@atlaskit/link
Version:
A link takes people to a new location in the app or another website.
81 lines (79 loc) • 4.97 kB
JavaScript
/* index.tsx generated by @compiled/babel-plugin v0.38.1 */
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
require("./index.compiled.css");
var _react = _interopRequireWildcard(require("react"));
var React = _react;
var _runtime = require("@compiled/react/runtime");
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
var _css = require("@atlaskit/css");
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
var _compiled = require("@atlaskit/primitives/compiled");
var _excluded = ["children", "testId", "appearance", "newWindowLabel", "target", "className", "style"];
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
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 = (0, _objectWithoutProperties2.default)(_ref, _excluded);
return /*#__PURE__*/React.createElement(_compiled.Anchor
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
, (0, _extends2.default)({}, htmlAttributes, {
target: target,
ref: ref,
xcss: (0, _css.cx)(styles.base, (0, _platformFeatureFlags.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(_compiled.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: (0, _runtime.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__*/(0, _react.forwardRef)(LinkWithoutRef);
var _default = exports.default = Link;