@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,17 +1,53 @@
1
1
  import { Check, Copy } from "lucide-react";
2
2
  import * as React from "react";
3
+ import { toast } from "sonner";
4
+ import {
5
+ Tooltip,
6
+ TooltipContent,
7
+ TooltipTrigger,
8
+ } from "#shadcn/components/ui/tooltip";
3
9
 
4
10
  interface CopyIconProps {
5
11
  text: string;
12
+ showTooltip?: boolean;
13
+ tooltipText?: string;
14
+ showToast?: boolean;
15
+ onCopy?: (text: string) => void;
6
16
  }
7
17
 
8
- function CopyIcon({ text }: CopyIconProps) {
18
+ function CopyIcon({
19
+ text,
20
+ showTooltip = true,
21
+ tooltipText = "Copy",
22
+ showToast = true,
23
+ onCopy,
24
+ ...props
25
+ }: CopyIconProps) {
9
26
  const [isActive, setIsActive] = React.useState(false);
10
27
 
11
28
  async function handleClick() {
12
29
  try {
13
30
  await navigator.clipboard.writeText(text);
14
31
  setIsActive(true);
32
+
33
+ if (showToast) {
34
+ const truncatedText =
35
+ text.length > 30 ? `${text.slice(0, 30)}...` : text;
36
+ toast(
37
+ <div className="flex flex-col gap-1">
38
+ <span className="typo-body">Successfully copied</span>
39
+ <span className="typo-code text-text-secondary">
40
+ {truncatedText}
41
+ </span>
42
+ </div>,
43
+ {
44
+ duration: 2000,
45
+ },
46
+ );
47
+ }
48
+
49
+ onCopy?.(text);
50
+
15
51
  setTimeout(() => {
16
52
  setIsActive(false);
17
53
  }, 1000);
@@ -20,11 +56,29 @@ function CopyIcon({ text }: CopyIconProps) {
20
56
  }
21
57
  }
22
58
 
23
- return (
24
- <button type="button" onClick={handleClick} style={{ cursor: "pointer" }}>
59
+ const button = (
60
+ <button
61
+ {...props}
62
+ type="button"
63
+ onClick={handleClick}
64
+ style={{ cursor: "pointer" }}
65
+ >
25
66
  {isActive ? <Check /> : <Copy />}
26
67
  </button>
27
68
  );
69
+
70
+ if (!showTooltip) {
71
+ return button;
72
+ }
73
+
74
+ return (
75
+ <Tooltip>
76
+ <TooltipTrigger asChild>{button}</TooltipTrigger>
77
+ <TooltipContent>
78
+ <p>{tooltipText}</p>
79
+ </TooltipContent>
80
+ </Tooltip>
81
+ );
28
82
  }
29
83
 
30
84
  export { CopyIcon };
@@ -0,0 +1,38 @@
1
+ import type { Meta, StoryObj } from "@storybook/react-vite";
2
+ import { DataTable, type DataTableProps } from "./data-table";
3
+
4
+ const meta: Meta<typeof DataTable> = {
5
+ title: "Component/Data table",
6
+ component: DataTable,
7
+ tags: ["autodocs"],
8
+ };
9
+
10
+ export default meta;
11
+ type Story = StoryObj<typeof DataTable>;
12
+
13
+ function DataTableWrapper<TData, TValue>({
14
+ columns,
15
+ data,
16
+ }: DataTableProps<TData, TValue>) {
17
+ return <DataTable columns={columns} data={data} />;
18
+ }
19
+
20
+ export const Default: Story = {
21
+ args: {
22
+ columns: [
23
+ {
24
+ header: "Name",
25
+ accessorKey: "name",
26
+ },
27
+ {
28
+ header: "Age",
29
+ accessorKey: "age",
30
+ },
31
+ ],
32
+ data: [{ name: "John Doe", age: 30 }],
33
+ },
34
+ parameters: {
35
+ layout: "fullscreen",
36
+ },
37
+ render: (args) => <DataTableWrapper {...args} />,
38
+ };
@@ -0,0 +1,117 @@
1
+ "use client";
2
+
3
+ import {
4
+ type ColumnDef,
5
+ flexRender,
6
+ getCoreRowModel,
7
+ useReactTable,
8
+ } from "@tanstack/react-table";
9
+
10
+ import {
11
+ Table,
12
+ TableBody,
13
+ TableCell,
14
+ TableHead,
15
+ TableHeader,
16
+ TableRow,
17
+ } from "../shadcn/components/ui/table";
18
+
19
+ export interface DataTableProps<TData, TValue> {
20
+ columns: ColumnDef<TData, TValue>[];
21
+ data: TData[];
22
+ }
23
+
24
+ export function DataTable<TData, TValue>({
25
+ columns,
26
+ data,
27
+ }: DataTableProps<TData, TValue>) {
28
+ const table = useReactTable({
29
+ data,
30
+ columns,
31
+ getCoreRowModel: getCoreRowModel(),
32
+ columnResizeMode: "onChange",
33
+ enableColumnResizing: true,
34
+ });
35
+
36
+ return (
37
+ <div className="overflow-hidden w-full">
38
+ <Table className="w-full">
39
+ <TableHeader>
40
+ {table.getHeaderGroups().map((headerGroup) => (
41
+ <TableRow key={headerGroup.id}>
42
+ {headerGroup.headers.map((header) => {
43
+ return (
44
+ <TableHead
45
+ key={header.id}
46
+ className="relative group border"
47
+ style={{
48
+ width:
49
+ header.column.getIndex() ===
50
+ headerGroup.headers.length - 1
51
+ ? "w-full"
52
+ : header.getSize(),
53
+ }}
54
+ >
55
+ {header.isPlaceholder
56
+ ? null
57
+ : flexRender(
58
+ header.column.columnDef.header,
59
+ header.getContext(),
60
+ )}
61
+ {header.column.getCanResize() && (
62
+ <div
63
+ {...{
64
+ onMouseDown: header.getResizeHandler(),
65
+ onTouchStart: header.getResizeHandler(),
66
+ className: `hidden group-hover:block absolute top-0 right-0 h-full w-1 bg-border-secondary cursor-col-resize hover:bg-border-secondary`,
67
+ style: {
68
+ userSelect: "none",
69
+ touchAction: "none",
70
+ },
71
+ }}
72
+ />
73
+ )}
74
+ </TableHead>
75
+ );
76
+ })}
77
+ </TableRow>
78
+ ))}
79
+ </TableHeader>
80
+ <TableBody>
81
+ {table.getRowModel().rows?.length ? (
82
+ table.getRowModel().rows.map((row) => (
83
+ <TableRow
84
+ key={row.id}
85
+ data-state={row.getIsSelected() && "selected"}
86
+ >
87
+ {row.getVisibleCells().map((cell) => (
88
+ <TableCell
89
+ className="border"
90
+ key={cell.id}
91
+ style={{
92
+ width:
93
+ cell.column.getIndex() ===
94
+ row.getVisibleCells().length - 1
95
+ ? "w-full"
96
+ : cell.column.getSize(),
97
+ }}
98
+ >
99
+ {flexRender(cell.column.columnDef.cell, cell.getContext())}
100
+ </TableCell>
101
+ ))}
102
+ </TableRow>
103
+ ))
104
+ ) : (
105
+ <TableRow>
106
+ <TableCell colSpan={columns.length} className="h-24 text-center">
107
+ No results.
108
+ </TableCell>
109
+ </TableRow>
110
+ )}
111
+ </TableBody>
112
+ </Table>
113
+ </div>
114
+ );
115
+ }
116
+
117
+ export type { ColumnDef };
@@ -0,0 +1,439 @@
1
+ import type { Meta, StoryObj } from "@storybook/react-vite";
2
+ import { type FhirStructure, FhirStructureView } from "./fhir-structure-view";
3
+ import type { TreeViewItem } from "./tree-view";
4
+
5
+ const meta: Meta<typeof FhirStructureView> = {
6
+ title: "Component/FHIRStructureView",
7
+ component: FhirStructureView,
8
+ };
9
+
10
+ export default meta;
11
+
12
+ type Story = StoryObj<typeof FhirStructureView>;
13
+
14
+ const tree: Record<string, TreeViewItem<FhirStructure>> = {
15
+ root: {
16
+ name: "Root",
17
+ children: ["Patient"],
18
+ },
19
+ Patient: {
20
+ name: "Patient",
21
+ meta: {
22
+ type: "Resource",
23
+ min: "0",
24
+ max: "*",
25
+ desc: "Information about an individual or animal receiving health care services",
26
+ },
27
+ children: [
28
+ "Patient.id",
29
+ "Patient.meta",
30
+ "Patient.implicitRules",
31
+ "Patient.language",
32
+ "Patient.text",
33
+ "Patient.contained",
34
+ "Patient.extension",
35
+ "Patient.modifierExtension",
36
+ "Patient.identifier",
37
+ "Patient.active",
38
+ "Patient.name",
39
+ "Patient.telecom",
40
+ "Patient.gender",
41
+ "Patient.birthDate",
42
+ "Patient.deceased",
43
+ "Patient.address",
44
+ "Patient.maritalStatus",
45
+ "Patient.multipleBirth",
46
+ "Patient.photo",
47
+ "Patient.contact",
48
+ "Patient.communication",
49
+ "Patient.generalPractitioner",
50
+ "Patient.managingOrganization",
51
+ "Patient.link",
52
+ ],
53
+ },
54
+ "Patient.id": {
55
+ name: "id",
56
+ meta: {
57
+ type: "id",
58
+ min: "0",
59
+ max: "1",
60
+ isSummary: true,
61
+ desc: "Logical id of this artifact",
62
+ },
63
+ },
64
+ "Patient.meta": {
65
+ name: "meta",
66
+ meta: {
67
+ type: "Meta",
68
+ min: "0",
69
+ max: "1",
70
+ isSummary: true,
71
+ desc: "Metadata about the resource",
72
+ },
73
+ },
74
+ "Patient.implicitRules": {
75
+ name: "implicitRules",
76
+ meta: {
77
+ type: "uri",
78
+ min: "0",
79
+ max: "1",
80
+ isSummary: true,
81
+ isModifier: true,
82
+ desc: "A set of rules under which this content was created",
83
+ },
84
+ },
85
+ "Patient.language": {
86
+ name: "language",
87
+ meta: {
88
+ type: "code",
89
+ min: "0",
90
+ max: "1",
91
+ desc: "Language of the resource content",
92
+ },
93
+ },
94
+ "Patient.text": {
95
+ name: "text",
96
+ meta: {
97
+ type: "Narrative",
98
+ min: "0",
99
+ max: "1",
100
+ desc: "Text summary of the resource, for human interpretation",
101
+ },
102
+ },
103
+ "Patient.contained": {
104
+ name: "contained",
105
+ meta: {
106
+ type: "Resource",
107
+ min: "0",
108
+ max: "*",
109
+ desc: "Contained, inline Resources",
110
+ },
111
+ },
112
+ "Patient.extension": {
113
+ name: "extension",
114
+ meta: {
115
+ type: "Extension",
116
+ min: "0",
117
+ max: "*",
118
+ desc: "Additional content defined by implementations",
119
+ },
120
+ },
121
+ "Patient.modifierExtension": {
122
+ name: "modifierExtension",
123
+ meta: {
124
+ type: "Extension",
125
+ min: "0",
126
+ max: "*",
127
+ isSummary: true,
128
+ isModifier: true,
129
+ desc: "Extensions that cannot be ignored",
130
+ },
131
+ },
132
+ "Patient.identifier": {
133
+ name: "identifier",
134
+ meta: {
135
+ type: "Identifier",
136
+ min: "0",
137
+ max: "*",
138
+ isSummary: true,
139
+ desc: "An identifier for this patient",
140
+ },
141
+ },
142
+ "Patient.active": {
143
+ name: "active",
144
+ meta: {
145
+ type: "boolean",
146
+ min: "0",
147
+ max: "1",
148
+ isSummary: true,
149
+ isModifier: true,
150
+ desc: "Whether this patient's record is in active use",
151
+ },
152
+ },
153
+ "Patient.name": {
154
+ name: "name",
155
+ meta: {
156
+ type: "HumanName",
157
+ min: "0",
158
+ max: "*",
159
+ isSummary: true,
160
+ desc: "A name associated with the patient",
161
+ },
162
+ },
163
+ "Patient.telecom": {
164
+ name: "telecom",
165
+ meta: {
166
+ type: "ContactPoint",
167
+ min: "0",
168
+ max: "*",
169
+ isSummary: true,
170
+ desc: "A contact detail for the individual",
171
+ },
172
+ },
173
+ "Patient.gender": {
174
+ name: "gender",
175
+ meta: {
176
+ type: "code",
177
+ min: "0",
178
+ max: "1",
179
+ isSummary: true,
180
+ desc: "male | female | other | unknown",
181
+ },
182
+ },
183
+ "Patient.birthDate": {
184
+ name: "birthDate",
185
+ meta: {
186
+ type: "date",
187
+ min: "0",
188
+ max: "1",
189
+ isSummary: true,
190
+ desc: "The date of birth for the individual",
191
+ },
192
+ },
193
+ "Patient.deceased": {
194
+ name: "deceased[x]",
195
+ meta: {
196
+ type: "union",
197
+ min: "0",
198
+ max: "1",
199
+ isSummary: true,
200
+ isModifier: true,
201
+ desc: "Indicates if the individual is deceased or not",
202
+ },
203
+ children: ["Patient.deceasedBoolean", "Patient.deceasedDateTime"],
204
+ },
205
+ "Patient.deceasedBoolean": {
206
+ name: "deceasedBoolean",
207
+ meta: {
208
+ type: "boolean",
209
+ },
210
+ },
211
+ "Patient.deceasedDateTime": {
212
+ name: "deceasedDateTime",
213
+ meta: {
214
+ type: "dateTime",
215
+ lastNode: true,
216
+ },
217
+ },
218
+ "Patient.address": {
219
+ name: "address",
220
+ meta: {
221
+ type: "Address",
222
+ min: "0",
223
+ max: "*",
224
+ isSummary: true,
225
+ desc: "An address for the individual",
226
+ },
227
+ },
228
+ "Patient.maritalStatus": {
229
+ name: "maritalStatus",
230
+ meta: {
231
+ type: "CodeableConcept",
232
+ min: "0",
233
+ max: "1",
234
+ desc: "Marital (civil) status of a patient",
235
+ },
236
+ },
237
+ "Patient.multipleBirth": {
238
+ name: "multipleBirth[x]",
239
+ meta: {
240
+ type: "union",
241
+ min: "0",
242
+ max: "1",
243
+ desc: "Whether patient is part of a multiple birth",
244
+ },
245
+ children: ["Patient.multipleBirthBoolean", "Patient.multipleBirthInteger"],
246
+ },
247
+ "Patient.multipleBirthBoolean": {
248
+ name: "multipleBirthBoolean",
249
+ meta: {
250
+ type: "boolean",
251
+ },
252
+ },
253
+ "Patient.multipleBirthInteger": {
254
+ name: "multipleBirthInteger",
255
+ meta: {
256
+ type: "integer",
257
+ lastNode: true,
258
+ },
259
+ },
260
+ "Patient.photo": {
261
+ name: "photo",
262
+ meta: {
263
+ type: "Attachment",
264
+ min: "0",
265
+ max: "*",
266
+ desc: "Image of the patient",
267
+ },
268
+ },
269
+ "Patient.contact": {
270
+ name: "contact",
271
+ meta: {
272
+ type: "BackboneElement",
273
+ min: "0",
274
+ max: "*",
275
+ desc: "A contact party (e.g. guardian, partner, friend) for the patient",
276
+ },
277
+ children: [
278
+ "Patient.contact.relationship",
279
+ "Patient.contact.name",
280
+ "Patient.contact.telecom",
281
+ "Patient.contact.address",
282
+ "Patient.contact.gender",
283
+ "Patient.contact.organization",
284
+ "Patient.contact.period",
285
+ ],
286
+ },
287
+ "Patient.contact.relationship": {
288
+ name: "relationship",
289
+ meta: {
290
+ type: "CodeableConcept",
291
+ min: "0",
292
+ max: "*",
293
+ desc: "The kind of relationship",
294
+ },
295
+ },
296
+ "Patient.contact.name": {
297
+ name: "name",
298
+ meta: {
299
+ type: "HumanName",
300
+ min: "0",
301
+ max: "1",
302
+ desc: "A name associated with the contact person",
303
+ },
304
+ },
305
+ "Patient.contact.telecom": {
306
+ name: "telecom",
307
+ meta: {
308
+ type: "ContactPoint",
309
+ min: "0",
310
+ max: "*",
311
+ desc: "A contact detail for the person",
312
+ },
313
+ },
314
+ "Patient.contact.address": {
315
+ name: "address",
316
+ meta: {
317
+ type: "Address",
318
+ min: "0",
319
+ max: "1",
320
+ desc: "Address for the contact person",
321
+ },
322
+ },
323
+ "Patient.contact.gender": {
324
+ name: "gender",
325
+ meta: {
326
+ type: "code",
327
+ min: "0",
328
+ max: "1",
329
+ desc: "male | female | other | unknown",
330
+ },
331
+ },
332
+ "Patient.contact.organization": {
333
+ name: "organization",
334
+ meta: {
335
+ type: "Reference",
336
+ min: "0",
337
+ max: "1",
338
+ desc: "Organization that is associated with the contact",
339
+ },
340
+ },
341
+ "Patient.contact.period": {
342
+ name: "period",
343
+ meta: {
344
+ type: "Period",
345
+ min: "0",
346
+ max: "1",
347
+ lastNode: true,
348
+ desc: "The period during which this contact person or organization is valid to be contacted relating to this patient",
349
+ },
350
+ },
351
+ "Patient.communication": {
352
+ name: "communication",
353
+ meta: {
354
+ type: "BackboneElement",
355
+ min: "0",
356
+ max: "*",
357
+ desc: "A language which may be used to communicate with the patient about his or her health",
358
+ },
359
+ children: [
360
+ "Patient.communication.language",
361
+ "Patient.communication.preferred",
362
+ ],
363
+ },
364
+ "Patient.communication.language": {
365
+ name: "language",
366
+ meta: {
367
+ type: "CodeableConcept",
368
+ min: "1",
369
+ max: "1",
370
+ desc: "The language which can be used to communicate with the patient about his or her health",
371
+ },
372
+ },
373
+ "Patient.communication.preferred": {
374
+ name: "preferred",
375
+ meta: {
376
+ type: "boolean",
377
+ min: "0",
378
+ max: "1",
379
+ lastNode: true,
380
+ desc: "Language preference indicator",
381
+ },
382
+ },
383
+ "Patient.generalPractitioner": {
384
+ name: "generalPractitioner",
385
+ meta: {
386
+ type: "Reference",
387
+ min: "0",
388
+ max: "*",
389
+ desc: "Patient's nominated primary care provider",
390
+ },
391
+ },
392
+ "Patient.managingOrganization": {
393
+ name: "managingOrganization",
394
+ meta: {
395
+ type: "Reference",
396
+ min: "0",
397
+ max: "1",
398
+ isSummary: true,
399
+ desc: "Organization that is the custodian of the patient record",
400
+ },
401
+ },
402
+ "Patient.link": {
403
+ name: "link",
404
+ meta: {
405
+ type: "BackboneElement",
406
+ min: "0",
407
+ max: "*",
408
+ isSummary: true,
409
+ isModifier: true,
410
+ desc: "Link to a Patient or RelatedPerson resource that concerns the same actual individual",
411
+ },
412
+ children: ["Patient.link.other", "Patient.link.type"],
413
+ },
414
+ "Patient.link.other": {
415
+ name: "other",
416
+ meta: {
417
+ type: "Reference",
418
+ min: "1",
419
+ max: "1",
420
+ isSummary: true,
421
+ desc: "The other patient or related person resource that the link refers to",
422
+ },
423
+ },
424
+ "Patient.link.type": {
425
+ name: "type",
426
+ meta: {
427
+ type: "code",
428
+ min: "1",
429
+ max: "1",
430
+ isSummary: true,
431
+ lastNode: true,
432
+ desc: "replaced-by | replaces | refer | seealso",
433
+ },
434
+ },
435
+ };
436
+
437
+ export const Default: Story = {
438
+ render: () => <FhirStructureView tree={tree} />,
439
+ };