@kujoforall/paper-ui 0.1.0 → 0.2.1

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 (553) hide show
  1. package/CHANGELOG.md +94 -0
  2. package/README.md +50 -7
  3. package/dist/components/editor/block-text.d.ts.map +1 -1
  4. package/dist/components/editor/block-text.js +52 -17
  5. package/dist/components/editor/block-text.js.map +1 -1
  6. package/dist/components/editor/blocks.d.ts.map +1 -1
  7. package/dist/components/editor/blocks.js +17 -13
  8. package/dist/components/editor/blocks.js.map +1 -1
  9. package/dist/components/editor/document-editor.d.ts.map +1 -1
  10. package/dist/components/editor/document-editor.js +4 -2
  11. package/dist/components/editor/document-editor.js.map +1 -1
  12. package/dist/components/editor/document-view.d.ts.map +1 -1
  13. package/dist/components/editor/document-view.js +17 -12
  14. package/dist/components/editor/document-view.js.map +1 -1
  15. package/dist/components/editor/editor-state.d.ts +7 -0
  16. package/dist/components/editor/editor-state.d.ts.map +1 -1
  17. package/dist/components/editor/editor-state.js +28 -3
  18. package/dist/components/editor/editor-state.js.map +1 -1
  19. package/dist/components/editor/extensions/kit-blocks.d.ts +34 -0
  20. package/dist/components/editor/extensions/kit-blocks.d.ts.map +1 -0
  21. package/dist/components/editor/extensions/kit-blocks.js +201 -0
  22. package/dist/components/editor/extensions/kit-blocks.js.map +1 -0
  23. package/dist/components/editor/extensions/spoiler.d.ts.map +1 -1
  24. package/dist/components/editor/extensions/spoiler.js +2 -2
  25. package/dist/components/editor/extensions/spoiler.js.map +1 -1
  26. package/dist/components/editor/index.d.ts +1 -0
  27. package/dist/components/editor/index.d.ts.map +1 -1
  28. package/dist/components/editor/index.js +1 -0
  29. package/dist/components/editor/index.js.map +1 -1
  30. package/dist/components/editor/kinds.js +1 -1
  31. package/dist/components/editor/kinds.js.map +1 -1
  32. package/dist/components/editor/look.d.ts +18 -0
  33. package/dist/components/editor/look.d.ts.map +1 -0
  34. package/dist/components/editor/look.js +21 -0
  35. package/dist/components/editor/look.js.map +1 -0
  36. package/dist/components/three/model-viewer.d.ts +36 -0
  37. package/dist/components/three/model-viewer.d.ts.map +1 -0
  38. package/dist/components/three/model-viewer.js +338 -0
  39. package/dist/components/three/model-viewer.js.map +1 -0
  40. package/dist/components/ui/accent-picker.js +1 -1
  41. package/dist/components/ui/accent-picker.js.map +1 -1
  42. package/dist/components/ui/alert-dialog.d.ts +29 -0
  43. package/dist/components/ui/alert-dialog.d.ts.map +1 -0
  44. package/dist/components/ui/alert-dialog.js +72 -0
  45. package/dist/components/ui/alert-dialog.js.map +1 -0
  46. package/dist/components/ui/animated-height.d.ts +6 -0
  47. package/dist/components/ui/animated-height.d.ts.map +1 -0
  48. package/dist/components/ui/animated-height.js +26 -0
  49. package/dist/components/ui/animated-height.js.map +1 -0
  50. package/dist/components/ui/app-shell.d.ts +1 -0
  51. package/dist/components/ui/app-shell.d.ts.map +1 -1
  52. package/dist/components/ui/app-shell.js +5 -3
  53. package/dist/components/ui/app-shell.js.map +1 -1
  54. package/dist/components/ui/avatar.d.ts +30 -0
  55. package/dist/components/ui/avatar.d.ts.map +1 -0
  56. package/dist/components/ui/avatar.js +50 -0
  57. package/dist/components/ui/avatar.js.map +1 -0
  58. package/dist/components/ui/badge.d.ts +3 -3
  59. package/dist/components/ui/badge.d.ts.map +1 -1
  60. package/dist/components/ui/badge.js +2 -2
  61. package/dist/components/ui/badge.js.map +1 -1
  62. package/dist/components/ui/banner.d.ts +33 -0
  63. package/dist/components/ui/banner.d.ts.map +1 -0
  64. package/dist/components/ui/banner.js +21 -0
  65. package/dist/components/ui/banner.js.map +1 -0
  66. package/dist/components/ui/breadcrumbs.js +1 -1
  67. package/dist/components/ui/breadcrumbs.js.map +1 -1
  68. package/dist/components/ui/button.d.ts +8 -6
  69. package/dist/components/ui/button.d.ts.map +1 -1
  70. package/dist/components/ui/button.js +91 -26
  71. package/dist/components/ui/button.js.map +1 -1
  72. package/dist/components/ui/calendar.d.ts.map +1 -1
  73. package/dist/components/ui/calendar.js +6 -5
  74. package/dist/components/ui/calendar.js.map +1 -1
  75. package/dist/components/ui/callout.d.ts +23 -4
  76. package/dist/components/ui/callout.d.ts.map +1 -1
  77. package/dist/components/ui/callout.js +28 -15
  78. package/dist/components/ui/callout.js.map +1 -1
  79. package/dist/components/ui/card.d.ts +13 -8
  80. package/dist/components/ui/card.d.ts.map +1 -1
  81. package/dist/components/ui/card.js +10 -9
  82. package/dist/components/ui/card.js.map +1 -1
  83. package/dist/components/ui/checkbox.d.ts +9 -4
  84. package/dist/components/ui/checkbox.d.ts.map +1 -1
  85. package/dist/components/ui/checkbox.js +25 -5
  86. package/dist/components/ui/checkbox.js.map +1 -1
  87. package/dist/components/ui/choice-label.d.ts +13 -0
  88. package/dist/components/ui/choice-label.d.ts.map +1 -0
  89. package/dist/components/ui/choice-label.js +17 -0
  90. package/dist/components/ui/choice-label.js.map +1 -0
  91. package/dist/components/ui/collapsible.d.ts +10 -0
  92. package/dist/components/ui/collapsible.d.ts.map +1 -0
  93. package/dist/components/ui/collapsible.js +21 -0
  94. package/dist/components/ui/collapsible.js.map +1 -0
  95. package/dist/components/ui/collection-layout.d.ts +24 -0
  96. package/dist/components/ui/collection-layout.d.ts.map +1 -0
  97. package/dist/components/ui/collection-layout.js +16 -0
  98. package/dist/components/ui/collection-layout.js.map +1 -0
  99. package/dist/components/ui/combobox.d.ts +10 -0
  100. package/dist/components/ui/combobox.d.ts.map +1 -0
  101. package/dist/components/ui/combobox.js +93 -0
  102. package/dist/components/ui/combobox.js.map +1 -0
  103. package/dist/components/ui/command-menu.d.ts +5 -2
  104. package/dist/components/ui/command-menu.d.ts.map +1 -1
  105. package/dist/components/ui/command-menu.js +31 -6
  106. package/dist/components/ui/command-menu.js.map +1 -1
  107. package/dist/components/ui/context-menu.d.ts +19 -0
  108. package/dist/components/ui/context-menu.d.ts.map +1 -0
  109. package/dist/components/ui/context-menu.js +42 -0
  110. package/dist/components/ui/context-menu.js.map +1 -0
  111. package/dist/components/ui/copy-button.d.ts +11 -0
  112. package/dist/components/ui/copy-button.d.ts.map +1 -0
  113. package/dist/components/ui/copy-button.js +48 -0
  114. package/dist/components/ui/copy-button.js.map +1 -0
  115. package/dist/components/ui/database/calendar-view.d.ts +10 -0
  116. package/dist/components/ui/database/calendar-view.d.ts.map +1 -0
  117. package/dist/components/ui/database/calendar-view.js +65 -0
  118. package/dist/components/ui/database/calendar-view.js.map +1 -0
  119. package/dist/components/ui/database/card-views.d.ts +22 -0
  120. package/dist/components/ui/database/card-views.d.ts.map +1 -0
  121. package/dist/components/ui/database/card-views.js +74 -0
  122. package/dist/components/ui/database/card-views.js.map +1 -0
  123. package/dist/components/ui/database/cells.d.ts +20 -0
  124. package/dist/components/ui/database/cells.d.ts.map +1 -0
  125. package/dist/components/ui/database/cells.js +132 -0
  126. package/dist/components/ui/database/cells.js.map +1 -0
  127. package/dist/components/ui/database/database.d.ts +19 -0
  128. package/dist/components/ui/database/database.d.ts.map +1 -0
  129. package/dist/components/ui/database/database.js +102 -0
  130. package/dist/components/ui/database/database.js.map +1 -0
  131. package/dist/components/ui/database/icons.d.ts +5 -0
  132. package/dist/components/ui/database/icons.d.ts.map +1 -0
  133. package/dist/components/ui/database/icons.js +13 -0
  134. package/dist/components/ui/database/icons.js.map +1 -0
  135. package/dist/components/ui/database/table-view.d.ts +11 -0
  136. package/dist/components/ui/database/table-view.d.ts.map +1 -0
  137. package/dist/components/ui/database/table-view.js +157 -0
  138. package/dist/components/ui/database/table-view.js.map +1 -0
  139. package/dist/components/ui/date-picker.d.ts +6 -1
  140. package/dist/components/ui/date-picker.d.ts.map +1 -1
  141. package/dist/components/ui/date-picker.js +20 -12
  142. package/dist/components/ui/date-picker.js.map +1 -1
  143. package/dist/components/ui/date-time-picker.d.ts +3 -1
  144. package/dist/components/ui/date-time-picker.d.ts.map +1 -1
  145. package/dist/components/ui/date-time-picker.js +17 -15
  146. package/dist/components/ui/date-time-picker.js.map +1 -1
  147. package/dist/components/ui/dialog.d.ts +13 -9
  148. package/dist/components/ui/dialog.d.ts.map +1 -1
  149. package/dist/components/ui/dialog.js +33 -3
  150. package/dist/components/ui/dialog.js.map +1 -1
  151. package/dist/components/ui/document-layout.d.ts +15 -0
  152. package/dist/components/ui/document-layout.d.ts.map +1 -0
  153. package/dist/components/ui/document-layout.js +15 -0
  154. package/dist/components/ui/document-layout.js.map +1 -0
  155. package/dist/components/ui/dropdown-menu.d.ts +14 -10
  156. package/dist/components/ui/dropdown-menu.d.ts.map +1 -1
  157. package/dist/components/ui/dropdown-menu.js +22 -13
  158. package/dist/components/ui/dropdown-menu.js.map +1 -1
  159. package/dist/components/ui/editable-text.d.ts +9 -2
  160. package/dist/components/ui/editable-text.d.ts.map +1 -1
  161. package/dist/components/ui/editable-text.js +27 -10
  162. package/dist/components/ui/editable-text.js.map +1 -1
  163. package/dist/components/ui/empty-state.d.ts +11 -0
  164. package/dist/components/ui/empty-state.d.ts.map +1 -0
  165. package/dist/components/ui/empty-state.js +9 -0
  166. package/dist/components/ui/empty-state.js.map +1 -0
  167. package/dist/components/ui/error-state.d.ts +20 -0
  168. package/dist/components/ui/error-state.d.ts.map +1 -0
  169. package/dist/components/ui/error-state.js +17 -0
  170. package/dist/components/ui/error-state.js.map +1 -0
  171. package/dist/components/ui/field-button.d.ts +2 -1
  172. package/dist/components/ui/field-button.d.ts.map +1 -1
  173. package/dist/components/ui/field-button.js +7 -5
  174. package/dist/components/ui/field-button.js.map +1 -1
  175. package/dist/components/ui/file-preview.js +1 -1
  176. package/dist/components/ui/file-preview.js.map +1 -1
  177. package/dist/components/ui/file-uploader.d.ts.map +1 -1
  178. package/dist/components/ui/file-uploader.js +5 -4
  179. package/dist/components/ui/file-uploader.js.map +1 -1
  180. package/dist/components/ui/filter-builder.d.ts +18 -0
  181. package/dist/components/ui/filter-builder.d.ts.map +1 -0
  182. package/dist/components/ui/filter-builder.js +98 -0
  183. package/dist/components/ui/filter-builder.js.map +1 -0
  184. package/dist/components/ui/focus-shell.d.ts +14 -0
  185. package/dist/components/ui/focus-shell.d.ts.map +1 -0
  186. package/dist/components/ui/focus-shell.js +13 -0
  187. package/dist/components/ui/focus-shell.js.map +1 -0
  188. package/dist/components/ui/handle-row.d.ts +11 -1
  189. package/dist/components/ui/handle-row.d.ts.map +1 -1
  190. package/dist/components/ui/handle-row.js +101 -32
  191. package/dist/components/ui/handle-row.js.map +1 -1
  192. package/dist/components/ui/header-bar.d.ts +5 -0
  193. package/dist/components/ui/header-bar.d.ts.map +1 -0
  194. package/dist/components/ui/header-bar.js +10 -0
  195. package/dist/components/ui/header-bar.js.map +1 -0
  196. package/dist/components/ui/hover-card.d.ts +6 -0
  197. package/dist/components/ui/hover-card.d.ts.map +1 -0
  198. package/dist/components/ui/hover-card.js +13 -0
  199. package/dist/components/ui/hover-card.js.map +1 -0
  200. package/dist/components/ui/image-block.js +4 -4
  201. package/dist/components/ui/image-block.js.map +1 -1
  202. package/dist/components/ui/image-card.d.ts.map +1 -1
  203. package/dist/components/ui/image-card.js +5 -4
  204. package/dist/components/ui/image-card.js.map +1 -1
  205. package/dist/components/ui/image-framer.d.ts +24 -0
  206. package/dist/components/ui/image-framer.d.ts.map +1 -0
  207. package/dist/components/ui/image-framer.js +89 -0
  208. package/dist/components/ui/image-framer.js.map +1 -0
  209. package/dist/components/ui/image-viewer.d.ts.map +1 -1
  210. package/dist/components/ui/image-viewer.js +38 -5
  211. package/dist/components/ui/image-viewer.js.map +1 -1
  212. package/dist/components/ui/image.d.ts +25 -3
  213. package/dist/components/ui/image.d.ts.map +1 -1
  214. package/dist/components/ui/image.js +50 -21
  215. package/dist/components/ui/image.js.map +1 -1
  216. package/dist/components/ui/index.d.ts +54 -11
  217. package/dist/components/ui/index.d.ts.map +1 -1
  218. package/dist/components/ui/index.js +53 -10
  219. package/dist/components/ui/index.js.map +1 -1
  220. package/dist/components/ui/input.d.ts +71 -12
  221. package/dist/components/ui/input.d.ts.map +1 -1
  222. package/dist/components/ui/input.js +236 -23
  223. package/dist/components/ui/input.js.map +1 -1
  224. package/dist/components/ui/link-block.d.ts.map +1 -1
  225. package/dist/components/ui/link-block.js +1 -1
  226. package/dist/components/ui/link-block.js.map +1 -1
  227. package/dist/components/ui/list-detail.d.ts +23 -0
  228. package/dist/components/ui/list-detail.d.ts.map +1 -0
  229. package/dist/components/ui/list-detail.js +33 -0
  230. package/dist/components/ui/list-detail.js.map +1 -0
  231. package/dist/components/ui/listbox.d.ts +7 -0
  232. package/dist/components/ui/listbox.d.ts.map +1 -0
  233. package/dist/components/ui/listbox.js +29 -0
  234. package/dist/components/ui/listbox.js.map +1 -0
  235. package/dist/components/ui/mac-card.js +1 -1
  236. package/dist/components/ui/mac-card.js.map +1 -1
  237. package/dist/components/ui/month-picker.d.ts +13 -0
  238. package/dist/components/ui/month-picker.d.ts.map +1 -0
  239. package/dist/components/ui/month-picker.js +53 -0
  240. package/dist/components/ui/month-picker.js.map +1 -0
  241. package/dist/components/ui/multi-select.d.ts +22 -0
  242. package/dist/components/ui/multi-select.d.ts.map +1 -0
  243. package/dist/components/ui/multi-select.js +88 -0
  244. package/dist/components/ui/multi-select.js.map +1 -0
  245. package/dist/components/ui/nav-tree.d.ts.map +1 -1
  246. package/dist/components/ui/nav-tree.js +10 -3
  247. package/dist/components/ui/nav-tree.js.map +1 -1
  248. package/dist/components/ui/page.d.ts +16 -5
  249. package/dist/components/ui/page.d.ts.map +1 -1
  250. package/dist/components/ui/page.js +23 -10
  251. package/dist/components/ui/page.js.map +1 -1
  252. package/dist/components/ui/pagination.d.ts +26 -0
  253. package/dist/components/ui/pagination.d.ts.map +1 -0
  254. package/dist/components/ui/pagination.js +54 -0
  255. package/dist/components/ui/pagination.js.map +1 -0
  256. package/dist/components/ui/picker-panel.d.ts +13 -0
  257. package/dist/components/ui/picker-panel.d.ts.map +1 -0
  258. package/dist/components/ui/picker-panel.js +19 -0
  259. package/dist/components/ui/picker-panel.js.map +1 -0
  260. package/dist/components/ui/popover.d.ts +2 -2
  261. package/dist/components/ui/popover.d.ts.map +1 -1
  262. package/dist/components/ui/popover.js +1 -1
  263. package/dist/components/ui/popover.js.map +1 -1
  264. package/dist/components/ui/progress.d.ts +11 -1
  265. package/dist/components/ui/progress.d.ts.map +1 -1
  266. package/dist/components/ui/progress.js +17 -4
  267. package/dist/components/ui/progress.js.map +1 -1
  268. package/dist/components/ui/property.d.ts +2 -6
  269. package/dist/components/ui/property.d.ts.map +1 -1
  270. package/dist/components/ui/property.js +6 -22
  271. package/dist/components/ui/property.js.map +1 -1
  272. package/dist/components/ui/radio-group.d.ts +8 -0
  273. package/dist/components/ui/radio-group.d.ts.map +1 -0
  274. package/dist/components/ui/radio-group.js +18 -0
  275. package/dist/components/ui/radio-group.js.map +1 -0
  276. package/dist/components/ui/rating.d.ts +14 -0
  277. package/dist/components/ui/rating.d.ts.map +1 -0
  278. package/dist/components/ui/rating.js +61 -0
  279. package/dist/components/ui/rating.js.map +1 -0
  280. package/dist/components/ui/save-status.d.ts +8 -0
  281. package/dist/components/ui/save-status.d.ts.map +1 -0
  282. package/dist/components/ui/save-status.js +31 -0
  283. package/dist/components/ui/save-status.js.map +1 -0
  284. package/dist/components/ui/segmented.d.ts +15 -7
  285. package/dist/components/ui/segmented.d.ts.map +1 -1
  286. package/dist/components/ui/segmented.js +8 -6
  287. package/dist/components/ui/segmented.js.map +1 -1
  288. package/dist/components/ui/select-menu.d.ts +3 -1
  289. package/dist/components/ui/select-menu.d.ts.map +1 -1
  290. package/dist/components/ui/select-menu.js +2 -2
  291. package/dist/components/ui/select-menu.js.map +1 -1
  292. package/dist/components/ui/select.d.ts +7 -2
  293. package/dist/components/ui/select.d.ts.map +1 -1
  294. package/dist/components/ui/select.js +19 -5
  295. package/dist/components/ui/select.js.map +1 -1
  296. package/dist/components/ui/selection-bar.js +1 -1
  297. package/dist/components/ui/selection-bar.js.map +1 -1
  298. package/dist/components/ui/settings-layout.d.ts +34 -0
  299. package/dist/components/ui/settings-layout.d.ts.map +1 -0
  300. package/dist/components/ui/settings-layout.js +16 -0
  301. package/dist/components/ui/settings-layout.js.map +1 -0
  302. package/dist/components/ui/share-link.d.ts +14 -0
  303. package/dist/components/ui/share-link.d.ts.map +1 -0
  304. package/dist/components/ui/share-link.js +16 -0
  305. package/dist/components/ui/share-link.js.map +1 -0
  306. package/dist/components/ui/sheet.d.ts +21 -0
  307. package/dist/components/ui/sheet.d.ts.map +1 -0
  308. package/dist/components/ui/sheet.js +53 -0
  309. package/dist/components/ui/sheet.js.map +1 -0
  310. package/dist/components/ui/sidebar.d.ts +82 -0
  311. package/dist/components/ui/sidebar.d.ts.map +1 -0
  312. package/dist/components/ui/sidebar.js +258 -0
  313. package/dist/components/ui/sidebar.js.map +1 -0
  314. package/dist/components/ui/skeleton.d.ts +8 -0
  315. package/dist/components/ui/skeleton.d.ts.map +1 -0
  316. package/dist/components/ui/skeleton.js +15 -0
  317. package/dist/components/ui/skeleton.js.map +1 -0
  318. package/dist/components/ui/spinner.d.ts +12 -0
  319. package/dist/components/ui/spinner.d.ts.map +1 -0
  320. package/dist/components/ui/spinner.js +14 -0
  321. package/dist/components/ui/spinner.js.map +1 -0
  322. package/dist/components/ui/spotlight.d.ts.map +1 -1
  323. package/dist/components/ui/spotlight.js +14 -11
  324. package/dist/components/ui/spotlight.js.map +1 -1
  325. package/dist/components/ui/step-dialog.js +3 -3
  326. package/dist/components/ui/step-dialog.js.map +1 -1
  327. package/dist/components/ui/steps-layout.d.ts +20 -0
  328. package/dist/components/ui/steps-layout.d.ts.map +1 -0
  329. package/dist/components/ui/steps-layout.js +26 -0
  330. package/dist/components/ui/steps-layout.js.map +1 -0
  331. package/dist/components/ui/switch.d.ts +8 -0
  332. package/dist/components/ui/switch.d.ts.map +1 -0
  333. package/dist/components/ui/switch.js +21 -0
  334. package/dist/components/ui/switch.js.map +1 -0
  335. package/dist/components/ui/table.d.ts +13 -5
  336. package/dist/components/ui/table.d.ts.map +1 -1
  337. package/dist/components/ui/table.js +65 -12
  338. package/dist/components/ui/table.js.map +1 -1
  339. package/dist/components/ui/tabs.d.ts +7 -0
  340. package/dist/components/ui/tabs.d.ts.map +1 -0
  341. package/dist/components/ui/tabs.js +19 -0
  342. package/dist/components/ui/tabs.js.map +1 -0
  343. package/dist/components/ui/theme-toggle.d.ts +14 -0
  344. package/dist/components/ui/theme-toggle.d.ts.map +1 -1
  345. package/dist/components/ui/theme-toggle.js +69 -41
  346. package/dist/components/ui/theme-toggle.js.map +1 -1
  347. package/dist/components/ui/time-list.d.ts +16 -0
  348. package/dist/components/ui/time-list.d.ts.map +1 -0
  349. package/dist/components/ui/time-list.js +49 -0
  350. package/dist/components/ui/time-list.js.map +1 -0
  351. package/dist/components/ui/time-picker.d.ts +37 -11
  352. package/dist/components/ui/time-picker.d.ts.map +1 -1
  353. package/dist/components/ui/time-picker.js +130 -52
  354. package/dist/components/ui/time-picker.js.map +1 -1
  355. package/dist/components/ui/toast.d.ts +18 -0
  356. package/dist/components/ui/toast.d.ts.map +1 -0
  357. package/dist/components/ui/toast.js +77 -0
  358. package/dist/components/ui/toast.js.map +1 -0
  359. package/dist/components/ui/toggle.d.ts +15 -0
  360. package/dist/components/ui/toggle.d.ts.map +1 -0
  361. package/dist/components/ui/toggle.js +55 -0
  362. package/dist/components/ui/toggle.js.map +1 -0
  363. package/dist/components/ui/tooltip.d.ts +1 -1
  364. package/dist/components/ui/tooltip.d.ts.map +1 -1
  365. package/dist/components/ui/tooltip.js +13 -2
  366. package/dist/components/ui/tooltip.js.map +1 -1
  367. package/dist/components/ui/top-bar.d.ts +25 -0
  368. package/dist/components/ui/top-bar.d.ts.map +1 -0
  369. package/dist/components/ui/top-bar.js +23 -0
  370. package/dist/components/ui/top-bar.js.map +1 -0
  371. package/dist/components/ui/typography.d.ts +11 -5
  372. package/dist/components/ui/typography.d.ts.map +1 -1
  373. package/dist/components/ui/typography.js +31 -5
  374. package/dist/components/ui/typography.js.map +1 -1
  375. package/dist/components/ui/video-block.d.ts.map +1 -1
  376. package/dist/components/ui/video-block.js +5 -1
  377. package/dist/components/ui/video-block.js.map +1 -1
  378. package/dist/hooks/use-dismiss.d.ts +5 -0
  379. package/dist/hooks/use-dismiss.d.ts.map +1 -0
  380. package/dist/hooks/use-dismiss.js +23 -0
  381. package/dist/hooks/use-dismiss.js.map +1 -0
  382. package/dist/hooks/use-escape-first.d.ts +3 -0
  383. package/dist/hooks/use-escape-first.d.ts.map +1 -0
  384. package/dist/hooks/use-escape-first.js +27 -0
  385. package/dist/hooks/use-escape-first.js.map +1 -0
  386. package/dist/hooks/use-media-query.d.ts +5 -0
  387. package/dist/hooks/use-media-query.d.ts.map +1 -0
  388. package/dist/hooks/use-media-query.js +16 -0
  389. package/dist/hooks/use-media-query.js.map +1 -0
  390. package/dist/hooks/use-save-queue.d.ts.map +1 -1
  391. package/dist/hooks/use-save-queue.js +19 -7
  392. package/dist/hooks/use-save-queue.js.map +1 -1
  393. package/dist/hooks/use-selection.d.ts.map +1 -1
  394. package/dist/hooks/use-selection.js +10 -1
  395. package/dist/hooks/use-selection.js.map +1 -1
  396. package/dist/lib/database.d.ts +92 -0
  397. package/dist/lib/database.d.ts.map +1 -0
  398. package/dist/lib/database.js +272 -0
  399. package/dist/lib/database.js.map +1 -0
  400. package/dist/lib/dates.d.ts +16 -0
  401. package/dist/lib/dates.d.ts.map +1 -1
  402. package/dist/lib/dates.js +27 -0
  403. package/dist/lib/dates.js.map +1 -1
  404. package/dist/lib/keys.d.ts +18 -0
  405. package/dist/lib/keys.d.ts.map +1 -0
  406. package/dist/lib/keys.js +66 -0
  407. package/dist/lib/keys.js.map +1 -0
  408. package/dist/lib/number.d.ts +4 -0
  409. package/dist/lib/number.d.ts.map +1 -0
  410. package/dist/lib/number.js +33 -0
  411. package/dist/lib/number.js.map +1 -0
  412. package/dist/lib/pointer.d.ts +2 -0
  413. package/dist/lib/pointer.d.ts.map +1 -0
  414. package/dist/lib/pointer.js +4 -0
  415. package/dist/lib/pointer.js.map +1 -0
  416. package/dist/lib/prepare-image.d.ts +43 -0
  417. package/dist/lib/prepare-image.d.ts.map +1 -0
  418. package/dist/lib/prepare-image.js +105 -0
  419. package/dist/lib/prepare-image.js.map +1 -0
  420. package/dist/lib/rich-text-dom.d.ts +2 -0
  421. package/dist/lib/rich-text-dom.d.ts.map +1 -1
  422. package/dist/lib/rich-text-dom.js +5 -3
  423. package/dist/lib/rich-text-dom.js.map +1 -1
  424. package/dist/lib/theme.d.ts +6 -0
  425. package/dist/lib/theme.d.ts.map +1 -0
  426. package/dist/lib/theme.js +15 -0
  427. package/dist/lib/theme.js.map +1 -0
  428. package/dist/lib/time.d.ts +19 -0
  429. package/dist/lib/time.d.ts.map +1 -0
  430. package/dist/lib/time.js +91 -0
  431. package/dist/lib/time.js.map +1 -0
  432. package/dist/lib/utils.d.ts.map +1 -1
  433. package/dist/lib/utils.js +20 -2
  434. package/dist/lib/utils.js.map +1 -1
  435. package/dist/styles/notion.css +342 -51
  436. package/package.json +27 -4
  437. package/src/components/editor/block-text.tsx +58 -17
  438. package/src/components/editor/blocks.tsx +19 -14
  439. package/src/components/editor/document-editor.tsx +7 -2
  440. package/src/components/editor/document-view.tsx +37 -24
  441. package/src/components/editor/editor-state.tsx +31 -3
  442. package/src/components/editor/extensions/kit-blocks.tsx +452 -0
  443. package/src/components/editor/extensions/spoiler.tsx +9 -4
  444. package/src/components/editor/index.ts +1 -0
  445. package/src/components/editor/kinds.ts +1 -1
  446. package/src/components/editor/look.tsx +36 -0
  447. package/src/components/three/model-viewer.tsx +514 -0
  448. package/src/components/ui/accent-picker.tsx +2 -2
  449. package/src/components/ui/alert-dialog.tsx +136 -0
  450. package/src/components/ui/animated-height.tsx +34 -0
  451. package/src/components/ui/app-shell.tsx +9 -7
  452. package/src/components/ui/avatar.tsx +106 -0
  453. package/src/components/ui/badge.tsx +4 -4
  454. package/src/components/ui/banner.tsx +53 -0
  455. package/src/components/ui/breadcrumbs.tsx +1 -1
  456. package/src/components/ui/button.tsx +115 -41
  457. package/src/components/ui/calendar.tsx +8 -7
  458. package/src/components/ui/callout.tsx +41 -42
  459. package/src/components/ui/card.tsx +27 -58
  460. package/src/components/ui/checkbox.tsx +53 -19
  461. package/src/components/ui/choice-label.tsx +43 -0
  462. package/src/components/ui/collapsible.tsx +58 -0
  463. package/src/components/ui/collection-layout.tsx +69 -0
  464. package/src/components/ui/combobox.tsx +155 -0
  465. package/src/components/ui/command-menu.tsx +61 -31
  466. package/src/components/ui/context-menu.tsx +89 -0
  467. package/src/components/ui/copy-button.tsx +80 -0
  468. package/src/components/ui/database/calendar-view.tsx +180 -0
  469. package/src/components/ui/database/card-views.tsx +221 -0
  470. package/src/components/ui/database/cells.tsx +237 -0
  471. package/src/components/ui/database/database.tsx +279 -0
  472. package/src/components/ui/database/icons.ts +15 -0
  473. package/src/components/ui/database/table-view.tsx +311 -0
  474. package/src/components/ui/date-picker.tsx +99 -61
  475. package/src/components/ui/date-time-picker.tsx +68 -62
  476. package/src/components/ui/dialog.tsx +48 -21
  477. package/src/components/ui/document-layout.tsx +52 -0
  478. package/src/components/ui/dropdown-menu.tsx +33 -31
  479. package/src/components/ui/editable-text.tsx +40 -7
  480. package/src/components/ui/empty-state.tsx +35 -0
  481. package/src/components/ui/error-state.tsx +67 -0
  482. package/src/components/ui/field-button.tsx +11 -9
  483. package/src/components/ui/file-preview.tsx +1 -1
  484. package/src/components/ui/file-uploader.tsx +23 -24
  485. package/src/components/ui/filter-builder.tsx +304 -0
  486. package/src/components/ui/focus-shell.tsx +48 -0
  487. package/src/components/ui/handle-row.tsx +176 -40
  488. package/src/components/ui/header-bar.tsx +15 -0
  489. package/src/components/ui/hover-card.tsx +30 -0
  490. package/src/components/ui/image-block.tsx +6 -6
  491. package/src/components/ui/image-card.tsx +18 -25
  492. package/src/components/ui/image-framer.tsx +160 -0
  493. package/src/components/ui/image-viewer.tsx +53 -10
  494. package/src/components/ui/image.tsx +133 -29
  495. package/src/components/ui/index.ts +106 -11
  496. package/src/components/ui/input.tsx +437 -65
  497. package/src/components/ui/link-block.tsx +5 -2
  498. package/src/components/ui/list-detail.tsx +115 -0
  499. package/src/components/ui/listbox.ts +26 -0
  500. package/src/components/ui/mac-card.tsx +5 -5
  501. package/src/components/ui/month-picker.tsx +119 -0
  502. package/src/components/ui/multi-select.tsx +221 -0
  503. package/src/components/ui/nav-tree.tsx +11 -5
  504. package/src/components/ui/page.tsx +63 -15
  505. package/src/components/ui/pagination.tsx +143 -0
  506. package/src/components/ui/picker-panel.tsx +69 -0
  507. package/src/components/ui/popover.tsx +3 -3
  508. package/src/components/ui/progress.tsx +56 -16
  509. package/src/components/ui/property.tsx +6 -37
  510. package/src/components/ui/radio-group.tsx +61 -0
  511. package/src/components/ui/rating.tsx +122 -0
  512. package/src/components/ui/save-status.tsx +53 -0
  513. package/src/components/ui/segmented.tsx +48 -16
  514. package/src/components/ui/select-menu.tsx +11 -3
  515. package/src/components/ui/select.tsx +33 -10
  516. package/src/components/ui/selection-bar.tsx +1 -1
  517. package/src/components/ui/settings-layout.tsx +117 -0
  518. package/src/components/ui/share-link.tsx +66 -0
  519. package/src/components/ui/sheet.tsx +90 -0
  520. package/src/components/ui/sidebar.tsx +627 -0
  521. package/src/components/ui/skeleton.tsx +22 -0
  522. package/src/components/ui/spinner.tsx +28 -0
  523. package/src/components/ui/spotlight.tsx +21 -21
  524. package/src/components/ui/step-dialog.tsx +6 -6
  525. package/src/components/ui/steps-layout.tsx +91 -0
  526. package/src/components/ui/switch.tsx +55 -0
  527. package/src/components/ui/table.tsx +75 -18
  528. package/src/components/ui/tabs.tsx +41 -0
  529. package/src/components/ui/theme-toggle.tsx +74 -83
  530. package/src/components/ui/time-list.tsx +106 -0
  531. package/src/components/ui/time-picker.tsx +305 -134
  532. package/src/components/ui/toast.tsx +132 -0
  533. package/src/components/ui/toggle.tsx +76 -0
  534. package/src/components/ui/tooltip.tsx +20 -6
  535. package/src/components/ui/top-bar.tsx +118 -0
  536. package/src/components/ui/typography.tsx +45 -9
  537. package/src/components/ui/video-block.tsx +9 -3
  538. package/src/hooks/use-dismiss.ts +24 -0
  539. package/src/hooks/use-escape-first.ts +25 -0
  540. package/src/hooks/use-media-query.ts +23 -0
  541. package/src/hooks/use-save-queue.ts +19 -7
  542. package/src/hooks/use-selection.ts +8 -1
  543. package/src/lib/database.ts +322 -0
  544. package/src/lib/dates.ts +36 -0
  545. package/src/lib/keys.ts +72 -0
  546. package/src/lib/number.ts +29 -0
  547. package/src/lib/pointer.ts +3 -0
  548. package/src/lib/prepare-image.ts +141 -0
  549. package/src/lib/rich-text-dom.ts +5 -3
  550. package/src/lib/theme.ts +18 -0
  551. package/src/lib/time.ts +83 -0
  552. package/src/lib/utils.ts +21 -2
  553. package/src/styles/notion.css +342 -51
@@ -0,0 +1,89 @@
1
+ "use client";
2
+
3
+ import * as ContextMenuPrimitive from "@radix-ui/react-context-menu";
4
+ import { Check, ChevronRight } from "lucide-react";
5
+ import type { ComponentProps } from "react";
6
+ import { cn } from "../../lib/utils.ts";
7
+ import { menuItemClasses, menuSurfaceClasses } from "./dropdown-menu.tsx";
8
+
9
+ /* The menu for a right click, or a long press on a touch screen, on the thing it
10
+ is about: a row, a card, a picture. The same look as DropdownMenu, from the same
11
+ classes. Its items should also be reachable another way (a row's "⋯" button),
12
+ because a right click is invisible to anyone who does not know to try it, and
13
+ a keyboard can only open it with the Menu key or Shift+F10. */
14
+
15
+ export const ContextMenu = ContextMenuPrimitive.Root;
16
+ export const ContextMenuTrigger = ContextMenuPrimitive.Trigger;
17
+ export const ContextMenuGroup = ContextMenuPrimitive.Group;
18
+ export const ContextMenuSub = ContextMenuPrimitive.Sub;
19
+ export const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;
20
+
21
+ export function ContextMenuContent({ className, ...props }: ComponentProps<typeof ContextMenuPrimitive.Content>) {
22
+ return (
23
+ <ContextMenuPrimitive.Portal>
24
+ <ContextMenuPrimitive.Content collisionPadding={8} className={cn(menuSurfaceClasses, "origin-[--radix-context-menu-content-transform-origin]", className)} {...props} />
25
+ </ContextMenuPrimitive.Portal>
26
+ );
27
+ }
28
+
29
+ export function ContextMenuItem({ className, danger, ...props }: ComponentProps<typeof ContextMenuPrimitive.Item> & { danger?: boolean }) {
30
+ return (
31
+ <ContextMenuPrimitive.Item
32
+ className={cn(menuItemClasses, danger && "text-danger data-[highlighted]:bg-danger-tint [&_svg]:text-danger", className)}
33
+ {...props}
34
+ />
35
+ );
36
+ }
37
+
38
+ export function ContextMenuCheckboxItem({ className, children, ...props }: ComponentProps<typeof ContextMenuPrimitive.CheckboxItem>) {
39
+ return (
40
+ <ContextMenuPrimitive.CheckboxItem className={cn(menuItemClasses, "pl-7", className)} {...props}>
41
+ <span className="left-2 absolute flex justify-center items-center size-4">
42
+ <ContextMenuPrimitive.ItemIndicator>
43
+ <Check className="size-3.5 !text-ink" />
44
+ </ContextMenuPrimitive.ItemIndicator>
45
+ </span>
46
+ {children}
47
+ </ContextMenuPrimitive.CheckboxItem>
48
+ );
49
+ }
50
+
51
+ export function ContextMenuRadioItem({ className, children, ...props }: ComponentProps<typeof ContextMenuPrimitive.RadioItem>) {
52
+ return (
53
+ <ContextMenuPrimitive.RadioItem className={cn(menuItemClasses, "pl-7", className)} {...props}>
54
+ <span className="left-2 absolute flex justify-center items-center size-4">
55
+ <ContextMenuPrimitive.ItemIndicator>
56
+ <span className="block bg-ink rounded-full size-1.5" />
57
+ </ContextMenuPrimitive.ItemIndicator>
58
+ </span>
59
+ {children}
60
+ </ContextMenuPrimitive.RadioItem>
61
+ );
62
+ }
63
+
64
+ export function ContextMenuLabel({ className, ...props }: ComponentProps<typeof ContextMenuPrimitive.Label>) {
65
+ return <ContextMenuPrimitive.Label className={cn("px-2 pt-1.5 pb-1 font-medium text-caption text-ink-tertiary", className)} {...props} />;
66
+ }
67
+
68
+ export function ContextMenuSeparator({ className, ...props }: ComponentProps<typeof ContextMenuPrimitive.Separator>) {
69
+ return <ContextMenuPrimitive.Separator className={cn("-mx-1.5 my-1.5 bg-hairline h-px", className)} {...props} />;
70
+ }
71
+
72
+ export function ContextMenuSubTrigger({ className, children, ...props }: ComponentProps<typeof ContextMenuPrimitive.SubTrigger>) {
73
+ return (
74
+ <ContextMenuPrimitive.SubTrigger className={cn(menuItemClasses, "data-[state=open]:bg-tint-hover", className)} {...props}>
75
+ {children}
76
+ <ChevronRight className="ml-auto size-3.5" />
77
+ </ContextMenuPrimitive.SubTrigger>
78
+ );
79
+ }
80
+
81
+ export function ContextMenuSubContent({ className, ...props }: ComponentProps<typeof ContextMenuPrimitive.SubContent>) {
82
+ return (
83
+ <ContextMenuPrimitive.Portal>
84
+ <ContextMenuPrimitive.SubContent className={cn(menuSurfaceClasses, className)} {...props} />
85
+ </ContextMenuPrimitive.Portal>
86
+ );
87
+ }
88
+
89
+ export { DropdownMenuShortcut as ContextMenuShortcut } from "./dropdown-menu.tsx";
@@ -0,0 +1,80 @@
1
+ "use client";
2
+
3
+ import { Check, Copy } from "lucide-react";
4
+ import { useEffect, useRef, useState, type ReactNode } from "react";
5
+ import { cn } from "../../lib/utils.ts";
6
+ import { Button, type ButtonProps } from "./button.tsx";
7
+
8
+ /** Writes text to the clipboard; true if it worked. Falls back to a hidden field where the Clipboard API is missing or refused. */
9
+ export async function copyText(text: string): Promise<boolean> {
10
+ try {
11
+ await navigator.clipboard.writeText(text);
12
+ return true;
13
+ } catch {
14
+ try {
15
+ const area = document.createElement("textarea");
16
+ area.value = text;
17
+ area.setAttribute("readonly", "");
18
+ area.style.position = "fixed";
19
+ area.style.opacity = "0";
20
+ document.body.appendChild(area);
21
+ area.select();
22
+ const ok = document.execCommand("copy");
23
+ area.remove();
24
+ return ok;
25
+ } catch {
26
+ return false;
27
+ }
28
+ }
29
+ }
30
+
31
+ /* Copies `value`. The icon turns to a tick for a moment and a screen reader hears
32
+ "Copied"; if copying fails it says so instead. Icon-only by default (named
33
+ "Copy …" with `label`); give `children` for words beside the icon. */
34
+ export function CopyButton({
35
+ value,
36
+ label = "Copy",
37
+ children,
38
+ size,
39
+ variant = "ghost",
40
+ className,
41
+ onCopied,
42
+ ...props
43
+ }: Omit<ButtonProps, "value" | "onClick" | "children"> & {
44
+ value: string | (() => string);
45
+ label?: string;
46
+ children?: ReactNode;
47
+ onCopied?: () => void;
48
+ }) {
49
+ const [state, setState] = useState<"idle" | "copied" | "failed">("idle");
50
+ const timer = useRef<ReturnType<typeof setTimeout>>(undefined);
51
+ useEffect(() => () => clearTimeout(timer.current), []);
52
+ const iconOnly = children === undefined;
53
+ return (
54
+ <>
55
+ <Button
56
+ {...props}
57
+ variant={variant}
58
+ size={size ?? (iconOnly ? "icon-sm" : "sm")}
59
+ aria-label={iconOnly ? label : undefined}
60
+ className={cn(className)}
61
+ onClick={async () => {
62
+ const ok = await copyText(typeof value === "function" ? value() : value);
63
+ setState(ok ? "copied" : "failed");
64
+ if (ok) onCopied?.();
65
+ clearTimeout(timer.current);
66
+ timer.current = setTimeout(() => setState("idle"), 1600);
67
+ }}
68
+ >
69
+ <span className="inline-grid [&>svg]:col-start-1 [&>svg]:row-start-1">
70
+ <Copy className={cn("transition-[opacity,scale] duration-(--duration-fast)", state === "copied" ? "opacity-0 scale-50" : "opacity-100 scale-100")} />
71
+ <Check className={cn("text-success transition-[opacity,scale] duration-(--duration-fast)", state === "copied" ? "opacity-100 scale-100" : "opacity-0 scale-50")} />
72
+ </span>
73
+ {children}
74
+ </Button>
75
+ <span role="status" className="sr-only">
76
+ {state === "copied" ? "Copied" : state === "failed" ? "Couldn't copy" : ""}
77
+ </span>
78
+ </>
79
+ );
80
+ }
@@ -0,0 +1,180 @@
1
+ "use client";
2
+
3
+ import { DndContext, MouseSensor, pointerWithin, TouchSensor, useDraggable, useDroppable, useSensor, useSensors } from "@dnd-kit/core";
4
+ import { ChevronLeft, ChevronRight, Plus } from "lucide-react";
5
+ import { useState } from "react";
6
+ import { daysIn, formatMonth, fromISODate, monthOf, shiftMonth, today, toISODate } from "../../../lib/dates.ts";
7
+ import { isEmpty, titleOf, type Property, type Row, type Value, type View } from "../../../lib/database.ts";
8
+ import { cn } from "../../../lib/utils.ts";
9
+ import { Button } from "../button.tsx";
10
+ import { EmptyState } from "../empty-state.tsx";
11
+
12
+ /* The calendar view: a month, each row on the day of the view's date property
13
+ (`dateProperty`). A row is dragged to another day to move it (a short press on
14
+ a touch screen); "+" on a day adds a row there. Under 40rem of room the grid
15
+ becomes the month's days that have something, as a list, since seven columns
16
+ of chips cannot be read on a phone. */
17
+
18
+ const WEEKDAYS = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
19
+
20
+ /** The days a month grid shows: from the Monday on or before the 1st, whole weeks. */
21
+ function gridDays(month: string): string[] {
22
+ const first = fromISODate(`${month}-01`)!;
23
+ const lead = (first.getDay() + 6) % 7;
24
+ const count = Math.ceil((lead + daysIn(month)) / 7) * 7;
25
+ return Array.from({ length: count }, (_, i) => toISODate(new Date(first.getFullYear(), first.getMonth(), 1 - lead + i)));
26
+ }
27
+
28
+ function Chip({ row, title, onOpenRow }: { row: Row; title: string; onOpenRow?: (row: Row) => void }) {
29
+ const drag = useDraggable({ id: row.id });
30
+ return (
31
+ <button
32
+ ref={drag.setNodeRef}
33
+ {...drag.listeners}
34
+ type="button"
35
+ onClick={() => onOpenRow?.(row)}
36
+ className={cn(
37
+ "bg-surface shadow-xs hover:shadow-sm px-1.5 py-0.5 rounded-small w-full text-caption text-left truncate touch-manipulation",
38
+ drag.isDragging && "opacity-40",
39
+ )}
40
+ style={drag.transform ? { transform: `translate(${drag.transform.x}px, ${drag.transform.y}px)`, position: "relative", zIndex: 10 } : undefined}
41
+ >
42
+ {title || <span className="text-ink-tertiary">Untitled</span>}
43
+ </button>
44
+ );
45
+ }
46
+
47
+ function Day({ day, month, rows, titleOf, onOpenRow, onAdd }: { day: string; month: string; rows: Row[]; titleOf: (row: Row) => string; onOpenRow?: (row: Row) => void; onAdd: () => void }) {
48
+ const drop = useDroppable({ id: day });
49
+ const date = fromISODate(day)!;
50
+ const isToday = day === today();
51
+ return (
52
+ <div
53
+ ref={drop.setNodeRef}
54
+ role="gridcell"
55
+ aria-label={date.toLocaleDateString(undefined, { weekday: "long", day: "numeric", month: "long" }) + (rows.length ? `, ${rows.length} item${rows.length === 1 ? "" : "s"}` : "")}
56
+ className={cn(
57
+ "group group/day flex flex-col gap-0.5 p-1 border-hairline border-r border-b min-h-24 transition-colors duration-(--duration-fast)",
58
+ monthOf(day) !== month && "bg-surface-sunken/60",
59
+ drop.isOver && "bg-accent-tint",
60
+ )}
61
+ >
62
+ <div className="flex justify-between items-center">
63
+ <button type="button" aria-label={`Add on ${date.toLocaleDateString()}`} onClick={onAdd} className="flex justify-center items-center hover:bg-tint-hover rounded-small size-5 text-ink-tertiary affordance">
64
+ <Plus className="size-3.5" />
65
+ </button>
66
+ <span className={cn("flex justify-center items-center rounded-full size-6 tabular-nums text-caption", isToday ? "bg-accent-solid text-accent-ink font-medium" : monthOf(day) === month ? "text-ink-secondary" : "text-ink-tertiary")}>
67
+ {date.getDate()}
68
+ </span>
69
+ </div>
70
+ {rows.map((row) => (
71
+ <Chip key={row.id} row={row} title={titleOf(row)} onOpenRow={onOpenRow} />
72
+ ))}
73
+ </div>
74
+ );
75
+ }
76
+
77
+ export function CalendarView({ properties, rows, view, onSetValue, onAddRow, onOpenRow }: {
78
+ properties: readonly Property[];
79
+ rows: readonly Row[];
80
+ view: View;
81
+ onSetValue: (row: Row, property: Property, value: Value) => void;
82
+ onAddRow: (values?: Record<string, Value>) => void;
83
+ onOpenRow?: (row: Row) => void;
84
+ }) {
85
+ const dateBy = properties.find((p) => p.id === view.dateProperty && p.type === "date");
86
+ const [month, setMonth] = useState(() => monthOf(today()));
87
+ const sensors = useSensors(useSensor(MouseSensor, { activationConstraint: { distance: 4 } }), useSensor(TouchSensor, { activationConstraint: { delay: 220, tolerance: 6 } }));
88
+ if (!dateBy) return <EmptyState compact title="Choose what the calendar dates by" description="A calendar needs a date property to place rows on days. Choose one in the view's options." />;
89
+
90
+ const title = titleOf(properties);
91
+ const nameOf = (row: Row) => (title && !isEmpty(row.values[title.id] ?? null) ? String(row.values[title.id]) : "");
92
+ const onDay = new Map<string, Row[]>();
93
+ for (const row of rows) {
94
+ const v = row.values[dateBy.id];
95
+ if (typeof v !== "string" || v === "") continue;
96
+ const day = v.slice(0, 10);
97
+ onDay.set(day, [...(onDay.get(day) ?? []), row]);
98
+ }
99
+ const days = gridDays(month);
100
+ const inMonth = days.filter((d) => monthOf(d) === month && onDay.has(d));
101
+ const undated = rows.filter((r) => isEmpty(r.values[dateBy.id] ?? null)).length;
102
+
103
+ return (
104
+ <div className="@container">
105
+ <div className="flex items-center gap-1 mb-2">
106
+ <h3 className="mr-auto font-semibold text-h3" aria-live="polite">
107
+ {formatMonth(month)}
108
+ </h3>
109
+ <Button variant="ghost" size="icon-sm" aria-label="Previous month" onClick={() => setMonth(shiftMonth(month, -1))}>
110
+ <ChevronLeft />
111
+ </Button>
112
+ <Button variant="ghost" size="sm" onClick={() => setMonth(monthOf(today()))}>
113
+ Today
114
+ </Button>
115
+ <Button variant="ghost" size="icon-sm" aria-label="Next month" onClick={() => setMonth(shiftMonth(month, 1))}>
116
+ <ChevronRight />
117
+ </Button>
118
+ </div>
119
+
120
+ <DndContext
121
+ sensors={sensors}
122
+ collisionDetection={pointerWithin}
123
+ onDragEnd={(e) => {
124
+ const row = rows.find((r) => r.id === e.active.id);
125
+ if (!row || !e.over) return;
126
+ const day = String(e.over.id);
127
+ const before = row.values[dateBy.id];
128
+ // A time the date had stays with it.
129
+ const time = typeof before === "string" && before.length > 10 ? before.slice(10) : "";
130
+ if (typeof before !== "string" || before.slice(0, 10) !== day) onSetValue(row, dateBy, day + time);
131
+ }}
132
+ accessibility={{ screenReaderInstructions: { draggable: "Open the item to change its date." } }}
133
+ >
134
+ <div role="grid" aria-label={formatMonth(month)} className="@max-xl:hidden border-hairline border-t border-l rounded-surface overflow-hidden">
135
+ <div role="row" className="grid grid-cols-7">
136
+ {WEEKDAYS.map((d) => (
137
+ <div key={d} role="columnheader" className="px-2 py-1 border-hairline border-r border-b text-caption text-ink-tertiary">
138
+ {d}
139
+ </div>
140
+ ))}
141
+ </div>
142
+ {Array.from({ length: days.length / 7 }, (_, w) => (
143
+ <div key={w} role="row" className="grid grid-cols-7">
144
+ {days.slice(w * 7, w * 7 + 7).map((day) => (
145
+ <Day key={day} day={day} month={month} rows={onDay.get(day) ?? []} titleOf={nameOf} onOpenRow={onOpenRow} onAdd={() => onAddRow({ [dateBy.id]: day })} />
146
+ ))}
147
+ </div>
148
+ ))}
149
+ </div>
150
+ </DndContext>
151
+
152
+ {/* Narrow: the month's days that have something. */}
153
+ <div className="@xl:hidden">
154
+ {inMonth.length === 0 ? (
155
+ <EmptyState compact title={`Nothing in ${formatMonth(month)}`} />
156
+ ) : (
157
+ <ol className="flex flex-col">
158
+ {inMonth.map((day) => (
159
+ <li key={day} className="py-2 border-hairline border-b">
160
+ <p className="mb-1 font-medium text-caption text-ink-secondary">{fromISODate(day)!.toLocaleDateString(undefined, { weekday: "long", day: "numeric", month: "long" })}</p>
161
+ <div className="flex flex-col gap-1">
162
+ {onDay.get(day)!.map((row) => (
163
+ <button key={row.id} type="button" onClick={() => onOpenRow?.(row)} className="hover:bg-tint-hover px-2 py-1.5 rounded-control text-sm text-left">
164
+ {nameOf(row) || <span className="text-ink-tertiary">Untitled</span>}
165
+ </button>
166
+ ))}
167
+ </div>
168
+ </li>
169
+ ))}
170
+ </ol>
171
+ )}
172
+ </div>
173
+ {undated > 0 && (
174
+ <p className="mt-2 text-caption text-ink-tertiary">
175
+ {undated} with no {dateBy.name}, not shown.
176
+ </p>
177
+ )}
178
+ </div>
179
+ );
180
+ }
@@ -0,0 +1,221 @@
1
+ "use client";
2
+
3
+ import { DndContext, DragOverlay, MouseSensor, pointerWithin, TouchSensor, useDraggable, useDroppable, useSensor, useSensors } from "@dnd-kit/core";
4
+ import { ArrowRightLeft, MoreHorizontal, Plus } from "lucide-react";
5
+ import { useState, type ReactNode } from "react";
6
+ import { groupRows, isEmpty, shownProperties, titleOf, type Group, type Property, type Row, type Value, type View } from "../../../lib/database.ts";
7
+ import { cn } from "../../../lib/utils.ts";
8
+ import { Badge } from "../badge.tsx";
9
+ import { Button } from "../button.tsx";
10
+ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuTrigger } from "../dropdown-menu.tsx";
11
+ import { EmptyState } from "../empty-state.tsx";
12
+ import { Image } from "../image.tsx";
13
+ import { CellValue } from "./cells.tsx";
14
+
15
+ /* The views made of cards and lines: board, gallery and list. A card or a line
16
+ opens its row (onOpenRow); the properties shown under its title are the view's
17
+ own (hidden ones left out, empty ones skipped). */
18
+
19
+ function Title({ row, properties }: { row: Row; properties: readonly Property[] }) {
20
+ const title = titleOf(properties);
21
+ const v = title ? row.values[title.id] : null;
22
+ return isEmpty(v ?? null) ? <span className="text-ink-tertiary">Untitled</span> : <>{String(v)}</>;
23
+ }
24
+
25
+ function Facts({ row, properties, skip }: { row: Row; properties: readonly Property[]; skip?: string }) {
26
+ const facts = properties.filter((p) => p.type !== "title" && p.id !== skip && !isEmpty(row.values[p.id] ?? null) && !(p.type === "checkbox" && row.values[p.id] !== true));
27
+ if (facts.length === 0) return null;
28
+ return (
29
+ <div className="flex flex-wrap items-center gap-x-2 gap-y-1 mt-1.5 text-caption text-ink-secondary">
30
+ {facts.map((p) => (
31
+ <span key={p.id} className="inline-flex items-center gap-1 max-w-full">
32
+ {p.type === "checkbox" && <span>{p.name}</span>}
33
+ <CellValue property={p} value={row.values[p.id]} plain />
34
+ </span>
35
+ ))}
36
+ </div>
37
+ );
38
+ }
39
+
40
+ /* ── Board ─────────────────────────────────────────────────────────────────
41
+ A column for each option of the view's select (`groupBy`), and one for no
42
+ value. Cards are dragged between columns (a short press on a touch screen); a
43
+ card's menu moves it from the keyboard. "New" in a column adds a row there.
44
+ On a phone the columns scroll sideways, a column at a time. */
45
+
46
+ function BoardCard({ row, properties, view, groups, onOpenRow, onMoveTo, overlay = false }: {
47
+ row: Row;
48
+ properties: readonly Property[];
49
+ view: View;
50
+ groups: Group[];
51
+ onOpenRow?: (row: Row) => void;
52
+ onMoveTo: (row: Row, key: string | null) => void;
53
+ overlay?: boolean;
54
+ }) {
55
+ const drag = useDraggable({ id: row.id, disabled: overlay });
56
+ const groupBy = properties.find((p) => p.id === view.groupBy);
57
+ return (
58
+ <div
59
+ ref={drag.setNodeRef}
60
+ {...drag.listeners}
61
+ className={cn(
62
+ "group group/card relative bg-surface shadow-sm hover:shadow-md p-2.5 rounded-surface text-sm transition-[opacity,box-shadow] duration-(--duration-fast) touch-manipulation",
63
+ drag.isDragging && "opacity-40",
64
+ overlay && "shadow-popover rotate-1 cursor-grabbing",
65
+ )}
66
+ >
67
+ <button type="button" onClick={() => onOpenRow?.(row)} className="pr-6 w-full font-medium text-left break-words after:absolute after:inset-0 after:content-['']">
68
+ <Title row={row} properties={properties} />
69
+ </button>
70
+ <Facts row={row} properties={shownProperties(properties, view)} skip={view.groupBy} />
71
+ {!overlay && groupBy && (
72
+ <DropdownMenu>
73
+ <DropdownMenuTrigger asChild>
74
+ <Button variant="ghost" size="icon-sm" aria-label="Move to another column" className="top-1.5 right-1.5 z-1 absolute size-6 affordance">
75
+ <MoreHorizontal />
76
+ </Button>
77
+ </DropdownMenuTrigger>
78
+ <DropdownMenuContent align="end">
79
+ <DropdownMenuLabel>Move to</DropdownMenuLabel>
80
+ {groups.map((g) => (
81
+ <DropdownMenuItem key={g.key ?? "none"} disabled={row.values[groupBy.id] === g.key || (g.key === null && isEmpty(row.values[groupBy.id] ?? null))} onSelect={() => onMoveTo(row, g.key)}>
82
+ <ArrowRightLeft /> {g.option?.name ?? `No ${groupBy.name}`}
83
+ </DropdownMenuItem>
84
+ ))}
85
+ </DropdownMenuContent>
86
+ </DropdownMenu>
87
+ )}
88
+ </div>
89
+ );
90
+ }
91
+
92
+ function BoardColumn({ group, label, children, onAdd, count }: { group: Group; label: ReactNode; children: ReactNode; onAdd: () => void; count: number }) {
93
+ const drop = useDroppable({ id: group.key ?? "__none" });
94
+ return (
95
+ <section
96
+ ref={drop.setNodeRef}
97
+ aria-label={typeof label === "string" ? label : group.option?.name}
98
+ className={cn(
99
+ "flex flex-col gap-2 bg-surface-sunken p-2 rounded-surface w-68 transition-colors duration-(--duration-fast) snap-start shrink-0",
100
+ drop.isOver && "bg-accent-tint",
101
+ )}
102
+ >
103
+ <h3 className="flex items-center gap-2 px-1 h-control-sm text-sm">
104
+ {label}
105
+ <span className="tabular-nums text-ink-tertiary">{count}</span>
106
+ </h3>
107
+ {children}
108
+ <Button variant="ghost" size="sm" onClick={onAdd} className="justify-start text-ink-tertiary">
109
+ <Plus /> New
110
+ </Button>
111
+ </section>
112
+ );
113
+ }
114
+
115
+ export function BoardView({ properties, rows, view, onSetValue, onAddRow, onOpenRow }: {
116
+ properties: readonly Property[];
117
+ rows: readonly Row[];
118
+ view: View;
119
+ onSetValue: (row: Row, property: Property, value: Value) => void;
120
+ onAddRow: (values?: Record<string, Value>) => void;
121
+ onOpenRow?: (row: Row) => void;
122
+ }) {
123
+ const groupBy = properties.find((p) => p.id === view.groupBy && p.type === "select");
124
+ const sensors = useSensors(useSensor(MouseSensor, { activationConstraint: { distance: 4 } }), useSensor(TouchSensor, { activationConstraint: { delay: 220, tolerance: 6 } }));
125
+ const [dragging, setDragging] = useState<Row | null>(null);
126
+ if (!groupBy) return <EmptyState compact title="Choose what the board groups by" description="A board needs a select property: its options become the columns. Choose one in the view's options." />;
127
+ const groups = groupRows(rows, groupBy);
128
+ const moveTo = (row: Row, key: string | null) => onSetValue(row, groupBy, key);
129
+ return (
130
+ <DndContext
131
+ sensors={sensors}
132
+ collisionDetection={pointerWithin}
133
+ onDragStart={(e) => setDragging(rows.find((r) => r.id === e.active.id) ?? null)}
134
+ onDragCancel={() => setDragging(null)}
135
+ onDragEnd={(e) => {
136
+ setDragging(null);
137
+ const row = rows.find((r) => r.id === e.active.id);
138
+ if (!row || !e.over) return;
139
+ const key = e.over.id === "__none" ? null : String(e.over.id);
140
+ if ((row.values[groupBy.id] ?? null) !== key) moveTo(row, key);
141
+ }}
142
+ accessibility={{ screenReaderInstructions: { draggable: "Open a card's menu to move it to another column." } }}
143
+ >
144
+ <div className="flex items-start gap-3 pb-2 overflow-x-auto overscroll-x-contain snap-x snap-mandatory sm:snap-none">
145
+ {groups.map((g) => (
146
+ <BoardColumn
147
+ key={g.key ?? "none"}
148
+ group={g}
149
+ count={g.rows.length}
150
+ label={g.option ? <Badge color={g.option.color}>{g.option.name}</Badge> : <span className="text-ink-secondary">No {groupBy.name}</span>}
151
+ onAdd={() => onAddRow({ [groupBy.id]: g.key })}
152
+ >
153
+ {g.rows.map((row) => (
154
+ <BoardCard key={row.id} row={row} properties={properties} view={view} groups={groups} onOpenRow={onOpenRow} onMoveTo={moveTo} />
155
+ ))}
156
+ </BoardColumn>
157
+ ))}
158
+ </div>
159
+ {/* A picture of the card being carried: not a second draggable card with the same id. */}
160
+ <DragOverlay dropAnimation={null}>
161
+ {dragging && (
162
+ <div className="bg-surface shadow-popover p-2.5 rounded-surface text-sm rotate-1 cursor-grabbing">
163
+ <div className="font-medium break-words">
164
+ <Title row={dragging} properties={properties} />
165
+ </div>
166
+ <Facts row={dragging} properties={shownProperties(properties, view)} skip={view.groupBy} />
167
+ </div>
168
+ )}
169
+ </DragOverlay>
170
+ </DndContext>
171
+ );
172
+ }
173
+
174
+ /* ── Gallery ───────────────────────────────────────────────────────────────
175
+ Cards with the row's cover picture (row.cover) over its title. As many columns
176
+ as fit, one on a small phone. */
177
+
178
+ export function GalleryView({ properties, rows, view, onOpenRow }: { properties: readonly Property[]; rows: readonly Row[]; view: View; onOpenRow?: (row: Row) => void }) {
179
+ const shown = shownProperties(properties, view);
180
+ return (
181
+ <ul className="gap-3 grid grid-cols-[repeat(auto-fill,minmax(min(14rem,100%),1fr))]">
182
+ {rows.map((row) => (
183
+ <li key={row.id} className="group/card relative bg-surface shadow-sm hover:shadow-md rounded-surface overflow-hidden transition-shadow duration-(--duration-fast)">
184
+ <Image src={row.cover ?? null} alt="" ratio="landscape" className="rounded-none" />
185
+ <div className="p-2.5 text-sm">
186
+ <button type="button" onClick={() => onOpenRow?.(row)} className="w-full font-medium text-left break-words after:absolute after:inset-0 after:content-['']">
187
+ <Title row={row} properties={properties} />
188
+ </button>
189
+ <Facts row={row} properties={shown} />
190
+ </div>
191
+ </li>
192
+ ))}
193
+ </ul>
194
+ );
195
+ }
196
+
197
+ /* ── List ──────────────────────────────────────────────────────────────────
198
+ A line per row: its title, and its shown properties at the end (under it on a
199
+ phone). The quietest view. */
200
+
201
+ export function ListView({ properties, rows, view, onOpenRow }: { properties: readonly Property[]; rows: readonly Row[]; view: View; onOpenRow?: (row: Row) => void }) {
202
+ const shown = shownProperties(properties, view).filter((p) => p.type !== "title");
203
+ return (
204
+ <ul className="@container flex flex-col">
205
+ {rows.map((row) => (
206
+ <li key={row.id} className="border-hairline border-b">
207
+ <button type="button" onClick={() => onOpenRow?.(row)} className="flex @max-md:flex-col @md:items-center gap-x-4 gap-y-1 hover:bg-tint-hover px-2 py-2 rounded-control w-full text-sm text-left">
208
+ <span className="flex-1 min-w-0 font-medium truncate">
209
+ <Title row={row} properties={properties} />
210
+ </span>
211
+ <span className="flex flex-wrap items-center gap-2 text-caption text-ink-secondary">
212
+ {shown.map((p) => (
213
+ <CellValue key={p.id} property={p} value={row.values[p.id]} plain />
214
+ ))}
215
+ </span>
216
+ </button>
217
+ </li>
218
+ ))}
219
+ </ul>
220
+ );
221
+ }