@antscorp/antsomi-ui 1.3.5-beta.624 → 1.3.5-beta.626

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.
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { IconProps } from './types';
3
+ export declare const DestinationsIcon: React.ForwardRefExoticComponent<IconProps & React.RefAttributes<SVGSVGElement>>;
@@ -0,0 +1,7 @@
1
+ import React, { forwardRef } from 'react';
2
+ import { useIcon } from './hooks/useIcon';
3
+ export const DestinationsIcon = forwardRef((props, ref) => {
4
+ const { width, height } = useIcon(props);
5
+ return (React.createElement("svg", Object.assign({ viewBox: "0 0 30 30", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props, { ref: ref, width: width, height: height }),
6
+ React.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M19.0025 6.5C19.0025 7.88071 15.6505 9 11.5155 9C7.38058 9 4.02853 7.88071 4.02853 6.5C4.02853 5.11929 7.38058 4 11.5155 4C15.6505 4 19.0025 5.11929 19.0025 6.5ZM11.4875 14.465C15.6225 14.465 18.9745 13.42 18.9745 12.131V8.46204C18.9745 9.74904 15.6225 10.795 11.4875 10.795C7.35255 10.795 4.00055 9.75104 4.00055 8.46204V12.131C4.00055 13.419 7.35255 14.465 11.4875 14.465ZM21.0026 17L26.0026 21.5L21.0026 26V23H16.0026V20H21.0026V17ZM18.8865 18H14.0026L13.9996 19.858C13.1644 19.9505 12.3248 19.9966 11.4846 19.996C7.34956 19.996 3.99756 18.95 3.99756 17.662V14C3.99756 15.289 7.34956 16.333 11.4846 16.333C15.6196 16.333 18.9716 15.287 18.9716 14V17.666C18.9677 17.7821 18.9386 17.8961 18.8865 18Z", fill: "currentColor" })));
7
+ });
@@ -239,3 +239,4 @@ export { WebhookIcon } from './WebhookIcon';
239
239
  export { WidgetIcon } from './WidgetIcon';
240
240
  export { WritingAIAssitantIcon } from './WritingAIAssitantIcon';
241
241
  export { ExpandMoreIcon } from './ExpandMoreIcon';
242
+ export { DestinationsIcon } from './DestinationsIcon';
@@ -239,3 +239,4 @@ export { WebhookIcon } from './WebhookIcon';
239
239
  export { WidgetIcon } from './WidgetIcon';
240
240
  export { WritingAIAssitantIcon } from './WritingAIAssitantIcon';
241
241
  export { ExpandMoreIcon } from './ExpandMoreIcon';
242
+ export { DestinationsIcon } from './DestinationsIcon';
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ export declare const ComponentIcons: {
3
+ AccountCircleIcon: React.LazyExoticComponent<React.ForwardRefExoticComponent<import("./types").IconProps & React.RefAttributes<SVGSVGElement>>>;
4
+ ListIcon: React.LazyExoticComponent<React.ForwardRefExoticComponent<import("./types").IconProps & React.RefAttributes<SVGSVGElement>>>;
5
+ InvisibleIcon: React.LazyExoticComponent<React.ForwardRefExoticComponent<import("./types").IconProps & React.RefAttributes<SVGSVGElement>>>;
6
+ LocalMallIcon: React.LazyExoticComponent<React.ForwardRefExoticComponent<import("./types").IconProps & React.RefAttributes<SVGSVGElement>>>;
7
+ };
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ export const ComponentIcons = {
3
+ AccountCircleIcon: React.lazy(() => import('./AccountCircleIcon').then(m => ({ default: m.AccountCircleIcon }))),
4
+ ListIcon: React.lazy(() => import('./ListIcon').then(m => ({ default: m.ListIcon }))),
5
+ InvisibleIcon: React.lazy(() => import('./InvisibleIcon').then(m => ({ default: m.InvisibleIcon }))),
6
+ LocalMallIcon: React.lazy(() => import('./LocalMallIcon').then(m => ({ default: m.LocalMallIcon }))),
7
+ };
@@ -2,3 +2,4 @@ export * from './atoms';
2
2
  export * from './molecules';
3
3
  export * from './organism';
4
4
  export * from './template';
5
+ export { ComponentIcons } from './icons/loadable';
@@ -2,3 +2,5 @@ export * from './atoms';
2
2
  export * from './molecules';
3
3
  export * from './organism';
4
4
  export * from './template';
5
+ // Icons
6
+ export { ComponentIcons } from './icons/loadable';
@@ -21,12 +21,13 @@ export const AccountListing = React.forwardRef((props, ref) => {
21
21
  }), [recentData, accountData]);
22
22
  // Handlers
23
23
  const handleSelectAccount = useCallback((userId) => {
24
- const currentRecent = (recentData === null || recentData === void 0 ? void 0 : recentData.value) || [];
24
+ const currentRecent = (recentData === null || recentData === void 0 ? void 0 : recentData.value.filter(Boolean).slice(0, 2)) || [];
25
25
  const body = userId !== currentRecent[0]
26
26
  ? [userId, currentRecent[0]]
27
- : currentRecent[1]
28
- ? [userId, currentRecent[1]]
29
- : [userId, currentRecent[0]];
27
+ : // Check the second current account is existed
28
+ currentRecent[1]
29
+ ? [userId, currentRecent[1]]
30
+ : [userId, undefined];
30
31
  updateRecentAccount(body.map(id => Number(id)));
31
32
  onChange === null || onChange === void 0 ? void 0 : onChange(userId);
32
33
  },
@@ -15,17 +15,20 @@ import { LoadingOutlined } from '@ant-design/icons';
15
15
  import { isString } from 'lodash';
16
16
  // Components
17
17
  import { Flex, Spin, Typography } from '@antscorp/antsomi-ui/es/components/atoms';
18
- // Components
19
18
  import { Icon } from '@antscorp/antsomi-ui/es/components';
20
19
  // Styled
21
20
  import { EmptyIcon, EmptyWrapper, ImageWrapper } from './styled';
21
+ // Constants
22
+ import { EMPTY_ICON_SIZE } from './constants';
22
23
  const { Text } = Typography;
23
24
  export const EmptyData = props => {
24
25
  const { size = 'medium', icon = 'icon-ants-media', showIcon = true, title, subTitle, description, loading, className, image, imageClassName, imageStyle, children } = props, restOfProps = __rest(props, ["size", "icon", "showIcon", "title", "subTitle", "description", "loading", "className", "image", "imageClassName", "imageStyle", "children"]);
25
26
  return (React.createElement(EmptyWrapper, Object.assign({ className: className }, restOfProps),
26
27
  React.createElement(Flex, { vertical: true, align: "center", justify: "center", gap: 15 },
27
28
  !!showIcon && (React.createElement(React.Fragment, null,
28
- !image && (React.createElement(EmptyIcon, { className: "animate__animated animate__tada", "$size": size }, isString(icon) ? React.createElement(Icon, { type: icon }) : icon)),
29
+ !image && (React.createElement(EmptyIcon, { className: "animate__animated animate__tada", "$size": size }, isString(icon) ? (React.createElement(Icon, { type: icon })) : (React.cloneElement(icon, {
30
+ size: EMPTY_ICON_SIZE[size],
31
+ })))),
29
32
  image && (React.createElement(ImageWrapper, { className: imageClassName, style: imageStyle },
30
33
  React.createElement("img", { src: image, alt: "" }))))),
31
34
  loading ? (React.createElement(Spin, { indicator: React.createElement(LoadingOutlined, { style: { fontSize: 24 }, spin: true }) })) : (React.createElement(Flex, { gap: 5, align: "center", justify: "center", vertical: true },
@@ -1,4 +1,4 @@
1
- var _a, _b, _c;
1
+ var _a, _b, _c, _d;
2
2
  // Libraries
3
3
  import styled, { css } from 'styled-components';
4
4
  // Components
@@ -44,6 +44,7 @@ export const EmptyIcon = styled.div `
44
44
  justify-content: center;
45
45
  border-radius: 100%;
46
46
  background-color: ${(_b = THEME.token) === null || _b === void 0 ? void 0 : _b.bw2};
47
+ color: ${(_c = THEME.token) === null || _c === void 0 ? void 0 : _c.bw5};
47
48
 
48
49
  /* Handle Size */
49
50
  ${({ $size }) => {
@@ -60,7 +61,7 @@ export const EmptyIcon = styled.div `
60
61
  }}
61
62
 
62
63
  i {
63
- color: ${(_c = THEME.token) === null || _c === void 0 ? void 0 : _c.bw5};
64
+ color: ${(_d = THEME.token) === null || _d === void 0 ? void 0 : _d.bw5};
64
65
  }
65
66
  `;
66
67
  export const ImageWrapper = styled.div `
@@ -29,7 +29,7 @@ import { useIntersectionObserver, useListingItemResize } from '@antscorp/antsomi
29
29
  export const TemplateListing = memo(props => {
30
30
  const { templatesProps = TEMPLATES_DEFAULT, templateItemProps = TEMPLATE_ITEM_DEFAULT, blankTemplateProps = BLANK_TEMPLATE_DEFAULT, categoryListingProps = CATEGORY_LISTING_DEFAULT, emptyProps = EMPTY_DEFAULT, previewModalProps, } = props;
31
31
  const [openPreviewModal, setOpenPreviewModal] = useState(false);
32
- const { header, footer, items = [], gap = LISTING_GAP_DEFAULT, loading = false, wrapperClassName, wrapperStyle, onLoadMoreTemplates = () => { }, } = templatesProps || {};
32
+ const { header, footer, content, items = [], gap = LISTING_GAP_DEFAULT, loading = false, wrapperClassName, wrapperStyle, onLoadMoreTemplates = () => { }, } = templatesProps || {};
33
33
  const _a = previewModalProps || {}, { onOk, onCancel } = _a, restOfPreviewModalProps = __rest(_a, ["onOk", "onCancel"]);
34
34
  const _b = templateItemProps || {}, { width = THUMBNAIL_CARD_DEFAULT_WIDTH, height = THUMBNAIL_CARD_DEFAULT_HEIGHT, previewBtnProps } = _b, restOfTemplateItemProps = __rest(_b, ["width", "height", "previewBtnProps"]);
35
35
  const { onClick: onClickPreview } = previewBtnProps || {};
@@ -62,27 +62,32 @@ export const TemplateListing = memo(props => {
62
62
  onCancel === null || onCancel === void 0 ? void 0 : onCancel(e);
63
63
  setOpenPreviewModal(false);
64
64
  };
65
+ const renderTemplateListing = () => (React.createElement(Spin, { spinning: loading || !itemPerRow, wrapperClassName: "template-listing__loading template-listing__loading--full" },
66
+ React.createElement(Scrollbars, { className: "template-listing" },
67
+ React.createElement("div", { ref: containerRef, style: {
68
+ display: 'grid',
69
+ gap: listingGap,
70
+ gridTemplateColumns: `repeat(${itemPerRow}, minmax(0, 1fr))`,
71
+ } },
72
+ React.createElement(BlankTemplate, Object.assign({ width: width * ratio, height: height * ratio }, blankTemplateProps)),
73
+ !!itemPerRow &&
74
+ (items === null || items === void 0 ? void 0 : items.map((item, index) => {
75
+ const { id, name, thumbnail } = item || {};
76
+ const loading = typeof (item === null || item === void 0 ? void 0 : item.name) === 'undefined';
77
+ return (React.createElement("div", { key: id },
78
+ index === items.length - 2 && React.createElement(LoadMoreBlock, { ref: loadMoreRef }),
79
+ React.createElement(ThumbnailCard, Object.assign({ id: id || 0, name: name || 'Untitled', loading: loading, width: width * ratio, height: height * ratio, thumbnail: thumbnail, className: `${templateItemProps.className}`, thumbnailCacheValue: thumbnailCacheValue, previewBtnProps: Object.assign(Object.assign({}, previewBtnProps), { onClick: handleClickThumbnailPreview }) }, restOfTemplateItemProps))));
80
+ }))),
81
+ !loading && !blankTemplateProps.show && !isHasData && (React.createElement(EmptyData, { icon: emptyProps === null || emptyProps === void 0 ? void 0 : emptyProps.icon, title: emptyProps === null || emptyProps === void 0 ? void 0 : emptyProps.description })))));
65
82
  return (React.createElement(TemplateListingWrapper, null,
66
83
  React.createElement(CategoryListing, Object.assign({}, categoryListingProps, { emptyProps: emptyProps })),
67
84
  React.createElement(TemplateWrapper, { className: wrapperClassName, style: wrapperStyle },
68
85
  header,
69
- React.createElement(Spin, { spinning: loading || !itemPerRow, wrapperClassName: "template-listing__loading template-listing__loading--full" },
70
- React.createElement(Scrollbars, { className: "template-listing" },
71
- React.createElement("div", { ref: containerRef, style: {
72
- display: 'grid',
73
- gap: listingGap,
74
- gridTemplateColumns: `repeat(${itemPerRow}, minmax(0, 1fr))`,
75
- } },
76
- React.createElement(BlankTemplate, Object.assign({ width: width * ratio, height: height * ratio }, blankTemplateProps)),
77
- !!itemPerRow &&
78
- (items === null || items === void 0 ? void 0 : items.map((item, index) => {
79
- const { id, name, thumbnail } = item || {};
80
- const loading = typeof (item === null || item === void 0 ? void 0 : item.name) === 'undefined';
81
- return (React.createElement("div", { key: id },
82
- index === items.length - 2 && React.createElement(LoadMoreBlock, { ref: loadMoreRef }),
83
- React.createElement(ThumbnailCard, Object.assign({ id: id || 0, name: name || 'Untitled', loading: loading, width: width * ratio, height: height * ratio, thumbnail: thumbnail, className: `${templateItemProps.className}`, thumbnailCacheValue: thumbnailCacheValue, previewBtnProps: Object.assign(Object.assign({}, previewBtnProps), { onClick: handleClickThumbnailPreview }) }, restOfTemplateItemProps))));
84
- }))),
85
- !loading && !blankTemplateProps.show && !isHasData && (React.createElement(EmptyData, { icon: emptyProps === null || emptyProps === void 0 ? void 0 : emptyProps.icon, title: emptyProps === null || emptyProps === void 0 ? void 0 : emptyProps.description })))),
86
+ content
87
+ ? typeof content === 'function'
88
+ ? content(renderTemplateListing())
89
+ : content
90
+ : renderTemplateListing(),
86
91
  footer),
87
92
  React.createElement(PreviewTemplateModal, Object.assign({ open: openPreviewModal, onOk: handleOkPreviewModal, onCancel: handleCancelPreviewModal }, restOfPreviewModalProps))));
88
93
  });
@@ -1,4 +1,4 @@
1
- import { ReactNode } from 'react';
1
+ import React, { ReactNode } from 'react';
2
2
  import { ThumbnailCardProps } from '../../../molecules';
3
3
  import { TThumbnailCardId } from '../../../molecules/ThumbnailCard';
4
4
  import { PreviewTemplateModalProps } from '../../../organism/PreviewTemplateModal/types';
@@ -16,6 +16,8 @@ export interface TemplateListingProps<T = {}> {
16
16
  export type TemplatesProps<T = {}> = {
17
17
  header?: ReactNode;
18
18
  footer?: ReactNode;
19
+ /** Custom content render instead render template listing */
20
+ content?: ReactNode | ((node: ReactNode) => ReactNode);
19
21
  items?: ((TTemplateItem & T) | undefined)[];
20
22
  loading?: boolean;
21
23
  gap?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.5-beta.624",
3
+ "version": "1.3.5-beta.626",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",