@teambit/preview.ui.preview-placeholder 0.0.504 → 0.0.506

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,6 +1,17 @@
1
- import React from 'react';
1
+ import React, { ComponentType, ReactNode } from 'react';
2
+ import { Composition } from '@teambit/compositions';
2
3
  import { ComponentModel } from '@teambit/component';
3
- export declare function PreviewPlaceholder({ component, shouldShowPreview, }: {
4
- component: ComponentModel;
5
- shouldShowPreview: boolean;
4
+ import { ComponentDescriptor } from '@teambit/component-descriptor';
5
+ export declare function getCompositions(component: ComponentDescriptor): Composition[];
6
+ export declare function getDisplayName(component: ComponentDescriptor): string;
7
+ export declare function getDescription(component: ComponentDescriptor): any;
8
+ export declare function PreviewPlaceholder({ component, componentDescriptor, Container, shouldShowPreview, }: {
9
+ component?: ComponentModel;
10
+ componentDescriptor?: ComponentDescriptor;
11
+ Container?: ComponentType<{
12
+ component: any;
13
+ children: ReactNode;
14
+ className: string;
15
+ }>;
16
+ shouldShowPreview?: boolean;
6
17
  }): React.JSX.Element;
@@ -26,12 +26,59 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.PreviewPlaceholder = void 0;
29
+ exports.PreviewPlaceholder = exports.getDescription = exports.getDisplayName = exports.getCompositions = void 0;
30
30
  const react_1 = __importStar(require("react"));
31
- const compositions_1 = require("@teambit/compositions");
31
+ const compositions_1 = __importStar(require("@teambit/compositions"));
32
+ const design_ui_heading_1 = require("@teambit/design.ui.heading");
33
+ const toolbox_string_capitalize_1 = require("@teambit/toolbox.string.capitalize");
32
34
  const evangelist_elements_icon_1 = require("@teambit/evangelist.elements.icon");
35
+ const docs_1 = __importDefault(require("@teambit/docs"));
33
36
  const preview_placeholder_module_scss_1 = __importDefault(require("./preview-placeholder.module.scss"));
34
- function PreviewPlaceholder({ component, shouldShowPreview, }) {
37
+ function getCompositions(component) {
38
+ const entry = component.get(compositions_1.default.id);
39
+ if (!entry)
40
+ return [];
41
+ const compositions = entry.data.compositions;
42
+ if (!compositions)
43
+ return [];
44
+ return compositions_1.Composition.fromArray(compositions);
45
+ }
46
+ exports.getCompositions = getCompositions;
47
+ function getDisplayName(component) {
48
+ const tokens = component.id.name.split('-').map((token) => (0, toolbox_string_capitalize_1.capitalize)(token));
49
+ return tokens.join(' ');
50
+ }
51
+ exports.getDisplayName = getDisplayName;
52
+ function getDocsProperty(component, name) {
53
+ var _a, _b;
54
+ const docs = ((_a = component.get(docs_1.default.id)) === null || _a === void 0 ? void 0 : _a.data) || {};
55
+ if (!docs || !((_b = docs === null || docs === void 0 ? void 0 : docs.doc) === null || _b === void 0 ? void 0 : _b.props))
56
+ return undefined;
57
+ const docProps = docs.doc.props;
58
+ return docProps.find((prop) => prop.name === name);
59
+ }
60
+ function getDescription(component) {
61
+ const descriptionItem = getDocsProperty(component, 'description');
62
+ if (!descriptionItem)
63
+ return '';
64
+ return descriptionItem.value || '';
65
+ }
66
+ exports.getDescription = getDescription;
67
+ function PreviewPlaceholder({ component, componentDescriptor, Container = ({ children, className }) => react_1.default.createElement("div", { className: className }, children), shouldShowPreview = true, }) {
68
+ var _a;
69
+ if (!component || !componentDescriptor)
70
+ return null;
71
+ const compositions = component.compositions;
72
+ const description = getDescription(componentDescriptor);
73
+ const displayName = getDisplayName(componentDescriptor);
74
+ if (!compositions || !compositions.length || ((_a = component.buildStatus) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== 'succeed') {
75
+ return (react_1.default.createElement(Container, { className: preview_placeholder_module_scss_1.default.noPreview, component: component },
76
+ react_1.default.createElement("div", { className: preview_placeholder_module_scss_1.default.scope },
77
+ react_1.default.createElement(design_ui_heading_1.H5, { className: preview_placeholder_module_scss_1.default.scopeTitle }, component.id.scope)),
78
+ react_1.default.createElement("div", { className: preview_placeholder_module_scss_1.default.component },
79
+ react_1.default.createElement(design_ui_heading_1.H3, { className: preview_placeholder_module_scss_1.default.componentTitle }, displayName),
80
+ react_1.default.createElement("span", { className: preview_placeholder_module_scss_1.default.description }, description))));
81
+ }
35
82
  const selectedPreview = (0, react_1.useMemo)(() => {
36
83
  if (!shouldShowPreview)
37
84
  return undefined;
@@ -42,12 +89,15 @@ function PreviewPlaceholder({ component, shouldShowPreview, }) {
42
89
  return (react_1.default.createElement("div", { className: preview_placeholder_module_scss_1.default.previewPlaceholder, "data-tip": "", "data-for": name },
43
90
  react_1.default.createElement(evangelist_elements_icon_1.Icon, { of: "Ripple-processing" }),
44
91
  react_1.default.createElement("div", null, "Processing preview")));
45
- if (shouldShowPreview) {
46
- return react_1.default.createElement(compositions_1.ComponentComposition, { component: component, composition: selectedPreview, pubsub: false });
47
- }
48
- return (react_1.default.createElement("div", { className: preview_placeholder_module_scss_1.default.previewPlaceholder, "data-tip": "", "data-for": name },
49
- react_1.default.createElement(evangelist_elements_icon_1.Icon, { of: "img" }),
50
- react_1.default.createElement("div", null, "No preview available")));
92
+ return (react_1.default.createElement(react_1.default.Fragment, null,
93
+ react_1.default.createElement(compositions_1.ComponentComposition, { component: component, composition: selectedPreview, pubsub: false }),
94
+ react_1.default.createElement("div", { className: preview_placeholder_module_scss_1.default.previewOverlay })));
95
+ // return (
96
+ // <div className={styles.previewPlaceholder} data-tip="" data-for={name}>
97
+ // <Icon of="img" />
98
+ // <div>No preview available</div>
99
+ // </div>
100
+ // );
51
101
  }
52
102
  exports.PreviewPlaceholder = PreviewPlaceholder;
53
103
  const PREVIEW_COMPOSITION_SUFFIX = 'Preview';
@@ -1 +1 @@
1
- {"version":3,"file":"preview-placeholder.js","sourceRoot":"","sources":["../preview-placeholder.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAuC;AACvC,wDAA6D;AAC7D,gFAAyD;AAEzD,wGAAuD;AAEvD,SAAgB,kBAAkB,CAAC,EACjC,SAAS,EACT,iBAAiB,GAIlB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G,IAAA,eAAO,EAAC,GAAG,EAAE;QACnC,IAAI,CAAC,iBAAiB;YAAE,OAAO,SAAS,CAAC;QACzC,OAAO,wBAAwB,CAAC,SAAS,CAAC,CAAC;IAC7C,CAAC,EAAE,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAEnC,MAAM,IAAI,GAAG,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC;IACrC,IAAI,SAAS,CAAC,WAAW,KAAK,SAAS;QACrC,OAAO,CACL,uCAAK,SAAS,EAAE,yCAAM,CAAC,kBAAkB,cAAW,EAAE,cAAW,IAAI;YACnE,8BAAC,+BAAI,IAAC,EAAE,EAAC,mBAAmB,GAAG;YAC/B,gEAA6B,CACzB,CACP,CAAC;IAEJ,OAAO,CACL;QACE,8BAAC,mCAAoB,IAAC,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,EAAE,KAAK,GAAI;QAC3F,uCAAK,SAAS,EAAE,yCAAM,CAAC,cAAc,GAAI,CACxC,CACJ,CAAC;IAEF,WAAW;IACX,4EAA4E;IAC5E,wBAAwB;IACxB,sCAAsC;IACtC,WAAW;IACX,KAAK;AACP,CAAC;AA1DD,gDA0DC;AAED,MAAM,0BAA0B,GAAG,SAAS,CAAC;AAE7C,SAAS,wBAAwB,CAAC,SAAyB;IACzD,MAAM,EAAE,YAAY,EAAE,GAAG,SAAS,CAAC;IAEnC,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,0BAA0B,CAAC,CAAC,CAAC;AACrF,CAAC"}
@@ -19,3 +19,59 @@
19
19
  max-width: 155px;
20
20
  text-align: center;
21
21
  }
22
+
23
+ .previewIframe {
24
+ width: 100%;
25
+ height: 100%;
26
+ box-sizing: border-box;
27
+ border: none;
28
+ }
29
+
30
+ .preview {
31
+ overflow: hidden;
32
+ }
33
+
34
+ .description {
35
+ margin-top: 10px;
36
+ font-weight: 400;
37
+ font-size: 12px;
38
+ }
39
+
40
+ .noPreview {
41
+ background-color: var(--surface-color);
42
+ width: 100%;
43
+ padding: 16px;
44
+ display: flex;
45
+ flex-direction: column;
46
+ align-items: flex-start;
47
+ // justify-content: space-evenly;
48
+ margin: 0;
49
+ position: absolute;
50
+ height: 100%;
51
+ }
52
+
53
+ .component {
54
+ width: 90%;
55
+ }
56
+
57
+ .scopeTitle {
58
+ margin: 0;
59
+ padding-bottom: 25px;
60
+ font-weight: 400;
61
+ }
62
+
63
+ .componentTitle {
64
+ font-size: 28px !important;
65
+ margin: 0;
66
+ margin-bottom: 20px;
67
+ }
68
+
69
+ .previewOverlay {
70
+ position: absolute;
71
+ top: 0;
72
+ left: 0;
73
+ width: 100%;
74
+ height: 100%;
75
+ z-index: 100;
76
+ cursor: pointer;
77
+ }
package/package.json CHANGED
@@ -1,16 +1,19 @@
1
1
  {
2
2
  "name": "@teambit/preview.ui.preview-placeholder",
3
- "version": "0.0.504",
3
+ "version": "0.0.506",
4
4
  "homepage": "https://bit.cloud/teambit/preview/ui/preview-placeholder",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.preview",
8
8
  "name": "ui/preview-placeholder",
9
- "version": "0.0.504"
9
+ "version": "0.0.506"
10
10
  },
11
11
  "dependencies": {
12
12
  "core-js": "^3.0.0",
13
- "@teambit/evangelist.elements.icon": "1.0.2"
13
+ "@teambit/design.ui.heading": "1.0.16",
14
+ "@teambit/evangelist.elements.icon": "1.0.2",
15
+ "@teambit/component-descriptor": "0.0.411",
16
+ "@teambit/toolbox.string.capitalize": "0.0.495"
14
17
  },
15
18
  "devDependencies": {
16
19
  "@types/react": "^17.0.8",
@@ -26,6 +29,8 @@
26
29
  "react-dom": "^16.8.0 || ^17.0.0"
27
30
  },
28
31
  "license": "Apache-2.0",
32
+ "optionalDependencies": {},
33
+ "peerDependenciesMeta": {},
29
34
  "private": false,
30
35
  "engines": {
31
36
  "node": ">=12.22.0"
@@ -19,3 +19,59 @@
19
19
  max-width: 155px;
20
20
  text-align: center;
21
21
  }
22
+
23
+ .previewIframe {
24
+ width: 100%;
25
+ height: 100%;
26
+ box-sizing: border-box;
27
+ border: none;
28
+ }
29
+
30
+ .preview {
31
+ overflow: hidden;
32
+ }
33
+
34
+ .description {
35
+ margin-top: 10px;
36
+ font-weight: 400;
37
+ font-size: 12px;
38
+ }
39
+
40
+ .noPreview {
41
+ background-color: var(--surface-color);
42
+ width: 100%;
43
+ padding: 16px;
44
+ display: flex;
45
+ flex-direction: column;
46
+ align-items: flex-start;
47
+ // justify-content: space-evenly;
48
+ margin: 0;
49
+ position: absolute;
50
+ height: 100%;
51
+ }
52
+
53
+ .component {
54
+ width: 90%;
55
+ }
56
+
57
+ .scopeTitle {
58
+ margin: 0;
59
+ padding-bottom: 25px;
60
+ font-weight: 400;
61
+ }
62
+
63
+ .componentTitle {
64
+ font-size: 28px !important;
65
+ margin: 0;
66
+ margin-bottom: 20px;
67
+ }
68
+
69
+ .previewOverlay {
70
+ position: absolute;
71
+ top: 0;
72
+ left: 0;
73
+ width: 100%;
74
+ height: 100%;
75
+ z-index: 100;
76
+ cursor: pointer;
77
+ }
@@ -1,16 +1,71 @@
1
- import React, { useMemo } from 'react';
2
- import { ComponentComposition } from '@teambit/compositions';
1
+ import React, { useMemo, ComponentType, ReactNode } from 'react';
2
+ import CompositionsAspect, { ComponentComposition, Composition } from '@teambit/compositions';
3
+ import { H3, H5 } from '@teambit/design.ui.heading';
4
+ import { capitalize } from '@teambit/toolbox.string.capitalize';
3
5
  import { Icon } from '@teambit/evangelist.elements.icon';
4
6
  import { ComponentModel } from '@teambit/component';
7
+ import { ComponentDescriptor } from '@teambit/component-descriptor';
8
+ import DocsAspect from '@teambit/docs';
5
9
  import styles from './preview-placeholder.module.scss';
6
10
 
11
+ export function getCompositions(component: ComponentDescriptor) {
12
+ const entry: any = component.get(CompositionsAspect.id);
13
+ if (!entry) return [];
14
+ const compositions = entry.data.compositions;
15
+ if (!compositions) return [];
16
+
17
+ return Composition.fromArray(compositions);
18
+ }
19
+
20
+ export function getDisplayName(component: ComponentDescriptor) {
21
+ const tokens = component.id.name.split('-').map((token) => capitalize(token));
22
+ return tokens.join(' ');
23
+ }
24
+
25
+ function getDocsProperty(component: ComponentDescriptor, name: string) {
26
+ const docs = component.get<any>(DocsAspect.id)?.data || {};
27
+ if (!docs || !docs?.doc?.props) return undefined;
28
+ const docProps = docs.doc.props;
29
+ return docProps.find((prop) => prop.name === name);
30
+ }
31
+
32
+ export function getDescription(component: ComponentDescriptor) {
33
+ const descriptionItem = getDocsProperty(component, 'description');
34
+ if (!descriptionItem) return '';
35
+ return descriptionItem.value || '';
36
+ }
37
+
7
38
  export function PreviewPlaceholder({
8
39
  component,
9
- shouldShowPreview,
40
+ componentDescriptor,
41
+ Container = ({ children, className }) => <div className={className}>{children}</div>,
42
+ shouldShowPreview = true,
10
43
  }: {
11
- component: ComponentModel;
12
- shouldShowPreview: boolean;
44
+ component?: ComponentModel;
45
+ componentDescriptor?: ComponentDescriptor;
46
+ Container?: ComponentType<{ component: any; children: ReactNode; className: string }>;
47
+ shouldShowPreview?: boolean;
13
48
  }) {
49
+ if (!component || !componentDescriptor) return null;
50
+
51
+ const compositions = component.compositions;
52
+ const description = getDescription(componentDescriptor);
53
+ const displayName = getDisplayName(componentDescriptor);
54
+
55
+ if (!compositions || !compositions.length || component.buildStatus?.toLowerCase() !== 'succeed') {
56
+ return (
57
+ <Container className={styles.noPreview} component={component}>
58
+ <div className={styles.scope}>
59
+ <H5 className={styles.scopeTitle}>{component.id.scope}</H5>
60
+ </div>
61
+ <div className={styles.component}>
62
+ <H3 className={styles.componentTitle}>{displayName}</H3>
63
+ <span className={styles.description}>{description}</span>
64
+ </div>
65
+ </Container>
66
+ );
67
+ }
68
+
14
69
  const selectedPreview = useMemo(() => {
15
70
  if (!shouldShowPreview) return undefined;
16
71
  return selectDefaultComposition(component);
@@ -25,16 +80,19 @@ export function PreviewPlaceholder({
25
80
  </div>
26
81
  );
27
82
 
28
- if (shouldShowPreview) {
29
- return <ComponentComposition component={component} composition={selectedPreview} pubsub={false} />;
30
- }
31
-
32
83
  return (
33
- <div className={styles.previewPlaceholder} data-tip="" data-for={name}>
34
- <Icon of="img" />
35
- <div>No preview available</div>
36
- </div>
84
+ <>
85
+ <ComponentComposition component={component} composition={selectedPreview} pubsub={false} />
86
+ <div className={styles.previewOverlay} />
87
+ </>
37
88
  );
89
+
90
+ // return (
91
+ // <div className={styles.previewPlaceholder} data-tip="" data-for={name}>
92
+ // <Icon of="img" />
93
+ // <div>No preview available</div>
94
+ // </div>
95
+ // );
38
96
  }
39
97
 
40
98
  const PREVIEW_COMPOSITION_SUFFIX = 'Preview';