create-auto-app 1.34.0 → 1.36.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 (156) hide show
  1. package/package.json +2 -2
  2. package/templates/typical/.gitignore +1 -1
  3. package/templates/typical/auto.config.ts +85 -80
  4. package/templates/typical/client/.gitignore +0 -4
  5. package/templates/typical/client/.storybook/main.ts +0 -66
  6. package/templates/typical/client/.storybook/manager-head.html +0 -154
  7. package/templates/typical/client/.storybook/manager.ts +0 -164
  8. package/templates/typical/client/.storybook/preview-head.html +0 -31
  9. package/templates/typical/client/.storybook/preview.tsx +0 -120
  10. package/templates/typical/client/codegen.ts +0 -17
  11. package/templates/typical/client/components.json +0 -29
  12. package/templates/typical/client/index.html +0 -12
  13. package/templates/typical/client/package.json +0 -69
  14. package/templates/typical/client/pnpm-lock.yaml +0 -7868
  15. package/templates/typical/client/public/blank.svg +0 -1
  16. package/templates/typical/client/public/mockServiceWorker.js +0 -336
  17. package/templates/typical/client/src/App.tsx +0 -29
  18. package/templates/typical/client/src/components/.gitkeep +0 -0
  19. package/templates/typical/client/src/components/ui/Accordion.stories.tsx +0 -49
  20. package/templates/typical/client/src/components/ui/Accordion.tsx +0 -55
  21. package/templates/typical/client/src/components/ui/Alert.stories.tsx +0 -29
  22. package/templates/typical/client/src/components/ui/Alert.tsx +0 -56
  23. package/templates/typical/client/src/components/ui/AlertDialog.stories.tsx +0 -67
  24. package/templates/typical/client/src/components/ui/AlertDialog.tsx +0 -178
  25. package/templates/typical/client/src/components/ui/AspectRatio.stories.tsx +0 -35
  26. package/templates/typical/client/src/components/ui/AspectRatio.tsx +0 -13
  27. package/templates/typical/client/src/components/ui/Avatar.stories.tsx +0 -45
  28. package/templates/typical/client/src/components/ui/Avatar.tsx +0 -98
  29. package/templates/typical/client/src/components/ui/Badge.stories.tsx +0 -41
  30. package/templates/typical/client/src/components/ui/Badge.tsx +0 -45
  31. package/templates/typical/client/src/components/ui/Breadcrumb.stories.tsx +0 -54
  32. package/templates/typical/client/src/components/ui/Breadcrumb.tsx +0 -104
  33. package/templates/typical/client/src/components/ui/Button.stories.tsx +0 -102
  34. package/templates/typical/client/src/components/ui/Button.tsx +0 -67
  35. package/templates/typical/client/src/components/ui/ButtonGroup.stories.tsx +0 -32
  36. package/templates/typical/client/src/components/ui/ButtonGroup.tsx +0 -81
  37. package/templates/typical/client/src/components/ui/Calendar.stories.tsx +0 -40
  38. package/templates/typical/client/src/components/ui/Calendar.tsx +0 -165
  39. package/templates/typical/client/src/components/ui/Card.stories.tsx +0 -44
  40. package/templates/typical/client/src/components/ui/Card.tsx +0 -66
  41. package/templates/typical/client/src/components/ui/Carousel.stories.tsx +0 -56
  42. package/templates/typical/client/src/components/ui/Carousel.tsx +0 -225
  43. package/templates/typical/client/src/components/ui/Chart.stories.tsx +0 -39
  44. package/templates/typical/client/src/components/ui/Chart.tsx +0 -305
  45. package/templates/typical/client/src/components/ui/Checkbox.stories.tsx +0 -35
  46. package/templates/typical/client/src/components/ui/Checkbox.tsx +0 -30
  47. package/templates/typical/client/src/components/ui/Collapsible.stories.tsx +0 -58
  48. package/templates/typical/client/src/components/ui/Collapsible.tsx +0 -18
  49. package/templates/typical/client/src/components/ui/Combobox.stories.tsx +0 -75
  50. package/templates/typical/client/src/components/ui/Combobox.tsx +0 -296
  51. package/templates/typical/client/src/components/ui/Command.stories.tsx +0 -71
  52. package/templates/typical/client/src/components/ui/Command.tsx +0 -157
  53. package/templates/typical/client/src/components/ui/ContextMenu.stories.tsx +0 -68
  54. package/templates/typical/client/src/components/ui/ContextMenu.tsx +0 -231
  55. package/templates/typical/client/src/components/ui/DesignSystem-Colors.mdx +0 -68
  56. package/templates/typical/client/src/components/ui/DesignSystem-Colors.stories.tsx +0 -117
  57. package/templates/typical/client/src/components/ui/DesignSystem-Layout.mdx +0 -64
  58. package/templates/typical/client/src/components/ui/DesignSystem-Layout.stories.tsx +0 -167
  59. package/templates/typical/client/src/components/ui/DesignSystem-Overview.stories.tsx +0 -748
  60. package/templates/typical/client/src/components/ui/DesignSystem-Typography.mdx +0 -31
  61. package/templates/typical/client/src/components/ui/DesignSystem-Typography.stories.tsx +0 -80
  62. package/templates/typical/client/src/components/ui/Dialog.stories.tsx +0 -74
  63. package/templates/typical/client/src/components/ui/Dialog.tsx +0 -154
  64. package/templates/typical/client/src/components/ui/Direction.stories.tsx +0 -38
  65. package/templates/typical/client/src/components/ui/Direction.tsx +0 -24
  66. package/templates/typical/client/src/components/ui/Drawer.stories.tsx +0 -70
  67. package/templates/typical/client/src/components/ui/Drawer.tsx +0 -124
  68. package/templates/typical/client/src/components/ui/DropdownMenu.stories.tsx +0 -74
  69. package/templates/typical/client/src/components/ui/DropdownMenu.tsx +0 -239
  70. package/templates/typical/client/src/components/ui/Empty.stories.tsx +0 -37
  71. package/templates/typical/client/src/components/ui/Empty.tsx +0 -98
  72. package/templates/typical/client/src/components/ui/Field.stories.tsx +0 -50
  73. package/templates/typical/client/src/components/ui/Field.tsx +0 -251
  74. package/templates/typical/client/src/components/ui/Form.stories.tsx +0 -45
  75. package/templates/typical/client/src/components/ui/Form.tsx +0 -148
  76. package/templates/typical/client/src/components/ui/HoverCard.stories.tsx +0 -49
  77. package/templates/typical/client/src/components/ui/HoverCard.tsx +0 -39
  78. package/templates/typical/client/src/components/ui/Input.stories.tsx +0 -42
  79. package/templates/typical/client/src/components/ui/Input.tsx +0 -22
  80. package/templates/typical/client/src/components/ui/InputGroup.stories.tsx +0 -53
  81. package/templates/typical/client/src/components/ui/InputGroup.tsx +0 -153
  82. package/templates/typical/client/src/components/ui/InputOTP.stories.tsx +0 -42
  83. package/templates/typical/client/src/components/ui/InputOTP.tsx +0 -72
  84. package/templates/typical/client/src/components/ui/Item.stories.tsx +0 -64
  85. package/templates/typical/client/src/components/ui/Item.tsx +0 -168
  86. package/templates/typical/client/src/components/ui/Kbd.stories.tsx +0 -59
  87. package/templates/typical/client/src/components/ui/Kbd.tsx +0 -22
  88. package/templates/typical/client/src/components/ui/Label.stories.tsx +0 -90
  89. package/templates/typical/client/src/components/ui/Label.tsx +0 -44
  90. package/templates/typical/client/src/components/ui/Menubar.stories.tsx +0 -78
  91. package/templates/typical/client/src/components/ui/Menubar.tsx +0 -251
  92. package/templates/typical/client/src/components/ui/NativeSelect.stories.tsx +0 -45
  93. package/templates/typical/client/src/components/ui/NativeSelect.tsx +0 -50
  94. package/templates/typical/client/src/components/ui/NavigationMenu.stories.tsx +0 -80
  95. package/templates/typical/client/src/components/ui/NavigationMenu.tsx +0 -152
  96. package/templates/typical/client/src/components/ui/Pagination.stories.tsx +0 -77
  97. package/templates/typical/client/src/components/ui/Pagination.tsx +0 -108
  98. package/templates/typical/client/src/components/ui/Popover.stories.tsx +0 -53
  99. package/templates/typical/client/src/components/ui/Popover.tsx +0 -57
  100. package/templates/typical/client/src/components/ui/Progress.stories.tsx +0 -32
  101. package/templates/typical/client/src/components/ui/Progress.tsx +0 -25
  102. package/templates/typical/client/src/components/ui/RadioGroup.stories.tsx +0 -50
  103. package/templates/typical/client/src/components/ui/RadioGroup.tsx +0 -36
  104. package/templates/typical/client/src/components/ui/Resizable.stories.tsx +0 -72
  105. package/templates/typical/client/src/components/ui/Resizable.tsx +0 -54
  106. package/templates/typical/client/src/components/ui/ScrollArea.stories.tsx +0 -45
  107. package/templates/typical/client/src/components/ui/ScrollArea.tsx +0 -51
  108. package/templates/typical/client/src/components/ui/Select.stories.tsx +0 -59
  109. package/templates/typical/client/src/components/ui/Select.tsx +0 -171
  110. package/templates/typical/client/src/components/ui/Separator.stories.tsx +0 -42
  111. package/templates/typical/client/src/components/ui/Separator.tsx +0 -27
  112. package/templates/typical/client/src/components/ui/Sheet.stories.tsx +0 -68
  113. package/templates/typical/client/src/components/ui/Sheet.tsx +0 -115
  114. package/templates/typical/client/src/components/ui/Sidebar.stories.tsx +0 -96
  115. package/templates/typical/client/src/components/ui/Sidebar.tsx +0 -695
  116. package/templates/typical/client/src/components/ui/Skeleton.stories.tsx +0 -40
  117. package/templates/typical/client/src/components/ui/Skeleton.tsx +0 -11
  118. package/templates/typical/client/src/components/ui/Slider.stories.tsx +0 -24
  119. package/templates/typical/client/src/components/ui/Slider.tsx +0 -55
  120. package/templates/typical/client/src/components/ui/Sonner.stories.tsx +0 -45
  121. package/templates/typical/client/src/components/ui/Sonner.tsx +0 -38
  122. package/templates/typical/client/src/components/ui/Spinner.stories.tsx +0 -26
  123. package/templates/typical/client/src/components/ui/Spinner.tsx +0 -13
  124. package/templates/typical/client/src/components/ui/Switch.stories.tsx +0 -39
  125. package/templates/typical/client/src/components/ui/Switch.tsx +0 -35
  126. package/templates/typical/client/src/components/ui/Table.stories.tsx +0 -67
  127. package/templates/typical/client/src/components/ui/Table.tsx +0 -86
  128. package/templates/typical/client/src/components/ui/Tabs.stories.tsx +0 -53
  129. package/templates/typical/client/src/components/ui/Tabs.tsx +0 -75
  130. package/templates/typical/client/src/components/ui/Textarea.stories.tsx +0 -27
  131. package/templates/typical/client/src/components/ui/Textarea.tsx +0 -22
  132. package/templates/typical/client/src/components/ui/Toast.stories.tsx +0 -116
  133. package/templates/typical/client/src/components/ui/Toast.tsx +0 -123
  134. package/templates/typical/client/src/components/ui/Toaster.tsx +0 -32
  135. package/templates/typical/client/src/components/ui/Toggle.stories.tsx +0 -44
  136. package/templates/typical/client/src/components/ui/Toggle.tsx +0 -42
  137. package/templates/typical/client/src/components/ui/ToggleGroup.stories.tsx +0 -61
  138. package/templates/typical/client/src/components/ui/ToggleGroup.tsx +0 -83
  139. package/templates/typical/client/src/components/ui/Tooltip.stories.tsx +0 -42
  140. package/templates/typical/client/src/components/ui/Tooltip.tsx +0 -48
  141. package/templates/typical/client/src/gql/execute.ts +0 -11
  142. package/templates/typical/client/src/gql/fragment-masking.ts +0 -83
  143. package/templates/typical/client/src/gql/gql.ts +0 -9
  144. package/templates/typical/client/src/gql/graphql.ts +0 -182
  145. package/templates/typical/client/src/gql/index.ts +0 -2
  146. package/templates/typical/client/src/graphql/mutations.ts +0 -0
  147. package/templates/typical/client/src/graphql/queries.ts +0 -0
  148. package/templates/typical/client/src/hooks/.gitkeep +0 -0
  149. package/templates/typical/client/src/hooks/use-mobile.ts +0 -19
  150. package/templates/typical/client/src/hooks/use-toast.ts +0 -186
  151. package/templates/typical/client/src/index.css +0 -121
  152. package/templates/typical/client/src/lib/utils.ts +0 -6
  153. package/templates/typical/client/src/main.tsx +0 -5
  154. package/templates/typical/client/tsconfig.app.json +0 -26
  155. package/templates/typical/client/tsconfig.json +0 -10
  156. package/templates/typical/client/vite.config.ts +0 -50
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="1" height="1"></svg>
@@ -1,336 +0,0 @@
1
- /* eslint-disable */
2
- /* tslint:disable */
3
-
4
- /**
5
- * Mock Service Worker.
6
- * @see https://github.com/mswjs/msw
7
- * - Please do NOT modify this file.
8
- */
9
-
10
- const PACKAGE_VERSION = '2.12.10';
11
- const INTEGRITY_CHECKSUM = '4db4a41e972cec1b64cc569c66952d82';
12
- const IS_MOCKED_RESPONSE = Symbol('isMockedResponse');
13
- const activeClientIds = new Set();
14
-
15
- addEventListener('install', function () {
16
- self.skipWaiting();
17
- });
18
-
19
- addEventListener('activate', function (event) {
20
- event.waitUntil(self.clients.claim());
21
- });
22
-
23
- addEventListener('message', async function (event) {
24
- const clientId = Reflect.get(event.source || {}, 'id');
25
-
26
- if (!clientId || !self.clients) {
27
- return;
28
- }
29
-
30
- const client = await self.clients.get(clientId);
31
-
32
- if (!client) {
33
- return;
34
- }
35
-
36
- const allClients = await self.clients.matchAll({
37
- type: 'window',
38
- });
39
-
40
- switch (event.data) {
41
- case 'KEEPALIVE_REQUEST': {
42
- sendToClient(client, {
43
- type: 'KEEPALIVE_RESPONSE',
44
- });
45
- break;
46
- }
47
-
48
- case 'INTEGRITY_CHECK_REQUEST': {
49
- sendToClient(client, {
50
- type: 'INTEGRITY_CHECK_RESPONSE',
51
- payload: {
52
- packageVersion: PACKAGE_VERSION,
53
- checksum: INTEGRITY_CHECKSUM,
54
- },
55
- });
56
- break;
57
- }
58
-
59
- case 'MOCK_ACTIVATE': {
60
- activeClientIds.add(clientId);
61
-
62
- sendToClient(client, {
63
- type: 'MOCKING_ENABLED',
64
- payload: {
65
- client: {
66
- id: client.id,
67
- frameType: client.frameType,
68
- },
69
- },
70
- });
71
- break;
72
- }
73
-
74
- case 'CLIENT_CLOSED': {
75
- activeClientIds.delete(clientId);
76
-
77
- const remainingClients = allClients.filter((client) => {
78
- return client.id !== clientId;
79
- });
80
-
81
- // Unregister itself when there are no more clients
82
- if (remainingClients.length === 0) {
83
- self.registration.unregister();
84
- }
85
-
86
- break;
87
- }
88
- }
89
- });
90
-
91
- addEventListener('fetch', function (event) {
92
- const requestInterceptedAt = Date.now();
93
-
94
- // Bypass navigation requests.
95
- if (event.request.mode === 'navigate') {
96
- return;
97
- }
98
-
99
- // Opening the DevTools triggers the "only-if-cached" request
100
- // that cannot be handled by the worker. Bypass such requests.
101
- if (event.request.cache === 'only-if-cached' && event.request.mode !== 'same-origin') {
102
- return;
103
- }
104
-
105
- // Bypass all requests when there are no active clients.
106
- // Prevents the self-unregistered worked from handling requests
107
- // after it's been terminated (still remains active until the next reload).
108
- if (activeClientIds.size === 0) {
109
- return;
110
- }
111
-
112
- const requestId = crypto.randomUUID();
113
- event.respondWith(handleRequest(event, requestId, requestInterceptedAt));
114
- });
115
-
116
- /**
117
- * @param {FetchEvent} event
118
- * @param {string} requestId
119
- * @param {number} requestInterceptedAt
120
- */
121
- async function handleRequest(event, requestId, requestInterceptedAt) {
122
- const client = await resolveMainClient(event);
123
- const requestCloneForEvents = event.request.clone();
124
- const response = await getResponse(event, client, requestId, requestInterceptedAt);
125
-
126
- // Send back the response clone for the "response:*" life-cycle events.
127
- // Ensure MSW is active and ready to handle the message, otherwise
128
- // this message will pend indefinitely.
129
- if (client && activeClientIds.has(client.id)) {
130
- const serializedRequest = await serializeRequest(requestCloneForEvents);
131
-
132
- // Clone the response so both the client and the library could consume it.
133
- const responseClone = response.clone();
134
-
135
- sendToClient(
136
- client,
137
- {
138
- type: 'RESPONSE',
139
- payload: {
140
- isMockedResponse: IS_MOCKED_RESPONSE in response,
141
- request: {
142
- id: requestId,
143
- ...serializedRequest,
144
- },
145
- response: {
146
- type: responseClone.type,
147
- status: responseClone.status,
148
- statusText: responseClone.statusText,
149
- headers: Object.fromEntries(responseClone.headers.entries()),
150
- body: responseClone.body,
151
- },
152
- },
153
- },
154
- responseClone.body ? [serializedRequest.body, responseClone.body] : [],
155
- );
156
- }
157
-
158
- return response;
159
- }
160
-
161
- /**
162
- * Resolve the main client for the given event.
163
- * Client that issues a request doesn't necessarily equal the client
164
- * that registered the worker. It's with the latter the worker should
165
- * communicate with during the response resolving phase.
166
- * @param {FetchEvent} event
167
- * @returns {Promise<Client | undefined>}
168
- */
169
- async function resolveMainClient(event) {
170
- const client = await self.clients.get(event.clientId);
171
-
172
- if (activeClientIds.has(event.clientId)) {
173
- return client;
174
- }
175
-
176
- if (client?.frameType === 'top-level') {
177
- return client;
178
- }
179
-
180
- const allClients = await self.clients.matchAll({
181
- type: 'window',
182
- });
183
-
184
- return allClients
185
- .filter((client) => {
186
- // Get only those clients that are currently visible.
187
- return client.visibilityState === 'visible';
188
- })
189
- .find((client) => {
190
- // Find the client ID that's recorded in the
191
- // set of clients that have registered the worker.
192
- return activeClientIds.has(client.id);
193
- });
194
- }
195
-
196
- /**
197
- * @param {FetchEvent} event
198
- * @param {Client | undefined} client
199
- * @param {string} requestId
200
- * @param {number} requestInterceptedAt
201
- * @returns {Promise<Response>}
202
- */
203
- async function getResponse(event, client, requestId, requestInterceptedAt) {
204
- // Clone the request because it might've been already used
205
- // (i.e. its body has been read and sent to the client).
206
- const requestClone = event.request.clone();
207
-
208
- function passthrough() {
209
- // Cast the request headers to a new Headers instance
210
- // so the headers can be manipulated with.
211
- const headers = new Headers(requestClone.headers);
212
-
213
- // Remove the "accept" header value that marked this request as passthrough.
214
- // This prevents request alteration and also keeps it compliant with the
215
- // user-defined CORS policies.
216
- const acceptHeader = headers.get('accept');
217
- if (acceptHeader) {
218
- const values = acceptHeader.split(',').map((value) => value.trim());
219
- const filteredValues = values.filter((value) => value !== 'msw/passthrough');
220
-
221
- if (filteredValues.length > 0) {
222
- headers.set('accept', filteredValues.join(', '));
223
- } else {
224
- headers.delete('accept');
225
- }
226
- }
227
-
228
- return fetch(requestClone, { headers });
229
- }
230
-
231
- // Bypass mocking when the client is not active.
232
- if (!client) {
233
- return passthrough();
234
- }
235
-
236
- // Bypass initial page load requests (i.e. static assets).
237
- // The absence of the immediate/parent client in the map of the active clients
238
- // means that MSW hasn't dispatched the "MOCK_ACTIVATE" event yet
239
- // and is not ready to handle requests.
240
- if (!activeClientIds.has(client.id)) {
241
- return passthrough();
242
- }
243
-
244
- // Notify the client that a request has been intercepted.
245
- const serializedRequest = await serializeRequest(event.request);
246
- const clientMessage = await sendToClient(
247
- client,
248
- {
249
- type: 'REQUEST',
250
- payload: {
251
- id: requestId,
252
- interceptedAt: requestInterceptedAt,
253
- ...serializedRequest,
254
- },
255
- },
256
- [serializedRequest.body],
257
- );
258
-
259
- switch (clientMessage.type) {
260
- case 'MOCK_RESPONSE': {
261
- return respondWithMock(clientMessage.data);
262
- }
263
-
264
- case 'PASSTHROUGH': {
265
- return passthrough();
266
- }
267
- }
268
-
269
- return passthrough();
270
- }
271
-
272
- /**
273
- * @param {Client} client
274
- * @param {any} message
275
- * @param {Array<Transferable>} transferrables
276
- * @returns {Promise<any>}
277
- */
278
- function sendToClient(client, message, transferrables = []) {
279
- return new Promise((resolve, reject) => {
280
- const channel = new MessageChannel();
281
-
282
- channel.port1.onmessage = (event) => {
283
- if (event.data && event.data.error) {
284
- return reject(event.data.error);
285
- }
286
-
287
- resolve(event.data);
288
- };
289
-
290
- client.postMessage(message, [channel.port2, ...transferrables.filter(Boolean)]);
291
- });
292
- }
293
-
294
- /**
295
- * @param {Response} response
296
- * @returns {Response}
297
- */
298
- function respondWithMock(response) {
299
- // Setting response status code to 0 is a no-op.
300
- // However, when responding with a "Response.error()", the produced Response
301
- // instance will have status code set to 0. Since it's not possible to create
302
- // a Response instance with status code 0, handle that use-case separately.
303
- if (response.status === 0) {
304
- return Response.error();
305
- }
306
-
307
- const mockedResponse = new Response(response.body, response);
308
-
309
- Reflect.defineProperty(mockedResponse, IS_MOCKED_RESPONSE, {
310
- value: true,
311
- enumerable: true,
312
- });
313
-
314
- return mockedResponse;
315
- }
316
-
317
- /**
318
- * @param {Request} request
319
- */
320
- async function serializeRequest(request) {
321
- return {
322
- url: request.url,
323
- mode: request.mode,
324
- method: request.method,
325
- headers: Object.fromEntries(request.headers.entries()),
326
- cache: request.cache,
327
- credentials: request.credentials,
328
- destination: request.destination,
329
- integrity: request.integrity,
330
- redirect: request.redirect,
331
- referrer: request.referrer,
332
- referrerPolicy: request.referrerPolicy,
333
- body: await request.arrayBuffer(),
334
- keepalive: request.keepalive,
335
- };
336
- }
@@ -1,29 +0,0 @@
1
- import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
2
- import { BrowserRouter, Route, Routes } from 'react-router-dom';
3
- import { Card, CardContent } from '@/components/ui/Card';
4
- import { Separator } from '@/components/ui/Separator';
5
-
6
- const queryClient = new QueryClient();
7
-
8
- const LandingPage = () => (
9
- <div className="min-h-screen flex items-center justify-center bg-gradient-to-br from-background to-muted/50">
10
- <Card className="border-0 shadow-none bg-transparent">
11
- <CardContent className="flex flex-col items-center gap-6">
12
- <h1 className="text-5xl md:text-7xl font-extralight tracking-tight text-foreground">
13
- Your ideas await
14
- </h1>
15
- <Separator className="w-16 bg-muted-foreground/30" />
16
- </CardContent>
17
- </Card>
18
- </div>
19
- );
20
-
21
- export const App = () => (
22
- <QueryClientProvider client={queryClient}>
23
- <BrowserRouter>
24
- <Routes>
25
- <Route path="/" element={<LandingPage />} />
26
- </Routes>
27
- </BrowserRouter>
28
- </QueryClientProvider>
29
- );
File without changes
@@ -1,49 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react-vite';
2
- import { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from '@/components/ui/Accordion';
3
-
4
- const meta: Meta<typeof Accordion> = {
5
- title: 'UI Components/Accordion',
6
- component: Accordion,
7
- };
8
- export default meta;
9
- type Story = StoryObj<typeof Accordion>;
10
-
11
- /** Shows the accordion in single-select mode where only one item can be open at a time, with collapsible behavior. */
12
- export const Default: Story = {
13
- render: () => (
14
- <Accordion type="single" collapsible className="w-full max-w-md">
15
- <AccordionItem value="item-1">
16
- <AccordionTrigger>Is it accessible?</AccordionTrigger>
17
- <AccordionContent>Yes. It adheres to the WAI-ARIA design pattern for accordions.</AccordionContent>
18
- </AccordionItem>
19
- <AccordionItem value="item-2">
20
- <AccordionTrigger>Is it styled?</AccordionTrigger>
21
- <AccordionContent>Yes. It comes with default styles that match the other components.</AccordionContent>
22
- </AccordionItem>
23
- <AccordionItem value="item-3">
24
- <AccordionTrigger>Is it animated?</AccordionTrigger>
25
- <AccordionContent>Yes. It uses CSS animations for smooth open and close transitions.</AccordionContent>
26
- </AccordionItem>
27
- </Accordion>
28
- ),
29
- };
30
-
31
- /** Demonstrates multiple panels open simultaneously using `type="multiple"`. */
32
- export const Multiple: Story = {
33
- render: () => (
34
- <Accordion type="multiple" className="w-full max-w-md">
35
- <AccordionItem value="item-1">
36
- <AccordionTrigger>First section</AccordionTrigger>
37
- <AccordionContent>Content for the first section. Multiple items can be open at once.</AccordionContent>
38
- </AccordionItem>
39
- <AccordionItem value="item-2">
40
- <AccordionTrigger>Second section</AccordionTrigger>
41
- <AccordionContent>Content for the second section. Try opening multiple items.</AccordionContent>
42
- </AccordionItem>
43
- <AccordionItem value="item-3">
44
- <AccordionTrigger>Third section</AccordionTrigger>
45
- <AccordionContent>Content for the third section. All three can be open simultaneously.</AccordionContent>
46
- </AccordionItem>
47
- </Accordion>
48
- ),
49
- };
@@ -1,55 +0,0 @@
1
- import * as React from 'react';
2
- import { ChevronDownIcon } from 'lucide-react';
3
- import { Accordion as AccordionPrimitive } from 'radix-ui';
4
-
5
- import { cn } from '@/lib/utils';
6
-
7
- /** Expandable content sections. Use `type="single"` for one open at a time, `type="multiple"` for many. */
8
- function Accordion({ ...props }: React.ComponentProps<typeof AccordionPrimitive.Root>) {
9
- return <AccordionPrimitive.Root data-slot="accordion" {...props} />;
10
- }
11
-
12
- /** A single collapsible section within an Accordion, identified by a unique `value` prop. */
13
- function AccordionItem({ className, ...props }: React.ComponentProps<typeof AccordionPrimitive.Item>) {
14
- return (
15
- <AccordionPrimitive.Item
16
- data-slot="accordion-item"
17
- className={cn('border-b last:border-b-0', className)}
18
- {...props}
19
- />
20
- );
21
- }
22
-
23
- /** The clickable heading that toggles the visibility of its associated AccordionContent. Renders a chevron icon that rotates when open. */
24
- function AccordionTrigger({ className, children, ...props }: React.ComponentProps<typeof AccordionPrimitive.Trigger>) {
25
- return (
26
- <AccordionPrimitive.Header className="flex">
27
- <AccordionPrimitive.Trigger
28
- data-slot="accordion-trigger"
29
- className={cn(
30
- 'focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180',
31
- className,
32
- )}
33
- {...props}
34
- >
35
- {children}
36
- <ChevronDownIcon className="text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200" />
37
- </AccordionPrimitive.Trigger>
38
- </AccordionPrimitive.Header>
39
- );
40
- }
41
-
42
- /** The collapsible body of an AccordionItem, animated with slide-up/slide-down transitions. */
43
- function AccordionContent({ className, children, ...props }: React.ComponentProps<typeof AccordionPrimitive.Content>) {
44
- return (
45
- <AccordionPrimitive.Content
46
- data-slot="accordion-content"
47
- className="data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm"
48
- {...props}
49
- >
50
- <div className={cn('pt-0 pb-4', className)}>{children}</div>
51
- </AccordionPrimitive.Content>
52
- );
53
- }
54
-
55
- export { Accordion, AccordionItem, AccordionTrigger, AccordionContent };
@@ -1,29 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react-vite';
2
- import { Alert, AlertTitle, AlertDescription } from '@/components/ui/Alert';
3
-
4
- const meta: Meta<typeof Alert> = {
5
- title: 'UI Components/Alert',
6
- component: Alert,
7
- };
8
- export default meta;
9
- type Story = StoryObj<typeof Alert>;
10
-
11
- /** Shows the default informational alert variant with a title and description. */
12
- export const Default: Story = {
13
- render: () => (
14
- <Alert>
15
- <AlertTitle>Heads up!</AlertTitle>
16
- <AlertDescription>You can add components to your app using the CLI.</AlertDescription>
17
- </Alert>
18
- ),
19
- };
20
-
21
- /** Shows the destructive variant used for error or warning messages. */
22
- export const Destructive: Story = {
23
- render: () => (
24
- <Alert variant="destructive">
25
- <AlertTitle>Error</AlertTitle>
26
- <AlertDescription>Your session has expired. Please log in again.</AlertDescription>
27
- </Alert>
28
- ),
29
- };
@@ -1,56 +0,0 @@
1
- import * as React from 'react';
2
- import { cva, type VariantProps } from 'class-variance-authority';
3
-
4
- import { cn } from '@/lib/utils';
5
-
6
- const alertVariants = cva(
7
- 'relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current',
8
- {
9
- variants: {
10
- variant: {
11
- default: 'bg-card text-card-foreground',
12
- destructive:
13
- 'text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90',
14
- },
15
- },
16
- defaultVariants: {
17
- variant: 'default',
18
- },
19
- },
20
- );
21
-
22
- /**
23
- * Displays a callout message to attract user attention.
24
- * Supports `default` and `destructive` variants. Compose with AlertTitle and AlertDescription.
25
- * An optional leading SVG icon is automatically laid out in a grid column.
26
- */
27
- function Alert({ className, variant, ...props }: React.ComponentProps<'div'> & VariantProps<typeof alertVariants>) {
28
- return <div data-slot="alert" role="alert" className={cn(alertVariants({ variant }), className)} {...props} />;
29
- }
30
-
31
- /** The heading of an Alert, rendered as a single-line truncated title. */
32
- function AlertTitle({ className, ...props }: React.ComponentProps<'div'>) {
33
- return (
34
- <div
35
- data-slot="alert-title"
36
- className={cn('col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight', className)}
37
- {...props}
38
- />
39
- );
40
- }
41
-
42
- /** The body text of an Alert, styled in muted foreground for secondary emphasis. */
43
- function AlertDescription({ className, ...props }: React.ComponentProps<'div'>) {
44
- return (
45
- <div
46
- data-slot="alert-description"
47
- className={cn(
48
- 'text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed',
49
- className,
50
- )}
51
- {...props}
52
- />
53
- );
54
- }
55
-
56
- export { Alert, AlertTitle, AlertDescription };
@@ -1,67 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react-vite';
2
- import {
3
- AlertDialog,
4
- AlertDialogAction,
5
- AlertDialogCancel,
6
- AlertDialogContent,
7
- AlertDialogDescription,
8
- AlertDialogFooter,
9
- AlertDialogHeader,
10
- AlertDialogTitle,
11
- AlertDialogTrigger,
12
- } from '@/components/ui/AlertDialog';
13
- import { Button } from '@/components/ui/Button';
14
-
15
- const meta: Meta<typeof AlertDialog> = {
16
- title: 'UI Components/AlertDialog',
17
- component: AlertDialog,
18
- };
19
- export default meta;
20
- type Story = StoryObj<typeof AlertDialog>;
21
-
22
- /** Shows a standard confirmation dialog with cancel and continue actions. */
23
- export const Default: Story = {
24
- render: () => (
25
- <AlertDialog>
26
- <AlertDialogTrigger asChild>
27
- <Button variant="outline">Delete Account</Button>
28
- </AlertDialogTrigger>
29
- <AlertDialogContent>
30
- <AlertDialogHeader>
31
- <AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
32
- <AlertDialogDescription>
33
- This action cannot be undone. This will permanently delete your account and remove your data from our
34
- servers.
35
- </AlertDialogDescription>
36
- </AlertDialogHeader>
37
- <AlertDialogFooter>
38
- <AlertDialogCancel>Cancel</AlertDialogCancel>
39
- <AlertDialogAction>Continue</AlertDialogAction>
40
- </AlertDialogFooter>
41
- </AlertDialogContent>
42
- </AlertDialog>
43
- ),
44
- };
45
-
46
- /** Demonstrates a destructive confirmation using the destructive button variant for dangerous actions like deletion. */
47
- export const DestructiveAction: Story = {
48
- render: () => (
49
- <AlertDialog>
50
- <AlertDialogTrigger asChild>
51
- <Button variant="destructive">Delete Item</Button>
52
- </AlertDialogTrigger>
53
- <AlertDialogContent>
54
- <AlertDialogHeader>
55
- <AlertDialogTitle>Delete this item?</AlertDialogTitle>
56
- <AlertDialogDescription>
57
- This item will be permanently removed. This action cannot be undone.
58
- </AlertDialogDescription>
59
- </AlertDialogHeader>
60
- <AlertDialogFooter>
61
- <AlertDialogCancel>Cancel</AlertDialogCancel>
62
- <AlertDialogAction variant="destructive">Delete</AlertDialogAction>
63
- </AlertDialogFooter>
64
- </AlertDialogContent>
65
- </AlertDialog>
66
- ),
67
- };