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,116 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react-vite';
2
- import { Button } from '@/components/ui/Button';
3
- import {
4
- Toast,
5
- ToastAction,
6
- ToastClose,
7
- ToastDescription,
8
- ToastProvider,
9
- ToastTitle,
10
- ToastViewport,
11
- } from '@/components/ui/Toast';
12
- import { Toaster } from '@/components/ui/Toaster';
13
- import { useToast } from '@/hooks/use-toast';
14
-
15
- const meta: Meta<typeof Toast> = {
16
- title: 'UI Components/Toast',
17
- component: Toast,
18
- };
19
- export default meta;
20
- type Story = StoryObj<typeof Toast>;
21
-
22
- function ToastDemo() {
23
- const { toast } = useToast();
24
-
25
- return (
26
- <div>
27
- <Toaster />
28
- <Button
29
- variant="outline"
30
- onClick={() => {
31
- toast({
32
- title: 'UI Components/Scheduled: Catch up',
33
- description: 'Friday, February 10, 2026 at 5:57 PM',
34
- });
35
- }}
36
- >
37
- Show Toast
38
- </Button>
39
- </div>
40
- );
41
- }
42
-
43
- /** Demonstrates triggering a basic toast notification with a title and description. */
44
- export const Default: Story = {
45
- render: () => <ToastDemo />,
46
- };
47
-
48
- function ToastDestructiveDemo() {
49
- const { toast } = useToast();
50
-
51
- return (
52
- <div>
53
- <Toaster />
54
- <Button
55
- variant="outline"
56
- onClick={() => {
57
- toast({
58
- variant: 'destructive',
59
- title: 'UI Components/Uh oh! Something went wrong.',
60
- description: 'There was a problem with your request.',
61
- });
62
- }}
63
- >
64
- Show Destructive Toast
65
- </Button>
66
- </div>
67
- );
68
- }
69
-
70
- /** Shows a destructive-variant toast for error or warning scenarios. */
71
- export const Destructive: Story = {
72
- render: () => <ToastDestructiveDemo />,
73
- };
74
-
75
- function ToastWithActionDemo() {
76
- const { toast } = useToast();
77
-
78
- return (
79
- <div>
80
- <Toaster />
81
- <Button
82
- variant="outline"
83
- onClick={() => {
84
- toast({
85
- title: 'UI Components/Event created',
86
- description: 'Sunday, December 03, 2023 at 9:00 AM',
87
- action: <ToastAction altText="Undo">Undo</ToastAction>,
88
- });
89
- }}
90
- >
91
- Show Toast with Action
92
- </Button>
93
- </div>
94
- );
95
- }
96
-
97
- /** Shows a toast with an action button (e.g., "Undo") alongside the message. */
98
- export const WithAction: Story = {
99
- render: () => <ToastWithActionDemo />,
100
- };
101
-
102
- /** Shows a toast rendered inline (always open) using the primitive subcomponents directly. */
103
- export const Inline: Story = {
104
- render: () => (
105
- <ToastProvider>
106
- <Toast open>
107
- <div className="grid gap-1">
108
- <ToastTitle>Toast Title</ToastTitle>
109
- <ToastDescription>This is a toast description.</ToastDescription>
110
- </div>
111
- <ToastClose />
112
- </Toast>
113
- <ToastViewport />
114
- </ToastProvider>
115
- ),
116
- };
@@ -1,123 +0,0 @@
1
- 'use client';
2
-
3
- import * as React from 'react';
4
- import { cva, type VariantProps } from 'class-variance-authority';
5
- import { XIcon } from 'lucide-react';
6
- import { Toast as ToastPrimitive } from 'radix-ui';
7
-
8
- import { cn } from '@/lib/utils';
9
-
10
- /** Temporary notification at screen edge with swipe-to-dismiss. Supports default and destructive variants. */
11
-
12
- /** Provides the toast context for managing toast state and swipe behavior. */
13
- function ToastProvider({ ...props }: React.ComponentProps<typeof ToastPrimitive.Provider>) {
14
- return <ToastPrimitive.Provider data-slot="toast-provider" {...props} />;
15
- }
16
-
17
- /** The fixed-position viewport where toasts are rendered, positioned at bottom-right on larger screens. */
18
- function ToastViewport({ className, ...props }: React.ComponentProps<typeof ToastPrimitive.Viewport>) {
19
- return (
20
- <ToastPrimitive.Viewport
21
- data-slot="toast-viewport"
22
- className={cn(
23
- 'fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]',
24
- className,
25
- )}
26
- {...props}
27
- />
28
- );
29
- }
30
-
31
- const toastVariants = cva(
32
- 'group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full',
33
- {
34
- variants: {
35
- variant: {
36
- default: 'border bg-background text-foreground',
37
- destructive: 'destructive group border-destructive bg-destructive text-destructive-foreground',
38
- },
39
- },
40
- defaultVariants: {
41
- variant: 'default',
42
- },
43
- },
44
- );
45
-
46
- /** An individual toast notification with default or destructive variant styling. */
47
- function Toast({
48
- className,
49
- variant,
50
- ...props
51
- }: React.ComponentProps<typeof ToastPrimitive.Root> & VariantProps<typeof toastVariants>) {
52
- return <ToastPrimitive.Root data-slot="toast" className={cn(toastVariants({ variant }), className)} {...props} />;
53
- }
54
-
55
- /** An action button displayed within a toast, such as "Undo" or "Retry". */
56
- function ToastAction({ className, ...props }: React.ComponentProps<typeof ToastPrimitive.Action>) {
57
- return (
58
- <ToastPrimitive.Action
59
- data-slot="toast-action"
60
- className={cn(
61
- 'inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive',
62
- className,
63
- )}
64
- {...props}
65
- />
66
- );
67
- }
68
-
69
- /** A close button positioned in the top-right corner of a toast, visible on hover. */
70
- function ToastClose({ className, ...props }: React.ComponentProps<typeof ToastPrimitive.Close>) {
71
- return (
72
- <ToastPrimitive.Close
73
- data-slot="toast-close"
74
- className={cn(
75
- 'absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600',
76
- className,
77
- )}
78
- toast-close=""
79
- {...props}
80
- >
81
- <XIcon className="h-4 w-4" />
82
- </ToastPrimitive.Close>
83
- );
84
- }
85
-
86
- /** The bold heading text of a toast notification. */
87
- function ToastTitle({ className, ...props }: React.ComponentProps<typeof ToastPrimitive.Title>) {
88
- return (
89
- <ToastPrimitive.Title
90
- data-slot="toast-title"
91
- className={cn('text-sm font-semibold [&+div]:text-xs', className)}
92
- {...props}
93
- />
94
- );
95
- }
96
-
97
- /** The secondary descriptive text of a toast notification. */
98
- function ToastDescription({ className, ...props }: React.ComponentProps<typeof ToastPrimitive.Description>) {
99
- return (
100
- <ToastPrimitive.Description
101
- data-slot="toast-description"
102
- className={cn('text-sm opacity-90', className)}
103
- {...props}
104
- />
105
- );
106
- }
107
-
108
- type ToastProps = React.ComponentPropsWithoutRef<typeof Toast>;
109
-
110
- type ToastActionElement = React.ReactElement<typeof ToastAction>;
111
-
112
- export {
113
- type ToastProps,
114
- type ToastActionElement,
115
- ToastProvider,
116
- ToastViewport,
117
- Toast,
118
- ToastTitle,
119
- ToastDescription,
120
- ToastClose,
121
- ToastAction,
122
- toastVariants,
123
- };
@@ -1,32 +0,0 @@
1
- 'use client';
2
-
3
- import { useToast } from '@/hooks/use-toast';
4
- import { Toast, ToastClose, ToastDescription, ToastProvider, ToastTitle, ToastViewport } from '@/components/ui/Toast';
5
-
6
- /**
7
- * Renders all active toasts from the useToast hook into a fixed-position viewport.
8
- * Place once at the app root to enable imperative toast notifications via the useToast hook.
9
- */
10
- function Toaster() {
11
- const { toasts } = useToast();
12
-
13
- return (
14
- <ToastProvider>
15
- {toasts.map(function ({ id, title, description, action, ...props }) {
16
- return (
17
- <Toast key={id} {...props}>
18
- <div className="grid gap-1">
19
- {title && <ToastTitle>{title}</ToastTitle>}
20
- {description && <ToastDescription>{description}</ToastDescription>}
21
- </div>
22
- {action}
23
- <ToastClose />
24
- </Toast>
25
- );
26
- })}
27
- <ToastViewport />
28
- </ToastProvider>
29
- );
30
- }
31
-
32
- export { Toaster };
@@ -1,44 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react-vite';
2
- import { BoldIcon } from 'lucide-react';
3
- import { Toggle } from '@/components/ui/Toggle';
4
-
5
- const meta: Meta<typeof Toggle> = {
6
- title: 'UI Components/Toggle',
7
- component: Toggle,
8
- };
9
- export default meta;
10
- type Story = StoryObj<typeof Toggle>;
11
-
12
- /** Shows a toggle button with a bold icon in the default ghost variant. */
13
- export const Default: Story = {
14
- args: {
15
- 'aria-label': 'Toggle bold',
16
- children: <BoldIcon />,
17
- },
18
- };
19
-
20
- /** Shows the outline variant with a visible border. */
21
- export const Outline: Story = {
22
- args: {
23
- variant: 'outline',
24
- 'aria-label': 'Toggle bold',
25
- children: <BoldIcon />,
26
- },
27
- };
28
-
29
- /** Shows a toggle with a text label instead of an icon. */
30
- export const WithText: Story = {
31
- args: {
32
- 'aria-label': 'Toggle italic',
33
- children: 'Italic',
34
- },
35
- };
36
-
37
- /** Shows a toggle in its initially pressed (on) state. */
38
- export const Pressed: Story = {
39
- args: {
40
- defaultPressed: true,
41
- 'aria-label': 'Toggle bold',
42
- children: <BoldIcon />,
43
- },
44
- };
@@ -1,42 +0,0 @@
1
- 'use client';
2
-
3
- import * as React from 'react';
4
- import { cva, type VariantProps } from 'class-variance-authority';
5
- import { Toggle as TogglePrimitive } from 'radix-ui';
6
-
7
- import { cn } from '@/lib/utils';
8
-
9
- const toggleVariants = cva(
10
- "inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",
11
- {
12
- variants: {
13
- variant: {
14
- default: 'bg-transparent',
15
- outline: 'border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground',
16
- },
17
- size: {
18
- default: 'h-9 px-2 min-w-9',
19
- sm: 'h-8 px-1.5 min-w-8',
20
- lg: 'h-10 px-2.5 min-w-10',
21
- },
22
- },
23
- defaultVariants: {
24
- variant: 'default',
25
- size: 'default',
26
- },
27
- },
28
- );
29
-
30
- /** A two-state button for toolbar controls. Has "default" (ghost) and "outline" variants in sm/default/lg sizes. */
31
- function Toggle({
32
- className,
33
- variant,
34
- size,
35
- ...props
36
- }: React.ComponentProps<typeof TogglePrimitive.Root> & VariantProps<typeof toggleVariants>) {
37
- return (
38
- <TogglePrimitive.Root data-slot="toggle" className={cn(toggleVariants({ variant, size, className }))} {...props} />
39
- );
40
- }
41
-
42
- export { Toggle, toggleVariants };
@@ -1,61 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react-vite';
2
- import { BoldIcon, ItalicIcon, UnderlineIcon } from 'lucide-react';
3
- import { ToggleGroup, ToggleGroupItem } from '@/components/ui/ToggleGroup';
4
-
5
- const meta: Meta<typeof ToggleGroup> = {
6
- title: 'UI Components/ToggleGroup',
7
- component: ToggleGroup,
8
- };
9
- export default meta;
10
- type Story = StoryObj<typeof ToggleGroup>;
11
-
12
- /** Shows a single-selection toggle group where only one item can be active at a time. */
13
- export const Single: Story = {
14
- render: () => (
15
- <ToggleGroup type="single">
16
- <ToggleGroupItem value="bold" aria-label="Toggle bold">
17
- <BoldIcon />
18
- </ToggleGroupItem>
19
- <ToggleGroupItem value="italic" aria-label="Toggle italic">
20
- <ItalicIcon />
21
- </ToggleGroupItem>
22
- <ToggleGroupItem value="underline" aria-label="Toggle underline">
23
- <UnderlineIcon />
24
- </ToggleGroupItem>
25
- </ToggleGroup>
26
- ),
27
- };
28
-
29
- /** Shows a multi-selection toggle group with bold and italic pre-selected. */
30
- export const Multiple: Story = {
31
- render: () => (
32
- <ToggleGroup type="multiple" defaultValue={['bold', 'italic']}>
33
- <ToggleGroupItem value="bold" aria-label="Toggle bold">
34
- <BoldIcon />
35
- </ToggleGroupItem>
36
- <ToggleGroupItem value="italic" aria-label="Toggle italic">
37
- <ItalicIcon />
38
- </ToggleGroupItem>
39
- <ToggleGroupItem value="underline" aria-label="Toggle underline">
40
- <UnderlineIcon />
41
- </ToggleGroupItem>
42
- </ToggleGroup>
43
- ),
44
- };
45
-
46
- /** Shows a toggle group using the outline variant with visible borders. */
47
- export const Outline: Story = {
48
- render: () => (
49
- <ToggleGroup type="single" variant="outline">
50
- <ToggleGroupItem value="bold" aria-label="Toggle bold">
51
- <BoldIcon />
52
- </ToggleGroupItem>
53
- <ToggleGroupItem value="italic" aria-label="Toggle italic">
54
- <ItalicIcon />
55
- </ToggleGroupItem>
56
- <ToggleGroupItem value="underline" aria-label="Toggle underline">
57
- <UnderlineIcon />
58
- </ToggleGroupItem>
59
- </ToggleGroup>
60
- ),
61
- };
@@ -1,83 +0,0 @@
1
- 'use client';
2
-
3
- import * as React from 'react';
4
- import { type VariantProps } from 'class-variance-authority';
5
- import { ToggleGroup as ToggleGroupPrimitive } from 'radix-ui';
6
-
7
- import { cn } from '@/lib/utils';
8
- import { toggleVariants } from '@/components/ui/Toggle';
9
-
10
- const ToggleGroupContext = React.createContext<
11
- VariantProps<typeof toggleVariants> & {
12
- spacing?: number;
13
- }
14
- >({
15
- size: 'default',
16
- variant: 'default',
17
- spacing: 0,
18
- });
19
-
20
- /** A group of toggles where one (`type="single"`) or multiple (`type="multiple"`) can be active. */
21
- function ToggleGroup({
22
- className,
23
- variant,
24
- size,
25
- /** Controls gap between items. When 0, items are visually joined with shared borders. */
26
- spacing = 0,
27
- children,
28
- ...props
29
- }: React.ComponentProps<typeof ToggleGroupPrimitive.Root> &
30
- VariantProps<typeof toggleVariants> & {
31
- spacing?: number;
32
- }) {
33
- return (
34
- <ToggleGroupPrimitive.Root
35
- data-slot="toggle-group"
36
- data-variant={variant}
37
- data-size={size}
38
- data-spacing={spacing}
39
- style={{ '--gap': spacing } as React.CSSProperties}
40
- className={cn(
41
- 'group/toggle-group flex w-fit items-center gap-[--spacing(var(--gap))] rounded-md data-[spacing=default]:data-[variant=outline]:shadow-xs',
42
- className,
43
- )}
44
- {...props}
45
- >
46
- <ToggleGroupContext.Provider value={{ variant, size, spacing }}>{children}</ToggleGroupContext.Provider>
47
- </ToggleGroupPrimitive.Root>
48
- );
49
- }
50
-
51
- /** An individual toggle button within a ToggleGroup. Inherits variant and size from the parent group context. */
52
- function ToggleGroupItem({
53
- className,
54
- children,
55
- variant,
56
- size,
57
- ...props
58
- }: React.ComponentProps<typeof ToggleGroupPrimitive.Item> & VariantProps<typeof toggleVariants>) {
59
- const context = React.useContext(ToggleGroupContext);
60
-
61
- return (
62
- <ToggleGroupPrimitive.Item
63
- data-slot="toggle-group-item"
64
- data-variant={context.variant || variant}
65
- data-size={context.size || size}
66
- data-spacing={context.spacing}
67
- className={cn(
68
- toggleVariants({
69
- variant: context.variant || variant,
70
- size: context.size || size,
71
- }),
72
- 'w-auto min-w-0 shrink-0 px-3 focus:z-10 focus-visible:z-10',
73
- 'data-[spacing=0]:rounded-none data-[spacing=0]:shadow-none data-[spacing=0]:first:rounded-l-md data-[spacing=0]:last:rounded-r-md data-[spacing=0]:data-[variant=outline]:border-l-0 data-[spacing=0]:data-[variant=outline]:first:border-l',
74
- className,
75
- )}
76
- {...props}
77
- >
78
- {children}
79
- </ToggleGroupPrimitive.Item>
80
- );
81
- }
82
-
83
- export { ToggleGroup, ToggleGroupItem };
@@ -1,42 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react-vite';
2
- import { Button } from '@/components/ui/Button';
3
- import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/Tooltip';
4
-
5
- const meta: Meta<typeof Tooltip> = {
6
- title: 'UI Components/Tooltip',
7
- component: Tooltip,
8
- };
9
- export default meta;
10
- type Story = StoryObj<typeof Tooltip>;
11
-
12
- /** Shows a basic tooltip appearing on hover over a button. */
13
- export const Default: Story = {
14
- render: () => (
15
- <TooltipProvider>
16
- <Tooltip>
17
- <TooltipTrigger asChild>
18
- <Button variant="outline">Hover me</Button>
19
- </TooltipTrigger>
20
- <TooltipContent>
21
- <p>This is a tooltip</p>
22
- </TooltipContent>
23
- </Tooltip>
24
- </TooltipProvider>
25
- ),
26
- };
27
-
28
- /** Shows a tooltip with additional spacing between the trigger and content via sideOffset. */
29
- export const WithSideOffset: Story = {
30
- render: () => (
31
- <TooltipProvider>
32
- <Tooltip>
33
- <TooltipTrigger asChild>
34
- <Button variant="outline">With offset</Button>
35
- </TooltipTrigger>
36
- <TooltipContent sideOffset={8}>
37
- <p>Tooltip with side offset</p>
38
- </TooltipContent>
39
- </Tooltip>
40
- </TooltipProvider>
41
- ),
42
- };
@@ -1,48 +0,0 @@
1
- import * as React from 'react';
2
- import { Tooltip as TooltipPrimitive } from 'radix-ui';
3
-
4
- import { cn } from '@/lib/utils';
5
-
6
- /** Brief descriptive popup on hover/focus. Has enter/exit animations and arrow indicator. Wrap app in TooltipProvider first. */
7
-
8
- /** Provides shared tooltip configuration (e.g., delay duration) for all nested Tooltip instances. */
9
- function TooltipProvider({ delayDuration = 0, ...props }: React.ComponentProps<typeof TooltipPrimitive.Provider>) {
10
- return <TooltipPrimitive.Provider data-slot="tooltip-provider" delayDuration={delayDuration} {...props} />;
11
- }
12
-
13
- /** The root component that manages open/close state for a single tooltip. */
14
- function Tooltip({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Root>) {
15
- return <TooltipPrimitive.Root data-slot="tooltip" {...props} />;
16
- }
17
-
18
- /** The element that triggers the tooltip on hover or focus. */
19
- function TooltipTrigger({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {
20
- return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />;
21
- }
22
-
23
- /** The popup content panel rendered via a portal with an arrow indicator. */
24
- function TooltipContent({
25
- className,
26
- sideOffset = 0,
27
- children,
28
- ...props
29
- }: React.ComponentProps<typeof TooltipPrimitive.Content>) {
30
- return (
31
- <TooltipPrimitive.Portal>
32
- <TooltipPrimitive.Content
33
- data-slot="tooltip-content"
34
- sideOffset={sideOffset}
35
- className={cn(
36
- 'bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance',
37
- className,
38
- )}
39
- {...props}
40
- >
41
- {children}
42
- <TooltipPrimitive.Arrow className="bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" />
43
- </TooltipPrimitive.Content>
44
- </TooltipPrimitive.Portal>
45
- );
46
- }
47
-
48
- export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
@@ -1,11 +0,0 @@
1
- import request from 'graphql-request';
2
- import type { TypedDocumentString } from './graphql';
3
-
4
- const GRAPHQL_ENDPOINT = 'http://localhost:4000/graphql';
5
-
6
- export async function execute<TResult, TVariables>(
7
- query: TypedDocumentString<TResult, TVariables>,
8
- ...[variables]: TVariables extends Record<string, never> ? [] : [TVariables]
9
- ): Promise<TResult> {
10
- return request(GRAPHQL_ENDPOINT, query.toString(), variables ? variables : undefined);
11
- }