@atlaskit/flag 14.4.2 → 14.5.3
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 +39 -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 +57 -19
- package/dist/cjs/flag-provider.js +6 -4
- package/dist/cjs/flag.js +85 -108
- package/dist/cjs/index.js +12 -12
- 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 +62 -62
- 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-provider.js +4 -3
- package/dist/esm/flag.js +81 -103
- 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/auto-dismiss-flag.d.ts +1 -0
- package/dist/types/flag-actions.d.ts +4 -4
- package/dist/types/flag-group.d.ts +2 -2
- package/dist/types/flag.d.ts +2 -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 +10 -8
- package/dist/types/expander.d.ts +0 -9
- package/expander/package.json +0 -7
package/dist/esm/flag.js
CHANGED
|
@@ -1,39 +1,49 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
3
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
7
6
|
|
|
8
|
-
function
|
|
9
|
-
|
|
10
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
7
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
11
8
|
|
|
12
9
|
/** @jsx jsx */
|
|
13
10
|
import { useCallback, useEffect, useState } from 'react';
|
|
14
11
|
import { css, jsx } from '@emotion/core';
|
|
15
|
-
import
|
|
16
|
-
import ChevronUpIcon from '@atlaskit/icon/glyph/chevron-up';
|
|
17
|
-
import CrossIcon from '@atlaskit/icon/glyph/cross';
|
|
18
|
-
import GlobalTheme from '@atlaskit/theme/components';
|
|
12
|
+
import { useGlobalTheme } from '@atlaskit/theme/components';
|
|
19
13
|
import { borderRadius, gridSize as getGridSize, layers } from '@atlaskit/theme/constants';
|
|
20
14
|
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatformLeafEventHandler';
|
|
15
|
+
import noop from '@atlaskit/ds-lib/noop';
|
|
16
|
+
import FocusRing from '@atlaskit/focus-ring';
|
|
21
17
|
import { DEFAULT_APPEARANCE } from './constants';
|
|
22
|
-
import { flagBorderColor, flagShadowColor, getFlagBackgroundColor,
|
|
23
|
-
import Expander from './expander';
|
|
18
|
+
import { flagBorderColor, flagShadowColor, getFlagBackgroundColor, getFlagTextColor, getFlagIconColor } from './theme';
|
|
24
19
|
import Actions from './flag-actions';
|
|
25
20
|
import { useFlagGroup } from './flag-group';
|
|
26
|
-
|
|
27
|
-
function noop() {}
|
|
28
|
-
|
|
21
|
+
import { Title, Description, Expander, DismissButton } from './internal';
|
|
29
22
|
var analyticsAttributes = {
|
|
30
23
|
componentName: 'flag',
|
|
31
24
|
packageName: "@atlaskit/flag",
|
|
32
|
-
packageVersion: "14.
|
|
25
|
+
packageVersion: "14.5.3"
|
|
33
26
|
};
|
|
34
27
|
var gridSize = getGridSize();
|
|
35
28
|
var doubleGridSize = gridSize * 2;
|
|
36
29
|
var headerHeight = gridSize * 4;
|
|
30
|
+
var iconStyles = css({
|
|
31
|
+
display: 'flex',
|
|
32
|
+
height: headerHeight,
|
|
33
|
+
alignItems: 'center'
|
|
34
|
+
});
|
|
35
|
+
var flagHeaderStyles = css({
|
|
36
|
+
boxSizing: 'border-box',
|
|
37
|
+
width: '100%',
|
|
38
|
+
padding: doubleGridSize,
|
|
39
|
+
borderRadius: borderRadius()
|
|
40
|
+
});
|
|
41
|
+
var flagContainerStyles = css({
|
|
42
|
+
width: '100%',
|
|
43
|
+
zIndex: layers.flag(),
|
|
44
|
+
borderRadius: borderRadius(),
|
|
45
|
+
transition: 'background-color 200ms'
|
|
46
|
+
});
|
|
37
47
|
|
|
38
48
|
var Flag = function Flag(props) {
|
|
39
49
|
var _props$actions = props.actions,
|
|
@@ -76,60 +86,16 @@ var Flag = function Flag(props) {
|
|
|
76
86
|
analyticsData: analyticsContext
|
|
77
87
|
}, analyticsAttributes));
|
|
78
88
|
var isBold = appearance !== DEFAULT_APPEARANCE;
|
|
79
|
-
var
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
if (
|
|
86
|
-
|
|
87
|
-
} // If it is bold then ensure there is a description or actions to render
|
|
88
|
-
// the toggle button
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
if (isBold && !description && !actions.length) {
|
|
92
|
-
return null;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
var ButtonIcon = CrossIcon;
|
|
96
|
-
var buttonLabel = 'Dismiss';
|
|
97
|
-
|
|
98
|
-
var buttonAction = function buttonAction() {
|
|
99
|
-
if (isDismissAllowed) {
|
|
100
|
-
onDismissedAnalytics(id);
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
var size = 'small';
|
|
105
|
-
var buttonTestId = testId && "".concat(testId, "-dismiss");
|
|
106
|
-
var a11yProps = {};
|
|
107
|
-
|
|
108
|
-
if (isBold) {
|
|
109
|
-
ButtonIcon = isExpanded ? ChevronUpIcon : ChevronDownIcon;
|
|
110
|
-
buttonLabel = isExpanded ? 'Collapse' : 'Expand';
|
|
111
|
-
|
|
112
|
-
buttonAction = function buttonAction() {
|
|
113
|
-
return setIsExpanded(!isExpanded);
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
size = 'large';
|
|
117
|
-
buttonTestId = testId && "".concat(testId, "-toggle");
|
|
118
|
-
a11yProps = {
|
|
119
|
-
'aria-expanded': isExpanded
|
|
120
|
-
};
|
|
89
|
+
var toggleExpand = useCallback(function () {
|
|
90
|
+
setIsExpanded(function (previous) {
|
|
91
|
+
return !previous;
|
|
92
|
+
});
|
|
93
|
+
}, []);
|
|
94
|
+
var buttonActionCallback = useCallback(function () {
|
|
95
|
+
if (isDismissAllowed) {
|
|
96
|
+
onDismissedAnalytics(id);
|
|
121
97
|
}
|
|
122
|
-
|
|
123
|
-
return jsx("button", _extends({
|
|
124
|
-
css: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n appearance: none;\n background: none;\n border: none;\n border-radius: ", "px;\n color: ", ";\n cursor: pointer;\n flex: 0 0 auto;\n line-height: 1;\n margin-left: ", "px;\n padding: 0;\n white-space: nowrap;\n &:focus {\n outline: none;\n box-shadow: 0 0 0 2px ", ";\n }\n "])), borderRadius(), getFlagTextColor(appearance, mode), gridSize, getFlagFocusRingColor(appearance, mode)),
|
|
125
|
-
onClick: buttonAction,
|
|
126
|
-
"data-testid": buttonTestId,
|
|
127
|
-
type: "button"
|
|
128
|
-
}, a11yProps), jsx(ButtonIcon, {
|
|
129
|
-
label: buttonLabel,
|
|
130
|
-
size: size
|
|
131
|
-
}));
|
|
132
|
-
}, [actions.length, appearance, description, id, isBold, isDismissAllowed, isExpanded, onDismissedAnalytics, testId]);
|
|
98
|
+
}, [onDismissedAnalytics, id, isDismissAllowed]);
|
|
133
99
|
useEffect(function () {
|
|
134
100
|
// If buttons are removed as a prop, update isExpanded to be false
|
|
135
101
|
if (isBold && isExpanded && !description && !actions.length) {
|
|
@@ -152,45 +118,57 @@ var Flag = function Flag(props) {
|
|
|
152
118
|
onMouseOut: onMouseOut,
|
|
153
119
|
onBlur: onBlurAnalytics
|
|
154
120
|
};
|
|
155
|
-
var
|
|
156
|
-
var boxShadow = "var(--ds-overlay, ".concat("0 20px 32px -8px ".concat(flagShadowColor), ")");
|
|
121
|
+
var boxShadow = "var(--ds-shadow-overlay, ".concat("0 20px 32px -8px ".concat(flagShadowColor), ")");
|
|
157
122
|
|
|
158
123
|
if (!isBold) {
|
|
159
|
-
boxShadow = "var(--ds-overlay, ".concat("0 0 1px ".concat(flagBorderColor, ", ").concat(boxShadow), ")");
|
|
124
|
+
boxShadow = "var(--ds-shadow-overlay, ".concat("0 0 1px ".concat(flagBorderColor, ", ").concat(boxShadow), ")");
|
|
160
125
|
}
|
|
161
126
|
|
|
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
|
-
|
|
127
|
+
var _useGlobalTheme = useGlobalTheme(),
|
|
128
|
+
mode = _useGlobalTheme.mode;
|
|
129
|
+
|
|
130
|
+
var textColor = getFlagTextColor(appearance, mode);
|
|
131
|
+
var iconColor = getFlagIconColor(appearance, mode);
|
|
132
|
+
var isDismissable = isBold || isDismissAllowed;
|
|
133
|
+
return jsx("div", _extends({
|
|
134
|
+
style: {
|
|
135
|
+
color: textColor,
|
|
136
|
+
backgroundColor: getFlagBackgroundColor(appearance, mode),
|
|
137
|
+
boxShadow: boxShadow
|
|
138
|
+
},
|
|
139
|
+
css: flagContainerStyles,
|
|
140
|
+
role: "alert",
|
|
141
|
+
"data-testid": testId
|
|
142
|
+
}, autoDismissProps), jsx(FocusRing, null, jsx("div", {
|
|
143
|
+
css: flagHeaderStyles // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
|
|
144
|
+
,
|
|
145
|
+
tabIndex: 0
|
|
146
|
+
}, jsx("div", {
|
|
147
|
+
style: {
|
|
148
|
+
color: iconColor
|
|
149
|
+
},
|
|
150
|
+
css: iconStyles
|
|
151
|
+
}, icon, jsx(Title, {
|
|
152
|
+
color: textColor
|
|
153
|
+
}, title), isDismissable ? !(isBold && !description && !actions.length) && jsx(DismissButton, {
|
|
154
|
+
testId: testId,
|
|
155
|
+
appearance: appearance,
|
|
156
|
+
isBold: isBold,
|
|
157
|
+
isExpanded: isExpanded,
|
|
158
|
+
onClick: isBold ? toggleExpand : buttonActionCallback
|
|
159
|
+
}) : null), jsx(Expander, {
|
|
160
|
+
isExpanded: !isBold || isExpanded,
|
|
161
|
+
testId: testId
|
|
162
|
+
}, description && jsx(Description, {
|
|
163
|
+
testId: testId && "".concat(testId, "-description"),
|
|
164
|
+
color: textColor
|
|
165
|
+
}, description), jsx(Actions, {
|
|
166
|
+
actions: actions,
|
|
167
|
+
appearance: appearance,
|
|
168
|
+
linkComponent: linkComponent,
|
|
169
|
+
testId: testId,
|
|
170
|
+
mode: mode
|
|
171
|
+
})))));
|
|
194
172
|
};
|
|
195
173
|
|
|
196
174
|
export default Flag;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx, css } from '@emotion/core';
|
|
3
|
+
var 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
|
+
var Description = function Description(_ref) {
|
|
11
|
+
var color = _ref.color,
|
|
12
|
+
testId = _ref.testId,
|
|
13
|
+
children = _ref.children;
|
|
14
|
+
return jsx("div", {
|
|
15
|
+
style: {
|
|
16
|
+
color: color
|
|
17
|
+
},
|
|
18
|
+
css: descriptionStyles,
|
|
19
|
+
"data-testid": testId
|
|
20
|
+
}, children);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
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
|
+
var gridSize = getGridSize();
|
|
12
|
+
var borderRadius = getBorderRadius();
|
|
13
|
+
var dismissButtonStyles = css({
|
|
14
|
+
marginLeft: gridSize,
|
|
15
|
+
padding: 0,
|
|
16
|
+
flex: '0 0 auto',
|
|
17
|
+
appearance: 'none',
|
|
18
|
+
background: 'none',
|
|
19
|
+
border: 'none',
|
|
20
|
+
borderRadius: borderRadius,
|
|
21
|
+
cursor: 'pointer',
|
|
22
|
+
lineHeight: '1',
|
|
23
|
+
whiteSpace: 'nowrap'
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
var DismissButton = function DismissButton(_ref) {
|
|
27
|
+
var appearance = _ref.appearance,
|
|
28
|
+
onClick = _ref.onClick,
|
|
29
|
+
isBold = _ref.isBold,
|
|
30
|
+
isExpanded = _ref.isExpanded,
|
|
31
|
+
testId = _ref.testId;
|
|
32
|
+
|
|
33
|
+
var _useGlobalTheme = useGlobalTheme(),
|
|
34
|
+
mode = _useGlobalTheme.mode;
|
|
35
|
+
|
|
36
|
+
var ButtonIcon = CrossIcon;
|
|
37
|
+
var buttonLabel = 'Dismiss';
|
|
38
|
+
var size = 'small';
|
|
39
|
+
var buttonTestId = testId && "".concat(testId, "-dismiss");
|
|
40
|
+
|
|
41
|
+
if (isBold) {
|
|
42
|
+
ButtonIcon = isExpanded ? ChevronUpIcon : ChevronDownIcon;
|
|
43
|
+
buttonLabel = isExpanded ? 'Collapse' : 'Expand';
|
|
44
|
+
size = 'large';
|
|
45
|
+
buttonTestId = testId && "".concat(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);
|
|
@@ -1,12 +1,21 @@
|
|
|
1
|
-
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
-
|
|
3
|
-
var _templateObject;
|
|
4
|
-
|
|
5
1
|
/** @jsx jsx */
|
|
6
2
|
import { css, jsx } from '@emotion/core';
|
|
7
3
|
import { ExitingPersistence, FadeIn } from '@atlaskit/motion';
|
|
8
4
|
import { gridSize } from '@atlaskit/theme/constants';
|
|
9
5
|
var paddingLeft = gridSize() * 5;
|
|
6
|
+
var expanderStyles = css({
|
|
7
|
+
display: 'flex',
|
|
8
|
+
minWidth: 0,
|
|
9
|
+
maxHeight: 0,
|
|
10
|
+
padding: "0 0 0 ".concat(paddingLeft, "px"),
|
|
11
|
+
justifyContent: 'center',
|
|
12
|
+
flex: '1 1 100%',
|
|
13
|
+
flexDirection: 'column',
|
|
14
|
+
transition: "max-height 0.3s"
|
|
15
|
+
});
|
|
16
|
+
var expandedStyles = css({
|
|
17
|
+
maxHeight: 150
|
|
18
|
+
});
|
|
10
19
|
|
|
11
20
|
var Expander = function Expander(_ref) {
|
|
12
21
|
var children = _ref.children,
|
|
@@ -17,7 +26,7 @@ var Expander = function Expander(_ref) {
|
|
|
17
26
|
// the the reveal because we don't know the height of the content.
|
|
18
27
|
return jsx("div", {
|
|
19
28
|
"aria-hidden": !isExpanded,
|
|
20
|
-
css:
|
|
29
|
+
css: [expanderStyles, isExpanded && expandedStyles],
|
|
21
30
|
"data-testid": testId && "".concat(testId, "-expander")
|
|
22
31
|
}, jsx(ExitingPersistence, {
|
|
23
32
|
appear: true
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx, css } from '@emotion/core';
|
|
3
|
+
var 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
|
+
var Title = function Title(_ref) {
|
|
13
|
+
var color = _ref.color,
|
|
14
|
+
children = _ref.children;
|
|
15
|
+
return jsx("span", {
|
|
16
|
+
style: {
|
|
17
|
+
color: color
|
|
18
|
+
},
|
|
19
|
+
css: titleStyles
|
|
20
|
+
}, children);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default Title;
|
package/dist/esm/theme.js
CHANGED
|
@@ -1,72 +1,72 @@
|
|
|
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
|
var flagBackgroundColor = {
|
|
3
3
|
error: {
|
|
4
|
-
light: "var(--ds-
|
|
5
|
-
dark: "var(--ds-
|
|
4
|
+
light: "var(--ds-surface-overlay, ".concat(R400, ")"),
|
|
5
|
+
dark: "var(--ds-surface-overlay, ".concat(R300, ")")
|
|
6
6
|
},
|
|
7
7
|
info: {
|
|
8
|
-
light: "var(--ds-
|
|
9
|
-
dark: "var(--ds-
|
|
8
|
+
light: "var(--ds-surface-overlay, ".concat(N500, ")"),
|
|
9
|
+
dark: "var(--ds-surface-overlay, ".concat(N500, ")")
|
|
10
10
|
},
|
|
11
11
|
normal: {
|
|
12
|
-
light: "var(--ds-
|
|
13
|
-
dark: "var(--ds-
|
|
12
|
+
light: "var(--ds-surface-overlay, ".concat(N0, ")"),
|
|
13
|
+
dark: "var(--ds-surface-overlay, ".concat(DN50, ")")
|
|
14
14
|
},
|
|
15
15
|
success: {
|
|
16
|
-
light: "var(--ds-
|
|
17
|
-
dark: "var(--ds-
|
|
16
|
+
light: "var(--ds-surface-overlay, ".concat(G400, ")"),
|
|
17
|
+
dark: "var(--ds-surface-overlay, ".concat(G300, ")")
|
|
18
18
|
},
|
|
19
19
|
warning: {
|
|
20
|
-
light: "var(--ds-
|
|
21
|
-
dark: "var(--ds-
|
|
20
|
+
light: "var(--ds-surface-overlay, ".concat(Y200, ")"),
|
|
21
|
+
dark: "var(--ds-surface-overlay, ".concat(Y300, ")")
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
24
|
export var getFlagBackgroundColor = function getFlagBackgroundColor(appearance, mode) {
|
|
25
25
|
return flagBackgroundColor[appearance][mode];
|
|
26
26
|
};
|
|
27
|
-
export var flagBorderColor = "var(--ds-
|
|
27
|
+
export var flagBorderColor = "var(--ds-surface-overlay, ".concat(N60A, ")");
|
|
28
28
|
var flagIconColor = {
|
|
29
29
|
error: {
|
|
30
|
-
light: "var(--ds-
|
|
31
|
-
dark: "var(--ds-
|
|
30
|
+
light: "var(--ds-icon-danger, ".concat(N0, ")"),
|
|
31
|
+
dark: "var(--ds-icon-danger, ".concat(DN40, ")")
|
|
32
32
|
},
|
|
33
33
|
info: {
|
|
34
|
-
light: "var(--ds-
|
|
35
|
-
dark: "var(--ds-
|
|
34
|
+
light: "var(--ds-icon-discovery, ".concat(N0, ")"),
|
|
35
|
+
dark: "var(--ds-icon-discovery, ".concat(DN600, ")")
|
|
36
36
|
},
|
|
37
37
|
normal: {
|
|
38
|
-
light: "var(--ds-
|
|
39
|
-
dark: "var(--ds-
|
|
38
|
+
light: "var(--ds-icon-brand, ".concat(N500, ")"),
|
|
39
|
+
dark: "var(--ds-icon-brand, ".concat(DN600, ")")
|
|
40
40
|
},
|
|
41
41
|
success: {
|
|
42
|
-
light: "var(--ds-
|
|
43
|
-
dark: "var(--ds-
|
|
42
|
+
light: "var(--ds-icon-success, ".concat(N0, ")"),
|
|
43
|
+
dark: "var(--ds-icon-success, ".concat(DN40, ")")
|
|
44
44
|
},
|
|
45
45
|
warning: {
|
|
46
|
-
light: "var(--ds-
|
|
47
|
-
dark: "var(--ds-
|
|
46
|
+
light: "var(--ds-icon-warning, ".concat(N700, ")"),
|
|
47
|
+
dark: "var(--ds-icon-warning, ".concat(DN40, ")")
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
50
|
var flagTextColor = {
|
|
51
51
|
error: {
|
|
52
|
-
light: "var(--ds-text
|
|
53
|
-
dark: "var(--ds-text
|
|
52
|
+
light: "var(--ds-text, ".concat(N0, ")"),
|
|
53
|
+
dark: "var(--ds-text, ".concat(DN40, ")")
|
|
54
54
|
},
|
|
55
55
|
info: {
|
|
56
|
-
light: "var(--ds-text
|
|
57
|
-
dark: "var(--ds-text
|
|
56
|
+
light: "var(--ds-text, ".concat(N0, ")"),
|
|
57
|
+
dark: "var(--ds-text, ".concat(DN600, ")")
|
|
58
58
|
},
|
|
59
59
|
normal: {
|
|
60
|
-
light: "var(--ds-text
|
|
61
|
-
dark: "var(--ds-text
|
|
60
|
+
light: "var(--ds-text, ".concat(N500, ")"),
|
|
61
|
+
dark: "var(--ds-text, ".concat(DN600, ")")
|
|
62
62
|
},
|
|
63
63
|
success: {
|
|
64
|
-
light: "var(--ds-text
|
|
65
|
-
dark: "var(--ds-text
|
|
64
|
+
light: "var(--ds-text, ".concat(N0, ")"),
|
|
65
|
+
dark: "var(--ds-text, ".concat(DN40, ")")
|
|
66
66
|
},
|
|
67
67
|
warning: {
|
|
68
|
-
light: "var(--ds-text
|
|
69
|
-
dark: "var(--ds-text
|
|
68
|
+
light: "var(--ds-text, ".concat(N700, ")"),
|
|
69
|
+
dark: "var(--ds-text, ".concat(DN40, ")")
|
|
70
70
|
}
|
|
71
71
|
};
|
|
72
72
|
export var getFlagTextColor = function getFlagTextColor(appearance, mode) {
|
|
@@ -80,24 +80,24 @@ export var getFlagIconColor = function getFlagIconColor(appearance, mode) {
|
|
|
80
80
|
export var flagShadowColor = N50A;
|
|
81
81
|
var flagFocusRingColor = {
|
|
82
82
|
error: {
|
|
83
|
-
light: "var(--ds-border-
|
|
84
|
-
dark: "var(--ds-border-
|
|
83
|
+
light: "var(--ds-border-focused, ".concat(N40, ")"),
|
|
84
|
+
dark: "var(--ds-border-focused, ".concat(N40, ")")
|
|
85
85
|
},
|
|
86
86
|
info: {
|
|
87
|
-
light: "var(--ds-border-
|
|
88
|
-
dark: "var(--ds-border-
|
|
87
|
+
light: "var(--ds-border-focused, ".concat(N40, ")"),
|
|
88
|
+
dark: "var(--ds-border-focused, ".concat(N40, ")")
|
|
89
89
|
},
|
|
90
90
|
normal: {
|
|
91
|
-
light: "var(--ds-border-
|
|
92
|
-
dark: "var(--ds-border-
|
|
91
|
+
light: "var(--ds-border-focused, ".concat(B100, ")"),
|
|
92
|
+
dark: "var(--ds-border-focused, ".concat(B100, ")")
|
|
93
93
|
},
|
|
94
94
|
success: {
|
|
95
|
-
light: "var(--ds-border-
|
|
96
|
-
dark: "var(--ds-border-
|
|
95
|
+
light: "var(--ds-border-focused, ".concat(N40, ")"),
|
|
96
|
+
dark: "var(--ds-border-focused, ".concat(N40, ")")
|
|
97
97
|
},
|
|
98
98
|
warning: {
|
|
99
|
-
light: "var(--ds-border-
|
|
100
|
-
dark: "var(--ds-border-
|
|
99
|
+
light: "var(--ds-border-focused, ".concat(N200, ")"),
|
|
100
|
+
dark: "var(--ds-border-focused, ".concat(N200, ")")
|
|
101
101
|
}
|
|
102
102
|
};
|
|
103
103
|
export var getFlagFocusRingColor = function getFlagFocusRingColor(appearance, mode) {
|
|
@@ -106,46 +106,46 @@ export var getFlagFocusRingColor = function getFlagFocusRingColor(appearance, mo
|
|
|
106
106
|
var lightButtonBackground = 'rgba(255, 255, 255, 0.08)';
|
|
107
107
|
var actionBackground = {
|
|
108
108
|
success: {
|
|
109
|
-
light: "var(--ds-background-
|
|
110
|
-
dark: "var(--ds-background-
|
|
109
|
+
light: "var(--ds-background-neutral, ".concat(lightButtonBackground, ")"),
|
|
110
|
+
dark: "var(--ds-background-neutral, ".concat(N30A, ")")
|
|
111
111
|
},
|
|
112
112
|
info: {
|
|
113
|
-
light: "var(--ds-background-
|
|
114
|
-
dark: "var(--ds-background-
|
|
113
|
+
light: "var(--ds-background-neutral, ".concat(lightButtonBackground, ")"),
|
|
114
|
+
dark: "var(--ds-background-neutral, ".concat(lightButtonBackground, ")")
|
|
115
115
|
},
|
|
116
116
|
error: {
|
|
117
|
-
light: "var(--ds-background-
|
|
118
|
-
dark: "var(--ds-background-
|
|
117
|
+
light: "var(--ds-background-neutral, ".concat(lightButtonBackground, ")"),
|
|
118
|
+
dark: "var(--ds-background-neutral, ".concat(N30A, ")")
|
|
119
119
|
},
|
|
120
120
|
warning: {
|
|
121
|
-
light: "var(--ds-background-
|
|
122
|
-
dark: "var(--ds-background-
|
|
121
|
+
light: "var(--ds-background-neutral, ".concat(N30A, ")"),
|
|
122
|
+
dark: "var(--ds-background-neutral, ".concat(N30A, ")")
|
|
123
123
|
},
|
|
124
124
|
normal: {
|
|
125
|
-
light: "var(--ds-background-
|
|
126
|
-
dark: "var(--ds-background-
|
|
125
|
+
light: "var(--ds-background-neutral, none)",
|
|
126
|
+
dark: "var(--ds-background-neutral, none)"
|
|
127
127
|
}
|
|
128
128
|
};
|
|
129
129
|
var actionColor = {
|
|
130
130
|
success: {
|
|
131
|
-
light: "var(--ds-text-
|
|
132
|
-
dark: "var(--ds-text-
|
|
131
|
+
light: "var(--ds-text-subtle, ".concat(N0, ")"),
|
|
132
|
+
dark: "var(--ds-text-subtle, ".concat(DN40, ")")
|
|
133
133
|
},
|
|
134
134
|
info: {
|
|
135
|
-
light: "var(--ds-text-
|
|
136
|
-
dark: "var(--ds-text-
|
|
135
|
+
light: "var(--ds-text-subtle, ".concat(N0, ")"),
|
|
136
|
+
dark: "var(--ds-text-subtle, ".concat(DN600, ")")
|
|
137
137
|
},
|
|
138
138
|
error: {
|
|
139
|
-
light: "var(--ds-text-
|
|
140
|
-
dark: "var(--ds-text-
|
|
139
|
+
light: "var(--ds-text-subtle, ".concat(N0, ")"),
|
|
140
|
+
dark: "var(--ds-text-subtle, ".concat(DN600, ")")
|
|
141
141
|
},
|
|
142
142
|
warning: {
|
|
143
|
-
light: "var(--ds-text-
|
|
144
|
-
dark: "var(--ds-text-
|
|
143
|
+
light: "var(--ds-text-subtle, ".concat(N700, ")"),
|
|
144
|
+
dark: "var(--ds-text-subtle, ".concat(DN40, ")")
|
|
145
145
|
},
|
|
146
146
|
normal: {
|
|
147
|
-
light: "var(--ds-text-
|
|
148
|
-
dark: "var(--ds-text-
|
|
147
|
+
light: "var(--ds-text-subtle, ".concat(B400, ")"),
|
|
148
|
+
dark: "var(--ds-text-subtle, ".concat(B100, ")")
|
|
149
149
|
}
|
|
150
150
|
};
|
|
151
151
|
export var getActionBackground = function getActionBackground(appearance, mode) {
|
package/dist/esm/version.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import { ComponentType } from 'react';
|
|
3
|
-
import { CustomThemeButtonProps } from '@atlaskit/button/types';
|
|
4
|
-
import { ThemeModes } from '@atlaskit/theme/types';
|
|
5
|
-
import { ActionsType, AppearanceTypes } from './types';
|
|
2
|
+
import type { ComponentType } from 'react';
|
|
3
|
+
import type { CustomThemeButtonProps } from '@atlaskit/button/types';
|
|
4
|
+
import type { ThemeModes } from '@atlaskit/theme/types';
|
|
5
|
+
import type { ActionsType, AppearanceTypes } from './types';
|
|
6
6
|
declare type Props = {
|
|
7
7
|
appearance: AppearanceTypes;
|
|
8
8
|
actions: ActionsType;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { ReactElement } from 'react';
|
|
3
3
|
import type { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
4
|
-
declare type
|
|
4
|
+
declare type FlagGroupProps = {
|
|
5
5
|
/** ID attribute used for DOM selection. */
|
|
6
6
|
id?: string;
|
|
7
7
|
/** Describes the specific role of this FlagGroup for users viewing the page with a screen reader (defaults to `Flag notifications`). */
|
|
@@ -23,5 +23,5 @@ declare type FlagGroupAPI = {
|
|
|
23
23
|
};
|
|
24
24
|
export declare const FlagGroupContext: import("react").Context<FlagGroupAPI>;
|
|
25
25
|
export declare function useFlagGroup(): FlagGroupAPI;
|
|
26
|
-
declare const FlagGroup: (props:
|
|
26
|
+
declare const FlagGroup: (props: FlagGroupProps) => JSX.Element;
|
|
27
27
|
export default FlagGroup;
|
package/dist/types/flag.d.ts
CHANGED