@economic/taco 1.1.5-alpha.1 → 1.1.5-alpha.102

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (357) hide show
  1. package/dist/components/Icon/components/LogOut.d.ts +3 -0
  2. package/dist/components/Icon/components/Menu.d.ts +3 -0
  3. package/dist/components/Icon/components/Numbers.d.ts +3 -0
  4. package/dist/components/Icon/components/Profile.d.ts +3 -0
  5. package/dist/components/Icon/components/index.d.ts +1 -1
  6. package/dist/components/Input/Input.d.ts +1 -1
  7. package/dist/components/Menu/Menu.d.ts +2 -2
  8. package/dist/components/Menu/components/Item.d.ts +1 -1
  9. package/dist/components/Menu/components/Link.d.ts +1 -1
  10. package/dist/components/Tour/Tour.d.ts +2 -0
  11. package/dist/esm/components/Accordion/Accordion.js.map +1 -1
  12. package/dist/esm/components/Backdrop/Backdrop.js.map +1 -1
  13. package/dist/esm/components/Badge/Badge.js.map +1 -1
  14. package/dist/esm/components/Banner/Banner.js.map +1 -1
  15. package/dist/esm/components/Banner/util.js.map +1 -1
  16. package/dist/esm/components/Button/Button.js.map +1 -1
  17. package/dist/esm/components/Button/util.js.map +1 -1
  18. package/dist/esm/components/Calendar/Calendar.js.map +1 -1
  19. package/dist/esm/components/Card/Card.js +14 -13
  20. package/dist/esm/components/Card/Card.js.map +1 -1
  21. package/dist/esm/components/Checkbox/Checkbox.js +18 -15
  22. package/dist/esm/components/Checkbox/Checkbox.js.map +1 -1
  23. package/dist/esm/components/Combobox/Combobox.js +26 -23
  24. package/dist/esm/components/Combobox/Combobox.js.map +1 -1
  25. package/dist/esm/components/Combobox/useCombobox.js.map +1 -1
  26. package/dist/esm/components/Datepicker/Datepicker.js +52 -48
  27. package/dist/esm/components/Datepicker/Datepicker.js.map +1 -1
  28. package/dist/esm/components/Datepicker/useDatepicker.js.map +1 -1
  29. package/dist/esm/components/Dialog/Context.js.map +1 -1
  30. package/dist/esm/components/Dialog/Dialog.js +58 -39
  31. package/dist/esm/components/Dialog/Dialog.js.map +1 -1
  32. package/dist/esm/components/Dialog/components/Content.js.map +1 -1
  33. package/dist/esm/components/Dialog/components/Drawer.js.map +1 -1
  34. package/dist/esm/components/Dialog/components/Extra.js.map +1 -1
  35. package/dist/esm/components/Dialog/components/Trigger.js +1 -1
  36. package/dist/esm/components/Dialog/components/Trigger.js.map +1 -1
  37. package/dist/esm/components/Field/Field.js +12 -10
  38. package/dist/esm/components/Field/Field.js.map +1 -1
  39. package/dist/esm/components/Form/Form.js +8 -6
  40. package/dist/esm/components/Form/Form.js.map +1 -1
  41. package/dist/esm/components/Group/Group.js +8 -6
  42. package/dist/esm/components/Group/Group.js.map +1 -1
  43. package/dist/esm/components/Hanger/Hanger.js +36 -28
  44. package/dist/esm/components/Hanger/Hanger.js.map +1 -1
  45. package/dist/esm/components/HoverCard/HoverCard.js +9 -8
  46. package/dist/esm/components/HoverCard/HoverCard.js.map +1 -1
  47. package/dist/esm/components/Icon/Icon.js +8 -7
  48. package/dist/esm/components/Icon/Icon.js.map +1 -1
  49. package/dist/esm/components/Icon/components/AccountPreview.js.map +1 -1
  50. package/dist/esm/components/Icon/components/Accounting.js.map +1 -1
  51. package/dist/esm/components/Icon/components/AccountingYear.js.map +1 -1
  52. package/dist/esm/components/Icon/components/AccountingYearCancel.js.map +1 -1
  53. package/dist/esm/components/Icon/components/ArrowBottom.js.map +1 -1
  54. package/dist/esm/components/Icon/components/ArrowDown.js.map +1 -1
  55. package/dist/esm/components/Icon/components/ArrowEnd.js.map +1 -1
  56. package/dist/esm/components/Icon/components/ArrowLeft.js.map +1 -1
  57. package/dist/esm/components/Icon/components/ArrowRight.js.map +1 -1
  58. package/dist/esm/components/Icon/components/ArrowStart.js.map +1 -1
  59. package/dist/esm/components/Icon/components/ArrowTop.js.map +1 -1
  60. package/dist/esm/components/Icon/components/ArrowUp.js.map +1 -1
  61. package/dist/esm/components/Icon/components/Attach.js.map +1 -1
  62. package/dist/esm/components/Icon/components/AttachAuto.js.map +1 -1
  63. package/dist/esm/components/Icon/components/AttachCancel.js.map +1 -1
  64. package/dist/esm/components/Icon/components/Autotext.js.map +1 -1
  65. package/dist/esm/components/Icon/components/AutotextInsert.js.map +1 -1
  66. package/dist/esm/components/Icon/components/Basic.js.map +1 -1
  67. package/dist/esm/components/Icon/components/BasicTabs.js.map +1 -1
  68. package/dist/esm/components/Icon/components/BellSolid.js.map +1 -1
  69. package/dist/esm/components/Icon/components/Book.js.map +1 -1
  70. package/dist/esm/components/Icon/components/Booking.js.map +1 -1
  71. package/dist/esm/components/Icon/components/Budget.js.map +1 -1
  72. package/dist/esm/components/Icon/components/Calendar.js.map +1 -1
  73. package/dist/esm/components/Icon/components/CashAccount.js.map +1 -1
  74. package/dist/esm/components/Icon/components/CashReports.js.map +1 -1
  75. package/dist/esm/components/Icon/components/Chat.js.map +1 -1
  76. package/dist/esm/components/Icon/components/ChatSolid.js.map +1 -1
  77. package/dist/esm/components/Icon/components/ChevronDown.js.map +1 -1
  78. package/dist/esm/components/Icon/components/ChevronDownDouble.js.map +1 -1
  79. package/dist/esm/components/Icon/components/ChevronDownSolid.js.map +1 -1
  80. package/dist/esm/components/Icon/components/ChevronLeft.js.map +1 -1
  81. package/dist/esm/components/Icon/components/ChevronLeftDouble.js.map +1 -1
  82. package/dist/esm/components/Icon/components/ChevronRight.js.map +1 -1
  83. package/dist/esm/components/Icon/components/ChevronRightDouble.js.map +1 -1
  84. package/dist/esm/components/Icon/components/ChevronUp.js.map +1 -1
  85. package/dist/esm/components/Icon/components/ChevronUpDouble.js.map +1 -1
  86. package/dist/esm/components/Icon/components/ChevronUpSolid.js.map +1 -1
  87. package/dist/esm/components/Icon/components/CircleClose.js.map +1 -1
  88. package/dist/esm/components/Icon/components/CircleMinus.js.map +1 -1
  89. package/dist/esm/components/Icon/components/CirclePlus.js.map +1 -1
  90. package/dist/esm/components/Icon/components/CircleTick.js.map +1 -1
  91. package/dist/esm/components/Icon/components/Clamp.js.map +1 -1
  92. package/dist/esm/components/Icon/components/ClampOpen.js.map +1 -1
  93. package/dist/esm/components/Icon/components/Close.js.map +1 -1
  94. package/dist/esm/components/Icon/components/ConnectionEnable.js.map +1 -1
  95. package/dist/esm/components/Icon/components/ConnectionRevoke.js.map +1 -1
  96. package/dist/esm/components/Icon/components/Contacts.js.map +1 -1
  97. package/dist/esm/components/Icon/components/Copy.js.map +1 -1
  98. package/dist/esm/components/Icon/components/Courses.js.map +1 -1
  99. package/dist/esm/components/Icon/components/Credit.js.map +1 -1
  100. package/dist/esm/components/Icon/components/Delete.js.map +1 -1
  101. package/dist/esm/components/Icon/components/DeletePermanently.js.map +1 -1
  102. package/dist/esm/components/Icon/components/Depecriate.js.map +1 -1
  103. package/dist/esm/components/Icon/components/Developer.js.map +1 -1
  104. package/dist/esm/components/Icon/components/DistributionTemplate.js.map +1 -1
  105. package/dist/esm/components/Icon/components/Document.js.map +1 -1
  106. package/dist/esm/components/Icon/components/DocumentApprove.js.map +1 -1
  107. package/dist/esm/components/Icon/components/DocumentCreateEntry.js.map +1 -1
  108. package/dist/esm/components/Icon/components/DocumentCut.js.map +1 -1
  109. package/dist/esm/components/Icon/components/DocumentError.js.map +1 -1
  110. package/dist/esm/components/Icon/components/DocumentIsolatePage.js.map +1 -1
  111. package/dist/esm/components/Icon/components/DocumentMerge.js.map +1 -1
  112. package/dist/esm/components/Icon/components/DocumentMove.js.map +1 -1
  113. package/dist/esm/components/Icon/components/DocumentPreview.js.map +1 -1
  114. package/dist/esm/components/Icon/components/DocumentReceived.js.map +1 -1
  115. package/dist/esm/components/Icon/components/DocumentRejectedRequest.js.map +1 -1
  116. package/dist/esm/components/Icon/components/DocumentSplit.js.map +1 -1
  117. package/dist/esm/components/Icon/components/DocumentTime.js.map +1 -1
  118. package/dist/esm/components/Icon/components/Download.js.map +1 -1
  119. package/dist/esm/components/Icon/components/Drag.js.map +1 -1
  120. package/dist/esm/components/Icon/components/ECopedia.js.map +1 -1
  121. package/dist/esm/components/Icon/components/ESignature.js.map +1 -1
  122. package/dist/esm/components/Icon/components/Edit.js.map +1 -1
  123. package/dist/esm/components/Icon/components/EllipsisHorizontal.js.map +1 -1
  124. package/dist/esm/components/Icon/components/EllipsisVertical.js.map +1 -1
  125. package/dist/esm/components/Icon/components/EntriesOnAccount.js.map +1 -1
  126. package/dist/esm/components/Icon/components/EntriesOpen.js.map +1 -1
  127. package/dist/esm/components/Icon/components/EntriesWarning.js.map +1 -1
  128. package/dist/esm/components/Icon/components/EntryTypeCustomerInvoice.js.map +1 -1
  129. package/dist/esm/components/Icon/components/EntryTypeCustomerPayment.js.map +1 -1
  130. package/dist/esm/components/Icon/components/EntryTypeJournalEntry.js.map +1 -1
  131. package/dist/esm/components/Icon/components/EntryTypeManualCustomerInvoice.js.map +1 -1
  132. package/dist/esm/components/Icon/components/EntryTypeSupplierInvoice.js.map +1 -1
  133. package/dist/esm/components/Icon/components/EntryTypeSupplierPayment.js.map +1 -1
  134. package/dist/esm/components/Icon/components/Envelope.js.map +1 -1
  135. package/dist/esm/components/Icon/components/EnvelopeApproved.js.map +1 -1
  136. package/dist/esm/components/Icon/components/ExpandView.js.map +1 -1
  137. package/dist/esm/components/Icon/components/Expenses.js.map +1 -1
  138. package/dist/esm/components/Icon/components/Export.js.map +1 -1
  139. package/dist/esm/components/Icon/components/ExportToExcel.js.map +1 -1
  140. package/dist/esm/components/Icon/components/ExportToPdf.js.map +1 -1
  141. package/dist/esm/components/Icon/components/Filter.js.map +1 -1
  142. package/dist/esm/components/Icon/components/FilterSolid.js.map +1 -1
  143. package/dist/esm/components/Icon/components/GraphSolid.js.map +1 -1
  144. package/dist/esm/components/Icon/components/Hash.js.map +1 -1
  145. package/dist/esm/components/Icon/components/Home.js.map +1 -1
  146. package/dist/esm/components/Icon/components/Images.js.map +1 -1
  147. package/dist/esm/components/Icon/components/Import.js.map +1 -1
  148. package/dist/esm/components/Icon/components/Inbox.js.map +1 -1
  149. package/dist/esm/components/Icon/components/InboxEinvoicing.js.map +1 -1
  150. package/dist/esm/components/Icon/components/InboxScanning.js.map +1 -1
  151. package/dist/esm/components/Icon/components/InboxSmart.js.map +1 -1
  152. package/dist/esm/components/Icon/components/Info.js.map +1 -1
  153. package/dist/esm/components/Icon/components/Inventory.js.map +1 -1
  154. package/dist/esm/components/Icon/components/InventoryMatrix.js.map +1 -1
  155. package/dist/esm/components/Icon/components/JournalPro.js.map +1 -1
  156. package/dist/esm/components/Icon/components/Layout.js.map +1 -1
  157. package/dist/esm/components/Icon/components/LayoutBoth.js.map +1 -1
  158. package/dist/esm/components/Icon/components/LayoutFirst.js.map +1 -1
  159. package/dist/esm/components/Icon/components/LayoutLast.js.map +1 -1
  160. package/dist/esm/components/Icon/components/LayoutNone.js.map +1 -1
  161. package/dist/esm/components/Icon/components/LedgerCard.js.map +1 -1
  162. package/dist/esm/components/Icon/components/LedgerCardCustomerReminder.js.map +1 -1
  163. package/dist/esm/components/Icon/components/LedgerCardManualCustomerInvoice.js.map +1 -1
  164. package/dist/esm/components/Icon/components/LedgerCardObsoleteStock.js.map +1 -1
  165. package/dist/esm/components/Icon/components/LedgerCardOpeningEntry.js.map +1 -1
  166. package/dist/esm/components/Icon/components/LedgerCardReservedEntry.js.map +1 -1
  167. package/dist/esm/components/Icon/components/LedgerCardShrinkagePilferage.js.map +1 -1
  168. package/dist/esm/components/Icon/components/LedgerCardStockAdjustment.js.map +1 -1
  169. package/dist/esm/components/Icon/components/LedgerCardTransferredOpeningEntry.js.map +1 -1
  170. package/dist/esm/components/Icon/components/Lightbulb.js.map +1 -1
  171. package/dist/esm/components/Icon/components/Line.js.map +1 -1
  172. package/dist/esm/components/Icon/components/List.js.map +1 -1
  173. package/dist/esm/components/Icon/components/ListBulleted.js.map +1 -1
  174. package/dist/esm/components/Icon/components/ListSearch.js.map +1 -1
  175. package/dist/esm/components/Icon/components/LockOpen.js.map +1 -1
  176. package/dist/esm/components/Icon/components/Log.js.map +1 -1
  177. package/dist/esm/components/Icon/components/LogOut.js +20 -0
  178. package/dist/esm/components/Icon/components/LogOut.js.map +1 -0
  179. package/dist/esm/components/Icon/components/Market.js.map +1 -1
  180. package/dist/esm/components/Icon/components/MatchAmount.js.map +1 -1
  181. package/dist/esm/components/Icon/components/MatchEntries.js.map +1 -1
  182. package/dist/esm/components/Icon/components/Menu.js +18 -0
  183. package/dist/esm/components/Icon/components/Menu.js.map +1 -0
  184. package/dist/esm/components/Icon/components/Mileage.js.map +1 -1
  185. package/dist/esm/components/Icon/components/ModalResize.js.map +1 -1
  186. package/dist/esm/components/Icon/components/ModalShrink.js.map +1 -1
  187. package/dist/esm/components/Icon/components/More.js.map +1 -1
  188. package/dist/esm/components/Icon/components/MoreSolid.js.map +1 -1
  189. package/dist/esm/components/Icon/components/Move.js.map +1 -1
  190. package/dist/esm/components/Icon/components/NavigationList.js.map +1 -1
  191. package/dist/esm/components/Icon/components/Note.js.map +1 -1
  192. package/dist/esm/components/Icon/components/NoteFollowUp.js.map +1 -1
  193. package/dist/esm/components/Icon/components/NoteRead.js.map +1 -1
  194. package/dist/esm/components/Icon/components/Numbers.js +18 -0
  195. package/dist/esm/components/Icon/components/Numbers.js.map +1 -0
  196. package/dist/esm/components/Icon/components/PartnerApi.js.map +1 -1
  197. package/dist/esm/components/Icon/components/Period.js.map +1 -1
  198. package/dist/esm/components/Icon/components/PersonChange.js.map +1 -1
  199. package/dist/esm/components/Icon/components/PersonMinus.js.map +1 -1
  200. package/dist/esm/components/Icon/components/PersonPlus.js.map +1 -1
  201. package/dist/esm/components/Icon/components/PersonTick.js.map +1 -1
  202. package/dist/esm/components/Icon/components/Play.js.map +1 -1
  203. package/dist/esm/components/Icon/components/PlusMinus.js.map +1 -1
  204. package/dist/esm/components/Icon/components/Print.js.map +1 -1
  205. package/dist/esm/components/Icon/components/ProcessPayment.js.map +1 -1
  206. package/dist/esm/components/Icon/components/ProductLedgerCard.js.map +1 -1
  207. package/dist/esm/components/Icon/components/Profile.js +20 -0
  208. package/dist/esm/components/Icon/components/Profile.js.map +1 -0
  209. package/dist/esm/components/Icon/components/ProjectCards.js.map +1 -1
  210. package/dist/esm/components/Icon/components/Projects.js.map +1 -1
  211. package/dist/esm/components/Icon/components/Quicklinks.js.map +1 -1
  212. package/dist/esm/components/Icon/components/RatingBankruptcy.js.map +1 -1
  213. package/dist/esm/components/Icon/components/RatingPaymentProblems.js.map +1 -1
  214. package/dist/esm/components/Icon/components/Reconciled.js.map +1 -1
  215. package/dist/esm/components/Icon/components/Refresh.js.map +1 -1
  216. package/dist/esm/components/Icon/components/Report.js.map +1 -1
  217. package/dist/esm/components/Icon/components/ReportSolid.js.map +1 -1
  218. package/dist/esm/components/Icon/components/Restore.js.map +1 -1
  219. package/dist/esm/components/Icon/components/RotateLeft.js.map +1 -1
  220. package/dist/esm/components/Icon/components/RotateRight.js.map +1 -1
  221. package/dist/esm/components/Icon/components/Sales.js.map +1 -1
  222. package/dist/esm/components/Icon/components/Search.js.map +1 -1
  223. package/dist/esm/components/Icon/components/SearchBold.js.map +1 -1
  224. package/dist/esm/components/Icon/components/Secure.js.map +1 -1
  225. package/dist/esm/components/Icon/components/SecureTick.js.map +1 -1
  226. package/dist/esm/components/Icon/components/Settings.js.map +1 -1
  227. package/dist/esm/components/Icon/components/SettingsSolid.js.map +1 -1
  228. package/dist/esm/components/Icon/components/Shortcuts.js.map +1 -1
  229. package/dist/esm/components/Icon/components/ShowAll.js.map +1 -1
  230. package/dist/esm/components/Icon/components/ShowLess.js.map +1 -1
  231. package/dist/esm/components/Icon/components/ShowMore.js.map +1 -1
  232. package/dist/esm/components/Icon/components/ShowTemplate.js.map +1 -1
  233. package/dist/esm/components/Icon/components/Sliders.js.map +1 -1
  234. package/dist/esm/components/Icon/components/Smartpay.js.map +1 -1
  235. package/dist/esm/components/Icon/components/SortBy.js.map +1 -1
  236. package/dist/esm/components/Icon/components/Spinner.js.map +1 -1
  237. package/dist/esm/components/Icon/components/Star.js.map +1 -1
  238. package/dist/esm/components/Icon/components/StarSolid.js.map +1 -1
  239. package/dist/esm/components/Icon/components/Subscriptions.js.map +1 -1
  240. package/dist/esm/components/Icon/components/SystemEntries.js.map +1 -1
  241. package/dist/esm/components/Icon/components/Tag.js.map +1 -1
  242. package/dist/esm/components/Icon/components/TemplateOverride.js.map +1 -1
  243. package/dist/esm/components/Icon/components/Templates.js.map +1 -1
  244. package/dist/esm/components/Icon/components/ThumbBoth.js.map +1 -1
  245. package/dist/esm/components/Icon/components/ThumbDown.js.map +1 -1
  246. package/dist/esm/components/Icon/components/ThumbDownSolid.js.map +1 -1
  247. package/dist/esm/components/Icon/components/ThumbUp.js.map +1 -1
  248. package/dist/esm/components/Icon/components/ThumbUpSolid.js.map +1 -1
  249. package/dist/esm/components/Icon/components/Tick.js.map +1 -1
  250. package/dist/esm/components/Icon/components/Time.js.map +1 -1
  251. package/dist/esm/components/Icon/components/Transfer.js.map +1 -1
  252. package/dist/esm/components/Icon/components/TransferCancel.js.map +1 -1
  253. package/dist/esm/components/Icon/components/TransferLocked.js.map +1 -1
  254. package/dist/esm/components/Icon/components/Undock.js.map +1 -1
  255. package/dist/esm/components/Icon/components/Unreconciled.js.map +1 -1
  256. package/dist/esm/components/Icon/components/Warning.js.map +1 -1
  257. package/dist/esm/components/Icon/components/Webshop.js.map +1 -1
  258. package/dist/esm/components/Icon/components/Website.js.map +1 -1
  259. package/dist/esm/components/Icon/components/Workflow.js.map +1 -1
  260. package/dist/esm/components/Icon/components/Zoom.js.map +1 -1
  261. package/dist/esm/components/Icon/components/index.js +8 -0
  262. package/dist/esm/components/Icon/components/index.js.map +1 -1
  263. package/dist/esm/components/IconButton/IconButton.js +11 -9
  264. package/dist/esm/components/IconButton/IconButton.js.map +1 -1
  265. package/dist/esm/components/Input/Input.js +25 -25
  266. package/dist/esm/components/Input/Input.js.map +1 -1
  267. package/dist/esm/components/Listbox/Listbox.js +25 -24
  268. package/dist/esm/components/Listbox/Listbox.js.map +1 -1
  269. package/dist/esm/components/Listbox/ScrollableList.js.map +1 -1
  270. package/dist/esm/components/Listbox/useListbox.js.map +1 -1
  271. package/dist/esm/components/Listbox/useMultiListbox.js.map +1 -1
  272. package/dist/esm/components/Listbox/useTypeahead.js.map +1 -1
  273. package/dist/esm/components/Menu/Context.js.map +1 -1
  274. package/dist/esm/components/Menu/Menu.js +34 -16
  275. package/dist/esm/components/Menu/Menu.js.map +1 -1
  276. package/dist/esm/components/Menu/components/Checkbox.js +1 -1
  277. package/dist/esm/components/Menu/components/Checkbox.js.map +1 -1
  278. package/dist/esm/components/Menu/components/Content.js.map +1 -1
  279. package/dist/esm/components/Menu/components/Header.js.map +1 -1
  280. package/dist/esm/components/Menu/components/Item.js.map +1 -1
  281. package/dist/esm/components/Menu/components/Link.js.map +1 -1
  282. package/dist/esm/components/Menu/components/RadioGroup.js +1 -1
  283. package/dist/esm/components/Menu/components/RadioGroup.js.map +1 -1
  284. package/dist/esm/components/Menu/components/Separator.js.map +1 -1
  285. package/dist/esm/components/Menu/components/Trigger.js.map +1 -1
  286. package/dist/esm/components/Navigation/Navigation.js +44 -35
  287. package/dist/esm/components/Navigation/Navigation.js.map +1 -1
  288. package/dist/esm/components/Pagination/PageNumbers.js.map +1 -1
  289. package/dist/esm/components/Pagination/Pagination.js +56 -39
  290. package/dist/esm/components/Pagination/Pagination.js.map +1 -1
  291. package/dist/esm/components/Pagination/usePagination.js.map +1 -1
  292. package/dist/esm/components/Pagination/usePaginationShortcuts.js.map +1 -1
  293. package/dist/esm/components/Popover/Popover.js +35 -30
  294. package/dist/esm/components/Popover/Popover.js.map +1 -1
  295. package/dist/esm/components/Popover/Primitives.js.map +1 -1
  296. package/dist/esm/components/Progress/Progress.js +15 -11
  297. package/dist/esm/components/Progress/Progress.js.map +1 -1
  298. package/dist/esm/components/Provider/Provider.js +18 -13
  299. package/dist/esm/components/Provider/Provider.js.map +1 -1
  300. package/dist/esm/components/RadioGroup/RadioGroup.js +57 -45
  301. package/dist/esm/components/RadioGroup/RadioGroup.js.map +1 -1
  302. package/dist/esm/components/SearchInput/SearchInput.js +13 -10
  303. package/dist/esm/components/SearchInput/SearchInput.js.map +1 -1
  304. package/dist/esm/components/Select/Select.js +31 -30
  305. package/dist/esm/components/Select/Select.js.map +1 -1
  306. package/dist/esm/components/Select/useSelect.js.map +1 -1
  307. package/dist/esm/components/Spinner/Spinner.js +19 -12
  308. package/dist/esm/components/Spinner/Spinner.js.map +1 -1
  309. package/dist/esm/components/Switch/Switch.js +10 -9
  310. package/dist/esm/components/Switch/Switch.js.map +1 -1
  311. package/dist/esm/components/Table/components/BaseTable.js.map +1 -1
  312. package/dist/esm/components/Table/components/PaginatedTable.js.map +1 -1
  313. package/dist/esm/components/Table/components/Table.js.map +1 -1
  314. package/dist/esm/components/Table/components/WindowedTable.js.map +1 -1
  315. package/dist/esm/components/Table/hooks/plugins/useRowActions.js.map +1 -1
  316. package/dist/esm/components/Table/hooks/plugins/useRowDraggable.js.map +1 -1
  317. package/dist/esm/components/Table/hooks/plugins/useRowEditing.js.map +1 -1
  318. package/dist/esm/components/Table/hooks/plugins/useRowSelect.js.map +1 -1
  319. package/dist/esm/components/Table/hooks/useRowCreation.js.map +1 -1
  320. package/dist/esm/components/Table/hooks/useTable.js.map +1 -1
  321. package/dist/esm/components/Table/util/renderColumn.js.map +1 -1
  322. package/dist/esm/components/Table/util/renderRow.js.map +1 -1
  323. package/dist/esm/components/Tabs/Tabs.js +27 -25
  324. package/dist/esm/components/Tabs/Tabs.js.map +1 -1
  325. package/dist/esm/components/Textarea/Textarea.js +9 -11
  326. package/dist/esm/components/Textarea/Textarea.js.map +1 -1
  327. package/dist/esm/components/Toast/Toast.js +1 -1
  328. package/dist/esm/components/Toast/Toast.js.map +1 -1
  329. package/dist/esm/components/Toast/Toaster.js +118 -88
  330. package/dist/esm/components/Toast/Toaster.js.map +1 -1
  331. package/dist/esm/components/Toast/util.js.map +1 -1
  332. package/dist/esm/components/Tooltip/Tooltip.js +8 -7
  333. package/dist/esm/components/Tooltip/Tooltip.js.map +1 -1
  334. package/dist/esm/components/Tour/Tour.js +52 -44
  335. package/dist/esm/components/Tour/Tour.js.map +1 -1
  336. package/dist/esm/components/Treeview/Treeview.js +36 -26
  337. package/dist/esm/components/Treeview/Treeview.js.map +1 -1
  338. package/dist/esm/components/VisuallyHidden/VisuallyHidden.js +1 -1
  339. package/dist/esm/components/VisuallyHidden/VisuallyHidden.js.map +1 -1
  340. package/dist/esm/index.js +2 -0
  341. package/dist/esm/index.js.map +1 -1
  342. package/dist/esm/primitives/Button.js.map +1 -1
  343. package/dist/esm/utils/hooks/useDraggable.js.map +1 -1
  344. package/dist/esm/utils/hooks/useDropTarget.js +10 -7
  345. package/dist/esm/utils/hooks/useDropTarget.js.map +1 -1
  346. package/dist/esm/utils/mergeRefs.js +3 -3
  347. package/dist/esm/utils/mergeRefs.js.map +1 -1
  348. package/dist/index.d.ts +3 -1
  349. package/dist/taco.cjs.development.js +945 -732
  350. package/dist/taco.cjs.development.js.map +1 -1
  351. package/dist/taco.cjs.production.min.js +1 -1
  352. package/dist/taco.cjs.production.min.js.map +1 -1
  353. package/dist/utils/mergeRefs.d.ts +1 -1
  354. package/dist/utils/tailwind.d.ts +1 -1
  355. package/package.json +4 -5
  356. package/tailwind.config.js +264 -260
  357. package/types.json +12 -2
@@ -1 +1 @@
1
- {"version":3,"file":"useRowCreation.js","sources":["../../../../../src/components/Table/hooks/useRowCreation.tsx"],"sourcesContent":["import React from 'react';\r\nimport { v4 as uuid } from 'uuid';\r\nimport set from 'lodash/set';\r\nimport unset from 'lodash/unset';\r\nimport get from 'lodash/get';\r\nimport compact from 'lodash/compact';\r\nimport pullAt from 'lodash/pullAt';\r\n\r\nimport { convertRowIndexPathToNumberArray, getByRowIndexPath, getParentRowIndexPath } from '../util/rowIndexPath';\r\nimport { Row, RowIndexPath, TableRef } from '../types';\r\n\r\nexport const insertChildTableRow = <TRow,>(\r\n data: Row<TRow>[],\r\n rowIndexPath: RowIndexPath = undefined,\r\n values: any = {}\r\n): [Row<TRow>[], RowIndexPath] => {\r\n const nexTRow: Row<TRow>[] = JSON.parse(JSON.stringify(data));\r\n\r\n let childRowIndexPath;\r\n\r\n if (rowIndexPath) {\r\n const rowIndexes = convertRowIndexPathToNumberArray(rowIndexPath);\r\n const currentRow = getByRowIndexPath(nexTRow, rowIndexes.join('.'));\r\n const nextSubRows = currentRow?.subRows ?? [];\r\n\r\n const path = rowIndexes.map(i => `[${i}]`).join('.subRows') + '.subRows';\r\n nextSubRows.unshift(values);\r\n set(nexTRow, path, nextSubRows);\r\n\r\n // rebuild the new id\r\n rowIndexes.push(0);\r\n childRowIndexPath = rowIndexes.join('.');\r\n } else {\r\n nexTRow.unshift(values);\r\n childRowIndexPath = '0';\r\n }\r\n\r\n return [nexTRow, childRowIndexPath];\r\n};\r\n\r\nexport const removeChildTableRow = <TRow,>(data: Row<TRow>[], rowIndexPath: RowIndexPath): Row<TRow>[] => {\r\n const nexTRow = JSON.parse(JSON.stringify(data));\r\n\r\n const rowIndexes = convertRowIndexPathToNumberArray(rowIndexPath);\r\n const rootIndex = Number(rowIndexes.shift());\r\n\r\n if (rowIndexes.length) {\r\n // unset\r\n const unsetPath = rowIndexes.map(index => `subRows[${index}]`).join('.');\r\n unset(nexTRow[rootIndex], unsetPath);\r\n\r\n // remove empty value from subRows\r\n rowIndexes.pop();\r\n const setPath = rowIndexes.length ? rowIndexes.map(index => `subRows[${index}]`).join('.') + '.subRows' : 'subRows';\r\n set(nexTRow[rootIndex], setPath, compact(get(nexTRow[rootIndex], setPath)));\r\n } else {\r\n pullAt(nexTRow, rootIndex);\r\n }\r\n\r\n return nexTRow;\r\n};\r\n\r\nexport type useTableRowCreation<TRow> = {\r\n data: Row<TRow>[];\r\n create: (rowIndexPath: RowIndexPath, values?: object | undefined) => RowIndexPath;\r\n remove: (rowIndexPath: RowIndexPath) => void;\r\n isCreating: boolean;\r\n};\r\n\r\nexport const useTableRowCreation = <TRow,>(data: Row<TRow>[], tableRef: React.RefObject<TableRef>): useTableRowCreation<TRow> => {\r\n const [internalData, setInternalData] = React.useState(JSON.parse(JSON.stringify(data)));\r\n const [activeRowIndexPath, setActiveRowIndexPath] = React.useState<string | undefined>(undefined);\r\n\r\n React.useEffect(() => {\r\n if (activeRowIndexPath !== undefined) {\r\n // keep the same edit key, so that we don't remount the row/form\r\n const currentRow: any = getByRowIndexPath(internalData, activeRowIndexPath);\r\n\r\n // get the active creation rows parent\r\n const parentId = getParentRowIndexPath(activeRowIndexPath);\r\n\r\n // insert a new empty row in the external data (with the same key)\r\n const [nexTRow, newRowIndexPath] = insertChildTableRow(JSON.parse(JSON.stringify(data)), parentId, currentRow);\r\n\r\n // update and set that row as active, we basically just changed it's position in our internal data\r\n setActiveRowIndexPath(newRowIndexPath);\r\n setInternalData(nexTRow);\r\n\r\n if (tableRef?.current) {\r\n tableRef.current.instance.toggleRowEditing(currentRow?._createKey);\r\n }\r\n } else {\r\n setInternalData(data);\r\n }\r\n }, [JSON.stringify(data)]);\r\n\r\n const create = (rowIndexPath: RowIndexPath = undefined, values: object | undefined = {}): RowIndexPath => {\r\n const _createKey = uuid();\r\n const [nexTRow, newRowIndexPath] = insertChildTableRow(internalData, rowIndexPath, { ...values, _createKey });\r\n setActiveRowIndexPath(newRowIndexPath);\r\n setInternalData(nexTRow);\r\n\r\n if (tableRef?.current) {\r\n tableRef.current.instance.toggleRowEditing(_createKey);\r\n }\r\n\r\n return newRowIndexPath;\r\n };\r\n\r\n const remove = (rowIndexPath: any): void => {\r\n const nexTRow = removeChildTableRow(internalData, rowIndexPath);\r\n setInternalData(nexTRow);\r\n setActiveRowIndexPath(undefined);\r\n };\r\n\r\n return {\r\n data: internalData,\r\n create,\r\n remove,\r\n isCreating: activeRowIndexPath !== undefined,\r\n };\r\n};\r\n"],"names":["insertChildTableRow","data","rowIndexPath","undefined","values","nexTRow","JSON","parse","stringify","childRowIndexPath","rowIndexes","convertRowIndexPathToNumberArray","currentRow","getByRowIndexPath","join","nextSubRows","subRows","path","map","i","unshift","set","push","removeChildTableRow","rootIndex","Number","shift","length","unsetPath","index","unset","pop","setPath","compact","get","pullAt","useTableRowCreation","tableRef","internalData","setInternalData","React","useState","activeRowIndexPath","setActiveRowIndexPath","useEffect","parentId","getParentRowIndexPath","newRowIndexPath","current","instance","toggleRowEditing","_createKey","create","uuid","remove","isCreating"],"mappings":";;;;;;;;;MAWaA,mBAAmB,GAAG,CAC/BC,IAD+B,EAE/BC,eAA6BC,SAFE,EAG/BC,SAAc,EAHiB;EAK/B,MAAMC,OAAO,GAAgBC,IAAI,CAACC,KAAL,CAAWD,IAAI,CAACE,SAAL,CAAeP,IAAf,CAAX,CAA7B;EAEA,IAAIQ,iBAAJ;;EAEA,IAAIP,YAAJ,EAAkB;IAAA;;IACd,MAAMQ,UAAU,GAAGC,gCAAgC,CAACT,YAAD,CAAnD;IACA,MAAMU,UAAU,GAAGC,iBAAiB,CAACR,OAAD,EAAUK,UAAU,CAACI,IAAX,CAAgB,GAAhB,CAAV,CAApC;IACA,MAAMC,WAAW,0BAAGH,UAAH,aAAGA,UAAH,uBAAGA,UAAU,CAAEI,OAAf,qEAA0B,EAA3C;IAEA,MAAMC,IAAI,GAAGP,UAAU,CAACQ,GAAX,CAAeC,CAAC,QAAQA,IAAxB,EAA8BL,IAA9B,CAAmC,UAAnC,IAAiD,UAA9D;IACAC,WAAW,CAACK,OAAZ,CAAoBhB,MAApB;IACAiB,GAAG,CAAChB,OAAD,EAAUY,IAAV,EAAgBF,WAAhB,CAAH,CAPc;;IAUdL,UAAU,CAACY,IAAX,CAAgB,CAAhB;IACAb,iBAAiB,GAAGC,UAAU,CAACI,IAAX,CAAgB,GAAhB,CAApB;GAXJ,MAYO;IACHT,OAAO,CAACe,OAAR,CAAgBhB,MAAhB;IACAK,iBAAiB,GAAG,GAApB;;;EAGJ,OAAO,CAACJ,OAAD,EAAUI,iBAAV,CAAP;AACH;MAEYc,mBAAmB,GAAG,CAAQtB,IAAR,EAA2BC,YAA3B;EAC/B,MAAMG,OAAO,GAAGC,IAAI,CAACC,KAAL,CAAWD,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,CAACe,YAAD,EAAepC,YAAf,CAAnC;IACAqC,eAAe,CAAClC,OAAD,CAAf;IACAsC,qBAAqB,CAACxC,SAAD,CAArB;GAHJ;;EAMA,OAAO;IACHF,IAAI,EAAEqC,YADH;IAEHc,MAFG;IAGHE,MAHG;IAIHC,UAAU,EAAEb,kBAAkB,KAAKvC;GAJvC;AAMH;;;;"}
1
+ {"version":3,"file":"useRowCreation.js","sources":["../../../../../src/components/Table/hooks/useRowCreation.tsx"],"sourcesContent":["import React from 'react';\nimport { v4 as uuid } from 'uuid';\nimport set from 'lodash/set';\nimport unset from 'lodash/unset';\nimport get from 'lodash/get';\nimport compact from 'lodash/compact';\nimport pullAt from 'lodash/pullAt';\n\nimport { convertRowIndexPathToNumberArray, getByRowIndexPath, getParentRowIndexPath } from '../util/rowIndexPath';\nimport { Row, RowIndexPath, TableRef } from '../types';\n\nexport const insertChildTableRow = <TRow,>(\n data: Row<TRow>[],\n rowIndexPath: RowIndexPath = undefined,\n values: any = {}\n): [Row<TRow>[], RowIndexPath] => {\n const nexTRow: Row<TRow>[] = JSON.parse(JSON.stringify(data));\n\n let childRowIndexPath;\n\n if (rowIndexPath) {\n const rowIndexes = convertRowIndexPathToNumberArray(rowIndexPath);\n const currentRow = getByRowIndexPath(nexTRow, rowIndexes.join('.'));\n const nextSubRows = currentRow?.subRows ?? [];\n\n const path = rowIndexes.map(i => `[${i}]`).join('.subRows') + '.subRows';\n nextSubRows.unshift(values);\n set(nexTRow, path, nextSubRows);\n\n // rebuild the new id\n rowIndexes.push(0);\n childRowIndexPath = rowIndexes.join('.');\n } else {\n nexTRow.unshift(values);\n childRowIndexPath = '0';\n }\n\n return [nexTRow, childRowIndexPath];\n};\n\nexport const removeChildTableRow = <TRow,>(data: Row<TRow>[], rowIndexPath: RowIndexPath): Row<TRow>[] => {\n const nexTRow = JSON.parse(JSON.stringify(data));\n\n const rowIndexes = convertRowIndexPathToNumberArray(rowIndexPath);\n const rootIndex = Number(rowIndexes.shift());\n\n if (rowIndexes.length) {\n // unset\n const unsetPath = rowIndexes.map(index => `subRows[${index}]`).join('.');\n unset(nexTRow[rootIndex], unsetPath);\n\n // remove empty value from subRows\n rowIndexes.pop();\n const setPath = rowIndexes.length ? rowIndexes.map(index => `subRows[${index}]`).join('.') + '.subRows' : 'subRows';\n set(nexTRow[rootIndex], setPath, compact(get(nexTRow[rootIndex], setPath)));\n } else {\n pullAt(nexTRow, rootIndex);\n }\n\n return nexTRow;\n};\n\nexport type useTableRowCreation<TRow> = {\n data: Row<TRow>[];\n create: (rowIndexPath: RowIndexPath, values?: object | undefined) => RowIndexPath;\n remove: (rowIndexPath: RowIndexPath) => void;\n isCreating: boolean;\n};\n\nexport const useTableRowCreation = <TRow,>(data: Row<TRow>[], tableRef: React.RefObject<TableRef>): useTableRowCreation<TRow> => {\n const [internalData, setInternalData] = React.useState(JSON.parse(JSON.stringify(data)));\n const [activeRowIndexPath, setActiveRowIndexPath] = React.useState<string | undefined>(undefined);\n\n React.useEffect(() => {\n if (activeRowIndexPath !== undefined) {\n // keep the same edit key, so that we don't remount the row/form\n const currentRow: any = getByRowIndexPath(internalData, activeRowIndexPath);\n\n // get the active creation rows parent\n const parentId = getParentRowIndexPath(activeRowIndexPath);\n\n // insert a new empty row in the external data (with the same key)\n const [nexTRow, newRowIndexPath] = insertChildTableRow(JSON.parse(JSON.stringify(data)), parentId, currentRow);\n\n // update and set that row as active, we basically just changed it's position in our internal data\n setActiveRowIndexPath(newRowIndexPath);\n setInternalData(nexTRow);\n\n if (tableRef?.current) {\n tableRef.current.instance.toggleRowEditing(currentRow?._createKey);\n }\n } else {\n setInternalData(data);\n }\n }, [JSON.stringify(data)]);\n\n const create = (rowIndexPath: RowIndexPath = undefined, values: object | undefined = {}): RowIndexPath => {\n const _createKey = uuid();\n const [nexTRow, newRowIndexPath] = insertChildTableRow(internalData, rowIndexPath, { ...values, _createKey });\n setActiveRowIndexPath(newRowIndexPath);\n setInternalData(nexTRow);\n\n if (tableRef?.current) {\n tableRef.current.instance.toggleRowEditing(_createKey);\n }\n\n return newRowIndexPath;\n };\n\n const remove = (rowIndexPath: any): void => {\n const nexTRow = removeChildTableRow(internalData, rowIndexPath);\n setInternalData(nexTRow);\n setActiveRowIndexPath(undefined);\n };\n\n return {\n data: internalData,\n create,\n remove,\n isCreating: activeRowIndexPath !== undefined,\n };\n};\n"],"names":["insertChildTableRow","data","rowIndexPath","undefined","values","nexTRow","JSON","parse","stringify","childRowIndexPath","rowIndexes","convertRowIndexPathToNumberArray","currentRow","getByRowIndexPath","join","nextSubRows","subRows","path","map","i","unshift","set","push","removeChildTableRow","rootIndex","Number","shift","length","unsetPath","index","unset","pop","setPath","compact","get","pullAt","useTableRowCreation","tableRef","internalData","setInternalData","React","useState","activeRowIndexPath","setActiveRowIndexPath","useEffect","parentId","getParentRowIndexPath","newRowIndexPath","current","instance","toggleRowEditing","_createKey","create","uuid","remove","isCreating"],"mappings":";;;;;;;;;MAWaA,mBAAmB,GAAG,CAC/BC,IAD+B,EAE/BC,eAA6BC,SAFE,EAG/BC,SAAc,EAHiB;EAK/B,MAAMC,OAAO,GAAgBC,IAAI,CAACC,KAAL,CAAWD,IAAI,CAACE,SAAL,CAAeP,IAAf,CAAX,CAA7B;EAEA,IAAIQ,iBAAJ;;EAEA,IAAIP,YAAJ,EAAkB;IAAA;;IACd,MAAMQ,UAAU,GAAGC,gCAAgC,CAACT,YAAD,CAAnD;IACA,MAAMU,UAAU,GAAGC,iBAAiB,CAACR,OAAD,EAAUK,UAAU,CAACI,IAAX,CAAgB,GAAhB,CAAV,CAApC;IACA,MAAMC,WAAW,0BAAGH,UAAH,aAAGA,UAAH,uBAAGA,UAAU,CAAEI,OAAf,qEAA0B,EAA3C;IAEA,MAAMC,IAAI,GAAGP,UAAU,CAACQ,GAAX,CAAeC,CAAC,QAAQA,IAAxB,EAA8BL,IAA9B,CAAmC,UAAnC,IAAiD,UAA9D;IACAC,WAAW,CAACK,OAAZ,CAAoBhB,MAApB;IACAiB,G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B/C,mBAAmB,CAACsC,YAAD,EAAepC,YAAf,EAA6B,EAAE,GAAGE,MAAL;MAAa+C;KAA1C,CAAtD;IACAR,qBAAqB,CAACI,eAAD,CAArB;IACAR,eAAe,CAAClC,OAAD,CAAf;;IAEA,IAAIgC,QAAJ,aAAIA,QAAJ,eAAIA,QAAQ,CAAEW,OAAd,EAAuB;MACnBX,QAAQ,CAACW,OAAT,CAAiBC,QAAjB,CAA0BC,gBAA1B,CAA2CC,UAA3C;;;IAGJ,OAAOJ,eAAP;GAVJ;;EAaA,MAAMO,MAAM,GAAIpD,YAAD;IACX,MAAMG,OAAO,GAAGkB,mBAAmB,CAACe,YAAD,EAAepC,YAAf,CAAnC;IACAqC,eAAe,CAAClC,OAAD,CAAf;IACAsC,qBAAqB,CAACxC,SAAD,CAArB;GAHJ;;EAMA,OAAO;IACHF,IAAI,EAAEqC,YADH;IAEHc,MAFG;IAGHE,MAHG;IAIHC,UAAU,EAAEb,kBAAkB,KAAKvC;GAJvC;AAMH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useTable.js","sources":["../../../../../src/components/Table/hooks/useTable.tsx"],"sourcesContent":["import React from 'react';\r\nimport { useTable as useReactTable, useExpanded, useSortBy, usePagination, useRowState } from 'react-table';\r\nimport { getColumnsFromChildren, getInternalSortRules } from '../util';\r\nimport { sortTypes } from '../util/sortTypes';\r\nimport { useRowEditing } from './plugins/useRowEditing';\r\nimport { useRowActions } from './plugins/useRowActions';\r\nimport { useRowSelect } from './plugins/useRowSelect';\r\nimport {\r\n InternalTable,\r\n InternalTableRow,\r\n PaginationHandler,\r\n RowActiveHandler,\r\n SortHandler,\r\n TableProps,\r\n TableRef,\r\n} from '../types';\r\nimport { useTableKeyboardNavigation } from './useTableKeyboardNavigation';\r\nimport { useLocalization } from '../../Provider/Provider';\r\nimport { useRowDraggable } from './plugins/useRowDraggable';\r\nimport { sanitizeRowProps } from '../util';\r\n\r\nconst useTableRowActive = (\r\n activeIndex: number | undefined,\r\n rows: InternalTableRow[],\r\n rowExpansionRenderer: TableProps<any>['rowExpansionRenderer'],\r\n handleonRowActive: RowActiveHandler<any> | undefined\r\n) => {\r\n React.useEffect(() => {\r\n if (activeIndex !== undefined && rows.length && handleonRowActive) {\r\n const focusedRow = rows[activeIndex];\r\n if (focusedRow) {\r\n const sanitizedFocusedRow = sanitizeRowProps(focusedRow, rowExpansionRenderer);\r\n handleonRowActive(sanitizedFocusedRow);\r\n }\r\n }\r\n }, [activeIndex, rows]);\r\n};\r\n\r\nconst useTableInstance = (instance: any, ref: React.RefObject<TableRef>): object => {\r\n const sanitizedInstance = React.useMemo(\r\n () => ({\r\n toggleAllRowsExpanded: instance.toggleAllRowsExpanded,\r\n toggleHideAllColumns: instance.toggleHideAllColumns,\r\n toggleHideColumn: instance.toggleHideColumn,\r\n toggleEditing: instance.toggleEditing,\r\n toggleRowEditing: instance.toggleRowEditing,\r\n resetRowEditing: instance.resetRowEditing,\r\n toggleRowExpanded: instance.toggleRowExpanded,\r\n toggleSortBy: instance.toggleSortBy,\r\n }),\r\n []\r\n );\r\n\r\n React.useEffect(() => {\r\n if (ref?.current) {\r\n ref.current.instance = sanitizedInstance;\r\n }\r\n }, [ref]);\r\n\r\n return sanitizedInstance;\r\n};\r\n\r\nconst useTablePaginationListener = (disablePagination: boolean, onPaginate: PaginationHandler | undefined, state: any): void => {\r\n React.useEffect(() => {\r\n if (!disablePagination && onPaginate) {\r\n onPaginate(state.pageIndex, state.pageSize);\r\n }\r\n }, [state.pageIndex, state.pageSize]);\r\n};\r\n\r\nconst useTableSortingListener = (\r\n data: any[],\r\n sortedRows: any[],\r\n onSort: SortHandler<any> | undefined,\r\n manualSorting: boolean,\r\n state: any\r\n): void => {\r\n React.useEffect(() => {\r\n if (onSort) {\r\n const sortRules = state.sortBy.map((rule: any) => ({ accessor: rule.id, desc: rule.desc }));\r\n\r\n if (manualSorting) {\r\n onSort(sortRules);\r\n } else {\r\n let sortedData;\r\n\r\n if (sortRules.length && sortedRows?.length) {\r\n sortedData = sortedRows.map((row: any) => row.original);\r\n }\r\n\r\n onSort(sortRules, sortedData || data);\r\n }\r\n }\r\n }, [onSort && JSON.stringify(state.sortBy), manualSorting]);\r\n};\r\n\r\nconst DEFAULT_PAGE_SIZE = 10;\r\n\r\nexport const useTable = <T extends {}>(\r\n props: TableProps<T> & { windowed?: boolean },\r\n ref: React.RefObject<TableRef>\r\n): InternalTable => {\r\n const {\r\n children,\r\n data,\r\n dangerouslyHijackGlobalKeyboardNavigation: _1,\r\n onRowClick,\r\n onRowDrag,\r\n onSelectedRows,\r\n rowClassName,\r\n rowExpansionRenderer,\r\n rowHeight,\r\n selectedRows,\r\n\r\n // sorting\r\n disableSorting,\r\n manualSorting,\r\n onSort,\r\n sortRules,\r\n\r\n // pagination\r\n disablePagination = true,\r\n length,\r\n onPaginate,\r\n pageSize = DEFAULT_PAGE_SIZE,\r\n pageIndex = 0,\r\n\r\n // row editing\r\n inlineEditingUniqueId = undefined,\r\n onRowCreate,\r\n\r\n // actions\r\n actions,\r\n onRowEdit,\r\n onRowCopy,\r\n onRowDelete,\r\n onRowActive,\r\n\r\n windowed = false,\r\n\r\n ...otherProps\r\n } = props;\r\n\r\n if ((onSelectedRows && !selectedRows) || (!onSelectedRows && selectedRows)) {\r\n throw new Error(\r\n 'Selected rows in a Table component are fully controlled - you must pass both the `onSelectedRows` and `selectedRows` props when using row selection'\r\n );\r\n }\r\n\r\n const { texts } = useLocalization();\r\n const { columns, sortRules: defaultSortRules } = React.useMemo(\r\n () => getColumnsFromChildren(children, rowExpansionRenderer),\r\n [children, rowExpansionRenderer]\r\n );\r\n\r\n const manualPagination = !disablePagination && !!onPaginate && !!length;\r\n\r\n const {\r\n headerGroups,\r\n rows,\r\n sortedRows,\r\n prepareRow: prepareBaseRow,\r\n state,\r\n // pagination\r\n page,\r\n gotoPage,\r\n setPageSize,\r\n ...instance\r\n }: any = useReactTable(\r\n {\r\n columns,\r\n data,\r\n initialState: {\r\n // eslint-disable-next-line\r\n // @ts-ignore: not sure how to type this correctly right now\r\n sortBy: getInternalSortRules(sortRules) || defaultSortRules,\r\n pageSize: !disablePagination ? pageSize : undefined,\r\n pageIndex: !disablePagination ? pageIndex : undefined,\r\n },\r\n manualPagination,\r\n pageCount: manualPagination && length ? Math.ceil(length / pageSize) : -1,\r\n manualSortBy: manualSorting,\r\n disableSortBy: disableSorting,\r\n // most of these resets preventions are needed for editing mode\r\n autoResetExpanded: false,\r\n autoResetSelectedRows: false,\r\n autoResetSortBy: false,\r\n autoResetPage: false,\r\n sortTypes: React.useMemo(() => sortTypes, []),\r\n useControlledState: currentState => {\r\n return React.useMemo(\r\n () => ({\r\n ...currentState,\r\n selectedRowIds: selectedRows || [],\r\n }),\r\n [currentState, selectedRows]\r\n );\r\n },\r\n },\r\n useRowState,\r\n useSortBy,\r\n useExpanded,\r\n usePagination,\r\n useRowSelect(onSelectedRows),\r\n useRowDraggable(onRowDrag),\r\n useRowEditing(inlineEditingUniqueId),\r\n useRowActions(\r\n inlineEditingUniqueId,\r\n { onRowCreate, onRowEdit, onRowCopy, onRowDelete },\r\n actions,\r\n rowExpansionRenderer,\r\n texts,\r\n windowed\r\n )\r\n );\r\n\r\n useTablePaginationListener(disablePagination, onPaginate, state);\r\n useTableSortingListener(data, sortedRows, onSort, !!manualSorting, state);\r\n\r\n const sanitizedInstance = useTableInstance(instance, ref);\r\n\r\n const visibleRows = !disablePagination && !manualPagination ? page : rows;\r\n\r\n const [activeIndex, setActiveIndex, handleKeyDown, handleFocus] = useTableKeyboardNavigation<T>(\r\n props,\r\n visibleRows,\r\n { onRowClick, onRowCreate, onRowEdit, onRowCopy, onRowDelete, rowExpansionRenderer },\r\n ref\r\n );\r\n\r\n useTableRowActive(activeIndex, rows, rowExpansionRenderer, onRowActive);\r\n\r\n const prepareRow = React.useCallback(\r\n (row: any, index: number) => {\r\n prepareBaseRow(row);\r\n row.setActive = () => setActiveIndex(index);\r\n },\r\n [prepareBaseRow, setActiveIndex]\r\n );\r\n\r\n return {\r\n rowProps: {\r\n activeIndex,\r\n setActiveIndex,\r\n onRowClick,\r\n rowClassName,\r\n rowExpansionRenderer,\r\n rowHeight,\r\n inlineEditingUniqueId,\r\n },\r\n tableProps: {\r\n ...otherProps,\r\n headerGroups,\r\n onFocus: handleFocus,\r\n onKeyDown: handleKeyDown,\r\n tabIndex: otherProps.tabIndex ?? 0,\r\n },\r\n state,\r\n pagination: !disablePagination\r\n ? {\r\n length: manualPagination && length ? length : data.length,\r\n pageIndex: state.pageIndex,\r\n pageSize: state.pageSize,\r\n setPageIndex: gotoPage,\r\n setPageSize: setPageSize,\r\n }\r\n : null,\r\n rows: visibleRows,\r\n prepareRow,\r\n instance: sanitizedInstance,\r\n };\r\n};\r\n"],"names":["useTableRowActive","activeIndex","rows","rowExpansionRenderer","handleonRowActive","React","useEffect","undefined","length","focusedRow","sanitizedFocusedRow","sanitizeRowProps","useTableInstance","instance","ref","sanitizedInstance","useMemo","toggleAllRowsExpanded","toggleHideAllColumns","toggleHideColumn","toggleEditing","toggleRowEditing","resetRowEditing","toggleRowExpanded","toggleSortBy","current","useTablePaginationListener","disablePagination","onPaginate","state","pageIndex","pageSize","useTableSortingListener","data","sortedRows","onSort","manualSorting","sortRules","sortBy","map","rule","accessor","id","desc","sortedData","row","original","JSON","stringify","DEFAULT_PAGE_SIZE","useTable","props","children","dangerouslyHijackGlobalKeyboardNavigation","_1","onRowClick","onRowDrag","onSelectedRows","rowClassName","rowHeight","selectedRows","disableSorting","inlineEditingUniqueId","onRowCreate","actions","onRowEdit","onRowCopy","onRowDelete","onRowActive","windowed","otherProps","Error","texts","useLocalization","columns","defaultSortRules","getColumnsFromChildren","manualPagination","headerGroups","prepareRow","prepareBaseRow","page","gotoPage","setPageSize","useReactTable","initialState","getInternalSortRules","pageCount","Math","ceil","manualSortBy","disableSortBy","autoResetExpanded","autoResetSelectedRows","autoResetSortBy","autoResetPage","sortTypes","useControlledState","currentState","selectedRowIds","useRowState","useSortBy","useExpanded","usePagination","useRowSelect","useRowDraggable","useRowEditing","useRowActions","visibleRows","setActiveIndex","handleKeyDown","handleFocus","useTableKeyboardNavigation","useCallback","index","setActive","rowProps","tableProps","onFocus","onKeyDown","tabIndex","pagination","setPageIndex"],"mappings":";;;;;;;;;;;AAqBA,MAAMA,iBAAiB,GAAG,CACtBC,WADsB,EAEtBC,IAFsB,EAGtBC,oBAHsB,EAItBC,iBAJsB;EAMtBC,cAAK,CAACC,SAAN,CAAgB;IACZ,IAAIL,WAAW,KAAKM,SAAhB,IAA6BL,IAAI,CAACM,MAAlC,IAA4CJ,iBAAhD,EAAmE;MAC/D,MAAMK,UAAU,GAAGP,IAAI,CAACD,WAAD,CAAvB;;MACA,IAAIQ,UAAJ,EAAgB;QACZ,MAAMC,mBAAmB,GAAGC,gBAAgB,CAACF,UAAD,EAAaN,oBAAb,CAA5C;QACAC,iBAAiB,CAACM,mBAAD,CAAjB;;;GALZ,EAQG,CAACT,WAAD,EAAcC,IAAd,CARH;AASH,CAfD;;AAiBA,MAAMU,gBAAgB,GAAG,CAACC,QAAD,EAAgBC,GAAhB;EACrB,MAAMC,iBAAiB,GAAGV,cAAK,CAACW,OAAN,CACtB,OAAO;IACHC,qBAAqB,EAAEJ,QAAQ,CAACI,qBAD7B;IAEHC,oBAAoB,EAAEL,QAAQ,CAACK,oBAF5B;IAGHC,gBAAgB,EAAEN,QAAQ,CAACM,gBAHxB;IAIHC,aAAa,EAAEP,QAAQ,CAACO,aAJrB;IAKHC,gBAAgB,EAAER,QAAQ,CAACQ,gBALxB;IAMHC,eAAe,EAAET,QAAQ,CAACS,eANvB;IAOHC,iBAAiB,EAAEV,QAAQ,CAACU,iBAPzB;IAQHC,YAAY,EAAEX,QAAQ,CAACW;GAR3B,CADsB,EAWtB,EAXsB,CAA1B;EAcAnB,cAAK,CAACC,SAAN,CAAgB;IACZ,IAAIQ,GAAJ,aAAIA,GAAJ,eAAIA,GAAG,CAAEW,OAAT,EAAkB;MACdX,GAAG,CAACW,OA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BA,MAA7B,GAAsCyB,IAAI,CAACzB,MADvD;MAEIsB,SAAS,EAAED,KAAK,CAACC,SAFrB;MAGIC,QAAQ,EAAEF,KAAK,CAACE,QAHpB;MAII2F,YAAY,EAAExC,QAJlB;MAKIC,WAAW,EAAEA;KANX,GAQN,IA1BH;IA2BHjF,IAAI,EAAE0G,WA3BH;IA4BH7B,UA5BG;IA6BHlE,QAAQ,EAAEE;GA7Bd;AA+BH;;;;"}
1
+ {"version":3,"file":"useTable.js","sources":["../../../../../src/components/Table/hooks/useTable.tsx"],"sourcesContent":["import React from 'react';\nimport { useTable as useReactTable, useExpanded, useSortBy, usePagination, useRowState } from 'react-table';\nimport { getColumnsFromChildren, getInternalSortRules } from '../util';\nimport { sortTypes } from '../util/sortTypes';\nimport { useRowEditing } from './plugins/useRowEditing';\nimport { useRowActions } from './plugins/useRowActions';\nimport { useRowSelect } from './plugins/useRowSelect';\nimport {\n InternalTable,\n InternalTableRow,\n PaginationHandler,\n RowActiveHandler,\n SortHandler,\n TableProps,\n TableRef,\n} from '../types';\nimport { useTableKeyboardNavigation } from './useTableKeyboardNavigation';\nimport { useLocalization } from '../../Provider/Provider';\nimport { useRowDraggable } from './plugins/useRowDraggable';\nimport { sanitizeRowProps } from '../util';\n\nconst useTableRowActive = (\n activeIndex: number | undefined,\n rows: InternalTableRow[],\n rowExpansionRenderer: TableProps<any>['rowExpansionRenderer'],\n handleonRowActive: RowActiveHandler<any> | undefined\n) => {\n React.useEffect(() => {\n if (activeIndex !== undefined && rows.length && handleonRowActive) {\n const focusedRow = rows[activeIndex];\n if (focusedRow) {\n const sanitizedFocusedRow = sanitizeRowProps(focusedRow, rowExpansionRenderer);\n handleonRowActive(sanitizedFocusedRow);\n }\n }\n }, [activeIndex, rows]);\n};\n\nconst useTableInstance = (instance: any, ref: React.RefObject<TableRef>): object => {\n const sanitizedInstance = React.useMemo(\n () => ({\n toggleAllRowsExpanded: instance.toggleAllRowsExpanded,\n toggleHideAllColumns: instance.toggleHideAllColumns,\n toggleHideColumn: instance.toggleHideColumn,\n toggleEditing: instance.toggleEditing,\n toggleRowEditing: instance.toggleRowEditing,\n resetRowEditing: instance.resetRowEditing,\n toggleRowExpanded: instance.toggleRowExpanded,\n toggleSortBy: instance.toggleSortBy,\n }),\n []\n );\n\n React.useEffect(() => {\n if (ref?.current) {\n ref.current.instance = sanitizedInstance;\n }\n }, [ref]);\n\n return sanitizedInstance;\n};\n\nconst useTablePaginationListener = (disablePagination: boolean, onPaginate: PaginationHandler | undefined, state: any): void => {\n React.useEffect(() => {\n if (!disablePagination && onPaginate) {\n onPaginate(state.pageIndex, state.pageSize);\n }\n }, [state.pageIndex, state.pageSize]);\n};\n\nconst useTableSortingListener = (\n data: any[],\n sortedRows: any[],\n onSort: SortHandler<any> | undefined,\n manualSorting: boolean,\n state: any\n): void => {\n React.useEffect(() => {\n if (onSort) {\n const sortRules = state.sortBy.map((rule: any) => ({ accessor: rule.id, desc: rule.desc }));\n\n if (manualSorting) {\n onSort(sortRules);\n } else {\n let sortedData;\n\n if (sortRules.length && sortedRows?.length) {\n sortedData = sortedRows.map((row: any) => row.original);\n }\n\n onSort(sortRules, sortedData || data);\n }\n }\n }, [onSort && JSON.stringify(state.sortBy), manualSorting]);\n};\n\nconst DEFAULT_PAGE_SIZE = 10;\n\nexport const useTable = <T extends {}>(\n props: TableProps<T> & { windowed?: boolean },\n ref: React.RefObject<TableRef>\n): InternalTable => {\n const {\n children,\n data,\n dangerouslyHijackGlobalKeyboardNavigation: _1,\n onRowClick,\n onRowDrag,\n onSelectedRows,\n rowClassName,\n rowExpansionRenderer,\n rowHeight,\n selectedRows,\n\n // sorting\n disableSorting,\n manualSorting,\n onSort,\n sortRules,\n\n // pagination\n disablePagination = true,\n length,\n onPaginate,\n pageSize = DEFAULT_PAGE_SIZE,\n pageIndex = 0,\n\n // row editing\n inlineEditingUniqueId = undefined,\n onRowCreate,\n\n // actions\n actions,\n onRowEdit,\n onRowCopy,\n onRowDelete,\n onRowActive,\n\n windowed = false,\n\n ...otherProps\n } = props;\n\n if ((onSelectedRows && !selectedRows) || (!onSelectedRows && selectedRows)) {\n throw new Error(\n 'Selected rows in a Table component are fully controlled - you must pass both the `onSelectedRows` and `selectedRows` props when using row selection'\n );\n }\n\n const { texts } = useLocalization();\n const { columns, sortRules: defaultSortRules } = React.useMemo(\n () => getColumnsFromChildren(children, rowExpansionRenderer),\n [children, rowExpansionRenderer]\n );\n\n const manualPagination = !disablePagination && !!onPaginate && !!length;\n\n const {\n headerGroups,\n rows,\n sortedRows,\n prepareRow: prepareBaseRow,\n state,\n // pagination\n page,\n gotoPage,\n setPageSize,\n ...instance\n }: any = useReactTable(\n {\n columns,\n data,\n initialState: {\n // eslint-disable-next-line\n // @ts-ignore: not sure how to type this correctly right now\n sortBy: getInternalSortRules(sortRules) || defaultSortRules,\n pageSize: !disablePagination ? pageSize : undefined,\n pageIndex: !disablePagination ? pageIndex : undefined,\n },\n manualPagination,\n pageCount: manualPagination && length ? Math.ceil(length / pageSize) : -1,\n manualSortBy: manualSorting,\n disableSortBy: disableSorting,\n // most of these resets preventions are needed for editing mode\n autoResetExpanded: false,\n autoResetSelectedRows: false,\n autoResetSortBy: false,\n autoResetPage: false,\n sortTypes: React.useMemo(() => sortTypes, []),\n useControlledState: currentState => {\n return React.useMemo(\n () => ({\n ...currentState,\n selectedRowIds: selectedRows || [],\n }),\n [currentState, selectedRows]\n );\n },\n },\n useRowState,\n useSortBy,\n useExpanded,\n usePagination,\n useRowSelect(onSelectedRows),\n useRowDraggable(onRowDrag),\n useRowEditing(inlineEditingUniqueId),\n useRowActions(\n inlineEditingUniqueId,\n { onRowCreate, onRowEdit, onRowCopy, onRowDelete },\n actions,\n rowExpansionRenderer,\n texts,\n windowed\n )\n );\n\n useTablePaginationListener(disablePagination, onPaginate, state);\n useTableSortingListener(data, sortedRows, onSort, !!manualSorting, state);\n\n const sanitizedInstance = useTableInstance(instance, ref);\n\n const visibleRows = !disablePagination && !manualPagination ? page : rows;\n\n const [activeIndex, setActiveIndex, handleKeyDown, handleFocus] = useTableKeyboardNavigation<T>(\n props,\n visibleRows,\n { onRowClick, onRowCreate, onRowEdit, onRowCopy, onRowDelete, rowExpansionRenderer },\n ref\n );\n\n useTableRowActive(activeIndex, rows, rowExpansionRenderer, onRowActive);\n\n const prepareRow = React.useCallback(\n (row: any, index: number) => {\n prepareBaseRow(row);\n row.setActive = () => setActiveIndex(index);\n },\n [prepareBaseRow, setActiveIndex]\n );\n\n return {\n rowProps: {\n activeIndex,\n setActiveIndex,\n onRowClick,\n rowClassName,\n rowExpansionRenderer,\n rowHeight,\n inlineEditingUniqueId,\n },\n tableProps: {\n ...otherProps,\n headerGroups,\n onFocus: handleFocus,\n onKeyDown: handleKeyDown,\n tabIndex: otherProps.tabIndex ?? 0,\n },\n state,\n pagination: !disablePagination\n ? {\n length: manualPagination && length ? length : data.length,\n pageIndex: state.pageIndex,\n pageSize: state.pageSize,\n setPageIndex: gotoPage,\n setPageSize: setPageSize,\n }\n : null,\n rows: visibleRows,\n prepareRow,\n instance: sanitizedInstance,\n };\n};\n"],"names":["useTableRowActive","activeIndex","rows","rowExpansionRenderer","handleonRowActive","React","useEffect","undefined","length","focusedRow","sanitizedFocusedRow","sanitizeRowProps","useTableInstance","instance","ref","sanitizedInstance","useMemo","toggleAllRowsExpanded","toggleHideAllColumns","toggleHideColumn","toggleEditing","toggleRowEditing","resetRowEditing","toggleRowExpanded","toggleSortBy","current","useTablePaginationListener","disablePagination","onPaginate","state","pageIndex","pageSize","useTableSortingListener","data","sortedRows","onSort","manualSorting","sortRules","sortBy","map","rule","accessor","id","desc","sortedData","row","original","JSON","stringify","DEFAULT_PAGE_SIZE","useTable","props","children","dangerouslyHijackGlobalKeyboardNavigation","_1","onRowClick","onRowDrag","onSelectedRows","rowClassName","rowHeight","selectedRows","disableSorting","inlineEditingUniqueId","onRowCreate","actions","onRowEdit","onRowCopy","onRowDelete","onRowActive","windowed","otherProps","Error","texts","useLocalization","columns","defaultSortRules","getColumnsFromChildren","manualPagination","headerGroups","prepareRow","prepareBaseRow","page","gotoPage","setPageSize","useReactTable","initialState","getInternalSortRules","pageCount","Math","ceil","manualSortBy","disableSortBy","autoResetExpanded","autoResetSelectedRows","autoResetSortBy","autoResetPage","sortTypes","useControlledState","currentState","selectedRowIds","useRowState","useSortBy","useExpanded","usePagination","useRowSelect","useRowDraggable","useRowEditing","useRowActions","visibleRows","setActiveIndex","handleKeyDown","handleFocus","useTableKeyboardNavigation","useCallback","index","setActive","rowProps","tableProps","onFocus","onKeyDown","tabIndex","pagination","setPageIndex"],"mappings":";;;;;;;;;;;AAqBA,MAAMA,iBAAiB,GAAG,CACtBC,WADsB,EAEtBC,IAFsB,EAGtBC,oBAHsB,EAItBC,iBAJsB;EAMtBC,cAAK,CAACC,SAAN,CAAgB;IACZ,IAAIL,WAAW,KAAKM,SAAhB,IAA6BL,IAAI,CAACM,MAAlC,IAA4CJ,iBAAhD,EAAmE;MAC/D,MAAMK,UAAU,GAAGP,IAAI,CAACD,WAAD,CAAvB;;MACA,IAAIQ,UAAJ,EAAgB;QACZ,MAAMC,mBAAmB,GAAGC,gBAAgB,CAACF,UAAD,EAAaN,oBAAb,CAA5C;QACAC,iBAAiB,CAACM,mBAAD,CAAjB;;;GALZ,EAQG,CAACT,WAAD,EAAcC,IAAd,CARH;AASH,CAfD;;AAiBA,MAAMU,gBAAgB,GAAG,CAACC,QAAD,EAAgBC,GAAhB;EACrB,MAAMC,iBAAiB,GAAGV,cAAK,CAACW,OAAN,CACtB,OAAO;IACHC,qBAAqB,EAAEJ,QAAQ,CAACI,qBAD7B;IAEHC,oBAAoB,EAAEL,QAAQ,CAACK,oBAF5B;IAGHC,gBAAgB,EAAEN,QAAQ,CAACM,gBAHxB;IAIHC,aAAa,EAAEP,QAAQ,CAACO,aAJrB;IAKHC,gBAAgB,EAAER,QAAQ,CAACQ,gBALxB;IAMHC,eAAe,EAAET,QAAQ,CAACS,eANvB;IAOHC,iBAAiB,EAAEV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GRwC,OAAO,EAAEP,WAHD;MAIRQ,SAAS,EAAET,aAJH;MAKRU,QAAQ,0BAAElD,UAAU,CAACkD,QAAb,uEAAyB;KAflC;IAiBH3F,KAjBG;IAkBH4F,UAAU,EAAE,CAAC9F,iBAAD,GACN;MACInB,MAAM,EAAEqE,gBAAgB,IAAIrE,MAApB,GAA6BA,MAA7B,GAAsCyB,IAAI,CAACzB,MADvD;MAEIsB,SAAS,EAAED,KAAK,CAACC,SAFrB;MAGIC,QAAQ,EAAEF,KAAK,CAACE,QAHpB;MAII2F,YAAY,EAAExC,QAJlB;MAKIC,WAAW,EAAEA;KANX,GAQN,IA1BH;IA2BHjF,IAAI,EAAE0G,WA3BH;IA4BH7B,UA5BG;IA6BHlE,QAAQ,EAAEE;GA7Bd;AA+BH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"renderColumn.js","sources":["../../../../../src/components/Table/util/renderColumn.tsx"],"sourcesContent":["import React from 'react';\r\nimport cn from 'classnames';\r\nimport { Icon } from '../../Icon/Icon';\r\n\r\nexport const Column = ({ cell }: any): any => {\r\n const props = {\r\n ...cell.getHeaderProps(),\r\n ...(cell.getSortByToggleProps && cell.getSortByToggleProps({ title: undefined })),\r\n className: cn('yt-table__cell flex flex-1 truncate p-2 align-middle text-grey-darkest hover:text-black', cell.className, {\r\n 'yt-table__cell__group': !!cell.columns,\r\n 'cursor-pointer': !cell.disableSorting,\r\n 'justify-start text-left': cell.align === 'left',\r\n 'justify-end text-right': cell.align === 'right',\r\n 'justify-center text-center': cell.align === 'center' || !cell.align,\r\n }),\r\n style: { ...cell.style, flex: cell.flex },\r\n };\r\n\r\n if (cell.isSorted) {\r\n props['aria-sort'] = cell.isSortedDesc ? 'descending' : 'ascending';\r\n }\r\n\r\n return (\r\n <div {...props} key={cell.id} data-taco=\"table-column\">\r\n <span className=\"truncate\">{cell.render('Header')}</span>\r\n {cell.isSorted ? (\r\n <Icon name={cell.isSortedDesc ? 'chevron-down-solid' : 'chevron-up-solid'} className=\"-mt-0.5\" />\r\n ) : null}\r\n </div>\r\n );\r\n};\r\n"],"names":["Column","cell","props","getHeaderProps","getSortByToggleProps","title","undefined","className","cn","columns","disableSorting","align","style","flex","isSorted","isSortedDesc","React","key","id","render","Icon","name"],"mappings":";;;;MAIaA,MAAM,GAAG,CAAC;EAAEC;AAAF,CAAD;EAClB,MAAMC,KAAK,GAAG,EACV,GAAGD,IAAI,CAACE,cAAL,EADO;IAEV,IAAIF,IAAI,CAACG,oBAAL,IAA6BH,IAAI,CAACG,oBAAL,CAA0B;MAAEC,KAAK,EAAEC;KAAnC,CAAjC,CAFU;IAGVC,SAAS,EAAEC,EAAE,CAAC,yFAAD,EAA4FP,IAAI,CAACM,SAAjG,EAA4G;MACrH,yBAAyB,CAAC,CAACN,IAAI,CAACQ,OADqF;MAErH,kBAAkB,CAACR,IAAI,CAACS,cAF6F;MAGrH,2BAA2BT,IAAI,CAACU,KAAL,KAAe,MAH2E;MAIrH,0BAA0BV,IAAI,CAACU,KAAL,KAAe,OAJ4E;MAKrH,8BAA8BV,IAAI,CAACU,KAAL,KAAe,QAAf,IAA2B,CAACV,IAAI,CAACU;KALtD,CAHH;IAUVC,KAAK,EAAE,EAAE,GAAGX,IAAI,CAACW,KAAV;MAAiBC,IAAI,EAAEZ,IAAI,CAACY;;GAVvC;;EAaA,IAAIZ,IAAI,CAACa,QAAT,EAAmB;IACfZ,KAAK,CAAC,WAAD,CAAL,GAAqBD,IAAI,CAACc,YAAL,GAAoB,YAApB,GAAmC,WAAxD;;;EAGJ,OACIC,4BAAA,MAAA,oBAASd;IAAOe,GAAG,EAAEhB,IAAI,CAACiB;iBAAc;IAAxC,EACIF,4BAAA,OAAA;IAAMT,SAAS,EAAC;GAAhB,EAA4BN,IAAI,CAACkB,MAAL,CAAY,QAAZ,CAA5B,CADJ,EAEKlB,IAAI,CAACa,QAAL,GACGE,4BAAA,CAACI,IAAD;IAAMC,IAAI,EAAEpB,IAAI,CAACc,YAAL,GAAoB,oBAApB,GAA2C;IAAoBR,SAAS,EAAC;GAArF,CADH,GAEG,IAJR,CADJ;AAQH;;;;"}
1
+ {"version":3,"file":"renderColumn.js","sources":["../../../../../src/components/Table/util/renderColumn.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Icon } from '../../Icon/Icon';\n\nexport const Column = ({ cell }: any): any => {\n const props = {\n ...cell.getHeaderProps(),\n ...(cell.getSortByToggleProps && cell.getSortByToggleProps({ title: undefined })),\n className: cn('yt-table__cell flex flex-1 truncate p-2 align-middle text-grey-darkest hover:text-black', cell.className, {\n 'yt-table__cell__group': !!cell.columns,\n 'cursor-pointer': !cell.disableSorting,\n 'justify-start text-left': cell.align === 'left',\n 'justify-end text-right': cell.align === 'right',\n 'justify-center text-center': cell.align === 'center' || !cell.align,\n }),\n style: { ...cell.style, flex: cell.flex },\n };\n\n if (cell.isSorted) {\n props['aria-sort'] = cell.isSortedDesc ? 'descending' : 'ascending';\n }\n\n return (\n <div {...props} key={cell.id} data-taco=\"table-column\">\n <span className=\"truncate\">{cell.render('Header')}</span>\n {cell.isSorted ? (\n <Icon name={cell.isSortedDesc ? 'chevron-down-solid' : 'chevron-up-solid'} className=\"-mt-0.5\" />\n ) : null}\n </div>\n );\n};\n"],"names":["Column","cell","props","getHeaderProps","getSortByToggleProps","title","undefined","className","cn","columns","disableSorting","align","style","flex","isSorted","isSortedDesc","React","key","id","render","Icon","name"],"mappings":";;;;MAIaA,MAAM,GAAG,CAAC;EAAEC;AAAF,CAAD;EAClB,MAAMC,KAAK,GAAG,EACV,GAAGD,IAAI,CAACE,cAAL,EADO;IAEV,IAAIF,IAAI,CAACG,oBAAL,IAA6BH,IAAI,CAACG,oBAAL,CAA0B;MAAEC,KAAK,EAAEC;KAAnC,CAAjC,CAFU;IAGVC,SAAS,EAAEC,EAAE,CAAC,yFAAD,EAA4FP,IAAI,CAACM,SAAjG,EAA4G;MACrH,yBAAyB,CAAC,CAACN,IAAI,CAACQ,OADqF;MAErH,kBAAkB,CAACR,IAAI,CAACS,cAF6F;MAGrH,2BAA2BT,IAAI,CAACU,KAAL,KAAe,MAH2E;MAIrH,0BAA0BV,IAAI,CAACU,KAAL,KAAe,OAJ4E;MAKrH,8BAA8BV,IAAI,CAACU,KAAL,KAAe,QAAf,IAA2B,CAACV,IAAI,CAACU;KALtD,CAHH;IAUVC,KAAK,EAAE,EAAE,GAAGX,IAAI,CAACW,KAAV;MAAiBC,IAAI,EAAEZ,IAAI,CAACY;;GAVvC;;EAaA,IAAIZ,IAAI,CAACa,QAAT,EAAmB;IACfZ,KAAK,CAAC,WAAD,CAAL,GAAqBD,IAAI,CAACc,YAAL,GAAoB,YAApB,GAAmC,WAAxD;;;EAGJ,OACIC,4BAAA,MAAA,oBAASd;IAAOe,GAAG,EAAEhB,IAAI,CAACiB;iBAAc;IAAxC,EACIF,4BAAA,OAAA;IAAMT,SAAS,EAAC;GAAhB,EAA4BN,IAAI,CAACkB,MAAL,CAAY,QAAZ,CAA5B,CADJ,EAEKlB,IAAI,CAACa,QAAL,GACGE,4BAAA,CAACI,IAAD;IAAMC,IAAI,EAAEpB,IAAI,CAACc,YAAL,GAAoB,oBAApB,GAA2C;IAAoBR,SAAS,EAAC;GAArF,CADH,GAEG,IAJR,CADJ;AAQH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"renderRow.js","sources":["../../../../../src/components/Table/util/renderRow.tsx"],"sourcesContent":["import React from 'react';\r\nimport cn from 'classnames';\r\nimport { FocusScope } from '@react-aria/focus';\r\nimport { InternalTableCell, TableRow } from '../types';\r\nimport { sanitizeRowProps } from '../util';\r\n\r\nconst renderCell = (cell: InternalTableCell, row: TableRow<any>): JSX.Element => {\r\n const props = {\r\n ...cell.getCellProps(),\r\n className: cn('yt-table__cell flex-1 truncate p-2 align-middle', cell.column.className, {\r\n 'justify-start text-left': cell.column.align === 'left',\r\n 'justify-end text-right': cell.column.align === 'right',\r\n 'text-center': !cell.column.align,\r\n }),\r\n style: {\r\n ...cell.column.style,\r\n flex: typeof cell.column.flex === 'function' ? cell.column.flex(row) : cell.column.flex,\r\n },\r\n };\r\n return (\r\n <div {...props} role=\"gridcell\" data-taco=\"table-cell\">\r\n {cell.render('Cell') || null}\r\n </div>\r\n );\r\n};\r\n\r\nexport const Row = React.forwardRef(function TableRow({ row, index, instance, headerGroups, ...rowProps }: any, ref: any) {\r\n const {\r\n activeIndex,\r\n onRowClick,\r\n rowClassName,\r\n rowExpansionRenderer,\r\n rowHeight,\r\n setActiveIndex,\r\n style,\r\n inlineEditingUniqueId,\r\n } = rowProps;\r\n const sanitizedRow = sanitizeRowProps(row, rowExpansionRenderer);\r\n\r\n const props = {\r\n ...row.getRowProps(),\r\n style: {\r\n ...style,\r\n minHeight: rowHeight ? `${rowHeight}px` : undefined,\r\n paddingLeft: row.depth ? `${row.depth * 2}rem` : undefined,\r\n },\r\n className: cn(\r\n 'yt-table__row border-grey-light flex border-b min-h-[2.5rem] hover:bg-grey-light',\r\n {\r\n 'yt-table__row--active bg-grey-light hover:bg-grey-light': activeIndex === index,\r\n 'yt-table__row--clickable': !!onRowClick,\r\n 'yt-table__row--dragging': !!row.isDragging,\r\n 'yt-table__row--editing': !!row.isEditing,\r\n },\r\n typeof rowClassName === 'function' ? rowClassName(sanitizedRow) : rowClassName\r\n ),\r\n onClick: onRowClick\r\n ? (event: React.MouseEvent<HTMLElement>) => {\r\n if (\r\n event.target === event.currentTarget ||\r\n (event.target as HTMLElement).classList.contains('yt-table__cell')\r\n ) {\r\n event.preventDefault();\r\n event.persist();\r\n setActiveIndex(index);\r\n onRowClick(sanitizedRow);\r\n }\r\n }\r\n : () => {\r\n setActiveIndex(index);\r\n },\r\n };\r\n\r\n let cells = row.cells;\r\n\r\n if (row.depth > 0) {\r\n cells = row.cells.filter((cell: any) => !cell.column.hiddenOnSubRows);\r\n }\r\n\r\n const expandedRow = rowExpansionRenderer && row.isExpanded && <div>{rowExpansionRenderer(sanitizedRow, instance)}</div>;\r\n const rowContent = React.useMemo(() => {\r\n return (\r\n <>\r\n <FocusScope key={row.original._createKey} contain restoreFocus autoFocus>\r\n <div {...props} role=\"row\" ref={ref}>\r\n <input type=\"hidden\" name=\"_rowIndexPath\" value={row.id} />\r\n <input type=\"hidden\" name=\"_inlineEditingUniqueId\" value={row.original[inlineEditingUniqueId]} />\r\n {cells.map((cell: InternalTableCell) => renderCell(cell, sanitizedRow))}\r\n </div>\r\n </FocusScope>\r\n {expandedRow}\r\n </>\r\n );\r\n }, [row.original._createKey]);\r\n\r\n if (row.isEditing) {\r\n return rowContent;\r\n }\r\n\r\n return (\r\n <>\r\n <div {...props} role=\"row\" ref={ref}>\r\n {cells.map((cell: InternalTableCell) => renderCell(cell, sanitizedRow))}\r\n </div>\r\n {expandedRow}\r\n </>\r\n );\r\n});\r\n"],"names":["renderCell","cell","row","props","getCellProps","className","cn","column","align","style","flex","React","role","render","Row","forwardRef","TableRow","index","instance","headerGroups","rowProps","ref","activeIndex","onRowClick","rowClassName","rowExpansionRenderer","rowHeight","setActiveIndex","inlineEditingUniqueId","sanitizedRow","sanitizeRowProps","getRowProps","minHeight","undefined","paddingLeft","depth","isDragging","isEditing","onClick","event","target","currentTarget","classList","contains","preventDefault","persist","cells","filter","hiddenOnSubRows","expandedRow","isExpanded","rowContent","useMemo","FocusScope","key","original","_createKey","contain","restoreFocus","autoFocus","type","name","value","id","map"],"mappings":";;;;;AAMA,MAAMA,UAAU,GAAG,CAACC,IAAD,EAA0BC,GAA1B;EACf,MAAMC,KAAK,GAAG,EACV,GAAGF,IAAI,CAACG,YAAL,EADO;IAEVC,SAAS,EAAEC,EAAE,CAAC,iDAAD,EAAoDL,IAAI,CAACM,MAAL,CAAYF,SAAhE,EAA2E;MACpF,2BAA2BJ,IAAI,CAACM,MAAL,CAAYC,KAAZ,KAAsB,MADmC;MAEpF,0BAA0BP,IAAI,CAACM,MAAL,CAAYC,KAAZ,KAAsB,OAFoC;MAGpF,eAAe,CAACP,IAAI,CAACM,MAAL,CAAYC;KAHnB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ASC,IAAI,EAAC;MAAyBC,KAAK,EAAE5D,GAAG,CAACqD,QAAJ,CAAa3B,qBAAb;KAA1D,CAFJ,EAGKkB,KAAK,CAACkB,GAAN,CAAW/D,IAAD,IAA6BD,UAAU,CAACC,IAAD,EAAO4B,YAAP,CAAjD,CAHL,CADJ,CADJ,EAQKoB,WARL,CADJ;GADe,EAahB,CAAC/C,GAAG,CAACqD,QAAJ,CAAaC,UAAd,CAbgB,CAAnB;;EAeA,IAAItD,GAAG,CAACmC,SAAR,EAAmB;IACf,OAAOc,UAAP;;;EAGJ,OACIxC,4BAAA,wBAAA,MAAA,EACIA,4BAAA,MAAA,oBAASR;IAAOS,IAAI,EAAC;IAAMS,GAAG,EAAEA;IAAhC,EACKyB,KAAK,CAACkB,GAAN,CAAW/D,IAAD,IAA6BD,UAAU,CAACC,IAAD,EAAO4B,YAAP,CAAjD,CADL,CADJ,EAIKoB,WAJL,CADJ;AAQH,CAjFkB;;;;"}
1
+ {"version":3,"file":"renderRow.js","sources":["../../../../../src/components/Table/util/renderRow.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { FocusScope } from '@react-aria/focus';\nimport { InternalTableCell, TableRow } from '../types';\nimport { sanitizeRowProps } from '../util';\n\nconst renderCell = (cell: InternalTableCell, row: TableRow<any>): JSX.Element => {\n const props = {\n ...cell.getCellProps(),\n className: cn('yt-table__cell flex-1 truncate p-2 align-middle', cell.column.className, {\n 'justify-start text-left': cell.column.align === 'left',\n 'justify-end text-right': cell.column.align === 'right',\n 'text-center': !cell.column.align,\n }),\n style: {\n ...cell.column.style,\n flex: typeof cell.column.flex === 'function' ? cell.column.flex(row) : cell.column.flex,\n },\n };\n return (\n <div {...props} role=\"gridcell\" data-taco=\"table-cell\">\n {cell.render('Cell') || null}\n </div>\n );\n};\n\nexport const Row = React.forwardRef(function TableRow({ row, index, instance, headerGroups, ...rowProps }: any, ref: any) {\n const {\n activeIndex,\n onRowClick,\n rowClassName,\n rowExpansionRenderer,\n rowHeight,\n setActiveIndex,\n style,\n inlineEditingUniqueId,\n } = rowProps;\n const sanitizedRow = sanitizeRowProps(row, rowExpansionRenderer);\n\n const props = {\n ...row.getRowProps(),\n style: {\n ...style,\n minHeight: rowHeight ? `${rowHeight}px` : undefined,\n paddingLeft: row.depth ? `${row.depth * 2}rem` : undefined,\n },\n className: cn(\n 'yt-table__row border-grey-light flex border-b min-h-[2.5rem] hover:bg-grey-light',\n {\n 'yt-table__row--active bg-grey-light hover:bg-grey-light': activeIndex === index,\n 'yt-table__row--clickable': !!onRowClick,\n 'yt-table__row--dragging': !!row.isDragging,\n 'yt-table__row--editing': !!row.isEditing,\n },\n typeof rowClassName === 'function' ? rowClassName(sanitizedRow) : rowClassName\n ),\n onClick: onRowClick\n ? (event: React.MouseEvent<HTMLElement>) => {\n if (\n event.target === event.currentTarget ||\n (event.target as HTMLElement).classList.contains('yt-table__cell')\n ) {\n event.preventDefault();\n event.persist();\n setActiveIndex(index);\n onRowClick(sanitizedRow);\n }\n }\n : () => {\n setActiveIndex(index);\n },\n };\n\n let cells = row.cells;\n\n if (row.depth > 0) {\n cells = row.cells.filter((cell: any) => !cell.column.hiddenOnSubRows);\n }\n\n const expandedRow = rowExpansionRenderer && row.isExpanded && <div>{rowExpansionRenderer(sanitizedRow, instance)}</div>;\n const rowContent = React.useMemo(() => {\n return (\n <>\n <FocusScope key={row.original._createKey} contain restoreFocus autoFocus>\n <div {...props} role=\"row\" ref={ref}>\n <input type=\"hidden\" name=\"_rowIndexPath\" value={row.id} />\n <input type=\"hidden\" name=\"_inlineEditingUniqueId\" value={row.original[inlineEditingUniqueId]} />\n {cells.map((cell: InternalTableCell) => renderCell(cell, sanitizedRow))}\n </div>\n </FocusScope>\n {expandedRow}\n </>\n );\n }, [row.original._createKey]);\n\n if (row.isEditing) {\n return rowContent;\n }\n\n return (\n <>\n <div {...props} role=\"row\" ref={ref}>\n {cells.map((cell: InternalTableCell) => renderCell(cell, sanitizedRow))}\n </div>\n {expandedRow}\n </>\n );\n});\n"],"names":["renderCell","cell","row","props","getCellProps","className","cn","column","align","style","flex","React","role","render","Row","forwardRef","TableRow","index","instance","headerGroups","rowProps","ref","activeIndex","onRowClick","rowClassName","rowExpansionRenderer","rowHeight","setActiveIndex","inlineEditingUniqueId","sanitizedRow","sanitizeRowProps","getRowProps","minHeight","undefined","paddingLeft","depth","isDragging","isEditing","onClick","event","target","currentTarget","classList","contains","preventDefault","persist","cells","filter","hiddenOnSubRows","expandedRow","isExpanded","rowContent","useMemo","FocusScope","key","original","_createKey","contain","restoreFocus","autoFocus","type","name","value","id","map"],"mappings":";;;;;AAMA,MAAMA,UAAU,GAAG,CAACC,IAAD,EAA0BC,GAA1B;EACf,MAAMC,KAAK,GAAG,EACV,GAAGF,IAAI,CAACG,YAAL,EADO;IAEVC,SAAS,EAAEC,EAAE,CAAC,iDAAD,EAAoDL,IAAI,CAACM,MAAL,CAAYF,SAAhE,EAA2E;MACpF,2BAA2BJ,IAAI,CAACM,MAAL,CAAYC,KAAZ,KAAsB,MADmC;MAEpF,0BAA0BP,IAAI,CAACM,MAAL,CAAYC,KAAZ,KAAsB,OAFoC;MAGpF,eAAe,CAACP,IAAI,CAACM,MAAL,CAAYC;KAHnB,CAFH;IAOVC,KAAK,EAAE,EACH,GAAGR,IAAI,CAACM,MAAL,CAAYE,KADZ;MAEHC,IAAI,EAAE,OAAOT,IAAI,CAACM,MAAL,CAAYG,IAAnB,KAA4B,UAA5B,GAAyCT,IAAI,CAACM,MAAL,CAAYG,IAAZ,CAAiBR,GAAjB,CAAzC,GAAiED,IAAI,CAACM,MAAL,CAAYG;;GAT3F;EAYA,OACIC,4BAAA,MAAA,oBAASR;IAAOS,IAAI,EAAC;iBAAqB;IAA1C,EACKX,IAAI,CAACY,MAAL,CAAY,MAAZ,KAAuB,IAD5B,CADJ;AAKH,CAlBD;;MAoBaC,GAAG,gBAAGH,cAAK,CAACI,UAAN,CAAiB,SAASC,QAAT,CAAkB;EAAEd,GAAF;EAA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B,GAAN,CAAW/D,IAAD,IAA6BD,UAAU,CAACC,IAAD,EAAO4B,YAAP,CAAjD,CADL,CADJ,EAIKoB,WAJL,CADJ;AAQH,CAjFkB;;;;"}
@@ -1,17 +1,21 @@
1
+ import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../_virtual/_rollupPluginBabelHelpers.js';
1
2
  import { forwardRef, createElement } from 'react';
2
3
  import cn from 'classnames';
3
4
  import { Root, List, Trigger, Content } from '@radix-ui/react-tabs';
4
5
 
5
- const Tabs = /*#__PURE__*/forwardRef(function Tabs(props, ref) {
6
- const {
7
- id,
8
- defaultId,
9
- children,
10
- onChange,
11
- orientation = 'horizontal',
12
- ...otherProps
13
- } = props;
14
- const className = cn('yt-tabs', `yt-tabs--${orientation}`, {
6
+ var _excluded = ["id", "defaultId", "children", "onChange", "orientation"],
7
+ _excluded2 = ["id", "disabled"],
8
+ _excluded3 = ["id"];
9
+ var Tabs = /*#__PURE__*/forwardRef(function Tabs(props, ref) {
10
+ var id = props.id,
11
+ defaultId = props.defaultId,
12
+ children = props.children,
13
+ onChange = props.onChange,
14
+ _props$orientation = props.orientation,
15
+ orientation = _props$orientation === void 0 ? 'horizontal' : _props$orientation,
16
+ otherProps = _objectWithoutPropertiesLoose(props, _excluded);
17
+
18
+ var className = cn('yt-tabs', "yt-tabs--" + orientation, {
15
19
  'flex w-full': orientation === 'vertical'
16
20
  }, props.className);
17
21
  return createElement(Root, Object.assign({}, otherProps, {
@@ -25,20 +29,19 @@ const Tabs = /*#__PURE__*/forwardRef(function Tabs(props, ref) {
25
29
  value: id
26
30
  }), children);
27
31
  });
28
- const TabList = /*#__PURE__*/forwardRef(function Tab(props, ref) {
29
- const className = cn('yt-tab__list border-b border-grey-light flex flex-row m-0 mb-4', props.className);
32
+ var TabList = /*#__PURE__*/forwardRef(function Tab(props, ref) {
33
+ var className = cn('yt-tab__list border-b border-grey-light flex flex-row m-0 mb-4', props.className);
30
34
  return createElement(List, Object.assign({}, props, {
31
35
  className: className,
32
36
  ref: ref
33
37
  }));
34
38
  });
35
- const TabTrigger = /*#__PURE__*/forwardRef(function Tab(props, ref) {
36
- const {
37
- id,
38
- disabled,
39
- ...otherProps
40
- } = props;
41
- const className = cn('yt-tab bg-transparent border-b-2 border-transparent text-grey-darkest m-0 py-2 px-4', disabled ? 'cursor-not-allowed !text-grey-darker' : 'cursor-pointer rounded-t hover:border-grey-dark aria-selected:border-blue aria-selected:text-black aria-selected:hover:border-blue-light hover:text-black active:yt-focus active:border-blue focus:yt-focus focus:border-blue', props.className);
39
+ var TabTrigger = /*#__PURE__*/forwardRef(function Tab(props, ref) {
40
+ var id = props.id,
41
+ disabled = props.disabled,
42
+ otherProps = _objectWithoutPropertiesLoose(props, _excluded2);
43
+
44
+ var className = cn('yt-tab bg-transparent border-b-2 border-transparent text-grey-darkest m-0 py-2 px-4', disabled ? 'cursor-not-allowed !text-grey-darker' : 'cursor-pointer rounded-t hover:border-grey-dark aria-selected:border-blue aria-selected:text-black aria-selected:hover:border-blue-light hover:text-black active:yt-focus active:border-blue focus:yt-focus focus:border-blue', props.className);
42
45
  return createElement(Trigger, Object.assign({}, otherProps, {
43
46
  className: className,
44
47
  disabled: disabled,
@@ -49,12 +52,11 @@ const TabTrigger = /*#__PURE__*/forwardRef(function Tab(props, ref) {
49
52
  value: id
50
53
  }));
51
54
  });
52
- const TabContent = /*#__PURE__*/forwardRef(function Tab(props, ref) {
53
- const {
54
- id,
55
- ...otherProps
56
- } = props;
57
- const className = cn('yt-tab__panel outline-none', props.className);
55
+ var TabContent = /*#__PURE__*/forwardRef(function Tab(props, ref) {
56
+ var id = props.id,
57
+ otherProps = _objectWithoutPropertiesLoose(props, _excluded3);
58
+
59
+ var className = cn('yt-tab__panel outline-none', props.className);
58
60
  return createElement(Content, Object.assign({}, otherProps, {
59
61
  className: className,
60
62
  ref: ref,
@@ -1 +1 @@
1
- {"version":3,"file":"Tabs.js","sources":["../../../../src/components/Tabs/Tabs.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport cn from 'classnames';\r\nimport * as TabsPrimitive from '@radix-ui/react-tabs';\r\n\r\nimport { Orientation } from '../../types';\r\nimport './Tabs.css';\r\n\r\nexport type TabsProps = React.HTMLAttributes<HTMLDivElement> & {\r\n /**\r\n * The controlled value of the tab to activate. Should be used in conjunction with `onChange`.\r\n */\r\n id?: string;\r\n /**\r\n * Set which tab is selected on mount.\r\n * This has to be one of the existing ids provided for tabs\r\n */\r\n defaultId?: string;\r\n /**\r\n * Content should be one or an array of `Tabs.Trigger` components inside `Tabs.List` and then\r\n * followed by one or an array of `Tabs.Content`.\r\n * *Note* that there can also be tabs that are rendered conditionally.\r\n */\r\n children: React.ReactNode;\r\n /**\r\n * Define orientation of tabs.\r\n * @defaultValue horizontal\r\n */\r\n orientation?: Orientation;\r\n /**\r\n * Callback that is called when tab is changed.\r\n */\r\n onChange?: (id: string) => void;\r\n};\r\n\r\nexport type TabListProps = React.HTMLAttributes<HTMLDivElement>;\r\n\r\nexport type TabTriggerProps = React.HTMLAttributes<HTMLButtonElement> & {\r\n /**\r\n * A unique value that associates the trigger with a content.\r\n */\r\n id: string;\r\n /**\r\n * When true, prevents the user from interacting with the tab.\r\n */\r\n disabled?: boolean;\r\n};\r\n\r\nexport type TabContentProps = React.HTMLAttributes<HTMLDivElement> & {\r\n /**\r\n * A unique value that associates the content with a trigger.\r\n */\r\n id: string;\r\n};\r\n\r\nexport type ForwardedTabsWithStatics = React.ForwardRefExoticComponent<TabsProps & React.RefAttributes<HTMLDivElement>> & {\r\n /** Tab list component containing all tab triggers, rendered in a `Tabs` group component */\r\n List: React.ForwardRefExoticComponent<TabListProps & React.RefAttributes<HTMLDivElement>>;\r\n /** Tab trigger component rendered in a `Tabs.List` component */\r\n Trigger: React.ForwardRefExoticComponent<TabTriggerProps & React.RefAttributes<HTMLButtonElement>>;\r\n /** Tab content component rendered in a `Tabs` group component */\r\n Content: React.ForwardRefExoticComponent<TabContentProps & React.RefAttributes<HTMLDivElement>>;\r\n};\r\n\r\nexport const Tabs = React.forwardRef(function Tabs(props: TabsProps, ref: React.Ref<HTMLDivElement>) {\r\n const { id, defaultId, children, onChange, orientation = 'horizontal', ...otherProps } = props;\r\n const className = cn(\r\n 'yt-tabs',\r\n `yt-tabs--${orientation}`,\r\n {\r\n 'flex w-full': orientation === 'vertical',\r\n },\r\n props.className\r\n );\r\n\r\n return (\r\n <TabsPrimitive.Root\r\n {...otherProps}\r\n className={className}\r\n data-taco=\"tabs\"\r\n defaultValue={defaultId}\r\n dir=\"ltr\"\r\n onValueChange={onChange}\r\n orientation={orientation}\r\n ref={ref}\r\n value={id}\r\n >\r\n {children}\r\n </TabsPrimitive.Root>\r\n );\r\n}) as ForwardedTabsWithStatics;\r\n\r\nconst TabList = React.forwardRef(function Tab(props: TabListProps, ref: React.Ref<HTMLDivElement>) {\r\n const className = cn('yt-tab__list border-b border-grey-light flex flex-row m-0 mb-4', props.className);\r\n\r\n return <TabsPrimitive.List {...props} className={className} ref={ref} />;\r\n});\r\n\r\nconst TabTrigger = React.forwardRef(function Tab(props: TabTriggerProps, ref: React.Ref<HTMLButtonElement>) {\r\n const { id, disabled, ...otherProps } = props;\r\n const className = cn(\r\n 'yt-tab bg-transparent border-b-2 border-transparent text-grey-darkest m-0 py-2 px-4',\r\n disabled\r\n ? 'cursor-not-allowed !text-grey-darker'\r\n : 'cursor-pointer rounded-t hover:border-grey-dark aria-selected:border-blue aria-selected:text-black aria-selected:hover:border-blue-light hover:text-black active:yt-focus active:border-blue focus:yt-focus focus:border-blue',\r\n props.className\r\n );\r\n\r\n return (\r\n <TabsPrimitive.Trigger\r\n {...otherProps}\r\n className={className}\r\n disabled={disabled}\r\n ref={ref}\r\n style={{\r\n transition: 'border 0.2s ease-in',\r\n }}\r\n value={id}\r\n />\r\n );\r\n});\r\n\r\nconst TabContent = React.forwardRef(function Tab(props: TabContentProps, ref: React.Ref<HTMLDivElement>) {\r\n const { id, ...otherProps } = props;\r\n const className = cn('yt-tab__panel outline-none', props.className);\r\n\r\n return <TabsPrimitive.Content {...otherProps} className={className} ref={ref} value={id} />;\r\n});\r\n\r\nTabs.List = TabList;\r\nTabs.Trigger = TabTrigger;\r\nTabs.Content = TabContent;\r\n"],"names":["Tabs","React","props","ref","id","defaultId","children","onChange","orientation","otherProps","className","cn","TabsPrimitive","defaultValue","dir","onValueChange","value","TabList","Tab","TabTrigger","disabled","style","transition","TabContent","List","Trigger","Content"],"mappings":";;;;MA+DaA,IAAI,gBAAGC,UAAA,CAAiB,SAASD,IAAT,CAAcE,KAAd,EAAgCC,GAAhC;EACjC,MAAM;IAAEC,EAAF;IAAMC,SAAN;IAAiBC,QAAjB;IAA2BC,QAA3B;IAAqCC,WAAW,GAAG,YAAnD;IAAiE,GAAGC;MAAeP,KAAzF;EACA,MAAMQ,SAAS,GAAGC,EAAE,CAChB,SADgB,cAEJH,aAFI,EAGhB;IACI,eAAeA,WAAW,KAAK;GAJnB,EAMhBN,KAAK,CAACQ,SANU,CAApB;EASA,OACIT,aAAA,CAACW,IAAD,oBACQH;IACJC,SAAS,EAAEA;iBACD;IACVG,YAAY,EAAER;IACdS,GAAG,EAAC;IACJC,aAAa,EAAER;IACfC,WAAW,EAAEA;IACbL,GAAG,EAAEA;IACLa,KAAK,EAAEZ;IATX,EAWKE,QAXL,CADJ;AAeH,CA1BmB;AA4BpB,MAAMW,OAAO,gBAAGhB,UAAA,CAAiB,SAASiB,GAAT,CAAahB,KAAb,EAAkCC,GAAlC;EAC7B,MAAMO,SAAS,GAAGC,EAAE,CAAC,gEAAD,EAAmET,KAAK,CAACQ,SAAzE,CAApB;EAEA,OAAOT,aAAA,CAACW,IAAD,oBAAwBV;IAAOQ,SAAS,EAAEA;IAAWP,GAAG,EAAEA;IAA1D,CAAP;AACH,CAJe,CAAhB;AAMA,MAAMgB,UAAU,gBAAGlB,UAAA,CAAiB,SAASiB,GAAT,CAAahB,KAAb,EAAqCC,GAArC;EAChC,MAAM;IAAEC,EAAF;IAAMgB,QAAN;IAAgB,GAAGX;MAAeP,KAAxC;EACA,MAAMQ,SAAS,GAAGC,EAAE,CAChB,qFADgB,EAEhBS,QAAQ,GACF,sCADE,GAEF,+NAJU,EAKhBlB,KAAK,CAACQ,SALU,CAApB;EAQA,OACIT,aAAA,CAACW,OAAD,oBACQH;IACJC,SAAS,EAAEA;IACXU,QAAQ,EAAEA;IACVjB,GAAG,EAAEA;IACLkB,KAAK,EAAE;MACHC,UAAU,EAAE;;IAEhBN,KAAK,EAAEZ;IARX,CADJ;AAYH,CAtBkB,CAAnB;AAwBA,MAAMmB,UAAU,gBAAGtB,UAAA,CAAiB,SAASiB,GAAT,CAAahB,KAAb,EAAqCC,GAArC;EAChC,MAAM;IAAEC,EAAF;IAAM,GAAGK;MAAeP,KAA9B;EACA,MAAMQ,SAAS,GAAGC,EAAE,CAAC,4BAAD,EAA+BT,KAAK,CAACQ,SAArC,CAApB;EAEA,OAAOT,aAAA,CAACW,OAAD,oBAA2BH;IAAYC,SAAS,EAAEA;IAAWP,GAAG,EAAEA;IAAKa,KAAK,EAAEZ;IAA9E,CAAP;AACH,CALkB,CAAnB;AAOAJ,IAAI,CAACwB,IAAL,GAAYP,OAAZ;AACAjB,IAAI,CAACyB,OAAL,GAAeN,UAAf;AACAnB,IAAI,CAAC0B,OAAL,GAAeH,UAAf;;;;"}
1
+ {"version":3,"file":"Tabs.js","sources":["../../../../src/components/Tabs/Tabs.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as TabsPrimitive from '@radix-ui/react-tabs';\n\nimport { Orientation } from '../../types';\nimport './Tabs.css';\n\nexport type TabsProps = React.HTMLAttributes<HTMLDivElement> & {\n /**\n * The controlled value of the tab to activate. Should be used in conjunction with `onChange`.\n */\n id?: string;\n /**\n * Set which tab is selected on mount.\n * This has to be one of the existing ids provided for tabs\n */\n defaultId?: string;\n /**\n * Content should be one or an array of `Tabs.Trigger` components inside `Tabs.List` and then\n * followed by one or an array of `Tabs.Content`.\n * *Note* that there can also be tabs that are rendered conditionally.\n */\n children: React.ReactNode;\n /**\n * Define orientation of tabs.\n * @defaultValue horizontal\n */\n orientation?: Orientation;\n /**\n * Callback that is called when tab is changed.\n */\n onChange?: (id: string) => void;\n};\n\nexport type TabListProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport type TabTriggerProps = React.HTMLAttributes<HTMLButtonElement> & {\n /**\n * A unique value that associates the trigger with a content.\n */\n id: string;\n /**\n * When true, prevents the user from interacting with the tab.\n */\n disabled?: boolean;\n};\n\nexport type TabContentProps = React.HTMLAttributes<HTMLDivElement> & {\n /**\n * A unique value that associates the content with a trigger.\n */\n id: string;\n};\n\nexport type ForwardedTabsWithStatics = React.ForwardRefExoticComponent<TabsProps & React.RefAttributes<HTMLDivElement>> & {\n /** Tab list component containing all tab triggers, rendered in a `Tabs` group component */\n List: React.ForwardRefExoticComponent<TabListProps & React.RefAttributes<HTMLDivElement>>;\n /** Tab trigger component rendered in a `Tabs.List` component */\n Trigger: React.ForwardRefExoticComponent<TabTriggerProps & React.RefAttributes<HTMLButtonElement>>;\n /** Tab content component rendered in a `Tabs` group component */\n Content: React.ForwardRefExoticComponent<TabContentProps & React.RefAttributes<HTMLDivElement>>;\n};\n\nexport const Tabs = React.forwardRef(function Tabs(props: TabsProps, ref: React.Ref<HTMLDivElement>) {\n const { id, defaultId, children, onChange, orientation = 'horizontal', ...otherProps } = props;\n const className = cn(\n 'yt-tabs',\n `yt-tabs--${orientation}`,\n {\n 'flex w-full': orientation === 'vertical',\n },\n props.className\n );\n\n return (\n <TabsPrimitive.Root\n {...otherProps}\n className={className}\n data-taco=\"tabs\"\n defaultValue={defaultId}\n dir=\"ltr\"\n onValueChange={onChange}\n orientation={orientation}\n ref={ref}\n value={id}\n >\n {children}\n </TabsPrimitive.Root>\n );\n}) as ForwardedTabsWithStatics;\n\nconst TabList = React.forwardRef(function Tab(props: TabListProps, ref: React.Ref<HTMLDivElement>) {\n const className = cn('yt-tab__list border-b border-grey-light flex flex-row m-0 mb-4', props.className);\n\n return <TabsPrimitive.List {...props} className={className} ref={ref} />;\n});\n\nconst TabTrigger = React.forwardRef(function Tab(props: TabTriggerProps, ref: React.Ref<HTMLButtonElement>) {\n const { id, disabled, ...otherProps } = props;\n const className = cn(\n 'yt-tab bg-transparent border-b-2 border-transparent text-grey-darkest m-0 py-2 px-4',\n disabled\n ? 'cursor-not-allowed !text-grey-darker'\n : 'cursor-pointer rounded-t hover:border-grey-dark aria-selected:border-blue aria-selected:text-black aria-selected:hover:border-blue-light hover:text-black active:yt-focus active:border-blue focus:yt-focus focus:border-blue',\n props.className\n );\n\n return (\n <TabsPrimitive.Trigger\n {...otherProps}\n className={className}\n disabled={disabled}\n ref={ref}\n style={{\n transition: 'border 0.2s ease-in',\n }}\n value={id}\n />\n );\n});\n\nconst TabContent = React.forwardRef(function Tab(props: TabContentProps, ref: React.Ref<HTMLDivElement>) {\n const { id, ...otherProps } = props;\n const className = cn('yt-tab__panel outline-none', props.className);\n\n return <TabsPrimitive.Content {...otherProps} className={className} ref={ref} value={id} />;\n});\n\nTabs.List = TabList;\nTabs.Trigger = TabTrigger;\nTabs.Content = TabContent;\n"],"names":["Tabs","React","props","ref","id","defaultId","children","onChange","orientation","otherProps","className","cn","TabsPrimitive","defaultValue","dir","onValueChange","value","TabList","Tab","TabTrigger","disabled","style","transition","TabContent","List","Trigger","Content"],"mappings":";;;;;;;;IA+DaA,IAAI,gBAAGC,UAAA,CAAiB,SAASD,IAAT,CAAcE,KAAd,EAAgCC,GAAhC;EACjC,IAAQC,EAAR,GAAyFF,KAAzF,CAAQE,EAAR;MAAYC,SAAZ,GAAyFH,KAAzF,CAAYG,SAAZ;MAAuBC,QAAvB,GAAyFJ,KAAzF,CAAuBI,QAAvB;MAAiCC,QAAjC,GAAyFL,KAAzF,CAAiCK,QAAjC;2BAAyFL,KAAzF,CAA2CM,WAA3C;MAA2CA,WAA3C,mCAAyD,YAAzD;MAA0EC,UAA1E,iCAAyFP,KAAzF;;EACA,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C,IAAQC,EAAR,GAA8BF,KAA9B,CAAQE,EAAR;MAAeK,UAAf,iCAA8BP,KAA9B;;EACA,IAAMQ,SAAS,GAAGC,EAAE,CAAC,4BAAD,EAA+BT,KAAK,CAACQ,SAArC,CAApB;EAEA,OAAOT,aAAA,CAACW,OAAD,oBAA2BH;IAAYC,SAAS,EAAEA;IAAWP,GAAG,EAAEA;IAAKa,KAAK,EAAEZ;IAA9E,CAAP;AACH,CALkB,CAAnB;AAOAJ,IAAI,CAACwB,IAAL,GAAYP,OAAZ;AACAjB,IAAI,CAACyB,OAAL,GAAeN,UAAf;AACAnB,IAAI,CAAC0B,OAAL,GAAeH,UAAf;;;;"}
@@ -1,23 +1,21 @@
1
+ import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../_virtual/_rollupPluginBabelHelpers.js';
1
2
  import { forwardRef, createElement } from 'react';
2
3
  import cn from 'classnames';
3
4
  import { getInputClasses } from '../Input/util.js';
4
5
 
5
- const Textarea = /*#__PURE__*/forwardRef(function Textarea(props, ref) {
6
- const {
7
- defaultValue: _,
8
- highlighted,
9
- invalid,
10
- onKeyDown,
11
- ...otherProps
12
- } = props;
13
- const classNames = cn(getInputClasses(props), 'py-1 min-h-[75px] disabled:resize-none', props.className); // home and end keys only navigate to the start/end of textarea value if the textarea container does not scroll
6
+ var _excluded = ["defaultValue", "highlighted", "invalid", "onKeyDown"];
7
+ var Textarea = /*#__PURE__*/forwardRef(function Textarea(props, ref) {
8
+ var onKeyDown = props.onKeyDown,
9
+ otherProps = _objectWithoutPropertiesLoose(props, _excluded);
10
+
11
+ var classNames = cn(getInputClasses(props), 'py-1 min-h-[75px] disabled:resize-none', props.className); // home and end keys only navigate to the start/end of textarea value if the textarea container does not scroll
14
12
  // if it has scroll height then the browser reverts to native scrolling behaviour only
15
13
  // so we manually override it to ensure _our_ desired behaviour remains intact
16
14
 
17
- const handleKeyDown = event => {
15
+ var handleKeyDown = function handleKeyDown(event) {
18
16
  if (event.key === 'Home' || event.key === 'End') {
19
17
  event.preventDefault();
20
- const position = event.key === 'End' ? event.currentTarget.value.length : 0;
18
+ var position = event.key === 'End' ? event.currentTarget.value.length : 0;
21
19
  event.currentTarget.setSelectionRange(position, position);
22
20
  event.currentTarget.scrollTop = event.key === 'End' ? event.currentTarget.scrollHeight : 0;
23
21
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Textarea.js","sources":["../../../../src/components/Textarea/Textarea.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport cn from 'classnames';\r\nimport { getInputClasses } from '../Input/util';\r\n\r\nexport type TextareaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement> & {\r\n /** Draws attention to the textarea by changing its style and making it visually prominent */\r\n highlighted?: boolean;\r\n /* Whether the input is in an invalid state */\r\n invalid?: boolean;\r\n /** Value of the textarea */\r\n value?: string;\r\n};\r\n\r\nexport const Textarea = React.forwardRef(function Textarea(props: TextareaProps, ref: React.Ref<HTMLTextAreaElement>) {\r\n const { defaultValue: _, highlighted, invalid, onKeyDown, ...otherProps } = props;\r\n const classNames = cn(getInputClasses(props), 'py-1 min-h-[75px] disabled:resize-none', props.className);\r\n\r\n // home and end keys only navigate to the start/end of textarea value if the textarea container does not scroll\r\n // if it has scroll height then the browser reverts to native scrolling behaviour only\r\n // so we manually override it to ensure _our_ desired behaviour remains intact\r\n const handleKeyDown = (event: React.KeyboardEvent<HTMLTextAreaElement>) => {\r\n if (event.key === 'Home' || event.key === 'End') {\r\n event.preventDefault();\r\n const position = event.key === 'End' ? event.currentTarget.value.length : 0;\r\n event.currentTarget.setSelectionRange(position, position);\r\n event.currentTarget.scrollTop = event.key === 'End' ? event.currentTarget.scrollHeight : 0;\r\n }\r\n\r\n if (onKeyDown) {\r\n onKeyDown(event);\r\n }\r\n };\r\n\r\n return <textarea {...otherProps} className={classNames} data-taco=\"textarea\" onKeyDown={handleKeyDown} ref={ref} />;\r\n});\r\n"],"names":["Textarea","React","props","ref","defaultValue","_","highlighted","invalid","onKeyDown","otherProps","classNames","cn","getInputClasses","className","handleKeyDown","event","key","preventDefault","position","currentTarget","value","length","setSelectionRange","scrollTop","scrollHeight"],"mappings":";;;;MAaaA,QAAQ,gBAAGC,UAAA,CAAiB,SAASD,QAAT,CAAkBE,KAAlB,EAAwCC,GAAxC;EACrC,MAAM;IAAEC,YAAY,EAAEC,CAAhB;IAAmBC,WAAnB;IAAgCC,OAAhC;IAAyCC,SAAzC;IAAoD,GAAGC;MAAeP,KAA5E;EACA,MAAMQ,UAAU,GAAGC,EAAE,CAACC,eAAe,CAACV,KAAD,CAAhB,EAAyB,wCAAzB,EAAmEA,KAAK,CAACW,SAAzE,CAArB;;;;EAKA,MAAMC,aAAa,GAAIC,KAAD;IAClB,IAAIA,KAAK,CAACC,GAAN,KAAc,MAAd,IAAwBD,KAAK,CAACC,GAAN,KAAc,KAA1C,EAAiD;MAC7CD,KAAK,CAACE,cAAN;MACA,MAAMC,QAAQ,GAAGH,KAAK,CAACC,GAAN,KAAc,KAAd,GAAsBD,KAAK,CAACI,aAAN,CAAoBC,KAApB,CAA0BC,MAAhD,GAAyD,CAA1E;MACAN,KAAK,CAACI,aAAN,CAAoBG,iBAApB,CAAsCJ,QAAtC,EAAgDA,QAAhD;MACAH,KAAK,CAACI,aAAN,CAAoBI,SAApB,GAAgCR,KAAK,CAACC,GAAN,KAAc,KAAd,GAAsBD,KAAK,CAACI,aAAN,CAAoBK,YAA1C,GAAyD,CAAzF;;;IAGJ,IAAIhB,SAAJ,EAAe;MACXA,SAAS,CAACO,KAAD,CAAT;;GATR;;EAaA,OAAOd,aAAA,WAAA,oBAAcQ;IAAYI,SAAS,EAAEH;iBAAsB;IAAWF,SAAS,EAAEM;IAAeX,GAAG,EAAEA;IAArG,CAAP;AACH,CArBuB;;;;"}
1
+ {"version":3,"file":"Textarea.js","sources":["../../../../src/components/Textarea/Textarea.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport { getInputClasses } from '../Input/util';\n\nexport type TextareaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement> & {\n /** Draws attention to the textarea by changing its style and making it visually prominent */\n highlighted?: boolean;\n /* Whether the input is in an invalid state */\n invalid?: boolean;\n /** Value of the textarea */\n value?: string;\n};\n\nexport const Textarea = React.forwardRef(function Textarea(props: TextareaProps, ref: React.Ref<HTMLTextAreaElement>) {\n const { defaultValue: _, highlighted, invalid, onKeyDown, ...otherProps } = props;\n const classNames = cn(getInputClasses(props), 'py-1 min-h-[75px] disabled:resize-none', props.className);\n\n // home and end keys only navigate to the start/end of textarea value if the textarea container does not scroll\n // if it has scroll height then the browser reverts to native scrolling behaviour only\n // so we manually override it to ensure _our_ desired behaviour remains intact\n const handleKeyDown = (event: React.KeyboardEvent<HTMLTextAreaElement>) => {\n if (event.key === 'Home' || event.key === 'End') {\n event.preventDefault();\n const position = event.key === 'End' ? event.currentTarget.value.length : 0;\n event.currentTarget.setSelectionRange(position, position);\n event.currentTarget.scrollTop = event.key === 'End' ? event.currentTarget.scrollHeight : 0;\n }\n\n if (onKeyDown) {\n onKeyDown(event);\n }\n };\n\n return <textarea {...otherProps} className={classNames} data-taco=\"textarea\" onKeyDown={handleKeyDown} ref={ref} />;\n});\n"],"names":["Textarea","React","props","ref","onKeyDown","otherProps","classNames","cn","getInputClasses","className","handleKeyDown","event","key","preventDefault","position","currentTarget","value","length","setSelectionRange","scrollTop","scrollHeight"],"mappings":";;;;;;IAaaA,QAAQ,gBAAGC,UAAA,CAAiB,SAASD,QAAT,CAAkBE,KAAlB,EAAwCC,GAAxC;MACUC,SAA/C,GAA4EF,KAA5E,CAA+CE,SAA/C;MAA6DC,UAA7D,iCAA4EH,KAA5E;;EACA,IAAMI,UAAU,GAAGC,EAAE,CAACC,eAAe,CAACN,KAAD,CAAhB,EAAyB,wCAAzB,EAAmEA,KAAK,CAACO,SAAzE,CAArB;;;;EAKA,IAAMC,aAAa,GAAG,SAAhBA,aAAgB,CAACC,KAAD;IAClB,IAAIA,KAAK,CAACC,GAAN,KAAc,MAAd,IAAwBD,KAAK,CAACC,GAAN,KAAc,KAA1C,EAAiD;MAC7CD,KAAK,CAACE,cAAN;MACA,IAAMC,QAAQ,GAAGH,KAAK,CAACC,GAAN,KAAc,KAAd,GAAsBD,KAAK,CAACI,aAAN,CAAoBC,KAApB,CAA0BC,MAAhD,GAAyD,CAA1E;MACAN,KAAK,CAACI,aAAN,CAAoBG,iBAApB,CAAsCJ,QAAtC,EAAgDA,QAAhD;MACAH,KAAK,CAACI,aAAN,CAAoBI,SAApB,GAAgCR,KAAK,CAACC,GAAN,KAAc,KAAd,GAAsBD,KAAK,CAACI,aAAN,CAAoBK,YAA1C,GAAyD,CAAzF;;;IAGJ,IAAIhB,SAAJ,EAAe;MACXA,SAAS,CAACO,KAAD,CAAT;;GATR;;EAaA,OAAOV,aAAA,WAAA,oBAAcI;IAAYI,SAAS,EAAEH;iBAAsB;IAAWF,SAAS,EAAEM;IAAeP,GAAG,EAAEA;IAArG,CAAP;AACH,CArBuB;;;;"}
@@ -68,7 +68,7 @@ const Toast = ({
68
68
  className: "flex-grow"
69
69
  }, content), React__default.createElement(IconButton, {
70
70
  appearance: "discrete",
71
- className: "text-grey-darkest cursor-pointer -mr-2 !px-0",
71
+ className: "text-grey-darkest -mr-2 cursor-pointer !px-0",
72
72
  icon: "close",
73
73
  "aria-label": texts.toasts.dismiss,
74
74
  onClick: handleClose
@@ -1 +1 @@
1
- {"version":3,"file":"Toast.js","sources":["../../../../src/components/Toast/Toast.tsx"],"sourcesContent":["import React from 'react';\r\nimport cn from 'classnames';\r\nimport { motion, useAnimation } from 'framer-motion';\r\nimport useTimer from '../../utils/hooks/useTimer';\r\nimport { getBadgeIcon } from './util';\r\nimport { State } from '../../types';\r\nimport { useLocalization } from '../Provider/Provider';\r\nimport { IconButton } from '../IconButton/IconButton';\r\n\r\nexport type ToastsTexts = {\r\n /** Aria-label for the close icon button of toast */\r\n dismiss: string;\r\n};\r\n\r\nexport type ToastType = Omit<State, 'default'> | 'loading';\r\nexport type ToastOptions = {\r\n /** Provide time in milliseconds after which the toast should autoclose */\r\n autoClose?: number;\r\n /**\r\n * State will change the icon displayed in toast and other characteristics,\r\n * for e.g. `loading` state will display a progress animation.\r\n * Default value is `default`\r\n */\r\n type?: ToastType;\r\n};\r\nexport type ToastProps = {\r\n /** Provide a unique id for toast */\r\n id: string;\r\n /**\r\n * Content can be any valid react node, for e.g. a `div`, or a simple text.\r\n * Note that content can also be `null`, resulting in a slimmer version of your toast with a vertically centered title\r\n */\r\n content: React.ReactNode;\r\n /** Additional options to define your toast */\r\n options: ToastOptions;\r\n /**\r\n * Handler called when toast closes.\r\n * To read more about how to provide the text, see [Provider](component:provider) component\r\n */\r\n onClose: () => void;\r\n lastUpdated?: number;\r\n lastDuplicateId?: string;\r\n};\r\n\r\nexport const Toast = ({ content, lastUpdated, onClose: handleClose, options, ...props }: ToastProps): JSX.Element => {\r\n const { texts } = useLocalization();\r\n const { autoClose, type = 'default' } = options;\r\n const className = cn('bg-white relative flex items-center py-1 px-2 mt-3 w-full rounded yt-shadow', {\r\n 'border border-grey': type === 'default' || type === 'loading' || !type,\r\n 'border border-grey-darker': type === 'success',\r\n 'border border-blue': type === 'information',\r\n 'border border-yellow-dark': type === 'warning',\r\n 'border border-red': type === 'error',\r\n });\r\n const timer = useTimer(autoClose, handleClose);\r\n const controls = useAnimation();\r\n\r\n React.useEffect(() => {\r\n if (autoClose) {\r\n timer.start();\r\n }\r\n }, [autoClose]);\r\n\r\n const triggerUpdateAnimation = async () => {\r\n await controls.start({ scale: 1.05 });\r\n await controls.start({ scale: 1 });\r\n };\r\n\r\n React.useEffect(() => {\r\n if (lastUpdated) {\r\n triggerUpdateAnimation();\r\n\r\n if (timer.running) {\r\n timer.start();\r\n }\r\n }\r\n }, [lastUpdated]);\r\n\r\n return (\r\n <motion.div\r\n {...props}\r\n animate={controls}\r\n className={className}\r\n data-taco=\"toast\"\r\n onMouseEnter={timer.pause}\r\n onMouseLeave={timer.resume}\r\n >\r\n {getBadgeIcon(type)}\r\n {content && <div className=\"flex-grow\">{content}</div>}\r\n <IconButton\r\n appearance=\"discrete\"\r\n className=\"text-grey-darkest cursor-pointer -mr-2 !px-0\"\r\n icon=\"close\"\r\n aria-label={texts.toasts.dismiss}\r\n onClick={handleClose}\r\n />\r\n </motion.div>\r\n );\r\n};\r\n"],"names":["Toast","content","lastUpdated","onClose","handleClose","options","props","texts","useLocalization","autoClose","type","className","cn","timer","useTimer","controls","useAnimation","React","useEffect","start","triggerUpdateAnimation","scale","running","motion","div","animate","onMouseEnter","pause","onMouseLeave","resume","getBadgeIcon","IconButton","appearance","icon","toasts","dismiss","onClick"],"mappings":";;;;;;;;MA4CaA,KAAK,GAAG,CAAC;EAAEC,OAAF;EAAWC,WAAX;EAAwBC,OAAO,EAAEC,WAAjC;EAA8CC,OAA9C;EAAuD,GAAGC;AAA1D,CAAD;EACjB,MAAM;IAAEC;MAAUC,eAAe,EAAjC;EACA,MAAM;IAAEC,SAAF;IAAaC,IAAI,GAAG;MAAcL,OAAxC;EACA,MAAMM,SAAS,GAAGC,EAAE,CAAC,6EAAD,EAAgF;IAChG,sBAAsBF,IAAI,KAAK,SAAT,IAAsBA,IAAI,KAAK,SAA/B,IAA4C,CAACA,IAD6B;IAEhG,6BAA6BA,IAAI,KAAK,SAF0D;IAGhG,sBAAsBA,IAAI,KAAK,aAHiE;IAIhG,6BAA6BA,IAAI,KAAK,SAJ0D;IAKhG,qBAAqBA,IAAI,KAAK;GALd,CAApB;EAOA,MAAMG,KAAK,GAAGC,QAAQ,CAACL,SAAD,EAAYL,WAAZ,CAAtB;EACA,MAAMW,QAAQ,GAAGC,YAAY,EAA7B;EAEAC,cAAK,CAACC,SAAN,CAAgB;IACZ,IAAIT,SAAJ,EAAe;MACXI,KAAK,CAACM,KAAN;;GAFR,EAIG,CAACV,SAAD,CAJH;;EAMA,MAAMW,sBAAsB;IAAA;6BAClBL,QAAQ,CAACI,KAAT,CAAe;QAAEE,KAAK,EAAE;OAAxB;+BACAN,QAAQ,CAACI,KAAT,CAAe;UAAEE,KAAK,EAAE;SAAxB;;KAFkB;MAAA;;GAA5B;;EAKAJ,cAAK,CAACC,SAAN,CAAgB;IACZ,IAAIhB,WAAJ,EAAiB;MACbkB,sBAAsB;;MAEtB,IAAIP,KAAK,CAACS,OAAV,EAAmB;QACfT,KAAK,CAACM,KAAN;;;GALZ,EAQG,CAACjB,WAAD,CARH;EAUA,OACIe,4BAAA,CAACM,MAAM,CAACC,GAAR,oBACQlB;IACJmB,OAAO,EAAEV;IACTJ,SAAS,EAAEA;iBACD;IACVe,YAAY,EAAEb,KAAK,CAACc;IACpBC,YAAY,EAAEf,KAAK,CAACgB;IANxB,EAQKC,YAAY,CAACpB,IAAD,CARjB,EASKT,OAAO,IAAIgB,4BAAA,MAAA;IAAKN,SAAS,EAAC;GAAf,EAA4BV,OAA5B,CAThB,EAUIgB,4BAAA,CAACc,UAAD;IACIC,UAAU,EAAC;IACXrB,SAAS,EAAC;IACVsB,IAAI,EAAC;kBACO1B,KAAK,CAAC2B,MAAN,CAAaC;IACzBC,OAAO,EAAEhC;GALb,CAVJ,CADJ;AAoBH;;;;"}
1
+ {"version":3,"file":"Toast.js","sources":["../../../../src/components/Toast/Toast.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { motion, useAnimation } from 'framer-motion';\nimport useTimer from '../../utils/hooks/useTimer';\nimport { getBadgeIcon } from './util';\nimport { State } from '../../types';\nimport { useLocalization } from '../Provider/Provider';\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 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 * Note that content can also be `null`, resulting in a slimmer version of your toast with a vertically centered title\n */\n content: React.ReactNode;\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', {\n 'border border-grey': type === 'default' || type === 'loading' || !type,\n 'border border-grey-darker': type === 'success',\n 'border border-blue': type === 'information',\n 'border border-yellow-dark': type === 'warning',\n 'border border-red': type === 'error',\n });\n const timer = useTimer(autoClose, handleClose);\n const controls = useAnimation();\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 >\n {getBadgeIcon(type)}\n {content && <div className=\"flex-grow\">{content}</div>}\n <IconButton\n appearance=\"discrete\"\n className=\"text-grey-darkest -mr-2 cursor-pointer !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","React","useEffect","start","triggerUpdateAnimation","scale","running","motion","div","animate","onMouseEnter","pause","onMouseLeave","resume","getBadgeIcon","IconButton","appearance","icon","toasts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