@atlaskit/menu 3.2.0 → 4.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.
Files changed (30) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/cjs/internal/components/menu-item-primitive.compiled.css +81 -0
  3. package/dist/cjs/internal/components/menu-item-primitive.js +47 -174
  4. package/dist/cjs/menu-item/button-item.js +10 -22
  5. package/dist/cjs/menu-item/custom-item.js +11 -25
  6. package/dist/cjs/menu-item/link-item.js +10 -22
  7. package/dist/cjs/menu-item/skeleton-heading-item.js +1 -4
  8. package/dist/cjs/menu-item/skeleton-item.js +1 -4
  9. package/dist/cjs/menu-section/section.js +1 -4
  10. package/dist/es2019/internal/components/menu-item-primitive.compiled.css +81 -0
  11. package/dist/es2019/internal/components/menu-item-primitive.js +43 -172
  12. package/dist/es2019/menu-item/button-item.js +5 -20
  13. package/dist/es2019/menu-item/custom-item.js +6 -24
  14. package/dist/es2019/menu-item/link-item.js +5 -20
  15. package/dist/es2019/menu-item/skeleton-heading-item.js +1 -4
  16. package/dist/es2019/menu-item/skeleton-item.js +1 -4
  17. package/dist/es2019/menu-section/section.js +1 -4
  18. package/dist/esm/internal/components/menu-item-primitive.compiled.css +81 -0
  19. package/dist/esm/internal/components/menu-item-primitive.js +43 -171
  20. package/dist/esm/menu-item/button-item.js +6 -22
  21. package/dist/esm/menu-item/custom-item.js +7 -26
  22. package/dist/esm/menu-item/link-item.js +6 -22
  23. package/dist/esm/menu-item/skeleton-heading-item.js +1 -4
  24. package/dist/esm/menu-item/skeleton-item.js +1 -4
  25. package/dist/esm/menu-section/section.js +1 -4
  26. package/dist/types/internal/components/menu-item-primitive.d.ts +2 -2
  27. package/dist/types/types.d.ts +2 -9
  28. package/dist/types-ts4.5/internal/components/menu-item-primitive.d.ts +2 -2
  29. package/dist/types-ts4.5/types.d.ts +2 -9
  30. package/package.json +16 -12
@@ -1,162 +1,40 @@
1
- /**
2
- * @jsxRuntime classic
3
- * @jsx jsx
4
- */
1
+ /* menu-item-primitive.tsx generated by @compiled/babel-plugin v0.36.1 */
2
+ import "./menu-item-primitive.compiled.css";
3
+ import * as React from 'react';
5
4
  import { useContext } from 'react';
6
-
7
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
8
- import { ClassNames, css, jsx } from '@emotion/react';
5
+ import { ax, ix } from '@compiled/react/runtime';
9
6
  import { propDeprecationWarning } from '@atlaskit/ds-lib/deprecation-warning';
10
- import FocusRing from '@atlaskit/focus-ring';
11
7
  import { fg } from '@atlaskit/platform-feature-flags';
12
- import { Inline, Stack, xcss } from '@atlaskit/primitives';
13
- import { N20, N200, N30 } from '@atlaskit/theme/colors';
8
+ import { Inline } from '@atlaskit/primitives/compiled';
14
9
  import { SELECTION_STYLE_CONTEXT_DO_NOT_USE, SpacingContext } from './menu-context';
15
10
  var defaultRender = function defaultRender(Component, props) {
16
11
  return (
12
+ /*#__PURE__*/
17
13
  // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
18
- jsx(Component, props)
14
+ React.createElement(Component, props)
19
15
  );
20
16
  };
21
- var beforeAfterElementStylesOld = css({
22
- display: 'flex',
23
- alignItems: 'center',
24
- justifyContent: 'center',
25
- flexShrink: 0
26
- });
27
- var beforeAfterElementStyles = css({
28
- display: 'flex',
29
- minWidth: 24,
30
- minHeight: 24,
31
- alignItems: 'center',
32
- justifyContent: 'center',
33
- flexShrink: 0
34
- });
35
- var contentStyles = xcss({
36
- outline: 'none',
37
- overflow: 'hidden',
38
- textAlign: 'left'
39
- });
40
- var truncateStyles = css({
41
- display: 'block',
42
- overflow: 'hidden',
43
- textOverflow: 'ellipsis',
44
- whiteSpace: 'nowrap'
45
- });
46
- var titleStyles = css({
47
- font: "var(--ds-font-body, normal 400 14px/20px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)"
48
- });
49
- var wordBreakStyles = css({
50
- wordBreak: 'break-word'
51
- });
52
- var descriptionStyles = css({
53
- color: "var(--ds-text-subtlest, ".concat(N200, ")"),
54
- font: "var(--ds-font-body-UNSAFE_small, normal 400 12px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)"
55
- });
56
- var disabledDescriptionStyles = css({
57
- color: "var(--ds-text-disabled, ".concat(N200, ")")
58
- });
59
- var positionRelativeStyles = css({
60
- position: 'relative'
61
- });
62
- var primitiveStyles = css({
63
- display: 'flex',
64
- boxSizing: 'border-box',
65
- width: '100%',
66
- minHeight: 40,
67
- margin: "var(--ds-space-0, 0px)",
68
- alignItems: 'center',
69
- border: 0,
70
- outline: 0,
71
- textDecoration: 'none',
72
- userSelect: 'none',
73
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
74
- '&::-moz-focus-inner': {
75
- border: 0
76
- },
77
- '&:hover': {
78
- textDecoration: 'none'
79
- }
80
- });
17
+ var styles = {
18
+ root: "_19itidpf _12ji1r31 _1qu2glyw _12y3idpf _4bfu1r31 _1hmsglyw _ajmmnqa1 _kqswh2mm _1e0c1txw _vchhusvi _1bsb1osq _1tke1ylp _19pkze3t _2hwxze3t _otyrze3t _18u0ze3t _4cvr1h6o _uiztglyw _80omtlke _mizu194a _1ah311pw _ra3xnqa1 _128m1bk5 _9oik1r31 _1bnxglyw _jf4cnqa1 _1cvmnqa1 _4davt94y",
19
+ beforeAfterElementOld: "_1e0c1txw _4cvr1h6o _1bah1h6o _1o9zidpf",
20
+ beforeAfterElement: "_1e0c1txw _1ul91tcg _1tke1tcg _4cvr1h6o _1bah1h6o _1o9zidpf",
21
+ content: "_12ji1r31 _1qu2glyw _12y31o36 _1reo15vq _18m915vq _1e0c1txw _2lx21bp4 _1bah1h6o _16jlkb7n _y3gn1e5h",
22
+ truncate: "_1reo15vq _18m915vq _1e0c1ule _1bto1l2s _o5721q9c",
23
+ title: "_11c82smr",
24
+ wordBreak: "_1nmz1hna",
25
+ description: "_11c8dcr7 _syaz1wmz",
26
+ disabledDescription: "_syaz2oi6",
27
+ unselected: "_bfhkqtfy _syaz1r31 _10531r31 _irr31dko _30l31r31 _1di61dko _9h8h1r31",
28
+ disabled: "_80om13gf _bfhkqtfy _syaz2oi6 _irr3qtfy _30l32oi6 _1di6qtfy _9h8h2oi6",
29
+ selectedBorder: "_1mp4yh40 _1cs8stnw _1rus67is _1kt9b3bt _1fkrze3t _iajmze3t _z5wtze3t",
30
+ selectedNotch: "_rfx315o9 _1mp41y44 _1cs8stnw _1rus67is _1kt9b3bt _1fkrutpp _iajmutpp _z5wtze3t",
31
+ selected: "_bfhk1q4k _syazhu5v _1053hu5v _irr32seo _30l316ov _1di6guph _9h8hhu5v",
32
+ selectedOld: "_30l3hu5v"
33
+ };
81
34
  var spacingMapStyles = {
82
- cozy: css({
83
- // 8 * 2 (16) + icon (24) === 40
84
- paddingBlock: "var(--ds-space-100, 8px)",
85
- paddingInline: "var(--ds-space-200, 16px)"
86
- }),
87
- compact: css({
88
- minHeight: 32,
89
- // 4 * 2 (8) + icon (24) === 32
90
- paddingBlock: "var(--ds-space-050, 4px)",
91
- paddingInline: "var(--ds-space-150, 12px)"
92
- })
35
+ cozy: "_1rjcu2gc _18zrpxbi",
36
+ compact: "_1rjc1b66 _18zrutpp _1tkezwfg"
93
37
  };
94
- var interactiveStyles = css({
95
- cursor: 'pointer'
96
- });
97
- var unselectedStyles = css({
98
- backgroundColor: "var(--ds-background-neutral-subtle, transparent)",
99
- color: 'currentColor',
100
- '&:visited': {
101
- color: 'currentColor'
102
- },
103
- '&:hover': {
104
- backgroundColor: "var(--ds-background-neutral-subtle-hovered, ".concat(N20, ")"),
105
- color: 'currentColor'
106
- },
107
- '&:active': {
108
- backgroundColor: "var(--ds-background-neutral-subtle-pressed, ".concat(N30, ")"),
109
- boxShadow: 'none',
110
- color: 'currentColor'
111
- }
112
- });
113
- var disabledStyles = css({
114
- cursor: 'not-allowed',
115
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
116
- '&, :hover, :active': {
117
- backgroundColor: "var(--ds-background-neutral-subtle, transparent)",
118
- color: "var(--ds-text-disabled, ".concat(N200, ")")
119
- }
120
- });
121
- var selectedBorderStyles = css({
122
- '&::before': {
123
- width: 2,
124
- position: 'absolute',
125
- background: "var(--ds-border-selected, transparent)",
126
- content: '""',
127
- insetBlockEnd: 0,
128
- insetBlockStart: 0,
129
- insetInlineStart: 0
130
- }
131
- });
132
- var selectedNotchStyles = css({
133
- '&::before': {
134
- width: 4,
135
- position: 'absolute',
136
- background: "var(--ds-border-selected, transparent)",
137
- borderRadius: "0 ".concat("var(--ds-border-radius, 4px)", " ", "var(--ds-border-radius, 4px)", " 0"),
138
- content: '""',
139
- insetBlockEnd: "var(--ds-space-150, 12px)",
140
- insetBlockStart: "var(--ds-space-150, 12px)",
141
- insetInlineStart: 0
142
- }
143
- });
144
- var selectedStyles = css({
145
- backgroundColor: "var(--ds-background-selected, ".concat(N20, ")"),
146
- // Fallback set as babel plugin inserts one otherwise
147
- color: "var(--ds-text-selected, currentColor)",
148
- '&:visited': {
149
- color: "var(--ds-text-selected, currentColor)"
150
- },
151
- '&:hover': {
152
- backgroundColor: "var(--ds-background-selected-hovered, ".concat(N20, ")"),
153
- color: "var(--ds-text-selected, currentColor)"
154
- },
155
- '&:active': {
156
- backgroundColor: "var(--ds-background-selected-pressed, ".concat(N30, ")"),
157
- color: "var(--ds-text-selected, currentColor)"
158
- }
159
- });
160
38
  var gapMap = {
161
39
  compact: 'space.100',
162
40
  cozy: 'space.150'
@@ -199,41 +77,35 @@ var MenuItemPrimitive = function MenuItemPrimitive(_ref) {
199
77
  var selectionStyle = useContext(SELECTION_STYLE_CONTEXT_DO_NOT_USE);
200
78
  var renderTitle = overrides && overrides.Title && overrides.Title.render || defaultRender;
201
79
  var UNSAFE_className = UNSAFE_externalClassName;
202
- return jsx(ClassNames, null, function (_ref2) {
203
- var cn = _ref2.css,
204
- cx = _ref2.cx;
205
- return jsx(FocusRing, {
206
- isInset: true
207
- }, children({
208
- className: cx([cn([positionRelativeStyles, primitiveStyles, spacingMapStyles[spacing], !isDisabled && !isSelected && unselectedStyles, !isDisabled && isSelected && [selectedStyles, [selectionStyle === 'border' && selectedBorderStyles, selectionStyle === 'notch' && selectedNotchStyles]], isDisabled ? disabledStyles : interactiveStyles]), UNSAFE_className]),
209
- children: jsx(Inline, {
80
+ return function () {
81
+ return children({
82
+ className: ax([ax([styles.root, spacingMapStyles[spacing], !isDisabled && !isSelected && styles.unselected, !isDisabled && isSelected && styles.selected, !fg('platform_fix_a11y_selected_and_hovered_state_color') && !isDisabled && isSelected && styles.selectedOld, !isDisabled && isSelected && selectionStyle === 'border' && styles.selectedBorder, !isDisabled && isSelected && selectionStyle === 'notch' && styles.selectedNotch, isDisabled && styles.disabled]), UNSAFE_className]),
83
+ children: /*#__PURE__*/React.createElement(Inline, {
210
84
  as: "span",
211
85
  spread: "space-between",
212
86
  alignBlock: "center",
213
87
  space: gapMap[spacing],
214
88
  grow: "fill",
215
89
  testId: testId && "".concat(testId, "--container")
216
- }, iconBefore && jsx("span", {
90
+ }, iconBefore && /*#__PURE__*/React.createElement("span", {
217
91
  "data-item-elem-before": true,
218
- css: fg('platform_ads_component_no_icon_spacing_support') ? beforeAfterElementStyles : beforeAfterElementStylesOld,
219
- "data-testid": testId && "".concat(testId, "--icon-before")
220
- }, iconBefore), title && jsx(Stack, {
221
- alignBlock: "center",
222
- grow: "fill",
223
- xcss: contentStyles
92
+ "data-testid": testId && "".concat(testId, "--icon-before"),
93
+ className: ax([fg('platform_ads_component_no_icon_spacing_support') && styles.beforeAfterElement, !fg('platform_ads_component_no_icon_spacing_support') && styles.beforeAfterElementOld])
94
+ }, iconBefore), title && /*#__PURE__*/React.createElement("div", {
95
+ className: ax([styles.content])
224
96
  }, renderTitle('span', {
225
97
  children: title,
226
- className: cn(titleStyles, shouldTitleWrap ? wordBreakStyles : truncateStyles),
98
+ className: ax([styles.title, shouldTitleWrap ? styles.wordBreak : styles.truncate]),
227
99
  'data-item-title': true
228
- }), description && jsx("span", {
100
+ }), description && /*#__PURE__*/React.createElement("span", {
229
101
  "data-item-description": true,
230
- css: [descriptionStyles, isDisabled && disabledDescriptionStyles, shouldDescriptionWrap ? wordBreakStyles : truncateStyles]
231
- }, description)), iconAfter && jsx("span", {
102
+ className: ax([styles.description, isDisabled && styles.disabledDescription, shouldDescriptionWrap && styles.wordBreak, !shouldDescriptionWrap && styles.truncate])
103
+ }, description)), iconAfter && /*#__PURE__*/React.createElement("span", {
232
104
  "data-item-elem-after": true,
233
- css: fg('platform_ads_component_no_icon_spacing_support') ? beforeAfterElementStyles : beforeAfterElementStylesOld,
234
- "data-testid": testId && "".concat(testId, "--icon-after")
105
+ "data-testid": testId && "".concat(testId, "--icon-after"),
106
+ className: ax([fg('platform_ads_component_no_icon_spacing_support') && styles.beforeAfterElement, !fg('platform_ads_component_no_icon_spacing_support') && styles.beforeAfterElementOld])
235
107
  }, iconAfter))
236
- }));
237
- });
108
+ });
109
+ }();
238
110
  };
239
111
  export default MenuItemPrimitive;
@@ -1,16 +1,10 @@
1
+ /* button-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", "cssFn", "description", "iconAfter", "iconBefore", "isDisabled", "isSelected", "onClick", "testId", "overrides", "onMouseDown", "shouldTitleWrap", "shouldDescriptionWrap", "className", "interactionName"];
4
- /**
5
- * @jsxRuntime classic
6
- * @jsx jsx
7
- */
4
+ var _excluded = ["children", "description", "iconAfter", "iconBefore", "isDisabled", "isSelected", "onClick", "testId", "overrides", "onMouseDown", "shouldTitleWrap", "shouldDescriptionWrap", "className", "interactionName"];
5
+ import * as React from 'react';
6
+ import { ax, ix } from "@compiled/react/runtime";
8
7
  import { forwardRef, memo, useCallback, useContext } from 'react';
9
-
10
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
11
- import { jsx } from '@emotion/react';
12
- import { propDeprecationWarning } from '@atlaskit/ds-lib/deprecation-warning';
13
- import noop from '@atlaskit/ds-lib/noop';
14
8
  import InteractionContext from '@atlaskit/interaction-context';
15
9
  import { fg } from '@atlaskit/platform-feature-flags';
16
10
  import MenuItemPrimitive from '../internal/components/menu-item-primitive';
@@ -26,8 +20,6 @@ var ButtonItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(
26
20
  // Type needed on props to extract types with extract react types.
27
21
  function (props, ref) {
28
22
  var children = props.children,
29
- _props$cssFn = props.cssFn,
30
- cssFn = _props$cssFn === void 0 ? noop : _props$cssFn,
31
23
  description = props.description,
32
24
  iconAfter = props.iconAfter,
33
25
  iconBefore = props.iconBefore,
@@ -53,9 +45,7 @@ function (props, ref) {
53
45
  if (!children) {
54
46
  return null;
55
47
  }
56
- propDeprecationWarning("@atlaskit/menu" || '', 'cssFn', cssFn !== noop, '' // TODO: Create DAC post when primitives/xcss are available as alternatives
57
- );
58
- return jsx(MenuItemPrimitive
48
+ return /*#__PURE__*/React.createElement(MenuItemPrimitive
59
49
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
60
50
  , _extends({
61
51
  className: UNSAFE_className
@@ -70,17 +60,11 @@ function (props, ref) {
70
60
  title: children,
71
61
  shouldTitleWrap: shouldTitleWrap,
72
62
  shouldDescriptionWrap: shouldDescriptionWrap,
73
- css:
74
- // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
75
- cssFn({
76
- isSelected: isSelected,
77
- isDisabled: isDisabled
78
- }),
79
63
  testId: testId && "".concat(testId, "--primitive")
80
64
  }), function (_ref) {
81
65
  var children = _ref.children,
82
66
  className = _ref.className;
83
- return jsx("button", _extends({
67
+ return /*#__PURE__*/React.createElement("button", _extends({
84
68
  "data-testid": testId
85
69
  }, rest, {
86
70
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
@@ -1,17 +1,10 @@
1
+ /* custom-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 = ["component", "cssFn", "isDisabled", "isSelected", "onClick", "testId", "children", "description", "iconAfter", "iconBefore", "overrides", "onMouseDown", "shouldTitleWrap", "shouldDescriptionWrap", "className", "UNSAFE_isDraggable", "interactionName"];
4
- /**
5
- * @jsxRuntime classic
6
- * @jsx jsx
7
- */
8
-
4
+ var _excluded = ["component", "isDisabled", "isSelected", "onClick", "testId", "children", "description", "iconAfter", "iconBefore", "overrides", "onMouseDown", "shouldTitleWrap", "shouldDescriptionWrap", "className", "UNSAFE_isDraggable", "interactionName"];
5
+ import * as React from 'react';
6
+ import { ax, ix } from "@compiled/react/runtime";
9
7
  import { forwardRef, memo, useCallback, useContext } from 'react';
10
-
11
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
12
- import { css, jsx } from '@emotion/react';
13
- import { propDeprecationWarning } from '@atlaskit/ds-lib/deprecation-warning';
14
- import noop from '@atlaskit/ds-lib/noop';
15
8
  import InteractionContext from '@atlaskit/interaction-context';
16
9
  import { fg } from '@atlaskit/platform-feature-flags';
17
10
  import MenuItemPrimitive from '../internal/components/menu-item-primitive';
@@ -31,8 +24,6 @@ var preventEvent = function preventEvent(e) {
31
24
  */
32
25
  var CustomItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref, ref) {
33
26
  var Component = _ref.component,
34
- _ref$cssFn = _ref.cssFn,
35
- cssFn = _ref$cssFn === void 0 ? noop : _ref$cssFn,
36
27
  _ref$isDisabled = _ref.isDisabled,
37
28
  isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
38
29
  _ref$isSelected = _ref.isSelected,
@@ -60,9 +51,7 @@ var CustomItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref, ref)
60
51
  if (!Component) {
61
52
  return null;
62
53
  }
63
- propDeprecationWarning("@atlaskit/menu" || '', 'cssFn', cssFn !== noop, '' // TODO: Create DAC post when primitives/xcss are available as alternatives
64
- );
65
- return jsx(MenuItemPrimitive
54
+ return /*#__PURE__*/React.createElement(MenuItemPrimitive
66
55
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
67
56
  , _extends({
68
57
  className: UNSAFE_className
@@ -76,20 +65,12 @@ var CustomItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref, ref)
76
65
  isSelected: isSelected,
77
66
  isDisabled: isDisabled,
78
67
  shouldTitleWrap: shouldTitleWrap,
79
- shouldDescriptionWrap: shouldDescriptionWrap
80
- // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
81
- ,
82
- css: css(
83
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
84
- cssFn({
85
- isDisabled: isDisabled,
86
- isSelected: isSelected
87
- })),
68
+ shouldDescriptionWrap: shouldDescriptionWrap,
88
69
  testId: testId && "".concat(testId, "--primitive")
89
70
  }), function (_ref2) {
90
71
  var children = _ref2.children,
91
72
  className = _ref2.className;
92
- return jsx(Component, _extends({
73
+ return /*#__PURE__*/React.createElement(Component, _extends({
93
74
  "data-testid": testId
94
75
  }, rest, {
95
76
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
@@ -1,17 +1,11 @@
1
+ /* link-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", "href", "cssFn", "description", "iconAfter", "iconBefore", "isDisabled", "isSelected", "onClick", "testId", "overrides", "onMouseDown", "shouldTitleWrap", "shouldDescriptionWrap", "className", "UNSAFE_shouldDisableRouterLink", "UNSAFE_isDraggable", "interactionName"];
4
- /**
5
- * @jsxRuntime classic
6
- * @jsx jsx
7
- */
4
+ var _excluded = ["children", "href", "description", "iconAfter", "iconBefore", "isDisabled", "isSelected", "onClick", "testId", "overrides", "onMouseDown", "shouldTitleWrap", "shouldDescriptionWrap", "className", "UNSAFE_shouldDisableRouterLink", "UNSAFE_isDraggable", "interactionName"];
5
+ import * as React from 'react';
6
+ import { ax, ix } from "@compiled/react/runtime";
8
7
  import { forwardRef, memo, useCallback, useContext } from 'react';
9
-
10
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
11
- import { jsx } from '@emotion/react';
12
8
  import { useRouterLink } from '@atlaskit/app-provider';
13
- import { propDeprecationWarning } from '@atlaskit/ds-lib/deprecation-warning';
14
- import noop from '@atlaskit/ds-lib/noop';
15
9
  import InteractionContext from '@atlaskit/interaction-context';
16
10
  import { fg } from '@atlaskit/platform-feature-flags';
17
11
  import MenuItemPrimitive from '../internal/components/menu-item-primitive';
@@ -34,8 +28,6 @@ var LinkItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(
34
28
  function (props, ref) {
35
29
  var children = props.children,
36
30
  href = props.href,
37
- _props$cssFn = props.cssFn,
38
- cssFn = _props$cssFn === void 0 ? noop : _props$cssFn,
39
31
  description = props.description,
40
32
  iconAfter = props.iconAfter,
41
33
  iconBefore = props.iconBefore,
@@ -78,9 +70,7 @@ function (props, ref) {
78
70
  */
79
71
  var isRouterLink = !UNSAFE_shouldDisableRouterLink && RouterLink && !isExternal && !isNonHttpBased && !isEmptyHref;
80
72
  var Component = isRouterLink ? RouterLink : 'a';
81
- propDeprecationWarning("@atlaskit/menu" || '', 'cssFn', cssFn !== noop, '' // TODO: Create DAC post when primitives/xcss are available as alternatives
82
- );
83
- return jsx(MenuItemPrimitive, _extends({}, rest, {
73
+ return /*#__PURE__*/React.createElement(MenuItemPrimitive, _extends({}, rest, {
84
74
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
85
75
  className: UNSAFE_className
86
76
  // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
@@ -93,18 +83,12 @@ function (props, ref) {
93
83
  description: description,
94
84
  shouldTitleWrap: shouldTitleWrap,
95
85
  shouldDescriptionWrap: shouldDescriptionWrap,
96
- css:
97
- // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
98
- cssFn({
99
- isSelected: isSelected,
100
- isDisabled: isDisabled
101
- }),
102
86
  title: children,
103
87
  testId: testId && "".concat(testId, "--primitive")
104
88
  }), function (_ref) {
105
89
  var children = _ref.children,
106
90
  className = _ref.className;
107
- return jsx(Component, _extends({
91
+ return /*#__PURE__*/React.createElement(Component, _extends({
108
92
  "data-testid": testId,
109
93
  "data-is-router-link": testId ? isRouterLink ? 'true' : 'false' : undefined,
110
94
  "data-vc": "link-item"
@@ -61,12 +61,9 @@ var SkeletonHeadingItem = function SkeletonHeadingItem(_ref) {
61
61
  var className = _ref2.className;
62
62
  return jsx("div", {
63
63
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
64
- className: className
65
- // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
66
- ,
64
+ className: className,
67
65
  style: {
68
66
  '--width': width
69
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
70
67
  },
71
68
  css: [skeletonStyles, width ? customWidthStyles : defaultWidthStyles,
72
69
  // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
@@ -130,12 +130,9 @@ var SkeletonItem = function SkeletonItem(_ref) {
130
130
  var className = _ref2.className;
131
131
  return jsx("div", {
132
132
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
133
- className: className
134
- // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
135
- ,
133
+ className: className,
136
134
  style: {
137
135
  '--width': width
138
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
139
136
  },
140
137
  css: [skeletonStyles, (hasAvatar || hasIcon) && beforeElementStyles, hasAvatar && avatarStyles, hasIcon && iconStyles, width ? customWidthStyles : defaultWidthStyles,
141
138
  // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
@@ -1,7 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  var _excluded = ["children", "overrides", "title", "titleId", "testId", "isScrollable", "hasSeparator", "id", "isList", "className"];
4
- /* eslint-disable @atlaskit/design-system/ensure-design-token-usage, @atlaskit/design-system/ensure-design-token-usage/preview */
5
4
  /**
6
5
  * @jsxRuntime classic
7
6
  * @jsx jsx
@@ -140,9 +139,7 @@ var Section = /*#__PURE__*/forwardRef(function (_ref, ref) {
140
139
  // NOTE: Firefox allows elements that have "overflow: auto" to gain focus (as if it had tab-index="0")
141
140
  // We have made a deliberate choice to leave this behaviour as is.
142
141
  ,
143
- css: [sectionStyles, isScrollable ? scrollableStyles : unscrollableStyles, hasSeparator ?
144
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
145
- thinSeparatorStyles : noSeparatorStyles],
142
+ css: [sectionStyles, isScrollable ? scrollableStyles : unscrollableStyles, hasSeparator ? thinSeparatorStyles : noSeparatorStyles],
146
143
  "aria-label": title,
147
144
  "aria-labelledby": titleId,
148
145
  "data-testid": testId,
@@ -1,4 +1,4 @@
1
- import { jsx } from '@emotion/react';
1
+ /// <reference types="react" />
2
2
  import type { MenuItemPrimitiveProps } from '../../types';
3
3
  /**
4
4
  * __Menu item primitive__
@@ -14,5 +14,5 @@ import type { MenuItemPrimitiveProps } from '../../types';
14
14
  * </MenuItemPrimitive>
15
15
  * ```
16
16
  */
17
- declare const MenuItemPrimitive: ({ children, title, description, iconAfter, iconBefore, overrides, className: UNSAFE_externalClassName, shouldTitleWrap, shouldDescriptionWrap, isDisabled, isSelected, testId, }: MenuItemPrimitiveProps) => jsx.JSX.Element;
17
+ declare const MenuItemPrimitive: ({ children, title, description, iconAfter, iconBefore, overrides, className: UNSAFE_externalClassName, shouldTitleWrap, shouldDescriptionWrap, isDisabled, isSelected, testId, }: MenuItemPrimitiveProps) => JSX.Element;
18
18
  export default MenuItemPrimitive;
@@ -126,7 +126,7 @@ export interface SectionProps {
126
126
  }
127
127
  export interface MenuItemPrimitiveProps {
128
128
  children: (props: {
129
- className: string;
129
+ className?: string;
130
130
  children: React.ReactNode;
131
131
  }) => JSX.Element;
132
132
  title: React.ReactNode | undefined;
@@ -145,13 +145,6 @@ export interface MenuItemPrimitiveProps {
145
145
  testId?: string;
146
146
  }
147
147
  export interface MenuItemProps {
148
- /**
149
- * A function that overrides the styles of the component.
150
- * It receives the current styles and state and expects a styles object.
151
- *
152
- * @deprecated This API is deprecated and will be removed in a future release. See DSP-2676 for more information.
153
- */
154
- cssFn?: CSSFn;
155
148
  /**
156
149
  * Not recommended for general use as it enables unsafe style overrides.
157
150
  */
@@ -265,7 +258,7 @@ export interface CustomItemComponentProps {
265
258
  * Class to apply to the root container of the custom component.
266
259
  * Ensure this has been applied so the item styling is consistent.
267
260
  */
268
- className: string;
261
+ className?: string;
269
262
  /**
270
263
  * Test ID that's passed through to the custom component.
271
264
  */
@@ -1,4 +1,4 @@
1
- import { jsx } from '@emotion/react';
1
+ /// <reference types="react" />
2
2
  import type { MenuItemPrimitiveProps } from '../../types';
3
3
  /**
4
4
  * __Menu item primitive__
@@ -14,5 +14,5 @@ import type { MenuItemPrimitiveProps } from '../../types';
14
14
  * </MenuItemPrimitive>
15
15
  * ```
16
16
  */
17
- declare const MenuItemPrimitive: ({ children, title, description, iconAfter, iconBefore, overrides, className: UNSAFE_externalClassName, shouldTitleWrap, shouldDescriptionWrap, isDisabled, isSelected, testId, }: MenuItemPrimitiveProps) => jsx.JSX.Element;
17
+ declare const MenuItemPrimitive: ({ children, title, description, iconAfter, iconBefore, overrides, className: UNSAFE_externalClassName, shouldTitleWrap, shouldDescriptionWrap, isDisabled, isSelected, testId, }: MenuItemPrimitiveProps) => JSX.Element;
18
18
  export default MenuItemPrimitive;
@@ -126,7 +126,7 @@ export interface SectionProps {
126
126
  }
127
127
  export interface MenuItemPrimitiveProps {
128
128
  children: (props: {
129
- className: string;
129
+ className?: string;
130
130
  children: React.ReactNode;
131
131
  }) => JSX.Element;
132
132
  title: React.ReactNode | undefined;
@@ -145,13 +145,6 @@ export interface MenuItemPrimitiveProps {
145
145
  testId?: string;
146
146
  }
147
147
  export interface MenuItemProps {
148
- /**
149
- * A function that overrides the styles of the component.
150
- * It receives the current styles and state and expects a styles object.
151
- *
152
- * @deprecated This API is deprecated and will be removed in a future release. See DSP-2676 for more information.
153
- */
154
- cssFn?: CSSFn;
155
148
  /**
156
149
  * Not recommended for general use as it enables unsafe style overrides.
157
150
  */
@@ -265,7 +258,7 @@ export interface CustomItemComponentProps {
265
258
  * Class to apply to the root container of the custom component.
266
259
  * Ensure this has been applied so the item styling is consistent.
267
260
  */
268
- className: string;
261
+ className?: string;
269
262
  /**
270
263
  * Test ID that's passed through to the custom component.
271
264
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/menu",
3
- "version": "3.2.0",
3
+ "version": "4.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/"
@@ -41,15 +41,16 @@
41
41
  }
42
42
  },
43
43
  "dependencies": {
44
- "@atlaskit/app-provider": "^2.0.0",
44
+ "@atlaskit/app-provider": "^2.1.0",
45
45
  "@atlaskit/ds-lib": "^4.0.0",
46
46
  "@atlaskit/focus-ring": "^3.0.0",
47
47
  "@atlaskit/interaction-context": "^3.0.0",
48
48
  "@atlaskit/platform-feature-flags": "^1.1.0",
49
- "@atlaskit/primitives": "^14.2.0",
49
+ "@atlaskit/primitives": "^14.4.0",
50
50
  "@atlaskit/theme": "^18.0.0",
51
- "@atlaskit/tokens": "^4.5.0",
51
+ "@atlaskit/tokens": "^4.8.0",
52
52
  "@babel/runtime": "^7.0.0",
53
+ "@compiled/react": "^0.18.3",
53
54
  "@emotion/react": "^11.7.1"
54
55
  },
55
56
  "peerDependencies": {
@@ -57,17 +58,17 @@
57
58
  "react-dom": "^18.2.0"
58
59
  },
59
60
  "devDependencies": {
60
- "@af/accessibility-testing": "^2.0.0",
61
- "@af/integration-testing": "^0.5.0",
62
- "@af/visual-regression": "^1.3.0",
63
- "@atlaskit/button": "^22.0.0",
61
+ "@af/accessibility-testing": "workspace:^",
62
+ "@af/integration-testing": "workspace:^",
63
+ "@af/visual-regression": "workspace:^",
64
+ "@atlaskit/button": "^23.0.0",
64
65
  "@atlaskit/docs": "^10.0.0",
65
- "@atlaskit/icon": "^25.2.0",
66
+ "@atlaskit/icon": "^25.6.0",
66
67
  "@atlaskit/icon-file-type": "^7.0.0",
67
- "@atlaskit/icon-object": "^7.0.0",
68
- "@atlaskit/link": "^3.0.0",
68
+ "@atlaskit/icon-object": "^7.1.0",
69
+ "@atlaskit/link": "^3.1.0",
69
70
  "@atlaskit/section-message": "^8.2.0",
70
- "@atlaskit/visual-regression": "^0.10.0",
71
+ "@atlaskit/visual-regression": "workspace:^",
71
72
  "@atlassian/feature-flags-test-utils": "^0.3.0",
72
73
  "@emotion/jest": "^11.8.0",
73
74
  "@testing-library/react": "^13.4.0",
@@ -126,6 +127,9 @@
126
127
  },
127
128
  "platform_button_item-add-ufo-metrics": {
128
129
  "type": "boolean"
130
+ },
131
+ "platform_fix_a11y_selected_and_hovered_state_color": {
132
+ "type": "boolean"
129
133
  }
130
134
  },
131
135
  "homepage": "https://atlassian.design/components/menu/"