@krizaka/ui 3.73.0 → 3.75.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 (369) hide show
  1. package/README.md +4 -10
  2. package/dist/{RotatingWord-COSabR2c.d.ts → RotatingWord-D3tpDLE4.d.ts} +1 -1
  3. package/dist/account-menu.d.ts +1 -1
  4. package/dist/account-menu.js +1 -1
  5. package/dist/account-settings.d.ts +1 -1
  6. package/dist/account-settings.js +1 -1
  7. package/dist/app-frame.d.ts +2 -5
  8. package/dist/avatar/defaults.d.ts +2 -2
  9. package/dist/avatar/defaults.js +1 -5
  10. package/dist/avatar/defaults.js.map +1 -1
  11. package/dist/{avatar-B_na7r1U.d.ts → avatar-CNV6ld8l.d.ts} +2 -2
  12. package/dist/avatar.d.ts +2 -2
  13. package/dist/avatar.js +1 -5
  14. package/dist/avatar.js.map +1 -1
  15. package/dist/blocks.css +4 -4
  16. package/dist/chat.js +1 -1
  17. package/dist/{chunk-5MPPIGCB.js → chunk-E46AEUPH.js} +1 -5
  18. package/dist/chunk-E46AEUPH.js.map +1 -0
  19. package/dist/{chunk-TISDOZH3.js → chunk-IOTY5HYG.js} +1 -5
  20. package/dist/chunk-IOTY5HYG.js.map +1 -0
  21. package/dist/chunk-PGPNYYE2.js +286 -0
  22. package/dist/chunk-PGPNYYE2.js.map +1 -0
  23. package/dist/{chunk-GRVIZTT2.js → chunk-RI3AA2E3.js} +3 -3
  24. package/dist/{chunk-Y5YBTHVD.js → chunk-SG3QJJXE.js} +6 -12
  25. package/dist/chunk-SG3QJJXE.js.map +1 -0
  26. package/dist/{chunk-4JO5GSSD.js → chunk-VA4NPCUQ.js} +2 -2
  27. package/dist/chunk-VA4NPCUQ.js.map +1 -0
  28. package/dist/{chunk-E4FMPPDL.js → chunk-WC3SO4CE.js} +2 -2
  29. package/dist/{chunk-T5NZSKWT.js → chunk-YQWYGQTV.js} +38 -41
  30. package/dist/chunk-YQWYGQTV.js.map +1 -0
  31. package/dist/{chunk-M3GEYLMR.js → chunk-ZPOVOEO3.js} +1 -2
  32. package/dist/collection-switcher.d.ts +1 -1
  33. package/dist/data-table.js +3 -3
  34. package/dist/{default-avatar-BL0nJFti.d.ts → default-avatar-Bh4atFDo.d.ts} +2 -2
  35. package/dist/elephant.d.ts +2 -2
  36. package/dist/elephant.js +2 -3
  37. package/dist/elephant.js.map +1 -1
  38. package/dist/engine-flow.js +29 -21
  39. package/dist/engine-flow.js.map +1 -1
  40. package/dist/entity-header.d.ts +1 -1
  41. package/dist/filter-bar.d.ts +9 -1
  42. package/dist/filter-bar.js +1 -1
  43. package/dist/gallery-page.js +3 -3
  44. package/dist/genui.js +101 -35
  45. package/dist/genui.js.map +1 -1
  46. package/dist/index.d.ts +7 -51
  47. package/dist/index.js +2 -12
  48. package/dist/index.js.map +1 -1
  49. package/dist/{lightbox-D5NAHFEA.js → lightbox-Q45BZ3HW.js} +3 -3
  50. package/dist/map.js +0 -120
  51. package/dist/map.js.map +1 -1
  52. package/dist/match-dialog.js +3 -3
  53. package/dist/motion.css +3 -120
  54. package/dist/motion.d.ts +1 -1
  55. package/dist/motion.js +1 -1
  56. package/dist/native/list.js +1 -1
  57. package/dist/native/list.js.map +1 -1
  58. package/dist/native/map.js +0 -120
  59. package/dist/native/map.js.map +1 -1
  60. package/dist/native.d.ts +7 -111
  61. package/dist/native.js +988 -1436
  62. package/dist/native.js.map +1 -1
  63. package/dist/nav-bar.d.ts +1 -1
  64. package/dist/nav-bar.js +2 -2
  65. package/dist/product-page.js +3 -3
  66. package/dist/rail-nav.d.ts +2 -5
  67. package/dist/shop-gallery.js +1 -1
  68. package/dist/site-cahier.d.ts +3 -11
  69. package/dist/site-cahier.js +126 -367
  70. package/dist/site-cahier.js.map +1 -1
  71. package/dist/site-footer.d.ts +1 -1
  72. package/dist/site-footer.js +2 -2
  73. package/dist/{sites-CEnywB89.d.ts → sites-CVNSirrg.d.ts} +3 -11
  74. package/dist/sites.d.ts +7 -15
  75. package/dist/sites.js +4 -10
  76. package/dist/sites.js.map +1 -1
  77. package/dist/tag-selector.js +28 -21
  78. package/dist/tag-selector.js.map +1 -1
  79. package/dist/vertical-video.js +2 -2
  80. package/dist/waveform.js.map +1 -1
  81. package/package.json +5 -109
  82. package/registry/account-menu.json +1 -1
  83. package/registry/account-settings.json +1 -1
  84. package/registry/achievement.json +1 -1
  85. package/registry/action-bar.json +1 -1
  86. package/registry/activity-feed.json +1 -1
  87. package/registry/agenda.json +1 -1
  88. package/registry/alert.json +1 -1
  89. package/registry/analysis-report.json +1 -1
  90. package/registry/anatomy-plate.json +1 -1
  91. package/registry/app-frame.json +6 -38
  92. package/registry/app-header.json +1 -1
  93. package/registry/app-shell.json +1 -1
  94. package/registry/argument-card.json +1 -1
  95. package/registry/auth-layout.json +1 -1
  96. package/registry/avatar.json +2 -2
  97. package/registry/badge.json +1 -1
  98. package/registry/bird-plate.json +1 -1
  99. package/registry/button.json +1 -1
  100. package/registry/captcha.json +1 -1
  101. package/registry/card-grid.json +1 -1
  102. package/registry/card.json +1 -1
  103. package/registry/catalogue-page.json +1 -1
  104. package/registry/changelog-page.json +1 -1
  105. package/registry/chapter.json +1 -1
  106. package/registry/chat.json +3 -3
  107. package/registry/checkbox.json +1 -1
  108. package/registry/chip-link.json +1 -1
  109. package/registry/chip-row.json +1 -1
  110. package/registry/chip.json +1 -1
  111. package/registry/choice-grid.json +1 -1
  112. package/registry/code-block.json +1 -1
  113. package/registry/collection-switcher.json +1 -1
  114. package/registry/combobox.json +1 -1
  115. package/registry/command.json +1 -1
  116. package/registry/comparison-table.json +1 -1
  117. package/registry/component-page.json +1 -1
  118. package/registry/confirm-button.json +1 -1
  119. package/registry/contact-page.json +1 -1
  120. package/registry/continue-prompt.json +1 -1
  121. package/registry/copy-button.json +1 -1
  122. package/registry/countdown.json +1 -1
  123. package/registry/cover-hero.json +1 -1
  124. package/registry/cta-panel.json +1 -1
  125. package/registry/dashboard-layout.json +1 -1
  126. package/registry/data-table.json +1 -1
  127. package/registry/date-picker.json +1 -1
  128. package/registry/decision-list.json +1 -1
  129. package/registry/description-list.json +1 -1
  130. package/registry/desktop-window.json +1 -1
  131. package/registry/detail-layout.json +1 -1
  132. package/registry/dialog.json +1 -1
  133. package/registry/docs-article-page.json +1 -1
  134. package/registry/docs-hub-page.json +1 -1
  135. package/registry/docs-layout.json +1 -1
  136. package/registry/docs-nav.json +1 -1
  137. package/registry/document-viewer.json +1 -1
  138. package/registry/doodle.json +1 -1
  139. package/registry/drop-overlay.json +1 -1
  140. package/registry/dropdown-menu.json +1 -1
  141. package/registry/elephant.json +3 -5
  142. package/registry/embed-facade.json +1 -1
  143. package/registry/empty-state.json +1 -1
  144. package/registry/engine-flow.json +3 -4
  145. package/registry/entity-header.json +1 -1
  146. package/registry/environment-notice.json +1 -1
  147. package/registry/error-page.json +1 -1
  148. package/registry/field.json +1 -1
  149. package/registry/file-upload.json +1 -1
  150. package/registry/filter-bar.json +2 -2
  151. package/registry/flock.json +1 -1
  152. package/registry/footnote.json +1 -1
  153. package/registry/force-update-screen.json +1 -1
  154. package/registry/form.json +1 -1
  155. package/registry/gallery-page.json +1 -1
  156. package/registry/genui.json +1 -1
  157. package/registry/glossary-term.json +1 -1
  158. package/registry/glossary.json +1 -1
  159. package/registry/glow-card.json +1 -1
  160. package/registry/goal-gauge.json +1 -1
  161. package/registry/grade-stamp.json +1 -1
  162. package/registry/image-cropper.json +1 -1
  163. package/registry/index.json +11 -246
  164. package/registry/kanban.json +1 -1
  165. package/registry/kbd.json +1 -1
  166. package/registry/kind-config-editor.json +1 -1
  167. package/registry/kpi-explained.json +1 -1
  168. package/registry/landing-page.json +1 -1
  169. package/registry/landscape.json +1 -1
  170. package/registry/language-switch.json +1 -1
  171. package/registry/legal-page.json +1 -1
  172. package/registry/link-card.json +1 -1
  173. package/registry/list.json +1 -1
  174. package/registry/loader.json +1 -1
  175. package/registry/longform-page.json +1 -1
  176. package/registry/maintenance-screen.json +1 -1
  177. package/registry/map.json +2 -2
  178. package/registry/margin-layout.json +1 -1
  179. package/registry/markdown.json +1 -1
  180. package/registry/marketing-layout.json +1 -1
  181. package/registry/mascot-quote.json +1 -1
  182. package/registry/mascot-state.json +1 -1
  183. package/registry/mascots.json +1 -1
  184. package/registry/match-dialog.json +3 -3
  185. package/registry/media-capture.json +1 -1
  186. package/registry/media-gallery.json +3 -14
  187. package/registry/meter.json +1 -1
  188. package/registry/money-input.json +1 -1
  189. package/registry/nav-bar.json +6 -38
  190. package/registry/next-actions.json +1 -1
  191. package/registry/notification-preferences.json +1 -1
  192. package/registry/number-ticker.json +1 -1
  193. package/registry/opening-hours.json +3 -4
  194. package/registry/page-header.json +1 -1
  195. package/registry/page-hero.json +1 -1
  196. package/registry/page-index.json +1 -1
  197. package/registry/page.json +1 -1
  198. package/registry/pagination.json +1 -1
  199. package/registry/pointer-light.json +1 -1
  200. package/registry/popover.json +1 -1
  201. package/registry/price-catalogue-editor.json +1 -1
  202. package/registry/pricing-page.json +1 -1
  203. package/registry/product-page.json +2 -6
  204. package/registry/profile-card.json +1 -1
  205. package/registry/progress.json +1 -1
  206. package/registry/promise-card.json +1 -1
  207. package/registry/promo-code-field.json +1 -1
  208. package/registry/proposal.json +1 -1
  209. package/registry/qr-code.json +1 -1
  210. package/registry/quota-meter.json +1 -1
  211. package/registry/radio-group.json +1 -1
  212. package/registry/rail-nav.json +6 -38
  213. package/registry/recipes.json +1 -1
  214. package/registry/retro-tv.json +2 -3
  215. package/registry/reviews.json +1 -1
  216. package/registry/router.json +1 -1
  217. package/registry/schema-form.json +1 -1
  218. package/registry/scroll-stage.json +1 -1
  219. package/registry/search-field.json +1 -1
  220. package/registry/section-backdrop.json +1 -1
  221. package/registry/separator.json +1 -1
  222. package/registry/service-card.json +1 -1
  223. package/registry/settings-layout.json +1 -1
  224. package/registry/shop-composer.json +1 -1
  225. package/registry/shop-gallery.json +3 -8
  226. package/registry/shop.json +2 -2
  227. package/registry/showcase.json +2 -7
  228. package/registry/signature.json +1 -1
  229. package/registry/site-cahier.json +1 -1
  230. package/registry/site-footer.json +6 -38
  231. package/registry/sites.json +3 -3
  232. package/registry/skeleton.json +1 -1
  233. package/registry/skip-link.json +1 -1
  234. package/registry/slider.json +1 -1
  235. package/registry/slot-picker.json +1 -1
  236. package/registry/slot.json +1 -1
  237. package/registry/specimen-tag.json +1 -1
  238. package/registry/speed-lines.json +1 -1
  239. package/registry/spinner.json +1 -1
  240. package/registry/split-view.json +1 -1
  241. package/registry/stage-banner.json +1 -1
  242. package/registry/stat.json +1 -1
  243. package/registry/status-chip.json +1 -1
  244. package/registry/status-page.json +1 -1
  245. package/registry/step-progress.json +1 -1
  246. package/registry/step-showcase.json +1 -1
  247. package/registry/stepper.json +1 -1
  248. package/registry/sticky-action.json +1 -1
  249. package/registry/stuck.json +1 -1
  250. package/registry/swipe-deck.json +4 -5
  251. package/registry/switch.json +1 -1
  252. package/registry/tabs.json +1 -1
  253. package/registry/tag-input.json +1 -1
  254. package/registry/tag-selector.json +2 -2
  255. package/registry/taped-photo.json +1 -1
  256. package/registry/terminal-replay.json +1 -1
  257. package/registry/text-style.json +1 -1
  258. package/registry/theme.json +1 -1
  259. package/registry/toast.json +1 -1
  260. package/registry/toc.json +1 -1
  261. package/registry/tooltip.json +1 -1
  262. package/registry/tree-view.json +1 -1
  263. package/registry/update-prompt.json +1 -1
  264. package/registry/upload-queue.json +1 -1
  265. package/registry/usage.json +1 -1
  266. package/registry/verified-badge.json +1 -1
  267. package/registry/versus-card.json +1 -1
  268. package/registry/vertical-video.json +2 -6
  269. package/registry/video-player.json +2 -7
  270. package/registry/video-trimmer.json +3 -4
  271. package/registry/virtual.json +1 -1
  272. package/registry/wall.json +3 -9
  273. package/registry/waveform.json +4 -9
  274. package/dist/audio-player.d.ts +0 -115
  275. package/dist/audio-player.js +0 -211
  276. package/dist/audio-player.js.map +0 -1
  277. package/dist/chunk-4JO5GSSD.js.map +0 -1
  278. package/dist/chunk-5MPPIGCB.js.map +0 -1
  279. package/dist/chunk-B2HS5EAH.js +0 -527
  280. package/dist/chunk-B2HS5EAH.js.map +0 -1
  281. package/dist/chunk-T5NZSKWT.js.map +0 -1
  282. package/dist/chunk-TISDOZH3.js.map +0 -1
  283. package/dist/chunk-Y5YBTHVD.js.map +0 -1
  284. package/dist/chunk-YKOLME7R.js +0 -126
  285. package/dist/chunk-YKOLME7R.js.map +0 -1
  286. package/dist/how-it-works-page.d.ts +0 -49
  287. package/dist/how-it-works-page.js +0 -28
  288. package/dist/how-it-works-page.js.map +0 -1
  289. package/dist/iso.d.ts +0 -401
  290. package/dist/iso.js +0 -363
  291. package/dist/iso.js.map +0 -1
  292. package/dist/marquee.d.ts +0 -34
  293. package/dist/marquee.js +0 -52
  294. package/dist/marquee.js.map +0 -1
  295. package/dist/media-grid.d.ts +0 -246
  296. package/dist/media-grid.js +0 -468
  297. package/dist/media-grid.js.map +0 -1
  298. package/dist/meta-row.d.ts +0 -55
  299. package/dist/meta-row.js +0 -35
  300. package/dist/meta-row.js.map +0 -1
  301. package/dist/photo-grid.d.ts +0 -123
  302. package/dist/photo-grid.js +0 -94
  303. package/dist/photo-grid.js.map +0 -1
  304. package/registry/audio-player.json +0 -300
  305. package/registry/examples/audio-player/podcast.d.ts +0 -4
  306. package/registry/examples/audio-player/podcast.js +0 -22
  307. package/registry/examples/audio-player/podcast.tsx +0 -19
  308. package/registry/examples/audio-player/voice-note.d.ts +0 -4
  309. package/registry/examples/audio-player/voice-note.js +0 -12
  310. package/registry/examples/audio-player/voice-note.tsx +0 -12
  311. package/registry/examples/how-it-works-page/orazaka.d.ts +0 -4
  312. package/registry/examples/how-it-works-page/orazaka.js +0 -30
  313. package/registry/examples/how-it-works-page/orazaka.tsx +0 -26
  314. package/registry/examples/iso/compose.d.ts +0 -4
  315. package/registry/examples/iso/compose.js +0 -22
  316. package/registry/examples/iso/compose.tsx +0 -19
  317. package/registry/examples/iso/creator-hero.d.ts +0 -4
  318. package/registry/examples/iso/creator-hero.js +0 -29
  319. package/registry/examples/iso/creator-hero.tsx +0 -23
  320. package/registry/examples/iso/orazaka-hero.d.ts +0 -4
  321. package/registry/examples/iso/orazaka-hero.js +0 -26
  322. package/registry/examples/iso/orazaka-hero.tsx +0 -21
  323. package/registry/examples/iso/still.d.ts +0 -4
  324. package/registry/examples/iso/still.js +0 -21
  325. package/registry/examples/iso/still.tsx +0 -15
  326. package/registry/examples/marquee/cards.d.ts +0 -4
  327. package/registry/examples/marquee/cards.js +0 -23
  328. package/registry/examples/marquee/cards.tsx +0 -21
  329. package/registry/examples/marquee/logos.d.ts +0 -4
  330. package/registry/examples/marquee/logos.js +0 -12
  331. package/registry/examples/marquee/logos.tsx +0 -17
  332. package/registry/examples/media-grid/feed.d.ts +0 -4
  333. package/registry/examples/media-grid/feed.js +0 -32
  334. package/registry/examples/media-grid/feed.tsx +0 -31
  335. package/registry/examples/media-grid/loading.d.ts +0 -4
  336. package/registry/examples/media-grid/loading.js +0 -28
  337. package/registry/examples/media-grid/loading.tsx +0 -25
  338. package/registry/examples/media-grid/uniform.d.ts +0 -4
  339. package/registry/examples/media-grid/uniform.js +0 -29
  340. package/registry/examples/media-grid/uniform.tsx +0 -26
  341. package/registry/examples/meta-row/native/video.d.ts +0 -4
  342. package/registry/examples/meta-row/native/video.dark.png +0 -0
  343. package/registry/examples/meta-row/native/video.js +0 -11
  344. package/registry/examples/meta-row/native/video.light.png +0 -0
  345. package/registry/examples/meta-row/native/video.tsx +0 -5
  346. package/registry/examples/meta-row/status.d.ts +0 -4
  347. package/registry/examples/meta-row/status.js +0 -12
  348. package/registry/examples/meta-row/status.tsx +0 -7
  349. package/registry/examples/meta-row/video.d.ts +0 -4
  350. package/registry/examples/meta-row/video.js +0 -12
  351. package/registry/examples/meta-row/video.tsx +0 -7
  352. package/registry/examples/photo-grid/native/profile-photos.d.ts +0 -4
  353. package/registry/examples/photo-grid/native/profile-photos.dark.png +0 -0
  354. package/registry/examples/photo-grid/native/profile-photos.js +0 -27
  355. package/registry/examples/photo-grid/native/profile-photos.light.png +0 -0
  356. package/registry/examples/photo-grid/native/profile-photos.tsx +0 -24
  357. package/registry/examples/photo-grid/profile-photos.d.ts +0 -4
  358. package/registry/examples/photo-grid/profile-photos.js +0 -28
  359. package/registry/examples/photo-grid/profile-photos.tsx +0 -25
  360. package/registry/how-it-works-page.json +0 -258
  361. package/registry/iso.json +0 -1371
  362. package/registry/marquee.json +0 -241
  363. package/registry/media-grid.json +0 -1034
  364. package/registry/meta-row.json +0 -218
  365. package/registry/photo-grid.json +0 -316
  366. /package/dist/{chunk-GRVIZTT2.js.map → chunk-RI3AA2E3.js.map} +0 -0
  367. /package/dist/{chunk-E4FMPPDL.js.map → chunk-WC3SO4CE.js.map} +0 -0
  368. /package/dist/{chunk-M3GEYLMR.js.map → chunk-ZPOVOEO3.js.map} +0 -0
  369. /package/dist/{lightbox-D5NAHFEA.js.map → lightbox-Q45BZ3HW.js.map} +0 -0
@@ -1,1034 +0,0 @@
1
- {
2
- "name": "media-grid",
3
- "type": "primitive",
4
- "title": "Media grid",
5
- "summary": "A feed of videos in mixed orientations that never staggers, with its loading states (`MediaGridSkeleton`, `VideoCardSkeleton`, `LoadMore`): `MediaGrid` routes the 9:16 clips to a `ShortsShelf` (equal-height cards, snap scroll, arrows, “See all”) and lays the others in a uniform 16:9 grid; `VideoCard` is aspect-aware and gives every card the same body height so rows align.",
6
- "description": "A feed of videos in mixed orientations that never staggers, with its loading states (`MediaGridSkeleton`, `VideoCardSkeleton`, `LoadMore`): `MediaGrid` routes the 9:16 clips to a `ShortsShelf` (equal-height cards, snap scroll, arrows, “See all”) and lays the others in a uniform 16:9 grid; `VideoCard` is aspect-aware and gives every card the same body height so rows align.",
7
- "status": "beta",
8
- "deprecated": null,
9
- "category": "media",
10
- "domain": "media",
11
- "adoption": null,
12
- "platforms": "web",
13
- "parity": {
14
- "web": {
15
- "state": "yes"
16
- },
17
- "native": {
18
- "state": "gap",
19
- "reason": "A mobile app hand-rolls its tiles and stories rail.",
20
- "issue": "krizaka/krizaka-ui#228"
21
- },
22
- "desktop": {
23
- "state": "yes"
24
- }
25
- },
26
- "whenToUse": [
27
- "A home, an explore page or a profile's Videos tab where creators publish both vertical and horizontal video.",
28
- "A gallery whose items come from different sources (`uniform`: everything in one frame, the odd one drawn whole over a blurred copy)."
29
- ],
30
- "whenNotToUse": [
31
- {
32
- "when": "For a feed that plays one video per screen.",
33
- "use": "vertical-video"
34
- },
35
- {
36
- "when": "For still photos the owner reorders.",
37
- "use": "photo-grid"
38
- }
39
- ],
40
- "bestPractices": [
41
- "Leave `mode` on `split` for a feed: a 9:16 card in a 16:9 grid is what makes a row tower over its neighbours.",
42
- "Give `orientationOf` the source's width and height, not the card's: a clip of the other shape is drawn with `fit=\"contain\"`, never cropped to a face.",
43
- "Put what is the product's own in the slots (`badges`, `action`); badges sit on `scrim` and read in both themes.",
44
- "Pass every word translated: the shelf's name, its arrows and “See all”.",
45
- "Give `previewSrc` the small animated WebP, never the stream: it is requested only after the pointer rests (`previewDelay`, 200 ms), fades in over the poster and is removed on leave. On a phone only the card most inside the viewport plays it, and none under Save-Data or reduced motion.",
46
- "Put `loading=\"eager\"` and `posterPriority=\"high\"` on the first row's posters, sized images from the CDN on the others (they are lazy).",
47
- "While the first page loads, draw `MediaGridSkeleton` (the same shelf and grid, the same card heights); under a long list use `LoadMore`: the next page is asked a screenful before the end, and the button stays for keyboards and failures."
48
- ],
49
- "accessibility": {
50
- "keyboard": [
51
- {
52
- "keys": "Tab",
53
- "action": "Each card is one link (its title); the creator and the action are their own stops; the shelf takes the focus to scroll with the arrow keys."
54
- },
55
- {
56
- "keys": "Arrow Left / Arrow Right",
57
- "action": "Scrolls the focused shelf."
58
- }
59
- ],
60
- "notes": [
61
- "The shelf is a labelled section whose row is a list; the arrows are named buttons shown with a mouse, hidden on touch (swipe).",
62
- "The card's whole surface is the title's link (a stretched link over the picture and the text): no nested interactive element. The badges and the duration let the click through; the creator and the action stay their own stops above it.",
63
- "The animated preview plays on hover or focus (after a short rest), or for the one most visible card of a phone; never under Save-Data, and on a phone never under reduced motion. It is decorative (empty `alt`).",
64
- "`MediaGridSkeleton` is one polite `role=\"status\"` announcement; its cards are hidden from assistive technology. `LoadMore` names its wait through the `Spinner`."
65
- ]
66
- },
67
- "related": [
68
- "vertical-video",
69
- "card",
70
- "photo-grid"
71
- ],
72
- "web": {
73
- "entry": "@krizaka/ui/media-grid",
74
- "import": "import { MediaGrid, ShortsShelf, VideoCard, VideoCardSkeleton, MediaGridSkeleton, LoadMore } from \"@krizaka/ui/media-grid\";",
75
- "props": [
76
- {
77
- "component": "LoadMore",
78
- "description": "Infinite scroll with a visible \"Load more\" under it.",
79
- "props": [
80
- {
81
- "name": "hasMore",
82
- "type": "boolean",
83
- "default": null,
84
- "description": "There is a next page.",
85
- "required": true
86
- },
87
- {
88
- "name": "label",
89
- "type": "string",
90
- "default": null,
91
- "description": "The button, passed translated (\"Load more\").",
92
- "required": true
93
- },
94
- {
95
- "name": "loadingLabel",
96
- "type": "string",
97
- "default": null,
98
- "description": "The wait, passed translated (\"Loading more videos\").",
99
- "required": true
100
- },
101
- {
102
- "name": "onLoadMore",
103
- "type": "() => void",
104
- "default": null,
105
- "description": "Asks for the next page. Not called while `loading`, nor once `hasMore` is false.",
106
- "required": true
107
- },
108
- {
109
- "name": "endLabel",
110
- "type": "string",
111
- "default": null,
112
- "description": "Shown instead of the button when the list is over, passed translated (\"You have seen everything\"). Nothing if absent.",
113
- "required": false
114
- },
115
- {
116
- "name": "failed",
117
- "type": "boolean",
118
- "default": "false",
119
- "description": "The last page failed: the button reads `retryLabel`, and nothing loads by itself until it is pressed.",
120
- "required": false
121
- },
122
- {
123
- "name": "loading",
124
- "type": "boolean",
125
- "default": "false",
126
- "description": "A page is on its way.",
127
- "required": false
128
- },
129
- {
130
- "name": "retryLabel",
131
- "type": "string",
132
- "default": null,
133
- "description": "The button after a failure, passed translated (\"Try again\"). Defaults to `label`.",
134
- "required": false
135
- },
136
- {
137
- "name": "rootMargin",
138
- "type": "string",
139
- "default": "900px 0px",
140
- "description": "How far below the viewport the page is already requested (an IntersectionObserver `rootMargin`).",
141
- "required": false
142
- }
143
- ]
144
- },
145
- {
146
- "component": "MediaGrid",
147
- "description": "A media grid that never mixes heights badly: a shelf for the 9:16, a uniform grid for the rest.",
148
- "props": [
149
- {
150
- "name": "getId",
151
- "type": "(item: T) => string",
152
- "default": null,
153
- "description": "A stable key for an item.",
154
- "required": true
155
- },
156
- {
157
- "name": "items",
158
- "type": "readonly T[]",
159
- "default": null,
160
- "description": "The videos, in order.",
161
- "required": true
162
- },
163
- {
164
- "name": "orientationOf",
165
- "type": "(item: T) => VideoCardAspect",
166
- "default": null,
167
- "description": "The source's orientation (from its width and height).",
168
- "required": true
169
- },
170
- {
171
- "name": "renderItem",
172
- "type": "(item: T, state: MediaGridState) => ReactNode",
173
- "default": null,
174
- "description": "One card, drawn in the frame the grid gives (`state`): use `VideoCard`.",
175
- "required": true
176
- },
177
- {
178
- "name": "shelf",
179
- "type": "Pick<ShortsShelfProps<unknown>, \"label\" | \"title\" | \"hint\" | \"seeAll\" | \"previousLabel\" | \"nextLabel\">",
180
- "default": null,
181
- "description": "The shelf of `split`: its name, \"See all\" and arrows, passed translated.",
182
- "required": true
183
- },
184
- {
185
- "name": "frame",
186
- "type": "VideoCardAspect",
187
- "default": "landscape",
188
- "description": "The frame of `uniform`.",
189
- "required": false
190
- },
191
- {
192
- "name": "grid",
193
- "type": "{ label: string; hint?: SectionHintProps; }",
194
- "default": null,
195
- "description": "A heading for the grid of the others (“Videos”), in the style of the shelf's, with an optional definition.",
196
- "required": false
197
- },
198
- {
199
- "name": "layout",
200
- "type": "\"grid\" | \"list\"",
201
- "default": "grid",
202
- "description": "`grid` or `list` (one row per video).",
203
- "required": false
204
- },
205
- {
206
- "name": "mode",
207
- "type": "\"split\" | \"uniform\"",
208
- "default": "split",
209
- "description": "`split`: verticals on the shelf, the others in the grid · `uniform`: all in one frame (`frame`).",
210
- "required": false
211
- }
212
- ]
213
- },
214
- {
215
- "component": "SectionHint",
216
- "description": "The definition of a section, one tap away from its heading.",
217
- "props": [
218
- {
219
- "name": "label",
220
- "type": "string",
221
- "default": null,
222
- "description": "The button's accessible name, passed translated (“What are Shorts?”).",
223
- "required": true
224
- },
225
- {
226
- "name": "text",
227
- "type": "string",
228
- "default": null,
229
- "description": "The definition, in one line.",
230
- "required": true
231
- },
232
- {
233
- "name": "link",
234
- "type": "{ href: string; label: string; linkAs?: LinkComponent; }",
235
- "default": null,
236
- "description": "A link to the full definition (the glossary).",
237
- "required": false
238
- }
239
- ]
240
- },
241
- {
242
- "component": "ShortsShelf",
243
- "description": "A Shorts shelf: equal-height 9:16 cards in a snap-scrolling row.",
244
- "props": [
245
- {
246
- "name": "getId",
247
- "type": "(item: T) => string",
248
- "default": null,
249
- "description": "A stable key for an item.",
250
- "required": true
251
- },
252
- {
253
- "name": "items",
254
- "type": "readonly T[]",
255
- "default": null,
256
- "description": "The clips, in order.",
257
- "required": true
258
- },
259
- {
260
- "name": "label",
261
- "type": "string",
262
- "default": null,
263
- "description": "The shelf's accessible name (\"Shorts\"), passed translated; shown as its heading unless `title` is set.",
264
- "required": true
265
- },
266
- {
267
- "name": "nextLabel",
268
- "type": "string",
269
- "default": null,
270
- "description": "The next arrow's name.",
271
- "required": true
272
- },
273
- {
274
- "name": "previousLabel",
275
- "type": "string",
276
- "default": null,
277
- "description": "The arrows' names, passed translated.",
278
- "required": true
279
- },
280
- {
281
- "name": "renderItem",
282
- "type": "(item: T, index: number) => ReactNode",
283
- "default": null,
284
- "description": "One card: use `VideoCard aspect=\"portrait\"`.",
285
- "required": true
286
- },
287
- {
288
- "name": "hint",
289
- "type": "SectionHintProps",
290
- "default": null,
291
- "description": "A small “i” beside the heading: the one-line definition of the section and a link to the glossary.",
292
- "required": false
293
- },
294
- {
295
- "name": "seeAll",
296
- "type": "{ href: string; label: string; linkAs?: LinkComponent; }",
297
- "default": null,
298
- "description": "Opens the vertical feed.",
299
- "required": false
300
- },
301
- {
302
- "name": "title",
303
- "type": "ReactNode",
304
- "default": null,
305
- "description": "A heading different from the name.",
306
- "required": false
307
- }
308
- ]
309
- },
310
- {
311
- "component": "VideoCard",
312
- "description": "A video card whose frame, body and footer have one height per aspect, so a grid row or a shelf never staggers.",
313
- "props": [
314
- {
315
- "name": "href",
316
- "type": "string",
317
- "default": null,
318
- "description": "Where the card opens.",
319
- "required": true
320
- },
321
- {
322
- "name": "title",
323
- "type": "string",
324
- "default": null,
325
- "description": "The title; it names the card and is its link.",
326
- "required": true
327
- },
328
- {
329
- "name": "action",
330
- "type": "ReactNode",
331
- "default": null,
332
- "description": "One quick action at the end of the footer (a tip, a save). Its clicks must not follow the card's link.",
333
- "required": false
334
- },
335
- {
336
- "name": "aspect",
337
- "type": "VideoCardAspect",
338
- "default": "landscape",
339
- "description": "The frame: `landscape` (16:9) or `portrait` (9:16).",
340
- "required": false
341
- },
342
- {
343
- "name": "badges",
344
- "type": "ReactNode",
345
- "default": null,
346
- "description": "Badges at the top-left of the picture (Free, a price, 18+). Put them on `scrim` so they read in both themes.",
347
- "required": false
348
- },
349
- {
350
- "name": "blurred",
351
- "type": "boolean",
352
- "default": "false",
353
- "description": "A sensitive picture: blurred and scaled so nothing shows (put the reveal button in `overlay`).",
354
- "required": false
355
- },
356
- {
357
- "name": "creator",
358
- "type": "VideoCardCreator",
359
- "default": null,
360
- "description": "Who made it: name, photo, profile.",
361
- "required": false
362
- },
363
- {
364
- "name": "duration",
365
- "type": "string",
366
- "default": null,
367
- "description": "The length, already formatted (`3:42`).",
368
- "required": false
369
- },
370
- {
371
- "name": "fallback",
372
- "type": "ReactNode",
373
- "default": null,
374
- "description": "Shown instead of the picture while there is none.",
375
- "required": false
376
- },
377
- {
378
- "name": "fit",
379
- "type": "\"cover\" | \"contain\"",
380
- "default": "cover",
381
- "description": "`cover` fills the frame; `contain` draws the whole picture over a blurred copy of itself (a source of the other\norientation: no cropped face, no black bar).",
382
- "required": false
383
- },
384
- {
385
- "name": "layout",
386
- "type": "\"row\" | \"stack\"",
387
- "default": "stack",
388
- "description": "`stack` (picture over text) or `row` (picture beside the text: the list mode of a section).",
389
- "required": false
390
- },
391
- {
392
- "name": "linkAs",
393
- "type": "LinkComponent",
394
- "default": null,
395
- "description": "The app's router link (Next's `Link`).",
396
- "required": false
397
- },
398
- {
399
- "name": "loading",
400
- "type": "\"eager\" | \"lazy\"",
401
- "default": "lazy",
402
- "description": "`eager` for the first cards of a page.",
403
- "required": false
404
- },
405
- {
406
- "name": "meta",
407
- "type": "ReactNode",
408
- "default": null,
409
- "description": "What is counted (`12.4K views`), already formatted.",
410
- "required": false
411
- },
412
- {
413
- "name": "overlay",
414
- "type": "ReactNode",
415
- "default": null,
416
- "description": "Over the whole picture, above the card's link (a veil, a reveal button).",
417
- "required": false
418
- },
419
- {
420
- "name": "poster",
421
- "type": "string | null",
422
- "default": null,
423
- "description": "The picture.",
424
- "required": false
425
- },
426
- {
427
- "name": "posterPriority",
428
- "type": "\"auto\" | \"high\" | \"low\"",
429
- "default": "auto",
430
- "description": "`fetchPriority` of the poster: `high` for the first row (the largest contentful paint).",
431
- "required": false
432
- },
433
- {
434
- "name": "previewDelay",
435
- "type": "number",
436
- "default": "200",
437
- "description": "How long the pointer must rest before the preview is requested, in ms: a pointer crossing the grid loads nothing.",
438
- "required": false
439
- },
440
- {
441
- "name": "previewSrc",
442
- "type": "string | null",
443
- "default": null,
444
- "description": "An animated picture (WebP, a few hundred kB) that fades in over the poster once the pointer has rested on the card\n(or it is focused) for `previewDelay`, and is removed again on leave. It is never requested before. On a phone (no\nhover) only the card most inside the viewport plays it, unless the person asked for less data or less motion.",
445
- "required": false
446
- }
447
- ]
448
- },
449
- {
450
- "component": "MediaGridSkeleton",
451
- "description": "The placeholder of a `MediaGrid`: the same shelf and grid, skeleton cards, one polite announcement.",
452
- "props": [
453
- {
454
- "name": "label",
455
- "type": "string",
456
- "default": null,
457
- "description": "What is loading, passed translated (\"Loading videos\"): announced once, the cards are hidden from assistive technology.",
458
- "required": true
459
- },
460
- {
461
- "name": "count",
462
- "type": "number",
463
- "default": "8",
464
- "description": "Cards in the grid.",
465
- "required": false
466
- },
467
- {
468
- "name": "frame",
469
- "type": "VideoCardAspect",
470
- "default": "landscape",
471
- "description": "The frame of the grid.",
472
- "required": false
473
- },
474
- {
475
- "name": "layout",
476
- "type": "\"grid\" | \"list\"",
477
- "default": "grid",
478
- "description": "`grid` or `list`.",
479
- "required": false
480
- },
481
- {
482
- "name": "shelfCount",
483
- "type": "number",
484
- "default": "0",
485
- "description": "Cards on the Shorts shelf above the grid (`split` mode); 0 for none.",
486
- "required": false
487
- }
488
- ]
489
- },
490
- {
491
- "component": "VideoCardSkeleton",
492
- "description": "The placeholder of a `VideoCard` (decorative: announce the wait on the list, with `MediaGridSkeleton`).",
493
- "props": [
494
- {
495
- "name": "aspect",
496
- "type": "VideoCardAspect",
497
- "default": "landscape",
498
- "description": "`landscape` (16:9) or `portrait` (9:16), as the card it stands for.",
499
- "required": false
500
- },
501
- {
502
- "name": "layout",
503
- "type": "\"row\" | \"stack\"",
504
- "default": "stack",
505
- "description": "`stack` or `row`, as the card it stands for.",
506
- "required": false
507
- }
508
- ]
509
- }
510
- ],
511
- "examples": [
512
- {
513
- "name": "feed",
514
- "title": "A feed",
515
- "description": "Three horizontal clips in the grid, three vertical on the shelf: every card of a row has one height.",
516
- "path": "examples/media-grid/feed.tsx",
517
- "module": "@krizaka/ui/registry/examples/media-grid/feed",
518
- "code": "\"use client\";\n\nimport { Badge } from \"@krizaka/ui/badge\";\nimport { MediaGrid, VideoCard } from \"@krizaka/ui/media-grid\";\n\nconst CDN = \"https://krizaka-assets.b-cdn.net/site\";\nconst WIDE = `${CDN}/products/orazaka/gallery`;\nconst TALL = `${CDN}/docs/orochia/mobile`;\nconst CLIPS = [\n { id: \"tea\", title: \"Pouring the mint tea, slow\", poster: `${WIDE}/tea-pour.d69c3a5700.webp`, tall: false },\n { id: \"story\", title: \"Backstage, a minute before\", poster: `${TALL}/clip-feed-stories-poster.fd7835fa74.webp`, tall: true },\n { id: \"snow\", title: \"First snow on rue Saint-Denis\", poster: `${WIDE}/mtl-snow.e3ecb20e82.webp`, tall: false },\n { id: \"watch\", title: \"The unlock in one tap\", poster: `${TALL}/clip-watch-poster.9fc5d19c39.webp`, tall: true },\n { id: \"desert\", title: \"Desert camp at blue hour\", poster: `${WIDE}/desert-camp.78c6c0d26c.webp`, tall: false },\n { id: \"thanks\", title: \"Three ways to say thanks\", poster: `${TALL}/clip-unlock-poster.57e13fee5f.webp`, tall: true },\n];\n\n// 'split' (the feed default): vertical clips on a Shorts shelf, the others in a 16:9 grid whose cards share one height.\nexport default function MediaGridFeed() {\n return (\n <MediaGrid\n items={CLIPS}\n getId={(c) => c.id}\n orientationOf={(c) => (c.tall ? \"portrait\" : \"landscape\")}\n shelf={{ label: \"Shorts\", previousLabel: \"Previous shorts\", nextLabel: \"Next shorts\", seeAll: { href: \"#shorts\", label: \"See all\" } }}\n renderItem={(c, { aspect, layout }) => (\n <VideoCard href={`#${c.id}`} title={c.title} aspect={aspect} layout={layout} poster={c.poster} duration=\"0:12\" meta=\"12.4K views\" creator={{ name: \"Camille\" }} badges={<Badge tone=\"success\" size=\"sm\" className=\"bg-scrim\">Free</Badge>} />\n )}\n />\n );\n}\n"
519
- },
520
- {
521
- "name": "loading",
522
- "title": "Loading",
523
- "description": "The skeleton of the feed in the real frames (a shelf of 9:16, a grid of 16:9) and `LoadMore` under the list.",
524
- "path": "examples/media-grid/loading.tsx",
525
- "module": "@krizaka/ui/registry/examples/media-grid/loading",
526
- "code": "\"use client\";\n\nimport { LoadMore, MediaGridSkeleton } from \"@krizaka/ui/media-grid\";\nimport { useState } from \"react\";\n\n// The wait, in the shape of the feed: skeleton cards of the real frames (a shelf of 9:16, a grid of 16:9) while the first\n// page loads, then `LoadMore` under the list — the next page is asked a screenful before the end, the button never fails.\nexport default function MediaGridLoading() {\n const [loading, setLoading] = useState(false);\n return (\n <div className=\"flex flex-col gap-6\">\n <MediaGridSkeleton label=\"Loading videos\" shelfCount={4} count={4} />\n <LoadMore\n hasMore\n loading={loading}\n onLoadMore={() => {\n setLoading(true);\n setTimeout(() => setLoading(false), 1200);\n }}\n label=\"Load more\"\n loadingLabel=\"Loading more videos\"\n />\n </div>\n );\n}\n"
527
- },
528
- {
529
- "name": "uniform",
530
- "title": "One frame",
531
- "description": "`mode=\"uniform\"`: vertical clips drawn whole over a blurred copy inside 16:9 cards.",
532
- "path": "examples/media-grid/uniform.tsx",
533
- "module": "@krizaka/ui/registry/examples/media-grid/uniform",
534
- "code": "\"use client\";\n\nimport { MediaGrid, VideoCard } from \"@krizaka/ui/media-grid\";\n\nconst CDN = \"https://krizaka-assets.b-cdn.net/site\";\nconst CLIPS = [\n { id: \"tea\", title: \"Pouring the mint tea, slow\", poster: `${CDN}/products/orazaka/gallery/tea-pour.d69c3a5700.webp`, portrait: false },\n { id: \"story\", title: \"Backstage, a minute before\", poster: `${CDN}/docs/orochia/mobile/clip-feed-stories-poster.fd7835fa74.webp`, portrait: true },\n { id: \"snow\", title: \"First snow on rue Saint-Denis\", poster: `${CDN}/products/orazaka/gallery/mtl-snow.e3ecb20e82.webp`, portrait: false },\n { id: \"watch\", title: \"The unlock in one tap\", poster: `${CDN}/docs/orochia/mobile/clip-watch-poster.9fc5d19c39.webp`, portrait: true },\n];\n\n// 'uniform': one frame for everyone; a clip of the other orientation is drawn whole over a blurred copy of itself.\nexport default function MediaGridUniform() {\n return (\n <MediaGrid\n mode=\"uniform\"\n frame=\"landscape\"\n items={CLIPS}\n getId={(c) => c.id}\n orientationOf={(c) => (c.portrait ? \"portrait\" : \"landscape\")}\n shelf={{ label: \"Shorts\", previousLabel: \"Previous\", nextLabel: \"Next\" }}\n renderItem={(c, { aspect, layout, mismatch }) => <VideoCard href={`#${c.id}`} title={c.title} aspect={aspect} layout={layout} fit={mismatch ? \"contain\" : \"cover\"} poster={c.poster} meta=\"2.4K views\" />}\n />\n );\n}\n"
535
- }
536
- ]
537
- },
538
- "native": null,
539
- "files": [
540
- {
541
- "path": "block-link.tsx",
542
- "content": "// The links of the page blocks (PageHero's back link, LinkCard, ArgumentCard, ActionBar): an internal path renders\n// through the app's router link (`linkAs`, e.g. Next's `Link`), anything else is an `<a>` that opens in a new tab.\n// Shared by the block entries; never exported on its own.\nimport type * as React from \"react\";\n\n/** The app's link component (Next's `Link`, React Router's `Link`…): receives `href`, `className` and the children. */\nexport type LinkComponent = React.ElementType<{ href: string; className?: string; children?: React.ReactNode; \"aria-label\"?: string; \"aria-describedby\"?: string }>;\n\n/** An address that leaves the app: an absolute URL or a protocol (`mailto:`). */\nexport const isExternal = (href: string) => /^[a-z][a-z0-9+.-]*:/i.test(href);\n\nexport function BlockLink({\n href,\n linkAs: Link = \"a\",\n external = isExternal(href),\n rel,\n ...props\n}: Omit<React.ComponentProps<\"a\">, \"href\"> & { href: string; linkAs?: LinkComponent; external?: boolean }) {\n if (external) return <a href={href} target=\"_blank\" rel={rel ?? \"noopener noreferrer\"} {...props} />;\n const Comp = Link as React.ElementType;\n return <Comp href={href} rel={rel} {...props} />;\n}\n"
543
- },
544
- {
545
- "path": "media-grid/index.ts",
546
- "content": "/** @krizaka/ui/media-grid — `MediaGrid` (a shelf for 9:16, a uniform grid for the rest), `ShortsShelf`, `VideoCard` (aspect-aware, one body height, whole card one link, preview on intent), their skeletons and `LoadMore`. Client. */\nexport { LoadMore, type LoadMoreProps } from \"./load-more\";\nexport { MediaGrid, type MediaGridProps, type MediaGridState } from \"./media-grid\";\nexport { SectionHint, type SectionHintProps } from \"./section-hint\";\nexport { ShortsShelf, type ShortsShelfProps } from \"./shorts-shelf\";\nexport { VideoCard, type VideoCardAspect, type VideoCardCreator, type VideoCardProps } from \"./video-card\";\nexport { MediaGridSkeleton, type MediaGridSkeletonProps, VideoCardSkeleton, type VideoCardSkeletonProps } from \"./video-card-skeleton\";\n"
547
- },
548
- {
549
- "path": "media-grid/load-more.tsx",
550
- "content": "// Client (IntersectionObserver). The end of a long list: the next page is requested while the person is still a\n// screenful away (`rootMargin`), so it is there before they reach it; the button stays as the way that never fails\n// (no observer, a failed page, a keyboard).\nimport * as React from \"react\";\n\nimport { Button } from \"../button\";\nimport { cn } from \"../cn\";\nimport { Spinner } from \"../spinner\";\n\nexport interface LoadMoreProps extends Omit<React.ComponentProps<\"div\">, \"children\" | \"onError\"> {\n /** Asks for the next page. Not called while `loading`, nor once `hasMore` is false. */\n onLoadMore: () => void;\n /** There is a next page. */\n hasMore: boolean;\n /** A page is on its way. */\n loading?: boolean;\n /** The last page failed: the button reads `retryLabel`, and nothing loads by itself until it is pressed. */\n failed?: boolean;\n /** The button, passed translated (\"Load more\"). */\n label: string;\n /** The wait, passed translated (\"Loading more videos\"). */\n loadingLabel: string;\n /** The button after a failure, passed translated (\"Try again\"). Defaults to `label`. */\n retryLabel?: string;\n /** Shown instead of the button when the list is over, passed translated (\"You have seen everything\"). Nothing if absent. */\n endLabel?: string;\n /**\n * How far below the viewport the page is already requested (an IntersectionObserver `rootMargin`).\n * @default \"900px 0px\"\n */\n rootMargin?: string;\n}\n\n/** Infinite scroll with a visible \"Load more\" under it. */\nexport function LoadMore({ onLoadMore, hasMore, loading = false, failed = false, label, loadingLabel, retryLabel, endLabel, rootMargin = \"900px 0px\", className, ...props }: LoadMoreProps) {\n const sentinel = React.useRef<HTMLDivElement>(null);\n const ask = React.useRef(onLoadMore);\n React.useEffect(() => {\n ask.current = onLoadMore;\n });\n // Observing again after each page makes the observer report the current state: a short page that leaves the sentinel in view asks for the next.\n React.useEffect(() => {\n const el = sentinel.current;\n if (!el || !hasMore || loading || failed || typeof IntersectionObserver === \"undefined\") return;\n const io = new IntersectionObserver((entries) => entries.some((e) => e.isIntersecting) && ask.current(), { rootMargin });\n io.observe(el);\n return () => io.disconnect();\n }, [hasMore, loading, failed, rootMargin]);\n return (\n <div data-load-more=\"\" data-state={loading ? \"loading\" : failed ? \"failed\" : hasMore ? \"idle\" : \"end\"} className={cn(\"relative flex min-h-14 items-center justify-center py-6\", className)} {...props}>\n <div ref={sentinel} aria-hidden className=\"pointer-events-none absolute inset-x-0 top-0 h-px\" />\n {loading ? (\n <Spinner label={loadingLabel} size=\"md\" />\n ) : hasMore ? (\n <Button type=\"button\" variant=\"secondary\" size=\"md\" onClick={() => onLoadMore()}>\n {failed ? (retryLabel ?? label) : label}\n </Button>\n ) : endLabel ? (\n <p className=\"m-0 text-sm text-fg-secondary\">{endLabel}</p>\n ) : null}\n </div>\n );\n}\n"
551
- },
552
- {
553
- "path": "media-grid/media-grid.tsx",
554
- "content": "// Client (it renders the shelf). Mixed orientations without a broken grid. `split` (the feed default) sends the 9:16\n// clips to a `ShortsShelf` and lays the rest in a uniform 16:9 grid; `uniform` puts everything in one grid of one frame\n// (a source of the other orientation is told to `contain`, never cropped to a face). `layout=\"list\"` is one column.\nimport * as React from \"react\";\n\nimport { cn } from \"../cn\";\nimport { SectionHint, type SectionHintProps } from \"./section-hint\";\nimport { ShortsShelf, type ShortsShelfProps } from \"./shorts-shelf\";\nimport type { VideoCardAspect } from \"./video-card\";\n\nexport interface MediaGridState {\n /** The frame the card is drawn in (`aspect` of `VideoCard`). */\n aspect: VideoCardAspect;\n /** The card's `layout`. */\n layout: \"stack\" | \"row\";\n /** The source's orientation differs from the frame: pass `fit=\"contain\"`. */\n mismatch: boolean;\n}\n\nexport interface MediaGridProps<T> extends Omit<React.ComponentProps<\"div\">, \"children\"> {\n /** The videos, in order. */\n items: readonly T[];\n /** A stable key for an item. */\n getId: (item: T) => string;\n /** The source's orientation (from its width and height). */\n orientationOf: (item: T) => VideoCardAspect;\n /** One card, drawn in the frame the grid gives (`state`): use `VideoCard`. */\n renderItem: (item: T, state: MediaGridState) => React.ReactNode;\n /**\n * `split`: verticals on the shelf, the others in the grid · `uniform`: all in one frame (`frame`).\n * @default \"split\"\n */\n mode?: \"split\" | \"uniform\";\n /** The frame of `uniform`. @default \"landscape\" */\n frame?: VideoCardAspect;\n /** `grid` or `list` (one row per video). @default \"grid\" */\n layout?: \"grid\" | \"list\";\n /** The shelf of `split`: its name, \"See all\" and arrows, passed translated. */\n shelf: Pick<ShortsShelfProps<unknown>, \"label\" | \"title\" | \"hint\" | \"seeAll\" | \"previousLabel\" | \"nextLabel\">;\n /** A heading for the grid of the others (“Videos”), in the style of the shelf's, with an optional definition. */\n grid?: { label: string; hint?: SectionHintProps };\n}\n\nconst GRID = {\n landscape: \"grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4\",\n portrait: \"grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 xl:grid-cols-6\",\n} as const;\n\n/** A media grid that never mixes heights badly: a shelf for the 9:16, a uniform grid for the rest. */\nexport function MediaGrid<T>({ items, getId, orientationOf, renderItem, mode = \"split\", frame = \"landscape\", layout = \"grid\", shelf, grid, className, ...props }: MediaGridProps<T>) {\n const gridHeading = React.useId();\n const row = layout === \"list\";\n const split = mode === \"split\";\n const verticals = split ? items.filter((i) => orientationOf(i) === \"portrait\") : [];\n const rest = split ? items.filter((i) => orientationOf(i) !== \"portrait\") : items;\n const gridFrame: VideoCardAspect = split ? \"landscape\" : frame;\n const state = (item: T, aspect: VideoCardAspect): MediaGridState => ({ aspect, layout: row ? \"row\" : \"stack\", mismatch: orientationOf(item) !== aspect });\n return (\n <div data-media-grid={mode} className={cn(\"flex min-w-0 flex-col gap-8\", className)} {...props}>\n {verticals.length > 0 && <ShortsShelf {...shelf} items={verticals} getId={getId} renderItem={(item) => renderItem(item, { ...state(item, \"portrait\"), layout: \"stack\" })} />}\n {rest.length > 0 && (\n <section aria-labelledby={grid ? gridHeading : undefined} data-media-grid-section className=\"min-w-0\">\n {grid && (\n <div className=\"mb-3 flex items-center gap-2\">\n <h2 id={gridHeading} className=\"m-0 text-base font-bold text-fg\">\n {grid.label}\n </h2>\n {grid.hint && <SectionHint {...grid.hint} />}\n </div>\n )}\n <ul data-grid-frame={gridFrame} className={cn(\"m-0 grid list-none auto-rows-fr gap-4 p-0\", row ? \"grid-cols-1\" : GRID[gridFrame])}>\n {rest.map((item) => (\n <li key={getId(item)} className=\"min-w-0\">\n {renderItem(item, state(item, gridFrame))}\n </li>\n ))}\n </ul>\n </section>\n )}\n </div>\n );\n}\n"
555
- },
556
- {
557
- "path": "media-grid/meta.ts",
558
- "content": "import type { ComponentMeta } from \"../meta\";\n\nexport const meta = {\n title: \"Media grid\",\n summary: \"A feed of videos in mixed orientations that never staggers, with its loading states (`MediaGridSkeleton`, `VideoCardSkeleton`, `LoadMore`): `MediaGrid` routes the 9:16 clips to a `ShortsShelf` (equal-height cards, snap scroll, arrows, “See all”) and lays the others in a uniform 16:9 grid; `VideoCard` is aspect-aware and gives every card the same body height so rows align.\",\n status: \"beta\",\n category: \"media\",\n domain: \"media\",\n platforms: \"web\",\n parity: { native: { status: \"gap\", issue: \"krizaka/krizaka-ui#228\", reason: \"A mobile app hand-rolls its tiles and stories rail.\" }, desktop: \"web\" },\n whenToUse: [\n \"A home, an explore page or a profile's Videos tab where creators publish both vertical and horizontal video.\",\n \"A gallery whose items come from different sources (`uniform`: everything in one frame, the odd one drawn whole over a blurred copy).\",\n ],\n whenNotToUse: [\n { when: \"For a feed that plays one video per screen.\", use: \"vertical-video\" },\n { when: \"For still photos the owner reorders.\", use: \"photo-grid\" },\n ],\n bestPractices: [\n \"Leave `mode` on `split` for a feed: a 9:16 card in a 16:9 grid is what makes a row tower over its neighbours.\",\n \"Give `orientationOf` the source's width and height, not the card's: a clip of the other shape is drawn with `fit=\\\"contain\\\"`, never cropped to a face.\",\n \"Put what is the product's own in the slots (`badges`, `action`); badges sit on `scrim` and read in both themes.\",\n \"Pass every word translated: the shelf's name, its arrows and “See all”.\",\n \"Give `previewSrc` the small animated WebP, never the stream: it is requested only after the pointer rests (`previewDelay`, 200 ms), fades in over the poster and is removed on leave. On a phone only the card most inside the viewport plays it, and none under Save-Data or reduced motion.\",\n \"Put `loading=\\\"eager\\\"` and `posterPriority=\\\"high\\\"` on the first row's posters, sized images from the CDN on the others (they are lazy).\",\n \"While the first page loads, draw `MediaGridSkeleton` (the same shelf and grid, the same card heights); under a long list use `LoadMore`: the next page is asked a screenful before the end, and the button stays for keyboards and failures.\",\n ],\n accessibility: {\n keyboard: [\n { keys: \"Tab\", action: \"Each card is one link (its title); the creator and the action are their own stops; the shelf takes the focus to scroll with the arrow keys.\" },\n { keys: \"Arrow Left / Arrow Right\", action: \"Scrolls the focused shelf.\" },\n ],\n notes: [\n \"The shelf is a labelled section whose row is a list; the arrows are named buttons shown with a mouse, hidden on touch (swipe).\",\n \"The card's whole surface is the title's link (a stretched link over the picture and the text): no nested interactive element. The badges and the duration let the click through; the creator and the action stay their own stops above it.\",\n \"The animated preview plays on hover or focus (after a short rest), or for the one most visible card of a phone; never under Save-Data, and on a phone never under reduced motion. It is decorative (empty `alt`).\",\n \"`MediaGridSkeleton` is one polite `role=\\\"status\\\"` announcement; its cards are hidden from assistive technology. `LoadMore` names its wait through the `Spinner`.\",\n ],\n },\n related: [\"vertical-video\", \"card\", \"photo-grid\"],\n web: {\n imports: [\"MediaGrid\", \"ShortsShelf\", \"VideoCard\", \"VideoCardSkeleton\", \"MediaGridSkeleton\", \"LoadMore\"],\n examples: [\n { name: \"feed\", title: \"A feed\", description: \"Three horizontal clips in the grid, three vertical on the shelf: every card of a row has one height.\" },\n { name: \"loading\", title: \"Loading\", description: \"The skeleton of the feed in the real frames (a shelf of 9:16, a grid of 16:9) and `LoadMore` under the list.\" },\n { name: \"uniform\", title: \"One frame\", description: \"`mode=\\\"uniform\\\"`: vertical clips drawn whole over a blurred copy inside 16:9 cards.\" },\n ],\n },\n} satisfies ComponentMeta;\n"
559
- },
560
- {
561
- "path": "media-grid/preview-focus.ts",
562
- "content": "// Client only. Which card of the page is the most visible: on a phone there is no hover, so exactly one card at a time\n// (the one most inside the viewport) may play its preview. One IntersectionObserver for the whole page, no per-card\n// observer; the answer is a store read with `useSyncExternalStore`.\nconst MIN_RATIO = 0.6;\nconst ratios = new Map<Element, number>();\nconst listeners = new Set<() => void>();\nlet observer: IntersectionObserver | null = null;\nlet leader: Element | null = null;\n\nfunction elect() {\n let best: Element | null = null;\n let bestRatio = MIN_RATIO - Number.EPSILON;\n for (const [el, ratio] of ratios) {\n if (ratio > bestRatio) {\n best = el;\n bestRatio = ratio;\n }\n }\n if (best === leader) return;\n leader = best;\n for (const l of listeners) l();\n}\n\n/** Starts counting an element's visibility; returns the function that stops it. */\nexport function trackVisibility(el: Element): () => void {\n if (typeof IntersectionObserver === \"undefined\") return () => {};\n observer ??= new IntersectionObserver(\n (entries) => {\n for (const e of entries) ratios.set(e.target, e.isIntersecting ? e.intersectionRatio : 0);\n elect();\n },\n { threshold: [0, 0.25, 0.5, 0.6, 0.75, 1] },\n );\n ratios.set(el, 0);\n observer.observe(el);\n return () => {\n observer?.unobserve(el);\n ratios.delete(el);\n elect();\n };\n}\n\nexport const subscribeLeader = (l: () => void) => (listeners.add(l), () => void listeners.delete(l));\n\n/** Whether this element is the card the page is showing most. */\nexport const isLeader = (el: Element | null) => el !== null && leader === el;\n\n/** Test seam: forget everything. */\nexport function resetPreviewFocus() {\n observer?.disconnect();\n observer = null;\n ratios.clear();\n leader = null;\n}\n"
563
- },
564
- {
565
- "path": "media-grid/section-hint.tsx",
566
- "content": "// Client (open state). A tiny \"i\" button beside a section heading: it opens a one-line definition and, when given, a link to\n// the glossary. Opens on a tap or a press, on hover with a mouse, closes on Escape or when the focus leaves.\nimport * as React from \"react\";\n\nimport { BlockLink, type LinkComponent } from \"../block-link\";\nimport { cn } from \"../cn\";\n\nexport interface SectionHintProps {\n /** The button's accessible name, passed translated (“What are Shorts?”). */\n label: string;\n /** The definition, in one line. */\n text: string;\n /** A link to the full definition (the glossary). */\n link?: { href: string; label: string; linkAs?: LinkComponent };\n}\n\n/** The definition of a section, one tap away from its heading. */\nexport function SectionHint({ label, text, link }: SectionHintProps) {\n const [open, setOpen] = React.useState(false);\n const id = React.useId();\n return (\n <span\n className=\"relative inline-flex\"\n onMouseEnter={() => setOpen(true)}\n onMouseLeave={() => setOpen(false)}\n onBlur={(e) => {\n if (!e.currentTarget.contains(e.relatedTarget)) setOpen(false);\n }}\n onKeyDown={(e) => {\n if (e.key === \"Escape\") setOpen(false);\n }}\n >\n <button\n type=\"button\"\n aria-label={label}\n aria-expanded={open}\n aria-controls={id}\n onClick={() => setOpen((o) => !o)}\n className=\"inline-flex h-6 w-6 items-center justify-center rounded-full text-fg-muted transition-colors hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n <svg viewBox=\"0 0 24 24\" width=\"16\" height=\"16\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" aria-hidden>\n <circle cx=\"12\" cy=\"12\" r=\"9\" />\n <path d=\"M12 11v5M12 8h.01\" />\n </svg>\n </button>\n <span\n id={id}\n role=\"tooltip\"\n hidden={!open}\n className={cn(\"absolute left-0 top-full z-20 mt-1 w-64 max-w-[80vw] rounded-xl border border-border-default bg-surface-1 p-3 text-sm font-normal leading-snug text-fg-secondary shadow-lg\")}\n >\n {text}\n {link && (\n <>\n {\" \"}\n <BlockLink href={link.href} linkAs={link.linkAs} className=\"font-semibold text-fg-accent hover:underline\">\n {link.label}\n </BlockLink>\n </>\n )}\n </span>\n </span>\n );\n}\n"
567
- },
568
- {
569
- "path": "media-grid/shorts-shelf.tsx",
570
- "content": "// Client (the arrows scroll the row). A horizontal row of 9:16 cards of one height: scroll-snap, arrows with a mouse,\n// a swipe on touch, a \"See all\" link. The row is a labelled list that scrolls with the keyboard (it takes focus).\nimport * as React from \"react\";\n\nimport { BlockLink, type LinkComponent } from \"../block-link\";\nimport { cn } from \"../cn\";\nimport { SectionHint, type SectionHintProps } from \"./section-hint\";\n\nexport interface ShortsShelfProps<T> extends Omit<React.ComponentProps<\"section\">, \"children\" | \"title\"> {\n /** The shelf's accessible name (\"Shorts\"), passed translated; shown as its heading unless `title` is set. */\n label: string;\n /** A heading different from the name. */\n title?: React.ReactNode;\n /** A small “i” beside the heading: the one-line definition of the section and a link to the glossary. */\n hint?: SectionHintProps;\n /** The clips, in order. */\n items: readonly T[];\n /** A stable key for an item. */\n getId: (item: T) => string;\n /** One card: use `VideoCard aspect=\"portrait\"`. */\n renderItem: (item: T, index: number) => React.ReactNode;\n /** Opens the vertical feed. */\n seeAll?: { href: string; label: string; linkAs?: LinkComponent };\n /** The arrows' names, passed translated. */\n previousLabel: string;\n /** The next arrow's name. */\n nextLabel: string;\n}\n\nconst Chevron = ({ flip }: { flip?: boolean }) => (\n <svg viewBox=\"0 0 24 24\" width=\"18\" height=\"18\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden className={flip ? \"rotate-180\" : undefined}>\n <path d=\"m9 6 6 6-6 6\" />\n </svg>\n);\n\nconst ARROW =\n \"hidden h-9 w-9 items-center justify-center rounded-full border border-border-default bg-surface-1 text-fg shadow-sm transition-colors hover:bg-surface-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-40 [@media(hover:hover)]:inline-flex\";\n\n/** A Shorts shelf: equal-height 9:16 cards in a snap-scrolling row. */\nexport function ShortsShelf<T>({ label, title, hint, items, getId, renderItem, seeAll, previousLabel, nextLabel, className, ...props }: ShortsShelfProps<T>) {\n const row = React.useRef<HTMLUListElement>(null);\n const [edge, setEdge] = React.useState({ start: true, end: false });\n const measure = React.useCallback(() => {\n const el = row.current;\n if (!el) return;\n setEdge({ start: el.scrollLeft <= 2, end: el.scrollLeft + el.clientWidth >= el.scrollWidth - 2 });\n }, []);\n React.useEffect(measure, [measure, items.length]);\n const page = (dir: 1 | -1) => {\n const el = row.current;\n if (el) el.scrollBy({ left: dir * el.clientWidth * 0.85, behavior: window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches ? \"auto\" : \"smooth\" });\n };\n const headingId = React.useId();\n if (items.length === 0) return null;\n return (\n <section aria-labelledby={headingId} data-shorts-shelf className={cn(\"min-w-0\", className)} {...props}>\n <div className=\"mb-3 flex items-center gap-2\">\n <h2 id={headingId} className=\"m-0 mr-auto text-base font-bold text-fg\">\n {title ?? label}\n </h2>\n {hint && <SectionHint {...hint} />}\n {seeAll && (\n <BlockLink href={seeAll.href} linkAs={seeAll.linkAs} className=\"text-sm font-semibold text-fg-accent hover:underline\">\n {seeAll.label}\n </BlockLink>\n )}\n <button type=\"button\" aria-label={previousLabel} disabled={edge.start} onClick={() => page(-1)} className={ARROW}>\n <Chevron flip />\n </button>\n <button type=\"button\" aria-label={nextLabel} disabled={edge.end} onClick={() => page(1)} className={ARROW}>\n <Chevron />\n </button>\n </div>\n <ul\n ref={row}\n onScroll={measure}\n // biome-ignore: a scroll container must take the keyboard focus to scroll with the arrow keys\n tabIndex={0}\n aria-labelledby={headingId}\n className=\"m-0 flex list-none snap-x snap-mandatory items-stretch gap-3 overflow-x-auto overflow-y-hidden overscroll-x-contain p-0 pt-1 -mt-1 pb-2 [scrollbar-width:none] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring [&::-webkit-scrollbar]:hidden\"\n >\n {items.map((item, i) => (\n <li key={getId(item)} className=\"w-[9.5rem] shrink-0 snap-start sm:w-44\">\n {renderItem(item, i)}\n </li>\n ))}\n </ul>\n </section>\n );\n}\n"
571
- },
572
- {
573
- "path": "media-grid/video-card-skeleton.tsx",
574
- "content": "// A video card on its way: the same frame, body and footer heights as `VideoCard`, so nothing moves when it arrives.\nimport * as React from \"react\";\n\nimport { Card } from \"../card\";\nimport { cn } from \"../cn\";\nimport { Skeleton } from \"../skeleton\";\nimport type { VideoCardAspect } from \"./video-card\";\n\nexport interface VideoCardSkeletonProps extends React.ComponentProps<\"div\"> {\n /** `landscape` (16:9) or `portrait` (9:16), as the card it stands for. @default \"landscape\" */\n aspect?: VideoCardAspect;\n /** `stack` or `row`, as the card it stands for. @default \"stack\" */\n layout?: \"stack\" | \"row\";\n}\n\nconst FRAME = { landscape: \"aspect-video\", portrait: \"aspect-[9/16]\" } as const;\n\n/** The placeholder of a `VideoCard` (decorative: announce the wait on the list, with `MediaGridSkeleton`). */\nexport function VideoCardSkeleton({ aspect = \"landscape\", layout = \"stack\", className, ...props }: VideoCardSkeletonProps) {\n const row = layout === \"row\";\n const tall = aspect === \"portrait\" && !row;\n return (\n <div aria-hidden data-skeleton=\"video-card\" data-aspect={aspect} data-layout={layout} className={cn(\"h-full min-w-0\", className)} {...props}>\n <Card.Root tone=\"glass\" className={cn(\"h-full w-full max-w-full\", row ? \"flex-row\" : \"flex-col\")}>\n <Card.Media aspect=\"auto\" className={cn(\"shrink-0\", FRAME[aspect], row && (aspect === \"portrait\" ? \"w-24 sm:w-28\" : \"w-40 sm:w-56\"))}>\n <Skeleton shape=\"rect\" className=\"h-full w-full rounded-none\" />\n </Card.Media>\n <Card.Body className=\"static min-w-0 flex-1 justify-between gap-2 p-3\">\n <div className=\"flex min-h-[2.5em] flex-col justify-center gap-1.5\">\n <Skeleton className=\"h-3\" />\n <Skeleton className=\"h-3 w-3/5\" />\n </div>\n <div className={cn(\"flex text-xs\", tall ? \"flex-col gap-1\" : \"h-8 items-center gap-2\")}>\n <div className=\"flex h-6 min-w-0 items-center gap-2\">\n <Skeleton shape=\"circle\" className=\"h-6 w-6 shrink-0\" />\n <Skeleton className=\"h-2.5 w-20\" />\n </div>\n <div className={cn(\"flex items-center\", tall ? \"h-7\" : \"ml-auto\")}>\n <Skeleton className=\"h-2.5 w-14\" />\n </div>\n </div>\n </Card.Body>\n </Card.Root>\n </div>\n );\n}\n\nexport interface MediaGridSkeletonProps extends Omit<React.ComponentProps<\"div\">, \"children\"> {\n /** What is loading, passed translated (\"Loading videos\"): announced once, the cards are hidden from assistive technology. */\n label: string;\n /** Cards in the grid. @default 8 */\n count?: number;\n /** Cards on the Shorts shelf above the grid (`split` mode); 0 for none. @default 0 */\n shelfCount?: number;\n /** `grid` or `list`. @default \"grid\" */\n layout?: \"grid\" | \"list\";\n /** The frame of the grid. @default \"landscape\" */\n frame?: VideoCardAspect;\n}\n\nconst GRID = {\n landscape: \"grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4\",\n portrait: \"grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 xl:grid-cols-6\",\n} as const;\n\n/** The placeholder of a `MediaGrid`: the same shelf and grid, skeleton cards, one polite announcement. */\nexport function MediaGridSkeleton({ label, count = 8, shelfCount = 0, layout = \"grid\", frame = \"landscape\", className, ...props }: MediaGridSkeletonProps) {\n const row = layout === \"list\";\n return (\n <div role=\"status\" aria-busy=\"true\" data-media-grid-skeleton=\"\" className={cn(\"flex min-w-0 flex-col gap-8\", className)} {...props}>\n <span className=\"sr-only\">{label}</span>\n {shelfCount > 0 && (\n <div aria-hidden className=\"min-w-0\">\n <Skeleton className=\"mb-3 h-4 w-24\" />\n <ul className=\"m-0 flex list-none items-stretch gap-3 overflow-hidden p-0\">\n {Array.from({ length: shelfCount }, (_, i) => (\n <li key={i} className=\"w-[9.5rem] shrink-0 sm:w-44\">\n <VideoCardSkeleton aspect=\"portrait\" />\n </li>\n ))}\n </ul>\n </div>\n )}\n <ul aria-hidden className={cn(\"m-0 grid list-none auto-rows-fr gap-4 p-0\", row ? \"grid-cols-1\" : GRID[frame])}>\n {Array.from({ length: count }, (_, i) => (\n <li key={i} className=\"min-w-0\">\n <VideoCardSkeleton aspect={frame} layout={row ? \"row\" : \"stack\"} />\n </li>\n ))}\n </ul>\n </div>\n );\n}\n"
575
- },
576
- {
577
- "path": "media-grid/video-card.tsx",
578
- "content": "// Client (hover / focus swaps the picture for its animated preview). A video in a grid or a shelf: the picture in a 16:9\n// or 9:16 frame (a source of the other shape is shown inside, never stretched), badges, duration, the title on two lines\n// reserved, the creator, a count and one quick action — the same height of body in every card so a row aligns.\nimport * as React from \"react\";\n\nimport { Avatar } from \"../avatar\";\nimport type { DefaultAvatar } from \"../avatar/default-avatar\";\nimport { BlockLink, type LinkComponent } from \"../block-link\";\nimport { Card } from \"../card\";\nimport { cn } from \"../cn\";\nimport { isLeader, subscribeLeader, trackVisibility } from \"./preview-focus\";\n\nexport type VideoCardAspect = \"landscape\" | \"portrait\";\n\nexport interface VideoCardCreator {\n /** The creator's name. */\n name: string;\n /** Their photo. */\n avatarSrc?: string | null;\n /** Their profile. */\n href?: string;\n /** The Krizaka default picture when there is no photo (a brand and a seed). */\n defaultAvatar?: DefaultAvatar;\n}\n\nexport interface VideoCardProps extends Omit<React.ComponentProps<\"article\">, \"title\"> {\n /** The title; it names the card and is its link. */\n title: string;\n /** Where the card opens. */\n href: string;\n /** The app's router link (Next's `Link`). */\n linkAs?: LinkComponent;\n /**\n * The frame: `landscape` (16:9) or `portrait` (9:16).\n * @default \"landscape\"\n */\n aspect?: VideoCardAspect;\n /**\n * `stack` (picture over text) or `row` (picture beside the text: the list mode of a section).\n * @default \"stack\"\n */\n layout?: \"stack\" | \"row\";\n /** The picture. */\n poster?: string | null;\n /**\n * An animated picture (WebP, a few hundred kB) that fades in over the poster once the pointer has rested on the card\n * (or it is focused) for `previewDelay`, and is removed again on leave. It is never requested before. On a phone (no\n * hover) only the card most inside the viewport plays it, unless the person asked for less data or less motion.\n */\n previewSrc?: string | null;\n /**\n * How long the pointer must rest before the preview is requested, in ms: a pointer crossing the grid loads nothing.\n * @default 200\n */\n previewDelay?: number;\n /**\n * `fetchPriority` of the poster: `high` for the first row (the largest contentful paint).\n * @default \"auto\"\n */\n posterPriority?: \"high\" | \"low\" | \"auto\";\n /**\n * `cover` fills the frame; `contain` draws the whole picture over a blurred copy of itself (a source of the other\n * orientation: no cropped face, no black bar).\n * @default \"cover\"\n */\n fit?: \"cover\" | \"contain\";\n /** The length, already formatted (`3:42`). */\n duration?: string;\n /** Badges at the top-left of the picture (Free, a price, 18+). Put them on `scrim` so they read in both themes. */\n badges?: React.ReactNode;\n /** Who made it: name, photo, profile. */\n creator?: VideoCardCreator;\n /** What is counted (`12.4K views`), already formatted. */\n meta?: React.ReactNode;\n /** One quick action at the end of the footer (a tip, a save). Its clicks must not follow the card's link. */\n action?: React.ReactNode;\n /** A sensitive picture: blurred and scaled so nothing shows (put the reveal button in `overlay`). */\n blurred?: boolean;\n /** Over the whole picture, above the card's link (a veil, a reveal button). */\n overlay?: React.ReactNode;\n /** Shown instead of the picture while there is none. */\n fallback?: React.ReactNode;\n /** `eager` for the first cards of a page. */\n loading?: \"lazy\" | \"eager\";\n}\n\nconst FRAME = { landscape: \"aspect-video\", portrait: \"aspect-[9/16]\" } as const;\n\n/** A video card whose frame, body and footer have one height per aspect, so a grid row or a shelf never staggers. */\nexport function VideoCard({\n title,\n href,\n linkAs,\n aspect = \"landscape\",\n layout = \"stack\",\n poster,\n previewSrc,\n previewDelay = 200,\n posterPriority = \"auto\",\n fit = \"cover\",\n duration,\n badges,\n creator,\n meta,\n action,\n fallback,\n blurred = false,\n overlay,\n loading = \"lazy\",\n className,\n onMouseEnter,\n onMouseLeave,\n onFocus,\n onBlur,\n ref,\n ...props\n}: VideoCardProps) {\n const [node, setNode] = React.useState<HTMLElement | null>(null);\n const setRef = React.useCallback(\n (el: HTMLElement | null) => {\n setNode(el);\n if (typeof ref === \"function\") ref(el);\n else if (ref) (ref as React.RefObject<HTMLElement | null>).current = el;\n },\n [ref],\n );\n const canPreview = Boolean(previewSrc) && !blurred;\n const { live, arm, disarm } = usePreviewIntent(node, canPreview, previewDelay);\n const row = layout === \"row\";\n const tall = aspect === \"portrait\" && !row;\n return (\n <article\n ref={setRef}\n data-aspect={aspect}\n data-layout={layout}\n className={cn(\"group relative h-full min-w-0\", className)}\n data-preview={live ? \"on\" : undefined}\n onMouseEnter={(e) => (arm(\"pointer\"), onMouseEnter?.(e))}\n onMouseLeave={(e) => (disarm(\"pointer\"), onMouseLeave?.(e))}\n onFocus={(e) => (arm(\"focus\"), onFocus?.(e))}\n onBlur={(e) => (disarm(\"focus\"), onBlur?.(e))}\n {...props}\n >\n <Card.Root interactive tone=\"glass\" className={cn(\"h-full w-full max-w-full\", row ? \"flex-row\" : \"flex-col\")}>\n <Card.Media aspect=\"auto\" className={cn(\"shrink-0\", FRAME[aspect], row && (aspect === \"portrait\" ? \"w-24 sm:w-28\" : \"w-40 sm:w-56\"))}>\n {fit === \"contain\" && poster && <img src={poster} alt=\"\" aria-hidden loading=\"lazy\" className=\"absolute inset-0 h-full w-full scale-125 object-cover opacity-70 blur-2xl\" />}\n <Card.Image\n src={poster}\n loading={loading}\n fetchPriority={posterPriority === \"auto\" ? undefined : posterPriority}\n fallback={fallback}\n className={cn(fit === \"contain\" && \"relative object-contain\", blurred && \"scale-110 blur-xl\")}\n />\n {live && previewSrc && <PreviewLayer src={previewSrc} contain={fit === \"contain\"} />}\n {overlay && <div className=\"absolute inset-0 z-20 flex\">{overlay}</div>}\n {badges && (\n <Card.Overlay corner=\"top-left\" className=\"theme-dark pointer-events-none flex-wrap\">\n {badges}\n </Card.Overlay>\n )}\n {duration && (\n <Card.Overlay corner=\"bottom-right\" className=\"pointer-events-none\">\n <span className=\"rounded-sm bg-scrim px-1.5 py-0.5 font-mono text-[11px] text-fg-on-media\">{duration}</span>\n </Card.Overlay>\n )}\n </Card.Media>\n {/* `static`: the body must not be the containing block of the title link's ::after, or the link would cover the text only and the picture would not open the video. */}\n <Card.Body className=\"static min-w-0 flex-1 justify-between gap-2 p-3\">\n <h3 className=\"m-0 min-h-[2.5em] text-sm font-semibold leading-tight text-fg\">\n <BlockLink href={href} linkAs={linkAs} className=\"line-clamp-2 outline-none after:absolute after:inset-0 after:z-0 after:content-[''] focus-visible:after:ring-2 focus-visible:after:ring-ring\">\n {title}\n </BlockLink>\n </h3>\n {/* A narrow card (9:16 on a shelf) puts the count and the action on a second line so the name is never cut to an initial. */}\n <div className={cn(\"relative z-10 text-xs text-fg-secondary\", tall ? \"flex flex-col gap-1\" : \"flex h-8 items-center gap-2\")}>\n {creator && (\n <div className=\"flex h-6 min-w-0 items-center gap-2\">\n <Avatar src={creator.avatarSrc} defaultAvatar={creator.defaultAvatar} alt=\"\" fallback={creator.name.charAt(0)} size=\"xs\" className=\"shrink-0\" />\n {creator.href ? (\n <BlockLink href={creator.href} linkAs={linkAs} className=\"min-w-0 truncate hover:text-fg\">\n {creator.name}\n </BlockLink>\n ) : (\n <span className=\"min-w-0 truncate\">{creator.name}</span>\n )}\n </div>\n )}\n {(meta || action) && (\n <div className={cn(\"flex items-center gap-2\", tall ? \"h-7 justify-between\" : \"ml-auto shrink-0\")}>\n {meta && <span className=\"shrink-0 font-mono text-[11px] text-fg-muted\">{meta}</span>}\n {action && <span className=\"shrink-0\">{action}</span>}\n </div>\n )}\n </div>\n </Card.Body>\n </Card.Root>\n </article>\n );\n}\n\n/** The animated preview, fading in over the poster once it has loaded; unmounted (so unloaded) on leave. */\nfunction PreviewLayer({ src, contain }: { src: string; contain: boolean }) {\n const [ready, setReady] = React.useState(false);\n return (\n <img\n src={src}\n alt=\"\"\n aria-hidden\n decoding=\"async\"\n data-preview-layer=\"\"\n data-ready={ready ? \"\" : undefined}\n onLoad={() => setReady(true)}\n className={cn(\"pointer-events-none absolute inset-0 h-full w-full opacity-0 transition-opacity duration-300 data-[ready]:opacity-100 motion-reduce:transition-none\", contain ? \"object-contain\" : \"object-cover\")}\n />\n );\n}\n\ntype Cause = \"pointer\" | \"focus\";\n\nconst matches = (query: string) => typeof window !== \"undefined\" && typeof window.matchMedia === \"function\" && window.matchMedia(query).matches;\nconst hoverCapable = () => matches(\"(hover: hover)\");\nconst saveData = () => typeof navigator !== \"undefined\" && (navigator as Navigator & { connection?: { saveData?: boolean } }).connection?.saveData === true;\n\n/**\n * When the preview is wanted. A desktop pointer or the keyboard focus must rest `delay` ms first; on a phone the card\n * the page shows most (and only one) wants it, never under Save-Data or reduced motion. Leaving clears everything.\n */\nfunction usePreviewIntent(node: HTMLElement | null, enabled: boolean, delay: number) {\n const [causes, setCauses] = React.useState<ReadonlySet<Cause>>(new Set());\n const timers = React.useRef(new Map<Cause, ReturnType<typeof setTimeout>>());\n const arm = React.useCallback(\n (cause: Cause) => {\n if (!enabled || saveData()) return;\n if (cause === \"pointer\" && !hoverCapable()) return;\n clearTimeout(timers.current.get(cause));\n timers.current.set(\n cause,\n setTimeout(() => setCauses((c) => new Set(c).add(cause)), delay),\n );\n },\n [enabled, delay],\n );\n const disarm = React.useCallback((cause: Cause) => {\n clearTimeout(timers.current.get(cause));\n timers.current.delete(cause);\n setCauses((c) => {\n if (!c.has(cause)) return c;\n const next = new Set(c);\n next.delete(cause);\n return next;\n });\n }, []);\n React.useEffect(() => {\n const pending = timers.current;\n return () => {\n for (const t of pending.values()) clearTimeout(t);\n pending.clear();\n };\n }, []);\n\n // A phone: the single most visible card, after the same rest.\n const touch = enabled && !hoverCapable();\n const leading = React.useSyncExternalStore(\n subscribeLeader,\n () => isLeader(node),\n () => false,\n );\n React.useEffect(() => {\n if (!node || !touch) return;\n return trackVisibility(node);\n }, [node, touch]);\n const [ready, setReady] = React.useState(false);\n const [wasLeading, setWasLeading] = React.useState(false);\n if (leading !== wasLeading) {\n setWasLeading(leading);\n if (!leading) setReady(false);\n }\n const wanted = touch && leading && !saveData() && !matches(\"(prefers-reduced-motion: reduce)\");\n React.useEffect(() => {\n if (!wanted) return;\n const t = setTimeout(() => setReady(true), delay);\n return () => clearTimeout(t);\n }, [wanted, delay]);\n\n return { live: enabled && (causes.size > 0 || (wanted && ready)), arm, disarm };\n}\n"
579
- },
580
- {
581
- "path": "meta.ts",
582
- "content": "// The documentation of a component, carried by its code: each primitive has a `meta.ts` beside its source\n// (`src/<name>/meta.ts`; a component that exists only in React Native: `src/native/meta/<name>.ts`). Never built into\n// the package: `scripts/build-registry.mjs` reads them into `registry/<name>.json`, which ui.krizaka.com (apps/site) renders as\n// ui.krizaka.com/components/<name>, and `scripts/registry.test.mjs` fails when one is missing or incomplete.\n//\n// Why a typed module and not JSDoc tags: the fields are lists and links (`related`, `whenNotToUse[].use`, examples),\n// which a type checks and a comment does not; the file is plain data (erasable TypeScript), so Node reads it without a\n// compiler, and an editor completes it.\n\n/** Every documented component: the web primitives (one entry of the package each) and the native-only ones. */\nexport type ComponentName =\n | \"notification-preferences\"\n | \"quota-meter\"\n | \"environment-notice\"\n | \"embed-facade\"\n | \"reviews\"\n | \"margin-layout\"\n | \"analysis-report\"\n | \"status-chip\"\n | \"kind-config-editor\"\n | \"agenda\"\n | \"account-settings\"\n | \"drop-overlay\"\n | \"upload-queue\"\n | \"achievement\"\n | \"anatomy-plate\"\n | \"bird-plate\"\n | \"taped-photo\"\n | \"stuck\"\n | \"doodle\"\n | \"signature\"\n | \"grade-stamp\"\n | \"versus-card\"\n | \"speed-lines\"\n | \"site-cahier\"\n | \"text-style\"\n | \"flock\"\n | \"elephant\"\n | \"footnote\"\n | \"page-index\"\n | \"chapter\"\n | \"specimen-tag\"\n | \"action-bar\"\n | \"action-sheet\"\n | \"activity-feed\"\n | \"alert\"\n | \"app-frame\"\n | \"desktop-window\"\n | \"form-flow\"\n | \"grid\"\n | \"list-detail\"\n | \"state-screen\"\n | \"app-header\"\n | \"app-shell\"\n | \"argument-card\"\n | \"audio-player\"\n | \"auth-layout\"\n | \"avatar\"\n | \"badge\"\n | \"button\"\n | \"captcha\"\n | \"card\"\n | \"card-grid\"\n | \"catalogue-page\"\n | \"changelog-page\"\n | \"chat\"\n | \"checkbox\"\n | \"chip\"\n | \"chip-link\"\n | \"chip-row\"\n | \"choice-grid\"\n | \"cn\"\n | \"code-block\"\n | \"combobox\"\n | \"comparison-table\"\n | \"command\"\n | \"component-page\"\n | \"confirm-button\"\n | \"copy-button\"\n | \"money-input\"\n | \"price-catalogue-editor\"\n | \"promo-code-field\"\n | \"contact-page\"\n | \"continue-prompt\"\n | \"countdown\"\n | \"cover-hero\"\n | \"cta-panel\"\n | \"dashboard-layout\"\n | \"data-table\"\n | \"date-picker\"\n | \"decision-list\"\n | \"description-list\"\n | \"detail-layout\"\n | \"dialog\"\n | \"docs-article-page\"\n | \"docs-hub-page\"\n | \"docs-layout\"\n | \"docs-nav\"\n | \"document-viewer\"\n | \"dropdown-menu\"\n | \"empty-state\"\n | \"engine-flow\"\n | \"error-page\"\n | \"fab\"\n | \"field\"\n | \"file-upload\"\n | \"filter-bar\"\n | \"force-update-screen\"\n | \"form\"\n | \"gallery-page\"\n | \"genui\"\n | \"glossary\"\n | \"glossary-term\"\n | \"glow-card\"\n | \"goal-gauge\"\n | \"header\"\n | \"how-it-works-page\"\n | \"image-cropper\"\n | \"image-viewer\"\n | \"iso\"\n | \"kanban\"\n | \"kbd\"\n | \"kpi-explained\"\n | \"landing-page\"\n | \"landscape\"\n | \"legal-page\"\n | \"link-card\"\n | \"list\"\n | \"loader\"\n | \"longform-page\"\n | \"maintenance-screen\"\n | \"map\"\n | \"markdown\"\n | \"meta-row\"\n | \"waveform\"\n | \"proposal\"\n | \"qr-code\"\n | \"entity-header\"\n | \"collection-switcher\"\n | \"marketing-layout\"\n | \"marquee\"\n | \"mascot-quote\"\n | \"mascot-state\"\n | \"mascots\"\n | \"match-dialog\"\n | \"media-capture\"\n | \"media-grid\"\n | \"language-switch\"\n | \"media-gallery\"\n | \"media-picker\"\n | \"meter\"\n | \"nav-bar\"\n | \"number-ticker\"\n | \"onboarding\"\n | \"opening-hours\"\n | \"otp-input\"\n | \"page\"\n | \"page-header\"\n | \"page-hero\"\n | \"pagination\"\n | \"permission-prompt\"\n | \"photo-grid\"\n | \"pointer-light\"\n | \"popover\"\n | \"pricing-page\"\n | \"product-page\"\n | \"profile-card\"\n | \"progress\"\n | \"promise-card\"\n | \"pull-to-refresh\"\n | \"retro-tv\"\n | \"shop-gallery\"\n | \"radio-group\"\n | \"router\"\n | \"rail-nav\"\n | \"recipes\"\n | \"screen\"\n | \"scroll-stage\"\n | \"search-field\"\n | \"section-backdrop\"\n | \"segmented\"\n | \"separator\"\n | \"service-card\"\n | \"shop\"\n | \"shop-composer\"\n | \"schema-form\"\n | \"settings-layout\"\n | \"account-menu\"\n | \"showcase\"\n | \"step-showcase\"\n | \"site-footer\"\n | \"sites\"\n | \"skeleton\"\n | \"skip-link\"\n | \"slider\"\n | \"slot-picker\"\n | \"slot\"\n | \"spinner\"\n | \"sticky-action\"\n | \"splash-handoff\"\n | \"split-view\"\n | \"stage-banner\"\n | \"stat\"\n | \"usage\"\n | \"status-page\"\n | \"step-progress\"\n | \"stepper\"\n | \"swipe-deck\"\n | \"swipeable-row\"\n | \"switch\"\n | \"tab-bar\"\n | \"tabs\"\n | \"tag-input\"\n | \"tag-selector\"\n | \"terminal-replay\"\n | \"theme\"\n | \"toast\"\n | \"toc\"\n | \"tooltip\"\n | \"tree-view\"\n | \"txt\"\n | \"update-prompt\"\n | \"verified-badge\"\n | \"vertical-video\"\n | \"video-player\"\n | \"video-trimmer\"\n | \"virtual\"\n | \"wall\";\n\n/** Where a component exists: `@krizaka/ui/<name>` (web), `@krizaka/ui/native` (React Native), or both. */\nexport type Platform = \"web\" | \"native\" | \"both\";\n\n/**\n * Why a component is not on a platform — a decision, never a silence (the parity matrix of ui.krizaka.com/platforms):\n * - `gap` (✗): it belongs there and is not built yet; `issue` is the issue that tracks it (`krizaka/krizaka-ui#275`);\n * - `n/a`: it is not meant for that platform (a site's page block on a phone, a swipe on a desktop); `use` names the\n * component that answers there, when one does.\n */\nexport type Absence =\n | { readonly status: \"gap\"; readonly issue: string; readonly reason: string; readonly use?: undefined }\n | { readonly status: \"n/a\"; readonly reason: string; readonly use?: ComponentName; readonly issue?: undefined };\n\n/**\n * Desktop is the Orazaka Mac app (Tauri 2: the system WebView renders the web components — ADR-002). `web`: the web\n * component runs there as it is; `desktop`: it also has a desktop form (a window's title bar, a denser layout…), said in\n * its documentation; otherwise the absence and why.\n */\nexport type DesktopSupport = \"web\" | \"desktop\" | Absence;\n\n/**\n * The three platforms of Krizaka UI — web · native (React Native, Expo) · desktop — for one component. The side a\n * component has is `platforms`; the side it lacks says why here: `native` is required for (and only for) a web-only\n * component, `web` for a native-only one; `desktop` always. `scripts/registry.test.mjs` fails on a missing decision.\n */\nexport interface Parity {\n readonly web?: Absence;\n readonly native?: Absence;\n readonly desktop: DesktopSupport;\n}\n\n/**\n * `experimental`: created for a filed need (ADR-008 §4), it may change or go in any minor until its first consumer imports it; `adoption`\n * names that consumer's issue. `stable`: its API only changes in a major. `beta`: it may still change in a minor. `deprecated`: no product uses it and\n * no work plans to — it still works, says what replaces it, and goes in the major named by `deprecated.removedIn`.\n */\nexport type Status = \"experimental\" | \"stable\" | \"beta\" | \"deprecated\";\n\n/**\n * What a component is for (ADR-008 §3): the twelve domains the documentation, the size budgets and the guards are\n * organised by. The domain is metadata: the entries stay flat (`@krizaka/ui/<name>`). `cahier` is the sites' register\n * (ADR-004): a product never imports it.\n */\nexport type Domain =\n | \"foundations\"\n | \"forms\"\n | \"data-display\"\n | \"navigation-shell\"\n | \"feedback\"\n | \"maps\"\n | \"media\"\n | \"commerce\"\n | \"identity\"\n | \"conversation\"\n | \"page-blocks\"\n | \"cahier\";\n\n/** What a deprecated component says (required when `status` is `deprecated`, absent otherwise). */\nexport interface Deprecation {\n /** The version that deprecated it (`3.6.0`). */\n readonly since: string;\n /** The major that removes it (`4.0.0`). */\n readonly removedIn: string;\n /** What replaces it, when a component does. */\n readonly use?: ComponentName;\n /** Why it goes: no product uses it, no planned work needs it. */\n readonly reason: string;\n}\n\n/**\n * The group of the catalogue. `media`: video, sound, camera, files, cropping. `blocks`: the page blocks — the frame,\n * the hero, sections, cards that lead or argue, decisions, code, calls to act — that every page of a site is made of.\n * `layouts`: the shells of whole screens — an application, a dashboard, settings, sign-in, an object, a list and its\n * item, a site's page, a documentation page — each with its screens. `templates`: the page templates — whole pages of a\n * site (a landing, a product, a docs hub, a long read, a changelog, pricing, status, an error…), each a distinct\n * composition of the blocks, words and content as props.\n */\nexport type Category = \"actions\" | \"forms\" | \"navigation\" | \"overlays\" | \"feedback\" | \"data-display\" | \"media\" | \"blocks\" | \"layouts\" | \"templates\" | \"layout\" | \"foundations\";\n\n/** Why a reader needs a template: the seven intents the templates are grouped by (sidebar sub-headings, catalogue filter). */\nexport type TemplatePurpose = \"convince\" | \"explain\" | \"show\" | \"act\" | \"operate\" | \"converse\" | \"recover\";\n\n/** The groups of templates, in reading order: the title, and the one line that says when to come to that group. */\nexport const templatePurposes = {\n convince: { title: \"Convince\", useWhen: \"You come here when a visitor must decide: a landing, a product, a price, a comparison, a proof.\" },\n explain: { title: \"Explain\", useWhen: \"You come here when a reader must understand: how it works, a documentation hub or article, a changelog, a FAQ, a policy.\" },\n show: { title: \"Show\", useWhen: \"You come here when the work itself is the argument: a gallery, a story, a case study, an object and its details.\" },\n act: { title: \"Act\", useWhen: \"You come here when a person must do something once: reach the team, sign in or up, set up, pay.\" },\n operate: { title: \"Operate\", useWhen: \"You come here when a person works every day: a dashboard, a console with a table, settings, an app shell.\" },\n converse: { title: \"Converse\", useWhen: \"You come here when people talk: an inbox, a chat, comments, a notifications centre.\" },\n recover: { title: \"Recover\", useWhen: \"You come here when the way is blocked: an empty list, an error, a missing page, maintenance, a product still being built.\" },\n} as const satisfies Record<TemplatePurpose, { readonly title: string; readonly useWhen: string }>;\n\n/**\n * A named example: the file `registry/examples/<component>/<name>.tsx` (web) or\n * `registry/examples/<component>/native/<name>.tsx` (React Native) — at most 40 lines, imported by the stories and\n * shown (live, with its code) by the documentation.\n */\ninterface ExampleBase {\n /** The file name, kebab-case (`primary`, `icon-button`). */\n readonly name: string;\n /** A short title (`Primary`, `Icon button`). */\n readonly title: string;\n /** One or two sentences: when this variant is the right one. */\n readonly description: string;\n}\n\n/** A plain example, or a template: a whole screen with its intent (`purpose`) and the user goal its layout serves (`why`). */\nexport type Example =\n | (ExampleBase & { readonly template?: false; readonly purpose?: undefined; readonly why?: undefined })\n | (ExampleBase & {\n /**\n * A template: a whole screen of a product composed from the platform (a layout and its blocks, real words, its\n * phone version thought out), copied as a starting point — at most 160 lines, listed on ui.krizaka.com/templates.\n */\n readonly template: true;\n /** The intent that groups it: why you need this block. */\n readonly purpose: TemplatePurpose;\n /** Why this layout: the user goal it serves, in one sentence. */\n readonly why: string;\n });\n\n/** One platform's side of a component. */\nexport interface PlatformDocs {\n /** The names to import (`[\"Button\", \"IconButton\"]`): from `@krizaka/ui/<name>` on the web, `@krizaka/ui/native` in React Native. */\n readonly imports: readonly string[];\n /** The examples, in reading order; the first one is the component's preview. */\n readonly examples: readonly Example[];\n}\n\n/** The React Native side: the same concept, and what differs from the web API. */\nexport interface NativeDocs extends PlatformDocs {\n /**\n * The entry to import from when it is not `@krizaka/ui/native`: a component that needs an Expo module (an optional\n * peer) has its own, `@krizaka/ui/native/<name>`, so an app that does not use it never installs the module.\n */\n readonly entry?: string;\n /** What differs from the web API (`label` instead of children…); empty for a native-only component. */\n readonly differences: readonly string[];\n /** The React Native entry alone is deprecated while the web one stays (ADR-006 §7); a deprecated component says it once, above. */\n readonly deprecated?: Deprecation;\n}\n\nexport interface KeyboardInteraction {\n /** The keys, as written on a keyboard: `Space`, `Enter`, `Arrow keys`, `Esc`, `Tab`. */\n readonly keys: string;\n /** What they do. */\n readonly action: string;\n}\n\nexport interface ComponentMeta {\n /** The display name: `Button`, `Dropdown menu`. */\n readonly title: string;\n /** One sentence: what it is. */\n readonly summary: string;\n readonly status: Status;\n /** Required for, and only for, a `deprecated` component. */\n readonly deprecated?: Deprecation;\n readonly category: Category;\n /** What it is for: one of the twelve domains (ADR-008 §3). */\n readonly domain: Domain;\n /** The `<repo>#<n>` issue of its first consumer: required for, and only for, an `experimental` component. */\n readonly adoption?: string;\n /** Must match the sides below: `both` ⇔ `web` and `native`. */\n readonly platforms: Platform;\n /** The platforms it is not on, and why; and its desktop form (see `Parity`). */\n readonly parity: Parity;\n /** When to reach for it: concrete situations, one per item. */\n readonly whenToUse: readonly string[];\n /** When not to — and what to use instead (`use`), when another component is the answer. */\n readonly whenNotToUse: readonly { readonly when: string; readonly use?: ComponentName }[];\n /** How to use it well: wording, placement, composition. */\n readonly bestPractices: readonly string[];\n readonly accessibility: {\n /** The keyboard, when it does more than Tab and Enter. */\n readonly keyboard: readonly KeyboardInteraction[];\n /** Roles, names and announcements: what the component does, what the app must provide. */\n readonly notes: readonly string[];\n };\n /** The components a reader of this page should know about. */\n readonly related: readonly ComponentName[];\n readonly web?: PlatformDocs;\n readonly native?: NativeDocs;\n}\n"
583
- }
584
- ],
585
- "dependencies": [],
586
- "registryDependencies": [
587
- "avatar",
588
- "button",
589
- "card",
590
- "cn",
591
- "skeleton",
592
- "spinner"
593
- ],
594
- "demo": {
595
- "path": "examples/media-grid/feed.tsx",
596
- "content": "\"use client\";\n\nimport { Badge } from \"@krizaka/ui/badge\";\nimport { MediaGrid, VideoCard } from \"@krizaka/ui/media-grid\";\n\nconst CDN = \"https://krizaka-assets.b-cdn.net/site\";\nconst WIDE = `${CDN}/products/orazaka/gallery`;\nconst TALL = `${CDN}/docs/orochia/mobile`;\nconst CLIPS = [\n { id: \"tea\", title: \"Pouring the mint tea, slow\", poster: `${WIDE}/tea-pour.d69c3a5700.webp`, tall: false },\n { id: \"story\", title: \"Backstage, a minute before\", poster: `${TALL}/clip-feed-stories-poster.fd7835fa74.webp`, tall: true },\n { id: \"snow\", title: \"First snow on rue Saint-Denis\", poster: `${WIDE}/mtl-snow.e3ecb20e82.webp`, tall: false },\n { id: \"watch\", title: \"The unlock in one tap\", poster: `${TALL}/clip-watch-poster.9fc5d19c39.webp`, tall: true },\n { id: \"desert\", title: \"Desert camp at blue hour\", poster: `${WIDE}/desert-camp.78c6c0d26c.webp`, tall: false },\n { id: \"thanks\", title: \"Three ways to say thanks\", poster: `${TALL}/clip-unlock-poster.57e13fee5f.webp`, tall: true },\n];\n\n// 'split' (the feed default): vertical clips on a Shorts shelf, the others in a 16:9 grid whose cards share one height.\nexport default function MediaGridFeed() {\n return (\n <MediaGrid\n items={CLIPS}\n getId={(c) => c.id}\n orientationOf={(c) => (c.tall ? \"portrait\" : \"landscape\")}\n shelf={{ label: \"Shorts\", previousLabel: \"Previous shorts\", nextLabel: \"Next shorts\", seeAll: { href: \"#shorts\", label: \"See all\" } }}\n renderItem={(c, { aspect, layout }) => (\n <VideoCard href={`#${c.id}`} title={c.title} aspect={aspect} layout={layout} poster={c.poster} duration=\"0:12\" meta=\"12.4K views\" creator={{ name: \"Camille\" }} badges={<Badge tone=\"success\" size=\"sm\" className=\"bg-scrim\">Free</Badge>} />\n )}\n />\n );\n}\n"
597
- },
598
- "props": [
599
- {
600
- "component": "LoadMore",
601
- "description": "Infinite scroll with a visible \"Load more\" under it.",
602
- "props": [
603
- {
604
- "name": "hasMore",
605
- "type": "boolean",
606
- "default": null,
607
- "description": "There is a next page.",
608
- "required": true
609
- },
610
- {
611
- "name": "label",
612
- "type": "string",
613
- "default": null,
614
- "description": "The button, passed translated (\"Load more\").",
615
- "required": true
616
- },
617
- {
618
- "name": "loadingLabel",
619
- "type": "string",
620
- "default": null,
621
- "description": "The wait, passed translated (\"Loading more videos\").",
622
- "required": true
623
- },
624
- {
625
- "name": "onLoadMore",
626
- "type": "() => void",
627
- "default": null,
628
- "description": "Asks for the next page. Not called while `loading`, nor once `hasMore` is false.",
629
- "required": true
630
- },
631
- {
632
- "name": "endLabel",
633
- "type": "string",
634
- "default": null,
635
- "description": "Shown instead of the button when the list is over, passed translated (\"You have seen everything\"). Nothing if absent.",
636
- "required": false
637
- },
638
- {
639
- "name": "failed",
640
- "type": "boolean",
641
- "default": "false",
642
- "description": "The last page failed: the button reads `retryLabel`, and nothing loads by itself until it is pressed.",
643
- "required": false
644
- },
645
- {
646
- "name": "loading",
647
- "type": "boolean",
648
- "default": "false",
649
- "description": "A page is on its way.",
650
- "required": false
651
- },
652
- {
653
- "name": "retryLabel",
654
- "type": "string",
655
- "default": null,
656
- "description": "The button after a failure, passed translated (\"Try again\"). Defaults to `label`.",
657
- "required": false
658
- },
659
- {
660
- "name": "rootMargin",
661
- "type": "string",
662
- "default": "900px 0px",
663
- "description": "How far below the viewport the page is already requested (an IntersectionObserver `rootMargin`).",
664
- "required": false
665
- }
666
- ]
667
- },
668
- {
669
- "component": "MediaGrid",
670
- "description": "A media grid that never mixes heights badly: a shelf for the 9:16, a uniform grid for the rest.",
671
- "props": [
672
- {
673
- "name": "getId",
674
- "type": "(item: T) => string",
675
- "default": null,
676
- "description": "A stable key for an item.",
677
- "required": true
678
- },
679
- {
680
- "name": "items",
681
- "type": "readonly T[]",
682
- "default": null,
683
- "description": "The videos, in order.",
684
- "required": true
685
- },
686
- {
687
- "name": "orientationOf",
688
- "type": "(item: T) => VideoCardAspect",
689
- "default": null,
690
- "description": "The source's orientation (from its width and height).",
691
- "required": true
692
- },
693
- {
694
- "name": "renderItem",
695
- "type": "(item: T, state: MediaGridState) => ReactNode",
696
- "default": null,
697
- "description": "One card, drawn in the frame the grid gives (`state`): use `VideoCard`.",
698
- "required": true
699
- },
700
- {
701
- "name": "shelf",
702
- "type": "Pick<ShortsShelfProps<unknown>, \"label\" | \"title\" | \"hint\" | \"seeAll\" | \"previousLabel\" | \"nextLabel\">",
703
- "default": null,
704
- "description": "The shelf of `split`: its name, \"See all\" and arrows, passed translated.",
705
- "required": true
706
- },
707
- {
708
- "name": "frame",
709
- "type": "VideoCardAspect",
710
- "default": "landscape",
711
- "description": "The frame of `uniform`.",
712
- "required": false
713
- },
714
- {
715
- "name": "grid",
716
- "type": "{ label: string; hint?: SectionHintProps; }",
717
- "default": null,
718
- "description": "A heading for the grid of the others (“Videos”), in the style of the shelf's, with an optional definition.",
719
- "required": false
720
- },
721
- {
722
- "name": "layout",
723
- "type": "\"grid\" | \"list\"",
724
- "default": "grid",
725
- "description": "`grid` or `list` (one row per video).",
726
- "required": false
727
- },
728
- {
729
- "name": "mode",
730
- "type": "\"split\" | \"uniform\"",
731
- "default": "split",
732
- "description": "`split`: verticals on the shelf, the others in the grid · `uniform`: all in one frame (`frame`).",
733
- "required": false
734
- }
735
- ]
736
- },
737
- {
738
- "component": "SectionHint",
739
- "description": "The definition of a section, one tap away from its heading.",
740
- "props": [
741
- {
742
- "name": "label",
743
- "type": "string",
744
- "default": null,
745
- "description": "The button's accessible name, passed translated (“What are Shorts?”).",
746
- "required": true
747
- },
748
- {
749
- "name": "text",
750
- "type": "string",
751
- "default": null,
752
- "description": "The definition, in one line.",
753
- "required": true
754
- },
755
- {
756
- "name": "link",
757
- "type": "{ href: string; label: string; linkAs?: LinkComponent; }",
758
- "default": null,
759
- "description": "A link to the full definition (the glossary).",
760
- "required": false
761
- }
762
- ]
763
- },
764
- {
765
- "component": "ShortsShelf",
766
- "description": "A Shorts shelf: equal-height 9:16 cards in a snap-scrolling row.",
767
- "props": [
768
- {
769
- "name": "getId",
770
- "type": "(item: T) => string",
771
- "default": null,
772
- "description": "A stable key for an item.",
773
- "required": true
774
- },
775
- {
776
- "name": "items",
777
- "type": "readonly T[]",
778
- "default": null,
779
- "description": "The clips, in order.",
780
- "required": true
781
- },
782
- {
783
- "name": "label",
784
- "type": "string",
785
- "default": null,
786
- "description": "The shelf's accessible name (\"Shorts\"), passed translated; shown as its heading unless `title` is set.",
787
- "required": true
788
- },
789
- {
790
- "name": "nextLabel",
791
- "type": "string",
792
- "default": null,
793
- "description": "The next arrow's name.",
794
- "required": true
795
- },
796
- {
797
- "name": "previousLabel",
798
- "type": "string",
799
- "default": null,
800
- "description": "The arrows' names, passed translated.",
801
- "required": true
802
- },
803
- {
804
- "name": "renderItem",
805
- "type": "(item: T, index: number) => ReactNode",
806
- "default": null,
807
- "description": "One card: use `VideoCard aspect=\"portrait\"`.",
808
- "required": true
809
- },
810
- {
811
- "name": "hint",
812
- "type": "SectionHintProps",
813
- "default": null,
814
- "description": "A small “i” beside the heading: the one-line definition of the section and a link to the glossary.",
815
- "required": false
816
- },
817
- {
818
- "name": "seeAll",
819
- "type": "{ href: string; label: string; linkAs?: LinkComponent; }",
820
- "default": null,
821
- "description": "Opens the vertical feed.",
822
- "required": false
823
- },
824
- {
825
- "name": "title",
826
- "type": "ReactNode",
827
- "default": null,
828
- "description": "A heading different from the name.",
829
- "required": false
830
- }
831
- ]
832
- },
833
- {
834
- "component": "VideoCard",
835
- "description": "A video card whose frame, body and footer have one height per aspect, so a grid row or a shelf never staggers.",
836
- "props": [
837
- {
838
- "name": "href",
839
- "type": "string",
840
- "default": null,
841
- "description": "Where the card opens.",
842
- "required": true
843
- },
844
- {
845
- "name": "title",
846
- "type": "string",
847
- "default": null,
848
- "description": "The title; it names the card and is its link.",
849
- "required": true
850
- },
851
- {
852
- "name": "action",
853
- "type": "ReactNode",
854
- "default": null,
855
- "description": "One quick action at the end of the footer (a tip, a save). Its clicks must not follow the card's link.",
856
- "required": false
857
- },
858
- {
859
- "name": "aspect",
860
- "type": "VideoCardAspect",
861
- "default": "landscape",
862
- "description": "The frame: `landscape` (16:9) or `portrait` (9:16).",
863
- "required": false
864
- },
865
- {
866
- "name": "badges",
867
- "type": "ReactNode",
868
- "default": null,
869
- "description": "Badges at the top-left of the picture (Free, a price, 18+). Put them on `scrim` so they read in both themes.",
870
- "required": false
871
- },
872
- {
873
- "name": "blurred",
874
- "type": "boolean",
875
- "default": "false",
876
- "description": "A sensitive picture: blurred and scaled so nothing shows (put the reveal button in `overlay`).",
877
- "required": false
878
- },
879
- {
880
- "name": "creator",
881
- "type": "VideoCardCreator",
882
- "default": null,
883
- "description": "Who made it: name, photo, profile.",
884
- "required": false
885
- },
886
- {
887
- "name": "duration",
888
- "type": "string",
889
- "default": null,
890
- "description": "The length, already formatted (`3:42`).",
891
- "required": false
892
- },
893
- {
894
- "name": "fallback",
895
- "type": "ReactNode",
896
- "default": null,
897
- "description": "Shown instead of the picture while there is none.",
898
- "required": false
899
- },
900
- {
901
- "name": "fit",
902
- "type": "\"cover\" | \"contain\"",
903
- "default": "cover",
904
- "description": "`cover` fills the frame; `contain` draws the whole picture over a blurred copy of itself (a source of the other\norientation: no cropped face, no black bar).",
905
- "required": false
906
- },
907
- {
908
- "name": "layout",
909
- "type": "\"row\" | \"stack\"",
910
- "default": "stack",
911
- "description": "`stack` (picture over text) or `row` (picture beside the text: the list mode of a section).",
912
- "required": false
913
- },
914
- {
915
- "name": "linkAs",
916
- "type": "LinkComponent",
917
- "default": null,
918
- "description": "The app's router link (Next's `Link`).",
919
- "required": false
920
- },
921
- {
922
- "name": "loading",
923
- "type": "\"eager\" | \"lazy\"",
924
- "default": "lazy",
925
- "description": "`eager` for the first cards of a page.",
926
- "required": false
927
- },
928
- {
929
- "name": "meta",
930
- "type": "ReactNode",
931
- "default": null,
932
- "description": "What is counted (`12.4K views`), already formatted.",
933
- "required": false
934
- },
935
- {
936
- "name": "overlay",
937
- "type": "ReactNode",
938
- "default": null,
939
- "description": "Over the whole picture, above the card's link (a veil, a reveal button).",
940
- "required": false
941
- },
942
- {
943
- "name": "poster",
944
- "type": "string | null",
945
- "default": null,
946
- "description": "The picture.",
947
- "required": false
948
- },
949
- {
950
- "name": "posterPriority",
951
- "type": "\"auto\" | \"high\" | \"low\"",
952
- "default": "auto",
953
- "description": "`fetchPriority` of the poster: `high` for the first row (the largest contentful paint).",
954
- "required": false
955
- },
956
- {
957
- "name": "previewDelay",
958
- "type": "number",
959
- "default": "200",
960
- "description": "How long the pointer must rest before the preview is requested, in ms: a pointer crossing the grid loads nothing.",
961
- "required": false
962
- },
963
- {
964
- "name": "previewSrc",
965
- "type": "string | null",
966
- "default": null,
967
- "description": "An animated picture (WebP, a few hundred kB) that fades in over the poster once the pointer has rested on the card\n(or it is focused) for `previewDelay`, and is removed again on leave. It is never requested before. On a phone (no\nhover) only the card most inside the viewport plays it, unless the person asked for less data or less motion.",
968
- "required": false
969
- }
970
- ]
971
- },
972
- {
973
- "component": "MediaGridSkeleton",
974
- "description": "The placeholder of a `MediaGrid`: the same shelf and grid, skeleton cards, one polite announcement.",
975
- "props": [
976
- {
977
- "name": "label",
978
- "type": "string",
979
- "default": null,
980
- "description": "What is loading, passed translated (\"Loading videos\"): announced once, the cards are hidden from assistive technology.",
981
- "required": true
982
- },
983
- {
984
- "name": "count",
985
- "type": "number",
986
- "default": "8",
987
- "description": "Cards in the grid.",
988
- "required": false
989
- },
990
- {
991
- "name": "frame",
992
- "type": "VideoCardAspect",
993
- "default": "landscape",
994
- "description": "The frame of the grid.",
995
- "required": false
996
- },
997
- {
998
- "name": "layout",
999
- "type": "\"grid\" | \"list\"",
1000
- "default": "grid",
1001
- "description": "`grid` or `list`.",
1002
- "required": false
1003
- },
1004
- {
1005
- "name": "shelfCount",
1006
- "type": "number",
1007
- "default": "0",
1008
- "description": "Cards on the Shorts shelf above the grid (`split` mode); 0 for none.",
1009
- "required": false
1010
- }
1011
- ]
1012
- },
1013
- {
1014
- "component": "VideoCardSkeleton",
1015
- "description": "The placeholder of a `VideoCard` (decorative: announce the wait on the list, with `MediaGridSkeleton`).",
1016
- "props": [
1017
- {
1018
- "name": "aspect",
1019
- "type": "VideoCardAspect",
1020
- "default": "landscape",
1021
- "description": "`landscape` (16:9) or `portrait` (9:16), as the card it stands for.",
1022
- "required": false
1023
- },
1024
- {
1025
- "name": "layout",
1026
- "type": "\"row\" | \"stack\"",
1027
- "default": "stack",
1028
- "description": "`stack` or `row`, as the card it stands for.",
1029
- "required": false
1030
- }
1031
- ]
1032
- }
1033
- ]
1034
- }