@atlaskit/pragmatic-drag-and-drop-react-accessibility 0.3.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/constellation/drag-handle-button/examples.mdx +10 -0
  3. package/constellation/drag-handle-dropdown-menu/examples.mdx +10 -0
  4. package/dist/cjs/drag-handle-button-base.js +75 -0
  5. package/dist/cjs/drag-handle-button-small.js +31 -0
  6. package/dist/cjs/drag-handle-button.js +12 -58
  7. package/dist/cjs/drag-handle-dropdown-menu-small.js +43 -0
  8. package/dist/cjs/drag-handle-icon-small.js +26 -0
  9. package/dist/cjs/drag-handle-icon.js +16 -0
  10. package/dist/cjs/types.js +5 -0
  11. package/dist/es2019/drag-handle-button-base.js +74 -0
  12. package/dist/es2019/drag-handle-button-small.js +20 -0
  13. package/dist/es2019/drag-handle-button.js +7 -63
  14. package/dist/es2019/drag-handle-dropdown-menu-small.js +34 -0
  15. package/dist/es2019/drag-handle-icon-small.js +20 -0
  16. package/dist/es2019/drag-handle-icon.js +10 -0
  17. package/dist/es2019/types.js +1 -0
  18. package/dist/esm/drag-handle-button-base.js +69 -0
  19. package/dist/esm/drag-handle-button-small.js +21 -0
  20. package/dist/esm/drag-handle-button.js +9 -59
  21. package/dist/esm/drag-handle-dropdown-menu-small.js +34 -0
  22. package/dist/esm/drag-handle-icon-small.js +19 -0
  23. package/dist/esm/drag-handle-icon.js +9 -0
  24. package/dist/esm/types.js +1 -0
  25. package/dist/types/drag-handle-button-base.d.ts +11 -0
  26. package/dist/types/drag-handle-button-small.d.ts +11 -0
  27. package/dist/types/drag-handle-button.d.ts +3 -41
  28. package/dist/types/drag-handle-dropdown-menu-small.d.ts +8 -0
  29. package/dist/types/drag-handle-dropdown-menu.d.ts +2 -20
  30. package/dist/types/drag-handle-icon-small.d.ts +4 -0
  31. package/dist/types/drag-handle-icon.d.ts +3 -0
  32. package/dist/types/types.d.ts +37 -0
  33. package/dist/types-ts4.5/drag-handle-button-base.d.ts +11 -0
  34. package/dist/types-ts4.5/drag-handle-button-small.d.ts +11 -0
  35. package/dist/types-ts4.5/drag-handle-button.d.ts +11 -0
  36. package/dist/types-ts4.5/drag-handle-dropdown-menu-small.d.ts +8 -0
  37. package/dist/types-ts4.5/drag-handle-dropdown-menu.d.ts +8 -0
  38. package/dist/types-ts4.5/drag-handle-icon-small.d.ts +4 -0
  39. package/dist/types-ts4.5/drag-handle-icon.d.ts +3 -0
  40. package/dist/types-ts4.5/index.d.ts +5 -0
  41. package/dist/types-ts4.5/types.d.ts +37 -0
  42. package/drag-handle-button-small/package.json +15 -0
  43. package/drag-handle-dropdown-menu-small/package.json +15 -0
  44. package/extract-react-types/drag-handle-button.tsx +1 -1
  45. package/extract-react-types/drag-handle-dropdown-menu.tsx +1 -1
  46. package/package.json +7 -4
  47. package/tmp/api-report-tmp.d.ts +13 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @atlaskit/pragmatic-drag-and-drop-react-accessibility
2
2
 
3
+ ## 0.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#41296](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/41296) [`3e479ba1a4a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/3e479ba1a4a) - [ux] The drag handle icon now uses the `color.icon.subtle` token.
8
+ - [#41296](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/41296) [`ac64412c674`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ac64412c674) - Introduced small variants of the drag handle button and drag handle dropdown menu.
9
+
10
+ These are intended for existing experiences with little space available to
11
+ introduce a drag handle. They are not recommended for general use.
12
+
13
+ These small variants can be accessed through the `/drag-handle-button-small` and
14
+ `/drag-handle-dropdown-menu-small` entrypoints.
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies
19
+
3
20
  ## 0.3.1
4
21
 
5
22
  ### Patch Changes
@@ -8,6 +8,7 @@ import { Code } from '@atlaskit/code';
8
8
  import SectionMessage from '@atlaskit/section-message';
9
9
 
10
10
  import DragHandleButtonExample from '../../examples/drag-handle-button';
11
+ import DragHandleButtonSmallExample from '../../examples/drag-handle-button-small';
11
12
 
12
13
  <SectionMessage appearance="warning">
13
14
  This component does not use the <Code>@atlaskit/button</Code> component,
@@ -19,3 +20,12 @@ import DragHandleButtonExample from '../../examples/drag-handle-button';
19
20
  ## Default
20
21
 
21
22
  <Example Component={DragHandleButtonExample} />
23
+
24
+ ## Small variant
25
+
26
+ A small variant is available through the `/drag-handle-button-small` entrypoint.
27
+
28
+ It is intended for experiences with very limited space to accomodate a drag handle.
29
+ It is not recommended for general use due to the small target size.
30
+
31
+ <Example Component={DragHandleButtonSmallExample} />
@@ -8,6 +8,7 @@ import { Code } from '@atlaskit/code';
8
8
  import SectionMessage from '@atlaskit/section-message';
9
9
 
10
10
  import DragHandleDropdownMenuExample from '../../examples/drag-handle-dropdown-menu';
11
+ import DragHandleDropdownMenuSmallExample from '../../examples/drag-handle-dropdown-menu-small';
11
12
 
12
13
  <SectionMessage appearance="warning">
13
14
  This component does not use the <Code>@atlaskit/button</Code> component,
@@ -19,3 +20,12 @@ import DragHandleDropdownMenuExample from '../../examples/drag-handle-dropdown-m
19
20
  ## Default
20
21
 
21
22
  <Example Component={DragHandleDropdownMenuExample} />
23
+
24
+ ## Small variant
25
+
26
+ A small variant is available through the `/drag-handle-dropdown-menu-small` entrypoint.
27
+
28
+ It is intended for experiences with very limited space to accomodate a drag handle.
29
+ It is not recommended for general use due to the small target size.
30
+
31
+ <Example Component={DragHandleButtonSizeExample} />
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.DragHandleButtonBase = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
+ var _react = require("react");
11
+ var _react2 = require("@emotion/react");
12
+ var _focusRing = _interopRequireDefault(require("@atlaskit/focus-ring"));
13
+ var _excluded = ["children", "isSelected", "testId", "appearance", "type"];
14
+ /** @jsx jsx */
15
+ /**
16
+ * Cannot use `@atlaskit/button` here because it cancels `mousedown` events
17
+ * which prevents dragging.
18
+ */
19
+ var buttonStyles = (0, _react2.css)({
20
+ borderRadius: "var(--ds-border-radius-100, 3px)",
21
+ padding: "var(--ds-space-0, 0px)",
22
+ width: 'max-content',
23
+ border: 'none',
24
+ cursor: 'grab',
25
+ display: 'flex'
26
+ });
27
+ var buttonAppearanceStyles = {
28
+ default: (0, _react2.css)({
29
+ backgroundColor: "var(--ds-background-neutral, #091E420F)",
30
+ ':hover': {
31
+ backgroundColor: "var(--ds-background-neutral-hovered, #091E4224)"
32
+ },
33
+ ':active': {
34
+ backgroundColor: "var(--ds-background-neutral-pressed, #091E424F)"
35
+ }
36
+ }),
37
+ subtle: (0, _react2.css)({
38
+ backgroundColor: "var(--ds-background-neutral-subtle, #00000000)",
39
+ ':hover': {
40
+ backgroundColor: "var(--ds-background-neutral-subtle-hovered, #091E420F)"
41
+ },
42
+ ':active': {
43
+ backgroundColor: "var(--ds-background-neutral-subtle-pressed, #091E4224)"
44
+ }
45
+ }),
46
+ selected: (0, _react2.css)({
47
+ backgroundColor: "var(--ds-background-selected, #E9F2FF)",
48
+ color: "var(--ds-text-selected, #0C66E4)"
49
+ })
50
+ };
51
+
52
+ /**
53
+ * A button with pre-configured styling to look like a drag handle.
54
+ *
55
+ * This component uses a native button because the `@atlaskit/button`
56
+ * cancels `mouseDown` events, which prevents dragging.
57
+ */
58
+ var DragHandleButtonBase = exports.DragHandleButtonBase = /*#__PURE__*/(0, _react.forwardRef)(function DragHandleButton(_ref, ref) {
59
+ var children = _ref.children,
60
+ _ref$isSelected = _ref.isSelected,
61
+ isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected,
62
+ testId = _ref.testId,
63
+ _ref$appearance = _ref.appearance,
64
+ appearanceProp = _ref$appearance === void 0 ? 'default' : _ref$appearance,
65
+ _ref$type = _ref.type,
66
+ type = _ref$type === void 0 ? 'button' : _ref$type,
67
+ buttonProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
68
+ var appearance = isSelected ? 'selected' : appearanceProp;
69
+ return (0, _react2.jsx)(_focusRing.default, null, (0, _react2.jsx)("button", (0, _extends2.default)({
70
+ ref: ref,
71
+ css: [buttonStyles, buttonAppearanceStyles[appearance]],
72
+ "data-testid": testId,
73
+ type: type
74
+ }, buttonProps), children));
75
+ });
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.DragHandleButtonSmall = void 0;
9
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
+ var _react = _interopRequireWildcard(require("react"));
12
+ var _dragHandleButtonBase = require("./drag-handle-button-base");
13
+ var _dragHandleIconSmall = require("./drag-handle-icon-small");
14
+ var _excluded = ["label"];
15
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
16
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
+ /**
18
+ * A button with pre-configured styling to look like a drag handle.
19
+ *
20
+ * This component uses a native button because the `@atlaskit/button`
21
+ * cancels `mouseDown` events, which prevents dragging.
22
+ */
23
+ var DragHandleButtonSmall = exports.DragHandleButtonSmall = /*#__PURE__*/(0, _react.forwardRef)(function DragHandleButton(_ref, ref) {
24
+ var label = _ref.label,
25
+ buttonProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
26
+ return /*#__PURE__*/_react.default.createElement(_dragHandleButtonBase.DragHandleButtonBase, (0, _extends2.default)({
27
+ ref: ref
28
+ }, buttonProps), /*#__PURE__*/_react.default.createElement(_dragHandleIconSmall.DragHandleIconSmall, {
29
+ label: label
30
+ }));
31
+ });
@@ -1,54 +1,19 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.DragHandleButton = void 0;
8
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
10
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
- var _react = require("react");
11
- var _react2 = require("@emotion/react");
12
- var _focusRing = _interopRequireDefault(require("@atlaskit/focus-ring"));
13
- var _dragHandler = _interopRequireDefault(require("@atlaskit/icon/glyph/drag-handler"));
14
- var _excluded = ["isSelected", "testId", "appearance", "label", "type"];
15
- /** @jsx jsx */
16
- /**
17
- * Cannot use `@atlaskit/button` here because it cancels `mousedown` events
18
- * which prevents dragging.
19
- */
20
- var buttonStyles = (0, _react2.css)({
21
- borderRadius: "var(--ds-border-radius-100, 3px)",
22
- padding: "var(--ds-space-0, 0px)",
23
- width: 'max-content',
24
- border: 'none',
25
- cursor: 'grab',
26
- display: 'flex'
27
- });
28
- var buttonAppearanceStyles = {
29
- default: (0, _react2.css)({
30
- backgroundColor: "var(--ds-background-neutral, #091E420F)",
31
- ':hover': {
32
- backgroundColor: "var(--ds-background-neutral-hovered, #091E4224)"
33
- },
34
- ':active': {
35
- backgroundColor: "var(--ds-background-neutral-pressed, #091E424F)"
36
- }
37
- }),
38
- subtle: (0, _react2.css)({
39
- backgroundColor: "var(--ds-background-neutral-subtle, #00000000)",
40
- ':hover': {
41
- backgroundColor: "var(--ds-background-neutral-subtle-hovered, #091E420F)"
42
- },
43
- ':active': {
44
- backgroundColor: "var(--ds-background-neutral-subtle-pressed, #091E4224)"
45
- }
46
- }),
47
- selected: (0, _react2.css)({
48
- backgroundColor: "var(--ds-background-selected, #E9F2FF)",
49
- color: "var(--ds-text-selected, #0C66E4)"
50
- })
51
- };
11
+ var _react = _interopRequireWildcard(require("react"));
12
+ var _dragHandleButtonBase = require("./drag-handle-button-base");
13
+ var _dragHandleIcon = require("./drag-handle-icon");
14
+ var _excluded = ["label"];
15
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
16
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
52
17
  /**
53
18
  * A button with pre-configured styling to look like a drag handle.
54
19
  *
@@ -56,22 +21,11 @@ var buttonAppearanceStyles = {
56
21
  * cancels `mouseDown` events, which prevents dragging.
57
22
  */
58
23
  var DragHandleButton = exports.DragHandleButton = /*#__PURE__*/(0, _react.forwardRef)(function DragHandleButton(_ref, ref) {
59
- var _ref$isSelected = _ref.isSelected,
60
- isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected,
61
- testId = _ref.testId,
62
- _ref$appearance = _ref.appearance,
63
- appearanceProp = _ref$appearance === void 0 ? 'default' : _ref$appearance,
64
- label = _ref.label,
65
- _ref$type = _ref.type,
66
- type = _ref$type === void 0 ? 'button' : _ref$type,
24
+ var label = _ref.label,
67
25
  buttonProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
68
- var appearance = isSelected ? 'selected' : appearanceProp;
69
- return (0, _react2.jsx)(_focusRing.default, null, (0, _react2.jsx)("button", (0, _extends2.default)({
70
- ref: ref,
71
- css: [buttonStyles, buttonAppearanceStyles[appearance]],
72
- "data-testid": testId,
73
- type: type
74
- }, buttonProps), (0, _react2.jsx)(_dragHandler.default, {
26
+ return /*#__PURE__*/_react.default.createElement(_dragHandleButtonBase.DragHandleButtonBase, (0, _extends2.default)({
27
+ ref: ref
28
+ }, buttonProps), /*#__PURE__*/_react.default.createElement(_dragHandleIcon.DragHandleIcon, {
75
29
  label: label
76
- })));
30
+ }));
77
31
  });
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.DragHandleDropdownMenuSmall = DragHandleDropdownMenuSmall;
9
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
+ var _react = _interopRequireWildcard(require("react"));
12
+ var _dropdownMenu = _interopRequireDefault(require("@atlaskit/dropdown-menu"));
13
+ var _mergeRefs = _interopRequireDefault(require("@atlaskit/ds-lib/merge-refs"));
14
+ var _dragHandleButtonBase = require("./drag-handle-button-base");
15
+ var _dragHandleIconSmall = require("./drag-handle-icon-small");
16
+ var _excluded = ["triggerRef"]; // eslint-disable-next-line @atlaskit/design-system/no-banned-imports
17
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
18
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
+ /**
20
+ * A dropdown menu with a predefined trigger, styled to look like a drag handle.
21
+ *
22
+ * The API is designed to mirror the `@atlaskit/dropdown-menu` API.
23
+ */
24
+ function DragHandleDropdownMenuSmall(_ref) {
25
+ var children = _ref.children,
26
+ consumerRef = _ref.triggerRef,
27
+ appearance = _ref.appearance,
28
+ label = _ref.label;
29
+ var renderTrigger = (0, _react.useCallback)(function (_ref2) {
30
+ var triggerRef = _ref2.triggerRef,
31
+ triggerProps = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
32
+ var mergedRef = (0, _mergeRefs.default)([consumerRef, triggerRef]);
33
+ return /*#__PURE__*/_react.default.createElement(_dragHandleButtonBase.DragHandleButtonBase, (0, _extends2.default)({
34
+ ref: mergedRef,
35
+ appearance: appearance
36
+ }, triggerProps), /*#__PURE__*/_react.default.createElement(_dragHandleIconSmall.DragHandleIconSmall, {
37
+ label: label
38
+ }));
39
+ }, [appearance, consumerRef, label]);
40
+ return /*#__PURE__*/_react.default.createElement(_dropdownMenu.default, {
41
+ trigger: renderTrigger
42
+ }, children);
43
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.DragHandleIconSmall = DragHandleIconSmall;
8
+ var _react = require("@emotion/react");
9
+ var _dragHandler = _interopRequireDefault(require("@atlaskit/icon/glyph/drag-handler"));
10
+ var _primitives = require("@atlaskit/primitives");
11
+ /** @jsx jsx */
12
+
13
+ var iconSmallStyles = (0, _primitives.xcss)({
14
+ display: 'inline-flex',
15
+ marginInline: "var(--ds-space-negative-050, -4px)"
16
+ });
17
+ function DragHandleIconSmall(_ref) {
18
+ var label = _ref.label;
19
+ return (0, _react.jsx)(_primitives.Box, {
20
+ xcss: iconSmallStyles
21
+ }, (0, _react.jsx)(_dragHandler.default, {
22
+ label: label,
23
+ size: "small",
24
+ primaryColor: "var(--ds-icon-subtle, #626F86)"
25
+ }));
26
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.DragHandleIcon = DragHandleIcon;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _dragHandler = _interopRequireDefault(require("@atlaskit/icon/glyph/drag-handler"));
10
+ function DragHandleIcon(_ref) {
11
+ var label = _ref.label;
12
+ return /*#__PURE__*/_react.default.createElement(_dragHandler.default, {
13
+ label: label,
14
+ primaryColor: "var(--ds-icon-subtle, #626F86)"
15
+ });
16
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -0,0 +1,74 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ /** @jsx jsx */
3
+
4
+ import { forwardRef } from 'react';
5
+ import { css, jsx } from '@emotion/react';
6
+ import FocusRing from '@atlaskit/focus-ring';
7
+ /**
8
+ * Cannot use `@atlaskit/button` here because it cancels `mousedown` events
9
+ * which prevents dragging.
10
+ */
11
+ const buttonStyles = css({
12
+ borderRadius: "var(--ds-border-radius-100, 3px)",
13
+ padding: "var(--ds-space-0, 0px)",
14
+ width: 'max-content',
15
+ border: 'none',
16
+ cursor: 'grab',
17
+ display: 'flex'
18
+ });
19
+ const buttonAppearanceStyles = {
20
+ default: css({
21
+ backgroundColor: "var(--ds-background-neutral, #091E420F)",
22
+ ':hover': {
23
+ backgroundColor: "var(--ds-background-neutral-hovered, #091E4224)"
24
+ },
25
+ ':active': {
26
+ backgroundColor: "var(--ds-background-neutral-pressed, #091E424F)"
27
+ }
28
+ }),
29
+ subtle: css({
30
+ backgroundColor: "var(--ds-background-neutral-subtle, #00000000)",
31
+ ':hover': {
32
+ backgroundColor: "var(--ds-background-neutral-subtle-hovered, #091E420F)"
33
+ },
34
+ ':active': {
35
+ backgroundColor: "var(--ds-background-neutral-subtle-pressed, #091E4224)"
36
+ }
37
+ }),
38
+ selected: css({
39
+ backgroundColor: "var(--ds-background-selected, #E9F2FF)",
40
+ color: "var(--ds-text-selected, #0C66E4)"
41
+ })
42
+ };
43
+
44
+ /**
45
+ * A button with pre-configured styling to look like a drag handle.
46
+ *
47
+ * This component uses a native button because the `@atlaskit/button`
48
+ * cancels `mouseDown` events, which prevents dragging.
49
+ */
50
+ export const DragHandleButtonBase = /*#__PURE__*/forwardRef(function DragHandleButton({
51
+ children,
52
+ isSelected = false,
53
+ testId,
54
+ appearance: appearanceProp = 'default',
55
+ /**
56
+ * Defaulting to `button` instead of `submit` (native default in some cases).
57
+ *
58
+ * A type of `submit` only makes sense in a form context, and isn't very
59
+ * relevant to a drag handle.
60
+ *
61
+ * `@atlaskit/button` also defaults to a type of `button` as well, as it
62
+ * is more semantically appropriate in a wider range of cases.
63
+ */
64
+ type = 'button',
65
+ ...buttonProps
66
+ }, ref) {
67
+ const appearance = isSelected ? 'selected' : appearanceProp;
68
+ return jsx(FocusRing, null, jsx("button", _extends({
69
+ ref: ref,
70
+ css: [buttonStyles, buttonAppearanceStyles[appearance]],
71
+ "data-testid": testId,
72
+ type: type
73
+ }, buttonProps), children));
74
+ });
@@ -0,0 +1,20 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React, { forwardRef } from 'react';
3
+ import { DragHandleButtonBase } from './drag-handle-button-base';
4
+ import { DragHandleIconSmall } from './drag-handle-icon-small';
5
+ /**
6
+ * A button with pre-configured styling to look like a drag handle.
7
+ *
8
+ * This component uses a native button because the `@atlaskit/button`
9
+ * cancels `mouseDown` events, which prevents dragging.
10
+ */
11
+ export const DragHandleButtonSmall = /*#__PURE__*/forwardRef(function DragHandleButton({
12
+ label,
13
+ ...buttonProps
14
+ }, ref) {
15
+ return /*#__PURE__*/React.createElement(DragHandleButtonBase, _extends({
16
+ ref: ref
17
+ }, buttonProps), /*#__PURE__*/React.createElement(DragHandleIconSmall, {
18
+ label: label
19
+ }));
20
+ });
@@ -1,46 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- /** @jsx jsx */
3
-
4
- import { forwardRef } from 'react';
5
- import { css, jsx } from '@emotion/react';
6
- import FocusRing from '@atlaskit/focus-ring';
7
- import DragHandlerIcon from '@atlaskit/icon/glyph/drag-handler';
8
- /**
9
- * Cannot use `@atlaskit/button` here because it cancels `mousedown` events
10
- * which prevents dragging.
11
- */
12
- const buttonStyles = css({
13
- borderRadius: "var(--ds-border-radius-100, 3px)",
14
- padding: "var(--ds-space-0, 0px)",
15
- width: 'max-content',
16
- border: 'none',
17
- cursor: 'grab',
18
- display: 'flex'
19
- });
20
- const buttonAppearanceStyles = {
21
- default: css({
22
- backgroundColor: "var(--ds-background-neutral, #091E420F)",
23
- ':hover': {
24
- backgroundColor: "var(--ds-background-neutral-hovered, #091E4224)"
25
- },
26
- ':active': {
27
- backgroundColor: "var(--ds-background-neutral-pressed, #091E424F)"
28
- }
29
- }),
30
- subtle: css({
31
- backgroundColor: "var(--ds-background-neutral-subtle, #00000000)",
32
- ':hover': {
33
- backgroundColor: "var(--ds-background-neutral-subtle-hovered, #091E420F)"
34
- },
35
- ':active': {
36
- backgroundColor: "var(--ds-background-neutral-subtle-pressed, #091E4224)"
37
- }
38
- }),
39
- selected: css({
40
- backgroundColor: "var(--ds-background-selected, #E9F2FF)",
41
- color: "var(--ds-text-selected, #0C66E4)"
42
- })
43
- };
2
+ import React, { forwardRef } from 'react';
3
+ import { DragHandleButtonBase } from './drag-handle-button-base';
4
+ import { DragHandleIcon } from './drag-handle-icon';
44
5
  /**
45
6
  * A button with pre-configured styling to look like a drag handle.
46
7
  *
@@ -48,29 +9,12 @@ const buttonAppearanceStyles = {
48
9
  * cancels `mouseDown` events, which prevents dragging.
49
10
  */
50
11
  export const DragHandleButton = /*#__PURE__*/forwardRef(function DragHandleButton({
51
- isSelected = false,
52
- testId,
53
- appearance: appearanceProp = 'default',
54
12
  label,
55
- /**
56
- * Defaulting to `button` instead of `submit` (native default in some cases).
57
- *
58
- * A type of `submit` only makes sense in a form context, and isn't very
59
- * relevant to a drag handle.
60
- *
61
- * `@atlaskit/button` also defaults to a type of `button` as well, as it
62
- * is more semantically appropriate in a wider range of cases.
63
- */
64
- type = 'button',
65
13
  ...buttonProps
66
14
  }, ref) {
67
- const appearance = isSelected ? 'selected' : appearanceProp;
68
- return jsx(FocusRing, null, jsx("button", _extends({
69
- ref: ref,
70
- css: [buttonStyles, buttonAppearanceStyles[appearance]],
71
- "data-testid": testId,
72
- type: type
73
- }, buttonProps), jsx(DragHandlerIcon, {
15
+ return /*#__PURE__*/React.createElement(DragHandleButtonBase, _extends({
16
+ ref: ref
17
+ }, buttonProps), /*#__PURE__*/React.createElement(DragHandleIcon, {
74
18
  label: label
75
- })));
19
+ }));
76
20
  });
@@ -0,0 +1,34 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React, { useCallback } from 'react';
3
+ import DropdownMenu from '@atlaskit/dropdown-menu';
4
+ // eslint-disable-next-line @atlaskit/design-system/no-banned-imports
5
+ import mergeRefs from '@atlaskit/ds-lib/merge-refs';
6
+ import { DragHandleButtonBase } from './drag-handle-button-base';
7
+ import { DragHandleIconSmall } from './drag-handle-icon-small';
8
+ /**
9
+ * A dropdown menu with a predefined trigger, styled to look like a drag handle.
10
+ *
11
+ * The API is designed to mirror the `@atlaskit/dropdown-menu` API.
12
+ */
13
+ export function DragHandleDropdownMenuSmall({
14
+ children,
15
+ triggerRef: consumerRef,
16
+ appearance,
17
+ label
18
+ }) {
19
+ const renderTrigger = useCallback(({
20
+ triggerRef,
21
+ ...triggerProps
22
+ }) => {
23
+ const mergedRef = mergeRefs([consumerRef, triggerRef]);
24
+ return /*#__PURE__*/React.createElement(DragHandleButtonBase, _extends({
25
+ ref: mergedRef,
26
+ appearance: appearance
27
+ }, triggerProps), /*#__PURE__*/React.createElement(DragHandleIconSmall, {
28
+ label: label
29
+ }));
30
+ }, [appearance, consumerRef, label]);
31
+ return /*#__PURE__*/React.createElement(DropdownMenu, {
32
+ trigger: renderTrigger
33
+ }, children);
34
+ }
@@ -0,0 +1,20 @@
1
+ /** @jsx jsx */
2
+
3
+ import { jsx } from '@emotion/react';
4
+ import DragHandlerIcon from '@atlaskit/icon/glyph/drag-handler';
5
+ import { Box, xcss } from '@atlaskit/primitives';
6
+ const iconSmallStyles = xcss({
7
+ display: 'inline-flex',
8
+ marginInline: "var(--ds-space-negative-050, -4px)"
9
+ });
10
+ export function DragHandleIconSmall({
11
+ label
12
+ }) {
13
+ return jsx(Box, {
14
+ xcss: iconSmallStyles
15
+ }, jsx(DragHandlerIcon, {
16
+ label: label,
17
+ size: "small",
18
+ primaryColor: "var(--ds-icon-subtle, #626F86)"
19
+ }));
20
+ }
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import DragHandlerIcon from '@atlaskit/icon/glyph/drag-handler';
3
+ export function DragHandleIcon({
4
+ label
5
+ }) {
6
+ return /*#__PURE__*/React.createElement(DragHandlerIcon, {
7
+ label: label,
8
+ primaryColor: "var(--ds-icon-subtle, #626F86)"
9
+ });
10
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,69 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["children", "isSelected", "testId", "appearance", "type"];
4
+ /** @jsx jsx */
5
+
6
+ import { forwardRef } from 'react';
7
+ import { css, jsx } from '@emotion/react';
8
+ import FocusRing from '@atlaskit/focus-ring';
9
+ /**
10
+ * Cannot use `@atlaskit/button` here because it cancels `mousedown` events
11
+ * which prevents dragging.
12
+ */
13
+ var buttonStyles = css({
14
+ borderRadius: "var(--ds-border-radius-100, 3px)",
15
+ padding: "var(--ds-space-0, 0px)",
16
+ width: 'max-content',
17
+ border: 'none',
18
+ cursor: 'grab',
19
+ display: 'flex'
20
+ });
21
+ var buttonAppearanceStyles = {
22
+ default: css({
23
+ backgroundColor: "var(--ds-background-neutral, #091E420F)",
24
+ ':hover': {
25
+ backgroundColor: "var(--ds-background-neutral-hovered, #091E4224)"
26
+ },
27
+ ':active': {
28
+ backgroundColor: "var(--ds-background-neutral-pressed, #091E424F)"
29
+ }
30
+ }),
31
+ subtle: css({
32
+ backgroundColor: "var(--ds-background-neutral-subtle, #00000000)",
33
+ ':hover': {
34
+ backgroundColor: "var(--ds-background-neutral-subtle-hovered, #091E420F)"
35
+ },
36
+ ':active': {
37
+ backgroundColor: "var(--ds-background-neutral-subtle-pressed, #091E4224)"
38
+ }
39
+ }),
40
+ selected: css({
41
+ backgroundColor: "var(--ds-background-selected, #E9F2FF)",
42
+ color: "var(--ds-text-selected, #0C66E4)"
43
+ })
44
+ };
45
+
46
+ /**
47
+ * A button with pre-configured styling to look like a drag handle.
48
+ *
49
+ * This component uses a native button because the `@atlaskit/button`
50
+ * cancels `mouseDown` events, which prevents dragging.
51
+ */
52
+ export var DragHandleButtonBase = /*#__PURE__*/forwardRef(function DragHandleButton(_ref, ref) {
53
+ var children = _ref.children,
54
+ _ref$isSelected = _ref.isSelected,
55
+ isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected,
56
+ testId = _ref.testId,
57
+ _ref$appearance = _ref.appearance,
58
+ appearanceProp = _ref$appearance === void 0 ? 'default' : _ref$appearance,
59
+ _ref$type = _ref.type,
60
+ type = _ref$type === void 0 ? 'button' : _ref$type,
61
+ buttonProps = _objectWithoutProperties(_ref, _excluded);
62
+ var appearance = isSelected ? 'selected' : appearanceProp;
63
+ return jsx(FocusRing, null, jsx("button", _extends({
64
+ ref: ref,
65
+ css: [buttonStyles, buttonAppearanceStyles[appearance]],
66
+ "data-testid": testId,
67
+ type: type
68
+ }, buttonProps), children));
69
+ });
@@ -0,0 +1,21 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["label"];
4
+ import React, { forwardRef } from 'react';
5
+ import { DragHandleButtonBase } from './drag-handle-button-base';
6
+ import { DragHandleIconSmall } from './drag-handle-icon-small';
7
+ /**
8
+ * A button with pre-configured styling to look like a drag handle.
9
+ *
10
+ * This component uses a native button because the `@atlaskit/button`
11
+ * cancels `mouseDown` events, which prevents dragging.
12
+ */
13
+ export var DragHandleButtonSmall = /*#__PURE__*/forwardRef(function DragHandleButton(_ref, ref) {
14
+ var label = _ref.label,
15
+ buttonProps = _objectWithoutProperties(_ref, _excluded);
16
+ return /*#__PURE__*/React.createElement(DragHandleButtonBase, _extends({
17
+ ref: ref
18
+ }, buttonProps), /*#__PURE__*/React.createElement(DragHandleIconSmall, {
19
+ label: label
20
+ }));
21
+ });
@@ -1,48 +1,9 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["isSelected", "testId", "appearance", "label", "type"];
4
- /** @jsx jsx */
5
-
6
- import { forwardRef } from 'react';
7
- import { css, jsx } from '@emotion/react';
8
- import FocusRing from '@atlaskit/focus-ring';
9
- import DragHandlerIcon from '@atlaskit/icon/glyph/drag-handler';
10
- /**
11
- * Cannot use `@atlaskit/button` here because it cancels `mousedown` events
12
- * which prevents dragging.
13
- */
14
- var buttonStyles = css({
15
- borderRadius: "var(--ds-border-radius-100, 3px)",
16
- padding: "var(--ds-space-0, 0px)",
17
- width: 'max-content',
18
- border: 'none',
19
- cursor: 'grab',
20
- display: 'flex'
21
- });
22
- var buttonAppearanceStyles = {
23
- default: css({
24
- backgroundColor: "var(--ds-background-neutral, #091E420F)",
25
- ':hover': {
26
- backgroundColor: "var(--ds-background-neutral-hovered, #091E4224)"
27
- },
28
- ':active': {
29
- backgroundColor: "var(--ds-background-neutral-pressed, #091E424F)"
30
- }
31
- }),
32
- subtle: css({
33
- backgroundColor: "var(--ds-background-neutral-subtle, #00000000)",
34
- ':hover': {
35
- backgroundColor: "var(--ds-background-neutral-subtle-hovered, #091E420F)"
36
- },
37
- ':active': {
38
- backgroundColor: "var(--ds-background-neutral-subtle-pressed, #091E4224)"
39
- }
40
- }),
41
- selected: css({
42
- backgroundColor: "var(--ds-background-selected, #E9F2FF)",
43
- color: "var(--ds-text-selected, #0C66E4)"
44
- })
45
- };
3
+ var _excluded = ["label"];
4
+ import React, { forwardRef } from 'react';
5
+ import { DragHandleButtonBase } from './drag-handle-button-base';
6
+ import { DragHandleIcon } from './drag-handle-icon';
46
7
  /**
47
8
  * A button with pre-configured styling to look like a drag handle.
48
9
  *
@@ -50,22 +11,11 @@ var buttonAppearanceStyles = {
50
11
  * cancels `mouseDown` events, which prevents dragging.
51
12
  */
52
13
  export var DragHandleButton = /*#__PURE__*/forwardRef(function DragHandleButton(_ref, ref) {
53
- var _ref$isSelected = _ref.isSelected,
54
- isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected,
55
- testId = _ref.testId,
56
- _ref$appearance = _ref.appearance,
57
- appearanceProp = _ref$appearance === void 0 ? 'default' : _ref$appearance,
58
- label = _ref.label,
59
- _ref$type = _ref.type,
60
- type = _ref$type === void 0 ? 'button' : _ref$type,
14
+ var label = _ref.label,
61
15
  buttonProps = _objectWithoutProperties(_ref, _excluded);
62
- var appearance = isSelected ? 'selected' : appearanceProp;
63
- return jsx(FocusRing, null, jsx("button", _extends({
64
- ref: ref,
65
- css: [buttonStyles, buttonAppearanceStyles[appearance]],
66
- "data-testid": testId,
67
- type: type
68
- }, buttonProps), jsx(DragHandlerIcon, {
16
+ return /*#__PURE__*/React.createElement(DragHandleButtonBase, _extends({
17
+ ref: ref
18
+ }, buttonProps), /*#__PURE__*/React.createElement(DragHandleIcon, {
69
19
  label: label
70
- })));
20
+ }));
71
21
  });
@@ -0,0 +1,34 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["triggerRef"];
4
+ import React, { useCallback } from 'react';
5
+ import DropdownMenu from '@atlaskit/dropdown-menu';
6
+ // eslint-disable-next-line @atlaskit/design-system/no-banned-imports
7
+ import mergeRefs from '@atlaskit/ds-lib/merge-refs';
8
+ import { DragHandleButtonBase } from './drag-handle-button-base';
9
+ import { DragHandleIconSmall } from './drag-handle-icon-small';
10
+ /**
11
+ * A dropdown menu with a predefined trigger, styled to look like a drag handle.
12
+ *
13
+ * The API is designed to mirror the `@atlaskit/dropdown-menu` API.
14
+ */
15
+ export function DragHandleDropdownMenuSmall(_ref) {
16
+ var children = _ref.children,
17
+ consumerRef = _ref.triggerRef,
18
+ appearance = _ref.appearance,
19
+ label = _ref.label;
20
+ var renderTrigger = useCallback(function (_ref2) {
21
+ var triggerRef = _ref2.triggerRef,
22
+ triggerProps = _objectWithoutProperties(_ref2, _excluded);
23
+ var mergedRef = mergeRefs([consumerRef, triggerRef]);
24
+ return /*#__PURE__*/React.createElement(DragHandleButtonBase, _extends({
25
+ ref: mergedRef,
26
+ appearance: appearance
27
+ }, triggerProps), /*#__PURE__*/React.createElement(DragHandleIconSmall, {
28
+ label: label
29
+ }));
30
+ }, [appearance, consumerRef, label]);
31
+ return /*#__PURE__*/React.createElement(DropdownMenu, {
32
+ trigger: renderTrigger
33
+ }, children);
34
+ }
@@ -0,0 +1,19 @@
1
+ /** @jsx jsx */
2
+
3
+ import { jsx } from '@emotion/react';
4
+ import DragHandlerIcon from '@atlaskit/icon/glyph/drag-handler';
5
+ import { Box, xcss } from '@atlaskit/primitives';
6
+ var iconSmallStyles = xcss({
7
+ display: 'inline-flex',
8
+ marginInline: "var(--ds-space-negative-050, -4px)"
9
+ });
10
+ export function DragHandleIconSmall(_ref) {
11
+ var label = _ref.label;
12
+ return jsx(Box, {
13
+ xcss: iconSmallStyles
14
+ }, jsx(DragHandlerIcon, {
15
+ label: label,
16
+ size: "small",
17
+ primaryColor: "var(--ds-icon-subtle, #626F86)"
18
+ }));
19
+ }
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import DragHandlerIcon from '@atlaskit/icon/glyph/drag-handler';
3
+ export function DragHandleIcon(_ref) {
4
+ var label = _ref.label;
5
+ return /*#__PURE__*/React.createElement(DragHandlerIcon, {
6
+ label: label,
7
+ primaryColor: "var(--ds-icon-subtle, #626F86)"
8
+ });
9
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ /** @jsx jsx */
2
+ /// <reference types="react" />
3
+ import type { DragHandleButtonProps } from './types';
4
+ export type DragHandleButtonAppearance = 'default' | 'subtle' | 'selected';
5
+ /**
6
+ * A button with pre-configured styling to look like a drag handle.
7
+ *
8
+ * This component uses a native button because the `@atlaskit/button`
9
+ * cancels `mouseDown` events, which prevents dragging.
10
+ */
11
+ export declare const DragHandleButtonBase: import("react").ForwardRefExoticComponent<Omit<DragHandleButtonProps, "label"> & import("react").RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ /**
3
+ * A button with pre-configured styling to look like a drag handle.
4
+ *
5
+ * This component uses a native button because the `@atlaskit/button`
6
+ * cancels `mouseDown` events, which prevents dragging.
7
+ */
8
+ export declare const DragHandleButtonSmall: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & import("./types").DragHandleSharedProps & {
9
+ isSelected?: boolean | undefined;
10
+ testId?: string | undefined;
11
+ } & React.RefAttributes<HTMLButtonElement>>;
@@ -1,49 +1,11 @@
1
- /** @jsx jsx */
2
- import { ButtonHTMLAttributes } from 'react';
3
- export type DragHandleButtonAppearance = 'default' | 'subtle' | 'selected';
4
- export type DragHandleButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {
5
- /**
6
- * Change the style to indicate the button is selected
7
- */
8
- isSelected?: boolean;
9
- /**
10
- * A `testId` prop is provided for specified elements, which is a unique string
11
- * that appears as a data attribute `data-testid` in the rendered code,
12
- * serving as a hook for automated tests
13
- */
14
- testId?: string;
15
- /**
16
- * The base styling to apply to the button
17
- */
18
- appearance?: DragHandleButtonAppearance;
19
- /**
20
- * Text used to describe what the button is in context.
21
- */
22
- label: string;
23
- };
1
+ import React from 'react';
24
2
  /**
25
3
  * A button with pre-configured styling to look like a drag handle.
26
4
  *
27
5
  * This component uses a native button because the `@atlaskit/button`
28
6
  * cancels `mouseDown` events, which prevents dragging.
29
7
  */
30
- export declare const DragHandleButton: import("react").ForwardRefExoticComponent<ButtonHTMLAttributes<HTMLButtonElement> & {
31
- /**
32
- * Change the style to indicate the button is selected
33
- */
8
+ export declare const DragHandleButton: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & import("./types").DragHandleSharedProps & {
34
9
  isSelected?: boolean | undefined;
35
- /**
36
- * A `testId` prop is provided for specified elements, which is a unique string
37
- * that appears as a data attribute `data-testid` in the rendered code,
38
- * serving as a hook for automated tests
39
- */
40
10
  testId?: string | undefined;
41
- /**
42
- * The base styling to apply to the button
43
- */
44
- appearance?: DragHandleButtonAppearance | undefined;
45
- /**
46
- * Text used to describe what the button is in context.
47
- */
48
- label: string;
49
- } & import("react").RefAttributes<HTMLButtonElement>>;
11
+ } & React.RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import type { DragHandleDropdownMenuProps } from './types';
3
+ /**
4
+ * A dropdown menu with a predefined trigger, styled to look like a drag handle.
5
+ *
6
+ * The API is designed to mirror the `@atlaskit/dropdown-menu` API.
7
+ */
8
+ export declare function DragHandleDropdownMenuSmall({ children, triggerRef: consumerRef, appearance, label, }: DragHandleDropdownMenuProps): JSX.Element;
@@ -1,23 +1,5 @@
1
- import { ReactElement, Ref } from 'react';
2
- import { DragHandleButtonAppearance } from './drag-handle-button';
3
- export type DragHandleDropdownMenuProps = {
4
- /**
5
- * The contents of the dropdown menu.
6
- */
7
- children: ReactElement;
8
- /**
9
- * Ref for the button which acts as the dropdown trigger.
10
- */
11
- triggerRef: Ref<HTMLButtonElement>;
12
- /**
13
- * The appearance of the button which acts as the dropdown trigger.
14
- */
15
- appearance?: DragHandleButtonAppearance;
16
- /**
17
- * The string used as the button label.
18
- */
19
- label: string;
20
- };
1
+ /// <reference types="react" />
2
+ import type { DragHandleDropdownMenuProps } from './types';
21
3
  /**
22
4
  * A dropdown menu with a predefined trigger, styled to look like a drag handle.
23
5
  *
@@ -0,0 +1,4 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ import type { DragHandleIconProps } from './types';
4
+ export declare function DragHandleIconSmall({ label }: DragHandleIconProps): jsx.JSX.Element;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import type { DragHandleIconProps } from './types';
3
+ export declare function DragHandleIcon({ label }: DragHandleIconProps): JSX.Element;
@@ -0,0 +1,37 @@
1
+ import { ButtonHTMLAttributes, ReactElement, Ref } from 'react';
2
+ export type DragHandleButtonAppearance = 'default' | 'subtle' | 'selected';
3
+ export type DragHandleSharedProps = {
4
+ /**
5
+ * The base styling to apply to the button
6
+ */
7
+ appearance?: DragHandleButtonAppearance;
8
+ /**
9
+ * Text used to describe what the button is in context.
10
+ */
11
+ label: string;
12
+ };
13
+ export type DragHandleButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & DragHandleSharedProps & {
14
+ /**
15
+ * Change the style to indicate the button is selected
16
+ */
17
+ isSelected?: boolean;
18
+ /**
19
+ * A `testId` prop is provided for specified elements, which is a unique string
20
+ * that appears as a data attribute `data-testid` in the rendered code,
21
+ * serving as a hook for automated tests
22
+ */
23
+ testId?: string;
24
+ };
25
+ export type DragHandleIconProps = {
26
+ label: string;
27
+ };
28
+ export type DragHandleDropdownMenuProps = DragHandleSharedProps & {
29
+ /**
30
+ * The contents of the dropdown menu.
31
+ */
32
+ children: ReactElement;
33
+ /**
34
+ * Ref for the button which acts as the dropdown trigger.
35
+ */
36
+ triggerRef: Ref<HTMLButtonElement>;
37
+ };
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ /** @jsx jsx */
3
+ import type { DragHandleButtonProps } from './types';
4
+ export type DragHandleButtonAppearance = 'default' | 'subtle' | 'selected';
5
+ /**
6
+ * A button with pre-configured styling to look like a drag handle.
7
+ *
8
+ * This component uses a native button because the `@atlaskit/button`
9
+ * cancels `mouseDown` events, which prevents dragging.
10
+ */
11
+ export declare const DragHandleButtonBase: import("react").ForwardRefExoticComponent<Omit<DragHandleButtonProps, "label"> & import("react").RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ /**
3
+ * A button with pre-configured styling to look like a drag handle.
4
+ *
5
+ * This component uses a native button because the `@atlaskit/button`
6
+ * cancels `mouseDown` events, which prevents dragging.
7
+ */
8
+ export declare const DragHandleButtonSmall: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & import("./types").DragHandleSharedProps & {
9
+ isSelected?: boolean | undefined;
10
+ testId?: string | undefined;
11
+ } & React.RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ /**
3
+ * A button with pre-configured styling to look like a drag handle.
4
+ *
5
+ * This component uses a native button because the `@atlaskit/button`
6
+ * cancels `mouseDown` events, which prevents dragging.
7
+ */
8
+ export declare const DragHandleButton: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & import("./types").DragHandleSharedProps & {
9
+ isSelected?: boolean | undefined;
10
+ testId?: string | undefined;
11
+ } & React.RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import type { DragHandleDropdownMenuProps } from './types';
3
+ /**
4
+ * A dropdown menu with a predefined trigger, styled to look like a drag handle.
5
+ *
6
+ * The API is designed to mirror the `@atlaskit/dropdown-menu` API.
7
+ */
8
+ export declare function DragHandleDropdownMenuSmall({ children, triggerRef: consumerRef, appearance, label, }: DragHandleDropdownMenuProps): JSX.Element;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import type { DragHandleDropdownMenuProps } from './types';
3
+ /**
4
+ * A dropdown menu with a predefined trigger, styled to look like a drag handle.
5
+ *
6
+ * The API is designed to mirror the `@atlaskit/dropdown-menu` API.
7
+ */
8
+ export declare function DragHandleDropdownMenu({ children, triggerRef: consumerRef, appearance, label, }: DragHandleDropdownMenuProps): JSX.Element;
@@ -0,0 +1,4 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ import type { DragHandleIconProps } from './types';
4
+ export declare function DragHandleIconSmall({ label }: DragHandleIconProps): jsx.JSX.Element;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import type { DragHandleIconProps } from './types';
3
+ export declare function DragHandleIcon({ label }: DragHandleIconProps): JSX.Element;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * This file exists for module resolution purposes.
3
+ */
4
+ declare const _default: {};
5
+ export default _default;
@@ -0,0 +1,37 @@
1
+ import { ButtonHTMLAttributes, ReactElement, Ref } from 'react';
2
+ export type DragHandleButtonAppearance = 'default' | 'subtle' | 'selected';
3
+ export type DragHandleSharedProps = {
4
+ /**
5
+ * The base styling to apply to the button
6
+ */
7
+ appearance?: DragHandleButtonAppearance;
8
+ /**
9
+ * Text used to describe what the button is in context.
10
+ */
11
+ label: string;
12
+ };
13
+ export type DragHandleButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & DragHandleSharedProps & {
14
+ /**
15
+ * Change the style to indicate the button is selected
16
+ */
17
+ isSelected?: boolean;
18
+ /**
19
+ * A `testId` prop is provided for specified elements, which is a unique string
20
+ * that appears as a data attribute `data-testid` in the rendered code,
21
+ * serving as a hook for automated tests
22
+ */
23
+ testId?: string;
24
+ };
25
+ export type DragHandleIconProps = {
26
+ label: string;
27
+ };
28
+ export type DragHandleDropdownMenuProps = DragHandleSharedProps & {
29
+ /**
30
+ * The contents of the dropdown menu.
31
+ */
32
+ children: ReactElement;
33
+ /**
34
+ * Ref for the button which acts as the dropdown trigger.
35
+ */
36
+ triggerRef: Ref<HTMLButtonElement>;
37
+ };
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "@atlaskit/pragmatic-drag-and-drop-react-accessibility/drag-handle-button-small",
3
+ "main": "../dist/cjs/drag-handle-button-small.js",
4
+ "module": "../dist/esm/drag-handle-button-small.js",
5
+ "module:es2019": "../dist/es2019/drag-handle-button-small.js",
6
+ "sideEffects": false,
7
+ "types": "../dist/types/drag-handle-button-small.d.ts",
8
+ "typesVersions": {
9
+ ">=4.5 <4.9": {
10
+ "*": [
11
+ "../dist/types-ts4.5/drag-handle-button-small.d.ts"
12
+ ]
13
+ }
14
+ }
15
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "@atlaskit/pragmatic-drag-and-drop-react-accessibility/drag-handle-dropdown-menu-small",
3
+ "main": "../dist/cjs/drag-handle-dropdown-menu-small.js",
4
+ "module": "../dist/esm/drag-handle-dropdown-menu-small.js",
5
+ "module:es2019": "../dist/es2019/drag-handle-dropdown-menu-small.js",
6
+ "sideEffects": false,
7
+ "types": "../dist/types/drag-handle-dropdown-menu-small.d.ts",
8
+ "typesVersions": {
9
+ ">=4.5 <4.9": {
10
+ "*": [
11
+ "../dist/types-ts4.5/drag-handle-dropdown-menu-small.d.ts"
12
+ ]
13
+ }
14
+ }
15
+ }
@@ -1,3 +1,3 @@
1
- import type { DragHandleButtonProps } from '../src/drag-handle-button';
1
+ import type { DragHandleButtonProps } from '../src/types';
2
2
 
3
3
  export default function ({}: DragHandleButtonProps) {}
@@ -1,3 +1,3 @@
1
- import type { DragHandleDropdownMenuProps } from '../src/drag-handle-dropdown-menu';
1
+ import type { DragHandleDropdownMenuProps } from '../src/types';
2
2
 
3
3
  export default function ({}: DragHandleDropdownMenuProps) {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/pragmatic-drag-and-drop-react-accessibility",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "description": "Optional react components to help implement accessible alternative flows for Pragmatic drag and drop",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -37,14 +37,17 @@
37
37
  "atlaskit:src": "src/index.tsx",
38
38
  "af:exports": {
39
39
  "./drag-handle-button": "./src/drag-handle-button.tsx",
40
- "./drag-handle-dropdown-menu": "./src/drag-handle-dropdown-menu.tsx"
40
+ "./drag-handle-dropdown-menu": "./src/drag-handle-dropdown-menu.tsx",
41
+ "./drag-handle-button-small": "./src/drag-handle-button-small.tsx",
42
+ "./drag-handle-dropdown-menu-small": "./src/drag-handle-dropdown-menu-small.tsx"
41
43
  },
42
44
  "dependencies": {
43
- "@atlaskit/dropdown-menu": "^12.0.0",
45
+ "@atlaskit/dropdown-menu": "^12.1.0",
44
46
  "@atlaskit/ds-lib": "^2.2.3",
45
47
  "@atlaskit/focus-ring": "^1.3.4",
46
48
  "@atlaskit/icon": "^21.12.6",
47
- "@atlaskit/tokens": "^1.25.0",
49
+ "@atlaskit/primitives": "^1.6.1",
50
+ "@atlaskit/tokens": "^1.26.0",
48
51
  "@babel/runtime": "^7.0.0",
49
52
  "@emotion/react": "^11.7.1"
50
53
  },
@@ -0,0 +1,13 @@
1
+ ## API Report File for "@atlaskit/pragmatic-drag-and-drop-react-accessibility"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+
7
+ // @public
8
+ const _default: {};
9
+ export default _default;
10
+
11
+ // (No @packageDocumentation comment for this package)
12
+
13
+ ```