@foundrykit/primitives 2.0.9 → 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 (131) hide show
  1. package/dist/chunk-3NQR7JZR.js +128 -0
  2. package/dist/chunk-B5YCE3UP.js +57 -0
  3. package/dist/chunk-F2TEA6ER.js +138 -0
  4. package/dist/chunk-SIQHWNPH.js +45 -0
  5. package/dist/components/dialog/index.cjs +182 -0
  6. package/dist/components/dialog/index.d.cts +38 -0
  7. package/dist/components/dialog/index.d.ts +38 -0
  8. package/dist/components/dialog/index.js +25 -0
  9. package/dist/components/input-group/index.cjs +270 -0
  10. package/dist/components/input-group/index.d.cts +44 -0
  11. package/dist/components/input-group/index.d.ts +44 -0
  12. package/dist/components/input-group/index.js +153 -0
  13. package/dist/components/sheet/index.cjs +170 -0
  14. package/dist/components/sheet/index.d.cts +31 -0
  15. package/dist/components/sheet/index.d.ts +31 -0
  16. package/dist/components/sheet/index.js +21 -0
  17. package/dist/components/toggle/index.cjs +81 -0
  18. package/dist/components/toggle/index.d.cts +26 -0
  19. package/dist/components/toggle/index.d.ts +26 -0
  20. package/dist/components/toggle/index.js +9 -0
  21. package/dist/components/tooltip/index.cjs +95 -0
  22. package/dist/components/tooltip/index.d.cts +25 -0
  23. package/dist/components/tooltip/index.d.ts +25 -0
  24. package/dist/components/tooltip/index.js +13 -0
  25. package/dist/index.d.cts +11 -105
  26. package/dist/index.d.ts +11 -105
  27. package/dist/index.js +93 -399
  28. package/package.json +200 -8
  29. package/CHANGELOG.md +0 -230
  30. package/postcss.config.mjs +0 -6
  31. package/registry.json +0 -64
  32. package/src/components/accordion/config.ts +0 -28
  33. package/src/components/accordion/index.tsx +0 -80
  34. package/src/components/alert/config.ts +0 -40
  35. package/src/components/alert/index.tsx +0 -80
  36. package/src/components/alert-dialog/config.ts +0 -28
  37. package/src/components/alert-dialog/index.tsx +0 -188
  38. package/src/components/aspect-ratio/config.ts +0 -27
  39. package/src/components/aspect-ratio/index.tsx +0 -24
  40. package/src/components/avatar/config.ts +0 -46
  41. package/src/components/avatar/index.tsx +0 -67
  42. package/src/components/badge/config.ts +0 -56
  43. package/src/components/badge/index.tsx +0 -56
  44. package/src/components/breadcrumb/config.ts +0 -121
  45. package/src/components/breadcrumb/index.tsx +0 -127
  46. package/src/components/button/config.ts +0 -97
  47. package/src/components/button/index.tsx +0 -86
  48. package/src/components/button-group/config.ts +0 -39
  49. package/src/components/button-group/index.tsx +0 -99
  50. package/src/components/card/config.ts +0 -89
  51. package/src/components/card/index.tsx +0 -90
  52. package/src/components/checkbox/config.ts +0 -46
  53. package/src/components/checkbox/index.tsx +0 -41
  54. package/src/components/collapsible/config.ts +0 -27
  55. package/src/components/collapsible/index.tsx +0 -47
  56. package/src/components/context-menu/config.ts +0 -28
  57. package/src/components/context-menu/index.tsx +0 -271
  58. package/src/components/dialog/config.ts +0 -582
  59. package/src/components/dialog/index.tsx +0 -162
  60. package/src/components/direction/config.ts +0 -28
  61. package/src/components/direction/index.tsx +0 -27
  62. package/src/components/drawer/config.ts +0 -28
  63. package/src/components/drawer/index.tsx +0 -153
  64. package/src/components/dropdown/config.ts +0 -262
  65. package/src/components/dropdown/index.tsx +0 -280
  66. package/src/components/empty/config.ts +0 -38
  67. package/src/components/empty/index.tsx +0 -127
  68. package/src/components/field/config.ts +0 -40
  69. package/src/components/field/index.tsx +0 -252
  70. package/src/components/hover-card/config.ts +0 -27
  71. package/src/components/hover-card/index.tsx +0 -56
  72. package/src/components/input/config.ts +0 -64
  73. package/src/components/input/index.tsx +0 -32
  74. package/src/components/input-group/config.ts +0 -209
  75. package/src/components/input-group/index.tsx +0 -177
  76. package/src/components/item/config.ts +0 -52
  77. package/src/components/item/index.tsx +0 -215
  78. package/src/components/kbd/config.ts +0 -38
  79. package/src/components/kbd/index.tsx +0 -40
  80. package/src/components/label/config.ts +0 -72
  81. package/src/components/label/index.tsx +0 -32
  82. package/src/components/menubar/config.ts +0 -28
  83. package/src/components/menubar/index.tsx +0 -295
  84. package/src/components/native-select/config.ts +0 -40
  85. package/src/components/native-select/index.tsx +0 -40
  86. package/src/components/navigation-menu/config.ts +0 -32
  87. package/src/components/navigation-menu/index.tsx +0 -188
  88. package/src/components/popover/config.ts +0 -222
  89. package/src/components/popover/index.tsx +0 -60
  90. package/src/components/progress/config.ts +0 -42
  91. package/src/components/progress/index.tsx +0 -39
  92. package/src/components/radio-group/config.ts +0 -303
  93. package/src/components/radio-group/index.tsx +0 -58
  94. package/src/components/resizable/config.ts +0 -28
  95. package/src/components/resizable/index.tsx +0 -67
  96. package/src/components/scroll-area/config.ts +0 -17
  97. package/src/components/scroll-area/index.tsx +0 -70
  98. package/src/components/select/config.ts +0 -277
  99. package/src/components/select/index.tsx +0 -202
  100. package/src/components/separator/config.ts +0 -63
  101. package/src/components/separator/index.tsx +0 -38
  102. package/src/components/sheet/config.ts +0 -16
  103. package/src/components/sheet/index.tsx +0 -153
  104. package/src/components/skeleton/config.ts +0 -77
  105. package/src/components/skeleton/index.tsx +0 -22
  106. package/src/components/slider/config.ts +0 -46
  107. package/src/components/slider/index.tsx +0 -76
  108. package/src/components/sonner/config.ts +0 -27
  109. package/src/components/sonner/index.tsx +0 -37
  110. package/src/components/spinner/config.ts +0 -40
  111. package/src/components/spinner/index.tsx +0 -30
  112. package/src/components/switch/config.ts +0 -171
  113. package/src/components/switch/index.tsx +0 -40
  114. package/src/components/table/config.ts +0 -38
  115. package/src/components/table/index.tsx +0 -135
  116. package/src/components/tabs/config.ts +0 -335
  117. package/src/components/tabs/index.tsx +0 -82
  118. package/src/components/textarea/config.ts +0 -117
  119. package/src/components/textarea/index.tsx +0 -26
  120. package/src/components/toggle/config.ts +0 -67
  121. package/src/components/toggle/index.tsx +0 -59
  122. package/src/components/toggle-group/config.ts +0 -46
  123. package/src/components/toggle-group/index.tsx +0 -106
  124. package/src/components/tooltip/config.ts +0 -16
  125. package/src/components/tooltip/index.tsx +0 -75
  126. package/src/components/typography/config.ts +0 -38
  127. package/src/components/typography/index.tsx +0 -172
  128. package/src/index.ts +0 -291
  129. package/tsconfig.json +0 -9
  130. package/tsconfig.lint.json +0 -8
  131. package/tsup.config.ts +0 -55
@@ -1,76 +0,0 @@
1
- 'use client';
2
-
3
- import { cn } from '@foundrykit/utils';
4
- import * as SliderPrimitive from '@radix-ui/react-slider';
5
- import * as React from 'react';
6
-
7
- /**
8
- * Slider built on Radix `Slider.Root`. Supports single or multiple thumbs by
9
- * passing an array to `value`/`defaultValue`. Works horizontally or vertically
10
- * via the `orientation` prop. `aria-label` names each thumb (the focusable
11
- * `role="slider"` element), not the root.
12
- *
13
- * @example
14
- * ```tsx
15
- * <Slider defaultValue={[50]} max={100} step={1} />
16
- * <Slider defaultValue={[25, 75]} max={100} step={1} />
17
- * ```
18
- */
19
- function Slider({
20
- className,
21
- defaultValue,
22
- value,
23
- min = 0,
24
- max = 100,
25
- 'aria-label': ariaLabel,
26
- ...props
27
- }: React.ComponentProps<typeof SliderPrimitive.Root>) {
28
- const _values = React.useMemo(
29
- () =>
30
- Array.isArray(value)
31
- ? value
32
- : Array.isArray(defaultValue)
33
- ? defaultValue
34
- : [min, max],
35
- [value, defaultValue, min, max]
36
- );
37
-
38
- return (
39
- <SliderPrimitive.Root
40
- data-slot='slider'
41
- defaultValue={defaultValue}
42
- value={value}
43
- min={min}
44
- max={max}
45
- className={cn(
46
- 'relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col',
47
- className
48
- )}
49
- {...props}
50
- >
51
- <SliderPrimitive.Track
52
- data-slot='slider-track'
53
- className={cn(
54
- 'bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5'
55
- )}
56
- >
57
- <SliderPrimitive.Range
58
- data-slot='slider-range'
59
- className={cn(
60
- 'bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full'
61
- )}
62
- />
63
- </SliderPrimitive.Track>
64
- {Array.from({ length: _values.length }, (_, index) => (
65
- <SliderPrimitive.Thumb
66
- data-slot='slider-thumb'
67
- key={index}
68
- aria-label={ariaLabel}
69
- className='border-primary bg-background ring-ring/50 block size-4 shrink-0 rounded-full border shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50'
70
- />
71
- ))}
72
- </SliderPrimitive.Root>
73
- );
74
- }
75
-
76
- export { Slider };
@@ -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
- };