@foundrykit/primitives 2.0.9 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/dist/{chunk-HS46TIMU.js → chunk-2UG6OCGA.js} +1 -1
  2. package/dist/chunk-3NQR7JZR.js +128 -0
  3. package/dist/{chunk-XCPGTXEJ.js → chunk-5RFGKG4K.js} +1 -1
  4. package/dist/chunk-B5YCE3UP.js +57 -0
  5. package/dist/chunk-F2TEA6ER.js +138 -0
  6. package/dist/{chunk-46UI3AUE.js → chunk-SEDTBIZW.js} +3 -3
  7. package/dist/chunk-SIQHWNPH.js +45 -0
  8. package/dist/chunk-STRBREHN.js +17 -0
  9. package/dist/components/button/index.cjs +3 -3
  10. package/dist/components/button/index.js +1 -1
  11. package/dist/components/card/index.cjs +1 -1
  12. package/dist/components/card/index.js +1 -1
  13. package/dist/components/dialog/index.cjs +182 -0
  14. package/dist/components/dialog/index.d.cts +38 -0
  15. package/dist/components/dialog/index.d.ts +38 -0
  16. package/dist/components/dialog/index.js +25 -0
  17. package/dist/components/input/index.cjs +1 -1
  18. package/dist/components/input/index.js +1 -1
  19. package/dist/components/input-group/index.cjs +270 -0
  20. package/dist/components/input-group/index.d.cts +44 -0
  21. package/dist/components/input-group/index.d.ts +44 -0
  22. package/dist/components/input-group/index.js +153 -0
  23. package/dist/components/section/index.cjs +41 -0
  24. package/dist/components/section/index.d.cts +27 -0
  25. package/dist/components/section/index.d.ts +27 -0
  26. package/dist/components/section/index.js +6 -0
  27. package/dist/components/sheet/index.cjs +170 -0
  28. package/dist/components/sheet/index.d.cts +31 -0
  29. package/dist/components/sheet/index.d.ts +31 -0
  30. package/dist/components/sheet/index.js +21 -0
  31. package/dist/components/toggle/index.cjs +81 -0
  32. package/dist/components/toggle/index.d.cts +26 -0
  33. package/dist/components/toggle/index.d.ts +26 -0
  34. package/dist/components/toggle/index.js +9 -0
  35. package/dist/components/tooltip/index.cjs +95 -0
  36. package/dist/components/tooltip/index.d.cts +25 -0
  37. package/dist/components/tooltip/index.d.ts +25 -0
  38. package/dist/components/tooltip/index.js +13 -0
  39. package/dist/index.cjs +112 -96
  40. package/dist/index.d.cts +12 -105
  41. package/dist/index.d.ts +12 -105
  42. package/dist/index.js +104 -406
  43. package/package.json +206 -10
  44. package/CHANGELOG.md +0 -230
  45. package/postcss.config.mjs +0 -6
  46. package/registry.json +0 -64
  47. package/src/components/accordion/config.ts +0 -28
  48. package/src/components/accordion/index.tsx +0 -80
  49. package/src/components/alert/config.ts +0 -40
  50. package/src/components/alert/index.tsx +0 -80
  51. package/src/components/alert-dialog/config.ts +0 -28
  52. package/src/components/alert-dialog/index.tsx +0 -188
  53. package/src/components/aspect-ratio/config.ts +0 -27
  54. package/src/components/aspect-ratio/index.tsx +0 -24
  55. package/src/components/avatar/config.ts +0 -46
  56. package/src/components/avatar/index.tsx +0 -67
  57. package/src/components/badge/config.ts +0 -56
  58. package/src/components/badge/index.tsx +0 -56
  59. package/src/components/breadcrumb/config.ts +0 -121
  60. package/src/components/breadcrumb/index.tsx +0 -127
  61. package/src/components/button/config.ts +0 -97
  62. package/src/components/button/index.tsx +0 -86
  63. package/src/components/button-group/config.ts +0 -39
  64. package/src/components/button-group/index.tsx +0 -99
  65. package/src/components/card/config.ts +0 -89
  66. package/src/components/card/index.tsx +0 -90
  67. package/src/components/checkbox/config.ts +0 -46
  68. package/src/components/checkbox/index.tsx +0 -41
  69. package/src/components/collapsible/config.ts +0 -27
  70. package/src/components/collapsible/index.tsx +0 -47
  71. package/src/components/context-menu/config.ts +0 -28
  72. package/src/components/context-menu/index.tsx +0 -271
  73. package/src/components/dialog/config.ts +0 -582
  74. package/src/components/dialog/index.tsx +0 -162
  75. package/src/components/direction/config.ts +0 -28
  76. package/src/components/direction/index.tsx +0 -27
  77. package/src/components/drawer/config.ts +0 -28
  78. package/src/components/drawer/index.tsx +0 -153
  79. package/src/components/dropdown/config.ts +0 -262
  80. package/src/components/dropdown/index.tsx +0 -280
  81. package/src/components/empty/config.ts +0 -38
  82. package/src/components/empty/index.tsx +0 -127
  83. package/src/components/field/config.ts +0 -40
  84. package/src/components/field/index.tsx +0 -252
  85. package/src/components/hover-card/config.ts +0 -27
  86. package/src/components/hover-card/index.tsx +0 -56
  87. package/src/components/input/config.ts +0 -64
  88. package/src/components/input/index.tsx +0 -32
  89. package/src/components/input-group/config.ts +0 -209
  90. package/src/components/input-group/index.tsx +0 -177
  91. package/src/components/item/config.ts +0 -52
  92. package/src/components/item/index.tsx +0 -215
  93. package/src/components/kbd/config.ts +0 -38
  94. package/src/components/kbd/index.tsx +0 -40
  95. package/src/components/label/config.ts +0 -72
  96. package/src/components/label/index.tsx +0 -32
  97. package/src/components/menubar/config.ts +0 -28
  98. package/src/components/menubar/index.tsx +0 -295
  99. package/src/components/native-select/config.ts +0 -40
  100. package/src/components/native-select/index.tsx +0 -40
  101. package/src/components/navigation-menu/config.ts +0 -32
  102. package/src/components/navigation-menu/index.tsx +0 -188
  103. package/src/components/popover/config.ts +0 -222
  104. package/src/components/popover/index.tsx +0 -60
  105. package/src/components/progress/config.ts +0 -42
  106. package/src/components/progress/index.tsx +0 -39
  107. package/src/components/radio-group/config.ts +0 -303
  108. package/src/components/radio-group/index.tsx +0 -58
  109. package/src/components/resizable/config.ts +0 -28
  110. package/src/components/resizable/index.tsx +0 -67
  111. package/src/components/scroll-area/config.ts +0 -17
  112. package/src/components/scroll-area/index.tsx +0 -70
  113. package/src/components/select/config.ts +0 -277
  114. package/src/components/select/index.tsx +0 -202
  115. package/src/components/separator/config.ts +0 -63
  116. package/src/components/separator/index.tsx +0 -38
  117. package/src/components/sheet/config.ts +0 -16
  118. package/src/components/sheet/index.tsx +0 -153
  119. package/src/components/skeleton/config.ts +0 -77
  120. package/src/components/skeleton/index.tsx +0 -22
  121. package/src/components/slider/config.ts +0 -46
  122. package/src/components/slider/index.tsx +0 -76
  123. package/src/components/sonner/config.ts +0 -27
  124. package/src/components/sonner/index.tsx +0 -37
  125. package/src/components/spinner/config.ts +0 -40
  126. package/src/components/spinner/index.tsx +0 -30
  127. package/src/components/switch/config.ts +0 -171
  128. package/src/components/switch/index.tsx +0 -40
  129. package/src/components/table/config.ts +0 -38
  130. package/src/components/table/index.tsx +0 -135
  131. package/src/components/tabs/config.ts +0 -335
  132. package/src/components/tabs/index.tsx +0 -82
  133. package/src/components/textarea/config.ts +0 -117
  134. package/src/components/textarea/index.tsx +0 -26
  135. package/src/components/toggle/config.ts +0 -67
  136. package/src/components/toggle/index.tsx +0 -59
  137. package/src/components/toggle-group/config.ts +0 -46
  138. package/src/components/toggle-group/index.tsx +0 -106
  139. package/src/components/tooltip/config.ts +0 -16
  140. package/src/components/tooltip/index.tsx +0 -75
  141. package/src/components/typography/config.ts +0 -38
  142. package/src/components/typography/index.tsx +0 -172
  143. package/src/index.ts +0 -291
  144. package/tsconfig.json +0 -9
  145. package/tsconfig.lint.json +0 -8
  146. package/tsup.config.ts +0 -55
@@ -1,335 +0,0 @@
1
- import type { 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
- };
@@ -1,82 +0,0 @@
1
- 'use client';
2
-
3
- import { cn } from '@foundrykit/utils';
4
- import * as TabsPrimitive from '@radix-ui/react-tabs';
5
- import type * as React from 'react';
6
-
7
- /**
8
- * Tabbed interface root built on Radix `Tabs.Root`. Compose with
9
- * {@link TabsList} containing {@link TabsTrigger}s and matching
10
- * {@link TabsContent} panels; manage the active tab via Radix
11
- * `value`/`defaultValue`/`onValueChange`.
12
- *
13
- * @example
14
- * ```tsx
15
- * <Tabs defaultValue="a">
16
- * <TabsList>
17
- * <TabsTrigger value="a">A</TabsTrigger>
18
- * <TabsTrigger value="b">B</TabsTrigger>
19
- * </TabsList>
20
- * <TabsContent value="a">Panel A</TabsContent>
21
- * </Tabs>
22
- * ```
23
- */
24
- function Tabs({
25
- className,
26
- ...props
27
- }: React.ComponentProps<typeof TabsPrimitive.Root>) {
28
- return (
29
- <TabsPrimitive.Root
30
- data-slot='tabs'
31
- className={cn('flex flex-col gap-2', className)}
32
- {...props}
33
- />
34
- );
35
- }
36
-
37
- function TabsList({
38
- className,
39
- ...props
40
- }: React.ComponentProps<typeof TabsPrimitive.List>) {
41
- return (
42
- <TabsPrimitive.List
43
- data-slot='tabs-list'
44
- className={cn(
45
- 'bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]',
46
- className
47
- )}
48
- {...props}
49
- />
50
- );
51
- }
52
-
53
- function TabsTrigger({
54
- className,
55
- ...props
56
- }: React.ComponentProps<typeof TabsPrimitive.Trigger>) {
57
- return (
58
- <TabsPrimitive.Trigger
59
- data-slot='tabs-trigger'
60
- className={cn(
61
- "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 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
62
- className
63
- )}
64
- {...props}
65
- />
66
- );
67
- }
68
-
69
- function TabsContent({
70
- className,
71
- ...props
72
- }: React.ComponentProps<typeof TabsPrimitive.Content>) {
73
- return (
74
- <TabsPrimitive.Content
75
- data-slot='tabs-content'
76
- className={cn('flex-1 outline-none', className)}
77
- {...props}
78
- />
79
- );
80
- }
81
-
82
- export { Tabs, TabsContent, TabsList, TabsTrigger };
@@ -1,117 +0,0 @@
1
- import type { 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
- };
@@ -1,26 +0,0 @@
1
- import { cn } from '@foundrykit/utils';
2
- import type * as React from 'react';
3
-
4
- /**
5
- * Styled multi-line text input wrapping the native `<textarea>`. Auto-sizes to
6
- * content and includes focus-ring, disabled and `aria-invalid` styling.
7
- *
8
- * @example
9
- * ```tsx
10
- * <Textarea placeholder="Write a message" />
11
- * ```
12
- */
13
- function Textarea({ className, ...props }: React.ComponentProps<'textarea'>) {
14
- return (
15
- <textarea
16
- data-slot='textarea'
17
- className={cn(
18
- '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 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',
19
- className
20
- )}
21
- {...props}
22
- />
23
- );
24
- }
25
-
26
- export { Textarea };
@@ -1,67 +0,0 @@
1
- import type { ComponentConfig } from '@foundrykit/types';
2
-
3
- export const ToggleConfig: ComponentConfig = {
4
- name: 'Toggle',
5
- description: 'Toggle component',
6
- category: 'primitives',
7
- tags: ['toggle', 'input', 'form'],
8
- preview: {
9
- type: 'static',
10
- html: '<div class="flex h-12 w-full items-center rounded-md border border-gray-300 bg-gray-100 px-3"><div class="h-3 w-3 rounded-full border border-gray-400"></div><div class="h-2 w-12 rounded bg-gray-400"></div></div>',
11
- },
12
- variants: [
13
- {
14
- name: 'Default',
15
- description: 'Default toggle',
16
- code: '<Toggle />',
17
- preview: {
18
- type: 'component',
19
- component: 'Toggle',
20
- props: {},
21
- },
22
- },
23
- {
24
- name: 'Checked',
25
- description: 'Checked toggle',
26
- code: '<Toggle checked />',
27
- preview: {
28
- type: 'component',
29
- component: 'Toggle',
30
- props: {
31
- checked: true,
32
- },
33
- },
34
- },
35
- {
36
- name: 'Disabled',
37
- description: 'Disabled toggle',
38
- code: '<Toggle disabled />',
39
- preview: {
40
- type: 'component',
41
- component: 'Toggle',
42
- props: {
43
- disabled: true,
44
- },
45
- },
46
- },
47
- {
48
- name: 'Custom Style',
49
- description: 'Toggle with custom styling',
50
- code: '<Toggle className="h-12 text-lg" />',
51
- preview: {
52
- type: 'component',
53
- component: 'Toggle',
54
- props: {
55
- className: 'h-12 text-lg',
56
- },
57
- },
58
- },
59
- ],
60
- dependencies: ['utils'],
61
- packageDependencies: [
62
- 'lucide-react',
63
- '@radix-ui/react-toggle',
64
- 'class-variance-authority',
65
- ],
66
- files: ['components/primitives/toggle/index.tsx'],
67
- };
@@ -1,59 +0,0 @@
1
- 'use client';
2
-
3
- import { cn } from '@foundrykit/utils';
4
- import * as TogglePrimitive from '@radix-ui/react-toggle';
5
- import { cva, type VariantProps } from 'class-variance-authority';
6
- import type * as React from 'react';
7
-
8
- const toggleVariants = cva(
9
- "hover:bg-muted hover:text-muted-foreground data-[state=on]:bg-accent data-[state=on]:text-accent-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 inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
10
- {
11
- variants: {
12
- variant: {
13
- default: 'bg-transparent',
14
- outline:
15
- 'border-input hover:bg-accent hover:text-accent-foreground border bg-transparent shadow-xs',
16
- },
17
- size: {
18
- default: 'h-9 min-w-9 px-2',
19
- sm: 'h-8 min-w-8 px-1.5',
20
- lg: 'h-10 min-w-10 px-2.5',
21
- },
22
- },
23
- defaultVariants: {
24
- variant: 'default',
25
- size: 'default',
26
- },
27
- }
28
- );
29
-
30
- /**
31
- * Two-state toggle button built on Radix `Toggle.Root`, styled via
32
- * {@link toggleVariants} with a `variant` (default, outline) and `size`
33
- * (default, sm, lg). Control the pressed state with Radix
34
- * `pressed`/`onPressedChange`.
35
- *
36
- * @example
37
- * ```tsx
38
- * <Toggle variant="outline" pressed={bold} onPressedChange={setBold}>
39
- * <BoldIcon />
40
- * </Toggle>
41
- * ```
42
- */
43
- function Toggle({
44
- className,
45
- variant,
46
- size,
47
- ...props
48
- }: React.ComponentProps<typeof TogglePrimitive.Root> &
49
- VariantProps<typeof toggleVariants>) {
50
- return (
51
- <TogglePrimitive.Root
52
- data-slot='toggle'
53
- className={cn(toggleVariants({ variant, size, className }))}
54
- {...props}
55
- />
56
- );
57
- }
58
-
59
- export { Toggle, toggleVariants };