@atlaskit/primitives
Version:
Primitives are token-backed low-level building blocks.
48 lines (47 loc) • 2.88 kB
JavaScript
/* focusable.tsx generated by @compiled/babel-plugin v0.39.1 */
;
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("./focusable.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 _excluded = ["as", "children", "isInset", "testId", "style", "xcss"],
_excluded2 = ["className"];
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 focusRingStyles = null;
var insetFocusRingStyles = null;
/**
* __Focus ring__
*
* A focus ring visually indicates the currently focused item.
*
*/
var Focusable = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
var _ref$as = _ref.as,
Component = _ref$as === void 0 ? 'button' : _ref$as,
children = _ref.children,
isInset = _ref.isInset,
testId = _ref.testId,
style = _ref.style,
xcss = _ref.xcss,
htmlAttributes = (0, _objectWithoutProperties2.default)(_ref, _excluded);
// This is to remove className from safeHtmlAttributes
// @ts-ignore -- not using expect since it causes issues with help-center local consumption - className doesn't exist in the prop definition but we want to ensure it cannot be applied even if types are bypassed
var _spreadClass = htmlAttributes.className,
safeHtmlAttributes = (0, _objectWithoutProperties2.default)(htmlAttributes, _excluded2);
return /*#__PURE__*/React.createElement(Component, (0, _extends2.default)({}, safeHtmlAttributes, {
// @ts-ignore Expression produces a union type that is too complex to represent. We may be able to narrow the type here but unsure.
ref: ref,
className: (0, _runtime.ax)(["_ymio1r31 _ypr0glyw _zcxs1o36 _mizu194a _1ah3dkaa _ra3xnqa1 _128mdkaa _1cvmnqa1 _4davt94y", isInset && "_1ah31gjf _2mwq1gjf", xcss]),
style: style,
"data-testid": testId
}), children);
});
var _default = exports.default = Focusable;