@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,121 +0,0 @@
1
- import type { ComponentConfig } from '@foundrykit/types';
2
-
3
- export const breadcrumbConfig: ComponentConfig = {
4
- name: 'Breadcrumb',
5
- description: 'Navigation breadcrumb component',
6
- category: 'primitives',
7
- tags: ['navigation', 'breadcrumb', 'menu'],
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="flex items-center space-x-1"><div class="h-3 w-3 rounded bg-gray-400"></div><div class="h-2 w-2 rotate-45 bg-gray-300"></div><div class="h-1 w-8 rounded bg-gray-400"></div><div class="h-2 w-2 rotate-45 bg-gray-300"></div><div class="h-1 w-6 rounded bg-gray-400"></div></div></div>',
11
- },
12
- variants: [
13
- {
14
- name: 'Default',
15
- description: 'Default breadcrumb navigation',
16
- code: '<Breadcrumb items={[{ label: "Home", href: "/" }, { label: "Products", href: "/products" }, { label: "Current" }]} />',
17
- preview: {
18
- type: 'component',
19
- component: 'Breadcrumb',
20
- props: {
21
- children: {
22
- component: 'BreadcrumbList',
23
- props: {
24
- children: [
25
- {
26
- component: 'BreadcrumbItem',
27
- props: {
28
- children: {
29
- component: 'BreadcrumbLink',
30
- props: { href: '/', children: 'Home' },
31
- },
32
- },
33
- },
34
- {
35
- component: 'BreadcrumbSeparator',
36
- props: {},
37
- },
38
- {
39
- component: 'BreadcrumbItem',
40
- props: {
41
- children: {
42
- component: 'BreadcrumbLink',
43
- props: { href: '/products', children: 'Products' },
44
- },
45
- },
46
- },
47
- {
48
- component: 'BreadcrumbSeparator',
49
- props: {},
50
- },
51
- {
52
- component: 'BreadcrumbItem',
53
- props: {
54
- children: {
55
- component: 'BreadcrumbPage',
56
- props: { children: 'Current' },
57
- },
58
- },
59
- },
60
- ],
61
- },
62
- },
63
- },
64
- },
65
- },
66
- {
67
- name: 'With Icons',
68
- description: 'Breadcrumb with custom icons',
69
- code: '<Breadcrumb items={[{ label: "Home", href: "/", icon: HomeIcon }, { label: "Settings", href: "/settings", icon: SettingsIcon }]} />',
70
- preview: {
71
- type: 'component',
72
- component: 'Breadcrumb',
73
- props: {
74
- children: {
75
- component: 'BreadcrumbList',
76
- props: {
77
- children: [
78
- {
79
- component: 'BreadcrumbItem',
80
- props: {
81
- children: [
82
- {
83
- component: 'Home',
84
- props: { className: 'h-4 w-4' },
85
- },
86
- {
87
- component: 'BreadcrumbLink',
88
- props: { href: '/', children: 'Home' },
89
- },
90
- ],
91
- },
92
- },
93
- {
94
- component: 'BreadcrumbSeparator',
95
- props: {},
96
- },
97
- {
98
- component: 'BreadcrumbItem',
99
- props: {
100
- children: [
101
- {
102
- component: 'Settings',
103
- props: { className: 'h-4 w-4' },
104
- },
105
- {
106
- component: 'BreadcrumbLink',
107
- props: { href: '/settings', children: 'Settings' },
108
- },
109
- ],
110
- },
111
- },
112
- ],
113
- },
114
- },
115
- },
116
- },
117
- },
118
- ],
119
- dependencies: ['utils'],
120
- files: ['components/primitives/breadcrumb/index.tsx'],
121
- };
@@ -1,127 +0,0 @@
1
- import { cn } from '@foundrykit/utils';
2
- import { Slot } from '@radix-ui/react-slot';
3
- import { ChevronRight, MoreHorizontal } from 'lucide-react';
4
- import type * as React from 'react';
5
-
6
- /**
7
- * Breadcrumb navigation landmark (`<nav aria-label="breadcrumb">`). Compose the
8
- * trail with {@link BreadcrumbList}, {@link BreadcrumbItem},
9
- * {@link BreadcrumbLink}, {@link BreadcrumbPage} (current page),
10
- * {@link BreadcrumbSeparator} and {@link BreadcrumbEllipsis}.
11
- *
12
- * @example
13
- * ```tsx
14
- * <Breadcrumb>
15
- * <BreadcrumbList>
16
- * <BreadcrumbItem><BreadcrumbLink href="/">Home</BreadcrumbLink></BreadcrumbItem>
17
- * <BreadcrumbSeparator />
18
- * <BreadcrumbItem><BreadcrumbPage>Settings</BreadcrumbPage></BreadcrumbItem>
19
- * </BreadcrumbList>
20
- * </Breadcrumb>
21
- * ```
22
- */
23
- function Breadcrumb({ ...props }: React.ComponentProps<'nav'>) {
24
- return <nav aria-label='breadcrumb' data-slot='breadcrumb' {...props} />;
25
- }
26
-
27
- function BreadcrumbList({ className, ...props }: React.ComponentProps<'ol'>) {
28
- return (
29
- <ol
30
- data-slot='breadcrumb-list'
31
- className={cn(
32
- 'text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5',
33
- className
34
- )}
35
- {...props}
36
- />
37
- );
38
- }
39
-
40
- function BreadcrumbItem({ className, ...props }: React.ComponentProps<'li'>) {
41
- return (
42
- <li
43
- data-slot='breadcrumb-item'
44
- className={cn('inline-flex items-center gap-1.5', className)}
45
- {...props}
46
- />
47
- );
48
- }
49
-
50
- /** Interactive breadcrumb link (`<a>`, or any element via `asChild` + Radix `Slot`). */
51
- function BreadcrumbLink({
52
- asChild,
53
- className,
54
- ...props
55
- }: React.ComponentProps<'a'> & {
56
- asChild?: boolean;
57
- }) {
58
- const Comp = asChild ? Slot : 'a';
59
-
60
- return (
61
- <Comp
62
- data-slot='breadcrumb-link'
63
- className={cn('hover:text-foreground transition-colors', className)}
64
- {...props}
65
- />
66
- );
67
- }
68
-
69
- function BreadcrumbPage({ className, ...props }: React.ComponentProps<'span'>) {
70
- return (
71
- <span
72
- data-slot='breadcrumb-page'
73
- role='link'
74
- aria-disabled='true'
75
- aria-current='page'
76
- className={cn('text-foreground font-normal', className)}
77
- {...props}
78
- />
79
- );
80
- }
81
-
82
- /** Visual separator between items; defaults to a chevron when no children are given. */
83
- function BreadcrumbSeparator({
84
- children,
85
- className,
86
- ...props
87
- }: React.ComponentProps<'li'>) {
88
- return (
89
- <li
90
- data-slot='breadcrumb-separator'
91
- role='presentation'
92
- aria-hidden='true'
93
- className={cn('[&>svg]:size-3.5', className)}
94
- {...props}
95
- >
96
- {children ?? <ChevronRight />}
97
- </li>
98
- );
99
- }
100
-
101
- function BreadcrumbEllipsis({
102
- className,
103
- ...props
104
- }: React.ComponentProps<'span'>) {
105
- return (
106
- <span
107
- data-slot='breadcrumb-ellipsis'
108
- role='presentation'
109
- aria-hidden='true'
110
- className={cn('flex size-9 items-center justify-center', className)}
111
- {...props}
112
- >
113
- <MoreHorizontal className='size-4' />
114
- <span className='sr-only'>More</span>
115
- </span>
116
- );
117
- }
118
-
119
- export {
120
- Breadcrumb,
121
- BreadcrumbEllipsis,
122
- BreadcrumbItem,
123
- BreadcrumbLink,
124
- BreadcrumbList,
125
- BreadcrumbPage,
126
- BreadcrumbSeparator,
127
- };
@@ -1,97 +0,0 @@
1
- import type { ComponentConfig } from '@foundrykit/types';
2
-
3
- export const buttonConfig: ComponentConfig = {
4
- name: 'Button',
5
- description: 'Versatile button component with multiple variants and sizes',
6
- category: 'primitives',
7
- tags: ['form', 'interactive'],
8
- preview: {
9
- type: 'static',
10
- html: '<div class="flex h-12 w-full items-center justify-center rounded-md bg-gray-200"><div class="h-8 w-20 rounded bg-gray-400 flex items-center justify-center text-xs text-white">Button</div></div>',
11
- },
12
- variants: [
13
- {
14
- name: 'Default',
15
- description: 'Primary button with default styling',
16
- code: '<Button>Default Button</Button>',
17
- preview: {
18
- type: 'component',
19
- component: 'Button',
20
- props: { children: 'Default Button' },
21
- },
22
- },
23
- {
24
- name: 'Outline',
25
- description: 'Button with outline styling',
26
- code: '<Button variant="outline">Outline Button</Button>',
27
- preview: {
28
- type: 'component',
29
- component: 'Button',
30
- props: { variant: 'outline', children: 'Outline Button' },
31
- },
32
- },
33
- {
34
- name: 'Secondary',
35
- description: 'Secondary button styling',
36
- code: '<Button variant="secondary">Secondary Button</Button>',
37
- preview: {
38
- type: 'component',
39
- component: 'Button',
40
- props: { variant: 'secondary', children: 'Secondary Button' },
41
- },
42
- },
43
- {
44
- name: 'Destructive',
45
- description: 'Button for destructive actions',
46
- code: '<Button variant="destructive">Destructive Button</Button>',
47
- preview: {
48
- type: 'component',
49
- component: 'Button',
50
- props: { variant: 'destructive', children: 'Destructive Button' },
51
- },
52
- },
53
- {
54
- name: 'Inline Link',
55
- description: 'Inline text link that inherits the surrounding text color',
56
- code: '<Button variant="inline-link">Inline link</Button>',
57
- preview: {
58
- type: 'component',
59
- component: 'Button',
60
- props: { variant: 'inline-link', children: 'Inline link' },
61
- },
62
- },
63
- {
64
- name: 'Nav Link',
65
- description: 'Navigation link styling for nav bars and menus',
66
- code: '<Button variant="navlink">Nav link</Button>',
67
- preview: {
68
- type: 'component',
69
- component: 'Button',
70
- props: { variant: 'navlink', children: 'Nav link' },
71
- },
72
- },
73
- {
74
- name: 'Small',
75
- description: 'Small button size',
76
- code: '<Button size="sm">Small Button</Button>',
77
- preview: {
78
- type: 'component',
79
- component: 'Button',
80
- props: { size: 'sm', children: 'Small Button' },
81
- },
82
- },
83
- {
84
- name: 'Large',
85
- description: 'Large button size',
86
- code: '<Button size="lg">Large Button</Button>',
87
- preview: {
88
- type: 'component',
89
- component: 'Button',
90
- props: { size: 'lg', children: 'Large Button' },
91
- },
92
- },
93
- ],
94
- dependencies: ['utils'],
95
- packageDependencies: ['@radix-ui/react-slot', 'class-variance-authority'],
96
- files: ['components/primitives/button/index.tsx'],
97
- };
@@ -1,86 +0,0 @@
1
- import { cn } from '@foundrykit/utils';
2
- import { Slot } from '@radix-ui/react-slot';
3
- import { cva, type VariantProps } from 'class-variance-authority';
4
- import type * as React from 'react';
5
-
6
- const buttonVariants = cva(
7
- "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 shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all 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",
8
- {
9
- variants: {
10
- variant: {
11
- default:
12
- 'bg-primary text-primary-foreground hover:bg-primary/90 shadow-xs',
13
- destructive:
14
- 'bg-destructive hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60 text-white shadow-xs',
15
- outline:
16
- 'bg-background hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 border shadow-xs',
17
- secondary:
18
- 'bg-secondary text-secondary-foreground hover:bg-secondary/80 shadow-xs',
19
- ghost:
20
- 'hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50',
21
- link: 'text-primary underline-offset-4 hover:underline',
22
- 'inline-link':
23
- 'inline align-baseline text-inherit underline underline-offset-4 hover:text-inherit',
24
- navlink:
25
- 'text-foreground hover:text-accent-foreground underline-offset-4 hover:underline',
26
- },
27
- size: {
28
- default: 'h-9 px-4 py-2 has-[>svg]:px-3',
29
- sm: 'h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5',
30
- lg: 'h-10 rounded-md px-6 has-[>svg]:px-4',
31
- icon: 'size-9',
32
- },
33
- },
34
- // The link-style variants read as inline text, not a button box: strip the
35
- // height/padding/radius that `size` would otherwise apply, across all sizes.
36
- compoundVariants: [
37
- {
38
- variant: ['inline-link', 'navlink'],
39
- className: 'h-auto rounded-none p-0 has-[>svg]:px-0',
40
- },
41
- ],
42
- defaultVariants: {
43
- variant: 'default',
44
- size: 'default',
45
- },
46
- }
47
- );
48
-
49
- export interface ButtonProps
50
- extends React.ComponentProps<'button'>,
51
- VariantProps<typeof buttonVariants> {
52
- /** Render as the child element (via Radix `Slot`) instead of a `<button>`. */
53
- asChild?: boolean;
54
- }
55
-
56
- /**
57
- * Clickable button with `variant` (default, destructive, outline, secondary,
58
- * ghost, link, inline-link, navlink) and `size` (default, sm, lg, icon) styles from
59
- * {@link buttonVariants}. Pass `asChild` to render a different element (e.g. a
60
- * link) while keeping the button styling.
61
- *
62
- * @example
63
- * ```tsx
64
- * <Button variant="outline" size="sm">Cancel</Button>
65
- * <Button asChild><a href="/docs">Docs</a></Button>
66
- * ```
67
- */
68
- function Button({
69
- className,
70
- variant,
71
- size,
72
- asChild = false,
73
- ...props
74
- }: ButtonProps) {
75
- const Comp = asChild ? Slot : 'button';
76
-
77
- return (
78
- <Comp
79
- data-slot='button'
80
- className={cn(buttonVariants({ variant, size, className }))}
81
- {...props}
82
- />
83
- );
84
- }
85
-
86
- export { Button, buttonVariants };
@@ -1,39 +0,0 @@
1
- import type { ComponentConfig } from '@foundrykit/types';
2
-
3
- export const ButtonGroupConfig: ComponentConfig = {
4
- name: 'Button Group',
5
- description: 'Groups related buttons into a single connected cluster.',
6
- category: 'primitives',
7
- tags: ['button-group', 'button', 'layout'],
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="flex"><div class="h-8 rounded-l-md border border-gray-300 bg-white px-3 text-sm leading-8 text-gray-600">One</div><div class="h-8 border border-l-0 border-gray-300 bg-white px-3 text-sm leading-8 text-gray-600">Two</div><div class="h-8 rounded-r-md border border-l-0 border-gray-300 bg-white px-3 text-sm leading-8 text-gray-600">Three</div></div></div>',
11
- },
12
- variants: [
13
- {
14
- name: 'Horizontal',
15
- description: 'Default horizontal button group',
16
- code: '<ButtonGroup><Button>One</Button><Button>Two</Button></ButtonGroup>',
17
- preview: {
18
- type: 'component',
19
- component: 'ButtonGroup',
20
- props: {},
21
- },
22
- },
23
- {
24
- name: 'Vertical',
25
- description: 'Vertically stacked button group',
26
- code: '<ButtonGroup orientation="vertical"><Button>One</Button><Button>Two</Button></ButtonGroup>',
27
- preview: {
28
- type: 'component',
29
- component: 'ButtonGroup',
30
- props: {
31
- orientation: 'vertical',
32
- },
33
- },
34
- },
35
- ],
36
- dependencies: ['utils', 'separator'],
37
- packageDependencies: ['@radix-ui/react-slot', 'class-variance-authority'],
38
- files: ['components/primitives/button-group/index.tsx'],
39
- };
@@ -1,99 +0,0 @@
1
- import { cn } from '@foundrykit/utils';
2
- import { Slot } from '@radix-ui/react-slot';
3
- import { cva, type VariantProps } from 'class-variance-authority';
4
- import type * as React from 'react';
5
- import { Separator } from '../separator/index.js';
6
-
7
- const buttonGroupVariants = cva(
8
- "flex w-fit items-stretch has-[>[data-slot=button-group]]:gap-2 [&>*]:focus-visible:relative [&>*]:focus-visible:z-10 [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1",
9
- {
10
- variants: {
11
- orientation: {
12
- horizontal:
13
- '[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none',
14
- vertical:
15
- 'flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none',
16
- },
17
- },
18
- defaultVariants: {
19
- orientation: 'horizontal',
20
- },
21
- }
22
- );
23
-
24
- /**
25
- * Groups related buttons (and compatible controls) into a single connected
26
- * cluster, merging their adjacent borders and corners. Use `orientation`
27
- * (`horizontal`/`vertical`) and compose with {@link ButtonGroupText} and
28
- * {@link ButtonGroupSeparator}.
29
- *
30
- * @example
31
- * ```tsx
32
- * <ButtonGroup>
33
- * <Button variant="outline">Prev</Button>
34
- * <Button variant="outline">Next</Button>
35
- * </ButtonGroup>
36
- * ```
37
- */
38
- function ButtonGroup({
39
- className,
40
- orientation,
41
- ...props
42
- }: React.ComponentProps<'div'> & VariantProps<typeof buttonGroupVariants>) {
43
- return (
44
- <div
45
- data-slot='button-group'
46
- data-orientation={orientation}
47
- role='group'
48
- className={cn(buttonGroupVariants({ orientation }), className)}
49
- {...props}
50
- />
51
- );
52
- }
53
-
54
- /** Non-interactive label segment inside a {@link ButtonGroup}; set `asChild` to render custom markup. */
55
- function ButtonGroupText({
56
- className,
57
- asChild = false,
58
- ...props
59
- }: React.ComponentProps<'div'> & {
60
- asChild?: boolean;
61
- }) {
62
- const Comp = asChild ? Slot : 'div';
63
- return (
64
- <Comp
65
- data-slot='button-group-text'
66
- className={cn(
67
- "bg-muted flex items-center gap-2 rounded-md border px-4 text-sm font-medium shadow-xs [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
68
- className
69
- )}
70
- {...props}
71
- />
72
- );
73
- }
74
-
75
- /** Divider between segments of a {@link ButtonGroup}; defaults to a vertical orientation. */
76
- function ButtonGroupSeparator({
77
- className,
78
- orientation = 'vertical',
79
- ...props
80
- }: React.ComponentProps<typeof Separator>) {
81
- return (
82
- <Separator
83
- data-slot='button-group-separator'
84
- orientation={orientation}
85
- className={cn(
86
- 'bg-input relative !m-0 self-stretch data-[orientation=vertical]:h-auto',
87
- className
88
- )}
89
- {...props}
90
- />
91
- );
92
- }
93
-
94
- export {
95
- ButtonGroup,
96
- ButtonGroupSeparator,
97
- ButtonGroupText,
98
- buttonGroupVariants,
99
- };
@@ -1,89 +0,0 @@
1
- import type { ComponentConfig } from '@foundrykit/types';
2
-
3
- export const cardConfig: ComponentConfig = {
4
- name: 'Card',
5
- description: 'Container component for content organization',
6
- category: 'primitives',
7
- tags: ['container', 'layout', 'content'],
8
- preview: {
9
- type: 'static',
10
- html: '<div class="flex h-12 w-full flex-col justify-center rounded-md border border-gray-200 bg-white p-2"><div class="mb-1 h-2 w-full rounded bg-gray-200"></div><div class="h-1 w-3/4 rounded bg-gray-200"></div></div>',
11
- },
12
- variants: [
13
- {
14
- name: 'Default',
15
- description: 'Default card with header and content',
16
- code: '<Card><CardHeader><CardTitle>Card Title</CardTitle><CardDescription>Card description</CardDescription></CardHeader><CardContent>Card content</CardContent></Card>',
17
- preview: {
18
- type: 'component',
19
- component: 'Card',
20
- props: {
21
- children: [
22
- {
23
- component: 'CardHeader',
24
- props: {
25
- children: [
26
- { component: 'CardTitle', props: { children: 'Card Title' } },
27
- {
28
- component: 'CardDescription',
29
- props: { children: 'Card description' },
30
- },
31
- ],
32
- },
33
- },
34
- { component: 'CardContent', props: { children: 'Card content' } },
35
- ],
36
- },
37
- },
38
- },
39
- {
40
- name: 'Simple',
41
- description: 'Simple card without header',
42
- code: '<Card><CardContent>Simple card content</CardContent></Card>',
43
- preview: {
44
- type: 'component',
45
- component: 'Card',
46
- props: {
47
- children: {
48
- component: 'CardContent',
49
- props: { children: 'Simple card content' },
50
- },
51
- },
52
- },
53
- },
54
- {
55
- name: 'With Footer',
56
- description: 'Card with footer actions',
57
- code: '<Card><CardHeader><CardTitle>Card with Footer</CardTitle></CardHeader><CardContent>Content</CardContent><CardFooter><Button>Action</Button></CardFooter></Card>',
58
- preview: {
59
- type: 'component',
60
- component: 'Card',
61
- props: {
62
- children: [
63
- {
64
- component: 'CardHeader',
65
- props: {
66
- children: {
67
- component: 'CardTitle',
68
- props: { children: 'Card with Footer' },
69
- },
70
- },
71
- },
72
- { component: 'CardContent', props: { children: 'Content' } },
73
- {
74
- component: 'CardFooter',
75
- props: {
76
- children: {
77
- component: 'Button',
78
- props: { children: 'Action' },
79
- },
80
- },
81
- },
82
- ],
83
- },
84
- },
85
- },
86
- ],
87
- dependencies: ['utils'],
88
- files: ['components/primitives/card/index.tsx'],
89
- };