UNPKG

@sikka/hawa

Version:

Modern UI Kit made with Tailwind

1,303 lines (1,279 loc) • 141 kB
"use client"; "use strict"; var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // layout/index.ts var layout_exports = {}; __export(layout_exports, { AppLayout: () => AppLayout, AppTabs: () => AppTabs, AppTopbar: () => AppTopbar, Copyrights: () => Copyrights, DocsLayout: () => DocsLayout, DocsSidebar: () => DocsSidebar, Menubar: () => Menubar, MenubarCheckboxItem: () => MenubarCheckboxItem, MenubarContent: () => MenubarContent, MenubarGroup: () => MenubarGroup, MenubarItem: () => MenubarItem, MenubarLabel: () => MenubarLabel, MenubarMenu: () => MenubarMenu, MenubarPortal: () => MenubarPortal, MenubarRadioGroup: () => MenubarRadioGroup, MenubarRadioItem: () => MenubarRadioItem, MenubarSeparator: () => MenubarSeparator, MenubarShortcut: () => MenubarShortcut, MenubarSub: () => MenubarSub, MenubarSubContent: () => MenubarSubContent, MenubarSubTrigger: () => MenubarSubTrigger, MenubarTrigger: () => MenubarTrigger, Navbar: () => Navbar, SidebarGroup: () => SidebarGroup, SidebarItem: () => SidebarItem, Stats: () => Stats }); module.exports = __toCommonJS(layout_exports); // layout/stats/Stats.tsx var import_react2 = __toESM(require("react")); // util/index.ts var import_clsx = require("clsx"); var import_tailwind_merge = require("tailwind-merge"); function cn(...inputs) { return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs)); } // elements/card/Card.tsx var React = __toESM(require("react")); var Card = React.forwardRef( ({ className, variant = "default", clickable = false, asContainer = false, ...props }, ref) => { let variantStyles = { default: cn( "hawa-rounded-lg hawa-border hawa-bg-card hawa-text-card-foreground hawa-shadow-sm", clickable && "hawa-cursor-pointer hawa-transition-all hover:hawa-drop-shadow-md dark:hover:dark-shadow" ), neoBrutalism: cn( "neo-brutalism", // "hawa-transition-all hawa-uppercase hawa-font-mono dark:hawa-bg-black hawa-font-bold hawa-py-2 hawa-px-4 hawa-rounded hawa-border-2 hawa-border-primary hawa-shadow-color-primary hawa-transition-[hawa-transform_50ms, hawa-box-shadow_50ms] transition-all uppercase font-mono dark:bg-black font-bold py-2 px-4 rounded border-2 border-primary shadow-color-primary transition-[transform_50ms, box-shadow_50ms]", clickable && "hawa-cursor-pointer active:hawa-translate-x-0.5 active:hawa-translate-y-0.5 active:hawa-shadow-color-primary-active active:translate-x-0.5 active:translate-y-0.5 active:shadow-color-primary-active" ) }; return /* @__PURE__ */ React.createElement( "div", { ref, className: cn(className, !asContainer && variantStyles[variant]), ...props } ); } ); var CardHeader = React.forwardRef( ({ className, ...props }, ref) => /* @__PURE__ */ React.createElement("div", { className: "hawa-flex hawa-flex-row hawa-justify-between" }, /* @__PURE__ */ React.createElement( "div", { ref, className: cn( "hawa-flex hawa-flex-col hawa-space-y-1.5 hawa-p-6", className ), ...props } ), props.actions && /* @__PURE__ */ React.createElement("div", { className: "hawa-p-6" }, props.actions)) ); var CardTitle = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React.createElement( "h3", { ref, className: cn("hawa-text-2xl hawa-font-semibold", className), ...props } )); var CardDescription = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React.createElement( "p", { ref, className: cn("hawa-text-sm hawa-text-muted-foreground", className), ...props } )); var CardContent = React.forwardRef( ({ headless, noPadding, className, ...props }, ref) => /* @__PURE__ */ React.createElement( "div", { ref, className: cn( noPadding ? "hawa-p-0" : "hawa-p-6", headless ? "hawa-pt-6" : "hawa-pt-0", className ), ...props } ) ); var CardFooter = React.forwardRef(({ className, noPadding, ...props }, ref) => /* @__PURE__ */ React.createElement( "div", { ref, className: cn( noPadding ? "hawa-p-0" : "hawa-p-6", "hawa-flex hawa-items-center hawa-pt-0", className ), ...props } )); CardDescription.displayName = "CardDescription"; CardContent.displayName = "CardContent"; CardHeader.displayName = "CardHeader"; CardFooter.displayName = "CardFooter"; CardTitle.displayName = "CardTitle"; Card.displayName = "Card"; // elements/skeleton/Skeleton.tsx var import_react = __toESM(require("react")); function Skeleton({ className, content, animation = "pulse", fade, ...props }) { const animationStyles = { none: "hawa-rounded hawa-bg-muted", pulse: "hawa-animate-pulse hawa-rounded hawa-bg-muted", shimmer: "hawa-space-y-5 hawa-rounded hawa-bg-muted hawa-p-4 hawa-relative before:hawa-absolute before:hawa-inset-0 before:hawa--translate-x-full before:hawa-animate-[shimmer_2s_infinite] before:hawa-bg-gradient-to-r before:hawa-from-transparent before:hawa-via-gray-300/40 dark:before:hawa-via-white/10 before:hawa-to-transparent hawa-isolate hawa-overflow-hidden before:hawa-border-t before:hawa-border-rose-100/10" }; const fadeStyle = { bottom: "hawa-mask-fade-bottom", top: "hawa-mask-fade-top", right: "hawa-mask-fade-right", left: "hawa-mask-fade-left " }; return /* @__PURE__ */ import_react.default.createElement( "div", { className: cn( animationStyles[animation], content && "hawa-flex hawa-flex-col hawa-items-center hawa-justify-center", fade && fadeStyle[fade], className ), ...props }, content && content ); } // layout/stats/Stats.tsx var Stats = ({ label, icon, isLoading, number, helperText, helperTextColor = "default", chart, clickable, variant = "default", ...props }) => { let helperTextColorStyles = { default: "", positive: "hawa-text-green-600 dark:hawa-text-green-500", negative: "hawa-text-red-600 dark:hawa-text-red-500", muted: "hawa-text-muted-foreground" }; return /* @__PURE__ */ import_react2.default.createElement(Card, { ...props, clickable }, /* @__PURE__ */ import_react2.default.createElement("div", { className: "hawa-flex hawa-flex-row hawa-items-center hawa-justify-between hawa-p-4 hawa-px-6" }, /* @__PURE__ */ import_react2.default.createElement(CardTitle, { className: "hawa-text-sm hawa-font-medium" }, label), icon && /* @__PURE__ */ import_react2.default.createElement("span", null, icon)), /* @__PURE__ */ import_react2.default.createElement(CardContent, { className: "hawa-transition-all" }, isLoading ? /* @__PURE__ */ import_react2.default.createElement(Skeleton, { className: "hawa-h-8 hawa-w-3/4" }) : /* @__PURE__ */ import_react2.default.createElement("div", { className: "hawa-text-2xl hawa-font-bold" }, number), helperText && /* @__PURE__ */ import_react2.default.createElement( "div", { className: cn( "hawa-my-0 hawa-text-start hawa-text-xs hawa-transition-all", helperTextColorStyles[helperTextColor], helperText ? "hawa-h-4 hawa-opacity-100" : "hawa-h-0 hawa-opacity-0" ) }, isLoading ? /* @__PURE__ */ import_react2.default.createElement(Skeleton, { className: "hawa-mt-2 hawa-h-4 hawa-w-1/2" }) : helperText ), chart && (isLoading ? /* @__PURE__ */ import_react2.default.createElement(Skeleton, { className: "hawa-mt-2 hawa-h-4 hawa-w-1/2" }) : chart))); }; // layout/sidebar/Sidebar.tsx var React5 = __toESM(require("react")); var AccordionPrimitive = __toESM(require("@radix-ui/react-accordion")); // elements/chip/Chip.tsx var import_react3 = __toESM(require("react")); var Chip = import_react3.default.forwardRef( ({ label, size = "normal", icon, color, radius = "inherit", dot, dotStatus = "none", ...rest }, ref) => { let defaultStyles = "hawa-flex hawa-flex-row hawa-w-fit hawa-gap-1 hawa-items-center hawa-px-2.5 hawa-py-1 hawa-font-bold "; let radiusStyles = { inherit: " hawa-rounded", full: "hawa-rounded-full", none: "hawa-rounded-none" }; let sizeStyles = { small: "hawa-h-[15px] hawa-leading-4 hawa-px-0 hawa-py-0 hawa-text-[9px] hawa-gap-0.5 ", normal: "hawa-h-fit hawa-text-xs", large: "hawa-text-base" }; let dotStyles = { small: "hawa-flex hawa-h-1 hawa-w-1 hawa-rounded-full", normal: "hawa-flex hawa-h-2 hawa-w-2 hawa-rounded-full", large: "hawa-flex hawa-h-3 hawa-w-3 hawa-rounded-full" }; let dotStatusStyles = { none: "hawa-bg-gray-500 dark:hawa-bg-gray-800", available: "hawa-bg-green-500", unavailable: "hawa-bg-red-500" }; let colorStyles = { green: "hawa-bg-green-200 hawa-text-green-700 dark:hawa-bg-green-700 dark:hawa-text-green-200", blue: "hawa-bg-blue-200 hawa-text-blue-700 dark:hawa-bg-blue-700 dark:hawa-text-blue-100", red: "hawa-bg-red-200 hawa-text-red-700 dark:hawa-bg-red-700 dark:hawa-text-red-100", yellow: "hawa-bg-yellow-200 hawa-text-yellow-700 dark:hawa-bg-yellow-600 dark:hawa-text-black", orange: "hawa-bg-orange-200 hawa-text-orange-700 dark:hawa-bg-orange-700 dark:hawa-text-orange-100", purple: "hawa-bg-purple-200 hawa-text-purple-700 dark:hawa-bg-purple-700 dark:hawa-text-purple-100", cyan: "hawa-bg-cyan-200 hawa-text-cyan-700 dark:hawa-bg-cyan-700 dark:hawa-text-cyan-100", hyper: "hawa-text-white dark:hawa-text-black hawa-bg-gradient-to-tl hawa-from-pink-500 hawa-via-red-500 hawa-to-yellow-500 ", oceanic: "hawa-text-white dark:hawa-text-black hawa-bg-gradient-to-bl hawa-from-green-300 hawa-via-blue-500 hawa-to-purple-600" }; if (label) { return /* @__PURE__ */ import_react3.default.createElement( "span", { ...rest, ref, className: cn( defaultStyles, sizeStyles[size], radiusStyles[radius], color ? colorStyles[color] : "hawa-border hawa-bg-none", rest.className ) }, dot && /* @__PURE__ */ import_react3.default.createElement( "span", { className: cn(dotStyles[size], dotStatusStyles[dotStatus]) } ), icon && icon, label ); } else { return /* @__PURE__ */ import_react3.default.createElement( "span", { ...rest, ref, className: cn( "hawa-h-2 hawa-w-2 hawa-rounded-full", color ? colorStyles[color] : "hawa-border hawa-bg-none" ) } ); } } ); // layout/sidebar/Sidebar.tsx var Accordion = AccordionPrimitive.Root; var triggerStyles = "hawa-flex hawa-flex-1 hawa-items-center hawa-duration-75 hawa-select-none hawa-cursor-pointer hawa-rounded hawa-justify-between hawa-p-2 hawa-px-3 hawa-font-medium hawa-transition-all [&[data-state=open]>svg]:hawa--rotate-90"; var AccordionItem = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React5.createElement(AccordionPrimitive.Item, { ref, className: cn(className), ...props })); AccordionItem.displayName = "AccordionItem"; var AccordionTrigger = React5.forwardRef(({ className, showArrow, children, ...props }, ref) => /* @__PURE__ */ React5.createElement(AccordionPrimitive.Header, { className: "flex" }, /* @__PURE__ */ React5.createElement( AccordionPrimitive.Trigger, { ref, className: cn(triggerStyles, className), ...props }, children, showArrow && /* @__PURE__ */ React5.createElement( "svg", { "aria-label": "Chevron Right Icon", stroke: "currentColor", fill: "currentColor", viewBox: "0 0 16 16", height: "1em", width: "1em", className: "hawa-icon hawa-shrink-0 hawa-rotate-90 hawa-transition-transform hawa-duration-200" }, /* @__PURE__ */ React5.createElement("path", { d: "M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z" }) ) ))); AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName; var AccordionContent = React5.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ React5.createElement( AccordionPrimitive.Content, { ref, className: cn( "hawa-overflow-hidden hawa-text-sm hawa-transition-all data-[state=closed]:hawa-animate-accordion-up data-[state=open]:hawa-animate-accordion-down", className ), ...props }, /* @__PURE__ */ React5.createElement("div", null, children) )); AccordionContent.displayName = AccordionPrimitive.Content.displayName; var SidebarGroup = ({ title, items, selectedItem, openedItem, setOpenedItem, onItemClick, onSubItemClick, direction, isOpen, ...props }) => { const LinkComponent = props.LinkComponent || "a"; return /* @__PURE__ */ React5.createElement("div", { className: "hawa-m-2" }, title && /* @__PURE__ */ React5.createElement("h3", { className: "hawa-mb-1 hawa-font-bold" }, title), /* @__PURE__ */ React5.createElement("ul", { className: "hawa-flex hawa-flex-col hawa-gap-2" }, /* @__PURE__ */ React5.createElement( Accordion, { value: openedItem, type: "single", onValueChange: (e) => { setOpenedItem(e); }, collapsible: true, className: "hawa-flex hawa-flex-col hawa-gap-1" }, items.map((item, idx) => /* @__PURE__ */ React5.createElement( SidebarItem, { isOpen, selectedItem, key: idx, direction, item, onItemClick, onSubItemClick, LinkComponent } )) ))); }; var SidebarItem = ({ item, onItemClick, onSubItemClick, direction, isOpen = true, LinkComponent, ...props }) => { const getSelectedStyle = (value) => { return props.selectedItem === value ? "hawa-bg-primary/90 hawa-text-primary-foreground hawa-cursor-default" : "hover:hawa-bg-primary/10"; }; if (item.subitems) { return /* @__PURE__ */ React5.createElement( AccordionItem, { value: item.value, className: "hawa-overflow-x-clip", dir: direction }, /* @__PURE__ */ React5.createElement( AccordionTrigger, { className: cn( "hawa-w-full hawa-overflow-x-clip", props.selectedItem === item.value ? "hawa-cursor-default hawa-bg-primary hawa-text-primary-foreground" : "hawa-h-10 hover:hawa-bg-primary/10", item.subitems && item.subitems.some( (subitem) => props.selectedItem === subitem.value ) ? "hawa-bg-primary/80 hawa-text-primary-foreground hover:hawa-bg-primary/80" : "" ), showArrow: isOpen }, /* @__PURE__ */ React5.createElement( "div", { className: cn( "hawa-flex hawa-h-fit hawa-w-fit hawa-flex-row hawa-items-center hawa-gap-2" ) }, item.icon && item.icon, /* @__PURE__ */ React5.createElement( "span", { className: cn( "hawa-transition-all hawa-flex hawa-flex-row hawa-items-center hawa-gap-2 hawa-whitespace-nowrap", isOpen ? "hawa-opacity-100" : "hawa-opacity-0" ) }, item.label, item.badge && /* @__PURE__ */ React5.createElement( Chip, { label: item.badge.label, color: item.badge.color, size: "small" } ) ) ) ), item.subitems && /* @__PURE__ */ React5.createElement(AccordionContent, { className: "hawa-mt-1 hawa-h-full hawa-rounded" }, /* @__PURE__ */ React5.createElement( "div", { className: cn( "hawa-flex hawa-h-full hawa-flex-col hawa-gap-2 hawa-bg-foreground/5 hawa-p-1" ) }, item.subitems.map((subitem, idx) => /* @__PURE__ */ React5.createElement( LinkComponent, { href: subitem.slug, key: idx, onMouseDown: (e) => { if (subitem.onMouseDown) { subitem.onMouseDown(e); } }, onClick: (e) => { e.stopPropagation(); if (subitem.onClick) { subitem.onClick(e); } if (onSubItemClick) { onSubItemClick([item.value, subitem.value]); } }, className: cn( "hawa-flex hawa-h-full hawa-cursor-pointer hawa-flex-row hawa-items-center hawa-gap-2 hawa-overflow-x-clip hawa-whitespace-nowrap hawa-rounded hawa-p-2 hawa-transition-all", // bg-foreground/10 getSelectedStyle(subitem.value) ) }, subitem.icon && subitem.icon, subitem.label, subitem.badge && /* @__PURE__ */ React5.createElement( Chip, { label: subitem.badge.label, color: subitem.badge.color, size: "small" } ) )) )) ); } else { return /* @__PURE__ */ React5.createElement( LinkComponent, { href: item.slug, dir: direction, onMouseDown: (e) => { if (item.onMouseDown) { item.onMouseDown(e); } }, onClick: (e) => { if (item.onClick) { item.onClick(e); } if (onItemClick) { onItemClick([item.value]); } }, className: cn( triggerStyles, getSelectedStyle(item.value), "hawa-overflow-x-clip" ) }, /* @__PURE__ */ React5.createElement("div", { className: "hawa-flex hawa-flex-row hawa-items-center hawa-gap-2" }, item.icon && item.icon, /* @__PURE__ */ React5.createElement( "span", { className: cn( "hawa-flex hawa-flex-row hawa-items-center hawa-gap-2 hawa-whitespace-nowrap hawa-transition-all", isOpen ? "hawa-opacity-100" : "hawa-opacity-0" ) }, item.label, " ", item.badge && /* @__PURE__ */ React5.createElement( Chip, { label: item.badge.label, color: item.badge.color, size: "small" } ) )) ); } }; // layout/copyrights/Copyrights.tsx var import_react4 = __toESM(require("react")); var Copyrights = (props) => { return /* @__PURE__ */ import_react4.default.createElement("div", { className: "hawa-my-2 hawa-flex hawa-flex-col hawa-items-center hawa-justify-center hawa-gap-1 hawa-text-xs hawa-text-gray-400" }, props.withLogo ? /* @__PURE__ */ import_react4.default.createElement("a", { href: props.onLogoClicked }, /* @__PURE__ */ import_react4.default.createElement("div", { className: "hawa-cursor-pointer" }, /* @__PURE__ */ import_react4.default.createElement("image", { href: props.logoURL, width: 100, height: 50 }))) : null, /* @__PURE__ */ import_react4.default.createElement("div", null, props.version), props.credits ? props.credits : null); }; // layout/navbar/Navbar.tsx var import_react5 = __toESM(require("react")); // elements/collapsible/Collapsible.tsx var CollapsiblePrimitive = __toESM(require("@radix-ui/react-collapsible")); var Collapsible = CollapsiblePrimitive.Root; var CollapsibleTrigger2 = CollapsiblePrimitive.CollapsibleTrigger; var CollapsibleContent2 = CollapsiblePrimitive.CollapsibleContent; // layout/navbar/Navbar.tsx var Navbar = ({ backgroundColor, logo, handleLogoClick, ...props }) => { var _a, _b; const [isOpen, setIsOpen] = (0, import_react5.useState)(false); return /* @__PURE__ */ import_react5.default.createElement("nav", { className: "hawa-sticky hawa-top-2 hawa-transition-all" }, /* @__PURE__ */ import_react5.default.createElement( Collapsible, { className: "hawa-relative hawa-m-2 hawa-rounded hawa-p-2", style: { backgroundColor: backgroundColor || "#1f2937" } }, /* @__PURE__ */ import_react5.default.createElement("div", { className: "hawa-flex hawa-items-center hawa-justify-between hawa-px-3" }, /* @__PURE__ */ import_react5.default.createElement("div", { className: "hawa-flex hawa-items-center" }, /* @__PURE__ */ import_react5.default.createElement( "div", { className: "hawa-p-1.5 hawa-text-xl hawa-font-bold hawa-text-white", onClick: () => { if (handleLogoClick) { handleLogoClick(); } } }, logo )), /* @__PURE__ */ import_react5.default.createElement("div", { className: "hawa-hidden md:hawa-flex" }, (_a = props.menuItems) == null ? void 0 : _a.map((item, i) => /* @__PURE__ */ import_react5.default.createElement( "div", { key: i, onClick: item.action, className: "hawa-cursor-pointer hawa-rounded hawa-p-1.5 hawa-px-2 hawa-text-center hawa-text-sm hawa-text-white hawa-transition-all hover:hawa-bg-gray-300 hover:hawa-text-black" }, item.label ))), /* @__PURE__ */ import_react5.default.createElement("div", { className: "hawa-m-0 hawa-flex hawa-h-fit hawa-p-0 md:hawa-hidden" }, /* @__PURE__ */ import_react5.default.createElement( CollapsibleTrigger2, { onClick: () => setIsOpen(!isOpen), className: "hawa-h-full hawa-text-white selection:hawa-p-0", "aria-label": "Toggle menu" }, /* @__PURE__ */ import_react5.default.createElement( "svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: cn( "hawa-fixed hawa-h-6 hawa-w-6", isOpen ? "hawa-invisible" : "hawa-visible" ) }, /* @__PURE__ */ import_react5.default.createElement("line", { x1: "4", x2: "20", y1: "12", y2: "12" }), /* @__PURE__ */ import_react5.default.createElement("line", { x1: "4", x2: "20", y1: "6", y2: "6" }), /* @__PURE__ */ import_react5.default.createElement("line", { x1: "4", x2: "20", y1: "18", y2: "18" }) ), /* @__PURE__ */ import_react5.default.createElement( "svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: cn( "hawa-h-6 hawa-w-6", !isOpen ? "hawa-invisible" : "hawa-visible" ) }, /* @__PURE__ */ import_react5.default.createElement("path", { d: "M18 6 6 18" }), /* @__PURE__ */ import_react5.default.createElement("path", { d: "m6 6 12 12" }) ) ))), /* @__PURE__ */ import_react5.default.createElement( CollapsibleContent2, { className: cn( "data-[state=closed]:hawa-opacity-0", "data-[state=open]:hawa-animate-in", "data-[state=open]:hawa-fade-in-90", "hawa-absolute hawa-left-0 hawa-top-[60px] hawa-flex hawa-flex-col hawa-rounded hawa-border hawa-bg-gray-200 hawa-p-1 hawa-transition-all" // "hawa-transition-all hawa-bg-gray-400 hawa-fixed hawa-left-0 hawa-top-[72px] hawa-w-full hawa-flex hawa-flex-col" ), style: { width: "calc(100%)", zIndex: -100 } }, (_b = props.menuItems) == null ? void 0 : _b.map((item, i) => /* @__PURE__ */ import_react5.default.createElement( "div", { key: i, onClick: item.action, className: "hawa-cursor-pointer hawa-rounded hawa-p-2 hawa-px-10 hawa-text-center hawa-text-black hawa-transition-all hover:hawa-bg-gray-300" }, item.label )) ) )); }; // layout/appLayout/AppLayout.tsx var import_react14 = __toESM(require("react")); // hooks/useClickOutside.ts var import_react6 = require("react"); var DEFAULT_EVENTS = ["mousedown", "touchstart"]; function useClickOutside(handler, events, nodes) { const ref = (0, import_react6.useRef)(); (0, import_react6.useEffect)(() => { const listener = (event) => { const { target } = event != null ? event : {}; if (Array.isArray(nodes)) { const shouldIgnore = (target == null ? void 0 : target.hasAttribute("data-ignore-outside-clicks")) || !document.body.contains(target) && target.tagName !== "HTML"; const shouldTrigger = nodes.every( (node) => !!node && !event.composedPath().includes(node) ); shouldTrigger && !shouldIgnore && handler(); } else if (ref.current && !ref.current.contains(target)) { handler(); } }; (events || DEFAULT_EVENTS).forEach( (fn) => document.addEventListener(fn, listener) ); return () => { (events || DEFAULT_EVENTS).forEach( (fn) => document.removeEventListener(fn, listener) ); }; }, [ref, handler, nodes]); return ref; } // layout/appLayout/AppLayout.tsx var Dialog = __toESM(require("@radix-ui/react-dialog")); // elements/button/Button.tsx var React12 = __toESM(require("react")); var import_class_variance_authority = require("class-variance-authority"); // elements/helperText/HelperText.tsx var import_react7 = __toESM(require("react")); var HelperText = ({ helperText }) => /* @__PURE__ */ import_react7.default.createElement( "p", { className: cn( "hawa-my-0 hawa-text-start hawa-text-xs hawa-text-helper-color hawa-transition-all", helperText ? "hawa-h-4 hawa-opacity-100" : "hawa-h-0 hawa-opacity-0" ) }, helperText ); // elements/label/Label.tsx var React10 = __toESM(require("react")); // elements/tooltip/Tooltip.tsx var import_react8 = __toESM(require("react")); var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip")); var TooltipContent = import_react8.default.forwardRef(({ className, sideOffset = 4, size = "default", ...props }, ref) => /* @__PURE__ */ import_react8.default.createElement( TooltipPrimitive.Content, { ref, sideOffset, className: cn( "hawa-z-50 hawa-overflow-hidden hawa-rounded-md hawa-border hawa-bg-popover hawa-px-3 hawa-py-1.5 hawa-text-sm hawa-text-popover-foreground hawa-shadow-md hawa-animate-in hawa-fade-in-0 hawa-zoom-in-95 data-[state=closed]:hawa-animate-out data-[state=closed]:hawa-fade-out-0 data-[state=closed]:hawa-zoom-out-95 data-[side=bottom]:hawa-slide-in-from-top-2 data-[side=left]:hawa-slide-in-from-right-2 data-[side=right]:hawa-slide-in-from-left-2 data-[side=top]:hawa-slide-in-from-bottom-2", { "hawa-text-xs": size === "small", "hawa-text-xl": size === "large" }, className ), ...props } )); TooltipContent.displayName = TooltipPrimitive.Content.displayName; var TooltipArrow = import_react8.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ import_react8.default.createElement(TooltipPrimitive.Arrow, { ref, className: cn(className), ...props })); TooltipArrow.displayName = TooltipPrimitive.Arrow.displayName; var Tooltip = ({ side, size, open, content, children, disabled, defaultOpen, onOpenChange, triggerProps, contentProps, providerProps, delayDuration = 300, ...props }) => { return /* @__PURE__ */ import_react8.default.createElement( TooltipPrimitive.TooltipProvider, { delayDuration, ...providerProps }, /* @__PURE__ */ import_react8.default.createElement( TooltipPrimitive.Root, { open: !disabled && open, defaultOpen, onOpenChange, ...props }, /* @__PURE__ */ import_react8.default.createElement(TooltipPrimitive.Trigger, { ...triggerProps }, children), /* @__PURE__ */ import_react8.default.createElement( TooltipContent, { size, side, align: "center", ...contentProps, style: { ...contentProps == null ? void 0 : contentProps.style, maxWidth: "var(--radix-tooltip-content-available-width)", maxHeight: "var(--radix-tooltip-content-available-height)" } }, content ) ) ); }; // elements/label/Label.tsx var Label = React10.forwardRef(({ className, hint, hintSide, required, children, ...props }, ref) => /* @__PURE__ */ React10.createElement("div", { className: "hawa-flex hawa-flex-row hawa-items-center hawa-gap-1 hawa-transition-all" }, /* @__PURE__ */ React10.createElement( "label", { ref, className: cn( "hawa-text-sm hawa-font-medium hawa-leading-none peer-disabled:hawa-cursor-not-allowed peer-disabled:hawa-opacity-70", className ), ...props }, children, required && /* @__PURE__ */ React10.createElement("span", { className: "hawa-mx-0.5 hawa-text-red-500" }, "*") ), hint && /* @__PURE__ */ React10.createElement( Tooltip, { content: hint, side: hintSide, triggerProps: { tabIndex: -1, onClick: (event) => event.preventDefault() } }, /* @__PURE__ */ React10.createElement("div", null, /* @__PURE__ */ React10.createElement( "svg", { xmlns: "http://www.w3.org/2000/svg", className: "hawa-h-[14px] hawa-w-[14px] hawa-cursor-help", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ React10.createElement("circle", { cx: "12", cy: "12", r: "10" }), /* @__PURE__ */ React10.createElement("path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" }), /* @__PURE__ */ React10.createElement("path", { d: "M12 17h.01" }) )) ))); Label.displayName = "Label"; // elements/loading/Loading.tsx var import_react9 = __toESM(require("react")); var Loading = ({ design = "spinner", size = "normal", themeMode = "light", classNames, color, ...props }) => { let sizeStyles = { button: "hawa-h-4 hawa-w-4", xs: "hawa-h-1 hawa-w-1", sm: "hawa-h-6 hawa-w-6", normal: "hawa-h-8 hawa-w-8", lg: "hawa-h-14 hawa-w-14", xl: "hawa-h-24 hawa-w-24" }; let progressSizes = { button: "hawa-h-1", xs: "hawa-h-1 hawa-w-1", sm: "hawa-h-6 hawa-w-6", normal: "", lg: "hawa-h-6", xl: "hawa-h-10 hawa-w-64" }; let animationStyles = { pulse: "hawa-animate-in hawa-fade-in hawa-duration-1000", bounce: "hawa-animate-bounce" }; switch (design.split("-")[0]) { case "dots": return /* @__PURE__ */ import_react9.default.createElement( "div", { className: cn( "hawa-flex hawa-flex-row hawa-gap-2", classNames == null ? void 0 : classNames.container ) }, /* @__PURE__ */ import_react9.default.createElement( "div", { className: cn( "hawa-animate-bounce hawa-rounded-full hawa-delay-100 hawa-repeat-infinite", size === "button" ? "hawa-h-2 hawa-w-2" : sizeStyles[size], animationStyles[design.split("-")[1]], color ? color : "hawa-bg-primary" ) } ), /* @__PURE__ */ import_react9.default.createElement( "div", { className: cn( "hawa-animate-bounce hawa-rounded-full hawa-delay-200 hawa-repeat-infinite", size === "button" ? "hawa-h-2 hawa-w-2" : sizeStyles[size], animationStyles[design.split("-")[1]], color ? color : "hawa-bg-primary" ) } ), /* @__PURE__ */ import_react9.default.createElement( "div", { className: cn( "hawa-animate-bounce hawa-rounded-full hawa-delay-300 hawa-repeat-infinite", size === "button" ? "hawa-h-2 hawa-w-2" : sizeStyles[size], animationStyles[design.split("-")[1]], color ? color : "hawa-bg-primary" ) } ) ); case "square": return /* @__PURE__ */ import_react9.default.createElement( "svg", { className: cn( "squircle-container", sizeStyles[size], classNames == null ? void 0 : classNames.container ), viewBox: "0 0 35 35", height: "35", width: "35" }, /* @__PURE__ */ import_react9.default.createElement( "rect", { className: "squircle-track", x: "2.5", y: "2.5", fill: "none", strokeWidth: "5px", width: "32.5", height: "32.5" } ), /* @__PURE__ */ import_react9.default.createElement( "rect", { className: "square-car", x: "2.5", y: "2.5", fill: "none", strokeWidth: "5px", width: "32.5", height: "32.5", pathLength: "100" } ) ); case "squircle": return /* @__PURE__ */ import_react9.default.createElement( "svg", { x: "0px", y: "0px", viewBox: "0 0 37 37", height: "37", width: "37", preserveAspectRatio: "xMidYMid meet", className: cn( "squircle-container", sizeStyles[size], classNames == null ? void 0 : classNames.container ) }, /* @__PURE__ */ import_react9.default.createElement( "path", { className: cn("squircle-track", classNames == null ? void 0 : classNames.track), fill: "none", strokeWidth: "5", pathLength: "100", d: "M0.37 18.5 C0.37 5.772 5.772 0.37 18.5 0.37 S36.63 5.772 36.63 18.5 S31.228 36.63 18.5 36.63 S0.37 31.228 0.37 18.5" } ), /* @__PURE__ */ import_react9.default.createElement( "path", { className: cn("squircle-car", classNames == null ? void 0 : classNames.car), fill: "none", strokeWidth: "5", pathLength: "100", d: "M0.37 18.5 C0.37 5.772 5.772 0.37 18.5 0.37 S36.63 5.772 36.63 18.5 S31.228 36.63 18.5 36.63 S0.37 31.228 0.37 18.5" } ) ); case "progress": return /* @__PURE__ */ import_react9.default.createElement( "div", { className: cn( "progress-loading after:hawa-rounded hawa-rounded", progressSizes[size], classNames == null ? void 0 : classNames.container ) } ); case "orbit": return /* @__PURE__ */ import_react9.default.createElement("div", { className: cn("orbit-container", classNames == null ? void 0 : classNames.container) }); default: return /* @__PURE__ */ import_react9.default.createElement( "svg", { viewBox: "0 0 40 40", height: "40", width: "40", className: cn( "circle-container", sizeStyles[size], classNames == null ? void 0 : classNames.container ) }, /* @__PURE__ */ import_react9.default.createElement( "circle", { className: cn( "circle-track", { "hawa-stroke-primary-foreground": themeMode === "dark", "hawa-stroke-primary": themeMode === "light" }, classNames == null ? void 0 : classNames.track ), cx: "20", cy: "20", r: "17.5", fill: "none", strokeWidth: "5px", pathLength: "100" } ), /* @__PURE__ */ import_react9.default.createElement( "circle", { className: cn( "circle-car", { "hawa-stroke-primary-foreground": themeMode === "dark", "hawa-stroke-primary": themeMode === "light" }, classNames == null ? void 0 : classNames.car ), cx: "20", cy: "20", r: "17.5", fill: "none", pathLength: "100", strokeWidth: "5px" } ) ); } }; // elements/button/Button.tsx var buttonVariants = (0, import_class_variance_authority.cva)( "hawa-inline-flex hawa-items-center hawa-select-none hawa-rounded-md hawa-text-sm hawa-font-medium hawa-ring-offset-background hawa-transition-colors focus-visible:hawa-outline-none focus-visible:hawa-ring-2 focus-visible:hawa-ring-ring focus-visible:hawa-ring-offset-2 disabled:hawa-pointer-events-none disabled:hawa-opacity-50", { variants: { variant: { default: "hawa-bg-primary hawa-text-primary-foreground hover:hawa-bg-primary/90", light: "hawa-bg-primary/20 hawa-text-primary hover:hawa-bg-primary/40", destructive: "hawa-bg-destructive hawa-text-destructive-foreground hover:hawa-bg-destructive/90", outline: "hawa-border hawa-border-input hawa-bg-transparent hover:hawa-bg-accent hover:hawa-text-accent-foreground", secondary: "hawa-bg-secondary hawa-text-secondary-foreground hover:hawa-bg-secondary/80", ghost: "hover:hawa-bg-accent hover:hawa-text-accent-foreground", link: "hawa-text-primary hawa-underline-offset-4 hover:hawa-underline", combobox: "hawa-bg-background hawa-border", neoBrutalism: "neo-brutalism" // "hawa-cursor-pointer hawa-transition-all hawa-uppercase hawa-font-mono dark:hawa-bg-black hawa-font-bold hawa-py-2 hawa-px-4 hawa-rounded hawa-border-2 hawa-border-primary hawa-shadow-color-primary hawa-transition-[hawa-transform_50ms, hawa-box-shadow_50ms] active:hawa-translate-x-0.5 active:hawa-translate-y-0.5 active:hawa-shadow-color-primary-active shadow-color-primary active:shadow-color-primary-active", }, size: { default: "hawa-h-10 hawa-px-4 hawa-py-2", heightless: "hawa-px-4 hawa-py-4", xs: "hawa-h-fit hawa-min-h-[25px] hawa-py-1 hawa-text-[10px] hawa-px-2 ", sm: "hawa-h-9 hawa-text-[11px] hawa-rounded-md hawa-px-3", lg: "hawa-h-11 hawa-rounded-md hawa-px-8", xl: "hawa-h-14 hawa-rounded-md hawa-px-10", icon: "hawa-h-10 hawa-w-10", smallIcon: "hawa-h-7 hawa-w-7" } }, defaultVariants: { variant: "default", size: "default" } } ); var Button = React12.forwardRef( ({ className, label, variant, size, asChild = false, centered = true, isLoading, children, labelProps, showHelperText = false, asInput = false, ...props }, ref) => { const Comp = "button"; const loadingColor = variant === "outline" || variant === "ghost" || variant === "neoBrutalism" ? "hawa-bg-primary" : "hawa-bg-primary-foreground"; if (asInput) { return /* @__PURE__ */ React12.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-2" }, label && /* @__PURE__ */ React12.createElement(Label, { ...labelProps }, label), /* @__PURE__ */ React12.createElement( Comp, { className: cn( buttonVariants({ variant, size, className }), centered && "hawa-justify-center" ), ref, ...props }, isLoading ? /* @__PURE__ */ React12.createElement( Loading, { design: size === "icon" || size === "smallIcon" ? "spinner" : "dots-pulse", themeMode: variant === "outline" ? "light" : "dark", color: loadingColor, size: size === "sm" || size === "xs" ? "xs" : "button" } ) : children ), showHelperText && /* @__PURE__ */ React12.createElement(HelperText, { helperText: props.helperText })); } else { return /* @__PURE__ */ React12.createElement( Comp, { className: cn( buttonVariants({ variant, size, className }), centered && "hawa-justify-center" ), ref, ...props }, isLoading ? /* @__PURE__ */ React12.createElement( Loading, { design: size === "icon" || size === "smallIcon" ? "spinner" : "dots-pulse", themeMode: variant === "outline" ? "light" : "dark", color: loadingColor, size: size === "sm" || size === "xs" ? "xs" : "button" } ) : children ); } } ); Button.displayName = "Button"; // elements/dropdownMenu/DropdownMenu.tsx var React13 = __toESM(require("react")); var import_react10 = require("@headlessui/react"); var DropdownMenuPrimitive = __toESM(require("@radix-ui/react-dropdown-menu")); var DropdownMenuRoot = DropdownMenuPrimitive.Root; var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger; var DropdownMenuSub = DropdownMenuPrimitive.Sub; var DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup; var DropdownMenuSubTrigger = React13.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ React13.createElement( DropdownMenuPrimitive.SubTrigger, { ref, className: cn( "hawa-flex hawa-cursor-default hawa-select-none hawa-items-center hawa-justify-between hawa-rounded-sm hawa-text-sm hawa-outline-none focus:hawa-bg-accent data-[state=open]:hawa-bg-accent", inset && "hawa-pl-8", className ), ...props }, /* @__PURE__ */ React13.createElement("div", { className: "hawa-flex hawa-flex-row hawa-items-center hawa-gap-2" }, children), " ", /* @__PURE__ */ React13.createElement( "svg", { "aria-label": "Chevron Right Icon", stroke: "currentColor", fill: "currentColor", strokeWidth: "0", viewBox: "0 0 16 16", height: "1em", width: "1em", className: cn(props.dir === "rtl" ? "hawa-rotate-180" : "") }, /* @__PURE__ */ React13.createElement( "path", { fillRule: "evenodd", d: "M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z" } ) ) )); DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName; var DropdownMenuSubContent = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React13.createElement( DropdownMenuPrimitive.SubContent, { ref, className: cn( "hawa-z-50 hawa-min-w-[8rem] hawa-gap-1 hawa-overflow-hidden hawa-rounded-md hawa-border hawa-bg-popover hawa-p-1 hawa-text-popover-foreground hawa-shadow-lg data-[state=open]:hawa-animate-in data-[state=closed]:hawa-animate-out data-[state=closed]:hawa-fade-out-0 data-[state=open]:hawa-fade-in-0 data-[state=closed]:hawa-zoom-out-95 data-[state=open]:hawa-zoom-in-95 data-[side=bottom]:hawa-slide-in-from-top-2 data-[side=left]:hawa-slide-in-from-right-2 data-[side=right]:hawa-slide-in-from-left-2 data-[side=top]:hawa-slide-in-from-bottom-2", className ), ...props } )); DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName; var DropdownMenuContent = React13.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ React13.createElement(import_react10.Portal, null, /* @__PURE__ */ React13.createElement( DropdownMenuPrimitive.Content, { ref, sideOffset, className: cn( "hawa-z-50 hawa-overflow-hidden hawa-rounded-md hawa-border hawa-bg-popover hawa-p-1 hawa-text-popover-foreground hawa-shadow-md data-[state=open]:hawa-animate-in data-[state=closed]:hawa-animate-out data-[state=closed]:hawa-fade-out-0 data-[state=open]:hawa-fade-in-0 data-[state=closed]:hawa-zoom-out-95 data-[state=open]:hawa-zoom-in-95 data-[side=bottom]:hawa-slide-in-from-top-2 data-[side=left]:hawa-slide-in-from-right-2 data-[side=right]:hawa-slide-in-from-left-2 data-[side=top]:hawa-slide-in-from-bottom-2", className ), ...props } ))); DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName; var DropdownMenuItem = React13.forwardRef(({ className, inset, badged, slug, LinkComponent = "a", ...props }, ref) => { return /* @__PURE__ */ React13.createElement(LinkComponent, { href: slug }, /* @__PURE__ */ React13.createElement( DropdownMenuPrimitive.Item, { disabled: props.disabled, ref, className: cn( "hawa-relative hawa-flex hawa-cursor-pointer hawa-select-none hawa-items-center hawa-justify-between hawa-rounded-sm hawa-text-sm hawa-outline-none hawa-transition-colors focus:hawa-text-accent-foreground data-[disabled]:hawa-pointer-events-none data-[disabled]:hawa-opacity-50", inset && "hawa-pl-8", props.end && Array.isArray(props.children) && props.children[1] && "hawa-gap-6", className ), ...props }, /* @__PURE__ */ React13.createElement("div", { className: "hawa-flex hawa-flex-row hawa-items-center hawa-gap-2" }, props.children), props.end && props.end, !props.end && props.shortcut && /* @__PURE__ */ React13.createElement(DropdownMenuShortcut, null, props.shortcut), !props.end && badged && /* @__PURE__ */ React13.createElement("div", { className: "hawa-h-3 hawa-w-3 hawa-rounded-full hawa-bg-red-500" }) )); }); DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName; var DropdownMenuCheckboxItem = React13.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ React13.createElement( DropdownMenuPrimitive.CheckboxItem, { ref, className: cn( "hawa-relative hawa-flex hawa-cursor-default hawa-select-none hawa-items-center hawa-rounded-sm hawa-py-1.5 hawa-pl-8 hawa-pr-2 hawa-text-sm hawa-outline-none hawa-transition-colors focus:hawa-bg-accent focus:hawa-text-accent-foreground data-[disabled]:hawa-pointer-events-none data-[disabled]:hawa-opacity-50", className ), checked, ...props }, /* @__PURE__ */ React13.createElement("span", { className: "hawa-absolute hawa-left-2 hawa-flex hawa-h-3.5 hawa-w-3.5 hawa-items-center hawa-justify-center" }, /* @__PURE__ */ React13.createElement(DropdownMenuPrimitive.ItemIndicator, null, /* @__PURE__ */ React13.createElement( "svg", { "aria-label": "Check Mark", stroke: "currentColor", fill: "currentColor", strokeWidth: "0", viewBox: "0 0 512 512", height: "0.60em", width: "0.60em" }, /* @__PURE__ */ React13.createElement("path", { d: "M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z" }) ), " ")), children )); DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName; var DropdownMenuRadioItem = React13.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ React13.createElement( DropdownMenuPrimitive.RadioItem, { ref, className: cn( "hawa-relative hawa-flex hawa-cursor-pointer hawa-select-none hawa-items-center hawa-rounded-sm hawa-py-1.5 hawa-pl-8 hawa-pr-2 hawa-text-sm hawa-outline-none hawa-transition-colors focus:hawa-bg-accent focus:hawa-text-accent-foreground data-[disabled]:hawa-pointer-events-none data-[disabled]:hawa-opacity-50", className ), ...props }, /* @__PURE__ */ React13.createElement("span", { className: "hawa-absolute hawa-left-2 hawa-flex hawa-h-3.5 hawa-w-3.5 hawa-items-center hawa-justify-center" }, /* @__PURE__ */ React13.createElement(DropdownMenuPrimitive.ItemIndicator, null, /* @__PURE__ */ React13.createElement( "svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", "aria-label": "Circle", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "hawa-h-2 hawa-w-2 hawa-fill-current" }, /* @__PURE__ */ React13.createElement("circle", { cx: "1