@dxos/plugin-preview 0.8.4-main.f9ba587 → 0.8.4-main.fcc0d83b33
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 +33 -53
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/translations.mjs +21 -0
- package/dist/lib/browser/translations.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +33 -52
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/translations.mjs +23 -0
- package/dist/lib/node-esm/translations.mjs.map +7 -0
- package/dist/types/src/PreviewPlugin.d.ts +2 -1
- package/dist/types/src/PreviewPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +3 -2
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/preview-popover.d.ts +3 -2
- package/dist/types/src/capabilities/preview-popover.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +3 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/cards/ExpandoCard.d.ts +4 -0
- package/dist/types/src/cards/ExpandoCard.d.ts.map +1 -0
- package/dist/types/src/cards/FormCard.d.ts +7 -0
- package/dist/types/src/cards/FormCard.d.ts.map +1 -0
- package/dist/types/src/cards/JsonCard.d.ts +5 -0
- package/dist/types/src/cards/JsonCard.d.ts.map +1 -0
- package/dist/types/src/cards/OrganizationCard.d.ts +5 -0
- package/dist/types/src/cards/OrganizationCard.d.ts.map +1 -0
- package/dist/types/src/cards/PersonCard.d.ts +5 -0
- package/dist/types/src/cards/PersonCard.d.ts.map +1 -0
- package/dist/types/src/cards/ProjectCard.d.ts +5 -0
- package/dist/types/src/cards/ProjectCard.d.ts.map +1 -0
- package/dist/types/src/cards/TaskCard.d.ts +5 -0
- package/dist/types/src/cards/TaskCard.d.ts.map +1 -0
- package/dist/types/src/cards/index.d.ts +8 -0
- package/dist/types/src/cards/index.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +0 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -3
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/stories/Card.stories.d.ts +38 -0
- package/dist/types/src/stories/Card.stories.d.ts.map +1 -0
- package/dist/types/src/stories/testing.d.ts +21 -0
- package/dist/types/src/stories/testing.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +8 -3
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +57 -32
- package/src/PreviewPlugin.tsx +17 -29
- package/src/capabilities/index.ts +3 -3
- package/src/capabilities/preview-popover.ts +72 -50
- package/src/capabilities/react-surface.tsx +108 -120
- package/src/cards/ExpandoCard.tsx +76 -0
- package/src/cards/FormCard.tsx +48 -0
- package/src/cards/JsonCard.tsx +19 -0
- package/src/cards/OrganizationCard.tsx +29 -0
- package/src/cards/PersonCard.tsx +65 -0
- package/src/cards/ProjectCard.tsx +22 -0
- package/src/cards/TaskCard.tsx +44 -0
- package/src/cards/index.ts +11 -0
- package/src/index.ts +0 -1
- package/src/meta.ts +8 -5
- package/src/stories/Card.stories.tsx +121 -0
- package/src/stories/testing.tsx +101 -0
- package/src/translations.ts +8 -2
- package/dist/lib/browser/chunk-Z73ENKLE.mjs +0 -14
- package/dist/lib/browser/chunk-Z73ENKLE.mjs.map +0 -7
- package/dist/lib/browser/preview-popover-2UCEZUQW.mjs +0 -69
- package/dist/lib/browser/preview-popover-2UCEZUQW.mjs.map +0 -7
- package/dist/lib/browser/react-surface-P5GWVHQD.mjs +0 -272
- package/dist/lib/browser/react-surface-P5GWVHQD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-2ORSL4GJ.mjs +0 -16
- package/dist/lib/node-esm/chunk-2ORSL4GJ.mjs.map +0 -7
- package/dist/lib/node-esm/preview-popover-OSHWR2YE.mjs +0 -71
- package/dist/lib/node-esm/preview-popover-OSHWR2YE.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-KBHIRVNI.mjs +0 -273
- package/dist/lib/node-esm/react-surface-KBHIRVNI.mjs.map +0 -7
- package/dist/types/src/Preview.stories.d.ts +0 -127
- package/dist/types/src/Preview.stories.d.ts.map +0 -1
- package/dist/types/src/components/ContactCard.d.ts +0 -7
- package/dist/types/src/components/ContactCard.d.ts.map +0 -1
- package/dist/types/src/components/OrganizationCard.d.ts +0 -5
- package/dist/types/src/components/OrganizationCard.d.ts.map +0 -1
- package/dist/types/src/components/ProjectCard.d.ts +0 -5
- package/dist/types/src/components/ProjectCard.d.ts.map +0 -1
- package/dist/types/src/components/index.d.ts +0 -4
- package/dist/types/src/components/index.d.ts.map +0 -1
- package/dist/types/src/types.d.ts +0 -6
- package/dist/types/src/types.d.ts.map +0 -1
- package/src/Preview.stories.tsx +0 -147
- package/src/components/ContactCard.tsx +0 -70
- package/src/components/OrganizationCard.tsx +0 -41
- package/src/components/ProjectCard.tsx +0 -20
- package/src/components/index.ts +0 -7
- package/src/types.ts +0 -11
|
@@ -1,273 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
PREVIEW_PLUGIN
|
|
4
|
-
} from "./chunk-2ORSL4GJ.mjs";
|
|
5
|
-
|
|
6
|
-
// src/capabilities/react-surface.tsx
|
|
7
|
-
import React4, { useCallback } from "react";
|
|
8
|
-
import { Capabilities, LayoutAction, Surface, contributes, createIntent, createSurface, useIntentDispatcher } from "@dxos/app-framework";
|
|
9
|
-
import { fullyQualifiedId, getSchema, getSpace } from "@dxos/client/echo";
|
|
10
|
-
import { Obj, Filter } from "@dxos/echo";
|
|
11
|
-
import { setValue } from "@dxos/echo-schema";
|
|
12
|
-
import { useTranslation } from "@dxos/react-ui";
|
|
13
|
-
import { Form } from "@dxos/react-ui-form";
|
|
14
|
-
import { Card as Card4 } from "@dxos/react-ui-stack";
|
|
15
|
-
import { TableType } from "@dxos/react-ui-table";
|
|
16
|
-
import { descriptionMessage, mx as mx2 } from "@dxos/react-ui-theme";
|
|
17
|
-
import { DataType } from "@dxos/schema";
|
|
18
|
-
|
|
19
|
-
// src/components/ContactCard.tsx
|
|
20
|
-
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
21
|
-
import React, { Fragment } from "react";
|
|
22
|
-
import { Icon, Avatar, Button } from "@dxos/react-ui";
|
|
23
|
-
import { Card, cardHeading, cardText } from "@dxos/react-ui-stack";
|
|
24
|
-
import { mx } from "@dxos/react-ui-theme";
|
|
25
|
-
var ContactCard = ({ children, subject: { fullName, image, organization, emails }, onOrgClick, role }) => {
|
|
26
|
-
var _effect = _useSignals();
|
|
27
|
-
try {
|
|
28
|
-
const organizationName = organization && typeof organization === "object" ? organization.target?.name : organization;
|
|
29
|
-
return /* @__PURE__ */ React.createElement(Card.SurfaceRoot, {
|
|
30
|
-
role
|
|
31
|
-
}, /* @__PURE__ */ React.createElement(Avatar.Root, null, /* @__PURE__ */ React.createElement(Card.Text, {
|
|
32
|
-
role: "group",
|
|
33
|
-
classNames: "grid gap-3 grid-cols-[min-content_1fr]"
|
|
34
|
-
}, /* @__PURE__ */ React.createElement(Avatar.Content, {
|
|
35
|
-
imgSrc: image,
|
|
36
|
-
icon: "ph--user--regular",
|
|
37
|
-
size: 16,
|
|
38
|
-
hue: "neutral"
|
|
39
|
-
}), /* @__PURE__ */ React.createElement("div", {
|
|
40
|
-
role: "none",
|
|
41
|
-
className: "bs-min self-center"
|
|
42
|
-
}, /* @__PURE__ */ React.createElement(Avatar.Label, {
|
|
43
|
-
asChild: true
|
|
44
|
-
}, /* @__PURE__ */ React.createElement("h2", {
|
|
45
|
-
className: cardHeading
|
|
46
|
-
}, fullName))))), organizationName && /* @__PURE__ */ React.createElement(Card.Chrome, null, typeof organization === "object" && onOrgClick ? /* @__PURE__ */ React.createElement(Button, {
|
|
47
|
-
variant: "ghost",
|
|
48
|
-
classNames: "gap-2 text-start",
|
|
49
|
-
onClick: () => onOrgClick(organization.target)
|
|
50
|
-
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
51
|
-
icon: "ph--buildings--regular",
|
|
52
|
-
size: 5,
|
|
53
|
-
classNames: "text-subdued"
|
|
54
|
-
}), /* @__PURE__ */ React.createElement("span", {
|
|
55
|
-
className: "min-is-0 flex-1 truncate"
|
|
56
|
-
}, organizationName), /* @__PURE__ */ React.createElement(Icon, {
|
|
57
|
-
icon: "ph--arrow-right--regular"
|
|
58
|
-
})) : /* @__PURE__ */ React.createElement("p", {
|
|
59
|
-
className: "dx-button gap-2",
|
|
60
|
-
"data-variant": "ghost"
|
|
61
|
-
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
62
|
-
icon: "ph--buildings--regular",
|
|
63
|
-
size: 5,
|
|
64
|
-
classNames: "text-subdued"
|
|
65
|
-
}), /* @__PURE__ */ React.createElement("span", {
|
|
66
|
-
className: "min-is-0 flex-1 truncate"
|
|
67
|
-
}, organizationName))), /* @__PURE__ */ React.createElement("dl", {
|
|
68
|
-
className: mx(cardText, "grid gap-2 grid-cols-[min-content_1fr] [&_dt]:text-subdued [&_dt]:pbs-0.5 [&_dd]:min-is-0")
|
|
69
|
-
}, emails?.length && emails.map(({ label, value }) => /* @__PURE__ */ React.createElement(Fragment, {
|
|
70
|
-
key: value
|
|
71
|
-
}, /* @__PURE__ */ React.createElement("dt", null, /* @__PURE__ */ React.createElement(Icon, {
|
|
72
|
-
icon: "ph--at--regular",
|
|
73
|
-
size: 5
|
|
74
|
-
})), /* @__PURE__ */ React.createElement("dd", {
|
|
75
|
-
key: value,
|
|
76
|
-
className: "break-words"
|
|
77
|
-
}, value)))), children);
|
|
78
|
-
} finally {
|
|
79
|
-
_effect.f();
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
// src/components/OrganizationCard.tsx
|
|
84
|
-
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
85
|
-
import React2 from "react";
|
|
86
|
-
import { Icon as Icon2 } from "@dxos/react-ui";
|
|
87
|
-
import { Card as Card2 } from "@dxos/react-ui-stack";
|
|
88
|
-
var OrganizationCard = ({ children, subject: { name, image, description, website }, role }) => {
|
|
89
|
-
var _effect = _useSignals2();
|
|
90
|
-
try {
|
|
91
|
-
return /* @__PURE__ */ React2.createElement(Card2.SurfaceRoot, {
|
|
92
|
-
role
|
|
93
|
-
}, /* @__PURE__ */ React2.createElement(Card2.Poster, {
|
|
94
|
-
alt: name,
|
|
95
|
-
...image ? {
|
|
96
|
-
image
|
|
97
|
-
} : {
|
|
98
|
-
icon: "ph--building-office--regular"
|
|
99
|
-
}
|
|
100
|
-
}), /* @__PURE__ */ React2.createElement(Card2.Heading, null, name), description && /* @__PURE__ */ React2.createElement(Card2.Text, {
|
|
101
|
-
classNames: "line-clamp-2"
|
|
102
|
-
}, description), website && /* @__PURE__ */ React2.createElement(Card2.Chrome, null, /* @__PURE__ */ React2.createElement("a", {
|
|
103
|
-
className: "dx-button dx-focus-ring gap-2",
|
|
104
|
-
"data-variant": "ghost",
|
|
105
|
-
href: website,
|
|
106
|
-
target: "_blank",
|
|
107
|
-
rel: "noreferrer"
|
|
108
|
-
}, /* @__PURE__ */ React2.createElement(Icon2, {
|
|
109
|
-
icon: "ph--link--regular",
|
|
110
|
-
size: 5,
|
|
111
|
-
classNames: "text-subdued"
|
|
112
|
-
}), /* @__PURE__ */ React2.createElement("span", {
|
|
113
|
-
className: "grow"
|
|
114
|
-
}, website), /* @__PURE__ */ React2.createElement(Icon2, {
|
|
115
|
-
icon: "ph--arrow-square-out--regular"
|
|
116
|
-
}))), children);
|
|
117
|
-
} finally {
|
|
118
|
-
_effect.f();
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
// src/components/ProjectCard.tsx
|
|
123
|
-
import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
|
|
124
|
-
import React3 from "react";
|
|
125
|
-
import { Card as Card3 } from "@dxos/react-ui-stack";
|
|
126
|
-
var ProjectCard = ({ subject: { name, image, description }, role }) => {
|
|
127
|
-
var _effect = _useSignals3();
|
|
128
|
-
try {
|
|
129
|
-
return /* @__PURE__ */ React3.createElement(Card3.SurfaceRoot, {
|
|
130
|
-
role
|
|
131
|
-
}, image && /* @__PURE__ */ React3.createElement(Card3.Poster, {
|
|
132
|
-
image,
|
|
133
|
-
alt: name,
|
|
134
|
-
aspect: "auto"
|
|
135
|
-
}), /* @__PURE__ */ React3.createElement(Card3.Heading, null, name), description && /* @__PURE__ */ React3.createElement(Card3.Text, {
|
|
136
|
-
classNames: "line-clamp-2"
|
|
137
|
-
}, description));
|
|
138
|
-
} finally {
|
|
139
|
-
_effect.f();
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
// src/capabilities/react-surface.tsx
|
|
144
|
-
var react_surface_default = () => contributes(Capabilities.ReactSurface, [
|
|
145
|
-
//
|
|
146
|
-
// Specific schema types.
|
|
147
|
-
//
|
|
148
|
-
createSurface({
|
|
149
|
-
id: `${PREVIEW_PLUGIN}/schema-popover--contact`,
|
|
150
|
-
role: [
|
|
151
|
-
"popover",
|
|
152
|
-
"card--kanban",
|
|
153
|
-
"card--document",
|
|
154
|
-
"card"
|
|
155
|
-
],
|
|
156
|
-
filter: (data) => Obj.instanceOf(DataType.Person, data.subject),
|
|
157
|
-
component: ({ data, role }) => {
|
|
158
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
159
|
-
const handleOrgClick = useCallback(async (org) => {
|
|
160
|
-
const space = getSpace(org);
|
|
161
|
-
const tablesQuery = await space?.db.query(Filter.type(TableType)).run();
|
|
162
|
-
const currentSpaceOrgTable = tablesQuery?.objects.find((table) => {
|
|
163
|
-
return table.view?.target?.query?.typename === DataType.Organization.typename;
|
|
164
|
-
});
|
|
165
|
-
await dispatch(createIntent(LayoutAction.UpdatePopover, {
|
|
166
|
-
part: "popover",
|
|
167
|
-
options: {
|
|
168
|
-
state: false,
|
|
169
|
-
anchorId: ""
|
|
170
|
-
}
|
|
171
|
-
}));
|
|
172
|
-
if (currentSpaceOrgTable) {
|
|
173
|
-
return dispatch(createIntent(LayoutAction.Open, {
|
|
174
|
-
part: "main",
|
|
175
|
-
subject: [
|
|
176
|
-
fullyQualifiedId(currentSpaceOrgTable)
|
|
177
|
-
],
|
|
178
|
-
options: {
|
|
179
|
-
workspace: space?.id
|
|
180
|
-
}
|
|
181
|
-
}));
|
|
182
|
-
}
|
|
183
|
-
}, [
|
|
184
|
-
dispatch
|
|
185
|
-
]);
|
|
186
|
-
return /* @__PURE__ */ React4.createElement(ContactCard, {
|
|
187
|
-
role,
|
|
188
|
-
subject: data.subject,
|
|
189
|
-
onOrgClick: handleOrgClick
|
|
190
|
-
}, role === "popover" && /* @__PURE__ */ React4.createElement(Surface, {
|
|
191
|
-
role: "related",
|
|
192
|
-
data
|
|
193
|
-
}));
|
|
194
|
-
}
|
|
195
|
-
}),
|
|
196
|
-
createSurface({
|
|
197
|
-
id: `${PREVIEW_PLUGIN}/schema-popover--organization`,
|
|
198
|
-
role: [
|
|
199
|
-
"popover",
|
|
200
|
-
"card--kanban",
|
|
201
|
-
"card--document",
|
|
202
|
-
"card"
|
|
203
|
-
],
|
|
204
|
-
filter: (data) => Obj.instanceOf(DataType.Organization, data.subject),
|
|
205
|
-
component: ({ data, role }) => /* @__PURE__ */ React4.createElement(OrganizationCard, {
|
|
206
|
-
role,
|
|
207
|
-
subject: data.subject
|
|
208
|
-
}, role === "popover" && /* @__PURE__ */ React4.createElement(Surface, {
|
|
209
|
-
role: "related",
|
|
210
|
-
data
|
|
211
|
-
}))
|
|
212
|
-
}),
|
|
213
|
-
createSurface({
|
|
214
|
-
id: `${PREVIEW_PLUGIN}/schema-popover--project`,
|
|
215
|
-
role: [
|
|
216
|
-
"popover",
|
|
217
|
-
"card--kanban",
|
|
218
|
-
"card--document",
|
|
219
|
-
"card"
|
|
220
|
-
],
|
|
221
|
-
filter: (data) => Obj.instanceOf(DataType.Project, data.subject),
|
|
222
|
-
component: ({ data, role }) => /* @__PURE__ */ React4.createElement(ProjectCard, {
|
|
223
|
-
subject: data.subject,
|
|
224
|
-
role
|
|
225
|
-
})
|
|
226
|
-
}),
|
|
227
|
-
//
|
|
228
|
-
// Fallback for any object.
|
|
229
|
-
//
|
|
230
|
-
createSurface({
|
|
231
|
-
id: `${PREVIEW_PLUGIN}/fallback-popover`,
|
|
232
|
-
role: [
|
|
233
|
-
"popover",
|
|
234
|
-
"card--kanban",
|
|
235
|
-
"card--document",
|
|
236
|
-
"card"
|
|
237
|
-
],
|
|
238
|
-
position: "fallback",
|
|
239
|
-
filter: (data) => Obj.isObject(data.subject),
|
|
240
|
-
component: ({ data, role }) => {
|
|
241
|
-
const schema = getSchema(data.subject);
|
|
242
|
-
const { t } = useTranslation(PREVIEW_PLUGIN);
|
|
243
|
-
if (!schema) {
|
|
244
|
-
return /* @__PURE__ */ React4.createElement("p", {
|
|
245
|
-
className: mx2(descriptionMessage)
|
|
246
|
-
}, t("unable to create preview message"));
|
|
247
|
-
}
|
|
248
|
-
const handleSave = useCallback((values, { changed }) => {
|
|
249
|
-
const changedPaths = Object.keys(changed).filter((path) => changed[path]);
|
|
250
|
-
for (const path of changedPaths) {
|
|
251
|
-
const value = values[path];
|
|
252
|
-
setValue(data.subject, path, value);
|
|
253
|
-
}
|
|
254
|
-
}, []);
|
|
255
|
-
return /* @__PURE__ */ React4.createElement(Card4.SurfaceRoot, {
|
|
256
|
-
role
|
|
257
|
-
}, /* @__PURE__ */ React4.createElement(Form, {
|
|
258
|
-
schema,
|
|
259
|
-
values: data.subject,
|
|
260
|
-
readonly: role === "popover",
|
|
261
|
-
onSave: handleSave,
|
|
262
|
-
autoSave: true,
|
|
263
|
-
...role === "card--kanban" && {
|
|
264
|
-
outerSpacing: "blockStart-0"
|
|
265
|
-
}
|
|
266
|
-
}));
|
|
267
|
-
}
|
|
268
|
-
})
|
|
269
|
-
]);
|
|
270
|
-
export {
|
|
271
|
-
react_surface_default as default
|
|
272
|
-
};
|
|
273
|
-
//# sourceMappingURL=react-surface-KBHIRVNI.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/react-surface.tsx", "../../../src/components/ContactCard.tsx", "../../../src/components/OrganizationCard.tsx", "../../../src/components/ProjectCard.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { useCallback } from 'react';\n\nimport {\n Capabilities,\n LayoutAction,\n Surface,\n contributes,\n createIntent,\n createSurface,\n useIntentDispatcher,\n} from '@dxos/app-framework';\nimport { fullyQualifiedId, getSchema, getSpace } from '@dxos/client/echo';\nimport { Obj, Filter } from '@dxos/echo';\nimport { type JsonPath, setValue } from '@dxos/echo-schema';\nimport { useTranslation } from '@dxos/react-ui';\nimport { Form } from '@dxos/react-ui-form';\nimport { Card } from '@dxos/react-ui-stack';\nimport { TableType } from '@dxos/react-ui-table';\nimport { descriptionMessage, mx } from '@dxos/react-ui-theme';\nimport { DataType } from '@dxos/schema';\n\nimport { ContactCard, OrganizationCard, ProjectCard } from '../components';\nimport { PREVIEW_PLUGIN } from '../meta';\n\nexport default () =>\n contributes(Capabilities.ReactSurface, [\n //\n // Specific schema types.\n //\n createSurface({\n id: `${PREVIEW_PLUGIN}/schema-popover--contact`,\n role: ['popover', 'card--kanban', 'card--document', 'card'],\n filter: (data): data is { subject: DataType.Person } => Obj.instanceOf(DataType.Person, data.subject),\n component: ({ data, role }) => {\n const { dispatchPromise: dispatch } = useIntentDispatcher();\n const handleOrgClick = useCallback(\n async (org: DataType.Organization) => {\n const space = getSpace(org);\n const tablesQuery = await space?.db.query(Filter.type(TableType)).run();\n const currentSpaceOrgTable = tablesQuery?.objects.find((table) => {\n return table.view?.target?.query?.typename === DataType.Organization.typename;\n });\n await dispatch(\n createIntent(LayoutAction.UpdatePopover, {\n part: 'popover',\n options: {\n state: false,\n anchorId: '',\n },\n }),\n );\n if (currentSpaceOrgTable) {\n return dispatch(\n createIntent(LayoutAction.Open, {\n part: 'main',\n subject: [fullyQualifiedId(currentSpaceOrgTable)],\n options: { workspace: space?.id },\n }),\n );\n }\n },\n [dispatch],\n );\n return (\n <ContactCard role={role} subject={data.subject} onOrgClick={handleOrgClick}>\n {role === 'popover' && <Surface role='related' data={data} />}\n </ContactCard>\n );\n },\n }),\n createSurface({\n id: `${PREVIEW_PLUGIN}/schema-popover--organization`,\n role: ['popover', 'card--kanban', 'card--document', 'card'],\n filter: (data): data is { subject: DataType.Organization } => Obj.instanceOf(DataType.Organization, data.subject),\n component: ({ data, role }) => (\n <OrganizationCard role={role} subject={data.subject}>\n {role === 'popover' && <Surface role='related' data={data} />}\n </OrganizationCard>\n ),\n }),\n createSurface({\n id: `${PREVIEW_PLUGIN}/schema-popover--project`,\n role: ['popover', 'card--kanban', 'card--document', 'card'],\n filter: (data): data is { subject: DataType.Project } => Obj.instanceOf(DataType.Project, data.subject),\n component: ({ data, role }) => <ProjectCard subject={data.subject} role={role} />,\n }),\n\n //\n // Fallback for any object.\n //\n createSurface({\n id: `${PREVIEW_PLUGIN}/fallback-popover`,\n role: ['popover', 'card--kanban', 'card--document', 'card'],\n position: 'fallback',\n filter: (data): data is { subject: Obj.Any } => Obj.isObject(data.subject),\n component: ({ data, role }) => {\n const schema = getSchema(data.subject);\n const { t } = useTranslation(PREVIEW_PLUGIN);\n if (!schema) {\n // TODO(burdon): Use Alert.\n return <p className={mx(descriptionMessage)}>{t('unable to create preview message')}</p>;\n }\n\n const handleSave = useCallback((values: any, { changed }: { changed: Record<string, boolean> }) => {\n const changedPaths = Object.keys(changed).filter((path) => changed[path]);\n for (const path of changedPaths) {\n const value = values[path];\n setValue(data.subject, path as JsonPath, value);\n }\n }, []);\n\n return (\n <Card.SurfaceRoot role={role}>\n <Form\n schema={schema}\n values={data.subject}\n readonly={role === 'popover'}\n onSave={handleSave}\n autoSave\n {...(role === 'card--kanban' && { outerSpacing: 'blockStart-0' })}\n />\n </Card.SurfaceRoot>\n );\n },\n }),\n ]);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { Fragment } from 'react';\n\nimport { Icon, Avatar, Button } from '@dxos/react-ui';\nimport { Card, cardHeading, cardText } from '@dxos/react-ui-stack';\nimport { mx } from '@dxos/react-ui-theme';\nimport { type DataType } from '@dxos/schema';\n\nimport { type PreviewProps } from '../types';\n\nexport const ContactCard = ({\n children,\n subject: { fullName, image, organization, emails },\n onOrgClick,\n role,\n}: PreviewProps<DataType.Person> & { onOrgClick?: (org: DataType.Organization) => void }) => {\n const organizationName = organization && typeof organization === 'object' ? organization.target?.name : organization;\n return (\n <Card.SurfaceRoot role={role}>\n <Avatar.Root>\n <Card.Text role='group' classNames='grid gap-3 grid-cols-[min-content_1fr]'>\n <Avatar.Content imgSrc={image} icon='ph--user--regular' size={16} hue='neutral' />\n <div role='none' className='bs-min self-center'>\n <Avatar.Label asChild>\n <h2 className={cardHeading}>{fullName}</h2>\n </Avatar.Label>\n </div>\n </Card.Text>\n </Avatar.Root>\n {organizationName && (\n <Card.Chrome>\n {typeof organization === 'object' && onOrgClick ? (\n <Button variant='ghost' classNames='gap-2 text-start' onClick={() => onOrgClick(organization.target!)}>\n <Icon icon='ph--buildings--regular' size={5} classNames='text-subdued' />\n <span className='min-is-0 flex-1 truncate'>{organizationName}</span>\n <Icon icon='ph--arrow-right--regular' />\n </Button>\n ) : (\n <p className='dx-button gap-2' data-variant='ghost'>\n <Icon icon='ph--buildings--regular' size={5} classNames='text-subdued' />\n <span className='min-is-0 flex-1 truncate'>{organizationName}</span>\n </p>\n )}\n </Card.Chrome>\n )}\n <dl\n className={mx(\n cardText,\n 'grid gap-2 grid-cols-[min-content_1fr] [&_dt]:text-subdued [&_dt]:pbs-0.5 [&_dd]:min-is-0',\n )}\n >\n {emails?.length &&\n emails.map(({ label, value }) => (\n <Fragment key={value}>\n <dt>\n <Icon icon='ph--at--regular' size={5} />\n </dt>\n <dd key={value} className='break-words'>\n {value}\n </dd>\n </Fragment>\n ))}\n </dl>\n {children}\n </Card.SurfaceRoot>\n );\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { Icon } from '@dxos/react-ui';\nimport { Card } from '@dxos/react-ui-stack';\nimport { type DataType } from '@dxos/schema';\n\nimport { type PreviewProps } from '../types';\n\nexport const OrganizationCard = ({\n children,\n subject: { name, image, description, website },\n role,\n}: PreviewProps<DataType.Organization>) => {\n return (\n <Card.SurfaceRoot role={role}>\n <Card.Poster alt={name!} {...(image ? { image } : { icon: 'ph--building-office--regular' })} />\n <Card.Heading>{name}</Card.Heading>\n {description && <Card.Text classNames='line-clamp-2'>{description}</Card.Text>}\n {website && (\n <Card.Chrome>\n <a\n className='dx-button dx-focus-ring gap-2'\n data-variant='ghost'\n href={website}\n target='_blank'\n rel='noreferrer'\n >\n <Icon icon='ph--link--regular' size={5} classNames='text-subdued' />\n <span className='grow'>{website}</span>\n <Icon icon='ph--arrow-square-out--regular' />\n </a>\n </Card.Chrome>\n )}\n {children}\n </Card.SurfaceRoot>\n );\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { Card } from '@dxos/react-ui-stack';\nimport { type DataType } from '@dxos/schema';\n\nimport { type PreviewProps } from '../types';\n\nexport const ProjectCard = ({ subject: { name, image, description }, role }: PreviewProps<DataType.Project>) => {\n return (\n <Card.SurfaceRoot role={role}>\n {image && <Card.Poster image={image} alt={name} aspect='auto' />}\n <Card.Heading>{name}</Card.Heading>\n {description && <Card.Text classNames='line-clamp-2'>{description}</Card.Text>}\n </Card.SurfaceRoot>\n );\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;AAIA,OAAOA,UAASC,mBAAmB;AAEnC,SACEC,cACAC,cACAC,SACAC,aACAC,cACAC,eACAC,2BACK;AACP,SAASC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AShD,KAAKK,OAAO;IACzEC,WAAW,CAAC,EAAEN,MAAMF,KAAI,MAAE;AACxB,YAAMmD,SAASC,UAAUlD,KAAKK,OAAO;AACrC,YAAM,EAAE8C,EAAC,IAAKC,eAAevD,cAAAA;AAC7B,UAAI,CAACoD,QAAQ;AAEX,eAAO,gBAAAT,OAAA,cAACa,KAAAA;UAAEC,WAAWC,IAAGC,kBAAAA;WAAsBL,EAAE,kCAAA,CAAA;MAClD;AAEA,YAAMM,aAAa9C,YAAY,CAAC+C,QAAa,EAAEC,QAAO,MAAwC;AAC5F,cAAMC,eAAeC,OAAOC,KAAKH,OAAAA,EAAS5D,OAAO,CAACgE,SAASJ,QAAQI,IAAAA,CAAK;AACxE,mBAAWA,QAAQH,cAAc;AAC/B,gBAAMI,QAAQN,OAAOK,IAAAA;AACrBE,mBAASjE,KAAKK,SAAS0D,MAAkBC,KAAAA;QAC3C;MACF,GAAG,CAAA,CAAE;AAEL,aACE,gBAAAxB,OAAA,cAAC0B,MAAKC,aAAW;QAACrE;SAChB,gBAAA0C,OAAA,cAAC4B,MAAAA;QACCnB;QACAS,QAAQ1D,KAAKK;QACbgE,UAAUvE,SAAS;QACnBwE,QAAQb;QACRc,UAAAA;QACC,GAAIzE,SAAS,kBAAkB;UAAE0E,cAAc;QAAe;;IAIvE;EACF,CAAA;CACD;",
|
|
6
|
-
"names": ["React", "useCallback", "Capabilities", "LayoutAction", "Surface", "contributes", "createIntent", "createSurface", "useIntentDispatcher", "fullyQualifiedId", "getSchema", "getSpace", "Obj", "Filter", "setValue", "useTranslation", "Form", "Card", "TableType", "descriptionMessage", "mx", "DataType", "React", "Fragment", "Icon", "Avatar", "Button", "Card", "cardHeading", "cardText", "mx", "ContactCard", "children", "subject", "fullName", "image", "organization", "emails", "onOrgClick", "role", "organizationName", "target", "name", "Card", "SurfaceRoot", "Avatar", "Root", "Text", "classNames", "Content", "imgSrc", "icon", "size", "hue", "div", "className", "Label", "asChild", "h2", "cardHeading", "Chrome", "Button", "variant", "onClick", "Icon", "span", "p", "data-variant", "dl", "mx", "cardText", "length", "map", "label", "value", "Fragment", "key", "dt", "dd", "React", "Icon", "Card", "OrganizationCard", "children", "subject", "name", "image", "description", "website", "role", "React", "Card", "SurfaceRoot", "Poster", "alt", "icon", "Heading", "Text", "classNames", "Chrome", "a", "className", "data-variant", "href", "target", "rel", "Icon", "size", "span", "React", "Card", "ProjectCard", "subject", "name", "image", "description", "role", "React", "Card", "SurfaceRoot", "Poster", "alt", "aspect", "Heading", "Text", "classNames", "contributes", "Capabilities", "ReactSurface", "createSurface", "id", "PREVIEW_PLUGIN", "role", "filter", "data", "Obj", "instanceOf", "DataType", "Person", "subject", "component", "dispatchPromise", "dispatch", "useIntentDispatcher", "handleOrgClick", "useCallback", "org", "space", "getSpace", "tablesQuery", "db", "query", "Filter", "type", "TableType", "run", "currentSpaceOrgTable", "objects", "find", "table", "view", "target", "typename", "Organization", "createIntent", "LayoutAction", "UpdatePopover", "part", "options", "state", "anchorId", "Open", "fullyQualifiedId", "workspace", "React", "ContactCard", "onOrgClick", "Surface", "OrganizationCard", "Project", "ProjectCard", "position", "isObject", "schema", "getSchema", "t", "useTranslation", "p", "className", "mx", "descriptionMessage", "handleSave", "values", "changed", "changedPaths", "Object", "keys", "path", "value", "setValue", "Card", "SurfaceRoot", "Form", "readonly", "onSave", "autoSave", "outerSpacing"]
|
|
7
|
-
}
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import '@dxos-theme';
|
|
2
|
-
import { type Meta } from '@storybook/react-vite';
|
|
3
|
-
import React, { type FC } from 'react';
|
|
4
|
-
import { DataType } from '@dxos/schema';
|
|
5
|
-
import { type PreviewProps } from './types';
|
|
6
|
-
type StoryProps = {
|
|
7
|
-
Component: FC<PreviewProps<any>>;
|
|
8
|
-
icon: string;
|
|
9
|
-
subject: any;
|
|
10
|
-
};
|
|
11
|
-
declare const meta: Meta<StoryProps>;
|
|
12
|
-
export default meta;
|
|
13
|
-
export declare const ContactWithImage: {
|
|
14
|
-
args: {
|
|
15
|
-
Component: ({ children, subject: { fullName, image, organization, emails }, onOrgClick, role, }: PreviewProps<DataType.Person> & {
|
|
16
|
-
onOrgClick?: (org: DataType.Organization) => void;
|
|
17
|
-
}) => React.JSX.Element;
|
|
18
|
-
icon: string;
|
|
19
|
-
subject: import("@dxos/live-object").Live<import("@dxos/echo/Type").OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
|
|
20
|
-
fields?: {
|
|
21
|
-
readonly label: string;
|
|
22
|
-
readonly category?: string | undefined;
|
|
23
|
-
readonly value: string;
|
|
24
|
-
}[] | undefined;
|
|
25
|
-
fullName?: string | undefined;
|
|
26
|
-
preferredName?: string | undefined;
|
|
27
|
-
nickname?: string | undefined;
|
|
28
|
-
image?: string | undefined;
|
|
29
|
-
organization?: import("@dxos/echo-schema").Ref<import("@dxos/echo/Type").OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
|
|
30
|
-
description?: string | undefined;
|
|
31
|
-
id: string;
|
|
32
|
-
name?: string | undefined;
|
|
33
|
-
status?: "prospect" | "qualified" | "active" | "commit" | "reject" | undefined;
|
|
34
|
-
image?: string | undefined;
|
|
35
|
-
website?: string | undefined;
|
|
36
|
-
}> | undefined;
|
|
37
|
-
jobTitle?: string | undefined;
|
|
38
|
-
department?: string | undefined;
|
|
39
|
-
notes?: string | undefined;
|
|
40
|
-
emails?: {
|
|
41
|
-
readonly label?: string | undefined;
|
|
42
|
-
readonly value: string;
|
|
43
|
-
}[] | undefined;
|
|
44
|
-
identities?: {
|
|
45
|
-
readonly label?: string | undefined;
|
|
46
|
-
readonly value: string;
|
|
47
|
-
}[] | undefined;
|
|
48
|
-
phoneNumbers?: {
|
|
49
|
-
readonly label?: string | undefined;
|
|
50
|
-
readonly value: string;
|
|
51
|
-
}[] | undefined;
|
|
52
|
-
addresses?: {
|
|
53
|
-
readonly label?: string | undefined;
|
|
54
|
-
readonly value: {
|
|
55
|
-
readonly street?: string | undefined;
|
|
56
|
-
readonly extended?: string | undefined;
|
|
57
|
-
readonly locality?: string | undefined;
|
|
58
|
-
readonly region?: string | undefined;
|
|
59
|
-
readonly postalCode?: string | undefined;
|
|
60
|
-
readonly postOfficeBoxNumber?: string | undefined;
|
|
61
|
-
readonly country?: string | undefined;
|
|
62
|
-
};
|
|
63
|
-
}[] | undefined;
|
|
64
|
-
urls?: {
|
|
65
|
-
readonly label?: string | undefined;
|
|
66
|
-
readonly value: string;
|
|
67
|
-
}[] | undefined;
|
|
68
|
-
birthday?: string | undefined;
|
|
69
|
-
}>;
|
|
70
|
-
role: string;
|
|
71
|
-
};
|
|
72
|
-
};
|
|
73
|
-
export declare const ContactNoImage: {
|
|
74
|
-
args: {
|
|
75
|
-
Component: ({ children, subject: { fullName, image, organization, emails }, onOrgClick, role, }: PreviewProps<DataType.Person> & {
|
|
76
|
-
onOrgClick?: (org: DataType.Organization) => void;
|
|
77
|
-
}) => React.JSX.Element;
|
|
78
|
-
icon: string;
|
|
79
|
-
subject: any;
|
|
80
|
-
role: string;
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
export declare const OrganizationWithImage: {
|
|
84
|
-
args: {
|
|
85
|
-
Component: ({ children, subject: { name, image, description, website }, role, }: PreviewProps<DataType.Organization>) => React.JSX.Element;
|
|
86
|
-
icon: string;
|
|
87
|
-
subject: import("@dxos/live-object").Live<import("@dxos/echo/Type").OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
|
|
88
|
-
image?: string | undefined;
|
|
89
|
-
id: string;
|
|
90
|
-
status?: "active" | "prospect" | "qualified" | "commit" | "reject" | undefined;
|
|
91
|
-
name?: string | undefined;
|
|
92
|
-
description?: string | undefined;
|
|
93
|
-
website?: string | undefined;
|
|
94
|
-
}>;
|
|
95
|
-
role: string;
|
|
96
|
-
};
|
|
97
|
-
};
|
|
98
|
-
export declare const OrganizationNoImage: {
|
|
99
|
-
args: {
|
|
100
|
-
Component: ({ children, subject: { name, image, description, website }, role, }: PreviewProps<DataType.Organization>) => React.JSX.Element;
|
|
101
|
-
icon: string;
|
|
102
|
-
subject: any;
|
|
103
|
-
role: string;
|
|
104
|
-
};
|
|
105
|
-
};
|
|
106
|
-
export declare const ProjectWithImage: {
|
|
107
|
-
args: {
|
|
108
|
-
Component: ({ subject: { name, image, description }, role }: PreviewProps<DataType.Project>) => React.JSX.Element;
|
|
109
|
-
icon: string;
|
|
110
|
-
subject: import("@dxos/live-object").Live<import("@dxos/echo/Type").OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
|
|
111
|
-
image?: string | undefined;
|
|
112
|
-
id: string;
|
|
113
|
-
name: string;
|
|
114
|
-
description?: string | undefined;
|
|
115
|
-
}>;
|
|
116
|
-
role: string;
|
|
117
|
-
};
|
|
118
|
-
};
|
|
119
|
-
export declare const ProjectNoImage: {
|
|
120
|
-
args: {
|
|
121
|
-
Component: ({ subject: { name, image, description }, role }: PreviewProps<DataType.Project>) => React.JSX.Element;
|
|
122
|
-
icon: string;
|
|
123
|
-
subject: any;
|
|
124
|
-
role: string;
|
|
125
|
-
};
|
|
126
|
-
};
|
|
127
|
-
//# sourceMappingURL=Preview.stories.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,uBAAuB,CAAC;AAClD,OAAO,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAKvC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAKxC,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AAI5C,KAAK,UAAU,GAAG;IAChB,SAAS,EAAE,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,GAAG,CAAC;CACd,CAAC;AAEF,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,UAAU,CAsB1B,CAAC;AAEF,eAAe,IAAI,CAAC;AA2CpB,eAAO,MAAM,gBAAgB;;;sBA7E7B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoFA,CAAC;AAEF,eAAO,MAAM,cAAc;;;sBAtF3B,CAAC;;;;;;CA6FA,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,7 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type DataType } from '@dxos/schema';
|
|
3
|
-
import { type PreviewProps } from '../types';
|
|
4
|
-
export declare const ContactCard: ({ children, subject: { fullName, image, organization, emails }, onOrgClick, role, }: PreviewProps<DataType.Person> & {
|
|
5
|
-
onOrgClick?: (org: DataType.Organization) => void;
|
|
6
|
-
}) => React.JSX.Element;
|
|
7
|
-
//# sourceMappingURL=ContactCard.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ContactCard.d.ts","sourceRoot":"","sources":["../../../../src/components/ContactCard.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAKxC,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,eAAO,MAAM,WAAW,GAAI,qFAKzB,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG;IAAE,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,QAAQ,CAAC,YAAY,KAAK,IAAI,CAAA;CAAE,sBAmDvF,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type DataType } from '@dxos/schema';
|
|
3
|
-
import { type PreviewProps } from '../types';
|
|
4
|
-
export declare const OrganizationCard: ({ children, subject: { name, image, description, website }, role, }: PreviewProps<DataType.Organization>) => React.JSX.Element;
|
|
5
|
-
//# sourceMappingURL=OrganizationCard.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,eAAO,MAAM,gBAAgB,GAAI,qEAI9B,YAAY,CAAC,QAAQ,CAAC,YAAY,CAAC,sBAwBrC,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type DataType } from '@dxos/schema';
|
|
3
|
-
import { type PreviewProps } from '../types';
|
|
4
|
-
export declare const ProjectCard: ({ subject: { name, image, description }, role }: PreviewProps<DataType.Project>) => React.JSX.Element;
|
|
5
|
-
//# sourceMappingURL=ProjectCard.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,eAAO,MAAM,WAAW,GAAI,iDAAiD,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,sBAQ1G,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAIA,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAG/C,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,MAAM,IAAI,iBAAiB,CAAC;IAC7D,OAAO,EAAE,CAAC,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC,CAAC"}
|
package/src/Preview.stories.tsx
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
|
-
import { type Meta } from '@storybook/react-vite';
|
|
8
|
-
import React, { type FC } from 'react';
|
|
9
|
-
|
|
10
|
-
import { Obj, Ref } from '@dxos/echo';
|
|
11
|
-
import { faker } from '@dxos/random';
|
|
12
|
-
import { Icon, Popover } from '@dxos/react-ui';
|
|
13
|
-
import { DataType } from '@dxos/schema';
|
|
14
|
-
import { withTheme, withLayout } from '@dxos/storybook-utils';
|
|
15
|
-
|
|
16
|
-
import { ContactCard, OrganizationCard, ProjectCard } from './components';
|
|
17
|
-
import { translations } from './translations';
|
|
18
|
-
import { type PreviewProps } from './types';
|
|
19
|
-
|
|
20
|
-
faker.seed(1234);
|
|
21
|
-
|
|
22
|
-
type StoryProps = {
|
|
23
|
-
Component: FC<PreviewProps<any>>;
|
|
24
|
-
icon: string;
|
|
25
|
-
subject: any;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const meta: Meta<StoryProps> = {
|
|
29
|
-
title: 'plugins/plugin-preview/Preview',
|
|
30
|
-
render: ({ Component, icon, ...args }) => {
|
|
31
|
-
return (
|
|
32
|
-
<Popover.Root open>
|
|
33
|
-
<Popover.Content>
|
|
34
|
-
<Popover.Viewport>
|
|
35
|
-
<Component {...args} role='popover' />
|
|
36
|
-
</Popover.Viewport>
|
|
37
|
-
<Popover.Arrow />
|
|
38
|
-
</Popover.Content>
|
|
39
|
-
<Popover.Trigger>
|
|
40
|
-
<Icon icon={icon} size={5} />
|
|
41
|
-
</Popover.Trigger>
|
|
42
|
-
</Popover.Root>
|
|
43
|
-
);
|
|
44
|
-
},
|
|
45
|
-
decorators: [withTheme, withLayout()],
|
|
46
|
-
parameters: {
|
|
47
|
-
layout: 'centered',
|
|
48
|
-
translations,
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export default meta;
|
|
53
|
-
|
|
54
|
-
const omitImage = ({ image, ...rest }: any) => rest;
|
|
55
|
-
|
|
56
|
-
const data = (() => {
|
|
57
|
-
const organization = Obj.make(DataType.Organization, {
|
|
58
|
-
name: faker.company.name(),
|
|
59
|
-
image:
|
|
60
|
-
'https://plus.unsplash.com/premium_photo-1672116452571-896980a801c8?q=80&w=2671&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D',
|
|
61
|
-
website: faker.internet.url(),
|
|
62
|
-
description: faker.lorem.paragraph(),
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
const contact = Obj.make(DataType.Person, {
|
|
66
|
-
fullName: faker.person.fullName(),
|
|
67
|
-
image:
|
|
68
|
-
'https://plus.unsplash.com/premium_photo-1664536392779-049ba8fde933?q=80&w=2574&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D',
|
|
69
|
-
organization: Ref.make(organization),
|
|
70
|
-
emails: [
|
|
71
|
-
{
|
|
72
|
-
label: 'Work',
|
|
73
|
-
value: faker.internet.email(),
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
label: 'Work',
|
|
77
|
-
value: faker.internet.email(),
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
label: 'Work',
|
|
81
|
-
value: faker.internet.email(),
|
|
82
|
-
},
|
|
83
|
-
],
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
const project = Obj.make(DataType.Project, {
|
|
87
|
-
name: faker.person.fullName(),
|
|
88
|
-
image: 'https://dxos.network/dxos-logotype-blue.png',
|
|
89
|
-
description: faker.lorem.paragraph(),
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
return { organization, contact, project };
|
|
93
|
-
})();
|
|
94
|
-
|
|
95
|
-
export const ContactWithImage = {
|
|
96
|
-
args: {
|
|
97
|
-
Component: ContactCard,
|
|
98
|
-
icon: 'ph--user--regular',
|
|
99
|
-
subject: data.contact,
|
|
100
|
-
role: 'popover',
|
|
101
|
-
},
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
export const ContactNoImage = {
|
|
105
|
-
args: {
|
|
106
|
-
Component: ContactCard,
|
|
107
|
-
icon: 'ph--user--regular',
|
|
108
|
-
subject: omitImage(data.contact),
|
|
109
|
-
role: 'popover',
|
|
110
|
-
},
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
export const OrganizationWithImage = {
|
|
114
|
-
args: {
|
|
115
|
-
Component: OrganizationCard,
|
|
116
|
-
icon: 'ph--building-office--regular',
|
|
117
|
-
subject: data.organization,
|
|
118
|
-
role: 'popover',
|
|
119
|
-
},
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
export const OrganizationNoImage = {
|
|
123
|
-
args: {
|
|
124
|
-
Component: OrganizationCard,
|
|
125
|
-
icon: 'ph--building-office--regular',
|
|
126
|
-
subject: omitImage(data.organization),
|
|
127
|
-
role: 'popover',
|
|
128
|
-
},
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
export const ProjectWithImage = {
|
|
132
|
-
args: {
|
|
133
|
-
Component: ProjectCard,
|
|
134
|
-
icon: 'ph--building--regular',
|
|
135
|
-
subject: data.project,
|
|
136
|
-
role: 'popover',
|
|
137
|
-
},
|
|
138
|
-
};
|
|
139
|
-
|
|
140
|
-
export const ProjectNoImage = {
|
|
141
|
-
args: {
|
|
142
|
-
Component: ProjectCard,
|
|
143
|
-
icon: 'ph--building--regular',
|
|
144
|
-
subject: omitImage(data.project),
|
|
145
|
-
role: 'popover',
|
|
146
|
-
},
|
|
147
|
-
};
|