@economic/taco 1.1.5-alpha.0 → 1.1.5-alpha.108

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 (352) hide show
  1. package/dist/components/Icon/components/LogOut.d.ts +3 -0
  2. package/dist/components/Icon/components/Menu.d.ts +3 -0
  3. package/dist/components/Icon/components/Numbers.d.ts +3 -0
  4. package/dist/components/Icon/components/Profile.d.ts +3 -0
  5. package/dist/components/Icon/components/index.d.ts +1 -1
  6. package/dist/components/Input/Input.d.ts +1 -1
  7. package/dist/components/Menu/Menu.d.ts +2 -2
  8. package/dist/components/Menu/components/Item.d.ts +1 -1
  9. package/dist/components/Menu/components/Link.d.ts +1 -1
  10. package/dist/components/Tour/Tour.d.ts +2 -0
  11. package/dist/esm/components/Accordion/Accordion.js.map +1 -1
  12. package/dist/esm/components/Backdrop/Backdrop.js.map +1 -1
  13. package/dist/esm/components/Badge/Badge.js.map +1 -1
  14. package/dist/esm/components/Banner/Banner.js.map +1 -1
  15. package/dist/esm/components/Banner/util.js.map +1 -1
  16. package/dist/esm/components/Button/Button.js.map +1 -1
  17. package/dist/esm/components/Button/util.js.map +1 -1
  18. package/dist/esm/components/Calendar/Calendar.js.map +1 -1
  19. package/dist/esm/components/Card/Card.js +3 -0
  20. package/dist/esm/components/Card/Card.js.map +1 -1
  21. package/dist/esm/components/Checkbox/Checkbox.js.map +1 -1
  22. package/dist/esm/components/Combobox/Combobox.js +1 -0
  23. package/dist/esm/components/Combobox/Combobox.js.map +1 -1
  24. package/dist/esm/components/Combobox/useCombobox.js.map +1 -1
  25. package/dist/esm/components/Datepicker/Datepicker.js.map +1 -1
  26. package/dist/esm/components/Datepicker/useDatepicker.js.map +1 -1
  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.map +1 -1
  30. package/dist/esm/components/Dialog/components/Drawer.js.map +1 -1
  31. package/dist/esm/components/Dialog/components/Extra.js.map +1 -1
  32. package/dist/esm/components/Dialog/components/Trigger.js +1 -1
  33. package/dist/esm/components/Dialog/components/Trigger.js.map +1 -1
  34. package/dist/esm/components/Field/Field.js.map +1 -1
  35. package/dist/esm/components/Form/Form.js.map +1 -1
  36. package/dist/esm/components/Group/Group.js.map +1 -1
  37. package/dist/esm/components/Hanger/Hanger.js +1 -1
  38. package/dist/esm/components/Hanger/Hanger.js.map +1 -1
  39. package/dist/esm/components/HoverCard/HoverCard.js.map +1 -1
  40. package/dist/esm/components/Icon/Icon.js +7 -8
  41. package/dist/esm/components/Icon/Icon.js.map +1 -1
  42. package/dist/esm/components/Icon/components/AccountPreview.js.map +1 -1
  43. package/dist/esm/components/Icon/components/Accounting.js.map +1 -1
  44. package/dist/esm/components/Icon/components/AccountingYear.js.map +1 -1
  45. package/dist/esm/components/Icon/components/AccountingYearCancel.js.map +1 -1
  46. package/dist/esm/components/Icon/components/ArrowBottom.js.map +1 -1
  47. package/dist/esm/components/Icon/components/ArrowDown.js.map +1 -1
  48. package/dist/esm/components/Icon/components/ArrowEnd.js.map +1 -1
  49. package/dist/esm/components/Icon/components/ArrowLeft.js.map +1 -1
  50. package/dist/esm/components/Icon/components/ArrowRight.js.map +1 -1
  51. package/dist/esm/components/Icon/components/ArrowStart.js.map +1 -1
  52. package/dist/esm/components/Icon/components/ArrowTop.js.map +1 -1
  53. package/dist/esm/components/Icon/components/ArrowUp.js.map +1 -1
  54. package/dist/esm/components/Icon/components/Attach.js.map +1 -1
  55. package/dist/esm/components/Icon/components/AttachAuto.js.map +1 -1
  56. package/dist/esm/components/Icon/components/AttachCancel.js.map +1 -1
  57. package/dist/esm/components/Icon/components/Autotext.js.map +1 -1
  58. package/dist/esm/components/Icon/components/AutotextInsert.js.map +1 -1
  59. package/dist/esm/components/Icon/components/Basic.js.map +1 -1
  60. package/dist/esm/components/Icon/components/BasicTabs.js.map +1 -1
  61. package/dist/esm/components/Icon/components/BellSolid.js.map +1 -1
  62. package/dist/esm/components/Icon/components/Book.js.map +1 -1
  63. package/dist/esm/components/Icon/components/Booking.js.map +1 -1
  64. package/dist/esm/components/Icon/components/Budget.js.map +1 -1
  65. package/dist/esm/components/Icon/components/Calendar.js.map +1 -1
  66. package/dist/esm/components/Icon/components/CashAccount.js.map +1 -1
  67. package/dist/esm/components/Icon/components/CashReports.js.map +1 -1
  68. package/dist/esm/components/Icon/components/Chat.js.map +1 -1
  69. package/dist/esm/components/Icon/components/ChatSolid.js.map +1 -1
  70. package/dist/esm/components/Icon/components/ChevronDown.js.map +1 -1
  71. package/dist/esm/components/Icon/components/ChevronDownDouble.js.map +1 -1
  72. package/dist/esm/components/Icon/components/ChevronDownSolid.js.map +1 -1
  73. package/dist/esm/components/Icon/components/ChevronLeft.js.map +1 -1
  74. package/dist/esm/components/Icon/components/ChevronLeftDouble.js.map +1 -1
  75. package/dist/esm/components/Icon/components/ChevronRight.js.map +1 -1
  76. package/dist/esm/components/Icon/components/ChevronRightDouble.js.map +1 -1
  77. package/dist/esm/components/Icon/components/ChevronUp.js.map +1 -1
  78. package/dist/esm/components/Icon/components/ChevronUpDouble.js.map +1 -1
  79. package/dist/esm/components/Icon/components/ChevronUpSolid.js.map +1 -1
  80. package/dist/esm/components/Icon/components/CircleClose.js.map +1 -1
  81. package/dist/esm/components/Icon/components/CircleMinus.js.map +1 -1
  82. package/dist/esm/components/Icon/components/CirclePlus.js.map +1 -1
  83. package/dist/esm/components/Icon/components/CircleTick.js.map +1 -1
  84. package/dist/esm/components/Icon/components/Clamp.js.map +1 -1
  85. package/dist/esm/components/Icon/components/ClampOpen.js.map +1 -1
  86. package/dist/esm/components/Icon/components/Close.js.map +1 -1
  87. package/dist/esm/components/Icon/components/ConnectionEnable.js.map +1 -1
  88. package/dist/esm/components/Icon/components/ConnectionRevoke.js.map +1 -1
  89. package/dist/esm/components/Icon/components/Contacts.js.map +1 -1
  90. package/dist/esm/components/Icon/components/Copy.js.map +1 -1
  91. package/dist/esm/components/Icon/components/Courses.js.map +1 -1
  92. package/dist/esm/components/Icon/components/Credit.js.map +1 -1
  93. package/dist/esm/components/Icon/components/Delete.js.map +1 -1
  94. package/dist/esm/components/Icon/components/DeletePermanently.js.map +1 -1
  95. package/dist/esm/components/Icon/components/Depecriate.js.map +1 -1
  96. package/dist/esm/components/Icon/components/Developer.js.map +1 -1
  97. package/dist/esm/components/Icon/components/DistributionTemplate.js.map +1 -1
  98. package/dist/esm/components/Icon/components/Document.js.map +1 -1
  99. package/dist/esm/components/Icon/components/DocumentApprove.js.map +1 -1
  100. package/dist/esm/components/Icon/components/DocumentCreateEntry.js.map +1 -1
  101. package/dist/esm/components/Icon/components/DocumentCut.js.map +1 -1
  102. package/dist/esm/components/Icon/components/DocumentError.js.map +1 -1
  103. package/dist/esm/components/Icon/components/DocumentIsolatePage.js.map +1 -1
  104. package/dist/esm/components/Icon/components/DocumentMerge.js.map +1 -1
  105. package/dist/esm/components/Icon/components/DocumentMove.js.map +1 -1
  106. package/dist/esm/components/Icon/components/DocumentPreview.js.map +1 -1
  107. package/dist/esm/components/Icon/components/DocumentReceived.js.map +1 -1
  108. package/dist/esm/components/Icon/components/DocumentRejectedRequest.js.map +1 -1
  109. package/dist/esm/components/Icon/components/DocumentSplit.js.map +1 -1
  110. package/dist/esm/components/Icon/components/DocumentTime.js.map +1 -1
  111. package/dist/esm/components/Icon/components/Download.js.map +1 -1
  112. package/dist/esm/components/Icon/components/Drag.js.map +1 -1
  113. package/dist/esm/components/Icon/components/ECopedia.js.map +1 -1
  114. package/dist/esm/components/Icon/components/ESignature.js.map +1 -1
  115. package/dist/esm/components/Icon/components/Edit.js.map +1 -1
  116. package/dist/esm/components/Icon/components/EllipsisHorizontal.js.map +1 -1
  117. package/dist/esm/components/Icon/components/EllipsisVertical.js.map +1 -1
  118. package/dist/esm/components/Icon/components/EntriesOnAccount.js.map +1 -1
  119. package/dist/esm/components/Icon/components/EntriesOpen.js.map +1 -1
  120. package/dist/esm/components/Icon/components/EntriesWarning.js.map +1 -1
  121. package/dist/esm/components/Icon/components/EntryTypeCustomerInvoice.js.map +1 -1
  122. package/dist/esm/components/Icon/components/EntryTypeCustomerPayment.js.map +1 -1
  123. package/dist/esm/components/Icon/components/EntryTypeJournalEntry.js.map +1 -1
  124. package/dist/esm/components/Icon/components/EntryTypeManualCustomerInvoice.js.map +1 -1
  125. package/dist/esm/components/Icon/components/EntryTypeSupplierInvoice.js.map +1 -1
  126. package/dist/esm/components/Icon/components/EntryTypeSupplierPayment.js.map +1 -1
  127. package/dist/esm/components/Icon/components/Envelope.js.map +1 -1
  128. package/dist/esm/components/Icon/components/EnvelopeApproved.js.map +1 -1
  129. package/dist/esm/components/Icon/components/ExpandView.js.map +1 -1
  130. package/dist/esm/components/Icon/components/Expenses.js.map +1 -1
  131. package/dist/esm/components/Icon/components/Export.js.map +1 -1
  132. package/dist/esm/components/Icon/components/ExportToExcel.js.map +1 -1
  133. package/dist/esm/components/Icon/components/ExportToPdf.js.map +1 -1
  134. package/dist/esm/components/Icon/components/Filter.js.map +1 -1
  135. package/dist/esm/components/Icon/components/FilterSolid.js.map +1 -1
  136. package/dist/esm/components/Icon/components/GraphSolid.js.map +1 -1
  137. package/dist/esm/components/Icon/components/Hash.js.map +1 -1
  138. package/dist/esm/components/Icon/components/Home.js.map +1 -1
  139. package/dist/esm/components/Icon/components/Images.js.map +1 -1
  140. package/dist/esm/components/Icon/components/Import.js.map +1 -1
  141. package/dist/esm/components/Icon/components/Inbox.js.map +1 -1
  142. package/dist/esm/components/Icon/components/InboxEinvoicing.js.map +1 -1
  143. package/dist/esm/components/Icon/components/InboxScanning.js.map +1 -1
  144. package/dist/esm/components/Icon/components/InboxSmart.js.map +1 -1
  145. package/dist/esm/components/Icon/components/Info.js.map +1 -1
  146. package/dist/esm/components/Icon/components/Inventory.js.map +1 -1
  147. package/dist/esm/components/Icon/components/InventoryMatrix.js.map +1 -1
  148. package/dist/esm/components/Icon/components/JournalPro.js.map +1 -1
  149. package/dist/esm/components/Icon/components/Layout.js.map +1 -1
  150. package/dist/esm/components/Icon/components/LayoutBoth.js.map +1 -1
  151. package/dist/esm/components/Icon/components/LayoutFirst.js.map +1 -1
  152. package/dist/esm/components/Icon/components/LayoutLast.js.map +1 -1
  153. package/dist/esm/components/Icon/components/LayoutNone.js.map +1 -1
  154. package/dist/esm/components/Icon/components/LedgerCard.js.map +1 -1
  155. package/dist/esm/components/Icon/components/LedgerCardCustomerReminder.js.map +1 -1
  156. package/dist/esm/components/Icon/components/LedgerCardManualCustomerInvoice.js.map +1 -1
  157. package/dist/esm/components/Icon/components/LedgerCardObsoleteStock.js.map +1 -1
  158. package/dist/esm/components/Icon/components/LedgerCardOpeningEntry.js.map +1 -1
  159. package/dist/esm/components/Icon/components/LedgerCardReservedEntry.js.map +1 -1
  160. package/dist/esm/components/Icon/components/LedgerCardShrinkagePilferage.js.map +1 -1
  161. package/dist/esm/components/Icon/components/LedgerCardStockAdjustment.js.map +1 -1
  162. package/dist/esm/components/Icon/components/LedgerCardTransferredOpeningEntry.js.map +1 -1
  163. package/dist/esm/components/Icon/components/Lightbulb.js.map +1 -1
  164. package/dist/esm/components/Icon/components/Line.js.map +1 -1
  165. package/dist/esm/components/Icon/components/List.js.map +1 -1
  166. package/dist/esm/components/Icon/components/ListBulleted.js.map +1 -1
  167. package/dist/esm/components/Icon/components/ListSearch.js.map +1 -1
  168. package/dist/esm/components/Icon/components/LockOpen.js.map +1 -1
  169. package/dist/esm/components/Icon/components/Log.js.map +1 -1
  170. package/dist/esm/components/Icon/components/LogOut.js +20 -0
  171. package/dist/esm/components/Icon/components/LogOut.js.map +1 -0
  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/Menu.js +18 -0
  176. package/dist/esm/components/Icon/components/Menu.js.map +1 -0
  177. package/dist/esm/components/Icon/components/Mileage.js.map +1 -1
  178. package/dist/esm/components/Icon/components/ModalResize.js.map +1 -1
  179. package/dist/esm/components/Icon/components/ModalShrink.js.map +1 -1
  180. package/dist/esm/components/Icon/components/More.js.map +1 -1
  181. package/dist/esm/components/Icon/components/MoreSolid.js.map +1 -1
  182. package/dist/esm/components/Icon/components/Move.js.map +1 -1
  183. package/dist/esm/components/Icon/components/NavigationList.js.map +1 -1
  184. package/dist/esm/components/Icon/components/Note.js.map +1 -1
  185. package/dist/esm/components/Icon/components/NoteFollowUp.js.map +1 -1
  186. package/dist/esm/components/Icon/components/NoteRead.js.map +1 -1
  187. package/dist/esm/components/Icon/components/Numbers.js +18 -0
  188. package/dist/esm/components/Icon/components/Numbers.js.map +1 -0
  189. package/dist/esm/components/Icon/components/PartnerApi.js.map +1 -1
  190. package/dist/esm/components/Icon/components/Period.js.map +1 -1
  191. package/dist/esm/components/Icon/components/PersonChange.js.map +1 -1
  192. package/dist/esm/components/Icon/components/PersonMinus.js.map +1 -1
  193. package/dist/esm/components/Icon/components/PersonPlus.js.map +1 -1
  194. package/dist/esm/components/Icon/components/PersonTick.js.map +1 -1
  195. package/dist/esm/components/Icon/components/Play.js.map +1 -1
  196. package/dist/esm/components/Icon/components/PlusMinus.js.map +1 -1
  197. package/dist/esm/components/Icon/components/Print.js.map +1 -1
  198. package/dist/esm/components/Icon/components/ProcessPayment.js.map +1 -1
  199. package/dist/esm/components/Icon/components/ProductLedgerCard.js.map +1 -1
  200. package/dist/esm/components/Icon/components/Profile.js +20 -0
  201. package/dist/esm/components/Icon/components/Profile.js.map +1 -0
  202. package/dist/esm/components/Icon/components/ProjectCards.js.map +1 -1
  203. package/dist/esm/components/Icon/components/Projects.js.map +1 -1
  204. package/dist/esm/components/Icon/components/Quicklinks.js.map +1 -1
  205. package/dist/esm/components/Icon/components/RatingBankruptcy.js.map +1 -1
  206. package/dist/esm/components/Icon/components/RatingPaymentProblems.js.map +1 -1
  207. package/dist/esm/components/Icon/components/Reconciled.js.map +1 -1
  208. package/dist/esm/components/Icon/components/Refresh.js.map +1 -1
  209. package/dist/esm/components/Icon/components/Report.js.map +1 -1
  210. package/dist/esm/components/Icon/components/ReportSolid.js.map +1 -1
  211. package/dist/esm/components/Icon/components/Restore.js.map +1 -1
  212. package/dist/esm/components/Icon/components/RotateLeft.js.map +1 -1
  213. package/dist/esm/components/Icon/components/RotateRight.js.map +1 -1
  214. package/dist/esm/components/Icon/components/Sales.js.map +1 -1
  215. package/dist/esm/components/Icon/components/Search.js.map +1 -1
  216. package/dist/esm/components/Icon/components/SearchBold.js.map +1 -1
  217. package/dist/esm/components/Icon/components/Secure.js.map +1 -1
  218. package/dist/esm/components/Icon/components/SecureTick.js.map +1 -1
  219. package/dist/esm/components/Icon/components/Settings.js.map +1 -1
  220. package/dist/esm/components/Icon/components/SettingsSolid.js.map +1 -1
  221. package/dist/esm/components/Icon/components/Shortcuts.js.map +1 -1
  222. package/dist/esm/components/Icon/components/ShowAll.js.map +1 -1
  223. package/dist/esm/components/Icon/components/ShowLess.js.map +1 -1
  224. package/dist/esm/components/Icon/components/ShowMore.js.map +1 -1
  225. package/dist/esm/components/Icon/components/ShowTemplate.js.map +1 -1
  226. package/dist/esm/components/Icon/components/Sliders.js.map +1 -1
  227. package/dist/esm/components/Icon/components/Smartpay.js.map +1 -1
  228. package/dist/esm/components/Icon/components/SortBy.js.map +1 -1
  229. package/dist/esm/components/Icon/components/Spinner.js.map +1 -1
  230. package/dist/esm/components/Icon/components/Star.js.map +1 -1
  231. package/dist/esm/components/Icon/components/StarSolid.js.map +1 -1
  232. package/dist/esm/components/Icon/components/Subscriptions.js.map +1 -1
  233. package/dist/esm/components/Icon/components/SystemEntries.js.map +1 -1
  234. package/dist/esm/components/Icon/components/Tag.js.map +1 -1
  235. package/dist/esm/components/Icon/components/TemplateOverride.js.map +1 -1
  236. package/dist/esm/components/Icon/components/Templates.js.map +1 -1
  237. package/dist/esm/components/Icon/components/ThumbBoth.js.map +1 -1
  238. package/dist/esm/components/Icon/components/ThumbDown.js.map +1 -1
  239. package/dist/esm/components/Icon/components/ThumbDownSolid.js.map +1 -1
  240. package/dist/esm/components/Icon/components/ThumbUp.js.map +1 -1
  241. package/dist/esm/components/Icon/components/ThumbUpSolid.js.map +1 -1
  242. package/dist/esm/components/Icon/components/Tick.js.map +1 -1
  243. package/dist/esm/components/Icon/components/Time.js.map +1 -1
  244. package/dist/esm/components/Icon/components/Transfer.js.map +1 -1
  245. package/dist/esm/components/Icon/components/TransferCancel.js.map +1 -1
  246. package/dist/esm/components/Icon/components/TransferLocked.js.map +1 -1
  247. package/dist/esm/components/Icon/components/Undock.js.map +1 -1
  248. package/dist/esm/components/Icon/components/Unreconciled.js.map +1 -1
  249. package/dist/esm/components/Icon/components/Warning.js.map +1 -1
  250. package/dist/esm/components/Icon/components/Webshop.js.map +1 -1
  251. package/dist/esm/components/Icon/components/Website.js.map +1 -1
  252. package/dist/esm/components/Icon/components/Workflow.js.map +1 -1
  253. package/dist/esm/components/Icon/components/Zoom.js.map +1 -1
  254. package/dist/esm/components/Icon/components/index.js +8 -0
  255. package/dist/esm/components/Icon/components/index.js.map +1 -1
  256. package/dist/esm/components/IconButton/IconButton.js +9 -11
  257. package/dist/esm/components/IconButton/IconButton.js.map +1 -1
  258. package/dist/esm/components/Input/Input.js +25 -25
  259. package/dist/esm/components/Input/Input.js.map +1 -1
  260. package/dist/esm/components/Listbox/Listbox.js +24 -25
  261. package/dist/esm/components/Listbox/Listbox.js.map +1 -1
  262. package/dist/esm/components/Listbox/ScrollableList.js.map +1 -1
  263. package/dist/esm/components/Listbox/useListbox.js.map +1 -1
  264. package/dist/esm/components/Listbox/useMultiListbox.js.map +1 -1
  265. package/dist/esm/components/Listbox/useTypeahead.js.map +1 -1
  266. package/dist/esm/components/Menu/Context.js.map +1 -1
  267. package/dist/esm/components/Menu/Menu.js +16 -34
  268. package/dist/esm/components/Menu/Menu.js.map +1 -1
  269. package/dist/esm/components/Menu/components/Checkbox.js +1 -1
  270. package/dist/esm/components/Menu/components/Checkbox.js.map +1 -1
  271. package/dist/esm/components/Menu/components/Content.js.map +1 -1
  272. package/dist/esm/components/Menu/components/Header.js.map +1 -1
  273. package/dist/esm/components/Menu/components/Item.js.map +1 -1
  274. package/dist/esm/components/Menu/components/Link.js.map +1 -1
  275. package/dist/esm/components/Menu/components/RadioGroup.js +1 -1
  276. package/dist/esm/components/Menu/components/RadioGroup.js.map +1 -1
  277. package/dist/esm/components/Menu/components/Separator.js.map +1 -1
  278. package/dist/esm/components/Menu/components/Trigger.js.map +1 -1
  279. package/dist/esm/components/Navigation/Navigation.js +35 -44
  280. package/dist/esm/components/Navigation/Navigation.js.map +1 -1
  281. package/dist/esm/components/Pagination/PageNumbers.js.map +1 -1
  282. package/dist/esm/components/Pagination/Pagination.js +39 -56
  283. package/dist/esm/components/Pagination/Pagination.js.map +1 -1
  284. package/dist/esm/components/Pagination/usePagination.js.map +1 -1
  285. package/dist/esm/components/Pagination/usePaginationShortcuts.js.map +1 -1
  286. package/dist/esm/components/Popover/Popover.js +30 -35
  287. package/dist/esm/components/Popover/Popover.js.map +1 -1
  288. package/dist/esm/components/Popover/Primitives.js.map +1 -1
  289. package/dist/esm/components/Progress/Progress.js +11 -15
  290. package/dist/esm/components/Progress/Progress.js.map +1 -1
  291. package/dist/esm/components/Provider/Provider.js +13 -18
  292. package/dist/esm/components/Provider/Provider.js.map +1 -1
  293. package/dist/esm/components/RadioGroup/RadioGroup.js +45 -57
  294. package/dist/esm/components/RadioGroup/RadioGroup.js.map +1 -1
  295. package/dist/esm/components/SearchInput/SearchInput.js +13 -11
  296. package/dist/esm/components/SearchInput/SearchInput.js.map +1 -1
  297. package/dist/esm/components/Select/Select.js +30 -31
  298. package/dist/esm/components/Select/Select.js.map +1 -1
  299. package/dist/esm/components/Select/useSelect.js.map +1 -1
  300. package/dist/esm/components/Spinner/Spinner.js +12 -19
  301. package/dist/esm/components/Spinner/Spinner.js.map +1 -1
  302. package/dist/esm/components/Switch/Switch.js +9 -10
  303. package/dist/esm/components/Switch/Switch.js.map +1 -1
  304. package/dist/esm/components/Table/components/BaseTable.js.map +1 -1
  305. package/dist/esm/components/Table/components/PaginatedTable.js.map +1 -1
  306. package/dist/esm/components/Table/components/Table.js.map +1 -1
  307. package/dist/esm/components/Table/components/WindowedTable.js.map +1 -1
  308. package/dist/esm/components/Table/hooks/plugins/useRowActions.js.map +1 -1
  309. package/dist/esm/components/Table/hooks/plugins/useRowDraggable.js.map +1 -1
  310. package/dist/esm/components/Table/hooks/plugins/useRowEditing.js.map +1 -1
  311. package/dist/esm/components/Table/hooks/plugins/useRowSelect.js.map +1 -1
  312. package/dist/esm/components/Table/hooks/useRowCreation.js.map +1 -1
  313. package/dist/esm/components/Table/hooks/useTable.js.map +1 -1
  314. package/dist/esm/components/Table/util/renderColumn.js.map +1 -1
  315. package/dist/esm/components/Table/util/renderRow.js.map +1 -1
  316. package/dist/esm/components/Tabs/Tabs.js +25 -27
  317. package/dist/esm/components/Tabs/Tabs.js.map +1 -1
  318. package/dist/esm/components/Textarea/Textarea.js +11 -9
  319. package/dist/esm/components/Textarea/Textarea.js.map +1 -1
  320. package/dist/esm/components/Toast/Toast.js +1 -1
  321. package/dist/esm/components/Toast/Toast.js.map +1 -1
  322. package/dist/esm/components/Toast/Toaster.js +88 -118
  323. package/dist/esm/components/Toast/Toaster.js.map +1 -1
  324. package/dist/esm/components/Toast/util.js.map +1 -1
  325. package/dist/esm/components/Tooltip/Tooltip.js +7 -8
  326. package/dist/esm/components/Tooltip/Tooltip.js.map +1 -1
  327. package/dist/esm/components/Tour/Tour.js +46 -50
  328. package/dist/esm/components/Tour/Tour.js.map +1 -1
  329. package/dist/esm/components/Treeview/Treeview.js +26 -36
  330. package/dist/esm/components/Treeview/Treeview.js.map +1 -1
  331. package/dist/esm/components/VisuallyHidden/VisuallyHidden.js +1 -1
  332. package/dist/esm/components/VisuallyHidden/VisuallyHidden.js.map +1 -1
  333. package/dist/esm/index.js +3 -0
  334. package/dist/esm/index.js.map +1 -1
  335. package/dist/esm/primitives/Button.js.map +1 -1
  336. package/dist/esm/utils/hooks/useDraggable.js.map +1 -1
  337. package/dist/esm/utils/hooks/useDropTarget.js +10 -7
  338. package/dist/esm/utils/hooks/useDropTarget.js.map +1 -1
  339. package/dist/esm/utils/hooks/useProxiedRef.js +3 -3
  340. package/dist/esm/utils/hooks/useProxiedRef.js.map +1 -1
  341. package/dist/esm/utils/mergeRefs.js +3 -3
  342. package/dist/esm/utils/mergeRefs.js.map +1 -1
  343. package/dist/index.d.ts +4 -1
  344. package/dist/taco.cjs.development.js +635 -673
  345. package/dist/taco.cjs.development.js.map +1 -1
  346. package/dist/taco.cjs.production.min.js +1 -1
  347. package/dist/taco.cjs.production.min.js.map +1 -1
  348. package/dist/utils/mergeRefs.d.ts +1 -1
  349. package/dist/utils/tailwind.d.ts +1 -1
  350. package/package.json +4 -5
  351. package/tailwind.config.js +264 -260
  352. package/types.json +12 -2
@@ -1 +1 @@
1
- {"version":3,"file":"Calendar.js","sources":["../../../../src/components/Calendar/Calendar.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport cn from 'classnames';\r\nimport ReactDayPicker, { NavbarElementProps, DayModifiers } from 'react-day-picker';\r\nimport { useLocalization } from '../Provider/Provider';\r\nimport './Calendar.css';\r\nimport { IconButton } from '../IconButton/IconButton';\r\n\r\nexport type CalendarTextsActions = {\r\n /** Aria-label for previous month action button */\r\n previousMonth: string;\r\n /** Aria-label for next month action button */\r\n nextMonth: string;\r\n /** Aria-label for previous year action button */\r\n previousYear: string;\r\n /** Aria-label for next year action button */\r\n nextYear: string;\r\n /** Text displayed within today action button */\r\n today: string;\r\n};\r\n\r\nexport type CalendarTexts = {\r\n /** Text and aria-label for action buttons in Calendar */\r\n actions: CalendarTextsActions;\r\n /** Text abbreviation for months in Calendar's header, starting with January */\r\n months: string[];\r\n /** Text abbreviation for days in Calendar's header, starting with Sunday */\r\n weekdaysShort: string[];\r\n};\r\n\r\nconst renderDay = (day: Date, modifiers: DayModifiers): React.ReactNode =>\r\n modifiers.disabled ? <span className=\"dot\" /> : day.getDate();\r\n\r\n/** @internal */\r\ntype CustomNavbarElementProps = NavbarElementProps & {\r\n showYearControls?: boolean;\r\n onMonthChange: (month: Date) => void;\r\n value?: Date;\r\n};\r\n\r\nconst thisYear = new Date().getFullYear();\r\nconst years: number[] = [];\r\n\r\nfor (let i = thisYear - 10; i <= thisYear + 10; i += 1) {\r\n years.push(i);\r\n}\r\n\r\nconst Navbar = React.memo(\r\n ({ onMonthChange, onNextClick, onPreviousClick, value = new Date() }: CustomNavbarElementProps): JSX.Element => {\r\n const {\r\n texts: {\r\n calendar: { actions, months },\r\n },\r\n } = useLocalization();\r\n\r\n const handleChange = function handleChange(event) {\r\n const { year, month } = event.target.form;\r\n onMonthChange(new Date(year.value, month.value));\r\n };\r\n\r\n return (\r\n <div className=\"mb-2 flex items-center justify-between\">\r\n <form className=\"inline-flex space-x-1\">\r\n <select className=\"h-8 px-2\" name=\"month\" onChange={handleChange} value={value.getMonth()}>\r\n {months.map((month, i) => (\r\n <option key={month} value={i}>\r\n {month}\r\n </option>\r\n ))}\r\n </select>\r\n <select className=\"h-8 px-2\" name=\"year\" onChange={handleChange} value={value.getFullYear()}>\r\n {years.map(year => (\r\n <option key={year} value={year}>\r\n {String(year)}\r\n </option>\r\n ))}\r\n </select>\r\n </form>\r\n <div>\r\n <IconButton\r\n appearance=\"discrete\"\r\n icon=\"chevron-left\"\r\n aria-label={actions.previousMonth}\r\n onClick={() => onPreviousClick()}\r\n rounded\r\n />\r\n <IconButton\r\n appearance=\"discrete\"\r\n icon=\"chevron-right\"\r\n aria-label={actions.nextMonth}\r\n onClick={() => onNextClick()}\r\n rounded\r\n />\r\n </div>\r\n </div>\r\n );\r\n }\r\n);\r\n\r\nexport type CalendarProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'value'> & {\r\n /** Handler called when a day is clicked in calendar */\r\n onChange: (date: Date, event?: React.MouseEvent<HTMLDivElement>) => void;\r\n value?: Date;\r\n};\r\n\r\nexport const Calendar = React.forwardRef(function Calendar(props: CalendarProps, ref: React.Ref<ReactDayPicker>) {\r\n const { onChange: handleChange, value, ...otherProps } = props;\r\n const { locale, texts } = useLocalization();\r\n const [visibleMonth, setVisibleMonth] = React.useState(value ?? new Date());\r\n\r\n React.useEffect(() => {\r\n if (visibleMonth !== value) {\r\n setVisibleMonth(value ?? new Date());\r\n }\r\n }, [value]);\r\n\r\n const handleDayClick = (date, modifiers, event) => {\r\n if (modifiers.outside || modifiers.disabled) {\r\n return;\r\n }\r\n\r\n handleChange(date, event);\r\n };\r\n\r\n const handleCalendarClickToday = (): void => {\r\n const today = new Date();\r\n\r\n // set to midday to avoid UTC offset causing dates to be mismatched server side\r\n today.setHours(12);\r\n today.setMinutes(0);\r\n today.setSeconds(0);\r\n\r\n handleChange(today);\r\n };\r\n\r\n const className = cn('flex bg-white text-xs p-4', otherProps.className);\r\n\r\n return (\r\n <div data-taco=\"calendar\">\r\n <ReactDayPicker\r\n {...otherProps}\r\n className={className}\r\n month={visibleMonth}\r\n selectedDays={value}\r\n locale={locale.substring(0, 2)}\r\n firstDayOfWeek={1}\r\n months={texts.calendar.months}\r\n weekdaysShort={texts.calendar.weekdaysShort}\r\n navbarElement={navProps => <Navbar {...navProps} onMonthChange={setVisibleMonth} value={visibleMonth} />}\r\n onDayClick={handleDayClick}\r\n onMonthChange={setVisibleMonth}\r\n onTodayButtonClick={handleCalendarClickToday}\r\n captionElement={() => null}\r\n todayButton={texts.calendar.actions.today}\r\n showOutsideDays\r\n renderDay={renderDay}\r\n numberOfMonths={1}\r\n ref={ref}\r\n />\r\n </div>\r\n );\r\n});\r\n"],"names":["renderDay","day","modifiers","disabled","React","className","getDate","thisYear","Date","getFullYear","years","i","push","Navbar","onMonthChange","onNextClick","onPreviousClick","value","useLocalization","texts","calendar","actions","months","handleChange","event","target","form","year","month","name","onChange","getMonth","map","key","String","IconButton","appearance","icon","previousMonth","onClick","rounded","nextMonth","Calendar","props","ref","otherProps","locale","visibleMonth","setVisibleMonth","handleDayClick","date","outside","handleCalendarClickToday","today","setHours","setMinutes","setSeconds","cn","ReactDayPicker","selectedDays","substring","firstDayOfWeek","weekdaysShort","navbarElement","navProps","onDayClick","onTodayButtonClick","captionElement","todayButton","showOutsideDays","numberOfMonths"],"mappings":";;;;;;;;;AA6BA,IAAMA,SAAS,GAAG,SAAZA,SAAY,CAACC,GAAD,EAAYC,SAAZ;EAAA,OACdA,SAAS,CAACC,QAAV,GAAqBC,aAAA,OAAA;IAAMC,SAAS,EAAC;GAAhB,CAArB,GAAgDJ,GAAG,CAACK,OAAJ,EADlC;AAAA,CAAlB;;AAUA,IAAMC,QAAQ,gBAAG,IAAIC,IAAJ,GAAWC,WAAX,EAAjB;AACA,IAAMC,KAAK,GAAa,EAAxB;;AAEA,KAAK,IAAIC,CAAC,GAAGJ,QAAQ,GAAG,EAAxB,EAA4BI,CAAC,IAAIJ,QAAQ,GAAG,EAA5C,EAAgDI,CAAC,IAAI,CAArD,EAAwD;EACpDD,KAAK,CAACE,IAAN,CAAWD,CAAX;AACH;;AAED,IAAME,MAAM,gBAAGT,IAAA,CACX;MAAGU,qBAAAA;MAAeC,mBAAAA;MAAaC,uBAAAA;wBAAiBC;MAAAA,gCAAQ,IAAIT,IAAJ;;EACpD,uBAIIU,eAAe,EAJnB;+CACIC,KADJ,CAEQC,QAFR;MAEoBC,OAFpB,yBAEoBA,OAFpB;MAE6BC,MAF7B,yBAE6BA,MAF7B;;EAMA,IAAMC,YAAY,GAAG,SAASA,YAAT,CAAsBC,KAAtB;IACjB,yBAAwBA,KAAK,CAACC,MAAN,CAAaC,IAArC;QAAQC,IAAR,sBAAQA,IAAR;QAAcC,KAAd,sBAAcA,KAAd;IACAd,aAAa,CAAC,IAAIN,IAAJ,CAASmB,IAAI,CAACV,KAAd,EAAqBW,KAAK,CAACX,KAA3B,CAAD,CAAb;GAFJ;;EAKA,OACIb,aAAA,MAAA;IAAK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QAAN,CAAeE;IACvBwC,aAAa,EAAE3C,KAAK,CAACC,QAAN,CAAe0C;IAC9BC,aAAa,EAAE,uBAAAC,QAAQ;MAAA,OAAI5D,aAAA,CAACS,MAAD,oBAAYmD;QAAUlD,aAAa,EAAEkC;QAAiB/B,KAAK,EAAE8B;QAA7D,CAAJ;;IACvBkB,UAAU,EAAEhB;IACZnC,aAAa,EAAEkC;IACfkB,kBAAkB,EAAEd;IACpBe,cAAc,EAAE;MAAA,OAAM,IAAN;;IAChBC,WAAW,EAAEjD,KAAK,CAACC,QAAN,CAAeC,OAAf,CAAuBgC;IACpCgB,eAAe;IACfrE,SAAS,EAAEA;IACXsE,cAAc,EAAE;IAChB1B,GAAG,EAAEA;IAlBT,CADJ,CADJ;AAwBH,CAxDuB;;;;"}
1
+ {"version":3,"file":"Calendar.js","sources":["../../../../src/components/Calendar/Calendar.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport ReactDayPicker, { NavbarElementProps, DayModifiers } from 'react-day-picker';\nimport { useLocalization } from '../Provider/Provider';\nimport './Calendar.css';\nimport { IconButton } from '../IconButton/IconButton';\n\nexport type CalendarTextsActions = {\n /** Aria-label for previous month action button */\n previousMonth: string;\n /** Aria-label for next month action button */\n nextMonth: string;\n /** Aria-label for previous year action button */\n previousYear: string;\n /** Aria-label for next year action button */\n nextYear: string;\n /** Text displayed within today action button */\n today: string;\n};\n\nexport type CalendarTexts = {\n /** Text and aria-label for action buttons in Calendar */\n actions: CalendarTextsActions;\n /** Text abbreviation for months in Calendar's header, starting with January */\n months: string[];\n /** Text abbreviation for days in Calendar's header, starting with Sunday */\n weekdaysShort: string[];\n};\n\nconst renderDay = (day: Date, modifiers: DayModifiers): React.ReactNode =>\n modifiers.disabled ? <span className=\"dot\" /> : day.getDate();\n\n/** @internal */\ntype CustomNavbarElementProps = NavbarElementProps & {\n showYearControls?: boolean;\n onMonthChange: (month: Date) => void;\n value?: Date;\n};\n\nconst thisYear = new Date().getFullYear();\nconst years: number[] = [];\n\nfor (let i = thisYear - 10; i <= thisYear + 10; i += 1) {\n years.push(i);\n}\n\nconst Navbar = React.memo(\n ({ onMonthChange, onNextClick, onPreviousClick, value = new Date() }: CustomNavbarElementProps): JSX.Element => {\n const {\n texts: {\n calendar: { actions, months },\n },\n } = useLocalization();\n\n const handleChange = function handleChange(event) {\n const { year, month } = event.target.form;\n onMonthChange(new Date(year.value, month.value));\n };\n\n return (\n <div className=\"mb-2 flex items-center justify-between\">\n <form className=\"inline-flex space-x-1\">\n <select className=\"h-8 px-2\" name=\"month\" onChange={handleChange} value={value.getMonth()}>\n {months.map((month, i) => (\n <option key={month} value={i}>\n {month}\n </option>\n ))}\n </select>\n <select className=\"h-8 px-2\" name=\"year\" onChange={handleChange} value={value.getFullYear()}>\n {years.map(year => (\n <option key={year} value={year}>\n {String(year)}\n </option>\n ))}\n </select>\n </form>\n <div>\n <IconButton\n appearance=\"discrete\"\n icon=\"chevron-left\"\n aria-label={actions.previousMonth}\n onClick={() => onPreviousClick()}\n rounded\n />\n <IconButton\n appearance=\"discrete\"\n icon=\"chevron-right\"\n aria-label={actions.nextMonth}\n onClick={() => onNextClick()}\n rounded\n />\n </div>\n </div>\n );\n }\n);\n\nexport type CalendarProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'value'> & {\n /** Handler called when a day is clicked in calendar */\n onChange: (date: Date, event?: React.MouseEvent<HTMLDivElement>) => void;\n value?: Date;\n};\n\nexport const Calendar = React.forwardRef(function Calendar(props: CalendarProps, ref: React.Ref<ReactDayPicker>) {\n const { onChange: handleChange, value, ...otherProps } = props;\n const { locale, texts } = useLocalization();\n const [visibleMonth, setVisibleMonth] = React.useState(value ?? new Date());\n\n React.useEffect(() => {\n if (visibleMonth !== value) {\n setVisibleMonth(value ?? new Date());\n }\n }, [value]);\n\n const handleDayClick = (date, modifiers, event) => {\n if (modifiers.outside || modifiers.disabled) {\n return;\n }\n\n handleChange(date, event);\n };\n\n const handleCalendarClickToday = (): void => {\n const today = new Date();\n\n // set to midday to avoid UTC offset causing dates to be mismatched server side\n today.setHours(12);\n today.setMinutes(0);\n today.setSeconds(0);\n\n handleChange(today);\n };\n\n const className = cn('flex bg-white text-xs p-4', otherProps.className);\n\n return (\n <div data-taco=\"calendar\">\n <ReactDayPicker\n {...otherProps}\n className={className}\n month={visibleMonth}\n selectedDays={value}\n locale={locale.substring(0, 2)}\n firstDayOfWeek={1}\n months={texts.calendar.months}\n weekdaysShort={texts.calendar.weekdaysShort}\n navbarElement={navProps => <Navbar {...navProps} onMonthChange={setVisibleMonth} value={visibleMonth} />}\n onDayClick={handleDayClick}\n onMonthChange={setVisibleMonth}\n onTodayButtonClick={handleCalendarClickToday}\n captionElement={() => null}\n todayButton={texts.calendar.actions.today}\n showOutsideDays\n renderDay={renderDay}\n numberOfMonths={1}\n ref={ref}\n />\n </div>\n );\n});\n"],"names":["renderDay","day","modifiers","disabled","React","className","getDate","thisYear","Date","getFullYear","years","i","push","Navbar","onMonthChange","onNextClick","onPreviousClick","value","useLocalization","texts","calendar","actions","months","handleChange","event","target","form","year","month","name","onChange","getMonth","map","key","String","IconButton","appearance","icon","previousMonth","onClick","rounded","nextMonth","Calendar","props","ref","otherProps","locale","visibleMonth","setVisibleMonth","handleDayClick","date","outside","handleCalendarClickToday","today","setHours","setMinutes","setSeconds","cn","ReactDayPicker","selectedDays","substring","firstDayOfWeek","weekdaysShort","navbarElement","navProps","onDayClick","onTodayButtonClick","captionElement","todayButton","showOutsideDays","numberOfMonths"],"mappings":";;;;;;;;;AA6BA,IAAMA,SAAS,GAAG,SAAZA,SAAY,CAACC,GAAD,EAAYC,SAAZ;EAAA,OACdA,SAAS,CAACC,QAAV,GAAqBC,aAAA,OAAA;IAAMC,SAAS,EAAC;GAAhB,CAArB,GAAgDJ,GAAG,CAACK,OAAJ,EADlC;AAAA,CAAlB;;AAUA,IAAMC,QAAQ,gBAAG,IAAIC,IAAJ,GAAWC,WAAX,EAAjB;AACA,IAAMC,KA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 @@ import '../Toast/Toaster.js';
16
16
  import '../Provider/Provider.js';
17
17
  import '../Calendar/Calendar.js';
18
18
  import '../Checkbox/Checkbox.js';
19
+ import '../../utils/hooks/useProxiedRef.js';
19
20
  import '../Input/Input.js';
20
21
  import '../../utils/hooks/useListKeyboardNavigation.js';
21
22
  import '../../utils/hooks/useListScrollTo.js';
22
23
  import '../../utils/hooks/useBoundingClientRectListener.js';
23
24
  import '../Combobox/Combobox.js';
24
25
  import '../../utils/date.js';
26
+ import '../../utils/mergeRefs.js';
25
27
  import '../Popover/Popover.js';
26
28
  import '../Datepicker/Datepicker.js';
27
29
  import '../Dialog/Dialog.js';
@@ -35,6 +37,7 @@ import '../Listbox/Listbox.js';
35
37
  import '../RadioGroup/RadioGroup.js';
36
38
  import '../Menu/Menu.js';
37
39
  import '../Treeview/Treeview.js';
40
+ import '../../utils/hooks/useDropTarget.js';
38
41
  import '../Navigation/Navigation.js';
39
42
  import '../Select/Select.js';
40
43
  import '../Pagination/usePagination.js';
@@ -1 +1 @@
1
- {"version":3,"file":"Card.js","sources":["../../../../src/components/Card/Card.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport cn from 'classnames';\r\n\r\nimport { MenuProps, IconButton } from '../..';\r\n\r\nexport type CardContentProps = React.HTMLAttributes<HTMLDivElement> & {\r\n noPadding?: boolean;\r\n};\r\n\r\nconst Content = React.forwardRef<HTMLDivElement, CardContentProps>(function CardContent(externalProps, ref) {\r\n const { noPadding, ...props } = externalProps;\r\n const className = cn(\r\n 'flex-grow overflow-auto',\r\n {\r\n 'mx-4 mb-4': !noPadding,\r\n },\r\n props.className\r\n );\r\n return <div {...props} className={className} ref={ref} />;\r\n});\r\n\r\nexport type CardProps = React.HTMLAttributes<HTMLDivElement> & {\r\n /** Title of the Card */\r\n title: string | React.ReactElement;\r\n /** Menu component associated with the Card */\r\n menu?: (props: Partial<MenuProps>) => JSX.Element;\r\n};\r\n\r\nexport const Card = React.forwardRef<HTMLDivElement, CardProps>(function Card(props, ref) {\r\n const { title, menu, children } = props;\r\n const className = cn(\r\n 'bg-white flex flex-col rounded-xl shadow-[0px_0px_1px_rgba(0,0,0,0.1),0px_6px_18px_rgba(47,51,68,0.2)]',\r\n props.className\r\n );\r\n\r\n return (\r\n <div className={className} data-taco=\"card\" ref={ref}>\r\n <div className=\"mx-4 mt-4 mb-2 flex\">\r\n {title && <h4 className=\"mb-0 flex-grow text-left\">{title}</h4>}\r\n {menu ? <IconButton icon=\"ellipsis-horizontal\" appearance=\"discrete\" menu={menu} className=\"-mt-[4px]\" /> : null}\r\n </div>\r\n {children}\r\n </div>\r\n );\r\n}) as React.ForwardRefExoticComponent<CardProps> & {\r\n Content: React.ForwardRefExoticComponent<CardContentProps>;\r\n};\r\nCard.Content = Content;\r\n"],"names":["Content","React","CardContent","externalProps","ref","noPadding","props","className","cn","Card","title","menu","children","IconButton","icon","appearance"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,IAAMA,OAAO,gBAAGC,UAAA,CAAmD,SAASC,WAAT,CAAqBC,aAArB,EAAoCC,GAApC;EAC/D,IAAQC,SAAR,GAAgCF,aAAhC,CAAQE,SAAR;MAAsBC,KAAtB,iCAAgCH,aAAhC;;EACA,IAAMI,SAAS,GAAGC,EAAE,CAChB,yBADgB,EAEhB;IACI,aAAa,CAACH;GAHF,EAKhBC,KAAK,CAACC,SALU,CAApB;EAOA,OAAON,aAAA,MAAA,oBAASK;IAAOC,SAAS,EAAEA;IAAWH,GAAG,EAAEA;IAA3C,CAAP;AACH,CAVe,CAAhB;IAmBaK,IAAI,gBAAGR,UAAA,CAA4C,SAASQ,IAAT,CAAcH,KAAd,EAAqBF,GAArB;EAC5D,IAAQM,KAAR,GAAkCJ,KAAlC,CAAQI,KAAR;MAAeC,IAAf,GAAkCL,KAAlC,CAAeK,IAAf;MAAqBC,QAArB,GAAkCN,KAAlC,CAAqBM,QAArB;EACA,IAAML,SAAS,GAAGC,EAAE,CAChB,wGADgB,EAEhBF,KAAK,CAACC,SAFU,CAApB;EAKA,OACIN,aAAA,MAAA;IAAKM,SAAS,EAAEA;iBAAqB;IAAOH,GAAG,EAAEA;GAAjD,EACIH,aAAA,MAAA;IAAKM,SAAS,EAAC;GAAf,EACKG,KAAK,IAAIT,aAAA,KAAA;IAAIM,SAAS,EAAC;GAAd,EAA0CG,KAA1C,CADd,EAEKC,IAAI,GAAGV,aAAA,CAACY,UAAD;IAAYC,IAAI,EAAC;IAAsBC,UAAU,EAAC;IAAWJ,IAAI,EAAEA;IAAMJ,SAAS,EAAC;GAAnF,CAAH,GAAuG,IAFhH,CADJ,EAKKK,QALL,CADJ;AASH,CAhBmB;AAmBpBH,IAAI,CAACT,OAAL,GAAeA,OAAf;;;;"}
1
+ {"version":3,"file":"Card.js","sources":["../../../../src/components/Card/Card.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\n\nimport { MenuProps, IconButton } from '../..';\n\nexport type CardContentProps = React.HTMLAttributes<HTMLDivElement> & {\n noPadding?: boolean;\n};\n\nconst Content = React.forwardRef<HTMLDivElement, CardContentProps>(function CardContent(externalProps, ref) {\n const { noPadding, ...props } = externalProps;\n const className = cn(\n 'flex-grow overflow-auto',\n {\n 'mx-4 mb-4': !noPadding,\n },\n props.className\n );\n return <div {...props} className={className} ref={ref} />;\n});\n\nexport type CardProps = React.HTMLAttributes<HTMLDivElement> & {\n /** Title of the Card */\n title: string | React.ReactElement;\n /** Menu component associated with the Card */\n menu?: (props: Partial<MenuProps>) => JSX.Element;\n};\n\nexport const Card = React.forwardRef<HTMLDivElement, CardProps>(function Card(props, ref) {\n const { title, menu, children } = props;\n const className = cn(\n 'bg-white flex flex-col rounded-xl shadow-[0px_0px_1px_rgba(0,0,0,0.1),0px_6px_18px_rgba(47,51,68,0.2)]',\n props.className\n );\n\n return (\n <div className={className} data-taco=\"card\" ref={ref}>\n <div className=\"mx-4 mt-4 mb-2 flex\">\n {title && <h4 className=\"mb-0 flex-grow text-left\">{title}</h4>}\n {menu ? <IconButton icon=\"ellipsis-horizontal\" appearance=\"discrete\" menu={menu} className=\"-mt-[4px]\" /> : null}\n </div>\n {children}\n </div>\n );\n}) as React.ForwardRefExoticComponent<CardProps> & {\n Content: React.ForwardRefExoticComponent<CardContentProps>;\n};\nCard.Content = Content;\n"],"names":["Content","React","CardContent","externalProps","ref","noPadding","props","className","cn","Card","title","menu","children","IconButton","icon","appearance"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,IAAMA,OAAO,gBAAGC,UAAA,CAAmD,SAASC,WAAT,CAAqBC,aAArB,EAAoCC,GAApC;EAC/D,IAAQC,SAAR,GAAgCF,aAAhC,CAAQE,SAAR;MAAsBC,KAAtB,iCAAgCH,aAAhC;;EACA,IAAMI,SAAS,GAAGC,EAAE,CAChB,yBADgB,EAEhB;IACI,aAAa,CAACH;GAHF,EAKhBC,KAAK,CAACC,SALU,CAApB;EAOA,OAAON,aAAA,MAAA,oBAASK;IAAOC,SAAS,EAAEA;IAAWH,GAAG,EAAEA;IAA3C,CAAP;AACH,CAVe,CAAhB;IAmBaK,IAAI,gBAAGR,UAAA,CAA4C,SAASQ,IAAT,CAAcH,KAAd,EAAqBF,GAArB;EAC5D,IAAQM,KAAR,GAAkCJ,KAAlC,CAAQI,KAAR;MAAeC,IAAf,GAAkCL,KAAlC,CAAeK,IAAf;MAAqBC,QAArB,GAAkCN,KAAlC,CAAqBM,QAArB;EACA,IAAML,SAAS,GAAGC,EAAE,CAChB,wGADgB,EAEhBF,KAAK,CAACC,SAFU,CAApB;EAKA,OACIN,aAAA,MAAA;IAAKM,SAAS,EAAEA;iBAAqB;IAAOH,GAAG,EAAEA;GAAjD,EACIH,aAAA,MAAA;IAAKM,SAAS,EAAC;GAAf,EACKG,KAAK,IAAIT,aAAA,KAAA;IAAIM,SAAS,EAAC;GAAd,EAA0CG,KAA1C,CADd,EAEKC,IAAI,GAAGV,aAAA,CAACY,UAAD;IAAYC,IAAI,EAAC;IAAsBC,UAAU,EAAC;IAAWJ,IAAI,EAAEA;IAAMJ,SAAS,EAAC;GAAnF,CAAH,GAAuG,IAFhH,CADJ,EAKKK,QALL,CADJ;AASH,CAhBmB;AAmBpBH,IAAI,CAACT,OAAL,GAAeA,OAAf;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.js","sources":["../../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport cn from 'classnames';\r\nimport * as CheckboxPrimitive from '@radix-ui/react-checkbox';\r\nimport { Icon } from '../Icon/Icon';\r\n\r\ntype CheckedState = boolean | 'indeterminate';\r\n\r\ntype CheckboxBaseProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'onChange'> & {\r\n /* Increases visual prominenance of the checkbox */\r\n highlighted?: boolean;\r\n /**\r\n * Indeterminate state should only be used with sub-checkboxes. The indeterminate state is shown if not all\r\n * sub-checkboxes are selected. This only affects the style, changing the icon in the checkbox.\r\n */\r\n indeterminate?: boolean;\r\n /* Whether the checkbox is in an invalid state */\r\n invalid?: boolean;\r\n /** Label for the checkbox */\r\n label?: React.ReactNode;\r\n /* Whether user input is required */\r\n required?: boolean;\r\n};\r\n\r\ninterface UncontrolledCheckboxProps extends CheckboxBaseProps {\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 ControlledCheckboxProps extends CheckboxBaseProps {\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 CheckboxProps = UncontrolledCheckboxProps | ControlledCheckboxProps;\r\n\r\nexport const Checkbox = React.forwardRef(function Checkbox(props: CheckboxProps, ref: React.Ref<HTMLButtonElement>) {\r\n const { checked, highlighted, indeterminate, invalid, label, onChange, ...otherProps } = props;\r\n\r\n const className = cn(\r\n 'bg-white h-5 w-5 border rounded text-sm flex-shrink-0 self-start mt-[0.1rem] focus:yt-focus', //hover:shadow-[0_0_0_1px_rgba(235,235,235,1)]\r\n props.className,\r\n {\r\n 'border-grey-dark text-blue hover:text-blue-light focus:border-blue focus:hover:border-blue-light':\r\n !props.disabled && !invalid,\r\n 'border-grey text-blue-light cursor-not-allowed': props.disabled,\r\n 'bg-[rgba(255,255,0,0.2)] disabled:bg-[rgba(255,255,0,0.075)]': highlighted,\r\n 'border-red text-red hover:text-red-light hover:border-red-light focus:border-red focus:hover:border-red-light':\r\n invalid && !props.disabled,\r\n }\r\n );\r\n\r\n let handleChange: ((checked: CheckedState) => void) | undefined;\r\n\r\n if (onChange) {\r\n handleChange = (checked: CheckedState) => onChange(checked === 'indeterminate' ? false : checked);\r\n }\r\n\r\n const element = (\r\n <CheckboxPrimitive.Root\r\n {...otherProps}\r\n data-taco=\"checkbox\"\r\n checked={indeterminate ? 'indeterminate' : checked}\r\n className={className}\r\n onCheckedChange={handleChange}\r\n ref={ref}\r\n >\r\n <CheckboxPrimitive.Indicator className=\"flex h-full w-full\">\r\n <Icon name={indeterminate ? 'line' : 'tick'} className=\"!h-full !w-full\" />\r\n </CheckboxPrimitive.Indicator>\r\n </CheckboxPrimitive.Root>\r\n );\r\n\r\n if (label) {\r\n const labelClassName = cn(\r\n 'flex items-center cursor-pointer gap-2',\r\n {\r\n 'cursor-not-allowed text-grey-dark': props.disabled,\r\n },\r\n props.className\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":["Checkbox","React","props","ref","checked","highlighted","indeterminate","invalid","label","onChange","otherProps","className","cn","disabled","handleChange","element","CheckboxPrimitive","onCheckedChange","Icon","name","labelClassName"],"mappings":";;;;;;;IAwCaA,QAAQ,gBAAGC,UAAA,CAAiB,SAASD,QAAT,CAAkBE,KAAlB,EAAwCC,GA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aAAA,QAAA;MAAOU,SAAS,EAAES;KAAlB,EACKL,OADL,EAEKP,KAFL,CADJ;;;EAQJ,OAAOO,OAAP;AACH,CAvDuB;;;;"}
1
+ {"version":3,"file":"Checkbox.js","sources":["../../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as CheckboxPrimitive from '@radix-ui/react-checkbox';\nimport { Icon } from '../Icon/Icon';\n\ntype CheckedState = boolean | 'indeterminate';\n\ntype CheckboxBaseProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'onChange'> & {\n /* Increases visual prominenance of the checkbox */\n highlighted?: boolean;\n /**\n * Indeterminate state should only be used with sub-checkboxes. The indeterminate state is shown if not all\n * sub-checkboxes are selected. This only affects the style, changing the icon in the checkbox.\n */\n indeterminate?: boolean;\n /* Whether the checkbox is in an invalid state */\n invalid?: boolean;\n /** Label for the checkbox */\n label?: React.ReactNode;\n /* Whether user input is required */\n required?: boolean;\n};\n\ninterface UncontrolledCheckboxProps extends CheckboxBaseProps {\n checked?: never;\n onChange?: never;\n /* The default checked state (uncontrolled) */\n defaultChecked?: boolean;\n}\n\ninterface ControlledCheckboxProps extends CheckboxBaseProps {\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 CheckboxProps = UncontrolledCheckboxProps | ControlledCheckboxProps;\n\nexport const Checkbox = React.forwardRef(function Checkbox(props: CheckboxProps, ref: React.Ref<HTMLButtonElement>) {\n const { checked, highlighted, indeterminate, invalid, label, onChange, ...otherProps } = props;\n\n const className = cn(\n 'bg-white h-5 w-5 border rounded text-sm flex-shrink-0 self-start mt-[0.1rem] focus:yt-focus', //hover:shadow-[0_0_0_1px_rgba(235,235,235,1)]\n props.className,\n {\n 'border-grey-dark text-blue hover:text-blue-light focus:border-blue focus:hover:border-blue-light':\n !props.disabled && !invalid,\n 'border-grey text-blue-light cursor-not-allowed': props.disabled,\n 'bg-[rgba(255,255,0,0.2)] disabled:bg-[rgba(255,255,0,0.075)]': highlighted,\n 'border-red text-red hover:text-red-light hover:border-red-light focus:border-red focus:hover:border-red-light':\n invalid && !props.disabled,\n }\n );\n\n let handleChange: ((checked: CheckedState) => void) | undefined;\n\n if (onChange) {\n handleChange = (checked: CheckedState) => onChange(checked === 'indeterminate' ? false : checked);\n }\n\n const element = (\n <CheckboxPrimitive.Root\n {...otherProps}\n data-taco=\"checkbox\"\n checked={indeterminate ? 'indeterminate' : checked}\n className={className}\n onCheckedChange={handleChange}\n ref={ref}\n >\n <CheckboxPrimitive.Indicator className=\"flex h-full w-full\">\n <Icon name={indeterminate ? 'line' : 'tick'} className=\"!h-full !w-full\" />\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n );\n\n if (label) {\n const labelClassName = cn(\n 'flex items-center cursor-pointer gap-2',\n {\n 'cursor-not-allowed text-grey-dark': props.disabled,\n },\n props.className\n );\n\n return (\n <label className={labelClassName}>\n {element}\n {label}\n </label>\n );\n }\n\n return element;\n});\n"],"names":["Checkbox","React","props","ref","checked","highlighted","indeterminate","invalid","label","onChange","otherProps","className","cn","disabled","handleChange","element","CheckboxPrimitive","onCheckedChange","Icon","name","labelClassName"],"mappings":";;;;;;;IAwCaA,QAAQ,gBAAGC,UAAA,CAAiB,SAASD,QAAT,CAAkBE,KAAlB,EAAwCC,GAAxC;EACrC,IAAQC,OAAR,GAAyFF,KAAzF,CAAQE,OAAR;MAAiBC,WAAjB,GAAyFH,KAAzF,CAAiBG,WAAjB;MAA8BC,aAA9B,GAAyFJ,KAAzF,CAA8BI,aAA9B;MAA6CC,OAA7C,GAAyFL,KAAzF,CAA6CK,OAA7C;MAAsDC,KAAtD,GAAyFN,KAAzF,CAAsDM,KAAtD;MAA6DC,QAA7D,GAAyFP,KAAzF,CAA6DO,QAA7D;MAA0EC,UAA1E,iCAAyFR,KAAzF;;EAEA,IAAMS,SAAS,GAAGC,EAAE,CAChB,6FADgB;EAEhBV,KAAK,CAACS,SAFU,EAGhB;IACI,oGACI,CAACT,KAAK,CAACW,QAAP,IAAmB,CAACN,OAF5B;IAGI,kDAAkDL,KAAK,CAACW,QAH5D;IAII,gEAAgER,WAJpE;IAKI,iHACIE,OAAO,IAAI,CAACL,KAAK,CAACW;GATV,CAApB;EAaA,IAAIC,YAAJ;;EAEA,IAAIL,QAAJ,EAAc;IACVK,YAAY,GAAG,sBAACV,OAAD;MAAA,OAA2BK,QAAQ,CAACL,OAAO,KAAK,eAAZ,GAA8B,KAA9B,GAAsCA,OAAvC,CAAnC;KAAf;;;EAGJ,IAAMW,OAAO,GACTd,aAAA,CAACe,IAAD,oBACQN;iBACM;IACVN,OAAO,EAAEE,aAAa,GAAG,eAAH,GAAqBF;IAC3CO,SAAS,EAAEA;IACXM,eAAe,EAAEH;IACjBX,GAAG,EAAEA;IANT,EAQIF,aAAA,CAACe,SAAD;IAA6BL,SAAS,EAAC;GAAvC,EACIV,aAAA,CAACiB,IAAD;IAAMC,IAAI,EAAEb,aAAa,GAAG,MAAH,GAAY;IAAQK,SAAS,EAAC;GAAvD,CADJ,CARJ,CADJ;;EAeA,IAAIH,KAAJ,EAAW;IACP,IAAMY,cAAc,GAAGR,EAAE,CACrB,wCADqB,EAErB;MACI,qCAAqCV,KAAK,CAACW;KAH1B,EAKrBX,KAAK,CAACS,SALe,CAAzB;IAQA,OACIV,aAAA,QAAA;MAAOU,SAAS,EAAES;KAAlB,EACKL,OADL,EAEKP,KAFL,CADJ;;;EAQJ,OAAOO,OAAP;AACH,CAvDuB;;;;"}
@@ -56,6 +56,7 @@ var Combobox = /*#__PURE__*/forwardRef(function Combobox(props, ref) {
56
56
  },
57
57
  tabIndex: -1
58
58
  }) : dialog ? createElement(IconButton, {
59
+ "aria-label": texts.combobox.tooltip,
59
60
  icon: "list-search",
60
61
  disabled: props.readOnly || props.disabled,
61
62
  dialog: dialog,
@@ -1 +1 @@
1
- {"version":3,"file":"Combobox.js","sources":["../../../../src/components/Combobox/Combobox.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport cn from 'classnames';\r\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\r\nimport { Input, InputProps } from '../Input/Input';\r\nimport { useCombobox } from './useCombobox';\r\nimport { ScrollableList, ScrollableListItem, ScrollableListItemValue } from '../Listbox/ScrollableList';\r\nimport { useBoundingClientRectListener } from '../../utils/hooks/useBoundingClientRectListener';\r\nimport { IconButton } from '../IconButton/IconButton';\r\nimport './Combobox.css';\r\nimport { DialogProps } from '../Dialog/Dialog';\r\nimport { useLocalization } from '../Provider/Provider';\r\n\r\nexport type ComboboxTexts = {\r\n /* Tooltip shown for the dialog button */\r\n tooltip: string;\r\n};\r\n\r\nexport type ComboboxItem = ScrollableListItem;\r\nexport type ComboboxValue = ScrollableListItemValue;\r\n\r\ntype ComboboxBaseProps = Omit<InputProps, 'defaultValue' | 'button' | 'onChange' | 'value'> & {\r\n /** Array of options in combobox */\r\n data?: ComboboxItem[];\r\n /**\r\n * Initial value of the input in combobox.\r\n * This is used when combobox is mounted, if no value is provided.\r\n * *Note* that combobox is a controlled component, setting this will also trigger the `onChange` event\r\n */\r\n defaultValue?: ComboboxValue;\r\n /** Set what value should have an empty option in combobox */\r\n emptyValue?: ComboboxValue;\r\n /** Draws attention to the combobox by changing its style and making it visually prominent */\r\n highlighted?: boolean;\r\n /** Displays loading state in listbox */\r\n loading?: boolean;\r\n /**\r\n * Handler called when user chooses an option from the provided suggestions.\r\n * Suggestions will be calculated based on the input value.\r\n * There are two ways to choose an option: either click on it, or navigate using keyboard and press `enter`\r\n */\r\n onChange?: React.ChangeEventHandler<HTMLInputElement>;\r\n /** Handler called when the user enters a query **/\r\n onSearch?: (query: string) => void | Promise<void>;\r\n /** Value of the input in combobox */\r\n value?: ComboboxValue;\r\n};\r\n\r\ninterface InlineComboboxProps extends ComboboxBaseProps {\r\n dialog?: never;\r\n /**\r\n * Combobox will display its data when input is clicked/focused, even if the input is empty.\r\n * *Note* that default combobox will display matching data only when user starts typing in input.\r\n */\r\n inline: boolean; // Example 3 on https://www.w3.org/TR/wai-aria-practices/examples/combobox/aria1.1pattern/listbox-combo.html\r\n}\r\n\r\ninterface DialogComboboxProps extends ComboboxBaseProps {\r\n dialog: (props: Partial<DialogProps>) => JSX.Element;\r\n inline?: never;\r\n}\r\n\r\nexport type ComboboxProps = InlineComboboxProps | DialogComboboxProps;\r\n\r\nexport const Combobox = React.forwardRef(function Combobox(props: ComboboxProps, ref: React.Ref<HTMLInputElement>) {\r\n const { className: externalClassName, dialog, style, ...otherProps } = props;\r\n const { combobox, button, input, popover, list } = useCombobox(otherProps, ref);\r\n const internalRef = React.useRef<HTMLDivElement>(null);\r\n const { texts } = useLocalization();\r\n const selectDimensions = useBoundingClientRectListener(internalRef);\r\n const className = cn(\r\n 'inline-flex relative',\r\n {\r\n 'yt-combobox--inline': props.inline,\r\n },\r\n externalClassName\r\n );\r\n\r\n return (\r\n <span className={className} data-taco=\"combobox\" style={style}>\r\n <PopoverPrimitive.Root {...popover}>\r\n <PopoverPrimitive.Anchor asChild ref={internalRef}>\r\n <div {...combobox} className=\"inline w-full\" ref={ref}>\r\n <Input\r\n {...input}\r\n autoComplete=\"off\"\r\n button={\r\n props.inline ? (\r\n <IconButton\r\n appearance=\"discrete\"\r\n className=\"!border-l-0 focus:!border-none focus:!shadow-none active:!border-none\"\r\n icon={popover.open ? 'chevron-up' : 'chevron-down'}\r\n onClick={() => {\r\n popover.onOpenChange(true);\r\n input.ref.current?.focus();\r\n }}\r\n tabIndex={-1}\r\n />\r\n ) : dialog ? (\r\n <IconButton\r\n icon=\"list-search\"\r\n disabled={props.readOnly || props.disabled}\r\n dialog={dialog}\r\n onFocus={(event: React.FocusEvent<HTMLButtonElement>) => {\r\n // Prevents the default focus behaviour of showing the tooltip, on parent tooltip element\r\n event.preventDefault();\r\n input.ref.current?.focus();\r\n }}\r\n ref={button.ref}\r\n tabIndex={-1}\r\n tooltip={texts.combobox.tooltip}\r\n />\r\n ) : undefined\r\n }\r\n />\r\n </div>\r\n </PopoverPrimitive.Anchor>\r\n <PopoverPrimitive.Content\r\n align=\"start\"\r\n onOpenAutoFocus={event => {\r\n event.preventDefault();\r\n }}\r\n sideOffset={4}\r\n >\r\n <ScrollableList\r\n {...list}\r\n className={cn('!border-blue max-h-[calc(12rem+2px)] w-auto max-w-[theme(spacing.96)]')}\r\n style={{ minWidth: selectDimensions?.width }}\r\n tabIndex={popover.open ? 0 : -1}\r\n />\r\n </PopoverPrimitive.Content>\r\n </PopoverPrimitive.Root>\r\n </span>\r\n );\r\n});\r\n"],"names":["Combobox","React","props","ref","externalClassName","className","dialog","style","otherProps","useCombobox","combobox","button","input","popover","list","internalRef","useLocalization","texts","selectDimensions","useBoundingClientRectListener","cn","inline","PopoverPrimitive","asChild","Input","autoComplete","IconButton","appearance","icon","open","onClick","onOpenChange","current","focus","tabIndex","disabled","readOnly","onFocus","event","preventDefault","tooltip","undefined","align","onOpenAutoFocus","sideOffset","ScrollableList","minWidth","width"],"mappings":";;;;;;;;;;;;IA+DaA,QAAQ,gBAAGC,UAAA,CAAiB,SAASD,QAAT,CAAkBE,KAAlB,EAAwCC,GAAxC;EACrC,IAAmBC,iBAAnB,GAAuEF,KAAvE,CAAQG,SAAR;MAAsCC,MAAtC,GAAuEJ,KAAvE,CAAsCI,MAAtC;MAA8CC,KAA9C,GAAuEL,KAAvE,CAA8CK,KAA9C;MAAwDC,UAAxD,iCAAuEN,KAAvE;;EACA,mBAAmDO,WAAW,CAACD,UAAD,EAAaL,GAAb,CAA9D;MAAQO,QAAR,gBAAQA,QAAR;MAAkBC,MAAlB,gBAAkBA,MAAlB;MAA0BC,KAA1B,gBAA0BA,KAA1B;MAAiCC,OAAjC,gBAAiCA,OAAjC;MAA0CC,IAA1C,gBAA0CA,IAA1C;;EACA,IAAMC,WAAW,GAAGd,MAAA,CAA6B,IAA7B,CAApB;;EACA,uBAAkBe,eAAe,EAAjC;MAAQC,KAAR,oB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CADJ,CADJ,EAqCIxC,aAAA,CAACqB,OAAD;IACIoB,KAAK,EAAC;IACNC,eAAe,EAAE,yBAAAL,KAAK;MAClBA,KAAK,CAACC,cAAN;;IAEJK,UAAU,EAAE;GALhB,EAOI3C,aAAA,CAAC4C,cAAD,oBACQ/B;IACJT,SAAS,EAAEe,EAAE,CAAC,uEAAD;IACbb,KAAK,EAAE;MAAEuC,QAAQ,EAAE5B,gBAAF,aAAEA,gBAAF,uBAAEA,gBAAgB,CAAE6B;;IACrCb,QAAQ,EAAErB,OAAO,CAACgB,IAAR,GAAe,CAAf,GAAmB,CAAC;IAJlC,CAPJ,CArCJ,CADJ,CADJ;AAwDH,CAtEuB;;;;"}
1
+ {"version":3,"file":"Combobox.js","sources":["../../../../src/components/Combobox/Combobox.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport { Input, InputProps } from '../Input/Input';\nimport { useCombobox } from './useCombobox';\nimport { ScrollableList, ScrollableListItem, ScrollableListItemValue } from '../Listbox/ScrollableList';\nimport { useBoundingClientRectListener } from '../../utils/hooks/useBoundingClientRectListener';\nimport { IconButton } from '../IconButton/IconButton';\nimport './Combobox.css';\nimport { DialogProps } from '../Dialog/Dialog';\nimport { useLocalization } from '../Provider/Provider';\n\nexport type ComboboxTexts = {\n /* Tooltip shown for the dialog button */\n tooltip: string;\n};\n\nexport type ComboboxItem = ScrollableListItem;\nexport type ComboboxValue = ScrollableListItemValue;\n\ntype ComboboxBaseProps = Omit<InputProps, 'defaultValue' | 'button' | 'onChange' | 'value'> & {\n /** Array of options in combobox */\n data?: ComboboxItem[];\n /**\n * Initial value of the input in combobox.\n * This is used when combobox is mounted, if no value is provided.\n * *Note* that combobox is a controlled component, setting this will also trigger the `onChange` event\n */\n defaultValue?: ComboboxValue;\n /** Set what value should have an empty option in combobox */\n emptyValue?: ComboboxValue;\n /** Draws attention to the combobox by changing its style and making it visually prominent */\n highlighted?: boolean;\n /** Displays loading state in listbox */\n loading?: boolean;\n /**\n * Handler called when user chooses an option from the provided suggestions.\n * Suggestions will be calculated based on the input value.\n * There are two ways to choose an option: either click on it, or navigate using keyboard and press `enter`\n */\n onChange?: React.ChangeEventHandler<HTMLInputElement>;\n /** Handler called when the user enters a query **/\n onSearch?: (query: string) => void | Promise<void>;\n /** Value of the input in combobox */\n value?: ComboboxValue;\n};\n\ninterface InlineComboboxProps extends ComboboxBaseProps {\n dialog?: never;\n /**\n * Combobox will display its data when input is clicked/focused, even if the input is empty.\n * *Note* that default combobox will display matching data only when user starts typing in input.\n */\n inline: boolean; // Example 3 on https://www.w3.org/TR/wai-aria-practices/examples/combobox/aria1.1pattern/listbox-combo.html\n}\n\ninterface DialogComboboxProps extends ComboboxBaseProps {\n dialog: (props: Partial<DialogProps>) => JSX.Element;\n inline?: never;\n}\n\nexport type ComboboxProps = InlineComboboxProps | DialogComboboxProps;\n\nexport const Combobox = React.forwardRef(function Combobox(props: ComboboxProps, ref: React.Ref<HTMLInputElement>) {\n const { className: externalClassName, dialog, style, ...otherProps } = props;\n const { combobox, button, input, popover, list } = useCombobox(otherProps, ref);\n const internalRef = React.useRef<HTMLDivElement>(null);\n const { texts } = useLocalization();\n const selectDimensions = useBoundingClientRectListener(internalRef);\n const className = cn(\n 'inline-flex relative',\n {\n 'yt-combobox--inline': props.inline,\n },\n externalClassName\n );\n\n return (\n <span className={className} data-taco=\"combobox\" style={style}>\n <PopoverPrimitive.Root {...popover}>\n <PopoverPrimitive.Anchor asChild ref={internalRef}>\n <div {...combobox} className=\"inline w-full\" ref={ref}>\n <Input\n {...input}\n autoComplete=\"off\"\n button={\n props.inline ? (\n <IconButton\n appearance=\"discrete\"\n className=\"!border-l-0 focus:!border-none focus:!shadow-none active:!border-none\"\n icon={popover.open ? 'chevron-up' : 'chevron-down'}\n onClick={() => {\n popover.onOpenChange(true);\n input.ref.current?.focus();\n }}\n tabIndex={-1}\n />\n ) : dialog ? (\n <IconButton\n aria-label={texts.combobox.tooltip}\n icon=\"list-search\"\n disabled={props.readOnly || props.disabled}\n dialog={dialog}\n onFocus={(event: React.FocusEvent<HTMLButtonElement>) => {\n // Prevents the default focus behaviour of showing the tooltip, on parent tooltip element\n event.preventDefault();\n input.ref.current?.focus();\n }}\n ref={button.ref}\n tabIndex={-1}\n tooltip={texts.combobox.tooltip}\n />\n ) : undefined\n }\n />\n </div>\n </PopoverPrimitive.Anchor>\n <PopoverPrimitive.Content\n align=\"start\"\n onOpenAutoFocus={event => {\n event.preventDefault();\n }}\n sideOffset={4}\n >\n <ScrollableList\n {...list}\n className={cn('!border-blue max-h-[calc(12rem+2px)] w-auto max-w-[theme(spacing.96)]')}\n style={{ minWidth: selectDimensions?.width }}\n tabIndex={popover.open ? 0 : -1}\n />\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Root>\n </span>\n );\n});\n"],"names":["Combobox","React","props","ref","externalClassName","className","dialog","style","otherProps","useCombobox","combobox","button","input","popover","list","internalRef","useLocalization","texts","selectDimensions","useBoundingClientRectListener","cn","inline","PopoverPrimitive","asChild","Input","autoComplete","IconButton","appearance","icon","open","onClick","onOpenChange","current","focus","tabIndex","tooltip","disabled","readOnly","onFocus","event","preventDefault","undefined","align","onOpenAutoFocus","sideOffset","ScrollableList","minWidth","width"],"mappings":";;;;;;;;;;;;IA+DaA,QAAQ,gBAAGC,UAAA,CAAiB,SAASD,QAAT,CAAkBE,KAAlB,EAAwCC,GAAxC;EACrC,IAAmBC,iBAAnB,GAAuEF,KAAvE,CAAQG,SAAR;MAAsCC,MAAtC,GAAuEJ,KAAvE,CAAsCI,MAAtC;MAA8CC,KAA9C,GAAuEL,KAAvE,CAA8CK,KAA9C;MAAwDC,UAAxD,iCAAuEN,KAAvE;;EACA,mBAAmDO,WAAW,CAACD,UAAD,EAAaL,GAAb,CAA9D;MAAQO,QAAR,gBAAQA,QAAR;MAAkBC,MAAlB,gBAAkBA,MAAlB;MAA0BC,KAA1B,gBAA0BA,KAA1B;MAAi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KAAK,CAACT,GAAN,CAAU6B,OAAV,4EAAmBC,KAAnB;;MAEJ9B,GAAG,EAAEQ,MAAM,CAACR;MACZ+B,QAAQ,EAAE,CAAC;MACXC,OAAO,EAAElB,KAAK,CAACP,QAAN,CAAeyB;KAZ5B,CADM,GAeNM;IA9BZ,CADJ,CADJ,CADJ,EAsCIxC,aAAA,CAACqB,OAAD;IACIoB,KAAK,EAAC;IACNC,eAAe,EAAE,yBAAAJ,KAAK;MAClBA,KAAK,CAACC,cAAN;;IAEJI,UAAU,EAAE;GALhB,EAOI3C,aAAA,CAAC4C,cAAD,oBACQ/B;IACJT,SAAS,EAAEe,EAAE,CAAC,uEAAD;IACbb,KAAK,EAAE;MAAEuC,QAAQ,EAAE5B,gBAAF,aAAEA,gBAAF,uBAAEA,gBAAgB,CAAE6B;;IACrCb,QAAQ,EAAErB,OAAO,CAACgB,IAAR,GAAe,CAAf,GAAmB,CAAC;IAJlC,CAPJ,CAtCJ,CADJ,CADJ;AAyDH,CAvEuB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useCombobox.js","sources":["../../../../src/components/Combobox/useCombobox.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport keycode from 'keycode';\r\nimport { v4 as uuid } from 'uuid';\r\nimport debounce from 'lodash/debounce';\r\nimport { ComboboxProps } from './Combobox';\r\nimport {\r\n setInputValueByRef,\r\n getIndexFromValue,\r\n findByValue,\r\n useFlattenedData,\r\n sanitizeItem,\r\n getOptionParents,\r\n filterData,\r\n} from '../Listbox/util';\r\nimport { createCustomKeyboardEvent } from '../../utils/input';\r\nimport { useProxiedRef } from '../../utils/hooks/useProxiedRef';\r\nimport { getId, ScrollableListItemValue, ScrollableListPropsWithRef } from '../Listbox/ScrollableList';\r\n\r\nconst debouncer = debounce(f => f(), 200);\r\n\r\nconst convertToInputValue = (value: ScrollableListItemValue | undefined) => String(value ?? '');\r\n\r\ntype useCombobox = React.HTMLAttributes<HTMLDivElement> & {\r\n combobox: React.HTMLAttributes<HTMLSpanElement>;\r\n input: Omit<React.InputHTMLAttributes<HTMLInputElement>, 'defaultValue'> & { ref: React.RefObject<HTMLInputElement> };\r\n list: ScrollableListPropsWithRef;\r\n button: { ref: any };\r\n popover: { open: boolean; onOpenChange: (open: boolean) => void };\r\n};\r\n\r\nexport const useCombobox = (\r\n {\r\n 'aria-label': ariaLabel,\r\n 'aria-labelledby': ariaLabelledBy,\r\n data: unfilteredData = [],\r\n defaultValue,\r\n disabled,\r\n id: nativeId,\r\n inline,\r\n loading: __,\r\n onChange,\r\n onClick,\r\n onKeyDown,\r\n onSearch,\r\n readOnly,\r\n value,\r\n ...props\r\n }: Omit<ComboboxProps, 'dialog'>,\r\n ref: React.Ref<HTMLInputElement>\r\n): useCombobox => {\r\n const inputRef = useProxiedRef<HTMLInputElement>(ref);\r\n const buttonRef = React.useRef<HTMLButtonElement>(null);\r\n const listRef = React.useRef<HTMLUListElement>(null);\r\n const [open, setOpen] = React.useState(false);\r\n const listId = React.useMemo(() => uuid(), []);\r\n const [inputValue, setInputValue] = React.useState<string>(convertToInputValue(value));\r\n const shouldFilterData = !onSearch && (!inline || (inline && inputValue !== convertToInputValue(value)));\r\n const flattenedData = useFlattenedData(unfilteredData);\r\n const data = React.useMemo(\r\n () => (shouldFilterData ? filterData(flattenedData, inputValue) : flattenedData),\r\n [shouldFilterData, inputValue, flattenedData]\r\n );\r\n // listbox/select change value _with_ the index, but combobox changes on select of an index (click/enter), so we need state\r\n const [currentIndex, setCurrentIndex] = React.useState<number | undefined>(\r\n inputValue !== undefined ? getIndexFromValue(data, inputValue) : undefined\r\n );\r\n\r\n const setInputValueByIndex = (index: number | undefined): void => {\r\n if (index !== undefined) {\r\n const option = data[index];\r\n\r\n if (option && !option.disabled) {\r\n setInputValueByRef(inputRef.current, option.value, 'focusout');\r\n }\r\n }\r\n };\r\n\r\n const setCurrentValue = (index: number | undefined) => {\r\n if (index === undefined) {\r\n return;\r\n }\r\n\r\n const option = data[index];\r\n\r\n // if the selected option is not already selected, trigger blur event\r\n if (option.value !== value) {\r\n setInputValueByIndex(index);\r\n } else {\r\n // if the selected option is already selected, refill input with its value\r\n setInputValue(convertToInputValue(value));\r\n }\r\n };\r\n\r\n // ensure the external value is synced with the internal value when mounting, e.g. incase a default value was set\r\n React.useEffect(() => {\r\n if (defaultValue && !value) {\r\n setInputValueByIndex(getIndexFromValue(data, defaultValue));\r\n }\r\n }, [data]);\r\n\r\n // update input value if it changed 'externally', e.g. clicking/entering an item in the listbox, from a modal etc\r\n React.useEffect(() => {\r\n if (value !== undefined && value !== inputValue) {\r\n setInputValue(convertToInputValue(value));\r\n }\r\n }, [value]);\r\n\r\n React.useEffect(() => {\r\n if (onSearch) {\r\n debouncer(() => {\r\n onSearch(inputValue);\r\n });\r\n }\r\n }, [inputValue]);\r\n\r\n // show listbox based on input value\r\n React.useEffect(() => {\r\n // don't show the popover if the internal (input) value already is the current value\r\n // this prevents the popover showing after selecting a value or pressing escape\r\n const isCurrentValue = value !== undefined && value !== null && inputValue === String(value);\r\n\r\n if (inputValue && data.length && !isCurrentValue) {\r\n setCurrentIndex(0);\r\n\r\n if (!open) {\r\n setOpen(true);\r\n }\r\n } else {\r\n setOpen(false);\r\n }\r\n }, [inputValue, data]);\r\n\r\n React.useEffect(() => {\r\n if (open) {\r\n setCurrentIndex(getIndexFromValue(data, inputValue) || 0);\r\n } else {\r\n setCurrentIndex(undefined);\r\n }\r\n }, [open]);\r\n\r\n // event handlers\r\n const handleInputBlur = (event: React.FocusEvent<HTMLInputElement>): void => {\r\n event.persist();\r\n\r\n if (event.relatedTarget === listRef.current) {\r\n event.preventDefault();\r\n return;\r\n }\r\n\r\n if (onChange && event.target.value !== value) {\r\n const item = findByValue(flattenedData, event.target.value);\r\n (event as any).detail = sanitizeItem(item);\r\n\r\n const parents = getOptionParents(flattenedData, item?.path);\r\n\r\n if (parents !== null && parents.length > 0) {\r\n (event as any).detail.parents = parents;\r\n }\r\n\r\n onChange(event);\r\n }\r\n\r\n if (props.onBlur) {\r\n props.onBlur(event);\r\n }\r\n };\r\n\r\n const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>): void => {\r\n setInputValue(event.target.value);\r\n };\r\n\r\n const handleInputClick = (event: React.MouseEvent<HTMLInputElement>): void => {\r\n if (inline || (!open && inputValue && data.length)) {\r\n setOpen(true);\r\n }\r\n\r\n if (onClick) {\r\n event.persist();\r\n onClick(event);\r\n }\r\n };\r\n\r\n const handleInputKeyDown = (event: React.KeyboardEvent<HTMLInputElement>): void => {\r\n event.persist();\r\n\r\n switch (event.keyCode) {\r\n case keycode('backspace'): {\r\n return;\r\n }\r\n\r\n case keycode('escape'): {\r\n event.preventDefault();\r\n setInputValue(convertToInputValue(value));\r\n setOpen(false);\r\n return;\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\r\n setCurrentValue(currentIndex);\r\n setOpen(false);\r\n return;\r\n }\r\n\r\n case keycode('down'):\r\n if (open) {\r\n event.preventDefault();\r\n } else {\r\n if (!inline && buttonRef.current) {\r\n buttonRef.current.click();\r\n }\r\n }\r\n break;\r\n\r\n case keycode('up'):\r\n case keycode('home'):\r\n case keycode('end'): {\r\n if (open) {\r\n event.preventDefault();\r\n }\r\n break;\r\n }\r\n\r\n default:\r\n }\r\n\r\n // we aren't focused on the list, so manually forward the keydown event to it\r\n if (listRef.current) {\r\n listRef.current.dispatchEvent(createCustomKeyboardEvent(event));\r\n }\r\n\r\n if (inline && !open) {\r\n if (event.keyCode === keycode('up') || event.keyCode === keycode('down')) {\r\n event.preventDefault();\r\n const initialIndex = event.keyCode === keycode('up') ? data.length - 1 : 0;\r\n setCurrentIndex(currentIndex !== undefined ? currentIndex : initialIndex);\r\n setOpen(true);\r\n }\r\n }\r\n\r\n if (!event.isDefaultPrevented() && onKeyDown) {\r\n event.persist();\r\n onKeyDown(event);\r\n }\r\n };\r\n\r\n const handleListboxChange = (index: number): void => {\r\n setCurrentIndex(index);\r\n };\r\n\r\n const handleListboxClick = (event: React.MouseEvent<HTMLLIElement>, index: number): void => {\r\n event.preventDefault();\r\n setCurrentValue(index);\r\n setOpen(false);\r\n };\r\n\r\n const combobox = {\r\n 'aria-expanded': open,\r\n 'aria-owns': listId,\r\n 'aria-haspopup': 'listbox' as const,\r\n role: 'combobox',\r\n };\r\n\r\n const input = {\r\n ...props,\r\n 'aria-controls': listId,\r\n // Indicates that the autocomplete behavior of the text input is to suggest a list of possible values in a popup and that the suggestions\r\n // are related to the string that is present in the textbox\r\n 'aria-autocomplete': 'list' as const,\r\n // Enables assistive technologies to know which element the application regards as focused while DOM focus remains on the input element\r\n 'aria-activedescendant':\r\n currentIndex !== undefined && data[currentIndex] ? getId(listId, String(data[currentIndex].value)) : undefined,\r\n 'aria-labelledby': ariaLabelledBy,\r\n disabled,\r\n onBlur: !disabled && !readOnly ? handleInputBlur : undefined,\r\n onChange: !disabled && !readOnly ? handleInputChange : undefined,\r\n onClick: !disabled && !readOnly ? handleInputClick : undefined,\r\n onKeyDown: !disabled && !readOnly ? handleInputKeyDown : undefined,\r\n readOnly,\r\n ref: inputRef,\r\n type: 'text',\r\n value: inputValue ?? '',\r\n };\r\n\r\n const list: ScrollableListPropsWithRef = {\r\n 'aria-labelledby': ariaLabelledBy,\r\n data,\r\n disabled,\r\n id: listId,\r\n onChange: handleListboxChange,\r\n onClick: handleListboxClick,\r\n ref: listRef,\r\n scrollOnFocus: false,\r\n tabIndex: -1,\r\n value: currentIndex,\r\n };\r\n\r\n const button = {\r\n ref: buttonRef,\r\n };\r\n\r\n return {\r\n combobox,\r\n input,\r\n list,\r\n button,\r\n popover: {\r\n open,\r\n onOpenChange: setOpen,\r\n //visible: !data.length ? false : open,\r\n },\r\n };\r\n};\r\n"],"names":["debouncer","debounce","f","convertToInputValue","value","String","useCombobox","ariaLabel","ariaLabelledBy","data","unfilteredData","defaultValue","disabled","id","nativeId","inline","loading","__","onChange","onClick","onKeyDown","onSearch","readOnly","props","ref","inputRef","useProxiedRef","buttonRef","React","listRef","open","setOpen","listId","uuid","inputValue","setInputValue","shouldFilterData","flattenedData","useFlattenedData","filterData","currentIndex","setCurrentIndex","undefined","getIndexFromValue","setInputValueByIndex","index","option","setInputValueByRef","current","setCurrentValue","isCurrentValue","length","handleInputBlur","event","persist","relatedTarget","preventDefault","target","item","findByValue","detail","sanitizeItem","parents","getOptionParents","path","onBlur","handleInputChange","handleInputClick","handleInputKeyDown","keyCode","keycode","click","dispatchEvent","createCustomKeyboardEvent","initialIndex","isDefaultPrevented","handleListboxChange","handleListboxClick","combobox","role","input","getId","type","list","scrollOnFocus","tabIndex","button","popover","onOpenChange"],"mappings":";;;;;;;;;AAkBA,MAAMA,SAAS,gBAAGC,QAAQ,CAACC,CAAC,IAAIA,CAAC,EAAP,EAAW,GAAX,CAA1B;;AAEA,MAAMC,mBAAmB,GAAIC,KAAD,IAAgDC,MAAM,CAACD,KAAD,aAACA,KAAD,cAACA,KAAD,GAAU,EAAV,CAAlF;;MAUaE,WAAW,GAAG,CACvB;EACI,cAAcC,SADlB;EAEI,mBAAmBC,cAFvB;EAGIC,IAAI,EAAEC,cAAc,GAAG,EAH3B;EAIIC,YAJJ;EAKIC,QALJ;EAMIC,EAAE,EAAEC,QANR;EAOIC,MAPJ;EAQIC,OAAO,EAAEC,EARb;EASIC,QATJ;EAUIC,OAVJ;EAWIC,SAXJ;EAYIC,QAZJ;EAaIC,QAbJ;EAcIlB,KAdJ;EAeI,GAAGmB;AAfP,CADuB,EAkBvBC,GAlBuB;EAoBvB,MAAMC,QAAQ,GAAGC,aAAa,CAAmBF,GAAnB,CAA9B;EACA,MAAMG,SAAS,GAAGC,MAAA,CAAgC,IAAhC,CAAlB;EACA,MAAMC,OAAO,GAAGD,MAAA,CAA+B,IAA/B,CAAhB;EACA,MAAM,CAACE,IAAD,EAAOC,OAAP,IAAkBH,QAAA,CAAe,KAAf,CAAxB;EACA,MAAMI,MAAM,GAAGJ,OAAA,CA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AAD,IAAa,CAACU,QAAd,GAAyB8C,kBAAzB,GAA8C1B,SAd/C;IAeVpB,QAfU;IAgBVE,GAAG,EAAEC,QAhBK;IAiBVyD,IAAI,EAAE,MAjBI;IAkBV9E,KAAK,EAAE8B,UAAF,aAAEA,UAAF,cAAEA,UAAF,GAAgB;GAlBzB;EAqBA,MAAMiD,IAAI,GAA+B;IACrC,mBAAmB3E,cADkB;IAErCC,IAFqC;IAGrCG,QAHqC;IAIrCC,EAAE,EAAEmB,MAJiC;IAKrCd,QAAQ,EAAE0D,mBAL2B;IAMrCzD,OAAO,EAAE0D,kBAN4B;IAOrCrD,GAAG,EAAEK,OAPgC;IAQrCuD,aAAa,EAAE,KARsB;IASrCC,QAAQ,EAAE,CAAC,CAT0B;IAUrCjF,KAAK,EAAEoC;GAVX;EAaA,MAAM8C,MAAM,GAAG;IACX9D,GAAG,EAAEG;GADT;EAIA,OAAO;IACHmD,QADG;IAEHE,KAFG;IAGHG,IAHG;IAIHG,MAJG;IAKHC,OAAO,EAAE;MACLzD,IADK;MAEL0D,YAAY,EAAEzD;;GAPtB;AAWH;;;;"}
1
+ {"version":3,"file":"useCombobox.js","sources":["../../../../src/components/Combobox/useCombobox.tsx"],"sourcesContent":["import * as React from 'react';\nimport keycode from 'keycode';\nimport { v4 as uuid } from 'uuid';\nimport debounce from 'lodash/debounce';\nimport { ComboboxProps } from './Combobox';\nimport {\n setInputValueByRef,\n getIndexFromValue,\n findByValue,\n useFlattenedData,\n sanitizeItem,\n getOptionParents,\n filterData,\n} from '../Listbox/util';\nimport { createCustomKeyboardEvent } from '../../utils/input';\nimport { useProxiedRef } from '../../utils/hooks/useProxiedRef';\nimport { getId, ScrollableListItemValue, ScrollableListPropsWithRef } from '../Listbox/ScrollableList';\n\nconst debouncer = debounce(f => f(), 200);\n\nconst convertToInputValue = (value: ScrollableListItemValue | undefined) => String(value ?? '');\n\ntype useCombobox = React.HTMLAttributes<HTMLDivElement> & {\n combobox: React.HTMLAttributes<HTMLSpanElement>;\n input: Omit<React.InputHTMLAttributes<HTMLInputElement>, 'defaultValue'> & { ref: React.RefObject<HTMLInputElement> };\n list: ScrollableListPropsWithRef;\n button: { ref: any };\n popover: { open: boolean; onOpenChange: (open: boolean) => void };\n};\n\nexport const useCombobox = (\n {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n data: unfilteredData = [],\n defaultValue,\n disabled,\n id: nativeId,\n inline,\n loading: __,\n onChange,\n onClick,\n onKeyDown,\n onSearch,\n readOnly,\n value,\n ...props\n }: Omit<ComboboxProps, 'dialog'>,\n ref: React.Ref<HTMLInputElement>\n): useCombobox => {\n const inputRef = useProxiedRef<HTMLInputElement>(ref);\n const buttonRef = React.useRef<HTMLButtonElement>(null);\n const listRef = React.useRef<HTMLUListElement>(null);\n const [open, setOpen] = React.useState(false);\n const listId = React.useMemo(() => uuid(), []);\n const [inputValue, setInputValue] = React.useState<string>(convertToInputValue(value));\n const shouldFilterData = !onSearch && (!inline || (inline && inputValue !== convertToInputValue(value)));\n const flattenedData = useFlattenedData(unfilteredData);\n const data = React.useMemo(\n () => (shouldFilterData ? filterData(flattenedData, inputValue) : flattenedData),\n [shouldFilterData, inputValue, flattenedData]\n );\n // listbox/select change value _with_ the index, but combobox changes on select of an index (click/enter), so we need state\n const [currentIndex, setCurrentIndex] = React.useState<number | undefined>(\n inputValue !== undefined ? getIndexFromValue(data, inputValue) : undefined\n );\n\n const setInputValueByIndex = (index: number | undefined): void => {\n if (index !== undefined) {\n const option = data[index];\n\n if (option && !option.disabled) {\n setInputValueByRef(inputRef.current, option.value, 'focusout');\n }\n }\n };\n\n const setCurrentValue = (index: number | undefined) => {\n if (index === undefined) {\n return;\n }\n\n const option = data[index];\n\n // if the selected option is not already selected, trigger blur event\n if (option.value !== value) {\n setInputValueByIndex(index);\n } else {\n // if the selected option is already selected, refill input with its value\n setInputValue(convertToInputValue(value));\n }\n };\n\n // ensure the external value is synced with the internal value when mounting, e.g. incase a default value was set\n React.useEffect(() => {\n if (defaultValue && !value) {\n setInputValueByIndex(getIndexFromValue(data, defaultValue));\n }\n }, [data]);\n\n // update input value if it changed 'externally', e.g. clicking/entering an item in the listbox, from a modal etc\n React.useEffect(() => {\n if (value !== undefined && value !== inputValue) {\n setInputValue(convertToInputValue(value));\n }\n }, [value]);\n\n React.useEffect(() => {\n if (onSearch) {\n debouncer(() => {\n onSearch(inputValue);\n });\n }\n }, [inputValue]);\n\n // show listbox based on input value\n React.useEffect(() => {\n // don't show the popover if the internal (input) value already is the current value\n // this prevents the popover showing after selecting a value or pressing escape\n const isCurrentValue = value !== undefined && value !== null && inputValue === String(value);\n\n if (inputValue && data.length && !isCurrentValue) {\n setCurrentIndex(0);\n\n if (!open) {\n setOpen(true);\n }\n } else {\n setOpen(false);\n }\n }, [inputValue, data]);\n\n React.useEffect(() => {\n if (open) {\n setCurrentIndex(getIndexFromValue(data, inputValue) || 0);\n } else {\n setCurrentIndex(undefined);\n }\n }, [open]);\n\n // event handlers\n const handleInputBlur = (event: React.FocusEvent<HTMLInputElement>): void => {\n event.persist();\n\n if (event.relatedTarget === listRef.current) {\n event.preventDefault();\n return;\n }\n\n if (onChange && event.target.value !== value) {\n const item = findByValue(flattenedData, event.target.value);\n (event as any).detail = sanitizeItem(item);\n\n const parents = getOptionParents(flattenedData, item?.path);\n\n if (parents !== null && parents.length > 0) {\n (event as any).detail.parents = parents;\n }\n\n onChange(event);\n }\n\n if (props.onBlur) {\n props.onBlur(event);\n }\n };\n\n const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>): void => {\n setInputValue(event.target.value);\n };\n\n const handleInputClick = (event: React.MouseEvent<HTMLInputElement>): void => {\n if (inline || (!open && inputValue && data.length)) {\n setOpen(true);\n }\n\n if (onClick) {\n event.persist();\n onClick(event);\n }\n };\n\n const handleInputKeyDown = (event: React.KeyboardEvent<HTMLInputElement>): void => {\n event.persist();\n\n switch (event.keyCode) {\n case keycode('backspace'): {\n return;\n }\n\n case keycode('escape'): {\n event.preventDefault();\n setInputValue(convertToInputValue(value));\n setOpen(false);\n return;\n }\n\n case keycode('tab'):\n case keycode('enter'): {\n if (event.keyCode !== keycode('tab')) {\n event.preventDefault();\n }\n\n setCurrentValue(currentIndex);\n setOpen(false);\n return;\n }\n\n case keycode('down'):\n if (open) {\n event.preventDefault();\n } else {\n if (!inline && buttonRef.current) {\n buttonRef.current.click();\n }\n }\n break;\n\n case keycode('up'):\n case keycode('home'):\n case keycode('end'): {\n if (open) {\n event.preventDefault();\n }\n break;\n }\n\n default:\n }\n\n // we aren't focused on the list, so manually forward the keydown event to it\n if (listRef.current) {\n listRef.current.dispatchEvent(createCustomKeyboardEvent(event));\n }\n\n if (inline && !open) {\n if (event.keyCode === keycode('up') || event.keyCode === keycode('down')) {\n event.preventDefault();\n const initialIndex = event.keyCode === keycode('up') ? data.length - 1 : 0;\n setCurrentIndex(currentIndex !== undefined ? currentIndex : initialIndex);\n setOpen(true);\n }\n }\n\n if (!event.isDefaultPrevented() && onKeyDown) {\n event.persist();\n onKeyDown(event);\n }\n };\n\n const handleListboxChange = (index: number): void => {\n setCurrentIndex(index);\n };\n\n const handleListboxClick = (event: React.MouseEvent<HTMLLIElement>, index: number): void => {\n event.preventDefault();\n setCurrentValue(index);\n setOpen(false);\n };\n\n const combobox = {\n 'aria-expanded': open,\n 'aria-owns': listId,\n 'aria-haspopup': 'listbox' as const,\n role: 'combobox',\n };\n\n const input = {\n ...props,\n 'aria-controls': listId,\n // Indicates that the autocomplete behavior of the text input is to suggest a list of possible values in a popup and that the suggestions\n // are related to the string that is present in the textbox\n 'aria-autocomplete': 'list' as const,\n // Enables assistive technologies to know which element the application regards as focused while DOM focus remains on the input element\n 'aria-activedescendant':\n currentIndex !== undefined && data[currentIndex] ? getId(listId, String(data[currentIndex].value)) : undefined,\n 'aria-labelledby': ariaLabelledBy,\n disabled,\n onBlur: !disabled && !readOnly ? handleInputBlur : undefined,\n onChange: !disabled && !readOnly ? handleInputChange : undefined,\n onClick: !disabled && !readOnly ? handleInputClick : undefined,\n onKeyDown: !disabled && !readOnly ? handleInputKeyDown : undefined,\n readOnly,\n ref: inputRef,\n type: 'text',\n value: inputValue ?? '',\n };\n\n const list: ScrollableListPropsWithRef = {\n 'aria-labelledby': ariaLabelledBy,\n data,\n disabled,\n id: listId,\n onChange: handleListboxChange,\n onClick: handleListboxClick,\n ref: listRef,\n scrollOnFocus: false,\n tabIndex: -1,\n value: currentIndex,\n };\n\n const button = {\n ref: buttonRef,\n };\n\n return {\n combobox,\n input,\n list,\n button,\n popover: {\n open,\n onOpenChange: setOpen,\n //visible: !data.length ? false : open,\n },\n };\n};\n"],"names":["debouncer","debounce","f","convertToInputValue","value","String","useCombobox","ariaLabel","ariaLabelledBy","data","unfilteredData","defaultValue","disabled","id","nativeId","inline","loading","__","onChange","onClick","onKeyDown","onSearch","readOnly","props","ref","inputRef","useProxiedRef","buttonRef","React","listRef","open","setOpen","listId","uuid","inputValue","setInputValue","shouldFilterData","flattenedData","useFlattenedData","filterData","currentIndex","setCurrentIndex","undefined","getIndexFromValue","setInputValueByIndex","index","option","setInputValueByRef","current","setCurrentValue","isCurrentValue","length","handleInputBlur","event","persist","relatedTarget","preventDefault","target","item","findByValue","detail","sanitizeItem","parents","getOptionParents","path","onBlur","handleInputChange","handleInputClick","handleInputKeyDown","keyCode","keycode","click","dispatchEvent","createCustomKeyboardEvent","initialIndex","isDefaultPrevented","handleListboxChange","handleListboxClick","combobox","role","input","getId","type","list","scrollOnFocus","tabIndex","button","popover","onOpenChange"],"mappings":";;;;;;;;;AAkBA,MAAMA,SAAS,gBAAGC,QAAQ,CAACC,CAAC,IAAIA,CAAC,EAAP,EAAW,GAAX,CAA1B;;AAEA,MAAMC,mBAAmB,GAAIC,KAAD,IAAgDC,MAAM,CAACD,KAAD,aAACA,KAAD,cAACA,KAAD,GAAU,EAAV,CAAlF;;MAUaE,WAAW,GAAG,CACvB;EACI,cAAcC,SADlB;EAEI,mBAAmBC,cAFvB;EAGIC,IAAI,EA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,"file":"Datepicker.js","sources":["../../../../src/components/Datepicker/Datepicker.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport cn from 'classnames';\r\nimport { Calendar, CalendarProps } from '../Calendar/Calendar';\r\nimport { Input, InputProps } from '../Input/Input';\r\nimport { useLocalization } from '../Provider/Provider';\r\nimport { useDatepicker } from './useDatepicker';\r\nimport { IconButton } from '../IconButton/IconButton';\r\nimport { Popover } from '../Popover/Popover';\r\n\r\nexport type DatepickerTexts = {\r\n /** Aria-label for calendar */\r\n calendar: string;\r\n /** Clear button text */\r\n clear: string;\r\n /**\r\n * Aria-label for calendar icon button in the input.\r\n * Calendar will open when user clicks this icon button.\r\n */\r\n expand: string;\r\n /** Shortcut heading text */\r\n shortcuts: string;\r\n};\r\n\r\nexport type DatepickerProps = Omit<InputProps, 'value'> & {\r\n /** [Calendar](component:calendar) component associated with the DatePicker */\r\n calendar?: CalendarProps;\r\n /** List of shortcuts */\r\n shortcuts?: any;\r\n /** Title for the shortcuts panel */\r\n shortcutsText?: string;\r\n /** Handler to be called when the clear button is clicked */\r\n onReset?: (event: React.MouseEvent<HTMLButtonElement>) => void;\r\n /**\r\n * Date value of the calendar.\r\n * This will be displayed in DatePicker's input in the format given to the [Provider](component:provider) component\r\n */\r\n value?: Date;\r\n};\r\n\r\nexport const Datepicker = React.forwardRef(function Datepicker(props: DatepickerProps, ref: React.Ref<HTMLInputElement>) {\r\n const { className: externalClassName, onReset: handleReset, style, shortcuts, shortcutsText, ...otherProps } = props;\r\n const { calendar, input } = useDatepicker(otherProps, ref);\r\n const { texts } = useLocalization();\r\n const className = cn('inline-flex w-full text-black font-normal', externalClassName);\r\n\r\n return (\r\n <span className={className} data-taco=\"datepicker\" style={style}>\r\n <Input\r\n {...input}\r\n button={\r\n <Popover>\r\n <Popover.Trigger>\r\n <IconButton\r\n aria-label={texts.datepicker.expand}\r\n disabled={input.disabled || input.readOnly}\r\n icon=\"calendar\"\r\n />\r\n </Popover.Trigger>\r\n <Popover.Content>\r\n {({ close }) => (\r\n <div className=\"-m-3 flex\">\r\n <Calendar\r\n {...calendar}\r\n onChange={(date: Date, event?: React.MouseEvent<HTMLDivElement>) => {\r\n calendar.onChange(date, event);\r\n close();\r\n }}\r\n tabIndex={-1}\r\n />\r\n {shortcuts && (\r\n <div className=\"border-grey-dark flex flex-col border-l\">\r\n <span className=\"m-4 mb-3 flex h-8 w-32 items-center text-xs font-semibold\">\r\n {shortcutsText ?? texts.datepicker.shortcuts}\r\n </span>\r\n <ul>\r\n {shortcuts.map((shortcut, i) => (\r\n <li key={i}>\r\n <button\r\n className=\"hover:bg-grey-light flex w-full items-start px-4 py-1 text-xs\"\r\n onClick={event => {\r\n event.persist();\r\n shortcut.onClick(event);\r\n close();\r\n }}\r\n >\r\n {shortcut.text}\r\n </button>\r\n </li>\r\n ))}\r\n </ul>\r\n {handleReset && (\r\n <button\r\n className=\"text-blue hover:text-blue-light my-4 mx-auto mt-auto inline-flex cursor-pointer border-none bg-transparent text-xs\"\r\n onClick={event => {\r\n event.persist();\r\n handleReset(event);\r\n close();\r\n }}\r\n >\r\n {texts.datepicker.clear}\r\n </button>\r\n )}\r\n </div>\r\n )}\r\n </div>\r\n )}\r\n </Popover.Content>\r\n </Popover>\r\n }\r\n />\r\n </span>\r\n );\r\n});\r\n"],"names":["Datepicker","React","props","ref","externalClassName","className","handleReset","onReset","style","shortcuts","shortcutsText","otherProps","useDatepicker","calendar","input","useLocalization","texts","cn","Input","button","Popover","Trigger","IconButton","datepicker","expand","disabled","readOnly","icon","Content","close","Calendar","onChange","date","event","tabIndex","map","shortcut","i","key","onClick","persist","text","clear"],"mappings":";;;;;;;;;;;IAuCaA,UAAU,gBAAGC,UAAA,CAAiB,SAASD,UAAT,CAAoBE,KAApB,EAA4CC,GAA5C;EACvC,IAAmBC,iBAAnB,GAA+GF,KAA/G,CAAQG,SAAR;MAA+CC,WAA/C,GAA+GJ,KAA/G,CAAsCK,OAAtC;MAA4DC,KAA5D,GAA+GN,KAA/G,CA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AAiBd,SADvC,CADJ,EAIIR,aAAA,KAAA,MAAA,EACKQ,SAAS,CAAC0B,GAAV,CAAc,UAACC,QAAD,EAAWC,CAAX;QAAA,OACXpC,aAAA,KAAA;UAAIqC,GAAG,EAAED;SAAT,EACIpC,aAAA,SAAA;UACII,SAAS,EAAC;UACVkC,OAAO,EAAE,iBAAAN,KAAK;YACVA,KAAK,CAACO,OAAN;YACAJ,QAAQ,CAACG,OAAT,CAAiBN,KAAjB;YACAJ,KAAK;;SALb,EAQKO,QAAQ,CAACK,IARd,CADJ,CADW;OAAd,CADL,CAJJ,EAoBKnC,WAAW,IACRL,aAAA,SAAA;QACII,SAAS,EAAC;QACVkC,OAAO,EAAE,iBAAAN,KAAK;UACVA,KAAK,CAACO,OAAN;UACAlC,WAAW,CAAC2B,KAAD,CAAX;UACAJ,KAAK;;OALb,EAQKb,KAAK,CAACO,UAAN,CAAiBmB,KARtB,CArBR,CAVR,CADH;KADL,CARJ;IAHR,CADJ,CADJ;AAmEH,CAzEyB;;;;"}
1
+ {"version":3,"file":"Datepicker.js","sources":["../../../../src/components/Datepicker/Datepicker.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport { Calendar, CalendarProps } from '../Calendar/Calendar';\nimport { Input, InputProps } from '../Input/Input';\nimport { useLocalization } from '../Provider/Provider';\nimport { useDatepicker } from './useDatepicker';\nimport { IconButton } from '../IconButton/IconButton';\nimport { Popover } from '../Popover/Popover';\n\nexport type DatepickerTexts = {\n /** Aria-label for calendar */\n calendar: string;\n /** Clear button text */\n clear: string;\n /**\n * Aria-label for calendar icon button in the input.\n * Calendar will open when user clicks this icon button.\n */\n expand: string;\n /** Shortcut heading text */\n shortcuts: string;\n};\n\nexport type DatepickerProps = Omit<InputProps, 'value'> & {\n /** [Calendar](component:calendar) component associated with the DatePicker */\n calendar?: CalendarProps;\n /** List of shortcuts */\n shortcuts?: any;\n /** Title for the shortcuts panel */\n shortcutsText?: string;\n /** Handler to be called when the clear button is clicked */\n onReset?: (event: React.MouseEvent<HTMLButtonElement>) => void;\n /**\n * Date value of the calendar.\n * This will be displayed in DatePicker's input in the format given to the [Provider](component:provider) component\n */\n value?: Date;\n};\n\nexport const Datepicker = React.forwardRef(function Datepicker(props: DatepickerProps, ref: React.Ref<HTMLInputElement>) {\n const { className: externalClassName, onReset: handleReset, style, shortcuts, shortcutsText, ...otherProps } = props;\n const { calendar, input } = useDatepicker(otherProps, ref);\n const { texts } = useLocalization();\n const className = cn('inline-flex w-full text-black font-normal', externalClassName);\n\n return (\n <span className={className} data-taco=\"datepicker\" style={style}>\n <Input\n {...input}\n button={\n <Popover>\n <Popover.Trigger>\n <IconButton\n aria-label={texts.datepicker.expand}\n disabled={input.disabled || input.readOnly}\n icon=\"calendar\"\n />\n </Popover.Trigger>\n <Popover.Content>\n {({ close }) => (\n <div className=\"-m-3 flex\">\n <Calendar\n {...calendar}\n onChange={(date: Date, event?: React.MouseEvent<HTMLDivElement>) => {\n calendar.onChange(date, event);\n close();\n }}\n tabIndex={-1}\n />\n {shortcuts && (\n <div className=\"border-grey-dark flex flex-col border-l\">\n <span className=\"m-4 mb-3 flex h-8 w-32 items-center text-xs font-semibold\">\n {shortcutsText ?? texts.datepicker.shortcuts}\n </span>\n <ul>\n {shortcuts.map((shortcut, i) => (\n <li key={i}>\n <button\n className=\"hover:bg-grey-light flex w-full items-start px-4 py-1 text-xs\"\n onClick={event => {\n event.persist();\n shortcut.onClick(event);\n close();\n }}\n >\n {shortcut.text}\n </button>\n </li>\n ))}\n </ul>\n {handleReset && (\n <button\n className=\"text-blue hover:text-blue-light my-4 mx-auto mt-auto inline-flex cursor-pointer border-none bg-transparent text-xs\"\n onClick={event => {\n event.persist();\n handleReset(event);\n close();\n }}\n >\n {texts.datepicker.clear}\n </button>\n )}\n </div>\n )}\n </div>\n )}\n </Popover.Content>\n </Popover>\n }\n />\n </span>\n );\n});\n"],"names":["Datepicker","React","props","ref","externalClassName","className","handleReset","onReset","style","shortcuts","shortcutsText","otherProps","useDatepicker","calendar","input","useLocalization","texts","cn","Input","button","Popover","Trigger","IconButton","datepicker","expand","disabled","readOnly","icon","Content","close","Calendar","onChange","date","event","tabIndex","map","shortcut","i","key","onClick","persist","text","clear"],"mappings":";;;;;;;;;;;IAuCaA,UAAU,gBAAGC,UAAA,CAAiB,SAASD,UAAT,CAAoBE,KAApB,EAA4CC,GAA5C;EACvC,IAAmBC,iBAAnB,GAA+GF,KAA/G,CAAQG,SAAR;MAA+CC,WAA/C,GAA+GJ,KAA/G,CAAsCK,OAAtC;MAA4DC,KAA5D,GAA+GN,KAA/G,CAA4DM,KAA5D;MAAmEC,SAAnE,GAA+GP,KAA/G,CAAmEO,SAAnE;MAA8EC,aAA9E,GAA+GR,KAA/G,CAA8EQ,aAA9E;MAAgGC,UAAhG,iCAA+GT,KAA/G;;EACA,qBAA4BU,aAAa,CAACD,UAAD,EAAaR,GAAb,CAAzC;MAAQU,QAAR,kBAAQA,QAAR;MAAkBC,KAAlB,kBAAkBA,KAAlB;;EACA,uBAAkBC,eAAe,EAAjC;MAAQC,KAAR,oBAAQA,KAAR;;EACA,IAAMX,SAAS,GAAGY,EAAE,CAAC,2CAAD,EAA8Cb,iBAA9C,CAApB;EAEA,OACIH,aAAA,OAAA;IAAMI,SAAS,EAAEA;iBAAqB;IAAaG,KAAK,EAAEA;GAA1D,EACIP,aAAA,CAACiB,KAAD,oBACQJ;IACJK,MAAM,EACFlB,aAAA,CAACmB,OAAD,MAAA,EACInB,aAAA,CAACmB,OAAO,CAACC,OAAT,MAAA,EACIpB,aAAA,CAACqB,UAAD;oBACgBN,KAAK,CAACO,UAAN,CAAiBC;MAC7BC,QAAQ,EAAEX,KAAK,CAACW,QAAN,IAAkBX,KAAK,CAACY;MAClCC,IAAI,EAAC;KAHT,CADJ,CADJ,EAQI1B,aAAA,CAACmB,OAAO,CAACQ,OAAT,MAAA,EACK;MAAA,IAAGC,KAAH,QAAGA,KAAH;MAAA,OACG5B,aAAA,MAAA;QAAKI,SAAS,EAAC;OAAf,EACIJ,aAAA,CAAC6B,QAAD,oBACQjB;QACJkB,QAAQ,EAAE,kBAACC,IAAD,EAAaC,KAAb;UACNpB,QAAQ,CAACkB,QAAT,CAAkBC,IAAlB,EAAwBC,KAAxB;UACAJ,KAAK;;QAETK,QAAQ,EAAE,CAAC;QANf,CADJ,EASKzB,SAAS,IACNR,aAAA,MAAA;QAAKI,SAAS,EAAC;OAAf,EACIJ,aAAA,OAAA;QAAMI,SAAS,EAAC;OAAhB,EACKK,aADL,aACKA,aADL,cACKA,aADL,GACsBM,KAAK,CAACO,UAAN,CAAiBd,SADvC,CADJ,EAIIR,aAAA,KAAA,MAAA,EACKQ,SAAS,CAAC0B,GAAV,CAAc,UAACC,QAAD,EAAWC,CAAX;QAAA,OACXpC,aAAA,KAAA;UAAIqC,GAAG,EAAED;SAAT,EACIpC,aAAA,SAAA;UACII,SAAS,EAAC;UACVkC,OAAO,EAAE,iBAAAN,KAAK;YACVA,KAAK,CAACO,OAAN;YACAJ,QAAQ,CAACG,OAAT,CAAiBN,KAAjB;YACAJ,KAAK;;SALb,EAQKO,QAAQ,CAACK,IARd,CADJ,CADW;OAAd,CADL,CAJJ,EAoBKnC,WAAW,IACRL,aAAA,SAAA;QACII,SAAS,EAAC;QACVkC,OAAO,EAAE,iBAAAN,KAAK;UACVA,KAAK,CAACO,OAAN;UACAlC,WAAW,CAAC2B,KAAD,CAAX;UACAJ,KAAK;;OALb,EAQKb,KAAK,CAACO,UAAN,CAAiBmB,KARtB,CArBR,CAVR,CADH;KADL,CARJ;IAHR,CADJ,CADJ;AAmEH,CAzEyB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useDatepicker.js","sources":["../../../../src/components/Datepicker/useDatepicker.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport { parseFromCustomString, format } from '../../utils/date';\r\nimport { useLocalization } from '../Provider/Provider';\r\nimport { setInputValueByRef } from '../../utils/input';\r\nimport { useProxiedRef } from '../../utils/hooks/useProxiedRef';\r\nimport { DatepickerProps } from './Datepicker';\r\nimport { CalendarProps } from '../Calendar/Calendar';\r\n\r\ntype InputProps = React.InputHTMLAttributes<HTMLInputElement> & { ref: React.RefObject<HTMLInputElement> };\r\n\r\ntype useDatepicker = React.HTMLAttributes<HTMLDivElement> & {\r\n calendar: CalendarProps;\r\n input: InputProps;\r\n};\r\n\r\nexport const useDatepicker = (\r\n { defaultValue: _, calendar, onBlur, onChange, value, ...props }: DatepickerProps,\r\n ref: React.Ref<HTMLInputElement>\r\n): useDatepicker => {\r\n const inputRef = useProxiedRef<HTMLInputElement>(ref);\r\n const { formatting } = useLocalization();\r\n const [internalValue, setInternalValue] = React.useState(value ? format(value, formatting.date) : '');\r\n\r\n // update internal value if it changed 'externally'\r\n React.useEffect(() => {\r\n if (value) {\r\n const formattedValue = format(value, formatting.date);\r\n\r\n if (formattedValue !== internalValue) {\r\n setInternalValue(formattedValue);\r\n }\r\n } else {\r\n setInternalValue('');\r\n }\r\n }, [value]);\r\n\r\n // event handlers\r\n const handleInputBlur = (event: React.FocusEvent<HTMLInputElement>): void => {\r\n event.persist();\r\n\r\n const valueAsDate = parseFromCustomString(event.target.value);\r\n const formattedValue = valueAsDate ? format(valueAsDate) || '' : '';\r\n\r\n event.target.value = formattedValue;\r\n\r\n if (onChange) {\r\n (event as any).detail = valueAsDate;\r\n onChange(event);\r\n } else {\r\n // update the internal value to use the formatted date\r\n setInternalValue(formattedValue);\r\n }\r\n\r\n if (onBlur) {\r\n onBlur(event);\r\n }\r\n };\r\n\r\n const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>): void => {\r\n setInternalValue(event.target.value);\r\n };\r\n\r\n const handleChange = date => {\r\n setInputValueByRef(inputRef.current, format(date, formatting.date), 'focusout');\r\n };\r\n\r\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\r\n if (event.key === 'Enter') {\r\n event.target.dispatchEvent(new Event('focusout', { bubbles: true }));\r\n }\r\n };\r\n\r\n const inputProps: InputProps = {\r\n ...props,\r\n autoComplete: 'off',\r\n onBlur: handleInputBlur,\r\n onChange: handleInputChange,\r\n onKeyDown: handleKeyDown,\r\n ref: inputRef,\r\n type: 'text',\r\n value: internalValue,\r\n };\r\n\r\n const calendarProps: CalendarProps = {\r\n ...calendar,\r\n onChange: handleChange,\r\n value,\r\n };\r\n\r\n return {\r\n input: inputProps,\r\n calendar: calendarProps,\r\n };\r\n};\r\n"],"names":["useDatepicker","defaultValue","_","calendar","onBlur","onChange","value","props","ref","inputRef","useProxiedRef","formatting","useLocalization","internalValue","setInternalValue","React","format","date","formattedValue","handleInputBlur","event","persist","valueAsDate","parseFromCustomString","target","detail","handleInputChange","handleChange","setInputValueByRef","current","handleKeyDown","key","dispatchEvent","Event","bubbles","inputProps","autoComplete","onKeyDown","type","calendarProps","input"],"mappings":";;;;;;MAeaA,aAAa,GAAG,CACzB;EAAEC,YAAY,EAAEC,CAAhB;EAAmBC,QAAnB;EAA6BC,MAA7B;EAAqCC,QAArC;EAA+CC,KAA/C;EAAsD,GAAGC;AAAzD,CADyB,EAEzBC,GAFyB;EAIzB,MAAMC,QAAQ,GAAGC,aAAa,CAAmBF,GAAnB,CAA9B;EACA,MAAM;IAAEG;MAAeC,eAAe,EAAtC;EACA,MAAM,CAACC,aAAD,EAAgBC,gBAAhB,IAAoCC,QAAA,CAAeT,KAAK,GAAGU,MAAM,CAACV,KAAD,EAAQK,UAAU,CAACM,IAAnB,CAAT,GAAoC,EAAxD,CAA1C;;EAGAF,SAAA,CAAgB;IACZ,IAAIT,KAAJ,EAAW;MACP,MAAMY,cAAc,GAAGF,MAAM,CAACV,KAAD,EAAQK,UAAU,CAACM,IAAnB,CAA7B;;MAEA,IAAIC,cAAc,KAAKL,aAAvB,EAAsC;QAClCC,gBAAgB,CAACI,cAAD,CAAhB;;KAJR,MAMO;MACHJ,gBAAgB,CAAC,EAAD,CAAhB;;GARR,EAUG,CAACR,KAAD,CAVH;;EAaA,MAAMa,eAAe,GAAIC,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jC,GAAGpC,QAD8B;IAEjCE,QAAQ,EAAEsB,YAFuB;IAGjCrB;GAHJ;EAMA,OAAO;IACHkC,KAAK,EAAEL,UADJ;IAEHhC,QAAQ,EAAEoC;GAFd;AAIH;;;;"}
1
+ {"version":3,"file":"useDatepicker.js","sources":["../../../../src/components/Datepicker/useDatepicker.tsx"],"sourcesContent":["import * as React from 'react';\nimport { parseFromCustomString, format } from '../../utils/date';\nimport { useLocalization } from '../Provider/Provider';\nimport { setInputValueByRef } from '../../utils/input';\nimport { useProxiedRef } from '../../utils/hooks/useProxiedRef';\nimport { DatepickerProps } from './Datepicker';\nimport { CalendarProps } from '../Calendar/Calendar';\n\ntype InputProps = React.InputHTMLAttributes<HTMLInputElement> & { ref: React.RefObject<HTMLInputElement> };\n\ntype useDatepicker = React.HTMLAttributes<HTMLDivElement> & {\n calendar: CalendarProps;\n input: InputProps;\n};\n\nexport const useDatepicker = (\n { defaultValue: _, calendar, onBlur, onChange, value, ...props }: DatepickerProps,\n ref: React.Ref<HTMLInputElement>\n): useDatepicker => {\n const inputRef = useProxiedRef<HTMLInputElement>(ref);\n const { formatting } = useLocalization();\n const [internalValue, setInternalValue] = React.useState(value ? format(value, formatting.date) : '');\n\n // update internal value if it changed 'externally'\n React.useEffect(() => {\n if (value) {\n const formattedValue = format(value, formatting.date);\n\n if (formattedValue !== internalValue) {\n setInternalValue(formattedValue);\n }\n } else {\n setInternalValue('');\n }\n }, [value]);\n\n // event handlers\n const handleInputBlur = (event: React.FocusEvent<HTMLInputElement>): void => {\n event.persist();\n\n const valueAsDate = parseFromCustomString(event.target.value);\n const formattedValue = valueAsDate ? format(valueAsDate) || '' : '';\n\n event.target.value = formattedValue;\n\n if (onChange) {\n (event as any).detail = valueAsDate;\n onChange(event);\n } else {\n // update the internal value to use the formatted date\n setInternalValue(formattedValue);\n }\n\n if (onBlur) {\n onBlur(event);\n }\n };\n\n const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>): void => {\n setInternalValue(event.target.value);\n };\n\n const handleChange = date => {\n setInputValueByRef(inputRef.current, format(date, formatting.date), 'focusout');\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter') {\n event.target.dispatchEvent(new Event('focusout', { bubbles: true }));\n }\n };\n\n const inputProps: InputProps = {\n ...props,\n autoComplete: 'off',\n onBlur: handleInputBlur,\n onChange: handleInputChange,\n onKeyDown: handleKeyDown,\n ref: inputRef,\n type: 'text',\n value: internalValue,\n };\n\n const calendarProps: CalendarProps = {\n ...calendar,\n onChange: handleChange,\n value,\n };\n\n return {\n input: inputProps,\n calendar: calendarProps,\n };\n};\n"],"names":["useDatepicker","defaultValue","_","calendar","onBlur","onChange","value","props","ref","inputRef","useProxiedRef","formatting","useLocalization","internalValue","setInternalValue","React","format","date","formattedValue","handleInputBlur","event","persist","valueAsDate","parseFromCustomString","target","detail","handleInputChange","handleChange","setInputValueByRef","current","handleKeyDown","key","dispatchEvent","Event","bubbles","inputProps","autoComplete","onKeyDown","type","calendarProps","input"],"mappings":";;;;;;MAeaA,aAAa,GAAG,CACzB;EAAEC,YAAY,EAAEC,CAAhB;EAAmBC,QAAnB;EAA6BC,MAA7B;EAAqCC,QAArC;EAA+CC,KAA/C;EAAsD,GAAGC;AAAzD,CADyB,EAEzBC,GAFyB;EAIzB,MAAMC,QAAQ,GAAGC,aAAa,CAAmBF,GAAnB,CAA9B;EACA,MAAM;IAAEG;MAAeC,eAAe,EAAtC;EACA,MAAM,CAACC,aAAD,EAAgBC,gBAAhB,IAAoCC,QAAA,CAAeT,KAAK,GAAGU,MAAM,CAACV,KAAD,EAAQK,UAAU,CAACM,IAAnB,CAAT,GAAoC,EAAxD,CAA1C;;EAGAF,SAAA,CAAgB;IACZ,IAAIT,KAAJ,EAAW;MACP,MAAMY,cAAc,GAAGF,MAAM,CAACV,KAAD,EAAQK,UAAU,CAACM,IAAnB,CAA7B;;MAEA,IAAIC,cAAc,KAAKL,aAAvB,EAAsC;QAClCC,g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S,EAAEP,aALgB;IAM3BtB,GAAG,EAAEC,QANsB;IAO3B6B,IAAI,EAAE,MAPqB;IAQ3BhC,KAAK,EAAEO;GARX;EAWA,MAAM0B,aAAa,GAAkB,EACjC,GAAGpC,QAD8B;IAEjCE,QAAQ,EAAEsB,YAFuB;IAGjCrB;GAHJ;EAMA,OAAO;IACHkC,KAAK,EAAEL,UADJ;IAEHhC,QAAQ,EAAEoC;GAFd;AAIH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Context.js","sources":["../../../../src/components/Dialog/Context.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-function */\r\nimport * as React from 'react';\r\nimport { DialogSize } from './types';\r\n\r\nexport type DialogContext = {\r\n closeOnEscape: boolean;\r\n draggable: boolean;\r\n drawer: {\r\n open: boolean;\r\n toggle: () => void;\r\n };\r\n elements: {\r\n drawer?: React.ReactNode;\r\n extra?: React.ReactNode;\r\n };\r\n onClose?: () => void;\r\n props: {};\r\n ref: React.Ref<HTMLElement>;\r\n showCloseButton: boolean;\r\n size: DialogSize;\r\n};\r\n\r\nexport const DialogContext = React.createContext<DialogContext>({\r\n closeOnEscape: true,\r\n draggable: false,\r\n drawer: {\r\n open: false,\r\n toggle: () => {},\r\n },\r\n elements: {\r\n drawer: undefined,\r\n extra: undefined,\r\n },\r\n onClose: () => {},\r\n props: {},\r\n ref: null,\r\n showCloseButton: true,\r\n size: 'sm',\r\n});\r\n\r\nexport const useCurrentDialog = () => {\r\n return React.useContext(DialogContext);\r\n};\r\n"],"names":["DialogContext","React","closeOnEscape","draggable","drawer","open","toggle","elements","undefined","extra","onClose","props","ref","showCloseButton","size","useCurrentDialog"],"mappings":";;AAAA;MAsBaA,aAAa,gBAAGC,aAAA,CAAmC;EAC5DC,aAAa,EAAE,IAD6C;EAE5DC,SAAS,EAAE,KAFiD;EAG5DC,MAAM,EAAE;IACJC,IAAI,EAAE,KADF;IAEJC,MAAM,EAAE;GALgD;EAO5DC,QAAQ,EAAE;IACNH,MAAM,EAAEI,SADF;IAENC,KAAK,EAAED;GATiD;EAW5DE,OAAO,EAAE,QAXmD;EAY5DC,KAAK,EAAE,EAZqD;EAa5DC,GAAG,EAAE,IAbuD;EAc5DC,eAAe,EAAE,IAd2C;EAe5DC,IAAI,EAAE;AAfsD,CAAnC;MAkBhBC,gBAAgB,GAAG;EAC5B,OAAOd,UAAA,CAAiBD,aAAjB,CAAP;AACH;;;;"}
1
+ {"version":3,"file":"Context.js","sources":["../../../../src/components/Dialog/Context.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-function */\nimport * as React from 'react';\nimport { DialogSize } from './types';\n\nexport type DialogContext = {\n closeOnEscape: boolean;\n draggable: boolean;\n drawer: {\n open: boolean;\n toggle: () => void;\n };\n elements: {\n drawer?: React.ReactNode;\n extra?: React.ReactNode;\n };\n onClose?: () => void;\n props: {};\n ref: React.Ref<HTMLElement>;\n showCloseButton: boolean;\n size: DialogSize;\n};\n\nexport const DialogContext = React.createContext<DialogContext>({\n closeOnEscape: true,\n draggable: false,\n drawer: {\n open: false,\n toggle: () => {},\n },\n elements: {\n drawer: undefined,\n extra: undefined,\n },\n onClose: () => {},\n props: {},\n ref: null,\n showCloseButton: true,\n size: 'sm',\n});\n\nexport const useCurrentDialog = () => {\n return React.useContext(DialogContext);\n};\n"],"names":["DialogContext","React","closeOnEscape","draggable","drawer","open","toggle","elements","undefined","extra","onClose","props","ref","showCloseButton","size","useCurrentDialog"],"mappings":";;AAAA;MAsBaA,aAAa,gBAAGC,aAAA,CAAmC;EAC5DC,aAAa,EAAE,IAD6C;EAE5DC,SAAS,EAAE,KAFiD;EAG5DC,MAAM,EAAE;IACJC,IAAI,EAAE,KADF;IAEJC,MAAM,EAAE;GALgD;EAO5DC,QAAQ,EAAE;IACNH,MAAM,EAAEI,SADF;IAENC,KAAK,EAAED;GATiD;EAW5DE,OAAO,EAAE,QAXmD;EAY5DC,KAAK,EAAE,EAZqD;EAa5DC,GAAG,EAAE,IAbuD;EAc5DC,eAAe,EAAE,IAd2C;EAe5DC,IAAI,EAAE;AAfsD,CAAnC;MAkBhBC,gBAAgB,GAAG;EAC5B,OAAOd,UAAA,CAAiBD,aAAjB,CAAP;AACH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.js","sources":["../../../../src/components/Dialog/Dialog.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\r\nimport './Dialog.css';\r\nimport { DialogTriggerProps, Trigger } from './components/Trigger';\r\nimport {\r\n Content,\r\n Title,\r\n Footer,\r\n Close,\r\n DialogContentProps,\r\n DialogContentRenderProps,\r\n DialogContentDrawerRenderProps,\r\n DialogTitleProps,\r\n DialogFooterProps,\r\n DialogCloseProps,\r\n} from './components/Content';\r\nimport { DialogDrawerProps, DialogDrawerRenderProps, Drawer } from './components/Drawer';\r\nimport { DialogExtraProps, Extra } from './components/Extra';\r\nimport { DialogContext } from './Context';\r\nimport { DialogSize } from './types';\r\n\r\nexport {\r\n DialogCloseProps,\r\n DialogContentDrawerRenderProps,\r\n DialogContentProps,\r\n DialogContentRenderProps,\r\n DialogDrawerProps,\r\n DialogDrawerRenderProps,\r\n DialogFooterProps,\r\n DialogSize,\r\n DialogTitleProps,\r\n};\r\n\r\nexport type DialogTexts = {\r\n /**\r\n * Aria-label for close icon button in dialog.\r\n * To read more about how to provide the text, see [Provider](component:provider) component\r\n */\r\n close: string;\r\n drag: string;\r\n};\r\n\r\nexport type DialogProps = {\r\n children: React.ReactNode | React.ReactNode[];\r\n /** When `true`, pressing escape will close the dialog */\r\n closeOnEscape?: boolean;\r\n /** Set whether the dialog is open by default or not, use when not providing a trigger */\r\n defaultOpen?: boolean;\r\n /** Allows dragging the dialog around the screen (window constrained) */\r\n draggable?: boolean;\r\n /** Handler called when dialog closes by user interaction */\r\n onClose?: () => void;\r\n /** Called when the dialog opens or closes, must be used in conjunction with open */\r\n onChange?: (open: boolean) => void;\r\n /** Control the open state of the dialog from outside the component */\r\n open?: boolean;\r\n /** Shows the close icon button of the dialog */\r\n showCloseButton?: boolean;\r\n /** Size of the dialog. This is the recommended way to set a size for dialog component. */\r\n size?: DialogSize;\r\n /** A trigger to be used for the dialog, should not be set if `children` already contains a trigger */\r\n trigger?: JSX.Element;\r\n};\r\n\r\nconst useSeparatedChildren = initialChildren => {\r\n return React.useMemo(() => {\r\n const children: any[] = [];\r\n let drawer;\r\n let extra;\r\n\r\n React.Children.toArray(initialChildren).forEach((child: any) => {\r\n if (child.type?.displayName === Drawer.displayName) {\r\n drawer = child;\r\n } else if (child.type?.displayName === Extra.displayName) {\r\n extra = child;\r\n } else {\r\n children.push(child);\r\n }\r\n });\r\n\r\n return [children, drawer, extra];\r\n }, [initialChildren]);\r\n};\r\n\r\nexport type ForwardedDialogWithStatics = React.ForwardRefExoticComponent<DialogProps & React.RefAttributes<HTMLElement>> & {\r\n Trigger: React.ForwardRefExoticComponent<DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;\r\n Content: React.ForwardRefExoticComponent<DialogContentProps & React.RefAttributes<HTMLDivElement>>;\r\n Title: React.ForwardRefExoticComponent<DialogTitleProps & React.RefAttributes<HTMLHeadingElement>>;\r\n Footer: React.ForwardRefExoticComponent<DialogFooterProps & React.RefAttributes<HTMLDivElement>>;\r\n Extra: React.ForwardRefExoticComponent<DialogExtraProps & React.RefAttributes<HTMLDivElement>>;\r\n Drawer: React.ForwardRefExoticComponent<DialogDrawerProps & React.RefAttributes<HTMLDivElement>>;\r\n Close: React.ForwardRefExoticComponent<DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;\r\n};\r\n\r\nexport const Dialog = React.forwardRef(function Dialog(props: DialogProps, ref: React.Ref<HTMLElement>) {\r\n const {\r\n children: initialChildren,\r\n closeOnEscape = true,\r\n defaultOpen,\r\n draggable = false,\r\n onChange,\r\n onClose,\r\n open,\r\n showCloseButton = true,\r\n size = 'sm',\r\n trigger,\r\n ...otherProps\r\n } = props;\r\n const [children, drawer, extra] = useSeparatedChildren(initialChildren);\r\n const [drawerOpen, setDrawerOpen] = React.useState(false);\r\n\r\n const context = React.useMemo(\r\n () => ({\r\n closeOnEscape,\r\n draggable,\r\n drawer: {\r\n open: drawerOpen,\r\n toggle: () => setDrawerOpen(isDrawerOpen => !isDrawerOpen),\r\n },\r\n elements: {\r\n drawer,\r\n extra,\r\n },\r\n onClose,\r\n props: otherProps,\r\n showCloseButton,\r\n size,\r\n ref,\r\n }),\r\n [closeOnEscape, drawerOpen, draggable, drawer, extra, open, otherProps, showCloseButton]\r\n );\r\n\r\n return (\r\n <DialogContext.Provider value={context}>\r\n <DialogPrimitive.Root defaultOpen={defaultOpen} open={open} onOpenChange={onChange}>\r\n {trigger && <Trigger>{trigger}</Trigger>}\r\n {children}\r\n </DialogPrimitive.Root>\r\n </DialogContext.Provider>\r\n );\r\n}) as ForwardedDialogWithStatics;\r\n\r\nDialog.Trigger = Trigger;\r\nDialog.Content = Content;\r\nDialog.Title = Title;\r\nDialog.Footer = Footer;\r\nDialog.Extra = Extra;\r\nDialog.Drawer = Drawer;\r\nDialog.Close = Close;\r\n"],"names":["useSeparatedChildren","initialChildren","React","children","drawer","extra","toArray","forEach","child","type","displayName","Drawer","Extra","push","Dialog","props","ref","closeOnEscape","defaultOpen","draggable","onChange","onClose","open","showCloseButton","size","trigger","otherProps","drawerOpen","setDrawerOpen","context","toggle","isDrawerOpen","elements","DialogContext","Provider","value","DialogPrimitive","onOpenChange","Trigger","Content","Title","Footer","Close"],"mappings":";;;;;;;;;;;AAgEA,IAAMA,oBAAoB,GAAG,SAAvBA,oBAAuB,CAAAC,eAAe;EACxC,OAAOC,OAAA,CAAc;IACjB,IAAMC,QAAQ,GAAU,EAAxB;IACA,IAAIC,MAAJ;IACA,IAAIC,KAAJ;IAEAH,QAAA,CAAeI,OAAf,CAAuBL,eAAvB,EAAwCM,OAAxC,CAAgD,UAACC,KAAD;;;MAC5C,IAAI,gBAAAA,KAAK,CAACC,IAAN,4DAAYC,WA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ACJkB,IAAI,EAAEK,UADF;QAEJG,MAAM,EAAE;UAAA,OAAMF,aAAa,CAAC,UAAAG,YAAY;YAAA,OAAI,CAACA,YAAL;WAAb,CAAnB;;OALT;MAOHC,QAAQ,EAAE;QACN5B,MAAM,EAANA,MADM;QAENC,KAAK,EAALA;OATD;MAWHgB,OAAO,EAAPA,OAXG;MAYHN,KAAK,EAAEW,UAZJ;MAaHH,eAAe,EAAfA,eAbG;MAcHC,IAAI,EAAJA,IAdG;MAeHR,GAAG,EAAHA;KAfJ;GADY,EAkBZ,CAACC,aAAD,EAAgBU,UAAhB,EAA4BR,SAA5B,EAAuCf,MAAvC,EAA+CC,KAA/C,EAAsDiB,IAAtD,EAA4DI,UAA5D,EAAwEH,eAAxE,CAlBY,CAAhB;EAqBA,OACIrB,aAAA,CAAC+B,aAAa,CAACC,QAAf;IAAwBC,KAAK,EAAEN;GAA/B,EACI3B,aAAA,CAACkC,IAAD;IAAsBlB,WAAW,EAAEA;IAAaI,IAAI,EAAEA;IAAMe,YAAY,EAAEjB;GAA1E,EACKK,OAAO,IAAIvB,aAAA,CAACoC,OAAD,MAAA,EAAUb,OAAV,CADhB,EAEKtB,QAFL,CADJ,CADJ;AAQH,CA9CqB;AAgDtBW,MAAM,CAACwB,OAAP,GAAiBA,OAAjB;AACAxB,MAAM,CAACyB,OAAP,GAAiBA,OAAjB;AACAzB,MAAM,CAAC0B,KAAP,GAAeA,KAAf;AACA1B,MAAM,CAAC2B,MAAP,GAAgBA,MAAhB;AACA3B,MAAM,CAACF,KAAP,GAAeA,KAAf;AACAE,MAAM,CAACH,MAAP,GAAgBA,MAAhB;AACAG,MAAM,CAAC4B,KAAP,GAAeA,KAAf;;;;"}
1
+ {"version":3,"file":"Dialog.js","sources":["../../../../src/components/Dialog/Dialog.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport './Dialog.css';\nimport { DialogTriggerProps, Trigger } from './components/Trigger';\nimport {\n Content,\n Title,\n Footer,\n Close,\n DialogContentProps,\n DialogContentRenderProps,\n DialogContentDrawerRenderProps,\n DialogTitleProps,\n DialogFooterProps,\n DialogCloseProps,\n} from './components/Content';\nimport { DialogDrawerProps, DialogDrawerRenderProps, Drawer } from './components/Drawer';\nimport { DialogExtraProps, Extra } from './components/Extra';\nimport { DialogContext } from './Context';\nimport { DialogSize } from './types';\n\nexport {\n DialogCloseProps,\n DialogContentDrawerRenderProps,\n DialogContentProps,\n DialogContentRenderProps,\n DialogDrawerProps,\n DialogDrawerRenderProps,\n DialogFooterProps,\n DialogSize,\n DialogTitleProps,\n};\n\nexport type DialogTexts = {\n /**\n * Aria-label for close icon button in dialog.\n * To read more about how to provide the text, see [Provider](component:provider) component\n */\n close: string;\n drag: string;\n};\n\nexport type DialogProps = {\n children: React.ReactNode | React.ReactNode[];\n /** When `true`, pressing escape will close the dialog */\n closeOnEscape?: boolean;\n /** Set whether the dialog is open by default or not, use when not providing a trigger */\n defaultOpen?: boolean;\n /** Allows dragging the dialog around the screen (window constrained) */\n draggable?: boolean;\n /** Handler called when dialog closes by user interaction */\n onClose?: () => void;\n /** Called when the dialog opens or closes, must be used in conjunction with open */\n onChange?: (open: boolean) => void;\n /** Control the open state of the dialog from outside the component */\n open?: boolean;\n /** Shows the close icon button of the dialog */\n showCloseButton?: boolean;\n /** Size of the dialog. This is the recommended way to set a size for dialog component. */\n size?: DialogSize;\n /** A trigger to be used for the dialog, should not be set if `children` already contains a trigger */\n trigger?: JSX.Element;\n};\n\nconst useSeparatedChildren = initialChildren => {\n return React.useMemo(() => {\n const children: any[] = [];\n let drawer;\n let extra;\n\n React.Children.toArray(initialChildren).forEach((child: any) => {\n if (child.type?.displayName === Drawer.displayName) {\n drawer = child;\n } else if (child.type?.displayName === Extra.displayName) {\n extra = child;\n } else {\n children.push(child);\n }\n });\n\n return [children, drawer, extra];\n }, [initialChildren]);\n};\n\nexport type ForwardedDialogWithStatics = React.ForwardRefExoticComponent<DialogProps & React.RefAttributes<HTMLElement>> & {\n Trigger: React.ForwardRefExoticComponent<DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;\n Content: React.ForwardRefExoticComponent<DialogContentProps & React.RefAttributes<HTMLDivElement>>;\n Title: React.ForwardRefExoticComponent<DialogTitleProps & React.RefAttributes<HTMLHeadingElement>>;\n Footer: React.ForwardRefExoticComponent<DialogFooterProps & React.RefAttributes<HTMLDivElement>>;\n Extra: React.ForwardRefExoticComponent<DialogExtraProps & React.RefAttributes<HTMLDivElement>>;\n Drawer: React.ForwardRefExoticComponent<DialogDrawerProps & React.RefAttributes<HTMLDivElement>>;\n Close: React.ForwardRefExoticComponent<DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;\n};\n\nexport const Dialog = React.forwardRef(function Dialog(props: DialogProps, ref: React.Ref<HTMLElement>) {\n const {\n children: initialChildren,\n closeOnEscape = true,\n defaultOpen,\n draggable = false,\n onChange,\n onClose,\n open,\n showCloseButton = true,\n size = 'sm',\n trigger,\n ...otherProps\n } = props;\n const [children, drawer, extra] = useSeparatedChildren(initialChildren);\n const [drawerOpen, setDrawerOpen] = React.useState(false);\n\n const context = React.useMemo(\n () => ({\n closeOnEscape,\n draggable,\n drawer: {\n open: drawerOpen,\n toggle: () => setDrawerOpen(isDrawerOpen => !isDrawerOpen),\n },\n elements: {\n drawer,\n extra,\n },\n onClose,\n props: otherProps,\n showCloseButton,\n size,\n ref,\n }),\n [closeOnEscape, drawerOpen, draggable, drawer, extra, open, otherProps, showCloseButton]\n );\n\n return (\n <DialogContext.Provider value={context}>\n <DialogPrimitive.Root defaultOpen={defaultOpen} open={open} onOpenChange={onChange}>\n {trigger && <Trigger>{trigger}</Trigger>}\n {children}\n </DialogPrimitive.Root>\n </DialogContext.Provider>\n );\n}) as ForwardedDialogWithStatics;\n\nDialog.Trigger = Trigger;\nDialog.Content = Content;\nDialog.Title = Title;\nDialog.Footer = Footer;\nDialog.Extra = Extra;\nDialog.Drawer = Drawer;\nDialog.Close = Close;\n"],"names":["useSeparatedChildren","initialChildren","React","children","drawer","extra","toArray","forEach","child","type","displayName","Drawer","Extra","push","Dialog","props","ref","closeOnEscape","defaultOpen","draggable","onChange","onClose","open","showCloseButton","size","trigger","otherProps","drawerOpen","setDrawerOpen","context","toggle","isDrawerOpen","elements","DialogContext","Provider","value","DialogPrimitive","onOpenChange","Trigger","Content","Title","Footer","Close"],"mappings":";;;;;;;;;;;AAgEA,IAAMA,oBAAoB,GAAG,SAAvBA,oBAAuB,CAAAC,eAAe;EACxC,OAAOC,OAAA,CAAc;IACjB,IAAMC,QAAQ,GAAU,EAAxB;IACA,IAAIC,MAAJ;IACA,IAAIC,KAAJ;IAEAH,QAAA,CAAeI,OAAf,CAAuBL,eAAvB,EAAwCM,OAAxC,CAAgD,UAACC,KAAD;;;MAC5C,IAAI,gBAAAA,KAAK,CAACC,IAAN,4DAAYC,WAAZ,MAA4BC,MAAM,CAACD,WAAvC,EAAoD;QAChDN,MAAM,GAAGI,KAAT;OADJ,MAEO,IAAI,iBAAAA,KAAK,CAACC,IAAN,8DAAYC,WAAZ,MAA4BE,KAAK,CAACF,WAAtC,EAAmD;QACtDL,KAAK,GAAGG,KAAR;OADG,MAEA;QACHL,QAAQ,CAACU,IAAT,CAAcL,KAAd;;KANR;IAUA,OAAO,CAACL,QAAD,EAAWC,MAAX,EAAmBC,KAAnB,CAAP;GAfG,EAgBJ,CAACJ,eAAD,CAhBI,CAAP;AAiBH,CAlBD;;IA8Baa,MAAM,gBAAGZ,UAAA,CAAiB,SAASY,MAAT,CAAgBC,KAAhB,EAAoCC,GAApC;EACnC,IACcf,eADd,GAYIc,KAZJ,CACIZ,QADJ;6BAYIY,KAZJ,CAEIE,aAFJ;MAEIA,aAFJ,qCAEoB,IAFpB;MAGIC,WAHJ,GAYIH,KAZJ,CAGIG,WAHJ;yBAYIH,KAZJ,CAIII,SAJJ;MAIIA,SAJJ,iCAIgB,KAJhB;MAKIC,QALJ,GAYIL,KAZJ,CAKIK,QALJ;MAMIC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,MAAA,EAAUb,OAAV,CADhB,EAEKtB,QAFL,CADJ,CADJ;AAQH,CA9CqB;AAgDtBW,MAAM,CAACwB,OAAP,GAAiBA,OAAjB;AACAxB,MAAM,CAACyB,OAAP,GAAiBA,OAAjB;AACAzB,MAAM,CAAC0B,KAAP,GAAeA,KAAf;AACA1B,MAAM,CAAC2B,MAAP,GAAgBA,MAAhB;AACA3B,MAAM,CAACF,KAAP,GAAeA,KAAf;AACAE,MAAM,CAACH,MAAP,GAAgBA,MAAhB;AACAG,MAAM,CAAC4B,KAAP,GAAeA,KAAf;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Content.js","sources":["../../../../../src/components/Dialog/components/Content.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport cn from 'classnames';\r\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\r\nimport type { DialogContentProps as DialogPrimitiveContentProps } from '@radix-ui/react-dialog';\r\nimport { useProxiedRef } from '../../../utils/hooks/useProxiedRef';\r\nimport { useDraggable } from '../../../utils/hooks/useDraggable';\r\nimport { useCurrentMenu } from '../../Menu/Context';\r\nimport { DialogContext, useCurrentDialog } from '../Context';\r\nimport { useLocalization } from '../../Provider/Provider';\r\nimport { IconButton } from '../../IconButton/IconButton';\r\nimport { Backdrop } from '../../Backdrop/Backdrop';\r\n\r\nexport type DialogContentDrawerRenderProps = DialogContext['drawer'];\r\n\r\nexport type DialogContentRenderProps = {\r\n close: () => void;\r\n drawer?: DialogContentDrawerRenderProps;\r\n};\r\n\r\nexport type DialogTitleProps = React.HTMLAttributes<HTMLHeadingElement>;\r\nexport const Title = React.forwardRef(function DialogTitle(props: DialogTitleProps, ref: React.Ref<HTMLHeadingElement>) {\r\n const className = cn('text-center', props.className);\r\n return <DialogPrimitive.Title {...props} className={className} ref={ref} />;\r\n});\r\n\r\nexport type DialogFooterProps = React.HTMLAttributes<HTMLDivElement>;\r\nexport const Footer = React.forwardRef(function DialogFooter(props: DialogFooterProps, ref: React.Ref<HTMLDivElement>) {\r\n const className = cn('mt-8 flex justify-end', props.className);\r\n return (\r\n <div {...props} className={className} ref={ref}>\r\n {props.children}\r\n </div>\r\n );\r\n});\r\n\r\nexport type DialogCloseProps = React.HTMLAttributes<HTMLButtonElement>;\r\n\r\nexport const Close = React.forwardRef(function DialogClose(props: DialogCloseProps, ref: React.Ref<HTMLButtonElement>) {\r\n const dialog = useCurrentDialog();\r\n\r\n return <DialogPrimitive.Close onClick={dialog.onClose} {...props} ref={ref} asChild />;\r\n});\r\n\r\nconst RenderPropWrapper = React.forwardRef(function RenderPropWrapper({ children, onClick, renderProps }: any, ref) {\r\n const close = () => {\r\n onClick(new CustomEvent('close'));\r\n };\r\n\r\n return children({ close, ref, ...renderProps });\r\n});\r\n\r\nexport type DialogContentProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> & {\r\n /** An accessible label to be announced when the dialog is opened */\r\n 'aria-label': string;\r\n children: Omit<React.ReactNode, 'Function'> | ((props: DialogContentRenderProps) => JSX.Element);\r\n};\r\nexport const Content = React.forwardRef(function DialogContent(props: DialogContentProps, ref: React.Ref<HTMLDivElement>) {\r\n const dialog = useCurrentDialog();\r\n const internalRef = useProxiedRef<HTMLDivElement>(ref);\r\n const { position, handleProps: dragHandleProps } = useDraggable(internalRef);\r\n const { texts } = useLocalization();\r\n\r\n // if the dialog was opened by a menu, we need to close the menu when the dialog closes\r\n // the menu is still open (and mounted) because it is the trigger for the dialog\r\n const menu = useCurrentMenu();\r\n let handleCloseAutoFocus: DialogPrimitiveContentProps['onCloseAutoFocus'];\r\n\r\n if (menu) {\r\n handleCloseAutoFocus = () => menu.close();\r\n }\r\n\r\n const className = cn('bg-white rounded relative mt-16 mx-auto animate-[fade-in_150ms] z-[997]', {\r\n 'w-128 text-center justify-center': dialog.size === 'dialog',\r\n 'w-xs': dialog.size === 'xs',\r\n 'w-sm': dialog.size === 'sm',\r\n 'w-md': dialog.size === 'md',\r\n 'w-lg': dialog.size === 'lg',\r\n });\r\n\r\n const containerClassName = cn(\r\n 'bg-white p-6 rounded relative z-[999]',\r\n 'shadow-[0_6px_9px_0_rgba(89,85,98,0.3),0_0_1px_0_rgba(89,85,98,0.2)]',\r\n {\r\n 'rounded-b-none': !!dialog.elements.extra,\r\n },\r\n props.className\r\n );\r\n\r\n const handleEscapeKeyDown = (event: KeyboardEvent) => {\r\n if (!dialog.closeOnEscape) {\r\n event.preventDefault();\r\n } else if (dialog.onClose) {\r\n dialog.onClose();\r\n }\r\n };\r\n\r\n // the chosen behaviour in taco is that outside clicks do not close the dialog\r\n const handleInteractOutside = event => event.preventDefault();\r\n\r\n let output;\r\n\r\n if (typeof props.children === 'function') {\r\n output = (\r\n <DialogPrimitive.Close asChild>\r\n <RenderPropWrapper renderProps={{ drawer: dialog.drawer }}>{props.children}</RenderPropWrapper>\r\n </DialogPrimitive.Close>\r\n );\r\n } else {\r\n output = props.children;\r\n }\r\n\r\n return (\r\n <DialogPrimitive.Portal>\r\n <DialogPrimitive.Overlay asChild>\r\n <Backdrop>\r\n <DialogPrimitive.Content\r\n {...props}\r\n className={className}\r\n onEscapeKeyDown={handleEscapeKeyDown}\r\n onInteractOutside={handleInteractOutside}\r\n onCloseAutoFocus={handleCloseAutoFocus}\r\n ref={ref}\r\n style={{\r\n ...props.style,\r\n left: dialog.draggable ? `${position.x}px` : undefined,\r\n top: dialog.draggable ? `${position.y}px` : undefined,\r\n }}\r\n >\r\n <div className={containerClassName} data-taco=\"dialog\">\r\n {output}\r\n {dialog.draggable && (\r\n <div\r\n {...dragHandleProps}\r\n aria-label={texts.dialog.drag}\r\n className=\"yt-dialog__drag absolute-center-x bg-grey-light top-1.5 h-3 w-24 cursor-move rounded text-center\"\r\n />\r\n )}\r\n {dialog.showCloseButton ? (\r\n <DialogPrimitive.Close onClick={dialog.onClose} asChild>\r\n <IconButton\r\n appearance=\"discrete\"\r\n aria-label={texts.dialog.close}\r\n className=\"absolute top-0 right-0 mt-2 mr-2\"\r\n icon=\"close\"\r\n />\r\n </DialogPrimitive.Close>\r\n ) : null}\r\n </div>\r\n {dialog.elements.drawer}\r\n {dialog.elements.extra}\r\n </DialogPrimitive.Content>\r\n </Backdrop>\r\n </DialogPrimitive.Overlay>\r\n </DialogPrimitive.Portal>\r\n );\r\n});\r\n"],"names":["Title","React","DialogTitle","props","ref","className","cn","DialogPrimitive","Footer","DialogFooter","children","Close","DialogClose","dialog","useCurrentDialog","onClick","onClose","asChild","RenderPropWrapper","renderProps","close","CustomEvent","Content","DialogContent","internalRef","useProxiedRef","position","handleProps","dragHandleProps","useDraggable","texts","useLocalization","menu","useCurrentMenu","handleCloseAutoFocus","size","containerClassName","elements","extra","handleEscapeKeyDown","event","closeOnEscape","preventDefault","handleInteractOutside","output","drawer","Backdrop","onEscapeKeyDown","onInteractOutside","onCloseAutoFocus","style","left","draggable","x","undefined","top","y","drag","showCloseButton","IconButton","appearance","icon"],"mappings":";;;;;;;;;;;MAoBaA,KAAK,gBAAGC,UAAA,CAAiB,SAASC,WAAT,CAAqBC,KAArB,EAA8CC,GAA9C;EAClC,MAAMC,SAAS,GAAGC,EAAE,CAAC,aAAD,EAAgBH,KAAK,CAACE,SAAtB,CAApB;EACA,OAAOJ,aAAA,CAACM,OAAD,oBAA2BJ;IAAOE,SAAS,EAAEA;IAAWD,GAAG,EAAEA;IAA7D,CAAP;AACH,CAHoB;MAMRI,MAAM,gBAAGP,UAAA,CAAiB,SAASQ,YAAT,CAAsBN,KAAtB,EAAgDC,GAAhD;EACnC,MAAMC,SAAS,GAAGC,EAAE,CAAC,uBAAD,EAA0BH,KAAK,CAACE,SAAhC,CAApB;EACA,OACIJ,aAAA,MAAA,oBAASE;IAAOE,SAAS,EAAEA;IAAWD,GAAG,EAAEA;IAA3C,EACKD,KAAK,CAACO,QADX,CADJ;AAKH,CAPqB;MAWTC,KAAK,gBAAGV,UAAA,CAAiB,SAASW,WAAT,CAAqBT,KAArB,EAA8CC,GAA9C;EAClC,MAAMS,MAAM,GAAGC,gBAAgB,EAA/B;EAEA,O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SAAS,EAAE+B;iBAA8B;GAA9C,EACKQ,MADL,EAEK/B,MAAM,CAACuC,SAAP,IACGnD,aAAA,MAAA,oBACQ2B;kBACQE,KAAK,CAACjB,MAAN,CAAa4C;IACzBpD,SAAS,EAAC;IAHd,CAHR,EASKQ,MAAM,CAAC6C,eAAP,GACGzD,aAAA,CAACM,OAAD;IAAuBQ,OAAO,EAAEF,MAAM,CAACG;IAASC,OAAO;GAAvD,EACIhB,aAAA,CAAC0D,UAAD;IACIC,UAAU,EAAC;kBACC9B,KAAK,CAACjB,MAAN,CAAaO;IACzBf,SAAS,EAAC;IACVwD,IAAI,EAAC;GAJT,CADJ,CADH,GASG,IAlBR,CAbJ,EAiCKhD,MAAM,CAACwB,QAAP,CAAgBQ,MAjCrB,EAkCKhC,MAAM,CAACwB,QAAP,CAAgBC,KAlCrB,CADJ,CADJ,CADJ,CADJ;AA4CH,CAnGsB;;;;"}
1
+ {"version":3,"file":"Content.js","sources":["../../../../../src/components/Dialog/components/Content.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport type { DialogContentProps as DialogPrimitiveContentProps } from '@radix-ui/react-dialog';\nimport { useProxiedRef } from '../../../utils/hooks/useProxiedRef';\nimport { useDraggable } from '../../../utils/hooks/useDraggable';\nimport { useCurrentMenu } from '../../Menu/Context';\nimport { DialogContext, useCurrentDialog } from '../Context';\nimport { useLocalization } from '../../Provider/Provider';\nimport { IconButton } from '../../IconButton/IconButton';\nimport { Backdrop } from '../../Backdrop/Backdrop';\n\nexport type DialogContentDrawerRenderProps = DialogContext['drawer'];\n\nexport type DialogContentRenderProps = {\n close: () => void;\n drawer?: DialogContentDrawerRenderProps;\n};\n\nexport type DialogTitleProps = React.HTMLAttributes<HTMLHeadingElement>;\nexport const Title = React.forwardRef(function DialogTitle(props: DialogTitleProps, ref: React.Ref<HTMLHeadingElement>) {\n const className = cn('text-center', props.className);\n return <DialogPrimitive.Title {...props} className={className} ref={ref} />;\n});\n\nexport type DialogFooterProps = React.HTMLAttributes<HTMLDivElement>;\nexport const Footer = React.forwardRef(function DialogFooter(props: DialogFooterProps, ref: React.Ref<HTMLDivElement>) {\n const className = cn('mt-8 flex justify-end', props.className);\n return (\n <div {...props} className={className} ref={ref}>\n {props.children}\n </div>\n );\n});\n\nexport type DialogCloseProps = React.HTMLAttributes<HTMLButtonElement>;\n\nexport const Close = React.forwardRef(function DialogClose(props: DialogCloseProps, ref: React.Ref<HTMLButtonElement>) {\n const dialog = useCurrentDialog();\n\n return <DialogPrimitive.Close onClick={dialog.onClose} {...props} ref={ref} asChild />;\n});\n\nconst RenderPropWrapper = React.forwardRef(function RenderPropWrapper({ children, onClick, renderProps }: any, ref) {\n const close = () => {\n onClick(new CustomEvent('close'));\n };\n\n return children({ close, ref, ...renderProps });\n});\n\nexport type DialogContentProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> & {\n /** An accessible label to be announced when the dialog is opened */\n 'aria-label': string;\n children: Omit<React.ReactNode, 'Function'> | ((props: DialogContentRenderProps) => JSX.Element);\n};\nexport const Content = React.forwardRef(function DialogContent(props: DialogContentProps, ref: React.Ref<HTMLDivElement>) {\n const dialog = useCurrentDialog();\n const internalRef = useProxiedRef<HTMLDivElement>(ref);\n const { position, handleProps: dragHandleProps } = useDraggable(internalRef);\n const { texts } = useLocalization();\n\n // if the dialog was opened by a menu, we need to close the menu when the dialog closes\n // the menu is still open (and mounted) because it is the trigger for the dialog\n const menu = useCurrentMenu();\n let handleCloseAutoFocus: DialogPrimitiveContentProps['onCloseAutoFocus'];\n\n if (menu) {\n handleCloseAutoFocus = () => menu.close();\n }\n\n const className = cn('bg-white rounded relative mt-16 mx-auto animate-[fade-in_150ms] z-[997]', {\n 'w-128 text-center justify-center': dialog.size === 'dialog',\n 'w-xs': dialog.size === 'xs',\n 'w-sm': dialog.size === 'sm',\n 'w-md': dialog.size === 'md',\n 'w-lg': dialog.size === 'lg',\n });\n\n const containerClassName = cn(\n 'bg-white p-6 rounded relative z-[999]',\n 'shadow-[0_6px_9px_0_rgba(89,85,98,0.3),0_0_1px_0_rgba(89,85,98,0.2)]',\n {\n 'rounded-b-none': !!dialog.elements.extra,\n },\n props.className\n );\n\n const handleEscapeKeyDown = (event: KeyboardEvent) => {\n if (!dialog.closeOnEscape) {\n event.preventDefault();\n } else if (dialog.onClose) {\n dialog.onClose();\n }\n };\n\n // the chosen behaviour in taco is that outside clicks do not close the dialog\n const handleInteractOutside = event => event.preventDefault();\n\n let output;\n\n if (typeof props.children === 'function') {\n output = (\n <DialogPrimitive.Close asChild>\n <RenderPropWrapper renderProps={{ drawer: dialog.drawer }}>{props.children}</RenderPropWrapper>\n </DialogPrimitive.Close>\n );\n } else {\n output = props.children;\n }\n\n return (\n <DialogPrimitive.Portal>\n <DialogPrimitive.Overlay asChild>\n <Backdrop>\n <DialogPrimitive.Content\n {...props}\n className={className}\n onEscapeKeyDown={handleEscapeKeyDown}\n onInteractOutside={handleInteractOutside}\n onCloseAutoFocus={handleCloseAutoFocus}\n ref={ref}\n style={{\n ...props.style,\n left: dialog.draggable ? `${position.x}px` : undefined,\n top: dialog.draggable ? `${position.y}px` : undefined,\n }}\n >\n <div className={containerClassName} data-taco=\"dialog\">\n {output}\n {dialog.draggable && (\n <div\n {...dragHandleProps}\n aria-label={texts.dialog.drag}\n className=\"yt-dialog__drag absolute-center-x bg-grey-light top-1.5 h-3 w-24 cursor-move rounded text-center\"\n />\n )}\n {dialog.showCloseButton ? (\n <DialogPrimitive.Close onClick={dialog.onClose} asChild>\n <IconButton\n appearance=\"discrete\"\n aria-label={texts.dialog.close}\n className=\"absolute top-0 right-0 mt-2 mr-2\"\n icon=\"close\"\n />\n </DialogPrimitive.Close>\n ) : null}\n </div>\n {dialog.elements.drawer}\n {dialog.elements.extra}\n </DialogPrimitive.Content>\n </Backdrop>\n </DialogPrimitive.Overlay>\n </DialogPrimitive.Portal>\n );\n});\n"],"names":["Title","React","DialogTitle","props","ref","className","cn","DialogPrimitive","Footer","DialogFooter","children","Close","DialogClose","dialog","useCurrentDialog","onClick","onClose","asChild","RenderPropWrapper","renderProps","close","CustomEvent","Content","DialogContent","internalRef","useProxiedRef","position","handleProps","dragHandleProps","useDraggable","texts","useLocalization","menu","useCurrentMenu","handleCloseAutoFocus","size","containerClassName","elements","extra","handleEscapeKeyDown","event","closeOnEscape","preventDefault","handleInteractOutside","output","drawer","Backdrop","onEscapeKeyDown","onInteractOutside","onCloseAutoFocus","style","left","draggable","x","undefined","top","y","drag","showCloseButton","IconButton","appearance","icon"],"mappings":";;;;;;;;;;;MAoBaA,KAAK,gBAAGC,UAAA,CAAiB,SAASC,WAAT,CAAqBC,KAArB,EAA8CC,GAA9C;EAClC,MAAMC,SAAS,GAAGC,EAAE,CAAC,aAAD,EAAgBH,KAAK,CAACE,SAAtB,CAApB;EACA,OAAOJ,aAAA,CAACM,OAAD,oBAA2BJ;IAAOE,SAAS,EAAEA;IAAWD,GAAG,EAAEA;IAA7D,CAAP;AACH,CAHoB;MAMRI,MAAM,gBAAGP,UAAA,CAAiB,SAASQ,YAAT,CAAsBN,KAAtB,EAAgDC,GAAhD;EACnC,MAAMC,SAAS,GAAGC,EAAE,CAAC,uBAAD,EAA0BH,KAAK,CAACE,SAAhC,CAApB;EACA,OACIJ,aAAA,MAAA,oBAASE;IAAOE,SAAS,EAAEA;IAAWD,GAAG,EAAEA;IAA3C,EACKD,KAAK,CAACO,QADX,CADJ;AAKH,CAPqB;MAWTC,KAAK,gBAAGV,UAAA,CAAiB,SAASW,WAAT,CAAqBT,KAArB,EAA8CC,GAA9C;EAClC,MAAMS,MAAM,GAAGC,gBAAgB,EAA/B;EAEA,OAAOb,aAAA,CAACM,OAAD;IAAuBQ,OAAO,EAAEF,MAAM,CAACG;KAAab;IAAOC,GAAG,EAAEA;IAAKa,OAAO;IAA5E,CAAP;AACH,CAJoB;AAMrB,MAAMC,iBAAiB,gBAAGjB,UAAA,CAAiB,SAASiB,iBAAT,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6C,eAAP,GACGzD,aAAA,CAACM,OAAD;IAAuBQ,OAAO,EAAEF,MAAM,CAACG;IAASC,OAAO;GAAvD,EACIhB,aAAA,CAAC0D,UAAD;IACIC,UAAU,EAAC;kBACC9B,KAAK,CAACjB,MAAN,CAAaO;IACzBf,SAAS,EAAC;IACVwD,IAAI,EAAC;GAJT,CADJ,CADH,GASG,IAlBR,CAbJ,EAiCKhD,MAAM,CAACwB,QAAP,CAAgBQ,MAjCrB,EAkCKhC,MAAM,CAACwB,QAAP,CAAgBC,KAlCrB,CADJ,CADJ,CADJ,CADJ;AA4CH,CAnGsB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Drawer.js","sources":["../../../../../src/components/Dialog/components/Drawer.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport { motion } from 'framer-motion';\r\nimport cn from 'classnames';\r\nimport { DialogContext, useCurrentDialog } from '../Context';\r\n\r\nexport type DialogDrawerRenderProps = DialogContext['drawer'];\r\n\r\nexport type DialogDrawerProps = Omit<\r\n React.HTMLAttributes<HTMLDivElement>,\r\n 'onAnimationStart' | 'onDragStart' | 'onDragEnd' | 'onDrag'\r\n> & {\r\n children: Omit<React.ReactNode, 'Function'> | ((props: DialogDrawerRenderProps) => React.ReactNode);\r\n};\r\n\r\nconst Drawer = React.forwardRef(function DialogDrawer(props: DialogDrawerProps, ref: React.Ref<HTMLDivElement>) {\r\n const dialog = useCurrentDialog();\r\n const className = cn(\r\n 'absolute top-0 z-[998] -ml-[4px] hidden h-full w-full overflow-y-auto rounded-r bg-white p-6 text-left',\r\n props.className\r\n );\r\n\r\n return (\r\n <motion.div\r\n {...props}\r\n className={className}\r\n data-taco=\"dialog-drawer\"\r\n aria-hidden={!dialog.drawer?.open}\r\n variants={{\r\n visible: {\r\n left: '100%',\r\n display: 'block',\r\n transition: { ease: 'easeOut', duration: 0.2 },\r\n },\r\n hidden: {\r\n left: '0%',\r\n transition: { ease: 'easeOut', duration: 0.2 },\r\n transitionEnd: {\r\n display: 'none',\r\n },\r\n },\r\n }}\r\n animate={dialog.drawer?.open ? 'visible' : 'hidden'}\r\n ref={ref}\r\n >\r\n {typeof props.children === 'function' ? props.children(dialog.drawer) : props.children}\r\n </motion.div>\r\n );\r\n});\r\nDrawer.displayName = 'DialogDrawer';\r\n\r\nexport { Drawer };\r\n"],"names":["Drawer","React","DialogDrawer","props","ref","dialog","useCurrentDialog","className","cn","motion","div","drawer","open","variants","visible","left","display","transition","ease","duration","hidden","transitionEnd","animate","children","displayName"],"mappings":";;;;;MAcMA,MAAM,gBAAGC,UAAA,CAAiB,SAASC,YAAT,CAAsBC,KAAtB,EAAgDC,GAAhD;;;EAC5B,MAAMC,MAAM,GAAGC,gBAAgB,EAA/B;EACA,MAAMC,SAAS,GAAGC,EAAE,CAChB,wGADgB,EAEhBL,KAAK,CAACI,SAFU,CAApB;EAKA,OACIN,aAAA,CAACQ,MAAM,CAACC,GAAR,oBACQP;IACJI,SAAS,EAAEA;iBACD;mBACG,oBAACF,MAAM,CAACM,MAAR,2CAAC,eAAeC,IAAhB;IACbC,QAAQ,EAAE;MACNC,OAAO,EAAE;QACLC,IAAI,EAAE,MADD;QAELC,OAAO,EAAE,OAFJ;QAGLC,UAAU,EAAE;UAAEC,IAAI,EAAE,SAAR;UAAmBC,QAAQ,EAAE;;OAJvC;MAMNC,MAAM,EAAE;QACJL,IAAI,EAAE,IADF;QAEJE,UAAU,EAAE;UAAEC,IAAI,EAAE,SAAR;UAAmBC,QAAQ,EAAE;SAFrC;QAGJE,aAAa,EAAE;UACXL,OAAO,EAAE;;;;IAIrBM,OAAO,EAAE,mBAAAjB,MAAM,CAACM,MAAP,4DAAeC,IAAf,GAAsB,SAAtB,GAAkC;IAC3CR,GAAG,EAAEA;IApBT,EAsBK,OAAOD,KAAK,CAACoB,QAAb,KAA0B,UAA1B,GAAuCpB,KAAK,CAACoB,QAAN,CAAelB,MAAM,CAACM,MAAtB,CAAvC,GAAuER,KAAK,CAACoB,QAtBlF,CADJ;AA0BH,CAjCc;AAkCfvB,MAAM,CAACwB,WAAP,GAAqB,cAArB;;;;"}
1
+ {"version":3,"file":"Drawer.js","sources":["../../../../../src/components/Dialog/components/Drawer.tsx"],"sourcesContent":["import * as React from 'react';\nimport { motion } from 'framer-motion';\nimport cn from 'classnames';\nimport { DialogContext, useCurrentDialog } from '../Context';\n\nexport type DialogDrawerRenderProps = DialogContext['drawer'];\n\nexport type DialogDrawerProps = Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'onAnimationStart' | 'onDragStart' | 'onDragEnd' | 'onDrag'\n> & {\n children: Omit<React.ReactNode, 'Function'> | ((props: DialogDrawerRenderProps) => React.ReactNode);\n};\n\nconst Drawer = React.forwardRef(function DialogDrawer(props: DialogDrawerProps, ref: React.Ref<HTMLDivElement>) {\n const dialog = useCurrentDialog();\n const className = cn(\n 'absolute top-0 z-[998] -ml-[4px] hidden h-full w-full overflow-y-auto rounded-r bg-white p-6 text-left',\n props.className\n );\n\n return (\n <motion.div\n {...props}\n className={className}\n data-taco=\"dialog-drawer\"\n aria-hidden={!dialog.drawer?.open}\n variants={{\n visible: {\n left: '100%',\n display: 'block',\n transition: { ease: 'easeOut', duration: 0.2 },\n },\n hidden: {\n left: '0%',\n transition: { ease: 'easeOut', duration: 0.2 },\n transitionEnd: {\n display: 'none',\n },\n },\n }}\n animate={dialog.drawer?.open ? 'visible' : 'hidden'}\n ref={ref}\n >\n {typeof props.children === 'function' ? props.children(dialog.drawer) : props.children}\n </motion.div>\n );\n});\nDrawer.displayName = 'DialogDrawer';\n\nexport { Drawer };\n"],"names":["Drawer","React","DialogDrawer","props","ref","dialog","useCurrentDialog","className","cn","motion","div","drawer","open","variants","visible","left","display","transition","ease","duration","hidden","transitionEnd","animate","children","displayName"],"mappings":";;;;;MAcMA,MAAM,gBAAGC,UAAA,CAAiB,SAASC,YAAT,CAAsBC,KAAtB,EAAgDC,GAAhD;;;EAC5B,MAAMC,MAAM,GAAGC,gBAAgB,EAA/B;EACA,MAAMC,SAAS,GAAGC,EAAE,CAChB,wGADgB,EAEhBL,KAAK,CAACI,SAFU,CAApB;EAKA,OACIN,aAAA,CAACQ,MAAM,CAACC,GAAR,oBACQP;IACJI,SAAS,EAAEA;iBACD;mBACG,oBAACF,MAAM,CAACM,MAAR,2CAAC,eAAeC,IAAhB;IACbC,QAAQ,EAAE;MACNC,OAAO,EAAE;QACLC,IAAI,EAAE,MADD;QAELC,OAAO,EAAE,OAFJ;QAGLC,UAAU,EAAE;UAAEC,IAAI,EAAE,SAAR;UAAmBC,QAAQ,EAAE;;OAJvC;MAMNC,MAAM,EAAE;QACJL,IAAI,EAAE,IADF;QAEJE,UAAU,EAAE;UAAEC,IAAI,EAAE,SAAR;UAAmBC,QAAQ,EAAE;SAFrC;QAGJE,aAAa,EAAE;UACXL,OAAO,EAAE;;;;IAIrBM,OAAO,EAAE,mBAAAjB,MAAM,CAACM,MAAP,4DAAeC,IAAf,GAAsB,SAAtB,GAAkC;IAC3CR,GAAG,EAAEA;IApBT,EAsBK,OAAOD,KAAK,CAACoB,QAAb,KAA0B,UAA1B,GAAuCpB,KAAK,CAACoB,QAAN,CAAelB,MAAM,CAACM,MAAtB,CAAvC,GAAuER,KAAK,CAACoB,QAtBlF,CADJ;AA0BH,CAjCc;AAkCfvB,MAAM,CAACwB,WAAP,GAAqB,cAArB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Extra.js","sources":["../../../../../src/components/Dialog/components/Extra.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport cn from 'classnames';\r\n\r\nexport type DialogExtraProps = React.HTMLAttributes<HTMLDivElement>;\r\n\r\nconst Extra = React.forwardRef(function DialogExtra(props: DialogExtraProps, ref: React.Ref<HTMLDivElement>) {\r\n const className = cn(\r\n 'bg-grey-light yt-shadow-inset absolute top-full left-0 -mt-px w-full rounded-t-none rounded-b p-6 text-left',\r\n props.className\r\n );\r\n\r\n return <div {...props} className={className} data-taco=\"dialog-extra\" ref={ref} />;\r\n});\r\nExtra.displayName = 'DialogExtra';\r\n\r\nexport { Extra };\r\n"],"names":["Extra","React","DialogExtra","props","ref","className","cn","displayName"],"mappings":";;;MAKMA,KAAK,gBAAGC,UAAA,CAAiB,SAASC,WAAT,CAAqBC,KAArB,EAA8CC,GAA9C;EAC3B,MAAMC,SAAS,GAAGC,EAAE,CAChB,6GADgB,EAEhBH,KAAK,CAACE,SAFU,CAApB;EAKA,OAAOJ,aAAA,MAAA,oBAASE;IAAOE,SAAS,EAAEA;iBAAqB;IAAeD,GAAG,EAAEA;IAApE,CAAP;AACH,CAPa;AAQdJ,KAAK,CAACO,WAAN,GAAoB,aAApB;;;;"}
1
+ {"version":3,"file":"Extra.js","sources":["../../../../../src/components/Dialog/components/Extra.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\n\nexport type DialogExtraProps = React.HTMLAttributes<HTMLDivElement>;\n\nconst Extra = React.forwardRef(function DialogExtra(props: DialogExtraProps, ref: React.Ref<HTMLDivElement>) {\n const className = cn(\n 'bg-grey-light yt-shadow-inset absolute top-full left-0 -mt-px w-full rounded-t-none rounded-b p-6 text-left',\n props.className\n );\n\n return <div {...props} className={className} data-taco=\"dialog-extra\" ref={ref} />;\n});\nExtra.displayName = 'DialogExtra';\n\nexport { Extra };\n"],"names":["Extra","React","DialogExtra","props","ref","className","cn","displayName"],"mappings":";;;MAKMA,KAAK,gBAAGC,UAAA,CAAiB,SAASC,WAAT,CAAqBC,KAArB,EAA8CC,GAA9C;EAC3B,MAAMC,SAAS,GAAGC,EAAE,CAChB,6GADgB,EAEhBH,KAAK,CAACE,SAFU,CAApB;EAKA,OAAOJ,aAAA,MAAA,oBAASE;IAAOE,SAAS,EAAEA;iBAAqB;IAAeD,GAAG,EAAEA;IAApE,CAAP;AACH,CAPa;AAQdJ,KAAK,CAACO,WAAN,GAAoB,aAApB;;;;"}
@@ -1,5 +1,5 @@
1
1
  import { forwardRef, createElement } from 'react';
2
- import mergeRefs from '../../../utils/mergeRefs.js';
2
+ import { mergeRefs } from '../../../utils/mergeRefs.js';
3
3
  import { Trigger as Trigger$1 } from '@radix-ui/react-dialog';
4
4
  import { useCurrentDialog } from '../Context.js';
5
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"Trigger.js","sources":["../../../../../src/components/Dialog/components/Trigger.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\r\nimport { useCurrentDialog } from '../Context';\r\nimport mergeRefs from '../../../utils/mergeRefs';\r\n\r\nexport type DialogTriggerProps = React.HTMLAttributes<HTMLButtonElement>;\r\n\r\nexport const Trigger = React.forwardRef(function DialogTrigger(props: DialogTriggerProps, ref: React.Ref<HTMLButtonElement>) {\r\n const dialog = useCurrentDialog();\r\n return <DialogPrimitive.Trigger {...dialog.props} {...props} ref={mergeRefs([dialog.ref, ref])} asChild />;\r\n});\r\n"],"names":["Trigger","React","DialogTrigger","props","ref","dialog","useCurrentDialog","DialogPrimitive","mergeRefs","asChild"],"mappings":";;;;;MAOaA,OAAO,gBAAGC,UAAA,CAAiB,SAASC,aAAT,CAAuBC,KAAvB,EAAkDC,GAAlD;EACpC,MAAMC,MAAM,GAAGC,gBAAgB,EAA/B;EACA,OAAOL,aAAA,CAACM,SAAD,oBAA6BF,MAAM,CAACF,OAAWA;IAAOC,GAAG,EAAEI,SAAS,CAAC,CAACH,MAAM,CAACD,GAAR,EAAaA,GAAb,CAAD;IAAqBK,OAAO;IAAhG,CAAP;AACH,CAHsB;;;;"}
1
+ {"version":3,"file":"Trigger.js","sources":["../../../../../src/components/Dialog/components/Trigger.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { useCurrentDialog } from '../Context';\nimport { mergeRefs } from '../../../utils/mergeRefs';\n\nexport type DialogTriggerProps = React.HTMLAttributes<HTMLButtonElement>;\n\nexport const Trigger = React.forwardRef(function DialogTrigger(props: DialogTriggerProps, ref: React.Ref<HTMLButtonElement>) {\n const dialog = useCurrentDialog();\n return <DialogPrimitive.Trigger {...dialog.props} {...props} ref={mergeRefs([dialog.ref, ref])} asChild />;\n});\n"],"names":["Trigger","React","DialogTrigger","props","ref","dialog","useCurrentDialog","DialogPrimitive","mergeRefs","asChild"],"mappings":";;;;;MAOaA,OAAO,gBAAGC,UAAA,CAAiB,SAASC,aAAT,CAAuBC,KAAvB,EAAkDC,GAAlD;EACpC,MAAMC,MAAM,GAAGC,gBAAgB,EAA/B;EACA,OAAOL,aAAA,CAACM,SAAD,oBAA6BF,MAAM,CAACF,OAAWA;IAAOC,GAAG,EAAEI,SAAS,CAAC,CAACH,MAAM,CAACD,GAAR,EAAaA,GAAb,CAAD;IAAqBK,OAAO;IAAhG,CAAP;AACH,CAHsB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Field.js","sources":["../../../../src/components/Field/Field.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport cn from 'classnames';\r\n\r\nimport './Field.css';\r\n\r\nexport type FieldProps = React.LabelHTMLAttributes<HTMLLabelElement> & {\r\n /** Content of the field */\r\n children: React.ReactNode;\r\n /**\tChanges the style to indicate the element is disabled */\r\n disabled?: boolean;\r\n /* Whether the input is in an invalid state */\r\n invalid?: boolean;\r\n /**\r\n * Text displayed below the children of Field.\r\n * Should be a short text that indicates feedback for user.\r\n */\r\n message?: string;\r\n};\r\n\r\nexport const Field = React.forwardRef(function Field(props: FieldProps, ref: React.Ref<HTMLLabelElement>) {\r\n const { disabled, children, invalid = false, message, ...otherProps } = props;\r\n const className = cn(\r\n 'flex flex-col font-bold text-xs leading-loose pb-4 min-h-[theme(spacing.18)]',\r\n {\r\n 'text-grey-dark': disabled,\r\n },\r\n props.className\r\n );\r\n const messageClassName = cn(\r\n 'h-4 text-xs text-left leading-normal font-normal truncate -mb-4',\r\n {\r\n 'text-grey-darkest': !invalid,\r\n 'text-red': invalid,\r\n 'opacity-50': disabled,\r\n },\r\n props.className\r\n );\r\n\r\n return (\r\n <label {...otherProps} className={className} data-taco=\"label\" ref={ref}>\r\n {children}\r\n {message && (\r\n <span className={messageClassName} role={invalid ? 'alert' : undefined}>\r\n {message}\r\n </span>\r\n )}\r\n </label>\r\n );\r\n});\r\n"],"names":["Field","React","props","ref","disabled","children","invalid","message","otherProps","className","cn","messageClassName","role","undefined"],"mappings":";;;;;IAmBaA,KAAK,gBAAGC,UAAA,CAAiB,SAASD,KAAT,CAAeE,KAAf,EAAkCC,GAAlC;EAClC,IAAQC,QAAR,GAAwEF,KAAxE,CAAQE,QAAR;MAAkBC,QAAlB,GAAwEH,KAAxE,CAAkBG,QAAlB;uBAAwEH,KAAxE,CAA4BI,OAA5B;MAA4BA,OAA5B,+BAAsC,KAAtC;MAA6CC,OAA7C,GAAwEL,KAAxE,CAA6CK,OAA7C;MAAyDC,UAAzD,iCAAwEN,KAAxE;;EACA,IAAMO,SAAS,GAAGC,EAAE,CAChB,8EADgB,EAEhB;IACI,kBAAkBN;GAHN,EAKhBF,KAAK,CAACO,SALU,CAApB;EAOA,IAAME,gBAAgB,GAAGD,EAAE,CACvB,iEADuB,EAEvB;IACI,qBAAqB,CAACJ,OAD1B;IAEI,YAAYA,OAFhB;IAGI,cAAcF;GALK,EAOvBF,KAAK,CAACO,SAPiB,CAA3B;EAUA,OACIR,aAAA,QAAA,oBAAWO;IAAYC,SAAS,EAAEA;iBAAqB;IAAQN,GAAG,EAAEA;IAApE,EACKE,QADL,EAEKE,OAAO,IACJN,aAAA,OAAA;IAAMQ,SAAS,EAAEE;IAAkBC,IAAI,EAAEN,OAAO,GAAG,OAAH,GAAaO;GAA7D,EACKN,OADL,CAHR,CADJ;AAUH,CA7BoB;;;;"}
1
+ {"version":3,"file":"Field.js","sources":["../../../../src/components/Field/Field.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\n\nimport './Field.css';\n\nexport type FieldProps = React.LabelHTMLAttributes<HTMLLabelElement> & {\n /** Content of the field */\n children: React.ReactNode;\n /**\tChanges the style to indicate the element is disabled */\n disabled?: boolean;\n /* Whether the input is in an invalid state */\n invalid?: boolean;\n /**\n * Text displayed below the children of Field.\n * Should be a short text that indicates feedback for user.\n */\n message?: string;\n};\n\nexport const Field = React.forwardRef(function Field(props: FieldProps, ref: React.Ref<HTMLLabelElement>) {\n const { disabled, children, invalid = false, message, ...otherProps } = props;\n const className = cn(\n 'flex flex-col font-bold text-xs leading-loose pb-4 min-h-[theme(spacing.18)]',\n {\n 'text-grey-dark': disabled,\n },\n props.className\n );\n const messageClassName = cn(\n 'h-4 text-xs text-left leading-normal font-normal truncate -mb-4',\n {\n 'text-grey-darkest': !invalid,\n 'text-red': invalid,\n 'opacity-50': disabled,\n },\n props.className\n );\n\n return (\n <label {...otherProps} className={className} data-taco=\"label\" ref={ref}>\n {children}\n {message && (\n <span className={messageClassName} role={invalid ? 'alert' : undefined}>\n {message}\n </span>\n )}\n </label>\n );\n});\n"],"names":["Field","React","props","ref","disabled","children","invalid","message","otherProps","className","cn","messageClassName","role","undefined"],"mappings":";;;;;IAmBaA,KAAK,gBAAGC,UAAA,CAAiB,SAASD,KAAT,CAAeE,KAAf,EAAkCC,GAAlC;EAClC,IAAQC,QAAR,GAAwEF,KAAxE,CAAQE,QAAR;MAAkBC,QAAlB,GAAwEH,KAAxE,CAAkBG,QAAlB;uBAAwEH,KAAxE,CAA4BI,OAA5B;MAA4BA,OAA5B,+BAAsC,KAAtC;MAA6CC,OAA7C,GAAwEL,KAAxE,CAA6CK,OAA7C;MAAyDC,UAAzD,iCAAwEN,KAAxE;;EACA,IAAMO,SAAS,GAAGC,EAAE,CAChB,8EADgB,EAEhB;IACI,kBAAkBN;GAHN,EAKhBF,KAAK,CAACO,SALU,CAApB;EAOA,IAAME,gBAAgB,GAAGD,EAAE,CACvB,iEADuB,EAEvB;IACI,qBAAqB,CAACJ,OAD1B;IAEI,YAAYA,OAFhB;IAGI,cAAcF;GALK,EAOvBF,KAAK,CAACO,SAPiB,CAA3B;EAUA,OACIR,aAAA,QAAA,oBAAWO;IAAYC,SAAS,EAAEA;iBAAqB;IAAQN,GAAG,EAAEA;IAApE,EACKE,QADL,EAEKE,OAAO,IACJN,aAAA,OAAA;IAAMQ,SAAS,EAAEE;IAAkBC,IAAI,EAAEN,OAAO,GAAG,OAAH,GAAaO;GAA7D,EACKN,OADL,CAHR,CADJ;AAUH,CA7BoB;;;;"}