/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-b67433b | Cube Dev Team */
import { extractStyles } from "../../utils/styles.js";
import { useCombinedRefs } from "../../utils/react/useCombinedRefs.js";
import { CONTAINER_STYLES, filterBaseProps, parseStyle, tasty } from "@tenphi/tasty";
import { forwardRef, useEffect } from "react";
import { jsx } from "react/jsx-runtime";

//#region src/components/layout/Suffix.tsx
const SuffixElement = tasty({
	element: "Suffix",
	styles: {
		position: "absolute",
		display: "grid",
		placeContent: "stretch",
		placeItems: "center",
		flow: "column",
		gap: 0,
		right: "$suffix-gap",
		top: "$suffix-gap",
		bottom: "$suffix-gap",
		color: "#dark-02",
		height: "(100% - (2 * $suffix-gap))"
	}
});
const Suffix = forwardRef(function Suffix(allProps, outerRef) {
	let { onWidthChange, outerGap = "1bw", children, ...props } = allProps;
	const styles = extractStyles(props, CONTAINER_STYLES);
	const ref = useCombinedRefs(outerRef);
	useEffect(() => {
		if (ref && ref.current && onWidthChange) onWidthChange(ref.current.offsetWidth);
	}, [
		children,
		ref,
		onWidthChange
	]);
	return /* @__PURE__ */ jsx(SuffixElement, {
		...filterBaseProps(props, { eventProps: true }),
		ref,
		styles,
		style: { "--suffix-gap": parseStyle(outerGap).output },
		children
	});
});

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