UNPKG

@atlaskit/navigation-system

Version:

The latest navigation system for Atlassian apps.

74 lines (69 loc) • 3.5 kB
/* themed-anchor.tsx generated by @compiled/babel-plugin v3.0.2 */ "use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.ThemedAnchor = void 0; require("./themed-anchor.compiled.css"); var _runtime = require("@compiled/react/runtime"); var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties")); var _react = _interopRequireDefault(require("react")); var _react2 = require("@compiled/react"); var _forwardRefWithGeneric = _interopRequireDefault(require("@atlaskit/ds-lib/forward-ref-with-generic")); var _anchor = require("@atlaskit/primitives/compiled/anchor"); var _getPrimitivesSpreadProps = require("./get-primitives-spread-props"); var _excluded = ["appearance", "shape", "isSelected", "isDisabled"]; var styles = { root: "_zulp12x7 _11c8fhey _2rko1qi0 _v564k6bl _4bfu1r31 _1hmsglyw _ajmmnqa1 _1rjcze3t _1e0c1txw _4cvr1h6o _1bah1h6o _4t3i5r7u _kqswh2mm _1nrm1r31 _1a3b1r31 _9oik1r31 _c2waglyw _4fprglyw _1bnxglyw _1iohnqa1 _5goinqa1 _jf4cnqa1 _1ggl5xtf", border: "_14mj1kw7 _9v7aze3t _1tv3nqa1 _39yqe4h9 _aetrb3bt _18postnw", selected: "_11q71qds _syazw5ct _8l3m15jn _f8pjw5ct _1053w5ct _19lcjrv1 _30l3w5ct _j6xtnh62 _9h8hw5ct", disabled: "_11q71c9b _syaz1i3i _8l3m1j28 _f8pj1i3i _10531i3i _19lc1c9b _30l31i3i _j6xt1c9b _9h8h1i3i" }; var appearanceStyles = { default: "_11q7pkxg _syaz1r31 _8l3maykr _f8pj1r31 _10531r31 _19lc1rps _30l31r31 _j6xtqtgh _9h8h1r31", subtle: "_11q7pkxg _syaz1r31 _f8pj1r31 _10531r31 _19lc1rps _30l31r31 _j6xtqtgh _9h8h1r31", primary: "_11q7esko _syaz15o7 _f8pj15o7 _105315o7 _19lcp6hf _30l315o7 _j6xt5sko _9h8h15o7" }; var shapeStyles = { default: "_18zrutpp", square: "_18zrze3t _1bsb5r7u _vwz4idpf" }; /** * Props that are common between link buttons. */ /** * Props shared by `ThemedPressable` and `ThemedAnchor` */ function ThemedAnchorFn(_ref, ref) { var _ref$appearance = _ref.appearance, appearance = _ref$appearance === void 0 ? 'default' : _ref$appearance, _ref$shape = _ref.shape, shape = _ref$shape === void 0 ? 'default' : _ref$shape, isSelected = _ref.isSelected, isDisabled = _ref.isDisabled, props = (0, _objectWithoutProperties2.default)(_ref, _excluded); var hasBorder = appearance === 'default' || isSelected; return /*#__PURE__*/_react.default.createElement(_anchor.Anchor, (0, _extends2.default)({}, (0, _getPrimitivesSpreadProps.getPrimitiveSpreadProps)(props), { ref: ref /** * We are using some style values that are outside of the strict * `@atlaskit/css` types. */ // @ts-expect-error // eslint-disable-next-line @compiled/no-suppress-xcss , xcss: (0, _react2.cx)(styles.root, shapeStyles[shape], hasBorder && styles.border, appearanceStyles[appearance], isSelected && styles.selected, isDisabled && styles.disabled) })); } /** * Intentionally an almost-duplicate of `ThemedPressable` - make sure to update both. * * More 'clever' solutions were tried but I couldn't get them working in an acceptable state. * * Polymorphism had many typing issues and required sacrificing type safety. * * Render props had problems passing down styles through `xcss` to the `children` function. */ var ThemedAnchor = exports.ThemedAnchor = (0, _forwardRefWithGeneric.default)(ThemedAnchorFn);