UNPKG

@atlaskit/pragmatic-drag-and-drop-react-accessibility

Version:

An optional package for Pragmatic drag and drop containing react components to assist with setting up accessible experiences

56 lines (54 loc) • 3.41 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); var _typeof = require("@babel/runtime/helpers/typeof"); Object.defineProperty(exports, "__esModule", { value: true }); exports.DragHandleButtonSmall = void 0; var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties")); var _react = _interopRequireWildcard(require("react")); var _dragHandleVertical = _interopRequireDefault(require("@atlaskit/icon/core/drag-handle-vertical")); var _fg = require("@atlaskit/platform-feature-flags/fg"); var _primitives = require("@atlaskit/primitives"); var _dragHandleButtonBase = require("./drag-handle-button-base"); var _excluded = ["label"]; // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss 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 iconSmallStyles = (0, _primitives.xcss)({ display: 'inline-flex', marginInline: 'space.negative.050' }); var iconSmallStylesNew = (0, _primitives.xcss)({ display: 'inline-flex' }); // TODO: will run full deprecation process later. For now just want people to stop using this. // eslint-disable-next-line @repo/internal/deprecations/deprecation-ticket-required /** * A button with pre-configured styling to look like a drag handle. * * This component uses a native button because the `@atlaskit/button` * cancels `mouseDown` events, which prevents dragging. * * @deprecated Please use `DragHandleButton`. * * Rationale: * * - `DragHandleButtonSmall` uses a tiny icon size that is no longer supported by our icon system * (the smallest icon size is now `12px` x `12px`) * - Icons smaller than `12px` x `12px` are not good for visibility and accessibility * - The small hitbox of `DragHandleButtonSmall` (`8px` x `16px`) is below our `24px` x `24px` * minimum hit target size for accessibility. [More details](https://www.w3.org/WAI/WCAG22/Understanding/target-size-minimum.html) */ var DragHandleButtonSmall = exports.DragHandleButtonSmall = /*#__PURE__*/(0, _react.forwardRef)(function DragHandleButton(_ref, ref) { var label = _ref.label, buttonProps = (0, _objectWithoutProperties2.default)(_ref, _excluded); return /*#__PURE__*/_react.default.createElement(_dragHandleButtonBase.DragHandleButtonBase, (0, _extends2.default)({ ref: ref }, buttonProps), /*#__PURE__*/_react.default.createElement(_primitives.Box, { xcss: (0, _fg.fg)('platform-component-visual-refresh') ? iconSmallStylesNew : iconSmallStyles }, /*#__PURE__*/_react.default.createElement(_dragHandleVertical.default, { color: "currentColor", label: label, size: "small" }))); });