@slotted/react 0.1.0-beta.42 → 0.1.0-beta.43

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 (298) hide show
  1. package/dist/{app-shell-D54YkU7E.js → app-shell-DsWhsSMU.js} +3 -2
  2. package/dist/app-shell.js +1 -1
  3. package/dist/attachment-TZykYNu5.js +300 -0
  4. package/dist/attachment.js +2 -2
  5. package/dist/{avatar-group-bJaZE1_C.js → avatar-group-Bzmmj2HI.js} +2 -1
  6. package/dist/avatar-group.js +1 -1
  7. package/dist/{carousel-B9nMK7Yf.js → carousel-CRNz-T3g.js} +1 -1
  8. package/dist/carousel.js +1 -1
  9. package/dist/{command-palette-C90CzfQi.js → command-palette-Bgf5tfCI.js} +160 -156
  10. package/dist/command-palette.js +1 -1
  11. package/dist/{data-grid-D106baPp.js → data-grid-DUft3rJb.js} +1 -1
  12. package/dist/data-grid.js +1 -1
  13. package/dist/{data-list-BA0xrySM.js → data-list-Dv3orBtf.js} +15 -15
  14. package/dist/data-list.js +1 -1
  15. package/dist/detail-panel-Cke3ZFU3.js +342 -0
  16. package/dist/detail-panel.js +2 -2
  17. package/dist/docs/action-bar.examples.md +768 -0
  18. package/dist/docs/action-bar.json +74 -50
  19. package/dist/docs/action-bar.md +49 -311
  20. package/dist/docs/app-shell.examples.md +1221 -64
  21. package/dist/docs/app-shell.json +92 -60
  22. package/dist/docs/app-shell.md +92 -57
  23. package/dist/docs/attachment.examples.md +689 -0
  24. package/dist/docs/attachment.json +69 -37
  25. package/dist/docs/attachment.md +44 -203
  26. package/dist/docs/avatar-group.json +111 -23
  27. package/dist/docs/avatar-group.md +487 -28
  28. package/dist/docs/button-group.json +98 -2
  29. package/dist/docs/button-group.md +411 -8
  30. package/dist/docs/calendar.examples.md +512 -0
  31. package/dist/docs/calendar.json +72 -24
  32. package/dist/docs/calendar.md +18 -147
  33. package/dist/docs/carousel.examples.md +868 -0
  34. package/dist/docs/carousel.json +58 -50
  35. package/dist/docs/carousel.md +66 -300
  36. package/dist/docs/cascader.examples.md +1269 -0
  37. package/dist/docs/cascader.json +72 -16
  38. package/dist/docs/cascader.md +78 -154
  39. package/dist/docs/chart.examples.md +734 -24
  40. package/dist/docs/chart.json +93 -13
  41. package/dist/docs/chart.md +28 -7
  42. package/dist/docs/clock.json +71 -15
  43. package/dist/docs/clock.md +326 -21
  44. package/dist/docs/code-block.json +79 -55
  45. package/dist/docs/code-block.md +417 -74
  46. package/dist/docs/color-picker.json +60 -12
  47. package/dist/docs/color-picker.md +245 -22
  48. package/dist/docs/column-manager.examples.md +764 -0
  49. package/dist/docs/column-manager.json +68 -12
  50. package/dist/docs/column-manager.md +44 -203
  51. package/dist/docs/command-palette.examples.md +747 -0
  52. package/dist/docs/command-palette.json +48 -24
  53. package/dist/docs/command-palette.md +60 -339
  54. package/dist/docs/currency-field.examples.md +355 -73
  55. package/dist/docs/currency-field.json +96 -64
  56. package/dist/docs/currency-field.md +57 -50
  57. package/dist/docs/dashboard-grid.examples.md +629 -0
  58. package/dist/docs/dashboard-grid.json +64 -16
  59. package/dist/docs/dashboard-grid.md +34 -152
  60. package/dist/docs/data-list.examples.md +1556 -0
  61. package/dist/docs/data-list.json +58 -18
  62. package/dist/docs/data-list.md +139 -224
  63. package/dist/docs/date-field.examples.md +543 -0
  64. package/dist/docs/date-field.json +64 -24
  65. package/dist/docs/date-field.md +22 -168
  66. package/dist/docs/datetime-field.examples.md +699 -0
  67. package/dist/docs/datetime-field.json +79 -31
  68. package/dist/docs/datetime-field.md +24 -269
  69. package/dist/docs/datetime-range-picker.examples.md +682 -0
  70. package/dist/docs/datetime-range-picker.json +117 -61
  71. package/dist/docs/datetime-range-picker.md +59 -224
  72. package/dist/docs/description-list.examples.md +652 -0
  73. package/dist/docs/description-list.json +49 -25
  74. package/dist/docs/description-list.md +33 -188
  75. package/dist/docs/detail-panel.examples.md +1177 -0
  76. package/dist/docs/detail-panel.json +69 -53
  77. package/dist/docs/detail-panel.md +114 -324
  78. package/dist/docs/entity-picker.examples.md +1037 -0
  79. package/dist/docs/entity-picker.json +66 -18
  80. package/dist/docs/entity-picker.md +56 -246
  81. package/dist/docs/event-calendar.examples.md +749 -49
  82. package/dist/docs/event-calendar.json +46 -22
  83. package/dist/docs/event-calendar.md +81 -11
  84. package/dist/docs/field-group.examples.md +554 -0
  85. package/dist/docs/field-group.json +98 -34
  86. package/dist/docs/field-group.md +55 -133
  87. package/dist/docs/filter-bar.examples.md +772 -0
  88. package/dist/docs/filter-bar.json +41 -25
  89. package/dist/docs/filter-bar.md +42 -246
  90. package/dist/docs/form.examples.md +579 -0
  91. package/dist/docs/form.json +87 -39
  92. package/dist/docs/form.md +53 -177
  93. package/dist/docs/fullscreen.examples.md +558 -0
  94. package/dist/docs/fullscreen.json +58 -18
  95. package/dist/docs/fullscreen.md +50 -169
  96. package/dist/docs/highlight.json +57 -25
  97. package/dist/docs/highlight.md +402 -50
  98. package/dist/docs/icon.json +85 -5
  99. package/dist/docs/icon.md +401 -10
  100. package/dist/docs/image.examples.md +670 -0
  101. package/dist/docs/image.json +44 -28
  102. package/dist/docs/image.md +24 -176
  103. package/dist/docs/import-export-center.examples.md +1280 -0
  104. package/dist/docs/import-export-center.json +67 -27
  105. package/dist/docs/import-export-center.md +121 -226
  106. package/dist/docs/list-item.examples.md +769 -0
  107. package/dist/docs/list-item.json +110 -38
  108. package/dist/docs/list-item.md +84 -201
  109. package/dist/docs/listbox.examples.md +858 -0
  110. package/dist/docs/listbox.json +76 -28
  111. package/dist/docs/listbox.md +41 -263
  112. package/dist/docs/markdown.json +79 -55
  113. package/dist/docs/markdown.md +581 -85
  114. package/dist/docs/media-viewer.examples.md +1038 -0
  115. package/dist/docs/media-viewer.json +70 -15
  116. package/dist/docs/media-viewer.md +84 -135
  117. package/dist/docs/message-scroller.examples.md +1193 -0
  118. package/dist/docs/message-scroller.json +41 -17
  119. package/dist/docs/message-scroller.md +80 -134
  120. package/dist/docs/message.examples.md +944 -0
  121. package/dist/docs/message.json +64 -16
  122. package/dist/docs/message.md +34 -326
  123. package/dist/docs/meter.json +58 -26
  124. package/dist/docs/meter.md +312 -32
  125. package/dist/docs/navigation-menu.examples.md +1107 -0
  126. package/dist/docs/navigation-menu.json +57 -41
  127. package/dist/docs/navigation-menu.md +105 -298
  128. package/dist/docs/notification-center.examples.md +1045 -0
  129. package/dist/docs/notification-center.json +71 -15
  130. package/dist/docs/notification-center.md +76 -266
  131. package/dist/docs/otp-input.examples.md +490 -0
  132. package/dist/docs/otp-input.json +65 -25
  133. package/dist/docs/otp-input.md +20 -191
  134. package/dist/docs/page-header.examples.md +1041 -0
  135. package/dist/docs/page-header.json +75 -43
  136. package/dist/docs/page-header.md +79 -291
  137. package/dist/docs/page.examples.md +633 -0
  138. package/dist/docs/page.json +48 -16
  139. package/dist/docs/page.md +62 -129
  140. package/dist/docs/prompt-composer.examples.md +630 -0
  141. package/dist/docs/prompt-composer.json +66 -18
  142. package/dist/docs/prompt-composer.md +35 -161
  143. package/dist/docs/prose.json +69 -37
  144. package/dist/docs/prose.md +393 -75
  145. package/dist/docs/rating.examples.md +525 -0
  146. package/dist/docs/rating.json +92 -28
  147. package/dist/docs/rating.md +27 -241
  148. package/dist/docs/saved-views.examples.md +1108 -0
  149. package/dist/docs/saved-views.json +53 -21
  150. package/dist/docs/saved-views.md +86 -171
  151. package/dist/docs/scroll-area.examples.md +837 -0
  152. package/dist/docs/scroll-area.json +64 -24
  153. package/dist/docs/scroll-area.md +57 -140
  154. package/dist/docs/section.examples.md +676 -0
  155. package/dist/docs/section.json +68 -20
  156. package/dist/docs/section.md +39 -162
  157. package/dist/docs/segmented-control.examples.md +480 -0
  158. package/dist/docs/segmented-control.json +76 -28
  159. package/dist/docs/segmented-control.md +20 -191
  160. package/dist/docs/side-navigation.examples.md +1468 -0
  161. package/dist/docs/side-navigation.json +53 -53
  162. package/dist/docs/side-navigation.md +79 -354
  163. package/dist/docs/slider.examples.md +505 -0
  164. package/dist/docs/slider.json +91 -51
  165. package/dist/docs/slider.md +47 -212
  166. package/dist/docs/sparkline.json +60 -36
  167. package/dist/docs/sparkline.md +447 -71
  168. package/dist/docs/split-button.examples.md +509 -0
  169. package/dist/docs/split-button.json +73 -41
  170. package/dist/docs/split-button.md +64 -194
  171. package/dist/docs/splitter.examples.md +921 -0
  172. package/dist/docs/splitter.json +94 -46
  173. package/dist/docs/splitter.md +75 -182
  174. package/dist/docs/stat-card.examples.md +725 -0
  175. package/dist/docs/stat-card.json +89 -41
  176. package/dist/docs/stat-card.md +55 -227
  177. package/dist/docs/status-indicator.json +80 -32
  178. package/dist/docs/status-indicator.md +409 -65
  179. package/dist/docs/stepper.json +53 -21
  180. package/dist/docs/stepper.md +369 -48
  181. package/dist/docs/table-of-contents.examples.md +550 -0
  182. package/dist/docs/table-of-contents.json +60 -28
  183. package/dist/docs/table-of-contents.md +70 -205
  184. package/dist/docs/tags-input.examples.md +541 -0
  185. package/dist/docs/tags-input.json +64 -16
  186. package/dist/docs/tags-input.md +15 -262
  187. package/dist/docs/time-field.examples.md +587 -0
  188. package/dist/docs/time-field.json +69 -29
  189. package/dist/docs/time-field.md +21 -223
  190. package/dist/docs/time-picker.json +117 -53
  191. package/dist/docs/time-picker.md +499 -54
  192. package/dist/docs/time-range-picker.examples.md +750 -0
  193. package/dist/docs/time-range-picker.json +139 -75
  194. package/dist/docs/time-range-picker.md +63 -225
  195. package/dist/docs/timeline.examples.md +617 -0
  196. package/dist/docs/timeline.json +44 -28
  197. package/dist/docs/timeline.md +34 -208
  198. package/dist/docs/toolbar.json +56 -16
  199. package/dist/docs/toolbar.md +357 -63
  200. package/dist/docs/top-navigation.examples.md +1206 -140
  201. package/dist/docs/top-navigation.json +49 -33
  202. package/dist/docs/top-navigation.md +87 -36
  203. package/dist/docs/tour.examples.md +960 -0
  204. package/dist/docs/tour.json +57 -25
  205. package/dist/docs/tour.md +60 -244
  206. package/dist/docs/transfer.examples.md +631 -0
  207. package/dist/docs/transfer.json +80 -16
  208. package/dist/docs/transfer.md +41 -170
  209. package/dist/docs/typography.json +96 -0
  210. package/dist/docs/typography.md +352 -4
  211. package/dist/docs/upload.examples.md +555 -53
  212. package/dist/docs/upload.json +62 -30
  213. package/dist/docs/upload.md +46 -11
  214. package/dist/docs/wizard.examples.md +1389 -0
  215. package/dist/docs/wizard.json +89 -49
  216. package/dist/docs/wizard.md +122 -263
  217. package/dist/{entity-picker-CC4VoC3p.js → entity-picker-C78f3Z0o.js} +9 -6
  218. package/dist/entity-picker.js +1 -1
  219. package/dist/{event-calendar-CjmF_e0H.js → event-calendar-DJPoCi-O.js} +1 -1
  220. package/dist/event-calendar.js +1 -1
  221. package/dist/{filter-bar-B3QJD7SZ.js → filter-bar-D61wiQFP.js} +1 -1
  222. package/dist/filter-bar.js +1 -1
  223. package/dist/{import-export-center-CW8YVZev.js → import-export-center-mqvmlzwB.js} +44 -36
  224. package/dist/import-export-center.js +1 -1
  225. package/dist/index.js +58 -58
  226. package/dist/{markdown-BdskE4-L.js → markdown-8CtV4k44.js} +2 -2
  227. package/dist/markdown.js +1 -1
  228. package/dist/{media-viewer-zEXcwfEY.js → media-viewer-C_cbuAq-.js} +64 -60
  229. package/dist/media-viewer.js +2 -2
  230. package/dist/message-P91bEGyV.js +455 -0
  231. package/dist/message.js +2 -2
  232. package/dist/{page-header-DmwBGwlm.js → page-header-jeAIQSZM.js} +103 -108
  233. package/dist/page-header.js +1 -1
  234. package/dist/section-CVTQdWBl.js +216 -0
  235. package/dist/section.js +2 -2
  236. package/dist/{segmented-control-CbK7SurB.js → segmented-control-BSMVjukr.js} +1 -1
  237. package/dist/segmented-control.js +1 -1
  238. package/dist/{side-navigation-CKRETc8E.js → side-navigation-BQzBxz2B.js} +179 -179
  239. package/dist/side-navigation.js +1 -1
  240. package/dist/{stat-card-CL3Xe6pV.js → stat-card-BpGZiFbG.js} +12 -14
  241. package/dist/stat-card.js +1 -1
  242. package/dist/{stepper-DHdrANZI.js → stepper-Cxb_tHnA.js} +130 -127
  243. package/dist/stepper.js +2 -2
  244. package/dist/styles/carousel.css +1 -1
  245. package/dist/styles/index.css +1 -1
  246. package/dist/styles.css +1 -1
  247. package/dist/{timeline-BiL2CXfn.js → timeline-ZngK6zLC.js} +9 -6
  248. package/dist/timeline.js +1 -1
  249. package/dist/top-navigation-YSEQzBhD.js +744 -0
  250. package/dist/top-navigation.js +2 -2
  251. package/dist/{transfer-sKUvmEKe.js → transfer-Cv5yQuTN.js} +1 -1
  252. package/dist/transfer.js +1 -1
  253. package/dist/types/attachment/attachment-parts.d.ts +24 -11
  254. package/dist/types/attachment/attachment-parts.d.ts.map +1 -1
  255. package/dist/types/attachment/attachment.d.ts +3 -3
  256. package/dist/types/attachment/attachment.d.ts.map +1 -1
  257. package/dist/types/avatar-group/avatar-group.d.ts.map +1 -1
  258. package/dist/types/carousel/carousel-parts.d.ts +2 -2
  259. package/dist/types/command-palette/command-palette.d.ts.map +1 -1
  260. package/dist/types/data-list/data-list.d.ts.map +1 -1
  261. package/dist/types/detail-panel/detail-panel-parts.d.ts +10 -3
  262. package/dist/types/detail-panel/detail-panel-parts.d.ts.map +1 -1
  263. package/dist/types/detail-panel/detail-panel.d.ts.map +1 -1
  264. package/dist/types/detail-panel/detail-panel.types.d.ts +7 -0
  265. package/dist/types/detail-panel/detail-panel.types.d.ts.map +1 -1
  266. package/dist/types/entity-picker/entity-picker.d.ts.map +1 -1
  267. package/dist/types/import-export-center/import-export-center.d.ts.map +1 -1
  268. package/dist/types/media-viewer/index.d.ts +2 -2
  269. package/dist/types/media-viewer/index.d.ts.map +1 -1
  270. package/dist/types/media-viewer/media-viewer-bar.d.ts +3 -1
  271. package/dist/types/media-viewer/media-viewer-bar.d.ts.map +1 -1
  272. package/dist/types/media-viewer/media-viewer.types.d.ts +1 -0
  273. package/dist/types/media-viewer/media-viewer.types.d.ts.map +1 -1
  274. package/dist/types/message/message-parts.d.ts +7 -0
  275. package/dist/types/message/message-parts.d.ts.map +1 -1
  276. package/dist/types/message/message.d.ts.map +1 -1
  277. package/dist/types/page-header/page-header-parts.d.ts.map +1 -1
  278. package/dist/types/section/section-parts.d.ts +16 -8
  279. package/dist/types/section/section-parts.d.ts.map +1 -1
  280. package/dist/types/section/section.d.ts.map +1 -1
  281. package/dist/types/segmented-control/segmented-control-parts.d.ts.map +1 -1
  282. package/dist/types/side-navigation/side-navigation-parts.d.ts.map +1 -1
  283. package/dist/types/stat-card/stat-card-delta.d.ts.map +1 -1
  284. package/dist/types/stat-card/stat-card-parts.d.ts +3 -3
  285. package/dist/types/stat-card/stat-card-parts.d.ts.map +1 -1
  286. package/dist/types/stepper/stepper-parts.d.ts +11 -2
  287. package/dist/types/stepper/stepper-parts.d.ts.map +1 -1
  288. package/dist/types/stepper/stepper.d.ts.map +1 -1
  289. package/dist/types/timeline/timeline-parts.d.ts.map +1 -1
  290. package/dist/types/top-navigation/top-navigation.d.ts.map +1 -1
  291. package/dist/{wizard-4c0X7Bx_.js → wizard-Dfryz1id.js} +214 -214
  292. package/dist/wizard.js +1 -1
  293. package/package.json +6 -6
  294. package/dist/attachment-MqczA38F.js +0 -292
  295. package/dist/detail-panel-EImAtksY.js +0 -327
  296. package/dist/message-D1Dd6Y2k.js +0 -452
  297. package/dist/section-D_qOfdxR.js +0 -213
  298. package/dist/top-navigation-D8IHPOmm.js +0 -744
@@ -67,7 +67,7 @@
67
67
  "docs": {
68
68
  "mediaViewer": {
69
69
  "imports": {
70
- "source": "import { MediaViewer, MediaViewerActions, MediaViewerBar, MediaViewerCaption, MediaViewerClose, MediaViewerDefaultsProvider, MediaViewerDownload, MediaViewerNext, MediaViewerPosition, MediaViewerPrevious, MediaViewerStage, MediaViewerThumbnails, MediaViewerTitle, MediaViewerZoom } from '@slotted/react';"
70
+ "source": "import { MediaViewer, MediaViewerActions, MediaViewerBar, MediaViewerCaption, MediaViewerClose, MediaViewerDefaultsProvider, MediaViewerDownload, MediaViewerHeading, MediaViewerNext, MediaViewerPosition, MediaViewerPrevious, MediaViewerStage, MediaViewerThumbnails, MediaViewerTitle, MediaViewerZoom } from '@slotted/react';"
71
71
  },
72
72
  "anatomy": [
73
73
  {
@@ -363,7 +363,14 @@
363
363
  {
364
364
  "name": "children",
365
365
  "type": "ReactNode",
366
- "defaultValue": "close, title, position, actions",
366
+ "defaultValue": "the title and the position",
367
+ "appliesTo": "MediaViewerHeading",
368
+ "description": "The column’s own content"
369
+ },
370
+ {
371
+ "name": "children",
372
+ "type": "ReactNode",
373
+ "defaultValue": "heading, actions, close",
367
374
  "appliesTo": "MediaViewerBar",
368
375
  "description": "The bar’s own arrangement"
369
376
  },
@@ -402,7 +409,7 @@
402
409
  "type": "handler",
403
410
  "defaultValue": "—",
404
411
  "appliesTo": "close, previous, next",
405
- "description": "Composed: the page handler runs first and preventDefault refuses the family behavior"
412
+ "description": "Composed: the page handler runs first and preventDefault refuses the viewer’s own behavior"
406
413
  },
407
414
  {
408
415
  "name": "useMediaViewer",
@@ -438,7 +445,7 @@
438
445
  "The layer is dialog’s: focus enters it, Tab stays inside, Escape and the platform’s back close it, and focus returns to the opener.",
439
446
  "The dialog is named by the file’s title and described by its position, so a reader hears “police-report.pdf, 3 of 5” when it opens; a step announces the new name and position politely.",
440
447
  "Focus lands on the stage rather than on the close button, because the content is the picture; the stage is named by the file and takes the arrows, plus, minus, zero and R.",
441
- "The family’s keys give way inside a video, an audio, a frame or a field, whose own keys win; Ctrl and Meta combinations stay the browser’s zoom. A text file keeps the arrows that scroll it.",
448
+ "The viewer’s keys give way inside a video, an audio, a frame or a field, whose own keys win; Ctrl and Meta combinations stay the browser’s zoom. A text file keeps the arrows that scroll it.",
442
449
  "A text file is fetched and set as text, never executed, so an HTML file shows its source; the stage holding it scrolls under a finger as a document does.",
443
450
  "Every control is a real button with a name from the catalog, and the level is an output that is not live, so the zoom does not chatter at every wheel event.",
444
451
  "The viewer draws the dark scheme on its dark ground in light and dark, and keeps the high-contrast scheme when the reader chose it."
@@ -512,47 +519,47 @@
512
519
  "title": "Zoom around a point",
513
520
  "note": "The wheel zooms around the point under the pointer by distance, so a trackpad’s many small events do not jump to the maximum. Drag to pan; double-click returns to the fit.",
514
521
  "language": "tsx",
515
- "source": "<MediaViewer items={files} defaultOpen minZoom={1} maxZoom={8} zoomStep={0.5} />;\n",
516
- "verdict": "excerpt"
522
+ "source": "import { Button } from '@slotted/react/button';\nimport { Inline } from '@slotted/react/inline';\nimport { MediaViewer, type MediaViewerItem } from '@slotted/react/media-viewer';\nimport { useState } from 'react';\n\nconst photo = (width: number, height: number, sky: string, crate: string) =>\n 'data:image/svg+xml,' +\n encodeURIComponent(\n `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${String(width)}\" height=\"${String(height)}\">` +\n `<rect width=\"100%\" height=\"100%\" fill=\"${sky}\"/>` +\n `<rect y=\"${String(height * 0.7)}\" width=\"100%\" height=\"${String(height * 0.3)}\" fill=\"#4b5563\"/>` +\n `<rect x=\"${String(width * 0.3)}\" y=\"${String(height * 0.4)}\" width=\"${String(width * 0.4)}\" height=\"${String(height * 0.3)}\" fill=\"${crate}\"/>` +\n '</svg>',\n );\n\nconst FRONT: MediaViewerItem = {\n id: 'front',\n name: 'pallet-front.jpg',\n type: 'image/jpeg',\n src: photo(2400, 1600, '#bfdbfe', '#c2410c'),\n caption: 'Front face of pallet 7: two crushed corners.',\n downloadHref: '#pallet-front.jpg',\n};\n\nconst REAR: MediaViewerItem = {\n id: 'rear',\n name: 'pallet-rear.jpg',\n type: 'image/jpeg',\n src: photo(1200, 1600, '#e0e7ff', '#9a3412'),\n caption: 'Rear face, taken on the dock.',\n downloadHref: '#pallet-rear.jpg',\n};\n\nconst LABEL: MediaViewerItem = {\n id: 'label',\n name: 'carrier-label.jpg',\n type: 'image/jpeg',\n src: photo(320, 200, '#fde68a', '#78350f'),\n downloadHref: '#carrier-label.jpg',\n};\n\nconst PHOTOS = [FRONT, REAR, LABEL];\n\nexport default function MediaViewerZoomExample() {\n const [open, setOpen] = useState(false);\n const [value, setValue] = useState('front');\n\n function handleOpen(id: string) {\n setValue(id);\n setOpen(true);\n }\n\n return (\n <>\n <Inline gap={2}>\n {PHOTOS.map((file) => (\n <Button\n key={file.id}\n onClick={() => handleOpen(file.id)}\n size=\"sm\"\n tone=\"secondary\"\n variant=\"outline\"\n >\n {file.name}\n </Button>\n ))}\n </Inline>\n <MediaViewer\n items={PHOTOS}\n open={open}\n onOpenChange={setOpen}\n value={value}\n onValueChange={setValue}\n maxZoom={8}\n zoomStep={0.5}\n />\n </>\n );\n}\n",
523
+ "verdict": "example"
517
524
  },
518
525
  {
519
526
  "id": "kinds",
520
527
  "title": "A photograph, a PDF, a JSON export and a spreadsheet",
521
528
  "note": "The PDF opens in the browser’s own reader; the JSON export is read as text, indented and never executed, as a log, a CSV or source would be. A spreadsheet the browser cannot draw gets its tile, a sentence and the download.",
522
529
  "language": "tsx",
523
- "source": "const files = [\n { id: 'front', name: 'front.jpg', type: 'image/jpeg', src: frontUrl },\n { id: 'report', name: 'police-report.pdf', type: 'application/pdf', src: reportUrl },\n { id: 'export', name: 'claim-0914.json', type: 'application/json', src: exportUrl },\n { id: 'estimate', name: 'estimate.xlsx', type: '', src: estimateUrl, downloadHref: estimateUrl },\n];\n",
524
- "verdict": "excerpt"
530
+ "source": "import { Button } from '@slotted/react/button';\nimport { Inline } from '@slotted/react/inline';\nimport { MediaViewer, type MediaViewerItem } from '@slotted/react/media-viewer';\nimport { useState } from 'react';\n\nconst photo = (width: number, height: number, sky: string, crate: string) =>\n 'data:image/svg+xml,' +\n encodeURIComponent(\n `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${String(width)}\" height=\"${String(height)}\">` +\n `<rect width=\"100%\" height=\"100%\" fill=\"${sky}\"/>` +\n `<rect y=\"${String(height * 0.7)}\" width=\"100%\" height=\"${String(height * 0.3)}\" fill=\"#4b5563\"/>` +\n `<rect x=\"${String(width * 0.3)}\" y=\"${String(height * 0.4)}\" width=\"${String(width * 0.4)}\" height=\"${String(height * 0.3)}\" fill=\"${crate}\"/>` +\n '</svg>',\n );\n\nconst FRONT: MediaViewerItem = {\n id: 'front',\n name: 'pallet-front.jpg',\n type: 'image/jpeg',\n src: photo(2400, 1600, '#bfdbfe', '#c2410c'),\n caption: 'Front face of pallet 7: two crushed corners.',\n downloadHref: '#pallet-front.jpg',\n};\n\nconst PDF_SOURCE = `%PDF-1.4\n1 0 obj<</Type/Catalog/Pages 2 0 R>>endobj\n2 0 obj<</Type/Pages/Kids[3 0 R]/Count 1>>endobj\n3 0 obj<</Type/Page/Parent 2 0 R/MediaBox[0 0 595 842]/Contents 4 0 R/Resources<</Font<</F1 5 0 R>>>>>>endobj\n4 0 obj<</Length 150>>stream\nBT /F1 22 Tf 72 760 Td (Carrier damage report SH-20418) Tj 0 -36 Td /F1 12 Tf (Two pallets crushed at the Rotterdam dock.) Tj ET\nendstream endobj\n5 0 obj<</Type/Font/Subtype/Type1/BaseFont/Helvetica>>endobj\ntrailer<</Root 1 0 R>>\n%%EOF`;\n\nconst REPORT: MediaViewerItem = {\n id: 'report',\n name: 'carrier-report.pdf',\n type: 'application/pdf',\n src: `data:application/pdf;base64,${btoa(PDF_SOURCE)}`,\n};\n\nconst EXPORT = JSON.stringify({\n shipment: 'SH-20418',\n carrier: 'Harbor Freight',\n delivered: '2026-09-13',\n pallets: 12,\n damaged: [7, 9],\n estimate: { parts: 1840.5, labour: 960, currency: 'EUR' },\n});\n\nconst EXPORT_ITEM: MediaViewerItem = {\n id: 'export',\n name: 'shipment-20418.json',\n type: 'application/json',\n src: `data:application/json,${encodeURIComponent(EXPORT)}`,\n};\n\nconst SHEET: MediaViewerItem = {\n id: 'estimate',\n name: 'damage-estimate.xlsx',\n type: '',\n src: '#damage-estimate.xlsx',\n downloadHref: '#damage-estimate.xlsx',\n};\n\nconst FILES = [FRONT, REPORT, EXPORT_ITEM, SHEET];\n\nexport default function MediaViewerKindsExample() {\n const [open, setOpen] = useState(false);\n const [value, setValue] = useState('front');\n\n function handleOpen(id: string) {\n setValue(id);\n setOpen(true);\n }\n\n return (\n <>\n <Inline gap={2}>\n {FILES.map((file) => (\n <Button\n key={file.id}\n onClick={() => handleOpen(file.id)}\n size=\"sm\"\n tone=\"secondary\"\n variant=\"outline\"\n >\n {file.name}\n </Button>\n ))}\n </Inline>\n <MediaViewer\n items={FILES}\n open={open}\n onOpenChange={setOpen}\n value={value}\n onValueChange={setValue}\n />\n </>\n );\n}\n",
531
+ "verdict": "example"
525
532
  },
526
533
  {
527
534
  "id": "states",
528
535
  "title": "A picture that fails to load",
529
536
  "note": "The photograph’s address no longer answers: the stage says what happened and offers to try again or to download, and the zoom pill leaves because there is nothing to zoom.",
530
537
  "language": "tsx",
531
- "source": "const scan = { id: 'scan', name: 'scan.png', type: 'image/png', src, width: 2480, height: 3508 };\n",
532
- "verdict": "excerpt"
538
+ "source": "import { Button } from '@slotted/react/button';\nimport { Inline } from '@slotted/react/inline';\nimport { MediaViewer, type MediaViewerItem } from '@slotted/react/media-viewer';\nimport { useState } from 'react';\n\nconst photo = (width: number, height: number, sky: string, crate: string) =>\n 'data:image/svg+xml,' +\n encodeURIComponent(\n `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${String(width)}\" height=\"${String(height)}\">` +\n `<rect width=\"100%\" height=\"100%\" fill=\"${sky}\"/>` +\n `<rect y=\"${String(height * 0.7)}\" width=\"100%\" height=\"${String(height * 0.3)}\" fill=\"#4b5563\"/>` +\n `<rect x=\"${String(width * 0.3)}\" y=\"${String(height * 0.4)}\" width=\"${String(width * 0.4)}\" height=\"${String(height * 0.3)}\" fill=\"${crate}\"/>` +\n '</svg>',\n );\n\nconst FRONT: MediaViewerItem = {\n id: 'front',\n name: 'pallet-front.jpg',\n type: 'image/jpeg',\n src: photo(2400, 1600, '#bfdbfe', '#c2410c'),\n caption: 'Front face of pallet 7: two crushed corners.',\n downloadHref: '#pallet-front.jpg',\n};\n\nconst BROKEN: MediaViewerItem = {\n id: 'broken',\n name: 'pallet-side.jpg',\n type: 'image/jpeg',\n src: 'data:image/jpeg;base64,AAAA',\n downloadHref: '#pallet-side.jpg',\n};\n\nconst REAR: MediaViewerItem = {\n id: 'rear',\n name: 'pallet-rear.jpg',\n type: 'image/jpeg',\n src: photo(1200, 1600, '#e0e7ff', '#9a3412'),\n caption: 'Rear face, taken on the dock.',\n downloadHref: '#pallet-rear.jpg',\n};\n\nconst FILES = [FRONT, BROKEN, REAR];\n\nexport default function MediaViewerStatesExample() {\n const [open, setOpen] = useState(false);\n const [value, setValue] = useState('front');\n\n function handleOpen(id: string) {\n setValue(id);\n setOpen(true);\n }\n\n return (\n <>\n <Inline gap={2}>\n {FILES.map((file) => (\n <Button\n key={file.id}\n onClick={() => handleOpen(file.id)}\n size=\"sm\"\n tone=\"secondary\"\n variant=\"outline\"\n >\n {file.name}\n </Button>\n ))}\n </Inline>\n <MediaViewer\n items={FILES}\n open={open}\n onOpenChange={setOpen}\n value={value}\n onValueChange={setValue}\n />\n </>\n );\n}\n",
539
+ "verdict": "example"
533
540
  },
534
541
  {
535
542
  "id": "content",
536
543
  "title": "A long name and a set of one",
537
544
  "note": "A scanner’s name is cut in the middle so the extension stays; the whole name is in the tooltip and the accessible name. A single file draws no steps and no position.",
538
545
  "language": "tsx",
539
- "source": "<MediaViewer items={[scan]} defaultOpen />;\n",
540
- "verdict": "excerpt"
546
+ "source": "import { Button } from '@slotted/react/button';\nimport { Inline } from '@slotted/react/inline';\nimport { MediaViewer, type MediaViewerItem } from '@slotted/react/media-viewer';\nimport { useState } from 'react';\n\nconst photo = (width: number, height: number, sky: string, crate: string) =>\n 'data:image/svg+xml,' +\n encodeURIComponent(\n `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${String(width)}\" height=\"${String(height)}\">` +\n `<rect width=\"100%\" height=\"100%\" fill=\"${sky}\"/>` +\n `<rect y=\"${String(height * 0.7)}\" width=\"100%\" height=\"${String(height * 0.3)}\" fill=\"#4b5563\"/>` +\n `<rect x=\"${String(width * 0.3)}\" y=\"${String(height * 0.4)}\" width=\"${String(width * 0.4)}\" height=\"${String(height * 0.3)}\" fill=\"${crate}\"/>` +\n '</svg>',\n );\n\nconst SCAN: MediaViewerItem = {\n id: 'scan',\n name: 'scan_2026-09-14_delivery-note_consignee-signature_page-1-of-3_final.png',\n type: 'image/png',\n src: photo(1240, 1754, '#f5f5f4', '#d6d3d1'),\n width: 1240,\n height: 1754,\n};\n\nconst FILES = [SCAN];\n\nexport default function MediaViewerContentExample() {\n const [open, setOpen] = useState(false);\n const [value, setValue] = useState('scan');\n\n function handleOpen(id: string) {\n setValue(id);\n setOpen(true);\n }\n\n return (\n <>\n <Inline gap={2}>\n {FILES.map((file) => (\n <Button\n key={file.id}\n onClick={() => handleOpen(file.id)}\n size=\"sm\"\n tone=\"secondary\"\n variant=\"outline\"\n >\n {file.name}\n </Button>\n ))}\n </Inline>\n <MediaViewer\n items={FILES}\n open={open}\n onOpenChange={setOpen}\n value={value}\n onValueChange={setValue}\n />\n </>\n );\n}\n",
547
+ "verdict": "example"
541
548
  },
542
549
  {
543
550
  "id": "thumbnails",
544
551
  "title": "A strip of the set",
545
552
  "note": "Composed under the stage: the current photograph is framed and the others dimmed until the pointer reaches them. A press steps straight to that file.",
546
553
  "language": "tsx",
547
- "source": "<MediaViewer items={files} defaultOpen>\n <MediaViewerBar />\n <MediaViewerStage />\n <MediaViewerPrevious />\n <MediaViewerNext />\n <MediaViewerZoom />\n <MediaViewerCaption />\n <MediaViewerThumbnails aria-label=\"Claim photographs\" />\n</MediaViewer>;\n",
548
- "verdict": "excerpt"
554
+ "source": "import { Button } from '@slotted/react/button';\nimport { Inline } from '@slotted/react/inline';\nimport {\n MediaViewer,\n MediaViewerBar,\n MediaViewerCaption,\n MediaViewerNext,\n MediaViewerPrevious,\n MediaViewerStage,\n MediaViewerThumbnails,\n MediaViewerZoom,\n type MediaViewerItem,\n} from '@slotted/react/media-viewer';\nimport { useState } from 'react';\n\nconst photo = (width: number, height: number, sky: string, crate: string) =>\n 'data:image/svg+xml,' +\n encodeURIComponent(\n `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${String(width)}\" height=\"${String(height)}\">` +\n `<rect width=\"100%\" height=\"100%\" fill=\"${sky}\"/>` +\n `<rect y=\"${String(height * 0.7)}\" width=\"100%\" height=\"${String(height * 0.3)}\" fill=\"#4b5563\"/>` +\n `<rect x=\"${String(width * 0.3)}\" y=\"${String(height * 0.4)}\" width=\"${String(width * 0.4)}\" height=\"${String(height * 0.3)}\" fill=\"${crate}\"/>` +\n '</svg>',\n );\n\nconst FRONT: MediaViewerItem = {\n id: 'front',\n name: 'pallet-front.jpg',\n type: 'image/jpeg',\n src: photo(2400, 1600, '#bfdbfe', '#c2410c'),\n caption: 'Front face of pallet 7: two crushed corners.',\n downloadHref: '#pallet-front.jpg',\n};\n\nconst REAR: MediaViewerItem = {\n id: 'rear',\n name: 'pallet-rear.jpg',\n type: 'image/jpeg',\n src: photo(1200, 1600, '#e0e7ff', '#9a3412'),\n caption: 'Rear face, taken on the dock.',\n downloadHref: '#pallet-rear.jpg',\n};\n\nconst LABEL: MediaViewerItem = {\n id: 'label',\n name: 'carrier-label.jpg',\n type: 'image/jpeg',\n src: photo(320, 200, '#fde68a', '#78350f'),\n downloadHref: '#carrier-label.jpg',\n};\n\nconst PHOTOS = [FRONT, REAR, LABEL];\n\nexport default function MediaViewerThumbnailsExample() {\n const [open, setOpen] = useState(false);\n const [value, setValue] = useState('front');\n\n function handleOpen(id: string) {\n setValue(id);\n setOpen(true);\n }\n\n return (\n <>\n <Inline gap={2}>\n {PHOTOS.map((file) => (\n <Button\n key={file.id}\n onClick={() => handleOpen(file.id)}\n size=\"sm\"\n tone=\"secondary\"\n variant=\"outline\"\n >\n {file.name}\n </Button>\n ))}\n </Inline>\n <MediaViewer\n items={PHOTOS}\n open={open}\n onOpenChange={setOpen}\n value={value}\n onValueChange={setValue}\n >\n <MediaViewerBar />\n <MediaViewerStage />\n <MediaViewerPrevious />\n <MediaViewerNext />\n <MediaViewerZoom />\n <MediaViewerCaption />\n <MediaViewerThumbnails aria-label=\"Shipment photographs\" />\n </MediaViewer>\n </>\n );\n}\n",
555
+ "verdict": "example"
549
556
  },
550
557
  {
551
558
  "id": "composition",
552
559
  "title": "Actions of the product, defaults of the application",
553
560
  "note": "The bar takes the product’s own controls beside the download. A provider sets the limits, the loop and the words once for every viewer under it.",
554
561
  "language": "tsx",
555
- "source": "<MediaViewerDefaultsProvider maxZoom={6} loop>\n <MediaViewer items={files} defaultOpen>\n <MediaViewerBar>\n <MediaViewerClose />\n <MediaViewerTitle />\n <MediaViewerActions>\n <Button onClick={share}>Share</Button>\n <MediaViewerDownload />\n </MediaViewerActions>\n </MediaViewerBar>\n <MediaViewerStage />\n </MediaViewer>\n</MediaViewerDefaultsProvider>;\n",
562
+ "source": "<MediaViewerDefaultsProvider maxZoom={6} loop>\n <MediaViewer items={files} defaultOpen>\n <MediaViewerBar>\n <MediaViewerHeading />\n <MediaViewerActions>\n <Button onClick={share}>Share</Button>\n <MediaViewerDownload />\n </MediaViewerActions>\n <MediaViewerClose />\n </MediaViewerBar>\n <MediaViewerStage />\n </MediaViewer>\n</MediaViewerDefaultsProvider>;\n",
556
563
  "verdict": "excerpt"
557
564
  },
558
565
  {
@@ -570,6 +577,54 @@
570
577
  "language": "tsx",
571
578
  "source": "<MediaViewer items={files} defaultOpen />;\n",
572
579
  "verdict": "excerpt"
580
+ },
581
+ {
582
+ "id": "actions",
583
+ "title": "actions.tsx",
584
+ "note": null,
585
+ "language": "tsx",
586
+ "source": "import { Button } from '@slotted/react/button';\nimport { Inline } from '@slotted/react/inline';\nimport {\n MediaViewer,\n MediaViewerActions,\n MediaViewerBar,\n MediaViewerClose,\n MediaViewerDownload,\n MediaViewerHeading,\n MediaViewerNext,\n MediaViewerPrevious,\n MediaViewerStage,\n MediaViewerZoom,\n type MediaViewerItem,\n} from '@slotted/react/media-viewer';\nimport { Stack } from '@slotted/react/stack';\nimport { Text } from '@slotted/react/typography';\nimport { useState } from 'react';\n\nconst photo = (width: number, height: number, sky: string, crate: string) =>\n 'data:image/svg+xml,' +\n encodeURIComponent(\n `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${String(width)}\" height=\"${String(height)}\">` +\n `<rect width=\"100%\" height=\"100%\" fill=\"${sky}\"/>` +\n `<rect y=\"${String(height * 0.7)}\" width=\"100%\" height=\"${String(height * 0.3)}\" fill=\"#4b5563\"/>` +\n `<rect x=\"${String(width * 0.3)}\" y=\"${String(height * 0.4)}\" width=\"${String(width * 0.4)}\" height=\"${String(height * 0.3)}\" fill=\"${crate}\"/>` +\n '</svg>',\n );\n\nconst FRONT: MediaViewerItem = {\n id: 'front',\n name: 'pallet-front.jpg',\n type: 'image/jpeg',\n src: photo(2400, 1600, '#bfdbfe', '#c2410c'),\n caption: 'Front face of pallet 7: two crushed corners.',\n downloadHref: '#pallet-front.jpg',\n};\n\nconst REAR: MediaViewerItem = {\n id: 'rear',\n name: 'pallet-rear.jpg',\n type: 'image/jpeg',\n src: photo(1200, 1600, '#e0e7ff', '#9a3412'),\n caption: 'Rear face, taken on the dock.',\n downloadHref: '#pallet-rear.jpg',\n};\n\nconst LABEL: MediaViewerItem = {\n id: 'label',\n name: 'carrier-label.jpg',\n type: 'image/jpeg',\n src: photo(320, 200, '#fde68a', '#78350f'),\n downloadHref: '#carrier-label.jpg',\n};\n\nconst PHOTOS = [FRONT, REAR, LABEL];\n\nexport default function MediaViewerActionsExample() {\n const [open, setOpen] = useState(false);\n const [value, setValue] = useState('front');\n const [flagged, setFlagged] = useState('No photograph flagged for the claim.');\n\n function handleFlag() {\n const file = PHOTOS.find((photo) => photo.id === value);\n setFlagged(`${file?.name ?? value} flagged for the claim.`);\n }\n\n return (\n <Stack gap={2}>\n <Inline gap={2}>\n <Button onClick={() => setOpen(true)} size=\"sm\" tone=\"secondary\" variant=\"outline\">\n Review damage photographs\n </Button>\n </Inline>\n <Text size=\"sm\" tone=\"muted\">\n {flagged}\n </Text>\n <MediaViewer\n items={PHOTOS}\n open={open}\n onOpenChange={setOpen}\n value={value}\n onValueChange={setValue}\n >\n <MediaViewerBar>\n <MediaViewerHeading />\n <MediaViewerActions>\n <Button onClick={handleFlag} size=\"sm\" tone=\"neutral\" variant=\"ghost\">\n Flag for claim\n </Button>\n <MediaViewerDownload />\n </MediaViewerActions>\n <MediaViewerClose />\n </MediaViewerBar>\n <MediaViewerStage />\n <MediaViewerPrevious />\n <MediaViewerNext />\n <MediaViewerZoom />\n </MediaViewer>\n </Stack>\n );\n}\n",
587
+ "verdict": "example"
588
+ },
589
+ {
590
+ "id": "basic",
591
+ "title": "basic.tsx",
592
+ "note": null,
593
+ "language": "tsx",
594
+ "source": "import { Button } from '@slotted/react/button';\nimport { Inline } from '@slotted/react/inline';\nimport { MediaViewer, type MediaViewerItem } from '@slotted/react/media-viewer';\nimport { useState } from 'react';\n\nconst photo = (width: number, height: number, sky: string, crate: string) =>\n 'data:image/svg+xml,' +\n encodeURIComponent(\n `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${String(width)}\" height=\"${String(height)}\">` +\n `<rect width=\"100%\" height=\"100%\" fill=\"${sky}\"/>` +\n `<rect y=\"${String(height * 0.7)}\" width=\"100%\" height=\"${String(height * 0.3)}\" fill=\"#4b5563\"/>` +\n `<rect x=\"${String(width * 0.3)}\" y=\"${String(height * 0.4)}\" width=\"${String(width * 0.4)}\" height=\"${String(height * 0.3)}\" fill=\"${crate}\"/>` +\n '</svg>',\n );\n\nconst FRONT: MediaViewerItem = {\n id: 'front',\n name: 'pallet-front.jpg',\n type: 'image/jpeg',\n src: photo(2400, 1600, '#bfdbfe', '#c2410c'),\n caption: 'Front face of pallet 7: two crushed corners.',\n downloadHref: '#pallet-front.jpg',\n};\n\nconst REAR: MediaViewerItem = {\n id: 'rear',\n name: 'pallet-rear.jpg',\n type: 'image/jpeg',\n src: photo(1200, 1600, '#e0e7ff', '#9a3412'),\n caption: 'Rear face, taken on the dock.',\n downloadHref: '#pallet-rear.jpg',\n};\n\nconst LABEL: MediaViewerItem = {\n id: 'label',\n name: 'carrier-label.jpg',\n type: 'image/jpeg',\n src: photo(320, 200, '#fde68a', '#78350f'),\n downloadHref: '#carrier-label.jpg',\n};\n\nconst PHOTOS = [FRONT, REAR, LABEL];\n\nexport default function MediaViewerBasicExample() {\n const [open, setOpen] = useState(false);\n const [value, setValue] = useState('front');\n\n function handleOpen(id: string) {\n setValue(id);\n setOpen(true);\n }\n\n return (\n <>\n <Inline gap={2}>\n {PHOTOS.map((file) => (\n <Button\n key={file.id}\n onClick={() => handleOpen(file.id)}\n size=\"sm\"\n tone=\"secondary\"\n variant=\"outline\"\n >\n {file.name}\n </Button>\n ))}\n </Inline>\n <MediaViewer\n items={PHOTOS}\n open={open}\n onOpenChange={setOpen}\n value={value}\n onValueChange={setValue}\n />\n </>\n );\n}\n",
595
+ "verdict": "example"
596
+ },
597
+ {
598
+ "id": "defaults",
599
+ "title": "defaults.tsx",
600
+ "note": null,
601
+ "language": "tsx",
602
+ "source": "import { Button } from '@slotted/react/button';\nimport { Inline } from '@slotted/react/inline';\nimport {\n MediaViewer,\n MediaViewerDefaultsProvider,\n type MediaViewerItem,\n} from '@slotted/react/media-viewer';\nimport { useState } from 'react';\n\nconst photo = (width: number, height: number, sky: string, crate: string) =>\n 'data:image/svg+xml,' +\n encodeURIComponent(\n `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${String(width)}\" height=\"${String(height)}\">` +\n `<rect width=\"100%\" height=\"100%\" fill=\"${sky}\"/>` +\n `<rect y=\"${String(height * 0.7)}\" width=\"100%\" height=\"${String(height * 0.3)}\" fill=\"#4b5563\"/>` +\n `<rect x=\"${String(width * 0.3)}\" y=\"${String(height * 0.4)}\" width=\"${String(width * 0.4)}\" height=\"${String(height * 0.3)}\" fill=\"${crate}\"/>` +\n '</svg>',\n );\n\nconst FRONT: MediaViewerItem = {\n id: 'front',\n name: 'pallet-front.jpg',\n type: 'image/jpeg',\n src: photo(2400, 1600, '#bfdbfe', '#c2410c'),\n caption: 'Front face of pallet 7: two crushed corners.',\n downloadHref: '#pallet-front.jpg',\n};\n\nconst REAR: MediaViewerItem = {\n id: 'rear',\n name: 'pallet-rear.jpg',\n type: 'image/jpeg',\n src: photo(1200, 1600, '#e0e7ff', '#9a3412'),\n caption: 'Rear face, taken on the dock.',\n downloadHref: '#pallet-rear.jpg',\n};\n\nconst LABEL: MediaViewerItem = {\n id: 'label',\n name: 'carrier-label.jpg',\n type: 'image/jpeg',\n src: photo(320, 200, '#fde68a', '#78350f'),\n downloadHref: '#carrier-label.jpg',\n};\n\nconst PHOTOS = [FRONT, REAR, LABEL];\n\nexport default function MediaViewerDefaultsExample() {\n const [open, setOpen] = useState(false);\n const [value, setValue] = useState('front');\n\n function handleOpen(id: string) {\n setValue(id);\n setOpen(true);\n }\n\n return (\n <MediaViewerDefaultsProvider loop maxZoom={6}>\n <Inline gap={2}>\n {PHOTOS.map((file) => (\n <Button\n key={file.id}\n onClick={() => handleOpen(file.id)}\n size=\"sm\"\n tone=\"secondary\"\n variant=\"outline\"\n >\n {file.name}\n </Button>\n ))}\n </Inline>\n <MediaViewer\n items={PHOTOS}\n open={open}\n onOpenChange={setOpen}\n value={value}\n onValueChange={setValue}\n />\n </MediaViewerDefaultsProvider>\n );\n}\n",
603
+ "verdict": "example"
604
+ },
605
+ {
606
+ "id": "fullscreen",
607
+ "title": "fullscreen.tsx",
608
+ "note": null,
609
+ "language": "tsx",
610
+ "source": "import { Button } from '@slotted/react/button';\nimport { Inline } from '@slotted/react/inline';\nimport { MediaViewer, type MediaViewerItem } from '@slotted/react/media-viewer';\nimport { useState } from 'react';\n\nconst photo = (width: number, height: number, sky: string, crate: string) =>\n 'data:image/svg+xml,' +\n encodeURIComponent(\n `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${String(width)}\" height=\"${String(height)}\">` +\n `<rect width=\"100%\" height=\"100%\" fill=\"${sky}\"/>` +\n `<rect y=\"${String(height * 0.7)}\" width=\"100%\" height=\"${String(height * 0.3)}\" fill=\"#4b5563\"/>` +\n `<rect x=\"${String(width * 0.3)}\" y=\"${String(height * 0.4)}\" width=\"${String(width * 0.4)}\" height=\"${String(height * 0.3)}\" fill=\"${crate}\"/>` +\n '</svg>',\n );\n\nconst FRONT: MediaViewerItem = {\n id: 'front',\n name: 'pallet-front.jpg',\n type: 'image/jpeg',\n src: photo(2400, 1600, '#bfdbfe', '#c2410c'),\n caption: 'Front face of pallet 7: two crushed corners.',\n downloadHref: '#pallet-front.jpg',\n};\n\nconst REAR: MediaViewerItem = {\n id: 'rear',\n name: 'pallet-rear.jpg',\n type: 'image/jpeg',\n src: photo(1200, 1600, '#e0e7ff', '#9a3412'),\n caption: 'Rear face, taken on the dock.',\n downloadHref: '#pallet-rear.jpg',\n};\n\nconst LABEL: MediaViewerItem = {\n id: 'label',\n name: 'carrier-label.jpg',\n type: 'image/jpeg',\n src: photo(320, 200, '#fde68a', '#78350f'),\n downloadHref: '#carrier-label.jpg',\n};\n\nconst PHOTOS = [FRONT, REAR, LABEL];\n\nexport default function MediaViewerFullscreenExample() {\n const [open, setOpen] = useState(false);\n const [value, setValue] = useState('front');\n\n function handleOpen(id: string) {\n setValue(id);\n setOpen(true);\n }\n\n return (\n <>\n <Inline gap={2}>\n {PHOTOS.map((file) => (\n <Button\n key={file.id}\n onClick={() => handleOpen(file.id)}\n size=\"sm\"\n tone=\"secondary\"\n variant=\"outline\"\n >\n {file.name}\n </Button>\n ))}\n </Inline>\n <MediaViewer\n items={PHOTOS}\n open={open}\n onOpenChange={setOpen}\n value={value}\n onValueChange={setValue}\n fullscreenToggle\n />\n </>\n );\n}\n",
611
+ "verdict": "example"
612
+ },
613
+ {
614
+ "id": "messages",
615
+ "title": "messages.tsx",
616
+ "note": null,
617
+ "language": "tsx",
618
+ "source": "import { Button } from '@slotted/react/button';\nimport { Inline } from '@slotted/react/inline';\nimport { MediaViewer, type MediaViewerItem } from '@slotted/react/media-viewer';\nimport { useState } from 'react';\n\nconst photo = (width: number, height: number, sky: string, crate: string) =>\n 'data:image/svg+xml,' +\n encodeURIComponent(\n `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${String(width)}\" height=\"${String(height)}\">` +\n `<rect width=\"100%\" height=\"100%\" fill=\"${sky}\"/>` +\n `<rect y=\"${String(height * 0.7)}\" width=\"100%\" height=\"${String(height * 0.3)}\" fill=\"#4b5563\"/>` +\n `<rect x=\"${String(width * 0.3)}\" y=\"${String(height * 0.4)}\" width=\"${String(width * 0.4)}\" height=\"${String(height * 0.3)}\" fill=\"${crate}\"/>` +\n '</svg>',\n );\n\nconst FRONT: MediaViewerItem = {\n id: 'front',\n name: 'pallet-front.jpg',\n type: 'image/jpeg',\n src: photo(2400, 1600, '#bfdbfe', '#c2410c'),\n caption: 'Front face of pallet 7: two crushed corners.',\n downloadHref: '#pallet-front.jpg',\n};\n\nconst BROKEN: MediaViewerItem = {\n id: 'broken',\n name: 'pallet-side.jpg',\n type: 'image/jpeg',\n src: 'data:image/jpeg;base64,AAAA',\n downloadHref: '#pallet-side.jpg',\n};\n\nconst REAR: MediaViewerItem = {\n id: 'rear',\n name: 'pallet-rear.jpg',\n type: 'image/jpeg',\n src: photo(1200, 1600, '#e0e7ff', '#9a3412'),\n caption: 'Rear face, taken on the dock.',\n downloadHref: '#pallet-rear.jpg',\n};\n\nconst FILES = [FRONT, BROKEN, REAR];\n\nconst MESSAGES = {\n close: 'Close photographs',\n download: 'Save to the claim file',\n position: 'Photograph {index} of {count}',\n errorTitle: 'Photograph unavailable',\n error: 'The carrier portal did not return this photograph.',\n retry: 'Ask again',\n};\n\nexport default function MediaViewerMessagesExample() {\n const [open, setOpen] = useState(false);\n const [value, setValue] = useState('front');\n\n function handleOpen(id: string) {\n setValue(id);\n setOpen(true);\n }\n\n return (\n <>\n <Inline gap={2}>\n {FILES.map((file) => (\n <Button\n key={file.id}\n onClick={() => handleOpen(file.id)}\n size=\"sm\"\n tone=\"secondary\"\n variant=\"outline\"\n >\n {file.name}\n </Button>\n ))}\n </Inline>\n <MediaViewer\n items={FILES}\n open={open}\n onOpenChange={setOpen}\n value={value}\n onValueChange={setValue}\n messages={MESSAGES}\n />\n </>\n );\n}\n",
619
+ "verdict": "example"
620
+ },
621
+ {
622
+ "id": "requests",
623
+ "title": "requests.tsx",
624
+ "note": null,
625
+ "language": "tsx",
626
+ "source": "import { Button } from '@slotted/react/button';\nimport { Inline } from '@slotted/react/inline';\nimport {\n MediaViewer,\n type MediaViewerItem,\n type MediaViewerOpenRequest,\n type MediaViewerRotationRequest,\n type MediaViewerValueRequest,\n type MediaViewerZoomRequest,\n} from '@slotted/react/media-viewer';\nimport { Stack } from '@slotted/react/stack';\nimport { Text } from '@slotted/react/typography';\nimport { useState } from 'react';\n\nconst photo = (width: number, height: number, sky: string, crate: string) =>\n 'data:image/svg+xml,' +\n encodeURIComponent(\n `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${String(width)}\" height=\"${String(height)}\">` +\n `<rect width=\"100%\" height=\"100%\" fill=\"${sky}\"/>` +\n `<rect y=\"${String(height * 0.7)}\" width=\"100%\" height=\"${String(height * 0.3)}\" fill=\"#4b5563\"/>` +\n `<rect x=\"${String(width * 0.3)}\" y=\"${String(height * 0.4)}\" width=\"${String(width * 0.4)}\" height=\"${String(height * 0.3)}\" fill=\"${crate}\"/>` +\n '</svg>',\n );\n\nconst FRONT: MediaViewerItem = {\n id: 'front',\n name: 'pallet-front.jpg',\n type: 'image/jpeg',\n src: photo(2400, 1600, '#bfdbfe', '#c2410c'),\n caption: 'Front face of pallet 7: two crushed corners.',\n downloadHref: '#pallet-front.jpg',\n};\n\nconst REAR: MediaViewerItem = {\n id: 'rear',\n name: 'pallet-rear.jpg',\n type: 'image/jpeg',\n src: photo(1200, 1600, '#e0e7ff', '#9a3412'),\n caption: 'Rear face, taken on the dock.',\n downloadHref: '#pallet-rear.jpg',\n};\n\nconst LABEL: MediaViewerItem = {\n id: 'label',\n name: 'carrier-label.jpg',\n type: 'image/jpeg',\n src: photo(320, 200, '#fde68a', '#78350f'),\n downloadHref: '#carrier-label.jpg',\n};\n\nconst PHOTOS = [FRONT, REAR, LABEL];\n\nexport default function MediaViewerRequestsExample() {\n const [open, setOpen] = useState(false);\n const [value, setValue] = useState('front');\n const [log, setLog] = useState<string[]>([]);\n\n const summary = log.length === 0 ? 'Open a photograph, zoom, turn and step.' : log.join(' · ');\n\n function record(line: string) {\n setLog((lines) => [line, ...lines].slice(0, 4));\n }\n\n function handleOpen(id: string) {\n setValue(id);\n setOpen(true);\n }\n\n function handleOpenChange(next: boolean, request: MediaViewerOpenRequest) {\n setOpen(next);\n record(`open ${String(next)} by ${request.reason}`);\n }\n\n function handleValueChange(next: string, request: MediaViewerValueRequest) {\n setValue(next);\n record(`file ${next} by ${request.reason}`);\n }\n\n function handleZoomChange(next: number, request: MediaViewerZoomRequest) {\n record(`level ${String(Math.round(next * 100))}% by ${request.reason}`);\n }\n\n function handleRotationChange(next: number, request: MediaViewerRotationRequest) {\n record(`turn to ${String(next)} degrees by ${request.reason}`);\n }\n\n return (\n <Stack gap={4}>\n <Inline gap={2}>\n {PHOTOS.map((file) => (\n <Button\n key={file.id}\n onClick={() => handleOpen(file.id)}\n size=\"sm\"\n tone=\"secondary\"\n variant=\"outline\"\n >\n {file.name}\n </Button>\n ))}\n </Inline>\n <MediaViewer\n items={PHOTOS}\n open={open}\n onOpenChange={handleOpenChange}\n value={value}\n onValueChange={handleValueChange}\n onZoomChange={handleZoomChange}\n onRotationChange={handleRotationChange}\n />\n <Text tone=\"muted\">{summary}</Text>\n </Stack>\n );\n}\n",
627
+ "verdict": "example"
573
628
  }
574
629
  ]
575
630
  }
@@ -6,29 +6,91 @@
6
6
  ## Import
7
7
 
8
8
  ```tsx
9
- import { MediaViewer, MediaViewerActions, MediaViewerBar, MediaViewerCaption, MediaViewerClose, MediaViewerDefaultsProvider, MediaViewerDownload, MediaViewerNext, MediaViewerPosition, MediaViewerPrevious, MediaViewerStage, MediaViewerThumbnails, MediaViewerTitle, MediaViewerZoom } from '@slotted/react';
9
+ import { MediaViewer, MediaViewerActions, MediaViewerBar, MediaViewerCaption, MediaViewerClose, MediaViewerDefaultsProvider, MediaViewerDownload, MediaViewerHeading, MediaViewerNext, MediaViewerPosition, MediaViewerPrevious, MediaViewerStage, MediaViewerThumbnails, MediaViewerTitle, MediaViewerZoom } from '@slotted/react';
10
10
  ```
11
11
 
12
12
  ## Minimal example
13
13
 
14
- Excerpt — not a complete module
14
+ Example
15
15
 
16
16
  ```tsx
17
- <>
18
- <AttachmentTrigger
19
- onClick={() => {
20
- setValue(file.id);
21
- setOpen(true);
22
- }}
23
- />
24
- <MediaViewer
25
- items={files}
26
- open={open}
27
- onOpenChange={setOpen}
28
- value={value}
29
- onValueChange={setValue}
30
- />
31
- </>;
17
+ import { Button } from '@slotted/react/button';
18
+ import { Inline } from '@slotted/react/inline';
19
+ import { MediaViewer, type MediaViewerItem } from '@slotted/react/media-viewer';
20
+ import { useState } from 'react';
21
+
22
+ const photo = (width: number, height: number, sky: string, crate: string) =>
23
+ 'data:image/svg+xml,' +
24
+ encodeURIComponent(
25
+ `<svg xmlns="http://www.w3.org/2000/svg" width="${String(width)}" height="${String(height)}">` +
26
+ `<rect width="100%" height="100%" fill="${sky}"/>` +
27
+ `<rect y="${String(height * 0.7)}" width="100%" height="${String(height * 0.3)}" fill="#4b5563"/>` +
28
+ `<rect x="${String(width * 0.3)}" y="${String(height * 0.4)}" width="${String(width * 0.4)}" height="${String(height * 0.3)}" fill="${crate}"/>` +
29
+ '</svg>',
30
+ );
31
+
32
+ const FRONT: MediaViewerItem = {
33
+ id: 'front',
34
+ name: 'pallet-front.jpg',
35
+ type: 'image/jpeg',
36
+ src: photo(2400, 1600, '#bfdbfe', '#c2410c'),
37
+ caption: 'Front face of pallet 7: two crushed corners.',
38
+ downloadHref: '#pallet-front.jpg',
39
+ };
40
+
41
+ const REAR: MediaViewerItem = {
42
+ id: 'rear',
43
+ name: 'pallet-rear.jpg',
44
+ type: 'image/jpeg',
45
+ src: photo(1200, 1600, '#e0e7ff', '#9a3412'),
46
+ caption: 'Rear face, taken on the dock.',
47
+ downloadHref: '#pallet-rear.jpg',
48
+ };
49
+
50
+ const LABEL: MediaViewerItem = {
51
+ id: 'label',
52
+ name: 'carrier-label.jpg',
53
+ type: 'image/jpeg',
54
+ src: photo(320, 200, '#fde68a', '#78350f'),
55
+ downloadHref: '#carrier-label.jpg',
56
+ };
57
+
58
+ const PHOTOS = [FRONT, REAR, LABEL];
59
+
60
+ export default function MediaViewerBasicExample() {
61
+ const [open, setOpen] = useState(false);
62
+ const [value, setValue] = useState('front');
63
+
64
+ function handleOpen(id: string) {
65
+ setValue(id);
66
+ setOpen(true);
67
+ }
68
+
69
+ return (
70
+ <>
71
+ <Inline gap={2}>
72
+ {PHOTOS.map((file) => (
73
+ <Button
74
+ key={file.id}
75
+ onClick={() => handleOpen(file.id)}
76
+ size="sm"
77
+ tone="secondary"
78
+ variant="outline"
79
+ >
80
+ {file.name}
81
+ </Button>
82
+ ))}
83
+ </Inline>
84
+ <MediaViewer
85
+ items={PHOTOS}
86
+ open={open}
87
+ onOpenChange={setOpen}
88
+ value={value}
89
+ onValueChange={setValue}
90
+ />
91
+ </>
92
+ );
93
+ }
32
94
  ```
33
95
 
34
96
  ## Anatomy
@@ -85,12 +147,13 @@ Excerpt — not a complete module
85
147
  | `messages` | `Partial<MediaViewerMessages>` | — | MediaViewer | Words laid over the language in force, key by key: close, previous, next, zoomIn, zoomOut, fit, rotate, download, position, zoomLevel, unsupportedTitle, unsupported, errorTitle, error, retry, truncated, loading, announce, label |
86
148
  | `children` | `ReactNode` | the anatomy | MediaViewer | The parts, arranged by the consumer |
87
149
  | `children` | `ReactNode` | the download | MediaViewerActions | The product’s own controls |
88
- | `children` | `ReactNode` | close, title, position, actions | MediaViewerBar | The bar’s own arrangement |
150
+ | `children` | `ReactNode` | the title and the position | MediaViewerHeading | The column’s own content |
151
+ | `children` | `ReactNode` | heading, actions, close | MediaViewerBar | The bar’s own arrangement |
89
152
  | `render` | `(props) => ReactNode` | — | close, download, previous, next | Renders the wiring into another element |
90
153
  | `ref` | `Ref<HTMLElement>` | — | every part | Reaches the native element; each part extends its own element props |
91
154
  | `MediaViewerDefaultsProvider` | `{ minZoom, maxZoom, zoomStep, loop, messages }` | — | a subtree | Sets them once; a viewer that states one still wins |
92
155
  | `render` | `(props) => ReactNode` | — | close, download, previous, next | The consumer element receives data-part and the wiring; spread it |
93
- | `onClick` | `handler` | — | close, previous, next | Composed: the page handler runs first and preventDefault refuses the family behavior |
156
+ | `onClick` | `handler` | — | close, previous, next | Composed: the page handler runs first and preventDefault refuses the viewer’s own behavior |
94
157
  | `useMediaViewer` | `() => context` | — | a part of the consumer’s own | The item, the index, the level and the requests |
95
158
 
96
159
  ## Events
@@ -107,7 +170,7 @@ Excerpt — not a complete module
107
170
  - The layer is dialog’s: focus enters it, Tab stays inside, Escape and the platform’s back close it, and focus returns to the opener.
108
171
  - The dialog is named by the file’s title and described by its position, so a reader hears “police-report.pdf, 3 of 5” when it opens; a step announces the new name and position politely.
109
172
  - Focus lands on the stage rather than on the close button, because the content is the picture; the stage is named by the file and takes the arrows, plus, minus, zero and R.
110
- - The family’s keys give way inside a video, an audio, a frame or a field, whose own keys win; Ctrl and Meta combinations stay the browser’s zoom. A text file keeps the arrows that scroll it.
173
+ - The viewer’s keys give way inside a video, an audio, a frame or a field, whose own keys win; Ctrl and Meta combinations stay the browser’s zoom. A text file keeps the arrows that scroll it.
111
174
  - A text file is fetched and set as text, never executed, so an HTML file shows its source; the stage holding it scrolls under a finger as a document does.
112
175
  - Every control is a real button with a name from the catalog, and the level is an output that is not live, so the zoom does not chatter at every wheel event.
113
176
  - The viewer draws the dark scheme on its dark ground in light and dark, and keeps the high-contrast scheme when the reader chose it.
@@ -118,118 +181,4 @@ Excerpt — not a complete module
118
181
 
119
182
  ## Examples
120
183
 
121
- ### Zoom around a point
122
-
123
- The wheel zooms around the point under the pointer by distance, so a trackpad’s many small events do not jump to the maximum. Drag to pan; double-click returns to the fit.
124
-
125
- Excerpt — not a complete module
126
-
127
- ```tsx
128
- <MediaViewer items={files} defaultOpen minZoom={1} maxZoom={8} zoomStep={0.5} />;
129
- ```
130
-
131
- ### A photograph, a PDF, a JSON export and a spreadsheet
132
-
133
- The PDF opens in the browser’s own reader; the JSON export is read as text, indented and never executed, as a log, a CSV or source would be. A spreadsheet the browser cannot draw gets its tile, a sentence and the download.
134
-
135
- Excerpt — not a complete module
136
-
137
- ```tsx
138
- const files = [
139
- { id: 'front', name: 'front.jpg', type: 'image/jpeg', src: frontUrl },
140
- { id: 'report', name: 'police-report.pdf', type: 'application/pdf', src: reportUrl },
141
- { id: 'export', name: 'claim-0914.json', type: 'application/json', src: exportUrl },
142
- { id: 'estimate', name: 'estimate.xlsx', type: '', src: estimateUrl, downloadHref: estimateUrl },
143
- ];
144
- ```
145
-
146
- ### A picture that fails to load
147
-
148
- The photograph’s address no longer answers: the stage says what happened and offers to try again or to download, and the zoom pill leaves because there is nothing to zoom.
149
-
150
- Excerpt — not a complete module
151
-
152
- ```tsx
153
- const scan = { id: 'scan', name: 'scan.png', type: 'image/png', src, width: 2480, height: 3508 };
154
- ```
155
-
156
- ### A long name and a set of one
157
-
158
- A scanner’s name is cut in the middle so the extension stays; the whole name is in the tooltip and the accessible name. A single file draws no steps and no position.
159
-
160
- Excerpt — not a complete module
161
-
162
- ```tsx
163
- <MediaViewer items={[scan]} defaultOpen />;
164
- ```
165
-
166
- ### A strip of the set
167
-
168
- Composed under the stage: the current photograph is framed and the others dimmed until the pointer reaches them. A press steps straight to that file.
169
-
170
- Excerpt — not a complete module
171
-
172
- ```tsx
173
- <MediaViewer items={files} defaultOpen>
174
- <MediaViewerBar />
175
- <MediaViewerStage />
176
- <MediaViewerPrevious />
177
- <MediaViewerNext />
178
- <MediaViewerZoom />
179
- <MediaViewerCaption />
180
- <MediaViewerThumbnails aria-label="Claim photographs" />
181
- </MediaViewer>;
182
- ```
183
-
184
- ### Actions of the product, defaults of the application
185
-
186
- The bar takes the product’s own controls beside the download. A provider sets the limits, the loop and the words once for every viewer under it.
187
-
188
- Excerpt — not a complete module
189
-
190
- ```tsx
191
- <MediaViewerDefaultsProvider maxZoom={6} loop>
192
- <MediaViewer items={files} defaultOpen>
193
- <MediaViewerBar>
194
- <MediaViewerClose />
195
- <MediaViewerTitle />
196
- <MediaViewerActions>
197
- <Button onClick={share}>Share</Button>
198
- <MediaViewerDownload />
199
- </MediaViewerActions>
200
- </MediaViewerBar>
201
- <MediaViewerStage />
202
- </MediaViewer>
203
- </MediaViewerDefaultsProvider>;
204
- ```
205
-
206
- ### The application holds the file and the level
207
-
208
- Every move is a request with a reason: the step says pointer, keyboard or remove, the level says pointer, keyboard or select. The log below the openers shows each one.
209
-
210
- Excerpt — not a complete module
211
-
212
- ```tsx
213
- <MediaViewer
214
- items={files}
215
- open={open}
216
- onOpenChange={setOpen}
217
- value={value}
218
- onValueChange={(next, { reason }) => {
219
- setValue(next);
220
- log(`step by ${reason}`);
221
- }}
222
- zoom={zoom}
223
- onZoomChange={(next) => setZoom(next)}
224
- />;
225
- ```
226
-
227
- ### Every key of the viewer
228
-
229
- Arrows step while the picture fits and pan once it is zoomed; plus, minus and zero zoom; R turns; Home and End reach the ends; Escape closes and focus returns to the opener.
230
-
231
- Excerpt — not a complete module
232
-
233
- ```tsx
234
- <MediaViewer items={files} defaultOpen />;
235
- ```
184
+ See [media-viewer.examples.md](./media-viewer.examples.md).