UNPKG

@atlaskit/primitives

Version:

Primitives are token-backed low-level building blocks.

47 lines (46 loc) 2.72 kB
/* focusable.tsx generated by @compiled/babel-plugin v0.36.1 */ import _extends from "@babel/runtime/helpers/extends"; import _defineProperty from "@babel/runtime/helpers/defineProperty"; import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; var _excluded = ["as", "children", "isInset", "testId", "style", "xcss"], _excluded2 = ["className"]; import "./focusable.compiled.css"; import * as React from 'react'; import { ax, ix } from "@compiled/react/runtime"; function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } import { forwardRef } from 'react'; var focusRingStyles = null; var insetFocusRingStyles = null; /** * __Focus ring__ * * A focus ring visually indicates the currently focused item. * */ var Focusable = /*#__PURE__*/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 = _objectWithoutProperties(_ref, _excluded); // This is to remove className from safeHtmlAttributes // @ts-expect-error 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 = _objectWithoutProperties(htmlAttributes, _excluded2); return /*#__PURE__*/React.createElement(Component, _extends({}, 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: ax(["_mizu194a _1ah31bk5 _ra3xnqa1 _128m1bk5 _1cvmnqa1 _4davt94y", isInset && "_1ah3115h _2mwq115h", xcss]) // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop , "data-testid": testId, style: _objectSpread(_objectSpread({}, style), {}, { "--_1203r2w": ix("calc(0px - ".concat("var(--ds-border-width-outline, 2px)", ")")) }) }), children); }); export default Focusable;