@atlaskit/flag 14.5.8 → 14.6.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 CHANGED
@@ -1,5 +1,29 @@
1
1
  # @atlaskit/flag
2
2
 
3
+ ## 14.6.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`45ebe7af434`](https://bitbucket.org/atlassian/atlassian-frontend/commits/45ebe7af434) - Moved to using declarative entrypoints internally. Public API is unchanged.
8
+ - Updated dependencies
9
+
10
+ ## 14.6.0
11
+
12
+ ### Minor Changes
13
+
14
+ - [`379b0a864df`](https://bitbucket.org/atlassian/atlassian-frontend/commits/379b0a864df) - [ux] Remove truncation of titles and wrap text instead. Very slightly changed title text positioning.
15
+
16
+ ### Patch Changes
17
+
18
+ - [`f16146d83ff`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f16146d83ff) - [ux] Fix cross icon positioning
19
+ - Updated dependencies
20
+
21
+ ## 14.5.9
22
+
23
+ ### Patch Changes
24
+
25
+ - [`2329b0e8cc0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2329b0e8cc0) - [ux] DSP-4541 Update wrongly used tokens
26
+
3
27
  ## 14.5.8
4
28
 
5
29
  ### Patch Changes
@@ -26,7 +26,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
26
26
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
27
27
 
28
28
  var packageName = "@atlaskit/flag";
29
- var packageVersion = "14.5.8";
29
+ var packageVersion = "14.6.1";
30
30
  var AUTO_DISMISS_SECONDS = 8;
31
31
  exports.AUTO_DISMISS_SECONDS = AUTO_DISMISS_SECONDS;
32
32
 
package/dist/cjs/flag.js CHANGED
@@ -44,15 +44,19 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
44
44
  var analyticsAttributes = {
45
45
  componentName: 'flag',
46
46
  packageName: "@atlaskit/flag",
47
- packageVersion: "14.5.8"
47
+ packageVersion: "14.6.1"
48
48
  };
49
49
  var gridSize = (0, _constants.gridSize)();
50
50
  var doubleGridSize = gridSize * 2;
51
- var headerHeight = gridSize * 4;
52
- var iconStyles = (0, _core.css)({
51
+ var titleGroupStyles = (0, _core.css)({
53
52
  display: 'flex',
54
- height: headerHeight,
55
- alignItems: 'center'
53
+ alignItems: 'start'
54
+ });
55
+ var iconTitleStyles = (0, _core.css)({
56
+ display: 'flex',
57
+ paddingTop: "".concat(gridSize / 2, "px"),
58
+ alignItems: 'start',
59
+ flex: 1
56
60
  });
57
61
  var flagHeaderStyles = (0, _core.css)({
58
62
  boxSizing: 'border-box',
@@ -140,12 +144,14 @@ var Flag = function Flag(props) {
140
144
  onMouseOut: onMouseOut,
141
145
  onBlur: onBlurAnalytics
142
146
  };
143
- var boxShadow = "var(--ds-shadow-overlay, ".concat("0 20px 32px -8px ".concat(_theme.flagShadowColor), ")");
147
+ var boxShadowValue = "0 20px 32px -8px ".concat(_theme.flagShadowColor);
144
148
 
145
149
  if (!isBold) {
146
- boxShadow = "var(--ds-shadow-overlay, ".concat("0 0 1px ".concat(_theme.flagBorderColor, ", ").concat(boxShadow), ")");
150
+ boxShadowValue = "0 0 1px ".concat(_theme.flagBorderColor, ", ").concat(boxShadowValue);
147
151
  }
148
152
 
153
+ var boxShadow = "var(--ds-shadow-overlay, ".concat(boxShadowValue, ")");
154
+
149
155
  var _useGlobalTheme = (0, _components.useGlobalTheme)(),
150
156
  mode = _useGlobalTheme.mode;
151
157
 
@@ -169,10 +175,12 @@ var Flag = function Flag(props) {
169
175
  style: {
170
176
  color: iconColor
171
177
  },
172
- css: iconStyles
178
+ css: titleGroupStyles
179
+ }, (0, _core.jsx)("div", {
180
+ css: iconTitleStyles
173
181
  }, icon, (0, _core.jsx)(_internal.Title, {
174
182
  color: textColor
175
- }, title), isDismissable ? !(isBold && !description && !actions.length) && (0, _core.jsx)(_internal.DismissButton, {
183
+ }, title)), isDismissable ? !(isBold && !description && !actions.length) && (0, _core.jsx)(_internal.DismissButton, {
176
184
  testId: testId,
177
185
  appearance: appearance,
178
186
  isBold: isBold,
@@ -183,7 +191,8 @@ var Flag = function Flag(props) {
183
191
  testId: testId
184
192
  }, description && (0, _core.jsx)(_internal.Description, {
185
193
  testId: testId && "".concat(testId, "-description"),
186
- color: textColor
194
+ color: textColor,
195
+ isBold: isBold
187
196
  }, description), (0, _core.jsx)(_flagActions.default, {
188
197
  actions: actions,
189
198
  appearance: appearance,
@@ -9,8 +9,8 @@ var _core = require("@emotion/core");
9
9
 
10
10
  /** @jsx jsx */
11
11
  var descriptionStyles = (0, _core.css)({
12
- /* height is defined as 5 lines maximum by design */
13
12
  maxHeight: 100,
13
+ // height is defined as 5 lines maximum by design
14
14
  overflow: 'auto',
15
15
  wordWrap: 'break-word'
16
16
  });
@@ -18,12 +18,13 @@ var descriptionStyles = (0, _core.css)({
18
18
  var Description = function Description(_ref) {
19
19
  var color = _ref.color,
20
20
  testId = _ref.testId,
21
- children = _ref.children;
21
+ children = _ref.children,
22
+ isBold = _ref.isBold;
22
23
  return (0, _core.jsx)("div", {
23
24
  style: {
24
25
  color: color
25
26
  },
26
- css: descriptionStyles,
27
+ css: [descriptionStyles],
27
28
  "data-testid": testId
28
29
  }, children);
29
30
  };
@@ -40,6 +40,9 @@ var dismissButtonStyles = (0, _core.css)({
40
40
  lineHeight: '1',
41
41
  whiteSpace: 'nowrap'
42
42
  });
43
+ var crossIconStyles = (0, _core.css)({
44
+ paddingTop: "".concat(gridSize, "px")
45
+ });
43
46
 
44
47
  var DismissButton = function DismissButton(_ref) {
45
48
  var appearance = _ref.appearance,
@@ -67,7 +70,7 @@ var DismissButton = function DismissButton(_ref) {
67
70
  style: {
68
71
  color: (0, _theme.getFlagTextColor)(appearance, mode)
69
72
  },
70
- css: dismissButtonStyles,
73
+ css: [dismissButtonStyles, !isBold && crossIconStyles],
71
74
  onClick: onClick,
72
75
  "data-testid": buttonTestId,
73
76
  type: "button",
@@ -12,7 +12,8 @@ var _motion = require("@atlaskit/motion");
12
12
  var _constants = require("@atlaskit/theme/constants");
13
13
 
14
14
  /** @jsx jsx */
15
- var paddingLeft = (0, _constants.gridSize)() * 5;
15
+ var gridSize = (0, _constants.gridSize)();
16
+ var paddingLeft = gridSize * 5;
16
17
  var expanderStyles = (0, _core.css)({
17
18
  display: 'flex',
18
19
  minWidth: 0,
@@ -9,12 +9,9 @@ var _core = require("@emotion/core");
9
9
 
10
10
  /** @jsx jsx */
11
11
  var titleStyles = (0, _core.css)({
12
- padding: "0 0 0 16px",
12
+ padding: "2px 0 6px 16px",
13
13
  flex: 1,
14
- fontWeight: 600,
15
- overflow: 'hidden',
16
- textOverflow: 'ellipsis',
17
- whiteSpace: 'nowrap'
14
+ fontWeight: 600
18
15
  });
19
16
 
20
17
  var Title = function Title(_ref) {
package/dist/cjs/theme.js CHANGED
@@ -32,11 +32,18 @@ var flagBackgroundColor = {
32
32
 
33
33
  var getFlagBackgroundColor = function getFlagBackgroundColor(appearance, mode) {
34
34
  return flagBackgroundColor[appearance][mode];
35
- };
35
+ }; // token set in flag.tsx instead
36
+
37
+ /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
38
+
36
39
 
37
40
  exports.getFlagBackgroundColor = getFlagBackgroundColor;
38
- var flagBorderColor = "var(--ds-surface-overlay, ".concat(_colors.N60A, ")");
41
+ var flagBorderColor = _colors.N60A;
39
42
  exports.flagBorderColor = flagBorderColor;
43
+ var flagShadowColor = _colors.N50A;
44
+ /* eslint-enable @atlaskit/design-system/ensure-design-token-usage */
45
+
46
+ exports.flagShadowColor = flagShadowColor;
40
47
  var flagIconColor = {
41
48
  error: {
42
49
  light: "var(--ds-icon-inverse, ".concat(_colors.N0, ")"),
@@ -90,13 +97,9 @@ exports.getFlagTextColor = getFlagTextColor;
90
97
 
91
98
  var getFlagIconColor = function getFlagIconColor(appearance, mode) {
92
99
  return flagIconColor[appearance][mode];
93
- }; // token set in flag.tsx instead
94
- // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
95
-
100
+ };
96
101
 
97
102
  exports.getFlagIconColor = getFlagIconColor;
98
- var flagShadowColor = _colors.N50A;
99
- exports.flagShadowColor = flagShadowColor;
100
103
  var flagFocusRingColor = {
101
104
  error: {
102
105
  light: "var(--ds-border-focused, ".concat(_colors.N40, ")"),
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/flag",
3
- "version": "14.5.8",
3
+ "version": "14.6.1",
4
4
  "sideEffects": false
5
5
  }
@@ -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 = "14.5.8";
8
+ const packageVersion = "14.6.1";
9
9
  export const AUTO_DISMISS_SECONDS = 8;
10
10
 
11
11
  const AutoDismissFlag = props => {
@@ -16,15 +16,19 @@ import { Title, Description, Expander, DismissButton } from './internal';
16
16
  const analyticsAttributes = {
17
17
  componentName: 'flag',
18
18
  packageName: "@atlaskit/flag",
19
- packageVersion: "14.5.8"
19
+ packageVersion: "14.6.1"
20
20
  };
21
21
  const gridSize = getGridSize();
22
22
  const doubleGridSize = gridSize * 2;
23
- const headerHeight = gridSize * 4;
24
- const iconStyles = css({
23
+ const titleGroupStyles = css({
25
24
  display: 'flex',
26
- height: headerHeight,
27
- alignItems: 'center'
25
+ alignItems: 'start'
26
+ });
27
+ const iconTitleStyles = css({
28
+ display: 'flex',
29
+ paddingTop: `${gridSize / 2}px`,
30
+ alignItems: 'start',
31
+ flex: 1
28
32
  });
29
33
  const flagHeaderStyles = css({
30
34
  boxSizing: 'border-box',
@@ -104,12 +108,13 @@ const Flag = props => {
104
108
  onMouseOut,
105
109
  onBlur: onBlurAnalytics
106
110
  };
107
- let boxShadow = `var(--ds-shadow-overlay, ${`0 20px 32px -8px ${flagShadowColor}`})`;
111
+ let boxShadowValue = `0 20px 32px -8px ${flagShadowColor}`;
108
112
 
109
113
  if (!isBold) {
110
- boxShadow = `var(--ds-shadow-overlay, ${`0 0 1px ${flagBorderColor}, ${boxShadow}`})`;
114
+ boxShadowValue = `0 0 1px ${flagBorderColor}, ${boxShadowValue}`;
111
115
  }
112
116
 
117
+ const boxShadow = `var(--ds-shadow-overlay, ${boxShadowValue})`;
113
118
  const {
114
119
  mode
115
120
  } = useGlobalTheme();
@@ -133,10 +138,12 @@ const Flag = props => {
133
138
  style: {
134
139
  color: iconColor
135
140
  },
136
- css: iconStyles
141
+ css: titleGroupStyles
142
+ }, jsx("div", {
143
+ css: iconTitleStyles
137
144
  }, icon, jsx(Title, {
138
145
  color: textColor
139
- }, title), isDismissable ? !(isBold && !description && !actions.length) && jsx(DismissButton, {
146
+ }, title)), isDismissable ? !(isBold && !description && !actions.length) && jsx(DismissButton, {
140
147
  testId: testId,
141
148
  appearance: appearance,
142
149
  isBold: isBold,
@@ -147,7 +154,8 @@ const Flag = props => {
147
154
  testId: testId
148
155
  }, description && jsx(Description, {
149
156
  testId: testId && `${testId}-description`,
150
- color: textColor
157
+ color: textColor,
158
+ isBold: isBold
151
159
  }, description), jsx(Actions, {
152
160
  actions: actions,
153
161
  appearance: appearance,
@@ -1,8 +1,8 @@
1
1
  /** @jsx jsx */
2
2
  import { jsx, css } from '@emotion/core';
3
3
  const descriptionStyles = css({
4
- /* height is defined as 5 lines maximum by design */
5
4
  maxHeight: 100,
5
+ // height is defined as 5 lines maximum by design
6
6
  overflow: 'auto',
7
7
  wordWrap: 'break-word'
8
8
  });
@@ -10,12 +10,13 @@ const descriptionStyles = css({
10
10
  const Description = ({
11
11
  color,
12
12
  testId,
13
- children
13
+ children,
14
+ isBold
14
15
  }) => jsx("div", {
15
16
  style: {
16
17
  color
17
18
  },
18
- css: descriptionStyles,
19
+ css: [descriptionStyles],
19
20
  "data-testid": testId
20
21
  }, children);
21
22
 
@@ -22,6 +22,9 @@ const dismissButtonStyles = css({
22
22
  lineHeight: '1',
23
23
  whiteSpace: 'nowrap'
24
24
  });
25
+ const crossIconStyles = css({
26
+ paddingTop: `${gridSize}px`
27
+ });
25
28
 
26
29
  const DismissButton = ({
27
30
  appearance,
@@ -49,7 +52,7 @@ const DismissButton = ({
49
52
  style: {
50
53
  color: getFlagTextColor(appearance, mode)
51
54
  },
52
- css: dismissButtonStyles,
55
+ css: [dismissButtonStyles, !isBold && crossIconStyles],
53
56
  onClick: onClick,
54
57
  "data-testid": buttonTestId,
55
58
  type: "button",
@@ -1,8 +1,9 @@
1
1
  /** @jsx jsx */
2
2
  import { css, jsx } from '@emotion/core';
3
3
  import { ExitingPersistence, FadeIn } from '@atlaskit/motion';
4
- import { gridSize } from '@atlaskit/theme/constants';
5
- const paddingLeft = gridSize() * 5;
4
+ import { gridSize as getGridSize } from '@atlaskit/theme/constants';
5
+ const gridSize = getGridSize();
6
+ const paddingLeft = gridSize * 5;
6
7
  const expanderStyles = css({
7
8
  display: 'flex',
8
9
  minWidth: 0,
@@ -1,12 +1,9 @@
1
1
  /** @jsx jsx */
2
2
  import { jsx, css } from '@emotion/core';
3
3
  const titleStyles = css({
4
- padding: `0 0 0 16px`,
4
+ padding: `2px 0 6px 16px`,
5
5
  flex: 1,
6
- fontWeight: 600,
7
- overflow: 'hidden',
8
- textOverflow: 'ellipsis',
9
- whiteSpace: 'nowrap'
6
+ fontWeight: 600
10
7
  });
11
8
 
12
9
  const Title = ({
@@ -21,8 +21,14 @@ const flagBackgroundColor = {
21
21
  dark: `var(--ds-background-warning-bold, ${Y300})`
22
22
  }
23
23
  };
24
- export const getFlagBackgroundColor = (appearance, mode) => flagBackgroundColor[appearance][mode];
25
- export const flagBorderColor = `var(--ds-surface-overlay, ${N60A})`;
24
+ export const getFlagBackgroundColor = (appearance, mode) => flagBackgroundColor[appearance][mode]; // token set in flag.tsx instead
25
+
26
+ /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
27
+
28
+ export const flagBorderColor = N60A;
29
+ export const flagShadowColor = N50A;
30
+ /* eslint-enable @atlaskit/design-system/ensure-design-token-usage */
31
+
26
32
  const flagIconColor = {
27
33
  error: {
28
34
  light: `var(--ds-icon-inverse, ${N0})`,
@@ -68,10 +74,7 @@ const flagTextColor = {
68
74
  }
69
75
  };
70
76
  export const getFlagTextColor = (appearance, mode) => flagTextColor[appearance][mode];
71
- export const getFlagIconColor = (appearance, mode) => flagIconColor[appearance][mode]; // token set in flag.tsx instead
72
- // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
73
-
74
- export const flagShadowColor = N50A;
77
+ export const getFlagIconColor = (appearance, mode) => flagIconColor[appearance][mode];
75
78
  const flagFocusRingColor = {
76
79
  error: {
77
80
  light: `var(--ds-border-focused, ${N40})`,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/flag",
3
- "version": "14.5.8",
3
+ "version": "14.6.1",
4
4
  "sideEffects": false
5
5
  }
@@ -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 = "14.5.8";
8
+ var packageVersion = "14.6.1";
9
9
  export var AUTO_DISMISS_SECONDS = 8;
10
10
 
11
11
  var AutoDismissFlag = function AutoDismissFlag(props) {
package/dist/esm/flag.js CHANGED
@@ -22,15 +22,19 @@ import { Title, Description, Expander, DismissButton } from './internal';
22
22
  var analyticsAttributes = {
23
23
  componentName: 'flag',
24
24
  packageName: "@atlaskit/flag",
25
- packageVersion: "14.5.8"
25
+ packageVersion: "14.6.1"
26
26
  };
27
27
  var gridSize = getGridSize();
28
28
  var doubleGridSize = gridSize * 2;
29
- var headerHeight = gridSize * 4;
30
- var iconStyles = css({
29
+ var titleGroupStyles = css({
31
30
  display: 'flex',
32
- height: headerHeight,
33
- alignItems: 'center'
31
+ alignItems: 'start'
32
+ });
33
+ var iconTitleStyles = css({
34
+ display: 'flex',
35
+ paddingTop: "".concat(gridSize / 2, "px"),
36
+ alignItems: 'start',
37
+ flex: 1
34
38
  });
35
39
  var flagHeaderStyles = css({
36
40
  boxSizing: 'border-box',
@@ -118,12 +122,14 @@ var Flag = function Flag(props) {
118
122
  onMouseOut: onMouseOut,
119
123
  onBlur: onBlurAnalytics
120
124
  };
121
- var boxShadow = "var(--ds-shadow-overlay, ".concat("0 20px 32px -8px ".concat(flagShadowColor), ")");
125
+ var boxShadowValue = "0 20px 32px -8px ".concat(flagShadowColor);
122
126
 
123
127
  if (!isBold) {
124
- boxShadow = "var(--ds-shadow-overlay, ".concat("0 0 1px ".concat(flagBorderColor, ", ").concat(boxShadow), ")");
128
+ boxShadowValue = "0 0 1px ".concat(flagBorderColor, ", ").concat(boxShadowValue);
125
129
  }
126
130
 
131
+ var boxShadow = "var(--ds-shadow-overlay, ".concat(boxShadowValue, ")");
132
+
127
133
  var _useGlobalTheme = useGlobalTheme(),
128
134
  mode = _useGlobalTheme.mode;
129
135
 
@@ -147,10 +153,12 @@ var Flag = function Flag(props) {
147
153
  style: {
148
154
  color: iconColor
149
155
  },
150
- css: iconStyles
156
+ css: titleGroupStyles
157
+ }, jsx("div", {
158
+ css: iconTitleStyles
151
159
  }, icon, jsx(Title, {
152
160
  color: textColor
153
- }, title), isDismissable ? !(isBold && !description && !actions.length) && jsx(DismissButton, {
161
+ }, title)), isDismissable ? !(isBold && !description && !actions.length) && jsx(DismissButton, {
154
162
  testId: testId,
155
163
  appearance: appearance,
156
164
  isBold: isBold,
@@ -161,7 +169,8 @@ var Flag = function Flag(props) {
161
169
  testId: testId
162
170
  }, description && jsx(Description, {
163
171
  testId: testId && "".concat(testId, "-description"),
164
- color: textColor
172
+ color: textColor,
173
+ isBold: isBold
165
174
  }, description), jsx(Actions, {
166
175
  actions: actions,
167
176
  appearance: appearance,
@@ -1,8 +1,8 @@
1
1
  /** @jsx jsx */
2
2
  import { jsx, css } from '@emotion/core';
3
3
  var descriptionStyles = css({
4
- /* height is defined as 5 lines maximum by design */
5
4
  maxHeight: 100,
5
+ // height is defined as 5 lines maximum by design
6
6
  overflow: 'auto',
7
7
  wordWrap: 'break-word'
8
8
  });
@@ -10,12 +10,13 @@ var descriptionStyles = css({
10
10
  var Description = function Description(_ref) {
11
11
  var color = _ref.color,
12
12
  testId = _ref.testId,
13
- children = _ref.children;
13
+ children = _ref.children,
14
+ isBold = _ref.isBold;
14
15
  return jsx("div", {
15
16
  style: {
16
17
  color: color
17
18
  },
18
- css: descriptionStyles,
19
+ css: [descriptionStyles],
19
20
  "data-testid": testId
20
21
  }, children);
21
22
  };
@@ -22,6 +22,9 @@ var dismissButtonStyles = css({
22
22
  lineHeight: '1',
23
23
  whiteSpace: 'nowrap'
24
24
  });
25
+ var crossIconStyles = css({
26
+ paddingTop: "".concat(gridSize, "px")
27
+ });
25
28
 
26
29
  var DismissButton = function DismissButton(_ref) {
27
30
  var appearance = _ref.appearance,
@@ -49,7 +52,7 @@ var DismissButton = function DismissButton(_ref) {
49
52
  style: {
50
53
  color: getFlagTextColor(appearance, mode)
51
54
  },
52
- css: dismissButtonStyles,
55
+ css: [dismissButtonStyles, !isBold && crossIconStyles],
53
56
  onClick: onClick,
54
57
  "data-testid": buttonTestId,
55
58
  type: "button",
@@ -1,8 +1,9 @@
1
1
  /** @jsx jsx */
2
2
  import { css, jsx } from '@emotion/core';
3
3
  import { ExitingPersistence, FadeIn } from '@atlaskit/motion';
4
- import { gridSize } from '@atlaskit/theme/constants';
5
- var paddingLeft = gridSize() * 5;
4
+ import { gridSize as getGridSize } from '@atlaskit/theme/constants';
5
+ var gridSize = getGridSize();
6
+ var paddingLeft = gridSize * 5;
6
7
  var expanderStyles = css({
7
8
  display: 'flex',
8
9
  minWidth: 0,
@@ -1,12 +1,9 @@
1
1
  /** @jsx jsx */
2
2
  import { jsx, css } from '@emotion/core';
3
3
  var titleStyles = css({
4
- padding: "0 0 0 16px",
4
+ padding: "2px 0 6px 16px",
5
5
  flex: 1,
6
- fontWeight: 600,
7
- overflow: 'hidden',
8
- textOverflow: 'ellipsis',
9
- whiteSpace: 'nowrap'
6
+ fontWeight: 600
10
7
  });
11
8
 
12
9
  var Title = function Title(_ref) {
package/dist/esm/theme.js CHANGED
@@ -23,8 +23,14 @@ var flagBackgroundColor = {
23
23
  };
24
24
  export var getFlagBackgroundColor = function getFlagBackgroundColor(appearance, mode) {
25
25
  return flagBackgroundColor[appearance][mode];
26
- };
27
- export var flagBorderColor = "var(--ds-surface-overlay, ".concat(N60A, ")");
26
+ }; // token set in flag.tsx instead
27
+
28
+ /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
29
+
30
+ export var flagBorderColor = N60A;
31
+ export var flagShadowColor = N50A;
32
+ /* eslint-enable @atlaskit/design-system/ensure-design-token-usage */
33
+
28
34
  var flagIconColor = {
29
35
  error: {
30
36
  light: "var(--ds-icon-inverse, ".concat(N0, ")"),
@@ -74,10 +80,7 @@ export var getFlagTextColor = function getFlagTextColor(appearance, mode) {
74
80
  };
75
81
  export var getFlagIconColor = function getFlagIconColor(appearance, mode) {
76
82
  return flagIconColor[appearance][mode];
77
- }; // token set in flag.tsx instead
78
- // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
79
-
80
- export var flagShadowColor = N50A;
83
+ };
81
84
  var flagFocusRingColor = {
82
85
  error: {
83
86
  light: "var(--ds-border-focused, ".concat(N40, ")"),
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/flag",
3
- "version": "14.5.8",
3
+ "version": "14.6.1",
4
4
  "sideEffects": false
5
5
  }
@@ -2,6 +2,7 @@ import { FC } from 'react';
2
2
  interface DescriptionProps {
3
3
  testId?: string;
4
4
  color: string;
5
+ isBold: boolean;
5
6
  }
6
7
  declare const Description: FC<DescriptionProps>;
7
8
  export default Description;
@@ -1,10 +1,10 @@
1
1
  import { ThemeModes } from '@atlaskit/theme/types';
2
2
  import { AppearanceTypes } from './types';
3
3
  export declare const getFlagBackgroundColor: (appearance: AppearanceTypes, mode: ThemeModes) => string;
4
- export declare const flagBorderColor: "var(--ds-surface-overlay)";
4
+ export declare const flagBorderColor = "rgba(9, 30, 66, 0.31)";
5
+ export declare const flagShadowColor = "rgba(9, 30, 66, 0.25)";
5
6
  export declare const getFlagTextColor: (appearance: AppearanceTypes, mode: ThemeModes) => string;
6
7
  export declare const getFlagIconColor: (appearance: AppearanceTypes, mode: ThemeModes) => string;
7
- export declare const flagShadowColor = "rgba(9, 30, 66, 0.25)";
8
8
  export declare const getFlagFocusRingColor: (appearance: AppearanceTypes, mode: ThemeModes) => string;
9
9
  export declare const getActionBackground: (appearance: AppearanceTypes, mode: ThemeModes) => string;
10
10
  export declare const getActionColor: (appearance: AppearanceTypes, mode: ThemeModes) => string;
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@atlaskit/flag",
3
- "version": "14.5.8",
3
+ "version": "14.6.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/"
7
7
  },
8
- "repository": "https://bitbucket.org/atlassian/atlassian-frontend",
8
+ "repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
9
9
  "author": "Atlassian Pty Ltd",
10
10
  "license": "Apache-2.0",
11
11
  "main": "dist/cjs/index.js",
@@ -16,19 +16,30 @@
16
16
  "atlaskit:src": "src/index.ts",
17
17
  "atlassian": {
18
18
  "team": "Design System Team",
19
- "deprecatedAutoEntryPoints": true,
20
19
  "releaseModel": "scheduled",
21
20
  "website": {
22
- "name": "Flag"
21
+ "name": "Flag",
22
+ "category": "Components"
23
23
  }
24
24
  },
25
+ "af:exports": {
26
+ ".": "./src/index.ts",
27
+ "./auto-dismiss-flag": "./src/auto-dismiss-flag.tsx",
28
+ "./constants": "./src/constants.ts",
29
+ "./flag-actions": "./src/flag-actions.tsx",
30
+ "./flag-group": "./src/flag-group.tsx",
31
+ "./flag-provider": "./src/flag-provider.tsx",
32
+ "./flag": "./src/flag.tsx",
33
+ "./theme": "./src/theme.ts",
34
+ "./types": "./src/types.ts"
35
+ },
25
36
  "dependencies": {
26
37
  "@atlaskit/analytics-next": "^8.0.0",
27
38
  "@atlaskit/button": "^16.3.0",
28
- "@atlaskit/ds-lib": "^1.4.0",
39
+ "@atlaskit/ds-lib": "^2.0.0",
29
40
  "@atlaskit/focus-ring": "^1.0.0",
30
41
  "@atlaskit/icon": "^21.10.0",
31
- "@atlaskit/motion": "^1.0.0",
42
+ "@atlaskit/motion": "^1.2.0",
32
43
  "@atlaskit/portal": "^4.0.0",
33
44
  "@atlaskit/theme": "^12.1.0",
34
45
  "@atlaskit/tokens": "^0.10.0",
@@ -62,6 +73,7 @@
62
73
  ],
63
74
  "techstack": {
64
75
  "@repo/internal": {
76
+ "dom-events": "use-bind-event-listener",
65
77
  "ui-components": [
66
78
  "lite-mode"
67
79
  ],
package/report.api.md ADDED
@@ -0,0 +1,179 @@
1
+ ## API Report File for "@atlaskit/flag"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+ /// <reference types="react" />
7
+
8
+ import { ComponentType } from 'react';
9
+ import { CustomThemeButtonProps } from '@atlaskit/button/types';
10
+ import { MouseEventHandler } from 'react';
11
+ import { default as React_2 } from 'react';
12
+ import { ReactElement } from 'react';
13
+ import { ReactNode } from 'react';
14
+ import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
15
+ import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
16
+
17
+ export declare type ActionsType = Array<ActionType>;
18
+
19
+ declare type ActionType = {
20
+ content: ReactNode;
21
+ onClick?: (
22
+ e: React.MouseEvent<HTMLElement>,
23
+ analyticsEvent: UIAnalyticsEvent,
24
+ ) => void;
25
+ href?: string;
26
+ target?: string;
27
+ testId?: string;
28
+ };
29
+
30
+ export declare type AppearanceTypes =
31
+ | 'error'
32
+ | 'info'
33
+ | 'normal'
34
+ | 'success'
35
+ | 'warning';
36
+
37
+ export declare const AutoDismissFlag: (
38
+ props: AutoDismissFlagProps,
39
+ ) => JSX.Element;
40
+
41
+ declare interface AutoDismissFlagProps
42
+ extends AutoDismissFlagPropsWithoutId,
43
+ FlagPropsId {}
44
+
45
+ declare type AutoDismissFlagPropsWithoutId = {
46
+ /** Array of clickable actions to be shown at the bottom of the flag. For flags where appearance
47
+ * is 'normal', actions will be shown as links. For all other appearance values, actions will
48
+ * shown as buttons.
49
+ * If href is passed the action will be shown as a link with the passed href prop.
50
+ */
51
+ actions?: ActionsType;
52
+ /** Makes the flag appearance bold. Setting this to anything other than 'normal' hides the
53
+ * dismiss button.
54
+ */
55
+ appearance?: AppearanceTypes;
56
+ /** The secondary content shown below the flag title */
57
+ description?: ReactNode;
58
+ /** The icon displayed in the top-left of the flag. Should be an instance of `@atlaskit/icon`.
59
+ * Your icon will receive the appropriate default color, which you can override by wrapping the
60
+ * icon in a containing element with CSS `color` set to your preferred icon color.
61
+ */
62
+ icon: ReactNode;
63
+ /** The bold text shown at the top of the flag. */
64
+ title: ReactNode;
65
+ /** Handler which will be called when a Flag's dismiss button is clicked.
66
+ * Receives the id of the dismissed Flag as a parameter.
67
+ */
68
+ onDismissed?: (id: number | string, analyticsEvent: UIAnalyticsEvent) => void;
69
+ /** A link component that is passed down to the `@atlaskit/button` used by actions,
70
+ to allow custom routers to be used. See the
71
+ [button with router](https://atlaskit.atlassian.com/packages/design-system/button/example/ButtonWithRouter)
72
+ example of what this component should look like. */
73
+ linkComponent?: ComponentType<CustomThemeButtonProps>;
74
+ /**
75
+ * A `testId` prop is provided for specified elements,
76
+ * which is a unique string that appears as a data attribute `data-testid` in the rendered code,
77
+ * serving as a hook for automated tests.
78
+
79
+ * Will set these elements when defined:
80
+
81
+ * - Flag root element - `{testId}`
82
+ * - Close button visible on default flags - `{testId}-dismiss`
83
+ * - Toggle button visible on bold flags - `{testId}-toggle`
84
+ * - Flag content which wraps the description and actions - `{testId}-expander`
85
+ * - Flag description - `{testId}-description`
86
+ * - Flag actions - `{testId}-actions`
87
+ */
88
+ testId?: string;
89
+ /** Additional information to be included in the `context` of analytics events that come from flag */
90
+ analyticsContext?: Record<string, any>;
91
+ };
92
+
93
+ declare type Combine<First, Second> = Omit<First, keyof Second> & Second;
94
+
95
+ export declare interface CreateFlagArgs extends FlagPropsWithoutId {
96
+ /** A unique identifier used for rendering and onDismissed callbacks.
97
+ * This will be autogenerated if you don’t supply one.
98
+ * If you don’t want the same flag showing multiple times, provide a unique id.
99
+ */
100
+ id?: FlagId;
101
+ /** Marks whether the flag should render as an AutoDismissFlag */
102
+ isAutoDismiss?: boolean;
103
+ }
104
+
105
+ export declare type DismissFn = () => void;
106
+
107
+ declare const Flag: (props: FlagProps) => JSX.Element;
108
+ export default Flag;
109
+
110
+ export declare type FlagAPI = {
111
+ showFlag: (args: CreateFlagArgs) => DismissFn;
112
+ };
113
+
114
+ export declare type FlagArgs = Combine<
115
+ CreateFlagArgs,
116
+ {
117
+ id: FlagId;
118
+ }
119
+ >;
120
+
121
+ export declare const FlagGroup: (props: FlagGroupProps) => JSX.Element;
122
+
123
+ declare type FlagGroupProps = {
124
+ /** ID attribute used for DOM selection. */
125
+ id?: string;
126
+ /** Describes the specific role of this FlagGroup for users viewing the page with a screen reader (defaults to `Flag notifications`). */
127
+ label?: string;
128
+ /** Describes the specific tag on which the screen reader text will be rendered (defaults to `h2`). */
129
+ labelTag?: React.ElementType;
130
+ /** Flag elements to be displayed. */
131
+ children?: Array<ReactElement> | ReactElement | null | boolean;
132
+ /** Handler which will be called when a Flag's dismiss button is clicked.
133
+ * Receives the id of the dismissed Flag as a parameter.
134
+ */
135
+ onDismissed?: (id: number | string, analyticsEvent: UIAnalyticsEvent) => void;
136
+ };
137
+
138
+ declare type FlagId = string | number;
139
+
140
+ export declare interface FlagProps extends FlagPropsWithoutId, FlagPropsId {}
141
+
142
+ declare type FlagPropsId = {
143
+ /** A unique identifier used for rendering and onDismissed callbacks. */
144
+ id: number | string;
145
+ };
146
+
147
+ declare interface FlagPropsWithoutId
148
+ extends AutoDismissFlagPropsWithoutId,
149
+ WithAnalyticsEventsProps {
150
+ /** Standard onBlur event, applied to Flag by AutoDismissFlag */
151
+ onBlur?: (
152
+ e: React.FocusEvent<HTMLElement>,
153
+ analyticsEvent: UIAnalyticsEvent,
154
+ ) => void;
155
+ /** Standard onFocus event, applied to Flag by AutoDismissFlag */
156
+ onFocus?: (
157
+ e: React.FocusEvent<HTMLElement>,
158
+ analyticsEvent: UIAnalyticsEvent,
159
+ ) => void;
160
+ /** Standard onMouseOut event, applied to Flag by AutoDismissFlag */
161
+ onMouseOut?: MouseEventHandler;
162
+ /** Standard onMouseOver event, applied to Flag by AutoDismissFlag */
163
+ onMouseOver?: MouseEventHandler;
164
+ }
165
+
166
+ export declare function FlagsProvider({
167
+ children,
168
+ }: {
169
+ children: React_2.ReactNode;
170
+ }): JSX.Element;
171
+
172
+ export declare function useFlags(): FlagAPI;
173
+
174
+ export declare const withFlagsProvider: (
175
+ fn: () => React_2.ReactNode,
176
+ ) => React_2.ReactNode;
177
+
178
+ export {};
179
+ ```