@kujoforall/paper-ui 0.0.0-stage → 0.2.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 (661) hide show
  1. package/CHANGELOG.md +93 -0
  2. package/LICENSE +21 -0
  3. package/README.md +295 -2
  4. package/dist/components/editor/block-text.d.ts +8 -0
  5. package/dist/components/editor/block-text.d.ts.map +1 -0
  6. package/dist/components/editor/block-text.js +248 -0
  7. package/dist/components/editor/block-text.js.map +1 -0
  8. package/dist/components/editor/blocks.d.ts +33 -0
  9. package/dist/components/editor/blocks.d.ts.map +1 -0
  10. package/dist/components/editor/blocks.js +191 -0
  11. package/dist/components/editor/blocks.js.map +1 -0
  12. package/dist/components/editor/document-editor.d.ts +27 -0
  13. package/dist/components/editor/document-editor.d.ts.map +1 -0
  14. package/dist/components/editor/document-editor.js +42 -0
  15. package/dist/components/editor/document-editor.js.map +1 -0
  16. package/dist/components/editor/document-view.d.ts +22 -0
  17. package/dist/components/editor/document-view.d.ts.map +1 -0
  18. package/dist/components/editor/document-view.js +110 -0
  19. package/dist/components/editor/document-view.js.map +1 -0
  20. package/dist/components/editor/editor-state.d.ts +107 -0
  21. package/dist/components/editor/editor-state.d.ts.map +1 -0
  22. package/dist/components/editor/editor-state.js +217 -0
  23. package/dist/components/editor/editor-state.js.map +1 -0
  24. package/dist/components/editor/extensions/kit-blocks.d.ts +34 -0
  25. package/dist/components/editor/extensions/kit-blocks.d.ts.map +1 -0
  26. package/dist/components/editor/extensions/kit-blocks.js +201 -0
  27. package/dist/components/editor/extensions/kit-blocks.js.map +1 -0
  28. package/dist/components/editor/extensions/spoiler.d.ts +8 -0
  29. package/dist/components/editor/extensions/spoiler.d.ts.map +1 -0
  30. package/dist/components/editor/extensions/spoiler.js +36 -0
  31. package/dist/components/editor/extensions/spoiler.js.map +1 -0
  32. package/dist/components/editor/index.d.ts +10 -0
  33. package/dist/components/editor/index.d.ts.map +1 -0
  34. package/dist/components/editor/index.js +10 -0
  35. package/dist/components/editor/index.js.map +1 -0
  36. package/dist/components/editor/kinds.d.ts +99 -0
  37. package/dist/components/editor/kinds.d.ts.map +1 -0
  38. package/dist/components/editor/kinds.js +74 -0
  39. package/dist/components/editor/kinds.js.map +1 -0
  40. package/dist/components/editor/look.d.ts +18 -0
  41. package/dist/components/editor/look.d.ts.map +1 -0
  42. package/dist/components/editor/look.js +21 -0
  43. package/dist/components/editor/look.js.map +1 -0
  44. package/dist/components/sketch/rough.d.ts +38 -0
  45. package/dist/components/sketch/rough.d.ts.map +1 -0
  46. package/dist/components/sketch/rough.js +57 -0
  47. package/dist/components/sketch/rough.js.map +1 -0
  48. package/dist/components/three/model-viewer.d.ts +36 -0
  49. package/dist/components/three/model-viewer.d.ts.map +1 -0
  50. package/dist/components/three/model-viewer.js +338 -0
  51. package/dist/components/three/model-viewer.js.map +1 -0
  52. package/dist/components/ui/accent-picker.d.ts +2 -0
  53. package/dist/components/ui/accent-picker.d.ts.map +1 -0
  54. package/dist/components/ui/accent-picker.js +44 -0
  55. package/dist/components/ui/accent-picker.js.map +1 -0
  56. package/dist/components/ui/address-field.d.ts +10 -0
  57. package/dist/components/ui/address-field.d.ts.map +1 -0
  58. package/dist/components/ui/address-field.js +24 -0
  59. package/dist/components/ui/address-field.js.map +1 -0
  60. package/dist/components/ui/alert-dialog.d.ts +29 -0
  61. package/dist/components/ui/alert-dialog.d.ts.map +1 -0
  62. package/dist/components/ui/alert-dialog.js +72 -0
  63. package/dist/components/ui/alert-dialog.js.map +1 -0
  64. package/dist/components/ui/animated-height.d.ts +6 -0
  65. package/dist/components/ui/animated-height.d.ts.map +1 -0
  66. package/dist/components/ui/animated-height.js +26 -0
  67. package/dist/components/ui/animated-height.js.map +1 -0
  68. package/dist/components/ui/app-shell.d.ts +26 -0
  69. package/dist/components/ui/app-shell.d.ts.map +1 -0
  70. package/dist/components/ui/app-shell.js +71 -0
  71. package/dist/components/ui/app-shell.js.map +1 -0
  72. package/dist/components/ui/avatar.d.ts +30 -0
  73. package/dist/components/ui/avatar.d.ts.map +1 -0
  74. package/dist/components/ui/avatar.js +50 -0
  75. package/dist/components/ui/avatar.js.map +1 -0
  76. package/dist/components/ui/badge.d.ts +19 -0
  77. package/dist/components/ui/badge.d.ts.map +1 -0
  78. package/dist/components/ui/badge.js +62 -0
  79. package/dist/components/ui/badge.js.map +1 -0
  80. package/dist/components/ui/banner.d.ts +33 -0
  81. package/dist/components/ui/banner.d.ts.map +1 -0
  82. package/dist/components/ui/banner.js +21 -0
  83. package/dist/components/ui/banner.js.map +1 -0
  84. package/dist/components/ui/breadcrumbs.d.ts +10 -0
  85. package/dist/components/ui/breadcrumbs.d.ts.map +1 -0
  86. package/dist/components/ui/breadcrumbs.js +9 -0
  87. package/dist/components/ui/breadcrumbs.js.map +1 -0
  88. package/dist/components/ui/button.d.ts +15 -0
  89. package/dist/components/ui/button.d.ts.map +1 -0
  90. package/dist/components/ui/button.js +110 -0
  91. package/dist/components/ui/button.js.map +1 -0
  92. package/dist/components/ui/calendar.d.ts +5 -0
  93. package/dist/components/ui/calendar.d.ts.map +1 -0
  94. package/dist/components/ui/calendar.js +65 -0
  95. package/dist/components/ui/calendar.js.map +1 -0
  96. package/dist/components/ui/callout.d.ts +32 -0
  97. package/dist/components/ui/callout.d.ts.map +1 -0
  98. package/dist/components/ui/callout.js +40 -0
  99. package/dist/components/ui/callout.js.map +1 -0
  100. package/dist/components/ui/card.d.ts +18 -0
  101. package/dist/components/ui/card.d.ts.map +1 -0
  102. package/dist/components/ui/card.js +28 -0
  103. package/dist/components/ui/card.js.map +1 -0
  104. package/dist/components/ui/checkbox.d.ts +11 -0
  105. package/dist/components/ui/checkbox.d.ts.map +1 -0
  106. package/dist/components/ui/checkbox.js +30 -0
  107. package/dist/components/ui/checkbox.js.map +1 -0
  108. package/dist/components/ui/choice-label.d.ts +13 -0
  109. package/dist/components/ui/choice-label.d.ts.map +1 -0
  110. package/dist/components/ui/choice-label.js +17 -0
  111. package/dist/components/ui/choice-label.js.map +1 -0
  112. package/dist/components/ui/collapsible.d.ts +10 -0
  113. package/dist/components/ui/collapsible.d.ts.map +1 -0
  114. package/dist/components/ui/collapsible.js +21 -0
  115. package/dist/components/ui/collapsible.js.map +1 -0
  116. package/dist/components/ui/collection-layout.d.ts +24 -0
  117. package/dist/components/ui/collection-layout.d.ts.map +1 -0
  118. package/dist/components/ui/collection-layout.js +16 -0
  119. package/dist/components/ui/collection-layout.js.map +1 -0
  120. package/dist/components/ui/combobox.d.ts +10 -0
  121. package/dist/components/ui/combobox.d.ts.map +1 -0
  122. package/dist/components/ui/combobox.js +93 -0
  123. package/dist/components/ui/combobox.js.map +1 -0
  124. package/dist/components/ui/command-menu.d.ts +18 -0
  125. package/dist/components/ui/command-menu.d.ts.map +1 -0
  126. package/dist/components/ui/command-menu.js +49 -0
  127. package/dist/components/ui/command-menu.js.map +1 -0
  128. package/dist/components/ui/context-menu.d.ts +19 -0
  129. package/dist/components/ui/context-menu.d.ts.map +1 -0
  130. package/dist/components/ui/context-menu.js +42 -0
  131. package/dist/components/ui/context-menu.js.map +1 -0
  132. package/dist/components/ui/copy-button.d.ts +11 -0
  133. package/dist/components/ui/copy-button.d.ts.map +1 -0
  134. package/dist/components/ui/copy-button.js +48 -0
  135. package/dist/components/ui/copy-button.js.map +1 -0
  136. package/dist/components/ui/database/calendar-view.d.ts +10 -0
  137. package/dist/components/ui/database/calendar-view.d.ts.map +1 -0
  138. package/dist/components/ui/database/calendar-view.js +65 -0
  139. package/dist/components/ui/database/calendar-view.js.map +1 -0
  140. package/dist/components/ui/database/card-views.d.ts +22 -0
  141. package/dist/components/ui/database/card-views.d.ts.map +1 -0
  142. package/dist/components/ui/database/card-views.js +74 -0
  143. package/dist/components/ui/database/card-views.js.map +1 -0
  144. package/dist/components/ui/database/cells.d.ts +20 -0
  145. package/dist/components/ui/database/cells.d.ts.map +1 -0
  146. package/dist/components/ui/database/cells.js +132 -0
  147. package/dist/components/ui/database/cells.js.map +1 -0
  148. package/dist/components/ui/database/database.d.ts +19 -0
  149. package/dist/components/ui/database/database.d.ts.map +1 -0
  150. package/dist/components/ui/database/database.js +102 -0
  151. package/dist/components/ui/database/database.js.map +1 -0
  152. package/dist/components/ui/database/icons.d.ts +5 -0
  153. package/dist/components/ui/database/icons.d.ts.map +1 -0
  154. package/dist/components/ui/database/icons.js +13 -0
  155. package/dist/components/ui/database/icons.js.map +1 -0
  156. package/dist/components/ui/database/table-view.d.ts +11 -0
  157. package/dist/components/ui/database/table-view.d.ts.map +1 -0
  158. package/dist/components/ui/database/table-view.js +157 -0
  159. package/dist/components/ui/database/table-view.js.map +1 -0
  160. package/dist/components/ui/date-picker.d.ts +40 -0
  161. package/dist/components/ui/date-picker.d.ts.map +1 -0
  162. package/dist/components/ui/date-picker.js +64 -0
  163. package/dist/components/ui/date-picker.js.map +1 -0
  164. package/dist/components/ui/date-time-picker.d.ts +21 -0
  165. package/dist/components/ui/date-time-picker.d.ts.map +1 -0
  166. package/dist/components/ui/date-time-picker.js +34 -0
  167. package/dist/components/ui/date-time-picker.js.map +1 -0
  168. package/dist/components/ui/dialog.d.ts +21 -0
  169. package/dist/components/ui/dialog.d.ts.map +1 -0
  170. package/dist/components/ui/dialog.js +63 -0
  171. package/dist/components/ui/dialog.js.map +1 -0
  172. package/dist/components/ui/document-layout.d.ts +15 -0
  173. package/dist/components/ui/document-layout.d.ts.map +1 -0
  174. package/dist/components/ui/document-layout.js +15 -0
  175. package/dist/components/ui/document-layout.js.map +1 -0
  176. package/dist/components/ui/dropdown-menu.d.ts +24 -0
  177. package/dist/components/ui/dropdown-menu.d.ts.map +1 -0
  178. package/dist/components/ui/dropdown-menu.js +65 -0
  179. package/dist/components/ui/dropdown-menu.js.map +1 -0
  180. package/dist/components/ui/editable-text.d.ts +24 -0
  181. package/dist/components/ui/editable-text.d.ts.map +1 -0
  182. package/dist/components/ui/editable-text.js +85 -0
  183. package/dist/components/ui/editable-text.js.map +1 -0
  184. package/dist/components/ui/empty-state.d.ts +11 -0
  185. package/dist/components/ui/empty-state.d.ts.map +1 -0
  186. package/dist/components/ui/empty-state.js +9 -0
  187. package/dist/components/ui/empty-state.js.map +1 -0
  188. package/dist/components/ui/error-state.d.ts +20 -0
  189. package/dist/components/ui/error-state.d.ts.map +1 -0
  190. package/dist/components/ui/error-state.js +17 -0
  191. package/dist/components/ui/error-state.js.map +1 -0
  192. package/dist/components/ui/field-button.d.ts +15 -0
  193. package/dist/components/ui/field-button.d.ts.map +1 -0
  194. package/dist/components/ui/field-button.js +18 -0
  195. package/dist/components/ui/field-button.js.map +1 -0
  196. package/dist/components/ui/file-preview.d.ts +5 -0
  197. package/dist/components/ui/file-preview.d.ts.map +1 -0
  198. package/dist/components/ui/file-preview.js +66 -0
  199. package/dist/components/ui/file-preview.js.map +1 -0
  200. package/dist/components/ui/file-uploader.d.ts +39 -0
  201. package/dist/components/ui/file-uploader.d.ts.map +1 -0
  202. package/dist/components/ui/file-uploader.js +111 -0
  203. package/dist/components/ui/file-uploader.js.map +1 -0
  204. package/dist/components/ui/filter-builder.d.ts +18 -0
  205. package/dist/components/ui/filter-builder.d.ts.map +1 -0
  206. package/dist/components/ui/filter-builder.js +98 -0
  207. package/dist/components/ui/filter-builder.js.map +1 -0
  208. package/dist/components/ui/focus-shell.d.ts +14 -0
  209. package/dist/components/ui/focus-shell.d.ts.map +1 -0
  210. package/dist/components/ui/focus-shell.js +13 -0
  211. package/dist/components/ui/focus-shell.js.map +1 -0
  212. package/dist/components/ui/handle-row.d.ts +25 -0
  213. package/dist/components/ui/handle-row.d.ts.map +1 -0
  214. package/dist/components/ui/handle-row.js +110 -0
  215. package/dist/components/ui/handle-row.js.map +1 -0
  216. package/dist/components/ui/header-bar.d.ts +5 -0
  217. package/dist/components/ui/header-bar.d.ts.map +1 -0
  218. package/dist/components/ui/header-bar.js +10 -0
  219. package/dist/components/ui/header-bar.js.map +1 -0
  220. package/dist/components/ui/hover-card.d.ts +6 -0
  221. package/dist/components/ui/hover-card.d.ts.map +1 -0
  222. package/dist/components/ui/hover-card.js +13 -0
  223. package/dist/components/ui/hover-card.js.map +1 -0
  224. package/dist/components/ui/image-block.d.ts +31 -0
  225. package/dist/components/ui/image-block.d.ts.map +1 -0
  226. package/dist/components/ui/image-block.js +103 -0
  227. package/dist/components/ui/image-block.js.map +1 -0
  228. package/dist/components/ui/image-card.d.ts +17 -0
  229. package/dist/components/ui/image-card.d.ts.map +1 -0
  230. package/dist/components/ui/image-card.js +39 -0
  231. package/dist/components/ui/image-card.js.map +1 -0
  232. package/dist/components/ui/image-framer.d.ts +24 -0
  233. package/dist/components/ui/image-framer.d.ts.map +1 -0
  234. package/dist/components/ui/image-framer.js +89 -0
  235. package/dist/components/ui/image-framer.js.map +1 -0
  236. package/dist/components/ui/image-viewer.d.ts +31 -0
  237. package/dist/components/ui/image-viewer.d.ts.map +1 -0
  238. package/dist/components/ui/image-viewer.js +114 -0
  239. package/dist/components/ui/image-viewer.js.map +1 -0
  240. package/dist/components/ui/image.d.ts +33 -0
  241. package/dist/components/ui/image.d.ts.map +1 -0
  242. package/dist/components/ui/image.js +61 -0
  243. package/dist/components/ui/image.js.map +1 -0
  244. package/dist/components/ui/index.d.ts +92 -0
  245. package/dist/components/ui/index.d.ts.map +1 -0
  246. package/dist/components/ui/index.js +92 -0
  247. package/dist/components/ui/index.js.map +1 -0
  248. package/dist/components/ui/input.d.ts +75 -0
  249. package/dist/components/ui/input.d.ts.map +1 -0
  250. package/dist/components/ui/input.js +245 -0
  251. package/dist/components/ui/input.js.map +1 -0
  252. package/dist/components/ui/link-block.d.ts +13 -0
  253. package/dist/components/ui/link-block.d.ts.map +1 -0
  254. package/dist/components/ui/link-block.js +21 -0
  255. package/dist/components/ui/link-block.js.map +1 -0
  256. package/dist/components/ui/list-detail.d.ts +23 -0
  257. package/dist/components/ui/list-detail.d.ts.map +1 -0
  258. package/dist/components/ui/list-detail.js +33 -0
  259. package/dist/components/ui/list-detail.js.map +1 -0
  260. package/dist/components/ui/listbox.d.ts +7 -0
  261. package/dist/components/ui/listbox.d.ts.map +1 -0
  262. package/dist/components/ui/listbox.js +29 -0
  263. package/dist/components/ui/listbox.js.map +1 -0
  264. package/dist/components/ui/mac-card.d.ts +15 -0
  265. package/dist/components/ui/mac-card.d.ts.map +1 -0
  266. package/dist/components/ui/mac-card.js +9 -0
  267. package/dist/components/ui/mac-card.js.map +1 -0
  268. package/dist/components/ui/month-picker.d.ts +13 -0
  269. package/dist/components/ui/month-picker.d.ts.map +1 -0
  270. package/dist/components/ui/month-picker.js +53 -0
  271. package/dist/components/ui/month-picker.js.map +1 -0
  272. package/dist/components/ui/multi-select.d.ts +22 -0
  273. package/dist/components/ui/multi-select.d.ts.map +1 -0
  274. package/dist/components/ui/multi-select.js +88 -0
  275. package/dist/components/ui/multi-select.js.map +1 -0
  276. package/dist/components/ui/nav-tree.d.ts +16 -0
  277. package/dist/components/ui/nav-tree.d.ts.map +1 -0
  278. package/dist/components/ui/nav-tree.js +41 -0
  279. package/dist/components/ui/nav-tree.js.map +1 -0
  280. package/dist/components/ui/page.d.ts +23 -0
  281. package/dist/components/ui/page.d.ts.map +1 -0
  282. package/dist/components/ui/page.js +28 -0
  283. package/dist/components/ui/page.js.map +1 -0
  284. package/dist/components/ui/pagination.d.ts +26 -0
  285. package/dist/components/ui/pagination.d.ts.map +1 -0
  286. package/dist/components/ui/pagination.js +54 -0
  287. package/dist/components/ui/pagination.js.map +1 -0
  288. package/dist/components/ui/picker-panel.d.ts +13 -0
  289. package/dist/components/ui/picker-panel.d.ts.map +1 -0
  290. package/dist/components/ui/picker-panel.js +19 -0
  291. package/dist/components/ui/picker-panel.js.map +1 -0
  292. package/dist/components/ui/popover.d.ts +8 -0
  293. package/dist/components/ui/popover.d.ts.map +1 -0
  294. package/dist/components/ui/popover.js +18 -0
  295. package/dist/components/ui/popover.js.map +1 -0
  296. package/dist/components/ui/progress.d.ts +19 -0
  297. package/dist/components/ui/progress.d.ts.map +1 -0
  298. package/dist/components/ui/progress.js +22 -0
  299. package/dist/components/ui/progress.js.map +1 -0
  300. package/dist/components/ui/property.d.ts +11 -0
  301. package/dist/components/ui/property.d.ts.map +1 -0
  302. package/dist/components/ui/property.js +18 -0
  303. package/dist/components/ui/property.js.map +1 -0
  304. package/dist/components/ui/radio-group.d.ts +8 -0
  305. package/dist/components/ui/radio-group.d.ts.map +1 -0
  306. package/dist/components/ui/radio-group.js +18 -0
  307. package/dist/components/ui/radio-group.js.map +1 -0
  308. package/dist/components/ui/rating.d.ts +14 -0
  309. package/dist/components/ui/rating.d.ts.map +1 -0
  310. package/dist/components/ui/rating.js +61 -0
  311. package/dist/components/ui/rating.js.map +1 -0
  312. package/dist/components/ui/save-status.d.ts +8 -0
  313. package/dist/components/ui/save-status.d.ts.map +1 -0
  314. package/dist/components/ui/save-status.js +31 -0
  315. package/dist/components/ui/save-status.js.map +1 -0
  316. package/dist/components/ui/segmented.d.ts +21 -0
  317. package/dist/components/ui/segmented.d.ts.map +1 -0
  318. package/dist/components/ui/segmented.js +12 -0
  319. package/dist/components/ui/segmented.js.map +1 -0
  320. package/dist/components/ui/select-menu.d.ts +12 -0
  321. package/dist/components/ui/select-menu.d.ts.map +1 -0
  322. package/dist/components/ui/select-menu.js +10 -0
  323. package/dist/components/ui/select-menu.js.map +1 -0
  324. package/dist/components/ui/select.d.ts +16 -0
  325. package/dist/components/ui/select.d.ts.map +1 -0
  326. package/dist/components/ui/select.js +45 -0
  327. package/dist/components/ui/select.js.map +1 -0
  328. package/dist/components/ui/selection-bar.d.ts +12 -0
  329. package/dist/components/ui/selection-bar.d.ts.map +1 -0
  330. package/dist/components/ui/selection-bar.js +15 -0
  331. package/dist/components/ui/selection-bar.js.map +1 -0
  332. package/dist/components/ui/separator.d.ts +4 -0
  333. package/dist/components/ui/separator.d.ts.map +1 -0
  334. package/dist/components/ui/separator.js +12 -0
  335. package/dist/components/ui/separator.js.map +1 -0
  336. package/dist/components/ui/settings-layout.d.ts +34 -0
  337. package/dist/components/ui/settings-layout.d.ts.map +1 -0
  338. package/dist/components/ui/settings-layout.js +16 -0
  339. package/dist/components/ui/settings-layout.js.map +1 -0
  340. package/dist/components/ui/share-link.d.ts +14 -0
  341. package/dist/components/ui/share-link.d.ts.map +1 -0
  342. package/dist/components/ui/share-link.js +16 -0
  343. package/dist/components/ui/share-link.js.map +1 -0
  344. package/dist/components/ui/sheet.d.ts +21 -0
  345. package/dist/components/ui/sheet.d.ts.map +1 -0
  346. package/dist/components/ui/sheet.js +53 -0
  347. package/dist/components/ui/sheet.js.map +1 -0
  348. package/dist/components/ui/sidebar.d.ts +82 -0
  349. package/dist/components/ui/sidebar.d.ts.map +1 -0
  350. package/dist/components/ui/sidebar.js +258 -0
  351. package/dist/components/ui/sidebar.js.map +1 -0
  352. package/dist/components/ui/skeleton.d.ts +8 -0
  353. package/dist/components/ui/skeleton.d.ts.map +1 -0
  354. package/dist/components/ui/skeleton.js +15 -0
  355. package/dist/components/ui/skeleton.js.map +1 -0
  356. package/dist/components/ui/spinner.d.ts +12 -0
  357. package/dist/components/ui/spinner.d.ts.map +1 -0
  358. package/dist/components/ui/spinner.js +14 -0
  359. package/dist/components/ui/spinner.js.map +1 -0
  360. package/dist/components/ui/spotlight.d.ts +23 -0
  361. package/dist/components/ui/spotlight.d.ts.map +1 -0
  362. package/dist/components/ui/spotlight.js +110 -0
  363. package/dist/components/ui/spotlight.js.map +1 -0
  364. package/dist/components/ui/stat-tile.d.ts +8 -0
  365. package/dist/components/ui/stat-tile.d.ts.map +1 -0
  366. package/dist/components/ui/stat-tile.js +9 -0
  367. package/dist/components/ui/stat-tile.js.map +1 -0
  368. package/dist/components/ui/step-dialog.d.ts +20 -0
  369. package/dist/components/ui/step-dialog.d.ts.map +1 -0
  370. package/dist/components/ui/step-dialog.js +36 -0
  371. package/dist/components/ui/step-dialog.js.map +1 -0
  372. package/dist/components/ui/steps-layout.d.ts +20 -0
  373. package/dist/components/ui/steps-layout.d.ts.map +1 -0
  374. package/dist/components/ui/steps-layout.js +26 -0
  375. package/dist/components/ui/steps-layout.js.map +1 -0
  376. package/dist/components/ui/switch.d.ts +8 -0
  377. package/dist/components/ui/switch.d.ts.map +1 -0
  378. package/dist/components/ui/switch.js +21 -0
  379. package/dist/components/ui/switch.js.map +1 -0
  380. package/dist/components/ui/table.d.ts +16 -0
  381. package/dist/components/ui/table.d.ts.map +1 -0
  382. package/dist/components/ui/table.js +76 -0
  383. package/dist/components/ui/table.js.map +1 -0
  384. package/dist/components/ui/tabs.d.ts +7 -0
  385. package/dist/components/ui/tabs.d.ts.map +1 -0
  386. package/dist/components/ui/tabs.js +19 -0
  387. package/dist/components/ui/tabs.js.map +1 -0
  388. package/dist/components/ui/theme-toggle.d.ts +16 -0
  389. package/dist/components/ui/theme-toggle.d.ts.map +1 -0
  390. package/dist/components/ui/theme-toggle.js +65 -0
  391. package/dist/components/ui/theme-toggle.js.map +1 -0
  392. package/dist/components/ui/time-list.d.ts +16 -0
  393. package/dist/components/ui/time-list.d.ts.map +1 -0
  394. package/dist/components/ui/time-list.js +49 -0
  395. package/dist/components/ui/time-list.js.map +1 -0
  396. package/dist/components/ui/time-picker.d.ts +47 -0
  397. package/dist/components/ui/time-picker.d.ts.map +1 -0
  398. package/dist/components/ui/time-picker.js +141 -0
  399. package/dist/components/ui/time-picker.js.map +1 -0
  400. package/dist/components/ui/toast.d.ts +18 -0
  401. package/dist/components/ui/toast.d.ts.map +1 -0
  402. package/dist/components/ui/toast.js +77 -0
  403. package/dist/components/ui/toast.js.map +1 -0
  404. package/dist/components/ui/toggle.d.ts +15 -0
  405. package/dist/components/ui/toggle.d.ts.map +1 -0
  406. package/dist/components/ui/toggle.js +55 -0
  407. package/dist/components/ui/toggle.js.map +1 -0
  408. package/dist/components/ui/tooltip.d.ts +15 -0
  409. package/dist/components/ui/tooltip.d.ts.map +1 -0
  410. package/dist/components/ui/tooltip.js +32 -0
  411. package/dist/components/ui/tooltip.js.map +1 -0
  412. package/dist/components/ui/top-bar.d.ts +25 -0
  413. package/dist/components/ui/top-bar.d.ts.map +1 -0
  414. package/dist/components/ui/top-bar.js +23 -0
  415. package/dist/components/ui/top-bar.js.map +1 -0
  416. package/dist/components/ui/typography.d.ts +40 -0
  417. package/dist/components/ui/typography.d.ts.map +1 -0
  418. package/dist/components/ui/typography.js +98 -0
  419. package/dist/components/ui/typography.js.map +1 -0
  420. package/dist/components/ui/video-block.d.ts +14 -0
  421. package/dist/components/ui/video-block.d.ts.map +1 -0
  422. package/dist/components/ui/video-block.js +22 -0
  423. package/dist/components/ui/video-block.js.map +1 -0
  424. package/dist/hooks/use-dismiss.d.ts +5 -0
  425. package/dist/hooks/use-dismiss.d.ts.map +1 -0
  426. package/dist/hooks/use-dismiss.js +23 -0
  427. package/dist/hooks/use-dismiss.js.map +1 -0
  428. package/dist/hooks/use-escape-first.d.ts +3 -0
  429. package/dist/hooks/use-escape-first.d.ts.map +1 -0
  430. package/dist/hooks/use-escape-first.js +27 -0
  431. package/dist/hooks/use-escape-first.js.map +1 -0
  432. package/dist/hooks/use-media-query.d.ts +5 -0
  433. package/dist/hooks/use-media-query.d.ts.map +1 -0
  434. package/dist/hooks/use-media-query.js +16 -0
  435. package/dist/hooks/use-media-query.js.map +1 -0
  436. package/dist/hooks/use-save-queue.d.ts +13 -0
  437. package/dist/hooks/use-save-queue.d.ts.map +1 -0
  438. package/dist/hooks/use-save-queue.js +57 -0
  439. package/dist/hooks/use-save-queue.js.map +1 -0
  440. package/dist/hooks/use-selection.d.ts +10 -0
  441. package/dist/hooks/use-selection.d.ts.map +1 -0
  442. package/dist/hooks/use-selection.js +52 -0
  443. package/dist/hooks/use-selection.js.map +1 -0
  444. package/dist/hooks/use-shared-transition.d.ts +3 -0
  445. package/dist/hooks/use-shared-transition.d.ts.map +1 -0
  446. package/dist/hooks/use-shared-transition.js +38 -0
  447. package/dist/hooks/use-shared-transition.js.map +1 -0
  448. package/dist/hooks/use-upload-queue.d.ts +22 -0
  449. package/dist/hooks/use-upload-queue.d.ts.map +1 -0
  450. package/dist/hooks/use-upload-queue.js +78 -0
  451. package/dist/hooks/use-upload-queue.js.map +1 -0
  452. package/dist/lib/accent.d.ts +5 -0
  453. package/dist/lib/accent.d.ts.map +1 -0
  454. package/dist/lib/accent.js +10 -0
  455. package/dist/lib/accent.js.map +1 -0
  456. package/dist/lib/bento.d.ts +17 -0
  457. package/dist/lib/bento.d.ts.map +1 -0
  458. package/dist/lib/bento.js +92 -0
  459. package/dist/lib/bento.js.map +1 -0
  460. package/dist/lib/database.d.ts +92 -0
  461. package/dist/lib/database.d.ts.map +1 -0
  462. package/dist/lib/database.js +272 -0
  463. package/dist/lib/database.js.map +1 -0
  464. package/dist/lib/dates.d.ts +30 -0
  465. package/dist/lib/dates.d.ts.map +1 -0
  466. package/dist/lib/dates.js +61 -0
  467. package/dist/lib/dates.js.map +1 -0
  468. package/dist/lib/document.d.ts +79 -0
  469. package/dist/lib/document.d.ts.map +1 -0
  470. package/dist/lib/document.js +11 -0
  471. package/dist/lib/document.js.map +1 -0
  472. package/dist/lib/embed.d.ts +14 -0
  473. package/dist/lib/embed.d.ts.map +1 -0
  474. package/dist/lib/embed.js +63 -0
  475. package/dist/lib/embed.js.map +1 -0
  476. package/dist/lib/files.d.ts +23 -0
  477. package/dist/lib/files.d.ts.map +1 -0
  478. package/dist/lib/files.js +69 -0
  479. package/dist/lib/files.js.map +1 -0
  480. package/dist/lib/justified.d.ts +50 -0
  481. package/dist/lib/justified.d.ts.map +1 -0
  482. package/dist/lib/justified.js +78 -0
  483. package/dist/lib/justified.js.map +1 -0
  484. package/dist/lib/keys.d.ts +18 -0
  485. package/dist/lib/keys.d.ts.map +1 -0
  486. package/dist/lib/keys.js +66 -0
  487. package/dist/lib/keys.js.map +1 -0
  488. package/dist/lib/number.d.ts +4 -0
  489. package/dist/lib/number.d.ts.map +1 -0
  490. package/dist/lib/number.js +33 -0
  491. package/dist/lib/number.js.map +1 -0
  492. package/dist/lib/pointer.d.ts +2 -0
  493. package/dist/lib/pointer.d.ts.map +1 -0
  494. package/dist/lib/pointer.js +4 -0
  495. package/dist/lib/pointer.js.map +1 -0
  496. package/dist/lib/prepare-image.d.ts +43 -0
  497. package/dist/lib/prepare-image.d.ts.map +1 -0
  498. package/dist/lib/prepare-image.js +105 -0
  499. package/dist/lib/prepare-image.js.map +1 -0
  500. package/dist/lib/rich-text-dom.d.ts +16 -0
  501. package/dist/lib/rich-text-dom.d.ts.map +1 -0
  502. package/dist/lib/rich-text-dom.js +145 -0
  503. package/dist/lib/rich-text-dom.js.map +1 -0
  504. package/dist/lib/rich-text.d.ts +15 -0
  505. package/dist/lib/rich-text.d.ts.map +1 -0
  506. package/dist/lib/rich-text.js +35 -0
  507. package/dist/lib/rich-text.js.map +1 -0
  508. package/dist/lib/spotlight.d.ts +22 -0
  509. package/dist/lib/spotlight.d.ts.map +1 -0
  510. package/dist/lib/spotlight.js +66 -0
  511. package/dist/lib/spotlight.js.map +1 -0
  512. package/dist/lib/theme.d.ts +6 -0
  513. package/dist/lib/theme.d.ts.map +1 -0
  514. package/dist/lib/theme.js +15 -0
  515. package/dist/lib/theme.js.map +1 -0
  516. package/dist/lib/time.d.ts +19 -0
  517. package/dist/lib/time.d.ts.map +1 -0
  518. package/dist/lib/time.js +91 -0
  519. package/dist/lib/time.js.map +1 -0
  520. package/dist/lib/tree.d.ts +17 -0
  521. package/dist/lib/tree.d.ts.map +1 -0
  522. package/dist/lib/tree.js +35 -0
  523. package/dist/lib/tree.js.map +1 -0
  524. package/dist/lib/utils.d.ts +3 -0
  525. package/dist/lib/utils.d.ts.map +1 -0
  526. package/dist/lib/utils.js +24 -0
  527. package/dist/lib/utils.js.map +1 -0
  528. package/dist/styles/notion.css +817 -0
  529. package/package.json +129 -5
  530. package/src/components/editor/block-text.tsx +271 -0
  531. package/src/components/editor/blocks.tsx +373 -0
  532. package/src/components/editor/document-editor.tsx +106 -0
  533. package/src/components/editor/document-view.tsx +205 -0
  534. package/src/components/editor/editor-state.tsx +298 -0
  535. package/src/components/editor/extensions/kit-blocks.tsx +452 -0
  536. package/src/components/editor/extensions/spoiler.tsx +81 -0
  537. package/src/components/editor/index.ts +10 -0
  538. package/src/components/editor/kinds.ts +158 -0
  539. package/src/components/editor/look.tsx +36 -0
  540. package/src/components/sketch/rough.tsx +90 -0
  541. package/src/components/three/model-viewer.tsx +514 -0
  542. package/src/components/ui/accent-picker.tsx +72 -0
  543. package/src/components/ui/address-field.tsx +57 -0
  544. package/src/components/ui/alert-dialog.tsx +136 -0
  545. package/src/components/ui/animated-height.tsx +34 -0
  546. package/src/components/ui/app-shell.tsx +140 -0
  547. package/src/components/ui/avatar.tsx +106 -0
  548. package/src/components/ui/badge.tsx +81 -0
  549. package/src/components/ui/banner.tsx +53 -0
  550. package/src/components/ui/breadcrumbs.tsx +25 -0
  551. package/src/components/ui/button.tsx +147 -0
  552. package/src/components/ui/calendar.tsx +101 -0
  553. package/src/components/ui/callout.tsx +61 -0
  554. package/src/components/ui/card.tsx +59 -0
  555. package/src/components/ui/checkbox.tsx +66 -0
  556. package/src/components/ui/choice-label.tsx +43 -0
  557. package/src/components/ui/collapsible.tsx +58 -0
  558. package/src/components/ui/collection-layout.tsx +69 -0
  559. package/src/components/ui/combobox.tsx +155 -0
  560. package/src/components/ui/command-menu.tsx +102 -0
  561. package/src/components/ui/context-menu.tsx +89 -0
  562. package/src/components/ui/copy-button.tsx +80 -0
  563. package/src/components/ui/database/calendar-view.tsx +180 -0
  564. package/src/components/ui/database/card-views.tsx +221 -0
  565. package/src/components/ui/database/cells.tsx +237 -0
  566. package/src/components/ui/database/database.tsx +279 -0
  567. package/src/components/ui/database/icons.ts +15 -0
  568. package/src/components/ui/database/table-view.tsx +311 -0
  569. package/src/components/ui/date-picker.tsx +208 -0
  570. package/src/components/ui/date-time-picker.tsx +123 -0
  571. package/src/components/ui/dialog.tsx +151 -0
  572. package/src/components/ui/document-layout.tsx +52 -0
  573. package/src/components/ui/dropdown-menu.tsx +185 -0
  574. package/src/components/ui/editable-text.tsx +142 -0
  575. package/src/components/ui/empty-state.tsx +35 -0
  576. package/src/components/ui/error-state.tsx +67 -0
  577. package/src/components/ui/field-button.tsx +70 -0
  578. package/src/components/ui/file-preview.tsx +80 -0
  579. package/src/components/ui/file-uploader.tsx +375 -0
  580. package/src/components/ui/filter-builder.tsx +304 -0
  581. package/src/components/ui/focus-shell.tsx +48 -0
  582. package/src/components/ui/handle-row.tsx +252 -0
  583. package/src/components/ui/header-bar.tsx +15 -0
  584. package/src/components/ui/hover-card.tsx +30 -0
  585. package/src/components/ui/image-block.tsx +238 -0
  586. package/src/components/ui/image-card.tsx +95 -0
  587. package/src/components/ui/image-framer.tsx +160 -0
  588. package/src/components/ui/image-viewer.tsx +230 -0
  589. package/src/components/ui/image.tsx +200 -0
  590. package/src/components/ui/index.ts +178 -0
  591. package/src/components/ui/input.tsx +471 -0
  592. package/src/components/ui/link-block.tsx +85 -0
  593. package/src/components/ui/list-detail.tsx +115 -0
  594. package/src/components/ui/listbox.ts +26 -0
  595. package/src/components/ui/mac-card.tsx +46 -0
  596. package/src/components/ui/month-picker.tsx +119 -0
  597. package/src/components/ui/multi-select.tsx +221 -0
  598. package/src/components/ui/nav-tree.tsx +92 -0
  599. package/src/components/ui/page.tsx +73 -0
  600. package/src/components/ui/pagination.tsx +143 -0
  601. package/src/components/ui/picker-panel.tsx +69 -0
  602. package/src/components/ui/popover.tsx +42 -0
  603. package/src/components/ui/progress.tsx +76 -0
  604. package/src/components/ui/property.tsx +33 -0
  605. package/src/components/ui/radio-group.tsx +61 -0
  606. package/src/components/ui/rating.tsx +122 -0
  607. package/src/components/ui/save-status.tsx +53 -0
  608. package/src/components/ui/segmented.tsx +74 -0
  609. package/src/components/ui/select-menu.tsx +54 -0
  610. package/src/components/ui/select.tsx +147 -0
  611. package/src/components/ui/selection-bar.tsx +50 -0
  612. package/src/components/ui/separator.tsx +30 -0
  613. package/src/components/ui/settings-layout.tsx +117 -0
  614. package/src/components/ui/share-link.tsx +66 -0
  615. package/src/components/ui/sheet.tsx +90 -0
  616. package/src/components/ui/sidebar.tsx +627 -0
  617. package/src/components/ui/skeleton.tsx +22 -0
  618. package/src/components/ui/spinner.tsx +28 -0
  619. package/src/components/ui/spotlight.tsx +222 -0
  620. package/src/components/ui/stat-tile.tsx +25 -0
  621. package/src/components/ui/step-dialog.tsx +104 -0
  622. package/src/components/ui/steps-layout.tsx +91 -0
  623. package/src/components/ui/switch.tsx +55 -0
  624. package/src/components/ui/table.tsx +99 -0
  625. package/src/components/ui/tabs.tsx +41 -0
  626. package/src/components/ui/theme-toggle.tsx +80 -0
  627. package/src/components/ui/time-list.tsx +106 -0
  628. package/src/components/ui/time-picker.tsx +344 -0
  629. package/src/components/ui/toast.tsx +132 -0
  630. package/src/components/ui/toggle.tsx +76 -0
  631. package/src/components/ui/tooltip.tsx +78 -0
  632. package/src/components/ui/top-bar.tsx +118 -0
  633. package/src/components/ui/typography.tsx +204 -0
  634. package/src/components/ui/video-block.tsx +66 -0
  635. package/src/hooks/use-dismiss.ts +24 -0
  636. package/src/hooks/use-escape-first.ts +25 -0
  637. package/src/hooks/use-media-query.ts +23 -0
  638. package/src/hooks/use-save-queue.ts +78 -0
  639. package/src/hooks/use-selection.ts +51 -0
  640. package/src/hooks/use-shared-transition.ts +40 -0
  641. package/src/hooks/use-upload-queue.ts +111 -0
  642. package/src/lib/accent.ts +11 -0
  643. package/src/lib/bento.ts +87 -0
  644. package/src/lib/database.ts +322 -0
  645. package/src/lib/dates.ts +75 -0
  646. package/src/lib/document.ts +55 -0
  647. package/src/lib/embed.ts +62 -0
  648. package/src/lib/files.ts +73 -0
  649. package/src/lib/justified.ts +106 -0
  650. package/src/lib/keys.ts +72 -0
  651. package/src/lib/number.ts +29 -0
  652. package/src/lib/pointer.ts +3 -0
  653. package/src/lib/prepare-image.ts +141 -0
  654. package/src/lib/rich-text-dom.ts +138 -0
  655. package/src/lib/rich-text.ts +50 -0
  656. package/src/lib/spotlight.ts +78 -0
  657. package/src/lib/theme.ts +18 -0
  658. package/src/lib/time.ts +83 -0
  659. package/src/lib/tree.ts +41 -0
  660. package/src/lib/utils.ts +25 -0
  661. package/src/styles/notion.css +817 -0
@@ -0,0 +1,82 @@
1
+ import { type VariantProps } from "class-variance-authority";
2
+ import { type ComponentProps, type ReactNode } from "react";
3
+ import { Button } from "./button.js";
4
+ type SidebarContextValue = {
5
+ /** "expanded" or "collapsed" on a wide screen. */
6
+ state: "expanded" | "collapsed";
7
+ open: boolean;
8
+ setOpen: (open: boolean) => void;
9
+ /** The drawer on a phone, apart from the column's state. */
10
+ openMobile: boolean;
11
+ setOpenMobile: (open: boolean) => void;
12
+ isMobile: boolean;
13
+ /** Opens or closes whichever applies at this width. */
14
+ toggleSidebar: () => void;
15
+ closeOnNavigate: boolean;
16
+ width?: string;
17
+ widthIcon?: string;
18
+ };
19
+ /** The sidebar's state, for any part of an app inside a SidebarProvider. */
20
+ export declare function useSidebar(): SidebarContextValue;
21
+ export declare function SidebarProvider({ defaultOpen, open: openProp, onOpenChange, storageKey, closeOnNavigate, width, widthIcon, className, style, children, ...props }: ComponentProps<"div"> & {
22
+ defaultOpen?: boolean;
23
+ open?: boolean;
24
+ onOpenChange?: (open: boolean) => void;
25
+ /** Where open or closed is remembered; `null` remembers nothing. */
26
+ storageKey?: string | null;
27
+ /** On a phone, close the drawer when an entry is chosen. */
28
+ closeOnNavigate?: boolean;
29
+ /** Overrides --sidebar-width (15rem in the stylesheet). */
30
+ width?: string;
31
+ /** Overrides --sidebar-width-icon (3rem). */
32
+ widthIcon?: string;
33
+ }): import("react").JSX.Element;
34
+ export declare function Sidebar({ side, variant, collapsible, label, className, children, ...props }: ComponentProps<"div"> & {
35
+ side?: "left" | "right";
36
+ variant?: "sidebar" | "floating" | "inset";
37
+ collapsible?: "offcanvas" | "icon" | "none";
38
+ /** Named for screen readers: the drawer's title and the landmark's label. */
39
+ label?: string;
40
+ }): import("react").JSX.Element;
41
+ export declare function SidebarTrigger({ className, onClick, ...props }: ComponentProps<typeof Button>): import("react").JSX.Element;
42
+ export declare function SidebarRail({ className, ...props }: ComponentProps<"button">): import("react").JSX.Element;
43
+ export declare function SidebarInset({ className, ...props }: ComponentProps<"main">): import("react").JSX.Element;
44
+ export declare function SidebarHeader({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
45
+ export declare function SidebarFooter({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
46
+ export declare function SidebarSeparator({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
47
+ export declare function SidebarContent({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
48
+ export declare function SidebarGroup({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
49
+ export declare function SidebarGroupLabel({ className, asChild, ...props }: ComponentProps<"div"> & {
50
+ asChild?: boolean;
51
+ }): import("react").JSX.Element;
52
+ export declare function SidebarGroupAction({ className, asChild, ...props }: ComponentProps<"button"> & {
53
+ asChild?: boolean;
54
+ }): import("react").JSX.Element;
55
+ export declare function SidebarGroupContent({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
56
+ export declare function SidebarMenu({ className, ...props }: ComponentProps<"ul">): import("react").JSX.Element;
57
+ export declare function SidebarMenuItem({ className, ...props }: ComponentProps<"li">): import("react").JSX.Element;
58
+ declare const menuButtonVariants: (props?: ({
59
+ size?: "md" | "sm" | "lg" | null | undefined;
60
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
61
+ export declare function SidebarMenuButton({ asChild, isActive, size, tooltip, className, onClick, ...props }: ComponentProps<"button"> & VariantProps<typeof menuButtonVariants> & {
62
+ asChild?: boolean;
63
+ isActive?: boolean;
64
+ tooltip?: ReactNode;
65
+ }): import("react").JSX.Element;
66
+ export declare function SidebarMenuAction({ asChild, showOnHover, className, ...props }: ComponentProps<"button"> & {
67
+ asChild?: boolean;
68
+ showOnHover?: boolean;
69
+ }): import("react").JSX.Element;
70
+ export declare function SidebarMenuBadge({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
71
+ export declare function SidebarMenuSkeleton({ showIcon, className, ...props }: ComponentProps<"div"> & {
72
+ showIcon?: boolean;
73
+ }): import("react").JSX.Element;
74
+ export declare function SidebarMenuSub({ className, ...props }: ComponentProps<"ul">): import("react").JSX.Element;
75
+ export declare function SidebarMenuSubItem({ className, ...props }: ComponentProps<"li">): import("react").JSX.Element;
76
+ export declare function SidebarMenuSubButton({ asChild, isActive, size, className, onClick, ...props }: ComponentProps<"a"> & {
77
+ asChild?: boolean;
78
+ isActive?: boolean;
79
+ size?: "sm" | "md";
80
+ }): import("react").JSX.Element;
81
+ export {};
82
+ //# sourceMappingURL=sidebar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../../src/components/ui/sidebar.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,EAOH,KAAK,cAAc,EAGnB,KAAK,SAAS,EACjB,MAAM,OAAO,CAAC;AAIf,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAStC,KAAK,mBAAmB,GAAG;IACvB,kDAAkD;IAClD,KAAK,EAAE,UAAU,GAAG,WAAW,CAAC;IAChC,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACjC,4DAA4D;IAC5D,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,QAAQ,EAAE,OAAO,CAAC;IAClB,uDAAuD;IACvD,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,eAAe,EAAE,OAAO,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAIF,4EAA4E;AAC5E,wBAAgB,UAAU,IAAI,mBAAmB,CAIhD;AAMD,wBAAgB,eAAe,CAAC,EAC5B,WAA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AAI,GAAG,IAAI,CAAA;CAAE,+BA0BrF"}
@@ -0,0 +1,258 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ /* The sidebar app: a navigation column beside the page. The structure, the options
4
+ and why are in docs/layouts/sidebar.md. The parts and their nesting follow
5
+ shadcn's sidebar so its blocks read across; the look, sizes and keys are the kit's. */
6
+ import * as DialogPrimitive from "@radix-ui/react-dialog";
7
+ import { Slot } from "@radix-ui/react-slot";
8
+ import { cva } from "class-variance-authority";
9
+ import { PanelLeft } from "lucide-react";
10
+ import { createContext, useCallback, useContext, useEffect, useMemo, useState, } from "react";
11
+ import { useIsPhone } from "../../hooks/use-media-query.js";
12
+ import { formatShortcut } from "../../lib/keys.js";
13
+ import { cn } from "../../lib/utils.js";
14
+ import { Button } from "./button.js";
15
+ import { TooltipContent, TooltipProvider, TooltipRoot, TooltipTrigger } from "./tooltip.js";
16
+ import { usePlatform } from "./typography.js";
17
+ import { matchShortcut } from "../../lib/keys.js";
18
+ import { DialogOverlay } from "./dialog.js";
19
+ // The same event AppShell answers, so toggleSidebar() works with either.
20
+ const TOGGLE_EVENT = "ui:toggle-sidebar";
21
+ const SidebarContext = createContext(null);
22
+ /** The sidebar's state, for any part of an app inside a SidebarProvider. */
23
+ export function useSidebar() {
24
+ const value = useContext(SidebarContext);
25
+ if (value === null)
26
+ throw new Error("useSidebar must be used inside SidebarProvider");
27
+ return value;
28
+ }
29
+ /* Holds the sidebar's state and the shortcut, and sets the width variables. Open
30
+ or closed is kept in localStorage under `storageKey` (read after the first render,
31
+ so a server-rendered page hydrates cleanly), or the app controls it with `open`
32
+ and `onOpenChange`. */
33
+ export function SidebarProvider({ defaultOpen = true, open: openProp, onOpenChange, storageKey = "sidebar", closeOnNavigate = true, width, widthIcon, className, style, children, ...props }) {
34
+ const isMobile = useIsPhone();
35
+ const [openMobile, setOpenMobile] = useState(false);
36
+ const [ownOpen, setOwnOpen] = useState(defaultOpen);
37
+ const open = openProp ?? ownOpen;
38
+ useEffect(() => {
39
+ if (storageKey === null || openProp !== undefined)
40
+ return;
41
+ try {
42
+ const stored = localStorage.getItem(storageKey);
43
+ if (stored === "open" || stored === "closed")
44
+ setOwnOpen(stored === "open");
45
+ }
46
+ catch {
47
+ // Private windows and blocked site data throw; the default stands.
48
+ }
49
+ }, [storageKey, openProp]);
50
+ const setOpen = useCallback((next) => {
51
+ if (openProp === undefined)
52
+ setOwnOpen(next);
53
+ onOpenChange?.(next);
54
+ if (storageKey === null)
55
+ return;
56
+ try {
57
+ localStorage.setItem(storageKey, next ? "open" : "closed");
58
+ }
59
+ catch {
60
+ // Remembering is a convenience.
61
+ }
62
+ }, [openProp, onOpenChange, storageKey]);
63
+ const toggleSidebar = useCallback(() => (isMobile ? setOpenMobile((o) => !o) : setOpen(!open)), [isMobile, open, setOpen]);
64
+ // A phone turned to landscape is a wide screen: the drawer has no business staying open.
65
+ useEffect(() => {
66
+ if (!isMobile)
67
+ setOpenMobile(false);
68
+ }, [isMobile]);
69
+ useEffect(() => {
70
+ const onKey = (e) => {
71
+ if (matchShortcut(e, "mod+\\")) {
72
+ e.preventDefault();
73
+ toggleSidebar();
74
+ }
75
+ };
76
+ window.addEventListener("keydown", onKey);
77
+ window.addEventListener(TOGGLE_EVENT, toggleSidebar);
78
+ return () => {
79
+ window.removeEventListener("keydown", onKey);
80
+ window.removeEventListener(TOGGLE_EVENT, toggleSidebar);
81
+ };
82
+ }, [toggleSidebar]);
83
+ const value = useMemo(() => ({
84
+ state: open ? "expanded" : "collapsed",
85
+ open,
86
+ setOpen,
87
+ openMobile,
88
+ setOpenMobile,
89
+ isMobile,
90
+ toggleSidebar,
91
+ closeOnNavigate,
92
+ width,
93
+ widthIcon,
94
+ }), [open, setOpen, openMobile, isMobile, toggleSidebar, closeOnNavigate, width, widthIcon]);
95
+ return (_jsx(SidebarContext.Provider, { value: value, children: _jsx(TooltipProvider, { delayDuration: 0, children: _jsx("div", { "data-slot": "sidebar-wrapper", style: { ...(width && { "--sidebar-width": width }), ...(widthIcon && { "--sidebar-width-icon": widthIcon }), ...style }, className: cn("group/sidebar-wrapper flex w-full min-h-dvh has-data-[variant=inset]:bg-surface-sunken", className), ...props, children: children }) }) }));
96
+ }
97
+ /* The column. On a phone it is a drawer from its side; on a wide screen a fixed
98
+ column, with a gap of the same width in the page's flow so the page sits beside
99
+ it. Its options are `collapsible`, `variant` and `side` (docs/layouts/sidebar.md). */
100
+ export function Sidebar({ side = "left", variant = "sidebar", collapsible = "offcanvas", label = "Sidebar", className, children, ...props }) {
101
+ const { isMobile, state, openMobile, setOpenMobile, width, widthIcon } = useSidebar();
102
+ // How much of the window the column takes, for overlays laid over the page that
103
+ // should leave it showing (ImageViewer, SelectionBar).
104
+ useEffect(() => {
105
+ const full = width ?? "var(--sidebar-width)";
106
+ const narrow = widthIcon ?? "var(--sidebar-width-icon)";
107
+ const taken = isMobile ? "0px" : collapsible === "none" || state === "expanded" ? full : collapsible === "icon" ? narrow : "0px";
108
+ document.documentElement.style.setProperty("--sidebar-w", taken);
109
+ return () => void document.documentElement.style.removeProperty("--sidebar-w");
110
+ }, [isMobile, state, collapsible, width, widthIcon]);
111
+ if (collapsible === "none") {
112
+ return (_jsx("div", { "data-slot": "sidebar", className: cn("flex flex-col bg-surface-sunken w-(--sidebar-width) h-dvh text-ink shrink-0", className), ...props, children: children }));
113
+ }
114
+ if (isMobile) {
115
+ return (_jsx(DialogPrimitive.Root, { open: openMobile, onOpenChange: setOpenMobile, children: _jsxs(DialogPrimitive.Portal, { children: [_jsx(DialogOverlay, {}), _jsxs(DialogPrimitive.Content, { "data-slot": "sidebar", "data-mobile": "true", "aria-describedby": undefined,
116
+ // In a portal, outside the wrapper that sets the width.
117
+ style: { "--drawer-from": side === "left" ? "-100%" : "100%", ...(width && { "--sidebar-width": width }) }, className: cn("group/sidebar z-(--z-overlay) fixed inset-y-0 flex flex-col bg-surface-sunken shadow-dialog w-(--sidebar-width) max-w-[85vw] text-ink outline-none", "pb-[env(safe-area-inset-bottom)] data-[state=closed]:animate-drawer-out data-[state=open]:animate-drawer-in", side === "left" ? "left-0" : "right-0"), ...props, children: [_jsx(DialogPrimitive.Title, { className: "sr-only", children: label }), _jsx("div", { className: cn("flex flex-col w-full h-full", className), children: children })] })] }) }));
118
+ }
119
+ return (_jsxs("div", { "data-slot": "sidebar", "data-state": state, "data-collapsible": state === "collapsed" ? collapsible : "", "data-variant": variant, "data-side": side, className: "group/sidebar peer/sidebar hidden md:block text-ink", children: [_jsx("div", { className: cn("relative bg-transparent w-(--sidebar-width) transition-[width] duration-(--duration-slow) ease-out-notion motion-reduce:transition-none", "group-data-[collapsible=offcanvas]/sidebar:w-0", variant === "sidebar"
120
+ ? "group-data-[collapsible=icon]/sidebar:w-(--sidebar-width-icon)"
121
+ : "group-data-[collapsible=icon]/sidebar:w-[calc(var(--sidebar-width-icon)+1rem)]") }), _jsx("div", { className: cn("hidden md:flex z-(--z-raised) fixed inset-y-0 w-(--sidebar-width) h-dvh transition-[left,right,width] duration-(--duration-slow) ease-out-notion motion-reduce:transition-none", side === "left"
122
+ ? "left-0 group-data-[collapsible=offcanvas]/sidebar:left-[calc(var(--sidebar-width)*-1)]"
123
+ : "right-0 group-data-[collapsible=offcanvas]/sidebar:right-[calc(var(--sidebar-width)*-1)]", variant === "sidebar"
124
+ ? cn("group-data-[collapsible=icon]/sidebar:w-(--sidebar-width-icon)", side === "left" ? "shadow-edge-r" : "shadow-edge-l")
125
+ : "p-2 group-data-[collapsible=icon]/sidebar:w-[calc(var(--sidebar-width-icon)+1rem+2px)]", className), ...props, children: _jsx("nav", { "aria-label": label, "data-sidebar": "sidebar", className: cn("flex flex-col w-full h-full", variant === "floating" ? "bg-surface-overlay rounded-overlay shadow-popover" : "bg-surface-sunken"), children: children }) })] }));
126
+ }
127
+ /* The button that opens and closes the sidebar, for the page's top bar. */
128
+ export function SidebarTrigger({ className, onClick, ...props }) {
129
+ const { toggleSidebar, isMobile, state } = useSidebar();
130
+ const on = usePlatform();
131
+ const expanded = isMobile ? undefined : state === "expanded";
132
+ return (_jsxs(TooltipRoot, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(Button, { "data-sidebar": "trigger", variant: "ghost", size: "icon-sm", "aria-label": expanded ? "Close sidebar" : "Open sidebar", "aria-expanded": expanded, className: cn("text-ink-secondary", className), onClick: (e) => {
133
+ onClick?.(e);
134
+ toggleSidebar();
135
+ }, ...props, children: _jsx(PanelLeft, {}) }) }), _jsxs(TooltipContent, { side: "bottom", children: [expanded ? "Close sidebar" : "Open sidebar", _jsx("span", { className: "ml-1.5 text-ink-tertiary", children: formatShortcut("mod+\\", on) })] })] }));
136
+ }
137
+ /* A thin strip along the column's inner edge: hovering shows a line, a click toggles. */
138
+ export function SidebarRail({ className, ...props }) {
139
+ const { toggleSidebar } = useSidebar();
140
+ return (_jsx("button", { type: "button", "data-sidebar": "rail", "aria-label": "Toggle sidebar", tabIndex: -1, onClick: toggleSidebar, title: "Toggle sidebar", className: cn("hidden sm:flex z-20 absolute inset-y-0 w-3 transition-colors -translate-x-1/2", "after:absolute after:inset-y-0 after:left-1/2 after:w-0.5 hover:after:bg-hairline-strong", "group-data-[side=left]/sidebar:-right-3 group-data-[side=right]/sidebar:left-0", "group-data-[side=left]/sidebar:cursor-w-resize group-data-[side=right]/sidebar:cursor-e-resize", "group-data-[collapsible=offcanvas]/sidebar:translate-x-0 group-data-[collapsible=offcanvas]/sidebar:after:left-full", "group-data-[side=left]/sidebar:group-data-[collapsible=offcanvas]/sidebar:-right-2", className), ...props }));
141
+ }
142
+ /* The page beside the sidebar. The window scrolls; this is a container, so content
143
+ can size itself to the room it has (`@4xl:`), sidebar open or shut. With the
144
+ `inset` variant it is a raised card inside the sidebar's colour. */
145
+ export function SidebarInset({ className, ...props }) {
146
+ return (_jsx("main", { "data-slot": "sidebar-inset", className: cn("@container relative flex flex-col flex-1 bg-surface w-full min-w-0 min-h-dvh", "md:peer-data-[variant=inset]/sidebar:m-2 md:peer-data-[variant=inset]/sidebar:ml-0 md:peer-data-[variant=inset]/sidebar:min-h-[calc(100dvh-1rem)]", "md:peer-data-[variant=inset]/sidebar:rounded-overlay md:peer-data-[variant=inset]/sidebar:shadow-sm", "md:peer-data-[variant=inset]/sidebar:peer-data-[state=collapsed]/sidebar:ml-2", className), ...props }));
147
+ }
148
+ /* The column's top: the app's name or a workspace switcher, search. 2.75rem tall at
149
+ least, the height of the page's top bar, so the two line up. */
150
+ export function SidebarHeader({ className, ...props }) {
151
+ return _jsx("div", { "data-sidebar": "header", className: cn("flex flex-col justify-center gap-0.5 p-2 min-h-11", className), ...props });
152
+ }
153
+ /* The column's foot: the account, settings, the theme. */
154
+ export function SidebarFooter({ className, ...props }) {
155
+ return _jsx("div", { "data-sidebar": "footer", className: cn("flex flex-col gap-0.5 p-2", className), ...props });
156
+ }
157
+ export function SidebarSeparator({ className, ...props }) {
158
+ return _jsx("div", { role: "separator", "data-sidebar": "separator", className: cn("bg-hairline mx-2 h-px shrink-0", className), ...props });
159
+ }
160
+ /* The scrolling middle. Its scroll is its own; the page's is the window's. */
161
+ export function SidebarContent({ className, ...props }) {
162
+ return (_jsx("div", { "data-sidebar": "content", className: cn("flex flex-col flex-1 gap-1 min-h-0 overflow-y-auto overscroll-contain", "group-data-[collapsible=icon]/sidebar:overflow-hidden", className), ...props }));
163
+ }
164
+ /* One labelled set of entries. */
165
+ export function SidebarGroup({ className, ...props }) {
166
+ return _jsx("div", { "data-sidebar": "group", className: cn("relative flex flex-col px-2 py-1 w-full min-w-0", className), ...props });
167
+ }
168
+ export function SidebarGroupLabel({ className, asChild = false, ...props }) {
169
+ const Comp = asChild ? Slot : "div";
170
+ return (_jsx(Comp, { "data-sidebar": "group-label", className: cn("flex items-center px-2 rounded-control h-control-sm font-medium text-caption text-ink-tertiary shrink-0", "transition-[margin,opacity] duration-(--duration-slow) ease-out-notion", "group-data-[collapsible=icon]/sidebar:-mt-(--spacing-control-sm) group-data-[collapsible=icon]/sidebar:opacity-0", "[&>svg]:size-4 [&>svg]:shrink-0", className), ...props }));
171
+ }
172
+ /* A button on the group label's row ("New page"). Name it with aria-label. */
173
+ export function SidebarGroupAction({ className, asChild = false, ...props }) {
174
+ const Comp = asChild ? Slot : "button";
175
+ return (_jsx(Comp, { "data-sidebar": "group-action", className: cn("top-2 right-3 absolute flex justify-center items-center rounded-small size-5 text-ink-tertiary", "hover:bg-tint-active hover:text-ink transition-colors duration-(--duration-instant) [&>svg]:size-4 [&>svg]:shrink-0",
176
+ // A bigger target on a touch screen.
177
+ "after:absolute after:-inset-2 md:after:hidden", "group-data-[collapsible=icon]/sidebar:hidden", className), ...props }));
178
+ }
179
+ export function SidebarGroupContent({ className, ...props }) {
180
+ return _jsx("div", { "data-sidebar": "group-content", className: cn("w-full text-sm", className), ...props });
181
+ }
182
+ export function SidebarMenu({ className, ...props }) {
183
+ return _jsx("ul", { "data-sidebar": "menu", className: cn("flex flex-col gap-px w-full min-w-0", className), ...props });
184
+ }
185
+ export function SidebarMenuItem({ className, ...props }) {
186
+ return _jsx("li", { "data-sidebar": "menu-item", className: cn("group/menu-item relative", className), ...props });
187
+ }
188
+ const menuButtonVariants = cva([
189
+ "peer/menu-button flex items-center gap-2 px-2 rounded-control w-full overflow-hidden text-ink-secondary text-left",
190
+ "transition-[color,background-color,width,height,padding] duration-(--duration-instant) outline-none",
191
+ "hover:bg-tint-hover hover:text-ink active:bg-tint-active",
192
+ "disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50",
193
+ "data-[active=true]:bg-tint-active data-[active=true]:font-medium data-[active=true]:text-ink",
194
+ "data-[state=open]:hover:bg-tint-hover",
195
+ "[&>svg]:size-4 [&>svg]:shrink-0 [&>span:last-child]:truncate",
196
+ // Room for an action or a badge at the end of the row.
197
+ "group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-has-data-[sidebar=menu-badge]/menu-item:pr-8",
198
+ // Narrowed to its icon.
199
+ "group-data-[collapsible=icon]/sidebar:size-control-md! group-data-[collapsible=icon]/sidebar:p-2!",
200
+ ], {
201
+ variants: {
202
+ size: {
203
+ sm: "h-6 text-caption",
204
+ md: "h-control-sm text-sm",
205
+ // Two lines: a workspace switcher, an account.
206
+ lg: "h-12 text-sm group-data-[collapsible=icon]/sidebar:p-0!",
207
+ },
208
+ },
209
+ defaultVariants: { size: "md" },
210
+ });
211
+ /* An entry. Put the app's link inside with `asChild`. When the column is narrowed
212
+ to its icons, `tooltip` (its name, usually) is shown beside it on hover. */
213
+ export function SidebarMenuButton({ asChild = false, isActive = false, size, tooltip, className, onClick, ...props }) {
214
+ const { isMobile, state, setOpenMobile, closeOnNavigate } = useSidebar();
215
+ const Comp = asChild ? Slot : "button";
216
+ const button = (_jsx(Comp, { "data-sidebar": "menu-button", "data-size": size ?? "md", "data-active": isActive, "aria-current": isActive ? "page" : undefined, className: cn(menuButtonVariants({ size }), className), onClick: (e) => {
217
+ onClick?.(e);
218
+ if (isMobile && closeOnNavigate && !e.defaultPrevented)
219
+ setOpenMobile(false);
220
+ }, ...props }));
221
+ if (tooltip === undefined)
222
+ return button;
223
+ return (_jsxs(TooltipRoot, { children: [_jsx(TooltipTrigger, { asChild: true, children: button }), _jsx(TooltipContent, { side: "right", align: "center", hidden: state !== "collapsed" || isMobile, children: tooltip })] }));
224
+ }
225
+ /* A button at the end of an entry's row (⋯, +). With `showOnHover` it appears when
226
+ the row is hovered or holds focus, and always where there is no hover to give. */
227
+ export function SidebarMenuAction({ asChild = false, showOnHover = false, className, ...props }) {
228
+ const Comp = asChild ? Slot : "button";
229
+ return (_jsx(Comp, { "data-sidebar": "menu-action", className: cn("top-1 right-1 absolute flex justify-center items-center rounded-small size-5 text-ink-tertiary", "hover:bg-tint-active hover:text-ink transition-[color,background-color,opacity] duration-(--duration-instant) [&>svg]:size-4 [&>svg]:shrink-0", "after:absolute after:-inset-2 md:after:hidden", "peer-data-[size=sm]/menu-button:top-0.5 peer-data-[size=lg]/menu-button:top-3.5", "group-data-[collapsible=icon]/sidebar:hidden", showOnHover &&
230
+ "[@media(hover:hover)]:opacity-0 group-hover/menu-item:opacity-100 group-focus-within/menu-item:opacity-100 data-[state=open]:opacity-100", className), ...props }));
231
+ }
232
+ /* A count at the end of an entry's row. */
233
+ export function SidebarMenuBadge({ className, ...props }) {
234
+ return (_jsx("div", { "data-sidebar": "menu-badge", className: cn("top-1 right-1 absolute flex justify-center items-center px-1 rounded-small min-w-5 h-5", "font-medium tabular-nums text-caption text-ink-tertiary pointer-events-none select-none", "peer-data-[active=true]/menu-button:text-ink-secondary", "group-data-[collapsible=icon]/sidebar:hidden", className), ...props }));
235
+ }
236
+ /* Stands in for an entry still loading. */
237
+ export function SidebarMenuSkeleton({ showIcon = false, className, ...props }) {
238
+ // A width that differs per row but not per render.
239
+ const [width] = useState(() => `${50 + Math.floor(Math.random() * 40)}%`);
240
+ return (_jsxs("div", { "data-sidebar": "menu-skeleton", className: cn("flex items-center gap-2 px-2 rounded-control h-control-sm", className), ...props, children: [showIcon && _jsx("div", { className: "bg-tint-active rounded-small size-4 animate-pulse motion-reduce:animate-none" }), _jsx("div", { className: "flex-1 bg-tint-active rounded-small h-3.5 animate-pulse motion-reduce:animate-none", style: { maxWidth: width } })] }));
241
+ }
242
+ /* Entries inside an entry, set in under it with a hairline. */
243
+ export function SidebarMenuSub({ className, ...props }) {
244
+ return (_jsx("ul", { "data-sidebar": "menu-sub", className: cn("flex flex-col gap-px ml-3.5 py-0.5 pl-2 border-hairline border-l min-w-0", "group-data-[collapsible=icon]/sidebar:hidden", className), ...props }));
245
+ }
246
+ export function SidebarMenuSubItem({ className, ...props }) {
247
+ return _jsx("li", { "data-sidebar": "menu-sub-item", className: cn("group/menu-sub-item relative", className), ...props });
248
+ }
249
+ export function SidebarMenuSubButton({ asChild = false, isActive = false, size = "md", className, onClick, ...props }) {
250
+ const { isMobile, setOpenMobile, closeOnNavigate } = useSidebar();
251
+ const Comp = asChild ? Slot : "a";
252
+ return (_jsx(Comp, { "data-sidebar": "menu-sub-button", "data-size": size, "data-active": isActive, "aria-current": isActive ? "page" : undefined, className: cn("flex items-center gap-2 px-2 rounded-control min-w-0 overflow-hidden text-ink-secondary outline-none", "hover:bg-tint-hover hover:text-ink active:bg-tint-active transition-colors duration-(--duration-instant)", "aria-disabled:pointer-events-none aria-disabled:opacity-50", "data-[active=true]:bg-tint-active data-[active=true]:font-medium data-[active=true]:text-ink", "[&>svg]:size-4 [&>svg]:shrink-0 [&>span:last-child]:truncate", size === "sm" ? "h-6 text-caption" : "h-control-sm text-sm", "group-data-[collapsible=icon]/sidebar:hidden", className), onClick: (e) => {
253
+ onClick?.(e);
254
+ if (isMobile && closeOnNavigate && !e.defaultPrevented)
255
+ setOpenMobile(false);
256
+ }, ...props }));
257
+ }
258
+ //# sourceMappingURL=sidebar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sidebar.js","sourceRoot":"","sources":["../../../src/components/ui/sidebar.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb;;yFAEyF;AAEzF,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EACH,aAAa,EACb,WAAW,EACX,UAAU,EACV,SAAS,EACT,OAAO,EACP,QAAQ,GAKX,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAc,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,cAAe,CAAC;AAC7F,OAAO,EAA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AAC;AACpH,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,EACjC,OAAO,GAAG,KAAK,EACf,QAAQ,GAAG,KAAK,EAChB,IAAI,GAAG,IAAI,EACX,SAAS,EACT,OAAO,EACP,GAAG,KAAK,EAC0E;IAClF,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,eAAe,EAAE,GAAG,UAAU,EAAE,CAAC;IAClE,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC;IAClC,OAAO,CACH,KAAC,IAAI,oBACY,iBAAiB,eACnB,IAAI,iBACF,QAAQ,kBACP,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,EAC3C,SAAS,EAAE,EAAE,CACT,sGAAsG,EACtG,0GAA0G,EAC1G,4DAA4D,EAC5D,8FAA8F,EAC9F,8DAA8D,EAC9D,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,sBAAsB,EAC3D,8CAA8C,EAC9C,SAAS,CACZ,EACD,OAAO,EAAE,CAAC,CAAgC,EAAE,EAAE;YAC1C,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;YACb,IAAI,QAAQ,IAAI,eAAe,IAAI,CAAC,CAAC,CAAC,gBAAgB;gBAAE,aAAa,CAAC,KAAK,CAAC,CAAC;QACjF,CAAC,KACG,KAAK,GACX,CACL,CAAC;AACN,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { ComponentProps } from "react";
2
+ export declare function Skeleton({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
3
+ export declare function SkeletonText({ lines, size, className }: {
4
+ lines?: number;
5
+ size?: "sm" | "body";
6
+ className?: string;
7
+ }): import("react").JSX.Element;
8
+ //# sourceMappingURL=skeleton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skeleton.d.ts","sourceRoot":"","sources":["../../../src/components/ui/skeleton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAO5C,wBAAgB,QAAQ,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,CAAC,KAAK,CAAC,+BAEtE;AAID,wBAAgB,YAAY,CAAC,EAAE,KAAS,EAAE,IAAa,EAAE,SAAS,EAAE,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,+BAQjI"}
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn } from "../../lib/utils.js";
3
+ /* A stand-in for something still loading, the shape of what will come so nothing
4
+ jumps when it does. A soft pulse in the ink's tint; still under reduced motion.
5
+ Hidden from assistive technology: mark the region that is loading with
6
+ aria-busy="true" instead, and say "Loading" once if it takes a while. */
7
+ export function Skeleton({ className, ...props }) {
8
+ return _jsx("div", { "aria-hidden": true, className: cn("bg-tint-active rounded-small animate-pulse motion-reduce:animate-none", className), ...props });
9
+ }
10
+ /* Lines of text still loading: full width, the last one shorter, at the line
11
+ height of `size`. */
12
+ export function SkeletonText({ lines = 3, size = "body", className }) {
13
+ return (_jsx("div", { "aria-hidden": true, className: cn("flex flex-col", size === "sm" ? "gap-2" : "gap-2.5", className), children: Array.from({ length: lines }, (_, i) => (_jsx(Skeleton, { className: cn(size === "sm" ? "h-3" : "h-3.5", i === lines - 1 && lines > 1 ? "w-3/5" : "w-full") }, i))) }));
14
+ }
15
+ //# sourceMappingURL=skeleton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skeleton.js","sourceRoot":"","sources":["../../../src/components/ui/skeleton.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAExC;;;2EAG2E;AAC3E,MAAM,UAAU,QAAQ,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAyB;IACnE,OAAO,mCAAiB,SAAS,EAAE,EAAE,CAAC,uEAAuE,EAAE,SAAS,CAAC,KAAM,KAAK,GAAI,CAAC;AAC7I,CAAC;AAED;uBACuB;AACvB,MAAM,UAAU,YAAY,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,IAAI,GAAG,MAAM,EAAE,SAAS,EAAgE;IAC9H,OAAO,CACH,mCAAiB,SAAS,EAAE,EAAE,CAAC,eAAe,EAAE,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EAAE,SAAS,CAAC,YAC1F,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CACrC,KAAC,QAAQ,IAAS,SAAS,EAAE,EAAE,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,KAAK,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,IAApG,CAAC,CAAuG,CAC1H,CAAC,GACA,CACT,CAAC;AACN,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { ComponentProps } from "react";
2
+ declare const SIZES: {
3
+ readonly sm: "size-3.5";
4
+ readonly md: "size-4";
5
+ readonly lg: "size-5";
6
+ };
7
+ export declare function Spinner({ label, size, className, ...props }: ComponentProps<"svg"> & {
8
+ label?: string;
9
+ size?: keyof typeof SIZES;
10
+ }): import("react").JSX.Element;
11
+ export {};
12
+ //# sourceMappingURL=spinner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spinner.d.ts","sourceRoot":"","sources":["../../../src/components/ui/spinner.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAU5C,QAAA,MAAM,KAAK;;;;CAA0D,CAAC;AAEtE,wBAAgB,OAAO,CAAC,EAAE,KAAK,EAAE,IAAW,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,CAAC,KAAK,CAAC,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,OAAO,KAAK,CAAA;CAAE,+BAezI"}
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cn } from "../../lib/utils.js";
3
+ /* Something is happening and will finish soon. A ring three quarters drawn, in the
4
+ ink of whatever it sits in (currentColor), turning. Sized like an icon: size-3.5,
5
+ size-4 (default) or size-5. Under reduced motion it stands still, which still
6
+ reads as "busy" beside a word like "Saving".
7
+
8
+ Named for assistive technology with `label` when it stands alone; inside a
9
+ button that already says what is happening, it is hidden from them. */
10
+ const SIZES = { sm: "size-3.5", md: "size-4", lg: "size-5" };
11
+ export function Spinner({ label, size = "md", className, ...props }) {
12
+ return (_jsxs("svg", { viewBox: "0 0 16 16", fill: "none", role: label ? "status" : undefined, "aria-label": label, "aria-hidden": label ? undefined : true, className: cn(SIZES[size], "animate-spin motion-reduce:animate-none shrink-0", className), ...props, children: [_jsx("circle", { cx: "8", cy: "8", r: "6.25", stroke: "currentColor", strokeOpacity: "0.25", strokeWidth: "1.5" }), _jsx("path", { d: "M8 1.75a6.25 6.25 0 0 1 6.25 6.25", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })] }));
13
+ }
14
+ //# sourceMappingURL=spinner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spinner.js","sourceRoot":"","sources":["../../../src/components/ui/spinner.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAExC;;;;;;yEAMyE;AACzE,MAAM,KAAK,GAAG,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAW,CAAC;AAEtE,MAAM,UAAU,OAAO,CAAC,EAAE,KAAK,EAAE,IAAI,GAAG,IAAI,EAAE,SAAS,EAAE,GAAG,KAAK,EAAyE;IACtI,OAAO,CACH,eACI,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,gBACtB,KAAK,iBACJ,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,EACrC,SAAS,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,kDAAkD,EAAE,SAAS,CAAC,KACrF,KAAK,aAET,iBAAQ,EAAE,EAAC,GAAG,EAAC,EAAE,EAAC,GAAG,EAAC,CAAC,EAAC,MAAM,EAAC,MAAM,EAAC,cAAc,EAAC,aAAa,EAAC,MAAM,EAAC,WAAW,EAAC,KAAK,GAAG,EAC9F,eAAM,CAAC,EAAC,mCAAmC,EAAC,MAAM,EAAC,cAAc,EAAC,WAAW,EAAC,KAAK,EAAC,aAAa,EAAC,OAAO,GAAG,IAC1G,CACT,CAAC;AACN,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { type LucideIcon } from "lucide-react";
2
+ import { type ReactNode } from "react";
3
+ import { type SpotlightEntry } from "../../lib/spotlight.js";
4
+ export type SpotlightItem = SpotlightEntry & {
5
+ icon?: LucideIcon;
6
+ };
7
+ /**
8
+ * ⌘K (Ctrl+K elsewhere) from anywhere on the page calls `toggle`. Kept apart from
9
+ * the Spotlight so the owner decides what the shortcut opens and when.
10
+ */
11
+ export declare function useSpotlightShortcut(toggle: () => void): void;
12
+ export declare function Spotlight({ open, onOpenChange, items, onPick, placeholder, empty, title, }: {
13
+ open: boolean;
14
+ onOpenChange: (open: boolean) => void;
15
+ items: SpotlightItem[];
16
+ onPick: (item: SpotlightItem) => void;
17
+ placeholder?: string;
18
+ /** Shown in place of results when nothing matches. */
19
+ empty?: ReactNode;
20
+ /** Read out to assistive technology; not shown. */
21
+ title?: string;
22
+ }): import("react").JSX.Element;
23
+ //# sourceMappingURL=spotlight.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spotlight.d.ts","sourceRoot":"","sources":["../../../src/components/ui/spotlight.tsx"],"names":[],"mappings":"AAGA,OAAO,EAA0B,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,EAAyD,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAC9F,OAAO,EAAe,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAQ1E,MAAM,MAAM,aAAa,GAAG,cAAc,GAAG;IAAE,IAAI,CAAC,EAAE,UAAU,CAAA;CAAE,CAAC;AAGnE;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,IAAI,GAAG,IAAI,CAa7D;AAmCD,wBAAgB,SAAS,CAAC,EACtB,IAAI,EACJ,YAAY,EACZ,KAAK,EACL,MAAM,EACN,WAAuB,EACvB,KAAyB,EACzB,KAAe,GAClB,EAAE;IACC,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,MAAM,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sDAAsD;IACtD,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,mDAAmD;IACnD,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB,+BAuIA"}
@@ -0,0 +1,110 @@
1
+ "use client";
2
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import * as DialogPrimitive from "@radix-ui/react-dialog";
4
+ import { CornerDownLeft, Search } from "lucide-react";
5
+ import { Fragment, useEffect, useId, useMemo, useRef, useState } from "react";
6
+ import { rankEntries } from "../../lib/spotlight.js";
7
+ import { cn } from "../../lib/utils.js";
8
+ import { Shortcut } from "./typography.js";
9
+ import { matchShortcut } from "../../lib/keys.js";
10
+ import { EmptyState } from "./empty-state.js";
11
+ import { DialogOverlay } from "./dialog.js";
12
+ import { optionClasses } from "./listbox.js";
13
+ /**
14
+ * ⌘K (Ctrl+K elsewhere) from anywhere on the page calls `toggle`. Kept apart from
15
+ * the Spotlight so the owner decides what the shortcut opens and when.
16
+ */
17
+ export function useSpotlightShortcut(toggle) {
18
+ const latest = useRef(toggle);
19
+ latest.current = toggle;
20
+ useEffect(() => {
21
+ const onKey = (e) => {
22
+ if (matchShortcut(e, "mod+k")) {
23
+ e.preventDefault();
24
+ latest.current();
25
+ }
26
+ };
27
+ window.addEventListener("keydown", onKey);
28
+ return () => window.removeEventListener("keydown", onKey);
29
+ }, []);
30
+ }
31
+ /** The label with the typed letters picked out. */
32
+ function Marked({ text, hits }) {
33
+ if (hits.length === 0)
34
+ return _jsx(_Fragment, { children: text });
35
+ const at = new Set(hits);
36
+ const runs = [];
37
+ for (let i = 0; i < text.length; i++) {
38
+ const hit = at.has(i);
39
+ const last = runs.at(-1);
40
+ if (last && last.hit === hit)
41
+ last.text += text[i];
42
+ else
43
+ runs.push({ text: text[i], hit });
44
+ }
45
+ return (_jsx(_Fragment, { children: runs.map((run, i) => run.hit ? (_jsx("mark", { className: "bg-transparent font-semibold text-ink underline decoration-accent/50 underline-offset-2", children: run.text }, i)) : (_jsx(Fragment, { children: run.text }, i))) }));
46
+ }
47
+ /* Jump anywhere by typing: a search field over every place the owner lists, best
48
+ match first. The keyboard never leaves the field — the arrows move the highlight,
49
+ Enter goes, Escape closes — so a page is a few keystrokes away.
50
+
51
+ With nothing typed it lists the entries as given, under their groups, so the
52
+ owner decides what is offered first (the current page's neighbours, say). Once
53
+ something is typed it is one ranked list, each entry's group shown beside it. */
54
+ export function Spotlight({ open, onOpenChange, items, onPick, placeholder = "Search…", empty = "Nothing matches", title = "Go to", }) {
55
+ const [query, setQuery] = useState("");
56
+ const [index, setIndex] = useState(0);
57
+ const list = useRef(null);
58
+ const id = useId();
59
+ // Every opening starts afresh: reset while closing, so the first frame of the
60
+ // next opening never shows last time's search.
61
+ useEffect(() => {
62
+ if (open)
63
+ return;
64
+ setQuery("");
65
+ setIndex(0);
66
+ }, [open]);
67
+ const results = useMemo(() => rankEntries(items, query), [items, query]);
68
+ const browsing = query.trim() === "";
69
+ const active = Math.min(index, Math.max(results.length - 1, 0));
70
+ // The keyboard moves the highlight, so the list follows it out of view.
71
+ useEffect(() => {
72
+ list.current?.querySelector('[aria-selected="true"]')?.scrollIntoView({ block: "nearest" });
73
+ }, [active, open]);
74
+ const pick = (item) => {
75
+ if (item === undefined)
76
+ return;
77
+ onOpenChange(false);
78
+ onPick(item);
79
+ };
80
+ const move = (by) => {
81
+ if (results.length === 0)
82
+ return;
83
+ setIndex((active + by + results.length) % results.length);
84
+ };
85
+ return (_jsx(DialogPrimitive.Root, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogPrimitive.Portal, { children: [_jsx(DialogOverlay, {}), _jsxs(DialogPrimitive.Content, { "aria-describedby": undefined, className: cn("z-(--z-overlay) fixed top-[12dvh] left-1/2 -translate-x-1/2 flex flex-col", "w-[calc(100vw-2rem)] max-w-xl max-h-[min(30rem,76dvh)] overflow-hidden outline-none", "bg-surface-overlay shadow-dialog rounded-overlay", "data-[state=open]:animate-scale-in data-[state=closed]:animate-scale-out"), children: [_jsx(DialogPrimitive.Title, { className: "sr-only", children: title }), _jsxs("div", { className: "flex items-center gap-2.5 shadow-edge-b px-4 h-12 shrink-0", children: [_jsx(Search, { className: "size-4 text-ink-tertiary shrink-0" }), _jsx("input", { autoFocus: true, role: "combobox", "aria-expanded": true, "aria-controls": `${id}-list`, "aria-activedescendant": results.length > 0 ? `${id}-${active}` : undefined, "aria-autocomplete": "list", value: query, placeholder: placeholder, onChange: (e) => {
86
+ setQuery(e.target.value);
87
+ setIndex(0);
88
+ }, onKeyDown: (e) => {
89
+ const ctrl = e.ctrlKey && !e.metaKey;
90
+ if (e.key === "ArrowDown" || (ctrl && e.key === "n")) {
91
+ e.preventDefault();
92
+ move(1);
93
+ }
94
+ else if (e.key === "ArrowUp" || (ctrl && e.key === "p")) {
95
+ e.preventDefault();
96
+ move(-1);
97
+ }
98
+ else if (e.key === "Enter" && !e.nativeEvent.isComposing) {
99
+ e.preventDefault();
100
+ pick(results[active]?.item);
101
+ }
102
+ }, className: "flex-1 bg-transparent min-w-0 text-ink placeholder:text-ink-tertiary outline-none" })] }), _jsxs("div", { ref: list, id: `${id}-list`, role: "listbox", "aria-label": title, className: "flex-1 p-1.5 min-h-0 overflow-y-auto overscroll-contain", children: [results.length === 0 && _jsx(EmptyState, { compact: true, title: empty }), results.map(({ item, hits }, i) => {
103
+ const heading = browsing && item.group !== undefined && item.group !== results[i - 1]?.item.group;
104
+ const Icon = item.icon;
105
+ return (_jsxs(Fragment, { children: [heading && _jsx("div", { className: "px-2 pt-2.5 pb-1 font-medium text-caption text-ink-tertiary first:pt-1", children: item.group }), _jsxs("div", { id: `${id}-${i}`, role: "option", "aria-selected": i === active, "data-active": i === active,
106
+ // Movement, not entry: a list scrolled under a still pointer keeps the keyboard's pick.
107
+ onPointerMove: () => i !== active && setIndex(i), onClick: () => pick(item), className: cn(optionClasses, "gap-2.5 h-control-md"), children: [Icon && _jsx(Icon, { className: "size-4 text-ink-secondary shrink-0" }), _jsx("span", { className: "min-w-0 text-ink truncate", children: _jsx(Marked, { text: item.label, hits: hits }) }), (item.hint ?? (!browsing ? item.group : undefined)) && (_jsx("span", { className: "min-w-0 text-ink-tertiary truncate", children: item.hint ?? item.group })), i === active && _jsx(CornerDownLeft, { className: "ml-auto size-3.5 text-ink-tertiary shrink-0" })] })] }, item.key));
108
+ })] }), _jsxs("div", { className: "max-sm:hidden flex items-center gap-4 shadow-edge-t px-4 h-9 text-caption text-ink-tertiary shrink-0", children: [_jsxs("span", { className: "flex items-center gap-1", children: [_jsx(Shortcut, { keys: "up" }), _jsx(Shortcut, { keys: "down" }), "to move"] }), _jsxs("span", { className: "flex items-center gap-1", children: [_jsx(Shortcut, { keys: "enter" }), "to open"] }), _jsxs("span", { className: "flex items-center gap-1", children: [_jsx(Shortcut, { keys: "escape" }), "to close"] }), _jsxs("span", { className: "flex items-center gap-1 ml-auto", children: [_jsx(Shortcut, { keys: "mod+k" }), "anywhere"] })] })] })] }) }));
109
+ }
110
+ //# sourceMappingURL=spotlight.js.map