@antscorp/antsomi-ui 1.3.5-beta.268 → 1.3.5-beta.269

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.
@@ -1,7 +1,9 @@
1
1
  import React from 'react';
2
- export interface EmptyTemplateProps {
2
+ export interface EmptyDataProps {
3
+ size?: TUISize;
3
4
  icon?: React.ReactNode;
4
5
  title?: React.ReactNode;
6
+ subTitle?: React.ReactNode;
5
7
  description?: React.ReactNode;
6
8
  loading?: boolean;
7
9
  className?: string;
@@ -9,4 +11,4 @@ export interface EmptyTemplateProps {
9
11
  imageClassName?: string;
10
12
  imageStyle?: React.CSSProperties;
11
13
  }
12
- export declare const EmptyTemplate: React.FC<React.PropsWithChildren<EmptyTemplateProps>>;
14
+ export declare const EmptyData: React.FC<React.PropsWithChildren<EmptyDataProps>>;
@@ -0,0 +1,24 @@
1
+ // Libraries
2
+ import React from 'react';
3
+ import { LoadingOutlined } from '@ant-design/icons';
4
+ import { isString } from 'lodash';
5
+ // Components
6
+ import { Flex, Spin, Typography } from '@antscorp/antsomi-ui/es/components/atoms';
7
+ // Components
8
+ import { Icon } from '@antscorp/antsomi-ui/es/components';
9
+ // Styled
10
+ import { EmptyIcon, EmptyWrapper, ImageWrapper } from './styled';
11
+ const { Text } = Typography;
12
+ export const EmptyData = props => {
13
+ const { size = 'medium', icon = 'icon-ants-media', title, subTitle, description, loading, className, image, imageClassName, imageStyle, children, } = props;
14
+ return (React.createElement(EmptyWrapper, { className: className },
15
+ React.createElement(Flex, { vertical: true, align: "center", justify: "center", gap: 15 },
16
+ !image && (React.createElement(EmptyIcon, { className: "animate__animated animate__tada", "$size": size }, isString(icon) ? React.createElement(Icon, { type: icon }) : icon)),
17
+ image && (React.createElement(ImageWrapper, { className: imageClassName, style: imageStyle },
18
+ React.createElement("img", { src: image, alt: "" }))),
19
+ loading ? (React.createElement(Spin, { indicator: React.createElement(LoadingOutlined, { style: { fontSize: 24 }, spin: true }) })) : (React.createElement(Flex, { gap: 5, align: "center", justify: "center", vertical: true },
20
+ title && React.createElement(Text, { className: "title animate__animated animate__fadeInUp" }, title),
21
+ subTitle && (React.createElement(Text, { className: "subTitle animate__animated animate__fadeInUp" }, subTitle)),
22
+ description && (React.createElement(Text, { className: "description animate__animated animate__fadeInUp" }, description))))),
23
+ children));
24
+ };
@@ -0,0 +1,6 @@
1
+ export declare const EMPTY_WRAPPER_SIZE: {
2
+ [x: string]: number;
3
+ };
4
+ export declare const EMPTY_ICON_SIZE: {
5
+ [x: string]: number;
6
+ };
@@ -0,0 +1,12 @@
1
+ import { UI_SIZE } from '@antscorp/antsomi-ui/es/constants';
2
+ const { SMALL, MEDIUM, LARGE } = UI_SIZE;
3
+ export const EMPTY_WRAPPER_SIZE = {
4
+ [SMALL]: 60,
5
+ [MEDIUM]: 80,
6
+ [LARGE]: 100,
7
+ };
8
+ export const EMPTY_ICON_SIZE = {
9
+ [SMALL]: 27,
10
+ [MEDIUM]: 48,
11
+ [LARGE]: 60,
12
+ };
@@ -0,0 +1,2 @@
1
+ export { EmptyData } from './EmptyData';
2
+ export type { EmptyDataProps } from './EmptyData';
@@ -0,0 +1 @@
1
+ export { EmptyData } from './EmptyData';
@@ -1,4 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  export declare const EmptyWrapper: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("antd/es/flex/interface").FlexProps<import("antd/es/_util/type").AnyObject> & import("react").RefAttributes<HTMLElement>>, any, {}, never>;
3
- export declare const EmptyIcon: import("styled-components").StyledComponent<"div", any, {}, never>;
3
+ export declare const EmptyIcon: import("styled-components").StyledComponent<"div", any, {
4
+ $size?: TUISize | undefined;
5
+ }, never>;
4
6
  export declare const ImageWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -1,10 +1,11 @@
1
1
  var _a, _b, _c;
2
2
  // Libraries
3
- import styled from 'styled-components';
3
+ import styled, { css } from 'styled-components';
4
4
  // Components
5
5
  import { Flex } from '@antscorp/antsomi-ui/es/components/atoms';
6
6
  // Constants
7
7
  import { THEME } from '@antscorp/antsomi-ui/es/constants';
8
+ import { EMPTY_ICON_SIZE, EMPTY_WRAPPER_SIZE } from './constants';
8
9
  export const EmptyWrapper = styled(Flex) `
9
10
  width: 100%;
10
11
  height: 100%;
@@ -12,7 +13,14 @@ export const EmptyWrapper = styled(Flex) `
12
13
  .title {
13
14
  font-size: 14px;
14
15
  font-weight: 400;
15
- line-height: 16px;
16
+ line-height: 16.41px;
17
+ color: black;
18
+ }
19
+
20
+ .subTitle {
21
+ font-size: 12px;
22
+ font-weight: 600;
23
+ line-height: 14.06px;
16
24
  color: black;
17
25
  }
18
26
 
@@ -27,19 +35,30 @@ EmptyWrapper.defaultProps = {
27
35
  vertical: true,
28
36
  align: 'center',
29
37
  justify: 'center',
30
- gap: 15,
38
+ gap: 20,
31
39
  };
32
40
  export const EmptyIcon = styled.div `
33
41
  display: flex;
34
42
  align-items: center;
35
43
  justify-content: center;
36
- width: 80px;
37
- height: 80px;
38
44
  border-radius: 100%;
39
45
  background-color: ${(_b = THEME.token) === null || _b === void 0 ? void 0 : _b.bw2};
40
46
 
47
+ /* Handle Size */
48
+ ${({ $size }) => {
49
+ if ($size) {
50
+ return css `
51
+ width: ${EMPTY_WRAPPER_SIZE[$size]}px;
52
+ height: ${EMPTY_WRAPPER_SIZE[$size]}px;
53
+
54
+ i {
55
+ font-size: ${EMPTY_ICON_SIZE[$size]}px;
56
+ }
57
+ `;
58
+ }
59
+ }}
60
+
41
61
  i {
42
- font-size: 40px;
43
62
  color: ${(_c = THEME.token) === null || _c === void 0 ? void 0 : _c.bw6};
44
63
  }
45
64
  `;
@@ -45,8 +45,8 @@ export { InputNumber as InputNumberWithLabel } from './InputNumber';
45
45
  export * from './SelectMulti';
46
46
  export * from './SelectEventAttribute';
47
47
  export * from './DatePickerV2';
48
- export { EmptyTemplate, EmptyTemplateProps } from './EmptyTemplate';
49
48
  export { ModalSelect } from './ModalSelect';
49
+ export { EmptyData, EmptyDataProps } from './EmptyData';
50
50
  export * from './PreviewModal';
51
51
  export * from './Drawer';
52
52
  export * from './DrawerDetail';
@@ -45,8 +45,8 @@ export { InputNumber as InputNumberWithLabel } from './InputNumber';
45
45
  export * from './SelectMulti';
46
46
  export * from './SelectEventAttribute';
47
47
  export * from './DatePickerV2';
48
- export { EmptyTemplate } from './EmptyTemplate';
49
48
  export { ModalSelect } from './ModalSelect';
49
+ export { EmptyData } from './EmptyData';
50
50
  export * from './PreviewModal';
51
51
  export * from './Drawer';
52
52
  export * from './DrawerDetail';
@@ -24,3 +24,8 @@ export declare const PORTALS_IDS: {
24
24
  SANDBOX: number;
25
25
  SANDBOX_76753: number;
26
26
  };
27
+ export declare const UI_SIZE: {
28
+ SMALL: string;
29
+ MEDIUM: string;
30
+ LARGE: string;
31
+ };
@@ -25,3 +25,8 @@ export const PORTALS_IDS = {
25
25
  SANDBOX: 33167,
26
26
  SANDBOX_76753: 76753,
27
27
  };
28
+ export const UI_SIZE = {
29
+ SMALL: 'small',
30
+ MEDIUM: 'medium',
31
+ LARGE: 'large',
32
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.5-beta.268",
3
+ "version": "1.3.5-beta.269",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",
@@ -1,22 +0,0 @@
1
- // Libraries
2
- import React from 'react';
3
- import { LoadingOutlined } from '@ant-design/icons';
4
- import { isString } from 'lodash';
5
- // Components
6
- import { Flex, Spin, Typography } from '@antscorp/antsomi-ui/es/components/atoms';
7
- // Components
8
- import { Icon } from '@antscorp/antsomi-ui/es/components';
9
- // Styled
10
- import { EmptyIcon, EmptyWrapper, ImageWrapper } from './styled';
11
- const { Text } = Typography;
12
- export const EmptyTemplate = props => {
13
- const { icon = 'icon-ants-media', title = 'No data', description, loading, className, image, imageClassName, imageStyle, children, } = props;
14
- return (React.createElement(EmptyWrapper, { className: className },
15
- !image && (React.createElement(EmptyIcon, { className: "animate__animated animate__tada" }, isString(icon) ? React.createElement(Icon, { type: icon }) : icon)),
16
- image && (React.createElement(ImageWrapper, { className: imageClassName, style: imageStyle },
17
- React.createElement("img", { src: image, alt: "" }))),
18
- loading ? (React.createElement(Spin, { indicator: React.createElement(LoadingOutlined, { style: { fontSize: 24 }, spin: true }) })) : (React.createElement(Flex, { gap: 5, align: "center", justify: "center", vertical: true },
19
- React.createElement(Text, { className: "title animate__animated animate__fadeInUp" }, title),
20
- description && (React.createElement(Text, { className: "description animate__animated animate__fadeInUp" }, description)))),
21
- children));
22
- };
@@ -1,2 +0,0 @@
1
- export { EmptyTemplate } from './EmptyTemplate';
2
- export type { EmptyTemplateProps } from './EmptyTemplate';
@@ -1 +0,0 @@
1
- export { EmptyTemplate } from './EmptyTemplate';