@pihanga2/shadcn 0.1.0

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 (399) hide show
  1. package/README.md +114 -0
  2. package/cards/badge/badge.component.d.ts +14 -0
  3. package/cards/badge/badge.component.js +18 -0
  4. package/cards/badge/badge.component.js.map +1 -0
  5. package/cards/badge/badge.types.d.ts +37 -0
  6. package/cards/badge/badge.types.js +7 -0
  7. package/cards/badge/badge.types.js.map +1 -0
  8. package/cards/badge/index.d.ts +1 -0
  9. package/cards/badge/index.js +12 -0
  10. package/cards/badge/index.js.map +1 -0
  11. package/cards/box/box.component.d.ts +4 -0
  12. package/cards/box/box.component.js +24 -0
  13. package/cards/box/box.component.js.map +1 -0
  14. package/cards/box/box.types.d.ts +71 -0
  15. package/cards/box/box.types.js +7 -0
  16. package/cards/box/box.types.js.map +1 -0
  17. package/cards/box/index.d.ts +1 -0
  18. package/cards/box/index.js +12 -0
  19. package/cards/box/index.js.map +1 -0
  20. package/cards/button/button.component.d.ts +4 -0
  21. package/cards/button/button.component.js +71 -0
  22. package/cards/button/button.component.js.map +1 -0
  23. package/cards/button/button.types.d.ts +106 -0
  24. package/cards/button/button.types.js +7 -0
  25. package/cards/button/button.types.js.map +1 -0
  26. package/cards/button/index.d.ts +1 -0
  27. package/cards/button/index.js +13 -0
  28. package/cards/button/index.js.map +1 -0
  29. package/cards/checkbox/checkbox.component.d.ts +4 -0
  30. package/cards/checkbox/checkbox.component.js +36 -0
  31. package/cards/checkbox/checkbox.component.js.map +1 -0
  32. package/cards/checkbox/checkbox.types.d.ts +37 -0
  33. package/cards/checkbox/checkbox.types.js +7 -0
  34. package/cards/checkbox/checkbox.types.js.map +1 -0
  35. package/cards/checkbox/index.d.ts +1 -0
  36. package/cards/checkbox/index.js +13 -0
  37. package/cards/checkbox/index.js.map +1 -0
  38. package/cards/conditional/conditional.component.d.ts +11 -0
  39. package/cards/conditional/conditional.component.js +15 -0
  40. package/cards/conditional/conditional.component.js.map +1 -0
  41. package/cards/conditional/conditional.types.d.ts +29 -0
  42. package/cards/conditional/conditional.types.js +7 -0
  43. package/cards/conditional/conditional.types.js.map +1 -0
  44. package/cards/conditional/index.d.ts +1 -0
  45. package/cards/conditional/index.js +12 -0
  46. package/cards/conditional/index.js.map +1 -0
  47. package/cards/core-index.d.ts +30 -0
  48. package/cards/core-index.js +61 -0
  49. package/cards/dataTable/dataTable.component.d.ts +4 -0
  50. package/cards/dataTable/dataTable.component.js +209 -0
  51. package/cards/dataTable/dataTable.component.js.map +1 -0
  52. package/cards/dataTable/dataTable.types.d.ts +196 -0
  53. package/cards/dataTable/dataTable.types.js +13 -0
  54. package/cards/dataTable/dataTable.types.js.map +1 -0
  55. package/cards/dataTable/dataTableRowDetail.component.d.ts +26 -0
  56. package/cards/dataTable/dataTableRowDetail.component.js +47 -0
  57. package/cards/dataTable/dataTableRowDetail.component.js.map +1 -0
  58. package/cards/dataTable/index.d.ts +1 -0
  59. package/cards/dataTable/index.js +16 -0
  60. package/cards/dataTable/index.js.map +1 -0
  61. package/cards/dialog/dialog.component.d.ts +4 -0
  62. package/cards/dialog/dialog.component.js +89 -0
  63. package/cards/dialog/dialog.component.js.map +1 -0
  64. package/cards/dialog/dialog.types.d.ts +115 -0
  65. package/cards/dialog/dialog.types.js +11 -0
  66. package/cards/dialog/dialog.types.js.map +1 -0
  67. package/cards/dialog/index.d.ts +1 -0
  68. package/cards/dialog/index.js +13 -0
  69. package/cards/dialog/index.js.map +1 -0
  70. package/cards/dropDownMenu/drop-down.component.d.ts +4 -0
  71. package/cards/dropDownMenu/drop-down.component.js +205 -0
  72. package/cards/dropDownMenu/drop-down.component.js.map +1 -0
  73. package/cards/dropDownMenu/drop-down.types.d.ts +131 -0
  74. package/cards/dropDownMenu/drop-down.types.js +7 -0
  75. package/cards/dropDownMenu/drop-down.types.js.map +1 -0
  76. package/cards/dropDownMenu/dropdown-context.d.ts +7 -0
  77. package/cards/dropDownMenu/dropdown-context.js +7 -0
  78. package/cards/dropDownMenu/dropdown-context.js.map +1 -0
  79. package/cards/dropDownMenu/dropdown-menu.ui.d.ts +42 -0
  80. package/cards/dropDownMenu/dropdown-menu.ui.js +111 -0
  81. package/cards/dropDownMenu/dropdown-menu.ui.js.map +1 -0
  82. package/cards/dropDownMenu/index.d.ts +1 -0
  83. package/cards/dropDownMenu/index.js +13 -0
  84. package/cards/dropDownMenu/index.js.map +1 -0
  85. package/cards/emptyCard.d.ts +7 -0
  86. package/cards/field/field.component.d.ts +4 -0
  87. package/cards/field/field.component.js +38 -0
  88. package/cards/field/field.component.js.map +1 -0
  89. package/cards/field/field.types.d.ts +30 -0
  90. package/cards/field/field.types.js +7 -0
  91. package/cards/field/field.types.js.map +1 -0
  92. package/cards/field/index.d.ts +1 -0
  93. package/cards/field/index.js +12 -0
  94. package/cards/field/index.js.map +1 -0
  95. package/cards/flexGrid/flexGrid.component.d.ts +4 -0
  96. package/cards/flexGrid/flexGrid.component.js +40 -0
  97. package/cards/flexGrid/flexGrid.component.js.map +1 -0
  98. package/cards/flexGrid/flexGrid.types.d.ts +23 -0
  99. package/cards/flexGrid/flexGrid.types.js +7 -0
  100. package/cards/flexGrid/flexGrid.types.js.map +1 -0
  101. package/cards/flexGrid/index.d.ts +1 -0
  102. package/cards/flexGrid/index.js +12 -0
  103. package/cards/flexGrid/index.js.map +1 -0
  104. package/cards/form/form.component.d.ts +4 -0
  105. package/cards/form/form.component.js +64 -0
  106. package/cards/form/form.component.js.map +1 -0
  107. package/cards/form/form.context.d.ts +23 -0
  108. package/cards/form/form.context.js +13 -0
  109. package/cards/form/form.context.js.map +1 -0
  110. package/cards/form/form.types.d.ts +43 -0
  111. package/cards/form/form.types.js +7 -0
  112. package/cards/form/form.types.js.map +1 -0
  113. package/cards/form/index.d.ts +2 -0
  114. package/cards/form/index.js +14 -0
  115. package/cards/form/index.js.map +1 -0
  116. package/cards/framework/framework.component.d.ts +3 -0
  117. package/cards/framework/framework.component.js +21 -0
  118. package/cards/framework/framework.component.js.map +1 -0
  119. package/cards/framework/index.d.ts +2 -0
  120. package/cards/framework/index.js +12 -0
  121. package/cards/framework/index.js.map +1 -0
  122. package/cards/graphin/graphin.component.d.ts +4 -0
  123. package/cards/graphin/graphin.types.d.ts +18 -0
  124. package/cards/graphin/index.d.ts +2 -0
  125. package/cards/graphin/tooltip.component.d.ts +10 -0
  126. package/cards/icons.d.ts +15 -0
  127. package/cards/icons.js +15 -0
  128. package/cards/icons.js.map +1 -0
  129. package/cards/input/index.d.ts +1 -0
  130. package/cards/input/index.js +13 -0
  131. package/cards/input/index.js.map +1 -0
  132. package/cards/input/input.component.d.ts +4 -0
  133. package/cards/input/input.component.js +69 -0
  134. package/cards/input/input.component.js.map +1 -0
  135. package/cards/input/input.types.d.ts +80 -0
  136. package/cards/input/input.types.js +7 -0
  137. package/cards/input/input.types.js.map +1 -0
  138. package/cards/jsonViewer/index.d.ts +1 -0
  139. package/cards/jsonViewer/jsonViewer.component.d.ts +4 -0
  140. package/cards/jsonViewer/jsonViewer.types.d.ts +76 -0
  141. package/cards/list/index.d.ts +1 -0
  142. package/cards/list/index.js +13 -0
  143. package/cards/list/index.js.map +1 -0
  144. package/cards/list/list.component.d.ts +4 -0
  145. package/cards/list/list.component.js +102 -0
  146. package/cards/list/list.component.js.map +1 -0
  147. package/cards/list/list.types.d.ts +65 -0
  148. package/cards/list/list.types.js +7 -0
  149. package/cards/list/list.types.js.map +1 -0
  150. package/cards/loadingOverlay/index.d.ts +1 -0
  151. package/cards/loadingOverlay/index.js +12 -0
  152. package/cards/loadingOverlay/index.js.map +1 -0
  153. package/cards/loadingOverlay/loadingOverlay.component.d.ts +4 -0
  154. package/cards/loadingOverlay/loadingOverlay.component.js +31 -0
  155. package/cards/loadingOverlay/loadingOverlay.component.js.map +1 -0
  156. package/cards/loadingOverlay/loadingOverlay.types.d.ts +13 -0
  157. package/cards/loadingOverlay/loadingOverlay.types.js +7 -0
  158. package/cards/loadingOverlay/loadingOverlay.types.js.map +1 -0
  159. package/cards/loadingSkeleton/index.d.ts +1 -0
  160. package/cards/loadingSkeleton/index.js +12 -0
  161. package/cards/loadingSkeleton/index.js.map +1 -0
  162. package/cards/loadingSkeleton/loading-skeleton.component.d.ts +19 -0
  163. package/cards/loadingSkeleton/loading-skeleton.component.js +33 -0
  164. package/cards/loadingSkeleton/loading-skeleton.component.js.map +1 -0
  165. package/cards/loadingSkeleton/loading-skeleton.types.d.ts +94 -0
  166. package/cards/loadingSkeleton/loading-skeleton.types.js +7 -0
  167. package/cards/loadingSkeleton/loading-skeleton.types.js.map +1 -0
  168. package/cards/markdownViewer/index.d.ts +1 -0
  169. package/cards/markdownViewer/markdownViewer.component.d.ts +4 -0
  170. package/cards/markdownViewer/markdownViewer.types.d.ts +28 -0
  171. package/cards/menu/index.d.ts +1 -0
  172. package/cards/menu/index.js +13 -0
  173. package/cards/menu/index.js.map +1 -0
  174. package/cards/menu/menu.component.d.ts +4 -0
  175. package/cards/menu/menu.component.js +23 -0
  176. package/cards/menu/menu.component.js.map +1 -0
  177. package/cards/menu/menu.types.d.ts +53 -0
  178. package/cards/menu/menu.types.js +7 -0
  179. package/cards/menu/menu.types.js.map +1 -0
  180. package/cards/modeToggle/index.d.ts +1 -0
  181. package/cards/modeToggle/index.js +13 -0
  182. package/cards/modeToggle/index.js.map +1 -0
  183. package/cards/modeToggle/mode-toggle.component.d.ts +4 -0
  184. package/cards/modeToggle/mode-toggle.component.js +32 -0
  185. package/cards/modeToggle/mode-toggle.component.js.map +1 -0
  186. package/cards/modeToggle/mode-toggle.types.d.ts +20 -0
  187. package/cards/modeToggle/mode-toggle.types.js +7 -0
  188. package/cards/modeToggle/mode-toggle.types.js.map +1 -0
  189. package/cards/navbarSearch/index.d.ts +1 -0
  190. package/cards/navbarSearch/index.js +13 -0
  191. package/cards/navbarSearch/index.js.map +1 -0
  192. package/cards/navbarSearch/navbarSearch.component.d.ts +3 -0
  193. package/cards/navbarSearch/navbarSearch.component.js +88 -0
  194. package/cards/navbarSearch/navbarSearch.component.js.map +1 -0
  195. package/cards/navbarSearch/navbarSearch.type.d.ts +32 -0
  196. package/cards/navbarSearch/navbarSearch.type.js +11 -0
  197. package/cards/navbarSearch/navbarSearch.type.js.map +1 -0
  198. package/cards/pageWithNavbar/index.d.ts +2 -0
  199. package/cards/pageWithNavbar/index.js +14 -0
  200. package/cards/pageWithNavbar/index.js.map +1 -0
  201. package/cards/pageWithNavbar/pageWithNavbar.component.d.ts +12 -0
  202. package/cards/pageWithNavbar/pageWithNavbar.component.js +153 -0
  203. package/cards/pageWithNavbar/pageWithNavbar.component.js.map +1 -0
  204. package/cards/pageWithNavbar/pageWithNavbar.type.d.ts +81 -0
  205. package/cards/pageWithNavbar/pageWithNavbar.type.js +7 -0
  206. package/cards/pageWithNavbar/pageWithNavbar.type.js.map +1 -0
  207. package/cards/pasteTarget/index.d.ts +1 -0
  208. package/cards/pasteTarget/index.js +13 -0
  209. package/cards/pasteTarget/index.js.map +1 -0
  210. package/cards/pasteTarget/pasteTarget.component.d.ts +4 -0
  211. package/cards/pasteTarget/pasteTarget.component.js +158 -0
  212. package/cards/pasteTarget/pasteTarget.component.js.map +1 -0
  213. package/cards/pasteTarget/pasteTarget.types.d.ts +46 -0
  214. package/cards/pasteTarget/pasteTarget.types.js +11 -0
  215. package/cards/pasteTarget/pasteTarget.types.js.map +1 -0
  216. package/cards/resizable/index.d.ts +1 -0
  217. package/cards/resizable/resizable.component.d.ts +4 -0
  218. package/cards/resizable/resizable.types.d.ts +49 -0
  219. package/cards/select/index.d.ts +1 -0
  220. package/cards/select/index.js +13 -0
  221. package/cards/select/index.js.map +1 -0
  222. package/cards/select/select.component.d.ts +4 -0
  223. package/cards/select/select.component.js +41 -0
  224. package/cards/select/select.component.js.map +1 -0
  225. package/cards/select/select.types.d.ts +73 -0
  226. package/cards/select/select.types.js +11 -0
  227. package/cards/select/select.types.js.map +1 -0
  228. package/cards/stack/index.d.ts +1 -0
  229. package/cards/stack/index.js +12 -0
  230. package/cards/stack/index.js.map +1 -0
  231. package/cards/stack/stack.component.d.ts +7 -0
  232. package/cards/stack/stack.component.js +83 -0
  233. package/cards/stack/stack.component.js.map +1 -0
  234. package/cards/stack/stack.types.d.ts +47 -0
  235. package/cards/stack/stack.types.js +7 -0
  236. package/cards/stack/stack.types.js.map +1 -0
  237. package/cards/stepper/index.d.ts +1 -0
  238. package/cards/stepper/index.js +13 -0
  239. package/cards/stepper/index.js.map +1 -0
  240. package/cards/stepper/stepper.component.d.ts +4 -0
  241. package/cards/stepper/stepper.component.js +48 -0
  242. package/cards/stepper/stepper.component.js.map +1 -0
  243. package/cards/stepper/stepper.types.d.ts +96 -0
  244. package/cards/stepper/stepper.types.js +7 -0
  245. package/cards/stepper/stepper.types.js.map +1 -0
  246. package/cards/switch/index.d.ts +1 -0
  247. package/cards/switch/index.js +13 -0
  248. package/cards/switch/index.js.map +1 -0
  249. package/cards/switch/switch.component.d.ts +4 -0
  250. package/cards/switch/switch.component.js +34 -0
  251. package/cards/switch/switch.component.js.map +1 -0
  252. package/cards/switch/switch.types.d.ts +39 -0
  253. package/cards/switch/switch.types.js +7 -0
  254. package/cards/switch/switch.types.js.map +1 -0
  255. package/cards/tabs/index.d.ts +1 -0
  256. package/cards/tabs/index.js +13 -0
  257. package/cards/tabs/index.js.map +1 -0
  258. package/cards/tabs/tabs.component.d.ts +4 -0
  259. package/cards/tabs/tabs.component.js +42 -0
  260. package/cards/tabs/tabs.component.js.map +1 -0
  261. package/cards/tabs/tabs.types.d.ts +72 -0
  262. package/cards/tabs/tabs.types.js +7 -0
  263. package/cards/tabs/tabs.types.js.map +1 -0
  264. package/cards/textField/index.d.ts +1 -0
  265. package/cards/textField/index.js +13 -0
  266. package/cards/textField/index.js.map +1 -0
  267. package/cards/textField/textField.component.d.ts +4 -0
  268. package/cards/textField/textField.component.js +29 -0
  269. package/cards/textField/textField.component.js.map +1 -0
  270. package/cards/textField/textField.types.d.ts +36 -0
  271. package/cards/textField/textField.types.js +7 -0
  272. package/cards/textField/textField.types.js.map +1 -0
  273. package/cards/toast/index.d.ts +1 -0
  274. package/cards/toast/index.js +13 -0
  275. package/cards/toast/index.js.map +1 -0
  276. package/cards/toast/toast.component.d.ts +4 -0
  277. package/cards/toast/toast.component.js +76 -0
  278. package/cards/toast/toast.component.js.map +1 -0
  279. package/cards/toast/toast.types.d.ts +100 -0
  280. package/cards/toast/toast.types.js +12 -0
  281. package/cards/toast/toast.types.js.map +1 -0
  282. package/cards/toggleGroup/index.d.ts +1 -0
  283. package/cards/toggleGroup/index.js +13 -0
  284. package/cards/toggleGroup/index.js.map +1 -0
  285. package/cards/toggleGroup/toggleGroup.component.d.ts +4 -0
  286. package/cards/toggleGroup/toggleGroup.component.js +55 -0
  287. package/cards/toggleGroup/toggleGroup.component.js.map +1 -0
  288. package/cards/toggleGroup/toggleGroup.types.d.ts +96 -0
  289. package/cards/toggleGroup/toggleGroup.types.js +7 -0
  290. package/cards/toggleGroup/toggleGroup.types.js.map +1 -0
  291. package/cards/types.d.ts +72 -0
  292. package/cards/types.js +22 -0
  293. package/cards/types.js.map +1 -0
  294. package/cards/typography/index.d.ts +1 -0
  295. package/cards/typography/index.js +12 -0
  296. package/cards/typography/index.js.map +1 -0
  297. package/cards/typography/typography.component.d.ts +4 -0
  298. package/cards/typography/typography.component.js +44 -0
  299. package/cards/typography/typography.component.js.map +1 -0
  300. package/cards/typography/typography.types.d.ts +23 -0
  301. package/cards/typography/typography.types.js +7 -0
  302. package/cards/typography/typography.types.js.map +1 -0
  303. package/components/hooks/use-is-touch-device.d.ts +1 -0
  304. package/components/lib/utils.js +10 -0
  305. package/components/lib/utils.js.map +1 -0
  306. package/components/theme-provider/index.d.ts +4 -0
  307. package/components/theme-provider/index.js +12 -0
  308. package/components/theme-provider/index.js.map +1 -0
  309. package/components/theme-provider/theme-provider.component.d.ts +2 -0
  310. package/components/theme-provider/theme-provider.component.js +31 -0
  311. package/components/theme-provider/theme-provider.component.js.map +1 -0
  312. package/components/theme-provider/theme-provider.types.d.ts +12 -0
  313. package/components/theme-provider/theme-provider.types.js +9 -0
  314. package/components/theme-provider/theme-provider.types.js.map +1 -0
  315. package/components/ui/avatar.js +30 -0
  316. package/components/ui/avatar.js.map +1 -0
  317. package/components/ui/badge.js +26 -0
  318. package/components/ui/badge.js.map +1 -0
  319. package/components/ui/button.js +98 -0
  320. package/components/ui/button.js.map +1 -0
  321. package/components/ui/dialog.js +109 -0
  322. package/components/ui/dialog.js.map +1 -0
  323. package/components/ui/field.js +68 -0
  324. package/components/ui/field.js.map +1 -0
  325. package/components/ui/input.js +16 -0
  326. package/components/ui/input.js.map +1 -0
  327. package/components/ui/label.js +16 -0
  328. package/components/ui/label.js.map +1 -0
  329. package/components/ui/menubar.js +62 -0
  330. package/components/ui/menubar.js.map +1 -0
  331. package/components/ui/select.js +84 -0
  332. package/components/ui/select.js.map +1 -0
  333. package/components/ui/separator.js +5 -0
  334. package/components/ui/sheet.js +49 -0
  335. package/components/ui/sheet.js.map +1 -0
  336. package/components/ui/spinner.js +35 -0
  337. package/components/ui/spinner.js.map +1 -0
  338. package/components/ui/stepper.js +145 -0
  339. package/components/ui/stepper.js.map +1 -0
  340. package/components/ui/switch.js +20 -0
  341. package/components/ui/switch.js.map +1 -0
  342. package/components/ui/table.js +61 -0
  343. package/components/ui/table.js.map +1 -0
  344. package/components/ui/tabs.js +38 -0
  345. package/components/ui/tabs.js.map +1 -0
  346. package/components/ui/toggle-group.js +50 -0
  347. package/components/ui/toggle-group.js.map +1 -0
  348. package/components/ui/toggle.js +27 -0
  349. package/components/ui/toggle.js.map +1 -0
  350. package/components/ui/tooltip.js +38 -0
  351. package/components/ui/tooltip.js.map +1 -0
  352. package/lib/utils.d.ts +2 -0
  353. package/lib/utils.js +10 -0
  354. package/lib/utils.js.map +1 -0
  355. package/mountain-snow.svg +4 -0
  356. package/package.json +203 -0
  357. package/pihanga-shadcn.css +2 -0
  358. package/r/badge.json +35 -0
  359. package/r/box.json +26 -0
  360. package/r/button.json +39 -0
  361. package/r/checkbox.json +31 -0
  362. package/r/conditional.json +30 -0
  363. package/r/dataTable.json +43 -0
  364. package/r/dialog.json +36 -0
  365. package/r/dropDownMenu.json +47 -0
  366. package/r/field.json +35 -0
  367. package/r/flexGrid.json +32 -0
  368. package/r/form.json +37 -0
  369. package/r/framework.json +28 -0
  370. package/r/graphin.json +42 -0
  371. package/r/input.json +35 -0
  372. package/r/jsonViewer.json +40 -0
  373. package/r/list.json +39 -0
  374. package/r/loadingOverlay.json +39 -0
  375. package/r/loadingSkeleton.json +30 -0
  376. package/r/markdownViewer.json +51 -0
  377. package/r/menu.json +34 -0
  378. package/r/modeToggle.json +36 -0
  379. package/r/navbarSearch.json +31 -0
  380. package/r/pageWithNavbar.json +46 -0
  381. package/r/pasteTarget.json +41 -0
  382. package/r/pihanga-base.json +11 -0
  383. package/r/pihanga-cards-icons.json +16 -0
  384. package/r/pihanga-cards-types.json +16 -0
  385. package/r/pihanga-hook-use-is-touch-device.json +15 -0
  386. package/r/pihanga-lib-utils.json +18 -0
  387. package/r/pihanga-theme-provider.json +25 -0
  388. package/r/pihanga-ui-extras.json +68 -0
  389. package/r/registry.json +171 -0
  390. package/r/resizable.json +35 -0
  391. package/r/select.json +35 -0
  392. package/r/stack.json +27 -0
  393. package/r/stepper.json +39 -0
  394. package/r/switch.json +36 -0
  395. package/r/tabs.json +33 -0
  396. package/r/textField.json +32 -0
  397. package/r/toast.json +32 -0
  398. package/r/toggleGroup.json +35 -0
  399. package/r/typography.json +31 -0
@@ -0,0 +1,36 @@
1
+ import { useFormContext as e } from "../form/form.context.js";
2
+ import "react";
3
+ import { jsx as t, jsxs as n } from "react/jsx-runtime";
4
+ //#region src/cards/checkbox/checkbox.component.tsx
5
+ var r = (r) => {
6
+ let { name: i, checked: a = !1, disabled: o, label: s, cardName: c, onChanged: l } = r, u = r.id, d = !!r.invalid, f = e(), p = f.isInForm && !!i, m = p ? !!(f.formData[i] ?? !1) : a;
7
+ function h(e) {
8
+ let t = e.target.checked;
9
+ p ? f.handleChange(i, t) : l({
10
+ name: i,
11
+ checked: t
12
+ });
13
+ }
14
+ let g = `${c}-${i ?? "checkbox"}`, _ = u ?? g;
15
+ return /* @__PURE__ */ n("div", {
16
+ "data-pihanga": c,
17
+ className: "flex items-center gap-2",
18
+ children: [/* @__PURE__ */ t("input", {
19
+ id: _,
20
+ type: "checkbox",
21
+ checked: m,
22
+ onChange: h,
23
+ disabled: o,
24
+ "aria-invalid": d || void 0,
25
+ className: "h-4 w-4 rounded border-input accent-primary disabled:cursor-not-allowed disabled:opacity-50"
26
+ }), s && /* @__PURE__ */ t("label", {
27
+ htmlFor: _,
28
+ className: "text-sm leading-none cursor-pointer select-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
29
+ children: s
30
+ })]
31
+ });
32
+ };
33
+ //#endregion
34
+ export { r as CheckboxComponent };
35
+
36
+ //# sourceMappingURL=checkbox.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkbox.component.js","names":[],"sources":["../../../src/cards/checkbox/checkbox.component.tsx"],"sourcesContent":["import React from \"react\";\nimport {type PiCardProps} from \"@pihanga2/core\";\nimport {useFormContext} from \"@/cards/form/form.context\";\nimport type {PiCheckboxEvents, PiCheckboxProps} from \"./checkbox.types\";\n\nexport const CheckboxComponent = (\n props: PiCardProps<PiCheckboxProps, PiCheckboxEvents>,\n): React.ReactNode => {\n const {\n name,\n checked: propChecked = false,\n disabled,\n label,\n cardName,\n onChanged,\n } = props;\n\n // `id` and `invalid` may be injected by a parent pi/field card via\n // Pihanga's extra-prop forwarding. They are not in the official type so\n // we read them through an escape hatch.\n const injectedId = (props as {id?: string}).id;\n const invalid = Boolean((props as {invalid?: boolean}).invalid);\n\n // Detect if we are inside a pi/form card via React context.\n const form = useFormContext();\n const useFormData = form.isInForm && Boolean(name);\n\n const checked = useFormData\n ? Boolean(form.formData[name!] ?? false)\n : propChecked;\n\n function handleChange(e: React.ChangeEvent<HTMLInputElement>) {\n const newChecked = e.target.checked;\n if (useFormData) {\n form.handleChange(name!, newChecked);\n } else {\n onChanged({name, checked: newChecked});\n }\n }\n\n // Use the id injected by pi/field; fall back to a local id when standalone.\n const selfId = `${cardName}-${name ?? \"checkbox\"}`;\n const fieldId = injectedId ?? selfId;\n\n return (\n <div data-pihanga={cardName} className=\"flex items-center gap-2\">\n <input\n id={fieldId}\n type=\"checkbox\"\n checked={checked}\n onChange={handleChange}\n disabled={disabled}\n aria-invalid={invalid || undefined}\n className=\"h-4 w-4 rounded border-input accent-primary disabled:cursor-not-allowed disabled:opacity-50\"\n />\n {label && (\n <label\n htmlFor={fieldId}\n className=\"text-sm leading-none cursor-pointer select-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\"\n >\n {label}\n </label>\n )}\n </div>\n );\n};\n"],"mappings":";;;;AAKA,IAAa,KACX,MACoB;CACpB,IAAM,EACJ,SACA,SAAS,IAAc,IACvB,aACA,UACA,aACA,iBACE,GAKE,IAAc,EAAwB,IACtC,IAAU,EAAS,EAA8B,SAGjD,IAAO,EAAe,GACtB,IAAc,EAAK,YAAY,EAAQ,GAEvC,IAAU,IACZ,GAAQ,EAAK,SAAS,MAAU,MAChC;CAEJ,SAAS,EAAa,GAAwC;EAC5D,IAAM,IAAa,EAAE,OAAO;EAC5B,AAAI,IACF,EAAK,aAAa,GAAO,CAAU,IAEnC,EAAU;GAAC;GAAM,SAAS;EAAU,CAAC;CAEzC;CAGA,IAAM,IAAS,GAAG,EAAS,GAAG,KAAQ,cAChC,IAAU,KAAc;CAE9B,OACE,kBAAC,OAAD;EAAK,gBAAc;EAAU,WAAU;YAAvC,CACE,kBAAC,SAAD;GACE,IAAI;GACJ,MAAK;GACI;GACT,UAAU;GACA;GACV,gBAAc,KAAW,KAAA;GACzB,WAAU;EACX,CAAA,GACA,KACC,kBAAC,SAAD;GACE,SAAS;GACT,WAAU;aAET;EACI,CAAA,CAEN;;AAET"}
@@ -0,0 +1,37 @@
1
+ export declare const PI_CHECKBOX_CARD = "pi/checkbox";
2
+ export declare const Checkbox: <S extends import('@pihanga2/core').ReduxState>(p: import('@pihanga2/core').PiMapProps<PiCheckboxProps, S, PiCheckboxEvents>) => import('@pihanga2/core').PiCardDef;
3
+ export declare const PI_CHECKBOX_ACTION: {
4
+ CHANGED: string;
5
+ };
6
+ export declare const onPiCheckboxChanged: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core').PiRegister, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
7
+ cardID: string;
8
+ } & PiCheckboxChangedEvent>) => void;
9
+ export type PiCheckboxProps = {
10
+ /**
11
+ * Field name used to bind to FormContext when inside a pi/form card.
12
+ * When provided the component reads its checked state from form data and
13
+ * writes back via form.handleChange.
14
+ */
15
+ name?: string;
16
+ /**
17
+ * Controlled checked state used in standalone mode (outside a Form).
18
+ * Ignored when `name` is set and the component is inside a pi/form.
19
+ */
20
+ checked?: boolean;
21
+ /** When true, the checkbox is disabled and non-interactive. */
22
+ disabled?: boolean;
23
+ /**
24
+ * Optional label text rendered next to the checkbox.
25
+ * The label is automatically associated with the input via `htmlFor`.
26
+ */
27
+ label?: string;
28
+ };
29
+ export type PiCheckboxChangedEvent = {
30
+ /** Field name, mirrors the `name` prop if provided. */
31
+ name?: string;
32
+ /** New checked state after the change. */
33
+ checked: boolean;
34
+ };
35
+ export type PiCheckboxEvents = {
36
+ onChanged: PiCheckboxChangedEvent;
37
+ };
@@ -0,0 +1,7 @@
1
+ import { createCardDeclaration as e, createOnAction as t, registerActions as n } from "@pihanga2/core";
2
+ //#region src/cards/checkbox/checkbox.types.ts
3
+ var r = "pi/checkbox", i = e(r), a = n(r, ["changed"]), o = t(a.CHANGED);
4
+ //#endregion
5
+ export { i as Checkbox, a as PI_CHECKBOX_ACTION, r as PI_CHECKBOX_CARD, o as onPiCheckboxChanged };
6
+
7
+ //# sourceMappingURL=checkbox.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkbox.types.js","names":[],"sources":["../../../src/cards/checkbox/checkbox.types.ts"],"sourcesContent":["import {\n createCardDeclaration,\n createOnAction,\n registerActions,\n} from \"@pihanga2/core\";\n\nexport const PI_CHECKBOX_CARD = \"pi/checkbox\";\n\nexport const Checkbox = createCardDeclaration<\n PiCheckboxProps,\n PiCheckboxEvents\n>(PI_CHECKBOX_CARD);\n\nexport const PI_CHECKBOX_ACTION = registerActions(PI_CHECKBOX_CARD, [\n \"changed\",\n]);\n\nexport const onPiCheckboxChanged = createOnAction<PiCheckboxChangedEvent>(\n PI_CHECKBOX_ACTION.CHANGED,\n);\n\nexport type PiCheckboxProps = {\n /**\n * Field name used to bind to FormContext when inside a pi/form card.\n * When provided the component reads its checked state from form data and\n * writes back via form.handleChange.\n */\n name?: string;\n\n /**\n * Controlled checked state used in standalone mode (outside a Form).\n * Ignored when `name` is set and the component is inside a pi/form.\n */\n checked?: boolean;\n\n /** When true, the checkbox is disabled and non-interactive. */\n disabled?: boolean;\n\n /**\n * Optional label text rendered next to the checkbox.\n * The label is automatically associated with the input via `htmlFor`.\n */\n label?: string;\n};\n\nexport type PiCheckboxChangedEvent = {\n /** Field name, mirrors the `name` prop if provided. */\n name?: string;\n /** New checked state after the change. */\n checked: boolean;\n};\n\nexport type PiCheckboxEvents = {\n onChanged: PiCheckboxChangedEvent;\n};\n"],"mappings":";;AAMA,IAAa,IAAmB,eAEnB,IAAW,EAGtB,CAAgB,GAEL,IAAqB,EAAgB,GAAkB,CAClE,SACF,CAAC,GAEY,IAAsB,EACjC,EAAmB,OACrB"}
@@ -0,0 +1 @@
1
+ export * from './checkbox.types';
@@ -0,0 +1,13 @@
1
+ import { CheckboxComponent as e } from "./checkbox.component.js";
2
+ import { Checkbox as t, PI_CHECKBOX_ACTION as n, PI_CHECKBOX_CARD as r, onPiCheckboxChanged as i } from "./checkbox.types.js";
3
+ import { actionTypesToEvents as a, registerCardComponent as o } from "@pihanga2/core";
4
+ //#region src/cards/checkbox/index.ts
5
+ o({
6
+ name: r,
7
+ component: e,
8
+ events: a(n)
9
+ });
10
+ //#endregion
11
+ export { t as Checkbox, n as PI_CHECKBOX_ACTION, r as PI_CHECKBOX_CARD, i as onPiCheckboxChanged };
12
+
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/cards/checkbox/index.ts"],"sourcesContent":["import {actionTypesToEvents, registerCardComponent} from \"@pihanga2/core\";\n\nimport {CheckboxComponent} from \"./checkbox.component\";\nimport {PI_CHECKBOX_ACTION, PI_CHECKBOX_CARD} from \"./checkbox.types\";\n\nexport * from \"./checkbox.types\";\n\nregisterCardComponent({\n name: PI_CHECKBOX_CARD,\n component: CheckboxComponent,\n events: actionTypesToEvents(PI_CHECKBOX_ACTION),\n});\n"],"mappings":";;;;AAOA,EAAsB;CACpB,MAAM;CACN,WAAW;CACX,QAAQ,EAAoB,CAAkB;AAChD,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { PiCardProps } from '@pihanga2/core';
2
+ import { ConditionalProps } from './conditional.types';
3
+ import * as React from "react";
4
+ /**
5
+ * ConditionalComponent
6
+ *
7
+ * Transparent pass-through: renders the `content` card when `show` is `true`,
8
+ * returns `null` otherwise. No extra DOM wrapper is added — the mounted
9
+ * card's own root element is the only node in the tree.
10
+ */
11
+ export declare const ConditionalComponent: (props: PiCardProps<ConditionalProps>) => React.ReactNode;
@@ -0,0 +1,15 @@
1
+ import { Card as e } from "@pihanga2/core";
2
+ import "react";
3
+ import { jsx as t } from "react/jsx-runtime";
4
+ //#region src/cards/conditional/conditional.component.tsx
5
+ var n = (n) => {
6
+ let { cardName: r, show: i, content: a } = n;
7
+ return i ? /* @__PURE__ */ t(e, {
8
+ cardName: a,
9
+ parentCard: r
10
+ }) : null;
11
+ };
12
+ //#endregion
13
+ export { n as ConditionalComponent };
14
+
15
+ //# sourceMappingURL=conditional.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conditional.component.js","names":[],"sources":["../../../src/cards/conditional/conditional.component.tsx"],"sourcesContent":["import * as React from \"react\";\nimport {Card, type PiCardProps} from \"@pihanga2/core\";\nimport type {ConditionalProps} from \"./conditional.types\";\n\n/**\n * ConditionalComponent\n *\n * Transparent pass-through: renders the `content` card when `show` is `true`,\n * returns `null` otherwise. No extra DOM wrapper is added — the mounted\n * card's own root element is the only node in the tree.\n */\nexport const ConditionalComponent = (\n props: PiCardProps<ConditionalProps>,\n): React.ReactNode => {\n const {cardName, show, content} = props;\n if (!show) return null;\n return <Card cardName={content} parentCard={cardName} />;\n};\n"],"mappings":";;;;AAWA,IAAa,KACX,MACoB;CACpB,IAAM,EAAC,aAAU,SAAM,eAAW;CAElC,OADK,IACE,kBAAC,GAAD;EAAM,UAAU;EAAS,YAAY;CAAW,CAAA,IADrC;AAEpB"}
@@ -0,0 +1,29 @@
1
+ import { PiCardRef } from '@pihanga2/core';
2
+ export declare const CONDITIONAL_CARD = "shad/conditional";
3
+ export declare const Conditional: <S extends import('@pihanga2/core').ReduxState>(p: import('@pihanga2/core').PiMapProps<ConditionalProps, S, {}>) => import('@pihanga2/core').PiCardDef;
4
+ /**
5
+ * Props for the `shad/conditional` card.
6
+ *
7
+ * Renders `content` only when `show` is `true`; renders nothing otherwise.
8
+ * This is a transparent pass-through — no extra DOM wrapper is added.
9
+ *
10
+ * In a real app, drive `show` from a `memo()` selector so the card
11
+ * reactively mounts/unmounts as state changes:
12
+ *
13
+ * ```ts
14
+ * import {memo, registerCard} from "@pihanga2/core";
15
+ * import {Conditional} from "@/cards/conditional";
16
+ *
17
+ * registerCard("myApp/hint", Conditional({
18
+ * show: memo((s: AppState) => s.items.length === 0 && !s.isLoading),
19
+ * content: "myApp/emptyStateHint",
20
+ * }));
21
+ * ```
22
+ */
23
+ export type ConditionalProps = {
24
+ /** Render `content` only when this is `true`. Drive with `memo()` for
25
+ * reactive mount/unmount behaviour. */
26
+ show: boolean;
27
+ /** The card to render when `show` is `true`. */
28
+ content: PiCardRef;
29
+ };
@@ -0,0 +1,7 @@
1
+ import { createCardDeclaration as e } from "@pihanga2/core";
2
+ //#region src/cards/conditional/conditional.types.ts
3
+ var t = "shad/conditional", n = e(t);
4
+ //#endregion
5
+ export { t as CONDITIONAL_CARD, n as Conditional };
6
+
7
+ //# sourceMappingURL=conditional.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conditional.types.js","names":[],"sources":["../../../src/cards/conditional/conditional.types.ts"],"sourcesContent":["import {createCardDeclaration} from \"@pihanga2/core\";\nimport type {PiCardRef} from \"@pihanga2/core\";\n\n// ── Card id ───────────────────────────────────────────────────────────────────\n\nexport const CONDITIONAL_CARD = \"shad/conditional\";\n\n// ── Card declaration factory ──────────────────────────────────────────────────\n\nexport const Conditional =\n createCardDeclaration<ConditionalProps>(CONDITIONAL_CARD);\n\n// ── Props ─────────────────────────────────────────────────────────────────────\n\n/**\n * Props for the `shad/conditional` card.\n *\n * Renders `content` only when `show` is `true`; renders nothing otherwise.\n * This is a transparent pass-through — no extra DOM wrapper is added.\n *\n * In a real app, drive `show` from a `memo()` selector so the card\n * reactively mounts/unmounts as state changes:\n *\n * ```ts\n * import {memo, registerCard} from \"@pihanga2/core\";\n * import {Conditional} from \"@/cards/conditional\";\n *\n * registerCard(\"myApp/hint\", Conditional({\n * show: memo((s: AppState) => s.items.length === 0 && !s.isLoading),\n * content: \"myApp/emptyStateHint\",\n * }));\n * ```\n */\nexport type ConditionalProps = {\n /** Render `content` only when this is `true`. Drive with `memo()` for\n * reactive mount/unmount behaviour. */\n show: boolean;\n\n /** The card to render when `show` is `true`. */\n content: PiCardRef;\n};\n"],"mappings":";;AAKA,IAAa,IAAmB,oBAInB,IACX,EAAwC,CAAgB"}
@@ -0,0 +1 @@
1
+ export * from './conditional.types';
@@ -0,0 +1,12 @@
1
+ import { ConditionalComponent as e } from "./conditional.component.js";
2
+ import { CONDITIONAL_CARD as t, Conditional as n } from "./conditional.types.js";
3
+ import { registerCardComponent as r } from "@pihanga2/core";
4
+ //#region src/cards/conditional/index.ts
5
+ r({
6
+ name: t,
7
+ component: e
8
+ });
9
+ //#endregion
10
+ export { t as CONDITIONAL_CARD, n as Conditional };
11
+
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/cards/conditional/index.ts"],"sourcesContent":["import {registerCardComponent} from \"@pihanga2/core\";\nimport {ConditionalComponent} from \"./conditional.component\";\nimport {CONDITIONAL_CARD} from \"./conditional.types\";\n\nexport * from \"./conditional.types\";\n\n// No events — this card is purely structural.\nregisterCardComponent({\n name: CONDITIONAL_CARD,\n component: ConditionalComponent,\n});\n"],"mappings":";;;;AAOA,EAAsB;CACpB,MAAM;CACN,WAAW;AACb,CAAC"}
@@ -0,0 +1,30 @@
1
+ export * from './badge/index.js';
2
+ export * from './box/index.js';
3
+ export * from './button/index.js';
4
+ export * from './checkbox/index.js';
5
+ export * from './conditional/index.js';
6
+ export * from './dataTable/index.js';
7
+ export * from './dialog/index.js';
8
+ export * from './dropDownMenu/index.js';
9
+ export * from './field/index.js';
10
+ export * from './flexGrid/index.js';
11
+ export * from './form/index.js';
12
+ export * from './framework/index.js';
13
+ export * from './input/index.js';
14
+ export * from './list/index.js';
15
+ export * from './loadingOverlay/index.js';
16
+ export * from './loadingSkeleton/index.js';
17
+ export * from './menu/index.js';
18
+ export * from './modeToggle/index.js';
19
+ export * from './navbarSearch/index.js';
20
+ export * from './pageWithNavbar/index.js';
21
+ export * from './pasteTarget/index.js';
22
+ export * from './select/index.js';
23
+ export * from './stack/index.js';
24
+ export * from './stepper/index.js';
25
+ export * from './switch/index.js';
26
+ export * from './tabs/index.js';
27
+ export * from './textField/index.js';
28
+ export * from './toast/index.js';
29
+ export * from './toggleGroup/index.js';
30
+ export * from './typography/index.js';
@@ -0,0 +1,61 @@
1
+ import { BADGE_CARD as e, ShadBadge as t } from "./badge/badge.types.js";
2
+ import "./badge/index.js";
3
+ import { BOX_CARD as n, Box as r } from "./box/box.types.js";
4
+ import "./box/index.js";
5
+ import { Button as i, PI_BUTTON_ACTION as a, PI_BUTTON_CARD as o, onPiButtonClicked as s } from "./button/button.types.js";
6
+ import "./button/index.js";
7
+ import { FormContext as c, useFormContext as l } from "./form/form.context.js";
8
+ import { Checkbox as u, PI_CHECKBOX_ACTION as d, PI_CHECKBOX_CARD as f, onPiCheckboxChanged as p } from "./checkbox/checkbox.types.js";
9
+ import "./checkbox/index.js";
10
+ import { CONDITIONAL_CARD as m, Conditional as h } from "./conditional/conditional.types.js";
11
+ import "./conditional/index.js";
12
+ import { DATA_TABLE_ACTION as g, DATA_TABLE_CARD as _, DATA_TABLE_ROW_DETAIL_CARD as v, DataTable as y, DataTableRowDetail as b, onDataTableHideDetail as x, onDataTablePageChanged as S, onDataTableRowClicked as C, onDataTableShowDetail as w, onDataTableSortChanged as T } from "./dataTable/dataTable.types.js";
13
+ import "./dataTable/index.js";
14
+ import { Dialog as E, PI_DIALOG_ACTION as D, PI_DIALOG_CARD as O, onDialogClosed as k, onDialogOpenChanged as A, onDialogOpened as j } from "./dialog/dialog.types.js";
15
+ import "./dialog/index.js";
16
+ import { DROP_DOWN_MENU_ACTION as M, DROP_DOWN_MENU_CARD as N, DropDownMenu as P, onDropDownMenuClicked as F } from "./dropDownMenu/drop-down.types.js";
17
+ import "./dropDownMenu/index.js";
18
+ import { Field as I, PI_FIELD_CARD as L } from "./field/field.types.js";
19
+ import "./field/index.js";
20
+ import { FLEX_GRID_CARD as R, FlexGrid as z } from "./flexGrid/flexGrid.types.js";
21
+ import "./flexGrid/index.js";
22
+ import { Form as B, PI_FORM_ACTION as V, PI_FORM_CARD as H, onPiFormSubmitted as U } from "./form/form.types.js";
23
+ import "./form/index.js";
24
+ import { SdFramework as W } from "./framework/index.js";
25
+ import { PI_INPUT_ACTION as G, PI_INPUT_CARD as K, PiInput as q, onPiInputChanged as J, onPiInputCommitted as Y } from "./input/input.types.js";
26
+ import "./input/index.js";
27
+ import { LIST_ACTION as X, LIST_CARD as Z, List as Q, onListItemClicked as $ } from "./list/list.types.js";
28
+ import "./list/index.js";
29
+ import { LOADING_OVERLAY_CARD as ee, LoadingOverlay as te } from "./loadingOverlay/loadingOverlay.types.js";
30
+ import "./loadingOverlay/index.js";
31
+ import { LOADING_SKELETON_CARD as ne, LoadingSkeleton as re } from "./loadingSkeleton/loading-skeleton.types.js";
32
+ import "./loadingSkeleton/index.js";
33
+ import { MENU_ACTION as ie, MENU_CARD as ae, Menu as oe, onMenuClicked as se } from "./menu/menu.types.js";
34
+ import "./menu/index.js";
35
+ import { MODE_TOGGLE_ACTION as ce, MODE_TOGGLE_CARD as le, ModeToggle as ue, onModeToggleChanged as de } from "./modeToggle/mode-toggle.types.js";
36
+ import "./modeToggle/index.js";
37
+ import { NAVBAR_SEARCH_ACTION as fe, NAVBAR_SEARCH_CARD as pe, NavbarSearch as me, onNavbarSearchFocus as he, onNavbarSearchItems as ge, onNavbarSearchSubmit as _e } from "./navbarSearch/navbarSearch.type.js";
38
+ import "./navbarSearch/index.js";
39
+ import { PAGE_WITH_NAVBAR_ACTION as ve, PAGE_WITH_NAVBAR_CARD as ye, PageWithNavbar as be, onPageWithNavbarNavigateTo as xe } from "./pageWithNavbar/pageWithNavbar.type.js";
40
+ import { SdPageWithNavbar as Se } from "./pageWithNavbar/index.js";
41
+ import { DEF_ERROR_COLOR as Ce, DEF_EVENT_DURATION_SECONDS as we, DEF_HEIGHT as Te, DEF_OVERLAY_OPACITY as Ee, DEF_PASTE_FIRST_REMINDER as De, DEF_PASTE_TARGET_FILE_TYPES as Oe, DEF_SUCCESS_COLOR as ke, PASTE_TARGET_ACTION as Ae, PASTE_TARGET_CARD as je, PasteTarget as Me, onContentPasted as Ne, onPasteError as Pe } from "./pasteTarget/pasteTarget.types.js";
42
+ import "./pasteTarget/index.js";
43
+ import { PI_SELECT_ACTION as Fe, PI_SELECT_CARD as Ie, Select as Le, onPiSelectChanged as Re, onPiSelectClosed as ze, onPiSelectOpened as Be } from "./select/select.types.js";
44
+ import "./select/index.js";
45
+ import { STACK_CARD as Ve, Stack as He } from "./stack/stack.types.js";
46
+ import "./stack/index.js";
47
+ import { STEPPER_ACTION as Ue, STEPPER_CARD as We, Stepper as Ge, onStepperStepClicked as Ke } from "./stepper/stepper.types.js";
48
+ import "./stepper/index.js";
49
+ import { PI_SWITCH_ACTION as qe, PI_SWITCH_CARD as Je, Switch as Ye, onPiSwitchChanged as Xe } from "./switch/switch.types.js";
50
+ import "./switch/index.js";
51
+ import { SdTabs as Ze, TABS_ACTION as Qe, TABS_CARD as $e, onTabsTabChanged as et } from "./tabs/tabs.types.js";
52
+ import "./tabs/index.js";
53
+ import { PI_TEXT_FIELD_ACTION as tt, PI_TEXT_FIELD_CARD as nt, TextField as rt, onPiTextFieldChanged as it } from "./textField/textField.types.js";
54
+ import "./textField/index.js";
55
+ import { PI_TOAST_ACTION as at, PI_TOAST_CARD as ot, TOAST_OP_ACTION as st, Toast as ct, dispatchShowToast as lt, onPiToastClosed as ut, onShowToast as dt } from "./toast/toast.types.js";
56
+ import "./toast/index.js";
57
+ import { PI_TOGGLE_GROUP_ACTION as ft, PI_TOGGLE_GROUP_CARD as pt, ToggleGroup as mt, onPiToggleGroupChanged as ht } from "./toggleGroup/toggleGroup.types.js";
58
+ import "./toggleGroup/index.js";
59
+ import { TYPOGRAPHY_CARD as gt, Typography as _t } from "./typography/typography.types.js";
60
+ import "./typography/index.js";
61
+ export { e as BADGE_CARD, n as BOX_CARD, r as Box, i as Button, m as CONDITIONAL_CARD, u as Checkbox, h as Conditional, g as DATA_TABLE_ACTION, _ as DATA_TABLE_CARD, v as DATA_TABLE_ROW_DETAIL_CARD, Ce as DEF_ERROR_COLOR, we as DEF_EVENT_DURATION_SECONDS, Te as DEF_HEIGHT, Ee as DEF_OVERLAY_OPACITY, De as DEF_PASTE_FIRST_REMINDER, Oe as DEF_PASTE_TARGET_FILE_TYPES, ke as DEF_SUCCESS_COLOR, M as DROP_DOWN_MENU_ACTION, N as DROP_DOWN_MENU_CARD, y as DataTable, b as DataTableRowDetail, E as Dialog, P as DropDownMenu, R as FLEX_GRID_CARD, I as Field, z as FlexGrid, B as Form, c as FormContext, X as LIST_ACTION, Z as LIST_CARD, ee as LOADING_OVERLAY_CARD, ne as LOADING_SKELETON_CARD, Q as List, te as LoadingOverlay, re as LoadingSkeleton, ie as MENU_ACTION, ae as MENU_CARD, ce as MODE_TOGGLE_ACTION, le as MODE_TOGGLE_CARD, oe as Menu, ue as ModeToggle, fe as NAVBAR_SEARCH_ACTION, pe as NAVBAR_SEARCH_CARD, me as NavbarSearch, ve as PAGE_WITH_NAVBAR_ACTION, ye as PAGE_WITH_NAVBAR_CARD, Ae as PASTE_TARGET_ACTION, je as PASTE_TARGET_CARD, a as PI_BUTTON_ACTION, o as PI_BUTTON_CARD, d as PI_CHECKBOX_ACTION, f as PI_CHECKBOX_CARD, D as PI_DIALOG_ACTION, O as PI_DIALOG_CARD, L as PI_FIELD_CARD, V as PI_FORM_ACTION, H as PI_FORM_CARD, G as PI_INPUT_ACTION, K as PI_INPUT_CARD, Fe as PI_SELECT_ACTION, Ie as PI_SELECT_CARD, qe as PI_SWITCH_ACTION, Je as PI_SWITCH_CARD, tt as PI_TEXT_FIELD_ACTION, nt as PI_TEXT_FIELD_CARD, at as PI_TOAST_ACTION, ot as PI_TOAST_CARD, ft as PI_TOGGLE_GROUP_ACTION, pt as PI_TOGGLE_GROUP_CARD, be as PageWithNavbar, Me as PasteTarget, q as PiInput, Ve as STACK_CARD, Ue as STEPPER_ACTION, We as STEPPER_CARD, W as SdFramework, Se as SdPageWithNavbar, Ze as SdTabs, Le as Select, t as ShadBadge, He as Stack, Ge as Stepper, Ye as Switch, Qe as TABS_ACTION, $e as TABS_CARD, st as TOAST_OP_ACTION, gt as TYPOGRAPHY_CARD, rt as TextField, ct as Toast, mt as ToggleGroup, _t as Typography, lt as dispatchShowToast, Ne as onContentPasted, x as onDataTableHideDetail, S as onDataTablePageChanged, C as onDataTableRowClicked, w as onDataTableShowDetail, T as onDataTableSortChanged, k as onDialogClosed, A as onDialogOpenChanged, j as onDialogOpened, F as onDropDownMenuClicked, $ as onListItemClicked, se as onMenuClicked, de as onModeToggleChanged, he as onNavbarSearchFocus, ge as onNavbarSearchItems, _e as onNavbarSearchSubmit, xe as onPageWithNavbarNavigateTo, Pe as onPasteError, s as onPiButtonClicked, p as onPiCheckboxChanged, U as onPiFormSubmitted, J as onPiInputChanged, Y as onPiInputCommitted, Re as onPiSelectChanged, ze as onPiSelectClosed, Be as onPiSelectOpened, Xe as onPiSwitchChanged, it as onPiTextFieldChanged, ut as onPiToastClosed, ht as onPiToggleGroupChanged, dt as onShowToast, Ke as onStepperStepClicked, et as onTabsTabChanged, l as useFormContext };
@@ -0,0 +1,4 @@
1
+ import { default as React } from 'react';
2
+ import { PiCardProps } from '@pihanga2/core';
3
+ import { DataTableEvents, DataTableProps } from './dataTable.types';
4
+ export declare const DataTableComponent: (props: PiCardProps<DataTableProps, DataTableEvents>) => React.ReactNode;
@@ -0,0 +1,209 @@
1
+ import { Badge as e } from "../../components/ui/badge.js";
2
+ import { cn as t } from "../../lib/utils.js";
3
+ import { Table as n, TableBody as r, TableCaption as i, TableCell as a, TableHead as o, TableHeader as s, TableRow as c } from "../../components/ui/table.js";
4
+ import { Card as l } from "@pihanga2/core";
5
+ import u, { useMemo as d, useState as f } from "react";
6
+ import { jsx as p, jsxs as m } from "react/jsx-runtime";
7
+ import { Check as h, ChevronDown as g, ChevronRight as _, ChevronUp as v, ChevronsUpDown as y, X as b } from "lucide-react";
8
+ //#region src/cards/dataTable/dataTable.component.tsx
9
+ function ee(t, n, r) {
10
+ if (n == null) return null;
11
+ switch (t.type) {
12
+ case "number": {
13
+ let e = typeof n == "number" ? n : Number(n);
14
+ return isNaN(e) ? String(n) : t.format ? t.format(e) : String(e);
15
+ }
16
+ case "date": {
17
+ if (t.format) return t.format(n);
18
+ let e = n instanceof Date ? n : new Date(String(n));
19
+ return isNaN(e.getTime()) ? String(n) : e.toLocaleDateString();
20
+ }
21
+ case "badge": {
22
+ let r = String(n);
23
+ return /* @__PURE__ */ p(e, {
24
+ variant: t.variants?.[r] ?? "secondary",
25
+ children: r
26
+ });
27
+ }
28
+ case "boolean": return n ? /* @__PURE__ */ p(h, {
29
+ className: "size-4 text-green-600",
30
+ "aria-label": "true"
31
+ }) : /* @__PURE__ */ p(b, {
32
+ className: "size-4 text-muted-foreground",
33
+ "aria-label": "false"
34
+ });
35
+ case "card": return /* @__PURE__ */ p(l, {
36
+ cardName: String(n),
37
+ parentCard: r
38
+ });
39
+ default: return String(n);
40
+ }
41
+ }
42
+ function x({ columnKey: e, activeKey: t, ascending: n }) {
43
+ return e === t ? p(n ? v : g, { className: "ml-1 inline size-3.5" }) : /* @__PURE__ */ p(y, { className: "ml-1 inline size-3.5 opacity-40" });
44
+ }
45
+ function S({ page: e, totalPages: n, onPrev: r, onNext: i }) {
46
+ return /* @__PURE__ */ m("div", {
47
+ className: "flex items-center justify-end gap-2 mt-2 px-2",
48
+ children: [
49
+ /* @__PURE__ */ m("span", {
50
+ className: "text-sm text-muted-foreground",
51
+ children: [
52
+ "Page ",
53
+ e + 1,
54
+ " of ",
55
+ n
56
+ ]
57
+ }),
58
+ /* @__PURE__ */ p("button", {
59
+ type: "button",
60
+ className: t("rounded border px-2 py-1 text-sm transition-colors", "hover:bg-accent disabled:cursor-not-allowed disabled:opacity-40"),
61
+ disabled: e === 0,
62
+ onClick: r,
63
+ children: "Previous"
64
+ }),
65
+ /* @__PURE__ */ p("button", {
66
+ type: "button",
67
+ className: t("rounded border px-2 py-1 text-sm transition-colors", "hover:bg-accent disabled:cursor-not-allowed disabled:opacity-40"),
68
+ disabled: e >= n - 1,
69
+ onClick: i,
70
+ children: "Next"
71
+ })
72
+ ]
73
+ });
74
+ }
75
+ function C(e) {
76
+ return e.replace(/([A-Z])/g, " $1").replace(/^./, (e) => e.toUpperCase()).trim();
77
+ }
78
+ var w = (e) => {
79
+ let { columns: h, rows: v, caption: y, sortKey: b, sortAscending: w, pageSize: T, currentPage: E, stickyHeader: D = !1, striped: te = !1, hoverable: ne = !0, compact: re = !1, emptyCard: O, emptyText: ie = "No data", className: k, cardName: A, onRowClicked: j, onSortChanged: M, onShowDetail: N, onHideDetail: P, onPageChanged: F } = e, [I, L] = f(/* @__PURE__ */ new Set()), [R, z] = f(b), [B, V] = f(w ?? !0), H = b === void 0 ? R : b, U = w === void 0 ? B : w, [W, G] = f(E ?? 0), K = E === void 0 ? W : E, q = v.some((e) => e.detailCard != null), J = h.length + +!!q, Y = d(() => H ? [...v].sort((e, t) => {
80
+ let n = e.data[H], r = t.data[H];
81
+ if (n == null && r == null) return 0;
82
+ if (n == null) return 1;
83
+ if (r == null) return -1;
84
+ let i = n < r ? -1 : +(n > r);
85
+ return U ? i : -i;
86
+ }) : v, [
87
+ v,
88
+ H,
89
+ U
90
+ ]), X = d(() => {
91
+ if (!T) return Y;
92
+ let e = K * T;
93
+ return Y.slice(e, e + T);
94
+ }, [
95
+ Y,
96
+ T,
97
+ K
98
+ ]), Z = T ? Math.ceil(Y.length / T) : 1, ae = (e) => {
99
+ let t = H === e ? !U : !0;
100
+ z(e), V(t), M({
101
+ key: e,
102
+ ascending: t
103
+ });
104
+ }, oe = (e, t) => {
105
+ t.stopPropagation(), L((t) => {
106
+ let n = new Set(t);
107
+ return n.has(e.id) ? (n.delete(e.id), P({
108
+ rowId: e.id,
109
+ row: e
110
+ })) : (n.add(e.id), N({
111
+ rowId: e.id,
112
+ row: e
113
+ })), n;
114
+ });
115
+ }, se = (e) => {
116
+ j({
117
+ rowId: e.id,
118
+ row: e
119
+ });
120
+ }, Q = (e) => {
121
+ G(e), T && F({
122
+ page: e,
123
+ pageSize: T
124
+ });
125
+ }, $ = re ? "py-1 px-2" : "py-2 px-3";
126
+ return /* @__PURE__ */ m("div", {
127
+ className: t("w-full", k),
128
+ "data-pihanga": A,
129
+ children: [/* @__PURE__ */ m(n, { children: [
130
+ y && /* @__PURE__ */ p(i, { children: y }),
131
+ /* @__PURE__ */ p(s, {
132
+ className: D ? "sticky top-0 z-10 bg-background" : void 0,
133
+ children: /* @__PURE__ */ m(c, { children: [q && /* @__PURE__ */ p(o, {
134
+ className: "w-10 px-2",
135
+ "aria-label": "Row details"
136
+ }), h.map((e) => /* @__PURE__ */ p(o, {
137
+ style: e.width ? { width: e.width } : void 0,
138
+ className: t($, e.align === "center" && "text-center", e.align === "right" && "text-right", e.sortable && "cursor-pointer select-none", e.headerClassName),
139
+ onClick: e.sortable ? () => ae(e.key) : void 0,
140
+ children: /* @__PURE__ */ m("span", {
141
+ className: "inline-flex items-center",
142
+ children: [e.title ?? C(e.key), e.sortable && /* @__PURE__ */ p(x, {
143
+ columnKey: e.key,
144
+ activeKey: H,
145
+ ascending: U
146
+ })]
147
+ })
148
+ }, e.key))] })
149
+ }),
150
+ /* @__PURE__ */ p(r, { children: X.length === 0 ? /* @__PURE__ */ p(c, { children: /* @__PURE__ */ p(a, {
151
+ colSpan: J,
152
+ className: "py-8 text-center text-muted-foreground",
153
+ children: O ? /* @__PURE__ */ p(l, {
154
+ cardName: O,
155
+ parentCard: A
156
+ }) : ie
157
+ }) }) : X.map((e, n) => {
158
+ let r = I.has(e.id), i = te && n % 2 == 1;
159
+ return /* @__PURE__ */ m(u.Fragment, { children: [/* @__PURE__ */ m(c, {
160
+ className: t(i && "bg-muted/30", ne && "cursor-pointer"),
161
+ "data-expanded": r || void 0,
162
+ onClick: () => se(e),
163
+ children: [q && /* @__PURE__ */ p(a, {
164
+ className: "w-10 px-2",
165
+ children: e.detailCard && /* @__PURE__ */ p("button", {
166
+ type: "button",
167
+ "aria-label": r ? "Collapse detail" : "Expand detail",
168
+ "aria-expanded": r,
169
+ className: t("flex items-center justify-center rounded p-0.5 transition-colors", "hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"),
170
+ onClick: (t) => oe(e, t),
171
+ children: p(r ? g : _, { className: "size-4" })
172
+ })
173
+ }), h.map((n) => {
174
+ let r = e.data[n.key];
175
+ return /* @__PURE__ */ p(a, {
176
+ className: t($, n.align === "center" && "text-center", n.align === "right" && "text-right", n.cellClassName),
177
+ children: ee(n, r, A)
178
+ }, n.key);
179
+ })]
180
+ }), r && e.detailCard && /* @__PURE__ */ p(c, {
181
+ className: "hover:bg-transparent",
182
+ onClick: (e) => e.stopPropagation(),
183
+ children: /* @__PURE__ */ p(a, {
184
+ colSpan: J,
185
+ className: "border-b p-0",
186
+ children: /* @__PURE__ */ p("div", {
187
+ className: "bg-muted/20 px-4 py-3",
188
+ children: /* @__PURE__ */ p(l, {
189
+ cardName: e.detailCard,
190
+ cardKey: `detail-${e.id}`,
191
+ row: e,
192
+ parentCard: A
193
+ }, `${A}-${e.id}-detail`)
194
+ })
195
+ })
196
+ })] }, e.id);
197
+ }) })
198
+ ] }), T && Z > 1 && /* @__PURE__ */ p(S, {
199
+ page: K,
200
+ totalPages: Z,
201
+ onPrev: () => Q(K - 1),
202
+ onNext: () => Q(K + 1)
203
+ })]
204
+ });
205
+ };
206
+ //#endregion
207
+ export { w as DataTableComponent };
208
+
209
+ //# sourceMappingURL=dataTable.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataTable.component.js","names":[],"sources":["../../../src/cards/dataTable/dataTable.component.tsx"],"sourcesContent":["import React, {useMemo, useState} from \"react\";\nimport {Card, type PiCardProps} from \"@pihanga2/core\";\nimport {\n Check,\n ChevronDown,\n ChevronRight,\n ChevronUp,\n ChevronsUpDown,\n X,\n} from \"lucide-react\";\nimport {cn} from \"@/lib/utils\";\nimport {Badge} from \"@/components/ui/badge\";\nimport {\n Table,\n TableBody,\n TableCaption,\n TableCell,\n TableHead,\n TableHeader,\n TableRow,\n} from \"@/components/ui/table\";\nimport type {\n DataTableColumn,\n DataTableEvents,\n DataTableProps,\n DataTableRow as DataTableRowType,\n} from \"./dataTable.types\";\n\n// ---------------------------------------------------------------------------\n// Cell renderer\n// ---------------------------------------------------------------------------\n\nfunction renderCell(\n column: DataTableColumn,\n value: unknown,\n parentCard: string,\n): React.ReactNode {\n if (value == null) return null;\n\n switch (column.type) {\n case \"number\": {\n const num = typeof value === \"number\" ? value : Number(value);\n return isNaN(num)\n ? String(value)\n : column.format\n ? column.format(num)\n : String(num);\n }\n\n case \"date\": {\n if (column.format) {\n return column.format(value as Date | string);\n }\n const d = value instanceof Date ? value : new Date(String(value));\n return isNaN(d.getTime()) ? String(value) : d.toLocaleDateString();\n }\n\n case \"badge\": {\n const strVal = String(value);\n const variant = column.variants?.[strVal] ?? \"secondary\";\n return <Badge variant={variant}>{strVal}</Badge>;\n }\n\n case \"boolean\": {\n return value ? (\n <Check className=\"size-4 text-green-600\" aria-label=\"true\" />\n ) : (\n <X className=\"size-4 text-muted-foreground\" aria-label=\"false\" />\n );\n }\n\n case \"card\": {\n // Cell value is expected to be a PiCardRef (string)\n return <Card cardName={String(value)} parentCard={parentCard} />;\n }\n\n default:\n // \"text\" or omitted type\n return String(value);\n }\n}\n\n// ---------------------------------------------------------------------------\n// Sort icon\n// ---------------------------------------------------------------------------\n\nfunction SortIcon({\n columnKey,\n activeKey,\n ascending,\n}: {\n columnKey: string;\n activeKey: string | undefined;\n ascending: boolean;\n}): React.ReactNode {\n if (columnKey !== activeKey) {\n return <ChevronsUpDown className=\"ml-1 inline size-3.5 opacity-40\" />;\n }\n return ascending ? (\n <ChevronUp className=\"ml-1 inline size-3.5\" />\n ) : (\n <ChevronDown className=\"ml-1 inline size-3.5\" />\n );\n}\n\n// ---------------------------------------------------------------------------\n// Pagination controls\n// ---------------------------------------------------------------------------\n\nfunction PaginationBar({\n page,\n totalPages,\n onPrev,\n onNext,\n}: {\n page: number;\n totalPages: number;\n onPrev: () => void;\n onNext: () => void;\n}): React.ReactNode {\n return (\n <div className=\"flex items-center justify-end gap-2 mt-2 px-2\">\n <span className=\"text-sm text-muted-foreground\">\n Page {page + 1} of {totalPages}\n </span>\n <button\n type=\"button\"\n className={cn(\n \"rounded border px-2 py-1 text-sm transition-colors\",\n \"hover:bg-accent disabled:cursor-not-allowed disabled:opacity-40\",\n )}\n disabled={page === 0}\n onClick={onPrev}\n >\n Previous\n </button>\n <button\n type=\"button\"\n className={cn(\n \"rounded border px-2 py-1 text-sm transition-colors\",\n \"hover:bg-accent disabled:cursor-not-allowed disabled:opacity-40\",\n )}\n disabled={page >= totalPages - 1}\n onClick={onNext}\n >\n Next\n </button>\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Helper: derive a human-readable title from a camelCase key\n// ---------------------------------------------------------------------------\n\nfunction keyToTitle(key: string): string {\n return key\n .replace(/([A-Z])/g, \" $1\")\n .replace(/^./, (s) => s.toUpperCase())\n .trim();\n}\n\n// ---------------------------------------------------------------------------\n// Main data-table component\n// ---------------------------------------------------------------------------\n\nexport const DataTableComponent = (\n props: PiCardProps<DataTableProps, DataTableEvents>,\n): React.ReactNode => {\n const {\n columns,\n rows,\n caption,\n sortKey: sortKeyProp,\n sortAscending: sortAscendingProp,\n pageSize,\n currentPage: currentPageProp,\n stickyHeader = false,\n striped = false,\n hoverable = true,\n compact = false,\n emptyCard,\n emptyText = \"No data\",\n className,\n cardName,\n onRowClicked,\n onSortChanged,\n onShowDetail,\n onHideDetail,\n onPageChanged,\n } = props;\n\n // ── Expanded-rows state ──────────────────────────────────────────────────\n const [expandedRows, setExpandedRows] = useState<Set<string | number>>(\n new Set(),\n );\n\n // ── Sort state (uncontrolled; props override when present) ───────────────\n const [localSortKey, setLocalSortKey] = useState<string | undefined>(\n sortKeyProp,\n );\n const [localSortAsc, setLocalSortAsc] = useState<boolean>(\n sortAscendingProp ?? true,\n );\n const activeSortKey = sortKeyProp !== undefined ? sortKeyProp : localSortKey;\n const activeSortAsc =\n sortAscendingProp !== undefined ? sortAscendingProp : localSortAsc;\n\n // ── Pagination state (uncontrolled; props override when present) ─────────\n const [localPage, setLocalPage] = useState<number>(currentPageProp ?? 0);\n const activePage =\n currentPageProp !== undefined ? currentPageProp : localPage;\n\n // ── Derived flags ────────────────────────────────────────────────────────\n const hasDetailRows = rows.some((row) => row.detailCard != null);\n // Total column count used for detail-row colSpan\n const colCount = columns.length + (hasDetailRows ? 1 : 0);\n\n // ── Sorted rows ──────────────────────────────────────────────────────────\n const sortedRows = useMemo(() => {\n if (!activeSortKey) return rows;\n return [...rows].sort((a, b) => {\n const av = (a.data as Record<string, unknown>)[activeSortKey];\n const bv = (b.data as Record<string, unknown>)[activeSortKey];\n if (av == null && bv == null) return 0;\n if (av == null) return 1;\n if (bv == null) return -1;\n const cmp = av < bv ? -1 : av > bv ? 1 : 0;\n return activeSortAsc ? cmp : -cmp;\n });\n }, [rows, activeSortKey, activeSortAsc]);\n\n // ── Paginated slice ──────────────────────────────────────────────────────\n const paginatedRows = useMemo(() => {\n if (!pageSize) return sortedRows;\n const start = activePage * pageSize;\n return sortedRows.slice(start, start + pageSize);\n }, [sortedRows, pageSize, activePage]);\n\n const totalPages = pageSize ? Math.ceil(sortedRows.length / pageSize) : 1;\n\n // ── Handlers ─────────────────────────────────────────────────────────────\n const handleSortClick = (key: string) => {\n const newAsc = activeSortKey === key ? !activeSortAsc : true;\n setLocalSortKey(key);\n setLocalSortAsc(newAsc);\n onSortChanged({key, ascending: newAsc});\n };\n\n const handleToggleDetail = (row: DataTableRowType, e: React.MouseEvent) => {\n e.stopPropagation();\n setExpandedRows((prev) => {\n const next = new Set(prev);\n if (next.has(row.id)) {\n next.delete(row.id);\n onHideDetail({rowId: row.id, row});\n } else {\n next.add(row.id);\n onShowDetail({rowId: row.id, row});\n }\n return next;\n });\n };\n\n const handleRowClick = (row: DataTableRowType) => {\n onRowClicked({rowId: row.id, row});\n };\n\n const handlePageChange = (page: number) => {\n setLocalPage(page);\n if (pageSize) {\n onPageChanged({page, pageSize});\n }\n };\n\n // ── Cell padding ─────────────────────────────────────────────────────────\n const cellPad = compact ? \"py-1 px-2\" : \"py-2 px-3\";\n\n // ── Render ────────────────────────────────────────────────────────────────\n return (\n <div className={cn(\"w-full\", className)} data-pihanga={cardName}>\n <Table>\n {caption && <TableCaption>{caption}</TableCaption>}\n\n {/* ── Header ─────────────────────────────────────────────────────── */}\n <TableHeader\n className={\n stickyHeader ? \"sticky top-0 z-10 bg-background\" : undefined\n }\n >\n <TableRow>\n {/* Expand-toggle placeholder header cell */}\n {hasDetailRows && (\n <TableHead className=\"w-10 px-2\" aria-label=\"Row details\" />\n )}\n\n {columns.map((col) => (\n <TableHead\n key={col.key}\n style={col.width ? {width: col.width} : undefined}\n className={cn(\n cellPad,\n col.align === \"center\" && \"text-center\",\n col.align === \"right\" && \"text-right\",\n col.sortable && \"cursor-pointer select-none\",\n col.headerClassName,\n )}\n onClick={\n col.sortable ? () => handleSortClick(col.key) : undefined\n }\n >\n <span className=\"inline-flex items-center\">\n {col.title ?? keyToTitle(col.key)}\n {col.sortable && (\n <SortIcon\n columnKey={col.key}\n activeKey={activeSortKey}\n ascending={activeSortAsc}\n />\n )}\n </span>\n </TableHead>\n ))}\n </TableRow>\n </TableHeader>\n\n {/* ── Body ───────────────────────────────────────────────────────── */}\n <TableBody>\n {paginatedRows.length === 0 ? (\n /* Empty state */\n <TableRow>\n <TableCell\n colSpan={colCount}\n className=\"py-8 text-center text-muted-foreground\"\n >\n {emptyCard ? (\n <Card cardName={emptyCard} parentCard={cardName} />\n ) : (\n emptyText\n )}\n </TableCell>\n </TableRow>\n ) : (\n paginatedRows.map((row, rowIdx) => {\n const isExpanded = expandedRows.has(row.id);\n const isStriped = striped && rowIdx % 2 === 1;\n\n return (\n <React.Fragment key={row.id}>\n {/* ── Data row ─────────────────────────────────────────── */}\n <TableRow\n className={cn(\n isStriped && \"bg-muted/30\",\n hoverable && \"cursor-pointer\",\n )}\n data-expanded={isExpanded || undefined}\n onClick={() => handleRowClick(row)}\n >\n {/* Expand / collapse toggle */}\n {hasDetailRows && (\n <TableCell className=\"w-10 px-2\">\n {row.detailCard && (\n <button\n type=\"button\"\n aria-label={\n isExpanded ? \"Collapse detail\" : \"Expand detail\"\n }\n aria-expanded={isExpanded}\n className={cn(\n \"flex items-center justify-center rounded p-0.5 transition-colors\",\n \"hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring\",\n )}\n onClick={(e) => handleToggleDetail(row, e)}\n >\n {isExpanded ? (\n <ChevronDown className=\"size-4\" />\n ) : (\n <ChevronRight className=\"size-4\" />\n )}\n </button>\n )}\n </TableCell>\n )}\n\n {/* Data cells */}\n {columns.map((col) => {\n const value = (row.data as Record<string, unknown>)[\n col.key\n ];\n return (\n <TableCell\n key={col.key}\n className={cn(\n cellPad,\n col.align === \"center\" && \"text-center\",\n col.align === \"right\" && \"text-right\",\n col.cellClassName,\n )}\n >\n {renderCell(col, value, cardName)}\n </TableCell>\n );\n })}\n </TableRow>\n\n {/* ── Detail row (full-width, shown when expanded) ──────── */}\n {isExpanded && row.detailCard && (\n <TableRow\n // Suppress the default hover/click styles on the detail row\n className=\"hover:bg-transparent\"\n onClick={(e) => e.stopPropagation()}\n >\n <TableCell colSpan={colCount} className=\"border-b p-0\">\n <div className=\"bg-muted/20 px-4 py-3\">\n {/*\n * cardKey creates a unique virtual card instance per row\n * (e.g. \"myDetailTemplate@detail-42\").\n * The `row` prop is forwarded as ctxtProps so the detail\n * card's state-mapper functions can access it via\n * `ctx.ctxtProps.row` — no need to pre-register one card\n * per row.\n */}\n <Card\n cardName={row.detailCard}\n cardKey={`detail-${row.id}`}\n row={row}\n parentCard={cardName}\n key={`${cardName}-${row.id}-detail`}\n />\n </div>\n </TableCell>\n </TableRow>\n )}\n </React.Fragment>\n );\n })\n )}\n </TableBody>\n </Table>\n\n {/* ── Pagination controls ──────────────────────────────────────────── */}\n {pageSize && totalPages > 1 && (\n <PaginationBar\n page={activePage}\n totalPages={totalPages}\n onPrev={() => handlePageChange(activePage - 1)}\n onNext={() => handlePageChange(activePage + 1)}\n />\n )}\n </div>\n );\n};\n"],"mappings":";;;;;;;;AAgCA,SAAS,GACP,GACA,GACA,GACiB;CACjB,IAAI,KAAS,MAAM,OAAO;C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