@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
@@ -1,82 +1,105 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cva } from "class-variance-authority";
3
+ import { toast } from "sonner";
2
4
  import { Input } from "../shadcn/components/ui/input.js";
3
5
  import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../shadcn/components/ui/select.js";
4
6
  import { cn } from "../shadcn/lib/utils.js";
5
7
  import { CopyIcon } from "./copy-icon.js";
6
- const METHOD_COLORS = {
7
- GET: {
8
- text: "text-[#6D9F0F] [&_svg]:text-[#6D9F0F]!",
9
- background: "bg-green-200",
10
- border: "border-fg-success-secondary! hover:border-fg-success-secondary ring-green-200!"
11
- },
12
- POST: {
13
- text: "text-yellow-600 [&_svg]:text-yellow-600!",
14
- background: "bg-yellow-200",
15
- border: "border-[#F4CB00]! hover:border-[#F4CB00] ring-yellow-200!"
16
- },
17
- PUT: {
18
- text: "text-blue-500 [&_svg]:text-blue-500!",
19
- background: "bg-blue-200",
20
- border: "border-blue-400! hover:border-blue-400 ring-blue-200!"
21
- },
22
- PATCH: {
23
- text: "text-violet-600 [&_svg]:text-violet-600",
24
- background: "bg-violet-200",
25
- border: "border-violet-400! hover:border-violet-400 ring-violet-200!"
26
- },
27
- DELETE: {
28
- text: "text-red-600 [&_svg]:text-red-600!",
29
- background: "bg-red-200",
30
- border: "border-red-300! hover:border-red-300 ring-red-200!"
8
+ const METHODS = [
9
+ "GET",
10
+ "POST",
11
+ "PUT",
12
+ "PATCH",
13
+ "DELETE"
14
+ ];
15
+ const requestMethodVariants = cva(cn("border-r-0", "rounded-r-none", "shadow-none", "typo-label", "text-left", "items-center", "w-26"), {
16
+ variants: {
17
+ method: {
18
+ GET: "text-utility-green [&_svg]:text-utility-green",
19
+ POST: "text-utility-yellow [&_svg]:text-utility-yellow",
20
+ PUT: "text-utility-blue [&_svg]:text-utility-blue ",
21
+ PATCH: "text-utility-violet [&_svg]:text-utility-violet",
22
+ DELETE: "text-utility-red [&_svg]:text-utility-red"
23
+ }
31
24
  }
32
- };
33
- function RequestMethodSelector({ selectedMethod, setMethod, methods }) {
25
+ });
26
+ function isKnownMethod(candidate) {
27
+ const methods = METHODS;
28
+ return methods.includes(candidate);
29
+ }
30
+ function RequestMethodSelector({ value, onValueChange }) {
34
31
  return /*#__PURE__*/ _jsxs(Select, {
35
- value: selectedMethod,
36
- onValueChange: setMethod,
32
+ value: value,
33
+ ...onValueChange ? {
34
+ onValueChange: onValueChange
35
+ } : {},
37
36
  children: [
38
37
  /*#__PURE__*/ _jsx(SelectTrigger, {
39
- className: `min-w-26 border-r-0 rounded-r-none shadow-none ${METHOD_COLORS[selectedMethod].text} ${METHOD_COLORS[selectedMethod].background} ${METHOD_COLORS[selectedMethod].border}`,
40
- children: /*#__PURE__*/ _jsx(SelectValue, {})
38
+ className: requestMethodVariants(isKnownMethod(value) ? {
39
+ method: value
40
+ } : undefined),
41
+ children: /*#__PURE__*/ _jsx(SelectValue, {
42
+ children: value
43
+ })
41
44
  }),
42
45
  /*#__PURE__*/ _jsx(SelectContent, {
43
- children: methods.map((method)=>/*#__PURE__*/ _jsx(SelectItem, {
46
+ children: METHODS.map((method)=>/*#__PURE__*/ _jsx(SelectItem, {
44
47
  value: method,
45
- children: /*#__PURE__*/ _jsxs("span", {
46
- className: `${METHOD_COLORS[method].text}`,
47
- children: [
48
- " ",
49
- method,
50
- " "
51
- ]
48
+ children: /*#__PURE__*/ _jsx("span", {
49
+ className: requestMethodVariants({
50
+ method: method
51
+ }),
52
+ children: method
52
53
  })
53
54
  }, method))
54
55
  })
55
56
  ]
56
57
  });
57
58
  }
58
- function RequestLineEditor({ className, selectedMethod, setMethod, methods, inputValue, onInputChange }) {
59
+ function RequestLineEditor({ className, method, onMethodChange, path, placeholder, autoFocus, onPathChange }) {
59
60
  return /*#__PURE__*/ _jsxs("div", {
60
61
  className: cn("flex", className),
61
62
  children: [
62
63
  /*#__PURE__*/ _jsx(RequestMethodSelector, {
63
- selectedMethod: selectedMethod,
64
- setMethod: setMethod,
65
- methods: methods
64
+ value: method,
65
+ onValueChange: onMethodChange
66
66
  }),
67
67
  /*#__PURE__*/ _jsx(Input, {
68
- className: `rounded-l-none ${METHOD_COLORS[selectedMethod].border}`,
69
- value: inputValue,
68
+ className: "rounded-l-none",
69
+ value: path,
70
+ autoFocus: autoFocus,
71
+ placeholder: placeholder,
70
72
  rightSlot: /*#__PURE__*/ _jsx(CopyIcon, {
71
- text: `${selectedMethod} ${inputValue}`
73
+ text: `${method} ${path}`,
74
+ tooltipText: "Copy request line",
75
+ showToast: false,
76
+ onCopy: (text)=>{
77
+ // Custom toast for request line
78
+ const truncatedText = text.length > 30 ? `${text.slice(0, 30)}...` : text;
79
+ toast(/*#__PURE__*/ _jsxs("div", {
80
+ className: "flex flex-col gap-1",
81
+ children: [
82
+ /*#__PURE__*/ _jsx("span", {
83
+ className: "typo-body",
84
+ children: "Request line copied"
85
+ }),
86
+ /*#__PURE__*/ _jsx("span", {
87
+ className: "typo-code text-text-secondary",
88
+ children: truncatedText
89
+ })
90
+ ]
91
+ }), {
92
+ duration: 2000
93
+ });
94
+ }
72
95
  }),
73
- ...onInputChange !== undefined ? {
74
- onChange: onInputChange
96
+ ...onPathChange !== undefined ? {
97
+ onChange: onPathChange
75
98
  } : {}
76
99
  })
77
100
  ]
78
101
  });
79
102
  }
80
- export { RequestLineEditor, METHOD_COLORS };
103
+ export { RequestLineEditor, requestMethodVariants };
81
104
 
82
105
  //# sourceMappingURL=request-line-editor.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/request-line-editor.tsx"],"sourcesContent":["import type * as React from \"react\";\nimport { Input } from \"#shadcn/components/ui/input\";\nimport {\n\tSelect,\n\tSelectContent,\n\tSelectItem,\n\tSelectTrigger,\n\tSelectValue,\n} from \"#shadcn/components/ui/select\";\nimport { cn } from \"#shadcn/lib/utils\";\nimport { CopyIcon } from \"./copy-icon\";\n\ninterface RequestLineEditorProps extends React.ComponentProps<\"div\"> {\n\tselectedMethod: string;\n\tsetMethod: (value: string) => void;\n\tmethods: string[];\n\tinputValue?: string | undefined;\n\tonInputChange?: React.ChangeEventHandler<HTMLInputElement>;\n}\n\nconst METHOD_COLORS = {\n\tGET: {\n\t\ttext: \"text-[#6D9F0F] [&_svg]:text-[#6D9F0F]!\",\n\t\tbackground: \"bg-green-200\",\n\t\tborder:\n\t\t\t\"border-fg-success-secondary! hover:border-fg-success-secondary ring-green-200!\",\n\t},\n\tPOST: {\n\t\ttext: \"text-yellow-600 [&_svg]:text-yellow-600!\",\n\t\tbackground: \"bg-yellow-200\",\n\t\tborder: \"border-[#F4CB00]! hover:border-[#F4CB00] ring-yellow-200!\",\n\t},\n\tPUT: {\n\t\ttext: \"text-blue-500 [&_svg]:text-blue-500!\",\n\t\tbackground: \"bg-blue-200\",\n\t\tborder: \"border-blue-400! hover:border-blue-400 ring-blue-200!\",\n\t},\n\tPATCH: {\n\t\ttext: \"text-violet-600 [&_svg]:text-violet-600\",\n\t\tbackground: \"bg-violet-200\",\n\t\tborder: \"border-violet-400! hover:border-violet-400 ring-violet-200!\",\n\t},\n\tDELETE: {\n\t\ttext: \"text-red-600 [&_svg]:text-red-600!\",\n\t\tbackground: \"bg-red-200\",\n\t\tborder: \"border-red-300! hover:border-red-300 ring-red-200!\",\n\t},\n};\n\nfunction RequestMethodSelector({\n\tselectedMethod,\n\tsetMethod,\n\tmethods,\n}: RequestLineEditorProps) {\n\treturn (\n\t\t<Select value={selectedMethod} onValueChange={setMethod}>\n\t\t\t<SelectTrigger\n\t\t\t\tclassName={`min-w-26 border-r-0 rounded-r-none shadow-none ${METHOD_COLORS[selectedMethod as keyof typeof METHOD_COLORS].text} ${METHOD_COLORS[selectedMethod as keyof typeof METHOD_COLORS].background} ${METHOD_COLORS[selectedMethod as keyof typeof METHOD_COLORS].border}`}\n\t\t\t>\n\t\t\t\t<SelectValue />\n\t\t\t</SelectTrigger>\n\t\t\t<SelectContent>\n\t\t\t\t{methods.map((method) => (\n\t\t\t\t\t<SelectItem key={method} value={method}>\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tclassName={`${METHOD_COLORS[method as keyof typeof METHOD_COLORS].text}`}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{\" \"}\n\t\t\t\t\t\t\t{method}{\" \"}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</SelectItem>\n\t\t\t\t))}\n\t\t\t</SelectContent>\n\t\t</Select>\n\t);\n}\n\nfunction RequestLineEditor({\n\tclassName,\n\tselectedMethod,\n\tsetMethod,\n\tmethods,\n\tinputValue,\n\tonInputChange,\n}: RequestLineEditorProps) {\n\treturn (\n\t\t<div className={cn(\"flex\", className)}>\n\t\t\t<RequestMethodSelector\n\t\t\t\tselectedMethod={selectedMethod}\n\t\t\t\tsetMethod={setMethod}\n\t\t\t\tmethods={methods}\n\t\t\t/>\n\t\t\t<Input\n\t\t\t\tclassName={`rounded-l-none ${METHOD_COLORS[selectedMethod as keyof typeof METHOD_COLORS].border}`}\n\t\t\t\tvalue={inputValue}\n\t\t\t\trightSlot={<CopyIcon text={`${selectedMethod} ${inputValue}`} />}\n\t\t\t\t{...(onInputChange !== undefined ? { onChange: onInputChange } : {})}\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nexport { RequestLineEditor, type RequestLineEditorProps, METHOD_COLORS };\n"],"names":["Input","Select","SelectContent","SelectItem","SelectTrigger","SelectValue","cn","CopyIcon","METHOD_COLORS","GET","text","background","border","POST","PUT","PATCH","DELETE","RequestMethodSelector","selectedMethod","setMethod","methods","value","onValueChange","className","map","method","span","RequestLineEditor","inputValue","onInputChange","div","rightSlot","undefined","onChange"],"mappings":";AACA,SAASA,KAAK,QAAQ,mCAA8B;AACpD,SACCC,MAAM,EACNC,aAAa,EACbC,UAAU,EACVC,aAAa,EACbC,WAAW,QACL,oCAA+B;AACtC,SAASC,EAAE,QAAQ,yBAAoB;AACvC,SAASC,QAAQ,QAAQ,iBAAc;AAUvC,MAAMC,gBAAgB;IACrBC,KAAK;QACJC,MAAM;QACNC,YAAY;QACZC,QACC;IACF;IACAC,MAAM;QACLH,MAAM;QACNC,YAAY;QACZC,QAAQ;IACT;IACAE,KAAK;QACJJ,MAAM;QACNC,YAAY;QACZC,QAAQ;IACT;IACAG,OAAO;QACNL,MAAM;QACNC,YAAY;QACZC,QAAQ;IACT;IACAI,QAAQ;QACPN,MAAM;QACNC,YAAY;QACZC,QAAQ;IACT;AACD;AAEA,SAASK,sBAAsB,EAC9BC,cAAc,EACdC,SAAS,EACTC,OAAO,EACiB;IACxB,qBACC,MAACnB;QAAOoB,OAAOH;QAAgBI,eAAeH;;0BAC7C,KAACf;gBACAmB,WAAW,CAAC,+CAA+C,EAAEf,aAAa,CAACU,eAA6C,CAACR,IAAI,CAAC,CAAC,EAAEF,aAAa,CAACU,eAA6C,CAACP,UAAU,CAAC,CAAC,EAAEH,aAAa,CAACU,eAA6C,CAACN,MAAM,EAAE;0BAE/Q,cAAA,KAACP;;0BAEF,KAACH;0BACCkB,QAAQI,GAAG,CAAC,CAACC,uBACb,KAACtB;wBAAwBkB,OAAOI;kCAC/B,cAAA,MAACC;4BACAH,WAAW,GAAGf,aAAa,CAACiB,OAAqC,CAACf,IAAI,EAAE;;gCAEvE;gCACAe;gCAAQ;;;uBALMA;;;;AAYtB;AAEA,SAASE,kBAAkB,EAC1BJ,SAAS,EACTL,cAAc,EACdC,SAAS,EACTC,OAAO,EACPQ,UAAU,EACVC,aAAa,EACW;IACxB,qBACC,MAACC;QAAIP,WAAWjB,GAAG,QAAQiB;;0BAC1B,KAACN;gBACAC,gBAAgBA;gBAChBC,WAAWA;gBACXC,SAASA;;0BAEV,KAACpB;gBACAuB,WAAW,CAAC,eAAe,EAAEf,aAAa,CAACU,eAA6C,CAACN,MAAM,EAAE;gBACjGS,OAAOO;gBACPG,yBAAW,KAACxB;oBAASG,MAAM,GAAGQ,eAAe,CAAC,EAAEU,YAAY;;gBAC3D,GAAIC,kBAAkBG,YAAY;oBAAEC,UAAUJ;gBAAc,IAAI,CAAC,CAAC;;;;AAIvE;AAEA,SAASF,iBAAiB,EAA+BnB,aAAa,GAAG"}
1
+ {"version":3,"sources":["../../../src/components/request-line-editor.tsx"],"sourcesContent":["import { cva } from \"class-variance-authority\";\nimport type * as React from \"react\";\nimport { toast } from \"sonner\";\nimport { Input } from \"#shadcn/components/ui/input\";\nimport {\n\tSelect,\n\tSelectContent,\n\tSelectItem,\n\tSelectTrigger,\n\tSelectValue,\n} from \"#shadcn/components/ui/select\";\nimport { cn } from \"#shadcn/lib/utils\";\nimport { CopyIcon } from \"./copy-icon\";\n\nconst METHODS = [\"GET\", \"POST\", \"PUT\", \"PATCH\", \"DELETE\"] as const;\ntype RequestMethod = (typeof METHODS)[number];\n\nconst requestMethodVariants = cva<{ method: { [K in RequestMethod]: string } }>(\n\tcn(\n\t\t\"border-r-0\",\n\t\t\"rounded-r-none\",\n\t\t\"shadow-none\",\n\t\t\"typo-label\",\n\t\t\"text-left\",\n\t\t\"items-center\",\n\t\t\"w-26\",\n\t),\n\t{\n\t\tvariants: {\n\t\t\tmethod: {\n\t\t\t\tGET: \"text-utility-green [&_svg]:text-utility-green\",\n\t\t\t\tPOST: \"text-utility-yellow [&_svg]:text-utility-yellow\",\n\t\t\t\tPUT: \"text-utility-blue [&_svg]:text-utility-blue \",\n\t\t\t\tPATCH: \"text-utility-violet [&_svg]:text-utility-violet\",\n\t\t\t\tDELETE: \"text-utility-red [&_svg]:text-utility-red\",\n\t\t\t},\n\t\t},\n\t},\n);\n\ntype RequestMethodSelectorProps = {\n\tvalue: string;\n\tonValueChange?: (newMethod: string) => void;\n};\n\nfunction isKnownMethod(candidate: string): candidate is RequestMethod {\n\tconst methods: readonly string[] = METHODS;\n\treturn methods.includes(candidate);\n}\n\nfunction RequestMethodSelector({\n\tvalue,\n\tonValueChange,\n}: RequestMethodSelectorProps) {\n\treturn (\n\t\t<Select\n\t\t\tvalue={value}\n\t\t\t{...(onValueChange ? { onValueChange: onValueChange } : {})}\n\t\t>\n\t\t\t<SelectTrigger\n\t\t\t\tclassName={requestMethodVariants(\n\t\t\t\t\tisKnownMethod(value) ? { method: value } : undefined,\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t<SelectValue>{value}</SelectValue>\n\t\t\t</SelectTrigger>\n\t\t\t<SelectContent>\n\t\t\t\t{METHODS.map((method) => (\n\t\t\t\t\t<SelectItem key={method} value={method}>\n\t\t\t\t\t\t<span className={requestMethodVariants({ method: method })}>\n\t\t\t\t\t\t\t{method}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</SelectItem>\n\t\t\t\t))}\n\t\t\t</SelectContent>\n\t\t</Select>\n\t);\n}\n\ntype RequestLineEditorProps = {\n\tmethod: string;\n\tplaceholder?: string;\n\tautoFocus?: boolean;\n\tonMethodChange: (newMethod: string) => void;\n\tpath?: string | undefined;\n\tonPathChange?: React.ChangeEventHandler<HTMLInputElement>;\n\tclassName?: string;\n};\n\nfunction RequestLineEditor({\n\tclassName,\n\tmethod,\n\tonMethodChange,\n\tpath,\n\tplaceholder,\n\tautoFocus,\n\tonPathChange,\n}: RequestLineEditorProps) {\n\treturn (\n\t\t<div className={cn(\"flex\", className)}>\n\t\t\t<RequestMethodSelector value={method} onValueChange={onMethodChange} />\n\t\t\t<Input\n\t\t\t\tclassName=\"rounded-l-none\"\n\t\t\t\tvalue={path}\n\t\t\t\tautoFocus={autoFocus}\n\t\t\t\tplaceholder={placeholder}\n\t\t\t\trightSlot={\n\t\t\t\t\t<CopyIcon\n\t\t\t\t\t\ttext={`${method} ${path}`}\n\t\t\t\t\t\ttooltipText=\"Copy request line\"\n\t\t\t\t\t\tshowToast={false}\n\t\t\t\t\t\tonCopy={(text) => {\n\t\t\t\t\t\t\t// Custom toast for request line\n\t\t\t\t\t\t\tconst truncatedText =\n\t\t\t\t\t\t\t\ttext.length > 30 ? `${text.slice(0, 30)}...` : text;\n\t\t\t\t\t\t\ttoast(\n\t\t\t\t\t\t\t\t<div className=\"flex flex-col gap-1\">\n\t\t\t\t\t\t\t\t\t<span className=\"typo-body\">Request line copied</span>\n\t\t\t\t\t\t\t\t\t<span className=\"typo-code text-text-secondary\">\n\t\t\t\t\t\t\t\t\t\t{truncatedText}\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t</div>,\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tduration: 2000,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\t{...(onPathChange !== undefined ? { onChange: onPathChange } : {})}\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nexport {\n\tRequestLineEditor,\n\ttype RequestLineEditorProps,\n\trequestMethodVariants,\n};\n"],"names":["cva","toast","Input","Select","SelectContent","SelectItem","SelectTrigger","SelectValue","cn","CopyIcon","METHODS","requestMethodVariants","variants","method","GET","POST","PUT","PATCH","DELETE","isKnownMethod","candidate","methods","includes","RequestMethodSelector","value","onValueChange","className","undefined","map","span","RequestLineEditor","onMethodChange","path","placeholder","autoFocus","onPathChange","div","rightSlot","text","tooltipText","showToast","onCopy","truncatedText","length","slice","duration","onChange"],"mappings":";AAAA,SAASA,GAAG,QAAQ,2BAA2B;AAE/C,SAASC,KAAK,QAAQ,SAAS;AAC/B,SAASC,KAAK,QAAQ,mCAA8B;AACpD,SACCC,MAAM,EACNC,aAAa,EACbC,UAAU,EACVC,aAAa,EACbC,WAAW,QACL,oCAA+B;AACtC,SAASC,EAAE,QAAQ,yBAAoB;AACvC,SAASC,QAAQ,QAAQ,iBAAc;AAEvC,MAAMC,UAAU;IAAC;IAAO;IAAQ;IAAO;IAAS;CAAS;AAGzD,MAAMC,wBAAwBX,IAC7BQ,GACC,cACA,kBACA,eACA,cACA,aACA,gBACA,SAED;IACCI,UAAU;QACTC,QAAQ;YACPC,KAAK;YACLC,MAAM;YACNC,KAAK;YACLC,OAAO;YACPC,QAAQ;QACT;IACD;AACD;AAQD,SAASC,cAAcC,SAAiB;IACvC,MAAMC,UAA6BX;IACnC,OAAOW,QAAQC,QAAQ,CAACF;AACzB;AAEA,SAASG,sBAAsB,EAC9BC,KAAK,EACLC,aAAa,EACe;IAC5B,qBACC,MAACtB;QACAqB,OAAOA;QACN,GAAIC,gBAAgB;YAAEA,eAAeA;QAAc,IAAI,CAAC,CAAC;;0BAE1D,KAACnB;gBACAoB,WAAWf,sBACVQ,cAAcK,SAAS;oBAAEX,QAAQW;gBAAM,IAAIG;0BAG5C,cAAA,KAACpB;8BAAaiB;;;0BAEf,KAACpB;0BACCM,QAAQkB,GAAG,CAAC,CAACf,uBACb,KAACR;wBAAwBmB,OAAOX;kCAC/B,cAAA,KAACgB;4BAAKH,WAAWf,sBAAsB;gCAAEE,QAAQA;4BAAO;sCACtDA;;uBAFcA;;;;AAStB;AAYA,SAASiB,kBAAkB,EAC1BJ,SAAS,EACTb,MAAM,EACNkB,cAAc,EACdC,IAAI,EACJC,WAAW,EACXC,SAAS,EACTC,YAAY,EACY;IACxB,qBACC,MAACC;QAAIV,WAAWlB,GAAG,QAAQkB;;0BAC1B,KAACH;gBAAsBC,OAAOX;gBAAQY,eAAeM;;0BACrD,KAAC7B;gBACAwB,WAAU;gBACVF,OAAOQ;gBACPE,WAAWA;gBACXD,aAAaA;gBACbI,yBACC,KAAC5B;oBACA6B,MAAM,GAAGzB,OAAO,CAAC,EAAEmB,MAAM;oBACzBO,aAAY;oBACZC,WAAW;oBACXC,QAAQ,CAACH;wBACR,gCAAgC;wBAChC,MAAMI,gBACLJ,KAAKK,MAAM,GAAG,KAAK,GAAGL,KAAKM,KAAK,CAAC,GAAG,IAAI,GAAG,CAAC,GAAGN;wBAChDrC,oBACC,MAACmC;4BAAIV,WAAU;;8CACd,KAACG;oCAAKH,WAAU;8CAAY;;8CAC5B,KAACG;oCAAKH,WAAU;8CACdgB;;;4BAGH;4BACCG,UAAU;wBACX;oBAEF;;gBAGD,GAAIV,iBAAiBR,YAAY;oBAAEmB,UAAUX;gBAAa,IAAI,CAAC,CAAC;;;;AAIrE;AAEA,SACCL,iBAAiB,EAEjBnB,qBAAqB,GACpB"}
@@ -1 +1 @@
1
- {"version":3,"file":"request-line-editor.stories.d.ts","sourceRoot":"","sources":["../../../src/components/request-line-editor.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,EACN,iBAAiB,EAEjB,MAAM,uBAAuB,CAAC;AAE/B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,iBAAiB,CAOxC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,iBAAiB,CAAC,CAAC;AA4BhD,eAAO,MAAM,GAAG,EAAE,KAOjB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,KAOlB,CAAC;AAEF,eAAO,MAAM,GAAG,EAAE,KAOjB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAOnB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,KAOpB,CAAC"}
1
+ {"version":3,"file":"request-line-editor.stories.d.ts","sourceRoot":"","sources":["../../../src/components/request-line-editor.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,EACN,iBAAiB,EAEjB,MAAM,uBAAuB,CAAC;AAE/B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,iBAAiB,CAOxC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAuBhD,eAAO,MAAM,GAAG,EAAE,KAMjB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,KAMlB,CAAC;AAEF,eAAO,MAAM,GAAG,EAAE,KAMjB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAMnB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,KAMpB,CAAC"}
@@ -13,9 +13,9 @@ const meta = {
13
13
  ]
14
14
  };
15
15
  export default meta;
16
- function RequestLineEditorWrapper({ selectedMethod, methods, inputValue }) {
17
- const [currentSelectedMethod, setMethod] = React.useState(selectedMethod);
18
- const [currentInputValue, setInputValue] = React.useState(inputValue);
16
+ function RequestLineEditorWrapper({ method, path }) {
17
+ const [currentSelectedMethod, setMethod] = React.useState(method);
18
+ const [currentInputValue, setInputValue] = React.useState(path);
19
19
  const actionSetMethod = (method)=>{
20
20
  action("setMethod")(method);
21
21
  setMethod(method);
@@ -25,24 +25,16 @@ function RequestLineEditorWrapper({ selectedMethod, methods, inputValue }) {
25
25
  setInputValue(event.target.value);
26
26
  };
27
27
  return /*#__PURE__*/ _jsx(RequestLineEditor, {
28
- methods: methods,
29
- selectedMethod: currentSelectedMethod,
30
- setMethod: actionSetMethod,
31
- inputValue: currentInputValue,
32
- onInputChange: actionSetInputValue
28
+ method: currentSelectedMethod,
29
+ onMethodChange: actionSetMethod,
30
+ path: currentInputValue,
31
+ onPathChange: actionSetInputValue
33
32
  });
34
33
  }
35
34
  export const GET = {
36
35
  args: {
37
- selectedMethod: "GET",
38
- methods: [
39
- "GET",
40
- "POST",
41
- "PUT",
42
- "PATCH",
43
- "DELETE"
44
- ],
45
- inputValue: "/fhir/Patient"
36
+ method: "GET",
37
+ path: "/fhir/Patient"
46
38
  },
47
39
  render: (args)=>/*#__PURE__*/ _jsx(RequestLineEditorWrapper, {
48
40
  ...args
@@ -50,15 +42,8 @@ export const GET = {
50
42
  };
51
43
  export const POST = {
52
44
  args: {
53
- selectedMethod: "POST",
54
- methods: [
55
- "GET",
56
- "POST",
57
- "PUT",
58
- "PATCH",
59
- "DELETE"
60
- ],
61
- inputValue: "/fhir/Patient"
45
+ method: "POST",
46
+ path: "/fhir/Patient"
62
47
  },
63
48
  render: (args)=>/*#__PURE__*/ _jsx(RequestLineEditorWrapper, {
64
49
  ...args
@@ -66,15 +51,8 @@ export const POST = {
66
51
  };
67
52
  export const PUT = {
68
53
  args: {
69
- selectedMethod: "PUT",
70
- methods: [
71
- "GET",
72
- "POST",
73
- "PUT",
74
- "PATCH",
75
- "DELETE"
76
- ],
77
- inputValue: "/fhir/Patient"
54
+ method: "PUT",
55
+ path: "/fhir/Patient"
78
56
  },
79
57
  render: (args)=>/*#__PURE__*/ _jsx(RequestLineEditorWrapper, {
80
58
  ...args
@@ -82,15 +60,8 @@ export const PUT = {
82
60
  };
83
61
  export const PATCH = {
84
62
  args: {
85
- selectedMethod: "PATCH",
86
- methods: [
87
- "GET",
88
- "POST",
89
- "PUT",
90
- "PATCH",
91
- "DELETE"
92
- ],
93
- inputValue: "/fhir/Patient"
63
+ method: "PATCH",
64
+ path: "/fhir/Patient"
94
65
  },
95
66
  render: (args)=>/*#__PURE__*/ _jsx(RequestLineEditorWrapper, {
96
67
  ...args
@@ -98,15 +69,8 @@ export const PATCH = {
98
69
  };
99
70
  export const DELETE = {
100
71
  args: {
101
- selectedMethod: "DELETE",
102
- methods: [
103
- "GET",
104
- "POST",
105
- "PUT",
106
- "PATCH",
107
- "DELETE"
108
- ],
109
- inputValue: "/fhir/Patient"
72
+ method: "DELETE",
73
+ path: "/fhir/Patient"
110
74
  },
111
75
  render: (args)=>/*#__PURE__*/ _jsx(RequestLineEditorWrapper, {
112
76
  ...args
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/request-line-editor.stories.tsx"],"sourcesContent":["import type { Meta, StoryObj } from \"@storybook/react-vite\";\nimport * as React from \"react\";\nimport { action } from \"storybook/actions\";\nimport {\n\tRequestLineEditor,\n\ttype RequestLineEditorProps,\n} from \"./request-line-editor\";\n\nconst meta: Meta<typeof RequestLineEditor> = {\n\ttitle: \"Component/Request line editor\",\n\tcomponent: RequestLineEditor,\n\tparameters: {\n\t\tlayout: \"centered\",\n\t},\n\ttags: [\"autodocs\"],\n};\n\nexport default meta;\ntype Story = StoryObj<typeof RequestLineEditor>;\n\nfunction RequestLineEditorWrapper({\n\tselectedMethod,\n\tmethods,\n\tinputValue,\n}: RequestLineEditorProps) {\n\tconst [currentSelectedMethod, setMethod] = React.useState(selectedMethod);\n\tconst [currentInputValue, setInputValue] = React.useState(inputValue);\n\tconst actionSetMethod = (method: string) => {\n\t\taction(\"setMethod\")(method);\n\t\tsetMethod(method);\n\t};\n\tconst actionSetInputValue = (event: React.ChangeEvent<HTMLInputElement>) => {\n\t\taction(\"setMethod\")(event);\n\t\tsetInputValue(event.target.value);\n\t};\n\treturn (\n\t\t<RequestLineEditor\n\t\t\tmethods={methods}\n\t\t\tselectedMethod={currentSelectedMethod}\n\t\t\tsetMethod={actionSetMethod}\n\t\t\tinputValue={currentInputValue}\n\t\t\tonInputChange={actionSetInputValue}\n\t\t/>\n\t);\n}\n\nexport const GET: Story = {\n\targs: {\n\t\tselectedMethod: \"GET\",\n\t\tmethods: [\"GET\", \"POST\", \"PUT\", \"PATCH\", \"DELETE\"],\n\t\tinputValue: \"/fhir/Patient\",\n\t},\n\trender: (args) => <RequestLineEditorWrapper {...args} />,\n};\n\nexport const POST: Story = {\n\targs: {\n\t\tselectedMethod: \"POST\",\n\t\tmethods: [\"GET\", \"POST\", \"PUT\", \"PATCH\", \"DELETE\"],\n\t\tinputValue: \"/fhir/Patient\",\n\t},\n\trender: (args) => <RequestLineEditorWrapper {...args} />,\n};\n\nexport const PUT: Story = {\n\targs: {\n\t\tselectedMethod: \"PUT\",\n\t\tmethods: [\"GET\", \"POST\", \"PUT\", \"PATCH\", \"DELETE\"],\n\t\tinputValue: \"/fhir/Patient\",\n\t},\n\trender: (args) => <RequestLineEditorWrapper {...args} />,\n};\n\nexport const PATCH: Story = {\n\targs: {\n\t\tselectedMethod: \"PATCH\",\n\t\tmethods: [\"GET\", \"POST\", \"PUT\", \"PATCH\", \"DELETE\"],\n\t\tinputValue: \"/fhir/Patient\",\n\t},\n\trender: (args) => <RequestLineEditorWrapper {...args} />,\n};\n\nexport const DELETE: Story = {\n\targs: {\n\t\tselectedMethod: \"DELETE\",\n\t\tmethods: [\"GET\", \"POST\", \"PUT\", \"PATCH\", \"DELETE\"],\n\t\tinputValue: \"/fhir/Patient\",\n\t},\n\trender: (args) => <RequestLineEditorWrapper {...args} />,\n};\n"],"names":["React","action","RequestLineEditor","meta","title","component","parameters","layout","tags","RequestLineEditorWrapper","selectedMethod","methods","inputValue","currentSelectedMethod","setMethod","useState","currentInputValue","setInputValue","actionSetMethod","method","actionSetInputValue","event","target","value","onInputChange","GET","args","render","POST","PUT","PATCH","DELETE"],"mappings":";AACA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,MAAM,QAAQ,oBAAoB;AAC3C,SACCC,iBAAiB,QAEX,2BAAwB;AAE/B,MAAMC,OAAuC;IAC5CC,OAAO;IACPC,WAAWH;IACXI,YAAY;QACXC,QAAQ;IACT;IACAC,MAAM;QAAC;KAAW;AACnB;AAEA,eAAeL,KAAK;AAGpB,SAASM,yBAAyB,EACjCC,cAAc,EACdC,OAAO,EACPC,UAAU,EACc;IACxB,MAAM,CAACC,uBAAuBC,UAAU,GAAGd,MAAMe,QAAQ,CAACL;IAC1D,MAAM,CAACM,mBAAmBC,cAAc,GAAGjB,MAAMe,QAAQ,CAACH;IAC1D,MAAMM,kBAAkB,CAACC;QACxBlB,OAAO,aAAakB;QACpBL,UAAUK;IACX;IACA,MAAMC,sBAAsB,CAACC;QAC5BpB,OAAO,aAAaoB;QACpBJ,cAAcI,MAAMC,MAAM,CAACC,KAAK;IACjC;IACA,qBACC,KAACrB;QACAS,SAASA;QACTD,gBAAgBG;QAChBC,WAAWI;QACXN,YAAYI;QACZQ,eAAeJ;;AAGlB;AAEA,OAAO,MAAMK,MAAa;IACzBC,MAAM;QACLhB,gBAAgB;QAChBC,SAAS;YAAC;YAAO;YAAQ;YAAO;YAAS;SAAS;QAClDC,YAAY;IACb;IACAe,QAAQ,CAACD,qBAAS,KAACjB;YAA0B,GAAGiB,IAAI;;AACrD,EAAE;AAEF,OAAO,MAAME,OAAc;IAC1BF,MAAM;QACLhB,gBAAgB;QAChBC,SAAS;YAAC;YAAO;YAAQ;YAAO;YAAS;SAAS;QAClDC,YAAY;IACb;IACAe,QAAQ,CAACD,qBAAS,KAACjB;YAA0B,GAAGiB,IAAI;;AACrD,EAAE;AAEF,OAAO,MAAMG,MAAa;IACzBH,MAAM;QACLhB,gBAAgB;QAChBC,SAAS;YAAC;YAAO;YAAQ;YAAO;YAAS;SAAS;QAClDC,YAAY;IACb;IACAe,QAAQ,CAACD,qBAAS,KAACjB;YAA0B,GAAGiB,IAAI;;AACrD,EAAE;AAEF,OAAO,MAAMI,QAAe;IAC3BJ,MAAM;QACLhB,gBAAgB;QAChBC,SAAS;YAAC;YAAO;YAAQ;YAAO;YAAS;SAAS;QAClDC,YAAY;IACb;IACAe,QAAQ,CAACD,qBAAS,KAACjB;YAA0B,GAAGiB,IAAI;;AACrD,EAAE;AAEF,OAAO,MAAMK,SAAgB;IAC5BL,MAAM;QACLhB,gBAAgB;QAChBC,SAAS;YAAC;YAAO;YAAQ;YAAO;YAAS;SAAS;QAClDC,YAAY;IACb;IACAe,QAAQ,CAACD,qBAAS,KAACjB;YAA0B,GAAGiB,IAAI;;AACrD,EAAE"}
1
+ {"version":3,"sources":["../../../src/components/request-line-editor.stories.tsx"],"sourcesContent":["import type { Meta, StoryObj } from \"@storybook/react-vite\";\nimport * as React from \"react\";\nimport { action } from \"storybook/actions\";\nimport {\n\tRequestLineEditor,\n\ttype RequestLineEditorProps,\n} from \"./request-line-editor\";\n\nconst meta: Meta<typeof RequestLineEditor> = {\n\ttitle: \"Component/Request line editor\",\n\tcomponent: RequestLineEditor,\n\tparameters: {\n\t\tlayout: \"centered\",\n\t},\n\ttags: [\"autodocs\"],\n};\n\nexport default meta;\ntype Story = StoryObj<typeof RequestLineEditor>;\n\nfunction RequestLineEditorWrapper({ method, path }: RequestLineEditorProps) {\n\tconst [currentSelectedMethod, setMethod] = React.useState(method);\n\tconst [currentInputValue, setInputValue] = React.useState(path);\n\tconst actionSetMethod = (method: string) => {\n\t\taction(\"setMethod\")(method);\n\t\tsetMethod(method);\n\t};\n\tconst actionSetInputValue = (event: React.ChangeEvent<HTMLInputElement>) => {\n\t\taction(\"setMethod\")(event);\n\t\tsetInputValue(event.target.value);\n\t};\n\treturn (\n\t\t<RequestLineEditor\n\t\t\tmethod={currentSelectedMethod}\n\t\t\tonMethodChange={actionSetMethod}\n\t\t\tpath={currentInputValue}\n\t\t\tonPathChange={actionSetInputValue}\n\t\t/>\n\t);\n}\n\nexport const GET: Story = {\n\targs: {\n\t\tmethod: \"GET\",\n\t\tpath: \"/fhir/Patient\",\n\t},\n\trender: (args) => <RequestLineEditorWrapper {...args} />,\n};\n\nexport const POST: Story = {\n\targs: {\n\t\tmethod: \"POST\",\n\t\tpath: \"/fhir/Patient\",\n\t},\n\trender: (args) => <RequestLineEditorWrapper {...args} />,\n};\n\nexport const PUT: Story = {\n\targs: {\n\t\tmethod: \"PUT\",\n\t\tpath: \"/fhir/Patient\",\n\t},\n\trender: (args) => <RequestLineEditorWrapper {...args} />,\n};\n\nexport const PATCH: Story = {\n\targs: {\n\t\tmethod: \"PATCH\",\n\t\tpath: \"/fhir/Patient\",\n\t},\n\trender: (args) => <RequestLineEditorWrapper {...args} />,\n};\n\nexport const DELETE: Story = {\n\targs: {\n\t\tmethod: \"DELETE\",\n\t\tpath: \"/fhir/Patient\",\n\t},\n\trender: (args) => <RequestLineEditorWrapper {...args} />,\n};\n"],"names":["React","action","RequestLineEditor","meta","title","component","parameters","layout","tags","RequestLineEditorWrapper","method","path","currentSelectedMethod","setMethod","useState","currentInputValue","setInputValue","actionSetMethod","actionSetInputValue","event","target","value","onMethodChange","onPathChange","GET","args","render","POST","PUT","PATCH","DELETE"],"mappings":";AACA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,MAAM,QAAQ,oBAAoB;AAC3C,SACCC,iBAAiB,QAEX,2BAAwB;AAE/B,MAAMC,OAAuC;IAC5CC,OAAO;IACPC,WAAWH;IACXI,YAAY;QACXC,QAAQ;IACT;IACAC,MAAM;QAAC;KAAW;AACnB;AAEA,eAAeL,KAAK;AAGpB,SAASM,yBAAyB,EAAEC,MAAM,EAAEC,IAAI,EAA0B;IACzE,MAAM,CAACC,uBAAuBC,UAAU,GAAGb,MAAMc,QAAQ,CAACJ;IAC1D,MAAM,CAACK,mBAAmBC,cAAc,GAAGhB,MAAMc,QAAQ,CAACH;IAC1D,MAAMM,kBAAkB,CAACP;QACxBT,OAAO,aAAaS;QACpBG,UAAUH;IACX;IACA,MAAMQ,sBAAsB,CAACC;QAC5BlB,OAAO,aAAakB;QACpBH,cAAcG,MAAMC,MAAM,CAACC,KAAK;IACjC;IACA,qBACC,KAACnB;QACAQ,QAAQE;QACRU,gBAAgBL;QAChBN,MAAMI;QACNQ,cAAcL;;AAGjB;AAEA,OAAO,MAAMM,MAAa;IACzBC,MAAM;QACLf,QAAQ;QACRC,MAAM;IACP;IACAe,QAAQ,CAACD,qBAAS,KAAChB;YAA0B,GAAGgB,IAAI;;AACrD,EAAE;AAEF,OAAO,MAAME,OAAc;IAC1BF,MAAM;QACLf,QAAQ;QACRC,MAAM;IACP;IACAe,QAAQ,CAACD,qBAAS,KAAChB;YAA0B,GAAGgB,IAAI;;AACrD,EAAE;AAEF,OAAO,MAAMG,MAAa;IACzBH,MAAM;QACLf,QAAQ;QACRC,MAAM;IACP;IACAe,QAAQ,CAACD,qBAAS,KAAChB;YAA0B,GAAGgB,IAAI;;AACrD,EAAE;AAEF,OAAO,MAAMI,QAAe;IAC3BJ,MAAM;QACLf,QAAQ;QACRC,MAAM;IACP;IACAe,QAAQ,CAACD,qBAAS,KAAChB;YAA0B,GAAGgB,IAAI;;AACrD,EAAE;AAEF,OAAO,MAAMK,SAAgB;IAC5BL,MAAM;QACLf,QAAQ;QACRC,MAAM;IACP;IACAe,QAAQ,CAACD,qBAAS,KAAChB;YAA0B,GAAGgB,IAAI;;AACrD,EAAE"}
@@ -0,0 +1,16 @@
1
+ import { type ReactNode } from "react";
2
+ export interface SegmentControlProps {
3
+ defaultValue?: string;
4
+ onValueChange?: (value: string) => void;
5
+ name?: string;
6
+ }
7
+ interface SegmentControlItemProps {
8
+ children: ReactNode;
9
+ value: string;
10
+ }
11
+ declare const SegmentControlItem: ({ children, value }: SegmentControlItemProps) => import("react/jsx-runtime").JSX.Element;
12
+ declare const SegmentControl: ({ children, defaultValue, onValueChange, name, }: SegmentControlProps & {
13
+ children?: ReactNode;
14
+ }) => import("react/jsx-runtime").JSX.Element;
15
+ export { SegmentControl, SegmentControlItem };
16
+ //# sourceMappingURL=segment-control.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"segment-control.d.ts","sourceRoot":"","sources":["../../../src/components/segment-control.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,SAAS,EAAc,MAAM,OAAO,CAAC;AAWlE,MAAM,WAAW,mBAAmB;IACnC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAED,UAAU,uBAAuB;IAChC,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACd;AAeD,QAAA,MAAM,kBAAkB,GAAI,qBAAqB,uBAAuB,4CAqBvE,CAAC;AAEF,QAAA,MAAM,cAAc,GAAI,kDAKrB,mBAAmB,GAAG;IAAE,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,4CAchD,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,CAAC"}
@@ -0,0 +1,48 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { createContext, useContext } from "react";
3
+ import { cn } from "../shadcn/lib/utils.js";
4
+ const SegmentControlContext = /*#__PURE__*/ createContext({});
5
+ const segmentControlItemClass = cn("flex", "items-center", "justify-center", "px-2", "py-0.5", "text-sm", "cursor-pointer", "rounded-2xl", "text-white/80", "peer-checked:bg-bg-primary", "peer-checked:text-text-secondary");
6
+ const SegmentControlItem = ({ children, value })=>{
7
+ const { defaultValue, onValueChange, name } = useContext(SegmentControlContext);
8
+ return /*#__PURE__*/ _jsxs("div", {
9
+ className: "relative",
10
+ children: [
11
+ /*#__PURE__*/ _jsx("input", {
12
+ type: "radio",
13
+ id: `${name}-${value}`,
14
+ name: name,
15
+ value: value,
16
+ defaultChecked: value === defaultValue,
17
+ onChange: (e)=>onValueChange?.(e.target.value),
18
+ className: "sr-only peer"
19
+ }),
20
+ /*#__PURE__*/ _jsx("label", {
21
+ htmlFor: `${name}-${value}`,
22
+ className: segmentControlItemClass,
23
+ children: children
24
+ })
25
+ ]
26
+ });
27
+ };
28
+ const SegmentControl = ({ children, defaultValue, onValueChange, name })=>{
29
+ const contextValue = {
30
+ ...defaultValue !== undefined && {
31
+ defaultValue
32
+ },
33
+ ...onValueChange !== undefined && {
34
+ onValueChange
35
+ },
36
+ name: name || "react-components-segment-control"
37
+ };
38
+ return /*#__PURE__*/ _jsx(SegmentControlContext.Provider, {
39
+ value: contextValue,
40
+ children: /*#__PURE__*/ _jsx("div", {
41
+ className: "inline-flex bg-gray-500 p-0.5 gap-0 rounded-full",
42
+ children: children
43
+ })
44
+ });
45
+ };
46
+ export { SegmentControl, SegmentControlItem };
47
+
48
+ //# sourceMappingURL=segment-control.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/segment-control.tsx"],"sourcesContent":["import { createContext, type ReactNode, useContext } from \"react\";\nimport { cn } from \"#shadcn/lib/utils.js\";\n\ninterface SegmentControlContextType {\n\tdefaultValue?: string;\n\tonValueChange?: (value: string) => void;\n\tname?: string;\n}\n\nconst SegmentControlContext = createContext<SegmentControlContextType>({});\n\nexport interface SegmentControlProps {\n\tdefaultValue?: string;\n\tonValueChange?: (value: string) => void;\n\tname?: string;\n}\n\ninterface SegmentControlItemProps {\n\tchildren: ReactNode;\n\tvalue: string;\n}\nconst segmentControlItemClass = cn(\n\t\"flex\",\n\t\"items-center\",\n\t\"justify-center\",\n\t\"px-2\",\n\t\"py-0.5\",\n\t\"text-sm\",\n\t\"cursor-pointer\",\n\t\"rounded-2xl\",\n\t\"text-white/80\",\n\t\"peer-checked:bg-bg-primary\",\n\t\"peer-checked:text-text-secondary\",\n);\n\nconst SegmentControlItem = ({ children, value }: SegmentControlItemProps) => {\n\tconst { defaultValue, onValueChange, name } = useContext(\n\t\tSegmentControlContext,\n\t);\n\n\treturn (\n\t\t<div className=\"relative\">\n\t\t\t<input\n\t\t\t\ttype=\"radio\"\n\t\t\t\tid={`${name}-${value}`}\n\t\t\t\tname={name}\n\t\t\t\tvalue={value}\n\t\t\t\tdefaultChecked={value === defaultValue}\n\t\t\t\tonChange={(e) => onValueChange?.(e.target.value)}\n\t\t\t\tclassName=\"sr-only peer\"\n\t\t\t/>\n\t\t\t<label htmlFor={`${name}-${value}`} className={segmentControlItemClass}>\n\t\t\t\t{children}\n\t\t\t</label>\n\t\t</div>\n\t);\n};\n\nconst SegmentControl = ({\n\tchildren,\n\tdefaultValue,\n\tonValueChange,\n\tname,\n}: SegmentControlProps & { children?: ReactNode }) => {\n\tconst contextValue: SegmentControlContextType = {\n\t\t...(defaultValue !== undefined && { defaultValue }),\n\t\t...(onValueChange !== undefined && { onValueChange }),\n\t\tname: name || \"react-components-segment-control\",\n\t};\n\n\treturn (\n\t\t<SegmentControlContext.Provider value={contextValue}>\n\t\t\t<div className=\"inline-flex bg-gray-500 p-0.5 gap-0 rounded-full\">\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t</SegmentControlContext.Provider>\n\t);\n};\n\nexport { SegmentControl, SegmentControlItem };\n"],"names":["createContext","useContext","cn","SegmentControlContext","segmentControlItemClass","SegmentControlItem","children","value","defaultValue","onValueChange","name","div","className","input","type","id","defaultChecked","onChange","e","target","label","htmlFor","SegmentControl","contextValue","undefined","Provider"],"mappings":";AAAA,SAASA,aAAa,EAAkBC,UAAU,QAAQ,QAAQ;AAClE,SAASC,EAAE,QAAQ,yBAAuB;AAQ1C,MAAMC,sCAAwBH,cAAyC,CAAC;AAYxE,MAAMI,0BAA0BF,GAC/B,QACA,gBACA,kBACA,QACA,UACA,WACA,kBACA,eACA,iBACA,8BACA;AAGD,MAAMG,qBAAqB,CAAC,EAAEC,QAAQ,EAAEC,KAAK,EAA2B;IACvE,MAAM,EAAEC,YAAY,EAAEC,aAAa,EAAEC,IAAI,EAAE,GAAGT,WAC7CE;IAGD,qBACC,MAACQ;QAAIC,WAAU;;0BACd,KAACC;gBACAC,MAAK;gBACLC,IAAI,GAAGL,KAAK,CAAC,EAAEH,OAAO;gBACtBG,MAAMA;gBACNH,OAAOA;gBACPS,gBAAgBT,UAAUC;gBAC1BS,UAAU,CAACC,IAAMT,gBAAgBS,EAAEC,MAAM,CAACZ,KAAK;gBAC/CK,WAAU;;0BAEX,KAACQ;gBAAMC,SAAS,GAAGX,KAAK,CAAC,EAAEH,OAAO;gBAAEK,WAAWR;0BAC7CE;;;;AAIL;AAEA,MAAMgB,iBAAiB,CAAC,EACvBhB,QAAQ,EACRE,YAAY,EACZC,aAAa,EACbC,IAAI,EAC4C;IAChD,MAAMa,eAA0C;QAC/C,GAAIf,iBAAiBgB,aAAa;YAAEhB;QAAa,CAAC;QAClD,GAAIC,kBAAkBe,aAAa;YAAEf;QAAc,CAAC;QACpDC,MAAMA,QAAQ;IACf;IAEA,qBACC,KAACP,sBAAsBsB,QAAQ;QAAClB,OAAOgB;kBACtC,cAAA,KAACZ;YAAIC,WAAU;sBACbN;;;AAIL;AAEA,SAASgB,cAAc,EAAEjB,kBAAkB,GAAG"}
@@ -0,0 +1,15 @@
1
+ import type { StoryObj } from "@storybook/react-vite";
2
+ declare const meta: {
3
+ title: string;
4
+ component: ({ children, defaultValue, onValueChange, name, }: import("./segment-control").SegmentControlProps & {
5
+ children?: import("react").ReactNode;
6
+ }) => import("react/jsx-runtime").JSX.Element;
7
+ parameters: {
8
+ layout: string;
9
+ };
10
+ tags: string[];
11
+ };
12
+ export default meta;
13
+ type Story = StoryObj<typeof meta>;
14
+ export declare const Default: Story;
15
+ //# sourceMappingURL=segment-control.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"segment-control.stories.d.ts","sourceRoot":"","sources":["../../../src/components/segment-control.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAI5D,QAAA,MAAM,IAAI;;;gBAyBorB,CAAC;;;;;;CAlBxpB,CAAC;AAExC,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAYrB,CAAC"}
@@ -0,0 +1,33 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { SegmentControl, SegmentControlItem } from "./segment-control.js";
3
+ const meta = {
4
+ title: "Component/SegmentControl",
5
+ component: SegmentControl,
6
+ parameters: {
7
+ layout: "centered"
8
+ },
9
+ tags: [
10
+ "autodocs"
11
+ ]
12
+ };
13
+ export default meta;
14
+ export const Default = {
15
+ render: ()=>{
16
+ return /*#__PURE__*/ _jsxs(SegmentControl, {
17
+ defaultValue: "yaml",
18
+ onValueChange: (value)=>console.log("Selected:", value),
19
+ children: [
20
+ /*#__PURE__*/ _jsx(SegmentControlItem, {
21
+ value: "yaml",
22
+ children: "YAML"
23
+ }),
24
+ /*#__PURE__*/ _jsx(SegmentControlItem, {
25
+ value: "json",
26
+ children: "JSON"
27
+ })
28
+ ]
29
+ });
30
+ }
31
+ };
32
+
33
+ //# sourceMappingURL=segment-control.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/segment-control.stories.tsx"],"sourcesContent":["import type { Meta, StoryObj } from \"@storybook/react-vite\";\n\nimport { SegmentControl, SegmentControlItem } from \"./segment-control\";\n\nconst meta = {\n\ttitle: \"Component/SegmentControl\",\n\tcomponent: SegmentControl,\n\tparameters: {\n\t\tlayout: \"centered\",\n\t},\n\ttags: [\"autodocs\"],\n} satisfies Meta<typeof SegmentControl>;\n\nexport default meta;\ntype Story = StoryObj<typeof meta>;\n\nexport const Default: Story = {\n\trender: () => {\n\t\treturn (\n\t\t\t<SegmentControl\n\t\t\t\tdefaultValue=\"yaml\"\n\t\t\t\tonValueChange={(value) => console.log(\"Selected:\", value)}\n\t\t\t>\n\t\t\t\t<SegmentControlItem value=\"yaml\">YAML</SegmentControlItem>\n\t\t\t\t<SegmentControlItem value=\"json\">JSON</SegmentControlItem>\n\t\t\t</SegmentControl>\n\t\t);\n\t},\n};\n"],"names":["SegmentControl","SegmentControlItem","meta","title","component","parameters","layout","tags","Default","render","defaultValue","onValueChange","value","console","log"],"mappings":";AAEA,SAASA,cAAc,EAAEC,kBAAkB,QAAQ,uBAAoB;AAEvE,MAAMC,OAAO;IACZC,OAAO;IACPC,WAAWJ;IACXK,YAAY;QACXC,QAAQ;IACT;IACAC,MAAM;QAAC;KAAW;AACnB;AAEA,eAAeL,KAAK;AAGpB,OAAO,MAAMM,UAAiB;IAC7BC,QAAQ;QACP,qBACC,MAACT;YACAU,cAAa;YACbC,eAAe,CAACC,QAAUC,QAAQC,GAAG,CAAC,aAAaF;;8BAEnD,KAACX;oBAAmBW,OAAM;8BAAO;;8BACjC,KAACX;oBAAmBW,OAAM;8BAAO;;;;IAGpC;AACD,EAAE"}
@@ -0,0 +1,5 @@
1
+ declare const SplitButton: ({ children }: {
2
+ children: React.ReactNode;
3
+ }) => import("react/jsx-runtime").JSX.Element;
4
+ export { SplitButton };
5
+ //# sourceMappingURL=split-button.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"split-button.d.ts","sourceRoot":"","sources":["../../../src/components/split-button.tsx"],"names":[],"mappings":"AAYA,QAAA,MAAM,WAAW,GAAI,cAAc;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,4CAE/D,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn } from "../shadcn/lib/utils.js";
3
+ const splitButtonStyles = cn("flex", "*:data-[slot=button]:rounded-r-none", "*:data-[slot=dropdown-menu-trigger]:px-1", "*:data-[slot=dropdown-menu-trigger]:py-2", "*:data-[slot=dropdown-menu-trigger]:rounded-l-none", "*:data-[slot=dropdown-menu-trigger]:border-l-0", "*:data-[slot=dropdown-menu-trigger]:border-l-0");
4
+ const SplitButton = ({ children })=>{
5
+ return /*#__PURE__*/ _jsx("div", {
6
+ className: splitButtonStyles,
7
+ children: children
8
+ });
9
+ };
10
+ export { SplitButton };
11
+
12
+ //# sourceMappingURL=split-button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/split-button.tsx"],"sourcesContent":["import { cn } from \"#shadcn/lib/utils\";\n\nconst splitButtonStyles = cn(\n\t\"flex\",\n\t\"*:data-[slot=button]:rounded-r-none\",\n\t\"*:data-[slot=dropdown-menu-trigger]:px-1\",\n\t\"*:data-[slot=dropdown-menu-trigger]:py-2\",\n\t\"*:data-[slot=dropdown-menu-trigger]:rounded-l-none\",\n\t\"*:data-[slot=dropdown-menu-trigger]:border-l-0\",\n\t\"*:data-[slot=dropdown-menu-trigger]:border-l-0\",\n);\n\nconst SplitButton = ({ children }: { children: React.ReactNode }) => {\n\treturn <div className={splitButtonStyles}>{children}</div>;\n};\n\nexport { SplitButton };\n"],"names":["cn","splitButtonStyles","SplitButton","children","div","className"],"mappings":";AAAA,SAASA,EAAE,QAAQ,yBAAoB;AAEvC,MAAMC,oBAAoBD,GACzB,QACA,uCACA,4CACA,4CACA,sDACA,kDACA;AAGD,MAAME,cAAc,CAAC,EAAEC,QAAQ,EAAiC;IAC/D,qBAAO,KAACC;QAAIC,WAAWJ;kBAAoBE;;AAC5C;AAEA,SAASD,WAAW,GAAG"}
@@ -0,0 +1,7 @@
1
+ import type { Meta, StoryObj } from "@storybook/react-vite";
2
+ import { SplitButton } from "./split-button";
3
+ declare const meta: Meta<typeof SplitButton>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof SplitButton>;
6
+ export declare const Default: Story;
7
+ //# sourceMappingURL=split-button.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"split-button.stories.d.ts","sourceRoot":"","sources":["../../../src/components/split-button.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAW5D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,WAAW,CAGlC,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,WAAW,CAAC,CAAC;AAE1C,eAAO,MAAM,OAAO,EAAE,KA0BrB,CAAC"}
@@ -0,0 +1,57 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ChevronDown, Plus, Save } from "lucide-react";
3
+ import { Button } from "../shadcn/components/ui/button.js";
4
+ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from "../shadcn/components/ui/dropdown-menu.js";
5
+ import { SplitButton } from "./split-button.js";
6
+ const meta = {
7
+ title: "Component/SplitButton",
8
+ component: SplitButton
9
+ };
10
+ export default meta;
11
+ export const Default = {
12
+ render: ()=>/*#__PURE__*/ _jsxs(SplitButton, {
13
+ children: [
14
+ /*#__PURE__*/ _jsxs(Button, {
15
+ variant: "secondary",
16
+ children: [
17
+ /*#__PURE__*/ _jsx(Save, {}),
18
+ "Save"
19
+ ]
20
+ }),
21
+ /*#__PURE__*/ _jsxs(DropdownMenu, {
22
+ children: [
23
+ /*#__PURE__*/ _jsx(DropdownMenuTrigger, {
24
+ asChild: true,
25
+ children: /*#__PURE__*/ _jsx(Button, {
26
+ variant: "secondary",
27
+ children: /*#__PURE__*/ _jsx(ChevronDown, {})
28
+ })
29
+ }),
30
+ /*#__PURE__*/ _jsxs(DropdownMenuContent, {
31
+ children: [
32
+ /*#__PURE__*/ _jsx(DropdownMenuLabel, {
33
+ children: "Save to collection:"
34
+ }),
35
+ /*#__PURE__*/ _jsx(DropdownMenuSeparator, {}),
36
+ /*#__PURE__*/ _jsx(DropdownMenuItem, {
37
+ disabled: true,
38
+ children: "No collections"
39
+ }),
40
+ /*#__PURE__*/ _jsx(DropdownMenuSeparator, {}),
41
+ /*#__PURE__*/ _jsxs(DropdownMenuItem, {
42
+ children: [
43
+ /*#__PURE__*/ _jsx(Plus, {
44
+ className: "text-fg-link"
45
+ }),
46
+ "New collection"
47
+ ]
48
+ })
49
+ ]
50
+ })
51
+ ]
52
+ })
53
+ ]
54
+ })
55
+ };
56
+
57
+ //# sourceMappingURL=split-button.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/split-button.stories.tsx"],"sourcesContent":["import type { Meta, StoryObj } from \"@storybook/react-vite\";\nimport { ChevronDown, Plus, Save } from \"lucide-react\";\nimport { Button } from \"#shadcn/components/ui/button.js\";\nimport {\n\tDropdownMenu,\n\tDropdownMenuContent,\n\tDropdownMenuItem,\n\tDropdownMenuLabel,\n\tDropdownMenuSeparator,\n\tDropdownMenuTrigger,\n} from \"#shadcn/components/ui/dropdown-menu.js\";\nimport { SplitButton } from \"./split-button\";\n\nconst meta: Meta<typeof SplitButton> = {\n\ttitle: \"Component/SplitButton\",\n\tcomponent: SplitButton,\n};\n\nexport default meta;\n\ntype Story = StoryObj<typeof SplitButton>;\n\nexport const Default: Story = {\n\trender: () => (\n\t\t<SplitButton>\n\t\t\t<Button variant=\"secondary\">\n\t\t\t\t<Save />\n\t\t\t\tSave\n\t\t\t</Button>\n\t\t\t<DropdownMenu>\n\t\t\t\t<DropdownMenuTrigger asChild>\n\t\t\t\t\t<Button variant=\"secondary\">\n\t\t\t\t\t\t<ChevronDown />\n\t\t\t\t\t</Button>\n\t\t\t\t</DropdownMenuTrigger>\n\t\t\t\t<DropdownMenuContent>\n\t\t\t\t\t<DropdownMenuLabel>Save to collection:</DropdownMenuLabel>\n\t\t\t\t\t<DropdownMenuSeparator />\n\t\t\t\t\t<DropdownMenuItem disabled>No collections</DropdownMenuItem>\n\t\t\t\t\t<DropdownMenuSeparator />\n\t\t\t\t\t<DropdownMenuItem>\n\t\t\t\t\t\t<Plus className=\"text-fg-link\" />\n\t\t\t\t\t\tNew collection\n\t\t\t\t\t</DropdownMenuItem>\n\t\t\t\t</DropdownMenuContent>\n\t\t\t</DropdownMenu>\n\t\t</SplitButton>\n\t),\n};\n"],"names":["ChevronDown","Plus","Save","Button","DropdownMenu","DropdownMenuContent","DropdownMenuItem","DropdownMenuLabel","DropdownMenuSeparator","DropdownMenuTrigger","SplitButton","meta","title","component","Default","render","variant","asChild","disabled","className"],"mappings":";AACA,SAASA,WAAW,EAAEC,IAAI,EAAEC,IAAI,QAAQ,eAAe;AACvD,SAASC,MAAM,QAAQ,oCAAkC;AACzD,SACCC,YAAY,EACZC,mBAAmB,EACnBC,gBAAgB,EAChBC,iBAAiB,EACjBC,qBAAqB,EACrBC,mBAAmB,QACb,2CAAyC;AAChD,SAASC,WAAW,QAAQ,oBAAiB;AAE7C,MAAMC,OAAiC;IACtCC,OAAO;IACPC,WAAWH;AACZ;AAEA,eAAeC,KAAK;AAIpB,OAAO,MAAMG,UAAiB;IAC7BC,QAAQ,kBACP,MAACL;;8BACA,MAACP;oBAAOa,SAAQ;;sCACf,KAACd;wBAAO;;;8BAGT,MAACE;;sCACA,KAACK;4BAAoBQ,OAAO;sCAC3B,cAAA,KAACd;gCAAOa,SAAQ;0CACf,cAAA,KAAChB;;;sCAGH,MAACK;;8CACA,KAACE;8CAAkB;;8CACnB,KAACC;8CACD,KAACF;oCAAiBY,QAAQ;8CAAC;;8CAC3B,KAACV;8CACD,MAACF;;sDACA,KAACL;4CAAKkB,WAAU;;wCAAiB;;;;;;;;;AAOvC,EAAE"}
@@ -0,0 +1,22 @@
1
+ import type { ItemInstance, TreeInstance } from "@headless-tree/core";
2
+ import React from "react";
3
+ interface TreeViewItem<T> {
4
+ name: string;
5
+ children?: string[];
6
+ meta?: T;
7
+ }
8
+ declare function TreeView<T>({ rootItemId, items, selectedItemId, expandedItemIds, onSelectItem, customItemView, onRename, disableHover, zebra, horizontalLines, hideChevron, }: {
9
+ rootItemId: string;
10
+ selectedItemId?: string;
11
+ expandedItemIds?: string[];
12
+ onSelectItem?: (item: ItemInstance<TreeViewItem<T>>) => void;
13
+ items: Record<string, TreeViewItem<T>>;
14
+ customItemView?: (item: ItemInstance<TreeViewItem<T>>, tree: TreeInstance<TreeViewItem<T>>) => React.ReactNode;
15
+ onRename?: ((item: ItemInstance<TreeViewItem<T>>, value: string) => void) | undefined;
16
+ disableHover?: boolean;
17
+ zebra?: boolean;
18
+ horizontalLines?: boolean;
19
+ hideChevron?: boolean;
20
+ }): import("react/jsx-runtime").JSX.Element;
21
+ export { TreeView, type TreeViewItem, type TreeInstance };
22
+ //# sourceMappingURL=tree-view.d.ts.map