@dxos/plugin-preview 0.8.2-main.36232bc → 0.8.2-main.5885341
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/dist/lib/browser/index.mjs +46 -24
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +49 -25
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +46 -24
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/Preview.stories.d.ts +14 -8
- package/dist/types/src/Preview.stories.d.ts.map +1 -1
- package/dist/types/src/PreviewPlugin.d.ts.map +1 -1
- package/dist/types/src/components/ContactCard.d.ts +1 -1
- package/dist/types/src/components/ContactCard.d.ts.map +1 -1
- package/dist/types/src/components/OrganizationCard.d.ts +1 -1
- package/dist/types/src/components/OrganizationCard.d.ts.map +1 -1
- package/dist/types/src/components/ProjectCard.d.ts +1 -1
- package/dist/types/src/components/ProjectCard.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +4 -1
- package/dist/types/src/types.d.ts.map +1 -1
- package/package.json +19 -19
- package/src/Preview.stories.tsx +6 -0
- package/src/PreviewPlugin.tsx +21 -13
- package/src/components/ContactCard.tsx +3 -2
- package/src/components/OrganizationCard.tsx +4 -3
- package/src/components/ProjectCard.tsx +3 -3
- package/src/types.ts +4 -1
|
@@ -13,7 +13,7 @@ declare const meta: Meta<StoryProps>;
|
|
|
13
13
|
export default meta;
|
|
14
14
|
export declare const ContactWithImage: {
|
|
15
15
|
args: {
|
|
16
|
-
Component: ({ children, classNames, subject: { fullName, image, organization, emails }, onOrgClick, }: import("./types").PreviewProps<Contact> & {
|
|
16
|
+
Component: ({ children, classNames, role, subject: { fullName, image, organization, emails }, onOrgClick, }: import("./types").PreviewProps<Contact> & {
|
|
17
17
|
onOrgClick?: (org: Organization) => void;
|
|
18
18
|
}) => React.JSX.Element;
|
|
19
19
|
icon: string;
|
|
@@ -27,7 +27,7 @@ export declare const ContactWithImage: {
|
|
|
27
27
|
readonly id: string;
|
|
28
28
|
description?: string | undefined;
|
|
29
29
|
name?: string | undefined;
|
|
30
|
-
status?: "
|
|
30
|
+
status?: "prospect" | "qualified" | "active" | "commit" | "reject" | undefined;
|
|
31
31
|
image?: string | undefined;
|
|
32
32
|
website?: string | undefined;
|
|
33
33
|
}> | undefined;
|
|
@@ -135,45 +135,49 @@ export declare const ContactWithImage: {
|
|
|
135
135
|
} & {
|
|
136
136
|
id: string;
|
|
137
137
|
};
|
|
138
|
+
role: string;
|
|
138
139
|
};
|
|
139
140
|
};
|
|
140
141
|
export declare const ContactNoImage: {
|
|
141
142
|
args: {
|
|
142
|
-
Component: ({ children, classNames, subject: { fullName, image, organization, emails }, onOrgClick, }: import("./types").PreviewProps<Contact> & {
|
|
143
|
+
Component: ({ children, classNames, role, subject: { fullName, image, organization, emails }, onOrgClick, }: import("./types").PreviewProps<Contact> & {
|
|
143
144
|
onOrgClick?: (org: Organization) => void;
|
|
144
145
|
}) => React.JSX.Element;
|
|
145
146
|
icon: string;
|
|
146
147
|
subject: any;
|
|
148
|
+
role: string;
|
|
147
149
|
};
|
|
148
150
|
};
|
|
149
151
|
export declare const OrganizationWithImage: {
|
|
150
152
|
args: {
|
|
151
|
-
Component: ({ children, classNames, subject: { name, image, description, website }, }: import("./types").PreviewProps<Organization>) => React.JSX.Element;
|
|
153
|
+
Component: ({ children, classNames, subject: { name, image, description, website }, role, }: import("./types").PreviewProps<Organization>) => React.JSX.Element;
|
|
152
154
|
icon: string;
|
|
153
155
|
subject: Omit<{
|
|
154
156
|
readonly id: string;
|
|
155
157
|
image?: string | undefined;
|
|
156
158
|
name?: string | undefined;
|
|
157
159
|
description?: string | undefined;
|
|
158
|
-
status?: "
|
|
160
|
+
status?: "prospect" | "qualified" | "active" | "commit" | "reject" | undefined;
|
|
159
161
|
website?: string | undefined;
|
|
160
162
|
}, "id"> & {
|
|
161
163
|
id?: string;
|
|
162
164
|
} & {
|
|
163
165
|
id: string;
|
|
164
166
|
};
|
|
167
|
+
role: string;
|
|
165
168
|
};
|
|
166
169
|
};
|
|
167
170
|
export declare const OrganizationNoImage: {
|
|
168
171
|
args: {
|
|
169
|
-
Component: ({ children, classNames, subject: { name, image, description, website }, }: import("./types").PreviewProps<Organization>) => React.JSX.Element;
|
|
172
|
+
Component: ({ children, classNames, subject: { name, image, description, website }, role, }: import("./types").PreviewProps<Organization>) => React.JSX.Element;
|
|
170
173
|
icon: string;
|
|
171
174
|
subject: any;
|
|
175
|
+
role: string;
|
|
172
176
|
};
|
|
173
177
|
};
|
|
174
178
|
export declare const ProjectWithImage: {
|
|
175
179
|
args: {
|
|
176
|
-
Component: ({ classNames, subject: { name, image, description } }: import("./types").PreviewProps<Project>) => React.JSX.Element;
|
|
180
|
+
Component: ({ classNames, role, subject: { name, image, description } }: import("./types").PreviewProps<Project>) => React.JSX.Element;
|
|
177
181
|
icon: string;
|
|
178
182
|
subject: Omit<{
|
|
179
183
|
readonly id: string;
|
|
@@ -185,13 +189,15 @@ export declare const ProjectWithImage: {
|
|
|
185
189
|
} & {
|
|
186
190
|
id: string;
|
|
187
191
|
};
|
|
192
|
+
role: string;
|
|
188
193
|
};
|
|
189
194
|
};
|
|
190
195
|
export declare const ProjectNoImage: {
|
|
191
196
|
args: {
|
|
192
|
-
Component: ({ classNames, subject: { name, image, description } }: import("./types").PreviewProps<Project>) => React.JSX.Element;
|
|
197
|
+
Component: ({ classNames, role, subject: { name, image, description } }: import("./types").PreviewProps<Project>) => React.JSX.Element;
|
|
193
198
|
icon: string;
|
|
194
199
|
subject: any;
|
|
200
|
+
role: string;
|
|
195
201
|
};
|
|
196
202
|
};
|
|
197
203
|
//# sourceMappingURL=Preview.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Preview.stories.d.ts","sourceRoot":"","sources":["../../../src/Preview.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAMvC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAQ9D,KAAK,UAAU,GAAG;IAChB,SAAS,EAAE,EAAE,CAAC;QAAE,OAAO,EAAE,GAAG,CAAA;KAAE,CAAC,CAAC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,GAAG,CAAC;CACd,CAAC;AAEF,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,UAAU,CAoB1B,CAAC;AAEF,eAAe,IAAI,CAAC;AA2CpB,eAAO,MAAM,gBAAgB;;;
|
|
1
|
+
{"version":3,"file":"Preview.stories.d.ts","sourceRoot":"","sources":["../../../src/Preview.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAMvC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAQ9D,KAAK,UAAU,GAAG;IAChB,SAAS,EAAE,EAAE,CAAC;QAAE,OAAO,EAAE,GAAG,CAAA;KAAE,CAAC,CAAC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,GAAG,CAAC;CACd,CAAC;AAEF,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,UAAU,CAoB1B,CAAC;AAEF,eAAe,IAAI,CAAC;AA2CpB,eAAO,MAAM,gBAAgB;;;sBA3E7B,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4DAgI6v+M,KAAM,qBAAqB;+BAxF3p+M,KAAM,eAAe,YAAW,KAAM,qBACjK;;;;4DAuF62/M,KAAM,qBAAqB;+BAnE92/M,KAAM,eAEjC,YAGC,KAAE,qBAAqB;;;;4DA8Dy8gN,KAAM,qBAAqB;+BAhCv/gN,KAAM,eAAe,YAAW,KAClC,qBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAftB,CAAC;AAEF,eAAO,MAAM,cAAc;;;sBApF3B,CAAA;;;;;;CA2FC,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;CAOjC,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;;;;CAO/B,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;CAO5B,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;CAO1B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PreviewPlugin.d.ts","sourceRoot":"","sources":["../../../src/PreviewPlugin.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PreviewPlugin.d.ts","sourceRoot":"","sources":["../../../src/PreviewPlugin.tsx"],"names":[],"mappings":"AA+DA,eAAO,MAAM,aAAa,4CAqJtB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type Contact, type Organization } from '@dxos/schema';
|
|
3
3
|
import { type PreviewProps } from '../types';
|
|
4
|
-
export declare const ContactCard: ({ children, classNames, subject: { fullName, image, organization, emails }, onOrgClick, }: PreviewProps<Contact> & {
|
|
4
|
+
export declare const ContactCard: ({ children, classNames, role, subject: { fullName, image, organization, emails }, onOrgClick, }: PreviewProps<Contact> & {
|
|
5
5
|
onOrgClick?: (org: Organization) => void;
|
|
6
6
|
}) => React.JSX.Element;
|
|
7
7
|
//# sourceMappingURL=ContactCard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContactCard.d.ts","sourceRoot":"","sources":["../../../../src/components/ContactCard.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAIxC,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAE/D,OAAO,EAAE,KAAK,YAAY,
|
|
1
|
+
{"version":3,"file":"ContactCard.d.ts","sourceRoot":"","sources":["../../../../src/components/ContactCard.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAIxC,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAE/D,OAAO,EAAE,KAAK,YAAY,EAAuE,MAAM,UAAU,CAAC;AAElH,eAAO,MAAM,WAAW,oGAMrB,YAAY,CAAC,OAAO,CAAC,GAAG;IAAE,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,YAAY,KAAK,IAAI,CAAA;CAAE,sBAmDtE,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type Organization } from '@dxos/schema';
|
|
3
3
|
import { type PreviewProps } from '../types';
|
|
4
|
-
export declare const OrganizationCard: ({ children, classNames, subject: { name, image, description, website }, }: PreviewProps<Organization>) => React.JSX.Element;
|
|
4
|
+
export declare const OrganizationCard: ({ children, classNames, subject: { name, image, description, website }, role, }: PreviewProps<Organization>) => React.JSX.Element;
|
|
5
5
|
//# sourceMappingURL=OrganizationCard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrganizationCard.d.ts","sourceRoot":"","sources":["../../../../src/components/OrganizationCard.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,KAAK,YAAY,
|
|
1
|
+
{"version":3,"file":"OrganizationCard.d.ts","sourceRoot":"","sources":["../../../../src/components/OrganizationCard.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,KAAK,YAAY,EAAuE,MAAM,UAAU,CAAC;AAElH,eAAO,MAAM,gBAAgB,oFAK1B,YAAY,CAAC,YAAY,CAAC,sBAwB5B,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type Project } from '@dxos/schema';
|
|
3
3
|
import { type PreviewProps } from '../types';
|
|
4
|
-
export declare const ProjectCard: ({ classNames, subject: { name, image, description } }: PreviewProps<Project>) => React.JSX.Element;
|
|
4
|
+
export declare const ProjectCard: ({ classNames, role, subject: { name, image, description } }: PreviewProps<Project>) => React.JSX.Element;
|
|
5
5
|
//# sourceMappingURL=ProjectCard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProjectCard.d.ts","sourceRoot":"","sources":["../../../../src/components/ProjectCard.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,KAAK,YAAY,
|
|
1
|
+
{"version":3,"file":"ProjectCard.d.ts","sourceRoot":"","sources":["../../../../src/components/ProjectCard.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,KAAK,YAAY,EAA0C,MAAM,UAAU,CAAC;AAErF,eAAO,MAAM,WAAW,gEAAiE,YAAY,CAAC,OAAO,CAAC,sBAQ7G,CAAC"}
|
|
@@ -2,6 +2,7 @@ import { type PropsWithChildren } from 'react';
|
|
|
2
2
|
import { type ThemedClassName } from '@dxos/react-ui';
|
|
3
3
|
export type PreviewProps<T extends object> = PropsWithChildren<ThemedClassName<{
|
|
4
4
|
subject: T;
|
|
5
|
+
role: string;
|
|
5
6
|
}>>;
|
|
6
7
|
/**
|
|
7
8
|
* <Card.Root>
|
|
@@ -15,7 +16,9 @@ export type PreviewProps<T extends object> = PropsWithChildren<ThemedClassName<{
|
|
|
15
16
|
* </Card.Body>
|
|
16
17
|
* </Card.Root>
|
|
17
18
|
*/
|
|
18
|
-
export declare const
|
|
19
|
+
export declare const popoverCard = "popover-consistent-width rounded-lg overflow-hidden";
|
|
20
|
+
export declare const defaultCard = "";
|
|
21
|
+
export declare const kanbanCardWithoutPoster = "pbs-[--rail-action]";
|
|
19
22
|
export declare const previewTitle = "text-lg font-medium line-clamp-2";
|
|
20
23
|
export declare const previewProse = "pli-3 mlb-3";
|
|
21
24
|
export declare const previewChrome = "pli-1.5 mlb-1.5 [&_.dx-button]:pli-1.5 [&_.dx-button]:text-start [&_.dx-button]:is-full";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/C,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGtD,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,MAAM,IAAI,iBAAiB,CAC5D,eAAe,CAAC;IACd,OAAO,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/C,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGtD,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,MAAM,IAAI,iBAAiB,CAC5D,eAAe,CAAC;IACd,OAAO,EAAE,CAAC,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd,CAAC,CACH,CAAC;AAQF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,WAAW,wDAAwD,CAAC;AACjF,eAAO,MAAM,WAAW,KAAK,CAAC;AAC9B,eAAO,MAAM,uBAAuB,wBAAwB,CAAC;AAC7D,eAAO,MAAM,YAAY,qCAAqC,CAAC;AAC/D,eAAO,MAAM,YAAY,gBAAgB,CAAC;AAC1C,eAAO,MAAM,aAAa,4FAA4F,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-preview",
|
|
3
|
-
"version": "0.8.2-main.
|
|
3
|
+
"version": "0.8.2-main.5885341",
|
|
4
4
|
"description": "Preview plugin",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -23,29 +23,29 @@
|
|
|
23
23
|
"src"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@dxos/app-framework": "0.8.2-main.
|
|
27
|
-
"@dxos/
|
|
28
|
-
"@dxos/client": "0.8.2-main.
|
|
29
|
-
"@dxos/echo-schema": "0.8.2-main.
|
|
30
|
-
"@dxos/
|
|
31
|
-
"@dxos/
|
|
32
|
-
"@dxos/
|
|
33
|
-
"@dxos/
|
|
34
|
-
"@dxos/react-
|
|
35
|
-
"@dxos/react-
|
|
36
|
-
"@dxos/react-ui-
|
|
37
|
-
"@dxos/react-ui-editor": "0.8.2-main.
|
|
38
|
-
"@dxos/react-ui-theme": "0.8.2-main.
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/react-ui-
|
|
41
|
-
"@dxos/
|
|
26
|
+
"@dxos/app-framework": "0.8.2-main.5885341",
|
|
27
|
+
"@dxos/keys": "0.8.2-main.5885341",
|
|
28
|
+
"@dxos/client": "0.8.2-main.5885341",
|
|
29
|
+
"@dxos/echo-schema": "0.8.2-main.5885341",
|
|
30
|
+
"@dxos/async": "0.8.2-main.5885341",
|
|
31
|
+
"@dxos/log": "0.8.2-main.5885341",
|
|
32
|
+
"@dxos/lit-ui": "0.8.2-main.5885341",
|
|
33
|
+
"@dxos/plugin-client": "0.8.2-main.5885341",
|
|
34
|
+
"@dxos/react-ui": "0.8.2-main.5885341",
|
|
35
|
+
"@dxos/react-client": "0.8.2-main.5885341",
|
|
36
|
+
"@dxos/react-ui-table": "0.8.2-main.5885341",
|
|
37
|
+
"@dxos/react-ui-editor": "0.8.2-main.5885341",
|
|
38
|
+
"@dxos/react-ui-theme": "0.8.2-main.5885341",
|
|
39
|
+
"@dxos/schema": "0.8.2-main.5885341",
|
|
40
|
+
"@dxos/react-ui-form": "0.8.2-main.5885341",
|
|
41
|
+
"@dxos/util": "0.8.2-main.5885341"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"effect": "3.
|
|
44
|
+
"effect": "3.14.21",
|
|
45
45
|
"react": "~18.2.0",
|
|
46
46
|
"react-dom": "~18.2.0",
|
|
47
47
|
"vite": "5.4.7",
|
|
48
|
-
"@dxos/random": "0.8.2-main.
|
|
48
|
+
"@dxos/random": "0.8.2-main.5885341"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"effect": "3.13.3",
|
package/src/Preview.stories.tsx
CHANGED
|
@@ -95,6 +95,7 @@ export const ContactWithImage = {
|
|
|
95
95
|
Component: ContactCard,
|
|
96
96
|
icon: 'ph--user--regular',
|
|
97
97
|
subject: data.contact,
|
|
98
|
+
role: 'popover',
|
|
98
99
|
},
|
|
99
100
|
};
|
|
100
101
|
|
|
@@ -103,6 +104,7 @@ export const ContactNoImage = {
|
|
|
103
104
|
Component: ContactCard,
|
|
104
105
|
icon: 'ph--user--regular',
|
|
105
106
|
subject: omitImage(data.contact),
|
|
107
|
+
role: 'popover',
|
|
106
108
|
},
|
|
107
109
|
};
|
|
108
110
|
|
|
@@ -111,6 +113,7 @@ export const OrganizationWithImage = {
|
|
|
111
113
|
Component: OrganizationCard,
|
|
112
114
|
icon: 'ph--building-office--regular',
|
|
113
115
|
subject: data.organization,
|
|
116
|
+
role: 'popover',
|
|
114
117
|
},
|
|
115
118
|
};
|
|
116
119
|
|
|
@@ -119,6 +122,7 @@ export const OrganizationNoImage = {
|
|
|
119
122
|
Component: OrganizationCard,
|
|
120
123
|
icon: 'ph--building-office--regular',
|
|
121
124
|
subject: omitImage(data.organization),
|
|
125
|
+
role: 'popover',
|
|
122
126
|
},
|
|
123
127
|
};
|
|
124
128
|
|
|
@@ -127,6 +131,7 @@ export const ProjectWithImage = {
|
|
|
127
131
|
Component: ProjectCard,
|
|
128
132
|
icon: 'ph--building--regular',
|
|
129
133
|
subject: data.project,
|
|
134
|
+
role: 'popover',
|
|
130
135
|
},
|
|
131
136
|
};
|
|
132
137
|
|
|
@@ -135,5 +140,6 @@ export const ProjectNoImage = {
|
|
|
135
140
|
Component: ProjectCard,
|
|
136
141
|
icon: 'ph--building--regular',
|
|
137
142
|
subject: omitImage(data.project),
|
|
143
|
+
role: 'popover',
|
|
138
144
|
},
|
|
139
145
|
};
|
package/src/PreviewPlugin.tsx
CHANGED
|
@@ -43,6 +43,7 @@ import { Contact, Organization, Project } from '@dxos/schema';
|
|
|
43
43
|
import { ContactCard, OrganizationCard, ProjectCard } from './components';
|
|
44
44
|
import { meta, PREVIEW_PLUGIN } from './meta';
|
|
45
45
|
import translations from './translations';
|
|
46
|
+
import { kanbanCardWithoutPoster } from './types';
|
|
46
47
|
|
|
47
48
|
const customEventOptions = { capture: true, passive: false };
|
|
48
49
|
|
|
@@ -126,9 +127,9 @@ export const PreviewPlugin = () =>
|
|
|
126
127
|
//
|
|
127
128
|
createSurface({
|
|
128
129
|
id: `${PREVIEW_PLUGIN}/schema-popover`,
|
|
129
|
-
role: 'popover',
|
|
130
|
+
role: ['popover', 'card--kanban'],
|
|
130
131
|
filter: (data): data is { subject: Contact } => isInstanceOf(Contact, data.subject),
|
|
131
|
-
component: ({ data }) => {
|
|
132
|
+
component: ({ data, role }) => {
|
|
132
133
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
133
134
|
const handleOrgClick = useCallback(
|
|
134
135
|
async (org: Organization) => {
|
|
@@ -159,27 +160,27 @@ export const PreviewPlugin = () =>
|
|
|
159
160
|
[dispatch],
|
|
160
161
|
);
|
|
161
162
|
return (
|
|
162
|
-
<ContactCard subject={data.subject} onOrgClick={handleOrgClick}>
|
|
163
|
-
<Surface role='related' data={data} />
|
|
163
|
+
<ContactCard subject={data.subject} onOrgClick={handleOrgClick} role={role}>
|
|
164
|
+
{role === 'popover' && <Surface role='related' data={data} />}
|
|
164
165
|
</ContactCard>
|
|
165
166
|
);
|
|
166
167
|
},
|
|
167
168
|
}),
|
|
168
169
|
createSurface({
|
|
169
170
|
id: `${PREVIEW_PLUGIN}/schema-popover`,
|
|
170
|
-
role: 'popover',
|
|
171
|
+
role: ['popover', 'card--kanban'],
|
|
171
172
|
filter: (data): data is { subject: Organization } => isInstanceOf(Organization, data.subject),
|
|
172
|
-
component: ({ data }) => (
|
|
173
|
-
<OrganizationCard subject={data.subject}>
|
|
174
|
-
<Surface role='related' data={data} />
|
|
173
|
+
component: ({ data, role }) => (
|
|
174
|
+
<OrganizationCard subject={data.subject} role={role}>
|
|
175
|
+
{role === 'popover' && <Surface role='related' data={data} />}
|
|
175
176
|
</OrganizationCard>
|
|
176
177
|
),
|
|
177
178
|
}),
|
|
178
179
|
createSurface({
|
|
179
180
|
id: `${PREVIEW_PLUGIN}/schema-popover`,
|
|
180
|
-
role: 'popover',
|
|
181
|
+
role: ['popover', 'card--kanban'],
|
|
181
182
|
filter: (data): data is { subject: Project } => isInstanceOf(Project, data.subject),
|
|
182
|
-
component: ({ data }) => <ProjectCard subject={data.subject} />,
|
|
183
|
+
component: ({ data, role }) => <ProjectCard subject={data.subject} role={role} />,
|
|
183
184
|
}),
|
|
184
185
|
|
|
185
186
|
//
|
|
@@ -187,17 +188,24 @@ export const PreviewPlugin = () =>
|
|
|
187
188
|
//
|
|
188
189
|
createSurface({
|
|
189
190
|
id: `${PREVIEW_PLUGIN}/fallback-popover`,
|
|
190
|
-
role: 'popover',
|
|
191
|
+
role: ['popover', 'card--kanban'],
|
|
191
192
|
position: 'fallback',
|
|
192
193
|
filter: (data): data is { subject: ReactiveEchoObject<any> } => isEchoObject(data.subject),
|
|
193
|
-
component: ({ data }) => {
|
|
194
|
+
component: ({ data, role }) => {
|
|
194
195
|
const schema = getSchema(data.subject);
|
|
195
196
|
const { t } = useTranslation(PREVIEW_PLUGIN);
|
|
196
197
|
if (!schema) {
|
|
197
198
|
return <p className={descriptionMessage}>{t('unable to create preview message')}</p>;
|
|
198
199
|
}
|
|
199
200
|
|
|
200
|
-
return
|
|
201
|
+
return (
|
|
202
|
+
<Form
|
|
203
|
+
schema={schema}
|
|
204
|
+
values={data.subject}
|
|
205
|
+
readonly
|
|
206
|
+
{...(role === 'card--kanban' && { classNames: kanbanCardWithoutPoster })}
|
|
207
|
+
/>
|
|
208
|
+
);
|
|
201
209
|
},
|
|
202
210
|
}),
|
|
203
211
|
]),
|
|
@@ -8,17 +8,18 @@ import { Icon, Avatar, Button } from '@dxos/react-ui';
|
|
|
8
8
|
import { mx } from '@dxos/react-ui-theme';
|
|
9
9
|
import { type Contact, type Organization } from '@dxos/schema';
|
|
10
10
|
|
|
11
|
-
import { type PreviewProps,
|
|
11
|
+
import { type PreviewProps, popoverCard, previewTitle, previewProse, previewChrome, defaultCard } from '../types';
|
|
12
12
|
|
|
13
13
|
export const ContactCard = ({
|
|
14
14
|
children,
|
|
15
15
|
classNames,
|
|
16
|
+
role,
|
|
16
17
|
subject: { fullName, image, organization, emails },
|
|
17
18
|
onOrgClick,
|
|
18
19
|
}: PreviewProps<Contact> & { onOrgClick?: (org: Organization) => void }) => {
|
|
19
20
|
const organizationName = organization && typeof organization === 'object' ? organization.target?.name : organization;
|
|
20
21
|
return (
|
|
21
|
-
<div role='none' className={mx(
|
|
22
|
+
<div role='none' className={mx(role === 'popover' ? popoverCard : defaultCard, classNames)}>
|
|
22
23
|
<Avatar.Root>
|
|
23
24
|
<div role='group' className={mx(previewProse, 'grid gap-3 grid-cols-[min-content_1fr]')}>
|
|
24
25
|
<Avatar.Content imgSrc={image} icon='ph--user--regular' size={16} hue='neutral' />
|
|
@@ -8,19 +8,20 @@ import { Icon } from '@dxos/react-ui';
|
|
|
8
8
|
import { mx } from '@dxos/react-ui-theme';
|
|
9
9
|
import { type Organization } from '@dxos/schema';
|
|
10
10
|
|
|
11
|
-
import { type PreviewProps,
|
|
11
|
+
import { type PreviewProps, popoverCard, previewTitle, previewProse, previewChrome, defaultCard } from '../types';
|
|
12
12
|
|
|
13
13
|
export const OrganizationCard = ({
|
|
14
14
|
children,
|
|
15
15
|
classNames,
|
|
16
16
|
subject: { name, image, description, website },
|
|
17
|
+
role,
|
|
17
18
|
}: PreviewProps<Organization>) => {
|
|
18
19
|
return (
|
|
19
|
-
<div role='none' className={mx(
|
|
20
|
+
<div role='none' className={mx(role === 'popover' ? popoverCard : defaultCard, classNames)}>
|
|
20
21
|
{image ? (
|
|
21
22
|
<img className='aspect-video object-cover is-full bs-auto' src={image} alt={name} />
|
|
22
23
|
) : (
|
|
23
|
-
<div role='image' className='grid aspect-video place-items-center bg-
|
|
24
|
+
<div role='image' className='grid aspect-video place-items-center bg-input text-subdued'>
|
|
24
25
|
<Icon icon='ph--building-office--regular' size={10} />
|
|
25
26
|
</div>
|
|
26
27
|
)}
|
|
@@ -7,11 +7,11 @@ import React from 'react';
|
|
|
7
7
|
import { mx } from '@dxos/react-ui-theme';
|
|
8
8
|
import { type Project } from '@dxos/schema';
|
|
9
9
|
|
|
10
|
-
import { type PreviewProps,
|
|
10
|
+
import { type PreviewProps, popoverCard, previewTitle, defaultCard } from '../types';
|
|
11
11
|
|
|
12
|
-
export const ProjectCard = ({ classNames, subject: { name, image, description } }: PreviewProps<Project>) => {
|
|
12
|
+
export const ProjectCard = ({ classNames, role, subject: { name, image, description } }: PreviewProps<Project>) => {
|
|
13
13
|
return (
|
|
14
|
-
<div role='none' className={mx(
|
|
14
|
+
<div role='none' className={mx(role === 'popover' ? popoverCard : defaultCard, classNames)}>
|
|
15
15
|
{image && <img className='is-full bs-auto' src={image} alt={name} />}
|
|
16
16
|
<h2 className={mx(previewTitle, 'pli-3 mlb-3')}>{name}</h2>
|
|
17
17
|
{description && <p className='pli-3 line-clamp-2 mlb-3'>{description}</p>}
|
package/src/types.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { type ThemedClassName } from '@dxos/react-ui';
|
|
|
10
10
|
export type PreviewProps<T extends object> = PropsWithChildren<
|
|
11
11
|
ThemedClassName<{
|
|
12
12
|
subject: T;
|
|
13
|
+
role: string;
|
|
13
14
|
}>
|
|
14
15
|
>;
|
|
15
16
|
|
|
@@ -31,7 +32,9 @@ export type PreviewProps<T extends object> = PropsWithChildren<
|
|
|
31
32
|
* </Card.Body>
|
|
32
33
|
* </Card.Root>
|
|
33
34
|
*/
|
|
34
|
-
export const
|
|
35
|
+
export const popoverCard = 'popover-consistent-width rounded-lg overflow-hidden';
|
|
36
|
+
export const defaultCard = '';
|
|
37
|
+
export const kanbanCardWithoutPoster = 'pbs-[--rail-action]';
|
|
35
38
|
export const previewTitle = 'text-lg font-medium line-clamp-2';
|
|
36
39
|
export const previewProse = 'pli-3 mlb-3';
|
|
37
40
|
export const previewChrome = 'pli-1.5 mlb-1.5 [&_.dx-button]:pli-1.5 [&_.dx-button]:text-start [&_.dx-button]:is-full';
|