@atlaskit/flag 14.6.2 → 14.7.0

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.
Files changed (43) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/__perf__/{withFlagGroup.tsx → with-flag-group.tsx} +2 -1
  3. package/dist/cjs/auto-dismiss-flag.js +12 -2
  4. package/dist/cjs/flag-actions.js +12 -11
  5. package/dist/cjs/flag-group.js +23 -13
  6. package/dist/cjs/flag-provider.js +5 -0
  7. package/dist/cjs/flag.js +25 -15
  8. package/dist/cjs/internal/description.js +5 -4
  9. package/dist/cjs/internal/dismiss-button.js +5 -5
  10. package/dist/cjs/internal/expander.js +9 -8
  11. package/dist/cjs/internal/title.js +5 -4
  12. package/dist/cjs/types.js +3 -0
  13. package/dist/cjs/version.json +1 -1
  14. package/dist/es2019/auto-dismiss-flag.js +11 -2
  15. package/dist/es2019/flag-actions.js +3 -2
  16. package/dist/es2019/flag-group.js +14 -4
  17. package/dist/es2019/flag-provider.js +5 -0
  18. package/dist/es2019/flag.js +12 -2
  19. package/dist/es2019/internal/description.js +3 -2
  20. package/dist/es2019/internal/dismiss-button.js +1 -1
  21. package/dist/es2019/internal/expander.js +3 -2
  22. package/dist/es2019/internal/title.js +3 -2
  23. package/dist/es2019/types.js +2 -0
  24. package/dist/es2019/version.json +1 -1
  25. package/dist/esm/auto-dismiss-flag.js +11 -2
  26. package/dist/esm/flag-actions.js +3 -2
  27. package/dist/esm/flag-group.js +14 -4
  28. package/dist/esm/flag-provider.js +5 -0
  29. package/dist/esm/flag.js +12 -2
  30. package/dist/esm/internal/description.js +3 -2
  31. package/dist/esm/internal/dismiss-button.js +1 -1
  32. package/dist/esm/internal/expander.js +3 -2
  33. package/dist/esm/internal/title.js +3 -2
  34. package/dist/esm/types.js +2 -0
  35. package/dist/esm/version.json +1 -1
  36. package/dist/types/auto-dismiss-flag.d.ts +8 -0
  37. package/dist/types/flag-actions.d.ts +3 -2
  38. package/dist/types/flag-group.d.ts +24 -6
  39. package/dist/types/flag-provider.d.ts +9 -2
  40. package/dist/types/flag.d.ts +12 -2
  41. package/dist/types/internal/dismiss-button.d.ts +2 -1
  42. package/dist/types/types.d.ts +41 -19
  43. package/package.json +16 -15
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @atlaskit/flag
2
2
 
3
+ ## 14.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`d176305ad56`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d176305ad56) - Updates `@emotion/core` to `@emotion/react`; v10 to v11. There is no expected behavior change.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+
13
+ ## 14.6.4
14
+
15
+ ### Patch Changes
16
+
17
+ - [`8d4228767b0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8d4228767b0) - Upgrade Typescript from `4.2.4` to `4.3.5`.
18
+
19
+ ## 14.6.3
20
+
21
+ ### Patch Changes
22
+
23
+ - [`8202e37941b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8202e37941b) - Internal code change turning on new linting rules.
24
+ - Updated dependencies
25
+
3
26
  ## 14.6.2
4
27
 
5
28
  ### Patch Changes
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
 
3
+ import noop from '@atlaskit/ds-lib/noop';
3
4
  import SuccessIcon from '@atlaskit/icon/glyph/check-circle';
4
5
  import { G400 } from '@atlaskit/theme/colors';
5
6
  import { token } from '@atlaskit/tokens';
@@ -20,7 +21,7 @@ export default () => (
20
21
  key="success"
21
22
  title="Connected"
22
23
  description="All wires now hooked up."
23
- actions={[{ content: 'Alrighty then', onClick: () => {} }]}
24
+ actions={[{ content: 'Alrighty then', onClick: noop }]}
24
25
  />
25
26
  </FlagGroup>
26
27
  );
@@ -26,8 +26,17 @@ 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.6.2";
29
+ var packageVersion = "14.7.0";
30
30
  var AUTO_DISMISS_SECONDS = 8;
31
+ /**
32
+ * __Auto dismiss flag__
33
+ *
34
+ * An auto dismiss flag is dismissed automatically after eight seconds.
35
+ *
36
+ * - [Examples](https://atlassian.design/components/flag/auto-dismiss-flag/examples)
37
+ * - [Code](https://atlassian.design/components/flag/auto-dismiss-flag/code)
38
+ */
39
+
31
40
  exports.AUTO_DISMISS_SECONDS = AUTO_DISMISS_SECONDS;
32
41
 
33
42
  var AutoDismissFlag = function AutoDismissFlag(props) {
@@ -77,7 +86,8 @@ var AutoDismissFlag = function AutoDismissFlag(props) {
77
86
  startAutoDismissTimer();
78
87
  return stopAutoDismissTimer;
79
88
  }, [startAutoDismissTimer, stopAutoDismissTimer]);
80
- return /*#__PURE__*/_react.default.createElement(_flag.default, (0, _extends2.default)({}, props, {
89
+ return /*#__PURE__*/_react.default.createElement(_flag.default // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
90
+ , (0, _extends2.default)({}, props, {
81
91
  onMouseOver: stopAutoDismissTimer,
82
92
  onFocus: stopAutoDismissTimer,
83
93
  onMouseOut: startAutoDismissTimer,
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.default = void 0;
9
9
 
10
- var _core = require("@emotion/core");
10
+ var _react = require("@emotion/react");
11
11
 
12
12
  var _customThemeButton = _interopRequireDefault(require("@atlaskit/button/custom-theme-button"));
13
13
 
@@ -23,22 +23,22 @@ var _theme = require("./theme");
23
23
  var gridSize = (0, _constants.gridSize)();
24
24
  var separatorWidth = gridSize * 2;
25
25
  var defaultAppearanceTranslate = gridSize / 4;
26
- var separatorStyles = (0, _core.css)({
26
+ var separatorStyles = (0, _react.css)({
27
27
  display: 'inline-block',
28
28
  width: separatorWidth,
29
29
  textAlign: 'center'
30
30
  });
31
- var actionContainerStyles = (0, _core.css)({
31
+ var actionContainerStyles = (0, _react.css)({
32
32
  display: 'flex',
33
33
  paddingTop: gridSize,
34
34
  alignItems: 'center',
35
35
  flexWrap: 'wrap',
36
36
  transform: "translateX(-".concat(defaultAppearanceTranslate, "px)")
37
37
  });
38
- var boldActionContainerStyles = (0, _core.css)({
38
+ var boldActionContainerStyles = (0, _react.css)({
39
39
  transform: 0
40
40
  });
41
- var buttonStyles = (0, _core.css)({
41
+ var buttonStyles = (0, _react.css)({
42
42
  '&&, a&&': {
43
43
  marginLeft: 0,
44
44
  padding: "0 ".concat(gridSize, "px !important"),
@@ -53,12 +53,12 @@ var buttonStyles = (0, _core.css)({
53
53
  textDecoration: 'underline'
54
54
  }
55
55
  });
56
- var appeanceNormalButtonStyles = (0, _core.css)({
56
+ var appeanceNormalButtonStyles = (0, _react.css)({
57
57
  '&&, a&&': {
58
58
  padding: '0 !important'
59
59
  }
60
60
  });
61
- var isBoldButtonStyles = (0, _core.css)({
61
+ var isBoldButtonStyles = (0, _react.css)({
62
62
  '&&, a&&': {
63
63
  marginRight: gridSize
64
64
  }
@@ -78,14 +78,14 @@ var FlagActions = function FlagActions(props) {
78
78
  }
79
79
 
80
80
  var isBold = appearance !== _constants2.DEFAULT_APPEARANCE;
81
- return (0, _core.jsx)("div", {
81
+ return (0, _react.jsx)("div", {
82
82
  css: [actionContainerStyles, isBold && boldActionContainerStyles],
83
83
  "data-testid": testId && "".concat(testId, "-actions")
84
84
  }, actions.map(function (action, index) {
85
- return [index && !isBold ? (0, _core.jsx)("div", {
85
+ return [index && !isBold ? (0, _react.jsx)("div", {
86
86
  css: separatorStyles,
87
87
  key: index + 0.5
88
- }, "\xB7") : '', (0, _core.jsx)(_customThemeButton.default, {
88
+ }, "\xB7") : '', (0, _react.jsx)(_customThemeButton.default, {
89
89
  onClick: action.onClick,
90
90
  href: action.href,
91
91
  target: action.target,
@@ -102,7 +102,8 @@ var FlagActions = function FlagActions(props) {
102
102
  css: [buttonStyles, isBold && isBoldButtonStyles, appearance === 'normal' && appeanceNormalButtonStyles]
103
103
  }, action.content)];
104
104
  }));
105
- };
105
+ }; // eslint-disable-next-line @repo/internal/react/require-jsdoc
106
+
106
107
 
107
108
  var _default = FlagActions;
108
109
  exports.default = _default;
@@ -14,7 +14,7 @@ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
14
14
 
15
15
  var _react = require("react");
16
16
 
17
- var _core = require("@emotion/core");
17
+ var _react2 = require("@emotion/react");
18
18
 
19
19
  var _motion = require("@atlaskit/motion");
20
20
 
@@ -35,10 +35,12 @@ exports.flagAnimationTime = flagAnimationTime;
35
35
  var flagBottom = gridSize * 6;
36
36
  var flagLeft = gridSize * 10;
37
37
  var defaultFlagGroupContext = {
38
- onDismissed: function onDismissed() {},
38
+ onDismissed: _noop.default,
39
39
  isDismissAllowed: false
40
- };
41
- var FlagGroupContext = /*#__PURE__*/(0, _react.createContext)(defaultFlagGroupContext);
40
+ }; // eslint-disable-next-line @repo/internal/react/require-jsdoc
41
+
42
+ var FlagGroupContext = /*#__PURE__*/(0, _react.createContext)(defaultFlagGroupContext); // eslint-disable-next-line @repo/internal/react/require-jsdoc
43
+
42
44
  exports.FlagGroupContext = FlagGroupContext;
43
45
 
44
46
  function useFlagGroup() {
@@ -47,7 +49,7 @@ function useFlagGroup() {
47
49
  // that causes a broken transition
48
50
 
49
51
 
50
- var baseStyles = (0, _core.css)({
52
+ var baseStyles = (0, _react2.css)({
51
53
  width: flagWidth,
52
54
  position: 'absolute',
53
55
  bottom: 0,
@@ -75,14 +77,14 @@ var baseStyles = (0, _core.css)({
75
77
  }); // Transform needed to push up while 1st flag is leaving
76
78
  // Exiting time should match the exiting time of motion so is halved
77
79
 
78
- var dismissAllowedStyles = (0, _core.css)({
80
+ var dismissAllowedStyles = (0, _react2.css)({
79
81
  // eslint-disable-next-line @repo/internal/styles/no-nested-styles
80
82
  '&& + *': {
81
83
  transform: "translate(0, 0)",
82
84
  transitionDuration: "".concat(flagAnimationTime / 2, "ms")
83
85
  }
84
86
  });
85
- var flagGroupContainerStyles = (0, _core.css)({
87
+ var flagGroupContainerStyles = (0, _react2.css)({
86
88
  position: 'fixed',
87
89
  zIndex: _constants.layers.flag(),
88
90
  bottom: flagBottom,
@@ -92,6 +94,14 @@ var flagGroupContainerStyles = (0, _core.css)({
92
94
  left: 0
93
95
  }
94
96
  });
97
+ /**
98
+ * __Flag group__
99
+ *
100
+ * A flag group is used to group a set of related flags, with entry and exit animations.
101
+ *
102
+ * - [Examples](https://atlassian.design/components/flag/flag-group/examples)
103
+ * - [Code](https://atlassian.design/components/flag/flag-group/code)
104
+ */
95
105
 
96
106
  var FlagGroup = function FlagGroup(props) {
97
107
  var id = props.id,
@@ -113,7 +123,7 @@ var FlagGroup = function FlagGroup(props) {
113
123
  var renderChildren = function renderChildren() {
114
124
  return children && (0, _typeof2.default)(children) === 'object' ? _react.Children.map(children, function (flag, index) {
115
125
  var isDismissAllowed = index === 0;
116
- return (0, _core.jsx)(_motion.SlideIn, {
126
+ return (0, _react2.jsx)(_motion.SlideIn, {
117
127
  enterFrom: "left",
118
128
  fade: "inout",
119
129
  duration: flagAnimationTime,
@@ -121,9 +131,9 @@ var FlagGroup = function FlagGroup(props) {
121
131
  return _motion.easeIn;
122
132
  }
123
133
  }, function (props) {
124
- return (0, _core.jsx)("div", (0, _extends2.default)({}, props, {
134
+ return (0, _react2.jsx)("div", (0, _extends2.default)({}, props, {
125
135
  css: [baseStyles, isDismissAllowed && dismissAllowedStyles]
126
- }), (0, _core.jsx)(FlagGroupContext.Provider, {
136
+ }), (0, _react2.jsx)(FlagGroupContext.Provider, {
127
137
  value: // Only the first flag should be able to be dismissed.
128
138
  isDismissAllowed ? dismissFlagContext : defaultFlagGroupContext
129
139
  }, flag));
@@ -131,12 +141,12 @@ var FlagGroup = function FlagGroup(props) {
131
141
  }) : false;
132
142
  };
133
143
 
134
- return (0, _core.jsx)(_portal.default, {
144
+ return (0, _react2.jsx)(_portal.default, {
135
145
  zIndex: _constants.layers.flag()
136
- }, (0, _core.jsx)("div", {
146
+ }, (0, _react2.jsx)("div", {
137
147
  id: id,
138
148
  css: flagGroupContainerStyles
139
- }, hasFlags ? (0, _core.jsx)(_visuallyHidden.default, null, (0, _core.jsx)(LabelTag, null, label)) : null, (0, _core.jsx)(_motion.ExitingPersistence, {
149
+ }, hasFlags ? (0, _react2.jsx)(_visuallyHidden.default, null, (0, _react2.jsx)(LabelTag, null, label)) : null, (0, _react2.jsx)(_motion.ExitingPersistence, {
140
150
  appear: false
141
151
  }, renderChildren())));
142
152
  };
@@ -40,6 +40,11 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
40
40
  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) { (0, _defineProperty2.default)(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; }
41
41
 
42
42
  var FlagContext = /*#__PURE__*/_react.default.createContext(null);
43
+ /**
44
+ * useFlags is used to access the `showFlags` function which can be used to programatically display flags.
45
+ * - [Examples](https://atlassian.design/components/flag/flags-provider/examples#using-showflags)
46
+ */
47
+
43
48
 
44
49
  function useFlags() {
45
50
  var api = (0, _react.useContext)(FlagContext);
package/dist/cjs/flag.js CHANGED
@@ -15,7 +15,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
15
15
 
16
16
  var _react = require("react");
17
17
 
18
- var _core = require("@emotion/core");
18
+ var _react2 = require("@emotion/react");
19
19
 
20
20
  var _components = require("@atlaskit/theme/components");
21
21
 
@@ -44,32 +44,42 @@ 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.6.2"
47
+ packageVersion: "14.7.0"
48
48
  };
49
49
  var gridSize = (0, _constants.gridSize)();
50
50
  var doubleGridSize = gridSize * 2;
51
- var titleGroupStyles = (0, _core.css)({
51
+ var titleGroupStyles = (0, _react2.css)({
52
52
  display: 'flex',
53
53
  alignItems: 'start'
54
54
  });
55
- var iconTitleStyles = (0, _core.css)({
55
+ var iconTitleStyles = (0, _react2.css)({
56
56
  display: 'flex',
57
57
  paddingTop: "".concat(gridSize / 2, "px"),
58
58
  alignItems: 'start',
59
59
  flex: 1
60
60
  });
61
- var flagHeaderStyles = (0, _core.css)({
61
+ var flagHeaderStyles = (0, _react2.css)({
62
62
  boxSizing: 'border-box',
63
63
  width: '100%',
64
64
  padding: doubleGridSize,
65
65
  borderRadius: (0, _constants.borderRadius)()
66
66
  });
67
- var flagContainerStyles = (0, _core.css)({
67
+ var flagContainerStyles = (0, _react2.css)({
68
68
  width: '100%',
69
69
  zIndex: _constants.layers.flag(),
70
70
  borderRadius: (0, _constants.borderRadius)(),
71
71
  transition: 'background-color 200ms'
72
72
  });
73
+ /**
74
+ * __Flag__
75
+ *
76
+ * A flag is used for confirmations, alerts, and acknowledgments that require minimal user interaction,
77
+ * often displayed using a flag group.
78
+ *
79
+ * - [Examples](https://atlassian.design/components/flag/examples)
80
+ * - [Code](https://atlassian.design/components/flag/code)
81
+ * - [Usage](https://atlassian.design/components/flag/usage)
82
+ */
73
83
 
74
84
  var Flag = function Flag(props) {
75
85
  var _props$actions = props.actions,
@@ -158,7 +168,7 @@ var Flag = function Flag(props) {
158
168
  var textColor = (0, _theme.getFlagTextColor)(appearance, mode);
159
169
  var iconColor = (0, _theme.getFlagIconColor)(appearance, mode);
160
170
  var isDismissable = isBold || isDismissAllowed;
161
- return (0, _core.jsx)("div", (0, _extends2.default)({
171
+ return (0, _react2.jsx)("div", (0, _extends2.default)({
162
172
  style: {
163
173
  color: textColor,
164
174
  backgroundColor: (0, _theme.getFlagBackgroundColor)(appearance, mode),
@@ -167,33 +177,33 @@ var Flag = function Flag(props) {
167
177
  css: flagContainerStyles,
168
178
  role: "alert",
169
179
  "data-testid": testId
170
- }, autoDismissProps), (0, _core.jsx)(_focusRing.default, null, (0, _core.jsx)("div", {
180
+ }, autoDismissProps), (0, _react2.jsx)(_focusRing.default, null, (0, _react2.jsx)("div", {
171
181
  css: flagHeaderStyles // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
172
182
  ,
173
183
  tabIndex: 0
174
- }, (0, _core.jsx)("div", {
184
+ }, (0, _react2.jsx)("div", {
175
185
  style: {
176
186
  color: iconColor
177
187
  },
178
188
  css: titleGroupStyles
179
- }, (0, _core.jsx)("div", {
189
+ }, (0, _react2.jsx)("div", {
180
190
  css: iconTitleStyles
181
- }, icon, (0, _core.jsx)(_internal.Title, {
191
+ }, icon, (0, _react2.jsx)(_internal.Title, {
182
192
  color: textColor
183
- }, title)), isDismissable ? !(isBold && !description && !actions.length) && (0, _core.jsx)(_internal.DismissButton, {
193
+ }, title)), isDismissable ? !(isBold && !description && !actions.length) && (0, _react2.jsx)(_internal.DismissButton, {
184
194
  testId: testId,
185
195
  appearance: appearance,
186
196
  isBold: isBold,
187
197
  isExpanded: isExpanded,
188
198
  onClick: isBold ? toggleExpand : buttonActionCallback
189
- }) : null), (0, _core.jsx)(_internal.Expander, {
199
+ }) : null), (0, _react2.jsx)(_internal.Expander, {
190
200
  isExpanded: !isBold || isExpanded,
191
201
  testId: testId
192
- }, description && (0, _core.jsx)(_internal.Description, {
202
+ }, description && (0, _react2.jsx)(_internal.Description, {
193
203
  testId: testId && "".concat(testId, "-description"),
194
204
  color: textColor,
195
205
  isBold: isBold
196
- }, description), (0, _core.jsx)(_flagActions.default, {
206
+ }, description), (0, _react2.jsx)(_flagActions.default, {
197
207
  actions: actions,
198
208
  appearance: appearance,
199
209
  linkComponent: linkComponent,
@@ -5,10 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
- var _core = require("@emotion/core");
8
+ var _react = require("@emotion/react");
9
9
 
10
10
  /** @jsx jsx */
11
- var descriptionStyles = (0, _core.css)({
11
+ var descriptionStyles = (0, _react.css)({
12
12
  maxHeight: 100,
13
13
  // height is defined as 5 lines maximum by design
14
14
  overflow: 'auto',
@@ -20,14 +20,15 @@ var Description = function Description(_ref) {
20
20
  testId = _ref.testId,
21
21
  children = _ref.children,
22
22
  isBold = _ref.isBold;
23
- return (0, _core.jsx)("div", {
23
+ return (0, _react.jsx)("div", {
24
24
  style: {
25
25
  color: color
26
26
  },
27
27
  css: [descriptionStyles],
28
28
  "data-testid": testId
29
29
  }, children);
30
- };
30
+ }; // eslint-disable-next-line @repo/internal/react/require-jsdoc
31
+
31
32
 
32
33
  var _default = Description;
33
34
  exports.default = _default;
@@ -9,7 +9,7 @@ exports.default = void 0;
9
9
 
10
10
  var _react = require("react");
11
11
 
12
- var _core = require("@emotion/core");
12
+ var _react2 = require("@emotion/react");
13
13
 
14
14
  var _focusRing = _interopRequireDefault(require("@atlaskit/focus-ring"));
15
15
 
@@ -28,7 +28,7 @@ var _theme = require("../theme");
28
28
  /** @jsx jsx */
29
29
  var gridSize = (0, _constants.gridSize)();
30
30
  var borderRadius = (0, _constants.borderRadius)();
31
- var dismissButtonStyles = (0, _core.css)({
31
+ var dismissButtonStyles = (0, _react2.css)({
32
32
  marginLeft: gridSize,
33
33
  padding: 0,
34
34
  flex: '0 0 auto',
@@ -40,7 +40,7 @@ var dismissButtonStyles = (0, _core.css)({
40
40
  lineHeight: '1',
41
41
  whiteSpace: 'nowrap'
42
42
  });
43
- var crossIconStyles = (0, _core.css)({
43
+ var crossIconStyles = (0, _react2.css)({
44
44
  paddingTop: "".concat(gridSize, "px")
45
45
  });
46
46
 
@@ -66,7 +66,7 @@ var DismissButton = function DismissButton(_ref) {
66
66
  buttonTestId = testId && "".concat(testId, "-toggle");
67
67
  }
68
68
 
69
- return (0, _core.jsx)(_focusRing.default, null, (0, _core.jsx)("button", {
69
+ return (0, _react2.jsx)(_focusRing.default, null, (0, _react2.jsx)("button", {
70
70
  style: {
71
71
  color: (0, _theme.getFlagTextColor)(appearance, mode)
72
72
  },
@@ -75,7 +75,7 @@ var DismissButton = function DismissButton(_ref) {
75
75
  "data-testid": buttonTestId,
76
76
  type: "button",
77
77
  "aria-expanded": isBold ? isExpanded : undefined
78
- }, (0, _core.jsx)(ButtonIcon, {
78
+ }, (0, _react2.jsx)(ButtonIcon, {
79
79
  label: buttonLabel,
80
80
  size: size
81
81
  })));
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
- var _core = require("@emotion/core");
8
+ var _react = require("@emotion/react");
9
9
 
10
10
  var _motion = require("@atlaskit/motion");
11
11
 
@@ -14,7 +14,7 @@ var _constants = require("@atlaskit/theme/constants");
14
14
  /** @jsx jsx */
15
15
  var gridSize = (0, _constants.gridSize)();
16
16
  var paddingLeft = gridSize * 5;
17
- var expanderStyles = (0, _core.css)({
17
+ var expanderStyles = (0, _react.css)({
18
18
  display: 'flex',
19
19
  minWidth: 0,
20
20
  maxHeight: 0,
@@ -24,7 +24,7 @@ var expanderStyles = (0, _core.css)({
24
24
  flexDirection: 'column',
25
25
  transition: "max-height 0.3s"
26
26
  });
27
- var expandedStyles = (0, _core.css)({
27
+ var expandedStyles = (0, _react.css)({
28
28
  maxHeight: 150
29
29
  });
30
30
 
@@ -35,16 +35,17 @@ var Expander = function Expander(_ref) {
35
35
  // Need to always render the ExpanderInternal otherwise the
36
36
  // reveal transition doesn't happen. We can't use CSS animation for
37
37
  // the the reveal because we don't know the height of the content.
38
- return (0, _core.jsx)("div", {
38
+ return (0, _react.jsx)("div", {
39
39
  "aria-hidden": !isExpanded,
40
40
  css: [expanderStyles, isExpanded && expandedStyles],
41
41
  "data-testid": testId && "".concat(testId, "-expander")
42
- }, (0, _core.jsx)(_motion.ExitingPersistence, {
42
+ }, (0, _react.jsx)(_motion.ExitingPersistence, {
43
43
  appear: true
44
- }, isExpanded && (0, _core.jsx)(_motion.FadeIn, null, function (props) {
45
- return (0, _core.jsx)("div", props, children);
44
+ }, isExpanded && (0, _react.jsx)(_motion.FadeIn, null, function (props) {
45
+ return (0, _react.jsx)("div", props, children);
46
46
  })));
47
- };
47
+ }; // eslint-disable-next-line @repo/internal/react/require-jsdoc
48
+
48
49
 
49
50
  var _default = Expander;
50
51
  exports.default = _default;
@@ -5,10 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
- var _core = require("@emotion/core");
8
+ var _react = require("@emotion/react");
9
9
 
10
10
  /** @jsx jsx */
11
- var titleStyles = (0, _core.css)({
11
+ var titleStyles = (0, _react.css)({
12
12
  padding: "2px 0 6px 16px",
13
13
  flex: 1,
14
14
  fontWeight: 600
@@ -17,13 +17,14 @@ var titleStyles = (0, _core.css)({
17
17
  var Title = function Title(_ref) {
18
18
  var color = _ref.color,
19
19
  children = _ref.children;
20
- return (0, _core.jsx)("span", {
20
+ return (0, _react.jsx)("span", {
21
21
  style: {
22
22
  color: color
23
23
  },
24
24
  css: titleStyles
25
25
  }, children);
26
- };
26
+ }; // eslint-disable-next-line @repo/internal/react/require-jsdoc
27
+
27
28
 
28
29
  var _default = Title;
29
30
  exports.default = _default;
package/dist/cjs/types.js CHANGED
@@ -4,7 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.AppearanceArray = void 0;
7
+
8
+ /* eslint-disable @repo/internal/react/consistent-types-definitions */
7
9
  // exported for testing - keep in sync from `type AppearanceTypes`
10
+ // eslint-disable-next-line @repo/internal/react/require-jsdoc
8
11
  var AppearanceArray = ['error', 'info', 'normal', 'success', 'warning']; // CreateFlagsArg makes id optional so define this prop separately
9
12
 
10
13
  exports.AppearanceArray = AppearanceArray;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/flag",
3
- "version": "14.6.2",
3
+ "version": "14.7.0",
4
4
  "sideEffects": false
5
5
  }
@@ -5,8 +5,16 @@ 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.6.2";
8
+ const packageVersion = "14.7.0";
9
9
  export const AUTO_DISMISS_SECONDS = 8;
10
+ /**
11
+ * __Auto dismiss flag__
12
+ *
13
+ * An auto dismiss flag is dismissed automatically after eight seconds.
14
+ *
15
+ * - [Examples](https://atlassian.design/components/flag/auto-dismiss-flag/examples)
16
+ * - [Code](https://atlassian.design/components/flag/auto-dismiss-flag/code)
17
+ */
10
18
 
11
19
  const AutoDismissFlag = props => {
12
20
  const {
@@ -55,7 +63,8 @@ const AutoDismissFlag = props => {
55
63
  startAutoDismissTimer();
56
64
  return stopAutoDismissTimer;
57
65
  }, [startAutoDismissTimer, stopAutoDismissTimer]);
58
- return /*#__PURE__*/React.createElement(Flag, _extends({}, props, {
66
+ return /*#__PURE__*/React.createElement(Flag // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
67
+ , _extends({}, props, {
59
68
  onMouseOver: stopAutoDismissTimer,
60
69
  onFocus: stopAutoDismissTimer,
61
70
  onMouseOut: startAutoDismissTimer,
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable @repo/internal/styles/no-nested-styles */
2
2
 
3
3
  /** @jsx jsx */
4
- import { css, jsx } from '@emotion/core';
4
+ import { css, jsx } from '@emotion/react';
5
5
  import Button from '@atlaskit/button/custom-theme-button';
6
6
  import { gridSize as getGridSize } from '@atlaskit/theme/constants';
7
7
  import { DEFAULT_APPEARANCE } from './constants';
@@ -86,6 +86,7 @@ const FlagActions = props => {
86
86
  },
87
87
  css: [buttonStyles, isBold && isBoldButtonStyles, appearance === 'normal' && appeanceNormalButtonStyles]
88
88
  }, action.content)]));
89
- };
89
+ }; // eslint-disable-next-line @repo/internal/react/require-jsdoc
90
+
90
91
 
91
92
  export default FlagActions;
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
 
3
3
  /** @jsx jsx */
4
4
  import { Children, createContext, useContext, useMemo } from 'react';
5
- import { css, jsx } from '@emotion/core';
5
+ import { css, jsx } from '@emotion/react';
6
6
  import { easeIn, ExitingPersistence, SlideIn } from '@atlaskit/motion';
7
7
  import VisuallyHidden from '@atlaskit/visually-hidden';
8
8
  import noop from '@atlaskit/ds-lib/noop';
@@ -14,10 +14,12 @@ export const flagAnimationTime = 400;
14
14
  const flagBottom = gridSize * 6;
15
15
  const flagLeft = gridSize * 10;
16
16
  const defaultFlagGroupContext = {
17
- onDismissed: () => {},
17
+ onDismissed: noop,
18
18
  isDismissAllowed: false
19
- };
20
- export const FlagGroupContext = /*#__PURE__*/createContext(defaultFlagGroupContext);
19
+ }; // eslint-disable-next-line @repo/internal/react/require-jsdoc
20
+
21
+ export const FlagGroupContext = /*#__PURE__*/createContext(defaultFlagGroupContext); // eslint-disable-next-line @repo/internal/react/require-jsdoc
22
+
21
23
  export function useFlagGroup() {
22
24
  return useContext(FlagGroupContext);
23
25
  } // transition: none is set on first-of-type to prevent a bug in Firefox
@@ -68,6 +70,14 @@ const flagGroupContainerStyles = css({
68
70
  left: 0
69
71
  }
70
72
  });
73
+ /**
74
+ * __Flag group__
75
+ *
76
+ * A flag group is used to group a set of related flags, with entry and exit animations.
77
+ *
78
+ * - [Examples](https://atlassian.design/components/flag/flag-group/examples)
79
+ * - [Code](https://atlassian.design/components/flag/flag-group/code)
80
+ */
71
81
 
72
82
  const FlagGroup = props => {
73
83
  const {
@@ -4,6 +4,11 @@ import AutoDismissFlag from './auto-dismiss-flag';
4
4
  import Flag from './flag';
5
5
  import FlagGroup from './flag-group';
6
6
  const FlagContext = /*#__PURE__*/React.createContext(null);
7
+ /**
8
+ * useFlags is used to access the `showFlags` function which can be used to programatically display flags.
9
+ * - [Examples](https://atlassian.design/components/flag/flags-provider/examples#using-showflags)
10
+ */
11
+
7
12
  export function useFlags() {
8
13
  const api = useContext(FlagContext);
9
14