@antscorp/antsomi-ui 1.3.5-beta.77 → 1.3.5-beta.79

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,4 @@
1
+ import React from 'react';
2
+ export interface MobileFrameV2Props extends React.HtmlHTMLAttributes<HTMLDivElement> {
3
+ }
4
+ export declare const MobileFrameV2: React.FC<React.PropsWithChildren<MobileFrameV2Props>>;
@@ -0,0 +1,21 @@
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 from 'react';
14
+ // Styled
15
+ import { MobileWrapper, MobileInner, MobileCamera } from './styled';
16
+ export const MobileFrameV2 = (_a) => {
17
+ var { children } = _a, restOfProps = __rest(_a, ["children"]);
18
+ return (React.createElement(MobileWrapper, Object.assign({}, restOfProps),
19
+ React.createElement(MobileInner, null, children),
20
+ React.createElement(MobileCamera, null)));
21
+ };
@@ -0,0 +1,4 @@
1
+ export declare const MOBILE_VIEWPORT: {
2
+ width: number;
3
+ height: number;
4
+ };
@@ -0,0 +1,4 @@
1
+ export const MOBILE_VIEWPORT = {
2
+ width: 352.5,
3
+ height: 764.2,
4
+ };
@@ -0,0 +1,2 @@
1
+ export { MobileFrameV2 } from './MobileFrameV2';
2
+ export type { MobileFrameV2Props } from './MobileFrameV2';
@@ -0,0 +1 @@
1
+ export { MobileFrameV2 } from './MobileFrameV2';
@@ -0,0 +1,3 @@
1
+ export declare const MobileWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
2
+ export declare const MobileInner: import("styled-components").StyledComponent<"div", any, {}, never>;
3
+ export declare const MobileCamera: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -0,0 +1,35 @@
1
+ // Libraries
2
+ import styled from 'styled-components/macro';
3
+ // Assets
4
+ import MobileFrameV2 from '@antscorp/antsomi-ui/es/assets/images/ip14-pro-mobile-frame.png';
5
+ import cameraImage from '@antscorp/antsomi-ui/es/assets/images/ip14-pro-camera.png';
6
+ // Constants
7
+ import { MOBILE_VIEWPORT } from './constants';
8
+ export const MobileWrapper = styled.div `
9
+ position: relative;
10
+ display: flex;
11
+ justify-content: center;
12
+ background: url(${MobileFrameV2}) no-repeat center center;
13
+ background-size: contain;
14
+ `;
15
+ export const MobileInner = styled.div `
16
+ position: relative;
17
+ width: ${MOBILE_VIEWPORT.width}px;
18
+ max-width: ${MOBILE_VIEWPORT.width}px;
19
+ height: ${MOBILE_VIEWPORT.height}px;
20
+ margin: 18px 21px;
21
+ border-radius: 50px;
22
+ overflow: hidden;
23
+ `;
24
+ export const MobileCamera = styled.div `
25
+ position: absolute;
26
+ width: 112.11px;
27
+ height: 32.29px;
28
+ margin: auto;
29
+ top: 30px;
30
+ left: 50%;
31
+ transform: translateX(-50%);
32
+ z-index: 10;
33
+ background: url(${cameraImage}) no-repeat center center;
34
+ background-size: contain;
35
+ `;
@@ -36,6 +36,7 @@ export * from './Flex';
36
36
  export * from './RateV2';
37
37
  export * from './PreviewTabs';
38
38
  export * from './MobileFrame';
39
+ export * from './MobileFrameV2';
39
40
  export * from './SlideBar';
40
41
  export type { SliderProps } from './Slider';
41
42
  export type { PaginationProps } from './Pagination';
@@ -36,4 +36,5 @@ export * from './Flex';
36
36
  export * from './RateV2';
37
37
  export * from './PreviewTabs';
38
38
  export * from './MobileFrame';
39
+ export * from './MobileFrameV2';
39
40
  export * from './SlideBar';
@@ -1,2 +1,5 @@
1
- import React from 'react';
2
- export declare const GeneralAccess: () => React.JSX.Element | null;
1
+ import { FC } from 'react';
2
+ import { ShareAccessProps } from '../../types';
3
+ type GeneralAccessProps = Pick<ShareAccessProps, 'generalAccessSettings'>;
4
+ export declare const GeneralAccess: FC<GeneralAccessProps>;
5
+ export {};
@@ -6,12 +6,13 @@ import { updateObjAccessInfo } from '../../actions';
6
6
  import { GENERAL_ACCESS, PUBLIC_ROLE, ROLE_ACCESS_LABEL } from '../../constants';
7
7
  import { useShareAccess } from '../../hooks';
8
8
  import { StyledGeneralAccessRoot } from './styled';
9
- export const GeneralAccess = () => {
9
+ export const GeneralAccess = ({ generalAccessSettings }) => {
10
10
  const { state, dispatch } = useShareAccess();
11
11
  const { accessInfo, allowEdit } = state;
12
12
  if (!accessInfo)
13
13
  return null;
14
14
  const { isPublic, publicRole } = accessInfo;
15
+ const isShowOnlyText = !!(generalAccessSettings === null || generalAccessSettings === void 0 ? void 0 : generalAccessSettings.publicOnlyWith);
15
16
  const handleChangeGeneralAccess = (value) => {
16
17
  if (!accessInfo || !dispatch || !allowEdit)
17
18
  return;
@@ -58,7 +59,7 @@ export const GeneralAccess = () => {
58
59
  React.createElement("div", { className: "accessable-title" }, isPublic ? 'Public' : 'Restricted'),
59
60
  allowEdit && React.createElement(Icon, { className: "icon-angle", type: "icon-ants-angle-down" }))),
60
61
  React.createElement("div", { className: "description" }, renderDescription())),
61
- !!isPublic && publicRole && (React.createElement(Dropdown, { placement: "bottomLeft", trigger: ['click'], destroyPopupOnHide: true, disabled: !allowEdit, overlayStyle: { zIndex: 3002 }, menu: {
62
+ !!isPublic && publicRole && (React.createElement(Dropdown, { placement: "bottomLeft", trigger: ['click'], destroyPopupOnHide: true, disabled: !allowEdit || isShowOnlyText, overlayStyle: { zIndex: 3002 }, menu: {
62
63
  items: [
63
64
  publicRole === PUBLIC_ROLE.ONLY_VIEWER
64
65
  ? {
@@ -74,5 +75,5 @@ export const GeneralAccess = () => {
74
75
  } },
75
76
  React.createElement("div", { className: "public-role-dropdown-wrapper" },
76
77
  React.createElement("div", { className: "for-title" }, ROLE_ACCESS_LABEL[publicRole]),
77
- allowEdit && React.createElement(Icon, { className: "icon-angle", type: "icon-ants-angle-down" })))))));
78
+ allowEdit && !isShowOnlyText && (React.createElement(Icon, { className: "icon-angle", type: "icon-ants-angle-down" }))))))));
78
79
  };
@@ -6,7 +6,7 @@ import { PeopleAccess } from '../PeopleAccess';
6
6
  import { SearchUser } from '../SearchUser';
7
7
  import { StyledLayoutContentRoot } from './styled';
8
8
  export const LayoutContent = (props) => {
9
- const { getUserInfo, excludeUserAccess, allowAddUser = true } = props;
9
+ const { getUserInfo, generalAccessSettings, excludeUserAccess, allowAddUser = true } = props;
10
10
  const { state } = useShareAccess();
11
11
  const { allowEdit, allowView } = state;
12
12
  if (!allowEdit && !allowView)
@@ -14,6 +14,6 @@ export const LayoutContent = (props) => {
14
14
  return (React.createElement(StyledLayoutContentRoot, null,
15
15
  allowAddUser && React.createElement(SearchUser, { getUserInfo: getUserInfo }),
16
16
  React.createElement(PeopleAccess, { excludeUserAccess: excludeUserAccess }),
17
- React.createElement(GeneralAccess, null),
17
+ React.createElement(GeneralAccess, { generalAccessSettings: generalAccessSettings }),
18
18
  React.createElement(ModalTransferOwnership, null)));
19
19
  };
@@ -29,6 +29,9 @@ export type ObjectAccessInfo = {
29
29
  listAccess: UserAccessInfo[];
30
30
  };
31
31
  export type ExcludeUserAccess = Array<(typeof PEOPLE_ACTION_KEYS)[keyof typeof PEOPLE_ACTION_KEYS]>;
32
+ export type GeneralAccessSettings = {
33
+ publicOnlyWith?: boolean;
34
+ };
32
35
  export type ShareAccessProps = {
33
36
  userId?: number;
34
37
  userPermission?: {
@@ -39,6 +42,7 @@ export type ShareAccessProps = {
39
42
  allowAddUser?: boolean;
40
43
  excludeUserAccess?: ExcludeUserAccess;
41
44
  getUserInfo?(search: string, signal: AbortSignal): Promise<UserInfo[]> | UserInfo[];
45
+ generalAccessSettings?: GeneralAccessSettings;
42
46
  onChange?: (accessInfo: ObjectAccessInfo) => void;
43
47
  };
44
48
  export type ShareAccessState = {
@@ -1,13 +1,18 @@
1
1
  // Libraries
2
- import React, { memo } from 'react';
2
+ import React, { memo, useMemo } from 'react';
3
3
  // Styled
4
4
  import { BannerWrapper } from './styled';
5
+ // Components
6
+ import { MobileFrameV2 } from '@antscorp/antsomi-ui/es/components/atoms';
7
+ // Constants
8
+ import { DEVICE_TYPE } from '../../constants';
5
9
  export const Banner = memo(props => {
6
- const { deviceType, showBackgroundSkeleton = false, children } = props;
7
- return (React.createElement(BannerWrapper, { deviceType: deviceType, showBackgroundSkeleton: showBackgroundSkeleton },
8
- React.createElement("div", { className: "device-type" },
9
- React.createElement("div", { className: "device-type__background" }),
10
- React.createElement("div", { className: "device-type__wrapper" },
11
- React.createElement("div", { className: "content-wrapper" }, children || null),
12
- React.createElement("div", { className: "backdrop" })))));
10
+ const { deviceType, showSkeleton = false, children } = props;
11
+ const isMobile = useMemo(() => deviceType === DEVICE_TYPE.MOBILE.value, [deviceType]);
12
+ return (React.createElement(BannerWrapper, null,
13
+ React.createElement("div", { className: `${isMobile ? 'mobile-wrapper' : 'desktop-wrapper'}` },
14
+ React.createElement("div", { className: "content-wrapper" }, isMobile ? React.createElement(MobileFrameV2, null, children || null) : children || null),
15
+ showSkeleton && (React.createElement(React.Fragment, null,
16
+ React.createElement("div", { className: "skeleton" }),
17
+ React.createElement("div", { className: "backdrop" }))))));
13
18
  });
@@ -1,4 +1 @@
1
- export declare const BannerWrapper: import("styled-components").StyledComponent<"div", any, {
2
- deviceType: string;
3
- showBackgroundSkeleton: boolean;
4
- }, never>;
1
+ export declare const BannerWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -1,98 +1,69 @@
1
- import styled from 'styled-components';
1
+ import styled from 'styled-components/macro';
2
2
  // Images
3
3
  import skeletonBackground from '../../../../../assets/images/background/skeleton-background.png';
4
- import MobileFrame from '../../../../../assets/svg/mobile-frame.svg';
5
- // Constants
6
- import { DEVICE_TYPE } from '../../constants';
7
4
  const THUMBNAIL_CARD_RADIUS = 5;
8
- const { MOBILE } = DEVICE_TYPE;
9
- const MOBILE_BORDER_RADIUS = '19px 19px 19px 21px / 21px 21px 21px 21px';
10
5
  export const BannerWrapper = styled.div `
11
6
  width: 100%;
12
- height: 762px;
13
- max-height: 762px;
7
+ height: 830px;
8
+ max-height: 830px;
14
9
  overflow-y: hidden;
15
10
  display: flex;
16
11
  justify-content: center;
17
12
  align-items: center;
18
13
  background-color: #0000001a;
19
14
 
20
- .device-type {
15
+ .mobile-wrapper {
21
16
  position: relative;
22
- height: 750px;
23
- border-radius: ${THUMBNAIL_CARD_RADIUS}px;
24
- width: 100%;
17
+ width: 380px;
18
+ height: 800px;
19
+ border-radius: 80px;
25
20
 
26
- .device-type__wrapper,
27
- .device-type__background {
28
- width: 100%;
29
- height: 100%;
30
- position: absolute;
21
+ .content-wrapper {
22
+ width: fit-content;
23
+ height: fit-content;
31
24
  }
32
25
 
33
- ${p => {
34
- switch (p.deviceType) {
35
- case MOBILE.value:
36
- return `
37
- width: 416.004px;
38
- height: 713px;
39
- display: flex;
40
- justify-content: center;
41
- align-items: center;
42
-
43
- .device-type__background {
44
- background: url(${MobileFrame}) no-repeat center center;
45
- }
46
-
47
- .device-type__wrapper {
48
- width: 391px;
49
- left: 11px;
50
- height: 661px;
51
- top: 11px;
52
- z-index: 1;
53
- border-radius: ${MOBILE_BORDER_RADIUS};
54
-
55
- .content-wrapper {
56
- border-radius: inherit;
57
-
58
- & > * {
59
- border-radius: inherit;
60
- }
61
- }
62
- }
63
- `;
64
- default:
65
- return p.showBackgroundSkeleton
66
- ? `
67
- .device-type__background {
68
- background: center / cover no-repeat url(${skeletonBackground});
69
- }
70
-
71
- .device-type__wrapper {
72
- .backdrop {
73
- border-radius: ${THUMBNAIL_CARD_RADIUS}px;
74
- position: absolute;
75
- width: 100%;
76
- height: 100%;
77
- background-color: black;
78
- opacity: 0.5;
79
- z-index: 10;
80
- top: 0;
81
- left: 0;
82
- }
83
- }
84
- `
85
- : '';
26
+ .skeleton,
27
+ .backdrop {
28
+ left: 5px;
86
29
  }
87
- }}
30
+ }
31
+
32
+ .desktop-wrapper {
33
+ position: relative;
34
+ height: 100%;
35
+ width: 100%;
36
+ border-radius: ${THUMBNAIL_CARD_RADIUS}px;
88
37
 
89
38
  .content-wrapper {
90
- position: absolute;
91
- top: 0;
92
- left: 0;
93
- z-index: 12;
94
39
  width: 100%;
95
40
  height: 100%;
96
41
  }
97
42
  }
43
+
44
+ .content-wrapper {
45
+ position: absolute;
46
+ top: 0;
47
+ left: 0;
48
+ z-index: 12;
49
+ }
50
+
51
+ .skeleton {
52
+ width: 100%;
53
+ height: 100%;
54
+ background: center / cover no-repeat url(${skeletonBackground});
55
+ border-radius: inherit;
56
+ }
57
+
58
+ .backdrop {
59
+ border-radius: inherit;
60
+ position: absolute;
61
+ width: 100%;
62
+ height: 100%;
63
+ background-color: black;
64
+ opacity: 0.5;
65
+ z-index: 10;
66
+ top: 0;
67
+ left: 0;
68
+ }
98
69
  `;
@@ -14,7 +14,7 @@ export interface PreviewTemplateModalProps extends ModalProps {
14
14
  }
15
15
  export interface BannerProps {
16
16
  deviceType: InformationProps['deviceType'];
17
- showBackgroundSkeleton?: boolean;
17
+ showSkeleton?: boolean;
18
18
  children?: React.ReactNode;
19
19
  }
20
20
  export type ThumbnailProps = Omit<ThumbnailCardProps, keyof TTemplateItem | 'onClickWrapper'> & {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.5-beta.77",
3
+ "version": "1.3.5-beta.79",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",