@atlaskit/menu 1.4.7 → 1.4.8

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 (48) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cjs/entry-points/menu-item/button-item.js +0 -2
  3. package/dist/cjs/entry-points/menu-item/custom-item.js +0 -2
  4. package/dist/cjs/entry-points/menu-item/heading-item.js +0 -2
  5. package/dist/cjs/entry-points/menu-item/link-item.js +0 -2
  6. package/dist/cjs/entry-points/menu-item/skeleton-heading-item.js +0 -2
  7. package/dist/cjs/entry-points/menu-item/skeleton-item.js +0 -2
  8. package/dist/cjs/entry-points/menu-section/menu-group.js +0 -2
  9. package/dist/cjs/entry-points/menu-section/popup-menu-group.js +0 -2
  10. package/dist/cjs/entry-points/menu-section/section.js +0 -2
  11. package/dist/cjs/index.js +0 -10
  12. package/dist/cjs/internal/components/menu-item-primitive.js +25 -34
  13. package/dist/cjs/internal/components/skeleton-shimmer.js +4 -8
  14. package/dist/cjs/menu-item/button-item.js +21 -30
  15. package/dist/cjs/menu-item/custom-item.js +24 -32
  16. package/dist/cjs/menu-item/heading-item.js +8 -17
  17. package/dist/cjs/menu-item/link-item.js +23 -33
  18. package/dist/cjs/menu-item/skeleton-heading-item.js +11 -16
  19. package/dist/cjs/menu-item/skeleton-item.js +11 -17
  20. package/dist/cjs/menu-section/menu-group.js +10 -17
  21. package/dist/cjs/menu-section/popup-menu-group.js +6 -13
  22. package/dist/cjs/menu-section/section.js +16 -24
  23. package/dist/cjs/version.json +1 -1
  24. package/dist/es2019/internal/components/menu-item-primitive.js +9 -12
  25. package/dist/es2019/internal/components/skeleton-shimmer.js +3 -4
  26. package/dist/es2019/menu-item/button-item.js +4 -6
  27. package/dist/es2019/menu-item/custom-item.js +8 -7
  28. package/dist/es2019/menu-item/heading-item.js +3 -3
  29. package/dist/es2019/menu-item/link-item.js +5 -8
  30. package/dist/es2019/menu-item/skeleton-heading-item.js +6 -5
  31. package/dist/es2019/menu-item/skeleton-item.js +4 -3
  32. package/dist/es2019/menu-section/menu-group.js +4 -6
  33. package/dist/es2019/menu-section/popup-menu-group.js +3 -4
  34. package/dist/es2019/menu-section/section.js +9 -8
  35. package/dist/es2019/version.json +1 -1
  36. package/dist/esm/internal/components/menu-item-primitive.js +24 -27
  37. package/dist/esm/internal/components/skeleton-shimmer.js +5 -6
  38. package/dist/esm/menu-item/button-item.js +21 -24
  39. package/dist/esm/menu-item/custom-item.js +26 -26
  40. package/dist/esm/menu-item/heading-item.js +8 -9
  41. package/dist/esm/menu-item/link-item.js +23 -27
  42. package/dist/esm/menu-item/skeleton-heading-item.js +11 -10
  43. package/dist/esm/menu-item/skeleton-item.js +11 -10
  44. package/dist/esm/menu-section/menu-group.js +10 -13
  45. package/dist/esm/menu-section/popup-menu-group.js +7 -9
  46. package/dist/esm/menu-section/section.js +16 -16
  47. package/dist/esm/version.json +1 -1
  48. package/package.json +1 -1
@@ -1,16 +1,15 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  var _excluded = ["children", "href", "cssFn", "description", "iconAfter", "iconBefore", "isDisabled", "isSelected", "onClick", "testId", "overrides", "onMouseDown", "shouldTitleWrap", "shouldDescriptionWrap"];
4
-
5
4
  /** @jsx jsx */
6
5
  import { forwardRef, memo } from 'react';
7
6
  import { jsx } from '@emotion/react';
8
7
  import noop from '@atlaskit/ds-lib/noop';
9
8
  import MenuItemPrimitive from '../internal/components/menu-item-primitive';
10
-
11
9
  var preventEvent = function preventEvent(e) {
12
10
  e.preventDefault();
13
11
  };
12
+
14
13
  /**
15
14
  * __Link item__
16
15
  *
@@ -19,35 +18,31 @@ var preventEvent = function preventEvent(e) {
19
18
  * - [Examples](https://atlaskit.atlassian.com/packages/design-system/menu/docs/link-item)
20
19
  * - [Code](https://atlaskit.atlassian.com/packages/design-system/menu)
21
20
  */
22
-
23
-
24
- var LinkItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef( // Type needed on props to extract types with extract react types.
21
+ var LinkItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(
22
+ // Type needed on props to extract types with extract react types.
25
23
  function (props, ref) {
26
24
  var children = props.children,
27
- href = props.href,
28
- _props$cssFn = props.cssFn,
29
- cssFn = _props$cssFn === void 0 ? noop : _props$cssFn,
30
- description = props.description,
31
- iconAfter = props.iconAfter,
32
- iconBefore = props.iconBefore,
33
- _props$isDisabled = props.isDisabled,
34
- isDisabled = _props$isDisabled === void 0 ? false : _props$isDisabled,
35
- _props$isSelected = props.isSelected,
36
- isSelected = _props$isSelected === void 0 ? false : _props$isSelected,
37
- onClick = props.onClick,
38
- testId = props.testId,
39
- overrides = props.overrides,
40
- onMouseDown = props.onMouseDown,
41
- shouldTitleWrap = props.shouldTitleWrap,
42
- shouldDescriptionWrap = props.shouldDescriptionWrap,
43
- rest = _objectWithoutProperties(props, _excluded);
44
-
25
+ href = props.href,
26
+ _props$cssFn = props.cssFn,
27
+ cssFn = _props$cssFn === void 0 ? noop : _props$cssFn,
28
+ description = props.description,
29
+ iconAfter = props.iconAfter,
30
+ iconBefore = props.iconBefore,
31
+ _props$isDisabled = props.isDisabled,
32
+ isDisabled = _props$isDisabled === void 0 ? false : _props$isDisabled,
33
+ _props$isSelected = props.isSelected,
34
+ isSelected = _props$isSelected === void 0 ? false : _props$isSelected,
35
+ onClick = props.onClick,
36
+ testId = props.testId,
37
+ overrides = props.overrides,
38
+ onMouseDown = props.onMouseDown,
39
+ shouldTitleWrap = props.shouldTitleWrap,
40
+ shouldDescriptionWrap = props.shouldDescriptionWrap,
41
+ rest = _objectWithoutProperties(props, _excluded);
45
42
  var onMouseDownHandler = onMouseDown;
46
-
47
43
  if (!children) {
48
44
  return null;
49
45
  }
50
-
51
46
  return jsx(MenuItemPrimitive, _extends({}, rest, {
52
47
  // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
53
48
  overrides: overrides,
@@ -58,7 +53,8 @@ function (props, ref) {
58
53
  description: description,
59
54
  shouldTitleWrap: shouldTitleWrap,
60
55
  shouldDescriptionWrap: shouldDescriptionWrap,
61
- css: // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
56
+ css:
57
+ // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
62
58
  cssFn({
63
59
  isSelected: isSelected,
64
60
  isDisabled: isDisabled
@@ -66,7 +62,7 @@ function (props, ref) {
66
62
  title: children
67
63
  }), function (_ref) {
68
64
  var children = _ref.children,
69
- className = _ref.className;
65
+ className = _ref.className;
70
66
  return jsx("a", _extends({
71
67
  "data-testid": testId
72
68
  }, rest, {
@@ -1,14 +1,15 @@
1
1
  /** @jsx jsx */
2
+
2
3
  import { css, jsx } from '@emotion/react';
3
4
  import noop from '@atlaskit/ds-lib/noop';
4
5
  import { N20A } from '@atlaskit/theme/colors';
5
6
  import SkeletonShimmer from '../internal/components/skeleton-shimmer';
6
7
  var skeletonStyles = css({
7
- padding: "var(--ds-scale-0, 0px)".concat(" ", "var(--ds-scale-250, 20px)"),
8
+ padding: "var(--ds-space-0, 0px)".concat(" ", "var(--ds-space-250, 20px)"),
8
9
  '::after': {
9
10
  display: 'block',
10
11
  width: '30%',
11
- height: "var(--ds-scale-100, 8px)",
12
+ height: "var(--ds-space-100, 8px)",
12
13
  backgroundColor: "var(--ds-skeleton, ".concat(N20A, ")"),
13
14
  borderRadius: 100,
14
15
  content: '""'
@@ -24,6 +25,7 @@ var customWidthStyles = css({
24
25
  width: 'var(--width)'
25
26
  }
26
27
  });
28
+
27
29
  /**
28
30
  * __Skeleton heading item__
29
31
  *
@@ -32,14 +34,13 @@ var customWidthStyles = css({
32
34
  * - [Examples](https://atlaskit.atlassian.com/packages/design-system/menu/docs/skeleton-heading-item)
33
35
  * - [Code](https://atlaskit.atlassian.com/packages/design-system/menu)
34
36
  */
35
-
36
37
  var SkeletonHeadingItem = function SkeletonHeadingItem(_ref) {
37
38
  var _ref$isShimmering = _ref.isShimmering,
38
- isShimmering = _ref$isShimmering === void 0 ? false : _ref$isShimmering,
39
- testId = _ref.testId,
40
- width = _ref.width,
41
- _ref$cssFn = _ref.cssFn,
42
- cssFn = _ref$cssFn === void 0 ? noop : _ref$cssFn;
39
+ isShimmering = _ref$isShimmering === void 0 ? false : _ref$isShimmering,
40
+ testId = _ref.testId,
41
+ width = _ref.width,
42
+ _ref$cssFn = _ref.cssFn,
43
+ cssFn = _ref$cssFn === void 0 ? noop : _ref$cssFn;
43
44
  return jsx(SkeletonShimmer, {
44
45
  isShimmering: isShimmering
45
46
  }, function (_ref2) {
@@ -49,12 +50,12 @@ var SkeletonHeadingItem = function SkeletonHeadingItem(_ref) {
49
50
  style: {
50
51
  '--width': width
51
52
  },
52
- css: [skeletonStyles, width ? customWidthStyles : defaultWidthStyles, // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
53
+ css: [skeletonStyles, width ? customWidthStyles : defaultWidthStyles,
54
+ // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
53
55
  css(cssFn(undefined))],
54
56
  "data-ds--menu--skeleton-heading-item": true,
55
57
  "data-testid": testId
56
58
  });
57
59
  });
58
60
  };
59
-
60
61
  export default SkeletonHeadingItem;
@@ -1,4 +1,5 @@
1
1
  /** @jsx jsx */
2
+
2
3
  import { css, jsx } from '@emotion/react';
3
4
  import noop from '@atlaskit/ds-lib/noop';
4
5
  import { N20A } from '@atlaskit/theme/colors';
@@ -78,6 +79,7 @@ var iconStyles = css({
78
79
  borderRadius: borderRadius
79
80
  }
80
81
  });
82
+
81
83
  /**
82
84
  * __Skeleton item__
83
85
  *
@@ -86,16 +88,15 @@ var iconStyles = css({
86
88
  * - [Examples](https://atlaskit.atlassian.com/packages/design-system/menu/docs/skeleton-item)
87
89
  * - [Code](https://atlaskit.atlassian.com/packages/design-system/menu)
88
90
  */
89
-
90
91
  var SkeletonItem = function SkeletonItem(_ref) {
91
92
  var hasAvatar = _ref.hasAvatar,
92
- hasIcon = _ref.hasIcon,
93
- _ref$isShimmering = _ref.isShimmering,
94
- isShimmering = _ref$isShimmering === void 0 ? false : _ref$isShimmering,
95
- testId = _ref.testId,
96
- width = _ref.width,
97
- _ref$cssFn = _ref.cssFn,
98
- cssFn = _ref$cssFn === void 0 ? noop : _ref$cssFn;
93
+ hasIcon = _ref.hasIcon,
94
+ _ref$isShimmering = _ref.isShimmering,
95
+ isShimmering = _ref$isShimmering === void 0 ? false : _ref$isShimmering,
96
+ testId = _ref.testId,
97
+ width = _ref.width,
98
+ _ref$cssFn = _ref.cssFn,
99
+ cssFn = _ref$cssFn === void 0 ? noop : _ref$cssFn;
99
100
  return jsx(SkeletonShimmer, {
100
101
  isShimmering: isShimmering
101
102
  }, function (_ref2) {
@@ -105,11 +106,11 @@ var SkeletonItem = function SkeletonItem(_ref) {
105
106
  style: {
106
107
  '--width': width
107
108
  },
108
- css: [skeletonStyles, (hasAvatar || hasIcon) && beforeElementStyles, hasAvatar && avatarStyles, hasIcon && iconStyles, width ? customWidthStyles : defaultWidthStyles, // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
109
+ css: [skeletonStyles, (hasAvatar || hasIcon) && beforeElementStyles, hasAvatar && avatarStyles, hasIcon && iconStyles, width ? customWidthStyles : defaultWidthStyles,
110
+ // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
109
111
  css(cssFn())],
110
112
  "data-testid": testId
111
113
  });
112
114
  });
113
115
  };
114
-
115
116
  export default SkeletonItem;
@@ -1,11 +1,9 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  var _excluded = ["maxWidth", "minWidth", "minHeight", "maxHeight", "testId", "role"];
4
-
5
4
  /** @jsx jsx */
6
5
  import { jsx } from '@emotion/react';
7
6
  import { UNSAFE_Box as Box } from '@atlaskit/ds-explorations';
8
-
9
7
  /**
10
8
  * __Menu group__
11
9
  *
@@ -16,14 +14,14 @@ import { UNSAFE_Box as Box } from '@atlaskit/ds-explorations';
16
14
  */
17
15
  var MenuGroup = function MenuGroup(_ref) {
18
16
  var maxWidth = _ref.maxWidth,
19
- minWidth = _ref.minWidth,
20
- minHeight = _ref.minHeight,
21
- maxHeight = _ref.maxHeight,
22
- testId = _ref.testId,
23
- role = _ref.role,
24
- rest = _objectWithoutProperties(_ref, _excluded);
25
-
26
- return (// @ts-ignore type of rest/children needs to be made stricter to fit in Box -- string shouldn't be allowed
17
+ minWidth = _ref.minWidth,
18
+ minHeight = _ref.minHeight,
19
+ maxHeight = _ref.maxHeight,
20
+ testId = _ref.testId,
21
+ role = _ref.role,
22
+ rest = _objectWithoutProperties(_ref, _excluded);
23
+ return (
24
+ // @ts-ignore type of rest/children needs to be made stricter to fit in Box -- string shouldn't be allowed
27
25
  jsx(Box, _extends({
28
26
  UNSAFE_style: {
29
27
  minWidth: minWidth,
@@ -36,10 +34,9 @@ var MenuGroup = function MenuGroup(_ref) {
36
34
  overflow: "auto",
37
35
  testId: testId,
38
36
  role: role,
39
- position: "static" // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
40
-
37
+ position: "static"
38
+ // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
41
39
  }, rest))
42
40
  );
43
41
  };
44
-
45
42
  export default MenuGroup;
@@ -1,27 +1,25 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  var _excluded = ["maxWidth", "minWidth"];
4
-
5
4
  /** @jsx jsx */
6
5
  import { jsx } from '@emotion/react';
7
6
  import MenuGroup from './menu-group';
7
+
8
8
  /**
9
9
  * @deprecated
10
10
  */
11
-
12
11
  var PopupMenuGroup = function PopupMenuGroup(_ref) {
13
12
  var _ref$maxWidth = _ref.maxWidth,
14
- maxWidth = _ref$maxWidth === void 0 ? 800 : _ref$maxWidth,
15
- _ref$minWidth = _ref.minWidth,
16
- minWidth = _ref$minWidth === void 0 ? 320 : _ref$minWidth,
17
- rest = _objectWithoutProperties(_ref, _excluded);
18
-
19
- return (// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
13
+ maxWidth = _ref$maxWidth === void 0 ? 800 : _ref$maxWidth,
14
+ _ref$minWidth = _ref.minWidth,
15
+ minWidth = _ref$minWidth === void 0 ? 320 : _ref$minWidth,
16
+ rest = _objectWithoutProperties(_ref, _excluded);
17
+ return (
18
+ // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
20
19
  jsx(MenuGroup, _extends({
21
20
  maxWidth: maxWidth,
22
21
  minWidth: minWidth
23
22
  }, rest))
24
23
  );
25
24
  };
26
-
27
25
  export default PopupMenuGroup;
@@ -1,7 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  var _excluded = ["children", "overrides", "title", "testId", "isScrollable", "hasSeparator", "id"];
4
-
5
4
  /** @jsx jsx */
6
5
  import { forwardRef, Fragment } from 'react';
7
6
  import { css, jsx } from '@emotion/react';
@@ -11,15 +10,15 @@ import { headingSizes } from '@atlaskit/theme/typography';
11
10
  import HeadingItem from '../menu-item/heading-item';
12
11
  var gridSize = gridSizeFn();
13
12
  var itemHeadingTopMargin = gridSize * 2.5;
14
- var itemHeadingBottomMargin = gridSize * 0.75; // Skeleton content is slightly shorter than the real content.
13
+ var itemHeadingBottomMargin = gridSize * 0.75;
14
+ // Skeleton content is slightly shorter than the real content.
15
15
  // Because of that we slightly increase the top margin to offset this so the
16
16
  // containing size both real and skeleton always equal approx 30px.
17
-
18
17
  var itemHeadingContentHeight = headingSizes.h100.lineHeight;
19
18
  var skeletonHeadingHeight = gridSize;
20
19
  var skeletonHeadingMarginOffset = 3;
21
- var skeletonHeadingTopMargin = itemHeadingTopMargin + (itemHeadingContentHeight - skeletonHeadingHeight) - skeletonHeadingMarginOffset; // We want to move the entire body up by 3px without affecting the height of the skeleton container.
22
-
20
+ var skeletonHeadingTopMargin = itemHeadingTopMargin + (itemHeadingContentHeight - skeletonHeadingHeight) - skeletonHeadingMarginOffset;
21
+ // We want to move the entire body up by 3px without affecting the height of the skeleton container.
23
22
  var skeletonHeadingBottomMargin = itemHeadingBottomMargin + skeletonHeadingMarginOffset;
24
23
  var sectionPaddingTopBottom = gridSize * 0.75;
25
24
  var VAR_SEPARATOR_COLOR = '--ds-menu-seperator-color';
@@ -70,6 +69,7 @@ var noSeparatorStyles = css({
70
69
  marginTop: -6
71
70
  }
72
71
  });
72
+
73
73
  /**
74
74
  * __Section__
75
75
  *
@@ -78,25 +78,25 @@ var noSeparatorStyles = css({
78
78
  * - [Examples](https://atlaskit.atlassian.com/packages/design-system/menu/docs/section)
79
79
  * - [Code](https://atlaskit.atlassian.com/packages/design-system/menu)
80
80
  */
81
-
82
81
  var Section = /*#__PURE__*/forwardRef(function (_ref, ref) {
83
82
  var children = _ref.children,
84
- overrides = _ref.overrides,
85
- title = _ref.title,
86
- testId = _ref.testId,
87
- isScrollable = _ref.isScrollable,
88
- hasSeparator = _ref.hasSeparator,
89
- id = _ref.id,
90
- rest = _objectWithoutProperties(_ref, _excluded);
91
-
92
- var childrenMarkup = title !== undefined ? jsx(Fragment, null, jsx(HeadingItem // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
83
+ overrides = _ref.overrides,
84
+ title = _ref.title,
85
+ testId = _ref.testId,
86
+ isScrollable = _ref.isScrollable,
87
+ hasSeparator = _ref.hasSeparator,
88
+ id = _ref.id,
89
+ rest = _objectWithoutProperties(_ref, _excluded);
90
+ var childrenMarkup = title !== undefined ? jsx(Fragment, null, jsx(HeadingItem
91
+ // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
93
92
  , {
94
93
  cssFn: overrides && overrides.HeadingItem && overrides.HeadingItem.cssFn,
95
94
  testId: testId && "".concat(testId, "--heading"),
96
95
  "aria-hidden": true
97
96
  }, title), children) : children;
98
97
  return jsx("div", _extends({}, rest, {
99
- id: id // NOTE: Firefox allows elements that have "overflow: auto" to gain focus (as if it had tab-index="0")
98
+ id: id
99
+ // NOTE: Firefox allows elements that have "overflow: auto" to gain focus (as if it had tab-index="0")
100
100
  // We have made a deliberate choice to leave this behaviour as is.
101
101
  ,
102
102
  css: [sectionStyles, isScrollable ? scrollableStyles : unscrollableStyles, hasSeparator ? separatorStyles : noSeparatorStyles],
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/menu",
3
- "version": "1.4.7",
3
+ "version": "1.4.8",
4
4
  "sideEffects": false
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/menu",
3
- "version": "1.4.7",
3
+ "version": "1.4.8",
4
4
  "description": "A collection of composable menu components that can be used anywhere.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"