@ui-sdk/web 0.0.0-stage → 0.1.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (467) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +10 -2
  3. package/browser/web/accordion.js +1 -0
  4. package/browser/web/alert-dialog.js +1 -0
  5. package/browser/web/autocomplete.js +1 -0
  6. package/browser/web/avatar.js +1 -0
  7. package/browser/web/button.js +1 -0
  8. package/browser/web/calendar.js +1 -0
  9. package/browser/web/carousel.js +1 -0
  10. package/browser/web/checkbox.js +1 -0
  11. package/browser/web/chunks/0eRGibL6.js +1 -0
  12. package/browser/web/chunks/2bIEUO6_.js +1 -0
  13. package/browser/web/chunks/5A9w2ULz.js +1 -0
  14. package/browser/web/chunks/5RSyydjV.js +1 -0
  15. package/browser/web/chunks/9pWTy2wl.js +1 -0
  16. package/browser/web/chunks/B0f2j6zz.js +1 -0
  17. package/browser/web/chunks/B1rux6br.js +1 -0
  18. package/browser/web/chunks/B3-APaNf.js +1 -0
  19. package/browser/web/chunks/B7EgSgjQ.js +1 -0
  20. package/browser/web/chunks/B8QcOzJU.js +1 -0
  21. package/browser/web/chunks/BFueEkwm.js +3 -0
  22. package/browser/web/chunks/BJj3oS29.js +1 -0
  23. package/browser/web/chunks/BNSvTCpr.js +1 -0
  24. package/browser/web/chunks/BPD0kAZB.js +1 -0
  25. package/browser/web/chunks/BQeduZqT.js +1 -0
  26. package/browser/web/chunks/B_CVFyiz.js +1 -0
  27. package/browser/web/chunks/B_ns1YHO.js +1 -0
  28. package/browser/web/chunks/BcwkVTsR.js +1 -0
  29. package/browser/web/chunks/BeaQ6TYM.js +1 -0
  30. package/browser/web/chunks/BgBB013u.js +1 -0
  31. package/browser/web/chunks/BgsKhHDm.js +1 -0
  32. package/browser/web/chunks/BjMcbuhi.js +9 -0
  33. package/browser/web/chunks/Bjiy_F2N.js +1 -0
  34. package/browser/web/chunks/BqScCLwv.js +1 -0
  35. package/browser/web/chunks/BqX3Utqx.js +1 -0
  36. package/browser/web/chunks/BtVkQf3z.js +1 -0
  37. package/browser/web/chunks/By30h-7B.js +1 -0
  38. package/browser/web/chunks/C1zqYpy2.js +1 -0
  39. package/browser/web/chunks/C436juFf.js +1 -0
  40. package/browser/web/chunks/C4_bULs1.js +1 -0
  41. package/browser/web/chunks/C4omqJEz.js +1 -0
  42. package/browser/web/chunks/C7tt0T3n.js +1 -0
  43. package/browser/web/chunks/C8w7s5dg.js +1 -0
  44. package/browser/web/chunks/CElY4erO.js +1 -0
  45. package/browser/web/chunks/CFODo-m2.js +1 -0
  46. package/browser/web/chunks/CL4wjam9.js +1 -0
  47. package/browser/web/chunks/CMg-8UVf.js +1 -0
  48. package/browser/web/chunks/COWKfakj.js +1 -0
  49. package/browser/web/chunks/CQBU0qZ4.js +1 -0
  50. package/browser/web/chunks/CV6uABgc.js +1 -0
  51. package/browser/web/chunks/C_SWFpWQ.js +1 -0
  52. package/browser/web/chunks/C_Uanbrl.js +1 -0
  53. package/browser/web/chunks/Ce_CSanC.js +1 -0
  54. package/browser/web/chunks/Cg-ZmRhS.js +1 -0
  55. package/browser/web/chunks/Cgf2wPI_.js +1 -0
  56. package/browser/web/chunks/Cuep_3Vf.js +1 -0
  57. package/browser/web/chunks/D02PaHn6.js +1 -0
  58. package/browser/web/chunks/D5LiaI5R.js +1 -0
  59. package/browser/web/chunks/D9UgVYvF.js +1 -0
  60. package/browser/web/chunks/DC08tnkE.js +2 -0
  61. package/browser/web/chunks/DG8YGSvu.js +1 -0
  62. package/browser/web/chunks/DIQd0FYD.js +1 -0
  63. package/browser/web/chunks/DMLqacE8.js +1 -0
  64. package/browser/web/chunks/DSUI3yI-.js +1 -0
  65. package/browser/web/chunks/DT3Hb76X.js +1 -0
  66. package/browser/web/chunks/DY75g3-W.js +1 -0
  67. package/browser/web/chunks/DZpNQKZ9.js +1 -0
  68. package/browser/web/chunks/Db-W1wrC.js +1 -0
  69. package/browser/web/chunks/Dc1xK3Ii.js +1 -0
  70. package/browser/web/chunks/DdF6awFs.js +1 -0
  71. package/browser/web/chunks/DdaCLml8.js +1 -0
  72. package/browser/web/chunks/Dh8MLjQO.js +1 -0
  73. package/browser/web/chunks/DiuslJRy.js +1 -0
  74. package/browser/web/chunks/DjRcw3Y0.js +1 -0
  75. package/browser/web/chunks/Djdv-16J.js +1 -0
  76. package/browser/web/chunks/DnFXe_lF.js +1 -0
  77. package/browser/web/chunks/DneGv1oC.js +1 -0
  78. package/browser/web/chunks/DsVxP-p-.js +1 -0
  79. package/browser/web/chunks/DwDilCo2.js +1 -0
  80. package/browser/web/chunks/DwV48AXv.js +1 -0
  81. package/browser/web/chunks/F37aF4-L.js +1 -0
  82. package/browser/web/chunks/LyB6XIbN.js +1 -0
  83. package/browser/web/chunks/NKnbYGjC.js +1 -0
  84. package/browser/web/chunks/Vk-rVi16.js +1 -0
  85. package/browser/web/chunks/XsM0J1Ex.js +1 -0
  86. package/browser/web/chunks/asSN9iEp.js +1 -0
  87. package/browser/web/chunks/c-AjHfdF.js +1 -0
  88. package/browser/web/chunks/dR-12TPY.js +1 -0
  89. package/browser/web/chunks/hR4xM0EC.js +1 -0
  90. package/browser/web/chunks/hqOaBxAg.js +1 -0
  91. package/browser/web/chunks/kMKqqeG4.js +1 -0
  92. package/browser/web/chunks/kXboBcfi.js +1 -0
  93. package/browser/web/chunks/l4aQIg22.js +1 -0
  94. package/browser/web/chunks/tJC0JSU4.js +1 -0
  95. package/browser/web/chunks/wHdS_QYM.js +1 -0
  96. package/browser/web/chunks/yv8dTvNI.js +1 -0
  97. package/browser/web/chunks/yw9M3nfi.js +1 -0
  98. package/browser/web/collapsible.js +1 -0
  99. package/browser/web/color-picker.js +1 -0
  100. package/browser/web/combobox.js +2 -0
  101. package/browser/web/command.js +1 -0
  102. package/browser/web/core.js +5 -0
  103. package/browser/web/date-input.js +1 -0
  104. package/browser/web/date-picker.js +1 -0
  105. package/browser/web/dialog.js +1 -0
  106. package/browser/web/drawer.js +1 -0
  107. package/browser/web/field.js +1 -0
  108. package/browser/web/file-input.js +1 -0
  109. package/browser/web/hover-card.js +1 -0
  110. package/browser/web/image-cropper.js +1 -0
  111. package/browser/web/input.js +1 -0
  112. package/browser/web/label.js +1 -0
  113. package/browser/web/listbox.js +1 -0
  114. package/browser/web/menu.js +1 -0
  115. package/browser/web/menubar.js +1 -0
  116. package/browser/web/meter.js +1 -0
  117. package/browser/web/navigation-menu.js +1 -0
  118. package/browser/web/number-input.js +1 -0
  119. package/browser/web/otp-input.js +2 -0
  120. package/browser/web/overlays.js +1 -0
  121. package/browser/web/pagination.js +1 -0
  122. package/browser/web/password-input.js +1 -0
  123. package/browser/web/popover.js +1 -0
  124. package/browser/web/preferences.js +1 -0
  125. package/browser/web/progress.js +1 -0
  126. package/browser/web/radio.js +1 -0
  127. package/browser/web/rating.js +1 -0
  128. package/browser/web/resizable.js +1 -0
  129. package/browser/web/scroll-area.js +1 -0
  130. package/browser/web/segmented-control.js +1 -0
  131. package/browser/web/select.js +1 -0
  132. package/browser/web/separator.js +1 -0
  133. package/browser/web/slider.js +1 -0
  134. package/browser/web/switch.js +1 -0
  135. package/browser/web/tabs.js +1 -0
  136. package/browser/web/textarea.js +1 -0
  137. package/browser/web/time-input.js +1 -0
  138. package/browser/web/timeline.js +1 -0
  139. package/browser/web/toast.js +1 -0
  140. package/browser/web/toggle.js +1 -0
  141. package/browser/web/token-input.js +8 -0
  142. package/browser/web/toolbar.js +1 -0
  143. package/browser/web/tooltip.js +1 -0
  144. package/browser/web/tree.js +1 -0
  145. package/browser/web/trigger-menu.js +4 -0
  146. package/browser/web/waterfall.js +1 -0
  147. package/browser/web.css +3378 -0
  148. package/browser/web.js +3 -0
  149. package/custom-elements.json +32315 -0
  150. package/dist/accordion.d.ts +2 -0
  151. package/dist/accordion.js +57 -0
  152. package/dist/action.d.ts +16 -0
  153. package/dist/action.js +39 -0
  154. package/dist/agent.d.ts +2 -0
  155. package/dist/agent.js +7 -0
  156. package/dist/autocomplete.d.ts +2 -0
  157. package/dist/autocomplete.js +120 -0
  158. package/dist/autoload.d.ts +18 -0
  159. package/dist/autoload.js +63 -0
  160. package/dist/avatar.d.ts +2 -0
  161. package/dist/avatar.js +27 -0
  162. package/dist/browser-core.d.ts +2 -0
  163. package/dist/browser-core.js +8 -0
  164. package/dist/button.d.ts +2 -0
  165. package/dist/button.js +35 -0
  166. package/dist/calendar.d.ts +23 -0
  167. package/dist/calendar.js +429 -0
  168. package/dist/carousel.d.ts +2 -0
  169. package/dist/carousel.js +54 -0
  170. package/dist/checkbox.d.ts +4 -0
  171. package/dist/checkbox.js +75 -0
  172. package/dist/collapsible.d.ts +2 -0
  173. package/dist/collapsible.js +28 -0
  174. package/dist/color-picker.d.ts +2 -0
  175. package/dist/color-picker.js +64 -0
  176. package/dist/combobox.d.ts +2 -0
  177. package/dist/combobox.js +334 -0
  178. package/dist/command.d.ts +2 -0
  179. package/dist/command.js +122 -0
  180. package/dist/date-input.d.ts +3 -0
  181. package/dist/date-input.js +87 -0
  182. package/dist/date-picker.d.ts +2 -0
  183. package/dist/date-picker.js +174 -0
  184. package/dist/default-text.d.ts +3 -0
  185. package/dist/default-text.js +24 -0
  186. package/dist/define-element.d.ts +404 -0
  187. package/dist/define-element.js +1489 -0
  188. package/dist/dialog.d.ts +3 -0
  189. package/dist/dialog.js +94 -0
  190. package/dist/drawer.d.ts +2 -0
  191. package/dist/drawer.js +96 -0
  192. package/dist/entries/accordion.d.ts +3 -0
  193. package/dist/entries/accordion.js +7 -0
  194. package/dist/entries/alert-dialog.d.ts +3 -0
  195. package/dist/entries/alert-dialog.js +13 -0
  196. package/dist/entries/autocomplete.d.ts +3 -0
  197. package/dist/entries/autocomplete.js +7 -0
  198. package/dist/entries/avatar.d.ts +2 -0
  199. package/dist/entries/avatar.js +3 -0
  200. package/dist/entries/button.d.ts +2 -0
  201. package/dist/entries/button.js +3 -0
  202. package/dist/entries/calendar.d.ts +3 -0
  203. package/dist/entries/calendar.js +7 -0
  204. package/dist/entries/carousel.d.ts +3 -0
  205. package/dist/entries/carousel.js +7 -0
  206. package/dist/entries/checkbox.d.ts +3 -0
  207. package/dist/entries/checkbox.js +15 -0
  208. package/dist/entries/collapsible.d.ts +3 -0
  209. package/dist/entries/collapsible.js +7 -0
  210. package/dist/entries/color-picker.d.ts +3 -0
  211. package/dist/entries/color-picker.js +7 -0
  212. package/dist/entries/combobox.d.ts +3 -0
  213. package/dist/entries/combobox.js +7 -0
  214. package/dist/entries/command.d.ts +3 -0
  215. package/dist/entries/command.js +7 -0
  216. package/dist/entries/date-input.d.ts +3 -0
  217. package/dist/entries/date-input.js +7 -0
  218. package/dist/entries/date-picker.d.ts +3 -0
  219. package/dist/entries/date-picker.js +7 -0
  220. package/dist/entries/dialog.d.ts +3 -0
  221. package/dist/entries/dialog.js +7 -0
  222. package/dist/entries/drawer.d.ts +3 -0
  223. package/dist/entries/drawer.js +8 -0
  224. package/dist/entries/field.d.ts +2 -0
  225. package/dist/entries/field.js +3 -0
  226. package/dist/entries/file-input.d.ts +3 -0
  227. package/dist/entries/file-input.js +13 -0
  228. package/dist/entries/hover-card.d.ts +3 -0
  229. package/dist/entries/hover-card.js +7 -0
  230. package/dist/entries/image-cropper.d.ts +3 -0
  231. package/dist/entries/image-cropper.js +7 -0
  232. package/dist/entries/input.d.ts +3 -0
  233. package/dist/entries/input.js +8 -0
  234. package/dist/entries/label.d.ts +2 -0
  235. package/dist/entries/label.js +3 -0
  236. package/dist/entries/listbox.d.ts +3 -0
  237. package/dist/entries/listbox.js +7 -0
  238. package/dist/entries/menu.d.ts +3 -0
  239. package/dist/entries/menu.js +7 -0
  240. package/dist/entries/menubar.d.ts +3 -0
  241. package/dist/entries/menubar.js +7 -0
  242. package/dist/entries/meter.d.ts +2 -0
  243. package/dist/entries/meter.js +3 -0
  244. package/dist/entries/navigation-menu.d.ts +3 -0
  245. package/dist/entries/navigation-menu.js +7 -0
  246. package/dist/entries/number-input.d.ts +3 -0
  247. package/dist/entries/number-input.js +7 -0
  248. package/dist/entries/otp-input.d.ts +3 -0
  249. package/dist/entries/otp-input.js +7 -0
  250. package/dist/entries/overlays.d.ts +2 -0
  251. package/dist/entries/overlays.js +3 -0
  252. package/dist/entries/pagination.d.ts +3 -0
  253. package/dist/entries/pagination.js +11 -0
  254. package/dist/entries/password-input.d.ts +3 -0
  255. package/dist/entries/password-input.js +7 -0
  256. package/dist/entries/popover.d.ts +3 -0
  257. package/dist/entries/popover.js +7 -0
  258. package/dist/entries/preferences.d.ts +3 -0
  259. package/dist/entries/preferences.js +13 -0
  260. package/dist/entries/progress.d.ts +2 -0
  261. package/dist/entries/progress.js +3 -0
  262. package/dist/entries/radio.d.ts +3 -0
  263. package/dist/entries/radio.js +7 -0
  264. package/dist/entries/rating.d.ts +3 -0
  265. package/dist/entries/rating.js +8 -0
  266. package/dist/entries/resizable.d.ts +3 -0
  267. package/dist/entries/resizable.js +11 -0
  268. package/dist/entries/scroll-area.d.ts +3 -0
  269. package/dist/entries/scroll-area.js +7 -0
  270. package/dist/entries/segmented-control.d.ts +3 -0
  271. package/dist/entries/segmented-control.js +7 -0
  272. package/dist/entries/select.d.ts +3 -0
  273. package/dist/entries/select.js +7 -0
  274. package/dist/entries/separator.d.ts +2 -0
  275. package/dist/entries/separator.js +3 -0
  276. package/dist/entries/slider.d.ts +3 -0
  277. package/dist/entries/slider.js +7 -0
  278. package/dist/entries/switch.d.ts +3 -0
  279. package/dist/entries/switch.js +7 -0
  280. package/dist/entries/tabs.d.ts +3 -0
  281. package/dist/entries/tabs.js +7 -0
  282. package/dist/entries/textarea.d.ts +3 -0
  283. package/dist/entries/textarea.js +7 -0
  284. package/dist/entries/time-input.d.ts +3 -0
  285. package/dist/entries/time-input.js +7 -0
  286. package/dist/entries/timeline.d.ts +3 -0
  287. package/dist/entries/timeline.js +7 -0
  288. package/dist/entries/toast.d.ts +2 -0
  289. package/dist/entries/toast.js +3 -0
  290. package/dist/entries/toggle.d.ts +3 -0
  291. package/dist/entries/toggle.js +12 -0
  292. package/dist/entries/token-input.d.ts +3 -0
  293. package/dist/entries/token-input.js +17 -0
  294. package/dist/entries/toolbar.d.ts +3 -0
  295. package/dist/entries/toolbar.js +7 -0
  296. package/dist/entries/tooltip.d.ts +3 -0
  297. package/dist/entries/tooltip.js +7 -0
  298. package/dist/entries/tree.d.ts +3 -0
  299. package/dist/entries/tree.js +17 -0
  300. package/dist/entries/trigger-menu.d.ts +3 -0
  301. package/dist/entries/trigger-menu.js +11 -0
  302. package/dist/entries/waterfall.d.ts +3 -0
  303. package/dist/entries/waterfall.js +11 -0
  304. package/dist/events.d.ts +1658 -0
  305. package/dist/events.js +0 -0
  306. package/dist/field.d.ts +2 -0
  307. package/dist/field.js +101 -0
  308. package/dist/file-input.d.ts +2 -0
  309. package/dist/file-input.js +140 -0
  310. package/dist/forward-attributes.d.ts +2 -0
  311. package/dist/forward-attributes.js +22 -0
  312. package/dist/history.d.ts +2 -0
  313. package/dist/history.js +11 -0
  314. package/dist/hover-card.d.ts +2 -0
  315. package/dist/hover-card.js +31 -0
  316. package/dist/image-cropper.d.ts +2 -0
  317. package/dist/image-cropper.js +66 -0
  318. package/dist/index.d.ts +66 -0
  319. package/dist/index.js +269 -0
  320. package/dist/input.d.ts +3 -0
  321. package/dist/input.js +69 -0
  322. package/dist/label.d.ts +2 -0
  323. package/dist/label.js +11 -0
  324. package/dist/list.d.ts +40 -0
  325. package/dist/list.js +192 -0
  326. package/dist/listbox.d.ts +2 -0
  327. package/dist/listbox.js +84 -0
  328. package/dist/menu.d.ts +4 -0
  329. package/dist/menu.js +295 -0
  330. package/dist/menubar.d.ts +4 -0
  331. package/dist/menubar.js +30 -0
  332. package/dist/meter.d.ts +2 -0
  333. package/dist/meter.js +22 -0
  334. package/dist/navigation-menu.d.ts +2 -0
  335. package/dist/navigation-menu.js +114 -0
  336. package/dist/number-input.d.ts +2 -0
  337. package/dist/number-input.js +73 -0
  338. package/dist/observe.d.ts +2 -0
  339. package/dist/observe.js +7 -0
  340. package/dist/otp-input.d.ts +2 -0
  341. package/dist/otp-input.js +72 -0
  342. package/dist/overlays.d.ts +13 -0
  343. package/dist/overlays.js +156 -0
  344. package/dist/pagination.d.ts +2 -0
  345. package/dist/pagination.js +127 -0
  346. package/dist/password-input.d.ts +2 -0
  347. package/dist/password-input.js +57 -0
  348. package/dist/popover.d.ts +2 -0
  349. package/dist/popover.js +64 -0
  350. package/dist/popup.d.ts +40 -0
  351. package/dist/popup.js +112 -0
  352. package/dist/preferences.d.ts +2 -0
  353. package/dist/preferences.js +56 -0
  354. package/dist/progress.d.ts +2 -0
  355. package/dist/progress.js +22 -0
  356. package/dist/radio.d.ts +2 -0
  357. package/dist/radio.js +33 -0
  358. package/dist/rating.d.ts +2 -0
  359. package/dist/rating.js +64 -0
  360. package/dist/resizable.d.ts +2 -0
  361. package/dist/resizable.js +42 -0
  362. package/dist/scroll-area.d.ts +2 -0
  363. package/dist/scroll-area.js +45 -0
  364. package/dist/segmented-control.d.ts +2 -0
  365. package/dist/segmented-control.js +28 -0
  366. package/dist/select.d.ts +2 -0
  367. package/dist/select.js +239 -0
  368. package/dist/separator.d.ts +2 -0
  369. package/dist/separator.js +11 -0
  370. package/dist/slider.d.ts +2 -0
  371. package/dist/slider.js +77 -0
  372. package/dist/tabs.d.ts +2 -0
  373. package/dist/tabs.js +37 -0
  374. package/dist/timeline.d.ts +2 -0
  375. package/dist/timeline.js +27 -0
  376. package/dist/toast.d.ts +20 -0
  377. package/dist/toast.js +177 -0
  378. package/dist/toggle.d.ts +3 -0
  379. package/dist/toggle.js +64 -0
  380. package/dist/token-input.d.ts +2 -0
  381. package/dist/token-input.js +103 -0
  382. package/dist/toolbar.d.ts +2 -0
  383. package/dist/toolbar.js +36 -0
  384. package/dist/tooltip.d.ts +2 -0
  385. package/dist/tooltip.js +35 -0
  386. package/dist/tree.d.ts +2 -0
  387. package/dist/tree.js +147 -0
  388. package/dist/trigger-menu.d.ts +2 -0
  389. package/dist/trigger-menu.js +133 -0
  390. package/dist/waterfall.d.ts +2 -0
  391. package/dist/waterfall.js +140 -0
  392. package/docs/README.md +89 -0
  393. package/docs/agents.md +1523 -0
  394. package/docs/components/accordion.md +1401 -0
  395. package/docs/components/alert-dialog.md +788 -0
  396. package/docs/components/autocomplete.md +1692 -0
  397. package/docs/components/avatar.md +261 -0
  398. package/docs/components/button.md +441 -0
  399. package/docs/components/calendar.md +1536 -0
  400. package/docs/components/carousel.md +1055 -0
  401. package/docs/components/checkbox.md +1045 -0
  402. package/docs/components/collapsible.md +535 -0
  403. package/docs/components/color-picker.md +651 -0
  404. package/docs/components/combobox.md +3274 -0
  405. package/docs/components/command.md +1431 -0
  406. package/docs/components/date-input.md +563 -0
  407. package/docs/components/date-picker.md +1136 -0
  408. package/docs/components/dialog.md +1360 -0
  409. package/docs/components/drawer.md +1201 -0
  410. package/docs/components/field.md +519 -0
  411. package/docs/components/file-input.md +617 -0
  412. package/docs/components/hover-card.md +486 -0
  413. package/docs/components/image-cropper.md +489 -0
  414. package/docs/components/input.md +327 -0
  415. package/docs/components/label.md +208 -0
  416. package/docs/components/listbox.md +1015 -0
  417. package/docs/components/menu.md +1212 -0
  418. package/docs/components/menubar.md +460 -0
  419. package/docs/components/meter.md +298 -0
  420. package/docs/components/navigation-menu.md +1573 -0
  421. package/docs/components/number-input.md +1087 -0
  422. package/docs/components/otp-input.md +558 -0
  423. package/docs/components/pagination.md +639 -0
  424. package/docs/components/password-input.md +649 -0
  425. package/docs/components/popover.md +1433 -0
  426. package/docs/components/preferences.md +243 -0
  427. package/docs/components/progress.md +406 -0
  428. package/docs/components/radio.md +855 -0
  429. package/docs/components/rating.md +431 -0
  430. package/docs/components/resizable.md +866 -0
  431. package/docs/components/scroll-area.md +898 -0
  432. package/docs/components/segmented-control.md +421 -0
  433. package/docs/components/select.md +1957 -0
  434. package/docs/components/separator.md +238 -0
  435. package/docs/components/slider.md +1018 -0
  436. package/docs/components/switch.md +583 -0
  437. package/docs/components/tabs.md +948 -0
  438. package/docs/components/textarea.md +331 -0
  439. package/docs/components/time-input.md +235 -0
  440. package/docs/components/timeline.md +622 -0
  441. package/docs/components/toast.md +1223 -0
  442. package/docs/components/toggle.md +522 -0
  443. package/docs/components/token-input.md +854 -0
  444. package/docs/components/toolbar.md +815 -0
  445. package/docs/components/tooltip.md +860 -0
  446. package/docs/components/tree.md +1243 -0
  447. package/docs/components/trigger-menu.md +1110 -0
  448. package/docs/components/waterfall.md +709 -0
  449. package/docs/controllers.md +66 -0
  450. package/docs/core.md +8027 -0
  451. package/docs/custom-parts.md +91 -0
  452. package/docs/first-component.md +88 -0
  453. package/docs/forms.md +125 -0
  454. package/docs/installation.md +141 -0
  455. package/docs/introduction.md +32 -0
  456. package/docs/lists-and-menus.md +166 -0
  457. package/docs/llms.txt +1566 -0
  458. package/docs/parts-and-composition.md +57 -0
  459. package/docs/popups.md +92 -0
  460. package/docs/rendering.md +71 -0
  461. package/docs/server-rendering.md +118 -0
  462. package/docs/state-and-events.md +134 -0
  463. package/docs/styling-and-animation.md +104 -0
  464. package/docs/utilities/async-options.md +332 -0
  465. package/docs/utilities/shortcuts.md +184 -0
  466. package/html-custom-data.json +14792 -0
  467. package/package.json +302 -3
@@ -0,0 +1,489 @@
1
+ # Image Cropper
2
+
3
+ Choose the part of an image to keep by moving and resizing a selection, or by panning and zooming the image under it.
4
+
5
+ Use an image cropper to choose the part of a photo to keep, like a profile picture or a cover image. The crop is a box in the image's own pixels, with a quarter-turn rotation and a flip, ready to pass to [`cropImage`](../core.md#images).
6
+
7
+ <ComponentExample
8
+ name="image-cropper/basic"
9
+ inspect
10
+ caption="Pick a ratio, drag the selection or one of its handles, then press Crop. Tab to the selection and use the arrow keys, with Shift to move further."
11
+ />
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ npm install @ui-sdk/web @ui-sdk/core
17
+ ```
18
+
19
+ Import the component to register its elements. The import is safe on the server.
20
+
21
+ ```ts
22
+ import "@ui-sdk/web/image-cropper"
23
+ ```
24
+
25
+ ## Composition
26
+
27
+ Use the following composition to build a `ui-image-cropper`:
28
+
29
+ ```text
30
+ ui-image-cropper
31
+ ├── ui-image-cropper-viewport
32
+ │ ├── ui-image-cropper-image
33
+ │ └── ui-image-cropper-selection
34
+ │ ├── ui-image-cropper-grid
35
+ │ └── ui-image-cropper-handle
36
+ ├── ui-image-cropper-zoom
37
+ ├── ui-image-cropper-rotate
38
+ └── ui-image-cropper-flip
39
+ ```
40
+
41
+ - **ui-image-cropper** holds the crop and the image's `src`, and is a group around the parts.
42
+ - **ui-image-cropper-viewport** is the area the image shows in. Give it a size, and its padding keeps the image off its edges.
43
+ - **ui-image-cropper-image** wraps your `<img>`, with its `alt`, and turns and flips it.
44
+ - **ui-image-cropper-selection** shows the crop over the image. It's a slider you drag or move with the arrow keys.
45
+ - **ui-image-cropper-grid** draws lines across the selection, in thirds, for you to style.
46
+ - **ui-image-cropper-handle** resizes the selection from one edge or corner, its `position`, like `"se"` for the bottom right.
47
+ - **ui-image-cropper-zoom** wraps a range input from 1, the largest crop, to `max-zoom`.
48
+ - **ui-image-cropper-rotate** turns the image a quarter clockwise.
49
+ - **ui-image-cropper-flip** mirrors the image left to right, or top to bottom with `direction="vertical"`.
50
+
51
+ The viewport, image and selection are needed. The rest are optional. The zoom, rotate and flip use the `<input>` or `<button>` you put inside them, or make one.
52
+
53
+ ## Usage
54
+
55
+ Import the parts and put them together:
56
+
57
+ ```html
58
+ <script type="module">
59
+ import "@ui-sdk/web/image-cropper"
60
+ </script>
61
+
62
+ <ui-image-cropper aria-label="Cover photo" src="cover.jpg" aspect-ratio="3">
63
+ <ui-image-cropper-viewport>
64
+ <ui-image-cropper-image>
65
+ <img alt="Your cover photo" />
66
+ </ui-image-cropper-image>
67
+ <ui-image-cropper-selection>
68
+ <ui-image-cropper-handle position="nw"></ui-image-cropper-handle>
69
+ <ui-image-cropper-handle position="se"></ui-image-cropper-handle>
70
+ </ui-image-cropper-selection>
71
+ </ui-image-cropper-viewport>
72
+ </ui-image-cropper>
73
+ ```
74
+
75
+ Name the cropper with `aria-label`. Until the image loads, the root has `data-loading` and `aria-busy`, and the selection is hidden. The crop then starts in the middle at `aspectRatio`, four fifths as large as the image allows so its edges show, or as large as it allows in a frame, unless you set the `defaultCrop` property:
76
+
77
+ ```ts
78
+ const cropper = document.querySelector("ui-image-cropper")!
79
+ cropper.defaultCrop = { x: 40, y: 40, width: 320, height: 240 }
80
+ ```
81
+
82
+ ## Aspect Ratio
83
+
84
+ Set `aspect-ratio` to keep the crop's width over its height, like `1` for a square or `16 / 9`. Changing it fits the crop to the new ratio about its middle. Without one, the crop is free, and holding Shift while dragging a handle keeps its current ratio. `min-width` and `min-height` stop it getting too small, in image pixels.
85
+
86
+ ```ts title="aspect-ratio.ts"
87
+ import "@ui-sdk/web/image-cropper"
88
+
89
+ const photo = `data:image/svg+xml,${encodeURIComponent(
90
+ `<svg xmlns="http://www.w3.org/2000/svg" width="640" height="420"><rect width="640" height="420" fill="#e5e5e5"/><circle cx="460" cy="150" r="56" fill="#fafafa"/><path d="M0 280 120 170l110 100 120-130 130 125 90-60 70 40v175H0z" fill="#a3a3a3"/><path d="M0 330l160-80 120 70 150-80 210 85v95H0z" fill="#525252"/><path d="M0 380q160-35 320-10t320-5v55H0z" fill="#262626"/></svg>`
91
+ )}`
92
+
93
+ const ratios = [
94
+ { label: "Free", value: "" },
95
+ { label: "Square", value: "1" },
96
+ { label: "Wide", value: String(16 / 9) },
97
+ ]
98
+
99
+ const handles = ["nw", "n", "ne", "e", "se", "s", "sw", "w"]
100
+
101
+ function mount(root: HTMLElement) {
102
+ root.innerHTML = `
103
+ <div data-slot="stack">
104
+ <div data-slot="controls">
105
+ ${ratios
106
+ .map(
107
+ (ratio) =>
108
+ `<button type="button" aria-pressed="${ratio.value === ""}" data-ratio="${ratio.value}">${ratio.label}</button>`
109
+ )
110
+ .join("")}
111
+ </div>
112
+ <ui-image-cropper aria-label="Photo" src="${photo}" min-width="64" min-height="64">
113
+ <ui-image-cropper-viewport>
114
+ <ui-image-cropper-image><img alt="Mountains at sunset" /></ui-image-cropper-image>
115
+ <ui-image-cropper-selection>
116
+ <ui-image-cropper-grid></ui-image-cropper-grid>
117
+ ${handles.map((position) => `<ui-image-cropper-handle position="${position}"></ui-image-cropper-handle>`).join("")}
118
+ </ui-image-cropper-selection>
119
+ </ui-image-cropper-viewport>
120
+ <div data-slot="row">
121
+ <ui-image-cropper-flip>Flip</ui-image-cropper-flip>
122
+ <ui-image-cropper-flip direction="vertical">Flip Vertically</ui-image-cropper-flip>
123
+ </div>
124
+ </ui-image-cropper>
125
+ </div>
126
+ `
127
+ const cropper = root.querySelector("ui-image-cropper")!
128
+ const buttons = root.querySelectorAll<HTMLButtonElement>("[data-ratio]")
129
+ for (const button of buttons) {
130
+ button.addEventListener("click", () => {
131
+ for (const other of buttons) {
132
+ other.setAttribute("aria-pressed", String(other === button))
133
+ }
134
+ if (button.dataset.ratio) {
135
+ cropper.setAttribute("aspect-ratio", button.dataset.ratio)
136
+ } else {
137
+ cropper.removeAttribute("aspect-ratio")
138
+ }
139
+ })
140
+ }
141
+ }
142
+
143
+ export { mount }
144
+ ```
145
+
146
+ Choose Square or Wide, then drag an edge. Flip mirrors the image and the crop with it.
147
+
148
+ ## Frame Mode
149
+
150
+ Set `mode="frame"` for an avatar editor. The selection stays still and as large as it fits, and you pan the image under it with a drag, and zoom with the wheel, a pinch or the zoom input. Handles don't show in a frame.
151
+
152
+ `shape="circle"` rounds the selection, but the crop is still its box, so pass `shape: "circle"` to `cropImage` too. Here, Save Avatar crops a 128 pixel round file:
153
+
154
+ ```ts title="avatar.ts"
155
+ import "@ui-sdk/web/image-cropper"
156
+ import { cropImage } from "@ui-sdk/web"
157
+
158
+ const photo = `data:image/svg+xml,${encodeURIComponent(
159
+ `<svg xmlns="http://www.w3.org/2000/svg" width="640" height="420"><rect width="640" height="420" fill="#e5e5e5"/><circle cx="460" cy="150" r="56" fill="#fafafa"/><path d="M0 280 120 170l110 100 120-130 130 125 90-60 70 40v175H0z" fill="#a3a3a3"/><path d="M0 330l160-80 120 70 150-80 210 85v95H0z" fill="#525252"/><path d="M0 380q160-35 320-10t320-5v55H0z" fill="#262626"/></svg>`
160
+ )}`
161
+
162
+ function mount(root: HTMLElement) {
163
+ root.innerHTML = `
164
+ <ui-image-cropper aria-label="Profile photo" src="${photo}" mode="frame" aspect-ratio="1" shape="circle" max-zoom="4">
165
+ <ui-image-cropper-viewport>
166
+ <ui-image-cropper-image><img alt="Mountains at sunset" /></ui-image-cropper-image>
167
+ <ui-image-cropper-selection></ui-image-cropper-selection>
168
+ </ui-image-cropper-viewport>
169
+ <div data-slot="row">
170
+ <ui-image-cropper-zoom></ui-image-cropper-zoom>
171
+ <ui-image-cropper-rotate>Rotate</ui-image-cropper-rotate>
172
+ </div>
173
+ <div data-slot="row">
174
+ <button type="button">Save Avatar</button>
175
+ <img data-slot="image-cropper-avatar" alt="Your new avatar" hidden />
176
+ </div>
177
+ </ui-image-cropper>
178
+ `
179
+ const cropper = root.querySelector("ui-image-cropper")!
180
+ const avatar = root.querySelector<HTMLImageElement>(
181
+ '[data-slot="image-cropper-avatar"]'
182
+ )!
183
+ root
184
+ .querySelector("[data-slot=row] > button")!
185
+ .addEventListener("click", async () => {
186
+ if (!cropper.crop) {
187
+ return
188
+ }
189
+ const file = await cropImage(photo, cropper.crop, {
190
+ width: 128,
191
+ shape: "circle",
192
+ })
193
+ if (avatar.src) {
194
+ URL.revokeObjectURL(avatar.src)
195
+ }
196
+ avatar.src = URL.createObjectURL(file)
197
+ avatar.hidden = false
198
+ })
199
+ }
200
+
201
+ export { mount }
202
+ ```
203
+
204
+ Drag the image or move the zoom, then press Save Avatar. The new avatar shows beside the button.
205
+
206
+ ## Rotate and Flip
207
+
208
+ `ui-image-cropper-rotate` turns the image a quarter clockwise, and R does the same from the keyboard, with Shift to turn it back. `ui-image-cropper-flip` mirrors the image. The crop turns and flips with the image, so it keeps the same part of the photo. Its `x` and `y` count from the top left of the image as it shows, turned and flipped, which is what `cropImage` takes.
209
+
210
+ ## Disabled
211
+
212
+ Set `disabled`. The selection and handles can't be focused or dragged, and the zoom input and buttons are disabled.
213
+
214
+ ```html
215
+ <ui-image-cropper aria-label="Photo" src="photo.jpg" disabled>
216
+ <!-- … -->
217
+ </ui-image-cropper>
218
+ ```
219
+
220
+ ## Controlled
221
+
222
+ Listen to `cropchange` for each change. Each change carries a [reason](#reasons), like `drag`, `step-key` or `zoom-input`. Call `event.preventDefault()` to keep the current crop.
223
+
224
+ `cropchange` fires on every step of a drag and once the image loads. `cropcommit` fires once, when the drag, key press or wheel ends, so listen to it to save. The element's `crop` property reads the crop, and its `api` property sets it from anywhere:
225
+
226
+ ```ts
227
+ import "@ui-sdk/web/image-cropper"
228
+
229
+ const cropper = document.querySelector("ui-image-cropper")!
230
+
231
+ cropper.addEventListener("cropcommit", (event) => {
232
+ console.log(event.detail.value, event.detail.reason)
233
+ })
234
+
235
+ document
236
+ .querySelector("#zoom-in")!
237
+ .addEventListener("click", () => cropper.api.setZoom(2))
238
+ ```
239
+
240
+ See [State and Events](../state-and-events.md) for controlled state, cancellation and debugging.
241
+
242
+ ## Styling
243
+
244
+ Parts are unstyled, apart from the positions they need: the viewport is `position: relative` with `overflow: hidden`, and the image and selection get their place as inline styles in pixels. Give the viewport a size, and the handles a size and a place on their edge or corner of the selection.
245
+
246
+ A box viewport fits the whole image, so set its `aspect-ratio` to `--image-cropper-aspect-ratio`. A wide `box-shadow` on the selection dims the image outside it. Show the grid only while `data-dragging` is on it.
247
+
248
+ Each part has a `data-slot`, such as `image-cropper-selection`, and its state attributes are listed under [Data Attributes](#data-attributes).
249
+
250
+ ### ui-image-cropper-viewport
251
+ - `--image-cropper-aspect-ratio`: The image's width over its height as it shows, turned, once it loads. Give the viewport `aspect-ratio: var(--image-cropper-aspect-ratio)` to fit the image.
252
+
253
+ ## Data Attributes
254
+
255
+ ### ui-image-cropper
256
+ `[data-slot="image-cropper"]`
257
+
258
+ - `data-mode` (`box`, `frame`): How the crop changes.
259
+ - `data-shape` (`rectangle`, `circle`): The selection's shape.
260
+ - `data-loading`: Present until the image loads, while nothing can change.
261
+ - `data-disabled`: Present when the cropper is disabled.
262
+ - `data-error`: Present when the image failed to load.
263
+ - `data-dragging`: Present while a pointer drags the selection, the image or, on a handle, that handle. Show the grid with it.
264
+
265
+ ### ui-image-cropper-viewport
266
+ `[data-slot="image-cropper-viewport"]`
267
+
268
+ - `data-mode` (`box`, `frame`): How the crop changes.
269
+ - `data-shape` (`rectangle`, `circle`): The selection's shape.
270
+ - `data-loading`: Present until the image loads, while nothing can change.
271
+ - `data-disabled`: Present when the cropper is disabled.
272
+ - `data-error`: Present when the image failed to load.
273
+ - `data-dragging`: Present while a pointer drags the selection, the image or, on a handle, that handle. Show the grid with it.
274
+
275
+ ### ui-image-cropper-image
276
+ `[data-slot="image-cropper-image"]`
277
+
278
+ - `data-mode` (`box`, `frame`): How the crop changes.
279
+ - `data-shape` (`rectangle`, `circle`): The selection's shape.
280
+ - `data-loading`: Present until the image loads, while nothing can change.
281
+ - `data-disabled`: Present when the cropper is disabled.
282
+ - `data-error`: Present when the image failed to load.
283
+
284
+ ### ui-image-cropper-selection
285
+ `[data-slot="image-cropper-selection"]`
286
+
287
+ - `data-mode` (`box`, `frame`): How the crop changes.
288
+ - `data-shape` (`rectangle`, `circle`): The selection's shape.
289
+ - `data-loading`: Present until the image loads, while nothing can change.
290
+ - `data-disabled`: Present when the cropper is disabled.
291
+ - `data-error`: Present when the image failed to load.
292
+ - `data-dragging`: Present while a pointer drags the selection, the image or, on a handle, that handle. Show the grid with it.
293
+
294
+ ### ui-image-cropper-grid
295
+ `[data-slot="image-cropper-grid"]`
296
+
297
+ - `data-mode` (`box`, `frame`): How the crop changes.
298
+ - `data-shape` (`rectangle`, `circle`): The selection's shape.
299
+ - `data-loading`: Present until the image loads, while nothing can change.
300
+ - `data-disabled`: Present when the cropper is disabled.
301
+ - `data-error`: Present when the image failed to load.
302
+ - `data-dragging`: Present while a pointer drags the selection, the image or, on a handle, that handle. Show the grid with it.
303
+
304
+ ### ui-image-cropper-handle
305
+ `[data-slot="image-cropper-handle"]`
306
+
307
+ - `data-position` (`n`, `e`, `s`, `w`, `ne`, `nw`, `se`, `sw`): The edge or corner the handle resizes.
308
+ - `data-mode` (`box`, `frame`): How the crop changes.
309
+ - `data-shape` (`rectangle`, `circle`): The selection's shape.
310
+ - `data-loading`: Present until the image loads, while nothing can change.
311
+ - `data-disabled`: Present when the cropper is disabled.
312
+ - `data-error`: Present when the image failed to load.
313
+ - `data-dragging`: Present while a pointer drags the selection, the image or, on a handle, that handle. Show the grid with it.
314
+
315
+ ### ui-image-cropper-zoom
316
+ `[data-slot="image-cropper-zoom"]`
317
+
318
+ - `data-mode` (`box`, `frame`): How the crop changes.
319
+ - `data-shape` (`rectangle`, `circle`): The selection's shape.
320
+ - `data-loading`: Present until the image loads, while nothing can change.
321
+ - `data-disabled`: Present when the cropper is disabled.
322
+ - `data-error`: Present when the image failed to load.
323
+
324
+ ### ui-image-cropper-rotate
325
+ `[data-slot="image-cropper-rotate"]`
326
+
327
+ - `data-mode` (`box`, `frame`): How the crop changes.
328
+ - `data-shape` (`rectangle`, `circle`): The selection's shape.
329
+ - `data-loading`: Present until the image loads, while nothing can change.
330
+ - `data-disabled`: Present when the cropper is disabled.
331
+ - `data-error`: Present when the image failed to load.
332
+
333
+ ### ui-image-cropper-flip
334
+ `[data-slot="image-cropper-flip"]`
335
+
336
+ - `data-direction` (`horizontal`, `vertical`): Which way the button mirrors the image.
337
+ - `data-mode` (`box`, `frame`): How the crop changes.
338
+ - `data-shape` (`rectangle`, `circle`): The selection's shape.
339
+ - `data-loading`: Present until the image loads, while nothing can change.
340
+ - `data-disabled`: Present when the cropper is disabled.
341
+ - `data-error`: Present when the image failed to load.
342
+
343
+ ## API Reference
344
+
345
+ Props are attributes in kebab case, like `aspect-ratio` and `max-zoom`. `defaultCrop` and `controller` are properties. `crop` is a live property. Callbacks are DOM events.
346
+
347
+ ### ui-image-cropper
348
+
349
+ - `src?` (`string`): The image's URL, like an object URL for a file someone picked.
350
+ - `crop?` (`ImageCrop`): The crop, in the image's own pixels, from the top left of the image as it shows once turned and flipped, with its `rotation`, `flipX` and `flipY`. Pass it straight to `cropImage`. Pass it to control the cropper.
351
+ - `defaultCrop?` (`ImageCrop`): The crop at first, when uncontrolled.
352
+ - `cropchange event`: Runs while the crop changes: on every step of a drag, a key or the wheel, and once an image loads. `details.cancel()` stops it.
353
+ - `cropcommit event`: Runs once an interaction that changed the crop ends: the pointer lifts, a key is pressed, the wheel pauses. For saving.
354
+ - `mode?` (`ImageCropperMode`): `"box"` moves and resizes a selection over the whole image. `"frame"` keeps the selection still and as large as it fits, and pans and zooms the image under it, like an avatar editor.
355
+ - `aspectRatio?` (`number`): Keeps the crop's width over its height, like `1` for a square or `16 / 9`. Changing it fits the crop to the new ratio.
356
+ - `shape?` (`ImageCropperShape`): The selection's shape, as `data-shape`. A circle is still a box to the crop, so pass `shape: "circle"` to `cropImage` too.
357
+ - `minWidth?` (`number`): The narrowest the crop gets, in image pixels.
358
+ - `minHeight?` (`number`): The shortest the crop gets, in image pixels.
359
+ - `maxZoom?` (`number`): How far the crop magnifies the image, where 1 is the largest crop the image allows.
360
+ - `disabled?` (`boolean`): Stops every change: the selection can't be focused, and the buttons and zoom are disabled.
361
+ - `controller?` (`object`): Sets the crop from anywhere. Create one with `createImageCropperController()`.
362
+ - `debug?` (`boolean`): Logs every state change with its reason to the console, in development builds.
363
+
364
+ ### ui-image-cropper-handle
365
+
366
+ - `position` (`ImageCropperHandlePosition`): The edge or corner it resizes, like `"nw"` for the top left corner.
367
+
368
+ ### ui-image-cropper-flip
369
+
370
+ - `direction?` (`ImageCropperFlipDirection`): Which way it mirrors the image.
371
+
372
+ ### State
373
+
374
+ The same state shows as data attributes on each element.
375
+
376
+ - `crop` (`Required<ImageCrop> | null`): The crop, or null until the image loads.
377
+ - `zoom` (`number`): How far the crop magnifies: 1 when it's as large as the image allows at its ratio.
378
+ - `loading` (`boolean`): Whether the image is still loading, so nothing can change yet.
379
+ - `error` (`boolean`): Whether the image failed to load.
380
+ - `dragging` (`boolean`): Whether a pointer is dragging the selection, a handle or the image.
381
+ - `mode` (`ImageCropperMode`): How the crop changes.
382
+ - `shape` (`ImageCropperShape`): The selection's shape.
383
+ - `disabled` (`boolean`): Whether the `disabled` option stops every change.
384
+
385
+ - `crop` (`Required<ImageCrop> | null`): The crop, or null until the image loads.
386
+ - `zoom` (`number`): How far the crop magnifies: 1 when it's as large as the image allows at its ratio.
387
+ - `loading` (`boolean`): Whether the image is still loading, so nothing can change yet.
388
+ - `error` (`boolean`): Whether the image failed to load.
389
+ - `dragging` (`boolean`): Whether a pointer is dragging the selection, a handle or the image.
390
+ - `mode` (`ImageCropperMode`): How the crop changes.
391
+ - `shape` (`ImageCropperShape`): The selection's shape.
392
+ - `disabled` (`boolean`): Whether the `disabled` option stops every change.
393
+ - `position` (`ImageCropperHandlePosition`): The edge or corner it resizes.
394
+
395
+ ### Reasons
396
+
397
+ `event.detail.reason` says why the crop changed.
398
+
399
+ - `image-load` (`Event | undefined`): An image loaded. No event when it was already in the browser's cache.
400
+ - `drag` (`PointerEvent`): A slider thumb or a resize handle was dragged, or an item was dragged to a new place in a list.
401
+ - `pinch`
402
+ - `wheel` (`WheelEvent`): The mouse wheel stepped a focused number input.
403
+ - `step-key` (`KeyboardEvent`): Arrow, Page Up, Page Down, Home or End stepped a slider or a number input.
404
+ - `zoom-key`
405
+ - `zoom-input`
406
+ - `rotate-key`
407
+ - `rotate-press`
408
+ - `flip-press`
409
+ - `aspect-ratio-change`
410
+ - `imperative` (`none`): A controller or `api` call, or a property set on a web component.
411
+
412
+ ### Controller
413
+
414
+ The element's `api` property has the same methods. The `crop` property reads and sets the crop.
415
+
416
+ Each write method takes an optional `{ reason, event }`, fires the change event like a drag, and returns `false` when nothing changed or the change is canceled.
417
+
418
+ - `getCrop()` (`() => Required<ImageCrop> | null`): The crop, or null until the image loads.
419
+ - `setCrop(crop, options?)` (`(crop: ImageCrop, options?: ImageCropperChangeOptions | undefined) => boolean`): Sets the crop, as a user would. Returns whether it changed.
420
+ - `rotate(direction?, options?)` (`(direction?: 1 | -1 | undefined, options?: ImageCropperChangeOptions | undefined) => boolean`): Turns the image a quarter clockwise, or counterclockwise with `-1`.
421
+ - `flip(direction?, options?)` (`(direction?: ImageCropperFlipDirection | undefined, options?: ImageCropperChangeOptions | undefined) => boolean`): Mirrors the image left to right, or top to bottom with `"vertical"`.
422
+ - `getZoom()` (`() => number`): How far the crop magnifies: 1 when it's as large as the image allows at its ratio.
423
+ - `setZoom(zoom, options?)` (`(zoom: number, options?: ImageCropperChangeOptions | undefined) => boolean`): Zooms to a level, about the crop's middle, within 1 and `maxZoom`.
424
+ - `focus()` (`() => void`): Moves focus to the selection.
425
+
426
+ ### Events
427
+
428
+ Events fire on their own element and don't bubble, with the new crop in `event.detail.value` and the `reason` and `event` beside it. Calling `preventDefault()` on `cropchange` cancels the change.
429
+
430
+ | Member | On | Description |
431
+ | ------------------ | ------------------ | ------------------------------------------------------------- |
432
+ | `crop` property | `ui-image-cropper` | The crop, or `null` until the image loads |
433
+ | `api` property | `ui-image-cropper` | The [controller](#controller) |
434
+ | `cropchange` event | `ui-image-cropper` | `detail: { value, reason, event }` |
435
+ | `cropcommit` event | `ui-image-cropper` | `detail: { value, reason, event }`, once the interaction ends |
436
+
437
+ ## Accessibility
438
+
439
+ No WAI-ARIA pattern covers an image cropper, so it's built from ones that do. The cropper is a group. The selection and each handle follow the [WAI-ARIA slider pattern](https://www.w3.org/WAI/ARIA/apg/patterns/slider/), and say the crop in words, like "300 by 300 pixels, at 50, 0". The zoom is a native range input that says its level, like "125%".
440
+
441
+ The selection, handles and zoom are named in English by default. Pass `aria-label` to name them in another language.
442
+
443
+ ### Keyboard
444
+
445
+ | Key | Does |
446
+ | ------------------- | -------------------------------------------------------- |
447
+ | Arrow keys | Move the selection, or on a handle, move its edges |
448
+ | Shift with an arrow | Moves ten times as far |
449
+ | Plus or Minus | Zooms in or out, about the crop's middle |
450
+ | R | Turns the image a quarter clockwise, or back with Shift |
451
+ | Escape | During a drag, puts the crop back where the drag started |
452
+
453
+ Each key press commits, like the end of a drag.
454
+
455
+ ### Tested Behavior
456
+
457
+ Every line below is an automated test.
458
+
459
+ **Loading**
460
+
461
+ - The crop starts once the image loads, as four fifths of the largest at the ratio.
462
+
463
+ **Box**
464
+
465
+ - A drag moves the selection over the image and commits once.
466
+ - A handle resizes from its corner, within the image.
467
+ - At a ratio, a handle keeps it.
468
+ - Escape during a drag puts the selection back.
469
+
470
+ **Keyboard**
471
+
472
+ - Arrows move the selection, ten times as far with Shift.
473
+ - Arrows on a handle move its edges, and the next Tab reaches it.
474
+ - Plus and minus zoom about the middle, and R turns the image.
475
+
476
+ **Controls**
477
+
478
+ - The zoom input zooms the crop.
479
+ - Rotate turns the image a quarter clockwise, and flip mirrors it.
480
+ - A controller sets the crop, and a canceled change keeps it.
481
+ - Disabled, nothing takes focus or changes.
482
+
483
+ **Frame**
484
+
485
+ - The selection stays put and a drag pans the image under it.
486
+ - Escape during a pan puts the image back.
487
+ - The wheel zooms at the pointer and commits after a pause.
488
+
489
+ Runs in React, Vue and web components.