@atlaskit/empty-state 7.2.0 → 7.3.2

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,36 @@
1
1
  # @atlaskit/empty-state
2
2
 
3
+ ## 7.3.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`0397fedf294`](https://bitbucket.org/atlassian/atlassian-frontend/commits/0397fedf294) - Added documentation homepage URL to package.json
8
+
9
+ ## 7.3.1
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
15
+ ## 7.3.0
16
+
17
+ ### Minor Changes
18
+
19
+ - [`b5c96b26bf3`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b5c96b26bf3) - Instrumented empty-state with the new theming package, `@atlaskit/tokens`.
20
+
21
+ New tokens will be visible only in applications configured to use the new Tokens API (currently in alpha).
22
+ These changes are intended to be interoperable with the legacy theme implementation. Legacy dark mode users should expect no visual or breaking changes.
23
+
24
+ ### Patch Changes
25
+
26
+ - Updated dependencies
27
+
28
+ ## 7.2.1
29
+
30
+ ### Patch Changes
31
+
32
+ - [`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.
33
+
3
34
  ## 7.2.0
4
35
 
5
36
  ### Minor Changes
@@ -51,14 +51,14 @@ var EmptyState = function EmptyState(_ref) {
51
51
  primaryAction = _ref.primaryAction,
52
52
  renderImage = _ref.renderImage,
53
53
  secondaryAction = _ref.secondaryAction,
54
- _ref$width = _ref.width,
55
- width = _ref$width === void 0 ? 'wide' : _ref$width,
56
- _ref$size = _ref.size,
57
- size = _ref$size === void 0 ? 'wide' : _ref$size,
58
- tertiaryAction = _ref.tertiaryAction;
54
+ width = _ref.width,
55
+ size = _ref.size,
56
+ tertiaryAction = _ref.tertiaryAction,
57
+ testId = _ref.testId;
59
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;
60
59
  return /*#__PURE__*/_react.default.createElement(_styled.Container, {
61
- width: size || width
60
+ testId: testId,
61
+ width: width || size || 'wide'
62
62
  }, imageUrl ? /*#__PURE__*/_react.default.createElement(_styled.Image, {
63
63
  src: imageUrl,
64
64
  maxWidth: maxImageWidth,
@@ -36,8 +36,10 @@ var narrowContainerStyles = (0, _core.css)({
36
36
 
37
37
  var Container = function Container(_ref) {
38
38
  var children = _ref.children,
39
- width = _ref.width;
39
+ width = _ref.width,
40
+ testId = _ref.testId;
40
41
  return (0, _core.jsx)("div", {
42
+ "data-testid": testId,
41
43
  css: [containerStyles, width === 'narrow' ? narrowContainerStyles : wideContainerStyles]
42
44
  }, children);
43
45
  };
@@ -11,11 +11,13 @@ var _colors = require("@atlaskit/theme/colors");
11
11
 
12
12
  var _constants = require("@atlaskit/theme/constants");
13
13
 
14
+ var _tokens = require("@atlaskit/tokens");
15
+
14
16
  /** @jsx jsx */
15
17
  var descriptionStyles = (0, _core.css)({
16
18
  marginTop: 0,
17
19
  marginBottom: "".concat((0, _constants.gridSize)() * 3, "px"),
18
- color: _colors.N800
20
+ color: (0, _tokens.token)('color.text.highEmphasis', _colors.N800)
19
21
  });
20
22
  /**
21
23
  * __Description__
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/empty-state",
3
- "version": "7.2.0",
3
+ "version": "7.3.2",
4
4
  "sideEffects": false
5
5
  }
@@ -37,13 +37,15 @@ const EmptyState = ({
37
37
  primaryAction,
38
38
  renderImage,
39
39
  secondaryAction,
40
- width = 'wide',
41
- size = 'wide',
42
- tertiaryAction
40
+ width,
41
+ size,
42
+ tertiaryAction,
43
+ testId
43
44
  }) => {
44
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;
45
46
  return /*#__PURE__*/React.createElement(Container, {
46
- width: size || width
47
+ testId: testId,
48
+ width: width || size || 'wide'
47
49
  }, imageUrl ? /*#__PURE__*/React.createElement(Image, {
48
50
  src: imageUrl,
49
51
  maxWidth: maxImageWidth,
@@ -27,8 +27,10 @@ const narrowContainerStyles = css({
27
27
 
28
28
  const Container = ({
29
29
  children,
30
- width
30
+ width,
31
+ testId
31
32
  }) => jsx("div", {
33
+ "data-testid": testId,
32
34
  css: [containerStyles, width === 'narrow' ? narrowContainerStyles : wideContainerStyles]
33
35
  }, children);
34
36
 
@@ -2,10 +2,11 @@
2
2
  import { css, jsx } from '@emotion/core';
3
3
  import { N800 } from '@atlaskit/theme/colors';
4
4
  import { gridSize as getGridSize } from '@atlaskit/theme/constants';
5
+ import { token } from '@atlaskit/tokens';
5
6
  const descriptionStyles = css({
6
7
  marginTop: 0,
7
8
  marginBottom: `${getGridSize() * 3}px`,
8
- color: N800
9
+ color: token('color.text.highEmphasis', N800)
9
10
  });
10
11
  /**
11
12
  * __Description__
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/empty-state",
3
- "version": "7.2.0",
3
+ "version": "7.3.2",
4
4
  "sideEffects": false
5
5
  }
@@ -39,14 +39,14 @@ var EmptyState = function EmptyState(_ref) {
39
39
  primaryAction = _ref.primaryAction,
40
40
  renderImage = _ref.renderImage,
41
41
  secondaryAction = _ref.secondaryAction,
42
- _ref$width = _ref.width,
43
- width = _ref$width === void 0 ? 'wide' : _ref$width,
44
- _ref$size = _ref.size,
45
- size = _ref$size === void 0 ? 'wide' : _ref$size,
46
- tertiaryAction = _ref.tertiaryAction;
42
+ width = _ref.width,
43
+ size = _ref.size,
44
+ tertiaryAction = _ref.tertiaryAction,
45
+ testId = _ref.testId;
47
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;
48
47
  return /*#__PURE__*/React.createElement(Container, {
49
- width: size || width
48
+ testId: testId,
49
+ width: width || size || 'wide'
50
50
  }, imageUrl ? /*#__PURE__*/React.createElement(Image, {
51
51
  src: imageUrl,
52
52
  maxWidth: maxImageWidth,
@@ -27,8 +27,10 @@ var narrowContainerStyles = css({
27
27
 
28
28
  var Container = function Container(_ref) {
29
29
  var children = _ref.children,
30
- width = _ref.width;
30
+ width = _ref.width,
31
+ testId = _ref.testId;
31
32
  return jsx("div", {
33
+ "data-testid": testId,
32
34
  css: [containerStyles, width === 'narrow' ? narrowContainerStyles : wideContainerStyles]
33
35
  }, children);
34
36
  };
@@ -2,10 +2,11 @@
2
2
  import { css, jsx } from '@emotion/core';
3
3
  import { N800 } from '@atlaskit/theme/colors';
4
4
  import { gridSize as getGridSize } from '@atlaskit/theme/constants';
5
+ import { token } from '@atlaskit/tokens';
5
6
  var descriptionStyles = css({
6
7
  marginTop: 0,
7
8
  marginBottom: "".concat(getGridSize() * 3, "px"),
8
- color: N800
9
+ color: token('color.text.highEmphasis', N800)
9
10
  });
10
11
  /**
11
12
  * __Description__
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/empty-state",
3
- "version": "7.2.0",
3
+ "version": "7.3.2",
4
4
  "sideEffects": false
5
5
  }
@@ -1,68 +1,4 @@
1
- import React, { ReactNode } from 'react';
2
- import type { RenderImageProps, Width } from './types';
3
- export interface EmptyStateProps {
4
- /**
5
- * Title that briefly describes the page to the user.
6
- */
7
- header: string;
8
- /**
9
- * The main block of text that holds additional supporting information.
10
- */
11
- description?: ReactNode;
12
- /**
13
- * Controls how much horizontal space the component fills. Defaults to "wide".
14
- */
15
- width?: Width;
16
- /**
17
- * @deprecated
18
- * Duplicates the `width` prop. Use `width instead`.
19
- */
20
- size?: Width;
21
- /**
22
- * The url of image that will be shown above the title, fed directly into the `src` prop of an <img> element.
23
- * Note, this image will be constrained by the `maxWidth` and `maxHeight` props.
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
- * An alternative API to supply an image using a render prop. Only rendered if no `imageUrl` is supplied.
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
- * Used to indicate a loading state. Will show a spinner next to the action buttons when true.
52
- */
53
- isLoading?: boolean;
54
- /**
55
- * Width of the image that is rendered in EmptyState component.
56
- * Useful when you want image to be of exact width to stop it bouncing around when loading in.
57
- */
58
- imageWidth?: number;
59
- /**
60
- * Height of the image that is rendered in EmptyState component.
61
- * Useful when you want image to be of exact height to stop it bouncing around when loading in.
62
- * Only set `height` if you want the image to resize down on smaller devices.
63
- */
64
- imageHeight?: number;
65
- }
1
+ import type { EmptyStateProps } from './types';
66
2
  /**
67
3
  * __Empty state__
68
4
  *
@@ -85,5 +21,5 @@ export interface EmptyStateProps {
85
21
  * };
86
22
  * ```
87
23
  */
88
- declare const EmptyState: ({ description, header, imageHeight, imageUrl, imageWidth, isLoading, maxImageHeight, maxImageWidth, primaryAction, renderImage, secondaryAction, width, size, tertiaryAction, }: EmptyStateProps) => JSX.Element;
24
+ declare const EmptyState: ({ description, header, imageHeight, imageUrl, imageWidth, isLoading, maxImageHeight, maxImageWidth, primaryAction, renderImage, secondaryAction, width, size, tertiaryAction, testId, }: EmptyStateProps) => JSX.Element;
89
25
  export default EmptyState;
@@ -9,6 +9,7 @@ import type { Width } from '../index';
9
9
  * @internal
10
10
  */
11
11
  declare const Container: FC<{
12
+ testId?: string;
12
13
  width: Width;
13
14
  }>;
14
15
  export default Container;
@@ -1,3 +1,4 @@
1
+ import type { ReactNode } from 'react';
1
2
  export interface RenderImageProps {
2
3
  maxImageWidth?: number;
3
4
  maxImageHeight?: number;
@@ -6,4 +7,70 @@ export interface RenderImageProps {
6
7
  }
7
8
  export declare type Sizes = 'narrow' | 'wide';
8
9
  export declare type Width = Sizes;
9
- export type { EmptyStateProps } from './empty-state';
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,11 +1,12 @@
1
1
  {
2
2
  "name": "@atlaskit/empty-state",
3
- "version": "7.2.0",
4
- "description": "A React component used for presenting various empty states (no items, empty search, broken link, welcome screen etc.)",
3
+ "version": "7.3.2",
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
  },
8
8
  "repository": "https://bitbucket.org/atlassian/atlassian-frontend",
9
+ "homepage": "https://atlassian.design/components/empty-state/",
9
10
  "author": "Atlassian Pty Ltd",
10
11
  "license": "Apache-2.0",
11
12
  "main": "dist/cjs/index.js",
@@ -25,7 +26,8 @@
25
26
  "dependencies": {
26
27
  "@atlaskit/button": "^16.1.0",
27
28
  "@atlaskit/spinner": "^15.1.0",
28
- "@atlaskit/theme": "^11.5.0",
29
+ "@atlaskit/theme": "^12.0.0",
30
+ "@atlaskit/tokens": "^0.3.0",
29
31
  "@babel/runtime": "^7.0.0",
30
32
  "@emotion/core": "^10.0.9"
31
33
  },
@@ -38,6 +40,7 @@
38
40
  "@atlaskit/ssr": "*",
39
41
  "@atlaskit/visual-regression": "*",
40
42
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
43
+ "@testing-library/react": "^8.0.1",
41
44
  "enzyme": "^3.10.0",
42
45
  "react-dom": "^16.8.0",
43
46
  "typescript": "3.9.6",
@@ -49,7 +52,7 @@
49
52
  },
50
53
  "@repo/internal": {
51
54
  "analytics": "analytics-next",
52
- "theming": "new-theming-api",
55
+ "theming": "tokens",
53
56
  "styling": "emotion",
54
57
  "design-system": "v1",
55
58
  "deprecation": "no-deprecated-imports"