@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,222 +0,0 @@
1
- import type { ComponentConfig } from '@foundrykit/types';
2
-
3
- export const popoverConfig: ComponentConfig = {
4
- name: 'Popover',
5
- description: 'Popover component for displaying content in a floating panel',
6
- category: 'primitives',
7
- tags: ['overlay', '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="relative"><div class="h-8 w-20 rounded border border-gray-400 bg-white flex items-center justify-center text-xs">Trigger</div><div class="absolute top-full left-0 mt-1 w-32 rounded border border-gray-300 bg-white shadow-lg p-2"><div class="text-xs">Popover content</div></div></div></div>',
11
- },
12
- variants: [
13
- {
14
- name: 'Basic',
15
- description: 'Simple popover with trigger and content',
16
- code: `<Popover>
17
- <PopoverTrigger asChild>
18
- <Button variant="outline">Open Popover</Button>
19
- </PopoverTrigger>
20
- <PopoverContent>
21
- <div class="grid gap-4">
22
- <div class="space-y-2">
23
- <h4 class="font-medium leading-none">Dimensions</h4>
24
- <p class="text-sm text-muted-foreground">Set the dimensions for the layer.</p>
25
- </div>
26
- </div>
27
- </PopoverContent>
28
- </Popover>`,
29
- preview: {
30
- type: 'component',
31
- component: 'Popover',
32
- props: {
33
- children: [
34
- {
35
- component: 'PopoverTrigger',
36
- props: { children: 'Open Popover' },
37
- },
38
- {
39
- component: 'PopoverContent',
40
- props: {
41
- children: {
42
- component: 'div',
43
- props: {
44
- className: 'grid gap-4',
45
- children: {
46
- component: 'div',
47
- props: {
48
- className: 'space-y-2',
49
- children: [
50
- {
51
- component: 'h4',
52
- props: {
53
- className: 'font-medium leading-none',
54
- children: 'Dimensions',
55
- },
56
- },
57
- {
58
- component: 'p',
59
- props: {
60
- className: 'text-sm text-muted-foreground',
61
- children: 'Set the dimensions for the layer.',
62
- },
63
- },
64
- ],
65
- },
66
- },
67
- },
68
- },
69
- },
70
- },
71
- ],
72
- },
73
- },
74
- },
75
- {
76
- name: 'With Form',
77
- description: 'Popover containing form elements',
78
- code: `<Popover>
79
- <PopoverTrigger asChild>
80
- <Button variant="outline">Settings</Button>
81
- </PopoverTrigger>
82
- <PopoverContent className="w-80">
83
- <div class="grid gap-4">
84
- <div class="space-y-2">
85
- <h4 class="font-medium leading-none">Settings</h4>
86
- <p class="text-sm text-muted-foreground">Configure your preferences.</p>
87
- </div>
88
- <div class="grid gap-2">
89
- <Label htmlFor="width">Width</Label>
90
- <Input id="width" defaultValue="100%" />
91
- </div>
92
- </div>
93
- </PopoverContent>
94
- </Popover>`,
95
- preview: {
96
- type: 'component',
97
- component: 'Popover',
98
- props: {
99
- children: [
100
- { component: 'PopoverTrigger', props: { children: 'Settings' } },
101
- {
102
- component: 'PopoverContent',
103
- props: {
104
- className: 'w-80',
105
- children: {
106
- component: 'div',
107
- props: {
108
- className: 'grid gap-4',
109
- children: [
110
- {
111
- component: 'div',
112
- props: {
113
- className: 'space-y-2',
114
- children: [
115
- {
116
- component: 'h4',
117
- props: {
118
- className: 'font-medium leading-none',
119
- children: 'Settings',
120
- },
121
- },
122
- {
123
- component: 'p',
124
- props: {
125
- className: 'text-sm text-muted-foreground',
126
- children: 'Configure your preferences.',
127
- },
128
- },
129
- ],
130
- },
131
- },
132
- {
133
- component: 'div',
134
- props: {
135
- className: 'grid gap-2',
136
- children: [
137
- {
138
- component: 'Label',
139
- props: { htmlFor: 'width', children: 'Width' },
140
- },
141
- {
142
- component: 'Input',
143
- props: { id: 'width', defaultValue: '100%' },
144
- },
145
- ],
146
- },
147
- },
148
- ],
149
- },
150
- },
151
- },
152
- },
153
- ],
154
- },
155
- },
156
- },
157
- {
158
- name: 'With Close Button',
159
- description: 'Popover with close button in header',
160
- code: `<Popover>
161
- <PopoverTrigger asChild>
162
- <Button variant="outline">Info</Button>
163
- </PopoverTrigger>
164
- <PopoverContent>
165
- <div class="flex items-center justify-between">
166
- <h4 class="font-medium">Information</h4>
167
- <Button variant="ghost" size="sm" onClick={() => {}}>×</Button>
168
- </div>
169
- <p class="text-sm mt-2">This is some helpful information.</p>
170
- </PopoverContent>
171
- </Popover>`,
172
- preview: {
173
- type: 'component',
174
- component: 'Popover',
175
- props: {
176
- children: [
177
- { component: 'PopoverTrigger', props: { children: 'Info' } },
178
- {
179
- component: 'PopoverContent',
180
- props: {
181
- children: [
182
- {
183
- component: 'div',
184
- props: {
185
- className: 'flex items-center justify-between',
186
- children: [
187
- {
188
- component: 'h4',
189
- props: {
190
- className: 'font-medium',
191
- children: 'Information',
192
- },
193
- },
194
- {
195
- component: 'Button',
196
- props: {
197
- variant: 'ghost',
198
- size: 'sm',
199
- children: '×',
200
- },
201
- },
202
- ],
203
- },
204
- },
205
- {
206
- component: 'p',
207
- props: {
208
- className: 'text-sm mt-2',
209
- children: 'This is some helpful information.',
210
- },
211
- },
212
- ],
213
- },
214
- },
215
- ],
216
- },
217
- },
218
- },
219
- ],
220
- dependencies: ['utils', 'button', 'input', 'label'],
221
- files: ['components/primitives/popover/index.tsx'],
222
- };
@@ -1,60 +0,0 @@
1
- 'use client';
2
-
3
- import { cn } from '@foundrykit/utils';
4
- import * as PopoverPrimitive from '@radix-ui/react-popover';
5
- import type * as React from 'react';
6
-
7
- /**
8
- * Popover root built on Radix `Popover.Root`. Compose with
9
- * {@link PopoverTrigger}, {@link PopoverContent} (portalled, animated floating
10
- * panel) and optionally {@link PopoverAnchor} to position against a custom element.
11
- *
12
- * @example
13
- * ```tsx
14
- * <Popover>
15
- * <PopoverTrigger>Open</PopoverTrigger>
16
- * <PopoverContent>Content</PopoverContent>
17
- * </Popover>
18
- * ```
19
- */
20
- function Popover({
21
- ...props
22
- }: React.ComponentProps<typeof PopoverPrimitive.Root>) {
23
- return <PopoverPrimitive.Root data-slot='popover' {...props} />;
24
- }
25
-
26
- function PopoverTrigger({
27
- ...props
28
- }: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {
29
- return <PopoverPrimitive.Trigger data-slot='popover-trigger' {...props} />;
30
- }
31
-
32
- function PopoverContent({
33
- className,
34
- align = 'center',
35
- sideOffset = 4,
36
- ...props
37
- }: React.ComponentProps<typeof PopoverPrimitive.Content>) {
38
- return (
39
- <PopoverPrimitive.Portal>
40
- <PopoverPrimitive.Content
41
- data-slot='popover-content'
42
- align={align}
43
- sideOffset={sideOffset}
44
- className={cn(
45
- '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 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:zoom-in-95 motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=left]:slide-in-from-right-2 motion-safe:data-[side=right]:slide-in-from-left-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden',
46
- className
47
- )}
48
- {...props}
49
- />
50
- </PopoverPrimitive.Portal>
51
- );
52
- }
53
-
54
- function PopoverAnchor({
55
- ...props
56
- }: React.ComponentProps<typeof PopoverPrimitive.Anchor>) {
57
- return <PopoverPrimitive.Anchor data-slot='popover-anchor' {...props} />;
58
- }
59
-
60
- export { Popover, PopoverAnchor, PopoverContent, PopoverTrigger };
@@ -1,42 +0,0 @@
1
- import type { ComponentConfig } from '@foundrykit/types';
2
-
3
- export const ProgressConfig: ComponentConfig = {
4
- name: 'Progress',
5
- description:
6
- 'Displays an indicator showing the completion progress of a task.',
7
- category: 'primitives',
8
- tags: ['progress', 'feedback', 'loading'],
9
- preview: {
10
- type: 'static',
11
- html: '<div class="flex h-12 w-full items-center px-3"><div class="h-2 w-full overflow-hidden rounded-full bg-gray-200"><div class="h-full w-2/3 rounded-full bg-gray-500"></div></div></div>',
12
- },
13
- variants: [
14
- {
15
- name: 'Default',
16
- description: 'Default progress',
17
- code: '<Progress value={66} />',
18
- preview: {
19
- type: 'component',
20
- component: 'Progress',
21
- props: {
22
- value: 66,
23
- },
24
- },
25
- },
26
- {
27
- name: 'Complete',
28
- description: 'Fully complete progress',
29
- code: '<Progress value={100} />',
30
- preview: {
31
- type: 'component',
32
- component: 'Progress',
33
- props: {
34
- value: 100,
35
- },
36
- },
37
- },
38
- ],
39
- dependencies: ['utils'],
40
- packageDependencies: ['@radix-ui/react-progress'],
41
- files: ['components/primitives/progress/index.tsx'],
42
- };
@@ -1,39 +0,0 @@
1
- 'use client';
2
-
3
- import { cn } from '@foundrykit/utils';
4
- import * as ProgressPrimitive from '@radix-ui/react-progress';
5
- import type * as React from 'react';
6
-
7
- /**
8
- * Progress bar built on Radix `Progress.Root`. Pass `value` (0–100) to fill the
9
- * indicator; omit it for an indeterminate state.
10
- *
11
- * @example
12
- * ```tsx
13
- * <Progress value={66} />
14
- * ```
15
- */
16
- function Progress({
17
- className,
18
- value,
19
- ...props
20
- }: React.ComponentProps<typeof ProgressPrimitive.Root>) {
21
- return (
22
- <ProgressPrimitive.Root
23
- data-slot='progress'
24
- className={cn(
25
- 'bg-primary/20 relative h-2 w-full overflow-hidden rounded-full',
26
- className
27
- )}
28
- {...props}
29
- >
30
- <ProgressPrimitive.Indicator
31
- data-slot='progress-indicator'
32
- className='bg-primary h-full w-full flex-1 transition-all'
33
- style={{ transform: `translateX(-${100 - (value || 0)}%)` }}
34
- />
35
- </ProgressPrimitive.Root>
36
- );
37
- }
38
-
39
- export { Progress };
@@ -1,303 +0,0 @@
1
- import type { ComponentConfig } from '@foundrykit/types';
2
-
3
- export const radioGroupConfig: ComponentConfig = {
4
- name: 'Radio Group',
5
- description:
6
- 'Radio group component for single selection from multiple options',
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 flex-col gap-2"><div class="flex items-center gap-2"><div class="h-4 w-4 rounded-full border border-gray-400 bg-white flex items-center justify-center"><div class="h-2 w-2 rounded-full bg-blue-500"></div></div><span class="text-xs">Option 1</span></div><div class="flex items-center gap-2"><div class="h-4 w-4 rounded-full border border-gray-400 bg-white flex items-center justify-center"></div><span class="text-xs">Option 2</span></div></div></div>',
12
- },
13
- variants: [
14
- {
15
- name: 'Default',
16
- description: 'Basic radio group with default styling',
17
- code: `<RadioGroup defaultValue="option-one">
18
- <div class="flex items-center space-x-2">
19
- <RadioGroupItem value="option-one" id="option-one" />
20
- <Label htmlFor="option-one">Option One</Label>
21
- </div>
22
- <div class="flex items-center space-x-2">
23
- <RadioGroupItem value="option-two" id="option-two" />
24
- <Label htmlFor="option-two">Option Two</Label>
25
- </div>
26
- </RadioGroup>`,
27
- preview: {
28
- type: 'component',
29
- component: 'RadioGroup',
30
- props: {
31
- defaultValue: 'option-one',
32
- children: [
33
- {
34
- type: 'div',
35
- props: {
36
- className: 'flex items-center space-x-2',
37
- children: [
38
- {
39
- type: 'RadioGroupItem',
40
- props: { value: 'option-one', id: 'option-one' },
41
- },
42
- {
43
- type: 'Label',
44
- props: { htmlFor: 'option-one', children: 'Option One' },
45
- },
46
- ],
47
- },
48
- },
49
- {
50
- type: 'div',
51
- props: {
52
- className: 'flex items-center space-x-2',
53
- children: [
54
- {
55
- type: 'RadioGroupItem',
56
- props: { value: 'option-two', id: 'option-two' },
57
- },
58
- {
59
- type: 'Label',
60
- props: { htmlFor: 'option-two', children: 'Option Two' },
61
- },
62
- ],
63
- },
64
- },
65
- ],
66
- },
67
- },
68
- },
69
- {
70
- name: 'Horizontal',
71
- description: 'Radio group with horizontal layout',
72
- code: `<RadioGroup defaultValue="comfortable" className="flex flex-row space-x-4">
73
- <div class="flex items-center space-x-2">
74
- <RadioGroupItem value="default" id="r1" />
75
- <Label htmlFor="r1">Default</Label>
76
- </div>
77
- <div class="flex items-center space-x-2">
78
- <RadioGroupItem value="comfortable" id="r2" />
79
- <Label htmlFor="r2">Comfortable</Label>
80
- </div>
81
- <div class="flex items-center space-x-2">
82
- <RadioGroupItem value="compact" id="r3" />
83
- <Label htmlFor="r3">Compact</Label>
84
- </div>
85
- </RadioGroup>`,
86
- preview: {
87
- type: 'component',
88
- component: 'RadioGroup',
89
- props: {
90
- defaultValue: 'comfortable',
91
- className: 'flex flex-row space-x-4',
92
- children: [
93
- {
94
- type: 'div',
95
- props: {
96
- className: 'flex items-center space-x-2',
97
- children: [
98
- {
99
- type: 'RadioGroupItem',
100
- props: { value: 'default', id: 'r1' },
101
- },
102
- {
103
- type: 'Label',
104
- props: { htmlFor: 'r1', children: 'Default' },
105
- },
106
- ],
107
- },
108
- },
109
- {
110
- type: 'div',
111
- props: {
112
- className: 'flex items-center space-x-2',
113
- children: [
114
- {
115
- type: 'RadioGroupItem',
116
- props: { value: 'comfortable', id: 'r2' },
117
- },
118
- {
119
- type: 'Label',
120
- props: { htmlFor: 'r2', children: 'Comfortable' },
121
- },
122
- ],
123
- },
124
- },
125
- {
126
- type: 'div',
127
- props: {
128
- className: 'flex items-center space-x-2',
129
- children: [
130
- {
131
- type: 'RadioGroupItem',
132
- props: { value: 'compact', id: 'r3' },
133
- },
134
- {
135
- type: 'Label',
136
- props: { htmlFor: 'r3', children: 'Compact' },
137
- },
138
- ],
139
- },
140
- },
141
- ],
142
- },
143
- },
144
- },
145
- {
146
- name: 'Disabled',
147
- description: 'Radio group with disabled options',
148
- code: `<RadioGroup defaultValue="option-one">
149
- <div class="flex items-center space-x-2">
150
- <RadioGroupItem value="option-one" id="option-one" />
151
- <Label htmlFor="option-one">Option One</Label>
152
- </div>
153
- <div class="flex items-center space-x-2">
154
- <RadioGroupItem value="option-two" id="option-two" disabled />
155
- <Label htmlFor="option-two" className="text-muted-foreground">Option Two (Disabled)</Label>
156
- </div>
157
- </RadioGroup>`,
158
- preview: {
159
- type: 'component',
160
- component: 'RadioGroup',
161
- props: {
162
- defaultValue: 'option-one',
163
- children: [
164
- {
165
- type: 'div',
166
- props: {
167
- className: 'flex items-center space-x-2',
168
- children: [
169
- {
170
- type: 'RadioGroupItem',
171
- props: { value: 'option-one', id: 'option-one' },
172
- },
173
- {
174
- type: 'Label',
175
- props: { htmlFor: 'option-one', children: 'Option One' },
176
- },
177
- ],
178
- },
179
- },
180
- {
181
- type: 'div',
182
- props: {
183
- className: 'flex items-center space-x-2',
184
- children: [
185
- {
186
- type: 'RadioGroupItem',
187
- props: {
188
- value: 'option-two',
189
- id: 'option-two',
190
- disabled: true,
191
- },
192
- },
193
- {
194
- type: 'Label',
195
- props: {
196
- htmlFor: 'option-two',
197
- className: 'text-muted-foreground',
198
- children: 'Option Two (Disabled)',
199
- },
200
- },
201
- ],
202
- },
203
- },
204
- ],
205
- },
206
- },
207
- },
208
- {
209
- name: 'With Description',
210
- description: 'Radio group with descriptive text for each option',
211
- code: `<RadioGroup defaultValue="card">
212
- <div class="flex items-center space-x-2">
213
- <RadioGroupItem value="card" id="card" />
214
- <div class="grid gap-1.5 leading-none">
215
- <Label htmlFor="card">Credit Card</Label>
216
- <p class="text-sm text-muted-foreground">Save your credit card information for faster checkout.</p>
217
- </div>
218
- </div>
219
- <div class="flex items-center space-x-2">
220
- <RadioGroupItem value="paypal" id="paypal" />
221
- <div class="grid gap-1.5 leading-none">
222
- <Label htmlFor="paypal">PayPal</Label>
223
- <p class="text-sm text-muted-foreground">Pay with your PayPal account.</p>
224
- </div>
225
- </div>
226
- </RadioGroup>`,
227
- preview: {
228
- type: 'component',
229
- component: 'RadioGroup',
230
- props: {
231
- defaultValue: 'card',
232
- children: [
233
- {
234
- type: 'div',
235
- props: {
236
- className: 'flex items-center space-x-2',
237
- children: [
238
- {
239
- type: 'RadioGroupItem',
240
- props: { value: 'card', id: 'card' },
241
- },
242
- {
243
- type: 'div',
244
- props: {
245
- className: 'grid gap-1.5 leading-none',
246
- children: [
247
- {
248
- type: 'Label',
249
- props: { htmlFor: 'card', children: 'Credit Card' },
250
- },
251
- {
252
- type: 'p',
253
- props: {
254
- className: 'text-sm text-muted-foreground',
255
- children:
256
- 'Save your credit card information for faster checkout.',
257
- },
258
- },
259
- ],
260
- },
261
- },
262
- ],
263
- },
264
- },
265
- {
266
- type: 'div',
267
- props: {
268
- className: 'flex items-center space-x-2',
269
- children: [
270
- {
271
- type: 'RadioGroupItem',
272
- props: { value: 'paypal', id: 'paypal' },
273
- },
274
- {
275
- type: 'div',
276
- props: {
277
- className: 'grid gap-1.5 leading-none',
278
- children: [
279
- {
280
- type: 'Label',
281
- props: { htmlFor: 'paypal', children: 'PayPal' },
282
- },
283
- {
284
- type: 'p',
285
- props: {
286
- className: 'text-sm text-muted-foreground',
287
- children: 'Pay with your PayPal account.',
288
- },
289
- },
290
- ],
291
- },
292
- },
293
- ],
294
- },
295
- },
296
- ],
297
- },
298
- },
299
- },
300
- ],
301
- dependencies: ['utils', 'label'],
302
- files: ['components/primitives/radio-group/index.tsx'],
303
- };