@blips/ui 0.0.1 → 2.0.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/dist/index.cjs +4308 -2010
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +435 -411
- package/dist/index.d.ts +435 -411
- package/dist/index.js +4244 -2008
- package/dist/index.js.map +1 -1
- package/package.json +18 -4
- package/src/components/accordion.tsx +58 -48
- package/src/components/alert-dialog.tsx +170 -112
- package/src/components/alert.tsx +49 -42
- package/src/components/aspect-ratio.tsx +9 -3
- package/src/components/avatar.tsx +109 -50
- package/src/components/badge.tsx +29 -17
- package/src/components/breadcrumb.tsx +81 -87
- package/src/components/button-group.tsx +83 -0
- package/src/components/button.tsx +40 -32
- package/src/components/calendar.tsx +49 -45
- package/src/components/card.tsx +77 -71
- package/src/components/carousel.tsx +150 -168
- package/src/components/chart.tsx +357 -0
- package/src/components/checkbox.tsx +28 -24
- package/src/components/collapsible.tsx +28 -6
- package/src/components/command.tsx +144 -110
- package/src/components/context-menu.tsx +220 -166
- package/src/components/dialog.tsx +131 -95
- package/src/components/drawer.tsx +105 -86
- package/src/components/dropdown-menu.tsx +234 -177
- package/src/components/form.tsx +167 -0
- package/src/components/hover-card.tsx +39 -22
- package/src/components/input-group.tsx +175 -0
- package/src/components/input-otp.tsx +56 -48
- package/src/components/input.tsx +18 -19
- package/src/components/kbd.tsx +28 -0
- package/src/components/label.tsx +20 -22
- package/src/components/menubar.tsx +221 -199
- package/src/components/navigation-menu.tsx +144 -102
- package/src/components/pagination.tsx +102 -91
- package/src/components/popover.tsx +86 -26
- package/src/components/progress.tsx +27 -24
- package/src/components/radio-group.tsx +28 -25
- package/src/components/resizable.tsx +42 -34
- package/src/components/scroll-area.tsx +54 -42
- package/src/components/select.tsx +165 -135
- package/src/components/separator.tsx +16 -17
- package/src/components/sheet.tsx +116 -113
- package/src/components/sidebar.tsx +726 -0
- package/src/components/skeleton.tsx +6 -8
- package/src/components/slider.tsx +60 -23
- package/src/components/sonner.tsx +25 -30
- package/src/components/spinner.tsx +16 -0
- package/src/components/switch.tsx +30 -22
- package/src/components/table.tsx +96 -97
- package/src/components/tabs.tsx +91 -53
- package/src/components/textarea.tsx +8 -12
- package/src/components/toggle-group.tsx +60 -37
- package/src/components/toggle.tsx +28 -24
- package/src/components/tooltip.tsx +50 -23
- package/src/globals.css +230 -68
- package/src/hooks/use-mobile.tsx +19 -0
- package/src/index.ts +105 -6
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import type * as React from "react"
|
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
3
|
+
|
|
4
|
+
import { cn } from "../lib/utils"
|
|
5
|
+
import { Button } from "./button"
|
|
6
|
+
import { Input } from "./input"
|
|
7
|
+
import { Textarea } from "./textarea"
|
|
8
|
+
|
|
9
|
+
function InputGroup({ className, ...props }: React.ComponentProps<"div">) {
|
|
10
|
+
return (
|
|
11
|
+
<div
|
|
12
|
+
data-slot="input-group"
|
|
13
|
+
role="group"
|
|
14
|
+
className={cn(
|
|
15
|
+
"group/input-group border-input dark:bg-input/30 shadow-xs relative flex w-full items-center rounded-md border outline-none transition-[color,box-shadow]",
|
|
16
|
+
"h-9 has-[>textarea]:h-auto",
|
|
17
|
+
|
|
18
|
+
// Variants based on alignment.
|
|
19
|
+
"has-[>[data-align=inline-start]]:[&>input]:pl-2",
|
|
20
|
+
"has-[>[data-align=inline-end]]:[&>input]:pr-2",
|
|
21
|
+
"has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3",
|
|
22
|
+
"has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3",
|
|
23
|
+
|
|
24
|
+
// Focus state.
|
|
25
|
+
"has-[[data-slot=input-group-control]:focus-visible]:ring-ring has-[[data-slot=input-group-control]:focus-visible]:ring-1",
|
|
26
|
+
|
|
27
|
+
// Error state.
|
|
28
|
+
"has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",
|
|
29
|
+
|
|
30
|
+
className
|
|
31
|
+
)}
|
|
32
|
+
{...props}
|
|
33
|
+
/>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const inputGroupAddonVariants = cva(
|
|
38
|
+
"text-muted-foreground flex h-auto cursor-text select-none items-center justify-center gap-2 py-1.5 text-sm font-medium group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",
|
|
39
|
+
{
|
|
40
|
+
variants: {
|
|
41
|
+
align: {
|
|
42
|
+
"inline-start":
|
|
43
|
+
"order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]",
|
|
44
|
+
"inline-end":
|
|
45
|
+
"order-last pr-3 has-[>button]:mr-[-0.4rem] has-[>kbd]:mr-[-0.35rem]",
|
|
46
|
+
"block-start":
|
|
47
|
+
"[.border-b]:pb-3 order-first w-full justify-start px-3 pt-3 group-has-[>input]/input-group:pt-2.5",
|
|
48
|
+
"block-end":
|
|
49
|
+
"[.border-t]:pt-3 order-last w-full justify-start px-3 pb-3 group-has-[>input]/input-group:pb-2.5",
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
defaultVariants: {
|
|
53
|
+
align: "inline-start",
|
|
54
|
+
},
|
|
55
|
+
}
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
function InputGroupAddon({
|
|
59
|
+
className,
|
|
60
|
+
align = "inline-start",
|
|
61
|
+
...props
|
|
62
|
+
}: React.ComponentProps<"div"> & VariantProps<typeof inputGroupAddonVariants>) {
|
|
63
|
+
const focusInput = (e: React.SyntheticEvent<HTMLDivElement>) => {
|
|
64
|
+
if ((e.target as HTMLElement).closest("button")) {
|
|
65
|
+
return
|
|
66
|
+
}
|
|
67
|
+
e.currentTarget.parentElement?.querySelector("input")?.focus()
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<div
|
|
72
|
+
role="group"
|
|
73
|
+
data-slot="input-group-addon"
|
|
74
|
+
data-align={align}
|
|
75
|
+
className={cn(inputGroupAddonVariants({ align }), className)}
|
|
76
|
+
onClick={focusInput}
|
|
77
|
+
onKeyDown={(e) => {
|
|
78
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
79
|
+
focusInput(e)
|
|
80
|
+
}
|
|
81
|
+
}}
|
|
82
|
+
{...props}
|
|
83
|
+
/>
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const inputGroupButtonVariants = cva(
|
|
88
|
+
"flex items-center gap-2 text-sm shadow-none",
|
|
89
|
+
{
|
|
90
|
+
variants: {
|
|
91
|
+
size: {
|
|
92
|
+
xs: "h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-2 has-[>svg]:px-2 [&>svg:not([class*='size-'])]:size-3.5",
|
|
93
|
+
sm: "h-8 gap-1.5 rounded-md px-2.5 has-[>svg]:px-2.5",
|
|
94
|
+
"icon-xs":
|
|
95
|
+
"size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0",
|
|
96
|
+
"icon-sm": "size-8 p-0 has-[>svg]:p-0",
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
defaultVariants: {
|
|
100
|
+
size: "xs",
|
|
101
|
+
},
|
|
102
|
+
}
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
function InputGroupButton({
|
|
106
|
+
className,
|
|
107
|
+
type = "button",
|
|
108
|
+
variant = "ghost",
|
|
109
|
+
size = "xs",
|
|
110
|
+
...props
|
|
111
|
+
}: Omit<React.ComponentProps<typeof Button>, "size"> &
|
|
112
|
+
VariantProps<typeof inputGroupButtonVariants>) {
|
|
113
|
+
return (
|
|
114
|
+
<Button
|
|
115
|
+
type={type}
|
|
116
|
+
data-size={size}
|
|
117
|
+
variant={variant}
|
|
118
|
+
className={cn(inputGroupButtonVariants({ size }), className)}
|
|
119
|
+
{...props}
|
|
120
|
+
/>
|
|
121
|
+
)
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function InputGroupText({ className, ...props }: React.ComponentProps<"span">) {
|
|
125
|
+
return (
|
|
126
|
+
<span
|
|
127
|
+
className={cn(
|
|
128
|
+
"text-muted-foreground flex items-center gap-2 text-sm [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none",
|
|
129
|
+
className
|
|
130
|
+
)}
|
|
131
|
+
{...props}
|
|
132
|
+
/>
|
|
133
|
+
)
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function InputGroupInput({
|
|
137
|
+
className,
|
|
138
|
+
...props
|
|
139
|
+
}: React.ComponentProps<"input">) {
|
|
140
|
+
return (
|
|
141
|
+
<Input
|
|
142
|
+
data-slot="input-group-control"
|
|
143
|
+
className={cn(
|
|
144
|
+
"flex-1 rounded-none border-0 bg-transparent shadow-none focus-visible:ring-0 dark:bg-transparent",
|
|
145
|
+
className
|
|
146
|
+
)}
|
|
147
|
+
{...props}
|
|
148
|
+
/>
|
|
149
|
+
)
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function InputGroupTextarea({
|
|
153
|
+
className,
|
|
154
|
+
...props
|
|
155
|
+
}: React.ComponentProps<"textarea">) {
|
|
156
|
+
return (
|
|
157
|
+
<Textarea
|
|
158
|
+
data-slot="input-group-control"
|
|
159
|
+
className={cn(
|
|
160
|
+
"flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 dark:bg-transparent",
|
|
161
|
+
className
|
|
162
|
+
)}
|
|
163
|
+
{...props}
|
|
164
|
+
/>
|
|
165
|
+
)
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export {
|
|
169
|
+
InputGroup,
|
|
170
|
+
InputGroupAddon,
|
|
171
|
+
InputGroupButton,
|
|
172
|
+
InputGroupText,
|
|
173
|
+
InputGroupInput,
|
|
174
|
+
InputGroupTextarea,
|
|
175
|
+
}
|
|
@@ -1,46 +1,57 @@
|
|
|
1
|
-
|
|
2
|
-
import { Dot } from "lucide-react";
|
|
3
|
-
import * as React from "react";
|
|
1
|
+
"use client"
|
|
4
2
|
|
|
5
|
-
import
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { OTPInput, OTPInputContext } from "input-otp"
|
|
5
|
+
import { Minus } from "@phosphor-icons/react"
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
React.ElementRef<typeof OTPInput>,
|
|
9
|
-
React.ComponentPropsWithoutRef<typeof OTPInput>
|
|
10
|
-
>(({ className, containerClassName, ...props }, ref) => (
|
|
11
|
-
<OTPInput
|
|
12
|
-
ref={ref}
|
|
13
|
-
containerClassName={cn(
|
|
14
|
-
"flex items-center gap-2 has-[:disabled]:opacity-50",
|
|
15
|
-
containerClassName
|
|
16
|
-
)}
|
|
17
|
-
className={cn("disabled:cursor-not-allowed", className)}
|
|
18
|
-
{...props}
|
|
19
|
-
/>
|
|
20
|
-
));
|
|
21
|
-
InputOTP.displayName = "InputOTP";
|
|
7
|
+
import { cn } from "../lib/utils"
|
|
22
8
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
9
|
+
function InputOTP({
|
|
10
|
+
className,
|
|
11
|
+
containerClassName,
|
|
12
|
+
...props
|
|
13
|
+
}: React.ComponentProps<typeof OTPInput> & {
|
|
14
|
+
containerClassName?: string
|
|
15
|
+
}) {
|
|
16
|
+
return (
|
|
17
|
+
<OTPInput
|
|
18
|
+
data-slot="input-otp"
|
|
19
|
+
containerClassName={cn(
|
|
20
|
+
"flex items-center gap-2 has-disabled:opacity-50",
|
|
21
|
+
containerClassName
|
|
22
|
+
)}
|
|
23
|
+
className={cn("disabled:cursor-not-allowed", className)}
|
|
24
|
+
{...props}
|
|
25
|
+
/>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
30
28
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
function InputOTPGroup({ className, ...props }: React.ComponentProps<"div">) {
|
|
30
|
+
return (
|
|
31
|
+
<div
|
|
32
|
+
data-slot="input-otp-group"
|
|
33
|
+
className={cn("flex items-center", className)}
|
|
34
|
+
{...props}
|
|
35
|
+
/>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function InputOTPSlot({
|
|
40
|
+
index,
|
|
41
|
+
className,
|
|
42
|
+
...props
|
|
43
|
+
}: React.ComponentProps<"div"> & {
|
|
44
|
+
index: number
|
|
45
|
+
}) {
|
|
46
|
+
const inputOTPContext = React.useContext(OTPInputContext)
|
|
47
|
+
const { char, hasFakeCaret, isActive } = inputOTPContext?.slots[index] ?? {}
|
|
37
48
|
|
|
38
49
|
return (
|
|
39
50
|
<div
|
|
40
|
-
|
|
51
|
+
data-slot="input-otp-slot"
|
|
52
|
+
data-active={isActive}
|
|
41
53
|
className={cn(
|
|
42
|
-
"relative flex h-
|
|
43
|
-
isActive && "z-10 ring-2 ring-ring ring-offset-background",
|
|
54
|
+
"relative flex h-9 w-9 items-center justify-center border-y border-r border-input text-sm shadow-xs transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md aria-invalid:border-destructive data-[active=true]:z-10 data-[active=true]:border-ring data-[active=true]:ring-[3px] data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:border-destructive data-[active=true]:aria-invalid:ring-destructive/20 dark:bg-input/30 dark:data-[active=true]:aria-invalid:ring-destructive/40",
|
|
44
55
|
className
|
|
45
56
|
)}
|
|
46
57
|
{...props}
|
|
@@ -52,18 +63,15 @@ const InputOTPSlot = React.forwardRef<
|
|
|
52
63
|
</div>
|
|
53
64
|
)}
|
|
54
65
|
</div>
|
|
55
|
-
)
|
|
56
|
-
}
|
|
57
|
-
InputOTPSlot.displayName = "InputOTPSlot";
|
|
66
|
+
)
|
|
67
|
+
}
|
|
58
68
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
));
|
|
67
|
-
InputOTPSeparator.displayName = "InputOTPSeparator";
|
|
69
|
+
function InputOTPSeparator({ ...props }: React.ComponentProps<"div">) {
|
|
70
|
+
return (
|
|
71
|
+
<div data-slot="input-otp-separator" role="separator" {...props}>
|
|
72
|
+
<Minus />
|
|
73
|
+
</div>
|
|
74
|
+
)
|
|
75
|
+
}
|
|
68
76
|
|
|
69
|
-
export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator }
|
|
77
|
+
export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator }
|
package/src/components/input.tsx
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
import * as React from "react"
|
|
1
|
+
import * as React from "react"
|
|
2
2
|
|
|
3
|
-
import { cn } from "../lib/utils"
|
|
3
|
+
import { cn } from "../lib/utils"
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
Input.displayName = "Input";
|
|
5
|
+
function Input({ className, type, ...props }: React.ComponentProps<"input">) {
|
|
6
|
+
return (
|
|
7
|
+
<input
|
|
8
|
+
type={type}
|
|
9
|
+
data-slot="input"
|
|
10
|
+
className={cn(
|
|
11
|
+
"h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30",
|
|
12
|
+
"focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50",
|
|
13
|
+
"aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",
|
|
14
|
+
className
|
|
15
|
+
)}
|
|
16
|
+
{...props}
|
|
17
|
+
/>
|
|
18
|
+
)
|
|
19
|
+
}
|
|
21
20
|
|
|
22
|
-
export { Input }
|
|
21
|
+
export { Input }
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { cn } from "../lib/utils"
|
|
2
|
+
|
|
3
|
+
function Kbd({ className, ...props }: React.ComponentProps<"kbd">) {
|
|
4
|
+
return (
|
|
5
|
+
<kbd
|
|
6
|
+
data-slot="kbd"
|
|
7
|
+
className={cn(
|
|
8
|
+
"bg-muted text-muted-foreground pointer-events-none inline-flex h-5 w-fit min-w-5 select-none items-center justify-center gap-1 rounded-sm px-1 font-sans text-xs font-medium",
|
|
9
|
+
"[&_svg:not([class*='size-'])]:size-3",
|
|
10
|
+
"[[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background dark:[[data-slot=tooltip-content]_&]:bg-background/10",
|
|
11
|
+
className
|
|
12
|
+
)}
|
|
13
|
+
{...props}
|
|
14
|
+
/>
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function KbdGroup({ className, ...props }: React.ComponentProps<"div">) {
|
|
19
|
+
return (
|
|
20
|
+
<kbd
|
|
21
|
+
data-slot="kbd-group"
|
|
22
|
+
className={cn("inline-flex items-center gap-1", className)}
|
|
23
|
+
{...props}
|
|
24
|
+
/>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { Kbd, KbdGroup }
|
package/src/components/label.tsx
CHANGED
|
@@ -1,26 +1,24 @@
|
|
|
1
|
-
"use client"
|
|
1
|
+
"use client"
|
|
2
2
|
|
|
3
|
-
import * as
|
|
4
|
-
import
|
|
5
|
-
import * as React from "react";
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import * as LabelPrimitive from "@radix-ui/react-label"
|
|
6
5
|
|
|
7
|
-
import { cn } from "../lib/utils"
|
|
6
|
+
import { cn } from "../lib/utils"
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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 items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
|
|
17
|
+
className
|
|
18
|
+
)}
|
|
19
|
+
{...props}
|
|
20
|
+
/>
|
|
21
|
+
)
|
|
22
|
+
}
|
|
12
23
|
|
|
13
|
-
|
|
14
|
-
React.ElementRef<typeof LabelPrimitive.Root>,
|
|
15
|
-
React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> &
|
|
16
|
-
VariantProps<typeof labelVariants>
|
|
17
|
-
>(({ className, ...props }, ref) => (
|
|
18
|
-
<LabelPrimitive.Root
|
|
19
|
-
ref={ref}
|
|
20
|
-
className={cn(labelVariants(), className)}
|
|
21
|
-
{...props}
|
|
22
|
-
/>
|
|
23
|
-
));
|
|
24
|
-
Label.displayName = LabelPrimitive.Root.displayName;
|
|
25
|
-
|
|
26
|
-
export { Label };
|
|
24
|
+
export { Label }
|