@playfast/reform-better-hub-ui-primitives 0.2.2 → 0.3.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/README.md +9 -9
- package/package.json +23 -23
- package/src/components/agent-icon.tsx +16 -16
- package/src/components/autocomplete.tsx +166 -162
- package/src/components/badge.tsx +46 -45
- package/src/components/button.tsx +56 -63
- package/src/components/combobox.tsx +233 -228
- package/src/components/command.tsx +135 -139
- package/src/components/dialog.tsx +106 -98
- package/src/components/dropdown-menu.tsx +118 -115
- package/src/components/github-background.tsx +214 -216
- package/src/components/halftone-background.tsx +164 -155
- package/src/components/halftone-config.ts +8 -8
- package/src/components/input-group.tsx +149 -147
- package/src/components/input.tsx +17 -17
- package/src/components/live-duration.tsx +70 -64
- package/src/components/logo.tsx +9 -13
- package/src/components/popover.tsx +60 -62
- package/src/components/resize-handle.tsx +73 -75
- package/src/components/sheet.tsx +120 -112
- package/src/components/textarea.tsx +15 -15
- package/src/components/time-ago.tsx +64 -62
- package/src/components/tooltip.tsx +48 -42
- package/src/foundation/styles.css +6 -4
- package/src/index.ts +21 -21
|
@@ -1,169 +1,165 @@
|
|
|
1
|
-
import { Command as CommandPrimitive } from
|
|
2
|
-
import { SearchIcon } from
|
|
3
|
-
import type * as React from
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
DialogContent,
|
|
7
|
-
DialogDescription,
|
|
8
|
-
DialogHeader,
|
|
9
|
-
DialogTitle,
|
|
10
|
-
} from "./dialog";
|
|
11
|
-
import { cn } from "../foundation/cn";
|
|
1
|
+
import { Command as CommandPrimitive } from 'cmdk'
|
|
2
|
+
import { SearchIcon } from 'lucide-react'
|
|
3
|
+
import type * as React from 'react'
|
|
4
|
+
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from './dialog'
|
|
5
|
+
import { cn } from '../foundation/cn'
|
|
12
6
|
|
|
13
|
-
function Command({
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
7
|
+
function Command({
|
|
8
|
+
className,
|
|
9
|
+
...props
|
|
10
|
+
}: React.ComponentProps<typeof CommandPrimitive>): React.JSX.Element {
|
|
11
|
+
return (
|
|
12
|
+
<CommandPrimitive
|
|
13
|
+
data-slot="command"
|
|
14
|
+
className={cn(
|
|
15
|
+
'bg-background text-foreground flex h-full w-full flex-col overflow-hidden rounded-md',
|
|
16
|
+
className,
|
|
17
|
+
)}
|
|
18
|
+
{...props}
|
|
19
|
+
/>
|
|
20
|
+
)
|
|
24
21
|
}
|
|
25
22
|
|
|
26
23
|
type CommandDialogPropsExternalApi = React.ComponentProps<typeof Dialog> & {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
24
|
+
title?: string
|
|
25
|
+
description?: string
|
|
26
|
+
className?: string
|
|
27
|
+
showCloseButton?: boolean
|
|
28
|
+
}
|
|
32
29
|
|
|
33
30
|
function CommandDialog({
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
31
|
+
title = 'Command Palette',
|
|
32
|
+
description = 'Search for a command to run...',
|
|
33
|
+
children,
|
|
34
|
+
className,
|
|
35
|
+
showCloseButton = true,
|
|
36
|
+
...props
|
|
40
37
|
}: CommandDialogPropsExternalApi): React.JSX.Element {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
38
|
+
return (
|
|
39
|
+
<Dialog {...props}>
|
|
40
|
+
<DialogContent
|
|
41
|
+
className={cn('overflow-hidden p-0', className)}
|
|
42
|
+
showCloseButton={showCloseButton}
|
|
43
|
+
>
|
|
44
|
+
<DialogHeader className="sr-only">
|
|
45
|
+
<DialogTitle>{title}</DialogTitle>
|
|
46
|
+
<DialogDescription>{description}</DialogDescription>
|
|
47
|
+
</DialogHeader>
|
|
48
|
+
<Command className="[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
|
|
49
|
+
{children}
|
|
50
|
+
</Command>
|
|
51
|
+
</DialogContent>
|
|
52
|
+
</Dialog>
|
|
53
|
+
)
|
|
57
54
|
}
|
|
58
55
|
|
|
59
56
|
function CommandInput({
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
className,
|
|
58
|
+
...props
|
|
62
59
|
}: React.ComponentProps<typeof CommandPrimitive.Input>): React.JSX.Element {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
/>
|
|
77
|
-
</div>
|
|
78
|
-
);
|
|
60
|
+
return (
|
|
61
|
+
<div data-slot="command-input-wrapper" className="flex h-9 items-center gap-2 border-b px-3">
|
|
62
|
+
<SearchIcon className="size-4 shrink-0 opacity-50" />
|
|
63
|
+
<CommandPrimitive.Input
|
|
64
|
+
data-slot="command-input"
|
|
65
|
+
className={cn(
|
|
66
|
+
'placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50',
|
|
67
|
+
className,
|
|
68
|
+
)}
|
|
69
|
+
{...props}
|
|
70
|
+
/>
|
|
71
|
+
</div>
|
|
72
|
+
)
|
|
79
73
|
}
|
|
80
74
|
|
|
81
|
-
function CommandList({
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
75
|
+
function CommandList({
|
|
76
|
+
className,
|
|
77
|
+
...props
|
|
78
|
+
}: React.ComponentProps<typeof CommandPrimitive.List>): React.JSX.Element {
|
|
79
|
+
return (
|
|
80
|
+
<CommandPrimitive.List
|
|
81
|
+
data-slot="command-list"
|
|
82
|
+
className={cn('max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto', className)}
|
|
83
|
+
{...props}
|
|
84
|
+
/>
|
|
85
|
+
)
|
|
92
86
|
}
|
|
93
87
|
|
|
94
|
-
function CommandEmpty({
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
88
|
+
function CommandEmpty({
|
|
89
|
+
...props
|
|
90
|
+
}: React.ComponentProps<typeof CommandPrimitive.Empty>): React.JSX.Element {
|
|
91
|
+
return (
|
|
92
|
+
<CommandPrimitive.Empty
|
|
93
|
+
data-slot="command-empty"
|
|
94
|
+
className="py-6 text-center text-sm"
|
|
95
|
+
{...props}
|
|
96
|
+
/>
|
|
97
|
+
)
|
|
102
98
|
}
|
|
103
99
|
|
|
104
100
|
function CommandGroup({
|
|
105
|
-
|
|
106
|
-
|
|
101
|
+
className,
|
|
102
|
+
...props
|
|
107
103
|
}: React.ComponentProps<typeof CommandPrimitive.Group>): React.JSX.Element {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
104
|
+
return (
|
|
105
|
+
<CommandPrimitive.Group
|
|
106
|
+
data-slot="command-group"
|
|
107
|
+
className={cn(
|
|
108
|
+
'text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium',
|
|
109
|
+
className,
|
|
110
|
+
)}
|
|
111
|
+
{...props}
|
|
112
|
+
/>
|
|
113
|
+
)
|
|
118
114
|
}
|
|
119
115
|
|
|
120
116
|
function CommandSeparator({
|
|
121
|
-
|
|
122
|
-
|
|
117
|
+
className,
|
|
118
|
+
...props
|
|
123
119
|
}: React.ComponentProps<typeof CommandPrimitive.Separator>): React.JSX.Element {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
120
|
+
return (
|
|
121
|
+
<CommandPrimitive.Separator
|
|
122
|
+
data-slot="command-separator"
|
|
123
|
+
className={cn('bg-border -mx-1 h-px', className)}
|
|
124
|
+
{...props}
|
|
125
|
+
/>
|
|
126
|
+
)
|
|
131
127
|
}
|
|
132
128
|
|
|
133
|
-
function CommandItem({
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
129
|
+
function CommandItem({
|
|
130
|
+
className,
|
|
131
|
+
...props
|
|
132
|
+
}: React.ComponentProps<typeof CommandPrimitive.Item>): React.JSX.Element {
|
|
133
|
+
return (
|
|
134
|
+
<CommandPrimitive.Item
|
|
135
|
+
data-slot="command-item"
|
|
136
|
+
className={cn(
|
|
137
|
+
"data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
138
|
+
className,
|
|
139
|
+
)}
|
|
140
|
+
{...props}
|
|
141
|
+
/>
|
|
142
|
+
)
|
|
144
143
|
}
|
|
145
144
|
|
|
146
|
-
function CommandShortcut({ className, ...props }: React.ComponentProps<
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
{...props}
|
|
155
|
-
/>
|
|
156
|
-
);
|
|
145
|
+
function CommandShortcut({ className, ...props }: React.ComponentProps<'span'>): React.JSX.Element {
|
|
146
|
+
return (
|
|
147
|
+
<span
|
|
148
|
+
data-slot="command-shortcut"
|
|
149
|
+
className={cn('text-muted-foreground ml-auto text-xs tracking-widest', className)}
|
|
150
|
+
{...props}
|
|
151
|
+
/>
|
|
152
|
+
)
|
|
157
153
|
}
|
|
158
154
|
|
|
159
155
|
export {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
}
|
|
156
|
+
Command,
|
|
157
|
+
CommandDialog,
|
|
158
|
+
CommandInput,
|
|
159
|
+
CommandList,
|
|
160
|
+
CommandEmpty,
|
|
161
|
+
CommandGroup,
|
|
162
|
+
CommandItem,
|
|
163
|
+
CommandShortcut,
|
|
164
|
+
CommandSeparator,
|
|
165
|
+
}
|
|
@@ -1,128 +1,136 @@
|
|
|
1
|
-
import * as DialogPrimitive from
|
|
2
|
-
import { XIcon } from
|
|
3
|
-
import type * as React from
|
|
4
|
-
import { cn } from
|
|
1
|
+
import * as DialogPrimitive from '@radix-ui/react-dialog'
|
|
2
|
+
import { XIcon } from 'lucide-react'
|
|
3
|
+
import type * as React from 'react'
|
|
4
|
+
import { cn } from '../foundation/cn'
|
|
5
5
|
|
|
6
|
-
function Dialog({
|
|
7
|
-
|
|
6
|
+
function Dialog({
|
|
7
|
+
...props
|
|
8
|
+
}: React.ComponentProps<typeof DialogPrimitive.Root>): React.JSX.Element {
|
|
9
|
+
return <DialogPrimitive.Root data-slot="dialog" {...props} />
|
|
8
10
|
}
|
|
9
11
|
|
|
10
|
-
function DialogTrigger({
|
|
11
|
-
|
|
12
|
+
function DialogTrigger({
|
|
13
|
+
...props
|
|
14
|
+
}: React.ComponentProps<typeof DialogPrimitive.Trigger>): React.JSX.Element {
|
|
15
|
+
return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />
|
|
12
16
|
}
|
|
13
17
|
|
|
14
|
-
function DialogPortal({
|
|
15
|
-
|
|
18
|
+
function DialogPortal({
|
|
19
|
+
...props
|
|
20
|
+
}: React.ComponentProps<typeof DialogPrimitive.Portal>): React.JSX.Element {
|
|
21
|
+
return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />
|
|
16
22
|
}
|
|
17
23
|
|
|
18
|
-
function DialogClose({
|
|
19
|
-
|
|
24
|
+
function DialogClose({
|
|
25
|
+
...props
|
|
26
|
+
}: React.ComponentProps<typeof DialogPrimitive.Close>): React.JSX.Element {
|
|
27
|
+
return <DialogPrimitive.Close data-slot="dialog-close" {...props} />
|
|
20
28
|
}
|
|
21
29
|
|
|
22
30
|
function DialogOverlay({
|
|
23
|
-
|
|
24
|
-
|
|
31
|
+
className,
|
|
32
|
+
...props
|
|
25
33
|
}: React.ComponentProps<typeof DialogPrimitive.Overlay>): React.JSX.Element {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
return (
|
|
35
|
+
<DialogPrimitive.Overlay
|
|
36
|
+
data-slot="dialog-overlay"
|
|
37
|
+
className={cn(
|
|
38
|
+
'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/25 dark:bg-black/70 backdrop-blur-[2px]',
|
|
39
|
+
className,
|
|
40
|
+
)}
|
|
41
|
+
{...props}
|
|
42
|
+
/>
|
|
43
|
+
)
|
|
36
44
|
}
|
|
37
45
|
|
|
38
46
|
type DialogContentPropsExternalApi = React.ComponentProps<typeof DialogPrimitive.Content> & {
|
|
39
|
-
|
|
40
|
-
}
|
|
47
|
+
showCloseButton?: boolean
|
|
48
|
+
}
|
|
41
49
|
|
|
42
50
|
function DialogContent({
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
51
|
+
className,
|
|
52
|
+
children,
|
|
53
|
+
showCloseButton = true,
|
|
54
|
+
...props
|
|
47
55
|
}: DialogContentPropsExternalApi): React.JSX.Element {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
56
|
+
return (
|
|
57
|
+
<DialogPortal>
|
|
58
|
+
<DialogOverlay />
|
|
59
|
+
<DialogPrimitive.Content
|
|
60
|
+
data-slot="dialog-content"
|
|
61
|
+
className={cn(
|
|
62
|
+
'overflow-y-auto bg-background 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 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] max-h-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg',
|
|
63
|
+
className,
|
|
64
|
+
)}
|
|
65
|
+
{...props}
|
|
66
|
+
>
|
|
67
|
+
{children}
|
|
68
|
+
{showCloseButton && (
|
|
69
|
+
<DialogPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground 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 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4">
|
|
70
|
+
<XIcon />
|
|
71
|
+
<span className="sr-only">Close</span>
|
|
72
|
+
</DialogPrimitive.Close>
|
|
73
|
+
)}
|
|
74
|
+
</DialogPrimitive.Content>
|
|
75
|
+
</DialogPortal>
|
|
76
|
+
)
|
|
69
77
|
}
|
|
70
78
|
|
|
71
|
-
function DialogHeader({ className, ...props }: React.ComponentProps<
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
+
function DialogHeader({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element {
|
|
80
|
+
return (
|
|
81
|
+
<div
|
|
82
|
+
data-slot="dialog-header"
|
|
83
|
+
className={cn('flex flex-col gap-2 text-center sm:text-left', className)}
|
|
84
|
+
{...props}
|
|
85
|
+
/>
|
|
86
|
+
)
|
|
79
87
|
}
|
|
80
88
|
|
|
81
|
-
function DialogFooter({ className, ...props }: React.ComponentProps<
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
{...props}
|
|
90
|
-
/>
|
|
91
|
-
);
|
|
89
|
+
function DialogFooter({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element {
|
|
90
|
+
return (
|
|
91
|
+
<div
|
|
92
|
+
data-slot="dialog-footer"
|
|
93
|
+
className={cn('flex flex-col-reverse gap-2 sm:flex-row sm:justify-end', className)}
|
|
94
|
+
{...props}
|
|
95
|
+
/>
|
|
96
|
+
)
|
|
92
97
|
}
|
|
93
98
|
|
|
94
|
-
function DialogTitle({
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
function DialogTitle({
|
|
100
|
+
className,
|
|
101
|
+
...props
|
|
102
|
+
}: React.ComponentProps<typeof DialogPrimitive.Title>): React.JSX.Element {
|
|
103
|
+
return (
|
|
104
|
+
<DialogPrimitive.Title
|
|
105
|
+
data-slot="dialog-title"
|
|
106
|
+
className={cn('text-lg leading-none font-semibold', className)}
|
|
107
|
+
{...props}
|
|
108
|
+
/>
|
|
109
|
+
)
|
|
102
110
|
}
|
|
103
111
|
|
|
104
112
|
function DialogDescription({
|
|
105
|
-
|
|
106
|
-
|
|
113
|
+
className,
|
|
114
|
+
...props
|
|
107
115
|
}: React.ComponentProps<typeof DialogPrimitive.Description>): React.JSX.Element {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
116
|
+
return (
|
|
117
|
+
<DialogPrimitive.Description
|
|
118
|
+
data-slot="dialog-description"
|
|
119
|
+
className={cn('text-muted-foreground text-sm', className)}
|
|
120
|
+
{...props}
|
|
121
|
+
/>
|
|
122
|
+
)
|
|
115
123
|
}
|
|
116
124
|
|
|
117
125
|
export {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
126
|
+
Dialog,
|
|
127
|
+
DialogClose,
|
|
128
|
+
DialogContent,
|
|
129
|
+
DialogDescription,
|
|
130
|
+
DialogFooter,
|
|
131
|
+
DialogHeader,
|
|
132
|
+
DialogOverlay,
|
|
133
|
+
DialogPortal,
|
|
134
|
+
DialogTitle,
|
|
135
|
+
DialogTrigger,
|
|
136
|
+
}
|