@neurocode-ai/ui 1.18.8

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 (356) hide show
  1. package/LICENSE +21 -0
  2. package/package.json +113 -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 +147 -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 +115 -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 +154 -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 +37 -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 +170 -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 +16 -0
  165. package/src/components/progress-circle.tsx +64 -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 +98 -0
  176. package/src/components/scroll-view.css +67 -0
  177. package/src/components/scroll-view.tsx +388 -0
  178. package/src/components/select.css +199 -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 +861 -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 +163 -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-code-span.ts +17 -0
  210. package/src/context/marked.tsx +570 -0
  211. package/src/context/worker-pool.tsx +20 -0
  212. package/src/custom-elements.d.ts +17 -0
  213. package/src/hooks/create-auto-scroll.tsx +237 -0
  214. package/src/hooks/index.ts +2 -0
  215. package/src/hooks/use-filtered-list.tsx +134 -0
  216. package/src/i18n/ar.ts +193 -0
  217. package/src/i18n/br.ts +193 -0
  218. package/src/i18n/bs.ts +197 -0
  219. package/src/i18n/da.ts +192 -0
  220. package/src/i18n/de.ts +199 -0
  221. package/src/i18n/en.ts +196 -0
  222. package/src/i18n/es.ts +193 -0
  223. package/src/i18n/fr.ts +193 -0
  224. package/src/i18n/ja.ts +192 -0
  225. package/src/i18n/ko.ts +194 -0
  226. package/src/i18n/no.ts +197 -0
  227. package/src/i18n/pl.ts +192 -0
  228. package/src/i18n/ru.ts +192 -0
  229. package/src/i18n/th.ts +194 -0
  230. package/src/i18n/tr.ts +199 -0
  231. package/src/i18n/uk.ts +196 -0
  232. package/src/i18n/zh.ts +196 -0
  233. package/src/i18n/zht.ts +196 -0
  234. package/src/storybook/fixtures.ts +51 -0
  235. package/src/storybook/scaffold.tsx +62 -0
  236. package/src/styles/animations.css +141 -0
  237. package/src/styles/base.css +404 -0
  238. package/src/styles/colors.css +772 -0
  239. package/src/styles/index.css +53 -0
  240. package/src/styles/tailwind/colors.css +286 -0
  241. package/src/styles/tailwind/index.css +78 -0
  242. package/src/styles/tailwind/utilities.css +131 -0
  243. package/src/styles/theme.css +631 -0
  244. package/src/styles/utilities.css +118 -0
  245. package/src/theme/color.ts +299 -0
  246. package/src/theme/context.tsx +373 -0
  247. package/src/theme/default-themes.ts +116 -0
  248. package/src/theme/index.ts +78 -0
  249. package/src/theme/loader.ts +112 -0
  250. package/src/theme/resolve.ts +540 -0
  251. package/src/theme/themes/amoled.json +49 -0
  252. package/src/theme/themes/aura.json +51 -0
  253. package/src/theme/themes/ayu.json +51 -0
  254. package/src/theme/themes/carbonfox.json +53 -0
  255. package/src/theme/themes/catppuccin-frappe.json +85 -0
  256. package/src/theme/themes/catppuccin-macchiato.json +85 -0
  257. package/src/theme/themes/catppuccin.json +45 -0
  258. package/src/theme/themes/cobalt2.json +87 -0
  259. package/src/theme/themes/cursor.json +91 -0
  260. package/src/theme/themes/dracula.json +49 -0
  261. package/src/theme/themes/everforest.json +89 -0
  262. package/src/theme/themes/flexoki.json +86 -0
  263. package/src/theme/themes/github.json +85 -0
  264. package/src/theme/themes/gruvbox.json +45 -0
  265. package/src/theme/themes/kanagawa.json +89 -0
  266. package/src/theme/themes/lucent-orng.json +87 -0
  267. package/src/theme/themes/material.json +87 -0
  268. package/src/theme/themes/matrix.json +113 -0
  269. package/src/theme/themes/mercury.json +86 -0
  270. package/src/theme/themes/monokai.json +49 -0
  271. package/src/theme/themes/nightowl.json +46 -0
  272. package/src/theme/themes/nord.json +46 -0
  273. package/src/theme/themes/oc-2.json +474 -0
  274. package/src/theme/themes/one-dark.json +89 -0
  275. package/src/theme/themes/onedarkpro.json +45 -0
  276. package/src/theme/themes/opencode.json +89 -0
  277. package/src/theme/themes/orng.json +87 -0
  278. package/src/theme/themes/osaka-jade.json +88 -0
  279. package/src/theme/themes/palenight.json +85 -0
  280. package/src/theme/themes/rosepine.json +85 -0
  281. package/src/theme/themes/shadesofpurple.json +51 -0
  282. package/src/theme/themes/solarized.json +49 -0
  283. package/src/theme/themes/synthwave84.json +87 -0
  284. package/src/theme/themes/tokyonight.json +47 -0
  285. package/src/theme/themes/vercel.json +90 -0
  286. package/src/theme/themes/vesper.json +51 -0
  287. package/src/theme/themes/zenburn.json +87 -0
  288. package/src/theme/types.ts +75 -0
  289. package/src/theme/v2/avatar.ts +48 -0
  290. package/src/theme/v2/default-primitives.ts +114 -0
  291. package/src/theme/v2/foreground.ts +60 -0
  292. package/src/theme/v2/mapping.ts +170 -0
  293. package/src/theme/v2/resolve.ts +153 -0
  294. package/src/v2/components/accordion-v2.css +139 -0
  295. package/src/v2/components/accordion-v2.tsx +86 -0
  296. package/src/v2/components/avatar-v2.css +70 -0
  297. package/src/v2/components/avatar-v2.tsx +59 -0
  298. package/src/v2/components/badge-v2.css +33 -0
  299. package/src/v2/components/badge-v2.tsx +23 -0
  300. package/src/v2/components/button-v2.css +262 -0
  301. package/src/v2/components/button-v2.tsx +35 -0
  302. package/src/v2/components/checkbox-v2.css +184 -0
  303. package/src/v2/components/checkbox-v2.tsx +65 -0
  304. package/src/v2/components/dialog-v2.css +177 -0
  305. package/src/v2/components/dialog-v2.tsx +115 -0
  306. package/src/v2/components/diff-changes-v2.css +24 -0
  307. package/src/v2/components/diff-changes-v2.tsx +28 -0
  308. package/src/v2/components/divider-v2.css +11 -0
  309. package/src/v2/components/divider-v2.tsx +20 -0
  310. package/src/v2/components/field-v2.css +94 -0
  311. package/src/v2/components/field-v2.tsx +265 -0
  312. package/src/v2/components/file-tree-v2.css +137 -0
  313. package/src/v2/components/icon-button-v2.css +159 -0
  314. package/src/v2/components/icon-button-v2.tsx +37 -0
  315. package/src/v2/components/icon.tsx +209 -0
  316. package/src/v2/components/inline-input-v2.css +225 -0
  317. package/src/v2/components/inline-input-v2.tsx +105 -0
  318. package/src/v2/components/keybind-v2.css +76 -0
  319. package/src/v2/components/keybind-v2.tsx +30 -0
  320. package/src/v2/components/line-comment-v2.css +258 -0
  321. package/src/v2/components/line-comment-v2.tsx +304 -0
  322. package/src/v2/components/loader-v2.css +32 -0
  323. package/src/v2/components/loader-v2.tsx +31 -0
  324. package/src/v2/components/menu-v2.css +190 -0
  325. package/src/v2/components/menu-v2.tsx +225 -0
  326. package/src/v2/components/progress-circle-v2.css +13 -0
  327. package/src/v2/components/progress-circle-v2.tsx +52 -0
  328. package/src/v2/components/project-avatar-v2.css +132 -0
  329. package/src/v2/components/project-avatar-v2.tsx +66 -0
  330. package/src/v2/components/radio-v2.css +202 -0
  331. package/src/v2/components/radio-v2.tsx +72 -0
  332. package/src/v2/components/segmented-control-v2.css +80 -0
  333. package/src/v2/components/segmented-control-v2.tsx +208 -0
  334. package/src/v2/components/select-v2.css +286 -0
  335. package/src/v2/components/select-v2.tsx +208 -0
  336. package/src/v2/components/split-button-v2.css +99 -0
  337. package/src/v2/components/split-button-v2.tsx +48 -0
  338. package/src/v2/components/switch-v2.css +154 -0
  339. package/src/v2/components/switch-v2.tsx +28 -0
  340. package/src/v2/components/tab-state-indicator.tsx +37 -0
  341. package/src/v2/components/tabs-v2.css +226 -0
  342. package/src/v2/components/tabs-v2.tsx +147 -0
  343. package/src/v2/components/text-input-v2.css +179 -0
  344. package/src/v2/components/text-input-v2.tsx +93 -0
  345. package/src/v2/components/text-shimmer-v2.css +125 -0
  346. package/src/v2/components/text-shimmer-v2.tsx +63 -0
  347. package/src/v2/components/textarea-v2.css +78 -0
  348. package/src/v2/components/textarea-v2.tsx +31 -0
  349. package/src/v2/components/toast-v2.css +215 -0
  350. package/src/v2/components/toast-v2.tsx +146 -0
  351. package/src/v2/components/tooltip-v2.css +69 -0
  352. package/src/v2/components/tooltip-v2.tsx +147 -0
  353. package/src/v2/components/wordmark-v2.tsx +71 -0
  354. package/src/v2/styles/colors.css +172 -0
  355. package/src/v2/styles/tailwind.css +2 -0
  356. package/src/v2/styles/theme.css +503 -0
@@ -0,0 +1,174 @@
1
+ import { Select as Kobalte } from "@kobalte/core/select"
2
+ import { createMemo, onCleanup, splitProps, type ComponentProps, type JSX } from "solid-js"
3
+ import { pipe, groupBy, entries, map } from "remeda"
4
+ import { Button, ButtonProps } from "./button"
5
+ import { Icon } from "./icon"
6
+
7
+ export type SelectProps<T> = Omit<ComponentProps<typeof Kobalte<T>>, "value" | "onSelect" | "children"> & {
8
+ placeholder?: string
9
+ options: T[]
10
+ current?: T
11
+ value?: (x: T) => string
12
+ label?: (x: T) => string
13
+ groupBy?: (x: T) => string
14
+ valueClass?: ComponentProps<"div">["class"]
15
+ onSelect?: (value: T | undefined) => void
16
+ onHighlight?: (value: T | undefined) => (() => void) | void
17
+ class?: ComponentProps<"div">["class"]
18
+ classList?: ComponentProps<"div">["classList"]
19
+ children?: (item: T | undefined) => JSX.Element
20
+ triggerStyle?: JSX.CSSProperties
21
+ triggerVariant?: "settings"
22
+ triggerProps?: Record<string, string | number | boolean | undefined>
23
+ }
24
+
25
+ export function Select<T>(props: SelectProps<T> & Omit<ButtonProps, "children">) {
26
+ const [local, others] = splitProps(props, [
27
+ "class",
28
+ "classList",
29
+ "placeholder",
30
+ "options",
31
+ "current",
32
+ "value",
33
+ "label",
34
+ "groupBy",
35
+ "valueClass",
36
+ "onSelect",
37
+ "onHighlight",
38
+ "onOpenChange",
39
+ "children",
40
+ "triggerStyle",
41
+ "triggerVariant",
42
+ "triggerProps",
43
+ ])
44
+
45
+ const state = {
46
+ key: undefined as string | undefined,
47
+ cleanup: undefined as (() => void) | void,
48
+ }
49
+
50
+ const stop = () => {
51
+ state.cleanup?.()
52
+ state.cleanup = undefined
53
+ state.key = undefined
54
+ }
55
+
56
+ const keyFor = (item: T) => (local.value ? local.value(item) : (item as string))
57
+
58
+ const move = (item: T | undefined) => {
59
+ if (!local.onHighlight) return
60
+ if (!item) {
61
+ stop()
62
+ return
63
+ }
64
+
65
+ const key = keyFor(item)
66
+ if (state.key === key) return
67
+ state.cleanup?.()
68
+ state.cleanup = local.onHighlight(item)
69
+ state.key = key
70
+ }
71
+
72
+ onCleanup(stop)
73
+
74
+ const grouped = createMemo(() => {
75
+ const result = pipe(
76
+ local.options,
77
+ groupBy((x) => (local.groupBy ? local.groupBy(x) : "")),
78
+ // mapValues((x) => x.sort((a, b) => a.title.localeCompare(b.title))),
79
+ entries(),
80
+ map(([k, v]) => ({ category: k, options: v })),
81
+ )
82
+ return result
83
+ })
84
+
85
+ return (
86
+ // @ts-ignore
87
+ <Kobalte<T, { category: string; options: T[] }>
88
+ {...others}
89
+ data-component="select"
90
+ data-trigger-style={local.triggerVariant}
91
+ placement={local.triggerVariant === "settings" ? "bottom-end" : "bottom-start"}
92
+ gutter={4}
93
+ value={local.current}
94
+ options={grouped()}
95
+ optionValue={(x) => (local.value ? local.value(x) : (x as string))}
96
+ optionTextValue={(x) => (local.label ? local.label(x) : (x as string))}
97
+ optionGroupChildren="options"
98
+ placeholder={local.placeholder}
99
+ sectionComponent={(local) => (
100
+ <Kobalte.Section data-slot="select-section">{local.section.rawValue.category}</Kobalte.Section>
101
+ )}
102
+ itemComponent={(itemProps) => (
103
+ <Kobalte.Item
104
+ {...itemProps}
105
+ data-slot="select-select-item"
106
+ classList={{
107
+ ...local.classList,
108
+ [local.class ?? ""]: !!local.class,
109
+ }}
110
+ onPointerEnter={() => move(itemProps.item.rawValue)}
111
+ onPointerMove={() => move(itemProps.item.rawValue)}
112
+ onFocus={() => move(itemProps.item.rawValue)}
113
+ >
114
+ <Kobalte.ItemLabel data-slot="select-select-item-label">
115
+ {local.children
116
+ ? local.children(itemProps.item.rawValue)
117
+ : local.label
118
+ ? local.label(itemProps.item.rawValue)
119
+ : (itemProps.item.rawValue as string)}
120
+ </Kobalte.ItemLabel>
121
+ <Kobalte.ItemIndicator data-slot="select-select-item-indicator">
122
+ <Icon name="check-small" size="small" />
123
+ </Kobalte.ItemIndicator>
124
+ </Kobalte.Item>
125
+ )}
126
+ onChange={(v) => {
127
+ local.onSelect?.(v ?? undefined)
128
+ stop()
129
+ }}
130
+ onOpenChange={(open) => {
131
+ local.onOpenChange?.(open)
132
+ if (!open) stop()
133
+ }}
134
+ >
135
+ <Kobalte.Trigger
136
+ {...local.triggerProps}
137
+ disabled={props.disabled}
138
+ data-slot="select-select-trigger"
139
+ as={Button}
140
+ size={props.size}
141
+ variant={props.variant}
142
+ style={local.triggerStyle}
143
+ classList={{
144
+ ...local.classList,
145
+ [local.class ?? ""]: !!local.class,
146
+ }}
147
+ >
148
+ <Kobalte.Value<T> data-slot="select-select-trigger-value" class={local.valueClass}>
149
+ {(state) => {
150
+ const selected = state.selectedOption() ?? local.current
151
+ if (!selected) return local.placeholder || ""
152
+ if (local.label) return local.label(selected)
153
+ return selected as string
154
+ }}
155
+ </Kobalte.Value>
156
+ <Kobalte.Icon data-slot="select-select-trigger-icon">
157
+ <Icon name={local.triggerVariant === "settings" ? "selector" : "chevron-down"} size="small" />
158
+ </Kobalte.Icon>
159
+ </Kobalte.Trigger>
160
+ <Kobalte.Portal>
161
+ <Kobalte.Content
162
+ classList={{
163
+ ...local.classList,
164
+ [local.class ?? ""]: !!local.class,
165
+ }}
166
+ data-component="select-content"
167
+ data-trigger-style={local.triggerVariant}
168
+ >
169
+ <Kobalte.Listbox data-slot="select-select-content-list" />
170
+ </Kobalte.Content>
171
+ </Kobalte.Portal>
172
+ </Kobalte>
173
+ )
174
+ }
@@ -0,0 +1,6 @@
1
+ [data-component="spinner"] {
2
+ color: inherit;
3
+ flex-shrink: 0;
4
+ width: 18px;
5
+ aspect-ratio: 1;
6
+ }
@@ -0,0 +1,52 @@
1
+ import { ComponentProps, For } from "solid-js"
2
+
3
+ const outerIndices = new Set([1, 2, 4, 7, 8, 11, 13, 14])
4
+ const cornerIndices = new Set([0, 3, 12, 15])
5
+ const squares = Array.from({ length: 16 }, (_, i) => ({
6
+ id: i,
7
+ x: (i % 4) * 4,
8
+ y: Math.floor(i / 4) * 4,
9
+ delay: Math.random() * 1.5,
10
+ duration: 1 + Math.random() * 1,
11
+ outer: outerIndices.has(i),
12
+ corner: cornerIndices.has(i),
13
+ }))
14
+
15
+ export function Spinner(props: {
16
+ class?: string
17
+ classList?: ComponentProps<"div">["classList"]
18
+ style?: ComponentProps<"div">["style"]
19
+ }) {
20
+ return (
21
+ <svg
22
+ {...props}
23
+ viewBox="0 0 15 15"
24
+ data-component="spinner"
25
+ classList={{
26
+ ...props.classList,
27
+ [props.class ?? ""]: !!props.class,
28
+ }}
29
+ fill="currentColor"
30
+ >
31
+ <For each={squares}>
32
+ {(square) => (
33
+ <rect
34
+ x={square.x}
35
+ y={square.y}
36
+ width="3"
37
+ height="3"
38
+ rx="1"
39
+ style={{
40
+ opacity: square.corner ? 0 : undefined,
41
+ animation: square.corner
42
+ ? undefined
43
+ : `${square.outer ? "pulse-opacity-dim" : "pulse-opacity"} ${square.duration}s ease-in-out infinite`,
44
+ "animation-fill-mode": square.corner ? undefined : "both",
45
+ "animation-delay": square.corner ? undefined : `${square.delay}s`,
46
+ }}
47
+ />
48
+ )}
49
+ </For>
50
+ </svg>
51
+ )
52
+ }
@@ -0,0 +1,6 @@
1
+ [data-component="sticky-accordion-header"] {
2
+ position: sticky;
3
+ top: calc(var(--sticky-accordion-top, 0px) + var(--sticky-accordion-offset, 0px));
4
+ z-index: 10;
5
+ background-color: var(--background-stronger);
6
+ }
@@ -0,0 +1,18 @@
1
+ import { Accordion } from "./accordion"
2
+ import { ParentProps } from "solid-js"
3
+
4
+ export function StickyAccordionHeader(
5
+ props: ParentProps<{ class?: string; classList?: Record<string, boolean | undefined> }>,
6
+ ) {
7
+ return (
8
+ <Accordion.Header
9
+ data-component="sticky-accordion-header"
10
+ classList={{
11
+ ...props.classList,
12
+ [props.class ?? ""]: !!props.class,
13
+ }}
14
+ >
15
+ {props.children}
16
+ </Accordion.Header>
17
+ )
18
+ }
@@ -0,0 +1,132 @@
1
+ [data-component="switch"] {
2
+ position: relative;
3
+ display: flex;
4
+ align-items: center;
5
+ gap: 8px;
6
+ cursor: default;
7
+
8
+ [data-slot="switch-input"] {
9
+ position: absolute;
10
+ width: 1px;
11
+ height: 1px;
12
+ padding: 0;
13
+ margin: -1px;
14
+ overflow: hidden;
15
+ clip: rect(0, 0, 0, 0);
16
+ white-space: nowrap;
17
+ border-width: 0;
18
+ }
19
+
20
+ [data-slot="switch-control"] {
21
+ display: inline-flex;
22
+ align-items: center;
23
+ width: 28px;
24
+ height: 16px;
25
+ flex-shrink: 0;
26
+ border-radius: 3px;
27
+ border: 1px solid var(--border-weak-base);
28
+ background: var(--surface-base);
29
+ transition:
30
+ background-color 150ms,
31
+ border-color 150ms;
32
+ }
33
+
34
+ [data-slot="switch-thumb"] {
35
+ width: 14px;
36
+ height: 14px;
37
+ box-sizing: content-box;
38
+
39
+ border-radius: 2px;
40
+ border: 1px solid var(--border-base);
41
+ background: var(--icon-invert-base);
42
+
43
+ /* shadows/shadow-xs */
44
+ box-shadow:
45
+ 0 1px 2px -1px rgba(19, 16, 16, 0.04),
46
+ 0 1px 2px 0 rgba(19, 16, 16, 0.06),
47
+ 0 1px 3px 0 rgba(19, 16, 16, 0.08);
48
+
49
+ transform: translateX(-1px);
50
+ transition:
51
+ transform 150ms,
52
+ background-color 150ms;
53
+ }
54
+
55
+ [data-slot="switch-label"] {
56
+ user-select: none;
57
+ color: var(--text-base);
58
+ font-family: var(--font-family-sans);
59
+ font-size: var(--font-size-small);
60
+ font-style: normal;
61
+ font-weight: var(--font-weight-regular);
62
+ line-height: var(--line-height-large);
63
+ letter-spacing: var(--letter-spacing-normal);
64
+ }
65
+
66
+ [data-slot="switch-description"] {
67
+ color: var(--text-base);
68
+ font-family: var(--font-family-sans);
69
+ font-size: 12px;
70
+ font-weight: var(--font-weight-regular);
71
+ line-height: var(--line-height-normal);
72
+ letter-spacing: var(--letter-spacing-normal);
73
+ }
74
+
75
+ [data-slot="switch-error"] {
76
+ color: var(--text-error);
77
+ font-family: var(--font-family-sans);
78
+ font-size: 12px;
79
+ font-weight: var(--font-weight-regular);
80
+ line-height: var(--line-height-normal);
81
+ letter-spacing: var(--letter-spacing-normal);
82
+ }
83
+
84
+ &:hover:not([data-disabled], [data-readonly]) [data-slot="switch-control"] {
85
+ border-color: var(--border-hover);
86
+ background-color: var(--surface-hover);
87
+ }
88
+
89
+ &:not([data-readonly]) [data-slot="switch-input"]:focus-visible ~ [data-slot="switch-control"] {
90
+ border-color: var(--border-focus);
91
+ box-shadow: var(--shadow-xs-border-focus);
92
+ }
93
+
94
+ &[data-checked] [data-slot="switch-control"] {
95
+ box-sizing: border-box;
96
+ border-color: var(--icon-strong-base);
97
+ background-color: var(--icon-strong-base);
98
+ }
99
+
100
+ &[data-checked] [data-slot="switch-thumb"] {
101
+ border: none;
102
+ transform: translateX(12px);
103
+ background-color: var(--icon-invert-base);
104
+ }
105
+
106
+ &[data-checked]:hover:not([data-disabled], [data-readonly]) [data-slot="switch-control"] {
107
+ border-color: var(--border-hover);
108
+ background-color: var(--surface-hover);
109
+ }
110
+
111
+ &[data-disabled] {
112
+ cursor: not-allowed;
113
+ }
114
+
115
+ &[data-disabled] [data-slot="switch-control"] {
116
+ border-color: var(--border-disabled);
117
+ background-color: var(--surface-disabled);
118
+ }
119
+
120
+ &[data-disabled] [data-slot="switch-thumb"] {
121
+ background-color: var(--icon-disabled);
122
+ }
123
+
124
+ &[data-invalid] [data-slot="switch-control"] {
125
+ border-color: var(--border-error);
126
+ }
127
+
128
+ &[data-readonly] {
129
+ cursor: default;
130
+ pointer-events: none;
131
+ }
132
+ }
@@ -0,0 +1,29 @@
1
+ import { Switch as Kobalte } from "@kobalte/core/switch"
2
+ import { Show, splitProps } from "solid-js"
3
+ import type { ComponentProps, ParentProps } from "solid-js"
4
+
5
+ export interface SwitchProps extends ParentProps<ComponentProps<typeof Kobalte>> {
6
+ hideLabel?: boolean
7
+ description?: string
8
+ }
9
+
10
+ export function Switch(props: SwitchProps) {
11
+ const [local, others] = splitProps(props, ["children", "class", "hideLabel", "description"])
12
+ return (
13
+ <Kobalte {...others} class={local.class} data-component="switch">
14
+ <Kobalte.Input data-slot="switch-input" />
15
+ <Show when={local.children}>
16
+ <Kobalte.Label data-slot="switch-label" classList={{ "sr-only": local.hideLabel }}>
17
+ {local.children}
18
+ </Kobalte.Label>
19
+ </Show>
20
+ <Show when={local.description}>
21
+ <Kobalte.Description data-slot="switch-description">{local.description}</Kobalte.Description>
22
+ </Show>
23
+ <Kobalte.ErrorMessage data-slot="switch-error" />
24
+ <Kobalte.Control data-slot="switch-control">
25
+ <Kobalte.Thumb data-slot="switch-thumb" />
26
+ </Kobalte.Control>
27
+ </Kobalte>
28
+ )
29
+ }