@economic/taco 0.0.33-alpha.1 → 1.0.0-alpha.0

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 (409) hide show
  1. package/README.md +84 -84
  2. package/dist/components/Icon/components/{Minus.d.ts → CircleClose.d.ts} +0 -0
  3. package/dist/components/Icon/components/{PlusCircle.d.ts → CircleMinus.d.ts} +0 -0
  4. package/dist/components/Icon/components/{TickCircle.d.ts → CirclePlus.d.ts} +0 -0
  5. package/dist/components/Icon/components/CircleTick.d.ts +3 -0
  6. package/dist/components/Icon/components/index.d.ts +1 -1
  7. package/dist/components/Input/Input.d.ts +1 -1
  8. package/dist/components/Listbox/useMultiListbox.d.ts +1 -1
  9. package/dist/components/Menu/Menu.d.ts +2 -2
  10. package/dist/components/Menu/components/Item.d.ts +1 -1
  11. package/dist/components/Menu/components/Link.d.ts +1 -1
  12. package/dist/components/Select/useSelect.d.ts +13 -8
  13. package/dist/esm/components/Accordion/Accordion.js.map +1 -1
  14. package/dist/esm/components/Backdrop/Backdrop.js.map +1 -1
  15. package/dist/esm/components/Badge/Badge.js.map +1 -1
  16. package/dist/esm/components/Banner/Banner.js.map +1 -1
  17. package/dist/esm/components/Banner/util.js +1 -1
  18. package/dist/esm/components/Banner/util.js.map +1 -1
  19. package/dist/esm/components/Button/Button.js.map +1 -1
  20. package/dist/esm/components/Button/util.js +23 -18
  21. package/dist/esm/components/Button/util.js.map +1 -1
  22. package/dist/esm/components/Calendar/Calendar.js.map +1 -1
  23. package/dist/esm/components/Checkbox/Checkbox.js +1 -1
  24. package/dist/esm/components/Checkbox/Checkbox.js.map +1 -1
  25. package/dist/esm/components/Combobox/Combobox.js.map +1 -1
  26. package/dist/esm/components/Combobox/useCombobox.js +87 -67
  27. package/dist/esm/components/Combobox/useCombobox.js.map +1 -1
  28. package/dist/esm/components/Datepicker/Datepicker.js.map +1 -1
  29. package/dist/esm/components/Datepicker/useDatepicker.js +34 -27
  30. package/dist/esm/components/Datepicker/useDatepicker.js.map +1 -1
  31. package/dist/esm/components/Dialog/Context.js +4 -4
  32. package/dist/esm/components/Dialog/Context.js.map +1 -1
  33. package/dist/esm/components/Dialog/Dialog.js.map +1 -1
  34. package/dist/esm/components/Dialog/components/Content.js +44 -39
  35. package/dist/esm/components/Dialog/components/Content.js.map +1 -1
  36. package/dist/esm/components/Dialog/components/Drawer.js +3 -3
  37. package/dist/esm/components/Dialog/components/Drawer.js.map +1 -1
  38. package/dist/esm/components/Dialog/components/Extra.js +2 -2
  39. package/dist/esm/components/Dialog/components/Extra.js.map +1 -1
  40. package/dist/esm/components/Dialog/components/Trigger.js +2 -2
  41. package/dist/esm/components/Dialog/components/Trigger.js.map +1 -1
  42. package/dist/esm/components/Field/Field.js.map +1 -1
  43. package/dist/esm/components/Form/Form.js.map +1 -1
  44. package/dist/esm/components/Group/Group.js.map +1 -1
  45. package/dist/esm/components/Hanger/Hanger.js.map +1 -1
  46. package/dist/esm/components/Icon/Icon.js.map +1 -1
  47. package/dist/esm/components/Icon/components/AccountPreview.js.map +1 -1
  48. package/dist/esm/components/Icon/components/Accounting.js.map +1 -1
  49. package/dist/esm/components/Icon/components/AccountingYear.js.map +1 -1
  50. package/dist/esm/components/Icon/components/AccountingYearCancel.js.map +1 -1
  51. package/dist/esm/components/Icon/components/ArrowBottom.js.map +1 -1
  52. package/dist/esm/components/Icon/components/ArrowDown.js.map +1 -1
  53. package/dist/esm/components/Icon/components/ArrowEnd.js.map +1 -1
  54. package/dist/esm/components/Icon/components/ArrowLeft.js.map +1 -1
  55. package/dist/esm/components/Icon/components/ArrowRight.js.map +1 -1
  56. package/dist/esm/components/Icon/components/ArrowStart.js.map +1 -1
  57. package/dist/esm/components/Icon/components/ArrowTop.js.map +1 -1
  58. package/dist/esm/components/Icon/components/ArrowUp.js.map +1 -1
  59. package/dist/esm/components/Icon/components/Attach.js.map +1 -1
  60. package/dist/esm/components/Icon/components/AttachAuto.js.map +1 -1
  61. package/dist/esm/components/Icon/components/AttachCancel.js.map +1 -1
  62. package/dist/esm/components/Icon/components/Autotext.js.map +1 -1
  63. package/dist/esm/components/Icon/components/AutotextInsert.js.map +1 -1
  64. package/dist/esm/components/Icon/components/Basic.js.map +1 -1
  65. package/dist/esm/components/Icon/components/BasicTabs.js.map +1 -1
  66. package/dist/esm/components/Icon/components/BellSolid.js.map +1 -1
  67. package/dist/esm/components/Icon/components/Book.js.map +1 -1
  68. package/dist/esm/components/Icon/components/Booking.js.map +1 -1
  69. package/dist/esm/components/Icon/components/Budget.js.map +1 -1
  70. package/dist/esm/components/Icon/components/Calendar.js.map +1 -1
  71. package/dist/esm/components/Icon/components/CashAccount.js.map +1 -1
  72. package/dist/esm/components/Icon/components/CashReports.js.map +1 -1
  73. package/dist/esm/components/Icon/components/Chat.js.map +1 -1
  74. package/dist/esm/components/Icon/components/ChatSolid.js.map +1 -1
  75. package/dist/esm/components/Icon/components/ChevronDown.js.map +1 -1
  76. package/dist/esm/components/Icon/components/ChevronDownDouble.js.map +1 -1
  77. package/dist/esm/components/Icon/components/ChevronDownSolid.js.map +1 -1
  78. package/dist/esm/components/Icon/components/ChevronLeft.js.map +1 -1
  79. package/dist/esm/components/Icon/components/ChevronLeftDouble.js.map +1 -1
  80. package/dist/esm/components/Icon/components/ChevronRight.js.map +1 -1
  81. package/dist/esm/components/Icon/components/ChevronRightDouble.js.map +1 -1
  82. package/dist/esm/components/Icon/components/ChevronUp.js.map +1 -1
  83. package/dist/esm/components/Icon/components/ChevronUpDouble.js.map +1 -1
  84. package/dist/esm/components/Icon/components/ChevronUpSolid.js.map +1 -1
  85. package/dist/esm/components/Icon/components/CircleClose.js +19 -0
  86. package/dist/esm/components/Icon/components/CircleClose.js.map +1 -0
  87. package/dist/esm/components/Icon/components/{Minus.js → CircleMinus.js} +4 -4
  88. package/dist/esm/components/Icon/components/CircleMinus.js.map +1 -0
  89. package/dist/esm/components/Icon/components/{PlusCircle.js → CirclePlus.js} +4 -4
  90. package/dist/esm/components/Icon/components/CirclePlus.js.map +1 -0
  91. package/dist/esm/components/Icon/components/{TickCircle.js → CircleTick.js} +4 -4
  92. package/dist/esm/components/Icon/components/CircleTick.js.map +1 -0
  93. package/dist/esm/components/Icon/components/Clamp.js.map +1 -1
  94. package/dist/esm/components/Icon/components/ClampOpen.js.map +1 -1
  95. package/dist/esm/components/Icon/components/Close.js.map +1 -1
  96. package/dist/esm/components/Icon/components/ConnectionEnable.js.map +1 -1
  97. package/dist/esm/components/Icon/components/ConnectionRevoke.js.map +1 -1
  98. package/dist/esm/components/Icon/components/Contacts.js.map +1 -1
  99. package/dist/esm/components/Icon/components/Copy.js.map +1 -1
  100. package/dist/esm/components/Icon/components/Courses.js.map +1 -1
  101. package/dist/esm/components/Icon/components/Credit.js.map +1 -1
  102. package/dist/esm/components/Icon/components/Delete.js.map +1 -1
  103. package/dist/esm/components/Icon/components/DeletePermanently.js.map +1 -1
  104. package/dist/esm/components/Icon/components/Depecriate.js.map +1 -1
  105. package/dist/esm/components/Icon/components/Developer.js.map +1 -1
  106. package/dist/esm/components/Icon/components/DistributionTemplate.js.map +1 -1
  107. package/dist/esm/components/Icon/components/Document.js.map +1 -1
  108. package/dist/esm/components/Icon/components/DocumentApprove.js.map +1 -1
  109. package/dist/esm/components/Icon/components/DocumentCreateEntry.js.map +1 -1
  110. package/dist/esm/components/Icon/components/DocumentCut.js.map +1 -1
  111. package/dist/esm/components/Icon/components/DocumentError.js.map +1 -1
  112. package/dist/esm/components/Icon/components/DocumentIsolatePage.js.map +1 -1
  113. package/dist/esm/components/Icon/components/DocumentMerge.js.map +1 -1
  114. package/dist/esm/components/Icon/components/DocumentMove.js.map +1 -1
  115. package/dist/esm/components/Icon/components/DocumentPreview.js.map +1 -1
  116. package/dist/esm/components/Icon/components/DocumentReceived.js.map +1 -1
  117. package/dist/esm/components/Icon/components/DocumentRejectedRequest.js.map +1 -1
  118. package/dist/esm/components/Icon/components/DocumentSplit.js.map +1 -1
  119. package/dist/esm/components/Icon/components/DocumentTime.js.map +1 -1
  120. package/dist/esm/components/Icon/components/Download.js.map +1 -1
  121. package/dist/esm/components/Icon/components/Drag.js.map +1 -1
  122. package/dist/esm/components/Icon/components/ECopedia.js.map +1 -1
  123. package/dist/esm/components/Icon/components/ESignature.js.map +1 -1
  124. package/dist/esm/components/Icon/components/Edit.js.map +1 -1
  125. package/dist/esm/components/Icon/components/EllipsisHorizontal.js.map +1 -1
  126. package/dist/esm/components/Icon/components/EllipsisVertical.js.map +1 -1
  127. package/dist/esm/components/Icon/components/EntriesOnAccount.js.map +1 -1
  128. package/dist/esm/components/Icon/components/EntriesOpen.js.map +1 -1
  129. package/dist/esm/components/Icon/components/EntriesWarning.js.map +1 -1
  130. package/dist/esm/components/Icon/components/EntryTypeCustomerInvoice.js.map +1 -1
  131. package/dist/esm/components/Icon/components/EntryTypeCustomerPayment.js.map +1 -1
  132. package/dist/esm/components/Icon/components/EntryTypeJournalEntry.js.map +1 -1
  133. package/dist/esm/components/Icon/components/EntryTypeManualCustomerInvoice.js.map +1 -1
  134. package/dist/esm/components/Icon/components/EntryTypeSupplierInvoice.js.map +1 -1
  135. package/dist/esm/components/Icon/components/EntryTypeSupplierPayment.js.map +1 -1
  136. package/dist/esm/components/Icon/components/Envelope.js.map +1 -1
  137. package/dist/esm/components/Icon/components/EnvelopeApproved.js.map +1 -1
  138. package/dist/esm/components/Icon/components/ExpandView.js.map +1 -1
  139. package/dist/esm/components/Icon/components/Expenses.js.map +1 -1
  140. package/dist/esm/components/Icon/components/Export.js.map +1 -1
  141. package/dist/esm/components/Icon/components/ExportToExcel.js.map +1 -1
  142. package/dist/esm/components/Icon/components/ExportToPdf.js.map +1 -1
  143. package/dist/esm/components/Icon/components/Filter.js.map +1 -1
  144. package/dist/esm/components/Icon/components/FilterSolid.js.map +1 -1
  145. package/dist/esm/components/Icon/components/GraphSolid.js.map +1 -1
  146. package/dist/esm/components/Icon/components/Hash.js.map +1 -1
  147. package/dist/esm/components/Icon/components/Home.js.map +1 -1
  148. package/dist/esm/components/Icon/components/Images.js.map +1 -1
  149. package/dist/esm/components/Icon/components/Import.js.map +1 -1
  150. package/dist/esm/components/Icon/components/Inbox.js.map +1 -1
  151. package/dist/esm/components/Icon/components/InboxEinvoicing.js.map +1 -1
  152. package/dist/esm/components/Icon/components/InboxScanning.js.map +1 -1
  153. package/dist/esm/components/Icon/components/InboxSmart.js.map +1 -1
  154. package/dist/esm/components/Icon/components/Info.js.map +1 -1
  155. package/dist/esm/components/Icon/components/Inventory.js.map +1 -1
  156. package/dist/esm/components/Icon/components/InventoryMatrix.js.map +1 -1
  157. package/dist/esm/components/Icon/components/JournalPro.js.map +1 -1
  158. package/dist/esm/components/Icon/components/Layout.js.map +1 -1
  159. package/dist/esm/components/Icon/components/LayoutBoth.js.map +1 -1
  160. package/dist/esm/components/Icon/components/LayoutFirst.js.map +1 -1
  161. package/dist/esm/components/Icon/components/LayoutLast.js.map +1 -1
  162. package/dist/esm/components/Icon/components/LayoutNone.js.map +1 -1
  163. package/dist/esm/components/Icon/components/LedgerCard.js.map +1 -1
  164. package/dist/esm/components/Icon/components/LedgerCardCustomerReminder.js.map +1 -1
  165. package/dist/esm/components/Icon/components/LedgerCardManualCustomerInvoice.js.map +1 -1
  166. package/dist/esm/components/Icon/components/LedgerCardObsoleteStock.js.map +1 -1
  167. package/dist/esm/components/Icon/components/LedgerCardOpeningEntry.js.map +1 -1
  168. package/dist/esm/components/Icon/components/LedgerCardReservedEntry.js.map +1 -1
  169. package/dist/esm/components/Icon/components/LedgerCardShrinkagePilferage.js.map +1 -1
  170. package/dist/esm/components/Icon/components/LedgerCardStockAdjustment.js.map +1 -1
  171. package/dist/esm/components/Icon/components/LedgerCardTransferredOpeningEntry.js.map +1 -1
  172. package/dist/esm/components/Icon/components/Lightbulb.js.map +1 -1
  173. package/dist/esm/components/Icon/components/Line.js.map +1 -1
  174. package/dist/esm/components/Icon/components/List.js.map +1 -1
  175. package/dist/esm/components/Icon/components/ListBulleted.js.map +1 -1
  176. package/dist/esm/components/Icon/components/ListSearch.js.map +1 -1
  177. package/dist/esm/components/Icon/components/LockOpen.js.map +1 -1
  178. package/dist/esm/components/Icon/components/Log.js.map +1 -1
  179. package/dist/esm/components/Icon/components/Market.js.map +1 -1
  180. package/dist/esm/components/Icon/components/MatchAmount.js.map +1 -1
  181. package/dist/esm/components/Icon/components/MatchEntries.js.map +1 -1
  182. package/dist/esm/components/Icon/components/Mileage.js.map +1 -1
  183. package/dist/esm/components/Icon/components/ModalResize.js.map +1 -1
  184. package/dist/esm/components/Icon/components/ModalShrink.js.map +1 -1
  185. package/dist/esm/components/Icon/components/More.js.map +1 -1
  186. package/dist/esm/components/Icon/components/MoreSolid.js.map +1 -1
  187. package/dist/esm/components/Icon/components/Move.js.map +1 -1
  188. package/dist/esm/components/Icon/components/NavigationList.js.map +1 -1
  189. package/dist/esm/components/Icon/components/Note.js.map +1 -1
  190. package/dist/esm/components/Icon/components/NoteFollowUp.js.map +1 -1
  191. package/dist/esm/components/Icon/components/NoteRead.js.map +1 -1
  192. package/dist/esm/components/Icon/components/PartnerApi.js.map +1 -1
  193. package/dist/esm/components/Icon/components/Period.js.map +1 -1
  194. package/dist/esm/components/Icon/components/PersonChange.js.map +1 -1
  195. package/dist/esm/components/Icon/components/PersonMinus.js.map +1 -1
  196. package/dist/esm/components/Icon/components/PersonPlus.js.map +1 -1
  197. package/dist/esm/components/Icon/components/PersonTick.js.map +1 -1
  198. package/dist/esm/components/Icon/components/Play.js.map +1 -1
  199. package/dist/esm/components/Icon/components/PlusMinus.js.map +1 -1
  200. package/dist/esm/components/Icon/components/Print.js.map +1 -1
  201. package/dist/esm/components/Icon/components/ProcessPayment.js.map +1 -1
  202. package/dist/esm/components/Icon/components/ProductLedgerCard.js.map +1 -1
  203. package/dist/esm/components/Icon/components/ProjectCards.js.map +1 -1
  204. package/dist/esm/components/Icon/components/Projects.js.map +1 -1
  205. package/dist/esm/components/Icon/components/Quicklinks.js.map +1 -1
  206. package/dist/esm/components/Icon/components/RatingBankruptcy.js.map +1 -1
  207. package/dist/esm/components/Icon/components/RatingPaymentProblems.js.map +1 -1
  208. package/dist/esm/components/Icon/components/Reconciled.js.map +1 -1
  209. package/dist/esm/components/Icon/components/Refresh.js.map +1 -1
  210. package/dist/esm/components/Icon/components/Report.js.map +1 -1
  211. package/dist/esm/components/Icon/components/ReportSolid.js.map +1 -1
  212. package/dist/esm/components/Icon/components/Restore.js.map +1 -1
  213. package/dist/esm/components/Icon/components/RotateLeft.js.map +1 -1
  214. package/dist/esm/components/Icon/components/RotateRight.js.map +1 -1
  215. package/dist/esm/components/Icon/components/Sales.js.map +1 -1
  216. package/dist/esm/components/Icon/components/Search.js.map +1 -1
  217. package/dist/esm/components/Icon/components/SearchBold.js.map +1 -1
  218. package/dist/esm/components/Icon/components/Secure.js.map +1 -1
  219. package/dist/esm/components/Icon/components/SecureTick.js.map +1 -1
  220. package/dist/esm/components/Icon/components/Settings.js.map +1 -1
  221. package/dist/esm/components/Icon/components/SettingsSolid.js.map +1 -1
  222. package/dist/esm/components/Icon/components/Shortcuts.js.map +1 -1
  223. package/dist/esm/components/Icon/components/ShowAll.js.map +1 -1
  224. package/dist/esm/components/Icon/components/ShowLess.js.map +1 -1
  225. package/dist/esm/components/Icon/components/ShowMore.js.map +1 -1
  226. package/dist/esm/components/Icon/components/ShowTemplate.js.map +1 -1
  227. package/dist/esm/components/Icon/components/Sliders.js.map +1 -1
  228. package/dist/esm/components/Icon/components/Smartpay.js.map +1 -1
  229. package/dist/esm/components/Icon/components/SortBy.js.map +1 -1
  230. package/dist/esm/components/Icon/components/Spinner.js.map +1 -1
  231. package/dist/esm/components/Icon/components/Star.js.map +1 -1
  232. package/dist/esm/components/Icon/components/StarSolid.js.map +1 -1
  233. package/dist/esm/components/Icon/components/Subscriptions.js.map +1 -1
  234. package/dist/esm/components/Icon/components/SystemEntries.js.map +1 -1
  235. package/dist/esm/components/Icon/components/Tag.js.map +1 -1
  236. package/dist/esm/components/Icon/components/TemplateOverride.js.map +1 -1
  237. package/dist/esm/components/Icon/components/Templates.js.map +1 -1
  238. package/dist/esm/components/Icon/components/ThumbBoth.js.map +1 -1
  239. package/dist/esm/components/Icon/components/ThumbDown.js.map +1 -1
  240. package/dist/esm/components/Icon/components/ThumbDownSolid.js.map +1 -1
  241. package/dist/esm/components/Icon/components/ThumbUp.js.map +1 -1
  242. package/dist/esm/components/Icon/components/ThumbUpSolid.js.map +1 -1
  243. package/dist/esm/components/Icon/components/Tick.js.map +1 -1
  244. package/dist/esm/components/Icon/components/Time.js.map +1 -1
  245. package/dist/esm/components/Icon/components/Transfer.js.map +1 -1
  246. package/dist/esm/components/Icon/components/TransferCancel.js.map +1 -1
  247. package/dist/esm/components/Icon/components/TransferLocked.js.map +1 -1
  248. package/dist/esm/components/Icon/components/Undock.js.map +1 -1
  249. package/dist/esm/components/Icon/components/Unreconciled.js.map +1 -1
  250. package/dist/esm/components/Icon/components/Warning.js.map +1 -1
  251. package/dist/esm/components/Icon/components/Webshop.js.map +1 -1
  252. package/dist/esm/components/Icon/components/Website.js.map +1 -1
  253. package/dist/esm/components/Icon/components/Workflow.js.map +1 -1
  254. package/dist/esm/components/Icon/components/Zoom.js.map +1 -1
  255. package/dist/esm/components/Icon/components/index.js +12 -10
  256. package/dist/esm/components/Icon/components/index.js.map +1 -1
  257. package/dist/esm/components/IconButton/IconButton.js.map +1 -1
  258. package/dist/esm/components/Input/Input.js +1 -1
  259. package/dist/esm/components/Input/Input.js.map +1 -1
  260. package/dist/esm/components/Input/util.js +2 -2
  261. package/dist/esm/components/Input/util.js.map +1 -1
  262. package/dist/esm/components/Listbox/Listbox.js +25 -24
  263. package/dist/esm/components/Listbox/Listbox.js.map +1 -1
  264. package/dist/esm/components/Listbox/ScrollableList.js +83 -64
  265. package/dist/esm/components/Listbox/ScrollableList.js.map +1 -1
  266. package/dist/esm/components/Listbox/useListbox.js +61 -52
  267. package/dist/esm/components/Listbox/useListbox.js.map +1 -1
  268. package/dist/esm/components/Listbox/useMultiListbox.js +91 -63
  269. package/dist/esm/components/Listbox/useMultiListbox.js.map +1 -1
  270. package/dist/esm/components/Listbox/useTypeahead.js +9 -10
  271. package/dist/esm/components/Listbox/useTypeahead.js.map +1 -1
  272. package/dist/esm/components/Listbox/util.js +86 -52
  273. package/dist/esm/components/Listbox/util.js.map +1 -1
  274. package/dist/esm/components/Menu/Context.js +2 -2
  275. package/dist/esm/components/Menu/Context.js.map +1 -1
  276. package/dist/esm/components/Menu/Menu.js +43 -20
  277. package/dist/esm/components/Menu/Menu.js.map +1 -1
  278. package/dist/esm/components/Menu/components/Checkbox.js +9 -8
  279. package/dist/esm/components/Menu/components/Checkbox.js.map +1 -1
  280. package/dist/esm/components/Menu/components/Content.js +13 -10
  281. package/dist/esm/components/Menu/components/Content.js.map +1 -1
  282. package/dist/esm/components/Menu/components/Header.js +4 -4
  283. package/dist/esm/components/Menu/components/Header.js.map +1 -1
  284. package/dist/esm/components/Menu/components/Item.js +35 -34
  285. package/dist/esm/components/Menu/components/Item.js.map +1 -1
  286. package/dist/esm/components/Menu/components/Link.js +11 -10
  287. package/dist/esm/components/Menu/components/Link.js.map +1 -1
  288. package/dist/esm/components/Menu/components/RadioGroup.js +18 -16
  289. package/dist/esm/components/Menu/components/RadioGroup.js.map +1 -1
  290. package/dist/esm/components/Menu/components/Separator.js +4 -4
  291. package/dist/esm/components/Menu/components/Separator.js.map +1 -1
  292. package/dist/esm/components/Menu/components/Trigger.js +5 -5
  293. package/dist/esm/components/Menu/components/Trigger.js.map +1 -1
  294. package/dist/esm/components/Navigation/Navigation.js +44 -35
  295. package/dist/esm/components/Navigation/Navigation.js.map +1 -1
  296. package/dist/esm/components/Pagination/PageNumbers.js +28 -23
  297. package/dist/esm/components/Pagination/PageNumbers.js.map +1 -1
  298. package/dist/esm/components/Pagination/Pagination.js +56 -39
  299. package/dist/esm/components/Pagination/Pagination.js.map +1 -1
  300. package/dist/esm/components/Pagination/usePagination.js +21 -7
  301. package/dist/esm/components/Pagination/usePagination.js.map +1 -1
  302. package/dist/esm/components/Pagination/usePaginationShortcuts.js +9 -9
  303. package/dist/esm/components/Pagination/usePaginationShortcuts.js.map +1 -1
  304. package/dist/esm/components/Popover/Popover.js +34 -29
  305. package/dist/esm/components/Popover/Popover.js.map +1 -1
  306. package/dist/esm/components/Popover/Primitives.js +8 -7
  307. package/dist/esm/components/Popover/Primitives.js.map +1 -1
  308. package/dist/esm/components/Progress/Progress.js +15 -11
  309. package/dist/esm/components/Progress/Progress.js.map +1 -1
  310. package/dist/esm/components/Provider/Provider.js +18 -13
  311. package/dist/esm/components/Provider/Provider.js.map +1 -1
  312. package/dist/esm/components/RadioGroup/RadioGroup.js +57 -45
  313. package/dist/esm/components/RadioGroup/RadioGroup.js.map +1 -1
  314. package/dist/esm/components/SearchInput/SearchInput.js +11 -10
  315. package/dist/esm/components/SearchInput/SearchInput.js.map +1 -1
  316. package/dist/esm/components/Select/Select.js +31 -30
  317. package/dist/esm/components/Select/Select.js.map +1 -1
  318. package/dist/esm/components/Select/useSelect.js +119 -82
  319. package/dist/esm/components/Select/useSelect.js.map +1 -1
  320. package/dist/esm/components/Spinner/Spinner.js +19 -12
  321. package/dist/esm/components/Spinner/Spinner.js.map +1 -1
  322. package/dist/esm/components/Switch/Switch.js +10 -9
  323. package/dist/esm/components/Switch/Switch.js.map +1 -1
  324. package/dist/esm/components/Table/components/BaseTable.js +30 -23
  325. package/dist/esm/components/Table/components/BaseTable.js.map +1 -1
  326. package/dist/esm/components/Table/components/PaginatedTable.js +7 -3
  327. package/dist/esm/components/Table/components/PaginatedTable.js.map +1 -1
  328. package/dist/esm/components/Table/components/Table.js +25 -18
  329. package/dist/esm/components/Table/components/Table.js.map +1 -1
  330. package/dist/esm/components/Table/components/WindowedTable.js +104 -88
  331. package/dist/esm/components/Table/components/WindowedTable.js.map +1 -1
  332. package/dist/esm/components/Table/hooks/plugins/useRowActions.js +146 -122
  333. package/dist/esm/components/Table/hooks/plugins/useRowActions.js.map +1 -1
  334. package/dist/esm/components/Table/hooks/plugins/useRowDraggable.js +61 -57
  335. package/dist/esm/components/Table/hooks/plugins/useRowDraggable.js.map +1 -1
  336. package/dist/esm/components/Table/hooks/plugins/useRowEditing.js +36 -39
  337. package/dist/esm/components/Table/hooks/plugins/useRowEditing.js.map +1 -1
  338. package/dist/esm/components/Table/hooks/plugins/useRowSelect.js +90 -80
  339. package/dist/esm/components/Table/hooks/plugins/useRowSelect.js.map +1 -1
  340. package/dist/esm/components/Table/hooks/useRowCreation.js +64 -29
  341. package/dist/esm/components/Table/hooks/useRowCreation.js.map +1 -1
  342. package/dist/esm/components/Table/hooks/useTable.js +141 -119
  343. package/dist/esm/components/Table/hooks/useTable.js.map +1 -1
  344. package/dist/esm/components/Table/hooks/useTableKeyboardNavigation.js +15 -12
  345. package/dist/esm/components/Table/hooks/useTableKeyboardNavigation.js.map +1 -1
  346. package/dist/esm/components/Table/util/renderColumn.js +10 -10
  347. package/dist/esm/components/Table/util/renderColumn.js.map +1 -1
  348. package/dist/esm/components/Table/util/renderRow.js +46 -37
  349. package/dist/esm/components/Table/util/renderRow.js.map +1 -1
  350. package/dist/esm/components/Table/util/rowIndexPath.js +16 -14
  351. package/dist/esm/components/Table/util/rowIndexPath.js.map +1 -1
  352. package/dist/esm/components/Table/util/sortTypes.js +31 -23
  353. package/dist/esm/components/Table/util/sortTypes.js.map +1 -1
  354. package/dist/esm/components/Table/util.js +41 -29
  355. package/dist/esm/components/Table/util.js.map +1 -1
  356. package/dist/esm/components/Tabs/Tabs.js +27 -25
  357. package/dist/esm/components/Tabs/Tabs.js.map +1 -1
  358. package/dist/esm/components/Textarea/Textarea.js +9 -11
  359. package/dist/esm/components/Textarea/Textarea.js.map +1 -1
  360. package/dist/esm/components/Toast/Toast.js +21 -20
  361. package/dist/esm/components/Toast/Toast.js.map +1 -1
  362. package/dist/esm/components/Toast/Toaster.js +118 -88
  363. package/dist/esm/components/Toast/Toaster.js.map +1 -1
  364. package/dist/esm/components/Toast/util.js +2 -2
  365. package/dist/esm/components/Toast/util.js.map +1 -1
  366. package/dist/esm/components/Tooltip/Tooltip.js +8 -7
  367. package/dist/esm/components/Tooltip/Tooltip.js.map +1 -1
  368. package/dist/esm/components/Tour/Tour.js +50 -44
  369. package/dist/esm/components/Tour/Tour.js.map +1 -1
  370. package/dist/esm/components/Treeview/Treeview.js +36 -26
  371. package/dist/esm/components/Treeview/Treeview.js.map +1 -1
  372. package/dist/esm/components/VisuallyHidden/VisuallyHidden.js +1 -1
  373. package/dist/esm/components/VisuallyHidden/VisuallyHidden.js.map +1 -1
  374. package/dist/esm/index.css +665 -665
  375. package/dist/esm/index.js +1 -1
  376. package/dist/esm/primitives/Button.js +13 -9
  377. package/dist/esm/primitives/Button.js.map +1 -1
  378. package/dist/esm/utils/date.js.map +1 -1
  379. package/dist/esm/utils/hooks/useBoundingClientRectListener.js.map +1 -1
  380. package/dist/esm/utils/hooks/useDraggable.js +18 -16
  381. package/dist/esm/utils/hooks/useDraggable.js.map +1 -1
  382. package/dist/esm/utils/hooks/useDropTarget.js +10 -7
  383. package/dist/esm/utils/hooks/useDropTarget.js.map +1 -1
  384. package/dist/esm/utils/hooks/useListKeyboardNavigation.js.map +1 -1
  385. package/dist/esm/utils/hooks/useListScrollTo.js.map +1 -1
  386. package/dist/esm/utils/hooks/useOnClickOutside.js.map +1 -1
  387. package/dist/esm/utils/hooks/useProxiedRef.js +3 -3
  388. package/dist/esm/utils/hooks/useProxiedRef.js.map +1 -1
  389. package/dist/esm/utils/hooks/useTimer.js +17 -9
  390. package/dist/esm/utils/hooks/useTimer.js.map +1 -1
  391. package/dist/esm/utils/input.js +11 -7
  392. package/dist/esm/utils/input.js.map +1 -1
  393. package/dist/esm/utils/mergeRefs.js +2 -2
  394. package/dist/esm/utils/mergeRefs.js.map +1 -1
  395. package/dist/esm/utils/taillwind.js +2 -2
  396. package/dist/esm/utils/taillwind.js.map +1 -1
  397. package/dist/index.css +665 -665
  398. package/dist/taco.cjs.development.js +2486 -2013
  399. package/dist/taco.cjs.development.js.map +1 -1
  400. package/dist/taco.cjs.production.min.js +1 -1
  401. package/dist/taco.cjs.production.min.js.map +1 -1
  402. package/dist/utils/tailwind.d.ts +1 -1
  403. package/package.json +2 -3
  404. package/plugins/tailwindcss-aria-attributes.js +73 -73
  405. package/tailwind.config.js +297 -297
  406. package/types.json +16 -12
  407. package/dist/esm/components/Icon/components/Minus.js.map +0 -1
  408. package/dist/esm/components/Icon/components/PlusCircle.js.map +0 -1
  409. package/dist/esm/components/Icon/components/TickCircle.js.map +0 -1
@@ -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;AACI,gBAAcC,SADlB;AAEI,qBAAmBC,cAFvB;AAGIC,EAAAA,IAAI,EAAEC,cAAc,GAAG,EAH3B;AAIIC,EAAAA,YAJJ;AAKIC,EAAAA,QALJ;AAMIC,EAAAA,EAAE,EAAEC,QANR;AAOIC,EAAAA,MAPJ;AAQIC,EAAAA,OAAO,EAAEC,EARb;AASIC,EAAAA,QATJ;AAUIC,EAAAA,OAVJ;AAWIC,EAAAA,SAXJ;AAYIC,EAAAA,QAZJ;AAaIC,EAAAA,QAbJ;AAcIlB,EAAAA,KAdJ;AAeI,KAAGmB;AAfP,CADuB,EAkBvBC,GAlBuB;AAoBvB,QAAMC,QAAQ,GAAGC,aAAa,CAAmBF,GAAnB,CAA9B;AACA,QAAMG,SAAS,GAAGC,MAAA,CAAgC,IAAhC,CAAlB;AACA,QAAMC,OAAO,GAAGD,MAAA,CAA+B,IAA/B,CAAhB;AACA,QAAM,CAACE,IAAD,EAAOC,OAAP,IAAkBH,QAAA,CAAe,KAAf,CAAxB;AACA,QAAMI,MAAM,GAAGJ,OAAA,CAAc,MAAMK,EAAI,EAAxB,EAA4B,EAA5B,CAAf;AACA,QAAM,CAACC,UAAD,EAAaC,aAAb,IAA8BP,QAAA,CAAuBzB,mBAAmB,CAACC,KAAD,CAA1C,CAApC;AACA,QAAMgC,gBAAgB,GAAG,CAACf,QAAD,KAAc,CAACN,MAAD,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AAEzD;AAFT;AALN,GAAP;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","ref","ariaLabelledBy","data","unfilteredData","defaultValue","disabled","inline","onChange","onClick","onKeyDown","onSearch","readOnly","props","inputRef","useProxiedRef","buttonRef","React","listRef","open","setOpen","listId","uuid","inputValue","setInputValue","shouldFilterData","flattenedData","useFlattenedData","filterData","undefined","getIndexFromValue","currentIndex","setCurrentIndex","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","id","scrollOnFocus","tabIndex","button","popover","onOpenChange"],"mappings":";;;;;;;;;;;AAkBA,IAAMA,SAAS,gBAAGC,QAAQ,CAAC,UAAAC,CAAC;AAAA,SAAIA,CAAC,EAAL;AAAA,CAAF,EAAW,GAAX,CAA1B;;AAEA,IAAMC,mBAAmB,GAAG,SAAtBA,mBAAsB,CAACC,KAAD;AAAA,SAAgDC,MAAM,CAACD,KAAD,aAACA,KAAD,cAACA,KAAD,GAAU,EAAV,CAAtD;AAAA,CAA5B;;IAUaE,WAAW,GAAG,SAAdA,WAAc,OAkBvBC,GAlBuB;MAGAC,sBAAnB;uBACAC;MAAMC,wCAAiB;MACvBC,oBAAAA;MACAC,gBAAAA;MAEAC,cAAAA;MAEAC,gBAAAA;MACAC,eAAAA;MACAC,iBAAAA;MACAC,gBAAAA;MACAC,gBAAAA;MACAd,aAAAA;MACGe;;AAIP,MAAMC,QAAQ,GAAGC,aAAa,CAAmBd,GAAnB,CAA9B;AACA,MAAMe,SAAS,GAAGC,MAAA,CAAgC,IAAhC,CAAlB;AACA,MAAMC,OAAO,GAAGD,MAAA,CAA+B,IAA/B,CAAhB;;AACA,wBAAwBA,QAAA,CAAe,KAAf,CAAxB;AAAA,MAAOE,IAAP;AAAA,MAAaC,OAAb;;AACA,MAAMC,MAAM,GAAGJ,OAAA,CAAc;AAAA,WAAMK,EAAI,EAAV;AAAA,GAAd,EAA4B,EAA5B,CAAf;;AACA,yBAAoCL,QAAA,CAAuBpB,mBAAmB,CAACC,KAAD,CAA1C,CAApC;AAAA,MAAOyB,UAAP;AAAA,MAAmBC,aAAnB;;AACA,MAAMC,gB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T0B;AAUrC7E,IAAAA,KAAK,EAAEiC;AAV8B,GAAzC;AAaA,MAAM6C,MAAM,GAAG;AACX3E,IAAAA,GAAG,EAAEe;AADM,GAAf;AAIA,SAAO;AACHmD,IAAAA,QAAQ,EAARA,QADG;AAEHE,IAAAA,KAAK,EAALA,KAFG;AAGHG,IAAAA,IAAI,EAAJA,IAHG;AAIHI,IAAAA,MAAM,EAANA,MAJG;AAKHC,IAAAA,OAAO,EAAE;AACL1D,MAAAA,IAAI,EAAJA,IADK;AAEL2D,MAAAA,YAAY,EAAE1D;AAFT;AALN,GAAP;AAWH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"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=\"flex -m-3\">\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-l border-grey-dark flex flex-col\">\r\n <span className=\"font-semibold text-xs m-4 flex items-center h-8 w-32 mb-3\">\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=\"w-full px-4 py-1 flex items-start hover:bg-grey-light 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 inline-flex border-none bg-transparent text-xs cursor-pointer mt-auto my-4 mx-auto\"\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;;;AACvC,MAAmBC,iBAAnB,GAA+GF,KAA/G,CAAQG,SAAR;AAAA,MAA+CC,WAA/C,GAA+GJ,KAA/G,CAAsCK,OAAtC;AAAA,MAA4DC,KAA5D,GAA+GN,KAA/G,CAA4DM,KAA5D;AAAA,MAAmEC,SAAnE,GAA+GP,KAA/G,CAAmEO,SAAnE;AAAA,MAA8EC,aAA9E,GAA+GR,KAA/G,CAA8EQ,aAA9E;AAAA,MAAgGC,UAAhG,iCAA+GT,KAA/G;;AACA,uBAA4BU,aAAa,CAACD,UAAD,EAAaR,GAAb,CAAzC;AAAA,MAAQU,QAAR,kBAAQA,QAAR;AAAA,MAAkBC,KAAlB,kBAAkBA,KAAlB;;AACA,yBAAkBC,eAAe,EAAjC;AAAA,MAAQC,KAAR,oBAAQA,KAAR;;AACA,MAAMX,SAAS,GAAGY,EAAE,CAAC,2CAAD,EAA8Cb,iBAA9C,CAApB;AAEA,SACIH,aAAA,OAAA;AAAMI,IAAAA,SAAS,EAAEA;iBAAqB;AAAaG,IAAAA,KAAK,EAAEA;GAA1D,EACIP,aAAA,CAACiB,KAAD,oBACQJ;AACJK,IAAAA,MAAM,EACFlB,aAAA,CAACmB,OAAD,MAAA,EACInB,aAAA,CAACmB,OAAO,CAACC,OAAT,MAAA,EACIpB,aAAA,CAACqB,UAAD;oBACgBN,KAAK,CAACO,UAAN,CAAiBC;AAC7BC,MAAAA,QAAQ,qBAAEX,KAAK,CAACW,QAAR,6DAAoBX,KAAK,CAACY;AAClCC,MAAAA,IAAI,EAAC;KAHT,CADJ,CADJ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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=\"flex -m-3\">\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-l border-grey-dark flex flex-col\">\n <span className=\"font-semibold text-xs m-4 flex items-center h-8 w-32 mb-3\">\n {shortcutsText ?? texts.datepicker.shortcuts}\n </span>\n <ul>\n {shortcuts.map((shortcut, i) => (\n <li key={i}>\n <button\n className=\"w-full px-4 py-1 flex items-start hover:bg-grey-light 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 inline-flex border-none bg-transparent text-xs cursor-pointer mt-auto my-4 mx-auto\"\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;;;AACvC,MAAmBC,iBAAnB,GAA+GF,KAA/G,CAAQG,SAAR;AAAA,MAA+CC,WAA/C,GAA+GJ,KAA/G,CAAsCK,OAAtC;AAAA,MAA4DC,KAA5D,GAA+GN,KAA/G,CAA4DM,KAA5D;AAAA,MAAmEC,SAAnE,GAA+GP,KAA/G,CAAmEO,SAAnE;AAAA,MAA8EC,aAA9E,GAA+GR,KAA/G,CAA8EQ,aAA9E;AAAA,MAAgGC,UAAhG,iCAA+GT,KAA/G;;AACA,uBAA4BU,aAAa,CAACD,UAAD,EAAaR,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,CAAc,UAACC,QAAD,EAAWC,CAAX;AAAA,eACXpC,aAAA,KAAA;AAAIqC,UAAAA,GAAG,EAAED;SAAT,EACIpC,aAAA,SAAA;AACII,UAAAA,SAAS,EAAC;AACVkC,UAAAA,OAAO,EAAE,iBAAAN,KAAK;AACVA,YAAAA,KAAK,CAACO,OAAN;AACAJ,YAAAA,QAAQ,CAACG,OAAT,CAAiBN,KAAjB;AACAJ,YAAAA,KAAK;AACR;SANL,EAQKO,QAAQ,CAACK,IARd,CADJ,CADW;AAAA,OAAd,CADL,CAJJ,EAoBKnC,WAAW,IACRL,aAAA,SAAA;AACII,QAAAA,SAAS,EAAC;AACVkC,QAAAA,OAAO,EAAE,iBAAAN,KAAK;AACVA,UAAAA,KAAK,CAACO,OAAN;AACAlC,UAAAA,WAAW,CAAC2B,KAAD,CAAX;AACAJ,UAAAA,KAAK;AACR;OANL,EAQKb,KAAK,CAACO,UAAN,CAAiBmB,KARtB,CArBR,CAVR,CADH;AAAA,KADL,CARJ;IAHR,CADJ,CADJ;AAmEH,CAzEyB;;;;"}
@@ -1,26 +1,31 @@
1
+ import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
1
2
  import { useState, useEffect } from 'react';
2
3
  import { useLocalization } from '../Provider/Provider.js';
3
4
  import { useProxiedRef } from '../../utils/hooks/useProxiedRef.js';
4
5
  import { setInputValueByRef } from '../../utils/input.js';
5
6
  import { format, parseFromCustomString } from '../../utils/date.js';
6
7
 
7
- const useDatepicker = ({
8
- defaultValue: _,
9
- calendar,
10
- onBlur,
11
- onChange,
12
- value,
13
- ...props
14
- }, ref) => {
15
- const inputRef = useProxiedRef(ref);
16
- const {
17
- formatting
18
- } = useLocalization();
19
- const [internalValue, setInternalValue] = useState(value ? format(value, formatting.date) : ''); // update internal value if it changed 'externally'
20
-
21
- useEffect(() => {
8
+ var _excluded = ["defaultValue", "calendar", "onBlur", "onChange", "value"];
9
+ var useDatepicker = function useDatepicker(_ref, ref) {
10
+ var calendar = _ref.calendar,
11
+ onBlur = _ref.onBlur,
12
+ onChange = _ref.onChange,
13
+ value = _ref.value,
14
+ props = _objectWithoutPropertiesLoose(_ref, _excluded);
15
+
16
+ var inputRef = useProxiedRef(ref);
17
+
18
+ var _useLocalization = useLocalization(),
19
+ formatting = _useLocalization.formatting;
20
+
21
+ var _React$useState = useState(value ? format(value, formatting.date) : ''),
22
+ internalValue = _React$useState[0],
23
+ setInternalValue = _React$useState[1]; // update internal value if it changed 'externally'
24
+
25
+
26
+ useEffect(function () {
22
27
  if (value) {
23
- const formattedValue = format(value, formatting.date);
28
+ var formattedValue = format(value, formatting.date);
24
29
 
25
30
  if (formattedValue !== internalValue) {
26
31
  setInternalValue(formattedValue);
@@ -30,10 +35,10 @@ const useDatepicker = ({
30
35
  }
31
36
  }, [value]); // event handlers
32
37
 
33
- const handleInputBlur = event => {
38
+ var handleInputBlur = function handleInputBlur(event) {
34
39
  event.persist();
35
- const valueAsDate = parseFromCustomString(event.target.value);
36
- const formattedValue = valueAsDate ? format(valueAsDate) || '' : '';
40
+ var valueAsDate = parseFromCustomString(event.target.value);
41
+ var formattedValue = valueAsDate ? format(valueAsDate) || '' : '';
37
42
  event.target.value = formattedValue;
38
43
 
39
44
  if (onChange) {
@@ -49,15 +54,15 @@ const useDatepicker = ({
49
54
  }
50
55
  };
51
56
 
52
- const handleInputChange = event => {
57
+ var handleInputChange = function handleInputChange(event) {
53
58
  setInternalValue(event.target.value);
54
59
  };
55
60
 
56
- const handleChange = date => {
61
+ var handleChange = function handleChange(date) {
57
62
  setInputValueByRef(inputRef.current, format(date, formatting.date), 'focusout');
58
63
  };
59
64
 
60
- const handleKeyDown = event => {
65
+ var handleKeyDown = function handleKeyDown(event) {
61
66
  if (event.key === 'Enter') {
62
67
  event.target.dispatchEvent(new Event('focusout', {
63
68
  bubbles: true
@@ -65,7 +70,7 @@ const useDatepicker = ({
65
70
  }
66
71
  };
67
72
 
68
- const inputProps = { ...props,
73
+ var inputProps = _extends({}, props, {
69
74
  autoComplete: 'off',
70
75
  onBlur: handleInputBlur,
71
76
  onChange: handleInputChange,
@@ -73,11 +78,13 @@ const useDatepicker = ({
73
78
  ref: inputRef,
74
79
  type: 'text',
75
80
  value: internalValue
76
- };
77
- const calendarProps = { ...calendar,
81
+ });
82
+
83
+ var calendarProps = _extends({}, calendar, {
78
84
  onChange: handleChange,
79
- value
80
- };
85
+ value: value
86
+ });
87
+
81
88
  return {
82
89
  input: inputProps,
83
90
  calendar: calendarProps
@@ -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;AAAEC,EAAAA,YAAY,EAAEC,CAAhB;AAAmBC,EAAAA,QAAnB;AAA6BC,EAAAA,MAA7B;AAAqCC,EAAAA,QAArC;AAA+CC,EAAAA,KA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IAAAA,gBAAgB,CAACM,KAAK,CAACI,MAAN,CAAalB,KAAd,CAAhB;AACH,GAFD;;AAIA,QAAMqB,YAAY,GAAGV,IAAI;AACrBW,IAAAA,kBAAkB,CAACnB,QAAQ,CAACoB,OAAV,EAAmBb,MAAM,CAACC,IAAD,EAAON,UAAU,CAACM,IAAlB,CAAzB,EAAkD,UAAlD,CAAlB;AACH,GAFD;;AAIA,QAAMa,aAAa,GAAIV,KAAD;AAClB,QAAIA,KAAK,CAACW,GAAN,KAAc,OAAlB,EAA2B;AACvBX,MAAAA,KAAK,CAACI,MAAN,CAAaQ,aAAb,CAA2B,IAAIC,KAAJ,CAAU,UAAV,EAAsB;AAAEC,QAAAA,OAAO,EAAE;AAAX,OAAtB,CAA3B;AACH;AACJ,GAJD;;AAMA,QAAMC,UAAU,GAAe,EAC3B,GAAG5B,KADwB;AAE3B6B,IAAAA,YAAY,EAAE,KAFa;AAG3BhC,IAAAA,MAAM,EAAEe,eAHmB;AAI3Bd,IAAAA,QAAQ,EAAEqB,iBAJiB;AAK3BW,IAAAA,SAAS,EAAEP,aALgB;AAM3BtB,IAAAA,GAAG,EAAEC,QANsB;AAO3B6B,IAAAA,IAAI,EAAE,MAPqB;AAQ3BhC,IAAAA,KAAK,EAAEO;AARoB,GAA/B;AAWA,QAAM0B,aAAa,GAAkB,EACjC,GAAGpC,QAD8B;AAEjCE,IAAAA,QAAQ,EAAEsB,YAFuB;AAGjCrB,IAAAA;AAHiC,GAArC;AAMA,SAAO;AACHkC,IAAAA,KAAK,EAAEL,UADJ;AAEHhC,IAAAA,QAAQ,EAAEoC;AAFP,GAAP;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","ref","calendar","onBlur","onChange","value","props","inputRef","useProxiedRef","useLocalization","formatting","React","format","date","internalValue","setInternalValue","formattedValue","handleInputBlur","event","persist","valueAsDate","parseFromCustomString","target","detail","handleInputChange","handleChange","setInputValueByRef","current","handleKeyDown","key","dispatchEvent","Event","bubbles","inputProps","autoComplete","onKeyDown","type","calendarProps","input"],"mappings":";;;;;;;;IAeaA,aAAa,GAAG,SAAhBA,aAAgB,OAEzBC,GAFyB;MACNC,gBAAAA;MAAUC,cAAAA;MAAQC,gBAAAA;MAAUC,aAAAA;MAAUC;;AAGzD,MAAMC,QAAQ,GAAGC,aAAa,CAAmBP,GAAnB,CAA9B;;AACA,yBAAuBQ,eAAe,EAAtC;AAAA,MAAQC,UAAR,oBAAQA,UAAR;;AACA,wBAA0CC,QAAA,CAAeN,KAAK,GAAGO,MAAM,CAACP,KAAD,EAAQK,UAAU,CAACG,IAAnB,CAAT,GAAoC,EAAxD,CAA1C;AAAA,MAAOC,aAAP;AAAA,MAAsBC,gBAAtB;;;AAGAJ,EAAAA,SAAA,CAAgB;AACZ,QAAIN,KAAJ,EAAW;AACP,UAAMW,cAAc,GAAGJ,MAAM,CAACP,KAAD,EAAQK,UAAU,CAACG,IAAnB,CAA7B;;AAEA,UAAIG,cAAc,KAAKF,aAAvB,EAAsC;AAClCC,QAAAA,gBAAgB,CAACC,cAAD,CAAhB;AACH;AACJ,KAND,MAMO;AACHD,MAAAA,gBAAgB,CAAC,EAAD,CAAhB;AACH;AACJ,GAVD,EAUG,CAACV,KAAD,CAVH;;AAaA,MAAMY,eAAe,GAAG,SAAlBA,eAAkB,CAACC,KAAD;AACpBA,IAAAA,KAAK,CAACC,OAAN;AAEA,QAAMC,WAAW,GAAGC,qBAAqB,CAACH,KAAK,CAACI,MAAN,CAAajB,KAAd,CAAzC;AACA,QAAMW,cAAc,GAAGI,WAAW,GAAGR,MAAM,CAACQ,WAAD,CAA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;;AAWA,MAAMuB,aAAa,gBACZnC,QADY;AAEfE,IAAAA,QAAQ,EAAEqB,YAFK;AAGfpB,IAAAA,KAAK,EAALA;AAHe,IAAnB;;AAMA,SAAO;AACHiC,IAAAA,KAAK,EAAEL,UADJ;AAEH/B,IAAAA,QAAQ,EAAEmC;AAFP,GAAP;AAIH;;;;"}
@@ -1,24 +1,24 @@
1
1
  import { createContext, useContext } from 'react';
2
2
 
3
3
  /* eslint-disable @typescript-eslint/no-empty-function */
4
- const DialogContext = /*#__PURE__*/createContext({
4
+ var DialogContext = /*#__PURE__*/createContext({
5
5
  closeOnEscape: true,
6
6
  draggable: false,
7
7
  drawer: {
8
8
  open: false,
9
- toggle: () => {}
9
+ toggle: function toggle() {}
10
10
  },
11
11
  elements: {
12
12
  drawer: undefined,
13
13
  extra: undefined
14
14
  },
15
- onClose: () => {},
15
+ onClose: function onClose() {},
16
16
  props: {},
17
17
  ref: null,
18
18
  showCloseButton: true,
19
19
  size: 'sm'
20
20
  });
21
- const useCurrentDialog = () => {
21
+ var useCurrentDialog = function useCurrentDialog() {
22
22
  return useContext(DialogContext);
23
23
  };
24
24
 
@@ -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;AAC5DC,EAAAA,aAAa,EAAE,IAD6C;AAE5DC,EAAAA,SAAS,EAAE,KAFiD;AAG5DC,EAAAA,MAAM,EAAE;AACJC,IAAAA,IAAI,EAAE,KADF;AAEJC,IAAAA,MAAM,EAAE;AAFJ,GAHoD;AAO5DC,EAAAA,QAAQ,EAAE;AACNH,IAAAA,MAAM,EAAEI,SADF;AAENC,IAAAA,KAAK,EAAED;AAFD,GAPkD;AAW5DE,EAAAA,OAAO,EAAE,QAXmD;AAY5DC,EAAAA,KAAK,EAAE,EAZqD;AAa5DC,EAAAA,GAAG,EAAE,IAbuD;AAc5DC,EAAAA,eAAe,EAAE,IAd2C;AAe5DC,EAAAA,IAAI,EAAE;AAfsD,CAAnC;MAkBhBC,gBAAgB,GAAG;AAC5B,SAAOd,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;IAsBaA,aAAa,gBAAGC,aAAA,CAAmC;AAC5DC,EAAAA,aAAa,EAAE,IAD6C;AAE5DC,EAAAA,SAAS,EAAE,KAFiD;AAG5DC,EAAAA,MAAM,EAAE;AACJC,IAAAA,IAAI,EAAE,KADF;AAEJC,IAAAA,MAAM,EAAE;AAFJ,GAHoD;AAO5DC,EAAAA,QAAQ,EAAE;AACNH,IAAAA,MAAM,EAAEI,SADF;AAENC,IAAAA,KAAK,EAAED;AAFD,GAPkD;AAW5DE,EAAAA,OAAO,EAAE,qBAXmD;AAY5DC,EAAAA,KAAK,EAAE,EAZqD;AAa5DC,EAAAA,GAAG,EAAE,IAbuD;AAc5DC,EAAAA,eAAe,EAAE,IAd2C;AAe5DC,EAAAA,IAAI,EAAE;AAfsD,CAAnC;IAkBhBC,gBAAgB,GAAG,SAAnBA,gBAAmB;AAC5B,SAAOd,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;AACxC,SAAOC,OAAA,CAAc;AACjB,QAAMC,QAAQ,GAAU,EAAxB;AACA,QAAIC,MAAJ;AACA,QAAIC,KAAJ;AAEAH,IAAAA,QAAA,CAAeI,OAAf,CAAuBL,eAAvB,EAAwCM,OAAxC,CAAgD,UAACC,KAAD;;;AAC5C,UAAI,gBAAAA,KAAK,CAACC,IAAN,4DAAYC,WAAZ,MAA4BC,MAAM,CAACD,WAAvC,EAAoD;AAChDN,QAAAA,MAAM,GAAGI,KAAT;AACH,OAFD,MAEO,IAAI,iBAAAA,KAAK,CAACC,IAAN,8DAAYC,WAAZ,MAA4BE,KAAK,CAACF,WAAtC,EAAmD;AACtDL,QAAAA,KAAK,GAAGG,KAAR;AACH,OAFM,MAEA;AACHL,QAAAA,QAAQ,CAACU,IAAT,CAAcL,KAAd;AACH;AACJ,KARD;AAUA,WAAO,CAACL,QAAD,EAAWC,MAAX,EAAmBC,KAAnB,CAAP;AACH,GAhBM,EAgBJ,CAACJ,eAAD,CAhBI,CAAP;AAiBH,CAlBD;;IA8Baa,MAAM,gBAAGZ,UAAA,CAAiB,SAASY,MAAT,CAAgBC,KAAhB,EAAoCC,GAApC;AACnC,MACcf,eADd,GAYIc,KAZJ,CACIZ,QADJ;AAAA,6BAYIY,KAZJ,CAEIE,aA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AI,EAAJA,IAdG;AAeHR,MAAAA,GAAG,EAAHA;AAfG,KAAP;AAAA,GADY,EAkBZ,CAACC,aAAD,EAAgBU,UAAhB,EAA4BR,SAA5B,EAAuCf,MAAvC,EAA+CC,KAA/C,EAAsDiB,IAAtD,EAA4DI,UAA5D,EAAwEH,eAAxE,CAlBY,CAAhB;AAqBA,SACIrB,aAAA,CAAC+B,aAAa,CAACC,QAAf;AAAwBC,IAAAA,KAAK,EAAEN;GAA/B,EACI3B,aAAA,CAACkC,IAAD;AAAsBlB,IAAAA,WAAW,EAAEA;AAAaI,IAAAA,IAAI,EAAEA;AAAMe,IAAAA,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"],"m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IAAAA,IAAI,EAAEA;AAAMe,IAAAA,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,3 +1,4 @@
1
+ import { extends as _extends } from '../../../_virtual/_rollupPluginBabelHelpers.js';
1
2
  import { forwardRef, createElement } from 'react';
2
3
  import cn from 'classnames';
3
4
  import { Backdrop } from '../../Backdrop/Backdrop.js';
@@ -9,22 +10,22 @@ import { useCurrentDialog } from '../Context.js';
9
10
  import { useDraggable } from '../../../utils/hooks/useDraggable.js';
10
11
  import { useCurrentMenu } from '../../Menu/Context.js';
11
12
 
12
- const Title = /*#__PURE__*/forwardRef(function DialogTitle(props, ref) {
13
- const className = cn('text-center', props.className);
13
+ var Title = /*#__PURE__*/forwardRef(function DialogTitle(props, ref) {
14
+ var className = cn('text-center', props.className);
14
15
  return createElement(Title$1, Object.assign({}, props, {
15
16
  className: className,
16
17
  ref: ref
17
18
  }));
18
19
  });
19
- const Footer = /*#__PURE__*/forwardRef(function DialogFooter(props, ref) {
20
- const className = cn('mt-8 flex justify-end', props.className);
20
+ var Footer = /*#__PURE__*/forwardRef(function DialogFooter(props, ref) {
21
+ var className = cn('mt-8 flex justify-end', props.className);
21
22
  return createElement("div", Object.assign({}, props, {
22
23
  className: className,
23
24
  ref: ref
24
25
  }), props.children);
25
26
  });
26
- const Close = /*#__PURE__*/forwardRef(function DialogClose(props, ref) {
27
- const dialog = useCurrentDialog();
27
+ var Close = /*#__PURE__*/forwardRef(function DialogClose(props, ref) {
28
+ var dialog = useCurrentDialog();
28
29
  return createElement(Close$1, Object.assign({
29
30
  onClick: dialog.onClose
30
31
  }, props, {
@@ -32,52 +33,54 @@ const Close = /*#__PURE__*/forwardRef(function DialogClose(props, ref) {
32
33
  asChild: true
33
34
  }));
34
35
  });
35
- const RenderPropWrapper = /*#__PURE__*/forwardRef(function RenderPropWrapper({
36
- children,
37
- onClick,
38
- renderProps
39
- }, ref) {
40
- const close = () => {
36
+ var RenderPropWrapper = /*#__PURE__*/forwardRef(function RenderPropWrapper(_ref, ref) {
37
+ var children = _ref.children,
38
+ onClick = _ref.onClick,
39
+ renderProps = _ref.renderProps;
40
+
41
+ var close = function close() {
41
42
  onClick(new CustomEvent('close'));
42
43
  };
43
44
 
44
- return children({
45
- close,
46
- ref,
47
- ...renderProps
48
- });
45
+ return children(_extends({
46
+ close: close,
47
+ ref: ref
48
+ }, renderProps));
49
49
  });
50
- const Content = /*#__PURE__*/forwardRef(function DialogContent(props, ref) {
51
- const dialog = useCurrentDialog();
52
- const internalRef = useProxiedRef(ref);
53
- const {
54
- position,
55
- handleProps: dragHandleProps
56
- } = useDraggable(internalRef);
57
- const {
58
- texts
59
- } = useLocalization(); // if the dialog was opened by a menu, we need to close the menu when the dialog closes
50
+ var Content = /*#__PURE__*/forwardRef(function DialogContent(props, ref) {
51
+ var dialog = useCurrentDialog();
52
+ var internalRef = useProxiedRef(ref);
53
+
54
+ var _useDraggable = useDraggable(internalRef),
55
+ position = _useDraggable.position,
56
+ dragHandleProps = _useDraggable.handleProps;
57
+
58
+ var _useLocalization = useLocalization(),
59
+ texts = _useLocalization.texts; // if the dialog was opened by a menu, we need to close the menu when the dialog closes
60
60
  // the menu is still open (and mounted) because it is the trigger for the dialog
61
61
 
62
- const menu = useCurrentMenu();
63
- let handleCloseAutoFocus;
62
+
63
+ var menu = useCurrentMenu();
64
+ var handleCloseAutoFocus;
64
65
 
65
66
  if (menu) {
66
- handleCloseAutoFocus = () => menu.close();
67
+ handleCloseAutoFocus = function handleCloseAutoFocus() {
68
+ return menu.close();
69
+ };
67
70
  }
68
71
 
69
- const className = cn('bg-white rounded relative mt-16 mx-auto animate-[fade-in_150ms] z-[997]', {
72
+ var className = cn('bg-white rounded relative mt-16 mx-auto animate-[fade-in_150ms] z-[997]', {
70
73
  'w-128 text-center justify-center': dialog.size === 'dialog',
71
74
  'w-xs': dialog.size === 'xs',
72
75
  'w-sm': dialog.size === 'sm',
73
76
  'w-md': dialog.size === 'md',
74
77
  'w-lg': dialog.size === 'lg'
75
78
  });
76
- const containerClassName = cn('bg-white p-6 rounded relative z-[999]', 'shadow-[0_6px_9px_0_rgba(89,85,98,0.3),0_0_1px_0_rgba(89,85,98,0.2)]', {
79
+ var containerClassName = cn('bg-white p-6 rounded relative z-[999]', 'shadow-[0_6px_9px_0_rgba(89,85,98,0.3),0_0_1px_0_rgba(89,85,98,0.2)]', {
77
80
  'rounded-b-none': !!dialog.elements.extra
78
81
  }, props.className);
79
82
 
80
- const handleEscapeKeyDown = event => {
83
+ var handleEscapeKeyDown = function handleEscapeKeyDown(event) {
81
84
  if (!dialog.closeOnEscape) {
82
85
  event.preventDefault();
83
86
  } else if (dialog.onClose) {
@@ -86,9 +89,11 @@ const Content = /*#__PURE__*/forwardRef(function DialogContent(props, ref) {
86
89
  }; // the chosen behaviour in taco is that outside clicks do not close the dialog
87
90
 
88
91
 
89
- const handleInteractOutside = event => event.preventDefault();
92
+ var handleInteractOutside = function handleInteractOutside(event) {
93
+ return event.preventDefault();
94
+ };
90
95
 
91
- let output;
96
+ var output;
92
97
 
93
98
  if (typeof props.children === 'function') {
94
99
  output = createElement(Close$1, {
@@ -110,10 +115,10 @@ const Content = /*#__PURE__*/forwardRef(function DialogContent(props, ref) {
110
115
  onInteractOutside: handleInteractOutside,
111
116
  onCloseAutoFocus: handleCloseAutoFocus,
112
117
  ref: ref,
113
- style: { ...props.style,
114
- left: dialog.draggable ? `${position.x}px` : undefined,
115
- top: dialog.draggable ? `${position.y}px` : undefined
116
- }
118
+ style: _extends({}, props.style, {
119
+ left: dialog.draggable ? position.x + "px" : undefined,
120
+ top: dialog.draggable ? position.y + "px" : undefined
121
+ })
117
122
  }), createElement("div", {
118
123
  className: containerClassName,
119
124
  "data-taco": "dialog"
@@ -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;AAClC,QAAMC,SAAS,GAAGC,EAAE,CAAC,aAAD,EAAgBH,KAAK,CAACE,SAAtB,CAApB;AACA,SAAOJ,aAAA,CAACM,OAAD,oBAA2BJ;AAAOE,IAAAA,SAAS,EAAEA;AAAWD,IAAAA,GAAG,EAAEA;IAA7D,CAAP;AACH,CAHoB;MAMRI,MAAM,gBAAGP,UAAA,CAAiB,SAASQ,YAAT,CAAsBN,KAAtB,EAAgDC,GAAhD;AACnC,QAAMC,SAAS,GAAGC,EAAE,CAAC,uBAAD,EAA0BH,KAAK,CAACE,SAAhC,CAApB;AACA,SACIJ,aAAA,MAAA,oBAASE;AAAOE,IAAAA,SAAS,EAAEA;AAAWD,IAAAA,GAAG,EAAEA;IAA3C,EACKD,KAAK,CAACO,QADX,CADJ;AAKH,CAPqB;MAWTC,KAAK,gBAAGV,UAAA,CAAiB,SAASW,WAAT,CAAqBT,KAArB,EAA8CC,GAA9C;AAClC,QAAMS,MAAM,GAAGC,gBAAgB,EAA/B;AAEA,SAAOb,aAAA,CAACM,OAAD;AAAuBQ,IAAAA,OAAO,EAAEF,MAAM,CAACG;KAAab;AAAOC,IAAAA,GAAG,EAAEA;AAAKa,IAAA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1B,QAAQ,CAAC2B,KAA/B,GAAuCC,SAF1C;AAGHC,MAAAA,GAAG,EAAE1C,MAAM,CAACuC,SAAP,MAAsB1B,QAAQ,CAAC8B,KAA/B,GAAuCF;AAHzC;IAPX,EAaIrD,aAAA,MAAA;AAAKI,IAAAA,SAAS,EAAE+B;iBAA8B;GAA9C,EACKQ,MADL,EAEK/B,MAAM,CAACuC,SAAP,IACGnD,aAAA,MAAA,oBACQ2B;kBACQE,KAAK,CAACjB,MAAN,CAAa4C;AACzBpD,IAAAA,SAAS,EAAC;IAHd,CAHR,EASKQ,MAAM,CAAC6C,eAAP,GACGzD,aAAA,CAACM,OAAD;AAAuBQ,IAAAA,OAAO,EAAEF,MAAM,CAACG;AAASC,IAAAA,OAAO;GAAvD,EACIhB,aAAA,CAAC0D,UAAD;AACIC,IAAAA,UAAU,EAAC;kBACC9B,KAAK,CAACjB,MAAN,CAAaO;AACzBf,IAAAA,SAAS,EAAC;AACVwD,IAAAA,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","useDraggable","position","dragHandleProps","handleProps","useLocalization","texts","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":";;;;;;;;;;;;IAoBaA,KAAK,gBAAGC,UAAA,CAAiB,SAASC,WAAT,CAAqBC,KAArB,EAA8CC,GAA9C;AAClC,MAAMC,SAAS,GAAGC,EAAE,CAAC,aAAD,EAAgBH,KAAK,CAACE,SAAtB,CAApB;AACA,SAAOJ,aAAA,CAACM,OAAD,oBAA2BJ;AAAOE,IAAAA,SAAS,EAAEA;AAAWD,IAAAA,GAAG,EAAEA;IAA7D,CAAP;AACH,CAHoB;IAMRI,MAAM,gBAAGP,UAAA,CAAiB,SAASQ,YAAT,CAAsBN,KAAtB,EAAgDC,GAAhD;AACnC,MAAMC,SAAS,GAAGC,EAAE,CAAC,uBAAD,EAA0BH,KAAK,CAACE,SAAhC,CAApB;AACA,SACIJ,aAAA,MAAA,oBAASE;AAAOE,IAAAA,SAAS,EAAEA;AAAWD,IAAAA,GAAG,EAAEA;IAA3C,EACKD,KAAK,CAACO,QADX,CADJ;AAKH,CAPqB;IAWTC,KAAK,gBAAGV,UAAA,CAAiB,SAASW,WAAT,CAAqBT,KA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AA,CAACM,SAAD,oBACQJ;AACJE,IAAAA,SAAS,EAAEA;AACX0C,IAAAA,eAAe,EAAER;AACjBS,IAAAA,iBAAiB,EAAEL;AACnBM,IAAAA,gBAAgB,EAAEf;AAClB9B,IAAAA,GAAG,EAAEA;AACL8C,IAAAA,KAAK,eACE/C,KAAK,CAAC+C,KADR;AAEDC,MAAAA,IAAI,EAAEtC,MAAM,CAACuC,SAAP,GAAsBzB,QAAQ,CAAC0B,CAA/B,UAAuCC,SAF5C;AAGDC,MAAAA,GAAG,EAAE1C,MAAM,CAACuC,SAAP,GAAsBzB,QAAQ,CAAC6B,CAA/B,UAAuCF;AAH3C;IAPT,EAaIrD,aAAA,MAAA;AAAKI,IAAAA,SAAS,EAAE+B;iBAA8B;GAA9C,EACKQ,MADL,EAEK/B,MAAM,CAACuC,SAAP,IACGnD,aAAA,MAAA,oBACQ2B;kBACQG,KAAK,CAAClB,MAAN,CAAa4C;AACzBpD,IAAAA,SAAS,EAAC;IAHd,CAHR,EASKQ,MAAM,CAAC6C,eAAP,GACGzD,aAAA,CAACM,OAAD;AAAuBQ,IAAAA,OAAO,EAAEF,MAAM,CAACG;AAASC,IAAAA,OAAO;GAAvD,EACIhB,aAAA,CAAC0D,UAAD;AACIC,IAAAA,UAAU,EAAC;kBACC7B,KAAK,CAAClB,MAAN,CAAaO;AACzBf,IAAAA,SAAS,EAAC;AACVwD,IAAAA,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;;;;"}
@@ -3,11 +3,11 @@ import cn from 'classnames';
3
3
  import { motion } from 'framer-motion';
4
4
  import { useCurrentDialog } from '../Context.js';
5
5
 
6
- const Drawer = /*#__PURE__*/forwardRef(function DialogDrawer(props, ref) {
6
+ var Drawer = /*#__PURE__*/forwardRef(function DialogDrawer(props, ref) {
7
7
  var _dialog$drawer, _dialog$drawer2;
8
8
 
9
- const dialog = useCurrentDialog();
10
- const className = cn('absolute top-0 z-[998] -ml-[4px] hidden h-full w-full overflow-y-auto rounded-r bg-white p-6 text-left', props.className);
9
+ var dialog = useCurrentDialog();
10
+ var className = cn('absolute top-0 z-[998] -ml-[4px] hidden h-full w-full overflow-y-auto rounded-r bg-white p-6 text-left', props.className);
11
11
  return createElement(motion.div, Object.assign({}, props, {
12
12
  className: className,
13
13
  "data-taco": "dialog-drawer",