@atlaskit/menu 1.8.1 → 1.9.1

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,17 @@
1
1
  # @atlaskit/menu
2
2
 
3
+ ## 1.9.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 1.9.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`0af122e7d0f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/0af122e7d0f) - [ux] Prop isList in Section component allows to add `<ul>` and `<li>` elements around the items to better semantic markup if it is a list of items
14
+
3
15
  ## 1.8.1
4
16
 
5
17
  ### Patch Changes
@@ -34,7 +34,7 @@ var skeletonStyles = (0, _react.css)({
34
34
  // This is a little bespoke but we need to push everything down 1px
35
35
  // because the skeleton content should align to the bottom of the text.
36
36
  // Confirm VR test failures before accepting a change.
37
- // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage-spacing
37
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
38
38
  marginTop: 1,
39
39
  backgroundColor: skeletonColor,
40
40
  borderRadius: skeletonTextBorderRadius,
@@ -70,9 +70,9 @@ var beforeElementStyles = (0, _react.css)({
70
70
  '::before': {
71
71
  width: skeletonItemElemSize,
72
72
  height: skeletonItemElemSize,
73
- // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage-spacing
73
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
74
74
  marginRight: itemElemSpacing + itemElemSkeletonOffset,
75
- // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage-spacing
75
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
76
76
  marginLeft: itemElemSkeletonOffset,
77
77
  flexShrink: 0,
78
78
  backgroundColor: skeletonColor,
@@ -14,8 +14,8 @@ var _colors = require("@atlaskit/theme/colors");
14
14
  var _constants = require("@atlaskit/theme/constants");
15
15
  var _typography = require("@atlaskit/theme/typography");
16
16
  var _headingItem = _interopRequireDefault(require("../menu-item/heading-item"));
17
- var _excluded = ["children", "overrides", "title", "testId", "isScrollable", "hasSeparator", "id"];
18
- /* eslint-disable @atlaskit/design-system/ensure-design-token-usage-spacing */
17
+ var _excluded = ["children", "overrides", "title", "testId", "isScrollable", "hasSeparator", "id", "isList"];
18
+ /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
19
19
  /** @jsx jsx */
20
20
  // eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
21
21
  var gridSize = (0, _constants.gridSize)();
@@ -96,17 +96,34 @@ var Section = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
96
96
  isScrollable = _ref.isScrollable,
97
97
  hasSeparator = _ref.hasSeparator,
98
98
  id = _ref.id,
99
+ _ref$isList = _ref.isList,
100
+ isList = _ref$isList === void 0 ? false : _ref$isList,
99
101
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
100
102
  (0, _deprecationWarning.propDeprecationWarning)("@atlaskit/menu", 'overrides', overrides !== undefined, '' // TODO: Create DAC post when primitives/xcss are available as alternatives
101
103
  );
102
104
 
105
+ var content = isList ? (0, _react2.jsx)("ul", {
106
+ style: {
107
+ margin: 0,
108
+ padding: 0
109
+ }
110
+ }, _react.Children.map(_react.Children.toArray(children), function (child, index) {
111
+ return (0, _react2.jsx)("li", {
112
+ style: {
113
+ listStyleType: 'none',
114
+ margin: 0,
115
+ padding: 0
116
+ },
117
+ key: index
118
+ }, child);
119
+ })) : children;
103
120
  var childrenMarkup = title !== undefined ? (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(_headingItem.default
104
121
  // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
105
122
  , {
106
123
  cssFn: overrides && overrides.HeadingItem && overrides.HeadingItem.cssFn,
107
124
  testId: testId && "".concat(testId, "--heading"),
108
125
  "aria-hidden": true
109
- }, title), children) : children;
126
+ }, title), content) : (0, _react2.jsx)(_react.Fragment, null, content);
110
127
  return (0, _react2.jsx)("div", (0, _extends2.default)({}, rest, {
111
128
  id: id
112
129
  // NOTE: Firefox allows elements that have "overflow: auto" to gain focus (as if it had tab-index="0")
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/menu",
3
- "version": "1.8.1",
3
+ "version": "1.9.1",
4
4
  "sideEffects": false
5
5
  }
@@ -29,7 +29,7 @@ const skeletonStyles = css({
29
29
  // This is a little bespoke but we need to push everything down 1px
30
30
  // because the skeleton content should align to the bottom of the text.
31
31
  // Confirm VR test failures before accepting a change.
32
- // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage-spacing
32
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
33
33
  marginTop: 1,
34
34
  backgroundColor: skeletonColor,
35
35
  borderRadius: skeletonTextBorderRadius,
@@ -65,9 +65,9 @@ const beforeElementStyles = css({
65
65
  '::before': {
66
66
  width: skeletonItemElemSize,
67
67
  height: skeletonItemElemSize,
68
- // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage-spacing
68
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
69
69
  marginRight: itemElemSpacing + itemElemSkeletonOffset,
70
- // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage-spacing
70
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
71
71
  marginLeft: itemElemSkeletonOffset,
72
72
  flexShrink: 0,
73
73
  backgroundColor: skeletonColor,
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- /* eslint-disable @atlaskit/design-system/ensure-design-token-usage-spacing */
2
+ /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
3
3
  /** @jsx jsx */
4
- import { forwardRef, Fragment } from 'react';
4
+ import { Children, forwardRef, Fragment } from 'react';
5
5
  import { css, jsx } from '@emotion/react';
6
6
  import { propDeprecationWarning } from '@atlaskit/ds-lib/deprecation-warning';
7
7
  import { N30A } from '@atlaskit/theme/colors';
@@ -87,18 +87,32 @@ const Section = /*#__PURE__*/forwardRef(({
87
87
  isScrollable,
88
88
  hasSeparator,
89
89
  id,
90
+ isList = false,
90
91
  ...rest
91
92
  }, ref) => {
92
93
  propDeprecationWarning("@atlaskit/menu", 'overrides', overrides !== undefined, '' // TODO: Create DAC post when primitives/xcss are available as alternatives
93
94
  );
94
95
 
96
+ const content = isList ? jsx("ul", {
97
+ style: {
98
+ margin: 0,
99
+ padding: 0
100
+ }
101
+ }, Children.map(Children.toArray(children), (child, index) => jsx("li", {
102
+ style: {
103
+ listStyleType: 'none',
104
+ margin: 0,
105
+ padding: 0
106
+ },
107
+ key: index
108
+ }, child))) : children;
95
109
  const childrenMarkup = title !== undefined ? jsx(Fragment, null, jsx(HeadingItem
96
110
  // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
97
111
  , {
98
112
  cssFn: overrides && overrides.HeadingItem && overrides.HeadingItem.cssFn,
99
113
  testId: testId && `${testId}--heading`,
100
114
  "aria-hidden": true
101
- }, title), children) : children;
115
+ }, title), content) : jsx(Fragment, null, content);
102
116
  return jsx("div", _extends({}, rest, {
103
117
  id: id
104
118
  // NOTE: Firefox allows elements that have "overflow: auto" to gain focus (as if it had tab-index="0")
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/menu",
3
- "version": "1.8.1",
3
+ "version": "1.9.1",
4
4
  "sideEffects": false
5
5
  }
@@ -29,7 +29,7 @@ var skeletonStyles = css({
29
29
  // This is a little bespoke but we need to push everything down 1px
30
30
  // because the skeleton content should align to the bottom of the text.
31
31
  // Confirm VR test failures before accepting a change.
32
- // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage-spacing
32
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
33
33
  marginTop: 1,
34
34
  backgroundColor: skeletonColor,
35
35
  borderRadius: skeletonTextBorderRadius,
@@ -65,9 +65,9 @@ var beforeElementStyles = css({
65
65
  '::before': {
66
66
  width: skeletonItemElemSize,
67
67
  height: skeletonItemElemSize,
68
- // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage-spacing
68
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
69
69
  marginRight: itemElemSpacing + itemElemSkeletonOffset,
70
- // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage-spacing
70
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
71
71
  marginLeft: itemElemSkeletonOffset,
72
72
  flexShrink: 0,
73
73
  backgroundColor: skeletonColor,
@@ -1,9 +1,9 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["children", "overrides", "title", "testId", "isScrollable", "hasSeparator", "id"];
4
- /* eslint-disable @atlaskit/design-system/ensure-design-token-usage-spacing */
3
+ var _excluded = ["children", "overrides", "title", "testId", "isScrollable", "hasSeparator", "id", "isList"];
4
+ /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
5
5
  /** @jsx jsx */
6
- import { forwardRef, Fragment } from 'react';
6
+ import { Children, forwardRef, Fragment } from 'react';
7
7
  import { css, jsx } from '@emotion/react';
8
8
  import { propDeprecationWarning } from '@atlaskit/ds-lib/deprecation-warning';
9
9
  import { N30A } from '@atlaskit/theme/colors';
@@ -89,17 +89,34 @@ var Section = /*#__PURE__*/forwardRef(function (_ref, ref) {
89
89
  isScrollable = _ref.isScrollable,
90
90
  hasSeparator = _ref.hasSeparator,
91
91
  id = _ref.id,
92
+ _ref$isList = _ref.isList,
93
+ isList = _ref$isList === void 0 ? false : _ref$isList,
92
94
  rest = _objectWithoutProperties(_ref, _excluded);
93
95
  propDeprecationWarning("@atlaskit/menu", 'overrides', overrides !== undefined, '' // TODO: Create DAC post when primitives/xcss are available as alternatives
94
96
  );
95
97
 
98
+ var content = isList ? jsx("ul", {
99
+ style: {
100
+ margin: 0,
101
+ padding: 0
102
+ }
103
+ }, Children.map(Children.toArray(children), function (child, index) {
104
+ return jsx("li", {
105
+ style: {
106
+ listStyleType: 'none',
107
+ margin: 0,
108
+ padding: 0
109
+ },
110
+ key: index
111
+ }, child);
112
+ })) : children;
96
113
  var childrenMarkup = title !== undefined ? jsx(Fragment, null, jsx(HeadingItem
97
114
  // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
98
115
  , {
99
116
  cssFn: overrides && overrides.HeadingItem && overrides.HeadingItem.cssFn,
100
117
  testId: testId && "".concat(testId, "--heading"),
101
118
  "aria-hidden": true
102
- }, title), children) : children;
119
+ }, title), content) : jsx(Fragment, null, content);
103
120
  return jsx("div", _extends({}, rest, {
104
121
  id: id
105
122
  // NOTE: Firefox allows elements that have "overflow: auto" to gain focus (as if it had tab-index="0")
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/menu",
3
- "version": "1.8.1",
3
+ "version": "1.9.1",
4
4
  "sideEffects": false
5
5
  }
@@ -110,6 +110,10 @@ export interface SectionProps {
110
110
  * the HeadingItem will not be rendered, and this component acts as a regular Section
111
111
  */
112
112
  title?: string;
113
+ /**
114
+ * Specifically adds <ul> and <li> elements around the items for better semantic markup if it is a list of items
115
+ */
116
+ isList?: boolean;
113
117
  }
114
118
  export interface MenuItemPrimitiveProps {
115
119
  children: (props: {
@@ -110,6 +110,10 @@ export interface SectionProps {
110
110
  * the HeadingItem will not be rendered, and this component acts as a regular Section
111
111
  */
112
112
  title?: string;
113
+ /**
114
+ * Specifically adds <ul> and <li> elements around the items for better semantic markup if it is a list of items
115
+ */
116
+ isList?: boolean;
113
117
  }
114
118
  export interface MenuItemPrimitiveProps {
115
119
  children: (props: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/menu",
3
- "version": "1.8.1",
3
+ "version": "1.9.1",
4
4
  "description": "A collection of composable menu components that can be used anywhere.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -51,9 +51,9 @@
51
51
  "@atlaskit/ds-lib": "^2.2.0",
52
52
  "@atlaskit/focus-ring": "^1.3.0",
53
53
  "@atlaskit/platform-feature-flags": "^0.2.0",
54
- "@atlaskit/primitives": "^0.14.0",
54
+ "@atlaskit/primitives": "^0.15.0",
55
55
  "@atlaskit/theme": "^12.5.0",
56
- "@atlaskit/tokens": "^1.9.0",
56
+ "@atlaskit/tokens": "^1.10.0",
57
57
  "@babel/runtime": "^7.0.0",
58
58
  "@emotion/react": "^11.7.1"
59
59
  },
package/report.api.md CHANGED
@@ -197,6 +197,7 @@ interface SectionProps {
197
197
  children: React.ReactNode;
198
198
  hasSeparator?: boolean;
199
199
  id?: string;
200
+ isList?: boolean;
200
201
  isScrollable?: boolean;
201
202
  // @deprecated (undocumented)
202
203
  overrides?: {
@@ -155,6 +155,7 @@ interface SectionProps {
155
155
  children: React.ReactNode;
156
156
  hasSeparator?: boolean;
157
157
  id?: string;
158
+ isList?: boolean;
158
159
  isScrollable?: boolean;
159
160
  // @deprecated (undocumented)
160
161
  overrides?: {