@atlaskit/flag 14.5.1 → 14.5.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 +10 -0
- package/__perf__/withFlagGroup.tsx +1 -1
- package/dist/cjs/auto-dismiss-flag.js +4 -4
- package/dist/cjs/flag-actions.js +50 -6
- package/dist/cjs/flag-group.js +56 -18
- package/dist/cjs/flag.js +83 -106
- package/dist/cjs/internal/description.js +32 -0
- package/dist/cjs/internal/dismiss-button.js +83 -0
- package/dist/cjs/{expander.js → internal/expander.js} +15 -7
- package/dist/cjs/internal/index.js +39 -0
- package/dist/cjs/internal/title.js +32 -0
- package/dist/cjs/theme.js +61 -61
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/auto-dismiss-flag.js +2 -3
- package/dist/es2019/flag-actions.js +50 -32
- package/dist/es2019/flag-group.js +48 -65
- package/dist/es2019/flag.js +77 -164
- package/dist/es2019/internal/description.js +22 -0
- package/dist/es2019/internal/dismiss-button.js +63 -0
- package/dist/es2019/{expander.js → internal/expander.js} +14 -10
- package/dist/es2019/internal/index.js +4 -0
- package/dist/es2019/internal/title.js +22 -0
- package/dist/es2019/theme.js +61 -61
- package/dist/es2019/version.json +1 -1
- package/dist/esm/auto-dismiss-flag.js +2 -3
- package/dist/esm/flag-actions.js +49 -6
- package/dist/esm/flag-group.js +52 -16
- package/dist/esm/flag.js +79 -101
- package/dist/esm/internal/description.js +23 -0
- package/dist/esm/internal/dismiss-button.js +63 -0
- package/dist/esm/{expander.js → internal/expander.js} +14 -5
- package/dist/esm/internal/index.js +4 -0
- package/dist/esm/internal/title.js +23 -0
- package/dist/esm/theme.js +61 -61
- package/dist/esm/version.json +1 -1
- package/dist/types/flag-actions.d.ts +4 -4
- package/dist/types/flag-group.d.ts +2 -2
- package/dist/types/flag.d.ts +1 -1
- package/dist/types/internal/description.d.ts +7 -0
- package/dist/types/internal/dismiss-button.d.ts +11 -0
- package/dist/types/internal/expander.d.ts +8 -0
- package/dist/types/internal/index.d.ts +4 -0
- package/dist/types/internal/title.d.ts +6 -0
- package/dist/types/theme.d.ts +1 -1
- package/package.json +7 -3
- package/dist/types/expander.d.ts +0 -9
- package/expander/package.json +0 -7
package/dist/es2019/flag.js
CHANGED
|
@@ -3,28 +3,41 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
4
|
import { useCallback, useEffect, useState } from 'react';
|
|
5
5
|
import { css, jsx } from '@emotion/core';
|
|
6
|
-
import
|
|
7
|
-
import ChevronUpIcon from '@atlaskit/icon/glyph/chevron-up';
|
|
8
|
-
import CrossIcon from '@atlaskit/icon/glyph/cross';
|
|
9
|
-
import GlobalTheme from '@atlaskit/theme/components';
|
|
6
|
+
import { useGlobalTheme } from '@atlaskit/theme/components';
|
|
10
7
|
import { borderRadius, gridSize as getGridSize, layers } from '@atlaskit/theme/constants';
|
|
11
8
|
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatformLeafEventHandler';
|
|
9
|
+
import noop from '@atlaskit/ds-lib/noop';
|
|
10
|
+
import FocusRing from '@atlaskit/focus-ring';
|
|
12
11
|
import { DEFAULT_APPEARANCE } from './constants';
|
|
13
|
-
import { flagBorderColor, flagShadowColor, getFlagBackgroundColor,
|
|
14
|
-
import Expander from './expander';
|
|
12
|
+
import { flagBorderColor, flagShadowColor, getFlagBackgroundColor, getFlagTextColor, getFlagIconColor } from './theme';
|
|
15
13
|
import Actions from './flag-actions';
|
|
16
14
|
import { useFlagGroup } from './flag-group';
|
|
17
|
-
|
|
18
|
-
function noop() {}
|
|
19
|
-
|
|
15
|
+
import { Title, Description, Expander, DismissButton } from './internal';
|
|
20
16
|
const analyticsAttributes = {
|
|
21
17
|
componentName: 'flag',
|
|
22
18
|
packageName: "@atlaskit/flag",
|
|
23
|
-
packageVersion: "14.5.
|
|
19
|
+
packageVersion: "14.5.2"
|
|
24
20
|
};
|
|
25
21
|
const gridSize = getGridSize();
|
|
26
22
|
const doubleGridSize = gridSize * 2;
|
|
27
23
|
const headerHeight = gridSize * 4;
|
|
24
|
+
const iconStyles = css({
|
|
25
|
+
display: 'flex',
|
|
26
|
+
height: headerHeight,
|
|
27
|
+
alignItems: 'center'
|
|
28
|
+
});
|
|
29
|
+
const flagHeaderStyles = css({
|
|
30
|
+
boxSizing: 'border-box',
|
|
31
|
+
width: '100%',
|
|
32
|
+
padding: doubleGridSize,
|
|
33
|
+
borderRadius: borderRadius()
|
|
34
|
+
});
|
|
35
|
+
const flagContainerStyles = css({
|
|
36
|
+
width: '100%',
|
|
37
|
+
zIndex: layers.flag(),
|
|
38
|
+
borderRadius: borderRadius(),
|
|
39
|
+
transition: 'background-color 200ms'
|
|
40
|
+
});
|
|
28
41
|
|
|
29
42
|
const Flag = props => {
|
|
30
43
|
const {
|
|
@@ -59,74 +72,14 @@ const Flag = props => {
|
|
|
59
72
|
...analyticsAttributes
|
|
60
73
|
});
|
|
61
74
|
const isBold = appearance !== DEFAULT_APPEARANCE;
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
})
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
if (!isBold && !isDismissAllowed) {
|
|
69
|
-
return null;
|
|
70
|
-
} // If it is bold then ensure there is a description or actions to render
|
|
71
|
-
// the toggle button
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
if (isBold && !description && !actions.length) {
|
|
75
|
-
return null;
|
|
75
|
+
const toggleExpand = useCallback(() => {
|
|
76
|
+
setIsExpanded(previous => !previous);
|
|
77
|
+
}, []);
|
|
78
|
+
const buttonActionCallback = useCallback(() => {
|
|
79
|
+
if (isDismissAllowed) {
|
|
80
|
+
onDismissedAnalytics(id);
|
|
76
81
|
}
|
|
77
|
-
|
|
78
|
-
let ButtonIcon = CrossIcon;
|
|
79
|
-
let buttonLabel = 'Dismiss';
|
|
80
|
-
|
|
81
|
-
let buttonAction = () => {
|
|
82
|
-
if (isDismissAllowed) {
|
|
83
|
-
onDismissedAnalytics(id);
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
let size = 'small';
|
|
88
|
-
let buttonTestId = testId && `${testId}-dismiss`;
|
|
89
|
-
let a11yProps = {};
|
|
90
|
-
|
|
91
|
-
if (isBold) {
|
|
92
|
-
ButtonIcon = isExpanded ? ChevronUpIcon : ChevronDownIcon;
|
|
93
|
-
buttonLabel = isExpanded ? 'Collapse' : 'Expand';
|
|
94
|
-
|
|
95
|
-
buttonAction = () => setIsExpanded(!isExpanded);
|
|
96
|
-
|
|
97
|
-
size = 'large';
|
|
98
|
-
buttonTestId = testId && `${testId}-toggle`;
|
|
99
|
-
a11yProps = {
|
|
100
|
-
'aria-expanded': isExpanded
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
return jsx("button", _extends({
|
|
105
|
-
css: css`
|
|
106
|
-
appearance: none;
|
|
107
|
-
background: none;
|
|
108
|
-
border: none;
|
|
109
|
-
border-radius: ${borderRadius()}px;
|
|
110
|
-
color: ${getFlagTextColor(appearance, mode)};
|
|
111
|
-
cursor: pointer;
|
|
112
|
-
flex: 0 0 auto;
|
|
113
|
-
line-height: 1;
|
|
114
|
-
margin-left: ${gridSize}px;
|
|
115
|
-
padding: 0;
|
|
116
|
-
white-space: nowrap;
|
|
117
|
-
&:focus {
|
|
118
|
-
outline: none;
|
|
119
|
-
box-shadow: 0 0 0 2px ${getFlagFocusRingColor(appearance, mode)};
|
|
120
|
-
}
|
|
121
|
-
`,
|
|
122
|
-
onClick: buttonAction,
|
|
123
|
-
"data-testid": buttonTestId,
|
|
124
|
-
type: "button"
|
|
125
|
-
}, a11yProps), jsx(ButtonIcon, {
|
|
126
|
-
label: buttonLabel,
|
|
127
|
-
size: size
|
|
128
|
-
}));
|
|
129
|
-
}, [actions.length, appearance, description, id, isBold, isDismissAllowed, isExpanded, onDismissedAnalytics, testId]);
|
|
82
|
+
}, [onDismissedAnalytics, id, isDismissAllowed]);
|
|
130
83
|
useEffect(() => {
|
|
131
84
|
// If buttons are removed as a prop, update isExpanded to be false
|
|
132
85
|
if (isBold && isExpanded && !description && !actions.length) {
|
|
@@ -151,97 +104,57 @@ const Flag = props => {
|
|
|
151
104
|
onMouseOut,
|
|
152
105
|
onBlur: onBlurAnalytics
|
|
153
106
|
};
|
|
154
|
-
|
|
155
|
-
let boxShadow = `var(--ds-overlay, ${`0 20px 32px -8px ${flagShadowColor}`})`;
|
|
107
|
+
let boxShadow = `var(--ds-shadow-overlay, ${`0 20px 32px -8px ${flagShadowColor}`})`;
|
|
156
108
|
|
|
157
109
|
if (!isBold) {
|
|
158
|
-
boxShadow = `var(--ds-overlay, ${`0 0 1px ${flagBorderColor}, ${boxShadow}`})`;
|
|
110
|
+
boxShadow = `var(--ds-shadow-overlay, ${`0 0 1px ${flagBorderColor}, ${boxShadow}`})`;
|
|
159
111
|
}
|
|
160
112
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
tabIndex: 0
|
|
207
|
-
}, jsx("div", {
|
|
208
|
-
css: css`
|
|
209
|
-
color: ${iconColour};
|
|
210
|
-
display: flex;
|
|
211
|
-
align-items: center;
|
|
212
|
-
height: ${headerHeight}px;
|
|
213
|
-
`
|
|
214
|
-
}, icon, jsx("span", {
|
|
215
|
-
css: css`
|
|
216
|
-
color: ${textColour};
|
|
217
|
-
font-weight: 600;
|
|
218
|
-
flex: 1;
|
|
219
|
-
overflow: hidden;
|
|
220
|
-
text-overflow: ellipsis;
|
|
221
|
-
white-space: nowrap;
|
|
222
|
-
padding: 0 0 0 ${doubleGridSize}px;
|
|
223
|
-
`
|
|
224
|
-
}, title), jsx(OptionalDismissButton, {
|
|
225
|
-
mode: mode
|
|
226
|
-
})), jsx(Expander, {
|
|
227
|
-
isExpanded: !isBold || isExpanded,
|
|
228
|
-
testId: testId
|
|
229
|
-
}, description && jsx("div", {
|
|
230
|
-
css: css`
|
|
231
|
-
color: ${textColour};
|
|
232
|
-
word-wrap: break-word;
|
|
233
|
-
overflow: auto;
|
|
234
|
-
max-height: 100px; /* height is defined as 5 lines maximum by design */
|
|
235
|
-
`,
|
|
236
|
-
"data-testid": testId && `${testId}-description`
|
|
237
|
-
}, description), jsx(Actions, {
|
|
238
|
-
actions: actions,
|
|
239
|
-
appearance: appearance,
|
|
240
|
-
linkComponent: linkComponent,
|
|
241
|
-
testId: testId,
|
|
242
|
-
mode: mode
|
|
243
|
-
}))));
|
|
244
|
-
});
|
|
113
|
+
const {
|
|
114
|
+
mode
|
|
115
|
+
} = useGlobalTheme();
|
|
116
|
+
const textColor = getFlagTextColor(appearance, mode);
|
|
117
|
+
const iconColor = getFlagIconColor(appearance, mode);
|
|
118
|
+
const isDismissable = isBold || isDismissAllowed;
|
|
119
|
+
return jsx("div", _extends({
|
|
120
|
+
style: {
|
|
121
|
+
color: textColor,
|
|
122
|
+
backgroundColor: getFlagBackgroundColor(appearance, mode),
|
|
123
|
+
boxShadow
|
|
124
|
+
},
|
|
125
|
+
css: flagContainerStyles,
|
|
126
|
+
role: "alert",
|
|
127
|
+
"data-testid": testId
|
|
128
|
+
}, autoDismissProps), jsx(FocusRing, null, jsx("div", {
|
|
129
|
+
css: flagHeaderStyles // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
|
|
130
|
+
,
|
|
131
|
+
tabIndex: 0
|
|
132
|
+
}, jsx("div", {
|
|
133
|
+
style: {
|
|
134
|
+
color: iconColor
|
|
135
|
+
},
|
|
136
|
+
css: iconStyles
|
|
137
|
+
}, icon, jsx(Title, {
|
|
138
|
+
color: textColor
|
|
139
|
+
}, title), isDismissable ? !(isBold && !description && !actions.length) && jsx(DismissButton, {
|
|
140
|
+
testId: testId,
|
|
141
|
+
appearance: appearance,
|
|
142
|
+
isBold: isBold,
|
|
143
|
+
isExpanded: isExpanded,
|
|
144
|
+
onClick: isBold ? toggleExpand : buttonActionCallback
|
|
145
|
+
}) : null), jsx(Expander, {
|
|
146
|
+
isExpanded: !isBold || isExpanded,
|
|
147
|
+
testId: testId
|
|
148
|
+
}, description && jsx(Description, {
|
|
149
|
+
testId: testId && `${testId}-description`,
|
|
150
|
+
color: textColor
|
|
151
|
+
}, description), jsx(Actions, {
|
|
152
|
+
actions: actions,
|
|
153
|
+
appearance: appearance,
|
|
154
|
+
linkComponent: linkComponent,
|
|
155
|
+
testId: testId,
|
|
156
|
+
mode: mode
|
|
157
|
+
})))));
|
|
245
158
|
};
|
|
246
159
|
|
|
247
160
|
export default Flag;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx, css } from '@emotion/core';
|
|
3
|
+
const descriptionStyles = css({
|
|
4
|
+
/* height is defined as 5 lines maximum by design */
|
|
5
|
+
maxHeight: 100,
|
|
6
|
+
overflow: 'auto',
|
|
7
|
+
wordWrap: 'break-word'
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
const Description = ({
|
|
11
|
+
color,
|
|
12
|
+
testId,
|
|
13
|
+
children
|
|
14
|
+
}) => jsx("div", {
|
|
15
|
+
style: {
|
|
16
|
+
color
|
|
17
|
+
},
|
|
18
|
+
css: descriptionStyles,
|
|
19
|
+
"data-testid": testId
|
|
20
|
+
}, children);
|
|
21
|
+
|
|
22
|
+
export default Description;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
import { jsx, css } from '@emotion/core';
|
|
4
|
+
import FocusRing from '@atlaskit/focus-ring';
|
|
5
|
+
import ChevronDownIcon from '@atlaskit/icon/glyph/chevron-down';
|
|
6
|
+
import ChevronUpIcon from '@atlaskit/icon/glyph/chevron-up';
|
|
7
|
+
import CrossIcon from '@atlaskit/icon/glyph/cross';
|
|
8
|
+
import { borderRadius as getBorderRadius, gridSize as getGridSize } from '@atlaskit/theme/constants';
|
|
9
|
+
import { useGlobalTheme } from '@atlaskit/theme/components';
|
|
10
|
+
import { getFlagTextColor } from '../theme';
|
|
11
|
+
const gridSize = getGridSize();
|
|
12
|
+
const borderRadius = getBorderRadius();
|
|
13
|
+
const dismissButtonStyles = css({
|
|
14
|
+
marginLeft: gridSize,
|
|
15
|
+
padding: 0,
|
|
16
|
+
flex: '0 0 auto',
|
|
17
|
+
appearance: 'none',
|
|
18
|
+
background: 'none',
|
|
19
|
+
border: 'none',
|
|
20
|
+
borderRadius,
|
|
21
|
+
cursor: 'pointer',
|
|
22
|
+
lineHeight: '1',
|
|
23
|
+
whiteSpace: 'nowrap'
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const DismissButton = ({
|
|
27
|
+
appearance,
|
|
28
|
+
onClick,
|
|
29
|
+
isBold,
|
|
30
|
+
isExpanded,
|
|
31
|
+
testId
|
|
32
|
+
}) => {
|
|
33
|
+
const {
|
|
34
|
+
mode
|
|
35
|
+
} = useGlobalTheme();
|
|
36
|
+
let ButtonIcon = CrossIcon;
|
|
37
|
+
let buttonLabel = 'Dismiss';
|
|
38
|
+
let size = 'small';
|
|
39
|
+
let buttonTestId = testId && `${testId}-dismiss`;
|
|
40
|
+
|
|
41
|
+
if (isBold) {
|
|
42
|
+
ButtonIcon = isExpanded ? ChevronUpIcon : ChevronDownIcon;
|
|
43
|
+
buttonLabel = isExpanded ? 'Collapse' : 'Expand';
|
|
44
|
+
size = 'large';
|
|
45
|
+
buttonTestId = testId && `${testId}-toggle`;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return jsx(FocusRing, null, jsx("button", {
|
|
49
|
+
style: {
|
|
50
|
+
color: getFlagTextColor(appearance, mode)
|
|
51
|
+
},
|
|
52
|
+
css: dismissButtonStyles,
|
|
53
|
+
onClick: onClick,
|
|
54
|
+
"data-testid": buttonTestId,
|
|
55
|
+
type: "button",
|
|
56
|
+
"aria-expanded": isBold ? isExpanded : undefined
|
|
57
|
+
}, jsx(ButtonIcon, {
|
|
58
|
+
label: buttonLabel,
|
|
59
|
+
size: size
|
|
60
|
+
})));
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export default /*#__PURE__*/memo(DismissButton);
|
|
@@ -3,6 +3,19 @@ import { css, jsx } from '@emotion/core';
|
|
|
3
3
|
import { ExitingPersistence, FadeIn } from '@atlaskit/motion';
|
|
4
4
|
import { gridSize } from '@atlaskit/theme/constants';
|
|
5
5
|
const paddingLeft = gridSize() * 5;
|
|
6
|
+
const expanderStyles = css({
|
|
7
|
+
display: 'flex',
|
|
8
|
+
minWidth: 0,
|
|
9
|
+
maxHeight: 0,
|
|
10
|
+
padding: `0 0 0 ${paddingLeft}px`,
|
|
11
|
+
justifyContent: 'center',
|
|
12
|
+
flex: '1 1 100%',
|
|
13
|
+
flexDirection: 'column',
|
|
14
|
+
transition: `max-height 0.3s`
|
|
15
|
+
});
|
|
16
|
+
const expandedStyles = css({
|
|
17
|
+
maxHeight: 150
|
|
18
|
+
});
|
|
6
19
|
|
|
7
20
|
const Expander = ({
|
|
8
21
|
children,
|
|
@@ -14,16 +27,7 @@ const Expander = ({
|
|
|
14
27
|
// the the reveal because we don't know the height of the content.
|
|
15
28
|
return jsx("div", {
|
|
16
29
|
"aria-hidden": !isExpanded,
|
|
17
|
-
css:
|
|
18
|
-
max-height: ${isExpanded ? 150 : 0}px;
|
|
19
|
-
transition: max-height 0.3s;
|
|
20
|
-
display: flex;
|
|
21
|
-
flex: 1 1 100%;
|
|
22
|
-
flex-direction: column;
|
|
23
|
-
justify-content: center;
|
|
24
|
-
min-width: 0;
|
|
25
|
-
padding: 0 0 0 ${paddingLeft}px;
|
|
26
|
-
`,
|
|
30
|
+
css: [expanderStyles, isExpanded && expandedStyles],
|
|
27
31
|
"data-testid": testId && `${testId}-expander`
|
|
28
32
|
}, jsx(ExitingPersistence, {
|
|
29
33
|
appear: true
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx, css } from '@emotion/core';
|
|
3
|
+
const titleStyles = css({
|
|
4
|
+
padding: `0 0 0 16px`,
|
|
5
|
+
flex: 1,
|
|
6
|
+
fontWeight: 600,
|
|
7
|
+
overflow: 'hidden',
|
|
8
|
+
textOverflow: 'ellipsis',
|
|
9
|
+
whiteSpace: 'nowrap'
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const Title = ({
|
|
13
|
+
color,
|
|
14
|
+
children
|
|
15
|
+
}) => jsx("span", {
|
|
16
|
+
style: {
|
|
17
|
+
color
|
|
18
|
+
},
|
|
19
|
+
css: titleStyles
|
|
20
|
+
}, children);
|
|
21
|
+
|
|
22
|
+
export default Title;
|
package/dist/es2019/theme.js
CHANGED
|
@@ -1,70 +1,70 @@
|
|
|
1
1
|
import { B100, B400, DN40, DN50, DN600, G300, G400, N0, N200, N30A, N40, N500, N50A, N60A, N700, R300, R400, Y200, Y300 } from '@atlaskit/theme/colors';
|
|
2
2
|
const flagBackgroundColor = {
|
|
3
3
|
error: {
|
|
4
|
-
light: `var(--ds-
|
|
5
|
-
dark: `var(--ds-
|
|
4
|
+
light: `var(--ds-surface-overlay, ${R400})`,
|
|
5
|
+
dark: `var(--ds-surface-overlay, ${R300})`
|
|
6
6
|
},
|
|
7
7
|
info: {
|
|
8
|
-
light: `var(--ds-
|
|
9
|
-
dark: `var(--ds-
|
|
8
|
+
light: `var(--ds-surface-overlay, ${N500})`,
|
|
9
|
+
dark: `var(--ds-surface-overlay, ${N500})`
|
|
10
10
|
},
|
|
11
11
|
normal: {
|
|
12
|
-
light: `var(--ds-
|
|
13
|
-
dark: `var(--ds-
|
|
12
|
+
light: `var(--ds-surface-overlay, ${N0})`,
|
|
13
|
+
dark: `var(--ds-surface-overlay, ${DN50})`
|
|
14
14
|
},
|
|
15
15
|
success: {
|
|
16
|
-
light: `var(--ds-
|
|
17
|
-
dark: `var(--ds-
|
|
16
|
+
light: `var(--ds-surface-overlay, ${G400})`,
|
|
17
|
+
dark: `var(--ds-surface-overlay, ${G300})`
|
|
18
18
|
},
|
|
19
19
|
warning: {
|
|
20
|
-
light: `var(--ds-
|
|
21
|
-
dark: `var(--ds-
|
|
20
|
+
light: `var(--ds-surface-overlay, ${Y200})`,
|
|
21
|
+
dark: `var(--ds-surface-overlay, ${Y300})`
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
24
|
export const getFlagBackgroundColor = (appearance, mode) => flagBackgroundColor[appearance][mode];
|
|
25
|
-
export const flagBorderColor = `var(--ds-
|
|
25
|
+
export const flagBorderColor = `var(--ds-surface-overlay, ${N60A})`;
|
|
26
26
|
const flagIconColor = {
|
|
27
27
|
error: {
|
|
28
|
-
light: `var(--ds-
|
|
29
|
-
dark: `var(--ds-
|
|
28
|
+
light: `var(--ds-icon-danger, ${N0})`,
|
|
29
|
+
dark: `var(--ds-icon-danger, ${DN40})`
|
|
30
30
|
},
|
|
31
31
|
info: {
|
|
32
|
-
light: `var(--ds-
|
|
33
|
-
dark: `var(--ds-
|
|
32
|
+
light: `var(--ds-icon-discovery, ${N0})`,
|
|
33
|
+
dark: `var(--ds-icon-discovery, ${DN600})`
|
|
34
34
|
},
|
|
35
35
|
normal: {
|
|
36
|
-
light: `var(--ds-
|
|
37
|
-
dark: `var(--ds-
|
|
36
|
+
light: `var(--ds-icon-brand, ${N500})`,
|
|
37
|
+
dark: `var(--ds-icon-brand, ${DN600})`
|
|
38
38
|
},
|
|
39
39
|
success: {
|
|
40
|
-
light: `var(--ds-
|
|
41
|
-
dark: `var(--ds-
|
|
40
|
+
light: `var(--ds-icon-success, ${N0})`,
|
|
41
|
+
dark: `var(--ds-icon-success, ${DN40})`
|
|
42
42
|
},
|
|
43
43
|
warning: {
|
|
44
|
-
light: `var(--ds-
|
|
45
|
-
dark: `var(--ds-
|
|
44
|
+
light: `var(--ds-icon-warning, ${N700})`,
|
|
45
|
+
dark: `var(--ds-icon-warning, ${DN40})`
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
48
|
const flagTextColor = {
|
|
49
49
|
error: {
|
|
50
|
-
light: `var(--ds-text
|
|
51
|
-
dark: `var(--ds-text
|
|
50
|
+
light: `var(--ds-text, ${N0})`,
|
|
51
|
+
dark: `var(--ds-text, ${DN40})`
|
|
52
52
|
},
|
|
53
53
|
info: {
|
|
54
|
-
light: `var(--ds-text
|
|
55
|
-
dark: `var(--ds-text
|
|
54
|
+
light: `var(--ds-text, ${N0})`,
|
|
55
|
+
dark: `var(--ds-text, ${DN600})`
|
|
56
56
|
},
|
|
57
57
|
normal: {
|
|
58
|
-
light: `var(--ds-text
|
|
59
|
-
dark: `var(--ds-text
|
|
58
|
+
light: `var(--ds-text, ${N500})`,
|
|
59
|
+
dark: `var(--ds-text, ${DN600})`
|
|
60
60
|
},
|
|
61
61
|
success: {
|
|
62
|
-
light: `var(--ds-text
|
|
63
|
-
dark: `var(--ds-text
|
|
62
|
+
light: `var(--ds-text, ${N0})`,
|
|
63
|
+
dark: `var(--ds-text, ${DN40})`
|
|
64
64
|
},
|
|
65
65
|
warning: {
|
|
66
|
-
light: `var(--ds-text
|
|
67
|
-
dark: `var(--ds-text
|
|
66
|
+
light: `var(--ds-text, ${N700})`,
|
|
67
|
+
dark: `var(--ds-text, ${DN40})`
|
|
68
68
|
}
|
|
69
69
|
};
|
|
70
70
|
export const getFlagTextColor = (appearance, mode) => flagTextColor[appearance][mode];
|
|
@@ -74,70 +74,70 @@ export const getFlagIconColor = (appearance, mode) => flagIconColor[appearance][
|
|
|
74
74
|
export const flagShadowColor = N50A;
|
|
75
75
|
const flagFocusRingColor = {
|
|
76
76
|
error: {
|
|
77
|
-
light: `var(--ds-border-
|
|
78
|
-
dark: `var(--ds-border-
|
|
77
|
+
light: `var(--ds-border-focused, ${N40})`,
|
|
78
|
+
dark: `var(--ds-border-focused, ${N40})`
|
|
79
79
|
},
|
|
80
80
|
info: {
|
|
81
|
-
light: `var(--ds-border-
|
|
82
|
-
dark: `var(--ds-border-
|
|
81
|
+
light: `var(--ds-border-focused, ${N40})`,
|
|
82
|
+
dark: `var(--ds-border-focused, ${N40})`
|
|
83
83
|
},
|
|
84
84
|
normal: {
|
|
85
|
-
light: `var(--ds-border-
|
|
86
|
-
dark: `var(--ds-border-
|
|
85
|
+
light: `var(--ds-border-focused, ${B100})`,
|
|
86
|
+
dark: `var(--ds-border-focused, ${B100})`
|
|
87
87
|
},
|
|
88
88
|
success: {
|
|
89
|
-
light: `var(--ds-border-
|
|
90
|
-
dark: `var(--ds-border-
|
|
89
|
+
light: `var(--ds-border-focused, ${N40})`,
|
|
90
|
+
dark: `var(--ds-border-focused, ${N40})`
|
|
91
91
|
},
|
|
92
92
|
warning: {
|
|
93
|
-
light: `var(--ds-border-
|
|
94
|
-
dark: `var(--ds-border-
|
|
93
|
+
light: `var(--ds-border-focused, ${N200})`,
|
|
94
|
+
dark: `var(--ds-border-focused, ${N200})`
|
|
95
95
|
}
|
|
96
96
|
};
|
|
97
97
|
export const getFlagFocusRingColor = (appearance, mode) => flagFocusRingColor[appearance][mode];
|
|
98
98
|
const lightButtonBackground = 'rgba(255, 255, 255, 0.08)';
|
|
99
99
|
const actionBackground = {
|
|
100
100
|
success: {
|
|
101
|
-
light: `var(--ds-background-
|
|
102
|
-
dark: `var(--ds-background-
|
|
101
|
+
light: `var(--ds-background-neutral, ${lightButtonBackground})`,
|
|
102
|
+
dark: `var(--ds-background-neutral, ${N30A})`
|
|
103
103
|
},
|
|
104
104
|
info: {
|
|
105
|
-
light: `var(--ds-background-
|
|
106
|
-
dark: `var(--ds-background-
|
|
105
|
+
light: `var(--ds-background-neutral, ${lightButtonBackground})`,
|
|
106
|
+
dark: `var(--ds-background-neutral, ${lightButtonBackground})`
|
|
107
107
|
},
|
|
108
108
|
error: {
|
|
109
|
-
light: `var(--ds-background-
|
|
110
|
-
dark: `var(--ds-background-
|
|
109
|
+
light: `var(--ds-background-neutral, ${lightButtonBackground})`,
|
|
110
|
+
dark: `var(--ds-background-neutral, ${N30A})`
|
|
111
111
|
},
|
|
112
112
|
warning: {
|
|
113
|
-
light: `var(--ds-background-
|
|
114
|
-
dark: `var(--ds-background-
|
|
113
|
+
light: `var(--ds-background-neutral, ${N30A})`,
|
|
114
|
+
dark: `var(--ds-background-neutral, ${N30A})`
|
|
115
115
|
},
|
|
116
116
|
normal: {
|
|
117
|
-
light: "var(--ds-background-
|
|
118
|
-
dark: "var(--ds-background-
|
|
117
|
+
light: "var(--ds-background-neutral, none)",
|
|
118
|
+
dark: "var(--ds-background-neutral, none)"
|
|
119
119
|
}
|
|
120
120
|
};
|
|
121
121
|
const actionColor = {
|
|
122
122
|
success: {
|
|
123
|
-
light: `var(--ds-text-
|
|
124
|
-
dark: `var(--ds-text-
|
|
123
|
+
light: `var(--ds-text-subtle, ${N0})`,
|
|
124
|
+
dark: `var(--ds-text-subtle, ${DN40})`
|
|
125
125
|
},
|
|
126
126
|
info: {
|
|
127
|
-
light: `var(--ds-text-
|
|
128
|
-
dark: `var(--ds-text-
|
|
127
|
+
light: `var(--ds-text-subtle, ${N0})`,
|
|
128
|
+
dark: `var(--ds-text-subtle, ${DN600})`
|
|
129
129
|
},
|
|
130
130
|
error: {
|
|
131
|
-
light: `var(--ds-text-
|
|
132
|
-
dark: `var(--ds-text-
|
|
131
|
+
light: `var(--ds-text-subtle, ${N0})`,
|
|
132
|
+
dark: `var(--ds-text-subtle, ${DN600})`
|
|
133
133
|
},
|
|
134
134
|
warning: {
|
|
135
|
-
light: `var(--ds-text-
|
|
136
|
-
dark: `var(--ds-text-
|
|
135
|
+
light: `var(--ds-text-subtle, ${N700})`,
|
|
136
|
+
dark: `var(--ds-text-subtle, ${DN40})`
|
|
137
137
|
},
|
|
138
138
|
normal: {
|
|
139
|
-
light: `var(--ds-text-
|
|
140
|
-
dark: `var(--ds-text-
|
|
139
|
+
light: `var(--ds-text-subtle, ${B400})`,
|
|
140
|
+
dark: `var(--ds-text-subtle, ${B100})`
|
|
141
141
|
}
|
|
142
142
|
};
|
|
143
143
|
export const getActionBackground = (appearance, mode) => actionBackground[appearance][mode];
|
package/dist/es2019/version.json
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { useCallback, useEffect, useRef } from 'react';
|
|
3
3
|
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatformLeafEventHandler';
|
|
4
|
+
import noop from '@atlaskit/ds-lib/noop';
|
|
4
5
|
import Flag from './flag';
|
|
5
6
|
import { useFlagGroup } from './flag-group';
|
|
6
7
|
var packageName = "@atlaskit/flag";
|
|
7
|
-
var packageVersion = "14.5.
|
|
8
|
+
var packageVersion = "14.5.2";
|
|
8
9
|
export var AUTO_DISMISS_SECONDS = 8;
|
|
9
10
|
|
|
10
|
-
function noop() {}
|
|
11
|
-
|
|
12
11
|
var AutoDismissFlag = function AutoDismissFlag(props) {
|
|
13
12
|
var id = props.id,
|
|
14
13
|
analyticsContext = props.analyticsContext,
|