@farmzone/fz-react-ui 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -10,6 +10,7 @@ import { FieldValues, Path, ControllerRenderProps, ControllerFieldState, UseForm
10
10
  import * as zustand_middleware from 'zustand/middleware';
11
11
  import * as zustand from 'zustand';
12
12
  import { Address } from 'react-daum-postcode';
13
+ import { LucideIcon } from 'lucide-react';
13
14
  import { Location } from 'react-router';
14
15
  import { ClassValue } from 'clsx';
15
16
  import * as PopoverPrimitive from '@radix-ui/react-popover';
@@ -748,6 +749,8 @@ interface FilePreviewViewerProps<T extends string = string> {
748
749
  }
749
750
  declare function FilePreviewViewer<T extends string = string>(props: FilePreviewViewerProps<T>): React$1.JSX.Element | null;
750
751
 
752
+ declare function getFileLabel(src: string, index: number, fileTypeOverride?: PreviewFileType): string;
753
+
751
754
  interface TableCellRenderContext {
752
755
  value: unknown;
753
756
  rowIndex: number;
@@ -1048,6 +1051,19 @@ interface ToggleSwitchProps {
1048
1051
  }
1049
1052
  declare function ToggleSwitch(props: ToggleSwitchProps): React$1.JSX.Element;
1050
1053
 
1054
+ interface BaseUploaderProps {
1055
+ files: Array<File>;
1056
+ onChange: (files: Array<File>) => void;
1057
+ accept?: string;
1058
+ multiple?: boolean;
1059
+ maxFiles?: number;
1060
+ maxSize?: number;
1061
+ disabled?: boolean;
1062
+ placeholder?: string;
1063
+ className?: string;
1064
+ }
1065
+ declare function BaseUploader(props: BaseUploaderProps): React$1.JSX.Element;
1066
+
1051
1067
  interface ExcelUploaderProps {
1052
1068
  files: Array<File>;
1053
1069
  onChange: (files: Array<File>) => void;
@@ -1065,6 +1081,35 @@ interface FileUploaderProps {
1065
1081
  }
1066
1082
  declare function FileUploader(props: FileUploaderProps): React$1.JSX.Element;
1067
1083
 
1084
+ interface MenuGrandchild {
1085
+ label: string;
1086
+ path: string;
1087
+ }
1088
+ interface MenuChild {
1089
+ label: string;
1090
+ path?: string;
1091
+ children?: Array<MenuGrandchild>;
1092
+ }
1093
+ interface MenuItem {
1094
+ icon: LucideIcon;
1095
+ label: string;
1096
+ path?: string;
1097
+ children?: Array<MenuChild>;
1098
+ }
1099
+ interface MenuSection {
1100
+ title?: string;
1101
+ items: Array<MenuItem>;
1102
+ }
1103
+ interface SidebarProps {
1104
+ isOpen: boolean;
1105
+ onClose: () => void;
1106
+ menuSections: Array<MenuSection>;
1107
+ header?: ReactNode;
1108
+ className?: string;
1109
+ showCollapseButton?: boolean;
1110
+ }
1111
+ declare function Sidebar(props: SidebarProps): React$1.JSX.Element;
1112
+
1068
1113
  type DetailMode = "read" | "edit";
1069
1114
  type DetailFieldType = "text" | "badge" | "tag" | "link" | "image" | "date" | "number" | "boolean";
1070
1115
  type BadgeTone = "success" | "warning" | "error" | "info" | "default";
@@ -1236,6 +1281,15 @@ declare function useBlockModalConfirm(): {
1236
1281
  */
1237
1282
  declare function useScrollToTop(containerId?: string): () => void;
1238
1283
 
1284
+ type FilePreviewViewerFiles<T extends string> = FilePreviewViewerProps<T>["files"];
1285
+ declare function useFilePreviewViewer<T extends string = string>(files: FilePreviewViewerFiles<T>): {
1286
+ isOpen: boolean;
1287
+ initialIndex: number;
1288
+ open: (index?: number) => void;
1289
+ close: () => void;
1290
+ viewerProps: FilePreviewViewerProps<T>;
1291
+ };
1292
+
1239
1293
  declare function cn(...inputs: Array<ClassValue>): string;
1240
1294
  declare const buttonVariants: (props?: ({
1241
1295
  variant?: "outline" | "save" | "delete" | "reset" | "search" | "file" | "carousel" | "accent" | "ghost" | "link" | null | undefined;
@@ -1274,4 +1328,4 @@ declare const Z_INDEX: {
1274
1328
  };
1275
1329
  type ZIndexKey = keyof typeof Z_INDEX;
1276
1330
 
1277
- export { Badge, type BadgeProps, BreadCrumb, type BreadCrumbItem, type BreadCrumbProps, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Carousel, type CarouselProps, type CarouselRef, Checkbox, type CheckboxProps, type ConfirmOptions, DatePicker, DebouncedButton, type DebouncedButtonProps, DetailContent, type DetailContentProps, type DetailFieldOrSection, DetailModalFrame, type DetailMode, DetailPageFrame, Empty, ExcelUploader, FilePreviewViewer, FileUploader, Input, type InputProps, Loading, LoadingOverlay, type LoadingOverlayProps, type LoadingProps, Modal, ModalBody, ModalContent, ModalFooter, ModalHeader, ModalIconHeader, type ModalIconHeaderProps, ModalOverlay, type ModalProps, type ModalType, MultiTabBar as MultiTab, type MultiTab as MultiTabItem, PageFilter, Pagination, type PaginationProps, Popover, type PopoverAlign, PopoverAnchor, PopoverClose, PopoverContent, type PopoverContentProps, PopoverDescription, PopoverFooter, PopoverHeader, type PopoverPosition, PopoverTitle, PopoverTrigger, Radio, RadioGroup, type RadioGroupProps, type RadioOptionType, type RadioProps, ScrollArea, ScrollBar, SearchAddress, type SearchAddressProps, SearchBar, type SearchBarProps, Select, Select$1 as SelectBase, SelectContent, SelectGroup, SelectItem, SelectLabel, type SelectOptionType, type SelectProps, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SimplePopover, type SimplePopoverProps, Skeleton, type SkeletonProps, Slider, type SliderProps, Spinner, type SpinnerColor, type SpinnerProps, type SpinnerSize, SubmitForm, Switch, type SwitchProps, Tab, type TabItem, type TabProps, Table, Textarea, type TextareaProps, type ToastPosition, type ToastProps, ToastProvider, type ToastType, ToggleSwitch, Tooltip, type TooltipProps, type ZIndexKey, Z_INDEX, buildBreadCrumbItems, buttonVariants, cn, confirmModal, findParentMenuItem, findParentMenuName, switchTrackSizes, textVariants, toast, useBlockModalConfirm, useBreadCrumbItems, useCustomBlocker, useDetailController, useModal, useMultiTabStore, useScrollToTop, useToast };
1331
+ export { Badge, type BadgeProps, BaseUploader, type BaseUploaderProps, BreadCrumb, type BreadCrumbItem, type BreadCrumbProps, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Carousel, type CarouselProps, type CarouselRef, Checkbox, type CheckboxProps, type ConfirmOptions, DatePicker, DebouncedButton, type DebouncedButtonProps, DetailContent, type DetailContentProps, type DetailField, type DetailFieldOrSection, DetailModalFrame, type DetailMode, DetailPageFrame, Empty, ExcelUploader, FilePreviewViewer, FileUploader, type FilterRow, type FormFieldConfig, Input, type InputProps, Loading, LoadingOverlay, type LoadingOverlayProps, type LoadingProps, type MenuChild, type MenuGrandchild, type MenuItem, type MenuSection, Modal, ModalBody, ModalContent, ModalFooter, ModalHeader, ModalIconHeader, type ModalIconHeaderProps, ModalOverlay, type ModalProps, type ModalType, MultiTabBar as MultiTab, type MultiTab as MultiTabItem, PageFilter, Pagination, type PaginationProps, Popover, type PopoverAlign, PopoverAnchor, PopoverClose, PopoverContent, type PopoverContentProps, PopoverDescription, PopoverFooter, PopoverHeader, type PopoverPosition, PopoverTitle, PopoverTrigger, Radio, RadioGroup, type RadioGroupProps, type RadioOptionType, type RadioProps, ScrollArea, ScrollBar, SearchAddress, type SearchAddressProps, SearchBar, type SearchBarProps, Select, Select$1 as SelectBase, SelectContent, SelectGroup, SelectItem, SelectLabel, type SelectOptionType, type SelectProps, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Sidebar, type SidebarProps, SimplePopover, type SimplePopoverProps, Skeleton, type SkeletonProps, Slider, type SliderProps, Spinner, type SpinnerColor, type SpinnerProps, type SpinnerSize, SubmitForm, Switch, type SwitchProps, Tab, type TabItem, type TabProps, Table, Textarea, type TextareaProps, type ToastPosition, type ToastProps, ToastProvider, type ToastType, ToggleSwitch, Tooltip, type TooltipProps, type ZIndexKey, Z_INDEX, buildBreadCrumbItems, buttonVariants, cn, confirmModal, findParentMenuItem, findParentMenuName, getFileLabel, switchTrackSizes, textVariants, toast, useBlockModalConfirm, useBreadCrumbItems, useCustomBlocker, useDetailController, useFilePreviewViewer, useModal, useMultiTabStore, useScrollToTop, useToast };
package/dist/index.d.ts CHANGED
@@ -10,6 +10,7 @@ import { FieldValues, Path, ControllerRenderProps, ControllerFieldState, UseForm
10
10
  import * as zustand_middleware from 'zustand/middleware';
11
11
  import * as zustand from 'zustand';
12
12
  import { Address } from 'react-daum-postcode';
13
+ import { LucideIcon } from 'lucide-react';
13
14
  import { Location } from 'react-router';
14
15
  import { ClassValue } from 'clsx';
15
16
  import * as PopoverPrimitive from '@radix-ui/react-popover';
@@ -748,6 +749,8 @@ interface FilePreviewViewerProps<T extends string = string> {
748
749
  }
749
750
  declare function FilePreviewViewer<T extends string = string>(props: FilePreviewViewerProps<T>): React$1.JSX.Element | null;
750
751
 
752
+ declare function getFileLabel(src: string, index: number, fileTypeOverride?: PreviewFileType): string;
753
+
751
754
  interface TableCellRenderContext {
752
755
  value: unknown;
753
756
  rowIndex: number;
@@ -1048,6 +1051,19 @@ interface ToggleSwitchProps {
1048
1051
  }
1049
1052
  declare function ToggleSwitch(props: ToggleSwitchProps): React$1.JSX.Element;
1050
1053
 
1054
+ interface BaseUploaderProps {
1055
+ files: Array<File>;
1056
+ onChange: (files: Array<File>) => void;
1057
+ accept?: string;
1058
+ multiple?: boolean;
1059
+ maxFiles?: number;
1060
+ maxSize?: number;
1061
+ disabled?: boolean;
1062
+ placeholder?: string;
1063
+ className?: string;
1064
+ }
1065
+ declare function BaseUploader(props: BaseUploaderProps): React$1.JSX.Element;
1066
+
1051
1067
  interface ExcelUploaderProps {
1052
1068
  files: Array<File>;
1053
1069
  onChange: (files: Array<File>) => void;
@@ -1065,6 +1081,35 @@ interface FileUploaderProps {
1065
1081
  }
1066
1082
  declare function FileUploader(props: FileUploaderProps): React$1.JSX.Element;
1067
1083
 
1084
+ interface MenuGrandchild {
1085
+ label: string;
1086
+ path: string;
1087
+ }
1088
+ interface MenuChild {
1089
+ label: string;
1090
+ path?: string;
1091
+ children?: Array<MenuGrandchild>;
1092
+ }
1093
+ interface MenuItem {
1094
+ icon: LucideIcon;
1095
+ label: string;
1096
+ path?: string;
1097
+ children?: Array<MenuChild>;
1098
+ }
1099
+ interface MenuSection {
1100
+ title?: string;
1101
+ items: Array<MenuItem>;
1102
+ }
1103
+ interface SidebarProps {
1104
+ isOpen: boolean;
1105
+ onClose: () => void;
1106
+ menuSections: Array<MenuSection>;
1107
+ header?: ReactNode;
1108
+ className?: string;
1109
+ showCollapseButton?: boolean;
1110
+ }
1111
+ declare function Sidebar(props: SidebarProps): React$1.JSX.Element;
1112
+
1068
1113
  type DetailMode = "read" | "edit";
1069
1114
  type DetailFieldType = "text" | "badge" | "tag" | "link" | "image" | "date" | "number" | "boolean";
1070
1115
  type BadgeTone = "success" | "warning" | "error" | "info" | "default";
@@ -1236,6 +1281,15 @@ declare function useBlockModalConfirm(): {
1236
1281
  */
1237
1282
  declare function useScrollToTop(containerId?: string): () => void;
1238
1283
 
1284
+ type FilePreviewViewerFiles<T extends string> = FilePreviewViewerProps<T>["files"];
1285
+ declare function useFilePreviewViewer<T extends string = string>(files: FilePreviewViewerFiles<T>): {
1286
+ isOpen: boolean;
1287
+ initialIndex: number;
1288
+ open: (index?: number) => void;
1289
+ close: () => void;
1290
+ viewerProps: FilePreviewViewerProps<T>;
1291
+ };
1292
+
1239
1293
  declare function cn(...inputs: Array<ClassValue>): string;
1240
1294
  declare const buttonVariants: (props?: ({
1241
1295
  variant?: "outline" | "save" | "delete" | "reset" | "search" | "file" | "carousel" | "accent" | "ghost" | "link" | null | undefined;
@@ -1274,4 +1328,4 @@ declare const Z_INDEX: {
1274
1328
  };
1275
1329
  type ZIndexKey = keyof typeof Z_INDEX;
1276
1330
 
1277
- export { Badge, type BadgeProps, BreadCrumb, type BreadCrumbItem, type BreadCrumbProps, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Carousel, type CarouselProps, type CarouselRef, Checkbox, type CheckboxProps, type ConfirmOptions, DatePicker, DebouncedButton, type DebouncedButtonProps, DetailContent, type DetailContentProps, type DetailFieldOrSection, DetailModalFrame, type DetailMode, DetailPageFrame, Empty, ExcelUploader, FilePreviewViewer, FileUploader, Input, type InputProps, Loading, LoadingOverlay, type LoadingOverlayProps, type LoadingProps, Modal, ModalBody, ModalContent, ModalFooter, ModalHeader, ModalIconHeader, type ModalIconHeaderProps, ModalOverlay, type ModalProps, type ModalType, MultiTabBar as MultiTab, type MultiTab as MultiTabItem, PageFilter, Pagination, type PaginationProps, Popover, type PopoverAlign, PopoverAnchor, PopoverClose, PopoverContent, type PopoverContentProps, PopoverDescription, PopoverFooter, PopoverHeader, type PopoverPosition, PopoverTitle, PopoverTrigger, Radio, RadioGroup, type RadioGroupProps, type RadioOptionType, type RadioProps, ScrollArea, ScrollBar, SearchAddress, type SearchAddressProps, SearchBar, type SearchBarProps, Select, Select$1 as SelectBase, SelectContent, SelectGroup, SelectItem, SelectLabel, type SelectOptionType, type SelectProps, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SimplePopover, type SimplePopoverProps, Skeleton, type SkeletonProps, Slider, type SliderProps, Spinner, type SpinnerColor, type SpinnerProps, type SpinnerSize, SubmitForm, Switch, type SwitchProps, Tab, type TabItem, type TabProps, Table, Textarea, type TextareaProps, type ToastPosition, type ToastProps, ToastProvider, type ToastType, ToggleSwitch, Tooltip, type TooltipProps, type ZIndexKey, Z_INDEX, buildBreadCrumbItems, buttonVariants, cn, confirmModal, findParentMenuItem, findParentMenuName, switchTrackSizes, textVariants, toast, useBlockModalConfirm, useBreadCrumbItems, useCustomBlocker, useDetailController, useModal, useMultiTabStore, useScrollToTop, useToast };
1331
+ export { Badge, type BadgeProps, BaseUploader, type BaseUploaderProps, BreadCrumb, type BreadCrumbItem, type BreadCrumbProps, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Carousel, type CarouselProps, type CarouselRef, Checkbox, type CheckboxProps, type ConfirmOptions, DatePicker, DebouncedButton, type DebouncedButtonProps, DetailContent, type DetailContentProps, type DetailField, type DetailFieldOrSection, DetailModalFrame, type DetailMode, DetailPageFrame, Empty, ExcelUploader, FilePreviewViewer, FileUploader, type FilterRow, type FormFieldConfig, Input, type InputProps, Loading, LoadingOverlay, type LoadingOverlayProps, type LoadingProps, type MenuChild, type MenuGrandchild, type MenuItem, type MenuSection, Modal, ModalBody, ModalContent, ModalFooter, ModalHeader, ModalIconHeader, type ModalIconHeaderProps, ModalOverlay, type ModalProps, type ModalType, MultiTabBar as MultiTab, type MultiTab as MultiTabItem, PageFilter, Pagination, type PaginationProps, Popover, type PopoverAlign, PopoverAnchor, PopoverClose, PopoverContent, type PopoverContentProps, PopoverDescription, PopoverFooter, PopoverHeader, type PopoverPosition, PopoverTitle, PopoverTrigger, Radio, RadioGroup, type RadioGroupProps, type RadioOptionType, type RadioProps, ScrollArea, ScrollBar, SearchAddress, type SearchAddressProps, SearchBar, type SearchBarProps, Select, Select$1 as SelectBase, SelectContent, SelectGroup, SelectItem, SelectLabel, type SelectOptionType, type SelectProps, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Sidebar, type SidebarProps, SimplePopover, type SimplePopoverProps, Skeleton, type SkeletonProps, Slider, type SliderProps, Spinner, type SpinnerColor, type SpinnerProps, type SpinnerSize, SubmitForm, Switch, type SwitchProps, Tab, type TabItem, type TabProps, Table, Textarea, type TextareaProps, type ToastPosition, type ToastProps, ToastProvider, type ToastType, ToggleSwitch, Tooltip, type TooltipProps, type ZIndexKey, Z_INDEX, buildBreadCrumbItems, buttonVariants, cn, confirmModal, findParentMenuItem, findParentMenuName, getFileLabel, switchTrackSizes, textVariants, toast, useBlockModalConfirm, useBreadCrumbItems, useCustomBlocker, useDetailController, useFilePreviewViewer, useModal, useMultiTabStore, useScrollToTop, useToast };
package/dist/index.js CHANGED
@@ -6,13 +6,13 @@ import * as React6 from 'react';
6
6
  import React6__default, { forwardRef, useState, useRef, useEffect, useImperativeHandle, useCallback, memo, createContext, useMemo, useContext, useId, useLayoutEffect, useDeferredValue } from 'react';
7
7
  import { Slot } from '@radix-ui/react-slot';
8
8
  import * as TooltipPrimitive from '@radix-ui/react-tooltip';
9
- import { ChevronLeft, ChevronRight, FileText, ZoomIn, ZoomOut, RotateCcw, RotateCw, Download, X, Trash2, Plus, EyeOff, Eye, Minus, Check, CircleX, ChevronDown, Calendar, CircleIcon, ChevronUp, Search, TriangleAlert, Info, Pencil, BadgePlus, FileSearch2, FileUp, ChevronFirst, ChevronLast, Upload } from 'lucide-react';
9
+ import { ChevronLeft, ChevronRight, FileText, ZoomIn, ZoomOut, RotateCcw, RotateCw, Download, X, Trash2, Plus, EyeOff, Eye, Minus, Check, CircleX, ChevronDown, Calendar, CircleIcon, ChevronUp, Search, TriangleAlert, Info, Pencil, BadgePlus, FileSearch2, Upload, FileUp, PanelRightClose, PanelLeftClose, ChevronFirst, ChevronLast } from 'lucide-react';
10
10
  import * as SwitchPrimitive from '@radix-ui/react-switch';
11
11
  import * as RadixSlider from '@radix-ui/react-slider';
12
12
  import * as SelectPrimitive from '@radix-ui/react-select';
13
13
  import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
14
14
  import * as PopoverPrimitive from '@radix-ui/react-popover';
15
- import { useLocation, useBlocker, useSearchParams, Link } from 'react-router';
15
+ import { useLocation, useNavigate, useBlocker, useSearchParams, Link } from 'react-router';
16
16
  import { createPortal } from 'react-dom';
17
17
  import { debounce } from 'es-toolkit';
18
18
  import { createRoot } from 'react-dom/client';
@@ -275,6 +275,7 @@ function Button(props) {
275
275
  position: tooltipPosition,
276
276
  className: tooltipClassName,
277
277
  contentClassName: tooltipContentClassName,
278
+ asChild: true,
278
279
  children: /* @__PURE__ */ jsx("span", { className: "inline-block", children: buttonElement })
279
280
  }
280
281
  );
@@ -3127,7 +3128,6 @@ function Empty(props) {
3127
3128
  const useFullScreen = Boolean(defaultUI && fullScreen);
3128
3129
  const layout = useFullScreen ? "page" : "panel";
3129
3130
  const iconVariant = iconVariantProp ?? (icon ? "boxed" : "plain");
3130
- console.log("Asdf");
3131
3131
  const content = defaultUI ? /* @__PURE__ */ jsx(
3132
3132
  EmptyContent,
3133
3133
  {
@@ -5445,15 +5445,15 @@ function normalizeExtension(ext) {
5445
5445
  const lower = ext.replace(/^\./, "").toLowerCase();
5446
5446
  if (lower === "jpeg") return "jpg";
5447
5447
  if (lower === "svg+xml") return "svg";
5448
- return lower.split("+")[0];
5448
+ return lower.split("+")[0] || "";
5449
5449
  }
5450
5450
  function getExtensionFromPathname(pathname) {
5451
5451
  const segments = pathname.split("/");
5452
5452
  for (let i = segments.length - 1; i >= 0; i -= 1) {
5453
5453
  const segment = segments[i];
5454
- const dotIndex = segment.lastIndexOf(".");
5454
+ const dotIndex = segment?.lastIndexOf(".") ?? -1;
5455
5455
  if (dotIndex <= 0) continue;
5456
- return segment.slice(dotIndex + 1).toLowerCase();
5456
+ return segment?.slice(dotIndex + 1).toLowerCase() ?? "";
5457
5457
  }
5458
5458
  return null;
5459
5459
  }
@@ -5462,7 +5462,7 @@ function getExtensionFromSrc(src) {
5462
5462
  if (!pattern.test(src)) continue;
5463
5463
  if (type === "image") {
5464
5464
  const dataUrlMatch = src.match(/^data:image\/([a-zA-Z0-9+.-]+)/i);
5465
- return dataUrlMatch ? normalizeExtension(dataUrlMatch[1]) : "jpg";
5465
+ return dataUrlMatch ? normalizeExtension(dataUrlMatch[1] ?? "") : "jpg";
5466
5466
  }
5467
5467
  if (type === "pdf") return "pdf";
5468
5468
  }
@@ -8388,6 +8388,231 @@ function FileUploader(props) {
8388
8388
  /* @__PURE__ */ jsx(FilePreviewViewer, { ...viewer.viewerProps, fileTypes, fileNames: files.map((f) => f.name) })
8389
8389
  ] });
8390
8390
  }
8391
+ function Sidebar(props) {
8392
+ const navigate = useNavigate();
8393
+ const { isOpen: isOpen2, onClose, menuSections, header, className, showCollapseButton = false } = props;
8394
+ const { pathname } = useLocation();
8395
+ const [isCollapsed, setIsCollapsed] = useState(false);
8396
+ const [isContentVisible, setIsContentVisible] = useState(true);
8397
+ const [expandedItems, setExpandedItems] = useState(/* @__PURE__ */ new Set());
8398
+ const [expandedSubItems, setExpandedSubItems] = useState(/* @__PURE__ */ new Set());
8399
+ useEffect(() => {
8400
+ if (isCollapsed) return;
8401
+ const timer = setTimeout(() => setIsContentVisible(true), 300);
8402
+ return () => clearTimeout(timer);
8403
+ }, [isCollapsed]);
8404
+ useEffect(() => {
8405
+ menuSections.forEach((section) => {
8406
+ section.items.forEach((item) => {
8407
+ if (!item.children) return;
8408
+ const allLeafPaths = item.children.flatMap(
8409
+ (child) => child.children ? child.children.map((gc) => gc.path) : child.path ? [child.path] : []
8410
+ );
8411
+ if (!allLeafPaths.includes(pathname)) return;
8412
+ setExpandedItems((prev) => {
8413
+ if (prev.has(item.label)) return prev;
8414
+ const next = new Set(prev);
8415
+ next.add(item.label);
8416
+ return next;
8417
+ });
8418
+ item.children.forEach((child) => {
8419
+ if (!child.children) return;
8420
+ const gcPaths = child.children.map((gc) => gc.path);
8421
+ if (!gcPaths.includes(pathname)) return;
8422
+ const subKey = `${item.label}::${child.label}`;
8423
+ setExpandedSubItems((prev) => {
8424
+ if (prev.has(subKey)) return prev;
8425
+ const next = new Set(prev);
8426
+ next.add(subKey);
8427
+ return next;
8428
+ });
8429
+ });
8430
+ });
8431
+ });
8432
+ }, [pathname, menuSections]);
8433
+ const toggleExpand = (label) => {
8434
+ setExpandedItems((prev) => {
8435
+ const next = new Set(prev);
8436
+ if (next.has(label)) next.delete(label);
8437
+ else next.add(label);
8438
+ return next;
8439
+ });
8440
+ };
8441
+ const toggleSubExpand = (subKey) => {
8442
+ setExpandedSubItems((prev) => {
8443
+ const next = new Set(prev);
8444
+ if (next.has(subKey)) next.delete(subKey);
8445
+ else next.add(subKey);
8446
+ return next;
8447
+ });
8448
+ };
8449
+ const handleItemClick = (path) => {
8450
+ if (path.includes("https")) {
8451
+ window.open(path, "_blank", "noopener,noreferrer");
8452
+ } else if (path !== "") {
8453
+ navigate(path);
8454
+ onClose();
8455
+ }
8456
+ };
8457
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
8458
+ isOpen2 && /* @__PURE__ */ jsx("div", { className: "fixed inset-0 bg-black/10 bg-opacity-50 z-40 lg:hidden", onClick: onClose }),
8459
+ /* @__PURE__ */ jsxs(
8460
+ "aside",
8461
+ {
8462
+ className: `
8463
+ ${isCollapsed ? "w-11 min-w-11" : "min-w-60 w-62"}
8464
+ ${isOpen2 ? "translate-x-0" : "-translate-x-full lg:translate-x-0"}
8465
+ hide-scrollbar fixed lg:relative top-0 left-0 h-screen bg-white border-r border-gray-200 z-50 shrink-0 overflow-y-auto
8466
+ transition-transform duration-300 ease-in-out
8467
+ ${className ?? ""}
8468
+ `,
8469
+ children: [
8470
+ showCollapseButton && /* @__PURE__ */ jsx(
8471
+ "button",
8472
+ {
8473
+ onClick: () => {
8474
+ if (!isCollapsed) setIsContentVisible(false);
8475
+ setIsCollapsed((prev) => !prev);
8476
+ },
8477
+ className: "absolute top-4 right-2 z-20 w-6.5 h-6.5 bg-gray-50 rounded-full flex items-center justify-center hover:bg-gray-50 transition-colors cursor-pointer hover:bg-gray-100",
8478
+ children: isCollapsed ? /* @__PURE__ */ jsx(PanelRightClose, { size: 18, color: "var(--color-sub-darkgray)" }) : /* @__PURE__ */ jsx(PanelLeftClose, { size: 18, color: "var(--color-sub-darkgray)" })
8479
+ }
8480
+ ),
8481
+ isContentVisible && /* @__PURE__ */ jsxs("div", { className: "py-6 pl-6 pr-4", children: [
8482
+ /* @__PURE__ */ jsx(
8483
+ "button",
8484
+ {
8485
+ onClick: onClose,
8486
+ className: "lg:hidden absolute top-4 right-4 p-2 hover:bg-gray-100 rounded-lg transition-colors text-2xl leading-none",
8487
+ "aria-label": "Close menu",
8488
+ children: "x"
8489
+ }
8490
+ ),
8491
+ header && /* @__PURE__ */ jsx("div", { className: "mb-10 mt-2", children: header }),
8492
+ /* @__PURE__ */ jsx("nav", { className: "space-y-6", children: menuSections.map((section, sectionIndex) => /* @__PURE__ */ jsxs("div", { children: [
8493
+ section.title && /* @__PURE__ */ jsx("div", { className: "text-xs font-semibold text-gray-500 tracking-wider mb-3", children: section.title }),
8494
+ /* @__PURE__ */ jsx("div", { className: "space-y-1", children: section.items.map((item) => /* @__PURE__ */ jsxs("div", { children: [
8495
+ /* @__PURE__ */ jsxs(
8496
+ "button",
8497
+ {
8498
+ onClick: () => {
8499
+ if (item.children) {
8500
+ toggleExpand(item.label);
8501
+ } else if (item.path) {
8502
+ handleItemClick(item.path);
8503
+ }
8504
+ },
8505
+ className: `
8506
+ w-full text-left flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-colors
8507
+ ${!item.children && pathname === item.path ? "bg-blue-50 text-blue-600" : "text-gray-700 hover:bg-gray-100"}
8508
+ cursor-pointer
8509
+ `,
8510
+ children: [
8511
+ /* @__PURE__ */ jsx(item.icon, { className: "w-4 h-4 flex-shrink-0" }),
8512
+ /* @__PURE__ */ jsx("span", { className: "flex-1", children: item.label }),
8513
+ item.children && /* @__PURE__ */ jsx(
8514
+ "svg",
8515
+ {
8516
+ className: `w-4 h-4 transition-transform ${expandedItems.has(item.label) ? "rotate-90" : ""}`,
8517
+ fill: "none",
8518
+ stroke: "currentColor",
8519
+ viewBox: "0 0 24 24",
8520
+ children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5l7 7-7 7" })
8521
+ }
8522
+ ),
8523
+ item.path?.includes("https") && /* @__PURE__ */ jsx(
8524
+ "svg",
8525
+ {
8526
+ className: "w-4 h-4 flex-shrink-0 text-gray-400",
8527
+ fill: "none",
8528
+ stroke: "currentColor",
8529
+ viewBox: "0 0 24 24",
8530
+ children: /* @__PURE__ */ jsx(
8531
+ "path",
8532
+ {
8533
+ strokeLinecap: "round",
8534
+ strokeLinejoin: "round",
8535
+ strokeWidth: 2,
8536
+ d: "M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"
8537
+ }
8538
+ )
8539
+ }
8540
+ )
8541
+ ]
8542
+ }
8543
+ ),
8544
+ item.children && expandedItems.has(item.label) && /* @__PURE__ */ jsx("div", { className: "ml-[25px] mt-1 space-y-1", children: item.children.map((child, childIndex) => {
8545
+ if (child.children && child.children.length > 0) {
8546
+ const subKey = `${item.label}::${child.label}`;
8547
+ const isSubExpanded = expandedSubItems.has(subKey);
8548
+ const isSubActive = child.children.some((gc) => gc.path === pathname);
8549
+ return /* @__PURE__ */ jsxs("div", { children: [
8550
+ /* @__PURE__ */ jsxs(
8551
+ "button",
8552
+ {
8553
+ onClick: () => toggleSubExpand(subKey),
8554
+ className: `
8555
+ w-full text-left flex items-center justify-between px-3 py-1.5 rounded-lg text-sm transition-colors cursor-pointer
8556
+ ${isSubActive ? "text-blue-600 font-medium" : "text-gray-600 hover:bg-gray-50 hover:text-gray-900"}
8557
+ `,
8558
+ children: [
8559
+ /* @__PURE__ */ jsx("span", { children: child.label }),
8560
+ /* @__PURE__ */ jsx(
8561
+ "svg",
8562
+ {
8563
+ className: `w-3 h-3 transition-transform ${isSubExpanded ? "rotate-90" : ""}`,
8564
+ fill: "none",
8565
+ stroke: "currentColor",
8566
+ viewBox: "0 0 24 24",
8567
+ children: /* @__PURE__ */ jsx(
8568
+ "path",
8569
+ {
8570
+ strokeLinecap: "round",
8571
+ strokeLinejoin: "round",
8572
+ strokeWidth: 2,
8573
+ d: "M9 5l7 7-7 7"
8574
+ }
8575
+ )
8576
+ }
8577
+ )
8578
+ ]
8579
+ }
8580
+ ),
8581
+ isSubExpanded && /* @__PURE__ */ jsx("div", { className: "ml-3 mt-0.5 space-y-0.5 border-l border-gray-200 pl-2", children: child.children.map((grandchild) => /* @__PURE__ */ jsx(
8582
+ "button",
8583
+ {
8584
+ onClick: () => handleItemClick(grandchild.path),
8585
+ className: `
8586
+ w-full text-left px-3 py-1 rounded-lg text-sm transition-colors cursor-pointer
8587
+ ${pathname === grandchild.path ? "text-blue-600 font-medium" : "text-gray-500 hover:bg-gray-50 hover:text-gray-900"}
8588
+ `,
8589
+ children: grandchild.label
8590
+ },
8591
+ grandchild.path
8592
+ )) })
8593
+ ] }, child.label);
8594
+ }
8595
+ return /* @__PURE__ */ jsx(
8596
+ "button",
8597
+ {
8598
+ onClick: () => handleItemClick(child.path ?? ""),
8599
+ className: `
8600
+ w-full text-left px-3 py-1.5 rounded-lg text-sm transition-colors cursor-pointer
8601
+ ${pathname === child.path ? "bg-blue-50 text-blue-600 font-medium" : "text-gray-600 hover:bg-gray-50 hover:text-gray-900"}
8602
+ `,
8603
+ children: child.label
8604
+ },
8605
+ childIndex
8606
+ );
8607
+ }) })
8608
+ ] }, item.label)) })
8609
+ ] }, section.title ?? sectionIndex)) })
8610
+ ] })
8611
+ ]
8612
+ }
8613
+ )
8614
+ ] });
8615
+ }
8391
8616
  function useDetailController(params = {}) {
8392
8617
  const { mode: controlledMode, onModeChange } = params;
8393
8618
  const [internalMode, setInternalMode] = useState("read");
@@ -8980,6 +9205,6 @@ function useScrollToTop(containerId) {
8980
9205
  return scrollToTop;
8981
9206
  }
8982
9207
 
8983
- export { Badge, BreadCrumb, Button, Carousel_default as Carousel, Checkbox, DatePicker, DebouncedButton, DetailContent, DetailModalFrame, DetailPageFrame, Empty, ExcelUploader, FilePreviewViewer, FileUploader, Input2 as Input, Loading, LoadingOverlay, Modal, ModalBody, ModalContent, ModalFooter, ModalHeader, ModalIconHeader, ModalOverlay, MultiTabBar as MultiTab, PageFilter, Pagination, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverDescription, PopoverFooter, PopoverHeader, PopoverTitle, PopoverTrigger, Radio, RadioGroup, ScrollArea_default as ScrollArea, ScrollBar, SearchAddress, SearchBar, Select2 as Select, Select as SelectBase, SelectContent, SelectGroup2 as SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SimplePopover, Skeleton, Slider, Spinner, SubmitForm, Switch, Tab, Table, Textarea, ToastProvider, ToggleSwitch, Tooltip2 as Tooltip, Z_INDEX, buildBreadCrumbItems, buttonVariants, cn, confirmModal, findParentMenuItem, findParentMenuName, switchTrackSizes, textVariants, toast, useBlockModalConfirm, useBreadCrumbItems, useCustomBlocker, useDetailController, useModal, useMultiTabStore, useScrollToTop, useToast };
9208
+ export { Badge, BaseUploader, BreadCrumb, Button, Carousel_default as Carousel, Checkbox, DatePicker, DebouncedButton, DetailContent, DetailModalFrame, DetailPageFrame, Empty, ExcelUploader, FilePreviewViewer, FileUploader, Input2 as Input, Loading, LoadingOverlay, Modal, ModalBody, ModalContent, ModalFooter, ModalHeader, ModalIconHeader, ModalOverlay, MultiTabBar as MultiTab, PageFilter, Pagination, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverDescription, PopoverFooter, PopoverHeader, PopoverTitle, PopoverTrigger, Radio, RadioGroup, ScrollArea_default as ScrollArea, ScrollBar, SearchAddress, SearchBar, Select2 as Select, Select as SelectBase, SelectContent, SelectGroup2 as SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Sidebar, SimplePopover, Skeleton, Slider, Spinner, SubmitForm, Switch, Tab, Table, Textarea, ToastProvider, ToggleSwitch, Tooltip2 as Tooltip, Z_INDEX, buildBreadCrumbItems, buttonVariants, cn, confirmModal, findParentMenuItem, findParentMenuName, getFileLabel, switchTrackSizes, textVariants, toast, useBlockModalConfirm, useBreadCrumbItems, useCustomBlocker, useDetailController, useFilePreviewViewer, useModal, useMultiTabStore, useScrollToTop, useToast };
8984
9209
  //# sourceMappingURL=index.js.map
8985
9210
  //# sourceMappingURL=index.js.map