glints-aries 4.0.298 → 4.0.299
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/es/@next/EmptyState/EmptyState.d.ts +14 -11
- package/es/@next/EmptyState/EmptyState.js +39 -16
- package/es/@next/EmptyState/EmptyState.stories.d.ts +1 -0
- package/es/@next/Typography/Typography.d.ts +1 -0
- package/es/types/componentAction.d.ts +2 -1
- package/lib/@next/EmptyState/EmptyState.d.ts +14 -11
- package/lib/@next/EmptyState/EmptyState.js +39 -16
- package/lib/@next/EmptyState/EmptyState.stories.d.ts +1 -0
- package/lib/@next/Typography/Typography.d.ts +1 -0
- package/lib/types/componentAction.d.ts +2 -1
- package/package.json +1 -1
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ImageName } from './assets/assets';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
};
|
|
8
|
-
export interface EmptyStateProps {
|
|
9
|
-
basicButtonAction?: ButtonAction;
|
|
10
|
-
primaryButtonAction?: ButtonAction;
|
|
3
|
+
import { ComponentAction } from '../../types/componentAction';
|
|
4
|
+
declare type CommonProps = {
|
|
5
|
+
basicButtonAction?: ComponentAction;
|
|
6
|
+
primaryButtonAction?: ComponentAction;
|
|
11
7
|
description?: React.ReactNode;
|
|
12
8
|
fullWidth?: boolean;
|
|
13
9
|
helpText?: string;
|
|
14
|
-
imageName?: ImageName;
|
|
15
10
|
title?: string;
|
|
16
|
-
}
|
|
17
|
-
export declare
|
|
11
|
+
};
|
|
12
|
+
export declare type EmptyStateProps = CommonProps & ({
|
|
13
|
+
/** will soon be @deprecated. Please use image prop instead */
|
|
14
|
+
imageName?: ImageName;
|
|
15
|
+
} | {
|
|
16
|
+
/** Renders an image based on ImageName or a custom image */
|
|
17
|
+
image?: ImageName | React.ReactNode;
|
|
18
|
+
});
|
|
19
|
+
export declare const EmptyState: ({ basicButtonAction, primaryButtonAction, description, fullWidth, helpText, title, ...props }: EmptyStateProps) => JSX.Element;
|
|
20
|
+
export {};
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
|
3
|
+
var _excluded = ["basicButtonAction", "primaryButtonAction", "description", "fullWidth", "helpText", "title"];
|
|
1
4
|
import React from 'react';
|
|
2
5
|
import { Button, PrimaryButton } from '../Button';
|
|
3
6
|
import { Neutral } from '../utilities/colors';
|
|
@@ -10,31 +13,51 @@ export var EmptyState = function EmptyState(_ref) {
|
|
|
10
13
|
_ref$fullWidth = _ref.fullWidth,
|
|
11
14
|
fullWidth = _ref$fullWidth === void 0 ? true : _ref$fullWidth,
|
|
12
15
|
helpText = _ref.helpText,
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
title = _ref.title,
|
|
17
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
15
18
|
var displayButtons = !!primaryButtonAction || !!basicButtonAction;
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
var imageName = 'imageName' in props ? props.imageName : undefined;
|
|
20
|
+
var image = 'image' in props ? props.image : undefined;
|
|
21
|
+
if (imageName) {
|
|
22
|
+
console.warn('imageName will soon be deprecated. Please use image prop instead');
|
|
23
|
+
if (!imageNames.includes(imageName)) {
|
|
24
|
+
console.warn("image \"" + imageName + "\" is not a valid Image Name.");
|
|
25
|
+
}
|
|
19
26
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
27
|
+
if (typeof image === 'string' && !imageNames.includes(imageName)) {
|
|
28
|
+
console.warn("image \"" + imageName + "\" is not a valid Image Name.");
|
|
29
|
+
}
|
|
30
|
+
var renderImage = function renderImage() {
|
|
31
|
+
if (imageName || image && typeof image === 'string') {
|
|
32
|
+
var imageString = imageName ? imageName : image;
|
|
33
|
+
return /*#__PURE__*/React.createElement(StyledImage, {
|
|
34
|
+
src: imageMapping[imageString],
|
|
35
|
+
className: "empty-state-image"
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
return image;
|
|
39
|
+
};
|
|
40
|
+
return /*#__PURE__*/React.createElement(EmptyStateContainer, null, renderImage(), /*#__PURE__*/React.createElement(EmptyStateContentContainer, {
|
|
23
41
|
"data-full-width": fullWidth
|
|
24
42
|
}, title && /*#__PURE__*/React.createElement(StyledTitle, {
|
|
25
43
|
variant: "subtitle1",
|
|
26
|
-
color: Neutral.B18
|
|
44
|
+
color: Neutral.B18,
|
|
45
|
+
className: "empty-state-title"
|
|
27
46
|
}, title), description && /*#__PURE__*/React.createElement(StyledDescription, {
|
|
28
47
|
variant: "body1",
|
|
29
|
-
color: Neutral.B40
|
|
30
|
-
|
|
48
|
+
color: Neutral.B40,
|
|
49
|
+
className: "empty-state-description"
|
|
50
|
+
}, description), displayButtons && /*#__PURE__*/React.createElement(StyledButtonGroup, null, primaryButtonAction && /*#__PURE__*/React.createElement(PrimaryButton, _extends({}, primaryButtonAction, {
|
|
31
51
|
loading: primaryButtonAction == null ? void 0 : primaryButtonAction.loading,
|
|
32
|
-
onClick: primaryButtonAction == null ? void 0 : primaryButtonAction.onClick
|
|
33
|
-
|
|
52
|
+
onClick: primaryButtonAction == null ? void 0 : primaryButtonAction.onClick,
|
|
53
|
+
className: "empty-state-primary-button"
|
|
54
|
+
}), primaryButtonAction == null ? void 0 : primaryButtonAction.label), basicButtonAction && /*#__PURE__*/React.createElement(Button, _extends({}, basicButtonAction, {
|
|
34
55
|
loading: basicButtonAction == null ? void 0 : basicButtonAction.loading,
|
|
35
|
-
onClick: basicButtonAction.onClick
|
|
36
|
-
|
|
56
|
+
onClick: basicButtonAction.onClick,
|
|
57
|
+
className: "empty-state-basic-button"
|
|
58
|
+
}), basicButtonAction == null ? void 0 : basicButtonAction.label)), helpText && /*#__PURE__*/React.createElement(StyledHelpText, {
|
|
37
59
|
variant: "subtitle2",
|
|
38
|
-
color: Neutral.B40
|
|
60
|
+
color: Neutral.B40,
|
|
61
|
+
className: "empty-state-help-text"
|
|
39
62
|
}, helpText)));
|
|
40
63
|
};
|
|
@@ -2,5 +2,6 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
import { ButtonProps } from '../@next';
|
|
3
3
|
export declare type ComponentAction = ButtonProps & {
|
|
4
4
|
label: ReactNode;
|
|
5
|
-
action
|
|
5
|
+
/** action will soon be @deprecated. please use onClick instead */
|
|
6
|
+
action?: (...args: any[]) => void;
|
|
6
7
|
};
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ImageName } from './assets/assets';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
};
|
|
8
|
-
export interface EmptyStateProps {
|
|
9
|
-
basicButtonAction?: ButtonAction;
|
|
10
|
-
primaryButtonAction?: ButtonAction;
|
|
3
|
+
import { ComponentAction } from '../../types/componentAction';
|
|
4
|
+
declare type CommonProps = {
|
|
5
|
+
basicButtonAction?: ComponentAction;
|
|
6
|
+
primaryButtonAction?: ComponentAction;
|
|
11
7
|
description?: React.ReactNode;
|
|
12
8
|
fullWidth?: boolean;
|
|
13
9
|
helpText?: string;
|
|
14
|
-
imageName?: ImageName;
|
|
15
10
|
title?: string;
|
|
16
|
-
}
|
|
17
|
-
export declare
|
|
11
|
+
};
|
|
12
|
+
export declare type EmptyStateProps = CommonProps & ({
|
|
13
|
+
/** will soon be @deprecated. Please use image prop instead */
|
|
14
|
+
imageName?: ImageName;
|
|
15
|
+
} | {
|
|
16
|
+
/** Renders an image based on ImageName or a custom image */
|
|
17
|
+
image?: ImageName | React.ReactNode;
|
|
18
|
+
});
|
|
19
|
+
export declare const EmptyState: ({ basicButtonAction, primaryButtonAction, description, fullWidth, helpText, title, ...props }: EmptyStateProps) => JSX.Element;
|
|
20
|
+
export {};
|
|
@@ -3,11 +3,14 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
exports.__esModule = true;
|
|
5
5
|
exports.EmptyState = void 0;
|
|
6
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
7
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
6
8
|
var _react = _interopRequireDefault(require("react"));
|
|
7
9
|
var _Button = require("../Button");
|
|
8
10
|
var _colors = require("../utilities/colors");
|
|
9
11
|
var _assets = require("./assets/assets");
|
|
10
12
|
var _EmptyStateStyle = require("./EmptyStateStyle");
|
|
13
|
+
var _excluded = ["basicButtonAction", "primaryButtonAction", "description", "fullWidth", "helpText", "title"];
|
|
11
14
|
var EmptyState = function EmptyState(_ref) {
|
|
12
15
|
var basicButtonAction = _ref.basicButtonAction,
|
|
13
16
|
primaryButtonAction = _ref.primaryButtonAction,
|
|
@@ -15,32 +18,52 @@ var EmptyState = function EmptyState(_ref) {
|
|
|
15
18
|
_ref$fullWidth = _ref.fullWidth,
|
|
16
19
|
fullWidth = _ref$fullWidth === void 0 ? true : _ref$fullWidth,
|
|
17
20
|
helpText = _ref.helpText,
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
title = _ref.title,
|
|
22
|
+
props = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded);
|
|
20
23
|
var displayButtons = !!primaryButtonAction || !!basicButtonAction;
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
var imageName = 'imageName' in props ? props.imageName : undefined;
|
|
25
|
+
var image = 'image' in props ? props.image : undefined;
|
|
26
|
+
if (imageName) {
|
|
27
|
+
console.warn('imageName will soon be deprecated. Please use image prop instead');
|
|
28
|
+
if (!_assets.imageNames.includes(imageName)) {
|
|
29
|
+
console.warn("image \"" + imageName + "\" is not a valid Image Name.");
|
|
30
|
+
}
|
|
24
31
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
32
|
+
if (typeof image === 'string' && !_assets.imageNames.includes(imageName)) {
|
|
33
|
+
console.warn("image \"" + imageName + "\" is not a valid Image Name.");
|
|
34
|
+
}
|
|
35
|
+
var renderImage = function renderImage() {
|
|
36
|
+
if (imageName || image && typeof image === 'string') {
|
|
37
|
+
var imageString = imageName ? imageName : image;
|
|
38
|
+
return /*#__PURE__*/_react["default"].createElement(_EmptyStateStyle.StyledImage, {
|
|
39
|
+
src: _assets.imageMapping[imageString],
|
|
40
|
+
className: "empty-state-image"
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
return image;
|
|
44
|
+
};
|
|
45
|
+
return /*#__PURE__*/_react["default"].createElement(_EmptyStateStyle.EmptyStateContainer, null, renderImage(), /*#__PURE__*/_react["default"].createElement(_EmptyStateStyle.EmptyStateContentContainer, {
|
|
28
46
|
"data-full-width": fullWidth
|
|
29
47
|
}, title && /*#__PURE__*/_react["default"].createElement(_EmptyStateStyle.StyledTitle, {
|
|
30
48
|
variant: "subtitle1",
|
|
31
|
-
color: _colors.Neutral.B18
|
|
49
|
+
color: _colors.Neutral.B18,
|
|
50
|
+
className: "empty-state-title"
|
|
32
51
|
}, title), description && /*#__PURE__*/_react["default"].createElement(_EmptyStateStyle.StyledDescription, {
|
|
33
52
|
variant: "body1",
|
|
34
|
-
color: _colors.Neutral.B40
|
|
35
|
-
|
|
53
|
+
color: _colors.Neutral.B40,
|
|
54
|
+
className: "empty-state-description"
|
|
55
|
+
}, description), displayButtons && /*#__PURE__*/_react["default"].createElement(_EmptyStateStyle.StyledButtonGroup, null, primaryButtonAction && /*#__PURE__*/_react["default"].createElement(_Button.PrimaryButton, (0, _extends2["default"])({}, primaryButtonAction, {
|
|
36
56
|
loading: primaryButtonAction == null ? void 0 : primaryButtonAction.loading,
|
|
37
|
-
onClick: primaryButtonAction == null ? void 0 : primaryButtonAction.onClick
|
|
38
|
-
|
|
57
|
+
onClick: primaryButtonAction == null ? void 0 : primaryButtonAction.onClick,
|
|
58
|
+
className: "empty-state-primary-button"
|
|
59
|
+
}), primaryButtonAction == null ? void 0 : primaryButtonAction.label), basicButtonAction && /*#__PURE__*/_react["default"].createElement(_Button.Button, (0, _extends2["default"])({}, basicButtonAction, {
|
|
39
60
|
loading: basicButtonAction == null ? void 0 : basicButtonAction.loading,
|
|
40
|
-
onClick: basicButtonAction.onClick
|
|
41
|
-
|
|
61
|
+
onClick: basicButtonAction.onClick,
|
|
62
|
+
className: "empty-state-basic-button"
|
|
63
|
+
}), basicButtonAction == null ? void 0 : basicButtonAction.label)), helpText && /*#__PURE__*/_react["default"].createElement(_EmptyStateStyle.StyledHelpText, {
|
|
42
64
|
variant: "subtitle2",
|
|
43
|
-
color: _colors.Neutral.B40
|
|
65
|
+
color: _colors.Neutral.B40,
|
|
66
|
+
className: "empty-state-help-text"
|
|
44
67
|
}, helpText)));
|
|
45
68
|
};
|
|
46
69
|
exports.EmptyState = EmptyState;
|
|
@@ -2,5 +2,6 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
import { ButtonProps } from '../@next';
|
|
3
3
|
export declare type ComponentAction = ButtonProps & {
|
|
4
4
|
label: ReactNode;
|
|
5
|
-
action
|
|
5
|
+
/** action will soon be @deprecated. please use onClick instead */
|
|
6
|
+
action?: (...args: any[]) => void;
|
|
6
7
|
};
|