@dxos/plugin-preview 0.8.3 → 0.8.4-main.1c7ec43d41
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 +16 -53
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/plugin.mjs +25 -0
- package/dist/lib/browser/plugin.mjs.map +7 -0
- package/dist/lib/browser/translations.mjs +21 -0
- package/dist/lib/browser/translations.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +16 -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/plugin.mjs +27 -0
- package/dist/lib/node-esm/plugin.mjs.map +7 -0
- 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 +3 -1
- package/dist/types/src/PreviewPlugin.d.ts.map +1 -1
- package/dist/types/src/PreviewPlugin.node.d.ts +4 -0
- package/dist/types/src/PreviewPlugin.node.d.ts.map +1 -0
- package/dist/types/src/PreviewPlugin.test.d.ts +2 -0
- package/dist/types/src/PreviewPlugin.test.d.ts.map +1 -0
- 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 +2 -2
- 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/plugin.d.ts +2 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- 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 +11 -6
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +67 -33
- package/src/PreviewPlugin.node.ts +16 -0
- package/src/PreviewPlugin.test.ts +25 -0
- package/src/PreviewPlugin.tsx +19 -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 +6 -3
- package/src/meta.ts +8 -5
- package/src/plugin.ts +7 -0
- package/src/stories/Card.stories.tsx +121 -0
- package/src/stories/testing.tsx +101 -0
- package/src/translations.ts +13 -5
- package/dist/lib/browser/chunk-LFAK2TMG.mjs +0 -14
- package/dist/lib/browser/chunk-LFAK2TMG.mjs.map +0 -7
- package/dist/lib/browser/preview-popover-NRFVC4QQ.mjs +0 -69
- package/dist/lib/browser/preview-popover-NRFVC4QQ.mjs.map +0 -7
- package/dist/lib/browser/react-surface-J2R6Q33B.mjs +0 -272
- package/dist/lib/browser/react-surface-J2R6Q33B.mjs.map +0 -7
- package/dist/lib/node/chunk-XGHMBEIV.cjs +0 -37
- package/dist/lib/node/chunk-XGHMBEIV.cjs.map +0 -7
- package/dist/lib/node/index.cjs +0 -85
- package/dist/lib/node/index.cjs.map +0 -7
- package/dist/lib/node/meta.json +0 -1
- package/dist/lib/node/preview-popover-HIXRYF6L.cjs +0 -88
- package/dist/lib/node/preview-popover-HIXRYF6L.cjs.map +0 -7
- package/dist/lib/node/react-surface-ZSNNAKBG.cjs +0 -290
- package/dist/lib/node/react-surface-ZSNNAKBG.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-7BPXNL44.mjs +0 -16
- package/dist/lib/node-esm/chunk-7BPXNL44.mjs.map +0 -7
- package/dist/lib/node-esm/preview-popover-HBGSL64N.mjs +0 -71
- package/dist/lib/node-esm/preview-popover-HBGSL64N.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-UKEVHG5K.mjs +0 -273
- package/dist/lib/node-esm/react-surface-UKEVHG5K.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,70 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { Fragment } from 'react';
|
|
6
|
-
|
|
7
|
-
import { Icon, Avatar, Button } from '@dxos/react-ui';
|
|
8
|
-
import { Card, cardHeading, cardText } from '@dxos/react-ui-stack';
|
|
9
|
-
import { mx } from '@dxos/react-ui-theme';
|
|
10
|
-
import { type DataType } from '@dxos/schema';
|
|
11
|
-
|
|
12
|
-
import { type PreviewProps } from '../types';
|
|
13
|
-
|
|
14
|
-
export const ContactCard = ({
|
|
15
|
-
children,
|
|
16
|
-
subject: { fullName, image, organization, emails },
|
|
17
|
-
onOrgClick,
|
|
18
|
-
role,
|
|
19
|
-
}: PreviewProps<DataType.Person> & { onOrgClick?: (org: DataType.Organization) => void }) => {
|
|
20
|
-
const organizationName = organization && typeof organization === 'object' ? organization.target?.name : organization;
|
|
21
|
-
return (
|
|
22
|
-
<Card.Container role={role}>
|
|
23
|
-
<Avatar.Root>
|
|
24
|
-
<Card.Text role='group' classNames='grid gap-3 grid-cols-[min-content_1fr]'>
|
|
25
|
-
<Avatar.Content imgSrc={image} icon='ph--user--regular' size={16} hue='neutral' />
|
|
26
|
-
<div role='none' className='bs-min self-center'>
|
|
27
|
-
<Avatar.Label asChild>
|
|
28
|
-
<h2 className={cardHeading}>{fullName}</h2>
|
|
29
|
-
</Avatar.Label>
|
|
30
|
-
</div>
|
|
31
|
-
</Card.Text>
|
|
32
|
-
</Avatar.Root>
|
|
33
|
-
{organizationName && (
|
|
34
|
-
<Card.Chrome>
|
|
35
|
-
{typeof organization === 'object' && onOrgClick ? (
|
|
36
|
-
<Button variant='ghost' classNames='gap-2 text-start' onClick={() => onOrgClick(organization.target!)}>
|
|
37
|
-
<Icon icon='ph--buildings--regular' size={5} classNames='text-subdued' />
|
|
38
|
-
<span className='min-is-0 flex-1 truncate'>{organizationName}</span>
|
|
39
|
-
<Icon icon='ph--arrow-right--regular' />
|
|
40
|
-
</Button>
|
|
41
|
-
) : (
|
|
42
|
-
<p className='dx-button gap-2' data-variant='ghost'>
|
|
43
|
-
<Icon icon='ph--buildings--regular' size={5} classNames='text-subdued' />
|
|
44
|
-
<span className='min-is-0 flex-1 truncate'>{organizationName}</span>
|
|
45
|
-
</p>
|
|
46
|
-
)}
|
|
47
|
-
</Card.Chrome>
|
|
48
|
-
)}
|
|
49
|
-
<dl
|
|
50
|
-
className={mx(
|
|
51
|
-
cardText,
|
|
52
|
-
'grid gap-2 grid-cols-[min-content_1fr] [&_dt]:text-subdued [&_dt]:pbs-0.5 [&_dd]:min-is-0',
|
|
53
|
-
)}
|
|
54
|
-
>
|
|
55
|
-
{emails?.length &&
|
|
56
|
-
emails.map(({ label, value }) => (
|
|
57
|
-
<Fragment key={value}>
|
|
58
|
-
<dt>
|
|
59
|
-
<Icon icon='ph--at--regular' size={5} />
|
|
60
|
-
</dt>
|
|
61
|
-
<dd key={value} className='break-words'>
|
|
62
|
-
{value}
|
|
63
|
-
</dd>
|
|
64
|
-
</Fragment>
|
|
65
|
-
))}
|
|
66
|
-
</dl>
|
|
67
|
-
{children}
|
|
68
|
-
</Card.Container>
|
|
69
|
-
);
|
|
70
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
|
|
7
|
-
import { Icon } from '@dxos/react-ui';
|
|
8
|
-
import { Card } from '@dxos/react-ui-stack';
|
|
9
|
-
import { type DataType } from '@dxos/schema';
|
|
10
|
-
|
|
11
|
-
import { type PreviewProps } from '../types';
|
|
12
|
-
|
|
13
|
-
export const OrganizationCard = ({
|
|
14
|
-
children,
|
|
15
|
-
subject: { name, image, description, website },
|
|
16
|
-
role,
|
|
17
|
-
}: PreviewProps<DataType.Organization>) => {
|
|
18
|
-
return (
|
|
19
|
-
<Card.Container role={role}>
|
|
20
|
-
<Card.Poster alt={name!} {...(image ? { image } : { icon: 'ph--building-office--regular' })} />
|
|
21
|
-
<Card.Heading>{name}</Card.Heading>
|
|
22
|
-
{description && <Card.Text classNames='line-clamp-2'>{description}</Card.Text>}
|
|
23
|
-
{website && (
|
|
24
|
-
<Card.Chrome>
|
|
25
|
-
<a
|
|
26
|
-
className='dx-button dx-focus-ring gap-2'
|
|
27
|
-
data-variant='ghost'
|
|
28
|
-
href={website}
|
|
29
|
-
target='_blank'
|
|
30
|
-
rel='noreferrer'
|
|
31
|
-
>
|
|
32
|
-
<Icon icon='ph--link--regular' size={5} classNames='text-subdued' />
|
|
33
|
-
<span className='grow'>{website}</span>
|
|
34
|
-
<Icon icon='ph--arrow-square-out--regular' />
|
|
35
|
-
</a>
|
|
36
|
-
</Card.Chrome>
|
|
37
|
-
)}
|
|
38
|
-
{children}
|
|
39
|
-
</Card.Container>
|
|
40
|
-
);
|
|
41
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
|
|
7
|
-
import { Card } from '@dxos/react-ui-stack';
|
|
8
|
-
import { type DataType } from '@dxos/schema';
|
|
9
|
-
|
|
10
|
-
import { type PreviewProps } from '../types';
|
|
11
|
-
|
|
12
|
-
export const ProjectCard = ({ subject: { name, image, description }, role }: PreviewProps<DataType.Project>) => {
|
|
13
|
-
return (
|
|
14
|
-
<Card.Container role={role}>
|
|
15
|
-
{image && <Card.Poster image={image} alt={name} aspect='auto' />}
|
|
16
|
-
<Card.Heading>{name}</Card.Heading>
|
|
17
|
-
{description && <Card.Text classNames='line-clamp-2'>{description}</Card.Text>}
|
|
18
|
-
</Card.Container>
|
|
19
|
-
);
|
|
20
|
-
};
|
package/src/components/index.ts
DELETED
package/src/types.ts
DELETED