/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-1fc5ad1 | Cube Dev Team */
import { extractStyles } from "../../tasty/utils/styles.js";
import { CONTAINER_STYLES, TEXT_STYLES } from "../../tasty/styles/list.js";
import { tasty } from "../../tasty/tasty.js";
import { filterBaseProps } from "../../tasty/utils/filter-base-props.js";
import { useSlotProps } from "../../utils/react/Slots.js";
import { TEXT_PROP_MAP } from "./Text.js";
import { forwardRef } from "react";
import { jsx } from "react/jsx-runtime";

//#region src/components/content/Title.tsx
const STYLE_LIST = [...TEXT_STYLES, ...CONTAINER_STYLES];
const TitleElement = tasty({
	qa: "Title",
	as: "h1",
	styles: {
		gridArea: "title",
		display: "block",
		color: "#dark",
		preset: {
			"": "h6",
			"level=1": "h1",
			"level=2": "h2",
			"level=3": "h3",
			"level=4": "h4",
			"level=5": "h5",
			"level=6": "h6"
		},
		margin: "0",
		whiteSpace: {
			"": "inherit",
			"nowrap | ellipsis": "nowrap"
		},
		textOverflow: {
			"": false,
			ellipsis: "ellipsis"
		},
		overflow: {
			"": false,
			ellipsis: "hidden"
		},
		width: {
			"": false,
			ellipsis: "max 100%"
		}
	}
});
const Title = forwardRef(function CubeTitle({ qa, as, inline, nowrap, ellipsis, level, ...props }, ref) {
	const propsWithSlots = useSlotProps(props, "title");
	const tag = `h${level || 1}`;
	const styles = extractStyles(propsWithSlots, STYLE_LIST, {}, TEXT_PROP_MAP);
	return /* @__PURE__ */ jsx(TitleElement, {
		qa: qa || "Title",
		as: as || tag,
		"data-level": level || 1,
		mods: {
			nowrap,
			ellipsis
		},
		inline,
		...filterBaseProps(propsWithSlots, { eventProps: true }),
		ref,
		styles
	});
});
const _Title = Object.assign(Title, {
	Danger: forwardRef(function DangerTitle(props, ref) {
		return /* @__PURE__ */ jsx(Title, {
			ref,
			color: "#danger-text",
			...props
		});
	}),
	Success: forwardRef(function SuccessTitle(props, ref) {
		return /* @__PURE__ */ jsx(Title, {
			ref,
			color: "#success-text",
			...props
		});
	})
});
_Title.displayName = "Title";

//#endregion
export { _Title };
//# sourceMappingURL=Title.js.map