@appdirect/design-system 0.0.10 → 0.0.11
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 +2 -0
- package/dist/ComplexComponents/PageContentHeader/PageContentHeader.tsx +24 -34
- package/dist/ComplexComponents/PageContentHeader/index.ts +0 -2
- package/dist/contracts/PageContentHeader.json +10 -5
- package/dist/contracts/index.json +1 -1
- package/dist/index.ts +3 -4
- package/dist/stories/Buttons/ActionIcon.stories.tsx +159 -0
- package/dist/stories/Buttons/Button.stories.tsx +145 -0
- package/dist/stories/Buttons/CloseButton.stories.tsx +121 -0
- package/dist/stories/Combobox/AutocompleteClearable.stories.tsx +554 -0
- package/dist/stories/Combobox/Combobox.stories.tsx +106 -0
- package/dist/stories/Combobox/Multiselect.stories.tsx +664 -0
- package/dist/stories/Combobox/SearchableSelect.stories.tsx +640 -0
- package/dist/stories/Combobox/Select.stories.tsx +311 -0
- package/dist/stories/ComplexComponents/DashboardWidget/DashboardWidget.stories.tsx +822 -0
- package/dist/stories/ComplexComponents/DataTable/DataTable.stories.tsx +502 -0
- package/dist/stories/ComplexComponents/KeyInsight/KeyInsights.stories.tsx +386 -0
- package/dist/stories/ComplexComponents/NameValue/NameValue.stories.tsx +405 -0
- package/dist/stories/ComplexComponents/PageContentHeader/PageContentHeader.stories.tsx +527 -0
- package/dist/stories/ComplexComponents/Placeholder/Placeholder.stories.tsx +76 -0
- package/dist/stories/ComplexComponents/Slat/Slat.stories.tsx +79 -0
- package/dist/stories/ComplexComponents/Utilities/CopyButton.stories.tsx +479 -0
- package/dist/stories/DataDisplay/Alert.stories.tsx +296 -0
- package/dist/stories/DataDisplay/Avatar.stories.tsx +251 -0
- package/dist/stories/DataDisplay/Badge.stories.tsx +176 -0
- package/dist/stories/DataDisplay/Card.stories.tsx +406 -0
- package/dist/stories/DataDisplay/Chip.stories.tsx +495 -0
- package/dist/stories/DataDisplay/Indicator.stories.tsx +571 -0
- package/dist/stories/DataDisplay/List.stories.tsx +376 -0
- package/dist/stories/DataDisplay/Pill.stories.tsx +506 -0
- package/dist/stories/DataDisplay/Progress.stories.tsx +352 -0
- package/dist/stories/DataDisplay/Table.stories.tsx +346 -0
- package/dist/stories/DataDisplay/ThemeIcon.stories.tsx +125 -0
- package/dist/stories/Inputs/Checkbox.stories.tsx +263 -0
- package/dist/stories/Inputs/ColorInput.stories.tsx +434 -0
- package/dist/stories/Inputs/DropZone.stories.tsx +401 -0
- package/dist/stories/Inputs/FileInput.stories.tsx +383 -0
- package/dist/stories/Inputs/NumberInput.stories.tsx +342 -0
- package/dist/stories/Inputs/Radio.stories.tsx +437 -0
- package/dist/stories/Inputs/RadioGroup.stories.tsx +526 -0
- package/dist/stories/Inputs/SegmentedControl.stories.tsx +60 -0
- package/dist/stories/Inputs/Slider.stories.tsx +22 -0
- package/dist/stories/Inputs/SliderWithLabel.stories.tsx +37 -0
- package/dist/stories/Inputs/Switch.stories.tsx +361 -0
- package/dist/stories/Inputs/TextArea.stories.tsx +355 -0
- package/dist/stories/Inputs/TextInput.stories.tsx +266 -0
- package/dist/stories/Misc/Divider.stories.tsx +581 -0
- package/dist/stories/Misc/Paper.stories.tsx +557 -0
- package/dist/stories/Navigation/Breadcrumb.stories.tsx +489 -0
- package/dist/stories/Navigation/NavLink.stories.tsx +601 -0
- package/dist/stories/Navigation/Stepper.stories.tsx +413 -0
- package/dist/stories/Navigation/Tabs.stories.tsx +528 -0
- package/dist/stories/Overlays/Drawer.stories.tsx +802 -0
- package/dist/stories/Overlays/Menu.stories.tsx +941 -0
- package/dist/stories/Overlays/Modal.stories.tsx +249 -0
- package/dist/stories/Overlays/Popover.stories.tsx +780 -0
- package/dist/stories/Overlays/Tooltip.stories.tsx +52 -0
- package/dist/stories/Typography/Code.stories.tsx +368 -0
- package/dist/stories/Typography/Kbd.stories.tsx +514 -0
- package/dist/stories/Typography/Text.stories.tsx +117 -0
- package/dist/stories/Typography/Title.stories.tsx +112 -0
- package/dist/stories/index.json +1435 -0
- package/package.json +5 -3
- package/dist/ComplexComponents/PageContentHeader/DescriptionBlock.tsx +0 -65
|
@@ -0,0 +1,479 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/nextjs-vite';
|
|
2
|
+
import { Stack } from '@mantine/core';
|
|
3
|
+
import { SimpleGrid, Inline, CopyButton, Title, Text, Paper, Card, TextInput, Code } from '@appdirect/design-system';
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof CopyButton> = {
|
|
7
|
+
title: 'Design System/Complex Components/Utilities/CopyButton',
|
|
8
|
+
component: CopyButton,
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: 'centered',
|
|
11
|
+
docs: {
|
|
12
|
+
description: {
|
|
13
|
+
component: 'A reusable button component with copy-to-clipboard functionality and interactive tooltips. Shows "Copy" on hover and "Copied" after clicking, resetting when cursor leaves.',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
tags: ['autodocs', 'needs-connect'],
|
|
18
|
+
argTypes: {
|
|
19
|
+
value: {
|
|
20
|
+
control: 'text',
|
|
21
|
+
description: 'Value to copy to clipboard',
|
|
22
|
+
},
|
|
23
|
+
label: {
|
|
24
|
+
control: 'text',
|
|
25
|
+
description: 'Label for accessibility and tooltip context',
|
|
26
|
+
},
|
|
27
|
+
iconSize: {
|
|
28
|
+
control: 'number',
|
|
29
|
+
description: 'Size of the copy icon',
|
|
30
|
+
},
|
|
31
|
+
onCopy: {
|
|
32
|
+
action: 'copied',
|
|
33
|
+
description: 'Callback when copy action is performed',
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export default meta;
|
|
39
|
+
type Story = StoryObj<typeof meta>;
|
|
40
|
+
|
|
41
|
+
export const Default: Story = {
|
|
42
|
+
args: {
|
|
43
|
+
value: 'Hello World',
|
|
44
|
+
label: 'Text',
|
|
45
|
+
onCopy: (value) => {
|
|
46
|
+
navigator.clipboard.writeText(value);
|
|
47
|
+
console.log('Copied:', value);
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const BasicUsage: Story = {
|
|
53
|
+
render: () => {
|
|
54
|
+
const [copyStatus, setCopyStatus] = useState<string>('');
|
|
55
|
+
|
|
56
|
+
const handleCopy = (value: string, context: string) => {
|
|
57
|
+
navigator.clipboard.writeText(value);
|
|
58
|
+
setCopyStatus(`Copied ${context}: ${value}`);
|
|
59
|
+
setTimeout(() => setCopyStatus(''), 3000);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<Stack gap="lg" w={400}>
|
|
64
|
+
<Title order={3} size="md">Basic Copy Examples</Title>
|
|
65
|
+
|
|
66
|
+
<Inline gap="md" align="center">
|
|
67
|
+
<Text size="sm">Simple text:</Text>
|
|
68
|
+
<Text fw={500}>Hello World</Text>
|
|
69
|
+
<CopyButton
|
|
70
|
+
value="Hello World"
|
|
71
|
+
label="text"
|
|
72
|
+
onCopy={(v) => handleCopy(v, "text")}
|
|
73
|
+
/>
|
|
74
|
+
</Inline>
|
|
75
|
+
|
|
76
|
+
<Inline gap="md" align="center">
|
|
77
|
+
<Text size="sm">Email:</Text>
|
|
78
|
+
<Text fw={500}>user@example.com</Text>
|
|
79
|
+
<CopyButton
|
|
80
|
+
value="user@example.com"
|
|
81
|
+
label="email"
|
|
82
|
+
onCopy={(v) => handleCopy(v, "email")}
|
|
83
|
+
/>
|
|
84
|
+
</Inline>
|
|
85
|
+
|
|
86
|
+
<Inline gap="md" align="center">
|
|
87
|
+
<Text size="sm">Phone:</Text>
|
|
88
|
+
<Text fw={500}>+1 (555) 123-4567</Text>
|
|
89
|
+
<CopyButton
|
|
90
|
+
value="+1 (555) 123-4567"
|
|
91
|
+
label="phone number"
|
|
92
|
+
onCopy={(v) => handleCopy(v, "phone")}
|
|
93
|
+
/>
|
|
94
|
+
</Inline>
|
|
95
|
+
|
|
96
|
+
{copyStatus && (
|
|
97
|
+
<Text size="sm" c="green" fw={500}>
|
|
98
|
+
{copyStatus}
|
|
99
|
+
</Text>
|
|
100
|
+
)}
|
|
101
|
+
</Stack>
|
|
102
|
+
);
|
|
103
|
+
},
|
|
104
|
+
parameters: {
|
|
105
|
+
docs: {
|
|
106
|
+
description: {
|
|
107
|
+
story: 'Basic usage examples with different types of content.',
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export const DifferentSizes: Story = {
|
|
114
|
+
render: () => (
|
|
115
|
+
<Stack gap="lg" w={400}>
|
|
116
|
+
<Title order={3} size="md">Different Icon Sizes</Title>
|
|
117
|
+
|
|
118
|
+
<Inline gap="xl" align="center">
|
|
119
|
+
<Stack gap="xs" align="center">
|
|
120
|
+
<Text size="xs">Small (16px)</Text>
|
|
121
|
+
<CopyButton
|
|
122
|
+
value="Small icon"
|
|
123
|
+
label="small text"
|
|
124
|
+
iconSize={16}
|
|
125
|
+
onCopy={(v) => navigator.clipboard.writeText(v)}
|
|
126
|
+
/>
|
|
127
|
+
</Stack>
|
|
128
|
+
|
|
129
|
+
<Stack gap="xs" align="center">
|
|
130
|
+
<Text size="xs">Default (24px)</Text>
|
|
131
|
+
<CopyButton
|
|
132
|
+
value="Default icon"
|
|
133
|
+
label="default text"
|
|
134
|
+
onCopy={(v) => navigator.clipboard.writeText(v)}
|
|
135
|
+
/>
|
|
136
|
+
</Stack>
|
|
137
|
+
|
|
138
|
+
<Stack gap="xs" align="center">
|
|
139
|
+
<Text size="xs">Large (32px)</Text>
|
|
140
|
+
<CopyButton
|
|
141
|
+
value="Large icon"
|
|
142
|
+
label="large text"
|
|
143
|
+
iconSize={32}
|
|
144
|
+
onCopy={(v) => navigator.clipboard.writeText(v)}
|
|
145
|
+
/>
|
|
146
|
+
</Stack>
|
|
147
|
+
</Inline>
|
|
148
|
+
</Stack>
|
|
149
|
+
),
|
|
150
|
+
parameters: {
|
|
151
|
+
docs: {
|
|
152
|
+
description: {
|
|
153
|
+
story: 'CopyButton with different icon sizes for various use cases.',
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
export const WithCodeSnippets: Story = {
|
|
160
|
+
render: () => {
|
|
161
|
+
const [copyStatus, setCopyStatus] = useState<string>('');
|
|
162
|
+
|
|
163
|
+
const handleCopy = (value: string, type: string) => {
|
|
164
|
+
navigator.clipboard.writeText(value);
|
|
165
|
+
setCopyStatus(`Copied ${type}`);
|
|
166
|
+
setTimeout(() => setCopyStatus(''), 3000);
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
const codeExamples = [
|
|
170
|
+
{
|
|
171
|
+
label: 'JavaScript',
|
|
172
|
+
code: 'const greeting = "Hello, World!";',
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
label: 'CSS',
|
|
176
|
+
code: '.button { background: #007bff; color: white; }',
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
label: 'HTML',
|
|
180
|
+
code: '<div class="container"><h1>Title</h1></div>',
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
label: 'JSON',
|
|
184
|
+
code: '{"name": "John", "age": 30, "city": "New York"}',
|
|
185
|
+
},
|
|
186
|
+
];
|
|
187
|
+
|
|
188
|
+
return (
|
|
189
|
+
<Stack gap="lg" w={600}>
|
|
190
|
+
<Title order={3} size="md">Code Snippet Examples</Title>
|
|
191
|
+
|
|
192
|
+
{codeExamples.map((example, index) => (
|
|
193
|
+
<Paper key={index}>
|
|
194
|
+
<Inline gap="sm" align="flex-start" mb="xs">
|
|
195
|
+
<Text size="sm" fw={500}>{example.label}:</Text>
|
|
196
|
+
<CopyButton
|
|
197
|
+
value={example.code}
|
|
198
|
+
label={`${example.label} code`}
|
|
199
|
+
iconSize={16}
|
|
200
|
+
onCopy={(v) => handleCopy(v, example.label)}
|
|
201
|
+
/>
|
|
202
|
+
</Inline>
|
|
203
|
+
<Code block>{example.code}</Code>
|
|
204
|
+
</Paper>
|
|
205
|
+
))}
|
|
206
|
+
|
|
207
|
+
{copyStatus && (
|
|
208
|
+
<Text size="sm" c="green" fw={500}>
|
|
209
|
+
{copyStatus}
|
|
210
|
+
</Text>
|
|
211
|
+
)}
|
|
212
|
+
</Stack>
|
|
213
|
+
);
|
|
214
|
+
},
|
|
215
|
+
parameters: {
|
|
216
|
+
docs: {
|
|
217
|
+
description: {
|
|
218
|
+
story: 'Using CopyButton with code snippets and formatted content.',
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
export const CredentialsExample: Story = {
|
|
225
|
+
render: () => {
|
|
226
|
+
const [copyStatus, setCopyStatus] = useState<string>('');
|
|
227
|
+
|
|
228
|
+
const handleCopy = (value: string, type: string) => {
|
|
229
|
+
navigator.clipboard.writeText(value);
|
|
230
|
+
setCopyStatus(`Copied ${type}`);
|
|
231
|
+
setTimeout(() => setCopyStatus(''), 2000);
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
const credentials = [
|
|
235
|
+
{ label: 'API Key', value: 'sk-1234567890abcdefghijklmnopqrstuvwxyz', sensitive: true },
|
|
236
|
+
{ label: 'Secret Key', value: 'secret_abcdef123456789', sensitive: true },
|
|
237
|
+
{ label: 'Database URL', value: 'postgresql://user:pass@localhost:5432/db', sensitive: true },
|
|
238
|
+
{ label: 'Webhook URL', value: 'https://api.example.com/webhooks/abc123', sensitive: false },
|
|
239
|
+
];
|
|
240
|
+
|
|
241
|
+
return (
|
|
242
|
+
<Stack gap="lg" w={500}>
|
|
243
|
+
<Title order={3} size="md">API Credentials</Title>
|
|
244
|
+
|
|
245
|
+
<Card>
|
|
246
|
+
<Stack gap="md">
|
|
247
|
+
{credentials.map((cred, index) => (
|
|
248
|
+
<Inline key={index} gap="sm" align="center">
|
|
249
|
+
<Text size="sm" c="dimmed" w={100}>
|
|
250
|
+
{cred.label}:
|
|
251
|
+
</Text>
|
|
252
|
+
<Code
|
|
253
|
+
style={{
|
|
254
|
+
flex: 1,
|
|
255
|
+
fontFamily: 'monospace',
|
|
256
|
+
fontSize: '12px',
|
|
257
|
+
overflow: 'hidden',
|
|
258
|
+
textOverflow: 'ellipsis',
|
|
259
|
+
whiteSpace: 'nowrap'
|
|
260
|
+
}}
|
|
261
|
+
>
|
|
262
|
+
{cred.sensitive ? cred.value.substring(0, 20) + '...' : cred.value}
|
|
263
|
+
</Code>
|
|
264
|
+
<CopyButton
|
|
265
|
+
value={cred.value}
|
|
266
|
+
label={cred.label}
|
|
267
|
+
iconSize={16}
|
|
268
|
+
onCopy={(v) => handleCopy(v, cred.label)}
|
|
269
|
+
/>
|
|
270
|
+
</Inline>
|
|
271
|
+
))}
|
|
272
|
+
</Stack>
|
|
273
|
+
</Card>
|
|
274
|
+
|
|
275
|
+
{copyStatus && (
|
|
276
|
+
<Text size="sm" c="green" fw={500}>
|
|
277
|
+
✓ {copyStatus}
|
|
278
|
+
</Text>
|
|
279
|
+
)}
|
|
280
|
+
</Stack>
|
|
281
|
+
);
|
|
282
|
+
},
|
|
283
|
+
parameters: {
|
|
284
|
+
docs: {
|
|
285
|
+
description: {
|
|
286
|
+
story: 'Real-world example with API credentials and sensitive data.',
|
|
287
|
+
},
|
|
288
|
+
},
|
|
289
|
+
},
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
export const WithInputFields: Story = {
|
|
293
|
+
render: () => {
|
|
294
|
+
const [copyStatus, setCopyStatus] = useState<string>('');
|
|
295
|
+
const [formData, setFormData] = useState({
|
|
296
|
+
username: 'john_doe_2024',
|
|
297
|
+
email: 'john.doe@company.com',
|
|
298
|
+
userId: 'usr_1234567890',
|
|
299
|
+
apiToken: 'tok_abcdefghijklmnopqrstuvwxyz123456',
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
const handleCopy = (value: string, field: string) => {
|
|
303
|
+
navigator.clipboard.writeText(value);
|
|
304
|
+
setCopyStatus(`Copied ${field}`);
|
|
305
|
+
setTimeout(() => setCopyStatus(''), 2000);
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
return (
|
|
309
|
+
<Stack gap="lg" w={400}>
|
|
310
|
+
<Title order={3} size="md">Form Fields with Copy</Title>
|
|
311
|
+
|
|
312
|
+
<Stack gap="md">
|
|
313
|
+
<Inline gap="xs" align="flex-end">
|
|
314
|
+
<TextInput
|
|
315
|
+
label="Username"
|
|
316
|
+
value={formData.username}
|
|
317
|
+
readOnly
|
|
318
|
+
style={{ flex: 1 }}
|
|
319
|
+
/>
|
|
320
|
+
<CopyButton
|
|
321
|
+
value={formData.username}
|
|
322
|
+
label="username"
|
|
323
|
+
onCopy={(v) => handleCopy(v, "username")}
|
|
324
|
+
/>
|
|
325
|
+
</Inline>
|
|
326
|
+
|
|
327
|
+
<Inline gap="xs" align="flex-end">
|
|
328
|
+
<TextInput
|
|
329
|
+
label="Email"
|
|
330
|
+
value={formData.email}
|
|
331
|
+
readOnly
|
|
332
|
+
style={{ flex: 1 }}
|
|
333
|
+
/>
|
|
334
|
+
<CopyButton
|
|
335
|
+
value={formData.email}
|
|
336
|
+
label="email"
|
|
337
|
+
onCopy={(v) => handleCopy(v, "email")}
|
|
338
|
+
/>
|
|
339
|
+
</Inline>
|
|
340
|
+
|
|
341
|
+
<Inline gap="xs" align="flex-end">
|
|
342
|
+
<TextInput
|
|
343
|
+
label="User ID"
|
|
344
|
+
value={formData.userId}
|
|
345
|
+
readOnly
|
|
346
|
+
style={{ flex: 1 }}
|
|
347
|
+
/>
|
|
348
|
+
<CopyButton
|
|
349
|
+
value={formData.userId}
|
|
350
|
+
label="user ID"
|
|
351
|
+
onCopy={(v) => handleCopy(v, "user ID")}
|
|
352
|
+
/>
|
|
353
|
+
</Inline>
|
|
354
|
+
|
|
355
|
+
<Inline gap="xs" align="flex-end">
|
|
356
|
+
<TextInput
|
|
357
|
+
label="API Token"
|
|
358
|
+
value={formData.apiToken}
|
|
359
|
+
readOnly
|
|
360
|
+
type="password"
|
|
361
|
+
style={{ flex: 1 }}
|
|
362
|
+
/>
|
|
363
|
+
<CopyButton
|
|
364
|
+
value={formData.apiToken}
|
|
365
|
+
label="API token"
|
|
366
|
+
onCopy={(v) => handleCopy(v, "API token")}
|
|
367
|
+
/>
|
|
368
|
+
</Inline>
|
|
369
|
+
</Stack>
|
|
370
|
+
|
|
371
|
+
{copyStatus && (
|
|
372
|
+
<Text size="sm" c="green" fw={500}>
|
|
373
|
+
✓ {copyStatus}
|
|
374
|
+
</Text>
|
|
375
|
+
)}
|
|
376
|
+
</Stack>
|
|
377
|
+
);
|
|
378
|
+
},
|
|
379
|
+
parameters: {
|
|
380
|
+
docs: {
|
|
381
|
+
description: {
|
|
382
|
+
story: 'CopyButton integrated with form fields for easy data copying.',
|
|
383
|
+
},
|
|
384
|
+
},
|
|
385
|
+
},
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
export const SystemInformation: Story = {
|
|
389
|
+
render: () => {
|
|
390
|
+
const [copyStatus, setCopyStatus] = useState<string>('');
|
|
391
|
+
|
|
392
|
+
const handleCopy = (value: string, type: string) => {
|
|
393
|
+
navigator.clipboard.writeText(value);
|
|
394
|
+
setCopyStatus(`Copied ${type}`);
|
|
395
|
+
setTimeout(() => setCopyStatus(''), 2000);
|
|
396
|
+
};
|
|
397
|
+
|
|
398
|
+
const systemInfo = [
|
|
399
|
+
{ label: 'Server ID', value: 'srv-prod-web-01', category: 'Infrastructure' },
|
|
400
|
+
{ label: 'IP Address', value: '192.168.1.100', category: 'Network' },
|
|
401
|
+
{ label: 'MAC Address', value: '00:1B:44:11:3A:B7', category: 'Network' },
|
|
402
|
+
{ label: 'Docker Image', value: 'myapp:v2.1.0-alpine', category: 'Deployment' },
|
|
403
|
+
{ label: 'Container ID', value: 'c8f4b8d2e1a9', category: 'Deployment' },
|
|
404
|
+
{ label: 'Build Hash', value: 'a1b2c3d4e5f6g7h8i9j0', category: 'Build' },
|
|
405
|
+
];
|
|
406
|
+
|
|
407
|
+
const groupedInfo = systemInfo.reduce((acc, item) => {
|
|
408
|
+
if (!acc[item.category]) acc[item.category] = [];
|
|
409
|
+
acc[item.category].push(item);
|
|
410
|
+
return acc;
|
|
411
|
+
}, {} as Record<string, typeof systemInfo>);
|
|
412
|
+
|
|
413
|
+
return (
|
|
414
|
+
<Stack gap="lg" w={600}>
|
|
415
|
+
<Title order={3} size="md">System Information</Title>
|
|
416
|
+
|
|
417
|
+
<SimpleGrid cols={2} spacing="md">
|
|
418
|
+
{Object.entries(groupedInfo).map(([category, items]) => (
|
|
419
|
+
<Card key={category}>
|
|
420
|
+
<Stack gap="sm">
|
|
421
|
+
<Title order={4} size="sm" c="blue">
|
|
422
|
+
{category}
|
|
423
|
+
</Title>
|
|
424
|
+
{items.map((item, index) => (
|
|
425
|
+
<Inline key={index} gap="xs" align="center">
|
|
426
|
+
<Text size="xs" c="dimmed" w={80}>
|
|
427
|
+
{item.label}:
|
|
428
|
+
</Text>
|
|
429
|
+
<Code size="xs" style={{ flex: 1 }}>
|
|
430
|
+
{item.value}
|
|
431
|
+
</Code>
|
|
432
|
+
<CopyButton
|
|
433
|
+
value={item.value}
|
|
434
|
+
label={item.label}
|
|
435
|
+
iconSize={14}
|
|
436
|
+
onCopy={(v) => handleCopy(v, item.label)}
|
|
437
|
+
/>
|
|
438
|
+
</Inline>
|
|
439
|
+
))}
|
|
440
|
+
</Stack>
|
|
441
|
+
</Card>
|
|
442
|
+
))}
|
|
443
|
+
</SimpleGrid>
|
|
444
|
+
|
|
445
|
+
{copyStatus && (
|
|
446
|
+
<Text size="sm" c="green" fw={500}>
|
|
447
|
+
✓ {copyStatus}
|
|
448
|
+
</Text>
|
|
449
|
+
)}
|
|
450
|
+
</Stack>
|
|
451
|
+
);
|
|
452
|
+
},
|
|
453
|
+
parameters: {
|
|
454
|
+
docs: {
|
|
455
|
+
description: {
|
|
456
|
+
story: 'System information dashboard with categorized copyable data.',
|
|
457
|
+
},
|
|
458
|
+
},
|
|
459
|
+
},
|
|
460
|
+
};
|
|
461
|
+
|
|
462
|
+
export const Interactive: Story = {
|
|
463
|
+
args: {
|
|
464
|
+
value: 'Interactive Example',
|
|
465
|
+
label: 'example text',
|
|
466
|
+
iconSize: 24,
|
|
467
|
+
onCopy: (value) => {
|
|
468
|
+
navigator.clipboard.writeText(value);
|
|
469
|
+
console.log('Copied:', value);
|
|
470
|
+
},
|
|
471
|
+
},
|
|
472
|
+
parameters: {
|
|
473
|
+
docs: {
|
|
474
|
+
description: {
|
|
475
|
+
story: 'Use the controls below to interact with the CopyButton and see different combinations.',
|
|
476
|
+
},
|
|
477
|
+
},
|
|
478
|
+
},
|
|
479
|
+
};
|