Bin
2025-12-16 9e0b2ba2c317b1a86212f24cbae3195ad1f3dbfa
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
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
import type { Meta, StoryObj } from "@storybook/react";
import { EmptyState } from "./empty-state";
import { Button } from "../button/button";
import {
  IconUpload,
  IconSearch,
  IconInbox,
  IconLsLabeling,
  IconLsReview,
  IconCheck,
  IconCloudProviderS3,
  IconCloudProviderGCS,
  IconCloudProviderAzure,
  IconCloudProviderRedis,
  IconExternal,
  IconRelationLink,
} from "@humansignal/icons";
import { Typography } from "../typography/typography";
import { Tooltip } from "../Tooltip/Tooltip";
 
const meta: Meta<typeof EmptyState> = {
  component: EmptyState,
  title: "UI/Empty State",
  parameters: {
    docs: {
      description: {
        component:
          "A reusable empty state component for displaying various empty states throughout the application with support for different sizes and customizable content.",
      },
    },
  },
  argTypes: {
    size: {
      control: "select",
      options: ["large", "medium", "small"],
      description: "Size of the empty state",
    },
    variant: {
      control: "select",
      options: ["primary", "neutral", "negative", "positive", "warning", "gradient"],
      description: "Color variant of the empty state",
    },
    icon: {
      control: false,
      description: "Icon element to display",
    },
 
    title: {
      control: "text",
      description: "Main title text",
    },
    description: {
      control: "text",
      description: "Description text below the title",
    },
    actions: {
      control: false,
      description: "Action buttons or other interactive elements",
    },
    additionalContent: {
      control: false,
      description: "Additional content to display between description and actions",
    },
    footer: {
      control: false,
      description: "Footer content displayed at the bottom",
    },
  },
};
 
export default meta;
type Story = StoryObj<typeof EmptyState>;
 
// Basic Stories
export const Default: Story = {
  args: {
    size: "medium",
    variant: "primary",
    icon: <IconInbox />,
    title: "Add your first items",
    description: "Start building your collection by adding new items",
    footer: (
      <Typography variant="label" size="small" className="text-primary-link">
        <a href="/docs/labeling-interface" className="inline-flex items-center gap-1 hover:underline">
          Learn more
          <IconExternal width={16} height={16} />
        </a>
      </Typography>
    ),
  },
};
 
export const WithSingleAction: Story = {
  args: {
    size: "medium",
    variant: "primary",
    icon: <IconUpload />,
    title: "Upload your data",
    description: "Choose a file from your computer to get started",
    actions: (
      <Button variant="primary" look="filled">
        Upload File
      </Button>
    ),
  },
};
 
export const WithMultipleActions: Story = {
  args: {
    size: "medium",
    variant: "primary",
    icon: <IconUpload />,
    title: "Import data to get started",
    description: "Connect your cloud storage or upload files from your computer",
    actions: (
      <>
        <Button variant="primary" look="filled" className="flex-1">
          Connect Cloud Storage
        </Button>
        <Button variant="primary" look="outlined" className="flex-1">
          Upload Files
        </Button>
      </>
    ),
  },
};
 
// Size Comparison Stories
export const SizeComparison: Story = {
  render: () => (
    <div className="space-y-12">
      <div>
        <h3 className="text-lg font-semibold mb-4">Large Size (Data Manager Style)</h3>
        <div className="border border-neutral-border rounded-lg p-4 h-96">
          <EmptyState
            size="large"
            variant="primary"
            icon={<IconUpload />}
            title="Import data to get your project started"
            description="Connect your cloud storage or upload files from your computer"
            actions={
              <>
                <Button variant="primary" look="filled" className="flex-1">
                  Connect Cloud Storage
                </Button>
                <Button variant="primary" look="outlined" className="flex-1">
                  Import
                </Button>
              </>
            }
          />
        </div>
      </div>
 
      <div>
        <h3 className="text-lg font-semibold mb-4">Medium Size (Home Page Style)</h3>
        <div className="border border-neutral-border rounded-lg p-4 h-64">
          <EmptyState
            size="medium"
            variant="primary"
            icon={<IconUpload />}
            title="Create your first project"
            description="Import your data and set up the labeling interface to start annotating"
            actions={
              <Button variant="primary" look="filled">
                Create Project
              </Button>
            }
          />
        </div>
      </div>
 
      <div>
        <h3 className="text-lg font-semibold mb-4">Small Size (Sidepanel Style)</h3>
        <div className="border border-neutral-border rounded-lg p-4 h-48">
          <EmptyState
            size="small"
            variant="primary"
            icon={<IconLsLabeling />}
            title="Labeled regions will appear here"
            description="Start labeling and track your results using this panel"
            footer={
              <Typography variant="label" size="small" className="text-primary-link">
                <a href="/docs/labeling-interface" className="inline-flex items-center gap-1 hover:underline">
                  Learn more
                  <IconExternal width={16} height={16} />
                </a>
              </Typography>
            }
          />
        </div>
      </div>
    </div>
  ),
};
 
// Color Variant Stories
export const ColorVariants: Story = {
  render: () => (
    <div className="grid grid-cols-3 gap-8">
      <div className="border border-neutral-border rounded-lg p-4 h-64">
        <EmptyState
          size="medium"
          variant="primary"
          icon={<IconUpload />}
          title="Primary Variant"
          description="Default blue theme for standard empty states"
        />
      </div>
 
      <div className="border border-neutral-border rounded-lg p-4 h-64">
        <EmptyState
          size="medium"
          variant="neutral"
          icon={<IconInbox />}
          title="Neutral Variant"
          description="Gray theme for neutral states"
        />
      </div>
 
      <div className="border border-neutral-border rounded-lg p-4 h-64">
        <EmptyState
          size="medium"
          variant="negative"
          icon={<IconSearch />}
          title="Negative Variant"
          description="Red theme for error states and failures"
        />
      </div>
 
      <div className="border border-neutral-border rounded-lg p-4 h-64">
        <EmptyState
          size="medium"
          variant="positive"
          icon={<IconCheck />}
          title="Positive Variant"
          description="Green theme for success states"
        />
      </div>
 
      <div className="border border-neutral-border rounded-lg p-4 h-64">
        <EmptyState
          size="medium"
          variant="warning"
          icon={<IconSearch />}
          title="Warning Variant"
          description="Orange/Yellow theme for warning states"
        />
      </div>
 
      <div className="border border-neutral-border rounded-lg p-4 h-64">
        <EmptyState
          size="medium"
          variant="gradient"
          icon={<IconLsLabeling />}
          title="Gradient Variant"
          description="AI gradient theme with special effects and pulsating animation"
        />
      </div>
    </div>
  ),
};
 
// Data Manager Inspired Stories
export const DataManagerImport: Story = {
  args: {
    size: "large",
    variant: "primary",
    icon: <IconUpload />,
    title: "Import data to get your project started",
    description: "Connect your cloud storage or upload files from your computer",
    additionalContent: (
      <div className="flex items-center justify-center gap-base">
        <Tooltip title="Amazon S3">
          <div className="flex items-center justify-center p-2">
            <IconCloudProviderS3 width={32} height={32} className="text-neutral-content-subtler" />
          </div>
        </Tooltip>
        <Tooltip title="Google Cloud Storage">
          <div className="flex items-center justify-center p-2">
            <IconCloudProviderGCS width={32} height={32} className="text-neutral-content-subtler" />
          </div>
        </Tooltip>
        <Tooltip title="Azure Blob Storage">
          <div className="flex items-center justify-center p-2">
            <IconCloudProviderAzure width={32} height={32} className="text-neutral-content-subtler" />
          </div>
        </Tooltip>
        <Tooltip title="Redis Storage">
          <div className="flex items-center justify-center p-2">
            <IconCloudProviderRedis width={32} height={32} className="text-neutral-content-subtler" />
          </div>
        </Tooltip>
      </div>
    ),
    actions: (
      <>
        <Button variant="primary" look="filled" className="flex-1">
          Connect Cloud Storage
        </Button>
        <Button variant="primary" look="outlined" className="flex-1">
          Import
        </Button>
      </>
    ),
    footer: (
      <Typography variant="label" size="small" className="text-primary-link hover:underline">
        <a href="/docs/import-data" className="inline-flex items-center gap-1">
          See docs on importing data
          <IconExternal width={20} height={20} />
        </a>
      </Typography>
    ),
  },
};
 
export const AnnotatorLabelingState: Story = {
  args: {
    size: "medium",
    variant: "primary",
    icon: <IconLsLabeling />,
    title: "Start labeling tasks",
    description: "Begin labeling to track your progress here",
    actions: (
      <Button variant="primary" look="filled">
        Label All Tasks
      </Button>
    ),
  },
};
 
export const ReviewerEmptyState: Story = {
  args: {
    size: "medium",
    variant: "primary",
    icon: <IconLsReview />,
    title: "Begin reviewing tasks",
    description: "Import tasks to this project to start reviewing",
  },
};
 
export const NoResultsFound: Story = {
  args: {
    size: "medium",
    variant: "warning",
    icon: <IconSearch />,
    title: "Refine your search",
    description: "Adjust or clear your filters to see more results",
    actions: (
      <Button variant="primary" look="outlined">
        Clear Filters
      </Button>
    ),
  },
};
 
export const AssignedTasksEmpty: Story = {
  args: {
    size: "medium",
    variant: "neutral",
    icon: <IconInbox />,
    title: "Wait for task assignment",
    description: "Check back here when tasks get assigned to you",
  },
};
 
export const LabelingQueueComplete: Story = {
  args: {
    size: "medium",
    variant: "positive",
    icon: <IconCheck />,
    title: "You're all caught up!",
    description: "All tasks in the queue have been completed",
    actions: (
      <Button variant="primary" look="outlined">
        Go to Previous Task
      </Button>
    ),
  },
};
 
// Complex Content Example
export const ComplexContent: Story = {
  args: {
    size: "large",
    variant: "primary",
    icon: <IconUpload />,
    title: "Upload your files",
    description: "Choose from multiple upload options and formats to get started",
    additionalContent: (
      <div className="text-center">
        <Typography variant="label" size="small" className="text-neutral-content-subtler mb-2">
          Supported formats: CSV, JSON, TSV, TXT
        </Typography>
        <div className="flex justify-center items-center gap-2 text-neutral-content-subtler">
          <div className="w-2 h-2 bg-positive-icon rounded-full" />
          <Typography variant="label" size="smallest">
            Drag and drop enabled
          </Typography>
        </div>
      </div>
    ),
    actions: (
      <>
        <Button variant="primary" look="filled" className="flex-1">
          Browse Files
        </Button>
        <Button variant="primary" look="outlined" className="flex-1">
          Connect Storage
        </Button>
        <Button variant="neutral" look="outlined">
          Import From URL
        </Button>
      </>
    ),
    footer: (
      <div className="text-center space-y-1">
        <Typography variant="label" size="small" className="text-primary-link">
          <a href="/docs/import-guide" className="hover:underline">
            Need help? View our import guide
          </a>
        </Typography>
        <Typography variant="label" size="smallest" className="text-neutral-content-subtler">
          Maximum file size: 100MB per file
        </Typography>
      </div>
    ),
  },
};
 
// Accessibility Example
export const WithAccessibility: Story = {
  args: {
    size: "medium",
    variant: "primary",
    icon: <IconInbox />,
    title: "Build your collection",
    description: "Start adding items to create your first collection",
    titleId: "accessible-empty-title",
    descriptionId: "accessible-empty-desc",
    "aria-label": "Add items to build your collection",
    "data-testid": "accessible-empty-state",
    actions: (
      <Button variant="primary" look="filled">
        Add First Item
      </Button>
    ),
  },
};
 
// Relations Panel Example
export const RelationsPanel: Story = {
  args: {
    size: "small",
    variant: "primary",
    icon: <IconRelationLink />,
    title: "Create relations between labels",
    description: "Add relations to establish connections between labeled regions",
    actions: (
      <Button variant="primary" look="outlined" size="small">
        Add Relation
      </Button>
    ),
  },
};