@usefragments/ui 1.1.1 → 1.3.0

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.
Files changed (148) hide show
  1. package/dist/assets/ui.css +327 -274
  2. package/dist/components/Checkbox/Checkbox.module.scss.cjs +11 -11
  3. package/dist/components/Checkbox/Checkbox.module.scss.js +11 -11
  4. package/dist/components/Chip/Chip.module.scss.cjs +15 -15
  5. package/dist/components/Chip/Chip.module.scss.js +15 -15
  6. package/dist/components/Combobox/index.cjs +106 -9
  7. package/dist/components/Combobox/index.d.ts.map +1 -1
  8. package/dist/components/Combobox/index.js +106 -9
  9. package/dist/components/DataTable/DataTable.module.scss.cjs +37 -34
  10. package/dist/components/DataTable/DataTable.module.scss.js +37 -34
  11. package/dist/components/DataTable/index.d.ts.map +1 -1
  12. package/dist/components/Main/Main.module.scss.cjs +26 -0
  13. package/dist/components/Main/Main.module.scss.js +26 -0
  14. package/dist/components/Main/index.cjs +128 -0
  15. package/dist/components/Main/index.d.ts +22 -0
  16. package/dist/components/Main/index.d.ts.map +1 -0
  17. package/dist/components/Main/index.js +111 -0
  18. package/dist/components/Table/Table.module.scss.cjs +19 -19
  19. package/dist/components/Table/Table.module.scss.js +19 -19
  20. package/dist/components/TableOfContents/TableOfContents.module.scss.cjs +15 -15
  21. package/dist/components/TableOfContents/TableOfContents.module.scss.js +15 -15
  22. package/dist/components/TableOfContents/index.cjs +22 -42
  23. package/dist/components/TableOfContents/index.d.ts +3 -3
  24. package/dist/components/TableOfContents/index.d.ts.map +1 -1
  25. package/dist/components/TableOfContents/index.js +22 -42
  26. package/dist/{components/DataTable/DataTable.virtual.cjs → data-table-virtual.cjs} +1 -1
  27. package/dist/{components/DataTable/DataTable.virtual.js → data-table-virtual.js} +1 -1
  28. package/dist/data-table.cjs +27 -9
  29. package/dist/data-table.js +19 -1
  30. package/dist/index.cjs +87 -88
  31. package/dist/index.d.ts +1 -1
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js +2 -3
  34. package/fragments.json +1 -1
  35. package/package.json +57 -2
  36. package/src/components/Checkbox/Checkbox.contract.json +5 -24
  37. package/src/components/Checkbox/Checkbox.module.scss +4 -2
  38. package/src/components/Chip/Chip.contract.json +11 -28
  39. package/src/components/Chip/Chip.module.scss +21 -45
  40. package/src/components/Combobox/Combobox.contract.json +6 -24
  41. package/src/components/Combobox/index.tsx +132 -6
  42. package/src/components/DataTable/DataTable.module.scss +31 -8
  43. package/src/components/DataTable/index.tsx +44 -16
  44. package/src/components/Main/Main.contract.json +79 -0
  45. package/src/components/Main/Main.module.scss +31 -0
  46. package/src/components/Main/index.tsx +124 -0
  47. package/src/components/Table/Table.module.scss +22 -5
  48. package/src/components/TableOfContents/TableOfContents.contract.json +6 -16
  49. package/src/components/TableOfContents/TableOfContents.module.scss +10 -13
  50. package/src/components/TableOfContents/index.tsx +27 -38
  51. package/src/index.ts +11 -9
  52. package/src/styles/styles.d.ts +8 -0
  53. package/src/tokens/_component-properties.scss +1 -0
  54. package/dist/components/Cloud/DashboardLayoutPrototypes.shared.d.ts +0 -33
  55. package/dist/components/Cloud/DashboardLayoutPrototypes.shared.d.ts.map +0 -1
  56. package/dist/components/Cloud/DashboardLayoutPrototypes.shell.d.ts +0 -11
  57. package/dist/components/Cloud/DashboardLayoutPrototypes.shell.d.ts.map +0 -1
  58. package/dist/components/Cloud/PullRequestsPrototypes.content.d.ts +0 -5
  59. package/dist/components/Cloud/PullRequestsPrototypes.content.d.ts.map +0 -1
  60. package/dist/components/Cloud/PullRequestsPrototypes.detail-panels.d.ts +0 -4
  61. package/dist/components/Cloud/PullRequestsPrototypes.detail-panels.d.ts.map +0 -1
  62. package/dist/components/Cloud/PullRequestsPrototypes.detail.d.ts +0 -3
  63. package/dist/components/Cloud/PullRequestsPrototypes.detail.d.ts.map +0 -1
  64. package/dist/components/Cloud/PullRequestsPrototypes.id-data.d.ts +0 -86
  65. package/dist/components/Cloud/PullRequestsPrototypes.id-data.d.ts.map +0 -1
  66. package/dist/components/Cloud/PullRequestsPrototypes.id-page.d.ts +0 -2
  67. package/dist/components/Cloud/PullRequestsPrototypes.id-page.d.ts.map +0 -1
  68. package/src/components/Accordion/Accordion.stories.tsx +0 -106
  69. package/src/components/Alert/Alert.stories.tsx +0 -119
  70. package/src/components/AppShell/AppShell.stories.tsx +0 -156
  71. package/src/components/Avatar/Avatar.stories.tsx +0 -74
  72. package/src/components/Badge/Badge.stories.tsx +0 -92
  73. package/src/components/BentoGrid/BentoGrid.stories.tsx +0 -98
  74. package/src/components/Box/Box.stories.tsx +0 -150
  75. package/src/components/Breadcrumbs/Breadcrumbs.stories.tsx +0 -87
  76. package/src/components/Button/Button.stories.tsx +0 -103
  77. package/src/components/ButtonGroup/ButtonGroup.stories.tsx +0 -97
  78. package/src/components/Card/Card.stories.tsx +0 -144
  79. package/src/components/Chart/Chart.stories.tsx +0 -119
  80. package/src/components/Checkbox/Checkbox.stories.tsx +0 -68
  81. package/src/components/Chip/Chip.stories.tsx +0 -70
  82. package/src/components/Cloud/CloudGovernanceShell.module.scss +0 -88
  83. package/src/components/Cloud/CloudGovernanceShell.stories.tsx +0 -446
  84. package/src/components/Cloud/ControlSizing.module.scss +0 -49
  85. package/src/components/Cloud/ControlSizing.stories.tsx +0 -238
  86. package/src/components/Cloud/DashboardLayoutPrototypes.module.scss +0 -462
  87. package/src/components/Cloud/DashboardLayoutPrototypes.shared.tsx +0 -375
  88. package/src/components/Cloud/DashboardLayoutPrototypes.shell.tsx +0 -147
  89. package/src/components/Cloud/DashboardLayoutPrototypes.stories.tsx +0 -328
  90. package/src/components/Cloud/PullRequestsPrototypes.content.tsx +0 -283
  91. package/src/components/Cloud/PullRequestsPrototypes.detail-panels.tsx +0 -381
  92. package/src/components/Cloud/PullRequestsPrototypes.detail.tsx +0 -204
  93. package/src/components/Cloud/PullRequestsPrototypes.id-data.ts +0 -395
  94. package/src/components/Cloud/PullRequestsPrototypes.id-page.tsx +0 -349
  95. package/src/components/Cloud/PullRequestsPrototypes.stories.tsx +0 -81
  96. package/src/components/CodeBlock/CodeBlock.stories.tsx +0 -147
  97. package/src/components/Collapsible/Collapsible.stories.tsx +0 -94
  98. package/src/components/ColorPicker/ColorPicker.stories.tsx +0 -74
  99. package/src/components/Combobox/Combobox.stories.tsx +0 -133
  100. package/src/components/Command/Command.stories.tsx +0 -102
  101. package/src/components/ConversationList/ConversationList.stories.tsx +0 -93
  102. package/src/components/DataTable/DataTable.stories.tsx +0 -129
  103. package/src/components/DatePicker/DatePicker.stories.tsx +0 -129
  104. package/src/components/Dialog/Dialog.stories.tsx +0 -154
  105. package/src/components/Drawer/Drawer.stories.tsx +0 -144
  106. package/src/components/Editor/Editor.stories.tsx +0 -99
  107. package/src/components/EmptyState/EmptyState.stories.tsx +0 -97
  108. package/src/components/Field/Field.stories.tsx +0 -109
  109. package/src/components/Fieldset/Fieldset.stories.tsx +0 -116
  110. package/src/components/Form/Form.stories.tsx +0 -142
  111. package/src/components/Grid/Grid.stories.tsx +0 -125
  112. package/src/components/Header/Header.stories.tsx +0 -133
  113. package/src/components/Icon/Icon.stories.tsx +0 -80
  114. package/src/components/IconButton/IconButton.stories.tsx +0 -78
  115. package/src/components/Image/Image.stories.tsx +0 -109
  116. package/src/components/Input/Input.stories.tsx +0 -104
  117. package/src/components/Link/Link.stories.tsx +0 -67
  118. package/src/components/List/List.stories.tsx +0 -95
  119. package/src/components/Listbox/Listbox.stories.tsx +0 -81
  120. package/src/components/Loading/Loading.stories.tsx +0 -69
  121. package/src/components/Markdown/Markdown.stories.tsx +0 -75
  122. package/src/components/Menu/Menu.stories.tsx +0 -113
  123. package/src/components/Message/Message.stories.tsx +0 -85
  124. package/src/components/NavigationMenu/NavigationMenu.stories.tsx +0 -161
  125. package/src/components/Pagination/Pagination.stories.tsx +0 -81
  126. package/src/components/Popover/Popover.stories.tsx +0 -152
  127. package/src/components/Progress/Progress.stories.tsx +0 -64
  128. package/src/components/Prompt/Prompt.stories.tsx +0 -93
  129. package/src/components/RadioGroup/RadioGroup.stories.tsx +0 -107
  130. package/src/components/ScrollArea/ScrollArea.stories.tsx +0 -97
  131. package/src/components/Select/Select.stories.tsx +0 -127
  132. package/src/components/Separator/Separator.stories.tsx +0 -84
  133. package/src/components/Sidebar/Sidebar.stories.tsx +0 -122
  134. package/src/components/Skeleton/Skeleton.stories.tsx +0 -80
  135. package/src/components/Slider/Slider.stories.tsx +0 -73
  136. package/src/components/Stack/Stack.stories.tsx +0 -73
  137. package/src/components/Switch/Switch.stories.tsx +0 -59
  138. package/src/components/Table/Table.stories.tsx +0 -219
  139. package/src/components/TableOfContents/TableOfContents.stories.tsx +0 -120
  140. package/src/components/Tabs/Tabs.stories.tsx +0 -136
  141. package/src/components/Text/Text.stories.tsx +0 -133
  142. package/src/components/Textarea/Textarea.stories.tsx +0 -107
  143. package/src/components/Theme/Theme.stories.tsx +0 -95
  144. package/src/components/ThinkingIndicator/ThinkingIndicator.stories.tsx +0 -85
  145. package/src/components/Toast/Toast.stories.tsx +0 -91
  146. package/src/components/ToggleGroup/ToggleGroup.stories.tsx +0 -114
  147. package/src/components/Tooltip/Tooltip.stories.tsx +0 -95
  148. package/src/components/VisuallyHidden/VisuallyHidden.stories.tsx +0 -78
@@ -1,349 +0,0 @@
1
- import { CheckCircle, GithubLogo, Palette, Warning, XCircle } from "@phosphor-icons/react";
2
- import { Badge } from "../Badge";
3
- import { Box } from "../Box";
4
- import { Button } from "../Button";
5
- import { Stack } from "../Stack";
6
- import { Text } from "../Text";
7
- import {
8
- githubChecks,
9
- githubComments,
10
- impactAreas,
11
- prIdPagePullRequest as pr,
12
- type GithubCheck,
13
- type GithubComment,
14
- } from "./PullRequestsPrototypes.id-data";
15
- import styles from "./DashboardLayoutPrototypes.module.scss";
16
-
17
- export function PullRequestIdPage() {
18
- return (
19
- <Stack gap="md">
20
- <PullRequestHeader />
21
- <PullRequestTabs />
22
- <Box className={styles.prIdGithubLayout}>
23
- <ConversationTimeline />
24
- <PullRequestSidebar />
25
- </Box>
26
- </Stack>
27
- );
28
- }
29
-
30
- function PullRequestHeader() {
31
- const delta = pr.coverageAfter - pr.coverageBefore;
32
-
33
- return (
34
- <Stack gap="sm" className={styles.prIdHeader}>
35
- <Stack direction="row" justify="between" align="start" gap="md" wrap>
36
- <Stack gap="xs" className={styles.minWidthZero}>
37
- <Stack direction="row" gap="sm" align="center" wrap>
38
- <Badge variant="error" size="sm" icon={<XCircle size={13} weight="fill" />}>
39
- Blocked
40
- </Badge>
41
- <Text size="xs" color="tertiary">
42
- #{pr.number} opened by {pr.author} · {pr.branch}
43
- </Text>
44
- </Stack>
45
- <Text as="h2" size="xl" weight="semibold">
46
- {pr.title}
47
- </Text>
48
- </Stack>
49
- <Stack direction="row" gap="sm" align="center" wrap>
50
- <Button variant="primary" size="sm">
51
- <Palette size={14} />
52
- Mark design reviewed
53
- </Button>
54
- <Button
55
- as="a"
56
- href="https://github.com/fragments-sdk/fragments/pull/248"
57
- target="_blank"
58
- rel="noopener noreferrer"
59
- variant="outlined"
60
- size="sm"
61
- >
62
- <GithubLogo size={14} weight="fill" />
63
- GitHub
64
- </Button>
65
- </Stack>
66
- </Stack>
67
- <Text size="sm" color="secondary">
68
- Marketing contract coverage {pr.coverageBefore}% {"->"} {pr.coverageAfter}% ({delta}{" "}
69
- points). The build is green, but Fragments is blocking merge until the design-system
70
- comments are resolved.
71
- </Text>
72
- </Stack>
73
- );
74
- }
75
-
76
- function PullRequestTabs() {
77
- return (
78
- <Box className={styles.prIdTabs} role="navigation" aria-label="Pull request views">
79
- {[
80
- ["Conversation", String(pr.comments)],
81
- ["Checks", String(githubChecks.length)],
82
- ["Files changed", "6"],
83
- ["Fragments", "11"],
84
- ].map(([label, count], index) => (
85
- <span key={label} data-active={index === 0}>
86
- {label} <strong>{count}</strong>
87
- </span>
88
- ))}
89
- </Box>
90
- );
91
- }
92
-
93
- function ConversationTimeline() {
94
- return (
95
- <Stack gap="md" className={styles.prIdTimeline}>
96
- <TimelineComment author={pr.author} meta="opened this pull request">
97
- <Stack gap="sm">
98
- <Text size="sm">
99
- Refreshes the public launch cards for the June campaign. The branch changes hero CTA
100
- behavior, form danger states, and campaign-card spacing.
101
- </Text>
102
- <Box className={styles.prIdPrBodyTable}>
103
- <SummaryRow label="Area" value="Marketing / public launch" />
104
- <SummaryRow label="Designer" value="Growth design" />
105
- <SummaryRow label="Fragments gate" value="Blocked by contract" />
106
- </Box>
107
- </Stack>
108
- </TimelineComment>
109
-
110
- <TimelineComment author="fragments[bot]" meta="commented with a governance report" avatar="F">
111
- <Stack gap="md">
112
- <Stack gap="xs">
113
- <Text size="sm" weight="semibold">
114
- Fragments UI Governance Report
115
- </Text>
116
- <Text size="sm" color="secondary">
117
- This PR introduces new design-system drift in a public marketing flow.
118
- </Text>
119
- </Stack>
120
- <Box className={styles.prIdReportTable}>
121
- {impactAreas.map((area) => (
122
- <Box key={area.area} className={styles.prIdReportRow}>
123
- <Text size="sm" weight="medium">
124
- {area.area}
125
- </Text>
126
- <Text size="xs" color="tertiary">
127
- {area.criticality}
128
- </Text>
129
- <Text size="xs" color="secondary" tabularNums>
130
- {area.coverage}
131
- </Text>
132
- <Badge variant={area.variant} size="sm">
133
- {area.findings}
134
- </Badge>
135
- </Box>
136
- ))}
137
- </Box>
138
- <Text size="sm" color="secondary">
139
- Merge is blocked because Marketing allows no new primitive bypasses on public launch
140
- pages.
141
- </Text>
142
- </Stack>
143
- </TimelineComment>
144
-
145
- {githubComments.map((comment) => (
146
- <ReviewThread key={comment.id} comment={comment} />
147
- ))}
148
-
149
- <TimelineComment author="Noah Lee" meta="from Growth design" avatar="N" tone="designer">
150
- <Text size="sm" color="secondary">
151
- I can approve the visual direction after the Button replacement and semantic danger token
152
- land. The spacing issue can be an exception if this rhythm is intentional for the
153
- campaign.
154
- </Text>
155
- </TimelineComment>
156
- </Stack>
157
- );
158
- }
159
-
160
- function TimelineComment({
161
- author,
162
- meta,
163
- avatar,
164
- tone,
165
- children,
166
- }: {
167
- author: string;
168
- meta: string;
169
- avatar?: string;
170
- tone?: "designer";
171
- children: React.ReactNode;
172
- }) {
173
- return (
174
- <Box className={styles.prIdTimelineItem}>
175
- <span className={styles.prIdAvatar} data-tone={tone} aria-hidden>
176
- {avatar ?? initials(author)}
177
- </span>
178
- <Box className={styles.prIdCommentBox}>
179
- <Box className={styles.prIdCommentChrome}>
180
- <Text size="sm" weight="semibold">
181
- {author}
182
- </Text>
183
- <Text size="xs" color="tertiary">
184
- {meta}
185
- </Text>
186
- </Box>
187
- <Box className={styles.prIdCommentBody}>{children}</Box>
188
- </Box>
189
- </Box>
190
- );
191
- }
192
-
193
- function ReviewThread({ comment }: { comment: GithubComment }) {
194
- return (
195
- <Box className={styles.prIdTimelineItem}>
196
- <span className={styles.prIdAvatar} aria-hidden>
197
- F
198
- </span>
199
- <Box className={styles.prIdReviewThread}>
200
- <Box className={styles.prIdFileHeader}>
201
- <Text size="xs" color="secondary" font="mono" truncate>
202
- {comment.file}:{comment.line}
203
- </Text>
204
- <Badge variant={comment.variant} size="sm">
205
- {comment.status}
206
- </Badge>
207
- </Box>
208
- <Box className={styles.prIdCommentBox}>
209
- <Box className={styles.prIdCommentChrome}>
210
- <Text size="sm" weight="semibold">
211
- {comment.author}
212
- </Text>
213
- <Text size="xs" color="tertiary">
214
- left a review comment
215
- </Text>
216
- </Box>
217
- <Stack gap="sm" className={styles.prIdCommentBody}>
218
- <Text size="sm" color="secondary">
219
- {comment.body}
220
- </Text>
221
- <Text size="xs" color="tertiary">
222
- Designer signal: {comment.designerSignal}
223
- </Text>
224
- <Stack direction="row" gap="sm" wrap>
225
- <Button variant="outlined" size="xs">
226
- Create fix
227
- </Button>
228
- <Button variant="ghost" size="xs">
229
- Mark intentional
230
- </Button>
231
- </Stack>
232
- </Stack>
233
- </Box>
234
- </Box>
235
- </Box>
236
- );
237
- }
238
-
239
- function PullRequestSidebar() {
240
- return (
241
- <aside className={styles.prIdSidebar} aria-label="Pull request metadata">
242
- <SidebarSection title="Reviewers">
243
- <SidebarRow label="Growth design" value="Review needed" variant="warning" />
244
- <SidebarRow label="Frontend platform" value="Blocked" variant="error" />
245
- </SidebarSection>
246
- <SidebarSection title="Checks">
247
- <Stack gap="xs">
248
- {githubChecks.map((check) => (
249
- <CheckSummary key={check.name} check={check} />
250
- ))}
251
- </Stack>
252
- </SidebarSection>
253
- <SidebarSection title="Fragments">
254
- <SidebarRow label="Coverage" value={`${pr.coverageAfter}%`} />
255
- <SidebarRow label="Coverage delta" value="-7 points" variant="error" />
256
- <SidebarRow label="Safe fixes" value={String(pr.safeFixes)} />
257
- </SidebarSection>
258
- <SidebarSection title="Impacted areas">
259
- <Stack gap="xs">
260
- {impactAreas.map((area) => (
261
- <SidebarRow
262
- key={area.area}
263
- label={area.area}
264
- value={area.review}
265
- variant={area.variant}
266
- />
267
- ))}
268
- </Stack>
269
- </SidebarSection>
270
- </aside>
271
- );
272
- }
273
-
274
- function SidebarSection({ title, children }: { title: string; children: React.ReactNode }) {
275
- return (
276
- <section className={styles.prIdSidebarSection}>
277
- <Text as="h3" size="xs" weight="semibold" color="secondary">
278
- {title}
279
- </Text>
280
- {children}
281
- </section>
282
- );
283
- }
284
-
285
- function SidebarRow({
286
- label,
287
- value,
288
- variant,
289
- }: {
290
- label: string;
291
- value: string;
292
- variant?: GithubCheck["variant"];
293
- }) {
294
- return (
295
- <Box className={styles.prIdSidebarRow} data-variant={variant}>
296
- <Text size="xs" color="tertiary">
297
- {label}
298
- </Text>
299
- <Text size="xs" color="secondary">
300
- {value}
301
- </Text>
302
- </Box>
303
- );
304
- }
305
-
306
- function CheckSummary({ check }: { check: GithubCheck }) {
307
- const Icon =
308
- check.state === "passed" ? CheckCircle : check.state === "failed" ? XCircle : Warning;
309
-
310
- return (
311
- <Box className={styles.prIdCheckSummary}>
312
- <span className={styles.prIdCheckIcon} data-state={check.state} aria-hidden>
313
- <Icon size={14} weight="fill" />
314
- </span>
315
- <Stack gap="none" className={styles.minWidthZero}>
316
- <Text size="xs" weight="medium" truncate>
317
- {check.name}
318
- </Text>
319
- <Text size="xs" color="tertiary" truncate>
320
- {check.summary}
321
- </Text>
322
- </Stack>
323
- </Box>
324
- );
325
- }
326
-
327
- function SummaryRow({ label, value }: { label: string; value: string }) {
328
- return (
329
- <Box className={styles.prIdSummaryRow}>
330
- <Text size="xs" color="tertiary">
331
- {label}
332
- </Text>
333
- <Text size="xs" color="secondary">
334
- {value}
335
- </Text>
336
- </Box>
337
- );
338
- }
339
-
340
- function initials(value: string) {
341
- return value
342
- .split(/[\s@/_-]+/)
343
- .filter(Boolean)
344
- .slice(0, 2)
345
- .map((part) => part[0])
346
- .join("")
347
- .toUpperCase()
348
- .slice(0, 2);
349
- }
@@ -1,81 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/react";
2
- import { PrototypeShell } from "./DashboardLayoutPrototypes.shared";
3
- import { PrototypeActions, PullRequestInbox } from "./PullRequestsPrototypes.content";
4
- import { PullRequestDecisionActions, PullRequestDetail } from "./PullRequestsPrototypes.detail";
5
- import { PullRequestIdPage } from "./PullRequestsPrototypes.id-page";
6
-
7
- const meta = {
8
- title: "Cloud/Prototypes/Pull Requests",
9
- parameters: {
10
- layout: "fullscreen",
11
- backgrounds: { default: "dark" },
12
- docs: {
13
- description: {
14
- component: "Cloud pull-request review prototypes for table-first topology governance.",
15
- },
16
- },
17
- },
18
- } satisfies Meta;
19
-
20
- export default meta;
21
-
22
- type Story = StoryObj<typeof meta>;
23
-
24
- export const Layout1TableInbox: Story = {
25
- name: "Layout 1 · Table inbox",
26
- render: () => (
27
- <PrototypeShell
28
- activeNav="Pull Requests"
29
- title="Pull Requests"
30
- description="Filter every open PR by area, gate state, comments, and drift before reviewing the details."
31
- actions={<PrototypeActions />}
32
- >
33
- <PullRequestInbox />
34
- </PrototypeShell>
35
- ),
36
- };
37
-
38
- export const Layout2RoomierTable: Story = {
39
- name: "Layout 2 · Roomier table",
40
- render: () => (
41
- <PrototypeShell
42
- activeNav="Pull Requests"
43
- eyebrow="Alternative"
44
- title="Pull Requests"
45
- description="A roomier review queue for teams that want the same filters with less table density."
46
- actions={<PrototypeActions />}
47
- >
48
- <PullRequestInbox density="regular" />
49
- </PrototypeShell>
50
- ),
51
- };
52
-
53
- export const Layout3PullRequestDetail: Story = {
54
- name: "Layout 3 · Pull request detail",
55
- render: () => (
56
- <PrototypeShell
57
- activeNav="Pull Requests"
58
- eyebrow="Pull request #248 · feat/launch-pages"
59
- title="Refresh marketing campaign cards"
60
- description="Review every Fragments finding, the merge gate, and design impact before you merge."
61
- actions={<PullRequestDecisionActions />}
62
- >
63
- <PullRequestDetail />
64
- </PrototypeShell>
65
- ),
66
- };
67
-
68
- export const Layout4PullRequestIdPage: Story = {
69
- name: "Layout 4 · Pull request id page",
70
- render: () => (
71
- <PrototypeShell
72
- activeNav="Pull Requests"
73
- eyebrow="PR #248"
74
- title="Pull Request"
75
- description="Review GitHub checks, Fragments comments, and design impact before the merge decision."
76
- actions={<PrototypeActions />}
77
- >
78
- <PullRequestIdPage />
79
- </PrototypeShell>
80
- ),
81
- };
@@ -1,147 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import { CodeBlock } from '.';
3
-
4
- /**
5
- * Syntax-highlighted code display with copy, theming, diff view, line
6
- * numbers, and collapsible sections. The required `code` prop holds the
7
- * content; `language` and `theme` control highlighting.
8
- */
9
- const meta = {
10
- title: 'Display/CodeBlock',
11
- component: CodeBlock,
12
- tags: ['autodocs'],
13
- parameters: {
14
- docs: {
15
- description: {
16
- component: 'Syntax-highlighted code display with copy functionality.',
17
- },
18
- },
19
- },
20
- argTypes: {
21
- language: {
22
- control: 'select',
23
- options: [
24
- 'tsx',
25
- 'typescript',
26
- 'ts',
27
- 'javascript',
28
- 'js',
29
- 'jsx',
30
- 'bash',
31
- 'shell',
32
- 'css',
33
- 'scss',
34
- 'sass',
35
- 'json',
36
- 'html',
37
- 'xml',
38
- 'markdown',
39
- 'md',
40
- 'yaml',
41
- 'yml',
42
- 'python',
43
- 'py',
44
- 'ruby',
45
- 'go',
46
- 'rust',
47
- 'java',
48
- 'kotlin',
49
- 'swift',
50
- 'c',
51
- 'cpp',
52
- 'csharp',
53
- 'php',
54
- 'sql',
55
- 'graphql',
56
- 'diff',
57
- 'plaintext',
58
- 'text',
59
- ],
60
- description: 'Programming language for syntax highlighting',
61
- },
62
- theme: {
63
- control: 'select',
64
- options: [
65
- 'synthwave-84',
66
- 'github-dark',
67
- 'github-light',
68
- 'one-dark-pro',
69
- 'dracula',
70
- 'nord',
71
- 'monokai',
72
- 'vitesse-dark',
73
- 'vitesse-light',
74
- 'min-dark',
75
- 'min-light',
76
- ],
77
- description: 'Syntax highlighting theme',
78
- },
79
- copyPlacement: {
80
- control: 'select',
81
- options: ['auto', 'header', 'overlay'],
82
- description: 'Where to place the copy button',
83
- },
84
- showCopy: { control: 'boolean' },
85
- showLineNumbers: { control: 'boolean' },
86
- wordWrap: { control: 'boolean' },
87
- collapsible: { control: 'boolean' },
88
- defaultCollapsed: { control: 'boolean' },
89
- compact: { control: 'boolean' },
90
- persistentCopy: { control: 'boolean' },
91
- },
92
- args: {
93
- code: "import { Button } from '@usefragments/ui';\n\nfunction App() {\n return <Button>Click me</Button>;\n}",
94
- language: 'tsx',
95
- theme: 'one-dark-pro',
96
- },
97
- } satisfies Meta<typeof CodeBlock>;
98
-
99
- export default meta;
100
-
101
- type Story = StoryObj<typeof meta>;
102
-
103
- export const Default: Story = {};
104
-
105
- export const WithFilename: Story = {
106
- args: {
107
- filename: 'app.tsx',
108
- code: "import { Button, Card } from '@usefragments/ui';\n\nfunction App() {\n return <Button>Get Started</Button>;\n}",
109
- },
110
- };
111
-
112
- export const WithLineNumbers: Story = {
113
- args: {
114
- showLineNumbers: true,
115
- language: 'typescript',
116
- code: 'const greeting = "Hello";\nconst name = "World";\nconsole.log(`${greeting}, ${name}!`);',
117
- },
118
- };
119
-
120
- export const DiffView: Story = {
121
- args: {
122
- language: 'tsx',
123
- showLineNumbers: true,
124
- removedLines: [2],
125
- addedLines: [3],
126
- code: 'function Counter() {\n const inc = () => setCount(c => c + 1);\n const inc = useCallback(() => setCount(c => c + 1), []);\n return <button onClick={inc}>Count</button>;\n}',
127
- },
128
- };
129
-
130
- export const Bash: Story = {
131
- args: {
132
- language: 'bash',
133
- title: 'Installation',
134
- code: 'npm install @usefragments/ui',
135
- },
136
- };
137
-
138
- export const Collapsible: Story = {
139
- args: {
140
- language: 'tsx',
141
- showLineNumbers: true,
142
- collapsible: true,
143
- defaultCollapsed: true,
144
- collapsedLines: 4,
145
- code: 'export function UserProfile({ userId }: { userId: string }) {\n const [user, setUser] = useState(null);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState(null);\n if (loading) return <div>Loading...</div>;\n if (error) return <div>Error</div>;\n return <h1>{user.name}</h1>;\n}',
146
- },
147
- };
@@ -1,94 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import { Collapsible } from '.';
3
-
4
- /**
5
- * Disclosure component that expands and collapses to show or hide content.
6
- * Compose Collapsible.Trigger and Collapsible.Content as children. Supports
7
- * controlled `open`, uncontrolled `defaultOpen`, and a disabled state.
8
- */
9
- const meta = {
10
- title: 'Layout/Collapsible',
11
- component: Collapsible,
12
- tags: ['autodocs'],
13
- parameters: {
14
- docs: {
15
- description: {
16
- component: 'Expands and collapses to show or hide content.',
17
- },
18
- },
19
- },
20
- argTypes: {
21
- defaultOpen: { control: 'boolean', description: 'Initial open state' },
22
- disabled: { control: 'boolean' },
23
- },
24
- args: {
25
- defaultOpen: false,
26
- disabled: false,
27
- children: (
28
- <>
29
- <Collapsible.Trigger>Click to expand</Collapsible.Trigger>
30
- <Collapsible.Content>
31
- <p>This content is hidden by default and revealed on click.</p>
32
- </Collapsible.Content>
33
- </>
34
- ),
35
- },
36
- } satisfies Meta<typeof Collapsible>;
37
-
38
- export default meta;
39
-
40
- type Story = StoryObj<typeof meta>;
41
-
42
- export const Default: Story = {
43
- render: (args) => (
44
- <Collapsible {...args}>
45
- <Collapsible.Trigger>Click to expand</Collapsible.Trigger>
46
- <Collapsible.Content>
47
- <p>This content is hidden by default and revealed on click.</p>
48
- </Collapsible.Content>
49
- </Collapsible>
50
- ),
51
- };
52
-
53
- export const DefaultOpen: Story = {
54
- args: { defaultOpen: true },
55
- render: (args) => (
56
- <Collapsible {...args}>
57
- <Collapsible.Trigger>Section Title</Collapsible.Trigger>
58
- <Collapsible.Content>
59
- <p>This content is visible by default. Click to collapse.</p>
60
- </Collapsible.Content>
61
- </Collapsible>
62
- ),
63
- };
64
-
65
- export const Disabled: Story = {
66
- args: { disabled: true },
67
- render: (args) => (
68
- <Collapsible {...args}>
69
- <Collapsible.Trigger>Cannot toggle (disabled)</Collapsible.Trigger>
70
- <Collapsible.Content>
71
- <p>This content cannot be shown because the collapsible is disabled.</p>
72
- </Collapsible.Content>
73
- </Collapsible>
74
- ),
75
- };
76
-
77
- export const MultipleSections: Story = {
78
- render: () => (
79
- <div style={{ display: 'flex', flexDirection: 'column', gap: '4px' }}>
80
- <Collapsible defaultOpen>
81
- <Collapsible.Trigger>Getting Started</Collapsible.Trigger>
82
- <Collapsible.Content>
83
- <p>Introduction and setup instructions.</p>
84
- </Collapsible.Content>
85
- </Collapsible>
86
- <Collapsible>
87
- <Collapsible.Trigger>Advanced Usage</Collapsible.Trigger>
88
- <Collapsible.Content>
89
- <p>Advanced configuration options.</p>
90
- </Collapsible.Content>
91
- </Collapsible>
92
- </div>
93
- ),
94
- };