@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,15 +1,9 @@
|
|
|
1
|
+
/* link-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
6
|
import { useRouterLink } from '@atlaskit/app-provider';
|
|
11
|
-
import { propDeprecationWarning } from '@atlaskit/ds-lib/deprecation-warning';
|
|
12
|
-
import noop from '@atlaskit/ds-lib/noop';
|
|
13
7
|
import InteractionContext from '@atlaskit/interaction-context';
|
|
14
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
9
|
import MenuItemPrimitive from '../internal/components/menu-item-primitive';
|
|
@@ -33,7 +27,6 @@ const LinkItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(
|
|
|
33
27
|
const {
|
|
34
28
|
children,
|
|
35
29
|
href,
|
|
36
|
-
cssFn = noop,
|
|
37
30
|
description,
|
|
38
31
|
iconAfter,
|
|
39
32
|
iconBefore,
|
|
@@ -41,7 +34,6 @@ const LinkItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(
|
|
|
41
34
|
isSelected = false,
|
|
42
35
|
onClick,
|
|
43
36
|
testId,
|
|
44
|
-
overrides,
|
|
45
37
|
onMouseDown,
|
|
46
38
|
shouldTitleWrap,
|
|
47
39
|
shouldDescriptionWrap,
|
|
@@ -75,33 +67,23 @@ const LinkItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(
|
|
|
75
67
|
*/
|
|
76
68
|
const isRouterLink = !UNSAFE_shouldDisableRouterLink && RouterLink && !isExternal && !isNonHttpBased && !isEmptyHref;
|
|
77
69
|
const Component = isRouterLink ? RouterLink : 'a';
|
|
78
|
-
|
|
79
|
-
);
|
|
80
|
-
return jsx(MenuItemPrimitive, _extends({}, rest, {
|
|
70
|
+
return /*#__PURE__*/React.createElement(MenuItemPrimitive, _extends({}, rest, {
|
|
81
71
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
82
|
-
className: UNSAFE_className
|
|
83
|
-
// eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
|
|
84
|
-
,
|
|
85
|
-
overrides: overrides,
|
|
72
|
+
className: UNSAFE_className,
|
|
86
73
|
iconBefore: iconBefore,
|
|
87
74
|
iconAfter: iconAfter,
|
|
88
75
|
isSelected: isSelected,
|
|
89
76
|
isDisabled: isDisabled,
|
|
77
|
+
isTitleHeading: false,
|
|
90
78
|
description: description,
|
|
91
79
|
shouldTitleWrap: shouldTitleWrap,
|
|
92
80
|
shouldDescriptionWrap: shouldDescriptionWrap,
|
|
93
|
-
css:
|
|
94
|
-
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
95
|
-
cssFn({
|
|
96
|
-
isSelected,
|
|
97
|
-
isDisabled
|
|
98
|
-
}),
|
|
99
81
|
title: children,
|
|
100
82
|
testId: testId && `${testId}--primitive`
|
|
101
83
|
}), ({
|
|
102
84
|
children,
|
|
103
85
|
className
|
|
104
|
-
}) =>
|
|
86
|
+
}) => /*#__PURE__*/React.createElement(Component, _extends({
|
|
105
87
|
"data-testid": testId,
|
|
106
88
|
"data-is-router-link": testId ? isRouterLink ? 'true' : 'false' : undefined,
|
|
107
89
|
"data-vc": "link-item"
|
|
@@ -60,12 +60,9 @@ const SkeletonHeadingItem = ({
|
|
|
60
60
|
className
|
|
61
61
|
}) => jsx("div", {
|
|
62
62
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
63
|
-
className: className
|
|
64
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
65
|
-
,
|
|
63
|
+
className: className,
|
|
66
64
|
style: {
|
|
67
65
|
'--width': width
|
|
68
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
69
66
|
},
|
|
70
67
|
css: [skeletonStyles, width ? customWidthStyles : defaultWidthStyles,
|
|
71
68
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
@@ -129,12 +129,9 @@ const SkeletonItem = ({
|
|
|
129
129
|
className
|
|
130
130
|
}) => jsx("div", {
|
|
131
131
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
132
|
-
className: className
|
|
133
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
134
|
-
,
|
|
132
|
+
className: className,
|
|
135
133
|
style: {
|
|
136
134
|
'--width': width
|
|
137
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
138
135
|
},
|
|
139
136
|
css: [skeletonStyles, (hasAvatar || hasIcon) && beforeElementStyles, hasAvatar && avatarStyles, hasIcon && iconStyles, width ? customWidthStyles : defaultWidthStyles,
|
|
140
137
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage, @atlaskit/design-system/ensure-design-token-usage/preview */
|
|
3
2
|
/**
|
|
4
3
|
* @jsxRuntime classic
|
|
5
4
|
* @jsx jsx
|
|
@@ -140,9 +139,7 @@ const Section = /*#__PURE__*/forwardRef(({
|
|
|
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,
|
|
@@ -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,162 +1,39 @@
|
|
|
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
|
-
var
|
|
9
|
+
var renderTitle = function renderTitle(Component, props) {
|
|
16
10
|
return (
|
|
11
|
+
/*#__PURE__*/
|
|
17
12
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
18
|
-
|
|
13
|
+
React.createElement(Component, props)
|
|
19
14
|
);
|
|
20
15
|
};
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
});
|
|
16
|
+
var styles = {
|
|
17
|
+
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",
|
|
18
|
+
beforeAfterElementOld: "_1e0c1txw _4cvr1h6o _1bah1h6o _1o9zidpf",
|
|
19
|
+
beforeAfterElement: "_1e0c1txw _1ul91tcg _1tke1tcg _4cvr1h6o _1bah1h6o _1o9zidpf",
|
|
20
|
+
content: "_12ji1r31 _1qu2glyw _12y31o36 _1reo15vq _18m915vq _1e0c1txw _2lx21bp4 _1bah1h6o _16jlkb7n _y3gn1e5h",
|
|
21
|
+
truncate: "_1reo15vq _18m915vq _1e0c1ule _1bto1l2s _o5721q9c",
|
|
22
|
+
title: "_11c82smr",
|
|
23
|
+
wordBreak: "_1nmz1hna",
|
|
24
|
+
description: "_11c8dcr7 _syaz1wmz",
|
|
25
|
+
disabledDescription: "_syaz2oi6",
|
|
26
|
+
unselected: "_bfhkqtfy _syaz1r31 _10531r31 _irr31dko _30l31r31 _1di61dko _9h8h1r31",
|
|
27
|
+
disabled: "_80om13gf _bfhkqtfy _syaz2oi6 _irr3qtfy _30l32oi6 _1di6qtfy _9h8h2oi6",
|
|
28
|
+
selectedBorder: "_1mp4yh40 _1cs8stnw _1rus67is _1kt9b3bt _1fkrze3t _iajmze3t _z5wtze3t",
|
|
29
|
+
selectedNotch: "_rfx315o9 _1mp41y44 _1cs8stnw _1rus67is _1kt9b3bt _1fkrutpp _iajmutpp _z5wtze3t",
|
|
30
|
+
selected: "_bfhk1q4k _syazhu5v _1053hu5v _irr32seo _30l316ov _1di6guph _9h8hhu5v",
|
|
31
|
+
selectedOld: "_30l3hu5v"
|
|
32
|
+
};
|
|
81
33
|
var spacingMapStyles = {
|
|
82
|
-
cozy:
|
|
83
|
-
|
|
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
|
-
})
|
|
34
|
+
cozy: "_1rjcu2gc _18zrpxbi",
|
|
35
|
+
compact: "_1rjc1b66 _18zrutpp _1tkezwfg"
|
|
93
36
|
};
|
|
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
37
|
var gapMap = {
|
|
161
38
|
compact: 'space.100',
|
|
162
39
|
cozy: 'space.150'
|
|
@@ -182,7 +59,6 @@ var MenuItemPrimitive = function MenuItemPrimitive(_ref) {
|
|
|
182
59
|
description = _ref.description,
|
|
183
60
|
iconAfter = _ref.iconAfter,
|
|
184
61
|
iconBefore = _ref.iconBefore,
|
|
185
|
-
overrides = _ref.overrides,
|
|
186
62
|
UNSAFE_externalClassName = _ref.className,
|
|
187
63
|
_ref$shouldTitleWrap = _ref.shouldTitleWrap,
|
|
188
64
|
shouldTitleWrap = _ref$shouldTitleWrap === void 0 ? false : _ref$shouldTitleWrap,
|
|
@@ -192,48 +68,41 @@ var MenuItemPrimitive = function MenuItemPrimitive(_ref) {
|
|
|
192
68
|
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
193
69
|
_ref$isSelected = _ref.isSelected,
|
|
194
70
|
isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected,
|
|
71
|
+
_ref$isTitleHeading = _ref.isTitleHeading,
|
|
72
|
+
isTitleHeading = _ref$isTitleHeading === void 0 ? false : _ref$isTitleHeading,
|
|
195
73
|
testId = _ref.testId;
|
|
196
|
-
propDeprecationWarning("@atlaskit/menu" || '', 'overrides', overrides !== undefined, '' // TODO: Create DAC post when primitives/xcss are available as alternatives
|
|
197
|
-
);
|
|
198
74
|
var spacing = useContext(SpacingContext);
|
|
199
75
|
var selectionStyle = useContext(SELECTION_STYLE_CONTEXT_DO_NOT_USE);
|
|
200
|
-
var renderTitle = overrides && overrides.Title && overrides.Title.render || defaultRender;
|
|
201
76
|
var UNSAFE_className = UNSAFE_externalClassName;
|
|
202
|
-
return
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
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, {
|
|
77
|
+
return function () {
|
|
78
|
+
return children({
|
|
79
|
+
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]),
|
|
80
|
+
children: /*#__PURE__*/React.createElement(Inline, {
|
|
210
81
|
as: "span",
|
|
211
82
|
spread: "space-between",
|
|
212
83
|
alignBlock: "center",
|
|
213
84
|
space: gapMap[spacing],
|
|
214
85
|
grow: "fill",
|
|
215
86
|
testId: testId && "".concat(testId, "--container")
|
|
216
|
-
}, iconBefore &&
|
|
87
|
+
}, iconBefore && /*#__PURE__*/React.createElement("span", {
|
|
217
88
|
"data-item-elem-before": true,
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
}, iconBefore), title &&
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
xcss: contentStyles
|
|
224
|
-
}, renderTitle('span', {
|
|
89
|
+
"data-testid": testId && "".concat(testId, "--icon-before"),
|
|
90
|
+
className: ax([fg('platform_ads_component_no_icon_spacing_support') && styles.beforeAfterElement, !fg('platform_ads_component_no_icon_spacing_support') && styles.beforeAfterElementOld])
|
|
91
|
+
}, iconBefore), title && /*#__PURE__*/React.createElement("div", {
|
|
92
|
+
className: ax([styles.content])
|
|
93
|
+
}, renderTitle(isTitleHeading ? 'h2' : 'span', {
|
|
225
94
|
children: title,
|
|
226
|
-
className:
|
|
95
|
+
className: ax([styles.title, shouldTitleWrap ? styles.wordBreak : styles.truncate]),
|
|
227
96
|
'data-item-title': true
|
|
228
|
-
}), description &&
|
|
97
|
+
}), description && /*#__PURE__*/React.createElement("span", {
|
|
229
98
|
"data-item-description": true,
|
|
230
|
-
|
|
231
|
-
}, description)), iconAfter &&
|
|
99
|
+
className: ax([styles.description, isDisabled && styles.disabledDescription, shouldDescriptionWrap && styles.wordBreak, !shouldDescriptionWrap && styles.truncate])
|
|
100
|
+
}, description)), iconAfter && /*#__PURE__*/React.createElement("span", {
|
|
232
101
|
"data-item-elem-after": true,
|
|
233
|
-
|
|
234
|
-
|
|
102
|
+
"data-testid": testId && "".concat(testId, "--icon-after"),
|
|
103
|
+
className: ax([fg('platform_ads_component_no_icon_spacing_support') && styles.beforeAfterElement, !fg('platform_ads_component_no_icon_spacing_support') && styles.beforeAfterElementOld])
|
|
235
104
|
}, iconAfter))
|
|
236
|
-
})
|
|
237
|
-
});
|
|
105
|
+
});
|
|
106
|
+
}();
|
|
238
107
|
};
|
|
239
108
|
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", "
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* @jsx jsx
|
|
7
|
-
*/
|
|
4
|
+
var _excluded = ["children", "description", "iconAfter", "iconBefore", "isDisabled", "isSelected", "onClick", "testId", "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,
|
|
@@ -37,7 +29,6 @@ function (props, ref) {
|
|
|
37
29
|
isSelected = _props$isSelected === void 0 ? false : _props$isSelected,
|
|
38
30
|
onClick = props.onClick,
|
|
39
31
|
testId = props.testId,
|
|
40
|
-
overrides = props.overrides,
|
|
41
32
|
onMouseDown = props.onMouseDown,
|
|
42
33
|
shouldTitleWrap = props.shouldTitleWrap,
|
|
43
34
|
shouldDescriptionWrap = props.shouldDescriptionWrap,
|
|
@@ -53,34 +44,25 @@ function (props, ref) {
|
|
|
53
44
|
if (!children) {
|
|
54
45
|
return null;
|
|
55
46
|
}
|
|
56
|
-
|
|
57
|
-
);
|
|
58
|
-
return jsx(MenuItemPrimitive
|
|
47
|
+
return /*#__PURE__*/React.createElement(MenuItemPrimitive
|
|
59
48
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
60
49
|
, _extends({
|
|
61
50
|
className: UNSAFE_className
|
|
62
51
|
}, rest, {
|
|
63
|
-
// eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
|
|
64
|
-
overrides: overrides,
|
|
65
52
|
iconBefore: iconBefore,
|
|
66
53
|
iconAfter: iconAfter,
|
|
67
54
|
isDisabled: isDisabled,
|
|
68
55
|
isSelected: isSelected,
|
|
56
|
+
isTitleHeading: false,
|
|
69
57
|
description: description,
|
|
70
58
|
title: children,
|
|
71
59
|
shouldTitleWrap: shouldTitleWrap,
|
|
72
60
|
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
61
|
testId: testId && "".concat(testId, "--primitive")
|
|
80
62
|
}), function (_ref) {
|
|
81
63
|
var children = _ref.children,
|
|
82
64
|
className = _ref.className;
|
|
83
|
-
return
|
|
65
|
+
return /*#__PURE__*/React.createElement("button", _extends({
|
|
84
66
|
"data-testid": testId
|
|
85
67
|
}, rest, {
|
|
86
68
|
// 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", "
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* @jsx jsx
|
|
7
|
-
*/
|
|
8
|
-
|
|
4
|
+
var _excluded = ["component", "isDisabled", "isSelected", "isTitleHeading", "onClick", "testId", "children", "description", "iconAfter", "iconBefore", "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,19 +24,18 @@ 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,
|
|
39
30
|
isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected,
|
|
31
|
+
_ref$isTitleHeading = _ref.isTitleHeading,
|
|
32
|
+
isTitleHeading = _ref$isTitleHeading === void 0 ? false : _ref$isTitleHeading,
|
|
40
33
|
onClick = _ref.onClick,
|
|
41
34
|
testId = _ref.testId,
|
|
42
35
|
children = _ref.children,
|
|
43
36
|
description = _ref.description,
|
|
44
37
|
iconAfter = _ref.iconAfter,
|
|
45
38
|
iconBefore = _ref.iconBefore,
|
|
46
|
-
overrides = _ref.overrides,
|
|
47
39
|
onMouseDown = _ref.onMouseDown,
|
|
48
40
|
shouldTitleWrap = _ref.shouldTitleWrap,
|
|
49
41
|
shouldDescriptionWrap = _ref.shouldDescriptionWrap,
|
|
@@ -60,36 +52,25 @@ var CustomItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref, ref)
|
|
|
60
52
|
if (!Component) {
|
|
61
53
|
return null;
|
|
62
54
|
}
|
|
63
|
-
|
|
64
|
-
);
|
|
65
|
-
return jsx(MenuItemPrimitive
|
|
55
|
+
return /*#__PURE__*/React.createElement(MenuItemPrimitive
|
|
66
56
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
67
57
|
, _extends({
|
|
68
58
|
className: UNSAFE_className
|
|
69
59
|
}, rest, {
|
|
70
|
-
// eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
|
|
71
|
-
overrides: overrides,
|
|
72
60
|
description: description,
|
|
73
61
|
iconAfter: iconAfter,
|
|
74
62
|
title: children,
|
|
75
63
|
iconBefore: iconBefore,
|
|
76
64
|
isSelected: isSelected,
|
|
77
65
|
isDisabled: isDisabled,
|
|
66
|
+
isTitleHeading: isTitleHeading,
|
|
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
|
|
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
|