@j3m-quantum/ui 1.0.0 → 1.3.1
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/README.md +248 -39
- package/cursor-rules-for-consumers.md +171 -28
- package/dist/index.cjs +3925 -409
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +671 -3
- package/dist/index.d.ts +671 -3
- package/dist/index.js +3820 -409
- package/dist/index.js.map +1 -1
- package/dist/styles/index.css +1540 -279
- package/package.json +5 -3
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var React15 = require('react');
|
|
4
4
|
var reactSlot = require('@radix-ui/react-slot');
|
|
5
5
|
var classVarianceAuthority = require('class-variance-authority');
|
|
6
6
|
var clsx = require('clsx');
|
|
@@ -18,6 +18,7 @@ var ToggleGroupPrimitive = require('@radix-ui/react-toggle-group');
|
|
|
18
18
|
var reactHookForm = require('react-hook-form');
|
|
19
19
|
var LabelPrimitive = require('@radix-ui/react-label');
|
|
20
20
|
var AvatarPrimitive = require('@radix-ui/react-avatar');
|
|
21
|
+
var DropdownMenuPrimitive = require('@radix-ui/react-dropdown-menu');
|
|
21
22
|
var AccordionPrimitive = require('@radix-ui/react-accordion');
|
|
22
23
|
var TabsPrimitive = require('@radix-ui/react-tabs');
|
|
23
24
|
var reactDayPicker = require('react-day-picker');
|
|
@@ -30,7 +31,6 @@ var TooltipPrimitive = require('@radix-ui/react-tooltip');
|
|
|
30
31
|
var sonner = require('sonner');
|
|
31
32
|
var cmdk = require('cmdk');
|
|
32
33
|
var DialogPrimitive = require('@radix-ui/react-dialog');
|
|
33
|
-
var DropdownMenuPrimitive = require('@radix-ui/react-dropdown-menu');
|
|
34
34
|
var MenubarPrimitive = require('@radix-ui/react-menubar');
|
|
35
35
|
var NavigationMenuPrimitive = require('@radix-ui/react-navigation-menu');
|
|
36
36
|
var ContextMenuPrimitive = require('@radix-ui/react-context-menu');
|
|
@@ -40,6 +40,7 @@ var HoverCardPrimitive = require('@radix-ui/react-hover-card');
|
|
|
40
40
|
var ScrollAreaPrimitive = require('@radix-ui/react-scroll-area');
|
|
41
41
|
var CollapsiblePrimitive = require('@radix-ui/react-collapsible');
|
|
42
42
|
var ResizablePrimitive = require('react-resizable-panels');
|
|
43
|
+
var dateFns = require('date-fns');
|
|
43
44
|
|
|
44
45
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
45
46
|
|
|
@@ -61,7 +62,7 @@ function _interopNamespace(e) {
|
|
|
61
62
|
return Object.freeze(n);
|
|
62
63
|
}
|
|
63
64
|
|
|
64
|
-
var
|
|
65
|
+
var React15__namespace = /*#__PURE__*/_interopNamespace(React15);
|
|
65
66
|
var SeparatorPrimitive__namespace = /*#__PURE__*/_interopNamespace(SeparatorPrimitive);
|
|
66
67
|
var CheckboxPrimitive__namespace = /*#__PURE__*/_interopNamespace(CheckboxPrimitive);
|
|
67
68
|
var RadioGroupPrimitive__namespace = /*#__PURE__*/_interopNamespace(RadioGroupPrimitive);
|
|
@@ -72,6 +73,7 @@ var TogglePrimitive__namespace = /*#__PURE__*/_interopNamespace(TogglePrimitive)
|
|
|
72
73
|
var ToggleGroupPrimitive__namespace = /*#__PURE__*/_interopNamespace(ToggleGroupPrimitive);
|
|
73
74
|
var LabelPrimitive__namespace = /*#__PURE__*/_interopNamespace(LabelPrimitive);
|
|
74
75
|
var AvatarPrimitive__namespace = /*#__PURE__*/_interopNamespace(AvatarPrimitive);
|
|
76
|
+
var DropdownMenuPrimitive__namespace = /*#__PURE__*/_interopNamespace(DropdownMenuPrimitive);
|
|
75
77
|
var AccordionPrimitive__namespace = /*#__PURE__*/_interopNamespace(AccordionPrimitive);
|
|
76
78
|
var TabsPrimitive__namespace = /*#__PURE__*/_interopNamespace(TabsPrimitive);
|
|
77
79
|
var useEmblaCarousel__default = /*#__PURE__*/_interopDefault(useEmblaCarousel);
|
|
@@ -81,7 +83,6 @@ var AlertDialogPrimitive__namespace = /*#__PURE__*/_interopNamespace(AlertDialog
|
|
|
81
83
|
var ProgressPrimitive__namespace = /*#__PURE__*/_interopNamespace(ProgressPrimitive);
|
|
82
84
|
var TooltipPrimitive__namespace = /*#__PURE__*/_interopNamespace(TooltipPrimitive);
|
|
83
85
|
var DialogPrimitive__namespace = /*#__PURE__*/_interopNamespace(DialogPrimitive);
|
|
84
|
-
var DropdownMenuPrimitive__namespace = /*#__PURE__*/_interopNamespace(DropdownMenuPrimitive);
|
|
85
86
|
var MenubarPrimitive__namespace = /*#__PURE__*/_interopNamespace(MenubarPrimitive);
|
|
86
87
|
var NavigationMenuPrimitive__namespace = /*#__PURE__*/_interopNamespace(NavigationMenuPrimitive);
|
|
87
88
|
var ContextMenuPrimitive__namespace = /*#__PURE__*/_interopNamespace(ContextMenuPrimitive);
|
|
@@ -94,8 +95,8 @@ var ResizablePrimitive__namespace = /*#__PURE__*/_interopNamespace(ResizablePrim
|
|
|
94
95
|
// src/hooks/use-mobile.ts
|
|
95
96
|
var MOBILE_BREAKPOINT = 768;
|
|
96
97
|
function useIsMobile() {
|
|
97
|
-
const [isMobile, setIsMobile] =
|
|
98
|
-
|
|
98
|
+
const [isMobile, setIsMobile] = React15__namespace.useState(void 0);
|
|
99
|
+
React15__namespace.useEffect(() => {
|
|
99
100
|
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
100
101
|
const onChange = () => {
|
|
101
102
|
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
@@ -114,10 +115,10 @@ var buttonVariants = classVarianceAuthority.cva(
|
|
|
114
115
|
{
|
|
115
116
|
variants: {
|
|
116
117
|
variant: {
|
|
117
|
-
default: "bg-primary text-primary-foreground
|
|
118
|
-
destructive: "bg-destructive text-destructive-foreground
|
|
119
|
-
outline: "border border-input bg-background
|
|
120
|
-
secondary: "bg-secondary text-secondary-foreground
|
|
118
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
119
|
+
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
120
|
+
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
121
|
+
secondary: "bg-secondary text-secondary-foreground border border-input hover:bg-secondary/80",
|
|
121
122
|
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
122
123
|
link: "text-primary underline-offset-4 hover:underline"
|
|
123
124
|
},
|
|
@@ -136,7 +137,7 @@ var buttonVariants = classVarianceAuthority.cva(
|
|
|
136
137
|
}
|
|
137
138
|
}
|
|
138
139
|
);
|
|
139
|
-
var Button =
|
|
140
|
+
var Button = React15__namespace.forwardRef(
|
|
140
141
|
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
141
142
|
const Comp = asChild ? reactSlot.Slot : "button";
|
|
142
143
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -244,7 +245,7 @@ function Input({ className, type, ...props }) {
|
|
|
244
245
|
type,
|
|
245
246
|
"data-slot": "input",
|
|
246
247
|
className: cn(
|
|
247
|
-
"file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-
|
|
248
|
+
"file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-4 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
248
249
|
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
249
250
|
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
250
251
|
className
|
|
@@ -500,7 +501,7 @@ function Slider({
|
|
|
500
501
|
max = 100,
|
|
501
502
|
...props
|
|
502
503
|
}) {
|
|
503
|
-
const _values =
|
|
504
|
+
const _values = React15__namespace.useMemo(
|
|
504
505
|
() => Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max],
|
|
505
506
|
[value, defaultValue, min, max]
|
|
506
507
|
);
|
|
@@ -536,7 +537,7 @@ function Slider({
|
|
|
536
537
|
)
|
|
537
538
|
}
|
|
538
539
|
),
|
|
539
|
-
Array.from({ length: _values.length }, (
|
|
540
|
+
Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
540
541
|
SliderPrimitive__namespace.Thumb,
|
|
541
542
|
{
|
|
542
543
|
"data-slot": "slider-thumb",
|
|
@@ -786,7 +787,7 @@ function Toggle({
|
|
|
786
787
|
}
|
|
787
788
|
);
|
|
788
789
|
}
|
|
789
|
-
var ToggleGroupContext =
|
|
790
|
+
var ToggleGroupContext = React15__namespace.createContext({
|
|
790
791
|
size: "default",
|
|
791
792
|
variant: "default",
|
|
792
793
|
spacing: 0
|
|
@@ -823,7 +824,7 @@ function ToggleGroupItem({
|
|
|
823
824
|
size,
|
|
824
825
|
...props
|
|
825
826
|
}) {
|
|
826
|
-
const context =
|
|
827
|
+
const context = React15__namespace.useContext(ToggleGroupContext);
|
|
827
828
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
828
829
|
ToggleGroupPrimitive__namespace.Item,
|
|
829
830
|
{
|
|
@@ -845,6 +846,125 @@ function ToggleGroupItem({
|
|
|
845
846
|
}
|
|
846
847
|
);
|
|
847
848
|
}
|
|
849
|
+
function ThemeSwitch({
|
|
850
|
+
checked,
|
|
851
|
+
defaultChecked = false,
|
|
852
|
+
onCheckedChange,
|
|
853
|
+
disabled = false,
|
|
854
|
+
className,
|
|
855
|
+
size = "default"
|
|
856
|
+
}) {
|
|
857
|
+
const [isChecked, setIsChecked] = React15__namespace.useState(defaultChecked);
|
|
858
|
+
const isControlled = checked !== void 0;
|
|
859
|
+
const currentChecked = isControlled ? checked : isChecked;
|
|
860
|
+
const handleClick = () => {
|
|
861
|
+
if (disabled) return;
|
|
862
|
+
const newValue = !currentChecked;
|
|
863
|
+
if (!isControlled) {
|
|
864
|
+
setIsChecked(newValue);
|
|
865
|
+
}
|
|
866
|
+
onCheckedChange?.(newValue);
|
|
867
|
+
};
|
|
868
|
+
const sizeClasses = {
|
|
869
|
+
sm: {
|
|
870
|
+
track: "h-5 w-9",
|
|
871
|
+
thumb: "size-4",
|
|
872
|
+
icon: "h-2.5 w-2.5",
|
|
873
|
+
translate: "data-[state=checked]:translate-x-4"
|
|
874
|
+
},
|
|
875
|
+
default: {
|
|
876
|
+
track: "h-6 w-11",
|
|
877
|
+
thumb: "size-5",
|
|
878
|
+
icon: "h-3 w-3",
|
|
879
|
+
translate: "data-[state=checked]:translate-x-5"
|
|
880
|
+
},
|
|
881
|
+
lg: {
|
|
882
|
+
track: "h-7 w-14",
|
|
883
|
+
thumb: "size-6",
|
|
884
|
+
icon: "h-3.5 w-3.5",
|
|
885
|
+
translate: "data-[state=checked]:translate-x-7"
|
|
886
|
+
}
|
|
887
|
+
};
|
|
888
|
+
const sizes = sizeClasses[size];
|
|
889
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
890
|
+
"button",
|
|
891
|
+
{
|
|
892
|
+
type: "button",
|
|
893
|
+
role: "switch",
|
|
894
|
+
"aria-checked": currentChecked,
|
|
895
|
+
"aria-label": currentChecked ? "Switch to light mode" : "Switch to dark mode",
|
|
896
|
+
"data-slot": "theme-switch",
|
|
897
|
+
"data-state": currentChecked ? "checked" : "unchecked",
|
|
898
|
+
disabled,
|
|
899
|
+
onClick: handleClick,
|
|
900
|
+
className: cn(
|
|
901
|
+
"peer inline-flex shrink-0 cursor-pointer items-center rounded-full",
|
|
902
|
+
"border border-transparent shadow-xs transition-all outline-none",
|
|
903
|
+
"focus-visible:ring-[3px] focus-visible:ring-ring/50",
|
|
904
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
905
|
+
"bg-input data-[state=checked]:bg-primary",
|
|
906
|
+
sizes.track,
|
|
907
|
+
className
|
|
908
|
+
),
|
|
909
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
910
|
+
"span",
|
|
911
|
+
{
|
|
912
|
+
"data-state": currentChecked ? "checked" : "unchecked",
|
|
913
|
+
className: cn(
|
|
914
|
+
"pointer-events-none flex items-center justify-center rounded-full",
|
|
915
|
+
"bg-white shadow-lg ring-0 transition-transform",
|
|
916
|
+
"data-[state=unchecked]:translate-x-0.5",
|
|
917
|
+
sizes.thumb,
|
|
918
|
+
sizes.translate
|
|
919
|
+
),
|
|
920
|
+
children: currentChecked ? /* @__PURE__ */ jsxRuntime.jsx(MoonIcon, { className: cn(sizes.icon, "text-primary") }) : /* @__PURE__ */ jsxRuntime.jsx(SunIcon, { className: cn(sizes.icon, "text-muted-foreground") })
|
|
921
|
+
}
|
|
922
|
+
)
|
|
923
|
+
}
|
|
924
|
+
);
|
|
925
|
+
}
|
|
926
|
+
function SunIcon({ className }) {
|
|
927
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
928
|
+
"svg",
|
|
929
|
+
{
|
|
930
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
931
|
+
viewBox: "0 0 24 24",
|
|
932
|
+
fill: "none",
|
|
933
|
+
stroke: "currentColor",
|
|
934
|
+
strokeWidth: "2",
|
|
935
|
+
strokeLinecap: "round",
|
|
936
|
+
strokeLinejoin: "round",
|
|
937
|
+
className,
|
|
938
|
+
children: [
|
|
939
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "4" }),
|
|
940
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 2v2" }),
|
|
941
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 20v2" }),
|
|
942
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "m4.93 4.93 1.41 1.41" }),
|
|
943
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "m17.66 17.66 1.41 1.41" }),
|
|
944
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M2 12h2" }),
|
|
945
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M20 12h2" }),
|
|
946
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "m6.34 17.66-1.41 1.41" }),
|
|
947
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "m19.07 4.93-1.41 1.41" })
|
|
948
|
+
]
|
|
949
|
+
}
|
|
950
|
+
);
|
|
951
|
+
}
|
|
952
|
+
function MoonIcon({ className }) {
|
|
953
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
954
|
+
"svg",
|
|
955
|
+
{
|
|
956
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
957
|
+
viewBox: "0 0 24 24",
|
|
958
|
+
fill: "none",
|
|
959
|
+
stroke: "currentColor",
|
|
960
|
+
strokeWidth: "2",
|
|
961
|
+
strokeLinecap: "round",
|
|
962
|
+
strokeLinejoin: "round",
|
|
963
|
+
className,
|
|
964
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z" })
|
|
965
|
+
}
|
|
966
|
+
);
|
|
967
|
+
}
|
|
848
968
|
function ToolBarCanvas({
|
|
849
969
|
className,
|
|
850
970
|
...props
|
|
@@ -854,7 +974,7 @@ function ToolBarCanvas({
|
|
|
854
974
|
{
|
|
855
975
|
"data-slot": "toolbar-canvas",
|
|
856
976
|
className: cn(
|
|
857
|
-
"inline-flex items-center gap-1 rounded-full bg-
|
|
977
|
+
"inline-flex items-center gap-1 rounded-full bg-background border border-input p-1.5",
|
|
858
978
|
className
|
|
859
979
|
),
|
|
860
980
|
...props
|
|
@@ -949,7 +1069,7 @@ function PlayerCanvasControls({
|
|
|
949
1069
|
{
|
|
950
1070
|
"data-slot": "player-canvas-controls",
|
|
951
1071
|
className: cn(
|
|
952
|
-
"flex items-center gap-2 px-1.5 py-1.5 rounded-full bg-
|
|
1072
|
+
"flex items-center gap-2 px-1.5 py-1.5 rounded-full bg-background border border-input",
|
|
953
1073
|
className
|
|
954
1074
|
),
|
|
955
1075
|
...props
|
|
@@ -990,7 +1110,7 @@ function PlayerCanvasPlayButton({
|
|
|
990
1110
|
className
|
|
991
1111
|
),
|
|
992
1112
|
style: {
|
|
993
|
-
backgroundColor: "
|
|
1113
|
+
backgroundColor: "var(--j3m-orange-8)",
|
|
994
1114
|
...style
|
|
995
1115
|
},
|
|
996
1116
|
...props,
|
|
@@ -1130,7 +1250,7 @@ function PlayerCanvasProgress({
|
|
|
1130
1250
|
className: "absolute inset-y-0 left-0 rounded-full transition-all duration-200",
|
|
1131
1251
|
style: {
|
|
1132
1252
|
width: `${percentage}%`,
|
|
1133
|
-
backgroundColor: "
|
|
1253
|
+
backgroundColor: "var(--j3m-orange-8)"
|
|
1134
1254
|
}
|
|
1135
1255
|
}
|
|
1136
1256
|
)
|
|
@@ -1154,7 +1274,7 @@ function Label2({
|
|
|
1154
1274
|
);
|
|
1155
1275
|
}
|
|
1156
1276
|
var Form = reactHookForm.FormProvider;
|
|
1157
|
-
var FormFieldContext =
|
|
1277
|
+
var FormFieldContext = React15__namespace.createContext(
|
|
1158
1278
|
{}
|
|
1159
1279
|
);
|
|
1160
1280
|
var FormField = ({
|
|
@@ -1163,8 +1283,8 @@ var FormField = ({
|
|
|
1163
1283
|
return /* @__PURE__ */ jsxRuntime.jsx(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsxRuntime.jsx(reactHookForm.Controller, { ...props }) });
|
|
1164
1284
|
};
|
|
1165
1285
|
var useFormField = () => {
|
|
1166
|
-
const fieldContext =
|
|
1167
|
-
const itemContext =
|
|
1286
|
+
const fieldContext = React15__namespace.useContext(FormFieldContext);
|
|
1287
|
+
const itemContext = React15__namespace.useContext(FormItemContext);
|
|
1168
1288
|
const { getFieldState } = reactHookForm.useFormContext();
|
|
1169
1289
|
const formState = reactHookForm.useFormState({ name: fieldContext.name });
|
|
1170
1290
|
const fieldState = getFieldState(fieldContext.name, formState);
|
|
@@ -1181,11 +1301,11 @@ var useFormField = () => {
|
|
|
1181
1301
|
...fieldState
|
|
1182
1302
|
};
|
|
1183
1303
|
};
|
|
1184
|
-
var FormItemContext =
|
|
1304
|
+
var FormItemContext = React15__namespace.createContext(
|
|
1185
1305
|
{}
|
|
1186
1306
|
);
|
|
1187
1307
|
function FormItem({ className, ...props }) {
|
|
1188
|
-
const id =
|
|
1308
|
+
const id = React15__namespace.useId();
|
|
1189
1309
|
return /* @__PURE__ */ jsxRuntime.jsx(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1190
1310
|
"div",
|
|
1191
1311
|
{
|
|
@@ -1433,7 +1553,7 @@ function FieldError({
|
|
|
1433
1553
|
errors,
|
|
1434
1554
|
...props
|
|
1435
1555
|
}) {
|
|
1436
|
-
const content =
|
|
1556
|
+
const content = React15.useMemo(() => {
|
|
1437
1557
|
if (children) {
|
|
1438
1558
|
return children;
|
|
1439
1559
|
}
|
|
@@ -1469,7 +1589,7 @@ var cardVariants = classVarianceAuthority.cva(
|
|
|
1469
1589
|
{
|
|
1470
1590
|
variants: {
|
|
1471
1591
|
variant: {
|
|
1472
|
-
default: "bg-card border
|
|
1592
|
+
default: "bg-card border",
|
|
1473
1593
|
glass: [
|
|
1474
1594
|
"glass-context",
|
|
1475
1595
|
// Enables glass semantic token overrides for children
|
|
@@ -1724,183 +1844,475 @@ function AvatarFallback({
|
|
|
1724
1844
|
}
|
|
1725
1845
|
);
|
|
1726
1846
|
}
|
|
1727
|
-
function
|
|
1847
|
+
function DropdownMenu({
|
|
1848
|
+
...props
|
|
1849
|
+
}) {
|
|
1850
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Root, { "data-slot": "dropdown-menu", ...props });
|
|
1851
|
+
}
|
|
1852
|
+
function DropdownMenuPortal({
|
|
1853
|
+
...props
|
|
1854
|
+
}) {
|
|
1855
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Portal, { "data-slot": "dropdown-menu-portal", ...props });
|
|
1856
|
+
}
|
|
1857
|
+
function DropdownMenuTrigger({
|
|
1858
|
+
...props
|
|
1859
|
+
}) {
|
|
1728
1860
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1729
|
-
|
|
1861
|
+
DropdownMenuPrimitive__namespace.Trigger,
|
|
1730
1862
|
{
|
|
1731
|
-
"data-slot": "
|
|
1732
|
-
className: cn("bg-accent animate-pulse rounded-md", className),
|
|
1863
|
+
"data-slot": "dropdown-menu-trigger",
|
|
1733
1864
|
...props
|
|
1734
1865
|
}
|
|
1735
1866
|
);
|
|
1736
1867
|
}
|
|
1737
|
-
function
|
|
1868
|
+
function DropdownMenuContent({
|
|
1869
|
+
className,
|
|
1870
|
+
sideOffset = 4,
|
|
1738
1871
|
...props
|
|
1739
1872
|
}) {
|
|
1740
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1873
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1874
|
+
DropdownMenuPrimitive__namespace.Content,
|
|
1875
|
+
{
|
|
1876
|
+
"data-slot": "dropdown-menu-content",
|
|
1877
|
+
sideOffset,
|
|
1878
|
+
className: cn(
|
|
1879
|
+
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",
|
|
1880
|
+
className
|
|
1881
|
+
),
|
|
1882
|
+
...props
|
|
1883
|
+
}
|
|
1884
|
+
) });
|
|
1741
1885
|
}
|
|
1742
|
-
function
|
|
1886
|
+
function DropdownMenuGroup({
|
|
1887
|
+
...props
|
|
1888
|
+
}) {
|
|
1889
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Group, { "data-slot": "dropdown-menu-group", ...props });
|
|
1890
|
+
}
|
|
1891
|
+
function DropdownMenuItem({
|
|
1743
1892
|
className,
|
|
1893
|
+
inset,
|
|
1894
|
+
variant = "default",
|
|
1744
1895
|
...props
|
|
1745
1896
|
}) {
|
|
1746
1897
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1747
|
-
|
|
1898
|
+
DropdownMenuPrimitive__namespace.Item,
|
|
1748
1899
|
{
|
|
1749
|
-
"data-slot": "
|
|
1750
|
-
|
|
1900
|
+
"data-slot": "dropdown-menu-item",
|
|
1901
|
+
"data-inset": inset,
|
|
1902
|
+
"data-variant": variant,
|
|
1903
|
+
className: cn(
|
|
1904
|
+
"focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
1905
|
+
className
|
|
1906
|
+
),
|
|
1751
1907
|
...props
|
|
1752
1908
|
}
|
|
1753
1909
|
);
|
|
1754
1910
|
}
|
|
1755
|
-
function
|
|
1911
|
+
function DropdownMenuCheckboxItem({
|
|
1756
1912
|
className,
|
|
1757
1913
|
children,
|
|
1914
|
+
checked,
|
|
1758
1915
|
...props
|
|
1759
1916
|
}) {
|
|
1760
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
1761
|
-
|
|
1917
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1918
|
+
DropdownMenuPrimitive__namespace.CheckboxItem,
|
|
1762
1919
|
{
|
|
1763
|
-
"data-slot": "
|
|
1920
|
+
"data-slot": "dropdown-menu-checkbox-item",
|
|
1764
1921
|
className: cn(
|
|
1765
|
-
"focus
|
|
1922
|
+
"focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
1766
1923
|
className
|
|
1767
1924
|
),
|
|
1925
|
+
checked,
|
|
1768
1926
|
...props,
|
|
1769
1927
|
children: [
|
|
1770
|
-
children,
|
|
1771
|
-
|
|
1928
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.ItemIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckIcon, { className: "size-4" }) }) }),
|
|
1929
|
+
children
|
|
1772
1930
|
]
|
|
1773
1931
|
}
|
|
1774
|
-
)
|
|
1932
|
+
);
|
|
1775
1933
|
}
|
|
1776
|
-
function
|
|
1934
|
+
function DropdownMenuRadioGroup({
|
|
1935
|
+
...props
|
|
1936
|
+
}) {
|
|
1937
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1938
|
+
DropdownMenuPrimitive__namespace.RadioGroup,
|
|
1939
|
+
{
|
|
1940
|
+
"data-slot": "dropdown-menu-radio-group",
|
|
1941
|
+
...props
|
|
1942
|
+
}
|
|
1943
|
+
);
|
|
1944
|
+
}
|
|
1945
|
+
function DropdownMenuRadioItem({
|
|
1777
1946
|
className,
|
|
1778
1947
|
children,
|
|
1779
1948
|
...props
|
|
1780
1949
|
}) {
|
|
1781
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
1782
|
-
|
|
1950
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1951
|
+
DropdownMenuPrimitive__namespace.RadioItem,
|
|
1783
1952
|
{
|
|
1784
|
-
"data-slot": "
|
|
1785
|
-
className:
|
|
1953
|
+
"data-slot": "dropdown-menu-radio-item",
|
|
1954
|
+
className: cn(
|
|
1955
|
+
"focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
1956
|
+
className
|
|
1957
|
+
),
|
|
1786
1958
|
...props,
|
|
1787
|
-
children:
|
|
1959
|
+
children: [
|
|
1960
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.ItemIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CircleIcon, { className: "size-2 fill-current" }) }) }),
|
|
1961
|
+
children
|
|
1962
|
+
]
|
|
1788
1963
|
}
|
|
1789
1964
|
);
|
|
1790
1965
|
}
|
|
1791
|
-
function
|
|
1966
|
+
function DropdownMenuLabel({
|
|
1792
1967
|
className,
|
|
1968
|
+
inset,
|
|
1793
1969
|
...props
|
|
1794
1970
|
}) {
|
|
1795
1971
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1796
|
-
|
|
1972
|
+
DropdownMenuPrimitive__namespace.Label,
|
|
1797
1973
|
{
|
|
1798
|
-
"data-slot": "
|
|
1799
|
-
|
|
1974
|
+
"data-slot": "dropdown-menu-label",
|
|
1975
|
+
"data-inset": inset,
|
|
1976
|
+
className: cn(
|
|
1977
|
+
"px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",
|
|
1978
|
+
className
|
|
1979
|
+
),
|
|
1800
1980
|
...props
|
|
1801
1981
|
}
|
|
1802
1982
|
);
|
|
1803
1983
|
}
|
|
1804
|
-
function
|
|
1984
|
+
function DropdownMenuSeparator({
|
|
1805
1985
|
className,
|
|
1806
1986
|
...props
|
|
1807
1987
|
}) {
|
|
1808
1988
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1809
|
-
|
|
1989
|
+
DropdownMenuPrimitive__namespace.Separator,
|
|
1810
1990
|
{
|
|
1811
|
-
"data-slot": "
|
|
1812
|
-
className: cn(
|
|
1813
|
-
"bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",
|
|
1814
|
-
className
|
|
1815
|
-
),
|
|
1991
|
+
"data-slot": "dropdown-menu-separator",
|
|
1992
|
+
className: cn("bg-border -mx-1 my-1 h-px", className),
|
|
1816
1993
|
...props
|
|
1817
1994
|
}
|
|
1818
1995
|
);
|
|
1819
1996
|
}
|
|
1820
|
-
function
|
|
1997
|
+
function DropdownMenuShortcut({
|
|
1821
1998
|
className,
|
|
1822
1999
|
...props
|
|
1823
2000
|
}) {
|
|
1824
2001
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1825
|
-
|
|
2002
|
+
"span",
|
|
1826
2003
|
{
|
|
1827
|
-
"data-slot": "
|
|
2004
|
+
"data-slot": "dropdown-menu-shortcut",
|
|
1828
2005
|
className: cn(
|
|
1829
|
-
"
|
|
2006
|
+
"text-muted-foreground ml-auto text-xs tracking-widest",
|
|
1830
2007
|
className
|
|
1831
2008
|
),
|
|
1832
2009
|
...props
|
|
1833
2010
|
}
|
|
1834
2011
|
);
|
|
1835
2012
|
}
|
|
1836
|
-
function
|
|
2013
|
+
function DropdownMenuSub({
|
|
2014
|
+
...props
|
|
2015
|
+
}) {
|
|
2016
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Sub, { "data-slot": "dropdown-menu-sub", ...props });
|
|
2017
|
+
}
|
|
2018
|
+
function DropdownMenuSubTrigger({
|
|
1837
2019
|
className,
|
|
2020
|
+
inset,
|
|
2021
|
+
children,
|
|
1838
2022
|
...props
|
|
1839
2023
|
}) {
|
|
1840
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
1841
|
-
|
|
2024
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2025
|
+
DropdownMenuPrimitive__namespace.SubTrigger,
|
|
1842
2026
|
{
|
|
1843
|
-
"data-slot": "
|
|
1844
|
-
|
|
1845
|
-
|
|
2027
|
+
"data-slot": "dropdown-menu-sub-trigger",
|
|
2028
|
+
"data-inset": inset,
|
|
2029
|
+
className: cn(
|
|
2030
|
+
"focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
2031
|
+
className
|
|
2032
|
+
),
|
|
2033
|
+
...props,
|
|
2034
|
+
children: [
|
|
2035
|
+
children,
|
|
2036
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRightIcon, { className: "ml-auto size-4" })
|
|
2037
|
+
]
|
|
1846
2038
|
}
|
|
1847
2039
|
);
|
|
1848
2040
|
}
|
|
1849
|
-
function
|
|
2041
|
+
function DropdownMenuSubContent({
|
|
1850
2042
|
className,
|
|
1851
|
-
classNames,
|
|
1852
|
-
showOutsideDays = true,
|
|
1853
|
-
captionLayout = "label",
|
|
1854
|
-
formatters,
|
|
1855
|
-
components,
|
|
1856
2043
|
...props
|
|
1857
2044
|
}) {
|
|
1858
|
-
const defaultClassNames = reactDayPicker.getDefaultClassNames();
|
|
1859
2045
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1860
|
-
|
|
2046
|
+
DropdownMenuPrimitive__namespace.SubContent,
|
|
1861
2047
|
{
|
|
1862
|
-
|
|
2048
|
+
"data-slot": "dropdown-menu-sub-content",
|
|
1863
2049
|
className: cn(
|
|
1864
|
-
"bg-
|
|
1865
|
-
String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
|
|
1866
|
-
String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
|
|
2050
|
+
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",
|
|
1867
2051
|
className
|
|
1868
2052
|
),
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
"flex items-center
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
2053
|
+
...props
|
|
2054
|
+
}
|
|
2055
|
+
);
|
|
2056
|
+
}
|
|
2057
|
+
function UserAvatarsDropdown({
|
|
2058
|
+
users,
|
|
2059
|
+
selectedUserId,
|
|
2060
|
+
onSelect,
|
|
2061
|
+
maxVisible = 2,
|
|
2062
|
+
label = "All",
|
|
2063
|
+
className
|
|
2064
|
+
}) {
|
|
2065
|
+
const visibleUsers = users.slice(0, maxVisible);
|
|
2066
|
+
const overflowCount = Math.max(0, users.length - maxVisible);
|
|
2067
|
+
const getInitials = (name) => {
|
|
2068
|
+
return name.split(" ").map((n) => n[0]).join("").toUpperCase().slice(0, 2);
|
|
2069
|
+
};
|
|
2070
|
+
const selectedUser = users.find((u) => u.id === selectedUserId);
|
|
2071
|
+
const displayLabel = selectedUserId ? selectedUser?.name || "User" : label;
|
|
2072
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { children: [
|
|
2073
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2074
|
+
"button",
|
|
2075
|
+
{
|
|
2076
|
+
type: "button",
|
|
2077
|
+
className: cn(
|
|
2078
|
+
"flex items-center gap-2 rounded border border-border bg-background px-3 py-1.5 text-sm transition-colors",
|
|
2079
|
+
"hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
2080
|
+
className
|
|
2081
|
+
),
|
|
2082
|
+
children: [
|
|
2083
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex -space-x-2", children: [
|
|
2084
|
+
visibleUsers.map((user) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2085
|
+
Avatar,
|
|
2086
|
+
{
|
|
2087
|
+
className: "size-6 border-2 border-background",
|
|
2088
|
+
children: [
|
|
2089
|
+
/* @__PURE__ */ jsxRuntime.jsx(AvatarImage, { src: user.image, alt: user.name }),
|
|
2090
|
+
/* @__PURE__ */ jsxRuntime.jsx(AvatarFallback, { className: "text-[10px]", children: getInitials(user.name) })
|
|
2091
|
+
]
|
|
2092
|
+
},
|
|
2093
|
+
user.id
|
|
2094
|
+
)),
|
|
2095
|
+
overflowCount > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex size-6 items-center justify-center rounded-full border-2 border-background bg-muted text-[10px] font-medium", children: [
|
|
2096
|
+
"+",
|
|
2097
|
+
overflowCount
|
|
2098
|
+
] })
|
|
2099
|
+
] }),
|
|
2100
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: displayLabel }),
|
|
2101
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, { className: "size-4 text-muted-foreground" })
|
|
2102
|
+
]
|
|
2103
|
+
}
|
|
2104
|
+
) }),
|
|
2105
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuContent, { align: "end", className: "w-48", children: [
|
|
2106
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2107
|
+
DropdownMenuItem,
|
|
2108
|
+
{
|
|
2109
|
+
onClick: () => onSelect(null),
|
|
2110
|
+
className: "flex items-center justify-between",
|
|
2111
|
+
children: [
|
|
2112
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "All users" }),
|
|
2113
|
+
selectedUserId === null && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckIcon, { className: "size-4" })
|
|
2114
|
+
]
|
|
2115
|
+
}
|
|
2116
|
+
),
|
|
2117
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuSeparator, {}),
|
|
2118
|
+
users.map((user) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2119
|
+
DropdownMenuItem,
|
|
2120
|
+
{
|
|
2121
|
+
onClick: () => onSelect(user.id),
|
|
2122
|
+
className: "flex items-center justify-between",
|
|
2123
|
+
children: [
|
|
2124
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
2125
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Avatar, { className: "size-5", children: [
|
|
2126
|
+
/* @__PURE__ */ jsxRuntime.jsx(AvatarImage, { src: user.image, alt: user.name }),
|
|
2127
|
+
/* @__PURE__ */ jsxRuntime.jsx(AvatarFallback, { className: "text-[8px]", children: getInitials(user.name) })
|
|
2128
|
+
] }),
|
|
2129
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: user.name })
|
|
2130
|
+
] }),
|
|
2131
|
+
selectedUserId === user.id && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckIcon, { className: "size-4" })
|
|
2132
|
+
]
|
|
2133
|
+
},
|
|
2134
|
+
user.id
|
|
2135
|
+
))
|
|
2136
|
+
] })
|
|
2137
|
+
] });
|
|
2138
|
+
}
|
|
2139
|
+
function Skeleton({ className, ...props }) {
|
|
2140
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2141
|
+
"div",
|
|
2142
|
+
{
|
|
2143
|
+
"data-slot": "skeleton",
|
|
2144
|
+
className: cn("bg-accent animate-pulse rounded-md", className),
|
|
2145
|
+
...props
|
|
2146
|
+
}
|
|
2147
|
+
);
|
|
2148
|
+
}
|
|
2149
|
+
function Accordion({
|
|
2150
|
+
...props
|
|
2151
|
+
}) {
|
|
2152
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AccordionPrimitive__namespace.Root, { "data-slot": "accordion", ...props });
|
|
2153
|
+
}
|
|
2154
|
+
function AccordionItem({
|
|
2155
|
+
className,
|
|
2156
|
+
...props
|
|
2157
|
+
}) {
|
|
2158
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2159
|
+
AccordionPrimitive__namespace.Item,
|
|
2160
|
+
{
|
|
2161
|
+
"data-slot": "accordion-item",
|
|
2162
|
+
className: cn("border-b last:border-b-0", className),
|
|
2163
|
+
...props
|
|
2164
|
+
}
|
|
2165
|
+
);
|
|
2166
|
+
}
|
|
2167
|
+
function AccordionTrigger({
|
|
2168
|
+
className,
|
|
2169
|
+
children,
|
|
2170
|
+
...props
|
|
2171
|
+
}) {
|
|
2172
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AccordionPrimitive__namespace.Header, { className: "flex", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2173
|
+
AccordionPrimitive__namespace.Trigger,
|
|
2174
|
+
{
|
|
2175
|
+
"data-slot": "accordion-trigger",
|
|
2176
|
+
className: cn(
|
|
2177
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180",
|
|
2178
|
+
className
|
|
2179
|
+
),
|
|
2180
|
+
...props,
|
|
2181
|
+
children: [
|
|
2182
|
+
children,
|
|
2183
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, { className: "text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200" })
|
|
2184
|
+
]
|
|
2185
|
+
}
|
|
2186
|
+
) });
|
|
2187
|
+
}
|
|
2188
|
+
function AccordionContent({
|
|
2189
|
+
className,
|
|
2190
|
+
children,
|
|
2191
|
+
...props
|
|
2192
|
+
}) {
|
|
2193
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2194
|
+
AccordionPrimitive__namespace.Content,
|
|
2195
|
+
{
|
|
2196
|
+
"data-slot": "accordion-content",
|
|
2197
|
+
className: "data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm",
|
|
2198
|
+
...props,
|
|
2199
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("pt-0 pb-4", className), children })
|
|
2200
|
+
}
|
|
2201
|
+
);
|
|
2202
|
+
}
|
|
2203
|
+
function Tabs({
|
|
2204
|
+
className,
|
|
2205
|
+
...props
|
|
2206
|
+
}) {
|
|
2207
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2208
|
+
TabsPrimitive__namespace.Root,
|
|
2209
|
+
{
|
|
2210
|
+
"data-slot": "tabs",
|
|
2211
|
+
className: cn("flex flex-col gap-2", className),
|
|
2212
|
+
...props
|
|
2213
|
+
}
|
|
2214
|
+
);
|
|
2215
|
+
}
|
|
2216
|
+
function TabsList({
|
|
2217
|
+
className,
|
|
2218
|
+
...props
|
|
2219
|
+
}) {
|
|
2220
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2221
|
+
TabsPrimitive__namespace.List,
|
|
2222
|
+
{
|
|
2223
|
+
"data-slot": "tabs-list",
|
|
2224
|
+
className: cn(
|
|
2225
|
+
"bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px] dark:bg-[#1a1a1a]",
|
|
2226
|
+
className
|
|
2227
|
+
),
|
|
2228
|
+
...props
|
|
2229
|
+
}
|
|
2230
|
+
);
|
|
2231
|
+
}
|
|
2232
|
+
function TabsTrigger({
|
|
2233
|
+
className,
|
|
2234
|
+
...props
|
|
2235
|
+
}) {
|
|
2236
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2237
|
+
TabsPrimitive__namespace.Trigger,
|
|
2238
|
+
{
|
|
2239
|
+
"data-slot": "tabs-trigger",
|
|
2240
|
+
className: cn(
|
|
2241
|
+
"data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:border-input data-[state=inactive]:hover:bg-accent data-[state=inactive]:hover:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
2242
|
+
className
|
|
2243
|
+
),
|
|
2244
|
+
...props
|
|
2245
|
+
}
|
|
2246
|
+
);
|
|
2247
|
+
}
|
|
2248
|
+
function TabsContent({
|
|
2249
|
+
className,
|
|
2250
|
+
...props
|
|
2251
|
+
}) {
|
|
2252
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2253
|
+
TabsPrimitive__namespace.Content,
|
|
2254
|
+
{
|
|
2255
|
+
"data-slot": "tabs-content",
|
|
2256
|
+
className: cn("flex-1 outline-none", className),
|
|
2257
|
+
...props
|
|
2258
|
+
}
|
|
2259
|
+
);
|
|
2260
|
+
}
|
|
2261
|
+
function Calendar({
|
|
2262
|
+
className,
|
|
2263
|
+
classNames,
|
|
2264
|
+
showOutsideDays = true,
|
|
2265
|
+
captionLayout = "label",
|
|
2266
|
+
formatters,
|
|
2267
|
+
components,
|
|
2268
|
+
...props
|
|
2269
|
+
}) {
|
|
2270
|
+
const defaultClassNames = reactDayPicker.getDefaultClassNames();
|
|
2271
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2272
|
+
reactDayPicker.DayPicker,
|
|
2273
|
+
{
|
|
2274
|
+
showOutsideDays,
|
|
2275
|
+
className: cn(
|
|
2276
|
+
"bg-card group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent",
|
|
2277
|
+
String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
|
|
2278
|
+
String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
|
|
2279
|
+
className
|
|
2280
|
+
),
|
|
2281
|
+
captionLayout,
|
|
2282
|
+
formatters: {
|
|
2283
|
+
formatMonthDropdown: (date) => date.toLocaleString("default", { month: "short" }),
|
|
2284
|
+
...formatters
|
|
2285
|
+
},
|
|
2286
|
+
classNames: {
|
|
2287
|
+
root: cn("w-fit", defaultClassNames.root),
|
|
2288
|
+
months: cn(
|
|
2289
|
+
"flex gap-4 flex-col md:flex-row relative",
|
|
2290
|
+
defaultClassNames.months
|
|
2291
|
+
),
|
|
2292
|
+
month: cn("flex flex-col w-full gap-4", defaultClassNames.month),
|
|
2293
|
+
nav: cn(
|
|
2294
|
+
"flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between",
|
|
2295
|
+
defaultClassNames.nav
|
|
2296
|
+
),
|
|
2297
|
+
button_previous: cn(
|
|
2298
|
+
"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none inline-flex items-center justify-center rounded-full hover:bg-muted/50 transition-colors",
|
|
2299
|
+
defaultClassNames.button_previous
|
|
2300
|
+
),
|
|
2301
|
+
button_next: cn(
|
|
2302
|
+
"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none inline-flex items-center justify-center rounded-full hover:bg-muted/50 transition-colors",
|
|
2303
|
+
defaultClassNames.button_next
|
|
2304
|
+
),
|
|
2305
|
+
month_caption: cn(
|
|
2306
|
+
"flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)",
|
|
2307
|
+
defaultClassNames.month_caption
|
|
2308
|
+
),
|
|
2309
|
+
dropdowns: cn(
|
|
2310
|
+
"w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5",
|
|
2311
|
+
defaultClassNames.dropdowns
|
|
2312
|
+
),
|
|
2313
|
+
dropdown_root: cn(
|
|
2314
|
+
"relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md",
|
|
2315
|
+
defaultClassNames.dropdown_root
|
|
1904
2316
|
),
|
|
1905
2317
|
dropdown: cn(
|
|
1906
2318
|
"absolute bg-popover inset-0 opacity-0",
|
|
@@ -1995,8 +2407,8 @@ function CalendarDayButton({
|
|
|
1995
2407
|
modifiers,
|
|
1996
2408
|
...props
|
|
1997
2409
|
}) {
|
|
1998
|
-
const ref =
|
|
1999
|
-
|
|
2410
|
+
const ref = React15__namespace.useRef(null);
|
|
2411
|
+
React15__namespace.useEffect(() => {
|
|
2000
2412
|
if (modifiers.focused) ref.current?.focus();
|
|
2001
2413
|
}, [modifiers.focused]);
|
|
2002
2414
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2017,9 +2429,9 @@ function CalendarDayButton({
|
|
|
2017
2429
|
}
|
|
2018
2430
|
);
|
|
2019
2431
|
}
|
|
2020
|
-
var CarouselContext =
|
|
2432
|
+
var CarouselContext = React15__namespace.createContext(null);
|
|
2021
2433
|
function useCarousel() {
|
|
2022
|
-
const context =
|
|
2434
|
+
const context = React15__namespace.useContext(CarouselContext);
|
|
2023
2435
|
if (!context) {
|
|
2024
2436
|
throw new Error("useCarousel must be used within a <Carousel />");
|
|
2025
2437
|
}
|
|
@@ -2041,20 +2453,20 @@ function Carousel({
|
|
|
2041
2453
|
},
|
|
2042
2454
|
plugins
|
|
2043
2455
|
);
|
|
2044
|
-
const [canScrollPrev, setCanScrollPrev] =
|
|
2045
|
-
const [canScrollNext, setCanScrollNext] =
|
|
2046
|
-
const onSelect =
|
|
2456
|
+
const [canScrollPrev, setCanScrollPrev] = React15__namespace.useState(false);
|
|
2457
|
+
const [canScrollNext, setCanScrollNext] = React15__namespace.useState(false);
|
|
2458
|
+
const onSelect = React15__namespace.useCallback((api2) => {
|
|
2047
2459
|
if (!api2) return;
|
|
2048
2460
|
setCanScrollPrev(api2.canScrollPrev());
|
|
2049
2461
|
setCanScrollNext(api2.canScrollNext());
|
|
2050
2462
|
}, []);
|
|
2051
|
-
const scrollPrev =
|
|
2463
|
+
const scrollPrev = React15__namespace.useCallback(() => {
|
|
2052
2464
|
api?.scrollPrev();
|
|
2053
2465
|
}, [api]);
|
|
2054
|
-
const scrollNext =
|
|
2466
|
+
const scrollNext = React15__namespace.useCallback(() => {
|
|
2055
2467
|
api?.scrollNext();
|
|
2056
2468
|
}, [api]);
|
|
2057
|
-
const handleKeyDown =
|
|
2469
|
+
const handleKeyDown = React15__namespace.useCallback(
|
|
2058
2470
|
(event) => {
|
|
2059
2471
|
if (event.key === "ArrowLeft") {
|
|
2060
2472
|
event.preventDefault();
|
|
@@ -2066,11 +2478,11 @@ function Carousel({
|
|
|
2066
2478
|
},
|
|
2067
2479
|
[scrollPrev, scrollNext]
|
|
2068
2480
|
);
|
|
2069
|
-
|
|
2481
|
+
React15__namespace.useEffect(() => {
|
|
2070
2482
|
if (!api || !setApi) return;
|
|
2071
2483
|
setApi(api);
|
|
2072
2484
|
}, [api, setApi]);
|
|
2073
|
-
|
|
2485
|
+
React15__namespace.useEffect(() => {
|
|
2074
2486
|
if (!api) return;
|
|
2075
2487
|
onSelect(api);
|
|
2076
2488
|
api.on("reInit", onSelect);
|
|
@@ -2203,9 +2615,9 @@ function CarouselNext({
|
|
|
2203
2615
|
);
|
|
2204
2616
|
}
|
|
2205
2617
|
var THEMES = { light: "", dark: ".dark" };
|
|
2206
|
-
var ChartContext =
|
|
2618
|
+
var ChartContext = React15__namespace.createContext(null);
|
|
2207
2619
|
function useChart() {
|
|
2208
|
-
const context =
|
|
2620
|
+
const context = React15__namespace.useContext(ChartContext);
|
|
2209
2621
|
if (!context) {
|
|
2210
2622
|
throw new Error("useChart must be used within a <ChartContainer />");
|
|
2211
2623
|
}
|
|
@@ -2218,7 +2630,7 @@ function ChartContainer({
|
|
|
2218
2630
|
config,
|
|
2219
2631
|
...props
|
|
2220
2632
|
}) {
|
|
2221
|
-
const uniqueId =
|
|
2633
|
+
const uniqueId = React15__namespace.useId();
|
|
2222
2634
|
const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`;
|
|
2223
2635
|
return /* @__PURE__ */ jsxRuntime.jsx(ChartContext.Provider, { value: { config }, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2224
2636
|
"div",
|
|
@@ -2279,7 +2691,7 @@ function ChartTooltipContent({
|
|
|
2279
2691
|
labelKey
|
|
2280
2692
|
}) {
|
|
2281
2693
|
const { config } = useChart();
|
|
2282
|
-
const tooltipLabel =
|
|
2694
|
+
const tooltipLabel = React15__namespace.useMemo(() => {
|
|
2283
2695
|
if (hideLabel || !payload?.length) {
|
|
2284
2696
|
return null;
|
|
2285
2697
|
}
|
|
@@ -2573,7 +2985,7 @@ var itemVariants = classVarianceAuthority.cva(
|
|
|
2573
2985
|
}
|
|
2574
2986
|
}
|
|
2575
2987
|
);
|
|
2576
|
-
function
|
|
2988
|
+
function Item6({
|
|
2577
2989
|
className,
|
|
2578
2990
|
variant = "default",
|
|
2579
2991
|
size = "default",
|
|
@@ -2981,40 +3393,27 @@ function TooltipContent({
|
|
|
2981
3393
|
}
|
|
2982
3394
|
) });
|
|
2983
3395
|
}
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
var x = React7__namespace.createContext(void 0);
|
|
3006
|
-
var U = { setTheme: (e) => {
|
|
3007
|
-
}, themes: [] };
|
|
3008
|
-
var z = () => {
|
|
3009
|
-
var e;
|
|
3010
|
-
return (e = React7__namespace.useContext(x)) != null ? e : U;
|
|
3011
|
-
};
|
|
3012
|
-
React7__namespace.memo(({ forcedTheme: e, storageKey: i, attribute: s, enableSystem: u, enableColorScheme: m, defaultTheme: a, value: l, themes: h, nonce: d, scriptProps: w }) => {
|
|
3013
|
-
let p = JSON.stringify([s, i, a, e, h, l, u, m]).slice(1, -1);
|
|
3014
|
-
return React7__namespace.createElement("script", { ...w, suppressHydrationWarning: true, nonce: typeof window == "undefined" ? d : "", dangerouslySetInnerHTML: { __html: `(${M.toString()})(${p})` } });
|
|
3015
|
-
});
|
|
3016
|
-
var Toaster = ({ ...props }) => {
|
|
3017
|
-
const { theme = "system" } = z();
|
|
3396
|
+
function useDetectTheme() {
|
|
3397
|
+
const [theme, setTheme] = React15__namespace.useState("light");
|
|
3398
|
+
React15__namespace.useEffect(() => {
|
|
3399
|
+
const isDark = document.documentElement.classList.contains("dark");
|
|
3400
|
+
setTheme(isDark ? "dark" : "light");
|
|
3401
|
+
const observer = new MutationObserver((mutations) => {
|
|
3402
|
+
mutations.forEach((mutation) => {
|
|
3403
|
+
if (mutation.attributeName === "class") {
|
|
3404
|
+
const isDark2 = document.documentElement.classList.contains("dark");
|
|
3405
|
+
setTheme(isDark2 ? "dark" : "light");
|
|
3406
|
+
}
|
|
3407
|
+
});
|
|
3408
|
+
});
|
|
3409
|
+
observer.observe(document.documentElement, { attributes: true });
|
|
3410
|
+
return () => observer.disconnect();
|
|
3411
|
+
}, []);
|
|
3412
|
+
return theme;
|
|
3413
|
+
}
|
|
3414
|
+
var Toaster = ({ theme: themeProp, ...props }) => {
|
|
3415
|
+
const detectedTheme = useDetectTheme();
|
|
3416
|
+
const theme = themeProp ?? detectedTheme;
|
|
3018
3417
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3019
3418
|
sonner.Toaster,
|
|
3020
3419
|
{
|
|
@@ -3517,241 +3916,78 @@ function CommandShortcut({
|
|
|
3517
3916
|
}
|
|
3518
3917
|
);
|
|
3519
3918
|
}
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3919
|
+
var SearchTrigger = React15__namespace.forwardRef(
|
|
3920
|
+
({
|
|
3921
|
+
className,
|
|
3922
|
+
placeholder = "Search...",
|
|
3923
|
+
showShortcut = true,
|
|
3924
|
+
shortcutKey = "K",
|
|
3925
|
+
shortcutModifier = "\u2318",
|
|
3926
|
+
...props
|
|
3927
|
+
}, ref) => {
|
|
3928
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3929
|
+
Button,
|
|
3930
|
+
{
|
|
3931
|
+
ref,
|
|
3932
|
+
variant: "outline",
|
|
3933
|
+
"data-slot": "search-trigger",
|
|
3934
|
+
className: cn(
|
|
3935
|
+
"relative h-9 w-full justify-start rounded-full bg-background text-sm text-muted-foreground",
|
|
3936
|
+
"sm:w-64 sm:max-w-[280px]",
|
|
3937
|
+
className
|
|
3938
|
+
),
|
|
3939
|
+
...props,
|
|
3940
|
+
children: [
|
|
3941
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.SearchIcon, { className: "mr-2 h-4 w-4 shrink-0" }),
|
|
3942
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "hidden truncate sm:inline-flex", children: placeholder }),
|
|
3943
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate sm:hidden", children: "Search" }),
|
|
3944
|
+
showShortcut && /* @__PURE__ */ jsxRuntime.jsxs(Kbd, { className: "pointer-events-none absolute right-2 hidden h-5 select-none items-center gap-0.5 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium sm:flex", children: [
|
|
3945
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs", children: shortcutModifier }),
|
|
3946
|
+
shortcutKey
|
|
3947
|
+
] })
|
|
3948
|
+
]
|
|
3949
|
+
}
|
|
3950
|
+
);
|
|
3951
|
+
}
|
|
3952
|
+
);
|
|
3953
|
+
SearchTrigger.displayName = "SearchTrigger";
|
|
3954
|
+
function useSearchShortcut(onOpen, key = "k") {
|
|
3955
|
+
React15__namespace.useEffect(() => {
|
|
3956
|
+
const down = (e) => {
|
|
3957
|
+
if (e.key.toLowerCase() === key.toLowerCase() && (e.metaKey || e.ctrlKey)) {
|
|
3958
|
+
e.preventDefault();
|
|
3959
|
+
onOpen();
|
|
3960
|
+
}
|
|
3961
|
+
};
|
|
3962
|
+
document.addEventListener("keydown", down);
|
|
3963
|
+
return () => document.removeEventListener("keydown", down);
|
|
3964
|
+
}, [onOpen, key]);
|
|
3529
3965
|
}
|
|
3530
|
-
function
|
|
3966
|
+
function Menubar({
|
|
3967
|
+
className,
|
|
3531
3968
|
...props
|
|
3532
3969
|
}) {
|
|
3533
3970
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3534
|
-
|
|
3971
|
+
MenubarPrimitive__namespace.Root,
|
|
3535
3972
|
{
|
|
3536
|
-
"data-slot": "
|
|
3973
|
+
"data-slot": "menubar",
|
|
3974
|
+
className: cn(
|
|
3975
|
+
"bg-background flex h-9 items-center gap-1 rounded-md border p-1 shadow-xs",
|
|
3976
|
+
className
|
|
3977
|
+
),
|
|
3537
3978
|
...props
|
|
3538
3979
|
}
|
|
3539
3980
|
);
|
|
3540
3981
|
}
|
|
3541
|
-
function
|
|
3542
|
-
className,
|
|
3543
|
-
sideOffset = 4,
|
|
3982
|
+
function MenubarMenu({
|
|
3544
3983
|
...props
|
|
3545
3984
|
}) {
|
|
3546
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3547
|
-
DropdownMenuPrimitive__namespace.Content,
|
|
3548
|
-
{
|
|
3549
|
-
"data-slot": "dropdown-menu-content",
|
|
3550
|
-
sideOffset,
|
|
3551
|
-
className: cn(
|
|
3552
|
-
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",
|
|
3553
|
-
className
|
|
3554
|
-
),
|
|
3555
|
-
...props
|
|
3556
|
-
}
|
|
3557
|
-
) });
|
|
3985
|
+
return /* @__PURE__ */ jsxRuntime.jsx(MenubarPrimitive__namespace.Menu, { "data-slot": "menubar-menu", ...props });
|
|
3558
3986
|
}
|
|
3559
|
-
function
|
|
3987
|
+
function MenubarGroup({
|
|
3560
3988
|
...props
|
|
3561
3989
|
}) {
|
|
3562
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3563
|
-
}
|
|
3564
|
-
function DropdownMenuItem({
|
|
3565
|
-
className,
|
|
3566
|
-
inset,
|
|
3567
|
-
variant = "default",
|
|
3568
|
-
...props
|
|
3569
|
-
}) {
|
|
3570
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3571
|
-
DropdownMenuPrimitive__namespace.Item,
|
|
3572
|
-
{
|
|
3573
|
-
"data-slot": "dropdown-menu-item",
|
|
3574
|
-
"data-inset": inset,
|
|
3575
|
-
"data-variant": variant,
|
|
3576
|
-
className: cn(
|
|
3577
|
-
"focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
3578
|
-
className
|
|
3579
|
-
),
|
|
3580
|
-
...props
|
|
3581
|
-
}
|
|
3582
|
-
);
|
|
3583
|
-
}
|
|
3584
|
-
function DropdownMenuCheckboxItem({
|
|
3585
|
-
className,
|
|
3586
|
-
children,
|
|
3587
|
-
checked,
|
|
3588
|
-
...props
|
|
3589
|
-
}) {
|
|
3590
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3591
|
-
DropdownMenuPrimitive__namespace.CheckboxItem,
|
|
3592
|
-
{
|
|
3593
|
-
"data-slot": "dropdown-menu-checkbox-item",
|
|
3594
|
-
className: cn(
|
|
3595
|
-
"focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
3596
|
-
className
|
|
3597
|
-
),
|
|
3598
|
-
checked,
|
|
3599
|
-
...props,
|
|
3600
|
-
children: [
|
|
3601
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.ItemIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckIcon, { className: "size-4" }) }) }),
|
|
3602
|
-
children
|
|
3603
|
-
]
|
|
3604
|
-
}
|
|
3605
|
-
);
|
|
3606
|
-
}
|
|
3607
|
-
function DropdownMenuRadioGroup({
|
|
3608
|
-
...props
|
|
3609
|
-
}) {
|
|
3610
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3611
|
-
DropdownMenuPrimitive__namespace.RadioGroup,
|
|
3612
|
-
{
|
|
3613
|
-
"data-slot": "dropdown-menu-radio-group",
|
|
3614
|
-
...props
|
|
3615
|
-
}
|
|
3616
|
-
);
|
|
3617
|
-
}
|
|
3618
|
-
function DropdownMenuRadioItem({
|
|
3619
|
-
className,
|
|
3620
|
-
children,
|
|
3621
|
-
...props
|
|
3622
|
-
}) {
|
|
3623
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3624
|
-
DropdownMenuPrimitive__namespace.RadioItem,
|
|
3625
|
-
{
|
|
3626
|
-
"data-slot": "dropdown-menu-radio-item",
|
|
3627
|
-
className: cn(
|
|
3628
|
-
"focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
3629
|
-
className
|
|
3630
|
-
),
|
|
3631
|
-
...props,
|
|
3632
|
-
children: [
|
|
3633
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.ItemIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CircleIcon, { className: "size-2 fill-current" }) }) }),
|
|
3634
|
-
children
|
|
3635
|
-
]
|
|
3636
|
-
}
|
|
3637
|
-
);
|
|
3638
|
-
}
|
|
3639
|
-
function DropdownMenuLabel({
|
|
3640
|
-
className,
|
|
3641
|
-
inset,
|
|
3642
|
-
...props
|
|
3643
|
-
}) {
|
|
3644
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3645
|
-
DropdownMenuPrimitive__namespace.Label,
|
|
3646
|
-
{
|
|
3647
|
-
"data-slot": "dropdown-menu-label",
|
|
3648
|
-
"data-inset": inset,
|
|
3649
|
-
className: cn(
|
|
3650
|
-
"px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",
|
|
3651
|
-
className
|
|
3652
|
-
),
|
|
3653
|
-
...props
|
|
3654
|
-
}
|
|
3655
|
-
);
|
|
3656
|
-
}
|
|
3657
|
-
function DropdownMenuSeparator({
|
|
3658
|
-
className,
|
|
3659
|
-
...props
|
|
3660
|
-
}) {
|
|
3661
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3662
|
-
DropdownMenuPrimitive__namespace.Separator,
|
|
3663
|
-
{
|
|
3664
|
-
"data-slot": "dropdown-menu-separator",
|
|
3665
|
-
className: cn("bg-border -mx-1 my-1 h-px", className),
|
|
3666
|
-
...props
|
|
3667
|
-
}
|
|
3668
|
-
);
|
|
3669
|
-
}
|
|
3670
|
-
function DropdownMenuShortcut({
|
|
3671
|
-
className,
|
|
3672
|
-
...props
|
|
3673
|
-
}) {
|
|
3674
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3675
|
-
"span",
|
|
3676
|
-
{
|
|
3677
|
-
"data-slot": "dropdown-menu-shortcut",
|
|
3678
|
-
className: cn(
|
|
3679
|
-
"text-muted-foreground ml-auto text-xs tracking-widest",
|
|
3680
|
-
className
|
|
3681
|
-
),
|
|
3682
|
-
...props
|
|
3683
|
-
}
|
|
3684
|
-
);
|
|
3685
|
-
}
|
|
3686
|
-
function DropdownMenuSub({
|
|
3687
|
-
...props
|
|
3688
|
-
}) {
|
|
3689
|
-
return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Sub, { "data-slot": "dropdown-menu-sub", ...props });
|
|
3690
|
-
}
|
|
3691
|
-
function DropdownMenuSubTrigger({
|
|
3692
|
-
className,
|
|
3693
|
-
inset,
|
|
3694
|
-
children,
|
|
3695
|
-
...props
|
|
3696
|
-
}) {
|
|
3697
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3698
|
-
DropdownMenuPrimitive__namespace.SubTrigger,
|
|
3699
|
-
{
|
|
3700
|
-
"data-slot": "dropdown-menu-sub-trigger",
|
|
3701
|
-
"data-inset": inset,
|
|
3702
|
-
className: cn(
|
|
3703
|
-
"focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
3704
|
-
className
|
|
3705
|
-
),
|
|
3706
|
-
...props,
|
|
3707
|
-
children: [
|
|
3708
|
-
children,
|
|
3709
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRightIcon, { className: "ml-auto size-4" })
|
|
3710
|
-
]
|
|
3711
|
-
}
|
|
3712
|
-
);
|
|
3713
|
-
}
|
|
3714
|
-
function DropdownMenuSubContent({
|
|
3715
|
-
className,
|
|
3716
|
-
...props
|
|
3717
|
-
}) {
|
|
3718
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3719
|
-
DropdownMenuPrimitive__namespace.SubContent,
|
|
3720
|
-
{
|
|
3721
|
-
"data-slot": "dropdown-menu-sub-content",
|
|
3722
|
-
className: cn(
|
|
3723
|
-
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",
|
|
3724
|
-
className
|
|
3725
|
-
),
|
|
3726
|
-
...props
|
|
3727
|
-
}
|
|
3728
|
-
);
|
|
3729
|
-
}
|
|
3730
|
-
function Menubar({
|
|
3731
|
-
className,
|
|
3732
|
-
...props
|
|
3733
|
-
}) {
|
|
3734
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3735
|
-
MenubarPrimitive__namespace.Root,
|
|
3736
|
-
{
|
|
3737
|
-
"data-slot": "menubar",
|
|
3738
|
-
className: cn(
|
|
3739
|
-
"bg-background flex h-9 items-center gap-1 rounded-md border p-1 shadow-xs",
|
|
3740
|
-
className
|
|
3741
|
-
),
|
|
3742
|
-
...props
|
|
3743
|
-
}
|
|
3744
|
-
);
|
|
3745
|
-
}
|
|
3746
|
-
function MenubarMenu({
|
|
3747
|
-
...props
|
|
3748
|
-
}) {
|
|
3749
|
-
return /* @__PURE__ */ jsxRuntime.jsx(MenubarPrimitive__namespace.Menu, { "data-slot": "menubar-menu", ...props });
|
|
3750
|
-
}
|
|
3751
|
-
function MenubarGroup({
|
|
3752
|
-
...props
|
|
3753
|
-
}) {
|
|
3754
|
-
return /* @__PURE__ */ jsxRuntime.jsx(MenubarPrimitive__namespace.Group, { "data-slot": "menubar-group", ...props });
|
|
3990
|
+
return /* @__PURE__ */ jsxRuntime.jsx(MenubarPrimitive__namespace.Group, { "data-slot": "menubar-group", ...props });
|
|
3755
3991
|
}
|
|
3756
3992
|
function MenubarPortal({
|
|
3757
3993
|
...props
|
|
@@ -4744,9 +4980,9 @@ var SIDEBAR_WIDTH = "16rem";
|
|
|
4744
4980
|
var SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
4745
4981
|
var SIDEBAR_WIDTH_ICON = "3rem";
|
|
4746
4982
|
var SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
4747
|
-
var SidebarContext =
|
|
4983
|
+
var SidebarContext = React15__namespace.createContext(null);
|
|
4748
4984
|
function useSidebar() {
|
|
4749
|
-
const context =
|
|
4985
|
+
const context = React15__namespace.useContext(SidebarContext);
|
|
4750
4986
|
if (!context) {
|
|
4751
4987
|
throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
4752
4988
|
}
|
|
@@ -4762,10 +4998,10 @@ function SidebarProvider({
|
|
|
4762
4998
|
...props
|
|
4763
4999
|
}) {
|
|
4764
5000
|
const isMobile = useIsMobile();
|
|
4765
|
-
const [openMobile, setOpenMobile] =
|
|
4766
|
-
const [_open, _setOpen] =
|
|
5001
|
+
const [openMobile, setOpenMobile] = React15__namespace.useState(false);
|
|
5002
|
+
const [_open, _setOpen] = React15__namespace.useState(defaultOpen);
|
|
4767
5003
|
const open = openProp ?? _open;
|
|
4768
|
-
const setOpen =
|
|
5004
|
+
const setOpen = React15__namespace.useCallback(
|
|
4769
5005
|
(value) => {
|
|
4770
5006
|
const openState = typeof value === "function" ? value(open) : value;
|
|
4771
5007
|
if (setOpenProp) {
|
|
@@ -4777,10 +5013,10 @@ function SidebarProvider({
|
|
|
4777
5013
|
},
|
|
4778
5014
|
[setOpenProp, open]
|
|
4779
5015
|
);
|
|
4780
|
-
const toggleSidebar =
|
|
5016
|
+
const toggleSidebar = React15__namespace.useCallback(() => {
|
|
4781
5017
|
return isMobile ? setOpenMobile((open2) => !open2) : setOpen((open2) => !open2);
|
|
4782
5018
|
}, [isMobile, setOpen, setOpenMobile]);
|
|
4783
|
-
|
|
5019
|
+
React15__namespace.useEffect(() => {
|
|
4784
5020
|
const handleKeyDown = (event) => {
|
|
4785
5021
|
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
4786
5022
|
event.preventDefault();
|
|
@@ -4791,7 +5027,7 @@ function SidebarProvider({
|
|
|
4791
5027
|
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
4792
5028
|
}, [toggleSidebar]);
|
|
4793
5029
|
const state = open ? "expanded" : "collapsed";
|
|
4794
|
-
const contextValue =
|
|
5030
|
+
const contextValue = React15__namespace.useMemo(
|
|
4795
5031
|
() => ({
|
|
4796
5032
|
state,
|
|
4797
5033
|
open,
|
|
@@ -5249,7 +5485,7 @@ function SidebarMenuSkeleton({
|
|
|
5249
5485
|
showIcon = false,
|
|
5250
5486
|
...props
|
|
5251
5487
|
}) {
|
|
5252
|
-
const width =
|
|
5488
|
+
const width = React15__namespace.useMemo(() => {
|
|
5253
5489
|
return `${Math.floor(Math.random() * 40) + 50}%`;
|
|
5254
5490
|
}, []);
|
|
5255
5491
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -5347,8 +5583,7 @@ var sectionVariants = classVarianceAuthority.cva(
|
|
|
5347
5583
|
default: [
|
|
5348
5584
|
"bg-[var(--color-bg-surface)]",
|
|
5349
5585
|
"border border-[var(--color-border-subtle)]",
|
|
5350
|
-
"text-[var(--color-text-main)]"
|
|
5351
|
-
"shadow-sm"
|
|
5586
|
+
"text-[var(--color-text-main)]"
|
|
5352
5587
|
].join(" "),
|
|
5353
5588
|
// Glass Light - frosted glass for dark or image backgrounds
|
|
5354
5589
|
"glass-light": [
|
|
@@ -5393,7 +5628,7 @@ var sectionVariants = classVarianceAuthority.cva(
|
|
|
5393
5628
|
}
|
|
5394
5629
|
);
|
|
5395
5630
|
var isGlassVariant = (variant) => variant?.startsWith("glass-") ?? false;
|
|
5396
|
-
var Section =
|
|
5631
|
+
var Section = React15__namespace.forwardRef(
|
|
5397
5632
|
({ className, variant, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
5398
5633
|
"section",
|
|
5399
5634
|
{
|
|
@@ -5405,7 +5640,7 @@ var Section = React7__namespace.forwardRef(
|
|
|
5405
5640
|
)
|
|
5406
5641
|
);
|
|
5407
5642
|
Section.displayName = "Section";
|
|
5408
|
-
var SectionHeader =
|
|
5643
|
+
var SectionHeader = React15__namespace.forwardRef(
|
|
5409
5644
|
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
5410
5645
|
"div",
|
|
5411
5646
|
{
|
|
@@ -5420,7 +5655,7 @@ var SectionHeader = React7__namespace.forwardRef(
|
|
|
5420
5655
|
)
|
|
5421
5656
|
);
|
|
5422
5657
|
SectionHeader.displayName = "SectionHeader";
|
|
5423
|
-
var SectionTitle =
|
|
5658
|
+
var SectionTitle = React15__namespace.forwardRef(
|
|
5424
5659
|
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
5425
5660
|
"h2",
|
|
5426
5661
|
{
|
|
@@ -5434,7 +5669,7 @@ var SectionTitle = React7__namespace.forwardRef(
|
|
|
5434
5669
|
)
|
|
5435
5670
|
);
|
|
5436
5671
|
SectionTitle.displayName = "SectionTitle";
|
|
5437
|
-
var SectionDescription =
|
|
5672
|
+
var SectionDescription = React15__namespace.forwardRef(
|
|
5438
5673
|
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
5439
5674
|
"p",
|
|
5440
5675
|
{
|
|
@@ -5448,7 +5683,7 @@ var SectionDescription = React7__namespace.forwardRef(
|
|
|
5448
5683
|
)
|
|
5449
5684
|
);
|
|
5450
5685
|
SectionDescription.displayName = "SectionDescription";
|
|
5451
|
-
var SectionContent =
|
|
5686
|
+
var SectionContent = React15__namespace.forwardRef(
|
|
5452
5687
|
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
5453
5688
|
"div",
|
|
5454
5689
|
{
|
|
@@ -5462,7 +5697,7 @@ var SectionContent = React7__namespace.forwardRef(
|
|
|
5462
5697
|
)
|
|
5463
5698
|
);
|
|
5464
5699
|
SectionContent.displayName = "SectionContent";
|
|
5465
|
-
var SectionFooter =
|
|
5700
|
+
var SectionFooter = React15__namespace.forwardRef(
|
|
5466
5701
|
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
5467
5702
|
"div",
|
|
5468
5703
|
{
|
|
@@ -5478,11 +5713,3215 @@ var SectionFooter = React7__namespace.forwardRef(
|
|
|
5478
5713
|
)
|
|
5479
5714
|
);
|
|
5480
5715
|
SectionFooter.displayName = "SectionFooter";
|
|
5716
|
+
function SearchForm({ ...props }) {
|
|
5717
|
+
return /* @__PURE__ */ jsxRuntime.jsx("form", { ...props, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
5718
|
+
/* @__PURE__ */ jsxRuntime.jsx(Label2, { htmlFor: "search", className: "sr-only", children: "Search" }),
|
|
5719
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5720
|
+
SidebarInput,
|
|
5721
|
+
{
|
|
5722
|
+
id: "search",
|
|
5723
|
+
placeholder: "Type to search...",
|
|
5724
|
+
className: "h-8 pl-7"
|
|
5725
|
+
}
|
|
5726
|
+
),
|
|
5727
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.SearchIcon, { className: "pointer-events-none absolute top-1/2 left-2 size-4 -translate-y-1/2 opacity-50 select-none" })
|
|
5728
|
+
] }) });
|
|
5729
|
+
}
|
|
5730
|
+
function SiteHeader({
|
|
5731
|
+
trigger,
|
|
5732
|
+
breadcrumbs = [
|
|
5733
|
+
{ label: "Building Your Application", href: "#" },
|
|
5734
|
+
{ label: "Data Fetching" }
|
|
5735
|
+
],
|
|
5736
|
+
showSearch = true,
|
|
5737
|
+
className,
|
|
5738
|
+
children
|
|
5739
|
+
}) {
|
|
5740
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5741
|
+
"header",
|
|
5742
|
+
{
|
|
5743
|
+
"data-slot": "site-header",
|
|
5744
|
+
className: cn(
|
|
5745
|
+
"bg-sidebar text-sidebar-foreground sticky top-0 z-50 flex w-full items-center border-b border-sidebar-border",
|
|
5746
|
+
className
|
|
5747
|
+
),
|
|
5748
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-[var(--header-height,3.5rem)] w-full items-center gap-[var(--j3m-spacing-s)] px-[var(--j3m-spacing-m)]", children: [
|
|
5749
|
+
trigger,
|
|
5750
|
+
trigger && /* @__PURE__ */ jsxRuntime.jsx(Separator, { orientation: "vertical", className: "mr-[var(--j3m-spacing-s)] h-4" }),
|
|
5751
|
+
/* @__PURE__ */ jsxRuntime.jsx(Breadcrumb, { className: "hidden sm:block", children: /* @__PURE__ */ jsxRuntime.jsx(BreadcrumbList, { children: breadcrumbs.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs(React15__namespace.Fragment, { children: [
|
|
5752
|
+
index > 0 && /* @__PURE__ */ jsxRuntime.jsx(BreadcrumbSeparator, {}),
|
|
5753
|
+
/* @__PURE__ */ jsxRuntime.jsx(BreadcrumbItem, { children: item.href ? /* @__PURE__ */ jsxRuntime.jsx(BreadcrumbLink, { href: item.href, children: item.label }) : /* @__PURE__ */ jsxRuntime.jsx(BreadcrumbPage, { children: item.label }) })
|
|
5754
|
+
] }, index)) }) }),
|
|
5755
|
+
showSearch && /* @__PURE__ */ jsxRuntime.jsx(SearchForm, { className: "w-full sm:ml-auto sm:w-auto" }),
|
|
5756
|
+
children
|
|
5757
|
+
] })
|
|
5758
|
+
}
|
|
5759
|
+
);
|
|
5760
|
+
}
|
|
5761
|
+
function NavMain({ items, label = "Platform" }) {
|
|
5762
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(SidebarGroup, { children: [
|
|
5763
|
+
/* @__PURE__ */ jsxRuntime.jsx(SidebarGroupLabel, { children: label }),
|
|
5764
|
+
/* @__PURE__ */ jsxRuntime.jsx(SidebarMenu, { children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsx(Collapsible, { asChild: true, defaultOpen: item.isActive, children: /* @__PURE__ */ jsxRuntime.jsxs(SidebarMenuItem, { children: [
|
|
5765
|
+
/* @__PURE__ */ jsxRuntime.jsx(SidebarMenuButton, { asChild: true, tooltip: item.title, children: /* @__PURE__ */ jsxRuntime.jsxs("a", { href: item.url, children: [
|
|
5766
|
+
item.icon && /* @__PURE__ */ jsxRuntime.jsx(item.icon, {}),
|
|
5767
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: item.title })
|
|
5768
|
+
] }) }),
|
|
5769
|
+
item.items?.length ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5770
|
+
/* @__PURE__ */ jsxRuntime.jsx(CollapsibleTrigger2, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(SidebarMenuAction, { className: "data-[state=open]:rotate-90", children: [
|
|
5771
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRightIcon, {}),
|
|
5772
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Toggle" })
|
|
5773
|
+
] }) }),
|
|
5774
|
+
/* @__PURE__ */ jsxRuntime.jsx(CollapsibleContent2, { children: /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuSub, { children: item.items?.map((subItem) => /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuSubItem, { children: /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuSubButton, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("a", { href: subItem.url, children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: subItem.title }) }) }) }, subItem.title)) }) })
|
|
5775
|
+
] }) : null
|
|
5776
|
+
] }) }, item.title)) })
|
|
5777
|
+
] });
|
|
5778
|
+
}
|
|
5779
|
+
function NavProjects({ projects, label = "Projects" }) {
|
|
5780
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(SidebarGroup, { className: "group-data-[collapsible=icon]:hidden", children: [
|
|
5781
|
+
/* @__PURE__ */ jsxRuntime.jsx(SidebarGroupLabel, { children: label }),
|
|
5782
|
+
/* @__PURE__ */ jsxRuntime.jsxs(SidebarMenu, { children: [
|
|
5783
|
+
projects.map((item) => /* @__PURE__ */ jsxRuntime.jsxs(SidebarMenuItem, { children: [
|
|
5784
|
+
/* @__PURE__ */ jsxRuntime.jsx(SidebarMenuButton, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs("a", { href: item.url, children: [
|
|
5785
|
+
/* @__PURE__ */ jsxRuntime.jsx(item.icon, {}),
|
|
5786
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: item.name })
|
|
5787
|
+
] }) }),
|
|
5788
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { children: [
|
|
5789
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(SidebarMenuAction, { showOnHover: true, children: [
|
|
5790
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.MoreHorizontalIcon, {}),
|
|
5791
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "More" })
|
|
5792
|
+
] }) }),
|
|
5793
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
5794
|
+
DropdownMenuContent,
|
|
5795
|
+
{
|
|
5796
|
+
className: "w-48 rounded-[var(--j3m-radius-m)]",
|
|
5797
|
+
side: "right",
|
|
5798
|
+
align: "start",
|
|
5799
|
+
sideOffset: 8,
|
|
5800
|
+
children: [
|
|
5801
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuItem, { children: [
|
|
5802
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.FolderIcon, { className: "text-muted-foreground" }),
|
|
5803
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "View Project" })
|
|
5804
|
+
] }),
|
|
5805
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuItem, { children: [
|
|
5806
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ShareIcon, { className: "text-muted-foreground" }),
|
|
5807
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Share Project" })
|
|
5808
|
+
] }),
|
|
5809
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuSeparator, {}),
|
|
5810
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuItem, { children: [
|
|
5811
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.TrashIcon, { className: "text-muted-foreground" }),
|
|
5812
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Delete Project" })
|
|
5813
|
+
] })
|
|
5814
|
+
]
|
|
5815
|
+
}
|
|
5816
|
+
)
|
|
5817
|
+
] })
|
|
5818
|
+
] }, item.name)),
|
|
5819
|
+
/* @__PURE__ */ jsxRuntime.jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxRuntime.jsxs(SidebarMenuButton, { className: "text-sidebar-foreground/70", children: [
|
|
5820
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.MoreHorizontalIcon, { className: "text-sidebar-foreground/70" }),
|
|
5821
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "More" })
|
|
5822
|
+
] }) })
|
|
5823
|
+
] })
|
|
5824
|
+
] });
|
|
5825
|
+
}
|
|
5826
|
+
function NavSecondary({ items, ...props }) {
|
|
5827
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SidebarGroup, { ...props, children: /* @__PURE__ */ jsxRuntime.jsx(SidebarGroupContent, { children: /* @__PURE__ */ jsxRuntime.jsx(SidebarMenu, { children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuButton, { asChild: true, size: "sm", children: /* @__PURE__ */ jsxRuntime.jsxs("a", { href: item.url, children: [
|
|
5828
|
+
/* @__PURE__ */ jsxRuntime.jsx(item.icon, {}),
|
|
5829
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: item.title })
|
|
5830
|
+
] }) }) }, item.title)) }) }) });
|
|
5831
|
+
}
|
|
5832
|
+
function NavUser({ user }) {
|
|
5833
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SidebarMenu, { children: /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { children: [
|
|
5834
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5835
|
+
SidebarMenuButton,
|
|
5836
|
+
{
|
|
5837
|
+
size: "lg",
|
|
5838
|
+
className: "data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",
|
|
5839
|
+
children: [
|
|
5840
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Avatar, { className: "h-8 w-8 rounded-lg", children: [
|
|
5841
|
+
/* @__PURE__ */ jsxRuntime.jsx(AvatarImage, { src: user.avatar, alt: user.name }),
|
|
5842
|
+
/* @__PURE__ */ jsxRuntime.jsx(AvatarFallback, { className: "rounded-lg", children: user.name.slice(0, 2).toUpperCase() })
|
|
5843
|
+
] }),
|
|
5844
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid flex-1 text-left text-sm leading-tight", children: [
|
|
5845
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate font-semibold", children: user.name }),
|
|
5846
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-xs", children: user.email })
|
|
5847
|
+
] }),
|
|
5848
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsUpDownIcon, { className: "ml-auto size-4" })
|
|
5849
|
+
]
|
|
5850
|
+
}
|
|
5851
|
+
) }),
|
|
5852
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
5853
|
+
DropdownMenuContent,
|
|
5854
|
+
{
|
|
5855
|
+
className: "w-[--radix-dropdown-menu-trigger-width] min-w-56 rounded-[var(--j3m-radius-m)]",
|
|
5856
|
+
side: "right",
|
|
5857
|
+
align: "end",
|
|
5858
|
+
sideOffset: 8,
|
|
5859
|
+
children: [
|
|
5860
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuLabel, { className: "p-0 font-normal", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 px-1 py-1.5 text-left text-sm", children: [
|
|
5861
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Avatar, { className: "h-8 w-8 rounded-lg", children: [
|
|
5862
|
+
/* @__PURE__ */ jsxRuntime.jsx(AvatarImage, { src: user.avatar, alt: user.name }),
|
|
5863
|
+
/* @__PURE__ */ jsxRuntime.jsx(AvatarFallback, { className: "rounded-lg", children: user.name.slice(0, 2).toUpperCase() })
|
|
5864
|
+
] }),
|
|
5865
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid flex-1 text-left text-sm leading-tight", children: [
|
|
5866
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate font-semibold", children: user.name }),
|
|
5867
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-xs", children: user.email })
|
|
5868
|
+
] })
|
|
5869
|
+
] }) }),
|
|
5870
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuSeparator, {}),
|
|
5871
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuGroup, { children: /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuItem, { children: [
|
|
5872
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.SparklesIcon, {}),
|
|
5873
|
+
"Upgrade to Pro"
|
|
5874
|
+
] }) }),
|
|
5875
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuSeparator, {}),
|
|
5876
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuGroup, { children: [
|
|
5877
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuItem, { children: [
|
|
5878
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.BadgeCheckIcon, {}),
|
|
5879
|
+
"Account"
|
|
5880
|
+
] }),
|
|
5881
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuItem, { children: [
|
|
5882
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.CreditCardIcon, {}),
|
|
5883
|
+
"Billing"
|
|
5884
|
+
] }),
|
|
5885
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuItem, { children: [
|
|
5886
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.BellIcon, {}),
|
|
5887
|
+
"Notifications"
|
|
5888
|
+
] })
|
|
5889
|
+
] }),
|
|
5890
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuSeparator, {}),
|
|
5891
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuItem, { children: [
|
|
5892
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.LogOutIcon, {}),
|
|
5893
|
+
"Log out"
|
|
5894
|
+
] })
|
|
5895
|
+
]
|
|
5896
|
+
}
|
|
5897
|
+
)
|
|
5898
|
+
] }) }) });
|
|
5899
|
+
}
|
|
5481
5900
|
|
|
5901
|
+
// src/components/event-calendar/types.ts
|
|
5902
|
+
var DEFAULT_WORKING_HOURS = {
|
|
5903
|
+
0: { from: 0, to: 0 },
|
|
5904
|
+
// Sunday - closed
|
|
5905
|
+
1: { from: 9, to: 17 },
|
|
5906
|
+
// Monday
|
|
5907
|
+
2: { from: 9, to: 17 },
|
|
5908
|
+
// Tuesday
|
|
5909
|
+
3: { from: 9, to: 17 },
|
|
5910
|
+
// Wednesday
|
|
5911
|
+
4: { from: 9, to: 17 },
|
|
5912
|
+
// Thursday
|
|
5913
|
+
5: { from: 9, to: 17 },
|
|
5914
|
+
// Friday
|
|
5915
|
+
6: { from: 0, to: 0 }
|
|
5916
|
+
// Saturday - closed
|
|
5917
|
+
};
|
|
5918
|
+
var DEFAULT_VISIBLE_HOURS = { from: 0, to: 24 };
|
|
5919
|
+
var EVENT_COLORS = {
|
|
5920
|
+
blue: {
|
|
5921
|
+
bg: "bg-blue-500/20",
|
|
5922
|
+
text: "text-blue-700 dark:text-blue-300",
|
|
5923
|
+
border: "border-blue-500"
|
|
5924
|
+
},
|
|
5925
|
+
green: {
|
|
5926
|
+
bg: "bg-green-500/20",
|
|
5927
|
+
text: "text-green-700 dark:text-green-300",
|
|
5928
|
+
border: "border-green-500"
|
|
5929
|
+
},
|
|
5930
|
+
red: {
|
|
5931
|
+
bg: "bg-red-500/20",
|
|
5932
|
+
text: "text-red-700 dark:text-red-300",
|
|
5933
|
+
border: "border-red-500"
|
|
5934
|
+
},
|
|
5935
|
+
yellow: {
|
|
5936
|
+
bg: "bg-yellow-500/20",
|
|
5937
|
+
text: "text-yellow-700 dark:text-yellow-300",
|
|
5938
|
+
border: "border-yellow-500"
|
|
5939
|
+
},
|
|
5940
|
+
purple: {
|
|
5941
|
+
bg: "bg-purple-500/20",
|
|
5942
|
+
text: "text-purple-700 dark:text-purple-300",
|
|
5943
|
+
border: "border-purple-500"
|
|
5944
|
+
},
|
|
5945
|
+
orange: {
|
|
5946
|
+
bg: "bg-primary/20",
|
|
5947
|
+
text: "text-primary dark:text-orange-300",
|
|
5948
|
+
border: "border-primary"
|
|
5949
|
+
}
|
|
5950
|
+
};
|
|
5951
|
+
var VIEW_LABELS = {
|
|
5952
|
+
month: "Month",
|
|
5953
|
+
week: "Week",
|
|
5954
|
+
day: "Day",
|
|
5955
|
+
year: "Year",
|
|
5956
|
+
agenda: "Agenda"
|
|
5957
|
+
};
|
|
5958
|
+
var BADGE_VARIANT_LABELS = {
|
|
5959
|
+
dot: "Dot",
|
|
5960
|
+
colored: "Colored",
|
|
5961
|
+
mixed: "Mixed"
|
|
5962
|
+
};
|
|
5963
|
+
var CalendarContext = React15__namespace.createContext(null);
|
|
5964
|
+
function EventCalendarProvider({
|
|
5965
|
+
children,
|
|
5966
|
+
events: initialEvents = [],
|
|
5967
|
+
users: initialUsers = [],
|
|
5968
|
+
defaultDate = /* @__PURE__ */ new Date(),
|
|
5969
|
+
defaultView = "month",
|
|
5970
|
+
defaultBadgeVariant = "colored",
|
|
5971
|
+
defaultUserId = null,
|
|
5972
|
+
defaultWorkingHours = DEFAULT_WORKING_HOURS,
|
|
5973
|
+
defaultVisibleHours = DEFAULT_VISIBLE_HOURS,
|
|
5974
|
+
onEventAdd,
|
|
5975
|
+
onEventUpdate,
|
|
5976
|
+
onEventDelete
|
|
5977
|
+
}) {
|
|
5978
|
+
const [selectedDate, setSelectedDate] = React15__namespace.useState(defaultDate);
|
|
5979
|
+
const [selectedUserId, setSelectedUserId] = React15__namespace.useState(defaultUserId);
|
|
5980
|
+
const [events, setEventsState] = React15__namespace.useState(initialEvents);
|
|
5981
|
+
const [users] = React15__namespace.useState(initialUsers);
|
|
5982
|
+
const [badgeVariant, setBadgeVariant] = React15__namespace.useState(defaultBadgeVariant);
|
|
5983
|
+
const [view, setView] = React15__namespace.useState(defaultView);
|
|
5984
|
+
const [workingHours, setWorkingHours] = React15__namespace.useState(defaultWorkingHours);
|
|
5985
|
+
const [visibleHours, setVisibleHours] = React15__namespace.useState(defaultVisibleHours);
|
|
5986
|
+
React15__namespace.useEffect(() => {
|
|
5987
|
+
setEventsState(initialEvents);
|
|
5988
|
+
}, [initialEvents]);
|
|
5989
|
+
const setEvents = React15__namespace.useCallback((newEvents) => {
|
|
5990
|
+
setEventsState(newEvents);
|
|
5991
|
+
}, []);
|
|
5992
|
+
const addEvent = React15__namespace.useCallback((event) => {
|
|
5993
|
+
setEventsState((prev) => [...prev, event]);
|
|
5994
|
+
onEventAdd?.(event);
|
|
5995
|
+
}, [onEventAdd]);
|
|
5996
|
+
const updateEvent = React15__namespace.useCallback((event) => {
|
|
5997
|
+
setEventsState(
|
|
5998
|
+
(prev) => prev.map((e) => e.id === event.id ? event : e)
|
|
5999
|
+
);
|
|
6000
|
+
onEventUpdate?.(event);
|
|
6001
|
+
}, [onEventUpdate]);
|
|
6002
|
+
const deleteEvent = React15__namespace.useCallback((eventId) => {
|
|
6003
|
+
setEventsState((prev) => prev.filter((e) => e.id !== eventId));
|
|
6004
|
+
onEventDelete?.(eventId);
|
|
6005
|
+
}, [onEventDelete]);
|
|
6006
|
+
const goToToday = React15__namespace.useCallback(() => {
|
|
6007
|
+
setSelectedDate(/* @__PURE__ */ new Date());
|
|
6008
|
+
}, []);
|
|
6009
|
+
const goToPrevious = React15__namespace.useCallback(() => {
|
|
6010
|
+
setSelectedDate((current) => {
|
|
6011
|
+
switch (view) {
|
|
6012
|
+
case "day":
|
|
6013
|
+
return dateFns.subDays(current, 1);
|
|
6014
|
+
case "week":
|
|
6015
|
+
return dateFns.subWeeks(current, 1);
|
|
6016
|
+
case "month":
|
|
6017
|
+
return dateFns.subMonths(current, 1);
|
|
6018
|
+
case "year":
|
|
6019
|
+
return dateFns.subYears(current, 1);
|
|
6020
|
+
case "agenda":
|
|
6021
|
+
return dateFns.subMonths(current, 1);
|
|
6022
|
+
default:
|
|
6023
|
+
return current;
|
|
6024
|
+
}
|
|
6025
|
+
});
|
|
6026
|
+
}, [view]);
|
|
6027
|
+
const goToNext = React15__namespace.useCallback(() => {
|
|
6028
|
+
setSelectedDate((current) => {
|
|
6029
|
+
switch (view) {
|
|
6030
|
+
case "day":
|
|
6031
|
+
return dateFns.addDays(current, 1);
|
|
6032
|
+
case "week":
|
|
6033
|
+
return dateFns.addWeeks(current, 1);
|
|
6034
|
+
case "month":
|
|
6035
|
+
return dateFns.addMonths(current, 1);
|
|
6036
|
+
case "year":
|
|
6037
|
+
return dateFns.addYears(current, 1);
|
|
6038
|
+
case "agenda":
|
|
6039
|
+
return dateFns.addMonths(current, 1);
|
|
6040
|
+
default:
|
|
6041
|
+
return current;
|
|
6042
|
+
}
|
|
6043
|
+
});
|
|
6044
|
+
}, [view]);
|
|
6045
|
+
const contextValue = React15__namespace.useMemo(
|
|
6046
|
+
() => ({
|
|
6047
|
+
// State
|
|
6048
|
+
selectedDate,
|
|
6049
|
+
selectedUserId,
|
|
6050
|
+
events,
|
|
6051
|
+
users,
|
|
6052
|
+
badgeVariant,
|
|
6053
|
+
view,
|
|
6054
|
+
workingHours,
|
|
6055
|
+
visibleHours,
|
|
6056
|
+
// Actions
|
|
6057
|
+
setSelectedDate,
|
|
6058
|
+
setSelectedUserId,
|
|
6059
|
+
setEvents,
|
|
6060
|
+
addEvent,
|
|
6061
|
+
updateEvent,
|
|
6062
|
+
deleteEvent,
|
|
6063
|
+
setBadgeVariant,
|
|
6064
|
+
setView,
|
|
6065
|
+
setWorkingHours,
|
|
6066
|
+
setVisibleHours,
|
|
6067
|
+
goToToday,
|
|
6068
|
+
goToPrevious,
|
|
6069
|
+
goToNext
|
|
6070
|
+
}),
|
|
6071
|
+
[
|
|
6072
|
+
selectedDate,
|
|
6073
|
+
selectedUserId,
|
|
6074
|
+
events,
|
|
6075
|
+
users,
|
|
6076
|
+
badgeVariant,
|
|
6077
|
+
view,
|
|
6078
|
+
workingHours,
|
|
6079
|
+
visibleHours,
|
|
6080
|
+
setEvents,
|
|
6081
|
+
addEvent,
|
|
6082
|
+
updateEvent,
|
|
6083
|
+
deleteEvent,
|
|
6084
|
+
goToToday,
|
|
6085
|
+
goToPrevious,
|
|
6086
|
+
goToNext
|
|
6087
|
+
]
|
|
6088
|
+
);
|
|
6089
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CalendarContext.Provider, { value: contextValue, children });
|
|
6090
|
+
}
|
|
6091
|
+
function useEventCalendar() {
|
|
6092
|
+
const context = React15__namespace.useContext(CalendarContext);
|
|
6093
|
+
if (!context) {
|
|
6094
|
+
throw new Error("useEventCalendar must be used within an EventCalendarProvider");
|
|
6095
|
+
}
|
|
6096
|
+
return context;
|
|
6097
|
+
}
|
|
6098
|
+
function useFilteredEvents() {
|
|
6099
|
+
const { events, selectedUserId } = useEventCalendar();
|
|
6100
|
+
return React15__namespace.useMemo(() => {
|
|
6101
|
+
if (!selectedUserId) return events;
|
|
6102
|
+
return events.filter((event) => event.user.id === selectedUserId);
|
|
6103
|
+
}, [events, selectedUserId]);
|
|
6104
|
+
}
|
|
6105
|
+
function useEventsInRange(startDate, endDate) {
|
|
6106
|
+
const filteredEvents = useFilteredEvents();
|
|
6107
|
+
return React15__namespace.useMemo(() => {
|
|
6108
|
+
return filteredEvents.filter((event) => {
|
|
6109
|
+
const eventStart = new Date(event.startDate);
|
|
6110
|
+
const eventEnd = new Date(event.endDate);
|
|
6111
|
+
return eventStart <= endDate && eventEnd >= startDate;
|
|
6112
|
+
});
|
|
6113
|
+
}, [filteredEvents, startDate, endDate]);
|
|
6114
|
+
}
|
|
6115
|
+
function rangeText(view, date) {
|
|
6116
|
+
const formatString = "MMM d, yyyy";
|
|
6117
|
+
let start;
|
|
6118
|
+
let end;
|
|
6119
|
+
switch (view) {
|
|
6120
|
+
case "agenda":
|
|
6121
|
+
start = dateFns.startOfMonth(date);
|
|
6122
|
+
end = dateFns.endOfMonth(date);
|
|
6123
|
+
break;
|
|
6124
|
+
case "year":
|
|
6125
|
+
start = dateFns.startOfYear(date);
|
|
6126
|
+
end = dateFns.endOfYear(date);
|
|
6127
|
+
break;
|
|
6128
|
+
case "month":
|
|
6129
|
+
start = dateFns.startOfMonth(date);
|
|
6130
|
+
end = dateFns.endOfMonth(date);
|
|
6131
|
+
break;
|
|
6132
|
+
case "week":
|
|
6133
|
+
start = dateFns.startOfWeek(date);
|
|
6134
|
+
end = dateFns.endOfWeek(date);
|
|
6135
|
+
break;
|
|
6136
|
+
case "day":
|
|
6137
|
+
return dateFns.format(date, formatString);
|
|
6138
|
+
default:
|
|
6139
|
+
return "Error while formatting";
|
|
6140
|
+
}
|
|
6141
|
+
return `${dateFns.format(start, formatString)} - ${dateFns.format(end, formatString)}`;
|
|
6142
|
+
}
|
|
6143
|
+
function navigateDate(date, view, direction) {
|
|
6144
|
+
const operations = {
|
|
6145
|
+
agenda: direction === "next" ? dateFns.addMonths : dateFns.subMonths,
|
|
6146
|
+
year: direction === "next" ? dateFns.addYears : dateFns.subYears,
|
|
6147
|
+
month: direction === "next" ? dateFns.addMonths : dateFns.subMonths,
|
|
6148
|
+
week: direction === "next" ? dateFns.addWeeks : dateFns.subWeeks,
|
|
6149
|
+
day: direction === "next" ? dateFns.addDays : dateFns.subDays
|
|
6150
|
+
};
|
|
6151
|
+
return operations[view](date, 1);
|
|
6152
|
+
}
|
|
6153
|
+
function getEventsCount(events, date, view) {
|
|
6154
|
+
const compareFns = {
|
|
6155
|
+
agenda: dateFns.isSameMonth,
|
|
6156
|
+
year: dateFns.isSameYear,
|
|
6157
|
+
day: dateFns.isSameDay,
|
|
6158
|
+
week: dateFns.isSameWeek,
|
|
6159
|
+
month: dateFns.isSameMonth
|
|
6160
|
+
};
|
|
6161
|
+
return events.filter(
|
|
6162
|
+
(event) => compareFns[view](new Date(event.startDate), date)
|
|
6163
|
+
).length;
|
|
6164
|
+
}
|
|
6165
|
+
function getCurrentEvents(events) {
|
|
6166
|
+
const now = /* @__PURE__ */ new Date();
|
|
6167
|
+
return events.filter(
|
|
6168
|
+
(event) => dateFns.isWithinInterval(now, {
|
|
6169
|
+
start: dateFns.parseISO(event.startDate),
|
|
6170
|
+
end: dateFns.parseISO(event.endDate)
|
|
6171
|
+
})
|
|
6172
|
+
) || [];
|
|
6173
|
+
}
|
|
6174
|
+
function groupEvents(dayEvents) {
|
|
6175
|
+
const sortedEvents = dayEvents.sort(
|
|
6176
|
+
(a, b) => dateFns.parseISO(a.startDate).getTime() - dateFns.parseISO(b.startDate).getTime()
|
|
6177
|
+
);
|
|
6178
|
+
const groups = [];
|
|
6179
|
+
for (const event of sortedEvents) {
|
|
6180
|
+
const eventStart = dateFns.parseISO(event.startDate);
|
|
6181
|
+
let placed = false;
|
|
6182
|
+
for (const group of groups) {
|
|
6183
|
+
const lastEventInGroup = group[group.length - 1];
|
|
6184
|
+
const lastEventEnd = dateFns.parseISO(lastEventInGroup.endDate);
|
|
6185
|
+
if (eventStart >= lastEventEnd) {
|
|
6186
|
+
group.push(event);
|
|
6187
|
+
placed = true;
|
|
6188
|
+
break;
|
|
6189
|
+
}
|
|
6190
|
+
}
|
|
6191
|
+
if (!placed) groups.push([event]);
|
|
6192
|
+
}
|
|
6193
|
+
return groups;
|
|
6194
|
+
}
|
|
6195
|
+
function getEventBlockStyle(event, day, groupIndex, groupSize, visibleHoursRange, hourHeight = 96) {
|
|
6196
|
+
const startDate = dateFns.parseISO(event.startDate);
|
|
6197
|
+
const endDate = dateFns.parseISO(event.endDate);
|
|
6198
|
+
const dayStart = new Date(day);
|
|
6199
|
+
dayStart.setHours(0, 0, 0, 0);
|
|
6200
|
+
const eventStart = startDate < dayStart ? dayStart : startDate;
|
|
6201
|
+
const startMinutes = dateFns.differenceInMinutes(eventStart, dayStart);
|
|
6202
|
+
const durationMinutes = dateFns.differenceInMinutes(endDate, eventStart);
|
|
6203
|
+
const visibleStartMinutes = (visibleHoursRange?.from ?? 0) * 60;
|
|
6204
|
+
const topMinutes = startMinutes - visibleStartMinutes;
|
|
6205
|
+
const topPx = topMinutes / 60 * hourHeight;
|
|
6206
|
+
const heightPx = Math.max(durationMinutes / 60 * hourHeight, hourHeight / 4);
|
|
6207
|
+
const width = 100 / groupSize;
|
|
6208
|
+
const left = groupIndex * width;
|
|
6209
|
+
return {
|
|
6210
|
+
top: `${topPx}px`,
|
|
6211
|
+
height: `${heightPx}px`,
|
|
6212
|
+
width: `${width}%`,
|
|
6213
|
+
left: `${left}%`
|
|
6214
|
+
};
|
|
6215
|
+
}
|
|
6216
|
+
function isWorkingHour(day, hour, workingHours) {
|
|
6217
|
+
const dayIndex = day.getDay();
|
|
6218
|
+
const dayHours = workingHours[dayIndex];
|
|
6219
|
+
return hour >= dayHours.from && hour < dayHours.to;
|
|
6220
|
+
}
|
|
6221
|
+
function getVisibleHours(visibleHours, singleDayEvents) {
|
|
6222
|
+
let earliestEventHour = visibleHours.from;
|
|
6223
|
+
let latestEventHour = visibleHours.to;
|
|
6224
|
+
singleDayEvents.forEach((event) => {
|
|
6225
|
+
const startHour = dateFns.parseISO(event.startDate).getHours();
|
|
6226
|
+
const endTime = dateFns.parseISO(event.endDate);
|
|
6227
|
+
const endHour = endTime.getHours() + (endTime.getMinutes() > 0 ? 1 : 0);
|
|
6228
|
+
if (startHour < earliestEventHour) earliestEventHour = startHour;
|
|
6229
|
+
if (endHour > latestEventHour) latestEventHour = endHour;
|
|
6230
|
+
});
|
|
6231
|
+
latestEventHour = Math.min(latestEventHour, 24);
|
|
6232
|
+
const hours = Array.from(
|
|
6233
|
+
{ length: latestEventHour - earliestEventHour },
|
|
6234
|
+
(_, i) => i + earliestEventHour
|
|
6235
|
+
);
|
|
6236
|
+
return { hours, earliestEventHour, latestEventHour };
|
|
6237
|
+
}
|
|
6238
|
+
function getCalendarCells(selectedDate) {
|
|
6239
|
+
const currentYear = selectedDate.getFullYear();
|
|
6240
|
+
const currentMonth = selectedDate.getMonth();
|
|
6241
|
+
const getDaysInMonth = (year, month) => new Date(year, month + 1, 0).getDate();
|
|
6242
|
+
const getFirstDayOfMonth = (year, month) => new Date(year, month, 1).getDay();
|
|
6243
|
+
const daysInMonth = getDaysInMonth(currentYear, currentMonth);
|
|
6244
|
+
const firstDayOfMonth = getFirstDayOfMonth(currentYear, currentMonth);
|
|
6245
|
+
const daysInPrevMonth = getDaysInMonth(currentYear, currentMonth - 1);
|
|
6246
|
+
const totalDays = firstDayOfMonth + daysInMonth;
|
|
6247
|
+
const prevMonthCells = Array.from({ length: firstDayOfMonth }, (_, i) => ({
|
|
6248
|
+
day: daysInPrevMonth - firstDayOfMonth + i + 1,
|
|
6249
|
+
currentMonth: false,
|
|
6250
|
+
date: new Date(
|
|
6251
|
+
currentYear,
|
|
6252
|
+
currentMonth - 1,
|
|
6253
|
+
daysInPrevMonth - firstDayOfMonth + i + 1
|
|
6254
|
+
)
|
|
6255
|
+
}));
|
|
6256
|
+
const currentMonthCells = Array.from({ length: daysInMonth }, (_, i) => ({
|
|
6257
|
+
day: i + 1,
|
|
6258
|
+
currentMonth: true,
|
|
6259
|
+
date: new Date(currentYear, currentMonth, i + 1)
|
|
6260
|
+
}));
|
|
6261
|
+
const nextMonthCells = Array.from(
|
|
6262
|
+
{ length: (7 - totalDays % 7) % 7 },
|
|
6263
|
+
(_, i) => ({
|
|
6264
|
+
day: i + 1,
|
|
6265
|
+
currentMonth: false,
|
|
6266
|
+
date: new Date(currentYear, currentMonth + 1, i + 1)
|
|
6267
|
+
})
|
|
6268
|
+
);
|
|
6269
|
+
return [...prevMonthCells, ...currentMonthCells, ...nextMonthCells];
|
|
6270
|
+
}
|
|
6271
|
+
function calculateMonthEventPositions(multiDayEvents, singleDayEvents, selectedDate) {
|
|
6272
|
+
const monthStart = dateFns.startOfMonth(selectedDate);
|
|
6273
|
+
const monthEnd = dateFns.endOfMonth(selectedDate);
|
|
6274
|
+
const eventPositions = {};
|
|
6275
|
+
const occupiedPositions = {};
|
|
6276
|
+
dateFns.eachDayOfInterval({ start: monthStart, end: monthEnd }).forEach((day) => {
|
|
6277
|
+
occupiedPositions[day.toISOString()] = [false, false, false];
|
|
6278
|
+
});
|
|
6279
|
+
const sortedEvents = [
|
|
6280
|
+
...multiDayEvents.sort((a, b) => {
|
|
6281
|
+
const aDuration = dateFns.differenceInDays(
|
|
6282
|
+
dateFns.parseISO(a.endDate),
|
|
6283
|
+
dateFns.parseISO(a.startDate)
|
|
6284
|
+
);
|
|
6285
|
+
const bDuration = dateFns.differenceInDays(
|
|
6286
|
+
dateFns.parseISO(b.endDate),
|
|
6287
|
+
dateFns.parseISO(b.startDate)
|
|
6288
|
+
);
|
|
6289
|
+
return bDuration - aDuration || dateFns.parseISO(a.startDate).getTime() - dateFns.parseISO(b.startDate).getTime();
|
|
6290
|
+
}),
|
|
6291
|
+
...singleDayEvents.sort(
|
|
6292
|
+
(a, b) => dateFns.parseISO(a.startDate).getTime() - dateFns.parseISO(b.startDate).getTime()
|
|
6293
|
+
)
|
|
6294
|
+
];
|
|
6295
|
+
sortedEvents.forEach((event) => {
|
|
6296
|
+
const eventStart = dateFns.parseISO(event.startDate);
|
|
6297
|
+
const eventEnd = dateFns.parseISO(event.endDate);
|
|
6298
|
+
const eventDays = dateFns.eachDayOfInterval({
|
|
6299
|
+
start: eventStart < monthStart ? monthStart : eventStart,
|
|
6300
|
+
end: eventEnd > monthEnd ? monthEnd : eventEnd
|
|
6301
|
+
});
|
|
6302
|
+
let position = -1;
|
|
6303
|
+
for (let i = 0; i < 3; i++) {
|
|
6304
|
+
if (eventDays.every((day) => {
|
|
6305
|
+
const dayPositions = occupiedPositions[dateFns.startOfDay(day).toISOString()];
|
|
6306
|
+
return dayPositions && !dayPositions[i];
|
|
6307
|
+
})) {
|
|
6308
|
+
position = i;
|
|
6309
|
+
break;
|
|
6310
|
+
}
|
|
6311
|
+
}
|
|
6312
|
+
if (position !== -1) {
|
|
6313
|
+
eventDays.forEach((day) => {
|
|
6314
|
+
const dayKey = dateFns.startOfDay(day).toISOString();
|
|
6315
|
+
occupiedPositions[dayKey][position] = true;
|
|
6316
|
+
});
|
|
6317
|
+
eventPositions[event.id] = position;
|
|
6318
|
+
}
|
|
6319
|
+
});
|
|
6320
|
+
return eventPositions;
|
|
6321
|
+
}
|
|
6322
|
+
function getMonthCellEvents(date, events, eventPositions) {
|
|
6323
|
+
const eventsForDate = events.filter((event) => {
|
|
6324
|
+
const eventStart = dateFns.parseISO(event.startDate);
|
|
6325
|
+
const eventEnd = dateFns.parseISO(event.endDate);
|
|
6326
|
+
return date >= eventStart && date <= eventEnd || dateFns.isSameDay(date, eventStart) || dateFns.isSameDay(date, eventEnd);
|
|
6327
|
+
});
|
|
6328
|
+
return eventsForDate.map((event) => ({
|
|
6329
|
+
...event,
|
|
6330
|
+
position: eventPositions[event.id] ?? -1,
|
|
6331
|
+
isMultiDay: event.startDate !== event.endDate
|
|
6332
|
+
})).sort((a, b) => {
|
|
6333
|
+
if (a.isMultiDay && !b.isMultiDay) return -1;
|
|
6334
|
+
if (!a.isMultiDay && b.isMultiDay) return 1;
|
|
6335
|
+
return a.position - b.position;
|
|
6336
|
+
});
|
|
6337
|
+
}
|
|
6338
|
+
function getMonthDays(date, weekStartsOn = 0) {
|
|
6339
|
+
const start = dateFns.startOfWeek(dateFns.startOfMonth(date), { weekStartsOn });
|
|
6340
|
+
const end = dateFns.endOfWeek(dateFns.endOfMonth(date), { weekStartsOn });
|
|
6341
|
+
return dateFns.eachDayOfInterval({ start, end });
|
|
6342
|
+
}
|
|
6343
|
+
function getWeekDays(date, weekStartsOn = 0) {
|
|
6344
|
+
const start = dateFns.startOfWeek(date, { weekStartsOn });
|
|
6345
|
+
const end = dateFns.endOfWeek(date, { weekStartsOn });
|
|
6346
|
+
return dateFns.eachDayOfInterval({ start, end });
|
|
6347
|
+
}
|
|
6348
|
+
function getDayHours(date, start = 0, end = 24) {
|
|
6349
|
+
const dayStart = dateFns.setMinutes(dateFns.setHours(date, start), 0);
|
|
6350
|
+
const dayEnd = dateFns.setMinutes(dateFns.setHours(date, end - 1), 59);
|
|
6351
|
+
return dateFns.eachHourOfInterval({ start: dayStart, end: dayEnd });
|
|
6352
|
+
}
|
|
6353
|
+
function getYearMonths(date) {
|
|
6354
|
+
const start = dateFns.startOfYear(date);
|
|
6355
|
+
const months = [];
|
|
6356
|
+
for (let i = 0; i < 12; i++) {
|
|
6357
|
+
months.push(new Date(start.getFullYear(), i, 1));
|
|
6358
|
+
}
|
|
6359
|
+
return months;
|
|
6360
|
+
}
|
|
6361
|
+
function getEventsForDate(events, date) {
|
|
6362
|
+
return events.filter((event) => {
|
|
6363
|
+
const eventStart = dateFns.parseISO(event.startDate);
|
|
6364
|
+
const eventEnd = dateFns.parseISO(event.endDate);
|
|
6365
|
+
return dateFns.isWithinInterval(date, {
|
|
6366
|
+
start: dateFns.startOfDay(eventStart),
|
|
6367
|
+
end: dateFns.endOfDay(eventEnd)
|
|
6368
|
+
}) || dateFns.isSameDay(eventStart, date) || dateFns.isSameDay(eventEnd, date);
|
|
6369
|
+
});
|
|
6370
|
+
}
|
|
6371
|
+
function getEventsInRange(events, start, end) {
|
|
6372
|
+
return events.filter((event) => {
|
|
6373
|
+
const eventStart = dateFns.parseISO(event.startDate);
|
|
6374
|
+
const eventEnd = dateFns.parseISO(event.endDate);
|
|
6375
|
+
return eventStart >= start && eventStart <= end || eventEnd >= start && eventEnd <= end || eventStart <= start && eventEnd >= end;
|
|
6376
|
+
});
|
|
6377
|
+
}
|
|
6378
|
+
function splitEventsByDuration(events) {
|
|
6379
|
+
const singleDayEvents = [];
|
|
6380
|
+
const multiDayEvents = [];
|
|
6381
|
+
events.forEach((event) => {
|
|
6382
|
+
const start = dateFns.parseISO(event.startDate);
|
|
6383
|
+
const end = dateFns.parseISO(event.endDate);
|
|
6384
|
+
if (dateFns.isSameDay(start, end)) {
|
|
6385
|
+
singleDayEvents.push(event);
|
|
6386
|
+
} else {
|
|
6387
|
+
multiDayEvents.push(event);
|
|
6388
|
+
}
|
|
6389
|
+
});
|
|
6390
|
+
return { singleDayEvents, multiDayEvents };
|
|
6391
|
+
}
|
|
6392
|
+
function isMultiDayEvent(event) {
|
|
6393
|
+
const start = dateFns.parseISO(event.startDate);
|
|
6394
|
+
const end = dateFns.parseISO(event.endDate);
|
|
6395
|
+
return !dateFns.isSameDay(start, end);
|
|
6396
|
+
}
|
|
6397
|
+
function getEventDuration(event) {
|
|
6398
|
+
const start = dateFns.parseISO(event.startDate);
|
|
6399
|
+
const end = dateFns.parseISO(event.endDate);
|
|
6400
|
+
return dateFns.differenceInDays(end, start) + 1;
|
|
6401
|
+
}
|
|
6402
|
+
function getEventDurationMinutes(event) {
|
|
6403
|
+
const start = dateFns.parseISO(event.startDate);
|
|
6404
|
+
const end = dateFns.parseISO(event.endDate);
|
|
6405
|
+
return dateFns.differenceInMinutes(end, start);
|
|
6406
|
+
}
|
|
6407
|
+
function sortEvents(events) {
|
|
6408
|
+
return [...events].sort((a, b) => {
|
|
6409
|
+
const startDiff = dateFns.parseISO(a.startDate).getTime() - dateFns.parseISO(b.startDate).getTime();
|
|
6410
|
+
if (startDiff !== 0) return startDiff;
|
|
6411
|
+
return getEventDuration(b) - getEventDuration(a);
|
|
6412
|
+
});
|
|
6413
|
+
}
|
|
6414
|
+
function getTimePosition(event, visibleHoursRange) {
|
|
6415
|
+
const start = dateFns.parseISO(event.startDate);
|
|
6416
|
+
const hours = dateFns.getHours(start);
|
|
6417
|
+
const minutes = dateFns.getMinutes(start);
|
|
6418
|
+
const startHour = visibleHoursRange?.from ?? 0;
|
|
6419
|
+
const totalMinutes = (hours - startHour) * 60 + minutes;
|
|
6420
|
+
const totalDayMinutes = ((visibleHoursRange?.to ?? 24) - startHour) * 60;
|
|
6421
|
+
return totalMinutes / totalDayMinutes * 100;
|
|
6422
|
+
}
|
|
6423
|
+
function getTimeHeight(event, visibleHoursRange) {
|
|
6424
|
+
const duration = getEventDurationMinutes(event);
|
|
6425
|
+
const totalDayMinutes = ((visibleHoursRange?.to ?? 24) - (visibleHoursRange?.from ?? 0)) * 60;
|
|
6426
|
+
return Math.min(duration / totalDayMinutes * 100, 100);
|
|
6427
|
+
}
|
|
6428
|
+
function formatTime(date, use24h = false) {
|
|
6429
|
+
return dateFns.format(date, use24h ? "HH:mm" : "h:mm a");
|
|
6430
|
+
}
|
|
6431
|
+
function getWeekDayNames(weekStartsOn = 0, shortNames = true) {
|
|
6432
|
+
const days = [
|
|
6433
|
+
"Sunday",
|
|
6434
|
+
"Monday",
|
|
6435
|
+
"Tuesday",
|
|
6436
|
+
"Wednesday",
|
|
6437
|
+
"Thursday",
|
|
6438
|
+
"Friday",
|
|
6439
|
+
"Saturday"
|
|
6440
|
+
];
|
|
6441
|
+
const rotated = [...days.slice(weekStartsOn), ...days.slice(0, weekStartsOn)];
|
|
6442
|
+
return shortNames ? rotated.map((d) => d.slice(0, 3)) : rotated;
|
|
6443
|
+
}
|
|
6444
|
+
function getHeaderLabel(date, view) {
|
|
6445
|
+
switch (view) {
|
|
6446
|
+
case "day":
|
|
6447
|
+
return dateFns.format(date, "EEEE, MMMM d, yyyy");
|
|
6448
|
+
case "week":
|
|
6449
|
+
const weekStart = dateFns.startOfWeek(date);
|
|
6450
|
+
const weekEnd = dateFns.endOfWeek(date);
|
|
6451
|
+
if (weekStart.getMonth() === weekEnd.getMonth()) {
|
|
6452
|
+
return dateFns.format(weekStart, "MMMM d") + " - " + dateFns.format(weekEnd, "d, yyyy");
|
|
6453
|
+
}
|
|
6454
|
+
return dateFns.format(weekStart, "MMM d") + " - " + dateFns.format(weekEnd, "MMM d, yyyy");
|
|
6455
|
+
case "month":
|
|
6456
|
+
return dateFns.format(date, "MMMM yyyy");
|
|
6457
|
+
case "year":
|
|
6458
|
+
return dateFns.format(date, "yyyy");
|
|
6459
|
+
case "agenda":
|
|
6460
|
+
return dateFns.format(date, "MMMM yyyy");
|
|
6461
|
+
default:
|
|
6462
|
+
return dateFns.format(date, "MMMM yyyy");
|
|
6463
|
+
}
|
|
6464
|
+
}
|
|
6465
|
+
function getViewDateRange(date, view) {
|
|
6466
|
+
switch (view) {
|
|
6467
|
+
case "day":
|
|
6468
|
+
return { start: dateFns.startOfDay(date), end: dateFns.endOfDay(date) };
|
|
6469
|
+
case "week":
|
|
6470
|
+
return { start: dateFns.startOfWeek(date), end: dateFns.endOfWeek(date) };
|
|
6471
|
+
case "month":
|
|
6472
|
+
return { start: dateFns.startOfMonth(date), end: dateFns.endOfMonth(date) };
|
|
6473
|
+
case "year":
|
|
6474
|
+
return { start: dateFns.startOfYear(date), end: dateFns.endOfYear(date) };
|
|
6475
|
+
case "agenda":
|
|
6476
|
+
return { start: dateFns.startOfMonth(date), end: dateFns.endOfMonth(date) };
|
|
6477
|
+
default:
|
|
6478
|
+
return { start: dateFns.startOfMonth(date), end: dateFns.endOfMonth(date) };
|
|
6479
|
+
}
|
|
6480
|
+
}
|
|
6481
|
+
function formatDateRange(start, end) {
|
|
6482
|
+
if (dateFns.isSameDay(start, end)) {
|
|
6483
|
+
return dateFns.format(start, "MMM d, yyyy");
|
|
6484
|
+
}
|
|
6485
|
+
if (start.getFullYear() === end.getFullYear()) {
|
|
6486
|
+
if (start.getMonth() === end.getMonth()) {
|
|
6487
|
+
return dateFns.format(start, "MMM d") + " - " + dateFns.format(end, "d, yyyy");
|
|
6488
|
+
}
|
|
6489
|
+
return dateFns.format(start, "MMM d") + " - " + dateFns.format(end, "MMM d, yyyy");
|
|
6490
|
+
}
|
|
6491
|
+
return dateFns.format(start, "MMM d, yyyy") + " - " + dateFns.format(end, "MMM d, yyyy");
|
|
6492
|
+
}
|
|
6493
|
+
function createDefaultEvent(startDate, duration = 60) {
|
|
6494
|
+
return {
|
|
6495
|
+
title: "",
|
|
6496
|
+
description: "",
|
|
6497
|
+
startDate: startDate.toISOString(),
|
|
6498
|
+
endDate: dateFns.addMinutes(startDate, duration).toISOString(),
|
|
6499
|
+
color: "blue",
|
|
6500
|
+
user: {
|
|
6501
|
+
id: "",
|
|
6502
|
+
name: ""
|
|
6503
|
+
}
|
|
6504
|
+
};
|
|
6505
|
+
}
|
|
6506
|
+
function generateEventId() {
|
|
6507
|
+
return `event_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
|
|
6508
|
+
}
|
|
6509
|
+
function calculateDropDates(event, newStartDate) {
|
|
6510
|
+
const originalStart = dateFns.parseISO(event.startDate);
|
|
6511
|
+
const originalEnd = dateFns.parseISO(event.endDate);
|
|
6512
|
+
const duration = dateFns.differenceInMinutes(originalEnd, originalStart);
|
|
6513
|
+
const newStart = newStartDate;
|
|
6514
|
+
const newEnd = dateFns.addMinutes(newStart, duration);
|
|
6515
|
+
return {
|
|
6516
|
+
startDate: newStart.toISOString(),
|
|
6517
|
+
endDate: newEnd.toISOString()
|
|
6518
|
+
};
|
|
6519
|
+
}
|
|
6520
|
+
function snapToInterval(date, intervalMinutes = 15) {
|
|
6521
|
+
const minutes = dateFns.getMinutes(date);
|
|
6522
|
+
const snappedMinutes = Math.round(minutes / intervalMinutes) * intervalMinutes;
|
|
6523
|
+
return dateFns.setMinutes(date, snappedMinutes);
|
|
6524
|
+
}
|
|
6525
|
+
var colorClasses = {
|
|
6526
|
+
blue: {
|
|
6527
|
+
dot: "bg-blue-500",
|
|
6528
|
+
bg: "bg-blue-50 dark:bg-blue-950/50",
|
|
6529
|
+
text: "text-blue-600 dark:text-blue-400",
|
|
6530
|
+
border: "border-l-blue-500",
|
|
6531
|
+
solid: "bg-blue-500"
|
|
6532
|
+
},
|
|
6533
|
+
green: {
|
|
6534
|
+
dot: "bg-green-500",
|
|
6535
|
+
bg: "bg-green-50 dark:bg-green-950/50",
|
|
6536
|
+
text: "text-green-600 dark:text-green-400",
|
|
6537
|
+
border: "border-l-green-500",
|
|
6538
|
+
solid: "bg-green-500"
|
|
6539
|
+
},
|
|
6540
|
+
red: {
|
|
6541
|
+
dot: "bg-red-500",
|
|
6542
|
+
bg: "bg-red-50 dark:bg-red-950/50",
|
|
6543
|
+
text: "text-red-600 dark:text-red-400",
|
|
6544
|
+
border: "border-l-red-500",
|
|
6545
|
+
solid: "bg-red-500"
|
|
6546
|
+
},
|
|
6547
|
+
yellow: {
|
|
6548
|
+
dot: "bg-yellow-500",
|
|
6549
|
+
bg: "bg-yellow-50 dark:bg-yellow-950/50",
|
|
6550
|
+
text: "text-yellow-600 dark:text-yellow-400",
|
|
6551
|
+
border: "border-l-yellow-500",
|
|
6552
|
+
solid: "bg-yellow-500"
|
|
6553
|
+
},
|
|
6554
|
+
purple: {
|
|
6555
|
+
dot: "bg-purple-500",
|
|
6556
|
+
bg: "bg-purple-50 dark:bg-purple-950/50",
|
|
6557
|
+
text: "text-purple-600 dark:text-purple-400",
|
|
6558
|
+
border: "border-l-purple-500",
|
|
6559
|
+
solid: "bg-purple-500"
|
|
6560
|
+
},
|
|
6561
|
+
orange: {
|
|
6562
|
+
dot: "bg-primary",
|
|
6563
|
+
bg: "bg-orange-50 dark:bg-orange-950/50",
|
|
6564
|
+
text: "text-primary dark:text-orange-400",
|
|
6565
|
+
border: "border-l-primary",
|
|
6566
|
+
solid: "bg-primary"
|
|
6567
|
+
}
|
|
6568
|
+
};
|
|
6569
|
+
function EventBadge({
|
|
6570
|
+
event,
|
|
6571
|
+
variant = "colored",
|
|
6572
|
+
className,
|
|
6573
|
+
showTime = false,
|
|
6574
|
+
compact = false,
|
|
6575
|
+
isDragging = false,
|
|
6576
|
+
onClick
|
|
6577
|
+
}) {
|
|
6578
|
+
const colors = colorClasses[event.color];
|
|
6579
|
+
const startTime = dateFns.format(dateFns.parseISO(event.startDate), "h:mm a");
|
|
6580
|
+
const handleClick = (e) => {
|
|
6581
|
+
e.stopPropagation();
|
|
6582
|
+
onClick?.(event, e);
|
|
6583
|
+
};
|
|
6584
|
+
if (variant === "dot") {
|
|
6585
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6586
|
+
"button",
|
|
6587
|
+
{
|
|
6588
|
+
type: "button",
|
|
6589
|
+
onClick: handleClick,
|
|
6590
|
+
className: cn(
|
|
6591
|
+
"flex items-center gap-1.5 rounded-sm px-1.5 py-0.5 text-left text-xs transition-colors",
|
|
6592
|
+
"hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
6593
|
+
isDragging && "opacity-50",
|
|
6594
|
+
className
|
|
6595
|
+
),
|
|
6596
|
+
children: [
|
|
6597
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("size-2 shrink-0 rounded-full", colors.dot) }),
|
|
6598
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-foreground", children: event.title }),
|
|
6599
|
+
showTime && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 text-muted-foreground", children: startTime })
|
|
6600
|
+
]
|
|
6601
|
+
}
|
|
6602
|
+
);
|
|
6603
|
+
}
|
|
6604
|
+
if (variant === "mixed") {
|
|
6605
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6606
|
+
"button",
|
|
6607
|
+
{
|
|
6608
|
+
type: "button",
|
|
6609
|
+
onClick: handleClick,
|
|
6610
|
+
className: cn(
|
|
6611
|
+
"flex items-center gap-1.5 rounded-sm border-l-2 px-1.5 py-0.5 text-left text-xs transition-colors",
|
|
6612
|
+
"hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
6613
|
+
colors.border,
|
|
6614
|
+
isDragging && "opacity-50",
|
|
6615
|
+
className
|
|
6616
|
+
),
|
|
6617
|
+
children: [
|
|
6618
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-foreground", children: event.title }),
|
|
6619
|
+
showTime && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 text-muted-foreground", children: startTime })
|
|
6620
|
+
]
|
|
6621
|
+
}
|
|
6622
|
+
);
|
|
6623
|
+
}
|
|
6624
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6625
|
+
"button",
|
|
6626
|
+
{
|
|
6627
|
+
type: "button",
|
|
6628
|
+
onClick: handleClick,
|
|
6629
|
+
className: cn(
|
|
6630
|
+
"flex flex-col items-start rounded-sm border-l-[3px] text-left text-xs transition-colors",
|
|
6631
|
+
"hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
6632
|
+
colors.border,
|
|
6633
|
+
colors.bg,
|
|
6634
|
+
colors.text,
|
|
6635
|
+
compact ? "px-1.5 py-0.5" : "px-2 py-1",
|
|
6636
|
+
isDragging && "opacity-50 shadow-lg",
|
|
6637
|
+
className
|
|
6638
|
+
),
|
|
6639
|
+
children: [
|
|
6640
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate font-medium max-w-full", children: event.title }),
|
|
6641
|
+
showTime && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 text-muted-foreground", children: startTime })
|
|
6642
|
+
]
|
|
6643
|
+
}
|
|
6644
|
+
);
|
|
6645
|
+
}
|
|
6646
|
+
function MoreEvents({ count, onClick, className }) {
|
|
6647
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6648
|
+
"button",
|
|
6649
|
+
{
|
|
6650
|
+
type: "button",
|
|
6651
|
+
onClick,
|
|
6652
|
+
className: cn(
|
|
6653
|
+
"w-full rounded-sm px-2 py-0.5 text-left text-xs text-muted-foreground transition-colors",
|
|
6654
|
+
"hover:bg-muted hover:text-foreground",
|
|
6655
|
+
className
|
|
6656
|
+
),
|
|
6657
|
+
children: [
|
|
6658
|
+
count,
|
|
6659
|
+
" more..."
|
|
6660
|
+
]
|
|
6661
|
+
}
|
|
6662
|
+
);
|
|
6663
|
+
}
|
|
6664
|
+
function TimeIndicator({ className }) {
|
|
6665
|
+
const [now, setNow] = React15__namespace.useState(/* @__PURE__ */ new Date());
|
|
6666
|
+
React15__namespace.useEffect(() => {
|
|
6667
|
+
const interval = setInterval(() => setNow(/* @__PURE__ */ new Date()), 6e4);
|
|
6668
|
+
return () => clearInterval(interval);
|
|
6669
|
+
}, []);
|
|
6670
|
+
const hours = now.getHours();
|
|
6671
|
+
const minutes = now.getMinutes();
|
|
6672
|
+
const topPercent = (hours * 60 + minutes) / (24 * 60) * 100;
|
|
6673
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6674
|
+
"div",
|
|
6675
|
+
{
|
|
6676
|
+
className: cn(
|
|
6677
|
+
"pointer-events-none absolute left-0 right-0 z-20 flex items-center",
|
|
6678
|
+
className
|
|
6679
|
+
),
|
|
6680
|
+
style: { top: `${topPercent}%` },
|
|
6681
|
+
children: [
|
|
6682
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "size-2.5 -translate-x-1/2 rounded-full bg-red-500" }),
|
|
6683
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-0.5 flex-1 bg-red-500" })
|
|
6684
|
+
]
|
|
6685
|
+
}
|
|
6686
|
+
);
|
|
6687
|
+
}
|
|
6688
|
+
function DateBadge({ date, className }) {
|
|
6689
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6690
|
+
"div",
|
|
6691
|
+
{
|
|
6692
|
+
className: cn(
|
|
6693
|
+
"flex flex-col w-14 overflow-hidden border border-border rounded-md",
|
|
6694
|
+
className
|
|
6695
|
+
),
|
|
6696
|
+
children: [
|
|
6697
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-foreground text-background text-[10px] font-bold text-center py-1.5 uppercase tracking-wider", children: dateFns.format(date, "MMM") }),
|
|
6698
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-background text-foreground text-2xl font-bold text-center py-2.5", children: dateFns.format(date, "d") })
|
|
6699
|
+
]
|
|
6700
|
+
}
|
|
6701
|
+
);
|
|
6702
|
+
}
|
|
6703
|
+
var DragContext = React15__namespace.createContext(null);
|
|
6704
|
+
function DragProvider({
|
|
6705
|
+
children,
|
|
6706
|
+
snapMinutes = 15,
|
|
6707
|
+
onDragStart,
|
|
6708
|
+
onDragEnd
|
|
6709
|
+
}) {
|
|
6710
|
+
const [draggedEvent, setDraggedEventState] = React15__namespace.useState(null);
|
|
6711
|
+
const [isDragging, setIsDragging] = React15__namespace.useState(false);
|
|
6712
|
+
const { updateEvent } = useEventCalendar();
|
|
6713
|
+
const setDraggedEvent = React15__namespace.useCallback((event) => {
|
|
6714
|
+
setDraggedEventState(event);
|
|
6715
|
+
setIsDragging(!!event);
|
|
6716
|
+
if (event) {
|
|
6717
|
+
onDragStart?.(event);
|
|
6718
|
+
}
|
|
6719
|
+
}, [onDragStart]);
|
|
6720
|
+
const handleDrop = React15__namespace.useCallback((newStartDate) => {
|
|
6721
|
+
if (!draggedEvent) return;
|
|
6722
|
+
const snappedDate = snapToInterval(newStartDate, snapMinutes);
|
|
6723
|
+
const { startDate, endDate } = calculateDropDates(draggedEvent, snappedDate);
|
|
6724
|
+
const updatedEvent = {
|
|
6725
|
+
...draggedEvent,
|
|
6726
|
+
startDate,
|
|
6727
|
+
endDate
|
|
6728
|
+
};
|
|
6729
|
+
updateEvent(updatedEvent);
|
|
6730
|
+
onDragEnd?.(updatedEvent, new Date(startDate), new Date(endDate));
|
|
6731
|
+
setDraggedEvent(null);
|
|
6732
|
+
}, [draggedEvent, snapMinutes, updateEvent, onDragEnd, setDraggedEvent]);
|
|
6733
|
+
const contextValue = React15__namespace.useMemo(
|
|
6734
|
+
() => ({
|
|
6735
|
+
draggedEvent,
|
|
6736
|
+
setDraggedEvent,
|
|
6737
|
+
isDragging
|
|
6738
|
+
}),
|
|
6739
|
+
[draggedEvent, setDraggedEvent, isDragging]
|
|
6740
|
+
);
|
|
6741
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DragContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(DragDropHandler, { onDrop: handleDrop, children }) });
|
|
6742
|
+
}
|
|
6743
|
+
function useDrag() {
|
|
6744
|
+
const context = React15__namespace.useContext(DragContext);
|
|
6745
|
+
if (!context) {
|
|
6746
|
+
throw new Error("useDrag must be used within a DragProvider");
|
|
6747
|
+
}
|
|
6748
|
+
return context;
|
|
6749
|
+
}
|
|
6750
|
+
function DragDropHandler({ children, onDrop }) {
|
|
6751
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
6752
|
+
}
|
|
6753
|
+
function DraggableEvent({
|
|
6754
|
+
event,
|
|
6755
|
+
children,
|
|
6756
|
+
disabled = false
|
|
6757
|
+
}) {
|
|
6758
|
+
const { setDraggedEvent, isDragging, draggedEvent } = useDrag();
|
|
6759
|
+
const isDragged = draggedEvent?.id === event.id;
|
|
6760
|
+
const handleDragStart = (e) => {
|
|
6761
|
+
if (disabled) return;
|
|
6762
|
+
e.dataTransfer.effectAllowed = "move";
|
|
6763
|
+
e.dataTransfer.setData("text/plain", event.id);
|
|
6764
|
+
setDraggedEvent(event);
|
|
6765
|
+
};
|
|
6766
|
+
const handleDragEnd = () => {
|
|
6767
|
+
setDraggedEvent(null);
|
|
6768
|
+
};
|
|
6769
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6770
|
+
"div",
|
|
6771
|
+
{
|
|
6772
|
+
draggable: !disabled,
|
|
6773
|
+
onDragStart: handleDragStart,
|
|
6774
|
+
onDragEnd: handleDragEnd,
|
|
6775
|
+
className: isDragged ? "opacity-50" : "",
|
|
6776
|
+
style: { cursor: disabled ? "default" : "grab" },
|
|
6777
|
+
children
|
|
6778
|
+
}
|
|
6779
|
+
);
|
|
6780
|
+
}
|
|
6781
|
+
function DroppableZone({
|
|
6782
|
+
date,
|
|
6783
|
+
children,
|
|
6784
|
+
onDrop,
|
|
6785
|
+
className
|
|
6786
|
+
}) {
|
|
6787
|
+
const { draggedEvent, setDraggedEvent } = useDrag();
|
|
6788
|
+
const { updateEvent } = useEventCalendar();
|
|
6789
|
+
const [isOver, setIsOver] = React15__namespace.useState(false);
|
|
6790
|
+
const handleDragOver = (e) => {
|
|
6791
|
+
e.preventDefault();
|
|
6792
|
+
e.dataTransfer.dropEffect = "move";
|
|
6793
|
+
setIsOver(true);
|
|
6794
|
+
};
|
|
6795
|
+
const handleDragLeave = () => {
|
|
6796
|
+
setIsOver(false);
|
|
6797
|
+
};
|
|
6798
|
+
const handleDrop = (e) => {
|
|
6799
|
+
e.preventDefault();
|
|
6800
|
+
setIsOver(false);
|
|
6801
|
+
if (!draggedEvent) return;
|
|
6802
|
+
const { startDate, endDate } = calculateDropDates(draggedEvent, date);
|
|
6803
|
+
const updatedEvent = {
|
|
6804
|
+
...draggedEvent,
|
|
6805
|
+
startDate,
|
|
6806
|
+
endDate
|
|
6807
|
+
};
|
|
6808
|
+
updateEvent(updatedEvent);
|
|
6809
|
+
onDrop?.(updatedEvent, date);
|
|
6810
|
+
setDraggedEvent(null);
|
|
6811
|
+
};
|
|
6812
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6813
|
+
"div",
|
|
6814
|
+
{
|
|
6815
|
+
onDragOver: handleDragOver,
|
|
6816
|
+
onDragLeave: handleDragLeave,
|
|
6817
|
+
onDrop: handleDrop,
|
|
6818
|
+
className,
|
|
6819
|
+
"data-drag-over": isOver,
|
|
6820
|
+
children
|
|
6821
|
+
}
|
|
6822
|
+
);
|
|
6823
|
+
}
|
|
6824
|
+
function useDroppable({ date, hour, minute = 0, onDrop }) {
|
|
6825
|
+
const { draggedEvent, setDraggedEvent } = useDrag();
|
|
6826
|
+
const { updateEvent } = useEventCalendar();
|
|
6827
|
+
const [isOver, setIsOver] = React15__namespace.useState(false);
|
|
6828
|
+
const dropTargetDate = React15__namespace.useMemo(() => {
|
|
6829
|
+
const targetDate = new Date(date);
|
|
6830
|
+
if (hour !== void 0) {
|
|
6831
|
+
targetDate.setHours(hour, minute, 0, 0);
|
|
6832
|
+
}
|
|
6833
|
+
return targetDate;
|
|
6834
|
+
}, [date, hour, minute]);
|
|
6835
|
+
const handleDragOver = React15__namespace.useCallback((e) => {
|
|
6836
|
+
e.preventDefault();
|
|
6837
|
+
e.dataTransfer.dropEffect = "move";
|
|
6838
|
+
if (!isOver) setIsOver(true);
|
|
6839
|
+
}, [isOver]);
|
|
6840
|
+
const handleDragLeave = React15__namespace.useCallback(() => {
|
|
6841
|
+
setIsOver(false);
|
|
6842
|
+
}, []);
|
|
6843
|
+
const handleDrop = React15__namespace.useCallback((e) => {
|
|
6844
|
+
e.preventDefault();
|
|
6845
|
+
setIsOver(false);
|
|
6846
|
+
if (!draggedEvent) return;
|
|
6847
|
+
const { startDate, endDate } = calculateDropDates(draggedEvent, dropTargetDate);
|
|
6848
|
+
const updatedEvent = {
|
|
6849
|
+
...draggedEvent,
|
|
6850
|
+
startDate,
|
|
6851
|
+
endDate
|
|
6852
|
+
};
|
|
6853
|
+
updateEvent(updatedEvent);
|
|
6854
|
+
onDrop?.(updatedEvent, dropTargetDate);
|
|
6855
|
+
setDraggedEvent(null);
|
|
6856
|
+
}, [draggedEvent, dropTargetDate, updateEvent, onDrop, setDraggedEvent]);
|
|
6857
|
+
return {
|
|
6858
|
+
isOver,
|
|
6859
|
+
dropProps: {
|
|
6860
|
+
onDragOver: handleDragOver,
|
|
6861
|
+
onDragLeave: handleDragLeave,
|
|
6862
|
+
onDrop: handleDrop,
|
|
6863
|
+
"data-drag-over": isOver
|
|
6864
|
+
}
|
|
6865
|
+
};
|
|
6866
|
+
}
|
|
6867
|
+
function useDraggable(event, disabled = false) {
|
|
6868
|
+
const { setDraggedEvent, draggedEvent } = useDrag();
|
|
6869
|
+
const isDragged = draggedEvent?.id === event.id;
|
|
6870
|
+
const handleDragStart = React15__namespace.useCallback((e) => {
|
|
6871
|
+
if (disabled) return;
|
|
6872
|
+
e.dataTransfer.effectAllowed = "move";
|
|
6873
|
+
e.dataTransfer.setData("text/plain", event.id);
|
|
6874
|
+
setDraggedEvent(event);
|
|
6875
|
+
}, [disabled, event, setDraggedEvent]);
|
|
6876
|
+
const handleDragEnd = React15__namespace.useCallback(() => {
|
|
6877
|
+
setDraggedEvent(null);
|
|
6878
|
+
}, [setDraggedEvent]);
|
|
6879
|
+
return {
|
|
6880
|
+
isDragged,
|
|
6881
|
+
dragProps: {
|
|
6882
|
+
draggable: !disabled,
|
|
6883
|
+
onDragStart: handleDragStart,
|
|
6884
|
+
onDragEnd: handleDragEnd,
|
|
6885
|
+
style: { cursor: disabled ? "default" : "grab" }
|
|
6886
|
+
}
|
|
6887
|
+
};
|
|
6888
|
+
}
|
|
6889
|
+
var WEEK_DAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
|
6890
|
+
function DraggableEventWrapper({
|
|
6891
|
+
event,
|
|
6892
|
+
children
|
|
6893
|
+
}) {
|
|
6894
|
+
const { isDragged, dragProps } = useDraggable(event);
|
|
6895
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6896
|
+
"div",
|
|
6897
|
+
{
|
|
6898
|
+
...dragProps,
|
|
6899
|
+
className: cn(
|
|
6900
|
+
"transition-opacity",
|
|
6901
|
+
isDragged && "opacity-50"
|
|
6902
|
+
),
|
|
6903
|
+
children
|
|
6904
|
+
}
|
|
6905
|
+
);
|
|
6906
|
+
}
|
|
6907
|
+
function MonthView({
|
|
6908
|
+
className,
|
|
6909
|
+
maxEventsPerDay = 3,
|
|
6910
|
+
weekStartsOn = 0,
|
|
6911
|
+
onEventClick,
|
|
6912
|
+
onDateClick,
|
|
6913
|
+
onMoreClick
|
|
6914
|
+
}) {
|
|
6915
|
+
const { selectedDate, badgeVariant, setSelectedDate, setView } = useEventCalendar();
|
|
6916
|
+
const filteredEvents = useFilteredEvents();
|
|
6917
|
+
const { singleDayEvents, multiDayEvents } = React15__namespace.useMemo(
|
|
6918
|
+
() => splitEventsByDuration(filteredEvents),
|
|
6919
|
+
[filteredEvents]
|
|
6920
|
+
);
|
|
6921
|
+
const cells = React15__namespace.useMemo(
|
|
6922
|
+
() => getCalendarCells(selectedDate),
|
|
6923
|
+
[selectedDate]
|
|
6924
|
+
);
|
|
6925
|
+
const eventPositions = React15__namespace.useMemo(
|
|
6926
|
+
() => calculateMonthEventPositions(multiDayEvents, singleDayEvents, selectedDate),
|
|
6927
|
+
[multiDayEvents, singleDayEvents, selectedDate]
|
|
6928
|
+
);
|
|
6929
|
+
const allEvents = [...multiDayEvents, ...singleDayEvents];
|
|
6930
|
+
const handleDateClick = (date) => {
|
|
6931
|
+
setSelectedDate(date);
|
|
6932
|
+
setView("day");
|
|
6933
|
+
onDateClick?.(date);
|
|
6934
|
+
};
|
|
6935
|
+
const handleMoreClick = (date, events) => {
|
|
6936
|
+
setSelectedDate(date);
|
|
6937
|
+
setView("day");
|
|
6938
|
+
onMoreClick?.(date, events);
|
|
6939
|
+
};
|
|
6940
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("", className), children: [
|
|
6941
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-7 divide-x divide-border/50", children: WEEK_DAYS.map((day) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
6942
|
+
"div",
|
|
6943
|
+
{
|
|
6944
|
+
className: "flex items-center justify-center py-2",
|
|
6945
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-medium text-muted-foreground", children: day })
|
|
6946
|
+
},
|
|
6947
|
+
day
|
|
6948
|
+
)) }),
|
|
6949
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-7 overflow-hidden", children: cells.map((cell) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
6950
|
+
DayCell,
|
|
6951
|
+
{
|
|
6952
|
+
cell,
|
|
6953
|
+
events: allEvents,
|
|
6954
|
+
eventPositions,
|
|
6955
|
+
selectedDate,
|
|
6956
|
+
badgeVariant,
|
|
6957
|
+
maxEvents: maxEventsPerDay,
|
|
6958
|
+
onDateClick: handleDateClick,
|
|
6959
|
+
onEventClick,
|
|
6960
|
+
onMoreClick: handleMoreClick
|
|
6961
|
+
},
|
|
6962
|
+
cell.date.toISOString()
|
|
6963
|
+
)) })
|
|
6964
|
+
] });
|
|
6965
|
+
}
|
|
6966
|
+
function DayCell({
|
|
6967
|
+
cell,
|
|
6968
|
+
events,
|
|
6969
|
+
eventPositions,
|
|
6970
|
+
selectedDate,
|
|
6971
|
+
badgeVariant,
|
|
6972
|
+
maxEvents,
|
|
6973
|
+
onDateClick,
|
|
6974
|
+
onEventClick,
|
|
6975
|
+
onMoreClick
|
|
6976
|
+
}) {
|
|
6977
|
+
const { date, currentMonth } = cell;
|
|
6978
|
+
const isCurrentDay = dateFns.isToday(date);
|
|
6979
|
+
const isSelectedDay = dateFns.isSameDay(date, selectedDate);
|
|
6980
|
+
const { isOver, dropProps } = useDroppable({ date });
|
|
6981
|
+
const cellEvents = getMonthCellEvents(date, events, eventPositions);
|
|
6982
|
+
const positionedEvents = cellEvents.filter((e) => e.position !== -1);
|
|
6983
|
+
const hiddenEvents = cellEvents.filter((e) => e.position === -1);
|
|
6984
|
+
const slots = [null, null, null];
|
|
6985
|
+
positionedEvents.forEach((event) => {
|
|
6986
|
+
if (event.position >= 0 && event.position < 3) {
|
|
6987
|
+
slots[event.position] = event;
|
|
6988
|
+
}
|
|
6989
|
+
});
|
|
6990
|
+
const hiddenCount = hiddenEvents.length + positionedEvents.filter((e) => e.position >= 3).length;
|
|
6991
|
+
const isEventStart = (event) => dateFns.isSameDay(dateFns.parseISO(event.startDate), date);
|
|
6992
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6993
|
+
"div",
|
|
6994
|
+
{
|
|
6995
|
+
...dropProps,
|
|
6996
|
+
className: cn(
|
|
6997
|
+
"relative min-h-[120px] border-b border-r border-border/50 p-1 transition-colors",
|
|
6998
|
+
!currentMonth && "bg-muted/30",
|
|
6999
|
+
isOver && "bg-primary/10 ring-2 ring-primary/50 ring-inset"
|
|
7000
|
+
),
|
|
7001
|
+
children: [
|
|
7002
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7003
|
+
"button",
|
|
7004
|
+
{
|
|
7005
|
+
type: "button",
|
|
7006
|
+
onClick: () => onDateClick(date),
|
|
7007
|
+
className: cn(
|
|
7008
|
+
"mb-1 flex size-7 items-center justify-center text-sm transition-colors",
|
|
7009
|
+
"hover:bg-muted rounded-sm",
|
|
7010
|
+
isCurrentDay && "bg-primary text-primary-foreground hover:bg-primary/90 rounded-sm",
|
|
7011
|
+
isSelectedDay && !isCurrentDay && "bg-muted font-semibold rounded-sm",
|
|
7012
|
+
!currentMonth && "text-muted-foreground"
|
|
7013
|
+
),
|
|
7014
|
+
children: cell.day
|
|
7015
|
+
}
|
|
7016
|
+
),
|
|
7017
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-0.5", children: [
|
|
7018
|
+
slots.map((event, index) => {
|
|
7019
|
+
if (!event) {
|
|
7020
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-5" }, `empty-${index}`);
|
|
7021
|
+
}
|
|
7022
|
+
const showTitle = isEventStart(event) || dateFns.startOfDay(date).getDay() === 0;
|
|
7023
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DraggableEventWrapper, { event, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7024
|
+
EventBadge,
|
|
7025
|
+
{
|
|
7026
|
+
event,
|
|
7027
|
+
variant: badgeVariant,
|
|
7028
|
+
compact: true,
|
|
7029
|
+
showTime: showTitle,
|
|
7030
|
+
onClick: (e) => onEventClick?.(e),
|
|
7031
|
+
className: cn(
|
|
7032
|
+
"w-full",
|
|
7033
|
+
// If not showing title, make it appear as a continuation
|
|
7034
|
+
!showTitle && "rounded-l-none border-l-0"
|
|
7035
|
+
)
|
|
7036
|
+
}
|
|
7037
|
+
) }, event.id);
|
|
7038
|
+
}),
|
|
7039
|
+
hiddenCount > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
7040
|
+
MoreEvents,
|
|
7041
|
+
{
|
|
7042
|
+
count: hiddenCount,
|
|
7043
|
+
onClick: () => onMoreClick(date, cellEvents)
|
|
7044
|
+
}
|
|
7045
|
+
)
|
|
7046
|
+
] })
|
|
7047
|
+
]
|
|
7048
|
+
}
|
|
7049
|
+
);
|
|
7050
|
+
}
|
|
7051
|
+
function DraggableEventWrapper2({
|
|
7052
|
+
event,
|
|
7053
|
+
children,
|
|
7054
|
+
className,
|
|
7055
|
+
style
|
|
7056
|
+
}) {
|
|
7057
|
+
const { isDragged, dragProps } = useDraggable(event);
|
|
7058
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
7059
|
+
"div",
|
|
7060
|
+
{
|
|
7061
|
+
...dragProps,
|
|
7062
|
+
className: cn(
|
|
7063
|
+
className,
|
|
7064
|
+
"transition-opacity",
|
|
7065
|
+
isDragged && "opacity-50"
|
|
7066
|
+
),
|
|
7067
|
+
style,
|
|
7068
|
+
children
|
|
7069
|
+
}
|
|
7070
|
+
);
|
|
7071
|
+
}
|
|
7072
|
+
function DroppableTimeSlot({
|
|
7073
|
+
date,
|
|
7074
|
+
hour,
|
|
7075
|
+
minute,
|
|
7076
|
+
className,
|
|
7077
|
+
onClick
|
|
7078
|
+
}) {
|
|
7079
|
+
const { isOver, dropProps } = useDroppable({ date, hour, minute });
|
|
7080
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
7081
|
+
"div",
|
|
7082
|
+
{
|
|
7083
|
+
...dropProps,
|
|
7084
|
+
onClick,
|
|
7085
|
+
className: cn(
|
|
7086
|
+
className,
|
|
7087
|
+
"cursor-pointer transition-colors hover:bg-accent",
|
|
7088
|
+
isOver && "bg-primary/20"
|
|
7089
|
+
)
|
|
7090
|
+
}
|
|
7091
|
+
);
|
|
7092
|
+
}
|
|
7093
|
+
function WeekView({
|
|
7094
|
+
className,
|
|
7095
|
+
weekStartsOn = 0,
|
|
7096
|
+
onEventClick,
|
|
7097
|
+
onDateClick,
|
|
7098
|
+
onTimeClick
|
|
7099
|
+
}) {
|
|
7100
|
+
const {
|
|
7101
|
+
selectedDate,
|
|
7102
|
+
badgeVariant,
|
|
7103
|
+
workingHours,
|
|
7104
|
+
visibleHours
|
|
7105
|
+
} = useEventCalendar();
|
|
7106
|
+
const filteredEvents = useFilteredEvents();
|
|
7107
|
+
const { singleDayEvents, multiDayEvents } = React15__namespace.useMemo(
|
|
7108
|
+
() => splitEventsByDuration(filteredEvents),
|
|
7109
|
+
[filteredEvents]
|
|
7110
|
+
);
|
|
7111
|
+
const { hours, earliestEventHour, latestEventHour } = getVisibleHours(
|
|
7112
|
+
visibleHours,
|
|
7113
|
+
singleDayEvents
|
|
7114
|
+
);
|
|
7115
|
+
const weekStart = dateFns.startOfWeek(selectedDate, { weekStartsOn });
|
|
7116
|
+
const weekDays = Array.from({ length: 7 }, (_, i) => dateFns.addDays(weekStart, i));
|
|
7117
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
7118
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center justify-center border-b py-4 text-sm text-muted-foreground sm:hidden", children: [
|
|
7119
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { children: "Weekly view is not available on smaller devices." }),
|
|
7120
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { children: "Please switch to daily or monthly view." })
|
|
7121
|
+
] }),
|
|
7122
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("hidden flex-col sm:flex", className), children: [
|
|
7123
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7124
|
+
WeekViewMultiDayEventsRow,
|
|
7125
|
+
{
|
|
7126
|
+
selectedDate,
|
|
7127
|
+
multiDayEvents
|
|
7128
|
+
}
|
|
7129
|
+
),
|
|
7130
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative z-20 flex border-b border-border/50", children: [
|
|
7131
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-18" }),
|
|
7132
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid flex-1 grid-cols-7 divide-x divide-border/50 border-l border-border/50", children: weekDays.map((day, index) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7133
|
+
"span",
|
|
7134
|
+
{
|
|
7135
|
+
className: "py-2 text-center text-xs font-medium text-muted-foreground",
|
|
7136
|
+
children: [
|
|
7137
|
+
dateFns.format(day, "EE"),
|
|
7138
|
+
" ",
|
|
7139
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-1 font-semibold text-foreground", children: dateFns.format(day, "d") })
|
|
7140
|
+
]
|
|
7141
|
+
},
|
|
7142
|
+
index
|
|
7143
|
+
)) })
|
|
7144
|
+
] }),
|
|
7145
|
+
/* @__PURE__ */ jsxRuntime.jsx(ScrollArea, { className: "h-[736px]", type: "always", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex overflow-hidden", children: [
|
|
7146
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative w-18", children: hours.map((hour, index) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative", style: { height: "96px" }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute -top-3 right-2 flex h-6 items-center", children: index !== 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground", children: dateFns.format((/* @__PURE__ */ new Date()).setHours(hour, 0, 0, 0), "hh a") }) }) }, hour)) }),
|
|
7147
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex-1 border-l border-border/50", children: [
|
|
7148
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-7 divide-x divide-border/50", children: weekDays.map((day, dayIndex) => {
|
|
7149
|
+
const dayEvents = singleDayEvents.filter(
|
|
7150
|
+
(event) => dateFns.isSameDay(dateFns.parseISO(event.startDate), day) || dateFns.isSameDay(dateFns.parseISO(event.endDate), day)
|
|
7151
|
+
);
|
|
7152
|
+
const groupedEvents = groupEvents(dayEvents);
|
|
7153
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
7154
|
+
hours.map((hour, index) => {
|
|
7155
|
+
const isDisabled = !isWorkingHour(day, hour, workingHours);
|
|
7156
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7157
|
+
"div",
|
|
7158
|
+
{
|
|
7159
|
+
className: cn(
|
|
7160
|
+
"relative",
|
|
7161
|
+
isDisabled && "bg-[repeating-linear-gradient(45deg,transparent,transparent_5px,rgba(0,0,0,0.04)_5px,rgba(0,0,0,0.04)_10px)] dark:bg-[repeating-linear-gradient(45deg,transparent,transparent_5px,rgba(255,255,255,0.04)_5px,rgba(255,255,255,0.04)_10px)]"
|
|
7162
|
+
),
|
|
7163
|
+
style: { height: "96px" },
|
|
7164
|
+
children: [
|
|
7165
|
+
index !== 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pointer-events-none absolute inset-x-0 top-0 border-b border-border/40" }),
|
|
7166
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7167
|
+
DroppableTimeSlot,
|
|
7168
|
+
{
|
|
7169
|
+
date: day,
|
|
7170
|
+
hour,
|
|
7171
|
+
minute: 0,
|
|
7172
|
+
className: "absolute inset-x-0 top-0 h-[24px]",
|
|
7173
|
+
onClick: () => onTimeClick?.(day, hour, 0)
|
|
7174
|
+
}
|
|
7175
|
+
),
|
|
7176
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7177
|
+
DroppableTimeSlot,
|
|
7178
|
+
{
|
|
7179
|
+
date: day,
|
|
7180
|
+
hour,
|
|
7181
|
+
minute: 15,
|
|
7182
|
+
className: "absolute inset-x-0 top-[24px] h-[24px]",
|
|
7183
|
+
onClick: () => onTimeClick?.(day, hour, 15)
|
|
7184
|
+
}
|
|
7185
|
+
),
|
|
7186
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pointer-events-none absolute inset-x-0 top-1/2 border-b border-dashed border-border/30" }),
|
|
7187
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7188
|
+
DroppableTimeSlot,
|
|
7189
|
+
{
|
|
7190
|
+
date: day,
|
|
7191
|
+
hour,
|
|
7192
|
+
minute: 30,
|
|
7193
|
+
className: "absolute inset-x-0 top-[48px] h-[24px]",
|
|
7194
|
+
onClick: () => onTimeClick?.(day, hour, 30)
|
|
7195
|
+
}
|
|
7196
|
+
),
|
|
7197
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7198
|
+
DroppableTimeSlot,
|
|
7199
|
+
{
|
|
7200
|
+
date: day,
|
|
7201
|
+
hour,
|
|
7202
|
+
minute: 45,
|
|
7203
|
+
className: "absolute inset-x-0 top-[72px] h-[24px]",
|
|
7204
|
+
onClick: () => onTimeClick?.(day, hour, 45)
|
|
7205
|
+
}
|
|
7206
|
+
)
|
|
7207
|
+
]
|
|
7208
|
+
},
|
|
7209
|
+
hour
|
|
7210
|
+
);
|
|
7211
|
+
}),
|
|
7212
|
+
groupedEvents.map(
|
|
7213
|
+
(group, groupIndex) => group.map((event) => {
|
|
7214
|
+
let style = getEventBlockStyle(
|
|
7215
|
+
event,
|
|
7216
|
+
day,
|
|
7217
|
+
groupIndex,
|
|
7218
|
+
groupedEvents.length,
|
|
7219
|
+
{ from: earliestEventHour}
|
|
7220
|
+
);
|
|
7221
|
+
const hasOverlap = groupedEvents.some(
|
|
7222
|
+
(otherGroup, otherIndex) => otherIndex !== groupIndex && otherGroup.some(
|
|
7223
|
+
(otherEvent) => dateFns.areIntervalsOverlapping(
|
|
7224
|
+
{
|
|
7225
|
+
start: dateFns.parseISO(event.startDate),
|
|
7226
|
+
end: dateFns.parseISO(event.endDate)
|
|
7227
|
+
},
|
|
7228
|
+
{
|
|
7229
|
+
start: dateFns.parseISO(otherEvent.startDate),
|
|
7230
|
+
end: dateFns.parseISO(otherEvent.endDate)
|
|
7231
|
+
}
|
|
7232
|
+
)
|
|
7233
|
+
)
|
|
7234
|
+
);
|
|
7235
|
+
if (!hasOverlap) {
|
|
7236
|
+
style = { ...style, width: "100%", left: "0%" };
|
|
7237
|
+
}
|
|
7238
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
7239
|
+
DraggableEventWrapper2,
|
|
7240
|
+
{
|
|
7241
|
+
event,
|
|
7242
|
+
className: "absolute px-0.5 py-0.5",
|
|
7243
|
+
style,
|
|
7244
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7245
|
+
EventBadge,
|
|
7246
|
+
{
|
|
7247
|
+
event,
|
|
7248
|
+
variant: badgeVariant,
|
|
7249
|
+
showTime: true,
|
|
7250
|
+
onClick: (e) => onEventClick?.(e),
|
|
7251
|
+
className: "h-full w-full"
|
|
7252
|
+
}
|
|
7253
|
+
)
|
|
7254
|
+
},
|
|
7255
|
+
event.id
|
|
7256
|
+
);
|
|
7257
|
+
})
|
|
7258
|
+
)
|
|
7259
|
+
] }, dayIndex);
|
|
7260
|
+
}) }),
|
|
7261
|
+
weekDays.some((day) => dateFns.isToday(day)) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
7262
|
+
CalendarTimeline,
|
|
7263
|
+
{
|
|
7264
|
+
firstVisibleHour: earliestEventHour,
|
|
7265
|
+
lastVisibleHour: latestEventHour
|
|
7266
|
+
}
|
|
7267
|
+
)
|
|
7268
|
+
] })
|
|
7269
|
+
] }) })
|
|
7270
|
+
] })
|
|
7271
|
+
] });
|
|
7272
|
+
}
|
|
7273
|
+
function WeekViewMultiDayEventsRow({
|
|
7274
|
+
selectedDate,
|
|
7275
|
+
multiDayEvents
|
|
7276
|
+
}) {
|
|
7277
|
+
const { badgeVariant } = useEventCalendar();
|
|
7278
|
+
if (multiDayEvents.length === 0) return null;
|
|
7279
|
+
const weekStart = dateFns.startOfWeek(selectedDate);
|
|
7280
|
+
const weekDays = Array.from({ length: 7 }, (_, i) => dateFns.addDays(weekStart, i));
|
|
7281
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "hidden border-b sm:flex", children: [
|
|
7282
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-18 shrink-0" }),
|
|
7283
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid flex-1 grid-cols-7 divide-x border-l", children: weekDays.map((day, index) => {
|
|
7284
|
+
const dayMultiEvents = multiDayEvents.filter((event) => {
|
|
7285
|
+
const start = dateFns.parseISO(event.startDate);
|
|
7286
|
+
const end = dateFns.parseISO(event.endDate);
|
|
7287
|
+
return day >= start && day <= end;
|
|
7288
|
+
});
|
|
7289
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-h-[32px] space-y-1 p-1", children: [
|
|
7290
|
+
dayMultiEvents.slice(0, 2).map((event) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
7291
|
+
EventBadge,
|
|
7292
|
+
{
|
|
7293
|
+
event,
|
|
7294
|
+
variant: badgeVariant,
|
|
7295
|
+
compact: true,
|
|
7296
|
+
className: "w-full"
|
|
7297
|
+
},
|
|
7298
|
+
event.id
|
|
7299
|
+
)),
|
|
7300
|
+
dayMultiEvents.length > 2 && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs text-muted-foreground text-center", children: [
|
|
7301
|
+
"+",
|
|
7302
|
+
dayMultiEvents.length - 2,
|
|
7303
|
+
" more"
|
|
7304
|
+
] })
|
|
7305
|
+
] }, index);
|
|
7306
|
+
}) })
|
|
7307
|
+
] });
|
|
7308
|
+
}
|
|
7309
|
+
function CalendarTimeline({
|
|
7310
|
+
firstVisibleHour,
|
|
7311
|
+
lastVisibleHour
|
|
7312
|
+
}) {
|
|
7313
|
+
const [currentTime, setCurrentTime] = React15__namespace.useState(/* @__PURE__ */ new Date());
|
|
7314
|
+
React15__namespace.useEffect(() => {
|
|
7315
|
+
const interval = setInterval(() => {
|
|
7316
|
+
setCurrentTime(/* @__PURE__ */ new Date());
|
|
7317
|
+
}, 6e4);
|
|
7318
|
+
return () => clearInterval(interval);
|
|
7319
|
+
}, []);
|
|
7320
|
+
const currentHour = currentTime.getHours();
|
|
7321
|
+
const currentMinute = currentTime.getMinutes();
|
|
7322
|
+
if (currentHour < firstVisibleHour || currentHour >= lastVisibleHour) {
|
|
7323
|
+
return null;
|
|
7324
|
+
}
|
|
7325
|
+
const minutesSinceStart = (currentHour - firstVisibleHour) * 60 + currentMinute;
|
|
7326
|
+
const totalMinutes = (lastVisibleHour - firstVisibleHour) * 60;
|
|
7327
|
+
const topPercent = minutesSinceStart / totalMinutes * 100;
|
|
7328
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7329
|
+
"div",
|
|
7330
|
+
{
|
|
7331
|
+
className: "pointer-events-none absolute inset-x-0 z-30 flex items-center",
|
|
7332
|
+
style: { top: `${topPercent}%` },
|
|
7333
|
+
children: [
|
|
7334
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "size-3 -translate-x-1/2 rounded-full bg-red-500" }),
|
|
7335
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-0.5 flex-1 bg-red-500" })
|
|
7336
|
+
]
|
|
7337
|
+
}
|
|
7338
|
+
);
|
|
7339
|
+
}
|
|
7340
|
+
function DraggableEventWrapper3({
|
|
7341
|
+
event,
|
|
7342
|
+
children,
|
|
7343
|
+
className,
|
|
7344
|
+
style
|
|
7345
|
+
}) {
|
|
7346
|
+
const { isDragged, dragProps } = useDraggable(event);
|
|
7347
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
7348
|
+
"div",
|
|
7349
|
+
{
|
|
7350
|
+
...dragProps,
|
|
7351
|
+
className: cn(
|
|
7352
|
+
className,
|
|
7353
|
+
"transition-opacity",
|
|
7354
|
+
isDragged && "opacity-50"
|
|
7355
|
+
),
|
|
7356
|
+
style,
|
|
7357
|
+
children
|
|
7358
|
+
}
|
|
7359
|
+
);
|
|
7360
|
+
}
|
|
7361
|
+
function DroppableTimeSlot2({
|
|
7362
|
+
date,
|
|
7363
|
+
hour,
|
|
7364
|
+
minute,
|
|
7365
|
+
className,
|
|
7366
|
+
onClick
|
|
7367
|
+
}) {
|
|
7368
|
+
const { isOver, dropProps } = useDroppable({ date, hour, minute });
|
|
7369
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
7370
|
+
"div",
|
|
7371
|
+
{
|
|
7372
|
+
...dropProps,
|
|
7373
|
+
onClick,
|
|
7374
|
+
className: cn(
|
|
7375
|
+
className,
|
|
7376
|
+
"cursor-pointer transition-colors hover:bg-accent",
|
|
7377
|
+
isOver && "bg-primary/20"
|
|
7378
|
+
)
|
|
7379
|
+
}
|
|
7380
|
+
);
|
|
7381
|
+
}
|
|
7382
|
+
function DayView({
|
|
7383
|
+
className,
|
|
7384
|
+
showSidebar = true,
|
|
7385
|
+
onEventClick,
|
|
7386
|
+
onTimeClick
|
|
7387
|
+
}) {
|
|
7388
|
+
const {
|
|
7389
|
+
selectedDate,
|
|
7390
|
+
setSelectedDate,
|
|
7391
|
+
badgeVariant,
|
|
7392
|
+
users,
|
|
7393
|
+
workingHours,
|
|
7394
|
+
visibleHours
|
|
7395
|
+
} = useEventCalendar();
|
|
7396
|
+
const filteredEvents = useFilteredEvents();
|
|
7397
|
+
const { singleDayEvents, multiDayEvents } = React15__namespace.useMemo(
|
|
7398
|
+
() => splitEventsByDuration(filteredEvents),
|
|
7399
|
+
[filteredEvents]
|
|
7400
|
+
);
|
|
7401
|
+
const { hours, earliestEventHour, latestEventHour } = getVisibleHours(
|
|
7402
|
+
visibleHours,
|
|
7403
|
+
singleDayEvents
|
|
7404
|
+
);
|
|
7405
|
+
const currentEvents = React15__namespace.useMemo(() => {
|
|
7406
|
+
if (!dateFns.isToday(selectedDate)) return [];
|
|
7407
|
+
return getCurrentEvents(singleDayEvents);
|
|
7408
|
+
}, [singleDayEvents, selectedDate]);
|
|
7409
|
+
const dayEvents = singleDayEvents.filter((event) => {
|
|
7410
|
+
const eventDate = dateFns.parseISO(event.startDate);
|
|
7411
|
+
return eventDate.getDate() === selectedDate.getDate() && eventDate.getMonth() === selectedDate.getMonth() && eventDate.getFullYear() === selectedDate.getFullYear();
|
|
7412
|
+
});
|
|
7413
|
+
const groupedEvents = groupEvents(dayEvents);
|
|
7414
|
+
const handleDateSelect = (date) => {
|
|
7415
|
+
if (date) {
|
|
7416
|
+
setSelectedDate(date);
|
|
7417
|
+
}
|
|
7418
|
+
};
|
|
7419
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex", className), children: [
|
|
7420
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-1 flex-col", children: [
|
|
7421
|
+
multiDayEvents.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
7422
|
+
DayViewMultiDayEventsRow,
|
|
7423
|
+
{
|
|
7424
|
+
selectedDate,
|
|
7425
|
+
multiDayEvents
|
|
7426
|
+
}
|
|
7427
|
+
),
|
|
7428
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative z-20 flex border-b border-border/50", children: [
|
|
7429
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-18" }),
|
|
7430
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex-1 border-l border-border/50 py-2 text-center text-xs font-medium text-muted-foreground", children: [
|
|
7431
|
+
dateFns.format(selectedDate, "EE"),
|
|
7432
|
+
" ",
|
|
7433
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold text-foreground", children: dateFns.format(selectedDate, "d") })
|
|
7434
|
+
] })
|
|
7435
|
+
] }),
|
|
7436
|
+
/* @__PURE__ */ jsxRuntime.jsx(ScrollArea, { className: "h-[800px]", type: "always", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex", children: [
|
|
7437
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative w-18", children: hours.map((hour, index) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative", style: { height: "96px" }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute -top-3 right-2 flex h-6 items-center", children: index !== 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground", children: dateFns.format((/* @__PURE__ */ new Date()).setHours(hour, 0, 0, 0), "hh a") }) }) }, hour)) }),
|
|
7438
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex-1 border-l border-border/50", children: [
|
|
7439
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
7440
|
+
hours.map((hour, index) => {
|
|
7441
|
+
const isDisabled = !isWorkingHour(selectedDate, hour, workingHours);
|
|
7442
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7443
|
+
"div",
|
|
7444
|
+
{
|
|
7445
|
+
className: cn(
|
|
7446
|
+
"relative",
|
|
7447
|
+
isDisabled && "bg-[repeating-linear-gradient(45deg,transparent,transparent_5px,rgba(0,0,0,0.04)_5px,rgba(0,0,0,0.04)_10px)] dark:bg-[repeating-linear-gradient(45deg,transparent,transparent_5px,rgba(255,255,255,0.04)_5px,rgba(255,255,255,0.04)_10px)]"
|
|
7448
|
+
),
|
|
7449
|
+
style: { height: "96px" },
|
|
7450
|
+
children: [
|
|
7451
|
+
index !== 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pointer-events-none absolute inset-x-0 top-0 border-b border-border/40" }),
|
|
7452
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7453
|
+
DroppableTimeSlot2,
|
|
7454
|
+
{
|
|
7455
|
+
date: selectedDate,
|
|
7456
|
+
hour,
|
|
7457
|
+
minute: 0,
|
|
7458
|
+
className: "absolute inset-x-0 top-0 h-[24px]",
|
|
7459
|
+
onClick: () => onTimeClick?.(selectedDate, hour, 0)
|
|
7460
|
+
}
|
|
7461
|
+
),
|
|
7462
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7463
|
+
DroppableTimeSlot2,
|
|
7464
|
+
{
|
|
7465
|
+
date: selectedDate,
|
|
7466
|
+
hour,
|
|
7467
|
+
minute: 15,
|
|
7468
|
+
className: "absolute inset-x-0 top-[24px] h-[24px]",
|
|
7469
|
+
onClick: () => onTimeClick?.(selectedDate, hour, 15)
|
|
7470
|
+
}
|
|
7471
|
+
),
|
|
7472
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pointer-events-none absolute inset-x-0 top-1/2 border-b border-dashed border-border/30" }),
|
|
7473
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7474
|
+
DroppableTimeSlot2,
|
|
7475
|
+
{
|
|
7476
|
+
date: selectedDate,
|
|
7477
|
+
hour,
|
|
7478
|
+
minute: 30,
|
|
7479
|
+
className: "absolute inset-x-0 top-[48px] h-[24px]",
|
|
7480
|
+
onClick: () => onTimeClick?.(selectedDate, hour, 30)
|
|
7481
|
+
}
|
|
7482
|
+
),
|
|
7483
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7484
|
+
DroppableTimeSlot2,
|
|
7485
|
+
{
|
|
7486
|
+
date: selectedDate,
|
|
7487
|
+
hour,
|
|
7488
|
+
minute: 45,
|
|
7489
|
+
className: "absolute inset-x-0 top-[72px] h-[24px]",
|
|
7490
|
+
onClick: () => onTimeClick?.(selectedDate, hour, 45)
|
|
7491
|
+
}
|
|
7492
|
+
)
|
|
7493
|
+
]
|
|
7494
|
+
},
|
|
7495
|
+
hour
|
|
7496
|
+
);
|
|
7497
|
+
}),
|
|
7498
|
+
groupedEvents.map(
|
|
7499
|
+
(group, groupIndex) => group.map((event) => {
|
|
7500
|
+
let style = getEventBlockStyle(
|
|
7501
|
+
event,
|
|
7502
|
+
selectedDate,
|
|
7503
|
+
groupIndex,
|
|
7504
|
+
groupedEvents.length,
|
|
7505
|
+
{ from: earliestEventHour}
|
|
7506
|
+
);
|
|
7507
|
+
const hasOverlap = groupedEvents.some(
|
|
7508
|
+
(otherGroup, otherIndex) => otherIndex !== groupIndex && otherGroup.some(
|
|
7509
|
+
(otherEvent) => dateFns.areIntervalsOverlapping(
|
|
7510
|
+
{
|
|
7511
|
+
start: dateFns.parseISO(event.startDate),
|
|
7512
|
+
end: dateFns.parseISO(event.endDate)
|
|
7513
|
+
},
|
|
7514
|
+
{
|
|
7515
|
+
start: dateFns.parseISO(otherEvent.startDate),
|
|
7516
|
+
end: dateFns.parseISO(otherEvent.endDate)
|
|
7517
|
+
}
|
|
7518
|
+
)
|
|
7519
|
+
)
|
|
7520
|
+
);
|
|
7521
|
+
if (!hasOverlap) {
|
|
7522
|
+
style = { ...style, width: "100%", left: "0%" };
|
|
7523
|
+
}
|
|
7524
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
7525
|
+
DraggableEventWrapper3,
|
|
7526
|
+
{
|
|
7527
|
+
event,
|
|
7528
|
+
className: "absolute px-1 py-0.5",
|
|
7529
|
+
style,
|
|
7530
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7531
|
+
EventBadge,
|
|
7532
|
+
{
|
|
7533
|
+
event,
|
|
7534
|
+
variant: badgeVariant,
|
|
7535
|
+
showTime: true,
|
|
7536
|
+
onClick: (e) => onEventClick?.(e),
|
|
7537
|
+
className: "h-full w-full"
|
|
7538
|
+
}
|
|
7539
|
+
)
|
|
7540
|
+
},
|
|
7541
|
+
event.id
|
|
7542
|
+
);
|
|
7543
|
+
})
|
|
7544
|
+
)
|
|
7545
|
+
] }),
|
|
7546
|
+
dateFns.isToday(selectedDate) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
7547
|
+
CalendarTimeline2,
|
|
7548
|
+
{
|
|
7549
|
+
firstVisibleHour: earliestEventHour,
|
|
7550
|
+
lastVisibleHour: latestEventHour
|
|
7551
|
+
}
|
|
7552
|
+
)
|
|
7553
|
+
] })
|
|
7554
|
+
] }) })
|
|
7555
|
+
] }),
|
|
7556
|
+
showSidebar && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "hidden w-64 divide-y border-l md:block", children: [
|
|
7557
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7558
|
+
Calendar,
|
|
7559
|
+
{
|
|
7560
|
+
className: "mx-auto w-fit",
|
|
7561
|
+
mode: "single",
|
|
7562
|
+
selected: selectedDate,
|
|
7563
|
+
onSelect: handleDateSelect
|
|
7564
|
+
}
|
|
7565
|
+
),
|
|
7566
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 space-y-3", children: [
|
|
7567
|
+
currentEvents.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-2 px-4 pt-4", children: [
|
|
7568
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "relative mt-[5px] flex size-2.5", children: [
|
|
7569
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute inline-flex size-full animate-ping rounded-full bg-green-400 opacity-75" }),
|
|
7570
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "relative inline-flex size-2.5 rounded-full bg-green-600" })
|
|
7571
|
+
] }),
|
|
7572
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-semibold text-foreground", children: "Happening now" })
|
|
7573
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("p", { className: "p-4 text-center text-sm italic text-muted-foreground", children: "No appointments or consultations at the moment" }),
|
|
7574
|
+
currentEvents.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(ScrollArea, { className: "h-[422px] px-4", type: "always", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-6 pb-4", children: currentEvents.map((event) => {
|
|
7575
|
+
const user = users.find((u) => u.id === event.user.id);
|
|
7576
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
|
|
7577
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "line-clamp-2 text-sm font-semibold", children: event.title }),
|
|
7578
|
+
user && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5 text-muted-foreground", children: [
|
|
7579
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.User, { className: "size-3.5" }),
|
|
7580
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm", children: user.name })
|
|
7581
|
+
] }),
|
|
7582
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5 text-muted-foreground", children: [
|
|
7583
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Calendar, { className: "size-3.5" }),
|
|
7584
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm", children: dateFns.format(/* @__PURE__ */ new Date(), "MMM d, yyyy") })
|
|
7585
|
+
] }),
|
|
7586
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5 text-muted-foreground", children: [
|
|
7587
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Clock, { className: "size-3.5" }),
|
|
7588
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-sm", children: [
|
|
7589
|
+
dateFns.format(dateFns.parseISO(event.startDate), "h:mm a"),
|
|
7590
|
+
" -",
|
|
7591
|
+
" ",
|
|
7592
|
+
dateFns.format(dateFns.parseISO(event.endDate), "h:mm a")
|
|
7593
|
+
] })
|
|
7594
|
+
] })
|
|
7595
|
+
] }, event.id);
|
|
7596
|
+
}) }) })
|
|
7597
|
+
] })
|
|
7598
|
+
] })
|
|
7599
|
+
] });
|
|
7600
|
+
}
|
|
7601
|
+
function DayViewMultiDayEventsRow({
|
|
7602
|
+
selectedDate,
|
|
7603
|
+
multiDayEvents
|
|
7604
|
+
}) {
|
|
7605
|
+
const { badgeVariant } = useEventCalendar();
|
|
7606
|
+
const relevantEvents = multiDayEvents.filter((event) => {
|
|
7607
|
+
const start = dateFns.parseISO(event.startDate);
|
|
7608
|
+
const end = dateFns.parseISO(event.endDate);
|
|
7609
|
+
return selectedDate >= start && selectedDate <= end;
|
|
7610
|
+
});
|
|
7611
|
+
if (relevantEvents.length === 0) return null;
|
|
7612
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex border-b", children: [
|
|
7613
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-18 shrink-0" }),
|
|
7614
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 space-y-1 border-l p-2", children: relevantEvents.map((event) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
7615
|
+
EventBadge,
|
|
7616
|
+
{
|
|
7617
|
+
event,
|
|
7618
|
+
variant: badgeVariant,
|
|
7619
|
+
className: "w-full"
|
|
7620
|
+
},
|
|
7621
|
+
event.id
|
|
7622
|
+
)) })
|
|
7623
|
+
] });
|
|
7624
|
+
}
|
|
7625
|
+
function CalendarTimeline2({
|
|
7626
|
+
firstVisibleHour,
|
|
7627
|
+
lastVisibleHour
|
|
7628
|
+
}) {
|
|
7629
|
+
const [currentTime, setCurrentTime] = React15__namespace.useState(/* @__PURE__ */ new Date());
|
|
7630
|
+
React15__namespace.useEffect(() => {
|
|
7631
|
+
const interval = setInterval(() => {
|
|
7632
|
+
setCurrentTime(/* @__PURE__ */ new Date());
|
|
7633
|
+
}, 6e4);
|
|
7634
|
+
return () => clearInterval(interval);
|
|
7635
|
+
}, []);
|
|
7636
|
+
const currentHour = currentTime.getHours();
|
|
7637
|
+
const currentMinute = currentTime.getMinutes();
|
|
7638
|
+
if (currentHour < firstVisibleHour || currentHour >= lastVisibleHour) {
|
|
7639
|
+
return null;
|
|
7640
|
+
}
|
|
7641
|
+
const minutesSinceStart = (currentHour - firstVisibleHour) * 60 + currentMinute;
|
|
7642
|
+
const totalMinutes = (lastVisibleHour - firstVisibleHour) * 60;
|
|
7643
|
+
const topPercent = minutesSinceStart / totalMinutes * 100;
|
|
7644
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7645
|
+
"div",
|
|
7646
|
+
{
|
|
7647
|
+
className: "pointer-events-none absolute inset-x-0 z-30 flex items-center",
|
|
7648
|
+
style: { top: `${topPercent}%` },
|
|
7649
|
+
children: [
|
|
7650
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "size-3 -translate-x-1/2 rounded-full bg-red-500" }),
|
|
7651
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-0.5 flex-1 bg-red-500" })
|
|
7652
|
+
]
|
|
7653
|
+
}
|
|
7654
|
+
);
|
|
7655
|
+
}
|
|
7656
|
+
function YearView({
|
|
7657
|
+
className,
|
|
7658
|
+
weekStartsOn = 0,
|
|
7659
|
+
onMonthClick,
|
|
7660
|
+
onDateClick
|
|
7661
|
+
}) {
|
|
7662
|
+
const { selectedDate, setSelectedDate, setView } = useEventCalendar();
|
|
7663
|
+
const filteredEvents = useFilteredEvents();
|
|
7664
|
+
const months = React15__namespace.useMemo(() => {
|
|
7665
|
+
const yearStart = dateFns.startOfYear(selectedDate);
|
|
7666
|
+
return Array.from({ length: 12 }, (_, i) => dateFns.addMonths(yearStart, i));
|
|
7667
|
+
}, [selectedDate]);
|
|
7668
|
+
const handleMonthClick = (date) => {
|
|
7669
|
+
setSelectedDate(date);
|
|
7670
|
+
setView("month");
|
|
7671
|
+
onMonthClick?.(date);
|
|
7672
|
+
};
|
|
7673
|
+
const handleDateClick = (date) => {
|
|
7674
|
+
setSelectedDate(date);
|
|
7675
|
+
setView("day");
|
|
7676
|
+
onDateClick?.(date);
|
|
7677
|
+
};
|
|
7678
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ScrollArea, { className: cn("h-full", className), type: "always", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4", children: months.map((month) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
7679
|
+
YearViewMonth,
|
|
7680
|
+
{
|
|
7681
|
+
month,
|
|
7682
|
+
events: filteredEvents,
|
|
7683
|
+
onMonthClick: () => handleMonthClick(month),
|
|
7684
|
+
onDateClick: handleDateClick
|
|
7685
|
+
},
|
|
7686
|
+
month.toString()
|
|
7687
|
+
)) }) }) });
|
|
7688
|
+
}
|
|
7689
|
+
function YearViewMonth({
|
|
7690
|
+
month,
|
|
7691
|
+
events,
|
|
7692
|
+
onMonthClick,
|
|
7693
|
+
onDateClick
|
|
7694
|
+
}) {
|
|
7695
|
+
const cells = getCalendarCells(month);
|
|
7696
|
+
const monthEvents = events.filter((event) => {
|
|
7697
|
+
const eventStart = dateFns.parseISO(event.startDate);
|
|
7698
|
+
return dateFns.isSameMonth(eventStart, month);
|
|
7699
|
+
});
|
|
7700
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-sm border border-border/50 bg-card p-3", children: [
|
|
7701
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
7702
|
+
"button",
|
|
7703
|
+
{
|
|
7704
|
+
type: "button",
|
|
7705
|
+
onClick: onMonthClick,
|
|
7706
|
+
className: "mb-2 w-full text-left text-sm font-semibold transition-colors hover:text-primary",
|
|
7707
|
+
children: [
|
|
7708
|
+
dateFns.format(month, "MMMM"),
|
|
7709
|
+
monthEvents.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "ml-2 text-xs font-normal text-muted-foreground", children: [
|
|
7710
|
+
"(",
|
|
7711
|
+
monthEvents.length,
|
|
7712
|
+
")"
|
|
7713
|
+
] })
|
|
7714
|
+
]
|
|
7715
|
+
}
|
|
7716
|
+
),
|
|
7717
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-1 grid grid-cols-7", children: ["S", "M", "T", "W", "T", "F", "S"].map((day, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
7718
|
+
"div",
|
|
7719
|
+
{
|
|
7720
|
+
className: "text-center text-[10px] font-medium text-muted-foreground",
|
|
7721
|
+
children: day
|
|
7722
|
+
},
|
|
7723
|
+
i
|
|
7724
|
+
)) }),
|
|
7725
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-7", children: cells.map((cell) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
7726
|
+
YearViewDayCell,
|
|
7727
|
+
{
|
|
7728
|
+
cell,
|
|
7729
|
+
month,
|
|
7730
|
+
events,
|
|
7731
|
+
onDateClick
|
|
7732
|
+
},
|
|
7733
|
+
cell.date.toISOString()
|
|
7734
|
+
)) })
|
|
7735
|
+
] });
|
|
7736
|
+
}
|
|
7737
|
+
function YearViewDayCell({
|
|
7738
|
+
cell,
|
|
7739
|
+
month,
|
|
7740
|
+
events,
|
|
7741
|
+
onDateClick
|
|
7742
|
+
}) {
|
|
7743
|
+
const { date, currentMonth } = cell;
|
|
7744
|
+
const isCurrentDay = dateFns.isToday(date);
|
|
7745
|
+
const dayEvents = events.filter((event) => {
|
|
7746
|
+
const eventStart = dateFns.parseISO(event.startDate);
|
|
7747
|
+
const eventEnd = dateFns.parseISO(event.endDate);
|
|
7748
|
+
return date >= eventStart && date <= eventEnd || dateFns.isSameDay(eventStart, date) || dateFns.isSameDay(eventEnd, date);
|
|
7749
|
+
});
|
|
7750
|
+
const hasEvents = dayEvents.length > 0;
|
|
7751
|
+
if (!currentMonth) {
|
|
7752
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "aspect-square" });
|
|
7753
|
+
}
|
|
7754
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7755
|
+
"button",
|
|
7756
|
+
{
|
|
7757
|
+
type: "button",
|
|
7758
|
+
onClick: () => onDateClick(date),
|
|
7759
|
+
className: cn(
|
|
7760
|
+
"relative flex aspect-square items-center justify-center text-[11px] transition-colors",
|
|
7761
|
+
"hover:bg-muted rounded-sm",
|
|
7762
|
+
isCurrentDay && "bg-primary text-primary-foreground rounded-sm hover:bg-primary/90"
|
|
7763
|
+
),
|
|
7764
|
+
children: [
|
|
7765
|
+
cell.day,
|
|
7766
|
+
hasEvents && !isCurrentDay && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute bottom-0.5 left-1/2 size-1 -translate-x-1/2 rounded-full bg-primary" })
|
|
7767
|
+
]
|
|
7768
|
+
}
|
|
7769
|
+
);
|
|
7770
|
+
}
|
|
7771
|
+
var colorClasses2 = {
|
|
7772
|
+
blue: { border: "border-l-blue-500", bg: "bg-blue-50 dark:bg-blue-950/20" },
|
|
7773
|
+
green: { border: "border-l-green-500", bg: "bg-green-50 dark:bg-green-950/20" },
|
|
7774
|
+
red: { border: "border-l-red-500", bg: "bg-red-50 dark:bg-red-950/20" },
|
|
7775
|
+
yellow: { border: "border-l-yellow-500", bg: "bg-yellow-50 dark:bg-yellow-950/20" },
|
|
7776
|
+
purple: { border: "border-l-purple-500", bg: "bg-purple-50 dark:bg-purple-950/20" },
|
|
7777
|
+
orange: { border: "border-l-primary", bg: "bg-orange-50 dark:bg-orange-950/20" }
|
|
7778
|
+
};
|
|
7779
|
+
function AgendaView({
|
|
7780
|
+
className,
|
|
7781
|
+
emptyMessage = "No events scheduled for the selected month",
|
|
7782
|
+
onEventClick,
|
|
7783
|
+
onDateClick
|
|
7784
|
+
}) {
|
|
7785
|
+
const { selectedDate, setSelectedDate, setView } = useEventCalendar();
|
|
7786
|
+
const filteredEvents = useFilteredEvents();
|
|
7787
|
+
const { singleDayEvents, multiDayEvents } = React15__namespace.useMemo(
|
|
7788
|
+
() => splitEventsByDuration(filteredEvents),
|
|
7789
|
+
[filteredEvents]
|
|
7790
|
+
);
|
|
7791
|
+
const eventsByDay = React15__namespace.useMemo(() => {
|
|
7792
|
+
const allDates = /* @__PURE__ */ new Map();
|
|
7793
|
+
singleDayEvents.forEach((event) => {
|
|
7794
|
+
const eventDate = dateFns.parseISO(event.startDate);
|
|
7795
|
+
if (!dateFns.isSameMonth(eventDate, selectedDate)) return;
|
|
7796
|
+
const dateKey = dateFns.format(eventDate, "yyyy-MM-dd");
|
|
7797
|
+
if (!allDates.has(dateKey)) {
|
|
7798
|
+
allDates.set(dateKey, {
|
|
7799
|
+
date: dateFns.startOfDay(eventDate),
|
|
7800
|
+
events: [],
|
|
7801
|
+
multiDayEvents: []
|
|
7802
|
+
});
|
|
7803
|
+
}
|
|
7804
|
+
allDates.get(dateKey)?.events.push(event);
|
|
7805
|
+
});
|
|
7806
|
+
multiDayEvents.forEach((event) => {
|
|
7807
|
+
const eventStart = dateFns.parseISO(event.startDate);
|
|
7808
|
+
const eventEnd = dateFns.parseISO(event.endDate);
|
|
7809
|
+
let currentDate = dateFns.startOfDay(eventStart);
|
|
7810
|
+
const lastDate = dateFns.endOfDay(eventEnd);
|
|
7811
|
+
while (currentDate <= lastDate) {
|
|
7812
|
+
if (dateFns.isSameMonth(currentDate, selectedDate)) {
|
|
7813
|
+
const dateKey = dateFns.format(currentDate, "yyyy-MM-dd");
|
|
7814
|
+
if (!allDates.has(dateKey)) {
|
|
7815
|
+
allDates.set(dateKey, {
|
|
7816
|
+
date: new Date(currentDate),
|
|
7817
|
+
events: [],
|
|
7818
|
+
multiDayEvents: []
|
|
7819
|
+
});
|
|
7820
|
+
}
|
|
7821
|
+
allDates.get(dateKey)?.multiDayEvents.push(event);
|
|
7822
|
+
}
|
|
7823
|
+
currentDate = new Date(currentDate.setDate(currentDate.getDate() + 1));
|
|
7824
|
+
}
|
|
7825
|
+
});
|
|
7826
|
+
return Array.from(allDates.values()).sort(
|
|
7827
|
+
(a, b) => a.date.getTime() - b.date.getTime()
|
|
7828
|
+
);
|
|
7829
|
+
}, [singleDayEvents, multiDayEvents, selectedDate]);
|
|
7830
|
+
const hasAnyEvents = singleDayEvents.length > 0 || multiDayEvents.length > 0;
|
|
7831
|
+
const handleDateClick = (date) => {
|
|
7832
|
+
setSelectedDate(date);
|
|
7833
|
+
setView("day");
|
|
7834
|
+
onDateClick?.(date);
|
|
7835
|
+
};
|
|
7836
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("h-[800px]", className), children: /* @__PURE__ */ jsxRuntime.jsx(ScrollArea, { className: "h-full", type: "always", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-6 p-4", children: [
|
|
7837
|
+
eventsByDay.map((dayGroup) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
7838
|
+
AgendaDayGroup,
|
|
7839
|
+
{
|
|
7840
|
+
date: dayGroup.date,
|
|
7841
|
+
events: dayGroup.events,
|
|
7842
|
+
multiDayEvents: dayGroup.multiDayEvents,
|
|
7843
|
+
onDateClick: handleDateClick,
|
|
7844
|
+
onEventClick
|
|
7845
|
+
},
|
|
7846
|
+
dateFns.format(dayGroup.date, "yyyy-MM-dd")
|
|
7847
|
+
)),
|
|
7848
|
+
!hasAnyEvents && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center justify-center gap-2 py-20 text-muted-foreground", children: [
|
|
7849
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.CalendarX2, { className: "size-10" }),
|
|
7850
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm md:text-base", children: emptyMessage })
|
|
7851
|
+
] })
|
|
7852
|
+
] }) }) });
|
|
7853
|
+
}
|
|
7854
|
+
function AgendaDayGroup({
|
|
7855
|
+
date,
|
|
7856
|
+
events,
|
|
7857
|
+
multiDayEvents,
|
|
7858
|
+
onDateClick,
|
|
7859
|
+
onEventClick
|
|
7860
|
+
}) {
|
|
7861
|
+
const isCurrentDay = dateFns.isToday(date);
|
|
7862
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
7863
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
7864
|
+
"button",
|
|
7865
|
+
{
|
|
7866
|
+
type: "button",
|
|
7867
|
+
onClick: () => onDateClick(date),
|
|
7868
|
+
className: cn(
|
|
7869
|
+
"mb-3 flex items-center gap-2 text-left transition-colors hover:text-primary",
|
|
7870
|
+
isCurrentDay && "text-primary"
|
|
7871
|
+
),
|
|
7872
|
+
children: [
|
|
7873
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7874
|
+
"span",
|
|
7875
|
+
{
|
|
7876
|
+
className: cn(
|
|
7877
|
+
"flex size-8 items-center justify-center rounded-full text-sm font-bold",
|
|
7878
|
+
isCurrentDay && "bg-primary text-primary-foreground"
|
|
7879
|
+
),
|
|
7880
|
+
children: dateFns.format(date, "d")
|
|
7881
|
+
}
|
|
7882
|
+
),
|
|
7883
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
7884
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold", children: dateFns.format(date, "EEEE") }),
|
|
7885
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-2 text-muted-foreground", children: dateFns.format(date, "MMMM d, yyyy") })
|
|
7886
|
+
] })
|
|
7887
|
+
]
|
|
7888
|
+
}
|
|
7889
|
+
),
|
|
7890
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2 pl-10", children: [
|
|
7891
|
+
multiDayEvents.map((event) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
7892
|
+
AgendaEventCard,
|
|
7893
|
+
{
|
|
7894
|
+
event,
|
|
7895
|
+
isMultiDay: true,
|
|
7896
|
+
onClick: () => onEventClick?.(event)
|
|
7897
|
+
},
|
|
7898
|
+
`multi-${event.id}`
|
|
7899
|
+
)),
|
|
7900
|
+
events.map((event) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
7901
|
+
AgendaEventCard,
|
|
7902
|
+
{
|
|
7903
|
+
event,
|
|
7904
|
+
onClick: () => onEventClick?.(event)
|
|
7905
|
+
},
|
|
7906
|
+
event.id
|
|
7907
|
+
))
|
|
7908
|
+
] })
|
|
7909
|
+
] });
|
|
7910
|
+
}
|
|
7911
|
+
function AgendaEventCard({ event, isMultiDay, onClick }) {
|
|
7912
|
+
const colors = colorClasses2[event.color];
|
|
7913
|
+
const startTime = dateFns.format(dateFns.parseISO(event.startDate), "h:mm a");
|
|
7914
|
+
const endTime = dateFns.format(dateFns.parseISO(event.endDate), "h:mm a");
|
|
7915
|
+
const getInitials = (name) => {
|
|
7916
|
+
return name.split(" ").map((n) => n[0]).join("").toUpperCase().slice(0, 2);
|
|
7917
|
+
};
|
|
7918
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7919
|
+
"button",
|
|
7920
|
+
{
|
|
7921
|
+
type: "button",
|
|
7922
|
+
onClick,
|
|
7923
|
+
className: cn(
|
|
7924
|
+
"flex w-full items-start gap-3 rounded-lg border-l-4 p-3 text-left transition-colors",
|
|
7925
|
+
"hover:opacity-90",
|
|
7926
|
+
colors.border,
|
|
7927
|
+
colors.bg
|
|
7928
|
+
),
|
|
7929
|
+
children: [
|
|
7930
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Avatar, { className: "size-10 shrink-0", children: [
|
|
7931
|
+
/* @__PURE__ */ jsxRuntime.jsx(AvatarImage, { src: event.user.picturePath, alt: event.user.name }),
|
|
7932
|
+
/* @__PURE__ */ jsxRuntime.jsx(AvatarFallback, { children: getInitials(event.user.name) })
|
|
7933
|
+
] }),
|
|
7934
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
7935
|
+
isMultiDay && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground", children: "Multi-day event" }),
|
|
7936
|
+
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "font-semibold truncate", children: event.title }),
|
|
7937
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: event.user.name }),
|
|
7938
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "mt-1 text-xs text-muted-foreground", children: [
|
|
7939
|
+
startTime,
|
|
7940
|
+
" - ",
|
|
7941
|
+
endTime
|
|
7942
|
+
] }),
|
|
7943
|
+
event.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-2 text-sm text-muted-foreground line-clamp-2", children: event.description })
|
|
7944
|
+
] })
|
|
7945
|
+
]
|
|
7946
|
+
}
|
|
7947
|
+
);
|
|
7948
|
+
}
|
|
7949
|
+
var VIEW_CONFIG = [
|
|
7950
|
+
{ view: "day", icon: lucideReact.List, label: "View by day" },
|
|
7951
|
+
{ view: "week", icon: lucideReact.Columns, label: "View by week" },
|
|
7952
|
+
{ view: "month", icon: lucideReact.Grid2x2, label: "View by month" },
|
|
7953
|
+
{ view: "year", icon: lucideReact.Grid3x3, label: "View by year" },
|
|
7954
|
+
{ view: "agenda", icon: lucideReact.CalendarRange, label: "View by agenda" }
|
|
7955
|
+
];
|
|
7956
|
+
function CalendarHeader({
|
|
7957
|
+
className,
|
|
7958
|
+
showViewSwitcher = true,
|
|
7959
|
+
showUserFilter = true,
|
|
7960
|
+
showBadgeVariant = false,
|
|
7961
|
+
// Hidden by default, controlled via settings
|
|
7962
|
+
showToday = true,
|
|
7963
|
+
showAddButton = true,
|
|
7964
|
+
onAddClick
|
|
7965
|
+
}) {
|
|
7966
|
+
const {
|
|
7967
|
+
selectedDate,
|
|
7968
|
+
view,
|
|
7969
|
+
setView,
|
|
7970
|
+
setSelectedDate,
|
|
7971
|
+
selectedUserId,
|
|
7972
|
+
setSelectedUserId,
|
|
7973
|
+
users,
|
|
7974
|
+
badgeVariant,
|
|
7975
|
+
setBadgeVariant,
|
|
7976
|
+
goToPrevious,
|
|
7977
|
+
goToNext
|
|
7978
|
+
} = useEventCalendar();
|
|
7979
|
+
const filteredEvents = useFilteredEvents();
|
|
7980
|
+
const eventCount = filteredEvents.length;
|
|
7981
|
+
const { start: rangeStart, end: rangeEnd } = getViewDateRange(selectedDate, view);
|
|
7982
|
+
const dateRangeLabel = formatDateRange(rangeStart, rangeEnd);
|
|
7983
|
+
const getInitials = (name) => {
|
|
7984
|
+
return name.split(" ").map((n) => n[0]).join("").toUpperCase().slice(0, 2);
|
|
7985
|
+
};
|
|
7986
|
+
const handleTodayClick = () => {
|
|
7987
|
+
setSelectedDate(/* @__PURE__ */ new Date());
|
|
7988
|
+
};
|
|
7989
|
+
const today = /* @__PURE__ */ new Date();
|
|
7990
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7991
|
+
"div",
|
|
7992
|
+
{
|
|
7993
|
+
className: cn(
|
|
7994
|
+
"flex flex-col gap-4 border-b border-border p-4 lg:flex-row lg:items-center lg:justify-between",
|
|
7995
|
+
className
|
|
7996
|
+
),
|
|
7997
|
+
children: [
|
|
7998
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
7999
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
8000
|
+
"button",
|
|
8001
|
+
{
|
|
8002
|
+
type: "button",
|
|
8003
|
+
onClick: handleTodayClick,
|
|
8004
|
+
className: "flex size-14 flex-col items-start overflow-hidden rounded-lg border focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
8005
|
+
children: [
|
|
8006
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "flex h-6 w-full items-center justify-center bg-primary text-center text-xs font-semibold text-primary-foreground", children: dateFns.format(today, "MMM").toUpperCase() }),
|
|
8007
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "flex w-full flex-1 items-center justify-center text-lg font-bold", children: today.getDate() })
|
|
8008
|
+
]
|
|
8009
|
+
}
|
|
8010
|
+
),
|
|
8011
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-0.5", children: [
|
|
8012
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
8013
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-lg font-semibold", children: [
|
|
8014
|
+
dateFns.format(selectedDate, "MMMM"),
|
|
8015
|
+
" ",
|
|
8016
|
+
selectedDate.getFullYear()
|
|
8017
|
+
] }),
|
|
8018
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Badge, { variant: "outline", className: "px-1.5", children: [
|
|
8019
|
+
eventCount,
|
|
8020
|
+
" event",
|
|
8021
|
+
eventCount !== 1 ? "s" : ""
|
|
8022
|
+
] })
|
|
8023
|
+
] }),
|
|
8024
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
8025
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
8026
|
+
Button,
|
|
8027
|
+
{
|
|
8028
|
+
variant: "outline",
|
|
8029
|
+
size: "icon",
|
|
8030
|
+
className: "size-7 [&_svg]:size-4",
|
|
8031
|
+
onClick: goToPrevious,
|
|
8032
|
+
children: [
|
|
8033
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeft, {}),
|
|
8034
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Previous" })
|
|
8035
|
+
]
|
|
8036
|
+
}
|
|
8037
|
+
),
|
|
8038
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: dateRangeLabel }),
|
|
8039
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
8040
|
+
Button,
|
|
8041
|
+
{
|
|
8042
|
+
variant: "outline",
|
|
8043
|
+
size: "icon",
|
|
8044
|
+
className: "size-7 [&_svg]:size-4",
|
|
8045
|
+
onClick: goToNext,
|
|
8046
|
+
children: [
|
|
8047
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, {}),
|
|
8048
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Next" })
|
|
8049
|
+
]
|
|
8050
|
+
}
|
|
8051
|
+
)
|
|
8052
|
+
] })
|
|
8053
|
+
] })
|
|
8054
|
+
] }),
|
|
8055
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-1.5 sm:flex-row sm:justify-between", children: [
|
|
8056
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full items-center gap-1.5", children: [
|
|
8057
|
+
showViewSwitcher && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "inline-flex items-center gap-1 rounded-full border border-border px-1 py-1", children: VIEW_CONFIG.map((config, index) => {
|
|
8058
|
+
const Icon2 = config.icon;
|
|
8059
|
+
const isFirst = index === 0;
|
|
8060
|
+
const isLast = index === VIEW_CONFIG.length - 1;
|
|
8061
|
+
const isActive = view === config.view;
|
|
8062
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8063
|
+
Button,
|
|
8064
|
+
{
|
|
8065
|
+
"aria-label": config.label,
|
|
8066
|
+
size: "icon",
|
|
8067
|
+
variant: isActive ? "default" : "ghost",
|
|
8068
|
+
className: cn(
|
|
8069
|
+
"size-8 border-0 [&_svg]:size-4",
|
|
8070
|
+
isFirst && "rounded-l-full rounded-r-sm",
|
|
8071
|
+
isLast && "rounded-r-full rounded-l-sm",
|
|
8072
|
+
!isFirst && !isLast && "rounded-sm"
|
|
8073
|
+
),
|
|
8074
|
+
onClick: () => setView(config.view),
|
|
8075
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icon2, { strokeWidth: 1.8 })
|
|
8076
|
+
},
|
|
8077
|
+
config.view
|
|
8078
|
+
);
|
|
8079
|
+
}) }),
|
|
8080
|
+
showUserFilter && users.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8081
|
+
Select,
|
|
8082
|
+
{
|
|
8083
|
+
value: selectedUserId || "all",
|
|
8084
|
+
onValueChange: (value) => setSelectedUserId(value === "all" ? null : value),
|
|
8085
|
+
children: [
|
|
8086
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { className: "flex-1 md:w-48", children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, {}) }),
|
|
8087
|
+
/* @__PURE__ */ jsxRuntime.jsxs(SelectContent, { align: "end", children: [
|
|
8088
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: "all", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
|
|
8089
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex -space-x-2", children: [
|
|
8090
|
+
users.slice(0, 2).map((user) => /* @__PURE__ */ jsxRuntime.jsxs(Avatar, { className: "size-6 border-2 border-background", children: [
|
|
8091
|
+
/* @__PURE__ */ jsxRuntime.jsx(AvatarImage, { src: user.picturePath, alt: user.name }),
|
|
8092
|
+
/* @__PURE__ */ jsxRuntime.jsx(AvatarFallback, { className: "text-[10px]", children: getInitials(user.name) })
|
|
8093
|
+
] }, user.id)),
|
|
8094
|
+
users.length > 2 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex size-6 items-center justify-center rounded-full border-2 border-background bg-muted text-[10px] font-medium", children: [
|
|
8095
|
+
"+",
|
|
8096
|
+
users.length - 2
|
|
8097
|
+
] })
|
|
8098
|
+
] }),
|
|
8099
|
+
"All"
|
|
8100
|
+
] }) }),
|
|
8101
|
+
users.map((user) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: user.id, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
8102
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Avatar, { className: "size-6", children: [
|
|
8103
|
+
/* @__PURE__ */ jsxRuntime.jsx(AvatarImage, { src: user.picturePath, alt: user.name }),
|
|
8104
|
+
/* @__PURE__ */ jsxRuntime.jsx(AvatarFallback, { className: "text-[10px]", children: getInitials(user.name) })
|
|
8105
|
+
] }),
|
|
8106
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "truncate", children: user.name })
|
|
8107
|
+
] }) }, user.id))
|
|
8108
|
+
] })
|
|
8109
|
+
]
|
|
8110
|
+
}
|
|
8111
|
+
)
|
|
8112
|
+
] }),
|
|
8113
|
+
showAddButton && /* @__PURE__ */ jsxRuntime.jsxs(Button, { onClick: onAddClick, className: "w-full sm:w-auto", children: [
|
|
8114
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, {}),
|
|
8115
|
+
"Add Event"
|
|
8116
|
+
] })
|
|
8117
|
+
] })
|
|
8118
|
+
]
|
|
8119
|
+
}
|
|
8120
|
+
);
|
|
8121
|
+
}
|
|
8122
|
+
function CalendarHeaderCompact({
|
|
8123
|
+
className,
|
|
8124
|
+
showAddButton = true,
|
|
8125
|
+
onAddClick
|
|
8126
|
+
}) {
|
|
8127
|
+
const {
|
|
8128
|
+
selectedDate,
|
|
8129
|
+
setSelectedDate,
|
|
8130
|
+
view,
|
|
8131
|
+
setView,
|
|
8132
|
+
goToPrevious,
|
|
8133
|
+
goToNext
|
|
8134
|
+
} = useEventCalendar();
|
|
8135
|
+
const filteredEvents = useFilteredEvents();
|
|
8136
|
+
const eventCount = filteredEvents.length;
|
|
8137
|
+
const today = /* @__PURE__ */ new Date();
|
|
8138
|
+
const handleTodayClick = () => {
|
|
8139
|
+
setSelectedDate(/* @__PURE__ */ new Date());
|
|
8140
|
+
};
|
|
8141
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8142
|
+
"div",
|
|
8143
|
+
{
|
|
8144
|
+
className: cn(
|
|
8145
|
+
"flex items-center justify-between border-b border-border p-3",
|
|
8146
|
+
className
|
|
8147
|
+
),
|
|
8148
|
+
children: [
|
|
8149
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
8150
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
8151
|
+
"button",
|
|
8152
|
+
{
|
|
8153
|
+
type: "button",
|
|
8154
|
+
onClick: handleTodayClick,
|
|
8155
|
+
className: "flex size-10 flex-col items-start overflow-hidden rounded border focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
8156
|
+
children: [
|
|
8157
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "flex h-4 w-full items-center justify-center bg-primary text-center text-[8px] font-semibold text-primary-foreground", children: dateFns.format(today, "MMM").toUpperCase() }),
|
|
8158
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "flex w-full flex-1 items-center justify-center text-sm font-bold", children: today.getDate() })
|
|
8159
|
+
]
|
|
8160
|
+
}
|
|
8161
|
+
),
|
|
8162
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
8163
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-sm font-semibold", children: dateFns.format(selectedDate, "MMM yyyy") }),
|
|
8164
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-xs text-muted-foreground", children: [
|
|
8165
|
+
eventCount,
|
|
8166
|
+
" events"
|
|
8167
|
+
] })
|
|
8168
|
+
] })
|
|
8169
|
+
] }),
|
|
8170
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
|
|
8171
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "ghost", size: "icon", className: "size-8", onClick: goToPrevious, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeft, { className: "size-4" }) }),
|
|
8172
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "ghost", size: "icon", className: "size-8", onClick: goToNext, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "size-4" }) }),
|
|
8173
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ml-2 inline-flex items-center gap-0.5 rounded-full border border-border px-0.5 py-0.5", children: [
|
|
8174
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8175
|
+
Button,
|
|
8176
|
+
{
|
|
8177
|
+
size: "icon",
|
|
8178
|
+
variant: view === "day" ? "default" : "ghost",
|
|
8179
|
+
className: "size-6 rounded-l-full rounded-r-sm border-0 [&_svg]:size-3",
|
|
8180
|
+
onClick: () => setView("day"),
|
|
8181
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.List, { strokeWidth: 1.8 })
|
|
8182
|
+
}
|
|
8183
|
+
),
|
|
8184
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8185
|
+
Button,
|
|
8186
|
+
{
|
|
8187
|
+
size: "icon",
|
|
8188
|
+
variant: view === "week" ? "default" : "ghost",
|
|
8189
|
+
className: "size-6 rounded-sm border-0 [&_svg]:size-3",
|
|
8190
|
+
onClick: () => setView("week"),
|
|
8191
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Columns, { strokeWidth: 1.8 })
|
|
8192
|
+
}
|
|
8193
|
+
),
|
|
8194
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8195
|
+
Button,
|
|
8196
|
+
{
|
|
8197
|
+
size: "icon",
|
|
8198
|
+
variant: view === "month" ? "default" : "ghost",
|
|
8199
|
+
className: "size-6 rounded-r-full rounded-l-sm border-0 [&_svg]:size-3",
|
|
8200
|
+
onClick: () => setView("month"),
|
|
8201
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Grid2x2, { strokeWidth: 1.8 })
|
|
8202
|
+
}
|
|
8203
|
+
)
|
|
8204
|
+
] }),
|
|
8205
|
+
showAddButton && /* @__PURE__ */ jsxRuntime.jsx(Button, { size: "sm", onClick: onAddClick, className: "ml-2 size-8 p-0", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, { className: "size-4" }) })
|
|
8206
|
+
] })
|
|
8207
|
+
]
|
|
8208
|
+
}
|
|
8209
|
+
);
|
|
8210
|
+
}
|
|
8211
|
+
var EVENT_COLORS2 = [
|
|
8212
|
+
{ value: "blue", label: "Blue", className: "bg-blue-500" },
|
|
8213
|
+
{ value: "green", label: "Green", className: "bg-green-500" },
|
|
8214
|
+
{ value: "red", label: "Red", className: "bg-red-500" },
|
|
8215
|
+
{ value: "yellow", label: "Yellow", className: "bg-yellow-500" },
|
|
8216
|
+
{ value: "purple", label: "Purple", className: "bg-purple-500" },
|
|
8217
|
+
{ value: "orange", label: "Orange", className: "bg-primary" }
|
|
8218
|
+
];
|
|
8219
|
+
function EventDialog({
|
|
8220
|
+
open,
|
|
8221
|
+
onOpenChange,
|
|
8222
|
+
mode = "add",
|
|
8223
|
+
event,
|
|
8224
|
+
defaultDate = /* @__PURE__ */ new Date(),
|
|
8225
|
+
defaultUserId
|
|
8226
|
+
}) {
|
|
8227
|
+
const { addEvent, updateEvent, deleteEvent, users } = useEventCalendar();
|
|
8228
|
+
const [title, setTitle] = React15__namespace.useState("");
|
|
8229
|
+
const [description, setDescription] = React15__namespace.useState("");
|
|
8230
|
+
const [startDate, setStartDate] = React15__namespace.useState("");
|
|
8231
|
+
const [startTime, setStartTime] = React15__namespace.useState("");
|
|
8232
|
+
const [endDate, setEndDate] = React15__namespace.useState("");
|
|
8233
|
+
const [endTime, setEndTime] = React15__namespace.useState("");
|
|
8234
|
+
const [color, setColor] = React15__namespace.useState("blue");
|
|
8235
|
+
const [userId, setUserId] = React15__namespace.useState("");
|
|
8236
|
+
const [isSubmitting, setIsSubmitting] = React15__namespace.useState(false);
|
|
8237
|
+
React15__namespace.useEffect(() => {
|
|
8238
|
+
if (open) {
|
|
8239
|
+
if (mode === "edit" && event) {
|
|
8240
|
+
const start = dateFns.parseISO(event.startDate);
|
|
8241
|
+
const end = dateFns.parseISO(event.endDate);
|
|
8242
|
+
setTitle(event.title);
|
|
8243
|
+
setDescription(event.description || "");
|
|
8244
|
+
setStartDate(dateFns.format(start, "yyyy-MM-dd"));
|
|
8245
|
+
setStartTime(dateFns.format(start, "HH:mm"));
|
|
8246
|
+
setEndDate(dateFns.format(end, "yyyy-MM-dd"));
|
|
8247
|
+
setEndTime(dateFns.format(end, "HH:mm"));
|
|
8248
|
+
setColor(event.color);
|
|
8249
|
+
setUserId(event.user.id);
|
|
8250
|
+
} else {
|
|
8251
|
+
const start = defaultDate;
|
|
8252
|
+
const end = dateFns.setMinutes(dateFns.setHours(defaultDate, defaultDate.getHours() + 1), 0);
|
|
8253
|
+
setTitle("");
|
|
8254
|
+
setDescription("");
|
|
8255
|
+
setStartDate(dateFns.format(start, "yyyy-MM-dd"));
|
|
8256
|
+
setStartTime(dateFns.format(start, "HH:mm"));
|
|
8257
|
+
setEndDate(dateFns.format(end, "yyyy-MM-dd"));
|
|
8258
|
+
setEndTime(dateFns.format(end, "HH:mm"));
|
|
8259
|
+
setColor("blue");
|
|
8260
|
+
setUserId(defaultUserId || users[0]?.id || "");
|
|
8261
|
+
}
|
|
8262
|
+
}
|
|
8263
|
+
}, [open, mode, event, defaultDate, defaultUserId, users]);
|
|
8264
|
+
const handleSubmit = async (e) => {
|
|
8265
|
+
e.preventDefault();
|
|
8266
|
+
setIsSubmitting(true);
|
|
8267
|
+
try {
|
|
8268
|
+
const [startYear, startMonth, startDay] = startDate.split("-").map(Number);
|
|
8269
|
+
const [startHour, startMinute] = startTime.split(":").map(Number);
|
|
8270
|
+
const [endYear, endMonth, endDay] = endDate.split("-").map(Number);
|
|
8271
|
+
const [endHour, endMinute] = endTime.split(":").map(Number);
|
|
8272
|
+
const startDateTime = new Date(startYear, startMonth - 1, startDay, startHour, startMinute);
|
|
8273
|
+
const endDateTime = new Date(endYear, endMonth - 1, endDay, endHour, endMinute);
|
|
8274
|
+
const selectedUser = users.find((u) => u.id === userId);
|
|
8275
|
+
if (mode === "edit" && event) {
|
|
8276
|
+
const updatedEvent = {
|
|
8277
|
+
...event,
|
|
8278
|
+
title,
|
|
8279
|
+
description,
|
|
8280
|
+
startDate: startDateTime.toISOString(),
|
|
8281
|
+
endDate: endDateTime.toISOString(),
|
|
8282
|
+
color,
|
|
8283
|
+
user: {
|
|
8284
|
+
id: userId,
|
|
8285
|
+
name: selectedUser?.name || "Unknown"
|
|
8286
|
+
}
|
|
8287
|
+
};
|
|
8288
|
+
updateEvent(updatedEvent);
|
|
8289
|
+
} else {
|
|
8290
|
+
const newEvent = {
|
|
8291
|
+
id: generateEventId(),
|
|
8292
|
+
title,
|
|
8293
|
+
description,
|
|
8294
|
+
startDate: startDateTime.toISOString(),
|
|
8295
|
+
endDate: endDateTime.toISOString(),
|
|
8296
|
+
color,
|
|
8297
|
+
user: {
|
|
8298
|
+
id: userId,
|
|
8299
|
+
name: selectedUser?.name || "Unknown"
|
|
8300
|
+
}
|
|
8301
|
+
};
|
|
8302
|
+
addEvent(newEvent);
|
|
8303
|
+
}
|
|
8304
|
+
onOpenChange(false);
|
|
8305
|
+
} catch (error) {
|
|
8306
|
+
console.error("Failed to save event:", error);
|
|
8307
|
+
} finally {
|
|
8308
|
+
setIsSubmitting(false);
|
|
8309
|
+
}
|
|
8310
|
+
};
|
|
8311
|
+
const handleDelete = () => {
|
|
8312
|
+
if (event) {
|
|
8313
|
+
deleteEvent(event.id);
|
|
8314
|
+
onOpenChange(false);
|
|
8315
|
+
}
|
|
8316
|
+
};
|
|
8317
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxRuntime.jsx(DialogContent, { className: "sm:max-w-[500px]", children: /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: handleSubmit, children: [
|
|
8318
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DialogHeader, { children: [
|
|
8319
|
+
/* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { children: mode === "edit" ? "Edit Event" : "Add Event" }),
|
|
8320
|
+
/* @__PURE__ */ jsxRuntime.jsx(DialogDescription, { children: mode === "edit" ? "Make changes to your event below." : "Fill in the details for your new event." })
|
|
8321
|
+
] }),
|
|
8322
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-4 py-4", children: [
|
|
8323
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-2", children: [
|
|
8324
|
+
/* @__PURE__ */ jsxRuntime.jsx(Label2, { htmlFor: "title", children: "Title" }),
|
|
8325
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8326
|
+
Input,
|
|
8327
|
+
{
|
|
8328
|
+
id: "title",
|
|
8329
|
+
value: title,
|
|
8330
|
+
onChange: (e) => setTitle(e.target.value),
|
|
8331
|
+
placeholder: "Event title",
|
|
8332
|
+
required: true
|
|
8333
|
+
}
|
|
8334
|
+
)
|
|
8335
|
+
] }),
|
|
8336
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-2", children: [
|
|
8337
|
+
/* @__PURE__ */ jsxRuntime.jsx(Label2, { htmlFor: "description", children: "Description" }),
|
|
8338
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8339
|
+
Textarea,
|
|
8340
|
+
{
|
|
8341
|
+
id: "description",
|
|
8342
|
+
value: description,
|
|
8343
|
+
onChange: (e) => setDescription(e.target.value),
|
|
8344
|
+
placeholder: "Event description (optional)",
|
|
8345
|
+
rows: 3
|
|
8346
|
+
}
|
|
8347
|
+
)
|
|
8348
|
+
] }),
|
|
8349
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
8350
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-2", children: [
|
|
8351
|
+
/* @__PURE__ */ jsxRuntime.jsx(Label2, { htmlFor: "startDate", children: "Start Date" }),
|
|
8352
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8353
|
+
Input,
|
|
8354
|
+
{
|
|
8355
|
+
id: "startDate",
|
|
8356
|
+
type: "date",
|
|
8357
|
+
value: startDate,
|
|
8358
|
+
onChange: (e) => setStartDate(e.target.value),
|
|
8359
|
+
required: true
|
|
8360
|
+
}
|
|
8361
|
+
)
|
|
8362
|
+
] }),
|
|
8363
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-2", children: [
|
|
8364
|
+
/* @__PURE__ */ jsxRuntime.jsx(Label2, { htmlFor: "startTime", children: "Start Time" }),
|
|
8365
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8366
|
+
Input,
|
|
8367
|
+
{
|
|
8368
|
+
id: "startTime",
|
|
8369
|
+
type: "time",
|
|
8370
|
+
value: startTime,
|
|
8371
|
+
onChange: (e) => setStartTime(e.target.value),
|
|
8372
|
+
required: true
|
|
8373
|
+
}
|
|
8374
|
+
)
|
|
8375
|
+
] })
|
|
8376
|
+
] }),
|
|
8377
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
8378
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-2", children: [
|
|
8379
|
+
/* @__PURE__ */ jsxRuntime.jsx(Label2, { htmlFor: "endDate", children: "End Date" }),
|
|
8380
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8381
|
+
Input,
|
|
8382
|
+
{
|
|
8383
|
+
id: "endDate",
|
|
8384
|
+
type: "date",
|
|
8385
|
+
value: endDate,
|
|
8386
|
+
onChange: (e) => setEndDate(e.target.value),
|
|
8387
|
+
required: true
|
|
8388
|
+
}
|
|
8389
|
+
)
|
|
8390
|
+
] }),
|
|
8391
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-2", children: [
|
|
8392
|
+
/* @__PURE__ */ jsxRuntime.jsx(Label2, { htmlFor: "endTime", children: "End Time" }),
|
|
8393
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8394
|
+
Input,
|
|
8395
|
+
{
|
|
8396
|
+
id: "endTime",
|
|
8397
|
+
type: "time",
|
|
8398
|
+
value: endTime,
|
|
8399
|
+
onChange: (e) => setEndTime(e.target.value),
|
|
8400
|
+
required: true
|
|
8401
|
+
}
|
|
8402
|
+
)
|
|
8403
|
+
] })
|
|
8404
|
+
] }),
|
|
8405
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
8406
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-2", children: [
|
|
8407
|
+
/* @__PURE__ */ jsxRuntime.jsx(Label2, { children: "Color" }),
|
|
8408
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Select, { value: color, onValueChange: (v) => setColor(v), children: [
|
|
8409
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
8410
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8411
|
+
"span",
|
|
8412
|
+
{
|
|
8413
|
+
className: cn(
|
|
8414
|
+
"size-3 rounded-full",
|
|
8415
|
+
EVENT_COLORS2.find((c) => c.value === color)?.className
|
|
8416
|
+
)
|
|
8417
|
+
}
|
|
8418
|
+
),
|
|
8419
|
+
EVENT_COLORS2.find((c) => c.value === color)?.label
|
|
8420
|
+
] }) }) }),
|
|
8421
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectContent, { children: EVENT_COLORS2.map((c) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: c.value, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
8422
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("size-3 rounded-full", c.className) }),
|
|
8423
|
+
c.label
|
|
8424
|
+
] }) }, c.value)) })
|
|
8425
|
+
] })
|
|
8426
|
+
] }),
|
|
8427
|
+
users.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-2", children: [
|
|
8428
|
+
/* @__PURE__ */ jsxRuntime.jsx(Label2, { children: "Assignee" }),
|
|
8429
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Select, { value: userId, onValueChange: setUserId, children: [
|
|
8430
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, { placeholder: "Select user" }) }),
|
|
8431
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectContent, { children: users.map((user) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: user.id, children: user.name }, user.id)) })
|
|
8432
|
+
] })
|
|
8433
|
+
] })
|
|
8434
|
+
] })
|
|
8435
|
+
] }),
|
|
8436
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DialogFooter, { className: "flex-row justify-between gap-2", children: [
|
|
8437
|
+
mode === "edit" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
8438
|
+
Button,
|
|
8439
|
+
{
|
|
8440
|
+
type: "button",
|
|
8441
|
+
variant: "destructive",
|
|
8442
|
+
onClick: handleDelete,
|
|
8443
|
+
disabled: isSubmitting,
|
|
8444
|
+
children: "Delete"
|
|
8445
|
+
}
|
|
8446
|
+
) : /* @__PURE__ */ jsxRuntime.jsx("div", {}),
|
|
8447
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2", children: [
|
|
8448
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button, { type: "button", variant: "outline", onClick: () => onOpenChange(false), children: "Cancel" }),
|
|
8449
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button, { type: "submit", disabled: isSubmitting || !title.trim(), children: isSubmitting ? "Saving..." : mode === "edit" ? "Save Changes" : "Add Event" })
|
|
8450
|
+
] })
|
|
8451
|
+
] })
|
|
8452
|
+
] }) }) });
|
|
8453
|
+
}
|
|
8454
|
+
function QuickAddEvent({
|
|
8455
|
+
date,
|
|
8456
|
+
onAdd,
|
|
8457
|
+
onOpenDialog,
|
|
8458
|
+
onClose
|
|
8459
|
+
}) {
|
|
8460
|
+
const [title, setTitle] = React15__namespace.useState("");
|
|
8461
|
+
const { users } = useEventCalendar();
|
|
8462
|
+
const handleSubmit = (e) => {
|
|
8463
|
+
e.preventDefault();
|
|
8464
|
+
if (!title.trim()) return;
|
|
8465
|
+
const end = dateFns.setMinutes(dateFns.setHours(date, date.getHours() + 1), 0);
|
|
8466
|
+
onAdd({
|
|
8467
|
+
title,
|
|
8468
|
+
description: "",
|
|
8469
|
+
startDate: date.toISOString(),
|
|
8470
|
+
endDate: end.toISOString(),
|
|
8471
|
+
color: "blue",
|
|
8472
|
+
user: {
|
|
8473
|
+
id: users[0]?.id || "",
|
|
8474
|
+
name: users[0]?.name || "Unknown"
|
|
8475
|
+
}
|
|
8476
|
+
});
|
|
8477
|
+
onClose();
|
|
8478
|
+
};
|
|
8479
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: handleSubmit, className: "flex flex-col gap-2 p-3", children: [
|
|
8480
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-muted-foreground", children: dateFns.format(date, "EEE, MMM d, h:mm a") }),
|
|
8481
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8482
|
+
Input,
|
|
8483
|
+
{
|
|
8484
|
+
value: title,
|
|
8485
|
+
onChange: (e) => setTitle(e.target.value),
|
|
8486
|
+
placeholder: "Add title",
|
|
8487
|
+
className: "h-8",
|
|
8488
|
+
autoFocus: true
|
|
8489
|
+
}
|
|
8490
|
+
),
|
|
8491
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2", children: [
|
|
8492
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button, { type: "submit", size: "sm", disabled: !title.trim(), children: "Add" }),
|
|
8493
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: onOpenDialog, children: "More options" })
|
|
8494
|
+
] })
|
|
8495
|
+
] });
|
|
8496
|
+
}
|
|
8497
|
+
function ChangeBadgeVariantInput() {
|
|
8498
|
+
const { badgeVariant, setBadgeVariant } = useEventCalendar();
|
|
8499
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
8500
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-semibold", children: "Change badge variant" }),
|
|
8501
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
8502
|
+
Select,
|
|
8503
|
+
{
|
|
8504
|
+
value: badgeVariant,
|
|
8505
|
+
onValueChange: (value) => setBadgeVariant(value),
|
|
8506
|
+
children: [
|
|
8507
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { className: "w-48", children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, {}) }),
|
|
8508
|
+
/* @__PURE__ */ jsxRuntime.jsxs(SelectContent, { children: [
|
|
8509
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: "dot", children: "Dot" }),
|
|
8510
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: "colored", children: "Colored" }),
|
|
8511
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: "mixed", children: "Mixed" })
|
|
8512
|
+
] })
|
|
8513
|
+
]
|
|
8514
|
+
}
|
|
8515
|
+
)
|
|
8516
|
+
] });
|
|
8517
|
+
}
|
|
8518
|
+
var HOUR_OPTIONS = Array.from({ length: 25 }, (_, i) => {
|
|
8519
|
+
if (i === 0) return { value: "0", label: "12 AM" };
|
|
8520
|
+
if (i === 12) return { value: "12", label: "12 PM" };
|
|
8521
|
+
if (i === 24) return { value: "24", label: "12 AM (next)" };
|
|
8522
|
+
if (i < 12) return { value: String(i), label: `${i} AM` };
|
|
8523
|
+
return { value: String(i), label: `${i - 12} PM` };
|
|
8524
|
+
});
|
|
8525
|
+
function ChangeVisibleHoursInput() {
|
|
8526
|
+
const { visibleHours, setVisibleHours } = useEventCalendar();
|
|
8527
|
+
const [from, setFrom] = React15__namespace.useState(visibleHours.from);
|
|
8528
|
+
const [to, setTo] = React15__namespace.useState(visibleHours.to);
|
|
8529
|
+
const handleApply = () => {
|
|
8530
|
+
const toHour = to === 0 ? 24 : to;
|
|
8531
|
+
setVisibleHours({ from, to: toHour });
|
|
8532
|
+
};
|
|
8533
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
8534
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
8535
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-semibold", children: "Change visible hours" }),
|
|
8536
|
+
/* @__PURE__ */ jsxRuntime.jsx(TooltipProvider, { delayDuration: 100, children: /* @__PURE__ */ jsxRuntime.jsxs(Tooltip2, { children: [
|
|
8537
|
+
/* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Info, { className: "size-3" }) }),
|
|
8538
|
+
/* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { className: "max-w-80 text-center", children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: "If an event falls outside the specified visible hours, the visible hours will automatically adjust to include that event." }) })
|
|
8539
|
+
] }) })
|
|
8540
|
+
] }),
|
|
8541
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-4", children: [
|
|
8542
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { children: "From" }),
|
|
8543
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Select, { value: String(from), onValueChange: (v) => setFrom(Number(v)), children: [
|
|
8544
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { className: "w-28", children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, {}) }),
|
|
8545
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectContent, { children: HOUR_OPTIONS.slice(0, 24).map((option) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: option.value, children: option.label }, option.value)) })
|
|
8546
|
+
] }),
|
|
8547
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { children: "To" }),
|
|
8548
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Select, { value: String(to), onValueChange: (v) => setTo(Number(v)), children: [
|
|
8549
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { className: "w-28", children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, {}) }),
|
|
8550
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectContent, { children: HOUR_OPTIONS.slice(1).map((option) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: option.value, children: option.label }, option.value)) })
|
|
8551
|
+
] })
|
|
8552
|
+
] }),
|
|
8553
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button, { className: "mt-4 w-fit", onClick: handleApply, children: "Apply" })
|
|
8554
|
+
] });
|
|
8555
|
+
}
|
|
8556
|
+
var DAYS_OF_WEEK = [
|
|
8557
|
+
{ index: 0, name: "Sunday" },
|
|
8558
|
+
{ index: 1, name: "Monday" },
|
|
8559
|
+
{ index: 2, name: "Tuesday" },
|
|
8560
|
+
{ index: 3, name: "Wednesday" },
|
|
8561
|
+
{ index: 4, name: "Thursday" },
|
|
8562
|
+
{ index: 5, name: "Friday" },
|
|
8563
|
+
{ index: 6, name: "Saturday" }
|
|
8564
|
+
];
|
|
8565
|
+
var HOUR_OPTIONS2 = Array.from({ length: 25 }, (_, i) => {
|
|
8566
|
+
if (i === 0) return { value: "0", label: "12 AM" };
|
|
8567
|
+
if (i === 12) return { value: "12", label: "12 PM" };
|
|
8568
|
+
if (i === 24) return { value: "24", label: "12 AM (next)" };
|
|
8569
|
+
if (i < 12) return { value: String(i), label: `${i} AM` };
|
|
8570
|
+
return { value: String(i), label: `${i - 12} PM` };
|
|
8571
|
+
});
|
|
8572
|
+
function ChangeWorkingHoursInput() {
|
|
8573
|
+
const { workingHours, setWorkingHours } = useEventCalendar();
|
|
8574
|
+
const [localWorkingHours, setLocalWorkingHours] = React15__namespace.useState({
|
|
8575
|
+
...workingHours
|
|
8576
|
+
});
|
|
8577
|
+
const handleToggleDay = (dayId) => {
|
|
8578
|
+
setLocalWorkingHours((prev) => ({
|
|
8579
|
+
...prev,
|
|
8580
|
+
[dayId]: prev[dayId].from > 0 || prev[dayId].to > 0 ? { from: 0, to: 0 } : { from: 9, to: 17 }
|
|
8581
|
+
}));
|
|
8582
|
+
};
|
|
8583
|
+
const handleTimeChange = (dayId, timeType, value) => {
|
|
8584
|
+
const hour = Number(value);
|
|
8585
|
+
setLocalWorkingHours((prev) => {
|
|
8586
|
+
const updatedDay = { ...prev[dayId], [timeType]: hour };
|
|
8587
|
+
if (timeType === "to" && hour === 0 && updatedDay.from === 0) {
|
|
8588
|
+
updatedDay.to = 24;
|
|
8589
|
+
}
|
|
8590
|
+
return { ...prev, [dayId]: updatedDay };
|
|
8591
|
+
});
|
|
8592
|
+
};
|
|
8593
|
+
const handleSave = () => {
|
|
8594
|
+
const updatedWorkingHours = { ...localWorkingHours };
|
|
8595
|
+
for (const dayId in updatedWorkingHours) {
|
|
8596
|
+
const day = updatedWorkingHours[parseInt(dayId)];
|
|
8597
|
+
const isDayActive = localWorkingHours[parseInt(dayId)].from > 0 || localWorkingHours[parseInt(dayId)].to > 0;
|
|
8598
|
+
if (isDayActive) {
|
|
8599
|
+
if (day.from === 0 && day.to === 0) {
|
|
8600
|
+
updatedWorkingHours[dayId] = { from: 0, to: 24 };
|
|
8601
|
+
} else if (day.to === 0 && day.from > 0) {
|
|
8602
|
+
updatedWorkingHours[dayId] = { ...day, to: 24 };
|
|
8603
|
+
}
|
|
8604
|
+
} else {
|
|
8605
|
+
updatedWorkingHours[dayId] = { from: 0, to: 0 };
|
|
8606
|
+
}
|
|
8607
|
+
}
|
|
8608
|
+
setWorkingHours(updatedWorkingHours);
|
|
8609
|
+
};
|
|
8610
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
8611
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
8612
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-semibold", children: "Change working hours" }),
|
|
8613
|
+
/* @__PURE__ */ jsxRuntime.jsx(TooltipProvider, { delayDuration: 100, children: /* @__PURE__ */ jsxRuntime.jsxs(Tooltip2, { children: [
|
|
8614
|
+
/* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Info, { className: "size-3" }) }),
|
|
8615
|
+
/* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { className: "max-w-80 text-center", children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: "This will apply a dashed background to the hour cells that fall outside the working hours \u2014 only for week and day views." }) })
|
|
8616
|
+
] }) })
|
|
8617
|
+
] }),
|
|
8618
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-3", children: DAYS_OF_WEEK.map((day) => {
|
|
8619
|
+
const isDayActive = localWorkingHours[day.index].from > 0 || localWorkingHours[day.index].to > 0;
|
|
8620
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-2 sm:gap-4", children: [
|
|
8621
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-32 items-center gap-2 sm:w-36", children: [
|
|
8622
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8623
|
+
Switch,
|
|
8624
|
+
{
|
|
8625
|
+
checked: isDayActive,
|
|
8626
|
+
onCheckedChange: () => handleToggleDay(day.index)
|
|
8627
|
+
}
|
|
8628
|
+
),
|
|
8629
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium", children: day.name.slice(0, 3) })
|
|
8630
|
+
] }),
|
|
8631
|
+
isDayActive ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
8632
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
|
|
8633
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm", children: "From" }),
|
|
8634
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
8635
|
+
Select,
|
|
8636
|
+
{
|
|
8637
|
+
value: String(localWorkingHours[day.index].from),
|
|
8638
|
+
onValueChange: (v) => handleTimeChange(day.index, "from", v),
|
|
8639
|
+
children: [
|
|
8640
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { className: "w-24", children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, {}) }),
|
|
8641
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectContent, { children: HOUR_OPTIONS2.slice(0, 24).map((option) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: option.value, children: option.label }, option.value)) })
|
|
8642
|
+
]
|
|
8643
|
+
}
|
|
8644
|
+
)
|
|
8645
|
+
] }),
|
|
8646
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
|
|
8647
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm", children: "To" }),
|
|
8648
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
8649
|
+
Select,
|
|
8650
|
+
{
|
|
8651
|
+
value: String(localWorkingHours[day.index].to),
|
|
8652
|
+
onValueChange: (v) => handleTimeChange(day.index, "to", v),
|
|
8653
|
+
children: [
|
|
8654
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { className: "w-24", children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, {}) }),
|
|
8655
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectContent, { children: HOUR_OPTIONS2.slice(1).map((option) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: option.value, children: option.label }, option.value)) })
|
|
8656
|
+
]
|
|
8657
|
+
}
|
|
8658
|
+
)
|
|
8659
|
+
] })
|
|
8660
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-muted-foreground", children: [
|
|
8661
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Moon, { className: "size-4" }),
|
|
8662
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm", children: "Closed" })
|
|
8663
|
+
] })
|
|
8664
|
+
] }, day.index);
|
|
8665
|
+
}) }),
|
|
8666
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button, { className: "mt-4 w-fit", onClick: handleSave, children: "Apply" })
|
|
8667
|
+
] });
|
|
8668
|
+
}
|
|
8669
|
+
function CalendarSettingsPanel({
|
|
8670
|
+
className,
|
|
8671
|
+
showBadgeVariant = true,
|
|
8672
|
+
showVisibleHours = true,
|
|
8673
|
+
showWorkingHours = true
|
|
8674
|
+
}) {
|
|
8675
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Accordion, { type: "single", collapsible: true, className: cn("relative z-10 bg-background", className), children: /* @__PURE__ */ jsxRuntime.jsxs(AccordionItem, { value: "settings", className: "border-none", children: [
|
|
8676
|
+
/* @__PURE__ */ jsxRuntime.jsx(AccordionTrigger, { className: "flex-none gap-2 py-0 hover:no-underline", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
8677
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Settings, { className: "size-4" }),
|
|
8678
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-base font-semibold", children: "Calendar settings" })
|
|
8679
|
+
] }) }),
|
|
8680
|
+
/* @__PURE__ */ jsxRuntime.jsx(AccordionContent, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-4 flex flex-col gap-6", children: [
|
|
8681
|
+
showBadgeVariant && /* @__PURE__ */ jsxRuntime.jsx(ChangeBadgeVariantInput, {}),
|
|
8682
|
+
showVisibleHours && /* @__PURE__ */ jsxRuntime.jsx(ChangeVisibleHoursInput, {}),
|
|
8683
|
+
showWorkingHours && /* @__PURE__ */ jsxRuntime.jsx(ChangeWorkingHoursInput, {})
|
|
8684
|
+
] }) })
|
|
8685
|
+
] }) });
|
|
8686
|
+
}
|
|
8687
|
+
function useMediaQuery(query) {
|
|
8688
|
+
const [matches, setMatches] = React15__namespace.useState(false);
|
|
8689
|
+
React15__namespace.useEffect(() => {
|
|
8690
|
+
const media = window.matchMedia(query);
|
|
8691
|
+
setMatches(media.matches);
|
|
8692
|
+
const listener = (event) => {
|
|
8693
|
+
setMatches(event.matches);
|
|
8694
|
+
};
|
|
8695
|
+
media.addEventListener("change", listener);
|
|
8696
|
+
return () => media.removeEventListener("change", listener);
|
|
8697
|
+
}, [query]);
|
|
8698
|
+
return matches;
|
|
8699
|
+
}
|
|
8700
|
+
function BigCalendar({
|
|
8701
|
+
className,
|
|
8702
|
+
compact = "auto",
|
|
8703
|
+
bordered = true,
|
|
8704
|
+
showHeader = true,
|
|
8705
|
+
showAddButton = true,
|
|
8706
|
+
showSettings = true,
|
|
8707
|
+
enableDragDrop = true,
|
|
8708
|
+
weekStartsOn = 0,
|
|
8709
|
+
maxEventsPerDay = 3,
|
|
8710
|
+
config,
|
|
8711
|
+
...providerProps
|
|
8712
|
+
}) {
|
|
8713
|
+
return /* @__PURE__ */ jsxRuntime.jsx(EventCalendarProvider, { ...providerProps, children: /* @__PURE__ */ jsxRuntime.jsx(DragProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8714
|
+
BigCalendarInner,
|
|
8715
|
+
{
|
|
8716
|
+
className,
|
|
8717
|
+
compact,
|
|
8718
|
+
bordered,
|
|
8719
|
+
showHeader,
|
|
8720
|
+
showAddButton,
|
|
8721
|
+
showSettings,
|
|
8722
|
+
enableDragDrop,
|
|
8723
|
+
weekStartsOn,
|
|
8724
|
+
maxEventsPerDay,
|
|
8725
|
+
config
|
|
8726
|
+
}
|
|
8727
|
+
) }) });
|
|
8728
|
+
}
|
|
8729
|
+
function BigCalendarInner({
|
|
8730
|
+
className,
|
|
8731
|
+
compact,
|
|
8732
|
+
bordered,
|
|
8733
|
+
showHeader,
|
|
8734
|
+
showAddButton,
|
|
8735
|
+
showSettings,
|
|
8736
|
+
enableDragDrop,
|
|
8737
|
+
weekStartsOn,
|
|
8738
|
+
maxEventsPerDay
|
|
8739
|
+
}) {
|
|
8740
|
+
const { view, setView } = useEventCalendar();
|
|
8741
|
+
const [dialogOpen, setDialogOpen] = React15__namespace.useState(false);
|
|
8742
|
+
const [selectedEvent, setSelectedEvent] = React15__namespace.useState(null);
|
|
8743
|
+
const [dialogMode, setDialogMode] = React15__namespace.useState("add");
|
|
8744
|
+
const [defaultDate, setDefaultDate] = React15__namespace.useState(/* @__PURE__ */ new Date());
|
|
8745
|
+
const isMobile = useMediaQuery("(max-width: 768px)");
|
|
8746
|
+
const isCompact = compact === "auto" ? isMobile : compact;
|
|
8747
|
+
const handleAddClick = () => {
|
|
8748
|
+
setSelectedEvent(null);
|
|
8749
|
+
setDialogMode("add");
|
|
8750
|
+
setDefaultDate(/* @__PURE__ */ new Date());
|
|
8751
|
+
setDialogOpen(true);
|
|
8752
|
+
};
|
|
8753
|
+
const handleEventClick = (event) => {
|
|
8754
|
+
setSelectedEvent(event);
|
|
8755
|
+
setDialogMode("edit");
|
|
8756
|
+
setDialogOpen(true);
|
|
8757
|
+
};
|
|
8758
|
+
const handleDateClick = (date) => {
|
|
8759
|
+
setDefaultDate(date);
|
|
8760
|
+
};
|
|
8761
|
+
const handleMoreClick = (date, events) => {
|
|
8762
|
+
setDefaultDate(date);
|
|
8763
|
+
setView("day");
|
|
8764
|
+
};
|
|
8765
|
+
const handleTimeClick = (date, hour, minute) => {
|
|
8766
|
+
setSelectedEvent(null);
|
|
8767
|
+
setDialogMode("add");
|
|
8768
|
+
const clickedDate = new Date(date);
|
|
8769
|
+
clickedDate.setHours(hour, minute, 0, 0);
|
|
8770
|
+
setDefaultDate(clickedDate);
|
|
8771
|
+
setDialogOpen(true);
|
|
8772
|
+
};
|
|
8773
|
+
const Wrapper = bordered ? Card : "div";
|
|
8774
|
+
const Content14 = bordered ? CardContent : "div";
|
|
8775
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
8776
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex flex-col gap-4 relative", className), children: [
|
|
8777
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
8778
|
+
Wrapper,
|
|
8779
|
+
{
|
|
8780
|
+
className: cn(
|
|
8781
|
+
"flex min-h-[600px] flex-col overflow-hidden rounded-sm",
|
|
8782
|
+
!bordered && "border border-border bg-card"
|
|
8783
|
+
),
|
|
8784
|
+
children: [
|
|
8785
|
+
showHeader && (isCompact ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
8786
|
+
CalendarHeaderCompact,
|
|
8787
|
+
{
|
|
8788
|
+
showAddButton,
|
|
8789
|
+
onAddClick: handleAddClick
|
|
8790
|
+
}
|
|
8791
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
8792
|
+
CalendarHeader,
|
|
8793
|
+
{
|
|
8794
|
+
showAddButton,
|
|
8795
|
+
onAddClick: handleAddClick
|
|
8796
|
+
}
|
|
8797
|
+
)),
|
|
8798
|
+
/* @__PURE__ */ jsxRuntime.jsx(Content14, { className: cn("flex-1 overflow-hidden", bordered ? "p-0" : ""), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8799
|
+
CalendarView,
|
|
8800
|
+
{
|
|
8801
|
+
view,
|
|
8802
|
+
weekStartsOn,
|
|
8803
|
+
maxEventsPerDay,
|
|
8804
|
+
onEventClick: handleEventClick,
|
|
8805
|
+
onDateClick: handleDateClick,
|
|
8806
|
+
onMoreClick: handleMoreClick,
|
|
8807
|
+
onTimeClick: handleTimeClick
|
|
8808
|
+
}
|
|
8809
|
+
) })
|
|
8810
|
+
]
|
|
8811
|
+
}
|
|
8812
|
+
),
|
|
8813
|
+
showSettings && /* @__PURE__ */ jsxRuntime.jsx(CalendarSettingsPanel, {})
|
|
8814
|
+
] }),
|
|
8815
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8816
|
+
EventDialog,
|
|
8817
|
+
{
|
|
8818
|
+
open: dialogOpen,
|
|
8819
|
+
onOpenChange: setDialogOpen,
|
|
8820
|
+
mode: dialogMode,
|
|
8821
|
+
event: selectedEvent,
|
|
8822
|
+
defaultDate
|
|
8823
|
+
}
|
|
8824
|
+
)
|
|
8825
|
+
] });
|
|
8826
|
+
}
|
|
8827
|
+
function CalendarView({
|
|
8828
|
+
view,
|
|
8829
|
+
weekStartsOn,
|
|
8830
|
+
maxEventsPerDay,
|
|
8831
|
+
onEventClick,
|
|
8832
|
+
onDateClick,
|
|
8833
|
+
onMoreClick,
|
|
8834
|
+
onTimeClick
|
|
8835
|
+
}) {
|
|
8836
|
+
switch (view) {
|
|
8837
|
+
case "month":
|
|
8838
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8839
|
+
MonthView,
|
|
8840
|
+
{
|
|
8841
|
+
className: "h-full",
|
|
8842
|
+
weekStartsOn,
|
|
8843
|
+
maxEventsPerDay,
|
|
8844
|
+
onEventClick,
|
|
8845
|
+
onDateClick,
|
|
8846
|
+
onMoreClick
|
|
8847
|
+
}
|
|
8848
|
+
);
|
|
8849
|
+
case "week":
|
|
8850
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8851
|
+
WeekView,
|
|
8852
|
+
{
|
|
8853
|
+
className: "h-full",
|
|
8854
|
+
weekStartsOn,
|
|
8855
|
+
onEventClick,
|
|
8856
|
+
onDateClick,
|
|
8857
|
+
onTimeClick
|
|
8858
|
+
}
|
|
8859
|
+
);
|
|
8860
|
+
case "day":
|
|
8861
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8862
|
+
DayView,
|
|
8863
|
+
{
|
|
8864
|
+
className: "h-full",
|
|
8865
|
+
onEventClick,
|
|
8866
|
+
onTimeClick
|
|
8867
|
+
}
|
|
8868
|
+
);
|
|
8869
|
+
case "year":
|
|
8870
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8871
|
+
YearView,
|
|
8872
|
+
{
|
|
8873
|
+
className: "h-full",
|
|
8874
|
+
weekStartsOn,
|
|
8875
|
+
onDateClick
|
|
8876
|
+
}
|
|
8877
|
+
);
|
|
8878
|
+
case "agenda":
|
|
8879
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8880
|
+
AgendaView,
|
|
8881
|
+
{
|
|
8882
|
+
className: "h-full",
|
|
8883
|
+
onEventClick,
|
|
8884
|
+
onDateClick
|
|
8885
|
+
}
|
|
8886
|
+
);
|
|
8887
|
+
default:
|
|
8888
|
+
return null;
|
|
8889
|
+
}
|
|
8890
|
+
}
|
|
8891
|
+
|
|
8892
|
+
Object.defineProperty(exports, "areIntervalsOverlapping", {
|
|
8893
|
+
enumerable: true,
|
|
8894
|
+
get: function () { return dateFns.areIntervalsOverlapping; }
|
|
8895
|
+
});
|
|
8896
|
+
Object.defineProperty(exports, "format", {
|
|
8897
|
+
enumerable: true,
|
|
8898
|
+
get: function () { return dateFns.format; }
|
|
8899
|
+
});
|
|
8900
|
+
Object.defineProperty(exports, "getDay", {
|
|
8901
|
+
enumerable: true,
|
|
8902
|
+
get: function () { return dateFns.getDay; }
|
|
8903
|
+
});
|
|
8904
|
+
Object.defineProperty(exports, "isSameDay", {
|
|
8905
|
+
enumerable: true,
|
|
8906
|
+
get: function () { return dateFns.isSameDay; }
|
|
8907
|
+
});
|
|
8908
|
+
Object.defineProperty(exports, "isSameMonth", {
|
|
8909
|
+
enumerable: true,
|
|
8910
|
+
get: function () { return dateFns.isSameMonth; }
|
|
8911
|
+
});
|
|
8912
|
+
Object.defineProperty(exports, "isToday", {
|
|
8913
|
+
enumerable: true,
|
|
8914
|
+
get: function () { return dateFns.isToday; }
|
|
8915
|
+
});
|
|
8916
|
+
Object.defineProperty(exports, "parseISO", {
|
|
8917
|
+
enumerable: true,
|
|
8918
|
+
get: function () { return dateFns.parseISO; }
|
|
8919
|
+
});
|
|
5482
8920
|
exports.Accordion = Accordion;
|
|
5483
8921
|
exports.AccordionContent = AccordionContent;
|
|
5484
8922
|
exports.AccordionItem = AccordionItem;
|
|
5485
8923
|
exports.AccordionTrigger = AccordionTrigger;
|
|
8924
|
+
exports.AgendaView = AgendaView;
|
|
5486
8925
|
exports.Alert = Alert;
|
|
5487
8926
|
exports.AlertDescription = AlertDescription;
|
|
5488
8927
|
exports.AlertDialog = AlertDialog;
|
|
@@ -5501,7 +8940,9 @@ exports.AspectRatio = AspectRatio;
|
|
|
5501
8940
|
exports.Avatar = Avatar;
|
|
5502
8941
|
exports.AvatarFallback = AvatarFallback;
|
|
5503
8942
|
exports.AvatarImage = AvatarImage;
|
|
8943
|
+
exports.BADGE_VARIANT_LABELS = BADGE_VARIANT_LABELS;
|
|
5504
8944
|
exports.Badge = Badge;
|
|
8945
|
+
exports.BigCalendar = BigCalendar;
|
|
5505
8946
|
exports.Breadcrumb = Breadcrumb;
|
|
5506
8947
|
exports.BreadcrumbEllipsis = BreadcrumbEllipsis;
|
|
5507
8948
|
exports.BreadcrumbItem = BreadcrumbItem;
|
|
@@ -5514,7 +8955,11 @@ exports.ButtonGroup = ButtonGroup;
|
|
|
5514
8955
|
exports.ButtonGroupSeparator = ButtonGroupSeparator;
|
|
5515
8956
|
exports.ButtonGroupText = ButtonGroupText;
|
|
5516
8957
|
exports.Calendar = Calendar;
|
|
8958
|
+
exports.CalendarContext = CalendarContext;
|
|
5517
8959
|
exports.CalendarDayButton = CalendarDayButton;
|
|
8960
|
+
exports.CalendarHeader = CalendarHeader;
|
|
8961
|
+
exports.CalendarHeaderCompact = CalendarHeaderCompact;
|
|
8962
|
+
exports.CalendarSettingsPanel = CalendarSettingsPanel;
|
|
5518
8963
|
exports.Card = Card;
|
|
5519
8964
|
exports.CardContent = CardContent;
|
|
5520
8965
|
exports.CardDescription = CardDescription;
|
|
@@ -5526,6 +8971,9 @@ exports.CarouselContent = CarouselContent;
|
|
|
5526
8971
|
exports.CarouselItem = CarouselItem;
|
|
5527
8972
|
exports.CarouselNext = CarouselNext;
|
|
5528
8973
|
exports.CarouselPrevious = CarouselPrevious;
|
|
8974
|
+
exports.ChangeBadgeVariantInput = ChangeBadgeVariantInput;
|
|
8975
|
+
exports.ChangeVisibleHoursInput = ChangeVisibleHoursInput;
|
|
8976
|
+
exports.ChangeWorkingHoursInput = ChangeWorkingHoursInput;
|
|
5529
8977
|
exports.ChartContainer = ChartContainer;
|
|
5530
8978
|
exports.ChartLegend = ChartLegend;
|
|
5531
8979
|
exports.ChartLegendContent = ChartLegendContent;
|
|
@@ -5560,6 +9008,10 @@ exports.ContextMenuSub = ContextMenuSub;
|
|
|
5560
9008
|
exports.ContextMenuSubContent = ContextMenuSubContent;
|
|
5561
9009
|
exports.ContextMenuSubTrigger = ContextMenuSubTrigger;
|
|
5562
9010
|
exports.ContextMenuTrigger = ContextMenuTrigger;
|
|
9011
|
+
exports.DEFAULT_VISIBLE_HOURS = DEFAULT_VISIBLE_HOURS;
|
|
9012
|
+
exports.DEFAULT_WORKING_HOURS = DEFAULT_WORKING_HOURS;
|
|
9013
|
+
exports.DateBadge = DateBadge;
|
|
9014
|
+
exports.DayView = DayView;
|
|
5563
9015
|
exports.Dialog = Dialog;
|
|
5564
9016
|
exports.DialogClose = DialogClose;
|
|
5565
9017
|
exports.DialogContent = DialogContent;
|
|
@@ -5570,6 +9022,9 @@ exports.DialogOverlay = DialogOverlay;
|
|
|
5570
9022
|
exports.DialogPortal = DialogPortal;
|
|
5571
9023
|
exports.DialogTitle = DialogTitle;
|
|
5572
9024
|
exports.DialogTrigger = DialogTrigger;
|
|
9025
|
+
exports.DragContext = DragContext;
|
|
9026
|
+
exports.DragProvider = DragProvider;
|
|
9027
|
+
exports.DraggableEvent = DraggableEvent;
|
|
5573
9028
|
exports.Drawer = Drawer;
|
|
5574
9029
|
exports.DrawerClose = DrawerClose;
|
|
5575
9030
|
exports.DrawerContent = DrawerContent;
|
|
@@ -5595,12 +9050,17 @@ exports.DropdownMenuSub = DropdownMenuSub;
|
|
|
5595
9050
|
exports.DropdownMenuSubContent = DropdownMenuSubContent;
|
|
5596
9051
|
exports.DropdownMenuSubTrigger = DropdownMenuSubTrigger;
|
|
5597
9052
|
exports.DropdownMenuTrigger = DropdownMenuTrigger;
|
|
9053
|
+
exports.DroppableZone = DroppableZone;
|
|
9054
|
+
exports.EVENT_COLORS = EVENT_COLORS;
|
|
5598
9055
|
exports.Empty = Empty;
|
|
5599
9056
|
exports.EmptyContent = EmptyContent;
|
|
5600
9057
|
exports.EmptyDescription = EmptyDescription;
|
|
5601
9058
|
exports.EmptyHeader = EmptyHeader;
|
|
5602
9059
|
exports.EmptyMedia = EmptyMedia;
|
|
5603
9060
|
exports.EmptyTitle = EmptyTitle;
|
|
9061
|
+
exports.EventBadge = EventBadge;
|
|
9062
|
+
exports.EventCalendarProvider = EventCalendarProvider;
|
|
9063
|
+
exports.EventDialog = EventDialog;
|
|
5604
9064
|
exports.Field = Field;
|
|
5605
9065
|
exports.FieldContent = FieldContent;
|
|
5606
9066
|
exports.FieldDescription = FieldDescription;
|
|
@@ -5628,7 +9088,7 @@ exports.InputGroupButton = InputGroupButton;
|
|
|
5628
9088
|
exports.InputGroupInput = InputGroupInput;
|
|
5629
9089
|
exports.InputGroupText = InputGroupText;
|
|
5630
9090
|
exports.InputGroupTextarea = InputGroupTextarea;
|
|
5631
|
-
exports.Item =
|
|
9091
|
+
exports.Item = Item6;
|
|
5632
9092
|
exports.ItemActions = ItemActions;
|
|
5633
9093
|
exports.ItemContent = ItemContent;
|
|
5634
9094
|
exports.ItemDescription = ItemDescription;
|
|
@@ -5657,9 +9117,15 @@ exports.MenubarSub = MenubarSub;
|
|
|
5657
9117
|
exports.MenubarSubContent = MenubarSubContent;
|
|
5658
9118
|
exports.MenubarSubTrigger = MenubarSubTrigger;
|
|
5659
9119
|
exports.MenubarTrigger = MenubarTrigger;
|
|
9120
|
+
exports.MonthView = MonthView;
|
|
9121
|
+
exports.MoreEvents = MoreEvents;
|
|
5660
9122
|
exports.NativeSelect = NativeSelect;
|
|
5661
9123
|
exports.NativeSelectOptGroup = NativeSelectOptGroup;
|
|
5662
9124
|
exports.NativeSelectOption = NativeSelectOption;
|
|
9125
|
+
exports.NavMain = NavMain;
|
|
9126
|
+
exports.NavProjects = NavProjects;
|
|
9127
|
+
exports.NavSecondary = NavSecondary;
|
|
9128
|
+
exports.NavUser = NavUser;
|
|
5663
9129
|
exports.NavigationMenu = NavigationMenu;
|
|
5664
9130
|
exports.NavigationMenuContent = NavigationMenuContent;
|
|
5665
9131
|
exports.NavigationMenuIndicator = NavigationMenuIndicator;
|
|
@@ -5690,6 +9156,7 @@ exports.PopoverAnchor = PopoverAnchor;
|
|
|
5690
9156
|
exports.PopoverContent = PopoverContent;
|
|
5691
9157
|
exports.PopoverTrigger = PopoverTrigger;
|
|
5692
9158
|
exports.Progress = Progress;
|
|
9159
|
+
exports.QuickAddEvent = QuickAddEvent;
|
|
5693
9160
|
exports.RadioGroup = RadioGroup;
|
|
5694
9161
|
exports.RadioGroupItem = RadioGroupItem;
|
|
5695
9162
|
exports.ResizableHandle = ResizableHandle;
|
|
@@ -5697,6 +9164,8 @@ exports.ResizablePanel = ResizablePanel;
|
|
|
5697
9164
|
exports.ResizablePanelGroup = ResizablePanelGroup;
|
|
5698
9165
|
exports.ScrollArea = ScrollArea;
|
|
5699
9166
|
exports.ScrollBar = ScrollBar;
|
|
9167
|
+
exports.SearchForm = SearchForm;
|
|
9168
|
+
exports.SearchTrigger = SearchTrigger;
|
|
5700
9169
|
exports.Section = Section;
|
|
5701
9170
|
exports.SectionContent = SectionContent;
|
|
5702
9171
|
exports.SectionDescription = SectionDescription;
|
|
@@ -5746,6 +9215,7 @@ exports.SidebarProvider = SidebarProvider;
|
|
|
5746
9215
|
exports.SidebarRail = SidebarRail;
|
|
5747
9216
|
exports.SidebarSeparator = SidebarSeparator;
|
|
5748
9217
|
exports.SidebarTrigger = SidebarTrigger;
|
|
9218
|
+
exports.SiteHeader = SiteHeader;
|
|
5749
9219
|
exports.Skeleton = Skeleton;
|
|
5750
9220
|
exports.Slider = Slider;
|
|
5751
9221
|
exports.Spinner = Spinner;
|
|
@@ -5763,6 +9233,8 @@ exports.TabsContent = TabsContent;
|
|
|
5763
9233
|
exports.TabsList = TabsList;
|
|
5764
9234
|
exports.TabsTrigger = TabsTrigger;
|
|
5765
9235
|
exports.Textarea = Textarea;
|
|
9236
|
+
exports.ThemeSwitch = ThemeSwitch;
|
|
9237
|
+
exports.TimeIndicator = TimeIndicator;
|
|
5766
9238
|
exports.Toaster = Toaster;
|
|
5767
9239
|
exports.Toggle = Toggle;
|
|
5768
9240
|
exports.ToggleGroup = ToggleGroup;
|
|
@@ -5775,18 +9247,62 @@ exports.Tooltip = Tooltip2;
|
|
|
5775
9247
|
exports.TooltipContent = TooltipContent;
|
|
5776
9248
|
exports.TooltipProvider = TooltipProvider;
|
|
5777
9249
|
exports.TooltipTrigger = TooltipTrigger;
|
|
9250
|
+
exports.UserAvatarsDropdown = UserAvatarsDropdown;
|
|
9251
|
+
exports.VIEW_LABELS = VIEW_LABELS;
|
|
9252
|
+
exports.WeekView = WeekView;
|
|
9253
|
+
exports.YearView = YearView;
|
|
5778
9254
|
exports.badgeVariants = badgeVariants;
|
|
5779
9255
|
exports.buttonGroupVariants = buttonGroupVariants;
|
|
5780
9256
|
exports.buttonVariants = buttonVariants;
|
|
9257
|
+
exports.calculateDropDates = calculateDropDates;
|
|
9258
|
+
exports.calculateMonthEventPositions = calculateMonthEventPositions;
|
|
5781
9259
|
exports.cardVariants = cardVariants;
|
|
9260
|
+
exports.createDefaultEvent = createDefaultEvent;
|
|
9261
|
+
exports.formatDateRange = formatDateRange;
|
|
9262
|
+
exports.formatTime = formatTime;
|
|
9263
|
+
exports.generateEventId = generateEventId;
|
|
9264
|
+
exports.getCalendarCells = getCalendarCells;
|
|
9265
|
+
exports.getCurrentEvents = getCurrentEvents;
|
|
9266
|
+
exports.getDayHours = getDayHours;
|
|
9267
|
+
exports.getEventBlockStyle = getEventBlockStyle;
|
|
9268
|
+
exports.getEventDuration = getEventDuration;
|
|
9269
|
+
exports.getEventDurationMinutes = getEventDurationMinutes;
|
|
9270
|
+
exports.getEventsCount = getEventsCount;
|
|
9271
|
+
exports.getEventsForDate = getEventsForDate;
|
|
9272
|
+
exports.getEventsInRange = getEventsInRange;
|
|
9273
|
+
exports.getHeaderLabel = getHeaderLabel;
|
|
9274
|
+
exports.getMonthCellEvents = getMonthCellEvents;
|
|
9275
|
+
exports.getMonthDays = getMonthDays;
|
|
9276
|
+
exports.getTimeHeight = getTimeHeight;
|
|
9277
|
+
exports.getTimePosition = getTimePosition;
|
|
9278
|
+
exports.getViewDateRange = getViewDateRange;
|
|
9279
|
+
exports.getVisibleHours = getVisibleHours;
|
|
9280
|
+
exports.getWeekDayNames = getWeekDayNames;
|
|
9281
|
+
exports.getWeekDays = getWeekDays;
|
|
9282
|
+
exports.getYearMonths = getYearMonths;
|
|
9283
|
+
exports.groupEvents = groupEvents;
|
|
9284
|
+
exports.isMultiDayEvent = isMultiDayEvent;
|
|
9285
|
+
exports.isWorkingHour = isWorkingHour;
|
|
9286
|
+
exports.navigateDate = navigateDate;
|
|
5782
9287
|
exports.navigationMenuTriggerStyle = navigationMenuTriggerStyle;
|
|
5783
9288
|
exports.playerCanvasPlayButtonVariants = playerCanvasPlayButtonVariants;
|
|
5784
9289
|
exports.playerCanvasSkipButtonVariants = playerCanvasSkipButtonVariants;
|
|
9290
|
+
exports.rangeText = rangeText;
|
|
5785
9291
|
exports.sectionVariants = sectionVariants;
|
|
9292
|
+
exports.snapToInterval = snapToInterval;
|
|
9293
|
+
exports.sortEvents = sortEvents;
|
|
9294
|
+
exports.splitEventsByDuration = splitEventsByDuration;
|
|
5786
9295
|
exports.toggleVariants = toggleVariants;
|
|
5787
9296
|
exports.toolBarCanvasButtonVariants = toolBarCanvasButtonVariants;
|
|
9297
|
+
exports.useDrag = useDrag;
|
|
9298
|
+
exports.useDraggable = useDraggable;
|
|
9299
|
+
exports.useDroppable = useDroppable;
|
|
9300
|
+
exports.useEventCalendar = useEventCalendar;
|
|
9301
|
+
exports.useEventsInRange = useEventsInRange;
|
|
9302
|
+
exports.useFilteredEvents = useFilteredEvents;
|
|
5788
9303
|
exports.useFormField = useFormField;
|
|
5789
9304
|
exports.useIsMobile = useIsMobile;
|
|
9305
|
+
exports.useSearchShortcut = useSearchShortcut;
|
|
5790
9306
|
exports.useSidebar = useSidebar;
|
|
5791
9307
|
//# sourceMappingURL=index.cjs.map
|
|
5792
9308
|
//# sourceMappingURL=index.cjs.map
|