@foundrykit/primitives 0.1.0
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/components.json +20 -0
- package/dist/chunk-A3U73FA7.js +33 -0
- package/dist/chunk-AADRFFPH.js +171 -0
- package/dist/chunk-FUWID6MC.js +42 -0
- package/dist/chunk-FYCANIVJ.js +69 -0
- package/dist/chunk-I44GXEPN.js +20 -0
- package/dist/chunk-J4CRGO2P.js +46 -0
- package/dist/chunk-J57CV3VT.js +28 -0
- package/dist/chunk-KZMSLRLW.js +25 -0
- package/dist/chunk-PHMEWMFS.js +233 -0
- package/dist/chunk-QL4XJD7Y.js +24 -0
- package/dist/chunk-SKR3J46C.js +17 -0
- package/dist/chunk-U2EIVYWP.js +33 -0
- package/dist/chunk-UZIMC7AQ.js +63 -0
- package/dist/chunk-VSXKLSEP.js +105 -0
- package/dist/chunk-VVNIYCKH.js +55 -0
- package/dist/chunk-XQAJQKO7.js +47 -0
- package/dist/chunk-YTUI6MCB.js +52 -0
- package/dist/components/avatar/index.cjs +92 -0
- package/dist/components/avatar/index.d.cts +9 -0
- package/dist/components/avatar/index.d.ts +9 -0
- package/dist/components/avatar/index.js +11 -0
- package/dist/components/badge/index.cjs +67 -0
- package/dist/components/badge/index.d.cts +13 -0
- package/dist/components/badge/index.d.ts +13 -0
- package/dist/components/badge/index.js +8 -0
- package/dist/components/breadcrumb/index.cjs +135 -0
- package/dist/components/breadcrumb/index.d.cts +14 -0
- package/dist/components/breadcrumb/index.d.ts +14 -0
- package/dist/components/breadcrumb/index.js +18 -0
- package/dist/components/button/index.cjs +77 -0
- package/dist/components/button/index.d.cts +15 -0
- package/dist/components/button/index.d.ts +15 -0
- package/dist/components/button/index.js +8 -0
- package/dist/components/card/index.cjs +102 -0
- package/dist/components/card/index.d.cts +10 -0
- package/dist/components/card/index.d.ts +10 -0
- package/dist/components/card/index.js +16 -0
- package/dist/components/checkbox/index.cjs +68 -0
- package/dist/components/checkbox/index.d.cts +7 -0
- package/dist/components/checkbox/index.d.ts +7 -0
- package/dist/components/checkbox/index.js +7 -0
- package/dist/components/dropdown/index.cjs +282 -0
- package/dist/components/dropdown/index.d.cts +28 -0
- package/dist/components/dropdown/index.d.ts +28 -0
- package/dist/components/dropdown/index.js +35 -0
- package/dist/components/input/index.cjs +59 -0
- package/dist/components/input/index.d.cts +7 -0
- package/dist/components/input/index.d.ts +7 -0
- package/dist/components/input/index.js +6 -0
- package/dist/components/label/index.cjs +59 -0
- package/dist/components/label/index.d.cts +7 -0
- package/dist/components/label/index.d.ts +7 -0
- package/dist/components/label/index.js +7 -0
- package/dist/components/popover/index.cjs +84 -0
- package/dist/components/popover/index.d.cts +10 -0
- package/dist/components/popover/index.d.ts +10 -0
- package/dist/components/popover/index.js +13 -0
- package/dist/components/radio-group/index.cjs +83 -0
- package/dist/components/radio-group/index.d.cts +8 -0
- package/dist/components/radio-group/index.d.ts +8 -0
- package/dist/components/radio-group/index.js +9 -0
- package/dist/components/select/index.cjs +215 -0
- package/dist/components/select/index.d.cts +18 -0
- package/dist/components/select/index.d.ts +18 -0
- package/dist/components/select/index.js +25 -0
- package/dist/components/separator/index.cjs +63 -0
- package/dist/components/separator/index.d.cts +7 -0
- package/dist/components/separator/index.d.ts +7 -0
- package/dist/components/separator/index.js +7 -0
- package/dist/components/skeleton/index.cjs +41 -0
- package/dist/components/skeleton/index.d.cts +5 -0
- package/dist/components/skeleton/index.d.ts +5 -0
- package/dist/components/skeleton/index.js +6 -0
- package/dist/components/switch/index.cjs +68 -0
- package/dist/components/switch/index.d.cts +7 -0
- package/dist/components/switch/index.d.ts +7 -0
- package/dist/components/switch/index.js +7 -0
- package/dist/components/tabs/index.cjs +107 -0
- package/dist/components/tabs/index.d.cts +10 -0
- package/dist/components/tabs/index.d.ts +10 -0
- package/dist/components/tabs/index.js +13 -0
- package/dist/components/textarea/index.cjs +44 -0
- package/dist/components/textarea/index.d.cts +6 -0
- package/dist/components/textarea/index.d.ts +6 -0
- package/dist/components/textarea/index.js +6 -0
- package/dist/index.cjs +1275 -0
- package/dist/index.d.cts +46 -0
- package/dist/index.d.ts +46 -0
- package/dist/index.js +298 -0
- package/eslint.config.js +4 -0
- package/package.json +67 -0
- package/postcss.config.mjs +6 -0
- package/registry.json +51 -0
- package/src/components/avatar/config.ts +46 -0
- package/src/components/avatar/index.tsx +53 -0
- package/src/components/badge/config.ts +56 -0
- package/src/components/badge/index.tsx +46 -0
- package/src/components/breadcrumb/config.ts +121 -0
- package/src/components/breadcrumb/index.tsx +109 -0
- package/src/components/button/config.ts +76 -0
- package/src/components/button/index.tsx +62 -0
- package/src/components/card/config.ts +89 -0
- package/src/components/card/index.tsx +83 -0
- package/src/components/checkbox/config.ts +46 -0
- package/src/components/checkbox/index.tsx +32 -0
- package/src/components/dialog/config.ts +582 -0
- package/src/components/dialog/index.tsx +143 -0
- package/src/components/dropdown/config.ts +262 -0
- package/src/components/dropdown/index.tsx +257 -0
- package/src/components/input/config.ts +64 -0
- package/src/components/input/index.tsx +25 -0
- package/src/components/label/config.ts +72 -0
- package/src/components/label/index.tsx +24 -0
- package/src/components/popover/config.ts +219 -0
- package/src/components/popover/index.tsx +48 -0
- package/src/components/radio-group/config.ts +303 -0
- package/src/components/radio-group/index.tsx +45 -0
- package/src/components/select/config.ts +277 -0
- package/src/components/select/index.tsx +185 -0
- package/src/components/separator/config.ts +63 -0
- package/src/components/separator/index.tsx +28 -0
- package/src/components/skeleton/config.ts +77 -0
- package/src/components/skeleton/index.tsx +13 -0
- package/src/components/switch/config.ts +165 -0
- package/src/components/switch/index.tsx +31 -0
- package/src/components/tabs/config.ts +335 -0
- package/src/components/tabs/index.tsx +66 -0
- package/src/components/textarea/config.ts +117 -0
- package/src/components/textarea/index.tsx +18 -0
- package/src/index.ts +87 -0
- package/tsconfig.json +9 -0
- package/tsconfig.lint.json +8 -0
- package/tsup.config.ts +29 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { 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
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import { cn } from '@foundrykit/utils';
|
|
4
|
+
|
|
5
|
+
export interface InputProps
|
|
6
|
+
extends React.InputHTMLAttributes<HTMLInputElement> {}
|
|
7
|
+
|
|
8
|
+
const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|
9
|
+
({ className, type, ...props }, ref) => {
|
|
10
|
+
return (
|
|
11
|
+
<input
|
|
12
|
+
type={type}
|
|
13
|
+
className={cn(
|
|
14
|
+
'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:outline-none focus-visible:ring-1 disabled:cursor-not-allowed disabled:opacity-50',
|
|
15
|
+
className
|
|
16
|
+
)}
|
|
17
|
+
ref={ref}
|
|
18
|
+
{...props}
|
|
19
|
+
/>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
Input.displayName = 'Input';
|
|
24
|
+
|
|
25
|
+
export { Input };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { ComponentConfig } from '@foundrykit/types';
|
|
2
|
+
|
|
3
|
+
export const labelConfig: ComponentConfig = {
|
|
4
|
+
name: 'Label',
|
|
5
|
+
description: 'Accessible label component for form inputs',
|
|
6
|
+
category: 'primitives',
|
|
7
|
+
tags: ['form', 'accessibility'],
|
|
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="text-sm font-medium text-gray-700">Label</div></div>',
|
|
11
|
+
},
|
|
12
|
+
variants: [
|
|
13
|
+
{
|
|
14
|
+
name: 'Default',
|
|
15
|
+
description: 'Basic label with default styling',
|
|
16
|
+
code: '<Label htmlFor="email">Email</Label>',
|
|
17
|
+
preview: {
|
|
18
|
+
type: 'component',
|
|
19
|
+
component: 'Label',
|
|
20
|
+
props: { htmlFor: 'email', children: 'Email' },
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: 'With Input',
|
|
25
|
+
description: 'Label associated with an input field',
|
|
26
|
+
code: `<div class="grid w-full max-w-sm items-center gap-1.5">
|
|
27
|
+
<Label htmlFor="email">Email</Label>
|
|
28
|
+
<Input type="email" id="email" placeholder="Enter your email" />
|
|
29
|
+
</div>`,
|
|
30
|
+
preview: {
|
|
31
|
+
type: 'component',
|
|
32
|
+
component: 'Label',
|
|
33
|
+
props: { htmlFor: 'email', children: 'Email' },
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: 'Required',
|
|
38
|
+
description: 'Label for required field with asterisk',
|
|
39
|
+
code: '<Label htmlFor="name">Name <span class="text-red-500">*</span></Label>',
|
|
40
|
+
preview: {
|
|
41
|
+
type: 'component',
|
|
42
|
+
component: 'Label',
|
|
43
|
+
props: {
|
|
44
|
+
htmlFor: 'name',
|
|
45
|
+
children: [
|
|
46
|
+
'Name ',
|
|
47
|
+
{
|
|
48
|
+
component: 'span',
|
|
49
|
+
props: { className: 'text-red-500', children: '*' },
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: 'Disabled',
|
|
57
|
+
description: 'Label for disabled input',
|
|
58
|
+
code: '<Label htmlFor="disabled" className="text-muted-foreground">Disabled Field</Label>',
|
|
59
|
+
preview: {
|
|
60
|
+
type: 'component',
|
|
61
|
+
component: 'Label',
|
|
62
|
+
props: {
|
|
63
|
+
htmlFor: 'disabled',
|
|
64
|
+
className: 'text-muted-foreground',
|
|
65
|
+
children: 'Disabled Field',
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
dependencies: ['utils'],
|
|
71
|
+
files: ['components/primitives/label/index.tsx'],
|
|
72
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
5
|
+
|
|
6
|
+
import { cn } from '@foundrykit/utils';
|
|
7
|
+
|
|
8
|
+
function Label({
|
|
9
|
+
className,
|
|
10
|
+
...props
|
|
11
|
+
}: React.ComponentProps<typeof LabelPrimitive.Root>) {
|
|
12
|
+
return (
|
|
13
|
+
<LabelPrimitive.Root
|
|
14
|
+
data-slot='label'
|
|
15
|
+
className={cn(
|
|
16
|
+
'flex select-none items-center gap-2 text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-50 group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50',
|
|
17
|
+
className
|
|
18
|
+
)}
|
|
19
|
+
{...props}
|
|
20
|
+
/>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { Label };
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { 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
|
+
{ component: 'PopoverTrigger', props: { children: 'Open Popover' } },
|
|
35
|
+
{
|
|
36
|
+
component: 'PopoverContent',
|
|
37
|
+
props: {
|
|
38
|
+
children: {
|
|
39
|
+
component: 'div',
|
|
40
|
+
props: {
|
|
41
|
+
className: 'grid gap-4',
|
|
42
|
+
children: {
|
|
43
|
+
component: 'div',
|
|
44
|
+
props: {
|
|
45
|
+
className: 'space-y-2',
|
|
46
|
+
children: [
|
|
47
|
+
{
|
|
48
|
+
component: 'h4',
|
|
49
|
+
props: {
|
|
50
|
+
className: 'font-medium leading-none',
|
|
51
|
+
children: 'Dimensions',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
component: 'p',
|
|
56
|
+
props: {
|
|
57
|
+
className: 'text-sm text-muted-foreground',
|
|
58
|
+
children: 'Set the dimensions for the layer.',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: 'With Form',
|
|
74
|
+
description: 'Popover containing form elements',
|
|
75
|
+
code: `<Popover>
|
|
76
|
+
<PopoverTrigger asChild>
|
|
77
|
+
<Button variant="outline">Settings</Button>
|
|
78
|
+
</PopoverTrigger>
|
|
79
|
+
<PopoverContent className="w-80">
|
|
80
|
+
<div class="grid gap-4">
|
|
81
|
+
<div class="space-y-2">
|
|
82
|
+
<h4 class="font-medium leading-none">Settings</h4>
|
|
83
|
+
<p class="text-sm text-muted-foreground">Configure your preferences.</p>
|
|
84
|
+
</div>
|
|
85
|
+
<div class="grid gap-2">
|
|
86
|
+
<Label htmlFor="width">Width</Label>
|
|
87
|
+
<Input id="width" defaultValue="100%" />
|
|
88
|
+
</div>
|
|
89
|
+
</div>
|
|
90
|
+
</PopoverContent>
|
|
91
|
+
</Popover>`,
|
|
92
|
+
preview: {
|
|
93
|
+
type: 'component',
|
|
94
|
+
component: 'Popover',
|
|
95
|
+
props: {
|
|
96
|
+
children: [
|
|
97
|
+
{ component: 'PopoverTrigger', props: { children: 'Settings' } },
|
|
98
|
+
{
|
|
99
|
+
component: 'PopoverContent',
|
|
100
|
+
props: {
|
|
101
|
+
className: 'w-80',
|
|
102
|
+
children: {
|
|
103
|
+
component: 'div',
|
|
104
|
+
props: {
|
|
105
|
+
className: 'grid gap-4',
|
|
106
|
+
children: [
|
|
107
|
+
{
|
|
108
|
+
component: 'div',
|
|
109
|
+
props: {
|
|
110
|
+
className: 'space-y-2',
|
|
111
|
+
children: [
|
|
112
|
+
{
|
|
113
|
+
component: 'h4',
|
|
114
|
+
props: {
|
|
115
|
+
className: 'font-medium leading-none',
|
|
116
|
+
children: 'Settings',
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
component: 'p',
|
|
121
|
+
props: {
|
|
122
|
+
className: 'text-sm text-muted-foreground',
|
|
123
|
+
children: 'Configure your preferences.',
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
],
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
component: 'div',
|
|
131
|
+
props: {
|
|
132
|
+
className: 'grid gap-2',
|
|
133
|
+
children: [
|
|
134
|
+
{
|
|
135
|
+
component: 'Label',
|
|
136
|
+
props: { htmlFor: 'width', children: 'Width' },
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
component: 'Input',
|
|
140
|
+
props: { id: 'width', defaultValue: '100%' },
|
|
141
|
+
},
|
|
142
|
+
],
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
],
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
name: 'With Close Button',
|
|
156
|
+
description: 'Popover with close button in header',
|
|
157
|
+
code: `<Popover>
|
|
158
|
+
<PopoverTrigger asChild>
|
|
159
|
+
<Button variant="outline">Info</Button>
|
|
160
|
+
</PopoverTrigger>
|
|
161
|
+
<PopoverContent>
|
|
162
|
+
<div class="flex items-center justify-between">
|
|
163
|
+
<h4 class="font-medium">Information</h4>
|
|
164
|
+
<Button variant="ghost" size="sm" onClick={() => {}}>×</Button>
|
|
165
|
+
</div>
|
|
166
|
+
<p class="text-sm mt-2">This is some helpful information.</p>
|
|
167
|
+
</PopoverContent>
|
|
168
|
+
</Popover>`,
|
|
169
|
+
preview: {
|
|
170
|
+
type: 'component',
|
|
171
|
+
component: 'Popover',
|
|
172
|
+
props: {
|
|
173
|
+
children: [
|
|
174
|
+
{ component: 'PopoverTrigger', props: { children: 'Info' } },
|
|
175
|
+
{
|
|
176
|
+
component: 'PopoverContent',
|
|
177
|
+
props: {
|
|
178
|
+
children: [
|
|
179
|
+
{
|
|
180
|
+
component: 'div',
|
|
181
|
+
props: {
|
|
182
|
+
className: 'flex items-center justify-between',
|
|
183
|
+
children: [
|
|
184
|
+
{
|
|
185
|
+
component: 'h4',
|
|
186
|
+
props: {
|
|
187
|
+
className: 'font-medium',
|
|
188
|
+
children: 'Information',
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
component: 'Button',
|
|
193
|
+
props: {
|
|
194
|
+
variant: 'ghost',
|
|
195
|
+
size: 'sm',
|
|
196
|
+
children: '×',
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
],
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
component: 'p',
|
|
204
|
+
props: {
|
|
205
|
+
className: 'text-sm mt-2',
|
|
206
|
+
children: 'This is some helpful information.',
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
],
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
],
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
],
|
|
217
|
+
dependencies: ['utils', 'button', 'input', 'label'],
|
|
218
|
+
files: ['components/primitives/popover/index.tsx'],
|
|
219
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
5
|
+
|
|
6
|
+
import { cn } from '@foundrykit/utils';
|
|
7
|
+
|
|
8
|
+
function Popover({
|
|
9
|
+
...props
|
|
10
|
+
}: React.ComponentProps<typeof PopoverPrimitive.Root>) {
|
|
11
|
+
return <PopoverPrimitive.Root data-slot='popover' {...props} />;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function PopoverTrigger({
|
|
15
|
+
...props
|
|
16
|
+
}: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {
|
|
17
|
+
return <PopoverPrimitive.Trigger data-slot='popover-trigger' {...props} />;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function PopoverContent({
|
|
21
|
+
className,
|
|
22
|
+
align = 'center',
|
|
23
|
+
sideOffset = 4,
|
|
24
|
+
...props
|
|
25
|
+
}: React.ComponentProps<typeof PopoverPrimitive.Content>) {
|
|
26
|
+
return (
|
|
27
|
+
<PopoverPrimitive.Portal>
|
|
28
|
+
<PopoverPrimitive.Content
|
|
29
|
+
data-slot='popover-content'
|
|
30
|
+
align={align}
|
|
31
|
+
sideOffset={sideOffset}
|
|
32
|
+
className={cn(
|
|
33
|
+
'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 origin-(--radix-popover-content-transform-origin) outline-hidden z-50 w-72 rounded-md border p-4 shadow-md',
|
|
34
|
+
className
|
|
35
|
+
)}
|
|
36
|
+
{...props}
|
|
37
|
+
/>
|
|
38
|
+
</PopoverPrimitive.Portal>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function PopoverAnchor({
|
|
43
|
+
...props
|
|
44
|
+
}: React.ComponentProps<typeof PopoverPrimitive.Anchor>) {
|
|
45
|
+
return <PopoverPrimitive.Anchor data-slot='popover-anchor' {...props} />;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor };
|