// Copyright (c) Mysten Labs, Inc. // Modifications Copyright (c) 2024 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 import { Slot } from '@radix-ui/react-slot'; import clsx from 'clsx'; import { forwardRef } from 'react'; import { textVariants } from './Text.css.js'; import type { TextVariants } from './Text.css.js'; type TextAsChildProps = { asChild?: boolean; as?: never; }; type TextDivProps = { as: 'div'; asChild?: never }; type TextProps = (TextAsChildProps | TextDivProps) & React.HTMLAttributes & TextVariants; const Text = forwardRef( ( { children, className, asChild = false, as: Tag = 'div', size, weight, color, mono, ...textProps }, forwardedRef, ) => { return ( {asChild ? children : {children}} ); }, ); Text.displayName = 'Text'; export { Text };