@dxos/plugin-preview 0.8.4-main.406dc2a → 0.8.4-main.548089c
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/chunk-CEWM5LJG.mjs +17 -0
- package/dist/lib/browser/chunk-CEWM5LJG.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +5 -5
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-X56QWACK.mjs → react-surface-ZAOGRCMT.mjs} +238 -159
- package/dist/lib/browser/react-surface-ZAOGRCMT.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-L3IZVX56.mjs → chunk-Q5MUNELK.mjs} +6 -1
- package/dist/lib/node-esm/chunk-Q5MUNELK.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +5 -5
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-4P7UCMK7.mjs → react-surface-X76BTDM5.mjs} +238 -159
- package/dist/lib/node-esm/react-surface-X76BTDM5.mjs.map +7 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- 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/{components → cards}/TaskCard.d.ts +2 -2
- package/dist/types/src/cards/TaskCard.d.ts.map +1 -0
- package/dist/types/src/cards/index.d.ts +5 -0
- package/dist/types/src/cards/index.d.ts.map +1 -0
- package/dist/types/src/components/CardComponents.d.ts +16 -0
- package/dist/types/src/components/CardComponents.d.ts.map +1 -0
- package/dist/types/src/components/CardSubjectMenu.d.ts +3 -7
- package/dist/types/src/components/CardSubjectMenu.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +2 -3
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/stories/Card.stories.d.ts +0 -1
- package/dist/types/src/stories/Card.stories.d.ts.map +1 -1
- package/dist/types/src/stories/testing.d.ts +2 -1
- package/dist/types/src/stories/testing.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +4 -3
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +27 -26
- package/src/PreviewPlugin.tsx +2 -2
- package/src/capabilities/react-surface.tsx +44 -27
- package/src/cards/OrganizationCard.tsx +29 -0
- package/src/cards/PersonCard.tsx +63 -0
- package/src/cards/ProjectCard.tsx +24 -0
- package/src/{components → cards}/TaskCard.tsx +6 -6
- package/src/cards/index.ts +8 -0
- package/src/components/CardComponents.tsx +67 -0
- package/src/components/CardSubjectMenu.tsx +61 -40
- package/src/components/index.ts +2 -3
- package/src/meta.ts +5 -0
- package/src/stories/Card.stories.tsx +5 -2
- package/src/stories/testing.tsx +19 -19
- package/src/types.ts +5 -4
- package/dist/lib/browser/chunk-XKCIQK3C.mjs +0 -12
- package/dist/lib/browser/chunk-XKCIQK3C.mjs.map +0 -7
- package/dist/lib/browser/react-surface-X56QWACK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-L3IZVX56.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-4P7UCMK7.mjs.map +0 -7
- 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/TaskCard.d.ts.map +0 -1
- package/src/components/ContactCard.tsx +0 -78
- package/src/components/OrganizationCard.tsx +0 -44
- package/src/components/ProjectCard.tsx +0 -28
|
@@ -1,40 +1,70 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
meta
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-Q5MUNELK.mjs";
|
|
5
5
|
|
|
6
6
|
// src/capabilities/react-surface.tsx
|
|
7
|
-
import
|
|
8
|
-
import { Capabilities, LayoutAction as LayoutAction2,
|
|
9
|
-
import {
|
|
7
|
+
import React7, { useCallback } from "react";
|
|
8
|
+
import { Capabilities, LayoutAction as LayoutAction2, contributes, createIntent as createIntent2, createSurface } from "@dxos/app-framework";
|
|
9
|
+
import { Surface, useIntentDispatcher as useIntentDispatcher2 } from "@dxos/app-framework/react";
|
|
10
|
+
import { getSchema, getSpace } from "@dxos/client/echo";
|
|
10
11
|
import { Obj as Obj3 } from "@dxos/echo";
|
|
11
12
|
import { setValue } from "@dxos/echo/internal";
|
|
12
13
|
import { useActiveSpace } from "@dxos/plugin-space";
|
|
13
14
|
import { useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
14
15
|
import { Form } from "@dxos/react-ui-form";
|
|
15
|
-
import { Card as
|
|
16
|
-
import { descriptionMessage, mx as
|
|
17
|
-
import {
|
|
16
|
+
import { Card as Card6 } from "@dxos/react-ui-stack";
|
|
17
|
+
import { descriptionMessage, mx as mx4 } from "@dxos/react-ui-theme";
|
|
18
|
+
import { Organization, Person, Project, Task as Task2 } from "@dxos/types";
|
|
18
19
|
|
|
19
|
-
// src/
|
|
20
|
+
// src/cards/OrganizationCard.tsx
|
|
21
|
+
import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
|
|
22
|
+
import React3 from "react";
|
|
23
|
+
import { Card as Card2 } from "@dxos/react-ui-stack";
|
|
24
|
+
|
|
25
|
+
// src/components/CardComponents.tsx
|
|
20
26
|
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
21
|
-
import React2
|
|
22
|
-
import {
|
|
23
|
-
import { Card,
|
|
27
|
+
import React2 from "react";
|
|
28
|
+
import { Button, Icon } from "@dxos/react-ui";
|
|
29
|
+
import { Card, cardNoSpacing, cardSpacing } from "@dxos/react-ui-stack";
|
|
24
30
|
import { mx } from "@dxos/react-ui-theme";
|
|
25
31
|
|
|
26
32
|
// src/components/CardSubjectMenu.tsx
|
|
27
33
|
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
28
|
-
import {
|
|
34
|
+
import { Atom } from "@effect-atom/atom-react";
|
|
29
35
|
import React from "react";
|
|
30
|
-
import { LayoutAction, createIntent
|
|
36
|
+
import { LayoutAction, createIntent } from "@dxos/app-framework";
|
|
37
|
+
import { useIntentDispatcher } from "@dxos/app-framework/react";
|
|
31
38
|
import { ACTION_TYPE } from "@dxos/app-graph";
|
|
32
39
|
import { Obj } from "@dxos/echo";
|
|
33
40
|
import { SpaceAction } from "@dxos/plugin-space/types";
|
|
34
|
-
import { fullyQualifiedId } from "@dxos/react-client/echo";
|
|
35
41
|
import { IconButton, useTranslation } from "@dxos/react-ui";
|
|
36
42
|
import { DropdownMenu, MenuProvider, useMenuActions } from "@dxos/react-ui-menu";
|
|
37
|
-
var
|
|
43
|
+
var CardSubjectMenu = ({ subject, activeSpace, ...props }) => {
|
|
44
|
+
var _effect = _useSignals();
|
|
45
|
+
try {
|
|
46
|
+
const { t } = useTranslation(meta.id);
|
|
47
|
+
const menuProps = useSubjectMenuGroupItems({
|
|
48
|
+
subject,
|
|
49
|
+
activeSpace
|
|
50
|
+
});
|
|
51
|
+
if (!activeSpace) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
return /* @__PURE__ */ React.createElement(MenuProvider, menuProps, /* @__PURE__ */ React.createElement(DropdownMenu.Root, null, /* @__PURE__ */ React.createElement(DropdownMenu.Trigger, {
|
|
55
|
+
asChild: true
|
|
56
|
+
}, /* @__PURE__ */ React.createElement(IconButton, {
|
|
57
|
+
variant: "ghost",
|
|
58
|
+
icon: "ph--dots-three-vertical--bold",
|
|
59
|
+
iconOnly: true,
|
|
60
|
+
label: t("more options label"),
|
|
61
|
+
...props
|
|
62
|
+
}))));
|
|
63
|
+
} finally {
|
|
64
|
+
_effect.f();
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
var useSubjectMenuGroupItems = ({ subject, activeSpace }) => {
|
|
38
68
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
39
69
|
const result = {
|
|
40
70
|
edges: [],
|
|
@@ -46,7 +76,7 @@ var useSubjectMenuGroupItems = (subject, activeSpace) => {
|
|
|
46
76
|
data: () => dispatch(createIntent(LayoutAction.Open, {
|
|
47
77
|
part: "main",
|
|
48
78
|
subject: [
|
|
49
|
-
|
|
79
|
+
Obj.getDXN(subject).toString()
|
|
50
80
|
]
|
|
51
81
|
})),
|
|
52
82
|
properties: {
|
|
@@ -86,169 +116,192 @@ var useSubjectMenuGroupItems = (subject, activeSpace) => {
|
|
|
86
116
|
target
|
|
87
117
|
});
|
|
88
118
|
});
|
|
89
|
-
return useMenuActions(
|
|
119
|
+
return useMenuActions(Atom.make(result));
|
|
90
120
|
};
|
|
91
|
-
|
|
92
|
-
|
|
121
|
+
|
|
122
|
+
// src/components/CardComponents.tsx
|
|
123
|
+
var gridRow = "is-full grid grid-cols-[1.5rem_1fr_min-content] gap-2 items-center";
|
|
124
|
+
var CardHeader = ({ label, subject, activeSpace }) => {
|
|
125
|
+
var _effect = _useSignals2();
|
|
93
126
|
try {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
variant: "ghost",
|
|
104
|
-
icon: "ph--dots-three-vertical--bold",
|
|
105
|
-
label: t("more options label"),
|
|
106
|
-
...props
|
|
107
|
-
}))));
|
|
127
|
+
return /* @__PURE__ */ React2.createElement("div", {
|
|
128
|
+
role: "none",
|
|
129
|
+
className: mx("flex items-center gap-2", cardSpacing)
|
|
130
|
+
}, /* @__PURE__ */ React2.createElement(Card.Heading, {
|
|
131
|
+
classNames: cardNoSpacing
|
|
132
|
+
}, label), /* @__PURE__ */ React2.createElement(CardSubjectMenu, {
|
|
133
|
+
subject,
|
|
134
|
+
activeSpace
|
|
135
|
+
}));
|
|
108
136
|
} finally {
|
|
109
137
|
_effect.f();
|
|
110
138
|
}
|
|
111
139
|
};
|
|
112
|
-
|
|
113
|
-
// src/components/ContactCard.tsx
|
|
114
|
-
var ContactCard = ({ children, subject, activeSpace, onOrgClick, role }) => {
|
|
140
|
+
var CardRow = ({ icon, label, onClick }) => {
|
|
115
141
|
var _effect = _useSignals2();
|
|
116
142
|
try {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
role: "none",
|
|
131
|
-
className: "bs-min self-center flex items-center"
|
|
132
|
-
}, /* @__PURE__ */ React2.createElement(Avatar.Label, {
|
|
133
|
-
asChild: true
|
|
134
|
-
}, /* @__PURE__ */ React2.createElement("h2", {
|
|
135
|
-
className: mx(cardHeading, "grow")
|
|
136
|
-
}, fullName)), /* @__PURE__ */ React2.createElement(CardSubjectMenu, {
|
|
137
|
-
subject,
|
|
138
|
-
activeSpace
|
|
139
|
-
})))), organizationName && /* @__PURE__ */ React2.createElement(Card.Chrome, null, typeof organization === "object" && onOrgClick ? /* @__PURE__ */ React2.createElement(Button, {
|
|
143
|
+
if (!onClick) {
|
|
144
|
+
return /* @__PURE__ */ React2.createElement(Card.Chrome, null, /* @__PURE__ */ React2.createElement("p", {
|
|
145
|
+
"data-variant": "ghost",
|
|
146
|
+
className: mx(gridRow, "dx-button")
|
|
147
|
+
}, /* @__PURE__ */ React2.createElement(Icon, {
|
|
148
|
+
icon,
|
|
149
|
+
size: 5,
|
|
150
|
+
classNames: "text-subdued"
|
|
151
|
+
}), /* @__PURE__ */ React2.createElement("span", {
|
|
152
|
+
className: "min-is-0 flex-1 truncate col-span-2"
|
|
153
|
+
}, label)));
|
|
154
|
+
}
|
|
155
|
+
return /* @__PURE__ */ React2.createElement(Card.Chrome, null, /* @__PURE__ */ React2.createElement(Button, {
|
|
140
156
|
variant: "ghost",
|
|
141
|
-
classNames: "
|
|
142
|
-
onClick
|
|
157
|
+
classNames: mx(gridRow, "text-start"),
|
|
158
|
+
onClick
|
|
143
159
|
}, /* @__PURE__ */ React2.createElement(Icon, {
|
|
144
|
-
icon
|
|
160
|
+
icon,
|
|
145
161
|
size: 5,
|
|
146
162
|
classNames: "text-subdued"
|
|
147
163
|
}), /* @__PURE__ */ React2.createElement("span", {
|
|
148
164
|
className: "min-is-0 flex-1 truncate"
|
|
149
|
-
},
|
|
165
|
+
}, label), /* @__PURE__ */ React2.createElement(Icon, {
|
|
150
166
|
icon: "ph--arrow-right--regular"
|
|
151
|
-
}))
|
|
152
|
-
|
|
153
|
-
|
|
167
|
+
})));
|
|
168
|
+
} finally {
|
|
169
|
+
_effect.f();
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
var CardLink = ({ label, href }) => {
|
|
173
|
+
var _effect = _useSignals2();
|
|
174
|
+
try {
|
|
175
|
+
return /* @__PURE__ */ React2.createElement(Card.Chrome, null, /* @__PURE__ */ React2.createElement("a", {
|
|
176
|
+
className: mx(gridRow, "dx-button dx-focus-ring"),
|
|
177
|
+
"data-variant": "ghost",
|
|
178
|
+
href,
|
|
179
|
+
target: "_blank",
|
|
180
|
+
rel: "noreferrer"
|
|
154
181
|
}, /* @__PURE__ */ React2.createElement(Icon, {
|
|
155
|
-
icon: "ph--
|
|
182
|
+
icon: "ph--link--regular",
|
|
156
183
|
size: 5,
|
|
157
184
|
classNames: "text-subdued"
|
|
158
185
|
}), /* @__PURE__ */ React2.createElement("span", {
|
|
159
186
|
className: "min-is-0 flex-1 truncate"
|
|
160
|
-
}, organizationName))), emails?.length && /* @__PURE__ */ React2.createElement("dl", {
|
|
161
|
-
className: mx(cardText, "grid gap-2 grid-cols-[min-content_1fr] [&_dt]:text-subdued [&_dt]:pbs-0.5 [&_dd]:min-is-0")
|
|
162
|
-
}, emails?.length && emails.map(({ label, value }) => /* @__PURE__ */ React2.createElement(Fragment, {
|
|
163
|
-
key: value
|
|
164
|
-
}, /* @__PURE__ */ React2.createElement("dt", null, /* @__PURE__ */ React2.createElement("span", {
|
|
165
|
-
className: "sr-only"
|
|
166
187
|
}, label), /* @__PURE__ */ React2.createElement(Icon, {
|
|
167
|
-
icon: "ph--
|
|
168
|
-
|
|
169
|
-
})), /* @__PURE__ */ React2.createElement("dd", {
|
|
170
|
-
key: value,
|
|
171
|
-
className: "break-words"
|
|
172
|
-
}, value)))), children);
|
|
188
|
+
icon: "ph--arrow-square-out--regular"
|
|
189
|
+
})));
|
|
173
190
|
} finally {
|
|
174
191
|
_effect.f();
|
|
175
192
|
}
|
|
176
193
|
};
|
|
177
194
|
|
|
178
|
-
// src/
|
|
179
|
-
import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
|
|
180
|
-
import React3 from "react";
|
|
181
|
-
import { Icon as Icon2 } from "@dxos/react-ui";
|
|
182
|
-
import { Card as Card2, cardNoSpacing, cardSpacing } from "@dxos/react-ui-stack";
|
|
183
|
-
import { mx as mx2 } from "@dxos/react-ui-theme";
|
|
195
|
+
// src/cards/OrganizationCard.tsx
|
|
184
196
|
var OrganizationCard = ({ children, subject, role, activeSpace }) => {
|
|
185
197
|
var _effect = _useSignals3();
|
|
186
198
|
try {
|
|
187
199
|
const { name, image, description, website } = subject;
|
|
188
200
|
return /* @__PURE__ */ React3.createElement(Card2.SurfaceRoot, {
|
|
201
|
+
id: subject.id,
|
|
189
202
|
role
|
|
190
203
|
}, /* @__PURE__ */ React3.createElement(Card2.Poster, {
|
|
191
|
-
alt: name,
|
|
204
|
+
alt: name ?? "",
|
|
192
205
|
...image ? {
|
|
193
206
|
image
|
|
194
207
|
} : {
|
|
195
208
|
icon: "ph--building-office--regular"
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
}, /* @__PURE__ */ React3.createElement(Card2.Heading, {
|
|
201
|
-
classNames: cardNoSpacing
|
|
202
|
-
}, name), /* @__PURE__ */ React3.createElement(CardSubjectMenu, {
|
|
209
|
+
},
|
|
210
|
+
classNames: !image && "opacity-50"
|
|
211
|
+
}), /* @__PURE__ */ React3.createElement(CardHeader, {
|
|
212
|
+
label: name,
|
|
203
213
|
subject,
|
|
204
214
|
activeSpace
|
|
205
|
-
})
|
|
215
|
+
}), description && /* @__PURE__ */ React3.createElement(Card2.Text, {
|
|
206
216
|
classNames: "line-clamp-2"
|
|
207
|
-
}, description), website && /* @__PURE__ */ React3.createElement(
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
target: "_blank",
|
|
212
|
-
rel: "noreferrer"
|
|
213
|
-
}, /* @__PURE__ */ React3.createElement(Icon2, {
|
|
214
|
-
icon: "ph--link--regular",
|
|
215
|
-
size: 5,
|
|
216
|
-
classNames: "text-subdued"
|
|
217
|
-
}), /* @__PURE__ */ React3.createElement("span", {
|
|
218
|
-
className: "min-is-0 flex-1 truncate"
|
|
219
|
-
}, website), /* @__PURE__ */ React3.createElement(Icon2, {
|
|
220
|
-
icon: "ph--arrow-square-out--regular"
|
|
221
|
-
}))), children);
|
|
217
|
+
}, description), website && /* @__PURE__ */ React3.createElement(CardLink, {
|
|
218
|
+
label: website,
|
|
219
|
+
href: website
|
|
220
|
+
}), children);
|
|
222
221
|
} finally {
|
|
223
222
|
_effect.f();
|
|
224
223
|
}
|
|
225
224
|
};
|
|
226
225
|
|
|
227
|
-
// src/
|
|
226
|
+
// src/cards/PersonCard.tsx
|
|
228
227
|
import { useSignals as _useSignals4 } from "@preact-signals/safe-react/tracking";
|
|
229
|
-
import React4 from "react";
|
|
228
|
+
import React4, { Fragment } from "react";
|
|
229
|
+
import { Avatar, Icon as Icon2 } from "@dxos/react-ui";
|
|
230
|
+
import { Card as Card3, cardHeading, cardText } from "@dxos/react-ui-stack";
|
|
231
|
+
import { mx as mx2 } from "@dxos/react-ui-theme";
|
|
232
|
+
var PersonCard = ({ children, role, subject, activeSpace, onSelect }) => {
|
|
233
|
+
var _effect = _useSignals4();
|
|
234
|
+
try {
|
|
235
|
+
const { fullName, image, organization: { target: organization } = {}, emails = [] } = subject;
|
|
236
|
+
return /* @__PURE__ */ React4.createElement(Card3.SurfaceRoot, {
|
|
237
|
+
id: subject.id,
|
|
238
|
+
role
|
|
239
|
+
}, /* @__PURE__ */ React4.createElement(Avatar.Root, null, /* @__PURE__ */ React4.createElement(Card3.Text, {
|
|
240
|
+
role: "group",
|
|
241
|
+
classNames: mx2("grid gap-2 grid-cols-[1fr_min-content]")
|
|
242
|
+
}, /* @__PURE__ */ React4.createElement("div", {
|
|
243
|
+
role: "none",
|
|
244
|
+
className: mx2(gridRow, "grid-rows-2")
|
|
245
|
+
}, activeSpace ? /* @__PURE__ */ React4.createElement(CardSubjectMenu, {
|
|
246
|
+
subject,
|
|
247
|
+
activeSpace
|
|
248
|
+
}) : /* @__PURE__ */ React4.createElement("div", null), /* @__PURE__ */ React4.createElement(Avatar.Label, {
|
|
249
|
+
asChild: true
|
|
250
|
+
}, /* @__PURE__ */ React4.createElement("h2", {
|
|
251
|
+
className: mx2(cardHeading, "grow truncate")
|
|
252
|
+
}, fullName))), /* @__PURE__ */ React4.createElement(Avatar.Content, {
|
|
253
|
+
imgSrc: image,
|
|
254
|
+
icon: "ph--user--regular",
|
|
255
|
+
size: 16,
|
|
256
|
+
classNames: [
|
|
257
|
+
"text-subdued",
|
|
258
|
+
!image && "opacity-50"
|
|
259
|
+
],
|
|
260
|
+
hue: "neutral",
|
|
261
|
+
variant: "square"
|
|
262
|
+
}))), organization?.name && /* @__PURE__ */ React4.createElement(CardRow, {
|
|
263
|
+
icon: "ph--buildings--regular",
|
|
264
|
+
label: organization.name,
|
|
265
|
+
onClick: onSelect ? () => onSelect(organization) : void 0
|
|
266
|
+
}), emails.length > 0 && /* @__PURE__ */ React4.createElement("dl", {
|
|
267
|
+
className: mx2(cardText, gridRow, "[&_dt]:text-subdued [&_dt]:pbs-0.5 [&_dd]:min-is-0")
|
|
268
|
+
}, emails.map(({ label, value }) => /* @__PURE__ */ React4.createElement(Fragment, {
|
|
269
|
+
key: value
|
|
270
|
+
}, /* @__PURE__ */ React4.createElement("dt", null, /* @__PURE__ */ React4.createElement("span", {
|
|
271
|
+
className: "sr-only"
|
|
272
|
+
}, label), /* @__PURE__ */ React4.createElement(Icon2, {
|
|
273
|
+
icon: "ph--at--regular",
|
|
274
|
+
size: 5
|
|
275
|
+
})), /* @__PURE__ */ React4.createElement("dd", {
|
|
276
|
+
key: value,
|
|
277
|
+
className: "col-span-2 break-words"
|
|
278
|
+
}, value)))), children);
|
|
279
|
+
} finally {
|
|
280
|
+
_effect.f();
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
// src/cards/ProjectCard.tsx
|
|
285
|
+
import { useSignals as _useSignals5 } from "@preact-signals/safe-react/tracking";
|
|
286
|
+
import React5 from "react";
|
|
230
287
|
import { Obj as Obj2 } from "@dxos/echo";
|
|
231
|
-
import { Card as
|
|
232
|
-
import { mx as mx3 } from "@dxos/react-ui-theme";
|
|
288
|
+
import { Card as Card4 } from "@dxos/react-ui-stack";
|
|
233
289
|
var ProjectCard = ({ subject, role, activeSpace }) => {
|
|
234
|
-
var _effect =
|
|
290
|
+
var _effect = _useSignals5();
|
|
235
291
|
try {
|
|
236
292
|
const { name, image, description } = subject;
|
|
237
|
-
return /* @__PURE__ */
|
|
293
|
+
return /* @__PURE__ */ React5.createElement(Card4.SurfaceRoot, {
|
|
294
|
+
id: subject.id,
|
|
238
295
|
role
|
|
239
|
-
}, image && /* @__PURE__ */
|
|
296
|
+
}, image && /* @__PURE__ */ React5.createElement(Card4.Poster, {
|
|
240
297
|
image,
|
|
241
298
|
alt: Obj2.getLabel(subject) ?? "",
|
|
242
299
|
aspect: "auto"
|
|
243
|
-
}), /* @__PURE__ */
|
|
244
|
-
|
|
245
|
-
className: mx3("flex items-center gap-2", cardSpacing2)
|
|
246
|
-
}, /* @__PURE__ */ React4.createElement(Card3.Heading, {
|
|
247
|
-
classNames: cardNoSpacing2
|
|
248
|
-
}, name), /* @__PURE__ */ React4.createElement(CardSubjectMenu, {
|
|
300
|
+
}), /* @__PURE__ */ React5.createElement(CardHeader, {
|
|
301
|
+
label: name,
|
|
249
302
|
subject,
|
|
250
303
|
activeSpace
|
|
251
|
-
})
|
|
304
|
+
}), description && /* @__PURE__ */ React5.createElement(Card4.Text, {
|
|
252
305
|
classNames: "line-clamp-2"
|
|
253
306
|
}, description));
|
|
254
307
|
} finally {
|
|
@@ -256,16 +309,16 @@ var ProjectCard = ({ subject, role, activeSpace }) => {
|
|
|
256
309
|
}
|
|
257
310
|
};
|
|
258
311
|
|
|
259
|
-
// src/
|
|
260
|
-
import { useSignals as
|
|
312
|
+
// src/cards/TaskCard.tsx
|
|
313
|
+
import { useSignals as _useSignals6 } from "@preact-signals/safe-react/tracking";
|
|
261
314
|
import * as SchemaAST from "effect/SchemaAST";
|
|
262
|
-
import
|
|
315
|
+
import React6 from "react";
|
|
263
316
|
import { PropertyMetaAnnotationId } from "@dxos/echo/internal";
|
|
264
|
-
import { Card as
|
|
265
|
-
import { mx as
|
|
266
|
-
import {
|
|
317
|
+
import { Card as Card5, cardNoSpacing as cardNoSpacing2, cardSpacing as cardSpacing2 } from "@dxos/react-ui-stack";
|
|
318
|
+
import { mx as mx3 } from "@dxos/react-ui-theme";
|
|
319
|
+
import { Task } from "@dxos/types";
|
|
267
320
|
var getActiveStatusOption = (status) => {
|
|
268
|
-
const properties = SchemaAST.getPropertySignatures(
|
|
321
|
+
const properties = SchemaAST.getPropertySignatures(Task.Task.ast);
|
|
269
322
|
const statusProperty = properties.find((p) => p.name === "status");
|
|
270
323
|
const statusMeta = SchemaAST.getAnnotation(PropertyMetaAnnotationId)(
|
|
271
324
|
// TODO(thure): Typescript asserts `.type` doesn’t have `.types`, but in runtime it does.
|
|
@@ -275,24 +328,25 @@ var getActiveStatusOption = (status) => {
|
|
|
275
328
|
return options.find(({ id }) => id === status);
|
|
276
329
|
};
|
|
277
330
|
var TaskCard = ({ subject, role, activeSpace }) => {
|
|
278
|
-
var _effect =
|
|
331
|
+
var _effect = _useSignals6();
|
|
279
332
|
try {
|
|
280
333
|
const { title, status } = subject;
|
|
281
334
|
const statusOption = getActiveStatusOption(status);
|
|
282
|
-
return /* @__PURE__ */
|
|
335
|
+
return /* @__PURE__ */ React6.createElement(Card5.SurfaceRoot, {
|
|
336
|
+
id: subject.id,
|
|
283
337
|
role
|
|
284
|
-
}, /* @__PURE__ */
|
|
338
|
+
}, /* @__PURE__ */ React6.createElement("div", {
|
|
285
339
|
role: "none",
|
|
286
|
-
className:
|
|
287
|
-
}, /* @__PURE__ */
|
|
340
|
+
className: mx3("flex items-center gap-2", cardSpacing2)
|
|
341
|
+
}, /* @__PURE__ */ React6.createElement(Card5.Heading, {
|
|
288
342
|
classNames: [
|
|
289
|
-
|
|
343
|
+
cardNoSpacing2,
|
|
290
344
|
"min-is-0 flex-1 truncate"
|
|
291
345
|
]
|
|
292
|
-
}, title), statusOption && /* @__PURE__ */
|
|
346
|
+
}, title), statusOption && /* @__PURE__ */ React6.createElement("span", {
|
|
293
347
|
className: "dx-tag",
|
|
294
348
|
"data-hue": statusOption.color
|
|
295
|
-
}, statusOption.title), /* @__PURE__ */
|
|
349
|
+
}, statusOption.title), /* @__PURE__ */ React6.createElement(CardSubjectMenu, {
|
|
296
350
|
subject,
|
|
297
351
|
activeSpace
|
|
298
352
|
})));
|
|
@@ -305,6 +359,7 @@ var TaskCard = ({ subject, role, activeSpace }) => {
|
|
|
305
359
|
var react_surface_default = (() => contributes(Capabilities.ReactSurface, [
|
|
306
360
|
//
|
|
307
361
|
// Specific schema types.
|
|
362
|
+
// TODO(burdon): Create helpers and factor out.
|
|
308
363
|
//
|
|
309
364
|
createSurface({
|
|
310
365
|
id: `${meta.id}/schema-popover--contact`,
|
|
@@ -315,15 +370,15 @@ var react_surface_default = (() => contributes(Capabilities.ReactSurface, [
|
|
|
315
370
|
"card--extrinsic",
|
|
316
371
|
"card"
|
|
317
372
|
],
|
|
318
|
-
filter: (data) => Obj3.instanceOf(
|
|
373
|
+
filter: (data) => Obj3.instanceOf(Person.Person, data.subject),
|
|
319
374
|
component: ({ data, role }) => {
|
|
320
375
|
const { dispatchPromise: dispatch } = useIntentDispatcher2();
|
|
321
376
|
const space = getSpace(data.subject);
|
|
322
377
|
const activeSpace = useActiveSpace();
|
|
323
|
-
const
|
|
378
|
+
const handleSelect = useCallback((object) => dispatch(createIntent2(LayoutAction2.Open, {
|
|
324
379
|
part: "main",
|
|
325
380
|
subject: [
|
|
326
|
-
|
|
381
|
+
Obj3.getDXN(object).toString()
|
|
327
382
|
],
|
|
328
383
|
options: {
|
|
329
384
|
workspace: space?.id
|
|
@@ -331,12 +386,12 @@ var react_surface_default = (() => contributes(Capabilities.ReactSurface, [
|
|
|
331
386
|
})), [
|
|
332
387
|
dispatch
|
|
333
388
|
]);
|
|
334
|
-
return /* @__PURE__ */
|
|
389
|
+
return /* @__PURE__ */ React7.createElement(PersonCard, {
|
|
335
390
|
role,
|
|
336
391
|
subject: data.subject,
|
|
337
392
|
activeSpace,
|
|
338
|
-
|
|
339
|
-
}, role === "card--popover" && /* @__PURE__ */
|
|
393
|
+
onSelect: handleSelect
|
|
394
|
+
}, role === "card--popover" && /* @__PURE__ */ React7.createElement(Surface, {
|
|
340
395
|
role: "related",
|
|
341
396
|
data
|
|
342
397
|
}));
|
|
@@ -351,14 +406,14 @@ var react_surface_default = (() => contributes(Capabilities.ReactSurface, [
|
|
|
351
406
|
"card--extrinsic",
|
|
352
407
|
"card"
|
|
353
408
|
],
|
|
354
|
-
filter: (data) => Obj3.instanceOf(
|
|
409
|
+
filter: (data) => Obj3.instanceOf(Organization.Organization, data.subject),
|
|
355
410
|
component: ({ data, role }) => {
|
|
356
411
|
const activeSpace = useActiveSpace();
|
|
357
|
-
return /* @__PURE__ */
|
|
412
|
+
return /* @__PURE__ */ React7.createElement(OrganizationCard, {
|
|
358
413
|
role,
|
|
359
414
|
subject: data.subject,
|
|
360
415
|
activeSpace
|
|
361
|
-
}, role === "card--popover" && /* @__PURE__ */
|
|
416
|
+
}, role === "card--popover" && /* @__PURE__ */ React7.createElement(Surface, {
|
|
362
417
|
role: "related",
|
|
363
418
|
data
|
|
364
419
|
}));
|
|
@@ -373,10 +428,10 @@ var react_surface_default = (() => contributes(Capabilities.ReactSurface, [
|
|
|
373
428
|
"card--extrinsic",
|
|
374
429
|
"card"
|
|
375
430
|
],
|
|
376
|
-
filter: (data) => Obj3.instanceOf(
|
|
431
|
+
filter: (data) => Obj3.instanceOf(Project.Project, data.subject),
|
|
377
432
|
component: ({ data, role }) => {
|
|
378
433
|
const activeSpace = useActiveSpace();
|
|
379
|
-
return /* @__PURE__ */
|
|
434
|
+
return /* @__PURE__ */ React7.createElement(ProjectCard, {
|
|
380
435
|
subject: data.subject,
|
|
381
436
|
role,
|
|
382
437
|
activeSpace
|
|
@@ -392,11 +447,13 @@ var react_surface_default = (() => contributes(Capabilities.ReactSurface, [
|
|
|
392
447
|
"card--extrinsic",
|
|
393
448
|
"card"
|
|
394
449
|
],
|
|
395
|
-
filter: (data) => Obj3.instanceOf(
|
|
396
|
-
component: ({ data, role }) =>
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
450
|
+
filter: (data) => Obj3.instanceOf(Task2.Task, data.subject),
|
|
451
|
+
component: ({ data, role }) => {
|
|
452
|
+
return /* @__PURE__ */ React7.createElement(TaskCard, {
|
|
453
|
+
subject: data.subject,
|
|
454
|
+
role
|
|
455
|
+
});
|
|
456
|
+
}
|
|
400
457
|
}),
|
|
401
458
|
//
|
|
402
459
|
// Fallback for any object.
|
|
@@ -416,8 +473,8 @@ var react_surface_default = (() => contributes(Capabilities.ReactSurface, [
|
|
|
416
473
|
const schema = getSchema(data.subject);
|
|
417
474
|
const { t } = useTranslation2(meta.id);
|
|
418
475
|
if (!schema) {
|
|
419
|
-
return /* @__PURE__ */
|
|
420
|
-
className:
|
|
476
|
+
return /* @__PURE__ */ React7.createElement("p", {
|
|
477
|
+
className: mx4(descriptionMessage)
|
|
421
478
|
}, t("unable to create preview message"));
|
|
422
479
|
}
|
|
423
480
|
const handleSave = useCallback((values, { changed }) => {
|
|
@@ -427,9 +484,10 @@ var react_surface_default = (() => contributes(Capabilities.ReactSurface, [
|
|
|
427
484
|
setValue(data.subject, path, value);
|
|
428
485
|
}
|
|
429
486
|
}, []);
|
|
430
|
-
return /* @__PURE__ */
|
|
487
|
+
return /* @__PURE__ */ React7.createElement(Card6.SurfaceRoot, {
|
|
431
488
|
role
|
|
432
|
-
}, /* @__PURE__ */
|
|
489
|
+
}, /* @__PURE__ */ React7.createElement(Form, {
|
|
490
|
+
id: data.subject.id,
|
|
433
491
|
schema,
|
|
434
492
|
projection: data.projection,
|
|
435
493
|
values: data.subject,
|
|
@@ -441,9 +499,30 @@ var react_surface_default = (() => contributes(Capabilities.ReactSurface, [
|
|
|
441
499
|
}
|
|
442
500
|
}));
|
|
443
501
|
}
|
|
502
|
+
}),
|
|
503
|
+
createSurface({
|
|
504
|
+
id: `${meta.id}/section`,
|
|
505
|
+
role: [
|
|
506
|
+
"section"
|
|
507
|
+
],
|
|
508
|
+
position: "fallback",
|
|
509
|
+
filter: (data) => Obj3.isObject(data.subject),
|
|
510
|
+
component: ({ data }) => {
|
|
511
|
+
return /* @__PURE__ */ React7.createElement("div", {
|
|
512
|
+
role: "none",
|
|
513
|
+
className: "flex is-full justify-center"
|
|
514
|
+
}, /* @__PURE__ */ React7.createElement("div", {
|
|
515
|
+
role: "none",
|
|
516
|
+
className: "pbs-2 pbe-2 card-min-width card-max-width"
|
|
517
|
+
}, /* @__PURE__ */ React7.createElement(Surface, {
|
|
518
|
+
role: "card",
|
|
519
|
+
data,
|
|
520
|
+
limit: 1
|
|
521
|
+
})));
|
|
522
|
+
}
|
|
444
523
|
})
|
|
445
524
|
]));
|
|
446
525
|
export {
|
|
447
526
|
react_surface_default as default
|
|
448
527
|
};
|
|
449
|
-
//# sourceMappingURL=react-surface-
|
|
528
|
+
//# sourceMappingURL=react-surface-X76BTDM5.mjs.map
|