@dxos/plugin-preview 0.8.2-main.fbd8ed0 → 0.8.2-staging.4d6ad0f
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-B2VK6GFP.mjs +28 -0
- package/dist/lib/browser/chunk-B2VK6GFP.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +17 -309
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/preview-popover-S3OY3CFZ.mjs +65 -0
- package/dist/lib/browser/preview-popover-S3OY3CFZ.mjs.map +7 -0
- package/dist/lib/browser/react-surface-XDHP6EN7.mjs +285 -0
- package/dist/lib/browser/react-surface-XDHP6EN7.mjs.map +7 -0
- package/dist/lib/node/chunk-VFSOM2B4.cjs +55 -0
- package/dist/lib/node/chunk-VFSOM2B4.cjs.map +7 -0
- package/dist/lib/node/index.cjs +20 -314
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/preview-popover-GPBOHU5E.cjs +84 -0
- package/dist/lib/node/preview-popover-GPBOHU5E.cjs.map +7 -0
- package/dist/lib/node/react-surface-CPAQ7ZYR.cjs +297 -0
- package/dist/lib/node/react-surface-CPAQ7ZYR.cjs.map +7 -0
- package/dist/lib/node-esm/chunk-PYKIS3N7.mjs +30 -0
- package/dist/lib/node-esm/chunk-PYKIS3N7.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +17 -310
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/preview-popover-EQAEYYDT.mjs +67 -0
- package/dist/lib/node-esm/preview-popover-EQAEYYDT.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-QJRHN4PN.mjs +286 -0
- package/dist/lib/node-esm/react-surface-QJRHN4PN.mjs.map +7 -0
- package/dist/types/src/Preview.stories.d.ts +6 -6
- package/dist/types/src/PreviewPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +3 -0
- package/dist/types/src/capabilities/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/preview-popover.d.ts +4 -0
- package/dist/types/src/capabilities/preview-popover.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +4 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/components/OrganizationCard.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +1 -1
- package/dist/types/src/types.d.ts.map +1 -1
- package/package.json +20 -19
- package/src/PreviewPlugin.tsx +5 -184
- package/src/capabilities/index.ts +8 -0
- package/src/capabilities/preview-popover.ts +65 -0
- package/src/capabilities/react-surface.tsx +126 -0
- package/src/components/OrganizationCard.tsx +8 -2
- package/src/types.ts +1 -1
package/src/PreviewPlugin.tsx
CHANGED
|
@@ -2,64 +2,13 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
Capabilities,
|
|
9
|
-
Events,
|
|
10
|
-
LayoutAction,
|
|
11
|
-
Surface,
|
|
12
|
-
contributes,
|
|
13
|
-
createIntent,
|
|
14
|
-
createSurface,
|
|
15
|
-
defineModule,
|
|
16
|
-
definePlugin,
|
|
17
|
-
useIntentDispatcher,
|
|
18
|
-
} from '@dxos/app-framework';
|
|
19
|
-
import { addEventListener } from '@dxos/async';
|
|
20
|
-
import { type Client, resolveRef } from '@dxos/client';
|
|
21
|
-
import {
|
|
22
|
-
Filter,
|
|
23
|
-
fullyQualifiedId,
|
|
24
|
-
getSchema,
|
|
25
|
-
getSpace,
|
|
26
|
-
isEchoObject,
|
|
27
|
-
parseId,
|
|
28
|
-
type AnyLiveObject,
|
|
29
|
-
type Space,
|
|
30
|
-
} from '@dxos/client/echo';
|
|
31
|
-
import { isInstanceOf } from '@dxos/echo-schema';
|
|
32
|
-
import { DXN } from '@dxos/keys';
|
|
33
|
-
import { type DxRefTagActivate } from '@dxos/lit-ui';
|
|
34
|
-
import { log } from '@dxos/log';
|
|
5
|
+
import { Capabilities, Events, contributes, defineModule, definePlugin } from '@dxos/app-framework';
|
|
35
6
|
import { ClientCapabilities, ClientEvents } from '@dxos/plugin-client';
|
|
36
|
-
import { useTranslation } from '@dxos/react-ui';
|
|
37
|
-
import { type PreviewLinkRef, type PreviewLinkTarget } from '@dxos/react-ui-editor';
|
|
38
|
-
import { Form } from '@dxos/react-ui-form';
|
|
39
|
-
import { TableType } from '@dxos/react-ui-table';
|
|
40
|
-
import { descriptionMessage } from '@dxos/react-ui-theme';
|
|
41
7
|
import { DataType } from '@dxos/schema';
|
|
42
8
|
|
|
43
|
-
import {
|
|
44
|
-
import { meta
|
|
9
|
+
import { PreviewPopover, ReactSurface } from './capabilities';
|
|
10
|
+
import { meta } from './meta';
|
|
45
11
|
import translations from './translations';
|
|
46
|
-
import { kanbanCardWithoutPoster } from './types';
|
|
47
|
-
|
|
48
|
-
const customEventOptions = { capture: true, passive: false };
|
|
49
|
-
|
|
50
|
-
const handlePreviewLookup = async (
|
|
51
|
-
client: Client,
|
|
52
|
-
defaultSpace: Space,
|
|
53
|
-
{ ref, label }: PreviewLinkRef,
|
|
54
|
-
): Promise<PreviewLinkTarget | null> => {
|
|
55
|
-
const dxn = DXN.parse(ref);
|
|
56
|
-
if (!dxn) {
|
|
57
|
-
return null;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const object = await resolveRef(client, dxn, defaultSpace);
|
|
61
|
-
return { label, object };
|
|
62
|
-
};
|
|
63
12
|
|
|
64
13
|
export const PreviewPlugin = () =>
|
|
65
14
|
definePlugin(meta, [
|
|
@@ -76,139 +25,11 @@ export const PreviewPlugin = () =>
|
|
|
76
25
|
defineModule({
|
|
77
26
|
id: `${meta.id}/module/preview-popover`,
|
|
78
27
|
activatesOn: Events.Startup,
|
|
79
|
-
activate:
|
|
80
|
-
// TODO(wittjosiah): Factor out lookup handlers to other plugins to make not ECHO-specific.
|
|
81
|
-
const handleDxRefTagActivate = async ({ ref, label, trigger }: DxRefTagActivate) => {
|
|
82
|
-
const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);
|
|
83
|
-
const client = context.getCapability(ClientCapabilities.Client);
|
|
84
|
-
const [layout] = context.getCapabilities(Capabilities.Layout);
|
|
85
|
-
const { spaceId } = parseId(layout.workspace);
|
|
86
|
-
const space = (spaceId && client.spaces.get(spaceId)) ?? client.spaces.default;
|
|
87
|
-
const result = await handlePreviewLookup(client, space, { ref, label });
|
|
88
|
-
if (!result) {
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
await dispatch(
|
|
93
|
-
createIntent(LayoutAction.UpdatePopover, {
|
|
94
|
-
part: 'popover',
|
|
95
|
-
subject: result.object,
|
|
96
|
-
options: {
|
|
97
|
-
state: true,
|
|
98
|
-
variant: 'virtual',
|
|
99
|
-
anchor: trigger,
|
|
100
|
-
},
|
|
101
|
-
}),
|
|
102
|
-
);
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
if (!document.defaultView) {
|
|
106
|
-
log.warn('No default view found');
|
|
107
|
-
return [];
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
const cleanup = addEventListener(
|
|
111
|
-
document.defaultView,
|
|
112
|
-
'dx-ref-tag-activate',
|
|
113
|
-
handleDxRefTagActivate,
|
|
114
|
-
customEventOptions,
|
|
115
|
-
);
|
|
116
|
-
return contributes(Capabilities.Null, null, () => cleanup());
|
|
117
|
-
},
|
|
28
|
+
activate: PreviewPopover,
|
|
118
29
|
}),
|
|
119
30
|
defineModule({
|
|
120
31
|
id: `${meta.id}/module/react-surface`,
|
|
121
32
|
activatesOn: Events.SetupReactSurface,
|
|
122
|
-
activate:
|
|
123
|
-
// TODO(wittjosiah): Factor out to lazy capabilities like other plugins.
|
|
124
|
-
contributes(Capabilities.ReactSurface, [
|
|
125
|
-
//
|
|
126
|
-
// Specific schema types.
|
|
127
|
-
//
|
|
128
|
-
createSurface({
|
|
129
|
-
id: `${PREVIEW_PLUGIN}/schema-popover`,
|
|
130
|
-
role: ['popover', 'card--kanban'],
|
|
131
|
-
filter: (data): data is { subject: DataType.Person } => isInstanceOf(DataType.Person, data.subject),
|
|
132
|
-
component: ({ data, role }) => {
|
|
133
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
134
|
-
const handleOrgClick = useCallback(
|
|
135
|
-
async (org: DataType.Organization) => {
|
|
136
|
-
const space = getSpace(org);
|
|
137
|
-
const tablesQuery = await space?.db.query(Filter.type(TableType)).run();
|
|
138
|
-
const currentSpaceOrgTable = tablesQuery?.objects.find((table) => {
|
|
139
|
-
return table.view?.target?.query?.typename === DataType.Organization.typename;
|
|
140
|
-
});
|
|
141
|
-
await dispatch(
|
|
142
|
-
createIntent(LayoutAction.UpdatePopover, {
|
|
143
|
-
part: 'popover',
|
|
144
|
-
options: {
|
|
145
|
-
state: false,
|
|
146
|
-
anchorId: '',
|
|
147
|
-
},
|
|
148
|
-
}),
|
|
149
|
-
);
|
|
150
|
-
if (currentSpaceOrgTable) {
|
|
151
|
-
return dispatch(
|
|
152
|
-
createIntent(LayoutAction.Open, {
|
|
153
|
-
part: 'main',
|
|
154
|
-
subject: [fullyQualifiedId(currentSpaceOrgTable)],
|
|
155
|
-
options: { workspace: space?.id },
|
|
156
|
-
}),
|
|
157
|
-
);
|
|
158
|
-
}
|
|
159
|
-
},
|
|
160
|
-
[dispatch],
|
|
161
|
-
);
|
|
162
|
-
return (
|
|
163
|
-
<ContactCard subject={data.subject} onOrgClick={handleOrgClick} role={role}>
|
|
164
|
-
{role === 'popover' && <Surface role='related' data={data} />}
|
|
165
|
-
</ContactCard>
|
|
166
|
-
);
|
|
167
|
-
},
|
|
168
|
-
}),
|
|
169
|
-
createSurface({
|
|
170
|
-
id: `${PREVIEW_PLUGIN}/schema-popover`,
|
|
171
|
-
role: ['popover', 'card--kanban'],
|
|
172
|
-
filter: (data): data is { subject: DataType.Organization } =>
|
|
173
|
-
isInstanceOf(DataType.Organization, data.subject),
|
|
174
|
-
component: ({ data, role }) => (
|
|
175
|
-
<OrganizationCard subject={data.subject} role={role}>
|
|
176
|
-
{role === 'popover' && <Surface role='related' data={data} />}
|
|
177
|
-
</OrganizationCard>
|
|
178
|
-
),
|
|
179
|
-
}),
|
|
180
|
-
createSurface({
|
|
181
|
-
id: `${PREVIEW_PLUGIN}/schema-popover`,
|
|
182
|
-
role: ['popover', 'card--kanban'],
|
|
183
|
-
filter: (data): data is { subject: DataType.Project } => isInstanceOf(DataType.Project, data.subject),
|
|
184
|
-
component: ({ data, role }) => <ProjectCard subject={data.subject} role={role} />,
|
|
185
|
-
}),
|
|
186
|
-
|
|
187
|
-
//
|
|
188
|
-
// Fallback for any object.
|
|
189
|
-
//
|
|
190
|
-
createSurface({
|
|
191
|
-
id: `${PREVIEW_PLUGIN}/fallback-popover`,
|
|
192
|
-
role: ['popover', 'card--kanban'],
|
|
193
|
-
position: 'fallback',
|
|
194
|
-
filter: (data): data is { subject: AnyLiveObject<any> } => isEchoObject(data.subject),
|
|
195
|
-
component: ({ data, role }) => {
|
|
196
|
-
const schema = getSchema(data.subject);
|
|
197
|
-
const { t } = useTranslation(PREVIEW_PLUGIN);
|
|
198
|
-
if (!schema) {
|
|
199
|
-
return <p className={descriptionMessage}>{t('unable to create preview message')}</p>;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
return (
|
|
203
|
-
<Form
|
|
204
|
-
schema={schema}
|
|
205
|
-
values={data.subject}
|
|
206
|
-
readonly={role === 'popover'}
|
|
207
|
-
{...(role === 'card--kanban' && { classNames: kanbanCardWithoutPoster })}
|
|
208
|
-
/>
|
|
209
|
-
);
|
|
210
|
-
},
|
|
211
|
-
}),
|
|
212
|
-
]),
|
|
33
|
+
activate: ReactSurface,
|
|
213
34
|
}),
|
|
214
35
|
]);
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Capabilities, LayoutAction, contributes, createIntent, type PluginContext } from '@dxos/app-framework';
|
|
6
|
+
import { addEventListener } from '@dxos/async';
|
|
7
|
+
import { type Client, resolveRef } from '@dxos/client';
|
|
8
|
+
import { parseId, type Space } from '@dxos/client/echo';
|
|
9
|
+
import { DXN } from '@dxos/keys';
|
|
10
|
+
import { type DxRefTagActivate } from '@dxos/lit-ui';
|
|
11
|
+
import { log } from '@dxos/log';
|
|
12
|
+
import { ClientCapabilities } from '@dxos/plugin-client';
|
|
13
|
+
import { type PreviewLinkRef, type PreviewLinkTarget } from '@dxos/react-ui-editor';
|
|
14
|
+
|
|
15
|
+
const customEventOptions = { capture: true, passive: false };
|
|
16
|
+
|
|
17
|
+
const handlePreviewLookup = async (
|
|
18
|
+
client: Client,
|
|
19
|
+
defaultSpace: Space,
|
|
20
|
+
{ ref, label }: PreviewLinkRef,
|
|
21
|
+
): Promise<PreviewLinkTarget | null> => {
|
|
22
|
+
const dxn = DXN.parse(ref);
|
|
23
|
+
if (!dxn) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const object = await resolveRef(client, dxn, defaultSpace);
|
|
28
|
+
return { label, object };
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export default (context: PluginContext) => {
|
|
32
|
+
// TODO(wittjosiah): Factor out lookup handlers to other plugins to make not ECHO-specific.
|
|
33
|
+
const handleDxRefTagActivate = async ({ refId, label, trigger }: DxRefTagActivate) => {
|
|
34
|
+
const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);
|
|
35
|
+
const client = context.getCapability(ClientCapabilities.Client);
|
|
36
|
+
const [layout] = context.getCapabilities(Capabilities.Layout);
|
|
37
|
+
const { spaceId } = parseId(layout.workspace);
|
|
38
|
+
const space = (spaceId && client.spaces.get(spaceId)) ?? client.spaces.default;
|
|
39
|
+
const result = await handlePreviewLookup(client, space, { ref: refId, label });
|
|
40
|
+
if (!result) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
await dispatch(
|
|
45
|
+
createIntent(LayoutAction.UpdatePopover, {
|
|
46
|
+
part: 'popover',
|
|
47
|
+
subject: result.object,
|
|
48
|
+
options: {
|
|
49
|
+
state: true,
|
|
50
|
+
variant: 'virtual',
|
|
51
|
+
anchor: trigger,
|
|
52
|
+
},
|
|
53
|
+
}),
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
let cleanup: () => void;
|
|
58
|
+
if (document.defaultView) {
|
|
59
|
+
cleanup = addEventListener(document.defaultView, 'dx-ref-tag-activate', handleDxRefTagActivate, customEventOptions);
|
|
60
|
+
} else {
|
|
61
|
+
log.warn('No default view found');
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return contributes(Capabilities.Null, null, () => cleanup());
|
|
65
|
+
};
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { useCallback } from 'react';
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
Capabilities,
|
|
9
|
+
LayoutAction,
|
|
10
|
+
Surface,
|
|
11
|
+
contributes,
|
|
12
|
+
createIntent,
|
|
13
|
+
createSurface,
|
|
14
|
+
useIntentDispatcher,
|
|
15
|
+
} from '@dxos/app-framework';
|
|
16
|
+
import { Filter, fullyQualifiedId, getSchema, getSpace, isEchoObject, type AnyLiveObject } from '@dxos/client/echo';
|
|
17
|
+
import { isInstanceOf, type JsonPath, setValue } from '@dxos/echo-schema';
|
|
18
|
+
import { useTranslation } from '@dxos/react-ui';
|
|
19
|
+
import { Form } from '@dxos/react-ui-form';
|
|
20
|
+
import { TableType } from '@dxos/react-ui-table';
|
|
21
|
+
import { descriptionMessage } from '@dxos/react-ui-theme';
|
|
22
|
+
import { DataType } from '@dxos/schema';
|
|
23
|
+
|
|
24
|
+
import { ContactCard, OrganizationCard, ProjectCard } from '../components';
|
|
25
|
+
import { PREVIEW_PLUGIN } from '../meta';
|
|
26
|
+
import { kanbanCardWithoutPoster } from '../types';
|
|
27
|
+
|
|
28
|
+
export default () =>
|
|
29
|
+
contributes(Capabilities.ReactSurface, [
|
|
30
|
+
//
|
|
31
|
+
// Specific schema types.
|
|
32
|
+
//
|
|
33
|
+
createSurface({
|
|
34
|
+
id: `${PREVIEW_PLUGIN}/schema-popover--contact`,
|
|
35
|
+
role: ['popover', 'card--kanban', 'card'],
|
|
36
|
+
filter: (data): data is { subject: DataType.Person } => isInstanceOf(DataType.Person, data.subject),
|
|
37
|
+
component: ({ data, role }) => {
|
|
38
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
39
|
+
const handleOrgClick = useCallback(
|
|
40
|
+
async (org: DataType.Organization) => {
|
|
41
|
+
const space = getSpace(org);
|
|
42
|
+
const tablesQuery = await space?.db.query(Filter.type(TableType)).run();
|
|
43
|
+
const currentSpaceOrgTable = tablesQuery?.objects.find((table) => {
|
|
44
|
+
return table.view?.target?.query?.typename === DataType.Organization.typename;
|
|
45
|
+
});
|
|
46
|
+
await dispatch(
|
|
47
|
+
createIntent(LayoutAction.UpdatePopover, {
|
|
48
|
+
part: 'popover',
|
|
49
|
+
options: {
|
|
50
|
+
state: false,
|
|
51
|
+
anchorId: '',
|
|
52
|
+
},
|
|
53
|
+
}),
|
|
54
|
+
);
|
|
55
|
+
if (currentSpaceOrgTable) {
|
|
56
|
+
return dispatch(
|
|
57
|
+
createIntent(LayoutAction.Open, {
|
|
58
|
+
part: 'main',
|
|
59
|
+
subject: [fullyQualifiedId(currentSpaceOrgTable)],
|
|
60
|
+
options: { workspace: space?.id },
|
|
61
|
+
}),
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
[dispatch],
|
|
66
|
+
);
|
|
67
|
+
return (
|
|
68
|
+
<ContactCard subject={data.subject} onOrgClick={handleOrgClick} role={role}>
|
|
69
|
+
{role === 'popover' && <Surface role='related' data={data} />}
|
|
70
|
+
</ContactCard>
|
|
71
|
+
);
|
|
72
|
+
},
|
|
73
|
+
}),
|
|
74
|
+
createSurface({
|
|
75
|
+
id: `${PREVIEW_PLUGIN}/schema-popover--organization`,
|
|
76
|
+
role: ['popover', 'card--kanban', 'card'],
|
|
77
|
+
filter: (data): data is { subject: DataType.Organization } => isInstanceOf(DataType.Organization, data.subject),
|
|
78
|
+
component: ({ data, role }) => (
|
|
79
|
+
<OrganizationCard subject={data.subject} role={role}>
|
|
80
|
+
{role === 'popover' && <Surface role='related' data={data} />}
|
|
81
|
+
</OrganizationCard>
|
|
82
|
+
),
|
|
83
|
+
}),
|
|
84
|
+
createSurface({
|
|
85
|
+
id: `${PREVIEW_PLUGIN}/schema-popover--project`,
|
|
86
|
+
role: ['popover', 'card--kanban', 'card'],
|
|
87
|
+
filter: (data): data is { subject: DataType.Project } => isInstanceOf(DataType.Project, data.subject),
|
|
88
|
+
component: ({ data, role }) => <ProjectCard subject={data.subject} role={role} />,
|
|
89
|
+
}),
|
|
90
|
+
|
|
91
|
+
//
|
|
92
|
+
// Fallback for any object.
|
|
93
|
+
//
|
|
94
|
+
createSurface({
|
|
95
|
+
id: `${PREVIEW_PLUGIN}/fallback-popover`,
|
|
96
|
+
role: ['popover', 'card--kanban', 'card'],
|
|
97
|
+
position: 'fallback',
|
|
98
|
+
filter: (data): data is { subject: AnyLiveObject<any> } => isEchoObject(data.subject),
|
|
99
|
+
component: ({ data, role }) => {
|
|
100
|
+
const schema = getSchema(data.subject);
|
|
101
|
+
const { t } = useTranslation(PREVIEW_PLUGIN);
|
|
102
|
+
if (!schema) {
|
|
103
|
+
return <p className={descriptionMessage}>{t('unable to create preview message')}</p>;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const handleSave = useCallback((values: any, { changed }: { changed: Record<string, boolean> }) => {
|
|
107
|
+
const changedPaths = Object.keys(changed).filter((path) => changed[path]);
|
|
108
|
+
for (const path of changedPaths) {
|
|
109
|
+
const value = values[path];
|
|
110
|
+
setValue(data.subject, path as JsonPath, value);
|
|
111
|
+
}
|
|
112
|
+
}, []);
|
|
113
|
+
|
|
114
|
+
return (
|
|
115
|
+
<Form
|
|
116
|
+
schema={schema}
|
|
117
|
+
values={data.subject}
|
|
118
|
+
readonly={role === 'popover'}
|
|
119
|
+
onSave={handleSave}
|
|
120
|
+
autoSave
|
|
121
|
+
{...(role === 'card--kanban' && { classNames: kanbanCardWithoutPoster })}
|
|
122
|
+
/>
|
|
123
|
+
);
|
|
124
|
+
},
|
|
125
|
+
}),
|
|
126
|
+
]);
|
|
@@ -21,7 +21,7 @@ export const OrganizationCard = ({
|
|
|
21
21
|
{image ? (
|
|
22
22
|
<img className='aspect-video object-cover is-full bs-auto' src={image} alt={name} />
|
|
23
23
|
) : (
|
|
24
|
-
<div role='image' className='grid aspect-video place-items-center bg-
|
|
24
|
+
<div role='image' className='grid aspect-video place-items-center bg-inputSurface text-subdued'>
|
|
25
25
|
<Icon icon='ph--building-office--regular' size={10} />
|
|
26
26
|
</div>
|
|
27
27
|
)}
|
|
@@ -29,7 +29,13 @@ export const OrganizationCard = ({
|
|
|
29
29
|
{description && <p className={mx(previewProse, 'line-clamp-2')}>{description}</p>}
|
|
30
30
|
{website && (
|
|
31
31
|
<div role='none' className={previewChrome}>
|
|
32
|
-
<a
|
|
32
|
+
<a
|
|
33
|
+
className='dx-button dx-focus-ring gap-2'
|
|
34
|
+
data-variant='ghost'
|
|
35
|
+
href={website}
|
|
36
|
+
target='_blank'
|
|
37
|
+
rel='noreferrer'
|
|
38
|
+
>
|
|
33
39
|
<Icon icon='ph--link--regular' size={5} classNames='text-subdued' />
|
|
34
40
|
<span className='grow'>{website}</span>
|
|
35
41
|
<Icon icon='ph--arrow-square-out--regular' />
|
package/src/types.ts
CHANGED
|
@@ -32,7 +32,7 @@ export type PreviewProps<T extends object> = PropsWithChildren<
|
|
|
32
32
|
* </Card.Body>
|
|
33
33
|
* </Card.Root>
|
|
34
34
|
*/
|
|
35
|
-
export const popoverCard = 'popover-
|
|
35
|
+
export const popoverCard = 'popover-card-width rounded-lg overflow-hidden';
|
|
36
36
|
export const defaultCard = '';
|
|
37
37
|
export const kanbanCardWithoutPoster = 'pbs-[--rail-action]';
|
|
38
38
|
export const previewTitle = 'text-lg font-medium line-clamp-2';
|