UNPKG

@atlaskit/navigation-system

Version:

Page layout and navigation components for Atlassian apps.

52 lines (51 loc) • 2.26 kB
/* button.tsx generated by @compiled/babel-plugin v3.0.4 */ import _extends from "@babel/runtime/helpers/extends"; import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; var _excluded = ["isHidden"]; import "./button.compiled.css"; import { ax, ix } from "@compiled/react/runtime"; import React, { forwardRef } from 'react'; import AkButton from '@atlaskit/button/default/button'; import { cx } from '@atlaskit/css'; import { fg } from '@atlaskit/platform-feature-flags/fg'; import { Box } from '@atlaskit/primitives/compiled/box'; import { useHasCustomTheme } from './has-custom-theme-context'; import { ThemedButton } from './themed-button'; var styles = { visibility: "_1e0c1n7u _yv0ehkll _tzy4kb7n", content: "_1reozryt _18m9zryt _1e0c11p5 _yv0ei47z _1ul9idpf _o5721q9c _1b3h1b66", label: "_1reo15vq _18m915vq _1e0c1ule _1btozryt _o5721q9c", motion: "_v5641k00 _sedtglyw", hidden: "_yv0e63bf _tzy4idpf _3um015vq", hiddenMotion: "_v5641pxo _sedtglyw" }; // Explicitly typed to use only the themed button API, // which is a subset of the normal button API export var Button = /*#__PURE__*/forwardRef(function (_ref, ref) { var isHidden = _ref.isHidden, props = _objectWithoutProperties(_ref, _excluded); var hasCustomTheme = useHasCustomTheme(); var Component = hasCustomTheme ? ThemedButton : AkButton; if (isHidden === undefined) { return /*#__PURE__*/React.createElement(Component, _extends({ ref: ref }, props)); } var motionEnabled = fg('platform-dst-motion-uplift-panel'); return /*#__PURE__*/React.createElement(Box, _extends({ as: "span", xcss: cx(styles.visibility, motionEnabled && styles.motion, isHidden && styles.hidden, motionEnabled && isHidden && styles.hiddenMotion) // `inert` already hides the collapsed button from assistive tech. Avoid `aria-hidden` // here: it logs "blocked aria-hidden" errors when the button still holds focus. }, isHidden ? { inert: '' } : {}), /*#__PURE__*/React.createElement(Box, { as: "span", xcss: styles.content }, /*#__PURE__*/React.createElement(Component, _extends({ ref: ref }, props), /*#__PURE__*/React.createElement(Box, { as: "span", xcss: styles.label }, props.children)))); });