@brightlocal/ui-components 3.2.0 → 3.3.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 (428) hide show
  1. package/AI_USAGE.md +10 -0
  2. package/README.md +3 -1
  3. package/component-meta.json +1271 -428
  4. package/deprecations.json +44 -0
  5. package/dist/_virtual/_rolldown/runtime.cjs +1 -0
  6. package/dist/accordion.cjs +1 -1
  7. package/dist/accordion.js +73 -102
  8. package/dist/alert-dialog.cjs +1 -1
  9. package/dist/alert-dialog.d.ts +6 -4
  10. package/dist/alert-dialog.d.ts.map +1 -1
  11. package/dist/alert-dialog.js +85 -133
  12. package/dist/alert.cjs +1 -1
  13. package/dist/alert.d.ts +4 -4
  14. package/dist/alert.d.ts.map +1 -1
  15. package/dist/alert.js +106 -168
  16. package/dist/aspect-ratio.cjs +1 -1
  17. package/dist/aspect-ratio.js +13 -16
  18. package/dist/avatar.cjs +1 -1
  19. package/dist/avatar.js +30 -45
  20. package/dist/badge.cjs +1 -1
  21. package/dist/badge.d.ts +23 -1
  22. package/dist/badge.d.ts.map +1 -1
  23. package/dist/badge.js +90 -91
  24. package/dist/banner.cjs +1 -1
  25. package/dist/banner.js +102 -148
  26. package/dist/blocks/empty-state.cjs +1 -1
  27. package/dist/blocks/empty-state.d.ts +20 -3
  28. package/dist/blocks/empty-state.d.ts.map +1 -1
  29. package/dist/blocks/empty-state.js +73 -140
  30. package/dist/blocks/input-list.cjs +2 -2
  31. package/dist/blocks/input-list.d.ts +2 -2
  32. package/dist/blocks/input-list.d.ts.map +1 -1
  33. package/dist/blocks/input-list.js +136 -176
  34. package/dist/blocks/progress-state.cjs +1 -1
  35. package/dist/blocks/progress-state.js +223 -347
  36. package/dist/blocks/sidebar.cjs +1 -1
  37. package/dist/blocks/sidebar.d.ts +11 -6
  38. package/dist/blocks/sidebar.d.ts.map +1 -1
  39. package/dist/blocks/sidebar.js +763 -1092
  40. package/dist/brand-illustration-motif.cjs +1 -1
  41. package/dist/brand-illustration-motif.js +40 -61
  42. package/dist/breadcrumb.cjs +1 -1
  43. package/dist/breadcrumb.js +62 -102
  44. package/dist/button-group.cjs +1 -1
  45. package/dist/button-group.js +23 -31
  46. package/dist/button.cjs +1 -1
  47. package/dist/button.d.ts +4 -2
  48. package/dist/button.d.ts.map +1 -1
  49. package/dist/button.js +149 -189
  50. package/dist/calendar.cjs +1 -1
  51. package/dist/calendar.d.ts +87 -3
  52. package/dist/calendar.d.ts.map +1 -1
  53. package/dist/calendar.js +116 -173
  54. package/dist/callout.cjs +1 -1
  55. package/dist/callout.js +73 -96
  56. package/dist/card.cjs +1 -1
  57. package/dist/card.d.ts +10 -4
  58. package/dist/card.d.ts.map +1 -1
  59. package/dist/card.js +233 -316
  60. package/dist/carousel.cjs +1 -1
  61. package/dist/carousel.d.ts +3 -3
  62. package/dist/carousel.d.ts.map +1 -1
  63. package/dist/carousel.js +174 -268
  64. package/dist/centred-layout.cjs +1 -1
  65. package/dist/centred-layout.js +27 -48
  66. package/dist/chart-empty.cjs +1 -1
  67. package/dist/chart-empty.js +18 -27
  68. package/dist/chart.cjs +7 -7
  69. package/dist/chart.d.ts +23 -13
  70. package/dist/chart.d.ts.map +1 -1
  71. package/dist/chart.js +445 -651
  72. package/dist/checkbox.cjs +1 -1
  73. package/dist/checkbox.js +36 -69
  74. package/dist/chip.cjs +1 -1
  75. package/dist/chip.js +116 -173
  76. package/dist/collapsible.cjs +1 -1
  77. package/dist/collapsible.d.ts.map +1 -1
  78. package/dist/collapsible.js +35 -41
  79. package/dist/combobox.cjs +3 -3
  80. package/dist/combobox.d.ts +14 -4
  81. package/dist/combobox.d.ts.map +1 -1
  82. package/dist/combobox.js +439 -638
  83. package/dist/command.cjs +1 -1
  84. package/dist/command.d.ts.map +1 -1
  85. package/dist/command.js +273 -420
  86. package/dist/context-menu.cjs +1 -1
  87. package/dist/context-menu.d.ts +5 -5
  88. package/dist/context-menu.d.ts.map +1 -1
  89. package/dist/context-menu.js +121 -191
  90. package/dist/data-table.cjs +1 -1
  91. package/dist/data-table.d.ts +280 -129
  92. package/dist/data-table.d.ts.map +1 -1
  93. package/dist/data-table.js +687 -948
  94. package/dist/date-picker.cjs +1 -1
  95. package/dist/date-picker.d.ts +15 -4
  96. package/dist/date-picker.d.ts.map +1 -1
  97. package/dist/date-picker.js +156 -231
  98. package/dist/delta.cjs +1 -0
  99. package/dist/delta.d.ts +79 -0
  100. package/dist/delta.d.ts.map +1 -0
  101. package/dist/delta.js +62 -0
  102. package/dist/description.cjs +1 -1
  103. package/dist/description.js +11 -20
  104. package/dist/dialog.cjs +1 -1
  105. package/dist/dialog.d.ts +1 -1
  106. package/dist/dialog.d.ts.map +1 -1
  107. package/dist/dialog.js +76 -116
  108. package/dist/drawer.cjs +1 -1
  109. package/dist/drawer.d.ts +11 -11
  110. package/dist/drawer.d.ts.map +1 -1
  111. package/dist/drawer.js +76 -134
  112. package/dist/dropdown-menu.cjs +1 -1
  113. package/dist/dropdown-menu.d.ts +6 -6
  114. package/dist/dropdown-menu.d.ts.map +1 -1
  115. package/dist/dropdown-menu.js +179 -300
  116. package/dist/field.cjs +1 -1
  117. package/dist/field.d.ts +9 -9
  118. package/dist/field.d.ts.map +1 -1
  119. package/dist/field.js +166 -286
  120. package/dist/global-layout.cjs +1 -1
  121. package/dist/global-layout.js +203 -342
  122. package/dist/grid.cjs +1 -1
  123. package/dist/grid.js +16 -29
  124. package/dist/header.cjs +1 -1
  125. package/dist/header.js +21 -38
  126. package/dist/height-transition.cjs +1 -1
  127. package/dist/height-transition.js +38 -55
  128. package/dist/hooks/use-breakpoint.cjs +1 -1
  129. package/dist/hooks/use-breakpoint.js +9 -9
  130. package/dist/hooks/use-debounce.cjs +1 -1
  131. package/dist/hooks/use-debounce.js +12 -11
  132. package/dist/hooks/use-delayed-pending.cjs +1 -1
  133. package/dist/hooks/use-delayed-pending.js +8 -9
  134. package/dist/hooks/use-filter-search-params.cjs +1 -0
  135. package/dist/hooks/use-filter-search-params.d.ts +93 -0
  136. package/dist/hooks/use-filter-search-params.d.ts.map +1 -0
  137. package/dist/hooks/use-filter-search-params.js +122 -0
  138. package/dist/hooks/use-mobile.cjs +1 -1
  139. package/dist/hooks/use-mobile.js +6 -6
  140. package/dist/hooks/use-overlay-pointer-lock.cjs +1 -1
  141. package/dist/hooks/use-overlay-pointer-lock.js +8 -9
  142. package/dist/hooks/use-prefers-reduced-motion.cjs +1 -1
  143. package/dist/hooks/use-prefers-reduced-motion.js +5 -8
  144. package/dist/hover-card.cjs +1 -1
  145. package/dist/hover-card.d.ts +1 -1
  146. package/dist/hover-card.d.ts.map +1 -1
  147. package/dist/hover-card.js +30 -62
  148. package/dist/index.cjs +1 -1
  149. package/dist/index.d.ts +6 -0
  150. package/dist/index.d.ts.map +1 -1
  151. package/dist/index.js +630 -608
  152. package/dist/info-tooltip.cjs +1 -1
  153. package/dist/info-tooltip.js +22 -36
  154. package/dist/input-chip.cjs +1 -1
  155. package/dist/input-chip.d.ts +32 -3
  156. package/dist/input-chip.d.ts.map +1 -1
  157. package/dist/input-chip.js +181 -230
  158. package/dist/input-group.cjs +1 -1
  159. package/dist/input-group.js +174 -221
  160. package/dist/input-otp.cjs +1 -1
  161. package/dist/input-otp.d.ts +3 -3
  162. package/dist/input-otp.d.ts.map +1 -1
  163. package/dist/input-otp.js +102 -146
  164. package/dist/input-password.cjs +1 -1
  165. package/dist/input-password.d.ts +12 -16
  166. package/dist/input-password.d.ts.map +1 -1
  167. package/dist/input-password.js +139 -171
  168. package/dist/input.cjs +1 -1
  169. package/dist/input.d.ts.map +1 -1
  170. package/dist/input.js +51 -73
  171. package/dist/label.cjs +1 -1
  172. package/dist/label.js +20 -38
  173. package/dist/lib/block-illustration.cjs +1 -1
  174. package/dist/lib/block-illustration.d.ts +1 -1
  175. package/dist/lib/block-illustration.d.ts.map +1 -1
  176. package/dist/lib/block-illustration.js +16 -18
  177. package/dist/lib/compose-event-handlers.cjs +1 -0
  178. package/dist/lib/compose-event-handlers.d.ts +9 -0
  179. package/dist/lib/compose-event-handlers.d.ts.map +1 -0
  180. package/dist/lib/compose-event-handlers.js +8 -0
  181. package/dist/lib/download-file.cjs +1 -0
  182. package/dist/lib/download-file.d.ts +14 -0
  183. package/dist/lib/download-file.d.ts.map +1 -0
  184. package/dist/lib/download-file.js +40 -0
  185. package/dist/lib/empty-canvas.cjs +1 -1
  186. package/dist/lib/empty-canvas.js +28 -56
  187. package/dist/lib/empty-chip.cjs +1 -1
  188. package/dist/lib/empty-chip.d.ts +14 -3
  189. package/dist/lib/empty-chip.d.ts.map +1 -1
  190. package/dist/lib/empty-chip.js +15 -11
  191. package/dist/lib/field-aria.cjs +1 -0
  192. package/dist/lib/field-aria.d.ts +34 -0
  193. package/dist/lib/field-aria.d.ts.map +1 -0
  194. package/dist/lib/field-aria.js +52 -0
  195. package/dist/lib/image-file-info.cjs +1 -0
  196. package/dist/lib/image-file-info.d.ts +25 -0
  197. package/dist/lib/image-file-info.d.ts.map +1 -0
  198. package/dist/lib/image-file-info.js +67 -0
  199. package/dist/lib/media-viewer-content.cjs +1 -0
  200. package/dist/lib/media-viewer-content.d.ts +102 -0
  201. package/dist/lib/media-viewer-content.d.ts.map +1 -0
  202. package/dist/lib/media-viewer-content.js +650 -0
  203. package/dist/lib/media-viewer-internal.cjs +1 -0
  204. package/dist/lib/media-viewer-internal.d.ts +98 -0
  205. package/dist/lib/media-viewer-internal.d.ts.map +1 -0
  206. package/dist/lib/media-viewer-internal.js +61 -0
  207. package/dist/lib/media-viewer-motion.cjs +1 -0
  208. package/dist/lib/media-viewer-motion.d.ts +40 -0
  209. package/dist/lib/media-viewer-motion.d.ts.map +1 -0
  210. package/dist/lib/media-viewer-motion.js +37 -0
  211. package/dist/lib/motion.cjs +1 -1
  212. package/dist/lib/motion.d.ts +8 -0
  213. package/dist/lib/motion.d.ts.map +1 -1
  214. package/dist/lib/motion.js +11 -10
  215. package/dist/lib/optical-center.cjs +1 -1
  216. package/dist/lib/optical-center.d.ts +1 -1
  217. package/dist/lib/optical-center.d.ts.map +1 -1
  218. package/dist/lib/optical-center.js +12 -5
  219. package/dist/lib/spring-settle.cjs +1 -1
  220. package/dist/lib/spring-settle.js +1 -1
  221. package/dist/lib/table-internal.cjs +1 -0
  222. package/dist/lib/table-internal.d.ts +62 -0
  223. package/dist/lib/table-internal.d.ts.map +1 -0
  224. package/dist/lib/table-internal.js +18 -0
  225. package/dist/lib/use-controllable.cjs +1 -0
  226. package/dist/lib/use-controllable.d.ts +12 -0
  227. package/dist/lib/use-controllable.d.ts.map +1 -0
  228. package/dist/lib/use-controllable.js +15 -0
  229. package/dist/lib/use-dev-warning.cjs +1 -1
  230. package/dist/lib/utils.cjs +1 -1
  231. package/dist/lib/utils.js +26 -33
  232. package/dist/link.cjs +1 -1
  233. package/dist/link.d.ts +1 -1
  234. package/dist/link.js +78 -124
  235. package/dist/list.cjs +1 -1
  236. package/dist/list.d.ts +8 -0
  237. package/dist/list.d.ts.map +1 -1
  238. package/dist/list.js +94 -156
  239. package/dist/loading.cjs +1 -1
  240. package/dist/loading.js +124 -151
  241. package/dist/logo-mark.cjs +1 -0
  242. package/dist/logo-mark.d.ts +79 -0
  243. package/dist/logo-mark.d.ts.map +1 -0
  244. package/dist/logo-mark.js +219 -0
  245. package/dist/logo.cjs +1 -1
  246. package/dist/logo.d.ts +1 -1
  247. package/dist/logo.d.ts.map +1 -1
  248. package/dist/logo.js +51 -87
  249. package/dist/map.cjs +1 -1
  250. package/dist/map.d.ts.map +1 -1
  251. package/dist/map.js +390 -586
  252. package/dist/media-empty.cjs +1 -1
  253. package/dist/media-empty.js +27 -42
  254. package/dist/media-viewer.cjs +1 -0
  255. package/dist/media-viewer.d.ts +224 -0
  256. package/dist/media-viewer.d.ts.map +1 -0
  257. package/dist/media-viewer.js +295 -0
  258. package/dist/menubar.cjs +1 -1
  259. package/dist/menubar.d.ts +14 -14
  260. package/dist/menubar.d.ts.map +1 -1
  261. package/dist/menubar.js +130 -267
  262. package/dist/multi-select-filter.cjs +1 -1
  263. package/dist/multi-select-filter.d.ts +9 -1
  264. package/dist/multi-select-filter.d.ts.map +1 -1
  265. package/dist/multi-select-filter.js +357 -446
  266. package/dist/navigation-menu.cjs +1 -1
  267. package/dist/navigation-menu.js +108 -172
  268. package/dist/pagination.cjs +1 -1
  269. package/dist/pagination.d.ts +36 -12
  270. package/dist/pagination.d.ts.map +1 -1
  271. package/dist/pagination.js +208 -281
  272. package/dist/popover.cjs +1 -1
  273. package/dist/popover.d.ts +1 -1
  274. package/dist/popover.d.ts.map +1 -1
  275. package/dist/popover.js +34 -45
  276. package/dist/progress.cjs +1 -1
  277. package/dist/progress.d.ts +17 -2
  278. package/dist/progress.d.ts.map +1 -1
  279. package/dist/progress.js +116 -162
  280. package/dist/radio-group.cjs +1 -1
  281. package/dist/radio-group.js +90 -146
  282. package/dist/rating.cjs +1 -1
  283. package/dist/rating.d.ts +80 -13
  284. package/dist/rating.d.ts.map +1 -1
  285. package/dist/rating.js +70 -65
  286. package/dist/relative-date.cjs +1 -1
  287. package/dist/relative-date.d.ts.map +1 -1
  288. package/dist/relative-date.js +73 -89
  289. package/dist/resizable.cjs +1 -1
  290. package/dist/resizable.d.ts +39 -23
  291. package/dist/resizable.d.ts.map +1 -1
  292. package/dist/resizable.js +42 -44
  293. package/dist/result-count.cjs +1 -0
  294. package/dist/result-count.d.ts +110 -0
  295. package/dist/result-count.d.ts.map +1 -0
  296. package/dist/result-count.js +49 -0
  297. package/dist/route-progress.cjs +1 -1
  298. package/dist/route-progress.js +58 -102
  299. package/dist/scroll-area.cjs +1 -1
  300. package/dist/scroll-area.d.ts +9 -1
  301. package/dist/scroll-area.d.ts.map +1 -1
  302. package/dist/scroll-area.js +44 -79
  303. package/dist/select.cjs +2 -2
  304. package/dist/select.d.ts +10 -10
  305. package/dist/select.d.ts.map +1 -1
  306. package/dist/select.js +118 -238
  307. package/dist/separator.cjs +1 -1
  308. package/dist/separator.js +90 -78
  309. package/dist/sheet.cjs +1 -1
  310. package/dist/sheet.d.ts +8 -5
  311. package/dist/sheet.d.ts.map +1 -1
  312. package/dist/sheet.js +250 -317
  313. package/dist/single-select-filter.cjs +1 -1
  314. package/dist/single-select-filter.d.ts +32 -0
  315. package/dist/single-select-filter.d.ts.map +1 -1
  316. package/dist/single-select-filter.js +201 -203
  317. package/dist/skeleton.cjs +1 -1
  318. package/dist/skeleton.js +24 -38
  319. package/dist/slider.cjs +1 -1
  320. package/dist/slider.js +51 -81
  321. package/dist/sonner.cjs +1 -1
  322. package/dist/sonner.d.ts +1 -1
  323. package/dist/sonner.d.ts.map +1 -1
  324. package/dist/sonner.js +101 -125
  325. package/dist/spinner.cjs +1 -1
  326. package/dist/spinner.js +22 -31
  327. package/dist/split-layout.cjs +1 -1
  328. package/dist/split-layout.js +52 -101
  329. package/dist/status.cjs +1 -0
  330. package/dist/status.d.ts +51 -0
  331. package/dist/status.d.ts.map +1 -0
  332. package/dist/status.js +60 -0
  333. package/dist/stepper.cjs +1 -1
  334. package/dist/stepper.js +184 -316
  335. package/dist/switch.cjs +1 -1
  336. package/dist/switch.js +17 -32
  337. package/dist/table.cjs +1 -1
  338. package/dist/table.d.ts +103 -30
  339. package/dist/table.d.ts.map +1 -1
  340. package/dist/table.js +170 -209
  341. package/dist/tabs.cjs +1 -1
  342. package/dist/tabs.d.ts.map +1 -1
  343. package/dist/tabs.js +102 -147
  344. package/dist/text-reveal-motion.cjs +1 -1
  345. package/dist/text-reveal-motion.js +307 -363
  346. package/dist/textarea.cjs +1 -1
  347. package/dist/textarea.d.ts.map +1 -1
  348. package/dist/textarea.js +22 -35
  349. package/dist/toggle-group.cjs +1 -1
  350. package/dist/toggle-group.js +43 -62
  351. package/dist/toggle.cjs +1 -1
  352. package/dist/toggle.js +34 -46
  353. package/dist/tooltip.cjs +1 -1
  354. package/dist/tooltip.d.ts +2 -2
  355. package/dist/tooltip.d.ts.map +1 -1
  356. package/dist/tooltip.js +157 -249
  357. package/dist/typography-heading.cjs +1 -1
  358. package/dist/typography-heading.js +25 -61
  359. package/dist/typography-text.cjs +1 -1
  360. package/dist/typography-text.js +27 -57
  361. package/dist/typography.cjs +1 -1
  362. package/dist/typography.js +132 -340
  363. package/package.json +46 -46
  364. package/src/blocks/empty-state.tsx +34 -18
  365. package/src/blocks/sidebar.tsx +86 -31
  366. package/src/components/accordion.tsx +1 -1
  367. package/src/components/alert-dialog.tsx +4 -2
  368. package/src/components/badge.tsx +127 -15
  369. package/src/components/breadcrumb.tsx +1 -1
  370. package/src/components/button.tsx +8 -6
  371. package/src/components/calendar.tsx +155 -9
  372. package/src/components/card.tsx +63 -10
  373. package/src/components/carousel.tsx +4 -1
  374. package/src/components/chart.tsx +151 -17
  375. package/src/components/checkbox.tsx +1 -1
  376. package/src/components/collapsible.tsx +4 -1
  377. package/src/components/combobox.tsx +40 -7
  378. package/src/components/command.tsx +9 -10
  379. package/src/components/context-menu.tsx +4 -4
  380. package/src/components/data-table.tsx +619 -237
  381. package/src/components/date-picker.tsx +31 -4
  382. package/src/components/delta.tsx +217 -0
  383. package/src/components/drawer.tsx +5 -5
  384. package/src/components/dropdown-menu.tsx +4 -4
  385. package/src/components/field.tsx +36 -15
  386. package/src/components/global-layout.tsx +1 -1
  387. package/src/components/input-chip.tsx +51 -7
  388. package/src/components/input-group.tsx +1 -1
  389. package/src/components/input-password.tsx +15 -19
  390. package/src/components/input.tsx +10 -1
  391. package/src/components/list.tsx +14 -2
  392. package/src/components/logo-mark.tsx +345 -0
  393. package/src/components/map.tsx +18 -20
  394. package/src/components/media-viewer.tsx +908 -0
  395. package/src/components/multi-select-filter.tsx +255 -121
  396. package/src/components/navigation-menu.tsx +2 -2
  397. package/src/components/pagination.tsx +86 -26
  398. package/src/components/progress.tsx +91 -23
  399. package/src/components/rating.tsx +200 -74
  400. package/src/components/relative-date.tsx +19 -11
  401. package/src/components/resizable.tsx +86 -33
  402. package/src/components/result-count.tsx +253 -0
  403. package/src/components/scroll-area.tsx +31 -5
  404. package/src/components/select.tsx +2 -2
  405. package/src/components/sheet.tsx +14 -4
  406. package/src/components/single-select-filter.tsx +136 -41
  407. package/src/components/slider.tsx +2 -2
  408. package/src/components/status.tsx +162 -0
  409. package/src/components/switch.tsx +1 -1
  410. package/src/components/table.tsx +278 -106
  411. package/src/components/tabs.tsx +1 -0
  412. package/src/components/textarea.tsx +20 -2
  413. package/src/components/toggle.tsx +2 -2
  414. package/src/components/tooltip.tsx +11 -20
  415. package/src/hooks/use-filter-search-params.ts +302 -0
  416. package/src/index.ts +6 -0
  417. package/src/lib/compose-event-handlers.ts +14 -0
  418. package/src/lib/download-file.ts +61 -0
  419. package/src/lib/empty-chip.tsx +52 -0
  420. package/src/lib/field-aria.tsx +97 -0
  421. package/src/lib/image-file-info.ts +102 -0
  422. package/src/lib/media-viewer-content.tsx +1587 -0
  423. package/src/lib/media-viewer-internal.tsx +191 -0
  424. package/src/lib/media-viewer-motion.ts +120 -0
  425. package/src/lib/motion.ts +9 -0
  426. package/src/lib/table-internal.ts +74 -0
  427. package/src/lib/use-controllable.ts +43 -0
  428. package/src/lib/empty-chip.ts +0 -24
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Calls the consumer's handler first, then ours — unless the consumer called
3
+ * `preventDefault()`. Mirrors Radix's `composeEventHandlers` without adding
4
+ * `@radix-ui/primitive` as a direct dependency.
5
+ */
6
+ export declare function composeEventHandlers<E extends {
7
+ defaultPrevented: boolean;
8
+ }>(theirs: ((event: E) => void) | undefined, ours: (event: E) => void): (event: E) => void;
9
+ //# sourceMappingURL=compose-event-handlers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compose-event-handlers.d.ts","sourceRoot":"","sources":["../../src/lib/compose-event-handlers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS;IAAE,gBAAgB,EAAE,OAAO,CAAA;CAAE,EAC1E,MAAM,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC,GAAG,SAAS,EACxC,IAAI,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,IAEhB,OAAO,CAAC,UAIjB"}
@@ -0,0 +1,8 @@
1
+ function o(r, n) {
2
+ return (e) => {
3
+ r?.(e), e.defaultPrevented || n(e);
4
+ };
5
+ }
6
+ export {
7
+ o as composeEventHandlers
8
+ };
@@ -0,0 +1 @@
1
+ var l={"image/jpeg":"jpg","image/png":"png","image/webp":"webp","image/gif":"gif","image/avif":"avif","image/svg+xml":"svg"};function i(t,o=""){const a=l[o.split(";")[0]?.trim()??""];if(t.startsWith("data:")){const n=t.slice(5,t.indexOf(";"));return`image.${l[n]??a??"png"}`}let e="image";try{const n=new URL(t,window.location.href).pathname;e=decodeURIComponent(n.split("/").filter(Boolean).pop()??e)}catch{}return/\.[a-z0-9]{2,5}$/i.test(e)?e:`${e}.${a??"jpg"}`}function m(t,o,a=!1){const e=document.createElement("a");e.href=t,e.download=o,e.rel="noopener",a&&(e.target="_blank"),document.body.appendChild(e),e.click(),e.remove()}async function r(t){try{const o=await fetch(t,{mode:"cors"});if(!o.ok)throw new Error(`HTTP ${o.status}`);const a=await o.blob(),e=URL.createObjectURL(a);m(e,i(t,a.type)),window.setTimeout(()=>URL.revokeObjectURL(e),1e3)}catch{m(t,i(t),!0)}}exports.downloadFile=r;exports.fileNameFor=i;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * A file name for `src`: its last path segment, with an extension from the
3
+ * file's type when the URL has none (an image CDN path often does not).
4
+ */
5
+ export declare function fileNameFor(src: string, type?: string): string;
6
+ /**
7
+ * Saves the file at `src` to the reader's device. The file is fetched and
8
+ * saved from a blob, so a cross-origin image downloads rather than opening
9
+ * (`<a download>` alone is ignored across origins). If the fetch fails — the
10
+ * host sends no CORS headers — it falls back to a plain download link, which
11
+ * still saves same-origin files and opens a cross-origin one in a new tab.
12
+ */
13
+ export declare function downloadFile(src: string): Promise<void>;
14
+ //# sourceMappingURL=download-file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"download-file.d.ts","sourceRoot":"","sources":["../../src/lib/download-file.ts"],"names":[],"mappings":"AASA;;;GAGG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,SAAK,GAAG,MAAM,CAc1D;AAeD;;;;;;GAMG;AACH,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAW7D"}
@@ -0,0 +1,40 @@
1
+ var i = {
2
+ "image/jpeg": "jpg",
3
+ "image/png": "png",
4
+ "image/webp": "webp",
5
+ "image/gif": "gif",
6
+ "image/avif": "avif",
7
+ "image/svg+xml": "svg"
8
+ };
9
+ function r(t, o = "") {
10
+ const n = i[o.split(";")[0]?.trim() ?? ""];
11
+ if (t.startsWith("data:")) {
12
+ const a = t.slice(5, t.indexOf(";"));
13
+ return `image.${i[a] ?? n ?? "png"}`;
14
+ }
15
+ let e = "image";
16
+ try {
17
+ const a = new URL(t, window.location.href).pathname;
18
+ e = decodeURIComponent(a.split("/").filter(Boolean).pop() ?? e);
19
+ } catch {
20
+ }
21
+ return /\.[a-z0-9]{2,5}$/i.test(e) ? e : `${e}.${n ?? "jpg"}`;
22
+ }
23
+ function m(t, o, n = !1) {
24
+ const e = document.createElement("a");
25
+ e.href = t, e.download = o, e.rel = "noopener", n && (e.target = "_blank"), document.body.appendChild(e), e.click(), e.remove();
26
+ }
27
+ async function c(t) {
28
+ try {
29
+ const o = await fetch(t, { mode: "cors" });
30
+ if (!o.ok) throw new Error(`HTTP ${o.status}`);
31
+ const n = await o.blob(), e = URL.createObjectURL(n);
32
+ m(e, r(t, n.type)), window.setTimeout(() => URL.revokeObjectURL(e), 1e3);
33
+ } catch {
34
+ m(t, r(t), !0);
35
+ }
36
+ }
37
+ export {
38
+ c as downloadFile,
39
+ r as fileNameFor
40
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),g=require("react"),p=require("@brightlocal/ui-components/lib/utils"),f=require("../typography-text.cjs");function y(t){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const r=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(a,e,r.get?r:{enumerable:!0,get:()=>t[e]})}}return a.default=t,Object.freeze(a)}const s=y(g),b=32,i=s.forwardRef(({className:t,dataHook:a,icon:e,message:r,slot:n,trackingEl:o,trackingLabel:l,...d},u)=>{const m=s.isValidElement(e)&&typeof e.type!="string"&&e.type!==s.Fragment?s.cloneElement(e,{size:b}):e;return c.jsxs("div",{ref:u,className:p.cn("bg-muted flex flex-col items-center justify-center gap-2 text-center",t),"data-hook":a,"data-slot":n,"data-tracking-el":o??n,"data-tracking-label":l,...d,children:[c.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground flex items-center justify-center [&_svg:not([class*='size-'])]:size-8","data-hook":`${a}-icon`,"data-slot":`${n}-icon`,children:m}),c.jsx(f.TypographyText,{align:"center",color:"muted","data-slot":`${n}-message`,dataHook:`${a}-message`,variant:"body-sm",children:r})]})});i.displayName="EmptyCanvas";exports.EmptyCanvas=i;
1
+ const _=require("../_virtual/_rolldown/runtime.cjs"),g=require("../typography-text.cjs");let e=require("react");e=_.__toESM(e,1);let p=require("@brightlocal/ui-components/lib/utils"),s=require("react/jsx-runtime");var y=32,i=e.forwardRef(({className:n,dataHook:r,icon:t,message:l,slot:a,trackingEl:c,trackingLabel:d,...m},o)=>{const u=e.isValidElement(t)&&typeof t.type!="string"&&t.type!==e.Fragment?e.cloneElement(t,{size:y}):t;return(0,s.jsxs)("div",{ref:o,className:(0,p.cn)("bg-muted flex flex-col items-center justify-center gap-2 text-center",n),"data-hook":r,"data-slot":a,"data-tracking-el":c??a,"data-tracking-label":d,...m,children:[(0,s.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground flex items-center justify-center [&_svg:not([class*='size-'])]:size-8","data-hook":`${r}-icon`,"data-slot":`${a}-icon`,children:u}),(0,s.jsx)(g.TypographyText,{align:"center",color:"muted","data-slot":`${a}-message`,dataHook:`${r}-message`,variant:"body-sm",children:l})]})});i.displayName="EmptyCanvas";exports.EmptyCanvas=i;
@@ -1,61 +1,33 @@
1
- import { jsxs as p, jsx as s } from "react/jsx-runtime";
1
+ import { TypographyText as p } from "../typography-text.js";
2
2
  import * as a from "react";
3
3
  import { cn as f } from "@brightlocal/ui-components/lib/utils";
4
- import { TypographyText as g } from "../typography-text.js";
5
- const y = 32, x = a.forwardRef(
6
- ({
7
- className: n,
8
- dataHook: r,
9
- icon: e,
10
- message: i,
11
- slot: t,
12
- trackingEl: m,
13
- trackingLabel: o,
14
- ...d
15
- }, c) => {
16
- const l = a.isValidElement(e) && typeof e.type != "string" && e.type !== a.Fragment ? a.cloneElement(e, {
17
- size: y
18
- }) : e;
19
- return /* @__PURE__ */ p(
20
- "div",
21
- {
22
- ref: c,
23
- className: f(
24
- "bg-muted flex flex-col items-center justify-center gap-2 text-center",
25
- n
26
- ),
27
- "data-hook": r,
28
- "data-slot": t,
29
- "data-tracking-el": m ?? t,
30
- "data-tracking-label": o,
31
- ...d,
32
- children: [
33
- /* @__PURE__ */ s(
34
- "span",
35
- {
36
- "aria-hidden": "true",
37
- className: "text-muted-foreground flex items-center justify-center [&_svg:not([class*='size-'])]:size-8",
38
- "data-hook": `${r}-icon`,
39
- "data-slot": `${t}-icon`,
40
- children: l
41
- }
42
- ),
43
- /* @__PURE__ */ s(
44
- g,
45
- {
46
- align: "center",
47
- color: "muted",
48
- "data-slot": `${t}-message`,
49
- dataHook: `${r}-message`,
50
- variant: "body-sm",
51
- children: i
52
- }
53
- )
54
- ]
55
- }
56
- );
57
- }
58
- );
4
+ import { jsx as s, jsxs as g } from "react/jsx-runtime";
5
+ var y = 32, x = a.forwardRef(({ className: n, dataHook: r, icon: e, message: i, slot: t, trackingEl: m, trackingLabel: d, ...o }, l) => {
6
+ const c = a.isValidElement(e) && typeof e.type != "string" && e.type !== a.Fragment ? a.cloneElement(e, { size: y }) : e;
7
+ return /* @__PURE__ */ g("div", {
8
+ ref: l,
9
+ className: f("bg-muted flex flex-col items-center justify-center gap-2 text-center", n),
10
+ "data-hook": r,
11
+ "data-slot": t,
12
+ "data-tracking-el": m ?? t,
13
+ "data-tracking-label": d,
14
+ ...o,
15
+ children: [/* @__PURE__ */ s("span", {
16
+ "aria-hidden": "true",
17
+ className: "text-muted-foreground flex items-center justify-center [&_svg:not([class*='size-'])]:size-8",
18
+ "data-hook": `${r}-icon`,
19
+ "data-slot": `${t}-icon`,
20
+ children: c
21
+ }), /* @__PURE__ */ s(p, {
22
+ align: "center",
23
+ color: "muted",
24
+ "data-slot": `${t}-message`,
25
+ dataHook: `${r}-message`,
26
+ variant: "body-sm",
27
+ children: i
28
+ })]
29
+ });
30
+ });
59
31
  x.displayName = "EmptyCanvas";
60
32
  export {
61
33
  x as EmptyCanvas
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("class-variance-authority"),t=e.cva("bg-muted text-muted-foreground flex size-10 items-center justify-center rounded-full",{variants:{align:{center:"",left:"shrink-0"}},defaultVariants:{align:"center"}});exports.emptyChipStyles=t;
1
+ const l=require("../_virtual/_rolldown/runtime.cjs"),n=require("../logo-mark.cjs");let e=require("react");e=l.__toESM(e,1);let _=require("@brightlocal/ui-components/lib/utils"),a=require("react/jsx-runtime");function s({dataHook:r,icon:t,variant:i="filled",slot:u,className:o}){return(0,a.jsx)(n.LogoMark,{className:(0,_.cn)("text-muted-foreground",o),"data-slot":u,dataHook:r,name:t,size:"lg",variant:i})}exports.EmptyChip=s;
@@ -1,4 +1,15 @@
1
- export declare const emptyChipStyles: (props?: ({
2
- align?: "center" | "left" | null | undefined;
3
- } & import('class-variance-authority/types').ClassProp) | undefined) => string;
1
+ import { LogoMarkVariant } from '../components/logo-mark';
2
+ import * as React from "react";
3
+ interface EmptyChipProps {
4
+ dataHook: string;
5
+ /** The glyph. Decorative — the chip is aria-hidden. */
6
+ icon: React.ReactNode;
7
+ /** @default "filled" */
8
+ variant?: LogoMarkVariant;
9
+ /** Overrides LogoMark's own `logo-mark` slot, so each host keeps its name. */
10
+ slot: string;
11
+ className?: string;
12
+ }
13
+ export declare function EmptyChip({ dataHook, icon, variant, slot, className, }: EmptyChipProps): React.JSX.Element;
14
+ export {};
4
15
  //# sourceMappingURL=empty-chip.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"empty-chip.d.ts","sourceRoot":"","sources":["../../src/lib/empty-chip.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,eAAe;;8EAQ3B,CAAC"}
1
+ {"version":3,"file":"empty-chip.d.ts","sourceRoot":"","sources":["../../src/lib/empty-chip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAY,KAAK,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAoBzE,UAAU,cAAc;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;IACtB,wBAAwB;IACxB,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,8EAA8E;IAC9E,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,SAAS,CAAC,EACxB,QAAQ,EACR,IAAI,EACJ,OAAkB,EAClB,IAAI,EACJ,SAAS,GACV,EAAE,cAAc,qBAWhB"}
@@ -1,13 +1,17 @@
1
- import { cva as e } from "class-variance-authority";
2
- const r = e(
3
- "bg-muted text-muted-foreground flex size-10 items-center justify-center rounded-full",
4
- {
5
- variants: {
6
- align: { center: "", left: "shrink-0" }
7
- },
8
- defaultVariants: { align: "center" }
9
- }
10
- );
1
+ import { LogoMark as i } from "../logo-mark.js";
2
+ import "react";
3
+ import { cn as p } from "@brightlocal/ui-components/lib/utils";
4
+ import { jsx as a } from "react/jsx-runtime";
5
+ function d({ dataHook: o, icon: r, variant: t = "filled", slot: m, className: e }) {
6
+ return /* @__PURE__ */ a(i, {
7
+ className: p("text-muted-foreground", e),
8
+ "data-slot": m,
9
+ dataHook: o,
10
+ name: r,
11
+ size: "lg",
12
+ variant: t
13
+ });
14
+ }
11
15
  export {
12
- r as emptyChipStyles
16
+ d as EmptyChip
13
17
  };
@@ -0,0 +1 @@
1
+ "use client";const d=require("../_virtual/_rolldown/runtime.cjs");let i=require("react");i=d.__toESM(i,1);let f=require("react/jsx-runtime");var g={description:[],error:[]},c=i.createContext(null);function x({children:s}){const[e,n]=i.useState(g),t=i.useCallback((o,u)=>(n(r=>r[o].includes(u)?r:{...r,[o]:[...r[o],u]}),()=>{n(r=>r[o].includes(u)?{...r,[o]:r[o].filter(a=>a!==u)}:r)}),[]),l=i.useMemo(()=>({ids:e,register:t}),[e,t]);return(0,f.jsx)(c.Provider,{value:l,children:s})}function F(s,e,n){const t=i.useContext(c)?.register;i.useEffect(()=>{if(!(!t||!n))return t(s,e)},[t,s,e,n])}function _(s){const e=i.useContext(c);if(!e)return s;const n=s?.split(/\s+/).filter(Boolean)??[],t=[...new Set([...e.ids.error,...e.ids.description,...n])];return t.length>0?t.join(" "):void 0}exports.FieldAriaProvider=x;exports.useFieldAriaRegistration=F;exports.useFieldDescribedBy=_;
@@ -0,0 +1,34 @@
1
+ import * as React from "react";
2
+ /**
3
+ * Wires a Field's hint and error message to the control inside it.
4
+ *
5
+ * `Field` provides the context. `FieldDescription` and `FieldError` register
6
+ * the id they render while they are on screen. Text controls (`Input`,
7
+ * `Textarea`) read the registered ids and point `aria-describedby` at them, so
8
+ * a screen reader hears the message together with the field. Outside a Field
9
+ * the hooks do nothing and a control behaves exactly as before.
10
+ *
11
+ * Registration happens in an effect, after hydration. The hint and error sit
12
+ * after the control in the markup, so the control cannot know about them while
13
+ * it renders on the server. Server-rendered markup therefore has no wired
14
+ * `aria-describedby` until hydration; a consumer that needs it before that
15
+ * passes `id` on the message and `aria-describedby` on the control by hand.
16
+ */
17
+ type FieldAriaKind = "description" | "error";
18
+ declare function FieldAriaProvider({ children }: {
19
+ children: React.ReactNode;
20
+ }): React.JSX.Element;
21
+ /**
22
+ * Registers `id` as the Field's hint or error element while `present` is true.
23
+ * A no-op outside a Field.
24
+ */
25
+ declare function useFieldAriaRegistration(kind: FieldAriaKind, id: string, present: boolean): void;
26
+ /**
27
+ * Returns the `aria-describedby` value for a control: the Field's error, then
28
+ * its hint, then whatever the consumer passed. Ids are de-duplicated, so a
29
+ * consumer that already wires the same id by hand is unaffected. Outside a
30
+ * Field it returns `describedBy` unchanged.
31
+ */
32
+ declare function useFieldDescribedBy(describedBy?: string): string | undefined;
33
+ export { FieldAriaProvider, useFieldAriaRegistration, useFieldDescribedBy };
34
+ //# sourceMappingURL=field-aria.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-aria.d.ts","sourceRoot":"","sources":["../../src/lib/field-aria.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;;;;;;;;;;;;;;GAcG;AAEH,KAAK,aAAa,GAAG,aAAa,GAAG,OAAO,CAAC;AAiB7C,iBAAS,iBAAiB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,qBAuBrE;AAED;;;GAGG;AACH,iBAAS,wBAAwB,CAC/B,IAAI,EAAE,aAAa,EACnB,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,OAAO,QAQjB;AAED;;;;;GAKG;AACH,iBAAS,mBAAmB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CASrE;AAED,OAAO,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,CAAC"}
@@ -0,0 +1,52 @@
1
+ "use client";
2
+ import * as n from "react";
3
+ import { jsx as f } from "react/jsx-runtime";
4
+ var x = {
5
+ description: [],
6
+ error: []
7
+ }, c = n.createContext(null);
8
+ function m({ children: o }) {
9
+ const [e, s] = n.useState(x), t = n.useCallback((i, u) => (s((r) => r[i].includes(u) ? r : {
10
+ ...r,
11
+ [i]: [...r[i], u]
12
+ }), () => {
13
+ s((r) => r[i].includes(u) ? {
14
+ ...r,
15
+ [i]: r[i].filter((a) => a !== u)
16
+ } : r);
17
+ }), []), l = n.useMemo(() => ({
18
+ ids: e,
19
+ register: t
20
+ }), [e, t]);
21
+ return /* @__PURE__ */ f(c.Provider, {
22
+ value: l,
23
+ children: o
24
+ });
25
+ }
26
+ function d(o, e, s) {
27
+ const t = n.useContext(c)?.register;
28
+ n.useEffect(() => {
29
+ if (!(!t || !s))
30
+ return t(o, e);
31
+ }, [
32
+ t,
33
+ o,
34
+ e,
35
+ s
36
+ ]);
37
+ }
38
+ function C(o) {
39
+ const e = n.useContext(c);
40
+ if (!e) return o;
41
+ const s = o?.split(/\s+/).filter(Boolean) ?? [], t = [.../* @__PURE__ */ new Set([
42
+ ...e.ids.error,
43
+ ...e.ids.description,
44
+ ...s
45
+ ])];
46
+ return t.length > 0 ? t.join(" ") : void 0;
47
+ }
48
+ export {
49
+ m as FieldAriaProvider,
50
+ d as useFieldAriaRegistration,
51
+ C as useFieldDescribedBy
52
+ };
@@ -0,0 +1 @@
1
+ const f=require("../_virtual/_rolldown/runtime.cjs");let r=require("react");r=f.__toESM(r,1);var g={"image/jpeg":"JPEG","image/png":"PNG","image/webp":"WebP","image/gif":"GIF","image/avif":"AVIF","image/svg+xml":"SVG"};function m(e,t){const o=t?g[t.split(";")[0]?.trim()??""]:void 0;if(o)return o;if(e.startsWith("data:"))return g[e.slice(5,e.indexOf(";"))];try{const h=new URL(e,window.location.href).pathname,n=/\.([a-z0-9]{2,5})$/i.exec(h)?.[1];if(n)return n.toLowerCase()==="jpg"?"JPEG":n.toUpperCase()}catch{}}function s(e){return e<1024?`${e} B`:e<1048576?`${Math.round(e/1024)} KB`:`${(e/1048576).toFixed(1).replace(/\.0$/,"")} MB`}function l(e){if(!e)return"—";const t=[m(e.src,e.type),e.width&&e.height?`${e.width} × ${e.height} px`:void 0,e.bytes?s(e.bytes):void 0].filter(Boolean);return t.length?t.join(" · "):"—"}function p(e,t){const[o,h]=r.useState(()=>new Map),n=r.useRef(new Set);r.useEffect(()=>{if(!t||!e||n.current.has(e))return;n.current.add(e);const d=i=>h(a=>new Map(a).set(e,{...a.get(e),...i})),u=new Image;u.src=e,u.decode().then(()=>d({width:u.naturalWidth,height:u.naturalHeight})).catch(()=>{}),!e.startsWith("data:")&&fetch(e,{method:"HEAD",mode:"cors"}).then(i=>{if(!i.ok)return;const a=Number(i.headers.get("content-length"));d({type:i.headers.get("content-type")??void 0,bytes:a>0?a:void 0})}).catch(()=>{})},[e,t]);const c=e?o.get(e):void 0;return e?{src:e,...c}:void 0}exports.describeImageFile=l;exports.useImageFileInfo=p;
@@ -0,0 +1,25 @@
1
+ /** What the view knows about an image file. */
2
+ export interface ImageFileInfo {
3
+ /** MIME type, from the response — e.g. "image/jpeg". */
4
+ type?: string;
5
+ /** File size in bytes, from the response. */
6
+ bytes?: number;
7
+ width?: number;
8
+ height?: number;
9
+ }
10
+ /**
11
+ * One line for the details tooltip: "JPEG · 1600 × 1067 px · 245 KB". Only
12
+ * what is known; a dash while nothing is.
13
+ */
14
+ export declare function describeImageFile(info: (ImageFileInfo & {
15
+ src: string;
16
+ }) | undefined): string;
17
+ /**
18
+ * Looks up the file at `src` while `enabled`: its size in pixels from the
19
+ * image itself, its type and weight from a HEAD request (left out when the
20
+ * host does not allow it). Each file is looked up once.
21
+ */
22
+ export declare function useImageFileInfo(src: string | undefined, enabled: boolean): (ImageFileInfo & {
23
+ src: string;
24
+ }) | undefined;
25
+ //# sourceMappingURL=image-file-info.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-file-info.d.ts","sourceRoot":"","sources":["../../src/lib/image-file-info.ts"],"names":[],"mappings":"AAEA,+CAA+C;AAC/C,MAAM,WAAW,aAAa;IAC5B,wDAAwD;IACxD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6CAA6C;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AA+BD;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,CAAC,aAAa,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,SAAS,GAClD,MAAM,CAQR;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,MAAM,GAAG,SAAS,EACvB,OAAO,EAAE,OAAO,GACf,CAAC,aAAa,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,SAAS,CAoC/C"}
@@ -0,0 +1,67 @@
1
+ import * as d from "react";
2
+ var g = {
3
+ "image/jpeg": "JPEG",
4
+ "image/png": "PNG",
5
+ "image/webp": "WebP",
6
+ "image/gif": "GIF",
7
+ "image/avif": "AVIF",
8
+ "image/svg+xml": "SVG"
9
+ };
10
+ function c(t, e) {
11
+ const o = e ? g[e.split(";")[0]?.trim() ?? ""] : void 0;
12
+ if (o) return o;
13
+ if (t.startsWith("data:")) return g[t.slice(5, t.indexOf(";"))];
14
+ try {
15
+ const h = new URL(t, window.location.href).pathname, n = /\.([a-z0-9]{2,5})$/i.exec(h)?.[1];
16
+ if (n) return n.toLowerCase() === "jpg" ? "JPEG" : n.toUpperCase();
17
+ } catch {
18
+ }
19
+ }
20
+ function m(t) {
21
+ return t < 1024 ? `${t} B` : t < 1048576 ? `${Math.round(t / 1024)} KB` : `${(t / 1048576).toFixed(1).replace(/\.0$/, "")} MB`;
22
+ }
23
+ function s(t) {
24
+ if (!t) return "—";
25
+ const e = [
26
+ c(t.src, t.type),
27
+ t.width && t.height ? `${t.width} × ${t.height} px` : void 0,
28
+ t.bytes ? m(t.bytes) : void 0
29
+ ].filter(Boolean);
30
+ return e.length ? e.join(" · ") : "—";
31
+ }
32
+ function p(t, e) {
33
+ const [o, h] = d.useState(() => /* @__PURE__ */ new Map()), n = d.useRef(/* @__PURE__ */ new Set());
34
+ d.useEffect(() => {
35
+ if (!e || !t || n.current.has(t)) return;
36
+ n.current.add(t);
37
+ const u = (a) => h((i) => new Map(i).set(t, {
38
+ ...i.get(t),
39
+ ...a
40
+ })), r = new Image();
41
+ r.src = t, r.decode().then(() => u({
42
+ width: r.naturalWidth,
43
+ height: r.naturalHeight
44
+ })).catch(() => {
45
+ }), !t.startsWith("data:") && fetch(t, {
46
+ method: "HEAD",
47
+ mode: "cors"
48
+ }).then((a) => {
49
+ if (!a.ok) return;
50
+ const i = Number(a.headers.get("content-length"));
51
+ u({
52
+ type: a.headers.get("content-type") ?? void 0,
53
+ bytes: i > 0 ? i : void 0
54
+ });
55
+ }).catch(() => {
56
+ });
57
+ }, [t, e]);
58
+ const f = t ? o.get(t) : void 0;
59
+ return t ? {
60
+ src: t,
61
+ ...f
62
+ } : void 0;
63
+ }
64
+ export {
65
+ s as describeImageFile,
66
+ p as useImageFileInfo
67
+ };
@@ -0,0 +1 @@
1
+ "use client";const ye=require("../_virtual/_rolldown/runtime.cjs"),J=require("../button.cjs"),pe=require("../dialog.cjs"),He=require("../info-tooltip.cjs"),Ge=require("../media-empty.cjs"),Z=require("./compose-event-handlers.cjs"),V=require("./media-viewer-internal.cjs"),D=require("./media-viewer-motion.cjs"),Je=require("./download-file.cjs"),he=require("./image-file-info.cjs"),Qe=require("../relative-date.cjs");let c=require("react");c=ye.__toESM(c,1);let Y=require("@brightlocal/icons"),C=require("@brightlocal/ui-components/lib/utils"),i=require("react/jsx-runtime"),et=require("@brightlocal/ui-components/hooks/use-overlay-pointer-lock"),te=require("@radix-ui/react-dialog");te=ye.__toESM(te,1);let W=require("@brightlocal/ui-components/lib/motion"),tt=require("@brightlocal/ui-components/hooks/use-prefers-reduced-motion");var G=[1,1.5,2,3],ge=2.5,we=(0,C.cn)("group/nav absolute inset-y-0 flex w-16 items-center justify-center outline-none sm:w-20","duration-fast opacity-0 transition-opacity ease-out","group-hover/stage:opacity-100 focus-visible:opacity-100","disabled:invisible pointer-coarse:hidden"),xe=(0,C.cn)(J.ButtonVariants({variant:"ghost"}),"pointer-events-none size-9 p-0 group-hover/nav:bg-accent group-hover/nav:text-accent-foreground group-focus-visible/nav:shadow-default"),nt=(t,d)=>`${t} of ${d}`;function rt(t,d,g){const[p,b]=c.useState(()=>new Set),[x,R]=c.useState(()=>new Map),[_,e]=c.useState(()=>new Set),[l,s]=c.useState(()=>new Map),v=c.useCallback((m,n,f)=>{if(!n||!f)return null;const u=n/f;return R(h=>h.get(m)===u?h:new Map(h).set(m,u)),u},[]),o=c.useCallback(m=>{b(n=>new Set(n).add(m))},[]);return c.useEffect(()=>{if(!g)return;let m=!1;for(const n of[t[d],t[d+1],t[d-1]]){if(!n||n.expired)continue;const f=new Image;f.src=n.src,f.decode().then(()=>{m||(v(n.src,f.naturalWidth,f.naturalHeight),s(u=>u.get(n.src)===f.naturalWidth?u:new Map(u).set(n.src,f.naturalWidth)),e(u=>u.has(n.src)?u:new Set(u).add(n.src)))}).catch(()=>{})}return()=>{m=!0}},[g,t,d,v]),{failed:p,ratios:x,widths:l,ready:_,noteRatio:v,markFailed:o}}function at({index:t,openCount:d,openedAtRef:g,triggersRef:p,reducedMotion:b,setOpen:x,revealed:R,reveal:_}){const e=c.useRef(null),l=c.useRef(null),s=c.useRef(null),v=c.useRef(0),o=c.useRef(0),m=u=>{const h=p.current.get(u);return h?.isConnected?h:null};return{imageRef:e,overlayRef:l,barRef:s,revealed:R,reveal:_,zoomIn:(u,h,k)=>{if(v.current===d||(v.current=d,u.style.visibility="visible",_(),k-g.current>500))return;const E=b||h?null:m(t),T=E?D.zoomKeyframe(E,u):null;T?u.animate([T,D.ZOOM_REST],{duration:W.MOTION_DURATION_SLOW_MS,easing:W.MOTION_EASE_EMPHASIZED}):u.animate([{opacity:0},{opacity:1}],{duration:W.MOTION_DURATION_SLOW_MS,easing:"ease-out"})},requestClose:({fade:u=!1}={})=>{if(o.current===d)return;const h=e.current,k=b||u?null:m(t);h?.getAnimations().forEach(r=>r.cancel());const E=h&&k?D.zoomKeyframe(k,h):null;if(!h||!E){x(!1);return}o.current=d;const T={duration:W.MOTION_DURATION_BASE_MS,easing:"ease-in-out",fill:"forwards"};for(const r of[l.current,s.current])r?.animate([{opacity:1},{opacity:0}],T);h.animate([D.ZOOM_REST,E],T).finished.catch(()=>{}).finally(()=>x(!1))}}}function it({index:t,total:d,reducedMotion:g,onStep:p}){const b=c.useRef(null),x=c.useRef(null),R=c.useRef(null),_=c.useRef(null),e=()=>b.current?.clientWidth??0,l=r=>{const y=x.current;y&&(y.style.transform=r?`translateX(${r}px)`:"")},s=r=>r>0&&t===0||r<0&&t===d-1,v=r=>s(r)?D.rubberBand(r,e()*D.RUBBER_BAND_SHARE):r,o=(r,y)=>{const S=x.current?.animate([{transform:`translateX(${r}px)`},{transform:"none"}],D.glideTiming(r,y));_.current=S?{from:r,animation:S}:null},m=(r,y=0)=>{l(0),!(!r||g)&&o(r,y)},n=()=>{const r=_.current?.animation.playState;return r==="running"||r==="paused"},f=()=>{const r=_.current;if(_.current=null,!r||r.animation.playState==="finished")return 0;const y=r.animation.effect?.getComputedTiming().progress,S=r.from*(1-(y??0));return r.animation.cancel(),l(S),S},u=(r,y=0,S=0)=>{if(r===t||r<0||r>=d)return;const X=e();y&&!g&&X&&Math.abs(r-t)===1&&(R.current={from:(r>t?1:-1)*X+y,speed:S}),p(r)},h=r=>u(t+r),k=()=>Math.min(e()*D.DRAG_STEP_SHARE,160),E=(r,y=k())=>{const S=t+(r<0?1:-1);return Math.abs(r)>y&&S>=0&&S<d},T=(r,y,S=0)=>{const X=y<0?1:-1,Q=!(S*y<0&&Math.abs(S)>.2)&&(Math.abs(y)>k()||Math.abs(S)>.5),L=t+X;Q&&L>=0&&L<d?u(L,r,S):m(r,S)};return c.useLayoutEffect(()=>{const r=R.current;R.current=null,_.current?.animation.cancel(),_.current=null,l(0),r?.from&&o(r.from,r.speed)},[t]),{frameRef:b,trackRef:x,moveTrack:l,pastEnd:s,resist:v,settle:m,gliding:n,stopGlide:f,goTo:u,step:h,canStep:E,release:T}}function ot(t,d,g){const p=c.useRef({x:0,y:0}),b=c.useRef(t),x=c.useRef(null),R=c.useRef(!1),_=n=>{const f=d.current,u=g.current;if(!f||!u)return;const h=b.current,k=Math.max(0,(f.offsetWidth*h-u.clientWidth)/2),E=Math.max(0,(f.offsetHeight*h-u.clientHeight)/2),T=p.current;T.x=Math.min(k,Math.max(-k,T.x)),T.y=Math.min(E,Math.max(-E,T.y)),f.style.transition=n?`transform ${W.MOTION_DURATION_BASE_MS}ms ${W.MOTION_EASE_DECELERATE}`:"none",f.style.transform=h===1?"":`translate(${T.x}px, ${T.y}px) scale(${h})`};c.useLayoutEffect(()=>{const n=t/b.current;b.current=t,p.current=t===1?{x:0,y:0}:{x:p.current.x*n,y:p.current.y*n},_(!0)},[t]);const e=(n,f)=>{p.current.x+=n,p.current.y+=f,_(!1)};return{panBy:e,reset:()=>{const n=d.current;p.current={x:0,y:0},b.current=1,n&&(n.style.transition="none",n.style.transform="")},onPointerDown:n=>{n.pointerType==="mouse"&&n.button!==0||(R.current=!1,n.target instanceof Node&&d.current?.contains(n.target)&&(x.current={x:n.clientX,y:n.clientY,moved:!1},n.currentTarget.setPointerCapture?.(n.pointerId)))},onPointerMove:n=>{const f=x.current;if(!f)return;const u=n.clientX-f.x,h=n.clientY-f.y;!f.moved&&Math.hypot(u,h)<4||(f.moved=!0,f.x=n.clientX,f.y=n.clientY,e(u,h))},onPointerUp:()=>{R.current=!!x.current?.moved,x.current=null},consumePan:()=>{const n=R.current;return R.current=!1,n}}}function st(t,d){const g=c.useRef(!1),p=c.useRef(null);return{consumeSwipe:()=>{const l=g.current;return g.current=!1,l},onPointerDown:l=>{g.current=!1,!(l.pointerType==="mouse"||!d)&&(p.current={x:l.clientX,y:l.clientY,axis:null,base:0,offset:0,speed:0,lastX:l.clientX,lastTime:l.timeStamp})},onPointerMove:l=>{const s=p.current;if(!s)return;const v=l.clientX-s.x,o=l.clientY-s.y;if(!s.axis){if(Math.hypot(v,o)<8)return;s.axis=Math.abs(v)>Math.abs(o)?"x":"y",s.axis==="x"&&(s.base=t.stopGlide())}if(s.axis!=="x")return;const m=l.timeStamp-s.lastTime;if(m>0){const n=(l.clientX-s.lastX)/m;s.speed=s.speed*.3+n*.7}s.lastX=l.clientX,s.lastTime=l.timeStamp,s.offset=t.resist(s.base+v),t.moveTrack(s.offset)},onPointerUp:l=>{const s=p.current;if(p.current=null,!s||s.axis!=="x")return;g.current=!0;const v=l.timeStamp-s.lastTime>80?0:s.speed;t.release(s.offset,l.clientX-s.x,v)},onPointerCancel:()=>{const l=p.current;p.current=null,l?.axis==="x"&&t.settle(l.offset)}}}function ct(t,d,g,p){const b=c.useRef(d),x=c.useRef(g),R=c.useRef(p);c.useLayoutEffect(()=>{b.current=d,x.current=g,R.current=p});const _=c.useRef({swiping:!1,intent:0,offset:0,pull:0,previous:0,fading:0,speed:0,last:0,inertia:0,inertiaTimer:0,inertiaPrevious:0,inertiaFaintest:0,inertiaFading:!1,cancelTimer:0});c.useEffect(()=>{if(!t)return;const e=_.current,l=o=>{e.inertia=o,window.clearTimeout(e.inertiaTimer),e.inertiaTimer=window.setTimeout(()=>{e.inertia=0},300)},s=o=>{l(o),e.inertiaPrevious=Math.abs(o),e.inertiaFaintest=Math.abs(o),e.inertiaFading=!1},v=o=>{if(o.ctrlKey)return;if(!x.current){o.preventDefault(),R.current(-o.deltaX,-o.deltaY);return}if(Math.abs(o.deltaY)>Math.abs(o.deltaX)||o.target instanceof Element&&o.target.closest('[data-slot="media-viewer-thumbnails"]'))return;o.preventDefault();const m=b.current,n=Math.abs(o.deltaX),f=o.timeStamp-e.last;if(e.last=o.timeStamp,e.swiping)f>0&&(e.speed=e.speed*.3+-o.deltaX/f*.7);else{window.clearTimeout(e.cancelTimer);const h=e.inertia!==0&&Math.sign(o.deltaX)===Math.sign(e.inertia);h&&(n<e.inertiaPrevious&&(e.inertiaFading||(e.inertiaFaintest=n),e.inertiaFading=!0),e.inertiaFading&&(e.inertiaFaintest=Math.min(e.inertiaFaintest,n)),e.inertiaPrevious=n);const k=e.inertiaFading&&n>=e.inertiaFaintest*2;if(h&&!k&&(m.gliding()||n<=Math.abs(e.inertia)*1.2)){l(o.deltaX),e.intent=0;return}if(e.intent+=o.deltaX,Math.abs(e.intent)<=30){e.cancelTimer=window.setTimeout(()=>{e.intent=0},600);return}e.intent=0,e.swiping=!0,e.inertia=0,e.inertiaFading=!1,e.offset=m.stopGlide(),e.pull=0,e.speed=0,e.fading=0}window.clearTimeout(e.cancelTimer);const u=t.clientWidth;if(e.offset=Math.max(-u,Math.min(u,e.offset-o.deltaX)),e.pull-=o.deltaX,m.moveTrack(m.resist(e.offset)),e.fading=n<e.previous?e.fading+1:0,e.previous=n,m.pastEnd(e.offset)&&e.fading>=2){e.swiping=!1,s(o.deltaX),m.release(m.resist(e.offset),0);return}if(m.canStep(e.pull,u*.2)){e.swiping=!1,s(o.deltaX),m.release(m.resist(e.offset),e.pull,e.speed);return}e.cancelTimer=window.setTimeout(()=>{e.swiping=!1,m.release(m.resist(e.offset),0)},600)};return t.addEventListener("wheel",v,{passive:!1}),()=>{t.removeEventListener("wheel",v),window.clearTimeout(e.cancelTimer),window.clearTimeout(e.inertiaTimer)}},[t])}function lt({dataHook:t,hasPrevious:d,hasNext:g,previousLabel:p,nextLabel:b,onStep:x}){return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("button",{"aria-label":p??"Previous",className:(0,C.cn)(we,"left-0"),"data-hook":`${t}-previous`,"data-slot":"media-viewer-previous",disabled:!d,type:"button",onClick:()=>x(-1),children:(0,i.jsx)("span",{"aria-hidden":!0,className:xe,children:(0,i.jsx)(Y.ChevronLeft,{})})}),(0,i.jsx)("button",{"aria-label":b??"Next",className:(0,C.cn)(we,"right-0"),"data-hook":`${t}-next`,"data-slot":"media-viewer-next",disabled:!g,type:"button",onClick:()=>x(1),children:(0,i.jsx)("span",{"aria-hidden":!0,className:xe,children:(0,i.jsx)(Y.ChevronRight,{})})})]})}function ut({dataHook:t,items:d,index:g,failed:p,label:b,onSelect:x,onRatio:R}){const _=c.useRef(null);return c.useEffect(()=>{_.current?.querySelector('[aria-current="true"]')?.scrollIntoView?.({block:"nearest",inline:"nearest"})},[g]),(0,i.jsx)("div",{ref:_,"aria-label":b??"Images",className:"mb-2 flex max-w-full gap-1.5 justify-self-center overflow-x-auto p-1 [grid-area:strip] sm:mb-0","data-hook":`${t}-thumbnails`,"data-slot":"media-viewer-thumbnails",role:"group",children:d.map((e,l)=>{const s=l===g,v=e.expired||p.has(e.src);return(0,i.jsx)("button",{"aria-current":s?"true":void 0,"aria-label":e.alt,className:(0,C.cn)("bg-muted relative size-12 shrink-0 overflow-hidden rounded-md outline-none","duration-fast focus-visible:shadow-default transition-opacity ease-out",s?"opacity-100":"opacity-50 hover:opacity-100"),"data-hook":`${t}-thumbnail-${l}`,"data-slot":"media-viewer-thumbnail",type:"button",onClick:()=>x(l),children:v?null:(0,i.jsx)("img",{alt:"",className:"size-full object-cover object-top",decoding:"async",draggable:!1,loading:"lazy",src:e.thumbnailSrc??e.src,onLoad:o=>R(e.src,o.currentTarget.naturalWidth,o.currentTarget.naturalHeight)})},e.src)})})}var be=c.forwardRef(({dataHook:t,children:d,formatPosition:g,previousLabel:p,nextLabel:b,thumbnailsLabel:x,unavailableMessage:R,zoomInLabel:_,zoomOutLabel:e,downloadLabel:l,infoLabel:s,dateLabels:v,className:o,trackingEl:m,trackingLabel:n,onClick:f,onCloseAutoFocus:u,onEscapeKeyDown:h,onKeyDown:k,onOpenAutoFocus:E,...T},r)=>{const{items:y,index:S,setIndex:X,openerRef:Q,open:L,setOpen:ve,openCount:ne,openedAtRef:Me,revealed:Re,reveal:Se,triggersRef:Te,renderActions:re,actionsLabel:je}=V.useMediaViewerContext("MediaViewerContent"),ae=(0,tt.usePrefersReducedMotion)();(0,et.useOverlayPointerLock)();const F=y.length,j=Math.min(Math.max(S,0),Math.max(F-1,0)),Pe=j>0,ke=j<F-1,K=`${ne}:${j}`,[ie,Ee]=c.useState({key:"",level:0}),B=ie.key===K?ie.level:0,N=B>0,H=a=>Ee(w=>{const M=w.key===K?w.level:0,q=Math.min(Math.max(M+a,0),G.length-1);return q===M&&w.key===K?w:{key:K,level:q}}),{failed:ee,ratios:Ne,widths:oe,ready:qe,noteRatio:se,markFailed:Ce}=rt(y,j,L),z=at({index:j,openCount:ne,openedAtRef:Me,triggersRef:Te,reducedMotion:ae,setOpen:ve,revealed:Re,reveal:Se}),I=it({index:j,total:F,reducedMotion:ae,onStep:a=>{z.reveal(),A.reset(),X(a)}}),U=st(I,!N),{frameRef:ce,trackRef:Oe}=I,{imageRef:le,overlayRef:De,barRef:Fe}=z,A=ot(G[B]??1,le,ce),[Ie,Ae]=c.useState(null),$e=c.useCallback(a=>{Ae(a),typeof r=="function"?r(a):r&&(r.current=a)},[r]);ct(Ie,I,!N,A.panBy);const P=y[j],$=!!(P&&!P.expired&&!ee.has(P.src)),Xe=he.useImageFileInfo($?P?.downloadSrc??P?.src:void 0,L),Le=(a,w,M)=>{const q=a.currentTarget,O=se(w,q.naturalWidth,q.naturalHeight);M&&(O&&q.style.setProperty("--media-ratio",String(O)),z.zoomIn(q,O!==null&&1/O>ge,a.timeStamp))},ze=a=>{a.defaultPrevented||a.target.closest('[role="menu"]')||(a.key==="ArrowLeft"?(a.preventDefault(),I.step(-1)):a.key==="ArrowRight"?(a.preventDefault(),I.step(1)):(a.key==="+"||a.key==="=")&&$?(a.preventDefault(),H(1)):a.key==="-"&&$&&(a.preventDefault(),H(-1)))},Ve=a=>{const w=Q.current;w?.isConnected&&(a.preventDefault(),w.focus())},We=a=>{a.preventDefault(),a.currentTarget?.focus()},Be=a=>{U.consumeSwipe()||A.consumePan()||a.target instanceof HTMLElement&&a.target.hasAttribute("data-media-viewer-backdrop")&&z.requestClose({fade:N})},ue=(0,i.jsxs)(i.Fragment,{children:[P&&re?(0,i.jsx)(V.ItemActionsMenu,{dataHook:`${t}-actions-menu`,label:je(P,j),variant:"ghost",children:re(P,j)}):null,(0,i.jsx)(He.InfoTooltip,{ariaLabel:s??"Image details",className:"text-foreground hover:bg-accent size-9 items-center justify-center rounded-md",content:he.describeImageFile(Xe),dataHook:`${t}-info`,disabled:!$})]}),de=(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(J.Button,{iconOnly:!0,ariaLabel:l??"Download",dataHook:`${t}-download`,disabled:!$,variant:"ghost",onClick:()=>{P&&Je.downloadFile(P.downloadSrc??P.src)},children:(0,i.jsx)(Y.Download,{"aria-hidden":!0})}),(0,i.jsx)(J.Button,{iconOnly:!0,ariaLabel:_??"Zoom in",dataHook:`${t}-zoom-in`,disabled:!$||B===G.length-1,variant:"ghost",onClick:()=>H(1),children:(0,i.jsx)(Y.ZoomIn,{"aria-hidden":!0})}),(0,i.jsx)(J.Button,{iconOnly:!0,ariaLabel:e??"Zoom out",dataHook:`${t}-zoom-out`,disabled:!$||B===0,variant:"ghost",onClick:()=>H(-1),children:(0,i.jsx)(Y.ZoomOut,{"aria-hidden":!0})})]}),[Ue,fe]=c.useState(0),Ze=c.useMemo(()=>()=>(fe(a=>a+1),()=>fe(a=>a-1)),[]),Ye=a=>{const w=y[a];if(!w)return null;const M=a===j,q=w.expired||ee.has(w.src);if(q&&!M)return null;const O=Ne.get(w.src),me=O!==void 0&&1/O>ge;return(0,i.jsx)("div",{"aria-hidden":M?void 0:!0,className:(0,C.cn)("[container-type:size] absolute inset-0 flex px-4 pt-8 pb-4 sm:px-20",M&&!N?"overflow-auto":"overflow-hidden"),"data-media-viewer-backdrop":M?"":void 0,"data-slot":M?"media-viewer-slide":"media-viewer-peek",style:M?void 0:{transform:`translateX(${(a-j)*100}%)`},children:q?(0,i.jsx)("div",{className:"m-auto w-full max-w-3xl",children:(0,i.jsx)("div",{className:"aspect-[4/3] w-full",children:(0,i.jsx)(Ge.MediaEmpty,{dataHook:`${t}-empty`,message:R??"Image no longer available"})})}):(0,i.jsx)("img",{ref:M?le:void 0,alt:M?w.alt:"",className:(0,C.cn)("m-auto block h-auto",M&&N&&"cursor-grab active:cursor-grabbing",me?"w-full max-w-(--media-natural-width)":"w-[min(100cqw,calc(100cqh*var(--media-ratio,1)),var(--media-natural-width,100cqw))]"),"data-fit":M?me?"width":"contain":void 0,"data-hook":M?`${t}-image`:void 0,"data-media-viewer-backdrop":M&&!N?"":void 0,"data-slot":M?"media-viewer-image":void 0,"data-zoom":M?G[B]:void 0,decoding:"sync",draggable:!1,src:qe.has(w.src)?w.src:w.thumbnailSrc??w.src,style:{"--media-ratio":O,"--media-natural-width":oe.has(w.src)?`${oe.get(w.src)}px`:void 0,visibility:M&&!z.revealed?"hidden":void 0},onError:()=>Ce(w.src),onLoad:Ke=>Le(Ke,w.src,M)})},w.src)};return(0,i.jsxs)(pe.DialogPortal,{children:[(0,i.jsx)(pe.DialogOverlay,{ref:De,className:"data-[state=closed]:duration-fast bg-black/85 data-[state=closed]:ease-out"}),(0,i.jsxs)(te.Content,{ref:$e,"aria-describedby":void 0,className:(0,C.cn)("dark text-foreground group/viewer data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:duration-fast fixed inset-0 z-50 grid h-dvh w-screen grid-rows-[minmax(0,1fr)_auto] ease-out outline-none",o),"data-hook":t,"data-media-viewer-backdrop":"","data-slot":"media-viewer-content","data-tracking-el":m??"media-viewer","data-tracking-label":n,...T,onClick:a=>Z.composeEventHandlers(f,Be)(a),onCloseAutoFocus:a=>Z.composeEventHandlers(u,Ve)(a),onEscapeKeyDown:a=>Z.composeEventHandlers(h,w=>{w.preventDefault(),z.requestClose({fade:N})})(a),onKeyDown:a=>Z.composeEventHandlers(k,ze)(a),onOpenAutoFocus:a=>Z.composeEventHandlers(E,We)(a),children:[(0,i.jsxs)("div",{ref:ce,className:(0,C.cn)("group/stage relative min-h-0 overflow-hidden select-none",N?"touch-none":"touch-pan-y"),"data-hook":`${t}-frame`,"data-slot":"media-viewer-frame",onPointerCancel:N?A.onPointerUp:U.onPointerCancel,onPointerDown:N?A.onPointerDown:U.onPointerDown,onPointerMove:N?A.onPointerMove:U.onPointerMove,onPointerUp:N?A.onPointerUp:U.onPointerUp,children:[(0,i.jsx)("div",{ref:Oe,className:"relative size-full",children:[j-1,j,j+1].map(Ye)}),F>1?(0,i.jsx)(lt,{dataHook:t,hasNext:ke,hasPrevious:Pe,nextLabel:b,previousLabel:p,onStep:I.step}):null]}),(0,i.jsxs)("div",{ref:Fe,className:(0,C.cn)("grid items-center gap-x-4 gap-y-1 px-4 pt-6 pb-3 sm:px-8","grid-cols-[minmax(0,1fr)_auto] [grid-template-areas:'strip_strip'_'title_actions'_'caption_actions'_'date_actions']","sm:grid-cols-[minmax(0,1fr)_minmax(0,2fr)_minmax(0,1fr)] sm:[grid-template-areas:'title_strip_actions'_'caption_strip_actions'_'date_strip_actions']"),"data-media-viewer-backdrop":"","data-slot":"media-viewer-bar",children:[F>1?(0,i.jsx)("span",{"aria-atomic":"true","aria-live":"polite",className:"sr-only","data-hook":`${t}-position`,"data-slot":"media-viewer-position",role:"status",children:(g??nt)(j+1,F)}):null,F>1?(0,i.jsx)(ut,{dataHook:t,failed:ee,index:j,items:y,label:x,onRatio:se,onSelect:I.goTo}):null,P?.alt?(0,i.jsx)(V.TruncatedText,{dataHook:`${t}-caption`,full:P.alt,render:a=>(0,i.jsx)("p",{ref:a,"aria-hidden":!0,className:"text-body-xs truncate [grid-area:caption]","data-hook":`${t}-caption`,"data-slot":"media-viewer-caption",children:P.alt})}):null,P?.date?(0,i.jsx)(Qe.RelativeDate,{className:"truncate [grid-area:date]",dataHook:`${t}-date`,labels:v,value:P.date}):null,(0,i.jsx)(V.MediaViewerControlsContext.Provider,{value:{lead:de,more:ue},children:(0,i.jsxs)(V.MediaViewerActionsRegistry.Provider,{value:Ze,children:[Ue?null:(0,i.jsxs)("div",{className:"flex items-center justify-end gap-1 [grid-area:actions]","data-hook":`${t}-actions`,"data-slot":"media-viewer-actions",children:[de,ue]}),d]})})]})]})]})});be.displayName="MediaViewerView";var _e=c.forwardRef((t,d)=>{const{viewable:g}=V.useMediaViewerContext("MediaViewerContent");return g?(0,i.jsx)(be,{ref:d,...t}):null});_e.displayName="MediaViewerContent";exports.MediaViewerContent=_e;
@@ -0,0 +1,102 @@
1
+ import { RelativeDateLabels } from '../components/relative-date';
2
+ import * as React from "react";
3
+ import * as DialogPrimitive from "@radix-ui/react-dialog";
4
+ /**
5
+ * Props for MediaViewerContent.
6
+ */
7
+ export interface MediaViewerContentProps extends Omit<React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>, "children" | "asChild"> {
8
+ /**
9
+ * Required data-hook attribute for automated testing. The parts derive
10
+ * theirs from it: `-frame`, `-image`, `-empty`, `-position`, `-previous`,
11
+ * `-next`, `-thumbnails`, `-thumbnail-<index>`.
12
+ * @example "photo-viewer"
13
+ */
14
+ dataHook: string;
15
+ /**
16
+ * `MediaViewerTitle` (required — it names the dialog) and, optionally,
17
+ * `MediaViewerActions`. They go in the bottom bar: the title on the left,
18
+ * over the open image's description (`alt`) and `date`; the actions on the right.
19
+ */
20
+ children: React.ReactNode;
21
+ /**
22
+ * Builds the "2 of 5" text from the position and the total.
23
+ * @default (current, total) => `${current} of ${total}`
24
+ */
25
+ formatPosition?: (current: number, total: number) => string;
26
+ /**
27
+ * Accessible label for the Previous button.
28
+ * @default "Previous"
29
+ */
30
+ previousLabel?: string;
31
+ /**
32
+ * Accessible label for the Next button.
33
+ * @default "Next"
34
+ */
35
+ nextLabel?: string;
36
+ /**
37
+ * Accessible name for the strip of thumbnails.
38
+ * @default "Images"
39
+ */
40
+ thumbnailsLabel?: string;
41
+ /**
42
+ * The line shown when an image has expired or cannot be loaded.
43
+ * @default "Image no longer available"
44
+ */
45
+ unavailableMessage?: string;
46
+ /**
47
+ * Accessible label for the Zoom in button.
48
+ * @default "Zoom in"
49
+ */
50
+ zoomInLabel?: string;
51
+ /**
52
+ * Accessible label for the Zoom out button.
53
+ * @default "Zoom out"
54
+ */
55
+ zoomOutLabel?: string;
56
+ /**
57
+ * Accessible label for the Download button.
58
+ * @default "Download"
59
+ */
60
+ downloadLabel?: string;
61
+ /**
62
+ * Accessible label for the image details button — its format, size in
63
+ * pixels and file size, in a tooltip.
64
+ * @default "Image details"
65
+ */
66
+ infoLabel?: string;
67
+ /**
68
+ * Words for the open image's date ("3 days ago", "today"). Each key
69
+ * defaults to its English value.
70
+ * @default DEFAULT_RELATIVE_DATE_LABELS
71
+ */
72
+ dateLabels?: Partial<RelativeDateLabels>;
73
+ /**
74
+ * Tracking element identifier for analytics.
75
+ * @default "media-viewer"
76
+ */
77
+ trackingEl?: string;
78
+ /**
79
+ * Tracking label for analytics context.
80
+ */
81
+ trackingLabel?: string;
82
+ }
83
+ /**
84
+ * The full view, a lightbox that fills the window: the image with Previous /
85
+ * Next at its sides, and a bottom bar with the title, a strip of thumbnails and
86
+ * the actions; the arrow keys and Esc; an empty state for an expired image.
87
+ *
88
+ * @example
89
+ * ```tsx
90
+ * <MediaViewerContent dataHook="photo-viewer">
91
+ * <MediaViewerTitle>Riverside Plumbing</MediaViewerTitle>
92
+ * <MediaViewerActions>
93
+ * <Button iconOnly variant="ghost" dataHook="photo-share" ariaLabel="Share" onClick={share}>
94
+ * <Share2 aria-hidden />
95
+ * </Button>
96
+ * </MediaViewerActions>
97
+ * </MediaViewerContent>
98
+ * ```
99
+ */
100
+ declare const MediaViewerContent: React.ForwardRefExoticComponent<MediaViewerContentProps & React.RefAttributes<HTMLDivElement>>;
101
+ export { MediaViewerContent };
102
+ //# sourceMappingURL=media-viewer-content.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media-viewer-content.d.ts","sourceRoot":"","sources":["../../src/lib/media-viewer-content.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAwC1D,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,6BAA6B,CAAC;AAiBrC;;GAEG;AACH,MAAM,WAAW,uBAAwB,SAAQ,IAAI,CACnD,KAAK,CAAC,wBAAwB,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,EAC9D,UAAU,GAAG,SAAS,CACvB;IACC;;;;;OAKG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;OAGG;IACH,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAC5D;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACzC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAk4CD;;;;;;;;;;;;;;;;GAgBG;AACH,QAAA,MAAM,kBAAkB,gGAMtB,CAAC;AAIH,OAAO,EAAE,kBAAkB,EAAE,CAAC"}