@foundrykit/primitives 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components.json +20 -0
- package/dist/chunk-A3U73FA7.js +33 -0
- package/dist/chunk-AADRFFPH.js +171 -0
- package/dist/chunk-FUWID6MC.js +42 -0
- package/dist/chunk-FYCANIVJ.js +69 -0
- package/dist/chunk-I44GXEPN.js +20 -0
- package/dist/chunk-J4CRGO2P.js +46 -0
- package/dist/chunk-J57CV3VT.js +28 -0
- package/dist/chunk-KZMSLRLW.js +25 -0
- package/dist/chunk-PHMEWMFS.js +233 -0
- package/dist/chunk-QL4XJD7Y.js +24 -0
- package/dist/chunk-SKR3J46C.js +17 -0
- package/dist/chunk-U2EIVYWP.js +33 -0
- package/dist/chunk-UZIMC7AQ.js +63 -0
- package/dist/chunk-VSXKLSEP.js +105 -0
- package/dist/chunk-VVNIYCKH.js +55 -0
- package/dist/chunk-XQAJQKO7.js +47 -0
- package/dist/chunk-YTUI6MCB.js +52 -0
- package/dist/components/avatar/index.cjs +92 -0
- package/dist/components/avatar/index.d.cts +9 -0
- package/dist/components/avatar/index.d.ts +9 -0
- package/dist/components/avatar/index.js +11 -0
- package/dist/components/badge/index.cjs +67 -0
- package/dist/components/badge/index.d.cts +13 -0
- package/dist/components/badge/index.d.ts +13 -0
- package/dist/components/badge/index.js +8 -0
- package/dist/components/breadcrumb/index.cjs +135 -0
- package/dist/components/breadcrumb/index.d.cts +14 -0
- package/dist/components/breadcrumb/index.d.ts +14 -0
- package/dist/components/breadcrumb/index.js +18 -0
- package/dist/components/button/index.cjs +77 -0
- package/dist/components/button/index.d.cts +15 -0
- package/dist/components/button/index.d.ts +15 -0
- package/dist/components/button/index.js +8 -0
- package/dist/components/card/index.cjs +102 -0
- package/dist/components/card/index.d.cts +10 -0
- package/dist/components/card/index.d.ts +10 -0
- package/dist/components/card/index.js +16 -0
- package/dist/components/checkbox/index.cjs +68 -0
- package/dist/components/checkbox/index.d.cts +7 -0
- package/dist/components/checkbox/index.d.ts +7 -0
- package/dist/components/checkbox/index.js +7 -0
- package/dist/components/dropdown/index.cjs +282 -0
- package/dist/components/dropdown/index.d.cts +28 -0
- package/dist/components/dropdown/index.d.ts +28 -0
- package/dist/components/dropdown/index.js +35 -0
- package/dist/components/input/index.cjs +59 -0
- package/dist/components/input/index.d.cts +7 -0
- package/dist/components/input/index.d.ts +7 -0
- package/dist/components/input/index.js +6 -0
- package/dist/components/label/index.cjs +59 -0
- package/dist/components/label/index.d.cts +7 -0
- package/dist/components/label/index.d.ts +7 -0
- package/dist/components/label/index.js +7 -0
- package/dist/components/popover/index.cjs +84 -0
- package/dist/components/popover/index.d.cts +10 -0
- package/dist/components/popover/index.d.ts +10 -0
- package/dist/components/popover/index.js +13 -0
- package/dist/components/radio-group/index.cjs +83 -0
- package/dist/components/radio-group/index.d.cts +8 -0
- package/dist/components/radio-group/index.d.ts +8 -0
- package/dist/components/radio-group/index.js +9 -0
- package/dist/components/select/index.cjs +215 -0
- package/dist/components/select/index.d.cts +18 -0
- package/dist/components/select/index.d.ts +18 -0
- package/dist/components/select/index.js +25 -0
- package/dist/components/separator/index.cjs +63 -0
- package/dist/components/separator/index.d.cts +7 -0
- package/dist/components/separator/index.d.ts +7 -0
- package/dist/components/separator/index.js +7 -0
- package/dist/components/skeleton/index.cjs +41 -0
- package/dist/components/skeleton/index.d.cts +5 -0
- package/dist/components/skeleton/index.d.ts +5 -0
- package/dist/components/skeleton/index.js +6 -0
- package/dist/components/switch/index.cjs +68 -0
- package/dist/components/switch/index.d.cts +7 -0
- package/dist/components/switch/index.d.ts +7 -0
- package/dist/components/switch/index.js +7 -0
- package/dist/components/tabs/index.cjs +107 -0
- package/dist/components/tabs/index.d.cts +10 -0
- package/dist/components/tabs/index.d.ts +10 -0
- package/dist/components/tabs/index.js +13 -0
- package/dist/components/textarea/index.cjs +44 -0
- package/dist/components/textarea/index.d.cts +6 -0
- package/dist/components/textarea/index.d.ts +6 -0
- package/dist/components/textarea/index.js +6 -0
- package/dist/index.cjs +1275 -0
- package/dist/index.d.cts +46 -0
- package/dist/index.d.ts +46 -0
- package/dist/index.js +298 -0
- package/eslint.config.js +4 -0
- package/package.json +67 -0
- package/postcss.config.mjs +6 -0
- package/registry.json +51 -0
- package/src/components/avatar/config.ts +46 -0
- package/src/components/avatar/index.tsx +53 -0
- package/src/components/badge/config.ts +56 -0
- package/src/components/badge/index.tsx +46 -0
- package/src/components/breadcrumb/config.ts +121 -0
- package/src/components/breadcrumb/index.tsx +109 -0
- package/src/components/button/config.ts +76 -0
- package/src/components/button/index.tsx +62 -0
- package/src/components/card/config.ts +89 -0
- package/src/components/card/index.tsx +83 -0
- package/src/components/checkbox/config.ts +46 -0
- package/src/components/checkbox/index.tsx +32 -0
- package/src/components/dialog/config.ts +582 -0
- package/src/components/dialog/index.tsx +143 -0
- package/src/components/dropdown/config.ts +262 -0
- package/src/components/dropdown/index.tsx +257 -0
- package/src/components/input/config.ts +64 -0
- package/src/components/input/index.tsx +25 -0
- package/src/components/label/config.ts +72 -0
- package/src/components/label/index.tsx +24 -0
- package/src/components/popover/config.ts +219 -0
- package/src/components/popover/index.tsx +48 -0
- package/src/components/radio-group/config.ts +303 -0
- package/src/components/radio-group/index.tsx +45 -0
- package/src/components/select/config.ts +277 -0
- package/src/components/select/index.tsx +185 -0
- package/src/components/separator/config.ts +63 -0
- package/src/components/separator/index.tsx +28 -0
- package/src/components/skeleton/config.ts +77 -0
- package/src/components/skeleton/index.tsx +13 -0
- package/src/components/switch/config.ts +165 -0
- package/src/components/switch/index.tsx +31 -0
- package/src/components/tabs/config.ts +335 -0
- package/src/components/tabs/index.tsx +66 -0
- package/src/components/textarea/config.ts +117 -0
- package/src/components/textarea/index.tsx +18 -0
- package/src/index.ts +87 -0
- package/tsconfig.json +9 -0
- package/tsconfig.lint.json +8 -0
- package/tsup.config.ts +29 -0
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
import { ComponentConfig } from '@foundrykit/types';
|
|
2
|
+
|
|
3
|
+
export const tabsConfig: ComponentConfig = {
|
|
4
|
+
name: 'Tabs',
|
|
5
|
+
description: 'Tabbed interface component for organizing content',
|
|
6
|
+
category: 'primitives',
|
|
7
|
+
tags: ['navigation', 'interactive', 'ui'],
|
|
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="w-full max-w-md"><div class="flex border-b border-gray-300"><div class="px-3 py-2 text-sm font-medium border-b-2 border-blue-500 text-blue-600">Account</div><div class="px-3 py-2 text-sm text-gray-500">Password</div><div class="px-3 py-2 text-sm text-gray-500">Settings</div></div></div></div>',
|
|
11
|
+
},
|
|
12
|
+
variants: [
|
|
13
|
+
{
|
|
14
|
+
name: 'Default',
|
|
15
|
+
description: 'Basic tabs with default styling',
|
|
16
|
+
code: `<Tabs defaultValue="account" className="w-[400px]">
|
|
17
|
+
<TabsList>
|
|
18
|
+
<TabsTrigger value="account">Account</TabsTrigger>
|
|
19
|
+
<TabsTrigger value="password">Password</TabsTrigger>
|
|
20
|
+
<TabsTrigger value="settings">Settings</TabsTrigger>
|
|
21
|
+
</TabsList>
|
|
22
|
+
<TabsContent value="account">
|
|
23
|
+
<p>Make changes to your account here.</p>
|
|
24
|
+
</TabsContent>
|
|
25
|
+
<TabsContent value="password">
|
|
26
|
+
<p>Change your password here.</p>
|
|
27
|
+
</TabsContent>
|
|
28
|
+
<TabsContent value="settings">
|
|
29
|
+
<p>Manage your settings here.</p>
|
|
30
|
+
</TabsContent>
|
|
31
|
+
</Tabs>`,
|
|
32
|
+
preview: {
|
|
33
|
+
type: 'component',
|
|
34
|
+
component: 'Tabs',
|
|
35
|
+
props: {
|
|
36
|
+
defaultValue: 'account',
|
|
37
|
+
className: 'w-[400px]',
|
|
38
|
+
children: [
|
|
39
|
+
{
|
|
40
|
+
type: 'TabsList',
|
|
41
|
+
props: {
|
|
42
|
+
children: [
|
|
43
|
+
{
|
|
44
|
+
type: 'TabsTrigger',
|
|
45
|
+
props: { value: 'account', children: 'Account' },
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
type: 'TabsTrigger',
|
|
49
|
+
props: { value: 'password', children: 'Password' },
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
type: 'TabsTrigger',
|
|
53
|
+
props: { value: 'settings', children: 'Settings' },
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
type: 'TabsContent',
|
|
60
|
+
props: {
|
|
61
|
+
value: 'account',
|
|
62
|
+
children: {
|
|
63
|
+
type: 'p',
|
|
64
|
+
props: { children: 'Make changes to your account here.' },
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
type: 'TabsContent',
|
|
70
|
+
props: {
|
|
71
|
+
value: 'password',
|
|
72
|
+
children: {
|
|
73
|
+
type: 'p',
|
|
74
|
+
props: { children: 'Change your password here.' },
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
type: 'TabsContent',
|
|
80
|
+
props: {
|
|
81
|
+
value: 'settings',
|
|
82
|
+
children: {
|
|
83
|
+
type: 'p',
|
|
84
|
+
props: { children: 'Manage your settings here.' },
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: 'Vertical',
|
|
94
|
+
description: 'Tabs with vertical layout',
|
|
95
|
+
code: `<Tabs defaultValue="account" className="w-[400px]" orientation="vertical">
|
|
96
|
+
<TabsList className="grid w-full grid-cols-3">
|
|
97
|
+
<TabsTrigger value="account">Account</TabsTrigger>
|
|
98
|
+
<TabsTrigger value="password">Password</TabsTrigger>
|
|
99
|
+
<TabsTrigger value="settings">Settings</TabsTrigger>
|
|
100
|
+
</TabsList>
|
|
101
|
+
<TabsContent value="account">
|
|
102
|
+
<p>Make changes to your account here.</p>
|
|
103
|
+
</TabsContent>
|
|
104
|
+
<TabsContent value="password">
|
|
105
|
+
<p>Change your password here.</p>
|
|
106
|
+
</TabsContent>
|
|
107
|
+
<TabsContent value="settings">
|
|
108
|
+
<p>Manage your settings here.</p>
|
|
109
|
+
</TabsContent>
|
|
110
|
+
</Tabs>`,
|
|
111
|
+
preview: {
|
|
112
|
+
type: 'component',
|
|
113
|
+
component: 'Tabs',
|
|
114
|
+
props: {
|
|
115
|
+
defaultValue: 'account',
|
|
116
|
+
className: 'w-[400px]',
|
|
117
|
+
orientation: 'vertical',
|
|
118
|
+
children: [
|
|
119
|
+
{
|
|
120
|
+
type: 'TabsList',
|
|
121
|
+
props: {
|
|
122
|
+
className: 'grid w-full grid-cols-3',
|
|
123
|
+
children: [
|
|
124
|
+
{
|
|
125
|
+
type: 'TabsTrigger',
|
|
126
|
+
props: { value: 'account', children: 'Account' },
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
type: 'TabsTrigger',
|
|
130
|
+
props: { value: 'password', children: 'Password' },
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
type: 'TabsTrigger',
|
|
134
|
+
props: { value: 'settings', children: 'Settings' },
|
|
135
|
+
},
|
|
136
|
+
],
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
type: 'TabsContent',
|
|
141
|
+
props: {
|
|
142
|
+
value: 'account',
|
|
143
|
+
children: {
|
|
144
|
+
type: 'p',
|
|
145
|
+
props: { children: 'Make changes to your account here.' },
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
type: 'TabsContent',
|
|
151
|
+
props: {
|
|
152
|
+
value: 'password',
|
|
153
|
+
children: {
|
|
154
|
+
type: 'p',
|
|
155
|
+
props: { children: 'Change your password here.' },
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
type: 'TabsContent',
|
|
161
|
+
props: {
|
|
162
|
+
value: 'settings',
|
|
163
|
+
children: {
|
|
164
|
+
type: 'p',
|
|
165
|
+
props: { children: 'Manage your settings here.' },
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
],
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
name: 'With Icons',
|
|
175
|
+
description: 'Tabs with icons in triggers',
|
|
176
|
+
code: `<Tabs defaultValue="music" className="w-[400px]">
|
|
177
|
+
<TabsList className="grid w-full grid-cols-3">
|
|
178
|
+
<TabsTrigger value="music">
|
|
179
|
+
<MusicIcon className="mr-2 h-4 w-4" />
|
|
180
|
+
Music
|
|
181
|
+
</TabsTrigger>
|
|
182
|
+
<TabsTrigger value="podcasts">
|
|
183
|
+
<PodcastIcon className="mr-2 h-4 w-4" />
|
|
184
|
+
Podcasts
|
|
185
|
+
</TabsTrigger>
|
|
186
|
+
<TabsTrigger value="audiobooks">
|
|
187
|
+
<BookOpenIcon className="mr-2 h-4 w-4" />
|
|
188
|
+
Audiobooks
|
|
189
|
+
</TabsTrigger>
|
|
190
|
+
</TabsList>
|
|
191
|
+
<TabsContent value="music">
|
|
192
|
+
<p>Listen to your favorite music.</p>
|
|
193
|
+
</TabsContent>
|
|
194
|
+
<TabsContent value="podcasts">
|
|
195
|
+
<p>Discover new podcasts.</p>
|
|
196
|
+
</TabsContent>
|
|
197
|
+
<TabsContent value="audiobooks">
|
|
198
|
+
<p>Listen to audiobooks.</p>
|
|
199
|
+
</TabsContent>
|
|
200
|
+
</Tabs>`,
|
|
201
|
+
preview: {
|
|
202
|
+
type: 'component',
|
|
203
|
+
component: 'Tabs',
|
|
204
|
+
props: {
|
|
205
|
+
defaultValue: 'music',
|
|
206
|
+
className: 'w-[400px]',
|
|
207
|
+
children: [
|
|
208
|
+
{
|
|
209
|
+
type: 'TabsList',
|
|
210
|
+
props: {
|
|
211
|
+
className: 'grid w-full grid-cols-3',
|
|
212
|
+
children: [
|
|
213
|
+
{
|
|
214
|
+
type: 'TabsTrigger',
|
|
215
|
+
props: { value: 'music', children: 'Music' },
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
type: 'TabsTrigger',
|
|
219
|
+
props: { value: 'podcasts', children: 'Podcasts' },
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
type: 'TabsTrigger',
|
|
223
|
+
props: { value: 'audiobooks', children: 'Audiobooks' },
|
|
224
|
+
},
|
|
225
|
+
],
|
|
226
|
+
},
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
type: 'TabsContent',
|
|
230
|
+
props: {
|
|
231
|
+
value: 'music',
|
|
232
|
+
children: {
|
|
233
|
+
type: 'p',
|
|
234
|
+
props: { children: 'Listen to your favorite music.' },
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
type: 'TabsContent',
|
|
240
|
+
props: {
|
|
241
|
+
value: 'podcasts',
|
|
242
|
+
children: {
|
|
243
|
+
type: 'p',
|
|
244
|
+
props: { children: 'Discover new podcasts.' },
|
|
245
|
+
},
|
|
246
|
+
},
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
type: 'TabsContent',
|
|
250
|
+
props: {
|
|
251
|
+
value: 'audiobooks',
|
|
252
|
+
children: {
|
|
253
|
+
type: 'p',
|
|
254
|
+
props: { children: 'Listen to audiobooks.' },
|
|
255
|
+
},
|
|
256
|
+
},
|
|
257
|
+
},
|
|
258
|
+
],
|
|
259
|
+
},
|
|
260
|
+
},
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
name: 'Disabled',
|
|
264
|
+
description: 'Tabs with disabled tab',
|
|
265
|
+
code: `<Tabs defaultValue="account" className="w-[400px]">
|
|
266
|
+
<TabsList>
|
|
267
|
+
<TabsTrigger value="account">Account</TabsTrigger>
|
|
268
|
+
<TabsTrigger value="password" disabled>Password</TabsTrigger>
|
|
269
|
+
<TabsTrigger value="settings">Settings</TabsTrigger>
|
|
270
|
+
</TabsList>
|
|
271
|
+
<TabsContent value="account">
|
|
272
|
+
<p>Make changes to your account here.</p>
|
|
273
|
+
</TabsContent>
|
|
274
|
+
<TabsContent value="settings">
|
|
275
|
+
<p>Manage your settings here.</p>
|
|
276
|
+
</TabsContent>
|
|
277
|
+
</Tabs>`,
|
|
278
|
+
preview: {
|
|
279
|
+
type: 'component',
|
|
280
|
+
component: 'Tabs',
|
|
281
|
+
props: {
|
|
282
|
+
defaultValue: 'account',
|
|
283
|
+
className: 'w-[400px]',
|
|
284
|
+
children: [
|
|
285
|
+
{
|
|
286
|
+
type: 'TabsList',
|
|
287
|
+
props: {
|
|
288
|
+
children: [
|
|
289
|
+
{
|
|
290
|
+
type: 'TabsTrigger',
|
|
291
|
+
props: { value: 'account', children: 'Account' },
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
type: 'TabsTrigger',
|
|
295
|
+
props: {
|
|
296
|
+
value: 'password',
|
|
297
|
+
disabled: true,
|
|
298
|
+
children: 'Password',
|
|
299
|
+
},
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
type: 'TabsTrigger',
|
|
303
|
+
props: { value: 'settings', children: 'Settings' },
|
|
304
|
+
},
|
|
305
|
+
],
|
|
306
|
+
},
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
type: 'TabsContent',
|
|
310
|
+
props: {
|
|
311
|
+
value: 'account',
|
|
312
|
+
children: {
|
|
313
|
+
type: 'p',
|
|
314
|
+
props: { children: 'Make changes to your account here.' },
|
|
315
|
+
},
|
|
316
|
+
},
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
type: 'TabsContent',
|
|
320
|
+
props: {
|
|
321
|
+
value: 'settings',
|
|
322
|
+
children: {
|
|
323
|
+
type: 'p',
|
|
324
|
+
props: { children: 'Manage your settings here.' },
|
|
325
|
+
},
|
|
326
|
+
},
|
|
327
|
+
},
|
|
328
|
+
],
|
|
329
|
+
},
|
|
330
|
+
},
|
|
331
|
+
},
|
|
332
|
+
],
|
|
333
|
+
dependencies: ['utils'],
|
|
334
|
+
files: ['components/primitives/tabs/index.tsx'],
|
|
335
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
5
|
+
|
|
6
|
+
import { cn } from '@foundrykit/utils';
|
|
7
|
+
|
|
8
|
+
function Tabs({
|
|
9
|
+
className,
|
|
10
|
+
...props
|
|
11
|
+
}: React.ComponentProps<typeof TabsPrimitive.Root>) {
|
|
12
|
+
return (
|
|
13
|
+
<TabsPrimitive.Root
|
|
14
|
+
data-slot='tabs'
|
|
15
|
+
className={cn('flex flex-col gap-2', className)}
|
|
16
|
+
{...props}
|
|
17
|
+
/>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function TabsList({
|
|
22
|
+
className,
|
|
23
|
+
...props
|
|
24
|
+
}: React.ComponentProps<typeof TabsPrimitive.List>) {
|
|
25
|
+
return (
|
|
26
|
+
<TabsPrimitive.List
|
|
27
|
+
data-slot='tabs-list'
|
|
28
|
+
className={cn(
|
|
29
|
+
'bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]',
|
|
30
|
+
className
|
|
31
|
+
)}
|
|
32
|
+
{...props}
|
|
33
|
+
/>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function TabsTrigger({
|
|
38
|
+
className,
|
|
39
|
+
...props
|
|
40
|
+
}: React.ComponentProps<typeof TabsPrimitive.Trigger>) {
|
|
41
|
+
return (
|
|
42
|
+
<TabsPrimitive.Trigger
|
|
43
|
+
data-slot='tabs-trigger'
|
|
44
|
+
className={cn(
|
|
45
|
+
"data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 whitespace-nowrap rounded-md border border-transparent px-2 py-1 text-sm font-medium transition-[color,box-shadow] focus-visible:outline-1 focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
46
|
+
className
|
|
47
|
+
)}
|
|
48
|
+
{...props}
|
|
49
|
+
/>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function TabsContent({
|
|
54
|
+
className,
|
|
55
|
+
...props
|
|
56
|
+
}: React.ComponentProps<typeof TabsPrimitive.Content>) {
|
|
57
|
+
return (
|
|
58
|
+
<TabsPrimitive.Content
|
|
59
|
+
data-slot='tabs-content'
|
|
60
|
+
className={cn('flex-1 outline-none', className)}
|
|
61
|
+
{...props}
|
|
62
|
+
/>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export { Tabs, TabsList, TabsTrigger, TabsContent };
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { ComponentConfig } from '@foundrykit/types';
|
|
2
|
+
|
|
3
|
+
export const textareaConfig: ComponentConfig = {
|
|
4
|
+
name: 'Textarea',
|
|
5
|
+
description: 'Multi-line text input component',
|
|
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="w-full max-w-sm"><textarea class="flex min-h-[80px] w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm placeholder:text-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50" placeholder="Type your message here..."></textarea></div></div>',
|
|
11
|
+
},
|
|
12
|
+
variants: [
|
|
13
|
+
{
|
|
14
|
+
name: 'Default',
|
|
15
|
+
description: 'Basic textarea with default styling',
|
|
16
|
+
code: '<Textarea placeholder="Type your message here..." />',
|
|
17
|
+
preview: {
|
|
18
|
+
type: 'component',
|
|
19
|
+
component: 'Textarea',
|
|
20
|
+
props: { placeholder: 'Type your message here...' },
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: 'With Label',
|
|
25
|
+
description: 'Textarea with associated label',
|
|
26
|
+
code: `<div class="grid w-full gap-1.5">
|
|
27
|
+
<Label htmlFor="message">Your message</Label>
|
|
28
|
+
<Textarea placeholder="Type your message here." id="message" />
|
|
29
|
+
</div>`,
|
|
30
|
+
preview: {
|
|
31
|
+
type: 'component',
|
|
32
|
+
component: 'Textarea',
|
|
33
|
+
props: { placeholder: 'Type your message here.', id: 'message' },
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: 'With Value',
|
|
38
|
+
description: 'Textarea with pre-filled content',
|
|
39
|
+
code: `<Textarea
|
|
40
|
+
placeholder="Type your message here..."
|
|
41
|
+
defaultValue="This is a pre-filled message that demonstrates how the textarea looks with content."
|
|
42
|
+
/>`,
|
|
43
|
+
preview: {
|
|
44
|
+
type: 'component',
|
|
45
|
+
component: 'Textarea',
|
|
46
|
+
props: {
|
|
47
|
+
placeholder: 'Type your message here...',
|
|
48
|
+
defaultValue:
|
|
49
|
+
'This is a pre-filled message that demonstrates how the textarea looks with content.',
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: 'Disabled',
|
|
55
|
+
description: 'Disabled textarea',
|
|
56
|
+
code: `<div class="grid w-full gap-1.5">
|
|
57
|
+
<Label htmlFor="disabled">Disabled field</Label>
|
|
58
|
+
<Textarea
|
|
59
|
+
placeholder="This field is disabled"
|
|
60
|
+
id="disabled"
|
|
61
|
+
disabled
|
|
62
|
+
/>
|
|
63
|
+
</div>`,
|
|
64
|
+
preview: {
|
|
65
|
+
type: 'component',
|
|
66
|
+
component: 'Textarea',
|
|
67
|
+
props: {
|
|
68
|
+
placeholder: 'This field is disabled',
|
|
69
|
+
id: 'disabled',
|
|
70
|
+
disabled: true,
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: 'Resizable',
|
|
76
|
+
description: 'Textarea with resize functionality',
|
|
77
|
+
code: `<Textarea
|
|
78
|
+
placeholder="This textarea can be resized by dragging the corner..."
|
|
79
|
+
className="resize"
|
|
80
|
+
/>`,
|
|
81
|
+
preview: {
|
|
82
|
+
type: 'component',
|
|
83
|
+
component: 'Textarea',
|
|
84
|
+
props: {
|
|
85
|
+
placeholder: 'This textarea can be resized by dragging the corner...',
|
|
86
|
+
className: 'resize',
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: 'With Character Count',
|
|
92
|
+
description: 'Textarea with character limit and counter',
|
|
93
|
+
code: `<div class="grid w-full gap-1.5">
|
|
94
|
+
<Label htmlFor="limited">Message (max 280 characters)</Label>
|
|
95
|
+
<Textarea
|
|
96
|
+
placeholder="Type your message here..."
|
|
97
|
+
id="limited"
|
|
98
|
+
maxLength={280}
|
|
99
|
+
/>
|
|
100
|
+
<p class="text-sm text-muted-foreground">
|
|
101
|
+
You can type up to 280 characters in this field.
|
|
102
|
+
</p>
|
|
103
|
+
</div>`,
|
|
104
|
+
preview: {
|
|
105
|
+
type: 'component',
|
|
106
|
+
component: 'Textarea',
|
|
107
|
+
props: {
|
|
108
|
+
placeholder: 'Type your message here...',
|
|
109
|
+
id: 'limited',
|
|
110
|
+
maxLength: 280,
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
dependencies: ['utils', 'label'],
|
|
116
|
+
files: ['components/primitives/textarea/index.tsx'],
|
|
117
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import { cn } from '@foundrykit/utils';
|
|
4
|
+
|
|
5
|
+
function Textarea({ className, ...props }: React.ComponentProps<'textarea'>) {
|
|
6
|
+
return (
|
|
7
|
+
<textarea
|
|
8
|
+
data-slot='textarea'
|
|
9
|
+
className={cn(
|
|
10
|
+
'border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 field-sizing-content shadow-xs flex min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base outline-none transition-[color,box-shadow] focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',
|
|
11
|
+
className
|
|
12
|
+
)}
|
|
13
|
+
{...props}
|
|
14
|
+
/>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { Textarea };
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// Export all primitives
|
|
2
|
+
export { Button, buttonVariants } from './components/button/index.js';
|
|
3
|
+
export { Input } from './components/input/index.js';
|
|
4
|
+
export { Badge, badgeVariants } from './components/badge/index.js';
|
|
5
|
+
export {
|
|
6
|
+
Card,
|
|
7
|
+
CardHeader,
|
|
8
|
+
CardFooter,
|
|
9
|
+
CardTitle,
|
|
10
|
+
CardDescription,
|
|
11
|
+
CardContent,
|
|
12
|
+
} from './components/card/index.js';
|
|
13
|
+
export {
|
|
14
|
+
Avatar,
|
|
15
|
+
AvatarImage,
|
|
16
|
+
AvatarFallback,
|
|
17
|
+
} from './components/avatar/index.js';
|
|
18
|
+
export {
|
|
19
|
+
Breadcrumb,
|
|
20
|
+
BreadcrumbList,
|
|
21
|
+
BreadcrumbItem,
|
|
22
|
+
BreadcrumbLink,
|
|
23
|
+
BreadcrumbPage,
|
|
24
|
+
BreadcrumbSeparator,
|
|
25
|
+
BreadcrumbEllipsis,
|
|
26
|
+
} from './components/breadcrumb/index.js';
|
|
27
|
+
export { Checkbox } from './components/checkbox/index.js';
|
|
28
|
+
export {
|
|
29
|
+
DropdownMenu,
|
|
30
|
+
DropdownMenuPortal,
|
|
31
|
+
DropdownMenuTrigger,
|
|
32
|
+
DropdownMenuContent,
|
|
33
|
+
DropdownMenuGroup,
|
|
34
|
+
DropdownMenuLabel,
|
|
35
|
+
DropdownMenuItem,
|
|
36
|
+
DropdownMenuCheckboxItem,
|
|
37
|
+
DropdownMenuRadioGroup,
|
|
38
|
+
DropdownMenuRadioItem,
|
|
39
|
+
DropdownMenuSeparator,
|
|
40
|
+
DropdownMenuShortcut,
|
|
41
|
+
DropdownMenuSub,
|
|
42
|
+
DropdownMenuSubTrigger,
|
|
43
|
+
DropdownMenuSubContent,
|
|
44
|
+
} from './components/dropdown/index.js';
|
|
45
|
+
export { Label } from './components/label/index.js';
|
|
46
|
+
export {
|
|
47
|
+
Select,
|
|
48
|
+
SelectContent,
|
|
49
|
+
SelectGroup,
|
|
50
|
+
SelectItem,
|
|
51
|
+
SelectLabel,
|
|
52
|
+
SelectScrollDownButton,
|
|
53
|
+
SelectScrollUpButton,
|
|
54
|
+
SelectSeparator,
|
|
55
|
+
SelectTrigger,
|
|
56
|
+
SelectValue,
|
|
57
|
+
} from './components/select/index.js';
|
|
58
|
+
export { RadioGroup, RadioGroupItem } from './components/radio-group/index.js';
|
|
59
|
+
export { Separator } from './components/separator/index.js';
|
|
60
|
+
export { Switch } from './components/switch/index.js';
|
|
61
|
+
export {
|
|
62
|
+
Tabs,
|
|
63
|
+
TabsList,
|
|
64
|
+
TabsTrigger,
|
|
65
|
+
TabsContent,
|
|
66
|
+
} from './components/tabs/index.js';
|
|
67
|
+
export { Textarea } from './components/textarea/index.js';
|
|
68
|
+
export { Skeleton } from './components/skeleton/index.js';
|
|
69
|
+
export {
|
|
70
|
+
Popover,
|
|
71
|
+
PopoverTrigger,
|
|
72
|
+
PopoverContent,
|
|
73
|
+
PopoverAnchor,
|
|
74
|
+
} from './components/popover/index.js';
|
|
75
|
+
export {
|
|
76
|
+
Dialog,
|
|
77
|
+
DialogTrigger,
|
|
78
|
+
DialogContent,
|
|
79
|
+
DialogHeader,
|
|
80
|
+
DialogFooter,
|
|
81
|
+
DialogTitle,
|
|
82
|
+
DialogDescription,
|
|
83
|
+
DialogClose,
|
|
84
|
+
} from './components/dialog/index.js';
|
|
85
|
+
|
|
86
|
+
// Export utilities from utils package
|
|
87
|
+
export { cn } from '@foundrykit/utils';
|
package/tsconfig.json
ADDED
package/tsup.config.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { defineConfig } from 'tsup';
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
entry: [
|
|
5
|
+
'src/index.ts',
|
|
6
|
+
'src/components/button/index.tsx',
|
|
7
|
+
'src/components/input/index.tsx',
|
|
8
|
+
'src/components/badge/index.tsx',
|
|
9
|
+
'src/components/card/index.tsx',
|
|
10
|
+
'src/components/avatar/index.tsx',
|
|
11
|
+
'src/components/breadcrumb/index.tsx',
|
|
12
|
+
'src/components/checkbox/index.tsx',
|
|
13
|
+
'src/components/dropdown/index.tsx',
|
|
14
|
+
'src/components/label/index.tsx',
|
|
15
|
+
'src/components/select/index.tsx',
|
|
16
|
+
'src/components/radio-group/index.tsx',
|
|
17
|
+
'src/components/separator/index.tsx',
|
|
18
|
+
'src/components/switch/index.tsx',
|
|
19
|
+
'src/components/tabs/index.tsx',
|
|
20
|
+
'src/components/textarea/index.tsx',
|
|
21
|
+
'src/components/skeleton/index.tsx',
|
|
22
|
+
'src/components/popover/index.tsx',
|
|
23
|
+
],
|
|
24
|
+
format: ['esm'],
|
|
25
|
+
dts: true,
|
|
26
|
+
external: ['react', 'react-dom'],
|
|
27
|
+
clean: true,
|
|
28
|
+
outDir: 'dist',
|
|
29
|
+
});
|