UNPKG

@kubit-ui-web/react-components

Version:

Kubit React Components is a customizable, accessible library of React web components, designed to enhance your application's user experience

19 lines 1.68 kB
import { jsx as _jsx } from "react/jsx-runtime"; import React from 'react'; import { Text } from '../../components/text/text'; import { pickAriaProps } from '../../utils/aria/aria'; import { ElementOrIcon } from '../elementOrIcon/elementOrIcon'; // styles import { LabelIconWrapper, TextStyledExtended } from './link.styled'; import { LinkStateType } from './types/state'; const LinkStandAloneComponent = ({ dataTestId = 'link', url, ...props }, ref) => { const ariaProps = pickAriaProps(props); return (_jsx(TextStyledExtended, { ...ariaProps, ref: ref, alignCenter: props.alignCenter, as: Text, color: props.color, component: props.component, dataTestId: dataTestId, decoration: props.decoration, draggable: props.draggable, isDisabled: props.state === LinkStateType.DISABLED, linkStyles: props.styles, target: props.target, textStyles: props.textStyles, weight: props.weight, //We have to make this because even it was disabled, you could access to onClick by arrows onClick: props.state !== LinkStateType.DISABLED ? props.onClick : undefined, ...(props.state !== LinkStateType.DISABLED && { url }), role: props.role, children: props.icon ? (_jsx(LabelIconWrapper, { iconPosition: props.iconPosition, styles: props.styles?.[props.state], children: [ _jsx(ElementOrIcon, { color: props.styles?.[props.state]?.icon?.color, height: props.styles?.[props.state]?.icon?.height, width: props.styles?.[props.state]?.icon?.width, ...props.icon }, "icon"), props.children, ] })) : (props.children) })); }; export const LinkStandAlone = React.forwardRef(LinkStandAloneComponent); //# sourceMappingURL=linkStandAlone.js.map