@foundrykit/primitives 2.0.9 → 2.1.1

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 (146) hide show
  1. package/dist/{chunk-HS46TIMU.js → chunk-2UG6OCGA.js} +1 -1
  2. package/dist/chunk-3NQR7JZR.js +128 -0
  3. package/dist/{chunk-XCPGTXEJ.js → chunk-5RFGKG4K.js} +1 -1
  4. package/dist/chunk-B5YCE3UP.js +57 -0
  5. package/dist/chunk-F2TEA6ER.js +138 -0
  6. package/dist/{chunk-46UI3AUE.js → chunk-SEDTBIZW.js} +3 -3
  7. package/dist/chunk-SIQHWNPH.js +45 -0
  8. package/dist/chunk-STRBREHN.js +17 -0
  9. package/dist/components/button/index.cjs +3 -3
  10. package/dist/components/button/index.js +1 -1
  11. package/dist/components/card/index.cjs +1 -1
  12. package/dist/components/card/index.js +1 -1
  13. package/dist/components/dialog/index.cjs +182 -0
  14. package/dist/components/dialog/index.d.cts +38 -0
  15. package/dist/components/dialog/index.d.ts +38 -0
  16. package/dist/components/dialog/index.js +25 -0
  17. package/dist/components/input/index.cjs +1 -1
  18. package/dist/components/input/index.js +1 -1
  19. package/dist/components/input-group/index.cjs +270 -0
  20. package/dist/components/input-group/index.d.cts +44 -0
  21. package/dist/components/input-group/index.d.ts +44 -0
  22. package/dist/components/input-group/index.js +153 -0
  23. package/dist/components/section/index.cjs +41 -0
  24. package/dist/components/section/index.d.cts +27 -0
  25. package/dist/components/section/index.d.ts +27 -0
  26. package/dist/components/section/index.js +6 -0
  27. package/dist/components/sheet/index.cjs +170 -0
  28. package/dist/components/sheet/index.d.cts +31 -0
  29. package/dist/components/sheet/index.d.ts +31 -0
  30. package/dist/components/sheet/index.js +21 -0
  31. package/dist/components/toggle/index.cjs +81 -0
  32. package/dist/components/toggle/index.d.cts +26 -0
  33. package/dist/components/toggle/index.d.ts +26 -0
  34. package/dist/components/toggle/index.js +9 -0
  35. package/dist/components/tooltip/index.cjs +95 -0
  36. package/dist/components/tooltip/index.d.cts +25 -0
  37. package/dist/components/tooltip/index.d.ts +25 -0
  38. package/dist/components/tooltip/index.js +13 -0
  39. package/dist/index.cjs +112 -96
  40. package/dist/index.d.cts +12 -105
  41. package/dist/index.d.ts +12 -105
  42. package/dist/index.js +104 -406
  43. package/package.json +206 -10
  44. package/CHANGELOG.md +0 -230
  45. package/postcss.config.mjs +0 -6
  46. package/registry.json +0 -64
  47. package/src/components/accordion/config.ts +0 -28
  48. package/src/components/accordion/index.tsx +0 -80
  49. package/src/components/alert/config.ts +0 -40
  50. package/src/components/alert/index.tsx +0 -80
  51. package/src/components/alert-dialog/config.ts +0 -28
  52. package/src/components/alert-dialog/index.tsx +0 -188
  53. package/src/components/aspect-ratio/config.ts +0 -27
  54. package/src/components/aspect-ratio/index.tsx +0 -24
  55. package/src/components/avatar/config.ts +0 -46
  56. package/src/components/avatar/index.tsx +0 -67
  57. package/src/components/badge/config.ts +0 -56
  58. package/src/components/badge/index.tsx +0 -56
  59. package/src/components/breadcrumb/config.ts +0 -121
  60. package/src/components/breadcrumb/index.tsx +0 -127
  61. package/src/components/button/config.ts +0 -97
  62. package/src/components/button/index.tsx +0 -86
  63. package/src/components/button-group/config.ts +0 -39
  64. package/src/components/button-group/index.tsx +0 -99
  65. package/src/components/card/config.ts +0 -89
  66. package/src/components/card/index.tsx +0 -90
  67. package/src/components/checkbox/config.ts +0 -46
  68. package/src/components/checkbox/index.tsx +0 -41
  69. package/src/components/collapsible/config.ts +0 -27
  70. package/src/components/collapsible/index.tsx +0 -47
  71. package/src/components/context-menu/config.ts +0 -28
  72. package/src/components/context-menu/index.tsx +0 -271
  73. package/src/components/dialog/config.ts +0 -582
  74. package/src/components/dialog/index.tsx +0 -162
  75. package/src/components/direction/config.ts +0 -28
  76. package/src/components/direction/index.tsx +0 -27
  77. package/src/components/drawer/config.ts +0 -28
  78. package/src/components/drawer/index.tsx +0 -153
  79. package/src/components/dropdown/config.ts +0 -262
  80. package/src/components/dropdown/index.tsx +0 -280
  81. package/src/components/empty/config.ts +0 -38
  82. package/src/components/empty/index.tsx +0 -127
  83. package/src/components/field/config.ts +0 -40
  84. package/src/components/field/index.tsx +0 -252
  85. package/src/components/hover-card/config.ts +0 -27
  86. package/src/components/hover-card/index.tsx +0 -56
  87. package/src/components/input/config.ts +0 -64
  88. package/src/components/input/index.tsx +0 -32
  89. package/src/components/input-group/config.ts +0 -209
  90. package/src/components/input-group/index.tsx +0 -177
  91. package/src/components/item/config.ts +0 -52
  92. package/src/components/item/index.tsx +0 -215
  93. package/src/components/kbd/config.ts +0 -38
  94. package/src/components/kbd/index.tsx +0 -40
  95. package/src/components/label/config.ts +0 -72
  96. package/src/components/label/index.tsx +0 -32
  97. package/src/components/menubar/config.ts +0 -28
  98. package/src/components/menubar/index.tsx +0 -295
  99. package/src/components/native-select/config.ts +0 -40
  100. package/src/components/native-select/index.tsx +0 -40
  101. package/src/components/navigation-menu/config.ts +0 -32
  102. package/src/components/navigation-menu/index.tsx +0 -188
  103. package/src/components/popover/config.ts +0 -222
  104. package/src/components/popover/index.tsx +0 -60
  105. package/src/components/progress/config.ts +0 -42
  106. package/src/components/progress/index.tsx +0 -39
  107. package/src/components/radio-group/config.ts +0 -303
  108. package/src/components/radio-group/index.tsx +0 -58
  109. package/src/components/resizable/config.ts +0 -28
  110. package/src/components/resizable/index.tsx +0 -67
  111. package/src/components/scroll-area/config.ts +0 -17
  112. package/src/components/scroll-area/index.tsx +0 -70
  113. package/src/components/select/config.ts +0 -277
  114. package/src/components/select/index.tsx +0 -202
  115. package/src/components/separator/config.ts +0 -63
  116. package/src/components/separator/index.tsx +0 -38
  117. package/src/components/sheet/config.ts +0 -16
  118. package/src/components/sheet/index.tsx +0 -153
  119. package/src/components/skeleton/config.ts +0 -77
  120. package/src/components/skeleton/index.tsx +0 -22
  121. package/src/components/slider/config.ts +0 -46
  122. package/src/components/slider/index.tsx +0 -76
  123. package/src/components/sonner/config.ts +0 -27
  124. package/src/components/sonner/index.tsx +0 -37
  125. package/src/components/spinner/config.ts +0 -40
  126. package/src/components/spinner/index.tsx +0 -30
  127. package/src/components/switch/config.ts +0 -171
  128. package/src/components/switch/index.tsx +0 -40
  129. package/src/components/table/config.ts +0 -38
  130. package/src/components/table/index.tsx +0 -135
  131. package/src/components/tabs/config.ts +0 -335
  132. package/src/components/tabs/index.tsx +0 -82
  133. package/src/components/textarea/config.ts +0 -117
  134. package/src/components/textarea/index.tsx +0 -26
  135. package/src/components/toggle/config.ts +0 -67
  136. package/src/components/toggle/index.tsx +0 -59
  137. package/src/components/toggle-group/config.ts +0 -46
  138. package/src/components/toggle-group/index.tsx +0 -106
  139. package/src/components/tooltip/config.ts +0 -16
  140. package/src/components/tooltip/index.tsx +0 -75
  141. package/src/components/typography/config.ts +0 -38
  142. package/src/components/typography/index.tsx +0 -172
  143. package/src/index.ts +0 -291
  144. package/tsconfig.json +0 -9
  145. package/tsconfig.lint.json +0 -8
  146. package/tsup.config.ts +0 -55
@@ -1,162 +0,0 @@
1
- 'use client';
2
-
3
- import { cn } from '@foundrykit/utils';
4
- import * as DialogPrimitive from '@radix-ui/react-dialog';
5
- import { XIcon } from 'lucide-react';
6
- import type * as React from 'react';
7
-
8
- /**
9
- * Modal dialog root built on Radix `Dialog.Root`. Compose with
10
- * {@link DialogTrigger}, {@link DialogContent} (which renders the overlay and an
11
- * optional close button), {@link DialogHeader}, {@link DialogTitle},
12
- * {@link DialogDescription} and {@link DialogFooter}.
13
- *
14
- * @example
15
- * ```tsx
16
- * <Dialog>
17
- * <DialogTrigger>Open</DialogTrigger>
18
- * <DialogContent>
19
- * <DialogHeader><DialogTitle>Title</DialogTitle></DialogHeader>
20
- * </DialogContent>
21
- * </Dialog>
22
- * ```
23
- */
24
- function Dialog({
25
- ...props
26
- }: React.ComponentProps<typeof DialogPrimitive.Root>) {
27
- return <DialogPrimitive.Root data-slot='dialog' {...props} />;
28
- }
29
-
30
- function DialogTrigger({
31
- ...props
32
- }: React.ComponentProps<typeof DialogPrimitive.Trigger>) {
33
- return <DialogPrimitive.Trigger data-slot='dialog-trigger' {...props} />;
34
- }
35
-
36
- function DialogPortal({
37
- ...props
38
- }: React.ComponentProps<typeof DialogPrimitive.Portal>) {
39
- return <DialogPrimitive.Portal data-slot='dialog-portal' {...props} />;
40
- }
41
-
42
- function DialogClose({
43
- ...props
44
- }: React.ComponentProps<typeof DialogPrimitive.Close>) {
45
- return <DialogPrimitive.Close data-slot='dialog-close' {...props} />;
46
- }
47
-
48
- function DialogOverlay({
49
- className,
50
- ...props
51
- }: React.ComponentProps<typeof DialogPrimitive.Overlay>) {
52
- return (
53
- <DialogPrimitive.Overlay
54
- data-slot='dialog-overlay'
55
- className={cn(
56
- 'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50',
57
- className
58
- )}
59
- {...props}
60
- />
61
- );
62
- }
63
-
64
- /**
65
- * Centered, animated dialog panel rendered in a portal over a dark overlay.
66
- * Set `showCloseButton={false}` to hide the built-in top-right close button.
67
- */
68
- function DialogContent({
69
- className,
70
- children,
71
- showCloseButton = true,
72
- ...props
73
- }: React.ComponentProps<typeof DialogPrimitive.Content> & {
74
- showCloseButton?: boolean;
75
- }) {
76
- return (
77
- <DialogPortal data-slot='dialog-portal'>
78
- <DialogOverlay />
79
- <DialogPrimitive.Content
80
- data-slot='dialog-content'
81
- className={cn(
82
- 'bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg',
83
- className
84
- )}
85
- {...props}
86
- >
87
- {children}
88
- {showCloseButton && (
89
- <DialogPrimitive.Close
90
- data-slot='dialog-close'
91
- className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
92
- >
93
- <XIcon />
94
- <span className='sr-only'>Close</span>
95
- </DialogPrimitive.Close>
96
- )}
97
- </DialogPrimitive.Content>
98
- </DialogPortal>
99
- );
100
- }
101
-
102
- function DialogHeader({ className, ...props }: React.ComponentProps<'div'>) {
103
- return (
104
- <div
105
- data-slot='dialog-header'
106
- className={cn('flex flex-col gap-2 text-center sm:text-left', className)}
107
- {...props}
108
- />
109
- );
110
- }
111
-
112
- function DialogFooter({ className, ...props }: React.ComponentProps<'div'>) {
113
- return (
114
- <div
115
- data-slot='dialog-footer'
116
- className={cn(
117
- 'flex flex-col-reverse gap-2 sm:flex-row sm:justify-end',
118
- className
119
- )}
120
- {...props}
121
- />
122
- );
123
- }
124
-
125
- function DialogTitle({
126
- className,
127
- ...props
128
- }: React.ComponentProps<typeof DialogPrimitive.Title>) {
129
- return (
130
- <DialogPrimitive.Title
131
- data-slot='dialog-title'
132
- className={cn('text-lg leading-none font-semibold', className)}
133
- {...props}
134
- />
135
- );
136
- }
137
-
138
- function DialogDescription({
139
- className,
140
- ...props
141
- }: React.ComponentProps<typeof DialogPrimitive.Description>) {
142
- return (
143
- <DialogPrimitive.Description
144
- data-slot='dialog-description'
145
- className={cn('text-muted-foreground text-sm', className)}
146
- {...props}
147
- />
148
- );
149
- }
150
-
151
- export {
152
- Dialog,
153
- DialogClose,
154
- DialogContent,
155
- DialogDescription,
156
- DialogFooter,
157
- DialogHeader,
158
- DialogOverlay,
159
- DialogPortal,
160
- DialogTitle,
161
- DialogTrigger,
162
- };
@@ -1,28 +0,0 @@
1
- import type { ComponentConfig } from '@foundrykit/types';
2
-
3
- export const DirectionConfig: ComponentConfig = {
4
- name: 'Direction',
5
- description:
6
- 'Provides reading direction context (LTR/RTL) to descendant components.',
7
- category: 'primitives',
8
- tags: ['direction', 'rtl', 'ltr', 'provider', 'i18n'],
9
- preview: {
10
- type: 'static',
11
- html: '<div class="flex h-12 w-full items-center justify-end rounded-md border border-gray-300 bg-gray-100 px-3"><span class="text-sm text-gray-600">rtl</span></div>',
12
- },
13
- variants: [
14
- {
15
- name: 'Default',
16
- description: 'Default direction provider',
17
- code: '<DirectionProvider dir="rtl"><App /></DirectionProvider>',
18
- preview: {
19
- type: 'component',
20
- component: 'DirectionProvider',
21
- props: {},
22
- },
23
- },
24
- ],
25
- dependencies: ['utils'],
26
- packageDependencies: ['@radix-ui/react-direction'],
27
- files: ['components/primitives/direction/index.tsx'],
28
- };
@@ -1,27 +0,0 @@
1
- 'use client';
2
-
3
- import {
4
- DirectionProvider as DirectionProviderPrimitive,
5
- useDirection,
6
- } from '@radix-ui/react-direction';
7
- import type * as React from 'react';
8
-
9
- /**
10
- * Provides reading direction (`ltr`/`rtl`) to all descendant Radix
11
- * primitives via context. Wrap your app (or a subtree) to control layout
12
- * direction; read the current value with the re-exported {@link useDirection}.
13
- *
14
- * @example
15
- * ```tsx
16
- * <DirectionProvider dir="rtl">
17
- * <App />
18
- * </DirectionProvider>
19
- * ```
20
- */
21
- function DirectionProvider({
22
- ...props
23
- }: React.ComponentProps<typeof DirectionProviderPrimitive>) {
24
- return <DirectionProviderPrimitive {...props} />;
25
- }
26
-
27
- export { DirectionProvider, useDirection };
@@ -1,28 +0,0 @@
1
- import type { ComponentConfig } from '@foundrykit/types';
2
-
3
- export const DrawerConfig: ComponentConfig = {
4
- name: 'Drawer',
5
- description:
6
- 'A touch-friendly panel that slides in from the edge of the screen.',
7
- category: 'primitives',
8
- tags: ['drawer', 'dialog', 'overlay', 'sheet'],
9
- preview: {
10
- type: 'static',
11
- html: '<div class="flex h-24 w-full flex-col justify-end rounded-md border border-gray-300 bg-gray-50"><div class="mx-auto mb-2 h-1.5 w-12 rounded-full bg-gray-400"></div><div class="h-12 rounded-t-md bg-white p-3"><div class="h-2 w-24 rounded bg-gray-300"></div></div></div>',
12
- },
13
- variants: [
14
- {
15
- name: 'Default',
16
- description: 'Default drawer',
17
- code: '<Drawer><DrawerTrigger>Open</DrawerTrigger><DrawerContent>...</DrawerContent></Drawer>',
18
- preview: {
19
- type: 'component',
20
- component: 'Drawer',
21
- props: {},
22
- },
23
- },
24
- ],
25
- dependencies: ['utils'],
26
- packageDependencies: ['vaul'],
27
- files: ['components/primitives/drawer/index.tsx'],
28
- };
@@ -1,153 +0,0 @@
1
- 'use client';
2
-
3
- import { cn } from '@foundrykit/utils';
4
- import type * as React from 'react';
5
- import { Drawer as DrawerPrimitive } from 'vaul';
6
-
7
- /**
8
- * Drawer built on `vaul` for touch-friendly, swipe-dismissable panels that
9
- * slide in from any edge. Compose with {@link DrawerTrigger},
10
- * {@link DrawerContent}, {@link DrawerHeader}, {@link DrawerTitle},
11
- * {@link DrawerDescription} and {@link DrawerFooter}.
12
- *
13
- * @example
14
- * ```tsx
15
- * <Drawer>
16
- * <DrawerTrigger>Open</DrawerTrigger>
17
- * <DrawerContent>
18
- * <DrawerHeader>
19
- * <DrawerTitle>Are you sure?</DrawerTitle>
20
- * <DrawerDescription>This cannot be undone.</DrawerDescription>
21
- * </DrawerHeader>
22
- * </DrawerContent>
23
- * </Drawer>
24
- * ```
25
- */
26
- function Drawer({
27
- ...props
28
- }: React.ComponentProps<typeof DrawerPrimitive.Root>) {
29
- return <DrawerPrimitive.Root data-slot='drawer' {...props} />;
30
- }
31
-
32
- function DrawerTrigger({
33
- ...props
34
- }: React.ComponentProps<typeof DrawerPrimitive.Trigger>) {
35
- return <DrawerPrimitive.Trigger data-slot='drawer-trigger' {...props} />;
36
- }
37
-
38
- function DrawerPortal({
39
- ...props
40
- }: React.ComponentProps<typeof DrawerPrimitive.Portal>) {
41
- return <DrawerPrimitive.Portal data-slot='drawer-portal' {...props} />;
42
- }
43
-
44
- function DrawerClose({
45
- ...props
46
- }: React.ComponentProps<typeof DrawerPrimitive.Close>) {
47
- return <DrawerPrimitive.Close data-slot='drawer-close' {...props} />;
48
- }
49
-
50
- function DrawerOverlay({
51
- className,
52
- ...props
53
- }: React.ComponentProps<typeof DrawerPrimitive.Overlay>) {
54
- return (
55
- <DrawerPrimitive.Overlay
56
- data-slot='drawer-overlay'
57
- className={cn(
58
- 'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50',
59
- className
60
- )}
61
- {...props}
62
- />
63
- );
64
- }
65
-
66
- function DrawerContent({
67
- className,
68
- children,
69
- ...props
70
- }: React.ComponentProps<typeof DrawerPrimitive.Content>) {
71
- return (
72
- <DrawerPortal>
73
- <DrawerOverlay />
74
- <DrawerPrimitive.Content
75
- data-slot='drawer-content'
76
- className={cn(
77
- 'group/drawer-content bg-background fixed z-50 flex h-auto flex-col',
78
- 'data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b',
79
- 'data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg data-[vaul-drawer-direction=bottom]:border-t',
80
- 'data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm',
81
- 'data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm',
82
- className
83
- )}
84
- {...props}
85
- >
86
- <div className='bg-muted mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block' />
87
- {children}
88
- </DrawerPrimitive.Content>
89
- </DrawerPortal>
90
- );
91
- }
92
-
93
- function DrawerHeader({ className, ...props }: React.ComponentProps<'div'>) {
94
- return (
95
- <div
96
- data-slot='drawer-header'
97
- className={cn(
98
- 'flex flex-col gap-0.5 p-4 group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center group-data-[vaul-drawer-direction=top]/drawer-content:text-center md:gap-1.5 md:text-left',
99
- className
100
- )}
101
- {...props}
102
- />
103
- );
104
- }
105
-
106
- function DrawerFooter({ className, ...props }: React.ComponentProps<'div'>) {
107
- return (
108
- <div
109
- data-slot='drawer-footer'
110
- className={cn('mt-auto flex flex-col gap-2 p-4', className)}
111
- {...props}
112
- />
113
- );
114
- }
115
-
116
- function DrawerTitle({
117
- className,
118
- ...props
119
- }: React.ComponentProps<typeof DrawerPrimitive.Title>) {
120
- return (
121
- <DrawerPrimitive.Title
122
- data-slot='drawer-title'
123
- className={cn('text-foreground font-semibold', className)}
124
- {...props}
125
- />
126
- );
127
- }
128
-
129
- function DrawerDescription({
130
- className,
131
- ...props
132
- }: React.ComponentProps<typeof DrawerPrimitive.Description>) {
133
- return (
134
- <DrawerPrimitive.Description
135
- data-slot='drawer-description'
136
- className={cn('text-muted-foreground text-sm', className)}
137
- {...props}
138
- />
139
- );
140
- }
141
-
142
- export {
143
- Drawer,
144
- DrawerClose,
145
- DrawerContent,
146
- DrawerDescription,
147
- DrawerFooter,
148
- DrawerHeader,
149
- DrawerOverlay,
150
- DrawerPortal,
151
- DrawerTitle,
152
- DrawerTrigger,
153
- };
@@ -1,262 +0,0 @@
1
- import type { ComponentConfig } from '@foundrykit/types';
2
-
3
- export const dropdownConfig: ComponentConfig = {
4
- name: 'Dropdown Menu',
5
- description:
6
- 'Accessible dropdown menu component with multiple subcomponents for building complex menus',
7
- category: 'primitives',
8
- tags: ['navigation', 'interactive', 'menu'],
9
- preview: {
10
- type: 'static',
11
- html: '<div class="flex h-12 w-full items-center justify-center rounded-md bg-gray-200"><div class="relative"><button class="px-3 py-1.5 bg-white border border-gray-300 rounded text-sm">Menu ▼</button><div class="absolute top-full mt-1 w-32 bg-white border border-gray-300 rounded shadow-lg"><div class="px-2 py-1.5 text-sm">Item 1</div><div class="px-2 py-1.5 text-sm">Item 2</div></div></div></div>',
12
- },
13
- variants: [
14
- {
15
- name: 'Basic Menu',
16
- description: 'Simple dropdown menu with basic items',
17
- code: `<DropdownMenu>
18
- <DropdownMenuTrigger>Open Menu</DropdownMenuTrigger>
19
- <DropdownMenuContent>
20
- <DropdownMenuItem>Item 1</DropdownMenuItem>
21
- <DropdownMenuItem>Item 2</DropdownMenuItem>
22
- <DropdownMenuItem>Item 3</DropdownMenuItem>
23
- </DropdownMenuContent>
24
- </DropdownMenu>`,
25
- preview: {
26
- type: 'component',
27
- component: 'DropdownMenu',
28
- props: {
29
- defaultOpen: false,
30
- children: [
31
- {
32
- component: 'DropdownMenuTrigger',
33
- props: { children: 'Open Menu' },
34
- },
35
- {
36
- component: 'DropdownMenuContent',
37
- props: {
38
- children: [
39
- {
40
- component: 'DropdownMenuItem',
41
- props: { children: 'Item 1' },
42
- },
43
- {
44
- component: 'DropdownMenuItem',
45
- props: { children: 'Item 2' },
46
- },
47
- {
48
- component: 'DropdownMenuItem',
49
- props: { children: 'Item 3' },
50
- },
51
- ],
52
- },
53
- },
54
- ],
55
- },
56
- },
57
- },
58
- {
59
- name: 'With Separator',
60
- description: 'Dropdown menu with separator between items',
61
- code: `<DropdownMenu>
62
- <DropdownMenuTrigger>Open Menu</DropdownMenuTrigger>
63
- <DropdownMenuContent>
64
- <DropdownMenuItem>Item 1</DropdownMenuItem>
65
- <DropdownMenuItem>Item 2</DropdownMenuItem>
66
- <DropdownMenuSeparator />
67
- <DropdownMenuItem>Item 3</DropdownMenuItem>
68
- </DropdownMenuContent>
69
- </DropdownMenu>`,
70
- preview: {
71
- type: 'component',
72
- component: 'DropdownMenu',
73
- props: {
74
- defaultOpen: false,
75
- children: [
76
- {
77
- component: 'DropdownMenuTrigger',
78
- props: { children: 'Open Menu' },
79
- },
80
- {
81
- component: 'DropdownMenuContent',
82
- props: {
83
- children: [
84
- {
85
- component: 'DropdownMenuItem',
86
- props: { children: 'Item 1' },
87
- },
88
- {
89
- component: 'DropdownMenuItem',
90
- props: { children: 'Item 2' },
91
- },
92
- { component: 'DropdownMenuSeparator', props: {} },
93
- {
94
- component: 'DropdownMenuItem',
95
- props: { children: 'Item 3' },
96
- },
97
- ],
98
- },
99
- },
100
- ],
101
- },
102
- },
103
- },
104
- {
105
- name: 'With Checkbox Items',
106
- description: 'Dropdown menu with checkbox items for multiple selection',
107
- code: `<DropdownMenu>
108
- <DropdownMenuTrigger>Options</DropdownMenuTrigger>
109
- <DropdownMenuContent>
110
- <DropdownMenuCheckboxItem checked>Option 1</DropdownMenuCheckboxItem>
111
- <DropdownMenuCheckboxItem>Option 2</DropdownMenuCheckboxItem>
112
- <DropdownMenuCheckboxItem>Option 3</DropdownMenuCheckboxItem>
113
- </DropdownMenuContent>
114
- </DropdownMenu>`,
115
- preview: {
116
- type: 'component',
117
- component: 'DropdownMenu',
118
- props: {
119
- defaultOpen: false,
120
- children: [
121
- {
122
- component: 'DropdownMenuTrigger',
123
- props: { children: 'Options' },
124
- },
125
- {
126
- component: 'DropdownMenuContent',
127
- props: {
128
- children: [
129
- {
130
- component: 'DropdownMenuCheckboxItem',
131
- props: { checked: true, children: 'Option 1' },
132
- },
133
- {
134
- component: 'DropdownMenuCheckboxItem',
135
- props: { children: 'Option 2' },
136
- },
137
- {
138
- component: 'DropdownMenuCheckboxItem',
139
- props: { children: 'Option 3' },
140
- },
141
- ],
142
- },
143
- },
144
- ],
145
- },
146
- },
147
- },
148
- {
149
- name: 'With Destructive Item',
150
- description: 'Dropdown menu with destructive action item',
151
- code: `<DropdownMenu>
152
- <DropdownMenuTrigger>Actions</DropdownMenuTrigger>
153
- <DropdownMenuContent>
154
- <DropdownMenuItem>Edit</DropdownMenuItem>
155
- <DropdownMenuItem>Copy</DropdownMenuItem>
156
- <DropdownMenuItem variant="destructive">Delete</DropdownMenuItem>
157
- </DropdownMenuContent>
158
- </DropdownMenu>`,
159
- preview: {
160
- type: 'component',
161
- component: 'DropdownMenu',
162
- props: {
163
- defaultOpen: false,
164
- children: [
165
- {
166
- component: 'DropdownMenuTrigger',
167
- props: { children: 'Actions' },
168
- },
169
- {
170
- component: 'DropdownMenuContent',
171
- props: {
172
- children: [
173
- {
174
- component: 'DropdownMenuItem',
175
- props: { children: 'Edit' },
176
- },
177
- {
178
- component: 'DropdownMenuItem',
179
- props: { children: 'Copy' },
180
- },
181
- {
182
- component: 'DropdownMenuItem',
183
- props: { variant: 'destructive', children: 'Delete' },
184
- },
185
- ],
186
- },
187
- },
188
- ],
189
- },
190
- },
191
- },
192
- {
193
- name: 'With Submenu',
194
- description: 'Dropdown menu with nested submenu',
195
- code: `<DropdownMenu>
196
- <DropdownMenuTrigger>More Options</DropdownMenuTrigger>
197
- <DropdownMenuContent>
198
- <DropdownMenuItem>Item 1</DropdownMenuItem>
199
- <DropdownMenuSub>
200
- <DropdownMenuSubTrigger>More</DropdownMenuSubTrigger>
201
- <DropdownMenuSubContent>
202
- <DropdownMenuItem>Sub Item 1</DropdownMenuItem>
203
- <DropdownMenuItem>Sub Item 2</DropdownMenuItem>
204
- </DropdownMenuSubContent>
205
- </DropdownMenuSub>
206
- </DropdownMenuContent>
207
- </DropdownMenu>`,
208
- preview: {
209
- type: 'component',
210
- component: 'DropdownMenu',
211
- props: {
212
- defaultOpen: false,
213
- children: [
214
- {
215
- component: 'DropdownMenuTrigger',
216
- props: { children: 'More Options' },
217
- },
218
- {
219
- component: 'DropdownMenuContent',
220
- props: {
221
- children: [
222
- {
223
- component: 'DropdownMenuItem',
224
- props: { children: 'Item 1' },
225
- },
226
- {
227
- component: 'DropdownMenuSub',
228
- props: {
229
- children: [
230
- {
231
- component: 'DropdownMenuSubTrigger',
232
- props: { children: 'More' },
233
- },
234
- {
235
- component: 'DropdownMenuSubContent',
236
- props: {
237
- children: [
238
- {
239
- component: 'DropdownMenuItem',
240
- props: { children: 'Sub Item 1' },
241
- },
242
- {
243
- component: 'DropdownMenuItem',
244
- props: { children: 'Sub Item 2' },
245
- },
246
- ],
247
- },
248
- },
249
- ],
250
- },
251
- },
252
- ],
253
- },
254
- },
255
- ],
256
- },
257
- },
258
- },
259
- ],
260
- dependencies: ['utils'],
261
- files: ['components/primitives/dropdown/index.tsx'],
262
- };