create-auto-app 1.34.0 → 1.35.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 (157) hide show
  1. package/package.json +2 -2
  2. package/templates/typical/.context/components-db.json +4006 -0
  3. package/templates/typical/.gitignore +1 -1
  4. package/templates/typical/auto.config.ts +85 -80
  5. package/templates/typical/client/.gitignore +0 -4
  6. package/templates/typical/client/.storybook/main.ts +0 -66
  7. package/templates/typical/client/.storybook/manager-head.html +0 -154
  8. package/templates/typical/client/.storybook/manager.ts +0 -164
  9. package/templates/typical/client/.storybook/preview-head.html +0 -31
  10. package/templates/typical/client/.storybook/preview.tsx +0 -120
  11. package/templates/typical/client/codegen.ts +0 -17
  12. package/templates/typical/client/components.json +0 -29
  13. package/templates/typical/client/index.html +0 -12
  14. package/templates/typical/client/package.json +0 -69
  15. package/templates/typical/client/pnpm-lock.yaml +0 -7868
  16. package/templates/typical/client/public/blank.svg +0 -1
  17. package/templates/typical/client/public/mockServiceWorker.js +0 -336
  18. package/templates/typical/client/src/App.tsx +0 -29
  19. package/templates/typical/client/src/components/.gitkeep +0 -0
  20. package/templates/typical/client/src/components/ui/Accordion.stories.tsx +0 -49
  21. package/templates/typical/client/src/components/ui/Accordion.tsx +0 -55
  22. package/templates/typical/client/src/components/ui/Alert.stories.tsx +0 -29
  23. package/templates/typical/client/src/components/ui/Alert.tsx +0 -56
  24. package/templates/typical/client/src/components/ui/AlertDialog.stories.tsx +0 -67
  25. package/templates/typical/client/src/components/ui/AlertDialog.tsx +0 -178
  26. package/templates/typical/client/src/components/ui/AspectRatio.stories.tsx +0 -35
  27. package/templates/typical/client/src/components/ui/AspectRatio.tsx +0 -13
  28. package/templates/typical/client/src/components/ui/Avatar.stories.tsx +0 -45
  29. package/templates/typical/client/src/components/ui/Avatar.tsx +0 -98
  30. package/templates/typical/client/src/components/ui/Badge.stories.tsx +0 -41
  31. package/templates/typical/client/src/components/ui/Badge.tsx +0 -45
  32. package/templates/typical/client/src/components/ui/Breadcrumb.stories.tsx +0 -54
  33. package/templates/typical/client/src/components/ui/Breadcrumb.tsx +0 -104
  34. package/templates/typical/client/src/components/ui/Button.stories.tsx +0 -102
  35. package/templates/typical/client/src/components/ui/Button.tsx +0 -67
  36. package/templates/typical/client/src/components/ui/ButtonGroup.stories.tsx +0 -32
  37. package/templates/typical/client/src/components/ui/ButtonGroup.tsx +0 -81
  38. package/templates/typical/client/src/components/ui/Calendar.stories.tsx +0 -40
  39. package/templates/typical/client/src/components/ui/Calendar.tsx +0 -165
  40. package/templates/typical/client/src/components/ui/Card.stories.tsx +0 -44
  41. package/templates/typical/client/src/components/ui/Card.tsx +0 -66
  42. package/templates/typical/client/src/components/ui/Carousel.stories.tsx +0 -56
  43. package/templates/typical/client/src/components/ui/Carousel.tsx +0 -225
  44. package/templates/typical/client/src/components/ui/Chart.stories.tsx +0 -39
  45. package/templates/typical/client/src/components/ui/Chart.tsx +0 -305
  46. package/templates/typical/client/src/components/ui/Checkbox.stories.tsx +0 -35
  47. package/templates/typical/client/src/components/ui/Checkbox.tsx +0 -30
  48. package/templates/typical/client/src/components/ui/Collapsible.stories.tsx +0 -58
  49. package/templates/typical/client/src/components/ui/Collapsible.tsx +0 -18
  50. package/templates/typical/client/src/components/ui/Combobox.stories.tsx +0 -75
  51. package/templates/typical/client/src/components/ui/Combobox.tsx +0 -296
  52. package/templates/typical/client/src/components/ui/Command.stories.tsx +0 -71
  53. package/templates/typical/client/src/components/ui/Command.tsx +0 -157
  54. package/templates/typical/client/src/components/ui/ContextMenu.stories.tsx +0 -68
  55. package/templates/typical/client/src/components/ui/ContextMenu.tsx +0 -231
  56. package/templates/typical/client/src/components/ui/DesignSystem-Colors.mdx +0 -68
  57. package/templates/typical/client/src/components/ui/DesignSystem-Colors.stories.tsx +0 -117
  58. package/templates/typical/client/src/components/ui/DesignSystem-Layout.mdx +0 -64
  59. package/templates/typical/client/src/components/ui/DesignSystem-Layout.stories.tsx +0 -167
  60. package/templates/typical/client/src/components/ui/DesignSystem-Overview.stories.tsx +0 -748
  61. package/templates/typical/client/src/components/ui/DesignSystem-Typography.mdx +0 -31
  62. package/templates/typical/client/src/components/ui/DesignSystem-Typography.stories.tsx +0 -80
  63. package/templates/typical/client/src/components/ui/Dialog.stories.tsx +0 -74
  64. package/templates/typical/client/src/components/ui/Dialog.tsx +0 -154
  65. package/templates/typical/client/src/components/ui/Direction.stories.tsx +0 -38
  66. package/templates/typical/client/src/components/ui/Direction.tsx +0 -24
  67. package/templates/typical/client/src/components/ui/Drawer.stories.tsx +0 -70
  68. package/templates/typical/client/src/components/ui/Drawer.tsx +0 -124
  69. package/templates/typical/client/src/components/ui/DropdownMenu.stories.tsx +0 -74
  70. package/templates/typical/client/src/components/ui/DropdownMenu.tsx +0 -239
  71. package/templates/typical/client/src/components/ui/Empty.stories.tsx +0 -37
  72. package/templates/typical/client/src/components/ui/Empty.tsx +0 -98
  73. package/templates/typical/client/src/components/ui/Field.stories.tsx +0 -50
  74. package/templates/typical/client/src/components/ui/Field.tsx +0 -251
  75. package/templates/typical/client/src/components/ui/Form.stories.tsx +0 -45
  76. package/templates/typical/client/src/components/ui/Form.tsx +0 -148
  77. package/templates/typical/client/src/components/ui/HoverCard.stories.tsx +0 -49
  78. package/templates/typical/client/src/components/ui/HoverCard.tsx +0 -39
  79. package/templates/typical/client/src/components/ui/Input.stories.tsx +0 -42
  80. package/templates/typical/client/src/components/ui/Input.tsx +0 -22
  81. package/templates/typical/client/src/components/ui/InputGroup.stories.tsx +0 -53
  82. package/templates/typical/client/src/components/ui/InputGroup.tsx +0 -153
  83. package/templates/typical/client/src/components/ui/InputOTP.stories.tsx +0 -42
  84. package/templates/typical/client/src/components/ui/InputOTP.tsx +0 -72
  85. package/templates/typical/client/src/components/ui/Item.stories.tsx +0 -64
  86. package/templates/typical/client/src/components/ui/Item.tsx +0 -168
  87. package/templates/typical/client/src/components/ui/Kbd.stories.tsx +0 -59
  88. package/templates/typical/client/src/components/ui/Kbd.tsx +0 -22
  89. package/templates/typical/client/src/components/ui/Label.stories.tsx +0 -90
  90. package/templates/typical/client/src/components/ui/Label.tsx +0 -44
  91. package/templates/typical/client/src/components/ui/Menubar.stories.tsx +0 -78
  92. package/templates/typical/client/src/components/ui/Menubar.tsx +0 -251
  93. package/templates/typical/client/src/components/ui/NativeSelect.stories.tsx +0 -45
  94. package/templates/typical/client/src/components/ui/NativeSelect.tsx +0 -50
  95. package/templates/typical/client/src/components/ui/NavigationMenu.stories.tsx +0 -80
  96. package/templates/typical/client/src/components/ui/NavigationMenu.tsx +0 -152
  97. package/templates/typical/client/src/components/ui/Pagination.stories.tsx +0 -77
  98. package/templates/typical/client/src/components/ui/Pagination.tsx +0 -108
  99. package/templates/typical/client/src/components/ui/Popover.stories.tsx +0 -53
  100. package/templates/typical/client/src/components/ui/Popover.tsx +0 -57
  101. package/templates/typical/client/src/components/ui/Progress.stories.tsx +0 -32
  102. package/templates/typical/client/src/components/ui/Progress.tsx +0 -25
  103. package/templates/typical/client/src/components/ui/RadioGroup.stories.tsx +0 -50
  104. package/templates/typical/client/src/components/ui/RadioGroup.tsx +0 -36
  105. package/templates/typical/client/src/components/ui/Resizable.stories.tsx +0 -72
  106. package/templates/typical/client/src/components/ui/Resizable.tsx +0 -54
  107. package/templates/typical/client/src/components/ui/ScrollArea.stories.tsx +0 -45
  108. package/templates/typical/client/src/components/ui/ScrollArea.tsx +0 -51
  109. package/templates/typical/client/src/components/ui/Select.stories.tsx +0 -59
  110. package/templates/typical/client/src/components/ui/Select.tsx +0 -171
  111. package/templates/typical/client/src/components/ui/Separator.stories.tsx +0 -42
  112. package/templates/typical/client/src/components/ui/Separator.tsx +0 -27
  113. package/templates/typical/client/src/components/ui/Sheet.stories.tsx +0 -68
  114. package/templates/typical/client/src/components/ui/Sheet.tsx +0 -115
  115. package/templates/typical/client/src/components/ui/Sidebar.stories.tsx +0 -96
  116. package/templates/typical/client/src/components/ui/Sidebar.tsx +0 -695
  117. package/templates/typical/client/src/components/ui/Skeleton.stories.tsx +0 -40
  118. package/templates/typical/client/src/components/ui/Skeleton.tsx +0 -11
  119. package/templates/typical/client/src/components/ui/Slider.stories.tsx +0 -24
  120. package/templates/typical/client/src/components/ui/Slider.tsx +0 -55
  121. package/templates/typical/client/src/components/ui/Sonner.stories.tsx +0 -45
  122. package/templates/typical/client/src/components/ui/Sonner.tsx +0 -38
  123. package/templates/typical/client/src/components/ui/Spinner.stories.tsx +0 -26
  124. package/templates/typical/client/src/components/ui/Spinner.tsx +0 -13
  125. package/templates/typical/client/src/components/ui/Switch.stories.tsx +0 -39
  126. package/templates/typical/client/src/components/ui/Switch.tsx +0 -35
  127. package/templates/typical/client/src/components/ui/Table.stories.tsx +0 -67
  128. package/templates/typical/client/src/components/ui/Table.tsx +0 -86
  129. package/templates/typical/client/src/components/ui/Tabs.stories.tsx +0 -53
  130. package/templates/typical/client/src/components/ui/Tabs.tsx +0 -75
  131. package/templates/typical/client/src/components/ui/Textarea.stories.tsx +0 -27
  132. package/templates/typical/client/src/components/ui/Textarea.tsx +0 -22
  133. package/templates/typical/client/src/components/ui/Toast.stories.tsx +0 -116
  134. package/templates/typical/client/src/components/ui/Toast.tsx +0 -123
  135. package/templates/typical/client/src/components/ui/Toaster.tsx +0 -32
  136. package/templates/typical/client/src/components/ui/Toggle.stories.tsx +0 -44
  137. package/templates/typical/client/src/components/ui/Toggle.tsx +0 -42
  138. package/templates/typical/client/src/components/ui/ToggleGroup.stories.tsx +0 -61
  139. package/templates/typical/client/src/components/ui/ToggleGroup.tsx +0 -83
  140. package/templates/typical/client/src/components/ui/Tooltip.stories.tsx +0 -42
  141. package/templates/typical/client/src/components/ui/Tooltip.tsx +0 -48
  142. package/templates/typical/client/src/gql/execute.ts +0 -11
  143. package/templates/typical/client/src/gql/fragment-masking.ts +0 -83
  144. package/templates/typical/client/src/gql/gql.ts +0 -9
  145. package/templates/typical/client/src/gql/graphql.ts +0 -182
  146. package/templates/typical/client/src/gql/index.ts +0 -2
  147. package/templates/typical/client/src/graphql/mutations.ts +0 -0
  148. package/templates/typical/client/src/graphql/queries.ts +0 -0
  149. package/templates/typical/client/src/hooks/.gitkeep +0 -0
  150. package/templates/typical/client/src/hooks/use-mobile.ts +0 -19
  151. package/templates/typical/client/src/hooks/use-toast.ts +0 -186
  152. package/templates/typical/client/src/index.css +0 -121
  153. package/templates/typical/client/src/lib/utils.ts +0 -6
  154. package/templates/typical/client/src/main.tsx +0 -5
  155. package/templates/typical/client/tsconfig.app.json +0 -26
  156. package/templates/typical/client/tsconfig.json +0 -10
  157. package/templates/typical/client/vite.config.ts +0 -50
@@ -1,64 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react-vite';
2
- import { Item, ItemContent, ItemTitle, ItemDescription, ItemActions } from '@/components/ui/Item';
3
- import { Button } from '@/components/ui/Button';
4
-
5
- const meta: Meta<typeof Item> = {
6
- title: 'UI Components/Item',
7
- component: Item,
8
- };
9
- export default meta;
10
- type Story = StoryObj<typeof Item>;
11
-
12
- /** Standard item with title, description, and action buttons. */
13
- export const Default: Story = {
14
- render: () => (
15
- <Item>
16
- <ItemContent>
17
- <ItemTitle>Item Title</ItemTitle>
18
- <ItemDescription>This is a description of the item with some details.</ItemDescription>
19
- </ItemContent>
20
- <ItemActions>
21
- <Button variant="outline" size="sm">
22
- Edit
23
- </Button>
24
- <Button variant="ghost" size="sm">
25
- Delete
26
- </Button>
27
- </ItemActions>
28
- </Item>
29
- ),
30
- };
31
-
32
- /** Item with visible border using the outline variant. */
33
- export const OutlineVariant: Story = {
34
- render: () => (
35
- <Item variant="outline">
36
- <ItemContent>
37
- <ItemTitle>Outline Item</ItemTitle>
38
- <ItemDescription>An item displayed with the outline variant and a visible border.</ItemDescription>
39
- </ItemContent>
40
- <ItemActions>
41
- <Button variant="outline" size="sm">
42
- View
43
- </Button>
44
- </ItemActions>
45
- </Item>
46
- ),
47
- };
48
-
49
- /** Compact item with reduced padding for dense lists. */
50
- export const SmallSize: Story = {
51
- render: () => (
52
- <Item size="sm">
53
- <ItemContent>
54
- <ItemTitle>Small Item</ItemTitle>
55
- <ItemDescription>Compact item with reduced padding.</ItemDescription>
56
- </ItemContent>
57
- <ItemActions>
58
- <Button variant="ghost" size="sm">
59
- Action
60
- </Button>
61
- </ItemActions>
62
- </Item>
63
- ),
64
- };
@@ -1,168 +0,0 @@
1
- import * as React from 'react';
2
- import { cva, type VariantProps } from 'class-variance-authority';
3
- import { Slot } from 'radix-ui';
4
-
5
- import { cn } from '@/lib/utils';
6
- import { Separator } from '@/components/ui/Separator';
7
-
8
- /** Container for a list of Item components. Provides list semantics for accessibility. */
9
- function ItemGroup({ className, ...props }: React.ComponentProps<'div'>) {
10
- return (
11
- <div role="list" data-slot="item-group" className={cn('group/item-group flex flex-col', className)} {...props} />
12
- );
13
- }
14
-
15
- /** Horizontal divider between items in an ItemGroup. */
16
- function ItemSeparator({ className, ...props }: React.ComponentProps<typeof Separator>) {
17
- return <Separator data-slot="item-separator" orientation="horizontal" className={cn('my-0', className)} {...props} />;
18
- }
19
-
20
- const itemVariants = cva(
21
- 'group/item flex items-center border border-transparent text-sm rounded-md transition-colors [a]:hover:bg-accent/50 [a]:transition-colors duration-100 flex-wrap outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]',
22
- {
23
- variants: {
24
- variant: {
25
- default: 'bg-transparent',
26
- outline: 'border-border',
27
- muted: 'bg-muted/50',
28
- },
29
- size: {
30
- default: 'p-4 gap-4 ',
31
- sm: 'py-3 px-4 gap-2.5',
32
- },
33
- },
34
- defaultVariants: {
35
- variant: 'default',
36
- size: 'default',
37
- },
38
- },
39
- );
40
-
41
- /** A flexible list item for displaying structured content like notifications, settings rows, or search results. Compose with ItemMedia, ItemContent, ItemTitle, ItemDescription, and ItemActions. */
42
- function Item({
43
- className,
44
- variant = 'default',
45
- size = 'default',
46
- asChild = false,
47
- ...props
48
- }: React.ComponentProps<'div'> & VariantProps<typeof itemVariants> & { asChild?: boolean }) {
49
- const Comp = asChild ? Slot.Root : 'div';
50
- return (
51
- <Comp
52
- data-slot="item"
53
- data-variant={variant}
54
- data-size={size}
55
- className={cn(itemVariants({ variant, size, className }))}
56
- {...props}
57
- />
58
- );
59
- }
60
-
61
- const itemMediaVariants = cva(
62
- 'flex shrink-0 items-center justify-center gap-2 group-has-[[data-slot=item-description]]/item:self-start [&_svg]:pointer-events-none group-has-[[data-slot=item-description]]/item:translate-y-0.5',
63
- {
64
- variants: {
65
- variant: {
66
- default: 'bg-transparent',
67
- icon: "size-8 border rounded-sm bg-muted [&_svg:not([class*='size-'])]:size-4",
68
- image: 'size-10 rounded-sm overflow-hidden [&_img]:size-full [&_img]:object-cover',
69
- },
70
- },
71
- defaultVariants: {
72
- variant: 'default',
73
- },
74
- },
75
- );
76
-
77
- /** Container for an icon, avatar, or image at the start of an Item. Use variant="icon" for styled icon backgrounds or variant="image" for thumbnails. */
78
- function ItemMedia({
79
- className,
80
- variant = 'default',
81
- ...props
82
- }: React.ComponentProps<'div'> & VariantProps<typeof itemMediaVariants>) {
83
- return (
84
- <div
85
- data-slot="item-media"
86
- data-variant={variant}
87
- className={cn(itemMediaVariants({ variant, className }))}
88
- {...props}
89
- />
90
- );
91
- }
92
-
93
- /** Main content area of an Item, containing title and description. */
94
- function ItemContent({ className, ...props }: React.ComponentProps<'div'>) {
95
- return (
96
- <div
97
- data-slot="item-content"
98
- className={cn('flex flex-1 flex-col gap-1 [&+[data-slot=item-content]]:flex-none', className)}
99
- {...props}
100
- />
101
- );
102
- }
103
-
104
- /** Primary text label for an Item. */
105
- function ItemTitle({ className, ...props }: React.ComponentProps<'div'>) {
106
- return (
107
- <div
108
- data-slot="item-title"
109
- className={cn('flex w-fit items-center gap-2 text-sm leading-snug font-medium', className)}
110
- {...props}
111
- />
112
- );
113
- }
114
-
115
- /** Secondary text below the title, limited to 2 lines. */
116
- function ItemDescription({ className, ...props }: React.ComponentProps<'p'>) {
117
- return (
118
- <p
119
- data-slot="item-description"
120
- className={cn(
121
- 'text-muted-foreground line-clamp-2 text-sm leading-normal font-normal text-balance',
122
- '[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4',
123
- className,
124
- )}
125
- {...props}
126
- />
127
- );
128
- }
129
-
130
- /** Container for action buttons at the end of an Item. */
131
- function ItemActions({ className, ...props }: React.ComponentProps<'div'>) {
132
- return <div data-slot="item-actions" className={cn('flex items-center gap-2', className)} {...props} />;
133
- }
134
-
135
- /** Full-width header row spanning the top of an Item, with space-between layout. */
136
- function ItemHeader({ className, ...props }: React.ComponentProps<'div'>) {
137
- return (
138
- <div
139
- data-slot="item-header"
140
- className={cn('flex basis-full items-center justify-between gap-2', className)}
141
- {...props}
142
- />
143
- );
144
- }
145
-
146
- /** Full-width footer row spanning the bottom of an Item, with space-between layout. */
147
- function ItemFooter({ className, ...props }: React.ComponentProps<'div'>) {
148
- return (
149
- <div
150
- data-slot="item-footer"
151
- className={cn('flex basis-full items-center justify-between gap-2', className)}
152
- {...props}
153
- />
154
- );
155
- }
156
-
157
- export {
158
- Item,
159
- ItemMedia,
160
- ItemContent,
161
- ItemActions,
162
- ItemGroup,
163
- ItemSeparator,
164
- ItemTitle,
165
- ItemDescription,
166
- ItemHeader,
167
- ItemFooter,
168
- };
@@ -1,59 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react-vite';
2
- import { Kbd } from './Kbd';
3
-
4
- const meta: Meta<typeof Kbd> = {
5
- title: 'UI Components/Kbd',
6
- component: Kbd,
7
- parameters: {
8
- layout: 'centered',
9
- },
10
- tags: ['autodocs'],
11
- };
12
-
13
- export default meta;
14
- type Story = StoryObj<typeof meta>;
15
-
16
- /** Shows a single keyboard key shortcut. */
17
- export const Default: Story = {
18
- args: {
19
- children: '⌘K',
20
- },
21
- };
22
-
23
- /** Shows a key with a text label like "Ctrl". */
24
- export const WithText: Story = {
25
- args: {
26
- children: 'Ctrl',
27
- },
28
- };
29
-
30
- /** Shows a key with an arrow symbol. */
31
- export const ArrowKeys: Story = {
32
- args: {
33
- children: '→',
34
- },
35
- };
36
-
37
- /** Shows two keys composed together to represent a shortcut combination. */
38
- export const Multiple: Story = {
39
- render: () => (
40
- <div className="flex gap-2 items-center">
41
- <Kbd>⌘</Kbd>
42
- <span>+</span>
43
- <Kbd>K</Kbd>
44
- </div>
45
- ),
46
- };
47
-
48
- /** Shows a three-key combination shortcut. */
49
- export const Combination: Story = {
50
- render: () => (
51
- <div className="flex gap-2 items-center">
52
- <Kbd>Ctrl</Kbd>
53
- <span>+</span>
54
- <Kbd>Shift</Kbd>
55
- <span>+</span>
56
- <Kbd>P</Kbd>
57
- </div>
58
- ),
59
- };
@@ -1,22 +0,0 @@
1
- import React from 'react';
2
- import { cn } from '@/lib/utils';
3
-
4
- interface KbdProps {
5
- children: React.ReactNode;
6
- className?: string;
7
- }
8
-
9
- /**
10
- * Renders inline keyboard key indicators, styled to look like physical keys.
11
- * Use to display keyboard shortcuts or key combinations in documentation and UI hints.
12
- */
13
- export function Kbd({ children, className }: KbdProps) {
14
- return (
15
- <kbd
16
- data-slot="kbd"
17
- className={cn('border border-border rounded bg-muted px-1.5 py-0.5 text-xs font-medium', className)}
18
- >
19
- {children}
20
- </kbd>
21
- );
22
- }
@@ -1,90 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react-vite';
2
- import { Label } from './Label';
3
-
4
- const meta: Meta<typeof Label> = {
5
- title: 'UI Components/Label',
6
- component: Label,
7
- parameters: {
8
- layout: 'centered',
9
- },
10
- tags: ['autodocs'],
11
- argTypes: {
12
- variant: {
13
- control: { type: 'radio' },
14
- options: ['default', 'required'],
15
- },
16
- required: {
17
- control: { type: 'boolean' },
18
- },
19
- htmlFor: {
20
- control: { type: 'text' },
21
- },
22
- children: {
23
- control: { type: 'text' },
24
- },
25
- },
26
- };
27
-
28
- export default meta;
29
- type Story = StoryObj<typeof meta>;
30
-
31
- /** Shows a basic label associated with a form field. */
32
- export const Default: Story = {
33
- args: {
34
- children: 'Email address',
35
- htmlFor: 'email',
36
- },
37
- };
38
-
39
- /** Shows the label with the required prop, which appends a red asterisk. */
40
- export const Required: Story = {
41
- args: {
42
- children: 'Email address',
43
- htmlFor: 'email',
44
- required: true,
45
- },
46
- };
47
-
48
- /** Shows the label using the "required" variant prop directly. */
49
- export const RequiredVariant: Story = {
50
- args: {
51
- children: 'Email address',
52
- htmlFor: 'email',
53
- variant: 'required',
54
- },
55
- };
56
-
57
- /** Shows the label paired with a text input in a form layout. */
58
- export const WithForm: Story = {
59
- render: (args) => (
60
- <div className="space-y-2">
61
- <Label htmlFor="example-input" required>
62
- Example Field
63
- </Label>
64
- <input
65
- id="example-input"
66
- type="text"
67
- className="flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50"
68
- placeholder="Enter value..."
69
- />
70
- </div>
71
- ),
72
- };
73
-
74
- /** Demonstrates the dimmed appearance when the associated input is disabled. */
75
- export const DisabledField: Story = {
76
- render: (args) => (
77
- <div className="space-y-2">
78
- <Label htmlFor="disabled-input" required>
79
- Disabled Field
80
- </Label>
81
- <input
82
- id="disabled-input"
83
- type="text"
84
- disabled
85
- className="flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50"
86
- placeholder="Disabled input..."
87
- />
88
- </div>
89
- ),
90
- };
@@ -1,44 +0,0 @@
1
- import * as React from 'react';
2
- import { cva, type VariantProps } from 'class-variance-authority';
3
- import { cn } from '@/lib/utils';
4
-
5
- const labelVariants = cva(
6
- 'text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70',
7
- {
8
- variants: {
9
- variant: {
10
- default: 'text-foreground',
11
- required: "text-foreground after:content-['*'] after:ml-1 after:text-destructive",
12
- },
13
- },
14
- defaultVariants: {
15
- variant: 'default',
16
- },
17
- },
18
- );
19
-
20
- export interface LabelProps extends React.LabelHTMLAttributes<HTMLLabelElement>, VariantProps<typeof labelVariants> {
21
- htmlFor?: string;
22
- required?: boolean;
23
- children?: React.ReactNode;
24
- }
25
-
26
- /**
27
- * An accessible label associated with a form control via the htmlFor prop.
28
- * Supports a "required" variant that appends a red asterisk, and automatically dims when its peer input is disabled.
29
- */
30
- const Label = React.forwardRef<HTMLLabelElement, LabelProps>(({ className, variant, required, ...props }, ref) => {
31
- const effectiveVariant = required ? 'required' : variant || 'default';
32
-
33
- return (
34
- <label
35
- ref={ref}
36
- data-slot="label"
37
- className={cn(labelVariants({ variant: effectiveVariant }), className)}
38
- {...props}
39
- />
40
- );
41
- });
42
- Label.displayName = 'Label';
43
-
44
- export { Label, labelVariants };
@@ -1,78 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react-vite';
2
- import {
3
- Menubar,
4
- MenubarMenu,
5
- MenubarTrigger,
6
- MenubarContent,
7
- MenubarItem,
8
- MenubarSeparator,
9
- MenubarLabel,
10
- MenubarShortcut,
11
- } from '@/components/ui/Menubar';
12
-
13
- const meta: Meta<typeof Menubar> = {
14
- title: 'UI Components/Menubar',
15
- component: Menubar,
16
- };
17
- export default meta;
18
- type Story = StoryObj<typeof Menubar>;
19
-
20
- /** Shows a menubar with File and Edit menus containing items and keyboard shortcuts. */
21
- export const Default: Story = {
22
- render: () => (
23
- <Menubar>
24
- <MenubarMenu>
25
- <MenubarTrigger>File</MenubarTrigger>
26
- <MenubarContent>
27
- <MenubarItem>
28
- New Tab <MenubarShortcut>Ctrl+T</MenubarShortcut>
29
- </MenubarItem>
30
- <MenubarItem>
31
- New Window <MenubarShortcut>Ctrl+N</MenubarShortcut>
32
- </MenubarItem>
33
- <MenubarSeparator />
34
- <MenubarItem>
35
- Save <MenubarShortcut>Ctrl+S</MenubarShortcut>
36
- </MenubarItem>
37
- <MenubarSeparator />
38
- <MenubarItem>Exit</MenubarItem>
39
- </MenubarContent>
40
- </MenubarMenu>
41
- <MenubarMenu>
42
- <MenubarTrigger>Edit</MenubarTrigger>
43
- <MenubarContent>
44
- <MenubarItem>
45
- Undo <MenubarShortcut>Ctrl+Z</MenubarShortcut>
46
- </MenubarItem>
47
- <MenubarItem>
48
- Redo <MenubarShortcut>Ctrl+Y</MenubarShortcut>
49
- </MenubarItem>
50
- <MenubarSeparator />
51
- <MenubarItem>Cut</MenubarItem>
52
- <MenubarItem>Copy</MenubarItem>
53
- <MenubarItem>Paste</MenubarItem>
54
- </MenubarContent>
55
- </MenubarMenu>
56
- </Menubar>
57
- ),
58
- };
59
-
60
- /** Demonstrates menu sections organized with labels to group related items. */
61
- export const WithLabels: Story = {
62
- render: () => (
63
- <Menubar>
64
- <MenubarMenu>
65
- <MenubarTrigger>View</MenubarTrigger>
66
- <MenubarContent>
67
- <MenubarLabel>Appearance</MenubarLabel>
68
- <MenubarItem>Zoom In</MenubarItem>
69
- <MenubarItem>Zoom Out</MenubarItem>
70
- <MenubarSeparator />
71
- <MenubarLabel>Layout</MenubarLabel>
72
- <MenubarItem>Full Screen</MenubarItem>
73
- <MenubarItem>Side by Side</MenubarItem>
74
- </MenubarContent>
75
- </MenubarMenu>
76
- </Menubar>
77
- ),
78
- };