@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 @@
1
+ {"version":3,"file":"navbarSearch.type.js","names":[],"sources":["../../../src/cards/navbarSearch/navbarSearch.type.ts"],"sourcesContent":["import {\n createCardDeclaration,\n createOnAction,\n registerActions,\n} from \"@pihanga2/core\";\n\nexport const NAVBAR_SEARCH_CARD = \"navbarSearch\";\nexport const NavbarSearch = createCardDeclaration<\n NavbarSearchProps,\n NavbarSearchEvents\n>(NAVBAR_SEARCH_CARD);\n\nexport const NAVBAR_SEARCH_ACTION = registerActions(NAVBAR_SEARCH_CARD, [\n \"search_submit\",\n \"search_items\",\n \"search_focus\",\n]);\n\nexport const onNavbarSearchSubmit =\n createOnAction<NavbarSearchEvent>(NAVBAR_SEARCH_ACTION.SEARCH_SUBMIT);\nexport const onNavbarSearchItems = createOnAction<NavbarSearchInputEvent>(\n NAVBAR_SEARCH_ACTION.SEARCH_ITEMS,\n);\nexport const onNavbarSearchFocus = createOnAction<NavbarSearchFocusEvent>(\n NAVBAR_SEARCH_ACTION.SEARCH_FOCUS,\n);\n\nexport type NavbarSearchProps = {\n searchItems?: string[];\n placeholder?: string;\n};\n\nexport type NavbarSearchEvent = {search: string};\nexport type NavbarSearchInputEvent = {search: string};\nexport type NavbarSearchFocusEvent = Record<string, never>;\n\nexport type NavbarSearchEvents = {\n onSearchSubmit: NavbarSearchEvent;\n onSearchItems?: NavbarSearchInputEvent;\n onSearchFocus?: NavbarSearchFocusEvent;\n};\n"],"mappings":";;AAMA,IAAa,IAAqB,gBACrB,IAAe,EAG1B,CAAkB,GAEP,IAAuB,EAAgB,GAAoB;CACtE;CACA;CACA;AACF,CAAC,GAEY,IACX,EAAkC,EAAqB,aAAa,GACzD,IAAsB,EACjC,EAAqB,YACvB,GACa,IAAsB,EACjC,EAAqB,YACvB"}
@@ -0,0 +1,2 @@
1
+ export * from './pageWithNavbar.type';
2
+ export declare const SdPageWithNavbar: <S extends import('@pihanga2/core').ReduxState>(p: import('@pihanga2/core').PiMapProps<{}, S, {}>) => import('@pihanga2/core').PiCardDef;
@@ -0,0 +1,14 @@
1
+ import { Component as e } from "./pageWithNavbar.component.js";
2
+ import { PAGE_WITH_NAVBAR_ACTION as t, PAGE_WITH_NAVBAR_CARD as n, PageWithNavbar as r, onPageWithNavbarNavigateTo as i } from "./pageWithNavbar.type.js";
3
+ import { actionTypesToEvents as a, createCardDeclaration as o, registerCardComponent as s } from "@pihanga2/core";
4
+ //#region src/cards/pageWithNavbar/index.ts
5
+ var c = "shad/pageWithNavbar", l = o(c);
6
+ s({
7
+ name: c,
8
+ component: e,
9
+ events: a(t)
10
+ });
11
+ //#endregion
12
+ export { t as PAGE_WITH_NAVBAR_ACTION, n as PAGE_WITH_NAVBAR_CARD, r as PageWithNavbar, l as SdPageWithNavbar, i as onPageWithNavbarNavigateTo };
13
+
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/cards/pageWithNavbar/index.ts"],"sourcesContent":["import {\n actionTypesToEvents,\n createCardDeclaration,\n registerCardComponent,\n} from \"@pihanga2/core\";\n\nimport {Component} from \"./pageWithNavbar.component\";\nimport {PAGE_WITH_NAVBAR_ACTION} from \"./pageWithNavbar.type\";\n\nexport * from \"./pageWithNavbar.type\";\n\nconst CARD_NAME = \"shad/pageWithNavbar\";\n\nexport const SdPageWithNavbar = createCardDeclaration(CARD_NAME);\n\nregisterCardComponent({\n name: CARD_NAME,\n component: Component,\n events: actionTypesToEvents(PAGE_WITH_NAVBAR_ACTION),\n});\n"],"mappings":";;;;AAWA,IAAM,IAAY,uBAEL,IAAmB,EAAsB,CAAS;AAE/D,EAAsB;CACpB,MAAM;CACN,WAAW;CACX,QAAQ,EAAoB,CAAuB;AACrD,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { PiCardProps } from '@pihanga2/core';
2
+ import { PageWithNavbarEvents, PageWithNavbarProps } from './pageWithNavbar.type';
3
+ export type ShadStyle = {
4
+ shad?: {
5
+ window?: string;
6
+ page?: string;
7
+ header?: string;
8
+ main?: string;
9
+ footer?: string;
10
+ };
11
+ };
12
+ export declare const Component: (props: PiCardProps<PageWithNavbarProps<ShadStyle>, PageWithNavbarEvents>) => React.ReactNode;
@@ -0,0 +1,153 @@
1
+ import { Button as e } from "../../components/ui/button.js";
2
+ import { getIconElement as t } from "../icons.js";
3
+ import { Sheet as n, SheetContent as r, SheetTrigger as i } from "../../components/ui/sheet.js";
4
+ import { SCREEN_SIZE_ORDER as a, SCREEN_SIZE_WIDTHS as o, ScreenSize as s } from "../types.js";
5
+ /* empty css */
6
+ import { Card as c } from "@pihanga2/core";
7
+ import { useEffect as l, useRef as u, useState as d } from "react";
8
+ import f from "clsx";
9
+ import { jsx as p, jsxs as m } from "react/jsx-runtime";
10
+ import { Menu as h } from "lucide-react";
11
+ //#region src/cards/pageWithNavbar/pageWithNavbar.component.tsx
12
+ function g() {
13
+ let e = typeof window < "u" ? window.innerWidth : 0;
14
+ for (let t = a.length - 1; t >= 0; t--) {
15
+ let n = a[t];
16
+ if (e >= o[n]) return n;
17
+ }
18
+ return s.XS;
19
+ }
20
+ function _() {
21
+ let [e, t] = d(g);
22
+ return l(() => {
23
+ let e = () => t(g());
24
+ return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
25
+ }, []), e;
26
+ }
27
+ function v(e) {
28
+ return typeof e == "object" && !!e;
29
+ }
30
+ function y(e, t) {
31
+ if (!e) return;
32
+ if (!v(e)) return e;
33
+ let n = a.indexOf(t);
34
+ for (let t = n; t >= 0; t--) {
35
+ let n = a[t];
36
+ if (Object.prototype.hasOwnProperty.call(e, n)) return e[n] ?? void 0;
37
+ }
38
+ return e.default ?? void 0;
39
+ }
40
+ var b = (a) => {
41
+ let { title: o, iconName: s, main: d, footer: g, navLinks: v = [], scrollResetKey: b, headerLeftCard: S, headerRightCard: C, style: w, onNavigateTo: T, cardName: E } = a, D = _(), O = w?.shad ?? {}, k = u(null);
42
+ l(() => {
43
+ k.current?.scrollTo({
44
+ top: 0,
45
+ behavior: "auto"
46
+ });
47
+ }, [b]);
48
+ let A = y(S, D), j = y(C, D), M = v.length > 0;
49
+ function N({ className: e }) {
50
+ let n = s ? t(s) : void 0;
51
+ return /* @__PURE__ */ m("div", {
52
+ className: f("title-section", e),
53
+ children: [n && /* @__PURE__ */ p(n, {
54
+ className: "title-icon",
55
+ "aria-hidden": !0
56
+ }), /* @__PURE__ */ p("span", {
57
+ className: "title-text",
58
+ children: o
59
+ })]
60
+ });
61
+ }
62
+ function P() {
63
+ return /* @__PURE__ */ m("nav", {
64
+ className: "nav-md",
65
+ "aria-label": "Main navigation",
66
+ children: [/* @__PURE__ */ p(N, {}), v.map((t) => /* @__PURE__ */ p(e, {
67
+ onClick: () => T({ id: t.id }),
68
+ variant: "link",
69
+ className: "nav-link",
70
+ children: t.title ?? x(t.id)
71
+ }, t.id))]
72
+ });
73
+ }
74
+ function F() {
75
+ return /* @__PURE__ */ m(n, { children: [/* @__PURE__ */ p(i, {
76
+ asChild: !0,
77
+ children: /* @__PURE__ */ p(e, {
78
+ variant: "outline",
79
+ size: "icon",
80
+ className: "shrink-0 md:hidden",
81
+ "aria-label": "Toggle navigation menu",
82
+ children: /* @__PURE__ */ p(h, {
83
+ className: "h-5 w-5",
84
+ "aria-hidden": !0
85
+ })
86
+ })
87
+ }), /* @__PURE__ */ p(r, {
88
+ side: "left",
89
+ children: /* @__PURE__ */ m("nav", {
90
+ className: "nav-sm",
91
+ "aria-label": "Mobile navigation",
92
+ children: [/* @__PURE__ */ p(N, {}), v.map((t) => /* @__PURE__ */ p(e, {
93
+ onClick: () => T({ id: t.id }),
94
+ variant: "link",
95
+ className: "nav-link",
96
+ children: t.title ?? x(t.id)
97
+ }, t.id))]
98
+ })
99
+ })] });
100
+ }
101
+ return /* @__PURE__ */ p("div", {
102
+ className: f("window", O.window),
103
+ "data-pihanga": E,
104
+ children: /* @__PURE__ */ m("div", {
105
+ className: f("page", O.page),
106
+ children: [
107
+ /* @__PURE__ */ m("header", {
108
+ className: f("header", O.header),
109
+ children: [
110
+ /* @__PURE__ */ p(P, {}),
111
+ M && /* @__PURE__ */ p(F, {}),
112
+ !M && /* @__PURE__ */ p("div", {
113
+ className: "md:hidden",
114
+ children: /* @__PURE__ */ p(N, {})
115
+ }),
116
+ /* @__PURE__ */ m("div", {
117
+ className: "header-actions",
118
+ children: [A && /* @__PURE__ */ p(c, {
119
+ cardName: A,
120
+ parentCard: E
121
+ }), j && /* @__PURE__ */ p(c, {
122
+ cardName: j,
123
+ parentCard: E
124
+ })]
125
+ })
126
+ ]
127
+ }),
128
+ /* @__PURE__ */ p("main", {
129
+ className: f("main", O.main),
130
+ ref: k,
131
+ children: /* @__PURE__ */ p(c, {
132
+ cardName: d,
133
+ parentCard: E
134
+ })
135
+ }),
136
+ g && /* @__PURE__ */ p("footer", {
137
+ className: f("footer", O.footer),
138
+ children: /* @__PURE__ */ p(c, {
139
+ cardName: g,
140
+ parentCard: E
141
+ })
142
+ })
143
+ ]
144
+ })
145
+ });
146
+ };
147
+ function x(e) {
148
+ return e ? e.charAt(0).toLocaleUpperCase() + e.slice(1) : "";
149
+ }
150
+ //#endregion
151
+ export { b as Component };
152
+
153
+ //# sourceMappingURL=pageWithNavbar.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pageWithNavbar.component.js","names":[],"sources":["../../../src/cards/pageWithNavbar/pageWithNavbar.component.tsx"],"sourcesContent":["import {Menu} from \"lucide-react\";\nimport clsx from \"clsx\";\nimport {useEffect, useRef, useState} from \"react\";\n\nimport {Button} from \"@/components/ui/button\";\nimport {Sheet, SheetContent, SheetTrigger} from \"@/components/ui/sheet\";\nimport {Card, type PiCardProps} from \"@pihanga2/core\";\nimport {getIconElement} from \"@/cards/icons\";\nimport {ScreenSize, SCREEN_SIZE_ORDER, SCREEN_SIZE_WIDTHS} from \"@/cards/types\";\nimport type {\n PageWithNavbarEvents,\n PageWithNavbarProps,\n ResponsiveCardRef,\n} from \"./pageWithNavbar.type\";\nimport type {SizeMap} from \"@/cards/types\";\nimport type {PiCardRef} from \"@pihanga2/core\";\n\nimport \"./pageWithNavbar.css\";\n\n// ---------------------------------------------------------------------------\n// Style override type — consumers can extend this to add Tailwind class names\n// to any structural section of the layout.\n// ---------------------------------------------------------------------------\n\nexport type ShadStyle = {\n shad?: {\n window?: string;\n page?: string;\n header?: string;\n main?: string;\n footer?: string;\n };\n};\n\n// ---------------------------------------------------------------------------\n// Screen-size hook\n// ---------------------------------------------------------------------------\n\nfunction getCurrentScreenSize(): ScreenSize {\n const w = typeof window !== \"undefined\" ? window.innerWidth : 0;\n // Walk breakpoints from largest to smallest\n for (let i = SCREEN_SIZE_ORDER.length - 1; i >= 0; i--) {\n const size = SCREEN_SIZE_ORDER[i];\n if (w >= SCREEN_SIZE_WIDTHS[size]) return size;\n }\n return ScreenSize.XS;\n}\n\nfunction useScreenSize(): ScreenSize {\n const [size, setSize] = useState<ScreenSize>(getCurrentScreenSize);\n\n useEffect(() => {\n const handleResize = () => setSize(getCurrentScreenSize());\n window.addEventListener(\"resize\", handleResize);\n return () => window.removeEventListener(\"resize\", handleResize);\n }, []);\n\n return size;\n}\n\n// ---------------------------------------------------------------------------\n// Responsive card-ref resolution\n// ---------------------------------------------------------------------------\n\nfunction isSizeMap(ref: ResponsiveCardRef): ref is SizeMap<PiCardRef> {\n return typeof ref === \"object\" && ref !== null;\n}\n\n/**\n * Resolve a {@link ResponsiveCardRef} to a concrete `PiCardRef` (or\n * `undefined`) for the given screen size.\n *\n * Uses a **mobile-first cascade**: the entry with the largest breakpoint\n * that is still ≤ `currentSize` wins; falls back to `default` otherwise.\n */\nfunction resolveCardRef(\n ref: ResponsiveCardRef | undefined,\n currentSize: ScreenSize,\n): PiCardRef | undefined {\n if (!ref) return undefined;\n if (!isSizeMap(ref)) return ref; // plain PiCardRef (string or PiCardDef)\n\n // Cascade: find the highest breakpoint that is ≤ current size\n const currentIdx = SCREEN_SIZE_ORDER.indexOf(currentSize);\n for (let i = currentIdx; i >= 0; i--) {\n const size = SCREEN_SIZE_ORDER[i];\n if (Object.prototype.hasOwnProperty.call(ref, size)) {\n const val = ref[size];\n // null means \"explicitly hidden at this breakpoint\"\n return val ?? undefined;\n }\n }\n // Fall back to the default entry\n return ref.default ?? undefined;\n}\n\n// ---------------------------------------------------------------------------\n// Component\n// ---------------------------------------------------------------------------\n\nexport const Component = (\n props: PiCardProps<PageWithNavbarProps<ShadStyle>, PageWithNavbarEvents>,\n): React.ReactNode => {\n const {\n title,\n iconName,\n main,\n footer,\n navLinks = [],\n scrollResetKey,\n headerLeftCard,\n headerRightCard,\n style,\n onNavigateTo,\n cardName,\n } = props;\n\n const screenSize = useScreenSize();\n const cl = style?.shad ?? {};\n const mainRef = useRef<HTMLElement | null>(null);\n\n // Scroll main back to top when the logical \"page\" changes\n useEffect(() => {\n mainRef.current?.scrollTo({top: 0, behavior: \"auto\"});\n }, [scrollResetKey]);\n\n const resolvedLeftCard = resolveCardRef(headerLeftCard, screenSize);\n const resolvedRightCard = resolveCardRef(headerRightCard, screenSize);\n const hasNavLinks = navLinks.length > 0;\n\n // ------------------------------------------------------------------\n // Sub-components\n // ------------------------------------------------------------------\n\n /** Title section: optional icon + text */\n function TitleSection({className}: {className?: string}) {\n const IconEl = iconName ? getIconElement(iconName) : undefined;\n return (\n <div className={clsx(\"title-section\", className)}>\n {IconEl && <IconEl className=\"title-icon\" aria-hidden />}\n <span className=\"title-text\">{title}</span>\n </div>\n );\n }\n\n /** Nav bar rendered on medium screens and above */\n function NavMd() {\n return (\n <nav className=\"nav-md\" aria-label=\"Main navigation\">\n <TitleSection />\n {navLinks.map((el) => (\n <Button\n key={el.id}\n onClick={() => onNavigateTo({id: el.id})}\n variant=\"link\"\n className=\"nav-link\"\n >\n {el.title ?? capitalize(el.id)}\n </Button>\n ))}\n </nav>\n );\n }\n\n /** Hamburger trigger that opens a slide-out sheet on small screens */\n function NavSm() {\n return (\n <Sheet>\n <SheetTrigger asChild>\n <Button\n variant=\"outline\"\n size=\"icon\"\n className=\"shrink-0 md:hidden\"\n aria-label=\"Toggle navigation menu\"\n >\n <Menu className=\"h-5 w-5\" aria-hidden />\n </Button>\n </SheetTrigger>\n <SheetContent side=\"left\">\n <nav className=\"nav-sm\" aria-label=\"Mobile navigation\">\n <TitleSection />\n {navLinks.map((el) => (\n <Button\n key={el.id}\n onClick={() => onNavigateTo({id: el.id})}\n variant=\"link\"\n className=\"nav-link\"\n >\n {el.title ?? capitalize(el.id)}\n </Button>\n ))}\n </nav>\n </SheetContent>\n </Sheet>\n );\n }\n\n // ------------------------------------------------------------------\n // Layout\n // ------------------------------------------------------------------\n\n return (\n <div className={clsx(\"window\", cl.window)} data-pihanga={cardName}>\n <div className={clsx(\"page\", cl.page)}>\n {/* ── Header ─────────────────────────────────────────────── */}\n <header className={clsx(\"header\", cl.header)}>\n {/* Medium+ nav (title + links) */}\n <NavMd />\n\n {/* Small-screen hamburger (only when there are nav links) */}\n {hasNavLinks && <NavSm />}\n\n {/* On small screens with no nav links, show the title inline.\n Wrap in a plain div so md:hidden isn't overridden by the\n .title-section CSS class that sets display:inline-flex. */}\n {!hasNavLinks && (\n <div className=\"md:hidden\">\n <TitleSection />\n </div>\n )}\n\n {/* Push action cards to the right */}\n <div className=\"header-actions\">\n {resolvedLeftCard && (\n <Card cardName={resolvedLeftCard} parentCard={cardName} />\n )}\n {resolvedRightCard && (\n <Card cardName={resolvedRightCard} parentCard={cardName} />\n )}\n </div>\n </header>\n\n {/* ── Main ───────────────────────────────────────────────── */}\n <main className={clsx(\"main\", cl.main)} ref={mainRef}>\n <Card cardName={main} parentCard={cardName} />\n </main>\n\n {/* ── Footer (optional) ──────────────────────────────────── */}\n {footer && (\n <footer className={clsx(\"footer\", cl.footer)}>\n <Card cardName={footer} parentCard={cardName} />\n </footer>\n )}\n </div>\n </div>\n );\n};\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nfunction capitalize(str: string): string {\n if (!str) return \"\";\n return str.charAt(0).toLocaleUpperCase() + str.slice(1);\n}\n"],"mappings":";;;;;;;;;;;AAsCA,SAAS,IAAmC;CAC1C,IAAM,IAAI,OAAO,SAAW,MAAc,OAAO,aAAa;CAE9D,KAAK,IAAI,IAAI,EAAkB,SAAS,GAAG,KAAK,GAAG,KAAK;EACtD,IAAM,IAAO,EAAkB;EAC/B,IAAI,KAAK,EAAmB,IAAO,OAAO;CAC5C;CACA,OAAO,EAAW;AACpB;AAEA,SAAS,IAA4B;CAC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OAAK,WAAU;iBAAf,CACG,KACC,kBAAC,GAAD;QAAM,UAAU;QAAkB,YAAY;OAAW,CAAA,GAE1D,KACC,kBAAC,GAAD;QAAM,UAAU;QAAmB,YAAY;OAAW,CAAA,CAEzD;;KACC;;IAGR,kBAAC,QAAD;KAAM,WAAW,EAAK,QAAQ,EAAG,IAAI;KAAG,KAAK;eAC3C,kBAAC,GAAD;MAAM,UAAU;MAAM,YAAY;KAAW,CAAA;IACzC,CAAA;IAGL,KACC,kBAAC,UAAD;KAAQ,WAAW,EAAK,UAAU,EAAG,MAAM;eACzC,kBAAC,GAAD;MAAM,UAAU;MAAQ,YAAY;KAAW,CAAA;IACzC,CAAA;GAEP;;CACF,CAAA;AAET;AAMA,SAAS,EAAW,GAAqB;CAEvC,OADK,IACE,EAAI,OAAO,CAAC,EAAE,kBAAkB,IAAI,EAAI,MAAM,CAAC,IADrC;AAEnB"}
@@ -0,0 +1,81 @@
1
+ import { PiCardRef } from '@pihanga2/core';
2
+ import { SizeMap } from '../types';
3
+ export declare const PAGE_WITH_NAVBAR_CARD = "pageWithNavbar";
4
+ export declare const PageWithNavbar: <S extends import('@pihanga2/core').ReduxState>(p: import('@pihanga2/core').PiMapProps<PageWithNavbarProps<unknown>, S, PageWithNavbarEvents>) => import('@pihanga2/core').PiCardDef;
5
+ export declare const PAGE_WITH_NAVBAR_ACTION: {
6
+ NAVIGATE_TO: string;
7
+ };
8
+ export declare const onPageWithNavbarNavigateTo: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core').PiRegister, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
9
+ cardID: string;
10
+ } & PageWithNavbarNavigateToEvent>) => void;
11
+ /**
12
+ * A card reference that can optionally vary by screen size.
13
+ *
14
+ * Pass a plain `PiCardRef` string to always show the same card, or a
15
+ * {@link SizeMap} to show different cards (or none) at each breakpoint.
16
+ *
17
+ * @example
18
+ * // Always show the same card
19
+ * headerRightCard: "myAccountCard"
20
+ *
21
+ * // Show on md and above only
22
+ * headerRightCard: { [ScreenSize.MD]: "myAccountCard" }
23
+ *
24
+ * // Different card per breakpoint
25
+ * headerLeftCard: {
26
+ * [ScreenSize.XS]: "mobileSearchCard",
27
+ * [ScreenSize.MD]: "desktopSearchCard",
28
+ * }
29
+ */
30
+ export type ResponsiveCardRef = PiCardRef | SizeMap<PiCardRef>;
31
+ export type PageWithNavbarProps<S = unknown> = {
32
+ /** Page title displayed in the header. */
33
+ title: string;
34
+ /**
35
+ * Name of an icon registered via {@link registerIcon} in `icons.ts`.
36
+ * When provided, the icon is rendered next to the title in the header.
37
+ */
38
+ iconName?: string;
39
+ /** The main content card. */
40
+ main: PiCardRef;
41
+ /**
42
+ * Optional footer card.
43
+ * When omitted the footer row is not rendered.
44
+ */
45
+ footer?: PiCardRef;
46
+ /**
47
+ * Navigation links rendered in the header nav bar.
48
+ * On small screens they are collapsed behind a hamburger menu.
49
+ */
50
+ navLinks?: NavLink[];
51
+ /**
52
+ * When this value changes the main content area scrolls back to the top.
53
+ * Set it to any string that is unique per logical "page load" — typically
54
+ * the URL or ID of the currently loaded resource (e.g. "foo.xml").
55
+ */
56
+ scrollResetKey?: string;
57
+ /**
58
+ * Optional card shown on the left side of the header actions area.
59
+ * Supports size-dependent rendering via {@link ResponsiveCardRef}.
60
+ */
61
+ headerLeftCard?: ResponsiveCardRef;
62
+ /**
63
+ * Optional card shown on the right side of the header actions area.
64
+ * Supports size-dependent rendering via {@link ResponsiveCardRef}.
65
+ */
66
+ headerRightCard?: ResponsiveCardRef;
67
+ /** Additional style overrides passed through to the component. */
68
+ style?: S;
69
+ /** Additional CSS class names applied to the outermost wrapper. */
70
+ className?: string;
71
+ };
72
+ export type NavLink = {
73
+ id: string;
74
+ title?: string;
75
+ };
76
+ export type PageWithNavbarNavigateToEvent = {
77
+ id: string;
78
+ };
79
+ export type PageWithNavbarEvents = {
80
+ onNavigateTo: PageWithNavbarNavigateToEvent;
81
+ };
@@ -0,0 +1,7 @@
1
+ import { createCardDeclaration as e, createOnAction as t, registerActions as n } from "@pihanga2/core";
2
+ //#region src/cards/pageWithNavbar/pageWithNavbar.type.ts
3
+ var r = "pageWithNavbar", i = e(r), a = n(r, ["navigate_to"]), o = t(a.NAVIGATE_TO);
4
+ //#endregion
5
+ export { a as PAGE_WITH_NAVBAR_ACTION, r as PAGE_WITH_NAVBAR_CARD, i as PageWithNavbar, o as onPageWithNavbarNavigateTo };
6
+
7
+ //# sourceMappingURL=pageWithNavbar.type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pageWithNavbar.type.js","names":[],"sources":["../../../src/cards/pageWithNavbar/pageWithNavbar.type.ts"],"sourcesContent":["import {\n createCardDeclaration,\n createOnAction,\n type PiCardRef,\n registerActions,\n} from \"@pihanga2/core\";\nimport type {SizeMap} from \"@/cards/types\";\n\nexport const PAGE_WITH_NAVBAR_CARD = \"pageWithNavbar\";\nexport const PageWithNavbar = createCardDeclaration<\n PageWithNavbarProps,\n PageWithNavbarEvents\n>(PAGE_WITH_NAVBAR_CARD);\n\nexport const PAGE_WITH_NAVBAR_ACTION = registerActions(PAGE_WITH_NAVBAR_CARD, [\n \"navigate_to\",\n]);\n\nexport const onPageWithNavbarNavigateTo =\n createOnAction<PageWithNavbarNavigateToEvent>(\n PAGE_WITH_NAVBAR_ACTION.NAVIGATE_TO,\n );\n\n/**\n * A card reference that can optionally vary by screen size.\n *\n * Pass a plain `PiCardRef` string to always show the same card, or a\n * {@link SizeMap} to show different cards (or none) at each breakpoint.\n *\n * @example\n * // Always show the same card\n * headerRightCard: \"myAccountCard\"\n *\n * // Show on md and above only\n * headerRightCard: { [ScreenSize.MD]: \"myAccountCard\" }\n *\n * // Different card per breakpoint\n * headerLeftCard: {\n * [ScreenSize.XS]: \"mobileSearchCard\",\n * [ScreenSize.MD]: \"desktopSearchCard\",\n * }\n */\nexport type ResponsiveCardRef = PiCardRef | SizeMap<PiCardRef>;\n\nexport type PageWithNavbarProps<S = unknown> = {\n /** Page title displayed in the header. */\n title: string;\n\n /**\n * Name of an icon registered via {@link registerIcon} in `icons.ts`.\n * When provided, the icon is rendered next to the title in the header.\n */\n iconName?: string;\n\n /** The main content card. */\n main: PiCardRef;\n\n /**\n * Optional footer card.\n * When omitted the footer row is not rendered.\n */\n footer?: PiCardRef;\n\n /**\n * Navigation links rendered in the header nav bar.\n * On small screens they are collapsed behind a hamburger menu.\n */\n navLinks?: NavLink[];\n\n /**\n * When this value changes the main content area scrolls back to the top.\n * Set it to any string that is unique per logical \"page load\" — typically\n * the URL or ID of the currently loaded resource (e.g. \"foo.xml\").\n */\n scrollResetKey?: string;\n\n /**\n * Optional card shown on the left side of the header actions area.\n * Supports size-dependent rendering via {@link ResponsiveCardRef}.\n */\n headerLeftCard?: ResponsiveCardRef;\n\n /**\n * Optional card shown on the right side of the header actions area.\n * Supports size-dependent rendering via {@link ResponsiveCardRef}.\n */\n headerRightCard?: ResponsiveCardRef;\n\n /** Additional style overrides passed through to the component. */\n style?: S;\n\n /** Additional CSS class names applied to the outermost wrapper. */\n className?: string;\n};\n\nexport type NavLink = {\n id: string;\n title?: string;\n};\n\nexport type PageWithNavbarNavigateToEvent = {id: string};\n\nexport type PageWithNavbarEvents = {\n onNavigateTo: PageWithNavbarNavigateToEvent;\n};\n"],"mappings":";;AAQA,IAAa,IAAwB,kBACxB,IAAiB,EAG5B,CAAqB,GAEV,IAA0B,EAAgB,GAAuB,CAC5E,aACF,CAAC,GAEY,IACX,EACE,EAAwB,WAC1B"}
@@ -0,0 +1 @@
1
+ export * from './pasteTarget.types';
@@ -0,0 +1,13 @@
1
+ import { DEF_ERROR_COLOR as e, DEF_EVENT_DURATION_SECONDS as t, DEF_HEIGHT as n, DEF_OVERLAY_OPACITY as r, DEF_PASTE_FIRST_REMINDER as i, DEF_PASTE_TARGET_FILE_TYPES as a, DEF_SUCCESS_COLOR as o, PASTE_TARGET_ACTION as s, PASTE_TARGET_CARD as c, PasteTarget as l, onContentPasted as u, onPasteError as d } from "./pasteTarget.types.js";
2
+ import { PasteTargetComponent as f } from "./pasteTarget.component.js";
3
+ import { actionTypesToEvents as p, registerCardComponent as m } from "@pihanga2/core";
4
+ //#region src/cards/pasteTarget/index.ts
5
+ m({
6
+ name: c,
7
+ component: f,
8
+ events: p(s)
9
+ });
10
+ //#endregion
11
+ export { e as DEF_ERROR_COLOR, t as DEF_EVENT_DURATION_SECONDS, n as DEF_HEIGHT, r as DEF_OVERLAY_OPACITY, i as DEF_PASTE_FIRST_REMINDER, a as DEF_PASTE_TARGET_FILE_TYPES, o as DEF_SUCCESS_COLOR, s as PASTE_TARGET_ACTION, c as PASTE_TARGET_CARD, l as PasteTarget, u as onContentPasted, d as onPasteError };
12
+
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/cards/pasteTarget/index.ts"],"sourcesContent":["import {actionTypesToEvents, registerCardComponent} from \"@pihanga2/core\";\n\nimport {PasteTargetComponent} from \"./pasteTarget.component\";\nimport {PASTE_TARGET_ACTION, PASTE_TARGET_CARD} from \"./pasteTarget.types\";\n\nexport * from \"./pasteTarget.types\";\n\nregisterCardComponent({\n name: PASTE_TARGET_CARD,\n component: PasteTargetComponent,\n events: actionTypesToEvents(PASTE_TARGET_ACTION),\n});\n"],"mappings":";;;;AAOA,EAAsB;CACpB,MAAM;CACN,WAAW;CACX,QAAQ,EAAoB,CAAmB;AACjD,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { PasteTargetEvents, PasteTargetProps } from './pasteTarget.types';
2
+ import { PiCardProps } from '@pihanga2/core';
3
+ import { default as React } from 'react';
4
+ export declare const PasteTargetComponent: (props: PiCardProps<PasteTargetProps, PasteTargetEvents>) => React.ReactNode;
@@ -0,0 +1,158 @@
1
+ import { Button as e } from "../../components/ui/button.js";
2
+ import { DEF_ERROR_COLOR as t, DEF_HEIGHT as n, DEF_OVERLAY_OPACITY as r, DEF_PASTE_FIRST_REMINDER as i, DEF_SUCCESS_COLOR as a } from "./pasteTarget.types.js";
3
+ /* empty css */
4
+ import o, { useRef as s, useState as c } from "react";
5
+ import l from "clsx";
6
+ import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
7
+ //#region src/cards/pasteTarget/pasteTarget.component.tsx
8
+ var p = (p) => {
9
+ let { title: m, description: h, pasteFirstReminder: g = i, withUpload: _, fileTypes: v, height: y = n, onPastedContent: b, successColor: x = a, errorColor: S = t, eventDurationSeconds: C = 1, eventOpacity: w = r, cardName: T, className: E, _cls: D } = p, [O, k] = c(0), [A, j] = c("gray"), M = o.useRef(null), N = s(null), P = s(null), [F, I] = c(!1), L = {
10
+ backgroundColor: A,
11
+ opacity: O
12
+ }, R = (e) => {
13
+ M.current && clearTimeout(M.current), e.preventDefault();
14
+ let t = e.clipboardData || window.clipboardData;
15
+ if (t) {
16
+ let e = t.items, n = [];
17
+ for (let r = 0; r < e.length; r++) {
18
+ let i = e[r], a = i.type, o = t.getData(i.type);
19
+ o == "" || o == "\n" || n.push({
20
+ mimeType: a,
21
+ content: o
22
+ });
23
+ }
24
+ b({ items: n }), j(x);
25
+ } else j(S);
26
+ k(w), N.current && N.current.blur(), M.current = setTimeout(() => {
27
+ k(0), M.current = null;
28
+ }, C * 1e3);
29
+ };
30
+ o.useEffect(() => () => {
31
+ let e = M.current;
32
+ e && clearTimeout(e);
33
+ }, []);
34
+ function z() {
35
+ return /* @__PURE__ */ d("textarea", {
36
+ onPaste: R,
37
+ onFocus: () => {
38
+ I(!0);
39
+ },
40
+ onBlur: () => I(!1),
41
+ style: {
42
+ position: "absolute",
43
+ top: 0,
44
+ left: 0,
45
+ right: 0,
46
+ bottom: 0,
47
+ zIndex: 10,
48
+ resize: "none",
49
+ background: "transparent",
50
+ cursor: F ? "copy" : "pointer",
51
+ ...L
52
+ },
53
+ readOnly: !0,
54
+ ref: N
55
+ });
56
+ }
57
+ function B() {
58
+ if (v?.length) return v.map((e) => {
59
+ let t = e.toLowerCase();
60
+ return t === "jpg" || t === "jpeg" ? ".jpg,.jpeg" : `.${t}`;
61
+ }).join(",");
62
+ }
63
+ function V(e) {
64
+ M.current && clearTimeout(M.current), j(e), k(w), M.current = setTimeout(() => {
65
+ k(0), M.current = null;
66
+ }, C * 1e3);
67
+ }
68
+ function H(e) {
69
+ let t = e.target.files?.[0];
70
+ if (e.target.value = "", !t) return;
71
+ let n = new FileReader();
72
+ n.onload = (e) => {
73
+ let n = e.target?.result ?? "";
74
+ b({ items: [{
75
+ mimeType: t.type,
76
+ content: n
77
+ }] }), V(x);
78
+ }, n.onerror = () => {
79
+ V(S);
80
+ }, n.readAsDataURL(t);
81
+ }
82
+ function U(e) {
83
+ e.stopPropagation(), e.preventDefault(), P.current?.click();
84
+ }
85
+ function W() {
86
+ let t = !F && _ && /* @__PURE__ */ d(e, {
87
+ onClick: U,
88
+ style: {
89
+ position: "relative",
90
+ zIndex: 30,
91
+ pointerEvents: "auto"
92
+ },
93
+ children: "Upload"
94
+ });
95
+ return m ? /* @__PURE__ */ f("div", {
96
+ className: "paste-target-msg-title",
97
+ children: [/* @__PURE__ */ d("h2", { children: m }), t]
98
+ }) : /* @__PURE__ */ f("div", {
99
+ className: "paste-target-msg-title",
100
+ children: [
101
+ "Paste",
102
+ t && /* @__PURE__ */ f(u, { children: ["\xA0or\xA0", t] }),
103
+ "\xA0here"
104
+ ]
105
+ });
106
+ }
107
+ return /* @__PURE__ */ f("div", {
108
+ className: l(D("root", E || "pihanga-paste-target"), F && "pihanga-paste-target-focused"),
109
+ "data-pihanga": T,
110
+ style: {
111
+ position: "relative",
112
+ height: y,
113
+ width: "100%"
114
+ },
115
+ children: [
116
+ /* @__PURE__ */ f("div", {
117
+ className: "paste-target-label",
118
+ style: {
119
+ position: "absolute",
120
+ top: 0,
121
+ left: 0,
122
+ right: 0,
123
+ bottom: 0,
124
+ display: "flex",
125
+ flexDirection: "column",
126
+ justifyContent: "center",
127
+ alignItems: "center",
128
+ textAlign: "center",
129
+ pointerEvents: "none",
130
+ zIndex: 20
131
+ },
132
+ children: [
133
+ W(),
134
+ h && /* @__PURE__ */ d("span", {
135
+ className: "paste-target-msg-desc",
136
+ children: h
137
+ }),
138
+ /* @__PURE__ */ d("div", {
139
+ className: "paste-target-focus-reminder",
140
+ children: g
141
+ })
142
+ ]
143
+ }),
144
+ z(),
145
+ _ && /* @__PURE__ */ d("input", {
146
+ type: "file",
147
+ ref: P,
148
+ accept: B(),
149
+ onChange: H,
150
+ style: { display: "none" }
151
+ })
152
+ ]
153
+ });
154
+ };
155
+ //#endregion
156
+ export { p as PasteTargetComponent };
157
+
158
+ //# sourceMappingURL=pasteTarget.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pasteTarget.component.js","names":[],"sources":["../../../src/cards/pasteTarget/pasteTarget.component.tsx"],"sourcesContent":["import {\n DEF_ERROR_COLOR,\n DEF_EVENT_DURATION_SECONDS,\n DEF_HEIGHT,\n DEF_OVERLAY_OPACITY,\n DEF_PASTE_FIRST_REMINDER,\n DEF_SUCCESS_COLOR,\n PasteItem,\n PasteTargetEvents,\n PasteTargetProps,\n} from \"@/cards/pasteTarget/pasteTarget.types\";\nimport {PiCardProps} from \"@pihanga2/core\";\nimport React, {useRef, useState} from \"react\";\n\nimport \"./pasteTarget.css\";\nimport clsx from \"clsx\";\nimport {Button} from \"@/registry/ui/button\";\n\n// /* 3. Stretch the child to cover the parent entirely */\n// top: 0,\n// left: 0,\n// right: 0,\n// bottom: 0,\n\n// /* 4. Ensure the child is visually stacked above the parent's content */\n// z-index: 10,\n\n// /* Optional: Make the overlay visible (e.g., semi-transparent black) */\n// overlayOpacity: \"rgba(0, 0, 0, 0.5)\";\n// }\n\nexport const PasteTargetComponent = (\n props: PiCardProps<PasteTargetProps, PasteTargetEvents>,\n): React.ReactNode => {\n const {\n title, // = \"Paste content right here\",\n description,\n pasteFirstReminder = DEF_PASTE_FIRST_REMINDER,\n withUpload,\n fileTypes,\n\n height = DEF_HEIGHT,\n\n onPastedContent,\n\n successColor = DEF_SUCCESS_COLOR,\n errorColor = DEF_ERROR_COLOR,\n eventDurationSeconds = DEF_EVENT_DURATION_SECONDS,\n eventOpacity = DEF_OVERLAY_OPACITY,\n cardName,\n className,\n _cls,\n } = props;\n const [overlayOpacity, setOverlayOpacity] = useState<number>(0);\n const [overlayBackground, setOverlayBackground] = useState<string>(\"gray\");\n const timerRef = React.useRef<number | null>(null);\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n const fileInputRef = useRef<HTMLInputElement>(null);\n const [isFocused, setIsFocused] = useState<boolean>(false);\n\n const overlayStyle: React.CSSProperties = {\n backgroundColor: overlayBackground,\n opacity: overlayOpacity,\n };\n\n const handlePaste = (event: React.ClipboardEvent<HTMLTextAreaElement>) => {\n if (timerRef.current) {\n clearTimeout(timerRef.current);\n }\n\n event.preventDefault();\n const clipboardData =\n event.clipboardData ||\n (window as Window & {clipboardData?: DataTransfer}).clipboardData;\n\n if (clipboardData) {\n const pItems = clipboardData.items;\n const items: PasteItem[] = [];\n for (let i = 0; i < pItems.length; i++) {\n const pi = pItems[i];\n const mimeType = pi.type;\n const content = clipboardData.getData(pi.type);\n if (!(content == \"\" || content == \"\\n\")) {\n items.push({mimeType, content});\n }\n }\n onPastedContent({items});\n setOverlayBackground(successColor);\n } else {\n setOverlayBackground(errorColor);\n }\n setOverlayOpacity(eventOpacity);\n if (textareaRef.current) textareaRef.current.blur();\n\n // Set a timeout to switch the color back after 'n' seconds\n const newTimerId = setTimeout(() => {\n setOverlayOpacity(0);\n timerRef.current = null; // Clear the ref after the timeout executes\n }, eventDurationSeconds * 1000); // Convert seconds to milliseconds\n\n // Save the new timer ID to the ref (unknown necessary type casting)\n timerRef.current = newTimerId as unknown as number;\n };\n\n // Cleanup function to clear the timer when the component unmounts\n React.useEffect(() => {\n return () => {\n const ref = timerRef.current;\n if (ref) {\n clearTimeout(ref);\n }\n };\n }, []); // runs only on mount/unmount\n\n function renderPasteHandler() {\n return (\n <textarea\n onPaste={handlePaste}\n onFocus={() => {\n setIsFocused(true);\n }}\n onBlur={() => setIsFocused(false)}\n style={{\n position: \"absolute\",\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n zIndex: 10,\n resize: \"none\",\n background: \"transparent\",\n cursor: isFocused ? \"copy\" : \"pointer\",\n ...overlayStyle,\n }}\n // 🔑 CRUCIAL: Focus the element before pasting so it receives the paste event.\n // autoFocus\n readOnly\n ref={textareaRef}\n />\n );\n }\n\n /** Map friendly file-type labels to accept= strings for the hidden input. */\n function buildAccept(): string | undefined {\n if (!fileTypes?.length) return undefined;\n return fileTypes\n .map((t) => {\n const ext = t.toLowerCase();\n if (ext === \"jpg\" || ext === \"jpeg\") return \".jpg,.jpeg\";\n return `.${ext}`;\n })\n .join(\",\");\n }\n\n function flashOverlay(color: string) {\n if (timerRef.current) clearTimeout(timerRef.current);\n setOverlayBackground(color);\n setOverlayOpacity(eventOpacity);\n const id = setTimeout(() => {\n setOverlayOpacity(0);\n timerRef.current = null;\n }, eventDurationSeconds * 1000);\n timerRef.current = id as unknown as number;\n }\n\n function handleFileChange(ev: React.ChangeEvent<HTMLInputElement>) {\n const file = ev.target.files?.[0];\n // Reset input so the same file can be re-selected later.\n ev.target.value = \"\";\n if (!file) return;\n\n const reader = new FileReader();\n reader.onload = (e) => {\n const content = (e.target?.result as string) ?? \"\";\n onPastedContent({items: [{mimeType: file.type, content}]});\n flashOverlay(successColor);\n };\n reader.onerror = () => {\n flashOverlay(errorColor);\n };\n reader.readAsDataURL(file);\n }\n\n function onUpload(ev: React.MouseEvent<HTMLButtonElement>) {\n ev.stopPropagation();\n ev.preventDefault();\n fileInputRef.current?.click();\n }\n\n function renderTitle() {\n const uploadBtn = !isFocused && withUpload && (\n <Button\n onClick={onUpload}\n style={{position: \"relative\", zIndex: 30, pointerEvents: \"auto\"}}\n >\n Upload\n </Button>\n );\n\n if (title) {\n return (\n <div className=\"paste-target-msg-title\">\n <h2>{title}</h2>\n {uploadBtn}\n </div>\n );\n } else {\n return (\n <div className=\"paste-target-msg-title\">\n Paste\n {uploadBtn && (\n <>\n &nbsp;or&nbsp;\n {uploadBtn}\n </>\n )}\n &nbsp;here\n </div>\n );\n }\n }\n\n const cn = _cls(\"root\", className || \"pihanga-paste-target\");\n\n return (\n <div\n className={clsx(cn, isFocused && \"pihanga-paste-target-focused\")}\n data-pihanga={cardName}\n style={{position: \"relative\", height, width: \"100%\"}}\n >\n <div\n className=\"paste-target-label\"\n style={{\n position: \"absolute\",\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n display: \"flex\",\n flexDirection: \"column\",\n justifyContent: \"center\",\n alignItems: \"center\",\n textAlign: \"center\",\n // zIndex must be above textarea (10) so the Upload button is clickable.\n // pointer-events: none lets click/focus pass through to the textarea,\n // EXCEPT on children that override with pointer-events: auto (the button).\n pointerEvents: \"none\",\n zIndex: 20,\n }}\n >\n {renderTitle()}\n {description && (\n <span className=\"paste-target-msg-desc\">{description}</span>\n )}\n <div className=\"paste-target-focus-reminder\">{pasteFirstReminder}</div>\n </div>\n {renderPasteHandler()}\n {/* Hidden file input — triggered programmatically by the Upload button */}\n {withUpload && (\n <input\n type=\"file\"\n ref={fileInputRef}\n accept={buildAccept()}\n onChange={handleFileChange}\n style={{display: \"none\"}}\n />\n )}\n </div>\n );\n};\n"],"mappings":";;;;;;;AA+BA,IAAa,KACX,MACoB;CACpB,IAAM,EACJ,UACA,gBACA,wBAAqB,GACrB,eACA,cAEA,YAAS,GAET,oBAEA,kBAAe,GACf,gBAAa,GACb,0BAAA,GACA,kBAAe,GACf,aACA,cACA,YACE,GACE,CAAC,GAAgB,KAAqB,EAAiB,CAAC,GACxD,CAAC,GAAmB,KAAwB,EAAiB,MAAM,GACnE,IAAW,EAAM,OAAsB,IAAI,GAC3C,IAAc,EAA4B,IAAI,GAC9C,IAAe,EAAyB,IAAI,GAC5C,CAAC,GAAW,KAAgB,EAAkB,EAAK,GAEnD,IAAoC;EACxC,iBAAiB;EACjB,SAAS;CACX,GAEM,KAAe,MAAqD;EAKx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ACL,UAAU;KACV,KAAK;KACL,MAAM;KACN,OAAO;KACP,QAAQ;KACR,SAAS;KACT,eAAe;KACf,gBAAgB;KAChB,YAAY;KACZ,WAAW;KAIX,eAAe;KACf,QAAQ;IACV;cAlBF;KAoBG,EAAY;KACZ,KACC,kBAAC,QAAD;MAAM,WAAU;gBAAyB;KAAkB,CAAA;KAE7D,kBAAC,OAAD;MAAK,WAAU;gBAA+B;KAAwB,CAAA;IACnE;;GACJ,EAAmB;GAEnB,KACC,kBAAC,SAAD;IACE,MAAK;IACL,KAAK;IACL,QAAQ,EAAY;IACpB,UAAU;IACV,OAAO,EAAC,SAAS,OAAM;GACxB,CAAA;EAEA;;AAET"}
@@ -0,0 +1,46 @@
1
+ export declare const PASTE_TARGET_CARD = "paste-target";
2
+ export declare const PasteTarget: <S extends import('@pihanga2/core').ReduxState>(p: import('@pihanga2/core').PiMapProps<PasteTargetProps, S, PasteTargetEvents>) => import('@pihanga2/core').PiCardDef;
3
+ export declare const PASTE_TARGET_ACTION: {
4
+ ERROR: string;
5
+ PASTED_CONTENT: string;
6
+ };
7
+ export declare const onContentPasted: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core').PiRegister, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
8
+ cardID: string;
9
+ } & CloseEvent>) => void;
10
+ export declare const onPasteError: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core').PiRegister, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
11
+ cardID: string;
12
+ } & PasteTargetErrorEvent>) => void;
13
+ export declare const DEF_HEIGHT = "120px";
14
+ export declare const DEF_SUCCESS_COLOR = "lightgreen";
15
+ export declare const DEF_ERROR_COLOR = "lightcoral";
16
+ export declare const DEF_EVENT_DURATION_SECONDS = 1;
17
+ export declare const DEF_OVERLAY_OPACITY = 0.5;
18
+ export declare const DEF_PASTE_FIRST_REMINDER = "(Before pasting, click this box to get the focus)";
19
+ export type PasteTargetProps = {
20
+ fileTypes?: string[];
21
+ title?: string;
22
+ description?: string;
23
+ pasteFirstReminder?: string;
24
+ withUpload?: boolean;
25
+ height?: string | number;
26
+ successColor?: string;
27
+ errorColor?: string;
28
+ eventDurationSeconds?: number;
29
+ eventOpacity?: number;
30
+ className?: string;
31
+ };
32
+ export declare const DEF_PASTE_TARGET_FILE_TYPES: string[];
33
+ export type PasteItem = {
34
+ mimeType: string;
35
+ content: string;
36
+ };
37
+ export type PasteTargetPastedEvent = {
38
+ items: PasteItem[];
39
+ };
40
+ export type PasteTargetErrorEvent = {
41
+ error: string;
42
+ };
43
+ export type PasteTargetEvents = {
44
+ onPastedContent: PasteTargetPastedEvent;
45
+ onError: PasteTargetErrorEvent;
46
+ };
@@ -0,0 +1,11 @@
1
+ import { createCardDeclaration as e, createOnAction as t, registerActions as n } from "@pihanga2/core";
2
+ //#region src/cards/pasteTarget/pasteTarget.types.ts
3
+ var r = "paste-target", i = e(r), a = n(r, ["pasted_content", "error"]), o = t(a.PASTED_CONTENT), s = t(a.ERROR), c = "120px", l = "lightgreen", u = "lightcoral", d = 1, f = .5, p = "(Before pasting, click this box to get the focus)", m = [
4
+ "JPG",
5
+ "PNG",
6
+ "GIF"
7
+ ];
8
+ //#endregion
9
+ export { u as DEF_ERROR_COLOR, d as DEF_EVENT_DURATION_SECONDS, c as DEF_HEIGHT, f as DEF_OVERLAY_OPACITY, p as DEF_PASTE_FIRST_REMINDER, m as DEF_PASTE_TARGET_FILE_TYPES, l as DEF_SUCCESS_COLOR, a as PASTE_TARGET_ACTION, r as PASTE_TARGET_CARD, i as PasteTarget, o as onContentPasted, s as onPasteError };
10
+
11
+ //# sourceMappingURL=pasteTarget.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pasteTarget.types.js","names":[],"sources":["../../../src/cards/pasteTarget/pasteTarget.types.ts"],"sourcesContent":["import {\n createCardDeclaration,\n createOnAction,\n registerActions,\n} from \"@pihanga2/core\";\n\nexport const PASTE_TARGET_CARD = \"paste-target\";\nexport const PasteTarget = createCardDeclaration<\n PasteTargetProps,\n PasteTargetEvents\n>(PASTE_TARGET_CARD);\n\nexport const PASTE_TARGET_ACTION = registerActions(PASTE_TARGET_CARD, [\n \"pasted_content\",\n \"error\",\n]);\n\nexport const onContentPasted = createOnAction<CloseEvent>(\n PASTE_TARGET_ACTION.PASTED_CONTENT,\n);\n\nexport const onPasteError = createOnAction<PasteTargetErrorEvent>(\n PASTE_TARGET_ACTION.ERROR,\n);\n\nexport const DEF_HEIGHT = \"120px\";\nexport const DEF_SUCCESS_COLOR = \"lightgreen\";\nexport const DEF_ERROR_COLOR = \"lightcoral\";\nexport const DEF_EVENT_DURATION_SECONDS = 1;\nexport const DEF_OVERLAY_OPACITY = 0.5;\n\nexport const DEF_PASTE_FIRST_REMINDER =\n \"(Before pasting, click this box to get the focus)\";\n\nexport type PasteTargetProps = {\n fileTypes?: string[];\n title?: string;\n description?: string;\n pasteFirstReminder?: string;\n withUpload?: boolean;\n\n height?: string | number;\n\n successColor?: string;\n errorColor?: string;\n eventDurationSeconds?: number; // How long to show success/error overlay color\n eventOpacity?: number; // Opacity of overlay on paste event\n\n className?: string;\n};\n\nexport const DEF_PASTE_TARGET_FILE_TYPES = [\"JPG\", \"PNG\", \"GIF\"];\n\nexport type PasteItem = {\n mimeType: string;\n content: string;\n};\n\nexport type PasteTargetPastedEvent = {\n items: PasteItem[];\n};\n\nexport type PasteTargetErrorEvent = {\n error: string;\n};\n\nexport type PasteTargetEvents = {\n onPastedContent: PasteTargetPastedEvent;\n onError: PasteTargetErrorEvent;\n};\n"],"mappings":";;AAMA,IAAa,IAAoB,gBACpB,IAAc,EAGzB,CAAiB,GAEN,IAAsB,EAAgB,GAAmB,CACpE,kBACA,OACF,CAAC,GAEY,IAAkB,EAC7B,EAAoB,cACtB,GAEa,IAAe,EAC1B,EAAoB,KACtB,GAEa,IAAa,SACb,IAAoB,cACpB,IAAkB,cAClB,IAA6B,GAC7B,IAAsB,IAEtB,IACX,qDAmBW,IAA8B;CAAC;CAAO;CAAO;AAAK"}
@@ -0,0 +1 @@
1
+ export * from './resizable.types';
@@ -0,0 +1,4 @@
1
+ import { default as React } from 'react';
2
+ import { PiCardProps } from '@pihanga2/core';
3
+ import { ResizableProps } from './resizable.types';
4
+ export declare const ResizableComponent: (props: PiCardProps<ResizableProps>) => React.ReactNode;