@atlaskit/menu 2.1.3 → 2.1.5
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 +12 -0
- package/dist/cjs/menu-item/heading-item.js +5 -1
- package/dist/es2019/menu-item/heading-item.js +3 -0
- package/dist/esm/menu-item/heading-item.js +5 -1
- package/dist/types/menu-item/heading-item.d.ts +1 -1
- package/dist/types/types.d.ts +8 -3
- package/dist/types-ts4.5/menu-item/heading-item.d.ts +1 -1
- package/dist/types-ts4.5/types.d.ts +8 -3
- package/package.json +3 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/menu
|
|
2
2
|
|
|
3
|
+
## 2.1.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 2.1.4
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#58913](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/58913) [`36796c121e2a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/36796c121e2a) - [ux] This change includes heading role for HeadingItem and new prop `headingLevel` to specify the level of heading to be defined by assistive technologies.
|
|
14
|
+
|
|
3
15
|
## 2.1.3
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -14,7 +14,7 @@ var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
|
|
|
14
14
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
15
|
var _colors = require("@atlaskit/theme/colors");
|
|
16
16
|
var _typography = require("@atlaskit/theme/typography");
|
|
17
|
-
var _excluded = ["children", "testId", "id", "cssFn", "className"];
|
|
17
|
+
var _excluded = ["children", "testId", "headingLevel", "id", "cssFn", "className"];
|
|
18
18
|
/** @jsx jsx */
|
|
19
19
|
var itemHeadingContentHeight = _typography.headingSizes.h100.lineHeight;
|
|
20
20
|
var itemHeadingFontSize = _typography.headingSizes.h100.size;
|
|
@@ -39,6 +39,8 @@ var headingStyles = (0, _react2.css)({
|
|
|
39
39
|
var HeadingItem = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
40
40
|
var children = _ref.children,
|
|
41
41
|
testId = _ref.testId,
|
|
42
|
+
_ref$headingLevel = _ref.headingLevel,
|
|
43
|
+
headingLevel = _ref$headingLevel === void 0 ? 2 : _ref$headingLevel,
|
|
42
44
|
id = _ref.id,
|
|
43
45
|
_ref$cssFn = _ref.cssFn,
|
|
44
46
|
cssFn = _ref$cssFn === void 0 ? _noop.default : _ref$cssFn,
|
|
@@ -52,6 +54,8 @@ var HeadingItem = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
52
54
|
css: [headingStyles,
|
|
53
55
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
54
56
|
UNSAFE_overrides],
|
|
57
|
+
role: "heading",
|
|
58
|
+
"aria-level": headingLevel,
|
|
55
59
|
"data-testid": testId,
|
|
56
60
|
"data-ds--menu--heading-item": true,
|
|
57
61
|
id: id,
|
|
@@ -30,6 +30,7 @@ const headingStyles = css({
|
|
|
30
30
|
const HeadingItem = /*#__PURE__*/memo(({
|
|
31
31
|
children,
|
|
32
32
|
testId,
|
|
33
|
+
headingLevel = 2,
|
|
33
34
|
id,
|
|
34
35
|
cssFn = noop,
|
|
35
36
|
// Although this isn't defined on props it is available because we've used
|
|
@@ -47,6 +48,8 @@ const HeadingItem = /*#__PURE__*/memo(({
|
|
|
47
48
|
css: [headingStyles,
|
|
48
49
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
49
50
|
UNSAFE_overrides],
|
|
51
|
+
role: "heading",
|
|
52
|
+
"aria-level": headingLevel,
|
|
50
53
|
"data-testid": testId,
|
|
51
54
|
"data-ds--menu--heading-item": true,
|
|
52
55
|
id: id,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["children", "testId", "id", "cssFn", "className"];
|
|
3
|
+
var _excluded = ["children", "testId", "headingLevel", "id", "cssFn", "className"];
|
|
4
4
|
/** @jsx jsx */
|
|
5
5
|
import { memo } from 'react';
|
|
6
6
|
import { css, jsx } from '@emotion/react';
|
|
@@ -32,6 +32,8 @@ var headingStyles = css({
|
|
|
32
32
|
var HeadingItem = /*#__PURE__*/memo(function (_ref) {
|
|
33
33
|
var children = _ref.children,
|
|
34
34
|
testId = _ref.testId,
|
|
35
|
+
_ref$headingLevel = _ref.headingLevel,
|
|
36
|
+
headingLevel = _ref$headingLevel === void 0 ? 2 : _ref$headingLevel,
|
|
35
37
|
id = _ref.id,
|
|
36
38
|
_ref$cssFn = _ref.cssFn,
|
|
37
39
|
cssFn = _ref$cssFn === void 0 ? noop : _ref$cssFn,
|
|
@@ -45,6 +47,8 @@ var HeadingItem = /*#__PURE__*/memo(function (_ref) {
|
|
|
45
47
|
css: [headingStyles,
|
|
46
48
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
47
49
|
UNSAFE_overrides],
|
|
50
|
+
role: "heading",
|
|
51
|
+
"aria-level": headingLevel,
|
|
48
52
|
"data-testid": testId,
|
|
49
53
|
"data-ds--menu--heading-item": true,
|
|
50
54
|
id: id,
|
|
@@ -9,5 +9,5 @@ import type { HeadingItemProps } from '../types';
|
|
|
9
9
|
* - [Examples](https://atlaskit.atlassian.com/packages/design-system/menu/docs/heading-item)
|
|
10
10
|
* - [Code](https://atlaskit.atlassian.com/packages/design-system/menu)
|
|
11
11
|
*/
|
|
12
|
-
declare const HeadingItem: import("react").MemoExoticComponent<({ children, testId, id, cssFn, className: UNSAFE_className, ...rest }: HeadingItemProps) => jsx.JSX.Element>;
|
|
12
|
+
declare const HeadingItem: import("react").MemoExoticComponent<({ children, testId, headingLevel, id, cssFn, className: UNSAFE_className, ...rest }: HeadingItemProps) => jsx.JSX.Element>;
|
|
13
13
|
export default HeadingItem;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -111,7 +111,7 @@ export interface SectionProps {
|
|
|
111
111
|
};
|
|
112
112
|
/**
|
|
113
113
|
* The text passed into the internal HeadingItem. If a title is not provided,
|
|
114
|
-
* the HeadingItem will not be rendered, and this component acts as a regular Section
|
|
114
|
+
* the HeadingItem will not be rendered, and this component acts as a regular Section.
|
|
115
115
|
*/
|
|
116
116
|
title?: string;
|
|
117
117
|
/**
|
|
@@ -282,12 +282,12 @@ export interface CustomItemProps<TCustomComponentProps = CustomItemComponentProp
|
|
|
282
282
|
/**
|
|
283
283
|
Custom component to render as an item. This can be both a functional component or a class component.
|
|
284
284
|
|
|
285
|
-
__Will return `null` if no component is
|
|
285
|
+
__Will return `null` if no component is defined__.
|
|
286
286
|
|
|
287
287
|
Props passed to `CustomItem` will be passed down to this component. If the props for `component` have TypeScript types,
|
|
288
288
|
CustomItem will extend them, providing type safety for your custom item.
|
|
289
289
|
|
|
290
|
-
|
|
290
|
+
E.g. `<CustomItem to="/link" component={RouterLink} />`.
|
|
291
291
|
|
|
292
292
|
__NOTE:__ Make sure the reference for this component does not change between renders else undefined behavior may happen.
|
|
293
293
|
*/
|
|
@@ -349,6 +349,11 @@ export interface HeadingItemProps {
|
|
|
349
349
|
* serving as a hook for automated tests.
|
|
350
350
|
*/
|
|
351
351
|
testId?: string;
|
|
352
|
+
/**
|
|
353
|
+
* Specifies the heading level in the document structure.
|
|
354
|
+
* If not specified, level 2 will be applied by default.
|
|
355
|
+
*/
|
|
356
|
+
headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
352
357
|
}
|
|
353
358
|
export interface SkeletonHeadingItemProps {
|
|
354
359
|
/**
|
|
@@ -9,5 +9,5 @@ import type { HeadingItemProps } from '../types';
|
|
|
9
9
|
* - [Examples](https://atlaskit.atlassian.com/packages/design-system/menu/docs/heading-item)
|
|
10
10
|
* - [Code](https://atlaskit.atlassian.com/packages/design-system/menu)
|
|
11
11
|
*/
|
|
12
|
-
declare const HeadingItem: import("react").MemoExoticComponent<({ children, testId, id, cssFn, className: UNSAFE_className, ...rest }: HeadingItemProps) => jsx.JSX.Element>;
|
|
12
|
+
declare const HeadingItem: import("react").MemoExoticComponent<({ children, testId, headingLevel, id, cssFn, className: UNSAFE_className, ...rest }: HeadingItemProps) => jsx.JSX.Element>;
|
|
13
13
|
export default HeadingItem;
|
|
@@ -111,7 +111,7 @@ export interface SectionProps {
|
|
|
111
111
|
};
|
|
112
112
|
/**
|
|
113
113
|
* The text passed into the internal HeadingItem. If a title is not provided,
|
|
114
|
-
* the HeadingItem will not be rendered, and this component acts as a regular Section
|
|
114
|
+
* the HeadingItem will not be rendered, and this component acts as a regular Section.
|
|
115
115
|
*/
|
|
116
116
|
title?: string;
|
|
117
117
|
/**
|
|
@@ -282,12 +282,12 @@ export interface CustomItemProps<TCustomComponentProps = CustomItemComponentProp
|
|
|
282
282
|
/**
|
|
283
283
|
Custom component to render as an item. This can be both a functional component or a class component.
|
|
284
284
|
|
|
285
|
-
__Will return `null` if no component is
|
|
285
|
+
__Will return `null` if no component is defined__.
|
|
286
286
|
|
|
287
287
|
Props passed to `CustomItem` will be passed down to this component. If the props for `component` have TypeScript types,
|
|
288
288
|
CustomItem will extend them, providing type safety for your custom item.
|
|
289
289
|
|
|
290
|
-
|
|
290
|
+
E.g. `<CustomItem to="/link" component={RouterLink} />`.
|
|
291
291
|
|
|
292
292
|
__NOTE:__ Make sure the reference for this component does not change between renders else undefined behavior may happen.
|
|
293
293
|
*/
|
|
@@ -349,6 +349,11 @@ export interface HeadingItemProps {
|
|
|
349
349
|
* serving as a hook for automated tests.
|
|
350
350
|
*/
|
|
351
351
|
testId?: string;
|
|
352
|
+
/**
|
|
353
|
+
* Specifies the heading level in the document structure.
|
|
354
|
+
* If not specified, level 2 will be applied by default.
|
|
355
|
+
*/
|
|
356
|
+
headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
352
357
|
}
|
|
353
358
|
export interface SkeletonHeadingItemProps {
|
|
354
359
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/menu",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.5",
|
|
4
4
|
"description": "A collection of composable menu components that can be used anywhere.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
"@atlaskit/ds-lib": "^2.2.0",
|
|
46
46
|
"@atlaskit/focus-ring": "^1.3.0",
|
|
47
47
|
"@atlaskit/platform-feature-flags": "^0.2.0",
|
|
48
|
-
"@atlaskit/primitives": "^
|
|
48
|
+
"@atlaskit/primitives": "^2.0.0",
|
|
49
49
|
"@atlaskit/theme": "^12.6.0",
|
|
50
|
-
"@atlaskit/tokens": "^1.
|
|
50
|
+
"@atlaskit/tokens": "^1.35.0",
|
|
51
51
|
"@babel/runtime": "^7.0.0",
|
|
52
52
|
"@emotion/react": "^11.7.1"
|
|
53
53
|
},
|
|
@@ -60,7 +60,6 @@
|
|
|
60
60
|
"@af/integration-testing": "*",
|
|
61
61
|
"@af/visual-regression": "*",
|
|
62
62
|
"@atlaskit/visual-regression": "*",
|
|
63
|
-
"@atlaskit/webdriver-runner": "*",
|
|
64
63
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
65
64
|
"@atlassian/feature-flags-test-utils": "*",
|
|
66
65
|
"@emotion/jest": "^11.8.0",
|