import { cs } from "../utils/styles.js";
import "../utils/index.js";
import { omitThemingProps, useStyleConfig } from "../core/theme.js";
import { styled } from "../core/styled.js";
import { vui } from "../core/vui.js";
import icon_default from "../icon/icon.js";
import "../icon/index.js";
import t_default from "../t/t.js";
import "../t/index.js";
import "../core/index.js";
import tooltip_default from "../tooltip/tooltip.js";
import "../tooltip/index.js";
import { Fragment, jsx, jsxs } from "react/jsx-runtime";

//#region src/label/label.tsx
const LabelBase = styled.labelBox`
  display: block;
  color: darkBlue.main;
  width: 100%;

  &[aria-disabled='true'] {
    color: sandstone.75;
    cursor: not-allowed;
  }
`;
/** Displays a paragraph of text. */
const Label = vui((props, ref) => {
	const { children, className, markAsOptional, tooltipText, text, fontSize, ...rest } = omitThemingProps(props);
	const styles = useStyleConfig("Label", props);
	const isOnlyText = text && !markAsOptional && !tooltipText && !children;
	return /* @__PURE__ */ jsx(t_default, {
		as: LabelBase,
		className: cs("vui-label", className),
		fontSize,
		ref,
		...rest,
		children: children ?? (isOnlyText ? text : /* @__PURE__ */ jsxs(Fragment, { children: [
			/* @__PURE__ */ jsx(t_default, {
				variant: "label",
				fontSize,
				children: text
			}),
			!!markAsOptional && /* @__PURE__ */ jsx(t_default, {
				variant: "label",
				fontSize,
				...styles.helper,
				children: "(optional)"
			}),
			!!tooltipText && /* @__PURE__ */ jsx(t_default, {
				variant: "label",
				fontSize,
				...styles.helper,
				children: /* @__PURE__ */ jsx(tooltip_default, {
					text: tooltipText,
					children: /* @__PURE__ */ jsx(icon_default, {
						mb: fontSize === "xs" ? "-6px" : "-5px",
						name: "uiInfoCircle",
						role: "button",
						size: fontSize === "xs" ? "xs" : "sm"
					})
				})
			})
		] }))
	});
});
Label.displayName = "Label";
var label_default = Label;

//#endregion
export { Label, LabelBase, label_default as default };
globalThis.__vuiVersion__ = "4.0.0-beta.1"
//# sourceMappingURL=label.js.map