@atlaskit/menu 3.2.0 → 5.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 +30 -0
- package/dist/cjs/internal/components/menu-item-primitive.compiled.css +81 -0
- package/dist/cjs/internal/components/menu-item-primitive.js +51 -181
- package/dist/cjs/menu-item/button-item.js +11 -25
- package/dist/cjs/menu-item/custom-item.js +14 -28
- package/dist/cjs/menu-item/link-item.js +12 -27
- package/dist/cjs/menu-item/skeleton-heading-item.js +1 -4
- package/dist/cjs/menu-item/skeleton-item.js +1 -4
- package/dist/cjs/menu-section/section.js +1 -4
- package/dist/es2019/internal/components/menu-item-primitive.compiled.css +81 -0
- package/dist/es2019/internal/components/menu-item-primitive.js +46 -179
- package/dist/es2019/menu-item/button-item.js +6 -23
- package/dist/es2019/menu-item/custom-item.js +8 -27
- package/dist/es2019/menu-item/link-item.js +7 -25
- package/dist/es2019/menu-item/skeleton-heading-item.js +1 -4
- package/dist/es2019/menu-item/skeleton-item.js +1 -4
- package/dist/es2019/menu-section/section.js +1 -4
- package/dist/esm/internal/components/menu-item-primitive.compiled.css +81 -0
- package/dist/esm/internal/components/menu-item-primitive.js +47 -178
- package/dist/esm/menu-item/button-item.js +7 -25
- package/dist/esm/menu-item/custom-item.js +10 -29
- package/dist/esm/menu-item/link-item.js +8 -27
- package/dist/esm/menu-item/skeleton-heading-item.js +1 -4
- package/dist/esm/menu-item/skeleton-item.js +1 -4
- package/dist/esm/menu-section/section.js +1 -4
- package/dist/types/internal/components/menu-item-primitive.d.ts +2 -2
- package/dist/types/types.d.ts +11 -19
- package/dist/types-ts4.5/internal/components/menu-item-primitive.d.ts +2 -2
- package/dist/types-ts4.5/types.d.ts +11 -19
- package/package.json +16 -12
|
@@ -1,26 +1,24 @@
|
|
|
1
|
+
/* link-item.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
1
2
|
"use strict";
|
|
2
3
|
|
|
3
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
6
|
Object.defineProperty(exports, "__esModule", {
|
|
5
7
|
value: true
|
|
6
8
|
});
|
|
7
9
|
exports.default = void 0;
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var React = _react;
|
|
12
|
+
var _runtime = require("@compiled/react/runtime");
|
|
8
13
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
14
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
|
-
var _react = require("react");
|
|
11
|
-
var _react2 = require("@emotion/react");
|
|
12
15
|
var _appProvider = require("@atlaskit/app-provider");
|
|
13
|
-
var _deprecationWarning = require("@atlaskit/ds-lib/deprecation-warning");
|
|
14
|
-
var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
|
|
15
16
|
var _interactionContext = _interopRequireDefault(require("@atlaskit/interaction-context"));
|
|
16
17
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
17
18
|
var _menuItemPrimitive = _interopRequireDefault(require("../internal/components/menu-item-primitive"));
|
|
18
|
-
var _excluded = ["children", "href", "
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
* @jsx jsx
|
|
22
|
-
*/
|
|
23
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
19
|
+
var _excluded = ["children", "href", "description", "iconAfter", "iconBefore", "isDisabled", "isSelected", "onClick", "testId", "onMouseDown", "shouldTitleWrap", "shouldDescriptionWrap", "className", "UNSAFE_shouldDisableRouterLink", "UNSAFE_isDraggable", "interactionName"];
|
|
20
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
21
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
24
22
|
var IS_EXTERNAL_LINK_REGEX = /^(?:(http|https):\/\/)/;
|
|
25
23
|
var IS_NON_HTTP_BASED = /^(((mailto|tel|sms):)|(#))/;
|
|
26
24
|
var preventEvent = function preventEvent(e) {
|
|
@@ -40,8 +38,6 @@ var LinkItem = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef
|
|
|
40
38
|
function (props, ref) {
|
|
41
39
|
var children = props.children,
|
|
42
40
|
href = props.href,
|
|
43
|
-
_props$cssFn = props.cssFn,
|
|
44
|
-
cssFn = _props$cssFn === void 0 ? _noop.default : _props$cssFn,
|
|
45
41
|
description = props.description,
|
|
46
42
|
iconAfter = props.iconAfter,
|
|
47
43
|
iconBefore = props.iconBefore,
|
|
@@ -51,7 +47,6 @@ function (props, ref) {
|
|
|
51
47
|
isSelected = _props$isSelected === void 0 ? false : _props$isSelected,
|
|
52
48
|
onClick = props.onClick,
|
|
53
49
|
testId = props.testId,
|
|
54
|
-
overrides = props.overrides,
|
|
55
50
|
onMouseDown = props.onMouseDown,
|
|
56
51
|
shouldTitleWrap = props.shouldTitleWrap,
|
|
57
52
|
shouldDescriptionWrap = props.shouldDescriptionWrap,
|
|
@@ -84,33 +79,23 @@ function (props, ref) {
|
|
|
84
79
|
*/
|
|
85
80
|
var isRouterLink = !UNSAFE_shouldDisableRouterLink && RouterLink && !isExternal && !isNonHttpBased && !isEmptyHref;
|
|
86
81
|
var Component = isRouterLink ? RouterLink : 'a';
|
|
87
|
-
|
|
88
|
-
);
|
|
89
|
-
return (0, _react2.jsx)(_menuItemPrimitive.default, (0, _extends2.default)({}, rest, {
|
|
82
|
+
return /*#__PURE__*/React.createElement(_menuItemPrimitive.default, (0, _extends2.default)({}, rest, {
|
|
90
83
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
91
|
-
className: UNSAFE_className
|
|
92
|
-
// eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
|
|
93
|
-
,
|
|
94
|
-
overrides: overrides,
|
|
84
|
+
className: UNSAFE_className,
|
|
95
85
|
iconBefore: iconBefore,
|
|
96
86
|
iconAfter: iconAfter,
|
|
97
87
|
isSelected: isSelected,
|
|
98
88
|
isDisabled: isDisabled,
|
|
89
|
+
isTitleHeading: false,
|
|
99
90
|
description: description,
|
|
100
91
|
shouldTitleWrap: shouldTitleWrap,
|
|
101
92
|
shouldDescriptionWrap: shouldDescriptionWrap,
|
|
102
|
-
css:
|
|
103
|
-
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
104
|
-
cssFn({
|
|
105
|
-
isSelected: isSelected,
|
|
106
|
-
isDisabled: isDisabled
|
|
107
|
-
}),
|
|
108
93
|
title: children,
|
|
109
94
|
testId: testId && "".concat(testId, "--primitive")
|
|
110
95
|
}), function (_ref) {
|
|
111
96
|
var children = _ref.children,
|
|
112
97
|
className = _ref.className;
|
|
113
|
-
return
|
|
98
|
+
return /*#__PURE__*/React.createElement(Component, (0, _extends2.default)({
|
|
114
99
|
"data-testid": testId,
|
|
115
100
|
"data-is-router-link": testId ? isRouterLink ? 'true' : 'false' : undefined,
|
|
116
101
|
"data-vc": "link-item"
|
|
@@ -69,12 +69,9 @@ var SkeletonHeadingItem = function SkeletonHeadingItem(_ref) {
|
|
|
69
69
|
var className = _ref2.className;
|
|
70
70
|
return (0, _react.jsx)("div", {
|
|
71
71
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
72
|
-
className: className
|
|
73
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
74
|
-
,
|
|
72
|
+
className: className,
|
|
75
73
|
style: {
|
|
76
74
|
'--width': width
|
|
77
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
78
75
|
},
|
|
79
76
|
css: [skeletonStyles, width ? customWidthStyles : defaultWidthStyles,
|
|
80
77
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
@@ -136,12 +136,9 @@ var SkeletonItem = function SkeletonItem(_ref) {
|
|
|
136
136
|
var className = _ref2.className;
|
|
137
137
|
return (0, _react.jsx)("div", {
|
|
138
138
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
139
|
-
className: className
|
|
140
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
141
|
-
,
|
|
139
|
+
className: className,
|
|
142
140
|
style: {
|
|
143
141
|
'--width': width
|
|
144
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
145
142
|
},
|
|
146
143
|
css: [skeletonStyles, (hasAvatar || hasIcon) && beforeElementStyles, hasAvatar && avatarStyles, hasIcon && iconStyles, width ? customWidthStyles : defaultWidthStyles,
|
|
147
144
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
@@ -13,7 +13,6 @@ var _deprecationWarning = require("@atlaskit/ds-lib/deprecation-warning");
|
|
|
13
13
|
var _colors = require("@atlaskit/theme/colors");
|
|
14
14
|
var _headingItem = _interopRequireDefault(require("../menu-item/heading-item"));
|
|
15
15
|
var _excluded = ["children", "overrides", "title", "titleId", "testId", "isScrollable", "hasSeparator", "id", "isList", "className"];
|
|
16
|
-
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage, @atlaskit/design-system/ensure-design-token-usage/preview */
|
|
17
16
|
/**
|
|
18
17
|
* @jsxRuntime classic
|
|
19
18
|
* @jsx jsx
|
|
@@ -146,9 +145,7 @@ var Section = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
146
145
|
// NOTE: Firefox allows elements that have "overflow: auto" to gain focus (as if it had tab-index="0")
|
|
147
146
|
// We have made a deliberate choice to leave this behaviour as is.
|
|
148
147
|
,
|
|
149
|
-
css: [sectionStyles, isScrollable ? scrollableStyles : unscrollableStyles, hasSeparator ?
|
|
150
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
151
|
-
thinSeparatorStyles : noSeparatorStyles],
|
|
148
|
+
css: [sectionStyles, isScrollable ? scrollableStyles : unscrollableStyles, hasSeparator ? thinSeparatorStyles : noSeparatorStyles],
|
|
152
149
|
"aria-label": title,
|
|
153
150
|
"aria-labelledby": titleId,
|
|
154
151
|
"data-testid": testId,
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
|
|
2
|
+
._11c82smr{font:var(--ds-font-body,normal 400 14px/20px ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
|
|
3
|
+
._11c8dcr7{font:var(--ds-font-body-UNSAFE_small,normal 400 9pt/1pc ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
|
|
4
|
+
._19itidpf{border:0}
|
|
5
|
+
._rfx315o9:before{border-radius:0 var(--ds-border-radius,4px) var(--ds-border-radius,4px) 0}
|
|
6
|
+
._18zrpxbi{padding-inline:var(--ds-space-200,1pc)}
|
|
7
|
+
._18zrutpp{padding-inline:var(--ds-space-150,9pt)}
|
|
8
|
+
._1rjc1b66{padding-block:var(--ds-space-050,4px)}
|
|
9
|
+
._1rjcu2gc{padding-block:var(--ds-space-100,8px)}
|
|
10
|
+
._12ji1r31{outline-color:currentColor}
|
|
11
|
+
._12y31o36{outline-width:medium}
|
|
12
|
+
._12y3idpf{outline-width:0}
|
|
13
|
+
._16jlkb7n{flex-grow:1}
|
|
14
|
+
._18m915vq{overflow-y:hidden}
|
|
15
|
+
._18u0ze3t{margin-left:var(--ds-space-0,0)}
|
|
16
|
+
._19pkze3t{margin-top:var(--ds-space-0,0)}
|
|
17
|
+
._1bah1h6o{justify-content:center}
|
|
18
|
+
._1bsb1osq{width:100%}
|
|
19
|
+
._1bto1l2s{text-overflow:ellipsis}
|
|
20
|
+
._1cs8stnw:before{position:absolute}
|
|
21
|
+
._1e0c1txw{display:flex}
|
|
22
|
+
._1e0c1ule{display:block}
|
|
23
|
+
._1fkrutpp:before{inset-block-end:var(--ds-space-150,9pt)}
|
|
24
|
+
._1fkrze3t:before{inset-block-end:var(--ds-space-0,0)}
|
|
25
|
+
._1hmsglyw{text-decoration-line:none}
|
|
26
|
+
._1kt9b3bt:before{content:""}
|
|
27
|
+
._1mp41y44:before{width:4px}
|
|
28
|
+
._1mp4yh40:before{width:2px}
|
|
29
|
+
._1nmz1hna{word-break:break-word}
|
|
30
|
+
._1o9zidpf{flex-shrink:0}
|
|
31
|
+
._1qu2glyw{outline-style:none}
|
|
32
|
+
._1reo15vq{overflow-x:hidden}
|
|
33
|
+
._1rus67is:before{background-color:var(--ds-border-selected,transparent)}
|
|
34
|
+
._1tke1tcg{min-height:24px}
|
|
35
|
+
._1tke1ylp{min-height:40px}
|
|
36
|
+
._1tkezwfg{min-height:2pc}
|
|
37
|
+
._1ul91tcg{min-width:24px}
|
|
38
|
+
._2hwxze3t{margin-right:var(--ds-space-0,0)}
|
|
39
|
+
._2lx21bp4{flex-direction:column}
|
|
40
|
+
._4bfu1r31{text-decoration-color:currentColor}
|
|
41
|
+
._4cvr1h6o{align-items:center}
|
|
42
|
+
._80om13gf{cursor:not-allowed}
|
|
43
|
+
._80omtlke{cursor:pointer}
|
|
44
|
+
._ajmmnqa1{text-decoration-style:solid}
|
|
45
|
+
._bfhk1q4k{background-color:var(--ds-background-selected,#f4f5f7)}
|
|
46
|
+
._bfhkqtfy{background-color:var(--ds-background-neutral-subtle,transparent)}
|
|
47
|
+
._iajmutpp:before{inset-block-start:var(--ds-space-150,9pt)}
|
|
48
|
+
._iajmze3t:before{inset-block-start:var(--ds-space-0,0)}
|
|
49
|
+
._kqswh2mm{position:relative}
|
|
50
|
+
._o5721q9c{white-space:nowrap}
|
|
51
|
+
._otyrze3t{margin-bottom:var(--ds-space-0,0)}
|
|
52
|
+
._syaz1r31{color:currentColor}
|
|
53
|
+
._syaz1wmz{color:var(--ds-text-subtlest,#6b778c)}
|
|
54
|
+
._syaz2oi6{color:var(--ds-text-disabled,#6b778c)}
|
|
55
|
+
._syazhu5v{color:var(--ds-text-selected,currentColor)}
|
|
56
|
+
._uiztglyw{-webkit-user-select:none;-ms-user-select:none;user-select:none}
|
|
57
|
+
._vchhusvi{box-sizing:border-box}
|
|
58
|
+
._y3gn1e5h{text-align:left}
|
|
59
|
+
._z5wtze3t:before{inset-inline-start:var(--ds-space-0,0)}._10531r31:visited{color:currentColor}
|
|
60
|
+
._1053hu5v:visited{color:var(--ds-text-selected,currentColor)}
|
|
61
|
+
._128m1bk5:focus-visible{outline-width:var(--ds-border-width-outline,2px)}
|
|
62
|
+
._1ah311pw:focus-visible{outline-offset:calc(0px - var(--ds-border-width-outline, 2px))}
|
|
63
|
+
._mizu194a:focus-visible{outline-color:var(--ds-border-focused,#2684ff)}
|
|
64
|
+
._ra3xnqa1:focus-visible{outline-style:solid}
|
|
65
|
+
._1bnxglyw:hover{text-decoration-line:none}
|
|
66
|
+
._30l316ov:hover{color:var(--ds-text-accent-blue,currentColor)}
|
|
67
|
+
._30l31r31:hover{color:currentColor}
|
|
68
|
+
._30l32oi6:hover{color:var(--ds-text-disabled,#6b778c)}
|
|
69
|
+
._30l3hu5v:hover{color:var(--ds-text-selected,currentColor)}
|
|
70
|
+
._9oik1r31:hover{text-decoration-color:currentColor}
|
|
71
|
+
._irr31dko:hover{background-color:var(--ds-background-neutral-subtle-hovered,#f4f5f7)}
|
|
72
|
+
._irr32seo:hover{background-color:var(--ds-background-selected-hovered,#f4f5f7)}
|
|
73
|
+
._irr3qtfy:hover{background-color:var(--ds-background-neutral-subtle,transparent)}
|
|
74
|
+
._jf4cnqa1:hover{text-decoration-style:solid}
|
|
75
|
+
._1di61dko:active{background-color:var(--ds-background-neutral-subtle-hovered,#f4f5f7)}
|
|
76
|
+
._1di6guph:active{background-color:var(--ds-background-selected-pressed,#ebecf0)}
|
|
77
|
+
._1di6qtfy:active{background-color:var(--ds-background-neutral-subtle,transparent)}
|
|
78
|
+
._9h8h1r31:active{color:currentColor}
|
|
79
|
+
._9h8h2oi6:active{color:var(--ds-text-disabled,#6b778c)}
|
|
80
|
+
._9h8hhu5v:active{color:var(--ds-text-selected,currentColor)}
|
|
81
|
+
@media screen and (-ms-high-contrast:active),screen and (forced-colors:active){._1cvmnqa1:focus-visible{outline-style:solid}._4davt94y:focus-visible{outline-width:1px}}
|
|
@@ -1,159 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
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';
|
|
9
|
-
import { propDeprecationWarning } from '@atlaskit/ds-lib/deprecation-warning';
|
|
10
|
-
import FocusRing from '@atlaskit/focus-ring';
|
|
5
|
+
import { ax, ix } from '@compiled/react/runtime';
|
|
11
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
|
-
import { Inline
|
|
13
|
-
import { N20, N200, N30 } from '@atlaskit/theme/colors';
|
|
7
|
+
import { Inline } from '@atlaskit/primitives/compiled';
|
|
14
8
|
import { SELECTION_STYLE_CONTEXT_DO_NOT_USE, SpacingContext } from './menu-context';
|
|
15
|
-
const
|
|
9
|
+
const renderTitle = (Component, props) =>
|
|
10
|
+
/*#__PURE__*/
|
|
16
11
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
textAlign: 'left'
|
|
36
|
-
});
|
|
37
|
-
const truncateStyles = css({
|
|
38
|
-
display: 'block',
|
|
39
|
-
overflow: 'hidden',
|
|
40
|
-
textOverflow: 'ellipsis',
|
|
41
|
-
whiteSpace: 'nowrap'
|
|
42
|
-
});
|
|
43
|
-
const titleStyles = css({
|
|
44
|
-
font: "var(--ds-font-body, normal 400 14px/20px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)"
|
|
45
|
-
});
|
|
46
|
-
const wordBreakStyles = css({
|
|
47
|
-
wordBreak: 'break-word'
|
|
48
|
-
});
|
|
49
|
-
const descriptionStyles = css({
|
|
50
|
-
color: `var(--ds-text-subtlest, ${N200})`,
|
|
51
|
-
font: "var(--ds-font-body-UNSAFE_small, normal 400 12px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)"
|
|
52
|
-
});
|
|
53
|
-
const disabledDescriptionStyles = css({
|
|
54
|
-
color: `var(--ds-text-disabled, ${N200})`
|
|
55
|
-
});
|
|
56
|
-
const positionRelativeStyles = css({
|
|
57
|
-
position: 'relative'
|
|
58
|
-
});
|
|
59
|
-
const primitiveStyles = css({
|
|
60
|
-
display: 'flex',
|
|
61
|
-
boxSizing: 'border-box',
|
|
62
|
-
width: '100%',
|
|
63
|
-
minHeight: 40,
|
|
64
|
-
margin: "var(--ds-space-0, 0px)",
|
|
65
|
-
alignItems: 'center',
|
|
66
|
-
border: 0,
|
|
67
|
-
outline: 0,
|
|
68
|
-
textDecoration: 'none',
|
|
69
|
-
userSelect: 'none',
|
|
70
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
71
|
-
'&::-moz-focus-inner': {
|
|
72
|
-
border: 0
|
|
73
|
-
},
|
|
74
|
-
'&:hover': {
|
|
75
|
-
textDecoration: 'none'
|
|
76
|
-
}
|
|
77
|
-
});
|
|
12
|
+
React.createElement(Component, props);
|
|
13
|
+
const styles = {
|
|
14
|
+
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",
|
|
15
|
+
beforeAfterElementOld: "_1e0c1txw _4cvr1h6o _1bah1h6o _1o9zidpf",
|
|
16
|
+
beforeAfterElement: "_1e0c1txw _1ul91tcg _1tke1tcg _4cvr1h6o _1bah1h6o _1o9zidpf",
|
|
17
|
+
content: "_12ji1r31 _1qu2glyw _12y31o36 _1reo15vq _18m915vq _1e0c1txw _2lx21bp4 _1bah1h6o _16jlkb7n _y3gn1e5h",
|
|
18
|
+
truncate: "_1reo15vq _18m915vq _1e0c1ule _1bto1l2s _o5721q9c",
|
|
19
|
+
title: "_11c82smr",
|
|
20
|
+
wordBreak: "_1nmz1hna",
|
|
21
|
+
description: "_11c8dcr7 _syaz1wmz",
|
|
22
|
+
disabledDescription: "_syaz2oi6",
|
|
23
|
+
unselected: "_bfhkqtfy _syaz1r31 _10531r31 _irr31dko _30l31r31 _1di61dko _9h8h1r31",
|
|
24
|
+
disabled: "_80om13gf _bfhkqtfy _syaz2oi6 _irr3qtfy _30l32oi6 _1di6qtfy _9h8h2oi6",
|
|
25
|
+
selectedBorder: "_1mp4yh40 _1cs8stnw _1rus67is _1kt9b3bt _1fkrze3t _iajmze3t _z5wtze3t",
|
|
26
|
+
selectedNotch: "_rfx315o9 _1mp41y44 _1cs8stnw _1rus67is _1kt9b3bt _1fkrutpp _iajmutpp _z5wtze3t",
|
|
27
|
+
selected: "_bfhk1q4k _syazhu5v _1053hu5v _irr32seo _30l316ov _1di6guph _9h8hhu5v",
|
|
28
|
+
selectedOld: "_30l3hu5v"
|
|
29
|
+
};
|
|
78
30
|
const spacingMapStyles = {
|
|
79
|
-
cozy:
|
|
80
|
-
|
|
81
|
-
paddingBlock: "var(--ds-space-100, 8px)",
|
|
82
|
-
paddingInline: "var(--ds-space-200, 16px)"
|
|
83
|
-
}),
|
|
84
|
-
compact: css({
|
|
85
|
-
minHeight: 32,
|
|
86
|
-
// 4 * 2 (8) + icon (24) === 32
|
|
87
|
-
paddingBlock: "var(--ds-space-050, 4px)",
|
|
88
|
-
paddingInline: "var(--ds-space-150, 12px)"
|
|
89
|
-
})
|
|
31
|
+
cozy: "_1rjcu2gc _18zrpxbi",
|
|
32
|
+
compact: "_1rjc1b66 _18zrutpp _1tkezwfg"
|
|
90
33
|
};
|
|
91
|
-
const interactiveStyles = css({
|
|
92
|
-
cursor: 'pointer'
|
|
93
|
-
});
|
|
94
|
-
const unselectedStyles = css({
|
|
95
|
-
backgroundColor: "var(--ds-background-neutral-subtle, transparent)",
|
|
96
|
-
color: 'currentColor',
|
|
97
|
-
'&:visited': {
|
|
98
|
-
color: 'currentColor'
|
|
99
|
-
},
|
|
100
|
-
'&:hover': {
|
|
101
|
-
backgroundColor: `var(--ds-background-neutral-subtle-hovered, ${N20})`,
|
|
102
|
-
color: 'currentColor'
|
|
103
|
-
},
|
|
104
|
-
'&:active': {
|
|
105
|
-
backgroundColor: `var(--ds-background-neutral-subtle-pressed, ${N30})`,
|
|
106
|
-
boxShadow: 'none',
|
|
107
|
-
color: 'currentColor'
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
const disabledStyles = css({
|
|
111
|
-
cursor: 'not-allowed',
|
|
112
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
113
|
-
'&, :hover, :active': {
|
|
114
|
-
backgroundColor: "var(--ds-background-neutral-subtle, transparent)",
|
|
115
|
-
color: `var(--ds-text-disabled, ${N200})`
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
const selectedBorderStyles = css({
|
|
119
|
-
'&::before': {
|
|
120
|
-
width: 2,
|
|
121
|
-
position: 'absolute',
|
|
122
|
-
background: "var(--ds-border-selected, transparent)",
|
|
123
|
-
content: '""',
|
|
124
|
-
insetBlockEnd: 0,
|
|
125
|
-
insetBlockStart: 0,
|
|
126
|
-
insetInlineStart: 0
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
const selectedNotchStyles = css({
|
|
130
|
-
'&::before': {
|
|
131
|
-
width: 4,
|
|
132
|
-
position: 'absolute',
|
|
133
|
-
background: "var(--ds-border-selected, transparent)",
|
|
134
|
-
borderRadius: `0 ${"var(--ds-border-radius, 4px)"} ${"var(--ds-border-radius, 4px)"} 0`,
|
|
135
|
-
content: '""',
|
|
136
|
-
insetBlockEnd: "var(--ds-space-150, 12px)",
|
|
137
|
-
insetBlockStart: "var(--ds-space-150, 12px)",
|
|
138
|
-
insetInlineStart: 0
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
const selectedStyles = css({
|
|
142
|
-
backgroundColor: `var(--ds-background-selected, ${N20})`,
|
|
143
|
-
// Fallback set as babel plugin inserts one otherwise
|
|
144
|
-
color: "var(--ds-text-selected, currentColor)",
|
|
145
|
-
'&:visited': {
|
|
146
|
-
color: "var(--ds-text-selected, currentColor)"
|
|
147
|
-
},
|
|
148
|
-
'&:hover': {
|
|
149
|
-
backgroundColor: `var(--ds-background-selected-hovered, ${N20})`,
|
|
150
|
-
color: "var(--ds-text-selected, currentColor)"
|
|
151
|
-
},
|
|
152
|
-
'&:active': {
|
|
153
|
-
backgroundColor: `var(--ds-background-selected-pressed, ${N30})`,
|
|
154
|
-
color: "var(--ds-text-selected, currentColor)"
|
|
155
|
-
}
|
|
156
|
-
});
|
|
157
34
|
const gapMap = {
|
|
158
35
|
compact: 'space.100',
|
|
159
36
|
cozy: 'space.150'
|
|
@@ -179,56 +56,46 @@ const MenuItemPrimitive = ({
|
|
|
179
56
|
description,
|
|
180
57
|
iconAfter,
|
|
181
58
|
iconBefore,
|
|
182
|
-
overrides,
|
|
183
59
|
className: UNSAFE_externalClassName,
|
|
184
60
|
shouldTitleWrap = false,
|
|
185
61
|
shouldDescriptionWrap = false,
|
|
186
62
|
isDisabled = false,
|
|
187
63
|
isSelected = false,
|
|
64
|
+
isTitleHeading = false,
|
|
188
65
|
testId
|
|
189
66
|
}) => {
|
|
190
|
-
propDeprecationWarning("@atlaskit/menu" || '', 'overrides', overrides !== undefined, '' // TODO: Create DAC post when primitives/xcss are available as alternatives
|
|
191
|
-
);
|
|
192
67
|
const spacing = useContext(SpacingContext);
|
|
193
68
|
const selectionStyle = useContext(SELECTION_STYLE_CONTEXT_DO_NOT_USE);
|
|
194
|
-
const renderTitle = overrides && overrides.Title && overrides.Title.render || defaultRender;
|
|
195
69
|
const UNSAFE_className = UNSAFE_externalClassName;
|
|
196
|
-
return
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
return jsx(FocusRing, {
|
|
201
|
-
isInset: true
|
|
202
|
-
}, children({
|
|
203
|
-
className: cx([cn([positionRelativeStyles, primitiveStyles, spacingMapStyles[spacing], !isDisabled && !isSelected && unselectedStyles, !isDisabled && isSelected && [selectedStyles, [selectionStyle === 'border' && selectedBorderStyles, selectionStyle === 'notch' && selectedNotchStyles]], isDisabled ? disabledStyles : interactiveStyles]), UNSAFE_className]),
|
|
204
|
-
children: jsx(Inline, {
|
|
70
|
+
return (() => {
|
|
71
|
+
return children({
|
|
72
|
+
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]),
|
|
73
|
+
children: /*#__PURE__*/React.createElement(Inline, {
|
|
205
74
|
as: "span",
|
|
206
75
|
spread: "space-between",
|
|
207
76
|
alignBlock: "center",
|
|
208
77
|
space: gapMap[spacing],
|
|
209
78
|
grow: "fill",
|
|
210
79
|
testId: testId && `${testId}--container`
|
|
211
|
-
}, iconBefore &&
|
|
80
|
+
}, iconBefore && /*#__PURE__*/React.createElement("span", {
|
|
212
81
|
"data-item-elem-before": true,
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
}, iconBefore), title &&
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
xcss: contentStyles
|
|
219
|
-
}, renderTitle('span', {
|
|
82
|
+
"data-testid": testId && `${testId}--icon-before`,
|
|
83
|
+
className: ax([fg('platform_ads_component_no_icon_spacing_support') && styles.beforeAfterElement, !fg('platform_ads_component_no_icon_spacing_support') && styles.beforeAfterElementOld])
|
|
84
|
+
}, iconBefore), title && /*#__PURE__*/React.createElement("div", {
|
|
85
|
+
className: ax([styles.content])
|
|
86
|
+
}, renderTitle(isTitleHeading ? 'h2' : 'span', {
|
|
220
87
|
children: title,
|
|
221
|
-
className:
|
|
88
|
+
className: ax([styles.title, shouldTitleWrap ? styles.wordBreak : styles.truncate]),
|
|
222
89
|
'data-item-title': true
|
|
223
|
-
}), description &&
|
|
90
|
+
}), description && /*#__PURE__*/React.createElement("span", {
|
|
224
91
|
"data-item-description": true,
|
|
225
|
-
|
|
226
|
-
}, description)), iconAfter &&
|
|
92
|
+
className: ax([styles.description, isDisabled && styles.disabledDescription, shouldDescriptionWrap && styles.wordBreak, !shouldDescriptionWrap && styles.truncate])
|
|
93
|
+
}, description)), iconAfter && /*#__PURE__*/React.createElement("span", {
|
|
227
94
|
"data-item-elem-after": true,
|
|
228
|
-
|
|
229
|
-
|
|
95
|
+
"data-testid": testId && `${testId}--icon-after`,
|
|
96
|
+
className: ax([fg('platform_ads_component_no_icon_spacing_support') && styles.beforeAfterElement, !fg('platform_ads_component_no_icon_spacing_support') && styles.beforeAfterElementOld])
|
|
230
97
|
}, iconAfter))
|
|
231
|
-
})
|
|
232
|
-
});
|
|
98
|
+
});
|
|
99
|
+
})();
|
|
233
100
|
};
|
|
234
101
|
export default MenuItemPrimitive;
|
|
@@ -1,14 +1,8 @@
|
|
|
1
|
+
/* button-item.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
1
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* @jsx jsx
|
|
5
|
-
*/
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
6
5
|
import { forwardRef, memo, useCallback, useContext } from 'react';
|
|
7
|
-
|
|
8
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
|
-
import { jsx } from '@emotion/react';
|
|
10
|
-
import { propDeprecationWarning } from '@atlaskit/ds-lib/deprecation-warning';
|
|
11
|
-
import noop from '@atlaskit/ds-lib/noop';
|
|
12
6
|
import InteractionContext from '@atlaskit/interaction-context';
|
|
13
7
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
8
|
import MenuItemPrimitive from '../internal/components/menu-item-primitive';
|
|
@@ -25,7 +19,6 @@ const ButtonItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(
|
|
|
25
19
|
(props, ref) => {
|
|
26
20
|
const {
|
|
27
21
|
children,
|
|
28
|
-
cssFn = noop,
|
|
29
22
|
description,
|
|
30
23
|
iconAfter,
|
|
31
24
|
iconBefore,
|
|
@@ -33,7 +26,6 @@ const ButtonItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(
|
|
|
33
26
|
isSelected = false,
|
|
34
27
|
onClick,
|
|
35
28
|
testId,
|
|
36
|
-
overrides,
|
|
37
29
|
onMouseDown,
|
|
38
30
|
shouldTitleWrap,
|
|
39
31
|
shouldDescriptionWrap,
|
|
@@ -50,34 +42,25 @@ const ButtonItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(
|
|
|
50
42
|
if (!children) {
|
|
51
43
|
return null;
|
|
52
44
|
}
|
|
53
|
-
|
|
54
|
-
);
|
|
55
|
-
return jsx(MenuItemPrimitive
|
|
45
|
+
return /*#__PURE__*/React.createElement(MenuItemPrimitive
|
|
56
46
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
57
47
|
, _extends({
|
|
58
48
|
className: UNSAFE_className
|
|
59
49
|
}, rest, {
|
|
60
|
-
// eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
|
|
61
|
-
overrides: overrides,
|
|
62
50
|
iconBefore: iconBefore,
|
|
63
51
|
iconAfter: iconAfter,
|
|
64
52
|
isDisabled: isDisabled,
|
|
65
53
|
isSelected: isSelected,
|
|
54
|
+
isTitleHeading: false,
|
|
66
55
|
description: description,
|
|
67
56
|
title: children,
|
|
68
57
|
shouldTitleWrap: shouldTitleWrap,
|
|
69
58
|
shouldDescriptionWrap: shouldDescriptionWrap,
|
|
70
|
-
css:
|
|
71
|
-
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
72
|
-
cssFn({
|
|
73
|
-
isSelected,
|
|
74
|
-
isDisabled
|
|
75
|
-
}),
|
|
76
59
|
testId: testId && `${testId}--primitive`
|
|
77
60
|
}), ({
|
|
78
61
|
children,
|
|
79
62
|
className
|
|
80
|
-
}) =>
|
|
63
|
+
}) => /*#__PURE__*/React.createElement("button", _extends({
|
|
81
64
|
"data-testid": testId
|
|
82
65
|
}, rest, {
|
|
83
66
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -1,15 +1,8 @@
|
|
|
1
|
+
/* custom-item.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
1
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* @jsx jsx
|
|
5
|
-
*/
|
|
6
|
-
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
7
5
|
import { forwardRef, memo, useCallback, useContext } from 'react';
|
|
8
|
-
|
|
9
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
10
|
-
import { css, jsx } from '@emotion/react';
|
|
11
|
-
import { propDeprecationWarning } from '@atlaskit/ds-lib/deprecation-warning';
|
|
12
|
-
import noop from '@atlaskit/ds-lib/noop';
|
|
13
6
|
import InteractionContext from '@atlaskit/interaction-context';
|
|
14
7
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
8
|
import MenuItemPrimitive from '../internal/components/menu-item-primitive';
|
|
@@ -29,16 +22,15 @@ const preventEvent = e => {
|
|
|
29
22
|
*/
|
|
30
23
|
const CustomItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
31
24
|
component: Component,
|
|
32
|
-
cssFn = noop,
|
|
33
25
|
isDisabled = false,
|
|
34
26
|
isSelected = false,
|
|
27
|
+
isTitleHeading = false,
|
|
35
28
|
onClick,
|
|
36
29
|
testId,
|
|
37
30
|
children,
|
|
38
31
|
description,
|
|
39
32
|
iconAfter,
|
|
40
33
|
iconBefore,
|
|
41
|
-
overrides,
|
|
42
34
|
onMouseDown,
|
|
43
35
|
shouldTitleWrap,
|
|
44
36
|
shouldDescriptionWrap,
|
|
@@ -56,36 +48,25 @@ const CustomItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
56
48
|
if (!Component) {
|
|
57
49
|
return null;
|
|
58
50
|
}
|
|
59
|
-
|
|
60
|
-
);
|
|
61
|
-
return jsx(MenuItemPrimitive
|
|
51
|
+
return /*#__PURE__*/React.createElement(MenuItemPrimitive
|
|
62
52
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
63
53
|
, _extends({
|
|
64
54
|
className: UNSAFE_className
|
|
65
55
|
}, rest, {
|
|
66
|
-
// eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
|
|
67
|
-
overrides: overrides,
|
|
68
56
|
description: description,
|
|
69
57
|
iconAfter: iconAfter,
|
|
70
58
|
title: children,
|
|
71
59
|
iconBefore: iconBefore,
|
|
72
60
|
isSelected: isSelected,
|
|
73
61
|
isDisabled: isDisabled,
|
|
62
|
+
isTitleHeading: isTitleHeading,
|
|
74
63
|
shouldTitleWrap: shouldTitleWrap,
|
|
75
|
-
shouldDescriptionWrap: shouldDescriptionWrap
|
|
76
|
-
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
77
|
-
,
|
|
78
|
-
css: css(
|
|
79
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
80
|
-
cssFn({
|
|
81
|
-
isDisabled,
|
|
82
|
-
isSelected
|
|
83
|
-
})),
|
|
64
|
+
shouldDescriptionWrap: shouldDescriptionWrap,
|
|
84
65
|
testId: testId && `${testId}--primitive`
|
|
85
66
|
}), ({
|
|
86
67
|
children,
|
|
87
68
|
className
|
|
88
|
-
}) =>
|
|
69
|
+
}) => /*#__PURE__*/React.createElement(Component, _extends({
|
|
89
70
|
"data-testid": testId
|
|
90
71
|
}, rest, {
|
|
91
72
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|