@antscorp/antsomi-ui 1.3.5-beta.172 → 1.3.5-beta.174
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/components/organism/PreviewTemplateModal/components/Banner/index.js +13 -2
- package/es/components/organism/PreviewTemplateModal/components/Banner/styled.d.ts +3 -1
- package/es/components/organism/PreviewTemplateModal/components/Banner/styled.js +23 -17
- package/es/components/organism/PreviewTemplateModal/components/Information/index.js +4 -9
- package/es/components/organism/PreviewTemplateModal/components/Information/styled.d.ts +5 -0
- package/es/components/organism/PreviewTemplateModal/components/Information/styled.js +14 -3
- package/es/components/organism/PreviewTemplateModal/components/SimilarTemplate/index.js +1 -1
- package/es/components/organism/PreviewTemplateModal/components/SimilarTemplate/styled.js +11 -1
- package/es/components/organism/PreviewTemplateModal/components/ThumbnailSlider/styled.js +6 -0
- package/es/components/organism/PreviewTemplateModal/index.js +11 -9
- package/es/components/organism/PreviewTemplateModal/providers/AntdConfigProviderV2.d.ts +7 -0
- package/es/components/organism/PreviewTemplateModal/providers/AntdConfigProviderV2.js +26 -0
- package/es/components/organism/PreviewTemplateModal/providers/index.d.ts +1 -0
- package/es/components/organism/PreviewTemplateModal/providers/index.js +1 -0
- package/es/components/organism/PreviewTemplateModal/types.d.ts +2 -1
- package/package.json +1 -1
|
@@ -1,3 +1,14 @@
|
|
|
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
|
+
};
|
|
1
12
|
// Libraries
|
|
2
13
|
import React, { memo, useEffect, useMemo, useState } from 'react';
|
|
3
14
|
import classNames from 'classnames';
|
|
@@ -8,7 +19,7 @@ import { MobileFrameV2 } from '@antscorp/antsomi-ui/es/components/atoms';
|
|
|
8
19
|
// Constants
|
|
9
20
|
import { DEVICE_TYPE } from '../../constants';
|
|
10
21
|
export const Banner = memo(props => {
|
|
11
|
-
const { deviceType, showSkeleton = false, children } = props;
|
|
22
|
+
const { deviceType, showSkeleton = false, children, height } = props, restOfProps = __rest(props, ["deviceType", "showSkeleton", "children", "height"]);
|
|
12
23
|
const isMobile = useMemo(() => deviceType === DEVICE_TYPE.MOBILE.value, [deviceType]);
|
|
13
24
|
// States
|
|
14
25
|
const [shouldAnimate, setShouldAnimate] = useState(false);
|
|
@@ -20,7 +31,7 @@ export const Banner = memo(props => {
|
|
|
20
31
|
}, 1000);
|
|
21
32
|
return () => clearTimeout(timerId);
|
|
22
33
|
}, [children]);
|
|
23
|
-
return (React.createElement(BannerWrapper,
|
|
34
|
+
return (React.createElement(BannerWrapper, Object.assign({ "$height": height }, restOfProps),
|
|
24
35
|
React.createElement("div", { className: `${isMobile ? 'mobile-wrapper animate__animated animate__zoomIn' : 'desktop-wrapper'}` },
|
|
25
36
|
React.createElement("div", { className: classNames({
|
|
26
37
|
'content-wrapper': true,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
2
|
// Images
|
|
3
3
|
import skeletonBackground from '../../../../../assets/images/background/skeleton-background.png';
|
|
4
|
+
import { globalToken } from '../../providers';
|
|
4
5
|
const THUMBNAIL_CARD_RADIUS = 5;
|
|
5
6
|
export const BannerWrapper = styled.div `
|
|
6
7
|
width: 100%;
|
|
@@ -9,26 +10,31 @@ export const BannerWrapper = styled.div `
|
|
|
9
10
|
justify-content: center;
|
|
10
11
|
align-items: center;
|
|
11
12
|
background-color: #0000001a;
|
|
13
|
+
border-radius: ${globalToken.borderRadius}px;
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
height:
|
|
15
|
-
|
|
15
|
+
${props => props.$height
|
|
16
|
+
? `height: ${props.$height}px`
|
|
17
|
+
: css `
|
|
18
|
+
@media screen and (max-height: 1000px) {
|
|
19
|
+
height: 760px;
|
|
20
|
+
max-height: 760px;
|
|
16
21
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
.mobile-wrapper {
|
|
23
|
+
width: 359px;
|
|
24
|
+
height: 722.41px;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
22
27
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
28
|
+
@media screen and (min-height: 1001px) {
|
|
29
|
+
height: 830px;
|
|
30
|
+
max-height: 830px;
|
|
26
31
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
.mobile-wrapper {
|
|
33
|
+
width: 380px;
|
|
34
|
+
height: 800px;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
`}
|
|
32
38
|
|
|
33
39
|
.mobile-wrapper {
|
|
34
40
|
position: relative;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import React, { memo } from 'react';
|
|
3
3
|
import Icon from '@antscorp/icons';
|
|
4
4
|
// Styled
|
|
5
|
-
import { InformationWrapper } from './styled';
|
|
5
|
+
import { CheckboxButton, InformationWrapper } from './styled';
|
|
6
6
|
// Components
|
|
7
|
-
import { Button,
|
|
7
|
+
import { Button, Typography, Flex } from '../../../../atoms';
|
|
8
8
|
// Constants
|
|
9
9
|
import { DEVICE_TYPE } from '../../constants';
|
|
10
10
|
import { THEME } from '@antscorp/antsomi-ui/es/constants';
|
|
@@ -13,7 +13,7 @@ export const Information = memo(props => {
|
|
|
13
13
|
const { deviceType, itemName = 'Template name', buttonText = 'Use template', description, categoryListing, showDeviceRadios = true, onButtonClick, onDeviceTypeChange, } = props;
|
|
14
14
|
return (React.createElement(InformationWrapper, { gap: 20, vertical: true },
|
|
15
15
|
React.createElement("div", { style: { flexShrink: 0 }, className: "title" }, itemName),
|
|
16
|
-
React.createElement(Flex, { gap:
|
|
16
|
+
React.createElement(Flex, { gap: 15, vertical: true, className: "content-information" },
|
|
17
17
|
description && React.createElement("div", { style: { color: (_a = THEME.token) === null || _a === void 0 ? void 0 : _a.bw8 } }, description), categoryListing === null || categoryListing === void 0 ? void 0 :
|
|
18
18
|
categoryListing.map(({ key, label, children }) => {
|
|
19
19
|
var _a;
|
|
@@ -24,12 +24,7 @@ export const Information = memo(props => {
|
|
|
24
24
|
React.createElement("div", { style: { fontWeight: 'bold' } }, children === null || children === void 0 ? void 0 : children.map(({ label }) => label).join(', '))));
|
|
25
25
|
})),
|
|
26
26
|
React.createElement(Flex, { gap: 20, style: { flexShrink: 0 }, vertical: true },
|
|
27
|
-
showDeviceRadios && (React.createElement(
|
|
28
|
-
label: (React.createElement(Flex, { gap: 5, align: "center" },
|
|
29
|
-
React.createElement(Icon, { type: icon }),
|
|
30
|
-
label)),
|
|
31
|
-
value,
|
|
32
|
-
})), onChange: e => onDeviceTypeChange(e.target.value), value: deviceType, optionType: "button", style: { flexShrink: 0 } })),
|
|
27
|
+
showDeviceRadios && (React.createElement(Flex, { align: "center", gap: 1 }, Object.values(DEVICE_TYPE).map(({ value, label, icon }) => (React.createElement(CheckboxButton, { key: value, icon: React.createElement(Icon, { type: icon }), block: true, "$active": deviceType === value, onClick: () => onDeviceTypeChange(value), type: "text" }, label))))),
|
|
33
28
|
React.createElement(Button, { type: "primary", style: { width: '100%', flexShrink: 0 }, onClick: onButtonClick },
|
|
34
29
|
React.createElement(Typography.Text, { ellipsis: { tooltip: buttonText }, style: { maxWidth: '100%', color: 'inherit' } }, buttonText)))));
|
|
35
30
|
});
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export declare const InformationWrapper: 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 CheckboxButton: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("antd").ButtonProps & import("react").RefAttributes<HTMLElement>> & {
|
|
4
|
+
Group: import("react").FC<import("antd/es/button").ButtonGroupProps>;
|
|
5
|
+
}, any, {
|
|
6
|
+
$active?: boolean | undefined;
|
|
7
|
+
}, never>;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
// Libraries
|
|
2
|
-
import styled from 'styled-components';
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
3
|
// Components
|
|
4
|
-
import { Flex } from '../../../../atoms';
|
|
4
|
+
import { Button, Flex } from '../../../../atoms';
|
|
5
|
+
import { globalToken } from '../../providers';
|
|
5
6
|
export const InformationWrapper = styled(Flex) `
|
|
6
|
-
width:
|
|
7
|
+
width: 300px;
|
|
7
8
|
flex-shrink: 0;
|
|
8
9
|
font-size: 12px;
|
|
9
10
|
height: 100%;
|
|
@@ -43,3 +44,13 @@ export const InformationWrapper = styled(Flex) `
|
|
|
43
44
|
max-height: 682px;
|
|
44
45
|
}
|
|
45
46
|
`;
|
|
47
|
+
export const CheckboxButton = styled(Button) `
|
|
48
|
+
color: ${globalToken.colorText} !important;
|
|
49
|
+
font-weight: 400 !important;
|
|
50
|
+
|
|
51
|
+
${p => p.$active &&
|
|
52
|
+
css `
|
|
53
|
+
color: ${globalToken.colorPrimary} !important;
|
|
54
|
+
background-color: ${globalToken.blue1_1} !important;
|
|
55
|
+
`}
|
|
56
|
+
`;
|
|
@@ -27,6 +27,6 @@ export const SimilarTemplate = memo(props => {
|
|
|
27
27
|
React.createElement("div", { className: "title" }, "Similar templates"),
|
|
28
28
|
React.createElement(TemplateListWrapper, { templateQuantity: MAX_QUANTITY_TEMPLATES }, (_a = similarTemplates.slice(0, MAX_QUANTITY_TEMPLATES)) === null || _a === void 0 ? void 0 : _a.map((item, idx) => {
|
|
29
29
|
const { id, name, thumbnail } = item || {};
|
|
30
|
-
return (React.createElement(ThumbnailCard, Object.assign({ key: id, id: id || idx, name: name, width: width, height: height, thumbnail: thumbnail, actionAvailable: false }, restOfSimilarCardProps)));
|
|
30
|
+
return (React.createElement(ThumbnailCard, Object.assign({ key: id, id: id || idx, name: name, width: width, height: height, thumbnail: thumbnail, actionAvailable: false, className: "thumbnail-card" }, restOfSimilarCardProps)));
|
|
31
31
|
})))) : null;
|
|
32
32
|
});
|
|
@@ -2,15 +2,25 @@
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
// Components
|
|
4
4
|
import { Flex } from '../../../../atoms';
|
|
5
|
+
// Providers
|
|
6
|
+
import { globalToken } from '../../providers';
|
|
5
7
|
export const SimilarTemplateWrapper = styled(Flex) `
|
|
6
8
|
margin-top: 15px;
|
|
7
9
|
|
|
8
10
|
.title {
|
|
9
|
-
font-weight:
|
|
11
|
+
font-weight: 400;
|
|
10
12
|
font-size: 16px;
|
|
11
13
|
}
|
|
12
14
|
`;
|
|
13
15
|
export const TemplateListWrapper = styled.div `
|
|
14
16
|
display: flex;
|
|
15
17
|
justify-content: space-between;
|
|
18
|
+
|
|
19
|
+
.thumbnail-card {
|
|
20
|
+
border-radius: ${globalToken.borderRadius}px;
|
|
21
|
+
|
|
22
|
+
> div {
|
|
23
|
+
border-radius: ${globalToken.borderRadius}px;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
16
26
|
`;
|
|
@@ -2,6 +2,7 @@ var _a;
|
|
|
2
2
|
import { THEME } from '@antscorp/antsomi-ui/es/constants';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import { SwiperSlide } from 'swiper/react';
|
|
5
|
+
import { globalToken } from '../../providers';
|
|
5
6
|
export const ThumbnailSliderWrapper = styled.div `
|
|
6
7
|
width: 100%;
|
|
7
8
|
display: flex;
|
|
@@ -20,6 +21,11 @@ export const ThumbnailSliderWrapper = styled.div `
|
|
|
20
21
|
.thumbnail-animation {
|
|
21
22
|
box-shadow: none;
|
|
22
23
|
transition: box-shadow 0.1s ease-in-out;
|
|
24
|
+
border-radius: ${globalToken.borderRadius}px;
|
|
25
|
+
|
|
26
|
+
> div {
|
|
27
|
+
border-radius: ${globalToken.borderRadius}px;
|
|
28
|
+
}
|
|
23
29
|
|
|
24
30
|
&:hover {
|
|
25
31
|
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1), 0 0 32px rgba(0, 0, 0, 0.04);
|
|
@@ -18,17 +18,19 @@ import { Banner, Information, SimilarTemplate, ThumbnailSlider } from './compone
|
|
|
18
18
|
import { ModalContainer, ModalWrapper } from './styled';
|
|
19
19
|
// Constants
|
|
20
20
|
import { DEVICE_TYPE, SIMILAR_TEMPLATE_DEFAULT, THUMBNAIL_DEFAULT } from './constants';
|
|
21
|
+
import { AntdConfigProviderV2 } from './providers';
|
|
21
22
|
export const PreviewTemplateModal = memo(props => {
|
|
22
23
|
const { bannerProps, thumbnailProps = THUMBNAIL_DEFAULT, similarTemplateProps = SIMILAR_TEMPLATE_DEFAULT, informationProps, loading = false } = props, restOfProps = __rest(props, ["bannerProps", "thumbnailProps", "similarTemplateProps", "informationProps", "loading"]);
|
|
23
24
|
// States
|
|
24
25
|
const [deviceType, setDeviceType] = useState(DEVICE_TYPE.DESKTOP.value);
|
|
25
|
-
return (React.createElement(
|
|
26
|
-
React.createElement(
|
|
27
|
-
React.createElement(
|
|
28
|
-
React.createElement(
|
|
29
|
-
React.createElement(
|
|
30
|
-
React.createElement(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
return (React.createElement(AntdConfigProviderV2, null,
|
|
27
|
+
React.createElement(ModalContainer, Object.assign({ footer: null, centered: true, modalRender: node => React.createElement(ModalWrapper, null, node) }, restOfProps),
|
|
28
|
+
React.createElement(Spin, { spinning: loading },
|
|
29
|
+
React.createElement(Flex, { gap: 20 },
|
|
30
|
+
React.createElement("div", { className: "overview" },
|
|
31
|
+
React.createElement(Flex, { gap: 20, vertical: true, style: { width: '100%' } },
|
|
32
|
+
React.createElement(Banner, Object.assign({ deviceType: deviceType }, bannerProps)),
|
|
33
|
+
React.createElement(ThumbnailSlider, Object.assign({}, thumbnailProps)))),
|
|
34
|
+
React.createElement(Information, Object.assign({ deviceType: deviceType, onDeviceTypeChange: value => setDeviceType(value) }, informationProps))),
|
|
35
|
+
React.createElement(SimilarTemplate, Object.assign({}, similarTemplateProps))))));
|
|
34
36
|
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ConfigProviderProps } from 'antd';
|
|
3
|
+
interface AntdConfigProviderV2Props extends ConfigProviderProps {
|
|
4
|
+
}
|
|
5
|
+
export declare const AntdConfigProviderV2: React.FC<AntdConfigProviderV2Props>;
|
|
6
|
+
export declare const globalToken: import("antd/es/theme/internal").AliasToken;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
var _a;
|
|
13
|
+
// Libraries
|
|
14
|
+
import React from 'react';
|
|
15
|
+
import { ConfigProvider, theme } from 'antd';
|
|
16
|
+
import { THEME } from '@antscorp/antsomi-ui/es/constants';
|
|
17
|
+
const { getDesignToken } = theme;
|
|
18
|
+
const themeV2 = {
|
|
19
|
+
token: Object.assign(Object.assign({}, THEME.token), { colorText: '#000000', borderRadius: 10, borderRadiusLG: 10 }),
|
|
20
|
+
components: Object.assign(Object.assign({}, THEME.components), { Button: Object.assign(Object.assign({}, (_a = THEME.components) === null || _a === void 0 ? void 0 : _a.Button), { textHoverBg: '#F2F9FF' }) }),
|
|
21
|
+
};
|
|
22
|
+
export const AntdConfigProviderV2 = props => {
|
|
23
|
+
const { children } = props, restProps = __rest(props, ["children"]);
|
|
24
|
+
return (React.createElement(ConfigProvider, Object.assign({ theme: themeV2 }, restProps), children));
|
|
25
|
+
};
|
|
26
|
+
export const globalToken = getDesignToken(themeV2);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './AntdConfigProviderV2';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './AntdConfigProviderV2';
|
|
@@ -12,9 +12,10 @@ export interface PreviewTemplateModalProps extends ModalProps {
|
|
|
12
12
|
similarTemplateProps?: SimilarTemplateProps;
|
|
13
13
|
informationProps?: Omit<InformationProps, 'deviceType' | 'onDeviceTypeChange'>;
|
|
14
14
|
}
|
|
15
|
-
export interface BannerProps {
|
|
15
|
+
export interface BannerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
16
16
|
deviceType: InformationProps['deviceType'];
|
|
17
17
|
showSkeleton?: boolean;
|
|
18
|
+
height?: number;
|
|
18
19
|
children?: React.ReactNode;
|
|
19
20
|
}
|
|
20
21
|
export type ThumbnailProps = Omit<ThumbnailCardProps, 'id' | 'name' | 'thumbnail' | 'onClickWrapper'> & {
|