@opencode-ai/ui 0.0.0-dev-202609020429 → 0.0.0-dev-18874

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 (296) hide show
  1. package/dist/actions/button/button.d.ts +10 -0
  2. package/dist/actions/icon-button/icon-button.d.ts +11 -0
  3. package/dist/actions/split-button/split-button.d.ts +5 -0
  4. package/dist/components/card.d.ts +1 -1
  5. package/dist/components/list.d.ts +1 -1
  6. package/dist/components/scroll-view.d.ts +3 -3
  7. package/dist/context/i18n.d.ts +10 -7
  8. package/dist/context/marked-base.d.ts +3 -0
  9. package/dist/context/marked-parser.d.ts +1 -2
  10. package/dist/{components → data-display/accordion}/accordion.d.ts +6 -6
  11. package/dist/{v2/components/avatar-v2.d.ts → data-display/avatar/avatar.d.ts} +1 -1
  12. package/dist/data-display/badge/badge.d.ts +7 -0
  13. package/dist/{components → data-display/diff-changes}/diff-changes.d.ts +2 -1
  14. package/dist/data-display/keybind/keybind.d.ts +7 -0
  15. package/dist/{v2/components/line-comment-v2.d.ts → data-display/line-comment/line-comment.d.ts} +9 -9
  16. package/dist/{v2/components/project-avatar-v2.d.ts → data-display/project-avatar/project-avatar.d.ts} +1 -1
  17. package/dist/feedback/loader/loader.d.ts +3 -0
  18. package/dist/{components → feedback/progress-circle}/progress-circle.d.ts +2 -0
  19. package/dist/feedback/toast/toast.d.ts +57 -0
  20. package/dist/{components → forms/checkbox}/checkbox.d.ts +2 -2
  21. package/dist/{v2/components/field-v2.d.ts → forms/field/field.d.ts} +4 -10
  22. package/dist/forms/radio/radio.d.ts +16 -0
  23. package/dist/{v2/components/select-v2.d.ts → forms/select/select.d.ts} +4 -6
  24. package/dist/{components → forms/switch}/switch.d.ts +4 -2
  25. package/dist/{v2/components/text-input-v2.d.ts → forms/text-input/text-input.d.ts} +3 -3
  26. package/dist/forms/textarea/textarea.d.ts +7 -0
  27. package/dist/hooks/use-filtered-list.d.ts +9 -0
  28. package/dist/i18n/ar.d.ts +0 -2
  29. package/dist/i18n/bg.d.ts +0 -2
  30. package/dist/i18n/br.d.ts +0 -2
  31. package/dist/i18n/bs.d.ts +0 -2
  32. package/dist/i18n/da.d.ts +0 -2
  33. package/dist/i18n/de.d.ts +0 -2
  34. package/dist/i18n/en.d.ts +230 -1
  35. package/dist/i18n/es.d.ts +0 -2
  36. package/dist/i18n/fr.d.ts +0 -2
  37. package/dist/i18n/he.d.ts +197 -0
  38. package/dist/i18n/ja.d.ts +0 -2
  39. package/dist/i18n/km.d.ts +0 -2
  40. package/dist/i18n/ko.d.ts +0 -2
  41. package/dist/i18n/lo.d.ts +0 -2
  42. package/dist/i18n/mk.d.ts +0 -2
  43. package/dist/i18n/mn.d.ts +0 -2
  44. package/dist/i18n/my.d.ts +0 -2
  45. package/dist/i18n/pl.d.ts +0 -2
  46. package/dist/i18n/ru.d.ts +0 -2
  47. package/dist/i18n/sr.d.ts +0 -2
  48. package/dist/i18n/tg.d.ts +0 -2
  49. package/dist/i18n/th.d.ts +0 -2
  50. package/dist/i18n/tr.d.ts +0 -2
  51. package/dist/i18n/zh.d.ts +0 -2
  52. package/dist/i18n/zht.d.ts +0 -2
  53. package/dist/{components/icon.d.ts → icons/icon/additional-icons.d.ts} +8 -8
  54. package/dist/{v2/components → icons/icon}/icon.d.ts +24 -1
  55. package/dist/layout/divider/divider.d.ts +5 -0
  56. package/dist/navigation/menu/menu.d.ts +59 -0
  57. package/dist/{v2/components/segmented-control-v2.d.ts → navigation/segmented-control/segmented-control.d.ts} +5 -5
  58. package/dist/{components → navigation/tabs}/tabs.d.ts +15 -8
  59. package/dist/{v2/components/dialog-v2.d.ts → overlays/dialog/dialog.d.ts} +1 -2
  60. package/dist/overlays/tooltip/tooltip.d.ts +15 -0
  61. package/dist/{components → typography/text-shimmer}/text-shimmer.d.ts +1 -0
  62. package/dist/typography/wordmark/wordmark.d.ts +2 -0
  63. package/package.json +140 -34
  64. package/src/{components → actions/button}/button.tsx +10 -11
  65. package/src/actions/icon-button/icon-button.tsx +32 -0
  66. package/src/{v2/components/split-button-v2.css → actions/split-button/split-button.css} +1 -6
  67. package/src/{v2/components/split-button-v2.tsx → actions/split-button/split-button.tsx} +4 -4
  68. package/src/components/animated-number.css +29 -11
  69. package/src/components/animated-number.tsx +2 -2
  70. package/src/components/card.css +2 -23
  71. package/src/components/card.tsx +4 -4
  72. package/src/components/collapsible.tsx +2 -2
  73. package/src/components/dock-surface.css +2 -9
  74. package/src/components/image-preview.tsx +3 -2
  75. package/src/components/list.css +5 -5
  76. package/src/components/list.tsx +7 -5
  77. package/src/components/popover.tsx +3 -2
  78. package/src/components/scroll-view.tsx +5 -20
  79. package/src/components/sticky-accordion-header.tsx +1 -1
  80. package/src/components/text-field.tsx +12 -4
  81. package/src/context/dialog.tsx +1 -0
  82. package/src/context/i18n.tsx +17 -14
  83. package/src/context/marked-base.tsx +27 -0
  84. package/src/context/marked-parser.tsx +3 -13
  85. package/src/{components → data-display/accordion}/accordion.css +5 -31
  86. package/src/{components → data-display/accordion}/accordion.tsx +14 -14
  87. package/src/{v2/components/avatar-v2.tsx → data-display/avatar/avatar.tsx} +1 -1
  88. package/src/{v2/components/badge-v2.css → data-display/badge/badge.css} +19 -0
  89. package/src/{v2/components/badge-v2.tsx → data-display/badge/badge.tsx} +6 -4
  90. package/src/{components → data-display/diff-changes}/diff-changes.css +22 -19
  91. package/src/{v2/components/diff-changes-v2.tsx → data-display/diff-changes/diff-changes.tsx} +7 -2
  92. package/src/{v2/components/keybind-v2.css → data-display/keybind/keybind.css} +1 -1
  93. package/src/{v2/components/keybind-v2.tsx → data-display/keybind/keybind.tsx} +3 -3
  94. package/src/{v2/components/line-comment-v2.css → data-display/line-comment/line-comment.css} +3 -3
  95. package/src/{v2/components/line-comment-v2.tsx → data-display/line-comment/line-comment.tsx} +17 -15
  96. package/src/{v2/components/project-avatar-v2.tsx → data-display/project-avatar/project-avatar.tsx} +1 -1
  97. package/src/{v2/components/loader-v2.tsx → feedback/loader/loader.tsx} +2 -2
  98. package/src/feedback/progress-circle/progress-circle.css +28 -0
  99. package/src/feedback/progress-circle/progress-circle.tsx +64 -0
  100. package/src/{v2/components/toast-v2.tsx → feedback/toast/toast.tsx} +60 -58
  101. package/src/{components → forms/checkbox}/checkbox.css +1 -7
  102. package/src/{components → forms/checkbox}/checkbox.tsx +13 -13
  103. package/src/{v2/components/field-v2.css → forms/field/field.css} +1 -1
  104. package/src/{v2/components/field-v2.tsx → forms/field/field.tsx} +9 -11
  105. package/src/{v2/components/radio-v2.tsx → forms/radio/radio.tsx} +30 -20
  106. package/src/{v2/components/select-v2.css → forms/select/select.css} +2 -8
  107. package/src/{v2/components/select-v2.tsx → forms/select/select.tsx} +38 -32
  108. package/src/{v2/components/switch-v2.css → forms/switch/switch.css} +110 -0
  109. package/src/forms/switch/switch.tsx +34 -0
  110. package/src/{v2/components/text-input-v2.css → forms/text-input/text-input.css} +1 -1
  111. package/src/{v2/components/text-input-v2.tsx → forms/text-input/text-input.tsx} +4 -4
  112. package/src/{v2/components/textarea-v2.tsx → forms/textarea/textarea.tsx} +3 -3
  113. package/src/hooks/create-auto-scroll.tsx +20 -0
  114. package/src/i18n/am.ts +1 -3
  115. package/src/i18n/ar.ts +1 -3
  116. package/src/i18n/az.ts +1 -3
  117. package/src/i18n/bg.ts +1 -3
  118. package/src/i18n/bn.ts +1 -3
  119. package/src/i18n/br.ts +1 -3
  120. package/src/i18n/bs.ts +1 -3
  121. package/src/i18n/ca.ts +1 -3
  122. package/src/i18n/cs.ts +1 -3
  123. package/src/i18n/da.ts +1 -3
  124. package/src/i18n/de.ts +1 -3
  125. package/src/i18n/dv.ts +1 -3
  126. package/src/i18n/dz.ts +1 -3
  127. package/src/i18n/el.ts +1 -3
  128. package/src/i18n/en.ts +40 -5
  129. package/src/i18n/es.ts +1 -3
  130. package/src/i18n/et.ts +1 -3
  131. package/src/i18n/fa.ts +1 -3
  132. package/src/i18n/fi.ts +1 -3
  133. package/src/i18n/fo.ts +1 -3
  134. package/src/i18n/fr.ts +1 -3
  135. package/src/i18n/he.ts +199 -0
  136. package/src/i18n/hi.ts +1 -3
  137. package/src/i18n/hr.ts +1 -3
  138. package/src/i18n/hu.ts +1 -3
  139. package/src/i18n/hy.ts +1 -3
  140. package/src/i18n/id.ts +1 -3
  141. package/src/i18n/is.ts +1 -3
  142. package/src/i18n/it.ts +1 -3
  143. package/src/i18n/ja.ts +1 -3
  144. package/src/i18n/ka.ts +1 -3
  145. package/src/i18n/km.ts +1 -3
  146. package/src/i18n/ko.ts +1 -3
  147. package/src/i18n/lo.ts +1 -3
  148. package/src/i18n/lt.ts +1 -3
  149. package/src/i18n/lv.ts +1 -3
  150. package/src/i18n/mk.ts +1 -3
  151. package/src/i18n/mn.ts +1 -3
  152. package/src/i18n/ms.ts +1 -3
  153. package/src/i18n/my.ts +1 -3
  154. package/src/i18n/ne.ts +1 -3
  155. package/src/i18n/nl.ts +1 -3
  156. package/src/i18n/no.ts +1 -3
  157. package/src/i18n/pa.ts +1 -3
  158. package/src/i18n/pl.ts +1 -3
  159. package/src/i18n/ro.ts +1 -3
  160. package/src/i18n/ru.ts +1 -3
  161. package/src/i18n/si.ts +1 -3
  162. package/src/i18n/sk.ts +1 -3
  163. package/src/i18n/sl.ts +1 -3
  164. package/src/i18n/sq.ts +1 -3
  165. package/src/i18n/sr.ts +1 -3
  166. package/src/i18n/sv.ts +1 -3
  167. package/src/i18n/tg.ts +1 -3
  168. package/src/i18n/th.ts +1 -3
  169. package/src/i18n/tk.ts +1 -3
  170. package/src/i18n/tr.ts +1 -3
  171. package/src/i18n/uk.ts +1 -3
  172. package/src/i18n/ur.ts +1 -3
  173. package/src/i18n/uz.ts +1 -3
  174. package/src/i18n/vi.ts +1 -3
  175. package/src/i18n/zh.ts +1 -3
  176. package/src/i18n/zht.ts +1 -3
  177. package/src/{components/icon.tsx → icons/icon/additional-icons.ts} +8 -74
  178. package/src/icons/icon/icon.css +3 -0
  179. package/src/{v2/components → icons/icon}/icon.tsx +50 -9
  180. package/src/{v2/components/divider-v2.tsx → layout/divider/divider.tsx} +3 -3
  181. package/src/{v2/components/menu-v2.css → navigation/menu/menu.css} +123 -2
  182. package/src/{v2/components/menu-v2.tsx → navigation/menu/menu.tsx} +96 -32
  183. package/src/{v2/components/segmented-control-v2.css → navigation/segmented-control/segmented-control.css} +1 -1
  184. package/src/{v2/components/segmented-control-v2.tsx → navigation/segmented-control/segmented-control.tsx} +9 -8
  185. package/src/{v2/components/tabs-v2.css → navigation/tabs/tabs-current.css} +25 -10
  186. package/src/{components → navigation/tabs}/tabs.css +39 -229
  187. package/src/navigation/tabs/tabs.tsx +194 -0
  188. package/src/{v2/components/dialog-v2.css → overlays/dialog/dialog.css} +3 -0
  189. package/src/{v2/components/dialog-v2.tsx → overlays/dialog/dialog.tsx} +11 -13
  190. package/src/{v2/components/tooltip-v2.css → overlays/tooltip/tooltip.css} +26 -0
  191. package/src/{v2/components/tooltip-v2.tsx → overlays/tooltip/tooltip.tsx} +24 -17
  192. package/src/styles/base.css +5 -0
  193. package/src/styles/index.css +4 -20
  194. package/src/styles/tailwind/colors.css +1 -0
  195. package/src/styles/tailwind/index.css +18 -1
  196. package/src/styles/theme.css +2 -2
  197. package/src/{v2/styles → styles/tokens}/theme.css +18 -14
  198. package/src/theme/context.tsx +19 -11
  199. package/src/theme/themes/oc-2.json +3 -1
  200. package/src/theme/v2/foreground.ts +1 -0
  201. package/src/theme/v2/mapping.ts +4 -0
  202. package/src/{components → typography/text-shimmer}/text-shimmer.css +2 -1
  203. package/src/{components → typography/text-shimmer}/text-shimmer.tsx +1 -0
  204. package/src/{v2/components/wordmark-v2.tsx → typography/wordmark/wordmark.tsx} +1 -1
  205. package/dist/components/avatar.d.ts +0 -9
  206. package/dist/components/button.d.ts +0 -9
  207. package/dist/components/dialog.d.ts +0 -12
  208. package/dist/components/dropdown-menu.d.ts +0 -80
  209. package/dist/components/icon-button.d.ts +0 -10
  210. package/dist/components/keybind.d.ts +0 -6
  211. package/dist/components/radio-group.d.ts +0 -16
  212. package/dist/components/select.d.ts +0 -21
  213. package/dist/components/tag.d.ts +0 -5
  214. package/dist/components/toast.d.ts +0 -56
  215. package/dist/components/tooltip.d.ts +0 -17
  216. package/dist/v2/components/accordion-v2.d.ts +0 -26
  217. package/dist/v2/components/badge-v2.d.ts +0 -6
  218. package/dist/v2/components/button-v2.d.ts +0 -10
  219. package/dist/v2/components/checkbox-v2.d.ts +0 -10
  220. package/dist/v2/components/diff-changes-v2.d.ts +0 -11
  221. package/dist/v2/components/divider-v2.d.ts +0 -5
  222. package/dist/v2/components/icon-button-v2.d.ts +0 -11
  223. package/dist/v2/components/inline-input-v2.d.ts +0 -21
  224. package/dist/v2/components/keybind-v2.d.ts +0 -7
  225. package/dist/v2/components/loader-v2.d.ts +0 -3
  226. package/dist/v2/components/menu-v2.d.ts +0 -52
  227. package/dist/v2/components/progress-circle-v2.d.ts +0 -8
  228. package/dist/v2/components/radio-v2.d.ts +0 -16
  229. package/dist/v2/components/split-button-v2.d.ts +0 -5
  230. package/dist/v2/components/switch-v2.d.ts +0 -7
  231. package/dist/v2/components/tabs-v2.d.ts +0 -34
  232. package/dist/v2/components/text-shimmer-v2.d.ts +0 -9
  233. package/dist/v2/components/textarea-v2.d.ts +0 -7
  234. package/dist/v2/components/toast-v2.d.ts +0 -57
  235. package/dist/v2/components/tooltip-v2.d.ts +0 -13
  236. package/dist/v2/components/wordmark-v2.d.ts +0 -2
  237. package/src/components/avatar.css +0 -49
  238. package/src/components/avatar.tsx +0 -55
  239. package/src/components/button.css +0 -194
  240. package/src/components/dialog.css +0 -181
  241. package/src/components/dialog.tsx +0 -72
  242. package/src/components/diff-changes.tsx +0 -115
  243. package/src/components/dropdown-menu.css +0 -135
  244. package/src/components/dropdown-menu.tsx +0 -308
  245. package/src/components/icon-button.css +0 -181
  246. package/src/components/icon-button.tsx +0 -29
  247. package/src/components/icon.css +0 -39
  248. package/src/components/keybind.css +0 -18
  249. package/src/components/keybind.tsx +0 -20
  250. package/src/components/progress-circle.css +0 -16
  251. package/src/components/progress-circle.tsx +0 -64
  252. package/src/components/radio-group.css +0 -187
  253. package/src/components/radio-group.tsx +0 -83
  254. package/src/components/select.css +0 -201
  255. package/src/components/select.tsx +0 -174
  256. package/src/components/switch.css +0 -136
  257. package/src/components/switch.tsx +0 -29
  258. package/src/components/tabs.tsx +0 -126
  259. package/src/components/tag.css +0 -37
  260. package/src/components/tag.tsx +0 -22
  261. package/src/components/toast.css +0 -236
  262. package/src/components/toast.tsx +0 -185
  263. package/src/components/tooltip.css +0 -74
  264. package/src/components/tooltip.tsx +0 -163
  265. package/src/v2/components/accordion-v2.css +0 -139
  266. package/src/v2/components/accordion-v2.tsx +0 -86
  267. package/src/v2/components/button-v2.tsx +0 -35
  268. package/src/v2/components/checkbox-v2.css +0 -184
  269. package/src/v2/components/checkbox-v2.tsx +0 -65
  270. package/src/v2/components/diff-changes-v2.css +0 -26
  271. package/src/v2/components/icon-button-v2.tsx +0 -37
  272. package/src/v2/components/inline-input-v2.css +0 -225
  273. package/src/v2/components/inline-input-v2.tsx +0 -107
  274. package/src/v2/components/progress-circle-v2.css +0 -13
  275. package/src/v2/components/progress-circle-v2.tsx +0 -52
  276. package/src/v2/components/switch-v2.tsx +0 -28
  277. package/src/v2/components/tabs-v2.tsx +0 -149
  278. package/src/v2/components/text-shimmer-v2.css +0 -125
  279. package/src/v2/components/text-shimmer-v2.tsx +0 -63
  280. /package/dist/{components → forms/inline-input}/inline-input.d.ts +0 -0
  281. /package/dist/{v2/components → navigation}/tab-state-indicator.d.ts +0 -0
  282. /package/src/{v2/components/button-v2.css → actions/button/button.css} +0 -0
  283. /package/src/{v2/components/icon-button-v2.css → actions/icon-button/icon-button.css} +0 -0
  284. /package/src/{v2/components/avatar-v2.css → data-display/avatar/avatar.css} +0 -0
  285. /package/src/{v2/components/project-avatar-v2.css → data-display/project-avatar/project-avatar.css} +0 -0
  286. /package/src/{v2/components/loader-v2.css → feedback/loader/loader.css} +0 -0
  287. /package/src/{v2/components/toast-v2.css → feedback/toast/toast.css} +0 -0
  288. /package/src/{components → forms/inline-input}/inline-input.css +0 -0
  289. /package/src/{components → forms/inline-input}/inline-input.tsx +0 -0
  290. /package/src/{v2/components/radio-v2.css → forms/radio/radio.css} +0 -0
  291. /package/src/{v2/components/textarea-v2.css → forms/textarea/textarea.css} +0 -0
  292. /package/src/{v2/components/divider-v2.css → layout/divider/divider.css} +0 -0
  293. /package/src/{v2/components → navigation}/tab-state-indicator.tsx +0 -0
  294. /package/src/{v2/components/file-tree-v2.css → styles/file-tree.css} +0 -0
  295. /package/src/{v2/styles → styles/tokens}/colors.css +0 -0
  296. /package/src/{v2/styles/tailwind.css → styles/tokens/index.css} +0 -0
@@ -1,5 +1,8 @@
1
1
  import { onMount, type ComponentProps, splitProps } from "solid-js"
2
+ import { additionalIcons, additionalIconViewBox } from "./additional-icons"
3
+ import "./icon.css"
2
4
 
5
+ // Consumers center the SVG viewport, so each icon must center its artwork within its viewBox.
3
6
  const icons = {
4
7
  edit: {
5
8
  viewBox: "0 0 16 16",
@@ -17,6 +20,10 @@ const icons = {
17
20
  viewBox: "0 0 16 16",
18
21
  body: `<path d="M5.118 5.686V10.314M5.118 5.686C5.97 5.686 6.661 4.995 6.661 4.143C6.661 3.291 5.97 2.6 5.118 2.6C4.266 2.6 3.575 3.291 3.575 4.143C3.575 4.995 4.266 5.686 5.118 5.686ZM5.118 10.314C4.266 10.314 3.575 11.005 3.575 11.857C3.575 12.709 4.266 13.4 5.118 13.4C5.97 13.4 6.661 12.709 6.661 11.857M5.118 10.314C5.97 10.314 6.661 11.005 6.661 11.857M10.882 5.686C11.734 5.686 12.425 4.995 12.425 4.143C12.425 3.291 11.734 2.6 10.882 2.6C10.03 2.6 9.339 3.291 9.339 4.143C9.339 4.995 10.03 5.686 10.882 5.686ZM10.882 5.686V9.457C10.882 10.783 9.807 11.857 8.482 11.857H6.661" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>`,
19
22
  },
23
+ "branch-out": {
24
+ viewBox: "0 0 16 16",
25
+ body: `<path d="M10.4225 3.35355L12.9024 5.83344L10.4225 8.31333" stroke="currentColor"/><path d="M1 12.2852H4.23042C4.89912 12.2852 5.52359 11.951 5.89452 11.3946L9.00783 6.72462C8.37877 6.16823 10.0032 5.83402 10.6719 5.83402H12.9024" stroke="currentColor"/><path d="M8.5 12.2852H14" stroke="currentColor" stroke-linejoin="round"/>`,
26
+ },
20
27
  "grid-plus": {
21
28
  viewBox: "0 0 16 16",
22
29
  body: `<path d="M13.9948 11.668H9.32812M11.6641 9.33203V13.9987M6.66667 9.33203V13.9987H2V9.33203H6.66667ZM6.66667 2V6.66667H2V2H6.66667ZM13.9948 2V6.66667H9.32812V2H13.9948Z" stroke="currentColor" stroke-miterlimit="10" stroke-linecap="square"/>`,
@@ -25,6 +32,10 @@ const icons = {
25
32
  viewBox: "0 0 16 16",
26
33
  body: `<path d="M6.33345 6.33349V5.00015H9.66679V7.00015L8.00015 8.00015V9.66679M8.27485 11.6819H7.71897M14.4446 8.00011C14.4446 11.5593 11.5593 14.4446 8.00011 14.4446C4.44094 14.4446 1.55566 11.5593 1.55566 8.00011C1.55566 4.44094 4.44094 1.55566 8.00011 1.55566C11.5593 1.55566 14.4446 4.44094 14.4446 8.00011Z" stroke="currentColor" stroke-linecap="square"/>`,
27
34
  },
35
+ "circle-exclamation": {
36
+ viewBox: "0 0 16 16",
37
+ body: `<path d="M8.75 11.75H7.25V10.25H8.75V11.75Z" fill="currentColor"/><path d="M8.75 9.25H7.25V4.25H8.75V9.25Z" fill="currentColor"/><path fill-rule="evenodd" clip-rule="evenodd" d="M8 1C9.93286 1 11.684 1.7836 12.9502 3.0498C14.2164 4.31601 15 6.06714 15 8C15 11.866 11.866 15 8 15C6.06714 15 4.31601 14.2164 3.0498 12.9502C1.7836 11.684 1 9.93286 1 8C1 4.13401 4.13401 1 8 1ZM8 2C4.68629 2 2 4.68629 2 8C2 9.65699 2.67148 11.1559 3.75781 12.2422C4.84415 13.3285 6.34301 14 8 14C11.3137 14 14 11.3137 14 8C14 6.34301 13.3285 4.84415 12.2422 3.75781C11.1559 2.67148 9.65699 2 8 2Z" fill="currentColor"/>`,
38
+ },
28
39
  "sidebar-right": {
29
40
  viewBox: "0 0 20 20",
30
41
  body: `<path d="M2.91536 2.91406H2.36536V2.36406H2.91536V2.91406ZM2.91536 17.0807V17.6307H2.36536V17.0807H2.91536ZM17.082 17.0807H17.632V17.6307H17.082V17.0807ZM17.082 2.91406V2.36406H17.632V2.91406H17.082ZM6.9987 2.91406H6.4487V2.36406H6.9987V2.91406ZM6.9987 17.0807V17.6307H6.4487V17.0807H6.9987ZM2.91536 2.91406H3.46536V17.0807H2.91536H2.36536V2.91406H2.91536ZM2.91536 17.0807V16.5307H17.082V17.0807V17.6307H2.91536V17.0807ZM17.082 17.0807H16.532V2.91406H17.082H17.632V17.0807H17.082ZM17.082 2.91406V3.46406H2.91536V2.91406V2.36406H17.082V2.91406ZM6.9987 2.91406H7.5487V17.0807H6.9987H6.4487V2.91406H6.9987ZM17.082 17.0807L17.082 17.6307L6.9987 17.6307V17.0807V16.5307L17.082 16.5307L17.082 17.0807ZM6.9987 2.91406V2.36406H17.082V2.91406V3.46406H6.9987V2.91406Z" fill="currentColor"/>`,
@@ -121,6 +132,14 @@ const icons = {
121
132
  viewBox: "0 0 20 20",
122
133
  body: `<path d="M7 14.5H13M7 7.99512H10.0049M10.0049 7.99512H13M10.0049 7.99512V5M10.0049 7.99512V11M18 18V2L2 2L2 18H18Z" stroke="currentColor"/>`,
123
134
  },
135
+ "window-analytics": {
136
+ viewBox: "0 0 16 16",
137
+ body: `<g transform="translate(1 2)"><path d="M7 4H11M7 8H11M0.5 0.5V11.5H13.5V0.5H0.5ZM3.5 3.5H4.5V4.5H3.5V3.5ZM3.5 7.5H4.5V8.5H3.5V7.5Z" stroke="currentColor" stroke-miterlimit="10" stroke-linecap="square"/></g>`,
138
+ },
139
+ trash: {
140
+ viewBox: "0 0 20 20",
141
+ body: `<path d="M4.58342 17.9134L4.58369 17.4134L4.22787 17.5384L4.22766 18.0384H4.58342V17.9134ZM15.4167 17.9134V18.0384H15.7725L15.7723 17.5384L15.4167 17.9134ZM2.08342 3.95508V3.45508H1.58342V3.95508H2.08342V4.45508V3.95508ZM17.9167 4.45508V4.95508H18.4167V4.45508H17.9167V3.95508V4.45508ZM4.16677 4.58008L3.66701 4.5996L4.22816 17.5379L4.72792 17.4934L5.22767 17.4489L4.66652 4.54055L4.16677 4.58008ZM4.58342 18.0384V17.9134H15.4167V18.0384V18.5384H4.58342V18.0384ZM15.4167 17.9134L15.8332 17.5379L16.2498 4.5996L15.7501 4.58008L15.2503 4.56055L14.8337 17.4989L15.4167 17.9134ZM15.8334 4.58008V4.08008H4.16677V4.58008V5.08008H15.8334V4.58008ZM2.08342 4.45508V4.95508H4.16677V4.58008V4.08008H2.08342V4.45508ZM15.8334 4.58008V5.08008H17.9167V4.45508V3.95508H15.8334V4.58008ZM6.83951 4.35149L7.432 4.55047C7.79251 3.47701 8.80699 2.70508 10.0001 2.70508V2.20508V1.70508C8.25392 1.70508 6.77335 2.83539 6.24702 4.15251L6.83951 4.35149ZM10.0001 2.20508V2.70508C11.1932 2.70508 12.2077 3.47701 12.5682 4.55047L13.1607 4.35149L13.7532 4.15251C13.2269 2.83539 11.7463 1.70508 10.0001 1.70508V2.20508Z" fill="currentColor"/>`,
142
+ },
124
143
  "outline-sliders": {
125
144
  viewBox: "0 0 16 16",
126
145
  body: `<path d="M11.7779 4.66675H14.4446M11.7779 4.66675C11.7779 5.77132 10.8825 6.66675 9.77789 6.66675C8.67332 6.66675 7.77789 5.77132 7.77789 4.66675M11.7779 4.66675C11.7779 3.56218 10.8825 2.66675 9.77789 2.66675C8.67332 2.66675 7.77789 3.56218 7.77789 4.66675M1.55566 4.66675H7.77789M4.22233 11.3334H1.55566M4.22233 11.3334C4.22233 12.438 5.11776 13.3334 6.22233 13.3334C7.3269 13.3334 8.22233 12.438 8.22233 11.3334M4.22233 11.3334C4.22233 10.2288 5.11776 9.33341 6.22233 9.33341C7.3269 9.33341 8.22233 10.2288 8.22233 11.3334M14.4446 11.3334H8.22233" stroke="currentColor"/>`,
@@ -145,16 +164,29 @@ const icons = {
145
164
  viewBox: "0 0 20 20",
146
165
  body: `<path d="M5.83333 4.16406L2.5 7.4974L5.83333 10.8307M3.33333 7.4974H17.9167V15.4141H10" stroke="currentColor" stroke-linecap="square"/>`,
147
166
  },
167
+ "fill-triangle-down": {
168
+ viewBox: "0 0 16 16",
169
+ body: `<path d="M5.37624 6.75194C5.1818 6.41861 5.42223 6 5.80813 6H10.1921C10.578 6 10.8184 6.41861 10.624 6.75194L8.43199 10.5096C8.23905 10.8404 7.76115 10.8404 7.56821 10.5096L5.37624 6.75194Z" fill="currentColor"/>`,
170
+ },
148
171
  archive: {
149
172
  viewBox: "0 0 16 16",
150
173
  body: `<path d="M13.1112 13.5555V14.0555H13.6112V13.5555H13.1112ZM2.889 13.5555H2.389L2.389 14.0555H2.889V13.5555ZM3.38901 5.55546L3.38901 5.05546L2.38901 5.05546L2.38901 5.55546L2.88901 5.55546L3.38901 5.55546ZM14.4446 2.44434H14.9446V1.94434L14.4446 1.94434L14.4446 2.44434ZM14.4446 5.55545L14.4446 6.05545L14.9446 6.05545V5.55545H14.4446ZM1.55566 5.55546L1.05566 5.55545L1.05566 6.05546L1.55566 6.05546L1.55566 5.55546ZM1.5557 2.44436L1.5557 1.94436L1.05571 1.94436L1.0557 2.44435L1.5557 2.44436ZM13.1112 5.55546H12.6112V13.5555H13.1112H13.6112V5.55546H13.1112ZM2.889 13.5555H3.389L3.38901 5.55546L2.88901 5.55546L2.38901 5.55546L2.389 13.5555H2.889ZM14.4446 2.44434H13.9446V5.55545H14.4446H14.9446V2.44434H14.4446ZM1.55566 5.55546L2.05566 5.55547L2.0557 2.44436L1.5557 2.44436L1.0557 2.44435L1.05566 5.55545L1.55566 5.55546ZM6.22234 8.22213V8.72213H9.7779V8.22213V7.72213H6.22234V8.22213ZM13.1112 13.5555V13.0555H2.889V13.5555V14.0555H13.1112V13.5555ZM1.5557 2.44436L1.5557 2.94436L14.4446 2.94434L14.4446 2.44434L14.4446 1.94434L1.5557 1.94436L1.5557 2.44436ZM14.4446 5.55545L14.4446 5.05545L1.55566 5.05546L1.55566 5.55546L1.55566 6.05546L14.4446 6.05545L14.4446 5.55545Z" fill="currentColor"/>`,
151
174
  },
152
175
  }
153
176
 
177
+ type IconName = keyof typeof icons | keyof typeof additionalIcons
178
+
154
179
  const spriteID = "opencode-v2-icon-sprite"
155
- const symbol = (name: keyof typeof icons) => `opencode-v2-icon-${name}`
180
+ const symbol = (name: IconName) => `opencode-v2-icon-${name}`
156
181
  let spriteInserted = false
157
182
 
183
+ function getIcon(name: IconName) {
184
+ const icon = icons[name as keyof typeof icons]
185
+ if (icon) return icon
186
+ const body = additionalIcons[name as keyof typeof additionalIcons]
187
+ return { body, viewBox: additionalIconViewBox(name as keyof typeof additionalIcons) }
188
+ }
189
+
158
190
  function ensureSprite() {
159
191
  if (spriteInserted) return
160
192
  if (typeof document === "undefined") return
@@ -170,25 +202,26 @@ function ensureSprite() {
170
202
  svg.setAttribute("height", "0")
171
203
  svg.style.position = "absolute"
172
204
  svg.style.overflow = "hidden"
173
- svg.innerHTML = Object.entries(icons)
174
- .map(
175
- ([name, icon]) =>
176
- `<symbol id="${symbol(name as keyof typeof icons)}" viewBox="${icon.viewBox}">${icon.body}</symbol>`,
177
- )
205
+ svg.innerHTML = Array.from(new Set<IconName>([...Object.keys(additionalIcons), ...Object.keys(icons)] as IconName[]))
206
+ .map((name) => `<symbol id="${symbol(name)}" viewBox="${getIcon(name).viewBox}">${getIcon(name).body}</symbol>`)
178
207
  .join("")
179
208
  document.body.insertBefore(svg, document.body.firstChild)
180
209
  spriteInserted = true
181
210
  }
182
211
 
183
212
  export interface IconProps extends ComponentProps<"svg"> {
184
- name: keyof typeof icons | (string & {})
213
+ name: IconName | (string & {})
185
214
  size?: "small" | "normal" | "large"
186
215
  }
187
216
 
188
217
  export function Icon(props: IconProps) {
189
218
  const [split, rest] = splitProps(props, ["name", "size"])
190
- const iconName = () => (icons[split.name as keyof typeof icons] ? (split.name as keyof typeof icons) : "plus")
191
- const icon = () => icons[iconName()]
219
+ const iconName = (): IconName => {
220
+ if (icons[split.name as keyof typeof icons]) return split.name as keyof typeof icons
221
+ if (additionalIcons[split.name as keyof typeof additionalIcons]) return split.name as keyof typeof additionalIcons
222
+ return "plus"
223
+ }
224
+ const icon = () => getIcon(iconName())
192
225
  const pixelSize = split.size === "small" ? 14 : split.size === "large" ? 20 : 16
193
226
  onMount(ensureSprite)
194
227
 
@@ -196,6 +229,14 @@ export function Icon(props: IconProps) {
196
229
  <svg
197
230
  {...rest}
198
231
  data-slot="icon-svg"
232
+ data-directional={
233
+ iconName() === "arrow-left" ||
234
+ iconName() === "arrow-right" ||
235
+ iconName() === "chevron-left" ||
236
+ iconName() === "chevron-right"
237
+ ? ""
238
+ : undefined
239
+ }
199
240
  width={pixelSize}
200
241
  height={pixelSize}
201
242
  viewBox={icon().viewBox}
@@ -1,9 +1,9 @@
1
1
  import { type ComponentProps, splitProps } from "solid-js"
2
- import "./divider-v2.css"
2
+ import "./divider.css"
3
3
 
4
- export interface DividerV2Props extends ComponentProps<"div"> {}
4
+ export interface DividerProps extends ComponentProps<"div"> {}
5
5
 
6
- export function DividerV2(props: DividerV2Props) {
6
+ export function Divider(props: DividerProps) {
7
7
  const [local, rest] = splitProps(props, ["class", "classList"])
8
8
  return (
9
9
  <div
@@ -31,6 +31,10 @@
31
31
  }
32
32
  }
33
33
 
34
+ :dir(rtl) [data-slot="menu-v2-item-chevron"] {
35
+ transform: scaleX(-1);
36
+ }
37
+
34
38
  [data-component="menu-v2-item"] {
35
39
  --menu-v2-fg: var(--v2-text-text-base);
36
40
  --menu-v2-fg-muted: var(--v2-text-text-faint);
@@ -47,6 +51,7 @@
47
51
 
48
52
  box-sizing: border-box;
49
53
  display: flex;
54
+ flex-shrink: 0;
50
55
  flex-direction: row;
51
56
  align-items: center;
52
57
  gap: 8px;
@@ -72,7 +77,7 @@
72
77
 
73
78
  font-size: 13px;
74
79
  font-weight: 440;
75
- line-height: 100%;
80
+ line-height: var(--line-height-compact);
76
81
  letter-spacing: -0.04px;
77
82
  color: var(--menu-v2-fg);
78
83
  }
@@ -171,13 +176,129 @@
171
176
 
172
177
  font-size: 11px;
173
178
  font-weight: 530;
174
- line-height: 100%;
175
179
  letter-spacing: 0.05px;
176
180
  color: var(--v2-text-text-faint);
177
181
  user-select: none;
178
182
  font-variant-numeric: tabular-nums;
179
183
  }
180
184
 
185
+ [data-component="menu-v2-content"][data-appearance="standard"] {
186
+ min-width: 8rem;
187
+ padding: 4px;
188
+ overflow: hidden;
189
+ border: 1px solid color-mix(in oklch, var(--border-base) 50%, transparent);
190
+ border-radius: var(--radius-md);
191
+ background: var(--surface-raised-stronger-non-alpha);
192
+ background-clip: padding-box;
193
+ box-shadow: var(--shadow-md);
194
+ z-index: 60;
195
+ animation: dropdown-menu-open 150ms ease-out;
196
+
197
+ &[data-closed] {
198
+ animation: dropdown-menu-close 150ms ease-out;
199
+ }
200
+
201
+ [data-component="menu-v2-item"] {
202
+ position: relative;
203
+ height: auto;
204
+ min-height: 0;
205
+ padding: 4px 8px;
206
+ border-radius: var(--radius-sm);
207
+ color: var(--text-strong);
208
+ font-family: var(--font-family-sans);
209
+ font-size: var(--font-size-small);
210
+ font-weight: var(--font-weight-medium);
211
+ line-height: var(--line-height-large);
212
+ letter-spacing: var(--letter-spacing-normal);
213
+ font-variant-numeric: normal;
214
+ -webkit-font-smoothing: auto;
215
+ text-rendering: auto;
216
+
217
+ [data-slot="menu-v2-item-content"] {
218
+ font-family: inherit;
219
+ font-size: inherit;
220
+ font-weight: inherit;
221
+ line-height: inherit;
222
+ letter-spacing: inherit;
223
+ color: inherit;
224
+ }
225
+
226
+ &[data-highlighted] {
227
+ background: var(--surface-raised-base-hover);
228
+ }
229
+
230
+ &[data-disabled] {
231
+ color: var(--text-weak);
232
+ opacity: 1;
233
+ }
234
+
235
+ &[data-checked] {
236
+ padding-inline-end: 28px;
237
+ }
238
+
239
+ &[data-checked] [data-slot="menu-v2-item-content"] {
240
+ font-weight: inherit;
241
+ color: inherit;
242
+ }
243
+
244
+ [data-slot="menu-v2-item-indicator"] {
245
+ position: absolute;
246
+ inset-inline-end: 8px;
247
+ top: 50%;
248
+ width: 16px;
249
+ height: 16px;
250
+ transform: translateY(-50%);
251
+ color: var(--icon-base);
252
+ }
253
+
254
+ [data-slot="menu-v2-item-chevron"] {
255
+ margin-inline-start: auto;
256
+ color: var(--icon-base);
257
+ }
258
+ }
259
+
260
+ [data-slot="menu-v2-separator"] {
261
+ width: calc(100% + 8px);
262
+ height: 1px;
263
+ margin: 4px -4px;
264
+ background: var(--border-weak-base);
265
+ }
266
+
267
+ [data-slot="menu-v2-group-label"] {
268
+ height: auto;
269
+ padding: 4px 8px;
270
+ color: var(--text-weak);
271
+ font-family: var(--font-family-sans);
272
+ font-size: var(--font-size-x-small);
273
+ font-weight: var(--font-weight-medium);
274
+ line-height: var(--line-height-large);
275
+ letter-spacing: var(--letter-spacing-normal);
276
+ font-variant-numeric: normal;
277
+ }
278
+ }
279
+
280
+ @keyframes dropdown-menu-open {
281
+ from {
282
+ opacity: 0;
283
+ transform: scale(0.96);
284
+ }
285
+ to {
286
+ opacity: 1;
287
+ transform: scale(1);
288
+ }
289
+ }
290
+
291
+ @keyframes dropdown-menu-close {
292
+ from {
293
+ opacity: 1;
294
+ transform: scale(1);
295
+ }
296
+ to {
297
+ opacity: 0;
298
+ transform: scale(0.96);
299
+ }
300
+ }
301
+
181
302
  @keyframes menu-v2-in {
182
303
  from {
183
304
  opacity: 0;
@@ -1,7 +1,17 @@
1
1
  import { DropdownMenu } from "@kobalte/core/dropdown-menu"
2
2
  import { ContextMenu } from "@kobalte/core/context-menu"
3
- import { Show, splitProps, type Component, type ComponentProps, type JSX, type ParentProps } from "solid-js"
4
- import "./menu-v2.css"
3
+ import {
4
+ createContext,
5
+ Show,
6
+ splitProps,
7
+ useContext,
8
+ type Accessor,
9
+ type Component,
10
+ type ComponentProps,
11
+ type JSX,
12
+ type ParentProps,
13
+ } from "solid-js"
14
+ import "./menu.css"
5
15
 
6
16
  const ChevronRight: Component = () => (
7
17
  <svg
@@ -29,6 +39,18 @@ const CheckMark: Component = () => (
29
39
  </svg>
30
40
  )
31
41
 
42
+ export type MenuAppearance = "standard" | "compact"
43
+
44
+ const MenuAppearanceContext = createContext<{ appearance: Accessor<MenuAppearance> }>({
45
+ appearance: (): MenuAppearance => "compact",
46
+ })
47
+
48
+ function useMenuContext() {
49
+ const ctx = useContext(MenuAppearanceContext)
50
+ if (!ctx) throw new Error("Menu components must be used inside Menu or Menu.Context")
51
+ return ctx
52
+ }
53
+
32
54
  function ItemBody(
33
55
  props: ParentProps<{
34
56
  shortcut?: JSX.Element | string
@@ -46,15 +68,21 @@ function ItemBody(
46
68
  )
47
69
  }
48
70
 
49
- export interface MenuV2ItemProps extends ComponentProps<typeof DropdownMenu.Item> {
71
+ export interface MenuItemProps extends ComponentProps<typeof DropdownMenu.Item> {
50
72
  shortcut?: JSX.Element | string
51
73
  badge?: JSX.Element | string
52
74
  }
53
75
 
54
- function MenuV2Item(props: ParentProps<MenuV2ItemProps>) {
76
+ function MenuItem(props: ParentProps<MenuItemProps>) {
77
+ const ctx = useMenuContext()
55
78
  const [s, r] = splitProps(props, ["class", "classList", "children", "shortcut", "badge"])
56
79
  return (
57
- <DropdownMenu.Item {...r} data-component="menu-v2-item" classList={{ ...s.classList, [s.class ?? ""]: !!s.class }}>
80
+ <DropdownMenu.Item
81
+ {...r}
82
+ data-component="menu-v2-item"
83
+ data-appearance={ctx.appearance()}
84
+ classList={{ ...s.classList, [s.class ?? ""]: !!s.class }}
85
+ >
58
86
  <ItemBody shortcut={s.shortcut} badge={s.badge}>
59
87
  {s.children}
60
88
  </ItemBody>
@@ -62,17 +90,19 @@ function MenuV2Item(props: ParentProps<MenuV2ItemProps>) {
62
90
  )
63
91
  }
64
92
 
65
- export interface MenuV2CheckboxItemProps extends ComponentProps<typeof DropdownMenu.CheckboxItem> {
93
+ export interface MenuCheckboxItemProps extends ComponentProps<typeof DropdownMenu.CheckboxItem> {
66
94
  shortcut?: JSX.Element | string
67
95
  badge?: JSX.Element | string
68
96
  }
69
97
 
70
- function MenuV2CheckboxItem(props: ParentProps<MenuV2CheckboxItemProps>) {
98
+ function MenuCheckboxItem(props: ParentProps<MenuCheckboxItemProps>) {
99
+ const ctx = useMenuContext()
71
100
  const [s, r] = splitProps(props, ["class", "classList", "children", "shortcut", "badge"])
72
101
  return (
73
102
  <DropdownMenu.CheckboxItem
74
103
  {...r}
75
104
  data-component="menu-v2-item"
105
+ data-appearance={ctx.appearance()}
76
106
  classList={{ ...s.classList, [s.class ?? ""]: !!s.class }}
77
107
  >
78
108
  <ItemBody
@@ -90,17 +120,19 @@ function MenuV2CheckboxItem(props: ParentProps<MenuV2CheckboxItemProps>) {
90
120
  )
91
121
  }
92
122
 
93
- export interface MenuV2RadioItemProps extends ComponentProps<typeof DropdownMenu.RadioItem> {
123
+ export interface MenuRadioItemProps extends ComponentProps<typeof DropdownMenu.RadioItem> {
94
124
  shortcut?: JSX.Element | string
95
125
  badge?: JSX.Element | string
96
126
  }
97
127
 
98
- function MenuV2RadioItem(props: ParentProps<MenuV2RadioItemProps>) {
128
+ function MenuRadioItem(props: ParentProps<MenuRadioItemProps>) {
129
+ const ctx = useMenuContext()
99
130
  const [s, r] = splitProps(props, ["class", "classList", "children", "shortcut", "badge"])
100
131
  return (
101
132
  <DropdownMenu.RadioItem
102
133
  {...r}
103
134
  data-component="menu-v2-item"
135
+ data-appearance={ctx.appearance()}
104
136
  classList={{ ...s.classList, [s.class ?? ""]: !!s.class }}
105
137
  >
106
138
  <ItemBody
@@ -118,17 +150,19 @@ function MenuV2RadioItem(props: ParentProps<MenuV2RadioItemProps>) {
118
150
  )
119
151
  }
120
152
 
121
- export interface MenuV2SubTriggerProps extends ComponentProps<typeof DropdownMenu.SubTrigger> {
153
+ export interface MenuSubTriggerProps extends ComponentProps<typeof DropdownMenu.SubTrigger> {
122
154
  shortcut?: JSX.Element | string
123
155
  badge?: JSX.Element | string
124
156
  }
125
157
 
126
- function MenuV2SubTrigger(props: ParentProps<MenuV2SubTriggerProps>) {
158
+ function MenuSubTrigger(props: ParentProps<MenuSubTriggerProps>) {
159
+ const ctx = useMenuContext()
127
160
  const [s, r] = splitProps(props, ["class", "classList", "children", "shortcut", "badge"])
128
161
  return (
129
162
  <DropdownMenu.SubTrigger
130
163
  {...r}
131
164
  data-component="menu-v2-item"
165
+ data-appearance={ctx.appearance()}
132
166
  classList={{ ...s.classList, [s.class ?? ""]: !!s.class }}
133
167
  >
134
168
  <ItemBody shortcut={s.shortcut} badge={s.badge} trailing={<ChevronRight />}>
@@ -138,88 +172,118 @@ function MenuV2SubTrigger(props: ParentProps<MenuV2SubTriggerProps>) {
138
172
  )
139
173
  }
140
174
 
141
- function MenuV2SubContent(props: ComponentProps<typeof DropdownMenu.SubContent>) {
175
+ function MenuSubContent(props: ComponentProps<typeof DropdownMenu.SubContent>) {
176
+ const ctx = useMenuContext()
142
177
  const [s, r] = splitProps(props, ["class", "classList"])
143
178
  return (
144
179
  <DropdownMenu.SubContent
145
180
  {...r}
146
181
  data-component="menu-v2-content"
182
+ data-appearance={ctx.appearance()}
147
183
  classList={{ ...s.classList, [s.class ?? ""]: !!s.class }}
148
184
  />
149
185
  )
150
186
  }
151
187
 
152
- function MenuV2GroupLabel(props: ComponentProps<typeof DropdownMenu.GroupLabel>) {
188
+ function MenuGroupLabel(props: ComponentProps<typeof DropdownMenu.GroupLabel>) {
189
+ const ctx = useMenuContext()
153
190
  const [s, r] = splitProps(props, ["class", "classList"])
154
191
  return (
155
192
  <DropdownMenu.GroupLabel
156
193
  {...r}
157
194
  data-slot="menu-v2-group-label"
195
+ data-appearance={ctx.appearance()}
158
196
  classList={{ ...s.classList, [s.class ?? ""]: !!s.class }}
159
197
  />
160
198
  )
161
199
  }
162
200
 
163
- function MenuV2Separator(props: ComponentProps<typeof DropdownMenu.Separator>) {
201
+ function MenuSeparator(props: ComponentProps<typeof DropdownMenu.Separator>) {
202
+ const ctx = useMenuContext()
164
203
  const [s, r] = splitProps(props, ["class", "classList"])
165
204
  return (
166
205
  <DropdownMenu.Separator
167
206
  {...r}
168
207
  data-slot="menu-v2-separator"
208
+ data-appearance={ctx.appearance()}
169
209
  classList={{ ...s.classList, [s.class ?? ""]: !!s.class }}
170
210
  />
171
211
  )
172
212
  }
173
213
 
174
- function MenuV2Content(props: ComponentProps<typeof DropdownMenu.Content>) {
214
+ function MenuContent(props: ComponentProps<typeof DropdownMenu.Content>) {
215
+ const ctx = useMenuContext()
175
216
  const [s, r] = splitProps(props, ["class", "classList"])
176
217
  return (
177
218
  <DropdownMenu.Content
178
219
  {...r}
179
220
  data-component="menu-v2-content"
221
+ data-appearance={ctx.appearance()}
180
222
  classList={{ ...s.classList, [s.class ?? ""]: !!s.class }}
181
223
  />
182
224
  )
183
225
  }
184
226
 
185
- function MenuV2Root(props: ComponentProps<typeof DropdownMenu>) {
186
- return <DropdownMenu {...props} />
227
+ export interface MenuProps extends ComponentProps<typeof DropdownMenu> {
228
+ appearance?: MenuAppearance
187
229
  }
188
230
 
189
- function MenuV2ContextRoot(props: ComponentProps<typeof ContextMenu>) {
190
- return <ContextMenu {...props} />
231
+ function MenuRoot(props: MenuProps) {
232
+ const [local, rest] = splitProps(props, ["appearance", "children"])
233
+ const appearance = () => local.appearance ?? "compact"
234
+ return (
235
+ <MenuAppearanceContext.Provider value={{ appearance }}>
236
+ <DropdownMenu {...rest}>{local.children}</DropdownMenu>
237
+ </MenuAppearanceContext.Provider>
238
+ )
239
+ }
240
+
241
+ export interface MenuContextProps extends ComponentProps<typeof ContextMenu> {
242
+ appearance?: MenuAppearance
243
+ }
244
+
245
+ function MenuContextRoot(props: MenuContextProps) {
246
+ const [local, rest] = splitProps(props, ["appearance", "children"])
247
+ const appearance = () => local.appearance ?? "compact"
248
+ return (
249
+ <MenuAppearanceContext.Provider value={{ appearance }}>
250
+ <ContextMenu {...rest}>{local.children}</ContextMenu>
251
+ </MenuAppearanceContext.Provider>
252
+ )
191
253
  }
192
254
 
193
- function MenuV2ContextContent(props: ComponentProps<typeof ContextMenu.Content>) {
255
+ function MenuContextContent(props: ComponentProps<typeof ContextMenu.Content>) {
256
+ const ctx = useMenuContext()
194
257
  const [s, r] = splitProps(props, ["class", "classList"])
195
258
  return (
196
259
  <ContextMenu.Content
197
260
  {...r}
198
261
  data-component="menu-v2-content"
262
+ data-appearance={ctx.appearance()}
199
263
  classList={{ ...s.classList, [s.class ?? ""]: !!s.class }}
200
264
  />
201
265
  )
202
266
  }
203
267
 
204
- const MenuV2Context = Object.assign(MenuV2ContextRoot, {
268
+ const MenuContext = Object.assign(MenuContextRoot, {
205
269
  Trigger: ContextMenu.Trigger,
206
270
  Portal: ContextMenu.Portal,
207
- Content: MenuV2ContextContent,
271
+ Content: MenuContextContent,
208
272
  })
209
273
 
210
- export const MenuV2 = Object.assign(MenuV2Root, {
274
+ export const Menu = Object.assign(MenuRoot, {
211
275
  Trigger: DropdownMenu.Trigger,
212
276
  Portal: DropdownMenu.Portal,
213
- Content: MenuV2Content,
214
- Item: MenuV2Item,
215
- CheckboxItem: MenuV2CheckboxItem,
277
+ Content: MenuContent,
278
+ Item: MenuItem,
279
+ CheckboxItem: MenuCheckboxItem,
216
280
  RadioGroup: DropdownMenu.RadioGroup,
217
- RadioItem: MenuV2RadioItem,
281
+ RadioItem: MenuRadioItem,
218
282
  Group: DropdownMenu.Group,
219
- GroupLabel: MenuV2GroupLabel,
220
- Separator: MenuV2Separator,
283
+ GroupLabel: MenuGroupLabel,
284
+ Separator: MenuSeparator,
221
285
  Sub: DropdownMenu.Sub,
222
- SubTrigger: MenuV2SubTrigger,
223
- SubContent: MenuV2SubContent,
224
- Context: MenuV2Context,
286
+ SubTrigger: MenuSubTrigger,
287
+ SubContent: MenuSubContent,
288
+ Context: MenuContext,
225
289
  })
@@ -37,7 +37,7 @@
37
37
  font-style: normal;
38
38
  font-weight: 440;
39
39
  font-size: 13px;
40
- line-height: 100%;
40
+ line-height: var(--line-height-compact);
41
41
  letter-spacing: -0.04px;
42
42
  font-variant-numeric: tabular-nums;
43
43
  font-variation-settings: "slnt" 0;
@@ -10,7 +10,7 @@ import {
10
10
  type ParentProps,
11
11
  } from "solid-js"
12
12
  import type { ComponentProps } from "solid-js"
13
- import "./segmented-control-v2.css"
13
+ import "./segmented-control.css"
14
14
 
15
15
  type OnChange = (value: string | null) => void
16
16
 
@@ -26,11 +26,11 @@ const SegmentedControlContext = createContext<SegmentedControlContextValue>()
26
26
 
27
27
  function useSegmentedControlContext() {
28
28
  const ctx = useContext(SegmentedControlContext)
29
- if (!ctx) throw new Error("SegmentedControlItemV2 must be used inside SegmentedControlV2")
29
+ if (!ctx) throw new Error("SegmentedControlItem must be used inside SegmentedControl")
30
30
  return ctx
31
31
  }
32
32
 
33
- export type SegmentedControlV2Props = Omit<ComponentProps<"div">, "onChange"> &
33
+ export type SegmentedControlProps = Omit<ComponentProps<"div">, "onChange"> &
34
34
  ParentProps<{
35
35
  /** Selected value when controlled (including `null` when empty). Omit key for uncontrolled. */
36
36
  value?: string | null
@@ -42,7 +42,7 @@ export type SegmentedControlV2Props = Omit<ComponentProps<"div">, "onChange"> &
42
42
  disabled?: boolean
43
43
  }>
44
44
 
45
- export function SegmentedControlV2(props: SegmentedControlV2Props) {
45
+ export function SegmentedControl(props: SegmentedControlProps) {
46
46
  const isControlled = createMemo(() => Object.hasOwn(props as object, "value"))
47
47
  const merged = mergeProps({ allowDeselect: false, disabled: false }, props)
48
48
  const [local, rest] = splitProps(merged, [
@@ -119,7 +119,7 @@ export function SegmentedControlV2(props: SegmentedControlV2Props) {
119
119
  )
120
120
  }
121
121
 
122
- export type SegmentedControlItemV2Props = Omit<ComponentProps<"button">, "type" | "children"> &
122
+ export type SegmentedControlItemProps = Omit<ComponentProps<"button">, "type" | "children"> &
123
123
  ParentProps<{
124
124
  value: string
125
125
  children: JSX.Element
@@ -132,7 +132,7 @@ function invokeButtonHandler<E extends Event>(
132
132
  if (typeof handler === "function") (handler as (ev: typeof e) => void)(e)
133
133
  }
134
134
 
135
- export function SegmentedControlItemV2(props: SegmentedControlItemV2Props) {
135
+ export function SegmentedControlItem(props: SegmentedControlItemProps) {
136
136
  const merged = mergeProps({ disabled: false }, props)
137
137
  const [local, rest] = splitProps(merged, [
138
138
  "class",
@@ -159,13 +159,14 @@ export function SegmentedControlItemV2(props: SegmentedControlItemV2Props) {
159
159
  invokeButtonHandler(local.onKeyDown, e)
160
160
  if (e.defaultPrevented || disabled()) return
161
161
  const t = e.currentTarget
162
+ const horizontal = t.closest(`[data-slot="segmented-control-v2"]`)?.matches(":dir(rtl)") ? -1 : 1
162
163
 
163
164
  if (e.key === "ArrowRight") {
164
165
  e.preventDefault()
165
- ctx.focusNext(t, 1)
166
+ ctx.focusNext(t, horizontal)
166
167
  } else if (e.key === "ArrowLeft") {
167
168
  e.preventDefault()
168
- ctx.focusNext(t, -1)
169
+ ctx.focusNext(t, -horizontal as 1 | -1)
169
170
  }
170
171
 
171
172
  // accessibility stuff