@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,252 +0,0 @@
1
- 'use client';
2
-
3
- import { cn } from '@foundrykit/utils';
4
- import * as LabelPrimitive from '@radix-ui/react-label';
5
- import { cva, type VariantProps } from 'class-variance-authority';
6
- import * as React from 'react';
7
-
8
- /**
9
- * Field is a composable form-layout primitive. Group related controls with
10
- * {@link FieldGroup}/{@link FieldSet}, then wrap each control in a {@link Field}
11
- * alongside {@link FieldLabel}, {@link FieldDescription} and {@link FieldError}
12
- * to get consistent spacing, orientation and validation styling.
13
- *
14
- * @example
15
- * ```tsx
16
- * <Field>
17
- * <FieldLabel htmlFor="email">Email</FieldLabel>
18
- * <input id="email" type="email" />
19
- * <FieldDescription>We'll never share your email.</FieldDescription>
20
- * </Field>
21
- * ```
22
- */
23
- const fieldVariants = cva(
24
- 'group/field data-[invalid=true]:text-destructive flex w-full gap-3',
25
- {
26
- variants: {
27
- orientation: {
28
- vertical: ['flex-col [&>*]:w-full [&>.sr-only]:w-auto'],
29
- horizontal: [
30
- 'flex-row items-center',
31
- '[&>[data-slot=field-label]]:flex-auto',
32
- 'has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox]]:mt-px has-[>[data-slot=field-content]]:[&>[role=radio]]:mt-px',
33
- ],
34
- responsive: [
35
- 'flex-col @md/field-group:flex-row @md/field-group:items-center [&>*]:w-full @md/field-group:[&>*]:w-auto [&>.sr-only]:w-auto',
36
- '@md/field-group:[&>[data-slot=field-label]]:flex-auto',
37
- '@md/field-group:has-[>[data-slot=field-content]]:items-start',
38
- ],
39
- },
40
- },
41
- defaultVariants: {
42
- orientation: 'vertical',
43
- },
44
- }
45
- );
46
-
47
- function Field({
48
- className,
49
- orientation = 'vertical',
50
- ...props
51
- }: React.ComponentProps<'div'> & VariantProps<typeof fieldVariants>) {
52
- return (
53
- <div
54
- role='group'
55
- data-slot='field'
56
- data-orientation={orientation}
57
- className={cn(fieldVariants({ orientation }), className)}
58
- {...props}
59
- />
60
- );
61
- }
62
-
63
- function FieldSet({ className, ...props }: React.ComponentProps<'fieldset'>) {
64
- return (
65
- <fieldset
66
- data-slot='field-set'
67
- className={cn(
68
- 'flex flex-col gap-6',
69
- 'has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3',
70
- className
71
- )}
72
- {...props}
73
- />
74
- );
75
- }
76
-
77
- function FieldLegend({
78
- className,
79
- variant = 'legend',
80
- ...props
81
- }: React.ComponentProps<'legend'> & { variant?: 'legend' | 'label' }) {
82
- return (
83
- <legend
84
- data-slot='field-legend'
85
- data-variant={variant}
86
- className={cn(
87
- 'mb-3 font-medium',
88
- 'data-[variant=legend]:text-base',
89
- 'data-[variant=label]:text-sm',
90
- className
91
- )}
92
- {...props}
93
- />
94
- );
95
- }
96
-
97
- function FieldGroup({ className, ...props }: React.ComponentProps<'div'>) {
98
- return (
99
- <div
100
- data-slot='field-group'
101
- className={cn(
102
- 'group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4',
103
- className
104
- )}
105
- {...props}
106
- />
107
- );
108
- }
109
-
110
- function FieldContent({ className, ...props }: React.ComponentProps<'div'>) {
111
- return (
112
- <div
113
- data-slot='field-content'
114
- className={cn(
115
- 'group/field-content flex flex-1 flex-col gap-1.5 leading-snug',
116
- className
117
- )}
118
- {...props}
119
- />
120
- );
121
- }
122
-
123
- function FieldLabel({
124
- className,
125
- ...props
126
- }: React.ComponentProps<typeof LabelPrimitive.Root>) {
127
- return (
128
- <LabelPrimitive.Root
129
- data-slot='field-label'
130
- className={cn(
131
- 'group/field-label peer/field-label flex w-fit gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50',
132
- 'has-[[data-slot=field]]:w-full has-[[data-slot=field]]:flex-col has-[[data-slot=field]]:rounded-md has-[[data-slot=field]]:border',
133
- className
134
- )}
135
- {...props}
136
- />
137
- );
138
- }
139
-
140
- function FieldTitle({ className, ...props }: React.ComponentProps<'div'>) {
141
- return (
142
- <div
143
- data-slot='field-title'
144
- className={cn(
145
- 'flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50',
146
- className
147
- )}
148
- {...props}
149
- />
150
- );
151
- }
152
-
153
- function FieldDescription({ className, ...props }: React.ComponentProps<'p'>) {
154
- return (
155
- <p
156
- data-slot='field-description'
157
- className={cn(
158
- 'text-muted-foreground text-sm leading-normal font-normal group-has-[[data-orientation=horizontal]]/field:text-balance',
159
- 'last:mt-0 [[data-variant=legend]+&]:-mt-1.5',
160
- '[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4',
161
- className
162
- )}
163
- {...props}
164
- />
165
- );
166
- }
167
-
168
- function FieldSeparator({
169
- children,
170
- className,
171
- ...props
172
- }: React.ComponentProps<'div'>) {
173
- return (
174
- <div
175
- data-slot='field-separator'
176
- data-content={!!children}
177
- className={cn('relative -my-2 h-5 text-sm', className)}
178
- {...props}
179
- >
180
- <div className='bg-border absolute inset-0 top-1/2 h-px' />
181
- {children && (
182
- <span
183
- className='bg-background text-muted-foreground relative mx-auto block w-fit px-2'
184
- data-slot='field-separator-content'
185
- >
186
- {children}
187
- </span>
188
- )}
189
- </div>
190
- );
191
- }
192
-
193
- function FieldError({
194
- className,
195
- children,
196
- errors,
197
- ...props
198
- }: React.ComponentProps<'div'> & {
199
- errors?: Array<{ message?: string } | undefined>;
200
- }) {
201
- const content = React.useMemo(() => {
202
- if (children) {
203
- return children;
204
- }
205
-
206
- if (!errors) {
207
- return null;
208
- }
209
-
210
- if (errors.length === 1 && errors[0]?.message) {
211
- return errors[0].message;
212
- }
213
-
214
- return (
215
- <ul className='ml-4 flex list-disc flex-col gap-1'>
216
- {errors.map(
217
- (error, index) =>
218
- error?.message && <li key={index}>{error.message}</li>
219
- )}
220
- </ul>
221
- );
222
- }, [children, errors]);
223
-
224
- if (!content) {
225
- return null;
226
- }
227
-
228
- return (
229
- <div
230
- role='alert'
231
- data-slot='field-error'
232
- className={cn('text-destructive text-sm font-normal', className)}
233
- {...props}
234
- >
235
- {content}
236
- </div>
237
- );
238
- }
239
-
240
- export {
241
- Field,
242
- FieldContent,
243
- FieldDescription,
244
- FieldError,
245
- FieldGroup,
246
- FieldLabel,
247
- FieldLegend,
248
- FieldSeparator,
249
- FieldSet,
250
- FieldTitle,
251
- fieldVariants,
252
- };
@@ -1,27 +0,0 @@
1
- import type { ComponentConfig } from '@foundrykit/types';
2
-
3
- export const HoverCardConfig: ComponentConfig = {
4
- name: 'Hover Card',
5
- description: 'For sighted users to preview content available behind a link.',
6
- category: 'primitives',
7
- tags: ['hover-card', 'overlay', 'popover', 'interactive'],
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"><span class="text-sm text-gray-600">Hover Card</span></div>',
11
- },
12
- variants: [
13
- {
14
- name: 'Default',
15
- description: 'Default hover card',
16
- code: '<HoverCard>...</HoverCard>',
17
- preview: {
18
- type: 'component',
19
- component: 'HoverCard',
20
- props: {},
21
- },
22
- },
23
- ],
24
- dependencies: ['utils'],
25
- packageDependencies: ['@radix-ui/react-hover-card'],
26
- files: ['components/primitives/hover-card/index.tsx'],
27
- };
@@ -1,56 +0,0 @@
1
- 'use client';
2
-
3
- import { cn } from '@foundrykit/utils';
4
- import * as HoverCardPrimitive from '@radix-ui/react-hover-card';
5
- import type * as React from 'react';
6
-
7
- /**
8
- * Hover card root built on Radix `HoverCard.Root` for sighted users to preview
9
- * content available behind a link. Compose with {@link HoverCardTrigger} and
10
- * {@link HoverCardContent}.
11
- *
12
- * @example
13
- * ```tsx
14
- * <HoverCard>
15
- * <HoverCardTrigger>@nextjs</HoverCardTrigger>
16
- * <HoverCardContent>The React Framework.</HoverCardContent>
17
- * </HoverCard>
18
- * ```
19
- */
20
- function HoverCard({
21
- ...props
22
- }: React.ComponentProps<typeof HoverCardPrimitive.Root>) {
23
- return <HoverCardPrimitive.Root data-slot='hover-card' {...props} />;
24
- }
25
-
26
- function HoverCardTrigger({
27
- ...props
28
- }: React.ComponentProps<typeof HoverCardPrimitive.Trigger>) {
29
- return (
30
- <HoverCardPrimitive.Trigger data-slot='hover-card-trigger' {...props} />
31
- );
32
- }
33
-
34
- function HoverCardContent({
35
- className,
36
- align = 'center',
37
- sideOffset = 4,
38
- ...props
39
- }: React.ComponentProps<typeof HoverCardPrimitive.Content>) {
40
- return (
41
- <HoverCardPrimitive.Portal data-slot='hover-card-portal'>
42
- <HoverCardPrimitive.Content
43
- data-slot='hover-card-content'
44
- align={align}
45
- sideOffset={sideOffset}
46
- className={cn(
47
- 'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden',
48
- className
49
- )}
50
- {...props}
51
- />
52
- </HoverCardPrimitive.Portal>
53
- );
54
- }
55
-
56
- export { HoverCard, HoverCardContent, HoverCardTrigger };
@@ -1,64 +0,0 @@
1
- import type { ComponentConfig } from '@foundrykit/types';
2
-
3
- export const inputConfig: ComponentConfig = {
4
- name: 'Input',
5
- description: 'Form input component with various types and states',
6
- category: 'primitives',
7
- tags: ['form', 'input', 'text'],
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-2 w-16 rounded bg-gray-400"></div></div>',
11
- },
12
- variants: [
13
- {
14
- name: 'Default',
15
- description: 'Default input field',
16
- code: '<Input placeholder="Enter text..." />',
17
- preview: {
18
- type: 'component',
19
- component: 'Input',
20
- props: { placeholder: 'Enter text...' },
21
- },
22
- },
23
- {
24
- name: 'With Label',
25
- description: 'Input with label',
26
- code: '<div><Label htmlFor="email">Email</Label><Input id="email" type="email" /></div>',
27
- preview: {
28
- type: 'component',
29
- component: 'div',
30
- props: {
31
- children: [
32
- {
33
- component: 'Label',
34
- props: { htmlFor: 'email', children: 'Email' },
35
- },
36
- { component: 'Input', props: { id: 'email', type: 'email' } },
37
- ],
38
- },
39
- },
40
- },
41
- {
42
- name: 'Disabled',
43
- description: 'Disabled input state',
44
- code: '<Input disabled placeholder="Disabled" />',
45
- preview: {
46
- type: 'component',
47
- component: 'Input',
48
- props: { disabled: true, placeholder: 'Disabled' },
49
- },
50
- },
51
- {
52
- name: 'Error',
53
- description: 'Input with error state',
54
- code: '<Input className="border-red-500" placeholder="Error state" />',
55
- preview: {
56
- type: 'component',
57
- component: 'Input',
58
- props: { className: 'border-red-500', placeholder: 'Error state' },
59
- },
60
- },
61
- ],
62
- dependencies: ['utils'],
63
- files: ['components/primitives/input/index.tsx'],
64
- };
@@ -1,33 +0,0 @@
1
- import { cn } from '@foundrykit/utils';
2
- import * as React from 'react';
3
-
4
- export type InputProps = React.InputHTMLAttributes<HTMLInputElement>;
5
-
6
- /**
7
- * Styled text input wrapping the native `<input>`; forwards its ref and accepts
8
- * all standard input attributes (including `type`). Includes focus-ring and
9
- * disabled styling.
10
- *
11
- * @example
12
- * ```tsx
13
- * <Input type="email" placeholder="you@example.com" />
14
- * ```
15
- */
16
- const Input = React.forwardRef<HTMLInputElement, InputProps>(
17
- ({ className, type, ...props }, ref) => {
18
- return (
19
- <input
20
- type={type}
21
- className={cn(
22
- 'border-input file:text-foreground placeholder:text-muted-foreground focus-visible:ring-ring flex h-9 w-full rounded-md border bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:ring-1 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50',
23
- className
24
- )}
25
- ref={ref}
26
- {...props}
27
- />
28
- );
29
- }
30
- );
31
- Input.displayName = 'Input';
32
-
33
- export { Input };
@@ -1,209 +0,0 @@
1
- import type { ComponentConfig } from '@foundrykit/types';
2
-
3
- export const inputGroupConfig: ComponentConfig = {
4
- name: 'Input Group',
5
- description:
6
- 'Composable input group with addons, buttons, text, inputs, and textareas',
7
- category: 'primitives',
8
- tags: ['form', 'input', 'interactive'],
9
- preview: {
10
- type: 'static',
11
- html: '<div class="flex h-12 w-full items-center justify-center rounded-md bg-gray-200"><div class="flex h-8 w-full max-w-sm items-center rounded-lg border border-gray-300 bg-white"><div class="px-2 text-sm text-gray-500">@</div><div class="h-2 flex-1 rounded bg-gray-300"></div><div class="px-2 text-xs text-gray-500">.com</div></div></div>',
12
- },
13
- variants: [
14
- {
15
- name: 'Default',
16
- description: 'Input group with a leading text addon',
17
- code: `<InputGroup>
18
- <InputGroupAddon>
19
- <InputGroupText>@</InputGroupText>
20
- </InputGroupAddon>
21
- <InputGroupInput placeholder="Username" />
22
- </InputGroup>`,
23
- preview: {
24
- type: 'component',
25
- component: 'InputGroup',
26
- props: {
27
- children: [
28
- {
29
- type: 'InputGroupAddon',
30
- props: {
31
- children: {
32
- type: 'InputGroupText',
33
- props: { children: '@' },
34
- },
35
- },
36
- },
37
- {
38
- type: 'InputGroupInput',
39
- props: { placeholder: 'Username' },
40
- },
41
- ],
42
- },
43
- },
44
- },
45
- {
46
- name: 'With End Addon',
47
- description: 'Input group with trailing helper text',
48
- code: `<InputGroup>
49
- <InputGroupInput placeholder="company" />
50
- <InputGroupAddon align="inline-end">
51
- <InputGroupText>.com</InputGroupText>
52
- </InputGroupAddon>
53
- </InputGroup>`,
54
- preview: {
55
- type: 'component',
56
- component: 'InputGroup',
57
- props: {
58
- children: [
59
- {
60
- type: 'InputGroupInput',
61
- props: { placeholder: 'company' },
62
- },
63
- {
64
- type: 'InputGroupAddon',
65
- props: {
66
- align: 'inline-end',
67
- children: {
68
- type: 'InputGroupText',
69
- props: { children: '.com' },
70
- },
71
- },
72
- },
73
- ],
74
- },
75
- },
76
- },
77
- {
78
- name: 'With Button',
79
- description: 'Input group with an inline action button',
80
- code: `<InputGroup>
81
- <InputGroupInput type="search" placeholder="Search docs..." />
82
- <InputGroupAddon align="inline-end">
83
- <InputGroupButton>Search</InputGroupButton>
84
- </InputGroupAddon>
85
- </InputGroup>`,
86
- preview: {
87
- type: 'component',
88
- component: 'InputGroup',
89
- props: {
90
- children: [
91
- {
92
- type: 'InputGroupInput',
93
- props: { type: 'search', placeholder: 'Search docs...' },
94
- },
95
- {
96
- type: 'InputGroupAddon',
97
- props: {
98
- align: 'inline-end',
99
- children: {
100
- type: 'InputGroupButton',
101
- props: { children: 'Search' },
102
- },
103
- },
104
- },
105
- ],
106
- },
107
- },
108
- },
109
- {
110
- name: 'Block Addon',
111
- description: 'Input group with an addon above the control',
112
- code: `<InputGroup>
113
- <InputGroupAddon align="block-start">
114
- <InputGroupText>Amount</InputGroupText>
115
- </InputGroupAddon>
116
- <InputGroupInput type="number" placeholder="0.00" />
117
- </InputGroup>`,
118
- preview: {
119
- type: 'component',
120
- component: 'InputGroup',
121
- props: {
122
- children: [
123
- {
124
- type: 'InputGroupAddon',
125
- props: {
126
- align: 'block-start',
127
- children: {
128
- type: 'InputGroupText',
129
- props: { children: 'Amount' },
130
- },
131
- },
132
- },
133
- {
134
- type: 'InputGroupInput',
135
- props: { type: 'number', placeholder: '0.00' },
136
- },
137
- ],
138
- },
139
- },
140
- },
141
- {
142
- name: 'With Textarea',
143
- description: 'Input group using the textarea control',
144
- code: `<InputGroup>
145
- <InputGroupTextarea placeholder="Write a note..." />
146
- <InputGroupAddon align="block-end">
147
- <InputGroupText>Markdown supported</InputGroupText>
148
- </InputGroupAddon>
149
- </InputGroup>`,
150
- preview: {
151
- type: 'component',
152
- component: 'InputGroup',
153
- props: {
154
- children: [
155
- {
156
- type: 'InputGroupTextarea',
157
- props: { placeholder: 'Write a note...' },
158
- },
159
- {
160
- type: 'InputGroupAddon',
161
- props: {
162
- align: 'block-end',
163
- children: {
164
- type: 'InputGroupText',
165
- props: { children: 'Markdown supported' },
166
- },
167
- },
168
- },
169
- ],
170
- },
171
- },
172
- },
173
- {
174
- name: 'Invalid',
175
- description: 'Input group with an invalid control state',
176
- code: `<InputGroup>
177
- <InputGroupInput aria-invalid placeholder="Invalid email" />
178
- <InputGroupAddon align="inline-end">
179
- <InputGroupText>Error</InputGroupText>
180
- </InputGroupAddon>
181
- </InputGroup>`,
182
- preview: {
183
- type: 'component',
184
- component: 'InputGroup',
185
- props: {
186
- children: [
187
- {
188
- type: 'InputGroupInput',
189
- props: { 'aria-invalid': true, placeholder: 'Invalid email' },
190
- },
191
- {
192
- type: 'InputGroupAddon',
193
- props: {
194
- align: 'inline-end',
195
- children: {
196
- type: 'InputGroupText',
197
- props: { children: 'Error' },
198
- },
199
- },
200
- },
201
- ],
202
- },
203
- },
204
- },
205
- ],
206
- dependencies: ['utils', 'button', 'input', 'textarea'],
207
- packageDependencies: ['class-variance-authority'],
208
- files: ['components/primitives/input-group/index.tsx'],
209
- };