@atlaskit/menu 2.2.1 → 2.3.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 +9 -0
- package/dist/cjs/internal/components/menu-item-primitive.js +35 -25
- package/dist/cjs/menu-item/heading-item.js +8 -3
- package/dist/es2019/internal/components/menu-item-primitive.js +34 -24
- package/dist/es2019/menu-item/heading-item.js +8 -3
- package/dist/esm/internal/components/menu-item-primitive.js +34 -24
- package/dist/esm/menu-item/heading-item.js +8 -3
- package/package.json +7 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/menu
|
|
2
2
|
|
|
3
|
+
## 2.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#100991](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/100991)
|
|
8
|
+
[`364a95234076`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/364a95234076) -
|
|
9
|
+
[ux] We are testing a visual change behind a feature flag. The line height of menu item title
|
|
10
|
+
changes. If this change is successful it will be available in a later release.
|
|
11
|
+
|
|
3
12
|
## 2.2.1
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -10,7 +10,7 @@ var _react2 = require("@emotion/react");
|
|
|
10
10
|
var _deprecationWarning = require("@atlaskit/ds-lib/deprecation-warning");
|
|
11
11
|
var _focusRing = _interopRequireDefault(require("@atlaskit/focus-ring"));
|
|
12
12
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
|
-
var
|
|
13
|
+
var _primitives = require("@atlaskit/primitives");
|
|
14
14
|
var _colors = require("@atlaskit/theme/colors");
|
|
15
15
|
var _menuContext = require("./menu-context");
|
|
16
16
|
/** @jsx jsx */
|
|
@@ -27,29 +27,35 @@ var beforeAfterElementStyles = (0, _react2.css)({
|
|
|
27
27
|
justifyContent: 'center',
|
|
28
28
|
flexShrink: 0
|
|
29
29
|
});
|
|
30
|
-
var contentStyles = (0,
|
|
31
|
-
display: 'flex',
|
|
32
|
-
justifyContent: 'center',
|
|
33
|
-
flexDirection: 'column',
|
|
34
|
-
flexGrow: 1,
|
|
35
|
-
lineHeight: "var(--ds-font-lineHeight-100, 16px)",
|
|
30
|
+
var contentStyles = (0, _primitives.xcss)({
|
|
36
31
|
outline: 'none',
|
|
37
32
|
overflow: 'hidden',
|
|
38
33
|
textAlign: 'left'
|
|
39
34
|
});
|
|
35
|
+
var baseContentStyles = (0, _primitives.xcss)({
|
|
36
|
+
lineHeight: "var(--ds-font-lineHeight-100, 16px)"
|
|
37
|
+
});
|
|
40
38
|
var truncateStyles = (0, _react2.css)({
|
|
41
39
|
display: 'block',
|
|
42
40
|
overflow: 'hidden',
|
|
43
41
|
textOverflow: 'ellipsis',
|
|
44
42
|
whiteSpace: 'nowrap'
|
|
45
43
|
});
|
|
44
|
+
var titleStyles = (0, _react2.css)({
|
|
45
|
+
font: "var(--ds-font-body, normal 400 14px/20px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)"
|
|
46
|
+
});
|
|
46
47
|
var wordBreakStyles = (0, _react2.css)({
|
|
47
48
|
wordBreak: 'break-word'
|
|
48
49
|
});
|
|
49
50
|
var descriptionStyles = (0, _react2.css)({
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
color: "var(--ds-text-subtlest, ".concat(_colors.N200, ")")
|
|
52
|
+
});
|
|
53
|
+
var baseDescriptionStyles = (0, _react2.css)({
|
|
54
|
+
fontSize: "var(--ds-font-size-075, 12px)",
|
|
55
|
+
marginBlockStart: "var(--ds-space-050, 4px)"
|
|
56
|
+
});
|
|
57
|
+
var tokenizedDescriptionStyles = (0, _react2.css)({
|
|
58
|
+
font: "var(--ds-font-body-UNSAFE_small, normal 400 12px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)"
|
|
53
59
|
});
|
|
54
60
|
var disabledDescriptionStyles = (0, _react2.css)({
|
|
55
61
|
color: "var(--ds-text-disabled, ".concat(_colors.N200, ")")
|
|
@@ -65,7 +71,6 @@ var primitiveStyles = (0, _react2.css)({
|
|
|
65
71
|
margin: "var(--ds-space-0, 0px)",
|
|
66
72
|
alignItems: 'center',
|
|
67
73
|
border: 0,
|
|
68
|
-
fontSize: "var(--ds-font-size-100, 14px)",
|
|
69
74
|
outline: 0,
|
|
70
75
|
textDecoration: 'none',
|
|
71
76
|
userSelect: 'none',
|
|
@@ -76,6 +81,9 @@ var primitiveStyles = (0, _react2.css)({
|
|
|
76
81
|
textDecoration: 'none'
|
|
77
82
|
}
|
|
78
83
|
});
|
|
84
|
+
var primitiveBaseStyles = (0, _react2.css)({
|
|
85
|
+
fontSize: "var(--ds-font-size-100, 14px)"
|
|
86
|
+
});
|
|
79
87
|
var spacingMapStyles = {
|
|
80
88
|
cozy: (0, _react2.css)({
|
|
81
89
|
// 8 * 2 (16) + icon (24) === 40
|
|
@@ -119,23 +127,23 @@ var selectedBorderStyles = (0, _react2.css)({
|
|
|
119
127
|
'&::before': {
|
|
120
128
|
width: 2,
|
|
121
129
|
position: 'absolute',
|
|
122
|
-
top: 0,
|
|
123
|
-
bottom: 0,
|
|
124
|
-
left: 0,
|
|
125
130
|
background: "var(--ds-border-selected, transparent)",
|
|
126
|
-
content: '""'
|
|
131
|
+
content: '""',
|
|
132
|
+
insetBlockEnd: 0,
|
|
133
|
+
insetBlockStart: 0,
|
|
134
|
+
insetInlineStart: 0
|
|
127
135
|
}
|
|
128
136
|
});
|
|
129
137
|
var selectedNotchStyles = (0, _react2.css)({
|
|
130
138
|
'&::before': {
|
|
131
139
|
width: 4,
|
|
132
140
|
position: 'absolute',
|
|
133
|
-
top: "var(--ds-space-150, 12px)",
|
|
134
|
-
bottom: "var(--ds-space-150, 12px)",
|
|
135
|
-
left: 0,
|
|
136
141
|
background: "var(--ds-border-selected, transparent)",
|
|
137
142
|
borderRadius: "0 ".concat("var(--ds-border-radius, 4px)", " ", "var(--ds-border-radius, 4px)", " 0"),
|
|
138
|
-
content: '""'
|
|
143
|
+
content: '""',
|
|
144
|
+
insetBlockEnd: "var(--ds-space-150, 12px)",
|
|
145
|
+
insetBlockStart: "var(--ds-space-150, 12px)",
|
|
146
|
+
insetInlineStart: 0
|
|
139
147
|
}
|
|
140
148
|
});
|
|
141
149
|
var selectedStyles = (0, _react2.css)({
|
|
@@ -202,8 +210,8 @@ var MenuItemPrimitive = function MenuItemPrimitive(_ref) {
|
|
|
202
210
|
return (0, _react2.jsx)(_focusRing.default, {
|
|
203
211
|
isInset: true
|
|
204
212
|
}, children({
|
|
205
|
-
className: cx([cn([positionRelativeStyles, primitiveStyles, spacingMapStyles[spacing], !isDisabled && !isSelected && unselectedStyles, !isDisabled && isSelected && [selectedStyles, [selectionStyle === 'border' && selectedBorderStyles, selectionStyle === 'notch' && selectedNotchStyles]], isDisabled ? disabledStyles : interactiveStyles]), UNSAFE_className]),
|
|
206
|
-
children: (0, _react2.jsx)(
|
|
213
|
+
className: cx([cn([positionRelativeStyles, primitiveStyles, (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.menu-tokenised-typography-styles') ? undefined : primitiveBaseStyles, spacingMapStyles[spacing], !isDisabled && !isSelected && unselectedStyles, !isDisabled && isSelected && [selectedStyles, [selectionStyle === 'border' && selectedBorderStyles, selectionStyle === 'notch' && selectedNotchStyles]], isDisabled ? disabledStyles : interactiveStyles]), UNSAFE_className]),
|
|
214
|
+
children: (0, _react2.jsx)(_primitives.Inline, {
|
|
207
215
|
as: "span",
|
|
208
216
|
spread: "space-between",
|
|
209
217
|
alignBlock: "center",
|
|
@@ -214,15 +222,17 @@ var MenuItemPrimitive = function MenuItemPrimitive(_ref) {
|
|
|
214
222
|
"data-item-elem-before": true,
|
|
215
223
|
css: beforeAfterElementStyles,
|
|
216
224
|
"data-testid": testId && "".concat(testId, "--icon-before")
|
|
217
|
-
}, iconBefore), title && (0, _react2.jsx)(
|
|
218
|
-
|
|
225
|
+
}, iconBefore), title && (0, _react2.jsx)(_primitives.Stack, {
|
|
226
|
+
alignBlock: "center",
|
|
227
|
+
grow: "fill",
|
|
228
|
+
xcss: (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.menu-tokenised-typography-styles') ? contentStyles : [contentStyles, baseContentStyles]
|
|
219
229
|
}, renderTitle('span', {
|
|
220
230
|
children: title,
|
|
221
|
-
className: cn(shouldTitleWrap ? wordBreakStyles : truncateStyles),
|
|
231
|
+
className: cn((0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.menu-tokenised-typography-styles') ? titleStyles : undefined, shouldTitleWrap ? wordBreakStyles : truncateStyles),
|
|
222
232
|
'data-item-title': true
|
|
223
233
|
}), description && (0, _react2.jsx)("span", {
|
|
224
234
|
"data-item-description": true,
|
|
225
|
-
css: [descriptionStyles, isDisabled && disabledDescriptionStyles, shouldDescriptionWrap ? wordBreakStyles : truncateStyles]
|
|
235
|
+
css: [descriptionStyles, (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.menu-tokenised-typography-styles') ? tokenizedDescriptionStyles : baseDescriptionStyles, isDisabled && disabledDescriptionStyles, shouldDescriptionWrap ? wordBreakStyles : truncateStyles]
|
|
226
236
|
}, description)), iconAfter && (0, _react2.jsx)("span", {
|
|
227
237
|
"data-item-elem-after": true,
|
|
228
238
|
css: beforeAfterElementStyles,
|
|
@@ -20,13 +20,18 @@ var itemHeadingContentHeight = _typography.headingSizes.h100.lineHeight;
|
|
|
20
20
|
var itemHeadingFontSize = _typography.headingSizes.h100.size;
|
|
21
21
|
var headingStyles = (0, _react2.css)({
|
|
22
22
|
color: "var(--ds-text-subtle, ".concat(_colors.N300, ")"),
|
|
23
|
+
paddingBlock: "var(--ds-space-0, 0px)",
|
|
24
|
+
paddingInline: "var(--ds-space-200, 16px)"
|
|
25
|
+
});
|
|
26
|
+
var baseHeadingStyles = (0, _react2.css)({
|
|
23
27
|
fontSize: itemHeadingFontSize,
|
|
24
28
|
fontWeight: "var(--ds-font-weight-bold, 700)",
|
|
25
29
|
lineHeight: itemHeadingContentHeight / itemHeadingFontSize,
|
|
26
|
-
paddingBlock: "var(--ds-space-0, 0px)",
|
|
27
|
-
paddingInline: "var(--ds-space-200, 16px)",
|
|
28
30
|
textTransform: 'uppercase'
|
|
29
31
|
});
|
|
32
|
+
var tokenizedHeadingStyles = (0, _react2.css)({
|
|
33
|
+
font: "var(--ds-font-heading-xxsmall, normal 600 12px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)"
|
|
34
|
+
});
|
|
30
35
|
|
|
31
36
|
/**
|
|
32
37
|
* __Heading item__
|
|
@@ -50,7 +55,7 @@ var HeadingItem = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
50
55
|
);
|
|
51
56
|
var UNSAFE_overrides = (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.unsafe-overrides-killswitch_c8j9m') ? undefined : (0, _react2.css)(cssFn(undefined));
|
|
52
57
|
return (0, _react2.jsx)("div", (0, _extends2.default)({
|
|
53
|
-
css: [headingStyles,
|
|
58
|
+
css: [headingStyles, (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.menu-tokenised-typography-styles') ? tokenizedHeadingStyles : baseHeadingStyles,
|
|
54
59
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
55
60
|
UNSAFE_overrides],
|
|
56
61
|
role: "heading",
|
|
@@ -4,7 +4,7 @@ import { ClassNames, css, jsx } from '@emotion/react';
|
|
|
4
4
|
import { propDeprecationWarning } from '@atlaskit/ds-lib/deprecation-warning';
|
|
5
5
|
import FocusRing from '@atlaskit/focus-ring';
|
|
6
6
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
7
|
-
import Inline from '@atlaskit/primitives
|
|
7
|
+
import { Inline, Stack, xcss } from '@atlaskit/primitives';
|
|
8
8
|
import { N20, N200, N30 } from '@atlaskit/theme/colors';
|
|
9
9
|
import { SELECTION_STYLE_CONTEXT_DO_NOT_USE, SpacingContext } from './menu-context';
|
|
10
10
|
const defaultRender = (Component, props) =>
|
|
@@ -16,29 +16,35 @@ const beforeAfterElementStyles = css({
|
|
|
16
16
|
justifyContent: 'center',
|
|
17
17
|
flexShrink: 0
|
|
18
18
|
});
|
|
19
|
-
const contentStyles =
|
|
20
|
-
display: 'flex',
|
|
21
|
-
justifyContent: 'center',
|
|
22
|
-
flexDirection: 'column',
|
|
23
|
-
flexGrow: 1,
|
|
24
|
-
lineHeight: "var(--ds-font-lineHeight-100, 16px)",
|
|
19
|
+
const contentStyles = xcss({
|
|
25
20
|
outline: 'none',
|
|
26
21
|
overflow: 'hidden',
|
|
27
22
|
textAlign: 'left'
|
|
28
23
|
});
|
|
24
|
+
const baseContentStyles = xcss({
|
|
25
|
+
lineHeight: "var(--ds-font-lineHeight-100, 16px)"
|
|
26
|
+
});
|
|
29
27
|
const truncateStyles = css({
|
|
30
28
|
display: 'block',
|
|
31
29
|
overflow: 'hidden',
|
|
32
30
|
textOverflow: 'ellipsis',
|
|
33
31
|
whiteSpace: 'nowrap'
|
|
34
32
|
});
|
|
33
|
+
const titleStyles = css({
|
|
34
|
+
font: "var(--ds-font-body, normal 400 14px/20px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)"
|
|
35
|
+
});
|
|
35
36
|
const wordBreakStyles = css({
|
|
36
37
|
wordBreak: 'break-word'
|
|
37
38
|
});
|
|
38
39
|
const descriptionStyles = css({
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
color: `var(--ds-text-subtlest, ${N200})`
|
|
41
|
+
});
|
|
42
|
+
const baseDescriptionStyles = css({
|
|
43
|
+
fontSize: "var(--ds-font-size-075, 12px)",
|
|
44
|
+
marginBlockStart: "var(--ds-space-050, 4px)"
|
|
45
|
+
});
|
|
46
|
+
const tokenizedDescriptionStyles = css({
|
|
47
|
+
font: "var(--ds-font-body-UNSAFE_small, normal 400 12px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)"
|
|
42
48
|
});
|
|
43
49
|
const disabledDescriptionStyles = css({
|
|
44
50
|
color: `var(--ds-text-disabled, ${N200})`
|
|
@@ -54,7 +60,6 @@ const primitiveStyles = css({
|
|
|
54
60
|
margin: "var(--ds-space-0, 0px)",
|
|
55
61
|
alignItems: 'center',
|
|
56
62
|
border: 0,
|
|
57
|
-
fontSize: "var(--ds-font-size-100, 14px)",
|
|
58
63
|
outline: 0,
|
|
59
64
|
textDecoration: 'none',
|
|
60
65
|
userSelect: 'none',
|
|
@@ -65,6 +70,9 @@ const primitiveStyles = css({
|
|
|
65
70
|
textDecoration: 'none'
|
|
66
71
|
}
|
|
67
72
|
});
|
|
73
|
+
const primitiveBaseStyles = css({
|
|
74
|
+
fontSize: "var(--ds-font-size-100, 14px)"
|
|
75
|
+
});
|
|
68
76
|
const spacingMapStyles = {
|
|
69
77
|
cozy: css({
|
|
70
78
|
// 8 * 2 (16) + icon (24) === 40
|
|
@@ -108,23 +116,23 @@ const selectedBorderStyles = css({
|
|
|
108
116
|
'&::before': {
|
|
109
117
|
width: 2,
|
|
110
118
|
position: 'absolute',
|
|
111
|
-
top: 0,
|
|
112
|
-
bottom: 0,
|
|
113
|
-
left: 0,
|
|
114
119
|
background: "var(--ds-border-selected, transparent)",
|
|
115
|
-
content: '""'
|
|
120
|
+
content: '""',
|
|
121
|
+
insetBlockEnd: 0,
|
|
122
|
+
insetBlockStart: 0,
|
|
123
|
+
insetInlineStart: 0
|
|
116
124
|
}
|
|
117
125
|
});
|
|
118
126
|
const selectedNotchStyles = css({
|
|
119
127
|
'&::before': {
|
|
120
128
|
width: 4,
|
|
121
129
|
position: 'absolute',
|
|
122
|
-
top: "var(--ds-space-150, 12px)",
|
|
123
|
-
bottom: "var(--ds-space-150, 12px)",
|
|
124
|
-
left: 0,
|
|
125
130
|
background: "var(--ds-border-selected, transparent)",
|
|
126
131
|
borderRadius: `0 ${"var(--ds-border-radius, 4px)"} ${"var(--ds-border-radius, 4px)"} 0`,
|
|
127
|
-
content: '""'
|
|
132
|
+
content: '""',
|
|
133
|
+
insetBlockEnd: "var(--ds-space-150, 12px)",
|
|
134
|
+
insetBlockStart: "var(--ds-space-150, 12px)",
|
|
135
|
+
insetInlineStart: 0
|
|
128
136
|
}
|
|
129
137
|
});
|
|
130
138
|
const selectedStyles = css({
|
|
@@ -189,7 +197,7 @@ const MenuItemPrimitive = ({
|
|
|
189
197
|
return jsx(FocusRing, {
|
|
190
198
|
isInset: true
|
|
191
199
|
}, children({
|
|
192
|
-
className: cx([cn([positionRelativeStyles, primitiveStyles, spacingMapStyles[spacing], !isDisabled && !isSelected && unselectedStyles, !isDisabled && isSelected && [selectedStyles, [selectionStyle === 'border' && selectedBorderStyles, selectionStyle === 'notch' && selectedNotchStyles]], isDisabled ? disabledStyles : interactiveStyles]), UNSAFE_className]),
|
|
200
|
+
className: cx([cn([positionRelativeStyles, primitiveStyles, getBooleanFF('platform.design-system-team.menu-tokenised-typography-styles') ? undefined : primitiveBaseStyles, spacingMapStyles[spacing], !isDisabled && !isSelected && unselectedStyles, !isDisabled && isSelected && [selectedStyles, [selectionStyle === 'border' && selectedBorderStyles, selectionStyle === 'notch' && selectedNotchStyles]], isDisabled ? disabledStyles : interactiveStyles]), UNSAFE_className]),
|
|
193
201
|
children: jsx(Inline, {
|
|
194
202
|
as: "span",
|
|
195
203
|
spread: "space-between",
|
|
@@ -201,15 +209,17 @@ const MenuItemPrimitive = ({
|
|
|
201
209
|
"data-item-elem-before": true,
|
|
202
210
|
css: beforeAfterElementStyles,
|
|
203
211
|
"data-testid": testId && `${testId}--icon-before`
|
|
204
|
-
}, iconBefore), title && jsx(
|
|
205
|
-
|
|
212
|
+
}, iconBefore), title && jsx(Stack, {
|
|
213
|
+
alignBlock: "center",
|
|
214
|
+
grow: "fill",
|
|
215
|
+
xcss: getBooleanFF('platform.design-system-team.menu-tokenised-typography-styles') ? contentStyles : [contentStyles, baseContentStyles]
|
|
206
216
|
}, renderTitle('span', {
|
|
207
217
|
children: title,
|
|
208
|
-
className: cn(shouldTitleWrap ? wordBreakStyles : truncateStyles),
|
|
218
|
+
className: cn(getBooleanFF('platform.design-system-team.menu-tokenised-typography-styles') ? titleStyles : undefined, shouldTitleWrap ? wordBreakStyles : truncateStyles),
|
|
209
219
|
'data-item-title': true
|
|
210
220
|
}), description && jsx("span", {
|
|
211
221
|
"data-item-description": true,
|
|
212
|
-
css: [descriptionStyles, isDisabled && disabledDescriptionStyles, shouldDescriptionWrap ? wordBreakStyles : truncateStyles]
|
|
222
|
+
css: [descriptionStyles, getBooleanFF('platform.design-system-team.menu-tokenised-typography-styles') ? tokenizedDescriptionStyles : baseDescriptionStyles, isDisabled && disabledDescriptionStyles, shouldDescriptionWrap ? wordBreakStyles : truncateStyles]
|
|
213
223
|
}, description)), iconAfter && jsx("span", {
|
|
214
224
|
"data-item-elem-after": true,
|
|
215
225
|
css: beforeAfterElementStyles,
|
|
@@ -11,13 +11,18 @@ const itemHeadingContentHeight = headingSizes.h100.lineHeight;
|
|
|
11
11
|
const itemHeadingFontSize = headingSizes.h100.size;
|
|
12
12
|
const headingStyles = css({
|
|
13
13
|
color: `var(--ds-text-subtle, ${N300})`,
|
|
14
|
+
paddingBlock: "var(--ds-space-0, 0px)",
|
|
15
|
+
paddingInline: "var(--ds-space-200, 16px)"
|
|
16
|
+
});
|
|
17
|
+
const baseHeadingStyles = css({
|
|
14
18
|
fontSize: itemHeadingFontSize,
|
|
15
19
|
fontWeight: "var(--ds-font-weight-bold, 700)",
|
|
16
20
|
lineHeight: itemHeadingContentHeight / itemHeadingFontSize,
|
|
17
|
-
paddingBlock: "var(--ds-space-0, 0px)",
|
|
18
|
-
paddingInline: "var(--ds-space-200, 16px)",
|
|
19
21
|
textTransform: 'uppercase'
|
|
20
22
|
});
|
|
23
|
+
const tokenizedHeadingStyles = css({
|
|
24
|
+
font: "var(--ds-font-heading-xxsmall, normal 600 12px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)"
|
|
25
|
+
});
|
|
21
26
|
|
|
22
27
|
/**
|
|
23
28
|
* __Heading item__
|
|
@@ -44,7 +49,7 @@ const HeadingItem = /*#__PURE__*/memo(({
|
|
|
44
49
|
);
|
|
45
50
|
const UNSAFE_overrides = getBooleanFF('platform.design-system-team.unsafe-overrides-killswitch_c8j9m') ? undefined : css(cssFn(undefined));
|
|
46
51
|
return jsx("div", _extends({
|
|
47
|
-
css: [headingStyles,
|
|
52
|
+
css: [headingStyles, getBooleanFF('platform.design-system-team.menu-tokenised-typography-styles') ? tokenizedHeadingStyles : baseHeadingStyles,
|
|
48
53
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
49
54
|
UNSAFE_overrides],
|
|
50
55
|
role: "heading",
|
|
@@ -4,7 +4,7 @@ import { ClassNames, css, jsx } from '@emotion/react';
|
|
|
4
4
|
import { propDeprecationWarning } from '@atlaskit/ds-lib/deprecation-warning';
|
|
5
5
|
import FocusRing from '@atlaskit/focus-ring';
|
|
6
6
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
7
|
-
import Inline from '@atlaskit/primitives
|
|
7
|
+
import { Inline, Stack, xcss } from '@atlaskit/primitives';
|
|
8
8
|
import { N20, N200, N30 } from '@atlaskit/theme/colors';
|
|
9
9
|
import { SELECTION_STYLE_CONTEXT_DO_NOT_USE, SpacingContext } from './menu-context';
|
|
10
10
|
var defaultRender = function defaultRender(Component, props) {
|
|
@@ -19,29 +19,35 @@ var beforeAfterElementStyles = css({
|
|
|
19
19
|
justifyContent: 'center',
|
|
20
20
|
flexShrink: 0
|
|
21
21
|
});
|
|
22
|
-
var contentStyles =
|
|
23
|
-
display: 'flex',
|
|
24
|
-
justifyContent: 'center',
|
|
25
|
-
flexDirection: 'column',
|
|
26
|
-
flexGrow: 1,
|
|
27
|
-
lineHeight: "var(--ds-font-lineHeight-100, 16px)",
|
|
22
|
+
var contentStyles = xcss({
|
|
28
23
|
outline: 'none',
|
|
29
24
|
overflow: 'hidden',
|
|
30
25
|
textAlign: 'left'
|
|
31
26
|
});
|
|
27
|
+
var baseContentStyles = xcss({
|
|
28
|
+
lineHeight: "var(--ds-font-lineHeight-100, 16px)"
|
|
29
|
+
});
|
|
32
30
|
var truncateStyles = css({
|
|
33
31
|
display: 'block',
|
|
34
32
|
overflow: 'hidden',
|
|
35
33
|
textOverflow: 'ellipsis',
|
|
36
34
|
whiteSpace: 'nowrap'
|
|
37
35
|
});
|
|
36
|
+
var titleStyles = css({
|
|
37
|
+
font: "var(--ds-font-body, normal 400 14px/20px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)"
|
|
38
|
+
});
|
|
38
39
|
var wordBreakStyles = css({
|
|
39
40
|
wordBreak: 'break-word'
|
|
40
41
|
});
|
|
41
42
|
var descriptionStyles = css({
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
color: "var(--ds-text-subtlest, ".concat(N200, ")")
|
|
44
|
+
});
|
|
45
|
+
var baseDescriptionStyles = css({
|
|
46
|
+
fontSize: "var(--ds-font-size-075, 12px)",
|
|
47
|
+
marginBlockStart: "var(--ds-space-050, 4px)"
|
|
48
|
+
});
|
|
49
|
+
var tokenizedDescriptionStyles = css({
|
|
50
|
+
font: "var(--ds-font-body-UNSAFE_small, normal 400 12px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)"
|
|
45
51
|
});
|
|
46
52
|
var disabledDescriptionStyles = css({
|
|
47
53
|
color: "var(--ds-text-disabled, ".concat(N200, ")")
|
|
@@ -57,7 +63,6 @@ var primitiveStyles = css({
|
|
|
57
63
|
margin: "var(--ds-space-0, 0px)",
|
|
58
64
|
alignItems: 'center',
|
|
59
65
|
border: 0,
|
|
60
|
-
fontSize: "var(--ds-font-size-100, 14px)",
|
|
61
66
|
outline: 0,
|
|
62
67
|
textDecoration: 'none',
|
|
63
68
|
userSelect: 'none',
|
|
@@ -68,6 +73,9 @@ var primitiveStyles = css({
|
|
|
68
73
|
textDecoration: 'none'
|
|
69
74
|
}
|
|
70
75
|
});
|
|
76
|
+
var primitiveBaseStyles = css({
|
|
77
|
+
fontSize: "var(--ds-font-size-100, 14px)"
|
|
78
|
+
});
|
|
71
79
|
var spacingMapStyles = {
|
|
72
80
|
cozy: css({
|
|
73
81
|
// 8 * 2 (16) + icon (24) === 40
|
|
@@ -111,23 +119,23 @@ var selectedBorderStyles = css({
|
|
|
111
119
|
'&::before': {
|
|
112
120
|
width: 2,
|
|
113
121
|
position: 'absolute',
|
|
114
|
-
top: 0,
|
|
115
|
-
bottom: 0,
|
|
116
|
-
left: 0,
|
|
117
122
|
background: "var(--ds-border-selected, transparent)",
|
|
118
|
-
content: '""'
|
|
123
|
+
content: '""',
|
|
124
|
+
insetBlockEnd: 0,
|
|
125
|
+
insetBlockStart: 0,
|
|
126
|
+
insetInlineStart: 0
|
|
119
127
|
}
|
|
120
128
|
});
|
|
121
129
|
var selectedNotchStyles = css({
|
|
122
130
|
'&::before': {
|
|
123
131
|
width: 4,
|
|
124
132
|
position: 'absolute',
|
|
125
|
-
top: "var(--ds-space-150, 12px)",
|
|
126
|
-
bottom: "var(--ds-space-150, 12px)",
|
|
127
|
-
left: 0,
|
|
128
133
|
background: "var(--ds-border-selected, transparent)",
|
|
129
134
|
borderRadius: "0 ".concat("var(--ds-border-radius, 4px)", " ", "var(--ds-border-radius, 4px)", " 0"),
|
|
130
|
-
content: '""'
|
|
135
|
+
content: '""',
|
|
136
|
+
insetBlockEnd: "var(--ds-space-150, 12px)",
|
|
137
|
+
insetBlockStart: "var(--ds-space-150, 12px)",
|
|
138
|
+
insetInlineStart: 0
|
|
131
139
|
}
|
|
132
140
|
});
|
|
133
141
|
var selectedStyles = css({
|
|
@@ -194,7 +202,7 @@ var MenuItemPrimitive = function MenuItemPrimitive(_ref) {
|
|
|
194
202
|
return jsx(FocusRing, {
|
|
195
203
|
isInset: true
|
|
196
204
|
}, children({
|
|
197
|
-
className: cx([cn([positionRelativeStyles, primitiveStyles, spacingMapStyles[spacing], !isDisabled && !isSelected && unselectedStyles, !isDisabled && isSelected && [selectedStyles, [selectionStyle === 'border' && selectedBorderStyles, selectionStyle === 'notch' && selectedNotchStyles]], isDisabled ? disabledStyles : interactiveStyles]), UNSAFE_className]),
|
|
205
|
+
className: cx([cn([positionRelativeStyles, primitiveStyles, getBooleanFF('platform.design-system-team.menu-tokenised-typography-styles') ? undefined : primitiveBaseStyles, spacingMapStyles[spacing], !isDisabled && !isSelected && unselectedStyles, !isDisabled && isSelected && [selectedStyles, [selectionStyle === 'border' && selectedBorderStyles, selectionStyle === 'notch' && selectedNotchStyles]], isDisabled ? disabledStyles : interactiveStyles]), UNSAFE_className]),
|
|
198
206
|
children: jsx(Inline, {
|
|
199
207
|
as: "span",
|
|
200
208
|
spread: "space-between",
|
|
@@ -206,15 +214,17 @@ var MenuItemPrimitive = function MenuItemPrimitive(_ref) {
|
|
|
206
214
|
"data-item-elem-before": true,
|
|
207
215
|
css: beforeAfterElementStyles,
|
|
208
216
|
"data-testid": testId && "".concat(testId, "--icon-before")
|
|
209
|
-
}, iconBefore), title && jsx(
|
|
210
|
-
|
|
217
|
+
}, iconBefore), title && jsx(Stack, {
|
|
218
|
+
alignBlock: "center",
|
|
219
|
+
grow: "fill",
|
|
220
|
+
xcss: getBooleanFF('platform.design-system-team.menu-tokenised-typography-styles') ? contentStyles : [contentStyles, baseContentStyles]
|
|
211
221
|
}, renderTitle('span', {
|
|
212
222
|
children: title,
|
|
213
|
-
className: cn(shouldTitleWrap ? wordBreakStyles : truncateStyles),
|
|
223
|
+
className: cn(getBooleanFF('platform.design-system-team.menu-tokenised-typography-styles') ? titleStyles : undefined, shouldTitleWrap ? wordBreakStyles : truncateStyles),
|
|
214
224
|
'data-item-title': true
|
|
215
225
|
}), description && jsx("span", {
|
|
216
226
|
"data-item-description": true,
|
|
217
|
-
css: [descriptionStyles, isDisabled && disabledDescriptionStyles, shouldDescriptionWrap ? wordBreakStyles : truncateStyles]
|
|
227
|
+
css: [descriptionStyles, getBooleanFF('platform.design-system-team.menu-tokenised-typography-styles') ? tokenizedDescriptionStyles : baseDescriptionStyles, isDisabled && disabledDescriptionStyles, shouldDescriptionWrap ? wordBreakStyles : truncateStyles]
|
|
218
228
|
}, description)), iconAfter && jsx("span", {
|
|
219
229
|
"data-item-elem-after": true,
|
|
220
230
|
css: beforeAfterElementStyles,
|
|
@@ -13,13 +13,18 @@ var itemHeadingContentHeight = headingSizes.h100.lineHeight;
|
|
|
13
13
|
var itemHeadingFontSize = headingSizes.h100.size;
|
|
14
14
|
var headingStyles = css({
|
|
15
15
|
color: "var(--ds-text-subtle, ".concat(N300, ")"),
|
|
16
|
+
paddingBlock: "var(--ds-space-0, 0px)",
|
|
17
|
+
paddingInline: "var(--ds-space-200, 16px)"
|
|
18
|
+
});
|
|
19
|
+
var baseHeadingStyles = css({
|
|
16
20
|
fontSize: itemHeadingFontSize,
|
|
17
21
|
fontWeight: "var(--ds-font-weight-bold, 700)",
|
|
18
22
|
lineHeight: itemHeadingContentHeight / itemHeadingFontSize,
|
|
19
|
-
paddingBlock: "var(--ds-space-0, 0px)",
|
|
20
|
-
paddingInline: "var(--ds-space-200, 16px)",
|
|
21
23
|
textTransform: 'uppercase'
|
|
22
24
|
});
|
|
25
|
+
var tokenizedHeadingStyles = css({
|
|
26
|
+
font: "var(--ds-font-heading-xxsmall, normal 600 12px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)"
|
|
27
|
+
});
|
|
23
28
|
|
|
24
29
|
/**
|
|
25
30
|
* __Heading item__
|
|
@@ -43,7 +48,7 @@ var HeadingItem = /*#__PURE__*/memo(function (_ref) {
|
|
|
43
48
|
);
|
|
44
49
|
var UNSAFE_overrides = getBooleanFF('platform.design-system-team.unsafe-overrides-killswitch_c8j9m') ? undefined : css(cssFn(undefined));
|
|
45
50
|
return jsx("div", _extends({
|
|
46
|
-
css: [headingStyles,
|
|
51
|
+
css: [headingStyles, getBooleanFF('platform.design-system-team.menu-tokenised-typography-styles') ? tokenizedHeadingStyles : baseHeadingStyles,
|
|
47
52
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
48
53
|
UNSAFE_overrides],
|
|
49
54
|
role: "heading",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/menu",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.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/"
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
"@atlaskit/ds-lib": "^2.3.0",
|
|
47
47
|
"@atlaskit/focus-ring": "^1.4.0",
|
|
48
48
|
"@atlaskit/platform-feature-flags": "^0.2.0",
|
|
49
|
-
"@atlaskit/primitives": "^6.
|
|
50
|
-
"@atlaskit/theme": "^12.
|
|
51
|
-
"@atlaskit/tokens": "^1.
|
|
49
|
+
"@atlaskit/primitives": "^6.2.0",
|
|
50
|
+
"@atlaskit/theme": "^12.8.0",
|
|
51
|
+
"@atlaskit/tokens": "^1.48.0",
|
|
52
52
|
"@babel/runtime": "^7.0.0",
|
|
53
53
|
"@emotion/react": "^11.7.1"
|
|
54
54
|
},
|
|
@@ -126,6 +126,9 @@
|
|
|
126
126
|
},
|
|
127
127
|
"platform.design-system-team.section-1px-seperator-borders": {
|
|
128
128
|
"type": "boolean"
|
|
129
|
+
},
|
|
130
|
+
"platform.design-system-team.menu-tokenised-typography-styles": {
|
|
131
|
+
"type": "boolean"
|
|
129
132
|
}
|
|
130
133
|
},
|
|
131
134
|
"homepage": "https://atlassian.design/components/menu/",
|