@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,27 +0,0 @@
1
- import type { ComponentConfig } from '@foundrykit/types';
2
-
3
- export const SonnerConfig: ComponentConfig = {
4
- name: 'Sonner',
5
- description: 'An opinionated toast component for notifications.',
6
- category: 'primitives',
7
- tags: ['sonner', 'toast', 'notification', 'feedback'],
8
- preview: {
9
- type: 'static',
10
- html: '<div class="flex h-12 w-64 items-center gap-3 rounded-md border border-gray-300 bg-white px-3 shadow-sm"><div class="h-3 w-3 rounded-full bg-gray-400"></div><span class="text-sm text-gray-600">Event has been created</span></div>',
11
- },
12
- variants: [
13
- {
14
- name: 'Default',
15
- description: 'Default toaster',
16
- code: '<Toaster />',
17
- preview: {
18
- type: 'component',
19
- component: 'Toaster',
20
- props: {},
21
- },
22
- },
23
- ],
24
- dependencies: ['utils'],
25
- packageDependencies: ['sonner', 'next-themes'],
26
- files: ['components/primitives/sonner/index.tsx'],
27
- };
@@ -1,37 +0,0 @@
1
- 'use client';
2
-
3
- import { useTheme } from 'next-themes';
4
- import type * as React from 'react';
5
- import { Toaster as Sonner, type ToasterProps, toast } from 'sonner';
6
-
7
- /**
8
- * Toast notifications powered by Sonner, automatically themed via
9
- * `next-themes`. Render a single `Toaster` near the root of your app and
10
- * trigger notifications imperatively with the re-exported {@link toast}.
11
- *
12
- * @example
13
- * ```tsx
14
- * <Toaster />
15
- * <button onClick={() => toast('Saved!')}>Save</button>
16
- * ```
17
- */
18
- function Toaster({ ...props }: ToasterProps) {
19
- const { theme = 'system' } = useTheme();
20
-
21
- return (
22
- <Sonner
23
- theme={theme as ToasterProps['theme']}
24
- className='toaster group'
25
- style={
26
- {
27
- '--normal-bg': 'var(--popover)',
28
- '--normal-text': 'var(--popover-foreground)',
29
- '--normal-border': 'var(--border)',
30
- } as React.CSSProperties
31
- }
32
- {...props}
33
- />
34
- );
35
- }
36
-
37
- export { Toaster, toast };
@@ -1,40 +0,0 @@
1
- import type { ComponentConfig } from '@foundrykit/types';
2
-
3
- export const SpinnerConfig: ComponentConfig = {
4
- name: 'Spinner',
5
- description:
6
- 'An animated loading indicator for pending or in-progress states.',
7
- category: 'primitives',
8
- tags: ['spinner', 'loading', 'feedback'],
9
- preview: {
10
- type: 'static',
11
- html: '<div class="flex h-12 w-full items-center justify-center rounded-md border border-gray-300 bg-gray-100"><div class="h-5 w-5 rounded-full border-2 border-gray-400 border-t-transparent"></div></div>',
12
- },
13
- variants: [
14
- {
15
- name: 'Default',
16
- description: 'Default spinner',
17
- code: '<Spinner />',
18
- preview: {
19
- type: 'component',
20
- component: 'Spinner',
21
- props: {},
22
- },
23
- },
24
- {
25
- name: 'Large',
26
- description: 'Large spinner',
27
- code: '<Spinner className="size-8" />',
28
- preview: {
29
- type: 'component',
30
- component: 'Spinner',
31
- props: {
32
- className: 'size-8',
33
- },
34
- },
35
- },
36
- ],
37
- dependencies: ['utils'],
38
- packageDependencies: ['lucide-react'],
39
- files: ['components/primitives/spinner/index.tsx'],
40
- };
@@ -1,30 +0,0 @@
1
- import { cn } from '@foundrykit/utils';
2
- import { Loader2Icon } from 'lucide-react';
3
- import type * as React from 'react';
4
-
5
- /**
6
- * Loading indicator built on the lucide `Loader2Icon` with a continuous
7
- * spin animation. Adjust the size and color through `className` (e.g.
8
- * `size-6 text-muted-foreground`).
9
- *
10
- * @example
11
- * ```tsx
12
- * <Spinner className="size-6 text-muted-foreground" />
13
- * ```
14
- */
15
- function Spinner({
16
- className,
17
- ...props
18
- }: React.ComponentProps<typeof Loader2Icon>) {
19
- return (
20
- <Loader2Icon
21
- role='status'
22
- aria-label='Loading'
23
- data-slot='spinner'
24
- className={cn('size-4 animate-spin', className)}
25
- {...props}
26
- />
27
- );
28
- }
29
-
30
- export { Spinner };
@@ -1,171 +0,0 @@
1
- import type { ComponentConfig } from '@foundrykit/types';
2
-
3
- export const switchConfig: ComponentConfig = {
4
- name: 'Switch',
5
- description: 'Toggle switch component for boolean values',
6
- category: 'primitives',
7
- tags: ['form', 'input', 'interactive'],
8
- preview: {
9
- type: 'static',
10
- html: '<div class="flex h-12 w-full items-center justify-center rounded-md bg-gray-200"><div class="h-6 w-11 rounded-full bg-blue-500 flex items-center justify-end px-1"><div class="h-4 w-4 rounded-full bg-white"></div></div></div>',
11
- },
12
- variants: [
13
- {
14
- name: 'Default',
15
- description: 'Basic switch with default styling',
16
- code: '<Switch />',
17
- preview: {
18
- type: 'component',
19
- component: 'Switch',
20
- props: {},
21
- },
22
- },
23
- {
24
- name: 'With Label',
25
- description: 'Switch with associated label',
26
- code: `<div class="flex items-center space-x-2">
27
- <Switch id="airplane-mode" />
28
- <Label htmlFor="airplane-mode">Airplane Mode</Label>
29
- </div>`,
30
- preview: {
31
- type: 'component',
32
- component: 'div',
33
- props: {
34
- className: 'flex items-center space-x-2',
35
- children: [
36
- {
37
- component: 'Switch',
38
- props: { id: 'airplane-mode' },
39
- },
40
- {
41
- component: 'Label',
42
- props: { htmlFor: 'airplane-mode', children: 'Airplane Mode' },
43
- },
44
- ],
45
- },
46
- },
47
- },
48
- {
49
- name: 'Checked',
50
- description: 'Switch in checked state',
51
- code: '<Switch defaultChecked />',
52
- preview: {
53
- type: 'component',
54
- component: 'Switch',
55
- props: { defaultChecked: true },
56
- },
57
- },
58
- {
59
- name: 'Disabled',
60
- description: 'Disabled switch',
61
- code: `<div class="flex items-center space-x-2">
62
- <Switch disabled />
63
- <Label htmlFor="disabled" className="text-muted-foreground">Disabled</Label>
64
- </div>`,
65
- preview: {
66
- type: 'component',
67
- component: 'div',
68
- props: {
69
- className: 'flex items-center space-x-2',
70
- children: [
71
- {
72
- component: 'Switch',
73
- props: { disabled: true },
74
- },
75
- {
76
- component: 'Label',
77
- props: {
78
- htmlFor: 'disabled',
79
- className: 'text-muted-foreground',
80
- children: 'Disabled',
81
- },
82
- },
83
- ],
84
- },
85
- },
86
- },
87
- {
88
- name: 'Multiple Switches',
89
- description: 'Multiple switches with different states',
90
- code: `<div class="space-y-4">
91
- <div class="flex items-center justify-between">
92
- <Label htmlFor="notifications">Notifications</Label>
93
- <Switch id="notifications" defaultChecked />
94
- </div>
95
- <div class="flex items-center justify-between">
96
- <Label htmlFor="marketing">Marketing emails</Label>
97
- <Switch id="marketing" />
98
- </div>
99
- <div class="flex items-center justify-between">
100
- <Label htmlFor="updates">System updates</Label>
101
- <Switch id="updates" defaultChecked />
102
- </div>
103
- </div>`,
104
- preview: {
105
- type: 'component',
106
- component: 'div',
107
- props: {
108
- className: 'space-y-4',
109
- children: [
110
- {
111
- component: 'div',
112
- props: {
113
- className: 'flex items-center justify-between',
114
- children: [
115
- {
116
- component: 'Label',
117
- props: {
118
- htmlFor: 'notifications',
119
- children: 'Notifications',
120
- },
121
- },
122
- {
123
- component: 'Switch',
124
- props: { id: 'notifications', defaultChecked: true },
125
- },
126
- ],
127
- },
128
- },
129
- {
130
- component: 'div',
131
- props: {
132
- className: 'flex items-center justify-between',
133
- children: [
134
- {
135
- component: 'Label',
136
- props: {
137
- htmlFor: 'marketing',
138
- children: 'Marketing emails',
139
- },
140
- },
141
- {
142
- component: 'Switch',
143
- props: { id: 'marketing' },
144
- },
145
- ],
146
- },
147
- },
148
- {
149
- component: 'div',
150
- props: {
151
- className: 'flex items-center justify-between',
152
- children: [
153
- {
154
- component: 'Label',
155
- props: { htmlFor: 'updates', children: 'System updates' },
156
- },
157
- {
158
- component: 'Switch',
159
- props: { id: 'updates', defaultChecked: true },
160
- },
161
- ],
162
- },
163
- },
164
- ],
165
- },
166
- },
167
- },
168
- ],
169
- dependencies: ['utils', 'label'],
170
- files: ['components/primitives/switch/index.tsx'],
171
- };
@@ -1,40 +0,0 @@
1
- 'use client';
2
-
3
- import { cn } from '@foundrykit/utils';
4
- import * as SwitchPrimitive from '@radix-ui/react-switch';
5
- import type * as React from 'react';
6
-
7
- /**
8
- * Toggle switch built on Radix `Switch.Root` with a sliding thumb. Supports
9
- * controlled/uncontrolled state and disabled styling via the underlying Radix
10
- * props (`checked`/`onCheckedChange`).
11
- *
12
- * @example
13
- * ```tsx
14
- * <Switch checked={on} onCheckedChange={setOn} />
15
- * ```
16
- */
17
- function Switch({
18
- className,
19
- ...props
20
- }: React.ComponentProps<typeof SwitchPrimitive.Root>) {
21
- return (
22
- <SwitchPrimitive.Root
23
- data-slot='switch'
24
- className={cn(
25
- 'data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 peer inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50',
26
- className
27
- )}
28
- {...props}
29
- >
30
- <SwitchPrimitive.Thumb
31
- data-slot='switch-thumb'
32
- className={cn(
33
- 'bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0'
34
- )}
35
- />
36
- </SwitchPrimitive.Root>
37
- );
38
- }
39
-
40
- export { Switch };
@@ -1,38 +0,0 @@
1
- import type { ComponentConfig } from '@foundrykit/types';
2
-
3
- export const TableConfig: ComponentConfig = {
4
- name: 'Table',
5
- description:
6
- 'A responsive table component for displaying tabular data in rows and columns.',
7
- category: 'primitives',
8
- tags: ['table', 'data', 'grid'],
9
- preview: {
10
- type: 'static',
11
- html: '<div class="w-full overflow-hidden rounded-md border border-gray-300"><div class="flex border-b border-gray-300 bg-gray-100 px-3 py-2"><div class="h-2 w-16 rounded bg-gray-400"></div></div><div class="flex px-3 py-2"><div class="h-2 w-24 rounded bg-gray-300"></div></div></div>',
12
- },
13
- variants: [
14
- {
15
- name: 'Default',
16
- description: 'Default table',
17
- code: '<Table><TableHeader><TableRow><TableHead>Name</TableHead></TableRow></TableHeader><TableBody><TableRow><TableCell>Acme</TableCell></TableRow></TableBody></Table>',
18
- preview: {
19
- type: 'component',
20
- component: 'Table',
21
- props: {},
22
- },
23
- },
24
- {
25
- name: 'With Caption',
26
- description: 'Table with a caption',
27
- code: '<Table><TableCaption>A list of recent invoices.</TableCaption></Table>',
28
- preview: {
29
- type: 'component',
30
- component: 'Table',
31
- props: {},
32
- },
33
- },
34
- ],
35
- dependencies: ['utils'],
36
- packageDependencies: [],
37
- files: ['components/primitives/table/index.tsx'],
38
- };
@@ -1,135 +0,0 @@
1
- import { cn } from '@foundrykit/utils';
2
- import type * as React from 'react';
3
-
4
- /**
5
- * Responsive data table. Wraps a native `<table>` in a horizontally
6
- * scrollable container and composes with {@link TableHeader},
7
- * {@link TableBody}, {@link TableFooter}, {@link TableRow},
8
- * {@link TableHead}, {@link TableCell} and {@link TableCaption}.
9
- *
10
- * @example
11
- * ```tsx
12
- * <Table>
13
- * <TableHeader>
14
- * <TableRow>
15
- * <TableHead>Name</TableHead>
16
- * </TableRow>
17
- * </TableHeader>
18
- * <TableBody>
19
- * <TableRow>
20
- * <TableCell>Acme</TableCell>
21
- * </TableRow>
22
- * </TableBody>
23
- * </Table>
24
- * ```
25
- */
26
- function Table({ className, ...props }: React.ComponentProps<'table'>) {
27
- return (
28
- <div
29
- data-slot='table-container'
30
- className='relative w-full overflow-x-auto'
31
- >
32
- <table
33
- data-slot='table'
34
- className={cn('w-full caption-bottom text-sm', className)}
35
- {...props}
36
- />
37
- </div>
38
- );
39
- }
40
-
41
- function TableHeader({ className, ...props }: React.ComponentProps<'thead'>) {
42
- return (
43
- <thead
44
- data-slot='table-header'
45
- className={cn('[&_tr]:border-b', className)}
46
- {...props}
47
- />
48
- );
49
- }
50
-
51
- function TableBody({ className, ...props }: React.ComponentProps<'tbody'>) {
52
- return (
53
- <tbody
54
- data-slot='table-body'
55
- className={cn('[&_tr:last-child]:border-0', className)}
56
- {...props}
57
- />
58
- );
59
- }
60
-
61
- function TableFooter({ className, ...props }: React.ComponentProps<'tfoot'>) {
62
- return (
63
- <tfoot
64
- data-slot='table-footer'
65
- className={cn(
66
- 'bg-muted/50 border-t font-medium [&>tr]:last:border-b-0',
67
- className
68
- )}
69
- {...props}
70
- />
71
- );
72
- }
73
-
74
- function TableRow({ className, ...props }: React.ComponentProps<'tr'>) {
75
- return (
76
- <tr
77
- data-slot='table-row'
78
- className={cn(
79
- 'hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors',
80
- className
81
- )}
82
- {...props}
83
- />
84
- );
85
- }
86
-
87
- function TableHead({ className, ...props }: React.ComponentProps<'th'>) {
88
- return (
89
- <th
90
- data-slot='table-head'
91
- className={cn(
92
- 'text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]',
93
- className
94
- )}
95
- {...props}
96
- />
97
- );
98
- }
99
-
100
- function TableCell({ className, ...props }: React.ComponentProps<'td'>) {
101
- return (
102
- <td
103
- data-slot='table-cell'
104
- className={cn(
105
- 'p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]',
106
- className
107
- )}
108
- {...props}
109
- />
110
- );
111
- }
112
-
113
- function TableCaption({
114
- className,
115
- ...props
116
- }: React.ComponentProps<'caption'>) {
117
- return (
118
- <caption
119
- data-slot='table-caption'
120
- className={cn('text-muted-foreground mt-4 text-sm', className)}
121
- {...props}
122
- />
123
- );
124
- }
125
-
126
- export {
127
- Table,
128
- TableBody,
129
- TableCaption,
130
- TableCell,
131
- TableFooter,
132
- TableHead,
133
- TableHeader,
134
- TableRow,
135
- };