@atlaskit/empty-state 7.1.8 → 7.3.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.
Files changed (39) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/dist/cjs/{EmptyState/index.js → empty-state.js} +13 -12
  3. package/dist/cjs/index.js +2 -2
  4. package/dist/cjs/styled/actions-container.js +4 -7
  5. package/dist/cjs/styled/container.js +8 -8
  6. package/dist/cjs/styled/description.js +7 -8
  7. package/dist/cjs/styled/header.js +3 -10
  8. package/dist/cjs/styled/image.js +14 -15
  9. package/dist/cjs/styled/spinner-container.js +4 -7
  10. package/dist/cjs/types.js +5 -0
  11. package/dist/cjs/version.json +1 -1
  12. package/dist/es2019/{EmptyState/index.js → empty-state.js} +13 -11
  13. package/dist/es2019/index.js +1 -1
  14. package/dist/es2019/styled/actions-container.js +4 -4
  15. package/dist/es2019/styled/container.js +8 -5
  16. package/dist/es2019/styled/description.js +6 -5
  17. package/dist/es2019/styled/header.js +3 -6
  18. package/dist/es2019/styled/image.js +10 -13
  19. package/dist/es2019/styled/spinner-container.js +4 -4
  20. package/dist/es2019/types.js +1 -0
  21. package/dist/es2019/version.json +1 -1
  22. package/dist/esm/{EmptyState/index.js → empty-state.js} +13 -12
  23. package/dist/esm/index.js +1 -1
  24. package/dist/esm/styled/actions-container.js +4 -5
  25. package/dist/esm/styled/container.js +8 -6
  26. package/dist/esm/styled/description.js +6 -6
  27. package/dist/esm/styled/header.js +3 -8
  28. package/dist/esm/styled/image.js +14 -14
  29. package/dist/esm/styled/spinner-container.js +4 -5
  30. package/dist/esm/types.js +1 -0
  31. package/dist/esm/version.json +1 -1
  32. package/dist/types/empty-state.d.ts +25 -0
  33. package/dist/types/index.d.ts +2 -2
  34. package/dist/types/styled/container.d.ts +3 -2
  35. package/dist/types/styled/image.d.ts +0 -2
  36. package/dist/types/types.d.ts +76 -0
  37. package/package.json +10 -5
  38. package/types/package.json +7 -0
  39. package/dist/types/EmptyState/index.d.ts +0 -85
package/CHANGELOG.md CHANGED
@@ -1,5 +1,48 @@
1
1
  # @atlaskit/empty-state
2
2
 
3
+ ## 7.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 7.3.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`b5c96b26bf3`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b5c96b26bf3) - Instrumented empty-state with the new theming package, `@atlaskit/tokens`.
14
+
15
+ New tokens will be visible only in applications configured to use the new Tokens API (currently in alpha).
16
+ These changes are intended to be interoperable with the legacy theme implementation. Legacy dark mode users should expect no visual or breaking changes.
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies
21
+
22
+ ## 7.2.1
23
+
24
+ ### Patch Changes
25
+
26
+ - [`7465c0f0e1d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7465c0f0e1d) - Fix to account for the size/width fallback behaviour. Previously if a user provided a value for the the `width` property it would always be ignored, this is no longer the case.
27
+
28
+ ## 7.2.0
29
+
30
+ ### Minor Changes
31
+
32
+ - [`20ea31c9fdf`](https://bitbucket.org/atlassian/atlassian-frontend/commits/20ea31c9fdf) - **Deprecation Warning**
33
+ The `size` prop and `Sizes` type have been flagged as deprecated. Both are better described as a width and so internally have been renamed.
34
+ The `size` prop will continue to work in the shortrun before it's formally removed in the component's next major release.
35
+
36
+ Housekeeping:
37
+
38
+ - Component now uses the new entrypoint format.
39
+ - Prop descriptions have been updated to better describe component behaviors.
40
+ - Small bug fix related to additional props being spread in to some of the component's internals.
41
+
42
+ ### Patch Changes
43
+
44
+ - Updated dependencies
45
+
3
46
  ## 7.1.8
4
47
 
5
48
  ### Patch Changes
@@ -13,7 +13,7 @@ var _buttonGroup = _interopRequireDefault(require("@atlaskit/button/button-group
13
13
 
14
14
  var _spinner = _interopRequireDefault(require("@atlaskit/spinner"));
15
15
 
16
- var _styled = require("../styled");
16
+ var _styled = require("./styled");
17
17
 
18
18
  /**
19
19
  * __Empty state__
@@ -25,13 +25,14 @@ var _styled = require("../styled");
25
25
  * ```tsx
26
26
  * import EmptyState from '@atlaskit/empty-state';
27
27
  *
28
+ * // An example of a 404 state
28
29
  * export default () => {
29
30
  * <EmptyState
30
- * header="I am the header"
31
- * imageUrl="link/to/image"
32
- * description="some description"
33
- * primaryAction={<Button appearance="primary" />}
34
- * secondaryAction={<Button />}
31
+ * header="Page not found"
32
+ * imageUrl="https://cdn.io/images/404"
33
+ * description="Looks like you've stumbled off track. Sorry about that! This page either doesn't exist or has been removed."
34
+ * primaryAction={<Button appearance="primary">Home Page</Button>}
35
+ * secondaryAction={<Button>Report a problem</Button>}
35
36
  * />;
36
37
  * };
37
38
  * ```
@@ -50,15 +51,15 @@ var EmptyState = function EmptyState(_ref) {
50
51
  primaryAction = _ref.primaryAction,
51
52
  renderImage = _ref.renderImage,
52
53
  secondaryAction = _ref.secondaryAction,
53
- _ref$size = _ref.size,
54
- size = _ref$size === void 0 ? 'wide' : _ref$size,
55
- tertiaryAction = _ref.tertiaryAction;
54
+ width = _ref.width,
55
+ size = _ref.size,
56
+ tertiaryAction = _ref.tertiaryAction,
57
+ testId = _ref.testId;
56
58
  var actionsContainer = primaryAction || secondaryAction || isLoading ? /*#__PURE__*/_react.default.createElement(_styled.ActionsContainer, null, /*#__PURE__*/_react.default.createElement(_buttonGroup.default, null, secondaryAction, primaryAction), /*#__PURE__*/_react.default.createElement(_styled.SpinnerContainer, null, isLoading && /*#__PURE__*/_react.default.createElement(_spinner.default, null))) : null;
57
59
  return /*#__PURE__*/_react.default.createElement(_styled.Container, {
58
- size: size
60
+ testId: testId,
61
+ width: width || size || 'wide'
59
62
  }, imageUrl ? /*#__PURE__*/_react.default.createElement(_styled.Image, {
60
- alt: "",
61
- role: "presentation",
62
63
  src: imageUrl,
63
64
  maxWidth: maxImageWidth,
64
65
  maxHeight: maxImageHeight,
package/dist/cjs/index.js CHANGED
@@ -8,8 +8,8 @@ Object.defineProperty(exports, "__esModule", {
8
8
  Object.defineProperty(exports, "default", {
9
9
  enumerable: true,
10
10
  get: function get() {
11
- return _EmptyState.default;
11
+ return _emptyState.default;
12
12
  }
13
13
  });
14
14
 
15
- var _EmptyState = _interopRequireDefault(require("./EmptyState"));
15
+ var _emptyState = _interopRequireDefault(require("./empty-state"));
@@ -1,14 +1,10 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
6
  exports.default = void 0;
9
7
 
10
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
-
12
8
  var _core = require("@emotion/core");
13
9
 
14
10
  var _constants = require("@atlaskit/theme/constants");
@@ -30,10 +26,11 @@ var actionsStyles = (0, _core.css)({
30
26
  * @internal
31
27
  */
32
28
 
33
- var ActionsContainer = function ActionsContainer(props) {
34
- return (0, _core.jsx)("div", (0, _extends2.default)({
29
+ var ActionsContainer = function ActionsContainer(_ref) {
30
+ var children = _ref.children;
31
+ return (0, _core.jsx)("div", {
35
32
  css: actionsStyles
36
- }, props));
33
+ }, children);
37
34
  };
38
35
 
39
36
  var _default = ActionsContainer;
@@ -1,14 +1,10 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
6
  exports.default = void 0;
9
7
 
10
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
-
12
8
  var _core = require("@emotion/core");
13
9
 
14
10
  var _constants = require("@atlaskit/theme/constants");
@@ -38,10 +34,14 @@ var narrowContainerStyles = (0, _core.css)({
38
34
  * @internal
39
35
  */
40
36
 
41
- var Container = function Container(props) {
42
- return (0, _core.jsx)("div", (0, _extends2.default)({
43
- css: [containerStyles, props.size === 'narrow' ? narrowContainerStyles : wideContainerStyles]
44
- }, props));
37
+ var Container = function Container(_ref) {
38
+ var children = _ref.children,
39
+ width = _ref.width,
40
+ testId = _ref.testId;
41
+ return (0, _core.jsx)("div", {
42
+ "data-testid": testId,
43
+ css: [containerStyles, width === 'narrow' ? narrowContainerStyles : wideContainerStyles]
44
+ }, children);
45
45
  };
46
46
 
47
47
  var _default = Container;
@@ -1,25 +1,23 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
6
  exports.default = void 0;
9
7
 
10
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
-
12
8
  var _core = require("@emotion/core");
13
9
 
14
10
  var _colors = require("@atlaskit/theme/colors");
15
11
 
16
12
  var _constants = require("@atlaskit/theme/constants");
17
13
 
14
+ var _tokens = require("@atlaskit/tokens");
15
+
18
16
  /** @jsx jsx */
19
17
  var descriptionStyles = (0, _core.css)({
20
18
  marginTop: 0,
21
19
  marginBottom: "".concat((0, _constants.gridSize)() * 3, "px"),
22
- color: _colors.N800
20
+ color: (0, _tokens.token)('color.text.highEmphasis', _colors.N800)
23
21
  });
24
22
  /**
25
23
  * __Description__
@@ -29,10 +27,11 @@ var descriptionStyles = (0, _core.css)({
29
27
  * @internal
30
28
  */
31
29
 
32
- var Description = function Description(props) {
33
- return (0, _core.jsx)("p", (0, _extends2.default)({
30
+ var Description = function Description(_ref) {
31
+ var children = _ref.children;
32
+ return (0, _core.jsx)("p", {
34
33
  css: descriptionStyles
35
- }, props));
34
+ }, children);
36
35
  };
37
36
 
38
37
  var _default = Description;
@@ -1,16 +1,10 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
6
  exports.default = void 0;
9
7
 
10
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
-
12
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
13
-
14
8
  var _core = require("@emotion/core");
15
9
 
16
10
  var _constants = require("@atlaskit/theme/constants");
@@ -32,11 +26,10 @@ var headerStyles = (0, _core.css)([(0, _typography.h600)(), {
32
26
  */
33
27
 
34
28
  var EmptyStateHeader = function EmptyStateHeader(_ref) {
35
- var children = _ref.children,
36
- props = (0, _objectWithoutProperties2.default)(_ref, ["children"]);
37
- return (0, _core.jsx)("h4", (0, _extends2.default)({
29
+ var children = _ref.children;
30
+ return (0, _core.jsx)("h4", {
38
31
  css: headerStyles
39
- }, props), children);
32
+ }, children);
40
33
  };
41
34
 
42
35
  var _default = EmptyStateHeader;
@@ -7,26 +7,18 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.default = void 0;
9
9
 
10
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
-
12
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
11
 
14
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
15
-
16
12
  var _core = require("@emotion/core");
17
13
 
18
14
  var _constants = require("@atlaskit/theme/constants");
19
15
 
20
16
  /** @jsx jsx */
21
- var CSS_VAR_WIDTH = '--width';
22
17
  var CSS_VAR_MAX_WIDTH = '--max-width';
23
- var CSS_VAR_HEIGHT = '--height';
24
18
  var CSS_VAR_MAX_HEIGHT = '--max-height';
25
19
  var imageStyles = (0, _core.css)({
26
20
  display: 'block',
27
- width: "var(".concat(CSS_VAR_WIDTH, ")"),
28
21
  maxWidth: "var(".concat(CSS_VAR_MAX_WIDTH, ")"),
29
- height: "var(".concat(CSS_VAR_HEIGHT, ")"),
30
22
  maxHeight: "var(".concat(CSS_VAR_MAX_HEIGHT, ")"),
31
23
  margin: "0 auto ".concat((0, _constants.gridSize)() * 3, "px")
32
24
  });
@@ -41,15 +33,22 @@ var imageStyles = (0, _core.css)({
41
33
  var Image = function Image(_ref) {
42
34
  var _ref2;
43
35
 
44
- var alt = _ref.alt,
45
- maxHeight = _ref.maxHeight,
36
+ var maxHeight = _ref.maxHeight,
46
37
  maxWidth = _ref.maxWidth,
47
- props = (0, _objectWithoutProperties2.default)(_ref, ["alt", "maxHeight", "maxWidth"]);
48
- return (0, _core.jsx)("img", (0, _extends2.default)({
49
- style: (_ref2 = {}, (0, _defineProperty2.default)(_ref2, CSS_VAR_WIDTH, props.width || 'auto'), (0, _defineProperty2.default)(_ref2, CSS_VAR_MAX_WIDTH, "".concat(maxWidth, "px")), (0, _defineProperty2.default)(_ref2, CSS_VAR_HEIGHT, props.height || 'auto'), (0, _defineProperty2.default)(_ref2, CSS_VAR_MAX_HEIGHT, "".concat(maxHeight, "px")), _ref2),
38
+ _ref$height = _ref.height,
39
+ height = _ref$height === void 0 ? 'auto' : _ref$height,
40
+ _ref$width = _ref.width,
41
+ width = _ref$width === void 0 ? 'auto' : _ref$width,
42
+ src = _ref.src;
43
+ return (0, _core.jsx)("img", {
44
+ style: (_ref2 = {}, (0, _defineProperty2.default)(_ref2, CSS_VAR_MAX_WIDTH, "".concat(maxWidth, "px")), (0, _defineProperty2.default)(_ref2, CSS_VAR_MAX_HEIGHT, "".concat(maxHeight, "px")), _ref2),
45
+ width: width,
46
+ height: height,
47
+ alt: "",
48
+ role: "presentation",
50
49
  css: imageStyles,
51
- alt: alt
52
- }, props));
50
+ src: src
51
+ });
53
52
  };
54
53
 
55
54
  var _default = Image;
@@ -1,14 +1,10 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
6
  exports.default = void 0;
9
7
 
10
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
-
12
8
  var _core = require("@emotion/core");
13
9
 
14
10
  var _constants = require("@atlaskit/theme/constants");
@@ -27,10 +23,11 @@ var spinnerContainerStyles = (0, _core.css)({
27
23
  * @internal
28
24
  */
29
25
 
30
- var SpinnerContainer = function SpinnerContainer(props) {
31
- return (0, _core.jsx)("div", (0, _extends2.default)({
26
+ var SpinnerContainer = function SpinnerContainer(_ref) {
27
+ var children = _ref.children;
28
+ return (0, _core.jsx)("div", {
32
29
  css: spinnerContainerStyles
33
- }, props));
30
+ }, children);
34
31
  };
35
32
 
36
33
  var _default = SpinnerContainer;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/empty-state",
3
- "version": "7.1.8",
3
+ "version": "7.3.1",
4
4
  "sideEffects": false
5
5
  }
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import ButtonGroup from '@atlaskit/button/button-group';
3
3
  import Spinner from '@atlaskit/spinner';
4
- import { ActionsContainer, Container, Description, Header, Image, SpinnerContainer } from '../styled';
4
+ import { ActionsContainer, Container, Description, Header, Image, SpinnerContainer } from './styled';
5
5
 
6
6
  /**
7
7
  * __Empty state__
@@ -13,13 +13,14 @@ import { ActionsContainer, Container, Description, Header, Image, SpinnerContain
13
13
  * ```tsx
14
14
  * import EmptyState from '@atlaskit/empty-state';
15
15
  *
16
+ * // An example of a 404 state
16
17
  * export default () => {
17
18
  * <EmptyState
18
- * header="I am the header"
19
- * imageUrl="link/to/image"
20
- * description="some description"
21
- * primaryAction={<Button appearance="primary" />}
22
- * secondaryAction={<Button />}
19
+ * header="Page not found"
20
+ * imageUrl="https://cdn.io/images/404"
21
+ * description="Looks like you've stumbled off track. Sorry about that! This page either doesn't exist or has been removed."
22
+ * primaryAction={<Button appearance="primary">Home Page</Button>}
23
+ * secondaryAction={<Button>Report a problem</Button>}
23
24
  * />;
24
25
  * };
25
26
  * ```
@@ -36,15 +37,16 @@ const EmptyState = ({
36
37
  primaryAction,
37
38
  renderImage,
38
39
  secondaryAction,
39
- size = 'wide',
40
- tertiaryAction
40
+ width,
41
+ size,
42
+ tertiaryAction,
43
+ testId
41
44
  }) => {
42
45
  const actionsContainer = primaryAction || secondaryAction || isLoading ? /*#__PURE__*/React.createElement(ActionsContainer, null, /*#__PURE__*/React.createElement(ButtonGroup, null, secondaryAction, primaryAction), /*#__PURE__*/React.createElement(SpinnerContainer, null, isLoading && /*#__PURE__*/React.createElement(Spinner, null))) : null;
43
46
  return /*#__PURE__*/React.createElement(Container, {
44
- size: size
47
+ testId: testId,
48
+ width: width || size || 'wide'
45
49
  }, imageUrl ? /*#__PURE__*/React.createElement(Image, {
46
- alt: "",
47
- role: "presentation",
48
50
  src: imageUrl,
49
51
  maxWidth: maxImageWidth,
50
52
  maxHeight: maxImageHeight,
@@ -1 +1 @@
1
- export { default } from './EmptyState';
1
+ export { default } from './empty-state';
@@ -1,5 +1,3 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
-
3
1
  /** @jsx jsx */
4
2
  import { css, jsx } from '@emotion/core';
5
3
  import { gridSize as getGridSize } from '@atlaskit/theme/constants';
@@ -19,8 +17,10 @@ const actionsStyles = css({
19
17
  * @internal
20
18
  */
21
19
 
22
- const ActionsContainer = props => jsx("div", _extends({
20
+ const ActionsContainer = ({
21
+ children
22
+ }) => jsx("div", {
23
23
  css: actionsStyles
24
- }, props));
24
+ }, children);
25
25
 
26
26
  export default ActionsContainer;
@@ -1,5 +1,3 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
-
3
1
  /** @jsx jsx */
4
2
  import { css, jsx } from '@emotion/core';
5
3
  import { gridSize as getGridSize } from '@atlaskit/theme/constants';
@@ -27,8 +25,13 @@ const narrowContainerStyles = css({
27
25
  * @internal
28
26
  */
29
27
 
30
- const Container = props => jsx("div", _extends({
31
- css: [containerStyles, props.size === 'narrow' ? narrowContainerStyles : wideContainerStyles]
32
- }, props));
28
+ const Container = ({
29
+ children,
30
+ width,
31
+ testId
32
+ }) => jsx("div", {
33
+ "data-testid": testId,
34
+ css: [containerStyles, width === 'narrow' ? narrowContainerStyles : wideContainerStyles]
35
+ }, children);
33
36
 
34
37
  export default Container;
@@ -1,13 +1,12 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
-
3
1
  /** @jsx jsx */
4
2
  import { css, jsx } from '@emotion/core';
5
3
  import { N800 } from '@atlaskit/theme/colors';
6
4
  import { gridSize as getGridSize } from '@atlaskit/theme/constants';
5
+ import { token } from '@atlaskit/tokens';
7
6
  const descriptionStyles = css({
8
7
  marginTop: 0,
9
8
  marginBottom: `${getGridSize() * 3}px`,
10
- color: N800
9
+ color: token('color.text.highEmphasis', N800)
11
10
  });
12
11
  /**
13
12
  * __Description__
@@ -17,8 +16,10 @@ const descriptionStyles = css({
17
16
  * @internal
18
17
  */
19
18
 
20
- const Description = props => jsx("p", _extends({
19
+ const Description = ({
20
+ children
21
+ }) => jsx("p", {
21
22
  css: descriptionStyles
22
- }, props));
23
+ }, children);
23
24
 
24
25
  export default Description;
@@ -1,5 +1,3 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
-
3
1
  /** @jsx jsx */
4
2
  import { css, jsx } from '@emotion/core';
5
3
  import { gridSize as getGridSize } from '@atlaskit/theme/constants';
@@ -18,10 +16,9 @@ const headerStyles = css([h600(), {
18
16
  */
19
17
 
20
18
  const EmptyStateHeader = ({
21
- children,
22
- ...props
23
- }) => jsx("h4", _extends({
19
+ children
20
+ }) => jsx("h4", {
24
21
  css: headerStyles
25
- }, props), children);
22
+ }, children);
26
23
 
27
24
  export default EmptyStateHeader;
@@ -1,17 +1,11 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
-
3
1
  /** @jsx jsx */
4
2
  import { css, jsx } from '@emotion/core';
5
3
  import { gridSize as getGridSize } from '@atlaskit/theme/constants';
6
- const CSS_VAR_WIDTH = '--width';
7
4
  const CSS_VAR_MAX_WIDTH = '--max-width';
8
- const CSS_VAR_HEIGHT = '--height';
9
5
  const CSS_VAR_MAX_HEIGHT = '--max-height';
10
6
  const imageStyles = css({
11
7
  display: 'block',
12
- width: `var(${CSS_VAR_WIDTH})`,
13
8
  maxWidth: `var(${CSS_VAR_MAX_WIDTH})`,
14
- height: `var(${CSS_VAR_HEIGHT})`,
15
9
  maxHeight: `var(${CSS_VAR_MAX_HEIGHT})`,
16
10
  margin: `0 auto ${getGridSize() * 3}px`
17
11
  });
@@ -24,19 +18,22 @@ const imageStyles = css({
24
18
  */
25
19
 
26
20
  const Image = ({
27
- alt,
28
21
  maxHeight,
29
22
  maxWidth,
30
- ...props
31
- }) => jsx("img", _extends({
23
+ height = 'auto',
24
+ width = 'auto',
25
+ src
26
+ }) => jsx("img", {
32
27
  style: {
33
- [CSS_VAR_WIDTH]: props.width || 'auto',
34
28
  [CSS_VAR_MAX_WIDTH]: `${maxWidth}px`,
35
- [CSS_VAR_HEIGHT]: props.height || 'auto',
36
29
  [CSS_VAR_MAX_HEIGHT]: `${maxHeight}px`
37
30
  },
31
+ width: width,
32
+ height: height,
33
+ alt: "",
34
+ role: "presentation",
38
35
  css: imageStyles,
39
- alt: alt
40
- }, props));
36
+ src: src
37
+ });
41
38
 
42
39
  export default Image;
@@ -1,5 +1,3 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
-
3
1
  /** @jsx jsx */
4
2
  import { css, jsx } from '@emotion/core';
5
3
  import { gridSize as getGridSize } from '@atlaskit/theme/constants';
@@ -16,8 +14,10 @@ const spinnerContainerStyles = css({
16
14
  * @internal
17
15
  */
18
16
 
19
- const SpinnerContainer = props => jsx("div", _extends({
17
+ const SpinnerContainer = ({
18
+ children
19
+ }) => jsx("div", {
20
20
  css: spinnerContainerStyles
21
- }, props));
21
+ }, children);
22
22
 
23
23
  export default SpinnerContainer;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/empty-state",
3
- "version": "7.1.8",
3
+ "version": "7.3.1",
4
4
  "sideEffects": false
5
5
  }
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import ButtonGroup from '@atlaskit/button/button-group';
3
3
  import Spinner from '@atlaskit/spinner';
4
- import { ActionsContainer, Container, Description, Header, Image, SpinnerContainer } from '../styled';
4
+ import { ActionsContainer, Container, Description, Header, Image, SpinnerContainer } from './styled';
5
5
 
6
6
  /**
7
7
  * __Empty state__
@@ -13,13 +13,14 @@ import { ActionsContainer, Container, Description, Header, Image, SpinnerContain
13
13
  * ```tsx
14
14
  * import EmptyState from '@atlaskit/empty-state';
15
15
  *
16
+ * // An example of a 404 state
16
17
  * export default () => {
17
18
  * <EmptyState
18
- * header="I am the header"
19
- * imageUrl="link/to/image"
20
- * description="some description"
21
- * primaryAction={<Button appearance="primary" />}
22
- * secondaryAction={<Button />}
19
+ * header="Page not found"
20
+ * imageUrl="https://cdn.io/images/404"
21
+ * description="Looks like you've stumbled off track. Sorry about that! This page either doesn't exist or has been removed."
22
+ * primaryAction={<Button appearance="primary">Home Page</Button>}
23
+ * secondaryAction={<Button>Report a problem</Button>}
23
24
  * />;
24
25
  * };
25
26
  * ```
@@ -38,15 +39,15 @@ var EmptyState = function EmptyState(_ref) {
38
39
  primaryAction = _ref.primaryAction,
39
40
  renderImage = _ref.renderImage,
40
41
  secondaryAction = _ref.secondaryAction,
41
- _ref$size = _ref.size,
42
- size = _ref$size === void 0 ? 'wide' : _ref$size,
43
- tertiaryAction = _ref.tertiaryAction;
42
+ width = _ref.width,
43
+ size = _ref.size,
44
+ tertiaryAction = _ref.tertiaryAction,
45
+ testId = _ref.testId;
44
46
  var actionsContainer = primaryAction || secondaryAction || isLoading ? /*#__PURE__*/React.createElement(ActionsContainer, null, /*#__PURE__*/React.createElement(ButtonGroup, null, secondaryAction, primaryAction), /*#__PURE__*/React.createElement(SpinnerContainer, null, isLoading && /*#__PURE__*/React.createElement(Spinner, null))) : null;
45
47
  return /*#__PURE__*/React.createElement(Container, {
46
- size: size
48
+ testId: testId,
49
+ width: width || size || 'wide'
47
50
  }, imageUrl ? /*#__PURE__*/React.createElement(Image, {
48
- alt: "",
49
- role: "presentation",
50
51
  src: imageUrl,
51
52
  maxWidth: maxImageWidth,
52
53
  maxHeight: maxImageHeight,
package/dist/esm/index.js CHANGED
@@ -1 +1 @@
1
- export { default } from './EmptyState';
1
+ export { default } from './empty-state';
@@ -1,5 +1,3 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
-
3
1
  /** @jsx jsx */
4
2
  import { css, jsx } from '@emotion/core';
5
3
  import { gridSize as getGridSize } from '@atlaskit/theme/constants';
@@ -19,10 +17,11 @@ var actionsStyles = css({
19
17
  * @internal
20
18
  */
21
19
 
22
- var ActionsContainer = function ActionsContainer(props) {
23
- return jsx("div", _extends({
20
+ var ActionsContainer = function ActionsContainer(_ref) {
21
+ var children = _ref.children;
22
+ return jsx("div", {
24
23
  css: actionsStyles
25
- }, props));
24
+ }, children);
26
25
  };
27
26
 
28
27
  export default ActionsContainer;
@@ -1,5 +1,3 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
-
3
1
  /** @jsx jsx */
4
2
  import { css, jsx } from '@emotion/core';
5
3
  import { gridSize as getGridSize } from '@atlaskit/theme/constants';
@@ -27,10 +25,14 @@ var narrowContainerStyles = css({
27
25
  * @internal
28
26
  */
29
27
 
30
- var Container = function Container(props) {
31
- return jsx("div", _extends({
32
- css: [containerStyles, props.size === 'narrow' ? narrowContainerStyles : wideContainerStyles]
33
- }, props));
28
+ var Container = function Container(_ref) {
29
+ var children = _ref.children,
30
+ width = _ref.width,
31
+ testId = _ref.testId;
32
+ return jsx("div", {
33
+ "data-testid": testId,
34
+ css: [containerStyles, width === 'narrow' ? narrowContainerStyles : wideContainerStyles]
35
+ }, children);
34
36
  };
35
37
 
36
38
  export default Container;
@@ -1,13 +1,12 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
-
3
1
  /** @jsx jsx */
4
2
  import { css, jsx } from '@emotion/core';
5
3
  import { N800 } from '@atlaskit/theme/colors';
6
4
  import { gridSize as getGridSize } from '@atlaskit/theme/constants';
5
+ import { token } from '@atlaskit/tokens';
7
6
  var descriptionStyles = css({
8
7
  marginTop: 0,
9
8
  marginBottom: "".concat(getGridSize() * 3, "px"),
10
- color: N800
9
+ color: token('color.text.highEmphasis', N800)
11
10
  });
12
11
  /**
13
12
  * __Description__
@@ -17,10 +16,11 @@ var descriptionStyles = css({
17
16
  * @internal
18
17
  */
19
18
 
20
- var Description = function Description(props) {
21
- return jsx("p", _extends({
19
+ var Description = function Description(_ref) {
20
+ var children = _ref.children;
21
+ return jsx("p", {
22
22
  css: descriptionStyles
23
- }, props));
23
+ }, children);
24
24
  };
25
25
 
26
26
  export default Description;
@@ -1,6 +1,3 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
-
4
1
  /** @jsx jsx */
5
2
  import { css, jsx } from '@emotion/core';
6
3
  import { gridSize as getGridSize } from '@atlaskit/theme/constants';
@@ -19,12 +16,10 @@ var headerStyles = css([h600(), {
19
16
  */
20
17
 
21
18
  var EmptyStateHeader = function EmptyStateHeader(_ref) {
22
- var children = _ref.children,
23
- props = _objectWithoutProperties(_ref, ["children"]);
24
-
25
- return jsx("h4", _extends({
19
+ var children = _ref.children;
20
+ return jsx("h4", {
26
21
  css: headerStyles
27
- }, props), children);
22
+ }, children);
28
23
  };
29
24
 
30
25
  export default EmptyStateHeader;
@@ -1,19 +1,13 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
2
 
5
3
  /** @jsx jsx */
6
4
  import { css, jsx } from '@emotion/core';
7
5
  import { gridSize as getGridSize } from '@atlaskit/theme/constants';
8
- var CSS_VAR_WIDTH = '--width';
9
6
  var CSS_VAR_MAX_WIDTH = '--max-width';
10
- var CSS_VAR_HEIGHT = '--height';
11
7
  var CSS_VAR_MAX_HEIGHT = '--max-height';
12
8
  var imageStyles = css({
13
9
  display: 'block',
14
- width: "var(".concat(CSS_VAR_WIDTH, ")"),
15
10
  maxWidth: "var(".concat(CSS_VAR_MAX_WIDTH, ")"),
16
- height: "var(".concat(CSS_VAR_HEIGHT, ")"),
17
11
  maxHeight: "var(".concat(CSS_VAR_MAX_HEIGHT, ")"),
18
12
  margin: "0 auto ".concat(getGridSize() * 3, "px")
19
13
  });
@@ -28,16 +22,22 @@ var imageStyles = css({
28
22
  var Image = function Image(_ref) {
29
23
  var _ref2;
30
24
 
31
- var alt = _ref.alt,
32
- maxHeight = _ref.maxHeight,
25
+ var maxHeight = _ref.maxHeight,
33
26
  maxWidth = _ref.maxWidth,
34
- props = _objectWithoutProperties(_ref, ["alt", "maxHeight", "maxWidth"]);
35
-
36
- return jsx("img", _extends({
37
- style: (_ref2 = {}, _defineProperty(_ref2, CSS_VAR_WIDTH, props.width || 'auto'), _defineProperty(_ref2, CSS_VAR_MAX_WIDTH, "".concat(maxWidth, "px")), _defineProperty(_ref2, CSS_VAR_HEIGHT, props.height || 'auto'), _defineProperty(_ref2, CSS_VAR_MAX_HEIGHT, "".concat(maxHeight, "px")), _ref2),
27
+ _ref$height = _ref.height,
28
+ height = _ref$height === void 0 ? 'auto' : _ref$height,
29
+ _ref$width = _ref.width,
30
+ width = _ref$width === void 0 ? 'auto' : _ref$width,
31
+ src = _ref.src;
32
+ return jsx("img", {
33
+ style: (_ref2 = {}, _defineProperty(_ref2, CSS_VAR_MAX_WIDTH, "".concat(maxWidth, "px")), _defineProperty(_ref2, CSS_VAR_MAX_HEIGHT, "".concat(maxHeight, "px")), _ref2),
34
+ width: width,
35
+ height: height,
36
+ alt: "",
37
+ role: "presentation",
38
38
  css: imageStyles,
39
- alt: alt
40
- }, props));
39
+ src: src
40
+ });
41
41
  };
42
42
 
43
43
  export default Image;
@@ -1,5 +1,3 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
-
3
1
  /** @jsx jsx */
4
2
  import { css, jsx } from '@emotion/core';
5
3
  import { gridSize as getGridSize } from '@atlaskit/theme/constants';
@@ -16,10 +14,11 @@ var spinnerContainerStyles = css({
16
14
  * @internal
17
15
  */
18
16
 
19
- var SpinnerContainer = function SpinnerContainer(props) {
20
- return jsx("div", _extends({
17
+ var SpinnerContainer = function SpinnerContainer(_ref) {
18
+ var children = _ref.children;
19
+ return jsx("div", {
21
20
  css: spinnerContainerStyles
22
- }, props));
21
+ }, children);
23
22
  };
24
23
 
25
24
  export default SpinnerContainer;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/empty-state",
3
- "version": "7.1.8",
3
+ "version": "7.3.1",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1,25 @@
1
+ import type { EmptyStateProps } from './types';
2
+ /**
3
+ * __Empty state__
4
+ *
5
+ * A component used for presenting various empty states.
6
+ * e.g. (no items, empty search, broken link, welcome screen etc.)
7
+ *
8
+ * @example
9
+ * ```tsx
10
+ * import EmptyState from '@atlaskit/empty-state';
11
+ *
12
+ * // An example of a 404 state
13
+ * export default () => {
14
+ * <EmptyState
15
+ * header="Page not found"
16
+ * imageUrl="https://cdn.io/images/404"
17
+ * description="Looks like you've stumbled off track. Sorry about that! This page either doesn't exist or has been removed."
18
+ * primaryAction={<Button appearance="primary">Home Page</Button>}
19
+ * secondaryAction={<Button>Report a problem</Button>}
20
+ * />;
21
+ * };
22
+ * ```
23
+ */
24
+ declare const EmptyState: ({ description, header, imageHeight, imageUrl, imageWidth, isLoading, maxImageHeight, maxImageWidth, primaryAction, renderImage, secondaryAction, width, size, tertiaryAction, testId, }: EmptyStateProps) => JSX.Element;
25
+ export default EmptyState;
@@ -1,2 +1,2 @@
1
- export { default } from './EmptyState';
2
- export type { Sizes, RenderImageProps } from './EmptyState';
1
+ export { default } from './empty-state';
2
+ export type { Sizes, Width, RenderImageProps, EmptyStateProps } from './types';
@@ -1,6 +1,6 @@
1
1
  /** @jsx jsx */
2
2
  import { FC } from 'react';
3
- import { Sizes } from '../index';
3
+ import type { Width } from '../index';
4
4
  /**
5
5
  * __Container__
6
6
  *
@@ -9,6 +9,7 @@ import { Sizes } from '../index';
9
9
  * @internal
10
10
  */
11
11
  declare const Container: FC<{
12
- size: Sizes;
12
+ testId?: string;
13
+ width: Width;
13
14
  }>;
14
15
  export default Container;
@@ -4,9 +4,7 @@ declare type ImageProps = {
4
4
  height?: number;
5
5
  maxHeight: number;
6
6
  maxWidth: number;
7
- alt: string;
8
7
  width?: number;
9
- role: string;
10
8
  src: string;
11
9
  };
12
10
  /**
@@ -0,0 +1,76 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface RenderImageProps {
3
+ maxImageWidth?: number;
4
+ maxImageHeight?: number;
5
+ imageWidth?: number;
6
+ imageHeight?: number;
7
+ }
8
+ export declare type Sizes = 'narrow' | 'wide';
9
+ export declare type Width = Sizes;
10
+ export interface EmptyStateProps {
11
+ /**
12
+ * Title that briefly describes the page to the user.
13
+ */
14
+ header: string;
15
+ /**
16
+ * The main block of text that holds additional supporting information.
17
+ */
18
+ description?: ReactNode;
19
+ /**
20
+ * Controls how much horizontal space the component fills. Defaults to "wide".
21
+ */
22
+ width?: Width;
23
+ /**
24
+ * @deprecated
25
+ * Duplicates the `width` prop. Use `width instead`.
26
+ */
27
+ size?: Width;
28
+ /**
29
+ * The url of image that will be shown above the title, fed directly into the `src` prop of an <img> element.
30
+ * Note, this image will be constrained by the `maxWidth` and `maxHeight` props.
31
+ */
32
+ imageUrl?: string;
33
+ /**
34
+ * Maximum width (in pixels) of the image, default value is 160.
35
+ */
36
+ maxImageWidth?: number;
37
+ /**
38
+ * Maximum height (in pixels) of the image, default value is 160.
39
+ */
40
+ maxImageHeight?: number;
41
+ /**
42
+ * Primary action button for the page, usually it will be something like "Create" (or "Retry" for error pages).
43
+ */
44
+ primaryAction?: ReactNode;
45
+ /**
46
+ * An alternative API to supply an image using a render prop. Only rendered if no `imageUrl` is supplied.
47
+ */
48
+ renderImage?: (props: RenderImageProps) => React.ReactNode;
49
+ /**
50
+ * Secondary action button for the page.
51
+ */
52
+ secondaryAction?: ReactNode;
53
+ /**
54
+ * Button with link to some external resource like documentation or tutorial, it will be opened in a new tab.
55
+ */
56
+ tertiaryAction?: ReactNode;
57
+ /**
58
+ * A hook for automated testing
59
+ */
60
+ testId?: string;
61
+ /**
62
+ * Used to indicate a loading state. Will show a spinner next to the action buttons when true.
63
+ */
64
+ isLoading?: boolean;
65
+ /**
66
+ * Width of the image that is rendered in EmptyState component.
67
+ * Useful when you want image to be of exact width to stop it bouncing around when loading in.
68
+ */
69
+ imageWidth?: number;
70
+ /**
71
+ * Height of the image that is rendered in EmptyState component.
72
+ * Useful when you want image to be of exact height to stop it bouncing around when loading in.
73
+ * Only set `height` if you want the image to resize down on smaller devices.
74
+ */
75
+ imageHeight?: number;
76
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@atlaskit/empty-state",
3
- "version": "7.1.8",
4
- "description": "A React component used for presenting various empty states (no items, empty search, broken link, welcome screen etc.)",
3
+ "version": "7.3.1",
4
+ "description": "An empty state appears when there is no data to display and describes what the user can do next.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
7
7
  },
@@ -16,7 +16,6 @@
16
16
  "atlaskit:src": "src/index.tsx",
17
17
  "atlassian": {
18
18
  "team": "Design System Team",
19
- "deprecatedAutoEntryPoints": true,
20
19
  "inPublicMirror": true,
21
20
  "releaseModel": "scheduled",
22
21
  "website": {
@@ -26,7 +25,8 @@
26
25
  "dependencies": {
27
26
  "@atlaskit/button": "^16.1.0",
28
27
  "@atlaskit/spinner": "^15.1.0",
29
- "@atlaskit/theme": "^11.4.0",
28
+ "@atlaskit/theme": "^12.0.0",
29
+ "@atlaskit/tokens": "^0.3.0",
30
30
  "@babel/runtime": "^7.0.0",
31
31
  "@emotion/core": "^10.0.9"
32
32
  },
@@ -39,6 +39,7 @@
39
39
  "@atlaskit/ssr": "*",
40
40
  "@atlaskit/visual-regression": "*",
41
41
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
42
+ "@testing-library/react": "^8.0.1",
42
43
  "enzyme": "^3.10.0",
43
44
  "react-dom": "^16.8.0",
44
45
  "typescript": "3.9.6",
@@ -50,11 +51,15 @@
50
51
  },
51
52
  "@repo/internal": {
52
53
  "analytics": "analytics-next",
53
- "theming": "new-theming-api",
54
+ "theming": "tokens",
54
55
  "styling": "emotion",
55
56
  "design-system": "v1",
56
57
  "deprecation": "no-deprecated-imports"
57
58
  }
58
59
  },
60
+ "af:exports": {
61
+ "./types": "./src/types.tsx",
62
+ ".": "./src/index.tsx"
63
+ },
59
64
  "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
60
65
  }
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "@atlaskit/empty-state/types",
3
+ "main": "../dist/cjs/types.js",
4
+ "module": "../dist/esm/types.js",
5
+ "module:es2019": "../dist/es2019/types.js",
6
+ "types": "../dist/types/types.d.ts"
7
+ }
@@ -1,85 +0,0 @@
1
- import React, { ReactNode } from 'react';
2
- export interface RenderImageProps {
3
- maxImageWidth?: number;
4
- maxImageHeight?: number;
5
- imageWidth?: number;
6
- imageHeight?: number;
7
- }
8
- export declare type Sizes = 'narrow' | 'wide';
9
- interface EmptyStateProps {
10
- /**
11
- * Title that briefly describes the page to the user.
12
- */
13
- header: string;
14
- /**
15
- * The main block of text that holds some additional information.
16
- */
17
- description?: ReactNode;
18
- /**
19
- * It affects the width of the main container of this component, "wide" is a default one.
20
- */
21
- size?: Sizes;
22
- /**
23
- * Image that will be shown above the title. Goes directly into the src prop of an <img> element. The larger side of this image will be shrunk to 160px.
24
- */
25
- imageUrl?: string;
26
- /**
27
- * Maximum width (in pixels) of the image, default value is 160.
28
- */
29
- maxImageWidth?: number;
30
- /**
31
- * Maximum height (in pixels) of the image, default value is 160.
32
- */
33
- maxImageHeight?: number;
34
- /**
35
- * Primary action button for the page, usually it will be something like "Create" (or "Retry" for error pages).
36
- */
37
- primaryAction?: ReactNode;
38
- /**
39
- * Image that will be shown above the title. Only rendered if no imageUrl given.
40
- */
41
- renderImage?: (props: RenderImageProps) => React.ReactNode;
42
- /**
43
- * Secondary action button for the page.
44
- */
45
- secondaryAction?: ReactNode;
46
- /**
47
- * Button with link to some external resource like documentation or tutorial, it will be opened in a new tab.
48
- */
49
- tertiaryAction?: ReactNode;
50
- /**
51
- * Shows spinner next to the action buttons. Primary and secondary action buttons are disabled when this prop is set to true.
52
- */
53
- isLoading?: boolean;
54
- /**
55
- * Width of the image that is rendered in EmptyState component. It is useful when you want image to be of exact width to stop it bouncing around when loading in. Only set `height` if you want the image to resize down on smaller devices.
56
- */
57
- imageWidth?: number;
58
- /**
59
- * Height of the image that is rendered in EmptyState component. It is useful when you want image to be of exact height to stop it bouncing around when loading in. Only set `height` if you want the image to resize down on smaller devices.
60
- */
61
- imageHeight?: number;
62
- }
63
- /**
64
- * __Empty state__
65
- *
66
- * A component used for presenting various empty states.
67
- * e.g. (no items, empty search, broken link, welcome screen etc.)
68
- *
69
- * @example
70
- * ```tsx
71
- * import EmptyState from '@atlaskit/empty-state';
72
- *
73
- * export default () => {
74
- * <EmptyState
75
- * header="I am the header"
76
- * imageUrl="link/to/image"
77
- * description="some description"
78
- * primaryAction={<Button appearance="primary" />}
79
- * secondaryAction={<Button />}
80
- * />;
81
- * };
82
- * ```
83
- */
84
- declare const EmptyState: ({ description, header, imageHeight, imageUrl, imageWidth, isLoading, maxImageHeight, maxImageWidth, primaryAction, renderImage, secondaryAction, size, tertiaryAction, }: EmptyStateProps) => JSX.Element;
85
- export default EmptyState;