@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.
- package/dist/{chunk-D4X2ZO5T.js → chunk-2SBGU5XA.js} +2 -2
- package/dist/chunk-3NQR7JZR.js +128 -0
- package/dist/{chunk-3MEIDBWZ.js → chunk-3QUMCM5K.js} +2 -2
- package/dist/chunk-B5YCE3UP.js +57 -0
- package/dist/chunk-F2TEA6ER.js +138 -0
- package/dist/{chunk-5OSYIETI.js → chunk-FRIOQFPE.js} +1 -1
- package/dist/{chunk-EDKSYP4L.js → chunk-G2YBCHWR.js} +1 -1
- package/dist/{chunk-DKBMAFIR.js → chunk-GKCBSG2W.js} +2 -0
- package/dist/chunk-HS46TIMU.js +75 -0
- package/dist/{chunk-R3IEOV2B.js → chunk-P5KEJOBH.js} +1 -1
- package/dist/{chunk-FIRYLO5W.js → chunk-SDYKJVXX.js} +2 -2
- package/dist/chunk-SIQHWNPH.js +45 -0
- package/dist/{chunk-2PXD7LAX.js → chunk-U7JIOR7A.js} +3 -3
- package/dist/{chunk-VA4MKQN7.js → chunk-W4XY3SNY.js} +1 -1
- package/dist/chunk-XCPGTXEJ.js +23 -0
- package/dist/components/alert-dialog/index.cjs +1 -1
- package/dist/components/alert-dialog/index.js +1 -1
- package/dist/components/card/index.cjs +63 -61
- package/dist/components/card/index.d.cts +8 -7
- package/dist/components/card/index.d.ts +8 -7
- package/dist/components/card/index.js +1 -1
- package/dist/components/context-menu/index.cjs +2 -2
- package/dist/components/context-menu/index.js +1 -1
- package/dist/components/dialog/index.cjs +182 -0
- package/dist/components/dialog/index.d.cts +38 -0
- package/dist/components/dialog/index.d.ts +38 -0
- package/dist/components/dialog/index.js +25 -0
- package/dist/components/dropdown/index.cjs +2 -2
- package/dist/components/dropdown/index.js +1 -1
- package/dist/components/hover-card/index.cjs +1 -1
- package/dist/components/hover-card/index.js +1 -1
- package/dist/components/input/index.cjs +16 -28
- package/dist/components/input/index.d.cts +6 -5
- package/dist/components/input/index.d.ts +6 -5
- package/dist/components/input/index.js +1 -1
- package/dist/components/input-group/index.cjs +270 -0
- package/dist/components/input-group/index.d.cts +44 -0
- package/dist/components/input-group/index.d.ts +44 -0
- package/dist/components/input-group/index.js +153 -0
- package/dist/components/menubar/index.cjs +2 -2
- package/dist/components/menubar/index.js +1 -1
- package/dist/components/navigation-menu/index.cjs +3 -3
- package/dist/components/navigation-menu/index.js +1 -1
- package/dist/components/popover/index.cjs +1 -1
- package/dist/components/popover/index.js +1 -1
- package/dist/components/select/index.cjs +1 -1
- package/dist/components/select/index.js +1 -1
- package/dist/components/sheet/index.cjs +170 -0
- package/dist/components/sheet/index.d.cts +31 -0
- package/dist/components/sheet/index.d.ts +31 -0
- package/dist/components/sheet/index.js +21 -0
- package/dist/components/slider/index.cjs +2 -0
- package/dist/components/slider/index.d.cts +3 -2
- package/dist/components/slider/index.d.ts +3 -2
- package/dist/components/slider/index.js +1 -1
- package/dist/components/toggle/index.cjs +81 -0
- package/dist/components/toggle/index.d.cts +26 -0
- package/dist/components/toggle/index.d.ts +26 -0
- package/dist/components/toggle/index.js +9 -0
- package/dist/components/tooltip/index.cjs +95 -0
- package/dist/components/tooltip/index.d.cts +25 -0
- package/dist/components/tooltip/index.d.ts +25 -0
- package/dist/components/tooltip/index.js +13 -0
- package/dist/index.cjs +107 -95
- package/dist/index.d.cts +11 -105
- package/dist/index.d.ts +11 -105
- package/dist/index.js +108 -414
- package/package.json +200 -8
- package/.turbo/turbo-build.log +0 -235
- package/.turbo/turbo-type-check.log +0 -4
- package/CHANGELOG.md +0 -224
- package/dist/chunk-DFGLEAZI.js +0 -63
- package/dist/chunk-RDQF3IQE.js +0 -25
- package/postcss.config.mjs +0 -6
- package/registry.json +0 -64
- package/src/components/accordion/config.ts +0 -28
- package/src/components/accordion/index.tsx +0 -80
- package/src/components/alert/config.ts +0 -40
- package/src/components/alert/index.tsx +0 -80
- package/src/components/alert-dialog/config.ts +0 -28
- package/src/components/alert-dialog/index.tsx +0 -188
- package/src/components/aspect-ratio/config.ts +0 -27
- package/src/components/aspect-ratio/index.tsx +0 -24
- package/src/components/avatar/config.ts +0 -46
- package/src/components/avatar/index.tsx +0 -67
- package/src/components/badge/config.ts +0 -56
- package/src/components/badge/index.tsx +0 -56
- package/src/components/breadcrumb/config.ts +0 -121
- package/src/components/breadcrumb/index.tsx +0 -127
- package/src/components/button/config.ts +0 -97
- package/src/components/button/index.tsx +0 -86
- package/src/components/button-group/config.ts +0 -39
- package/src/components/button-group/index.tsx +0 -99
- package/src/components/card/config.ts +0 -89
- package/src/components/card/index.tsx +0 -98
- package/src/components/checkbox/config.ts +0 -46
- package/src/components/checkbox/index.tsx +0 -41
- package/src/components/collapsible/config.ts +0 -27
- package/src/components/collapsible/index.tsx +0 -47
- package/src/components/context-menu/config.ts +0 -28
- package/src/components/context-menu/index.tsx +0 -271
- package/src/components/dialog/config.ts +0 -582
- package/src/components/dialog/index.tsx +0 -162
- package/src/components/direction/config.ts +0 -28
- package/src/components/direction/index.tsx +0 -27
- package/src/components/drawer/config.ts +0 -28
- package/src/components/drawer/index.tsx +0 -153
- package/src/components/dropdown/config.ts +0 -262
- package/src/components/dropdown/index.tsx +0 -280
- package/src/components/empty/config.ts +0 -38
- package/src/components/empty/index.tsx +0 -127
- package/src/components/field/config.ts +0 -40
- package/src/components/field/index.tsx +0 -252
- package/src/components/hover-card/config.ts +0 -27
- package/src/components/hover-card/index.tsx +0 -56
- package/src/components/input/config.ts +0 -64
- package/src/components/input/index.tsx +0 -33
- package/src/components/input-group/config.ts +0 -209
- package/src/components/input-group/index.tsx +0 -177
- package/src/components/item/config.ts +0 -52
- package/src/components/item/index.tsx +0 -215
- package/src/components/kbd/config.ts +0 -38
- package/src/components/kbd/index.tsx +0 -40
- package/src/components/label/config.ts +0 -72
- package/src/components/label/index.tsx +0 -32
- package/src/components/menubar/config.ts +0 -28
- package/src/components/menubar/index.tsx +0 -295
- package/src/components/native-select/config.ts +0 -40
- package/src/components/native-select/index.tsx +0 -40
- package/src/components/navigation-menu/config.ts +0 -32
- package/src/components/navigation-menu/index.tsx +0 -188
- package/src/components/popover/config.ts +0 -222
- package/src/components/popover/index.tsx +0 -60
- package/src/components/progress/config.ts +0 -42
- package/src/components/progress/index.tsx +0 -39
- package/src/components/radio-group/config.ts +0 -303
- package/src/components/radio-group/index.tsx +0 -58
- package/src/components/resizable/config.ts +0 -28
- package/src/components/resizable/index.tsx +0 -67
- package/src/components/scroll-area/config.ts +0 -17
- package/src/components/scroll-area/index.tsx +0 -70
- package/src/components/select/config.ts +0 -277
- package/src/components/select/index.tsx +0 -202
- package/src/components/separator/config.ts +0 -63
- package/src/components/separator/index.tsx +0 -38
- package/src/components/sheet/config.ts +0 -16
- package/src/components/sheet/index.tsx +0 -153
- package/src/components/skeleton/config.ts +0 -77
- package/src/components/skeleton/index.tsx +0 -22
- package/src/components/slider/config.ts +0 -46
- package/src/components/slider/index.tsx +0 -73
- package/src/components/sonner/config.ts +0 -27
- package/src/components/sonner/index.tsx +0 -37
- package/src/components/spinner/config.ts +0 -40
- package/src/components/spinner/index.tsx +0 -30
- package/src/components/switch/config.ts +0 -171
- package/src/components/switch/index.tsx +0 -40
- package/src/components/table/config.ts +0 -38
- package/src/components/table/index.tsx +0 -135
- package/src/components/tabs/config.ts +0 -335
- package/src/components/tabs/index.tsx +0 -82
- package/src/components/textarea/config.ts +0 -117
- package/src/components/textarea/index.tsx +0 -26
- package/src/components/toggle/config.ts +0 -67
- package/src/components/toggle/index.tsx +0 -59
- package/src/components/toggle-group/config.ts +0 -46
- package/src/components/toggle-group/index.tsx +0 -106
- package/src/components/tooltip/config.ts +0 -16
- package/src/components/tooltip/index.tsx +0 -75
- package/src/components/typography/config.ts +0 -38
- package/src/components/typography/index.tsx +0 -172
- package/src/index.ts +0 -291
- package/tsconfig.json +0 -9
- package/tsconfig.lint.json +0 -8
- package/tsup.config.ts +0 -55
|
@@ -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
|
-
};
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { cn } from '@foundrykit/utils';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Bordered, rounded surface container for grouping related content. Compose with
|
|
6
|
-
* {@link CardHeader}, {@link CardTitle}, {@link CardDescription},
|
|
7
|
-
* {@link CardContent} and {@link CardFooter}. Forwards its ref to the root `<div>`.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```tsx
|
|
11
|
-
* <Card>
|
|
12
|
-
* <CardHeader>
|
|
13
|
-
* <CardTitle>Title</CardTitle>
|
|
14
|
-
* <CardDescription>Subtitle</CardDescription>
|
|
15
|
-
* </CardHeader>
|
|
16
|
-
* <CardContent>Body</CardContent>
|
|
17
|
-
* </Card>
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
const Card = React.forwardRef<
|
|
21
|
-
HTMLDivElement,
|
|
22
|
-
React.HTMLAttributes<HTMLDivElement>
|
|
23
|
-
>(({ className, ...props }, ref) => (
|
|
24
|
-
<div
|
|
25
|
-
ref={ref}
|
|
26
|
-
className={cn(
|
|
27
|
-
'bg-card text-card-foreground rounded-xl border shadow',
|
|
28
|
-
className
|
|
29
|
-
)}
|
|
30
|
-
{...props}
|
|
31
|
-
/>
|
|
32
|
-
));
|
|
33
|
-
Card.displayName = 'Card';
|
|
34
|
-
|
|
35
|
-
const CardHeader = React.forwardRef<
|
|
36
|
-
HTMLDivElement,
|
|
37
|
-
React.HTMLAttributes<HTMLDivElement>
|
|
38
|
-
>(({ className, ...props }, ref) => (
|
|
39
|
-
<div
|
|
40
|
-
ref={ref}
|
|
41
|
-
className={cn('flex flex-col space-y-1.5 p-6', className)}
|
|
42
|
-
{...props}
|
|
43
|
-
/>
|
|
44
|
-
));
|
|
45
|
-
CardHeader.displayName = 'CardHeader';
|
|
46
|
-
|
|
47
|
-
const CardTitle = React.forwardRef<
|
|
48
|
-
HTMLParagraphElement,
|
|
49
|
-
React.HTMLAttributes<HTMLHeadingElement>
|
|
50
|
-
>(({ className, ...props }, ref) => (
|
|
51
|
-
<h3
|
|
52
|
-
ref={ref}
|
|
53
|
-
className={cn('leading-none font-semibold tracking-tight', className)}
|
|
54
|
-
{...props}
|
|
55
|
-
/>
|
|
56
|
-
));
|
|
57
|
-
CardTitle.displayName = 'CardTitle';
|
|
58
|
-
|
|
59
|
-
const CardDescription = React.forwardRef<
|
|
60
|
-
HTMLParagraphElement,
|
|
61
|
-
React.HTMLAttributes<HTMLParagraphElement>
|
|
62
|
-
>(({ className, ...props }, ref) => (
|
|
63
|
-
<p
|
|
64
|
-
ref={ref}
|
|
65
|
-
className={cn('text-muted-foreground text-sm', className)}
|
|
66
|
-
{...props}
|
|
67
|
-
/>
|
|
68
|
-
));
|
|
69
|
-
CardDescription.displayName = 'CardDescription';
|
|
70
|
-
|
|
71
|
-
const CardContent = React.forwardRef<
|
|
72
|
-
HTMLDivElement,
|
|
73
|
-
React.HTMLAttributes<HTMLDivElement>
|
|
74
|
-
>(({ className, ...props }, ref) => (
|
|
75
|
-
<div ref={ref} className={cn('p-6 pt-0', className)} {...props} />
|
|
76
|
-
));
|
|
77
|
-
CardContent.displayName = 'CardContent';
|
|
78
|
-
|
|
79
|
-
const CardFooter = React.forwardRef<
|
|
80
|
-
HTMLDivElement,
|
|
81
|
-
React.HTMLAttributes<HTMLDivElement>
|
|
82
|
-
>(({ className, ...props }, ref) => (
|
|
83
|
-
<div
|
|
84
|
-
ref={ref}
|
|
85
|
-
className={cn('flex items-center p-6 pt-0', className)}
|
|
86
|
-
{...props}
|
|
87
|
-
/>
|
|
88
|
-
));
|
|
89
|
-
CardFooter.displayName = 'CardFooter';
|
|
90
|
-
|
|
91
|
-
export {
|
|
92
|
-
Card,
|
|
93
|
-
CardContent,
|
|
94
|
-
CardDescription,
|
|
95
|
-
CardFooter,
|
|
96
|
-
CardHeader,
|
|
97
|
-
CardTitle,
|
|
98
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { ComponentConfig } from '@foundrykit/types';
|
|
2
|
-
|
|
3
|
-
export const checkboxConfig: ComponentConfig = {
|
|
4
|
-
name: 'Checkbox',
|
|
5
|
-
description: 'Accessible checkbox component built with Radix UI primitives',
|
|
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="h-4 w-4 rounded border border-gray-400 bg-white flex items-center justify-center"><div class="h-3 w-3 bg-blue-500 rounded-sm"></div></div></div>',
|
|
11
|
-
},
|
|
12
|
-
variants: [
|
|
13
|
-
{
|
|
14
|
-
name: 'Default',
|
|
15
|
-
description: 'Standard checkbox with default styling',
|
|
16
|
-
code: '<Checkbox />',
|
|
17
|
-
preview: {
|
|
18
|
-
type: 'component',
|
|
19
|
-
component: 'Checkbox',
|
|
20
|
-
props: {},
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
name: 'Checked',
|
|
25
|
-
description: 'Checkbox in checked state',
|
|
26
|
-
code: '<Checkbox defaultChecked />',
|
|
27
|
-
preview: {
|
|
28
|
-
type: 'component',
|
|
29
|
-
component: 'Checkbox',
|
|
30
|
-
props: { defaultChecked: true },
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
name: 'Disabled',
|
|
35
|
-
description: 'Disabled checkbox',
|
|
36
|
-
code: '<Checkbox disabled />',
|
|
37
|
-
preview: {
|
|
38
|
-
type: 'component',
|
|
39
|
-
component: 'Checkbox',
|
|
40
|
-
props: { disabled: true },
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
],
|
|
44
|
-
dependencies: ['utils'],
|
|
45
|
-
files: ['components/primitives/checkbox/index.tsx'],
|
|
46
|
-
};
|