@foundrykit/primitives 2.0.8 → 2.0.10

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 (175) hide show
  1. package/dist/{chunk-D4X2ZO5T.js → chunk-2SBGU5XA.js} +2 -2
  2. package/dist/chunk-3NQR7JZR.js +128 -0
  3. package/dist/{chunk-3MEIDBWZ.js → chunk-3QUMCM5K.js} +2 -2
  4. package/dist/chunk-B5YCE3UP.js +57 -0
  5. package/dist/chunk-F2TEA6ER.js +138 -0
  6. package/dist/{chunk-5OSYIETI.js → chunk-FRIOQFPE.js} +1 -1
  7. package/dist/{chunk-EDKSYP4L.js → chunk-G2YBCHWR.js} +1 -1
  8. package/dist/{chunk-DKBMAFIR.js → chunk-GKCBSG2W.js} +2 -0
  9. package/dist/chunk-HS46TIMU.js +75 -0
  10. package/dist/{chunk-R3IEOV2B.js → chunk-P5KEJOBH.js} +1 -1
  11. package/dist/{chunk-FIRYLO5W.js → chunk-SDYKJVXX.js} +2 -2
  12. package/dist/chunk-SIQHWNPH.js +45 -0
  13. package/dist/{chunk-2PXD7LAX.js → chunk-U7JIOR7A.js} +3 -3
  14. package/dist/{chunk-VA4MKQN7.js → chunk-W4XY3SNY.js} +1 -1
  15. package/dist/chunk-XCPGTXEJ.js +23 -0
  16. package/dist/components/alert-dialog/index.cjs +1 -1
  17. package/dist/components/alert-dialog/index.js +1 -1
  18. package/dist/components/card/index.cjs +63 -61
  19. package/dist/components/card/index.d.cts +8 -7
  20. package/dist/components/card/index.d.ts +8 -7
  21. package/dist/components/card/index.js +1 -1
  22. package/dist/components/context-menu/index.cjs +2 -2
  23. package/dist/components/context-menu/index.js +1 -1
  24. package/dist/components/dialog/index.cjs +182 -0
  25. package/dist/components/dialog/index.d.cts +38 -0
  26. package/dist/components/dialog/index.d.ts +38 -0
  27. package/dist/components/dialog/index.js +25 -0
  28. package/dist/components/dropdown/index.cjs +2 -2
  29. package/dist/components/dropdown/index.js +1 -1
  30. package/dist/components/hover-card/index.cjs +1 -1
  31. package/dist/components/hover-card/index.js +1 -1
  32. package/dist/components/input/index.cjs +16 -28
  33. package/dist/components/input/index.d.cts +6 -5
  34. package/dist/components/input/index.d.ts +6 -5
  35. package/dist/components/input/index.js +1 -1
  36. package/dist/components/input-group/index.cjs +270 -0
  37. package/dist/components/input-group/index.d.cts +44 -0
  38. package/dist/components/input-group/index.d.ts +44 -0
  39. package/dist/components/input-group/index.js +153 -0
  40. package/dist/components/menubar/index.cjs +2 -2
  41. package/dist/components/menubar/index.js +1 -1
  42. package/dist/components/navigation-menu/index.cjs +3 -3
  43. package/dist/components/navigation-menu/index.js +1 -1
  44. package/dist/components/popover/index.cjs +1 -1
  45. package/dist/components/popover/index.js +1 -1
  46. package/dist/components/select/index.cjs +1 -1
  47. package/dist/components/select/index.js +1 -1
  48. package/dist/components/sheet/index.cjs +170 -0
  49. package/dist/components/sheet/index.d.cts +31 -0
  50. package/dist/components/sheet/index.d.ts +31 -0
  51. package/dist/components/sheet/index.js +21 -0
  52. package/dist/components/slider/index.cjs +2 -0
  53. package/dist/components/slider/index.d.cts +3 -2
  54. package/dist/components/slider/index.d.ts +3 -2
  55. package/dist/components/slider/index.js +1 -1
  56. package/dist/components/toggle/index.cjs +81 -0
  57. package/dist/components/toggle/index.d.cts +26 -0
  58. package/dist/components/toggle/index.d.ts +26 -0
  59. package/dist/components/toggle/index.js +9 -0
  60. package/dist/components/tooltip/index.cjs +95 -0
  61. package/dist/components/tooltip/index.d.cts +25 -0
  62. package/dist/components/tooltip/index.d.ts +25 -0
  63. package/dist/components/tooltip/index.js +13 -0
  64. package/dist/index.cjs +107 -95
  65. package/dist/index.d.cts +11 -105
  66. package/dist/index.d.ts +11 -105
  67. package/dist/index.js +108 -414
  68. package/package.json +200 -8
  69. package/.turbo/turbo-build.log +0 -235
  70. package/.turbo/turbo-type-check.log +0 -4
  71. package/CHANGELOG.md +0 -224
  72. package/dist/chunk-DFGLEAZI.js +0 -63
  73. package/dist/chunk-RDQF3IQE.js +0 -25
  74. package/postcss.config.mjs +0 -6
  75. package/registry.json +0 -64
  76. package/src/components/accordion/config.ts +0 -28
  77. package/src/components/accordion/index.tsx +0 -80
  78. package/src/components/alert/config.ts +0 -40
  79. package/src/components/alert/index.tsx +0 -80
  80. package/src/components/alert-dialog/config.ts +0 -28
  81. package/src/components/alert-dialog/index.tsx +0 -188
  82. package/src/components/aspect-ratio/config.ts +0 -27
  83. package/src/components/aspect-ratio/index.tsx +0 -24
  84. package/src/components/avatar/config.ts +0 -46
  85. package/src/components/avatar/index.tsx +0 -67
  86. package/src/components/badge/config.ts +0 -56
  87. package/src/components/badge/index.tsx +0 -56
  88. package/src/components/breadcrumb/config.ts +0 -121
  89. package/src/components/breadcrumb/index.tsx +0 -127
  90. package/src/components/button/config.ts +0 -97
  91. package/src/components/button/index.tsx +0 -86
  92. package/src/components/button-group/config.ts +0 -39
  93. package/src/components/button-group/index.tsx +0 -99
  94. package/src/components/card/config.ts +0 -89
  95. package/src/components/card/index.tsx +0 -98
  96. package/src/components/checkbox/config.ts +0 -46
  97. package/src/components/checkbox/index.tsx +0 -41
  98. package/src/components/collapsible/config.ts +0 -27
  99. package/src/components/collapsible/index.tsx +0 -47
  100. package/src/components/context-menu/config.ts +0 -28
  101. package/src/components/context-menu/index.tsx +0 -271
  102. package/src/components/dialog/config.ts +0 -582
  103. package/src/components/dialog/index.tsx +0 -162
  104. package/src/components/direction/config.ts +0 -28
  105. package/src/components/direction/index.tsx +0 -27
  106. package/src/components/drawer/config.ts +0 -28
  107. package/src/components/drawer/index.tsx +0 -153
  108. package/src/components/dropdown/config.ts +0 -262
  109. package/src/components/dropdown/index.tsx +0 -280
  110. package/src/components/empty/config.ts +0 -38
  111. package/src/components/empty/index.tsx +0 -127
  112. package/src/components/field/config.ts +0 -40
  113. package/src/components/field/index.tsx +0 -252
  114. package/src/components/hover-card/config.ts +0 -27
  115. package/src/components/hover-card/index.tsx +0 -56
  116. package/src/components/input/config.ts +0 -64
  117. package/src/components/input/index.tsx +0 -33
  118. package/src/components/input-group/config.ts +0 -209
  119. package/src/components/input-group/index.tsx +0 -177
  120. package/src/components/item/config.ts +0 -52
  121. package/src/components/item/index.tsx +0 -215
  122. package/src/components/kbd/config.ts +0 -38
  123. package/src/components/kbd/index.tsx +0 -40
  124. package/src/components/label/config.ts +0 -72
  125. package/src/components/label/index.tsx +0 -32
  126. package/src/components/menubar/config.ts +0 -28
  127. package/src/components/menubar/index.tsx +0 -295
  128. package/src/components/native-select/config.ts +0 -40
  129. package/src/components/native-select/index.tsx +0 -40
  130. package/src/components/navigation-menu/config.ts +0 -32
  131. package/src/components/navigation-menu/index.tsx +0 -188
  132. package/src/components/popover/config.ts +0 -222
  133. package/src/components/popover/index.tsx +0 -60
  134. package/src/components/progress/config.ts +0 -42
  135. package/src/components/progress/index.tsx +0 -39
  136. package/src/components/radio-group/config.ts +0 -303
  137. package/src/components/radio-group/index.tsx +0 -58
  138. package/src/components/resizable/config.ts +0 -28
  139. package/src/components/resizable/index.tsx +0 -67
  140. package/src/components/scroll-area/config.ts +0 -17
  141. package/src/components/scroll-area/index.tsx +0 -70
  142. package/src/components/select/config.ts +0 -277
  143. package/src/components/select/index.tsx +0 -202
  144. package/src/components/separator/config.ts +0 -63
  145. package/src/components/separator/index.tsx +0 -38
  146. package/src/components/sheet/config.ts +0 -16
  147. package/src/components/sheet/index.tsx +0 -153
  148. package/src/components/skeleton/config.ts +0 -77
  149. package/src/components/skeleton/index.tsx +0 -22
  150. package/src/components/slider/config.ts +0 -46
  151. package/src/components/slider/index.tsx +0 -73
  152. package/src/components/sonner/config.ts +0 -27
  153. package/src/components/sonner/index.tsx +0 -37
  154. package/src/components/spinner/config.ts +0 -40
  155. package/src/components/spinner/index.tsx +0 -30
  156. package/src/components/switch/config.ts +0 -171
  157. package/src/components/switch/index.tsx +0 -40
  158. package/src/components/table/config.ts +0 -38
  159. package/src/components/table/index.tsx +0 -135
  160. package/src/components/tabs/config.ts +0 -335
  161. package/src/components/tabs/index.tsx +0 -82
  162. package/src/components/textarea/config.ts +0 -117
  163. package/src/components/textarea/index.tsx +0 -26
  164. package/src/components/toggle/config.ts +0 -67
  165. package/src/components/toggle/index.tsx +0 -59
  166. package/src/components/toggle-group/config.ts +0 -46
  167. package/src/components/toggle-group/index.tsx +0 -106
  168. package/src/components/tooltip/config.ts +0 -16
  169. package/src/components/tooltip/index.tsx +0 -75
  170. package/src/components/typography/config.ts +0 -38
  171. package/src/components/typography/index.tsx +0 -172
  172. package/src/index.ts +0 -291
  173. package/tsconfig.json +0 -9
  174. package/tsconfig.lint.json +0 -8
  175. package/tsup.config.ts +0 -55
@@ -1,280 +0,0 @@
1
- 'use client';
2
-
3
- import { cn } from '@foundrykit/utils';
4
- import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
5
- import { CheckIcon, ChevronRightIcon, CircleIcon } from 'lucide-react';
6
- import type * as React from 'react';
7
-
8
- /**
9
- * Dropdown menu root built on Radix `DropdownMenu.Root`. Compose with
10
- * {@link DropdownMenuTrigger}, {@link DropdownMenuContent} and items such as
11
- * {@link DropdownMenuItem}, {@link DropdownMenuCheckboxItem},
12
- * {@link DropdownMenuRadioItem}, {@link DropdownMenuLabel},
13
- * {@link DropdownMenuSeparator}, {@link DropdownMenuShortcut} and submenus
14
- * ({@link DropdownMenuSub}, {@link DropdownMenuSubTrigger},
15
- * {@link DropdownMenuSubContent}).
16
- *
17
- * @example
18
- * ```tsx
19
- * <DropdownMenu>
20
- * <DropdownMenuTrigger>Open</DropdownMenuTrigger>
21
- * <DropdownMenuContent>
22
- * <DropdownMenuItem>Edit</DropdownMenuItem>
23
- * <DropdownMenuItem variant="destructive">Delete</DropdownMenuItem>
24
- * </DropdownMenuContent>
25
- * </DropdownMenu>
26
- * ```
27
- */
28
- function DropdownMenu({
29
- ...props
30
- }: React.ComponentProps<typeof DropdownMenuPrimitive.Root>) {
31
- return <DropdownMenuPrimitive.Root data-slot='dropdown-menu' {...props} />;
32
- }
33
-
34
- function DropdownMenuPortal({
35
- ...props
36
- }: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>) {
37
- return (
38
- <DropdownMenuPrimitive.Portal data-slot='dropdown-menu-portal' {...props} />
39
- );
40
- }
41
-
42
- function DropdownMenuTrigger({
43
- ...props
44
- }: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>) {
45
- return (
46
- <DropdownMenuPrimitive.Trigger
47
- data-slot='dropdown-menu-trigger'
48
- {...props}
49
- />
50
- );
51
- }
52
-
53
- function DropdownMenuContent({
54
- className,
55
- sideOffset = 4,
56
- ...props
57
- }: React.ComponentProps<typeof DropdownMenuPrimitive.Content>) {
58
- return (
59
- <DropdownMenuPrimitive.Portal>
60
- <DropdownMenuPrimitive.Content
61
- data-slot='dropdown-menu-content'
62
- sideOffset={sideOffset}
63
- className={cn(
64
- 'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-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 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md',
65
- className
66
- )}
67
- {...props}
68
- />
69
- </DropdownMenuPrimitive.Portal>
70
- );
71
- }
72
-
73
- function DropdownMenuGroup({
74
- ...props
75
- }: React.ComponentProps<typeof DropdownMenuPrimitive.Group>) {
76
- return (
77
- <DropdownMenuPrimitive.Group data-slot='dropdown-menu-group' {...props} />
78
- );
79
- }
80
-
81
- /**
82
- * Selectable menu item. Use `variant="destructive"` for dangerous actions and
83
- * `inset` to align text with items that have leading icons.
84
- */
85
- function DropdownMenuItem({
86
- className,
87
- inset,
88
- variant = 'default',
89
- ...props
90
- }: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
91
- inset?: boolean;
92
- variant?: 'default' | 'destructive';
93
- }) {
94
- return (
95
- <DropdownMenuPrimitive.Item
96
- data-slot='dropdown-menu-item'
97
- data-inset={inset}
98
- data-variant={variant}
99
- className={cn(
100
- "focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
101
- className
102
- )}
103
- {...props}
104
- />
105
- );
106
- }
107
-
108
- function DropdownMenuCheckboxItem({
109
- className,
110
- children,
111
- checked,
112
- ...props
113
- }: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>) {
114
- return (
115
- <DropdownMenuPrimitive.CheckboxItem
116
- data-slot='dropdown-menu-checkbox-item'
117
- className={cn(
118
- "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
119
- className
120
- )}
121
- checked={checked}
122
- {...props}
123
- >
124
- <span className='pointer-events-none absolute left-2 flex size-3.5 items-center justify-center'>
125
- <DropdownMenuPrimitive.ItemIndicator>
126
- <CheckIcon className='size-4' />
127
- </DropdownMenuPrimitive.ItemIndicator>
128
- </span>
129
- {children}
130
- </DropdownMenuPrimitive.CheckboxItem>
131
- );
132
- }
133
-
134
- function DropdownMenuRadioGroup({
135
- ...props
136
- }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>) {
137
- return (
138
- <DropdownMenuPrimitive.RadioGroup
139
- data-slot='dropdown-menu-radio-group'
140
- {...props}
141
- />
142
- );
143
- }
144
-
145
- function DropdownMenuRadioItem({
146
- className,
147
- children,
148
- ...props
149
- }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>) {
150
- return (
151
- <DropdownMenuPrimitive.RadioItem
152
- data-slot='dropdown-menu-radio-item'
153
- className={cn(
154
- "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
155
- className
156
- )}
157
- {...props}
158
- >
159
- <span className='pointer-events-none absolute left-2 flex size-3.5 items-center justify-center'>
160
- <DropdownMenuPrimitive.ItemIndicator>
161
- <CircleIcon className='size-2 fill-current' />
162
- </DropdownMenuPrimitive.ItemIndicator>
163
- </span>
164
- {children}
165
- </DropdownMenuPrimitive.RadioItem>
166
- );
167
- }
168
-
169
- function DropdownMenuLabel({
170
- className,
171
- inset,
172
- ...props
173
- }: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
174
- inset?: boolean;
175
- }) {
176
- return (
177
- <DropdownMenuPrimitive.Label
178
- data-slot='dropdown-menu-label'
179
- data-inset={inset}
180
- className={cn(
181
- 'px-2 py-1.5 text-sm font-medium data-[inset]:pl-8',
182
- className
183
- )}
184
- {...props}
185
- />
186
- );
187
- }
188
-
189
- function DropdownMenuSeparator({
190
- className,
191
- ...props
192
- }: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>) {
193
- return (
194
- <DropdownMenuPrimitive.Separator
195
- data-slot='dropdown-menu-separator'
196
- className={cn('bg-border -mx-1 my-1 h-px', className)}
197
- {...props}
198
- />
199
- );
200
- }
201
-
202
- function DropdownMenuShortcut({
203
- className,
204
- ...props
205
- }: React.ComponentProps<'span'>) {
206
- return (
207
- <span
208
- data-slot='dropdown-menu-shortcut'
209
- className={cn(
210
- 'text-muted-foreground ml-auto text-xs tracking-widest',
211
- className
212
- )}
213
- {...props}
214
- />
215
- );
216
- }
217
-
218
- function DropdownMenuSub({
219
- ...props
220
- }: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>) {
221
- return <DropdownMenuPrimitive.Sub data-slot='dropdown-menu-sub' {...props} />;
222
- }
223
-
224
- function DropdownMenuSubTrigger({
225
- className,
226
- inset,
227
- children,
228
- ...props
229
- }: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
230
- inset?: boolean;
231
- }) {
232
- return (
233
- <DropdownMenuPrimitive.SubTrigger
234
- data-slot='dropdown-menu-sub-trigger'
235
- data-inset={inset}
236
- className={cn(
237
- 'focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8',
238
- className
239
- )}
240
- {...props}
241
- >
242
- {children}
243
- <ChevronRightIcon className='ml-auto size-4' />
244
- </DropdownMenuPrimitive.SubTrigger>
245
- );
246
- }
247
-
248
- function DropdownMenuSubContent({
249
- className,
250
- ...props
251
- }: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>) {
252
- return (
253
- <DropdownMenuPrimitive.SubContent
254
- data-slot='dropdown-menu-sub-content'
255
- className={cn(
256
- 'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-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 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg',
257
- className
258
- )}
259
- {...props}
260
- />
261
- );
262
- }
263
-
264
- export {
265
- DropdownMenu,
266
- DropdownMenuCheckboxItem,
267
- DropdownMenuContent,
268
- DropdownMenuGroup,
269
- DropdownMenuItem,
270
- DropdownMenuLabel,
271
- DropdownMenuPortal,
272
- DropdownMenuRadioGroup,
273
- DropdownMenuRadioItem,
274
- DropdownMenuSeparator,
275
- DropdownMenuShortcut,
276
- DropdownMenuSub,
277
- DropdownMenuSubContent,
278
- DropdownMenuSubTrigger,
279
- DropdownMenuTrigger,
280
- };
@@ -1,38 +0,0 @@
1
- import type { ComponentConfig } from '@foundrykit/types';
2
-
3
- export const EmptyConfig: ComponentConfig = {
4
- name: 'Empty',
5
- description:
6
- 'An empty-state component for communicating that there is no content to display.',
7
- category: 'primitives',
8
- tags: ['empty', 'placeholder', 'feedback'],
9
- preview: {
10
- type: 'static',
11
- html: '<div class="flex h-24 w-full flex-col items-center justify-center gap-2 rounded-md border border-dashed border-gray-300 bg-gray-100"><div class="h-8 w-8 rounded-lg bg-gray-300"></div><div class="h-2 w-24 rounded bg-gray-400"></div></div>',
12
- },
13
- variants: [
14
- {
15
- name: 'Default',
16
- description: 'Default empty state',
17
- code: '<Empty><EmptyHeader><EmptyTitle>No results</EmptyTitle><EmptyDescription>Try a different search.</EmptyDescription></EmptyHeader></Empty>',
18
- preview: {
19
- type: 'component',
20
- component: 'Empty',
21
- props: {},
22
- },
23
- },
24
- {
25
- name: 'With Icon',
26
- description: 'Empty state with an icon media',
27
- code: '<Empty><EmptyHeader><EmptyMedia variant="icon"><InboxIcon /></EmptyMedia><EmptyTitle>No messages</EmptyTitle></EmptyHeader></Empty>',
28
- preview: {
29
- type: 'component',
30
- component: 'Empty',
31
- props: {},
32
- },
33
- },
34
- ],
35
- dependencies: ['utils'],
36
- packageDependencies: ['class-variance-authority'],
37
- files: ['components/primitives/empty/index.tsx'],
38
- };
@@ -1,127 +0,0 @@
1
- import { cn } from '@foundrykit/utils';
2
- import { cva, type VariantProps } from 'class-variance-authority';
3
- import type * as React from 'react';
4
-
5
- /**
6
- * Empty-state container for communicating that there is no content to show.
7
- * Compose with {@link EmptyHeader}, {@link EmptyMedia}, {@link EmptyTitle},
8
- * {@link EmptyDescription} and {@link EmptyContent} to build a centered,
9
- * illustrated message with optional actions.
10
- *
11
- * @example
12
- * ```tsx
13
- * <Empty>
14
- * <EmptyHeader>
15
- * <EmptyMedia variant="icon">
16
- * <InboxIcon />
17
- * </EmptyMedia>
18
- * <EmptyTitle>No messages</EmptyTitle>
19
- * <EmptyDescription>You're all caught up.</EmptyDescription>
20
- * </EmptyHeader>
21
- * <EmptyContent>
22
- * <Button>Refresh</Button>
23
- * </EmptyContent>
24
- * </Empty>
25
- * ```
26
- */
27
- function Empty({ className, ...props }: React.ComponentProps<'div'>) {
28
- return (
29
- <div
30
- data-slot='empty'
31
- className={cn(
32
- 'flex min-w-0 flex-1 flex-col items-center justify-center gap-6 rounded-lg border-dashed p-6 text-center text-balance md:p-12',
33
- className
34
- )}
35
- {...props}
36
- />
37
- );
38
- }
39
-
40
- function EmptyHeader({ className, ...props }: React.ComponentProps<'div'>) {
41
- return (
42
- <div
43
- data-slot='empty-header'
44
- className={cn(
45
- 'flex max-w-sm flex-col items-center gap-2 text-center',
46
- className
47
- )}
48
- {...props}
49
- />
50
- );
51
- }
52
-
53
- const emptyMediaVariants = cva(
54
- 'mb-2 flex shrink-0 items-center justify-center [&_svg:not([class*=size-])]:size-6',
55
- {
56
- variants: {
57
- variant: {
58
- default: 'bg-transparent',
59
- icon: 'bg-muted text-foreground flex size-10 shrink-0 items-center justify-center rounded-lg [&_svg:not([class*=size-])]:size-6',
60
- },
61
- },
62
- defaultVariants: {
63
- variant: 'default',
64
- },
65
- }
66
- );
67
-
68
- function EmptyMedia({
69
- className,
70
- variant,
71
- ...props
72
- }: React.ComponentProps<'div'> & VariantProps<typeof emptyMediaVariants>) {
73
- return (
74
- <div
75
- data-slot='empty-media'
76
- data-variant={variant}
77
- className={cn(emptyMediaVariants({ variant }), className)}
78
- {...props}
79
- />
80
- );
81
- }
82
-
83
- function EmptyTitle({ className, ...props }: React.ComponentProps<'div'>) {
84
- return (
85
- <div
86
- data-slot='empty-title'
87
- className={cn('text-lg font-medium tracking-tight', className)}
88
- {...props}
89
- />
90
- );
91
- }
92
-
93
- function EmptyDescription({ className, ...props }: React.ComponentProps<'p'>) {
94
- return (
95
- <p
96
- data-slot='empty-description'
97
- className={cn(
98
- 'text-muted-foreground [&>a:hover]:text-primary text-sm/relaxed [&>a]:underline [&>a]:underline-offset-4',
99
- className
100
- )}
101
- {...props}
102
- />
103
- );
104
- }
105
-
106
- function EmptyContent({ className, ...props }: React.ComponentProps<'div'>) {
107
- return (
108
- <div
109
- data-slot='empty-content'
110
- className={cn(
111
- 'flex w-full max-w-sm min-w-0 flex-col items-center gap-4 text-sm text-balance',
112
- className
113
- )}
114
- {...props}
115
- />
116
- );
117
- }
118
-
119
- export {
120
- Empty,
121
- EmptyContent,
122
- EmptyDescription,
123
- EmptyHeader,
124
- EmptyMedia,
125
- EmptyTitle,
126
- emptyMediaVariants,
127
- };
@@ -1,40 +0,0 @@
1
- import type { ComponentConfig } from '@foundrykit/types';
2
-
3
- export const FieldConfig: ComponentConfig = {
4
- name: 'Field',
5
- description:
6
- 'A composable set of primitives for building accessible form fields.',
7
- category: 'primitives',
8
- tags: ['field', 'form', 'label', 'input', 'validation'],
9
- preview: {
10
- type: 'static',
11
- html: '<div class="flex w-full flex-col gap-1.5 rounded-md border border-gray-300 bg-gray-50 p-3"><div class="h-2 w-16 rounded bg-gray-400"></div><div class="h-8 w-full rounded-md border border-gray-300 bg-white"></div><div class="h-2 w-28 rounded bg-gray-300"></div></div>',
12
- },
13
- variants: [
14
- {
15
- name: 'Vertical',
16
- description: 'Default vertical field',
17
- code: '<Field><FieldLabel>Email</FieldLabel><input /></Field>',
18
- preview: {
19
- type: 'component',
20
- component: 'Field',
21
- props: {},
22
- },
23
- },
24
- {
25
- name: 'Horizontal',
26
- description: 'Horizontal field layout',
27
- code: '<Field orientation="horizontal">...</Field>',
28
- preview: {
29
- type: 'component',
30
- component: 'Field',
31
- props: {
32
- orientation: 'horizontal',
33
- },
34
- },
35
- },
36
- ],
37
- dependencies: ['utils'],
38
- packageDependencies: ['@radix-ui/react-label', 'class-variance-authority'],
39
- files: ['components/primitives/field/index.tsx'],
40
- };