@dxos/react-ui 0.3.3-main.76bfae3 → 0.3.3-main.8043a2f
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/types/src/components/Card/Card.stories.d.ts +0 -1
- package/dist/types/src/components/Card/Card.stories.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/components/Card/Card.stories.tsx +32 -27
- package/dist/types/src/components/Card/testing.d.ts +0 -9
- package/dist/types/src/components/Card/testing.d.ts.map +0 -1
- package/src/components/Card/testing.ts +0 -90
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Card/Card.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,YAAY,CAAC;AAMpB,OAAO,KAAoD,MAAM,OAAO,CAAC
|
|
1
|
+
{"version":3,"file":"Card.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Card/Card.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,YAAY,CAAC;AAMpB,OAAO,KAAoD,MAAM,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBA+L7D,GAAG;;;;;AAHf,wBAiBE;AAEF,eAAO,MAAM,SAAS,mBAA2B,CAAC;AAClD,eAAO,MAAM,QAAQ,mBAA8B,CAAC;AACpD,eAAO,MAAM,QAAQ,mBAA8B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui",
|
|
3
|
-
"version": "0.3.3-main.
|
|
3
|
+
"version": "0.3.3-main.8043a2f",
|
|
4
4
|
"description": "Opinionated, styled, low-level React components for DXOS.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
"jdenticon": "^3.2.0",
|
|
41
41
|
"keyborg": "^2.0.0",
|
|
42
42
|
"react-i18next": "^11.18.6",
|
|
43
|
-
"@dxos/react-hooks": "0.3.3-main.
|
|
44
|
-
"@dxos/react-input": "0.3.3-main.
|
|
45
|
-
"@dxos/react-list": "0.3.3-main.
|
|
46
|
-
"@dxos/react-ui-types": "0.3.3-main.
|
|
43
|
+
"@dxos/react-hooks": "0.3.3-main.8043a2f",
|
|
44
|
+
"@dxos/react-input": "0.3.3-main.8043a2f",
|
|
45
|
+
"@dxos/react-list": "0.3.3-main.8043a2f",
|
|
46
|
+
"@dxos/react-ui-types": "0.3.3-main.8043a2f"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@dnd-kit/core": "^6.0.5",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"react-dom": "^18.2.0",
|
|
59
59
|
"vite": "^4.3.9",
|
|
60
60
|
"vite-plugin-turbosnap": "^1.0.2",
|
|
61
|
-
"@dxos/react-ui-theme": "0.3.3-main.
|
|
61
|
+
"@dxos/react-ui-theme": "0.3.3-main.8043a2f"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
64
|
"@phosphor-icons/react": "^2.0.5",
|
|
@@ -13,7 +13,6 @@ import React, { type FC, type PropsWithChildren, useState } from 'react';
|
|
|
13
13
|
import { chromeSurface, mx } from '@dxos/react-ui-theme';
|
|
14
14
|
|
|
15
15
|
import { Card } from './Card';
|
|
16
|
-
import { testImages } from './testing';
|
|
17
16
|
import { DensityProvider } from '../DensityProvider';
|
|
18
17
|
import { DropdownMenu } from '../DropdownMenu';
|
|
19
18
|
import { Input } from '../Input';
|
|
@@ -21,9 +20,16 @@ import { ScrollArea } from '../ScrollArea';
|
|
|
21
20
|
|
|
22
21
|
faker.seed(1);
|
|
23
22
|
|
|
24
|
-
//
|
|
25
|
-
// TODO(burdon):
|
|
26
|
-
|
|
23
|
+
// https://unsplash.com
|
|
24
|
+
// TODO(burdon): Use https://picsum.photos
|
|
25
|
+
const testImages = [
|
|
26
|
+
'https://images.unsplash.com/photo-1616394158624-a2ba9cfe2994',
|
|
27
|
+
'https://images.unsplash.com/photo-1507941097613-9f2157b69235',
|
|
28
|
+
'https://images.unsplash.com/photo-1431274172761-fca41d930114',
|
|
29
|
+
'https://images.unsplash.com/photo-1513635269975-59663e0ac1ad',
|
|
30
|
+
'https://images.unsplash.com/photo-1564221710304-0b37c8b9d729',
|
|
31
|
+
'https://images.unsplash.com/photo-1605425183435-25b7e99104a4',
|
|
32
|
+
];
|
|
27
33
|
|
|
28
34
|
type CardData = {
|
|
29
35
|
id: string;
|
|
@@ -92,7 +98,7 @@ const DraggableStory: FC<PropsWithChildren> = ({ children }) => {
|
|
|
92
98
|
<DndContext onDragEnd={handleDragEnd}>
|
|
93
99
|
<SortableContext items={cards.map(({ id }) => id)} strategy={verticalListSortingStrategy}>
|
|
94
100
|
<div className='flex flex-col overflow-y-scroll'>
|
|
95
|
-
<div className='flex flex-col
|
|
101
|
+
<div className='flex flex-col gap-4'>
|
|
96
102
|
{cards.map((card) => (
|
|
97
103
|
<DraggableCard key={card.id} data={card} onDelete={handleDelete} />
|
|
98
104
|
))}
|
|
@@ -105,8 +111,8 @@ const DraggableStory: FC<PropsWithChildren> = ({ children }) => {
|
|
|
105
111
|
|
|
106
112
|
const ReadonlyCardStory = () => {
|
|
107
113
|
return (
|
|
108
|
-
<div className='flex flex-col overflow-y-scroll
|
|
109
|
-
<div className='flex flex-col gap-
|
|
114
|
+
<div className='flex flex-col overflow-y-scroll'>
|
|
115
|
+
<div className='flex flex-col gap-4'>
|
|
110
116
|
<Card.Root square noPadding>
|
|
111
117
|
<Card.Header floating>
|
|
112
118
|
<Card.DragHandle position='left' />
|
|
@@ -173,35 +179,34 @@ const ReadonlyCardStory = () => {
|
|
|
173
179
|
|
|
174
180
|
const EditableCardStory = () => {
|
|
175
181
|
return (
|
|
176
|
-
<div className='flex flex-col
|
|
177
|
-
<
|
|
178
|
-
<Card.
|
|
179
|
-
<Card.
|
|
180
|
-
|
|
181
|
-
<Input.
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
</Card.Root>
|
|
190
|
-
</div>
|
|
182
|
+
<div className='flex flex-col h-full justify-center'>
|
|
183
|
+
<Card.Root>
|
|
184
|
+
<Card.Header>
|
|
185
|
+
<Card.DragHandle />
|
|
186
|
+
<Input.Root>
|
|
187
|
+
<Input.TextInput classNames={'-mx-2 px-2'} variant='subdued' placeholder={'Title'} />
|
|
188
|
+
</Input.Root>
|
|
189
|
+
<Card.Menu />
|
|
190
|
+
</Card.Header>
|
|
191
|
+
<Card.Body gutter classNames={'gap-2 text-sm font-thin'}>
|
|
192
|
+
{faker.lorem.sentences()}
|
|
193
|
+
</Card.Body>
|
|
194
|
+
</Card.Root>
|
|
191
195
|
</div>
|
|
192
196
|
);
|
|
193
197
|
};
|
|
194
198
|
|
|
195
199
|
export default {
|
|
196
200
|
component: Card,
|
|
197
|
-
args: {},
|
|
198
201
|
decorators: [
|
|
199
202
|
(Story: any) => (
|
|
200
203
|
<div className={mx('flex h-screen w-full justify-center overflow-hidden', chromeSurface)}>
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
<
|
|
204
|
-
|
|
204
|
+
<div className='flex flex-col w-[360px] overflow-hidden'>
|
|
205
|
+
{/* TODO(burdon): Story for different densities. */}
|
|
206
|
+
<DensityProvider density='fine'>
|
|
207
|
+
<Story />
|
|
208
|
+
</DensityProvider>
|
|
209
|
+
</div>
|
|
205
210
|
</div>
|
|
206
211
|
),
|
|
207
212
|
],
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
type CardType = 'document' | 'message' | 'contact' | 'image' | 'event' | 'project' | 'task' | 'result' | 'table';
|
|
2
|
-
export declare const testImages: string[];
|
|
3
|
-
type Data = {
|
|
4
|
-
id: string;
|
|
5
|
-
type: string;
|
|
6
|
-
};
|
|
7
|
-
export declare const generators: Record<CardType, () => Data & Record<string, any>>;
|
|
8
|
-
export {};
|
|
9
|
-
//# sourceMappingURL=testing.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../../../../../src/components/Card/testing.ts"],"names":[],"mappings":"AAQA,KAAK,QAAQ,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAIjH,eAAO,MAAM,UAAU,UAQtB,CAAC;AAEF,KAAK,IAAI,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzC,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAiEzE,CAAC"}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { faker } from '@faker-js/faker';
|
|
6
|
-
|
|
7
|
-
// TODO(burdon): Standardize with mosaic.
|
|
8
|
-
|
|
9
|
-
type CardType = 'document' | 'message' | 'contact' | 'image' | 'event' | 'project' | 'task' | 'result' | 'table';
|
|
10
|
-
|
|
11
|
-
// https://unsplash.com
|
|
12
|
-
// TODO(burdon): Use https://picsum.photos/
|
|
13
|
-
export const testImages = [
|
|
14
|
-
// 'https://images.unsplash.com/photo-1554629947-334ff61d85dc',
|
|
15
|
-
'https://images.unsplash.com/photo-1616394158624-a2ba9cfe2994',
|
|
16
|
-
'https://images.unsplash.com/photo-1507941097613-9f2157b69235',
|
|
17
|
-
'https://images.unsplash.com/photo-1431274172761-fca41d930114',
|
|
18
|
-
'https://images.unsplash.com/photo-1513635269975-59663e0ac1ad',
|
|
19
|
-
'https://images.unsplash.com/photo-1564221710304-0b37c8b9d729',
|
|
20
|
-
'https://images.unsplash.com/photo-1605425183435-25b7e99104a4',
|
|
21
|
-
];
|
|
22
|
-
|
|
23
|
-
type Data = { id: string; type: string };
|
|
24
|
-
|
|
25
|
-
export const generators: Record<CardType, () => Data & Record<string, any>> = {
|
|
26
|
-
document: () => ({
|
|
27
|
-
type: 'document',
|
|
28
|
-
id: faker.string.uuid(),
|
|
29
|
-
title: faker.lorem.sentence(),
|
|
30
|
-
body: faker.lorem.sentences({ min: 1, max: faker.number.int({ min: 1, max: 3 }) }),
|
|
31
|
-
}),
|
|
32
|
-
|
|
33
|
-
// TODO(burdon): Timestamp.
|
|
34
|
-
message: () => ({
|
|
35
|
-
type: 'message',
|
|
36
|
-
id: faker.string.uuid(),
|
|
37
|
-
from: faker.internet.userName(),
|
|
38
|
-
body: faker.lorem.sentence(),
|
|
39
|
-
}),
|
|
40
|
-
|
|
41
|
-
// TODO(burdon): Avatar.
|
|
42
|
-
contact: () => ({
|
|
43
|
-
type: 'contact',
|
|
44
|
-
id: faker.string.uuid(),
|
|
45
|
-
name: faker.person.fullName(),
|
|
46
|
-
username: faker.internet.userName(),
|
|
47
|
-
email: faker.internet.email(),
|
|
48
|
-
}),
|
|
49
|
-
|
|
50
|
-
image: () => ({
|
|
51
|
-
type: 'image',
|
|
52
|
-
id: faker.string.uuid(),
|
|
53
|
-
image: faker.helpers.arrayElement(testImages),
|
|
54
|
-
body: faker.datatype.boolean() ? faker.lorem.sentences() : undefined,
|
|
55
|
-
}),
|
|
56
|
-
|
|
57
|
-
event: () => ({
|
|
58
|
-
type: 'event',
|
|
59
|
-
id: faker.string.uuid(),
|
|
60
|
-
name: faker.commerce.productName(),
|
|
61
|
-
date: faker.date.recent(),
|
|
62
|
-
}),
|
|
63
|
-
|
|
64
|
-
project: () => ({
|
|
65
|
-
type: 'project',
|
|
66
|
-
id: faker.string.uuid(),
|
|
67
|
-
name: faker.commerce.productName(),
|
|
68
|
-
body: faker.lorem.sentences({ min: 1, max: faker.number.int({ min: 1, max: 3 }) }),
|
|
69
|
-
tasks: Array.from({ length: faker.number.int(5) }).map(() => generators.task()),
|
|
70
|
-
}),
|
|
71
|
-
|
|
72
|
-
task: () => ({
|
|
73
|
-
type: 'task',
|
|
74
|
-
id: faker.string.uuid(),
|
|
75
|
-
done: faker.datatype.boolean(),
|
|
76
|
-
title: faker.lorem.sentence(),
|
|
77
|
-
}),
|
|
78
|
-
|
|
79
|
-
// TODO(burdon): Search result.
|
|
80
|
-
result: () => ({
|
|
81
|
-
type: 'result',
|
|
82
|
-
id: faker.string.uuid(),
|
|
83
|
-
}),
|
|
84
|
-
|
|
85
|
-
// TODO(burdon): Generic data.
|
|
86
|
-
table: () => ({
|
|
87
|
-
type: 'table',
|
|
88
|
-
id: faker.string.uuid(),
|
|
89
|
-
}),
|
|
90
|
-
};
|