@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
24 lines • 2.23 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.LinkAsButtonStandAlone = exports.LinkAsButtonStandAloneComponent = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = __importDefault(require("react"));
const button_styled_1 = require("../../../components/button/button.styled");
const buttonStandAlone_1 = require("../../../components/button/buttonStandAlone");
const text_1 = require("../../../components/text/text");
const aria_1 = require("../../../utils/aria/aria");
const state_1 = require("../../button/types/state");
const decoration_1 = require("../../text/types/decoration");
const linkAsButton_styled_1 = require("./linkAsButton.styled");
const LinkAsButtonStandAloneComponent = ({ dataTestId = 'link-as-button', children, url, component, target, role, onClick, ['aria-label']: ariaLabel, ...props }, ref) => {
const ariaProps = (0, aria_1.pickAriaProps)(props);
return (
// Apply button border radius to the link when focus-visible
(0, jsx_runtime_1.jsx)(linkAsButton_styled_1.LinkAsButtonWrapperStyled, { "$fullWidth": props.fullWidth, "$sizeStyles": props.sizeStyles, "$state": props.state, "$styles": props.styles, "data-testid": dataTestId, children: (0, jsx_runtime_1.jsx)(text_1.Text, { ref: ref, "aria-label": ariaLabel, component: component, decoration: decoration_1.TextDecorationType.NONE, isDisabled: props.state === state_1.ButtonStateType.DISABLED, role: role, target: target, url: url, onClick: onClick, children: (0, jsx_runtime_1.jsx)(button_styled_1.ButtonStyled, { as: "span", ...props, "$fullWidth": props.fullWidth, "$iconPosition": props.iconPosition, "$sizeStyles": props.sizeStyles, "$state": props.state, "$styles": props.styles, children: (0, jsx_runtime_1.jsx)(buttonStandAlone_1.ButtonStandAloneStructure, { ...props, children: children }) }) }) }));
};
exports.LinkAsButtonStandAloneComponent = LinkAsButtonStandAloneComponent;
exports.LinkAsButtonStandAlone = react_1.default.forwardRef(exports.LinkAsButtonStandAloneComponent);
//# sourceMappingURL=linkAsButtonStandAlone.js.map