@antscorp/antsomi-ui 1.3.5-beta.249 → 1.3.5-beta.250

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,4 +1,8 @@
1
- /// <reference types="react" />
2
- export declare const Steps: import("react").FC<import("antd").StepsProps> & {
3
- Step: typeof import("rc-steps").Step;
1
+ import React from 'react';
2
+ import { StepsProps as AntdStepsProps, StepProps as AntdStepProps } from 'antd';
3
+ export type StepsProps = AntdStepsProps & {
4
+ saveHighestStep?: boolean;
5
+ iconSize?: number;
4
6
  };
7
+ export type StepProps = AntdStepProps;
8
+ export declare const Steps: React.FC<StepsProps>;
@@ -1,2 +1,51 @@
1
- import { Steps as AntdSteps } from 'antd';
2
- export const Steps = AntdSteps;
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ // Libraries
13
+ import React, { useEffect, useMemo, useState, memo } from 'react';
14
+ import { isNumber } from 'lodash';
15
+ // Styled
16
+ import { SelectedIcon, StepsWrapper } from './styled';
17
+ export const Steps = memo(props => {
18
+ const { items, saveHighestStep = true, iconSize = 24, className } = props, restOfProps = __rest(props, ["items", "saveHighestStep", "iconSize", "className"]);
19
+ const { current, size = 'small' } = restOfProps;
20
+ const [highestStep, setHighestStep] = useState(0);
21
+ useEffect(() => {
22
+ if (saveHighestStep && current && current > highestStep) {
23
+ setHighestStep(current);
24
+ }
25
+ }, [current, saveHighestStep, highestStep]);
26
+ const customItems = useMemo(() => saveHighestStep
27
+ ? items === null || items === void 0 ? void 0 : items.map((item, index) => {
28
+ let status;
29
+ let icon;
30
+ let className;
31
+ if (index > highestStep) {
32
+ status = 'wait';
33
+ }
34
+ else {
35
+ if (index === current) {
36
+ status = 'process';
37
+ icon = undefined;
38
+ }
39
+ else {
40
+ status = 'finish';
41
+ icon = React.createElement(SelectedIcon, { size: size }, index + 1);
42
+ className = `antsomi-steps-item-selectable${index === highestStep ? ' highest-step' : ''}`;
43
+ }
44
+ }
45
+ return Object.assign({ status, icon, className }, item);
46
+ })
47
+ : items, [current, saveHighestStep, highestStep, items, size]);
48
+ /** Check whether the user has reactivated the previous step or not */
49
+ const isReactivate = saveHighestStep && isNumber(current) && current < highestStep;
50
+ return (React.createElement(StepsWrapper, Object.assign({ items: customItems }, restOfProps, { size: "small", iconSize: iconSize, isReactivate: isReactivate, highestStep: highestStep, className: `${className || ''}${saveHighestStep ? ' save-highest-step' : ''}` })));
51
+ });
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ export declare const SelectedIcon: import("styled-components").StyledComponent<"div", any, {
3
+ size: 'small' | 'default';
4
+ }, never>;
5
+ export declare const StepsWrapper: import("styled-components").StyledComponent<import("react").FC<import("antd").StepsProps> & {
6
+ Step: typeof import("rc-steps").Step;
7
+ }, any, {
8
+ iconSize: number;
9
+ isReactivate: boolean;
10
+ highestStep: number;
11
+ }, never>;
@@ -0,0 +1,179 @@
1
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
2
+ import styled from 'styled-components';
3
+ import { Steps } from 'antd';
4
+ // Constants
5
+ import { THEME } from '@antscorp/antsomi-ui/es/constants';
6
+ export const SelectedIcon = styled.div `
7
+ border: 1px solid #b8cfe6;
8
+ border-radius: 100%;
9
+ width: ${({ size }) => (size === 'small' ? 20 : 30)}px;
10
+ height: ${({ size }) => (size === 'small' ? 20 : 30)}px;
11
+ font-size: 14px;
12
+ color: ${(_a = THEME.token) === null || _a === void 0 ? void 0 : _a.colorPrimary};
13
+ `;
14
+ export const StepsWrapper = styled(Steps) `
15
+ &.save-highest-step {
16
+ /** Steps Default */
17
+ &.antsomi-steps:not(.antsomi-steps-dot) {
18
+ .antsomi-steps-item {
19
+ .antsomi-steps-item-container {
20
+ .antsomi-steps-item-icon {
21
+ box-sizing: content-box;
22
+ border-radius: 100%;
23
+ font-size: 14px;
24
+ font-weight: bold;
25
+
26
+ .antsomi-steps-icon {
27
+ color: white;
28
+ }
29
+ }
30
+
31
+ & > .antsomi-steps-item-content > .antsomi-steps-item-title::after {
32
+ height: 2px;
33
+ background-color: ${(_b = THEME.token) === null || _b === void 0 ? void 0 : _b.bw6};
34
+ }
35
+
36
+ & > .antsomi-steps-item-tail::after {
37
+ width: 2px;
38
+ background-color: ${(_c = THEME.token) === null || _c === void 0 ? void 0 : _c.bw6};
39
+ }
40
+ }
41
+
42
+ &:not(.antsomi-steps-item-active) > .antsomi-steps-item-container[role='button'] {
43
+ &:hover {
44
+ .antsomi-steps-item-icon {
45
+ background-color: white;
46
+ }
47
+ .antsomi-steps-item-content {
48
+ color: ${(_d = THEME.token) === null || _d === void 0 ? void 0 : _d.colorPrimary};
49
+ }
50
+ }
51
+ }
52
+
53
+ &.highest-step {
54
+ .antsomi-steps-item-container {
55
+ & > .antsomi-steps-item-content > .antsomi-steps-item-title::after,
56
+ & > .antsomi-steps-item-tail::after {
57
+ background-color: ${(_e = THEME.token) === null || _e === void 0 ? void 0 : _e.bw6} !important;
58
+ }
59
+ }
60
+ }
61
+
62
+ &.antsomi-steps-item-selectable {
63
+ & > .antsomi-steps-item-container {
64
+ & > .antsomi-steps-item-content .antsomi-steps-item-title:after {
65
+ background-color: ${(_f = THEME.token) === null || _f === void 0 ? void 0 : _f.colorPrimary};
66
+ }
67
+
68
+ .antsomi-steps-item-tail::after {
69
+ background-color: ${(_g = THEME.token) === null || _g === void 0 ? void 0 : _g.colorPrimary};
70
+ }
71
+ }
72
+ }
73
+
74
+ &.antsomi-steps-item-process.antsomi-steps-item-active {
75
+ & > .antsomi-steps-item-container {
76
+ & > .antsomi-steps-item-content > .antsomi-steps-item-title {
77
+ &::after {
78
+ ${({ isReactivate }) => { var _a; return isReactivate ? `background-color: ${(_a = THEME.token) === null || _a === void 0 ? void 0 : _a.colorPrimary}` : ''; }};
79
+ }
80
+ }
81
+
82
+ & > .antsomi-steps-item-tail {
83
+ &::after {
84
+ ${({ isReactivate }) => { var _a; return isReactivate ? `background-color: ${(_a = THEME.token) === null || _a === void 0 ? void 0 : _a.colorPrimary}` : ''; }};
85
+ }
86
+ }
87
+ }
88
+ }
89
+ }
90
+ }
91
+
92
+ /** Steps dot */
93
+ &.antsomi-steps.antsomi-steps-dot {
94
+ &.antsomi-steps-horizontal .antsomi-steps-item .antsomi-steps-item-container {
95
+ & > .antsomi-steps-item-tail::after {
96
+ height: 2px;
97
+ }
98
+ }
99
+
100
+ &.antsomi-steps-vertical .antsomi-steps-item .antsomi-steps-item-container {
101
+ & > .antsomi-steps-item-tail::after {
102
+ width: 2px;
103
+ }
104
+ }
105
+
106
+ &.antsomi-steps-horizontal .antsomi-steps-item-tail::after,
107
+ &.antsomi-steps-vertical .antsomi-steps-item-tail::after {
108
+ background-color: ${(_h = THEME.token) === null || _h === void 0 ? void 0 : _h.bw6};
109
+ }
110
+
111
+ .antsomi-steps-item-selectable > .antsomi-steps-item-container {
112
+ & > .antsomi-steps-item-tail::after {
113
+ background-color: ${(_j = THEME.token) === null || _j === void 0 ? void 0 : _j.colorPrimary};
114
+ }
115
+ }
116
+
117
+ .antsomi-steps-item-process.antsomi-steps-item-active {
118
+ & > .antsomi-steps-item-container {
119
+ & > .antsomi-steps-item-tail::after {
120
+ ${({ isReactivate }) => { var _a; return isReactivate ? `background-color: ${(_a = THEME.token) === null || _a === void 0 ? void 0 : _a.colorPrimary}` : ''; }};
121
+ }
122
+ }
123
+ }
124
+
125
+ .highest-step {
126
+ .antsomi-steps-item-container > .antsomi-steps-item-tail::after {
127
+ background-color: ${(_k = THEME.token) === null || _k === void 0 ? void 0 : _k.bw6} !important;
128
+ }
129
+ }
130
+ }
131
+
132
+ /** Common */
133
+ &.antsomi-steps {
134
+ .antsomi-steps-item-wait {
135
+ color: ${(_l = THEME.token) === null || _l === void 0 ? void 0 : _l.bw7};
136
+
137
+ & > .antsomi-steps-item-container > .antsomi-steps-item-icon {
138
+ background-color: ${(_m = THEME.token) === null || _m === void 0 ? void 0 : _m.bw6};
139
+ }
140
+
141
+ & > .antsomi-steps-item-container > .antsomi-steps-item-content {
142
+ .antsomi-steps-item-title,
143
+ .antsomi-steps-item-description {
144
+ color: inherit;
145
+ }
146
+ }
147
+ }
148
+
149
+ .antsomi-steps-item-process.antsomi-steps-item-active {
150
+ font-weight: bold;
151
+ color: ${(_o = THEME.token) === null || _o === void 0 ? void 0 : _o.colorPrimary};
152
+
153
+ & > .antsomi-steps-item-container {
154
+ & > .antsomi-steps-item-content > .antsomi-steps-item-title,
155
+ & > .antsomi-steps-item-content > .antsomi-steps-item-description {
156
+ color: inherit;
157
+ }
158
+ }
159
+ }
160
+
161
+ .antsomi-steps-item-selectable {
162
+ color: black;
163
+
164
+ & > .antsomi-steps-item-container {
165
+ & > .antsomi-steps-item-icon {
166
+ color: ${(_p = THEME.token) === null || _p === void 0 ? void 0 : _p.colorPrimary};
167
+ }
168
+
169
+ & > .antsomi-steps-item-content {
170
+ .antsomi-steps-item-title,
171
+ .antsomi-steps-item-description {
172
+ color: inherit;
173
+ }
174
+ }
175
+ }
176
+ }
177
+ }
178
+ }
179
+ `;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ export interface EmptyTemplateProps {
3
+ icon?: React.ReactNode;
4
+ title?: React.ReactNode;
5
+ description?: React.ReactNode;
6
+ loading?: boolean;
7
+ className?: string;
8
+ image?: string;
9
+ imageClassName?: string;
10
+ imageStyle?: React.CSSProperties;
11
+ }
12
+ export declare const EmptyTemplate: React.FC<React.PropsWithChildren<EmptyTemplateProps>>;
@@ -0,0 +1,22 @@
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
+ };
@@ -0,0 +1,2 @@
1
+ export { EmptyTemplate } from './EmptyTemplate';
2
+ export type { EmptyTemplateProps } from './EmptyTemplate';
@@ -0,0 +1 @@
1
+ export { EmptyTemplate } from './EmptyTemplate';
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
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>;
4
+ export declare const ImageWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -0,0 +1,52 @@
1
+ var _a, _b, _c;
2
+ // Libraries
3
+ import styled from 'styled-components';
4
+ // Components
5
+ import { Flex } from '@antscorp/antsomi-ui/es/components/atoms';
6
+ // Constants
7
+ import { THEME } from '@antscorp/antsomi-ui/es/constants';
8
+ export const EmptyWrapper = styled(Flex) `
9
+ width: 100%;
10
+ height: 100%;
11
+
12
+ .title {
13
+ font-size: 14px;
14
+ font-weight: 400;
15
+ line-height: 16px;
16
+ color: black;
17
+ }
18
+
19
+ .description {
20
+ font-size: 11px;
21
+ font-weight: 400;
22
+ line-height: 13px;
23
+ color: ${(_a = THEME.token) === null || _a === void 0 ? void 0 : _a.bw8};
24
+ }
25
+ `;
26
+ EmptyWrapper.defaultProps = {
27
+ vertical: true,
28
+ align: 'center',
29
+ justify: 'center',
30
+ gap: 15,
31
+ };
32
+ export const EmptyIcon = styled.div `
33
+ display: flex;
34
+ align-items: center;
35
+ justify-content: center;
36
+ width: 80px;
37
+ height: 80px;
38
+ border-radius: 100%;
39
+ background-color: ${(_b = THEME.token) === null || _b === void 0 ? void 0 : _b.bw2};
40
+
41
+ i {
42
+ font-size: 40px;
43
+ color: ${(_c = THEME.token) === null || _c === void 0 ? void 0 : _c.bw6};
44
+ }
45
+ `;
46
+ export const ImageWrapper = styled.div `
47
+ img {
48
+ width: 100%;
49
+ height: auto;
50
+ object-fit: contain;
51
+ }
52
+ `;
@@ -26,7 +26,7 @@ export const HeaderV2 = memo(props => {
26
26
  const { search } = useLocation();
27
27
  const history = useHistory();
28
28
  /** Prefer to use Header in AppConfigContext */
29
- const { className, style, pageTitle = 'Page Title', accountSelection = {}, helpConfig, notificationConfig = {}, accountSharingConfig, useURLParam, config, } = props;
29
+ const { className, style, pageTitle = '', accountSelection = {}, helpConfig, notificationConfig = {}, accountSharingConfig, useURLParam, config, } = props;
30
30
  /** General config for children component */
31
31
  const { env = envContext, language = languageCode, userId = isNaN(Number(auth === null || auth === void 0 ? void 0 : auth.userId)) ? 0 : Number(auth === null || auth === void 0 ? void 0 : auth.userId), portalId = auth === null || auth === void 0 ? void 0 : auth.portalId, token = auth === null || auth === void 0 ? void 0 : auth.token, permissionDomain = PERMISSION_API, iamDomain = IAM_API, } = config || {};
32
32
  const { currentAccount, inputStyle = 'select', onSelectAccount } = accountSelection, accountSelectionProps = __rest(accountSelection, ["currentAccount", "inputStyle", "onSelectAccount"]);
@@ -44,6 +44,7 @@ export { InputNumber as InputNumberWithLabel } from './InputNumber';
44
44
  export * from './SelectMulti';
45
45
  export * from './SelectEventAttribute';
46
46
  export * from './DatePickerV2';
47
+ export { EmptyTemplate, EmptyTemplateProps } from './EmptyTemplate';
47
48
  export * from './PreviewModal';
48
49
  export * from './Drawer';
49
50
  export * from './DrawerDetail';
@@ -44,6 +44,7 @@ export { InputNumber as InputNumberWithLabel } from './InputNumber';
44
44
  export * from './SelectMulti';
45
45
  export * from './SelectEventAttribute';
46
46
  export * from './DatePickerV2';
47
+ export { EmptyTemplate } from './EmptyTemplate';
47
48
  export * from './PreviewModal';
48
49
  export * from './Drawer';
49
50
  export * from './DrawerDetail';
@@ -1,5 +1,6 @@
1
1
  // Libraries
2
2
  import React from 'react';
3
+ import { isString } from 'lodash';
3
4
  // Components
4
5
  import { Icon } from '@antscorp/antsomi-ui/es/components';
5
6
  import { Typography } from '@antscorp/antsomi-ui/es/components/atoms';
@@ -7,12 +8,8 @@ import { Typography } from '@antscorp/antsomi-ui/es/components/atoms';
7
8
  import { EmptyIcon, EmptyWrapper } from './styled';
8
9
  const { Text } = Typography;
9
10
  export const Empty = props => {
10
- const { icon, description } = props;
11
+ const { icon = React.createElement(Icon, { type: "icon-ants-media" }), description = 'No data' } = props;
11
12
  return (React.createElement(EmptyWrapper, null,
12
- React.createElement(EmptyIcon, { className: "animate__animated animate__tada" }, icon),
13
+ React.createElement(EmptyIcon, { className: "animate__animated animate__tada" }, isString(icon) ? React.createElement(Icon, { type: icon }) : icon),
13
14
  React.createElement(Text, { className: "animate__animated animate__fadeInUp" }, description)));
14
15
  };
15
- Empty.defaultProps = {
16
- icon: React.createElement(Icon, { type: "icon-ants-media" }),
17
- description: 'No data',
18
- };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.5-beta.249",
3
+ "version": "1.3.5-beta.250",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",