@pactor-app/ui 1.1.0 → 1.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.
@@ -0,0 +1,78 @@
1
+ // src/ui/button.tsx
2
+ import { Button as ButtonPrimitive } from "@base-ui/react/button";
3
+ import { cva } from "class-variance-authority";
4
+ import * as React from "react";
5
+
6
+ // src/lib/utils.ts
7
+ import { clsx } from "clsx";
8
+ import { twMerge } from "tailwind-merge";
9
+ function cn(...inputs) {
10
+ return twMerge(clsx(inputs));
11
+ }
12
+
13
+ // src/ui/button.tsx
14
+ import { jsx } from "react/jsx-runtime";
15
+ var buttonVariants = cva(
16
+ "inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium outline-none transition-colors focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
17
+ {
18
+ variants: {
19
+ variant: {
20
+ default: "bg-primary text-primary-foreground hover:bg-primary/90",
21
+ destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90 focus-visible:ring-destructive/20",
22
+ outline: "border border-border bg-card hover:bg-accent hover:text-accent-foreground",
23
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
24
+ ghost: "hover:bg-accent hover:text-accent-foreground",
25
+ link: "text-primary underline-offset-4 hover:underline"
26
+ },
27
+ size: {
28
+ default: "h-9 px-4 py-2",
29
+ xs: "h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",
30
+ sm: "h-8 gap-1.5 rounded-md px-3 text-xs",
31
+ lg: "h-10 rounded-md px-6",
32
+ icon: "size-9",
33
+ "icon-xs": "size-6 rounded-md [&_svg:not([class*='size-'])]:size-3",
34
+ "icon-sm": "size-8",
35
+ "icon-lg": "size-10"
36
+ }
37
+ },
38
+ defaultVariants: {
39
+ variant: "default",
40
+ size: "default"
41
+ }
42
+ }
43
+ );
44
+ function Button({
45
+ className,
46
+ variant,
47
+ size,
48
+ asChild = false,
49
+ children,
50
+ ...props
51
+ }) {
52
+ if (asChild && React.isValidElement(children)) {
53
+ return /* @__PURE__ */ jsx(
54
+ ButtonPrimitive,
55
+ {
56
+ "data-slot": "button",
57
+ className: cn(buttonVariants({ variant, size, className })),
58
+ render: children,
59
+ ...props
60
+ }
61
+ );
62
+ }
63
+ return /* @__PURE__ */ jsx(
64
+ ButtonPrimitive,
65
+ {
66
+ "data-slot": "button",
67
+ className: cn(buttonVariants({ variant, size, className })),
68
+ ...props,
69
+ children
70
+ }
71
+ );
72
+ }
73
+
74
+ export {
75
+ cn,
76
+ buttonVariants,
77
+ Button
78
+ };