@health-samurai/react-components 0.0.0-alpha.4 → 0.0.0-alpha.6

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 (304) hide show
  1. package/dist/bundle.css +1375 -484
  2. package/dist/src/components/code-editor/http/grammar/http.d.ts +3 -0
  3. package/dist/src/components/code-editor/http/grammar/http.d.ts.map +1 -0
  4. package/dist/src/components/code-editor/http/grammar/http.grammar +74 -0
  5. package/dist/src/components/code-editor/http/grammar/http.js +38 -0
  6. package/dist/src/components/code-editor/http/grammar/http.js.map +1 -0
  7. package/dist/src/components/code-editor/http/grammar/http.terms.d.ts +2 -0
  8. package/dist/src/components/code-editor/http/grammar/http.terms.d.ts.map +1 -0
  9. package/dist/src/components/code-editor/http/grammar/http.terms.js +4 -0
  10. package/dist/src/components/code-editor/http/grammar/http.terms.js.map +1 -0
  11. package/dist/src/components/code-editor/http/grammar/http.test.d.ts +2 -0
  12. package/dist/src/components/code-editor/http/grammar/http.test.d.ts.map +1 -0
  13. package/dist/src/components/code-editor/http/grammar/http.test.js +80 -0
  14. package/dist/src/components/code-editor/http/grammar/http.test.js.map +1 -0
  15. package/dist/src/components/code-editor/http/index.d.ts +4 -0
  16. package/dist/src/components/code-editor/http/index.d.ts.map +1 -0
  17. package/dist/src/components/code-editor/http/index.js +66 -0
  18. package/dist/src/components/code-editor/http/index.js.map +1 -0
  19. package/dist/src/components/code-editor/index.d.ts +14 -2
  20. package/dist/src/components/code-editor/index.d.ts.map +1 -1
  21. package/dist/src/components/code-editor/index.js +309 -20
  22. package/dist/src/components/code-editor/index.js.map +1 -1
  23. package/dist/src/components/code-editor.stories.d.ts +1 -0
  24. package/dist/src/components/code-editor.stories.d.ts.map +1 -1
  25. package/dist/src/components/code-editor.stories.js +255 -2
  26. package/dist/src/components/code-editor.stories.js.map +1 -1
  27. package/dist/src/components/copy-icon.d.ts +5 -1
  28. package/dist/src/components/copy-icon.d.ts.map +1 -1
  29. package/dist/src/components/copy-icon.js +41 -3
  30. package/dist/src/components/copy-icon.js.map +1 -1
  31. package/dist/src/components/data-table.d.ts +8 -0
  32. package/dist/src/components/data-table.d.ts.map +1 -0
  33. package/dist/src/components/data-table.js +65 -0
  34. package/dist/src/components/data-table.js.map +1 -0
  35. package/dist/src/components/data-table.stories.d.ts +7 -0
  36. package/dist/src/components/data-table.stories.d.ts.map +1 -0
  37. package/dist/src/components/data-table.stories.js +44 -0
  38. package/dist/src/components/data-table.stories.js.map +1 -0
  39. package/dist/src/components/fhir-structure-view.d.ts +34 -0
  40. package/dist/src/components/fhir-structure-view.d.ts.map +1 -0
  41. package/dist/src/components/fhir-structure-view.js +229 -0
  42. package/dist/src/components/fhir-structure-view.js.map +1 -0
  43. package/dist/src/components/fhir-structure-view.stories.d.ts +7 -0
  44. package/dist/src/components/fhir-structure-view.stories.d.ts.map +1 -0
  45. package/dist/src/components/fhir-structure-view.stories.js +447 -0
  46. package/dist/src/components/fhir-structure-view.stories.js.map +1 -0
  47. package/dist/src/components/patient-table.d.ts +73 -0
  48. package/dist/src/components/patient-table.d.ts.map +1 -0
  49. package/dist/src/components/patient-table.js +921 -0
  50. package/dist/src/components/patient-table.js.map +1 -0
  51. package/dist/src/components/patient-table.stories.d.ts +111 -0
  52. package/dist/src/components/patient-table.stories.d.ts.map +1 -0
  53. package/dist/src/components/patient-table.stories.js +172 -0
  54. package/dist/src/components/patient-table.stories.js.map +1 -0
  55. package/dist/src/components/request-line-editor.d.ts +13 -35
  56. package/dist/src/components/request-line-editor.d.ts.map +1 -1
  57. package/dist/src/components/request-line-editor.js +72 -49
  58. package/dist/src/components/request-line-editor.js.map +1 -1
  59. package/dist/src/components/request-line-editor.stories.d.ts.map +1 -1
  60. package/dist/src/components/request-line-editor.stories.js +17 -53
  61. package/dist/src/components/request-line-editor.stories.js.map +1 -1
  62. package/dist/src/components/segment-control.d.ts +16 -0
  63. package/dist/src/components/segment-control.d.ts.map +1 -0
  64. package/dist/src/components/segment-control.js +48 -0
  65. package/dist/src/components/segment-control.js.map +1 -0
  66. package/dist/src/components/segment-control.stories.d.ts +15 -0
  67. package/dist/src/components/segment-control.stories.d.ts.map +1 -0
  68. package/dist/src/components/segment-control.stories.js +33 -0
  69. package/dist/src/components/segment-control.stories.js.map +1 -0
  70. package/dist/src/components/split-button.d.ts +5 -0
  71. package/dist/src/components/split-button.d.ts.map +1 -0
  72. package/dist/src/components/split-button.js +12 -0
  73. package/dist/src/components/split-button.js.map +1 -0
  74. package/dist/src/components/split-button.stories.d.ts +7 -0
  75. package/dist/src/components/split-button.stories.d.ts.map +1 -0
  76. package/dist/src/components/split-button.stories.js +57 -0
  77. package/dist/src/components/split-button.stories.js.map +1 -0
  78. package/dist/src/components/tree-view.d.ts +22 -0
  79. package/dist/src/components/tree-view.d.ts.map +1 -0
  80. package/dist/src/components/tree-view.js +101 -0
  81. package/dist/src/components/tree-view.js.map +1 -0
  82. package/dist/src/components/tree-view.stories.d.ts +13 -0
  83. package/dist/src/components/tree-view.stories.d.ts.map +1 -0
  84. package/dist/src/components/tree-view.stories.js +274 -0
  85. package/dist/src/components/tree-view.stories.js.map +1 -0
  86. package/dist/src/icons.d.ts +9 -0
  87. package/dist/src/icons.d.ts.map +1 -0
  88. package/dist/src/icons.js +279 -0
  89. package/dist/src/icons.js.map +1 -0
  90. package/dist/src/index.css +42 -3
  91. package/dist/src/index.d.ts +9 -1
  92. package/dist/src/index.d.ts.map +1 -1
  93. package/dist/src/index.js +9 -1
  94. package/dist/src/index.js.map +1 -1
  95. package/dist/src/shadcn/components/ui/accordion.d.ts.map +1 -1
  96. package/dist/src/shadcn/components/ui/accordion.js +23 -5
  97. package/dist/src/shadcn/components/ui/accordion.js.map +1 -1
  98. package/dist/src/shadcn/components/ui/alert-dialog.d.ts +3 -1
  99. package/dist/src/shadcn/components/ui/alert-dialog.d.ts.map +1 -1
  100. package/dist/src/shadcn/components/ui/alert-dialog.js +5 -2
  101. package/dist/src/shadcn/components/ui/alert-dialog.js.map +1 -1
  102. package/dist/src/shadcn/components/ui/alert.d.ts.map +1 -1
  103. package/dist/src/shadcn/components/ui/alert.js +12 -5
  104. package/dist/src/shadcn/components/ui/alert.js.map +1 -1
  105. package/dist/src/shadcn/components/ui/avatar.d.ts.map +1 -1
  106. package/dist/src/shadcn/components/ui/avatar.js +4 -3
  107. package/dist/src/shadcn/components/ui/avatar.js.map +1 -1
  108. package/dist/src/shadcn/components/ui/badge.d.ts.map +1 -1
  109. package/dist/src/shadcn/components/ui/badge.js +16 -5
  110. package/dist/src/shadcn/components/ui/badge.js.map +1 -1
  111. package/dist/src/shadcn/components/ui/breadcrumb.d.ts.map +1 -1
  112. package/dist/src/shadcn/components/ui/breadcrumb.js +6 -6
  113. package/dist/src/shadcn/components/ui/breadcrumb.js.map +1 -1
  114. package/dist/src/shadcn/components/ui/button.d.ts.map +1 -1
  115. package/dist/src/shadcn/components/ui/button.js +19 -11
  116. package/dist/src/shadcn/components/ui/button.js.map +1 -1
  117. package/dist/src/shadcn/components/ui/card.d.ts.map +1 -1
  118. package/dist/src/shadcn/components/ui/card.js +14 -6
  119. package/dist/src/shadcn/components/ui/card.js.map +1 -1
  120. package/dist/src/shadcn/components/ui/checkbox.d.ts.map +1 -1
  121. package/dist/src/shadcn/components/ui/checkbox.js +20 -5
  122. package/dist/src/shadcn/components/ui/checkbox.js.map +1 -1
  123. package/dist/src/shadcn/components/ui/checkbox.stories.d.ts.map +1 -1
  124. package/dist/src/shadcn/components/ui/checkbox.stories.js +44 -35
  125. package/dist/src/shadcn/components/ui/checkbox.stories.js.map +1 -1
  126. package/dist/src/shadcn/components/ui/combobox.d.ts +18 -0
  127. package/dist/src/shadcn/components/ui/combobox.d.ts.map +1 -0
  128. package/dist/src/shadcn/components/ui/combobox.js +121 -0
  129. package/dist/src/shadcn/components/ui/combobox.js.map +1 -0
  130. package/dist/src/shadcn/components/ui/combobox.stories.d.ts +11 -0
  131. package/dist/src/shadcn/components/ui/combobox.stories.d.ts.map +1 -0
  132. package/dist/src/shadcn/components/ui/combobox.stories.js +16 -0
  133. package/dist/src/shadcn/components/ui/combobox.stories.js.map +1 -0
  134. package/dist/src/shadcn/components/ui/command.d.ts.map +1 -1
  135. package/dist/src/shadcn/components/ui/command.js +73 -12
  136. package/dist/src/shadcn/components/ui/command.js.map +1 -1
  137. package/dist/src/shadcn/components/ui/command.stories.js +0 -1
  138. package/dist/src/shadcn/components/ui/command.stories.js.map +1 -1
  139. package/dist/src/shadcn/components/ui/dialog.d.ts.map +1 -1
  140. package/dist/src/shadcn/components/ui/dialog.js +35 -7
  141. package/dist/src/shadcn/components/ui/dialog.js.map +1 -1
  142. package/dist/src/shadcn/components/ui/drawer.d.ts.map +1 -1
  143. package/dist/src/shadcn/components/ui/drawer.js +26 -5
  144. package/dist/src/shadcn/components/ui/drawer.js.map +1 -1
  145. package/dist/src/shadcn/components/ui/dropdown-menu.d.ts.map +1 -1
  146. package/dist/src/shadcn/components/ui/dropdown-menu.js +12 -1
  147. package/dist/src/shadcn/components/ui/dropdown-menu.js.map +1 -1
  148. package/dist/src/shadcn/components/ui/form.d.ts.map +1 -1
  149. package/dist/src/shadcn/components/ui/form.js +12 -4
  150. package/dist/src/shadcn/components/ui/form.js.map +1 -1
  151. package/dist/src/shadcn/components/ui/input.d.ts +3 -1
  152. package/dist/src/shadcn/components/ui/input.d.ts.map +1 -1
  153. package/dist/src/shadcn/components/ui/input.js +126 -17
  154. package/dist/src/shadcn/components/ui/input.js.map +1 -1
  155. package/dist/src/shadcn/components/ui/label.d.ts.map +1 -1
  156. package/dist/src/shadcn/components/ui/label.js +8 -1
  157. package/dist/src/shadcn/components/ui/label.js.map +1 -1
  158. package/dist/src/shadcn/components/ui/menubar.d.ts.map +1 -1
  159. package/dist/src/shadcn/components/ui/menubar.js +35 -13
  160. package/dist/src/shadcn/components/ui/menubar.js.map +1 -1
  161. package/dist/src/shadcn/components/ui/pagination.d.ts.map +1 -1
  162. package/dist/src/shadcn/components/ui/pagination.js +6 -6
  163. package/dist/src/shadcn/components/ui/pagination.js.map +1 -1
  164. package/dist/src/shadcn/components/ui/popover.d.ts.map +1 -1
  165. package/dist/src/shadcn/components/ui/popover.js +12 -1
  166. package/dist/src/shadcn/components/ui/popover.js.map +1 -1
  167. package/dist/src/shadcn/components/ui/progress.d.ts.map +1 -1
  168. package/dist/src/shadcn/components/ui/progress.js +6 -2
  169. package/dist/src/shadcn/components/ui/progress.js.map +1 -1
  170. package/dist/src/shadcn/components/ui/radio-group.d.ts.map +1 -1
  171. package/dist/src/shadcn/components/ui/radio-group.js +11 -6
  172. package/dist/src/shadcn/components/ui/radio-group.js.map +1 -1
  173. package/dist/src/shadcn/components/ui/radio-group.stories.d.ts.map +1 -1
  174. package/dist/src/shadcn/components/ui/radio-group.stories.js +57 -34
  175. package/dist/src/shadcn/components/ui/radio-group.stories.js.map +1 -1
  176. package/dist/src/shadcn/components/ui/scroll-area.d.ts.map +1 -1
  177. package/dist/src/shadcn/components/ui/scroll-area.js +9 -3
  178. package/dist/src/shadcn/components/ui/scroll-area.js.map +1 -1
  179. package/dist/src/shadcn/components/ui/select.d.ts.map +1 -1
  180. package/dist/src/shadcn/components/ui/select.js +49 -14
  181. package/dist/src/shadcn/components/ui/select.js.map +1 -1
  182. package/dist/src/shadcn/components/ui/select.stories.d.ts.map +1 -1
  183. package/dist/src/shadcn/components/ui/select.stories.js +1 -4
  184. package/dist/src/shadcn/components/ui/select.stories.js.map +1 -1
  185. package/dist/src/shadcn/components/ui/separator.d.ts.map +1 -1
  186. package/dist/src/shadcn/components/ui/separator.js +7 -1
  187. package/dist/src/shadcn/components/ui/separator.js.map +1 -1
  188. package/dist/src/shadcn/components/ui/sidebar.d.ts.map +1 -1
  189. package/dist/src/shadcn/components/ui/sidebar.js +20 -6
  190. package/dist/src/shadcn/components/ui/sidebar.js.map +1 -1
  191. package/dist/src/shadcn/components/ui/skeleton.d.ts.map +1 -1
  192. package/dist/src/shadcn/components/ui/skeleton.js +3 -1
  193. package/dist/src/shadcn/components/ui/skeleton.js.map +1 -1
  194. package/dist/src/shadcn/components/ui/slider.d.ts.map +1 -1
  195. package/dist/src/shadcn/components/ui/slider.js +34 -4
  196. package/dist/src/shadcn/components/ui/slider.js.map +1 -1
  197. package/dist/src/shadcn/components/ui/sonner.d.ts +16 -1
  198. package/dist/src/shadcn/components/ui/sonner.d.ts.map +1 -1
  199. package/dist/src/shadcn/components/ui/sonner.js +23 -3
  200. package/dist/src/shadcn/components/ui/sonner.js.map +1 -1
  201. package/dist/src/shadcn/components/ui/sonner.stories.d.ts.map +1 -1
  202. package/dist/src/shadcn/components/ui/sonner.stories.js +19 -11
  203. package/dist/src/shadcn/components/ui/sonner.stories.js.map +1 -1
  204. package/dist/src/shadcn/components/ui/switch.d.ts.map +1 -1
  205. package/dist/src/shadcn/components/ui/switch.js +18 -2
  206. package/dist/src/shadcn/components/ui/switch.js.map +1 -1
  207. package/dist/src/shadcn/components/ui/table.d.ts.map +1 -1
  208. package/dist/src/shadcn/components/ui/table.js +12 -8
  209. package/dist/src/shadcn/components/ui/table.js.map +1 -1
  210. package/dist/src/shadcn/components/ui/tabs.d.ts +21 -3
  211. package/dist/src/shadcn/components/ui/tabs.d.ts.map +1 -1
  212. package/dist/src/shadcn/components/ui/tabs.js +315 -9
  213. package/dist/src/shadcn/components/ui/tabs.js.map +1 -1
  214. package/dist/src/shadcn/components/ui/tabs.stories.d.ts.map +1 -1
  215. package/dist/src/shadcn/components/ui/tabs.stories.js +50 -1
  216. package/dist/src/shadcn/components/ui/tabs.stories.js.map +1 -1
  217. package/dist/src/shadcn/components/ui/textarea.d.ts.map +1 -1
  218. package/dist/src/shadcn/components/ui/textarea.js +15 -1
  219. package/dist/src/shadcn/components/ui/textarea.js.map +1 -1
  220. package/dist/src/shadcn/components/ui/toggle-group.d.ts.map +1 -1
  221. package/dist/src/shadcn/components/ui/toggle-group.js +6 -2
  222. package/dist/src/shadcn/components/ui/toggle-group.js.map +1 -1
  223. package/dist/src/shadcn/components/ui/toggle.d.ts.map +1 -1
  224. package/dist/src/shadcn/components/ui/toggle.js +18 -6
  225. package/dist/src/shadcn/components/ui/toggle.js.map +1 -1
  226. package/dist/src/shadcn/components/ui/tooltip.d.ts.map +1 -1
  227. package/dist/src/shadcn/components/ui/tooltip.js +11 -1
  228. package/dist/src/shadcn/components/ui/tooltip.js.map +1 -1
  229. package/dist/src/shadcn/components/ui/tree.d.ts +28 -0
  230. package/dist/src/shadcn/components/ui/tree.d.ts.map +1 -0
  231. package/dist/src/shadcn/components/ui/tree.js +122 -0
  232. package/dist/src/shadcn/components/ui/tree.js.map +1 -0
  233. package/dist/src/typography.css +12 -0
  234. package/package.json +13 -2
  235. package/src/components/code-editor/http/grammar/http.grammar +74 -0
  236. package/src/components/code-editor/http/grammar/http.terms.ts +9 -0
  237. package/src/components/code-editor/http/grammar/http.test.ts +110 -0
  238. package/src/components/code-editor/http/grammar/http.ts +21 -0
  239. package/src/components/code-editor/http/index.ts +87 -0
  240. package/src/components/code-editor/index.tsx +307 -21
  241. package/src/components/code-editor.stories.tsx +295 -1
  242. package/src/components/copy-icon.tsx +57 -3
  243. package/src/components/data-table.stories.tsx +38 -0
  244. package/src/components/data-table.tsx +117 -0
  245. package/src/components/fhir-structure-view.stories.tsx +439 -0
  246. package/src/components/fhir-structure-view.tsx +231 -0
  247. package/src/components/patient-table.stories.tsx +111 -0
  248. package/src/components/patient-table.tsx +1301 -0
  249. package/src/components/request-line-editor.stories.tsx +17 -27
  250. package/src/components/request-line-editor.tsx +98 -61
  251. package/src/components/segment-control.stories.tsx +29 -0
  252. package/src/components/segment-control.tsx +80 -0
  253. package/src/components/split-button.stories.tsx +49 -0
  254. package/src/components/split-button.tsx +17 -0
  255. package/src/components/tree-view.stories.tsx +259 -0
  256. package/src/components/tree-view.tsx +172 -0
  257. package/src/icons.tsx +287 -0
  258. package/src/index.css +42 -3
  259. package/src/index.tsx +9 -2
  260. package/src/shadcn/components/ui/accordion.tsx +66 -8
  261. package/src/shadcn/components/ui/alert-dialog.tsx +6 -2
  262. package/src/shadcn/components/ui/alert.tsx +53 -15
  263. package/src/shadcn/components/ui/avatar.tsx +17 -6
  264. package/src/shadcn/components/ui/badge.tsx +67 -18
  265. package/src/shadcn/components/ui/breadcrumb.tsx +35 -7
  266. package/src/shadcn/components/ui/button.tsx +118 -57
  267. package/src/shadcn/components/ui/card.tsx +44 -13
  268. package/src/shadcn/components/ui/checkbox.stories.tsx +20 -24
  269. package/src/shadcn/components/ui/checkbox.tsx +45 -4
  270. package/src/shadcn/components/ui/combobox.stories.tsx +19 -0
  271. package/src/shadcn/components/ui/combobox.tsx +142 -0
  272. package/src/shadcn/components/ui/command.stories.tsx +1 -1
  273. package/src/shadcn/components/ui/command.tsx +192 -36
  274. package/src/shadcn/components/ui/dialog.tsx +101 -13
  275. package/src/shadcn/components/ui/drawer.tsx +93 -18
  276. package/src/shadcn/components/ui/dropdown-menu.tsx +37 -9
  277. package/src/shadcn/components/ui/form.tsx +16 -4
  278. package/src/shadcn/components/ui/input.tsx +400 -29
  279. package/src/shadcn/components/ui/label.tsx +21 -4
  280. package/src/shadcn/components/ui/menubar.tsx +188 -43
  281. package/src/shadcn/components/ui/pagination.tsx +12 -6
  282. package/src/shadcn/components/ui/popover.tsx +35 -4
  283. package/src/shadcn/components/ui/progress.tsx +21 -5
  284. package/src/shadcn/components/ui/radio-group.stories.tsx +22 -14
  285. package/src/shadcn/components/ui/radio-group.tsx +42 -5
  286. package/src/shadcn/components/ui/scroll-area.tsx +33 -5
  287. package/src/shadcn/components/ui/select.stories.tsx +0 -2
  288. package/src/shadcn/components/ui/select.tsx +184 -33
  289. package/src/shadcn/components/ui/separator.tsx +15 -5
  290. package/src/shadcn/components/ui/sidebar.tsx +68 -26
  291. package/src/shadcn/components/ui/skeleton.tsx +4 -1
  292. package/src/shadcn/components/ui/slider.tsx +82 -11
  293. package/src/shadcn/components/ui/sonner.stories.tsx +19 -15
  294. package/src/shadcn/components/ui/sonner.tsx +53 -3
  295. package/src/shadcn/components/ui/switch.tsx +53 -7
  296. package/src/shadcn/components/ui/table.tsx +38 -11
  297. package/src/shadcn/components/ui/tabs.stories.tsx +32 -0
  298. package/src/shadcn/components/ui/tabs.tsx +456 -17
  299. package/src/shadcn/components/ui/textarea.tsx +42 -4
  300. package/src/shadcn/components/ui/toggle-group.tsx +27 -5
  301. package/src/shadcn/components/ui/toggle.tsx +59 -18
  302. package/src/shadcn/components/ui/tooltip.tsx +33 -8
  303. package/src/shadcn/components/ui/tree.tsx +233 -0
  304. package/src/typography.css +12 -0
@@ -4,27 +4,68 @@ import type * as React from "react";
4
4
 
5
5
  import { cn } from "#shadcn/lib/utils";
6
6
 
7
- const toggleVariants = cva(
8
- "inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",
9
- {
10
- variants: {
11
- variant: {
12
- default: "bg-transparent",
13
- outline:
14
- "border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground",
15
- },
16
- size: {
17
- default: "h-9 px-2 min-w-9",
18
- sm: "h-8 px-1.5 min-w-8",
19
- lg: "h-10 px-2.5 min-w-10",
20
- },
7
+ // Base toggle styles
8
+ const baseToggleStyles = cn(
9
+ // Layout
10
+ "inline-flex",
11
+ "items-center",
12
+ "justify-center",
13
+ "gap-2",
14
+ "whitespace-nowrap",
15
+ // Shape
16
+ "rounded-md",
17
+ // Typography
18
+ "text-sm",
19
+ "font-medium",
20
+ // Interaction
21
+ "outline-none",
22
+ "transition-[color,box-shadow]",
23
+ // Hover
24
+ "hover:bg-bg-tertiary",
25
+ "hover:text-text-secondary",
26
+ // Pressed/On state
27
+ "data-[state=on]:bg-bg-secondary",
28
+ "data-[state=on]:text-text-primary",
29
+ // Disabled
30
+ "disabled:pointer-events-none",
31
+ "disabled:opacity-50",
32
+ // SVG icons
33
+ "[&_svg]:pointer-events-none",
34
+ "[&_svg:not([class*='size-'])]:size-4",
35
+ "[&_svg]:shrink-0",
36
+ // Focus
37
+ "focus-visible:ring-2",
38
+ "focus-visible:ring-utility-blue/70",
39
+ // Invalid
40
+ "aria-invalid:ring-2",
41
+ "aria-invalid:ring-utility-red/70",
42
+ "aria-invalid:border-border-error",
43
+ );
44
+
45
+ const toggleVariants = cva(baseToggleStyles, {
46
+ variants: {
47
+ variant: {
48
+ default: cn("bg-transparent"),
49
+ outline: cn(
50
+ "border",
51
+ "border-border-primary",
52
+ "bg-transparent",
53
+ "shadow-xs",
54
+ "hover:bg-bg-secondary",
55
+ "hover:text-text-primary",
56
+ ),
21
57
  },
22
- defaultVariants: {
23
- variant: "default",
24
- size: "default",
58
+ size: {
59
+ default: cn("h-9", "px-2", "min-w-9"),
60
+ sm: cn("h-8", "px-1.5", "min-w-8"),
61
+ lg: cn("h-10", "px-2.5", "min-w-10"),
25
62
  },
26
63
  },
27
- );
64
+ defaultVariants: {
65
+ variant: "default",
66
+ size: "default",
67
+ },
68
+ });
28
69
 
29
70
  function Toggle({
30
71
  className,
@@ -4,6 +4,38 @@ import type * as React from "react";
4
4
 
5
5
  import { cn } from "#shadcn/lib/utils";
6
6
 
7
+ // Tooltip content styles
8
+ const tooltipContentStyles = cn(
9
+ // Layout
10
+ "z-50",
11
+ "w-fit",
12
+ "origin-(--radix-tooltip-content-transform-origin)",
13
+ // Shape
14
+ "rounded-md",
15
+ // Background & Colors
16
+ "bg-bg-overlay",
17
+ "text-text-primary_on-brand",
18
+ // Spacing
19
+ "px-3",
20
+ "py-1.5",
21
+ // Typography
22
+ "text-xs",
23
+ "text-balance",
24
+ // Animations - open
25
+ "animate-in",
26
+ "fade-in-0",
27
+ "zoom-in-95",
28
+ // Animations - closed
29
+ "data-[state=closed]:animate-out",
30
+ "data-[state=closed]:fade-out-0",
31
+ "data-[state=closed]:zoom-out-95",
32
+ // Slide animations
33
+ "data-[side=bottom]:slide-in-from-top-2",
34
+ "data-[side=left]:slide-in-from-right-2",
35
+ "data-[side=right]:slide-in-from-left-2",
36
+ "data-[side=top]:slide-in-from-bottom-2",
37
+ );
38
+
7
39
  function TooltipProvider({
8
40
  delayDuration = 0,
9
41
  ...props
@@ -44,14 +76,7 @@ function TooltipContent({
44
76
  <TooltipPrimitive.Content
45
77
  data-slot="tooltip-content"
46
78
  sideOffset={sideOffset}
47
- className={cn(
48
- "bg-(--color-elements-assistive) text-(--color-elements-readable-inv) animate-in fade-in-0 zoom-in-95",
49
- "data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
50
- "data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2",
51
- "data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md",
52
- "px-3 py-1.5 text-xs text-balance",
53
- className,
54
- )}
79
+ className={cn(tooltipContentStyles, className)}
55
80
  {...props}
56
81
  >
57
82
  {children}
@@ -0,0 +1,233 @@
1
+ import type { ItemInstance } from "@headless-tree/core";
2
+ import { ChevronDownIcon } from "lucide-react";
3
+ import { Slot } from "radix-ui";
4
+ import * as React from "react";
5
+
6
+ import { cn } from "#shadcn/lib/utils";
7
+
8
+ type WithMeta = {
9
+ meta?: {
10
+ lastNode?: boolean;
11
+ };
12
+ };
13
+
14
+ // biome-ignore lint/suspicious/noExplicitAny: FIXME Origin UI as-is
15
+ interface TreeContextValue<T = any> {
16
+ indent: number;
17
+ currentItem?: ItemInstance<T>;
18
+ // biome-ignore lint/suspicious/noExplicitAny: FIXME Origin UI as-is
19
+ tree?: any;
20
+ }
21
+
22
+ const TreeContext = React.createContext<TreeContextValue>({
23
+ indent: 20,
24
+ });
25
+
26
+ // biome-ignore lint/suspicious/noExplicitAny: FIXME Origin UI as-is
27
+ function useTreeContext<T = any>() {
28
+ return React.useContext(TreeContext) as TreeContextValue<T>;
29
+ }
30
+
31
+ interface TreeProps extends React.HTMLAttributes<HTMLDivElement> {
32
+ indent?: number;
33
+ // biome-ignore lint/suspicious/noExplicitAny: FIXME Origin UI as-is
34
+ tree?: any;
35
+ }
36
+
37
+ function Tree({ indent = 20, tree, className, ...props }: TreeProps) {
38
+ const containerProps =
39
+ tree && typeof tree.getContainerProps === "function"
40
+ ? tree.getContainerProps()
41
+ : {};
42
+ const mergedProps = { ...props, ...containerProps };
43
+
44
+ // Extract style from mergedProps to merge with our custom styles
45
+ const { style: propStyle, ...otherProps } = mergedProps;
46
+
47
+ // Merge styles
48
+ const mergedStyle = {
49
+ ...propStyle,
50
+ "--tree-indent": `${indent}px`,
51
+ "--border": `var(--color-fg-disabled)`,
52
+ } as React.CSSProperties;
53
+
54
+ return (
55
+ <TreeContext.Provider value={{ indent, tree }}>
56
+ <div
57
+ data-slot="tree"
58
+ style={mergedStyle}
59
+ className={cn("flex flex-col", className)}
60
+ {...otherProps}
61
+ />
62
+ </TreeContext.Provider>
63
+ );
64
+ }
65
+
66
+ // biome-ignore lint/suspicious/noExplicitAny: FIXME Origin UI as-is
67
+ interface TreeItemProps<T = any>
68
+ extends React.HTMLAttributes<HTMLButtonElement> {
69
+ item: ItemInstance<T>;
70
+ indent?: number;
71
+ asChild?: boolean;
72
+ }
73
+
74
+ // biome-ignore lint/suspicious/noExplicitAny: FIXME Origin UI as-is
75
+ function TreeItem<T = any>({
76
+ item,
77
+ className,
78
+ asChild,
79
+ children,
80
+ ...props
81
+ }: Omit<TreeItemProps<T>, "indent">) {
82
+ const { indent } = useTreeContext<T>();
83
+
84
+ const itemProps = typeof item.getProps === "function" ? item.getProps() : {};
85
+ const mergedProps = { ...props, ...itemProps };
86
+
87
+ // Extract style from mergedProps to merge with our custom styles
88
+ const { style: propStyle, ...otherProps } = mergedProps;
89
+
90
+ // Merge styles
91
+ const mergedStyle = {
92
+ ...propStyle,
93
+ "--tree-padding": `${item.getItemMeta().level * indent}px`,
94
+ } as React.CSSProperties;
95
+
96
+ const Comp = asChild ? Slot.Root : "button";
97
+
98
+ return (
99
+ <TreeContext.Provider value={{ indent, currentItem: item }}>
100
+ <Comp
101
+ data-slot="tree-item"
102
+ style={mergedStyle}
103
+ className={cn(
104
+ "z-10 ps-(--tree-padding) outline-hidden select-none focus:z-20 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
105
+ className,
106
+ )}
107
+ data-focus={
108
+ typeof item.isFocused === "function"
109
+ ? item.isFocused() || false
110
+ : undefined
111
+ }
112
+ data-folder={
113
+ typeof item.isFolder === "function"
114
+ ? item.isFolder() || false
115
+ : undefined
116
+ }
117
+ data-selected={
118
+ typeof item.isSelected === "function"
119
+ ? item.isSelected() || false
120
+ : undefined
121
+ }
122
+ data-drag-target={
123
+ typeof item.isDragTarget === "function"
124
+ ? item.isDragTarget() || false
125
+ : undefined
126
+ }
127
+ data-search-match={
128
+ typeof item.isMatchingSearch === "function"
129
+ ? item.isMatchingSearch() || false
130
+ : undefined
131
+ }
132
+ aria-expanded={item.isExpanded()}
133
+ {...otherProps}
134
+ >
135
+ {children}
136
+ </Comp>
137
+ </TreeContext.Provider>
138
+ );
139
+ }
140
+
141
+ // biome-ignore lint/suspicious/noExplicitAny: FIXME Origin UI as-is
142
+ interface TreeItemLabelProps<T = any>
143
+ extends React.HTMLAttributes<HTMLSpanElement> {
144
+ hideChevron?: boolean;
145
+ disableHover?: boolean;
146
+ item?: ItemInstance<T>;
147
+ horizontalLines?: boolean;
148
+ }
149
+
150
+ function TreeItemLabel<T>({
151
+ item: propItem,
152
+ children,
153
+ className,
154
+ disableHover,
155
+ horizontalLines,
156
+ hideChevron,
157
+ ...props
158
+ }: TreeItemLabelProps<T & WithMeta>) {
159
+ const { currentItem } = useTreeContext<T & WithMeta>();
160
+ const item = propItem || currentItem;
161
+
162
+ if (!item) {
163
+ console.warn("TreeItemLabel: No item provided via props or context");
164
+ return null;
165
+ }
166
+
167
+ const data = item.getItemData?.();
168
+ const isLastNode = data?.meta?.lastNode;
169
+ const itemMeta = item.getItemMeta();
170
+
171
+ return (
172
+ <span
173
+ data-slot="tree-item-label"
174
+ className={cn(
175
+ "group/tree-item-label relative select-text cursor-pointer border-l-2 border-l-transparent in-focus-visible:ring-ring/50 bg-background text-text-secondary in-data-[drag-target=true]:bg-accent flex items-center gap-2 pr-2 pl-2.5 py-1.5 text-sm transition-colors not-in-data-[folder=true]:ps-2.5 in-focus-visible:ring-[3px] in-data-[search-match=true]:bg-blue-400/20! [&_svg]:pointer-events-none [&_svg]:shrink-0",
176
+ !disableHover &&
177
+ "in-data-[selected=true]:bg-bg-secondary hover:bg-bg-secondary hover:text-text-primary in-data-[selected=true]:text-text-primary",
178
+ disableHover && "text-text-primary",
179
+ className,
180
+ )}
181
+ {...props}
182
+ >
183
+ {item.isFolder() && (
184
+ <ChevronDownIcon className="text-muted-foreground size-4 in-aria-[expanded=false]:-rotate-90 self-start mt-0.5" />
185
+ )}
186
+ {!item.isFolder() && horizontalLines && (
187
+ <div
188
+ className={`w-5 min-w-5 h-px border-t mt-2.25 -ml-1 self-start`}
189
+ ></div>
190
+ )}
191
+ {item.isFolder() && item.isExpanded() && horizontalLines && (
192
+ <div
193
+ className={`absolute left-4.25 top-4 w-px min-h-full h-full border-l mt-2.25 self-start `}
194
+ ></div>
195
+ )}
196
+ {horizontalLines && (
197
+ <div
198
+ className={`absolute left-0 top-5.5 -m-1.75 border-t w-4 ${isLastNode ? "h-full bg-inherit " : ""} ${itemMeta.level === 0 ? "hidden" : ""}`}
199
+ ></div>
200
+ )}
201
+ {children ||
202
+ (typeof item.getItemName === "function" ? item.getItemName() : null)}
203
+ </span>
204
+ );
205
+ }
206
+
207
+ function TreeDragLine({
208
+ className,
209
+ ...props
210
+ }: React.HTMLAttributes<HTMLDivElement>) {
211
+ const { tree } = useTreeContext();
212
+
213
+ if (!tree || typeof tree.getDragLineStyle !== "function") {
214
+ console.warn(
215
+ "TreeDragLine: No tree provided via context or tree does not have getDragLineStyle method",
216
+ );
217
+ return null;
218
+ }
219
+
220
+ const dragLine = tree.getDragLineStyle();
221
+ return (
222
+ <div
223
+ style={dragLine}
224
+ className={cn(
225
+ "bg-primary before:bg-background before:border-primary absolute z-30 -mt-px h-0.5 w-[unset] before:absolute before:-top-[3px] before:left-0 before:size-2 before:rounded-full before:border-2",
226
+ className,
227
+ )}
228
+ {...props}
229
+ />
230
+ );
231
+ }
232
+
233
+ export { Tree, TreeItem, TreeItemLabel, TreeDragLine, type ItemInstance };
@@ -42,6 +42,18 @@ body {
42
42
  font-weight: var(--font-weight-normal);
43
43
  line-height: var(--font-leading-4);
44
44
  }
45
+ .typo-body-xs {
46
+ font-size: var(--font-size-xs);
47
+ font-family: var(--font-family-sans);
48
+ font-weight: var(--font-weight-normal);
49
+ line-height: var(--font-leading-3);
50
+ }
51
+ .typo-label-xs {
52
+ font-size: var(--font-size-xs);
53
+ font-family: var(--font-family-sans);
54
+ font-weight: var(--font-weight-medium);
55
+ line-height: var(--font-leading-3);
56
+ }
45
57
 
46
58
  .h1 {
47
59
  font-size: var(--font-size-4xl);