UNPKG

@frontify/fondue

Version:
62 lines (61 loc) 2.03 kB
import { jsxs as h, jsx as t } from "react/jsx-runtime"; import { TooltipIcon as v } from "../TooltipIcon/TooltipIcon.es.js"; import { merge as n } from "../../utilities/merge.es.js"; const g = ({ id: w, children: e, htmlFor: r, required: m = !1, disabled: l = !1, clickable: p = !1, tooltip: i = [], bold: x, "data-test-id": a = "input-label" }) => { const c = (Array.isArray(i) ? i : [i]).map((s, o) => ({ key: o, ...s })); return /* @__PURE__ */ h( "div", { className: n([ "tw-inline-flex tw-leading-4 tw-items-center tw-gap-1 tw-font-sans tw-text-s tw-max-w-full tw-min-w-0 tw-flex-initial", l ? "tw-text-text-disabled" : "tw-text-text-weak" ]), "data-test-id": `${a}-container`, children: [ /* @__PURE__ */ t("div", { className: "tw-flex-1 tw-overflow-hidden tw-text-ellipsis tw-whitespace-nowrap", children: /* @__PURE__ */ t( "label", { id: w, htmlFor: r, className: n([ "tw-select-none tw-max-w-full", x && "tw-font-medium", l || !p ? "hover:tw-cursor-not-allowed tw-pointer-events-none" : "hover:tw-cursor-pointer hover:tw-text-text group-hover:tw-text-text" ]), "data-test-id": a, title: typeof e == "string" ? e : "", children: e } ) }), m && /* @__PURE__ */ t("span", { "data-test-id": `${a}-required`, className: "tw-h-4 tw-text-m tw-text-text-negative", children: "*" }), c.map(({ key: s, triggerIcon: o, triggerStyle: d, hoverDelay: f = 100, ...u }) => /* @__PURE__ */ t("div", { className: "tw-leading-3", children: /* @__PURE__ */ t( v, { tooltip: { ...u, hoverDelay: f }, iconSize: 16, triggerIcon: o, triggerStyle: d } ) }, s)) ] } ); }; g.displayName = "FondueInputLabel"; export { g as InputLabel }; //# sourceMappingURL=InputLabel.es.js.map