@economic/taco 2.44.3 → 2.45.0-alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (444) 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 +11 -1
  267. package/dist/components/Layout/components/Sidebar.d.ts +14 -2
  268. package/dist/components/Layout/components/Top.d.ts +4 -4
  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/RadioGroup/RadioGroup.d.ts +1 -1
  289. package/dist/components/ScrollArea/ScrollArea.d.ts +2 -2
  290. package/dist/components/SearchInput/SearchInput.d.ts +1 -1
  291. package/dist/components/Select/Select.d.ts +1 -1
  292. package/dist/components/Select2/components/All.d.ts +2 -2
  293. package/dist/components/Select2/components/Collection.d.ts +1 -1
  294. package/dist/components/Select2/components/Create.d.ts +1 -1
  295. package/dist/components/Select2/components/Edit.d.ts +2 -2
  296. package/dist/components/Select2/components/Group.d.ts +1 -1
  297. package/dist/components/Select2/components/Option.d.ts +1 -1
  298. package/dist/components/Select2/components/Search.d.ts +3 -3
  299. package/dist/components/Select2/components/Trigger.d.ts +1 -1
  300. package/dist/components/Select2/hooks/useChildren.d.ts +2 -2
  301. package/dist/components/Shortcut/Shortcut.d.ts +1 -1
  302. package/dist/components/Table3/components/Columns/Cell/Cell.d.ts +2 -2
  303. package/dist/components/Table3/components/Columns/Cell/Editing/RowMoveIndicator.d.ts +1 -1
  304. package/dist/components/Table3/components/Columns/Cell/EditingControlCell.d.ts +2 -2
  305. package/dist/components/Table3/components/Columns/Internal/EditingActionsMenu.d.ts +2 -2
  306. package/dist/components/Table3/components/Editing/Alert.d.ts +1 -1
  307. package/dist/components/Table3/components/Row/Editing/CreateRowButton.d.ts +2 -2
  308. package/dist/components/Table3/components/Row/Editing/SaveStatus.d.ts +2 -2
  309. package/dist/components/Table3/components/Row/Row.d.ts +2 -2
  310. package/dist/components/Table3/components/Toolbar/Editing/Editing.d.ts +1 -1
  311. package/dist/components/Table3/features/useTableEditing.d.ts +2 -2
  312. package/dist/components/Table3/util/editing.d.ts +1 -1
  313. package/dist/components/Tag/Tag.d.ts +2 -2
  314. package/dist/components/Tooltip/Tooltip.d.ts +1 -1
  315. package/dist/components/Tour/Tour.d.ts +3 -3
  316. package/dist/components/Truncate/Truncate.d.ts +1 -1
  317. package/dist/esm/packages/taco/src/components/Accordion/Accordion.js +14 -6
  318. package/dist/esm/packages/taco/src/components/Accordion/Accordion.js.map +1 -1
  319. package/dist/esm/packages/taco/src/components/Datepicker/useDatepicker.js.map +1 -1
  320. package/dist/esm/packages/taco/src/components/Dialog/Dialog.js.map +1 -1
  321. package/dist/esm/packages/taco/src/components/Dialog/components/Content.js +3 -3
  322. package/dist/esm/packages/taco/src/components/Dialog/components/Content.js.map +1 -1
  323. package/dist/esm/packages/taco/src/components/Dialog/components/DialogDrawer.js.map +1 -1
  324. package/dist/esm/packages/taco/src/components/Header/components/Agreement/Avatar.js.map +1 -1
  325. package/dist/esm/packages/taco/src/components/Header/components/AgreementSelector.js +5 -3
  326. package/dist/esm/packages/taco/src/components/Header/components/AgreementSelector.js.map +1 -1
  327. package/dist/esm/packages/taco/src/components/Input/util.js.map +1 -1
  328. package/dist/esm/packages/taco/src/components/Layout/components/Sidebar.js.map +1 -1
  329. package/dist/esm/packages/taco/src/components/Layout/components/Top.js +2 -2
  330. package/dist/esm/packages/taco/src/components/Layout/components/Top.js.map +1 -1
  331. package/dist/esm/packages/taco/src/components/Listbox/util.js +7 -1
  332. package/dist/esm/packages/taco/src/components/Listbox/util.js.map +1 -1
  333. package/dist/esm/packages/taco/src/components/Menu/components/Item.js.map +1 -1
  334. package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js.map +1 -1
  335. package/dist/esm/packages/taco/src/components/Popover/Popover.js.map +1 -1
  336. package/dist/esm/packages/taco/src/components/RadioGroup/RadioGroup.js.map +1 -1
  337. package/dist/esm/packages/taco/src/components/ScrollArea/ScrollArea.js +4 -4
  338. package/dist/esm/packages/taco/src/components/ScrollArea/ScrollArea.js.map +1 -1
  339. package/dist/esm/packages/taco/src/components/Select/Select.js.map +1 -1
  340. package/dist/esm/packages/taco/src/components/Select/useSelect.js.map +1 -1
  341. package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
  342. package/dist/esm/packages/taco/src/components/Select2/components/Create.js +11 -10
  343. package/dist/esm/packages/taco/src/components/Select2/components/Create.js.map +1 -1
  344. package/dist/esm/packages/taco/src/components/Select2/components/Edit.js +0 -2
  345. package/dist/esm/packages/taco/src/components/Select2/components/Edit.js.map +1 -1
  346. package/dist/esm/packages/taco/src/components/Select2/components/Option.js.map +1 -1
  347. package/dist/esm/packages/taco/src/components/Select2/components/Search.js.map +1 -1
  348. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js.map +1 -1
  349. package/dist/esm/packages/taco/src/components/Table/components/WindowedTable.js.map +1 -1
  350. package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowEditing.js.map +1 -1
  351. package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowSelect.js.map +1 -1
  352. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/Editing/RowMoveIndicator.js.map +1 -1
  353. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingControlCell.js.map +1 -1
  354. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Internal/EditingActionsMenu.js.map +1 -1
  355. package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js.map +1 -1
  356. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateRowButton.js.map +1 -1
  357. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/SaveStatus.js +1 -1
  358. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/SaveStatus.js.map +1 -1
  359. package/dist/esm/packages/taco/src/components/Table3/components/Row/Row.js +4 -1
  360. package/dist/esm/packages/taco/src/components/Table3/components/Row/Row.js.map +1 -1
  361. package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js.map +1 -1
  362. package/dist/esm/packages/taco/src/components/Table3/util/editing.js +5 -2
  363. package/dist/esm/packages/taco/src/components/Table3/util/editing.js.map +1 -1
  364. package/dist/esm/packages/taco/src/components/Toast/Toast.js.map +1 -1
  365. package/dist/esm/packages/taco/src/components/Tour/Tour.js +3 -3
  366. package/dist/esm/packages/taco/src/components/Tour/Tour.js.map +1 -1
  367. package/dist/esm/packages/taco/src/hooks/useGlobalKeyDown.js.map +1 -1
  368. package/dist/esm/packages/taco/src/hooks/useIntersectionObserver.js.map +1 -1
  369. package/dist/esm/packages/taco/src/primitives/Sortable/components/Container.js +1 -1
  370. package/dist/esm/packages/taco/src/primitives/Sortable/components/Container.js.map +1 -1
  371. package/dist/esm/packages/taco/src/primitives/Sortable/components/Item.js.map +1 -1
  372. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Body/util.js +4 -4
  373. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Body/util.js.map +1 -1
  374. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Expansion.js.map +1 -1
  375. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/Header.js.map +1 -1
  376. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Goto.js.map +1 -1
  377. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Menu.js +2 -2
  378. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Menu.js.map +1 -1
  379. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Resizer.js.map +1 -1
  380. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/SortIndicator.js.map +1 -1
  381. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/util.js.map +1 -1
  382. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/Filters.js.map +1 -1
  383. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/ManageFiltersPopover.js.map +1 -1
  384. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterValue.js +3 -1
  385. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterValue.js.map +1 -1
  386. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Print/Print.js.map +1 -1
  387. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Settings/HideOrOrderPopover.js.map +1 -1
  388. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Settings/Settings.js.map +1 -1
  389. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js.map +1 -1
  390. package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -1
  391. package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js.map +1 -1
  392. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSearch.js +3 -3
  393. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSearch.js.map +1 -1
  394. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSettings.js.map +1 -1
  395. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSettingsListener.js.map +1 -1
  396. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableShortcutsListener.js.map +1 -1
  397. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js.map +1 -1
  398. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/search.js.map +1 -1
  399. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/settings.js.map +1 -1
  400. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js.map +1 -1
  401. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/sorting.js.map +1 -1
  402. package/dist/esm/packages/taco/src/utils/dom.js +3 -2
  403. package/dist/esm/packages/taco/src/utils/dom.js.map +1 -1
  404. package/dist/primitives/BubbleSelect.d.ts +1 -1
  405. package/dist/primitives/Sortable/components/Container.d.ts +2 -2
  406. package/dist/primitives/Sortable/components/Item.d.ts +2 -1
  407. package/dist/primitives/Sortable/components/List.d.ts +1 -1
  408. package/dist/primitives/Table/Core/Table.d.ts +2 -2
  409. package/dist/primitives/Table/Core/components/Body/Body.d.ts +1 -1
  410. package/dist/primitives/Table/Core/components/Body/EmptyStateBody.d.ts +1 -1
  411. package/dist/primitives/Table/Core/components/Body/util.d.ts +4 -4
  412. package/dist/primitives/Table/Core/components/Columns/Cell/BuiltIns/DisplayCell.d.ts +2 -2
  413. package/dist/primitives/Table/Core/components/Columns/Cell/BuiltIns/GroupedCell.d.ts +2 -2
  414. package/dist/primitives/Table/Core/components/Columns/Cell/Cell.d.ts +1 -1
  415. package/dist/primitives/Table/Core/components/Columns/Internal/Actions.d.ts +2 -2
  416. package/dist/primitives/Table/Core/components/Footer/Footer.d.ts +3 -3
  417. package/dist/primitives/Table/Core/components/Footer/Summary.d.ts +2 -2
  418. package/dist/primitives/Table/Core/components/Header/Header.d.ts +1 -1
  419. package/dist/primitives/Table/Core/components/Header/components/Goto.d.ts +2 -2
  420. package/dist/primitives/Table/Core/components/Header/components/Menu.d.ts +1 -1
  421. package/dist/primitives/Table/Core/components/Header/components/Resizer.d.ts +2 -2
  422. package/dist/primitives/Table/Core/components/Header/components/SortIndicator.d.ts +3 -3
  423. package/dist/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.d.ts +2 -2
  424. package/dist/primitives/Table/Core/components/Row/Row.d.ts +1 -1
  425. package/dist/primitives/Table/Core/components/Toolbar/Toolbar.d.ts +1 -1
  426. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/Filters.d.ts +2 -2
  427. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/ManageFiltersPopover.d.ts +2 -2
  428. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/components/Filter.d.ts +2 -2
  429. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterColumn.d.ts +1 -1
  430. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterComparator.d.ts +2 -2
  431. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterValue.d.ts +2 -2
  432. package/dist/primitives/Table/Core/components/Toolbar/components/Print/Print.d.ts +1 -1
  433. package/dist/primitives/Table/Core/components/Toolbar/components/Print/PrintDialog.d.ts +2 -2
  434. package/dist/primitives/Table/Core/components/Toolbar/components/Search/Search.d.ts +1 -1
  435. package/dist/primitives/Table/Core/components/Toolbar/components/Settings/HideOrOrderPopover.d.ts +2 -2
  436. package/dist/primitives/Table/Core/components/Toolbar/components/Settings/Settings.d.ts +2 -2
  437. package/dist/primitives/Table/Core/features/useTableStyle.d.ts +1 -1
  438. package/dist/primitives/Table/useTableManager/util/settings.d.ts +1 -1
  439. package/dist/taco.cjs.development.js +72 -48
  440. package/dist/taco.cjs.development.js.map +1 -1
  441. package/dist/taco.cjs.production.min.js +1 -1
  442. package/dist/taco.cjs.production.min.js.map +1 -1
  443. package/dist/utils/dom.d.ts +1 -1
  444. package/package.json +12 -14
@@ -15,7 +15,10 @@ function Row(props) {
15
15
  const isActiveRow = tableMeta.rowActive.rowActiveIndex === index;
16
16
  React__default.useEffect(() => {
17
17
  if (tableMeta.editing.isEditing && isActiveRow && tableMeta.editing.lastFocusedCellIndex === undefined) {
18
- setDataFocusAttribute(focusManager.focusFirst());
18
+ const element = focusManager.focusFirst();
19
+ if (element) {
20
+ setDataFocusAttribute(element);
21
+ }
19
22
  }
20
23
  }, [tableMeta.editing.isEditing, tableMeta.rowActive.rowActiveIndex, tableMeta.editing.lastFocusedCellIndex]);
21
24
  const handleFocus = React__default.useCallback(event => {
@@ -1 +1 @@
1
- {"version":3,"file":"Row.js","sources":["../../../../../../../../../src/components/Table3/components/Row/Row.tsx"],"sourcesContent":["import React from 'react';\nimport { TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { DisplayRow, DisplayRowProps } from '../../../../primitives/Table/Core/components/Row/BuiltIns/DisplayRow';\nimport { SaveStatus } from './Editing/SaveStatus';\nimport { useAugmentedFocusManager } from '../../../../primitives/Table/Core/components/Body/util';\nimport { setDataFocusAttribute } from '../../../../utils/dom';\n\nexport function Row<TType = unknown>(props: DisplayRowProps<TType>) {\n const { row, index, table } = props;\n const focusManager = useAugmentedFocusManager();\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const isActiveRow = tableMeta.rowActive.rowActiveIndex === index;\n\n React.useEffect(() => {\n if (tableMeta.editing.isEditing && isActiveRow && tableMeta.editing.lastFocusedCellIndex === undefined) {\n setDataFocusAttribute(focusManager.focusFirst());\n }\n }, [tableMeta.editing.isEditing, tableMeta.rowActive.rowActiveIndex, tableMeta.editing.lastFocusedCellIndex]);\n\n const handleFocus = React.useCallback(\n (event: React.FocusEvent<HTMLTableRowElement>) => {\n if (tableMeta.editing.isEditing) {\n const cellIndex = Number(event.target.closest('td')?.getAttribute('data-cell-index') ?? undefined);\n\n if (!isNaN(cellIndex)) {\n tableMeta.editing.setLastFocusedCellIndex(Number(cellIndex));\n }\n }\n },\n [tableMeta.editing.isEditing, isActiveRow]\n );\n\n const attributes = {\n 'data-row-editing-invalid':\n tableMeta.editing.isEnabled && tableMeta.editing.hasRowErrors(row.id)\n ? !tableMeta.editing.hasRowErrorsSeen(row.id)\n ? 'unseen'\n : true\n : undefined,\n 'data-row-editing-status':\n tableMeta.editing.isEnabled && tableMeta.editing.getRowSaveStatus(row.id)\n ? tableMeta.editing.getRowSaveStatus(row.id)\n : undefined,\n onFocus: handleFocus,\n };\n\n return (\n <DisplayRow<TType> {...props} {...attributes}>\n {tableMeta.editing.getRowSaveStatus(row.id) ? <SaveStatus rowId={row.id} table={table} /> : null}\n </DisplayRow>\n );\n}\n"],"names":["Row","props","row","index","table","focusManager","useAugmentedFocusManager","tableMeta","options","meta","isActiveRow","rowActive","rowActiveIndex","React","useEffect","editing","isEditing","lastFocusedCellIndex","undefined","setDataFocusAttribute","focusFirst","handleFocus","useCallback","event","_event$target$closest","_event$target$closest2","cellIndex","Number","target","closest","getAttribute","isNaN","setLastFocusedCellIndex","attributes","isEnabled","hasRowErrors","id","hasRowErrorsSeen","getRowSaveStatus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C,CAC7C;EAED,MAAMuB,UAAU,GAAG;IACf,0BAA0B,EACtB1B,SAAS,CAACQ,OAAO,CAACmB,SAAS,IAAI3B,SAAS,CAACQ,OAAO,CAACoB,YAAY,CAACjC,GAAG,CAACkC,EAAE,CAAC,GAC/D,CAAC7B,SAAS,CAACQ,OAAO,CAACsB,gBAAgB,CAACnC,GAAG,CAACkC,EAAE,CAAC,GACvC,QAAQ,GACR,IAAI,GACRlB,SAAS;IACnB,yBAAyB,EACrBX,SAAS,CAACQ,OAAO,CAACmB,SAAS,IAAI3B,SAAS,CAACQ,OAAO,CAACuB,gBAAgB,CAACpC,GAAG,CAACkC,EAAE,CAAC,GACnE7B,SAAS,CAACQ,OAAO,CAACuB,gBAAgB,CAACpC,GAAG,CAACkC,EAAE,CAAC,GAC1ClB,SAAS;IACnBqB,OAAO,EAAElB;GACZ;EAED,oBACIR,6BAAC2B,UAAU,oBAAYvC,KAAK,EAAMgC,UAAU,GACvC1B,SAAS,CAACQ,OAAO,CAACuB,gBAAgB,CAACpC,GAAG,CAACkC,EAAE,CAAC,gBAAGvB,6BAAC4B,UAAU;IAACC,KAAK,EAAExC,GAAG,CAACkC,EAAE;IAAEhC,KAAK,EAAEA;IAAS,GAAG,IAAI,CACvF;AAErB;;;;"}
1
+ {"version":3,"file":"Row.js","sources":["../../../../../../../../../src/components/Table3/components/Row/Row.tsx"],"sourcesContent":["import React from 'react';\nimport { TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { DisplayRow, DisplayRowProps } from '../../../../primitives/Table/Core/components/Row/BuiltIns/DisplayRow';\nimport { SaveStatus } from './Editing/SaveStatus';\nimport { useAugmentedFocusManager } from '../../../../primitives/Table/Core/components/Body/util';\nimport { setDataFocusAttribute } from '../../../../utils/dom';\n\nexport function Row<TType = unknown>(props: DisplayRowProps<TType>) {\n const { row, index, table } = props;\n const focusManager = useAugmentedFocusManager();\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const isActiveRow = tableMeta.rowActive.rowActiveIndex === index;\n\n React.useEffect(() => {\n if (tableMeta.editing.isEditing && isActiveRow && tableMeta.editing.lastFocusedCellIndex === undefined) {\n const element = focusManager.focusFirst();\n if (element) {\n setDataFocusAttribute(element);\n }\n }\n }, [tableMeta.editing.isEditing, tableMeta.rowActive.rowActiveIndex, tableMeta.editing.lastFocusedCellIndex]);\n\n const handleFocus = React.useCallback(\n (event: React.FocusEvent<HTMLTableRowElement>) => {\n if (tableMeta.editing.isEditing) {\n const cellIndex = Number(event.target.closest('td')?.getAttribute('data-cell-index') ?? undefined);\n\n if (!isNaN(cellIndex)) {\n tableMeta.editing.setLastFocusedCellIndex(Number(cellIndex));\n }\n }\n },\n [tableMeta.editing.isEditing, isActiveRow]\n );\n\n const attributes = {\n 'data-row-editing-invalid':\n tableMeta.editing.isEnabled && tableMeta.editing.hasRowErrors(row.id)\n ? !tableMeta.editing.hasRowErrorsSeen(row.id)\n ? 'unseen'\n : true\n : undefined,\n 'data-row-editing-status':\n tableMeta.editing.isEnabled && tableMeta.editing.getRowSaveStatus(row.id)\n ? tableMeta.editing.getRowSaveStatus(row.id)\n : undefined,\n onFocus: handleFocus,\n };\n\n return (\n <DisplayRow<TType> {...props} {...attributes}>\n {tableMeta.editing.getRowSaveStatus(row.id) ? <SaveStatus rowId={row.id} table={table} /> : null}\n </DisplayRow>\n );\n}\n"],"names":["Row","props","row","index","table","focusManager","useAugmentedFocusManager","tableMeta","options","meta","isActiveRow","rowActive","rowActiveIndex","React","useEffect","editing","isEditing","lastFocusedCellIndex","undefined","element","focusFirst","setDataFocusAttribute","handleFocus","useCallback","event","_event$target$closest","_event$target$closest2","cellIndex","Number","target","closest","getAttribute","isNaN","setLastFocusedCellIndex","attributes","isEnabled","hasRowErrors","id","hasRowErrorsSeen","getRowSaveStatus","onFocus","DisplayRow","SaveStatus","rowId"],"mappings":";;;;;;SAOgBA,GAAGA,CAAkBC,KAA6B;EAC9D,MAAM;IAAEC,GAAG;IAAEC,KAAK;IAAEC;GAAO,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AAO,CAACoB,SAAS,IAAI5B,SAAS,CAACQ,OAAO,CAACqB,YAAY,CAAClC,GAAG,CAACmC,EAAE,CAAC,GAC/D,CAAC9B,SAAS,CAACQ,OAAO,CAACuB,gBAAgB,CAACpC,GAAG,CAACmC,EAAE,CAAC,GACvC,QAAQ,GACR,IAAI,GACRnB,SAAS;IACnB,yBAAyB,EACrBX,SAAS,CAACQ,OAAO,CAACoB,SAAS,IAAI5B,SAAS,CAACQ,OAAO,CAACwB,gBAAgB,CAACrC,GAAG,CAACmC,EAAE,CAAC,GACnE9B,SAAS,CAACQ,OAAO,CAACwB,gBAAgB,CAACrC,GAAG,CAACmC,EAAE,CAAC,GAC1CnB,SAAS;IACnBsB,OAAO,EAAElB;GACZ;EAED,oBACIT,6BAAC4B,UAAU,oBAAYxC,KAAK,EAAMiC,UAAU,GACvC3B,SAAS,CAACQ,OAAO,CAACwB,gBAAgB,CAACrC,GAAG,CAACmC,EAAE,CAAC,gBAAGxB,6BAAC6B,UAAU;IAACC,KAAK,EAAEzC,GAAG,CAACmC,EAAE;IAAEjC,KAAK,EAAEA;IAAS,GAAG,IAAI,CACvF;AAErB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useTableEditing.js","sources":["../../../../../../../../src/components/Table3/features/useTableEditing.ts"],"sourcesContent":["import React from 'react';\nimport { Cell as ReactTableCell, Row as ReactTableRow } from '@tanstack/react-table';\nimport { Table3EditingChangeHandler, Table3EditingSaveHandler, Table3EditingValidatorFn } from '../types';\nimport { useGlobalKeyDown } from '../../../hooks/useGlobalKeyDown';\nimport { willRowMove } from '../util/editing';\nimport { debounce } from 'lodash';\nimport { Localization, useLocalization } from '../../Provider/Localization';\n\nexport function useTableEditing<TType = unknown>(\n isEnabled = false,\n handleSave: Table3EditingSaveHandler<TType> | undefined,\n handleChange: Table3EditingChangeHandler<TType> | undefined,\n validator: Table3EditingValidatorFn<TType> | undefined\n) {\n // used to switch the table into editing mode\n const [isEditing, toggleEditing] = React.useState(false);\n\n // used to switch the editing between \"detailed\" mode\n const [isDetailedMode, toggleDetailedMode] = React.useState(false);\n\n // store the last focused cell, so that up/down arrow key navigation remains in the same column\n const [lastFocusedCellIndex, setLastFocusedCellIndex] = useLastFocusedCellIndex();\n\n // store pending changes for each row\n // changes are saved as soon as the active row changes, so in most cases this will only contain the active row's changes\n // but not always - if validation or server requests fail when saving, those rows remain until the failure is resolved\n const pendingChangesFns = usePendingChanges<TType>(isEnabled, handleSave, handleChange, validator);\n\n useGlobalKeyDown(isEnabled && isEditing ? { key: 's', meta: true, shift: false } : undefined, event => {\n event.preventDefault();\n pendingChangesFns.saveChanges();\n });\n\n return {\n isEnabled,\n isEditing,\n isDetailedMode,\n toggleDetailedMode: isEnabled ? toggleDetailedMode : () => undefined,\n toggleEditing: isEnabled ? toggleEditing : () => undefined,\n lastFocusedCellIndex,\n setLastFocusedCellIndex,\n ...pendingChangesFns,\n };\n}\n\ntype SaveState = 'pending' | 'complete';\nexport type PendingChange<TType = unknown> = Partial<TType> & {\n _meta: {\n original: TType;\n moveReason: Record<string, 'search' | 'sorting' | 'filter'>;\n errors: {\n row: string;\n cells: Record<string, string>;\n shouldShowErrorAlert: boolean;\n };\n status?: SaveState;\n };\n};\n\ntype PendingChanges<TType = unknown> = Record<string, PendingChange<TType>>;\nfunction usePendingChanges<TType = unknown>(\n isEnabled: boolean,\n handleSave: Table3EditingSaveHandler<TType> | undefined,\n handleChange: Table3EditingChangeHandler<TType> | undefined,\n validator: Table3EditingValidatorFn<TType> | undefined\n) {\n const localization = useLocalization();\n const [pendingChanges, setPendingChanges] = React.useState<PendingChanges<TType>>({});\n // we maintain save status as separate state because 'complete' needs to briefly show after pendingChanges are deleted\n const [saveStates, setSaveState] = React.useState<Record<string, SaveState>>({});\n\n function getCellValue<T extends TType>(cell: ReactTableCell<T, unknown>): unknown | undefined {\n return pendingChanges[cell.row.id]?.[cell.column.id];\n }\n\n function getCellError<T extends TType>(cell: ReactTableCell<T, unknown>): string | undefined {\n return pendingChanges[cell.row.id]?._meta.errors?.cells?.[cell.column.id];\n }\n\n async function addCreatedRowChangeset(row) {\n const cells = row.getAllCells();\n\n setPendingChanges(currentChanges => {\n return cells.reduce((changes, cell) => {\n if (cell.getValue()) {\n return {\n ...changes,\n [cell.row.id]: {\n ...changes[cell.row.id],\n [cell.column.id]: cell.getValue(),\n _meta: {\n ...currentChanges[cell.row.id]?._meta,\n original: cell.row.original,\n moveReason: {\n ...currentChanges[cell.row.id]?._meta.moveReason,\n },\n errors: {\n ...currentChanges[cell.row.id]?._meta.errors,\n },\n },\n },\n };\n } else {\n return changes;\n }\n }, currentChanges);\n });\n }\n const pendingChangesUpdater = usePendingChangesUpdater(handleChange, setPendingChanges);\n\n async function setCellValue<T extends TType>(cell: ReactTableCell<T, unknown>, change: unknown, rowIndex: number) {\n const changes = {\n [cell.column.id]: change,\n } as Partial<T>;\n\n setPendingChanges(currentChanges => {\n const nextChanges = createPendingChangesSetter<T>(\n currentChanges as PendingChanges<T>,\n cell.row,\n rowIndex,\n changes,\n localization\n );\n pendingChangesUpdater.syncCellChanges(nextChanges);\n return nextChanges;\n });\n pendingChangesUpdater.runCellUpdates<T>(changes, cell, rowIndex);\n }\n\n async function validateCell<T extends TType>(cell: ReactTableCell<T, unknown>) {\n if (!validator || !isEnabled) {\n return;\n }\n\n const changeSet = getChangesetFromChanges(pendingChanges[cell.row.id]);\n\n // only validate if the cell being blurred actually has any changes\n if (cell.column.id in changeSet) {\n const errors = ((await validator(changeSet)) ?? {}) as Record<string, string>;\n\n setPendingChanges(currentChanges => {\n const nextChanges = { ...currentChanges };\n nextChanges[cell.row.id]._meta = {\n ...nextChanges[cell.row.id]._meta,\n errors: {\n ...nextChanges[cell.row.id]._meta.errors,\n cells: errors,\n shouldShowErrorAlert: !Object.keys(errors).length\n ? false\n : nextChanges[cell.row.id]._meta.errors.shouldShowErrorAlert,\n },\n };\n return nextChanges;\n });\n }\n }\n\n function hasRowErrors(rowId: string) {\n if (!isEnabled) {\n return false;\n }\n\n return (\n !!pendingChanges[rowId]?._meta.errors?.row || !!Object.keys(pendingChanges[rowId]?._meta.errors?.cells ?? {}).length\n );\n }\n\n function hasRowErrorsSeen(rowId: string) {\n if (!isEnabled) {\n return false;\n }\n\n return hasRowErrors(rowId) && !!pendingChanges[rowId]._meta.errors?.shouldShowErrorAlert;\n }\n function getRowPendingChange(rowId: string) {\n const rowPendingChanges = pendingChanges[rowId];\n\n if (rowPendingChanges) {\n const { _meta, ...pendingChange } = rowPendingChanges;\n\n return pendingChange;\n }\n\n return undefined;\n }\n\n function getRowSaveStatus(rowId: string) {\n if (!isEnabled) {\n return false;\n }\n\n return saveStates[rowId];\n }\n\n function setRowSaveStatus(rowId: string, status: 'pending' | 'complete' | undefined) {\n setSaveState(currentStates => {\n const nextStates = { ...currentStates };\n\n if (status) {\n nextStates[rowId] = status;\n } else {\n delete nextStates[rowId];\n }\n\n return nextStates;\n });\n }\n\n function getRowMoveReason(rowId: string) {\n return pendingChanges[rowId]?._meta.moveReason ? Object.values(pendingChanges[rowId]._meta.moveReason)[0] : undefined;\n }\n\n function hasChanges(rowId?: string) {\n if (!isEnabled) {\n return false;\n }\n\n return rowId ? !!pendingChanges[rowId] : !!Object.keys(pendingChanges).length;\n }\n\n function hasAlertErrors() {\n if (!isEnabled) {\n return false;\n }\n return !!getAlertErrors().length;\n }\n\n function getAlertErrors<T extends TType>() {\n return Object.keys(pendingChanges)\n .filter(hasRowErrorsSeen)\n .map(rowId => ({ rowId, pendingChange: pendingChanges[rowId] as PendingChange<T> }));\n }\n\n function resetChanges(rowId: string) {\n setPendingChanges(currentChanges => {\n const nextChanges = { ...currentChanges };\n delete nextChanges[rowId];\n return nextChanges;\n });\n }\n\n async function saveChanges(rowId: string | undefined = undefined) {\n if (!handleSave) {\n console.warn('Tried to save, but Table has no onEditingSave handler');\n return;\n }\n\n // we save back to pendingChanges, so make a copy of it's state when save was triggered\n const changesToSave = rowId ? { [rowId]: pendingChanges[rowId] } : { ...pendingChanges };\n const changes = Object.keys(changesToSave);\n\n if (changes.length) {\n for (const rowId of changes) {\n const pendingChange = changesToSave[rowId];\n\n const changeSet = getChangesetFromChanges(pendingChange);\n try {\n if (getRowSaveStatus(rowId) === 'pending') return;\n\n // set saving = true\n setRowSaveStatus(rowId, 'pending');\n\n // re-run validation, maybe a cell is already invalid but has never been blurred\n if (validator) {\n const errors = await validator(changeSet);\n\n if (errors && Object.keys(errors).length) {\n throw errors;\n }\n }\n // send new data to the server\n await handleSave(changeSet);\n\n // cleanup changes, we don't need them after saving\n resetChanges(rowId);\n setRowSaveStatus(rowId, 'complete');\n } catch (error) {\n // the onEditingSave handler should throw errors when something fails, e.g. validation, network errors etc\n // this code handles those errors and maps them either to row errors or cell specific errors\n let rowError;\n let cellErrors;\n\n if (typeof error === 'string') {\n rowError = error;\n } else if (error instanceof Error) {\n rowError = error.message;\n\n // most of our apis return error objects within this shape\n if (typeof (error as any).response?.data === 'object') {\n cellErrors = (error as any).response?.data;\n }\n } else if (typeof error === 'object') {\n cellErrors = error;\n }\n\n if (rowError || cellErrors) {\n setPendingChanges(currentChanges => {\n const nextChanges = { ...currentChanges };\n nextChanges[rowId]._meta.errors = {\n row: rowError,\n cells: cellErrors,\n shouldShowErrorAlert: true,\n };\n return nextChanges;\n });\n }\n\n setRowSaveStatus(rowId, undefined);\n }\n }\n }\n }\n\n function getCompletedRowsCount() {\n return Object.values(saveStates).filter(value => value === 'complete').length;\n }\n\n return {\n getCellValue,\n getCellError,\n setCellValue,\n validateCell,\n addCreatedRowChangeset,\n hasChanges,\n hasAlertErrors,\n getAlertErrors,\n saveChanges,\n resetChanges,\n hasRowErrors,\n hasRowErrorsSeen,\n getRowPendingChange,\n getRowSaveStatus,\n setRowSaveStatus,\n getRowMoveReason,\n getCompletedRowsCount,\n };\n}\n\nfunction useLastFocusedCellIndex(): [number | undefined, (index: number | undefined) => void] {\n // store the last focused cell, so that up/down arrow key navigation remains in the same column\n const lastFocusedCellIndexRef = React.useRef<number | undefined>(undefined);\n const setLastFocusedCellIndex = React.useCallback((index: number | undefined) => {\n lastFocusedCellIndexRef.current = index;\n }, []);\n\n return [lastFocusedCellIndexRef.current, setLastFocusedCellIndex];\n}\n\nfunction usePendingChangesUpdater<TType = unknown>(\n handleChange: Table3EditingChangeHandler<TType> | undefined,\n setPendingChanges: React.Dispatch<React.SetStateAction<PendingChanges<TType>>>\n) {\n const localization = useLocalization();\n const updatersRef = React.useRef<PendingChanges<TType>>({});\n\n const runCellUpdates = React.useCallback(\n debounce(async function <T extends TType>(changes: Partial<T>, cell: ReactTableCell<T, unknown>, rowIndex: number) {\n if (typeof handleChange === 'function') {\n const previousValues = {\n ...cell.row.original,\n ...getChangesetFromChanges(updatersRef.current[cell.row.id]),\n };\n const nextValues = {\n ...previousValues,\n ...changes,\n };\n const updates = await handleChange(cell.column.id, changes[cell.column.id], nextValues, previousValues);\n\n if (updates && Object.keys(updates).length) {\n setPendingChanges(currentChanges =>\n createPendingChangesSetter(currentChanges, cell.row, rowIndex, updates, localization)\n );\n }\n }\n }, 250),\n []\n ) as unknown as <T extends TType>(changes: Partial<T>, cell: ReactTableCell<T, unknown>, rowIndex: number) => Promise<void>;\n\n function syncCellChanges<T extends TType>(changes: PendingChanges<T>) {\n updatersRef.current = changes;\n }\n\n return {\n syncCellChanges,\n runCellUpdates,\n };\n}\n\nfunction createPendingChangesSetter<TType = unknown>(\n currentChanges: PendingChanges<TType>,\n row: ReactTableRow<TType>,\n rowIndex: number,\n changes: Partial<TType>,\n localization: Localization\n) {\n // prepare\n const nextChanges: PendingChanges<TType> = { ...currentChanges };\n const rowChanges = {\n ...currentChanges[row.id],\n _meta: {\n ...currentChanges[row.id]?._meta,\n original: row.original,\n moveReason: {\n ...currentChanges[row.id]?._meta.moveReason,\n },\n errors: {\n ...currentChanges[row.id]?._meta.errors,\n },\n },\n } as PendingChange<TType>;\n\n // run changes\n const cells = row._getAllCellsByColumnId();\n\n for (const [accessor, change] of Object.entries(changes)) {\n // update if the change is different to the original (saved) value,\n // otherwise remove any change - no point saving the same value\n if (change !== row.original[accessor]) {\n rowChanges[accessor] = change;\n\n // consumers sometimes include properties in onEditingChange that aren't rendered as columns, we need to guard against that.\n // eslint-disable-next-line no-prototype-builtins\n if (cells.hasOwnProperty(accessor)) {\n // determine if the row will move position based on this change, and save why it will move\n const reason = willRowMove(cells[accessor], change, rowIndex, localization);\n\n if (reason) {\n rowChanges._meta.moveReason[accessor] = reason;\n } else {\n delete rowChanges._meta.moveReason[accessor];\n }\n }\n } else {\n delete rowChanges[accessor];\n delete rowChanges._meta.moveReason[accessor];\n }\n }\n\n // set changes\n // or delete if there are no changes left, so that we don't store changes with unchanged data\n if (Object.keys(rowChanges).filter(k => k !== '_meta').length) {\n nextChanges[row.id] = rowChanges;\n } else {\n delete nextChanges[row.id];\n }\n\n return nextChanges;\n}\n\nfunction getChangesetFromChanges<TType = unknown>(changes: PendingChange<TType>): TType {\n // extract the original data from the row changes\n const { _meta, ...changeset } = changes ?? {};\n // and mix them in with the changes, ready to send to the server\n return { ..._meta?.original, ...changeset };\n}\n"],"names":["useTableEditing","isEnabled","handleSave","handleChange","validator","isEditing","toggleEditing","React","useState","isDetailedMode","toggleDetailedMode","lastFocusedCellIndex","setLastFocusedCellIndex","useLastFocusedCellIndex","pendingChangesFns","usePendingChanges","useGlobalKeyDown","key","meta","shift","undefined","event","preventDefault","saveChanges","rowId","console","warn","Promise","resolve","changesToSave","pendingChanges","changes","Object","keys","length","_forOf","pendingChange","changeSet","getChangesetFromChanges","_catch","_temp3","_result","_exit","then","resetChanges","setRowSaveStatus","getRowSaveStatus","_temp2","errors","error","rowError","cellErrors","Error","_error$response","message","response","data","_error$response2","setPendingChanges","currentChanges","nextChanges","_meta","row","cells","shouldShowErrorAlert","e","reject","validateCell","cell","id","_temp","column","setCellValue","change","rowIndex","createPendingChangesSetter","localization","pendingChangesUpdater","syncCellChanges","runCellUpdates","addCreatedRowChangeset","getAllCells","reduce","getValue","_currentChanges$cell$","_currentChanges$cell$2","_currentChanges$cell$3","original","moveReason","useLocalization","saveStates","setSaveState","getCellValue","_pendingChanges$cell$","getCellError","_pendingChanges$cell$2","_pendingChanges$cell$3","_pendingChanges$cell$4","usePendingChangesUpdater","hasRowErrors","_pendingChanges$rowId","_pendingChanges$rowId2","_pendingChanges$rowId3","_pendingChanges$rowId4","_pendingChanges$rowId5","hasRowErrorsSeen","_pendingChanges$rowId6","getRowPendingChange","rowPendingChanges","status","currentStates","nextStates","getRowMoveReason","_pendingChanges$rowId7","values","hasChanges","hasAlertErrors","getAlertErrors","filter","map","getCompletedRowsCount","value","lastFocusedCellIndexRef","useRef","useCallback","index","current","updatersRef","debounce","previousValues","nextValues","updates","_temp4","rowChanges","_currentChanges$row$i","_currentChanges$row$i2","_currentChanges$row$i3","_getAllCellsByColumnId","accessor","entries","hasOwnProperty","reason","willRowMove","k","changeset"],"mappings":";;;;;;;SAQgBA,eAAeA,CAC3BC,SAAS,GAAG,KAAK,EACjBC,UAAuD,EACvDC,YAA2D,EAC3DC,SAAsD;;EAGtD,MAAM,CAACC,SAAS,EAAEC,aAAa,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAC,KAAK,CAAC;;EAGxD,MAAM,CAACC,cAAc,EAAEC,kBAAkB,CAAC,GAAGH,cAAK,CAACC,QAAQ,CAAC,KAAK,CAAC;;EAGlE,MAAM,CAACG,oBAAoB,EAAEC,uBAAuB,CAAC,GAAGC,uBAAuB,EAAE;;;;EAKjF,MAAMC,iBAAiB,GAAGC,iBAAiB,CAAQd,SAAS,EAAEC,UAAU,EAAEC,YAAY,EAAEC,SAAS,CAAC;EAElGY,gBAAgB,CAACf,SAAS,IAAII,SAAS,GAAG;IAAEY,GAAG,EAAE,GAAG;IAAEC,IAAI,EAAE,IAAI;IAAEC,KAAK,EAAE;GAAO,GAAGC,SAAS,EAAEC,KAAK;IAC/FA,KAAK,CAACC,cAAc,EAAE;IACtBR,iBAAiB,CAACS,WAAW,EAAE;GAClC,CAAC;EAEF,O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CAACK,QAAQ,CAAC;MAC3B,OAAOL,UAAU,CAACxE,KAAK,CAAC2B,UAAU,CAACkD,QAAQ,CAAC;;;;;EAMpD,IAAI1G,MAAM,CAACC,IAAI,CAACoG,UAAU,CAAC,CAACf,MAAM,CAACyB,CAAC,IAAIA,CAAC,KAAK,OAAO,CAAC,CAAC7G,MAAM,EAAE;IAC3D0B,WAAW,CAACE,GAAG,CAACO,EAAE,CAAC,GAAGgE,UAAU;GACnC,MAAM;IACH,OAAOzE,WAAW,CAACE,GAAG,CAACO,EAAE,CAAC;;EAG9B,OAAOT,WAAW;AACtB;AAEA,SAAStB,uBAAuBA,CAAkBP,OAA6B;;EAE3E,MAAM;IAAE8B,KAAK;IAAE,GAAGmF;GAAW,GAAGjH,OAAO,aAAPA,OAAO,cAAPA,OAAO,GAAI,EAAE;;EAE7C,OAAO;IAAE,IAAG8B,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAE0B,QAAQ;IAAE,GAAGyD;GAAW;AAC/C;;;;"}
1
+ {"version":3,"file":"useTableEditing.js","sources":["../../../../../../../../src/components/Table3/features/useTableEditing.ts"],"sourcesContent":["import React from 'react';\nimport { Cell as ReactTableCell, Row as ReactTableRow } from '@tanstack/react-table';\nimport { Table3EditingChangeHandler, Table3EditingSaveHandler, Table3EditingValidatorFn } from '../types';\nimport { useGlobalKeyDown } from '../../../hooks/useGlobalKeyDown';\nimport { willRowMove } from '../util/editing';\nimport { debounce } from 'lodash';\nimport { Localization, useLocalization } from '../../Provider/Localization';\n\nexport function useTableEditing<TType = unknown>(\n isEnabled = false,\n handleSave: Table3EditingSaveHandler<TType> | undefined,\n handleChange: Table3EditingChangeHandler<TType> | undefined,\n validator: Table3EditingValidatorFn<TType> | undefined\n) {\n // used to switch the table into editing mode\n const [isEditing, toggleEditing] = React.useState(false);\n\n // used to switch the editing between \"detailed\" mode\n const [isDetailedMode, toggleDetailedMode] = React.useState(false);\n\n // store the last focused cell, so that up/down arrow key navigation remains in the same column\n const [lastFocusedCellIndex, setLastFocusedCellIndex] = useLastFocusedCellIndex();\n\n // store pending changes for each row\n // changes are saved as soon as the active row changes, so in most cases this will only contain the active row's changes\n // but not always - if validation or server requests fail when saving, those rows remain until the failure is resolved\n const pendingChangesFns = usePendingChanges<TType>(isEnabled, handleSave, handleChange, validator);\n\n useGlobalKeyDown(isEnabled && isEditing ? { key: 's', meta: true, shift: false } : undefined, event => {\n event.preventDefault();\n pendingChangesFns.saveChanges();\n });\n\n return {\n isEnabled,\n isEditing,\n isDetailedMode,\n toggleDetailedMode: isEnabled ? toggleDetailedMode : () => undefined,\n toggleEditing: isEnabled ? toggleEditing : () => undefined,\n lastFocusedCellIndex,\n setLastFocusedCellIndex,\n ...pendingChangesFns,\n };\n}\n\ntype SaveState = 'pending' | 'complete';\nexport type PendingChange<TType = unknown> = Partial<TType> & {\n _meta: {\n original: TType;\n moveReason: Record<string, 'search' | 'sorting' | 'filter'>;\n errors: {\n row: string;\n cells: Record<string, string>;\n shouldShowErrorAlert: boolean;\n };\n status?: SaveState;\n };\n};\n\ntype PendingChanges<TType = unknown> = Record<string, PendingChange<TType>>;\nfunction usePendingChanges<TType = unknown>(\n isEnabled: boolean,\n handleSave: Table3EditingSaveHandler<TType> | undefined,\n handleChange: Table3EditingChangeHandler<TType> | undefined,\n validator: Table3EditingValidatorFn<TType> | undefined\n) {\n const localization = useLocalization();\n const [pendingChanges, setPendingChanges] = React.useState<PendingChanges<TType>>({});\n // we maintain save status as separate state because 'complete' needs to briefly show after pendingChanges are deleted\n const [saveStates, setSaveState] = React.useState<Record<string, SaveState>>({});\n\n function getCellValue<T extends TType>(cell: ReactTableCell<T, unknown>): unknown | undefined {\n return pendingChanges[cell.row.id]?.[cell.column.id];\n }\n\n function getCellError<T extends TType>(cell: ReactTableCell<T, unknown>): string | undefined {\n return pendingChanges[cell.row.id]?._meta.errors?.cells?.[cell.column.id];\n }\n\n async function addCreatedRowChangeset(row: ReactTableRow<unknown>) {\n const cells = row.getAllCells();\n\n setPendingChanges((currentChanges: any) => {\n return cells.reduce((changes, cell) => {\n if (cell.getValue()) {\n return {\n ...changes,\n [cell.row.id]: {\n ...changes[cell.row.id],\n [cell.column.id]: cell.getValue(),\n _meta: {\n ...currentChanges[cell.row.id]?._meta,\n original: cell.row.original,\n moveReason: {\n ...currentChanges[cell.row.id]?._meta.moveReason,\n },\n errors: {\n ...currentChanges[cell.row.id]?._meta.errors,\n },\n },\n },\n };\n } else {\n return changes;\n }\n }, currentChanges);\n });\n }\n const pendingChangesUpdater = usePendingChangesUpdater(handleChange, setPendingChanges);\n\n async function setCellValue<T extends TType>(cell: ReactTableCell<T, unknown>, change: unknown, rowIndex: number) {\n const changes = {\n [cell.column.id]: change,\n } as Partial<T>;\n\n setPendingChanges(currentChanges => {\n const nextChanges = createPendingChangesSetter<T>(\n currentChanges as PendingChanges<T>,\n cell.row,\n rowIndex,\n changes,\n localization\n );\n pendingChangesUpdater.syncCellChanges(nextChanges);\n return nextChanges;\n });\n pendingChangesUpdater.runCellUpdates<T>(changes, cell, rowIndex);\n }\n\n async function validateCell<T extends TType>(cell: ReactTableCell<T, unknown>) {\n if (!validator || !isEnabled) {\n return;\n }\n\n const changeSet: any = getChangesetFromChanges(pendingChanges[cell.row.id]);\n\n // only validate if the cell being blurred actually has any changes\n if (cell.column.id in changeSet) {\n const errors = ((await validator(changeSet)) ?? {}) as Record<string, string>;\n\n setPendingChanges(currentChanges => {\n const nextChanges = { ...currentChanges };\n nextChanges[cell.row.id]._meta = {\n ...nextChanges[cell.row.id]._meta,\n errors: {\n ...nextChanges[cell.row.id]._meta.errors,\n cells: errors,\n shouldShowErrorAlert: !Object.keys(errors).length\n ? false\n : nextChanges[cell.row.id]._meta.errors.shouldShowErrorAlert,\n },\n };\n return nextChanges;\n });\n }\n }\n\n function hasRowErrors(rowId: string) {\n if (!isEnabled) {\n return false;\n }\n\n return (\n !!pendingChanges[rowId]?._meta.errors?.row || !!Object.keys(pendingChanges[rowId]?._meta.errors?.cells ?? {}).length\n );\n }\n\n function hasRowErrorsSeen(rowId: string) {\n if (!isEnabled) {\n return false;\n }\n\n return hasRowErrors(rowId) && !!pendingChanges[rowId]._meta.errors?.shouldShowErrorAlert;\n }\n function getRowPendingChange(rowId: string) {\n const rowPendingChanges = pendingChanges[rowId];\n\n if (rowPendingChanges) {\n const { _meta, ...pendingChange } = rowPendingChanges;\n\n return pendingChange;\n }\n\n return undefined;\n }\n\n function getRowSaveStatus(rowId: string) {\n if (!isEnabled) {\n return false;\n }\n\n return saveStates[rowId];\n }\n\n function setRowSaveStatus(rowId: string, status: 'pending' | 'complete' | undefined) {\n setSaveState(currentStates => {\n const nextStates = { ...currentStates };\n\n if (status) {\n nextStates[rowId] = status;\n } else {\n delete nextStates[rowId];\n }\n\n return nextStates;\n });\n }\n\n function getRowMoveReason(rowId: string) {\n return pendingChanges[rowId]?._meta.moveReason ? Object.values(pendingChanges[rowId]._meta.moveReason)[0] : undefined;\n }\n\n function hasChanges(rowId?: string) {\n if (!isEnabled) {\n return false;\n }\n\n return rowId ? !!pendingChanges[rowId] : !!Object.keys(pendingChanges).length;\n }\n\n function hasAlertErrors() {\n if (!isEnabled) {\n return false;\n }\n return !!getAlertErrors().length;\n }\n\n function getAlertErrors<T extends TType>() {\n return Object.keys(pendingChanges)\n .filter(hasRowErrorsSeen)\n .map(rowId => ({ rowId, pendingChange: pendingChanges[rowId] as PendingChange<T> }));\n }\n\n function resetChanges(rowId: string) {\n setPendingChanges(currentChanges => {\n const nextChanges = { ...currentChanges };\n delete nextChanges[rowId];\n return nextChanges;\n });\n }\n\n async function saveChanges(rowId: string | undefined = undefined) {\n if (!handleSave) {\n console.warn('Tried to save, but Table has no onEditingSave handler');\n return;\n }\n\n // we save back to pendingChanges, so make a copy of it's state when save was triggered\n const changesToSave = rowId ? { [rowId]: pendingChanges[rowId] } : { ...pendingChanges };\n const changes = Object.keys(changesToSave);\n\n if (changes.length) {\n for (const rowId of changes) {\n const pendingChange = changesToSave[rowId];\n\n const changeSet = getChangesetFromChanges(pendingChange);\n try {\n if (getRowSaveStatus(rowId) === 'pending') return;\n\n // set saving = true\n setRowSaveStatus(rowId, 'pending');\n\n // re-run validation, maybe a cell is already invalid but has never been blurred\n if (validator) {\n const errors = await validator(changeSet);\n\n if (errors && Object.keys(errors).length) {\n throw errors;\n }\n }\n // send new data to the server\n await handleSave(changeSet);\n\n // cleanup changes, we don't need them after saving\n resetChanges(rowId);\n setRowSaveStatus(rowId, 'complete');\n } catch (error) {\n // the onEditingSave handler should throw errors when something fails, e.g. validation, network errors etc\n // this code handles those errors and maps them either to row errors or cell specific errors\n let rowError: any;\n let cellErrors: any;\n\n if (typeof error === 'string') {\n rowError = error;\n } else if (error instanceof Error) {\n rowError = error.message;\n\n // most of our apis return error objects within this shape\n if (typeof (error as any).response?.data === 'object') {\n cellErrors = (error as any).response?.data;\n }\n } else if (typeof error === 'object') {\n cellErrors = error;\n }\n\n if (rowError || cellErrors) {\n setPendingChanges(currentChanges => {\n const nextChanges = { ...currentChanges };\n nextChanges[rowId]._meta.errors = {\n row: rowError,\n cells: cellErrors,\n shouldShowErrorAlert: true,\n };\n return nextChanges;\n });\n }\n\n setRowSaveStatus(rowId, undefined);\n }\n }\n }\n }\n\n function getCompletedRowsCount() {\n return Object.values(saveStates).filter(value => value === 'complete').length;\n }\n\n return {\n getCellValue,\n getCellError,\n setCellValue,\n validateCell,\n addCreatedRowChangeset,\n hasChanges,\n hasAlertErrors,\n getAlertErrors,\n saveChanges,\n resetChanges,\n hasRowErrors,\n hasRowErrorsSeen,\n getRowPendingChange,\n getRowSaveStatus,\n setRowSaveStatus,\n getRowMoveReason,\n getCompletedRowsCount,\n };\n}\n\nfunction useLastFocusedCellIndex(): [number | undefined, (index: number | undefined) => void] {\n // store the last focused cell, so that up/down arrow key navigation remains in the same column\n const lastFocusedCellIndexRef = React.useRef<number | undefined>(undefined);\n const setLastFocusedCellIndex = React.useCallback((index: number | undefined) => {\n lastFocusedCellIndexRef.current = index;\n }, []);\n\n return [lastFocusedCellIndexRef.current, setLastFocusedCellIndex];\n}\n\nfunction usePendingChangesUpdater<TType = unknown>(\n handleChange: Table3EditingChangeHandler<TType> | undefined,\n setPendingChanges: React.Dispatch<React.SetStateAction<PendingChanges<TType>>>\n) {\n const localization = useLocalization();\n const updatersRef = React.useRef<PendingChanges<TType>>({});\n\n const runCellUpdates = React.useCallback(\n debounce(async function <T extends TType>(changes: Partial<T>, cell: ReactTableCell<T, unknown>, rowIndex: number) {\n if (typeof handleChange === 'function') {\n const previousValues = {\n ...cell.row.original,\n ...getChangesetFromChanges(updatersRef.current[cell.row.id]),\n };\n const nextValues = {\n ...previousValues,\n ...changes,\n };\n const updates = await handleChange(cell.column.id, (changes as any)[cell.column.id], nextValues, previousValues);\n\n if (updates && Object.keys(updates).length) {\n setPendingChanges(currentChanges =>\n createPendingChangesSetter(\n currentChanges,\n cell.row as unknown as ReactTableRow<TType>,\n rowIndex,\n updates,\n localization\n )\n );\n }\n }\n }, 250),\n []\n ) as unknown as <T extends TType>(changes: Partial<T>, cell: ReactTableCell<T, unknown>, rowIndex: number) => Promise<void>;\n\n function syncCellChanges<T extends TType>(changes: PendingChanges<T>) {\n updatersRef.current = changes;\n }\n\n return {\n syncCellChanges,\n runCellUpdates,\n };\n}\n\nfunction createPendingChangesSetter<TType = unknown>(\n currentChanges: PendingChanges<TType>,\n row: ReactTableRow<TType>,\n rowIndex: number,\n changes: Partial<TType>,\n localization: Localization\n) {\n // prepare\n const nextChanges: PendingChanges<TType> = { ...currentChanges };\n const rowChanges = {\n ...currentChanges[row.id],\n _meta: {\n ...currentChanges[row.id]?._meta,\n original: row.original,\n moveReason: {\n ...currentChanges[row.id]?._meta.moveReason,\n },\n errors: {\n ...currentChanges[row.id]?._meta.errors,\n },\n },\n } as PendingChange<TType>;\n\n // run changes\n const cells = row._getAllCellsByColumnId();\n\n for (const [accessor, change] of Object.entries(changes)) {\n // update if the change is different to the original (saved) value,\n // otherwise remove any change - no point saving the same value\n if (change !== (row.original as any)[accessor]) {\n (rowChanges as PendingChange)[accessor] = change;\n\n // consumers sometimes include properties in onEditingChange that aren't rendered as columns, we need to guard against that.\n // eslint-disable-next-line no-prototype-builtins\n if (cells.hasOwnProperty(accessor)) {\n // determine if the row will move position based on this change, and save why it will move\n const reason = willRowMove(cells[accessor], change, rowIndex, localization);\n\n if (reason) {\n rowChanges._meta.moveReason[accessor] = reason;\n } else {\n delete rowChanges._meta.moveReason[accessor];\n }\n }\n } else {\n delete rowChanges[accessor];\n delete rowChanges._meta.moveReason[accessor];\n }\n }\n\n // set changes\n // or delete if there are no changes left, so that we don't store changes with unchanged data\n if (Object.keys(rowChanges).filter(k => k !== '_meta').length) {\n nextChanges[row.id] = rowChanges;\n } else {\n delete nextChanges[row.id];\n }\n\n return nextChanges;\n}\n\nfunction getChangesetFromChanges<TType = unknown>(changes: PendingChange<TType>): TType {\n // extract the original data from the row changes\n const { _meta, ...changeset } = changes ?? {};\n // and mix them in with the changes, ready to send to the server\n return { ..._meta?.original, ...changeset };\n}\n"],"names":["useTableEditing","isEnabled","handleSave","handleChange","validator","isEditing","toggleEditing","React","useState","isDetailedMode","toggleDetailedMode","lastFocusedCellIndex","setLastFocusedCellIndex","useLastFocusedCellIndex","pendingChangesFns","usePendingChanges","useGlobalKeyDown","key","meta","shift","undefined","event","preventDefault","saveChanges","rowId","console","warn","Promise","resolve","changesToSave","pendingChanges","changes","Object","keys","length","_forOf","pendingChange","changeSet","getChangesetFromChanges","_catch","_temp3","_result","_exit","then","resetChanges","setRowSaveStatus","getRowSaveStatus","_temp2","errors","error","rowError","cellErrors","Error","_error$response","message","response","data","_error$response2","setPendingChanges","currentChanges","nextChanges","_meta","row","cells","shouldShowErrorAlert","e","reject","validateCell","cell","id","_temp","column","setCellValue","change","rowIndex","createPendingChangesSetter","localization","pendingChangesUpdater","syncCellChanges","runCellUpdates","addCreatedRowChangeset","getAllCells","reduce","getValue","_currentChanges$cell$","_currentChanges$cell$2","_currentChanges$cell$3","original","moveReason","useLocalization","saveStates","setSaveState","getCellValue","_pendingChanges$cell$","getCellError","_pendingChanges$cell$2","_pendingChanges$cell$3","_pendingChanges$cell$4","usePendingChangesUpdater","hasRowErrors","_pendingChanges$rowId","_pendingChanges$rowId2","_pendingChanges$rowId3","_pendingChanges$rowId4","_pendingChanges$rowId5","hasRowErrorsSeen","_pendingChanges$rowId6","getRowPendingChange","rowPendingChanges","status","currentStates","nextStates","getRowMoveReason","_pendingChanges$rowId7","values","hasChanges","hasAlertErrors","getAlertErrors","filter","map","getCompletedRowsCount","value","lastFocusedCellIndexRef","useRef","useCallback","index","current","updatersRef","debounce","previousValues","nextValues","updates","_temp4","rowChanges","_currentChanges$row$i","_currentChanges$row$i2","_currentChanges$row$i3","_getAllCellsByColumnId","accessor","entries","hasOwnProperty","reason","willRowMove","k","changeset"],"mappings":";;;;;;;SAQgBA,eAAeA,CAC3BC,SAAS,GAAG,KAAK,EACjBC,UAAuD,EACvDC,YAA2D,EAC3DC,SAAsD;;EAGtD,MAAM,CAACC,SAAS,EAAEC,aAAa,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAC,KAAK,CAAC;;EAGxD,MAAM,CAACC,cAAc,EAAEC,kBAAkB,CAAC,GAAGH,cAAK,CAACC,QAAQ,CAAC,KAAK,CAAC;;EAGlE,MAAM,CAACG,oBAAoB,EAAEC,uBAAuB,CAAC,GAAGC,uBAAuB,EAAE;;;;EAKjF,MAAMC,iBAAiB,GAAGC,iBAAiB,CAAQd,SAAS,EAAEC,UAAU,EAAEC,YAAY,EAAEC,SAAS,CAAC;EAElGY,gBAAgB,CAACf,SAAS,IAAII,SAAS,GAAG;IAAEY,GAAG,EAAE,GAAG;IAAEC,IAAI,EAAE,IAAI;IAAEC,KAAK,EAAE;GAAO,GAAGC,SAAS,EAAEC,KAAK;IAC/FA,KAAK,CAACC,cAAc,EAAE;IACtBR,iBAAiB,CAACS,WAAW,EAAE;GAClC,CAAC;EAEF,OAAO;IACHtB,SAAS;IACTI,SAAS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3B,OAAOL,UAAU,CAACxE,KAAK,CAAC2B,UAAU,CAACkD,QAAQ,CAAC;;;;;EAMpD,IAAI1G,MAAM,CAACC,IAAI,CAACoG,UAAU,CAAC,CAACf,MAAM,CAACyB,CAAC,IAAIA,CAAC,KAAK,OAAO,CAAC,CAAC7G,MAAM,EAAE;IAC3D0B,WAAW,CAACE,GAAG,CAACO,EAAE,CAAC,GAAGgE,UAAU;GACnC,MAAM;IACH,OAAOzE,WAAW,CAACE,GAAG,CAACO,EAAE,CAAC;;EAG9B,OAAOT,WAAW;AACtB;AAEA,SAAStB,uBAAuBA,CAAkBP,OAA6B;;EAE3E,MAAM;IAAE8B,KAAK;IAAE,GAAGmF;GAAW,GAAGjH,OAAO,aAAPA,OAAO,cAAPA,OAAO,GAAI,EAAE;;EAE7C,OAAO;IAAE,IAAG8B,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAE0B,QAAQ;IAAE,GAAGyD;GAAW;AAC/C;;;;"}
@@ -60,7 +60,7 @@ function willRowMoveAfterSorting(cell, change, rowIndex) {
60
60
  if (rowIndex < rows.length - 1) {
61
61
  miniSortRows.push(rows[rowIndex + 1]);
62
62
  }
63
- const resortedRows = [...miniSortRows].sort((rowA, rowB) => {
63
+ const sortRows = (rowA, rowB) => {
64
64
  const sortFn = cell.column.getSortingFn();
65
65
  const sortUndefined = cell.column.columnDef.sortUndefined;
66
66
  if (!table.options.manualSorting && sortUndefined) {
@@ -69,11 +69,14 @@ function willRowMoveAfterSorting(cell, change, rowIndex) {
69
69
  const aUndefined = aValue === undefined;
70
70
  const bUndefined = bValue === undefined;
71
71
  if (aUndefined || bUndefined) {
72
+ if (sortUndefined === 'first') return aUndefined ? -1 : 1;
73
+ if (sortUndefined === 'last') return aUndefined ? 1 : -1;
72
74
  return aUndefined && bUndefined ? 0 : aUndefined ? sortUndefined : -sortUndefined;
73
75
  }
74
76
  }
75
77
  return sortFn(rowA, rowB, cell.column.id);
76
- });
78
+ };
79
+ const resortedRows = [...miniSortRows].sort(sortRows);
77
80
  if (cell.column.getIsSorted() === 'desc') {
78
81
  resortedRows.reverse();
79
82
  }
@@ -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 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 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\nexport function animateCreateRow(id) {\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","resortedRows","sort","rowA","rowB","sortFn","getSortingFn","sortUndefined","columnDef","manualSorting","aValue","bValue","aUndefined","bUndefined","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,CA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,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 { 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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qB,YAAY,CAACE,OAAO,EAAE;;EAG1B,OAAO,EAAAC,mBAAA,GAAAH,YAAY,CAAChB,KAAK,CAAC,cAAAmB,mBAAA,uBAAnBA,mBAAA,CAAqB7B,EAAE,MAAKnB,IAAI,CAACgB,GAAG,CAACG,EAAE;AAClD;SAEgB8B,gBAAgBA,CAAC9B,EAAU;EACvC,MAAM+B,WAAW,GAAGC,QAAQ,CAACC,aAAa,CAAC,iBAAiBjC,EAAE,IAAI,CAAC;EAEnE,IAAI+B,WAAW,EAAE;IACb,MAAMG,SAAS,GAAGH,WAAW,CAACE,aAAa,CAAC,cAAc,CAAgB;IAC1E,MAAME,QAAQ,GAAGD,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAED,aAAa,CAAC,wBAAwB,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 +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}</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;;;;"}
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;;;;"}
@@ -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, { ACTIONS, LIFECYCLE, EVENTS } from 'react-joyride';
6
+ import Joyride__default, { 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 top-0 right-0 mt-1 mr-1"
45
+ className: "absolute right-0 top-0 mr-1 mt-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, Object.assign({}, rest, {
106
+ return /*#__PURE__*/createElement(Joyride__default, 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 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,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,SAAS,EAAEP,eAAe,CAAC;IAEnD,O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,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
+ {"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,KAA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AChE,IAAI,CAACwD,MAAM,CAAC,CAAC;;;IAI3C,IAAIQ,KAAK,CAACM,IAAI,KAAKJ,MAAc,CAACK,QAAQ,EAAE;MACxC,IAAI7B,UAAU,EAAE;QACZA,UAAU,EAAE;;;IAIpB,IAAIsB,KAAK,CAACI,SAAS,KAAKF,SAAiB,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 +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;\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
+ {"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 +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 = {};\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;;;;"}
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;;;;"}
@@ -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(active.id, activeList === null || activeList === void 0 ? void 0 : activeList.id, overList.id);
33
+ move === null || move === void 0 ? void 0 : move(active.id, activeList === null || activeList === void 0 ? void 0 : activeList.id, overList.id);
34
34
  }
35
35
  function handleDragEnd(event) {
36
36
  const {
@@ -1 +1 @@
1
- {"version":3,"file":"Container.js","sources":["../../../../../../../../src/primitives/Sortable/components/Container.tsx"],"sourcesContent":["import React, { ReactNode } from 'react';\nimport { DndContext, closestCenter } from '@dnd-kit/core';\nimport { SortableListProps } from './List';\nimport { SortableItemId } from './Item';\nimport { restrictToVerticalAxis } from '@dnd-kit/modifiers';\n\nexport type SortableContainerProps = {\n children: ReactNode;\n move?: (activeId: SortableItemId, overId: SortableItemId, listId: string) => void;\n reorder: (activeId: SortableItemId, oldListId: string, listId: string) => void;\n};\n\nfunction getContainerById(children, id): SortableListProps | undefined {\n const lists = React.Children.toArray(children).filter(\n (child: any) => child.type.displayName === 'SortableList'\n ) as React.ReactElement<SortableListProps>[];\n const list: React.ReactElement<SortableListProps> | undefined = lists.find(\n (list: React.ReactElement<SortableListProps>) => list.props.id === id\n );\n\n if (list) {\n return list?.props;\n }\n\n return lists.find(l => React.Children.toArray(l.props.children).findIndex((child: any) => child.props.id === id) > -1)?.props;\n}\n\nexport function Container(externalProps) {\n const { children, reorder, move } = externalProps;\n\n function handleDragOver(event): void {\n const { active, over } = event;\n\n if (!active?.id || !over?.id) {\n return;\n }\n\n const activeList = getContainerById(children, active.id);\n const overList = getContainerById(children, over.id);\n\n if (!activeList?.id || !overList?.id || activeList.id === overList.id) {\n return;\n }\n\n move(active.id, activeList?.id, overList.id);\n }\n\n function handleDragEnd(event): void {\n const { active, over } = event;\n\n if (!active?.id || !over?.id) {\n return;\n }\n\n const activeList = getContainerById(children, active.id);\n const overList = getContainerById(children, over.id);\n\n if (!activeList?.id || !overList?.id || activeList.id !== overList.id) {\n return;\n }\n\n reorder(active.id, over.id, overList.id);\n }\n\n return (\n <DndContext\n collisionDetection={closestCenter}\n {...externalProps}\n modifiers={[restrictToVerticalAxis]}\n onDragOver={handleDragOver}\n onDragEnd={handleDragEnd}>\n {children}\n </DndContext>\n );\n}\nContainer.displayName = 'SortableContainer';\n"],"names":["getContainerById","children","id","lists","React","Children","toArray","filter","child","type","displayName","list","find","props","_lists$find","l","findIndex","Container","externalProps","reorder","move","handleDragOver","event","active","over","activeList","overList","handleDragEnd","DndContext","collisionDetection","closestCenter","modifiers","restrictToVerticalAxis","onDragOver","onDragEnd"],"mappings":";;;;AAYA,SAASA,gBAAgBA,CAACC,QAAQ,EAAEC,EAAE;;EAClC,MAAMC,KAAK,GAAGC,cAAK,CAACC,QAAQ,CAACC,OAAO,CAACL,QAAQ,CAAC,CAACM,MAAM,CAChDC,KAAU,IAAKA,KAAK,CAACC,IAAI,CAACC,WAAW,KAAK,cAAc,CACjB;EAC5C,MAAMC,IAAI,GAAsDR,KAAK,CAACS,IAAI,CACrED,IAA2C,IAAKA,IAAI,CAACE,KAAK,CAACX,EAAE,KAAKA,EAAE,CACxE;EAED,IAAIS,IAAI,EAAE;IACN,OAAOA,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEE,KAAK;;EAGtB,QAAAC,WAAA,GAAOX,KAAK,CAACS,IAAI,CAACG,CAAC,IAAIX,cAAK,CAACC,QAAQ,CAACC,OAAO,CAACS,CAAC,CAACF,KAAK,CAACZ,QAAQ,CAAC,CAACe,SAAS,CAAER,KAAU,IAAKA,KAAK,CAACK,KAAK,CAACX,EAAE,KAAKA,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,cAAAY,WAAA,uBAA/GA,WAAA,CAAiHD,KAAK;AACjI;SAEgBI,SAASA,CAACC,aAAa;EACnC,MAAM;IAAEjB,QAAQ;IAAEkB,OAAO;IAAEC;GAAM,GAAGF,aAAa;EAEjD,SAASG,cAAcA,CAACC,KAAK;IACzB,MAAM;MAAEC,MAAM;MAAEC;KAAM,GAAGF,KAAK;IAE9B,IAAI,EAACC,MAAM,aAANA,MAAM,eAANA,MAAM,CAAErB,EAAE,KAAI,EAACsB,IAAI,aAAJA,IAAI,eAAJA,IAAI,CAAEtB,EAAE,GAAE;MAC1B;;IAGJ,MAAMuB,UAAU,GAAGzB,gBAAgB,CAACC,QAAQ,EAAEsB,MAAM,CAACrB,EAAE,CAAC;IAC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,cAAc;IAC1Ba,SAAS,EAAEP;MACV1B,QAAQ,CACA;AAErB;AACAgB,SAAS,CAACP,WAAW,GAAG,mBAAmB;;;;"}
1
+ {"version":3,"file":"Container.js","sources":["../../../../../../../../src/primitives/Sortable/components/Container.tsx"],"sourcesContent":["import React, { ReactNode } from 'react';\nimport { DndContext, closestCenter } from '@dnd-kit/core';\nimport { SortableListProps } from './List';\nimport { SortableItemId } from './Item';\nimport { restrictToVerticalAxis } from '@dnd-kit/modifiers';\n\nexport type SortableContainerProps = {\n children: ReactNode;\n move?: (activeId: SortableItemId, overId: SortableItemId, listId: string) => void;\n reorder: (activeId: SortableItemId, oldListId: string, listId: string) => void;\n};\n\nfunction getContainerById(children: React.ReactNode, id: string): SortableListProps | undefined {\n const lists = React.Children.toArray(children).filter(\n (child: any) => child.type.displayName === 'SortableList'\n ) as React.ReactElement<SortableListProps>[];\n const list: React.ReactElement<SortableListProps> | undefined = lists.find(\n (list: React.ReactElement<SortableListProps>) => list.props.id === id\n );\n\n if (list) {\n return list?.props;\n }\n\n return lists.find(l => React.Children.toArray(l.props.children).findIndex((child: any) => child.props.id === id) > -1)?.props;\n}\n\nexport function Container(externalProps: SortableContainerProps) {\n const { children, reorder, move } = externalProps;\n\n function handleDragOver(event: any): void {\n const { active, over } = event;\n\n if (!active?.id || !over?.id) {\n return;\n }\n\n const activeList = getContainerById(children, active.id);\n const overList = getContainerById(children, over.id);\n\n if (!activeList?.id || !overList?.id || activeList.id === overList.id) {\n return;\n }\n\n move?.(active.id, activeList?.id, overList.id);\n }\n\n function handleDragEnd(event: any): void {\n const { active, over } = event;\n\n if (!active?.id || !over?.id) {\n return;\n }\n\n const activeList = getContainerById(children, active.id);\n const overList = getContainerById(children, over.id);\n\n if (!activeList?.id || !overList?.id || activeList.id !== overList.id) {\n return;\n }\n\n reorder(active.id, over.id, overList.id);\n }\n\n return (\n <DndContext\n collisionDetection={closestCenter}\n {...externalProps}\n modifiers={[restrictToVerticalAxis]}\n onDragOver={handleDragOver}\n onDragEnd={handleDragEnd}>\n {children}\n </DndContext>\n );\n}\nContainer.displayName = 'SortableContainer';\n"],"names":["getContainerById","children","id","lists","React","Children","toArray","filter","child","type","displayName","list","find","props","_lists$find","l","findIndex","Container","externalProps","reorder","move","handleDragOver","event","active","over","activeList","overList","handleDragEnd","DndContext","collisionDetection","closestCenter","modifiers","restrictToVerticalAxis","onDragOver","onDragEnd"],"mappings":";;;;AAYA,SAASA,gBAAgBA,CAACC,QAAyB,EAAEC,EAAU;;EAC3D,MAAMC,KAAK,GAAGC,cAAK,CAACC,QAAQ,CAACC,OAAO,CAACL,QAAQ,CAAC,CAACM,MAAM,CAChDC,KAAU,IAAKA,KAAK,CAACC,IAAI,CAACC,WAAW,KAAK,cAAc,CACjB;EAC5C,MAAMC,IAAI,GAAsDR,KAAK,CAACS,IAAI,CACrED,IAA2C,IAAKA,IAAI,CAACE,KAAK,CAACX,EAAE,KAAKA,EAAE,CACxE;EAED,IAAIS,IAAI,EAAE;IACN,OAAOA,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEE,KAAK;;EAGtB,QAAAC,WAAA,GAAOX,KAAK,CAACS,IAAI,CAACG,CAAC,IAAIX,cAAK,CAACC,QAAQ,CAACC,OAAO,CAACS,CAAC,CAACF,KAAK,CAACZ,QAAQ,CAAC,CAACe,SAAS,CAAER,KAAU,IAAKA,KAAK,CAACK,KAAK,CAACX,EAAE,KAAKA,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,cAAAY,WAAA,uBAA/GA,WAAA,CAAiHD,KAAK;AACjI;SAEgBI,SAASA,CAACC,aAAqC;EAC3D,MAAM;IAAEjB,QAAQ;IAAEkB,OAAO;IAAEC;GAAM,GAAGF,aAAa;EAEjD,SAASG,cAAcA,CAACC,KAAU;IAC9B,MAAM;MAAEC,MAAM;MAAEC;KAAM,GAAGF,KAAK;IAE9B,IAAI,EAACC,MAAM,aAANA,MAAM,eAANA,MAAM,CAAErB,EAAE,KAAI,EAACsB,IA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I,CAACtB,EAAE,EAAEwB,QAAQ,CAACxB,EAAE,CAAC;;EAG5C,oBACIE,6BAACwB,UAAU;IACPC,kBAAkB,EAAEC;KAChBZ,aAAa;IACjBa,SAAS,EAAE,CAACC,sBAAsB,CAAC;IACnCC,UAAU,EAAEZ,cAAc;IAC1Ba,SAAS,EAAEP;MACV1B,QAAQ,CACA;AAErB;AACAgB,SAAS,CAACP,WAAW,GAAG,mBAAmB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Item.js","sources":["../../../../../../../../src/primitives/Sortable/components/Item.tsx"],"sourcesContent":["import React from 'react';\nimport { useSortable } from '@dnd-kit/sortable';\nimport { CSS } from '@dnd-kit/utilities';\n\nexport type SortableItemId = string | number;\n\nexport type SortableListItemProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'id'> & {\n disabled?: boolean;\n id: SortableItemId;\n};\n\nconst isFormElement = (element: HTMLElement) => {\n const formElementNodeNames = ['BUTTON', 'INPUT', 'TEXTAREA', 'SELECT', 'FIELDSET'];\n\n return formElementNodeNames.includes(element.nodeName);\n};\n\nexport function Item(props) {\n const { asChild, children, disabled = false, id } = props;\n const { attributes, listeners, setNodeRef, transform, transition } = useSortable({ disabled, id });\n\n const style = {\n transform: CSS.Transform.toString(transform),\n transition,\n };\n\n const onPointerDown = event => {\n // allow form components, like checkboxes, to be active\n if (event.currentTarget.contains(event.target) && !isFormElement(event.target)) {\n listeners?.onPointerDown(event);\n }\n };\n\n const elProps = { ...attributes, ...listeners, onPointerDown, ref: setNodeRef, style };\n\n if (asChild) {\n return React.cloneElement(children, elProps);\n }\n\n return <div {...elProps}>{children}</div>;\n}\nItem.displayName = 'SortableListItem';\n"],"names":["isFormElement","element","formElementNodeNames","includes","nodeName","Item","props","asChild","children","disabled","id","attributes","listeners","setNodeRef","transform","transition","useSortable","style","CSS","Transform","toString","onPointerDown","event","currentTarget","contains","target","elProps","ref","React","cloneElement","displayName"],"mappings":";;;;AAWA,MAAMA,aAAa,GAAIC,OAAoB;EACvC,MAAMC,oBAAoB,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,CAAC;EAElF,OAAOA,oBAAoB,CAACC,QAAQ,CAACF,OAAO,CAACG,QAAQ,CAAC;AAC1D,CAAC;SAEeC,IAAIA,CAACC,KAAK;EACtB,MAAM;IAAEC,OAAO;IAAEC,QAAQ;IAAEC,QAAQ,GAAG,KAAK;IAAEC;GAAI,GAAGJ,KAAK;EACzD,MAAM;IAAEK,UAAU;IAAEC,SAAS;IAAEC,UAAU;IAAEC,SAAS;IAAEC;GAAY,GAAGC,WAAW,CAAC;IAAEP,QAAQ;IAAEC;GAAI,CAAC;EAElG,MAAMO,KAAK,GAAG;IACVH,SAAS,EAAEI,GAAG,CAACC,SAAS,CAACC,QAAQ,CAACN,SAAS,CAAC;IAC5CC;GACH;EAED,MAAMM,aAAa,GAAGC,KAAK;;IAEvB,IAAIA,KAAK,CAACC,aAAa,CAACC,QAAQ,CAACF,KAAK,CAACG,MAAM,CAAC,IAAI,CAACzB,aAAa,CAACsB,KAAK,CAACG,MAAM,CAAC,EAAE;MAC5Eb,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAES,aAAa,CAACC,KAAK,CAAC;;GAEtC;EAED,MAAMI,OAAO,GAAG;IAAE,GAAGf,UAAU;IAAE,GAAGC,SAAS;IAAES,aAAa;IAAEM,GAAG,EAAEd,UAAU;IAAEI;GAAO;EAEtF,IAAIV,OAAO,EAAE;IACT,oBAAOqB,cAAK,CAACC,YAAY,CAACrB,QAAQ,EAAEkB,OAAO,CAAC;;EAGhD,oBAAOE,sDAASF,OAAO,GAAGlB,QAAQ,CAAO;AAC7C;AACAH,IAAI,CAACyB,WAAW,GAAG,kBAAkB;;;;"}
1
+ {"version":3,"file":"Item.js","sources":["../../../../../../../../src/primitives/Sortable/components/Item.tsx"],"sourcesContent":["import React from 'react';\nimport { useSortable } from '@dnd-kit/sortable';\nimport { CSS } from '@dnd-kit/utilities';\n\nexport type SortableItemId = string | number;\n\nexport type SortableListItemProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'id'> & {\n disabled?: boolean;\n id: SortableItemId;\n asChild: boolean;\n};\n\nconst isFormElement = (element: HTMLElement) => {\n const formElementNodeNames = ['BUTTON', 'INPUT', 'TEXTAREA', 'SELECT', 'FIELDSET'];\n\n return formElementNodeNames.includes(element.nodeName);\n};\n\nexport function Item(props: SortableListItemProps) {\n const { asChild, children, disabled = false, id } = props;\n const { attributes, listeners, setNodeRef, transform, transition } = useSortable({ disabled, id });\n\n const style = {\n transform: CSS.Transform.toString(transform),\n transition,\n };\n\n const onPointerDown = (event: any) => {\n // allow form components, like checkboxes, to be active\n if (event.currentTarget.contains(event.target) && !isFormElement(event.target)) {\n listeners?.onPointerDown(event);\n }\n };\n\n const elProps = { ...attributes, ...listeners, onPointerDown, ref: setNodeRef, style };\n\n if (asChild) {\n return React.cloneElement(children as React.ReactElement, elProps);\n }\n\n return <div {...elProps}>{children}</div>;\n}\nItem.displayName = 'SortableListItem';\n"],"names":["isFormElement","element","formElementNodeNames","includes","nodeName","Item","props","asChild","children","disabled","id","attributes","listeners","setNodeRef","transform","transition","useSortable","style","CSS","Transform","toString","onPointerDown","event","currentTarget","contains","target","elProps","ref","React","cloneElement","displayName"],"mappings":";;;;AAYA,MAAMA,aAAa,GAAIC,OAAoB;EACvC,MAAMC,oBAAoB,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,CAAC;EAElF,OAAOA,oBAAoB,CAACC,QAAQ,CAACF,OAAO,CAACG,QAAQ,CAAC;AAC1D,CAAC;SAEeC,IAAIA,CAACC,KAA4B;EAC7C,MAAM;IAAEC,OAAO;IAAEC,QAAQ;IAAEC,QAAQ,GAAG,KAAK;IAAEC;GAAI,GAAGJ,KAAK;EACzD,MAAM;IAAEK,UAAU;IAAEC,SAAS;IAAEC,UAAU;IAAEC,SAAS;IAAEC;GAAY,GAAGC,WAAW,CAAC;IAAEP,QAAQ;IAAEC;GAAI,CAAC;EAElG,MAAMO,KAAK,GAAG;IACVH,SAAS,EAAEI,GAAG,CAACC,SAAS,CAACC,QAAQ,CAACN,SAAS,CAAC;IAC5CC;GACH;EAED,MAAMM,aAAa,GAAIC,KAAU;;IAE7B,IAAIA,KAAK,CAACC,aAAa,CAACC,QAAQ,CAACF,KAAK,CAACG,MAAM,CAAC,IAAI,CAACzB,aAAa,CAACsB,KAAK,CAACG,MAAM,CAAC,EAAE;MAC5Eb,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAES,aAAa,CAACC,KAAK,CAAC;;GAEtC;EAED,MAAMI,OAAO,GAAG;IAAE,GAAGf,UAAU;IAAE,GAAGC,SAAS;IAAES,aAAa;IAAEM,GAAG,EAAEd,UAAU;IAAEI;GAAO;EAEtF,IAAIV,OAAO,EAAE;IACT,oBAAOqB,cAAK,CAACC,YAAY,CAACrB,QAA8B,EAAEkB,OAAO,CAAC;;EAGtE,oBAAOE,sDAASF,OAAO,GAAGlB,QAAQ,CAAO;AAC7C;AACAH,IAAI,CAACyB,WAAW,GAAG,kBAAkB;;;;"}
@@ -13,10 +13,10 @@ const FOCUS_MANAGER_OPTIONS_ARROW_KEYS = {
13
13
  };
14
14
  function useAugmentedFocusManager() {
15
15
  const focusManager = useFocusManager();
16
- const focusPrevious = (arrowNavigation = false) => focusManager.focusPrevious(arrowNavigation ? FOCUS_MANAGER_OPTIONS_ARROW_KEYS : FOCUS_MANAGER_OPTIONS_TAB);
17
- const focusNext = (arrowNavigation = false) => focusManager.focusNext(arrowNavigation ? FOCUS_MANAGER_OPTIONS_ARROW_KEYS : FOCUS_MANAGER_OPTIONS_TAB);
18
- const focusFirst = () => focusManager.focusFirst(FOCUS_MANAGER_OPTIONS_TAB);
19
- const focusLast = () => focusManager.focusLast(FOCUS_MANAGER_OPTIONS_TAB);
16
+ const focusPrevious = (arrowNavigation = false) => focusManager === null || focusManager === void 0 ? void 0 : focusManager.focusPrevious(arrowNavigation ? FOCUS_MANAGER_OPTIONS_ARROW_KEYS : FOCUS_MANAGER_OPTIONS_TAB);
17
+ const focusNext = (arrowNavigation = false) => focusManager === null || focusManager === void 0 ? void 0 : focusManager.focusNext(arrowNavigation ? FOCUS_MANAGER_OPTIONS_ARROW_KEYS : FOCUS_MANAGER_OPTIONS_TAB);
18
+ const focusFirst = () => focusManager === null || focusManager === void 0 ? void 0 : focusManager.focusFirst(FOCUS_MANAGER_OPTIONS_TAB);
19
+ const focusLast = () => focusManager === null || focusManager === void 0 ? void 0 : focusManager.focusLast(FOCUS_MANAGER_OPTIONS_TAB);
20
20
  return {
21
21
  focusPrevious,
22
22
  focusNext,
@@ -1 +1 @@
1
- {"version":3,"file":"util.js","sources":["../../../../../../../../../../src/primitives/Table/Core/components/Body/util.ts"],"sourcesContent":["import { useFocusManager } from '@react-aria/focus';\nimport { hasFocusableElement, isElementInteractive } from '../../../../../utils/dom';\n\nconst FOCUS_MANAGER_OPTIONS_TAB = {\n accept: (element: Element) => !!element.closest('tr[data-row-active=\"true\"]'),\n tabbable: true,\n};\n\nconst FOCUS_MANAGER_OPTIONS_ARROW_KEYS = {\n accept: (element: Element) => {\n const acceptTabbable = isElementInteractive(element) ? element.getAttribute('tabindex') !== '-1' : true;\n return !!element.closest('tr[data-row-active=\"true\"]') && !hasFocusableElement(element as HTMLElement) && acceptTabbable;\n },\n};\n\nexport function useAugmentedFocusManager() {\n const focusManager = useFocusManager();\n\n const focusPrevious = (arrowNavigation = false) =>\n focusManager.focusPrevious(arrowNavigation ? FOCUS_MANAGER_OPTIONS_ARROW_KEYS : FOCUS_MANAGER_OPTIONS_TAB);\n const focusNext = (arrowNavigation = false) =>\n focusManager.focusNext(arrowNavigation ? FOCUS_MANAGER_OPTIONS_ARROW_KEYS : FOCUS_MANAGER_OPTIONS_TAB);\n const focusFirst = () => focusManager.focusFirst(FOCUS_MANAGER_OPTIONS_TAB);\n const focusLast = () => focusManager.focusLast(FOCUS_MANAGER_OPTIONS_TAB);\n\n return {\n focusPrevious,\n focusNext,\n focusFirst,\n focusLast,\n };\n}\n"],"names":["FOCUS_MANAGER_OPTIONS_TAB","accept","element","closest","tabbable","FOCUS_MANAGER_OPTIONS_ARROW_KEYS","acceptTabbable","isElementInteractive","getAttribute","hasFocusableElement","useAugmentedFocusManager","focusManager","useFocusManager","focusPrevious","arrowNavigation","focusNext","focusFirst","focusLast"],"mappings":";;;AAGA,MAAMA,yBAAyB,GAAG;EAC9BC,MAAM,EAAGC,OAAgB,IAAK,CAAC,CAACA,OAAO,CAACC,OAAO,CAAC,4BAA4B,CAAC;EAC7EC,QAAQ,EAAE;CACb;AAED,MAAMC,gCAAgC,GAAG;EACrCJ,MAAM,EAAGC,OAAgB;IACrB,MAAMI,cAAc,GAAGC,oBAAoB,CAACL,OAAO,CAAC,GAAGA,OAAO,CAACM,YAAY,CAAC,UAAU,CAAC,KAAK,IAAI,GAAG,IAAI;IACvG,OAAO,CAAC,CAACN,OAAO,CAACC,OAAO,CAAC,4BAA4B,CAAC,IAAI,CAACM,mBAAmB,CAACP,OAAsB,CAAC,IAAII,cAAc;;CAE/H;SAEeI,wBAAwBA;EACpC,MAAMC,YAAY,GAAGC,eAAe,EAAE;EAEtC,MAAMC,aAAa,GAAGA,CAACC,eAAe,GAAG,KAAK,KAC1CH,YAAY,CAACE,aAAa,CAACC,eAAe,GAAGT,gCAAgC,GAAGL,yBAAyB,CAAC;EAC9G,MAAMe,SAAS,GAAGA,CAACD,eAAe,GAAG,KAAK,KACtCH,YAAY,CAACI,SAAS,CAACD,eAAe,GAAGT,gCAAgC,GAAGL,yBAAyB,CAAC;EAC1G,MAAMgB,UAAU,GAAGA,MAAML,YAAY,CAACK,UAAU,CAAChB,yBAAyB,CAAC;EAC3E,MAAMiB,SAAS,GAAGA,MAAMN,YAAY,CAACM,SAAS,CAACjB,yBAAyB,CAAC;EAEzE,OAAO;IACHa,aAAa;IACbE,SAAS;IACTC,UAAU;IACVC;GACH;AACL;;;;"}
1
+ {"version":3,"file":"util.js","sources":["../../../../../../../../../../src/primitives/Table/Core/components/Body/util.ts"],"sourcesContent":["import { useFocusManager } from '@react-aria/focus';\nimport { hasFocusableElement, isElementInteractive } from '../../../../../utils/dom';\n\nconst FOCUS_MANAGER_OPTIONS_TAB = {\n accept: (element: Element) => !!element.closest('tr[data-row-active=\"true\"]'),\n tabbable: true,\n};\n\nconst FOCUS_MANAGER_OPTIONS_ARROW_KEYS = {\n accept: (element: Element) => {\n const acceptTabbable = isElementInteractive(element) ? element.getAttribute('tabindex') !== '-1' : true;\n return !!element.closest('tr[data-row-active=\"true\"]') && !hasFocusableElement(element as HTMLElement) && acceptTabbable;\n },\n};\n\nexport function useAugmentedFocusManager() {\n const focusManager = useFocusManager();\n\n const focusPrevious = (arrowNavigation = false) =>\n focusManager?.focusPrevious(arrowNavigation ? FOCUS_MANAGER_OPTIONS_ARROW_KEYS : FOCUS_MANAGER_OPTIONS_TAB);\n const focusNext = (arrowNavigation = false) =>\n focusManager?.focusNext(arrowNavigation ? FOCUS_MANAGER_OPTIONS_ARROW_KEYS : FOCUS_MANAGER_OPTIONS_TAB);\n const focusFirst = () => focusManager?.focusFirst(FOCUS_MANAGER_OPTIONS_TAB);\n const focusLast = () => focusManager?.focusLast(FOCUS_MANAGER_OPTIONS_TAB);\n\n return {\n focusPrevious,\n focusNext,\n focusFirst,\n focusLast,\n };\n}\n"],"names":["FOCUS_MANAGER_OPTIONS_TAB","accept","element","closest","tabbable","FOCUS_MANAGER_OPTIONS_ARROW_KEYS","acceptTabbable","isElementInteractive","getAttribute","hasFocusableElement","useAugmentedFocusManager","focusManager","useFocusManager","focusPrevious","arrowNavigation","focusNext","focusFirst","focusLast"],"mappings":";;;AAGA,MAAMA,yBAAyB,GAAG;EAC9BC,MAAM,EAAGC,OAAgB,IAAK,CAAC,CAACA,OAAO,CAACC,OAAO,CAAC,4BAA4B,CAAC;EAC7EC,QAAQ,EAAE;CACb;AAED,MAAMC,gCAAgC,GAAG;EACrCJ,MAAM,EAAGC,OAAgB;IACrB,MAAMI,cAAc,GAAGC,oBAAoB,CAACL,OAAO,CAAC,GAAGA,OAAO,CAACM,YAAY,CAAC,UAAU,CAAC,KAAK,IAAI,GAAG,IAAI;IACvG,OAAO,CAAC,CAACN,OAAO,CAACC,OAAO,CAAC,4BAA4B,CAAC,IAAI,CAACM,mBAAmB,CAACP,OAAsB,CAAC,IAAII,cAAc;;CAE/H;SAEeI,wBAAwBA;EACpC,MAAMC,YAAY,GAAGC,eAAe,EAAE;EAEtC,MAAMC,aAAa,GAAGA,CAACC,eAAe,GAAG,KAAK,KAC1CH,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAEE,aAAa,CAACC,eAAe,GAAGT,gCAAgC,GAAGL,yBAAyB,CAAC;EAC/G,MAAMe,SAAS,GAAGA,CAACD,eAAe,GAAG,KAAK,KACtCH,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAEI,SAAS,CAACD,eAAe,GAAGT,gCAAgC,GAAGL,yBAAyB,CAAC;EAC3G,MAAMgB,UAAU,GAAGA,MAAML,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAEK,UAAU,CAAChB,yBAAyB,CAAC;EAC5E,MAAMiB,SAAS,GAAGA,MAAMN,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAEM,SAAS,CAACjB,yBAAyB,CAAC;EAE1E,OAAO;IACHa,aAAa;IACbE,SAAS;IACTC,UAAU;IACVC;GACH;AACL;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Expansion.js","sources":["../../../../../../../../../../../src/primitives/Table/Core/components/Columns/Internal/Expansion.tsx"],"sourcesContent":["import React from 'react';\nimport {\n HeaderContext as ReactTableHeaderContext,\n CellContext as ReactTableCellContext,\n TableMeta as ReactTableMeta,\n} from '@tanstack/react-table';\nimport { useLocalization } from '../../../../../../components/Provider/Localization';\nimport { Tooltip } from '../../../../../../components/Tooltip/Tooltip';\nimport { IconButton } from '../../../../../../components/IconButton/IconButton';\nimport { useTableManagerInternalColumn } from '../../../../useTableManager/types';\n\nfunction Header<TType = unknown>(context: ReactTableHeaderContext<TType, unknown>) {\n const { texts } = useLocalization();\n const { table } = context;\n\n const isSomeRowsExpanded = table.getIsSomeRowsExpanded();\n\n const handleClick = event => {\n event.stopPropagation();\n table.toggleAllRowsExpanded(!isSomeRowsExpanded);\n };\n\n const title = isSomeRowsExpanded ? texts.table.columns.expansion.collapseAll : texts.table.columns.expansion.expandAll;\n\n return (\n <Tooltip title={title}>\n <IconButton\n appearance=\"transparent\"\n icon={isSomeRowsExpanded ? 'chevron-down-double' : 'chevron-right-double'}\n onClick={handleClick}\n tabIndex={-1}\n title={title}\n />\n </Tooltip>\n );\n}\n\nfunction Cell<TType = unknown>(context: ReactTableCellContext<TType, unknown>) {\n const { texts } = useLocalization();\n const tableMeta = context.table.options.meta as ReactTableMeta<TType>;\n\n const hasExpandedRow = tableMeta.rowExpansion.rowExpansionRenderer?.(context.row.original);\n\n if (hasExpandedRow) {\n const isActiveRow = tableMeta.rowActive.rowActiveIndex === context.row.index;\n const isExpanded = context.row.getIsExpanded();\n\n const handleClick = event => {\n event.stopPropagation();\n context.row.toggleExpanded();\n };\n\n const title = isExpanded ? texts.table.columns.expansion.collapse : texts.table.columns.expansion.expand;\n const tabIndex = isActiveRow ? 0 : -1;\n\n return (\n <Tooltip title={title}>\n <IconButton\n appearance=\"discrete\"\n icon={isExpanded ? 'chevron-down' : 'chevron-right'}\n onClick={handleClick}\n tabIndex={tabIndex}\n title={title}\n />\n </Tooltip>\n );\n }\n\n return null;\n}\n\nexport const renderer: useTableManagerInternalColumn = {\n header: Header,\n renderer: Cell,\n size: 40,\n meta: {\n align: 'center',\n // TODO: remove when table3 is migrated, this satisfies the legacy table3 type\n enableSearch: false,\n header: '',\n headerClassName: '!p-0',\n },\n};\n"],"names":["Header","context","texts","useLocalization","table","isSomeRowsExpanded","getIsSomeRowsExpanded","handleClick","event","stopPropagation","toggleAllRowsExpanded","title","columns","expansion","collapseAll","expandAll","React","Tooltip","IconButton","appearance","icon","onClick","tabIndex","Cell","tableMeta","options","meta","hasExpandedRow","_tableMeta$rowExpansi","_tableMeta$rowExpansi2","rowExpansion","rowExpansionRenderer","call","row","original","isActiveRow","rowActive","rowActiveIndex","index","isExpanded","getIsExpanded","toggleExpanded","collapse","expand","renderer","header","size","align","enableSearch","headerClassName"],"mappings":";;;;;AAWA,SAASA,MAAMA,CAAkBC,OAAgD;EAC7E,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAM;IAAEC;GAAO,GAAGH,OAAO;EAEzB,MAAMI,kBAAkB,GAAGD,KAAK,CAACE,qBAAqB,EAAE;EAExD,MAAMC,WAAW,GAAGC,KAAK;IACrBA,KAAK,CAACC,eAAe,EAAE;IACvBL,KAAK,CAACM,qBAAqB,CAAC,CAACL,kBAAkB,CAAC;GACnD;EAED,MAAMM,KAAK,GAAGN,kBAAkB,GAAGH,KAAK,CAACE,KAAK,CAACQ,OAAO,CAACC,SAAS,CAACC,WAAW,GAAGZ,KAAK,CAACE,KAAK,CAACQ,OAAO,CAACC,SAAS,CAACE,SAAS;EAEtH,oBACIC,6BAACC,OAAO;IAACN,KAAK,EAAEA;kBACZK,6BAACE,UAAU;IACPC,UAAU,EAAC,aAAa;IACxBC,IAAI,EAAEf,kBAAkB,GAAG,qBAAqB,GAAG,sBAAsB;IACzEgB,OAAO,EAAEd,WAAW;IACpBe,QAAQ,EAAE,CAAC,CAAC;IACZX,KAAK,EAAEA;IACT,CACI;AAElB;AAEA,SAASY,IAAIA,CAAkBtB,OAA8C;;EACzE,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMqB,SAAS,GAAGvB,OAAO,CAACG,KAAK,CAACqB,OAAO,CAACC,IAA6B;EAErE,MAAMC,cAAc,IAAAC,qBAAA,GAAG,CAAAC,sBAAA,GAAAL,SAAS,CAACM,YAAY,EAACC,oBAAoB,cAAAH,qBAAA,uBAA3CA,qBAAA,CAAAI,IAAA,CAAAH,sBAAA,EAA8C5B,OAAO,CAACgC,GAAG,CAACC,QAAQ,CAAC;EAE1F,IAAIP,cAAc,EAAE;IAChB,MAAMQ,WAAW,GAAGX,SAAS,CAACY,SAAS,CAACC,cAAc,KAAKpC,OAAO,CAACgC,GAAG,CAACK,KAAK;IAC5E,MAAMC,UAAU,GAAGtC,OAAO,CAACgC,GAAG,CAACO,aAAa,EAAE;IAE9C,MAAMjC,WAAW,GAAGC,KAAK;MACrBA,KAAK,CAACC,eAAe,EAAE;MACvBR,OAAO,CAACgC,GAAG,CAACQ,cAAc,EAAE;KAC/B;IAED,MAAM9B,KAAK,GAAG4B,UAAU,GAAGrC,KAAK,CAACE,KAAK,CAACQ,OAAO,CAACC,SAAS,CAAC6B,QAAQ,GAAGxC,KAAK,CAACE,KAAK,CAACQ,OAAO,CAACC,SAAS,CAAC8B,MAAM;IACxG,MAAMrB,QAAQ,GAAGa,WAAW,GAAG,CAAC,GAAG,CAAC,CAAC;IAErC,oBACInB,6BAACC,OAAO;MAACN,KAAK,EAAEA;oBACZK,6BAACE,UAAU;MACPC,UAAU,EAAC,UAAU;MACrBC,IAAI,EAAEmB,UAAU,GAAG,cAAc,GAAG,eAAe;MACnDlB,OAAO,EAAEd,WAAW;MACpBe,QAAQ,EAAEA,QAAQ;MAClBX,KAAK,EAAEA;MACT,CACI;;EAIlB,OAAO,IAAI;AACf;MAEaiC,QAAQ,GAAkC;EACnDC,MAAM,EAAE7C,MAAM;EACd4C,QAAQ,EAAErB,IAAI;EACduB,IAAI,EAAE,EAAE;EACRpB,IAAI,EAAE;IACFqB,KAAK,EAAE,QAAQ;;IAEfC,YAAY,EAAE,KAAK;IACnBH,MAAM,EAAE,EAAE;IACVI,eAAe,EAAE;;;;;;"}
1
+ {"version":3,"file":"Expansion.js","sources":["../../../../../../../../../../../src/primitives/Table/Core/components/Columns/Internal/Expansion.tsx"],"sourcesContent":["import React from 'react';\nimport {\n HeaderContext as ReactTableHeaderContext,\n CellContext as ReactTableCellContext,\n TableMeta as ReactTableMeta,\n} from '@tanstack/react-table';\nimport { useLocalization } from '../../../../../../components/Provider/Localization';\nimport { Tooltip } from '../../../../../../components/Tooltip/Tooltip';\nimport { IconButton } from '../../../../../../components/IconButton/IconButton';\nimport { useTableManagerInternalColumn } from '../../../../useTableManager/types';\n\nfunction Header<TType = unknown>(context: ReactTableHeaderContext<TType, unknown>) {\n const { texts } = useLocalization();\n const { table } = context;\n\n const isSomeRowsExpanded = table.getIsSomeRowsExpanded();\n\n const handleClick = (event: React.MouseEvent) => {\n event.stopPropagation();\n table.toggleAllRowsExpanded(!isSomeRowsExpanded);\n };\n\n const title = isSomeRowsExpanded ? texts.table.columns.expansion.collapseAll : texts.table.columns.expansion.expandAll;\n\n return (\n <Tooltip title={title}>\n <IconButton\n appearance=\"transparent\"\n icon={isSomeRowsExpanded ? 'chevron-down-double' : 'chevron-right-double'}\n onClick={handleClick}\n tabIndex={-1}\n title={title}\n />\n </Tooltip>\n );\n}\n\nfunction Cell<TType = unknown>(context: ReactTableCellContext<TType, unknown>) {\n const { texts } = useLocalization();\n const tableMeta = context.table.options.meta as ReactTableMeta<TType>;\n\n const hasExpandedRow = tableMeta.rowExpansion.rowExpansionRenderer?.(context.row.original);\n\n if (hasExpandedRow) {\n const isActiveRow = tableMeta.rowActive.rowActiveIndex === context.row.index;\n const isExpanded = context.row.getIsExpanded();\n\n const handleClick = (event: React.MouseEvent) => {\n event.stopPropagation();\n context.row.toggleExpanded();\n };\n\n const title = isExpanded ? texts.table.columns.expansion.collapse : texts.table.columns.expansion.expand;\n const tabIndex = isActiveRow ? 0 : -1;\n\n return (\n <Tooltip title={title}>\n <IconButton\n appearance=\"discrete\"\n icon={isExpanded ? 'chevron-down' : 'chevron-right'}\n onClick={handleClick}\n tabIndex={tabIndex}\n title={title}\n />\n </Tooltip>\n );\n }\n\n return null;\n}\n\nexport const renderer: useTableManagerInternalColumn = {\n header: Header,\n renderer: Cell,\n size: 40,\n meta: {\n align: 'center',\n // TODO: remove when table3 is migrated, this satisfies the legacy table3 type\n enableSearch: false,\n header: '',\n headerClassName: '!p-0',\n },\n};\n"],"names":["Header","context","texts","useLocalization","table","isSomeRowsExpanded","getIsSomeRowsExpanded","handleClick","event","stopPropagation","toggleAllRowsExpanded","title","columns","expansion","collapseAll","expandAll","React","Tooltip","IconButton","appearance","icon","onClick","tabIndex","Cell","tableMeta","options","meta","hasExpandedRow","_tableMeta$rowExpansi","_tableMeta$rowExpansi2","rowExpansion","rowExpansionRenderer","call","row","original","isActiveRow","rowActive","rowActiveIndex","index","isExpanded","getIsExpanded","toggleExpanded","collapse","expand","renderer","header","size","align","enableSearch","headerClassName"],"mappings":";;;;;AAWA,SAASA,MAAMA,CAAkBC,OAAgD;EAC7E,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAM;IAAEC;GAAO,GAAGH,OAAO;EAEzB,MAAMI,kBAAkB,GAAGD,KAAK,CAACE,qBAAqB,EAAE;EAExD,MAAMC,WAAW,GAAIC,KAAuB;IACxCA,KAAK,CAACC,eAAe,EAAE;IACvBL,KAAK,CAACM,qBAAqB,CAAC,CAACL,kBAAkB,CAAC;GACnD;EAED,MAAMM,KAAK,GAAGN,kBAAkB,GAAGH,KAAK,CAACE,KAAK,CAACQ,OAAO,CAACC,SAAS,CAACC,WAAW,GAAGZ,KAAK,CAACE,KAAK,CAACQ,OAAO,CAACC,SAAS,CAACE,SAAS;EAEtH,oBACIC,6BAACC,OAAO;IAACN,KAAK,EAAEA;kBACZK,6BAACE,UAAU;IACPC,UAAU,EAAC,aAAa;IACxBC,IAAI,EAAEf,kBAAkB,GAAG,qBAAqB,GAAG,sBAAsB;IACzEgB,OAAO,EAAEd,WAAW;IACpBe,QAAQ,EAAE,CAAC,CAAC;IACZX,KAAK,EAAEA;IACT,CACI;AAElB;AAEA,SAASY,IAAIA,CAAkBtB,OAA8C;;EACzE,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,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