UNPKG

@trail-ui/react

Version:
43 lines (40 loc) 1.11 kB
import { Slot } from "./chunk-QD7CZFZ3.mjs"; import { focusOutlineStyle } from "./chunk-E45U7QEE.mjs"; // src/multiselect/tw-link.tsx import React from "react"; import { Link as RACLink, composeRenderProps } from "react-aria-components"; import { twMerge } from "tailwind-merge"; import { jsx } from "react/jsx-runtime"; var linkStyle = [ "relative inline-flex cursor-pointer items-center gap-1 rounded-md outline-none hover:underline", "text-base/6 sm:text-sm/6", "disabled:no-underline disabled:opacity-50 disabled:cursor-default", "[&.border]:hover:no-underline" ]; var Link = React.forwardRef(function Link2(props, ref) { if (props.asChild) { const { ...rest2 } = props; return /* @__PURE__ */ jsx(Slot, { ...rest2, className: twMerge(linkStyle) }); } const { ...rest } = props; return /* @__PURE__ */ jsx( RACLink, { ...rest, ref, className: composeRenderProps(props.className, (className, renderProps) => { return twMerge([linkStyle, renderProps.isFocusVisible && focusOutlineStyle, className]); }) } ); }); export { Link };