@atlaskit/menu 5.0.1 → 6.0.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.
- package/CHANGELOG.md +16 -0
- package/dist/cjs/menu-section/section.js +9 -7
- package/dist/es2019/menu-section/section.js +7 -6
- package/dist/esm/menu-section/section.js +9 -7
- package/dist/types/index.d.ts +1 -1
- package/dist/types/types.d.ts +6 -29
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/dist/types-ts4.5/types.d.ts +6 -29
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/menu
|
|
2
2
|
|
|
3
|
+
## 6.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#148607](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/148607)
|
|
8
|
+
[`474e66c7b2f54`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/474e66c7b2f54) -
|
|
9
|
+
Removed deprecated `overrides` prop from Section. Introduced `isSideNavSection` prop on Section
|
|
10
|
+
which when true renders headings with reduced padding. This prop was added exclusively to support
|
|
11
|
+
existing functionality in `@atlaskit/side-navigation` and will be removed once the new navigation
|
|
12
|
+
system fully rolls out. It should not be used outside of the Side Navigation component. Removed
|
|
13
|
+
deprecated `Overrides` and `TitleOverrides` types.
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 5.0.1
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -9,10 +9,9 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
9
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
10
|
var _react = require("react");
|
|
11
11
|
var _react2 = require("@emotion/react");
|
|
12
|
-
var _deprecationWarning = require("@atlaskit/ds-lib/deprecation-warning");
|
|
13
12
|
var _colors = require("@atlaskit/theme/colors");
|
|
14
13
|
var _headingItem = _interopRequireDefault(require("../menu-item/heading-item"));
|
|
15
|
-
var _excluded = ["children", "
|
|
14
|
+
var _excluded = ["children", "title", "titleId", "testId", "isScrollable", "hasSeparator", "id", "isList", "isSideNavSection", "className"];
|
|
16
15
|
/**
|
|
17
16
|
* @jsxRuntime classic
|
|
18
17
|
* @jsx jsx
|
|
@@ -88,6 +87,11 @@ var noSeparatorStyles = (0, _react2.css)({
|
|
|
88
87
|
marginBlockStart: -6
|
|
89
88
|
}
|
|
90
89
|
});
|
|
90
|
+
var sideNavSectionHeadingStyles = function sideNavSectionHeadingStyles() {
|
|
91
|
+
return {
|
|
92
|
+
paddingInline: "var(--ds-space-100, 8px)"
|
|
93
|
+
};
|
|
94
|
+
};
|
|
91
95
|
|
|
92
96
|
/**
|
|
93
97
|
* __Section__
|
|
@@ -99,7 +103,6 @@ var noSeparatorStyles = (0, _react2.css)({
|
|
|
99
103
|
*/
|
|
100
104
|
var Section = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
101
105
|
var children = _ref.children,
|
|
102
|
-
overrides = _ref.overrides,
|
|
103
106
|
title = _ref.title,
|
|
104
107
|
titleId = _ref.titleId,
|
|
105
108
|
testId = _ref.testId,
|
|
@@ -108,11 +111,10 @@ var Section = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
108
111
|
id = _ref.id,
|
|
109
112
|
_ref$isList = _ref.isList,
|
|
110
113
|
isList = _ref$isList === void 0 ? false : _ref$isList,
|
|
114
|
+
_ref$isSideNavSection = _ref.isSideNavSection,
|
|
115
|
+
isSideNavSection = _ref$isSideNavSection === void 0 ? false : _ref$isSideNavSection,
|
|
111
116
|
UNSAFE_className = _ref.className,
|
|
112
117
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
113
|
-
(0, _deprecationWarning.propDeprecationWarning)("@atlaskit/menu" || '', 'overrides', overrides !== undefined, '' // TODO: Create DAC post when primitives/xcss are available as alternatives
|
|
114
|
-
);
|
|
115
|
-
var UNSAFE_headingOverrides = overrides && overrides.HeadingItem && overrides.HeadingItem.cssFn;
|
|
116
118
|
var content = isList ? (0, _react2.jsx)("ul", {
|
|
117
119
|
style: {
|
|
118
120
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
@@ -134,7 +136,7 @@ var Section = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
134
136
|
var childrenMarkup = title !== undefined ? (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(_headingItem.default
|
|
135
137
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
|
|
136
138
|
, {
|
|
137
|
-
cssFn:
|
|
139
|
+
cssFn: isSideNavSection ? sideNavSectionHeadingStyles : undefined,
|
|
138
140
|
testId: testId && "".concat(testId, "--heading"),
|
|
139
141
|
"aria-hidden": true
|
|
140
142
|
}, title), content) : (0, _react2.jsx)(_react.Fragment, null, content);
|
|
@@ -7,7 +7,6 @@ import { Children, forwardRef, Fragment } from 'react';
|
|
|
7
7
|
|
|
8
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
9
|
import { css, jsx } from '@emotion/react';
|
|
10
|
-
import { propDeprecationWarning } from '@atlaskit/ds-lib/deprecation-warning';
|
|
11
10
|
import { N30A } from '@atlaskit/theme/colors';
|
|
12
11
|
import HeadingItem from '../menu-item/heading-item';
|
|
13
12
|
const gridSize = 8;
|
|
@@ -80,6 +79,11 @@ const noSeparatorStyles = css({
|
|
|
80
79
|
marginBlockStart: -6
|
|
81
80
|
}
|
|
82
81
|
});
|
|
82
|
+
const sideNavSectionHeadingStyles = () => {
|
|
83
|
+
return {
|
|
84
|
+
paddingInline: "var(--ds-space-100, 8px)"
|
|
85
|
+
};
|
|
86
|
+
};
|
|
83
87
|
|
|
84
88
|
/**
|
|
85
89
|
* __Section__
|
|
@@ -91,7 +95,6 @@ const noSeparatorStyles = css({
|
|
|
91
95
|
*/
|
|
92
96
|
const Section = /*#__PURE__*/forwardRef(({
|
|
93
97
|
children,
|
|
94
|
-
overrides,
|
|
95
98
|
title,
|
|
96
99
|
titleId,
|
|
97
100
|
testId,
|
|
@@ -99,6 +102,7 @@ const Section = /*#__PURE__*/forwardRef(({
|
|
|
99
102
|
hasSeparator,
|
|
100
103
|
id,
|
|
101
104
|
isList = false,
|
|
105
|
+
isSideNavSection = false,
|
|
102
106
|
// Although this isn't defined on props it is available because we've used
|
|
103
107
|
// Spread props below and on the jsx element. To forcibly block usage I've
|
|
104
108
|
// picked it out and supressed the expected type error.
|
|
@@ -106,9 +110,6 @@ const Section = /*#__PURE__*/forwardRef(({
|
|
|
106
110
|
className: UNSAFE_className,
|
|
107
111
|
...rest
|
|
108
112
|
}, ref) => {
|
|
109
|
-
propDeprecationWarning("@atlaskit/menu" || '', 'overrides', overrides !== undefined, '' // TODO: Create DAC post when primitives/xcss are available as alternatives
|
|
110
|
-
);
|
|
111
|
-
const UNSAFE_headingOverrides = overrides && overrides.HeadingItem && overrides.HeadingItem.cssFn;
|
|
112
113
|
const content = isList ? jsx("ul", {
|
|
113
114
|
style: {
|
|
114
115
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
@@ -128,7 +129,7 @@ const Section = /*#__PURE__*/forwardRef(({
|
|
|
128
129
|
const childrenMarkup = title !== undefined ? jsx(Fragment, null, jsx(HeadingItem
|
|
129
130
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
|
|
130
131
|
, {
|
|
131
|
-
cssFn:
|
|
132
|
+
cssFn: isSideNavSection ? sideNavSectionHeadingStyles : undefined,
|
|
132
133
|
testId: testId && `${testId}--heading`,
|
|
133
134
|
"aria-hidden": true
|
|
134
135
|
}, title), content) : jsx(Fragment, null, content);
|
|
@@ -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", "
|
|
3
|
+
var _excluded = ["children", "title", "titleId", "testId", "isScrollable", "hasSeparator", "id", "isList", "isSideNavSection", "className"];
|
|
4
4
|
/**
|
|
5
5
|
* @jsxRuntime classic
|
|
6
6
|
* @jsx jsx
|
|
@@ -9,7 +9,6 @@ import { Children, forwardRef, Fragment } from 'react';
|
|
|
9
9
|
|
|
10
10
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
11
11
|
import { css, jsx } from '@emotion/react';
|
|
12
|
-
import { propDeprecationWarning } from '@atlaskit/ds-lib/deprecation-warning';
|
|
13
12
|
import { N30A } from '@atlaskit/theme/colors';
|
|
14
13
|
import HeadingItem from '../menu-item/heading-item';
|
|
15
14
|
var gridSize = 8;
|
|
@@ -82,6 +81,11 @@ var noSeparatorStyles = css({
|
|
|
82
81
|
marginBlockStart: -6
|
|
83
82
|
}
|
|
84
83
|
});
|
|
84
|
+
var sideNavSectionHeadingStyles = function sideNavSectionHeadingStyles() {
|
|
85
|
+
return {
|
|
86
|
+
paddingInline: "var(--ds-space-100, 8px)"
|
|
87
|
+
};
|
|
88
|
+
};
|
|
85
89
|
|
|
86
90
|
/**
|
|
87
91
|
* __Section__
|
|
@@ -93,7 +97,6 @@ var noSeparatorStyles = css({
|
|
|
93
97
|
*/
|
|
94
98
|
var Section = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
95
99
|
var children = _ref.children,
|
|
96
|
-
overrides = _ref.overrides,
|
|
97
100
|
title = _ref.title,
|
|
98
101
|
titleId = _ref.titleId,
|
|
99
102
|
testId = _ref.testId,
|
|
@@ -102,11 +105,10 @@ var Section = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
102
105
|
id = _ref.id,
|
|
103
106
|
_ref$isList = _ref.isList,
|
|
104
107
|
isList = _ref$isList === void 0 ? false : _ref$isList,
|
|
108
|
+
_ref$isSideNavSection = _ref.isSideNavSection,
|
|
109
|
+
isSideNavSection = _ref$isSideNavSection === void 0 ? false : _ref$isSideNavSection,
|
|
105
110
|
UNSAFE_className = _ref.className,
|
|
106
111
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
107
|
-
propDeprecationWarning("@atlaskit/menu" || '', 'overrides', overrides !== undefined, '' // TODO: Create DAC post when primitives/xcss are available as alternatives
|
|
108
|
-
);
|
|
109
|
-
var UNSAFE_headingOverrides = overrides && overrides.HeadingItem && overrides.HeadingItem.cssFn;
|
|
110
112
|
var content = isList ? jsx("ul", {
|
|
111
113
|
style: {
|
|
112
114
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
@@ -128,7 +130,7 @@ var Section = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
128
130
|
var childrenMarkup = title !== undefined ? jsx(Fragment, null, jsx(HeadingItem
|
|
129
131
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
|
|
130
132
|
, {
|
|
131
|
-
cssFn:
|
|
133
|
+
cssFn: isSideNavSection ? sideNavSectionHeadingStyles : undefined,
|
|
132
134
|
testId: testId && "".concat(testId, "--heading"),
|
|
133
135
|
"aria-hidden": true
|
|
134
136
|
}, title), content) : jsx(Fragment, null, content);
|
package/dist/types/index.d.ts
CHANGED
|
@@ -8,4 +8,4 @@ export { default as SkeletonHeadingItem } from './menu-item/skeleton-heading-ite
|
|
|
8
8
|
export { default as Section } from './menu-section/section';
|
|
9
9
|
export { default as MenuGroup } from './menu-section/menu-group';
|
|
10
10
|
export { default as PopupMenuGroup } from './menu-section/popup-menu-group';
|
|
11
|
-
export type { ButtonItemProps, CSSFn, StatelessCSSFn, CustomItemComponentProps, CustomItemProps, HeadingItemProps, ItemState, LinkItemProps, MenuGroupProps, SectionProps, SkeletonHeadingItemProps, SkeletonItemProps, Dimension, MenuItemProps as BaseItemProps,
|
|
11
|
+
export type { ButtonItemProps, CSSFn, StatelessCSSFn, CustomItemComponentProps, CustomItemProps, HeadingItemProps, ItemState, LinkItemProps, MenuGroupProps, SectionProps, SkeletonHeadingItemProps, SkeletonItemProps, Dimension, MenuItemProps as BaseItemProps, MenuGroupSizing, RenderFunction, SectionProps as SectionBaseProps, } from './types';
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,25 +1,9 @@
|
|
|
1
|
-
import { type ComponentType, type PropsWithChildren, type
|
|
1
|
+
import { type ComponentType, type PropsWithChildren, type Ref } from 'react';
|
|
2
2
|
import { type CSSObject } from '@emotion/react';
|
|
3
3
|
import type { SpacingMode } from './internal/components/menu-context';
|
|
4
4
|
export interface RenderFunction<TProps = {}> {
|
|
5
5
|
(Component: ComponentType | string, props: TProps): React.ReactNode;
|
|
6
6
|
}
|
|
7
|
-
/**
|
|
8
|
-
* @deprecated This type is deprecated and will be removed in a future release. See DSP-2676 for more information.
|
|
9
|
-
*/
|
|
10
|
-
export interface TitleOverrides {
|
|
11
|
-
render?: RenderFunction<{
|
|
12
|
-
className?: string;
|
|
13
|
-
children: ReactNode;
|
|
14
|
-
'data-item-title': boolean;
|
|
15
|
-
}>;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* @deprecated This type is deprecated and will be removed in a future release. See DSP-2676 for more information.
|
|
19
|
-
*/
|
|
20
|
-
export interface Overrides {
|
|
21
|
-
Title?: TitleOverrides;
|
|
22
|
-
}
|
|
23
7
|
export type Dimension = string | number;
|
|
24
8
|
export interface MenuGroupSizing {
|
|
25
9
|
/**
|
|
@@ -97,18 +81,6 @@ export interface SectionProps {
|
|
|
97
81
|
* serving as a hook for automated tests.
|
|
98
82
|
*/
|
|
99
83
|
testId?: string;
|
|
100
|
-
/**
|
|
101
|
-
* @deprecated This API is deprecated and will be removed in a future release. See DSP-2676 for more information.
|
|
102
|
-
*/
|
|
103
|
-
overrides?: {
|
|
104
|
-
HeadingItem?: {
|
|
105
|
-
/**
|
|
106
|
-
* A function that overrides the styles of the component.
|
|
107
|
-
* It receives the current styles and state and expects a styles object.
|
|
108
|
-
*/
|
|
109
|
-
cssFn?: StatelessCSSFn;
|
|
110
|
-
};
|
|
111
|
-
};
|
|
112
84
|
/**
|
|
113
85
|
* The text passed into the internal `HeadingItem`. If a title isn't provided,
|
|
114
86
|
* the `HeadingItem` won't be rendered, and this component will act as a regular `Section`.
|
|
@@ -123,6 +95,11 @@ export interface SectionProps {
|
|
|
123
95
|
* If your menu contains a list, use this to add `<ul>` and `<li>` tags around the items. This is essential for offering better, accessible semantic markup in a list of items.
|
|
124
96
|
*/
|
|
125
97
|
isList?: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* When `true`, section header inline padding is reduced.
|
|
100
|
+
* @deprecated This API exists to support functionality in `@atlaskit/side-navigation` and should not be used. Once the new navigation is fully rolled out, this prop will be removed.
|
|
101
|
+
*/
|
|
102
|
+
isSideNavSection?: boolean;
|
|
126
103
|
}
|
|
127
104
|
export interface MenuItemPrimitiveProps {
|
|
128
105
|
children: (props: {
|
|
@@ -8,4 +8,4 @@ export { default as SkeletonHeadingItem } from './menu-item/skeleton-heading-ite
|
|
|
8
8
|
export { default as Section } from './menu-section/section';
|
|
9
9
|
export { default as MenuGroup } from './menu-section/menu-group';
|
|
10
10
|
export { default as PopupMenuGroup } from './menu-section/popup-menu-group';
|
|
11
|
-
export type { ButtonItemProps, CSSFn, StatelessCSSFn, CustomItemComponentProps, CustomItemProps, HeadingItemProps, ItemState, LinkItemProps, MenuGroupProps, SectionProps, SkeletonHeadingItemProps, SkeletonItemProps, Dimension, MenuItemProps as BaseItemProps,
|
|
11
|
+
export type { ButtonItemProps, CSSFn, StatelessCSSFn, CustomItemComponentProps, CustomItemProps, HeadingItemProps, ItemState, LinkItemProps, MenuGroupProps, SectionProps, SkeletonHeadingItemProps, SkeletonItemProps, Dimension, MenuItemProps as BaseItemProps, MenuGroupSizing, RenderFunction, SectionProps as SectionBaseProps, } from './types';
|
|
@@ -1,25 +1,9 @@
|
|
|
1
|
-
import { type ComponentType, type PropsWithChildren, type
|
|
1
|
+
import { type ComponentType, type PropsWithChildren, type Ref } from 'react';
|
|
2
2
|
import { type CSSObject } from '@emotion/react';
|
|
3
3
|
import type { SpacingMode } from './internal/components/menu-context';
|
|
4
4
|
export interface RenderFunction<TProps = {}> {
|
|
5
5
|
(Component: ComponentType | string, props: TProps): React.ReactNode;
|
|
6
6
|
}
|
|
7
|
-
/**
|
|
8
|
-
* @deprecated This type is deprecated and will be removed in a future release. See DSP-2676 for more information.
|
|
9
|
-
*/
|
|
10
|
-
export interface TitleOverrides {
|
|
11
|
-
render?: RenderFunction<{
|
|
12
|
-
className?: string;
|
|
13
|
-
children: ReactNode;
|
|
14
|
-
'data-item-title': boolean;
|
|
15
|
-
}>;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* @deprecated This type is deprecated and will be removed in a future release. See DSP-2676 for more information.
|
|
19
|
-
*/
|
|
20
|
-
export interface Overrides {
|
|
21
|
-
Title?: TitleOverrides;
|
|
22
|
-
}
|
|
23
7
|
export type Dimension = string | number;
|
|
24
8
|
export interface MenuGroupSizing {
|
|
25
9
|
/**
|
|
@@ -97,18 +81,6 @@ export interface SectionProps {
|
|
|
97
81
|
* serving as a hook for automated tests.
|
|
98
82
|
*/
|
|
99
83
|
testId?: string;
|
|
100
|
-
/**
|
|
101
|
-
* @deprecated This API is deprecated and will be removed in a future release. See DSP-2676 for more information.
|
|
102
|
-
*/
|
|
103
|
-
overrides?: {
|
|
104
|
-
HeadingItem?: {
|
|
105
|
-
/**
|
|
106
|
-
* A function that overrides the styles of the component.
|
|
107
|
-
* It receives the current styles and state and expects a styles object.
|
|
108
|
-
*/
|
|
109
|
-
cssFn?: StatelessCSSFn;
|
|
110
|
-
};
|
|
111
|
-
};
|
|
112
84
|
/**
|
|
113
85
|
* The text passed into the internal `HeadingItem`. If a title isn't provided,
|
|
114
86
|
* the `HeadingItem` won't be rendered, and this component will act as a regular `Section`.
|
|
@@ -123,6 +95,11 @@ export interface SectionProps {
|
|
|
123
95
|
* If your menu contains a list, use this to add `<ul>` and `<li>` tags around the items. This is essential for offering better, accessible semantic markup in a list of items.
|
|
124
96
|
*/
|
|
125
97
|
isList?: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* When `true`, section header inline padding is reduced.
|
|
100
|
+
* @deprecated This API exists to support functionality in `@atlaskit/side-navigation` and should not be used. Once the new navigation is fully rolled out, this prop will be removed.
|
|
101
|
+
*/
|
|
102
|
+
isSideNavSection?: boolean;
|
|
126
103
|
}
|
|
127
104
|
export interface MenuItemPrimitiveProps {
|
|
128
105
|
children: (props: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/menu",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "A list of options to help users navigate, or perform actions.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"@af/visual-regression": "workspace:^",
|
|
64
64
|
"@atlaskit/button": "^23.0.0",
|
|
65
65
|
"@atlaskit/docs": "^10.0.0",
|
|
66
|
-
"@atlaskit/icon": "^
|
|
66
|
+
"@atlaskit/icon": "^26.0.0",
|
|
67
67
|
"@atlaskit/icon-file-type": "^7.0.0",
|
|
68
68
|
"@atlaskit/icon-object": "^7.1.0",
|
|
69
69
|
"@atlaskit/link": "^3.1.0",
|