UNPKG

@atlaskit/navigation-system

Version:

The latest navigation system for Atlassian apps.

67 lines (63 loc) • 3.06 kB
/* themed-anchor.tsx generated by @compiled/babel-plugin v3.0.2 */ import _extends from "@babel/runtime/helpers/extends"; import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; var _excluded = ["appearance", "shape", "isSelected", "isDisabled"]; import "./themed-anchor.compiled.css"; import { ax, ix } from "@compiled/react/runtime"; import React from 'react'; import { cx } from '@compiled/react'; import forwardRefWithGeneric from '@atlaskit/ds-lib/forward-ref-with-generic'; import { Anchor } from '@atlaskit/primitives/compiled/anchor'; import { getPrimitiveSpreadProps } from './get-primitives-spread-props'; 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 = _objectWithoutProperties(_ref, _excluded); var hasBorder = appearance === 'default' || isSelected; return /*#__PURE__*/React.createElement(Anchor, _extends({}, 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: 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. */ export var ThemedAnchor = forwardRefWithGeneric(ThemedAnchorFn);