@opencode-ai/ui 0.0.0-beta-202606251302

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 (346) hide show
  1. package/LICENSE +21 -0
  2. package/package.json +110 -0
  3. package/src/assets/audio/alert-01.aac +0 -0
  4. package/src/assets/audio/alert-01.mp3 +0 -0
  5. package/src/assets/audio/alert-02.aac +0 -0
  6. package/src/assets/audio/alert-02.mp3 +0 -0
  7. package/src/assets/audio/alert-03.aac +0 -0
  8. package/src/assets/audio/alert-03.mp3 +0 -0
  9. package/src/assets/audio/alert-04.aac +0 -0
  10. package/src/assets/audio/alert-04.mp3 +0 -0
  11. package/src/assets/audio/alert-05.aac +0 -0
  12. package/src/assets/audio/alert-05.mp3 +0 -0
  13. package/src/assets/audio/alert-06.aac +0 -0
  14. package/src/assets/audio/alert-06.mp3 +0 -0
  15. package/src/assets/audio/alert-07.aac +0 -0
  16. package/src/assets/audio/alert-07.mp3 +0 -0
  17. package/src/assets/audio/alert-08.aac +0 -0
  18. package/src/assets/audio/alert-08.mp3 +0 -0
  19. package/src/assets/audio/alert-09.aac +0 -0
  20. package/src/assets/audio/alert-09.mp3 +0 -0
  21. package/src/assets/audio/alert-10.aac +0 -0
  22. package/src/assets/audio/alert-10.mp3 +0 -0
  23. package/src/assets/audio/bip-bop-01.aac +0 -0
  24. package/src/assets/audio/bip-bop-01.mp3 +0 -0
  25. package/src/assets/audio/bip-bop-02.aac +0 -0
  26. package/src/assets/audio/bip-bop-02.mp3 +0 -0
  27. package/src/assets/audio/bip-bop-03.aac +0 -0
  28. package/src/assets/audio/bip-bop-03.mp3 +0 -0
  29. package/src/assets/audio/bip-bop-04.aac +0 -0
  30. package/src/assets/audio/bip-bop-04.mp3 +0 -0
  31. package/src/assets/audio/bip-bop-05.aac +0 -0
  32. package/src/assets/audio/bip-bop-05.mp3 +0 -0
  33. package/src/assets/audio/bip-bop-06.aac +0 -0
  34. package/src/assets/audio/bip-bop-06.mp3 +0 -0
  35. package/src/assets/audio/bip-bop-07.aac +0 -0
  36. package/src/assets/audio/bip-bop-07.mp3 +0 -0
  37. package/src/assets/audio/bip-bop-08.aac +0 -0
  38. package/src/assets/audio/bip-bop-08.mp3 +0 -0
  39. package/src/assets/audio/bip-bop-09.aac +0 -0
  40. package/src/assets/audio/bip-bop-09.mp3 +0 -0
  41. package/src/assets/audio/bip-bop-10.aac +0 -0
  42. package/src/assets/audio/bip-bop-10.mp3 +0 -0
  43. package/src/assets/audio/nope-01.aac +0 -0
  44. package/src/assets/audio/nope-01.mp3 +0 -0
  45. package/src/assets/audio/nope-02.aac +0 -0
  46. package/src/assets/audio/nope-02.mp3 +0 -0
  47. package/src/assets/audio/nope-03.aac +0 -0
  48. package/src/assets/audio/nope-03.mp3 +0 -0
  49. package/src/assets/audio/nope-04.aac +0 -0
  50. package/src/assets/audio/nope-04.mp3 +0 -0
  51. package/src/assets/audio/nope-05.aac +0 -0
  52. package/src/assets/audio/nope-05.mp3 +0 -0
  53. package/src/assets/audio/nope-06.aac +0 -0
  54. package/src/assets/audio/nope-06.mp3 +0 -0
  55. package/src/assets/audio/nope-07.aac +0 -0
  56. package/src/assets/audio/nope-07.mp3 +0 -0
  57. package/src/assets/audio/nope-08.aac +0 -0
  58. package/src/assets/audio/nope-08.mp3 +0 -0
  59. package/src/assets/audio/nope-09.aac +0 -0
  60. package/src/assets/audio/nope-09.mp3 +0 -0
  61. package/src/assets/audio/nope-10.aac +0 -0
  62. package/src/assets/audio/nope-10.mp3 +0 -0
  63. package/src/assets/audio/nope-11.aac +0 -0
  64. package/src/assets/audio/nope-11.mp3 +0 -0
  65. package/src/assets/audio/nope-12.aac +0 -0
  66. package/src/assets/audio/nope-12.mp3 +0 -0
  67. package/src/assets/audio/staplebops-01.aac +0 -0
  68. package/src/assets/audio/staplebops-01.mp3 +0 -0
  69. package/src/assets/audio/staplebops-02.aac +0 -0
  70. package/src/assets/audio/staplebops-02.mp3 +0 -0
  71. package/src/assets/audio/staplebops-03.aac +0 -0
  72. package/src/assets/audio/staplebops-03.mp3 +0 -0
  73. package/src/assets/audio/staplebops-04.aac +0 -0
  74. package/src/assets/audio/staplebops-04.mp3 +0 -0
  75. package/src/assets/audio/staplebops-05.aac +0 -0
  76. package/src/assets/audio/staplebops-05.mp3 +0 -0
  77. package/src/assets/audio/staplebops-06.aac +0 -0
  78. package/src/assets/audio/staplebops-06.mp3 +0 -0
  79. package/src/assets/audio/staplebops-07.aac +0 -0
  80. package/src/assets/audio/staplebops-07.mp3 +0 -0
  81. package/src/assets/audio/yup-01.aac +0 -0
  82. package/src/assets/audio/yup-01.mp3 +0 -0
  83. package/src/assets/audio/yup-02.aac +0 -0
  84. package/src/assets/audio/yup-02.mp3 +0 -0
  85. package/src/assets/audio/yup-03.aac +0 -0
  86. package/src/assets/audio/yup-03.mp3 +0 -0
  87. package/src/assets/audio/yup-04.aac +0 -0
  88. package/src/assets/audio/yup-04.mp3 +0 -0
  89. package/src/assets/audio/yup-05.aac +0 -0
  90. package/src/assets/audio/yup-05.mp3 +0 -0
  91. package/src/assets/audio/yup-06.aac +0 -0
  92. package/src/assets/audio/yup-06.mp3 +0 -0
  93. package/src/assets/fonts/Inter.ttf +0 -0
  94. package/src/assets/fonts/JetBrainsMonoNerdFontMono-Regular.woff2 +0 -0
  95. package/src/assets/icons/app/android-studio.svg +369 -0
  96. package/src/assets/icons/app/antigravity.svg +97 -0
  97. package/src/assets/icons/app/cursor.svg +16 -0
  98. package/src/assets/icons/app/file-explorer.svg +20 -0
  99. package/src/assets/icons/app/finder.png +0 -0
  100. package/src/assets/icons/app/ghostty.svg +13 -0
  101. package/src/assets/icons/app/iterm2.svg +13 -0
  102. package/src/assets/icons/app/powershell.svg +14 -0
  103. package/src/assets/icons/app/sublimetext.svg +17 -0
  104. package/src/assets/icons/app/terminal.png +0 -0
  105. package/src/assets/icons/app/textmate.png +0 -0
  106. package/src/assets/icons/app/vscode.svg +39 -0
  107. package/src/assets/icons/app/warp.png +0 -0
  108. package/src/assets/icons/app/xcode.png +0 -0
  109. package/src/assets/icons/app/zed-dark.svg +15 -0
  110. package/src/assets/icons/app/zed.svg +15 -0
  111. package/src/components/accordion.css +123 -0
  112. package/src/components/accordion.tsx +92 -0
  113. package/src/components/animated-number.css +75 -0
  114. package/src/components/animated-number.tsx +109 -0
  115. package/src/components/app-icon.css +5 -0
  116. package/src/components/app-icon.tsx +85 -0
  117. package/src/components/app-icons/sprite.svg +114 -0
  118. package/src/components/app-icons/types.ts +21 -0
  119. package/src/components/avatar.css +49 -0
  120. package/src/components/avatar.tsx +55 -0
  121. package/src/components/button.css +194 -0
  122. package/src/components/button.tsx +33 -0
  123. package/src/components/card.css +94 -0
  124. package/src/components/card.tsx +123 -0
  125. package/src/components/checkbox.css +131 -0
  126. package/src/components/checkbox.tsx +43 -0
  127. package/src/components/collapsible.css +148 -0
  128. package/src/components/collapsible.tsx +48 -0
  129. package/src/components/context-menu.css +134 -0
  130. package/src/components/context-menu.tsx +308 -0
  131. package/src/components/dialog.css +181 -0
  132. package/src/components/dialog.tsx +72 -0
  133. package/src/components/diff-changes.css +42 -0
  134. package/src/components/diff-changes.tsx +115 -0
  135. package/src/components/dock-surface.css +23 -0
  136. package/src/components/dock-surface.tsx +54 -0
  137. package/src/components/dropdown-menu.css +135 -0
  138. package/src/components/dropdown-menu.tsx +308 -0
  139. package/src/components/favicon.tsx +13 -0
  140. package/src/components/file-icon.css +26 -0
  141. package/src/components/file-icon.tsx +588 -0
  142. package/src/components/file-icons/sprite.svg +11707 -0
  143. package/src/components/file-icons/types.ts +1095 -0
  144. package/src/components/font.tsx +1 -0
  145. package/src/components/hover-card.css +61 -0
  146. package/src/components/hover-card.tsx +32 -0
  147. package/src/components/icon-button.css +181 -0
  148. package/src/components/icon-button.tsx +29 -0
  149. package/src/components/icon.css +34 -0
  150. package/src/components/icon.tsx +169 -0
  151. package/src/components/image-preview.css +63 -0
  152. package/src/components/image-preview.tsx +32 -0
  153. package/src/components/inline-input.css +17 -0
  154. package/src/components/inline-input.tsx +22 -0
  155. package/src/components/keybind.css +18 -0
  156. package/src/components/keybind.tsx +20 -0
  157. package/src/components/list.css +331 -0
  158. package/src/components/list.tsx +394 -0
  159. package/src/components/logo.css +4 -0
  160. package/src/components/logo.tsx +62 -0
  161. package/src/components/motion-spring.tsx +58 -0
  162. package/src/components/popover.css +98 -0
  163. package/src/components/popover.tsx +153 -0
  164. package/src/components/progress-circle.css +12 -0
  165. package/src/components/progress-circle.tsx +57 -0
  166. package/src/components/progress.css +63 -0
  167. package/src/components/progress.tsx +39 -0
  168. package/src/components/provider-icon.css +5 -0
  169. package/src/components/provider-icon.tsx +25 -0
  170. package/src/components/provider-icons/sprite.svg +1135 -0
  171. package/src/components/provider-icons/types.ts +105 -0
  172. package/src/components/radio-group.css +187 -0
  173. package/src/components/radio-group.tsx +83 -0
  174. package/src/components/resize-handle.css +58 -0
  175. package/src/components/resize-handle.tsx +82 -0
  176. package/src/components/scroll-view.css +66 -0
  177. package/src/components/scroll-view.tsx +250 -0
  178. package/src/components/select.css +202 -0
  179. package/src/components/select.tsx +174 -0
  180. package/src/components/spinner.css +6 -0
  181. package/src/components/spinner.tsx +52 -0
  182. package/src/components/sticky-accordion-header.css +6 -0
  183. package/src/components/sticky-accordion-header.tsx +18 -0
  184. package/src/components/switch.css +132 -0
  185. package/src/components/switch.tsx +29 -0
  186. package/src/components/tabs.css +635 -0
  187. package/src/components/tabs.tsx +125 -0
  188. package/src/components/tag.css +37 -0
  189. package/src/components/tag.tsx +22 -0
  190. package/src/components/text-field.css +134 -0
  191. package/src/components/text-field.tsx +128 -0
  192. package/src/components/text-reveal.css +150 -0
  193. package/src/components/text-reveal.tsx +143 -0
  194. package/src/components/text-shimmer.css +119 -0
  195. package/src/components/text-shimmer.tsx +62 -0
  196. package/src/components/text-strikethrough.css +27 -0
  197. package/src/components/text-strikethrough.tsx +84 -0
  198. package/src/components/toast.css +236 -0
  199. package/src/components/toast.tsx +185 -0
  200. package/src/components/tooltip.css +74 -0
  201. package/src/components/tooltip.tsx +161 -0
  202. package/src/components/typewriter.css +14 -0
  203. package/src/components/typewriter.tsx +55 -0
  204. package/src/context/dialog.tsx +197 -0
  205. package/src/context/file.tsx +10 -0
  206. package/src/context/helper.tsx +38 -0
  207. package/src/context/i18n.tsx +38 -0
  208. package/src/context/index.ts +4 -0
  209. package/src/context/marked.tsx +522 -0
  210. package/src/context/worker-pool.tsx +20 -0
  211. package/src/custom-elements.d.ts +17 -0
  212. package/src/hooks/create-auto-scroll.tsx +237 -0
  213. package/src/hooks/index.ts +2 -0
  214. package/src/hooks/use-filtered-list.tsx +134 -0
  215. package/src/i18n/ar.ts +168 -0
  216. package/src/i18n/br.ts +168 -0
  217. package/src/i18n/bs.ts +172 -0
  218. package/src/i18n/da.ts +167 -0
  219. package/src/i18n/de.ts +173 -0
  220. package/src/i18n/en.ts +176 -0
  221. package/src/i18n/es.ts +168 -0
  222. package/src/i18n/fr.ts +168 -0
  223. package/src/i18n/ja.ts +167 -0
  224. package/src/i18n/ko.ts +168 -0
  225. package/src/i18n/no.ts +171 -0
  226. package/src/i18n/pl.ts +167 -0
  227. package/src/i18n/ru.ts +167 -0
  228. package/src/i18n/th.ts +169 -0
  229. package/src/i18n/tr.ts +174 -0
  230. package/src/i18n/uk.ts +167 -0
  231. package/src/i18n/zh.ts +171 -0
  232. package/src/i18n/zht.ts +171 -0
  233. package/src/storybook/fixtures.ts +51 -0
  234. package/src/storybook/scaffold.tsx +62 -0
  235. package/src/styles/animations.css +141 -0
  236. package/src/styles/base.css +404 -0
  237. package/src/styles/colors.css +772 -0
  238. package/src/styles/index.css +53 -0
  239. package/src/styles/tailwind/colors.css +285 -0
  240. package/src/styles/tailwind/index.css +78 -0
  241. package/src/styles/tailwind/utilities.css +131 -0
  242. package/src/styles/theme.css +609 -0
  243. package/src/styles/utilities.css +118 -0
  244. package/src/theme/color.ts +299 -0
  245. package/src/theme/context.tsx +370 -0
  246. package/src/theme/default-themes.ts +116 -0
  247. package/src/theme/index.ts +78 -0
  248. package/src/theme/loader.ts +112 -0
  249. package/src/theme/resolve.ts +540 -0
  250. package/src/theme/themes/amoled.json +49 -0
  251. package/src/theme/themes/aura.json +51 -0
  252. package/src/theme/themes/ayu.json +51 -0
  253. package/src/theme/themes/carbonfox.json +53 -0
  254. package/src/theme/themes/catppuccin-frappe.json +85 -0
  255. package/src/theme/themes/catppuccin-macchiato.json +85 -0
  256. package/src/theme/themes/catppuccin.json +45 -0
  257. package/src/theme/themes/cobalt2.json +87 -0
  258. package/src/theme/themes/cursor.json +91 -0
  259. package/src/theme/themes/dracula.json +49 -0
  260. package/src/theme/themes/everforest.json +89 -0
  261. package/src/theme/themes/flexoki.json +86 -0
  262. package/src/theme/themes/github.json +85 -0
  263. package/src/theme/themes/gruvbox.json +45 -0
  264. package/src/theme/themes/kanagawa.json +89 -0
  265. package/src/theme/themes/lucent-orng.json +87 -0
  266. package/src/theme/themes/material.json +87 -0
  267. package/src/theme/themes/matrix.json +113 -0
  268. package/src/theme/themes/mercury.json +86 -0
  269. package/src/theme/themes/monokai.json +49 -0
  270. package/src/theme/themes/nightowl.json +46 -0
  271. package/src/theme/themes/nord.json +46 -0
  272. package/src/theme/themes/oc-2.json +468 -0
  273. package/src/theme/themes/one-dark.json +89 -0
  274. package/src/theme/themes/onedarkpro.json +45 -0
  275. package/src/theme/themes/opencode.json +89 -0
  276. package/src/theme/themes/orng.json +87 -0
  277. package/src/theme/themes/osaka-jade.json +88 -0
  278. package/src/theme/themes/palenight.json +85 -0
  279. package/src/theme/themes/rosepine.json +85 -0
  280. package/src/theme/themes/shadesofpurple.json +51 -0
  281. package/src/theme/themes/solarized.json +49 -0
  282. package/src/theme/themes/synthwave84.json +87 -0
  283. package/src/theme/themes/tokyonight.json +47 -0
  284. package/src/theme/themes/vercel.json +90 -0
  285. package/src/theme/themes/vesper.json +51 -0
  286. package/src/theme/themes/zenburn.json +87 -0
  287. package/src/theme/types.ts +75 -0
  288. package/src/theme/v2/avatar.ts +48 -0
  289. package/src/theme/v2/default-primitives.ts +114 -0
  290. package/src/theme/v2/foreground.ts +60 -0
  291. package/src/theme/v2/mapping.ts +138 -0
  292. package/src/theme/v2/resolve.ts +153 -0
  293. package/src/v2/components/accordion-v2.css +139 -0
  294. package/src/v2/components/accordion-v2.tsx +86 -0
  295. package/src/v2/components/avatar-v2.css +70 -0
  296. package/src/v2/components/avatar-v2.tsx +59 -0
  297. package/src/v2/components/badge-v2.css +27 -0
  298. package/src/v2/components/badge-v2.tsx +20 -0
  299. package/src/v2/components/button-v2.css +186 -0
  300. package/src/v2/components/button-v2.tsx +35 -0
  301. package/src/v2/components/checkbox-v2.css +184 -0
  302. package/src/v2/components/checkbox-v2.tsx +65 -0
  303. package/src/v2/components/dialog-v2.css +150 -0
  304. package/src/v2/components/dialog-v2.tsx +93 -0
  305. package/src/v2/components/diff-changes-v2.css +24 -0
  306. package/src/v2/components/diff-changes-v2.tsx +28 -0
  307. package/src/v2/components/field-v2.css +94 -0
  308. package/src/v2/components/field-v2.tsx +265 -0
  309. package/src/v2/components/icon-button-v2.css +155 -0
  310. package/src/v2/components/icon-button-v2.tsx +37 -0
  311. package/src/v2/components/icon.tsx +129 -0
  312. package/src/v2/components/inline-input-v2.css +218 -0
  313. package/src/v2/components/inline-input-v2.tsx +90 -0
  314. package/src/v2/components/keybind-v2.css +76 -0
  315. package/src/v2/components/keybind-v2.tsx +30 -0
  316. package/src/v2/components/line-comment-v2.css +204 -0
  317. package/src/v2/components/line-comment-v2.tsx +155 -0
  318. package/src/v2/components/menu-v2.css +190 -0
  319. package/src/v2/components/menu-v2.tsx +225 -0
  320. package/src/v2/components/project-avatar-v2.css +126 -0
  321. package/src/v2/components/project-avatar-v2.tsx +64 -0
  322. package/src/v2/components/radio-v2.css +202 -0
  323. package/src/v2/components/radio-v2.tsx +72 -0
  324. package/src/v2/components/segmented-control-v2.css +80 -0
  325. package/src/v2/components/segmented-control-v2.tsx +208 -0
  326. package/src/v2/components/select-v2.css +285 -0
  327. package/src/v2/components/select-v2.tsx +208 -0
  328. package/src/v2/components/switch-v2.css +154 -0
  329. package/src/v2/components/switch-v2.tsx +28 -0
  330. package/src/v2/components/tab-state-indicator.tsx +37 -0
  331. package/src/v2/components/tabs-v2.css +225 -0
  332. package/src/v2/components/tabs-v2.tsx +147 -0
  333. package/src/v2/components/text-input-v2.css +145 -0
  334. package/src/v2/components/text-input-v2.tsx +67 -0
  335. package/src/v2/components/text-shimmer-v2.css +125 -0
  336. package/src/v2/components/text-shimmer-v2.tsx +63 -0
  337. package/src/v2/components/textarea-v2.css +78 -0
  338. package/src/v2/components/textarea-v2.tsx +31 -0
  339. package/src/v2/components/toast-v2.css +215 -0
  340. package/src/v2/components/toast-v2.tsx +144 -0
  341. package/src/v2/components/tooltip-v2.css +53 -0
  342. package/src/v2/components/tooltip-v2.tsx +146 -0
  343. package/src/v2/components/wordmark-v2.tsx +92 -0
  344. package/src/v2/styles/colors.css +172 -0
  345. package/src/v2/styles/tailwind.css +2 -0
  346. package/src/v2/styles/theme.css +441 -0
@@ -0,0 +1,93 @@
1
+ import { Dialog as Kobalte } from "@kobalte/core/dialog"
2
+ import { type ComponentProps, type JSXElement, type ParentProps, Show, children, splitProps } from "solid-js"
3
+ import "./dialog-v2.css"
4
+
5
+ export interface DialogProps extends ParentProps {
6
+ title?: JSXElement
7
+ description?: JSXElement
8
+ action?: JSXElement
9
+ size?: "normal" | "large" | "x-large"
10
+ variant?: "default" | "settings"
11
+ class?: ComponentProps<"div">["class"]
12
+ classList?: ComponentProps<"div">["classList"]
13
+ fit?: boolean
14
+ }
15
+
16
+ export function DialogFooter(props: ParentProps) {
17
+ return <div data-slot="dialog-footer">{props.children}</div>
18
+ }
19
+
20
+ export function Dialog(props: DialogProps) {
21
+ const [local] = splitProps(props, [
22
+ "title",
23
+ "description",
24
+ "action",
25
+ "size",
26
+ "variant",
27
+ "class",
28
+ "classList",
29
+ "fit",
30
+ "children",
31
+ ])
32
+ const title = children(() => local.title)
33
+ const description = children(() => local.description)
34
+ const action = children(() => local.action)
35
+ const hasHeader = () => title() || action()
36
+
37
+ return (
38
+ <div
39
+ data-component="dialog-v2"
40
+ data-variant={local.variant === "settings" ? "settings" : undefined}
41
+ data-fit={local.fit ? true : undefined}
42
+ data-size={local.size || "normal"}
43
+ >
44
+ <div data-slot="dialog-container">
45
+ <Kobalte.Content
46
+ data-slot="dialog-content"
47
+ data-no-header={!hasHeader() ? "" : undefined}
48
+ classList={{
49
+ ...local.classList,
50
+ [local.class ?? ""]: !!local.class,
51
+ }}
52
+ onOpenAutoFocus={(e) => {
53
+ const target = e.currentTarget as HTMLElement | null
54
+ const autofocusEl = target?.querySelector("[autofocus]") as HTMLElement | null
55
+ if (autofocusEl) {
56
+ e.preventDefault()
57
+ autofocusEl.focus()
58
+ }
59
+ }}
60
+ >
61
+ <Show when={hasHeader()}>
62
+ <div data-slot="dialog-header">
63
+ <div data-slot="dialog-title-group">
64
+ <Show when={title()}>{(t) => <Kobalte.Title data-slot="dialog-title">{t()}</Kobalte.Title>}</Show>
65
+ <Show when={description()}>
66
+ {(d) => <Kobalte.Description data-slot="dialog-description">{d()}</Kobalte.Description>}
67
+ </Show>
68
+ </div>
69
+ <Show when={action()}>{(a) => a()}</Show>
70
+ <Kobalte.CloseButton data-slot="dialog-close-button" aria-label="Close">
71
+ <svg
72
+ width="16"
73
+ height="16"
74
+ viewBox="0 0 16 16"
75
+ fill="none"
76
+ xmlns="http://www.w3.org/2000/svg"
77
+ aria-hidden="true"
78
+ >
79
+ <path
80
+ d="M12.4446 3.55469L3.55566 12.4436M3.55566 3.55469L12.4446 12.4436"
81
+ stroke="currentColor"
82
+ stroke-linejoin="round"
83
+ />
84
+ </svg>
85
+ </Kobalte.CloseButton>
86
+ </div>
87
+ </Show>
88
+ <div data-slot="dialog-body">{local.children}</div>
89
+ </Kobalte.Content>
90
+ </div>
91
+ </div>
92
+ )
93
+ }
@@ -0,0 +1,24 @@
1
+ [data-component="diff-changes"] {
2
+ display: flex;
3
+ gap: 8px;
4
+ justify-content: flex-end;
5
+ align-items: center;
6
+
7
+ [data-slot="diff-changes-additions"],
8
+ [data-slot="diff-changes-deletions"] {
9
+ font-size: 11px;
10
+ font-style: normal;
11
+ font-weight: 440;
12
+ line-height: 1;
13
+ letter-spacing: 0.05px;
14
+ text-align: right;
15
+ }
16
+
17
+ [data-slot="diff-changes-additions"] {
18
+ color: var(--v2-state-fg-success);
19
+ }
20
+
21
+ [data-slot="diff-changes-deletions"] {
22
+ color: var(--v2-state-fg-danger);
23
+ }
24
+ }
@@ -0,0 +1,28 @@
1
+ import { createMemo, Show } from "solid-js"
2
+ import "./diff-changes-v2.css"
3
+
4
+ export function DiffChanges(props: {
5
+ class?: string
6
+ changes: { additions: number; deletions: number } | { additions: number; deletions: number }[]
7
+ }) {
8
+ const additions = createMemo(() =>
9
+ Array.isArray(props.changes)
10
+ ? props.changes.reduce((acc, diff) => acc + (diff.additions ?? 0), 0)
11
+ : props.changes.additions,
12
+ )
13
+ const deletions = createMemo(() =>
14
+ Array.isArray(props.changes)
15
+ ? props.changes.reduce((acc, diff) => acc + (diff.deletions ?? 0), 0)
16
+ : props.changes.deletions,
17
+ )
18
+ const total = createMemo(() => (additions() ?? 0) + (deletions() ?? 0))
19
+
20
+ return (
21
+ <Show when={total() > 0}>
22
+ <div data-component="diff-changes" classList={{ [props.class ?? ""]: true }}>
23
+ <span data-slot="diff-changes-additions">{`+${additions()}`}</span>
24
+ <span data-slot="diff-changes-deletions">{`-${deletions()}`}</span>
25
+ </div>
26
+ </Show>
27
+ )
28
+ }
@@ -0,0 +1,94 @@
1
+ [data-component="field-v2"] {
2
+ display: flex;
3
+ flex-direction: column;
4
+ align-items: flex-start;
5
+ gap: 8px;
6
+ width: 100%;
7
+ min-width: 0;
8
+ }
9
+
10
+ [data-component="field-v2"] [data-slot="field-v2-label"] {
11
+ display: flex;
12
+ flex-direction: row;
13
+ align-items: center;
14
+ align-self: stretch;
15
+ gap: 4px;
16
+ min-height: 16px;
17
+ margin: 0;
18
+ padding: 0;
19
+ border: 0;
20
+ font-style: normal;
21
+ font-weight: 530;
22
+ font-size: 13px;
23
+ line-height: 1;
24
+ letter-spacing: -0.04px;
25
+ color: var(--v2-text-text-base);
26
+ font-variation-settings: "slnt" 0;
27
+ cursor: default;
28
+ user-select: none;
29
+ }
30
+
31
+ [data-component="field-v2"] [data-slot="field-v2-label-text"] {
32
+ display: inline-flex;
33
+ align-items: center;
34
+ }
35
+
36
+ [data-component="field-v2"] [data-slot="field-v2-label"] [data-component="tooltip-v2-trigger"] {
37
+ display: inline-flex;
38
+ flex: none;
39
+ width: 16px;
40
+ height: 16px;
41
+ }
42
+
43
+ [data-component="field-v2"] [data-slot="field-v2-label-info"] {
44
+ display: inline-flex;
45
+ align-items: center;
46
+ justify-content: center;
47
+ flex: none;
48
+ width: 16px;
49
+ height: 16px;
50
+ padding: 0;
51
+ border: 0;
52
+ border-radius: 0;
53
+ background: transparent;
54
+ color: var(--v2-icon-icon-muted);
55
+ cursor: pointer;
56
+ outline: none;
57
+ }
58
+
59
+ [data-component="field-v2"] [data-slot="field-v2-label-info"]:is(:hover, [data-state="hover"]) {
60
+ color: var(--v2-text-text-base);
61
+ }
62
+
63
+ [data-component="field-v2"] [data-slot="field-v2-label-info"]:focus {
64
+ outline: none;
65
+ }
66
+
67
+ [data-component="field-v2"] [data-slot="field-v2-label-info"]:focus-visible {
68
+ outline: 2px solid var(--v2-border-border-focus);
69
+ outline-offset: 1px;
70
+ border-radius: 2px;
71
+ }
72
+
73
+ [data-component="field-v2"] [data-slot="field-v2-prefix"],
74
+ [data-component="field-v2"] [data-slot="field-v2-suffix"] {
75
+ align-self: stretch;
76
+ width: 100%;
77
+ min-height: 11px;
78
+ font-style: normal;
79
+ font-weight: 440;
80
+ font-size: 11px;
81
+ line-height: 1;
82
+ letter-spacing: 0.05px;
83
+ color: var(--v2-text-text-muted);
84
+ font-variation-settings: "slnt" 0;
85
+ user-select: none;
86
+ }
87
+
88
+ [data-component="field-v2"] [data-slot="field-v2-control"] {
89
+ display: flex;
90
+ flex-direction: column;
91
+ align-items: flex-start;
92
+ width: 100%;
93
+ min-width: 0;
94
+ }
@@ -0,0 +1,265 @@
1
+ import {
2
+ createContext,
3
+ createEffect,
4
+ createSignal,
5
+ createUniqueId,
6
+ onCleanup,
7
+ onMount,
8
+ splitProps,
9
+ useContext,
10
+ Show,
11
+ type ComponentProps,
12
+ type ParentProps,
13
+ } from "solid-js"
14
+ import { TooltipV2 } from "./tooltip-v2"
15
+ import "./field-v2.css"
16
+
17
+ type FieldContextValue = {
18
+ controlId: string
19
+ labelId: string
20
+ prefixId: string
21
+ suffixId: string
22
+ invalid: () => boolean
23
+ registerPrefix: () => void
24
+ unregisterPrefix: () => void
25
+ registerSuffix: () => void
26
+ unregisterSuffix: () => void
27
+ getDescribedBy: () => string | undefined
28
+ }
29
+
30
+ const FieldContext = createContext<FieldContextValue>()
31
+
32
+ function useField() {
33
+ const ctx = useContext(FieldContext)
34
+ if (!ctx) {
35
+ throw new Error("Field subcomponents must be used within <Field>")
36
+ }
37
+ return ctx
38
+ }
39
+
40
+ const CONTROL_SELECTOR = [
41
+ "[data-slot='text-input-v2-input']",
42
+ "[data-slot='textarea-v2-textarea']",
43
+ "[data-slot='inline-input-v2-input']",
44
+ ].join(", ")
45
+
46
+ export interface FieldV2Props extends ComponentProps<"div"> {
47
+ invalid?: boolean
48
+ }
49
+
50
+ function FieldV2Root(props: ParentProps<FieldV2Props>) {
51
+ const [local, rest] = splitProps(props, ["invalid", "class", "classList", "children"])
52
+
53
+ const controlId = `field-control-${createUniqueId()}`
54
+ const labelId = `field-label-${createUniqueId()}`
55
+ const prefixId = `field-prefix-${createUniqueId()}`
56
+ const suffixId = `field-suffix-${createUniqueId()}`
57
+
58
+ const [prefixCount, setPrefixCount] = createSignal(0)
59
+ const [suffixCount, setSuffixCount] = createSignal(0)
60
+
61
+ let rootRef: HTMLDivElement | undefined
62
+
63
+ const ctx: FieldContextValue = {
64
+ controlId,
65
+ labelId,
66
+ prefixId,
67
+ suffixId,
68
+ invalid: () => !!local.invalid,
69
+ registerPrefix: () => setPrefixCount((n) => n + 1),
70
+ unregisterPrefix: () => setPrefixCount((n) => Math.max(0, n - 1)),
71
+ registerSuffix: () => setSuffixCount((n) => n + 1),
72
+ unregisterSuffix: () => setSuffixCount((n) => Math.max(0, n - 1)),
73
+ getDescribedBy: () => {
74
+ const ids: string[] = []
75
+ if (prefixCount() > 0) ids.push(prefixId)
76
+ if (suffixCount() > 0) ids.push(suffixId)
77
+ return ids.length > 0 ? ids.join(" ") : undefined
78
+ },
79
+ }
80
+
81
+ const syncControlA11y = () => {
82
+ const root = rootRef
83
+ if (!root) return
84
+
85
+ const control = root.querySelector(CONTROL_SELECTOR) as HTMLInputElement | HTMLTextAreaElement | null
86
+ if (!control) return
87
+
88
+ const shell = control.closest(
89
+ "[data-component='text-input-v2'], [data-component='textarea-v2'], [data-component='inline-input-v2']",
90
+ ) as HTMLElement | null
91
+
92
+ control.id = controlId
93
+ control.setAttribute("aria-labelledby", labelId)
94
+
95
+ const describedBy = ctx.getDescribedBy()
96
+ if (describedBy) {
97
+ control.setAttribute("aria-describedby", describedBy)
98
+ } else {
99
+ control.removeAttribute("aria-describedby")
100
+ }
101
+
102
+ if (ctx.invalid()) {
103
+ control.setAttribute("aria-invalid", "true")
104
+ shell?.setAttribute("data-invalid", "")
105
+ } else {
106
+ control.removeAttribute("aria-invalid")
107
+ shell?.removeAttribute("data-invalid")
108
+ }
109
+ }
110
+
111
+ onMount(() => {
112
+ syncControlA11y()
113
+ })
114
+
115
+ createEffect(() => {
116
+ prefixCount()
117
+ suffixCount()
118
+ local.invalid
119
+ syncControlA11y()
120
+ })
121
+
122
+ return (
123
+ <FieldContext.Provider value={ctx}>
124
+ <div
125
+ {...rest}
126
+ ref={rootRef}
127
+ data-component="field-v2"
128
+ data-invalid={local.invalid ? "" : undefined}
129
+ classList={{
130
+ ...local.classList,
131
+ [local.class ?? ""]: !!local.class,
132
+ }}
133
+ >
134
+ {local.children}
135
+ </div>
136
+ </FieldContext.Provider>
137
+ )
138
+ }
139
+
140
+ function FieldLabelInfoIcon() {
141
+ return (
142
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
143
+ <path
144
+ fill-rule="evenodd"
145
+ clip-rule="evenodd"
146
+ d="M13 13H3V3H13V13ZM6.46777 6.81641V7.81641H7.5791V11.3721H8.5791V6.81641H6.46777ZM7.30078 4.62891V5.62891H8.85645V4.62891H7.30078Z"
147
+ fill="currentColor"
148
+ />
149
+ </svg>
150
+ )
151
+ }
152
+
153
+ export interface FieldLabelProps extends ComponentProps<"label"> {
154
+ /** When set, shows the info icon with a tooltip containing this text. */
155
+ tooltip?: string
156
+ }
157
+
158
+ function FieldLabel(props: ParentProps<FieldLabelProps>) {
159
+ const [local, rest] = splitProps(props, ["class", "classList", "children", "tooltip"])
160
+ const field = useField()
161
+
162
+ return (
163
+ <label
164
+ {...rest}
165
+ id={field.labelId}
166
+ for={field.controlId}
167
+ data-slot="field-v2-label"
168
+ classList={{
169
+ ...local.classList,
170
+ [local.class ?? ""]: !!local.class,
171
+ }}
172
+ >
173
+ <span data-slot="field-v2-label-text">{local.children}</span>
174
+ <Show when={local.tooltip}>
175
+ {(tooltip) => (
176
+ <TooltipV2 value={tooltip()}>
177
+ <button
178
+ type="button"
179
+ data-slot="field-v2-label-info"
180
+ aria-label={tooltip()}
181
+ onClick={(e) => e.stopPropagation()}
182
+ >
183
+ <FieldLabelInfoIcon />
184
+ </button>
185
+ </TooltipV2>
186
+ )}
187
+ </Show>
188
+ </label>
189
+ )
190
+ }
191
+
192
+ function FieldPrefix(props: ParentProps<ComponentProps<"div">>) {
193
+ const [local, rest] = splitProps(props, ["class", "classList", "children"])
194
+ const field = useField()
195
+
196
+ onMount(() => {
197
+ field.registerPrefix()
198
+ onCleanup(() => field.unregisterPrefix())
199
+ })
200
+
201
+ return (
202
+ <div
203
+ {...rest}
204
+ id={field.prefixId}
205
+ data-slot="field-v2-prefix"
206
+ classList={{
207
+ ...local.classList,
208
+ [local.class ?? ""]: !!local.class,
209
+ }}
210
+ >
211
+ {local.children}
212
+ </div>
213
+ )
214
+ }
215
+
216
+ function FieldSuffix(props: ParentProps<ComponentProps<"div">>) {
217
+ const [local, rest] = splitProps(props, ["class", "classList", "children"])
218
+ const field = useField()
219
+
220
+ onMount(() => {
221
+ field.registerSuffix()
222
+ onCleanup(() => field.unregisterSuffix())
223
+ })
224
+
225
+ return (
226
+ <div
227
+ {...rest}
228
+ id={field.suffixId}
229
+ data-slot="field-v2-suffix"
230
+ classList={{
231
+ ...local.classList,
232
+ [local.class ?? ""]: !!local.class,
233
+ }}
234
+ >
235
+ {local.children}
236
+ </div>
237
+ )
238
+ }
239
+
240
+ /** Optional layout wrapper around the control. */
241
+ function FieldControl(props: ParentProps<ComponentProps<"div">>) {
242
+ const [local, rest] = splitProps(props, ["class", "classList", "children"])
243
+
244
+ return (
245
+ <div
246
+ {...rest}
247
+ data-slot="field-v2-control"
248
+ classList={{
249
+ ...local.classList,
250
+ [local.class ?? ""]: !!local.class,
251
+ }}
252
+ >
253
+ {local.children}
254
+ </div>
255
+ )
256
+ }
257
+
258
+ export const FieldV2 = Object.assign(FieldV2Root, {
259
+ Label: FieldLabel,
260
+ Prefix: FieldPrefix,
261
+ Suffix: FieldSuffix,
262
+ Control: FieldControl,
263
+ })
264
+
265
+ export const Field = FieldV2
@@ -0,0 +1,155 @@
1
+ * {
2
+ -webkit-font-smoothing: antialiased;
3
+ -moz-osx-font-smoothing: grayscale;
4
+ text-rendering: geometricPrecision;
5
+ }
6
+
7
+ [data-component="icon-button-v2"] {
8
+ display: inline-flex;
9
+ align-items: center;
10
+ justify-content: center;
11
+ border-radius: 6px;
12
+ color: var(--v2-text-text-base);
13
+ user-select: none;
14
+ outline: none;
15
+ padding: 0;
16
+ cursor: default;
17
+ }
18
+
19
+ [data-component="icon-button-v2"]:focus {
20
+ outline: none;
21
+ }
22
+
23
+ [data-component="icon-button-v2"]:is(:focus-visible, [data-state="focus"]):not(:disabled) {
24
+ outline: 2px solid var(--v2-border-border-focus);
25
+ outline-offset: 2.5px;
26
+ }
27
+
28
+ [data-component="icon-button-v2"][data-size="small"] {
29
+ width: 20px;
30
+ height: 20px;
31
+ border-radius: 4px;
32
+ }
33
+
34
+ [data-component="icon-button-v2"][data-size="normal"] {
35
+ width: 24px;
36
+ height: 24px;
37
+ }
38
+
39
+ [data-component="icon-button-v2"][data-size="large"] {
40
+ width: 28px;
41
+ height: 28px;
42
+ }
43
+
44
+ [data-component="icon-button-v2"] [data-slot="icon-svg"] {
45
+ color: currentColor;
46
+ }
47
+
48
+ /* Neutral */
49
+ [data-component="icon-button-v2"][data-variant="neutral"] {
50
+ background-color: var(--v2-background-bg-button-neutral);
51
+ color: var(--v2-text-text-base);
52
+ box-shadow: var(--v2-elevation-button-neutral);
53
+ }
54
+
55
+ [data-component="icon-button-v2"][data-variant="neutral"]:is(:hover, [data-state="hover"]):not(:disabled) {
56
+ background-image:
57
+ linear-gradient(90deg, var(--v2-overlay-simple-overlay-hover) 0%, var(--v2-overlay-simple-overlay-hover) 100%),
58
+ linear-gradient(90deg, var(--v2-background-bg-button-neutral) 0%, var(--v2-background-bg-button-neutral) 100%);
59
+ }
60
+
61
+ [data-component="icon-button-v2"][data-variant="neutral"]:is(:active, [data-state="pressed"]):not(:disabled) {
62
+ background-image:
63
+ linear-gradient(90deg, var(--v2-overlay-simple-overlay-pressed) 0%, var(--v2-overlay-simple-overlay-pressed) 100%),
64
+ linear-gradient(90deg, var(--v2-background-bg-button-neutral) 0%, var(--v2-background-bg-button-neutral) 100%);
65
+ }
66
+
67
+ [data-component="icon-button-v2"][data-variant="neutral"]:is(:disabled, [data-state="disabled"]) {
68
+ opacity: 0.5;
69
+ cursor: not-allowed;
70
+ }
71
+
72
+ /* Contrast */
73
+ [data-component="icon-button-v2"][data-variant="contrast"] {
74
+ background-image:
75
+ linear-gradient(180deg, var(--v2-alpha-light-20) 0%, var(--v2-alpha-light-0) 100%),
76
+ linear-gradient(90deg, var(--v2-background-bg-contrast) 0%, var(--v2-background-bg-contrast) 100%);
77
+ color: var(--v2-text-text-contrast);
78
+ text-shadow: 0 0.5px 0.5px rgba(0, 0, 0, 0.3);
79
+ box-shadow: var(--v2-elevation-button-contrast);
80
+ }
81
+
82
+ [data-component="icon-button-v2"][data-variant="contrast"]:is(:hover, [data-state="hover"]):not(:disabled) {
83
+ background-image:
84
+ linear-gradient(
85
+ 90deg,
86
+ var(--v2-overlay-simple-overlay-contrast-hover) 0%,
87
+ var(--v2-overlay-simple-overlay-contrast-hover) 100%
88
+ ),
89
+ linear-gradient(180deg, var(--v2-alpha-light-20) 0%, var(--v2-alpha-light-0) 100%),
90
+ linear-gradient(90deg, var(--v2-background-bg-contrast) 0%, var(--v2-background-bg-contrast) 100%);
91
+ }
92
+
93
+ [data-component="icon-button-v2"][data-variant="contrast"]:is(:active, [data-state="pressed"]):not(:disabled) {
94
+ background-image:
95
+ linear-gradient(
96
+ 90deg,
97
+ var(--v2-overlay-simple-overlay-contrast-pressed) 0%,
98
+ var(--v2-overlay-simple-overlay-contrast-pressed) 100%
99
+ ),
100
+ linear-gradient(180deg, var(--v2-alpha-light-20) 0%, var(--v2-alpha-light-0) 100%),
101
+ linear-gradient(90deg, var(--v2-background-bg-contrast) 0%, var(--v2-background-bg-contrast) 100%);
102
+ }
103
+
104
+ [data-component="icon-button-v2"][data-variant="contrast"]:is(:disabled, [data-state="disabled"]) {
105
+ opacity: 0.4;
106
+ cursor: not-allowed;
107
+ }
108
+
109
+ /* Ghost */
110
+ [data-component="icon-button-v2"][data-variant="ghost"] {
111
+ background-color: transparent;
112
+ color: var(--v2-text-text-base);
113
+ }
114
+
115
+ [data-component="icon-button-v2"][data-variant="ghost"]:is(:hover, [data-state="hover"], [data-expanded]):not(
116
+ :disabled
117
+ ) {
118
+ background-color: var(--v2-overlay-simple-overlay-hover);
119
+ }
120
+
121
+ [data-component="icon-button-v2"][data-variant="ghost"]:is(:active, [data-state="pressed"]):not(:disabled) {
122
+ background-color: var(--v2-overlay-simple-overlay-pressed);
123
+ }
124
+
125
+ [data-component="icon-button-v2"][data-variant="ghost"]:is(:disabled, [data-state="disabled"]) {
126
+ opacity: 0.5;
127
+ cursor: not-allowed;
128
+ }
129
+
130
+ /* Ghost */
131
+ [data-component="icon-button-v2"][data-variant="ghost-muted"] {
132
+ background-color: transparent;
133
+ color: var(--v2-icon-icon-muted);
134
+ }
135
+
136
+ [data-component="icon-button-v2"][data-variant="ghost-muted"]:is(:hover, [data-state="hover"], [data-expanded]):not(
137
+ :disabled
138
+ ) {
139
+ background-color: var(--v2-overlay-simple-overlay-hover);
140
+ }
141
+
142
+ [data-component="icon-button-v2"][data-variant="ghost-muted"]:is(:active, [data-state="pressed"]):not(:disabled) {
143
+ background-color: var(--v2-overlay-simple-overlay-pressed);
144
+ color: var(--v2-icon-icon-base);
145
+ }
146
+
147
+ [data-component="icon-button-v2"][data-variant="ghost-muted"]:where([data-expanded]):not(:disabled) {
148
+ background-color: var(--v2-overlay-simple-overlay-pressed);
149
+ color: var(--v2-icon-icon-base);
150
+ }
151
+
152
+ [data-component="icon-button-v2"][data-variant="ghost-muted"]:is(:disabled, [data-state="disabled"]) {
153
+ opacity: 0.5;
154
+ cursor: not-allowed;
155
+ }
@@ -0,0 +1,37 @@
1
+ import { Button as Kobalte } from "@kobalte/core/button"
2
+ import { type ComponentProps, splitProps } from "solid-js"
3
+ import { JSX } from "solid-js"
4
+ import "./icon-button-v2.css"
5
+
6
+ export interface IconButtonV2Props
7
+ extends ComponentProps<typeof Kobalte>,
8
+ Pick<ComponentProps<"button">, "class" | "classList"> {
9
+ // temporary
10
+ icon?: JSX.Element
11
+ // icon: IconProps["name"]
12
+ size?: "small" | "normal" | "large"
13
+ // iconSize?: IconProps["size"]
14
+ variant?: "neutral" | "contrast" | "ghost" | "ghost-muted"
15
+ state?: "rest" | "hover" | "pressed"
16
+ }
17
+
18
+ export function IconButtonV2(props: ComponentProps<"button"> & IconButtonV2Props) {
19
+ const [split, rest] = splitProps(props, ["variant", "size", "iconSize", "class", "classList", "state"])
20
+ return (
21
+ <Kobalte
22
+ {...rest}
23
+ data-component="icon-button-v2"
24
+ // data-icon={props.icon}
25
+ data-size={split.size || "normal"}
26
+ data-variant={split.variant || "neutral"}
27
+ data-state={split.state}
28
+ classList={{
29
+ ...split.classList,
30
+ [split.class ?? ""]: !!split.class,
31
+ }}
32
+ >
33
+ {props.icon}
34
+ {/*<Icon name={props.icon} size={split.iconSize ?? (split.size === "large" ? "normal" : "small")} />*/}
35
+ </Kobalte>
36
+ )
37
+ }