@atlaskit/lozenge 13.4.0 → 13.4.2
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 +18 -0
- package/dist/cjs/new/icon-renderer.js +3 -9
- package/dist/cjs/new/lozenge-base.compiled.css +39 -13
- package/dist/cjs/new/lozenge-base.js +80 -16
- package/dist/cjs/new/lozenge-dropdown-trigger.js +16 -7
- package/dist/cjs/new/lozenge.js +11 -7
- package/dist/es2019/new/icon-renderer.js +3 -9
- package/dist/es2019/new/lozenge-base.compiled.css +39 -13
- package/dist/es2019/new/lozenge-base.js +81 -17
- package/dist/es2019/new/lozenge-dropdown-trigger.js +23 -15
- package/dist/es2019/new/lozenge.js +15 -11
- package/dist/esm/new/icon-renderer.js +3 -9
- package/dist/esm/new/lozenge-base.compiled.css +39 -13
- package/dist/esm/new/lozenge-base.js +81 -17
- package/dist/esm/new/lozenge-dropdown-trigger.js +16 -7
- package/dist/esm/new/lozenge.js +11 -7
- package/dist/types/index.d.ts +1 -1
- package/dist/types/new/icon-renderer.d.ts +1 -5
- package/dist/types/new/lozenge-base.d.ts +4 -4
- package/dist/types/new/lozenge.d.ts +1 -1
- package/dist/types/new/types.d.ts +59 -9
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/dist/types-ts4.5/new/icon-renderer.d.ts +1 -5
- package/dist/types-ts4.5/new/lozenge-base.d.ts +4 -4
- package/dist/types-ts4.5/new/lozenge.d.ts +1 -1
- package/dist/types-ts4.5/new/types.d.ts +59 -9
- package/package.json +4 -2
|
@@ -1,21 +1,51 @@
|
|
|
1
1
|
/* lozenge-base.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
3
|
import "./lozenge-base.compiled.css";
|
|
3
4
|
import * as React from 'react';
|
|
4
5
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
-
import { forwardRef,
|
|
6
|
+
import { forwardRef, memo } from 'react';
|
|
7
|
+
import Badge from '@atlaskit/badge';
|
|
6
8
|
import { cx } from '@atlaskit/css';
|
|
7
9
|
import ChevronDownIcon from '@atlaskit/icon/core/chevron-down';
|
|
8
10
|
import Pressable from '@atlaskit/primitives/pressable';
|
|
11
|
+
import Spinner from '@atlaskit/spinner';
|
|
9
12
|
import IconRenderer from './icon-renderer';
|
|
10
13
|
import { getThemeStyles, resolveLozengeColor } from './utils';
|
|
14
|
+
// Get the pressed background color for the selected lozenge dropdown trigger
|
|
15
|
+
const pressedBackgroundMapping = {
|
|
16
|
+
success: "var(--ds-background-success-subtler-pressed, #B3DF72)",
|
|
17
|
+
warning: "var(--ds-background-warning-subtler-pressed, #FBC828)",
|
|
18
|
+
danger: "var(--ds-background-danger-subtler-pressed, #FD9891)",
|
|
19
|
+
information: "var(--ds-background-information-subtler-pressed, #8FB8F6)",
|
|
20
|
+
neutral: "var(--ds-background-neutral-pressed, #080F214A)",
|
|
21
|
+
discovery: "var(--ds-background-discovery-subtler-pressed, #D8A0F7)",
|
|
22
|
+
'accent-red': "var(--ds-background-accent-red-subtler-pressed, #FD9891)",
|
|
23
|
+
'accent-orange': "var(--ds-background-accent-orange-subtler-pressed, #FBC828)",
|
|
24
|
+
'accent-yellow': "var(--ds-background-accent-yellow-subtler-pressed, #EED12B)",
|
|
25
|
+
'accent-lime': "var(--ds-background-accent-lime-subtler-pressed, #B3DF72)",
|
|
26
|
+
'accent-green': "var(--ds-background-accent-green-subtler-pressed, #7EE2B8)",
|
|
27
|
+
'accent-teal': "var(--ds-background-accent-teal-subtler-pressed, #9DD9EE)",
|
|
28
|
+
'accent-blue': "var(--ds-background-accent-blue-subtler-pressed, #8FB8F6)",
|
|
29
|
+
'accent-purple': "var(--ds-background-accent-purple-subtler-pressed, #D8A0F7)",
|
|
30
|
+
'accent-magenta': "var(--ds-background-accent-magenta-subtler-pressed, #F797D2)",
|
|
31
|
+
'accent-gray': "var(--ds-background-accent-gray-subtlest-pressed, #B7B9BE)"
|
|
32
|
+
};
|
|
11
33
|
const styles = {
|
|
12
|
-
container: "_2rko12b0 _1reo15vq _18m915vq
|
|
13
|
-
containerSpacious: "_2rko1qi0
|
|
14
|
-
|
|
15
|
-
containerSelected: "_bfhk15s3 _syaz6x5g _irr3ufnl _1di6nozp",
|
|
34
|
+
container: "_2rko12b0 _1reo15vq _18m915vq _189ee4h9 _1dqonqa1 _1h6d1j28 _kqswh2mm _1e0c116y _4cvr1h6o _vchhusvi _4t3i1k92 _1q51v77o _85i5v77o _bozg1b66 _y4ti1b66",
|
|
35
|
+
containerSpacious: "_2rko1qi0 _1tkeviql _1q511b66 _85i51b66 _bozgutpp _y4tiutpp",
|
|
36
|
+
containerBadgePadding: "_y4ti303w",
|
|
16
37
|
text: "_11c8wadc _1reo15vq _18m915vq _1bto1l2s _o5721q9c",
|
|
17
38
|
textSpacious: "_11c8fhey _k48p1wq8",
|
|
18
39
|
textSelected: "_syaz6x5g",
|
|
40
|
+
loadingOverlay: "_1reo15vq _18m915vq _1e0c1txw _kqswstnw _4cvr1h6o _1bah1h6o _u7coze3t _152tze3t _rjxpze3t _1e02ze3t _lcxvglyw",
|
|
41
|
+
metricBadgeWrapper: "_1e0c1txw",
|
|
42
|
+
'metric.semantic.success': "_1bn8d6jc _4ayg1wl5",
|
|
43
|
+
'metric.semantic.warning': "_1bn8bkku _4aygzr32",
|
|
44
|
+
'metric.semantic.danger': "_1bn8jkmi _4ayg1r4b",
|
|
45
|
+
'metric.semantic.information': "_1bn8ar1y _4ayg1c1j",
|
|
46
|
+
'metric.semantic.neutral': "_1bn814je _4ayg1fkg _iymy8hz0 _16burnys",
|
|
47
|
+
'metric.semantic.discovery': "_1bn85usi _4ayg18vq",
|
|
48
|
+
'metric.inverse': "_1bn8vuon _4aygvuon",
|
|
19
49
|
'semantic.success': "_1b3i4pcx _3wu01mps _bfhk14j0 _syaz1p1e",
|
|
20
50
|
'semantic.warning': "_1b3iervl _3wu01xiv _bfhk10f4 _syazmgs1",
|
|
21
51
|
'semantic.danger': "_1b3is4qr _3wu01bqt _bfhk18wg _syaz1blx",
|
|
@@ -48,9 +78,14 @@ const styles = {
|
|
|
48
78
|
'interactive.accent.purple': "_irr3attl _1di63nfk",
|
|
49
79
|
'interactive.accent.magenta': "_irr31axx _1di642ri",
|
|
50
80
|
'interactive.accent.gray': "_irr3wejn _1di618ut",
|
|
51
|
-
selectedInteractive: "_irr3ufnl _1di6nozp",
|
|
52
81
|
iconBorderFilter: "_1h6dzs9d _4uq11yqs _1k671038 _m71tr3uz _13muu67f _168qx19p _oe6mmko7 _189qkb7n _u8p61h4e _1t75u67f _hg5mr3uz _1f28f1ug _1xe213rw _1easxmrh _1r9r1ss3",
|
|
53
|
-
iconBorderInteractiveFilter: "_1iel6xdd _111i1h4e _18dicjiy _hyog26zw _fdt01r5k _46v5hwvj _ylgq1r5k _bg3q9by0 _196p1btq _18mn783i _l0666xdd _pclnn8xv _ockq1r5k _aewt1n8h _4cvx7ddx _1cp21w66 _q4zt1csi _1gqs1mvc _75gv2l9f _1lh71sfd _ui3h1ct7 _11o31cha"
|
|
82
|
+
iconBorderInteractiveFilter: "_1iel6xdd _111i1h4e _18dicjiy _hyog26zw _fdt01r5k _46v5hwvj _ylgq1r5k _bg3q9by0 _196p1btq _18mn783i _l0666xdd _pclnn8xv _ockq1r5k _aewt1n8h _4cvx7ddx _1cp21w66 _q4zt1csi _1gqs1mvc _75gv2l9f _1lh71sfd _ui3h1ct7 _11o31cha",
|
|
83
|
+
containerSelected: "_1xe213kw",
|
|
84
|
+
content: "_zulp1b66 _1e0c116y _4cvr1h6o",
|
|
85
|
+
contentSpacious: "_zulp12x7",
|
|
86
|
+
loadingContent: "_tzy4idpf",
|
|
87
|
+
containerBadge: "_1ftrbpke",
|
|
88
|
+
containerBadgeInteractive: "_1axm1bqy"
|
|
54
89
|
};
|
|
55
90
|
|
|
56
91
|
/**
|
|
@@ -64,10 +99,14 @@ const LozengeBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
64
99
|
testId,
|
|
65
100
|
appearance,
|
|
66
101
|
iconBefore,
|
|
102
|
+
trailingMetric,
|
|
103
|
+
trailingMetricAppearance,
|
|
67
104
|
maxWidth = 200,
|
|
68
105
|
spacing = 'default',
|
|
69
106
|
isSelected,
|
|
70
107
|
// for dropdown trigger
|
|
108
|
+
isLoading = false,
|
|
109
|
+
// for dropdown trigger
|
|
71
110
|
onClick,
|
|
72
111
|
// for dropdown trigger
|
|
73
112
|
style,
|
|
@@ -86,15 +125,20 @@ const LozengeBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
86
125
|
const interactiveStyleKey = `interactive.${category}.${key}`;
|
|
87
126
|
const maxWidthValue = typeof maxWidth === 'string' ? maxWidth : `${maxWidth}px`;
|
|
88
127
|
const maxWidthIsPc = typeof maxWidth === 'string' && /%$/.test(maxWidth);
|
|
128
|
+
const resolvedTrailingMetricAppearance = trailingMetricAppearance ? trailingMetricAppearance === 'inverse' ? 'inverse' : resolveLozengeColor(trailingMetricAppearance) : resolvedColor;
|
|
129
|
+
const metricBadgeAppearance = resolvedTrailingMetricAppearance === 'inverse' ? 'inverse' : resolvedTrailingMetricAppearance != null && resolvedTrailingMetricAppearance.startsWith('accent-') ? 'neutral' : resolvedTrailingMetricAppearance !== null && resolvedTrailingMetricAppearance !== void 0 ? resolvedTrailingMetricAppearance : 'neutral';
|
|
130
|
+
const metricStyleKey = resolvedTrailingMetricAppearance === 'inverse' ? 'metric.inverse' : resolvedTrailingMetricAppearance != null && !resolvedTrailingMetricAppearance.startsWith('accent-') ? `metric.semantic.${getThemeStyles(resolvedTrailingMetricAppearance).key}` : 'metric.semantic.neutral';
|
|
89
131
|
const commonStyleOverrides = {
|
|
90
132
|
backgroundColor: style === null || style === void 0 ? void 0 : style.backgroundColor,
|
|
91
133
|
maxWidth: maxWidthIsPc ? maxWidth : '100%'
|
|
92
134
|
};
|
|
93
|
-
const
|
|
135
|
+
const hasTrailingMetric = trailingMetric != null && trailingMetric !== '';
|
|
136
|
+
const innerContent = /*#__PURE__*/React.createElement("span", {
|
|
137
|
+
className: ax([styles.content, spacing === 'spacious' && styles.contentSpacious, isLoading && styles.loadingContent])
|
|
138
|
+
}, iconBefore && /*#__PURE__*/React.createElement(IconRenderer, {
|
|
94
139
|
size: spacing === 'spacious' ? 'medium' : 'small',
|
|
95
140
|
icon: iconBefore,
|
|
96
141
|
color: resolvedColor,
|
|
97
|
-
isSelected: isInteractive ? isSelected : undefined,
|
|
98
142
|
testId: testId && `${testId}--icon`
|
|
99
143
|
}), /*#__PURE__*/React.createElement("span", {
|
|
100
144
|
style: {
|
|
@@ -103,35 +147,55 @@ const LozengeBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
103
147
|
},
|
|
104
148
|
"data-testid": testId && `${testId}--text`,
|
|
105
149
|
className: ax([styles.text, spacing === 'spacious' && styles.textSpacious])
|
|
106
|
-
}, children),
|
|
150
|
+
}, children), hasTrailingMetric && !resolvedColor.startsWith('accent-') && /*#__PURE__*/React.createElement("span", {
|
|
151
|
+
"data-lozenge-metric-wrapper": true,
|
|
152
|
+
"data-testid": testId && `${testId}--metric`,
|
|
153
|
+
className: ax([styles.metricBadgeWrapper])
|
|
154
|
+
}, /*#__PURE__*/React.createElement(Badge, {
|
|
155
|
+
appearance: metricBadgeAppearance
|
|
156
|
+
}, trailingMetric)), isInteractive && /*#__PURE__*/React.createElement(ChevronDownIcon, {
|
|
107
157
|
label: "",
|
|
108
158
|
size: "small",
|
|
109
|
-
color:
|
|
159
|
+
color: 'currentColor',
|
|
110
160
|
testId: testId && `${testId}--chevron`
|
|
111
161
|
}));
|
|
112
162
|
if (isInteractive) {
|
|
113
|
-
return /*#__PURE__*/React.createElement(Pressable, {
|
|
163
|
+
return /*#__PURE__*/React.createElement(Pressable, _extends({
|
|
114
164
|
ref: ref,
|
|
115
|
-
xcss: cx(styles.container, spacing === 'spacious' && styles.containerSpacious, !isSelected && styles.iconBorderFilter, !
|
|
116
|
-
|
|
165
|
+
xcss: cx(styles.container, spacing === 'spacious' && styles.containerSpacious, !isSelected && styles.iconBorderFilter, !isLoading && styles.iconBorderInteractiveFilter, styles[colorStyleKey], !isLoading && styles[interactiveStyleKey], isSelected && styles.containerSelected, hasTrailingMetric && styles.containerBadge, hasTrailingMetric && styles.containerBadgeInteractive, hasTrailingMetric && styles[metricStyleKey])
|
|
166
|
+
}, isLoading && {
|
|
167
|
+
'aria-busy': true,
|
|
168
|
+
'aria-disabled': true,
|
|
169
|
+
isDisabled: true
|
|
170
|
+
}, {
|
|
171
|
+
"aria-label": isLoading ? 'Loading' : undefined,
|
|
172
|
+
onClick: isLoading ? undefined : onClick,
|
|
117
173
|
style: {
|
|
118
174
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
119
175
|
...commonStyleOverrides,
|
|
120
176
|
// Specified because Pressable has a default border:none which overrides the border specified on the container
|
|
121
177
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
122
|
-
border: `solid ${"var(--ds-border-width, 1px)"} ${isSelected ?
|
|
178
|
+
border: `solid ${"var(--ds-border-width, 1px)"} ${isSelected ? 'oklch(from var(--border-color) calc(l * var(--border-pressed-l-factor)) c h) !important' : 'transparent'}`,
|
|
179
|
+
backgroundColor: isSelected ? pressedBackgroundMapping[resolvedColor] : undefined,
|
|
180
|
+
cursor: isLoading ? 'progress' : 'pointer'
|
|
123
181
|
},
|
|
124
182
|
testId: testId,
|
|
125
183
|
analyticsContext: analyticsContext,
|
|
126
184
|
interactionName: interactionName,
|
|
127
185
|
componentName: "LozengeDropdownTrigger"
|
|
128
|
-
}, innerContent
|
|
186
|
+
}), innerContent, isLoading && /*#__PURE__*/React.createElement("span", {
|
|
187
|
+
className: ax([styles.loadingOverlay])
|
|
188
|
+
}, /*#__PURE__*/React.createElement(Spinner, {
|
|
189
|
+
size: spacing === 'spacious' ? 'small' : 'xsmall',
|
|
190
|
+
label: ", Loading",
|
|
191
|
+
testId: testId ? `${testId}--loading-spinner` : undefined
|
|
192
|
+
})));
|
|
129
193
|
}
|
|
130
194
|
return /*#__PURE__*/React.createElement("span", {
|
|
131
195
|
ref: ref,
|
|
132
196
|
style: commonStyleOverrides,
|
|
133
197
|
"data-testid": testId,
|
|
134
|
-
className: ax([styles.container, spacing === 'spacious' && styles.containerSpacious, styles[colorStyleKey], styles.iconBorderFilter])
|
|
198
|
+
className: ax([styles.container, spacing === 'spacious' && styles.containerSpacious, spacing !== 'spacious' && hasTrailingMetric && styles.containerBadgePadding, styles[colorStyleKey], hasTrailingMetric && styles[metricStyleKey], styles.iconBorderFilter, styles.containerBadge])
|
|
135
199
|
}, innerContent);
|
|
136
200
|
}));
|
|
137
201
|
export default LozengeBase;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/* lozenge-dropdown-trigger.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
3
|
import * as React from 'react';
|
|
3
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
5
|
import { forwardRef, memo } from 'react';
|
|
@@ -22,28 +23,35 @@ const LozengeDropdownTrigger = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
22
23
|
appearance = 'neutral',
|
|
23
24
|
spacing = 'default',
|
|
24
25
|
iconBefore,
|
|
26
|
+
trailingMetric,
|
|
27
|
+
trailingMetricAppearance,
|
|
25
28
|
isSelected = false,
|
|
29
|
+
isLoading = false,
|
|
26
30
|
maxWidth = 200,
|
|
27
31
|
onClick = __noop,
|
|
28
32
|
style,
|
|
29
33
|
analyticsContext,
|
|
30
34
|
interactionName
|
|
31
35
|
}, ref) => {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
,
|
|
41
|
-
style
|
|
42
|
-
testId
|
|
43
|
-
onClick
|
|
44
|
-
analyticsContext
|
|
45
|
-
interactionName
|
|
46
|
-
|
|
36
|
+
const baseProps = {
|
|
37
|
+
appearance,
|
|
38
|
+
spacing,
|
|
39
|
+
iconBefore,
|
|
40
|
+
trailingMetric,
|
|
41
|
+
trailingMetricAppearance,
|
|
42
|
+
isSelected,
|
|
43
|
+
isLoading,
|
|
44
|
+
maxWidth,
|
|
45
|
+
style,
|
|
46
|
+
testId,
|
|
47
|
+
onClick,
|
|
48
|
+
analyticsContext,
|
|
49
|
+
interactionName,
|
|
50
|
+
children
|
|
51
|
+
};
|
|
52
|
+
return /*#__PURE__*/React.createElement(LozengeBase, _extends({
|
|
53
|
+
ref: ref
|
|
54
|
+
}, baseProps), children);
|
|
47
55
|
}));
|
|
48
56
|
LozengeDropdownTrigger.displayName = 'LozengeDropdownTrigger';
|
|
49
57
|
export default LozengeDropdownTrigger;
|
|
@@ -18,18 +18,22 @@ const Lozenge = ({
|
|
|
18
18
|
style,
|
|
19
19
|
testId,
|
|
20
20
|
children,
|
|
21
|
-
iconBefore
|
|
21
|
+
iconBefore,
|
|
22
|
+
trailingMetric,
|
|
23
|
+
trailingMetricAppearance
|
|
22
24
|
}) => {
|
|
23
|
-
|
|
24
|
-
appearance
|
|
25
|
-
spacing
|
|
26
|
-
iconBefore
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
,
|
|
30
|
-
style
|
|
31
|
-
testId
|
|
32
|
-
|
|
25
|
+
const baseProps = {
|
|
26
|
+
appearance,
|
|
27
|
+
spacing,
|
|
28
|
+
iconBefore,
|
|
29
|
+
trailingMetric,
|
|
30
|
+
trailingMetricAppearance,
|
|
31
|
+
maxWidth,
|
|
32
|
+
style,
|
|
33
|
+
testId,
|
|
34
|
+
children
|
|
35
|
+
};
|
|
36
|
+
return /*#__PURE__*/React.createElement(LozengeBase, baseProps, children);
|
|
33
37
|
};
|
|
34
38
|
Lozenge.displayName = 'Lozenge';
|
|
35
39
|
export default Lozenge;
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
// Map lozenge colors to appropriate icon colors
|
|
3
|
-
var getIconColor = function getIconColor(color
|
|
4
|
-
//
|
|
5
|
-
if (isSelected) {
|
|
6
|
-
return "var(--ds-icon-selected, #1868DB)";
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
// For semantic colors, use corresponding semantic text colors
|
|
3
|
+
var getIconColor = function getIconColor(color) {
|
|
4
|
+
// For semantic colors, use corresponding semantic icon colors
|
|
10
5
|
switch (color) {
|
|
11
6
|
case 'success':
|
|
12
7
|
return "var(--ds-icon-success, #6A9A23)";
|
|
@@ -53,10 +48,9 @@ var getIconColor = function getIconColor(color, isSelected) {
|
|
|
53
48
|
export var IconRenderer = function IconRenderer(_ref) {
|
|
54
49
|
var Icon = _ref.icon,
|
|
55
50
|
color = _ref.color,
|
|
56
|
-
isSelected = _ref.isSelected,
|
|
57
51
|
testId = _ref.testId,
|
|
58
52
|
size = _ref.size;
|
|
59
|
-
var iconColor = getIconColor(color
|
|
53
|
+
var iconColor = getIconColor(color);
|
|
60
54
|
return /*#__PURE__*/React.createElement(Icon, {
|
|
61
55
|
color: iconColor,
|
|
62
56
|
label: "",
|
|
@@ -6,17 +6,15 @@
|
|
|
6
6
|
._zulp12x7{gap:var(--ds-space-075,6px)}
|
|
7
7
|
._zulp1b66{gap:var(--ds-space-050,4px)}
|
|
8
8
|
._189ee4h9{border-width:var(--ds-border-width,1px)}
|
|
9
|
-
._18zr1b66{padding-inline:var(--ds-space-050,4px)}
|
|
10
|
-
._18zrutpp{padding-inline:var(--ds-space-150,9pt)}
|
|
11
9
|
._1dqonqa1{border-style:solid}
|
|
12
10
|
._1h6d1j28{border-color:transparent}
|
|
13
|
-
._1h6dzs9d{border-color:color-mix(in oklch,var(--border-color) 100%,var(--cm-border-color) var(--cm-border-value))!important}
|
|
14
|
-
._1rjc1b66{padding-block:var(--ds-space-050,4px)}
|
|
15
|
-
._1rjcv77o{padding-block:var(--ds-space-025,2px)}._111i1h4e{--icon-pressed-l-factor:0.7}
|
|
11
|
+
._1h6dzs9d{border-color:color-mix(in oklch,var(--border-color) 100%,var(--cm-border-color) var(--cm-border-value))!important}._111i1h4e{--icon-pressed-l-factor:0.7}
|
|
16
12
|
._13muu67f{--cm-border-color:#fff}
|
|
13
|
+
._152tze3t{inset-block-start:var(--ds-space-0,0)}
|
|
17
14
|
._168qx19p{--cm-icon-value:20%}
|
|
18
15
|
._18dicjiy{--border-hovered-l-factor:1.2}
|
|
19
16
|
._18m915vq{overflow-y:hidden}
|
|
17
|
+
._1axm1bqy:active [data-lozenge-metric-wrapper]>span:first-of-type{background-color:var(--badge-background-color-pressed)}
|
|
20
18
|
._1b3i17hp{--icon-color:var(--ds-icon-accent-green,#22a06b)}
|
|
21
19
|
._1b3i1cv2{--icon-color:var(--ds-icon-subtlest,#6b6e76)}
|
|
22
20
|
._1b3i1diz{--icon-color:var(--ds-icon-accent-gray,#7d818a)}
|
|
@@ -33,14 +31,28 @@
|
|
|
33
31
|
._1b3iuq3u{--icon-color:var(--ds-icon-accent-purple,#af59e1)}
|
|
34
32
|
._1b3iv8hk{--icon-color:var(--ds-icon-accent-magenta,#cd519d)}
|
|
35
33
|
._1b3iyhbg{--icon-color:var(--ds-icon-information,#357de8)}
|
|
34
|
+
._1bah1h6o{justify-content:center}
|
|
35
|
+
._1bn814je{--badge-background-color:#b7b9be}
|
|
36
|
+
._1bn85usi{--badge-background-color:var(--ds-background-discovery-subtler-pressed,#d8a0f7)}
|
|
37
|
+
._1bn8ar1y{--badge-background-color:var(--ds-background-information-subtler-pressed,#8fb8f6)}
|
|
38
|
+
._1bn8bkku{--badge-background-color:var(--ds-background-warning-subtler-pressed,#fbc828)}
|
|
39
|
+
._1bn8d6jc{--badge-background-color:var(--ds-background-success-subtler-pressed,#b3df72)}
|
|
40
|
+
._1bn8jkmi{--badge-background-color:var(--ds-background-danger-subtler-pressed,#fd9891)}
|
|
41
|
+
._1bn8vuon{--badge-background-color:var(--ds-surface,#fff)}
|
|
36
42
|
._1bto1l2s{text-overflow:ellipsis}
|
|
37
43
|
._1cp21w66:hover>span:first-of-type>svg{color:color-mix(in oklch,var(--icon-color) 100%,var(--cm-icon-color) var(--cm-icon-hovered-value))}
|
|
44
|
+
._1e02ze3t{inset-inline-start:var(--ds-space-0,0)}
|
|
38
45
|
._1e0c116y{display:inline-flex}
|
|
46
|
+
._1e0c1txw{display:flex}
|
|
47
|
+
._1ftrbpke [data-lozenge-metric-wrapper]>span:first-of-type{background-color:var(--badge-background-color)}
|
|
39
48
|
._1gqs1mvc:active>span:first-of-type>svg{color:color-mix(in oklch,var(--icon-color) 100%,var(--cm-icon-color) var(--cm-icon-pressed-value))}
|
|
40
49
|
._1iel6xdd{--icon-hovered-l-factor:0.8}
|
|
41
50
|
._1k671038{--border-l-factor:1.33}
|
|
51
|
+
._1q511b66{padding-block-start:var(--ds-space-050,4px)}
|
|
52
|
+
._1q51v77o{padding-block-start:var(--ds-space-025,2px)}
|
|
42
53
|
._1reo15vq{overflow-x:hidden}
|
|
43
54
|
._1tkeviql{min-height:2rem}
|
|
55
|
+
._1xe213kw>span:first-of-type>svg{color:oklch(from var(--icon-color) calc(l * var(--icon-pressed-l-factor)) c h)!important}
|
|
44
56
|
._1xe213rw>span:first-of-type>svg{color:color-mix(in oklch,var(--icon-color) 100%,var(--cm-icon-color) var(--cm-icon-value))}
|
|
45
57
|
._3wu016y8{--border-color:var(--ds-border-accent-red,#e2483d)}
|
|
46
58
|
._3wu01b2s{--border-color:var(--ds-border-accent-orange,#e06c00)}
|
|
@@ -59,13 +71,20 @@
|
|
|
59
71
|
._3wu0v30g{--border-color:var(--ds-border-discovery,#af59e1)}
|
|
60
72
|
._3wu0vbh5{--border-color:var(--ds-border-information,#357de8)}
|
|
61
73
|
._46v5hwvj{--cm-icon-pressed-value:40%}
|
|
74
|
+
._4ayg18vq{--badge-background-color-pressed:var(--ds-background-discovery-pressed,#e3bdfa)}
|
|
75
|
+
._4ayg1c1j{--badge-background-color-pressed:var(--ds-background-information-pressed,#adcbfb)}
|
|
76
|
+
._4ayg1fkg{--badge-background-color-pressed:#dddee1}
|
|
77
|
+
._4ayg1r4b{--badge-background-color-pressed:var(--ds-background-danger-pressed,#ffb8b2)}
|
|
78
|
+
._4ayg1wl5{--badge-background-color-pressed:var(--ds-background-success-pressed,#bde97c)}
|
|
79
|
+
._4aygvuon{--badge-background-color-pressed:var(--ds-surface,#fff)}
|
|
80
|
+
._4aygzr32{--badge-background-color-pressed:var(--ds-background-warning-pressed,#fbd779)}
|
|
62
81
|
._4cvr1h6o{align-items:center}
|
|
63
82
|
._4t3i1k92{height:1.25rem}
|
|
64
83
|
._4uq11yqs{--icon-l-factor:0.88}
|
|
65
|
-
.
|
|
84
|
+
._85i51b66{padding-block-end:var(--ds-space-050,4px)}
|
|
85
|
+
._85i5v77o{padding-block-end:var(--ds-space-025,2px)}
|
|
66
86
|
._bfhk10f4{background-color:var(--ds-background-warning-subtler,#fce4a6)}
|
|
67
87
|
._bfhk14j0{background-color:var(--ds-background-success-subtler,#d3f1a7)}
|
|
68
|
-
._bfhk15s3{background-color:var(--ds-background-selected,#e9f2fe)}
|
|
69
88
|
._bfhk165s{background-color:var(--ds-background-accent-orange-subtler,#fce4a6)}
|
|
70
89
|
._bfhk1773{background-color:var(--ds-background-accent-yellow-subtler,#f5e989)}
|
|
71
90
|
._bfhk18wg{background-color:var(--ds-background-danger-subtler,#ffd5d2)}
|
|
@@ -81,12 +100,18 @@
|
|
|
81
100
|
._bfhkysee{background-color:var(--ds-background-accent-gray-subtlest,#f0f1f2)}
|
|
82
101
|
._bfhkz2ec{background-color:var(--ds-background-accent-lime-subtler,#d3f1a7)}
|
|
83
102
|
._bg3q9by0{--cm-border-pressed-value:10%}
|
|
103
|
+
._bozg1b66{padding-inline-start:var(--ds-space-050,4px)}
|
|
104
|
+
._bozgutpp{padding-inline-start:var(--ds-space-150,9pt)}
|
|
84
105
|
._fdt01r5k{--cm-icon-hovered-value:30%}
|
|
85
106
|
._hyog26zw{--border-pressed-l-factor:1.08}
|
|
86
107
|
._k48p1wq8{font-weight:var(--ds-font-weight-medium,500)}
|
|
108
|
+
._kqswh2mm{position:relative}
|
|
109
|
+
._kqswstnw{position:absolute}
|
|
110
|
+
._lcxvglyw{pointer-events:none}
|
|
87
111
|
._m71tr3uz{--cm-icon-color:#000}
|
|
88
112
|
._o5721q9c{white-space:nowrap}
|
|
89
113
|
._oe6mmko7{--cm-border-value:45%}
|
|
114
|
+
._rjxpze3t{inset-inline-end:var(--ds-space-0,0)}
|
|
90
115
|
._syaz12v7{color:var(--ds-text-accent-teal-bolder,#164555)}
|
|
91
116
|
._syaz1blx{color:var(--ds-text-danger-bolder,#5d1f1a)}
|
|
92
117
|
._syaz1g72{color:var(--ds-text-discovery-bolder,#48245d)}
|
|
@@ -104,8 +129,14 @@
|
|
|
104
129
|
._syazhwvp{color:var(--ds-text-accent-red-bolder,#5d1f1a)}
|
|
105
130
|
._syazi7uo{color:var(--ds-text,#292a2e)}
|
|
106
131
|
._syazmgs1{color:var(--ds-text-warning-bolder,#693200)}
|
|
132
|
+
._tzy4idpf{opacity:0}
|
|
133
|
+
._u7coze3t{inset-block-end:var(--ds-space-0,0)}
|
|
107
134
|
._vchhusvi{box-sizing:border-box}
|
|
135
|
+
._y4ti1b66{padding-inline-end:var(--ds-space-050,4px)}
|
|
136
|
+
._y4ti303w{padding-inline-end:.0625rem}
|
|
137
|
+
._y4tiutpp{padding-inline-end:var(--ds-space-150,9pt)}
|
|
108
138
|
._ylgq1r5k{--cm-border-hovered-value:30%}
|
|
139
|
+
[data-color-mode=dark] ._16burnys{--badge-background-color-pressed:#3d3f43}
|
|
109
140
|
[data-color-mode=dark] ._189qkb7n{--icon-l-factor:1}
|
|
110
141
|
[data-color-mode=dark] ._18mn783i{--icon-pressed-l-factor:1.37}
|
|
111
142
|
[data-color-mode=dark] ._196p1btq{--icon-hovered-l-factor:1.15}
|
|
@@ -113,14 +144,11 @@
|
|
|
113
144
|
[data-color-mode=dark] ._1t75u67f{--cm-icon-color:#fff}
|
|
114
145
|
[data-color-mode=dark] ._aewt1n8h{--cm-icon-pressed-value:70%}
|
|
115
146
|
[data-color-mode=dark] ._hg5mr3uz{--cm-border-color:#000}
|
|
147
|
+
[data-color-mode=dark] ._iymy8hz0{--badge-background-color:#4b4d51}
|
|
116
148
|
[data-color-mode=dark] ._l0666xdd{--border-hovered-l-factor:0.8}
|
|
117
149
|
[data-color-mode=dark] ._ockq1r5k{--cm-icon-hovered-value:30%}
|
|
118
150
|
[data-color-mode=dark] ._pclnn8xv{--border-pressed-l-factor:0.9}
|
|
119
151
|
[data-color-mode=dark] ._u8p61h4e{--border-l-factor:0.7}
|
|
120
|
-
._128mdkaa:focus-visible{outline-width:var(--ds-border-width-focused,2px)}
|
|
121
|
-
._1ah3v77o:focus-visible{outline-offset:var(--ds-space-025,2px)}
|
|
122
|
-
._mizu1v1w:focus-visible{outline-color:var(--ds-border-focused,#4688ec)}
|
|
123
|
-
._ra3xnqa1:focus-visible{outline-style:solid}
|
|
124
152
|
._4cvx7ddx:hover{border-color:color-mix(in oklch,var(--border-color) 100%,var(--cm-border-color) var(--cm-border-hovered-value))!important}
|
|
125
153
|
._irr315aw:hover{background-color:var(--ds-background-information-subtler-hovered,#adcbfb)}
|
|
126
154
|
._irr31axx:hover{background-color:var(--ds-background-accent-magenta-subtler-hovered,#fcb6e1)}
|
|
@@ -137,7 +165,6 @@
|
|
|
137
165
|
._irr3kwwr:hover{background-color:var(--ds-background-accent-teal-subtler-hovered,#b1e4f7)}
|
|
138
166
|
._irr3plhp:hover{background-color:var(--ds-background-neutral-hovered,#0b120e24)}
|
|
139
167
|
._irr3rumk:hover{background-color:var(--ds-background-discovery-subtler-hovered,#e3bdfa)}
|
|
140
|
-
._irr3ufnl:hover{background-color:var(--ds-background-selected-hovered,#cfe1fd)}
|
|
141
168
|
._irr3wejn:hover{background-color:var(--ds-background-accent-gray-subtlest-hovered,#dddee1)}
|
|
142
169
|
._q4zt1csi:active{border-color:color-mix(in oklch,var(--border-color) 100%,var(--cm-border-color) var(--cm-border-pressed-value))!important}
|
|
143
170
|
._1di618ut:active{background-color:var(--ds-background-accent-gray-subtlest-pressed,#b7b9be)}
|
|
@@ -154,7 +181,6 @@
|
|
|
154
181
|
._1di6d6jc:active{background-color:var(--ds-background-success-subtler-pressed,#b3df72)}
|
|
155
182
|
._1di6dpo3:active{background-color:var(--ds-background-accent-orange-subtler-pressed,#fbc828)}
|
|
156
183
|
._1di6jkmi:active{background-color:var(--ds-background-danger-subtler-pressed,#fd9891)}
|
|
157
|
-
._1di6nozp:active{background-color:var(--ds-background-selected-pressed,#8fb8f6)}
|
|
158
184
|
._1di6rwxf:active{background-color:var(--ds-background-accent-blue-subtler-pressed,#8fb8f6)}
|
|
159
185
|
._1di6ybhx:active{background-color:var(--ds-background-accent-green-subtler-pressed,#7ee2b8)}
|
|
160
186
|
@supports (color:oklch(from white l c h)){._1easxmrh{border-color:oklch(from var(--border-color) calc(l * var(--border-l-factor)) c h)!important}._1r9r1ss3>span:first-of-type>svg{color:oklch(from var(--icon-color) calc(l * var(--icon-l-factor)) c h)}._1lh71sfd:hover>span:first-of-type>svg{color:oklch(from var(--icon-color) calc(l * var(--icon-hovered-l-factor)) c h)}._11o31cha:active>span:first-of-type>svg{color:oklch(from var(--icon-color) calc(l * var(--icon-pressed-l-factor)) c h)}._75gv2l9f:hover{border-color:oklch(from var(--border-color) calc(l * var(--border-hovered-l-factor)) c h)!important}._ui3h1ct7:active{border-color:oklch(from var(--border-color) calc(l * var(--border-pressed-l-factor)) c h)!important}}
|
|
@@ -1,24 +1,54 @@
|
|
|
1
1
|
/* lozenge-base.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
4
|
import "./lozenge-base.compiled.css";
|
|
4
5
|
import * as React from 'react';
|
|
5
6
|
import { ax, ix } from "@compiled/react/runtime";
|
|
6
7
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
8
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
|
-
import { forwardRef,
|
|
9
|
+
import { forwardRef, memo } from 'react';
|
|
10
|
+
import Badge from '@atlaskit/badge';
|
|
9
11
|
import { cx } from '@atlaskit/css';
|
|
10
12
|
import ChevronDownIcon from '@atlaskit/icon/core/chevron-down';
|
|
11
13
|
import Pressable from '@atlaskit/primitives/pressable';
|
|
14
|
+
import Spinner from '@atlaskit/spinner';
|
|
12
15
|
import IconRenderer from './icon-renderer';
|
|
13
16
|
import { getThemeStyles, resolveLozengeColor } from './utils';
|
|
17
|
+
// Get the pressed background color for the selected lozenge dropdown trigger
|
|
18
|
+
var pressedBackgroundMapping = {
|
|
19
|
+
success: "var(--ds-background-success-subtler-pressed, #B3DF72)",
|
|
20
|
+
warning: "var(--ds-background-warning-subtler-pressed, #FBC828)",
|
|
21
|
+
danger: "var(--ds-background-danger-subtler-pressed, #FD9891)",
|
|
22
|
+
information: "var(--ds-background-information-subtler-pressed, #8FB8F6)",
|
|
23
|
+
neutral: "var(--ds-background-neutral-pressed, #080F214A)",
|
|
24
|
+
discovery: "var(--ds-background-discovery-subtler-pressed, #D8A0F7)",
|
|
25
|
+
'accent-red': "var(--ds-background-accent-red-subtler-pressed, #FD9891)",
|
|
26
|
+
'accent-orange': "var(--ds-background-accent-orange-subtler-pressed, #FBC828)",
|
|
27
|
+
'accent-yellow': "var(--ds-background-accent-yellow-subtler-pressed, #EED12B)",
|
|
28
|
+
'accent-lime': "var(--ds-background-accent-lime-subtler-pressed, #B3DF72)",
|
|
29
|
+
'accent-green': "var(--ds-background-accent-green-subtler-pressed, #7EE2B8)",
|
|
30
|
+
'accent-teal': "var(--ds-background-accent-teal-subtler-pressed, #9DD9EE)",
|
|
31
|
+
'accent-blue': "var(--ds-background-accent-blue-subtler-pressed, #8FB8F6)",
|
|
32
|
+
'accent-purple': "var(--ds-background-accent-purple-subtler-pressed, #D8A0F7)",
|
|
33
|
+
'accent-magenta': "var(--ds-background-accent-magenta-subtler-pressed, #F797D2)",
|
|
34
|
+
'accent-gray': "var(--ds-background-accent-gray-subtlest-pressed, #B7B9BE)"
|
|
35
|
+
};
|
|
14
36
|
var styles = {
|
|
15
|
-
container: "_2rko12b0 _1reo15vq _18m915vq
|
|
16
|
-
containerSpacious: "_2rko1qi0
|
|
17
|
-
|
|
18
|
-
containerSelected: "_bfhk15s3 _syaz6x5g _irr3ufnl _1di6nozp",
|
|
37
|
+
container: "_2rko12b0 _1reo15vq _18m915vq _189ee4h9 _1dqonqa1 _1h6d1j28 _kqswh2mm _1e0c116y _4cvr1h6o _vchhusvi _4t3i1k92 _1q51v77o _85i5v77o _bozg1b66 _y4ti1b66",
|
|
38
|
+
containerSpacious: "_2rko1qi0 _1tkeviql _1q511b66 _85i51b66 _bozgutpp _y4tiutpp",
|
|
39
|
+
containerBadgePadding: "_y4ti303w",
|
|
19
40
|
text: "_11c8wadc _1reo15vq _18m915vq _1bto1l2s _o5721q9c",
|
|
20
41
|
textSpacious: "_11c8fhey _k48p1wq8",
|
|
21
42
|
textSelected: "_syaz6x5g",
|
|
43
|
+
loadingOverlay: "_1reo15vq _18m915vq _1e0c1txw _kqswstnw _4cvr1h6o _1bah1h6o _u7coze3t _152tze3t _rjxpze3t _1e02ze3t _lcxvglyw",
|
|
44
|
+
metricBadgeWrapper: "_1e0c1txw",
|
|
45
|
+
'metric.semantic.success': "_1bn8d6jc _4ayg1wl5",
|
|
46
|
+
'metric.semantic.warning': "_1bn8bkku _4aygzr32",
|
|
47
|
+
'metric.semantic.danger': "_1bn8jkmi _4ayg1r4b",
|
|
48
|
+
'metric.semantic.information': "_1bn8ar1y _4ayg1c1j",
|
|
49
|
+
'metric.semantic.neutral': "_1bn814je _4ayg1fkg _iymy8hz0 _16burnys",
|
|
50
|
+
'metric.semantic.discovery': "_1bn85usi _4ayg18vq",
|
|
51
|
+
'metric.inverse': "_1bn8vuon _4aygvuon",
|
|
22
52
|
'semantic.success': "_1b3i4pcx _3wu01mps _bfhk14j0 _syaz1p1e",
|
|
23
53
|
'semantic.warning': "_1b3iervl _3wu01xiv _bfhk10f4 _syazmgs1",
|
|
24
54
|
'semantic.danger': "_1b3is4qr _3wu01bqt _bfhk18wg _syaz1blx",
|
|
@@ -51,9 +81,14 @@ var styles = {
|
|
|
51
81
|
'interactive.accent.purple': "_irr3attl _1di63nfk",
|
|
52
82
|
'interactive.accent.magenta': "_irr31axx _1di642ri",
|
|
53
83
|
'interactive.accent.gray': "_irr3wejn _1di618ut",
|
|
54
|
-
selectedInteractive: "_irr3ufnl _1di6nozp",
|
|
55
84
|
iconBorderFilter: "_1h6dzs9d _4uq11yqs _1k671038 _m71tr3uz _13muu67f _168qx19p _oe6mmko7 _189qkb7n _u8p61h4e _1t75u67f _hg5mr3uz _1f28f1ug _1xe213rw _1easxmrh _1r9r1ss3",
|
|
56
|
-
iconBorderInteractiveFilter: "_1iel6xdd _111i1h4e _18dicjiy _hyog26zw _fdt01r5k _46v5hwvj _ylgq1r5k _bg3q9by0 _196p1btq _18mn783i _l0666xdd _pclnn8xv _ockq1r5k _aewt1n8h _4cvx7ddx _1cp21w66 _q4zt1csi _1gqs1mvc _75gv2l9f _1lh71sfd _ui3h1ct7 _11o31cha"
|
|
85
|
+
iconBorderInteractiveFilter: "_1iel6xdd _111i1h4e _18dicjiy _hyog26zw _fdt01r5k _46v5hwvj _ylgq1r5k _bg3q9by0 _196p1btq _18mn783i _l0666xdd _pclnn8xv _ockq1r5k _aewt1n8h _4cvx7ddx _1cp21w66 _q4zt1csi _1gqs1mvc _75gv2l9f _1lh71sfd _ui3h1ct7 _11o31cha",
|
|
86
|
+
containerSelected: "_1xe213kw",
|
|
87
|
+
content: "_zulp1b66 _1e0c116y _4cvr1h6o",
|
|
88
|
+
contentSpacious: "_zulp12x7",
|
|
89
|
+
loadingContent: "_tzy4idpf",
|
|
90
|
+
containerBadge: "_1ftrbpke",
|
|
91
|
+
containerBadgeInteractive: "_1axm1bqy"
|
|
57
92
|
};
|
|
58
93
|
|
|
59
94
|
/**
|
|
@@ -67,11 +102,15 @@ var LozengeBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref, ref
|
|
|
67
102
|
testId = _ref.testId,
|
|
68
103
|
appearance = _ref.appearance,
|
|
69
104
|
iconBefore = _ref.iconBefore,
|
|
105
|
+
trailingMetric = _ref.trailingMetric,
|
|
106
|
+
trailingMetricAppearance = _ref.trailingMetricAppearance,
|
|
70
107
|
_ref$maxWidth = _ref.maxWidth,
|
|
71
108
|
maxWidth = _ref$maxWidth === void 0 ? 200 : _ref$maxWidth,
|
|
72
109
|
_ref$spacing = _ref.spacing,
|
|
73
110
|
spacing = _ref$spacing === void 0 ? 'default' : _ref$spacing,
|
|
74
111
|
isSelected = _ref.isSelected,
|
|
112
|
+
_ref$isLoading = _ref.isLoading,
|
|
113
|
+
isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
|
|
75
114
|
onClick = _ref.onClick,
|
|
76
115
|
style = _ref.style,
|
|
77
116
|
analyticsContext = _ref.analyticsContext,
|
|
@@ -87,15 +126,20 @@ var LozengeBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref, ref
|
|
|
87
126
|
var interactiveStyleKey = "interactive.".concat(category, ".").concat(key);
|
|
88
127
|
var maxWidthValue = typeof maxWidth === 'string' ? maxWidth : "".concat(maxWidth, "px");
|
|
89
128
|
var maxWidthIsPc = typeof maxWidth === 'string' && /%$/.test(maxWidth);
|
|
129
|
+
var resolvedTrailingMetricAppearance = trailingMetricAppearance ? trailingMetricAppearance === 'inverse' ? 'inverse' : resolveLozengeColor(trailingMetricAppearance) : resolvedColor;
|
|
130
|
+
var metricBadgeAppearance = resolvedTrailingMetricAppearance === 'inverse' ? 'inverse' : resolvedTrailingMetricAppearance != null && resolvedTrailingMetricAppearance.startsWith('accent-') ? 'neutral' : resolvedTrailingMetricAppearance !== null && resolvedTrailingMetricAppearance !== void 0 ? resolvedTrailingMetricAppearance : 'neutral';
|
|
131
|
+
var metricStyleKey = resolvedTrailingMetricAppearance === 'inverse' ? 'metric.inverse' : resolvedTrailingMetricAppearance != null && !resolvedTrailingMetricAppearance.startsWith('accent-') ? "metric.semantic.".concat(getThemeStyles(resolvedTrailingMetricAppearance).key) : 'metric.semantic.neutral';
|
|
90
132
|
var commonStyleOverrides = {
|
|
91
133
|
backgroundColor: style === null || style === void 0 ? void 0 : style.backgroundColor,
|
|
92
134
|
maxWidth: maxWidthIsPc ? maxWidth : '100%'
|
|
93
135
|
};
|
|
94
|
-
var
|
|
136
|
+
var hasTrailingMetric = trailingMetric != null && trailingMetric !== '';
|
|
137
|
+
var innerContent = /*#__PURE__*/React.createElement("span", {
|
|
138
|
+
className: ax([styles.content, spacing === 'spacious' && styles.contentSpacious, isLoading && styles.loadingContent])
|
|
139
|
+
}, iconBefore && /*#__PURE__*/React.createElement(IconRenderer, {
|
|
95
140
|
size: spacing === 'spacious' ? 'medium' : 'small',
|
|
96
141
|
icon: iconBefore,
|
|
97
142
|
color: resolvedColor,
|
|
98
|
-
isSelected: isInteractive ? isSelected : undefined,
|
|
99
143
|
testId: testId && "".concat(testId, "--icon")
|
|
100
144
|
}), /*#__PURE__*/React.createElement("span", {
|
|
101
145
|
style: {
|
|
@@ -104,33 +148,53 @@ var LozengeBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref, ref
|
|
|
104
148
|
},
|
|
105
149
|
"data-testid": testId && "".concat(testId, "--text"),
|
|
106
150
|
className: ax([styles.text, spacing === 'spacious' && styles.textSpacious])
|
|
107
|
-
}, children),
|
|
151
|
+
}, children), hasTrailingMetric && !resolvedColor.startsWith('accent-') && /*#__PURE__*/React.createElement("span", {
|
|
152
|
+
"data-lozenge-metric-wrapper": true,
|
|
153
|
+
"data-testid": testId && "".concat(testId, "--metric"),
|
|
154
|
+
className: ax([styles.metricBadgeWrapper])
|
|
155
|
+
}, /*#__PURE__*/React.createElement(Badge, {
|
|
156
|
+
appearance: metricBadgeAppearance
|
|
157
|
+
}, trailingMetric)), isInteractive && /*#__PURE__*/React.createElement(ChevronDownIcon, {
|
|
108
158
|
label: "",
|
|
109
159
|
size: "small",
|
|
110
|
-
color:
|
|
160
|
+
color: 'currentColor',
|
|
111
161
|
testId: testId && "".concat(testId, "--chevron")
|
|
112
162
|
}));
|
|
113
163
|
if (isInteractive) {
|
|
114
|
-
return /*#__PURE__*/React.createElement(Pressable, {
|
|
164
|
+
return /*#__PURE__*/React.createElement(Pressable, _extends({
|
|
115
165
|
ref: ref,
|
|
116
|
-
xcss: cx(styles.container, spacing === 'spacious' && styles.containerSpacious, !isSelected && styles.iconBorderFilter, !
|
|
117
|
-
|
|
166
|
+
xcss: cx(styles.container, spacing === 'spacious' && styles.containerSpacious, !isSelected && styles.iconBorderFilter, !isLoading && styles.iconBorderInteractiveFilter, styles[colorStyleKey], !isLoading && styles[interactiveStyleKey], isSelected && styles.containerSelected, hasTrailingMetric && styles.containerBadge, hasTrailingMetric && styles.containerBadgeInteractive, hasTrailingMetric && styles[metricStyleKey])
|
|
167
|
+
}, isLoading && {
|
|
168
|
+
'aria-busy': true,
|
|
169
|
+
'aria-disabled': true,
|
|
170
|
+
isDisabled: true
|
|
171
|
+
}, {
|
|
172
|
+
"aria-label": isLoading ? 'Loading' : undefined,
|
|
173
|
+
onClick: isLoading ? undefined : onClick,
|
|
118
174
|
style: _objectSpread(_objectSpread({}, commonStyleOverrides), {}, {
|
|
119
175
|
// Specified because Pressable has a default border:none which overrides the border specified on the container
|
|
120
176
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
121
|
-
border: "solid ".concat("var(--ds-border-width, 1px)", " ", isSelected ?
|
|
177
|
+
border: "solid ".concat("var(--ds-border-width, 1px)", " ", isSelected ? 'oklch(from var(--border-color) calc(l * var(--border-pressed-l-factor)) c h) !important' : 'transparent'),
|
|
178
|
+
backgroundColor: isSelected ? pressedBackgroundMapping[resolvedColor] : undefined,
|
|
179
|
+
cursor: isLoading ? 'progress' : 'pointer'
|
|
122
180
|
}),
|
|
123
181
|
testId: testId,
|
|
124
182
|
analyticsContext: analyticsContext,
|
|
125
183
|
interactionName: interactionName,
|
|
126
184
|
componentName: "LozengeDropdownTrigger"
|
|
127
|
-
}, innerContent
|
|
185
|
+
}), innerContent, isLoading && /*#__PURE__*/React.createElement("span", {
|
|
186
|
+
className: ax([styles.loadingOverlay])
|
|
187
|
+
}, /*#__PURE__*/React.createElement(Spinner, {
|
|
188
|
+
size: spacing === 'spacious' ? 'small' : 'xsmall',
|
|
189
|
+
label: ", Loading",
|
|
190
|
+
testId: testId ? "".concat(testId, "--loading-spinner") : undefined
|
|
191
|
+
})));
|
|
128
192
|
}
|
|
129
193
|
return /*#__PURE__*/React.createElement("span", {
|
|
130
194
|
ref: ref,
|
|
131
195
|
style: commonStyleOverrides,
|
|
132
196
|
"data-testid": testId,
|
|
133
|
-
className: ax([styles.container, spacing === 'spacious' && styles.containerSpacious, styles[colorStyleKey], styles.iconBorderFilter])
|
|
197
|
+
className: ax([styles.container, spacing === 'spacious' && styles.containerSpacious, spacing !== 'spacious' && hasTrailingMetric && styles.containerBadgePadding, styles[colorStyleKey], hasTrailingMetric && styles[metricStyleKey], styles.iconBorderFilter, styles.containerBadge])
|
|
134
198
|
}, innerContent);
|
|
135
199
|
}));
|
|
136
200
|
export default LozengeBase;
|