@atlaskit/empty-state 7.5.1 → 7.6.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/empty-state
2
2
 
3
+ ## 7.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`56d11ec914b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/56d11ec914b) - Add a new prop `headingLevel` to set the heading level in the header element.
8
+
9
+ ## 7.5.2
10
+
11
+ ### Patch Changes
12
+
13
+ - [`9d00501a414`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9d00501a414) - Ensure legacy types are published for TS 4.5-4.8
14
+
3
15
  ## 7.5.1
4
16
 
5
17
  ### Patch Changes
@@ -34,6 +34,8 @@ var _styled = require("./styled");
34
34
  var EmptyState = function EmptyState(_ref) {
35
35
  var description = _ref.description,
36
36
  header = _ref.header,
37
+ _ref$headingLevel = _ref.headingLevel,
38
+ headingLevel = _ref$headingLevel === void 0 ? 4 : _ref$headingLevel,
37
39
  imageHeight = _ref.imageHeight,
38
40
  imageUrl = _ref.imageUrl,
39
41
  imageWidth = _ref.imageWidth,
@@ -66,7 +68,9 @@ var EmptyState = function EmptyState(_ref) {
66
68
  maxImageHeight: maxImageHeight,
67
69
  imageWidth: imageWidth,
68
70
  imageHeight: imageHeight
69
- }), /*#__PURE__*/_react.default.createElement(_styled.Header, null, header), description && /*#__PURE__*/_react.default.createElement(_styled.Description, null, description), actionsContainer, tertiaryAction);
71
+ }), /*#__PURE__*/_react.default.createElement(_styled.Header, {
72
+ level: headingLevel
73
+ }, header), description && /*#__PURE__*/_react.default.createElement(_styled.Description, null, description), actionsContainer, tertiaryAction);
70
74
  };
71
75
  var _default = EmptyState;
72
76
  exports.default = _default;
@@ -8,7 +8,7 @@ var _react = require("@emotion/react");
8
8
  var _typography = require("@atlaskit/theme/typography");
9
9
  /** @jsx jsx */
10
10
 
11
- // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
11
+ // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
12
12
  var headerStyles = (0, _react.css)([(0, _typography.h600)(), {
13
13
  marginTop: "var(--ds-space-0, 0px)",
14
14
  marginBottom: "var(--ds-space-200, 16px)"
@@ -22,8 +22,11 @@ var headerStyles = (0, _react.css)([(0, _typography.h600)(), {
22
22
  * @internal
23
23
  */
24
24
  var EmptyStateHeader = function EmptyStateHeader(_ref) {
25
- var children = _ref.children;
26
- return (0, _react.jsx)("h4", {
25
+ var children = _ref.children,
26
+ _ref$level = _ref.level,
27
+ level = _ref$level === void 0 ? 4 : _ref$level;
28
+ var Tag = "h".concat(level > 0 && level < 7 ? level : level > 6 ? 6 : 4);
29
+ return (0, _react.jsx)(Tag, {
27
30
  css: headerStyles
28
31
  }, children);
29
32
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/empty-state",
3
- "version": "7.5.1",
3
+ "version": "7.6.0",
4
4
  "sideEffects": false
5
5
  }
@@ -27,6 +27,7 @@ import { ActionsContainer, Container, Description, Header, Image, SpinnerContain
27
27
  const EmptyState = ({
28
28
  description,
29
29
  header,
30
+ headingLevel = 4,
30
31
  imageHeight,
31
32
  imageUrl,
32
33
  imageWidth,
@@ -58,6 +59,8 @@ const EmptyState = ({
58
59
  maxImageHeight,
59
60
  imageWidth,
60
61
  imageHeight
61
- }), /*#__PURE__*/React.createElement(Header, null, header), description && /*#__PURE__*/React.createElement(Description, null, description), actionsContainer, tertiaryAction);
62
+ }), /*#__PURE__*/React.createElement(Header, {
63
+ level: headingLevel
64
+ }, header), description && /*#__PURE__*/React.createElement(Description, null, description), actionsContainer, tertiaryAction);
62
65
  };
63
66
  export default EmptyState;
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { css, jsx } from '@emotion/react';
4
4
  import { h600 } from '@atlaskit/theme/typography';
5
- // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
5
+ // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
6
6
  const headerStyles = css([h600(), {
7
7
  marginTop: "var(--ds-space-0, 0px)",
8
8
  marginBottom: "var(--ds-space-200, 16px)"
@@ -16,8 +16,12 @@ const headerStyles = css([h600(), {
16
16
  * @internal
17
17
  */
18
18
  const EmptyStateHeader = ({
19
- children
20
- }) => jsx("h4", {
21
- css: headerStyles
22
- }, children);
19
+ children,
20
+ level = 4
21
+ }) => {
22
+ const Tag = `h${level > 0 && level < 7 ? level : level > 6 ? 6 : 4}`;
23
+ return jsx(Tag, {
24
+ css: headerStyles
25
+ }, children);
26
+ };
23
27
  export default EmptyStateHeader;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/empty-state",
3
- "version": "7.5.1",
3
+ "version": "7.6.0",
4
4
  "sideEffects": false
5
5
  }
@@ -27,6 +27,8 @@ import { ActionsContainer, Container, Description, Header, Image, SpinnerContain
27
27
  var EmptyState = function EmptyState(_ref) {
28
28
  var description = _ref.description,
29
29
  header = _ref.header,
30
+ _ref$headingLevel = _ref.headingLevel,
31
+ headingLevel = _ref$headingLevel === void 0 ? 4 : _ref$headingLevel,
30
32
  imageHeight = _ref.imageHeight,
31
33
  imageUrl = _ref.imageUrl,
32
34
  imageWidth = _ref.imageWidth,
@@ -59,6 +61,8 @@ var EmptyState = function EmptyState(_ref) {
59
61
  maxImageHeight: maxImageHeight,
60
62
  imageWidth: imageWidth,
61
63
  imageHeight: imageHeight
62
- }), /*#__PURE__*/React.createElement(Header, null, header), description && /*#__PURE__*/React.createElement(Description, null, description), actionsContainer, tertiaryAction);
64
+ }), /*#__PURE__*/React.createElement(Header, {
65
+ level: headingLevel
66
+ }, header), description && /*#__PURE__*/React.createElement(Description, null, description), actionsContainer, tertiaryAction);
63
67
  };
64
68
  export default EmptyState;
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { css, jsx } from '@emotion/react';
4
4
  import { h600 } from '@atlaskit/theme/typography';
5
- // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
5
+ // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
6
6
  var headerStyles = css([h600(), {
7
7
  marginTop: "var(--ds-space-0, 0px)",
8
8
  marginBottom: "var(--ds-space-200, 16px)"
@@ -16,8 +16,11 @@ var headerStyles = css([h600(), {
16
16
  * @internal
17
17
  */
18
18
  var EmptyStateHeader = function EmptyStateHeader(_ref) {
19
- var children = _ref.children;
20
- return jsx("h4", {
19
+ var children = _ref.children,
20
+ _ref$level = _ref.level,
21
+ level = _ref$level === void 0 ? 4 : _ref$level;
22
+ var Tag = "h".concat(level > 0 && level < 7 ? level : level > 6 ? 6 : 4);
23
+ return jsx(Tag, {
21
24
  css: headerStyles
22
25
  }, children);
23
26
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/empty-state",
3
- "version": "7.5.1",
3
+ "version": "7.6.0",
4
4
  "sideEffects": false
5
5
  }
@@ -22,5 +22,5 @@ import type { EmptyStateProps } from './types';
22
22
  * };
23
23
  * ```
24
24
  */
25
- declare const EmptyState: ({ description, header, imageHeight, imageUrl, imageWidth, isLoading, maxImageHeight, maxImageWidth, primaryAction, renderImage, secondaryAction, width, size, tertiaryAction, testId, }: EmptyStateProps) => JSX.Element;
25
+ declare const EmptyState: ({ description, header, headingLevel, imageHeight, imageUrl, imageWidth, isLoading, maxImageHeight, maxImageWidth, primaryAction, renderImage, secondaryAction, width, size, tertiaryAction, testId, }: EmptyStateProps) => JSX.Element;
26
26
  export default EmptyState;
@@ -1,5 +1,9 @@
1
1
  /** @jsx jsx */
2
2
  import { FC } from 'react';
3
+ type HeaderProps = {
4
+ children: string;
5
+ level?: number;
6
+ };
3
7
  /**
4
8
  * __Header__
5
9
  *
@@ -7,7 +11,5 @@ import { FC } from 'react';
7
11
  *
8
12
  * @internal
9
13
  */
10
- declare const EmptyStateHeader: FC<{
11
- children: string;
12
- }>;
14
+ declare const EmptyStateHeader: FC<HeaderProps>;
13
15
  export default EmptyStateHeader;
@@ -12,6 +12,11 @@ export interface EmptyStateProps {
12
12
  * Title that briefly describes the page to the user.
13
13
  */
14
14
  header: string;
15
+ /**
16
+ * The value used to set the heading level of the header element.
17
+ * Must be in the range of 1 to 6. Defaults to 4.
18
+ */
19
+ headingLevel?: number;
15
20
  /**
16
21
  * The main block of text that holds additional supporting information.
17
22
  */
@@ -0,0 +1,26 @@
1
+ /// <reference types="react" />
2
+ import type { EmptyStateProps } from './types';
3
+ /**
4
+ * __Empty state__
5
+ *
6
+ * A component used for presenting various empty states.
7
+ * e.g. (no items, empty search, broken link, welcome screen etc.)
8
+ *
9
+ * @example
10
+ * ```tsx
11
+ * import EmptyState from '@atlaskit/empty-state';
12
+ *
13
+ * // An example of a 404 state
14
+ * export default () => {
15
+ * <EmptyState
16
+ * header="Page not found"
17
+ * imageUrl="https://cdn.io/images/404"
18
+ * description="Looks like you've stumbled off track. Sorry about that! This page either doesn't exist or has been removed."
19
+ * primaryAction={<Button appearance="primary">Home Page</Button>}
20
+ * secondaryAction={<Button>Report a problem</Button>}
21
+ * />;
22
+ * };
23
+ * ```
24
+ */
25
+ declare const EmptyState: ({ description, header, headingLevel, imageHeight, imageUrl, imageWidth, isLoading, maxImageHeight, maxImageWidth, primaryAction, renderImage, secondaryAction, width, size, tertiaryAction, testId, }: EmptyStateProps) => JSX.Element;
26
+ export default EmptyState;
@@ -0,0 +1,2 @@
1
+ export { default } from './empty-state';
2
+ export type { Sizes, Width, RenderImageProps, EmptyStateProps } from './types';
@@ -0,0 +1,13 @@
1
+ /** @jsx jsx */
2
+ import { FC, ReactNode } from 'react';
3
+ /**
4
+ * __Actions container__
5
+ *
6
+ * A container for actions: primary action, secondary action, and tertiary action.
7
+ *
8
+ * @internal
9
+ */
10
+ declare const ActionsContainer: FC<{
11
+ children: ReactNode;
12
+ }>;
13
+ export default ActionsContainer;
@@ -0,0 +1,17 @@
1
+ /** @jsx jsx */
2
+ import { FC, ReactNode } from 'react';
3
+ import type { Width } from '../index';
4
+ type ContainerProps = {
5
+ testId?: string;
6
+ width: Width;
7
+ children: ReactNode;
8
+ };
9
+ /**
10
+ * __Container__
11
+ *
12
+ * Upper level container for Empty State.
13
+ *
14
+ * @internal
15
+ */
16
+ declare const Container: FC<ContainerProps>;
17
+ export default Container;
@@ -0,0 +1,13 @@
1
+ /** @jsx jsx */
2
+ import { FC, ReactNode } from 'react';
3
+ /**
4
+ * __Description__
5
+ *
6
+ * Description of Empty State.
7
+ *
8
+ * @internal
9
+ */
10
+ declare const Description: FC<{
11
+ children: ReactNode;
12
+ }>;
13
+ export default Description;
@@ -0,0 +1,15 @@
1
+ /** @jsx jsx */
2
+ import { FC } from 'react';
3
+ type HeaderProps = {
4
+ children: string;
5
+ level?: number;
6
+ };
7
+ /**
8
+ * __Header__
9
+ *
10
+ * Header of Empty State.
11
+ *
12
+ * @internal
13
+ */
14
+ declare const EmptyStateHeader: FC<HeaderProps>;
15
+ export default EmptyStateHeader;
@@ -0,0 +1,18 @@
1
+ /** @jsx jsx */
2
+ import { FC } from 'react';
3
+ type ImageProps = {
4
+ height?: number;
5
+ maxHeight: number;
6
+ maxWidth: number;
7
+ width?: number;
8
+ src: string;
9
+ };
10
+ /**
11
+ * __Image__
12
+ *
13
+ * Image in Empty State.
14
+ *
15
+ * @internal
16
+ */
17
+ declare const Image: FC<ImageProps>;
18
+ export default Image;
@@ -0,0 +1,6 @@
1
+ export { default as ActionsContainer } from './actions-container';
2
+ export { default as Container } from './container';
3
+ export { default as Description } from './description';
4
+ export { default as Header } from './header';
5
+ export { default as Image } from './image';
6
+ export { default as SpinnerContainer } from './spinner-container';
@@ -0,0 +1,13 @@
1
+ /** @jsx jsx */
2
+ import { FC, ReactNode } from 'react';
3
+ /**
4
+ * __Spinner container__
5
+ *
6
+ * A spinner container for loading state of Empty State.
7
+ *
8
+ * @internal
9
+ */
10
+ declare const SpinnerContainer: FC<{
11
+ children?: ReactNode;
12
+ }>;
13
+ export default SpinnerContainer;
@@ -0,0 +1,81 @@
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 type Sizes = 'narrow' | 'wide';
9
+ export 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 value used to set the heading level of the header element.
17
+ * Must be in the range of 1 to 6. Defaults to 4.
18
+ */
19
+ headingLevel?: number;
20
+ /**
21
+ * The main block of text that holds additional supporting information.
22
+ */
23
+ description?: ReactNode;
24
+ /**
25
+ * Controls how much horizontal space the component fills. Defaults to "wide".
26
+ */
27
+ width?: Width;
28
+ /**
29
+ * @deprecated
30
+ * Duplicates the `width` prop. Use `width instead`.
31
+ */
32
+ size?: Width;
33
+ /**
34
+ * The url of image that will be shown above the title, fed directly into the `src` prop of an <img> element.
35
+ * Note, this image will be constrained by the `maxWidth` and `maxHeight` props.
36
+ */
37
+ imageUrl?: string;
38
+ /**
39
+ * Maximum width (in pixels) of the image, default value is 160.
40
+ */
41
+ maxImageWidth?: number;
42
+ /**
43
+ * Maximum height (in pixels) of the image, default value is 160.
44
+ */
45
+ maxImageHeight?: number;
46
+ /**
47
+ * Primary action button for the page, usually it will be something like "Create" (or "Retry" for error pages).
48
+ */
49
+ primaryAction?: ReactNode;
50
+ /**
51
+ * An alternative API to supply an image using a render prop. Only rendered if no `imageUrl` is supplied.
52
+ */
53
+ renderImage?: (props: RenderImageProps) => React.ReactNode;
54
+ /**
55
+ * Secondary action button for the page.
56
+ */
57
+ secondaryAction?: ReactNode;
58
+ /**
59
+ * Button with link to some external resource like documentation or tutorial, it will be opened in a new tab.
60
+ */
61
+ tertiaryAction?: ReactNode;
62
+ /**
63
+ * A hook for automated testing
64
+ */
65
+ testId?: string;
66
+ /**
67
+ * Used to indicate a loading state. Will show a spinner next to the action buttons when true.
68
+ */
69
+ isLoading?: boolean;
70
+ /**
71
+ * Width of the image that is rendered in EmptyState component.
72
+ * Useful when you want image to be of exact width to stop it bouncing around when loading in.
73
+ */
74
+ imageWidth?: number;
75
+ /**
76
+ * Height of the image that is rendered in EmptyState component.
77
+ * Useful when you want image to be of exact height to stop it bouncing around when loading in.
78
+ * Only set `height` if you want the image to resize down on smaller devices.
79
+ */
80
+ imageHeight?: number;
81
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/empty-state",
3
- "version": "7.5.1",
3
+ "version": "7.6.0",
4
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/"
@@ -25,17 +25,17 @@
25
25
  "atlaskit:src": "src/index.tsx",
26
26
  "atlassian": {
27
27
  "team": "Design System Team",
28
- "releaseModel": "scheduled",
28
+ "releaseModel": "continuous",
29
29
  "website": {
30
30
  "name": "Empty state",
31
31
  "category": "Components"
32
32
  }
33
33
  },
34
34
  "dependencies": {
35
- "@atlaskit/button": "^16.7.0",
35
+ "@atlaskit/button": "^16.8.0",
36
36
  "@atlaskit/spinner": "^15.5.0",
37
37
  "@atlaskit/theme": "^12.5.0",
38
- "@atlaskit/tokens": "^1.4.0",
38
+ "@atlaskit/tokens": "^1.9.0",
39
39
  "@babel/runtime": "^7.0.0",
40
40
  "@emotion/react": "^11.7.1"
41
41
  },
@@ -49,6 +49,7 @@
49
49
  "@atlaskit/visual-regression": "*",
50
50
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
51
51
  "@testing-library/react": "^12.1.5",
52
+ "jest-axe": "^4.0.0",
52
53
  "react-dom": "^16.8.0",
53
54
  "typescript": "~4.9.5",
54
55
  "wait-for-expect": "^1.2.0"
package/report.api.md CHANGED
@@ -8,6 +8,7 @@
8
8
  ### Table of contents
9
9
 
10
10
  - [Main Entry Types](#main-entry-types)
11
+ - [Peer Dependencies](#peer-dependencies)
11
12
 
12
13
  ### Main Entry Types
13
14
 
@@ -22,6 +23,7 @@ import type { ReactNode } from 'react';
22
23
  const EmptyState: ({
23
24
  description,
24
25
  header,
26
+ headingLevel,
25
27
  imageHeight,
26
28
  imageUrl,
27
29
  imageWidth,
@@ -42,6 +44,7 @@ export default EmptyState;
42
44
  export interface EmptyStateProps {
43
45
  description?: ReactNode;
44
46
  header: string;
47
+ headingLevel?: number;
45
48
  imageHeight?: number;
46
49
  imageUrl?: string;
47
50
  imageWidth?: number;
@@ -80,3 +83,15 @@ export type Width = Sizes;
80
83
  ```
81
84
 
82
85
  <!--SECTION END: Main Entry Types-->
86
+
87
+ ### Peer Dependencies
88
+
89
+ <!--SECTION START: Peer Dependencies-->
90
+
91
+ ```json
92
+ {
93
+ "react": "^16.8.0"
94
+ }
95
+ ```
96
+
97
+ <!--SECTION END: Peer Dependencies-->
@@ -0,0 +1,56 @@
1
+ ## API Report File for "@atlaskit/empty-state"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+
7
+ /// <reference types="react" />
8
+
9
+ import type { ReactNode } from 'react';
10
+
11
+ // @public
12
+ const EmptyState: ({ description, header, headingLevel, imageHeight, imageUrl, imageWidth, isLoading, maxImageHeight, maxImageWidth, primaryAction, renderImage, secondaryAction, width, size, tertiaryAction, testId, }: EmptyStateProps) => JSX.Element;
13
+ export default EmptyState;
14
+
15
+ // @public (undocumented)
16
+ export interface EmptyStateProps {
17
+ description?: ReactNode;
18
+ header: string;
19
+ headingLevel?: number;
20
+ imageHeight?: number;
21
+ imageUrl?: string;
22
+ imageWidth?: number;
23
+ isLoading?: boolean;
24
+ maxImageHeight?: number;
25
+ maxImageWidth?: number;
26
+ primaryAction?: ReactNode;
27
+ renderImage?: (props: RenderImageProps) => React.ReactNode;
28
+ secondaryAction?: ReactNode;
29
+ // @deprecated (undocumented)
30
+ size?: Width;
31
+ tertiaryAction?: ReactNode;
32
+ testId?: string;
33
+ width?: Width;
34
+ }
35
+
36
+ // @public (undocumented)
37
+ export interface RenderImageProps {
38
+ // (undocumented)
39
+ imageHeight?: number;
40
+ // (undocumented)
41
+ imageWidth?: number;
42
+ // (undocumented)
43
+ maxImageHeight?: number;
44
+ // (undocumented)
45
+ maxImageWidth?: number;
46
+ }
47
+
48
+ // @public (undocumented)
49
+ export type Sizes = 'narrow' | 'wide';
50
+
51
+ // @public (undocumented)
52
+ export type Width = Sizes;
53
+
54
+ // (No @packageDocumentation comment for this package)
55
+
56
+ ```