@atlaskit/flag 16.0.0 → 16.1.1
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 +23 -0
- package/dist/cjs/auto-dismiss-flag.js +1 -1
- package/dist/cjs/flag.js +18 -6
- package/dist/cjs/theme.js +39 -6
- package/dist/es2019/auto-dismiss-flag.js +1 -1
- package/dist/es2019/flag.js +19 -7
- package/dist/es2019/theme.js +38 -6
- package/dist/esm/auto-dismiss-flag.js +1 -1
- package/dist/esm/flag.js +19 -7
- package/dist/esm/theme.js +38 -6
- package/dist/types/flag-provider.d.ts +1 -1
- package/dist/types/theme.d.ts +2 -0
- package/dist/types/types.d.ts +4 -3
- package/dist/types-ts4.5/flag-provider.d.ts +1 -1
- package/dist/types-ts4.5/theme.d.ts +2 -0
- package/dist/types-ts4.5/types.d.ts +4 -3
- package/package.json +15 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @atlaskit/flag
|
|
2
2
|
|
|
3
|
+
## 16.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#119202](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/119202)
|
|
8
|
+
[`903841d1b85ba`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/903841d1b85ba) -
|
|
9
|
+
Removes the explicit return type on withFlagsProvider to allow typescript to infer the real type.
|
|
10
|
+
This allows consumers to have a better typescript experience and not have to cast the
|
|
11
|
+
withFlagsProvider type in storybook.
|
|
12
|
+
|
|
13
|
+
## 16.1.0
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- [#118326](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/118326)
|
|
18
|
+
[`47ed83a62335a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/47ed83a62335a) -
|
|
19
|
+
We are testing improvements behind a feature flag. Flags with default icons, and support for icons
|
|
20
|
+
with no spacing. If this fix is successful it will be available in a later release.
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- Updated dependencies
|
|
25
|
+
|
|
3
26
|
## 16.0.0
|
|
4
27
|
|
|
5
28
|
### Major Changes
|
|
@@ -15,7 +15,7 @@ var _flagGroup = require("./flag-group");
|
|
|
15
15
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
16
16
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
17
17
|
var packageName = "@atlaskit/flag";
|
|
18
|
-
var packageVersion = "16.
|
|
18
|
+
var packageVersion = "16.1.1";
|
|
19
19
|
var AUTO_DISMISS_SECONDS = exports.AUTO_DISMISS_SECONDS = 8;
|
|
20
20
|
|
|
21
21
|
/**
|
package/dist/cjs/flag.js
CHANGED
|
@@ -13,6 +13,7 @@ var _react2 = require("@emotion/react");
|
|
|
13
13
|
var _usePlatformLeafEventHandler = require("@atlaskit/analytics-next/usePlatformLeafEventHandler");
|
|
14
14
|
var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
|
|
15
15
|
var _heading = _interopRequireDefault(require("@atlaskit/heading"));
|
|
16
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
17
|
var _primitives = require("@atlaskit/primitives");
|
|
17
18
|
var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden"));
|
|
18
19
|
var _constants = require("./constants");
|
|
@@ -37,12 +38,21 @@ var descriptionStyles = (0, _react2.css)({
|
|
|
37
38
|
overflow: 'auto',
|
|
38
39
|
overflowWrap: 'anywhere' // For cases where a single word is longer than the container (e.g. filenames)
|
|
39
40
|
});
|
|
40
|
-
var
|
|
41
|
+
var oldIconWrapperStyles = (0, _react2.css)({
|
|
41
42
|
display: 'flex',
|
|
42
43
|
alignItems: 'start',
|
|
43
44
|
flexShrink: 0,
|
|
44
45
|
color: "var(".concat(CSS_VAR_ICON_COLOR, ")")
|
|
45
46
|
});
|
|
47
|
+
var iconWrapperStyles = (0, _react2.css)({
|
|
48
|
+
display: 'flex',
|
|
49
|
+
minWidth: '24px',
|
|
50
|
+
minHeight: '24px',
|
|
51
|
+
alignItems: 'center',
|
|
52
|
+
justifyContent: 'center',
|
|
53
|
+
flexShrink: 0,
|
|
54
|
+
color: "var(".concat(CSS_VAR_ICON_COLOR, ")")
|
|
55
|
+
});
|
|
46
56
|
var flagStyles = (0, _primitives.xcss)({
|
|
47
57
|
boxShadow: 'elevation.shadow.overlay',
|
|
48
58
|
borderRadius: 'border.radius.100',
|
|
@@ -57,7 +67,7 @@ var flagWrapperStyles = (0, _react2.css)({
|
|
|
57
67
|
var analyticsAttributes = {
|
|
58
68
|
componentName: 'flag',
|
|
59
69
|
packageName: "@atlaskit/flag",
|
|
60
|
-
packageVersion: "16.
|
|
70
|
+
packageVersion: "16.1.1"
|
|
61
71
|
};
|
|
62
72
|
var transitionStyles = (0, _react2.css)({
|
|
63
73
|
flexGrow: 1,
|
|
@@ -160,6 +170,7 @@ var Flag = function Flag(props) {
|
|
|
160
170
|
};
|
|
161
171
|
var textColor = _theme.flagTextColor[appearance];
|
|
162
172
|
var iconColor = _theme.flagIconColor[appearance];
|
|
173
|
+
var iconGlyph = _theme.flagIconGlyph[appearance];
|
|
163
174
|
var isDismissable = isBold || isDismissAllowed;
|
|
164
175
|
var shouldRenderGap = !isBold && (description || actions.length) || isExpanded;
|
|
165
176
|
// when delayAnnouncement is available we will use a hidden content for announcement
|
|
@@ -173,14 +184,15 @@ var Flag = function Flag(props) {
|
|
|
173
184
|
padding: "space.200",
|
|
174
185
|
xcss: flagStyles
|
|
175
186
|
}, (0, _react2.jsx)(_primitives.Inline, {
|
|
176
|
-
alignBlock:
|
|
187
|
+
alignBlock: (0, _platformFeatureFlags.fg)('platform_ads_component_no_icon_spacing_support') ? 'start' : 'stretch',
|
|
177
188
|
space: "space.200"
|
|
178
189
|
}, (0, _react2.jsx)("div", {
|
|
179
|
-
css: iconWrapperStyles
|
|
190
|
+
css: (0, _platformFeatureFlags.fg)('platform_ads_component_no_icon_spacing_support') ? iconWrapperStyles : oldIconWrapperStyles
|
|
180
191
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
181
192
|
,
|
|
182
|
-
style: (0, _defineProperty2.default)({}, CSS_VAR_ICON_COLOR, iconColor)
|
|
183
|
-
|
|
193
|
+
style: (0, _defineProperty2.default)({}, CSS_VAR_ICON_COLOR, iconColor),
|
|
194
|
+
"data-testid": testId && "".concat(testId, "-icon-container")
|
|
195
|
+
}, icon || (iconGlyph && (0, _platformFeatureFlags.fg)('platform_ads_component_no_icon_spacing_support') ? iconGlyph : null)), (0, _react2.jsx)("span", {
|
|
184
196
|
css: transitionStyles
|
|
185
197
|
}, (0, _react2.jsx)(_primitives.Stack, {
|
|
186
198
|
space: shouldRenderGap ? 'space.100' : 'space.0' // Gap exists even when not expanded due to Expander internals always being in the DOM
|
package/dist/cjs/theme.js
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
|
-
exports.flagTextColorToken = exports.flagTextColor = exports.flagIconColor = exports.flagBackgroundColor = exports.actionTextColor = exports.actionBackgroundColor = void 0;
|
|
7
|
+
exports.flagTextColorToken = exports.flagTextColor = exports.flagIconGlyph = exports.flagIconColor = exports.flagBackgroundColor = exports.actionTextColor = exports.actionBackgroundColor = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _error = _interopRequireDefault(require("@atlaskit/icon/core/migration/error"));
|
|
10
|
+
var _informationInfo = _interopRequireDefault(require("@atlaskit/icon/core/migration/information--info"));
|
|
11
|
+
var _successCheckCircle = _interopRequireDefault(require("@atlaskit/icon/core/migration/success--check-circle"));
|
|
12
|
+
var _warning = _interopRequireDefault(require("@atlaskit/icon/core/migration/warning"));
|
|
7
13
|
var _colors = require("@atlaskit/theme/colors");
|
|
8
14
|
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
9
15
|
|
|
@@ -15,11 +21,38 @@ var flagBackgroundColor = exports.flagBackgroundColor = {
|
|
|
15
21
|
warning: 'color.background.warning.bold'
|
|
16
22
|
};
|
|
17
23
|
var flagIconColor = exports.flagIconColor = {
|
|
18
|
-
error: "var(--ds-icon-inverse,
|
|
19
|
-
info: "var(--ds-icon-inverse,
|
|
20
|
-
normal: "var(--ds-icon-subtle,
|
|
21
|
-
success: "var(--ds-icon-inverse,
|
|
22
|
-
warning: "var(--ds-icon-warning-inverse,
|
|
24
|
+
error: "var(--ds-icon-inverse, #FFFFFF)",
|
|
25
|
+
info: "var(--ds-icon-inverse, #FFFFFF)",
|
|
26
|
+
normal: "var(--ds-icon-subtle, #626F86)",
|
|
27
|
+
success: "var(--ds-icon-inverse, #FFFFFF)",
|
|
28
|
+
warning: "var(--ds-icon-warning-inverse, #172B4D)"
|
|
29
|
+
};
|
|
30
|
+
var flagIconGlyph = exports.flagIconGlyph = {
|
|
31
|
+
error: /*#__PURE__*/_react.default.createElement(_error.default, {
|
|
32
|
+
label: "",
|
|
33
|
+
LEGACY_primaryColor: "var(--ds-icon-inverse, ".concat(_colors.N0, ")"),
|
|
34
|
+
LEGACY_secondaryColor: "var(--ds-background-danger-bold, #C9372C)"
|
|
35
|
+
}),
|
|
36
|
+
info: /*#__PURE__*/_react.default.createElement(_informationInfo.default, {
|
|
37
|
+
label: "",
|
|
38
|
+
LEGACY_primaryColor: "var(--ds-icon-inverse, ".concat(_colors.N0, ")"),
|
|
39
|
+
LEGACY_secondaryColor: "var(--ds-background-neutral-bold, #44546F)"
|
|
40
|
+
}),
|
|
41
|
+
normal: /*#__PURE__*/_react.default.createElement(_informationInfo.default, {
|
|
42
|
+
label: "",
|
|
43
|
+
LEGACY_primaryColor: "var(--ds-icon-subtle, ".concat(_colors.N500, ")"),
|
|
44
|
+
LEGACY_secondaryColor: "var(--ds-surface-overlay, #FFFFFF)"
|
|
45
|
+
}),
|
|
46
|
+
success: /*#__PURE__*/_react.default.createElement(_successCheckCircle.default, {
|
|
47
|
+
label: "",
|
|
48
|
+
LEGACY_primaryColor: "var(--ds-icon-inverse, ".concat(_colors.N0, ")"),
|
|
49
|
+
LEGACY_secondaryColor: "var(--ds-background-success-bold, #1F845A)"
|
|
50
|
+
}),
|
|
51
|
+
warning: /*#__PURE__*/_react.default.createElement(_warning.default, {
|
|
52
|
+
label: "",
|
|
53
|
+
LEGACY_primaryColor: "var(--ds-icon-warning-inverse, ".concat(_colors.N700, ")"),
|
|
54
|
+
LEGACY_secondaryColor: "var(--ds-background-warning-bold, #F5CD47)"
|
|
55
|
+
})
|
|
23
56
|
};
|
|
24
57
|
|
|
25
58
|
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
@@ -5,7 +5,7 @@ import noop from '@atlaskit/ds-lib/noop';
|
|
|
5
5
|
import Flag from './flag';
|
|
6
6
|
import { useFlagGroup } from './flag-group';
|
|
7
7
|
const packageName = "@atlaskit/flag";
|
|
8
|
-
const packageVersion = "16.
|
|
8
|
+
const packageVersion = "16.1.1";
|
|
9
9
|
export const AUTO_DISMISS_SECONDS = 8;
|
|
10
10
|
|
|
11
11
|
/**
|
package/dist/es2019/flag.js
CHANGED
|
@@ -10,13 +10,14 @@ import { css, jsx } from '@emotion/react';
|
|
|
10
10
|
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatformLeafEventHandler';
|
|
11
11
|
import noop from '@atlaskit/ds-lib/noop';
|
|
12
12
|
import Heading from '@atlaskit/heading';
|
|
13
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
14
|
import { Box, Inline, Stack, xcss } from '@atlaskit/primitives';
|
|
14
15
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
15
16
|
import { DEFAULT_APPEARANCE } from './constants';
|
|
16
17
|
import Actions from './flag-actions';
|
|
17
18
|
import { useFlagGroup } from './flag-group';
|
|
18
19
|
import { DismissButton, Expander } from './internal';
|
|
19
|
-
import { flagBackgroundColor, flagIconColor, flagTextColor, flagTextColorToken } from './theme';
|
|
20
|
+
import { flagBackgroundColor, flagIconColor, flagIconGlyph, flagTextColor, flagTextColorToken } from './theme';
|
|
20
21
|
const CSS_VAR_ICON_COLOR = '--flag-icon-color';
|
|
21
22
|
|
|
22
23
|
// For cases where a single word is longer than the container (e.g. filenames)
|
|
@@ -29,12 +30,21 @@ const descriptionStyles = css({
|
|
|
29
30
|
overflow: 'auto',
|
|
30
31
|
overflowWrap: 'anywhere' // For cases where a single word is longer than the container (e.g. filenames)
|
|
31
32
|
});
|
|
32
|
-
const
|
|
33
|
+
const oldIconWrapperStyles = css({
|
|
33
34
|
display: 'flex',
|
|
34
35
|
alignItems: 'start',
|
|
35
36
|
flexShrink: 0,
|
|
36
37
|
color: `var(${CSS_VAR_ICON_COLOR})`
|
|
37
38
|
});
|
|
39
|
+
const iconWrapperStyles = css({
|
|
40
|
+
display: 'flex',
|
|
41
|
+
minWidth: '24px',
|
|
42
|
+
minHeight: '24px',
|
|
43
|
+
alignItems: 'center',
|
|
44
|
+
justifyContent: 'center',
|
|
45
|
+
flexShrink: 0,
|
|
46
|
+
color: `var(${CSS_VAR_ICON_COLOR})`
|
|
47
|
+
});
|
|
38
48
|
const flagStyles = xcss({
|
|
39
49
|
boxShadow: 'elevation.shadow.overlay',
|
|
40
50
|
borderRadius: 'border.radius.100',
|
|
@@ -49,7 +59,7 @@ const flagWrapperStyles = css({
|
|
|
49
59
|
const analyticsAttributes = {
|
|
50
60
|
componentName: 'flag',
|
|
51
61
|
packageName: "@atlaskit/flag",
|
|
52
|
-
packageVersion: "16.
|
|
62
|
+
packageVersion: "16.1.1"
|
|
53
63
|
};
|
|
54
64
|
const transitionStyles = css({
|
|
55
65
|
flexGrow: 1,
|
|
@@ -144,6 +154,7 @@ const Flag = props => {
|
|
|
144
154
|
};
|
|
145
155
|
const textColor = flagTextColor[appearance];
|
|
146
156
|
const iconColor = flagIconColor[appearance];
|
|
157
|
+
const iconGlyph = flagIconGlyph[appearance];
|
|
147
158
|
const isDismissable = isBold || isDismissAllowed;
|
|
148
159
|
const shouldRenderGap = !isBold && (description || actions.length) || isExpanded;
|
|
149
160
|
// when delayAnnouncement is available we will use a hidden content for announcement
|
|
@@ -157,16 +168,17 @@ const Flag = props => {
|
|
|
157
168
|
padding: "space.200",
|
|
158
169
|
xcss: flagStyles
|
|
159
170
|
}, jsx(Inline, {
|
|
160
|
-
alignBlock:
|
|
171
|
+
alignBlock: fg('platform_ads_component_no_icon_spacing_support') ? 'start' : 'stretch',
|
|
161
172
|
space: "space.200"
|
|
162
173
|
}, jsx("div", {
|
|
163
|
-
css: iconWrapperStyles
|
|
174
|
+
css: fg('platform_ads_component_no_icon_spacing_support') ? iconWrapperStyles : oldIconWrapperStyles
|
|
164
175
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
165
176
|
,
|
|
166
177
|
style: {
|
|
167
178
|
[CSS_VAR_ICON_COLOR]: iconColor
|
|
168
|
-
}
|
|
169
|
-
|
|
179
|
+
},
|
|
180
|
+
"data-testid": testId && `${testId}-icon-container`
|
|
181
|
+
}, icon || (iconGlyph && fg('platform_ads_component_no_icon_spacing_support') ? iconGlyph : null)), jsx("span", {
|
|
170
182
|
css: transitionStyles
|
|
171
183
|
}, jsx(Stack, {
|
|
172
184
|
space: shouldRenderGap ? 'space.100' : 'space.0' // Gap exists even when not expanded due to Expander internals always being in the DOM
|
package/dist/es2019/theme.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
|
|
3
|
+
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
4
|
+
import ErrorIcon from '@atlaskit/icon/core/migration/error';
|
|
5
|
+
import InformationIcon from '@atlaskit/icon/core/migration/information--info';
|
|
6
|
+
import SuccessIcon from '@atlaskit/icon/core/migration/success--check-circle';
|
|
7
|
+
import WarningIcon from '@atlaskit/icon/core/migration/warning';
|
|
3
8
|
import { B400, N0, N30A, N500, N700, N800 } from '@atlaskit/theme/colors';
|
|
4
9
|
export const flagBackgroundColor = {
|
|
5
10
|
error: 'color.background.danger.bold',
|
|
@@ -9,11 +14,38 @@ export const flagBackgroundColor = {
|
|
|
9
14
|
warning: 'color.background.warning.bold'
|
|
10
15
|
};
|
|
11
16
|
export const flagIconColor = {
|
|
12
|
-
error:
|
|
13
|
-
info:
|
|
14
|
-
normal:
|
|
15
|
-
success:
|
|
16
|
-
warning:
|
|
17
|
+
error: "var(--ds-icon-inverse, #FFFFFF)",
|
|
18
|
+
info: "var(--ds-icon-inverse, #FFFFFF)",
|
|
19
|
+
normal: "var(--ds-icon-subtle, #626F86)",
|
|
20
|
+
success: "var(--ds-icon-inverse, #FFFFFF)",
|
|
21
|
+
warning: "var(--ds-icon-warning-inverse, #172B4D)"
|
|
22
|
+
};
|
|
23
|
+
export const flagIconGlyph = {
|
|
24
|
+
error: /*#__PURE__*/React.createElement(ErrorIcon, {
|
|
25
|
+
label: "",
|
|
26
|
+
LEGACY_primaryColor: `var(--ds-icon-inverse, ${N0})`,
|
|
27
|
+
LEGACY_secondaryColor: "var(--ds-background-danger-bold, #C9372C)"
|
|
28
|
+
}),
|
|
29
|
+
info: /*#__PURE__*/React.createElement(InformationIcon, {
|
|
30
|
+
label: "",
|
|
31
|
+
LEGACY_primaryColor: `var(--ds-icon-inverse, ${N0})`,
|
|
32
|
+
LEGACY_secondaryColor: "var(--ds-background-neutral-bold, #44546F)"
|
|
33
|
+
}),
|
|
34
|
+
normal: /*#__PURE__*/React.createElement(InformationIcon, {
|
|
35
|
+
label: "",
|
|
36
|
+
LEGACY_primaryColor: `var(--ds-icon-subtle, ${N500})`,
|
|
37
|
+
LEGACY_secondaryColor: "var(--ds-surface-overlay, #FFFFFF)"
|
|
38
|
+
}),
|
|
39
|
+
success: /*#__PURE__*/React.createElement(SuccessIcon, {
|
|
40
|
+
label: "",
|
|
41
|
+
LEGACY_primaryColor: `var(--ds-icon-inverse, ${N0})`,
|
|
42
|
+
LEGACY_secondaryColor: "var(--ds-background-success-bold, #1F845A)"
|
|
43
|
+
}),
|
|
44
|
+
warning: /*#__PURE__*/React.createElement(WarningIcon, {
|
|
45
|
+
label: "",
|
|
46
|
+
LEGACY_primaryColor: `var(--ds-icon-warning-inverse, ${N700})`,
|
|
47
|
+
LEGACY_secondaryColor: "var(--ds-background-warning-bold, #F5CD47)"
|
|
48
|
+
})
|
|
17
49
|
};
|
|
18
50
|
|
|
19
51
|
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
@@ -5,7 +5,7 @@ import noop from '@atlaskit/ds-lib/noop';
|
|
|
5
5
|
import Flag from './flag';
|
|
6
6
|
import { useFlagGroup } from './flag-group';
|
|
7
7
|
var packageName = "@atlaskit/flag";
|
|
8
|
-
var packageVersion = "16.
|
|
8
|
+
var packageVersion = "16.1.1";
|
|
9
9
|
export var AUTO_DISMISS_SECONDS = 8;
|
|
10
10
|
|
|
11
11
|
/**
|
package/dist/esm/flag.js
CHANGED
|
@@ -14,13 +14,14 @@ import { css, jsx } from '@emotion/react';
|
|
|
14
14
|
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatformLeafEventHandler';
|
|
15
15
|
import noop from '@atlaskit/ds-lib/noop';
|
|
16
16
|
import Heading from '@atlaskit/heading';
|
|
17
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
17
18
|
import { Box, Inline, Stack, xcss } from '@atlaskit/primitives';
|
|
18
19
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
19
20
|
import { DEFAULT_APPEARANCE } from './constants';
|
|
20
21
|
import Actions from './flag-actions';
|
|
21
22
|
import { useFlagGroup } from './flag-group';
|
|
22
23
|
import { DismissButton, Expander } from './internal';
|
|
23
|
-
import { flagBackgroundColor, flagIconColor, flagTextColor, flagTextColorToken } from './theme';
|
|
24
|
+
import { flagBackgroundColor, flagIconColor, flagIconGlyph, flagTextColor, flagTextColorToken } from './theme';
|
|
24
25
|
var CSS_VAR_ICON_COLOR = '--flag-icon-color';
|
|
25
26
|
|
|
26
27
|
// For cases where a single word is longer than the container (e.g. filenames)
|
|
@@ -33,12 +34,21 @@ var descriptionStyles = css({
|
|
|
33
34
|
overflow: 'auto',
|
|
34
35
|
overflowWrap: 'anywhere' // For cases where a single word is longer than the container (e.g. filenames)
|
|
35
36
|
});
|
|
36
|
-
var
|
|
37
|
+
var oldIconWrapperStyles = css({
|
|
37
38
|
display: 'flex',
|
|
38
39
|
alignItems: 'start',
|
|
39
40
|
flexShrink: 0,
|
|
40
41
|
color: "var(".concat(CSS_VAR_ICON_COLOR, ")")
|
|
41
42
|
});
|
|
43
|
+
var iconWrapperStyles = css({
|
|
44
|
+
display: 'flex',
|
|
45
|
+
minWidth: '24px',
|
|
46
|
+
minHeight: '24px',
|
|
47
|
+
alignItems: 'center',
|
|
48
|
+
justifyContent: 'center',
|
|
49
|
+
flexShrink: 0,
|
|
50
|
+
color: "var(".concat(CSS_VAR_ICON_COLOR, ")")
|
|
51
|
+
});
|
|
42
52
|
var flagStyles = xcss({
|
|
43
53
|
boxShadow: 'elevation.shadow.overlay',
|
|
44
54
|
borderRadius: 'border.radius.100',
|
|
@@ -53,7 +63,7 @@ var flagWrapperStyles = css({
|
|
|
53
63
|
var analyticsAttributes = {
|
|
54
64
|
componentName: 'flag',
|
|
55
65
|
packageName: "@atlaskit/flag",
|
|
56
|
-
packageVersion: "16.
|
|
66
|
+
packageVersion: "16.1.1"
|
|
57
67
|
};
|
|
58
68
|
var transitionStyles = css({
|
|
59
69
|
flexGrow: 1,
|
|
@@ -156,6 +166,7 @@ var Flag = function Flag(props) {
|
|
|
156
166
|
};
|
|
157
167
|
var textColor = flagTextColor[appearance];
|
|
158
168
|
var iconColor = flagIconColor[appearance];
|
|
169
|
+
var iconGlyph = flagIconGlyph[appearance];
|
|
159
170
|
var isDismissable = isBold || isDismissAllowed;
|
|
160
171
|
var shouldRenderGap = !isBold && (description || actions.length) || isExpanded;
|
|
161
172
|
// when delayAnnouncement is available we will use a hidden content for announcement
|
|
@@ -169,14 +180,15 @@ var Flag = function Flag(props) {
|
|
|
169
180
|
padding: "space.200",
|
|
170
181
|
xcss: flagStyles
|
|
171
182
|
}, jsx(Inline, {
|
|
172
|
-
alignBlock:
|
|
183
|
+
alignBlock: fg('platform_ads_component_no_icon_spacing_support') ? 'start' : 'stretch',
|
|
173
184
|
space: "space.200"
|
|
174
185
|
}, jsx("div", {
|
|
175
|
-
css: iconWrapperStyles
|
|
186
|
+
css: fg('platform_ads_component_no_icon_spacing_support') ? iconWrapperStyles : oldIconWrapperStyles
|
|
176
187
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
177
188
|
,
|
|
178
|
-
style: _defineProperty({}, CSS_VAR_ICON_COLOR, iconColor)
|
|
179
|
-
|
|
189
|
+
style: _defineProperty({}, CSS_VAR_ICON_COLOR, iconColor),
|
|
190
|
+
"data-testid": testId && "".concat(testId, "-icon-container")
|
|
191
|
+
}, icon || (iconGlyph && fg('platform_ads_component_no_icon_spacing_support') ? iconGlyph : null)), jsx("span", {
|
|
180
192
|
css: transitionStyles
|
|
181
193
|
}, jsx(Stack, {
|
|
182
194
|
space: shouldRenderGap ? 'space.100' : 'space.0' // Gap exists even when not expanded due to Expander internals always being in the DOM
|
package/dist/esm/theme.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
|
|
3
|
+
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
4
|
+
import ErrorIcon from '@atlaskit/icon/core/migration/error';
|
|
5
|
+
import InformationIcon from '@atlaskit/icon/core/migration/information--info';
|
|
6
|
+
import SuccessIcon from '@atlaskit/icon/core/migration/success--check-circle';
|
|
7
|
+
import WarningIcon from '@atlaskit/icon/core/migration/warning';
|
|
3
8
|
import { B400, N0, N30A, N500, N700, N800 } from '@atlaskit/theme/colors';
|
|
4
9
|
export var flagBackgroundColor = {
|
|
5
10
|
error: 'color.background.danger.bold',
|
|
@@ -9,11 +14,38 @@ export var flagBackgroundColor = {
|
|
|
9
14
|
warning: 'color.background.warning.bold'
|
|
10
15
|
};
|
|
11
16
|
export var flagIconColor = {
|
|
12
|
-
error: "var(--ds-icon-inverse,
|
|
13
|
-
info: "var(--ds-icon-inverse,
|
|
14
|
-
normal: "var(--ds-icon-subtle,
|
|
15
|
-
success: "var(--ds-icon-inverse,
|
|
16
|
-
warning: "var(--ds-icon-warning-inverse,
|
|
17
|
+
error: "var(--ds-icon-inverse, #FFFFFF)",
|
|
18
|
+
info: "var(--ds-icon-inverse, #FFFFFF)",
|
|
19
|
+
normal: "var(--ds-icon-subtle, #626F86)",
|
|
20
|
+
success: "var(--ds-icon-inverse, #FFFFFF)",
|
|
21
|
+
warning: "var(--ds-icon-warning-inverse, #172B4D)"
|
|
22
|
+
};
|
|
23
|
+
export var flagIconGlyph = {
|
|
24
|
+
error: /*#__PURE__*/React.createElement(ErrorIcon, {
|
|
25
|
+
label: "",
|
|
26
|
+
LEGACY_primaryColor: "var(--ds-icon-inverse, ".concat(N0, ")"),
|
|
27
|
+
LEGACY_secondaryColor: "var(--ds-background-danger-bold, #C9372C)"
|
|
28
|
+
}),
|
|
29
|
+
info: /*#__PURE__*/React.createElement(InformationIcon, {
|
|
30
|
+
label: "",
|
|
31
|
+
LEGACY_primaryColor: "var(--ds-icon-inverse, ".concat(N0, ")"),
|
|
32
|
+
LEGACY_secondaryColor: "var(--ds-background-neutral-bold, #44546F)"
|
|
33
|
+
}),
|
|
34
|
+
normal: /*#__PURE__*/React.createElement(InformationIcon, {
|
|
35
|
+
label: "",
|
|
36
|
+
LEGACY_primaryColor: "var(--ds-icon-subtle, ".concat(N500, ")"),
|
|
37
|
+
LEGACY_secondaryColor: "var(--ds-surface-overlay, #FFFFFF)"
|
|
38
|
+
}),
|
|
39
|
+
success: /*#__PURE__*/React.createElement(SuccessIcon, {
|
|
40
|
+
label: "",
|
|
41
|
+
LEGACY_primaryColor: "var(--ds-icon-inverse, ".concat(N0, ")"),
|
|
42
|
+
LEGACY_secondaryColor: "var(--ds-background-success-bold, #1F845A)"
|
|
43
|
+
}),
|
|
44
|
+
warning: /*#__PURE__*/React.createElement(WarningIcon, {
|
|
45
|
+
label: "",
|
|
46
|
+
LEGACY_primaryColor: "var(--ds-icon-warning-inverse, ".concat(N700, ")"),
|
|
47
|
+
LEGACY_secondaryColor: "var(--ds-background-warning-bold, #F5CD47)"
|
|
48
|
+
})
|
|
17
49
|
};
|
|
18
50
|
|
|
19
51
|
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
@@ -30,5 +30,5 @@ export declare function FlagsProvider({ children, shouldRenderToParent, }: {
|
|
|
30
30
|
children: React.ReactNode;
|
|
31
31
|
shouldRenderToParent?: boolean;
|
|
32
32
|
}): React.JSX.Element;
|
|
33
|
-
export declare const withFlagsProvider: (fn: () => React.ReactNode) => React.
|
|
33
|
+
export declare const withFlagsProvider: (fn: () => React.ReactNode) => React.JSX.Element;
|
|
34
34
|
export {};
|
package/dist/types/theme.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { type ReactElement } from 'react';
|
|
1
2
|
import { type BackgroundColor } from '@atlaskit/primitives';
|
|
2
3
|
import { type AppearanceTypes, type HeadingColor } from './types';
|
|
3
4
|
export declare const flagBackgroundColor: Record<AppearanceTypes, BackgroundColor>;
|
|
4
5
|
export declare const flagIconColor: Record<AppearanceTypes, string>;
|
|
6
|
+
export declare const flagIconGlyph: Record<AppearanceTypes, ReactElement>;
|
|
5
7
|
export declare const flagTextColor: Record<AppearanceTypes, HeadingColor>;
|
|
6
8
|
export declare const flagTextColorToken: {
|
|
7
9
|
error: "var(--ds-text-inverse)";
|
package/dist/types/types.d.ts
CHANGED
|
@@ -37,10 +37,11 @@ type AutoDismissFlagPropsWithoutId = {
|
|
|
37
37
|
description?: ReactNode;
|
|
38
38
|
/**
|
|
39
39
|
* The icon displayed in the top-left of the flag. Should be an instance of `@atlaskit/icon`.
|
|
40
|
-
* Your icon will receive the appropriate default color, which you can override by
|
|
41
|
-
*
|
|
40
|
+
* Your icon will receive the appropriate default color, which you can override by setting
|
|
41
|
+
* the `color` prop on the icon to your preferred icon color.
|
|
42
|
+
* If no icon is provided, a default icon will be used based on the appearance prop.
|
|
42
43
|
*/
|
|
43
|
-
icon
|
|
44
|
+
icon?: ReactNode;
|
|
44
45
|
/**
|
|
45
46
|
* The bold text shown at the top of the flag.
|
|
46
47
|
*/
|
|
@@ -30,5 +30,5 @@ export declare function FlagsProvider({ children, shouldRenderToParent, }: {
|
|
|
30
30
|
children: React.ReactNode;
|
|
31
31
|
shouldRenderToParent?: boolean;
|
|
32
32
|
}): React.JSX.Element;
|
|
33
|
-
export declare const withFlagsProvider: (fn: () => React.ReactNode) => React.
|
|
33
|
+
export declare const withFlagsProvider: (fn: () => React.ReactNode) => React.JSX.Element;
|
|
34
34
|
export {};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { type ReactElement } from 'react';
|
|
1
2
|
import { type BackgroundColor } from '@atlaskit/primitives';
|
|
2
3
|
import { type AppearanceTypes, type HeadingColor } from './types';
|
|
3
4
|
export declare const flagBackgroundColor: Record<AppearanceTypes, BackgroundColor>;
|
|
4
5
|
export declare const flagIconColor: Record<AppearanceTypes, string>;
|
|
6
|
+
export declare const flagIconGlyph: Record<AppearanceTypes, ReactElement>;
|
|
5
7
|
export declare const flagTextColor: Record<AppearanceTypes, HeadingColor>;
|
|
6
8
|
export declare const flagTextColorToken: {
|
|
7
9
|
error: "var(--ds-text-inverse)";
|
|
@@ -37,10 +37,11 @@ type AutoDismissFlagPropsWithoutId = {
|
|
|
37
37
|
description?: ReactNode;
|
|
38
38
|
/**
|
|
39
39
|
* The icon displayed in the top-left of the flag. Should be an instance of `@atlaskit/icon`.
|
|
40
|
-
* Your icon will receive the appropriate default color, which you can override by
|
|
41
|
-
*
|
|
40
|
+
* Your icon will receive the appropriate default color, which you can override by setting
|
|
41
|
+
* the `color` prop on the icon to your preferred icon color.
|
|
42
|
+
* If no icon is provided, a default icon will be used based on the appearance prop.
|
|
42
43
|
*/
|
|
43
|
-
icon
|
|
44
|
+
icon?: ReactNode;
|
|
44
45
|
/**
|
|
45
46
|
* The bold text shown at the top of the flag.
|
|
46
47
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/flag",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.1.1",
|
|
4
4
|
"description": "A flag is used for confirmations, alerts, and acknowledgments that require minimal user interaction, often displayed using a flag group.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -45,15 +45,16 @@
|
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@atlaskit/analytics-next": "^11.0.0",
|
|
48
|
-
"@atlaskit/button": "^21.
|
|
48
|
+
"@atlaskit/button": "^21.1.0",
|
|
49
49
|
"@atlaskit/ds-lib": "^4.0.0",
|
|
50
|
-
"@atlaskit/heading": "^5.
|
|
51
|
-
"@atlaskit/icon": "^24.
|
|
52
|
-
"@atlaskit/motion": "^
|
|
50
|
+
"@atlaskit/heading": "^5.1.0",
|
|
51
|
+
"@atlaskit/icon": "^24.1.0",
|
|
52
|
+
"@atlaskit/motion": "^5.0.0",
|
|
53
|
+
"@atlaskit/platform-feature-flags": "1.1.0",
|
|
53
54
|
"@atlaskit/portal": "^5.0.0",
|
|
54
|
-
"@atlaskit/primitives": "^14.
|
|
55
|
+
"@atlaskit/primitives": "^14.1.0",
|
|
55
56
|
"@atlaskit/theme": "^17.0.0",
|
|
56
|
-
"@atlaskit/tokens": "^4.
|
|
57
|
+
"@atlaskit/tokens": "^4.2.0",
|
|
57
58
|
"@atlaskit/visually-hidden": "^2.0.0",
|
|
58
59
|
"@babel/runtime": "^7.0.0",
|
|
59
60
|
"@emotion/react": "^11.7.1"
|
|
@@ -73,6 +74,7 @@
|
|
|
73
74
|
"@atlaskit/spinner": "^18.0.0",
|
|
74
75
|
"@atlaskit/ssr": "*",
|
|
75
76
|
"@atlaskit/visual-regression": "*",
|
|
77
|
+
"@atlassian/feature-flags-test-utils": "*",
|
|
76
78
|
"@emotion/jest": "^11.8.0",
|
|
77
79
|
"@testing-library/react": "^13.4.0",
|
|
78
80
|
"react-dom": "^18.2.0",
|
|
@@ -108,5 +110,10 @@
|
|
|
108
110
|
]
|
|
109
111
|
}
|
|
110
112
|
},
|
|
111
|
-
"homepage": "https://atlassian.design/components/flag/"
|
|
113
|
+
"homepage": "https://atlassian.design/components/flag/",
|
|
114
|
+
"platform-feature-flags": {
|
|
115
|
+
"platform_ads_component_no_icon_spacing_support": {
|
|
116
|
+
"type": "boolean"
|
|
117
|
+
}
|
|
118
|
+
}
|
|
112
119
|
}
|