@remit/ui 0.0.53 → 0.0.54

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remit/ui",
3
- "version": "0.0.53",
3
+ "version": "0.0.54",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src"
@@ -0,0 +1,72 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { labelColorOptions } from "../lib/label-color.js";
3
+ import { LabelChip } from "./label-chip.js";
4
+
5
+ const meta: Meta<typeof LabelChip> = {
6
+ title: "Primitives/LabelChip",
7
+ component: LabelChip,
8
+ parameters: { layout: "padded" },
9
+ };
10
+ export default meta;
11
+
12
+ type Story = StoryObj<typeof LabelChip>;
13
+
14
+ /** A chip in each color the picker offers — the dot is the only thing that varies. */
15
+ export const AllColors: Story = {
16
+ render: () => (
17
+ <div className="flex flex-wrap gap-2">
18
+ {labelColorOptions.map((color) => (
19
+ <LabelChip
20
+ key={color}
21
+ label={{ labelId: `lbl-${color}`, name: color, color }}
22
+ />
23
+ ))}
24
+ </div>
25
+ ),
26
+ };
27
+
28
+ /** Same colors against the dark theme, so the dot keeps contrast either way. */
29
+ export const AllColorsDark: Story = {
30
+ name: "All Colors (dark)",
31
+ parameters: { theme: "dark" },
32
+ render: () => (
33
+ <div className="flex flex-wrap gap-2">
34
+ {labelColorOptions.map((color) => (
35
+ <LabelChip
36
+ key={color}
37
+ label={{ labelId: `lbl-${color}`, name: color, color }}
38
+ />
39
+ ))}
40
+ </div>
41
+ ),
42
+ };
43
+
44
+ /** A long name truncates rather than growing the chip. */
45
+ export const LongName: Story = {
46
+ args: {
47
+ label: {
48
+ labelId: "lbl-long",
49
+ name: "Quarterly compliance filings that need a second look",
50
+ color: "Purple",
51
+ },
52
+ className: "max-w-40",
53
+ },
54
+ };
55
+
56
+ /** The removable variant — the manual "just these" unlabel action. */
57
+ export const Removable: Story = {
58
+ args: {
59
+ label: { labelId: "lbl-receipts", name: "Receipts", color: "Blue" },
60
+ onRemove: () => undefined,
61
+ },
62
+ };
63
+
64
+ /** Removable, on the dark theme. */
65
+ export const RemovableDark: Story = {
66
+ name: "Removable (dark)",
67
+ parameters: { theme: "dark" },
68
+ args: {
69
+ label: { labelId: "lbl-receipts", name: "Receipts", color: "Blue" },
70
+ onRemove: () => undefined,
71
+ },
72
+ };
@@ -73,6 +73,81 @@ const withCategory: ThreadRowData = {
73
73
  category: "newsletter",
74
74
  };
75
75
 
76
+ const noLabel: ThreadRowData = {
77
+ id: "r-no-label",
78
+ accountId: "a1",
79
+ fromName: "Jordan Lee",
80
+ fromEmail: "jordan@example.com",
81
+ subject: "Lunch on Friday?",
82
+ snippet: "Thinking the usual place, around noon.",
83
+ timeLabel: "10:03",
84
+ isRead: true,
85
+ };
86
+
87
+ const oneLabel: ThreadRowData = {
88
+ id: "r-one-label",
89
+ accountId: "a1",
90
+ fromName: "Stripe",
91
+ fromEmail: "receipts@stripe.com",
92
+ subject: "Your receipt from Acme Co",
93
+ snippet: "Payment of $42.00 was successful.",
94
+ timeLabel: "9:10",
95
+ isRead: true,
96
+ labels: [{ labelId: "l1", name: "Receipts", color: "Blue" }],
97
+ };
98
+
99
+ const twoLabels: ThreadRowData = {
100
+ id: "r-two-labels",
101
+ accountId: "a1",
102
+ fromName: "United Airlines",
103
+ fromEmail: "noreply@united.com",
104
+ subject: "Your itinerary for SFO → JFK",
105
+ snippet: "Check-in opens 24 hours before departure.",
106
+ timeLabel: "Yesterday",
107
+ isRead: false,
108
+ labels: [
109
+ { labelId: "l1", name: "Receipts", color: "Blue" },
110
+ { labelId: "l2", name: "Travel", color: "Green" },
111
+ ],
112
+ };
113
+
114
+ const severalLabels: ThreadRowData = {
115
+ id: "r-several-labels",
116
+ accountId: "a1",
117
+ fromName: "Finance Team",
118
+ fromEmail: "finance@example.com",
119
+ subject: "Q3 budget review — action needed",
120
+ snippet: "Please review the attached numbers before Thursday.",
121
+ timeLabel: "Mon",
122
+ isRead: false,
123
+ labels: [
124
+ { labelId: "l1", name: "Receipts", color: "Blue" },
125
+ { labelId: "l2", name: "Travel", color: "Green" },
126
+ { labelId: "l3", name: "Urgent", color: "Red" },
127
+ { labelId: "l4", name: "Work", color: "Purple" },
128
+ ],
129
+ };
130
+
131
+ const longLabelName: ThreadRowData = {
132
+ id: "r-long-label",
133
+ accountId: "a1",
134
+ fromName: "Compliance",
135
+ fromEmail: "compliance@example.com",
136
+ subject: "Filing due end of quarter",
137
+ snippet: "One outstanding item on the checklist.",
138
+ timeLabel: "Tue",
139
+ isRead: true,
140
+ labels: [
141
+ {
142
+ labelId: "l5",
143
+ name: "Quarterly compliance filings that need a second look",
144
+ color: "Purple",
145
+ },
146
+ ],
147
+ };
148
+
149
+ const labeled = [noLabel, oneLabel, twoLabels, severalLabels, longLabelName];
150
+
76
151
  const all = [read, unread, starred, suspicious, withAttachment, withCategory];
77
152
 
78
153
  const meta: Meta = {
@@ -149,3 +224,60 @@ export const Selectable: Story = {
149
224
  </List>
150
225
  ),
151
226
  };
227
+
228
+ /**
229
+ * Labels (issue #26) alongside the existing read/unread, attachment and
230
+ * category affordances — no label, one, two, several, and a long name that
231
+ * truncates rather than growing the row. Comfortable density renders the
232
+ * chips; compact does not (see `CompactLabels` below).
233
+ */
234
+ export const ComfortableLabels: Story = {
235
+ render: () => (
236
+ <List>
237
+ {labeled.map((thread) => (
238
+ <ComfortableRow key={thread.id} thread={thread} />
239
+ ))}
240
+ </List>
241
+ ),
242
+ };
243
+
244
+ /** The same labeled threads on the dark theme. */
245
+ export const ComfortableLabelsDark: Story = {
246
+ name: "Comfortable Labels (dark)",
247
+ parameters: { theme: "dark" },
248
+ render: () => (
249
+ <List>
250
+ {labeled.map((thread) => (
251
+ <ComfortableRow key={thread.id} thread={thread} />
252
+ ))}
253
+ </List>
254
+ ),
255
+ };
256
+
257
+ /**
258
+ * The same labeled threads in compact density. `CompactRowBody` carries no
259
+ * label rendering today — this documents that as the approved current
260
+ * behavior, not an oversight in the story.
261
+ */
262
+ export const CompactLabels: Story = {
263
+ render: () => (
264
+ <List>
265
+ {labeled.map((thread) => (
266
+ <CompactRow key={thread.id} thread={thread} />
267
+ ))}
268
+ </List>
269
+ ),
270
+ };
271
+
272
+ /** Compact density, dark theme. */
273
+ export const CompactLabelsDark: Story = {
274
+ name: "Compact Labels (dark)",
275
+ parameters: { theme: "dark" },
276
+ render: () => (
277
+ <List>
278
+ {labeled.map((thread) => (
279
+ <CompactRow key={thread.id} thread={thread} />
280
+ ))}
281
+ </List>
282
+ ),
283
+ };