import { cn } from "./index3.js";
import { Badge } from "./index13.js";
import { Avatar } from "./index15.js";
import { Tag } from "./index86.js";
import { TooltipCompound } from "./index391.js";
import { HelpCircle } from "lucide-react";
import * as React from "react";
import { jsx, jsxs } from "react/jsx-runtime";
//#region src/components/molecules/forms/DisplayValue/DisplayValue.tsx
var DisplayValue = React.forwardRef(({ className, label, value, hint, helpIcon = false, helpTooltip, icon, size = "sm", type = "default", rtl = false, leadingText, trailingText, linkHref, avatarProps, avatarSupportingText, badgeProps, badgeLabel, tags, children, ...props }, ref) => {
	const isRTL = rtl;
	const displayPaddingY = size === "md" ? "py-2.5" : "py-2";
	const renderLabel = () => {
		if (!label) return null;
		return /* @__PURE__ */ jsxs("div", {
			className: "flex items-center gap-0.5",
			children: [/* @__PURE__ */ jsx("span", {
				className: "text-sm font-medium leading-5 text-secondary-foreground dark:text-quaternary-foreground",
				children: label
			}), helpIcon && /* @__PURE__ */ jsx(TooltipCompound, {
				trigger: /* @__PURE__ */ jsx("button", {
					type: "button",
					className: "text-muted-foreground hover:text-quaternary-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-full transition-colors duration-200 ease-smooth motion-reduce:transition-none",
					"aria-label": helpTooltip || `Help for ${label}`,
					children: /* @__PURE__ */ jsx(HelpCircle, { className: "size-4" })
				}),
				content: helpTooltip || label
			})]
		});
	};
	const renderHint = () => {
		if (!hint) return null;
		return /* @__PURE__ */ jsx("p", {
			className: "text-sm font-normal leading-5 text-muted-foreground dark:text-muted-foreground w-full",
			children: hint
		});
	};
	const renderContent = () => {
		switch (type) {
			case "icon-leading": return /* @__PURE__ */ jsxs("div", {
				className: "flex items-center gap-2 flex-1 min-w-0",
				children: [icon && /* @__PURE__ */ jsx("span", {
					className: "shrink-0 text-quaternary-foreground [&>svg]:size-5",
					children: icon
				}), /* @__PURE__ */ jsx("span", {
					className: "text-base font-normal leading-6 text-foreground dark:text-foreground truncate",
					children: value ?? children
				})]
			});
			case "leading-text": return /* @__PURE__ */ jsxs("div", {
				className: "flex items-start w-full",
				children: [leadingText && /* @__PURE__ */ jsx("div", {
					className: cn("flex items-center gap-1 overflow-hidden", displayPaddingY),
					children: /* @__PURE__ */ jsx("span", {
						className: "text-base font-normal leading-6 text-secondary-foreground dark:text-quaternary-foreground whitespace-nowrap",
						children: leadingText
					})
				}), /* @__PURE__ */ jsx("div", {
					className: cn("flex-1 flex items-center gap-2 min-w-0", displayPaddingY, "ps-3"),
					children: /* @__PURE__ */ jsx("span", {
						className: "text-base font-normal leading-6 text-foreground dark:text-foreground truncate",
						children: value ?? children
					})
				})]
			});
			case "trailing-text": return /* @__PURE__ */ jsxs("div", {
				className: "flex items-start w-full",
				children: [/* @__PURE__ */ jsx("div", {
					className: cn("flex-1 flex items-center gap-2 min-w-0", displayPaddingY),
					children: /* @__PURE__ */ jsx("span", {
						className: "text-base font-normal leading-6 text-foreground dark:text-foreground truncate",
						children: value ?? children
					})
				}), trailingText && /* @__PURE__ */ jsx("div", {
					className: cn("flex items-center gap-1 overflow-hidden px-3", displayPaddingY),
					children: /* @__PURE__ */ jsx("span", {
						className: "text-base font-normal leading-6 text-secondary-foreground dark:text-quaternary-foreground whitespace-nowrap",
						children: trailingText
					})
				})]
			});
			case "link": return /* @__PURE__ */ jsx("div", {
				className: "flex items-center gap-2 flex-1 min-w-0",
				children: linkHref ? /* @__PURE__ */ jsx("a", {
					href: linkHref,
					className: "text-sm font-normal leading-5 text-primary hover:text-primary dark:text-primary dark:hover:text-primary truncate transition-colors duration-200 ease-smooth motion-reduce:transition-none hover:underline",
					target: "_blank",
					rel: "noopener noreferrer",
					children: value ?? children ?? linkHref
				}) : /* @__PURE__ */ jsx("span", {
					className: "text-sm font-normal leading-5 text-primary dark:text-primary truncate",
					children: value ?? children
				})
			});
			case "tags": return /* @__PURE__ */ jsxs("div", {
				className: "flex items-center gap-1.5 flex-wrap",
				children: [tags?.map((tag, index) => /* @__PURE__ */ jsx(Tag, {
					size: "md",
					avatar: tag.avatar,
					...tag,
					children: tag.label
				}, index)), children]
			});
			case "avatar": return /* @__PURE__ */ jsxs("div", {
				className: "flex items-center gap-2",
				children: [/* @__PURE__ */ jsx(Avatar, {
					size: "lg",
					...avatarProps
				}), /* @__PURE__ */ jsxs("div", {
					className: "flex flex-col",
					children: [/* @__PURE__ */ jsx("span", {
						className: "text-sm font-semibold leading-5 text-foreground dark:text-foreground",
						children: value ?? children ?? avatarProps?.fallback
					}), avatarSupportingText && /* @__PURE__ */ jsx("span", {
						className: "text-sm font-normal leading-5 text-muted-foreground dark:text-muted-foreground",
						children: avatarSupportingText
					})]
				})]
			});
			case "badge": return /* @__PURE__ */ jsx("div", {
				className: "flex items-center gap-2 flex-1 min-w-0",
				children: /* @__PURE__ */ jsx(Badge, {
					variant: "dot",
					color: "success",
					...badgeProps,
					children: badgeLabel ?? value ?? children
				})
			});
			default: return /* @__PURE__ */ jsx("div", {
				className: "flex items-center gap-2 flex-1 min-w-0",
				children: /* @__PURE__ */ jsx("span", {
					className: "text-base font-normal leading-6 text-foreground dark:text-foreground truncate",
					children: value ?? children ?? /* @__PURE__ */ jsx("span", {
						className: "text-muted-foreground dark:text-quaternary-foreground italic",
						children: "—"
					})
				})
			});
		}
	};
	return /* @__PURE__ */ jsxs("div", {
		ref,
		dir: isRTL ? "rtl" : void 0,
		className: cn("flex flex-col gap-1.5", type === "tags" || type === "avatar" || type === "badge" ? "w-[400px]" : "w-[320px]", className),
		...props,
		children: [
			renderLabel(),
			/* @__PURE__ */ jsx("div", {
				className: cn("flex items-center gap-2 w-full rounded-md", type !== "leading-text" && type !== "trailing-text" && displayPaddingY),
				children: renderContent()
			}),
			renderHint()
		]
	});
});
DisplayValue.displayName = "DisplayValue";
//#endregion
export { DisplayValue };

//# sourceMappingURL=index392.js.map