-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Expand file tree
/
Copy pathLazy.js
More file actions
447 lines (410 loc) · 14.3 KB
/
Lazy.js
File metadata and controls
447 lines (410 loc) · 14.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
import React, {useState} from "react";
import "@react-spectrum/s2/page.css";
import {
Accordion,
ActionButton,
AlertDialog,
Avatar,
AvatarGroup,
Badge,
Breadcrumb,
Breadcrumbs,
Button,
ButtonGroup,
Calendar,
Checkbox,
CheckboxGroup,
CloseButton,
ColorArea,
ColorField,
ColorSlider,
ColorSwatch,
ColorSwatchPicker,
ColorWheel,
ComboBox,
ComboBoxItem,
Content,
ContextualHelp,
CustomDialog,
DateField,
DatePicker,
DateRangePicker,
Dialog,
DialogContainer,
DialogTrigger,
Disclosure,
DisclosureHeader,
DisclosurePanel,
DisclosureTitle,
DropZone,
Footer,
Form,
FullscreenDialog,
Header,
Heading,
IllustratedMessage,
Image,
InlineAlert,
Keyboard,
Link,
Meter,
NumberField,
Picker,
PickerItem,
Popover,
ProgressBar,
ProgressCircle,
Radio,
RadioGroup,
RangeCalendar,
RangeSlider,
SearchField,
SegmentedControl,
SegmentedControlItem,
SelectBox,
SelectBoxGroup,
Slider,
StatusLight,
Switch,
Tab,
TabList,
TabPanel,
Tabs,
Tag,
TagGroup,
Text,
TextArea,
TextField,
TimeField,
Tooltip,
TooltipTrigger,
} from "@react-spectrum/s2";
import Checkmark from '@react-spectrum/s2/illustrations/gradient/generic1/Checkmark';
import Cloud from "@react-spectrum/s2/illustrations/linear/Cloud";
import DropToUpload from "@react-spectrum/s2/illustrations/linear/DropToUpload";
import Server from "@react-spectrum/s2/illustrations/linear/Server";
import AlertNotice from "@react-spectrum/s2/illustrations/linear/AlertNotice";
import PaperAirplane from "@react-spectrum/s2/illustrations/linear/Paperairplane";
import StarFilled1 from "@react-spectrum/s2/illustrations/linear/Star";
import Edit from "@react-spectrum/s2/icons/Edit";
import Section from "./components/Section";
import { style } from "@react-spectrum/s2/style" with { type: "macro" };
export default function Lazy() {
let [isDialogOpen, setIsDialogOpen] = useState(false);
return (
<>
<Section title="Color">
<ColorField placeholder="-" label="Primary Color" />
<ColorSwatchPicker>
<ColorSwatch color="#A00" />
<ColorSwatch color="#f80" />
<ColorSwatch color="#080" />
<ColorSwatch color="#08f" />
<ColorSwatch color="#088" />
<ColorSwatch color="#008" />
</ColorSwatchPicker>
<ColorSlider defaultValue="#7f0000" channel="red" />
<ColorArea defaultValue="#7f0000" />
<ColorWheel defaultValue="hsl(30, 100%, 50%)" />
</Section>
<Section title="Date and time">
<Calendar aria-label="Calendar" />
<DateField label="Date Field" />
<DatePicker label="Date Picker" />
<DateRangePicker label="Date Range Picker" />
<RangeCalendar aria-label="Range Calendar" />
<TimeField label="Time Field" />
</Section>
<Section title="Drag and Drop">
<DropZone>
<IllustratedMessage>
<DropToUpload />
<Heading>Drag and drop your file</Heading>
<Content>Or, select a file from your computer</Content>
</IllustratedMessage>
</DropZone>
</Section>
<Section title="Forms">
<Form
styles={style({
maxWidth: 288,
})}
>
<CheckboxGroup label="Favorite sports">
<Checkbox value="soccer">Soccer</Checkbox>
<Checkbox value="baseball">Baseball</Checkbox>
<Checkbox value="basketball">Basketball</Checkbox>
</CheckboxGroup>
<NumberField placeholder="Enter a width" label="Width" defaultValue={1024} minValue={0} />
<RadioGroup label="Favorite pet">
<Radio value="dogs">Dogs</Radio>
<Radio value="cats">Cats</Radio>
</RadioGroup>
<SearchField label="Search" />
<Switch>Low power mode</Switch>
<TextArea placeholder="Enter a description" label="Description" />
<TextField placeholder="Enter a email" label="Email" />
<TextField placeholder="Enter a password" label="Password" />
<SelectBoxGroup aria-label="Choose a cloud">
<SelectBox id="aws" textValue="Amazon Web Services">
<Server />
<Text slot="label">Amazon Web Services</Text>
<Text slot="description">Reliable cloud infrastructure</Text>
</SelectBox>
<SelectBox id="azure" textValue="Microsoft Azure">
<AlertNotice />
<Text slot="label">Microsoft Azure</Text>
</SelectBox>
<SelectBox id="gcp" textValue="Google Cloud Platform">
<PaperAirplane />
<Text slot="label">Google Cloud Platform</Text>
</SelectBox>
<SelectBox id="ibm" textValue="IBM Cloud">
<StarFilled1 />
<Text slot="label">IBM Cloud</Text>
<Text slot="description">Hybrid cloud solutions</Text>
</SelectBox>
</SelectBoxGroup>
</Form>
</Section>
<Section title="Navigation">
<div className={style({ minHeight: 176 })}>
<Accordion>
<Disclosure id="files">
<DisclosureHeader>
<DisclosureTitle>
Files
</DisclosureTitle>
<ActionButton><Edit aria-label="Edit" /></ActionButton>
</DisclosureHeader>
<DisclosurePanel>
Files content
</DisclosurePanel>
</Disclosure>
<Disclosure id="people">
<DisclosureHeader>
<DisclosureTitle>
People
</DisclosureTitle>
</DisclosureHeader>
<DisclosurePanel>
<TextField label="Name" styles={style({ maxWidth: 176 })} />
</DisclosurePanel>
</Disclosure>
</Accordion>
</div>
<Breadcrumbs>
<Breadcrumb id="home">Home</Breadcrumb>
<Breadcrumb id="trendy">Trendy</Breadcrumb>
<Breadcrumb id="march 2020 assets">March 2020 Assets</Breadcrumb>
</Breadcrumbs>
<Link
href="https://www.imdb.com/title/tt6348138/"
target="_blank"
rel="noreferrer"
>
The missing link.
</Link>
<Link href="/foo">Foo</Link>
<SegmentedControl aria-label="Time granularity" styles={style({width: 384})} isJustified>
<SegmentedControlItem id="day">Day</SegmentedControlItem>
<SegmentedControlItem id="week">Week</SegmentedControlItem>
<SegmentedControlItem id="month">Month</SegmentedControlItem>
<SegmentedControlItem id="year">Year</SegmentedControlItem>
</SegmentedControl>
<Tabs aria-label="History of Ancient Rome">
<TabList>
<Tab id="FoR">Founding of Rome</Tab>
<Tab id="MaR">Monarchy and Republic</Tab>
<Tab id="Emp">Empire</Tab>
</TabList>
<TabPanel id="FoR">
Arma virumque cano, Troiae qui primus ab oris.
</TabPanel>
<TabPanel id="MaR">Senatus Populusque Romanus.</TabPanel>
<TabPanel id="Emp">Alea jacta est.</TabPanel>
</Tabs>
</Section>
<Section title="Overlays">
<DialogTrigger>
<ActionButton>Save</ActionButton>
<AlertDialog
title="Low Disk Space"
variant="warning"
primaryActionLabel="Confirm"
>
You are running low on disk space. Delete unnecessary files to
free up space.
</AlertDialog>
</DialogTrigger>
<ContextualHelp variant="info">
<Heading>Need help?</Heading>
<Content>
<Text>
If you are having issues accessing your account, contact our
customer support team for help.
</Text>
</Content>
</ContextualHelp>
<ActionButton onPress={() => setIsDialogOpen(true)}>
Show Dialog
</ActionButton>
<DialogContainer onDismiss={() => setIsDialogOpen(false)}>
{isDialogOpen && (
<AlertDialog
title="Delete"
variant="destructive"
primaryActionLabel="Delete"
>
Are you sure you want to delete this item?
</AlertDialog>
)}
</DialogContainer>
<DialogTrigger>
<ActionButton>Check connectivity</ActionButton>
<Dialog>
{({close}) => (
<>
<Heading>Internet Speed Test</Heading>
<Header>Connection status: Connected</Header>
<Content>
<Text>Start speed test?</Text>
</Content>
<ButtonGroup>
<Button variant="secondary" onPress={close}>
Cancel
</Button>
<Button variant="accent" onPress={close}>
Confirm
</Button>
</ButtonGroup>
</>
)}
</Dialog>
</DialogTrigger>
<DialogTrigger>
<ActionButton>Illustration</ActionButton>
<CustomDialog size="M">
<div className={style({display: 'flex', flexDirection: 'column', rowGap: 8, alignItems: 'center'})}>
<Checkmark />
<Heading slot="title" styles={style({font: 'heading-lg', textAlign: 'center', marginY: 0})}>Thank you!</Heading>
<p className={style({font: 'body', textAlign: 'center', marginY: 0})}>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
<CloseButton styles={style({position: 'absolute', top: 12, insetEnd: 12})} />
</div>
</CustomDialog>
</DialogTrigger>
<DialogTrigger>
<ActionButton>Disk Status</ActionButton>
<Popover>
<Heading styles={style({font: 'heading', marginTop: 0, marginBottom: 20})}>C://</Heading>
<Content styles={style({font: 'ui'})}>
<Text>50% disk space remaining.</Text>
</Content>
</Popover>
</DialogTrigger>
<DialogTrigger>
<Button variant="primary">Fullscreen</Button>
<FullscreenDialog>
{({close}) => <>
<Heading slot="title">Dialog title</Heading>
<Header>Header</Header>
<Content>
{[...Array(5)].map((_, i) => <p key={i} style={{
marginTop: i === 0 ? 0 : undefined,
marginBottom: i === 4 ? 0 : undefined
}}>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in</p>)}
</Content>
<ButtonGroup>
<Button onPress={close} variant="secondary">Cancel</Button>
<Button onPress={close} variant="accent">Save</Button>
</ButtonGroup>
</>}
</FullscreenDialog>
</DialogTrigger>
<TooltipTrigger>
<ActionButton aria-label="Edit Name">
<Edit />
</ActionButton>
<Tooltip>Change Name</Tooltip>
</TooltipTrigger>
</Section>
<Section title="Pickers">
<ComboBox placeholder="Select a value" label="Favorite Animal">
<ComboBoxItem id="red panda">Red Panda</ComboBoxItem>
<ComboBoxItem id="cat">Cat</ComboBoxItem>
<ComboBoxItem id="dog">Dog</ComboBoxItem>
<ComboBoxItem id="aardvark">Aardvark</ComboBoxItem>
<ComboBoxItem id="kangaroo">Kangaroo</ComboBoxItem>
<ComboBoxItem id="snake">Snake</ComboBoxItem>
</ComboBox>
<Picker label="Choose frequency">
<PickerItem id="rarely">Rarely</PickerItem>
<PickerItem id="sometimes">Sometimes</PickerItem>
<PickerItem id="always">Always</PickerItem>
</Picker>
</Section>
<Section title="Sliders">
<RangeSlider label="Range" defaultValue={{ start: 12, end: 36 }} />
<Slider label="Cookies to buy" defaultValue={12} />
</Section>
<Section title="Status">
<Badge variant="positive">Badge</Badge>
<Meter label="Storage space" variant="positive" value={35} />
<ProgressBar label="Loading…" value={50} />
<ProgressBar label="Loading…" isIndeterminate />
<ProgressCircle aria-label="Loading…" value={50} />
<ProgressCircle aria-label="Loading…" isIndeterminate />
<StatusLight variant="positive">Ready</StatusLight>
<TagGroup aria-label="Static TagGroup items example">
<Tag>News</Tag>
<Tag>Travel</Tag>
<Tag>Gaming</Tag>
<Tag>Shopping</Tag>
</TagGroup>
<InlineAlert>
<Heading>Payment Information</Heading>
<Content>
Enter your billing address, shipping address, and payment method
to complete your purchase.
</Content>
</InlineAlert>
</Section>
<Section title="Content">
<Avatar
src="https://i.imgur.com/kJOwAdv.png"
alt="default Adobe avatar"
/>
<AvatarGroup aria-label="Users">
<Avatar
src="https://i.imgur.com/kJOwAdv.png"
alt="default Adobe avatar"
/>
<Avatar
src="https://i.imgur.com/kJOwAdv.png"
alt="default Adobe avatar"
/>
<Avatar
src="https://i.imgur.com/kJOwAdv.png"
alt="default Adobe avatar"
/>
<Avatar
src="https://i.imgur.com/kJOwAdv.png"
alt="default Adobe avatar"
/>
</AvatarGroup>
<Content>Content is king</Content>
<Footer>© All rights reserved.</Footer>
<Header>Cute cats</Header>
<Heading level={4}>Edit</Heading>
<IllustratedMessage>
<Cloud />
<Heading>No results</Heading>
<Content>Try another search</Content>
</IllustratedMessage>
<Image src="https://i.imgur.com/Z7AzH2c.png" alt="Sky and roof" />
<Keyboard>⌘V</Keyboard>
<Text>Paste</Text>
</Section>
</>
);
}