@economic/taco 1.0.9 → 1.1.2

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 (381) hide show
  1. package/README.md +82 -84
  2. package/dist/components/Card/Card.d.ts +7 -7
  3. package/dist/components/Menu/Context.d.ts +0 -5
  4. package/dist/components/Menu/Menu.d.ts +0 -3
  5. package/dist/components/Table/hooks/useTable.d.ts +3 -0
  6. package/dist/components/Table/types.d.ts +3 -0
  7. package/dist/esm/components/Accordion/Accordion.js.map +1 -1
  8. package/dist/esm/components/Backdrop/Backdrop.js.map +1 -1
  9. package/dist/esm/components/Badge/Badge.js.map +1 -1
  10. package/dist/esm/components/Banner/Banner.js.map +1 -1
  11. package/dist/esm/components/Banner/util.js +1 -1
  12. package/dist/esm/components/Banner/util.js.map +1 -1
  13. package/dist/esm/components/Button/Button.js.map +1 -1
  14. package/dist/esm/components/Button/util.js +24 -19
  15. package/dist/esm/components/Button/util.js.map +1 -1
  16. package/dist/esm/components/Calendar/Calendar.js.map +1 -1
  17. package/dist/esm/components/Card/Card.js +19 -4
  18. package/dist/esm/components/Card/Card.js.map +1 -1
  19. package/dist/esm/components/Checkbox/Checkbox.js.map +1 -1
  20. package/dist/esm/components/Combobox/Combobox.js.map +1 -1
  21. package/dist/esm/components/Combobox/useCombobox.js +87 -67
  22. package/dist/esm/components/Combobox/useCombobox.js.map +1 -1
  23. package/dist/esm/components/Datepicker/Datepicker.js.map +1 -1
  24. package/dist/esm/components/Datepicker/useDatepicker.js +34 -27
  25. package/dist/esm/components/Datepicker/useDatepicker.js.map +1 -1
  26. package/dist/esm/components/Dialog/Context.js +4 -4
  27. package/dist/esm/components/Dialog/Context.js.map +1 -1
  28. package/dist/esm/components/Dialog/Dialog.js.map +1 -1
  29. package/dist/esm/components/Dialog/components/Content.js +44 -39
  30. package/dist/esm/components/Dialog/components/Content.js.map +1 -1
  31. package/dist/esm/components/Dialog/components/Drawer.js +3 -3
  32. package/dist/esm/components/Dialog/components/Drawer.js.map +1 -1
  33. package/dist/esm/components/Dialog/components/Extra.js +2 -2
  34. package/dist/esm/components/Dialog/components/Extra.js.map +1 -1
  35. package/dist/esm/components/Dialog/components/Trigger.js +2 -2
  36. package/dist/esm/components/Dialog/components/Trigger.js.map +1 -1
  37. package/dist/esm/components/Field/Field.js.map +1 -1
  38. package/dist/esm/components/Form/Form.js.map +1 -1
  39. package/dist/esm/components/Group/Group.js.map +1 -1
  40. package/dist/esm/components/Hanger/Hanger.js.map +1 -1
  41. package/dist/esm/components/HoverCard/HoverCard.js.map +1 -1
  42. package/dist/esm/components/Icon/Icon.js.map +1 -1
  43. package/dist/esm/components/Icon/components/AccountPreview.js.map +1 -1
  44. package/dist/esm/components/Icon/components/Accounting.js.map +1 -1
  45. package/dist/esm/components/Icon/components/AccountingYear.js.map +1 -1
  46. package/dist/esm/components/Icon/components/AccountingYearCancel.js.map +1 -1
  47. package/dist/esm/components/Icon/components/ArrowBottom.js.map +1 -1
  48. package/dist/esm/components/Icon/components/ArrowDown.js.map +1 -1
  49. package/dist/esm/components/Icon/components/ArrowEnd.js.map +1 -1
  50. package/dist/esm/components/Icon/components/ArrowLeft.js.map +1 -1
  51. package/dist/esm/components/Icon/components/ArrowRight.js.map +1 -1
  52. package/dist/esm/components/Icon/components/ArrowStart.js.map +1 -1
  53. package/dist/esm/components/Icon/components/ArrowTop.js.map +1 -1
  54. package/dist/esm/components/Icon/components/ArrowUp.js.map +1 -1
  55. package/dist/esm/components/Icon/components/Attach.js.map +1 -1
  56. package/dist/esm/components/Icon/components/AttachAuto.js.map +1 -1
  57. package/dist/esm/components/Icon/components/AttachCancel.js.map +1 -1
  58. package/dist/esm/components/Icon/components/Autotext.js.map +1 -1
  59. package/dist/esm/components/Icon/components/AutotextInsert.js.map +1 -1
  60. package/dist/esm/components/Icon/components/Basic.js.map +1 -1
  61. package/dist/esm/components/Icon/components/BasicTabs.js.map +1 -1
  62. package/dist/esm/components/Icon/components/BellSolid.js.map +1 -1
  63. package/dist/esm/components/Icon/components/Book.js.map +1 -1
  64. package/dist/esm/components/Icon/components/Booking.js.map +1 -1
  65. package/dist/esm/components/Icon/components/Budget.js.map +1 -1
  66. package/dist/esm/components/Icon/components/Calendar.js.map +1 -1
  67. package/dist/esm/components/Icon/components/CashAccount.js.map +1 -1
  68. package/dist/esm/components/Icon/components/CashReports.js.map +1 -1
  69. package/dist/esm/components/Icon/components/Chat.js.map +1 -1
  70. package/dist/esm/components/Icon/components/ChatSolid.js.map +1 -1
  71. package/dist/esm/components/Icon/components/ChevronDown.js.map +1 -1
  72. package/dist/esm/components/Icon/components/ChevronDownDouble.js.map +1 -1
  73. package/dist/esm/components/Icon/components/ChevronDownSolid.js.map +1 -1
  74. package/dist/esm/components/Icon/components/ChevronLeft.js.map +1 -1
  75. package/dist/esm/components/Icon/components/ChevronLeftDouble.js.map +1 -1
  76. package/dist/esm/components/Icon/components/ChevronRight.js.map +1 -1
  77. package/dist/esm/components/Icon/components/ChevronRightDouble.js.map +1 -1
  78. package/dist/esm/components/Icon/components/ChevronUp.js.map +1 -1
  79. package/dist/esm/components/Icon/components/ChevronUpDouble.js.map +1 -1
  80. package/dist/esm/components/Icon/components/ChevronUpSolid.js.map +1 -1
  81. package/dist/esm/components/Icon/components/CircleClose.js +6 -6
  82. package/dist/esm/components/Icon/components/CircleClose.js.map +1 -1
  83. package/dist/esm/components/Icon/components/CircleMinus.js.map +1 -1
  84. package/dist/esm/components/Icon/components/CirclePlus.js.map +1 -1
  85. package/dist/esm/components/Icon/components/CircleTick.js.map +1 -1
  86. package/dist/esm/components/Icon/components/Clamp.js.map +1 -1
  87. package/dist/esm/components/Icon/components/ClampOpen.js.map +1 -1
  88. package/dist/esm/components/Icon/components/Close.js.map +1 -1
  89. package/dist/esm/components/Icon/components/ConnectionEnable.js.map +1 -1
  90. package/dist/esm/components/Icon/components/ConnectionRevoke.js.map +1 -1
  91. package/dist/esm/components/Icon/components/Contacts.js.map +1 -1
  92. package/dist/esm/components/Icon/components/Copy.js.map +1 -1
  93. package/dist/esm/components/Icon/components/Courses.js.map +1 -1
  94. package/dist/esm/components/Icon/components/Credit.js.map +1 -1
  95. package/dist/esm/components/Icon/components/Delete.js.map +1 -1
  96. package/dist/esm/components/Icon/components/DeletePermanently.js.map +1 -1
  97. package/dist/esm/components/Icon/components/Depecriate.js.map +1 -1
  98. package/dist/esm/components/Icon/components/Developer.js.map +1 -1
  99. package/dist/esm/components/Icon/components/DistributionTemplate.js.map +1 -1
  100. package/dist/esm/components/Icon/components/Document.js.map +1 -1
  101. package/dist/esm/components/Icon/components/DocumentApprove.js.map +1 -1
  102. package/dist/esm/components/Icon/components/DocumentCreateEntry.js.map +1 -1
  103. package/dist/esm/components/Icon/components/DocumentCut.js.map +1 -1
  104. package/dist/esm/components/Icon/components/DocumentError.js.map +1 -1
  105. package/dist/esm/components/Icon/components/DocumentIsolatePage.js.map +1 -1
  106. package/dist/esm/components/Icon/components/DocumentMerge.js.map +1 -1
  107. package/dist/esm/components/Icon/components/DocumentMove.js.map +1 -1
  108. package/dist/esm/components/Icon/components/DocumentPreview.js.map +1 -1
  109. package/dist/esm/components/Icon/components/DocumentReceived.js.map +1 -1
  110. package/dist/esm/components/Icon/components/DocumentRejectedRequest.js.map +1 -1
  111. package/dist/esm/components/Icon/components/DocumentSplit.js.map +1 -1
  112. package/dist/esm/components/Icon/components/DocumentTime.js.map +1 -1
  113. package/dist/esm/components/Icon/components/Download.js.map +1 -1
  114. package/dist/esm/components/Icon/components/Drag.js.map +1 -1
  115. package/dist/esm/components/Icon/components/ECopedia.js.map +1 -1
  116. package/dist/esm/components/Icon/components/ESignature.js.map +1 -1
  117. package/dist/esm/components/Icon/components/Edit.js.map +1 -1
  118. package/dist/esm/components/Icon/components/EllipsisHorizontal.js.map +1 -1
  119. package/dist/esm/components/Icon/components/EllipsisVertical.js.map +1 -1
  120. package/dist/esm/components/Icon/components/EntriesOnAccount.js.map +1 -1
  121. package/dist/esm/components/Icon/components/EntriesOpen.js.map +1 -1
  122. package/dist/esm/components/Icon/components/EntriesWarning.js.map +1 -1
  123. package/dist/esm/components/Icon/components/EntryTypeCustomerInvoice.js.map +1 -1
  124. package/dist/esm/components/Icon/components/EntryTypeCustomerPayment.js.map +1 -1
  125. package/dist/esm/components/Icon/components/EntryTypeJournalEntry.js.map +1 -1
  126. package/dist/esm/components/Icon/components/EntryTypeManualCustomerInvoice.js.map +1 -1
  127. package/dist/esm/components/Icon/components/EntryTypeSupplierInvoice.js.map +1 -1
  128. package/dist/esm/components/Icon/components/EntryTypeSupplierPayment.js.map +1 -1
  129. package/dist/esm/components/Icon/components/Envelope.js.map +1 -1
  130. package/dist/esm/components/Icon/components/EnvelopeApproved.js.map +1 -1
  131. package/dist/esm/components/Icon/components/ExpandView.js.map +1 -1
  132. package/dist/esm/components/Icon/components/Expenses.js.map +1 -1
  133. package/dist/esm/components/Icon/components/Export.js.map +1 -1
  134. package/dist/esm/components/Icon/components/ExportToExcel.js.map +1 -1
  135. package/dist/esm/components/Icon/components/ExportToPdf.js.map +1 -1
  136. package/dist/esm/components/Icon/components/Filter.js.map +1 -1
  137. package/dist/esm/components/Icon/components/FilterSolid.js.map +1 -1
  138. package/dist/esm/components/Icon/components/GraphSolid.js.map +1 -1
  139. package/dist/esm/components/Icon/components/Hash.js.map +1 -1
  140. package/dist/esm/components/Icon/components/Home.js.map +1 -1
  141. package/dist/esm/components/Icon/components/Images.js.map +1 -1
  142. package/dist/esm/components/Icon/components/Import.js.map +1 -1
  143. package/dist/esm/components/Icon/components/Inbox.js.map +1 -1
  144. package/dist/esm/components/Icon/components/InboxEinvoicing.js.map +1 -1
  145. package/dist/esm/components/Icon/components/InboxScanning.js.map +1 -1
  146. package/dist/esm/components/Icon/components/InboxSmart.js.map +1 -1
  147. package/dist/esm/components/Icon/components/Info.js.map +1 -1
  148. package/dist/esm/components/Icon/components/Inventory.js.map +1 -1
  149. package/dist/esm/components/Icon/components/InventoryMatrix.js.map +1 -1
  150. package/dist/esm/components/Icon/components/JournalPro.js.map +1 -1
  151. package/dist/esm/components/Icon/components/Layout.js.map +1 -1
  152. package/dist/esm/components/Icon/components/LayoutBoth.js.map +1 -1
  153. package/dist/esm/components/Icon/components/LayoutFirst.js.map +1 -1
  154. package/dist/esm/components/Icon/components/LayoutLast.js.map +1 -1
  155. package/dist/esm/components/Icon/components/LayoutNone.js.map +1 -1
  156. package/dist/esm/components/Icon/components/LedgerCard.js.map +1 -1
  157. package/dist/esm/components/Icon/components/LedgerCardCustomerReminder.js.map +1 -1
  158. package/dist/esm/components/Icon/components/LedgerCardManualCustomerInvoice.js.map +1 -1
  159. package/dist/esm/components/Icon/components/LedgerCardObsoleteStock.js.map +1 -1
  160. package/dist/esm/components/Icon/components/LedgerCardOpeningEntry.js.map +1 -1
  161. package/dist/esm/components/Icon/components/LedgerCardReservedEntry.js.map +1 -1
  162. package/dist/esm/components/Icon/components/LedgerCardShrinkagePilferage.js.map +1 -1
  163. package/dist/esm/components/Icon/components/LedgerCardStockAdjustment.js.map +1 -1
  164. package/dist/esm/components/Icon/components/LedgerCardTransferredOpeningEntry.js.map +1 -1
  165. package/dist/esm/components/Icon/components/Lightbulb.js.map +1 -1
  166. package/dist/esm/components/Icon/components/Line.js.map +1 -1
  167. package/dist/esm/components/Icon/components/List.js.map +1 -1
  168. package/dist/esm/components/Icon/components/ListBulleted.js.map +1 -1
  169. package/dist/esm/components/Icon/components/ListSearch.js.map +1 -1
  170. package/dist/esm/components/Icon/components/LockOpen.js.map +1 -1
  171. package/dist/esm/components/Icon/components/Log.js.map +1 -1
  172. package/dist/esm/components/Icon/components/Market.js.map +1 -1
  173. package/dist/esm/components/Icon/components/MatchAmount.js.map +1 -1
  174. package/dist/esm/components/Icon/components/MatchEntries.js.map +1 -1
  175. package/dist/esm/components/Icon/components/Mileage.js.map +1 -1
  176. package/dist/esm/components/Icon/components/ModalResize.js.map +1 -1
  177. package/dist/esm/components/Icon/components/ModalShrink.js.map +1 -1
  178. package/dist/esm/components/Icon/components/More.js.map +1 -1
  179. package/dist/esm/components/Icon/components/MoreSolid.js.map +1 -1
  180. package/dist/esm/components/Icon/components/Move.js.map +1 -1
  181. package/dist/esm/components/Icon/components/NavigationList.js.map +1 -1
  182. package/dist/esm/components/Icon/components/Note.js.map +1 -1
  183. package/dist/esm/components/Icon/components/NoteFollowUp.js.map +1 -1
  184. package/dist/esm/components/Icon/components/NoteRead.js.map +1 -1
  185. package/dist/esm/components/Icon/components/PartnerApi.js.map +1 -1
  186. package/dist/esm/components/Icon/components/Period.js.map +1 -1
  187. package/dist/esm/components/Icon/components/PersonChange.js.map +1 -1
  188. package/dist/esm/components/Icon/components/PersonMinus.js.map +1 -1
  189. package/dist/esm/components/Icon/components/PersonPlus.js.map +1 -1
  190. package/dist/esm/components/Icon/components/PersonTick.js.map +1 -1
  191. package/dist/esm/components/Icon/components/Play.js.map +1 -1
  192. package/dist/esm/components/Icon/components/PlusMinus.js.map +1 -1
  193. package/dist/esm/components/Icon/components/Print.js.map +1 -1
  194. package/dist/esm/components/Icon/components/ProcessPayment.js.map +1 -1
  195. package/dist/esm/components/Icon/components/ProductLedgerCard.js.map +1 -1
  196. package/dist/esm/components/Icon/components/ProjectCards.js.map +1 -1
  197. package/dist/esm/components/Icon/components/Projects.js.map +1 -1
  198. package/dist/esm/components/Icon/components/Quicklinks.js.map +1 -1
  199. package/dist/esm/components/Icon/components/RatingBankruptcy.js.map +1 -1
  200. package/dist/esm/components/Icon/components/RatingPaymentProblems.js.map +1 -1
  201. package/dist/esm/components/Icon/components/Reconciled.js.map +1 -1
  202. package/dist/esm/components/Icon/components/Refresh.js.map +1 -1
  203. package/dist/esm/components/Icon/components/Report.js.map +1 -1
  204. package/dist/esm/components/Icon/components/ReportSolid.js.map +1 -1
  205. package/dist/esm/components/Icon/components/Restore.js.map +1 -1
  206. package/dist/esm/components/Icon/components/RotateLeft.js.map +1 -1
  207. package/dist/esm/components/Icon/components/RotateRight.js.map +1 -1
  208. package/dist/esm/components/Icon/components/Sales.js.map +1 -1
  209. package/dist/esm/components/Icon/components/Search.js.map +1 -1
  210. package/dist/esm/components/Icon/components/SearchBold.js.map +1 -1
  211. package/dist/esm/components/Icon/components/Secure.js.map +1 -1
  212. package/dist/esm/components/Icon/components/SecureTick.js.map +1 -1
  213. package/dist/esm/components/Icon/components/Settings.js.map +1 -1
  214. package/dist/esm/components/Icon/components/SettingsSolid.js.map +1 -1
  215. package/dist/esm/components/Icon/components/Shortcuts.js.map +1 -1
  216. package/dist/esm/components/Icon/components/ShowAll.js.map +1 -1
  217. package/dist/esm/components/Icon/components/ShowLess.js.map +1 -1
  218. package/dist/esm/components/Icon/components/ShowMore.js.map +1 -1
  219. package/dist/esm/components/Icon/components/ShowTemplate.js.map +1 -1
  220. package/dist/esm/components/Icon/components/Sliders.js.map +1 -1
  221. package/dist/esm/components/Icon/components/Smartpay.js.map +1 -1
  222. package/dist/esm/components/Icon/components/SortBy.js.map +1 -1
  223. package/dist/esm/components/Icon/components/Spinner.js.map +1 -1
  224. package/dist/esm/components/Icon/components/Star.js.map +1 -1
  225. package/dist/esm/components/Icon/components/StarSolid.js.map +1 -1
  226. package/dist/esm/components/Icon/components/Subscriptions.js.map +1 -1
  227. package/dist/esm/components/Icon/components/SystemEntries.js.map +1 -1
  228. package/dist/esm/components/Icon/components/Tag.js.map +1 -1
  229. package/dist/esm/components/Icon/components/TemplateOverride.js.map +1 -1
  230. package/dist/esm/components/Icon/components/Templates.js.map +1 -1
  231. package/dist/esm/components/Icon/components/ThumbBoth.js.map +1 -1
  232. package/dist/esm/components/Icon/components/ThumbDown.js.map +1 -1
  233. package/dist/esm/components/Icon/components/ThumbDownSolid.js.map +1 -1
  234. package/dist/esm/components/Icon/components/ThumbUp.js.map +1 -1
  235. package/dist/esm/components/Icon/components/ThumbUpSolid.js.map +1 -1
  236. package/dist/esm/components/Icon/components/Tick.js.map +1 -1
  237. package/dist/esm/components/Icon/components/Time.js.map +1 -1
  238. package/dist/esm/components/Icon/components/Transfer.js.map +1 -1
  239. package/dist/esm/components/Icon/components/TransferCancel.js.map +1 -1
  240. package/dist/esm/components/Icon/components/TransferLocked.js.map +1 -1
  241. package/dist/esm/components/Icon/components/Undock.js.map +1 -1
  242. package/dist/esm/components/Icon/components/Unreconciled.js.map +1 -1
  243. package/dist/esm/components/Icon/components/Warning.js.map +1 -1
  244. package/dist/esm/components/Icon/components/Webshop.js.map +1 -1
  245. package/dist/esm/components/Icon/components/Website.js.map +1 -1
  246. package/dist/esm/components/Icon/components/Workflow.js.map +1 -1
  247. package/dist/esm/components/Icon/components/Zoom.js.map +1 -1
  248. package/dist/esm/components/Icon/components/index.js +4 -4
  249. package/dist/esm/components/Icon/components/index.js.map +1 -1
  250. package/dist/esm/components/IconButton/IconButton.js.map +1 -1
  251. package/dist/esm/components/Input/Input.js.map +1 -1
  252. package/dist/esm/components/Input/util.js +2 -2
  253. package/dist/esm/components/Input/util.js.map +1 -1
  254. package/dist/esm/components/Listbox/Listbox.js.map +1 -1
  255. package/dist/esm/components/Listbox/ScrollableList.js +83 -64
  256. package/dist/esm/components/Listbox/ScrollableList.js.map +1 -1
  257. package/dist/esm/components/Listbox/useListbox.js +60 -51
  258. package/dist/esm/components/Listbox/useListbox.js.map +1 -1
  259. package/dist/esm/components/Listbox/useMultiListbox.js +91 -64
  260. package/dist/esm/components/Listbox/useMultiListbox.js.map +1 -1
  261. package/dist/esm/components/Listbox/useTypeahead.js +9 -10
  262. package/dist/esm/components/Listbox/useTypeahead.js.map +1 -1
  263. package/dist/esm/components/Listbox/util.js +85 -48
  264. package/dist/esm/components/Listbox/util.js.map +1 -1
  265. package/dist/esm/components/Menu/Context.js +2 -2
  266. package/dist/esm/components/Menu/Context.js.map +1 -1
  267. package/dist/esm/components/Menu/Menu.js +9 -18
  268. package/dist/esm/components/Menu/Menu.js.map +1 -1
  269. package/dist/esm/components/Menu/components/Checkbox.js +9 -8
  270. package/dist/esm/components/Menu/components/Checkbox.js.map +1 -1
  271. package/dist/esm/components/Menu/components/Content.js +9 -27
  272. package/dist/esm/components/Menu/components/Content.js.map +1 -1
  273. package/dist/esm/components/Menu/components/Header.js +3 -23
  274. package/dist/esm/components/Menu/components/Header.js.map +1 -1
  275. package/dist/esm/components/Menu/components/Item.js +32 -79
  276. package/dist/esm/components/Menu/components/Item.js.map +1 -1
  277. package/dist/esm/components/Menu/components/Link.js +11 -10
  278. package/dist/esm/components/Menu/components/Link.js.map +1 -1
  279. package/dist/esm/components/Menu/components/RadioGroup.js +18 -16
  280. package/dist/esm/components/Menu/components/RadioGroup.js.map +1 -1
  281. package/dist/esm/components/Menu/components/Separator.js +2 -26
  282. package/dist/esm/components/Menu/components/Separator.js.map +1 -1
  283. package/dist/esm/components/Menu/components/Trigger.js +5 -17
  284. package/dist/esm/components/Menu/components/Trigger.js.map +1 -1
  285. package/dist/esm/components/Navigation/Navigation.js.map +1 -1
  286. package/dist/esm/components/Pagination/PageNumbers.js +28 -23
  287. package/dist/esm/components/Pagination/PageNumbers.js.map +1 -1
  288. package/dist/esm/components/Pagination/Pagination.js.map +1 -1
  289. package/dist/esm/components/Pagination/usePagination.js +21 -7
  290. package/dist/esm/components/Pagination/usePagination.js.map +1 -1
  291. package/dist/esm/components/Pagination/usePaginationShortcuts.js +9 -9
  292. package/dist/esm/components/Pagination/usePaginationShortcuts.js.map +1 -1
  293. package/dist/esm/components/Popover/Popover.js.map +1 -1
  294. package/dist/esm/components/Popover/Primitives.js +8 -7
  295. package/dist/esm/components/Popover/Primitives.js.map +1 -1
  296. package/dist/esm/components/Progress/Progress.js.map +1 -1
  297. package/dist/esm/components/Provider/Provider.js.map +1 -1
  298. package/dist/esm/components/RadioGroup/RadioGroup.js.map +1 -1
  299. package/dist/esm/components/SearchInput/SearchInput.js +1 -1
  300. package/dist/esm/components/SearchInput/SearchInput.js.map +1 -1
  301. package/dist/esm/components/Select/Select.js.map +1 -1
  302. package/dist/esm/components/Select/useSelect.js +81 -63
  303. package/dist/esm/components/Select/useSelect.js.map +1 -1
  304. package/dist/esm/components/Spinner/Spinner.js.map +1 -1
  305. package/dist/esm/components/Switch/Switch.js.map +1 -1
  306. package/dist/esm/components/Table/components/BaseTable.js +30 -23
  307. package/dist/esm/components/Table/components/BaseTable.js.map +1 -1
  308. package/dist/esm/components/Table/components/PaginatedTable.js +7 -3
  309. package/dist/esm/components/Table/components/PaginatedTable.js.map +1 -1
  310. package/dist/esm/components/Table/components/Table.js +25 -18
  311. package/dist/esm/components/Table/components/Table.js.map +1 -1
  312. package/dist/esm/components/Table/components/WindowedTable.js +117 -95
  313. package/dist/esm/components/Table/components/WindowedTable.js.map +1 -1
  314. package/dist/esm/components/Table/hooks/plugins/useRowActions.js +146 -122
  315. package/dist/esm/components/Table/hooks/plugins/useRowActions.js.map +1 -1
  316. package/dist/esm/components/Table/hooks/plugins/useRowDraggable.js +61 -57
  317. package/dist/esm/components/Table/hooks/plugins/useRowDraggable.js.map +1 -1
  318. package/dist/esm/components/Table/hooks/plugins/useRowEditing.js +36 -39
  319. package/dist/esm/components/Table/hooks/plugins/useRowEditing.js.map +1 -1
  320. package/dist/esm/components/Table/hooks/plugins/useRowSelect.js +89 -79
  321. package/dist/esm/components/Table/hooks/plugins/useRowSelect.js.map +1 -1
  322. package/dist/esm/components/Table/hooks/useRowCreation.js +64 -29
  323. package/dist/esm/components/Table/hooks/useRowCreation.js.map +1 -1
  324. package/dist/esm/components/Table/hooks/useTable.js +141 -119
  325. package/dist/esm/components/Table/hooks/useTable.js.map +1 -1
  326. package/dist/esm/components/Table/hooks/useTableKeyboardNavigation.js +20 -12
  327. package/dist/esm/components/Table/hooks/useTableKeyboardNavigation.js.map +1 -1
  328. package/dist/esm/components/Table/util/renderColumn.js +10 -10
  329. package/dist/esm/components/Table/util/renderColumn.js.map +1 -1
  330. package/dist/esm/components/Table/util/renderRow.js +46 -37
  331. package/dist/esm/components/Table/util/renderRow.js.map +1 -1
  332. package/dist/esm/components/Table/util/rowIndexPath.js +16 -14
  333. package/dist/esm/components/Table/util/rowIndexPath.js.map +1 -1
  334. package/dist/esm/components/Table/util/sortTypes.js +31 -23
  335. package/dist/esm/components/Table/util/sortTypes.js.map +1 -1
  336. package/dist/esm/components/Table/util.js +41 -29
  337. package/dist/esm/components/Table/util.js.map +1 -1
  338. package/dist/esm/components/Tabs/Tabs.js +1 -1
  339. package/dist/esm/components/Tabs/Tabs.js.map +1 -1
  340. package/dist/esm/components/Textarea/Textarea.js.map +1 -1
  341. package/dist/esm/components/Toast/Toast.js +21 -20
  342. package/dist/esm/components/Toast/Toast.js.map +1 -1
  343. package/dist/esm/components/Toast/Toaster.js.map +1 -1
  344. package/dist/esm/components/Toast/util.js +2 -2
  345. package/dist/esm/components/Toast/util.js.map +1 -1
  346. package/dist/esm/components/Tooltip/Tooltip.js.map +1 -1
  347. package/dist/esm/components/Tour/Tour.js.map +1 -1
  348. package/dist/esm/components/Treeview/Treeview.js.map +1 -1
  349. package/dist/esm/components/VisuallyHidden/VisuallyHidden.js.map +1 -1
  350. package/dist/esm/index.css +661 -661
  351. package/dist/esm/index.js +1 -1
  352. package/dist/esm/primitives/Button.js +13 -9
  353. package/dist/esm/primitives/Button.js.map +1 -1
  354. package/dist/esm/utils/date.js.map +1 -1
  355. package/dist/esm/utils/hooks/useBoundingClientRectListener.js.map +1 -1
  356. package/dist/esm/utils/hooks/useDraggable.js +18 -16
  357. package/dist/esm/utils/hooks/useDraggable.js.map +1 -1
  358. package/dist/esm/utils/hooks/useDropTarget.js +10 -7
  359. package/dist/esm/utils/hooks/useDropTarget.js.map +1 -1
  360. package/dist/esm/utils/hooks/useListKeyboardNavigation.js.map +1 -1
  361. package/dist/esm/utils/hooks/useListScrollTo.js.map +1 -1
  362. package/dist/esm/utils/hooks/useOnClickOutside.js.map +1 -1
  363. package/dist/esm/utils/hooks/useProxiedRef.js +3 -3
  364. package/dist/esm/utils/hooks/useProxiedRef.js.map +1 -1
  365. package/dist/esm/utils/hooks/useTimer.js +17 -9
  366. package/dist/esm/utils/hooks/useTimer.js.map +1 -1
  367. package/dist/esm/utils/input.js +11 -7
  368. package/dist/esm/utils/input.js.map +1 -1
  369. package/dist/esm/utils/mergeRefs.js +2 -2
  370. package/dist/esm/utils/mergeRefs.js.map +1 -1
  371. package/dist/esm/utils/taillwind.js +2 -2
  372. package/dist/esm/utils/taillwind.js.map +1 -1
  373. package/dist/index.css +661 -661
  374. package/dist/taco.cjs.development.js +1852 -1631
  375. package/dist/taco.cjs.development.js.map +1 -1
  376. package/dist/taco.cjs.production.min.js +1 -1
  377. package/dist/taco.cjs.production.min.js.map +1 -1
  378. package/package.json +19 -8
  379. package/plugins/tailwindcss-aria-attributes.js +73 -73
  380. package/tailwind.config.js +297 -297
  381. package/types.json +427 -354
@@ -1 +1 @@
1
- {"version":3,"file":"Primitives.js","sources":["../../../../src/components/Popover/Primitives.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport cn from 'classnames';\r\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\r\nimport { Placement } from '../../types';\r\n\r\nexport const UnstyledArrow = React.forwardRef(function PopoverArrow(\r\n props: React.SVGAttributes<SVGElement>,\r\n ref: React.Ref<SVGSVGElement>\r\n) {\r\n return (\r\n <PopoverPrimitive.Arrow className=\"pointer-events-none -mt-px\" asChild offset={2} width={30} height={11}>\r\n <svg {...props} ref={ref} viewBox=\"0 19 30 11\" style={{ transform: 'rotateZ(180deg)' }}>\r\n <path\r\n className=\"text-grey-dark group-focus:text-blue-light fill-current\"\r\n d=\"M23.7,27.1L17,19.9C16.5,19.3,15.8,19,15,19s-1.6,0.3-2.1,0.9l-6.6,7.2C5.3,28.1,3.4,29,2,29h26 C26.7,29,24.6,28.1,23.7,27.1z\"\r\n ></path>\r\n <path\r\n className=\"fill-current\"\r\n d=\"M23,27.8c1.1,1.2,3.4,2.2,5,2.2h2H0h2c1.7,0,3.9-1,5-2.2l6.6-7.2c0.7-0.8,2-0.8,2.7,0L23,27.8L23,27.8z\"\r\n ></path>\r\n </svg>\r\n </PopoverPrimitive.Arrow>\r\n );\r\n});\r\n\r\nexport type UnstyledContentProps = Omit<PopoverPrimitive.PopoverContentProps, 'side'> & {\r\n /** Set the position of the Popover relative to its trigger. Default value is `bottom` */\r\n placement?: Placement;\r\n};\r\nexport const UnstyledContent = React.forwardRef(function PopoverContent(\r\n props: UnstyledContentProps,\r\n ref: React.Ref<HTMLDivElement>\r\n) {\r\n const { placement: side, ...otherProps } = props;\r\n\r\n const className = cn(\r\n 'border border-transparent rounded p-3 yt-shadow focus:yt-focus outline-none group z-[996]',\r\n props.className\r\n );\r\n\r\n return <PopoverPrimitive.Content {...otherProps} className={className} side={side} sideOffset={1} ref={ref} />;\r\n});\r\n"],"names":["UnstyledArrow","React","PopoverArrow","props","ref","PopoverPrimitive","className","asChild","offset","width","height","viewBox","style","transform","d","UnstyledContent","PopoverContent","placement","side","otherProps","cn","sideOffset"],"mappings":";;;;MAKaA,aAAa,gBAAGC,UAAA,CAAiB,SAASC,YAAT,CAC1CC,KAD0C,EAE1CC,GAF0C;AAI1C,SACIH,aAAA,CAACI,KAAD;AAAwBC,IAAAA,SAAS,EAAC;AAA6BC,IAAAA,OAAO;AAACC,IAAAA,MAAM,EAAE;AAAGC,IAAAA,KAAK,EAAE;AAAIC,IAAAA,MAAM,EAAE;GAArG,EACIT,aAAA,MAAA,oBAASE;AAAOC,IAAAA,GAAG,EAAEA;AAAKO,IAAAA,OAAO,EAAC;AAAaC,IAAAA,KAAK,EAAE;AAAEC,MAAAA,SAAS,EAAE;AAAb;IAAtD,EACIZ,aAAA,OAAA;AACIK,IAAAA,SAAS,EAAC;AACVQ,IAAAA,CAAC,EAAC;GAFN,CADJ,EAKIb,aAAA,OAAA;AACIK,IAAAA,SAAS,EAAC;AACVQ,IAAAA,CAAC,EAAC;GAFN,CALJ,CADJ,CADJ;AAcH,CAlB4B;MAwBhBC,eAAe,gBAAGd,UAAA,CAAiB,SAASe,cAAT,CAC5Cb,KAD4C,EAE5CC,GAF4C;AAI5C,QAAM;AAAEa,IAAAA,SAAS,EAAEC,IAAb;AAAmB,OAAGC;AAAtB,MAAqChB,KAA3C;AAEA,QAAMG,SAAS,GAAGc,EAAE,CAChB,2FADgB,EAEhBjB,KAAK,CAACG,SAFU,CAApB;AAKA,SAAOL,aAAA,CAACI,OAAD,oBAA8Bc;AAAYb,IAAAA,SAAS,EAAEA;AAAWY,IAAAA,IAAI,EAAEA;AAAMG,IAAAA,UAAU,EAAE;AAAGjB,IAAAA,GAAG,EAAEA;IAAhG,CAAP;AACH,CAZ8B;;;;"}
1
+ {"version":3,"file":"Primitives.js","sources":["../../../../src/components/Popover/Primitives.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport { Placement } from '../../types';\n\nexport const UnstyledArrow = React.forwardRef(function PopoverArrow(\n props: React.SVGAttributes<SVGElement>,\n ref: React.Ref<SVGSVGElement>\n) {\n return (\n <PopoverPrimitive.Arrow className=\"pointer-events-none -mt-px\" asChild offset={2} width={30} height={11}>\n <svg {...props} ref={ref} viewBox=\"0 19 30 11\" style={{ transform: 'rotateZ(180deg)' }}>\n <path\n className=\"text-grey-dark group-focus:text-blue-light fill-current\"\n d=\"M23.7,27.1L17,19.9C16.5,19.3,15.8,19,15,19s-1.6,0.3-2.1,0.9l-6.6,7.2C5.3,28.1,3.4,29,2,29h26 C26.7,29,24.6,28.1,23.7,27.1z\"\n ></path>\n <path\n className=\"fill-current\"\n d=\"M23,27.8c1.1,1.2,3.4,2.2,5,2.2h2H0h2c1.7,0,3.9-1,5-2.2l6.6-7.2c0.7-0.8,2-0.8,2.7,0L23,27.8L23,27.8z\"\n ></path>\n </svg>\n </PopoverPrimitive.Arrow>\n );\n});\n\nexport type UnstyledContentProps = Omit<PopoverPrimitive.PopoverContentProps, 'side'> & {\n /** Set the position of the Popover relative to its trigger. Default value is `bottom` */\n placement?: Placement;\n};\nexport const UnstyledContent = React.forwardRef(function PopoverContent(\n props: UnstyledContentProps,\n ref: React.Ref<HTMLDivElement>\n) {\n const { placement: side, ...otherProps } = props;\n\n const className = cn(\n 'border border-transparent rounded p-3 yt-shadow focus:yt-focus outline-none group z-[996]',\n props.className\n );\n\n return <PopoverPrimitive.Content {...otherProps} className={className} side={side} sideOffset={1} ref={ref} />;\n});\n"],"names":["UnstyledArrow","React","PopoverArrow","props","ref","PopoverPrimitive","className","asChild","offset","width","height","viewBox","style","transform","d","UnstyledContent","PopoverContent","side","placement","otherProps","cn","sideOffset"],"mappings":";;;;;;IAKaA,aAAa,gBAAGC,UAAA,CAAiB,SAASC,YAAT,CAC1CC,KAD0C,EAE1CC,GAF0C;EAI1C,OACIH,aAAA,CAACI,KAAD;IAAwBC,SAAS,EAAC;IAA6BC,OAAO;IAACC,MAAM,EAAE;IAAGC,KAAK,EAAE;IAAIC,MAAM,EAAE;GAArG,EACIT,aAAA,MAAA,oBAASE;IAAOC,GAAG,EAAEA;IAAKO,OAAO,EAAC;IAAaC,KAAK,EAAE;MAAEC,SAAS,EAAE;;IAAnE,EACIZ,aAAA,OAAA;IACIK,SAAS,EAAC;IACVQ,CAAC,EAAC;GAFN,CADJ,EAKIb,aAAA,OAAA;IACIK,SAAS,EAAC;IACVQ,CAAC,EAAC;GAFN,CALJ,CADJ,CADJ;AAcH,CAlB4B;IAwBhBC,eAAe,gBAAGd,UAAA,CAAiB,SAASe,cAAT,CAC5Cb,KAD4C,EAE5CC,GAF4C;EAI5C,IAAmBa,IAAnB,GAA2Cd,KAA3C,CAAQe,SAAR;MAA4BC,UAA5B,iCAA2ChB,KAA3C;;EAEA,IAAMG,SAAS,GAAGc,EAAE,CAChB,2FADgB,EAEhBjB,KAAK,CAACG,SAFU,CAApB;EAKA,OAAOL,aAAA,CAACI,OAAD,oBAA8Bc;IAAYb,SAAS,EAAEA;IAAWW,IAAI,EAAEA;IAAMI,UAAU,EAAE;IAAGjB,GAAG,EAAEA;IAAhG,CAAP;AACH,CAZ8B;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Progress.js","sources":["../../../../src/components/Progress/Progress.tsx"],"sourcesContent":["import React from 'react';\r\nimport cn from 'classnames';\r\nimport './Progress.css';\r\n\r\nexport type ProgressProps = React.HTMLAttributes<HTMLSpanElement> & {\r\n /**\r\n * Indicates how long (in milliseconds) a progress bar will take to progress through.\r\n * By default, progress bar has no duration\r\n */\r\n duration?: number;\r\n};\r\n\r\nexport const Progress = ({ duration = undefined, ...props }: ProgressProps): JSX.Element => {\r\n let style;\r\n\r\n if (duration) {\r\n style = {\r\n animationDuration: `${duration}ms`,\r\n };\r\n }\r\n\r\n const className = cn('bg-grey-light rounded block h-1 overflow-hidden w-full', props.className);\r\n\r\n const progressClassName = cn('yt-progress__bar block h-1', {\r\n \"w-full before:h-1 before:bg-grey-dark before:block before:animate-[progress-indeterminate_2s_cubic-bezier(0.4,0,0.2,1)_infinite] before:content-[' ']\":\r\n !duration,\r\n [`w-0 bg-grey-dark animate-[progress_linear]`]: duration,\r\n });\r\n\r\n return (\r\n <span {...props} data-taco=\"progress\" className={className}>\r\n <span className={progressClassName} data-taco=\"progress-bar\" style={style} />\r\n </span>\r\n );\r\n};\r\n"],"names":["Progress","duration","undefined","props","style","animationDuration","className","cn","progressClassName","React"],"mappings":";;;;;IAYaA,QAAQ,GAAG,SAAXA,QAAW;;;2BAAGC;MAAAA,sCAAWC;MAAcC;;AAChD,MAAIC,KAAJ;;AAEA,MAAIH,QAAJ,EAAc;AACVG,IAAAA,KAAK,GAAG;AACJC,MAAAA,iBAAiB,EAAKJ,QAAL;AADb,KAAR;AAGH;;AAED,MAAMK,SAAS,GAAGC,EAAE,CAAC,wDAAD,EAA2DJ,KAAK,CAACG,SAAjE,CAApB;AAEA,MAAME,iBAAiB,GAAGD,EAAE,CAAC,4BAAD;AACxB,6JACI,CAACN;AAFmB,yDAGwBA,QAHxB,OAA5B;AAMA,SACIQ,4BAAA,OAAA,oBAAUN;iBAAiB;AAAWG,IAAAA,SAAS,EAAEA;IAAjD,EACIG,4BAAA,OAAA;AAAMH,IAAAA,SAAS,EAAEE;iBAA6B;AAAeJ,IAAAA,KAAK,EAAEA;GAApE,CADJ,CADJ;AAKH;;;;"}
1
+ {"version":3,"file":"Progress.js","sources":["../../../../src/components/Progress/Progress.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport './Progress.css';\n\nexport type ProgressProps = React.HTMLAttributes<HTMLSpanElement> & {\n /**\n * Indicates how long (in milliseconds) a progress bar will take to progress through.\n * By default, progress bar has no duration\n */\n duration?: number;\n};\n\nexport const Progress = ({ duration = undefined, ...props }: ProgressProps): JSX.Element => {\n let style;\n\n if (duration) {\n style = {\n animationDuration: `${duration}ms`,\n };\n }\n\n const className = cn('bg-grey-light rounded block h-1 overflow-hidden w-full', props.className);\n\n const progressClassName = cn('yt-progress__bar block h-1', {\n \"w-full before:h-1 before:bg-grey-dark before:block before:animate-[progress-indeterminate_2s_cubic-bezier(0.4,0,0.2,1)_infinite] before:content-[' ']\":\n !duration,\n [`w-0 bg-grey-dark animate-[progress_linear]`]: duration,\n });\n\n return (\n <span {...props} data-taco=\"progress\" className={className}>\n <span className={progressClassName} data-taco=\"progress-bar\" style={style} />\n </span>\n );\n};\n"],"names":["Progress","duration","undefined","props","style","animationDuration","className","cn","progressClassName","React"],"mappings":";;;;;IAYaA,QAAQ,GAAG,SAAXA,QAAW;;;2BAAGC;MAAAA,sCAAWC;MAAcC;;EAChD,IAAIC,KAAJ;;EAEA,IAAIH,QAAJ,EAAc;IACVG,KAAK,GAAG;MACJC,iBAAiB,EAAKJ,QAAL;KADrB;;;EAKJ,IAAMK,SAAS,GAAGC,EAAE,CAAC,wDAAD,EAA2DJ,KAAK,CAACG,SAAjE,CAApB;EAEA,IAAME,iBAAiB,GAAGD,EAAE,CAAC,4BAAD;IACxB,yJACI,CAACN;yDAC2CA,QAHxB,OAA5B;EAMA,OACIQ,4BAAA,OAAA,oBAAUN;iBAAiB;IAAWG,SAAS,EAAEA;IAAjD,EACIG,4BAAA,OAAA;IAAMH,SAAS,EAAEE;iBAA6B;IAAeJ,KAAK,EAAEA;GAApE,CADJ,CADJ;AAKH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Provider.js","sources":["../../../../src/components/Provider/Provider.tsx"],"sourcesContent":["import * as React from 'react';\r\n\r\nimport { Locale } from '../../types';\r\nimport { CalendarTexts } from '../Calendar/Calendar';\r\nimport { ComboboxTexts } from '../Combobox/Combobox';\r\nimport { DialogTexts } from '../Dialog/Dialog';\r\nimport { PaginationTexts } from '../Pagination/Pagination';\r\nimport { ListboxTexts } from '../Listbox/Listbox';\r\nimport { ToastsTexts } from '../Toast/Toast';\r\nimport { DatepickerTexts } from '../Datepicker/Datepicker';\r\nimport { HangerTexts } from '../Hanger/Hanger';\r\nimport { SelectTexts } from '../Select/Select';\r\nimport { TourTexts } from '../Tour/Tour';\r\nimport { TableTexts } from '../Table/Table';\r\nimport { SearchInputTexts } from '../SearchInput/SearchInput';\r\nimport { ToastProvider } from '../Toast/Toaster';\r\n\r\nexport type LocalizationTexts = {\r\n /** Localized texts and aria-labels for [Calendar](component:calendar) component */\r\n calendar: CalendarTexts;\r\n /** Localized texts and aria-labels for [Combobox](component:combobox) component */\r\n combobox: ComboboxTexts;\r\n /** Localized texts and aria-labels for [DatePicker](component:datepicker) component */\r\n datepicker: DatepickerTexts;\r\n /** Localized texts and aria-labels for [Hanger](component:hanger) component */\r\n hanger: HangerTexts;\r\n /** Localized texts and aria-labels for [Listbox](component:listbox) component */\r\n listbox: ListboxTexts;\r\n /** Localized texts and aria-labels for [Dialog](component:dialog) component */\r\n dialog: DialogTexts;\r\n /** Localized texts and aria-labels for [Pagination](component:pagination) component */\r\n pagination: PaginationTexts;\r\n /** Localized texts and aria-labels for [Table](component:table) component */\r\n table: TableTexts;\r\n /** Localized texts and aria-labels for [Select](component:select) component */\r\n select: SelectTexts;\r\n /** Localized texts and aria-labels for [Toast](component:toast) component */\r\n toasts: ToastsTexts;\r\n /** Localized texts and aria-labels for [Tour](component:tour) component */\r\n tour: TourTexts;\r\n /** Localized texts and aria-labels for [SearchInput](component:searchinput) component */\r\n searchInput: SearchInputTexts;\r\n};\r\n\r\nexport type Localization = {\r\n /**\r\n * Provide the language code used in application.\r\n * Default value is `en-GB`\r\n */\r\n locale: Locale;\r\n /** Provide the texts and aria-labels for components used within the provider */\r\n texts: LocalizationTexts;\r\n /** Provide the formatting */\r\n formatting: {\r\n /** Default value is `dd.mm.yy` */\r\n date: string;\r\n };\r\n};\r\nexport type Taco = {\r\n /** Define localized texts and formatted data in your application */\r\n localization: Localization;\r\n};\r\n\r\nexport const defaultLocalisationTexts = {\r\n calendar: {\r\n months: [\r\n 'January',\r\n 'February',\r\n 'March',\r\n 'April',\r\n 'May',\r\n 'June',\r\n 'July',\r\n 'August',\r\n 'September',\r\n 'October',\r\n 'November',\r\n 'December',\r\n ],\r\n weekdaysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],\r\n actions: {\r\n previousMonth: 'Previous month',\r\n nextMonth: 'Next month',\r\n previousYear: 'Previous year',\r\n nextYear: 'Next year',\r\n today: 'Today',\r\n },\r\n },\r\n combobox: {\r\n tooltip: 'Search in list',\r\n },\r\n datepicker: {\r\n calendar: 'Calendar',\r\n clear: 'Clear',\r\n expand: 'Show calendar',\r\n shortcuts: 'Shortcuts',\r\n },\r\n hanger: {\r\n close: 'Close',\r\n },\r\n listbox: {\r\n loading: 'Loading results...',\r\n empty: 'No results found',\r\n allOption: 'All',\r\n },\r\n dialog: {\r\n close: 'Close',\r\n drag: 'Drag',\r\n },\r\n pagination: {\r\n label: 'Pagination',\r\n pageSize: 'Items per page',\r\n showingXofYofTotal: 'Showing [X] - [Y] of [total]',\r\n actions: {\r\n firstPage: 'Goto first page',\r\n firstPageWithShortcut: 'Goto first page (Home)',\r\n previousPage: 'Goto previous page',\r\n previousPageWithShortcut: 'Goto previous page (Page Up)',\r\n nextPage: 'Goto next page',\r\n nextPageWithShortcut: 'Goto next page (Page Down)',\r\n lastPage: 'Goto last page',\r\n lastPageWithShortcut: 'Goto last page (End)',\r\n pageX: 'Goto page [X]',\r\n },\r\n },\r\n table: {\r\n actions: 'Other actions',\r\n edit: 'Edit (e)',\r\n copy: 'Copy (c)',\r\n del: 'Delete (del)',\r\n newSubRow: 'New row (shift + n)',\r\n loading: 'Loading...',\r\n },\r\n select: {\r\n allOptionsSelected: 'All',\r\n },\r\n toasts: {\r\n dismiss: 'Dismiss',\r\n },\r\n tour: {\r\n back: 'Back',\r\n close: 'Close',\r\n skip: 'Close and complete',\r\n last: 'Done',\r\n next: 'Next',\r\n open: 'Open',\r\n },\r\n searchInput: {\r\n inputLabel: 'Search...',\r\n },\r\n};\r\n\r\nconst defaultLocalizationContext: Localization = {\r\n locale: 'en-GB',\r\n texts: defaultLocalisationTexts,\r\n formatting: {\r\n date: 'dd.mm.yy',\r\n },\r\n};\r\n\r\nconst Context = React.createContext<Taco>({\r\n localization: defaultLocalizationContext,\r\n});\r\n\r\nexport type ProviderProps = {\r\n /** Content would be your application */\r\n children?: any;\r\n /** Define localized texts and formatted data in your application */\r\n localization?: Localization;\r\n};\r\n\r\nexport const Provider = (props: ProviderProps): JSX.Element => {\r\n const { children, localization = defaultLocalizationContext } = props;\r\n const value = React.useMemo(() => ({ localization }), [localization]);\r\n\r\n return (\r\n <Context.Provider value={value}>\r\n <ToastProvider>{children}</ToastProvider>\r\n </Context.Provider>\r\n );\r\n};\r\n\r\nexport const useTaco = (): Taco => React.useContext(Context);\r\nexport const useLocalization = (): Localization => useTaco().localization;\r\n"],"names":["defaultLocalisationTexts","calendar","months","weekdaysShort","actions","previousMonth","nextMonth","previousYear","nextYear","today","combobox","tooltip","datepicker","clear","expand","shortcuts","hanger","close","listbox","loading","empty","allOption","dialog","drag","pagination","label","pageSize","showingXofYofTotal","firstPage","firstPageWithShortcut","previousPage","previousPageWithShortcut","nextPage","nextPageWithShortcut","lastPage","lastPageWithShortcut","pageX","table","edit","copy","del","newSubRow","select","allOptionsSelected","toasts","dismiss","tour","back","skip","last","next","open","searchInput","inputLabel","defaultLocalizationContext","locale","texts","formatting","date","Context","React","localization","Provider","props","children","value","ToastProvider","useTaco","useLocalization"],"mappings":";;;IA+DaA,wBAAwB,GAAG;AACpCC,EAAAA,QAAQ,EAAE;AACNC,IAAAA,MAAM,EAAE,CACJ,SADI,EAEJ,UAFI,EAGJ,OAHI,EAIJ,OAJI,EAKJ,KALI,EAMJ,MANI,EAOJ,MAPI,EAQJ,QARI,EASJ,WATI,EAUJ,SAVI,EAWJ,UAXI,EAYJ,UAZI,CADF;AAeNC,IAAAA,aAAa,EAAE,CAAC,KAAD,EAAQ,KAAR,EAAe,KAAf,EAAsB,KAAtB,EAA6B,KAA7B,EAAoC,KAApC,EAA2C,KAA3C,CAfT;AAgBNC,IAAAA,OAAO,EAAE;AACLC,MAAAA,aAAa,EAAE,gBADV;AAELC,MAAAA,SAAS,EAAE,YAFN;AAGLC,MAAAA,YAAY,EAAE,eAHT;AAILC,MAAAA,QAAQ,EAAE,WAJL;AAKLC,MAAAA,KAAK,EAAE;AALF;AAhBH,GAD0B;AAyBpCC,EAAAA,QAAQ,EAAE;AACNC,IAAAA,OAAO,EAAE;AADH,GAzB0B;AA4BpCC,EAAAA,UAAU,EAAE;AACRX,IAAAA,QAAQ,EAAE,UADF;AAERY,IAAAA,KAAK,EAAE,OAFC;AAGRC,IAAAA,MAAM,EAAE,eAHA;AAIRC,IAAAA,SAAS,EAAE;AAJH,GA5BwB;AAkCpCC,EAAAA,MAAM,EAAE;AACJC,IAAAA,KAAK,EAAE;AADH,GAlC4B;AAqCpCC,EAAAA,OAAO,EAAE;AACLC,IAAAA,OAAO,EAAE,oBADJ;AAELC,IAAAA,KAAK,EAAE,kBAFF;AAGLC,IAAAA,SAAS,EAAE;AAHN,GArC2B;AA0CpCC,EAAAA,MAAM,EAAE;AACJL,IAAAA,KAAK,EAAE,OADH;AAEJM,IAAAA,IAAI,EAAE;AAFF,GA1C4B;AA8CpCC,EAAA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ExD,wBAFsC;AAG7CyD,EAAAA,UAAU,EAAE;AACRC,IAAAA,IAAI,EAAE;AADE;AAHiC,CAAjD;AAQA,IAAMC,OAAO,gBAAGC,aAAA,CAA0B;AACtCC,EAAAA,YAAY,EAAEP;AADwB,CAA1B,CAAhB;IAWaQ,QAAQ,GAAG,SAAXA,QAAW,CAACC,KAAD;AACpB,MAAQC,QAAR,GAAgED,KAAhE,CAAQC,QAAR;AAAA,4BAAgED,KAAhE,CAAkBF,YAAlB;AAAA,MAAkBA,YAAlB,oCAAiCP,0BAAjC;AACA,MAAMW,KAAK,GAAGL,OAAA,CAAc;AAAA,WAAO;AAAEC,MAAAA,YAAY,EAAZA;AAAF,KAAP;AAAA,GAAd,EAAwC,CAACA,YAAD,CAAxC,CAAd;AAEA,SACID,aAAA,CAACD,OAAO,CAACG,QAAT;AAAkBG,IAAAA,KAAK,EAAEA;GAAzB,EACIL,aAAA,CAACM,aAAD,MAAA,EAAgBF,QAAhB,CADJ,CADJ;AAKH;IAEYG,OAAO,GAAG,SAAVA,OAAU;AAAA,SAAYP,UAAA,CAAiBD,OAAjB,CAAZ;AAAA;IACVS,eAAe,GAAG,SAAlBA,eAAkB;AAAA,SAAoBD,OAAO,GAAGN,YAA9B;AAAA;;;;"}
1
+ {"version":3,"file":"Provider.js","sources":["../../../../src/components/Provider/Provider.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Locale } from '../../types';\nimport { CalendarTexts } from '../Calendar/Calendar';\nimport { ComboboxTexts } from '../Combobox/Combobox';\nimport { DialogTexts } from '../Dialog/Dialog';\nimport { PaginationTexts } from '../Pagination/Pagination';\nimport { ListboxTexts } from '../Listbox/Listbox';\nimport { ToastsTexts } from '../Toast/Toast';\nimport { DatepickerTexts } from '../Datepicker/Datepicker';\nimport { HangerTexts } from '../Hanger/Hanger';\nimport { SelectTexts } from '../Select/Select';\nimport { TourTexts } from '../Tour/Tour';\nimport { TableTexts } from '../Table/Table';\nimport { SearchInputTexts } from '../SearchInput/SearchInput';\nimport { ToastProvider } from '../Toast/Toaster';\n\nexport type LocalizationTexts = {\n /** Localized texts and aria-labels for [Calendar](component:calendar) component */\n calendar: CalendarTexts;\n /** Localized texts and aria-labels for [Combobox](component:combobox) component */\n combobox: ComboboxTexts;\n /** Localized texts and aria-labels for [DatePicker](component:datepicker) component */\n datepicker: DatepickerTexts;\n /** Localized texts and aria-labels for [Hanger](component:hanger) component */\n hanger: HangerTexts;\n /** Localized texts and aria-labels for [Listbox](component:listbox) component */\n listbox: ListboxTexts;\n /** Localized texts and aria-labels for [Dialog](component:dialog) component */\n dialog: DialogTexts;\n /** Localized texts and aria-labels for [Pagination](component:pagination) component */\n pagination: PaginationTexts;\n /** Localized texts and aria-labels for [Table](component:table) component */\n table: TableTexts;\n /** Localized texts and aria-labels for [Select](component:select) component */\n select: SelectTexts;\n /** Localized texts and aria-labels for [Toast](component:toast) component */\n toasts: ToastsTexts;\n /** Localized texts and aria-labels for [Tour](component:tour) component */\n tour: TourTexts;\n /** Localized texts and aria-labels for [SearchInput](component:searchinput) component */\n searchInput: SearchInputTexts;\n};\n\nexport type Localization = {\n /**\n * Provide the language code used in application.\n * Default value is `en-GB`\n */\n locale: Locale;\n /** Provide the texts and aria-labels for components used within the provider */\n texts: LocalizationTexts;\n /** Provide the formatting */\n formatting: {\n /** Default value is `dd.mm.yy` */\n date: string;\n };\n};\nexport type Taco = {\n /** Define localized texts and formatted data in your application */\n localization: Localization;\n};\n\nexport const defaultLocalisationTexts = {\n calendar: {\n months: [\n 'January',\n 'February',\n 'March',\n 'April',\n 'May',\n 'June',\n 'July',\n 'August',\n 'September',\n 'October',\n 'November',\n 'December',\n ],\n weekdaysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],\n actions: {\n previousMonth: 'Previous month',\n nextMonth: 'Next month',\n previousYear: 'Previous year',\n nextYear: 'Next year',\n today: 'Today',\n },\n },\n combobox: {\n tooltip: 'Search in list',\n },\n datepicker: {\n calendar: 'Calendar',\n clear: 'Clear',\n expand: 'Show calendar',\n shortcuts: 'Shortcuts',\n },\n hanger: {\n close: 'Close',\n },\n listbox: {\n loading: 'Loading results...',\n empty: 'No results found',\n allOption: 'All',\n },\n dialog: {\n close: 'Close',\n drag: 'Drag',\n },\n pagination: {\n label: 'Pagination',\n pageSize: 'Items per page',\n showingXofYofTotal: 'Showing [X] - [Y] of [total]',\n actions: {\n firstPage: 'Goto first page',\n firstPageWithShortcut: 'Goto first page (Home)',\n previousPage: 'Goto previous page',\n previousPageWithShortcut: 'Goto previous page (Page Up)',\n nextPage: 'Goto next page',\n nextPageWithShortcut: 'Goto next page (Page Down)',\n lastPage: 'Goto last page',\n lastPageWithShortcut: 'Goto last page (End)',\n pageX: 'Goto page [X]',\n },\n },\n table: {\n actions: 'Other actions',\n edit: 'Edit (e)',\n copy: 'Copy (c)',\n del: 'Delete (del)',\n newSubRow: 'New row (shift + n)',\n loading: 'Loading...',\n },\n select: {\n allOptionsSelected: 'All',\n },\n toasts: {\n dismiss: 'Dismiss',\n },\n tour: {\n back: 'Back',\n close: 'Close',\n skip: 'Close and complete',\n last: 'Done',\n next: 'Next',\n open: 'Open',\n },\n searchInput: {\n inputLabel: 'Search...',\n },\n};\n\nconst defaultLocalizationContext: Localization = {\n locale: 'en-GB',\n texts: defaultLocalisationTexts,\n formatting: {\n date: 'dd.mm.yy',\n },\n};\n\nconst Context = React.createContext<Taco>({\n localization: defaultLocalizationContext,\n});\n\nexport type ProviderProps = {\n /** Content would be your application */\n children?: any;\n /** Define localized texts and formatted data in your application */\n localization?: Localization;\n};\n\nexport const Provider = (props: ProviderProps): JSX.Element => {\n const { children, localization = defaultLocalizationContext } = props;\n const value = React.useMemo(() => ({ localization }), [localization]);\n\n return (\n <Context.Provider value={value}>\n <ToastProvider>{children}</ToastProvider>\n </Context.Provider>\n );\n};\n\nexport const useTaco = (): Taco => React.useContext(Context);\nexport const useLocalization = (): Localization => useTaco().localization;\n"],"names":["defaultLocalisationTexts","calendar","months","weekdaysShort","actions","previousMonth","nextMonth","previousYear","nextYear","today","combobox","tooltip","datepicker","clear","expand","shortcuts","hanger","close","listbox","loading","empty","allOption","dialog","drag","pagination","label","pageSize","showingXofYofTotal","firstPage","firstPageWithShortcut","previousPage","previousPageWithShortcut","nextPage","nextPageWithShortcut","lastPage","lastPageWithShortcut","pageX","table","edit","copy","del","newSubRow","select","allOptionsSelected","toasts","dismiss","tour","back","skip","last","next","open","searchInput","inputLabel","defaultLocalizationContext","locale","texts","formatting","date","Context","React","localization","Provider","props","children","value","ToastProvider","useTaco","useLocalization"],"mappings":";;;IA+DaA,wBAAwB,GAAG;EACpCC,QAAQ,EAAE;IACNC,MAAM,EAAE,CACJ,SADI,EAEJ,UAFI,EAGJ,OAHI,EAIJ,OAJI,EAKJ,KALI,EAMJ,MANI,EAOJ,MAPI,EAQJ,QARI,EASJ,WATI,EAUJ,SAVI,EAWJ,UAXI,EAYJ,UAZI,CADF;IAeNC,aAAa,EAAE,CAAC,KAAD,EAAQ,KAAR,EAAe,KAAf,EAAsB,KAAtB,EAA6B,KAA7B,EAAoC,KAApC,EAA2C,KAA3C,CAfT;IAgBNC,OAAO,EAAE;MACLC,aAAa,EAAE,gBADV;MAELC,SAAS,EAAE,YAFN;MAGLC,YAAY,EAAE,eAHT;MAILC,QAAQ,EAAE,WAJL;MAKLC,KAAK,EAAE;;GAtBqB;EAyBpCC,QAAQ,EAAE;IACNC,OAAO,EAAE;GA1BuB;EA4BpCC,UAAU,EAAE;IACRX,QAAQ,EAAE,UADF;IAERY,KAAK,EAAE,OAFC;IAGRC,MAAM,EAAE,eAHA;IAIRC,SAAS,EAAE;GAhCqB;EAkCpCC,MAAM,EAAE;IACJC,KAAK,EAAE;GAnCyB;EAqCpCC,OAAO,EAAE;IACLC,OAAO,EAAE,oBADJ;IAELC,KAAK,EAAE,kBAFF;IAGLC,SAAS,EAAE;GAxCqB;EA0CpCC,MAAM,EAAE;IACJL,KAAK,EAAE,OADH;IAEJM,IAA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,YAAlB;MAAkBA,YAAlB,oCAAiCP,0BAAjC;EACA,IAAMW,KAAK,GAAGL,OAAA,CAAc;IAAA,OAAO;MAAEC,YAAY,EAAZA;KAAT;GAAd,EAAwC,CAACA,YAAD,CAAxC,CAAd;EAEA,OACID,aAAA,CAACD,OAAO,CAACG,QAAT;IAAkBG,KAAK,EAAEA;GAAzB,EACIL,aAAA,CAACM,aAAD,MAAA,EAAgBF,QAAhB,CADJ,CADJ;AAKH;IAEYG,OAAO,GAAG,SAAVA,OAAU;EAAA,OAAYP,UAAA,CAAiBD,OAAjB,CAAZ;AAAA;IACVS,eAAe,GAAG,SAAlBA,eAAkB;EAAA,OAAoBD,OAAO,GAAGN,YAA9B;AAAA;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"RadioGroup.js","sources":["../../../../src/components/RadioGroup/RadioGroup.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport cn from 'classnames';\r\nimport * as RadioGroupPrimitive from '@radix-ui/react-radio-group';\r\nimport { Orientation } from '../../types';\r\n\r\nexport type RadioGroupItemValue = string | number | boolean | null;\r\n\r\nexport const getRadioGroupItemValueAsString = (value: RadioGroupItemValue): string => String(value ?? '');\r\n\r\nexport const findByValue = (values: RadioGroupItemValue[], valueAsString: string): RadioGroupItemValue =>\r\n values.find(value => getRadioGroupItemValueAsString(value) === valueAsString) as RadioGroupItemValue;\r\n\r\nconst RadioGroupContext = React.createContext({ disabled: false, invalid: false });\r\n\r\nexport type RadioGroupItemProps<T = HTMLButtonElement> = Omit<\r\n React.ButtonHTMLAttributes<T>,\r\n 'children' | 'onSelect' | 'value'\r\n> & {\r\n /** Label for the radio group item */\r\n children: React.ReactNode;\r\n /* Whether the radio group item is disabled */\r\n disabled?: boolean;\r\n /** Value of the radio button */\r\n value: RadioGroupItemValue;\r\n};\r\n\r\nconst RadioGroupItem = React.forwardRef(function RadioGroupItem(props: RadioGroupItemProps, ref: React.Ref<HTMLButtonElement>) {\r\n const context = React.useContext(RadioGroupContext);\r\n const { children, value, ...otherProps } = props;\r\n\r\n const isDisabled = context.disabled || props.disabled;\r\n\r\n const className = cn(\r\n 'flex flex-shrink-0 self-start items-center justify-center h-4 w-4 mt-[0.2rem] rounded-full bg-white border-2',\r\n {\r\n 'border-grey-dark hover:border-4 focus:yt-focus aria-checked:bg-blue aria-checked:border-blue hover:aria-checked:border-blue-light':\r\n !isDisabled && !context.invalid,\r\n 'border-grey cursor-not-allowed aria-checked:bg-blue-light aria-checked:border-blue-light ': isDisabled,\r\n 'border-red hover:border-4 text-red focus:border-red focus:yt-focus-red aria-checked:bg-red aria-checked:border-red':\r\n context.invalid && !isDisabled,\r\n }\r\n );\r\n const labelClassName = cn(\r\n 'flex items-center gap-2',\r\n {\r\n 'cursor-pointer': !isDisabled,\r\n 'cursor-not-allowed text-grey-dark': isDisabled,\r\n },\r\n props.className\r\n );\r\n\r\n return (\r\n <label className={labelClassName}>\r\n <RadioGroupPrimitive.Item\r\n {...otherProps}\r\n className={className}\r\n disabled={isDisabled}\r\n ref={ref}\r\n value={getRadioGroupItemValueAsString(value)}\r\n >\r\n <RadioGroupPrimitive.Indicator className=\"h-2 w-2 rounded-full bg-white\" />\r\n </RadioGroupPrimitive.Item>\r\n {children}\r\n </label>\r\n );\r\n});\r\n\r\ntype ReactGroupBaseChild = React.ReactElement<RadioGroupItemProps> | boolean | null;\r\n\r\ntype RadioGroupBaseProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'children' | 'defaultValue' | 'onChange' | 'value'> & {\r\n children: ReactGroupBaseChild[];\r\n /* Whether the radio group is disabled */\r\n disabled?: boolean;\r\n /* Whether the radio group is in an invalid state */\r\n invalid?: boolean;\r\n /** The name of the radio group, used when submitting an HTML form */\r\n name?: string;\r\n /**\r\n * Orientation of the radio group\r\n * @defaultValue vertical\r\n */\r\n orientation?: Orientation;\r\n /* Whether the radio group requires user input */\r\n required?: boolean;\r\n};\r\n\r\ninterface UncontrolledRadioGroupProps extends RadioGroupBaseProps {\r\n /* The default value (uncontrolled) */\r\n defaultValue?: RadioGroupItemValue;\r\n onChange?: never;\r\n value?: never;\r\n}\r\n\r\ninterface ControlledRadioGroupProps extends RadioGroupBaseProps {\r\n defaultValue?: never;\r\n /** Handler called when the value changes */\r\n onChange: (value: RadioGroupItemValue) => void;\r\n /** The current value (controlled) */\r\n value?: RadioGroupItemValue;\r\n}\r\n\r\nexport type RadioGroupProps = UncontrolledRadioGroupProps | ControlledRadioGroupProps;\r\n\r\nexport type ForwardedRadioGroupWithStatics = React.ForwardRefExoticComponent<\r\n RadioGroupProps & React.RefAttributes<HTMLDivElement>\r\n> & {\r\n /** Item component rendered in a `RadioGroup` component */\r\n Item: React.ForwardRefExoticComponent<RadioGroupItemProps>;\r\n};\r\n\r\nexport const useRadioGroup = (props: RadioGroupProps) => {\r\n const { children, defaultValue, disabled, invalid, onChange, orientation = 'vertical', value, ...otherProps } = props;\r\n\r\n const values = React.useMemo<RadioGroupItemValue[]>(() => {\r\n const radioGroupItemValues: RadioGroupItemValue[] = [];\r\n\r\n React.Children.forEach(children, child => {\r\n if (React.isValidElement(child)) {\r\n radioGroupItemValues.push(child.props.value);\r\n }\r\n });\r\n\r\n return radioGroupItemValues;\r\n }, [children]);\r\n\r\n const context = React.useMemo(() => ({ disabled: disabled ?? false, invalid: invalid ?? false }), [disabled, invalid]);\r\n\r\n let valueProps;\r\n\r\n if (onChange !== undefined) {\r\n const handleChange = (value: string): void => onChange(findByValue(values, value));\r\n\r\n valueProps = {\r\n onValueChange: handleChange,\r\n value: value !== undefined ? getRadioGroupItemValueAsString(value) : undefined,\r\n };\r\n } else {\r\n valueProps = {\r\n defaultValue: defaultValue !== undefined ? getRadioGroupItemValueAsString(defaultValue) : undefined,\r\n };\r\n }\r\n\r\n return {\r\n context,\r\n props: {\r\n ...otherProps,\r\n ...valueProps,\r\n children,\r\n orientation,\r\n },\r\n };\r\n};\r\n\r\nexport const RadioGroup = React.forwardRef(function RadioGroup(props: RadioGroupProps, ref: React.Ref<HTMLDivElement>) {\r\n const { context, props: otherProps } = useRadioGroup(props);\r\n const className = cn(\r\n 'flex items-start gap-y-2',\r\n {\r\n 'flex-wrap gap-x-4 ': otherProps.orientation === 'horizontal',\r\n 'flex-col': otherProps.orientation === 'vertical',\r\n },\r\n otherProps.className\r\n );\r\n\r\n return (\r\n <RadioGroupContext.Provider value={context}>\r\n <RadioGroupPrimitive.Root {...otherProps} className={className} data-taco=\"radio-group\" ref={ref} />\r\n </RadioGroupContext.Provider>\r\n );\r\n}) as ForwardedRadioGroupWithStatics;\r\nRadioGroup.Item = RadioGroupItem;\r\n"],"names":["getRadioGroupItemValueAsString","value","String","findByValue","values","valueAsString","find","RadioGroupContext","React","disabled","invalid","RadioGroupItem","props","ref","context","children","otherProps","isDisabled","className","cn","labelClassName","RadioGroupPrimitive","useRadioGroup","defaultValue","onChange","orientation","radioGroupItemValues","forEach","child","push","valueProps","undefined","handleChange","onValueChange","RadioGroup","Provider","Item"],"mappings":";;;;;;;IAOaA,8BAA8B,GAAG,SAAjCA,8BAAiC,CAACC,KAAD;AAAA,SAAwCC,MAAM,CAACD,KAAD,aAACA,KAAD,cAACA,KAAD,GAAU,EAAV,CAA9C;AAAA;IAEjCE,WAAW,GAAG,SAAdA,WAAc,CAACC,MAAD,EAAgCC,aAAhC;AAAA,SACvBD,MAAM,CAACE,IAAP,CAAY,UAAAL,KAAK;AAAA,WAAID,8BAA8B,CAACC,KAAD,CAA9B,KAA0CI,aAA9C;AAAA,GAAjB,CADuB;AAAA;AAG3B,IAAME,iBAAiB,gBAAGC,aAAA,CAAoB;AAAEC,EAAAA,QAAQ,EAAE,KAAZ;AAAmBC,EAAAA,OAAO,EAAE;AAA5B,CAApB,CAA1B;AAcA,IAAMC,cAAc,gBAAGH,UAAA,CAAiB,SAASG,cAAT,CAAwBC,KAAxB,EAAoDC,GAApD;AACpC,MAAMC,OAAO,GAAGN,UAAA,CAAiBD,iBAAjB,CAAhB;;AACA,MAAQQ,QAAR,GAA2CH,KAA3C,CA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Q;AADjF,KAAb;AAGH;;AAED,SAAO;AACHjB,IAAAA,OAAO,EAAPA,OADG;AAEHF,IAAAA,KAAK,eACEI,UADF,EAEEc,UAFF;AAGDf,MAAAA,QAAQ,EAARA,QAHC;AAIDU,MAAAA,WAAW,EAAXA;AAJC;AAFF,GAAP;AASH;IAEYS,UAAU,gBAAG1B,UAAA,CAAiB,SAAS0B,UAAT,CAAoBtB,KAApB,EAA4CC,GAA5C;AACvC,uBAAuCS,aAAa,CAACV,KAAD,CAApD;AAAA,MAAQE,OAAR,kBAAQA,OAAR;AAAA,MAAwBE,UAAxB,kBAAiBJ,KAAjB;;AACA,MAAMM,SAAS,GAAGC,EAAE,CAChB,0BADgB,EAEhB;AACI,0BAAsBH,UAAU,CAACS,WAAX,KAA2B,YADrD;AAEI,gBAAYT,UAAU,CAACS,WAAX,KAA2B;AAF3C,GAFgB,EAMhBT,UAAU,CAACE,SANK,CAApB;AASA,SACIV,aAAA,CAACD,iBAAiB,CAAC4B,QAAnB;AAA4BlC,IAAAA,KAAK,EAAEa;GAAnC,EACIN,aAAA,CAACa,IAAD,oBAA8BL;AAAYE,IAAAA,SAAS,EAAEA;iBAAqB;AAAcL,IAAAA,GAAG,EAAEA;IAA7F,CADJ,CADJ;AAKH,CAhByB;AAiB1BqB,UAAU,CAACE,IAAX,GAAkBzB,cAAlB;;;;"}
1
+ {"version":3,"file":"RadioGroup.js","sources":["../../../../src/components/RadioGroup/RadioGroup.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as RadioGroupPrimitive from '@radix-ui/react-radio-group';\nimport { Orientation } from '../../types';\n\nexport type RadioGroupItemValue = string | number | boolean | null;\n\nexport const getRadioGroupItemValueAsString = (value: RadioGroupItemValue): string => String(value ?? '');\n\nexport const findByValue = (values: RadioGroupItemValue[], valueAsString: string): RadioGroupItemValue =>\n values.find(value => getRadioGroupItemValueAsString(value) === valueAsString) as RadioGroupItemValue;\n\nconst RadioGroupContext = React.createContext({ disabled: false, invalid: false });\n\nexport type RadioGroupItemProps<T = HTMLButtonElement> = Omit<\n React.ButtonHTMLAttributes<T>,\n 'children' | 'onSelect' | 'value'\n> & {\n /** Label for the radio group item */\n children: React.ReactNode;\n /* Whether the radio group item is disabled */\n disabled?: boolean;\n /** Value of the radio button */\n value: RadioGroupItemValue;\n};\n\nconst RadioGroupItem = React.forwardRef(function RadioGroupItem(props: RadioGroupItemProps, ref: React.Ref<HTMLButtonElement>) {\n const context = React.useContext(RadioGroupContext);\n const { children, value, ...otherProps } = props;\n\n const isDisabled = context.disabled || props.disabled;\n\n const className = cn(\n 'flex flex-shrink-0 self-start items-center justify-center h-4 w-4 mt-[0.2rem] rounded-full bg-white border-2',\n {\n 'border-grey-dark hover:border-4 focus:yt-focus aria-checked:bg-blue aria-checked:border-blue hover:aria-checked:border-blue-light':\n !isDisabled && !context.invalid,\n 'border-grey cursor-not-allowed aria-checked:bg-blue-light aria-checked:border-blue-light ': isDisabled,\n 'border-red hover:border-4 text-red focus:border-red focus:yt-focus-red aria-checked:bg-red aria-checked:border-red':\n context.invalid && !isDisabled,\n }\n );\n const labelClassName = cn(\n 'flex items-center gap-2',\n {\n 'cursor-pointer': !isDisabled,\n 'cursor-not-allowed text-grey-dark': isDisabled,\n },\n props.className\n );\n\n return (\n <label className={labelClassName}>\n <RadioGroupPrimitive.Item\n {...otherProps}\n className={className}\n disabled={isDisabled}\n ref={ref}\n value={getRadioGroupItemValueAsString(value)}\n >\n <RadioGroupPrimitive.Indicator className=\"h-2 w-2 rounded-full bg-white\" />\n </RadioGroupPrimitive.Item>\n {children}\n </label>\n );\n});\n\ntype ReactGroupBaseChild = React.ReactElement<RadioGroupItemProps> | boolean | null;\n\ntype RadioGroupBaseProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'children' | 'defaultValue' | 'onChange' | 'value'> & {\n children: ReactGroupBaseChild[];\n /* Whether the radio group is disabled */\n disabled?: boolean;\n /* Whether the radio group is in an invalid state */\n invalid?: boolean;\n /** The name of the radio group, used when submitting an HTML form */\n name?: string;\n /**\n * Orientation of the radio group\n * @defaultValue vertical\n */\n orientation?: Orientation;\n /* Whether the radio group requires user input */\n required?: boolean;\n};\n\ninterface UncontrolledRadioGroupProps extends RadioGroupBaseProps {\n /* The default value (uncontrolled) */\n defaultValue?: RadioGroupItemValue;\n onChange?: never;\n value?: never;\n}\n\ninterface ControlledRadioGroupProps extends RadioGroupBaseProps {\n defaultValue?: never;\n /** Handler called when the value changes */\n onChange: (value: RadioGroupItemValue) => void;\n /** The current value (controlled) */\n value?: RadioGroupItemValue;\n}\n\nexport type RadioGroupProps = UncontrolledRadioGroupProps | ControlledRadioGroupProps;\n\nexport type ForwardedRadioGroupWithStatics = React.ForwardRefExoticComponent<\n RadioGroupProps & React.RefAttributes<HTMLDivElement>\n> & {\n /** Item component rendered in a `RadioGroup` component */\n Item: React.ForwardRefExoticComponent<RadioGroupItemProps>;\n};\n\nexport const useRadioGroup = (props: RadioGroupProps) => {\n const { children, defaultValue, disabled, invalid, onChange, orientation = 'vertical', value, ...otherProps } = props;\n\n const values = React.useMemo<RadioGroupItemValue[]>(() => {\n const radioGroupItemValues: RadioGroupItemValue[] = [];\n\n React.Children.forEach(children, child => {\n if (React.isValidElement(child)) {\n radioGroupItemValues.push(child.props.value);\n }\n });\n\n return radioGroupItemValues;\n }, [children]);\n\n const context = React.useMemo(() => ({ disabled: disabled ?? false, invalid: invalid ?? false }), [disabled, invalid]);\n\n let valueProps;\n\n if (onChange !== undefined) {\n const handleChange = (value: string): void => onChange(findByValue(values, value));\n\n valueProps = {\n onValueChange: handleChange,\n value: value !== undefined ? getRadioGroupItemValueAsString(value) : undefined,\n };\n } else {\n valueProps = {\n defaultValue: defaultValue !== undefined ? getRadioGroupItemValueAsString(defaultValue) : undefined,\n };\n }\n\n return {\n context,\n props: {\n ...otherProps,\n ...valueProps,\n children,\n orientation,\n },\n };\n};\n\nexport const RadioGroup = React.forwardRef(function RadioGroup(props: RadioGroupProps, ref: React.Ref<HTMLDivElement>) {\n const { context, props: otherProps } = useRadioGroup(props);\n const className = cn(\n 'flex items-start gap-y-2',\n {\n 'flex-wrap gap-x-4 ': otherProps.orientation === 'horizontal',\n 'flex-col': otherProps.orientation === 'vertical',\n },\n otherProps.className\n );\n\n return (\n <RadioGroupContext.Provider value={context}>\n <RadioGroupPrimitive.Root {...otherProps} className={className} data-taco=\"radio-group\" ref={ref} />\n </RadioGroupContext.Provider>\n );\n}) as ForwardedRadioGroupWithStatics;\nRadioGroup.Item = RadioGroupItem;\n"],"names":["getRadioGroupItemValueAsString","value","String","findByValue","values","valueAsString","find","RadioGroupContext","React","disabled","invalid","RadioGroupItem","props","ref","context","children","otherProps","isDisabled","className","cn","labelClassName","RadioGroupPrimitive","useRadioGroup","defaultValue","onChange","orientation","radioGroupItemValues","forEach","child","push","valueProps","undefined","handleChange","onValueChange","RadioGroup","Provider","Item"],"mappings":";;;;;;;IAOaA,8BAA8B,GAAG,SAAjCA,8BAAiC,CAACC,KAAD;EAAA,OAAwCC,MAAM,CAACD,KAAD,aAACA,KAAD,cAACA,KAAD,GAAU,EAAV,CAA9C;AAAA;IAEjCE,WAAW,GAAG,SAAdA,WAAc,CAACC,MAAD,EAAgCC,aAAhC;EAAA,OACvBD,MAAM,CAACE,IAAP,CAAY,UAAAL,KAAK;IAAA,OAAID,8BAA8B,CAACC,KAAD,CAA9B,KAA0CI,aAA9C;GAAjB,CADuB;AAAA;AAG3B,IAAME,iBAAiB,gBAAGC,aAAA,CAAoB;EAAEC,QAAQ,EAAE,KAAZ;EAAmBC,OAAO,EAAE;AAA5B,CAApB,CAA1B;AAcA,IAAMC,cAAc,gBAAGH,UAAA,CAAiB,SAASG,cAAT,CAAwBC,KAAxB,EAAoDC,GAApD;EACpC,IAAMC,OAAO,GAAGN,UAAA,CAAiBD,iBAAjB,CAAhB;;EACA,IAAQQ,QAAR,GAA2CH,KAA3C,CAAQG,QAAR;MAAkBd,KAAlB,GAA2CW,KAA3C,CAAkBX,KAAlB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AAQA,OAAR;MAAwBE,UAAxB,kBAAiBJ,KAAjB;;EACA,IAAMM,SAAS,GAAGC,EAAE,CAChB,0BADgB,EAEhB;IACI,sBAAsBH,UAAU,CAACS,WAAX,KAA2B,YADrD;IAEI,YAAYT,UAAU,CAACS,WAAX,KAA2B;GAJ3B,EAMhBT,UAAU,CAACE,SANK,CAApB;EASA,OACIV,aAAA,CAACD,iBAAiB,CAAC4B,QAAnB;IAA4BlC,KAAK,EAAEa;GAAnC,EACIN,aAAA,CAACa,IAAD,oBAA8BL;IAAYE,SAAS,EAAEA;iBAAqB;IAAcL,GAAG,EAAEA;IAA7F,CADJ,CADJ;AAKH,CAhByB;AAiB1BqB,UAAU,CAACE,IAAX,GAAkBzB,cAAlB;;;;"}
@@ -14,6 +14,7 @@ import '../Spinner/Spinner.js';
14
14
  import '../Toast/Toaster.js';
15
15
  import { useLocalization } from '../Provider/Provider.js';
16
16
  import '../Calendar/Calendar.js';
17
+ import '../Card/Card.js';
17
18
  import '../Checkbox/Checkbox.js';
18
19
  import { Input } from '../Input/Input.js';
19
20
  import keycode from 'keycode';
@@ -49,7 +50,6 @@ import '../Textarea/Textarea.js';
49
50
  import '../Switch/Switch.js';
50
51
  import '../Tour/Tour.js';
51
52
  import '../../utils/hooks/useOnClickOutside.js';
52
- import '../Card/Card.js';
53
53
 
54
54
  var _excluded = ["onSearch"];
55
55
  var SearchInput = /*#__PURE__*/forwardRef(function SearchInput(_ref, ref) {
@@ -1 +1 @@
1
- {"version":3,"file":"SearchInput.js","sources":["../../../../src/components/SearchInput/SearchInput.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport keycode from 'keycode';\r\nimport { Input, InputProps, useLocalization, IconButton } from '../..';\r\n\r\nexport type SearchInputTexts = {\r\n /**\r\n * aria-label text for input\r\n */\r\n inputLabel: string;\r\n};\r\n\r\nexport type SearchInputProps = Omit<InputProps, 'icon'> & {\r\n /** Current input value will be passed to the method. In order to get the value, the component must be controlled otherwise value will always be undefined */\r\n onSearch?: (value: string | number | readonly string[] | undefined) => void;\r\n};\r\n\r\nexport const SearchInput = React.forwardRef(function SearchInput(\r\n { onSearch, ...props }: SearchInputProps,\r\n ref: React.Ref<HTMLInputElement>\r\n) {\r\n const { texts } = useLocalization();\r\n\r\n const handleClick = (): void => {\r\n if (!props.disabled) {\r\n onSearch?.(props.value);\r\n }\r\n };\r\n\r\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>): void => {\r\n const isEnterKeyPressed = event.keyCode === keycode('enter');\r\n\r\n if (isEnterKeyPressed) {\r\n handleClick();\r\n }\r\n\r\n props.onKeyDown?.(event);\r\n };\r\n\r\n return (\r\n <Input\r\n aria-label={texts.searchInput.inputLabel}\r\n {...props}\r\n button={\r\n <IconButton\r\n icon=\"search\"\r\n className=\"!border-transparent !bg-transparent focus:!border-transparent peer-focus:!border-transparent peer-focus:peer-active:!border-transparent\"\r\n disabled={props.disabled}\r\n onClick={handleClick}\r\n />\r\n }\r\n onKeyDown={handleKeyDown}\r\n ref={ref}\r\n type=\"search\"\r\n />\r\n );\r\n});\r\n"],"names":["SearchInput","React","ref","onSearch","props","useLocalization","texts","handleClick","disabled","value","handleKeyDown","event","isEnterKeyPressed","keyCode","keycode","onKeyDown","Input","searchInput","inputLabel","button","IconButton","icon","className","onClick","type"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAgBaA,WAAW,gBAAGC,UAAA,CAAiB,SAASD,WAAT,OAExCE,GAFwC;MACtCC,gBAAAA;MAAaC;;AAGf,yBAAkBC,eAAe,EAAjC;AAAA,MAAQC,KAAR,oBAAQA,KAAR;;AAEA,MAAMC,WAAW,GAAG,SAAdA,WAAc;AAChB,QAAI,CAACH,KAAK,CAACI,QAAX,EAAqB;AACjBL,MAAAA,QAAQ,SAAR,IAAAA,QAAQ,WAAR,YAAAA,QAAQ,CAAGC,KAAK,CAACK,KAAT,CAAR;AACH;AACJ,GAJD;;AAMA,MAAMC,aAAa,GAAG,SAAhBA,aAAgB,CAACC,KAAD;;;AAClB,QAAMC,iBAAiB,GAAGD,KAAK,CAACE,OAAN,KAAkBC,OAAO,CAAC,OAAD,CAAnD;;AAEA,QAAIF,iBAAJ,EAAuB;AACnBL,MAAAA,WAAW;AACd;;AAED,wBAAAH,KAAK,CAACW,SAAN,2EAAAX,KAAK,EAAaO,KAAb,CAAL;AACH,GARD;;AAUA,SACIV,aAAA,CAACe,KAAD;kBACgBV,KAAK,CAACW,WAAN,CAAkBC;KAC1Bd;AACJe,IAAAA,MAAM,EACFlB,aAAA,CAACmB,UAAD;AACIC,MAAAA,IAAI,EAAC;AACLC,MAAAA,SAAS,EAAC;AACVd,MAAAA,QAAQ,EAAEJ,KAAK,CAACI;AAChBe,MAAAA,OAAO,EAAEhB;KAJb;AAOJQ,IAAAA,SAAS,EAAEL;AACXR,IAAAA,GAAG,EAAEA;AACLsB,IAAAA,IAAI,EAAC;IAbT,CADJ;AAiBH,CAvC0B;;;;"}
1
+ {"version":3,"file":"SearchInput.js","sources":["../../../../src/components/SearchInput/SearchInput.tsx"],"sourcesContent":["import * as React from 'react';\nimport keycode from 'keycode';\nimport { Input, InputProps, useLocalization, IconButton } from '../..';\n\nexport type SearchInputTexts = {\n /**\n * aria-label text for input\n */\n inputLabel: string;\n};\n\nexport type SearchInputProps = Omit<InputProps, 'icon'> & {\n /** Current input value will be passed to the method. In order to get the value, the component must be controlled otherwise value will always be undefined */\n onSearch?: (value: string | number | readonly string[] | undefined) => void;\n};\n\nexport const SearchInput = React.forwardRef(function SearchInput(\n { onSearch, ...props }: SearchInputProps,\n ref: React.Ref<HTMLInputElement>\n) {\n const { texts } = useLocalization();\n\n const handleClick = (): void => {\n if (!props.disabled) {\n onSearch?.(props.value);\n }\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>): void => {\n const isEnterKeyPressed = event.keyCode === keycode('enter');\n\n if (isEnterKeyPressed) {\n handleClick();\n }\n\n props.onKeyDown?.(event);\n };\n\n return (\n <Input\n aria-label={texts.searchInput.inputLabel}\n {...props}\n button={\n <IconButton\n icon=\"search\"\n className=\"!border-transparent !bg-transparent focus:!border-transparent peer-focus:!border-transparent peer-focus:peer-active:!border-transparent\"\n disabled={props.disabled}\n onClick={handleClick}\n />\n }\n onKeyDown={handleKeyDown}\n ref={ref}\n type=\"search\"\n />\n );\n});\n"],"names":["SearchInput","React","ref","onSearch","props","useLocalization","texts","handleClick","disabled","value","handleKeyDown","event","isEnterKeyPressed","keyCode","keycode","onKeyDown","Input","searchInput","inputLabel","button","IconButton","icon","className","onClick","type"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAgBaA,WAAW,gBAAGC,UAAA,CAAiB,SAASD,WAAT,OAExCE,GAFwC;MACtCC,gBAAAA;MAAaC;;EAGf,uBAAkBC,eAAe,EAAjC;MAAQC,KAAR,oBAAQA,KAAR;;EAEA,IAAMC,WAAW,GAAG,SAAdA,WAAc;IAChB,IAAI,CAACH,KAAK,CAACI,QAAX,EAAqB;MACjBL,QAAQ,SAAR,IAAAA,QAAQ,WAAR,YAAAA,QAAQ,CAAGC,KAAK,CAACK,KAAT,CAAR;;GAFR;;EAMA,IAAMC,aAAa,GAAG,SAAhBA,aAAgB,CAACC,KAAD;;;IAClB,IAAMC,iBAAiB,GAAGD,KAAK,CAACE,OAAN,KAAkBC,OAAO,CAAC,OAAD,CAAnD;;IAEA,IAAIF,iBAAJ,EAAuB;MACnBL,WAAW;;;IAGf,oBAAAH,KAAK,CAACW,SAAN,2EAAAX,KAAK,EAAaO,KAAb,CAAL;GAPJ;;EAUA,OACIV,aAAA,CAACe,KAAD;kBACgBV,KAAK,CAACW,WAAN,CAAkBC;KAC1Bd;IACJe,MAAM,EACFlB,aAAA,CAACmB,UAAD;MACIC,IAAI,EAAC;MACLC,SAAS,EAAC;MACVd,QAAQ,EAAEJ,KAAK,CAACI;MAChBe,OAAO,EAAEhB;KAJb;IAOJQ,SAAS,EAAEL;IACXR,GAAG,EAAEA;IACLsB,IAAI,EAAC;IAbT,CADJ;AAiBH,CAvC0B;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Select.js","sources":["../../../../src/components/Select/Select.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport cn from 'classnames';\r\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\r\nimport { Icon } from '../Icon/Icon';\r\nimport { Listbox, MultiListbox, ListboxProps } from '../Listbox/Listbox';\r\nimport { useBoundingClientRectListener } from '../../utils/hooks/useBoundingClientRectListener';\r\nimport { useSelect } from './useSelect';\r\nimport { Combobox, ComboboxProps } from '../Combobox/Combobox';\r\nimport { Badge } from '../Badge/Badge';\r\nimport { getInputClasses } from '../Input/util';\r\n\r\nexport type SelectTexts = {\r\n /**\r\n * The text displayed when all options are selected when multiselect mode in on.\r\n */\r\n allOptionsSelected: string;\r\n};\r\n\r\nexport type BaseSelectProps = Omit<ListboxProps, 'dialog'> &\r\n Omit<ComboboxProps, 'inline'> & {\r\n /**\r\n * Allows to select multiple values.\r\n * All the selected values will be combined in a comma-seperated string as the value of the input.\r\n */\r\n multiselect?: boolean;\r\n };\r\n\r\nexport type SelectProps = BaseSelectProps & {\r\n /**\r\n * Creates an editable select.\r\n * Setting this will render a inline Combobox which will display the provided data on click/focus,\r\n * even if there is no value in the input.\r\n * After user starts typing, matching data will be displayed.\r\n */\r\n editable?: boolean;\r\n};\r\n\r\nconst BaseSelect = React.forwardRef(function BaseSelect(props: BaseSelectProps, ref: React.Ref<HTMLInputElement>) {\r\n const { autoFocus, className: externalClassName, highlighted, style, ...otherProps } = props;\r\n const { button, listbox, popover, input, text, more = 0 } = useSelect(otherProps, ref);\r\n const internalRef = React.useRef<HTMLButtonElement>(null);\r\n const selectDimensions = useBoundingClientRectListener(internalRef);\r\n const className = cn('inline-flex relative w-full', { 'yt-select--readonly': props.readOnly }, externalClassName);\r\n const inputClassname = cn(getInputClasses(props), 'h-8 text-left pr-0', {\r\n 'border-blue': popover.open,\r\n });\r\n\r\n React.useEffect(() => {\r\n if (autoFocus && internalRef.current) {\r\n internalRef.current.focus();\r\n }\r\n }, []);\r\n\r\n const renderMultiSelection = (): React.ReactNode => {\r\n return (\r\n <>\r\n <span className=\"flex-grow truncate text-left\">{text}</span>\r\n {more > 0 && <Badge className=\"ml-2\">{`+${more}`}</Badge>}\r\n </>\r\n );\r\n };\r\n\r\n const commonListboxProps: ListboxProps = {\r\n ...listbox,\r\n className: 'w-auto',\r\n invalid: undefined,\r\n style: { minWidth: selectDimensions?.width },\r\n tabIndex: popover.open ? 0 : -1,\r\n };\r\n\r\n return (\r\n <span className={className} data-taco=\"select\" style={style}>\r\n <PopoverPrimitive.Root {...popover}>\r\n <PopoverPrimitive.Trigger {...button} className={inputClassname} ref={internalRef}>\r\n {props.multiselect ? renderMultiSelection() : <span className=\"flex-grow truncate text-left\">{text}</span>}\r\n <span className=\"flex h-8 w-8 items-center justify-center\">\r\n <Icon className=\"pointer-events-none\" name={popover.open ? 'chevron-up' : 'chevron-down'} />\r\n </span>\r\n </PopoverPrimitive.Trigger>\r\n <PopoverPrimitive.Content align=\"start\" sideOffset={4}>\r\n {props.multiselect ? <MultiListbox {...commonListboxProps} /> : <Listbox {...commonListboxProps} />}\r\n </PopoverPrimitive.Content>\r\n <input {...input} className=\"hidden\" type=\"text\" />\r\n </PopoverPrimitive.Root>\r\n </span>\r\n );\r\n});\r\n\r\nexport const Select = React.forwardRef(function Select(props: SelectProps, ref: React.Ref<HTMLInputElement>) {\r\n const { editable, ...otherProps } = props;\r\n\r\n if (editable) {\r\n return <Combobox {...otherProps} dialog={undefined} inline ref={ref} />;\r\n }\r\n\r\n return <BaseSelect {...otherProps} ref={ref} />;\r\n});\r\n"],"names":["BaseSelect","React","props","ref","autoFocus","externalClassName","className","style","otherProps","useSelect","button","listbox","popover","input","text","more","internalRef","selectDimensions","useBoundingClientRectListener","cn","readOnly","inputClassname","getInputClasses","open","current","focus","renderMultiSelection","Badge","commonListboxProps","invalid","undefined","minWidth","width","tabIndex","PopoverPrimitive","multiselect","Icon","name","align","sideOffset","MultiListbox","Listbox","type","Select","editable","Combobox","dialog","inline"],"mappings":";;;;;;;;;;;;;;AAqCA,IAAMA,UAAU,gBAAGC,UAAA,CAAiB,SAASD,UAAT,CAAoBE,KAApB,EAA4CC,GAA5C;AAChC,MAAQC,SAAR,GAAuFF,KAAvF,CAAQE,SAAR;AAAA,MAA8BC,iBAA9B,GAAuFH,KAAvF,CAAmBI,SAAnB;AAAA,MAA8DC,KAA9D,GAAuFL,KAAvF,CAA8DK,KAA9D;AAAA,MAAwEC,UAAxE,iCAAuFN,KAAvF;;AACA,mBAA4DO,SAAS,CAACD,UAAD,EAAaL,GAAb,CAArE;AAAA,MAAQO,MAAR,cAAQA,MAAR;AAAA,MAAgBC,OAAhB,cAAgBA,OAAhB;AAAA,MAAyBC,OAAzB,cAAyBA,OAAzB;AAAA,MAAkCC,KAAlC,cAAkCA,KAAlC;AAAA,MAAyCC,IAAzC,cAAyCA,IAAzC;AAAA,mCAA+CC,IAA/C;AAAA,MAA+CA,IAA/C,gCAAsD,CAAtD;;AACA,MAAMC,WAAW,GAAGf,MAAA,CAAgC,IAAhC,CAApB;AACA,MAAMgB,gBAAgB,GAAGC,6BAA6B,CAACF,WAAD,CAAtD;AACA,MAAMV,SAAS,GAAGa,EAAE,CAAC,6BAAD,EAAgC;AAAE,2BAAuBjB,KAAK,CAACkB;AAA/B,GAAhC,EAA2Ef,iBAA3E,CAApB;AACA,MAAMgB,cAAc,GAAGF,EAAE,CAACG,eAAe,CAACpB,KAAD,CAAhB,EAAyB,oBAAzB,EAA+C;AACpE,mBAAeU,OAAO,CAACW;AAD6C,GAA/C,CAAzB;AAIAtB,EAAAA,SAAA,CAAgB;AACZ,QAAIG,SAAS,IAAIY,WAAW,CAACQ,OAA7B,EAAsC;AAClCR,MAAAA,WAAW,CAACQ,OAAZ,CAAoBC,KAApB;AACH;AACJ,GAJD,EA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AAAA,UAAU,EAAE;GAApD,EACKrC,KAAK,CAACiC,WAAN,GAAoBlC,aAAA,CAACuC,YAAD,oBAAkBZ,mBAAlB,CAApB,GAA+D3B,aAAA,CAACwC,OAAD,oBAAab,mBAAb,CADpE,CAPJ,EAUI3B,aAAA,QAAA,oBAAWY;AAAOP,IAAAA,SAAS,EAAC;AAASoC,IAAAA,IAAI,EAAC;IAA1C,CAVJ,CADJ,CADJ;AAgBH,CAjDkB,CAAnB;IAmDaC,MAAM,gBAAG1C,UAAA,CAAiB,SAAS0C,MAAT,CAAgBzC,KAAhB,EAAoCC,GAApC;AACnC,MAAQyC,QAAR,GAAoC1C,KAApC,CAAQ0C,QAAR;AAAA,MAAqBpC,UAArB,iCAAoCN,KAApC;;AAEA,MAAI0C,QAAJ,EAAc;AACV,WAAO3C,aAAA,CAAC4C,QAAD,oBAAcrC;AAAYsC,MAAAA,MAAM,EAAEhB;AAAWiB,MAAAA,MAAM;AAAC5C,MAAAA,GAAG,EAAEA;MAAzD,CAAP;AACH;;AAED,SAAOF,aAAA,CAACD,UAAD,oBAAgBQ;AAAYL,IAAAA,GAAG,EAAEA;IAAjC,CAAP;AACH,CARqB;;;;"}
1
+ {"version":3,"file":"Select.js","sources":["../../../../src/components/Select/Select.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport { Icon } from '../Icon/Icon';\nimport { Listbox, MultiListbox, ListboxProps } from '../Listbox/Listbox';\nimport { useBoundingClientRectListener } from '../../utils/hooks/useBoundingClientRectListener';\nimport { useSelect } from './useSelect';\nimport { Combobox, ComboboxProps } from '../Combobox/Combobox';\nimport { Badge } from '../Badge/Badge';\nimport { getInputClasses } from '../Input/util';\n\nexport type SelectTexts = {\n /**\n * The text displayed when all options are selected when multiselect mode in on.\n */\n allOptionsSelected: string;\n};\n\nexport type BaseSelectProps = Omit<ListboxProps, 'dialog'> &\n Omit<ComboboxProps, 'inline'> & {\n /**\n * Allows to select multiple values.\n * All the selected values will be combined in a comma-seperated string as the value of the input.\n */\n multiselect?: boolean;\n };\n\nexport type SelectProps = BaseSelectProps & {\n /**\n * Creates an editable select.\n * Setting this will render a inline Combobox which will display the provided data on click/focus,\n * even if there is no value in the input.\n * After user starts typing, matching data will be displayed.\n */\n editable?: boolean;\n};\n\nconst BaseSelect = React.forwardRef(function BaseSelect(props: BaseSelectProps, ref: React.Ref<HTMLInputElement>) {\n const { autoFocus, className: externalClassName, highlighted, style, ...otherProps } = props;\n const { button, listbox, popover, input, text, more = 0 } = useSelect(otherProps, ref);\n const internalRef = React.useRef<HTMLButtonElement>(null);\n const selectDimensions = useBoundingClientRectListener(internalRef);\n const className = cn('inline-flex relative w-full', { 'yt-select--readonly': props.readOnly }, externalClassName);\n const inputClassname = cn(getInputClasses(props), 'h-8 text-left pr-0', {\n 'border-blue': popover.open,\n });\n\n React.useEffect(() => {\n if (autoFocus && internalRef.current) {\n internalRef.current.focus();\n }\n }, []);\n\n const renderMultiSelection = (): React.ReactNode => {\n return (\n <>\n <span className=\"flex-grow truncate text-left\">{text}</span>\n {more > 0 && <Badge className=\"ml-2\">{`+${more}`}</Badge>}\n </>\n );\n };\n\n const commonListboxProps: ListboxProps = {\n ...listbox,\n className: 'w-auto',\n invalid: undefined,\n style: { minWidth: selectDimensions?.width },\n tabIndex: popover.open ? 0 : -1,\n };\n\n return (\n <span className={className} data-taco=\"select\" style={style}>\n <PopoverPrimitive.Root {...popover}>\n <PopoverPrimitive.Trigger {...button} className={inputClassname} ref={internalRef}>\n {props.multiselect ? renderMultiSelection() : <span className=\"flex-grow truncate text-left\">{text}</span>}\n <span className=\"flex h-8 w-8 items-center justify-center\">\n <Icon className=\"pointer-events-none\" name={popover.open ? 'chevron-up' : 'chevron-down'} />\n </span>\n </PopoverPrimitive.Trigger>\n <PopoverPrimitive.Content align=\"start\" sideOffset={4}>\n {props.multiselect ? <MultiListbox {...commonListboxProps} /> : <Listbox {...commonListboxProps} />}\n </PopoverPrimitive.Content>\n <input {...input} className=\"hidden\" type=\"text\" />\n </PopoverPrimitive.Root>\n </span>\n );\n});\n\nexport const Select = React.forwardRef(function Select(props: SelectProps, ref: React.Ref<HTMLInputElement>) {\n const { editable, ...otherProps } = props;\n\n if (editable) {\n return <Combobox {...otherProps} dialog={undefined} inline ref={ref} />;\n }\n\n return <BaseSelect {...otherProps} ref={ref} />;\n});\n"],"names":["BaseSelect","React","props","ref","autoFocus","externalClassName","className","style","otherProps","useSelect","button","listbox","popover","input","text","more","internalRef","selectDimensions","useBoundingClientRectListener","cn","readOnly","inputClassname","getInputClasses","open","current","focus","renderMultiSelection","Badge","commonListboxProps","invalid","undefined","minWidth","width","tabIndex","PopoverPrimitive","multiselect","Icon","name","align","sideOffset","MultiListbox","Listbox","type","Select","editable","Combobox","dialog","inline"],"mappings":";;;;;;;;;;;;;;AAqCA,IAAMA,UAAU,gBAAGC,UAAA,CAAiB,SAASD,UAAT,CAAoBE,KAApB,EAA4CC,GAA5C;MACxBC,SAAR,GAAuFF,KAAvF,CAAQE,SAAR;MAA8BC,iBAA9B,GAAuFH,KAAvF,CAAmBI,SAAnB;MAA8DC,KAA9D,GAAuFL,KAAvF,CAA8DK,KAA9D;MAAwEC,UAAxE,iCAAuFN,KAAvF;;EACA,iBAA4DO,SAAS,CAACD,UAAD,EAAaL,GAAb,CAArE;MAAQO,MAAR,cAAQA,MAAR;MAAgBC,OAAhB,cAAgBA,OAAhB;MAAyBC,OAAzB,cAAyBA,OAAzB;MAAkCC,KAAlC,cAAkCA,KAAlC;MAAyCC,IAAzC,cAAyCA,IAAzC;mCAA+CC,IAA/C;MAA+CA,IAA/C,gCAAsD,CAAtD;;EACA,IAAMC,WAAW,GAAGf,MAAA,CAAgC,IAAhC,CAApB;EACA,IAAMgB,gBAAgB,GAAGC,6BAA6B,CAACF,WAAD,CAAtD;EACA,IAAMV,SAAS,GAAGa,EAAE,CAAC,6BAAD,EAAgC;IAAE,uBAAuBjB,KAAK,CAACkB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S,EAAC;IAAsB+B,IAAI,EAAEzB,OAAO,CAACW,IAAR,GAAe,YAAf,GAA8B;GAA1E,CADJ,CAFJ,CADJ,EAOItB,aAAA,CAACiC,OAAD;IAA0BI,KAAK,EAAC;IAAQC,UAAU,EAAE;GAApD,EACKrC,KAAK,CAACiC,WAAN,GAAoBlC,aAAA,CAACuC,YAAD,oBAAkBZ,mBAAlB,CAApB,GAA+D3B,aAAA,CAACwC,OAAD,oBAAab,mBAAb,CADpE,CAPJ,EAUI3B,aAAA,QAAA,oBAAWY;IAAOP,SAAS,EAAC;IAASoC,IAAI,EAAC;IAA1C,CAVJ,CADJ,CADJ;AAgBH,CAjDkB,CAAnB;IAmDaC,MAAM,gBAAG1C,UAAA,CAAiB,SAAS0C,MAAT,CAAgBzC,KAAhB,EAAoCC,GAApC;EACnC,IAAQyC,QAAR,GAAoC1C,KAApC,CAAQ0C,QAAR;MAAqBpC,UAArB,iCAAoCN,KAApC;;EAEA,IAAI0C,QAAJ,EAAc;IACV,OAAO3C,aAAA,CAAC4C,QAAD,oBAAcrC;MAAYsC,MAAM,EAAEhB;MAAWiB,MAAM;MAAC5C,GAAG,EAAEA;MAAzD,CAAP;;;EAGJ,OAAOF,aAAA,CAACD,UAAD,oBAAgBQ;IAAYL,GAAG,EAAEA;IAAjC,CAAP;AACH,CARqB;;;;"}
@@ -1,3 +1,4 @@
1
+ import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
1
2
  import { useState, useMemo, useRef, useEffect, createElement, Fragment, cloneElement } from 'react';
2
3
  import cn from 'classnames';
3
4
  import { v4 } from 'uuid';
@@ -7,37 +8,47 @@ import keycode from 'keycode';
7
8
  import { createCustomEvent } from '../../utils/input.js';
8
9
  import { useFlattenedData, findByValue, setInputValueByRef, sanitizeItem } from '../Listbox/util.js';
9
10
 
10
- const useSelect = ({
11
- 'aria-label': ariaLabel,
12
- 'aria-labelledby': ariaLabelledBy,
13
- data = [],
14
- defaultValue,
15
- disabled,
16
- emptyValue,
17
- id: nativeId,
18
- multiselect,
19
- onBlur,
20
- onClick,
21
- onChange,
22
- readOnly,
23
- value,
24
- ...otherProps
25
- }, ref) => {
26
- const {
27
- texts
28
- } = useLocalization();
29
- const flattenedData = useFlattenedData(data);
30
- const listboxInputRef = useProxiedRef(ref);
31
- const [open, setOpen] = useState(false);
32
- const id = useMemo(() => nativeId || `select_${v4()}`, [nativeId]);
33
- const inputRef = useRef(null);
34
- const buttonId = `${id}-button`; // support 'escape' resetting to the value that was set when the listbox opened
35
-
36
- const [lastValue, setLastValue] = useState(value);
37
- useEffect(() => {
11
+ var _excluded = ["aria-label", "aria-labelledby", "data", "defaultValue", "disabled", "emptyValue", "id", "multiselect", "onBlur", "onClick", "onChange", "readOnly", "value"];
12
+ var useSelect = function useSelect(_ref, ref) {
13
+ var ariaLabel = _ref['aria-label'],
14
+ ariaLabelledBy = _ref['aria-labelledby'],
15
+ _ref$data = _ref.data,
16
+ data = _ref$data === void 0 ? [] : _ref$data,
17
+ defaultValue = _ref.defaultValue,
18
+ disabled = _ref.disabled,
19
+ emptyValue = _ref.emptyValue,
20
+ nativeId = _ref.id,
21
+ multiselect = _ref.multiselect,
22
+ onBlur = _ref.onBlur,
23
+ onChange = _ref.onChange,
24
+ readOnly = _ref.readOnly,
25
+ value = _ref.value,
26
+ otherProps = _objectWithoutPropertiesLoose(_ref, _excluded);
27
+
28
+ var _useLocalization = useLocalization(),
29
+ texts = _useLocalization.texts;
30
+
31
+ var flattenedData = useFlattenedData(data);
32
+ var listboxInputRef = useProxiedRef(ref);
33
+
34
+ var _React$useState = useState(false),
35
+ open = _React$useState[0],
36
+ setOpen = _React$useState[1];
37
+
38
+ var id = useMemo(function () {
39
+ return nativeId || "select_" + v4();
40
+ }, [nativeId]);
41
+ var inputRef = useRef(null);
42
+ var buttonId = id + "-button"; // support 'escape' resetting to the value that was set when the listbox opened
43
+
44
+ var _React$useState2 = useState(value),
45
+ lastValue = _React$useState2[0],
46
+ setLastValue = _React$useState2[1];
47
+
48
+ useEffect(function () {
38
49
  setLastValue(value);
39
50
  }, [open]);
40
- useEffect(() => {
51
+ useEffect(function () {
41
52
  if (value === undefined) {
42
53
  if (defaultValue !== undefined && findByValue(flattenedData, defaultValue)) {
43
54
  setInputValueByRef(inputRef.current, defaultValue);
@@ -59,14 +70,14 @@ const useSelect = ({
59
70
  }
60
71
  }, []); // event handlers
61
72
 
62
- const handleButtonKeyDown = event => {
73
+ var handleButtonKeyDown = function handleButtonKeyDown(event) {
63
74
  if (event.keyCode === keycode('up') || event.keyCode === keycode('down')) {
64
75
  event.preventDefault();
65
76
  setOpen(true);
66
77
  }
67
78
  };
68
79
 
69
- const handleListboxKeyDown = event => {
80
+ var handleListboxKeyDown = function handleListboxKeyDown(event) {
70
81
  switch (event.keyCode) {
71
82
  case keycode('escape'):
72
83
  {
@@ -97,7 +108,7 @@ const useSelect = ({
97
108
  }
98
109
  };
99
110
 
100
- const handleListboxClick = event => {
111
+ var handleListboxClick = function handleListboxClick(event) {
101
112
  event.preventDefault();
102
113
 
103
114
  if (!multiselect) {
@@ -109,14 +120,16 @@ const useSelect = ({
109
120
  }
110
121
  };
111
122
 
112
- let text = '';
113
- let more = 0;
123
+ var text = '';
124
+ var more = 0;
114
125
 
115
126
  if (value !== undefined) {
116
127
  if (multiselect) {
117
- const selectedValues = (value === null || value === void 0 ? void 0 : value.toString().split(',')) || [];
128
+ var selectedValues = (value === null || value === void 0 ? void 0 : value.toString().split(',')) || [];
118
129
 
119
- if (selectedValues.length === flattenedData.filter(item => !item.disabled).length) {
130
+ if (selectedValues.length === flattenedData.filter(function (item) {
131
+ return !item.disabled;
132
+ }).length) {
120
133
  text = texts.select.allOptionsSelected;
121
134
  } else {
122
135
  var _findByValue$text, _findByValue;
@@ -125,7 +138,7 @@ const useSelect = ({
125
138
  more = selectedValues.length > 1 ? selectedValues.length - 1 : 0;
126
139
  }
127
140
  } else {
128
- const item = findByValue(flattenedData, value);
141
+ var item = findByValue(flattenedData, value);
129
142
 
130
143
  if (item) {
131
144
  text = item.icon ? createElement(Fragment, null, cloneElement(item.icon, {
@@ -135,24 +148,27 @@ const useSelect = ({
135
148
  }
136
149
  }
137
150
 
138
- const handleInputChange = event => {
151
+ var handleInputChange = function handleInputChange(event) {
139
152
  event.persist();
140
153
 
141
154
  if (onChange) {
142
155
  var _item$path$split, _item$path;
143
156
 
144
- const item = findByValue(flattenedData, event.target.value);
145
- event.detail = sanitizeItem(item);
146
- const indexes = (_item$path$split = item === null || item === void 0 ? void 0 : (_item$path = item.path) === null || _item$path === void 0 ? void 0 : _item$path.split('.')) !== null && _item$path$split !== void 0 ? _item$path$split : [];
157
+ var _item = findByValue(flattenedData, event.target.value);
158
+
159
+ event.detail = sanitizeItem(_item);
160
+ var indexes = (_item$path$split = _item === null || _item === void 0 ? void 0 : (_item$path = _item.path) === null || _item$path === void 0 ? void 0 : _item$path.split('.')) !== null && _item$path$split !== void 0 ? _item$path$split : [];
147
161
 
148
162
  if (indexes.length > 1) {
149
163
  // we don't want to map the current item
150
164
  indexes.pop(); // we need to rebuild the path as we map
151
165
 
152
- let lastPath;
153
- event.detail.parents = indexes.map(i => {
166
+ var lastPath;
167
+ event.detail.parents = indexes.map(function (i) {
154
168
  lastPath = lastPath ? [lastPath, i].join('.') : i;
155
- return sanitizeItem(flattenedData.find(i => i.path === lastPath));
169
+ return sanitizeItem(flattenedData.find(function (i) {
170
+ return i.path === lastPath;
171
+ }));
156
172
  });
157
173
  }
158
174
 
@@ -160,42 +176,44 @@ const useSelect = ({
160
176
  }
161
177
  };
162
178
 
163
- const button = {
179
+ var button = {
164
180
  'aria-haspopup': 'listbox',
165
- 'aria-label': ariaLabel ? `${ariaLabel} ${text}` : undefined,
166
- 'aria-labelledby': ariaLabelledBy ? `${ariaLabelledBy} ${buttonId}` : undefined,
181
+ 'aria-label': ariaLabel ? ariaLabel + " " + text : undefined,
182
+ 'aria-labelledby': ariaLabelledBy ? ariaLabelledBy + " " + buttonId : undefined,
167
183
  disabled: disabled || readOnly,
168
184
  id: buttonId,
169
185
  onKeyDown: !disabled && !readOnly ? handleButtonKeyDown : undefined,
170
186
  type: 'button'
171
187
  };
172
- const listbox = { ...otherProps,
188
+
189
+ var listbox = _extends({}, otherProps, {
173
190
  'aria-label': ariaLabel,
174
191
  'aria-labelledby': ariaLabelledBy,
175
- data,
176
- disabled,
177
- emptyValue,
178
- onBlur,
192
+ data: data,
193
+ disabled: disabled,
194
+ emptyValue: emptyValue,
195
+ onBlur: onBlur,
179
196
  onClick: handleListboxClick,
180
- onChange: event => {
197
+ onChange: function onChange(event) {
181
198
  setInputValueByRef(inputRef.current, event.target.value);
182
199
  },
183
200
  onKeyDown: handleListboxKeyDown,
184
201
  ref: listboxInputRef,
185
- value
186
- };
187
- const input = {
202
+ value: value
203
+ });
204
+
205
+ var input = {
188
206
  onChange: handleInputChange,
189
207
  ref: inputRef,
190
208
  value: String(value !== null && value !== void 0 ? value : '')
191
209
  };
192
210
  return {
193
- button,
194
- listbox,
195
- input,
211
+ button: button,
212
+ listbox: listbox,
213
+ input: input,
196
214
  popover: {
197
- open,
198
- onOpenChange: open => {
215
+ open: open,
216
+ onOpenChange: function onOpenChange(open) {
199
217
  if (!open && onBlur) {
200
218
  onBlur(createCustomEvent('blur'));
201
219
  }
@@ -203,8 +221,8 @@ const useSelect = ({
203
221
  setOpen(open);
204
222
  }
205
223
  },
206
- text,
207
- more
224
+ text: text,
225
+ more: more
208
226
  };
209
227
  };
210
228
 
@@ -1 +1 @@
1
- {"version":3,"file":"useSelect.js","sources":["../../../../src/components/Select/useSelect.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport keycode from 'keycode';\r\nimport cn from 'classnames';\r\nimport { v4 as uuid } from 'uuid';\r\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\r\nimport { useLocalization } from '../Provider/Provider';\r\nimport { SelectProps } from './Select';\r\nimport { ListboxProps } from '../Listbox/Listbox';\r\nimport { useProxiedRef } from '../../utils/hooks/useProxiedRef';\r\nimport { setInputValueByRef, findByValue, useFlattenedData, sanitizeItem } from '../Listbox/util';\r\nimport { ScrollableListItemValue } from '../Listbox/ScrollableList';\r\nimport { createCustomEvent } from '../../utils/input';\r\n\r\ntype InternalButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement>;\r\ntype InternalListboxProps = ListboxProps & { ref: React.ForwardedRef<HTMLInputElement> };\r\ntype InternalInputProps = React.InputHTMLAttributes<HTMLInputElement> & { ref: React.ForwardedRef<HTMLInputElement> };\r\n\r\ntype useSelect = React.HtmlHTMLAttributes<HTMLDivElement> & {\r\n button: InternalButtonProps;\r\n listbox: InternalListboxProps;\r\n input: InternalInputProps;\r\n popover: Pick<PopoverPrimitive.PopoverProps, 'onOpenChange' | 'open'>;\r\n text: string | JSX.Element;\r\n more?: number;\r\n};\r\n\r\nexport const useSelect = (\r\n {\r\n 'aria-label': ariaLabel,\r\n 'aria-labelledby': ariaLabelledBy,\r\n data = [],\r\n defaultValue,\r\n disabled,\r\n emptyValue,\r\n id: nativeId,\r\n multiselect,\r\n onBlur,\r\n onClick,\r\n onChange,\r\n readOnly,\r\n value,\r\n ...otherProps\r\n }: SelectProps,\r\n ref: React.Ref<HTMLInputElement>\r\n): useSelect => {\r\n const { texts } = useLocalization();\r\n const flattenedData = useFlattenedData(data);\r\n const listboxInputRef = useProxiedRef<HTMLInputElement>(ref);\r\n const [open, setOpen] = React.useState(false);\r\n const id = React.useMemo(() => nativeId || `select_${uuid()}`, [nativeId]);\r\n const inputRef = React.useRef<HTMLInputElement>(null);\r\n const buttonId = `${id}-button`;\r\n // support 'escape' resetting to the value that was set when the listbox opened\r\n const [lastValue, setLastValue] = React.useState<ScrollableListItemValue | undefined>(value);\r\n\r\n React.useEffect(() => {\r\n setLastValue(value);\r\n }, [open]);\r\n\r\n React.useEffect(() => {\r\n if (value === undefined) {\r\n if (defaultValue !== undefined && findByValue(flattenedData, defaultValue)) {\r\n setInputValueByRef(inputRef.current, defaultValue);\r\n } else {\r\n if (emptyValue !== undefined) {\r\n setInputValueByRef(inputRef.current, emptyValue);\r\n } else if (data.length > 0) {\r\n setInputValueByRef(inputRef.current, data[0].value);\r\n }\r\n }\r\n } else {\r\n if (!multiselect && !findByValue(flattenedData, value)) {\r\n if (emptyValue !== undefined) {\r\n setInputValueByRef(inputRef.current, emptyValue);\r\n } else if (data.length > 0) {\r\n setInputValueByRef(inputRef.current, data[0].value);\r\n }\r\n }\r\n }\r\n }, []);\r\n\r\n // event handlers\r\n const handleButtonKeyDown = (event: React.KeyboardEvent<HTMLButtonElement>): void => {\r\n if (event.keyCode === keycode('up') || event.keyCode === keycode('down')) {\r\n event.preventDefault();\r\n setOpen(true);\r\n }\r\n };\r\n\r\n const handleListboxKeyDown = (event: React.KeyboardEvent<HTMLElement>): void => {\r\n switch (event.keyCode) {\r\n case keycode('escape'): {\r\n event.preventDefault();\r\n if (lastValue !== undefined) {\r\n setInputValueByRef(listboxInputRef.current, lastValue);\r\n }\r\n\r\n setOpen(false);\r\n break;\r\n }\r\n\r\n case keycode('tab'):\r\n case keycode('enter'): {\r\n if (event.keyCode !== keycode('tab')) {\r\n event.preventDefault();\r\n }\r\n setOpen(false);\r\n break;\r\n }\r\n\r\n default:\r\n }\r\n\r\n if (otherProps.onKeyDown) {\r\n otherProps.onKeyDown(event);\r\n }\r\n };\r\n\r\n const handleListboxClick = (event: React.MouseEvent<HTMLLIElement>): void => {\r\n event.preventDefault();\r\n if (!multiselect) {\r\n setOpen(false);\r\n if (onBlur) {\r\n onBlur(createCustomEvent('blur'));\r\n }\r\n }\r\n };\r\n\r\n let text: string | JSX.Element = '';\r\n let more = 0;\r\n\r\n if (value !== undefined) {\r\n if (multiselect) {\r\n const selectedValues = value?.toString().split(',') || [];\r\n\r\n if (selectedValues.length === flattenedData.filter(item => !item.disabled).length) {\r\n text = texts.select.allOptionsSelected;\r\n } else {\r\n text = findByValue(flattenedData, selectedValues[0])?.text ?? '';\r\n more = selectedValues.length > 1 ? selectedValues.length - 1 : 0;\r\n }\r\n } else {\r\n const item = findByValue(flattenedData, value);\r\n\r\n if (item) {\r\n text = item.icon ? (\r\n <>\r\n {React.cloneElement(item.icon, {\r\n className: cn(item.icon.props.className, 'mr-1 -mt-px'),\r\n })}\r\n {item.text}\r\n </>\r\n ) : (\r\n item.text\r\n );\r\n }\r\n }\r\n }\r\n\r\n const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>): void => {\r\n event.persist();\r\n\r\n if (onChange) {\r\n const item = findByValue(flattenedData, event.target.value);\r\n (event as any).detail = sanitizeItem(item);\r\n\r\n const indexes = item?.path?.split('.') ?? [];\r\n\r\n if (indexes.length > 1) {\r\n // we don't want to map the current item\r\n indexes.pop();\r\n // we need to rebuild the path as we map\r\n let lastPath: string;\r\n\r\n (event as any).detail.parents = indexes.map(i => {\r\n lastPath = lastPath ? [lastPath, i].join('.') : i;\r\n return sanitizeItem(flattenedData.find(i => i.path === lastPath));\r\n });\r\n }\r\n\r\n onChange(event);\r\n }\r\n };\r\n\r\n const button: InternalButtonProps = {\r\n 'aria-haspopup': 'listbox' as const,\r\n 'aria-label': ariaLabel ? `${ariaLabel} ${text}` : undefined,\r\n 'aria-labelledby': ariaLabelledBy ? `${ariaLabelledBy} ${buttonId}` : undefined,\r\n disabled: disabled || readOnly,\r\n id: buttonId,\r\n onKeyDown: !disabled && !readOnly ? handleButtonKeyDown : undefined,\r\n type: 'button',\r\n };\r\n\r\n const listbox: InternalListboxProps = {\r\n ...otherProps,\r\n 'aria-label': ariaLabel,\r\n 'aria-labelledby': ariaLabelledBy,\r\n data,\r\n disabled,\r\n emptyValue,\r\n onBlur,\r\n onClick: handleListboxClick,\r\n onChange: event => {\r\n setInputValueByRef(inputRef.current, event.target.value);\r\n },\r\n onKeyDown: handleListboxKeyDown,\r\n ref: listboxInputRef,\r\n value,\r\n };\r\n\r\n const input: InternalInputProps = {\r\n onChange: handleInputChange,\r\n ref: inputRef,\r\n value: String(value ?? ''),\r\n };\r\n\r\n return {\r\n button,\r\n listbox,\r\n input,\r\n popover: {\r\n open,\r\n onOpenChange: open => {\r\n if (!open && onBlur) {\r\n onBlur(createCustomEvent('blur'));\r\n }\r\n setOpen(open);\r\n },\r\n },\r\n text,\r\n more,\r\n };\r\n};\r\n"],"names":["useSelect","ariaLabel","ariaLabelledBy","data","defaultValue","disabled","emptyValue","id","nativeId","multiselect","onBlur","onClick","onChange","readOnly","value","otherProps","ref","texts","useLocalization","flattenedData","useFlattenedData","listboxInputRef","useProxiedRef","open","setOpen","React","uuid","inputRef","buttonId","lastValue","setLastValue","undefined","findByValue","setInputValueByRef","current","length","handleButtonKeyDown","event","keyCode","keycode","preventDefault","handleListboxKeyDown","onKeyDown","handleListboxClick","createCustomEvent","text","more","selectedValues","toString","split","filter","item","select","allOptionsSelected","icon","className","cn","props","handleInputChange","persist","target","detail","sanitizeItem","indexes","path","pop","lastPath","parents","map","i","join","find","button","type","listbox","input","String","popover","onOpenChange"],"mappings":";;;;;;;;;MA0BaA,SAAS,GAAG,CACrB;AACI,gBAAcC,SADlB;AAEI,qBAAmBC,cAFvB;AAGIC,EAAAA,IAAI,GAAG,EAHX;AAIIC,EAAAA,YAJJ;AAKIC,EAAAA,QALJ;AAMIC,EAAAA,UANJ;AAOIC,EAAAA,EAAE,EAAEC,QAPR;AAQIC,EAAAA,WARJ;AASIC,EAAAA,MATJ;AAUIC,EAAAA,OAVJ;AAWIC,EAAAA,QAXJ;AAYIC,EAAAA,QAZJ;AAaIC,EAAAA,KAbJ;AAcI,KAAGC;AAdP,CADqB,EAiBrBC,GAjBqB;AAmBrB,QAAM;AAAEC,IAAAA;AAAF,MAAYC,eAAe,EAAjC;AACA,QAAMC,aAAa,GAAGC,gBAAgB,CAACjB,IAAD,CAAtC;AACA,QAAMkB,eAAe,GAAGC,aAAa,CAAmBN,GAAnB,CAArC;AACA,QAAM,CAACO,IAAD,EAAOC,OAAP,IAAkBC,QAAA,CAAe,KAAf,CAAxB;AACA,QA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AD,IAAa,CAACQ,QAAd,GAAyBuB,mBAAzB,GAA+CL,SAN1B;AAOhC0C,IAAAA,IAAI,EAAE;AAP0B,GAApC;AAUA,QAAMC,OAAO,GAAyB,EAClC,GAAG3D,UAD+B;AAElC,kBAAcd,SAFoB;AAGlC,uBAAmBC,cAHe;AAIlCC,IAAAA,IAJkC;AAKlCE,IAAAA,QALkC;AAMlCC,IAAAA,UANkC;AAOlCI,IAAAA,MAPkC;AAQlCC,IAAAA,OAAO,EAAEgC,kBARyB;AASlC/B,IAAAA,QAAQ,EAAEyB,KAAK;AACXJ,MAAAA,kBAAkB,CAACN,QAAQ,CAACO,OAAV,EAAmBG,KAAK,CAACuB,MAAN,CAAa9C,KAAhC,CAAlB;AACH,KAXiC;AAYlC4B,IAAAA,SAAS,EAAED,oBAZuB;AAalCzB,IAAAA,GAAG,EAAEK,eAb6B;AAclCP,IAAAA;AAdkC,GAAtC;AAiBA,QAAM6D,KAAK,GAAuB;AAC9B/D,IAAAA,QAAQ,EAAE8C,iBADoB;AAE9B1C,IAAAA,GAAG,EAAEW,QAFyB;AAG9Bb,IAAAA,KAAK,EAAE8D,MAAM,CAAC9D,KAAD,aAACA,KAAD,cAACA,KAAD,GAAU,EAAV;AAHiB,GAAlC;AAMA,SAAO;AACH0D,IAAAA,MADG;AAEHE,IAAAA,OAFG;AAGHC,IAAAA,KAHG;AAIHE,IAAAA,OAAO,EAAE;AACLtD,MAAAA,IADK;AAELuD,MAAAA,YAAY,EAAEvD,IAAI;AACd,YAAI,CAACA,IAAD,IAASb,MAAb,EAAqB;AACjBA,UAAAA,MAAM,CAACkC,iBAAiB,CAAC,MAAD,CAAlB,CAAN;AACH;;AACDpB,QAAAA,OAAO,CAACD,IAAD,CAAP;AACH;AAPI,KAJN;AAaHsB,IAAAA,IAbG;AAcHC,IAAAA;AAdG,GAAP;AAgBH;;;;"}
1
+ {"version":3,"file":"useSelect.js","sources":["../../../../src/components/Select/useSelect.tsx"],"sourcesContent":["import * as React from 'react';\nimport keycode from 'keycode';\nimport cn from 'classnames';\nimport { v4 as uuid } from 'uuid';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport { useLocalization } from '../Provider/Provider';\nimport { SelectProps } from './Select';\nimport { ListboxProps } from '../Listbox/Listbox';\nimport { useProxiedRef } from '../../utils/hooks/useProxiedRef';\nimport { setInputValueByRef, findByValue, useFlattenedData, sanitizeItem } from '../Listbox/util';\nimport { ScrollableListItemValue } from '../Listbox/ScrollableList';\nimport { createCustomEvent } from '../../utils/input';\n\ntype InternalButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement>;\ntype InternalListboxProps = ListboxProps & { ref: React.ForwardedRef<HTMLInputElement> };\ntype InternalInputProps = React.InputHTMLAttributes<HTMLInputElement> & { ref: React.ForwardedRef<HTMLInputElement> };\n\ntype useSelect = React.HtmlHTMLAttributes<HTMLDivElement> & {\n button: InternalButtonProps;\n listbox: InternalListboxProps;\n input: InternalInputProps;\n popover: Pick<PopoverPrimitive.PopoverProps, 'onOpenChange' | 'open'>;\n text: string | JSX.Element;\n more?: number;\n};\n\nexport const useSelect = (\n {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n data = [],\n defaultValue,\n disabled,\n emptyValue,\n id: nativeId,\n multiselect,\n onBlur,\n onClick,\n onChange,\n readOnly,\n value,\n ...otherProps\n }: SelectProps,\n ref: React.Ref<HTMLInputElement>\n): useSelect => {\n const { texts } = useLocalization();\n const flattenedData = useFlattenedData(data);\n const listboxInputRef = useProxiedRef<HTMLInputElement>(ref);\n const [open, setOpen] = React.useState(false);\n const id = React.useMemo(() => nativeId || `select_${uuid()}`, [nativeId]);\n const inputRef = React.useRef<HTMLInputElement>(null);\n const buttonId = `${id}-button`;\n // support 'escape' resetting to the value that was set when the listbox opened\n const [lastValue, setLastValue] = React.useState<ScrollableListItemValue | undefined>(value);\n\n React.useEffect(() => {\n setLastValue(value);\n }, [open]);\n\n React.useEffect(() => {\n if (value === undefined) {\n if (defaultValue !== undefined && findByValue(flattenedData, defaultValue)) {\n setInputValueByRef(inputRef.current, defaultValue);\n } else {\n if (emptyValue !== undefined) {\n setInputValueByRef(inputRef.current, emptyValue);\n } else if (data.length > 0) {\n setInputValueByRef(inputRef.current, data[0].value);\n }\n }\n } else {\n if (!multiselect && !findByValue(flattenedData, value)) {\n if (emptyValue !== undefined) {\n setInputValueByRef(inputRef.current, emptyValue);\n } else if (data.length > 0) {\n setInputValueByRef(inputRef.current, data[0].value);\n }\n }\n }\n }, []);\n\n // event handlers\n const handleButtonKeyDown = (event: React.KeyboardEvent<HTMLButtonElement>): void => {\n if (event.keyCode === keycode('up') || event.keyCode === keycode('down')) {\n event.preventDefault();\n setOpen(true);\n }\n };\n\n const handleListboxKeyDown = (event: React.KeyboardEvent<HTMLElement>): void => {\n switch (event.keyCode) {\n case keycode('escape'): {\n event.preventDefault();\n if (lastValue !== undefined) {\n setInputValueByRef(listboxInputRef.current, lastValue);\n }\n\n setOpen(false);\n break;\n }\n\n case keycode('tab'):\n case keycode('enter'): {\n if (event.keyCode !== keycode('tab')) {\n event.preventDefault();\n }\n setOpen(false);\n break;\n }\n\n default:\n }\n\n if (otherProps.onKeyDown) {\n otherProps.onKeyDown(event);\n }\n };\n\n const handleListboxClick = (event: React.MouseEvent<HTMLLIElement>): void => {\n event.preventDefault();\n if (!multiselect) {\n setOpen(false);\n if (onBlur) {\n onBlur(createCustomEvent('blur'));\n }\n }\n };\n\n let text: string | JSX.Element = '';\n let more = 0;\n\n if (value !== undefined) {\n if (multiselect) {\n const selectedValues = value?.toString().split(',') || [];\n\n if (selectedValues.length === flattenedData.filter(item => !item.disabled).length) {\n text = texts.select.allOptionsSelected;\n } else {\n text = findByValue(flattenedData, selectedValues[0])?.text ?? '';\n more = selectedValues.length > 1 ? selectedValues.length - 1 : 0;\n }\n } else {\n const item = findByValue(flattenedData, value);\n\n if (item) {\n text = item.icon ? (\n <>\n {React.cloneElement(item.icon, {\n className: cn(item.icon.props.className, 'mr-1 -mt-px'),\n })}\n {item.text}\n </>\n ) : (\n item.text\n );\n }\n }\n }\n\n const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>): void => {\n event.persist();\n\n if (onChange) {\n const item = findByValue(flattenedData, event.target.value);\n (event as any).detail = sanitizeItem(item);\n\n const indexes = item?.path?.split('.') ?? [];\n\n if (indexes.length > 1) {\n // we don't want to map the current item\n indexes.pop();\n // we need to rebuild the path as we map\n let lastPath: string;\n\n (event as any).detail.parents = indexes.map(i => {\n lastPath = lastPath ? [lastPath, i].join('.') : i;\n return sanitizeItem(flattenedData.find(i => i.path === lastPath));\n });\n }\n\n onChange(event);\n }\n };\n\n const button: InternalButtonProps = {\n 'aria-haspopup': 'listbox' as const,\n 'aria-label': ariaLabel ? `${ariaLabel} ${text}` : undefined,\n 'aria-labelledby': ariaLabelledBy ? `${ariaLabelledBy} ${buttonId}` : undefined,\n disabled: disabled || readOnly,\n id: buttonId,\n onKeyDown: !disabled && !readOnly ? handleButtonKeyDown : undefined,\n type: 'button',\n };\n\n const listbox: InternalListboxProps = {\n ...otherProps,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n data,\n disabled,\n emptyValue,\n onBlur,\n onClick: handleListboxClick,\n onChange: event => {\n setInputValueByRef(inputRef.current, event.target.value);\n },\n onKeyDown: handleListboxKeyDown,\n ref: listboxInputRef,\n value,\n };\n\n const input: InternalInputProps = {\n onChange: handleInputChange,\n ref: inputRef,\n value: String(value ?? ''),\n };\n\n return {\n button,\n listbox,\n input,\n popover: {\n open,\n onOpenChange: open => {\n if (!open && onBlur) {\n onBlur(createCustomEvent('blur'));\n }\n setOpen(open);\n },\n },\n text,\n more,\n };\n};\n"],"names":["useSelect","ref","ariaLabel","ariaLabelledBy","data","defaultValue","disabled","emptyValue","nativeId","id","multiselect","onBlur","onChange","readOnly","value","otherProps","useLocalization","texts","flattenedData","useFlattenedData","listboxInputRef","useProxiedRef","React","open","setOpen","uuid","inputRef","buttonId","lastValue","setLastValue","undefined","findByValue","setInputValueByRef","current","length","handleButtonKeyDown","event","keyCode","keycode","preventDefault","handleListboxKeyDown","onKeyDown","handleListboxClick","createCustomEvent","text","more","selectedValues","toString","split","filter","item","select","allOptionsSelected","icon","className","cn","props","handleInputChange","persist","target","detail","sanitizeItem","indexes","path","pop","lastPath","parents","map","i","join","find","button","type","listbox","onClick","input","String","popover","onOpenChange"],"mappings":";;;;;;;;;;;IA0BaA,SAAS,GAAG,SAAZA,SAAY,OAiBrBC,GAjBqB;MAEHC,iBAAd;MACmBC,sBAAnB;uBACAC;MAAAA,8BAAO;MACPC,oBAAAA;MACAC,gBAAAA;MACAC,kBAAAA;MACIC,gBAAJC;MACAC,mBAAAA;MACAC,cAAAA;MAEAC,gBAAAA;MACAC,gBAAAA;MACAC,aAAAA;MACGC;;EAIP,uBAAkBC,eAAe,EAAjC;MAAQC,KAAR,oBAAQA,KAAR;;EACA,IAAMC,aAAa,GAAGC,gBAAgB,CAACf,IAAD,CAAtC;EACA,IAAMgB,eAAe,GAAGC,aAAa,CAAmBpB,GAAnB,CAArC;;EACA,sBAAwBqB,QAAA,CAAe,KAAf,CAAxB;MAAOC,IAAP;MAAaC,OAAb;;EACA,IAAMf,EAAE,GAAGa,OAAA,CAAc;IAAA,OAAMd,QAAQ,gBAAciB,EAAI,EAAhC;GAAd,EAAoD,CAACjB,QAAD,CAApD,CAAX;EACA,IAAMkB,QAAQ,GAAGJ,MAAA,CAA+B,IAA/B,CAAjB;EACA,IAAMK,QAAQ,GAAMlB,EAAN,YAAd;;EAEA,uBAAkCa,QAAA,CAAoDR,KAApD,CAAlC;MAAOc,SAAP;MAAkBC,YAAlB;;EAEAP,SAAA,CAAgB;IACZO,YAAY,CAACf,KAAD,CAAZ;GADJ,EAEG,CAACS,IAAD,CAFH;EAIAD,SAAA,CAAgB;IACZ,IAAIR,KAAK,KAAKgB,SAAd,EAAyB;MACrB,IAAIzB,YAAY,KAAKyB,SAAjB,IAA8BC,WAAW,CAACb,aAAD,EA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HE,OAAO,EAAPA,OAFG;IAGHE,KAAK,EAALA,KAHG;IAIHE,OAAO,EAAE;MACLtD,IAAI,EAAJA,IADK;MAELuD,YAAY,EAAE,sBAAAvD,IAAI;QACd,IAAI,CAACA,IAAD,IAASZ,MAAb,EAAqB;UACjBA,MAAM,CAACgC,iBAAiB,CAAC,MAAD,CAAlB,CAAN;;;QAEJnB,OAAO,CAACD,IAAD,CAAP;;KAVL;IAaHqB,IAAI,EAAJA,IAbG;IAcHC,IAAI,EAAJA;GAdJ;AAgBH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Spinner.js","sources":["../../../../src/components/Spinner/Spinner.tsx"],"sourcesContent":["import React from 'react';\r\nimport cn from 'classnames';\r\nimport './Spinner.css';\r\n\r\nexport type SpinnerProps = React.HTMLAttributes<HTMLDivElement> & {\r\n /**\r\n * Define a delay in milliseconds after which the spinner is shown.\r\n * Default value is `500`ms\r\n */\r\n delay?: number;\r\n /** Define a text that will be displayed below spinner */\r\n label?: string;\r\n};\r\n\r\nexport const Spinner = React.forwardRef(function Spinner(props: SpinnerProps, ref: React.Ref<HTMLDivElement>) {\r\n const { delay = 500, label, ...otherProps } = props;\r\n const [visible, setVisibility] = React.useState(!delay);\r\n\r\n React.useEffect(() => {\r\n let timeout: number;\r\n\r\n if (delay) {\r\n timeout = window.setTimeout(() => setVisibility(true), delay);\r\n }\r\n\r\n return () => {\r\n if (timeout) {\r\n clearTimeout(timeout);\r\n }\r\n };\r\n }, [delay]);\r\n\r\n if (!visible) {\r\n return null;\r\n }\r\n\r\n const className = cn('inline-flex flex-col relative items-center', otherProps.className);\r\n\r\n return (\r\n <div {...otherProps} className={className} data-taco=\"spinner\" ref={ref}>\r\n <svg\r\n className=\"h-10 w-10 animate-[spinnerRotation_2s_linear_infinite]\"\r\n viewBox=\"0 0 100 100\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n >\r\n <circle cx=\"50\" cy=\"50\" r=\"45\"></circle>\r\n </svg>\r\n {label && <span className=\"mt-4\">{label}</span>}\r\n </div>\r\n );\r\n});\r\n"],"names":["Spinner","React","forwardRef","props","ref","delay","label","otherProps","useState","visible","setVisibility","useEffect","timeout","window","setTimeout","clearTimeout","className","cn","viewBox","xmlns","cx","cy","r"],"mappings":";;;;;IAcaA,OAAO,gBAAGC,cAAK,CAACC,UAAN,CAAiB,SAASF,OAAT,CAAiBG,KAAjB,EAAsCC,GAAtC;AACpC,qBAA8CD,KAA9C,CAAQE,KAAR;AAAA,MAAQA,KAAR,6BAAgB,GAAhB;AAAA,MAAqBC,KAArB,GAA8CH,KAA9C,CAAqBG,KAArB;AAAA,MAA+BC,UAA/B,iCAA8CJ,KAA9C;;AACA,wBAAiCF,cAAK,CAACO,QAAN,CAAe,CAACH,KAAhB,CAAjC;AAAA,MAAOI,OAAP;AAAA,MAAgBC,aAAhB;;AAEAT,EAAAA,cAAK,CAACU,SAAN,CAAgB;AACZ,QAAIC,OAAJ;;AAEA,QAAIP,KAAJ,EAAW;AACPO,MAAAA,OAAO,GAAGC,MAAM,CAACC,UAAP,CAAkB;AAAA,eAAMJ,aAAa,CAAC,IAAD,CAAnB;AAAA,OAAlB,EAA6CL,KAA7C,CAAV;AACH;;AAED,WAAO;AACH,UAAIO,OAAJ,EAAa;AACTG,QAAAA,YAAY,CAACH,OAAD,CAAZ;AACH;AACJ,KAJD;AAKH,GAZD,EAYG,CAACP,KAAD,CAZH;;AAcA,MAAI,CAACI,OAAL,EAAc;AACV,WAAO,IAAP;AACH;;AAED,MAAMO,SAAS,GAAGC,EAAE,CAAC,4CAAD,EAA+CV,UAAU,CAACS,SAA1D,CAApB;AAEA,SACIf,4BAAA,MAAA,oBAASM;AAAYS,IAAAA,SAAS,EAAEA;iBAAqB;AAAUZ,IAAAA,GAAG,EAAEA;IAApE,EACIH,4BAAA,MAAA;AACIe,IAAAA,SAAS,EAAC;AACVE,IAAAA,OAAO,EAAC;AACRC,IAAAA,KAAK,EAAC;GAHV,EAKIlB,4BAAA,SAAA;AAAQmB,IAAAA,EAAE,EAAC;AAAKC,IAAAA,EAAE,EAAC;AAAKC,IAAAA,CAAC,EAAC;GAA1B,CALJ,CADJ,EAQKhB,KAAK,IAAIL,4BAAA,OAAA;AAAMe,IAAAA,SAAS,EAAC;GAAhB,EAAwBV,KAAxB,CARd,CADJ;AAYH,CApCsB;;;;"}
1
+ {"version":3,"file":"Spinner.js","sources":["../../../../src/components/Spinner/Spinner.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport './Spinner.css';\n\nexport type SpinnerProps = React.HTMLAttributes<HTMLDivElement> & {\n /**\n * Define a delay in milliseconds after which the spinner is shown.\n * Default value is `500`ms\n */\n delay?: number;\n /** Define a text that will be displayed below spinner */\n label?: string;\n};\n\nexport const Spinner = React.forwardRef(function Spinner(props: SpinnerProps, ref: React.Ref<HTMLDivElement>) {\n const { delay = 500, label, ...otherProps } = props;\n const [visible, setVisibility] = React.useState(!delay);\n\n React.useEffect(() => {\n let timeout: number;\n\n if (delay) {\n timeout = window.setTimeout(() => setVisibility(true), delay);\n }\n\n return () => {\n if (timeout) {\n clearTimeout(timeout);\n }\n };\n }, [delay]);\n\n if (!visible) {\n return null;\n }\n\n const className = cn('inline-flex flex-col relative items-center', otherProps.className);\n\n return (\n <div {...otherProps} className={className} data-taco=\"spinner\" ref={ref}>\n <svg\n className=\"h-10 w-10 animate-[spinnerRotation_2s_linear_infinite]\"\n viewBox=\"0 0 100 100\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <circle cx=\"50\" cy=\"50\" r=\"45\"></circle>\n </svg>\n {label && <span className=\"mt-4\">{label}</span>}\n </div>\n );\n});\n"],"names":["Spinner","React","forwardRef","props","ref","delay","label","otherProps","useState","visible","setVisibility","useEffect","timeout","window","setTimeout","clearTimeout","className","cn","viewBox","xmlns","cx","cy","r"],"mappings":";;;;;IAcaA,OAAO,gBAAGC,cAAK,CAACC,UAAN,CAAiB,SAASF,OAAT,CAAiBG,KAAjB,EAAsCC,GAAtC;EACpC,mBAA8CD,KAA9C,CAAQE,KAAR;MAAQA,KAAR,6BAAgB,GAAhB;MAAqBC,KAArB,GAA8CH,KAA9C,CAAqBG,KAArB;MAA+BC,UAA/B,iCAA8CJ,KAA9C;;EACA,sBAAiCF,cAAK,CAACO,QAAN,CAAe,CAACH,KAAhB,CAAjC;MAAOI,OAAP;MAAgBC,aAAhB;;EAEAT,cAAK,CAACU,SAAN,CAAgB;IACZ,IAAIC,OAAJ;;IAEA,IAAIP,KAAJ,EAAW;MACPO,OAAO,GAAGC,MAAM,CAACC,UAAP,CAAkB;QAAA,OAAMJ,aAAa,CAAC,IAAD,CAAnB;OAAlB,EAA6CL,KAA7C,CAAV;;;IAGJ,OAAO;MACH,IAAIO,OAAJ,EAAa;QACTG,YAAY,CAACH,OAAD,CAAZ;;KAFR;GAPJ,EAYG,CAACP,KAAD,CAZH;;EAcA,IAAI,CAACI,OAAL,EAAc;IACV,OAAO,IAAP;;;EAGJ,IAAMO,SAAS,GAAGC,EAAE,CAAC,4CAAD,EAA+CV,UAAU,CAACS,SAA1D,CAApB;EAEA,OACIf,4BAAA,MAAA,oBAASM;IAAYS,SAAS,EAAEA;iBAAqB;IAAUZ,GAAG,EAAEA;IAApE,EACIH,4BAAA,MAAA;IACIe,SAAS,EAAC;IACVE,OAAO,EAAC;IACRC,KAAK,EAAC;GAHV,EAKIlB,4BAAA,SAAA;IAAQmB,EAAE,EAAC;IAAKC,EAAE,EAAC;IAAKC,CAAC,EAAC;GAA1B,CALJ,CADJ,EAQKhB,KAAK,IAAIL,4BAAA,OAAA;IAAMe,SAAS,EAAC;GAAhB,EAAwBV,KAAxB,CARd,CADJ;AAYH,CApCsB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Switch.js","sources":["../../../../src/components/Switch/Switch.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport cn from 'classnames';\r\nimport * as PrimitiveSwitch from '@radix-ui/react-switch';\r\n\r\ntype SwitchBaseProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'onChange'> & {\r\n /** Label for the switch */\r\n label?: React.ReactNode;\r\n /* Whether user input is required */\r\n required?: boolean;\r\n};\r\n\r\ninterface UncontrolledSwitchProps extends SwitchBaseProps {\r\n checked?: never;\r\n onChange?: never;\r\n /* The default checked state (uncontrolled) */\r\n defaultChecked?: boolean;\r\n}\r\n\r\ninterface ControlledSwitchProps extends SwitchBaseProps {\r\n defaultChecked?: never;\r\n /* The current checked state (controlled) */\r\n checked: boolean;\r\n /* Handler called when the checked state changes */\r\n onChange: (checked: boolean) => void;\r\n}\r\n\r\nexport type SwitchProps = UncontrolledSwitchProps | ControlledSwitchProps;\r\n\r\nexport const Switch = React.forwardRef(function Switch(props: SwitchProps, ref: React.Ref<HTMLButtonElement>) {\r\n const { label, onChange, ...otherProps } = props;\r\n\r\n const className = cn(\r\n 'group h-5 w-9 flex rounded-full inline-flex',\r\n {\r\n 'mr-2': !!label,\r\n 'bg-grey-darker hover:bg-grey-dark aria-checked:bg-blue aria-checked:hover:bg-blue-light focus:yt-focus':\r\n !props.disabled,\r\n 'bg-grey-light cursor-not-allowed aria-checked:bg-blue-light': props.disabled,\r\n },\r\n props.className\r\n );\r\n\r\n const element = (\r\n <PrimitiveSwitch.Root {...otherProps} className={className} onCheckedChange={onChange} ref={ref}>\r\n <PrimitiveSwitch.Thumb className=\"'will-change-transform group-aria-checked:translate-x-[1.1rem] mt-0.5 h-4 w-4 translate-x-[0.15rem] rounded-full bg-white transition-transform group-disabled:opacity-50\" />\r\n </PrimitiveSwitch.Root>\r\n );\r\n\r\n if (label) {\r\n const labelClassName = cn('flex items-center cursor-pointer', {\r\n 'cursor-not-allowed text-grey-dark': props.disabled,\r\n });\r\n\r\n return (\r\n <label className={labelClassName}>\r\n {element}\r\n {label}\r\n </label>\r\n );\r\n }\r\n\r\n return element;\r\n});\r\n"],"names":["Switch","React","props","ref","label","onChange","otherProps","className","cn","disabled","element","PrimitiveSwitch","onCheckedChange","labelClassName"],"mappings":";;;;;;IA4BaA,MAAM,gBAAGC,UAAA,CAAiB,SAASD,MAAT,CAAgBE,KAAhB,EAAoCC,GAApC;AACnC,MAAQC,KAAR,GAA2CF,KAA3C,CAAQE,KAAR;AAAA,MAAeC,QAAf,GAA2CH,KAA3C,CAAeG,QAAf;AAAA,MAA4BC,UAA5B,iCAA2CJ,KAA3C;;AAEA,MAAMK,SAAS,GAAGC,EAAE,CAChB,6CADgB,EAEhB;AACI,YAAQ,CAAC,CAACJ,KADd;AAEI,8GACI,CAACF,KAAK,CAACO,QAHf;AAII,mEAA+DP,KAAK,CAACO;AAJzE,GAFgB,EAQhBP,KAAK,CAACK,SARU,CAApB;AAWA,MAAMG,OAAO,GACTT,aAAA,CAACU,IAAD,oBAA0BL;AAAYC,IAAAA,SAAS,EAAEA;AAAWK,IAAAA,eAAe,EAAEP;AAAUF,IAAAA,GAAG,EAAEA;IAA5F,EACIF,aAAA,CAACU,KAAD;AAAuBJ,IAAAA,SAAS,EAAC;GAAjC,CADJ,CADJ;;AAMA,MAAIH,KAAJ,EAAW;AACP,QAAMS,cAAc,GAAGL,EAAE,CAAC,kCAAD,EAAqC;AAC1D,2CAAqCN,KAAK,CAACO;AADe,KAArC,CAAzB;AAIA,WACIR,aAAA,QAAA;AAAOM,MAAAA,SAAS,EAAEM;KAAlB,EACKH,OADL,EAEKN,KAFL,CADJ;AAMH;;AAED,SAAOM,OAAP;AACH,CAlCqB;;;;"}
1
+ {"version":3,"file":"Switch.js","sources":["../../../../src/components/Switch/Switch.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as PrimitiveSwitch from '@radix-ui/react-switch';\n\ntype SwitchBaseProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'onChange'> & {\n /** Label for the switch */\n label?: React.ReactNode;\n /* Whether user input is required */\n required?: boolean;\n};\n\ninterface UncontrolledSwitchProps extends SwitchBaseProps {\n checked?: never;\n onChange?: never;\n /* The default checked state (uncontrolled) */\n defaultChecked?: boolean;\n}\n\ninterface ControlledSwitchProps extends SwitchBaseProps {\n defaultChecked?: never;\n /* The current checked state (controlled) */\n checked: boolean;\n /* Handler called when the checked state changes */\n onChange: (checked: boolean) => void;\n}\n\nexport type SwitchProps = UncontrolledSwitchProps | ControlledSwitchProps;\n\nexport const Switch = React.forwardRef(function Switch(props: SwitchProps, ref: React.Ref<HTMLButtonElement>) {\n const { label, onChange, ...otherProps } = props;\n\n const className = cn(\n 'group h-5 w-9 flex rounded-full inline-flex',\n {\n 'mr-2': !!label,\n 'bg-grey-darker hover:bg-grey-dark aria-checked:bg-blue aria-checked:hover:bg-blue-light focus:yt-focus':\n !props.disabled,\n 'bg-grey-light cursor-not-allowed aria-checked:bg-blue-light': props.disabled,\n },\n props.className\n );\n\n const element = (\n <PrimitiveSwitch.Root {...otherProps} className={className} onCheckedChange={onChange} ref={ref}>\n <PrimitiveSwitch.Thumb className=\"'will-change-transform group-aria-checked:translate-x-[1.1rem] mt-0.5 h-4 w-4 translate-x-[0.15rem] rounded-full bg-white transition-transform group-disabled:opacity-50\" />\n </PrimitiveSwitch.Root>\n );\n\n if (label) {\n const labelClassName = cn('flex items-center cursor-pointer', {\n 'cursor-not-allowed text-grey-dark': props.disabled,\n });\n\n return (\n <label className={labelClassName}>\n {element}\n {label}\n </label>\n );\n }\n\n return element;\n});\n"],"names":["Switch","React","props","ref","label","onChange","otherProps","className","cn","disabled","element","PrimitiveSwitch","onCheckedChange","labelClassName"],"mappings":";;;;;;IA4BaA,MAAM,gBAAGC,UAAA,CAAiB,SAASD,MAAT,CAAgBE,KAAhB,EAAoCC,GAApC;EACnC,IAAQC,KAAR,GAA2CF,KAA3C,CAAQE,KAAR;MAAeC,QAAf,GAA2CH,KAA3C,CAAeG,QAAf;MAA4BC,UAA5B,iCAA2CJ,KAA3C;;EAEA,IAAMK,SAAS,GAAGC,EAAE,CAChB,6CADgB,EAEhB;IACI,QAAQ,CAAC,CAACJ,KADd;IAEI,0GACI,CAACF,KAAK,CAACO,QAHf;IAII,+DAA+DP,KAAK,CAACO;GANzD,EAQhBP,KAAK,CAACK,SARU,CAApB;EAWA,IAAMG,OAAO,GACTT,aAAA,CAACU,IAAD,oBAA0BL;IAAYC,SAAS,EAAEA;IAAWK,eAAe,EAAEP;IAAUF,GAAG,EAAEA;IAA5F,EACIF,aAAA,CAACU,KAAD;IAAuBJ,SAAS,EAAC;GAAjC,CADJ,CADJ;;EAMA,IAAIH,KAAJ,EAAW;IACP,IAAMS,cAAc,GAAGL,EAAE,CAAC,kCAAD,EAAqC;MAC1D,qCAAqCN,KAAK,CAACO;KADtB,CAAzB;IAIA,OACIR,aAAA,QAAA;MAAOM,SAAS,EAAEM;KAAlB,EACKH,OADL,EAEKN,KAFL,CADJ;;;EAQJ,OAAOM,OAAP;AACH,CAlCqB;;;;"}