@economic/taco 1.1.12 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (364) hide show
  1. package/README.md +82 -82
  2. package/dist/components/Group/Group.d.ts +11 -1
  3. package/dist/components/Toast/Toast.d.ts +2 -2
  4. package/dist/components/Toast/Toaster.d.ts +2 -2
  5. package/dist/esm/components/Accordion/Accordion.js +31 -34
  6. package/dist/esm/components/Accordion/Accordion.js.map +1 -1
  7. package/dist/esm/components/Backdrop/Backdrop.js +2 -2
  8. package/dist/esm/components/Backdrop/Backdrop.js.map +1 -1
  9. package/dist/esm/components/Badge/Badge.js +14 -14
  10. package/dist/esm/components/Badge/Badge.js.map +1 -1
  11. package/dist/esm/components/Banner/Banner.js +7 -5
  12. package/dist/esm/components/Banner/Banner.js.map +1 -1
  13. package/dist/esm/components/Banner/util.js.map +1 -1
  14. package/dist/esm/components/Button/Button.js +12 -13
  15. package/dist/esm/components/Button/Button.js.map +1 -1
  16. package/dist/esm/components/Button/util.js.map +1 -1
  17. package/dist/esm/components/Calendar/Calendar.js +56 -71
  18. package/dist/esm/components/Calendar/Calendar.js.map +1 -1
  19. package/dist/esm/components/Card/Card.js +13 -12
  20. package/dist/esm/components/Card/Card.js.map +1 -1
  21. package/dist/esm/components/Checkbox/Checkbox.js +15 -18
  22. package/dist/esm/components/Checkbox/Checkbox.js.map +1 -1
  23. package/dist/esm/components/Combobox/Combobox.js +23 -25
  24. package/dist/esm/components/Combobox/Combobox.js.map +1 -1
  25. package/dist/esm/components/Combobox/useCombobox.js +12 -13
  26. package/dist/esm/components/Combobox/useCombobox.js.map +1 -1
  27. package/dist/esm/components/Datepicker/Datepicker.js +48 -52
  28. package/dist/esm/components/Datepicker/Datepicker.js.map +1 -1
  29. package/dist/esm/components/Datepicker/useDatepicker.js.map +1 -1
  30. package/dist/esm/components/Dialog/Context.js.map +1 -1
  31. package/dist/esm/components/Dialog/Dialog.js +39 -58
  32. package/dist/esm/components/Dialog/Dialog.js.map +1 -1
  33. package/dist/esm/components/Dialog/components/Content.js.map +1 -1
  34. package/dist/esm/components/Dialog/components/Drawer.js.map +1 -1
  35. package/dist/esm/components/Dialog/components/Extra.js.map +1 -1
  36. package/dist/esm/components/Dialog/components/Trigger.js.map +1 -1
  37. package/dist/esm/components/Field/Field.js +10 -12
  38. package/dist/esm/components/Field/Field.js.map +1 -1
  39. package/dist/esm/components/Form/Form.js +6 -8
  40. package/dist/esm/components/Form/Form.js.map +1 -1
  41. package/dist/esm/components/Group/Group.js +4 -1
  42. package/dist/esm/components/Group/Group.js.map +1 -1
  43. package/dist/esm/components/Hanger/Hanger.js +27 -35
  44. package/dist/esm/components/Hanger/Hanger.js.map +1 -1
  45. package/dist/esm/components/HoverCard/HoverCard.js.map +1 -1
  46. package/dist/esm/components/Icon/Icon.js.map +1 -1
  47. package/dist/esm/components/Icon/components/AccountPreview.js.map +1 -1
  48. package/dist/esm/components/Icon/components/Accounting.js.map +1 -1
  49. package/dist/esm/components/Icon/components/AccountingYear.js.map +1 -1
  50. package/dist/esm/components/Icon/components/AccountingYearCancel.js.map +1 -1
  51. package/dist/esm/components/Icon/components/ArrowBottom.js.map +1 -1
  52. package/dist/esm/components/Icon/components/ArrowDown.js.map +1 -1
  53. package/dist/esm/components/Icon/components/ArrowEnd.js.map +1 -1
  54. package/dist/esm/components/Icon/components/ArrowLeft.js.map +1 -1
  55. package/dist/esm/components/Icon/components/ArrowRight.js.map +1 -1
  56. package/dist/esm/components/Icon/components/ArrowStart.js.map +1 -1
  57. package/dist/esm/components/Icon/components/ArrowTop.js.map +1 -1
  58. package/dist/esm/components/Icon/components/ArrowUp.js.map +1 -1
  59. package/dist/esm/components/Icon/components/Attach.js.map +1 -1
  60. package/dist/esm/components/Icon/components/AttachAuto.js.map +1 -1
  61. package/dist/esm/components/Icon/components/AttachCancel.js.map +1 -1
  62. package/dist/esm/components/Icon/components/Autotext.js.map +1 -1
  63. package/dist/esm/components/Icon/components/AutotextInsert.js.map +1 -1
  64. package/dist/esm/components/Icon/components/Basic.js.map +1 -1
  65. package/dist/esm/components/Icon/components/BasicTabs.js.map +1 -1
  66. package/dist/esm/components/Icon/components/BellSolid.js.map +1 -1
  67. package/dist/esm/components/Icon/components/Book.js.map +1 -1
  68. package/dist/esm/components/Icon/components/Booking.js.map +1 -1
  69. package/dist/esm/components/Icon/components/Budget.js.map +1 -1
  70. package/dist/esm/components/Icon/components/Calendar.js.map +1 -1
  71. package/dist/esm/components/Icon/components/CashAccount.js.map +1 -1
  72. package/dist/esm/components/Icon/components/CashReports.js.map +1 -1
  73. package/dist/esm/components/Icon/components/Chat.js.map +1 -1
  74. package/dist/esm/components/Icon/components/ChatSolid.js.map +1 -1
  75. package/dist/esm/components/Icon/components/ChevronDown.js.map +1 -1
  76. package/dist/esm/components/Icon/components/ChevronDownDouble.js.map +1 -1
  77. package/dist/esm/components/Icon/components/ChevronDownSolid.js.map +1 -1
  78. package/dist/esm/components/Icon/components/ChevronLeft.js.map +1 -1
  79. package/dist/esm/components/Icon/components/ChevronLeftDouble.js.map +1 -1
  80. package/dist/esm/components/Icon/components/ChevronRight.js.map +1 -1
  81. package/dist/esm/components/Icon/components/ChevronRightDouble.js.map +1 -1
  82. package/dist/esm/components/Icon/components/ChevronUp.js.map +1 -1
  83. package/dist/esm/components/Icon/components/ChevronUpDouble.js.map +1 -1
  84. package/dist/esm/components/Icon/components/ChevronUpSolid.js.map +1 -1
  85. package/dist/esm/components/Icon/components/CircleClose.js.map +1 -1
  86. package/dist/esm/components/Icon/components/CircleMinus.js.map +1 -1
  87. package/dist/esm/components/Icon/components/CirclePlus.js.map +1 -1
  88. package/dist/esm/components/Icon/components/CircleTick.js.map +1 -1
  89. package/dist/esm/components/Icon/components/Clamp.js.map +1 -1
  90. package/dist/esm/components/Icon/components/ClampOpen.js.map +1 -1
  91. package/dist/esm/components/Icon/components/Close.js.map +1 -1
  92. package/dist/esm/components/Icon/components/ConnectionEnable.js.map +1 -1
  93. package/dist/esm/components/Icon/components/ConnectionRevoke.js.map +1 -1
  94. package/dist/esm/components/Icon/components/Contacts.js.map +1 -1
  95. package/dist/esm/components/Icon/components/Copy.js.map +1 -1
  96. package/dist/esm/components/Icon/components/Courses.js.map +1 -1
  97. package/dist/esm/components/Icon/components/Credit.js.map +1 -1
  98. package/dist/esm/components/Icon/components/Delete.js.map +1 -1
  99. package/dist/esm/components/Icon/components/DeletePermanently.js.map +1 -1
  100. package/dist/esm/components/Icon/components/Depecriate.js.map +1 -1
  101. package/dist/esm/components/Icon/components/Developer.js.map +1 -1
  102. package/dist/esm/components/Icon/components/DistributionTemplate.js.map +1 -1
  103. package/dist/esm/components/Icon/components/Document.js.map +1 -1
  104. package/dist/esm/components/Icon/components/DocumentApprove.js.map +1 -1
  105. package/dist/esm/components/Icon/components/DocumentCreateEntry.js.map +1 -1
  106. package/dist/esm/components/Icon/components/DocumentCut.js.map +1 -1
  107. package/dist/esm/components/Icon/components/DocumentError.js.map +1 -1
  108. package/dist/esm/components/Icon/components/DocumentIsolatePage.js.map +1 -1
  109. package/dist/esm/components/Icon/components/DocumentMerge.js.map +1 -1
  110. package/dist/esm/components/Icon/components/DocumentMove.js.map +1 -1
  111. package/dist/esm/components/Icon/components/DocumentPreview.js.map +1 -1
  112. package/dist/esm/components/Icon/components/DocumentReceived.js.map +1 -1
  113. package/dist/esm/components/Icon/components/DocumentRejectedRequest.js.map +1 -1
  114. package/dist/esm/components/Icon/components/DocumentSplit.js.map +1 -1
  115. package/dist/esm/components/Icon/components/DocumentTime.js.map +1 -1
  116. package/dist/esm/components/Icon/components/Download.js.map +1 -1
  117. package/dist/esm/components/Icon/components/Drag.js.map +1 -1
  118. package/dist/esm/components/Icon/components/ECopedia.js.map +1 -1
  119. package/dist/esm/components/Icon/components/ESignature.js.map +1 -1
  120. package/dist/esm/components/Icon/components/Edit.js.map +1 -1
  121. package/dist/esm/components/Icon/components/EllipsisHorizontal.js.map +1 -1
  122. package/dist/esm/components/Icon/components/EllipsisVertical.js.map +1 -1
  123. package/dist/esm/components/Icon/components/EntriesOnAccount.js.map +1 -1
  124. package/dist/esm/components/Icon/components/EntriesOpen.js.map +1 -1
  125. package/dist/esm/components/Icon/components/EntriesWarning.js.map +1 -1
  126. package/dist/esm/components/Icon/components/EntryTypeCustomerInvoice.js.map +1 -1
  127. package/dist/esm/components/Icon/components/EntryTypeCustomerPayment.js.map +1 -1
  128. package/dist/esm/components/Icon/components/EntryTypeJournalEntry.js.map +1 -1
  129. package/dist/esm/components/Icon/components/EntryTypeManualCustomerInvoice.js.map +1 -1
  130. package/dist/esm/components/Icon/components/EntryTypeSupplierInvoice.js.map +1 -1
  131. package/dist/esm/components/Icon/components/EntryTypeSupplierPayment.js.map +1 -1
  132. package/dist/esm/components/Icon/components/Envelope.js.map +1 -1
  133. package/dist/esm/components/Icon/components/EnvelopeApproved.js.map +1 -1
  134. package/dist/esm/components/Icon/components/ExpandView.js.map +1 -1
  135. package/dist/esm/components/Icon/components/Expenses.js.map +1 -1
  136. package/dist/esm/components/Icon/components/Export.js.map +1 -1
  137. package/dist/esm/components/Icon/components/ExportToExcel.js.map +1 -1
  138. package/dist/esm/components/Icon/components/ExportToPdf.js.map +1 -1
  139. package/dist/esm/components/Icon/components/Filter.js.map +1 -1
  140. package/dist/esm/components/Icon/components/FilterSolid.js.map +1 -1
  141. package/dist/esm/components/Icon/components/GraphSolid.js.map +1 -1
  142. package/dist/esm/components/Icon/components/Hash.js.map +1 -1
  143. package/dist/esm/components/Icon/components/Home.js.map +1 -1
  144. package/dist/esm/components/Icon/components/Images.js.map +1 -1
  145. package/dist/esm/components/Icon/components/Import.js.map +1 -1
  146. package/dist/esm/components/Icon/components/Inbox.js.map +1 -1
  147. package/dist/esm/components/Icon/components/InboxEinvoicing.js.map +1 -1
  148. package/dist/esm/components/Icon/components/InboxScanning.js.map +1 -1
  149. package/dist/esm/components/Icon/components/InboxSmart.js.map +1 -1
  150. package/dist/esm/components/Icon/components/Info.js.map +1 -1
  151. package/dist/esm/components/Icon/components/Inventory.js.map +1 -1
  152. package/dist/esm/components/Icon/components/InventoryMatrix.js.map +1 -1
  153. package/dist/esm/components/Icon/components/JournalPro.js.map +1 -1
  154. package/dist/esm/components/Icon/components/Layout.js.map +1 -1
  155. package/dist/esm/components/Icon/components/LayoutBoth.js.map +1 -1
  156. package/dist/esm/components/Icon/components/LayoutFirst.js.map +1 -1
  157. package/dist/esm/components/Icon/components/LayoutLast.js.map +1 -1
  158. package/dist/esm/components/Icon/components/LayoutNone.js.map +1 -1
  159. package/dist/esm/components/Icon/components/LedgerCard.js.map +1 -1
  160. package/dist/esm/components/Icon/components/LedgerCardCustomerReminder.js.map +1 -1
  161. package/dist/esm/components/Icon/components/LedgerCardManualCustomerInvoice.js.map +1 -1
  162. package/dist/esm/components/Icon/components/LedgerCardObsoleteStock.js.map +1 -1
  163. package/dist/esm/components/Icon/components/LedgerCardOpeningEntry.js.map +1 -1
  164. package/dist/esm/components/Icon/components/LedgerCardReservedEntry.js.map +1 -1
  165. package/dist/esm/components/Icon/components/LedgerCardShrinkagePilferage.js.map +1 -1
  166. package/dist/esm/components/Icon/components/LedgerCardStockAdjustment.js.map +1 -1
  167. package/dist/esm/components/Icon/components/LedgerCardTransferredOpeningEntry.js.map +1 -1
  168. package/dist/esm/components/Icon/components/Lightbulb.js.map +1 -1
  169. package/dist/esm/components/Icon/components/Line.js.map +1 -1
  170. package/dist/esm/components/Icon/components/List.js.map +1 -1
  171. package/dist/esm/components/Icon/components/ListBulleted.js.map +1 -1
  172. package/dist/esm/components/Icon/components/ListSearch.js.map +1 -1
  173. package/dist/esm/components/Icon/components/LockOpen.js.map +1 -1
  174. package/dist/esm/components/Icon/components/Log.js.map +1 -1
  175. package/dist/esm/components/Icon/components/LogOut.js.map +1 -1
  176. package/dist/esm/components/Icon/components/Market.js.map +1 -1
  177. package/dist/esm/components/Icon/components/MatchAmount.js.map +1 -1
  178. package/dist/esm/components/Icon/components/MatchEntries.js.map +1 -1
  179. package/dist/esm/components/Icon/components/Menu.js.map +1 -1
  180. package/dist/esm/components/Icon/components/Mileage.js.map +1 -1
  181. package/dist/esm/components/Icon/components/ModalResize.js.map +1 -1
  182. package/dist/esm/components/Icon/components/ModalShrink.js.map +1 -1
  183. package/dist/esm/components/Icon/components/More.js.map +1 -1
  184. package/dist/esm/components/Icon/components/MoreSolid.js.map +1 -1
  185. package/dist/esm/components/Icon/components/Move.js.map +1 -1
  186. package/dist/esm/components/Icon/components/NavigationList.js.map +1 -1
  187. package/dist/esm/components/Icon/components/Note.js.map +1 -1
  188. package/dist/esm/components/Icon/components/NoteFollowUp.js.map +1 -1
  189. package/dist/esm/components/Icon/components/NoteRead.js.map +1 -1
  190. package/dist/esm/components/Icon/components/Numbers.js.map +1 -1
  191. package/dist/esm/components/Icon/components/PartnerApi.js.map +1 -1
  192. package/dist/esm/components/Icon/components/Period.js.map +1 -1
  193. package/dist/esm/components/Icon/components/PersonChange.js.map +1 -1
  194. package/dist/esm/components/Icon/components/PersonMinus.js.map +1 -1
  195. package/dist/esm/components/Icon/components/PersonPlus.js.map +1 -1
  196. package/dist/esm/components/Icon/components/PersonTick.js.map +1 -1
  197. package/dist/esm/components/Icon/components/Play.js.map +1 -1
  198. package/dist/esm/components/Icon/components/PlusMinus.js.map +1 -1
  199. package/dist/esm/components/Icon/components/Print.js.map +1 -1
  200. package/dist/esm/components/Icon/components/ProcessPayment.js.map +1 -1
  201. package/dist/esm/components/Icon/components/ProductLedgerCard.js.map +1 -1
  202. package/dist/esm/components/Icon/components/Profile.js.map +1 -1
  203. package/dist/esm/components/Icon/components/ProjectCards.js.map +1 -1
  204. package/dist/esm/components/Icon/components/Projects.js.map +1 -1
  205. package/dist/esm/components/Icon/components/Quicklinks.js.map +1 -1
  206. package/dist/esm/components/Icon/components/RatingBankruptcy.js.map +1 -1
  207. package/dist/esm/components/Icon/components/RatingPaymentProblems.js.map +1 -1
  208. package/dist/esm/components/Icon/components/Reconciled.js.map +1 -1
  209. package/dist/esm/components/Icon/components/Refresh.js.map +1 -1
  210. package/dist/esm/components/Icon/components/Report.js.map +1 -1
  211. package/dist/esm/components/Icon/components/ReportSolid.js.map +1 -1
  212. package/dist/esm/components/Icon/components/Restore.js.map +1 -1
  213. package/dist/esm/components/Icon/components/RotateLeft.js.map +1 -1
  214. package/dist/esm/components/Icon/components/RotateRight.js.map +1 -1
  215. package/dist/esm/components/Icon/components/Sales.js.map +1 -1
  216. package/dist/esm/components/Icon/components/Search.js.map +1 -1
  217. package/dist/esm/components/Icon/components/SearchBold.js.map +1 -1
  218. package/dist/esm/components/Icon/components/Secure.js.map +1 -1
  219. package/dist/esm/components/Icon/components/SecureTick.js.map +1 -1
  220. package/dist/esm/components/Icon/components/Settings.js.map +1 -1
  221. package/dist/esm/components/Icon/components/SettingsSolid.js.map +1 -1
  222. package/dist/esm/components/Icon/components/Shortcuts.js.map +1 -1
  223. package/dist/esm/components/Icon/components/ShowAll.js.map +1 -1
  224. package/dist/esm/components/Icon/components/ShowLess.js.map +1 -1
  225. package/dist/esm/components/Icon/components/ShowMore.js.map +1 -1
  226. package/dist/esm/components/Icon/components/ShowTemplate.js.map +1 -1
  227. package/dist/esm/components/Icon/components/Sliders.js.map +1 -1
  228. package/dist/esm/components/Icon/components/Smartpay.js.map +1 -1
  229. package/dist/esm/components/Icon/components/SortBy.js.map +1 -1
  230. package/dist/esm/components/Icon/components/Spinner.js.map +1 -1
  231. package/dist/esm/components/Icon/components/Star.js.map +1 -1
  232. package/dist/esm/components/Icon/components/StarSolid.js.map +1 -1
  233. package/dist/esm/components/Icon/components/Subscriptions.js.map +1 -1
  234. package/dist/esm/components/Icon/components/SystemEntries.js.map +1 -1
  235. package/dist/esm/components/Icon/components/Tag.js.map +1 -1
  236. package/dist/esm/components/Icon/components/TemplateOverride.js.map +1 -1
  237. package/dist/esm/components/Icon/components/Templates.js.map +1 -1
  238. package/dist/esm/components/Icon/components/ThumbBoth.js.map +1 -1
  239. package/dist/esm/components/Icon/components/ThumbDown.js.map +1 -1
  240. package/dist/esm/components/Icon/components/ThumbDownSolid.js.map +1 -1
  241. package/dist/esm/components/Icon/components/ThumbUp.js.map +1 -1
  242. package/dist/esm/components/Icon/components/ThumbUpSolid.js.map +1 -1
  243. package/dist/esm/components/Icon/components/Tick.js.map +1 -1
  244. package/dist/esm/components/Icon/components/Time.js.map +1 -1
  245. package/dist/esm/components/Icon/components/Transfer.js.map +1 -1
  246. package/dist/esm/components/Icon/components/TransferCancel.js.map +1 -1
  247. package/dist/esm/components/Icon/components/TransferLocked.js.map +1 -1
  248. package/dist/esm/components/Icon/components/Undock.js.map +1 -1
  249. package/dist/esm/components/Icon/components/Unreconciled.js.map +1 -1
  250. package/dist/esm/components/Icon/components/Warning.js.map +1 -1
  251. package/dist/esm/components/Icon/components/Webshop.js.map +1 -1
  252. package/dist/esm/components/Icon/components/Website.js.map +1 -1
  253. package/dist/esm/components/Icon/components/Workflow.js.map +1 -1
  254. package/dist/esm/components/Icon/components/Zoom.js.map +1 -1
  255. package/dist/esm/components/Icon/components/index.js.map +1 -1
  256. package/dist/esm/components/IconButton/IconButton.js.map +1 -1
  257. package/dist/esm/components/Input/Input.js.map +1 -1
  258. package/dist/esm/components/Input/util.js.map +1 -1
  259. package/dist/esm/components/Listbox/Listbox.js.map +1 -1
  260. package/dist/esm/components/Listbox/ScrollableList.js +2 -2
  261. package/dist/esm/components/Listbox/ScrollableList.js.map +1 -1
  262. package/dist/esm/components/Listbox/useListbox.js +3 -2
  263. package/dist/esm/components/Listbox/useListbox.js.map +1 -1
  264. package/dist/esm/components/Listbox/useMultiListbox.js +6 -6
  265. package/dist/esm/components/Listbox/useMultiListbox.js.map +1 -1
  266. package/dist/esm/components/Listbox/useTypeahead.js.map +1 -1
  267. package/dist/esm/components/Listbox/util.js.map +1 -1
  268. package/dist/esm/components/Menu/Context.js.map +1 -1
  269. package/dist/esm/components/Menu/Menu.js.map +1 -1
  270. package/dist/esm/components/Menu/components/Checkbox.js +1 -1
  271. package/dist/esm/components/Menu/components/Checkbox.js.map +1 -1
  272. package/dist/esm/components/Menu/components/Content.js.map +1 -1
  273. package/dist/esm/components/Menu/components/Header.js.map +1 -1
  274. package/dist/esm/components/Menu/components/Item.js.map +1 -1
  275. package/dist/esm/components/Menu/components/Link.js.map +1 -1
  276. package/dist/esm/components/Menu/components/RadioGroup.js +1 -1
  277. package/dist/esm/components/Menu/components/RadioGroup.js.map +1 -1
  278. package/dist/esm/components/Menu/components/Separator.js.map +1 -1
  279. package/dist/esm/components/Menu/components/Trigger.js.map +1 -1
  280. package/dist/esm/components/Navigation/Navigation.js.map +1 -1
  281. package/dist/esm/components/Pagination/PageNumbers.js.map +1 -1
  282. package/dist/esm/components/Pagination/Pagination.js.map +1 -1
  283. package/dist/esm/components/Pagination/usePagination.js.map +1 -1
  284. package/dist/esm/components/Pagination/usePaginationShortcuts.js +4 -5
  285. package/dist/esm/components/Pagination/usePaginationShortcuts.js.map +1 -1
  286. package/dist/esm/components/Popover/Popover.js.map +1 -1
  287. package/dist/esm/components/Popover/Primitives.js.map +1 -1
  288. package/dist/esm/components/Progress/Progress.js.map +1 -1
  289. package/dist/esm/components/Provider/Provider.js.map +1 -1
  290. package/dist/esm/components/RadioGroup/RadioGroup.js.map +1 -1
  291. package/dist/esm/components/SearchInput/SearchInput.js +2 -3
  292. package/dist/esm/components/SearchInput/SearchInput.js.map +1 -1
  293. package/dist/esm/components/Select/Select.js.map +1 -1
  294. package/dist/esm/components/Select/useSelect.js +6 -7
  295. package/dist/esm/components/Select/useSelect.js.map +1 -1
  296. package/dist/esm/components/Spinner/Spinner.js.map +1 -1
  297. package/dist/esm/components/Switch/Switch.js.map +1 -1
  298. package/dist/esm/components/Table/components/BaseTable.js.map +1 -1
  299. package/dist/esm/components/Table/components/PaginatedTable.js.map +1 -1
  300. package/dist/esm/components/Table/components/Table.js.map +1 -1
  301. package/dist/esm/components/Table/components/WindowedTable.js.map +1 -1
  302. package/dist/esm/components/Table/hooks/plugins/useRowActions.js +1 -2
  303. package/dist/esm/components/Table/hooks/plugins/useRowActions.js.map +1 -1
  304. package/dist/esm/components/Table/hooks/plugins/useRowDraggable.js.map +1 -1
  305. package/dist/esm/components/Table/hooks/plugins/useRowEditing.js.map +1 -1
  306. package/dist/esm/components/Table/hooks/plugins/useRowSelect.js.map +1 -1
  307. package/dist/esm/components/Table/hooks/useRowCreation.js.map +1 -1
  308. package/dist/esm/components/Table/hooks/useTable.js +5 -1
  309. package/dist/esm/components/Table/hooks/useTable.js.map +1 -1
  310. package/dist/esm/components/Table/hooks/useTableKeyboardNavigation.js +11 -12
  311. package/dist/esm/components/Table/hooks/useTableKeyboardNavigation.js.map +1 -1
  312. package/dist/esm/components/Table/util/renderColumn.js.map +1 -1
  313. package/dist/esm/components/Table/util/renderRow.js.map +1 -1
  314. package/dist/esm/components/Table/util/rowIndexPath.js.map +1 -1
  315. package/dist/esm/components/Table/util/sortTypes.js.map +1 -1
  316. package/dist/esm/components/Table/util.js.map +1 -1
  317. package/dist/esm/components/Tabs/Tabs.js.map +1 -1
  318. package/dist/esm/components/Textarea/Textarea.js.map +1 -1
  319. package/dist/esm/components/Toast/Toast.js +7 -2
  320. package/dist/esm/components/Toast/Toast.js.map +1 -1
  321. package/dist/esm/components/Toast/Toaster.js.map +1 -1
  322. package/dist/esm/components/Toast/util.js.map +1 -1
  323. package/dist/esm/components/Tooltip/Tooltip.js.map +1 -1
  324. package/dist/esm/components/Tour/Tour.js +1 -2
  325. package/dist/esm/components/Tour/Tour.js.map +1 -1
  326. package/dist/esm/components/Treeview/Treeview.js.map +1 -1
  327. package/dist/esm/components/VisuallyHidden/VisuallyHidden.js.map +1 -1
  328. package/dist/esm/index.css +653 -661
  329. package/dist/esm/index.js +2 -2
  330. package/dist/esm/primitives/Button.js.map +1 -1
  331. package/dist/esm/utils/date.js +20 -40
  332. package/dist/esm/utils/date.js.map +1 -1
  333. package/dist/esm/utils/hooks/useBoundingClientRectListener.js +12 -20
  334. package/dist/esm/utils/hooks/useBoundingClientRectListener.js.map +1 -1
  335. package/dist/esm/utils/hooks/useDraggable.js.map +1 -1
  336. package/dist/esm/utils/hooks/useDropTarget.js +7 -10
  337. package/dist/esm/utils/hooks/useDropTarget.js.map +1 -1
  338. package/dist/esm/utils/hooks/useListKeyboardNavigation.js +15 -30
  339. package/dist/esm/utils/hooks/useListKeyboardNavigation.js.map +1 -1
  340. package/dist/esm/utils/hooks/useListScrollTo.js +9 -9
  341. package/dist/esm/utils/hooks/useListScrollTo.js.map +1 -1
  342. package/dist/esm/utils/hooks/useOnClickOutside.js +6 -8
  343. package/dist/esm/utils/hooks/useOnClickOutside.js.map +1 -1
  344. package/dist/esm/utils/hooks/useProxiedRef.js +3 -3
  345. package/dist/esm/utils/hooks/useProxiedRef.js.map +1 -1
  346. package/dist/esm/utils/hooks/useTimer.js.map +1 -1
  347. package/dist/esm/utils/input.js +1 -1
  348. package/dist/esm/utils/input.js.map +1 -1
  349. package/dist/esm/utils/mergeRefs.js +2 -2
  350. package/dist/esm/utils/mergeRefs.js.map +1 -1
  351. package/dist/esm/utils/taillwind.js.map +1 -1
  352. package/dist/index.css +653 -661
  353. package/dist/taco.cjs.development.js +479 -590
  354. package/dist/taco.cjs.development.js.map +1 -1
  355. package/dist/taco.cjs.production.min.js +1 -1
  356. package/dist/taco.cjs.production.min.js.map +1 -1
  357. package/dist/utils/hooks/useListKeyboardNavigation.d.ts +1 -1
  358. package/dist/utils/tailwind.d.ts +1 -1
  359. package/package.json +5 -5
  360. package/plugins/tailwindcss-aria-attributes.js +73 -73
  361. package/tailwind.config.js +264 -264
  362. package/types.json +10 -3
  363. package/dist/esm/_virtual/_rollupPluginBabelHelpers.js +0 -34
  364. package/dist/esm/_virtual/_rollupPluginBabelHelpers.js.map +0 -1
package/dist/esm/index.js CHANGED
@@ -12,10 +12,11 @@ export { Spinner } from './components/Spinner/Spinner.js';
12
12
  export { ToastProvider, useToast } from './components/Toast/Toaster.js';
13
13
  export { Provider, defaultLocalisationTexts, useLocalization, useTaco } from './components/Provider/Provider.js';
14
14
  export { Calendar } from './components/Calendar/Calendar.js';
15
+ export { Card } from './components/Card/Card.js';
15
16
  export { Checkbox } from './components/Checkbox/Checkbox.js';
16
17
  export { useProxiedRef } from './utils/hooks/useProxiedRef.js';
17
18
  export { Input } from './components/Input/Input.js';
18
- export { getNextIndexFromKeycode, useListKeyboardNavigation } from './utils/hooks/useListKeyboardNavigation.js';
19
+ export { getNextIndexFromKey, useListKeyboardNavigation } from './utils/hooks/useListKeyboardNavigation.js';
19
20
  export { useListScrollTo } from './utils/hooks/useListScrollTo.js';
20
21
  export { useBoundingClientRectListener } from './utils/hooks/useBoundingClientRectListener.js';
21
22
  export { Combobox } from './components/Combobox/Combobox.js';
@@ -50,5 +51,4 @@ export { Textarea } from './components/Textarea/Textarea.js';
50
51
  export { Switch } from './components/Switch/Switch.js';
51
52
  export { Tour, TourStep } from './components/Tour/Tour.js';
52
53
  export { useOnClickOutside } from './utils/hooks/useOnClickOutside.js';
53
- export { Card } from './components/Card/Card.js';
54
54
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","sources":["../../../src/primitives/Button.tsx"],"sourcesContent":["import * as React from 'react';\r\n\r\ntype ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement | HTMLAnchorElement> & {\r\n /** Content should be a text */\r\n children: React.ReactNode;\r\n /** Provides url for buttons being used as a link */\r\n href?: string;\r\n /** Provides target for buttons being used as a link */\r\n target?: '_self' | '_blank' | '_parent' | '_top';\r\n};\r\n\r\nconst Button = React.forwardRef(function Button(props: ButtonProps, ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>) {\r\n const { disabled, target, type = 'button', ...otherProps } = props;\r\n\r\n const Tag = props.href ? 'a' : 'button';\r\n\r\n return (\r\n <Tag\r\n {...otherProps}\r\n aria-disabled={disabled ? 'true' : undefined}\r\n disabled={disabled}\r\n target={Tag === 'a' ? target : undefined}\r\n type={Tag !== 'a' ? type : undefined}\r\n ref={ref as any}\r\n >\r\n {React.Children.count(props.children) > 1\r\n ? React.Children.map(props.children, child => (typeof child === 'string' ? <span>{child}</span> : child))\r\n : props.children}\r\n </Tag>\r\n );\r\n});\r\n\r\nexport { Button, ButtonProps };\r\n"],"names":["Button","React","props","ref","disabled","target","type","otherProps","Tag","href","undefined","count","children","map","child"],"mappings":";;MAWMA,MAAM,gBAAGC,UAAA,CAAiB,SAASD,MAAT,CAAgBE,KAAhB,EAAoCC,GAApC;EAC5B,MAAM;IAAEC,QAAF;IAAYC,MAAZ;IAAoBC,IAAI,GAAG,QAA3B;IAAqC,GAAGC;MAAeL,KAA7D;EAEA,MAAMM,GAAG,GAAGN,KAAK,CAACO,IAAN,GAAa,GAAb,GAAmB,QAA/B;EAEA,OACIR,aAAA,CAACO,GAAD,oBACQD;qBACWH,QAAQ,GAAG,MAAH,GAAYM;IACnCN,QAAQ,EAAEA;IACVC,MAAM,EAAEG,GAAG,KAAK,GAAR,GAAcH,MAAd,GAAuBK;IAC/BJ,IAAI,EAAEE,GAAG,KAAK,GAAR,GAAcF,IAAd,GAAqBI;IAC3BP,GAAG,EAAEA;IANT,EAQKF,QAAA,CAAeU,KAAf,CAAqBT,KAAK,CAACU,QAA3B,IAAuC,CAAvC,GACKX,QAAA,CAAeY,GAAf,CAAmBX,KAAK,CAACU,QAAzB,EAAmCE,KAAK,IAAK,OAAOA,KAAP,KAAiB,QAAjB,GAA4Bb,aAAA,OAAA,MAAA,EAAOa,KAAP,CAA5B,GAAmDA,KAAhG,CADL,GAEKZ,KAAK,CAACU,QAVhB,CADJ;AAcH,CAnBc;;;;"}
1
+ {"version":3,"file":"Button.js","sources":["../../../src/primitives/Button.tsx"],"sourcesContent":["import * as React from 'react';\n\ntype ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement | HTMLAnchorElement> & {\n /** Content should be a text */\n children: React.ReactNode;\n /** Provides url for buttons being used as a link */\n href?: string;\n /** Provides target for buttons being used as a link */\n target?: '_self' | '_blank' | '_parent' | '_top';\n};\n\nconst Button = React.forwardRef(function Button(props: ButtonProps, ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>) {\n const { disabled, target, type = 'button', ...otherProps } = props;\n\n const Tag = props.href ? 'a' : 'button';\n\n return (\n <Tag\n {...otherProps}\n aria-disabled={disabled ? 'true' : undefined}\n disabled={disabled}\n target={Tag === 'a' ? target : undefined}\n type={Tag !== 'a' ? type : undefined}\n ref={ref as any}\n >\n {React.Children.count(props.children) > 1\n ? React.Children.map(props.children, child => (typeof child === 'string' ? <span>{child}</span> : child))\n : props.children}\n </Tag>\n );\n});\n\nexport { Button, ButtonProps };\n"],"names":["Button","React","props","ref","disabled","target","type","otherProps","Tag","href","undefined","count","children","map","child"],"mappings":";;MAWMA,MAAM,gBAAGC,UAAA,CAAiB,SAASD,MAAT,CAAgBE,KAAhB,EAAoCC,GAApC;EAC5B,MAAM;IAAEC,QAAF;IAAYC,MAAZ;IAAoBC,IAAI,GAAG,QAA3B;IAAqC,GAAGC;MAAeL,KAA7D;EAEA,MAAMM,GAAG,GAAGN,KAAK,CAACO,IAAN,GAAa,GAAb,GAAmB,QAA/B;EAEA,OACIR,aAAA,CAACO,GAAD,oBACQD;qBACWH,QAAQ,GAAG,MAAH,GAAYM;IACnCN,QAAQ,EAAEA;IACVC,MAAM,EAAEG,GAAG,KAAK,GAAR,GAAcH,MAAd,GAAuBK;IAC/BJ,IAAI,EAAEE,GAAG,KAAK,GAAR,GAAcF,IAAd,GAAqBI;IAC3BP,GAAG,EAAEA;IANT,EAQKF,QAAA,CAAeU,KAAf,CAAqBT,KAAK,CAACU,QAA3B,IAAuC,CAAvC,GACKX,QAAA,CAAeY,GAAf,CAAmBX,KAAK,CAACU,QAAzB,EAAmCE,KAAK,IAAK,OAAOA,KAAP,KAAiB,QAAjB,GAA4Bb,aAAA,OAAA,MAAA,EAAOa,KAAP,CAA5B,GAAmDA,KAAhG,CADL,GAEKZ,KAAK,CAACU,QAVhB,CADJ;AAcH,CAnBc;;;;"}
@@ -1,67 +1,47 @@
1
1
  import { isDate, toDate, isValid } from 'date-fns';
2
2
 
3
- var format = function format(date, mask) {
4
- if (mask === void 0) {
5
- mask = 'dd.mm.yy';
6
- }
7
-
3
+ const format = (date, mask = 'dd.mm.yy') => {
8
4
  if (!date) {
9
5
  return undefined;
10
6
  }
11
7
 
12
- var value = isDate(date) ? date : toDate(date);
8
+ const value = isDate(date) ? date : toDate(date);
13
9
 
14
10
  if (!isValid(value)) {
15
11
  return undefined;
16
12
  }
17
13
 
18
- var pad = function pad(v) {
19
- return String(v).length === 1 ? "0" + v : v.toString();
20
- };
14
+ const pad = v => String(v).length === 1 ? `0${v}` : v.toString();
21
15
 
22
16
  return mask.replace('dd', pad(value.getDate())).replace('mm', pad(value.getMonth() + 1)).replace('yy', String(value.getFullYear()).slice(2));
23
17
  };
24
- var parseFromCustomString = function parseFromCustomString(date, mask) {
25
- if (date === void 0) {
26
- date = '';
27
- }
28
-
29
- if (mask === void 0) {
30
- mask = 'dd.mm.yy';
31
- }
32
-
18
+ const parseFromCustomString = (date = '', mask = 'dd.mm.yy') => {
33
19
  if (!date || !date.length) {
34
20
  return undefined;
35
21
  }
36
22
 
37
- var sanitizedMask = mask.split(/[^dmy]/);
38
- var dd = sanitizedMask.findIndex(function (x) {
39
- return x === 'dd';
40
- });
41
- var mm = sanitizedMask.findIndex(function (x) {
42
- return x === 'mm';
43
- });
44
- var yy = sanitizedMask.findIndex(function (x) {
45
- return x === 'yy' || x === 'yyyy';
46
- });
47
- var day;
48
- var month;
49
- var year;
23
+ const sanitizedMask = mask.split(/[^dmy]/);
24
+ const dd = sanitizedMask.findIndex(x => x === 'dd');
25
+ const mm = sanitizedMask.findIndex(x => x === 'mm');
26
+ const yy = sanitizedMask.findIndex(x => x === 'yy' || x === 'yyyy');
27
+ let day;
28
+ let month;
29
+ let year;
50
30
 
51
- var getFullYear = function getFullYear(y) {
31
+ const getFullYear = y => {
52
32
  if (y && y.length === 2) {
53
- var z = Number.parseInt(y, 10);
54
- return z > 50 ? "19" + y : "20" + y;
33
+ const z = Number.parseInt(y, 10);
34
+ return z > 50 ? `19${y}` : `20${y}`;
55
35
  }
56
36
 
57
37
  return y;
58
38
  };
59
39
 
60
- var inputParts = date.split(/\D/);
40
+ const inputParts = date.split(/\D/);
61
41
 
62
42
  if (inputParts.length === 1) {
63
- var fullDate = inputParts[0];
64
- var unseparatedMask = mask.replace(/[^dmy]/g, '');
43
+ const fullDate = inputParts[0];
44
+ const unseparatedMask = mask.replace(/[^dmy]/g, '');
65
45
  day = fullDate.slice(unseparatedMask.indexOf('d'), unseparatedMask.lastIndexOf('d') + 1);
66
46
  month = fullDate.slice(unseparatedMask.indexOf('m'), unseparatedMask.lastIndexOf('m') + 1);
67
47
  year = getFullYear(fullDate.slice(unseparatedMask.indexOf('y'), unseparatedMask.lastIndexOf('y') + 3)); // account for full years
@@ -74,7 +54,7 @@ var parseFromCustomString = function parseFromCustomString(date, mask) {
74
54
  day = Number.parseInt(day, 10);
75
55
  month = Number.parseInt(month, 10);
76
56
  year = Number.parseInt(year, 10);
77
- var currentDate = new Date();
57
+ const currentDate = new Date();
78
58
  return new Date(
79
59
  /* year */
80
60
  Object.is(year, NaN) ? currentDate.getFullYear() : year,
@@ -89,8 +69,8 @@ var parseFromCustomString = function parseFromCustomString(date, mask) {
89
69
  0 // set to midday to avoid UTC offset causing dates to be mismatched server side
90
70
  );
91
71
  };
92
- var parseFromISOString = function parseFromISOString(date) {
93
- var tempDate = new Date(date);
72
+ const parseFromISOString = date => {
73
+ const tempDate = new Date(date);
94
74
  return isValid(tempDate) ? parseFromCustomString(format(new Date(date))) : undefined;
95
75
  };
96
76
 
@@ -1 +1 @@
1
- {"version":3,"file":"date.js","sources":["../../../src/utils/date.ts"],"sourcesContent":["import { isDate, toDate, isValid } from 'date-fns';\r\n\r\nexport const format = (date: Date | undefined, mask = 'dd.mm.yy'): string | undefined => {\r\n if (!date) {\r\n return undefined;\r\n }\r\n\r\n const value = isDate(date) ? date : toDate(date);\r\n\r\n if (!isValid(value)) {\r\n return undefined;\r\n }\r\n\r\n const pad = (v: number): string => (String(v).length === 1 ? `0${v}` : v.toString());\r\n\r\n return mask\r\n .replace('dd', pad(value.getDate()))\r\n .replace('mm', pad(value.getMonth() + 1))\r\n .replace('yy', String(value.getFullYear()).slice(2));\r\n};\r\n\r\nexport const parseFromCustomString = (date = '', mask = 'dd.mm.yy'): Date | undefined => {\r\n if (!date || !date.length) {\r\n return undefined;\r\n }\r\n\r\n const sanitizedMask = mask.split(/[^dmy]/);\r\n const dd = sanitizedMask.findIndex(x => x === 'dd');\r\n const mm = sanitizedMask.findIndex(x => x === 'mm');\r\n const yy = sanitizedMask.findIndex(x => x === 'yy' || x === 'yyyy');\r\n\r\n let day;\r\n let month;\r\n let year;\r\n\r\n const getFullYear = (y: string): string => {\r\n if (y && y.length === 2) {\r\n const z = Number.parseInt(y, 10);\r\n\r\n return z > 50 ? `19${y}` : `20${y}`;\r\n }\r\n\r\n return y;\r\n };\r\n\r\n const inputParts = date.split(/\\D/);\r\n\r\n if (inputParts.length === 1) {\r\n const fullDate = inputParts[0];\r\n const unseparatedMask = mask.replace(/[^dmy]/g, '');\r\n\r\n day = fullDate.slice(unseparatedMask.indexOf('d'), unseparatedMask.lastIndexOf('d') + 1);\r\n month = fullDate.slice(unseparatedMask.indexOf('m'), unseparatedMask.lastIndexOf('m') + 1);\r\n year = getFullYear(fullDate.slice(unseparatedMask.indexOf('y'), unseparatedMask.lastIndexOf('y') + 3)); // account for full years\r\n } else {\r\n day = inputParts[dd];\r\n month = inputParts[mm];\r\n year = getFullYear(inputParts[yy]);\r\n }\r\n\r\n day = Number.parseInt(day, 10);\r\n month = Number.parseInt(month, 10);\r\n year = Number.parseInt(year, 10);\r\n\r\n const currentDate = new Date();\r\n\r\n return new Date(\r\n /* year */ Object.is(year, NaN) ? currentDate.getFullYear() : year,\r\n /* month */ Object.is(month, NaN) ? currentDate.getMonth() : month - 1, // months are zero based in javascript, so subtract a day\r\n /* day */ Object.is(day, NaN) ? currentDate.getDate() : day,\r\n /* hours */ 12,\r\n /* minutes */ 0 // set to midday to avoid UTC offset causing dates to be mismatched server side\r\n );\r\n};\r\n\r\nexport const parseFromISOString = (date: string): Date | undefined => {\r\n const tempDate = new Date(date);\r\n return isValid(tempDate) ? parseFromCustomString(format(new Date(date))) : undefined;\r\n};\r\n"],"names":["format","date","mask","undefined","value","isDate","toDate","isValid","pad","v","String","length","toString","replace","getDate","getMonth","getFullYear","slice","parseFromCustomString","sanitizedMask","split","dd","findIndex","x","mm","yy","day","month","year","y","z","Number","parseInt","inputParts","fullDate","unseparatedMask","indexOf","lastIndexOf","currentDate","Date","Object","is","NaN","parseFromISOString","tempDate"],"mappings":"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"}
1
+ {"version":3,"file":"date.js","sources":["../../../src/utils/date.ts"],"sourcesContent":["import { isDate, toDate, isValid } from 'date-fns';\n\nexport const format = (date: Date | undefined, mask = 'dd.mm.yy'): string | undefined => {\n if (!date) {\n return undefined;\n }\n\n const value = isDate(date) ? date : toDate(date);\n\n if (!isValid(value)) {\n return undefined;\n }\n\n const pad = (v: number): string => (String(v).length === 1 ? `0${v}` : v.toString());\n\n return mask\n .replace('dd', pad(value.getDate()))\n .replace('mm', pad(value.getMonth() + 1))\n .replace('yy', String(value.getFullYear()).slice(2));\n};\n\nexport const parseFromCustomString = (date = '', mask = 'dd.mm.yy'): Date | undefined => {\n if (!date || !date.length) {\n return undefined;\n }\n\n const sanitizedMask = mask.split(/[^dmy]/);\n const dd = sanitizedMask.findIndex(x => x === 'dd');\n const mm = sanitizedMask.findIndex(x => x === 'mm');\n const yy = sanitizedMask.findIndex(x => x === 'yy' || x === 'yyyy');\n\n let day;\n let month;\n let year;\n\n const getFullYear = (y: string): string => {\n if (y && y.length === 2) {\n const z = Number.parseInt(y, 10);\n\n return z > 50 ? `19${y}` : `20${y}`;\n }\n\n return y;\n };\n\n const inputParts = date.split(/\\D/);\n\n if (inputParts.length === 1) {\n const fullDate = inputParts[0];\n const unseparatedMask = mask.replace(/[^dmy]/g, '');\n\n day = fullDate.slice(unseparatedMask.indexOf('d'), unseparatedMask.lastIndexOf('d') + 1);\n month = fullDate.slice(unseparatedMask.indexOf('m'), unseparatedMask.lastIndexOf('m') + 1);\n year = getFullYear(fullDate.slice(unseparatedMask.indexOf('y'), unseparatedMask.lastIndexOf('y') + 3)); // account for full years\n } else {\n day = inputParts[dd];\n month = inputParts[mm];\n year = getFullYear(inputParts[yy]);\n }\n\n day = Number.parseInt(day, 10);\n month = Number.parseInt(month, 10);\n year = Number.parseInt(year, 10);\n\n const currentDate = new Date();\n\n return new Date(\n /* year */ Object.is(year, NaN) ? currentDate.getFullYear() : year,\n /* month */ Object.is(month, NaN) ? currentDate.getMonth() : month - 1, // months are zero based in javascript, so subtract a day\n /* day */ Object.is(day, NaN) ? currentDate.getDate() : day,\n /* hours */ 12,\n /* minutes */ 0 // set to midday to avoid UTC offset causing dates to be mismatched server side\n );\n};\n\nexport const parseFromISOString = (date: string): Date | undefined => {\n const tempDate = new Date(date);\n return isValid(tempDate) ? parseFromCustomString(format(new Date(date))) : undefined;\n};\n"],"names":["format","date","mask","undefined","value","isDate","toDate","isValid","pad","v","String","length","toString","replace","getDate","getMonth","getFullYear","slice","parseFromCustomString","sanitizedMask","split","dd","findIndex","x","mm","yy","day","month","year","y","z","Number","parseInt","inputParts","fullDate","unseparatedMask","indexOf","lastIndexOf","currentDate","Date","Object","is","NaN","parseFromISOString","tempDate"],"mappings":"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"}
@@ -1,22 +1,14 @@
1
1
  import { useState, useEffect } from 'react';
2
2
  import debounce from 'lodash-es/debounce';
3
3
 
4
- var getVisibility = function getVisibility(element) {
5
- return Boolean(element && (element.offsetWidth || element.offsetHeight || element.getClientRects().length));
6
- };
7
-
8
- var useBoundingClientRectListener = function useBoundingClientRectListener(ref) {
9
- var _React$useState = useState(undefined),
10
- dimensions = _React$useState[0],
11
- setDimensions = _React$useState[1];
12
-
13
- var isRefElementVisible = getVisibility(ref.current);
4
+ const getVisibility = element => Boolean(element && (element.offsetWidth || element.offsetHeight || element.getClientRects().length));
14
5
 
15
- var _React$useState2 = useState(isRefElementVisible),
16
- visibility = _React$useState2[0],
17
- setVisibility = _React$useState2[1];
6
+ const useBoundingClientRectListener = ref => {
7
+ const [dimensions, setDimensions] = useState(undefined);
8
+ const isRefElementVisible = getVisibility(ref.current);
9
+ const [visibility, setVisibility] = useState(isRefElementVisible);
18
10
 
19
- var resize = function resize() {
11
+ const resize = () => {
20
12
  if (visibility) {
21
13
  var _ref$current;
22
14
 
@@ -24,17 +16,17 @@ var useBoundingClientRectListener = function useBoundingClientRectListener(ref)
24
16
  }
25
17
  };
26
18
 
27
- useEffect(function () {
28
- var timeout = setTimeout(resize, 0);
29
- var debouncedResize = debounce(resize, 250);
19
+ useEffect(() => {
20
+ const timeout = setTimeout(resize, 0);
21
+ const debouncedResize = debounce(resize, 250);
30
22
  window.addEventListener('resize', debouncedResize);
31
- return function () {
23
+ return () => {
32
24
  clearTimeout(timeout);
33
25
  window.removeEventListener('resize', debouncedResize);
34
26
  };
35
27
  }, [ref.current, visibility]);
36
- useEffect(function () {
37
- var newRefElementVisibility = getVisibility(ref.current);
28
+ useEffect(() => {
29
+ const newRefElementVisibility = getVisibility(ref.current);
38
30
 
39
31
  if (visibility !== newRefElementVisibility) {
40
32
  // When visibility of an element changes, then the new visibility of the element can only be checked after the
@@ -1 +1 @@
1
- {"version":3,"file":"useBoundingClientRectListener.js","sources":["../../../../src/utils/hooks/useBoundingClientRectListener.ts"],"sourcesContent":["import * as React from 'react';\r\nimport debounce from 'lodash/debounce';\r\n\r\nconst getVisibility = (element: HTMLElement | null): boolean =>\r\n Boolean(element && (element.offsetWidth || element.offsetHeight || element.getClientRects().length));\r\n\r\nexport const useBoundingClientRectListener = (ref: React.RefObject<HTMLElement>): DOMRectReadOnly | undefined => {\r\n const [dimensions, setDimensions] = React.useState<DOMRectReadOnly | undefined>(undefined);\r\n const isRefElementVisible = getVisibility(ref.current);\r\n const [visibility, setVisibility] = React.useState(isRefElementVisible);\r\n\r\n const resize = () => {\r\n if (visibility) {\r\n setDimensions(ref.current?.getBoundingClientRect());\r\n }\r\n };\r\n\r\n React.useEffect(() => {\r\n const timeout = setTimeout(resize, 0);\r\n const debouncedResize = debounce(resize, 250);\r\n\r\n window.addEventListener('resize', debouncedResize);\r\n\r\n return () => {\r\n clearTimeout(timeout);\r\n window.removeEventListener('resize', debouncedResize);\r\n };\r\n }, [ref.current, visibility]);\r\n\r\n React.useEffect(() => {\r\n const newRefElementVisibility = getVisibility(ref.current);\r\n\r\n if (visibility !== newRefElementVisibility) {\r\n // When visibility of an element changes, then the new visibility of the element can only be checked after the\r\n // component has rendered. That's why the visibility check is inside the useEffect. This useEffect will cause\r\n // the consumer to rerender and that will cause the above hook to recalculate the dimensions\r\n setVisibility(newRefElementVisibility);\r\n }\r\n });\r\n\r\n return dimensions;\r\n};\r\n"],"names":["getVisibility","element","Boolean","offsetWidth","offsetHeight","getClientRects","length","useBoundingClientRectListener","ref","React","undefined","dimensions","setDimensions","isRefElementVisible","current","visibility","setVisibility","resize","getBoundingClientRect","timeout","setTimeout","debouncedResize","debounce","window","addEventListener","clearTimeout","removeEventListener","newRefElementVisibility"],"mappings":";;;AAGA,IAAMA,aAAa,GAAG,SAAhBA,aAAgB,CAACC,OAAD;EAAA,OAClBC,OAAO,CAACD,OAAO,KAAKA,OAAO,CAACE,WAAR,IAAuBF,OAAO,CAACG,YAA/B,IAA+CH,OAAO,CAACI,cAAR,GAAyBC,MAA7E,CAAR,CADW;AAAA,CAAtB;;IAGaC,6BAA6B,GAAG,SAAhCA,6BAAgC,CAACC,GAAD;EACzC,sBAAoCC,QAAA,CAA4CC,SAA5C,CAApC;MAAOC,UAAP;MAAmBC,aAAnB;;EACA,IAAMC,mBAAmB,GAAGb,aAAa,CAACQ,GAAG,CAACM,OAAL,CAAzC;;EACA,uBAAoCL,QAAA,CAAeI,mBAAf,CAApC;MAAOE,UAAP;MAAmBC,aAAnB;;EAEA,IAAMC,MAAM,GAAG,SAATA,MAAS;IACX,IAAIF,UAAJ,EAAgB;MAAA;;MACZH,aAAa,iBAACJ,GAAG,CAACM,OAAL,iDAAC,aAAaI,qBAAb,EAAD,CAAb;;GAFR;;EAMAT,SAAA,CAAgB;IACZ,IAAMU,OAAO,GAAGC,UAAU,CAACH,MAAD,EAAS,CAAT,CAA1B;IACA,IAAMI,eAAe,GAAGC,QAAQ,CAACL,MAAD,EAAS,GAAT,CAAhC;IAEAM,MAAM,CAACC,gBAAP,CAAwB,QAAxB,EAAkCH,eAAlC;IAEA,OAAO;MACHI,YAAY,CAACN,OAAD,CAAZ;MACAI,MAAM,CAACG,mBAAP,CAA2B,QAA3B,EAAqCL,eAArC;KAFJ;GANJ,EAUG,CAACb,GAAG,CAACM,OAAL,EAAcC,UAAd,CAVH;EAYAN,SAAA,CAAgB;IACZ,IAAMkB,uBAAuB,GAAG3B,aAAa,CAACQ,GAAG,CAACM,OAAL,CAA7C;;IAEA,IAAIC,UAAU,KAAKY,uBAAnB,EAA4C;;;;MAIxCX,aAAa,CAACW,uBAAD,CAAb;;GAPR;EAWA,OAAOhB,UAAP;AACH;;;;"}
1
+ {"version":3,"file":"useBoundingClientRectListener.js","sources":["../../../../src/utils/hooks/useBoundingClientRectListener.ts"],"sourcesContent":["import * as React from 'react';\nimport debounce from 'lodash/debounce';\n\nconst getVisibility = (element: HTMLElement | null): boolean =>\n Boolean(element && (element.offsetWidth || element.offsetHeight || element.getClientRects().length));\n\nexport const useBoundingClientRectListener = (ref: React.RefObject<HTMLElement>): DOMRectReadOnly | undefined => {\n const [dimensions, setDimensions] = React.useState<DOMRectReadOnly | undefined>(undefined);\n const isRefElementVisible = getVisibility(ref.current);\n const [visibility, setVisibility] = React.useState(isRefElementVisible);\n\n const resize = () => {\n if (visibility) {\n setDimensions(ref.current?.getBoundingClientRect());\n }\n };\n\n React.useEffect(() => {\n const timeout = setTimeout(resize, 0);\n const debouncedResize = debounce(resize, 250);\n\n window.addEventListener('resize', debouncedResize);\n\n return () => {\n clearTimeout(timeout);\n window.removeEventListener('resize', debouncedResize);\n };\n }, [ref.current, visibility]);\n\n React.useEffect(() => {\n const newRefElementVisibility = getVisibility(ref.current);\n\n if (visibility !== newRefElementVisibility) {\n // When visibility of an element changes, then the new visibility of the element can only be checked after the\n // component has rendered. That's why the visibility check is inside the useEffect. This useEffect will cause\n // the consumer to rerender and that will cause the above hook to recalculate the dimensions\n setVisibility(newRefElementVisibility);\n }\n });\n\n return dimensions;\n};\n"],"names":["getVisibility","element","Boolean","offsetWidth","offsetHeight","getClientRects","length","useBoundingClientRectListener","ref","dimensions","setDimensions","React","undefined","isRefElementVisible","current","visibility","setVisibility","resize","getBoundingClientRect","timeout","setTimeout","debouncedResize","debounce","window","addEventListener","clearTimeout","removeEventListener","newRefElementVisibility"],"mappings":";;;AAGA,MAAMA,aAAa,GAAIC,OAAD,IAClBC,OAAO,CAACD,OAAO,KAAKA,OAAO,CAACE,WAAR,IAAuBF,OAAO,CAACG,YAA/B,IAA+CH,OAAO,CAACI,cAAR,GAAyBC,MAA7E,CAAR,CADX;;MAGaC,6BAA6B,GAAIC,GAAD;EACzC,MAAM,CAACC,UAAD,EAAaC,aAAb,IAA8BC,QAAA,CAA4CC,SAA5C,CAApC;EACA,MAAMC,mBAAmB,GAAGb,aAAa,CAACQ,GAAG,CAACM,OAAL,CAAzC;EACA,MAAM,CAACC,UAAD,EAAaC,aAAb,IAA8BL,QAAA,CAAeE,mBAAf,CAApC;;EAEA,MAAMI,MAAM,GAAG;IACX,IAAIF,UAAJ,EAAgB;MAAA;;MACZL,aAAa,iBAACF,GAAG,CAACM,OAAL,iDAAC,aAAaI,qBAAb,EAAD,CAAb;;GAFR;;EAMAP,SAAA,CAAgB;IACZ,MAAMQ,OAAO,GAAGC,UAAU,CAACH,MAAD,EAAS,CAAT,CAA1B;IACA,MAAMI,eAAe,GAAGC,QAAQ,CAACL,MAAD,EAAS,GAAT,CAAhC;IAEAM,MAAM,CAACC,gBAAP,CAAwB,QAAxB,EAAkCH,eAAlC;IAEA,OAAO;MACHI,YAAY,CAACN,OAAD,CAAZ;MACAI,MAAM,CAACG,mBAAP,CAA2B,QAA3B,EAAqCL,eAArC;KAFJ;GANJ,EAUG,CAACb,GAAG,CAACM,OAAL,EAAcC,UAAd,CAVH;EAYAJ,SAAA,CAAgB;IACZ,MAAMgB,uBAAuB,GAAG3B,aAAa,CAACQ,GAAG,CAACM,OAAL,CAA7C;;IAEA,IAAIC,UAAU,KAAKY,uBAAnB,EAA4C;;;;MAIxCX,aAAa,CAACW,uBAAD,CAAb;;GAPR;EAWA,OAAOlB,UAAP;AACH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useDraggable.js","sources":["../../../../src/utils/hooks/useDraggable.tsx"],"sourcesContent":["import React from 'react';\r\nimport { useMove } from '@react-aria/interactions';\r\n\r\nexport const useDraggable = (ref: React.MutableRefObject<HTMLDivElement | null>): any => {\r\n const [position, setPosition] = React.useState({\r\n x: 0,\r\n y: 0,\r\n });\r\n\r\n const { moveProps } = useMove({\r\n onMove(event) {\r\n const rect = ref.current?.getBoundingClientRect();\r\n\r\n // Prevent dragging out of bounds\r\n if (\r\n rect &&\r\n (rect.left + event.deltaX < 0 ||\r\n rect.right + event.deltaX > window.innerWidth ||\r\n rect.top + event.deltaY < 0 ||\r\n rect.bottom + event.deltaY > window.innerHeight)\r\n ) {\r\n return;\r\n }\r\n\r\n setPosition(({ x, y }) => {\r\n x += event.deltaX;\r\n y += event.deltaY;\r\n return { x, y };\r\n });\r\n },\r\n });\r\n\r\n return {\r\n position,\r\n handleProps: moveProps,\r\n };\r\n};\r\n"],"names":["useDraggable","ref","position","setPosition","React","useState","x","y","moveProps","useMove","onMove","event","rect","current","getBoundingClientRect","left","deltaX","right","window","innerWidth","top","deltaY","bottom","innerHeight","handleProps"],"mappings":";;;MAGaA,YAAY,GAAIC,GAAD;EACxB,MAAM,CAACC,QAAD,EAAWC,WAAX,IAA0BC,cAAK,CAACC,QAAN,CAAe;IAC3CC,CAAC,EAAE,CADwC;IAE3CC,CAAC,EAAE;GAFyB,CAAhC;EAKA,MAAM;IAAEC;MAAcC,OAAO,CAAC;IAC1BC,MAAM,CAACC,KAAD;;;MACF,MAAMC,IAAI,mBAAGX,GAAG,CAACY,OAAP,iDAAG,aAAaC,qBAAb,EAAb;;MAGA,IACIF,IAAI,KACHA,IAAI,CAACG,IAAL,GAAYJ,KAAK,CAACK,MAAlB,GAA2B,CAA3B,IACGJ,IAAI,CAACK,KAAL,GAAaN,KAAK,CAACK,MAAnB,GAA4BE,MAAM,CAACC,UADtC,IAEGP,IAAI,CAACQ,GAAL,GAAWT,KAAK,CAACU,MAAjB,GAA0B,CAF7B,IAGGT,IAAI,CAACU,MAAL,GAAcX,KAAK,CAACU,MAApB,GAA6BH,MAAM,CAACK,WAJpC,CADR,EAME;QACE;;;MAGJpB,WAAW,CAAC,CAAC;QAAEG,CAAF;QAAKC;OAAN;QACRD,CAAC,IAAIK,KAAK,CAACK,MAAX;QACAT,CAAC,IAAII,KAAK,CAACU,MAAX;QACA,OAAO;UAAEf,CAAF;UAAKC;SAAZ;OAHO,CAAX;;;GAfqB,CAA7B;EAuBA,OAAO;IACHL,QADG;IAEHsB,WAAW,EAAEhB;GAFjB;AAIH;;;;"}
1
+ {"version":3,"file":"useDraggable.js","sources":["../../../../src/utils/hooks/useDraggable.tsx"],"sourcesContent":["import React from 'react';\nimport { useMove } from '@react-aria/interactions';\n\nexport const useDraggable = (ref: React.MutableRefObject<HTMLDivElement | null>): any => {\n const [position, setPosition] = React.useState({\n x: 0,\n y: 0,\n });\n\n const { moveProps } = useMove({\n onMove(event) {\n const rect = ref.current?.getBoundingClientRect();\n\n // Prevent dragging out of bounds\n if (\n rect &&\n (rect.left + event.deltaX < 0 ||\n rect.right + event.deltaX > window.innerWidth ||\n rect.top + event.deltaY < 0 ||\n rect.bottom + event.deltaY > window.innerHeight)\n ) {\n return;\n }\n\n setPosition(({ x, y }) => {\n x += event.deltaX;\n y += event.deltaY;\n return { x, y };\n });\n },\n });\n\n return {\n position,\n handleProps: moveProps,\n };\n};\n"],"names":["useDraggable","ref","position","setPosition","React","useState","x","y","moveProps","useMove","onMove","event","rect","current","getBoundingClientRect","left","deltaX","right","window","innerWidth","top","deltaY","bottom","innerHeight","handleProps"],"mappings":";;;MAGaA,YAAY,GAAIC,GAAD;EACxB,MAAM,CAACC,QAAD,EAAWC,WAAX,IAA0BC,cAAK,CAACC,QAAN,CAAe;IAC3CC,CAAC,EAAE,CADwC;IAE3CC,CAAC,EAAE;GAFyB,CAAhC;EAKA,MAAM;IAAEC;MAAcC,OAAO,CAAC;IAC1BC,MAAM,CAACC,KAAD;;;MACF,MAAMC,IAAI,mBAAGX,GAAG,CAACY,OAAP,iDAAG,aAAaC,qBAAb,EAAb;;MAGA,IACIF,IAAI,KACHA,IAAI,CAACG,IAAL,GAAYJ,KAAK,CAACK,MAAlB,GAA2B,CAA3B,IACGJ,IAAI,CAACK,KAAL,GAAaN,KAAK,CAACK,MAAnB,GAA4BE,MAAM,CAACC,UADtC,IAEGP,IAAI,CAACQ,GAAL,GAAWT,KAAK,CAACU,MAAjB,GAA0B,CAF7B,IAGGT,IAAI,CAACU,MAAL,GAAcX,KAAK,CAACU,MAApB,GAA6BH,MAAM,CAACK,WAJpC,CADR,EAME;QACE;;;MAGJpB,WAAW,CAAC,CAAC;QAAEG,CAAF;QAAKC;OAAN;QACRD,CAAC,IAAIK,KAAK,CAACK,MAAX;QACAT,CAAC,IAAII,KAAK,CAACU,MAAX;QACA,OAAO;UAAEf,CAAF;UAAKC;SAAZ;OAHO,CAAX;;;GAfqB,CAA7B;EAuBA,OAAO;IACHL,QADG;IAEHsB,WAAW,EAAEhB;GAFjB;AAIH;;;;"}
@@ -1,25 +1,22 @@
1
1
  import React__default from 'react';
2
2
 
3
- var useDropTarget = function useDropTarget(onDrop) {
4
- var _React$useState = React__default.useState(false),
5
- isDraggedOver = _React$useState[0],
6
- setDraggedOver = _React$useState[1];
7
-
8
- var handleDragEnter = React__default.useCallback(function (event) {
3
+ const useDropTarget = onDrop => {
4
+ const [isDraggedOver, setDraggedOver] = React__default.useState(false);
5
+ const handleDragEnter = React__default.useCallback(event => {
9
6
  event.preventDefault();
10
7
  setDraggedOver(true);
11
8
  }, []);
12
- var handleDragLeave = React__default.useCallback(function (event) {
9
+ const handleDragLeave = React__default.useCallback(event => {
13
10
  event.preventDefault();
14
11
 
15
12
  if (event.target === event.currentTarget) {
16
13
  setDraggedOver(false);
17
14
  }
18
15
  }, []);
19
- var handleDragOver = React__default.useCallback(function (event) {
16
+ const handleDragOver = React__default.useCallback(event => {
20
17
  event.preventDefault();
21
18
  }, []);
22
- var handleDrop = React__default.useCallback(function (event) {
19
+ const handleDrop = React__default.useCallback(event => {
23
20
  event.preventDefault();
24
21
  event.persist();
25
22
  setDraggedOver(false);
@@ -28,7 +25,7 @@ var useDropTarget = function useDropTarget(onDrop) {
28
25
  onDrop(event);
29
26
  }
30
27
  }, [onDrop]);
31
- var props = onDrop ? {
28
+ const props = onDrop ? {
32
29
  onDragEnter: handleDragEnter,
33
30
  onDragLeave: handleDragLeave,
34
31
  onDragOver: handleDragOver,
@@ -1 +1 @@
1
- {"version":3,"file":"useDropTarget.js","sources":["../../../../src/utils/hooks/useDropTarget.ts"],"sourcesContent":["import React from 'react';\r\n\r\nexport type useDropTarget = [\r\n boolean,\r\n (\r\n | undefined\r\n | {\r\n onDragEnter: React.DragEventHandler;\r\n onDragLeave: React.DragEventHandler;\r\n onDragOver: React.DragEventHandler;\r\n onDrop: React.DragEventHandler;\r\n }\r\n )\r\n];\r\n\r\nexport const useDropTarget = (onDrop: React.DragEventHandler | undefined): useDropTarget => {\r\n const [isDraggedOver, setDraggedOver] = React.useState(false);\r\n\r\n const handleDragEnter = React.useCallback((event: React.DragEvent<HTMLElement>) => {\r\n event.preventDefault();\r\n setDraggedOver(true);\r\n }, []);\r\n\r\n const handleDragLeave = React.useCallback((event: React.DragEvent<HTMLElement>) => {\r\n event.preventDefault();\r\n\r\n if (event.target === event.currentTarget) {\r\n setDraggedOver(false);\r\n }\r\n }, []);\r\n\r\n const handleDragOver = React.useCallback((event: React.DragEvent<HTMLElement>) => {\r\n event.preventDefault();\r\n }, []);\r\n\r\n const handleDrop = React.useCallback(\r\n (event: React.DragEvent<HTMLElement>) => {\r\n event.preventDefault();\r\n event.persist();\r\n\r\n setDraggedOver(false);\r\n\r\n if (onDrop) {\r\n onDrop(event);\r\n }\r\n },\r\n [onDrop]\r\n );\r\n\r\n const props = onDrop\r\n ? {\r\n onDragEnter: handleDragEnter,\r\n onDragLeave: handleDragLeave,\r\n onDragOver: handleDragOver,\r\n onDrop: handleDrop,\r\n }\r\n : undefined;\r\n\r\n return [isDraggedOver, props];\r\n};\r\n"],"names":["useDropTarget","onDrop","React","useState","isDraggedOver","setDraggedOver","handleDragEnter","useCallback","event","preventDefault","handleDragLeave","target","currentTarget","handleDragOver","handleDrop","persist","props","onDragEnter","onDragLeave","onDragOver","undefined"],"mappings":";;IAeaA,aAAa,GAAG,SAAhBA,aAAgB,CAACC,MAAD;EACzB,sBAAwCC,cAAK,CAACC,QAAN,CAAe,KAAf,CAAxC;MAAOC,aAAP;MAAsBC,cAAtB;;EAEA,IAAMC,eAAe,GAAGJ,cAAK,CAACK,WAAN,CAAkB,UAACC,KAAD;IACtCA,KAAK,CAACC,cAAN;IACAJ,cAAc,CAAC,IAAD,CAAd;GAFoB,EAGrB,EAHqB,CAAxB;EAKA,IAAMK,eAAe,GAAGR,cAAK,CAACK,WAAN,CAAkB,UAACC,KAAD;IACtCA,KAAK,CAACC,cAAN;;IAEA,IAAID,KAAK,CAACG,MAAN,KAAiBH,KAAK,CAACI,aAA3B,EAA0C;MACtCP,cAAc,CAAC,KAAD,CAAd;;GAJgB,EAMrB,EANqB,CAAxB;EAQA,IAAMQ,cAAc,GAAGX,cAAK,CAACK,WAAN,CAAkB,UAACC,KAAD;IACrCA,KAAK,CAACC,cAAN;GADmB,EAEpB,EAFoB,CAAvB;EAIA,IAAMK,UAAU,GAAGZ,cAAK,CAACK,WAAN,CACf,UAACC,KAAD;IACIA,KAAK,CAACC,cAAN;IACAD,KAAK,CAACO,OAAN;IAEAV,cAAc,CAAC,KAAD,CAAd;;IAEA,IAAIJ,MAAJ,EAAY;MACRA,MAAM,CAACO,KAAD,CAAN;;GARO,EAWf,CAACP,MAAD,CAXe,CAAnB;EAcA,IAAMe,KAAK,GAAGf,MAAM,GACd;IACIgB,WAAW,EAAEX,eADjB;IAEIY,WAAW,EAAER,eAFjB;IAGIS,UAAU,EAAEN,cAHhB;IAIIZ,MAAM,EAAEa;GALE,GAOdM,SAPN;EASA,OAAO,CAAChB,aAAD,EAAgBY,KAAhB,CAAP;AACH;;;;"}
1
+ {"version":3,"file":"useDropTarget.js","sources":["../../../../src/utils/hooks/useDropTarget.ts"],"sourcesContent":["import React from 'react';\n\nexport type useDropTarget = [\n boolean,\n (\n | undefined\n | {\n onDragEnter: React.DragEventHandler;\n onDragLeave: React.DragEventHandler;\n onDragOver: React.DragEventHandler;\n onDrop: React.DragEventHandler;\n }\n )\n];\n\nexport const useDropTarget = (onDrop: React.DragEventHandler | undefined): useDropTarget => {\n const [isDraggedOver, setDraggedOver] = React.useState(false);\n\n const handleDragEnter = React.useCallback((event: React.DragEvent<HTMLElement>) => {\n event.preventDefault();\n setDraggedOver(true);\n }, []);\n\n const handleDragLeave = React.useCallback((event: React.DragEvent<HTMLElement>) => {\n event.preventDefault();\n\n if (event.target === event.currentTarget) {\n setDraggedOver(false);\n }\n }, []);\n\n const handleDragOver = React.useCallback((event: React.DragEvent<HTMLElement>) => {\n event.preventDefault();\n }, []);\n\n const handleDrop = React.useCallback(\n (event: React.DragEvent<HTMLElement>) => {\n event.preventDefault();\n event.persist();\n\n setDraggedOver(false);\n\n if (onDrop) {\n onDrop(event);\n }\n },\n [onDrop]\n );\n\n const props = onDrop\n ? {\n onDragEnter: handleDragEnter,\n onDragLeave: handleDragLeave,\n onDragOver: handleDragOver,\n onDrop: handleDrop,\n }\n : undefined;\n\n return [isDraggedOver, props];\n};\n"],"names":["useDropTarget","onDrop","isDraggedOver","setDraggedOver","React","useState","handleDragEnter","useCallback","event","preventDefault","handleDragLeave","target","currentTarget","handleDragOver","handleDrop","persist","props","onDragEnter","onDragLeave","onDragOver","undefined"],"mappings":";;MAeaA,aAAa,GAAIC,MAAD;EACzB,MAAM,CAACC,aAAD,EAAgBC,cAAhB,IAAkCC,cAAK,CAACC,QAAN,CAAe,KAAf,CAAxC;EAEA,MAAMC,eAAe,GAAGF,cAAK,CAACG,WAAN,CAAmBC,KAAD;IACtCA,KAAK,CAACC,cAAN;IACAN,cAAc,CAAC,IAAD,CAAd;GAFoB,EAGrB,EAHqB,CAAxB;EAKA,MAAMO,eAAe,GAAGN,cAAK,CAACG,WAAN,CAAmBC,KAAD;IACtCA,KAAK,CAACC,cAAN;;IAEA,IAAID,KAAK,CAACG,MAAN,KAAiBH,KAAK,CAACI,aAA3B,EAA0C;MACtCT,cAAc,CAAC,KAAD,CAAd;;GAJgB,EAMrB,EANqB,CAAxB;EAQA,MAAMU,cAAc,GAAGT,cAAK,CAACG,WAAN,CAAmBC,KAAD;IACrCA,KAAK,CAACC,cAAN;GADmB,EAEpB,EAFoB,CAAvB;EAIA,MAAMK,UAAU,GAAGV,cAAK,CAACG,WAAN,CACdC,KAAD;IACIA,KAAK,CAACC,cAAN;IACAD,KAAK,CAACO,OAAN;IAEAZ,cAAc,CAAC,KAAD,CAAd;;IAEA,IAAIF,MAAJ,EAAY;MACRA,MAAM,CAACO,KAAD,CAAN;;GARO,EAWf,CAACP,MAAD,CAXe,CAAnB;EAcA,MAAMe,KAAK,GAAGf,MAAM,GACd;IACIgB,WAAW,EAAEX,eADjB;IAEIY,WAAW,EAAER,eAFjB;IAGIS,UAAU,EAAEN,cAHhB;IAIIZ,MAAM,EAAEa;GALE,GAOdM,SAPN;EASA,OAAO,CAAClB,aAAD,EAAgBc,KAAhB,CAAP;AACH;;;;"}
@@ -1,48 +1,33 @@
1
1
  import React__default from 'react';
2
- import keycode from 'keycode';
3
2
 
4
- var getNextIndexFromKeycode = function getNextIndexFromKeycode(keyCode, length, index, direction) {
5
- if (direction === void 0) {
6
- direction = 'vertical';
7
- }
8
-
9
- var previousKey = direction === 'horizontal' ? 'left' : 'up';
10
- var nextKey = direction === 'horizontal' ? 'right' : 'down';
3
+ const getNextIndexFromKey = (key, length, index, direction = 'vertical') => {
4
+ const previousKey = direction === 'horizontal' ? 'ArrowLeft' : 'ArrowUp';
5
+ const nextKey = direction === 'horizontal' ? 'ArrowRight' : 'ArrowDown';
11
6
 
12
- switch (keyCode) {
13
- case keycode(previousKey):
7
+ switch (key) {
8
+ case previousKey:
14
9
  return index !== undefined ? index - 1 < 0 ? 0 : index - 1 : index;
15
10
 
16
- case keycode(nextKey):
11
+ case nextKey:
17
12
  return index !== undefined ? index + 1 >= length ? index : index + 1 : index;
18
13
 
19
- case keycode('home'):
14
+ case 'Home':
20
15
  return 0;
21
16
 
22
- case keycode('end'):
17
+ case 'End':
23
18
  return length - 1;
24
19
 
25
20
  default:
26
21
  return;
27
22
  }
28
23
  };
29
- var useListKeyboardNavigation = function useListKeyboardNavigation(length, options) {
30
- if (length === void 0) {
31
- length = 0;
32
- }
33
-
34
- if (options === void 0) {
35
- options = {
36
- direction: 'vertical'
37
- };
38
- }
39
-
40
- var _React$useState = React__default.useState(options.initialIndex),
41
- index = _React$useState[0],
42
- setIndex = _React$useState[1];
24
+ const useListKeyboardNavigation = (length = 0, options = {
25
+ direction: 'vertical'
26
+ }) => {
27
+ const [index, setIndex] = React__default.useState(options.initialIndex);
43
28
 
44
- var getNextIndex = function getNextIndex(event) {
45
- var nextIndex = getNextIndexFromKeycode(event.keyCode, length, index, options.direction);
29
+ const getNextIndex = event => {
30
+ const nextIndex = getNextIndexFromKey(event.key, length, index, options.direction);
46
31
 
47
32
  if (nextIndex !== undefined) {
48
33
  event.preventDefault();
@@ -54,5 +39,5 @@ var useListKeyboardNavigation = function useListKeyboardNavigation(length, optio
54
39
  return [index, setIndex, getNextIndex];
55
40
  };
56
41
 
57
- export { getNextIndexFromKeycode, useListKeyboardNavigation };
42
+ export { getNextIndexFromKey, useListKeyboardNavigation };
58
43
  //# sourceMappingURL=useListKeyboardNavigation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useListKeyboardNavigation.js","sources":["../../../../src/utils/hooks/useListKeyboardNavigation.ts"],"sourcesContent":["import React from 'react';\r\nimport keycode from 'keycode';\r\nimport { Orientation } from '../../types';\r\n\r\nexport const getNextIndexFromKeycode = (\r\n keyCode: number,\r\n length: number,\r\n index: number | undefined,\r\n direction: Orientation = 'vertical'\r\n): number | undefined => {\r\n const previousKey = direction === 'horizontal' ? 'left' : 'up';\r\n const nextKey = direction === 'horizontal' ? 'right' : 'down';\r\n\r\n switch (keyCode) {\r\n case keycode(previousKey):\r\n return index !== undefined ? (index - 1 < 0 ? 0 : index - 1) : index;\r\n\r\n case keycode(nextKey):\r\n return index !== undefined ? (index + 1 >= length ? index : index + 1) : index;\r\n\r\n case keycode('home'):\r\n return 0;\r\n\r\n case keycode('end'):\r\n return length - 1;\r\n\r\n default:\r\n return;\r\n }\r\n};\r\n\r\nexport type useListKeyboardNavigationOptions = {\r\n direction?: Orientation;\r\n initialIndex?: number;\r\n};\r\n\r\nexport const useListKeyboardNavigation = (\r\n length = 0,\r\n options: useListKeyboardNavigationOptions = {\r\n direction: 'vertical',\r\n }\r\n): [number | undefined, (index: number | undefined) => void, (event: React.KeyboardEvent<HTMLElement>) => number | undefined] => {\r\n const [index, setIndex] = React.useState<number | undefined>(options.initialIndex);\r\n\r\n const getNextIndex = (event: React.KeyboardEvent<HTMLElement>): number | undefined => {\r\n const nextIndex = getNextIndexFromKeycode(event.keyCode, length, index, options.direction);\r\n\r\n if (nextIndex !== undefined) {\r\n event.preventDefault();\r\n }\r\n\r\n return nextIndex;\r\n };\r\n\r\n return [index, setIndex, getNextIndex];\r\n};\r\n"],"names":["getNextIndexFromKeycode","keyCode","length","index","direction","previousKey","nextKey","keycode","undefined","useListKeyboardNavigation","options","React","useState","initialIndex","setIndex","getNextIndex","event","nextIndex","preventDefault"],"mappings":";;;IAIaA,uBAAuB,GAAG,SAA1BA,uBAA0B,CACnCC,OADmC,EAEnCC,MAFmC,EAGnCC,KAHmC,EAInCC,SAJmC;MAInCA;IAAAA,YAAyB;;;EAEzB,IAAMC,WAAW,GAAGD,SAAS,KAAK,YAAd,GAA6B,MAA7B,GAAsC,IAA1D;EACA,IAAME,OAAO,GAAGF,SAAS,KAAK,YAAd,GAA6B,OAA7B,GAAuC,MAAvD;;EAEA,QAAQH,OAAR;IACI,KAAKM,OAAO,CAACF,WAAD,CAAZ;MACI,OAAOF,KAAK,KAAKK,SAAV,GAAuBL,KAAK,GAAG,CAAR,GAAY,CAAZ,GAAgB,CAAhB,GAAoBA,KAAK,GAAG,CAAnD,GAAwDA,KAA/D;;IAEJ,KAAKI,OAAO,CAACD,OAAD,CAAZ;MACI,OAAOH,KAAK,KAAKK,SAAV,GAAuBL,KAAK,GAAG,CAAR,IAAaD,MAAb,GAAsBC,KAAtB,GAA8BA,KAAK,GAAG,CAA7D,GAAkEA,KAAzE;;IAEJ,KAAKI,OAAO,CAAC,MAAD,CAAZ;MACI,OAAO,CAAP;;IAEJ,KAAKA,OAAO,CAAC,KAAD,CAAZ;MACI,OAAOL,MAAM,GAAG,CAAhB;;IAEJ;MACI;;AAEX;IAOYO,yBAAyB,GAAG,SAA5BA,yBAA4B,CACrCP,MADqC,EAErCQ,OAFqC;MACrCR;IAAAA,SAAS;;;MACTQ;IAAAA,UAA4C;MACxCN,SAAS,EAAE;;;;EAGf,sBAA0BO,cAAK,CAACC,QAAN,CAAmCF,OAAO,CAACG,YAA3C,CAA1B;MAAOV,KAAP;MAAcW,QAAd;;EAEA,IAAMC,YAAY,GAAG,SAAfA,YAAe,CAACC,KAAD;IACjB,IAAMC,SAAS,GAAGjB,uBAAuB,CAACgB,KAAK,CAACf,OAAP,EAAgBC,MAAhB,EAAwBC,KAAxB,EAA+BO,OAAO,CAACN,SAAvC,CAAzC;;IAEA,IAAIa,SAAS,KAAKT,SAAlB,EAA6B;MACzBQ,KAAK,CAACE,cAAN;;;IAGJ,OAAOD,SAAP;GAPJ;;EAUA,OAAO,CAACd,KAAD,EAAQW,QAAR,EAAkBC,YAAlB,CAAP;AACH;;;;"}
1
+ {"version":3,"file":"useListKeyboardNavigation.js","sources":["../../../../src/utils/hooks/useListKeyboardNavigation.ts"],"sourcesContent":["import React from 'react';\nimport { Orientation } from '../../types';\n\nexport const getNextIndexFromKey = (\n key: string,\n length: number,\n index: number | undefined,\n direction: Orientation = 'vertical'\n): number | undefined => {\n const previousKey = direction === 'horizontal' ? 'ArrowLeft' : 'ArrowUp';\n const nextKey = direction === 'horizontal' ? 'ArrowRight' : 'ArrowDown';\n\n switch (key) {\n case previousKey:\n return index !== undefined ? (index - 1 < 0 ? 0 : index - 1) : index;\n\n case nextKey:\n return index !== undefined ? (index + 1 >= length ? index : index + 1) : index;\n\n case 'Home':\n return 0;\n\n case 'End':\n return length - 1;\n\n default:\n return;\n }\n};\n\nexport type useListKeyboardNavigationOptions = {\n direction?: Orientation;\n initialIndex?: number;\n};\n\nexport const useListKeyboardNavigation = (\n length = 0,\n options: useListKeyboardNavigationOptions = {\n direction: 'vertical',\n }\n): [number | undefined, (index: number | undefined) => void, (event: React.KeyboardEvent<HTMLElement>) => number | undefined] => {\n const [index, setIndex] = React.useState<number | undefined>(options.initialIndex);\n\n const getNextIndex = (event: React.KeyboardEvent<HTMLElement>): number | undefined => {\n const nextIndex = getNextIndexFromKey(event.key, length, index, options.direction);\n\n if (nextIndex !== undefined) {\n event.preventDefault();\n }\n\n return nextIndex;\n };\n\n return [index, setIndex, getNextIndex];\n};\n"],"names":["getNextIndexFromKey","key","length","index","direction","previousKey","nextKey","undefined","useListKeyboardNavigation","options","setIndex","React","useState","initialIndex","getNextIndex","event","nextIndex","preventDefault"],"mappings":";;MAGaA,mBAAmB,GAAG,CAC/BC,GAD+B,EAE/BC,MAF+B,EAG/BC,KAH+B,EAI/BC,YAAyB,UAJM;EAM/B,MAAMC,WAAW,GAAGD,SAAS,KAAK,YAAd,GAA6B,WAA7B,GAA2C,SAA/D;EACA,MAAME,OAAO,GAAGF,SAAS,KAAK,YAAd,GAA6B,YAA7B,GAA4C,WAA5D;;EAEA,QAAQH,GAAR;IACI,KAAKI,WAAL;MACI,OAAOF,KAAK,KAAKI,SAAV,GAAuBJ,KAAK,GAAG,CAAR,GAAY,CAAZ,GAAgB,CAAhB,GAAoBA,KAAK,GAAG,CAAnD,GAAwDA,KAA/D;;IAEJ,KAAKG,OAAL;MACI,OAAOH,KAAK,KAAKI,SAAV,GAAuBJ,KAAK,GAAG,CAAR,IAAaD,MAAb,GAAsBC,KAAtB,GAA8BA,KAAK,GAAG,CAA7D,GAAkEA,KAAzE;;IAEJ,KAAK,MAAL;MACI,OAAO,CAAP;;IAEJ,KAAK,KAAL;MACI,OAAOD,MAAM,GAAG,CAAhB;;IAEJ;MACI;;AAEX;MAOYM,yBAAyB,GAAG,CACrCN,MAAM,GAAG,CAD4B,EAErCO,UAA4C;EACxCL,SAAS,EAAE;AAD6B,CAFP;EAMrC,MAAM,CAACD,KAAD,EAAQO,QAAR,IAAoBC,cAAK,CAACC,QAAN,CAAmCH,OAAO,CAACI,YAA3C,CAA1B;;EAEA,MAAMC,YAAY,GAAIC,KAAD;IACjB,MAAMC,SAAS,GAAGhB,mBAAmB,CAACe,KAAK,CAACd,GAAP,EAAYC,MAAZ,EAAoBC,KAApB,EAA2BM,OAAO,CAACL,SAAnC,CAArC;;IAEA,IAAIY,SAAS,KAAKT,SAAlB,EAA6B;MACzBQ,KAAK,CAACE,cAAN;;;IAGJ,OAAOD,SAAP;GAPJ;;EAUA,OAAO,CAACb,KAAD,EAAQO,QAAR,EAAkBI,YAAlB,CAAP;AACH;;;;"}
@@ -1,10 +1,10 @@
1
- var scrollToChildElement = function scrollToChildElement(parent, child) {
2
- var clientHeight = parent.clientHeight;
1
+ const scrollToChildElement = (parent, child) => {
2
+ const clientHeight = parent.clientHeight;
3
3
 
4
4
  if (parent.scrollHeight > clientHeight) {
5
- var scrollTop = parent.scrollTop;
6
- var scrollBottom = clientHeight + scrollTop;
7
- var childBottom = child.offsetTop + child.offsetHeight;
5
+ const scrollTop = parent.scrollTop;
6
+ const scrollBottom = clientHeight + scrollTop;
7
+ const childBottom = child.offsetTop + child.offsetHeight;
8
8
 
9
9
  if (childBottom > scrollBottom) {
10
10
  parent.scrollTop = childBottom - clientHeight;
@@ -14,11 +14,11 @@ var scrollToChildElement = function scrollToChildElement(parent, child) {
14
14
  }
15
15
  };
16
16
 
17
- var useListScrollTo = function useListScrollTo(internalRef, itemRefs) {
18
- var scrollTo = function scrollTo(index) {
17
+ const useListScrollTo = (internalRef, itemRefs) => {
18
+ const scrollTo = index => {
19
19
  if (internalRef && internalRef.current) {
20
20
  if (index !== undefined) {
21
- var activeRef = itemRefs[index];
21
+ const activeRef = itemRefs[index];
22
22
 
23
23
  if (activeRef && activeRef.current) {
24
24
  scrollToChildElement(internalRef.current, activeRef.current);
@@ -30,7 +30,7 @@ var useListScrollTo = function useListScrollTo(internalRef, itemRefs) {
30
30
  };
31
31
 
32
32
  return {
33
- scrollTo: scrollTo
33
+ scrollTo
34
34
  };
35
35
  };
36
36
 
@@ -1 +1 @@
1
- {"version":3,"file":"useListScrollTo.js","sources":["../../../../src/utils/hooks/useListScrollTo.ts"],"sourcesContent":["const scrollToChildElement = (parent: HTMLElement, child: HTMLElement): void => {\r\n const clientHeight = parent.clientHeight;\r\n\r\n if (parent.scrollHeight > clientHeight) {\r\n const scrollTop = parent.scrollTop;\r\n const scrollBottom = clientHeight + scrollTop;\r\n const childBottom = child.offsetTop + child.offsetHeight;\r\n\r\n if (childBottom > scrollBottom) {\r\n parent.scrollTop = childBottom - clientHeight;\r\n } else if (child.offsetTop < scrollTop) {\r\n parent.scrollTop = child.offsetTop;\r\n }\r\n }\r\n};\r\n\r\nexport const useListScrollTo = (internalRef: any, itemRefs: any[]): any => {\r\n const scrollTo = (index: number | undefined): void => {\r\n if (internalRef && internalRef.current) {\r\n if (index !== undefined) {\r\n const activeRef = itemRefs[index];\r\n\r\n if (activeRef && activeRef.current) {\r\n scrollToChildElement(internalRef.current, activeRef.current);\r\n }\r\n } else {\r\n internalRef.current.scrollTop = 0;\r\n }\r\n }\r\n };\r\n\r\n return { scrollTo };\r\n};\r\n"],"names":["scrollToChildElement","parent","child","clientHeight","scrollHeight","scrollTop","scrollBottom","childBottom","offsetTop","offsetHeight","useListScrollTo","internalRef","itemRefs","scrollTo","index","current","undefined","activeRef"],"mappings":"AAAA,IAAMA,oBAAoB,GAAG,SAAvBA,oBAAuB,CAACC,MAAD,EAAsBC,KAAtB;EACzB,IAAMC,YAAY,GAAGF,MAAM,CAACE,YAA5B;;EAEA,IAAIF,MAAM,CAACG,YAAP,GAAsBD,YAA1B,EAAwC;IACpC,IAAME,SAAS,GAAGJ,MAAM,CAACI,SAAzB;IACA,IAAMC,YAAY,GAAGH,YAAY,GAAGE,SAApC;IACA,IAAME,WAAW,GAAGL,KAAK,CAACM,SAAN,GAAkBN,KAAK,CAACO,YAA5C;;IAEA,IAAIF,WAAW,GAAGD,YAAlB,EAAgC;MAC5BL,MAAM,CAACI,SAAP,GAAmBE,WAAW,GAAGJ,YAAjC;KADJ,MAEO,IAAID,KAAK,CAACM,SAAN,GAAkBH,SAAtB,EAAiC;MACpCJ,MAAM,CAACI,SAAP,GAAmBH,KAAK,CAACM,SAAzB;;;AAGX,CAdD;;IAgBaE,eAAe,GAAG,SAAlBA,eAAkB,CAACC,WAAD,EAAmBC,QAAnB;EAC3B,IAAMC,QAAQ,GAAG,SAAXA,QAAW,CAACC,KAAD;IACb,IAAIH,WAAW,IAAIA,WAAW,CAACI,OAA/B,EAAwC;MACpC,IAAID,KAAK,KAAKE,SAAd,EAAyB;QACrB,IAAMC,SAAS,GAAGL,QAAQ,CAACE,KAAD,CAA1B;;QAEA,IAAIG,SAAS,IAAIA,SAAS,CAACF,OAA3B,EAAoC;UAChCf,oBAAoB,CAACW,WAAW,CAACI,OAAb,EAAsBE,SAAS,CAACF,OAAhC,CAApB;;OAJR,MAMO;QACHJ,WAAW,CAACI,OAAZ,CAAoBV,SAApB,GAAgC,CAAhC;;;GATZ;;EAcA,OAAO;IAAEQ,QAAQ,EAARA;GAAT;AACH;;;;"}
1
+ {"version":3,"file":"useListScrollTo.js","sources":["../../../../src/utils/hooks/useListScrollTo.ts"],"sourcesContent":["const scrollToChildElement = (parent: HTMLElement, child: HTMLElement): void => {\n const clientHeight = parent.clientHeight;\n\n if (parent.scrollHeight > clientHeight) {\n const scrollTop = parent.scrollTop;\n const scrollBottom = clientHeight + scrollTop;\n const childBottom = child.offsetTop + child.offsetHeight;\n\n if (childBottom > scrollBottom) {\n parent.scrollTop = childBottom - clientHeight;\n } else if (child.offsetTop < scrollTop) {\n parent.scrollTop = child.offsetTop;\n }\n }\n};\n\nexport const useListScrollTo = (internalRef: any, itemRefs: any[]): any => {\n const scrollTo = (index: number | undefined): void => {\n if (internalRef && internalRef.current) {\n if (index !== undefined) {\n const activeRef = itemRefs[index];\n\n if (activeRef && activeRef.current) {\n scrollToChildElement(internalRef.current, activeRef.current);\n }\n } else {\n internalRef.current.scrollTop = 0;\n }\n }\n };\n\n return { scrollTo };\n};\n"],"names":["scrollToChildElement","parent","child","clientHeight","scrollHeight","scrollTop","scrollBottom","childBottom","offsetTop","offsetHeight","useListScrollTo","internalRef","itemRefs","scrollTo","index","current","undefined","activeRef"],"mappings":"AAAA,MAAMA,oBAAoB,GAAG,CAACC,MAAD,EAAsBC,KAAtB;EACzB,MAAMC,YAAY,GAAGF,MAAM,CAACE,YAA5B;;EAEA,IAAIF,MAAM,CAACG,YAAP,GAAsBD,YAA1B,EAAwC;IACpC,MAAME,SAAS,GAAGJ,MAAM,CAACI,SAAzB;IACA,MAAMC,YAAY,GAAGH,YAAY,GAAGE,SAApC;IACA,MAAME,WAAW,GAAGL,KAAK,CAACM,SAAN,GAAkBN,KAAK,CAACO,YAA5C;;IAEA,IAAIF,WAAW,GAAGD,YAAlB,EAAgC;MAC5BL,MAAM,CAACI,SAAP,GAAmBE,WAAW,GAAGJ,YAAjC;KADJ,MAEO,IAAID,KAAK,CAACM,SAAN,GAAkBH,SAAtB,EAAiC;MACpCJ,MAAM,CAACI,SAAP,GAAmBH,KAAK,CAACM,SAAzB;;;AAGX,CAdD;;MAgBaE,eAAe,GAAG,CAACC,WAAD,EAAmBC,QAAnB;EAC3B,MAAMC,QAAQ,GAAIC,KAAD;IACb,IAAIH,WAAW,IAAIA,WAAW,CAACI,OAA/B,EAAwC;MACpC,IAAID,KAAK,KAAKE,SAAd,EAAyB;QACrB,MAAMC,SAAS,GAAGL,QAAQ,CAACE,KAAD,CAA1B;;QAEA,IAAIG,SAAS,IAAIA,SAAS,CAACF,OAA3B,EAAoC;UAChCf,oBAAoB,CAACW,WAAW,CAACI,OAAb,EAAsBE,SAAS,CAACF,OAAhC,CAApB;;OAJR,MAMO;QACHJ,WAAW,CAACI,OAAZ,CAAoBV,SAApB,GAAgC,CAAhC;;;GATZ;;EAcA,OAAO;IAAEQ;GAAT;AACH;;;;"}
@@ -1,13 +1,11 @@
1
1
  import React__default from 'react';
2
2
 
3
- var useOnClickOutside = function useOnClickOutside(ref, callback) {
4
- React__default.useEffect(function () {
5
- var listener = function listener(event) {
6
- var refs = !Array.isArray(ref) ? [ref] : ref;
3
+ const useOnClickOutside = (ref, callback) => {
4
+ React__default.useEffect(() => {
5
+ const listener = event => {
6
+ const refs = !Array.isArray(ref) ? [ref] : ref;
7
7
 
8
- if (refs.some(function (currentRef) {
9
- return !currentRef.current || currentRef.current.contains(event.target);
10
- })) {
8
+ if (refs.some(currentRef => !currentRef.current || currentRef.current.contains(event.target))) {
11
9
  return;
12
10
  }
13
11
 
@@ -16,7 +14,7 @@ var useOnClickOutside = function useOnClickOutside(ref, callback) {
16
14
 
17
15
  document.addEventListener('mousedown', listener);
18
16
  document.addEventListener('touchstart', listener);
19
- return function () {
17
+ return () => {
20
18
  document.removeEventListener('mousedown', listener);
21
19
  document.removeEventListener('touchstart', listener);
22
20
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useOnClickOutside.js","sources":["../../../../src/utils/hooks/useOnClickOutside.ts"],"sourcesContent":["import React from 'react';\r\n\r\nexport const useOnClickOutside = (\r\n ref: React.RefObject<HTMLElement> | React.RefObject<HTMLElement>[],\r\n callback: (event: MouseEvent | TouchEvent) => void\r\n): void => {\r\n React.useEffect(() => {\r\n const listener = (event: MouseEvent | TouchEvent): void => {\r\n const refs = !Array.isArray(ref) ? [ref] : ref;\r\n if (refs.some(currentRef => !currentRef.current || currentRef.current.contains(event.target as Node))) {\r\n return;\r\n }\r\n callback(event);\r\n };\r\n\r\n document.addEventListener('mousedown', listener);\r\n document.addEventListener('touchstart', listener);\r\n\r\n return () => {\r\n document.removeEventListener('mousedown', listener);\r\n document.removeEventListener('touchstart', listener);\r\n };\r\n }, [ref, callback]);\r\n};\r\n"],"names":["useOnClickOutside","ref","callback","React","useEffect","listener","event","refs","Array","isArray","some","currentRef","current","contains","target","document","addEventListener","removeEventListener"],"mappings":";;IAEaA,iBAAiB,GAAG,SAApBA,iBAAoB,CAC7BC,GAD6B,EAE7BC,QAF6B;EAI7BC,cAAK,CAACC,SAAN,CAAgB;IACZ,IAAMC,QAAQ,GAAG,SAAXA,QAAW,CAACC,KAAD;MACb,IAAMC,IAAI,GAAG,CAACC,KAAK,CAACC,OAAN,CAAcR,GAAd,CAAD,GAAsB,CAACA,GAAD,CAAtB,GAA8BA,GAA3C;;MACA,IAAIM,IAAI,CAACG,IAAL,CAAU,UAAAC,UAAU;QAAA,OAAI,CAACA,UAAU,CAACC,OAAZ,IAAuBD,UAAU,CAACC,OAAX,CAAmBC,QAAnB,CAA4BP,KAAK,CAACQ,MAAlC,CAA3B;OAApB,CAAJ,EAAuG;QACnG;;;MAEJZ,QAAQ,CAACI,KAAD,CAAR;KALJ;;IAQAS,QAAQ,CAACC,gBAAT,CAA0B,WAA1B,EAAuCX,QAAvC;IACAU,QAAQ,CAACC,gBAAT,CAA0B,YAA1B,EAAwCX,QAAxC;IAEA,OAAO;MACHU,QAAQ,CAACE,mBAAT,CAA6B,WAA7B,EAA0CZ,QAA1C;MACAU,QAAQ,CAACE,mBAAT,CAA6B,YAA7B,EAA2CZ,QAA3C;KAFJ;GAZJ,EAgBG,CAACJ,GAAD,EAAMC,QAAN,CAhBH;AAiBH;;;;"}
1
+ {"version":3,"file":"useOnClickOutside.js","sources":["../../../../src/utils/hooks/useOnClickOutside.ts"],"sourcesContent":["import React from 'react';\n\nexport const useOnClickOutside = (\n ref: React.RefObject<HTMLElement> | React.RefObject<HTMLElement>[],\n callback: (event: MouseEvent | TouchEvent) => void\n): void => {\n React.useEffect(() => {\n const listener = (event: MouseEvent | TouchEvent): void => {\n const refs = !Array.isArray(ref) ? [ref] : ref;\n if (refs.some(currentRef => !currentRef.current || currentRef.current.contains(event.target as Node))) {\n return;\n }\n callback(event);\n };\n\n document.addEventListener('mousedown', listener);\n document.addEventListener('touchstart', listener);\n\n return () => {\n document.removeEventListener('mousedown', listener);\n document.removeEventListener('touchstart', listener);\n };\n }, [ref, callback]);\n};\n"],"names":["useOnClickOutside","ref","callback","React","useEffect","listener","event","refs","Array","isArray","some","currentRef","current","contains","target","document","addEventListener","removeEventListener"],"mappings":";;MAEaA,iBAAiB,GAAG,CAC7BC,GAD6B,EAE7BC,QAF6B;EAI7BC,cAAK,CAACC,SAAN,CAAgB;IACZ,MAAMC,QAAQ,GAAIC,KAAD;MACb,MAAMC,IAAI,GAAG,CAACC,KAAK,CAACC,OAAN,CAAcR,GAAd,CAAD,GAAsB,CAACA,GAAD,CAAtB,GAA8BA,GAA3C;;MACA,IAAIM,IAAI,CAACG,IAAL,CAAUC,UAAU,IAAI,CAACA,UAAU,CAACC,OAAZ,IAAuBD,UAAU,CAACC,OAAX,CAAmBC,QAAnB,CAA4BP,KAAK,CAACQ,MAAlC,CAA/C,CAAJ,EAAuG;QACnG;;;MAEJZ,QAAQ,CAACI,KAAD,CAAR;KALJ;;IAQAS,QAAQ,CAACC,gBAAT,CAA0B,WAA1B,EAAuCX,QAAvC;IACAU,QAAQ,CAACC,gBAAT,CAA0B,YAA1B,EAAwCX,QAAxC;IAEA,OAAO;MACHU,QAAQ,CAACE,mBAAT,CAA6B,WAA7B,EAA0CZ,QAA1C;MACAU,QAAQ,CAACE,mBAAT,CAA6B,YAA7B,EAA2CZ,QAA3C;KAFJ;GAZJ,EAgBG,CAACJ,GAAD,EAAMC,QAAN,CAhBH;AAiBH;;;;"}
@@ -1,8 +1,8 @@
1
1
  import { useRef, useEffect } from 'react';
2
2
 
3
- var useProxiedRef = function useProxiedRef(ref) {
4
- var internalRef = useRef(null);
5
- useEffect(function () {
3
+ const useProxiedRef = ref => {
4
+ const internalRef = useRef(null);
5
+ useEffect(() => {
6
6
  if (ref) {
7
7
  if (typeof ref === 'function') {
8
8
  ref(internalRef.current);
@@ -1 +1 @@
1
- {"version":3,"file":"useProxiedRef.js","sources":["../../../../src/utils/hooks/useProxiedRef.ts"],"sourcesContent":["import * as React from 'react';\r\n\r\nexport const useProxiedRef = <T extends HTMLElement>(ref: React.Ref<HTMLElement>): React.RefObject<T> => {\r\n const internalRef = React.useRef<T>(null);\r\n\r\n React.useEffect(() => {\r\n if (ref) {\r\n if (typeof ref === 'function') {\r\n ref(internalRef.current);\r\n } else {\r\n (ref as React.MutableRefObject<HTMLElement | null>).current = internalRef.current;\r\n }\r\n }\r\n }, [ref]);\r\n\r\n return internalRef;\r\n};\r\n"],"names":["useProxiedRef","ref","internalRef","React","current"],"mappings":";;IAEaA,aAAa,GAAG,SAAhBA,aAAgB,CAAwBC,GAAxB;EACzB,IAAMC,WAAW,GAAGC,MAAA,CAAgB,IAAhB,CAApB;EAEAA,SAAA,CAAgB;IACZ,IAAIF,GAAJ,EAAS;MACL,IAAI,OAAOA,GAAP,KAAe,UAAnB,EAA+B;QAC3BA,GAAG,CAACC,WAAW,CAACE,OAAb,CAAH;OADJ,MAEO;QACFH,GAAkD,CAACG,OAAnD,GAA6DF,WAAW,CAACE,OAAzE;;;GALb,EAQG,CAACH,GAAD,CARH;EAUA,OAAOC,WAAP;AACH;;;;"}
1
+ {"version":3,"file":"useProxiedRef.js","sources":["../../../../src/utils/hooks/useProxiedRef.ts"],"sourcesContent":["import * as React from 'react';\n\nexport const useProxiedRef = <T extends HTMLElement>(ref: React.Ref<HTMLElement>): React.RefObject<T> => {\n const internalRef = React.useRef<T>(null);\n\n React.useEffect(() => {\n if (ref) {\n if (typeof ref === 'function') {\n ref(internalRef.current);\n } else {\n (ref as React.MutableRefObject<HTMLElement | null>).current = internalRef.current;\n }\n }\n }, [ref]);\n\n return internalRef;\n};\n"],"names":["useProxiedRef","ref","internalRef","React","current"],"mappings":";;MAEaA,aAAa,GAA2BC,GAAxB;EACzB,MAAMC,WAAW,GAAGC,MAAA,CAAgB,IAAhB,CAApB;EAEAA,SAAA,CAAgB;IACZ,IAAIF,GAAJ,EAAS;MACL,IAAI,OAAOA,GAAP,KAAe,UAAnB,EAA+B;QAC3BA,GAAG,CAACC,WAAW,CAACE,OAAb,CAAH;OADJ,MAEO;QACFH,GAAkD,CAACG,OAAnD,GAA6DF,WAAW,CAACE,OAAzE;;;GALb,EAQG,CAACH,GAAD,CARH;EAUA,OAAOC,WAAP;AACH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useTimer.js","sources":["../../../../src/utils/hooks/useTimer.ts"],"sourcesContent":["import * as React from 'react';\r\n\r\nexport interface Timer {\r\n running: boolean;\r\n start: () => void;\r\n pause: () => void;\r\n resume: () => void;\r\n}\r\n\r\ntype Tracker = {\r\n remaining: number;\r\n started: number | null;\r\n};\r\n\r\nexport default function useTimer(duration = 0, callback: () => void): Timer {\r\n const timer = React.useRef<number>();\r\n const [tracker, setTracker] = React.useState<Tracker>({\r\n remaining: duration,\r\n started: null,\r\n });\r\n\r\n React.useEffect(() => {\r\n if (duration) {\r\n if (tracker.started) {\r\n timer.current = window.setTimeout(callback, tracker.remaining);\r\n } else {\r\n clearTimeout(timer.current);\r\n }\r\n }\r\n\r\n return () => {\r\n clearTimeout(timer.current);\r\n };\r\n }, [tracker.started]);\r\n\r\n return {\r\n running: !!tracker.started,\r\n start: () => {\r\n setTracker({\r\n remaining: duration,\r\n started: Date.now(),\r\n });\r\n },\r\n pause: () => {\r\n if (tracker.started) {\r\n setTracker({\r\n remaining: tracker.remaining - (Date.now() - tracker.started),\r\n started: null,\r\n });\r\n }\r\n },\r\n resume: () => {\r\n if (tracker.remaining && !tracker.started) {\r\n setTracker({\r\n remaining: tracker.remaining,\r\n started: Date.now(),\r\n });\r\n }\r\n },\r\n };\r\n}\r\n"],"names":["useTimer","duration","callback","timer","React","tracker","setTracker","remaining","started","current","window","setTimeout","clearTimeout","running","start","Date","now","pause","resume"],"mappings":";;SAcwBA,SAASC,QAAQ,GAAG,GAAGC;EAC3C,MAAMC,KAAK,GAAGC,MAAA,EAAd;EACA,MAAM,CAACC,OAAD,EAAUC,UAAV,IAAwBF,QAAA,CAAwB;IAClDG,SAAS,EAAEN,QADuC;IAElDO,OAAO,EAAE;GAFiB,CAA9B;EAKAJ,SAAA,CAAgB;IACZ,IAAIH,QAAJ,EAAc;MACV,IAAII,OAAO,CAACG,OAAZ,EAAqB;QACjBL,KAAK,CAACM,OAAN,GAAgBC,MAAM,CAACC,UAAP,CAAkBT,QAAlB,EAA4BG,OAAO,CAACE,SAApC,CAAhB;OADJ,MAEO;QACHK,YAAY,CAACT,KAAK,CAACM,OAAP,CAAZ;;;;IAIR,OAAO;MACHG,YAAY,CAACT,KAAK,CAACM,OAAP,CAAZ;KADJ;GATJ,EAYG,CAACJ,OAAO,CAACG,OAAT,CAZH;EAcA,OAAO;IACHK,OAAO,EAAE,CAAC,CAACR,OAAO,CAACG,OADhB;IAEHM,KAAK,EAAE;MACHR,UAAU,CAAC;QACPC,SAAS,EAAEN,QADJ;QAEPO,OAAO,EAAEO,IAAI,CAACC,GAAL;OAFH,CAAV;KAHD;IAQHC,KAAK,EAAE;MACH,IAAIZ,OAAO,CAACG,OAAZ,EAAqB;QACjBF,UAAU,CAAC;UACPC,SAAS,EAAEF,OAAO,CAACE,SAAR,IAAqBQ,IAAI,CAACC,GAAL,KAAaX,OAAO,CAACG,OAA1C,CADJ;UAEPA,OAAO,EAAE;SAFH,CAAV;;KAVL;IAgBHU,MAAM,EAAE;MACJ,IAAIb,OAAO,CAACE,SAAR,IAAqB,CAACF,OAAO,CAACG,OAAlC,EAA2C;QACvCF,UAAU,CAAC;UACPC,SAAS,EAAEF,OAAO,CAACE,SADZ;UAEPC,OAAO,EAAEO,IAAI,CAACC,GAAL;SAFH,CAAV;;;GAlBZ;AAyBH;;;;"}
1
+ {"version":3,"file":"useTimer.js","sources":["../../../../src/utils/hooks/useTimer.ts"],"sourcesContent":["import * as React from 'react';\n\nexport interface Timer {\n running: boolean;\n start: () => void;\n pause: () => void;\n resume: () => void;\n}\n\ntype Tracker = {\n remaining: number;\n started: number | null;\n};\n\nexport default function useTimer(duration = 0, callback: () => void): Timer {\n const timer = React.useRef<number>();\n const [tracker, setTracker] = React.useState<Tracker>({\n remaining: duration,\n started: null,\n });\n\n React.useEffect(() => {\n if (duration) {\n if (tracker.started) {\n timer.current = window.setTimeout(callback, tracker.remaining);\n } else {\n clearTimeout(timer.current);\n }\n }\n\n return () => {\n clearTimeout(timer.current);\n };\n }, [tracker.started]);\n\n return {\n running: !!tracker.started,\n start: () => {\n setTracker({\n remaining: duration,\n started: Date.now(),\n });\n },\n pause: () => {\n if (tracker.started) {\n setTracker({\n remaining: tracker.remaining - (Date.now() - tracker.started),\n started: null,\n });\n }\n },\n resume: () => {\n if (tracker.remaining && !tracker.started) {\n setTracker({\n remaining: tracker.remaining,\n started: Date.now(),\n });\n }\n },\n };\n}\n"],"names":["useTimer","duration","callback","timer","React","tracker","setTracker","remaining","started","current","window","setTimeout","clearTimeout","running","start","Date","now","pause","resume"],"mappings":";;SAcwBA,SAASC,QAAQ,GAAG,GAAGC;EAC3C,MAAMC,KAAK,GAAGC,MAAA,EAAd;EACA,MAAM,CAACC,OAAD,EAAUC,UAAV,IAAwBF,QAAA,CAAwB;IAClDG,SAAS,EAAEN,QADuC;IAElDO,OAAO,EAAE;GAFiB,CAA9B;EAKAJ,SAAA,CAAgB;IACZ,IAAIH,QAAJ,EAAc;MACV,IAAII,OAAO,CAACG,OAAZ,EAAqB;QACjBL,KAAK,CAACM,OAAN,GAAgBC,MAAM,CAACC,UAAP,CAAkBT,QAAlB,EAA4BG,OAAO,CAACE,SAApC,CAAhB;OADJ,MAEO;QACHK,YAAY,CAACT,KAAK,CAACM,OAAP,CAAZ;;;;IAIR,OAAO;MACHG,YAAY,CAACT,KAAK,CAACM,OAAP,CAAZ;KADJ;GATJ,EAYG,CAACJ,OAAO,CAACG,OAAT,CAZH;EAcA,OAAO;IACHK,OAAO,EAAE,CAAC,CAACR,OAAO,CAACG,OADhB;IAEHM,KAAK,EAAE;MACHR,UAAU,CAAC;QACPC,SAAS,EAAEN,QADJ;QAEPO,OAAO,EAAEO,IAAI,CAACC,GAAL;OAFH,CAAV;KAHD;IAQHC,KAAK,EAAE;MACH,IAAIZ,OAAO,CAACG,OAAZ,EAAqB;QACjBF,UAAU,CAAC;UACPC,SAAS,EAAEF,OAAO,CAACE,SAAR,IAAqBQ,IAAI,CAACC,GAAL,KAAaX,OAAO,CAACG,OAA1C,CADJ;UAEPA,OAAO,EAAE;SAFH,CAAV;;KAVL;IAgBHU,MAAM,EAAE;MACJ,IAAIb,OAAO,CAACE,SAAR,IAAqB,CAACF,OAAO,CAACG,OAAlC,EAA2C;QACvCF,UAAU,CAAC;UACPC,SAAS,EAAEF,OAAO,CAACE,SADZ;UAEPC,OAAO,EAAEO,IAAI,CAACC,GAAL;SAFH,CAAV;;;GAlBZ;AAyBH;;;;"}
@@ -22,7 +22,7 @@ const createCustomKeyboardEvent = event => {
22
22
  } else {
23
23
  customKeyboardEvent = document.createEvent('Event');
24
24
  customKeyboardEvent.initEvent(event.type, true, true);
25
- customKeyboardEvent.keyCode = event.keyCode;
25
+ customKeyboardEvent.key = event.key;
26
26
  customKeyboardEvent.charCode = event.charCode;
27
27
  }
28
28
 
@@ -1 +1 @@
1
- {"version":3,"file":"input.js","sources":["../../../src/utils/input.ts"],"sourcesContent":["// returns a custom event compatible with all browsers\r\nexport const createCustomEvent = (eventType: string) => {\r\n let customEvent;\r\n\r\n if (typeof Event === 'function') {\r\n customEvent = new Event(eventType, { bubbles: true });\r\n } else {\r\n customEvent = document.createEvent('Event');\r\n customEvent.initEvent(eventType, true, true);\r\n }\r\n return customEvent;\r\n};\r\n\r\n// returns a custom keyboard event compatible with all browsers\r\nexport const createCustomKeyboardEvent = (event: React.KeyboardEvent<HTMLInputElement>) => {\r\n let customKeyboardEvent;\r\n\r\n if (typeof KeyboardEvent === 'function') {\r\n customKeyboardEvent = new KeyboardEvent(event.type, event as any);\r\n } else {\r\n customKeyboardEvent = document.createEvent('Event') as any;\r\n customKeyboardEvent.initEvent(event.type, true, true);\r\n customKeyboardEvent.keyCode = event.keyCode;\r\n customKeyboardEvent.charCode = event.charCode;\r\n }\r\n\r\n return customKeyboardEvent;\r\n};\r\n\r\nexport const setInputValueByRef = (input: HTMLInputElement | null, value: string | undefined, event = 'change'): void => {\r\n if (!input) {\r\n return;\r\n }\r\n\r\n const previousValue = input.value;\r\n input.value = value || '';\r\n\r\n const tracker = (input as any)._valueTracker;\r\n\r\n if (tracker) {\r\n tracker.setValue(previousValue);\r\n }\r\n\r\n // 'change' instead of 'input', see https://github.com/facebook/react/issues/11488#issuecomment-381590324\r\n input.dispatchEvent(createCustomEvent(event));\r\n};\r\n"],"names":["createCustomEvent","eventType","customEvent","Event","bubbles","document","createEvent","initEvent","createCustomKeyboardEvent","event","customKeyboardEvent","KeyboardEvent","type","keyCode","charCode","setInputValueByRef","input","value","previousValue","tracker","_valueTracker","setValue","dispatchEvent"],"mappings":"AAAA;MACaA,iBAAiB,GAAIC,SAAD;EAC7B,IAAIC,WAAJ;;EAEA,IAAI,OAAOC,KAAP,KAAiB,UAArB,EAAiC;IAC7BD,WAAW,GAAG,IAAIC,KAAJ,CAAUF,SAAV,EAAqB;MAAEG,OAAO,EAAE;KAAhC,CAAd;GADJ,MAEO;IACHF,WAAW,GAAGG,QAAQ,CAACC,WAAT,CAAqB,OAArB,CAAd;IACAJ,WAAW,CAACK,SAAZ,CAAsBN,SAAtB,EAAiC,IAAjC,EAAuC,IAAvC;;;EAEJ,OAAOC,WAAP;AACH;;MAGYM,yBAAyB,GAAIC,KAAD;EACrC,IAAIC,mBAAJ;;EAEA,IAAI,OAAOC,aAAP,KAAyB,UAA7B,EAAyC;IACrCD,mBAAmB,GAAG,IAAIC,aAAJ,CAAkBF,KAAK,CAACG,IAAxB,EAA8BH,KAA9B,CAAtB;GADJ,MAEO;IACHC,mBAAmB,GAAGL,QAAQ,CAACC,WAAT,CAAqB,OAArB,CAAtB;IACAI,mBAAmB,CAACH,SAApB,CAA8BE,KAAK,CAACG,IAApC,EAA0C,IAA1C,EAAgD,IAAhD;IACAF,mBAAmB,CAACG,OAApB,GAA8BJ,KAAK,CAACI,OAApC;IACAH,mBAAmB,CAACI,QAApB,GAA+BL,KAAK,CAACK,QAArC;;;EAGJ,OAAOJ,mBAAP;AACH;MAEYK,kBAAkB,GAAG,CAACC,KAAD,EAAiCC,KAAjC,EAA4DR,KAAK,GAAG,QAApE;EAC9B,IAAI,CAACO,KAAL,EAAY;IACR;;;EAGJ,MAAME,aAAa,GAAGF,KAAK,CAACC,KAA5B;EACAD,KAAK,CAACC,KAAN,GAAcA,KAAK,IAAI,EAAvB;EAEA,MAAME,OAAO,GAAIH,KAAa,CAACI,aAA/B;;EAEA,IAAID,OAAJ,EAAa;IACTA,OAAO,CAACE,QAAR,CAAiBH,aAAjB;;;;EAIJF,KAAK,CAACM,aAAN,CAAoBtB,iBAAiB,CAACS,KAAD,CAArC;AACH;;;;"}
1
+ {"version":3,"file":"input.js","sources":["../../../src/utils/input.ts"],"sourcesContent":["// returns a custom event compatible with all browsers\nexport const createCustomEvent = (eventType: string) => {\n let customEvent;\n\n if (typeof Event === 'function') {\n customEvent = new Event(eventType, { bubbles: true });\n } else {\n customEvent = document.createEvent('Event');\n customEvent.initEvent(eventType, true, true);\n }\n return customEvent;\n};\n\n// returns a custom keyboard event compatible with all browsers\nexport const createCustomKeyboardEvent = (event: React.KeyboardEvent<HTMLInputElement>) => {\n let customKeyboardEvent;\n\n if (typeof KeyboardEvent === 'function') {\n customKeyboardEvent = new KeyboardEvent(event.type, event as any);\n } else {\n customKeyboardEvent = document.createEvent('Event') as any;\n customKeyboardEvent.initEvent(event.type, true, true);\n customKeyboardEvent.key = event.key;\n customKeyboardEvent.charCode = event.charCode;\n }\n\n return customKeyboardEvent;\n};\n\nexport const setInputValueByRef = (input: HTMLInputElement | null, value: string | undefined, event = 'change'): void => {\n if (!input) {\n return;\n }\n\n const previousValue = input.value;\n input.value = value || '';\n\n const tracker = (input as any)._valueTracker;\n\n if (tracker) {\n tracker.setValue(previousValue);\n }\n\n // 'change' instead of 'input', see https://github.com/facebook/react/issues/11488#issuecomment-381590324\n input.dispatchEvent(createCustomEvent(event));\n};\n"],"names":["createCustomEvent","eventType","customEvent","Event","bubbles","document","createEvent","initEvent","createCustomKeyboardEvent","event","customKeyboardEvent","KeyboardEvent","type","key","charCode","setInputValueByRef","input","value","previousValue","tracker","_valueTracker","setValue","dispatchEvent"],"mappings":"AAAA;MACaA,iBAAiB,GAAIC,SAAD;EAC7B,IAAIC,WAAJ;;EAEA,IAAI,OAAOC,KAAP,KAAiB,UAArB,EAAiC;IAC7BD,WAAW,GAAG,IAAIC,KAAJ,CAAUF,SAAV,EAAqB;MAAEG,OAAO,EAAE;KAAhC,CAAd;GADJ,MAEO;IACHF,WAAW,GAAGG,QAAQ,CAACC,WAAT,CAAqB,OAArB,CAAd;IACAJ,WAAW,CAACK,SAAZ,CAAsBN,SAAtB,EAAiC,IAAjC,EAAuC,IAAvC;;;EAEJ,OAAOC,WAAP;AACH;;MAGYM,yBAAyB,GAAIC,KAAD;EACrC,IAAIC,mBAAJ;;EAEA,IAAI,OAAOC,aAAP,KAAyB,UAA7B,EAAyC;IACrCD,mBAAmB,GAAG,IAAIC,aAAJ,CAAkBF,KAAK,CAACG,IAAxB,EAA8BH,KAA9B,CAAtB;GADJ,MAEO;IACHC,mBAAmB,GAAGL,QAAQ,CAACC,WAAT,CAAqB,OAArB,CAAtB;IACAI,mBAAmB,CAACH,SAApB,CAA8BE,KAAK,CAACG,IAApC,EAA0C,IAA1C,EAAgD,IAAhD;IACAF,mBAAmB,CAACG,GAApB,GAA0BJ,KAAK,CAACI,GAAhC;IACAH,mBAAmB,CAACI,QAApB,GAA+BL,KAAK,CAACK,QAArC;;;EAGJ,OAAOJ,mBAAP;AACH;MAEYK,kBAAkB,GAAG,CAACC,KAAD,EAAiCC,KAAjC,EAA4DR,KAAK,GAAG,QAApE;EAC9B,IAAI,CAACO,KAAL,EAAY;IACR;;;EAGJ,MAAME,aAAa,GAAGF,KAAK,CAACC,KAA5B;EACAD,KAAK,CAACC,KAAN,GAAcA,KAAK,IAAI,EAAvB;EAEA,MAAME,OAAO,GAAIH,KAAa,CAACI,aAA/B;;EAEA,IAAID,OAAJ,EAAa;IACTA,OAAO,CAACE,QAAR,CAAiBH,aAAjB;;;;EAIJF,KAAK,CAACM,aAAN,CAAoBtB,iBAAiB,CAACS,KAAD,CAArC;AACH;;;;"}
@@ -1,6 +1,6 @@
1
1
  function mergeRefs(refs) {
2
- return function (value) {
3
- refs.forEach(function (ref) {
2
+ return value => {
3
+ refs.forEach(ref => {
4
4
  if (typeof ref === 'function') {
5
5
  ref(value);
6
6
  } else if (ref != null) {