@economic/taco 2.45.0-alpha.0 → 2.45.0-create.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (507) hide show
  1. package/dist/components/Accordion/Accordion.d.ts +2 -2
  2. package/dist/components/Alert/Alert.d.ts +1 -1
  3. package/dist/components/AlertDialog/components/Content.d.ts +1 -1
  4. package/dist/components/Calendar/Calendar.d.ts +1 -1
  5. package/dist/components/Datepicker/Datepicker.d.ts +1 -1
  6. package/dist/components/Dialog/components/Content.d.ts +1 -1
  7. package/dist/components/Dialog/components/DialogDrawer.d.ts +2 -2
  8. package/dist/components/Drawer/components/Content.d.ts +2 -2
  9. package/dist/components/Header/components/Agreement/Badge.d.ts +1 -1
  10. package/dist/components/Header/components/Agreement/Display.d.ts +2 -2
  11. package/dist/components/Header/components/Agreement/Item.d.ts +2 -2
  12. package/dist/components/Header/components/AgreementSelector.d.ts +2 -2
  13. package/dist/components/Header/components/Button.d.ts +1 -1
  14. package/dist/components/HoverCard/HoverCard.d.ts +1 -1
  15. package/dist/components/Icon/components/AccountPreview.d.ts +1 -1
  16. package/dist/components/Icon/components/Accounting.d.ts +1 -1
  17. package/dist/components/Icon/components/AccountingYear.d.ts +1 -1
  18. package/dist/components/Icon/components/AccountingYearCancel.d.ts +1 -1
  19. package/dist/components/Icon/components/AiChatSolid.d.ts +1 -1
  20. package/dist/components/Icon/components/AiStars.d.ts +1 -1
  21. package/dist/components/Icon/components/ArrowBottom.d.ts +1 -1
  22. package/dist/components/Icon/components/ArrowDown.d.ts +1 -1
  23. package/dist/components/Icon/components/ArrowEnd.d.ts +1 -1
  24. package/dist/components/Icon/components/ArrowLeft.d.ts +1 -1
  25. package/dist/components/Icon/components/ArrowRight.d.ts +1 -1
  26. package/dist/components/Icon/components/ArrowStart.d.ts +1 -1
  27. package/dist/components/Icon/components/ArrowTop.d.ts +1 -1
  28. package/dist/components/Icon/components/ArrowUp.d.ts +1 -1
  29. package/dist/components/Icon/components/Attach.d.ts +1 -1
  30. package/dist/components/Icon/components/AttachAuto.d.ts +1 -1
  31. package/dist/components/Icon/components/AttachCancel.d.ts +1 -1
  32. package/dist/components/Icon/components/AttachWarning.d.ts +1 -1
  33. package/dist/components/Icon/components/Autotext.d.ts +1 -1
  34. package/dist/components/Icon/components/AutotextInsert.d.ts +1 -1
  35. package/dist/components/Icon/components/Basic.d.ts +1 -1
  36. package/dist/components/Icon/components/BasicTabs.d.ts +1 -1
  37. package/dist/components/Icon/components/BellSolid.d.ts +1 -1
  38. package/dist/components/Icon/components/Book.d.ts +1 -1
  39. package/dist/components/Icon/components/Booking.d.ts +1 -1
  40. package/dist/components/Icon/components/Budget.d.ts +1 -1
  41. package/dist/components/Icon/components/Calendar.d.ts +1 -1
  42. package/dist/components/Icon/components/CashAccount.d.ts +1 -1
  43. package/dist/components/Icon/components/CashReports.d.ts +1 -1
  44. package/dist/components/Icon/components/ChartArea.d.ts +1 -1
  45. package/dist/components/Icon/components/ChartBar.d.ts +1 -1
  46. package/dist/components/Icon/components/ChartLine.d.ts +1 -1
  47. package/dist/components/Icon/components/ChartPie.d.ts +1 -1
  48. package/dist/components/Icon/components/ChartTable.d.ts +1 -1
  49. package/dist/components/Icon/components/Chat.d.ts +1 -1
  50. package/dist/components/Icon/components/ChatSolid.d.ts +1 -1
  51. package/dist/components/Icon/components/ChevronDown.d.ts +1 -1
  52. package/dist/components/Icon/components/ChevronDownDouble.d.ts +1 -1
  53. package/dist/components/Icon/components/ChevronDownSolid.d.ts +1 -1
  54. package/dist/components/Icon/components/ChevronLeft.d.ts +1 -1
  55. package/dist/components/Icon/components/ChevronLeftDouble.d.ts +1 -1
  56. package/dist/components/Icon/components/ChevronLeftSolid.d.ts +1 -1
  57. package/dist/components/Icon/components/ChevronRight.d.ts +1 -1
  58. package/dist/components/Icon/components/ChevronRightDouble.d.ts +1 -1
  59. package/dist/components/Icon/components/ChevronRightSolid.d.ts +1 -1
  60. package/dist/components/Icon/components/ChevronUp.d.ts +1 -1
  61. package/dist/components/Icon/components/ChevronUpDouble.d.ts +1 -1
  62. package/dist/components/Icon/components/ChevronUpSolid.d.ts +1 -1
  63. package/dist/components/Icon/components/CircleClose.d.ts +1 -1
  64. package/dist/components/Icon/components/CircleInformation.d.ts +1 -1
  65. package/dist/components/Icon/components/CircleMinus.d.ts +1 -1
  66. package/dist/components/Icon/components/CirclePlus.d.ts +1 -1
  67. package/dist/components/Icon/components/CircleQuestionmark.d.ts +1 -1
  68. package/dist/components/Icon/components/CircleTick.d.ts +1 -1
  69. package/dist/components/Icon/components/CircleWarning.d.ts +1 -1
  70. package/dist/components/Icon/components/Clamp.d.ts +1 -1
  71. package/dist/components/Icon/components/ClampOpen.d.ts +1 -1
  72. package/dist/components/Icon/components/Close.d.ts +1 -1
  73. package/dist/components/Icon/components/ColumnFreeze.d.ts +1 -1
  74. package/dist/components/Icon/components/ColumnUnfreeze.d.ts +1 -1
  75. package/dist/components/Icon/components/Columns.d.ts +1 -1
  76. package/dist/components/Icon/components/ConnectionEnable.d.ts +1 -1
  77. package/dist/components/Icon/components/ConnectionRevoke.d.ts +1 -1
  78. package/dist/components/Icon/components/Contacts.d.ts +1 -1
  79. package/dist/components/Icon/components/Copy.d.ts +1 -1
  80. package/dist/components/Icon/components/Courses.d.ts +1 -1
  81. package/dist/components/Icon/components/Credit.d.ts +1 -1
  82. package/dist/components/Icon/components/Delete.d.ts +1 -1
  83. package/dist/components/Icon/components/DeletePermanently.d.ts +1 -1
  84. package/dist/components/Icon/components/Depecriate.d.ts +1 -1
  85. package/dist/components/Icon/components/Developer.d.ts +1 -1
  86. package/dist/components/Icon/components/DistributionTemplate.d.ts +1 -1
  87. package/dist/components/Icon/components/Document.d.ts +1 -1
  88. package/dist/components/Icon/components/DocumentApprove.d.ts +1 -1
  89. package/dist/components/Icon/components/DocumentCreateEntry.d.ts +1 -1
  90. package/dist/components/Icon/components/DocumentCut.d.ts +1 -1
  91. package/dist/components/Icon/components/DocumentError.d.ts +1 -1
  92. package/dist/components/Icon/components/DocumentIsolatePage.d.ts +1 -1
  93. package/dist/components/Icon/components/DocumentMerge.d.ts +1 -1
  94. package/dist/components/Icon/components/DocumentMove.d.ts +1 -1
  95. package/dist/components/Icon/components/DocumentPreview.d.ts +1 -1
  96. package/dist/components/Icon/components/DocumentReceived.d.ts +1 -1
  97. package/dist/components/Icon/components/DocumentRejectedRequest.d.ts +1 -1
  98. package/dist/components/Icon/components/DocumentSigned.d.ts +1 -1
  99. package/dist/components/Icon/components/DocumentSignedSolid.d.ts +1 -1
  100. package/dist/components/Icon/components/DocumentSplit.d.ts +1 -1
  101. package/dist/components/Icon/components/DocumentTime.d.ts +1 -1
  102. package/dist/components/Icon/components/Download.d.ts +1 -1
  103. package/dist/components/Icon/components/Drag.d.ts +1 -1
  104. package/dist/components/Icon/components/ECopedia.d.ts +1 -1
  105. package/dist/components/Icon/components/Edit.d.ts +1 -1
  106. package/dist/components/Icon/components/EditSimple.d.ts +1 -1
  107. package/dist/components/Icon/components/EllipsisHorizontal.d.ts +1 -1
  108. package/dist/components/Icon/components/EllipsisVertical.d.ts +1 -1
  109. package/dist/components/Icon/components/EntriesOnAccount.d.ts +1 -1
  110. package/dist/components/Icon/components/EntriesOpen.d.ts +1 -1
  111. package/dist/components/Icon/components/EntriesWarning.d.ts +1 -1
  112. package/dist/components/Icon/components/EntryTypeCustomerInvoice.d.ts +1 -1
  113. package/dist/components/Icon/components/EntryTypeCustomerPayment.d.ts +1 -1
  114. package/dist/components/Icon/components/EntryTypeJournalEntry.d.ts +1 -1
  115. package/dist/components/Icon/components/EntryTypeManualCustomerInvoice.d.ts +1 -1
  116. package/dist/components/Icon/components/EntryTypeSupplierInvoice.d.ts +1 -1
  117. package/dist/components/Icon/components/EntryTypeSupplierPayment.d.ts +1 -1
  118. package/dist/components/Icon/components/Envelope.d.ts +1 -1
  119. package/dist/components/Icon/components/EnvelopeApproved.d.ts +1 -1
  120. package/dist/components/Icon/components/EnvelopeSolid.d.ts +1 -1
  121. package/dist/components/Icon/components/ExpandView.d.ts +1 -1
  122. package/dist/components/Icon/components/Expenses.d.ts +1 -1
  123. package/dist/components/Icon/components/Export.d.ts +1 -1
  124. package/dist/components/Icon/components/ExportToExcel.d.ts +1 -1
  125. package/dist/components/Icon/components/ExportToPdf.d.ts +1 -1
  126. package/dist/components/Icon/components/EyeOff.d.ts +1 -1
  127. package/dist/components/Icon/components/EyeOn.d.ts +1 -1
  128. package/dist/components/Icon/components/Filter.d.ts +1 -1
  129. package/dist/components/Icon/components/FilterSolid.d.ts +1 -1
  130. package/dist/components/Icon/components/FontSize.d.ts +1 -1
  131. package/dist/components/Icon/components/GraphSolid.d.ts +1 -1
  132. package/dist/components/Icon/components/Hash.d.ts +1 -1
  133. package/dist/components/Icon/components/HeightExtraTall.d.ts +1 -1
  134. package/dist/components/Icon/components/HeightMedium.d.ts +1 -1
  135. package/dist/components/Icon/components/HeightShort.d.ts +1 -1
  136. package/dist/components/Icon/components/HeightTall.d.ts +1 -1
  137. package/dist/components/Icon/components/House.d.ts +1 -1
  138. package/dist/components/Icon/components/HouseSolid.d.ts +1 -1
  139. package/dist/components/Icon/components/Id.d.ts +1 -1
  140. package/dist/components/Icon/components/Images.d.ts +1 -1
  141. package/dist/components/Icon/components/Import.d.ts +1 -1
  142. package/dist/components/Icon/components/Inbox.d.ts +1 -1
  143. package/dist/components/Icon/components/InboxEinvoicing.d.ts +1 -1
  144. package/dist/components/Icon/components/InboxScanning.d.ts +1 -1
  145. package/dist/components/Icon/components/InboxSmart.d.ts +1 -1
  146. package/dist/components/Icon/components/Info.d.ts +1 -1
  147. package/dist/components/Icon/components/Inventory.d.ts +1 -1
  148. package/dist/components/Icon/components/InventoryMatrix.d.ts +1 -1
  149. package/dist/components/Icon/components/JournalPro.d.ts +1 -1
  150. package/dist/components/Icon/components/Layout.d.ts +1 -1
  151. package/dist/components/Icon/components/LayoutBoth.d.ts +1 -1
  152. package/dist/components/Icon/components/LayoutFirst.d.ts +1 -1
  153. package/dist/components/Icon/components/LayoutLast.d.ts +1 -1
  154. package/dist/components/Icon/components/LayoutNone.d.ts +1 -1
  155. package/dist/components/Icon/components/LedgerCard.d.ts +1 -1
  156. package/dist/components/Icon/components/LedgerCardCustomerReminder.d.ts +1 -1
  157. package/dist/components/Icon/components/LedgerCardManualCustomerInvoice.d.ts +1 -1
  158. package/dist/components/Icon/components/LedgerCardObsoleteStock.d.ts +1 -1
  159. package/dist/components/Icon/components/LedgerCardOpeningEntry.d.ts +1 -1
  160. package/dist/components/Icon/components/LedgerCardReservedEntry.d.ts +1 -1
  161. package/dist/components/Icon/components/LedgerCardShrinkagePilferage.d.ts +1 -1
  162. package/dist/components/Icon/components/LedgerCardStockAdjustment.d.ts +1 -1
  163. package/dist/components/Icon/components/LedgerCardTransferredOpeningEntry.d.ts +1 -1
  164. package/dist/components/Icon/components/Lightbulb.d.ts +1 -1
  165. package/dist/components/Icon/components/Line.d.ts +1 -1
  166. package/dist/components/Icon/components/LinkExternal.d.ts +1 -1
  167. package/dist/components/Icon/components/List.d.ts +1 -1
  168. package/dist/components/Icon/components/ListBulleted.d.ts +1 -1
  169. package/dist/components/Icon/components/ListSearch.d.ts +1 -1
  170. package/dist/components/Icon/components/Location.d.ts +1 -1
  171. package/dist/components/Icon/components/Lock.d.ts +1 -1
  172. package/dist/components/Icon/components/LockOpen.d.ts +1 -1
  173. package/dist/components/Icon/components/Log.d.ts +1 -1
  174. package/dist/components/Icon/components/LogOut.d.ts +1 -1
  175. package/dist/components/Icon/components/Market.d.ts +1 -1
  176. package/dist/components/Icon/components/MastercardOs.d.ts +1 -1
  177. package/dist/components/Icon/components/MatchAmount.d.ts +1 -1
  178. package/dist/components/Icon/components/MatchEntries.d.ts +1 -1
  179. package/dist/components/Icon/components/Menu.d.ts +1 -1
  180. package/dist/components/Icon/components/Mileage.d.ts +1 -1
  181. package/dist/components/Icon/components/ModalResize.d.ts +1 -1
  182. package/dist/components/Icon/components/ModalShrink.d.ts +1 -1
  183. package/dist/components/Icon/components/More.d.ts +1 -1
  184. package/dist/components/Icon/components/MoreSolid.d.ts +1 -1
  185. package/dist/components/Icon/components/Move.d.ts +1 -1
  186. package/dist/components/Icon/components/NavigationList.d.ts +1 -1
  187. package/dist/components/Icon/components/Note.d.ts +1 -1
  188. package/dist/components/Icon/components/NoteFollowUp.d.ts +1 -1
  189. package/dist/components/Icon/components/NoteRead.d.ts +1 -1
  190. package/dist/components/Icon/components/NovemberFirst.d.ts +1 -1
  191. package/dist/components/Icon/components/Numbers.d.ts +1 -1
  192. package/dist/components/Icon/components/PartnerApi.d.ts +1 -1
  193. package/dist/components/Icon/components/PaymentPaid.d.ts +1 -1
  194. package/dist/components/Icon/components/PaymentUnpaid.d.ts +1 -1
  195. package/dist/components/Icon/components/Period.d.ts +1 -1
  196. package/dist/components/Icon/components/PersonChange.d.ts +1 -1
  197. package/dist/components/Icon/components/PersonMinus.d.ts +1 -1
  198. package/dist/components/Icon/components/PersonPlus.d.ts +1 -1
  199. package/dist/components/Icon/components/PersonTick.d.ts +1 -1
  200. package/dist/components/Icon/components/Phone.d.ts +1 -1
  201. package/dist/components/Icon/components/PhoneSolid.d.ts +1 -1
  202. package/dist/components/Icon/components/Play.d.ts +1 -1
  203. package/dist/components/Icon/components/PlusMinus.d.ts +1 -1
  204. package/dist/components/Icon/components/Print.d.ts +1 -1
  205. package/dist/components/Icon/components/ProcessPayment.d.ts +1 -1
  206. package/dist/components/Icon/components/ProductLedgerCard.d.ts +1 -1
  207. package/dist/components/Icon/components/Profile.d.ts +1 -1
  208. package/dist/components/Icon/components/ProjectCards.d.ts +1 -1
  209. package/dist/components/Icon/components/Projects.d.ts +1 -1
  210. package/dist/components/Icon/components/QuestionMark.d.ts +1 -1
  211. package/dist/components/Icon/components/QuestionMarkBold.d.ts +1 -1
  212. package/dist/components/Icon/components/Quicklinks.d.ts +1 -1
  213. package/dist/components/Icon/components/RatingBankruptcy.d.ts +1 -1
  214. package/dist/components/Icon/components/RatingPaymentProblems.d.ts +1 -1
  215. package/dist/components/Icon/components/Reconciled.d.ts +1 -1
  216. package/dist/components/Icon/components/Refresh.d.ts +1 -1
  217. package/dist/components/Icon/components/Report.d.ts +1 -1
  218. package/dist/components/Icon/components/ReportSolid.d.ts +1 -1
  219. package/dist/components/Icon/components/Restore.d.ts +1 -1
  220. package/dist/components/Icon/components/RotateLeft.d.ts +1 -1
  221. package/dist/components/Icon/components/RotateRight.d.ts +1 -1
  222. package/dist/components/Icon/components/Sales.d.ts +1 -1
  223. package/dist/components/Icon/components/Search.d.ts +1 -1
  224. package/dist/components/Icon/components/SearchBold.d.ts +1 -1
  225. package/dist/components/Icon/components/Secure.d.ts +1 -1
  226. package/dist/components/Icon/components/SecureTick.d.ts +1 -1
  227. package/dist/components/Icon/components/Settings.d.ts +1 -1
  228. package/dist/components/Icon/components/SettingsSolid.d.ts +1 -1
  229. package/dist/components/Icon/components/Shortcuts.d.ts +1 -1
  230. package/dist/components/Icon/components/ShowAll.d.ts +1 -1
  231. package/dist/components/Icon/components/ShowLess.d.ts +1 -1
  232. package/dist/components/Icon/components/ShowMore.d.ts +1 -1
  233. package/dist/components/Icon/components/ShowTemplate.d.ts +1 -1
  234. package/dist/components/Icon/components/Sliders.d.ts +1 -1
  235. package/dist/components/Icon/components/Smartpay.d.ts +1 -1
  236. package/dist/components/Icon/components/SortBy.d.ts +1 -1
  237. package/dist/components/Icon/components/Star.d.ts +1 -1
  238. package/dist/components/Icon/components/StarSolid.d.ts +1 -1
  239. package/dist/components/Icon/components/Subscriptions.d.ts +1 -1
  240. package/dist/components/Icon/components/SystemEntries.d.ts +1 -1
  241. package/dist/components/Icon/components/Tag.d.ts +1 -1
  242. package/dist/components/Icon/components/TemplateOverride.d.ts +1 -1
  243. package/dist/components/Icon/components/Templates.d.ts +1 -1
  244. package/dist/components/Icon/components/ThumbBoth.d.ts +1 -1
  245. package/dist/components/Icon/components/ThumbDown.d.ts +1 -1
  246. package/dist/components/Icon/components/ThumbDownSolid.d.ts +1 -1
  247. package/dist/components/Icon/components/ThumbUp.d.ts +1 -1
  248. package/dist/components/Icon/components/ThumbUpSolid.d.ts +1 -1
  249. package/dist/components/Icon/components/Tick.d.ts +1 -1
  250. package/dist/components/Icon/components/TickBold.d.ts +1 -1
  251. package/dist/components/Icon/components/Time.d.ts +1 -1
  252. package/dist/components/Icon/components/Transfer.d.ts +1 -1
  253. package/dist/components/Icon/components/TransferCancel.d.ts +1 -1
  254. package/dist/components/Icon/components/TransferLocked.d.ts +1 -1
  255. package/dist/components/Icon/components/Undo.d.ts +1 -1
  256. package/dist/components/Icon/components/Undock.d.ts +1 -1
  257. package/dist/components/Icon/components/Unreconciled.d.ts +1 -1
  258. package/dist/components/Icon/components/Warning.d.ts +1 -1
  259. package/dist/components/Icon/components/Webshop.d.ts +1 -1
  260. package/dist/components/Icon/components/Website.d.ts +1 -1
  261. package/dist/components/Icon/components/Workflow.d.ts +1 -1
  262. package/dist/components/Icon/components/WorkflowTemplateBasic.d.ts +1 -1
  263. package/dist/components/Icon/components/Zoom.d.ts +1 -1
  264. package/dist/components/IconButton/IconButton.d.ts +2 -2
  265. package/dist/components/Input/Input.d.ts +2 -2
  266. package/dist/components/Input/util.d.ts +1 -11
  267. package/dist/components/Layout/components/Sidebar.d.ts +2 -14
  268. package/dist/components/Layout/components/Top.d.ts +2 -2
  269. package/dist/components/List/List.d.ts +7 -7
  270. package/dist/components/List/components/Button.d.ts +1 -1
  271. package/dist/components/List/components/Collapsible.d.ts +1 -1
  272. package/dist/components/List/components/Group.d.ts +1 -1
  273. package/dist/components/List/components/Item.d.ts +1 -1
  274. package/dist/components/List/components/Link.d.ts +1 -1
  275. package/dist/components/List/components/Toggle.d.ts +2 -2
  276. package/dist/components/Listbox/Listbox.d.ts +2 -2
  277. package/dist/components/Listbox/ScrollableList.d.ts +1 -1
  278. package/dist/components/Listbox/util.d.ts +2 -2
  279. package/dist/components/Menu/components/Checkbox.d.ts +1 -1
  280. package/dist/components/Menu/components/Content.d.ts +2 -2
  281. package/dist/components/Menu/components/Item.d.ts +8 -8
  282. package/dist/components/Menu/components/Link.d.ts +1 -1
  283. package/dist/components/Menu/components/RadioGroup.d.ts +1 -1
  284. package/dist/components/Menu/components/SubMenu.d.ts +1 -1
  285. package/dist/components/Menu/components/Trigger.d.ts +1 -1
  286. package/dist/components/Navigation2/components/Group.d.ts +1 -1
  287. package/dist/components/Popover/Popover.d.ts +2 -2
  288. package/dist/components/Provider/Localization.d.ts +2 -0
  289. package/dist/components/RadioGroup/RadioGroup.d.ts +1 -1
  290. package/dist/components/Report/Report.d.ts +1 -1
  291. package/dist/components/ScrollArea/ScrollArea.d.ts +2 -2
  292. package/dist/components/SearchInput/SearchInput.d.ts +1 -1
  293. package/dist/components/Select/Select.d.ts +1 -1
  294. package/dist/components/Select2/components/All.d.ts +2 -2
  295. package/dist/components/Select2/components/Collection.d.ts +1 -1
  296. package/dist/components/Select2/components/Create.d.ts +1 -1
  297. package/dist/components/Select2/components/Edit.d.ts +2 -2
  298. package/dist/components/Select2/components/Group.d.ts +1 -1
  299. package/dist/components/Select2/components/Option.d.ts +1 -1
  300. package/dist/components/Select2/components/Search.d.ts +3 -3
  301. package/dist/components/Select2/components/Trigger.d.ts +1 -1
  302. package/dist/components/Select2/hooks/useChildren.d.ts +2 -2
  303. package/dist/components/Select2/utilities.d.ts +2 -0
  304. package/dist/components/Shortcut/Shortcut.d.ts +1 -1
  305. package/dist/components/Table3/Table3.d.ts +2 -14
  306. package/dist/components/Table3/components/Columns/Cell/Cell.d.ts +2 -2
  307. package/dist/components/Table3/components/Columns/Cell/Editing/RowMoveIndicator.d.ts +1 -1
  308. package/dist/components/Table3/components/Columns/Cell/EditingControlCell.d.ts +2 -2
  309. package/dist/components/Table3/components/Columns/Internal/EditingActionsMenu.d.ts +3 -4
  310. package/dist/components/Table3/components/Editing/Alert.d.ts +1 -1
  311. package/dist/components/Table3/components/Editing/DiscardChangesConfirmationDialog.d.ts +7 -0
  312. package/dist/components/Table3/components/Row/Editing/CreateNewRow.d.ts +13 -0
  313. package/dist/components/Table3/components/Row/Editing/SaveStatus.d.ts +2 -2
  314. package/dist/components/Table3/components/Row/Editing/TemporaryRow.d.ts +12 -0
  315. package/dist/components/Table3/components/Row/Row.d.ts +2 -2
  316. package/dist/components/Table3/components/Toolbar/Editing/Editing.d.ts +1 -1
  317. package/dist/components/Table3/features/useEditingState.d.ts +29 -0
  318. package/dist/components/Table3/features/useTableEditing.d.ts +24 -36
  319. package/dist/components/Table3/types.d.ts +23 -8
  320. package/dist/components/Table3/useTable3.d.ts +6 -0
  321. package/dist/components/Table3/util/editing.d.ts +0 -1
  322. package/dist/components/Tag/Tag.d.ts +2 -2
  323. package/dist/components/Tooltip/Tooltip.d.ts +1 -1
  324. package/dist/components/Tour/Tour.d.ts +3 -3
  325. package/dist/components/Truncate/Truncate.d.ts +1 -1
  326. package/dist/esm/index.css +6 -2
  327. package/dist/esm/node_modules/babel-plugin-transform-async-to-promises/helpers.mjs.js +17 -17
  328. package/dist/esm/node_modules/babel-plugin-transform-async-to-promises/helpers.mjs.js.map +1 -1
  329. package/dist/esm/packages/taco/src/components/Accordion/Accordion.js +6 -14
  330. package/dist/esm/packages/taco/src/components/Accordion/Accordion.js.map +1 -1
  331. package/dist/esm/packages/taco/src/components/Datepicker/useDatepicker.js.map +1 -1
  332. package/dist/esm/packages/taco/src/components/Dialog/Dialog.js.map +1 -1
  333. package/dist/esm/packages/taco/src/components/Dialog/components/Content.js +3 -3
  334. package/dist/esm/packages/taco/src/components/Dialog/components/Content.js.map +1 -1
  335. package/dist/esm/packages/taco/src/components/Dialog/components/DialogDrawer.js.map +1 -1
  336. package/dist/esm/packages/taco/src/components/Header/components/Agreement/Avatar.js.map +1 -1
  337. package/dist/esm/packages/taco/src/components/Header/components/AgreementSelector.js +3 -5
  338. package/dist/esm/packages/taco/src/components/Header/components/AgreementSelector.js.map +1 -1
  339. package/dist/esm/packages/taco/src/components/Input/util.js.map +1 -1
  340. package/dist/esm/packages/taco/src/components/Layout/components/Sidebar.js.map +1 -1
  341. package/dist/esm/packages/taco/src/components/Layout/components/Top.js.map +1 -1
  342. package/dist/esm/packages/taco/src/components/Listbox/util.js +1 -7
  343. package/dist/esm/packages/taco/src/components/Listbox/util.js.map +1 -1
  344. package/dist/esm/packages/taco/src/components/Menu/components/Item.js.map +1 -1
  345. package/dist/esm/packages/taco/src/components/ModeSwitch/ModeSwitch.js +2 -2
  346. package/dist/esm/packages/taco/src/components/ModeSwitch/ModeSwitch.js.map +1 -1
  347. package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js.map +1 -1
  348. package/dist/esm/packages/taco/src/components/Popover/Popover.js.map +1 -1
  349. package/dist/esm/packages/taco/src/components/Provider/Localization.js +5 -3
  350. package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
  351. package/dist/esm/packages/taco/src/components/RadioGroup/RadioGroup.js.map +1 -1
  352. package/dist/esm/packages/taco/src/components/ScrollArea/ScrollArea.js +4 -4
  353. package/dist/esm/packages/taco/src/components/ScrollArea/ScrollArea.js.map +1 -1
  354. package/dist/esm/packages/taco/src/components/Select/Select.js.map +1 -1
  355. package/dist/esm/packages/taco/src/components/Select/useSelect.js.map +1 -1
  356. package/dist/esm/packages/taco/src/components/Select2/Select2.js +29 -5
  357. package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
  358. package/dist/esm/packages/taco/src/components/Select2/components/Create.js +10 -11
  359. package/dist/esm/packages/taco/src/components/Select2/components/Create.js.map +1 -1
  360. package/dist/esm/packages/taco/src/components/Select2/components/Edit.js +2 -0
  361. package/dist/esm/packages/taco/src/components/Select2/components/Edit.js.map +1 -1
  362. package/dist/esm/packages/taco/src/components/Select2/components/Option.js +1 -1
  363. package/dist/esm/packages/taco/src/components/Select2/components/Option.js.map +1 -1
  364. package/dist/esm/packages/taco/src/components/Select2/components/Search.js +1 -1
  365. package/dist/esm/packages/taco/src/components/Select2/components/Search.js.map +1 -1
  366. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js.map +1 -1
  367. package/dist/esm/packages/taco/src/components/Select2/hooks/useChildren.js +1 -10
  368. package/dist/esm/packages/taco/src/components/Select2/hooks/useChildren.js.map +1 -1
  369. package/dist/esm/packages/taco/src/components/Select2/utilities.js +11 -1
  370. package/dist/esm/packages/taco/src/components/Select2/utilities.js.map +1 -1
  371. package/dist/esm/packages/taco/src/components/Switch/Switch.js +1 -1
  372. package/dist/esm/packages/taco/src/components/Switch/Switch.js.map +1 -1
  373. package/dist/esm/packages/taco/src/components/Table/components/WindowedTable.js.map +1 -1
  374. package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowEditing.js.map +1 -1
  375. package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowSelect.js.map +1 -1
  376. package/dist/esm/packages/taco/src/components/Table3/Table3.js +21 -7
  377. package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
  378. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/Editing/RowMoveIndicator.js.map +1 -1
  379. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingControlCell.js +24 -6
  380. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingControlCell.js.map +1 -1
  381. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Internal/EditingActionsMenu.js +5 -36
  382. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Internal/EditingActionsMenu.js.map +1 -1
  383. package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js +17 -12
  384. package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js.map +1 -1
  385. package/dist/esm/packages/taco/src/components/Table3/components/Editing/DiscardChangesConfirmationDialog.js +34 -0
  386. package/dist/esm/packages/taco/src/components/Table3/components/Editing/DiscardChangesConfirmationDialog.js.map +1 -0
  387. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateNewRow.js +88 -0
  388. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateNewRow.js.map +1 -0
  389. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/SaveStatus.js +2 -14
  390. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/SaveStatus.js.map +1 -1
  391. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/TemporaryRow.js +93 -0
  392. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/TemporaryRow.js.map +1 -0
  393. package/dist/esm/packages/taco/src/components/Table3/components/Row/Row.js +5 -7
  394. package/dist/esm/packages/taco/src/components/Table3/components/Row/Row.js.map +1 -1
  395. package/dist/esm/packages/taco/src/components/Table3/components/Toolbar/Editing/Editing.js +7 -2
  396. package/dist/esm/packages/taco/src/components/Table3/components/Toolbar/Editing/Editing.js.map +1 -1
  397. package/dist/esm/packages/taco/src/components/Table3/features/useEditingState.js +514 -0
  398. package/dist/esm/packages/taco/src/components/Table3/features/useEditingState.js.map +1 -0
  399. package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js +16 -406
  400. package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js.map +1 -1
  401. package/dist/esm/packages/taco/src/components/Table3/listeners/useTableEditingListener.js +37 -32
  402. package/dist/esm/packages/taco/src/components/Table3/listeners/useTableEditingListener.js.map +1 -1
  403. package/dist/esm/packages/taco/src/components/Table3/useTable3.js +21 -7
  404. package/dist/esm/packages/taco/src/components/Table3/useTable3.js.map +1 -1
  405. package/dist/esm/packages/taco/src/components/Table3/util/editing.js +3 -28
  406. package/dist/esm/packages/taco/src/components/Table3/util/editing.js.map +1 -1
  407. package/dist/esm/packages/taco/src/components/Toast/Toast.js.map +1 -1
  408. package/dist/esm/packages/taco/src/components/Tour/Tour.js +3 -3
  409. package/dist/esm/packages/taco/src/components/Tour/Tour.js.map +1 -1
  410. package/dist/esm/packages/taco/src/hooks/useGlobalKeyDown.js.map +1 -1
  411. package/dist/esm/packages/taco/src/hooks/useIntersectionObserver.js.map +1 -1
  412. package/dist/esm/packages/taco/src/primitives/Collection/components/Root.js +20 -4
  413. package/dist/esm/packages/taco/src/primitives/Collection/components/Root.js.map +1 -1
  414. package/dist/esm/packages/taco/src/primitives/Listbox2/components/Root.js +1 -0
  415. package/dist/esm/packages/taco/src/primitives/Listbox2/components/Root.js.map +1 -1
  416. package/dist/esm/packages/taco/src/primitives/Sortable/components/Container.js +1 -1
  417. package/dist/esm/packages/taco/src/primitives/Sortable/components/Container.js.map +1 -1
  418. package/dist/esm/packages/taco/src/primitives/Sortable/components/Item.js.map +1 -1
  419. package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js +3 -4
  420. package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js.map +1 -1
  421. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Body/util.js +4 -4
  422. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Body/util.js.map +1 -1
  423. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/BuiltIns/GroupedCell.js +9 -3
  424. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/BuiltIns/GroupedCell.js.map +1 -1
  425. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Actions.js +6 -3
  426. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Actions.js.map +1 -1
  427. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Expansion.js.map +1 -1
  428. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Footer.js +1 -1
  429. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Footer.js.map +1 -1
  430. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/Header.js.map +1 -1
  431. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Goto.js.map +1 -1
  432. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Menu.js +2 -2
  433. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Menu.js.map +1 -1
  434. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Resizer.js.map +1 -1
  435. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/SortIndicator.js.map +1 -1
  436. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/util.js.map +1 -1
  437. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/DisplayRow.js +1 -1
  438. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/DisplayRow.js.map +1 -1
  439. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/Filters.js.map +1 -1
  440. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/ManageFiltersPopover.js.map +1 -1
  441. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterValue.js +1 -3
  442. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterValue.js.map +1 -1
  443. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Print/Print.js.map +1 -1
  444. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Settings/HideOrOrderPopover.js.map +1 -1
  445. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Settings/Settings.js.map +1 -1
  446. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js +1 -1
  447. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js.map +1 -1
  448. package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -1
  449. package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js.map +1 -1
  450. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSettings.js.map +1 -1
  451. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSettingsListener.js.map +1 -1
  452. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableShortcutsListener.js.map +1 -1
  453. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js +1 -1
  454. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js.map +1 -1
  455. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/search.js.map +1 -1
  456. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/settings.js.map +1 -1
  457. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js +11 -0
  458. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js.map +1 -1
  459. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/sorting.js.map +1 -1
  460. package/dist/esm/packages/taco/src/utils/dom.js +7 -4
  461. package/dist/esm/packages/taco/src/utils/dom.js.map +1 -1
  462. package/dist/index.css +6 -2
  463. package/dist/primitives/BubbleSelect.d.ts +1 -1
  464. package/dist/primitives/Collection/components/Root.d.ts +3 -1
  465. package/dist/primitives/Sortable/components/Container.d.ts +2 -2
  466. package/dist/primitives/Sortable/components/Item.d.ts +1 -2
  467. package/dist/primitives/Sortable/components/List.d.ts +1 -1
  468. package/dist/primitives/Table/Core/Table.d.ts +3 -2
  469. package/dist/primitives/Table/Core/components/Body/Body.d.ts +1 -1
  470. package/dist/primitives/Table/Core/components/Body/EmptyStateBody.d.ts +1 -1
  471. package/dist/primitives/Table/Core/components/Columns/Cell/BuiltIns/DisplayCell.d.ts +2 -2
  472. package/dist/primitives/Table/Core/components/Columns/Cell/BuiltIns/GroupedCell.d.ts +2 -2
  473. package/dist/primitives/Table/Core/components/Columns/Cell/Cell.d.ts +1 -1
  474. package/dist/primitives/Table/Core/components/Columns/Internal/Actions.d.ts +5 -3
  475. package/dist/primitives/Table/Core/components/Footer/Footer.d.ts +3 -3
  476. package/dist/primitives/Table/Core/components/Footer/Summary.d.ts +2 -2
  477. package/dist/primitives/Table/Core/components/Header/Header.d.ts +1 -1
  478. package/dist/primitives/Table/Core/components/Header/components/Goto.d.ts +2 -2
  479. package/dist/primitives/Table/Core/components/Header/components/Menu.d.ts +1 -1
  480. package/dist/primitives/Table/Core/components/Header/components/Resizer.d.ts +2 -2
  481. package/dist/primitives/Table/Core/components/Header/components/SortIndicator.d.ts +3 -3
  482. package/dist/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.d.ts +2 -2
  483. package/dist/primitives/Table/Core/components/Row/Row.d.ts +1 -1
  484. package/dist/primitives/Table/Core/components/Toolbar/Toolbar.d.ts +1 -1
  485. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/Filters.d.ts +2 -2
  486. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/ManageFiltersPopover.d.ts +2 -2
  487. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/components/Filter.d.ts +2 -2
  488. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterColumn.d.ts +1 -1
  489. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterComparator.d.ts +2 -2
  490. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterValue.d.ts +2 -2
  491. package/dist/primitives/Table/Core/components/Toolbar/components/Print/Print.d.ts +1 -1
  492. package/dist/primitives/Table/Core/components/Toolbar/components/Print/PrintDialog.d.ts +2 -2
  493. package/dist/primitives/Table/Core/components/Toolbar/components/Search/Search.d.ts +1 -1
  494. package/dist/primitives/Table/Core/components/Toolbar/components/Settings/HideOrOrderPopover.d.ts +2 -2
  495. package/dist/primitives/Table/Core/components/Toolbar/components/Settings/Settings.d.ts +2 -2
  496. package/dist/primitives/Table/types.d.ts +1 -1
  497. package/dist/primitives/Table/useTableManager/useTableManager.d.ts +1 -1
  498. package/dist/primitives/Table/useTableManager/util/settings.d.ts +1 -1
  499. package/dist/taco.cjs.development.js +960 -694
  500. package/dist/taco.cjs.development.js.map +1 -1
  501. package/dist/taco.cjs.production.min.js +1 -1
  502. package/dist/taco.cjs.production.min.js.map +1 -1
  503. package/dist/utils/dom.d.ts +2 -1
  504. package/package.json +11 -11
  505. package/dist/components/Table3/components/Row/Editing/CreateRowButton.d.ts +0 -11
  506. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateRowButton.js +0 -90
  507. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateRowButton.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"useTableEditingListener.js","sources":["../../../../../../../../src/components/Table3/listeners/useTableEditingListener.ts"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { useLazyEffect } from '../../../hooks/useLazyEffect';\nimport { isElementInsideOrTriggeredFromContainer } from '../../../utils/dom';\nimport { TableRef } from '../../../primitives/Table/types';\nimport { resetHighlightedColumnIndexes } from '../../../primitives/Table/useTableManager/util/search';\nimport { useLocalization } from '../../Provider/Localization';\n\nexport function useTableEditingListener<TType = unknown>(table: ReactTable<TType>, tableRef: React.RefObject<TableRef>) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const completedRowsCount = tableMeta.editing.getCompletedRowsCount();\n const localization = useLocalization();\n\n const saveChanges = () => {\n requestAnimationFrame(() => {\n tableMeta.editing.saveChanges();\n });\n };\n\n // save when the row changes\n useLazyEffect(() => {\n if (tableMeta.editing.isEditing) {\n saveChanges();\n }\n }, [tableMeta.rowActive.rowActiveIndex]);\n\n useLazyEffect(() => {\n if (tableMeta.editing.isEditing) {\n if (tableMeta.rowActive.rowActiveIndex === undefined) {\n tableMeta.rowActive.setRowActiveIndex(0);\n }\n } else {\n // save\n saveChanges();\n // reset detailed mode\n tableMeta.editing.toggleDetailedMode(false);\n // reset the last index back to the first focusable element, when editing gets turned off\n tableMeta.editing.setLastFocusedCellIndex(undefined);\n }\n }, [tableMeta.editing.isEditing]);\n\n // show a warning if the user navigates away without triggering save, such as using the browser back/forward button\n const hasChanges = tableMeta.editing.hasChanges();\n\n React.useEffect(() => {\n function showUnsavedChangesWarning(event: BeforeUnloadEvent) {\n if (tableMeta.editing.isEditing && hasChanges) {\n event.returnValue = true;\n return true;\n }\n\n return false;\n }\n\n window.addEventListener('beforeunload', showUnsavedChangesWarning);\n\n return () => {\n window.removeEventListener('beforeunload', showUnsavedChangesWarning);\n };\n }, [tableMeta.editing.isEditing, hasChanges]);\n\n React.useEffect(() => {\n if (completedRowsCount > 0) {\n resetHighlightedColumnIndexes(table.getState().globalFilter, table, localization);\n }\n }, [completedRowsCount]);\n\n React.useEffect(() => {\n const onClickOutside = (event: MouseEvent) => {\n if (tableMeta.editing.isEditing) {\n const element = (event.target as Element)?.getAttribute('data-taco') ?? '';\n\n const insideTable =\n isElementInsideOrTriggeredFromContainer(event.target as Element, tableRef.current) || element === 'backdrop';\n\n if (!insideTable) {\n saveChanges();\n }\n }\n };\n\n document.addEventListener('click', onClickOutside);\n\n return () => document.removeEventListener('click', onClickOutside);\n }, [saveChanges, tableMeta.editing.isEditing]);\n}\n"],"names":["useTableEditingListener","table","tableRef","tableMeta","options","meta","completedRowsCount","editing","getCompletedRowsCount","localization","useLocalization","saveChanges","requestAnimationFrame","useLazyEffect","isEditing","rowActive","rowActiveIndex","undefined","setRowActiveIndex","toggleDetailedMode","setLastFocusedCellIndex","hasChanges","React","useEffect","showUnsavedChangesWarning","event","returnValue","window","addEventListener","removeEventListener","resetHighlightedColumnIndexes","getState","globalFilter","onClickOutside","_event$target$getAttr","_event$target","element","target","getAttribute","insideTable","isElementInsideOrTriggeredFromContainer","current","document"],"mappings":";;;;;;SAQgBA,uBAAuBA,CAAkBC,KAAwB,EAAEC,QAAmC;EAClH,MAAMC,SAAS,GAAGF,KAAK,CAACG,OAAO,CAACC,IAA6B;EAC7D,MAAMC,kBAAkB,GAAGH,SAAS,CAACI,OAAO,CAACC,qBAAqB,EAAE;EACpE,MAAMC,YAAY,GAAGC,eAAe,EAAE;EAEtC,MAAMC,WAAW,GAAGA;IAChBC,qBAAqB,CAAC;MAClBT,SAAS,CAACI,OAAO,CAACI,WAAW,EAAE;KAClC,CAAC;GACL;;EAGDE,aAAa,CAAC;IACV,IAAIV,SAAS,CAACI,OAAO,CAACO,SAAS,EAAE;MAC7BH,WAAW,EAAE;;GAEpB,EAAE,CAACR,SAAS,CAACY,SAAS,CAACC,cAAc,CAAC,CAAC;EAEx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oB,qBAAA,EAAAC,aAAA;QAC7B,MAAMC,OAAO,IAAAF,qBAAA,IAAAC,aAAA,GAAIV,KAAK,CAACY,MAAkB,cAAAF,aAAA,uBAAxBA,aAAA,CAA0BG,YAAY,CAAC,WAAW,CAAC,cAAAJ,qBAAA,cAAAA,qBAAA,GAAI,EAAE;QAE1E,MAAMK,WAAW,GACbC,uCAAuC,CAACf,KAAK,CAACY,MAAiB,EAAEnC,QAAQ,CAACuC,OAAO,CAAC,IAAIL,OAAO,KAAK,UAAU;QAEhH,IAAI,CAACG,WAAW,EAAE;UACd5B,WAAW,EAAE;;;KAGxB;IAED+B,QAAQ,CAACd,gBAAgB,CAAC,OAAO,EAAEK,cAAc,CAAC;IAElD,OAAO,MAAMS,QAAQ,CAACb,mBAAmB,CAAC,OAAO,EAAEI,cAAc,CAAC;GACrE,EAAE,CAACtB,WAAW,EAAER,SAAS,CAACI,OAAO,CAACO,SAAS,CAAC,CAAC;AAClD;;;;"}
1
+ {"version":3,"file":"useTableEditingListener.js","sources":["../../../../../../../../src/components/Table3/listeners/useTableEditingListener.ts"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { useLazyEffect } from '../../../hooks/useLazyEffect';\nimport { isElementInsideOrTriggeredFromContainer } from '../../../utils/dom';\nimport { TableRef } from '../../../primitives/Table/types';\nimport { resetHighlightedColumnIndexes } from '../../../primitives/Table/useTableManager/util/search';\nimport { useLocalization } from '../../Provider/Localization';\nimport { useGlobalKeyDown } from '../../../hooks/useGlobalKeyDown';\n\nexport function useTableEditingListener<TType = unknown>(table: ReactTable<TType>, tableRef: React.RefObject<TableRef>) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const localization = useLocalization();\n\n // save when the row changes\n // store the last row active index, otherwise everytime tableMeta.editing.saveChanges changes the hook runs again\n const lastRowActiveIndexRef = React.useRef<number | undefined>(tableMeta.rowActive.rowActiveIndex);\n\n useLazyEffect(() => {\n if (tableMeta.editing.isEditing && tableMeta.rowActive.rowActiveIndex !== lastRowActiveIndexRef.current) {\n lastRowActiveIndexRef.current = tableMeta.rowActive.rowActiveIndex;\n tableMeta.editing.saveChanges(table);\n }\n }, [tableMeta.rowActive.rowActiveIndex, tableMeta.editing.saveChanges]);\n\n // show a warning if the user navigates away without triggering save, such as using the browser back/forward button\n const hasChanges = tableMeta.editing.hasChanges();\n\n React.useEffect(() => {\n function showUnsavedChangesWarning(event: BeforeUnloadEvent) {\n if (tableMeta.editing.isEditing && hasChanges) {\n event.returnValue = true;\n return true;\n }\n\n return false;\n }\n\n window.addEventListener('beforeunload', showUnsavedChangesWarning);\n\n return () => {\n window.removeEventListener('beforeunload', showUnsavedChangesWarning);\n };\n }, [tableMeta.editing.isEditing, hasChanges]);\n\n const hasSavedChanges = tableMeta.editing.hasSaved();\n\n useLazyEffect(() => {\n if (hasSavedChanges) {\n resetHighlightedColumnIndexes(table.getState().globalFilter, table, localization);\n }\n }, [hasSavedChanges]);\n\n React.useEffect(() => {\n const onClickOutside = (event: MouseEvent) => {\n if (tableMeta.editing.isEditing) {\n const element = event.target as Element;\n const insideTable =\n element.getAttribute('data-taco') === 'backdrop' ||\n element.getAttribute('data-table') === 'editing-toggle' ||\n isElementInsideOrTriggeredFromContainer(element, tableRef.current);\n\n // users can click the white space below rows which could be inside the table, but a valid scenario to save\n if (!insideTable || element.tagName === 'TABLE' || element.tagName === 'TBODY') {\n tableMeta.editing.saveChanges(table);\n }\n }\n };\n\n document.addEventListener('click', onClickOutside);\n\n return () => document.removeEventListener('click', onClickOutside);\n }, [tableMeta.editing.isEditing, tableMeta.editing.saveChanges]);\n\n const rows = table.getRowModel().rows;\n\n // make sure pending changes are removed for rows that no longer exist\n useLazyEffect(() => {\n const pendingChanges = tableMeta.editing.getErrorsShownInAlert();\n\n pendingChanges.forEach(pendingChange => {\n try {\n table.getRow(pendingChange.rowId);\n } catch {\n tableMeta.editing.discardChanges(pendingChange.rowId, table);\n }\n });\n }, [rows.length]);\n\n useGlobalKeyDown(tableMeta.editing.isEditing ? { key: 's', meta: true, shift: false } : undefined, event => {\n event.preventDefault();\n tableMeta.editing.saveChanges(table);\n });\n}\n"],"names":["useTableEditingListener","table","tableRef","tableMeta","options","meta","localization","useLocalization","lastRowActiveIndexRef","React","useRef","rowActive","rowActiveIndex","useLazyEffect","editing","isEditing","current","saveChanges","hasChanges","useEffect","showUnsavedChangesWarning","event","returnValue","window","addEventListener","removeEventListener","hasSavedChanges","hasSaved","resetHighlightedColumnIndexes","getState","globalFilter","onClickOutside","element","target","insideTable","getAttribute","isElementInsideOrTriggeredFromContainer","tagName","document","rows","getRowModel","pendingChanges","getErrorsShownInAlert","forEach","pendingChange","getRow","rowId","discardChanges","length","useGlobalKeyDown","key","shift","undefined","preventDefault"],"mappings":";;;;;;;SASgBA,uBAAuBA,CAAkBC,KAAwB,EAAEC,QAAmC;EAClH,MAAMC,SAAS,GAAGF,KAAK,CAACG,OAAO,CAACC,IAA6B;EAC7D,MAAMC,YAAY,GAAGC,eAAe,EAAE;;;EAItC,MAAMC,qBAAqB,GAAGC,cAAK,CAACC,MAAM,CAAqBP,SAAS,CAACQ,SAAS,CAACC,cAAc,CAAC;EAElGC,aAAa,CAAC;IACV,IAAIV,SAAS,CAACW,OAAO,CAACC,SAAS,IAAIZ,SAAS,CAACQ,SAAS,CAACC,cAAc,KAAKJ,qBAAqB,CAACQ,OAAO,EAAE;MACrGR,qBAAqB,CAACQ,OAAO,GAAGb,SAAS,CAACQ,SAAS,CAACC,cAAc;MAClET,SAAS,CAACW,OAAO,CAACG,WAAW,CAAChB,KAAK,CAAC;;GAE3C,EAAE,CAACE,SAAS,CAACQ,SAAS,CAACC,cAAc,EAAET,SAAS,CAACW,OAAO,CAACG,WAAW,CAAC,CAAC;;EAGvE,MAAMC,UAAU,GAAGf,SAAS,CAACW,OAAO,CAACI,UAAU,EAAE;EAEjDT,cAAK,CAACU,SAAS,CAAC;IACZ,SAASC,yBAAyBA,CAACC,K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,CAACb,mBAAmB,CAAC,OAAO,EAAEM,cAAc,CAAC;GACrE,EAAE,CAAC5B,SAAS,CAACW,OAAO,CAACC,SAAS,EAAEZ,SAAS,CAACW,OAAO,CAACG,WAAW,CAAC,CAAC;EAEhE,MAAMsB,IAAI,GAAGtC,KAAK,CAACuC,WAAW,EAAE,CAACD,IAAI;;EAGrC1B,aAAa,CAAC;IACV,MAAM4B,cAAc,GAAGtC,SAAS,CAACW,OAAO,CAAC4B,qBAAqB,EAAE;IAEhED,cAAc,CAACE,OAAO,CAACC,aAAa;MAChC,IAAI;QACA3C,KAAK,CAAC4C,MAAM,CAACD,aAAa,CAACE,KAAK,CAAC;OACpC,CAAC,MAAM;QACJ3C,SAAS,CAACW,OAAO,CAACiC,cAAc,CAACH,aAAa,CAACE,KAAK,EAAE7C,KAAK,CAAC;;KAEnE,CAAC;GACL,EAAE,CAACsC,IAAI,CAACS,MAAM,CAAC,CAAC;EAEjBC,gBAAgB,CAAC9C,SAAS,CAACW,OAAO,CAACC,SAAS,GAAG;IAAEmC,GAAG,EAAE,GAAG;IAAE7C,IAAI,EAAE,IAAI;IAAE8C,KAAK,EAAE;GAAO,GAAGC,SAAS,EAAE/B,KAAK;IACpGA,KAAK,CAACgC,cAAc,EAAE;IACtBlD,SAAS,CAACW,OAAO,CAACG,WAAW,CAAChB,KAAK,CAAC;GACvC,CAAC;AACN;;;;"}
@@ -11,17 +11,31 @@ const RENDERERS = {
11
11
  cell: Cell
12
12
  };
13
13
  function useTable3(props, ref) {
14
- const editing = useTableEditing(props.enableEditing, props.onEditingSave, props.onEditingChange, props.validator);
14
+ const editing = useTableEditing(props.enableEditing, props.onEditingSave, props.onEditingChange, props.rowIdentityAccessor, props.validator);
15
15
  const creationEnabled = editing.isEnabled && !!props.onEditingCreate;
16
+ // this gives me the performance heeby jeebies, but can't think of a better way to internalise the state
17
+ const data = React__default.useMemo(() => {
18
+ if (editing.isEditing && editing.temporaryRows.length) {
19
+ var _props$data;
20
+ return editing.temporaryRows.concat((_props$data = props.data) !== null && _props$data !== void 0 ? _props$data : []);
21
+ }
22
+ return props.data;
23
+ }, [JSON.stringify(props.data), editing.temporaryRows.length]);
16
24
  const extendedProps = {
17
25
  ...props,
26
+ data,
18
27
  enableRowActions: editing.isEditing ? true : props.enableRowActions,
19
- rowActions: editing.isEditing ? [(_, rowId) => (/*#__PURE__*/React__default.createElement(EditingActionMenu, {
28
+ rowActions: editing.isEditing ? [(_, rowId, table) => (/*#__PURE__*/React__default.createElement(EditingActionMenu, {
20
29
  hasChanges: editing.hasChanges(rowId),
21
30
  hasErrors: editing.hasRowErrors(rowId),
22
- onClear: () => editing.resetChanges(rowId),
23
- onEditingSave: () => editing.saveChanges(rowId),
24
- onExit: () => editing.toggleEditing(false),
31
+ onDiscard: () => editing.discardChanges(rowId, table),
32
+ onEditingSave: function () {
33
+ try {
34
+ return Promise.resolve(editing.saveChanges(table, rowId)).then(function () {});
35
+ } catch (e) {
36
+ return Promise.reject(e);
37
+ }
38
+ },
25
39
  isLastRow: !creationEnabled && table.meta.rowActive.rowActiveIndex === table.meta.length - 1
26
40
  }))] : props.rowActions
27
41
  };
@@ -33,11 +47,11 @@ function useTable3(props, ref) {
33
47
  useTableEditingListener(table.instance, table.ref);
34
48
  React__default.useEffect(() => {
35
49
  if (table.ref.current) {
36
- table.ref.current.instance.toggleEditing = enabled => table.meta.editing.toggleEditing(enabled !== null && enabled !== void 0 ? enabled : editing => !editing);
50
+ table.ref.current.instance.toggleEditing = enabled => table.meta.editing.toggleEditing(enabled !== null && enabled !== void 0 ? enabled : editing => !editing, table.instance);
37
51
  }
38
52
  }, [table.ref.current]);
39
53
  return table;
40
54
  }
41
55
 
42
- export { useTable3 };
56
+ export { RENDERERS, useTable3 };
43
57
  //# sourceMappingURL=useTable3.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useTable3.js","sources":["../../../../../../../src/components/Table3/useTable3.tsx"],"sourcesContent":["import React from 'react';\nimport { RowData } from '@tanstack/react-table';\nimport { useTable } from '../../primitives/Table/Core/useTable';\nimport { useTableEditingListener } from './listeners/useTableEditingListener';\nimport { useTableEditing } from './features/useTableEditing';\nimport { Table3Props, Table3Ref } from './types';\nimport { TableRowActionRenderer } from '../../primitives/Table/types';\nimport { Cell } from './components/Columns/Cell/Cell';\nimport { EditingActionMenu } from './components/Columns/Internal/EditingActionsMenu';\nimport { Row } from './components/Row/Row';\n\nconst RENDERERS = {\n row: Row,\n cell: Cell,\n};\n\ndeclare module '@tanstack/table-core' {\n interface TableMeta<TData extends RowData> {\n editing: ReturnType<typeof useTableEditing>;\n }\n}\n\ntype Table3Meta = {\n editing: ReturnType<typeof useTableEditing>;\n};\n\nexport function useTable3<TType>(props: Table3Props<TType>, ref: React.Ref<Table3Ref>) {\n const editing = useTableEditing(props.enableEditing, props.onEditingSave, props.onEditingChange, props.validator);\n const creationEnabled = editing.isEnabled && !!props.onEditingCreate;\n\n const extendedProps: Table3Props<TType> = {\n ...props,\n enableRowActions: editing.isEditing ? true : props.enableRowActions,\n rowActions: editing.isEditing\n ? ([\n (_, rowId) => (\n <EditingActionMenu\n hasChanges={editing.hasChanges(rowId)}\n hasErrors={editing.hasRowErrors(rowId)}\n onClear={() => editing.resetChanges(rowId)}\n onEditingSave={() => editing.saveChanges(rowId)}\n onExit={() => editing.toggleEditing(false)}\n isLastRow={!creationEnabled && table.meta.rowActive.rowActiveIndex === table.meta.length - 1}\n />\n ),\n ] as TableRowActionRenderer<TType>[])\n : props.rowActions,\n };\n const meta = { editing };\n const table = useTable<TType, Table3Meta>(extendedProps, ref, RENDERERS, meta);\n\n // listeners\n useTableEditingListener<TType>(table.instance, table.ref);\n\n React.useEffect(() => {\n if (table.ref.current) {\n (table.ref.current as Table3Ref).instance.toggleEditing = (enabled: boolean | undefined) =>\n table.meta.editing.toggleEditing(enabled ?? (editing => !editing));\n }\n }, [table.ref.current]);\n\n return table;\n}\n"],"names":["RENDERERS","row","Row","cell","Cell","useTable3","props","ref","editing","useTableEditing","enableEditing","onEditingSave","onEditingChange","validator","creationEnabled","isEnabled","onEditingCreate","extendedProps","enableRowActions","isEditing","rowActions","_","rowId","React","EditingActionMenu","hasChanges","hasErrors","hasRowErrors","onClear","resetChanges","saveChanges","onExit","toggleEditing","isLastRow","table","meta","rowActive","rowActiveIndex","length","useTable","useTableEditingListener","instance","useEffect","current","enabled"],"mappings":";;;;;;;;AAWA,MAAMA,SAAS,GAAG;EACdC,GAAG,EAAEC,GAAG;EACRC,IAAI,EAAEC;CACT;SAYeC,SAASA,CAAQC,KAAyB,EAAEC,GAAyB;EACjF,MAAMC,OAAO,GAAGC,eAAe,CAACH,KAAK,CAACI,aAAa,EAAEJ,KAAK,CAACK,aAAa,EAAEL,KAAK,CAACM,eAAe,EAAEN,KAAK,CAACO,SAAS,CAAC;EACjH,MAAMC,eAAe,GAAGN,OAAO,CAACO,SAAS,IAAI,CAAC,CAACT,KAAK,CAACU,eAAe;EAEpE,MAAMC,aAAa,GAAuB;IACtC,GAAGX,KAAK;IACRY,gBAAgB,EAAEV,OAAO,CAACW,SAAS,GAAG,IAAI,GAAGb,KAAK,CAACY,gBAAgB;IACnEE,UAAU,EAAEZ,OAAO,CAACW,SAAS,GACtB,CACG,CAACE,CAAC,EAAEC,KAAK,mBACLC,6BAACC,iBAAiB;MACdC,UAAU,EAAEjB,OAAO,CAACiB,UAAU,CAACH,KAAK,CAAC;MACrCI,SAAS,EAAElB,OAAO,CAACmB,YAAY,CAACL,KAAK,CAAC;MACtCM,OAAO,EAAEA,MAAMpB,OAAO,CAACqB,YAAY,CAACP,KAAK,CAAC;MAC1CX,aAAa,EAAEA,MAAMH,OAAO,CAACsB,WAAW,CAACR,KAAK,CAAC;MAC/CS,MAAM,EAAEA,MAAMvB,OAAO,CAACwB,aAAa,CAAC,KAAK,CAAC;MAC1CC,SAAS,EAAE,CAACnB,eAAe,IAAIoB,KAAK,CAACC,IAAI,CAACC,SAAS,CAACC,cAAc,KAAKH,KAAK,CAACC,IAAI,CAACG,MAAM,GAAG;MAC7F,CACL,CACgC,GACrChC,KAAK,CAACc;GACf;EACD,MAAMe,IAAI,GAAG;IAAE3B;GAAS;EACxB,MAAM0B,KAAK,GAAGK,QAAQ,CAAoBtB,aAAa,EAAEV,GAAG,EAAEP,SAAS,EAAEmC,IAAI,CAAC;;EAG9EK,uBAAuB,CAAQN,KAAK,CAACO,QAAQ,EAAEP,KAAK,CAAC3B,GAAG,CAAC;EAEzDgB,cAAK,CAACmB,SAAS,CAAC;IACZ,IAAIR,KAAK,CAAC3B,GAAG,CAACoC,OAAO,EAAE;MAClBT,KAAK,CAAC3B,GAAG,CAACoC,OAAqB,CAACF,QAAQ,CAACT,aAAa,GAAIY,OAA4B,IACnFV,KAAK,CAACC,IAAI,CAAC3B,OAAO,CAACwB,aAAa,CAACY,OAAO,aAAPA,OAAO,cAAPA,OAAO,GAAKpC,OAAO,IAAI,CAACA,OAAQ,CAAC;;GAE7E,EAAE,CAAC0B,KAAK,CAAC3B,GAAG,CAACoC,OAAO,CAAC,CAAC;EAEvB,OAAOT,KAAK;AAChB;;;;"}
1
+ {"version":3,"file":"useTable3.js","sources":["../../../../../../../src/components/Table3/useTable3.tsx"],"sourcesContent":["import React from 'react';\nimport { RowData } from '@tanstack/react-table';\nimport { useTable } from '../../primitives/Table/Core/useTable';\nimport { useTableEditingListener } from './listeners/useTableEditingListener';\nimport { useTableEditing } from './features/useTableEditing';\nimport { Table3Props, Table3Ref } from './types';\nimport { TableRowActionRenderer } from '../../primitives/Table/types';\nimport { Cell } from './components/Columns/Cell/Cell';\nimport { EditingActionMenu } from './components/Columns/Internal/EditingActionsMenu';\nimport { Row } from './components/Row/Row';\n\nexport const RENDERERS = {\n row: Row,\n cell: Cell,\n};\n\ndeclare module '@tanstack/table-core' {\n interface TableMeta<TData extends RowData> {\n editing: ReturnType<typeof useTableEditing>;\n }\n}\n\ntype Table3Meta = {\n editing: ReturnType<typeof useTableEditing>;\n};\n\nexport function useTable3<TType>(props: Table3Props<TType>, ref: React.Ref<Table3Ref>) {\n const editing = useTableEditing(\n props.enableEditing,\n props.onEditingSave,\n props.onEditingChange,\n props.rowIdentityAccessor,\n props.validator\n );\n const creationEnabled = editing.isEnabled && !!props.onEditingCreate;\n\n // this gives me the performance heeby jeebies, but can't think of a better way to internalise the state\n const data: TType[] = React.useMemo(() => {\n if (editing.isEditing && editing.temporaryRows.length) {\n return editing.temporaryRows.concat(props.data ?? []) as TType[];\n }\n\n return props.data;\n }, [JSON.stringify(props.data), editing.temporaryRows.length]);\n\n const extendedProps: Table3Props<TType> = {\n ...props,\n data,\n enableRowActions: editing.isEditing ? true : props.enableRowActions,\n rowActions: editing.isEditing\n ? ([\n (_, rowId, table) => (\n <EditingActionMenu\n hasChanges={editing.hasChanges(rowId)}\n hasErrors={editing.hasRowErrors(rowId)}\n onDiscard={() => editing.discardChanges(rowId, table)}\n onEditingSave={async () => {\n await editing.saveChanges(table, rowId);\n }}\n isLastRow={!creationEnabled && table.meta.rowActive.rowActiveIndex === table.meta.length - 1}\n />\n ),\n ] as TableRowActionRenderer<TType>[])\n : props.rowActions,\n };\n const meta = { editing };\n const table = useTable<TType, Table3Meta>(extendedProps, ref, RENDERERS, meta);\n\n // listeners\n useTableEditingListener<TType>(table.instance, table.ref);\n\n React.useEffect(() => {\n if (table.ref.current) {\n (table.ref.current as Table3Ref).instance.toggleEditing = (enabled: boolean | undefined) =>\n table.meta.editing.toggleEditing(enabled ?? (editing => !editing), table.instance);\n }\n }, [table.ref.current]);\n\n return table;\n}\n"],"names":["RENDERERS","row","Row","cell","Cell","useTable3","props","ref","editing","useTableEditing","enableEditing","onEditingSave","onEditingChange","rowIdentityAccessor","validator","creationEnabled","isEnabled","onEditingCreate","data","React","useMemo","isEditing","temporaryRows","length","_props$data","concat","JSON","stringify","extendedProps","enableRowActions","rowActions","_","rowId","table","EditingActionMenu","hasChanges","hasErrors","hasRowErrors","onDiscard","discardChanges","saveChanges","then","e","Promise","reject","isLastRow","meta","rowActive","rowActiveIndex","useTable","useTableEditingListener","instance","useEffect","current","toggleEditing","enabled"],"mappings":";;;;;;;;MAWaA,SAAS,GAAG;EACrBC,GAAG,EAAEC,GAAG;EACRC,IAAI,EAAEC;;SAaMC,SAASA,CAAQC,KAAyB,EAAEC,GAAyB;EACjF,MAAMC,OAAO,GAAGC,eAAe,CAC3BH,KAAK,CAACI,aAAa,EACnBJ,KAAK,CAACK,aAAa,EACnBL,KAAK,CAACM,eAAe,EACrBN,KAAK,CAACO,mBAAmB,EACzBP,KAAK,CAACQ,SAAS,CAClB;EACD,MAAMC,eAAe,GAAGP,OAAO,CAACQ,SAAS,IAAI,CAAC,CAACV,KAAK,CAACW,eAAe;;EAGpE,MAAMC,IAAI,GAAYC,cAAK,CAACC,OAAO,CAAC;IAChC,IAAIZ,OAAO,CAACa,SAAS,IAAIb,OAAO,CAACc,aAAa,CAACC,MAAM,EAAE;MAAA,IAAAC,WAAA;MACnD,OAAOhB,OAAO,CAACc,aAAa,CAACG,MAAM,EAAAD,WAAA,GAAClB,KAAK,CAACY,IAAI,cAAAM,WAAA,cAAAA,WAAA,GAAI,EAAE,CAAY;;IAGpE,OAAOlB,KAAK,CAACY,IAAI;GACpB,EAAE,CAACQ,IAAI,CAACC,SAAS,CAACrB,KAAK,CAACY,IAAI,CAAC,EAAEV,OAAO,CAACc,aAAa,CAACC,MAAM,CAAC,CAAC;EAE9D,MAAMK,aAAa,GAAuB;IACtC,GAAGtB,KAAK;IACRY,IAAI;IACJW,gBAAgB,EAAErB,OAAO,CAACa,SAAS,GAAG,IAAI,GAAGf,KAAK,CAACuB,gBAAgB;IACnEC,UAAU,EAAEtB,OAAO,CAACa,SAAS,GACtB,CACG,CAACU,CAAC,EAAEC,KAAK,EAAEC,KAAK,mBACZd,6BAACe,iBAAiB;MACdC,UAAU,EAAE3B,OAAO,CAAC2B,UAAU,CAACH,KAAK,CAAC;MACrCI,SAAS,EAAE5B,OAAO,CAAC6B,YAAY,CAACL,KAAK,CAAC;MACtCM,SAAS,EAAEA,MAAM9B,OAAO,CAAC+B,cAAc,CAACP,KAAK,EAAEC,KAAK,CAAC;MACrDtB,aAAa;QAAA;iCACHH,OAAO,CAACgC,WAAW,CAACP,KAAK,EAAED,KAAK,CAAC,EAAAS,IAAA;SAC1C,QAAAC,CAAA;UAAA,OAAAC,OAAA,CAAAC,MAAA,CAAAF,CAAA;;;MACDG,SAAS,EAAE,CAAC9B,eAAe,IAAIkB,KAAK,CAACa,IAAI,CAACC,SAAS,CAACC,cAAc,KAAKf,KAAK,CAACa,IAAI,CAACvB,MAAM,GAAG;MAC7F,CACL,CACgC,GACrCjB,KAAK,CAACwB;GACf;EACD,MAAMgB,IAAI,GAAG;IAAEtC;GAAS;EACxB,MAAMyB,KAAK,GAAGgB,QAAQ,CAAoBrB,aAAa,EAAErB,GAAG,EAAEP,SAAS,EAAE8C,IAAI,CAAC;;EAG9EI,uBAAuB,CAAQjB,KAAK,CAACkB,QAAQ,EAAElB,KAAK,CAAC1B,GAAG,CAAC;EAEzDY,cAAK,CAACiC,SAAS,CAAC;IACZ,IAAInB,KAAK,CAAC1B,GAAG,CAAC8C,OAAO,EAAE;MAClBpB,KAAK,CAAC1B,GAAG,CAAC8C,OAAqB,CAACF,QAAQ,CAACG,aAAa,GAAIC,OAA4B,IACnFtB,KAAK,CAACa,IAAI,CAACtC,OAAO,CAAC8C,aAAa,CAACC,OAAO,aAAPA,OAAO,cAAPA,OAAO,GAAK/C,OAAO,IAAI,CAACA,OAAO,EAAGyB,KAAK,CAACkB,QAAQ,CAAC;;GAE7F,EAAE,CAAClB,KAAK,CAAC1B,GAAG,CAAC8C,OAAO,CAAC,CAAC;EAEvB,OAAOpB,KAAK;AAChB;;;;"}
@@ -1,4 +1,3 @@
1
- import { setDataFocusAttribute } from '../../../utils/dom.js';
2
1
  import { columnFilterFn } from '../../../primitives/Table/useTableManager/util/filtering.js';
3
2
  import { globalFilterFn } from '../../../primitives/Table/useTableManager/util/search.js';
4
3
 
@@ -60,7 +59,7 @@ function willRowMoveAfterSorting(cell, change, rowIndex) {
60
59
  if (rowIndex < rows.length - 1) {
61
60
  miniSortRows.push(rows[rowIndex + 1]);
62
61
  }
63
- const sortRows = (rowA, rowB) => {
62
+ const resortedRows = [...miniSortRows].sort((rowA, rowB) => {
64
63
  const sortFn = cell.column.getSortingFn();
65
64
  const sortUndefined = cell.column.columnDef.sortUndefined;
66
65
  if (!table.options.manualSorting && sortUndefined) {
@@ -75,36 +74,12 @@ function willRowMoveAfterSorting(cell, change, rowIndex) {
75
74
  }
76
75
  }
77
76
  return sortFn(rowA, rowB, cell.column.id);
78
- };
79
- const resortedRows = [...miniSortRows].sort(sortRows);
77
+ });
80
78
  if (cell.column.getIsSorted() === 'desc') {
81
79
  resortedRows.reverse();
82
80
  }
83
81
  return ((_resortedRows$index = resortedRows[index]) === null || _resortedRows$index === void 0 ? void 0 : _resortedRows$index.id) !== cell.row.id;
84
82
  }
85
- function animateCreateRow(id) {
86
- const templateRow = document.querySelector(`[data-row-id="${id}"]`);
87
- if (templateRow) {
88
- const firstCell = templateRow.querySelector(':first-child');
89
- const checkbox = firstCell === null || firstCell === void 0 ? void 0 : firstCell.querySelector('[data-taco="checkbox"]');
90
- firstCell === null || firstCell === void 0 ? void 0 : firstCell.focus();
91
- if (checkbox) {
92
- setDataFocusAttribute(checkbox);
93
- }
94
- templateRow.scrollIntoView();
95
- const keyframes = [{
96
- background: '#b2c7ef'
97
- }, {
98
- background: '#ebebeb'
99
- }];
100
- for (const child of templateRow.children) {
101
- child.animate(keyframes, {
102
- duration: 1000,
103
- easing: 'ease-out'
104
- });
105
- }
106
- }
107
- }
108
83
 
109
- export { animateCreateRow, willRowMove };
84
+ export { willRowMove };
110
85
  //# sourceMappingURL=editing.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"editing.js","sources":["../../../../../../../../src/components/Table3/util/editing.ts"],"sourcesContent":["import { Cell as ReactTableCell, Row as ReactTableRow, Table as ReactTable } from '@tanstack/react-table';\nimport { TableFilterValue } from '../../../primitives/Table/types';\nimport { setDataFocusAttribute } from '../../../utils/dom';\nimport { columnFilterFn } from '../../../primitives/Table/useTableManager/util/filtering';\nimport { globalFilterFn } from '../../../primitives/Table/useTableManager/util/search';\nimport { Localization } from '../../Provider/Localization';\n\nexport function willRowMove<TType = unknown>(\n cell: ReactTableCell<TType, unknown>,\n change: unknown,\n rowIndex: number,\n localization: Localization\n) {\n const { table } = cell.getContext();\n\n if (willRowMoveAfterSearch<TType>(cell, change, table, localization)) {\n return 'search';\n } else if (willRowMoveAfterFilter<TType>(cell, change)) {\n return 'filter';\n } else if (willRowMoveAfterSorting<TType>(cell, change, rowIndex)) {\n return 'sorting';\n }\n\n return undefined;\n}\n\nfunction willRowMoveAfterSearch<TType = unknown>(\n cell: ReactTableCell<TType, unknown>,\n change: unknown,\n table: ReactTable<TType>,\n localization: Localization\n) {\n const searchQuery = table.getState().globalFilter;\n\n if (!table.options.enableGlobalFilter || !searchQuery) {\n return false;\n }\n\n const rowWithChange = { ...cell.row, original: { ...cell.row.original, [cell.column.id]: change } };\n return !globalFilterFn(rowWithChange, cell.column.id, searchQuery, localization);\n}\n\nfunction willRowMoveAfterFilter<TType = unknown>(cell: ReactTableCell<TType, unknown>, change: unknown) {\n if (!cell.column.getIsFiltered()) {\n return false;\n }\n\n return !columnFilterFn(change, cell.column.getFilterValue() as TableFilterValue);\n}\n\nfunction willRowMoveAfterSorting<TType = unknown>(cell: ReactTableCell<TType, unknown>, change: unknown, rowIndex: number) {\n if (!cell.column.getIsSorted()) {\n return false;\n }\n\n const { table } = cell.getContext();\n const rows = table.getRowModel().rows;\n\n const miniSortRows: ReactTableRow<TType>[] = [\n {\n ...cell.row,\n original: {\n ...cell.row.original,\n [cell.column.id]: change,\n },\n getValue: () => change as any,\n },\n ];\n\n let index = 0;\n\n if (rowIndex > 0) {\n miniSortRows.unshift(rows[rowIndex - 1]);\n index = 1;\n }\n\n if (rowIndex < rows.length - 1) {\n miniSortRows.push(rows[rowIndex + 1]);\n }\n\n const sortRows = (rowA: ReactTableRow<TType>, rowB: ReactTableRow<TType>) => {\n const sortFn = cell.column.getSortingFn();\n const sortUndefined = cell.column.columnDef.sortUndefined;\n\n if (!table.options.manualSorting && sortUndefined) {\n const aValue = rowA.getValue(cell.column.id);\n const bValue = rowB.getValue(cell.column.id);\n\n const aUndefined = aValue === undefined;\n const bUndefined = bValue === undefined;\n\n if (aUndefined || bUndefined) {\n if (sortUndefined === 'first') return aUndefined ? -1 : 1;\n if (sortUndefined === 'last') return aUndefined ? 1 : -1;\n\n return aUndefined && bUndefined ? 0 : aUndefined ? sortUndefined : -sortUndefined;\n }\n }\n\n return sortFn(rowA, rowB, cell.column.id);\n };\n\n const resortedRows = [...miniSortRows].sort(sortRows as any);\n\n if (cell.column.getIsSorted() === 'desc') {\n resortedRows.reverse();\n }\n\n return resortedRows[index]?.id !== cell.row.id;\n}\n\nexport function animateCreateRow(id: string) {\n const templateRow = document.querySelector(`[data-row-id=\"${id}\"]`);\n\n if (templateRow) {\n const firstCell = templateRow.querySelector(':first-child') as HTMLElement;\n const checkbox = firstCell?.querySelector('[data-taco=\"checkbox\"]');\n firstCell?.focus();\n\n if (checkbox) {\n setDataFocusAttribute(checkbox);\n }\n\n templateRow.scrollIntoView();\n\n const keyframes = [{ background: '#b2c7ef' }, { background: '#ebebeb' }];\n\n for (const child of templateRow.children) {\n child.animate(keyframes, { duration: 1000, easing: 'ease-out' });\n }\n }\n}\n"],"names":["willRowMove","cell","change","rowIndex","localization","table","getContext","willRowMoveAfterSearch","willRowMoveAfterFilter","willRowMoveAfterSorting","undefined","searchQuery","getState","globalFilter","options","enableGlobalFilter","rowWithChange","row","original","column","id","globalFilterFn","getIsFiltered","columnFilterFn","getFilterValue","getIsSorted","rows","getRowModel","miniSortRows","getValue","index","unshift","length","push","sortRows","rowA","rowB","sortFn","getSortingFn","sortUndefined","columnDef","manualSorting","aValue","bValue","aUndefined","bUndefined","resortedRows","sort","reverse","_resortedRows$index","animateCreateRow","templateRow","document","querySelector","firstCell","checkbox","focus","setDataFocusAttribute","scrollIntoView","keyframes","background","child","children","animate","duration","easing"],"mappings":";;;;SAOgBA,WAAWA,CACvBC,IAAoC,EACpCC,MAAe,EACfC,QAAgB,EAChBC,YAA0B;EAE1B,MAAM;IAAEC;GAAO,GAAGJ,IAAI,CAACK,UAAU,EAAE;EAEnC,IAAIC,sBAAsB,CAAQN,IAAI,EAAEC,MAAM,EAAEG,KAAK,EAAED,YAAY,CAAC,EAAE;IAClE,OAAO,QAAQ;GAClB,MAAM,IAAII,sBAAsB,CAAQP,IAAI,EAAEC,MAAM,CAAC,EAAE;IACpD,OAAO,QAAQ;GAClB,MAAM,IAAIO,uBAAuB,CAAQR,IAAI,EAAEC,MAAM,EAAEC,QAAQ,CAAC,EAAE;IAC/D,OAAO,SAAS;;EAGpB,OAAOO,SAAS;AACpB;AAEA,SAASH,sBAAsBA,CAC3BN,IAAoC,EACpCC,MAAe,EACfG,KAAwB,EACxBD,YAA0B;EAE1B,MAAMO,WAAW,GAAGN,KAAK,CAACO,QAAQ,EAAE,CAACC,YAAY;EAEjD,IAAI,CAACR,KAAK,CAACS,OAAO,CAACC,kBAAkB,IAAI,CAACJ,WAAW,EAAE;IACnD,OAAO,KAAK;;EAGhB,MAAMK,aAAa,GAAG;IAAE,GAAGf,IAAI,CAACgB,GAAG;IAAEC,QAAQ,EAAE;MAAE,GAAGjB,IAAI,CAACgB,GAAG,CAACC,QAAQ;MAAE,CAACjB,IAAI,CAACkB,MAAM,CAACC,EAAE,GAAGlB;;GAAU;EACnG,OAAO,CAACmB,cAAc,CAACL,aAAa,EAAEf,IAAI,CAACkB,MAAM,CAACC,EAAE,EAAET,WAAW,EAAEP,YAAY,CAAC;AACpF;AAEA,SAASI,sBAAsBA,CAAkBP,IAAoC,EAAEC,MAAe;EAClG,IAAI,CAACD,IAAI,CAACkB,MAAM,CAACG,aAAa,EAAE,EAAE;IAC9B,OAAO,KAAK;;EAGhB,OAAO,CAACC,cAAc,CAACrB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B,CAAC;IACnEC,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAEE,KAAK,EAAE;IAElB,IAAID,QAAQ,EAAE;MACVE,qBAAqB,CAACF,QAAQ,CAAC;;IAGnCJ,WAAW,CAACO,cAAc,EAAE;IAE5B,MAAMC,SAAS,GAAG,CAAC;MAAEC,UAAU,EAAE;KAAW,EAAE;MAAEA,UAAU,EAAE;KAAW,CAAC;IAExE,KAAK,MAAMC,KAAK,IAAIV,WAAW,CAACW,QAAQ,EAAE;MACtCD,KAAK,CAACE,OAAO,CAACJ,SAAS,EAAE;QAAEK,QAAQ,EAAE,IAAI;QAAEC,MAAM,EAAE;OAAY,CAAC;;;AAG5E;;;;"}
1
+ {"version":3,"file":"editing.js","sources":["../../../../../../../../src/components/Table3/util/editing.ts"],"sourcesContent":["import { Cell as ReactTableCell, Row as ReactTableRow, Table as ReactTable } from '@tanstack/react-table';\nimport { TableFilterValue } from '../../../primitives/Table/types';\nimport { columnFilterFn } from '../../../primitives/Table/useTableManager/util/filtering';\nimport { globalFilterFn } from '../../../primitives/Table/useTableManager/util/search';\nimport { Localization } from '../../Provider/Localization';\n\nexport function willRowMove<TType = unknown>(\n cell: ReactTableCell<TType, unknown>,\n change: unknown,\n rowIndex: number,\n localization: Localization\n) {\n const { table } = cell.getContext();\n\n if (willRowMoveAfterSearch<TType>(cell, change, table, localization)) {\n return 'search';\n } else if (willRowMoveAfterFilter<TType>(cell, change)) {\n return 'filter';\n } else if (willRowMoveAfterSorting<TType>(cell, change, rowIndex)) {\n return 'sorting';\n }\n\n return undefined;\n}\n\nfunction willRowMoveAfterSearch<TType = unknown>(\n cell: ReactTableCell<TType, unknown>,\n change: unknown,\n table: ReactTable<TType>,\n localization: Localization\n) {\n const searchQuery = table.getState().globalFilter;\n\n if (!table.options.enableGlobalFilter || !searchQuery) {\n return false;\n }\n\n const rowWithChange = { ...cell.row, original: { ...cell.row.original, [cell.column.id]: change } };\n return !globalFilterFn(rowWithChange, cell.column.id, searchQuery, localization);\n}\n\nfunction willRowMoveAfterFilter<TType = unknown>(cell: ReactTableCell<TType, unknown>, change: unknown) {\n if (!cell.column.getIsFiltered()) {\n return false;\n }\n\n return !columnFilterFn(change, cell.column.getFilterValue() as TableFilterValue);\n}\n\nfunction willRowMoveAfterSorting<TType = unknown>(cell: ReactTableCell<TType, unknown>, change: unknown, rowIndex: number) {\n if (!cell.column.getIsSorted()) {\n return false;\n }\n\n const { table } = cell.getContext();\n const rows = table.getRowModel().rows;\n\n const miniSortRows: ReactTableRow<TType>[] = [\n {\n ...cell.row,\n original: {\n ...cell.row.original,\n [cell.column.id]: change,\n },\n getValue: () => change as any,\n },\n ];\n\n let index = 0;\n\n if (rowIndex > 0) {\n miniSortRows.unshift(rows[rowIndex - 1]);\n index = 1;\n }\n\n if (rowIndex < rows.length - 1) {\n miniSortRows.push(rows[rowIndex + 1]);\n }\n\n const resortedRows = [...miniSortRows].sort((rowA, rowB) => {\n const sortFn = cell.column.getSortingFn();\n const sortUndefined = cell.column.columnDef.sortUndefined;\n\n if (!table.options.manualSorting && sortUndefined) {\n const aValue = rowA.getValue(cell.column.id);\n const bValue = rowB.getValue(cell.column.id);\n\n const aUndefined = aValue === undefined;\n const bUndefined = bValue === undefined;\n\n if (aUndefined || bUndefined) {\n if (sortUndefined === 'first') return aUndefined ? -1 : 1;\n if (sortUndefined === 'last') return aUndefined ? 1 : -1;\n\n return aUndefined && bUndefined ? 0 : aUndefined ? sortUndefined : -sortUndefined;\n }\n }\n\n return sortFn(rowA, rowB, cell.column.id);\n });\n\n if (cell.column.getIsSorted() === 'desc') {\n resortedRows.reverse();\n }\n\n return resortedRows[index]?.id !== cell.row.id;\n}\n"],"names":["willRowMove","cell","change","rowIndex","localization","table","getContext","willRowMoveAfterSearch","willRowMoveAfterFilter","willRowMoveAfterSorting","undefined","searchQuery","getState","globalFilter","options","enableGlobalFilter","rowWithChange","row","original","column","id","globalFilterFn","getIsFiltered","columnFilterFn","getFilterValue","getIsSorted","rows","getRowModel","miniSortRows","getValue","index","unshift","length","push","resortedRows","sort","rowA","rowB","sortFn","getSortingFn","sortUndefined","columnDef","manualSorting","aValue","bValue","aUndefined","bUndefined","reverse","_resortedRows$index"],"mappings":";;;SAMgBA,WAAWA,CACvBC,IAAoC,EACpCC,MAAe,EACfC,QAAgB,EAChBC,YAA0B;EAE1B,MAAM;IAAEC;GAAO,GAAGJ,IAAI,CAACK,UAAU,EAAE;EAEnC,IAAIC,sBAAsB,CAAQN,IAAI,EAAEC,MAAM,EAAEG,KAAK,EAAED,YAAY,CAAC,EAAE;IAClE,OAAO,QAAQ;GAClB,MAAM,IAAII,sBAAsB,CAAQP,IAAI,EAAEC,MAAM,CAAC,EAAE;IACpD,OAAO,QAAQ;GAClB,MAAM,IAAIO,uBAAuB,CAAQR,IAAI,EAAEC,MAAM,EAAEC,QAAQ,CAAC,EAAE;IAC/D,OAAO,SAAS;;EAGpB,OAAOO,SAAS;AACpB;AAEA,SAASH,sBAAsBA,CAC3BN,IAAoC,EACpCC,MAAe,EACfG,KAAwB,EACxBD,YAA0B;EAE1B,MAAMO,WAAW,GAAGN,KAAK,CAACO,QAAQ,EAAE,CAACC,YAAY;EAEjD,IAAI,CAACR,KAAK,CAACS,OAAO,CAACC,kBAAkB,IAAI,CAACJ,WAAW,EAAE;IACnD,OAAO,KAAK;;EAGhB,MAAMK,aAAa,GAAG;IAAE,GAAGf,IAAI,CAACgB,GAAG;IAAEC,QAAQ,EAAE;MAAE,GAAGjB,IAAI,CAACgB,GAAG,CAACC,QAAQ;MAAE,CAACjB,IAAI,CAACkB,MAAM,CAACC,EAAE,GAAGlB;;GAAU;EACnG,OAAO,CAACmB,cAAc,CAACL,aAAa,EAAEf,IAAI,CAACkB,MAAM,CAACC,EAAE,EAAET,WAAW,EAAEP,YAAY,CAAC;AACpF;AAEA,SAASI,sBAAsBA,CAAkBP,IAAoC,EAAEC,MAAe;EAClG,IAAI,CAACD,IAAI,CAACkB,MAAM,CAACG,aAAa,EAAE,EAAE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IF,aAAa,EAAE;MAC/C,MAAMG,MAAM,GAAGP,IAAI,CAACP,QAAQ,CAAC5B,IAAI,CAACkB,MAAM,CAACC,EAAE,CAAC;MAC5C,MAAMwB,MAAM,GAAGP,IAAI,CAACR,QAAQ,CAAC5B,IAAI,CAACkB,MAAM,CAACC,EAAE,CAAC;MAE5C,MAAMyB,UAAU,GAAGF,MAAM,KAAKjC,SAAS;MACvC,MAAMoC,UAAU,GAAGF,MAAM,KAAKlC,SAAS;MAEvC,IAAImC,UAAU,IAAIC,UAAU,EAAE;QAC1B,IAAIN,aAAa,KAAK,OAAO,EAAE,OAAOK,UAAU,GAAG,CAAC,CAAC,GAAG,CAAC;QACzD,IAAIL,aAAa,KAAK,MAAM,EAAE,OAAOK,UAAU,GAAG,CAAC,GAAG,CAAC,CAAC;QAExD,OAAOA,UAAU,IAAIC,UAAU,GAAG,CAAC,GAAGD,UAAU,GAAGL,aAAa,GAAG,CAACA,aAAa;;;IAIzF,OAAOF,MAAM,CAACF,IAAI,EAAEC,IAAI,EAAEpC,IAAI,CAACkB,MAAM,CAACC,EAAE,CAAC;GAC5C,CAAC;EAEF,IAAInB,IAAI,CAACkB,MAAM,CAACM,WAAW,EAAE,KAAK,MAAM,EAAE;IACtCS,YAAY,CAACa,OAAO,EAAE;;EAG1B,OAAO,EAAAC,mBAAA,GAAAd,YAAY,CAACJ,KAAK,CAAC,cAAAkB,mBAAA,uBAAnBA,mBAAA,CAAqB5B,EAAE,MAAKnB,IAAI,CAACgB,GAAG,CAACG,EAAE;AAClD;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Toast.js","sources":["../../../../../../../src/components/Toast/Toast.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { motion, useAnimation } from 'framer-motion';\nimport useTimer from '../../utils/hooks/useTimer';\nimport { getBadgeIcon, getToastEmptyContentWarning } from './util';\nimport { State } from '../../types';\nimport { useLocalization } from '../Provider/Localization';\nimport { IconButton } from '../IconButton/IconButton';\n\nexport type ToastsTexts = {\n /** Aria-label for the close icon button of toast */\n dismiss: string;\n};\n\nexport type ToastType = Omit<State, 'default'> | 'loading';\nexport type ToastOptions = {\n /** Provide time in milliseconds after which the toast should autoclose */\n autoClose?: number;\n /**\n * State will change the icon displayed in toast and other characteristics,\n * for e.g. `loading` state will display a progress animation.\n * Default value is `default`\n */\n type?: ToastType;\n};\nexport type ToastContent = Omit<React.ReactNode, 'null' | 'undefined'>;\nexport type ToastProps = {\n /** Provide a unique id for toast */\n id: string;\n /**\n * Content can be any valid react node, for e.g. a `div`, or a simple text.\n */\n content: ToastContent;\n /** Additional options to define your toast */\n options: ToastOptions;\n /**\n * Handler called when toast closes.\n * To read more about how to provide the text, see [Provider](component:provider) component\n */\n onClose: () => void;\n lastUpdated?: number;\n lastDuplicateId?: string;\n};\n\nexport const Toast = ({ content, lastUpdated, onClose: handleClose, options, ...props }: ToastProps): JSX.Element => {\n const { texts } = useLocalization();\n const { autoClose, type = 'default' } = options;\n const className = cn('bg-white relative flex items-center py-1 px-2 mt-3 w-full rounded yt-shadow print:hidden', {\n 'border border-grey-200': type === 'default' || type === 'loading' || !type,\n 'border border-grey-500': type === 'success',\n 'border border-blue-500': type === 'information',\n 'border border-yellow-700': type === 'warning',\n 'border border-red': type === 'error',\n });\n const timer = useTimer(autoClose, handleClose);\n const controls = useAnimation();\n\n if (!content) {\n console.warn(getToastEmptyContentWarning(content));\n }\n\n React.useEffect(() => {\n if (autoClose) {\n timer.start();\n }\n }, [autoClose]);\n\n const triggerUpdateAnimation = async () => {\n await controls.start({ scale: 1.05 });\n await controls.start({ scale: 1 });\n };\n\n React.useEffect(() => {\n if (lastUpdated) {\n triggerUpdateAnimation();\n\n if (timer.running) {\n timer.start();\n }\n }\n }, [lastUpdated]);\n\n return (\n <motion.div\n {...props}\n animate={controls}\n className={className}\n data-taco=\"toast\"\n onMouseEnter={timer.pause}\n onMouseLeave={timer.resume}>\n {getBadgeIcon(type)}\n <div className=\"flex-grow\">{content as React.ReactNode}</div>\n <IconButton\n appearance=\"discrete\"\n className=\"text-grey-700 -mr-2 cursor-pointer self-start !px-0\"\n icon=\"close\"\n aria-label={texts.toasts.dismiss}\n onClick={handleClose}\n />\n </motion.div>\n );\n};\n"],"names":["Toast","content","lastUpdated","onClose","handleClose","options","props","texts","useLocalization","autoClose","type","className","cn","timer","useTimer","controls","useAnimation","console","warn","getToastEmptyContentWarning","React","useEffect","start","triggerUpdateAnimation","scale","then","Promise","resolve","e","reject","running","motion","div","animate","onMouseEnter","pause","onMouseLeave","resume","getBadgeIcon","IconButton","appearance","icon","toasts","dismiss","onClick"],"mappings":";;;;;;;;MA4CaA,KAAK,GAAGA,CAAC;EAAEC,OAAO;EAAEC,WAAW;EAAEC,OAAO,EAAEC,WAAW;EAAEC,OAAO;EAAE,GAAGC;CAAmB;EAC/F,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAM;IAAEC,SAAS;IAAEC,IAAI,GAAG;GAAW,GAAGL,OAAO;EAC/C,MAAMM,SAAS,GAAGC,EAAE,CAAC,0FAA0F,EAAE;IAC7G,wBAAwB,EAAEF,IAAI,KAAK,SAAS,IAAIA,IAAI,KAAK,SAAS,IAAI,CAACA,IAAI;IAC3E,wBAAwB,EAAEA,IAAI,KAAK,SAAS;IAC5C,wBAAwB,EAAEA,IAAI,KAAK,aAAa;IAChD,0BAA0B,EAAEA,IAAI,KAAK,SAAS;IAC9C,mBAAmB,EAAEA,IAAI,KAAK;GACjC,CAAC;EACF,MAAMG,KAAK,GAAGC,QAAQ,CAACL,SAAS,EAAEL,WAAW,CAAC;EAC9C,MAAMW,QAAQ,GAAGC,YAAY,EAAE;EAE/B,IAAI,CAACf,OAAO,EAAE;IACVgB,OAAO,CAACC,IAAI,CAACC,2BAA2B,CAAClB,OAAO,CAAC,CAAC;;EAGtDmB,cAAK,CAACC,SAAS,CAAC;IACZ,IAAIZ,SAAS,EAAE;MACXI,KAAK,CAACS,KAAK,EAAE;;GAEpB,EAAE,CAACb,SAAS,CAAC,CAAC;EAEf,MAAMc,sBAAsB;IAAA;6BAClBR,QAAQ,CAACO,KAAK,CAAC;QAAEE,KAAK,EAAE;OAAM,CAAC,EAAAC,IAAA;QAAA,OAAAC,OAAA,CAAAC,OAAA,CAC/BZ,QAAQ,CAACO,KAAK,CAAC;UAAEE,KAAK,EAAE;SAAG,CAAC,EAAAC,IAAA;;KACrC,QAAAG,CAAA;MAAA,OAAAF,OAAA,CAAAG,MAAA,CAAAD,CAAA;;;EAEDR,cAAK,CAACC,SAAS,CAAC;IACZ,IAAInB,WAAW,EAAE;MACbqB,sBAAsB,EAAE;MAExB,IAAIV,KAAK,CAACiB,OAAO,EAAE;QACfjB,KAAK,CAACS,KAAK,EAAE;;;GAGxB,EAAE,CAACpB,WAAW,CAAC,CAAC;EAEjB,oBACIkB,6BAACW,MAAM,CAACC,GAAG,oBACH1B,KAAK;IACT2B,OAAO,EAAElB,QAAQ;IACjBJ,SAAS,EAAEA,SAAS;iBACV,OAAO;IACjBuB,YAAY,EAAErB,KAAK,CAACsB,KAAK;IACzBC,YAAY,EAAEvB,KAAK,CAACwB;MACnBC,YAAY,CAAC5B,IAAI,CAAC,eACnBU;IAAKT,SAAS,EAAC;KAAaV,OAA0B,CAAO,eAC7DmB,6BAACmB,UAAU;IACPC,UAAU,EAAC,UAAU;IACrB7B,SAAS,EAAC,qDAAqD;IAC/D8B,IAAI,EAAC,OAAO;kBACAlC,KAAK,CAACmC,MAAM,CAACC,OAAO;IAChCC,OAAO,EAAExC;IACX,CACO;AAErB;;;;"}
1
+ {"version":3,"file":"Toast.js","sources":["../../../../../../../src/components/Toast/Toast.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { motion, useAnimation } from 'framer-motion';\nimport useTimer from '../../utils/hooks/useTimer';\nimport { getBadgeIcon, getToastEmptyContentWarning } from './util';\nimport { State } from '../../types';\nimport { useLocalization } from '../Provider/Localization';\nimport { IconButton } from '../IconButton/IconButton';\n\nexport type ToastsTexts = {\n /** Aria-label for the close icon button of toast */\n dismiss: string;\n};\n\nexport type ToastType = Omit<State, 'default'> | 'loading';\nexport type ToastOptions = {\n /** Provide time in milliseconds after which the toast should autoclose */\n autoClose?: number;\n /**\n * State will change the icon displayed in toast and other characteristics,\n * for e.g. `loading` state will display a progress animation.\n * Default value is `default`\n */\n type?: ToastType;\n};\nexport type ToastContent = Omit<React.ReactNode, 'null' | 'undefined'>;\nexport type ToastProps = {\n /** Provide a unique id for toast */\n id: string;\n /**\n * Content can be any valid react node, for e.g. a `div`, or a simple text.\n */\n content: ToastContent;\n /** Additional options to define your toast */\n options: ToastOptions;\n /**\n * Handler called when toast closes.\n * To read more about how to provide the text, see [Provider](component:provider) component\n */\n onClose: () => void;\n lastUpdated?: number;\n lastDuplicateId?: string;\n};\n\nexport const Toast = ({ content, lastUpdated, onClose: handleClose, options, ...props }: ToastProps): JSX.Element => {\n const { texts } = useLocalization();\n const { autoClose, type = 'default' } = options;\n const className = cn('bg-white relative flex items-center py-1 px-2 mt-3 w-full rounded yt-shadow print:hidden', {\n 'border border-grey-200': type === 'default' || type === 'loading' || !type,\n 'border border-grey-500': type === 'success',\n 'border border-blue-500': type === 'information',\n 'border border-yellow-700': type === 'warning',\n 'border border-red': type === 'error',\n });\n const timer = useTimer(autoClose, handleClose);\n const controls = useAnimation();\n\n if (!content) {\n console.warn(getToastEmptyContentWarning(content));\n }\n\n React.useEffect(() => {\n if (autoClose) {\n timer.start();\n }\n }, [autoClose]);\n\n const triggerUpdateAnimation = async () => {\n await controls.start({ scale: 1.05 });\n await controls.start({ scale: 1 });\n };\n\n React.useEffect(() => {\n if (lastUpdated) {\n triggerUpdateAnimation();\n\n if (timer.running) {\n timer.start();\n }\n }\n }, [lastUpdated]);\n\n return (\n <motion.div\n {...props}\n animate={controls}\n className={className}\n data-taco=\"toast\"\n onMouseEnter={timer.pause}\n onMouseLeave={timer.resume}>\n {getBadgeIcon(type)}\n <div className=\"flex-grow\">{content}</div>\n <IconButton\n appearance=\"discrete\"\n className=\"text-grey-700 -mr-2 cursor-pointer self-start !px-0\"\n icon=\"close\"\n aria-label={texts.toasts.dismiss}\n onClick={handleClose}\n />\n </motion.div>\n );\n};\n"],"names":["Toast","content","lastUpdated","onClose","handleClose","options","props","texts","useLocalization","autoClose","type","className","cn","timer","useTimer","controls","useAnimation","console","warn","getToastEmptyContentWarning","React","useEffect","start","triggerUpdateAnimation","scale","then","Promise","resolve","e","reject","running","motion","div","animate","onMouseEnter","pause","onMouseLeave","resume","getBadgeIcon","IconButton","appearance","icon","toasts","dismiss","onClick"],"mappings":";;;;;;;;MA4CaA,KAAK,GAAGA,CAAC;EAAEC,OAAO;EAAEC,WAAW;EAAEC,OAAO,EAAEC,WAAW;EAAEC,OAAO;EAAE,GAAGC;CAAmB;EAC/F,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAM;IAAEC,SAAS;IAAEC,IAAI,GAAG;GAAW,GAAGL,OAAO;EAC/C,MAAMM,SAAS,GAAGC,EAAE,CAAC,0FAA0F,EAAE;IAC7G,wBAAwB,EAAEF,IAAI,KAAK,SAAS,IAAIA,IAAI,KAAK,SAAS,IAAI,CAACA,IAAI;IAC3E,wBAAwB,EAAEA,IAAI,KAAK,SAAS;IAC5C,wBAAwB,EAAEA,IAAI,KAAK,aAAa;IAChD,0BAA0B,EAAEA,IAAI,KAAK,SAAS;IAC9C,mBAAmB,EAAEA,IAAI,KAAK;GACjC,CAAC;EACF,MAAMG,KAAK,GAAGC,QAAQ,CAACL,SAAS,EAAEL,WAAW,CAAC;EAC9C,MAAMW,QAAQ,GAAGC,YAAY,EAAE;EAE/B,IAAI,CAACf,OAAO,EAAE;IACVgB,OAAO,CAACC,IAAI,CAACC,2BAA2B,CAAClB,OAAO,CAAC,CAAC;;EAGtDmB,cAAK,CAACC,SAAS,CAAC;IACZ,IAAIZ,SAAS,EAAE;MACXI,KAAK,CAACS,KAAK,EAAE;;GAEpB,EAAE,CAACb,SAAS,CAAC,CAAC;EAEf,MAAMc,sBAAsB;IAAA;6BAClBR,QAAQ,CAACO,KAAK,CAAC;QAAEE,KAAK,EAAE;OAAM,CAAC,EAAAC,IAAA;QAAA,OAAAC,OAAA,CAAAC,OAAA,CAC/BZ,QAAQ,CAACO,KAAK,CAAC;UAAEE,KAAK,EAAE;SAAG,CAAC,EAAAC,IAAA;;KACrC,QAAAG,CAAA;MAAA,OAAAF,OAAA,CAAAG,MAAA,CAAAD,CAAA;;;EAEDR,cAAK,CAACC,SAAS,CAAC;IACZ,IAAInB,WAAW,EAAE;MACbqB,sBAAsB,EAAE;MAExB,IAAIV,KAAK,CAACiB,OAAO,EAAE;QACfjB,KAAK,CAACS,KAAK,EAAE;;;GAGxB,EAAE,CAACpB,WAAW,CAAC,CAAC;EAEjB,oBACIkB,6BAACW,MAAM,CAACC,GAAG,oBACH1B,KAAK;IACT2B,OAAO,EAAElB,QAAQ;IACjBJ,SAAS,EAAEA,SAAS;iBACV,OAAO;IACjBuB,YAAY,EAAErB,KAAK,CAACsB,KAAK;IACzBC,YAAY,EAAEvB,KAAK,CAACwB;MACnBC,YAAY,CAAC5B,IAAI,CAAC,eACnBU;IAAKT,SAAS,EAAC;KAAaV,OAAO,CAAO,eAC1CmB,6BAACmB,UAAU;IACPC,UAAU,EAAC,UAAU;IACrB7B,SAAS,EAAC,qDAAqD;IAC/D8B,IAAI,EAAC,OAAO;kBACAlC,KAAK,CAACmC,MAAM,CAACC,OAAO;IAChCC,OAAO,EAAExC;IACX,CACO;AAErB;;;;"}
@@ -3,7 +3,7 @@ import { IconButton } from '../IconButton/IconButton.js';
3
3
  import { useLocalization } from '../Provider/Localization.js';
4
4
  import { Button } from '../Button/Button.js';
5
5
  import { Group } from '../Group/Group.js';
6
- import Joyride__default, { ACTIONS, LIFECYCLE, EVENTS } from 'react-joyride';
6
+ import Joyride, { ACTIONS, LIFECYCLE, EVENTS } from 'react-joyride';
7
7
 
8
8
  const Tooltip = ({
9
9
  continuous,
@@ -42,7 +42,7 @@ const Tooltip = ({
42
42
  icon: "close",
43
43
  title: locale.skip,
44
44
  "aria-label": locale.skip,
45
- className: "absolute right-0 top-0 mr-1 mt-1"
45
+ className: "absolute top-0 right-0 mt-1 mr-1"
46
46
  })), step.title && /*#__PURE__*/createElement("h5", null, step.title), step.content, /*#__PURE__*/createElement(Group, {
47
47
  className: "mt-4 justify-end"
48
48
  }, index > 0 && (/*#__PURE__*/createElement(Button, Object.assign({}, backProps, {
@@ -103,7 +103,7 @@ const Tour = props => {
103
103
  }
104
104
  }
105
105
  };
106
- return /*#__PURE__*/createElement(Joyride__default, Object.assign({}, rest, {
106
+ return /*#__PURE__*/createElement(Joyride, Object.assign({}, rest, {
107
107
  run: run,
108
108
  steps: steps,
109
109
  showProgress: true,
@@ -1 +1 @@
1
- {"version":3,"file":"Tour.js","sources":["../../../../../../../src/components/Tour/Tour.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as Joyride from 'react-joyride';\n\nimport { Button } from '../Button/Button';\nimport { Group } from '../Group/Group';\nimport { IconButton } from '../IconButton/IconButton';\nimport { useLocalization } from '../Provider/Localization';\n\nexport type TourTexts = {\n /** Text for back action button */\n back: string;\n /**\n * Text for close button.\n * This button is displayed if tour is not continuous - replacing the `Next` button.\n * It will pause the flow of the tour and close the tooltip\n */\n close: string;\n /**\n * Aria-label and title for close icon button in each step.\n * This button skips and completes the flow entirely\n */\n skip: string;\n /**\n * Text for last action button.\n * This button is displayed when user is on the last step of the tour\n */\n last: string;\n /**\n * Text for next action button.\n * This button is displayed if tour has more than one steps and is continuous\n */\n next: string;\n /** Aria label and title for beacon that will open the tour step */\n open: string;\n};\n\nexport type TourStepProps = {\n /** Content can be any valid react node, for e.g. a `div` */\n children: React.ReactNode;\n /** Define the position of the tour's popup relative to the element is presenting */\n position?: Joyride.Placement;\n /** The css selector of the html element you want to include in a tour */\n selector: string;\n /**\n * Show beacon for step.\n * A beacon is a styled component which indicates the current element to be presented.\n * For more informations about how to create a beacon, read [Joyride](https://docs.react-joyride.com) docs\n */\n showBeacon?: boolean;\n /** Text displayed above the children/content of the popup */\n title: string;\n};\n\nconst Tooltip = ({\n continuous,\n index,\n isLastStep,\n step,\n backProps,\n primaryProps,\n skipProps,\n tooltipProps,\n size,\n locale,\n disableTourSkipOnEsc,\n}: Joyride.TooltipRenderProps & { locale: TourTexts; disableTourSkipOnEsc?: boolean }) => {\n const skipButtonRef = React.useRef<HTMLButtonElement>(null);\n\n React.useEffect(() => {\n const onWindowKeyDown = (event: KeyboardEvent): void => {\n if (!disableTourSkipOnEsc) {\n if (event.key === 'Escape' && skipButtonRef.current !== null) {\n event.preventDefault();\n skipButtonRef.current.click();\n return;\n }\n }\n };\n\n window.addEventListener('keydown', onWindowKeyDown);\n\n return () => {\n window.removeEventListener('keydown', onWindowKeyDown);\n };\n }, []);\n\n return (\n <div {...tooltipProps} className=\"yt-tour__step w-88 relative rounded bg-white p-4\">\n <IconButton\n {...skipProps}\n ref={skipButtonRef}\n appearance=\"discrete\"\n icon=\"close\"\n title={locale.skip}\n aria-label={locale.skip}\n className=\"absolute right-0 top-0 mr-1 mt-1\"\n />\n {step.title && <h5>{step.title}</h5>}\n {step.content}\n <Group className=\"mt-4 justify-end\">\n {index > 0 && (\n <Button {...backProps} appearance=\"discrete\">\n {locale.back}\n </Button>\n )}\n <Button {...primaryProps} appearance=\"primary\">\n {continuous\n ? isLastStep\n ? `${locale.last} (${index + 1}/${size})`\n : `${locale.next} (${index + 1}/${size})`\n : locale.close}\n </Button>\n </Group>\n </div>\n );\n};\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport const TourStep = (_props: TourStepProps): null => null;\n\nexport type TourProps = {\n /** Controls if [Joyride](https://docs.react-joyride.com) is active */\n autoStart?: boolean;\n /** Children should be one or more `Tour.Step` components */\n children: any;\n /** Are there more than one steps and should you be able to navigate between them using `Next` and `Previous` buttons */\n continuous?: boolean;\n /** Disable closing of tour when click on `Escape` */\n disableCloseOnEsc?: boolean;\n /** Don't close the presenting popup of the tour step when clicking outside it */\n disableOverlayClose?: boolean;\n /** Allows user to interact with the presented components (mouse and touch events) when the popup is visible */\n disableScrolling?: boolean;\n /* When user clicks on the close icon button, which will close the tour and complete the flow */\n onClose?: (step: TourStepProps) => void;\n /* When user completes the entire flow */\n onComplete?: Function;\n /** When step is ready */\n onReady?: (step: TourStepProps) => void;\n /* Allow mouse and touch events through the spotlight */\n spotlightClicks?: boolean;\n /* Stops the injection of custom overflow styles on parent container. Can be used to prevent remaining overflow styles after tour is done. */\n disableScrollParentFix?: boolean;\n /** The scroll distance from the element scrollTop value. */\n scrollOffset?: number;\n};\n\nexport const Tour = (props: TourProps) => {\n const {\n texts: { tour },\n } = useLocalization();\n\n const {\n autoStart: run,\n onComplete,\n onClose,\n onReady,\n spotlightClicks,\n disableCloseOnEsc: disableTourSkipOnEsc,\n disableScrollParentFix = false,\n scrollOffset,\n ...rest\n } = props;\n\n const steps = React.useMemo(() => {\n return React.Children.map(props.children, child => {\n const step: Joyride.Step = {\n disableBeacon: !child.props.showBeacon,\n target: child.props.selector,\n placement: child.props.position,\n title: child.props.title,\n content: child.props.children,\n };\n return step;\n });\n }, [props.children]);\n\n const getStep = React.useCallback(\n (selector: string | HTMLElement) => props.children.find((child: any) => child.props.selector === selector)?.props,\n [props.children]\n );\n\n const callback = (state: Joyride.CallBackProps) => {\n if (state.action === Joyride.ACTIONS.SKIP && state.lifecycle === Joyride.LIFECYCLE.COMPLETE) {\n if (onClose) {\n onClose(getStep(state.step.target));\n }\n }\n\n if (state.type === Joyride.EVENTS.TOUR_END) {\n if (onComplete) {\n onComplete();\n }\n }\n\n if (state.lifecycle === Joyride.LIFECYCLE.READY) {\n if (onReady) {\n onReady(getStep(state.step.target));\n }\n }\n };\n\n return (\n <Joyride.default\n {...rest}\n run={run}\n steps={steps}\n showProgress\n floaterProps={{\n disableAnimation: true,\n }}\n tooltipComponent={tooltipProps => (\n <Tooltip {...tooltipProps} locale={tour} disableTourSkipOnEsc={disableTourSkipOnEsc} />\n )}\n locale={tour}\n spotlightPadding={8}\n spotlightClicks={spotlightClicks}\n disableScrollParentFix={disableScrollParentFix}\n callback={callback}\n scrollOffset={scrollOffset}\n styles={\n {\n /** style beacon */\n options: {\n // tailwind.theme.colors.blue.300\n primaryColor: '#6ba4ff',\n },\n } as any\n }\n disableCloseOnEsc\n />\n );\n};\n\nTour.Step = TourStep;\n"],"names":["Tooltip","continuous","index","isLastStep","step","backProps","primaryProps","skipProps","tooltipProps","size","locale","disableTourSkipOnEsc","skipButtonRef","React","onWindowKeyDown","event","key","current","preventDefault","click","window","addEventListener","removeEventListener","className","IconButton","ref","appearance","icon","title","skip","content","Group","Button","back","last","next","close","TourStep","_props","Tour","props","texts","tour","useLocalization","autoStart","run","onComplete","onClose","onReady","spotlightClicks","disableCloseOnEsc","disableScrollParentFix","scrollOffset","rest","steps","map","children","child","disableBeacon","showBeacon","target","selector","placement","position","getStep","_props$children$find","find","callback","state","action","Joyride","SKIP","lifecycle","COMPLETE","type","TOUR_END","READY","showProgress","floaterProps","disableAnimation","tooltipComponent","spotlightPadding","styles","options","primaryColor","Step"],"mappings":";;;;;;;AAqDA,MAAMA,OAAO,GAAGA,CAAC;EACbC,UAAU;EACVC,KAAK;EACLC,UAAU;EACVC,IAAI;EACJC,SAAS;EACTC,YAAY;EACZC,SAAS;EACTC,YAAY;EACZC,IAAI;EACJC,MAAM;EACNC;CACiF;EACjF,MAAMC,aAAa,GAAGC,MAAY,CAAoB,IAAI,CAAC;EAE3DA,SAAe,CAAC;IACZ,MAAMC,eAAe,GAAIC,KAAoB;MACzC,IAAI,CAACJ,oBAAoB,EAAE;QACvB,IAAII,KAAK,CAACC,GAAG,KAAK,QAAQ,IAAIJ,aAAa,CAACK,OAAO,KAAK,IAAI,EAAE;UAC1DF,KAAK,CAACG,cAAc,EAAE;UACtBN,aAAa,CAACK,OAAO,CAACE,KAAK,EAAE;UAC7B;;;KAGX;IAEDC,MAAM,CAACC,gBAAgB,CAAC,S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B,CAACM,KAAK,EAAE;MAC7C,IAAI5B,OAAO,EAAE;QACTA,OAAO,CAACgB,OAAO,CAACI,KAAK,CAAChE,IAAI,CAACwD,MAAM,CAAC,CAAC;;;GAG9C;EAED,oBACI/C,cAACyD,gBAAe,oBACRjB,IAAI;IACRR,GAAG,EAAEA,GAAG;IACRS,KAAK,EAAEA,KAAK;IACZuB,YAAY;IACZC,YAAY,EAAE;MACVC,gBAAgB,EAAE;KACrB;IACDC,gBAAgB,EAAExE,YAAY,kBAC1BK,cAACb,OAAO,oBAAKQ,YAAY;MAAEE,MAAM,EAAEgC,IAAI;MAAE/B,oBAAoB,EAAEA;OAAwB,CAC1F;IACDD,MAAM,EAAEgC,IAAI;IACZuC,gBAAgB,EAAE,CAAC;IACnBhC,eAAe,EAAEA,eAAe;IAChCE,sBAAsB,EAAEA,sBAAsB;IAC9CgB,QAAQ,EAAEA,QAAQ;IAClBf,YAAY,EAAEA,YAAY;IAC1B8B,MAAM,EACF;;MAEIC,OAAO,EAAE;;QAELC,YAAY,EAAE;;KAEd;IAEZlC,iBAAiB;KACnB;AAEV;AAEAX,IAAI,CAAC8C,IAAI,GAAGhD,QAAQ;;;;"}
1
+ {"version":3,"file":"Tour.js","sources":["../../../../../../../src/components/Tour/Tour.tsx"],"sourcesContent":["import * as React from 'react';\nimport Joyride, { Step, CallBackProps, ACTIONS, LIFECYCLE, Placement, EVENTS, TooltipRenderProps } from 'react-joyride';\n\nimport { Button } from '../Button/Button';\nimport { Group } from '../Group/Group';\nimport { IconButton } from '../IconButton/IconButton';\nimport { useLocalization } from '../Provider/Localization';\n\nexport type TourTexts = {\n /** Text for back action button */\n back: string;\n /**\n * Text for close button.\n * This button is displayed if tour is not continuous - replacing the `Next` button.\n * It will pause the flow of the tour and close the tooltip\n */\n close: string;\n /**\n * Aria-label and title for close icon button in each step.\n * This button skips and completes the flow entirely\n */\n skip: string;\n /**\n * Text for last action button.\n * This button is displayed when user is on the last step of the tour\n */\n last: string;\n /**\n * Text for next action button.\n * This button is displayed if tour has more than one steps and is continuous\n */\n next: string;\n /** Aria label and title for beacon that will open the tour step */\n open: string;\n};\n\nexport type TourStepProps = {\n /** Content can be any valid react node, for e.g. a `div` */\n children: React.ReactNode;\n /** Define the position of the tour's popup relative to the element is presenting */\n position?: Placement;\n /** The css selector of the html element you want to include in a tour */\n selector: string;\n /**\n * Show beacon for step.\n * A beacon is a styled component which indicates the current element to be presented.\n * For more informations about how to create a beacon, read [Joyride](https://docs.react-joyride.com) docs\n */\n showBeacon?: boolean;\n /** Text displayed above the children/content of the popup */\n title: string;\n};\n\nconst Tooltip = ({\n continuous,\n index,\n isLastStep,\n step,\n backProps,\n primaryProps,\n skipProps,\n tooltipProps,\n size,\n locale,\n disableTourSkipOnEsc,\n}: TooltipRenderProps & { locale: TourTexts; disableTourSkipOnEsc?: boolean }) => {\n const skipButtonRef = React.useRef<HTMLButtonElement>(null);\n\n React.useEffect(() => {\n const onWindowKeyDown = (event: KeyboardEvent): void => {\n if (!disableTourSkipOnEsc) {\n if (event.key === 'Escape' && skipButtonRef.current !== null) {\n event.preventDefault();\n skipButtonRef.current.click();\n return;\n }\n }\n };\n\n window.addEventListener('keydown', onWindowKeyDown);\n\n return () => {\n window.removeEventListener('keydown', onWindowKeyDown);\n };\n }, []);\n\n return (\n <div {...tooltipProps} className=\"yt-tour__step w-88 relative rounded bg-white p-4\">\n <IconButton\n {...skipProps}\n ref={skipButtonRef}\n appearance=\"discrete\"\n icon=\"close\"\n title={locale.skip}\n aria-label={locale.skip}\n className=\"absolute top-0 right-0 mt-1 mr-1\"\n />\n {step.title && <h5>{step.title}</h5>}\n {step.content}\n <Group className=\"mt-4 justify-end\">\n {index > 0 && (\n <Button {...backProps} appearance=\"discrete\">\n {locale.back}\n </Button>\n )}\n <Button {...primaryProps} appearance=\"primary\">\n {continuous\n ? isLastStep\n ? `${locale.last} (${index + 1}/${size})`\n : `${locale.next} (${index + 1}/${size})`\n : locale.close}\n </Button>\n </Group>\n </div>\n );\n};\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport const TourStep = (_props: TourStepProps): null => null;\n\nexport type TourProps = {\n /** Controls if [Joyride](https://docs.react-joyride.com) is active */\n autoStart?: boolean;\n /** Children should be one or more `Tour.Step` components */\n children: any;\n /** Are there more than one steps and should you be able to navigate between them using `Next` and `Previous` buttons */\n continuous?: boolean;\n /** Disable closing of tour when click on `Escape` */\n disableCloseOnEsc?: boolean;\n /** Don't close the presenting popup of the tour step when clicking outside it */\n disableOverlayClose?: boolean;\n /** Allows user to interact with the presented components (mouse and touch events) when the popup is visible */\n disableScrolling?: boolean;\n /* When user clicks on the close icon button, which will close the tour and complete the flow */\n onClose?: (step: TourStepProps) => void;\n /* When user completes the entire flow */\n onComplete?: Function;\n /** When step is ready */\n onReady?: (step: TourStepProps) => void;\n /* Allow mouse and touch events through the spotlight */\n spotlightClicks?: boolean;\n /* Stops the injection of custom overflow styles on parent container. Can be used to prevent remaining overflow styles after tour is done. */\n disableScrollParentFix?: boolean;\n /** The scroll distance from the element scrollTop value. */\n scrollOffset?: number;\n};\n\nexport const Tour = (props: TourProps) => {\n const {\n texts: { tour },\n } = useLocalization();\n\n const {\n autoStart: run,\n onComplete,\n onClose,\n onReady,\n spotlightClicks,\n disableCloseOnEsc: disableTourSkipOnEsc,\n disableScrollParentFix = false,\n scrollOffset,\n ...rest\n } = props;\n\n const steps = React.useMemo(() => {\n return React.Children.map(props.children, child => {\n const step: Step = {\n disableBeacon: !child.props.showBeacon,\n target: child.props.selector,\n placement: child.props.position,\n title: child.props.title,\n content: child.props.children,\n };\n return step;\n });\n }, [props.children]);\n\n const getStep = React.useCallback(\n (selector: string | HTMLElement) => props.children.find((child: any) => child.props.selector === selector)?.props,\n [props.children]\n );\n\n const callback = (state: CallBackProps) => {\n if (state.action === ACTIONS.SKIP && state.lifecycle === LIFECYCLE.COMPLETE) {\n if (onClose) {\n onClose(getStep(state.step.target));\n }\n }\n\n if (state.type === EVENTS.TOUR_END) {\n if (onComplete) {\n onComplete();\n }\n }\n\n if (state.lifecycle === LIFECYCLE.READY) {\n if (onReady) {\n onReady(getStep(state.step.target));\n }\n }\n };\n\n return (\n <Joyride\n {...rest}\n run={run}\n steps={steps}\n showProgress\n floaterProps={{\n disableAnimation: true,\n }}\n tooltipComponent={tooltipProps => (\n <Tooltip {...tooltipProps} locale={tour} disableTourSkipOnEsc={disableTourSkipOnEsc} />\n )}\n locale={tour}\n spotlightPadding={8}\n spotlightClicks={spotlightClicks}\n disableScrollParentFix={disableScrollParentFix}\n callback={callback}\n scrollOffset={scrollOffset}\n styles={{\n /** style beacon */\n options: {\n // tailwind.theme.colors.blue.300\n primaryColor: '#6ba4ff',\n },\n }}\n disableCloseOnEsc\n />\n );\n};\n\nTour.Step = TourStep;\n"],"names":["Tooltip","continuous","index","isLastStep","step","backProps","primaryProps","skipProps","tooltipProps","size","locale","disableTourSkipOnEsc","skipButtonRef","React","onWindowKeyDown","event","key","current","preventDefault","click","window","addEventListener","removeEventListener","className","IconButton","ref","appearance","icon","title","skip","content","Group","Button","back","last","next","close","TourStep","_props","Tour","props","texts","tour","useLocalization","autoStart","run","onComplete","onClose","onReady","spotlightClicks","disableCloseOnEsc","disableScrollParentFix","scrollOffset","rest","steps","map","children","child","disableBeacon","showBeacon","target","selector","placement","position","getStep","_props$children$find","find","callback","state","action","ACTIONS","SKIP","lifecycle","LIFECYCLE","COMPLETE","type","EVENTS","TOUR_END","READY","Joyride","showProgress","floaterProps","disableAnimation","tooltipComponent","spotlightPadding","styles","options","primaryColor","Step"],"mappings":";;;;;;;AAqDA,MAAMA,OAAO,GAAGA,CAAC;EACbC,UAAU;EACVC,KAAK;EACLC,UAAU;EACVC,IAAI;EACJC,SAAS;EACTC,YAAY;EACZC,SAAS;EACTC,YAAY;EACZC,IAAI;EACJC,MAAM;EACNC;CACyE;EACzE,MAAMC,aAAa,GAAGC,MAAY,CAAoB,IAAI,CAAC;EAE3DA,SAAe,CAAC;IACZ,MAAMC,eAAe,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AAI3B,OAAO,EAAE;QACTA,OAAO,CAACiB,OAAO,CAACI,KAAK,CAAChE,IAAI,CAACwD,MAAM,CAAC,CAAC;;;IAI3C,IAAIQ,KAAK,CAACO,IAAI,KAAKC,MAAM,CAACC,QAAQ,EAAE;MAChC,IAAI/B,UAAU,EAAE;QACZA,UAAU,EAAE;;;IAIpB,IAAIsB,KAAK,CAACI,SAAS,KAAKC,SAAS,CAACK,KAAK,EAAE;MACrC,IAAI9B,OAAO,EAAE;QACTA,OAAO,CAACgB,OAAO,CAACI,KAAK,CAAChE,IAAI,CAACwD,MAAM,CAAC,CAAC;;;GAG9C;EAED,oBACI/C,cAACkE,OAAO,oBACA1B,IAAI;IACRR,GAAG,EAAEA,GAAG;IACRS,KAAK,EAAEA,KAAK;IACZ0B,YAAY;IACZC,YAAY,EAAE;MACVC,gBAAgB,EAAE;KACrB;IACDC,gBAAgB,EAAE3E,YAAY,kBAC1BK,cAACb,OAAO,oBAAKQ,YAAY;MAAEE,MAAM,EAAEgC,IAAI;MAAE/B,oBAAoB,EAAEA;OAAwB,CAC1F;IACDD,MAAM,EAAEgC,IAAI;IACZ0C,gBAAgB,EAAE,CAAC;IACnBnC,eAAe,EAAEA,eAAe;IAChCE,sBAAsB,EAAEA,sBAAsB;IAC9CgB,QAAQ,EAAEA,QAAQ;IAClBf,YAAY,EAAEA,YAAY;IAC1BiC,MAAM,EAAE;;MAEJC,OAAO,EAAE;;QAELC,YAAY,EAAE;;KAErB;IACDrC,iBAAiB;KACnB;AAEV;AAEAX,IAAI,CAACiD,IAAI,GAAGnD,QAAQ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useGlobalKeyDown.js","sources":["../../../../../../src/hooks/useGlobalKeyDown.ts"],"sourcesContent":["import React from 'react';\nimport { createShortcutKeyDownHandler, KeyDownHandlerOptions } from '../utils/keyboard';\n\nexport const useGlobalKeyDown = (\n shortcut: string | KeyDownHandlerOptions | undefined,\n handler: (event: KeyboardEvent) => void\n) => {\n React.useEffect(() => {\n let handleKeyDown: (event: KeyboardEvent | React.KeyboardEvent) => void;\n\n if (shortcut) {\n handleKeyDown = createShortcutKeyDownHandler(\n shortcut,\n handler as (event: KeyboardEvent | React.KeyboardEvent) => void,\n false\n );\n\n document.addEventListener('keydown', handleKeyDown);\n }\n\n return () => {\n if (handleKeyDown) {\n document.removeEventListener('keydown', handleKeyDown);\n }\n };\n }, [shortcut, handler]);\n};\n"],"names":["useGlobalKeyDown","shortcut","handler","React","useEffect","handleKeyDown","createShortcutKeyDownHandler","document","addEventListener","removeEventListener"],"mappings":";;;MAGaA,gBAAgB,GAAGA,CAC5BC,QAAoD,EACpDC,OAAuC;EAEvCC,cAAK,CAACC,SAAS,CAAC;IACZ,IAAIC,aAAmE;IAEvE,IAAIJ,QAAQ,EAAE;MACVI,aAAa,GAAGC,4BAA4B,CACxCL,QAAQ,EACRC,OAA+D,EAC/D,KAAK,CACR;MAEDK,QAAQ,CAACC,gBAAgB,CAAC,SAAS,EAAEH,aAAa,CAAC;;IAGvD,OAAO;MACH,IAAIA,aAAa,EAAE;QACfE,QAAQ,CAACE,mBAAmB,CAAC,SAAS,EAAEJ,aAAa,CAAC;;KAE7D;GACJ,EAAE,CAACJ,QAAQ,EAAEC,OAAO,CAAC,CAAC;AAC3B;;;;"}
1
+ {"version":3,"file":"useGlobalKeyDown.js","sources":["../../../../../../src/hooks/useGlobalKeyDown.ts"],"sourcesContent":["import React from 'react';\nimport { createShortcutKeyDownHandler, KeyDownHandlerOptions } from '../utils/keyboard';\n\nexport const useGlobalKeyDown = (\n shortcut: string | KeyDownHandlerOptions | undefined,\n handler: (event: KeyboardEvent) => void\n) => {\n React.useEffect(() => {\n let handleKeyDown;\n\n if (shortcut) {\n handleKeyDown = createShortcutKeyDownHandler(\n shortcut,\n handler as (event: KeyboardEvent | React.KeyboardEvent) => void,\n false\n );\n\n document.addEventListener('keydown', handleKeyDown);\n }\n\n return () => {\n if (handleKeyDown) {\n document.removeEventListener('keydown', handleKeyDown);\n }\n };\n }, [shortcut, handler]);\n};\n"],"names":["useGlobalKeyDown","shortcut","handler","React","useEffect","handleKeyDown","createShortcutKeyDownHandler","document","addEventListener","removeEventListener"],"mappings":";;;MAGaA,gBAAgB,GAAGA,CAC5BC,QAAoD,EACpDC,OAAuC;EAEvCC,cAAK,CAACC,SAAS,CAAC;IACZ,IAAIC,aAAa;IAEjB,IAAIJ,QAAQ,EAAE;MACVI,aAAa,GAAGC,4BAA4B,CACxCL,QAAQ,EACRC,OAA+D,EAC/D,KAAK,CACR;MAEDK,QAAQ,CAACC,gBAAgB,CAAC,SAAS,EAAEH,aAAa,CAAC;;IAGvD,OAAO;MACH,IAAIA,aAAa,EAAE;QACfE,QAAQ,CAACE,mBAAmB,CAAC,SAAS,EAAEJ,aAAa,CAAC;;KAE7D;GACJ,EAAE,CAACJ,QAAQ,EAAEC,OAAO,CAAC,CAAC;AAC3B;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useIntersectionObserver.js","sources":["../../../../../../src/hooks/useIntersectionObserver.ts"],"sourcesContent":["import React from 'react';\n\nexport const useIntersectionObserver = (ref: React.RefObject<HTMLElement>, offset?: number) => {\n const [intersectedIndexes, setIntersectedIndexes] = React.useState({});\n\n const handleIntersection = (entries: IntersectionObserverEntry[], observer: IntersectionObserver) => {\n if (observer.root) {\n const children = Array.from((observer.root as Element).children);\n const map: { [key: string]: boolean } = {};\n\n entries.forEach(entry => {\n // entries only contains the items being intersected not all children of the ref\n // so use root and the the entry being intersected to find its real index\n // on first mount this is different - all children are present\n map[children.indexOf(entry.target)] = entry.isIntersecting;\n });\n\n setIntersectedIndexes(prev => ({ ...prev, ...map }));\n }\n };\n\n const intersectedChildIndex = React.useMemo(() => {\n const index = Object.values(intersectedIndexes).indexOf(false);\n return index > -1 ? index : undefined;\n }, [intersectedIndexes]);\n\n const hasRootMargin = intersectedChildIndex !== undefined && offset;\n\n React.useEffect(() => {\n const observer = new IntersectionObserver(handleIntersection, {\n root: ref.current,\n // offset the button, but only after the first item has been intersected\n rootMargin: hasRootMargin ? `0px -${offset}px 0px 0px` : undefined,\n threshold: 1,\n });\n\n if (observer.root) {\n Array.from(observer.root.children).forEach(item => {\n if (!item.hasAttribute('data-observer-ignore')) {\n observer.observe(item);\n }\n });\n }\n\n return () => {\n observer.disconnect();\n };\n }, [hasRootMargin]);\n\n return intersectedChildIndex;\n};\n"],"names":["useIntersectionObserver","ref","offset","intersectedIndexes","setIntersectedIndexes","React","useState","handleIntersection","entries","observer","root","children","Array","from","map","forEach","entry","indexOf","target","isIntersecting","prev","intersectedChildIndex","useMemo","index","Object","values","undefined","hasRootMargin","useEffect","IntersectionObserver","current","rootMargin","threshold","item","hasAttribute","observe","disconnect"],"mappings":";;MAEaA,uBAAuB,GAAGA,CAACC,GAAiC,EAAEC,MAAe;EACtF,MAAM,CAACC,kBAAkB,EAAEC,qBAAqB,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAC,EAAE,CAAC;EAEtE,MAAMC,kBAAkB,GAAGA,CAACC,OAAoC,EAAEC,QAA8B;IAC5F,IAAIA,QAAQ,CAACC,IAAI,EAAE;MACf,MAAMC,QAAQ,GAAGC,KAAK,CAACC,IAAI,CAAEJ,QAAQ,CAACC,IAAgB,CAACC,QAAQ,CAAC;MAChE,MAAMG,GAAG,GAA+B,EAAE;MAE1CN,OAAO,CAACO,OAAO,CAACC,KAAK;;;;QAIjBF,GAAG,CAACH,QAAQ,CAACM,OAAO,CAACD,KAAK,CAACE,MAAM,CAAC,CAAC,GAAGF,KAAK,CAACG,cAAc;OAC7D,CAAC;MAEFf,qBAAqB,CAACgB,IAAI,KAAK;QAAE,GAAGA,IAAI;QAAE,GAAGN;OAAK,CAAC,CAAC;;GAE3D;EAED,MAAMO,qBAAqB,GAAGhB,cAAK,CAACiB,OAAO,CAAC;IACxC,MAAMC,KAAK,GAAGC,MAAM,CAACC,MAAM,CAACtB,kBAAkB,CAAC,CAACc,OAAO,CAAC,KAAK,CAAC;IAC9D,OAAOM,KAAK,GAAG,CAAC,CAAC,GAAGA,KAAK,GAAGG,SAAS;GACxC,EAAE,CAACvB,kBAAkB,CAAC,CAAC;EAExB,MAAMwB,aAAa,GAAGN,qBAAqB,KAAKK,SAAS,IAAIxB,MAAM;EAEnEG,cAAK,CAACuB,SAAS,CAAC;IACZ,MAAMnB,QAAQ,GAAG,IAAIoB,oBAAoB,CAACtB,kBAAkB,EAAE;MAC1DG,IAAI,EAAET,GAAG,CAAC6B,OAAO;;MAEjBC,UAAU,EAAEJ,aAAa,GAAG,QAAQzB,MAAM,YAAY,GAAGwB,SAAS;MAClEM,SAAS,EAAE;KACd,CAAC;IAEF,IAAIvB,QAAQ,CAACC,IAAI,EAAE;MACfE,KAAK,CAACC,IAAI,CAACJ,QAAQ,CAACC,IAAI,CAACC,QAAQ,CAAC,CAACI,OAAO,CAACkB,IAAI;QAC3C,IAAI,CAACA,IAAI,CAACC,YAAY,CAAC,sBAAsB,CAAC,EAAE;UAC5CzB,QAAQ,CAAC0B,OAAO,CAACF,IAAI,CAAC;;OAE7B,CAAC;;IAGN,OAAO;MACHxB,QAAQ,CAAC2B,UAAU,EAAE;KACxB;GACJ,EAAE,CAACT,aAAa,CAAC,CAAC;EAEnB,OAAON,qBAAqB;AAChC;;;;"}
1
+ {"version":3,"file":"useIntersectionObserver.js","sources":["../../../../../../src/hooks/useIntersectionObserver.ts"],"sourcesContent":["import React from 'react';\n\nexport const useIntersectionObserver = (ref: React.RefObject<HTMLElement>, offset?: number) => {\n const [intersectedIndexes, setIntersectedIndexes] = React.useState({});\n\n const handleIntersection = (entries: IntersectionObserverEntry[], observer: IntersectionObserver) => {\n if (observer.root) {\n const children = Array.from((observer.root as Element).children);\n const map = {};\n\n entries.forEach(entry => {\n // entries only contains the items being intersected not all children of the ref\n // so use root and the the entry being intersected to find its real index\n // on first mount this is different - all children are present\n map[children.indexOf(entry.target)] = entry.isIntersecting;\n });\n\n setIntersectedIndexes(prev => ({ ...prev, ...map }));\n }\n };\n\n const intersectedChildIndex = React.useMemo(() => {\n const index = Object.values(intersectedIndexes).indexOf(false);\n return index > -1 ? index : undefined;\n }, [intersectedIndexes]);\n\n const hasRootMargin = intersectedChildIndex !== undefined && offset;\n\n React.useEffect(() => {\n const observer = new IntersectionObserver(handleIntersection, {\n root: ref.current,\n // offset the button, but only after the first item has been intersected\n rootMargin: hasRootMargin ? `0px -${offset}px 0px 0px` : undefined,\n threshold: 1,\n });\n\n if (observer.root) {\n Array.from(observer.root.children).forEach(item => {\n if (!item.hasAttribute('data-observer-ignore')) {\n observer.observe(item);\n }\n });\n }\n\n return () => {\n observer.disconnect();\n };\n }, [hasRootMargin]);\n\n return intersectedChildIndex;\n};\n"],"names":["useIntersectionObserver","ref","offset","intersectedIndexes","setIntersectedIndexes","React","useState","handleIntersection","entries","observer","root","children","Array","from","map","forEach","entry","indexOf","target","isIntersecting","prev","intersectedChildIndex","useMemo","index","Object","values","undefined","hasRootMargin","useEffect","IntersectionObserver","current","rootMargin","threshold","item","hasAttribute","observe","disconnect"],"mappings":";;MAEaA,uBAAuB,GAAGA,CAACC,GAAiC,EAAEC,MAAe;EACtF,MAAM,CAACC,kBAAkB,EAAEC,qBAAqB,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAC,EAAE,CAAC;EAEtE,MAAMC,kBAAkB,GAAGA,CAACC,OAAoC,EAAEC,QAA8B;IAC5F,IAAIA,QAAQ,CAACC,IAAI,EAAE;MACf,MAAMC,QAAQ,GAAGC,KAAK,CAACC,IAAI,CAAEJ,QAAQ,CAACC,IAAgB,CAACC,QAAQ,CAAC;MAChE,MAAMG,GAAG,GAAG,EAAE;MAEdN,OAAO,CAACO,OAAO,CAACC,KAAK;;;;QAIjBF,GAAG,CAACH,QAAQ,CAACM,OAAO,CAACD,KAAK,CAACE,MAAM,CAAC,CAAC,GAAGF,KAAK,CAACG,cAAc;OAC7D,CAAC;MAEFf,qBAAqB,CAACgB,IAAI,KAAK;QAAE,GAAGA,IAAI;QAAE,GAAGN;OAAK,CAAC,CAAC;;GAE3D;EAED,MAAMO,qBAAqB,GAAGhB,cAAK,CAACiB,OAAO,CAAC;IACxC,MAAMC,KAAK,GAAGC,MAAM,CAACC,MAAM,CAACtB,kBAAkB,CAAC,CAACc,OAAO,CAAC,KAAK,CAAC;IAC9D,OAAOM,KAAK,GAAG,CAAC,CAAC,GAAGA,KAAK,GAAGG,SAAS;GACxC,EAAE,CAACvB,kBAAkB,CAAC,CAAC;EAExB,MAAMwB,aAAa,GAAGN,qBAAqB,KAAKK,SAAS,IAAIxB,MAAM;EAEnEG,cAAK,CAACuB,SAAS,CAAC;IACZ,MAAMnB,QAAQ,GAAG,IAAIoB,oBAAoB,CAACtB,kBAAkB,EAAE;MAC1DG,IAAI,EAAET,GAAG,CAAC6B,OAAO;;MAEjBC,UAAU,EAAEJ,aAAa,GAAG,QAAQzB,MAAM,YAAY,GAAGwB,SAAS;MAClEM,SAAS,EAAE;KACd,CAAC;IAEF,IAAIvB,QAAQ,CAACC,IAAI,EAAE;MACfE,KAAK,CAACC,IAAI,CAACJ,QAAQ,CAACC,IAAI,CAACC,QAAQ,CAAC,CAACI,OAAO,CAACkB,IAAI;QAC3C,IAAI,CAACA,IAAI,CAACC,YAAY,CAAC,sBAAsB,CAAC,EAAE;UAC5CzB,QAAQ,CAAC0B,OAAO,CAACF,IAAI,CAAC;;OAE7B,CAAC;;IAGN,OAAO;MACHxB,QAAQ,CAAC2B,UAAU,EAAE;KACxB;GACJ,EAAE,CAACT,aAAa,CAAC,CAAC;EAEnB,OAAON,qBAAqB;AAChC;;;;"}
@@ -10,12 +10,12 @@ const getOptionsFromCollection = (collection, selector) => collection.querySelec
10
10
  const Root = /*#__PURE__*/React__default.forwardRef(function CollectionRoot(props, ref) {
11
11
  const {
12
12
  querySelector,
13
+ resetOnChange,
13
14
  tabIndex = 0,
14
15
  ...otherProps
15
16
  } = props;
16
17
  const internalRef = useMergedRef(ref);
17
18
  const [activeIndex, setActiveIndex] = React__default.useState();
18
- const lastLengthRef = React__default.useRef(0);
19
19
  const setActiveOption = (index, collection, option) => {
20
20
  var _collection$querySele;
21
21
  (_collection$querySele = collection.querySelector(`[aria-current]`)) === null || _collection$querySele === void 0 ? void 0 : _collection$querySele.removeAttribute('aria-current');
@@ -38,17 +38,34 @@ const Root = /*#__PURE__*/React__default.forwardRef(function CollectionRoot(prop
38
38
  }, [internalRef.current, querySelector]);
39
39
  React__default.useEffect(() => {
40
40
  if (internalRef.current) {
41
- internalRef.current.setActiveIndex = setActiveIndexByElement;
41
+ internalRef.current.setActiveIndexByElement = setActiveIndexByElement;
42
42
  }
43
43
  }, [internalRef.current]);
44
44
  React__default.useEffect(() => {
45
45
  if (internalRef.current) {
46
+ const selected = internalRef.current.querySelectorAll(`[aria-current="true"]`);
46
47
  const options = getOptionsFromCollection(internalRef.current, querySelector);
47
- if (options.length && options.length !== lastLengthRef.current) {
48
+ if (options.length && selected.length === 1) {
49
+ const firstSelected = internalRef.current.querySelector(`[aria-selected]`);
50
+ if (firstSelected) {
51
+ const selectedIndex = Array.from(options).indexOf(firstSelected);
52
+ if (selectedIndex > -1) {
53
+ setActiveOption(selectedIndex, internalRef.current, firstSelected);
54
+ }
55
+ }
56
+ }
57
+ }
58
+ }, [resetOnChange]);
59
+ React__default.useEffect(() => {
60
+ if (internalRef.current) {
61
+ const options = getOptionsFromCollection(internalRef.current, querySelector);
62
+ if (options.length) {
48
63
  let selected = internalRef.current.querySelectorAll(`[aria-current="true"]`);
64
+ // if nothing is current (keyboard visible), look for selected items
49
65
  if (selected.length === 0) {
50
66
  selected = internalRef.current.querySelectorAll(`[aria-selected]`);
51
67
  }
68
+ // if one item is selected, make sure it's current
52
69
  if (selected.length === 1) {
53
70
  if (options) {
54
71
  const firstSelected = selected.item(0);
@@ -62,7 +79,6 @@ const Root = /*#__PURE__*/React__default.forwardRef(function CollectionRoot(prop
62
79
  setActiveOption(0, internalRef.current, options.item(0));
63
80
  }
64
81
  }
65
- lastLengthRef.current = options.length;
66
82
  }
67
83
  }, [props.children]);
68
84
  const handleClick = event => {
@@ -1 +1 @@
1
- {"version":3,"file":"Root.js","sources":["../../../../../../../../src/primitives/Collection/components/Root.tsx"],"sourcesContent":["import React from 'react';\nimport { useMergedRef } from '../../../hooks/useMergedRef';\nimport { isAriaDirectionKey } from '../../../utils/aria';\nimport { createCustomKeyboardEvent } from '../../../utils/input';\n\n/* This component provides a keyboard navigable collection primitive for use in lists\n * It is unlikely you need to edit this component\n */\n\nexport type CollectionProps = React.HTMLAttributes<HTMLDivElement> & {\n querySelector: string;\n};\n\nexport type CollectionRef = HTMLDivElement & {\n setActiveIndex: (option: HTMLDivElement) => void;\n};\n\nconst getOptionsFromCollection = (collection: HTMLDivElement, selector: string): NodeListOf<Element> =>\n collection.querySelectorAll(selector);\n\n// we use javascript to set attributes (rather than cloning children and adding them)\n// so that we can support nesting (e.g. groups) - child elements that aren't options.\n// without doing this we would have to unwrap and flatten all groups\nexport const Root = React.forwardRef<CollectionRef, CollectionProps>(function CollectionRoot(props, ref) {\n const { querySelector, tabIndex = 0, ...otherProps } = props;\n const internalRef = useMergedRef<CollectionRef>(ref);\n const [activeIndex, setActiveIndex] = React.useState<number | undefined>();\n const lastLengthRef = React.useRef(0);\n\n const setActiveOption = (index: number, collection: HTMLDivElement, option: Element) => {\n collection.querySelector(`[aria-current]`)?.removeAttribute('aria-current');\n option.setAttribute('aria-current', 'true');\n option.scrollIntoView({ block: 'nearest' });\n setActiveIndex(index);\n };\n\n const setActiveIndexByElement = React.useCallback(\n (option: HTMLDivElement) => {\n if (internalRef.current) {\n if (option.matches(querySelector)) {\n const options = getOptionsFromCollection(internalRef.current, querySelector);\n const nextActiveIndex = Array.from(options).indexOf(option);\n\n if (nextActiveIndex > -1) {\n setActiveOption(nextActiveIndex, internalRef.current, option);\n }\n }\n }\n },\n [internalRef.current, querySelector]\n );\n\n React.useEffect(() => {\n if (internalRef.current) {\n internalRef.current.setActiveIndex = setActiveIndexByElement;\n }\n }, [internalRef.current]);\n\n React.useEffect(() => {\n if (internalRef.current) {\n const options = getOptionsFromCollection(internalRef.current, querySelector);\n\n if (options.length && options.length !== lastLengthRef.current) {\n let selected = internalRef.current.querySelectorAll(`[aria-current=\"true\"]`);\n\n if (selected.length === 0) {\n selected = internalRef.current.querySelectorAll(`[aria-selected]`);\n }\n\n if (selected.length === 1) {\n if (options) {\n const firstSelected = selected.item(0);\n const selectedIndex = Array.from(options).indexOf(firstSelected);\n\n if (selectedIndex > -1) {\n setActiveOption(selectedIndex, internalRef.current, firstSelected);\n }\n }\n } else {\n // multiple selected or none selected should go to 0\n setActiveOption(0, internalRef.current, options.item(0));\n }\n }\n\n lastLengthRef.current = options.length;\n }\n }, [props.children]);\n\n const handleClick = (event: React.MouseEvent<HTMLDivElement>) => {\n const option = event.target as HTMLElement;\n\n if (option.matches(querySelector)) {\n const options = getOptionsFromCollection(event.currentTarget, querySelector);\n const nextActiveIndex = Array.from(options).indexOf(option);\n\n if (nextActiveIndex > -1) {\n setActiveOption(nextActiveIndex, event.currentTarget, option);\n }\n }\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n // this stops the event dispatched to the option rebounding back and starting an infinite loop\n if (event.target !== event.currentTarget) {\n return;\n }\n\n if (otherProps.onKeyDown) {\n otherProps.onKeyDown(event);\n }\n\n if (event.isDefaultPrevented()) {\n return;\n }\n\n const options = getOptionsFromCollection(event.currentTarget, querySelector);\n\n if (options) {\n if (isAriaDirectionKey(event)) {\n event.preventDefault();\n event.stopPropagation();\n const nextActiveIndex = getNextEnabledItem(event, options, activeIndex);\n\n if (nextActiveIndex !== undefined && nextActiveIndex !== activeIndex) {\n setActiveOption(nextActiveIndex, event.currentTarget, options.item(nextActiveIndex));\n }\n } else if (activeIndex !== undefined && !!options.item(activeIndex)) {\n // forward events onto the underlying option - this lets consumers place onKeyDown handlers on their own components\n options\n .item(activeIndex)\n ?.dispatchEvent(createCustomKeyboardEvent(event as React.KeyboardEvent<HTMLInputElement>));\n }\n }\n };\n\n return <div {...otherProps} onClick={handleClick} onKeyDown={handleKeyDown} ref={internalRef} tabIndex={tabIndex} />;\n});\n\nexport const getNextIndexFromKeycode = (\n event: React.KeyboardEvent,\n length: number,\n activeIndex: number | undefined\n): number | undefined => {\n switch (event.key) {\n case 'ArrowUp':\n return activeIndex === undefined ? length - 1 : activeIndex > 0 ? activeIndex - 1 : activeIndex;\n\n case 'ArrowDown':\n return activeIndex === undefined ? 0 : activeIndex < length - 1 ? activeIndex + 1 : activeIndex;\n\n case 'Home':\n return 0;\n\n case 'End':\n return length - 1;\n\n default:\n return;\n }\n};\n\nexport const getNextEnabledItem = (\n event: React.KeyboardEvent<HTMLElement>,\n options: NodeListOf<Element>,\n activeIndex: number | undefined,\n recurse = true\n): number | undefined => {\n const nextIndex = getNextIndexFromKeycode(event, options.length, activeIndex);\n\n if (nextIndex !== undefined) {\n if (nextIndex === activeIndex) {\n return activeIndex;\n } else if (options.item(nextIndex) && isSkippableItem(options.item(nextIndex))) {\n // check in the other direction if the first or last item is disabled,\n // but prevent infinite loops if all elements are disabled by disabling recursion\n if (recurse) {\n if (nextIndex === 0) {\n return getNextEnabledItem(\n new KeyboardEvent(event.type, { ...(event as any), key: 'ArrowDown' }) as any,\n options,\n nextIndex,\n false\n );\n } else if (nextIndex === options.length - 1) {\n return getNextEnabledItem(\n new KeyboardEvent(event.type, { ...(event as any), key: 'ArrowUp' }) as any,\n options,\n nextIndex,\n false\n );\n }\n }\n\n return getNextEnabledItem(event, options, nextIndex, recurse);\n }\n }\n\n return nextIndex;\n};\n\nconst isSkippableItem = (element: Element) => {\n return (\n element.getAttribute('role') === 'presentation' ||\n !!element.hasAttribute('disabled') ||\n !!element.getAttribute('aria-disabled') ||\n !!element.getAttribute('aria-hidden')\n );\n};\n"],"names":["getOptionsFromCollection","collection","selector","querySelectorAll","Root","React","forwardRef","CollectionRoot","props","ref","querySelector","tabIndex","otherProps","internalRef","useMergedRef","activeIndex","setActiveIndex","useState","lastLengthRef","useRef","setActiveOption","index","option","_collection$querySele","removeAttribute","setAttribute","scrollIntoView","block","setActiveIndexByElement","useCallback","current","matches","options","nextActiveIndex","Array","from","indexOf","useEffect","length","selected","firstSelected","item","selectedIndex","children","handleClick","event","target","currentTarget","handleKeyDown","onKeyDown","isDefaultPrevented","isAriaDirectionKey","preventDefault","stopPropagation","getNextEnabledItem","undefined","_options$item","dispatchEvent","createCustomKeyboardEvent","onClick","getNextIndexFromKeycode","key","recurse","nextIndex","isSkippableItem","KeyboardEvent","type","element","getAttribute","hasAttribute"],"mappings":";;;;;AAiBA,MAAMA,wBAAwB,GAAGA,CAACC,UAA0B,EAAEC,QAAgB,KAC1ED,UAAU,CAACE,gBAAgB,CAACD,QAAQ,CAAC;AAEzC;AACA;AACA;MACaE,IAAI,gBAAGC,cAAK,CAACC,UAAU,CAAiC,SAASC,cAAcA,CAACC,KAAK,EAAEC,GAAG;EACnG,MAAM;IAAEC,aAAa;IAAEC,QAAQ,GAAG,CAAC;IAAE,GAAGC;GAAY,GAAGJ,KAAK;EAC5D,MAAMK,WAAW,GAAGC,YAAY,CAAgBL,GAAG,CAAC;EACpD,MAAM,CAACM,WAAW,EAAEC,cAAc,CAAC,GAAGX,cAAK,CAACY,QAAQ,EAAsB;EAC1E,MAAMC,aAAa,GAAGb,cAAK,CAACc,MAAM,CAAC,CAAC,CAAC;EAErC,MAAMC,eAAe,GAAGA,CAACC,KAAa,EAAEpB,UAA0B,EAAEqB,MAAe;;IAC/E,CAAAC,qBAAA,GAAAtB,UAAU,CAACS,aAAa,CAAC,gBAAgB,CAAC,cAAAa,qBAAA,uBAA1CA,qBAAA,CAA4CC,eAAe,CAAC,cAAc,CAAC;IAC3EF,MAAM,CAACG,YAAY,CAAC,cAAc,EAAE,MAAM,CAAC;IAC3CH,MAAM,CAACI,cAAc,CAAC;MAAEC,KAAK,EAAE;KAAW,CAAC;IAC3CX,cAAc,CAACK,KAAK,CAAC;GACxB;EAED,MAAMO,uBAAuB,GAAGvB,cAAK,CA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AC,CAACD,OAAO,CAACE,YAAY,CAAC,UAAU,CAAC,IAClC,CAAC,CAACF,OAAO,CAACC,YAAY,CAAC,eAAe,CAAC,IACvC,CAAC,CAACD,OAAO,CAACC,YAAY,CAAC,aAAa,CAAC;AAE7C,CAAC;;;;"}
1
+ {"version":3,"file":"Root.js","sources":["../../../../../../../../src/primitives/Collection/components/Root.tsx"],"sourcesContent":["import React from 'react';\nimport { useMergedRef } from '../../../hooks/useMergedRef';\nimport { isAriaDirectionKey } from '../../../utils/aria';\nimport { createCustomKeyboardEvent } from '../../../utils/input';\n\n/* This component provides a keyboard navigable collection primitive for use in lists\n * It is unlikely you need to edit this component\n */\n\nexport type CollectionProps = React.HTMLAttributes<HTMLDivElement> & {\n querySelector: string;\n resetOnChange?: unknown;\n};\n\nexport type CollectionRef = HTMLDivElement & {\n setActiveIndexByElement: (option: HTMLDivElement) => void;\n};\n\nconst getOptionsFromCollection = (collection: HTMLDivElement, selector: string): NodeListOf<Element> =>\n collection.querySelectorAll(selector);\n\n// we use javascript to set attributes (rather than cloning children and adding them)\n// so that we can support nesting (e.g. groups) - child elements that aren't options.\n// without doing this we would have to unwrap and flatten all groups\nexport const Root = React.forwardRef<CollectionRef, CollectionProps>(function CollectionRoot(props, ref) {\n const { querySelector, resetOnChange, tabIndex = 0, ...otherProps } = props;\n const internalRef = useMergedRef<CollectionRef>(ref);\n const [activeIndex, setActiveIndex] = React.useState<number | undefined>();\n\n const setActiveOption = (index: number, collection: HTMLDivElement, option: Element) => {\n collection.querySelector(`[aria-current]`)?.removeAttribute('aria-current');\n option.setAttribute('aria-current', 'true');\n option.scrollIntoView({ block: 'nearest' });\n setActiveIndex(index);\n };\n\n const setActiveIndexByElement = React.useCallback(\n (option: HTMLDivElement) => {\n if (internalRef.current) {\n if (option.matches(querySelector)) {\n const options = getOptionsFromCollection(internalRef.current, querySelector);\n const nextActiveIndex = Array.from(options).indexOf(option);\n\n if (nextActiveIndex > -1) {\n setActiveOption(nextActiveIndex, internalRef.current, option);\n }\n }\n }\n },\n [internalRef.current, querySelector]\n );\n\n React.useEffect(() => {\n if (internalRef.current) {\n internalRef.current.setActiveIndexByElement = setActiveIndexByElement;\n }\n }, [internalRef.current]);\n\n React.useEffect(() => {\n if (internalRef.current) {\n const selected = internalRef.current.querySelectorAll(`[aria-current=\"true\"]`);\n const options = getOptionsFromCollection(internalRef.current, querySelector);\n\n if (options.length && selected.length === 1) {\n const firstSelected = internalRef.current.querySelector(`[aria-selected]`);\n\n if (firstSelected) {\n const selectedIndex = Array.from(options).indexOf(firstSelected);\n\n if (selectedIndex > -1) {\n setActiveOption(selectedIndex, internalRef.current, firstSelected);\n }\n }\n }\n }\n }, [resetOnChange]);\n\n React.useEffect(() => {\n if (internalRef.current) {\n const options = getOptionsFromCollection(internalRef.current, querySelector);\n\n if (options.length) {\n let selected = internalRef.current.querySelectorAll(`[aria-current=\"true\"]`);\n\n // if nothing is current (keyboard visible), look for selected items\n if (selected.length === 0) {\n selected = internalRef.current.querySelectorAll(`[aria-selected]`);\n }\n\n // if one item is selected, make sure it's current\n if (selected.length === 1) {\n if (options) {\n const firstSelected = selected.item(0);\n const selectedIndex = Array.from(options).indexOf(firstSelected);\n\n if (selectedIndex > -1) {\n setActiveOption(selectedIndex, internalRef.current, firstSelected);\n }\n }\n } else {\n // multiple selected or none selected should go to 0\n setActiveOption(0, internalRef.current, options.item(0));\n }\n }\n }\n }, [props.children]);\n\n const handleClick = (event: React.MouseEvent<HTMLDivElement>) => {\n const option = event.target as HTMLElement;\n\n if (option.matches(querySelector)) {\n const options = getOptionsFromCollection(event.currentTarget, querySelector);\n const nextActiveIndex = Array.from(options).indexOf(option);\n\n if (nextActiveIndex > -1) {\n setActiveOption(nextActiveIndex, event.currentTarget, option);\n }\n }\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n // this stops the event dispatched to the option rebounding back and starting an infinite loop\n if (event.target !== event.currentTarget) {\n return;\n }\n\n if (otherProps.onKeyDown) {\n otherProps.onKeyDown(event);\n }\n\n if (event.isDefaultPrevented()) {\n return;\n }\n\n const options = getOptionsFromCollection(event.currentTarget, querySelector);\n\n if (options) {\n if (isAriaDirectionKey(event)) {\n event.preventDefault();\n event.stopPropagation();\n const nextActiveIndex = getNextEnabledItem(event, options, activeIndex);\n\n if (nextActiveIndex !== undefined && nextActiveIndex !== activeIndex) {\n setActiveOption(nextActiveIndex, event.currentTarget, options.item(nextActiveIndex));\n }\n } else if (activeIndex !== undefined && !!options.item(activeIndex)) {\n // forward events onto the underlying option - this lets consumers place onKeyDown handlers on their own components\n options\n .item(activeIndex)\n ?.dispatchEvent(createCustomKeyboardEvent(event as React.KeyboardEvent<HTMLInputElement>));\n }\n }\n };\n\n return <div {...otherProps} onClick={handleClick} onKeyDown={handleKeyDown} ref={internalRef} tabIndex={tabIndex} />;\n});\n\nexport const getNextIndexFromKeycode = (\n event: React.KeyboardEvent,\n length: number,\n activeIndex: number | undefined\n): number | undefined => {\n switch (event.key) {\n case 'ArrowUp':\n return activeIndex === undefined ? length - 1 : activeIndex > 0 ? activeIndex - 1 : activeIndex;\n\n case 'ArrowDown':\n return activeIndex === undefined ? 0 : activeIndex < length - 1 ? activeIndex + 1 : activeIndex;\n\n case 'Home':\n return 0;\n\n case 'End':\n return length - 1;\n\n default:\n return;\n }\n};\n\nexport const getNextEnabledItem = (\n event: React.KeyboardEvent<HTMLElement>,\n options: NodeListOf<Element>,\n activeIndex: number | undefined,\n recurse = true\n): number | undefined => {\n const nextIndex = getNextIndexFromKeycode(event, options.length, activeIndex);\n\n if (nextIndex !== undefined) {\n if (nextIndex === activeIndex) {\n return activeIndex;\n } else if (options.item(nextIndex) && isSkippableItem(options.item(nextIndex))) {\n // check in the other direction if the first or last item is disabled,\n // but prevent infinite loops if all elements are disabled by disabling recursion\n if (recurse) {\n if (nextIndex === 0) {\n return getNextEnabledItem(\n new KeyboardEvent(event.type, { ...(event as any), key: 'ArrowDown' }) as any,\n options,\n nextIndex,\n false\n );\n } else if (nextIndex === options.length - 1) {\n return getNextEnabledItem(\n new KeyboardEvent(event.type, { ...(event as any), key: 'ArrowUp' }) as any,\n options,\n nextIndex,\n false\n );\n }\n }\n\n return getNextEnabledItem(event, options, nextIndex, recurse);\n }\n }\n\n return nextIndex;\n};\n\nconst isSkippableItem = (element: Element) => {\n return (\n element.getAttribute('role') === 'presentation' ||\n !!element.hasAttribute('disabled') ||\n !!element.getAttribute('aria-disabled') ||\n !!element.getAttribute('aria-hidden')\n );\n};\n"],"names":["getOptionsFromCollection","collection","selector","querySelectorAll","Root","React","forwardRef","CollectionRoot","props","ref","querySelector","resetOnChange","tabIndex","otherProps","internalRef","useMergedRef","activeIndex","setActiveIndex","useState","setActiveOption","index","option","_collection$querySele","removeAttribute","setAttribute","scrollIntoView","block","setActiveIndexByElement","useCallback","current","matches","options","nextActiveIndex","Array","from","indexOf","useEffect","selected","length","firstSelected","selectedIndex","item","children","handleClick","event","target","currentTarget","handleKeyDown","onKeyDown","isDefaultPrevented","isAriaDirectionKey","preventDefault","stopPropagation","getNextEnabledItem","undefined","_options$item","dispatchEvent","createCustomKeyboardEvent","onClick","getNextIndexFromKeycode","key","recurse","nextIndex","isSkippableItem","KeyboardEvent","type","element","getAttribute","hasAttribute"],"mappings":";;;;;AAkBA,MAAMA,wBAAwB,GAAGA,CAACC,UAA0B,EAAEC,QAAgB,KAC1ED,UAAU,CAACE,gBAAgB,CAACD,QAAQ,CAAC;AAEzC;AACA;AACA;MACaE,IAAI,gBAAGC,cAAK,CAACC,UAAU,CAAiC,SAASC,cAAcA,CAACC,KAAK,EAAEC,GAAG;EACnG,MAAM;IAAEC,aAAa;IAAEC,aAAa;IAAEC,QAAQ,GAAG,CAAC;IAAE,GAAGC;GAAY,GAAGL,KAAK;EAC3E,MAAMM,WAAW,GAAGC,YAAY,CAAgBN,GAAG,CAAC;EACpD,MAAM,CAACO,WAAW,EAAEC,cAAc,CAAC,GAAGZ,cAAK,CAACa,QAAQ,EAAsB;EAE1E,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AM,EAAEtB,WAAW,CAAC;EAE7E,IAAI8C,SAAS,KAAKR,SAAS,EAAE;IACzB,IAAIQ,SAAS,KAAK9C,WAAW,EAAE;MAC3B,OAAOA,WAAW;KACrB,MAAM,IAAIe,OAAO,CAACU,IAAI,CAACqB,SAAS,CAAC,IAAIC,eAAe,CAAChC,OAAO,CAACU,IAAI,CAACqB,SAAS,CAAC,CAAC,EAAE;;;MAG5E,IAAID,OAAO,EAAE;QACT,IAAIC,SAAS,KAAK,CAAC,EAAE;UACjB,OAAOT,kBAAkB,CACrB,IAAIW,aAAa,CAACpB,KAAK,CAACqB,IAAI,EAAE;YAAE,GAAIrB,KAAa;YAAEgB,GAAG,EAAE;WAAa,CAAQ,EAC7E7B,OAAO,EACP+B,SAAS,EACT,KAAK,CACR;SACJ,MAAM,IAAIA,SAAS,KAAK/B,OAAO,CAACO,MAAM,GAAG,CAAC,EAAE;UACzC,OAAOe,kBAAkB,CACrB,IAAIW,aAAa,CAACpB,KAAK,CAACqB,IAAI,EAAE;YAAE,GAAIrB,KAAa;YAAEgB,GAAG,EAAE;WAAW,CAAQ,EAC3E7B,OAAO,EACP+B,SAAS,EACT,KAAK,CACR;;;MAIT,OAAOT,kBAAkB,CAACT,KAAK,EAAEb,OAAO,EAAE+B,SAAS,EAAED,OAAO,CAAC;;;EAIrE,OAAOC,SAAS;AACpB;AAEA,MAAMC,eAAe,GAAIG,OAAgB;EACrC,OACIA,OAAO,CAACC,YAAY,CAAC,MAAM,CAAC,KAAK,cAAc,IAC/C,CAAC,CAACD,OAAO,CAACE,YAAY,CAAC,UAAU,CAAC,IAClC,CAAC,CAACF,OAAO,CAACC,YAAY,CAAC,eAAe,CAAC,IACvC,CAAC,CAACD,OAAO,CAACC,YAAY,CAAC,aAAa,CAAC;AAE7C,CAAC;;;;"}
@@ -36,6 +36,7 @@ const Root = /*#__PURE__*/React__default.forwardRef(function Listbox2(props, ref
36
36
  id: id,
37
37
  querySelector: customSelector ? `${DEFAULT_SELECTOR}, ${customSelector}` : DEFAULT_SELECTOR,
38
38
  ref: ref,
39
+ resetOnChange: value,
39
40
  role: "listbox"
40
41
  }), children)));
41
42
  });
@@ -1 +1 @@
1
- {"version":3,"file":"Root.js","sources":["../../../../../../../../src/primitives/Listbox2/components/Root.tsx"],"sourcesContent":["import React from 'react';\nimport { useId } from '../../../hooks/useId';\nimport * as CollectionPrimitive from '../../Collection/Collection';\nimport { Listbox2Value } from '../types';\nimport { Listbox2Context } from './Context';\n\nexport type Listbox2Props = React.HTMLAttributes<HTMLDivElement> & {\n customSelector?: string;\n disabled?: boolean;\n multiple?: boolean;\n readOnly?: boolean;\n setValue: (value: Listbox2Value) => void;\n value?: Listbox2Value;\n};\n\nconst DEFAULT_SELECTOR = '[role=\"option\"]';\n\nexport const Root = React.forwardRef<CollectionPrimitive.CollectionRef, Listbox2Props>(function Listbox2(props, ref) {\n const {\n children,\n customSelector,\n disabled = false,\n id: nativeId,\n multiple,\n readOnly = false,\n setValue,\n title,\n value,\n ...otherProps\n } = props;\n // The id name cannot start with a number, otherwise unit tests will fail when trying to querry element with such id.\n // That's why adding prefix.\n const id = 'listbox2-' + useId(nativeId);\n\n const context = React.useMemo(\n () => ({\n disabled,\n readOnly,\n setValue,\n value,\n }),\n [disabled, readOnly, value]\n );\n\n return (\n <Listbox2Context.Provider value={context}>\n <div data-taco=\"listbox2\">\n <CollectionPrimitive.Root\n {...otherProps}\n aria-multiselectable={multiple ? true : undefined}\n id={id}\n querySelector={customSelector ? `${DEFAULT_SELECTOR}, ${customSelector}` : DEFAULT_SELECTOR}\n ref={ref}\n role=\"listbox\">\n {children}\n </CollectionPrimitive.Root>\n </div>\n </Listbox2Context.Provider>\n );\n});\n\nexport const createListboxValueSetter =\n (multiple: boolean, setValue: React.Dispatch<React.SetStateAction<Listbox2Value | undefined>>) =>\n (nextValue: Listbox2Value) => {\n setValue(value => {\n if (Array.isArray(nextValue)) {\n return nextValue;\n }\n\n if (multiple) {\n if (value === undefined) {\n return [nextValue];\n } else if (Array.isArray(value)) {\n if (value.includes(nextValue)) {\n return value.filter(v => v !== nextValue);\n }\n\n return [...value, nextValue];\n } else if (value === nextValue) {\n return [];\n }\n\n return [value, nextValue];\n }\n\n return nextValue;\n });\n };\n"],"names":["DEFAULT_SELECTOR","Root","React","forwardRef","Listbox2","props","ref","children","customSelector","disabled","id","nativeId","multiple","readOnly","setValue","title","value","otherProps","useId","context","useMemo","Listbox2Context","Provider","CollectionPrimitive","undefined","querySelector","role","createListboxValueSetter","nextValue","Array","isArray","includes","filter","v"],"mappings":";;;;;;AAeA,MAAMA,gBAAgB,GAAG,iBAAiB;MAE7BC,IAAI,gBAAGC,cAAK,CAACC,UAAU,CAAmD,SAASC,QAAQA,CAACC,KAAK,EAAEC,GAAG;EAC/G,MAAM;IACFC,QAAQ;IACRC,cAAc;IACdC,QAAQ,GAAG,KAAK;IAChBC,EAAE,EAAEC,QAAQ;IACZC,QAAQ;IACRC,QAAQ,GAAG,KAAK;IAChBC,QAAQ;IACRC,KAAK;IACLC,KAAK;IACL,GAAGC;GACN,GAAGZ,KAAK;;;EAGT,MAAMK,EAAE,GAAG,WAAW,GAAGQ,KAAK,CAACP,QAAQ,CAAC;EAExC,MAAMQ,OAAO,GAAGjB,cAAK,CAACkB,OAAO,CACzB,OAAO;IACHX,QAAQ;IACRI,QAAQ;IACRC,QAAQ;IACRE;GACH,CAAC,EACF,CAACP,QAAQ,EAAEI,QAAQ,EAAEG,KAAK,CAAC,CAC9B;EAED,oBACId,6BAACmB,eAAe,CAACC,QAAQ;IAACN,KAAK,EAAEG;kBAC7BjB;iBAAe;kBACXA,6BAACqB,MAAwB,oBACjBN,UAAU;4BACQL,QAAQ,GAAG,IAAI,GAAGY,SAAS;IACjDd,EAAE,EAAEA,EAAE;IACNe,aAAa,EAAEjB,cAAc,GAAG,GAAGR,gBAAgB,KAAKQ,cAAc,EAAE,GAAGR,gBAAgB;IAC3FM,GAAG,EAAEA,GAAG;IACRoB,IAAI,EAAC;MACJnB,QAAQ,CACc,CACzB,CACiB;AAEnC,CAAC;MAEYoB,wBAAwB,GACjCA,CAACf,QAAiB,EAAEE,QAAyE,KAC5Fc,SAAwB;EACrBd,QAAQ,CAACE,KAAK;IACV,IAAIa,KAAK,CAACC,OAAO,CAACF,SAAS,CAAC,EAAE;MAC1B,OAAOA,SAAS;;IAGpB,IAAIhB,QAAQ,EAAE;MACV,IAAII,KAAK,KAAKQ,SAAS,EAAE;QACrB,OAAO,CAACI,SAAS,CAAC;OACrB,MAAM,IAAIC,KAAK,CAACC,OAAO,CAACd,KAAK,CAAC,EAAE;QAC7B,IAAIA,KAAK,CAACe,QAAQ,CAACH,SAAS,CAAC,EAAE;UAC3B,OAAOZ,KAAK,CAACgB,MAAM,CAACC,CAAC,IAAIA,CAAC,KAAKL,SAAS,CAAC;;QAG7C,OAAO,CAAC,GAAGZ,KAAK,EAAEY,SAAS,CAAC;OAC/B,MAAM,IAAIZ,KAAK,KAAKY,SAAS,EAAE;QAC5B,OAAO,EAAE;;MAGb,OAAO,CAACZ,KAAK,EAAEY,SAAS,CAAC;;IAG7B,OAAOA,SAAS;GACnB,CAAC;AACN;;;;"}
1
+ {"version":3,"file":"Root.js","sources":["../../../../../../../../src/primitives/Listbox2/components/Root.tsx"],"sourcesContent":["import React from 'react';\nimport { useId } from '../../../hooks/useId';\nimport * as CollectionPrimitive from '../../Collection/Collection';\nimport { Listbox2Value } from '../types';\nimport { Listbox2Context } from './Context';\n\nexport type Listbox2Props = React.HTMLAttributes<HTMLDivElement> & {\n customSelector?: string;\n disabled?: boolean;\n multiple?: boolean;\n readOnly?: boolean;\n setValue: (value: Listbox2Value) => void;\n value?: Listbox2Value;\n};\n\nconst DEFAULT_SELECTOR = '[role=\"option\"]';\n\nexport const Root = React.forwardRef<CollectionPrimitive.CollectionRef, Listbox2Props>(function Listbox2(props, ref) {\n const {\n children,\n customSelector,\n disabled = false,\n id: nativeId,\n multiple,\n readOnly = false,\n setValue,\n title,\n value,\n ...otherProps\n } = props;\n // The id name cannot start with a number, otherwise unit tests will fail when trying to querry element with such id.\n // That's why adding prefix.\n const id = 'listbox2-' + useId(nativeId);\n\n const context = React.useMemo(\n () => ({\n disabled,\n readOnly,\n setValue,\n value,\n }),\n [disabled, readOnly, value]\n );\n\n return (\n <Listbox2Context.Provider value={context}>\n <div data-taco=\"listbox2\">\n <CollectionPrimitive.Root\n {...otherProps}\n aria-multiselectable={multiple ? true : undefined}\n id={id}\n querySelector={customSelector ? `${DEFAULT_SELECTOR}, ${customSelector}` : DEFAULT_SELECTOR}\n ref={ref}\n resetOnChange={value}\n role=\"listbox\">\n {children}\n </CollectionPrimitive.Root>\n </div>\n </Listbox2Context.Provider>\n );\n});\n\nexport const createListboxValueSetter =\n (multiple: boolean, setValue: React.Dispatch<React.SetStateAction<Listbox2Value | undefined>>) =>\n (nextValue: Listbox2Value) => {\n setValue(value => {\n if (Array.isArray(nextValue)) {\n return nextValue;\n }\n\n if (multiple) {\n if (value === undefined) {\n return [nextValue];\n } else if (Array.isArray(value)) {\n if (value.includes(nextValue)) {\n return value.filter(v => v !== nextValue);\n }\n\n return [...value, nextValue];\n } else if (value === nextValue) {\n return [];\n }\n\n return [value, nextValue];\n }\n\n return nextValue;\n });\n };\n"],"names":["DEFAULT_SELECTOR","Root","React","forwardRef","Listbox2","props","ref","children","customSelector","disabled","id","nativeId","multiple","readOnly","setValue","title","value","otherProps","useId","context","useMemo","Listbox2Context","Provider","CollectionPrimitive","undefined","querySelector","resetOnChange","role","createListboxValueSetter","nextValue","Array","isArray","includes","filter","v"],"mappings":";;;;;;AAeA,MAAMA,gBAAgB,GAAG,iBAAiB;MAE7BC,IAAI,gBAAGC,cAAK,CAACC,UAAU,CAAmD,SAASC,QAAQA,CAACC,KAAK,EAAEC,GAAG;EAC/G,MAAM;IACFC,QAAQ;IACRC,cAAc;IACdC,QAAQ,GAAG,KAAK;IAChBC,EAAE,EAAEC,QAAQ;IACZC,QAAQ;IACRC,QAAQ,GAAG,KAAK;IACh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AAK,KAAKa,SAAS,EAAE;QAC5B,OAAO,EAAE;;MAGb,OAAO,CAACb,KAAK,EAAEa,SAAS,CAAC;;IAG7B,OAAOA,SAAS;GACnB,CAAC;AACN;;;;"}
@@ -30,7 +30,7 @@ function Container(externalProps) {
30
30
  if (!(activeList !== null && activeList !== void 0 && activeList.id) || !(overList !== null && overList !== void 0 && overList.id) || activeList.id === overList.id) {
31
31
  return;
32
32
  }
33
- move === null || move === void 0 ? void 0 : move(active.id, activeList === null || activeList === void 0 ? void 0 : activeList.id, overList.id);
33
+ move(active.id, activeList === null || activeList === void 0 ? void 0 : activeList.id, overList.id);
34
34
  }
35
35
  function handleDragEnd(event) {
36
36
  const {