@j3m-quantum/ui 1.5.0 → 1.6.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/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import * as React15 from 'react';
1
+ import * as React17 from 'react';
2
2
  import { useMemo } from 'react';
3
3
  import { Slot } from '@radix-ui/react-slot';
4
4
  import { cva } from 'class-variance-authority';
@@ -7,7 +7,7 @@ import { twMerge } from 'tailwind-merge';
7
7
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
8
8
  import * as SeparatorPrimitive from '@radix-ui/react-separator';
9
9
  import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
10
- import { SearchIcon, CheckIcon, CircleIcon, ChevronDownIcon, ChevronUpIcon, ChevronRightIcon, ChevronLeftIcon, ArrowLeft, ArrowRight, Loader2Icon, OctagonXIcon, TriangleAlertIcon, InfoIcon, CircleCheckIcon, ChevronRight, MoreHorizontal, MoreHorizontalIcon, XIcon, GripVerticalIcon, PanelLeftIcon, FolderIcon, ShareIcon, TrashIcon, ChevronsUpDownIcon, SparklesIcon, BadgeCheckIcon, CreditCardIcon, BellIcon, LogOutIcon, User, Calendar as Calendar$1, Clock, CalendarX2, ChevronLeft, List, Columns, Grid2x2, Grid3x3, CalendarRange, Settings, Plus, Info, Moon } from 'lucide-react';
10
+ import { SearchIcon, CheckIcon, CircleIcon, ChevronDownIcon, ChevronUpIcon, ChevronRightIcon, ChevronLeftIcon, ArrowLeft, ArrowRight, Loader2Icon, OctagonXIcon, TriangleAlertIcon, InfoIcon, CircleCheckIcon, ChevronRight, MoreHorizontal, MoreHorizontalIcon, XIcon, GripVerticalIcon, PanelLeftIcon, ArrowDown, ArrowUp, ChevronsUpDown, EyeOff, ChevronsLeft, ChevronLeft, ChevronsRight, Settings2, FolderIcon, ShareIcon, TrashIcon, ChevronsUpDownIcon, SparklesIcon, BadgeCheckIcon, CreditCardIcon, BellIcon, LogOutIcon, X, Factory, Truck, Calendar as Calendar$1, Package, AlertTriangle, User, Clock, CalendarX2, List, Columns, Grid2x2, Grid3x3, CalendarRange, Settings, Plus, Info, Moon, ArrowUpDown, ChevronDown, CheckCircle2, XCircle } from 'lucide-react';
11
11
  import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
12
12
  import * as SwitchPrimitive from '@radix-ui/react-switch';
13
13
  import * as SliderPrimitive from '@radix-ui/react-slider';
@@ -39,14 +39,16 @@ import * as PopoverPrimitive from '@radix-ui/react-popover';
39
39
  import * as HoverCardPrimitive from '@radix-ui/react-hover-card';
40
40
  import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
41
41
  import * as ResizablePrimitive from 'react-resizable-panels';
42
+ import { useReactTable, getPaginationRowModel, getFilteredRowModel, getSortedRowModel, getCoreRowModel, flexRender } from '@tanstack/react-table';
43
+ export { flexRender, getCoreRowModel, getFilteredRowModel, getPaginationRowModel, getSortedRowModel, useReactTable } from '@tanstack/react-table';
42
44
  import { subMonths, subYears, subWeeks, subDays, addMonths, addYears, addWeeks, addDays, format, startOfWeek, endOfWeek, startOfMonth, endOfMonth, startOfYear, endOfYear, isSameMonth, isSameWeek, isSameDay, isSameYear, isWithinInterval, parseISO, differenceInMinutes, eachDayOfInterval, differenceInDays, startOfDay, setMinutes, setHours, eachHourOfInterval, endOfDay, getHours, getMinutes, addMinutes, isToday, areIntervalsOverlapping } from 'date-fns';
43
45
  export { areIntervalsOverlapping, format, getDay, isSameDay, isSameMonth, isToday, parseISO } from 'date-fns';
44
46
 
45
47
  // src/hooks/use-mobile.ts
46
48
  var MOBILE_BREAKPOINT = 768;
47
49
  function useIsMobile() {
48
- const [isMobile, setIsMobile] = React15.useState(void 0);
49
- React15.useEffect(() => {
50
+ const [isMobile, setIsMobile] = React17.useState(void 0);
51
+ React17.useEffect(() => {
50
52
  const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
51
53
  const onChange = () => {
52
54
  setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
@@ -87,7 +89,7 @@ var buttonVariants = cva(
87
89
  }
88
90
  }
89
91
  );
90
- var Button = React15.forwardRef(
92
+ var Button = React17.forwardRef(
91
93
  ({ className, variant, size, asChild = false, ...props }, ref) => {
92
94
  const Comp = asChild ? Slot : "button";
93
95
  return /* @__PURE__ */ jsx(
@@ -451,7 +453,7 @@ function Slider({
451
453
  max = 100,
452
454
  ...props
453
455
  }) {
454
- const _values = React15.useMemo(
456
+ const _values = React17.useMemo(
455
457
  () => Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max],
456
458
  [value, defaultValue, min, max]
457
459
  );
@@ -737,7 +739,7 @@ function Toggle({
737
739
  }
738
740
  );
739
741
  }
740
- var ToggleGroupContext = React15.createContext({
742
+ var ToggleGroupContext = React17.createContext({
741
743
  size: "default",
742
744
  variant: "default",
743
745
  spacing: 0
@@ -774,7 +776,7 @@ function ToggleGroupItem({
774
776
  size,
775
777
  ...props
776
778
  }) {
777
- const context = React15.useContext(ToggleGroupContext);
779
+ const context = React17.useContext(ToggleGroupContext);
778
780
  return /* @__PURE__ */ jsx(
779
781
  ToggleGroupPrimitive.Item,
780
782
  {
@@ -804,7 +806,7 @@ function ThemeSwitch({
804
806
  className,
805
807
  size = "default"
806
808
  }) {
807
- const [isChecked, setIsChecked] = React15.useState(defaultChecked);
809
+ const [isChecked, setIsChecked] = React17.useState(defaultChecked);
808
810
  const isControlled = checked !== void 0;
809
811
  const currentChecked = isControlled ? checked : isChecked;
810
812
  const handleClick = () => {
@@ -1224,7 +1226,7 @@ function Label2({
1224
1226
  );
1225
1227
  }
1226
1228
  var Form = FormProvider;
1227
- var FormFieldContext = React15.createContext(
1229
+ var FormFieldContext = React17.createContext(
1228
1230
  {}
1229
1231
  );
1230
1232
  var FormField = ({
@@ -1233,8 +1235,8 @@ var FormField = ({
1233
1235
  return /* @__PURE__ */ jsx(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsx(Controller, { ...props }) });
1234
1236
  };
1235
1237
  var useFormField = () => {
1236
- const fieldContext = React15.useContext(FormFieldContext);
1237
- const itemContext = React15.useContext(FormItemContext);
1238
+ const fieldContext = React17.useContext(FormFieldContext);
1239
+ const itemContext = React17.useContext(FormItemContext);
1238
1240
  const { getFieldState } = useFormContext();
1239
1241
  const formState = useFormState({ name: fieldContext.name });
1240
1242
  const fieldState = getFieldState(fieldContext.name, formState);
@@ -1251,11 +1253,11 @@ var useFormField = () => {
1251
1253
  ...fieldState
1252
1254
  };
1253
1255
  };
1254
- var FormItemContext = React15.createContext(
1256
+ var FormItemContext = React17.createContext(
1255
1257
  {}
1256
1258
  );
1257
1259
  function FormItem({ className, ...props }) {
1258
- const id = React15.useId();
1260
+ const id = React17.useId();
1259
1261
  return /* @__PURE__ */ jsx(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsx(
1260
1262
  "div",
1261
1263
  {
@@ -2357,8 +2359,8 @@ function CalendarDayButton({
2357
2359
  modifiers,
2358
2360
  ...props
2359
2361
  }) {
2360
- const ref = React15.useRef(null);
2361
- React15.useEffect(() => {
2362
+ const ref = React17.useRef(null);
2363
+ React17.useEffect(() => {
2362
2364
  if (modifiers.focused) ref.current?.focus();
2363
2365
  }, [modifiers.focused]);
2364
2366
  return /* @__PURE__ */ jsx(
@@ -2379,9 +2381,9 @@ function CalendarDayButton({
2379
2381
  }
2380
2382
  );
2381
2383
  }
2382
- var CarouselContext = React15.createContext(null);
2384
+ var CarouselContext = React17.createContext(null);
2383
2385
  function useCarousel() {
2384
- const context = React15.useContext(CarouselContext);
2386
+ const context = React17.useContext(CarouselContext);
2385
2387
  if (!context) {
2386
2388
  throw new Error("useCarousel must be used within a <Carousel />");
2387
2389
  }
@@ -2403,20 +2405,20 @@ function Carousel({
2403
2405
  },
2404
2406
  plugins
2405
2407
  );
2406
- const [canScrollPrev, setCanScrollPrev] = React15.useState(false);
2407
- const [canScrollNext, setCanScrollNext] = React15.useState(false);
2408
- const onSelect = React15.useCallback((api2) => {
2408
+ const [canScrollPrev, setCanScrollPrev] = React17.useState(false);
2409
+ const [canScrollNext, setCanScrollNext] = React17.useState(false);
2410
+ const onSelect = React17.useCallback((api2) => {
2409
2411
  if (!api2) return;
2410
2412
  setCanScrollPrev(api2.canScrollPrev());
2411
2413
  setCanScrollNext(api2.canScrollNext());
2412
2414
  }, []);
2413
- const scrollPrev = React15.useCallback(() => {
2415
+ const scrollPrev = React17.useCallback(() => {
2414
2416
  api?.scrollPrev();
2415
2417
  }, [api]);
2416
- const scrollNext = React15.useCallback(() => {
2418
+ const scrollNext = React17.useCallback(() => {
2417
2419
  api?.scrollNext();
2418
2420
  }, [api]);
2419
- const handleKeyDown = React15.useCallback(
2421
+ const handleKeyDown = React17.useCallback(
2420
2422
  (event) => {
2421
2423
  if (event.key === "ArrowLeft") {
2422
2424
  event.preventDefault();
@@ -2428,11 +2430,11 @@ function Carousel({
2428
2430
  },
2429
2431
  [scrollPrev, scrollNext]
2430
2432
  );
2431
- React15.useEffect(() => {
2433
+ React17.useEffect(() => {
2432
2434
  if (!api || !setApi) return;
2433
2435
  setApi(api);
2434
2436
  }, [api, setApi]);
2435
- React15.useEffect(() => {
2437
+ React17.useEffect(() => {
2436
2438
  if (!api) return;
2437
2439
  onSelect(api);
2438
2440
  api.on("reInit", onSelect);
@@ -2565,9 +2567,9 @@ function CarouselNext({
2565
2567
  );
2566
2568
  }
2567
2569
  var THEMES = { light: "", dark: ".dark" };
2568
- var ChartContext = React15.createContext(null);
2570
+ var ChartContext = React17.createContext(null);
2569
2571
  function useChart() {
2570
- const context = React15.useContext(ChartContext);
2572
+ const context = React17.useContext(ChartContext);
2571
2573
  if (!context) {
2572
2574
  throw new Error("useChart must be used within a <ChartContainer />");
2573
2575
  }
@@ -2580,7 +2582,7 @@ function ChartContainer({
2580
2582
  config,
2581
2583
  ...props
2582
2584
  }) {
2583
- const uniqueId = React15.useId();
2585
+ const uniqueId = React17.useId();
2584
2586
  const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`;
2585
2587
  return /* @__PURE__ */ jsx(ChartContext.Provider, { value: { config }, children: /* @__PURE__ */ jsxs(
2586
2588
  "div",
@@ -2641,7 +2643,7 @@ function ChartTooltipContent({
2641
2643
  labelKey
2642
2644
  }) {
2643
2645
  const { config } = useChart();
2644
- const tooltipLabel = React15.useMemo(() => {
2646
+ const tooltipLabel = React17.useMemo(() => {
2645
2647
  if (hideLabel || !payload?.length) {
2646
2648
  return null;
2647
2649
  }
@@ -3344,8 +3346,8 @@ function TooltipContent({
3344
3346
  ) });
3345
3347
  }
3346
3348
  function useDetectTheme() {
3347
- const [theme, setTheme] = React15.useState("light");
3348
- React15.useEffect(() => {
3349
+ const [theme, setTheme] = React17.useState("light");
3350
+ React17.useEffect(() => {
3349
3351
  const isDark = document.documentElement.classList.contains("dark");
3350
3352
  setTheme(isDark ? "dark" : "light");
3351
3353
  const observer = new MutationObserver((mutations) => {
@@ -3397,6 +3399,81 @@ function Spinner({ className, ...props }) {
3397
3399
  }
3398
3400
  );
3399
3401
  }
3402
+ var deliveryIndicatorVariants = cva(
3403
+ "inline-block rounded-full shrink-0",
3404
+ {
3405
+ variants: {
3406
+ status: {
3407
+ "on-time": "bg-[var(--j3m-green-9,#84EBB4)]",
3408
+ "delayed": "bg-[var(--j3m-yellow-9,#FFDB43)]",
3409
+ "critical": "bg-[var(--j3m-red-9,#FB3748)]",
3410
+ "pending": "bg-[var(--j3m-gray-6,#D2D2D2)]"
3411
+ },
3412
+ size: {
3413
+ sm: "h-1.5 w-3",
3414
+ default: "h-1.5 w-3",
3415
+ lg: "h-2 w-4"
3416
+ }
3417
+ },
3418
+ defaultVariants: {
3419
+ status: "pending",
3420
+ size: "default"
3421
+ }
3422
+ }
3423
+ );
3424
+ function DeliveryIndicator({
3425
+ className,
3426
+ status,
3427
+ size,
3428
+ label,
3429
+ showTooltip = false,
3430
+ ...props
3431
+ }) {
3432
+ const indicator = /* @__PURE__ */ jsx(
3433
+ "span",
3434
+ {
3435
+ "data-slot": "delivery-indicator",
3436
+ "data-status": status,
3437
+ className: cn(deliveryIndicatorVariants({ status, size }), className),
3438
+ "aria-label": label || `Delivery status: ${status}`,
3439
+ role: "img",
3440
+ ...props
3441
+ }
3442
+ );
3443
+ if (showTooltip && label) {
3444
+ return /* @__PURE__ */ jsxs(Tooltip2, { children: [
3445
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: indicator }),
3446
+ /* @__PURE__ */ jsx(TooltipContent, { children: label })
3447
+ ] });
3448
+ }
3449
+ return indicator;
3450
+ }
3451
+ function DeliveryIndicators({
3452
+ className,
3453
+ deliveries,
3454
+ size = "default",
3455
+ showTooltips = false,
3456
+ ...props
3457
+ }) {
3458
+ return /* @__PURE__ */ jsx(
3459
+ "div",
3460
+ {
3461
+ "data-slot": "delivery-indicators",
3462
+ className: cn("flex items-center gap-1", className),
3463
+ ...props,
3464
+ children: deliveries.map((delivery, index) => /* @__PURE__ */ jsx(
3465
+ DeliveryIndicator,
3466
+ {
3467
+ status: delivery.status,
3468
+ size,
3469
+ label: delivery.label,
3470
+ showTooltip: showTooltips
3471
+ },
3472
+ index
3473
+ ))
3474
+ }
3475
+ );
3476
+ }
3400
3477
  function Breadcrumb({ ...props }) {
3401
3478
  return /* @__PURE__ */ jsx("nav", { "aria-label": "breadcrumb", "data-slot": "breadcrumb", ...props });
3402
3479
  }
@@ -3919,7 +3996,7 @@ function CommandShortcut({
3919
3996
  }
3920
3997
  );
3921
3998
  }
3922
- var SearchTrigger = React15.forwardRef(
3999
+ var SearchTrigger = React17.forwardRef(
3923
4000
  ({
3924
4001
  className,
3925
4002
  placeholder = "Search...",
@@ -3955,7 +4032,7 @@ var SearchTrigger = React15.forwardRef(
3955
4032
  );
3956
4033
  SearchTrigger.displayName = "SearchTrigger";
3957
4034
  function useSearchShortcut(onOpen, key = "k") {
3958
- React15.useEffect(() => {
4035
+ React17.useEffect(() => {
3959
4036
  const down = (e) => {
3960
4037
  if (e.key.toLowerCase() === key.toLowerCase() && (e.metaKey || e.ctrlKey)) {
3961
4038
  e.preventDefault();
@@ -4930,9 +5007,9 @@ var SIDEBAR_WIDTH = "16rem";
4930
5007
  var SIDEBAR_WIDTH_MOBILE = "18rem";
4931
5008
  var SIDEBAR_WIDTH_ICON = "3rem";
4932
5009
  var SIDEBAR_KEYBOARD_SHORTCUT = "b";
4933
- var SidebarContext = React15.createContext(null);
5010
+ var SidebarContext = React17.createContext(null);
4934
5011
  function useSidebar() {
4935
- const context = React15.useContext(SidebarContext);
5012
+ const context = React17.useContext(SidebarContext);
4936
5013
  if (!context) {
4937
5014
  throw new Error("useSidebar must be used within a SidebarProvider.");
4938
5015
  }
@@ -4948,10 +5025,10 @@ function SidebarProvider({
4948
5025
  ...props
4949
5026
  }) {
4950
5027
  const isMobile = useIsMobile();
4951
- const [openMobile, setOpenMobile] = React15.useState(false);
4952
- const [_open, _setOpen] = React15.useState(defaultOpen);
5028
+ const [openMobile, setOpenMobile] = React17.useState(false);
5029
+ const [_open, _setOpen] = React17.useState(defaultOpen);
4953
5030
  const open = openProp ?? _open;
4954
- const setOpen = React15.useCallback(
5031
+ const setOpen = React17.useCallback(
4955
5032
  (value) => {
4956
5033
  const openState = typeof value === "function" ? value(open) : value;
4957
5034
  if (setOpenProp) {
@@ -4963,10 +5040,10 @@ function SidebarProvider({
4963
5040
  },
4964
5041
  [setOpenProp, open]
4965
5042
  );
4966
- const toggleSidebar = React15.useCallback(() => {
5043
+ const toggleSidebar = React17.useCallback(() => {
4967
5044
  return isMobile ? setOpenMobile((open2) => !open2) : setOpen((open2) => !open2);
4968
5045
  }, [isMobile, setOpen, setOpenMobile]);
4969
- React15.useEffect(() => {
5046
+ React17.useEffect(() => {
4970
5047
  const handleKeyDown = (event) => {
4971
5048
  if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
4972
5049
  event.preventDefault();
@@ -4977,7 +5054,7 @@ function SidebarProvider({
4977
5054
  return () => window.removeEventListener("keydown", handleKeyDown);
4978
5055
  }, [toggleSidebar]);
4979
5056
  const state = open ? "expanded" : "collapsed";
4980
- const contextValue = React15.useMemo(
5057
+ const contextValue = React17.useMemo(
4981
5058
  () => ({
4982
5059
  state,
4983
5060
  open,
@@ -5435,7 +5512,7 @@ function SidebarMenuSkeleton({
5435
5512
  showIcon = false,
5436
5513
  ...props
5437
5514
  }) {
5438
- const width = React15.useMemo(() => {
5515
+ const width = React17.useMemo(() => {
5439
5516
  return `${Math.floor(Math.random() * 40) + 50}%`;
5440
5517
  }, []);
5441
5518
  return /* @__PURE__ */ jsxs(
@@ -5578,7 +5655,7 @@ var sectionVariants = cva(
5578
5655
  }
5579
5656
  );
5580
5657
  var isGlassVariant = (variant) => variant?.startsWith("glass-") ?? false;
5581
- var Section = React15.forwardRef(
5658
+ var Section = React17.forwardRef(
5582
5659
  ({ className, variant, ...props }, ref) => /* @__PURE__ */ jsx(
5583
5660
  "section",
5584
5661
  {
@@ -5590,7 +5667,7 @@ var Section = React15.forwardRef(
5590
5667
  )
5591
5668
  );
5592
5669
  Section.displayName = "Section";
5593
- var SectionHeader = React15.forwardRef(
5670
+ var SectionHeader = React17.forwardRef(
5594
5671
  ({ className, ...props }, ref) => /* @__PURE__ */ jsx(
5595
5672
  "div",
5596
5673
  {
@@ -5605,7 +5682,7 @@ var SectionHeader = React15.forwardRef(
5605
5682
  )
5606
5683
  );
5607
5684
  SectionHeader.displayName = "SectionHeader";
5608
- var SectionTitle = React15.forwardRef(
5685
+ var SectionTitle = React17.forwardRef(
5609
5686
  ({ className, ...props }, ref) => /* @__PURE__ */ jsx(
5610
5687
  "h2",
5611
5688
  {
@@ -5619,7 +5696,7 @@ var SectionTitle = React15.forwardRef(
5619
5696
  )
5620
5697
  );
5621
5698
  SectionTitle.displayName = "SectionTitle";
5622
- var SectionDescription = React15.forwardRef(
5699
+ var SectionDescription = React17.forwardRef(
5623
5700
  ({ className, ...props }, ref) => /* @__PURE__ */ jsx(
5624
5701
  "p",
5625
5702
  {
@@ -5633,7 +5710,7 @@ var SectionDescription = React15.forwardRef(
5633
5710
  )
5634
5711
  );
5635
5712
  SectionDescription.displayName = "SectionDescription";
5636
- var SectionContent = React15.forwardRef(
5713
+ var SectionContent = React17.forwardRef(
5637
5714
  ({ className, ...props }, ref) => /* @__PURE__ */ jsx(
5638
5715
  "div",
5639
5716
  {
@@ -5647,7 +5724,7 @@ var SectionContent = React15.forwardRef(
5647
5724
  )
5648
5725
  );
5649
5726
  SectionContent.displayName = "SectionContent";
5650
- var SectionFooter = React15.forwardRef(
5727
+ var SectionFooter = React17.forwardRef(
5651
5728
  ({ className, ...props }, ref) => /* @__PURE__ */ jsx(
5652
5729
  "div",
5653
5730
  {
@@ -5663,6 +5740,180 @@ var SectionFooter = React15.forwardRef(
5663
5740
  )
5664
5741
  );
5665
5742
  SectionFooter.displayName = "SectionFooter";
5743
+ function DataTableColumnHeader({
5744
+ column,
5745
+ title,
5746
+ className
5747
+ }) {
5748
+ if (!column.getCanSort()) {
5749
+ return /* @__PURE__ */ jsx("div", { className: cn(className), children: title });
5750
+ }
5751
+ return /* @__PURE__ */ jsx("div", { className: cn("flex items-center gap-2", className), children: /* @__PURE__ */ jsxs(DropdownMenu, { children: [
5752
+ /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
5753
+ Button,
5754
+ {
5755
+ variant: "ghost",
5756
+ size: "sm",
5757
+ className: "data-[state=open]:bg-accent -ml-3 h-8",
5758
+ children: [
5759
+ /* @__PURE__ */ jsx("span", { children: title }),
5760
+ column.getIsSorted() === "desc" ? /* @__PURE__ */ jsx(ArrowDown, {}) : column.getIsSorted() === "asc" ? /* @__PURE__ */ jsx(ArrowUp, {}) : /* @__PURE__ */ jsx(ChevronsUpDown, {})
5761
+ ]
5762
+ }
5763
+ ) }),
5764
+ /* @__PURE__ */ jsxs(DropdownMenuContent, { align: "start", children: [
5765
+ /* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: () => column.toggleSorting(false), children: [
5766
+ /* @__PURE__ */ jsx(ArrowUp, {}),
5767
+ "Asc"
5768
+ ] }),
5769
+ /* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: () => column.toggleSorting(true), children: [
5770
+ /* @__PURE__ */ jsx(ArrowDown, {}),
5771
+ "Desc"
5772
+ ] }),
5773
+ column.getCanHide() && /* @__PURE__ */ jsxs(Fragment, { children: [
5774
+ /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
5775
+ /* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: () => column.toggleVisibility(false), children: [
5776
+ /* @__PURE__ */ jsx(EyeOff, {}),
5777
+ "Hide"
5778
+ ] })
5779
+ ] })
5780
+ ] })
5781
+ ] }) });
5782
+ }
5783
+ function DataTablePagination({
5784
+ table,
5785
+ showRowSelection = true,
5786
+ pageSizeOptions = [10, 20, 25, 30, 40, 50]
5787
+ }) {
5788
+ return /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-2", children: [
5789
+ showRowSelection && /* @__PURE__ */ jsxs("div", { className: "text-muted-foreground flex-1 text-sm", children: [
5790
+ table.getFilteredSelectedRowModel().rows.length,
5791
+ " of",
5792
+ " ",
5793
+ table.getFilteredRowModel().rows.length,
5794
+ " row(s) selected."
5795
+ ] }),
5796
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-6 lg:space-x-8", children: [
5797
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2", children: [
5798
+ /* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: "Rows per page" }),
5799
+ /* @__PURE__ */ jsxs(
5800
+ Select,
5801
+ {
5802
+ value: `${table.getState().pagination.pageSize}`,
5803
+ onValueChange: (value) => {
5804
+ table.setPageSize(Number(value));
5805
+ },
5806
+ children: [
5807
+ /* @__PURE__ */ jsx(SelectTrigger, { className: "h-8 w-[70px]", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: table.getState().pagination.pageSize }) }),
5808
+ /* @__PURE__ */ jsx(SelectContent, { side: "top", children: pageSizeOptions.map((pageSize) => /* @__PURE__ */ jsx(SelectItem, { value: `${pageSize}`, children: pageSize }, pageSize)) })
5809
+ ]
5810
+ }
5811
+ )
5812
+ ] }),
5813
+ /* @__PURE__ */ jsxs("div", { className: "flex w-[100px] items-center justify-center text-sm font-medium", children: [
5814
+ "Page ",
5815
+ table.getState().pagination.pageIndex + 1,
5816
+ " of",
5817
+ " ",
5818
+ table.getPageCount()
5819
+ ] }),
5820
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2", children: [
5821
+ /* @__PURE__ */ jsxs(
5822
+ Button,
5823
+ {
5824
+ variant: "outline",
5825
+ size: "icon",
5826
+ className: "hidden size-8 lg:flex",
5827
+ onClick: () => table.setPageIndex(0),
5828
+ disabled: !table.getCanPreviousPage(),
5829
+ children: [
5830
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Go to first page" }),
5831
+ /* @__PURE__ */ jsx(ChevronsLeft, {})
5832
+ ]
5833
+ }
5834
+ ),
5835
+ /* @__PURE__ */ jsxs(
5836
+ Button,
5837
+ {
5838
+ variant: "outline",
5839
+ size: "icon",
5840
+ className: "size-8",
5841
+ onClick: () => table.previousPage(),
5842
+ disabled: !table.getCanPreviousPage(),
5843
+ children: [
5844
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Go to previous page" }),
5845
+ /* @__PURE__ */ jsx(ChevronLeft, {})
5846
+ ]
5847
+ }
5848
+ ),
5849
+ /* @__PURE__ */ jsxs(
5850
+ Button,
5851
+ {
5852
+ variant: "outline",
5853
+ size: "icon",
5854
+ className: "size-8",
5855
+ onClick: () => table.nextPage(),
5856
+ disabled: !table.getCanNextPage(),
5857
+ children: [
5858
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Go to next page" }),
5859
+ /* @__PURE__ */ jsx(ChevronRight, {})
5860
+ ]
5861
+ }
5862
+ ),
5863
+ /* @__PURE__ */ jsxs(
5864
+ Button,
5865
+ {
5866
+ variant: "outline",
5867
+ size: "icon",
5868
+ className: "hidden size-8 lg:flex",
5869
+ onClick: () => table.setPageIndex(table.getPageCount() - 1),
5870
+ disabled: !table.getCanNextPage(),
5871
+ children: [
5872
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Go to last page" }),
5873
+ /* @__PURE__ */ jsx(ChevronsRight, {})
5874
+ ]
5875
+ }
5876
+ )
5877
+ ] })
5878
+ ] })
5879
+ ] });
5880
+ }
5881
+ function DataTableViewOptions({
5882
+ table
5883
+ }) {
5884
+ return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
5885
+ /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
5886
+ Button,
5887
+ {
5888
+ variant: "outline",
5889
+ size: "sm",
5890
+ className: "ml-auto hidden h-8 lg:flex",
5891
+ children: [
5892
+ /* @__PURE__ */ jsx(Settings2, {}),
5893
+ "View"
5894
+ ]
5895
+ }
5896
+ ) }),
5897
+ /* @__PURE__ */ jsxs(DropdownMenuContent, { align: "end", className: "w-[150px]", children: [
5898
+ /* @__PURE__ */ jsx(DropdownMenuLabel, { children: "Toggle columns" }),
5899
+ /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
5900
+ table.getAllColumns().filter(
5901
+ (column) => typeof column.accessorFn !== "undefined" && column.getCanHide()
5902
+ ).map((column) => {
5903
+ return /* @__PURE__ */ jsx(
5904
+ DropdownMenuCheckboxItem,
5905
+ {
5906
+ className: "capitalize",
5907
+ checked: column.getIsVisible(),
5908
+ onCheckedChange: (value) => column.toggleVisibility(!!value),
5909
+ children: column.id
5910
+ },
5911
+ column.id
5912
+ );
5913
+ })
5914
+ ] })
5915
+ ] });
5916
+ }
5666
5917
  function SearchForm({ ...props }) {
5667
5918
  return /* @__PURE__ */ jsx("form", { ...props, children: /* @__PURE__ */ jsxs("div", { className: "relative", children: [
5668
5919
  /* @__PURE__ */ jsx(Label2, { htmlFor: "search", className: "sr-only", children: "Search" }),
@@ -5698,7 +5949,7 @@ function SiteHeader({
5698
5949
  children: /* @__PURE__ */ 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: [
5699
5950
  trigger,
5700
5951
  trigger && /* @__PURE__ */ jsx(Separator, { orientation: "vertical", className: "mr-[var(--j3m-spacing-s)] h-4" }),
5701
- /* @__PURE__ */ jsx(Breadcrumb, { className: "hidden sm:block", children: /* @__PURE__ */ jsx(BreadcrumbList, { children: breadcrumbs.map((item, index) => /* @__PURE__ */ jsxs(React15.Fragment, { children: [
5952
+ /* @__PURE__ */ jsx(Breadcrumb, { className: "hidden sm:block", children: /* @__PURE__ */ jsx(BreadcrumbList, { children: breadcrumbs.map((item, index) => /* @__PURE__ */ jsxs(React17.Fragment, { children: [
5702
5953
  index > 0 && /* @__PURE__ */ jsx(BreadcrumbSeparator, {}),
5703
5954
  /* @__PURE__ */ jsx(BreadcrumbItem, { children: item.href ? /* @__PURE__ */ jsx(BreadcrumbLink, { href: item.href, children: item.label }) : /* @__PURE__ */ jsx(BreadcrumbPage, { children: item.label }) })
5704
5955
  ] }, index)) }) }),
@@ -5847,6 +6098,934 @@ function NavUser({ user }) {
5847
6098
  )
5848
6099
  ] }) }) });
5849
6100
  }
6101
+ function PlanningTableToolbar({
6102
+ className,
6103
+ table,
6104
+ ...props
6105
+ }) {
6106
+ const isFiltered = table.getState().columnFilters.length > 0;
6107
+ return /* @__PURE__ */ jsxs(
6108
+ "div",
6109
+ {
6110
+ "data-slot": "planning-table-toolbar",
6111
+ className: cn("flex items-center gap-2", className),
6112
+ ...props,
6113
+ children: [
6114
+ /* @__PURE__ */ jsx(
6115
+ Input,
6116
+ {
6117
+ placeholder: "Filter suppliers...",
6118
+ value: table.getColumn("supplier")?.getFilterValue() ?? "",
6119
+ onChange: (event) => table.getColumn("supplier")?.setFilterValue(event.target.value),
6120
+ className: "h-8 w-[150px] lg:w-[250px]"
6121
+ }
6122
+ ),
6123
+ isFiltered && /* @__PURE__ */ jsxs(
6124
+ Button,
6125
+ {
6126
+ variant: "ghost",
6127
+ onClick: () => table.resetColumnFilters(),
6128
+ className: "h-8 px-2 lg:px-3",
6129
+ children: [
6130
+ "Reset",
6131
+ /* @__PURE__ */ jsx(X, { className: "ml-2 h-4 w-4" })
6132
+ ]
6133
+ }
6134
+ )
6135
+ ]
6136
+ }
6137
+ );
6138
+ }
6139
+ function getBadgeVariant(badgeType) {
6140
+ const variantMap = {
6141
+ Welded: "secondary",
6142
+ Painted: "secondary",
6143
+ Glazed: "secondary",
6144
+ Delivered: "secondary",
6145
+ Cured: "secondary",
6146
+ Assembled: "secondary",
6147
+ Tested: "secondary",
6148
+ Sealed: "secondary"
6149
+ };
6150
+ return variantMap[badgeType] || "secondary";
6151
+ }
6152
+ function SupplierCell({
6153
+ className,
6154
+ supplier,
6155
+ ...props
6156
+ }) {
6157
+ return /* @__PURE__ */ jsxs(
6158
+ "div",
6159
+ {
6160
+ "data-slot": "supplier-cell",
6161
+ className: cn(
6162
+ "flex flex-col justify-center gap-1 py-3 px-4 w-[200px] h-[72px]",
6163
+ className
6164
+ ),
6165
+ ...props,
6166
+ children: [
6167
+ /* @__PURE__ */ jsx("span", { className: "text-sm font-semibold leading-tight text-foreground", children: supplier.name }),
6168
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
6169
+ /* @__PURE__ */ jsx(
6170
+ Badge,
6171
+ {
6172
+ variant: getBadgeVariant(supplier.badgeType),
6173
+ className: "text-[10px] px-1.5 py-0 h-5 font-normal",
6174
+ children: supplier.badgeType
6175
+ }
6176
+ ),
6177
+ /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: supplier.scope })
6178
+ ] })
6179
+ ]
6180
+ }
6181
+ );
6182
+ }
6183
+ function getCombinedRiskLevel(data) {
6184
+ const productionStatus = data.production?.status || "on-time";
6185
+ const hasDeliveryCritical = data.deliveries?.some((d) => d.status === "critical");
6186
+ const hasDeliveryDelayed = data.deliveries?.some((d) => d.status === "delayed");
6187
+ if (productionStatus === "critical" || hasDeliveryCritical) {
6188
+ return "critical";
6189
+ }
6190
+ if (productionStatus === "delayed" || hasDeliveryDelayed || data.hasWarning) {
6191
+ return "warning";
6192
+ }
6193
+ return "normal";
6194
+ }
6195
+ function getRowStatus(status) {
6196
+ if (status === "critical") return "critical";
6197
+ if (status === "delayed") return "warning";
6198
+ return "normal";
6199
+ }
6200
+ var riskColorClasses = {
6201
+ normal: {
6202
+ border: "border-l-green-500",
6203
+ bg: "bg-green-50 dark:bg-green-950/50"
6204
+ },
6205
+ warning: {
6206
+ border: "border-l-amber-500",
6207
+ bg: "bg-amber-50 dark:bg-amber-950/50"
6208
+ },
6209
+ critical: {
6210
+ border: "border-l-red-500",
6211
+ bg: "bg-red-50 dark:bg-red-950/50"
6212
+ }
6213
+ };
6214
+ var statusColors = {
6215
+ normal: {
6216
+ icon: "text-green-600 dark:text-green-400",
6217
+ progress: "bg-green-500",
6218
+ text: "text-green-700 dark:text-green-300"
6219
+ },
6220
+ warning: {
6221
+ icon: "text-amber-600 dark:text-amber-400",
6222
+ progress: "bg-amber-500",
6223
+ text: "text-amber-700 dark:text-amber-300"
6224
+ },
6225
+ critical: {
6226
+ icon: "text-red-600 dark:text-red-400",
6227
+ progress: "bg-red-500",
6228
+ text: "text-red-700 dark:text-red-300"
6229
+ }
6230
+ };
6231
+ function WeekCell({
6232
+ className,
6233
+ data,
6234
+ week,
6235
+ supplier,
6236
+ isCurrentWeek,
6237
+ onCellClick,
6238
+ ...props
6239
+ }) {
6240
+ const handleClick = () => {
6241
+ if (onCellClick && data.type !== "empty") {
6242
+ onCellClick();
6243
+ }
6244
+ };
6245
+ const handleKeyDown = (e) => {
6246
+ if ((e.key === "Enter" || e.key === " ") && onCellClick && data.type !== "empty") {
6247
+ e.preventDefault();
6248
+ onCellClick();
6249
+ }
6250
+ };
6251
+ const combinedRisk = data.type === "data" ? getCombinedRiskLevel(data) : "normal";
6252
+ const cardColors = riskColorClasses[combinedRisk];
6253
+ const productionProgress = data.production?.progress ?? data.progress ?? 0;
6254
+ const productionStatus = getRowStatus(data.production?.status);
6255
+ const productionColors = statusColors[productionStatus];
6256
+ const deliveryCount = data.deliveries?.length ?? 0;
6257
+ const worstDeliveryStatus = data.deliveries?.some((d) => d.status === "critical") ? "critical" : data.deliveries?.some((d) => d.status === "delayed") ? "warning" : "normal";
6258
+ const deliveryColors = statusColors[worstDeliveryStatus];
6259
+ if (data.type === "empty") {
6260
+ return /* @__PURE__ */ jsx(
6261
+ "div",
6262
+ {
6263
+ "data-slot": "week-cell",
6264
+ "data-state": "empty",
6265
+ "data-current-week": isCurrentWeek,
6266
+ className: cn(
6267
+ "flex w-[120px] h-[72px] items-center justify-center cursor-default",
6268
+ isCurrentWeek && "bg-primary/5",
6269
+ className
6270
+ ),
6271
+ ...props,
6272
+ children: /* @__PURE__ */ jsx("span", { className: "text-muted-foreground/30 text-xl", children: "\xB7" })
6273
+ }
6274
+ );
6275
+ }
6276
+ if (data.type === "no-logistics") {
6277
+ return /* @__PURE__ */ jsx(
6278
+ "div",
6279
+ {
6280
+ "data-slot": "week-cell",
6281
+ "data-state": "no-logistics",
6282
+ "data-current-week": isCurrentWeek,
6283
+ onClick: handleClick,
6284
+ onKeyDown: handleKeyDown,
6285
+ role: "button",
6286
+ tabIndex: 0,
6287
+ className: cn(
6288
+ "flex flex-col w-[120px] h-[72px] justify-center p-1",
6289
+ "cursor-pointer",
6290
+ isCurrentWeek && "bg-primary/5",
6291
+ className
6292
+ ),
6293
+ ...props,
6294
+ children: /* @__PURE__ */ jsxs(
6295
+ "div",
6296
+ {
6297
+ className: cn(
6298
+ "flex flex-col w-full h-full justify-center gap-1.5 rounded-md border-l-[3px] px-2 py-1.5",
6299
+ "border-l-muted-foreground/30 bg-muted/50",
6300
+ // Hover lift effect with shadow
6301
+ "transition-all duration-200 ease-out",
6302
+ "hover:-translate-y-0.5 hover:shadow-md hover:bg-muted/70"
6303
+ ),
6304
+ children: [
6305
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
6306
+ /* @__PURE__ */ jsx(Factory, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
6307
+ /* @__PURE__ */ jsx("div", { className: "flex-1 h-1.5 bg-muted-foreground/20 rounded-full overflow-hidden", children: /* @__PURE__ */ jsx(
6308
+ "div",
6309
+ {
6310
+ className: "h-full bg-muted-foreground/40 rounded-full",
6311
+ style: { width: `${productionProgress}%` }
6312
+ }
6313
+ ) })
6314
+ ] }),
6315
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 text-muted-foreground", children: [
6316
+ /* @__PURE__ */ jsx(Truck, { className: "h-3.5 w-3.5 shrink-0" }),
6317
+ /* @__PURE__ */ jsx("span", { className: "text-[10px]", children: "No logistics" })
6318
+ ] })
6319
+ ]
6320
+ }
6321
+ )
6322
+ }
6323
+ );
6324
+ }
6325
+ return /* @__PURE__ */ jsx(
6326
+ "div",
6327
+ {
6328
+ "data-slot": "week-cell",
6329
+ "data-state": "data",
6330
+ "data-risk": combinedRisk,
6331
+ "data-current-week": isCurrentWeek,
6332
+ onClick: handleClick,
6333
+ onKeyDown: handleKeyDown,
6334
+ role: "button",
6335
+ tabIndex: 0,
6336
+ className: cn(
6337
+ "flex flex-col w-[120px] h-[72px] justify-center p-1",
6338
+ "cursor-pointer",
6339
+ isCurrentWeek && "bg-primary/5",
6340
+ className
6341
+ ),
6342
+ ...props,
6343
+ children: /* @__PURE__ */ jsxs(
6344
+ "div",
6345
+ {
6346
+ className: cn(
6347
+ "flex flex-col w-full h-full justify-center gap-1.5 rounded-md border-l-[3px] px-2 py-1.5",
6348
+ cardColors.border,
6349
+ cardColors.bg,
6350
+ // Hover lift effect with shadow
6351
+ "transition-all duration-200 ease-out",
6352
+ "hover:-translate-y-0.5 hover:shadow-md"
6353
+ ),
6354
+ children: [
6355
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
6356
+ /* @__PURE__ */ jsx(Factory, { className: cn("h-3.5 w-3.5 shrink-0", productionColors.icon) }),
6357
+ /* @__PURE__ */ jsx("div", { className: "flex-1 h-1.5 bg-black/10 dark:bg-white/10 rounded-full overflow-hidden", children: /* @__PURE__ */ jsx(
6358
+ "div",
6359
+ {
6360
+ className: cn("h-full rounded-full transition-all", productionColors.progress),
6361
+ style: { width: `${productionProgress}%` }
6362
+ }
6363
+ ) })
6364
+ ] }),
6365
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
6366
+ /* @__PURE__ */ jsx(Truck, { className: cn("h-3.5 w-3.5 shrink-0", deliveryColors.icon) }),
6367
+ deliveryCount > 0 ? /* @__PURE__ */ jsxs("span", { className: cn("text-[10px] font-medium", deliveryColors.text), children: [
6368
+ deliveryCount,
6369
+ "x delivery"
6370
+ ] }) : /* @__PURE__ */ jsx("span", { className: "text-[10px] text-muted-foreground", children: "\u2014" })
6371
+ ] })
6372
+ ]
6373
+ }
6374
+ )
6375
+ }
6376
+ );
6377
+ }
6378
+ function WeekHeader({
6379
+ className,
6380
+ week,
6381
+ ...props
6382
+ }) {
6383
+ return /* @__PURE__ */ jsxs(
6384
+ "div",
6385
+ {
6386
+ "data-slot": "week-header",
6387
+ "data-current-week": week.isCurrentWeek,
6388
+ className: cn(
6389
+ "flex flex-col justify-center gap-0.5 w-[120px] text-left",
6390
+ className
6391
+ ),
6392
+ ...props,
6393
+ children: [
6394
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
6395
+ /* @__PURE__ */ jsx("span", { className: cn(
6396
+ "text-sm font-medium",
6397
+ week.isCurrentWeek ? "text-primary" : "text-foreground"
6398
+ ), children: week.label }),
6399
+ week.isCurrentWeek && /* @__PURE__ */ jsxs("span", { className: "relative flex h-2 w-2", children: [
6400
+ /* @__PURE__ */ jsx("span", { className: "animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75" }),
6401
+ /* @__PURE__ */ jsx("span", { className: "relative inline-flex rounded-full h-2 w-2 bg-primary" })
6402
+ ] })
6403
+ ] }),
6404
+ /* @__PURE__ */ jsx("span", { className: "text-[11px] text-muted-foreground whitespace-nowrap", children: week.dateRange })
6405
+ ]
6406
+ }
6407
+ );
6408
+ }
6409
+
6410
+ // src/blocks/planning-table/types.ts
6411
+ function getWeekKey(date) {
6412
+ const year = date.getFullYear();
6413
+ const weekNumber = getISOWeek(date);
6414
+ return `${year}-W${weekNumber.toString().padStart(2, "0")}`;
6415
+ }
6416
+ function getISOWeek(date) {
6417
+ const d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));
6418
+ const dayNum = d.getUTCDay() || 7;
6419
+ d.setUTCDate(d.getUTCDate() + 4 - dayNum);
6420
+ const yearStart = new Date(Date.UTC(d.getUTCFullYear(), 0, 1));
6421
+ return Math.ceil(((d.getTime() - yearStart.getTime()) / 864e5 + 1) / 7);
6422
+ }
6423
+ function generateWeeks(startDate, count) {
6424
+ const weeks = [];
6425
+ const current = new Date(startDate);
6426
+ const today = /* @__PURE__ */ new Date();
6427
+ const currentWeekKey = getWeekKey(today);
6428
+ const dayOfWeek = current.getDay();
6429
+ const daysToMonday = dayOfWeek === 0 ? -6 : 1 - dayOfWeek;
6430
+ current.setDate(current.getDate() + daysToMonday);
6431
+ for (let i = 0; i < count; i++) {
6432
+ const weekStart = new Date(current);
6433
+ const weekEnd = new Date(current);
6434
+ weekEnd.setDate(weekEnd.getDate() + 6);
6435
+ const weekNumber = getISOWeek(weekStart);
6436
+ const year = weekStart.getFullYear();
6437
+ const weekKey = `${year}-W${weekNumber.toString().padStart(2, "0")}`;
6438
+ weeks.push({
6439
+ weekNumber,
6440
+ year,
6441
+ startDate: weekStart,
6442
+ endDate: weekEnd,
6443
+ label: `W${weekNumber.toString().padStart(2, "0")}`,
6444
+ dateRange: formatDateRange(weekStart, weekEnd),
6445
+ isCurrentWeek: weekKey === currentWeekKey
6446
+ });
6447
+ current.setDate(current.getDate() + 7);
6448
+ }
6449
+ return weeks;
6450
+ }
6451
+ function formatDateRange(start, end) {
6452
+ const months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
6453
+ const startMonth = months[start.getMonth()];
6454
+ const endMonth = months[end.getMonth()];
6455
+ if (startMonth === endMonth) {
6456
+ return `${startMonth} ${start.getDate()} - ${end.getDate()}`;
6457
+ }
6458
+ return `${startMonth} ${start.getDate()} - ${endMonth} ${end.getDate()}`;
6459
+ }
6460
+ function formatProductionUnit(unit) {
6461
+ const unitLabels = {
6462
+ quantity: "pcs",
6463
+ kvm: "m\xB2",
6464
+ ton: "ton",
6465
+ kg: "kg",
6466
+ m: "m",
6467
+ pcs: "pcs"
6468
+ };
6469
+ return unitLabels[unit] || unit;
6470
+ }
6471
+ function SupplierColumnHeader({
6472
+ column
6473
+ }) {
6474
+ return /* @__PURE__ */ jsxs(
6475
+ Button,
6476
+ {
6477
+ variant: "ghost",
6478
+ size: "sm",
6479
+ className: "-ml-3 h-8 data-[state=open]:bg-accent",
6480
+ onClick: () => column.toggleSorting(column.getIsSorted() === "asc"),
6481
+ children: [
6482
+ /* @__PURE__ */ jsx("span", { className: "font-medium", children: "Supplier / Scope" }),
6483
+ /* @__PURE__ */ jsx(ArrowUpDown, { className: "ml-2 h-4 w-4" })
6484
+ ]
6485
+ }
6486
+ );
6487
+ }
6488
+ function getSupplierColumn() {
6489
+ return {
6490
+ id: "supplier",
6491
+ accessorKey: "name",
6492
+ header: ({ column }) => /* @__PURE__ */ jsx(SupplierColumnHeader, { column }),
6493
+ cell: ({ row }) => /* @__PURE__ */ jsx(SupplierCell, { supplier: row.original }),
6494
+ enableSorting: true,
6495
+ enableHiding: false
6496
+ };
6497
+ }
6498
+ function generateWeekColumns(weeks, config) {
6499
+ return weeks.map((week) => {
6500
+ const weekKey = getWeekKey(week.startDate);
6501
+ return {
6502
+ id: weekKey,
6503
+ accessorFn: (supplier) => supplier.weeks[weekKey],
6504
+ header: () => /* @__PURE__ */ jsx(WeekHeader, { week }),
6505
+ cell: ({ row }) => {
6506
+ const supplier = row.original;
6507
+ const data = supplier.weeks[weekKey] || { type: "empty" };
6508
+ return /* @__PURE__ */ jsx(
6509
+ WeekCell,
6510
+ {
6511
+ data,
6512
+ week,
6513
+ supplier,
6514
+ isCurrentWeek: week.isCurrentWeek,
6515
+ onCellClick: config?.onCellClick ? () => config.onCellClick?.(supplier, week, data) : void 0
6516
+ }
6517
+ );
6518
+ },
6519
+ enableSorting: false,
6520
+ enableHiding: true
6521
+ };
6522
+ });
6523
+ }
6524
+ function generateColumns(weeks, config) {
6525
+ return [
6526
+ getSupplierColumn(),
6527
+ ...generateWeekColumns(weeks, config)
6528
+ ];
6529
+ }
6530
+ function PlanningTable({
6531
+ className,
6532
+ suppliers,
6533
+ config = {}
6534
+ }) {
6535
+ const {
6536
+ weekCount = 12,
6537
+ startDate = /* @__PURE__ */ new Date(),
6538
+ highlightCurrentWeek = true,
6539
+ showToolbar = true,
6540
+ showPagination = true,
6541
+ pageSizeOptions = [10, 20, 30, 50],
6542
+ defaultPageSize = 10,
6543
+ stickySupplierColumn = true,
6544
+ maxHeight = "600px"
6545
+ } = config;
6546
+ const weeks = React17.useMemo(
6547
+ () => generateWeeks(startDate, weekCount),
6548
+ [startDate, weekCount]
6549
+ );
6550
+ const currentWeekKey = React17.useMemo(() => {
6551
+ const currentWeek = weeks.find((w) => w.isCurrentWeek);
6552
+ return currentWeek ? getWeekKey(currentWeek.startDate) : null;
6553
+ }, [weeks]);
6554
+ const columns = React17.useMemo(
6555
+ () => generateColumns(weeks, config),
6556
+ [weeks, config]
6557
+ );
6558
+ const [sorting, setSorting] = React17.useState([]);
6559
+ const [columnFilters, setColumnFilters] = React17.useState([]);
6560
+ const [columnVisibility, setColumnVisibility] = React17.useState({});
6561
+ const [rowSelection, setRowSelection] = React17.useState({});
6562
+ const table = useReactTable({
6563
+ data: suppliers,
6564
+ columns,
6565
+ getCoreRowModel: getCoreRowModel(),
6566
+ getSortedRowModel: getSortedRowModel(),
6567
+ getFilteredRowModel: getFilteredRowModel(),
6568
+ getPaginationRowModel: getPaginationRowModel(),
6569
+ onSortingChange: setSorting,
6570
+ onColumnFiltersChange: setColumnFilters,
6571
+ onColumnVisibilityChange: setColumnVisibility,
6572
+ onRowSelectionChange: setRowSelection,
6573
+ state: {
6574
+ sorting,
6575
+ columnFilters,
6576
+ columnVisibility,
6577
+ rowSelection
6578
+ },
6579
+ initialState: {
6580
+ pagination: {
6581
+ pageSize: defaultPageSize
6582
+ }
6583
+ }
6584
+ });
6585
+ return /* @__PURE__ */ jsxs(
6586
+ "div",
6587
+ {
6588
+ "data-slot": "planning-table",
6589
+ className: cn("flex flex-col gap-4", className),
6590
+ children: [
6591
+ showToolbar && /* @__PURE__ */ jsx(PlanningTableToolbar, { table }),
6592
+ /* @__PURE__ */ jsx("div", { className: "rounded-lg border bg-card shadow-md", children: /* @__PURE__ */ jsxs(
6593
+ ScrollArea,
6594
+ {
6595
+ className: "w-full",
6596
+ style: { maxHeight },
6597
+ children: [
6598
+ /* @__PURE__ */ jsxs("table", { className: "w-full caption-bottom text-sm border-collapse", children: [
6599
+ /* @__PURE__ */ jsx("thead", { className: "[&_tr]:border-b bg-sidebar sticky top-0 z-20", children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx(
6600
+ "tr",
6601
+ {
6602
+ className: "border-b transition-colors",
6603
+ children: headerGroup.headers.map((header, index) => {
6604
+ const isCurrentWeekColumn = header.id === currentWeekKey;
6605
+ return /* @__PURE__ */ jsx(
6606
+ "th",
6607
+ {
6608
+ className: cn(
6609
+ "h-14 px-4 text-left align-middle font-medium text-muted-foreground border-r border-border last:border-r-0",
6610
+ index === 0 && stickySupplierColumn && [
6611
+ "sticky left-0 z-30 bg-sidebar min-w-[200px]"
6612
+ ],
6613
+ index > 0 && "min-w-[120px] w-[120px]",
6614
+ isCurrentWeekColumn && "bg-primary/10 border-t-2 border-t-primary"
6615
+ ),
6616
+ children: header.isPlaceholder ? null : flexRender(
6617
+ header.column.columnDef.header,
6618
+ header.getContext()
6619
+ )
6620
+ },
6621
+ header.id
6622
+ );
6623
+ })
6624
+ },
6625
+ headerGroup.id
6626
+ )) }),
6627
+ /* @__PURE__ */ jsx("tbody", { className: "[&_tr:last-child]:border-0 bg-background", children: table.getRowModel().rows?.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ jsx(
6628
+ "tr",
6629
+ {
6630
+ "data-state": row.getIsSelected() && "selected",
6631
+ className: "border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",
6632
+ children: row.getVisibleCells().map((cell, index) => {
6633
+ const isCurrentWeekColumn = cell.column.id === currentWeekKey;
6634
+ return /* @__PURE__ */ jsx(
6635
+ "td",
6636
+ {
6637
+ className: cn(
6638
+ "p-0 align-middle border-r border-border last:border-r-0",
6639
+ index === 0 && stickySupplierColumn && [
6640
+ "sticky left-0 z-10 bg-background min-w-[200px]"
6641
+ ],
6642
+ index > 0 && "min-w-[120px] w-[120px]",
6643
+ isCurrentWeekColumn && "bg-primary/5"
6644
+ ),
6645
+ children: flexRender(
6646
+ cell.column.columnDef.cell,
6647
+ cell.getContext()
6648
+ )
6649
+ },
6650
+ cell.id
6651
+ );
6652
+ })
6653
+ },
6654
+ row.id
6655
+ )) : /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx(
6656
+ "td",
6657
+ {
6658
+ colSpan: columns.length,
6659
+ className: "h-24 text-center",
6660
+ children: "No suppliers found."
6661
+ }
6662
+ ) }) })
6663
+ ] }),
6664
+ /* @__PURE__ */ jsx(ScrollBar, { orientation: "horizontal" }),
6665
+ /* @__PURE__ */ jsx(ScrollBar, { orientation: "vertical" })
6666
+ ]
6667
+ }
6668
+ ) }),
6669
+ showPagination && /* @__PURE__ */ jsx(
6670
+ DataTablePagination,
6671
+ {
6672
+ table,
6673
+ showRowSelection: false,
6674
+ pageSizeOptions
6675
+ }
6676
+ )
6677
+ ]
6678
+ }
6679
+ );
6680
+ }
6681
+ function getStatusBadgeVariant(status) {
6682
+ switch (status) {
6683
+ case "on-time":
6684
+ return "outline";
6685
+ // Green text with outline
6686
+ case "delayed":
6687
+ return "secondary";
6688
+ case "critical":
6689
+ return "destructive";
6690
+ default:
6691
+ return "outline";
6692
+ }
6693
+ }
6694
+ function getStatusBadgeClasses(status) {
6695
+ switch (status) {
6696
+ case "on-time":
6697
+ return "border-green-500 text-green-600 bg-green-50 dark:bg-green-950/50";
6698
+ case "delayed":
6699
+ return "border-amber-500 text-amber-600 bg-amber-50 dark:bg-amber-950/50";
6700
+ case "critical":
6701
+ return "";
6702
+ // Use default destructive
6703
+ default:
6704
+ return "";
6705
+ }
6706
+ }
6707
+ function getStatusLabel(status) {
6708
+ switch (status) {
6709
+ case "on-time":
6710
+ return "On Track";
6711
+ case "delayed":
6712
+ return "At Risk";
6713
+ case "critical":
6714
+ return "Critical";
6715
+ case "pending":
6716
+ return "Pending";
6717
+ default:
6718
+ return status;
6719
+ }
6720
+ }
6721
+ function DeliveryCard({ delivery, index }) {
6722
+ const [isOpen, setIsOpen] = React17.useState(false);
6723
+ const hasElements = delivery.elements && delivery.elements.length > 0;
6724
+ const elementsAtRisk = delivery.elementsAtRisk ?? delivery.elements?.filter((e) => !e.isProduced).length ?? 0;
6725
+ return /* @__PURE__ */ jsx(Collapsible, { open: isOpen, onOpenChange: setIsOpen, children: /* @__PURE__ */ jsxs("div", { className: "rounded-lg border overflow-hidden bg-card", children: [
6726
+ /* @__PURE__ */ jsx(CollapsibleTrigger2, { asChild: true, children: /* @__PURE__ */ jsxs(
6727
+ "button",
6728
+ {
6729
+ className: cn(
6730
+ "w-full flex items-center justify-between p-3 text-left",
6731
+ "hover:bg-muted/50 transition-colors",
6732
+ hasElements && "cursor-pointer"
6733
+ ),
6734
+ disabled: !hasElements,
6735
+ children: [
6736
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
6737
+ /* @__PURE__ */ jsx(Truck, { className: "h-4 w-4 text-muted-foreground" }),
6738
+ /* @__PURE__ */ jsxs("div", { children: [
6739
+ /* @__PURE__ */ jsx("div", { className: "text-sm font-medium", children: delivery.label || `Delivery ${index + 1}` }),
6740
+ delivery.destination && /* @__PURE__ */ jsxs("div", { className: "text-xs text-muted-foreground", children: [
6741
+ "\u2192 ",
6742
+ delivery.destination
6743
+ ] })
6744
+ ] })
6745
+ ] }),
6746
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
6747
+ /* @__PURE__ */ jsx(
6748
+ Badge,
6749
+ {
6750
+ variant: getStatusBadgeVariant(delivery.status),
6751
+ className: cn("text-xs", getStatusBadgeClasses(delivery.status)),
6752
+ children: getStatusLabel(delivery.status)
6753
+ }
6754
+ ),
6755
+ hasElements && /* @__PURE__ */ jsx(ChevronDown, { className: cn(
6756
+ "h-4 w-4 text-muted-foreground transition-transform",
6757
+ isOpen && "rotate-180"
6758
+ ) })
6759
+ ] })
6760
+ ]
6761
+ }
6762
+ ) }),
6763
+ hasElements && /* @__PURE__ */ jsxs(CollapsibleContent2, { children: [
6764
+ /* @__PURE__ */ jsx(Separator, {}),
6765
+ /* @__PURE__ */ jsxs("div", { className: "p-3 space-y-2", children: [
6766
+ elementsAtRisk > 0 && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-xs text-amber-600 dark:text-amber-400 mb-2", children: [
6767
+ /* @__PURE__ */ jsx(AlertTriangle, { className: "h-3.5 w-3.5" }),
6768
+ /* @__PURE__ */ jsxs("span", { children: [
6769
+ elementsAtRisk,
6770
+ " element(s) probably not all produced"
6771
+ ] })
6772
+ ] }),
6773
+ /* @__PURE__ */ jsx("div", { className: "space-y-1.5", children: delivery.elements?.map((element) => /* @__PURE__ */ jsxs(
6774
+ "div",
6775
+ {
6776
+ className: cn(
6777
+ "flex items-center justify-between text-xs p-2 rounded",
6778
+ element.isProduced ? "bg-muted/30" : "bg-amber-50/50 dark:bg-amber-950/30"
6779
+ ),
6780
+ children: [
6781
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
6782
+ element.isProduced ? /* @__PURE__ */ jsx(CheckCircle2, { className: "h-3.5 w-3.5 text-green-600" }) : /* @__PURE__ */ jsx(XCircle, { className: "h-3.5 w-3.5 text-amber-600" }),
6783
+ /* @__PURE__ */ jsx("span", { className: element.isProduced ? "text-foreground" : "text-amber-700 dark:text-amber-300", children: element.name })
6784
+ ] }),
6785
+ element.quantity && /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
6786
+ element.quantity,
6787
+ " ",
6788
+ element.unit ? formatProductionUnit(element.unit) : "pcs"
6789
+ ] })
6790
+ ]
6791
+ },
6792
+ element.id
6793
+ )) })
6794
+ ] })
6795
+ ] })
6796
+ ] }) });
6797
+ }
6798
+ function WeekDetailDialog({
6799
+ open,
6800
+ onOpenChange,
6801
+ supplier,
6802
+ week,
6803
+ data,
6804
+ onProgressUpdate
6805
+ }) {
6806
+ const production = data?.production;
6807
+ const initialProgress = production?.progress ?? data?.progress ?? 0;
6808
+ const initialProduced = production?.produced ?? 0;
6809
+ const [progressValue, setProgressValue] = React17.useState(initialProgress.toString());
6810
+ const [producedValue, setProducedValue] = React17.useState(initialProduced.toString());
6811
+ const [hasChanges, setHasChanges] = React17.useState(false);
6812
+ React17.useEffect(() => {
6813
+ const newProgress = data?.production?.progress ?? data?.progress ?? 0;
6814
+ const newProduced = data?.production?.produced ?? 0;
6815
+ setProgressValue(newProgress.toString());
6816
+ setProducedValue(newProduced.toString());
6817
+ setHasChanges(false);
6818
+ }, [data]);
6819
+ const handleProgressChange = (e) => {
6820
+ const value = e.target.value;
6821
+ setProgressValue(value);
6822
+ setHasChanges(true);
6823
+ };
6824
+ const handleProducedChange = (e) => {
6825
+ const value = e.target.value;
6826
+ setProducedValue(value);
6827
+ if (production?.target) {
6828
+ const produced = parseFloat(value) || 0;
6829
+ const calculatedProgress = Math.round(produced / production.target * 100);
6830
+ setProgressValue(Math.min(100, calculatedProgress).toString());
6831
+ }
6832
+ setHasChanges(true);
6833
+ };
6834
+ const handleSave = () => {
6835
+ if (!supplier || !week || !onProgressUpdate) return;
6836
+ const newProgress = Math.min(100, Math.max(0, parseFloat(progressValue) || 0));
6837
+ const newProduced = parseFloat(producedValue) || 0;
6838
+ const weekKey = `${week.year}-W${week.weekNumber.toString().padStart(2, "0")}`;
6839
+ onProgressUpdate(supplier.id, weekKey, newProgress, production ? newProduced : void 0);
6840
+ setHasChanges(false);
6841
+ };
6842
+ if (!supplier || !week || !data) {
6843
+ return null;
6844
+ }
6845
+ const productionProgress = parseFloat(progressValue) || 0;
6846
+ const productionStatus = production?.status ?? "on-time";
6847
+ return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs(DialogContent, { className: "max-w-lg max-h-[80vh] overflow-y-auto", children: [
6848
+ /* @__PURE__ */ jsxs(DialogHeader, { children: [
6849
+ /* @__PURE__ */ jsxs(DialogTitle, { className: "flex items-center gap-2", children: [
6850
+ supplier.name,
6851
+ /* @__PURE__ */ jsx(Badge, { variant: "secondary", className: "text-xs font-normal", children: supplier.badgeType })
6852
+ ] }),
6853
+ /* @__PURE__ */ jsxs(DialogDescription, { className: "flex items-center gap-2", children: [
6854
+ /* @__PURE__ */ jsx(Calendar$1, { className: "h-4 w-4" }),
6855
+ week.label,
6856
+ " \u2022 ",
6857
+ week.dateRange
6858
+ ] })
6859
+ ] }),
6860
+ /* @__PURE__ */ jsxs("div", { className: "space-y-4 mt-2", children: [
6861
+ /* @__PURE__ */ jsxs("div", { className: "text-sm text-muted-foreground", children: [
6862
+ "Scope: ",
6863
+ /* @__PURE__ */ jsx("span", { className: "text-foreground", children: supplier.scope })
6864
+ ] }),
6865
+ data.type !== "empty" && /* @__PURE__ */ jsxs(Fragment, { children: [
6866
+ /* @__PURE__ */ jsx(Separator, {}),
6867
+ /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
6868
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
6869
+ /* @__PURE__ */ jsx(Factory, { className: "h-4 w-4 text-muted-foreground" }),
6870
+ /* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: "Production Progress" }),
6871
+ /* @__PURE__ */ jsx(
6872
+ Badge,
6873
+ {
6874
+ variant: getStatusBadgeVariant(productionStatus),
6875
+ className: cn("text-xs ml-auto", getStatusBadgeClasses(productionStatus)),
6876
+ children: getStatusLabel(productionStatus)
6877
+ }
6878
+ )
6879
+ ] }),
6880
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
6881
+ /* @__PURE__ */ jsxs("div", { className: "flex justify-between text-xs text-muted-foreground", children: [
6882
+ /* @__PURE__ */ jsx("span", { children: "Progress" }),
6883
+ /* @__PURE__ */ jsxs("span", { children: [
6884
+ Math.round(productionProgress),
6885
+ "%"
6886
+ ] })
6887
+ ] }),
6888
+ /* @__PURE__ */ jsx("div", { className: "w-full h-2 bg-muted rounded-full overflow-hidden", children: /* @__PURE__ */ jsx(
6889
+ "div",
6890
+ {
6891
+ className: cn(
6892
+ "h-full rounded-full transition-all",
6893
+ productionStatus === "critical" ? "bg-red-500" : productionStatus === "delayed" ? "bg-amber-500" : "bg-green-500"
6894
+ ),
6895
+ style: { width: `${productionProgress}%` }
6896
+ }
6897
+ ) })
6898
+ ] }),
6899
+ /* @__PURE__ */ jsxs("div", { className: cn(
6900
+ "p-3 rounded-lg border bg-card space-y-3"
6901
+ ), children: [
6902
+ /* @__PURE__ */ jsx("div", { className: "text-xs font-medium text-muted-foreground uppercase tracking-wide", children: "Update Progress" }),
6903
+ production ? (
6904
+ // If we have production data, show produced amount input
6905
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-3", children: [
6906
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
6907
+ /* @__PURE__ */ jsxs(Label2, { htmlFor: "produced", className: "text-xs", children: [
6908
+ "Produced (",
6909
+ formatProductionUnit(production.unit),
6910
+ ")"
6911
+ ] }),
6912
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
6913
+ /* @__PURE__ */ jsx(
6914
+ Input,
6915
+ {
6916
+ id: "produced",
6917
+ type: "number",
6918
+ min: "0",
6919
+ max: production.target,
6920
+ value: producedValue,
6921
+ onChange: handleProducedChange,
6922
+ className: "h-8 text-sm"
6923
+ }
6924
+ ),
6925
+ /* @__PURE__ */ jsxs("span", { className: "text-sm text-muted-foreground whitespace-nowrap", children: [
6926
+ "/ ",
6927
+ production.target,
6928
+ " ",
6929
+ formatProductionUnit(production.unit)
6930
+ ] })
6931
+ ] })
6932
+ ] }),
6933
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
6934
+ /* @__PURE__ */ jsx(Label2, { htmlFor: "progress", className: "text-xs", children: "Progress (%)" }),
6935
+ /* @__PURE__ */ jsx(
6936
+ Input,
6937
+ {
6938
+ id: "progress",
6939
+ type: "number",
6940
+ min: "0",
6941
+ max: "100",
6942
+ value: progressValue,
6943
+ onChange: handleProgressChange,
6944
+ className: "h-8 text-sm"
6945
+ }
6946
+ )
6947
+ ] })
6948
+ ] })
6949
+ ) : (
6950
+ // Simple progress input if no production data
6951
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
6952
+ /* @__PURE__ */ jsx(Label2, { htmlFor: "progress", className: "text-xs", children: "Progress (%)" }),
6953
+ /* @__PURE__ */ jsx(
6954
+ Input,
6955
+ {
6956
+ id: "progress",
6957
+ type: "number",
6958
+ min: "0",
6959
+ max: "100",
6960
+ value: progressValue,
6961
+ onChange: handleProgressChange,
6962
+ className: "h-8 text-sm"
6963
+ }
6964
+ )
6965
+ ] })
6966
+ ),
6967
+ onProgressUpdate && /* @__PURE__ */ jsx(
6968
+ Button,
6969
+ {
6970
+ size: "sm",
6971
+ className: "w-full",
6972
+ disabled: !hasChanges,
6973
+ onClick: handleSave,
6974
+ children: hasChanges ? "Save Progress" : "No Changes"
6975
+ }
6976
+ )
6977
+ ] }),
6978
+ production && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between p-3 rounded-lg border bg-muted/30", children: [
6979
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
6980
+ /* @__PURE__ */ jsx(Package, { className: "h-4 w-4 text-muted-foreground" }),
6981
+ /* @__PURE__ */ jsx("span", { className: "text-sm", children: "Target" })
6982
+ ] }),
6983
+ /* @__PURE__ */ jsxs("span", { className: "text-sm font-medium", children: [
6984
+ production.target,
6985
+ " ",
6986
+ formatProductionUnit(production.unit)
6987
+ ] })
6988
+ ] })
6989
+ ] })
6990
+ ] }),
6991
+ data.deliveries && data.deliveries.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
6992
+ /* @__PURE__ */ jsx(Separator, {}),
6993
+ /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
6994
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
6995
+ /* @__PURE__ */ jsx(Truck, { className: "h-4 w-4 text-muted-foreground" }),
6996
+ /* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: "Deliveries" }),
6997
+ /* @__PURE__ */ jsxs("span", { className: "text-xs text-muted-foreground ml-auto", children: [
6998
+ data.deliveries.length,
6999
+ " scheduled"
7000
+ ] })
7001
+ ] }),
7002
+ /* @__PURE__ */ jsx("div", { className: "space-y-2", children: data.deliveries.map((delivery, index) => /* @__PURE__ */ jsx(DeliveryCard, { delivery, index }, delivery.id)) })
7003
+ ] })
7004
+ ] }),
7005
+ data.type === "no-logistics" && /* @__PURE__ */ jsxs(Fragment, { children: [
7006
+ /* @__PURE__ */ jsx(Separator, {}),
7007
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-muted-foreground p-3 bg-muted/50 rounded-lg", children: [
7008
+ /* @__PURE__ */ jsx(Truck, { className: "h-4 w-4" }),
7009
+ /* @__PURE__ */ jsx("span", { className: "text-sm", children: "No logistics scheduled for this week" })
7010
+ ] })
7011
+ ] }),
7012
+ data.hasWarning && data.warningMessage && /* @__PURE__ */ jsxs(Fragment, { children: [
7013
+ /* @__PURE__ */ jsx(Separator, {}),
7014
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2 rounded-lg bg-amber-50 dark:bg-amber-950/50 p-3 text-amber-700 dark:text-amber-300", children: [
7015
+ /* @__PURE__ */ jsx(AlertTriangle, { className: "h-4 w-4 mt-0.5 shrink-0" }),
7016
+ /* @__PURE__ */ jsx("div", { className: "text-sm", children: data.warningMessage })
7017
+ ] })
7018
+ ] }),
7019
+ data.notes && /* @__PURE__ */ jsxs(Fragment, { children: [
7020
+ /* @__PURE__ */ jsx(Separator, {}),
7021
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
7022
+ /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: "Notes" }),
7023
+ /* @__PURE__ */ jsx("p", { className: "text-sm", children: data.notes })
7024
+ ] })
7025
+ ] })
7026
+ ] })
7027
+ ] }) });
7028
+ }
5850
7029
 
5851
7030
  // src/components/event-calendar/types.ts
5852
7031
  var DEFAULT_WORKING_HOURS = {
@@ -5910,7 +7089,7 @@ var BADGE_VARIANT_LABELS = {
5910
7089
  colored: "Colored",
5911
7090
  mixed: "Mixed"
5912
7091
  };
5913
- var CalendarContext = React15.createContext(null);
7092
+ var CalendarContext = React17.createContext(null);
5914
7093
  function EventCalendarProvider({
5915
7094
  children,
5916
7095
  events: initialEvents = [],
@@ -5925,38 +7104,38 @@ function EventCalendarProvider({
5925
7104
  onEventUpdate,
5926
7105
  onEventDelete
5927
7106
  }) {
5928
- const [selectedDate, setSelectedDate] = React15.useState(defaultDate);
5929
- const [selectedUserId, setSelectedUserId] = React15.useState(defaultUserId);
5930
- const [events, setEventsState] = React15.useState(initialEvents);
5931
- const [users] = React15.useState(initialUsers);
5932
- const [badgeVariant, setBadgeVariant] = React15.useState(defaultBadgeVariant);
5933
- const [view, setView] = React15.useState(defaultView);
5934
- const [workingHours, setWorkingHours] = React15.useState(defaultWorkingHours);
5935
- const [visibleHours, setVisibleHours] = React15.useState(defaultVisibleHours);
5936
- React15.useEffect(() => {
7107
+ const [selectedDate, setSelectedDate] = React17.useState(defaultDate);
7108
+ const [selectedUserId, setSelectedUserId] = React17.useState(defaultUserId);
7109
+ const [events, setEventsState] = React17.useState(initialEvents);
7110
+ const [users] = React17.useState(initialUsers);
7111
+ const [badgeVariant, setBadgeVariant] = React17.useState(defaultBadgeVariant);
7112
+ const [view, setView] = React17.useState(defaultView);
7113
+ const [workingHours, setWorkingHours] = React17.useState(defaultWorkingHours);
7114
+ const [visibleHours, setVisibleHours] = React17.useState(defaultVisibleHours);
7115
+ React17.useEffect(() => {
5937
7116
  setEventsState(initialEvents);
5938
7117
  }, [initialEvents]);
5939
- const setEvents = React15.useCallback((newEvents) => {
7118
+ const setEvents = React17.useCallback((newEvents) => {
5940
7119
  setEventsState(newEvents);
5941
7120
  }, []);
5942
- const addEvent = React15.useCallback((event) => {
7121
+ const addEvent = React17.useCallback((event) => {
5943
7122
  setEventsState((prev) => [...prev, event]);
5944
7123
  onEventAdd?.(event);
5945
7124
  }, [onEventAdd]);
5946
- const updateEvent = React15.useCallback((event) => {
7125
+ const updateEvent = React17.useCallback((event) => {
5947
7126
  setEventsState(
5948
7127
  (prev) => prev.map((e) => e.id === event.id ? event : e)
5949
7128
  );
5950
7129
  onEventUpdate?.(event);
5951
7130
  }, [onEventUpdate]);
5952
- const deleteEvent = React15.useCallback((eventId) => {
7131
+ const deleteEvent = React17.useCallback((eventId) => {
5953
7132
  setEventsState((prev) => prev.filter((e) => e.id !== eventId));
5954
7133
  onEventDelete?.(eventId);
5955
7134
  }, [onEventDelete]);
5956
- const goToToday = React15.useCallback(() => {
7135
+ const goToToday = React17.useCallback(() => {
5957
7136
  setSelectedDate(/* @__PURE__ */ new Date());
5958
7137
  }, []);
5959
- const goToPrevious = React15.useCallback(() => {
7138
+ const goToPrevious = React17.useCallback(() => {
5960
7139
  setSelectedDate((current) => {
5961
7140
  switch (view) {
5962
7141
  case "day":
@@ -5974,7 +7153,7 @@ function EventCalendarProvider({
5974
7153
  }
5975
7154
  });
5976
7155
  }, [view]);
5977
- const goToNext = React15.useCallback(() => {
7156
+ const goToNext = React17.useCallback(() => {
5978
7157
  setSelectedDate((current) => {
5979
7158
  switch (view) {
5980
7159
  case "day":
@@ -5992,7 +7171,7 @@ function EventCalendarProvider({
5992
7171
  }
5993
7172
  });
5994
7173
  }, [view]);
5995
- const contextValue = React15.useMemo(
7174
+ const contextValue = React17.useMemo(
5996
7175
  () => ({
5997
7176
  // State
5998
7177
  selectedDate,
@@ -6039,7 +7218,7 @@ function EventCalendarProvider({
6039
7218
  return /* @__PURE__ */ jsx(CalendarContext.Provider, { value: contextValue, children });
6040
7219
  }
6041
7220
  function useEventCalendar() {
6042
- const context = React15.useContext(CalendarContext);
7221
+ const context = React17.useContext(CalendarContext);
6043
7222
  if (!context) {
6044
7223
  throw new Error("useEventCalendar must be used within an EventCalendarProvider");
6045
7224
  }
@@ -6047,14 +7226,14 @@ function useEventCalendar() {
6047
7226
  }
6048
7227
  function useFilteredEvents() {
6049
7228
  const { events, selectedUserId } = useEventCalendar();
6050
- return React15.useMemo(() => {
7229
+ return React17.useMemo(() => {
6051
7230
  if (!selectedUserId) return events;
6052
7231
  return events.filter((event) => event.user.id === selectedUserId);
6053
7232
  }, [events, selectedUserId]);
6054
7233
  }
6055
7234
  function useEventsInRange(startDate, endDate) {
6056
7235
  const filteredEvents = useFilteredEvents();
6057
- return React15.useMemo(() => {
7236
+ return React17.useMemo(() => {
6058
7237
  return filteredEvents.filter((event) => {
6059
7238
  const eventStart = new Date(event.startDate);
6060
7239
  const eventEnd = new Date(event.endDate);
@@ -6428,7 +7607,7 @@ function getViewDateRange(date, view) {
6428
7607
  return { start: startOfMonth(date), end: endOfMonth(date) };
6429
7608
  }
6430
7609
  }
6431
- function formatDateRange(start, end) {
7610
+ function formatDateRange2(start, end) {
6432
7611
  if (isSameDay(start, end)) {
6433
7612
  return format(start, "MMM d, yyyy");
6434
7613
  }
@@ -6612,8 +7791,8 @@ function MoreEvents({ count, onClick, className }) {
6612
7791
  );
6613
7792
  }
6614
7793
  function TimeIndicator({ className }) {
6615
- const [now, setNow] = React15.useState(/* @__PURE__ */ new Date());
6616
- React15.useEffect(() => {
7794
+ const [now, setNow] = React17.useState(/* @__PURE__ */ new Date());
7795
+ React17.useEffect(() => {
6617
7796
  const interval = setInterval(() => setNow(/* @__PURE__ */ new Date()), 6e4);
6618
7797
  return () => clearInterval(interval);
6619
7798
  }, []);
@@ -6650,24 +7829,24 @@ function DateBadge({ date, className }) {
6650
7829
  }
6651
7830
  );
6652
7831
  }
6653
- var DragContext = React15.createContext(null);
7832
+ var DragContext = React17.createContext(null);
6654
7833
  function DragProvider({
6655
7834
  children,
6656
7835
  snapMinutes = 15,
6657
7836
  onDragStart,
6658
7837
  onDragEnd
6659
7838
  }) {
6660
- const [draggedEvent, setDraggedEventState] = React15.useState(null);
6661
- const [isDragging, setIsDragging] = React15.useState(false);
7839
+ const [draggedEvent, setDraggedEventState] = React17.useState(null);
7840
+ const [isDragging, setIsDragging] = React17.useState(false);
6662
7841
  const { updateEvent } = useEventCalendar();
6663
- const setDraggedEvent = React15.useCallback((event) => {
7842
+ const setDraggedEvent = React17.useCallback((event) => {
6664
7843
  setDraggedEventState(event);
6665
7844
  setIsDragging(!!event);
6666
7845
  if (event) {
6667
7846
  onDragStart?.(event);
6668
7847
  }
6669
7848
  }, [onDragStart]);
6670
- const handleDrop = React15.useCallback((newStartDate) => {
7849
+ const handleDrop = React17.useCallback((newStartDate) => {
6671
7850
  if (!draggedEvent) return;
6672
7851
  const snappedDate = snapToInterval(newStartDate, snapMinutes);
6673
7852
  const { startDate, endDate } = calculateDropDates(draggedEvent, snappedDate);
@@ -6680,7 +7859,7 @@ function DragProvider({
6680
7859
  onDragEnd?.(updatedEvent, new Date(startDate), new Date(endDate));
6681
7860
  setDraggedEvent(null);
6682
7861
  }, [draggedEvent, snapMinutes, updateEvent, onDragEnd, setDraggedEvent]);
6683
- const contextValue = React15.useMemo(
7862
+ const contextValue = React17.useMemo(
6684
7863
  () => ({
6685
7864
  draggedEvent,
6686
7865
  setDraggedEvent,
@@ -6691,7 +7870,7 @@ function DragProvider({
6691
7870
  return /* @__PURE__ */ jsx(DragContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(DragDropHandler, { onDrop: handleDrop, children }) });
6692
7871
  }
6693
7872
  function useDrag() {
6694
- const context = React15.useContext(DragContext);
7873
+ const context = React17.useContext(DragContext);
6695
7874
  if (!context) {
6696
7875
  throw new Error("useDrag must be used within a DragProvider");
6697
7876
  }
@@ -6736,7 +7915,7 @@ function DroppableZone({
6736
7915
  }) {
6737
7916
  const { draggedEvent, setDraggedEvent } = useDrag();
6738
7917
  const { updateEvent } = useEventCalendar();
6739
- const [isOver, setIsOver] = React15.useState(false);
7918
+ const [isOver, setIsOver] = React17.useState(false);
6740
7919
  const handleDragOver = (e) => {
6741
7920
  e.preventDefault();
6742
7921
  e.dataTransfer.dropEffect = "move";
@@ -6774,23 +7953,23 @@ function DroppableZone({
6774
7953
  function useDroppable({ date, hour, minute = 0, onDrop }) {
6775
7954
  const { draggedEvent, setDraggedEvent } = useDrag();
6776
7955
  const { updateEvent } = useEventCalendar();
6777
- const [isOver, setIsOver] = React15.useState(false);
6778
- const dropTargetDate = React15.useMemo(() => {
7956
+ const [isOver, setIsOver] = React17.useState(false);
7957
+ const dropTargetDate = React17.useMemo(() => {
6779
7958
  const targetDate = new Date(date);
6780
7959
  if (hour !== void 0) {
6781
7960
  targetDate.setHours(hour, minute, 0, 0);
6782
7961
  }
6783
7962
  return targetDate;
6784
7963
  }, [date, hour, minute]);
6785
- const handleDragOver = React15.useCallback((e) => {
7964
+ const handleDragOver = React17.useCallback((e) => {
6786
7965
  e.preventDefault();
6787
7966
  e.dataTransfer.dropEffect = "move";
6788
7967
  if (!isOver) setIsOver(true);
6789
7968
  }, [isOver]);
6790
- const handleDragLeave = React15.useCallback(() => {
7969
+ const handleDragLeave = React17.useCallback(() => {
6791
7970
  setIsOver(false);
6792
7971
  }, []);
6793
- const handleDrop = React15.useCallback((e) => {
7972
+ const handleDrop = React17.useCallback((e) => {
6794
7973
  e.preventDefault();
6795
7974
  setIsOver(false);
6796
7975
  if (!draggedEvent) return;
@@ -6817,13 +7996,13 @@ function useDroppable({ date, hour, minute = 0, onDrop }) {
6817
7996
  function useDraggable(event, disabled = false) {
6818
7997
  const { setDraggedEvent, draggedEvent } = useDrag();
6819
7998
  const isDragged = draggedEvent?.id === event.id;
6820
- const handleDragStart = React15.useCallback((e) => {
7999
+ const handleDragStart = React17.useCallback((e) => {
6821
8000
  if (disabled) return;
6822
8001
  e.dataTransfer.effectAllowed = "move";
6823
8002
  e.dataTransfer.setData("text/plain", event.id);
6824
8003
  setDraggedEvent(event);
6825
8004
  }, [disabled, event, setDraggedEvent]);
6826
- const handleDragEnd = React15.useCallback(() => {
8005
+ const handleDragEnd = React17.useCallback(() => {
6827
8006
  setDraggedEvent(null);
6828
8007
  }, [setDraggedEvent]);
6829
8008
  return {
@@ -6864,15 +8043,15 @@ function MonthView({
6864
8043
  }) {
6865
8044
  const { selectedDate, badgeVariant, setSelectedDate, setView } = useEventCalendar();
6866
8045
  const filteredEvents = useFilteredEvents();
6867
- const { singleDayEvents, multiDayEvents } = React15.useMemo(
8046
+ const { singleDayEvents, multiDayEvents } = React17.useMemo(
6868
8047
  () => splitEventsByDuration(filteredEvents),
6869
8048
  [filteredEvents]
6870
8049
  );
6871
- const cells = React15.useMemo(
8050
+ const cells = React17.useMemo(
6872
8051
  () => getCalendarCells(selectedDate),
6873
8052
  [selectedDate]
6874
8053
  );
6875
- const eventPositions = React15.useMemo(
8054
+ const eventPositions = React17.useMemo(
6876
8055
  () => calculateMonthEventPositions(multiDayEvents, singleDayEvents, selectedDate),
6877
8056
  [multiDayEvents, singleDayEvents, selectedDate]
6878
8057
  );
@@ -7054,7 +8233,7 @@ function WeekView({
7054
8233
  visibleHours
7055
8234
  } = useEventCalendar();
7056
8235
  const filteredEvents = useFilteredEvents();
7057
- const { singleDayEvents, multiDayEvents } = React15.useMemo(
8236
+ const { singleDayEvents, multiDayEvents } = React17.useMemo(
7058
8237
  () => splitEventsByDuration(filteredEvents),
7059
8238
  [filteredEvents]
7060
8239
  );
@@ -7260,8 +8439,8 @@ function CalendarTimeline({
7260
8439
  firstVisibleHour,
7261
8440
  lastVisibleHour
7262
8441
  }) {
7263
- const [currentTime, setCurrentTime] = React15.useState(/* @__PURE__ */ new Date());
7264
- React15.useEffect(() => {
8442
+ const [currentTime, setCurrentTime] = React17.useState(/* @__PURE__ */ new Date());
8443
+ React17.useEffect(() => {
7265
8444
  const interval = setInterval(() => {
7266
8445
  setCurrentTime(/* @__PURE__ */ new Date());
7267
8446
  }, 6e4);
@@ -7344,7 +8523,7 @@ function DayView({
7344
8523
  visibleHours
7345
8524
  } = useEventCalendar();
7346
8525
  const filteredEvents = useFilteredEvents();
7347
- const { singleDayEvents, multiDayEvents } = React15.useMemo(
8526
+ const { singleDayEvents, multiDayEvents } = React17.useMemo(
7348
8527
  () => splitEventsByDuration(filteredEvents),
7349
8528
  [filteredEvents]
7350
8529
  );
@@ -7352,7 +8531,7 @@ function DayView({
7352
8531
  visibleHours,
7353
8532
  singleDayEvents
7354
8533
  );
7355
- const currentEvents = React15.useMemo(() => {
8534
+ const currentEvents = React17.useMemo(() => {
7356
8535
  if (!isToday(selectedDate)) return [];
7357
8536
  return getCurrentEvents(singleDayEvents);
7358
8537
  }, [singleDayEvents, selectedDate]);
@@ -7576,8 +8755,8 @@ function CalendarTimeline2({
7576
8755
  firstVisibleHour,
7577
8756
  lastVisibleHour
7578
8757
  }) {
7579
- const [currentTime, setCurrentTime] = React15.useState(/* @__PURE__ */ new Date());
7580
- React15.useEffect(() => {
8758
+ const [currentTime, setCurrentTime] = React17.useState(/* @__PURE__ */ new Date());
8759
+ React17.useEffect(() => {
7581
8760
  const interval = setInterval(() => {
7582
8761
  setCurrentTime(/* @__PURE__ */ new Date());
7583
8762
  }, 6e4);
@@ -7611,7 +8790,7 @@ function YearView({
7611
8790
  }) {
7612
8791
  const { selectedDate, setSelectedDate, setView } = useEventCalendar();
7613
8792
  const filteredEvents = useFilteredEvents();
7614
- const months = React15.useMemo(() => {
8793
+ const months = React17.useMemo(() => {
7615
8794
  const yearStart = startOfYear(selectedDate);
7616
8795
  return Array.from({ length: 12 }, (_, i) => addMonths(yearStart, i));
7617
8796
  }, [selectedDate]);
@@ -7734,11 +8913,11 @@ function AgendaView({
7734
8913
  }) {
7735
8914
  const { selectedDate, setSelectedDate, setView } = useEventCalendar();
7736
8915
  const filteredEvents = useFilteredEvents();
7737
- const { singleDayEvents, multiDayEvents } = React15.useMemo(
8916
+ const { singleDayEvents, multiDayEvents } = React17.useMemo(
7738
8917
  () => splitEventsByDuration(filteredEvents),
7739
8918
  [filteredEvents]
7740
8919
  );
7741
- const eventsByDay = React15.useMemo(() => {
8920
+ const eventsByDay = React17.useMemo(() => {
7742
8921
  const allDates = /* @__PURE__ */ new Map();
7743
8922
  singleDayEvents.forEach((event) => {
7744
8923
  const eventDate = parseISO(event.startDate);
@@ -7931,7 +9110,7 @@ function CalendarHeader({
7931
9110
  const filteredEvents = useFilteredEvents();
7932
9111
  const eventCount = filteredEvents.length;
7933
9112
  const { start: rangeStart, end: rangeEnd } = getViewDateRange(selectedDate, view);
7934
- const dateRangeLabel = formatDateRange(rangeStart, rangeEnd);
9113
+ const dateRangeLabel = formatDateRange2(rangeStart, rangeEnd);
7935
9114
  const getInitials = (name) => {
7936
9115
  return name.split(" ").map((n) => n[0]).join("").toUpperCase().slice(0, 2);
7937
9116
  };
@@ -8203,16 +9382,16 @@ function EventDialog({
8203
9382
  defaultUserId
8204
9383
  }) {
8205
9384
  const { addEvent, updateEvent, deleteEvent, users } = useEventCalendar();
8206
- const [title, setTitle] = React15.useState("");
8207
- const [description, setDescription] = React15.useState("");
8208
- const [startDate, setStartDate] = React15.useState("");
8209
- const [startTime, setStartTime] = React15.useState("");
8210
- const [endDate, setEndDate] = React15.useState("");
8211
- const [endTime, setEndTime] = React15.useState("");
8212
- const [color, setColor] = React15.useState("blue");
8213
- const [userId, setUserId] = React15.useState("");
8214
- const [isSubmitting, setIsSubmitting] = React15.useState(false);
8215
- React15.useEffect(() => {
9385
+ const [title, setTitle] = React17.useState("");
9386
+ const [description, setDescription] = React17.useState("");
9387
+ const [startDate, setStartDate] = React17.useState("");
9388
+ const [startTime, setStartTime] = React17.useState("");
9389
+ const [endDate, setEndDate] = React17.useState("");
9390
+ const [endTime, setEndTime] = React17.useState("");
9391
+ const [color, setColor] = React17.useState("blue");
9392
+ const [userId, setUserId] = React17.useState("");
9393
+ const [isSubmitting, setIsSubmitting] = React17.useState(false);
9394
+ React17.useEffect(() => {
8216
9395
  if (open) {
8217
9396
  if (mode === "edit" && event) {
8218
9397
  const start = parseISO(event.startDate);
@@ -8435,7 +9614,7 @@ function QuickAddEvent({
8435
9614
  onOpenDialog,
8436
9615
  onClose
8437
9616
  }) {
8438
- const [title, setTitle] = React15.useState("");
9617
+ const [title, setTitle] = React17.useState("");
8439
9618
  const { users } = useEventCalendar();
8440
9619
  const handleSubmit = (e) => {
8441
9620
  e.preventDefault();
@@ -8502,8 +9681,8 @@ var HOUR_OPTIONS = Array.from({ length: 25 }, (_, i) => {
8502
9681
  });
8503
9682
  function ChangeVisibleHoursInput() {
8504
9683
  const { visibleHours, setVisibleHours } = useEventCalendar();
8505
- const [from, setFrom] = React15.useState(visibleHours.from);
8506
- const [to, setTo] = React15.useState(visibleHours.to);
9684
+ const [from, setFrom] = React17.useState(visibleHours.from);
9685
+ const [to, setTo] = React17.useState(visibleHours.to);
8507
9686
  const handleApply = () => {
8508
9687
  const toHour = to === 0 ? 24 : to;
8509
9688
  setVisibleHours({ from, to: toHour });
@@ -8549,7 +9728,7 @@ var HOUR_OPTIONS2 = Array.from({ length: 25 }, (_, i) => {
8549
9728
  });
8550
9729
  function ChangeWorkingHoursInput() {
8551
9730
  const { workingHours, setWorkingHours } = useEventCalendar();
8552
- const [localWorkingHours, setLocalWorkingHours] = React15.useState({
9731
+ const [localWorkingHours, setLocalWorkingHours] = React17.useState({
8553
9732
  ...workingHours
8554
9733
  });
8555
9734
  const handleToggleDay = (dayId) => {
@@ -8698,8 +9877,8 @@ function CalendarSettingsButton({
8698
9877
  );
8699
9878
  }
8700
9879
  function useMediaQuery(query) {
8701
- const [matches, setMatches] = React15.useState(false);
8702
- React15.useEffect(() => {
9880
+ const [matches, setMatches] = React17.useState(false);
9881
+ React17.useEffect(() => {
8703
9882
  const media = window.matchMedia(query);
8704
9883
  setMatches(media.matches);
8705
9884
  const listener = (event) => {
@@ -8751,11 +9930,11 @@ function BigCalendarInner({
8751
9930
  maxEventsPerDay
8752
9931
  }) {
8753
9932
  const { view, setView } = useEventCalendar();
8754
- const [dialogOpen, setDialogOpen] = React15.useState(false);
8755
- const [settingsDialogOpen, setSettingsDialogOpen] = React15.useState(false);
8756
- const [selectedEvent, setSelectedEvent] = React15.useState(null);
8757
- const [dialogMode, setDialogMode] = React15.useState("add");
8758
- const [defaultDate, setDefaultDate] = React15.useState(/* @__PURE__ */ new Date());
9933
+ const [dialogOpen, setDialogOpen] = React17.useState(false);
9934
+ const [settingsDialogOpen, setSettingsDialogOpen] = React17.useState(false);
9935
+ const [selectedEvent, setSelectedEvent] = React17.useState(null);
9936
+ const [dialogMode, setDialogMode] = React17.useState("add");
9937
+ const [defaultDate, setDefaultDate] = React17.useState(/* @__PURE__ */ new Date());
8759
9938
  const isMobile = useMediaQuery("(max-width: 768px)");
8760
9939
  const isCompact = compact === "auto" ? isMobile : compact;
8761
9940
  const handleAddClick = () => {
@@ -8914,6 +10093,6 @@ function CalendarView({
8914
10093
  }
8915
10094
  }
8916
10095
 
8917
- export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AgendaView, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AspectRatio, Avatar, AvatarFallback, AvatarImage, BADGE_VARIANT_LABELS, Badge, BigCalendar, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, Calendar, CalendarContext, CalendarDayButton, CalendarHeader, CalendarHeaderCompact, CalendarSettingsButton, CalendarSettingsContent, CalendarSettingsDialog, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, ChangeBadgeVariantInput, ChangeVisibleHoursInput, ChangeWorkingHoursInput, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, Checkbox, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, DEFAULT_VISIBLE_HOURS, DEFAULT_WORKING_HOURS, DateBadge, DayView, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DragContext, DragProvider, DraggableEvent, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, DroppableZone, EVENT_COLORS, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, EventBadge, EventCalendarProvider, EventDialog, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, Item6 as Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, ItemSeparator, ItemTitle, Kbd, KbdGroup, Label2 as Label, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, MonthView, MoreEvents, NativeSelect, NativeSelectOptGroup, NativeSelectOption, NavMain, NavProjects, NavSecondary, NavUser, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PlayerCanvas, PlayerCanvasActionButton, PlayerCanvasControls, PlayerCanvasDivider, PlayerCanvasInfo, PlayerCanvasLabel, PlayerCanvasPlayButton, PlayerCanvasProgress, PlayerCanvasSkipButton, PlayerCanvasTitle, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, QuickAddEvent, RadioGroup, RadioGroupItem, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScrollArea, ScrollBar, SearchForm, SearchTrigger, Section, SectionContent, SectionDescription, SectionFooter, SectionHeader, SectionTitle, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetBody, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, SiteHeader, Skeleton, Slider, Spinner, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ThemeSwitch, TimeIndicator, Toaster, Toggle, ToggleGroup, ToggleGroupItem, ToolBarCanvas, ToolBarCanvasButton, ToolBarCanvasDivider, ToolBarCanvasGroup, Tooltip2 as Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, UserAvatarsDropdown, VIEW_LABELS, WeekView, YearView, badgeVariants, buttonGroupVariants, buttonVariants, calculateDropDates, calculateMonthEventPositions, cardVariants, createDefaultEvent, formatDateRange, formatTime, generateEventId, getCalendarCells, getCurrentEvents, getDayHours, getEventBlockStyle, getEventDuration, getEventDurationMinutes, getEventsCount, getEventsForDate, getEventsInRange, getHeaderLabel, getMonthCellEvents, getMonthDays, getTimeHeight, getTimePosition, getViewDateRange, getVisibleHours, getWeekDayNames, getWeekDays, getYearMonths, groupEvents, isMultiDayEvent, isWorkingHour, navigateDate, navigationMenuTriggerStyle, playerCanvasPlayButtonVariants, playerCanvasSkipButtonVariants, rangeText, sectionVariants, snapToInterval, sortEvents, splitEventsByDuration, toggleVariants, toolBarCanvasButtonVariants, useDrag, useDraggable, useDroppable, useEventCalendar, useEventsInRange, useFilteredEvents, useFormField, useIsMobile, useSearchShortcut, useSidebar };
10096
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AgendaView, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AspectRatio, Avatar, AvatarFallback, AvatarImage, BADGE_VARIANT_LABELS, Badge, BigCalendar, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, Calendar, CalendarContext, CalendarDayButton, CalendarHeader, CalendarHeaderCompact, CalendarSettingsButton, CalendarSettingsContent, CalendarSettingsDialog, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, ChangeBadgeVariantInput, ChangeVisibleHoursInput, ChangeWorkingHoursInput, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, Checkbox, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, DEFAULT_VISIBLE_HOURS, DEFAULT_WORKING_HOURS, DataTableColumnHeader, DataTablePagination, DataTableViewOptions, DateBadge, DayView, DeliveryIndicator, DeliveryIndicators, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DragContext, DragProvider, DraggableEvent, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, DroppableZone, EVENT_COLORS, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, EventBadge, EventCalendarProvider, EventDialog, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, Item6 as Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, ItemSeparator, ItemTitle, Kbd, KbdGroup, Label2 as Label, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, MonthView, MoreEvents, NativeSelect, NativeSelectOptGroup, NativeSelectOption, NavMain, NavProjects, NavSecondary, NavUser, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PlanningTable, PlanningTableToolbar, PlayerCanvas, PlayerCanvasActionButton, PlayerCanvasControls, PlayerCanvasDivider, PlayerCanvasInfo, PlayerCanvasLabel, PlayerCanvasPlayButton, PlayerCanvasProgress, PlayerCanvasSkipButton, PlayerCanvasTitle, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, QuickAddEvent, RadioGroup, RadioGroupItem, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScrollArea, ScrollBar, SearchForm, SearchTrigger, Section, SectionContent, SectionDescription, SectionFooter, SectionHeader, SectionTitle, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetBody, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, SiteHeader, Skeleton, Slider, Spinner, SupplierCell, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ThemeSwitch, TimeIndicator, Toaster, Toggle, ToggleGroup, ToggleGroupItem, ToolBarCanvas, ToolBarCanvasButton, ToolBarCanvasDivider, ToolBarCanvasGroup, Tooltip2 as Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, UserAvatarsDropdown, VIEW_LABELS, WeekCell, WeekDetailDialog, WeekHeader, WeekView, YearView, badgeVariants, buttonGroupVariants, buttonVariants, calculateDropDates, calculateMonthEventPositions, cardVariants, createDefaultEvent, deliveryIndicatorVariants, formatDateRange2 as formatDateRange, formatProductionUnit, formatTime, generateColumns, generateEventId, generateWeekColumns, generateWeeks, getCalendarCells, getCurrentEvents, getDayHours, getEventBlockStyle, getEventDuration, getEventDurationMinutes, getEventsCount, getEventsForDate, getEventsInRange, getHeaderLabel, getISOWeek, getMonthCellEvents, getMonthDays, getSupplierColumn, getTimeHeight, getTimePosition, getViewDateRange, getVisibleHours, getWeekDayNames, getWeekDays, getWeekKey, getYearMonths, groupEvents, isMultiDayEvent, isWorkingHour, navigateDate, navigationMenuTriggerStyle, playerCanvasPlayButtonVariants, playerCanvasSkipButtonVariants, rangeText, sectionVariants, snapToInterval, sortEvents, splitEventsByDuration, toggleVariants, toolBarCanvasButtonVariants, useDrag, useDraggable, useDroppable, useEventCalendar, useEventsInRange, useFilteredEvents, useFormField, useIsMobile, useSearchShortcut, useSidebar };
8918
10097
  //# sourceMappingURL=index.js.map
8919
10098
  //# sourceMappingURL=index.js.map