@bridgebrew/design-system 0.0.0-stage → 0.1.9
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/README.md +21 -2
- package/browser.tsx +227 -0
- package/design-system.css +110 -0
- package/e2e.test.ts +253 -0
- package/highlight.ts +29 -0
- package/model.test.ts +69 -0
- package/package.json +72 -3
- package/stories/action.tsx +101 -0
- package/stories/data-display.tsx +371 -0
- package/stories/feedback.tsx +109 -0
- package/stories/foundations.tsx +157 -0
- package/stories/input.tsx +851 -0
- package/stories/interaction.tsx +76 -0
- package/stories/layout.tsx +510 -0
- package/stories/navigation.tsx +220 -0
- package/stories/overlay.tsx +293 -0
- package/stories/parts.tsx +201 -0
- package/stories.ts +149 -0
- package/tsconfig.json +20 -0
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
// Data display: marks, chips, rows and tables.
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import {
|
|
4
|
+
Avatar, Badge, Button, Collapsible, CollapsiblePanel, CollapsibleTrigger, CollapsibleRows, FilterChip, Kbd, TagDot, TagList, TagPill, ExpandToggle, GroupHeader, Icon, ICON_NAMES, Input, Label, List, ListGroup,
|
|
5
|
+
ListItem, Picker, Properties, PropertyRow, StatusIcon, Table, TableBody, TableCell, TableFooter, TableHead, TableHeader,
|
|
6
|
+
TableRow, type StatusIconStatus,
|
|
7
|
+
Thumbnail,
|
|
8
|
+
} from '@bridge/ui';
|
|
9
|
+
import { Code, Group, Sample, Wide, organizations, people } from './parts.tsx';
|
|
10
|
+
|
|
11
|
+
const avatarSizes = ['xs', 'sm', 'default', 'lg', 'xl', '2xl', '3xl'] as const;
|
|
12
|
+
|
|
13
|
+
function AvatarStory() {
|
|
14
|
+
return (
|
|
15
|
+
<>
|
|
16
|
+
<Group title="Sizes" description="16 to 64px; initials at about 0.38 of the side." code={`{avatarSizes.map((size) => <Sample key={size} title={size}><Avatar name="Ada Lindqvist" size={size} tint /></Sample>)}`}>
|
|
17
|
+
{avatarSizes.map((size) => <Sample key={size} title={size}><Avatar name="Ada Lindqvist" size={size} tint /></Sample>)}
|
|
18
|
+
</Group>
|
|
19
|
+
<Group title="Variants" code={`<Avatar name="Bruno Okafor" size="xl" />\n<Avatar name="Bruno Okafor" size="xl" tint />\n<Avatar name="Northwind" size="xl" shape="square" tint />\n<Avatar name="Tessera" size="xl" shape="square" tint />\n<Avatar name="🚀 Launch" size="xl" tint />`}>
|
|
20
|
+
<Sample title="neutral" description="The default grey"><Avatar name="Bruno Okafor" size="xl" /></Sample>
|
|
21
|
+
<Sample title="tint" description="A calm hue from the name"><Avatar name="Bruno Okafor" size="xl" tint /></Sample>
|
|
22
|
+
<Sample title="square" description="An organization"><Avatar name="Northwind" size="xl" shape="square" tint /></Sample>
|
|
23
|
+
<Sample title="one word" description="One initial"><Avatar name="Tessera" size="xl" shape="square" tint /></Sample>
|
|
24
|
+
<Sample title="emoji" description="Whole code points"><Avatar name="🚀 Launch" size="xl" tint /></Sample>
|
|
25
|
+
</Group>
|
|
26
|
+
<Group title="Examples" description="Every name keeps its hue, in light and dark." layout="stack" code={`{people.slice(0, 14).map((name) => <Avatar key={name} name={name} size="xl" tint />)}\n{organizations.slice(0, 14).map((name) => <Avatar key={name} name={name} size="xl" shape="square" tint />)}`}>
|
|
27
|
+
<Sample title="people" wide>{people.slice(0, 14).map((name) => <Avatar key={name} name={name} size="xl" tint />)}</Sample>
|
|
28
|
+
<Sample title="organizations" wide>{organizations.slice(0, 14).map((name) => <Avatar key={name} name={name} size="xl" shape="square" tint />)}</Sample>
|
|
29
|
+
</Group>
|
|
30
|
+
</>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function BadgeStory() {
|
|
35
|
+
return (
|
|
36
|
+
<>
|
|
37
|
+
<Group title="Content" code={`<Badge>3</Badge><Badge>12</Badge><Badge>128</Badge>\n<Badge>Archived</Badge><Badge>Beta</Badge>\n<Badge><Icon name="star" size={10} /></Badge><Badge><Icon name="check" size={10} />Synced</Badge>\n<Badge />`}>
|
|
38
|
+
<Sample title="count"><Badge>3</Badge><Badge>12</Badge><Badge>128</Badge></Sample>
|
|
39
|
+
<Sample title="text"><Badge>Archived</Badge><Badge>Beta</Badge></Sample>
|
|
40
|
+
<Sample title="icon"><Badge><Icon name="star" size={10} /></Badge><Badge><Icon name="check" size={10} />Synced</Badge></Sample>
|
|
41
|
+
<Sample title="empty" description="An 18px dot"><Badge /></Sample>
|
|
42
|
+
</Group>
|
|
43
|
+
<Group title="Examples" layout="stack" code={`<Button variant="ghost"><Icon name="inbox" />Inbox<Badge>4</Badge></Button><Button variant="ghost"><Icon name="bell" />Notifications<Badge>23</Badge></Button>`}>
|
|
44
|
+
<Sample title="beside a title" wide><Button variant="ghost"><Icon name="inbox" />Inbox<Badge>4</Badge></Button><Button variant="ghost"><Icon name="bell" />Notifications<Badge>23</Badge></Button></Sample>
|
|
45
|
+
</Group>
|
|
46
|
+
</>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function IconStory() {
|
|
51
|
+
return (
|
|
52
|
+
<>
|
|
53
|
+
<Group title="Sizes" description="16px by default (size={…})." code={`{[12, 14, 16, 20, 24].map((size) => <Sample key={size} title={\`\${size}px\`}><Icon name="settings" size={size} /><Icon name="users" size={size} /><Icon name="calendar" size={size} /></Sample>)}`}>
|
|
54
|
+
{[12, 14, 16, 20, 24].map((size) => <Sample key={size} title={`${size}px`}><Icon name="settings" size={size} /><Icon name="users" size={size} /><Icon name="calendar" size={size} /></Sample>)}
|
|
55
|
+
</Group>
|
|
56
|
+
<Group title="Colour" description="The current text colour: inside a control, it follows the control." code={`<Button variant="ghost"><Icon name="archive" />Archive</Button>\n<Button variant="primary"><Icon name="check" />Done</Button>\n<Button variant="destructive"><Icon name="trash" />Delete</Button>\n<Button variant="property"><Icon name="calendar" />Due Friday</Button>`}>
|
|
57
|
+
<Sample title="ghost button"><Button variant="ghost"><Icon name="archive" />Archive</Button></Sample>
|
|
58
|
+
<Sample title="primary button"><Button variant="primary"><Icon name="check" />Done</Button></Sample>
|
|
59
|
+
<Sample title="destructive"><Button variant="destructive"><Icon name="trash" />Delete</Button></Sample>
|
|
60
|
+
<Sample title="property pill" description="Muted inside"><Button variant="property"><Icon name="calendar" />Due Friday</Button></Sample>
|
|
61
|
+
</Group>
|
|
62
|
+
<Group title="States" code={`<Icon name="loader-circle" className="animate-spin motion-reduce:animate-none" />\n<Icon name="not-an-icon" />\n<Icon name="book-open" />`}>
|
|
63
|
+
<Sample title="spinner" description="loader-circle with animate-spin"><Icon name="loader-circle" className="animate-spin motion-reduce:animate-none" /></Sample>
|
|
64
|
+
<Sample title="unknown name" description="Falls back to file"><Icon name="not-an-icon" /></Sample>
|
|
65
|
+
<Sample title="the set" description={`${ICON_NAMES.length} names; see Foundations › Icons`}><Icon name="book-open" /></Sample>
|
|
66
|
+
</Group>
|
|
67
|
+
</>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function LabelStory() {
|
|
72
|
+
return (
|
|
73
|
+
<>
|
|
74
|
+
<Group title="Variants" code={`<Label variant="bug">Bug</Label>\n<Label variant="feature">Feature</Label>\n<Label variant="improvement">Improvement</Label>\n<Label color="oklch(65% 0.17 300)">Research</Label><Label color="oklch(70% 0.15 60)">Ops</Label><Label color="oklch(62% 0.13 200)">Infra</Label>`}>
|
|
75
|
+
<Sample title="bug"><Label variant="bug">Bug</Label></Sample>
|
|
76
|
+
<Sample title="feature"><Label variant="feature">Feature</Label></Sample>
|
|
77
|
+
<Sample title="improvement"><Label variant="improvement">Improvement</Label></Sample>
|
|
78
|
+
<Sample title="custom colour" description="color: any CSS colour, mixed into the surface">
|
|
79
|
+
<Label color="oklch(65% 0.17 300)">Research</Label><Label color="oklch(70% 0.15 60)">Ops</Label><Label color="oklch(62% 0.13 200)">Infra</Label>
|
|
80
|
+
</Sample>
|
|
81
|
+
</Group>
|
|
82
|
+
<Group title="Examples" layout="stack" code={`<StatusIcon status="in-progress" /><Label variant="bug">Bug</Label><Label variant="feature">Sidebar</Label><Label color="oklch(65% 0.17 300)">Research</Label>`}>
|
|
83
|
+
<Sample title="on an issue row" wide>
|
|
84
|
+
<StatusIcon status="in-progress" /><Label variant="bug">Bug</Label><Label variant="feature">Sidebar</Label><Label color="oklch(65% 0.17 300)">Research</Label>
|
|
85
|
+
</Sample>
|
|
86
|
+
</Group>
|
|
87
|
+
</>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function StatusIconStory() {
|
|
92
|
+
const all: StatusIconStatus[] = ['backlog', 'todo', 'in-progress', 'in-review', 'done', 'cancelled'];
|
|
93
|
+
return (
|
|
94
|
+
<>
|
|
95
|
+
<Group title="Statuses" code={`{all.map((status) => <Sample key={status} title={status}><StatusIcon status={status} /></Sample>)}`}>
|
|
96
|
+
{all.map((status) => <Sample key={status} title={status}><StatusIcon status={status} /></Sample>)}
|
|
97
|
+
</Group>
|
|
98
|
+
<Group title="Sizes" code={`{(['sm', 'default'] as const).map((size) => <Sample key={size} title={size}>{all.map((status) => <StatusIcon key={status} status={status} size={size} />)}</Sample>)}`}>
|
|
99
|
+
{(['sm', 'default'] as const).map((size) => <Sample key={size} title={size}>{all.map((status) => <StatusIcon key={status} status={status} size={size} />)}</Sample>)}
|
|
100
|
+
</Group>
|
|
101
|
+
</>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const inbox = [
|
|
106
|
+
{ id: 'm1', from: 'Ada Lindqvist', subject: 'Pilot results are in', when: '09:41', group: 'Today' },
|
|
107
|
+
{ id: 'm2', from: 'Bruno Okafor', subject: 'Contract draft for Northwind', when: '08:15', group: 'Today' },
|
|
108
|
+
{ id: 'm3', from: 'Chloé Martin', subject: 'Design review notes', when: 'Tue', group: 'Earlier' },
|
|
109
|
+
{ id: 'm4', from: 'Dmitri Volkov', subject: 'Re: Q4 roadmap', when: 'Mon', group: 'Earlier' },
|
|
110
|
+
{ id: 'm5', from: 'Elif Şahin', subject: 'Invoice #2041', when: 'Sep 28', group: 'Earlier' },
|
|
111
|
+
];
|
|
112
|
+
|
|
113
|
+
function ListStory() {
|
|
114
|
+
const [single, setSingle] = React.useState('m2');
|
|
115
|
+
const [many, setMany] = React.useState<string[]>(['Lyon', 'Oslo']);
|
|
116
|
+
return (
|
|
117
|
+
<>
|
|
118
|
+
<Group title="Sizes" description="Each row a height; auto grows with its content." layout="grid" code={`{(['sm', 'default', 'lg', 'auto'] as const).map((size) => (\n <List aria-label={\`Rows \${size}\`} className="ds-list">\n <ListItem size={size} leading={<Avatar name="Ada Lindqvist" size={size === 'lg' ? 'xl' : 'default'} tint />} description={size === 'lg' || size === 'auto' ? 'Engineering lead' : undefined}>Ada Lindqvist</ListItem>\n <ListItem size={size} leading={<Avatar name="Bruno Okafor" size={size === 'lg' ? 'xl' : 'default'} tint />} description={size === 'lg' || size === 'auto' ? 'Account manager' : undefined}>Bruno Okafor</ListItem>\n </List>\n))}`}>
|
|
119
|
+
{(['sm', 'default', 'lg', 'auto'] as const).map((size) => (
|
|
120
|
+
<Sample key={size} title={size}>
|
|
121
|
+
<List aria-label={`Rows ${size}`} className="ds-list">
|
|
122
|
+
<ListItem size={size} leading={<Avatar name="Ada Lindqvist" size={size === 'lg' ? 'xl' : 'default'} tint />} description={size === 'lg' || size === 'auto' ? 'Engineering lead' : undefined}>Ada Lindqvist</ListItem>
|
|
123
|
+
<ListItem size={size} leading={<Avatar name="Bruno Okafor" size={size === 'lg' ? 'xl' : 'default'} tint />} description={size === 'lg' || size === 'auto' ? 'Account manager' : undefined}>Bruno Okafor</ListItem>
|
|
124
|
+
</List>
|
|
125
|
+
</Sample>
|
|
126
|
+
))}
|
|
127
|
+
</Group>
|
|
128
|
+
<Group title="States" layout="grid" code={`<List aria-label="States" selectionMode="single" selectedKey="b" className="ds-list">\n <ListItem value="a">Default</ListItem>\n <ListItem value="b">Selected</ListItem>\n <ListItem value="c" disabled>Disabled</ListItem>\n</List>\n<List aria-label="Trailing" className="ds-list">\n <ListItem trailing="09:41">Pilot results</ListItem>\n <ListItem trailing={<Badge>3</Badge>}>Mentions</ListItem>\n</List>`}>
|
|
129
|
+
<Sample title="selected and disabled">
|
|
130
|
+
<List aria-label="States" selectionMode="single" selectedKey="b" className="ds-list">
|
|
131
|
+
<ListItem value="a">Default</ListItem>
|
|
132
|
+
<ListItem value="b">Selected</ListItem>
|
|
133
|
+
<ListItem value="c" disabled>Disabled</ListItem>
|
|
134
|
+
</List>
|
|
135
|
+
</Sample>
|
|
136
|
+
<Sample title="trailing" description="A muted date, a count, a badge">
|
|
137
|
+
<List aria-label="Trailing" className="ds-list">
|
|
138
|
+
<ListItem trailing="09:41">Pilot results</ListItem>
|
|
139
|
+
<ListItem trailing={<Badge>3</Badge>}>Mentions</ListItem>
|
|
140
|
+
</List>
|
|
141
|
+
</Sample>
|
|
142
|
+
</Group>
|
|
143
|
+
<Group title="Groups" description="A header above each group, sticky while its rows scroll." layout="grid" code={`<List aria-label="Contacts by letter" className="ds-list">\n {Object.entries({ A: ['Ada Lindqvist', 'Amara Diallo'], B: ['Bruno Okafor'] }).map(([letter, names]) => (\n <ListGroup key={letter} label={letter}>\n {names.map((name) => <ListItem key={name} leading={<Avatar name={name} tint />}>{name}</ListItem>)}\n </ListGroup>\n ))}\n</List>\n<List aria-label="Components by category" className="ds-list">\n {Object.entries({ Input: ['Checkbox', 'Select'], Navigation: ['Breadcrumb', 'Tabs'] }).map(([category, names]) => (\n <ListGroup key={category} label={category} variant="section">\n {names.map((name) => <ListItem key={name} size="sm">{name}</ListItem>)}\n </ListGroup>\n ))}\n</List>`}>
|
|
144
|
+
<Sample title="index" description="The default: a quiet letter between the rows">
|
|
145
|
+
<List aria-label="Contacts by letter" className="ds-list">
|
|
146
|
+
{Object.entries({ A: ['Ada Lindqvist', 'Amara Diallo'], B: ['Bruno Okafor'] }).map(([letter, names]) => (
|
|
147
|
+
<ListGroup key={letter} label={letter}>
|
|
148
|
+
{names.map((name) => <ListItem key={name} leading={<Avatar name={name} tint />}>{name}</ListItem>)}
|
|
149
|
+
</ListGroup>
|
|
150
|
+
))}
|
|
151
|
+
</List>
|
|
152
|
+
</Sample>
|
|
153
|
+
<Sample title="section" description="A section title in a navigation list">
|
|
154
|
+
<List aria-label="Components by category" className="ds-list">
|
|
155
|
+
{Object.entries({ Input: ['Checkbox', 'Select'], Navigation: ['Breadcrumb', 'Tabs'] }).map(([category, names]) => (
|
|
156
|
+
<ListGroup key={category} label={category} variant="section">
|
|
157
|
+
{names.map((name) => <ListItem key={name} size="sm">{name}</ListItem>)}
|
|
158
|
+
</ListGroup>
|
|
159
|
+
))}
|
|
160
|
+
</List>
|
|
161
|
+
</Sample>
|
|
162
|
+
</Group>
|
|
163
|
+
<Group title="Examples" description="Click, or focus the list and use ↑ ↓ Home End; selection follows focus." layout="columns" code={`<Sample title="single, grouped" description={\`Open: \${inbox.find((each) => each.id === single)?.subject}\`}>\n <List aria-label="Inbox" selectionMode="single" selectionFollowsFocus selectedKey={single} onSelectionChange={([id]) => { if (id) setSingle(id); }} className="ds-list">\n {['Today', 'Earlier'].map((group) => (\n <ListGroup key={group} label={group}>\n {inbox.filter((each) => each.group === group).map((each) => (\n <ListItem key={each.id} value={each.id} textValue={each.from} leading={<Avatar name={each.from} size="xl" tint />} description={each.subject} trailing={each.when}>{each.from}</ListItem>\n ))}\n </ListGroup>\n ))}\n </List>\n <List aria-label="Offices" selectionMode="multiple" selectedKeys={many} onSelectionChange={setMany} className="ds-list">\n {['Lyon', 'Oslo', 'Porto', 'Prague', 'Vienna'].map((city) => <ListItem key={city} value={city} leading={<Icon name="map-pin" size={14} />}>{city}</ListItem>)}\n </List>`}>
|
|
164
|
+
<Sample title="single, grouped" description={`Open: ${inbox.find((each) => each.id === single)?.subject}`}>
|
|
165
|
+
<List aria-label="Inbox" selectionMode="single" selectionFollowsFocus selectedKey={single} onSelectionChange={([id]) => { if (id) setSingle(id); }} className="ds-list">
|
|
166
|
+
{['Today', 'Earlier'].map((group) => (
|
|
167
|
+
<ListGroup key={group} label={group}>
|
|
168
|
+
{inbox.filter((each) => each.group === group).map((each) => (
|
|
169
|
+
<ListItem key={each.id} value={each.id} textValue={each.from} leading={<Avatar name={each.from} size="xl" tint />} description={each.subject} trailing={each.when}>{each.from}</ListItem>
|
|
170
|
+
))}
|
|
171
|
+
</ListGroup>
|
|
172
|
+
))}
|
|
173
|
+
</List>
|
|
174
|
+
</Sample>
|
|
175
|
+
<Sample title="multiple" description={`${many.length} selected: ${many.join(', ') || 'none'}`}>
|
|
176
|
+
<List aria-label="Offices" selectionMode="multiple" selectedKeys={many} onSelectionChange={setMany} className="ds-list">
|
|
177
|
+
{['Lyon', 'Oslo', 'Porto', 'Prague', 'Vienna'].map((city) => <ListItem key={city} value={city} leading={<Icon name="map-pin" size={14} />}>{city}</ListItem>)}
|
|
178
|
+
</List>
|
|
179
|
+
</Sample>
|
|
180
|
+
</Group>
|
|
181
|
+
</>
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
const stages = [{ id: 'todo', label: 'Todo' }, { id: 'in-progress', label: 'In progress' }, { id: 'done', label: 'Done' }];
|
|
186
|
+
|
|
187
|
+
function PropertiesStory() {
|
|
188
|
+
const [stage, setStage] = React.useState(stages[1]!);
|
|
189
|
+
const [website, setWebsite] = React.useState('northwind.example');
|
|
190
|
+
const [city, setCity] = React.useState('Lyon');
|
|
191
|
+
return (
|
|
192
|
+
<>
|
|
193
|
+
<Group title="Rows" description="A 90px muted label, the value beside it, on the lg height." layout="fill" code={`<Properties className="ds-control-wide">\n <PropertyRow label="Status"><Picker aria-label="Status" items={stages} value={stage} onValueChange={setStage} itemToString={(each) => each.label} itemToKey={(each) => each.id} itemIcon={(each) => <StatusIcon status={each.id as StatusIconStatus} />} /></PropertyRow>\n <PropertyRow label="Owner"><Button variant="property"><Avatar name="Ada Lindqvist" size="sm" tint />Ada Lindqvist</Button></PropertyRow>\n <PropertyRow label="Website"><Input variant="inline" aria-label="Website" value={website} onChange={(event) => setWebsite(event.currentTarget.value)} /></PropertyRow>\n <PropertyRow label="City"><Input variant="inline" aria-label="City" value={city} onChange={(event) => setCity(event.currentTarget.value)} /></PropertyRow>\n <PropertyRow label="Labels"><Label variant="feature">Design</Label><span className="ds-gap" /><Label variant="improvement">Q4</Label></PropertyRow>\n <PropertyRow label="A very long property label"><Badge>Truncated, with a title</Badge></PropertyRow>\n</Properties>`}>
|
|
194
|
+
<Properties className="ds-control-wide">
|
|
195
|
+
<PropertyRow label="Status"><Picker aria-label="Status" items={stages} value={stage} onValueChange={setStage} itemToString={(each) => each.label} itemToKey={(each) => each.id} itemIcon={(each) => <StatusIcon status={each.id as StatusIconStatus} />} /></PropertyRow>
|
|
196
|
+
<PropertyRow label="Owner"><Button variant="property"><Avatar name="Ada Lindqvist" size="sm" tint />Ada Lindqvist</Button></PropertyRow>
|
|
197
|
+
<PropertyRow label="Website"><Input variant="inline" aria-label="Website" value={website} onChange={(event) => setWebsite(event.currentTarget.value)} /></PropertyRow>
|
|
198
|
+
<PropertyRow label="City"><Input variant="inline" aria-label="City" value={city} onChange={(event) => setCity(event.currentTarget.value)} /></PropertyRow>
|
|
199
|
+
<PropertyRow label="Labels"><Label variant="feature">Design</Label><span className="ds-gap" /><Label variant="improvement">Q4</Label></PropertyRow>
|
|
200
|
+
<PropertyRow label="A very long property label"><Badge>Truncated, with a title</Badge></PropertyRow>
|
|
201
|
+
</Properties>
|
|
202
|
+
</Group>
|
|
203
|
+
<Group title="States" layout="fill" code={`<Properties className="ds-control-wide">\n <PropertyRow label="Read-only"><Input variant="inline" aria-label="Read-only value" readOnly value="Created by Ada, 2 Oct" /></PropertyRow>\n <PropertyRow label="Empty"><Input variant="inline" aria-label="Empty value" placeholder="Add a phone" /></PropertyRow>\n <PropertyRow label="Disabled"><Input variant="inline" aria-label="Disabled value" disabled value="Locked by policy" /></PropertyRow>\n</Properties>`}>
|
|
204
|
+
<Properties className="ds-control-wide">
|
|
205
|
+
<PropertyRow label="Read-only"><Input variant="inline" aria-label="Read-only value" readOnly value="Created by Ada, 2 Oct" /></PropertyRow>
|
|
206
|
+
<PropertyRow label="Empty"><Input variant="inline" aria-label="Empty value" placeholder="Add a phone" /></PropertyRow>
|
|
207
|
+
<PropertyRow label="Disabled"><Input variant="inline" aria-label="Disabled value" disabled value="Locked by policy" /></PropertyRow>
|
|
208
|
+
</Properties>
|
|
209
|
+
</Group>
|
|
210
|
+
</>
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
interface Issue { id: string; title: string; status: StatusIconStatus; owner: string; points: number }
|
|
215
|
+
const issues: Issue[] = [
|
|
216
|
+
{ id: 'BRG-41', title: 'Storyboard of the kit', status: 'in-progress', owner: 'Ada Lindqvist', points: 5 },
|
|
217
|
+
{ id: 'BRG-38', title: 'Picker keyboard digits', status: 'in-progress', owner: 'Bruno Okafor', points: 3 },
|
|
218
|
+
{ id: 'BRG-35', title: 'Combobox server search', status: 'done', owner: 'Chloé Martin', points: 3 },
|
|
219
|
+
{ id: 'BRG-33', title: 'Sidebar items under screens', status: 'done', owner: 'Ada Lindqvist', points: 2 },
|
|
220
|
+
{ id: 'BRG-29', title: 'Trigram search index', status: 'done', owner: 'Dmitri Volkov', points: 8 },
|
|
221
|
+
{ id: 'BRG-44', title: 'Theme editor', status: 'backlog', owner: 'Elif Şahin', points: 13 },
|
|
222
|
+
];
|
|
223
|
+
const columns = '96px minmax(0, 1fr) 180px 72px';
|
|
224
|
+
|
|
225
|
+
function IssueRow({ issue, size }: { issue: Issue; size?: 'sm' | 'default' }) {
|
|
226
|
+
return (
|
|
227
|
+
<TableRow size={size}>
|
|
228
|
+
<TableCell>{issue.id}</TableCell>
|
|
229
|
+
<TableCell><StatusIcon status={issue.status} /><span className="ds-gap" />{issue.title}</TableCell>
|
|
230
|
+
<TableCell><Avatar name={issue.owner} size="sm" tint /><span className="ds-gap" />{issue.owner}</TableCell>
|
|
231
|
+
<TableCell className="ds-num">{issue.points}</TableCell>
|
|
232
|
+
</TableRow>
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
function TableStory() {
|
|
237
|
+
const [open, setOpen] = React.useState<Record<string, boolean>>({ 'in-progress': true, done: false, backlog: true });
|
|
238
|
+
const groups: { status: StatusIconStatus; label: string }[] = [{ status: 'in-progress', label: 'In progress' }, { status: 'done', label: 'Done' }, { status: 'backlog', label: 'Backlog' }];
|
|
239
|
+
return (
|
|
240
|
+
<>
|
|
241
|
+
<Group title="Rows" description="A grid per row from the table's columns; header, body (hover), footer." layout="fill" code={`<Table columns={columns} aria-label="Issues">\n <TableHeader><TableRow><TableHead>ID</TableHead><TableHead>Title</TableHead><TableHead>Owner</TableHead><TableHead className="ds-num">Points</TableHead></TableRow></TableHeader>\n <TableBody>{issues.slice(0, 4).map((issue) => <IssueRow key={issue.id} issue={issue} />)}</TableBody>\n <TableFooter><TableRow><TableCell>Total</TableCell><TableCell /><TableCell /><TableCell className="ds-num">{issues.slice(0, 4).reduce((sum, each) => sum + each.points, 0)}</TableCell></TableRow></TableFooter>\n</Table>`}>
|
|
242
|
+
<Wide> <Table columns={columns} aria-label="Issues">
|
|
243
|
+
<TableHeader><TableRow><TableHead>ID</TableHead><TableHead>Title</TableHead><TableHead>Owner</TableHead><TableHead className="ds-num">Points</TableHead></TableRow></TableHeader>
|
|
244
|
+
<TableBody>{issues.slice(0, 4).map((issue) => <IssueRow key={issue.id} issue={issue} />)}</TableBody>
|
|
245
|
+
<TableFooter><TableRow><TableCell>Total</TableCell><TableCell /><TableCell /><TableCell className="ds-num">{issues.slice(0, 4).reduce((sum, each) => sum + each.points, 0)}</TableCell></TableRow></TableFooter>
|
|
246
|
+
</Table></Wide>
|
|
247
|
+
</Group>
|
|
248
|
+
<Group title="Sizes" description="Rows of 40px (default) or 36px (sm)." layout="fill" code={`<Table columns={columns} aria-label="Compact issues">\n <TableBody>{issues.slice(0, 3).map((issue) => <IssueRow key={issue.id} issue={issue} size="sm" />)}</TableBody>\n</Table>`}>
|
|
249
|
+
<Wide> <Table columns={columns} aria-label="Compact issues">
|
|
250
|
+
<TableBody>{issues.slice(0, 3).map((issue) => <IssueRow key={issue.id} issue={issue} size="sm" />)}</TableBody>
|
|
251
|
+
</Table></Wide>
|
|
252
|
+
</Group>
|
|
253
|
+
<Group title="Examples" description="Grouped by status; each group collapses with its toggle." layout="fill" code={`<Table columns={columns} aria-label="Issues by status">\n <TableBody>\n {groups.map(({ status, label }) => {\n const rows = issues.filter((each) => each.status === status);\n const expanded = open[status] ?? true;\n return (\n <React.Fragment key={status}>\n <GroupHeader\n label={label}\n count={rows.length}\n icon={<><ExpandToggle expanded={expanded} onExpandedChange={(next) => setOpen((current) => ({ ...current, [status]: next }))} /><StatusIcon status={status} /></>}\n />\n <CollapsibleRows expanded={expanded}>{rows.map((issue) => <IssueRow key={issue.id} issue={issue} />)}</CollapsibleRows>\n </React.Fragment>\n );\n })}\n </TableBody>\n</Table>`}>
|
|
254
|
+
<Wide> <Table columns={columns} aria-label="Issues by status">
|
|
255
|
+
<TableBody>
|
|
256
|
+
{groups.map(({ status, label }) => {
|
|
257
|
+
const rows = issues.filter((each) => each.status === status);
|
|
258
|
+
const expanded = open[status] ?? true;
|
|
259
|
+
return (
|
|
260
|
+
<React.Fragment key={status}>
|
|
261
|
+
<GroupHeader
|
|
262
|
+
label={label}
|
|
263
|
+
count={rows.length}
|
|
264
|
+
icon={<><ExpandToggle expanded={expanded} onExpandedChange={(next) => setOpen((current) => ({ ...current, [status]: next }))} /><StatusIcon status={status} /></>}
|
|
265
|
+
/>
|
|
266
|
+
<CollapsibleRows expanded={expanded}>{rows.map((issue) => <IssueRow key={issue.id} issue={issue} />)}</CollapsibleRows>
|
|
267
|
+
</React.Fragment>
|
|
268
|
+
);
|
|
269
|
+
})}
|
|
270
|
+
</TableBody>
|
|
271
|
+
</Table></Wide>
|
|
272
|
+
</Group>
|
|
273
|
+
<Group title="Empty" layout="fill" code={`<Table columns={columns} aria-label="No issues">\n <TableHeader><TableRow><TableHead>ID</TableHead><TableHead>Title</TableHead><TableHead>Owner</TableHead><TableHead className="ds-num">Points</TableHead></TableRow></TableHeader>\n <TableBody><TableRow><TableCell className="ds-span-all"><Icon name="inbox" size={14} /><span className="ds-gap" />No issues match this view</TableCell></TableRow></TableBody>\n</Table>`}>
|
|
274
|
+
<Wide> <Table columns={columns} aria-label="No issues">
|
|
275
|
+
<TableHeader><TableRow><TableHead>ID</TableHead><TableHead>Title</TableHead><TableHead>Owner</TableHead><TableHead className="ds-num">Points</TableHead></TableRow></TableHeader>
|
|
276
|
+
<TableBody><TableRow><TableCell className="ds-span-all"><Icon name="inbox" size={14} /><span className="ds-gap" />No issues match this view</TableCell></TableRow></TableBody>
|
|
277
|
+
</Table></Wide>
|
|
278
|
+
</Group>
|
|
279
|
+
</>
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
function KbdStory() {
|
|
284
|
+
return (
|
|
285
|
+
<>
|
|
286
|
+
<Group title="Tones" code={`<Kbd>⌘K</Kbd>\n<Button variant="primary" size="sm">Create <Kbd tone="inverse">⌘↵</Kbd></Button>`}>
|
|
287
|
+
<Sample title="default"><Kbd>⌘K</Kbd></Sample>
|
|
288
|
+
<Sample title="inverse" description="Inside a primary button"><Button variant="primary" size="sm">Create <Kbd tone="inverse">⌘↵</Kbd></Button></Sample>
|
|
289
|
+
</Group>
|
|
290
|
+
<Group title="Examples" code={`<Kbd>Enter</Kbd> <Kbd>Esc</Kbd> <Kbd>J</Kbd>\nPress <Kbd>⇧</Kbd><Kbd>⌘</Kbd><Kbd>P</Kbd> to open the palette.`}>
|
|
291
|
+
<Sample title="single keys"><Kbd>Enter</Kbd> <Kbd>Esc</Kbd> <Kbd>J</Kbd></Sample>
|
|
292
|
+
<Sample title="in a sentence">Press <Kbd>⇧</Kbd><Kbd>⌘</Kbd><Kbd>P</Kbd> to open the palette.</Sample>
|
|
293
|
+
</Group>
|
|
294
|
+
</>
|
|
295
|
+
);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
const tagNames = ['client', 'lead', 'partner', 'press'];
|
|
299
|
+
|
|
300
|
+
function TagPillStory() {
|
|
301
|
+
const [filters, setFilters] = React.useState(['client', 'press']);
|
|
302
|
+
return (
|
|
303
|
+
<>
|
|
304
|
+
<Group title="Sizes" code={`<TagPill name="client" />\n<TagPill name="client" size="sm" />`}>
|
|
305
|
+
<Sample title="default"><TagPill name="client" /></Sample>
|
|
306
|
+
<Sample title="sm" description="A list row's, 20px"><TagPill name="client" size="sm" /></Sample>
|
|
307
|
+
</Group>
|
|
308
|
+
<Group title="Parts" description="The colour comes from the name, the same everywhere." code={`{tagNames.map((name) => <TagDot key={name} name={name} />)}\n<TagList aria-label="Tags">{tagNames.map((name) => <TagPill key={name} name={name} />)}</TagList>\n{filters.map((name) => <FilterChip key={name} name={name} onRemove={() => setFilters(filters.filter((each) => each !== name))} />)}\n{filters.length === 0 && <Button variant="ghost" size="sm" onClick={() => setFilters(['client', 'press'])}>Reset</Button>}`}>
|
|
309
|
+
<Sample title="TagDot">{tagNames.map((name) => <TagDot key={name} name={name} />)}</Sample>
|
|
310
|
+
<Sample title="TagList" description="Pills that wrap"><TagList aria-label="Tags">{tagNames.map((name) => <TagPill key={name} name={name} />)}</TagList></Sample>
|
|
311
|
+
<Sample title="FilterChip" description="A click removes the filter">
|
|
312
|
+
{filters.map((name) => <FilterChip key={name} name={name} onRemove={() => setFilters(filters.filter((each) => each !== name))} />)}
|
|
313
|
+
{filters.length === 0 && <Button variant="ghost" size="sm" onClick={() => setFilters(['client', 'press'])}>Reset</Button>}
|
|
314
|
+
</Sample>
|
|
315
|
+
</Group>
|
|
316
|
+
</>
|
|
317
|
+
);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
function ThumbnailStory() {
|
|
321
|
+
const [picked, setPicked] = React.useState<string>('Roadmap.pdf');
|
|
322
|
+
const tiles = [
|
|
323
|
+
{ kind: 'image', name: 'Launch banner.png' },
|
|
324
|
+
{ kind: 'video', name: 'Demo recording.mp4' },
|
|
325
|
+
{ kind: 'folder', name: 'Brand assets' },
|
|
326
|
+
{ kind: 'file', name: 'Roadmap.pdf' },
|
|
327
|
+
] as const;
|
|
328
|
+
return (
|
|
329
|
+
<>
|
|
330
|
+
<Group title="Kinds" description="A click or Enter opens; the picked tile draws the accent ring." layout="grid" code={`{tiles.map((tile) => (\n <div style={{ width: 120 }}>\n <Thumbnail kind={tile.kind} name={tile.name} selected={picked === tile.name} onOpen={() => setPicked(tile.name)} badge={tile.kind === 'image' ? <Icon name="pin" size={12} /> : undefined} />\n </div>\n))}`}>
|
|
331
|
+
{tiles.map((tile) => (
|
|
332
|
+
<Sample key={tile.name} title={tile.kind}>
|
|
333
|
+
<div style={{ width: 120 }}>
|
|
334
|
+
<Thumbnail kind={tile.kind} name={tile.name} selected={picked === tile.name} onOpen={() => setPicked(tile.name)} badge={tile.kind === 'image' ? <Icon name="pin" size={12} /> : undefined} />
|
|
335
|
+
</div>
|
|
336
|
+
</Sample>
|
|
337
|
+
))}
|
|
338
|
+
</Group>
|
|
339
|
+
</>
|
|
340
|
+
);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
function CollapsibleStory() {
|
|
344
|
+
return (
|
|
345
|
+
<Group title="Closed at first" description="The trigger turns its chevron and shows the panel." layout="stack" code={`<Collapsible>\n <CollapsibleTrigger>Advanced settings</CollapsibleTrigger>\n <CollapsiblePanel><Properties><PropertyRow label="Port">4815</PropertyRow><PropertyRow label="Host">0.0.0.0</PropertyRow></Properties></CollapsiblePanel>\n</Collapsible>`}>
|
|
346
|
+
<Collapsible>
|
|
347
|
+
<CollapsibleTrigger>Advanced settings</CollapsibleTrigger>
|
|
348
|
+
<CollapsiblePanel><Properties><PropertyRow label="Port">4815</PropertyRow><PropertyRow label="Host">0.0.0.0</PropertyRow></Properties></CollapsiblePanel>
|
|
349
|
+
</Collapsible>
|
|
350
|
+
</Group>
|
|
351
|
+
);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
function CodeBlockStory() {
|
|
355
|
+
return (
|
|
356
|
+
<>
|
|
357
|
+
<Group title="React" description="Hover it for Copy; its line breaks and indentation are kept." layout="fill" code={`<CodeBlock language="tsx" code={'<MultiPane\\n nav={<Pane aria-label="People">…</Pane>}\\n main={<Detail aria-label={person.name}>…</Detail>}\\n/>'} />`}>
|
|
358
|
+
<Code code={'<MultiPane\n nav={<Pane aria-label="People">…</Pane>}\n main={<Detail aria-label={person.name}>…</Detail>}\n/>'} />
|
|
359
|
+
</Group>
|
|
360
|
+
<Group title="A long line" description="It scrolls sideways rather than wrapping." layout="fill" code={`<CodeBlock language="sh" code="node packages/host/src/cli.ts start --root ~/.bridge-test/ui-layouts --port 4815 --host 0.0.0.0 --non-interactive" />`}>
|
|
361
|
+
<Code language="sh" code="node packages/host/src/cli.ts start --root ~/.bridge-test/ui-layouts --port 4815 --host 0.0.0.0 --non-interactive" />
|
|
362
|
+
</Group>
|
|
363
|
+
</>
|
|
364
|
+
);
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
export const dataDisplay = { thumbnail: ThumbnailStory, collapsible: CollapsibleStory, 'code-block': CodeBlockStory,
|
|
368
|
+
kbd: KbdStory, 'tag-pill': TagPillStory,
|
|
369
|
+
avatar: AvatarStory, badge: BadgeStory, icon: IconStory, label: LabelStory, list: ListStory, properties: PropertiesStory,
|
|
370
|
+
'status-icon': StatusIconStory, table: TableStory,
|
|
371
|
+
};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
// Feedback: toasts, fired for real (bottom right; hover pauses the fade, Escape dismisses the last).
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Button, DetailSkeleton, DraftBar, EmptyState, Icon, ListSkeleton, Progress, Skeleton, useToast, type ToastVariant } from '@bridge/ui';
|
|
4
|
+
import { Group, Sample } from './parts.tsx';
|
|
5
|
+
|
|
6
|
+
const variants: { variant: ToastVariant; title: string; description: string; icon: string }[] = [
|
|
7
|
+
{ variant: 'info', title: 'Sync started', description: '1,204 contacts to check', icon: 'rotate-cw' },
|
|
8
|
+
{ variant: 'success', title: 'Ada Lindqvist saved', description: 'Her card is up to date', icon: 'check' },
|
|
9
|
+
{ variant: 'warning', title: 'Storage almost full', description: '92% of 10 GB used', icon: 'triangle-alert' },
|
|
10
|
+
{ variant: 'error', title: 'Could not save the contact', description: 'The server did not answer; try again', icon: 'x' },
|
|
11
|
+
];
|
|
12
|
+
|
|
13
|
+
function ToastStory() {
|
|
14
|
+
const { toast, dismiss } = useToast();
|
|
15
|
+
const [last, setLast] = React.useState<string>();
|
|
16
|
+
const [retries, setRetries] = React.useState(0);
|
|
17
|
+
return (
|
|
18
|
+
<>
|
|
19
|
+
<Group title="Variants" description="Each fades after 3 s." code={`{variants.map(({ variant, title, description, icon }) => (\n <Button variant="outline" onClick={() => toast({ variant, title, description })}><Icon name={icon} />Show {variant}</Button>\n))}`}>
|
|
20
|
+
{variants.map(({ variant, title, description, icon }) => (
|
|
21
|
+
<Sample key={variant} title={variant}>
|
|
22
|
+
<Button variant="outline" onClick={() => toast({ variant, title, description })}><Icon name={icon} />Show {variant}</Button>
|
|
23
|
+
</Sample>
|
|
24
|
+
))}
|
|
25
|
+
</Group>
|
|
26
|
+
<Group title="Options" code={`<Button variant="outline" onClick={() => toast({ title: 'Link copied' })}><Icon name="link" />Copy link</Button>\n<Button variant="outline" onClick={() => toast({ variant: 'success', title: 'Contact archived', duration: 6000, action: { label: 'Undo', onClick: () => toast({ title: 'Contact restored' }) } })}><Icon name="archive" />Archive</Button>\n<Button variant="outline" onClick={() => setLast(toast({ variant: 'warning', title: 'You are offline', description: 'Changes are kept and sent once you are back', duration: Infinity }))}><Icon name="power" />Go offline</Button>\n<Button variant="ghost" disabled={last === undefined} onClick={() => { if (last) dismiss(last); setLast(undefined); }}>Dismiss it</Button>\n<Button variant="outline" onClick={() => { setRetries((n) => n + 1); toast({ key: 'save', variant: 'error', title: 'Could not save', description: \`Attempt \${retries + 1}\` }); }}><Icon name="rotate-cw" />Fail again</Button>`}>
|
|
27
|
+
<Sample title="title only"><Button variant="outline" onClick={() => toast({ title: 'Link copied' })}><Icon name="link" />Copy link</Button></Sample>
|
|
28
|
+
<Sample title="with an action" description="Undo for 6 s">
|
|
29
|
+
<Button variant="outline" onClick={() => toast({ variant: 'success', title: 'Contact archived', duration: 6000, action: { label: 'Undo', onClick: () => toast({ title: 'Contact restored' }) } })}><Icon name="archive" />Archive</Button>
|
|
30
|
+
</Sample>
|
|
31
|
+
<Sample title="sticky" description="duration: Infinity, until dismissed">
|
|
32
|
+
<Button variant="outline" onClick={() => setLast(toast({ variant: 'warning', title: 'You are offline', description: 'Changes are kept and sent once you are back', duration: Infinity }))}><Icon name="power" />Go offline</Button>
|
|
33
|
+
<Button variant="ghost" disabled={last === undefined} onClick={() => { if (last) dismiss(last); setLast(undefined); }}>Dismiss it</Button>
|
|
34
|
+
</Sample>
|
|
35
|
+
<Sample title="replaced by key" description="A repeated failure does not stack">
|
|
36
|
+
<Button variant="outline" onClick={() => { setRetries((n) => n + 1); toast({ key: 'save', variant: 'error', title: 'Could not save', description: `Attempt ${retries + 1}` }); }}><Icon name="rotate-cw" />Fail again</Button>
|
|
37
|
+
</Sample>
|
|
38
|
+
</Group>
|
|
39
|
+
</>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function DraftBarStory() {
|
|
44
|
+
const noop = () => {};
|
|
45
|
+
return (
|
|
46
|
+
<Group title="States" layout="stack" code={`<DraftBar message="Not created yet · kept on this device" onCancel={noop} onCreate={noop} />\n<DraftBar message="Not created yet · kept on this device" error="A first or last name is needed." onCancel={noop} onCreate={noop} />`}>
|
|
47
|
+
<Sample title="kept" description="Says where the draft is kept" wide>
|
|
48
|
+
<DraftBar message="Not created yet · kept on this device" onCancel={noop} onCreate={noop} />
|
|
49
|
+
</Sample>
|
|
50
|
+
<Sample title="error" description="What stops Create replaces the message, as an alert" wide>
|
|
51
|
+
<DraftBar message="Not created yet · kept on this device" error="A first or last name is needed." onCancel={noop} onCreate={noop} />
|
|
52
|
+
</Sample>
|
|
53
|
+
</Group>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function EmptyStateStory() {
|
|
58
|
+
return (
|
|
59
|
+
<>
|
|
60
|
+
<Group title="Variants" layout="columns" code={`<EmptyState icon={<Icon name="inbox" size={22} />} title="No contacts yet">Add one, or import a file.</EmptyState>\n<EmptyState title="Nothing selected" />`}>
|
|
61
|
+
<Sample title="icon, title and words"><EmptyState icon={<Icon name="inbox" size={22} />} title="No contacts yet">Add one, or import a file.</EmptyState></Sample>
|
|
62
|
+
<Sample title="title alone"><EmptyState title="Nothing selected" /></Sample>
|
|
63
|
+
</Group>
|
|
64
|
+
<Group title="Examples" layout="columns" code={`<EmptyState icon={<Icon name="users" size={22} />} title="No organizations">\n <p>Organizations group your contacts.</p>\n <Button variant="outline" size="sm"><Icon name="plus" />New organization</Button>\n</EmptyState>\n<div style={{ height: 160, border: '0.5px dashed var(--border)' }}><EmptyState fill title="Pick a contact" /></div>`}>
|
|
65
|
+
<Sample title="with an action">
|
|
66
|
+
<EmptyState icon={<Icon name="users" size={22} />} title="No organizations">
|
|
67
|
+
<p>Organizations group your contacts.</p>
|
|
68
|
+
<Button variant="outline" size="sm"><Icon name="plus" />New organization</Button>
|
|
69
|
+
</EmptyState>
|
|
70
|
+
</Sample>
|
|
71
|
+
<Sample title="fill" description="Centred in the height of its pane">
|
|
72
|
+
<div style={{ height: 160, border: '0.5px dashed var(--border)' }}><EmptyState fill title="Pick a contact" /></div>
|
|
73
|
+
</Sample>
|
|
74
|
+
</Group>
|
|
75
|
+
</>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function SkeletonStory() {
|
|
80
|
+
return (
|
|
81
|
+
<>
|
|
82
|
+
<Group title="Variants" description="A block takes its size from className or style." code={`<Skeleton style={{ width: 160, height: 12 }} />\n<Skeleton round style={{ width: 32, height: 32 }} />`}>
|
|
83
|
+
<Sample title="block"><Skeleton style={{ width: 160, height: 12 }} /></Sample>
|
|
84
|
+
<Sample title="round"><Skeleton round style={{ width: 32, height: 32 }} /></Sample>
|
|
85
|
+
</Group>
|
|
86
|
+
<Group title="Examples" layout="columns" code={`<ListSkeleton />\n<div style={{ height: 380 }}><DetailSkeleton /></div>`}>
|
|
87
|
+
<Sample title="ListSkeleton" description="A list loading: eight rows"><ListSkeleton /></Sample>
|
|
88
|
+
<Sample title="DetailSkeleton" description="A record page loading"><div style={{ height: 380 }}><DetailSkeleton /></div></Sample>
|
|
89
|
+
</Group>
|
|
90
|
+
</>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function ProgressStory() {
|
|
95
|
+
return (
|
|
96
|
+
<>
|
|
97
|
+
<Group title="Values" description="Determinate from 0 to 1; without a value, indeterminate and animated." layout="stack" code={`{[0, 0.4, 1].map((value) => <Sample key={value} title={\`\${value * 100}%\`} wide><Progress value={value} label="Uploading the images" /></Sample>)}\n<Progress label="Installing" />`}>
|
|
98
|
+
{[0, 0.4, 1].map((value) => <Sample key={value} title={`${value * 100}%`} wide><Progress value={value} label="Uploading the images" /></Sample>)}
|
|
99
|
+
<Sample title="indeterminate" wide><Progress label="Installing" /></Sample>
|
|
100
|
+
</Group>
|
|
101
|
+
<Group title="Options" layout="stack" code={`<Progress value={0.6} size="sm" label="Syncing" />\n<Progress value={0.95} tone="danger" label="Storage used" />`}>
|
|
102
|
+
<Sample title="sm" description="4px high" wide><Progress value={0.6} size="sm" label="Syncing" /></Sample>
|
|
103
|
+
<Sample title="danger" description="A failure or a limit" wide><Progress value={0.95} tone="danger" label="Storage used" /></Sample>
|
|
104
|
+
</Group>
|
|
105
|
+
</>
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export const feedback = { progress: ProgressStory, toast: ToastStory, 'draft-bar': DraftBarStory, 'empty-state': EmptyStateStory, skeleton: SkeletonStory };
|