UNPKG

@atlaskit/link

Version:

A link takes people to a new location in the app or another website.

72 lines (71 loc) 3.87 kB
/* index.tsx generated by @compiled/babel-plugin v0.38.1 */ import _extends from "@babel/runtime/helpers/extends"; import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; var _excluded = ["children", "testId", "appearance", "newWindowLabel", "target", "className", "style"]; import "./index.compiled.css"; import * as React from 'react'; import { ax, ix } from "@compiled/react/runtime"; import { forwardRef } from 'react'; import { cx } from '@atlaskit/css'; import { fg } from '@atlaskit/platform-feature-flags'; import { Anchor, Box } from '@atlaskit/primitives/compiled'; var styles = { base: "_ect4ttxp", baseT26Shape: "_2rkolb4i", visitedLink: "_10531ra0 _1ien1ra0 _n0fx1ra0 _1vhv17z1", defaultAppearance: "_4bfu1r31 _1hms8stv _ajmmnqa1 _syaz13af _1a3b1r31 _4fpr8stv _5goinqa1 _f8pj13af _9oik1r31 _1bnxglyw _jf4cnqa1 _30l313af _1nrm1r31 _c2waglyw _1iohnqa1 _9h8h12zz", subtleAppearance: "_4bfu1r31 _1hmsglyw _ajmmnqa1 _syazazsu _1a3b1r31 _4fprglyw _5goinqa1 _f8pjazsu _9oik1r31 _1bnx8stv _jf4cnqa1 _30l3azsu _1nrm1r31 _c2wa8stv _1iohnqa1 _9h8hi7uo", inverseAppearance: "_4bfu1r31 _1hms8stv _ajmmnqa1 _syaz15cr _105315cr _1a3b1r31 _4fpr8stv _5goinqa1 _f8pj15cr _9oik1r31 _1bnxglyw _jf4cnqa1 _30l315cr _1nrm1r31 _c2waglyw _1iohnqa1 _9h8h15cr", iconWrapper: "_1e0c1nu9 _o5721q9c _s7n41q9y _kqswh2mm _152ttb3r" }; var iconStyles = null; var LinkWithoutRef = function LinkWithoutRef(_ref, ref) { var children = _ref.children, testId = _ref.testId, _ref$appearance = _ref.appearance, appearance = _ref$appearance === void 0 ? 'default' : _ref$appearance, newWindowLabel = _ref.newWindowLabel, target = _ref.target, _preventedClassName = _ref.className, _preventedStyle = _ref.style, htmlAttributes = _objectWithoutProperties(_ref, _excluded); return /*#__PURE__*/React.createElement(Anchor // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props , _extends({}, htmlAttributes, { target: target, ref: ref, xcss: cx(styles.base, fg('platform-dst-shape-theme-default') && styles.baseT26Shape, appearance === 'default' && styles.defaultAppearance, appearance === 'subtle' && styles.subtleAppearance, appearance === 'inverse' && styles.inverseAppearance, // Visited styles are not supported for inverse links due to contrast issues appearance !== 'inverse' && styles.visitedLink), testId: testId, componentName: "Link", newWindowLabel: newWindowLabel }), children, target === '_blank' && /*#__PURE__*/React.createElement(Box, { as: "span", xcss: styles.iconWrapper, testId: testId && "".concat(testId, "__icon") }, "\uFEFF", /*#__PURE__*/React.createElement("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", className: ax(["_1bsbgm0b _4t3igm0b _ahbqzjw7"]) }, /*#__PURE__*/React.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M0 1.82609C0 0.817938 0.817938 0 1.82609 0H3.91304V1.04348H1.82609C1.39424 1.04348 1.04348 1.39424 1.04348 1.82609V10.1739C1.04348 10.6058 1.39424 10.9565 1.82609 10.9565H10.1739C10.6058 10.9565 10.9565 10.6058 10.9565 10.1739V8.08696H12V10.1739C12 11.1821 11.1821 12 10.1739 12H1.82609C0.817938 12 0 11.1821 0 10.1739V1.82609ZM7.04348 0H12V4.95652H10.9565V1.78133L6.36893 6.36893L5.63107 5.63107L10.2187 1.04348H7.04348V0Z", fill: "currentColor" })))); }; // Workarounds to support generic types with forwardRef /** * __Link__ * * A link is an inline text element that navigates to a new location when clicked. * * - [Examples](https://atlassian.design/components/primitives/link/examples) * - [Code](https://atlassian.design/components/primitives/link/code) * - [Usage](https://atlassian.design/components/primitives/link/usage) */ var Link = /*#__PURE__*/forwardRef(LinkWithoutRef); export default Link;