import { vt as __exportAll } from "./PortalTenantClientProvider-BmRtQAbi.mjs";
import { c as useScreenRenderer, t as ScreenRenderer, u as useRegistry } from "./ScreenRenderer-TobkTBMC.mjs";
import { f as getGapField, i as getBorderColorField, l as getColorField, m as getPaddingField, n as borderWidthClasses, o as getBorderRadiusField, r as gapValues, s as getBorderWidthField, t as borderColorClasses, u as getFontSizeField } from "./registries-59Barbhg.mjs";
import { jsx, jsxs } from "react/jsx-runtime";
//#region ../widgets/src/widgets/CardWidget.tsx
var CardWidget_exports = /* @__PURE__ */ __exportAll({
	CardWidget: () => CardWidget,
	cardWidgetPropertySchema: () => cardWidgetPropertySchema
});
const DEFAULT_BACKGROUND = {
	type: "solid",
	color: "background"
};
const DEFAULT_CHILDREN = [];
function CardWidget({ headerEnabled = true, title = "Card Title", titleFontSize = "lg", titleColor = "foreground", headerBackground = "transparent", footerEnabled = false, footerContent = "", footerColor = "muted", footerBackground = "transparent", background = DEFAULT_BACKGROUND, padding = 6, borderRadius = "xl", borderWidth = "thin", borderColor = "muted", borderEnabled, gapSize = "md", children = DEFAULT_CHILDREN, className = "" }) {
	const contextRegistry = useRegistry();
	const ScreenRenderer$1 = useScreenRenderer() ?? ScreenRenderer;
	const backgroundColor = background.color || "background";
	const backgroundImage = (background.resource?.image_url || background.resource?.imageUrl) && background.type === "image" ? `url(${background.resource.image_url || background.resource.imageUrl})` : "none";
	const gapSizeValue = gapSize ? gapValues[gapSize] : 4;
	const effectiveBorderWidth = borderEnabled === false ? "none" : borderWidth;
	const cardClasses = [
		"flex flex-col gap-6",
		`bg-${backgroundColor}`,
		`p-${padding}`,
		`rounded-${borderRadius}`,
		borderWidthClasses[effectiveBorderWidth],
		effectiveBorderWidth !== "none" ? borderColorClasses[borderColor] : "",
		className
	].filter(Boolean).join(" ");
	const containerStyle = { backgroundImage };
	const validChildren = children.filter((child) => child !== null);
	return /* @__PURE__ */ jsxs("div", {
		"data-slot": "card",
		className: cardClasses,
		style: containerStyle,
		children: [
			headerEnabled && (title || headerBackground !== "transparent") && /* @__PURE__ */ jsx("div", {
				"data-slot": "card-header",
				className: headerBackground !== "transparent" ? `bg-${headerBackground} -mx-${padding} -mt-${padding} px-${padding} py-${padding} rounded-t-${borderRadius}` : void 0,
				children: title && /* @__PURE__ */ jsx("div", {
					"data-slot": "card-title",
					className: `text-${titleFontSize} text-${titleColor} font-header leading-none font-semibold`,
					children: title
				})
			}),
			/* @__PURE__ */ jsx("div", {
				"data-slot": "card-content",
				className: "@container flex-1",
				children: contextRegistry ? /* @__PURE__ */ jsx(ScreenRenderer$1, {
					screen: validChildren,
					registry: contextRegistry,
					className: `flex flex-col gap-${gapSizeValue}`
				}) : /* @__PURE__ */ jsx("div", { className: `flex flex-col gap-${gapSizeValue}` })
			}),
			footerEnabled && footerContent && /* @__PURE__ */ jsx("div", {
				"data-slot": "card-footer",
				className: [`text-sm text-${footerColor} flex items-center`, footerBackground !== "transparent" ? `bg-${footerBackground} -mx-${padding} -mb-${padding} px-${padding} py-${padding} rounded-b-${borderRadius}` : ""].filter(Boolean).join(" "),
				children: footerContent
			})
		]
	});
}
const cardWidgetPropertySchema = {
	widgetType: "CardWidget",
	displayName: "Card",
	fields: [
		{
			key: "headerEnabled",
			label: "Show Header",
			type: "boolean",
			description: "Toggle header visibility",
			defaultValue: true,
			group: "Header"
		},
		{
			key: "title",
			label: "Title",
			type: "text",
			description: "Card title text",
			defaultValue: "Card Title",
			group: "Header",
			requiresKeyToBeTrue: "headerEnabled"
		},
		getFontSizeField({
			key: "titleFontSize",
			label: "Title Font Size",
			description: "Font size for the title",
			defaultValue: "lg",
			group: "Header",
			requiresKeyToBeTrue: "headerEnabled"
		}),
		getColorField({
			key: "titleColor",
			label: "Title Color",
			description: "Color for the title",
			defaultValue: "foreground",
			group: "Header",
			requiresKeyToBeTrue: "headerEnabled"
		}),
		getColorField({
			key: "headerBackground",
			label: "Header Background",
			description: "Background color for the header",
			defaultValue: "transparent",
			group: "Header",
			requiresKeyToBeTrue: "headerEnabled"
		}),
		{
			key: "footerEnabled",
			label: "Show Footer",
			type: "boolean",
			description: "Toggle footer visibility",
			defaultValue: false,
			group: "Footer"
		},
		{
			key: "footerContent",
			label: "Footer Text",
			type: "text",
			description: "Footer content text",
			defaultValue: "",
			group: "Footer",
			requiresKeyToBeTrue: "footerEnabled"
		},
		getColorField({
			key: "footerColor",
			label: "Footer Color",
			description: "Color for the footer text",
			defaultValue: "muted",
			group: "Footer",
			requiresKeyToBeTrue: "footerEnabled"
		}),
		getColorField({
			key: "footerBackground",
			label: "Footer Background",
			description: "Background color for the footer",
			defaultValue: "transparent",
			group: "Footer",
			requiresKeyToBeTrue: "footerEnabled"
		}),
		{
			type: "background",
			key: "background",
			label: "Background",
			description: "Background for the card",
			defaultValue: "background",
			group: "Design"
		},
		getPaddingField({
			key: "padding",
			label: "Padding",
			description: "Card padding",
			defaultValue: 6,
			group: "Design"
		}),
		getBorderRadiusField({
			key: "borderRadius",
			label: "Border Radius",
			description: "Card border radius",
			defaultValue: "xl",
			group: "Design"
		}),
		getBorderWidthField({
			key: "borderWidth",
			label: "Border Width",
			description: "Card border width",
			defaultValue: "thin",
			group: "Design"
		}),
		getBorderColorField({
			key: "borderColor",
			label: "Border Color",
			description: "Card border color",
			defaultValue: "muted",
			group: "Design"
		}),
		getGapField({
			key: "gapSize",
			label: "Gap",
			description: "Gap between child widgets",
			defaultValue: "md",
			group: "Design"
		})
	]
};
//#endregion
export { CardWidget_exports as n, cardWidgetPropertySchema as r, CardWidget as t };

//# sourceMappingURL=CardWidget-ChfurL_z.mjs.map