@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.
- package/dist/chunk-3NQR7JZR.js +128 -0
- package/dist/chunk-B5YCE3UP.js +57 -0
- package/dist/chunk-F2TEA6ER.js +138 -0
- package/dist/chunk-SIQHWNPH.js +45 -0
- 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/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/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/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.d.cts +11 -105
- package/dist/index.d.ts +11 -105
- package/dist/index.js +93 -399
- package/package.json +200 -8
- package/CHANGELOG.md +0 -230
- 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 -90
- 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 -32
- 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 -76
- 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,202 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { cn } from '@foundrykit/utils';
|
|
4
|
-
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
5
|
-
import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from 'lucide-react';
|
|
6
|
-
import type * as React from 'react';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Select (listbox) root built on Radix `Select.Root`. Compose with
|
|
10
|
-
* {@link SelectTrigger} + {@link SelectValue}, {@link SelectContent} and options
|
|
11
|
-
* ({@link SelectItem}, {@link SelectGroup}, {@link SelectLabel},
|
|
12
|
-
* {@link SelectSeparator}); scroll buttons are included automatically.
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```tsx
|
|
16
|
-
* <Select value={v} onValueChange={setV}>
|
|
17
|
-
* <SelectTrigger><SelectValue placeholder="Pick" /></SelectTrigger>
|
|
18
|
-
* <SelectContent>
|
|
19
|
-
* <SelectItem value="a">A</SelectItem>
|
|
20
|
-
* </SelectContent>
|
|
21
|
-
* </Select>
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
function Select({
|
|
25
|
-
...props
|
|
26
|
-
}: React.ComponentProps<typeof SelectPrimitive.Root>) {
|
|
27
|
-
return <SelectPrimitive.Root data-slot='select' {...props} />;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function SelectGroup({
|
|
31
|
-
...props
|
|
32
|
-
}: React.ComponentProps<typeof SelectPrimitive.Group>) {
|
|
33
|
-
return <SelectPrimitive.Group data-slot='select-group' {...props} />;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function SelectValue({
|
|
37
|
-
...props
|
|
38
|
-
}: React.ComponentProps<typeof SelectPrimitive.Value>) {
|
|
39
|
-
return <SelectPrimitive.Value data-slot='select-value' {...props} />;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/** Trigger button that opens the select and shows the current {@link SelectValue}; `size` may be `sm` or `default`. */
|
|
43
|
-
function SelectTrigger({
|
|
44
|
-
className,
|
|
45
|
-
size = 'default',
|
|
46
|
-
children,
|
|
47
|
-
...props
|
|
48
|
-
}: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
|
|
49
|
-
size?: 'sm' | 'default';
|
|
50
|
-
}) {
|
|
51
|
-
return (
|
|
52
|
-
<SelectPrimitive.Trigger
|
|
53
|
-
data-slot='select-trigger'
|
|
54
|
-
data-size={size}
|
|
55
|
-
className={cn(
|
|
56
|
-
"border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
57
|
-
className
|
|
58
|
-
)}
|
|
59
|
-
{...props}
|
|
60
|
-
>
|
|
61
|
-
{children}
|
|
62
|
-
<SelectPrimitive.Icon asChild>
|
|
63
|
-
<ChevronDownIcon className='size-4 opacity-50' />
|
|
64
|
-
</SelectPrimitive.Icon>
|
|
65
|
-
</SelectPrimitive.Trigger>
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/** Portalled, animated listbox panel holding the options; defaults to `position="popper"`. */
|
|
70
|
-
function SelectContent({
|
|
71
|
-
className,
|
|
72
|
-
children,
|
|
73
|
-
position = 'popper',
|
|
74
|
-
...props
|
|
75
|
-
}: React.ComponentProps<typeof SelectPrimitive.Content>) {
|
|
76
|
-
return (
|
|
77
|
-
<SelectPrimitive.Portal>
|
|
78
|
-
<SelectPrimitive.Content
|
|
79
|
-
data-slot='select-content'
|
|
80
|
-
className={cn(
|
|
81
|
-
'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 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md',
|
|
82
|
-
position === 'popper' &&
|
|
83
|
-
'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1',
|
|
84
|
-
className
|
|
85
|
-
)}
|
|
86
|
-
position={position}
|
|
87
|
-
{...props}
|
|
88
|
-
>
|
|
89
|
-
<SelectScrollUpButton />
|
|
90
|
-
<SelectPrimitive.Viewport
|
|
91
|
-
className={cn(
|
|
92
|
-
'p-1',
|
|
93
|
-
position === 'popper' &&
|
|
94
|
-
'h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1'
|
|
95
|
-
)}
|
|
96
|
-
>
|
|
97
|
-
{children}
|
|
98
|
-
</SelectPrimitive.Viewport>
|
|
99
|
-
<SelectScrollDownButton />
|
|
100
|
-
</SelectPrimitive.Content>
|
|
101
|
-
</SelectPrimitive.Portal>
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
function SelectLabel({
|
|
106
|
-
className,
|
|
107
|
-
...props
|
|
108
|
-
}: React.ComponentProps<typeof SelectPrimitive.Label>) {
|
|
109
|
-
return (
|
|
110
|
-
<SelectPrimitive.Label
|
|
111
|
-
data-slot='select-label'
|
|
112
|
-
className={cn('text-muted-foreground px-2 py-1.5 text-xs', className)}
|
|
113
|
-
{...props}
|
|
114
|
-
/>
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function SelectItem({
|
|
119
|
-
className,
|
|
120
|
-
children,
|
|
121
|
-
...props
|
|
122
|
-
}: React.ComponentProps<typeof SelectPrimitive.Item>) {
|
|
123
|
-
return (
|
|
124
|
-
<SelectPrimitive.Item
|
|
125
|
-
data-slot='select-item'
|
|
126
|
-
className={cn(
|
|
127
|
-
"focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
|
|
128
|
-
className
|
|
129
|
-
)}
|
|
130
|
-
{...props}
|
|
131
|
-
>
|
|
132
|
-
<span className='absolute right-2 flex size-3.5 items-center justify-center'>
|
|
133
|
-
<SelectPrimitive.ItemIndicator>
|
|
134
|
-
<CheckIcon className='size-4' />
|
|
135
|
-
</SelectPrimitive.ItemIndicator>
|
|
136
|
-
</span>
|
|
137
|
-
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
|
138
|
-
</SelectPrimitive.Item>
|
|
139
|
-
);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
function SelectSeparator({
|
|
143
|
-
className,
|
|
144
|
-
...props
|
|
145
|
-
}: React.ComponentProps<typeof SelectPrimitive.Separator>) {
|
|
146
|
-
return (
|
|
147
|
-
<SelectPrimitive.Separator
|
|
148
|
-
data-slot='select-separator'
|
|
149
|
-
className={cn('bg-border pointer-events-none -mx-1 my-1 h-px', className)}
|
|
150
|
-
{...props}
|
|
151
|
-
/>
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
function SelectScrollUpButton({
|
|
156
|
-
className,
|
|
157
|
-
...props
|
|
158
|
-
}: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {
|
|
159
|
-
return (
|
|
160
|
-
<SelectPrimitive.ScrollUpButton
|
|
161
|
-
data-slot='select-scroll-up-button'
|
|
162
|
-
className={cn(
|
|
163
|
-
'flex cursor-default items-center justify-center py-1',
|
|
164
|
-
className
|
|
165
|
-
)}
|
|
166
|
-
{...props}
|
|
167
|
-
>
|
|
168
|
-
<ChevronUpIcon className='size-4' />
|
|
169
|
-
</SelectPrimitive.ScrollUpButton>
|
|
170
|
-
);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
function SelectScrollDownButton({
|
|
174
|
-
className,
|
|
175
|
-
...props
|
|
176
|
-
}: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {
|
|
177
|
-
return (
|
|
178
|
-
<SelectPrimitive.ScrollDownButton
|
|
179
|
-
data-slot='select-scroll-down-button'
|
|
180
|
-
className={cn(
|
|
181
|
-
'flex cursor-default items-center justify-center py-1',
|
|
182
|
-
className
|
|
183
|
-
)}
|
|
184
|
-
{...props}
|
|
185
|
-
>
|
|
186
|
-
<ChevronDownIcon className='size-4' />
|
|
187
|
-
</SelectPrimitive.ScrollDownButton>
|
|
188
|
-
);
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
export {
|
|
192
|
-
Select,
|
|
193
|
-
SelectContent,
|
|
194
|
-
SelectGroup,
|
|
195
|
-
SelectItem,
|
|
196
|
-
SelectLabel,
|
|
197
|
-
SelectScrollDownButton,
|
|
198
|
-
SelectScrollUpButton,
|
|
199
|
-
SelectSeparator,
|
|
200
|
-
SelectTrigger,
|
|
201
|
-
SelectValue,
|
|
202
|
-
};
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import type { ComponentConfig } from '@foundrykit/types';
|
|
2
|
-
|
|
3
|
-
export const separatorConfig: ComponentConfig = {
|
|
4
|
-
name: 'Separator',
|
|
5
|
-
description: 'Visual separator component for dividing content',
|
|
6
|
-
category: 'primitives',
|
|
7
|
-
tags: ['layout', '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="w-full h-px bg-gray-300"></div></div>',
|
|
11
|
-
},
|
|
12
|
-
variants: [
|
|
13
|
-
{
|
|
14
|
-
name: 'Default',
|
|
15
|
-
description: 'Basic horizontal separator',
|
|
16
|
-
code: '<Separator />',
|
|
17
|
-
preview: {
|
|
18
|
-
type: 'component',
|
|
19
|
-
component: 'Separator',
|
|
20
|
-
props: {},
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
name: 'Vertical',
|
|
25
|
-
description: 'Vertical separator for horizontal layouts',
|
|
26
|
-
code: '<div class="flex h-4 items-center space-x-4"><div>Left</div><Separator orientation="vertical" /><div>Right</div></div>',
|
|
27
|
-
preview: {
|
|
28
|
-
type: 'component',
|
|
29
|
-
component: 'Separator',
|
|
30
|
-
props: { orientation: 'vertical' },
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
name: 'With Text',
|
|
35
|
-
description: 'Separator with centered text',
|
|
36
|
-
code: `<div class="relative">
|
|
37
|
-
<div class="absolute inset-0 flex items-center">
|
|
38
|
-
<Separator />
|
|
39
|
-
</div>
|
|
40
|
-
<div class="relative flex justify-center text-xs uppercase">
|
|
41
|
-
<span class="bg-background px-2 text-muted-foreground">Or continue with</span>
|
|
42
|
-
</div>
|
|
43
|
-
</div>`,
|
|
44
|
-
preview: {
|
|
45
|
-
type: 'component',
|
|
46
|
-
component: 'Separator',
|
|
47
|
-
props: {},
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
name: 'Custom Styling',
|
|
52
|
-
description: 'Separator with custom styling',
|
|
53
|
-
code: '<Separator className="my-4 bg-blue-200" />',
|
|
54
|
-
preview: {
|
|
55
|
-
type: 'component',
|
|
56
|
-
component: 'Separator',
|
|
57
|
-
props: { className: 'my-4 bg-blue-200' },
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
],
|
|
61
|
-
dependencies: ['utils'],
|
|
62
|
-
files: ['components/primitives/separator/index.tsx'],
|
|
63
|
-
};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { cn } from '@foundrykit/utils';
|
|
4
|
-
import * as SeparatorPrimitive from '@radix-ui/react-separator';
|
|
5
|
-
import type * as React from 'react';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Thin dividing line built on Radix `Separator.Root`. `orientation` may be
|
|
9
|
-
* `horizontal` (default) or `vertical`; `decorative` (default `true`) hides it
|
|
10
|
-
* from assistive tech.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```tsx
|
|
14
|
-
* <Separator />
|
|
15
|
-
* <Separator orientation="vertical" />
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
function Separator({
|
|
19
|
-
className,
|
|
20
|
-
orientation = 'horizontal',
|
|
21
|
-
decorative = true,
|
|
22
|
-
...props
|
|
23
|
-
}: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
|
|
24
|
-
return (
|
|
25
|
-
<SeparatorPrimitive.Root
|
|
26
|
-
data-slot='separator'
|
|
27
|
-
decorative={decorative}
|
|
28
|
-
orientation={orientation}
|
|
29
|
-
className={cn(
|
|
30
|
-
'bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px',
|
|
31
|
-
className
|
|
32
|
-
)}
|
|
33
|
-
{...props}
|
|
34
|
-
/>
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export { Separator };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { ComponentConfig } from '@foundrykit/types';
|
|
2
|
-
|
|
3
|
-
export const sheetConfig: ComponentConfig = {
|
|
4
|
-
name: 'Sheet',
|
|
5
|
-
description: 'Sheet component for displaying content in a floating panel',
|
|
6
|
-
category: 'primitives',
|
|
7
|
-
tags: ['overlay', 'modal', '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">Sheet</div></div>',
|
|
11
|
-
},
|
|
12
|
-
variants: [],
|
|
13
|
-
dependencies: ['utils'],
|
|
14
|
-
packageDependencies: ['@radix-ui/react-dialog', 'lucide-react'],
|
|
15
|
-
files: ['components/primitives/sheet/index.tsx'],
|
|
16
|
-
};
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { cn } from '@foundrykit/utils';
|
|
4
|
-
import * as SheetPrimitive from '@radix-ui/react-dialog';
|
|
5
|
-
import { XIcon } from 'lucide-react';
|
|
6
|
-
import type * as React from 'react';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Slide-in panel (drawer) built on the Radix Dialog primitive. Compose with
|
|
10
|
-
* {@link SheetTrigger}, {@link SheetContent}, {@link SheetHeader},
|
|
11
|
-
* {@link SheetTitle}, {@link SheetDescription} and {@link SheetFooter}.
|
|
12
|
-
* {@link SheetContent} slides from a chosen `side` and includes a close button.
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```tsx
|
|
16
|
-
* <Sheet>
|
|
17
|
-
* <SheetTrigger>Open</SheetTrigger>
|
|
18
|
-
* <SheetContent side="left">...</SheetContent>
|
|
19
|
-
* </Sheet>
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) {
|
|
23
|
-
return <SheetPrimitive.Root data-slot='sheet' {...props} />;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function SheetTrigger({
|
|
27
|
-
...props
|
|
28
|
-
}: React.ComponentProps<typeof SheetPrimitive.Trigger>) {
|
|
29
|
-
return <SheetPrimitive.Trigger data-slot='sheet-trigger' {...props} />;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function SheetClose({
|
|
33
|
-
...props
|
|
34
|
-
}: React.ComponentProps<typeof SheetPrimitive.Close>) {
|
|
35
|
-
return <SheetPrimitive.Close data-slot='sheet-close' {...props} />;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function SheetPortal({
|
|
39
|
-
...props
|
|
40
|
-
}: React.ComponentProps<typeof SheetPrimitive.Portal>) {
|
|
41
|
-
return <SheetPrimitive.Portal data-slot='sheet-portal' {...props} />;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function SheetOverlay({
|
|
45
|
-
className,
|
|
46
|
-
...props
|
|
47
|
-
}: React.ComponentProps<typeof SheetPrimitive.Overlay>) {
|
|
48
|
-
return (
|
|
49
|
-
<SheetPrimitive.Overlay
|
|
50
|
-
data-slot='sheet-overlay'
|
|
51
|
-
className={cn(
|
|
52
|
-
'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50',
|
|
53
|
-
className
|
|
54
|
-
)}
|
|
55
|
-
{...props}
|
|
56
|
-
/>
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/** Portalled sheet panel that slides in from `side` (`top`/`right`/`bottom`/`left`, default `right`) over an overlay, with a built-in close button. */
|
|
61
|
-
function SheetContent({
|
|
62
|
-
className,
|
|
63
|
-
children,
|
|
64
|
-
side = 'right',
|
|
65
|
-
...props
|
|
66
|
-
}: React.ComponentProps<typeof SheetPrimitive.Content> & {
|
|
67
|
-
side?: 'top' | 'right' | 'bottom' | 'left';
|
|
68
|
-
}) {
|
|
69
|
-
return (
|
|
70
|
-
<SheetPortal>
|
|
71
|
-
<SheetOverlay />
|
|
72
|
-
<SheetPrimitive.Content
|
|
73
|
-
data-slot='sheet-content'
|
|
74
|
-
className={cn(
|
|
75
|
-
'bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500',
|
|
76
|
-
side === 'right' &&
|
|
77
|
-
'motion-safe:data-[state=closed]:slide-out-to-right motion-safe:data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm',
|
|
78
|
-
side === 'left' &&
|
|
79
|
-
'motion-safe:data-[state=closed]:slide-out-to-left motion-safe:data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm',
|
|
80
|
-
side === 'top' &&
|
|
81
|
-
'motion-safe:data-[state=closed]:slide-out-to-top motion-safe:data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b',
|
|
82
|
-
side === 'bottom' &&
|
|
83
|
-
'motion-safe:data-[state=closed]:slide-out-to-bottom motion-safe:data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t',
|
|
84
|
-
className
|
|
85
|
-
)}
|
|
86
|
-
{...props}
|
|
87
|
-
>
|
|
88
|
-
{children}
|
|
89
|
-
<SheetPrimitive.Close className='ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none'>
|
|
90
|
-
<XIcon className='size-4' />
|
|
91
|
-
<span className='sr-only'>Close</span>
|
|
92
|
-
</SheetPrimitive.Close>
|
|
93
|
-
</SheetPrimitive.Content>
|
|
94
|
-
</SheetPortal>
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
function SheetHeader({ className, ...props }: React.ComponentProps<'div'>) {
|
|
99
|
-
return (
|
|
100
|
-
<div
|
|
101
|
-
data-slot='sheet-header'
|
|
102
|
-
className={cn('flex flex-col gap-1.5 p-4', className)}
|
|
103
|
-
{...props}
|
|
104
|
-
/>
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function SheetFooter({ className, ...props }: React.ComponentProps<'div'>) {
|
|
109
|
-
return (
|
|
110
|
-
<div
|
|
111
|
-
data-slot='sheet-footer'
|
|
112
|
-
className={cn('mt-auto flex flex-col gap-2 p-4', className)}
|
|
113
|
-
{...props}
|
|
114
|
-
/>
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function SheetTitle({
|
|
119
|
-
className,
|
|
120
|
-
...props
|
|
121
|
-
}: React.ComponentProps<typeof SheetPrimitive.Title>) {
|
|
122
|
-
return (
|
|
123
|
-
<SheetPrimitive.Title
|
|
124
|
-
data-slot='sheet-title'
|
|
125
|
-
className={cn('text-foreground font-semibold', className)}
|
|
126
|
-
{...props}
|
|
127
|
-
/>
|
|
128
|
-
);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
function SheetDescription({
|
|
132
|
-
className,
|
|
133
|
-
...props
|
|
134
|
-
}: React.ComponentProps<typeof SheetPrimitive.Description>) {
|
|
135
|
-
return (
|
|
136
|
-
<SheetPrimitive.Description
|
|
137
|
-
data-slot='sheet-description'
|
|
138
|
-
className={cn('text-muted-foreground text-sm', className)}
|
|
139
|
-
{...props}
|
|
140
|
-
/>
|
|
141
|
-
);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
export {
|
|
145
|
-
Sheet,
|
|
146
|
-
SheetClose,
|
|
147
|
-
SheetContent,
|
|
148
|
-
SheetDescription,
|
|
149
|
-
SheetFooter,
|
|
150
|
-
SheetHeader,
|
|
151
|
-
SheetTitle,
|
|
152
|
-
SheetTrigger,
|
|
153
|
-
};
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import type { ComponentConfig } from '@foundrykit/types';
|
|
2
|
-
|
|
3
|
-
export const skeletonConfig: ComponentConfig = {
|
|
4
|
-
name: 'Skeleton',
|
|
5
|
-
description: 'Skeleton loading component for content placeholders',
|
|
6
|
-
category: 'primitives',
|
|
7
|
-
tags: ['loading', '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="h-4 w-32 rounded bg-gray-300 animate-pulse"></div></div>',
|
|
11
|
-
},
|
|
12
|
-
variants: [
|
|
13
|
-
{
|
|
14
|
-
name: 'Default',
|
|
15
|
-
description: 'Basic skeleton with default styling',
|
|
16
|
-
code: '<Skeleton className="h-4 w-[250px]" />',
|
|
17
|
-
preview: {
|
|
18
|
-
type: 'component',
|
|
19
|
-
component: 'Skeleton',
|
|
20
|
-
props: { className: 'h-4 w-[250px]' },
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
name: 'Card Layout',
|
|
25
|
-
description: 'Skeleton for card content layout',
|
|
26
|
-
code: `<div class="flex flex-col space-y-3">
|
|
27
|
-
<Skeleton className="h-[125px] w-[250px] rounded-xl" />
|
|
28
|
-
<div class="space-y-2">
|
|
29
|
-
<Skeleton className="h-4 w-[250px]" />
|
|
30
|
-
<Skeleton className="h-4 w-[200px]" />
|
|
31
|
-
</div>
|
|
32
|
-
</div>`,
|
|
33
|
-
preview: {
|
|
34
|
-
type: 'component',
|
|
35
|
-
component: 'Skeleton',
|
|
36
|
-
props: { className: 'h-4 w-[250px]' },
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
name: 'Avatar',
|
|
41
|
-
description: 'Skeleton for avatar placeholder',
|
|
42
|
-
code: '<Skeleton className="h-12 w-12 rounded-full" />',
|
|
43
|
-
preview: {
|
|
44
|
-
type: 'component',
|
|
45
|
-
component: 'Skeleton',
|
|
46
|
-
props: { className: 'h-12 w-12 rounded-full' },
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
name: 'List Items',
|
|
51
|
-
description: 'Skeleton for list item layout',
|
|
52
|
-
code: `<div class="space-y-4">
|
|
53
|
-
<div class="flex items-center space-x-4">
|
|
54
|
-
<Skeleton className="h-12 w-12 rounded-full" />
|
|
55
|
-
<div class="space-y-2">
|
|
56
|
-
<Skeleton className="h-4 w-[250px]" />
|
|
57
|
-
<Skeleton className="h-4 w-[200px]" />
|
|
58
|
-
</div>
|
|
59
|
-
</div>
|
|
60
|
-
<div class="flex items-center space-x-4">
|
|
61
|
-
<Skeleton className="h-12 w-12 rounded-full" />
|
|
62
|
-
<div class="space-y-2">
|
|
63
|
-
<Skeleton className="h-4 w-[250px]" />
|
|
64
|
-
<Skeleton className="h-4 w-[200px]" />
|
|
65
|
-
</div>
|
|
66
|
-
</div>
|
|
67
|
-
</div>`,
|
|
68
|
-
preview: {
|
|
69
|
-
type: 'component',
|
|
70
|
-
component: 'Skeleton',
|
|
71
|
-
props: { className: 'h-4 w-[250px]' },
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
],
|
|
75
|
-
dependencies: ['utils'],
|
|
76
|
-
files: ['components/primitives/skeleton/index.tsx'],
|
|
77
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { cn } from '@foundrykit/utils';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Placeholder block with a pulse animation for loading states. Size and shape it
|
|
5
|
-
* with `className`.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```tsx
|
|
9
|
-
* <Skeleton className="h-4 w-32" />
|
|
10
|
-
* ```
|
|
11
|
-
*/
|
|
12
|
-
function Skeleton({ className, ...props }: React.ComponentProps<'div'>) {
|
|
13
|
-
return (
|
|
14
|
-
<div
|
|
15
|
-
data-slot='skeleton'
|
|
16
|
-
className={cn('bg-accent animate-pulse rounded-md', className)}
|
|
17
|
-
{...props}
|
|
18
|
-
/>
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export { Skeleton };
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { ComponentConfig } from '@foundrykit/types';
|
|
2
|
-
|
|
3
|
-
export const SliderConfig: ComponentConfig = {
|
|
4
|
-
name: 'Slider',
|
|
5
|
-
description:
|
|
6
|
-
'An input where the user selects a value or range from within a given range.',
|
|
7
|
-
category: 'primitives',
|
|
8
|
-
tags: ['slider', 'input', 'form'],
|
|
9
|
-
preview: {
|
|
10
|
-
type: 'static',
|
|
11
|
-
html: '<div class="flex h-12 w-full items-center px-3"><div class="relative h-1.5 w-full rounded-full bg-gray-200"><div class="absolute h-full w-1/2 rounded-full bg-gray-500"></div><div class="absolute left-1/2 top-1/2 size-4 -translate-x-1/2 -translate-y-1/2 rounded-full border border-gray-500 bg-white"></div></div></div>',
|
|
12
|
-
},
|
|
13
|
-
variants: [
|
|
14
|
-
{
|
|
15
|
-
name: 'Default',
|
|
16
|
-
description: 'Single-thumb slider',
|
|
17
|
-
code: '<Slider defaultValue={[50]} max={100} step={1} />',
|
|
18
|
-
preview: {
|
|
19
|
-
type: 'component',
|
|
20
|
-
component: 'Slider',
|
|
21
|
-
props: {
|
|
22
|
-
defaultValue: [50],
|
|
23
|
-
max: 100,
|
|
24
|
-
step: 1,
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
name: 'Range',
|
|
30
|
-
description: 'Multi-thumb range slider',
|
|
31
|
-
code: '<Slider defaultValue={[25, 75]} max={100} step={1} />',
|
|
32
|
-
preview: {
|
|
33
|
-
type: 'component',
|
|
34
|
-
component: 'Slider',
|
|
35
|
-
props: {
|
|
36
|
-
defaultValue: [25, 75],
|
|
37
|
-
max: 100,
|
|
38
|
-
step: 1,
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
],
|
|
43
|
-
dependencies: ['utils'],
|
|
44
|
-
packageDependencies: ['@radix-ui/react-slider'],
|
|
45
|
-
files: ['components/primitives/slider/index.tsx'],
|
|
46
|
-
};
|