@tangle-network/ui 11.9.0 → 11.11.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.
Files changed (155) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +14 -0
  3. package/dist/active-sessions-store-Gt1R0rFG.js +262 -0
  4. package/dist/{active-sessions-store-CeOmXgv5.d.ts → active-sessions-store-nl70ZnMC.d.ts} +40 -41
  5. package/dist/artifact-pane-BL_DFWNl.d.ts +32 -0
  6. package/dist/artifact-pane-DMXT9a8U.js +70 -0
  7. package/dist/auth-DixfCMCk.js +154 -0
  8. package/dist/auth.d.ts +2 -74
  9. package/dist/auth.js +2 -15
  10. package/dist/branding-26d5ARIr.d.ts +14 -0
  11. package/dist/button-uhNnwdsD.js +78 -0
  12. package/dist/button-yoIv77e2.d.ts +16 -0
  13. package/dist/chat-CPLL0Fd9.js +667 -0
  14. package/dist/chat.d.ts +2 -201
  15. package/dist/chat.js +2 -30
  16. package/dist/code-block-B9miUPht.d.ts +23 -0
  17. package/dist/code-block-CngSn37j.js +165 -0
  18. package/dist/diff-preview-cySuqowW.js +533 -0
  19. package/dist/document-editor-pane-BcoABlhn.d.ts +131 -0
  20. package/dist/document-editor-pane-Cz6oEF1o.js +1287 -0
  21. package/dist/dropdown-menu-BpcLa5vF.js +101 -0
  22. package/dist/editor.d.ts +76 -78
  23. package/dist/editor.js +2 -33
  24. package/dist/file-format-BgXbr-Ib.js +160 -0
  25. package/dist/files-CYlOo0mE.js +743 -0
  26. package/dist/files.d.ts +2 -243
  27. package/dist/files.js +3 -40
  28. package/dist/focus-Cw02pNSr.js +56 -0
  29. package/dist/format-DfcLWqMa.js +54 -0
  30. package/dist/hooks.d.ts +30 -37
  31. package/dist/hooks.js +111 -45
  32. package/dist/index-2UntyjBb.d.ts +52 -0
  33. package/dist/index-COgqsFAQ.d.ts +42 -0
  34. package/dist/index-CPDET_s1.d.ts +549 -0
  35. package/dist/index-CUhfHT_V.d.ts +204 -0
  36. package/dist/index-Cg6gYAqh.d.ts +73 -0
  37. package/dist/index-Cq-EJzqW.d.ts +16 -0
  38. package/dist/index-DhYmSaLF.d.ts +245 -0
  39. package/dist/index-DjKxO357.d.ts +128 -0
  40. package/dist/index-b56ew9aF.d.ts +107 -0
  41. package/dist/index.d.ts +26 -43
  42. package/dist/index.js +35 -460
  43. package/dist/markdown-BprL96Gl.js +45 -0
  44. package/dist/markdown.d.ts +3 -18
  45. package/dist/markdown.js +3 -14
  46. package/dist/message-vhUI0c5G.d.ts +16 -0
  47. package/dist/nav.d.ts +6 -8
  48. package/dist/nav.js +29 -11
  49. package/dist/openui-artifact-renderer-D3E5bIAI.d.ts +114 -0
  50. package/dist/openui-artifact-renderer-DT4xbvWt.js +266 -0
  51. package/dist/openui.d.ts +2 -115
  52. package/dist/openui.js +2 -12
  53. package/dist/parts-5mhy9yJ3.d.ts +37 -0
  54. package/dist/primitives-DE-blUz-.js +1239 -0
  55. package/dist/primitives.d.ts +5 -523
  56. package/dist/primitives.js +9 -211
  57. package/dist/redaction-CGGB2ENG.js +74 -0
  58. package/dist/redaction.d.ts +2 -42
  59. package/dist/redaction.js +2 -7
  60. package/dist/run-OyWmIDqu.d.ts +41 -0
  61. package/dist/run-ZsIKPA6J.js +17 -0
  62. package/dist/run-group-D1InSdQu.js +410 -0
  63. package/dist/run.d.ts +3 -126
  64. package/dist/run.js +5 -39
  65. package/dist/sdk-hooks.d.ts +2 -285
  66. package/dist/sdk-hooks.js +3 -35
  67. package/dist/stores.d.ts +13 -14
  68. package/dist/stores.js +34 -76
  69. package/dist/table-DHyqDPbU.js +146 -0
  70. package/dist/tabs-ujuqAdtb.js +40 -0
  71. package/dist/text-shimmer-BUUo6I-g.js +64 -0
  72. package/dist/tool-call-feed-BeB1_4pX.d.ts +47 -0
  73. package/dist/tool-call-feed-C1W1N54c.js +109 -0
  74. package/dist/tool-call-step-Bi3_YJRV.js +434 -0
  75. package/dist/tool-display-BAuAVa43.js +158 -0
  76. package/dist/{tool-display-z4JcDmMQ.d.ts → tool-display-DgmL5rIU.d.ts} +16 -16
  77. package/dist/tool-previews.d.ts +2 -48
  78. package/dist/tool-previews.js +2 -22
  79. package/dist/types.d.ts +6 -19
  80. package/dist/types.js +0 -1
  81. package/dist/use-auto-scroll-C5Pjeqon.js +153 -0
  82. package/dist/use-sse-stream-BjVBDbxK.js +884 -0
  83. package/dist/use-sse-stream-Dm6R5YWz.d.ts +282 -0
  84. package/dist/utils-Bl_CZ0Qp.js +37 -0
  85. package/dist/{chunk-RQHJBTEU.js → utils-C_uf36nf.js} +4 -6
  86. package/dist/utils.d.ts +2 -51
  87. package/dist/utils.js +6 -32
  88. package/package.json +39 -41
  89. package/src/auth/auth.tsx +5 -1
  90. package/src/chat/agent-timeline.tsx +6 -1
  91. package/src/chat/chat-container.tsx +2 -1
  92. package/src/editor/document-editor-pane.test.tsx +3 -1
  93. package/src/editor/document-editor-pane.tsx +5 -1
  94. package/src/editor/markdown-document-editor.test.tsx +9 -4
  95. package/src/files/file-artifact-pane.tsx +3 -2
  96. package/src/files/file-preview.tsx +3 -1
  97. package/src/files/file-tabs.tsx +9 -2
  98. package/src/lib/focus.ts +63 -0
  99. package/src/markdown/code-block.tsx +5 -1
  100. package/src/primitives/badge.tsx +2 -1
  101. package/src/primitives/button.tsx +2 -1
  102. package/src/primitives/card.tsx +1 -2
  103. package/src/primitives/dialog.tsx +7 -1
  104. package/src/primitives/input.tsx +15 -14
  105. package/src/primitives/segmented-control.tsx +5 -3
  106. package/src/primitives/select.tsx +3 -1
  107. package/src/primitives/switch.tsx +3 -1
  108. package/src/primitives/tabs.tsx +6 -4
  109. package/src/primitives/terminal-display.tsx +6 -8
  110. package/src/primitives/toast.tsx +5 -1
  111. package/src/tool-previews/command-preview.tsx +5 -1
  112. package/src/tool-previews/web-search-preview.tsx +2 -1
  113. package/src/utils/index.ts +7 -0
  114. package/dist/artifact-pane-DpuWcAiF.d.ts +0 -33
  115. package/dist/button-CMQuQEW_.d.ts +0 -17
  116. package/dist/chunk-34A66VBG.js +0 -214
  117. package/dist/chunk-3OI2QKFD.js +0 -0
  118. package/dist/chunk-3TI5DEHV.js +0 -299
  119. package/dist/chunk-4CLN43XT.js +0 -45
  120. package/dist/chunk-565EATZZ.js +0 -156
  121. package/dist/chunk-5Z5ZYMOJ.js +0 -0
  122. package/dist/chunk-6BGQA4BQ.js +0 -0
  123. package/dist/chunk-7YOCS6IF.js +0 -728
  124. package/dist/chunk-EOAX2ENE.js +0 -60
  125. package/dist/chunk-GYPQXTJU.js +0 -230
  126. package/dist/chunk-HFL6R6IF.js +0 -37
  127. package/dist/chunk-HGML45QH.js +0 -104
  128. package/dist/chunk-KNYSKNZX.js +0 -550
  129. package/dist/chunk-L57WRIND.js +0 -59
  130. package/dist/chunk-LDLOJKPC.js +0 -1585
  131. package/dist/chunk-LTEKI7YJ.js +0 -59
  132. package/dist/chunk-MKTSMWVD.js +0 -109
  133. package/dist/chunk-ND3ZFXQK.js +0 -179
  134. package/dist/chunk-NKDZ7GZE.js +0 -192
  135. package/dist/chunk-NWECTSOH.js +0 -589
  136. package/dist/chunk-OEX7NZE3.js +0 -321
  137. package/dist/chunk-Q56BYXQF.js +0 -61
  138. package/dist/chunk-REJESC5U.js +0 -117
  139. package/dist/chunk-RQGKSCEZ.js +0 -0
  140. package/dist/chunk-TN4FUEWY.js +0 -437
  141. package/dist/chunk-VPWY4I5O.js +0 -1048
  142. package/dist/chunk-WUQDUBJG.js +0 -168
  143. package/dist/chunk-XGKULLYE.js +0 -40
  144. package/dist/chunk-XU3HB5QL.js +0 -127
  145. package/dist/chunk-XYAIX4SU.js +0 -133
  146. package/dist/chunk-YJ6RE5WV.js +0 -875
  147. package/dist/chunk-YTO5V6QS.js +0 -19
  148. package/dist/chunk-ZKCEAIIZ.js +0 -1395
  149. package/dist/code-block-0kSpWMnf.d.ts +0 -25
  150. package/dist/document-editor-pane-EX25CEYW.js +0 -12
  151. package/dist/document-editor-pane-IAEQn_Dl.d.ts +0 -128
  152. package/dist/message-BHWbxBtT.d.ts +0 -15
  153. package/dist/parts-dj7AcUg0.d.ts +0 -36
  154. package/dist/run-PfLmDAox.d.ts +0 -41
  155. package/dist/tool-call-feed-D9iofJgW.d.ts +0 -46
@@ -0,0 +1,154 @@
1
+ import { i as focusRing } from "./focus-Cw02pNSr.js";
2
+ import { t as cn } from "./utils-C_uf36nf.js";
3
+ import { t as Button } from "./button-uhNnwdsD.js";
4
+ import { _ as AvatarFallback, a as DropdownMenuItem, g as Avatar, h as DropdownMenuTrigger, o as DropdownMenuLabel, r as DropdownMenuContent, t as DropdownMenu, u as DropdownMenuSeparator, v as AvatarImage } from "./dropdown-menu-BpcLa5vF.js";
5
+ import "react";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ import { Terminal } from "lucide-react";
8
+ //#region src/auth/auth.tsx
9
+ function GitHubIcon({ className }) {
10
+ return /* @__PURE__ */ jsx("svg", {
11
+ className,
12
+ viewBox: "0 0 24 24",
13
+ fill: "currentColor",
14
+ "aria-hidden": "true",
15
+ children: /* @__PURE__ */ jsx("path", {
16
+ fillRule: "evenodd",
17
+ clipRule: "evenodd",
18
+ d: "M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z"
19
+ })
20
+ });
21
+ }
22
+ function GitHubLoginButton({ authUrl = "/auth/github", variant = "default", className, children, ...props }) {
23
+ return /* @__PURE__ */ jsxs(Button, {
24
+ variant,
25
+ className: cn("gap-2", className),
26
+ onClick: () => {
27
+ window.location.href = authUrl;
28
+ },
29
+ ...props,
30
+ children: [/* @__PURE__ */ jsx(GitHubIcon, { className: "h-5 w-5" }), children ?? "Sign in with GitHub"]
31
+ });
32
+ }
33
+ function UserMenu({ user, logoutUrl = "/auth/logout", links = [], variant = "sandbox", onLogout }) {
34
+ const initials = user.name ? user.name.split(" ").map((n) => n[0]).join("").toUpperCase().slice(0, 2) : user.email.slice(0, 2).toUpperCase();
35
+ const avatarGradient = { sandbox: "bg-[image:var(--accent-gradient-strong)]" }[variant];
36
+ const handleLogout = () => {
37
+ if (onLogout) onLogout();
38
+ window.location.href = logoutUrl;
39
+ };
40
+ return /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
41
+ asChild: true,
42
+ children: /* @__PURE__ */ jsxs("button", {
43
+ type: "button",
44
+ className: cn("flex items-center gap-2 rounded-lg p-1.5 transition-colors hover:bg-accent", focusRing),
45
+ children: [/* @__PURE__ */ jsxs(Avatar, {
46
+ className: "h-8 w-8",
47
+ children: [/* @__PURE__ */ jsx(AvatarImage, {
48
+ src: void 0,
49
+ alt: user.name ?? user.email
50
+ }), /* @__PURE__ */ jsx(AvatarFallback, {
51
+ className: cn("text-white text-xs", avatarGradient),
52
+ children: initials
53
+ })]
54
+ }), /* @__PURE__ */ jsxs("div", {
55
+ className: "hidden text-left md:block",
56
+ children: [/* @__PURE__ */ jsx("p", {
57
+ className: "font-medium text-sm",
58
+ children: user.name ?? user.email
59
+ }), user.tier && /* @__PURE__ */ jsxs("p", {
60
+ className: "text-muted-foreground text-xs capitalize",
61
+ children: [user.tier, " Plan"]
62
+ })]
63
+ })]
64
+ })
65
+ }), /* @__PURE__ */ jsxs(DropdownMenuContent, {
66
+ align: "end",
67
+ className: "w-56",
68
+ children: [
69
+ /* @__PURE__ */ jsx(DropdownMenuLabel, {
70
+ className: "font-normal",
71
+ children: /* @__PURE__ */ jsxs("div", {
72
+ className: "flex flex-col space-y-1",
73
+ children: [/* @__PURE__ */ jsx("p", {
74
+ className: "font-medium text-sm",
75
+ children: user.name ?? "Account"
76
+ }), /* @__PURE__ */ jsx("p", {
77
+ className: "text-muted-foreground text-xs",
78
+ children: user.email
79
+ })]
80
+ })
81
+ }),
82
+ /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
83
+ links.map((link) => /* @__PURE__ */ jsx(DropdownMenuItem, {
84
+ asChild: true,
85
+ children: /* @__PURE__ */ jsxs("a", {
86
+ href: link.href,
87
+ className: "flex items-center gap-2",
88
+ children: [link.icon, link.label]
89
+ })
90
+ }, link.href)),
91
+ links.length > 0 && /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
92
+ /* @__PURE__ */ jsx(DropdownMenuItem, {
93
+ onClick: handleLogout,
94
+ className: "text-[var(--surface-danger-text)] focus:text-[var(--surface-danger-text)]",
95
+ children: "Sign out"
96
+ })
97
+ ]
98
+ })] });
99
+ }
100
+ function AuthHeader({ user, loading = false, variant = "sandbox", apiBaseUrl = "", menuLinks, className }) {
101
+ if (loading) return /* @__PURE__ */ jsxs("div", {
102
+ className: cn("flex items-center gap-2", className),
103
+ children: [/* @__PURE__ */ jsx("div", { className: "h-8 w-8 animate-pulse rounded-full bg-muted" }), /* @__PURE__ */ jsx("div", {
104
+ className: "hidden md:block",
105
+ children: /* @__PURE__ */ jsx("div", { className: "h-4 w-20 animate-pulse rounded bg-muted" })
106
+ })]
107
+ });
108
+ if (!user) return /* @__PURE__ */ jsx("div", {
109
+ className: cn("flex items-center gap-2", className),
110
+ children: /* @__PURE__ */ jsx(GitHubLoginButton, {
111
+ authUrl: `${apiBaseUrl}/auth/github`,
112
+ variant,
113
+ size: "sm"
114
+ })
115
+ });
116
+ return /* @__PURE__ */ jsx(UserMenu, {
117
+ user,
118
+ variant,
119
+ logoutUrl: `${apiBaseUrl}/auth/logout`,
120
+ links: menuLinks
121
+ });
122
+ }
123
+ //#endregion
124
+ //#region src/auth/login-layout.tsx
125
+ function LoginLayout({ title = "Welcome Back", subtitle = "Sign in to your workspace.", brandIcon, children, className }) {
126
+ return /* @__PURE__ */ jsx("div", {
127
+ className: cn("relative flex min-h-screen items-center justify-center bg-background overflow-hidden antialiased font-sans flex-col", className),
128
+ children: /* @__PURE__ */ jsxs("div", {
129
+ className: "z-10 w-full max-w-md px-6 animate-in flex flex-col items-center",
130
+ children: [/* @__PURE__ */ jsxs("div", {
131
+ className: "mb-10 text-center flex flex-col items-center",
132
+ children: [
133
+ /* @__PURE__ */ jsx("div", {
134
+ className: "inline-flex h-14 w-14 mb-4 items-center justify-center rounded-lg bg-muted border border-border",
135
+ children: brandIcon || /* @__PURE__ */ jsx(Terminal, { className: "h-7 w-7 text-foreground" })
136
+ }),
137
+ /* @__PURE__ */ jsx("h1", {
138
+ className: "text-2xl font-bold tracking-tight text-foreground font-display",
139
+ children: title
140
+ }),
141
+ /* @__PURE__ */ jsx("p", {
142
+ className: "mt-2 text-sm text-muted-foreground",
143
+ children: subtitle
144
+ })
145
+ ]
146
+ }), /* @__PURE__ */ jsx("div", {
147
+ className: "w-full bg-card p-8 border border-border rounded-lg",
148
+ children
149
+ })]
150
+ })
151
+ });
152
+ }
153
+ //#endregion
154
+ export { UserMenu as i, AuthHeader as n, GitHubLoginButton as r, LoginLayout as t };
package/dist/auth.d.ts CHANGED
@@ -1,74 +1,2 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import * as React from 'react';
3
- import { a as ButtonProps } from './button-CMQuQEW_.js';
4
- import 'class-variance-authority/types';
5
-
6
- interface SessionUser {
7
- customer_id: string;
8
- email: string;
9
- name?: string;
10
- tier?: string;
11
- github?: {
12
- login: string;
13
- connected: boolean;
14
- } | null;
15
- session_expires_at: string;
16
- }
17
- interface GitHubLoginButtonProps extends Omit<ButtonProps, "onClick"> {
18
- /** API base URL (defaults to /auth/github) */
19
- authUrl?: string;
20
- /** Product variant for styling */
21
- variant?: "sandbox" | "default" | "outline";
22
- }
23
- declare function GitHubLoginButton({ authUrl, variant, className, children, ...props }: GitHubLoginButtonProps): react_jsx_runtime.JSX.Element;
24
- interface UserMenuProps {
25
- user: SessionUser;
26
- /** API base URL for logout */
27
- logoutUrl?: string;
28
- /** Links to show in menu */
29
- links?: Array<{
30
- href: string;
31
- label: string;
32
- icon?: React.ReactNode;
33
- }>;
34
- /** Product variant for styling */
35
- variant?: "sandbox";
36
- /** Callback when logout is clicked */
37
- onLogout?: () => void;
38
- }
39
- declare function UserMenu({ user, logoutUrl, links, variant, onLogout, }: UserMenuProps): react_jsx_runtime.JSX.Element;
40
- interface AuthHeaderProps {
41
- /** Current session user (null if not logged in) */
42
- user: SessionUser | null;
43
- /** Whether session is loading */
44
- loading?: boolean;
45
- /** Product variant */
46
- variant?: "sandbox";
47
- /** API base URL */
48
- apiBaseUrl?: string;
49
- /** Links for user menu */
50
- menuLinks?: UserMenuProps["links"];
51
- /** Custom className */
52
- className?: string;
53
- }
54
- declare function AuthHeader({ user, loading, variant, apiBaseUrl, menuLinks, className, }: AuthHeaderProps): react_jsx_runtime.JSX.Element;
55
-
56
- interface LoginLayoutProps {
57
- title?: React.ReactNode;
58
- subtitle?: React.ReactNode;
59
- brandIcon?: React.ReactNode;
60
- children: React.ReactNode;
61
- className?: string;
62
- /** (Deprecated) terminal lines from legacy layout, kept for backwards compatibility */
63
- terminalLines?: string[];
64
- /** (Deprecated) tagline, kept for backwards compatibility */
65
- tagline?: React.ReactNode;
66
- /** (Deprecated) footerLinks, kept for backwards compatibility */
67
- footerLinks?: {
68
- label: string;
69
- href: string;
70
- }[];
71
- }
72
- declare function LoginLayout({ title, subtitle, brandIcon, children, className, }: LoginLayoutProps): react_jsx_runtime.JSX.Element;
73
-
74
- export { AuthHeader, type AuthHeaderProps, GitHubLoginButton, type GitHubLoginButtonProps, LoginLayout, type LoginLayoutProps, type SessionUser, UserMenu, type UserMenuProps };
1
+ import { a as GitHubLoginButton, c as UserMenu, i as AuthHeaderProps, l as UserMenuProps, n as LoginLayoutProps, o as GitHubLoginButtonProps, r as AuthHeader, s as SessionUser, t as LoginLayout } from "./index-Cg6gYAqh.js";
2
+ export { AuthHeader, type AuthHeaderProps, GitHubLoginButton, type GitHubLoginButtonProps, LoginLayout, type LoginLayoutProps, type SessionUser, UserMenu, type UserMenuProps };
package/dist/auth.js CHANGED
@@ -1,15 +1,2 @@
1
- import {
2
- AuthHeader,
3
- GitHubLoginButton,
4
- LoginLayout,
5
- UserMenu
6
- } from "./chunk-NKDZ7GZE.js";
7
- import "./chunk-34A66VBG.js";
8
- import "./chunk-MKTSMWVD.js";
9
- import "./chunk-RQHJBTEU.js";
10
- export {
11
- AuthHeader,
12
- GitHubLoginButton,
13
- LoginLayout,
14
- UserMenu
15
- };
1
+ import { i as UserMenu, n as AuthHeader, r as GitHubLoginButton, t as LoginLayout } from "./auth-DixfCMCk.js";
2
+ export { AuthHeader, GitHubLoginButton, LoginLayout, UserMenu };
@@ -0,0 +1,14 @@
1
+ //#region src/types/branding.d.ts
2
+ /** Visual branding for a run group header — injected by consuming app. */
3
+ interface AgentBranding {
4
+ label: string;
5
+ accentClass: string;
6
+ bgClass: string;
7
+ containerBgClass: string;
8
+ borderClass: string;
9
+ /** CSS class for the agent icon (legacy). Ignored when using lucide-react icons. */
10
+ iconClass: string;
11
+ textClass: string;
12
+ }
13
+ //#endregion
14
+ export { AgentBranding as t };
@@ -0,0 +1,78 @@
1
+ import { i as focusRing } from "./focus-Cw02pNSr.js";
2
+ import { t as cn } from "./utils-C_uf36nf.js";
3
+ import { Slot } from "@radix-ui/react-slot";
4
+ import { cva } from "class-variance-authority";
5
+ import * as React from "react";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ //#region src/primitives/button.tsx
8
+ const buttonVariants = cva(`inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-lg font-medium text-sm transition-all ${focusRing} disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`, {
9
+ variants: {
10
+ variant: {
11
+ default: "bg-primary text-primary-foreground hover:bg-primary/90 active:scale-[0.97] duration-[var(--transition-fast)]",
12
+ destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90 active:scale-[0.97] duration-[var(--transition-fast)]",
13
+ outline: "border border-border bg-card hover:bg-muted active:scale-[0.97] duration-[var(--transition-fast)] text-foreground",
14
+ secondary: "bg-muted border border-border text-foreground hover:bg-muted/80 active:scale-[0.97] duration-[var(--transition-fast)]",
15
+ ghost: "hover:bg-muted hover:text-foreground duration-[var(--transition-fast)] text-muted-foreground border border-transparent",
16
+ link: "text-primary underline-offset-4 hover:underline",
17
+ sandbox: "bg-[var(--btn-primary-bg)] text-[var(--btn-primary-text)] border border-[var(--border-accent)] hover:bg-[var(--btn-primary-hover)] active:scale-[0.97] duration-[var(--transition-fast)]"
18
+ },
19
+ size: {
20
+ default: "h-[var(--control-height)] px-4 py-2",
21
+ sm: "h-8 rounded-md px-3 text-xs",
22
+ lg: "h-11 rounded-lg px-7 text-sm",
23
+ xl: "h-13 rounded-xl px-9 text-base",
24
+ icon: "h-[var(--control-height)] w-[var(--control-height)]"
25
+ }
26
+ },
27
+ defaultVariants: {
28
+ variant: "default",
29
+ size: "default"
30
+ }
31
+ });
32
+ const Button = React.forwardRef(({ className, variant, size, asChild = false, loading = false, disabled, children, ...props }, ref) => {
33
+ const Comp = asChild ? Slot : "button";
34
+ if (asChild) return /* @__PURE__ */ jsx(Comp, {
35
+ className: cn(buttonVariants({
36
+ variant,
37
+ size,
38
+ className
39
+ })),
40
+ ref,
41
+ ...props,
42
+ children
43
+ });
44
+ return /* @__PURE__ */ jsxs(Comp, {
45
+ className: cn(buttonVariants({
46
+ variant,
47
+ size,
48
+ className
49
+ })),
50
+ ref,
51
+ disabled: disabled || loading,
52
+ ...props,
53
+ children: [loading && /* @__PURE__ */ jsxs("svg", {
54
+ className: "mr-2 -ml-1 h-4 w-4 animate-spin",
55
+ fill: "none",
56
+ viewBox: "0 0 24 24",
57
+ children: [
58
+ /* @__PURE__ */ jsx("title", { children: "Loading spinner" }),
59
+ /* @__PURE__ */ jsx("circle", {
60
+ className: "opacity-25",
61
+ cx: "12",
62
+ cy: "12",
63
+ r: "10",
64
+ stroke: "currentColor",
65
+ strokeWidth: "4"
66
+ }),
67
+ /* @__PURE__ */ jsx("path", {
68
+ className: "opacity-75",
69
+ fill: "currentColor",
70
+ d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
71
+ })
72
+ ]
73
+ }), children]
74
+ });
75
+ });
76
+ Button.displayName = "Button";
77
+ //#endregion
78
+ export { buttonVariants as n, Button as t };
@@ -0,0 +1,16 @@
1
+ import * as React from "react";
2
+ //#region src/primitives/button.d.ts
3
+ declare const buttonVariants: (props?: ({
4
+ variant?: "default" | "destructive" | "ghost" | "link" | "outline" | "sandbox" | "secondary" | null | undefined;
5
+ size?: "default" | "icon" | "lg" | "sm" | "xl" | null | undefined;
6
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
+ interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
8
+ variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | "sandbox" | null;
9
+ size?: "default" | "sm" | "lg" | "xl" | "icon" | null;
10
+ asChild?: boolean;
11
+ loading?: boolean;
12
+ children?: React.ReactNode;
13
+ }
14
+ declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
15
+ //#endregion
16
+ export { ButtonProps as n, buttonVariants as r, Button as t };