@bizapps/ui 1.0.0 → 1.1.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/dist/main.cjs CHANGED
@@ -8,13 +8,13 @@ var tailwindMerge = require('tailwind-merge');
8
8
  var jsxRuntime = require('react/jsx-runtime');
9
9
  var react = require('react');
10
10
  var radixUi = require('radix-ui');
11
- var reactDayPicker = require('react-day-picker');
12
11
  var dateFns = require('date-fns');
13
12
  var useEmblaCarousel = require('embla-carousel-react');
14
13
  var react$1 = require('motion/react');
15
14
  var cmdk = require('cmdk');
16
15
  var reactDropzone = require('react-dropzone');
17
16
  var Color = require('color');
17
+ var reactDayPicker = require('react-day-picker');
18
18
  var react$2 = require('@schedule-x/react');
19
19
  var calendar = require('@schedule-x/calendar');
20
20
  var eventsService = require('@schedule-x/events-service');
@@ -457,174 +457,6 @@ function Button({
457
457
  }
458
458
  );
459
459
  }
460
- function Calendar({
461
- className,
462
- classNames,
463
- showOutsideDays = true,
464
- captionLayout = "dropdown",
465
- buttonVariant = "ghost",
466
- locale,
467
- formatters,
468
- components,
469
- fromYear,
470
- toYear,
471
- ...props
472
- }) {
473
- const defaultClassNames = reactDayPicker.getDefaultClassNames();
474
- return /* @__PURE__ */ jsxRuntime.jsx(
475
- reactDayPicker.DayPicker,
476
- {
477
- showOutsideDays,
478
- className: cn(
479
- "group/calendar bg-background p-3 font-sans [--cell-radius:var(--radius-md)] [--cell-size:--spacing(7)] in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent",
480
- String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
481
- String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
482
- className
483
- ),
484
- captionLayout,
485
- startMonth: new Date(fromYear ?? 1900, 0),
486
- endMonth: new Date(toYear ?? 2100, 11),
487
- locale,
488
- formatters: {
489
- formatMonthDropdown: (date) => date.toLocaleString(locale?.code, { month: "short" }),
490
- ...formatters
491
- },
492
- classNames: {
493
- root: cn("w-fit", defaultClassNames.root),
494
- months: cn("relative flex flex-col gap-3 md:flex-row", defaultClassNames.months),
495
- month: cn("flex w-full flex-col gap-3", defaultClassNames.month),
496
- nav: cn(
497
- "absolute inset-x-0 top-0 flex w-full items-center justify-between gap-2",
498
- defaultClassNames.nav
499
- ),
500
- button_previous: cn(
501
- buttonVariants({ variant: buttonVariant }),
502
- "size-7 p-0 select-none opacity-50 aria-disabled:opacity-30 transition-opacity duration-150 hover:opacity-100",
503
- defaultClassNames.button_previous
504
- ),
505
- button_next: cn(
506
- buttonVariants({ variant: buttonVariant }),
507
- "size-7 p-0 select-none opacity-50 aria-disabled:opacity-30 transition-opacity duration-150 hover:opacity-100",
508
- defaultClassNames.button_next
509
- ),
510
- month_caption: cn(
511
- "flex h-(--cell-size) w-full items-center justify-center px-(--cell-size) tracking-tight",
512
- defaultClassNames.month_caption
513
- ),
514
- dropdowns: cn(
515
- "flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-semibold",
516
- defaultClassNames.dropdowns
517
- ),
518
- dropdown_root: cn(
519
- "relative rounded-(--cell-radius)",
520
- defaultClassNames.dropdown_root
521
- ),
522
- dropdown: cn("absolute inset-0 bg-popover opacity-0", defaultClassNames.dropdown),
523
- caption_label: cn(
524
- "font-semibold select-none",
525
- captionLayout === "label" ? "text-sm" : "flex items-center gap-1 rounded-(--cell-radius) text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground",
526
- defaultClassNames.caption_label
527
- ),
528
- weekdays: cn("flex gap-1", defaultClassNames.weekdays),
529
- weekday: cn(
530
- "flex-1 rounded-(--cell-radius) text-[0.75rem] font-semibold text-muted-foreground/70 select-none tracking-wide",
531
- defaultClassNames.weekday
532
- ),
533
- week: cn("mt-2 flex w-full gap-1", defaultClassNames.week),
534
- week_number_header: cn(
535
- "w-(--cell-size) select-none",
536
- defaultClassNames.week_number_header
537
- ),
538
- week_number: cn(
539
- "text-[0.75rem] text-muted-foreground/50 select-none",
540
- defaultClassNames.week_number
541
- ),
542
- day: cn(
543
- "group/day relative aspect-square h-full w-full rounded-(--cell-radius) p-0 text-center select-none [&:last-child[data-selected=true]_button]:rounded-r-(--cell-radius)",
544
- props.showWeekNumber ? "[&:nth-child(2)[data-selected=true]_button]:rounded-l-(--cell-radius)" : "[&:first-child[data-selected=true]_button]:rounded-l-(--cell-radius)",
545
- defaultClassNames.day
546
- ),
547
- range_start: cn(
548
- "relative isolate z-0 rounded-l-md bg-primary/8 after:absolute after:inset-y-0 after:right-0 after:w-3 after:bg-primary/8",
549
- defaultClassNames.range_start
550
- ),
551
- range_middle: cn("rounded-none bg-primary/8", defaultClassNames.range_middle),
552
- range_end: cn(
553
- "relative isolate z-0 rounded-r-md bg-primary/8 after:absolute after:inset-y-0 after:left-0 after:w-3 after:bg-primary/8",
554
- defaultClassNames.range_end
555
- ),
556
- today: cn("rounded-md bg-accent text-accent-foreground", defaultClassNames.today),
557
- outside: cn(
558
- "text-muted-foreground/50 aria-selected:text-muted-foreground/50",
559
- defaultClassNames.outside
560
- ),
561
- disabled: cn("text-muted-foreground/40 opacity-50", defaultClassNames.disabled),
562
- hidden: cn("invisible", defaultClassNames.hidden),
563
- ...classNames
564
- },
565
- components: {
566
- Root: ({ className: className2, rootRef, ...props2 }) => {
567
- return /* @__PURE__ */ jsxRuntime.jsx(
568
- "div",
569
- {
570
- "data-slot": "calendar",
571
- ref: rootRef,
572
- className: cn(className2),
573
- ...props2
574
- }
575
- );
576
- },
577
- Chevron: ({ className: className2, orientation, ...props2 }) => {
578
- if (orientation === "left") {
579
- return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeftIcon, { className: cn("size-4", className2), ...props2 });
580
- }
581
- if (orientation === "right") {
582
- return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRightIcon, { className: cn("size-4", className2), ...props2 });
583
- }
584
- return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, { className: cn("size-4", className2), ...props2 });
585
- },
586
- DayButton: ({ ...props2 }) => /* @__PURE__ */ jsxRuntime.jsx(CalendarDayButton, { locale, ...props2 }),
587
- WeekNumber: ({ children, ...props2 }) => {
588
- return /* @__PURE__ */ jsxRuntime.jsx("td", { ...props2, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex size-(--cell-size) items-center justify-center text-center", children }) });
589
- },
590
- ...components
591
- },
592
- ...props
593
- }
594
- );
595
- }
596
- function CalendarDayButton({
597
- className,
598
- day,
599
- modifiers,
600
- locale,
601
- ...props
602
- }) {
603
- const defaultClassNames = reactDayPicker.getDefaultClassNames();
604
- const ref = react.useRef(null);
605
- react.useEffect(() => {
606
- if (modifiers.focused) ref.current?.focus();
607
- }, [modifiers.focused]);
608
- return /* @__PURE__ */ jsxRuntime.jsx(
609
- Button,
610
- {
611
- ref,
612
- variant: "ghost",
613
- size: "icon-sm",
614
- "data-day": day.date.toLocaleDateString(locale?.code),
615
- "data-selected-single": modifiers.selected && !modifiers.range_start && !modifiers.range_end && !modifiers.range_middle,
616
- "data-range-start": modifiers.range_start,
617
- "data-range-end": modifiers.range_end,
618
- "data-range-middle": modifiers.range_middle,
619
- className: cn(
620
- "group-data-[focused=true]/day:ring-primary/40 data-[range-end=true]:!bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:!bg-primary/8 data-[range-middle=true]:text-foreground data-[range-start=true]:!bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:!bg-primary data-[selected-single=true]:text-primary-foreground relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 !rounded-md border-0 !bg-transparent leading-none font-normal transition-colors duration-150 group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:rounded-md group-data-[focused=true]/day:ring-[2px] hover:!bg-transparent data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md data-[selected-single=true]:rounded-md [&>span]:text-xs [&>span]:font-medium [&>span]:opacity-75",
621
- defaultClassNames.day,
622
- className
623
- ),
624
- ...props
625
- }
626
- );
627
- }
628
460
  function useControllableState({
629
461
  prop,
630
462
  defaultProp,
@@ -1110,6 +942,22 @@ function Input({ className, type, ...props }) {
1110
942
  }
1111
943
  );
1112
944
  }
945
+ function Label({ className, ...props }) {
946
+ return /* @__PURE__ */ jsxRuntime.jsx(
947
+ radixUi.Label.Root,
948
+ {
949
+ "data-slot": "label",
950
+ className: cn(
951
+ "text-foreground text-sm leading-6 font-medium transition-colors select-none",
952
+ "group-has-disabled/field:cursor-not-allowed group-has-disabled/field:opacity-50",
953
+ "peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
954
+ "aria-invalid:text-destructive dark:aria-invalid:text-destructive/90",
955
+ className
956
+ ),
957
+ ...props
958
+ }
959
+ );
960
+ }
1113
961
 
1114
962
  // src/utils/urlSecurity.ts
1115
963
  var SAFE_HREF_PROTOCOLS = /* @__PURE__ */ new Set(["https:", "http:", "mailto:", "tel:"]);
@@ -4144,49 +3992,217 @@ var ColorPickerPresets = ({ colors, className, ...props }) => {
4144
3992
  }) });
4145
3993
  };
4146
3994
  ColorPickerPresets.displayName = "ColorPickerPresets";
4147
- function DatePicker({
4148
- mode = "single",
4149
- selected,
4150
- onSelect,
4151
- placeholder = "Pick a date",
4152
- disabled = false,
3995
+ function Calendar({
4153
3996
  className,
4154
- fromDate,
4155
- toDate
3997
+ classNames,
3998
+ showOutsideDays = true,
3999
+ captionLayout = "dropdown",
4000
+ buttonVariant = "ghost",
4001
+ locale,
4002
+ formatters,
4003
+ components,
4004
+ fromYear,
4005
+ toYear,
4006
+ ...props
4156
4007
  }) {
4157
- const [open, setOpen] = react.useState(false);
4158
- const label = react.useMemo(() => {
4159
- if (mode === "range") {
4160
- const range = selected;
4161
- if (range?.from && range?.to)
4162
- return `${dateFns.format(range.from, "MMM d, yyyy")} \u2013 ${dateFns.format(range.to, "MMM d, yyyy")}`;
4163
- if (range?.from) return `${dateFns.format(range.from, "MMM d, yyyy")} \u2013 \u2026`;
4164
- return placeholder;
4165
- }
4166
- const date = selected;
4167
- return date ? dateFns.format(date, "MMM d, yyyy") : placeholder;
4168
- }, [mode, selected, placeholder]);
4169
- const hasValue = mode === "range" ? !!selected?.from : !!selected;
4170
- return /* @__PURE__ */ jsxRuntime.jsxs(Popover, { open, onOpenChange: setOpen, children: [
4171
- /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
4172
- Button,
4173
- {
4174
- "data-slot": "date-picker-trigger",
4175
- variant: "primary",
4176
- disabled,
4177
- className: cn(
4178
- "w-60 justify-start gap-2 font-normal",
4179
- !hasValue && "text-white",
4180
- className
4008
+ const defaultClassNames = reactDayPicker.getDefaultClassNames();
4009
+ return /* @__PURE__ */ jsxRuntime.jsx(
4010
+ reactDayPicker.DayPicker,
4011
+ {
4012
+ showOutsideDays,
4013
+ className: cn(
4014
+ "group/calendar bg-background p-3 font-sans [--cell-radius:var(--radius-md)] [--cell-size:--spacing(7)] in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent",
4015
+ String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
4016
+ String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
4017
+ className
4018
+ ),
4019
+ captionLayout,
4020
+ startMonth: new Date(fromYear ?? 1900, 0),
4021
+ endMonth: new Date(toYear ?? 2100, 11),
4022
+ locale,
4023
+ formatters: {
4024
+ formatMonthDropdown: (date) => date.toLocaleString(locale?.code, { month: "short" }),
4025
+ ...formatters
4026
+ },
4027
+ classNames: {
4028
+ root: cn("w-fit", defaultClassNames.root),
4029
+ months: cn("relative flex flex-col gap-3 md:flex-row", defaultClassNames.months),
4030
+ month: cn("flex w-full flex-col gap-3", defaultClassNames.month),
4031
+ nav: cn(
4032
+ "absolute inset-x-0 top-0 flex w-full items-center justify-between gap-2",
4033
+ defaultClassNames.nav
4181
4034
  ),
4182
- children: [
4183
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CalendarIcon, { className: "size-4 shrink-0" }),
4184
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: label })
4185
- ]
4186
- }
4187
- ) }),
4188
- /* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { "data-slot": "date-picker-content", className: "w-auto p-0", align: "start", children: mode === "range" ? /* @__PURE__ */ jsxRuntime.jsx(
4189
- Calendar,
4035
+ button_previous: cn(
4036
+ buttonVariants({ variant: buttonVariant }),
4037
+ "size-7 p-0 select-none opacity-50 aria-disabled:opacity-30 transition-opacity duration-150 hover:opacity-100",
4038
+ defaultClassNames.button_previous
4039
+ ),
4040
+ button_next: cn(
4041
+ buttonVariants({ variant: buttonVariant }),
4042
+ "size-7 p-0 select-none opacity-50 aria-disabled:opacity-30 transition-opacity duration-150 hover:opacity-100",
4043
+ defaultClassNames.button_next
4044
+ ),
4045
+ month_caption: cn(
4046
+ "flex h-(--cell-size) w-full items-center justify-center px-(--cell-size) tracking-tight",
4047
+ defaultClassNames.month_caption
4048
+ ),
4049
+ dropdowns: cn(
4050
+ "flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-semibold",
4051
+ defaultClassNames.dropdowns
4052
+ ),
4053
+ dropdown_root: cn(
4054
+ "relative rounded-(--cell-radius)",
4055
+ defaultClassNames.dropdown_root
4056
+ ),
4057
+ dropdown: cn("absolute inset-0 bg-popover opacity-0", defaultClassNames.dropdown),
4058
+ caption_label: cn(
4059
+ "font-semibold select-none",
4060
+ captionLayout === "label" ? "text-sm" : "flex items-center gap-1 rounded-(--cell-radius) text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground",
4061
+ defaultClassNames.caption_label
4062
+ ),
4063
+ weekdays: cn("flex gap-1", defaultClassNames.weekdays),
4064
+ weekday: cn(
4065
+ "flex-1 rounded-(--cell-radius) text-[0.75rem] font-semibold text-muted-foreground/70 select-none tracking-wide",
4066
+ defaultClassNames.weekday
4067
+ ),
4068
+ week: cn("mt-2 flex w-full gap-1", defaultClassNames.week),
4069
+ week_number_header: cn(
4070
+ "w-(--cell-size) select-none",
4071
+ defaultClassNames.week_number_header
4072
+ ),
4073
+ week_number: cn(
4074
+ "text-[0.75rem] text-muted-foreground/50 select-none",
4075
+ defaultClassNames.week_number
4076
+ ),
4077
+ day: cn(
4078
+ "group/day relative aspect-square h-full w-full rounded-(--cell-radius) p-0 text-center select-none [&:last-child[data-selected=true]_button]:rounded-r-(--cell-radius)",
4079
+ props.showWeekNumber ? "[&:nth-child(2)[data-selected=true]_button]:rounded-l-(--cell-radius)" : "[&:first-child[data-selected=true]_button]:rounded-l-(--cell-radius)",
4080
+ defaultClassNames.day
4081
+ ),
4082
+ range_start: cn(
4083
+ "relative isolate z-0 rounded-l-md bg-primary/8 after:absolute after:inset-y-0 after:right-0 after:w-3 after:bg-primary/8",
4084
+ defaultClassNames.range_start
4085
+ ),
4086
+ range_middle: cn("rounded-none bg-primary/8", defaultClassNames.range_middle),
4087
+ range_end: cn(
4088
+ "relative isolate z-0 rounded-r-md bg-primary/8 after:absolute after:inset-y-0 after:left-0 after:w-3 after:bg-primary/8",
4089
+ defaultClassNames.range_end
4090
+ ),
4091
+ today: cn("rounded-md bg-accent text-accent-foreground", defaultClassNames.today),
4092
+ outside: cn(
4093
+ "text-muted-foreground/50 aria-selected:text-muted-foreground/50",
4094
+ defaultClassNames.outside
4095
+ ),
4096
+ disabled: cn("text-muted-foreground/40 opacity-50", defaultClassNames.disabled),
4097
+ hidden: cn("invisible", defaultClassNames.hidden),
4098
+ ...classNames
4099
+ },
4100
+ components: {
4101
+ Root: ({ className: className2, rootRef, ...props2 }) => {
4102
+ return /* @__PURE__ */ jsxRuntime.jsx(
4103
+ "div",
4104
+ {
4105
+ "data-slot": "calendar",
4106
+ ref: rootRef,
4107
+ className: cn(className2),
4108
+ ...props2
4109
+ }
4110
+ );
4111
+ },
4112
+ Chevron: ({ className: className2, orientation, ...props2 }) => {
4113
+ if (orientation === "left") {
4114
+ return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeftIcon, { className: cn("size-4", className2), ...props2 });
4115
+ }
4116
+ if (orientation === "right") {
4117
+ return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRightIcon, { className: cn("size-4", className2), ...props2 });
4118
+ }
4119
+ return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, { className: cn("size-4", className2), ...props2 });
4120
+ },
4121
+ DayButton: ({ ...props2 }) => /* @__PURE__ */ jsxRuntime.jsx(CalendarDayButton, { locale, ...props2 }),
4122
+ WeekNumber: ({ children, ...props2 }) => {
4123
+ return /* @__PURE__ */ jsxRuntime.jsx("td", { ...props2, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex size-(--cell-size) items-center justify-center text-center", children }) });
4124
+ },
4125
+ ...components
4126
+ },
4127
+ ...props
4128
+ }
4129
+ );
4130
+ }
4131
+ function CalendarDayButton({
4132
+ className,
4133
+ day,
4134
+ modifiers,
4135
+ locale,
4136
+ ...props
4137
+ }) {
4138
+ const defaultClassNames = reactDayPicker.getDefaultClassNames();
4139
+ const ref = react.useRef(null);
4140
+ react.useEffect(() => {
4141
+ if (modifiers.focused) ref.current?.focus();
4142
+ }, [modifiers.focused]);
4143
+ return /* @__PURE__ */ jsxRuntime.jsx(
4144
+ Button,
4145
+ {
4146
+ ref,
4147
+ variant: "ghost",
4148
+ size: "icon-sm",
4149
+ "data-day": day.date.toLocaleDateString(locale?.code),
4150
+ "data-selected-single": modifiers.selected && !modifiers.range_start && !modifiers.range_end && !modifiers.range_middle,
4151
+ "data-range-start": modifiers.range_start,
4152
+ "data-range-end": modifiers.range_end,
4153
+ "data-range-middle": modifiers.range_middle,
4154
+ className: cn(
4155
+ "group-data-[focused=true]/day:ring-primary/40 data-[range-end=true]:!bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:!bg-primary/8 data-[range-middle=true]:text-foreground data-[range-start=true]:!bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:!bg-primary data-[selected-single=true]:text-primary-foreground relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 !rounded-md border-0 !bg-transparent leading-none font-normal transition-colors duration-150 group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:rounded-md group-data-[focused=true]/day:ring-[2px] hover:!bg-transparent data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md data-[selected-single=true]:rounded-md [&>span]:text-xs [&>span]:font-medium [&>span]:opacity-75",
4156
+ defaultClassNames.day,
4157
+ className
4158
+ ),
4159
+ ...props
4160
+ }
4161
+ );
4162
+ }
4163
+ function DatePicker({
4164
+ mode = "single",
4165
+ selected,
4166
+ onSelect,
4167
+ placeholder = "Pick a date",
4168
+ disabled = false,
4169
+ className,
4170
+ fromDate,
4171
+ toDate
4172
+ }) {
4173
+ const [open, setOpen] = react.useState(false);
4174
+ const label = react.useMemo(() => {
4175
+ if (mode === "range") {
4176
+ const range = selected;
4177
+ if (range?.from && range?.to)
4178
+ return `${dateFns.format(range.from, "MMM d, yyyy")} \u2013 ${dateFns.format(range.to, "MMM d, yyyy")}`;
4179
+ if (range?.from) return `${dateFns.format(range.from, "MMM d, yyyy")} \u2013 \u2026`;
4180
+ return placeholder;
4181
+ }
4182
+ const date = selected;
4183
+ return date ? dateFns.format(date, "MMM d, yyyy") : placeholder;
4184
+ }, [mode, selected, placeholder]);
4185
+ const hasValue = mode === "range" ? !!selected?.from : !!selected;
4186
+ return /* @__PURE__ */ jsxRuntime.jsxs(Popover, { open, onOpenChange: setOpen, children: [
4187
+ /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
4188
+ Button,
4189
+ {
4190
+ "data-slot": "date-picker-trigger",
4191
+ variant: "primary",
4192
+ disabled,
4193
+ className: cn(
4194
+ "w-60 justify-start gap-2 font-normal",
4195
+ !hasValue && "text-white",
4196
+ className
4197
+ ),
4198
+ children: [
4199
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CalendarIcon, { className: "size-4 shrink-0" }),
4200
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: label })
4201
+ ]
4202
+ }
4203
+ ) }),
4204
+ /* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { "data-slot": "date-picker-content", className: "w-auto p-0", align: "start", children: mode === "range" ? /* @__PURE__ */ jsxRuntime.jsx(
4205
+ Calendar,
4190
4206
  {
4191
4207
  ...{
4192
4208
  mode: "range",
@@ -4339,6 +4355,7 @@ var Navbar = react.forwardRef(
4339
4355
  notifications,
4340
4356
  avatarSrc,
4341
4357
  avatarFallback,
4358
+ showUtilityBar = true,
4342
4359
  onNavLinkClick,
4343
4360
  onSearchClick,
4344
4361
  onHelpClick,
@@ -4410,7 +4427,7 @@ var Navbar = react.forwardRef(
4410
4427
  ] }),
4411
4428
  /* @__PURE__ */ jsxRuntime.jsx("nav", { className: "ml-auto flex h-full items-center", children: navigationLinks.map((link, i) => /* @__PURE__ */ jsxRuntime.jsx(NavLinkItem, { link, onNavLinkClick }, i)) })
4412
4429
  ] }) }),
4413
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-background border-border border-b px-4 md:px-6", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mx-auto flex h-9 max-w-screen-2xl items-center justify-between", children: [
4430
+ showUtilityBar && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-background border-border border-b px-4 md:px-6", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mx-auto flex h-9 max-w-screen-2xl items-center justify-between", children: [
4414
4431
  /* @__PURE__ */ jsxRuntime.jsx("nav", { className: "flex items-center", children: utilityLinks.map((link, i) => /* @__PURE__ */ jsxRuntime.jsxs(react.Fragment, { children: [
4415
4432
  i > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-border mx-3 select-none", children: "|" }),
4416
4433
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -4733,220 +4750,723 @@ function CanNot({ permission, mode = "any", fallback = null, children }) {
4733
4750
  return /* @__PURE__ */ jsxRuntime.jsx(Can, { permission, mode, negate: true, fallback, children });
4734
4751
  }
4735
4752
  CanNot.displayName = "CanNot";
4736
- var SidebarContext = react.createContext({
4737
- open: true,
4738
- setOpen: () => {
4739
- },
4740
- isMobile: false
4741
- });
4753
+ function useMediaQuery(query) {
4754
+ const [matches, setMatches] = react.useState(false);
4755
+ react.useEffect(() => {
4756
+ if (typeof window === "undefined") return;
4757
+ const mql = window.matchMedia(query);
4758
+ setMatches(mql.matches);
4759
+ const handler = (e) => setMatches(e.matches);
4760
+ mql.addEventListener("change", handler);
4761
+ return () => mql.removeEventListener("change", handler);
4762
+ }, [query]);
4763
+ return matches;
4764
+ }
4765
+
4766
+ // src/hooks/use-mobile.ts
4767
+ function useIsMobile() {
4768
+ return useMediaQuery("(max-width: 767px)");
4769
+ }
4770
+ function Sheet({ ...props }) {
4771
+ return /* @__PURE__ */ jsxRuntime.jsx(radixUi.Dialog.Root, { "data-slot": "sheet", ...props });
4772
+ }
4773
+ function SheetTrigger({ ...props }) {
4774
+ return /* @__PURE__ */ jsxRuntime.jsx(radixUi.Dialog.Trigger, { "data-slot": "sheet-trigger", ...props });
4775
+ }
4776
+ function SheetClose({ ...props }) {
4777
+ return /* @__PURE__ */ jsxRuntime.jsx(radixUi.Dialog.Close, { "data-slot": "sheet-close", ...props });
4778
+ }
4779
+ function SheetPortal({ ...props }) {
4780
+ return /* @__PURE__ */ jsxRuntime.jsx(radixUi.Dialog.Portal, { "data-slot": "sheet-portal", ...props });
4781
+ }
4782
+ function SheetOverlay({
4783
+ className,
4784
+ ...props
4785
+ }) {
4786
+ return /* @__PURE__ */ jsxRuntime.jsx(
4787
+ radixUi.Dialog.Overlay,
4788
+ {
4789
+ "data-slot": "sheet-overlay",
4790
+ className: cn(
4791
+ "fixed inset-0 z-50 bg-black/30 duration-100 supports-backdrop-filter:backdrop-blur-sm data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",
4792
+ className
4793
+ ),
4794
+ ...props
4795
+ }
4796
+ );
4797
+ }
4798
+ function SheetContent({
4799
+ className,
4800
+ children,
4801
+ side = "right",
4802
+ showCloseButton = true,
4803
+ ...props
4804
+ }) {
4805
+ return /* @__PURE__ */ jsxRuntime.jsxs(SheetPortal, { children: [
4806
+ /* @__PURE__ */ jsxRuntime.jsx(SheetOverlay, {}),
4807
+ /* @__PURE__ */ jsxRuntime.jsxs(
4808
+ radixUi.Dialog.Content,
4809
+ {
4810
+ "data-slot": "sheet-content",
4811
+ "data-side": side,
4812
+ className: cn(
4813
+ "fixed z-50 flex flex-col bg-popover bg-clip-padding text-sm text-popover-foreground shadow-xl transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-[side=bottom]:data-open:slide-in-from-bottom-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:animate-out data-closed:fade-out-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=right]:data-closed:slide-out-to-right-10 data-[side=top]:data-closed:slide-out-to-top-10",
4814
+ className
4815
+ ),
4816
+ ...props,
4817
+ children: [
4818
+ children,
4819
+ showCloseButton && /* @__PURE__ */ jsxRuntime.jsx(radixUi.Dialog.Close, { "data-slot": "sheet-close", asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "ghost", className: "absolute top-4 right-4 bg-secondary", size: "icon-sm", children: [
4820
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XIcon, {}),
4821
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Close" })
4822
+ ] }) })
4823
+ ]
4824
+ }
4825
+ )
4826
+ ] });
4827
+ }
4828
+ function SheetHeader({ className, ...props }) {
4829
+ return /* @__PURE__ */ jsxRuntime.jsx(
4830
+ "div",
4831
+ {
4832
+ "data-slot": "sheet-header",
4833
+ className: cn("flex flex-col gap-1.5 p-6", className),
4834
+ ...props
4835
+ }
4836
+ );
4837
+ }
4838
+ function SheetFooter({ className, ...props }) {
4839
+ return /* @__PURE__ */ jsxRuntime.jsx(
4840
+ "div",
4841
+ {
4842
+ "data-slot": "sheet-footer",
4843
+ className: cn("mt-auto flex flex-col gap-2 p-6", className),
4844
+ ...props
4845
+ }
4846
+ );
4847
+ }
4848
+ function SheetTitle({
4849
+ className,
4850
+ ...props
4851
+ }) {
4852
+ return /* @__PURE__ */ jsxRuntime.jsx(
4853
+ radixUi.Dialog.Title,
4854
+ {
4855
+ "data-slot": "sheet-title",
4856
+ className: cn("text-base font-medium text-foreground", className),
4857
+ ...props
4858
+ }
4859
+ );
4860
+ }
4861
+ function SheetDescription({
4862
+ className,
4863
+ ...props
4864
+ }) {
4865
+ return /* @__PURE__ */ jsxRuntime.jsx(
4866
+ radixUi.Dialog.Description,
4867
+ {
4868
+ "data-slot": "sheet-description",
4869
+ className: cn("text-sm text-muted-foreground", className),
4870
+ ...props
4871
+ }
4872
+ );
4873
+ }
4874
+ var SIDEBAR_COOKIE_NAME = "sidebar_state";
4875
+ var SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
4876
+ var SIDEBAR_WIDTH = "16rem";
4877
+ var SIDEBAR_WIDTH_MOBILE = "18rem";
4878
+ var SIDEBAR_WIDTH_ICON = "3rem";
4879
+ var SIDEBAR_KEYBOARD_SHORTCUT = "b";
4880
+ var SidebarContext = react.createContext(null);
4742
4881
  function useSidebar() {
4743
- return react.useContext(SidebarContext);
4882
+ const context = react.useContext(SidebarContext);
4883
+ if (!context) {
4884
+ throw new Error("useSidebar must be used within a SidebarProvider.");
4885
+ }
4886
+ return context;
4887
+ }
4888
+ function SidebarProvider({
4889
+ defaultOpen = true,
4890
+ open: openProp,
4891
+ onOpenChange: setOpenProp,
4892
+ className,
4893
+ style,
4894
+ children,
4895
+ ...props
4896
+ }) {
4897
+ const isMobile = useIsMobile();
4898
+ const [openMobile, setOpenMobile] = react.useState(false);
4899
+ const [_open, _setOpen] = react.useState(defaultOpen);
4900
+ const open = openProp ?? _open;
4901
+ const setOpen = react.useCallback(
4902
+ (value) => {
4903
+ const openState = typeof value === "function" ? value(open) : value;
4904
+ if (setOpenProp) {
4905
+ setOpenProp(openState);
4906
+ } else {
4907
+ _setOpen(openState);
4908
+ }
4909
+ document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}; SameSite=Lax; Secure`;
4910
+ },
4911
+ [setOpenProp, open]
4912
+ );
4913
+ const toggleSidebar = react.useCallback(() => {
4914
+ return isMobile ? setOpenMobile((open2) => !open2) : setOpen((open2) => !open2);
4915
+ }, [isMobile, setOpen, setOpenMobile]);
4916
+ react.useEffect(() => {
4917
+ const handleKeyDown = (event) => {
4918
+ if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
4919
+ const target = event.target;
4920
+ if (target.isContentEditable || target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.tagName === "SELECT") {
4921
+ return;
4922
+ }
4923
+ event.preventDefault();
4924
+ toggleSidebar();
4925
+ }
4926
+ };
4927
+ window.addEventListener("keydown", handleKeyDown);
4928
+ return () => window.removeEventListener("keydown", handleKeyDown);
4929
+ }, [toggleSidebar]);
4930
+ const state = open ? "expanded" : "collapsed";
4931
+ const contextValue = react.useMemo(
4932
+ () => ({
4933
+ state,
4934
+ open,
4935
+ setOpen,
4936
+ isMobile,
4937
+ openMobile,
4938
+ setOpenMobile,
4939
+ toggleSidebar
4940
+ }),
4941
+ [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]
4942
+ );
4943
+ return /* @__PURE__ */ jsxRuntime.jsx(SidebarContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
4944
+ "div",
4945
+ {
4946
+ "data-slot": "sidebar-wrapper",
4947
+ style: {
4948
+ "--sidebar-width": SIDEBAR_WIDTH,
4949
+ "--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
4950
+ ...style
4951
+ },
4952
+ className: cn(
4953
+ "group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-dvh w-full",
4954
+ className
4955
+ ),
4956
+ ...props,
4957
+ children
4958
+ }
4959
+ ) });
4960
+ }
4961
+ function SidebarResizeHandle() {
4962
+ const dragRef = react.useRef(null);
4963
+ return /* @__PURE__ */ jsxRuntime.jsx(
4964
+ "div",
4965
+ {
4966
+ "data-slot": "sidebar-resize-handle",
4967
+ className: "absolute inset-y-0 right-0 w-1 cursor-col-resize opacity-0 transition-opacity hover:opacity-100 hover:bg-sidebar-border group-data-[state=collapsed]:hidden",
4968
+ onPointerDown: (e) => {
4969
+ e.preventDefault();
4970
+ const wrapper = e.currentTarget.closest('[data-slot="sidebar-wrapper"]');
4971
+ if (!wrapper) return;
4972
+ const container = e.currentTarget.closest('[data-slot="sidebar-container"]');
4973
+ const gap = container?.parentElement?.querySelector('[data-slot="sidebar-gap"]') ?? null;
4974
+ const currentWidth = container ? parseFloat(getComputedStyle(container).width) : 256;
4975
+ if (container) container.style.transition = "none";
4976
+ if (gap) gap.style.transition = "none";
4977
+ dragRef.current = { startX: e.clientX, startWidth: currentWidth, wrapper, container: container ?? null, gap };
4978
+ e.currentTarget.setPointerCapture(e.pointerId);
4979
+ },
4980
+ onPointerMove: (e) => {
4981
+ if (!dragRef.current) return;
4982
+ const { startX, startWidth, wrapper } = dragRef.current;
4983
+ const newWidth = Math.max(160, Math.min(480, startWidth + (e.clientX - startX)));
4984
+ wrapper.style.setProperty("--sidebar-width", `${newWidth}px`);
4985
+ },
4986
+ onPointerUp: () => {
4987
+ if (dragRef.current?.container) dragRef.current.container.style.transition = "";
4988
+ if (dragRef.current?.gap) dragRef.current.gap.style.transition = "";
4989
+ dragRef.current = null;
4990
+ }
4991
+ }
4992
+ );
4993
+ }
4994
+ function Sidebar({
4995
+ side = "left",
4996
+ variant = "sidebar",
4997
+ collapsible = "offcanvas",
4998
+ className,
4999
+ children,
5000
+ dir,
5001
+ ...props
5002
+ }) {
5003
+ const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
5004
+ if (collapsible === "none") {
5005
+ return /* @__PURE__ */ jsxRuntime.jsx(
5006
+ "div",
5007
+ {
5008
+ "data-slot": "sidebar",
5009
+ className: cn(
5010
+ "bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",
5011
+ className
5012
+ ),
5013
+ ...props,
5014
+ children
5015
+ }
5016
+ );
5017
+ }
5018
+ if (isMobile) {
5019
+ return /* @__PURE__ */ jsxRuntime.jsx(Sheet, { open: openMobile, onOpenChange: setOpenMobile, ...props, children: /* @__PURE__ */ jsxRuntime.jsxs(
5020
+ SheetContent,
5021
+ {
5022
+ dir,
5023
+ "data-sidebar": "sidebar",
5024
+ "data-slot": "sidebar",
5025
+ "data-mobile": "true",
5026
+ showCloseButton: false,
5027
+ className: "bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0",
5028
+ style: {
5029
+ "--sidebar-width": SIDEBAR_WIDTH_MOBILE
5030
+ },
5031
+ side,
5032
+ children: [
5033
+ /* @__PURE__ */ jsxRuntime.jsxs(SheetHeader, { className: "sr-only", children: [
5034
+ /* @__PURE__ */ jsxRuntime.jsx(SheetTitle, { children: "Sidebar" }),
5035
+ /* @__PURE__ */ jsxRuntime.jsx(SheetDescription, { children: "Displays the mobile sidebar." })
5036
+ ] }),
5037
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-full w-full flex-col", children })
5038
+ ]
5039
+ }
5040
+ ) });
5041
+ }
5042
+ return /* @__PURE__ */ jsxRuntime.jsxs(
5043
+ "div",
5044
+ {
5045
+ className: "group peer text-sidebar-foreground hidden md:block",
5046
+ "data-state": state,
5047
+ "data-collapsible": state === "collapsed" ? collapsible : "",
5048
+ "data-variant": variant,
5049
+ "data-side": side,
5050
+ "data-slot": "sidebar",
5051
+ children: [
5052
+ /* @__PURE__ */ jsxRuntime.jsx(
5053
+ "div",
5054
+ {
5055
+ "data-slot": "sidebar-gap",
5056
+ className: cn(
5057
+ "relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear",
5058
+ "group-data-[collapsible=offcanvas]:w-0",
5059
+ "group-data-[side=right]:rotate-180",
5060
+ variant === "floating" || variant === "inset" ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon)"
5061
+ )
5062
+ }
5063
+ ),
5064
+ /* @__PURE__ */ jsxRuntime.jsxs(
5065
+ "div",
5066
+ {
5067
+ "data-slot": "sidebar-container",
5068
+ "data-side": side,
5069
+ className: cn(
5070
+ "fixed inset-y-0 z-10 hidden h-dvh w-(--sidebar-width) overflow-hidden transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex",
5071
+ // Adjust the padding for floating and inset variants.
5072
+ variant === "floating" || variant === "inset" ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",
5073
+ className
5074
+ ),
5075
+ ...props,
5076
+ children: [
5077
+ /* @__PURE__ */ jsxRuntime.jsx(
5078
+ "div",
5079
+ {
5080
+ "data-sidebar": "sidebar",
5081
+ "data-slot": "sidebar-inner",
5082
+ className: "bg-sidebar group-data-[variant=floating]:ring-sidebar-border flex size-full flex-col group-data-[variant=floating]:rounded-2xl group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1",
5083
+ children
5084
+ }
5085
+ ),
5086
+ /* @__PURE__ */ jsxRuntime.jsx(SidebarResizeHandle, {})
5087
+ ]
5088
+ }
5089
+ )
5090
+ ]
5091
+ }
5092
+ );
5093
+ }
5094
+ function SidebarTrigger({ className, onClick, ...props }) {
5095
+ const { toggleSidebar } = useSidebar();
5096
+ return /* @__PURE__ */ jsxRuntime.jsxs(
5097
+ Button,
5098
+ {
5099
+ "data-sidebar": "trigger",
5100
+ "data-slot": "sidebar-trigger",
5101
+ variant: "ghost",
5102
+ size: "icon-sm",
5103
+ className: cn(className),
5104
+ onClick: (event) => {
5105
+ onClick?.(event);
5106
+ toggleSidebar();
5107
+ },
5108
+ ...props,
5109
+ children: [
5110
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MenuIcon, {}),
5111
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Toggle Sidebar" })
5112
+ ]
5113
+ }
5114
+ );
5115
+ }
5116
+ function SidebarRail({ className, ...props }) {
5117
+ const { toggleSidebar } = useSidebar();
5118
+ return /* @__PURE__ */ jsxRuntime.jsx(
5119
+ "button",
5120
+ {
5121
+ "data-sidebar": "rail",
5122
+ "data-slot": "sidebar-rail",
5123
+ "aria-label": "Toggle Sidebar",
5124
+ tabIndex: -1,
5125
+ onClick: toggleSidebar,
5126
+ title: "Toggle Sidebar",
5127
+ className: cn(
5128
+ "hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2",
5129
+ "in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize",
5130
+ "[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize",
5131
+ "hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full",
5132
+ "[[data-side=left][data-collapsible=offcanvas]_&]:-right-2",
5133
+ "[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",
5134
+ className
5135
+ ),
5136
+ ...props
5137
+ }
5138
+ );
5139
+ }
5140
+ function SidebarInset({ className, ...props }) {
5141
+ return /* @__PURE__ */ jsxRuntime.jsx(
5142
+ "main",
5143
+ {
5144
+ "data-slot": "sidebar-inset",
5145
+ className: cn(
5146
+ "bg-background relative flex w-full flex-1 flex-col md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-2xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",
5147
+ className
5148
+ ),
5149
+ ...props
5150
+ }
5151
+ );
5152
+ }
5153
+ function SidebarInput({ className, ...props }) {
5154
+ return /* @__PURE__ */ jsxRuntime.jsx(
5155
+ Input,
5156
+ {
5157
+ "data-slot": "sidebar-input",
5158
+ "data-sidebar": "input",
5159
+ className: cn("bg-input/50 h-8 w-full shadow-none", className),
5160
+ ...props
5161
+ }
5162
+ );
5163
+ }
5164
+ function SidebarHeader({ className, ...props }) {
5165
+ return /* @__PURE__ */ jsxRuntime.jsx(
5166
+ "div",
5167
+ {
5168
+ "data-slot": "sidebar-header",
5169
+ "data-sidebar": "header",
5170
+ className: cn("flex flex-col gap-2 p-2 [--radius:var(--radius-xl)]", className),
5171
+ ...props
5172
+ }
5173
+ );
5174
+ }
5175
+ function SidebarFooter({ className, ...props }) {
5176
+ return /* @__PURE__ */ jsxRuntime.jsx(
5177
+ "div",
5178
+ {
5179
+ "data-slot": "sidebar-footer",
5180
+ "data-sidebar": "footer",
5181
+ className: cn("flex flex-col gap-2 p-2", className),
5182
+ ...props
5183
+ }
5184
+ );
5185
+ }
5186
+ function SidebarSeparator({ className, ...props }) {
5187
+ return /* @__PURE__ */ jsxRuntime.jsx(
5188
+ Separator,
5189
+ {
5190
+ "data-slot": "sidebar-separator",
5191
+ "data-sidebar": "separator",
5192
+ className: cn("bg-sidebar-border mx-2 w-auto", className),
5193
+ ...props
5194
+ }
5195
+ );
5196
+ }
5197
+ function SidebarContent({ className, ...props }) {
5198
+ return /* @__PURE__ */ jsxRuntime.jsx(
5199
+ "div",
5200
+ {
5201
+ "data-slot": "sidebar-content",
5202
+ "data-sidebar": "content",
5203
+ className: cn(
5204
+ "no-scrollbar flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto overflow-x-hidden [--radius:var(--radius-xl)] group-data-[collapsible=icon]:overflow-hidden",
5205
+ className
5206
+ ),
5207
+ ...props
5208
+ }
5209
+ );
5210
+ }
5211
+ function SidebarGroup({ className, ...props }) {
5212
+ return /* @__PURE__ */ jsxRuntime.jsx(
5213
+ "div",
5214
+ {
5215
+ "data-slot": "sidebar-group",
5216
+ "data-sidebar": "group",
5217
+ className: cn("relative flex w-full min-w-0 flex-col p-2", className),
5218
+ ...props
5219
+ }
5220
+ );
5221
+ }
5222
+ function SidebarGroupLabel({
5223
+ className,
5224
+ asChild = false,
5225
+ ...props
5226
+ }) {
5227
+ const Comp = asChild ? radixUi.Slot.Root : "div";
5228
+ return /* @__PURE__ */ jsxRuntime.jsx(
5229
+ Comp,
5230
+ {
5231
+ "data-slot": "sidebar-group-label",
5232
+ "data-sidebar": "group-label",
5233
+ className: cn(
5234
+ "text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-xl px-3 text-xs font-medium outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
5235
+ className
5236
+ ),
5237
+ ...props
5238
+ }
5239
+ );
5240
+ }
5241
+ function SidebarGroupAction({
5242
+ className,
5243
+ asChild = false,
5244
+ ...props
5245
+ }) {
5246
+ const Comp = asChild ? radixUi.Slot.Root : "button";
5247
+ return /* @__PURE__ */ jsxRuntime.jsx(
5248
+ Comp,
5249
+ {
5250
+ "data-slot": "sidebar-group-action",
5251
+ "data-sidebar": "group-action",
5252
+ className: cn(
5253
+ "text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-xl p-0 outline-hidden transition-transform group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0",
5254
+ className
5255
+ ),
5256
+ ...props
5257
+ }
5258
+ );
5259
+ }
5260
+ function SidebarGroupContent({ className, ...props }) {
5261
+ return /* @__PURE__ */ jsxRuntime.jsx(
5262
+ "div",
5263
+ {
5264
+ "data-slot": "sidebar-group-content",
5265
+ "data-sidebar": "group-content",
5266
+ className: cn("w-full text-sm", className),
5267
+ ...props
5268
+ }
5269
+ );
5270
+ }
5271
+ function SidebarMenu({ className, ...props }) {
5272
+ return /* @__PURE__ */ jsxRuntime.jsx(
5273
+ "ul",
5274
+ {
5275
+ "data-slot": "sidebar-menu",
5276
+ "data-sidebar": "menu",
5277
+ className: cn("flex w-full min-w-0 flex-col gap-0.5", className),
5278
+ ...props
5279
+ }
5280
+ );
5281
+ }
5282
+ function SidebarMenuItem({ className, ...props }) {
5283
+ return /* @__PURE__ */ jsxRuntime.jsx(
5284
+ "li",
5285
+ {
5286
+ "data-slot": "sidebar-menu-item",
5287
+ "data-sidebar": "menu-item",
5288
+ className: cn("group/menu-item relative", className),
5289
+ ...props
5290
+ }
5291
+ );
4744
5292
  }
4745
- var SidebarProvider = react.forwardRef(
4746
- ({ defaultOpen = true, open: controlledOpen, onOpenChange, className, children, ...props }, ref) => {
4747
- const [internalOpen, setInternalOpen] = react.useState(defaultOpen);
4748
- const [isMobile, setIsMobile] = react.useState(false);
4749
- const containerRef = react.useRef(null);
4750
- const open = controlledOpen ?? internalOpen;
4751
- const setOpen = react.useCallback(
4752
- (value) => {
4753
- setInternalOpen(value);
4754
- onOpenChange?.(value);
5293
+ var sidebarMenuButtonVariants = classVarianceAuthority.cva(
5294
+ "peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-xl px-3 py-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate",
5295
+ {
5296
+ variants: {
5297
+ variant: {
5298
+ default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
5299
+ outline: "bg-background shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]"
4755
5300
  },
4756
- [onOpenChange]
4757
- );
4758
- react.useEffect(() => {
4759
- const check = () => {
4760
- const el = containerRef.current;
4761
- if (el) setIsMobile(el.offsetWidth < 768);
4762
- };
4763
- check();
4764
- const ro = new ResizeObserver(check);
4765
- if (containerRef.current) ro.observe(containerRef.current);
4766
- return () => ro.disconnect();
4767
- }, []);
4768
- return /* @__PURE__ */ jsxRuntime.jsx(SidebarContext.Provider, { value: { open, setOpen, isMobile }, children: /* @__PURE__ */ jsxRuntime.jsx(
4769
- "div",
4770
- {
4771
- ref: (node) => {
4772
- containerRef.current = node;
4773
- if (typeof ref === "function") ref(node);
4774
- else if (ref) ref.current = node;
4775
- },
4776
- className: cn("flex h-full w-full overflow-hidden", className),
4777
- ...props,
4778
- children
5301
+ size: {
5302
+ default: "h-9 text-sm",
5303
+ sm: "h-8 text-xs",
5304
+ lg: "h-14 px-3 text-sm group-data-[collapsible=icon]:p-0!"
4779
5305
  }
4780
- ) });
5306
+ },
5307
+ defaultVariants: {
5308
+ variant: "default",
5309
+ size: "default"
5310
+ }
4781
5311
  }
4782
5312
  );
4783
- SidebarProvider.displayName = "SidebarProvider";
4784
- var Sidebar = react.forwardRef(
4785
- ({ collapsible = "offcanvas", className, children, ...props }, ref) => {
4786
- const { open } = useSidebar();
4787
- return /* @__PURE__ */ jsxRuntime.jsx(
4788
- "div",
5313
+ function SidebarMenuButton({
5314
+ asChild = false,
5315
+ isActive = false,
5316
+ variant = "default",
5317
+ size = "default",
5318
+ tooltip,
5319
+ className,
5320
+ ...props
5321
+ }) {
5322
+ const Comp = asChild ? radixUi.Slot.Root : "button";
5323
+ const { isMobile, state } = useSidebar();
5324
+ const button = /* @__PURE__ */ jsxRuntime.jsx(
5325
+ Comp,
5326
+ {
5327
+ "data-slot": "sidebar-menu-button",
5328
+ "data-sidebar": "menu-button",
5329
+ "data-size": size,
5330
+ "data-active": isActive,
5331
+ className: cn(sidebarMenuButtonVariants({ variant, size }), className),
5332
+ ...props
5333
+ }
5334
+ );
5335
+ if (!tooltip) {
5336
+ return button;
5337
+ }
5338
+ if (typeof tooltip === "string") {
5339
+ tooltip = {
5340
+ children: tooltip
5341
+ };
5342
+ }
5343
+ return /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
5344
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: button }),
5345
+ /* @__PURE__ */ jsxRuntime.jsx(
5346
+ TooltipContent,
4789
5347
  {
4790
- ref,
4791
- "data-state": open ? "expanded" : "collapsed",
4792
- className: cn(
4793
- "bg-sidebar text-sidebar-foreground border-sidebar-border relative flex h-full shrink-0 flex-col border-r transition-all duration-300 ease-in-out",
4794
- open ? "w-64" : collapsible === "icon" ? "w-12" : "w-0 overflow-hidden",
4795
- className
4796
- ),
4797
- ...props,
4798
- children
5348
+ side: "right",
5349
+ align: "center",
5350
+ hidden: state !== "collapsed" || isMobile,
5351
+ ...tooltip
4799
5352
  }
4800
- );
4801
- }
4802
- );
4803
- Sidebar.displayName = "Sidebar";
4804
- var SidebarTrigger = react.forwardRef(({ className, onClick, ...props }, ref) => {
4805
- const { open, setOpen } = useSidebar();
4806
- return /* @__PURE__ */ jsxRuntime.jsxs(
4807
- Button,
5353
+ )
5354
+ ] });
5355
+ }
5356
+ function SidebarMenuAction({
5357
+ className,
5358
+ asChild = false,
5359
+ showOnHover = false,
5360
+ ...props
5361
+ }) {
5362
+ const Comp = asChild ? radixUi.Slot.Root : "button";
5363
+ return /* @__PURE__ */ jsxRuntime.jsx(
5364
+ Comp,
4808
5365
  {
4809
- ref,
4810
- variant: "ghost",
4811
- size: "md",
4812
- className: cn("shrink-0", className),
4813
- onClick: (e) => {
4814
- onClick?.(e);
4815
- setOpen(!open);
4816
- },
4817
- ...props,
4818
- children: [
4819
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Menu, { className: "size-4" }),
4820
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Toggle sidebar" })
4821
- ]
5366
+ "data-slot": "sidebar-menu-action",
5367
+ "data-sidebar": "menu-action",
5368
+ className: cn(
5369
+ "text-sidebar-foreground ring-sidebar-ring peer-hover/menu-button:text-sidebar-accent-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-xl p-0 outline-hidden transition-transform group-data-[collapsible=icon]:hidden peer-data-[size=default]/menu-button:top-2 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 after:absolute after:-inset-2 focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0",
5370
+ showOnHover && "peer-data-active/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 aria-expanded:opacity-100 md:opacity-0",
5371
+ className
5372
+ ),
5373
+ ...props
4822
5374
  }
4823
5375
  );
4824
- });
4825
- SidebarTrigger.displayName = "SidebarTrigger";
4826
- var SidebarHeader = react.forwardRef(
4827
- ({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
5376
+ }
5377
+ function SidebarMenuBadge({ className, ...props }) {
5378
+ return /* @__PURE__ */ jsxRuntime.jsx(
4828
5379
  "div",
4829
5380
  {
4830
- ref,
4831
- "data-slot": "sidebar-header",
4832
- className: cn("flex shrink-0 flex-col gap-2 p-3", className),
5381
+ "data-slot": "sidebar-menu-badge",
5382
+ "data-sidebar": "menu-badge",
5383
+ className: cn(
5384
+ "text-sidebar-foreground peer-hover/menu-button:text-sidebar-accent-foreground peer-data-active/menu-button:text-sidebar-accent-foreground pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-xl px-1 text-xs font-medium tabular-nums select-none group-data-[collapsible=icon]:hidden peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1",
5385
+ className
5386
+ ),
4833
5387
  ...props
4834
5388
  }
4835
- )
4836
- );
4837
- SidebarHeader.displayName = "SidebarHeader";
4838
- var SidebarContent = react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
4839
- "div",
4840
- {
4841
- ref,
4842
- "data-slot": "sidebar-content",
4843
- className: cn(
4844
- "flex flex-1 flex-col gap-2 overflow-x-hidden overflow-y-auto p-2",
4845
- className
4846
- ),
4847
- ...props
4848
- }
4849
- ));
4850
- SidebarContent.displayName = "SidebarContent";
4851
- var SidebarFooter = react.forwardRef(
4852
- ({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
5389
+ );
5390
+ }
5391
+ function SidebarMenuSkeleton({
5392
+ className,
5393
+ showIcon = false,
5394
+ ...props
5395
+ }) {
5396
+ const [width] = react.useState(() => {
5397
+ return `${Math.floor(Math.random() * 40) + 50}%`;
5398
+ });
5399
+ return /* @__PURE__ */ jsxRuntime.jsxs(
4853
5400
  "div",
4854
5401
  {
4855
- ref,
4856
- "data-slot": "sidebar-footer",
4857
- className: cn("flex shrink-0 flex-col gap-2 p-3", className),
4858
- ...props
5402
+ "data-slot": "sidebar-menu-skeleton",
5403
+ "data-sidebar": "menu-skeleton",
5404
+ className: cn("flex h-8 items-center gap-2 rounded-xl px-2", className),
5405
+ ...props,
5406
+ children: [
5407
+ showIcon && /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "size-4 rounded-xl", "data-sidebar": "menu-skeleton-icon" }),
5408
+ /* @__PURE__ */ jsxRuntime.jsx(
5409
+ Skeleton,
5410
+ {
5411
+ className: "h-4 max-w-(--skeleton-width) flex-1",
5412
+ "data-sidebar": "menu-skeleton-text",
5413
+ style: {
5414
+ "--skeleton-width": width
5415
+ }
5416
+ }
5417
+ )
5418
+ ]
4859
5419
  }
4860
- )
4861
- );
4862
- SidebarFooter.displayName = "SidebarFooter";
4863
- var SidebarGroup = react.forwardRef(
4864
- ({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
4865
- "div",
5420
+ );
5421
+ }
5422
+ function SidebarMenuSub({ className, ...props }) {
5423
+ return /* @__PURE__ */ jsxRuntime.jsx(
5424
+ "ul",
4866
5425
  {
4867
- ref,
4868
- "data-slot": "sidebar-group",
4869
- className: cn("flex flex-col gap-1", className),
5426
+ "data-slot": "sidebar-menu-sub",
5427
+ "data-sidebar": "menu-sub",
5428
+ className: cn(
5429
+ "border-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l px-2.5 py-0.5 group-data-[collapsible=icon]:hidden",
5430
+ className
5431
+ ),
4870
5432
  ...props
4871
5433
  }
4872
- )
4873
- );
4874
- SidebarGroup.displayName = "SidebarGroup";
4875
- var SidebarGroupLabel = react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
4876
- "div",
4877
- {
4878
- ref,
4879
- className: cn(
4880
- "text-sidebar-foreground/50 px-2 py-1 text-xs font-medium tracking-wider uppercase",
4881
- className
4882
- ),
4883
- ...props
4884
- }
4885
- ));
4886
- SidebarGroupLabel.displayName = "SidebarGroupLabel";
4887
- var SidebarGroupContent = react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
4888
- "div",
4889
- {
4890
- ref,
4891
- "data-slot": "sidebar-group-content",
4892
- className: cn("flex flex-col gap-0.5", className),
4893
- ...props
4894
- }
4895
- ));
4896
- SidebarGroupContent.displayName = "SidebarGroupContent";
4897
- var SidebarMenu = react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
4898
- "ul",
4899
- {
4900
- ref,
4901
- "data-slot": "sidebar-menu",
4902
- className: cn("m-0 flex list-none flex-col gap-0.5 p-0", className),
4903
- ...props
4904
- }
4905
- ));
4906
- SidebarMenu.displayName = "SidebarMenu";
4907
- var SidebarMenuItem = react.forwardRef(
4908
- ({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
5434
+ );
5435
+ }
5436
+ function SidebarMenuSubItem({ className, ...props }) {
5437
+ return /* @__PURE__ */ jsxRuntime.jsx(
4909
5438
  "li",
4910
5439
  {
4911
- ref,
4912
- "data-slot": "sidebar-menu-item",
4913
- className: cn("relative", className),
5440
+ "data-slot": "sidebar-menu-sub-item",
5441
+ "data-sidebar": "menu-sub-item",
5442
+ className: cn("group/menu-sub-item relative", className),
4914
5443
  ...props
4915
5444
  }
4916
- )
4917
- );
4918
- SidebarMenuItem.displayName = "SidebarMenuItem";
4919
- var SidebarMenuButton = react.forwardRef(
4920
- ({ asChild, isActive, className, children, ...props }, ref) => {
4921
- const { open } = useSidebar();
4922
- const Comp = asChild ? radixUi.Slot.Root : "button";
4923
- return /* @__PURE__ */ jsxRuntime.jsx(
4924
- Comp,
4925
- {
4926
- ref,
4927
- "data-active": isActive || void 0,
4928
- className: cn(
4929
- "flex w-full cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm font-normal transition-colors outline-none",
4930
- "text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
4931
- "data-[active]:bg-sidebar-primary/10 data-[active]:text-sidebar-primary data-[active]:font-normal",
4932
- !open && "justify-center px-2",
4933
- className
4934
- ),
4935
- ...props,
4936
- children: react.Children.map(children, (child, i) => {
4937
- if (i === 0 && react.isValidElement(child)) {
4938
- return react.cloneElement(child, {
4939
- className: cn("size-4 shrink-0", child.props.className)
4940
- });
4941
- }
4942
- if (i > 0 && !open) return null;
4943
- return child;
4944
- })
4945
- }
4946
- );
4947
- }
4948
- );
4949
- SidebarMenuButton.displayName = "SidebarMenuButton";
5445
+ );
5446
+ }
5447
+ function SidebarMenuSubButton({
5448
+ asChild = false,
5449
+ size = "md",
5450
+ isActive = false,
5451
+ className,
5452
+ ...props
5453
+ }) {
5454
+ const Comp = asChild ? radixUi.Slot.Root : "a";
5455
+ return /* @__PURE__ */ jsxRuntime.jsx(
5456
+ Comp,
5457
+ {
5458
+ "data-slot": "sidebar-menu-sub-button",
5459
+ "data-sidebar": "menu-sub-button",
5460
+ "data-size": size,
5461
+ "data-active": isActive,
5462
+ className: cn(
5463
+ "text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-xl px-3 outline-hidden group-data-[collapsible=icon]:hidden focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[size=md]:text-sm data-[size=sm]:text-xs [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",
5464
+ className
5465
+ ),
5466
+ ...props
5467
+ }
5468
+ );
5469
+ }
4950
5470
  var defaultItems = [
4951
5471
  { label: "Home", icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.House, {}) },
4952
5472
  { label: "Vacations", icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plane, {}) },
@@ -4954,11 +5474,20 @@ var defaultItems = [
4954
5474
  { label: "Apps", icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.LayoutDashboardIcon, {}) }
4955
5475
  ];
4956
5476
  function SidebarBrand({ brandName }) {
4957
- const { open } = useSidebar();
4958
- if (!open) return null;
5477
+ const { state } = useSidebar();
5478
+ const collapsed = state === "collapsed";
4959
5479
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4960
5480
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-primary text-primary-foreground flex size-7 shrink-0 items-center justify-center rounded-md text-xs font-bold", children: brandName.charAt(0) }),
4961
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-sm font-semibold", children: brandName })
5481
+ /* @__PURE__ */ jsxRuntime.jsx(
5482
+ "span",
5483
+ {
5484
+ className: cn(
5485
+ "truncate text-sm font-semibold transition-opacity duration-200",
5486
+ collapsed ? "opacity-0 pointer-events-none w-0 overflow-hidden" : "opacity-100"
5487
+ ),
5488
+ children: brandName
5489
+ }
5490
+ )
4962
5491
  ] });
4963
5492
  }
4964
5493
  function AppShell({
@@ -4967,48 +5496,65 @@ function AppShell({
4967
5496
  onItemClick,
4968
5497
  brandName = "Total Portal",
4969
5498
  showHeader = true,
5499
+ header,
5500
+ open,
5501
+ onOpenChange,
5502
+ defaultOpen,
4970
5503
  className,
4971
5504
  mainClassName,
4972
5505
  children
4973
5506
  }) {
4974
- return /* @__PURE__ */ jsxRuntime.jsxs(SidebarProvider, { className: cn("min-h-0", className), children: [
4975
- /* @__PURE__ */ jsxRuntime.jsxs(Sidebar, { collapsible: "icon", children: [
4976
- /* @__PURE__ */ jsxRuntime.jsxs(SidebarHeader, { className: "flex flex-row items-center gap-2 p-2", children: [
4977
- /* @__PURE__ */ jsxRuntime.jsx(SidebarTrigger, { variant: "ghost", className: "size-8 shrink-0" }),
4978
- /* @__PURE__ */ jsxRuntime.jsx(SidebarBrand, { brandName })
4979
- ] }),
4980
- /* @__PURE__ */ jsxRuntime.jsx(SidebarContent, { children: /* @__PURE__ */ jsxRuntime.jsx(SidebarGroup, { children: /* @__PURE__ */ jsxRuntime.jsx(SidebarGroupContent, { children: /* @__PURE__ */ jsxRuntime.jsx(SidebarMenu, { children: items.map((item) => {
4981
- const menuItem = /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxRuntime.jsxs(
4982
- SidebarMenuButton,
4983
- {
4984
- isActive: activeItem === item.label || item.active,
4985
- onClick: () => {
4986
- item.onClick?.();
4987
- onItemClick?.(item.label);
4988
- },
4989
- children: [
4990
- item.icon,
4991
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: item.label })
4992
- ]
4993
- }
4994
- ) }, item.label);
4995
- if (!item.permission) return menuItem;
4996
- return /* @__PURE__ */ jsxRuntime.jsx(
4997
- Can,
4998
- {
4999
- permission: item.permission,
5000
- mode: item.permissionMode,
5001
- children: menuItem
5002
- },
5003
- item.label
5004
- );
5005
- }) }) }) }) })
5006
- ] }),
5007
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-1 flex-col", children: [
5008
- showHeader && /* @__PURE__ */ jsxRuntime.jsx("header", { className: "flex h-14 items-center justify-between border-b px-4", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium", children: brandName }) }),
5009
- /* @__PURE__ */ jsxRuntime.jsx("main", { className: cn("overflow-y-auto flex-1 p-6", mainClassName), children })
5010
- ] })
5011
- ] });
5507
+ return /* @__PURE__ */ jsxRuntime.jsxs(
5508
+ SidebarProvider,
5509
+ {
5510
+ className: cn("h-dvh overflow-hidden", className),
5511
+ open,
5512
+ onOpenChange,
5513
+ defaultOpen,
5514
+ children: [
5515
+ /* @__PURE__ */ jsxRuntime.jsxs(Sidebar, { collapsible: "icon", children: [
5516
+ /* @__PURE__ */ jsxRuntime.jsxs(SidebarHeader, { className: "flex flex-row items-center gap-2 p-2", children: [
5517
+ /* @__PURE__ */ jsxRuntime.jsx(SidebarTrigger, { variant: "ghost", className: "size-8 shrink-0" }),
5518
+ /* @__PURE__ */ jsxRuntime.jsx(SidebarBrand, { brandName })
5519
+ ] }),
5520
+ /* @__PURE__ */ jsxRuntime.jsx(SidebarContent, { className: "overflow-x:hidden", children: /* @__PURE__ */ jsxRuntime.jsx(SidebarGroup, { children: /* @__PURE__ */ jsxRuntime.jsx(SidebarGroupContent, { children: /* @__PURE__ */ jsxRuntime.jsx(SidebarMenu, { children: items.map((item) => {
5521
+ const menuItem = /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxRuntime.jsxs(
5522
+ SidebarMenuButton,
5523
+ {
5524
+ tooltip: item.label,
5525
+ isActive: activeItem === item.label || item.active,
5526
+ onClick: () => {
5527
+ item.onClick?.();
5528
+ onItemClick?.(item.label);
5529
+ },
5530
+ children: [
5531
+ item.icon,
5532
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: item.label })
5533
+ ]
5534
+ }
5535
+ ) }, item.label);
5536
+ if (!item.permission) return menuItem;
5537
+ return /* @__PURE__ */ jsxRuntime.jsx(
5538
+ Can,
5539
+ {
5540
+ permission: item.permission,
5541
+ mode: item.permissionMode,
5542
+ children: menuItem
5543
+ },
5544
+ item.label
5545
+ );
5546
+ }) }) }) }) })
5547
+ ] }),
5548
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-1 flex-col overflow-hidden", children: [
5549
+ header ? header : showHeader ? /* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex h-14 items-center gap-2 border-b px-4", children: [
5550
+ /* @__PURE__ */ jsxRuntime.jsx(SidebarTrigger, { variant: "ghost", className: "size-8 shrink-0 md:hidden" }),
5551
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium", children: brandName })
5552
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx(SidebarTrigger, { variant: "ghost", className: "size-8 shrink-0 md:hidden" }),
5553
+ /* @__PURE__ */ jsxRuntime.jsx("main", { className: cn("overflow-y-auto flex-1 p-6", mainClassName), children })
5554
+ ] })
5555
+ ]
5556
+ }
5557
+ );
5012
5558
  }
5013
5559
  function Textarea({ className, ...props }) {
5014
5560
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -5614,14 +6160,9 @@ var eventCalendarStyles = `
5614
6160
  font-weight: 600;
5615
6161
  }
5616
6162
 
5617
- /* \u2500\u2500 Event modal \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
6163
+ /* \u2500\u2500 Event modal \u2014 hidden; replaced by TCCE Popover in event-calendar.tsx \u2500\u2500 */
5618
6164
  .sx-tcce .sx__event-modal {
5619
- border-radius: var(--border-radius-article, 0.875rem);
5620
- border: 1px solid var(--color-border);
5621
- font-size: 13px;
5622
- min-width: 220px;
5623
- max-width: 300px;
5624
- background: var(--color-background);
6165
+ display: none !important;
5625
6166
  }
5626
6167
  .sx-tcce .sx__event-modal__title {
5627
6168
  font-size: 14px;
@@ -5766,8 +6307,43 @@ function useEventCalendar({
5766
6307
  return () => unsubscribe?.();
5767
6308
  }, []);
5768
6309
  return {
5769
- calendarApp: calendarApp.current
6310
+ calendarApp: calendarApp.current,
6311
+ eventModal: eventModal$1.current
6312
+ };
6313
+ }
6314
+ var EVENT_COLOR = {
6315
+ default: "#22205f",
6316
+ primary: "#22205f",
6317
+ success: "#00a824",
6318
+ warning: "#c8a23b",
6319
+ danger: "#ea3a3d"
6320
+ };
6321
+ function getFixedAnchorRect(el) {
6322
+ const rect = el.getBoundingClientRect();
6323
+ let ancestor = el.parentElement;
6324
+ while (ancestor && ancestor !== document.documentElement) {
6325
+ if (window.getComputedStyle(ancestor).transform !== "none") {
6326
+ const cb = ancestor.getBoundingClientRect();
6327
+ return new DOMRect(rect.left - cb.left, rect.top - cb.top, rect.width, rect.height);
6328
+ }
6329
+ ancestor = ancestor.parentElement;
6330
+ }
6331
+ return rect;
6332
+ }
6333
+ function formatEventTime(start, end) {
6334
+ const isAllDay = start.length === 10;
6335
+ if (isAllDay) {
6336
+ const date = /* @__PURE__ */ new Date(`${start}T00:00:00`);
6337
+ return date.toLocaleDateString("en-US", { month: "long", day: "numeric", year: "numeric" });
6338
+ }
6339
+ const fmt = (s) => {
6340
+ const [, time] = s.split(" ");
6341
+ const [h, m] = time.split(":").map(Number);
6342
+ const ampm = h >= 12 ? "PM" : "AM";
6343
+ const hour = h % 12 || 12;
6344
+ return `${hour}:${m.toString().padStart(2, "0")} ${ampm}`;
5770
6345
  };
6346
+ return `${fmt(start)} \u2013 ${fmt(end)}`;
5771
6347
  }
5772
6348
  function EventCalendar({
5773
6349
  events,
@@ -5780,6 +6356,9 @@ function EventCalendar({
5780
6356
  className
5781
6357
  }) {
5782
6358
  const [currentView, setCurrentView] = react.useState(defaultView);
6359
+ const [selectedEvent, setSelectedEvent] = react.useState(null);
6360
+ const [anchorRect, setAnchorRect] = react.useState(null);
6361
+ const clickedEventElRef = react.useRef(false);
5783
6362
  const handleViewChange = react.useCallback(
5784
6363
  (view) => {
5785
6364
  setCurrentView(view);
@@ -5787,19 +6366,106 @@ function EventCalendar({
5787
6366
  },
5788
6367
  [onViewChange]
5789
6368
  );
5790
- const { calendarApp } = useEventCalendar({
6369
+ const handleEventClick = react.useCallback(
6370
+ (event) => {
6371
+ setSelectedEvent(event);
6372
+ onEventClick?.(event);
6373
+ },
6374
+ [onEventClick]
6375
+ );
6376
+ const { calendarApp, eventModal } = useEventCalendar({
5791
6377
  events,
5792
6378
  defaultView,
5793
6379
  defaultDate,
5794
6380
  locale,
5795
- onEventClick,
6381
+ onEventClick: handleEventClick,
5796
6382
  onEventCreate,
5797
6383
  onViewChange: handleViewChange
5798
6384
  });
6385
+ react.useEffect(() => {
6386
+ const unsub = eventModal.calendarEventElement.subscribe((el) => {
6387
+ if (!el) {
6388
+ if (clickedEventElRef.current) {
6389
+ clickedEventElRef.current = false;
6390
+ } else {
6391
+ setSelectedEvent(null);
6392
+ setAnchorRect(null);
6393
+ }
6394
+ } else {
6395
+ setAnchorRect(getFixedAnchorRect(el));
6396
+ }
6397
+ });
6398
+ return unsub;
6399
+ }, [eventModal]);
6400
+ const handlePopoverOpenChange = react.useCallback(
6401
+ (open) => {
6402
+ if (!open) {
6403
+ eventModal.close();
6404
+ setSelectedEvent(null);
6405
+ setAnchorRect(null);
6406
+ }
6407
+ },
6408
+ [eventModal]
6409
+ );
5799
6410
  const contextValue = react.useMemo(() => ({ currentView }), [currentView]);
5800
6411
  return /* @__PURE__ */ jsxRuntime.jsxs(EventCalendarContext.Provider, { value: contextValue, children: [
5801
6412
  /* @__PURE__ */ jsxRuntime.jsx("style", { href: "tcce-event-calendar", precedence: "default", children: eventCalendarStyles }),
5802
- /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "event-calendar", className: cn("sx-tcce w-full", className), children: /* @__PURE__ */ jsxRuntime.jsx(react$2.ScheduleXCalendar, { calendarApp: calendarApp ?? null }) })
6413
+ /* @__PURE__ */ jsxRuntime.jsxs(Popover, { open: !!selectedEvent && !!anchorRect, onOpenChange: handlePopoverOpenChange, children: [
6414
+ /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "event-calendar", className: cn("sx-tcce w-full", className), children: /* @__PURE__ */ jsxRuntime.jsx(react$2.ScheduleXCalendar, { calendarApp: calendarApp ?? null }) }),
6415
+ anchorRect && /* @__PURE__ */ jsxRuntime.jsx(PopoverAnchor, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
6416
+ "span",
6417
+ {
6418
+ style: {
6419
+ position: "fixed",
6420
+ top: anchorRect.top,
6421
+ left: anchorRect.left,
6422
+ width: anchorRect.width,
6423
+ height: anchorRect.height,
6424
+ pointerEvents: "none"
6425
+ }
6426
+ }
6427
+ ) }),
6428
+ /* @__PURE__ */ jsxRuntime.jsx(
6429
+ PopoverContent,
6430
+ {
6431
+ side: "right",
6432
+ align: "start",
6433
+ className: "w-65 gap-2",
6434
+ onPointerDownOutside: (e) => {
6435
+ const target = e.target;
6436
+ const isEventEl = target.closest(
6437
+ ".sx__month-grid-event, .sx__time-grid-event, .sx__month-agenda-event"
6438
+ );
6439
+ if (isEventEl) {
6440
+ e.preventDefault();
6441
+ clickedEventElRef.current = true;
6442
+ }
6443
+ },
6444
+ children: selectedEvent && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6445
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start justify-between gap-2", children: [
6446
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
6447
+ /* @__PURE__ */ jsxRuntime.jsx(
6448
+ "span",
6449
+ {
6450
+ className: "size-2 shrink-0 rounded-full",
6451
+ style: {
6452
+ backgroundColor: EVENT_COLOR[selectedEvent.color ?? "default"]
6453
+ }
6454
+ }
6455
+ ),
6456
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-heading text-sm font-semibold leading-tight", children: selectedEvent.title })
6457
+ ] }),
6458
+ /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "ghost", size: "icon-sm", "aria-label": "Edit event", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Pencil, { size: 14 }) })
6459
+ ] }),
6460
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
6461
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Clock, { size: 13, className: "shrink-0" }),
6462
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: formatEventTime(selectedEvent.start, selectedEvent.end) })
6463
+ ] }),
6464
+ selectedEvent.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: selectedEvent.description })
6465
+ ] })
6466
+ }
6467
+ )
6468
+ ] })
5803
6469
  ] });
5804
6470
  }
5805
6471
  function useAppForm(schema, options) {
@@ -6141,18 +6807,6 @@ function TablePaginationBase({
6141
6807
  );
6142
6808
  }
6143
6809
  var TablePagination = react.memo(TablePaginationBase);
6144
- function useMediaQuery(query) {
6145
- const [matches, setMatches] = react.useState(false);
6146
- react.useEffect(() => {
6147
- if (typeof window === "undefined") return;
6148
- const mql = window.matchMedia(query);
6149
- setMatches(mql.matches);
6150
- const handler = (e) => setMatches(e.matches);
6151
- mql.addEventListener("change", handler);
6152
- return () => mql.removeEventListener("change", handler);
6153
- }, [query]);
6154
- return matches;
6155
- }
6156
6810
  var TableContext = react.createContext(null);
6157
6811
  function useTableContext() {
6158
6812
  const ctx = react.useContext(TableContext);
@@ -7767,8 +8421,6 @@ exports.BreadcrumbList = BreadcrumbList;
7767
8421
  exports.BreadcrumbPage = BreadcrumbPage;
7768
8422
  exports.BreadcrumbSeparator = BreadcrumbSeparator;
7769
8423
  exports.Button = Button;
7770
- exports.Calendar = Calendar;
7771
- exports.CalendarDayButton = CalendarDayButton;
7772
8424
  exports.Can = Can;
7773
8425
  exports.CanNot = CanNot;
7774
8426
  exports.Card = Card;
@@ -7856,6 +8508,7 @@ exports.ItemHeader = ItemHeader;
7856
8508
  exports.ItemMedia = ItemMedia;
7857
8509
  exports.ItemSeparator = ItemSeparator;
7858
8510
  exports.ItemTitle = ItemTitle;
8511
+ exports.Label = Label;
7859
8512
  exports.Link = Link;
7860
8513
  exports.Logo = Logo;
7861
8514
  exports.MiniCalendar = MiniCalendar;
@@ -7902,7 +8555,36 @@ exports.SelectSeparator = SelectSeparator;
7902
8555
  exports.SelectTrigger = SelectTrigger;
7903
8556
  exports.SelectValue = SelectValue;
7904
8557
  exports.Separator = Separator;
8558
+ exports.Sheet = Sheet;
8559
+ exports.SheetClose = SheetClose;
8560
+ exports.SheetContent = SheetContent;
8561
+ exports.SheetDescription = SheetDescription;
8562
+ exports.SheetFooter = SheetFooter;
8563
+ exports.SheetHeader = SheetHeader;
8564
+ exports.SheetTitle = SheetTitle;
8565
+ exports.SheetTrigger = SheetTrigger;
8566
+ exports.Sidebar = Sidebar;
8567
+ exports.SidebarContent = SidebarContent;
8568
+ exports.SidebarFooter = SidebarFooter;
8569
+ exports.SidebarGroup = SidebarGroup;
8570
+ exports.SidebarGroupAction = SidebarGroupAction;
8571
+ exports.SidebarGroupContent = SidebarGroupContent;
8572
+ exports.SidebarGroupLabel = SidebarGroupLabel;
8573
+ exports.SidebarHeader = SidebarHeader;
8574
+ exports.SidebarInput = SidebarInput;
8575
+ exports.SidebarInset = SidebarInset;
8576
+ exports.SidebarMenu = SidebarMenu;
8577
+ exports.SidebarMenuAction = SidebarMenuAction;
8578
+ exports.SidebarMenuBadge = SidebarMenuBadge;
8579
+ exports.SidebarMenuButton = SidebarMenuButton;
8580
+ exports.SidebarMenuItem = SidebarMenuItem;
8581
+ exports.SidebarMenuSkeleton = SidebarMenuSkeleton;
8582
+ exports.SidebarMenuSub = SidebarMenuSub;
8583
+ exports.SidebarMenuSubButton = SidebarMenuSubButton;
8584
+ exports.SidebarMenuSubItem = SidebarMenuSubItem;
7905
8585
  exports.SidebarProvider = SidebarProvider;
8586
+ exports.SidebarRail = SidebarRail;
8587
+ exports.SidebarSeparator = SidebarSeparator;
7906
8588
  exports.SidebarTrigger = SidebarTrigger;
7907
8589
  exports.Skeleton = Skeleton;
7908
8590
  exports.Slider = Slider;
@@ -7990,6 +8672,7 @@ exports.useCan = useCan;
7990
8672
  exports.useCarousel = useCarousel;
7991
8673
  exports.useColorPicker = useColorPicker;
7992
8674
  exports.useColumnFilter = useColumnFilter;
8675
+ exports.useSidebar = useSidebar;
7993
8676
  exports.useTableContext = useTableContext;
7994
8677
  exports.useTableData = useTableData;
7995
8678
  exports.useTableFiltering = useTableFiltering;