UNPKG

welcome-ui

Version:

Customizable design system with react, typescript, tailwindcss and ariakit.

58 lines (57 loc) 1.96 kB
"use client"; import { jsx as t, jsxs as d } from "react/jsx-runtime"; import a from "react"; import "./Icon-BisRi8B3.js"; import { E } from "./index-CnxSNAPH.js"; import { c as N } from "./index-PAaZGbyz.js"; import { f as w } from "./forwardRefWithAs-8eP3ZN15.js"; const g = "_root_vehh7_2", k = "_isExternal_vehh7_13", M = "_isMultiline_vehh7_59", b = { root: g, isExternal: k, "wui-text": "_wui-text_vehh7_16", "variant-primary": "_variant-primary_vehh7_38", "variant-secondary": "_variant-secondary_vehh7_42", isMultiline: M }, i = N(b), l = ({ children: r, isExternal: e }) => /* @__PURE__ */ d("span", { className: i("wui-text"), children: [ r, e ? /* @__PURE__ */ t(E, { size: "sm" }) : null ] }), p = (r, e) => typeof r == "string" ? /* @__PURE__ */ t(l, { isExternal: e, children: r }) : a.isValidElement(r) && (r.type === "span" || r.props.as === "span" || // FormattedMessage from react-intl has a span tag by default r.props.tagName === "span" || r.props["data-wui-link"] === !0 || typeof r.props.children == "string") ? e ? /* @__PURE__ */ t(l, { isExternal: e, children: r }) : ( // If it is not external, we just need to add wui-text className to the child as we don't need to wrap it to display the icon a.cloneElement(r, { className: i("wui-text", r.props.className) }) ) : r, C = w((r, e) => { const { as: m, children: n, className: _, disabled: c, isExternal: s, multiline: u, target: o, variant: f = "primary", ...v } = r, x = m || "a", h = typeof n == "string" ? p(n, s) : a.Children.map(n, (y) => p(y, s)); return /* @__PURE__ */ t( x, { "aria-disabled": c, className: i( "root", `variant-${f}`, s && "isExternal", u && "isMultiline", _ ), ref: e, rel: o === "_blank" ? "noopener noreferrer" : void 0, target: o, ...v, children: h } ); }); export { C as Link };