@atlaskit/menu 5.0.1 → 7.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 +29 -0
- package/dist/cjs/menu-item/heading-item.compiled.css +4 -0
- package/dist/cjs/menu-item/heading-item.js +17 -29
- package/dist/cjs/menu-section/menu-group.compiled.css +5 -0
- package/dist/cjs/menu-section/menu-group.js +12 -17
- package/dist/cjs/menu-section/popup-menu-group.js +9 -8
- package/dist/cjs/menu-section/section.compiled.css +17 -0
- package/dist/cjs/menu-section/section.js +34 -88
- package/dist/es2019/menu-item/heading-item.compiled.css +4 -0
- package/dist/es2019/menu-item/heading-item.js +7 -26
- package/dist/es2019/menu-section/menu-group.compiled.css +5 -0
- package/dist/es2019/menu-section/menu-group.js +9 -17
- package/dist/es2019/menu-section/popup-menu-group.js +6 -6
- package/dist/es2019/menu-section/section.compiled.css +17 -0
- package/dist/es2019/menu-section/section.js +28 -87
- package/dist/esm/menu-item/heading-item.compiled.css +4 -0
- package/dist/esm/menu-item/heading-item.js +13 -29
- package/dist/esm/menu-section/menu-group.compiled.css +5 -0
- package/dist/esm/menu-section/menu-group.js +9 -17
- package/dist/esm/menu-section/popup-menu-group.js +6 -6
- package/dist/esm/menu-section/section.compiled.css +17 -0
- package/dist/esm/menu-section/section.js +30 -88
- package/dist/types/index.d.ts +1 -1
- package/dist/types/menu-item/heading-item.d.ts +1 -2
- package/dist/types/menu-section/menu-group.d.ts +2 -6
- package/dist/types/menu-section/popup-menu-group.d.ts +2 -6
- package/dist/types/types.d.ts +6 -36
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/dist/types-ts4.5/menu-item/heading-item.d.ts +1 -2
- package/dist/types-ts4.5/menu-section/menu-group.d.ts +2 -6
- package/dist/types-ts4.5/menu-section/popup-menu-group.d.ts +2 -6
- package/dist/types-ts4.5/types.d.ts +6 -36
- package/package.json +3 -2
|
@@ -1,85 +1,28 @@
|
|
|
1
|
+
/* section.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
1
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
*/
|
|
3
|
+
import "./section.compiled.css";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
6
6
|
import { Children, forwardRef, Fragment } from 'react';
|
|
7
|
-
|
|
8
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
|
-
import { css, jsx } from '@emotion/react';
|
|
10
|
-
import { propDeprecationWarning } from '@atlaskit/ds-lib/deprecation-warning';
|
|
11
|
-
import { N30A } from '@atlaskit/theme/colors';
|
|
12
7
|
import HeadingItem from '../menu-item/heading-item';
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const itemHeadingBottomMargin = gridSize * 0.75;
|
|
8
|
+
const itemHeadingTopMargin = 20;
|
|
9
|
+
const itemHeadingBottomMargin = 6;
|
|
16
10
|
// Skeleton content is slightly shorter than the real content.
|
|
17
11
|
// Because of that we slightly increase the top margin to offset this so the
|
|
18
12
|
// containing size both real and skeleton always equal approx 30px.
|
|
19
13
|
const itemHeadingContentHeight = 16; // Originally headingSizes.h100.lineHeight from '@atlaskit/theme/typography'
|
|
20
|
-
const skeletonHeadingHeight =
|
|
14
|
+
const skeletonHeadingHeight = 8;
|
|
21
15
|
const skeletonHeadingMarginOffset = 3;
|
|
22
16
|
const skeletonHeadingTopMargin = itemHeadingTopMargin + (itemHeadingContentHeight - skeletonHeadingHeight) - skeletonHeadingMarginOffset;
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
content: '""'
|
|
33
|
-
},
|
|
34
|
-
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles, @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
35
|
-
'& [data-ds--menu--heading-item]': {
|
|
36
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
37
|
-
marginBlockEnd: itemHeadingBottomMargin,
|
|
38
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
39
|
-
marginBlockStart: itemHeadingTopMargin,
|
|
40
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
41
|
-
'&:first-of-type': {
|
|
42
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
43
|
-
marginBlockStart: itemHeadingTopMargin - sectionPaddingTopBottom
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles, @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
47
|
-
'& [data-ds--menu--skeleton-heading-item]': {
|
|
48
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
49
|
-
marginBlockEnd: skeletonHeadingBottomMargin,
|
|
50
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
51
|
-
marginBlockStart: skeletonHeadingTopMargin,
|
|
52
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
53
|
-
'&:first-of-type': {
|
|
54
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
55
|
-
marginBlockStart: skeletonHeadingTopMargin - sectionPaddingTopBottom
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
'&:focus': {
|
|
59
|
-
// NOTE: Firefox allows elements that have "overflow: auto" to gain focus (as if it had tab-index="0")
|
|
60
|
-
// We have made a deliberate choice to leave this behaviour as is.
|
|
61
|
-
// This makes the outline go inside by 1px so it can actually be displayed
|
|
62
|
-
// else it gets cut off from the overflow: scroll from the parent menu group.
|
|
63
|
-
outlineOffset: -1
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
const scrollableStyles = css({
|
|
67
|
-
flexShrink: 1,
|
|
68
|
-
overflow: 'auto'
|
|
69
|
-
});
|
|
70
|
-
const unscrollableStyles = css({
|
|
71
|
-
flexShrink: 0
|
|
72
|
-
});
|
|
73
|
-
const thinSeparatorStyles = css({
|
|
74
|
-
borderBlockStart: `1px solid var(${VAR_SEPARATOR_COLOR}, ${`var(--ds-border, ${N30A})`})`
|
|
75
|
-
});
|
|
76
|
-
const noSeparatorStyles = css({
|
|
77
|
-
// this is to ensure that adjacent sections without separators don't get additional margins.
|
|
78
|
-
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles, @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
79
|
-
'[data-section] + &': {
|
|
80
|
-
marginBlockStart: -6
|
|
81
|
-
}
|
|
82
|
-
});
|
|
17
|
+
const sectionPaddingTopBottom = 6;
|
|
18
|
+
const styles = {
|
|
19
|
+
root: "_1ywu1ule _cfu11ule _1qdgi2wt _kfgti2wt _aetrb3bt _1kt9b3bt _1p3hi2wt _1l6bgktf _osbldlk8 _auo4rdoj _hp2110yn _1mfv8jkm _1bg41n1a",
|
|
20
|
+
scrollable: "_1reo1wug _18m91wug _1o9zkb7n",
|
|
21
|
+
unscrollable: "_1o9zidpf",
|
|
22
|
+
thinSeparator: "_mqm21imm",
|
|
23
|
+
noSeparator: "_n7cnyjp0",
|
|
24
|
+
sideNavSectionHeading: "_18zru2gc"
|
|
25
|
+
};
|
|
83
26
|
|
|
84
27
|
/**
|
|
85
28
|
* __Section__
|
|
@@ -91,7 +34,6 @@ const noSeparatorStyles = css({
|
|
|
91
34
|
*/
|
|
92
35
|
const Section = /*#__PURE__*/forwardRef(({
|
|
93
36
|
children,
|
|
94
|
-
overrides,
|
|
95
37
|
title,
|
|
96
38
|
titleId,
|
|
97
39
|
testId,
|
|
@@ -99,6 +41,7 @@ const Section = /*#__PURE__*/forwardRef(({
|
|
|
99
41
|
hasSeparator,
|
|
100
42
|
id,
|
|
101
43
|
isList = false,
|
|
44
|
+
isSideNavSection = false,
|
|
102
45
|
// Although this isn't defined on props it is available because we've used
|
|
103
46
|
// Spread props below and on the jsx element. To forcibly block usage I've
|
|
104
47
|
// picked it out and supressed the expected type error.
|
|
@@ -106,17 +49,14 @@ const Section = /*#__PURE__*/forwardRef(({
|
|
|
106
49
|
className: UNSAFE_className,
|
|
107
50
|
...rest
|
|
108
51
|
}, ref) => {
|
|
109
|
-
|
|
110
|
-
);
|
|
111
|
-
const UNSAFE_headingOverrides = overrides && overrides.HeadingItem && overrides.HeadingItem.cssFn;
|
|
112
|
-
const content = isList ? jsx("ul", {
|
|
52
|
+
const content = isList ? /*#__PURE__*/React.createElement("ul", {
|
|
113
53
|
style: {
|
|
114
54
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
115
55
|
margin: 0,
|
|
116
56
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
117
57
|
padding: 0
|
|
118
58
|
}
|
|
119
|
-
}, Children.map(Children.toArray(children), (child, index) =>
|
|
59
|
+
}, Children.map(Children.toArray(children), (child, index) => /*#__PURE__*/React.createElement("li", {
|
|
120
60
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
121
61
|
style: {
|
|
122
62
|
listStyleType: 'none',
|
|
@@ -125,21 +65,22 @@ const Section = /*#__PURE__*/forwardRef(({
|
|
|
125
65
|
},
|
|
126
66
|
key: index
|
|
127
67
|
}, child))) : children;
|
|
128
|
-
const childrenMarkup = title !== undefined ?
|
|
129
|
-
// eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
|
|
130
|
-
, {
|
|
131
|
-
cssFn: UNSAFE_headingOverrides,
|
|
68
|
+
const childrenMarkup = title !== undefined ? /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(HeadingItem, {
|
|
132
69
|
testId: testId && `${testId}--heading`,
|
|
133
70
|
"aria-hidden": true
|
|
134
|
-
|
|
135
|
-
|
|
71
|
+
// @ts-expect-error
|
|
72
|
+
// eslint-disable-next-line @atlaskit/design-system/no-unsafe-style-overrides
|
|
73
|
+
,
|
|
74
|
+
className: ax([isSideNavSection && styles.sideNavSectionHeading])
|
|
75
|
+
}, title), content) : /*#__PURE__*/React.createElement(Fragment, null, content);
|
|
76
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
136
77
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
137
|
-
className: UNSAFE_className,
|
|
78
|
+
className: ax([styles.root, isScrollable ? styles.scrollable : styles.unscrollable, hasSeparator ? styles.thinSeparator : styles.noSeparator, UNSAFE_className]),
|
|
138
79
|
id: id
|
|
139
80
|
// NOTE: Firefox allows elements that have "overflow: auto" to gain focus (as if it had tab-index="0")
|
|
140
81
|
// We have made a deliberate choice to leave this behaviour as is.
|
|
141
82
|
,
|
|
142
|
-
|
|
83
|
+
|
|
143
84
|
"aria-label": title,
|
|
144
85
|
"aria-labelledby": titleId,
|
|
145
86
|
"data-testid": testId,
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
._11c81vhk{font:var(--ds-font-heading-xxsmall,normal 600 9pt/1pc ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
|
|
2
|
+
._18zrpxbi{padding-inline:var(--ds-space-200,1pc)}
|
|
3
|
+
._1rjcze3t{padding-block:var(--ds-space-0,0)}
|
|
4
|
+
._syaz1vvm{color:var(--_bbz764)}
|
|
@@ -1,23 +1,13 @@
|
|
|
1
|
+
/* heading-item.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
1
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["children", "testId", "headingLevel", "id", "
|
|
4
|
-
|
|
5
|
-
*
|
|
6
|
-
|
|
7
|
-
*/
|
|
4
|
+
var _excluded = ["children", "testId", "headingLevel", "id", "className"];
|
|
5
|
+
import "./heading-item.compiled.css";
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
8
8
|
import { memo } from 'react';
|
|
9
|
-
|
|
10
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
11
|
-
import { css, jsx } from '@emotion/react';
|
|
12
|
-
import { propDeprecationWarning } from '@atlaskit/ds-lib/deprecation-warning';
|
|
13
|
-
import noop from '@atlaskit/ds-lib/noop';
|
|
14
9
|
import { N300 } from '@atlaskit/theme/colors';
|
|
15
|
-
var headingStyles =
|
|
16
|
-
color: "var(--ds-text-subtle, ".concat(N300, ")"),
|
|
17
|
-
font: "var(--ds-font-heading-xxsmall, normal 600 12px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)",
|
|
18
|
-
paddingBlock: "var(--ds-space-0, 0px)",
|
|
19
|
-
paddingInline: "var(--ds-space-200, 16px)"
|
|
20
|
-
});
|
|
10
|
+
var headingStyles = null;
|
|
21
11
|
|
|
22
12
|
/**
|
|
23
13
|
* __Heading item__
|
|
@@ -33,19 +23,9 @@ var HeadingItem = /*#__PURE__*/memo(function (_ref) {
|
|
|
33
23
|
_ref$headingLevel = _ref.headingLevel,
|
|
34
24
|
headingLevel = _ref$headingLevel === void 0 ? 2 : _ref$headingLevel,
|
|
35
25
|
id = _ref.id,
|
|
36
|
-
_ref$cssFn = _ref.cssFn,
|
|
37
|
-
cssFn = _ref$cssFn === void 0 ? noop : _ref$cssFn,
|
|
38
26
|
UNSAFE_className = _ref.className,
|
|
39
27
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
40
|
-
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
44
|
-
var UNSAFE_overrides = css(cssFn(undefined));
|
|
45
|
-
return jsx("div", _extends({
|
|
46
|
-
css: [headingStyles,
|
|
47
|
-
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
48
|
-
UNSAFE_overrides],
|
|
28
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
49
29
|
role: "heading",
|
|
50
30
|
"aria-level": headingLevel,
|
|
51
31
|
"data-testid": testId,
|
|
@@ -53,7 +33,11 @@ var HeadingItem = /*#__PURE__*/memo(function (_ref) {
|
|
|
53
33
|
id: id
|
|
54
34
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
55
35
|
,
|
|
56
|
-
className: UNSAFE_className
|
|
57
|
-
}, rest
|
|
36
|
+
className: ax(["_11c81vhk _1rjcze3t _18zrpxbi _syaz1vvm", UNSAFE_className])
|
|
37
|
+
}, rest, {
|
|
38
|
+
style: {
|
|
39
|
+
"--_bbz764": ix("var(--ds-text-subtle, ".concat(N300, ")"))
|
|
40
|
+
}
|
|
41
|
+
}), children);
|
|
58
42
|
});
|
|
59
43
|
export default HeadingItem;
|
|
@@ -1,19 +1,12 @@
|
|
|
1
|
+
/* menu-group.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
1
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
4
|
var _excluded = ["isLoading", "maxWidth", "minWidth", "minHeight", "maxHeight", "testId", "role", "spacing", "className"];
|
|
4
|
-
|
|
5
|
-
*
|
|
6
|
-
|
|
7
|
-
*/
|
|
8
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
|
-
import { css, jsx } from '@emotion/react';
|
|
5
|
+
import "./menu-group.compiled.css";
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
10
8
|
import { SELECTION_STYLE_CONTEXT_DO_NOT_USE, SpacingContext } from '../internal/components/menu-context';
|
|
11
|
-
var baseStyles =
|
|
12
|
-
display: 'flex',
|
|
13
|
-
position: 'static',
|
|
14
|
-
flexDirection: 'column',
|
|
15
|
-
overflow: 'auto'
|
|
16
|
-
});
|
|
9
|
+
var baseStyles = null;
|
|
17
10
|
|
|
18
11
|
/**
|
|
19
12
|
* __Menu group__
|
|
@@ -35,11 +28,11 @@ var MenuGroup = function MenuGroup(_ref) {
|
|
|
35
28
|
spacing = _ref$spacing === void 0 ? 'cozy' : _ref$spacing,
|
|
36
29
|
UNSAFE_className = _ref.className,
|
|
37
30
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
38
|
-
return
|
|
31
|
+
return /*#__PURE__*/React.createElement(SpacingContext.Provider, {
|
|
39
32
|
value: spacing
|
|
40
|
-
},
|
|
33
|
+
}, /*#__PURE__*/React.createElement(SELECTION_STYLE_CONTEXT_DO_NOT_USE.Provider, {
|
|
41
34
|
value: "border"
|
|
42
|
-
},
|
|
35
|
+
}, /*#__PURE__*/React.createElement("div", _extends({
|
|
43
36
|
"aria-busy": isLoading,
|
|
44
37
|
style: {
|
|
45
38
|
minWidth: minWidth,
|
|
@@ -47,12 +40,11 @@ var MenuGroup = function MenuGroup(_ref) {
|
|
|
47
40
|
minHeight: minHeight,
|
|
48
41
|
maxHeight: maxHeight
|
|
49
42
|
},
|
|
50
|
-
css: baseStyles,
|
|
51
43
|
"data-testid": testId,
|
|
52
44
|
role: role
|
|
53
45
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
54
46
|
,
|
|
55
|
-
className: UNSAFE_className
|
|
47
|
+
className: ax(["_1reo1wug _18m91wug _1e0c1txw _kqswpfqs _2lx21bp4", UNSAFE_className])
|
|
56
48
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
57
49
|
}, rest))));
|
|
58
50
|
};
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
+
/* popup-menu-group.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
1
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
4
|
var _excluded = ["maxWidth", "minWidth"];
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* @jsx jsx
|
|
7
|
-
*/
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
8
7
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
|
-
|
|
8
|
+
|
|
10
9
|
import MenuGroup from './menu-group';
|
|
11
10
|
|
|
12
11
|
/**
|
|
@@ -19,8 +18,9 @@ var PopupMenuGroup = function PopupMenuGroup(_ref) {
|
|
|
19
18
|
minWidth = _ref$minWidth === void 0 ? 320 : _ref$minWidth,
|
|
20
19
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
21
20
|
return (
|
|
21
|
+
/*#__PURE__*/
|
|
22
22
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
23
|
-
|
|
23
|
+
React.createElement(MenuGroup, _extends({
|
|
24
24
|
maxWidth: maxWidth,
|
|
25
25
|
minWidth: minWidth
|
|
26
26
|
}, rest))
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
._18zru2gc{padding-inline:var(--ds-space-100,8px)}
|
|
3
|
+
._mqm21imm{border-block-start:1px solid var(--ds-menu-seperator-color,var(--ds-border,rgba(9,30,66,.08)))}._18m91wug{overflow-y:auto}
|
|
4
|
+
._1l6bgktf [data-ds--menu--heading-item]{margin-block-start:20px}
|
|
5
|
+
._1mfv8jkm [data-ds--menu--skeleton-heading-item]:first-of-type{margin-block-start:19px}
|
|
6
|
+
._1o9zidpf{flex-shrink:0}
|
|
7
|
+
._1o9zkb7n{flex-shrink:1}
|
|
8
|
+
._1p3hi2wt [data-ds--menu--heading-item]{margin-block-end:6px}
|
|
9
|
+
._1qdgi2wt:after, ._kfgti2wt:before{height:6px}
|
|
10
|
+
._1reo1wug{overflow-x:auto}
|
|
11
|
+
._1ywu1ule:after, ._cfu11ule:before{display:block}
|
|
12
|
+
._aetrb3bt:after, ._1kt9b3bt:before{content:""}
|
|
13
|
+
._auo4rdoj [data-ds--menu--skeleton-heading-item]{margin-block-end:9px}
|
|
14
|
+
._hp2110yn [data-ds--menu--skeleton-heading-item]{margin-block-start:25px}
|
|
15
|
+
._osbldlk8 [data-ds--menu--heading-item]:first-of-type{margin-block-start:14px}
|
|
16
|
+
[data-section]+._n7cnyjp0{margin-block-start:-6px}
|
|
17
|
+
._1bg41n1a:focus{outline-offset:-1px}
|
|
@@ -1,87 +1,30 @@
|
|
|
1
|
+
/* section.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
1
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["children", "
|
|
4
|
-
|
|
5
|
-
*
|
|
6
|
-
|
|
7
|
-
*/
|
|
4
|
+
var _excluded = ["children", "title", "titleId", "testId", "isScrollable", "hasSeparator", "id", "isList", "isSideNavSection", "className"];
|
|
5
|
+
import "./section.compiled.css";
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
8
8
|
import { Children, forwardRef, Fragment } from 'react';
|
|
9
|
-
|
|
10
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
11
|
-
import { css, jsx } from '@emotion/react';
|
|
12
|
-
import { propDeprecationWarning } from '@atlaskit/ds-lib/deprecation-warning';
|
|
13
|
-
import { N30A } from '@atlaskit/theme/colors';
|
|
14
9
|
import HeadingItem from '../menu-item/heading-item';
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var itemHeadingBottomMargin = gridSize * 0.75;
|
|
10
|
+
var itemHeadingTopMargin = 20;
|
|
11
|
+
var itemHeadingBottomMargin = 6;
|
|
18
12
|
// Skeleton content is slightly shorter than the real content.
|
|
19
13
|
// Because of that we slightly increase the top margin to offset this so the
|
|
20
14
|
// containing size both real and skeleton always equal approx 30px.
|
|
21
15
|
var itemHeadingContentHeight = 16; // Originally headingSizes.h100.lineHeight from '@atlaskit/theme/typography'
|
|
22
|
-
var skeletonHeadingHeight =
|
|
16
|
+
var skeletonHeadingHeight = 8;
|
|
23
17
|
var skeletonHeadingMarginOffset = 3;
|
|
24
18
|
var skeletonHeadingTopMargin = itemHeadingTopMargin + (itemHeadingContentHeight - skeletonHeadingHeight) - skeletonHeadingMarginOffset;
|
|
25
|
-
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
content: '""'
|
|
35
|
-
},
|
|
36
|
-
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles, @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
37
|
-
'& [data-ds--menu--heading-item]': {
|
|
38
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
39
|
-
marginBlockEnd: itemHeadingBottomMargin,
|
|
40
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
41
|
-
marginBlockStart: itemHeadingTopMargin,
|
|
42
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
43
|
-
'&:first-of-type': {
|
|
44
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
45
|
-
marginBlockStart: itemHeadingTopMargin - sectionPaddingTopBottom
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles, @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
49
|
-
'& [data-ds--menu--skeleton-heading-item]': {
|
|
50
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
51
|
-
marginBlockEnd: skeletonHeadingBottomMargin,
|
|
52
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
53
|
-
marginBlockStart: skeletonHeadingTopMargin,
|
|
54
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
55
|
-
'&:first-of-type': {
|
|
56
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
57
|
-
marginBlockStart: skeletonHeadingTopMargin - sectionPaddingTopBottom
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
'&:focus': {
|
|
61
|
-
// NOTE: Firefox allows elements that have "overflow: auto" to gain focus (as if it had tab-index="0")
|
|
62
|
-
// We have made a deliberate choice to leave this behaviour as is.
|
|
63
|
-
// This makes the outline go inside by 1px so it can actually be displayed
|
|
64
|
-
// else it gets cut off from the overflow: scroll from the parent menu group.
|
|
65
|
-
outlineOffset: -1
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
var scrollableStyles = css({
|
|
69
|
-
flexShrink: 1,
|
|
70
|
-
overflow: 'auto'
|
|
71
|
-
});
|
|
72
|
-
var unscrollableStyles = css({
|
|
73
|
-
flexShrink: 0
|
|
74
|
-
});
|
|
75
|
-
var thinSeparatorStyles = css({
|
|
76
|
-
borderBlockStart: "1px solid var(".concat(VAR_SEPARATOR_COLOR, ", ", "var(--ds-border, ".concat(N30A, ")"), ")")
|
|
77
|
-
});
|
|
78
|
-
var noSeparatorStyles = css({
|
|
79
|
-
// this is to ensure that adjacent sections without separators don't get additional margins.
|
|
80
|
-
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles, @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
81
|
-
'[data-section] + &': {
|
|
82
|
-
marginBlockStart: -6
|
|
83
|
-
}
|
|
84
|
-
});
|
|
19
|
+
var sectionPaddingTopBottom = 6;
|
|
20
|
+
var styles = {
|
|
21
|
+
root: "_1ywu1ule _cfu11ule _1qdgi2wt _kfgti2wt _aetrb3bt _1kt9b3bt _1p3hi2wt _1l6bgktf _osbldlk8 _auo4rdoj _hp2110yn _1mfv8jkm _1bg41n1a",
|
|
22
|
+
scrollable: "_1reo1wug _18m91wug _1o9zkb7n",
|
|
23
|
+
unscrollable: "_1o9zidpf",
|
|
24
|
+
thinSeparator: "_mqm21imm",
|
|
25
|
+
noSeparator: "_n7cnyjp0",
|
|
26
|
+
sideNavSectionHeading: "_18zru2gc"
|
|
27
|
+
};
|
|
85
28
|
|
|
86
29
|
/**
|
|
87
30
|
* __Section__
|
|
@@ -93,7 +36,6 @@ var noSeparatorStyles = css({
|
|
|
93
36
|
*/
|
|
94
37
|
var Section = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
95
38
|
var children = _ref.children,
|
|
96
|
-
overrides = _ref.overrides,
|
|
97
39
|
title = _ref.title,
|
|
98
40
|
titleId = _ref.titleId,
|
|
99
41
|
testId = _ref.testId,
|
|
@@ -102,12 +44,11 @@ var Section = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
102
44
|
id = _ref.id,
|
|
103
45
|
_ref$isList = _ref.isList,
|
|
104
46
|
isList = _ref$isList === void 0 ? false : _ref$isList,
|
|
47
|
+
_ref$isSideNavSection = _ref.isSideNavSection,
|
|
48
|
+
isSideNavSection = _ref$isSideNavSection === void 0 ? false : _ref$isSideNavSection,
|
|
105
49
|
UNSAFE_className = _ref.className,
|
|
106
50
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
107
|
-
|
|
108
|
-
);
|
|
109
|
-
var UNSAFE_headingOverrides = overrides && overrides.HeadingItem && overrides.HeadingItem.cssFn;
|
|
110
|
-
var content = isList ? jsx("ul", {
|
|
51
|
+
var content = isList ? /*#__PURE__*/React.createElement("ul", {
|
|
111
52
|
style: {
|
|
112
53
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
113
54
|
margin: 0,
|
|
@@ -115,7 +56,7 @@ var Section = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
115
56
|
padding: 0
|
|
116
57
|
}
|
|
117
58
|
}, Children.map(Children.toArray(children), function (child, index) {
|
|
118
|
-
return
|
|
59
|
+
return /*#__PURE__*/React.createElement("li", {
|
|
119
60
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
120
61
|
style: {
|
|
121
62
|
listStyleType: 'none',
|
|
@@ -125,21 +66,22 @@ var Section = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
125
66
|
key: index
|
|
126
67
|
}, child);
|
|
127
68
|
})) : children;
|
|
128
|
-
var childrenMarkup = title !== undefined ?
|
|
129
|
-
// eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
|
|
130
|
-
, {
|
|
131
|
-
cssFn: UNSAFE_headingOverrides,
|
|
69
|
+
var childrenMarkup = title !== undefined ? /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(HeadingItem, {
|
|
132
70
|
testId: testId && "".concat(testId, "--heading"),
|
|
133
71
|
"aria-hidden": true
|
|
134
|
-
|
|
135
|
-
|
|
72
|
+
// @ts-expect-error
|
|
73
|
+
// eslint-disable-next-line @atlaskit/design-system/no-unsafe-style-overrides
|
|
74
|
+
,
|
|
75
|
+
className: ax([isSideNavSection && styles.sideNavSectionHeading])
|
|
76
|
+
}, title), content) : /*#__PURE__*/React.createElement(Fragment, null, content);
|
|
77
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
136
78
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
137
|
-
className: UNSAFE_className,
|
|
79
|
+
className: ax([styles.root, isScrollable ? styles.scrollable : styles.unscrollable, hasSeparator ? styles.thinSeparator : styles.noSeparator, UNSAFE_className]),
|
|
138
80
|
id: id
|
|
139
81
|
// NOTE: Firefox allows elements that have "overflow: auto" to gain focus (as if it had tab-index="0")
|
|
140
82
|
// We have made a deliberate choice to leave this behaviour as is.
|
|
141
83
|
,
|
|
142
|
-
|
|
84
|
+
|
|
143
85
|
"aria-label": title,
|
|
144
86
|
"aria-labelledby": titleId,
|
|
145
87
|
"data-testid": testId,
|
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';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { jsx } from '@emotion/react';
|
|
3
2
|
import type { HeadingItemProps } from '../types';
|
|
4
3
|
/**
|
|
5
4
|
* __Heading item__
|
|
@@ -9,5 +8,5 @@ import type { HeadingItemProps } from '../types';
|
|
|
9
8
|
* - [Examples](https://atlaskit.atlassian.com/packages/design-system/menu/docs/heading-item)
|
|
10
9
|
* - [Code](https://atlaskit.atlassian.com/packages/design-system/menu)
|
|
11
10
|
*/
|
|
12
|
-
declare const HeadingItem: import("react").MemoExoticComponent<({ children, testId, headingLevel, id,
|
|
11
|
+
declare const HeadingItem: import("react").MemoExoticComponent<({ children, testId, headingLevel, id, className: UNSAFE_className, ...rest }: HeadingItemProps) => JSX.Element>;
|
|
13
12
|
export default HeadingItem;
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* @jsxRuntime classic
|
|
3
|
-
* @jsx jsx
|
|
4
|
-
*/
|
|
5
|
-
import { jsx } from '@emotion/react';
|
|
1
|
+
/// <reference types="react" />
|
|
6
2
|
import type { MenuGroupProps } from '../types';
|
|
7
3
|
/**
|
|
8
4
|
* __Menu group__
|
|
@@ -12,5 +8,5 @@ import type { MenuGroupProps } from '../types';
|
|
|
12
8
|
* - [Examples](https://atlaskit.atlassian.com/packages/design-system/menu/docs/menu-group)
|
|
13
9
|
* - [Code](https://atlaskit.atlassian.com/packages/design-system/menu)
|
|
14
10
|
*/
|
|
15
|
-
declare const MenuGroup: ({ isLoading, maxWidth, minWidth, minHeight, maxHeight, testId, role, spacing, className: UNSAFE_className, ...rest }: MenuGroupProps) =>
|
|
11
|
+
declare const MenuGroup: ({ isLoading, maxWidth, minWidth, minHeight, maxHeight, testId, role, spacing, className: UNSAFE_className, ...rest }: MenuGroupProps) => JSX.Element;
|
|
16
12
|
export default MenuGroup;
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
* @jsxRuntime classic
|
|
3
|
-
* @jsx jsx
|
|
4
|
-
*/
|
|
5
|
-
import { jsx } from '@emotion/react';
|
|
1
|
+
/// <reference types="react" />
|
|
6
2
|
import type { MenuGroupProps } from '../types';
|
|
7
3
|
/**
|
|
8
4
|
* @deprecated refer to MenuGroup, explicitly set maxWidth and minWidth
|
|
9
5
|
*/
|
|
10
|
-
declare const PopupMenuGroup: ({ maxWidth, minWidth, ...rest }: MenuGroupProps) =>
|
|
6
|
+
declare const PopupMenuGroup: ({ maxWidth, minWidth, ...rest }: MenuGroupProps) => JSX.Element;
|
|
11
7
|
export default PopupMenuGroup;
|
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: {
|
|
@@ -347,13 +324,6 @@ export interface SkeletonItemProps {
|
|
|
347
324
|
cssFn?: StatelessCSSFn;
|
|
348
325
|
}
|
|
349
326
|
export interface HeadingItemProps {
|
|
350
|
-
/**
|
|
351
|
-
* A function that overrides the styles.
|
|
352
|
-
* It receives the current styles and returns a customized styles object.
|
|
353
|
-
*
|
|
354
|
-
* @deprecated This API is deprecated and will be removed in a future release. See DSP-2676 for more information.
|
|
355
|
-
*/
|
|
356
|
-
cssFn?: StatelessCSSFn;
|
|
357
327
|
/**
|
|
358
328
|
* The text of the heading.
|
|
359
329
|
*/
|