@atlaskit/primitives 1.2.2 → 1.2.3

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/primitives
2
2
 
3
+ ## 1.2.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`dfd014c15b3`](https://bitbucket.org/atlassian/atlassian-frontend/commits/dfd014c15b3) - [ux] Pressable primitive: Adds missing cursor style `not-allowed` for disabled buttons
8
+
3
9
  ## 1.2.2
4
10
 
5
11
  ### Patch Changes
@@ -15,10 +15,6 @@ var _box = _interopRequireDefault(require("./box"));
15
15
  var _excluded = ["children", "backgroundColor", "padding", "paddingBlock", "paddingBlockStart", "paddingBlockEnd", "paddingInline", "paddingInlineStart", "paddingInlineEnd", "isDisabled", "type", "testId", "xcss"];
16
16
  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); }
17
17
  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; }
18
- var defaultStyles = (0, _xcss.xcss)({
19
- cursor: 'pointer'
20
- });
21
-
22
18
  // TODO: Duplicated FocusRing styles due to lack of `xcss` support
23
19
  // and to prevent additional dependency
24
20
  var baseFocusRingStyles = {
@@ -67,9 +63,12 @@ var UNSAFE_PRESSABLE = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref)
67
63
  xcssStyles = _ref.xcss,
68
64
  htmlAttributes = (0, _objectWithoutProperties2.default)(_ref, _excluded);
69
65
  // Combine default styles with supplied styles. XCSS does not support deep nested arrays
70
- var styles = [defaultStyles, focusRingStyles];
66
+ var styles = [(0, _xcss.xcss)({
67
+ cursor: isDisabled ? 'not-allowed' : 'pointer'
68
+ }), focusRingStyles];
71
69
  styles = Array.isArray(xcssStyles) ? [].concat((0, _toConsumableArray2.default)(styles), (0, _toConsumableArray2.default)(xcssStyles)) : [].concat((0, _toConsumableArray2.default)(styles), [xcssStyles]);
72
70
  return /*#__PURE__*/_react.default.createElement(_box.default, (0, _extends2.default)({}, htmlAttributes, {
71
+ as: "button",
73
72
  ref: ref,
74
73
  testId: testId,
75
74
  type: type,
@@ -80,8 +79,7 @@ var UNSAFE_PRESSABLE = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref)
80
79
  paddingBlockEnd: paddingBlockEnd,
81
80
  paddingInline: paddingInline,
82
81
  paddingInlineStart: paddingInlineStart,
83
- paddingInlineEnd: paddingInlineEnd,
84
- as: "button"
82
+ paddingInlineEnd: paddingInlineEnd
85
83
  // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
86
84
  ,
87
85
  xcss: styles,
@@ -2,10 +2,6 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { forwardRef } from 'react';
3
3
  import { xcss } from '../xcss/xcss';
4
4
  import Box from './box';
5
- const defaultStyles = xcss({
6
- cursor: 'pointer'
7
- });
8
-
9
5
  // TODO: Duplicated FocusRing styles due to lack of `xcss` support
10
6
  // and to prevent additional dependency
11
7
  const baseFocusRingStyles = {
@@ -54,9 +50,12 @@ const UNSAFE_PRESSABLE = /*#__PURE__*/forwardRef(({
54
50
  ...htmlAttributes
55
51
  }, ref) => {
56
52
  // Combine default styles with supplied styles. XCSS does not support deep nested arrays
57
- let styles = [defaultStyles, focusRingStyles];
53
+ let styles = [xcss({
54
+ cursor: isDisabled ? 'not-allowed' : 'pointer'
55
+ }), focusRingStyles];
58
56
  styles = Array.isArray(xcssStyles) ? [...styles, ...xcssStyles] : [...styles, xcssStyles];
59
57
  return /*#__PURE__*/React.createElement(Box, _extends({}, htmlAttributes, {
58
+ as: "button",
60
59
  ref: ref,
61
60
  testId: testId,
62
61
  type: type,
@@ -67,8 +66,7 @@ const UNSAFE_PRESSABLE = /*#__PURE__*/forwardRef(({
67
66
  paddingBlockEnd: paddingBlockEnd,
68
67
  paddingInline: paddingInline,
69
68
  paddingInlineStart: paddingInlineStart,
70
- paddingInlineEnd: paddingInlineEnd,
71
- as: "button"
69
+ paddingInlineEnd: paddingInlineEnd
72
70
  // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
73
71
  ,
74
72
  xcss: styles,
@@ -5,10 +5,6 @@ var _excluded = ["children", "backgroundColor", "padding", "paddingBlock", "padd
5
5
  import React, { forwardRef } from 'react';
6
6
  import { xcss } from '../xcss/xcss';
7
7
  import Box from './box';
8
- var defaultStyles = xcss({
9
- cursor: 'pointer'
10
- });
11
-
12
8
  // TODO: Duplicated FocusRing styles due to lack of `xcss` support
13
9
  // and to prevent additional dependency
14
10
  var baseFocusRingStyles = {
@@ -57,9 +53,12 @@ var UNSAFE_PRESSABLE = /*#__PURE__*/forwardRef(function (_ref, ref) {
57
53
  xcssStyles = _ref.xcss,
58
54
  htmlAttributes = _objectWithoutProperties(_ref, _excluded);
59
55
  // Combine default styles with supplied styles. XCSS does not support deep nested arrays
60
- var styles = [defaultStyles, focusRingStyles];
56
+ var styles = [xcss({
57
+ cursor: isDisabled ? 'not-allowed' : 'pointer'
58
+ }), focusRingStyles];
61
59
  styles = Array.isArray(xcssStyles) ? [].concat(_toConsumableArray(styles), _toConsumableArray(xcssStyles)) : [].concat(_toConsumableArray(styles), [xcssStyles]);
62
60
  return /*#__PURE__*/React.createElement(Box, _extends({}, htmlAttributes, {
61
+ as: "button",
63
62
  ref: ref,
64
63
  testId: testId,
65
64
  type: type,
@@ -70,8 +69,7 @@ var UNSAFE_PRESSABLE = /*#__PURE__*/forwardRef(function (_ref, ref) {
70
69
  paddingBlockEnd: paddingBlockEnd,
71
70
  paddingInline: paddingInline,
72
71
  paddingInlineStart: paddingInlineStart,
73
- paddingInlineEnd: paddingInlineEnd,
74
- as: "button"
72
+ paddingInlineEnd: paddingInlineEnd
75
73
  // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
76
74
  ,
77
75
  xcss: styles,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/primitives",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "Primitives are token-backed low-level building blocks.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"