@jobber/components 4.92.0 → 4.92.1-JOB-91143.4

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 (638) hide show
  1. package/dist/AnimatedPresence/{index.js → index.cjs} +1 -3
  2. package/dist/AnimatedPresence/index.mjs +4 -0
  3. package/dist/{AnimatedPresence-20a02aaa.js → AnimatedPresence-C7_0OG8K.js} +3 -7
  4. package/dist/AnimatedPresence-DuP07qsR.js +98 -0
  5. package/dist/AnimatedSwitcher/index.cjs +11 -0
  6. package/dist/AnimatedSwitcher/index.mjs +5 -0
  7. package/dist/AnimatedSwitcher-DOQq-lwI.js +90 -0
  8. package/dist/{AnimatedSwitcher-3d45ec5d.js → AnimatedSwitcher-DypsdKLY.js} +4 -8
  9. package/dist/AtlantisContext/{index.js → index.cjs} +1 -3
  10. package/dist/AtlantisContext/index.mjs +2 -0
  11. package/dist/AtlantisContext-vajd9Fye.js +18 -0
  12. package/dist/Autocomplete/index.cjs +33 -0
  13. package/dist/Autocomplete/index.mjs +27 -0
  14. package/dist/Autocomplete-BG15vNs1.js +192 -0
  15. package/dist/Autocomplete-oDRc9WsO.js +190 -0
  16. package/dist/Avatar/index.cjs +12 -0
  17. package/dist/Avatar/index.mjs +6 -0
  18. package/dist/Avatar-5fBKFezP.js +67 -0
  19. package/dist/Avatar-CVgBcpGi.js +69 -0
  20. package/dist/Banner/components/BannerIcon/index.cjs +13 -0
  21. package/dist/Banner/components/BannerIcon/index.mjs +7 -0
  22. package/dist/Banner/index.cjs +23 -0
  23. package/dist/Banner/index.mjs +17 -0
  24. package/dist/Banner-BIHgdvV3.js +81 -0
  25. package/dist/Banner-BUy2m7mr.js +79 -0
  26. package/dist/BannerIcon-BoW3uKD-.js +19 -0
  27. package/dist/BannerIcon-DWpqnHvJ.js +22 -0
  28. package/dist/Body-BXB4Ywng.js +45 -0
  29. package/dist/Body-ByAvs9el.js +54 -0
  30. package/dist/Button/index.cjs +13 -0
  31. package/dist/Button/index.mjs +7 -0
  32. package/dist/Button-CKxjsn8f.js +47 -0
  33. package/dist/Button-DE6Du5Wv.js +49 -0
  34. package/dist/ButtonDismiss/index.cjs +14 -0
  35. package/dist/ButtonDismiss/index.mjs +8 -0
  36. package/dist/ButtonDismiss-BIVGFM9M.js +8 -0
  37. package/dist/ButtonDismiss-DjOs7eO3.js +10 -0
  38. package/dist/Card/index.cjs +21 -0
  39. package/dist/Card/index.mjs +15 -0
  40. package/dist/Card-CW-modgy.js +83 -0
  41. package/dist/Card-DOzOOnY0.js +81 -0
  42. package/dist/Checkbox/index.cjs +15 -0
  43. package/dist/Checkbox/index.mjs +9 -0
  44. package/dist/Checkbox-3Qa3Mp4s.js +55 -0
  45. package/dist/Checkbox-BVH5HUy3.js +53 -0
  46. package/dist/Chip/hooks/index.cjs +8 -0
  47. package/dist/Chip/hooks/index.mjs +2 -0
  48. package/dist/Chip/index.cjs +26 -0
  49. package/dist/Chip/index.mjs +18 -0
  50. package/dist/Chip-BRA8Ie1D.js +70 -0
  51. package/dist/Chip-D5t8gDBN.js +67 -0
  52. package/dist/ChipDismissible-BfodalJt.js +22 -0
  53. package/dist/ChipDismissible-D7vWlDtB.js +19 -0
  54. package/dist/Chips/InternalChipDismissible/hooks/index.cjs +23 -0
  55. package/dist/Chips/InternalChipDismissible/hooks/index.mjs +13 -0
  56. package/dist/Chips/InternalChipDismissible/index.cjs +35 -0
  57. package/dist/Chips/InternalChipDismissible/index.mjs +29 -0
  58. package/dist/Chips/index.cjs +48 -0
  59. package/dist/Chips/index.mjs +44 -0
  60. package/dist/Chips-CYDxrU8D.js +91 -0
  61. package/dist/Chips-ZogWZIAB.js +93 -0
  62. package/dist/Combobox/components/ComboboxAction/index.cjs +12 -0
  63. package/dist/Combobox/components/ComboboxAction/index.mjs +6 -0
  64. package/dist/Combobox/components/ComboboxActivator/index.cjs +27 -0
  65. package/dist/Combobox/components/ComboboxActivator/index.mjs +21 -0
  66. package/dist/Combobox/components/ComboboxContent/ComboboxContentHeader/index.cjs +14 -0
  67. package/dist/Combobox/components/ComboboxContent/ComboboxContentHeader/index.mjs +8 -0
  68. package/dist/Combobox/components/ComboboxContent/ComboboxContentList/index.cjs +24 -0
  69. package/dist/Combobox/components/ComboboxContent/ComboboxContentList/index.mjs +18 -0
  70. package/dist/Combobox/components/ComboboxContent/ComboboxContentSearch/index.cjs +10 -0
  71. package/dist/Combobox/components/ComboboxContent/ComboboxContentSearch/index.mjs +4 -0
  72. package/dist/Combobox/components/ComboboxContent/ComboboxLoadMore/index.cjs +9 -0
  73. package/dist/Combobox/components/ComboboxContent/ComboboxLoadMore/index.mjs +3 -0
  74. package/dist/Combobox/components/ComboboxContent/index.cjs +34 -0
  75. package/dist/Combobox/components/ComboboxContent/index.mjs +28 -0
  76. package/dist/Combobox/components/ComboboxOption/index.cjs +14 -0
  77. package/dist/Combobox/components/ComboboxOption/index.mjs +8 -0
  78. package/dist/Combobox/components/ComboboxTrigger/index.cjs +25 -0
  79. package/dist/Combobox/components/ComboboxTrigger/index.mjs +19 -0
  80. package/dist/Combobox/index.cjs +53 -0
  81. package/dist/Combobox/index.mjs +46 -0
  82. package/dist/Combobox-4g_P-scs.js +119 -0
  83. package/dist/Combobox-C9lk5lGs.js +117 -0
  84. package/dist/ComboboxAction-CDXUQcsS.js +22 -0
  85. package/dist/ComboboxAction-Ci7RkWIs.js +24 -0
  86. package/dist/ComboboxActivator-DC7UbnAU.js +26 -0
  87. package/dist/ComboboxActivator-Wru82KGv.js +28 -0
  88. package/dist/ComboboxContent-B3t3fDTn.js +143 -0
  89. package/dist/ComboboxContent-FcsdPGqc.js +145 -0
  90. package/dist/ComboboxContentHeader-CudWca0J.js +29 -0
  91. package/dist/ComboboxContentHeader-CwgZyJ-n.js +27 -0
  92. package/dist/ComboboxContentList-B84jQ_k9.js +77 -0
  93. package/dist/ComboboxContentList-BlSsa2wi.js +75 -0
  94. package/dist/ComboboxContentSearch-B76E7yYs.js +32 -0
  95. package/dist/ComboboxContentSearch-DH_9gdSF.js +34 -0
  96. package/dist/ComboboxLoadMore-BnhP-b9N.js +16 -0
  97. package/dist/ComboboxLoadMore-CKnSg956.js +14 -0
  98. package/dist/ComboboxOption-CmhVk1Tm.js +20 -0
  99. package/dist/ComboboxOption-fq9MC5fv.js +22 -0
  100. package/dist/ComboboxProvider-B1d2SG67.js +13 -0
  101. package/dist/ComboboxProvider-BpcqvBBD.js +10 -0
  102. package/dist/ComboboxTrigger-CBviayim.js +24 -0
  103. package/dist/ComboboxTrigger-D6M0Glk-.js +22 -0
  104. package/dist/ConfirmationModal/index.cjs +31 -0
  105. package/dist/ConfirmationModal/index.mjs +25 -0
  106. package/dist/{ConfirmationModal-c0b5e893.js → ConfirmationModal-MK_2VfpM.js} +8 -12
  107. package/dist/ConfirmationModal-rAPd3iIk.js +94 -0
  108. package/dist/Content/index.cjs +9 -0
  109. package/dist/Content/index.mjs +3 -0
  110. package/dist/Content-DErBfjY3.js +15 -0
  111. package/dist/Content-DvE60Q2i.js +13 -0
  112. package/dist/Countdown/index.cjs +11 -0
  113. package/dist/Countdown/index.mjs +5 -0
  114. package/dist/Countdown-CfRvv0Ww.js +657 -0
  115. package/dist/Countdown-DliSLLhR.js +659 -0
  116. package/dist/DataDump/index.cjs +24 -0
  117. package/dist/DataDump/index.mjs +18 -0
  118. package/dist/DataDump-CyNg2_YY.js +17 -0
  119. package/dist/DataDump-zMz56TNi.js +15 -0
  120. package/dist/DataList/components/DataListAction/index.cjs +13 -0
  121. package/dist/DataList/components/DataListAction/index.mjs +7 -0
  122. package/dist/DataList/components/DataListActions/index.cjs +43 -0
  123. package/dist/DataList/components/DataListActions/index.mjs +37 -0
  124. package/dist/DataList/components/DataListActionsMenu/index.cjs +17 -0
  125. package/dist/DataList/components/DataListActionsMenu/index.mjs +11 -0
  126. package/dist/DataList/components/DataListBulkActions/index.cjs +46 -0
  127. package/dist/DataList/components/DataListBulkActions/index.mjs +39 -0
  128. package/dist/DataList/components/DataListEmptyState/index.cjs +20 -0
  129. package/dist/DataList/components/DataListEmptyState/index.mjs +13 -0
  130. package/dist/DataList/components/DataListFilters/components/DataListSort/index.cjs +54 -0
  131. package/dist/DataList/components/DataListFilters/components/DataListSort/index.mjs +48 -0
  132. package/dist/DataList/components/DataListFilters/index.cjs +68 -0
  133. package/dist/DataList/components/DataListFilters/index.mjs +61 -0
  134. package/dist/DataList/components/DataListHeader/index.cjs +53 -0
  135. package/dist/DataList/components/DataListHeader/index.mjs +47 -0
  136. package/dist/DataList/components/DataListHeaderTile/components/index.cjs +12 -0
  137. package/dist/DataList/components/DataListHeaderTile/components/index.mjs +6 -0
  138. package/dist/DataList/components/DataListHeaderTile/index.cjs +20 -0
  139. package/dist/DataList/components/DataListHeaderTile/index.mjs +14 -0
  140. package/dist/DataList/components/DataListItem/components/DataListItemClickable/index.cjs +14 -0
  141. package/dist/DataList/components/DataListItem/components/DataListItemClickable/index.mjs +8 -0
  142. package/dist/DataList/components/DataListItem/index.cjs +52 -0
  143. package/dist/DataList/components/DataListItem/index.mjs +46 -0
  144. package/dist/DataList/components/DataListItemActions/index.cjs +45 -0
  145. package/dist/DataList/components/DataListItemActions/index.mjs +38 -0
  146. package/dist/DataList/components/DataListItemActionsOverflow/index.cjs +25 -0
  147. package/dist/DataList/components/DataListItemActionsOverflow/index.mjs +19 -0
  148. package/dist/DataList/components/DataListItems/index.cjs +53 -0
  149. package/dist/DataList/components/DataListItems/index.mjs +47 -0
  150. package/dist/DataList/components/DataListLayout/index.cjs +56 -0
  151. package/dist/DataList/components/DataListLayout/index.mjs +50 -0
  152. package/dist/DataList/components/DataListLayoutActions/DataListLayoutContext/index.cjs +9 -0
  153. package/dist/DataList/components/DataListLayoutActions/DataListLayoutContext/index.mjs +2 -0
  154. package/dist/DataList/components/DataListLayoutActions/index.cjs +33 -0
  155. package/dist/DataList/components/DataListLayoutActions/index.mjs +27 -0
  156. package/dist/DataList/components/DataListLoadMore/index.cjs +21 -0
  157. package/dist/DataList/components/DataListLoadMore/index.mjs +14 -0
  158. package/dist/DataList/components/DataListLoadingState/index.cjs +21 -0
  159. package/dist/DataList/components/DataListLoadingState/index.mjs +13 -0
  160. package/dist/DataList/components/DataListOverflowFade/index.cjs +11 -0
  161. package/dist/DataList/components/DataListOverflowFade/index.mjs +4 -0
  162. package/dist/DataList/components/DataListSearch/index.cjs +33 -0
  163. package/dist/DataList/components/DataListSearch/index.mjs +25 -0
  164. package/dist/DataList/components/DataListStatusBar/index.cjs +32 -0
  165. package/dist/DataList/components/DataListStatusBar/index.mjs +25 -0
  166. package/dist/DataList/components/DataListStickyHeader/index.cjs +11 -0
  167. package/dist/DataList/components/DataListStickyHeader/index.mjs +5 -0
  168. package/dist/DataList/components/DataListTags/index.cjs +12 -0
  169. package/dist/DataList/components/DataListTags/index.mjs +6 -0
  170. package/dist/DataList/components/DataListTotalCount/index.cjs +15 -0
  171. package/dist/DataList/components/DataListTotalCount/index.mjs +8 -0
  172. package/dist/DataList/context/DataListContext/index.cjs +12 -0
  173. package/dist/DataList/context/DataListContext/index.mjs +4 -0
  174. package/dist/DataList/context/DataListLayoutContext/index.cjs +12 -0
  175. package/dist/DataList/context/DataListLayoutContext/index.mjs +4 -0
  176. package/dist/DataList/index.cjs +98 -0
  177. package/dist/DataList/index.mjs +92 -0
  178. package/dist/DataList-B7x2oFVS.js +139 -0
  179. package/dist/DataList-BNQqXKIC.js +5 -0
  180. package/dist/DataList-Br4dFDOB.js +3 -0
  181. package/dist/DataList-Cu_Ae-fT.js +141 -0
  182. package/dist/DataList.const-Bhvz7Luy.js +38 -0
  183. package/dist/DataList.const-C329b2_o.js +25 -0
  184. package/dist/DataList.utils-C_f0XZRT.js +168 -0
  185. package/dist/DataList.utils-hr_HVCYl.js +161 -0
  186. package/dist/DataListAction-CGHgpeIN.js +39 -0
  187. package/dist/DataListAction-ymAGmjKg.js +37 -0
  188. package/dist/DataListActions-2RjU1dqb.js +45 -0
  189. package/dist/DataListActions-C6ZysnI5.js +43 -0
  190. package/dist/DataListActionsMenu-D6jGO6-B.js +57 -0
  191. package/dist/DataListActionsMenu-D98jRKew.js +55 -0
  192. package/dist/DataListBulkActions-CImnK1P5.js +29 -0
  193. package/dist/DataListBulkActions-DTrhDaNb.js +26 -0
  194. package/dist/DataListContext-DikZuZOD.js +29 -0
  195. package/dist/DataListContext-VbiGFkPI.js +25 -0
  196. package/dist/DataListEmptyState-C5r8SfIE.js +50 -0
  197. package/dist/DataListEmptyState-zgu3AGxu.js +53 -0
  198. package/dist/DataListFilters-DigCSxBy.js +43 -0
  199. package/dist/DataListFilters-NOmECi3p.js +46 -0
  200. package/dist/DataListHeader-B5iRESYw.js +95 -0
  201. package/dist/DataListHeader-JCeJNeuy.js +93 -0
  202. package/dist/DataListHeaderTile-CT3k41HG.js +80 -0
  203. package/dist/DataListHeaderTile-CZIjDn8L.js +82 -0
  204. package/dist/DataListItem-4Ix109is.js +114 -0
  205. package/dist/DataListItem-ChTxYoqE.js +112 -0
  206. package/dist/DataListItemActions-CQ8hDqYw.js +29 -0
  207. package/dist/DataListItemActions-D5wUuHMv.js +32 -0
  208. package/dist/DataListItemActionsOverflow-B_u6m2o9.js +33 -0
  209. package/dist/DataListItemActionsOverflow-DIzayDpq.js +35 -0
  210. package/dist/DataListItemClickable-Bt5Ucj0t.js +47 -0
  211. package/dist/DataListItemClickable-IwbswX6H.js +45 -0
  212. package/dist/DataListItems-BWg5lHjy.js +19 -0
  213. package/dist/DataListItems-Drq7j4YK.js +21 -0
  214. package/dist/DataListLayout-BgG0MMDj.js +19 -0
  215. package/dist/DataListLayout-DZynXNte.js +21 -0
  216. package/dist/DataListLayoutActions-AWqreR_S.js +36 -0
  217. package/dist/DataListLayoutActions-DeJK3JlE.js +38 -0
  218. package/dist/DataListLayoutContext--JcgS5I5.js +8 -0
  219. package/dist/DataListLayoutContext-D23XP8tN.js +11 -0
  220. package/dist/DataListLayoutContext-DWW2jgpD.js +18 -0
  221. package/dist/DataListLayoutContext-pSkER2Lr.js +14 -0
  222. package/dist/DataListLoadMore-CjCviC3F.js +34 -0
  223. package/dist/DataListLoadMore-jXRGVlFE.js +31 -0
  224. package/dist/DataListLoadingState-Bx7XgOwA.js +22 -0
  225. package/dist/DataListLoadingState-CSKfVetd.js +26 -0
  226. package/dist/DataListOverflowFade-DDkSdQhd.js +22 -0
  227. package/dist/DataListOverflowFade-DRoqry1j.js +25 -0
  228. package/dist/DataListSearch-CQY9fc7a.js +59 -0
  229. package/dist/DataListSearch-CjjEiz9Q.js +63 -0
  230. package/dist/DataListSort-DCNk7yyf.js +92 -0
  231. package/dist/DataListSort-invC98NZ.js +94 -0
  232. package/dist/DataListSortingOptions-CRMfOuGM.js +35 -0
  233. package/dist/DataListSortingOptions-sgWugbZH.js +37 -0
  234. package/dist/DataListStatusBar-Bc1dPDj_.js +22 -0
  235. package/dist/DataListStatusBar-C5HWzkA7.js +25 -0
  236. package/dist/DataListStickyHeader-MBgJBBb6.js +25 -0
  237. package/dist/DataListStickyHeader-O_e64YEP.js +23 -0
  238. package/dist/DataListTags-BG05pYRr.js +62 -0
  239. package/dist/DataListTags-DhUvQkt9.js +64 -0
  240. package/dist/DataListTotalCount-Ba0aAw-B.js +27 -0
  241. package/dist/DataListTotalCount-CKgXrXkX.js +24 -0
  242. package/dist/DataTable/index.cjs +36 -0
  243. package/dist/DataTable/index.mjs +25 -0
  244. package/dist/DataTable/test-utilities/index.cjs +246 -0
  245. package/dist/DataTable/test-utilities/index.mjs +238 -0
  246. package/dist/DataTable-Dl89aEOa.js +236 -0
  247. package/dist/DataTable-iSgYQH5p.js +238 -0
  248. package/dist/DatePicker/index.cjs +26 -0
  249. package/dist/DatePicker/index.mjs +20 -0
  250. package/dist/DatePicker-BpDKGmIl.js +8551 -0
  251. package/dist/DatePicker-CvQJ4m4F.js +8554 -0
  252. package/dist/DayOfMonthSelect-abrJ8VI9.js +137 -0
  253. package/dist/DayOfMonthSelect-t0nv438k.js +130 -0
  254. package/dist/DescriptionList/index.cjs +10 -0
  255. package/dist/DescriptionList/index.mjs +4 -0
  256. package/dist/DescriptionList-C2P6fxRg.js +14 -0
  257. package/dist/DescriptionList-DnPmrW50.js +12 -0
  258. package/dist/Disclosure/index.cjs +17 -0
  259. package/dist/Disclosure/index.mjs +11 -0
  260. package/dist/Disclosure-Du27Rftc.js +35 -0
  261. package/dist/Disclosure-DwDbK7TS.js +33 -0
  262. package/dist/Divider/index.cjs +9 -0
  263. package/dist/Divider/index.mjs +3 -0
  264. package/dist/Divider-02U5Br4P.js +19 -0
  265. package/dist/Divider-WHJnTEQ7.js +17 -0
  266. package/dist/Drawer/index.cjs +19 -0
  267. package/dist/Drawer/index.mjs +12 -0
  268. package/dist/DrawerGrid-BbRnqv1A.js +28 -0
  269. package/dist/DrawerGrid-BlhKZeYC.js +31 -0
  270. package/dist/Emphasis/index.cjs +10 -0
  271. package/dist/Emphasis/index.mjs +4 -0
  272. package/dist/Emphasis-ByZi7T6Z.js +13 -0
  273. package/dist/Emphasis-JTjJXWkg.js +15 -0
  274. package/dist/FeatureSwitch/index.cjs +26 -0
  275. package/dist/FeatureSwitch/index.mjs +20 -0
  276. package/dist/FeatureSwitch-BFrC78kj.js +54 -0
  277. package/dist/FeatureSwitch-ByeZTRwR.js +52 -0
  278. package/dist/Flex/index.cjs +9 -0
  279. package/dist/Flex/index.mjs +3 -0
  280. package/dist/Flex-BkRBJK0Z.js +30 -0
  281. package/dist/Flex-DQVyK7wo.js +28 -0
  282. package/dist/Form/index.cjs +10 -0
  283. package/dist/Form/index.mjs +4 -0
  284. package/dist/Form-BZeUfE2t.js +48 -0
  285. package/dist/{Form/index.js → Form-DUTTuYPf.js} +3 -9
  286. package/dist/FormField/index.cjs +20 -0
  287. package/dist/FormField/index.mjs +14 -0
  288. package/dist/FormField-D7z5-WII.js +263 -0
  289. package/dist/FormField-hdVpso_w.js +261 -0
  290. package/dist/FormatDate/{index.js → index.cjs} +1 -3
  291. package/dist/FormatDate/index.mjs +2 -0
  292. package/dist/FormatDate-Brr2_Lfu.js +27 -0
  293. package/dist/{FormatDate-70ea5b43.js → FormatDate-CE_p3d5L.js} +1 -5
  294. package/dist/FormatEmail/index.cjs +9 -0
  295. package/dist/FormatEmail/index.mjs +3 -0
  296. package/dist/FormatEmail-B326Qd3m.js +11 -0
  297. package/dist/FormatEmail-D6AV_2nc.js +13 -0
  298. package/dist/FormatFile/index.cjs +36 -0
  299. package/dist/FormatFile/index.mjs +30 -0
  300. package/dist/FormatFile-CDd5WXPj.js +149 -0
  301. package/dist/FormatFile-DxfGUhYm.js +147 -0
  302. package/dist/FormatRelativeDateTime/index.cjs +8 -0
  303. package/dist/FormatRelativeDateTime/index.mjs +2 -0
  304. package/dist/FormatRelativeDateTime-B9bjZ-eX.js +64 -0
  305. package/dist/{FormatRelativeDateTime/index.js → FormatRelativeDateTime-CXzEyJFr.js} +5 -11
  306. package/dist/FormatTime/index.cjs +8 -0
  307. package/dist/FormatTime/index.mjs +2 -0
  308. package/dist/FormatTime-B-wa4KRb.js +29 -0
  309. package/dist/{FormatTime/index.js → FormatTime-B91IsX-x.js} +1 -7
  310. package/dist/Gallery/index.cjs +42 -0
  311. package/dist/Gallery/index.mjs +36 -0
  312. package/dist/Gallery-1x8eXLka.js +63 -0
  313. package/dist/Gallery-DK44lD2R.js +65 -0
  314. package/dist/Glimmer/index.cjs +12 -0
  315. package/dist/Glimmer/index.mjs +5 -0
  316. package/dist/Glimmer-B5eYryBF.js +60 -0
  317. package/dist/Glimmer-D0tv78WP.js +63 -0
  318. package/dist/Grid/InternalGridCell/index.cjs +9 -0
  319. package/dist/Grid/InternalGridCell/index.mjs +2 -0
  320. package/dist/Grid/index.cjs +14 -0
  321. package/dist/Grid/index.mjs +7 -0
  322. package/dist/Grid-AIrBh4rt.js +32 -0
  323. package/dist/Grid-C5FWfhEs.js +29 -0
  324. package/dist/Heading/index.cjs +12 -0
  325. package/dist/Heading/index.mjs +6 -0
  326. package/dist/{Heading-ffc87a2a.js → Heading-BhKK7vho.js} +3 -7
  327. package/dist/Heading-CN8xip8K.js +49 -0
  328. package/dist/Icon/index.cjs +9 -0
  329. package/dist/Icon/index.mjs +3 -0
  330. package/dist/Icon-BJUSeqrr.js +34 -0
  331. package/dist/Icon-DjU29wkY.js +36 -0
  332. package/dist/InlineLabel/index.cjs +10 -0
  333. package/dist/InlineLabel/index.mjs +4 -0
  334. package/dist/InlineLabel-BF3sXYgM.js +20 -0
  335. package/dist/InlineLabel-CdbTX3Qa.js +18 -0
  336. package/dist/InputAvatar/index.cjs +26 -0
  337. package/dist/InputAvatar/index.mjs +20 -0
  338. package/dist/InputAvatar-BdAiPSSn.js +49 -0
  339. package/dist/InputAvatar-CPLTarYo.js +47 -0
  340. package/dist/InputDate/index.cjs +34 -0
  341. package/dist/InputDate/index.mjs +28 -0
  342. package/dist/InputDate-BN9KkEfE.js +48 -0
  343. package/dist/{InputDate/index.js → InputDate-BquD5lFz.js} +6 -31
  344. package/dist/InputEmail/index.cjs +22 -0
  345. package/dist/InputEmail/index.mjs +15 -0
  346. package/dist/InputEmail-CpyoerVx.js +23 -0
  347. package/dist/InputEmail-TUmHsMNX.js +20 -0
  348. package/dist/InputFile/index.cjs +23 -0
  349. package/dist/InputFile/index.mjs +16 -0
  350. package/dist/InputFile-DMnF1pDx.js +1611 -0
  351. package/dist/InputFile-OoWKy7q9.js +1608 -0
  352. package/dist/InputGroup/index.cjs +9 -0
  353. package/dist/InputGroup/index.mjs +3 -0
  354. package/dist/InputGroup-BFZ64kWc.js +25 -0
  355. package/dist/InputGroup-t1rzSE0F.js +23 -0
  356. package/dist/InputNumber/index.cjs +21 -0
  357. package/dist/InputNumber/index.mjs +15 -0
  358. package/dist/{InputNumber-f1990039.js → InputNumber-DL9rK650.js} +2 -6
  359. package/dist/InputNumber-u7uPvLgZ.js +56 -0
  360. package/dist/InputPassword/index.cjs +21 -0
  361. package/dist/InputPassword/index.mjs +15 -0
  362. package/dist/InputPassword-CqBOZ112.js +19 -0
  363. package/dist/InputPassword-cLUOeqk-.js +21 -0
  364. package/dist/InputPhoneNumber/index.cjs +21 -0
  365. package/dist/InputPhoneNumber/index.mjs +15 -0
  366. package/dist/InputPhoneNumber-B2FFUWwm.js +94 -0
  367. package/dist/{InputPhoneNumber/index.js → InputPhoneNumber-DxMxWR2z.js} +7 -27
  368. package/dist/InputText/index.cjs +22 -0
  369. package/dist/InputText/index.mjs +16 -0
  370. package/dist/InputText-Qhl0INR-.js +96 -0
  371. package/dist/{InputText-375a415c.js → InputText-nucFL4pz.js} +4 -8
  372. package/dist/InputTime/index.cjs +26 -0
  373. package/dist/InputTime/index.mjs +20 -0
  374. package/dist/{InputTime/index.js → InputTime-Bj4P_56s.js} +5 -25
  375. package/dist/InputTime-pPxm1wr1.js +190 -0
  376. package/dist/InputValidation/index.cjs +14 -0
  377. package/dist/InputValidation/index.mjs +8 -0
  378. package/dist/InputValidation-BY33gA8g.js +20 -0
  379. package/dist/InputValidation-BvTmvsYp.js +22 -0
  380. package/dist/InternalChipDismissible-LAkxRtnV.js +152 -0
  381. package/dist/InternalChipDismissible-PISlerj_.js +157 -0
  382. package/dist/InternalGridCell-BprDm5Fi.js +37 -0
  383. package/dist/InternalGridCell-DyWZRqAY.js +34 -0
  384. package/dist/LightBox/index.cjs +26 -0
  385. package/dist/LightBox/index.mjs +20 -0
  386. package/dist/LightBox-BWUWUkUD.js +112 -0
  387. package/dist/LightBox-D6Z6s0_U.js +110 -0
  388. package/dist/Link/index.cjs +8 -0
  389. package/dist/Link/index.mjs +2 -0
  390. package/dist/Link-B7ix2LW9.js +7 -0
  391. package/dist/Link-Cl2pzeag.js +9 -0
  392. package/dist/List/index.cjs +29 -0
  393. package/dist/List/index.mjs +22 -0
  394. package/dist/List-C3IcqOZZ.js +186 -0
  395. package/dist/List-D1li09_A.js +189 -0
  396. package/dist/Markdown/index.cjs +19 -0
  397. package/dist/Markdown/index.mjs +13 -0
  398. package/dist/Markdown-CRBKB6xQ.js +19013 -0
  399. package/dist/Markdown-DroxcM3U.js +19011 -0
  400. package/dist/Menu/index.cjs +18 -0
  401. package/dist/Menu/index.mjs +12 -0
  402. package/dist/Menu-BKIXU731.js +131 -0
  403. package/dist/Menu-DbsQFQOW.js +129 -0
  404. package/dist/Modal/index.cjs +23 -0
  405. package/dist/Modal/index.mjs +17 -0
  406. package/dist/Modal-Dx1bOlz7.js +63 -0
  407. package/dist/Modal-JhusMU4D.js +61 -0
  408. package/dist/MultiSelect/index.cjs +16 -0
  409. package/dist/MultiSelect/index.mjs +10 -0
  410. package/dist/MultiSelect-B2vx9vLw.js +166 -0
  411. package/dist/MultiSelect-But9vE7v.js +164 -0
  412. package/dist/Option-C2vJjWfu.js +15 -0
  413. package/dist/Option-m08lH3jJ.js +12 -0
  414. package/dist/Page/index.cjs +32 -0
  415. package/dist/Page/index.mjs +26 -0
  416. package/dist/Page-BU3T-y1q.js +58 -0
  417. package/dist/Page-DV_XwjfX.js +56 -0
  418. package/dist/Popover/index.cjs +17 -0
  419. package/dist/Popover/index.mjs +11 -0
  420. package/dist/Popover-B-KE_eFI.js +48 -0
  421. package/dist/Popover-CHu9ozKj.js +50 -0
  422. package/dist/ProgressBar/index.cjs +9 -0
  423. package/dist/ProgressBar/index.mjs +3 -0
  424. package/dist/ProgressBar-B5zkI3pM.js +33 -0
  425. package/dist/ProgressBar-s-XzXLlQ.js +31 -0
  426. package/dist/RadioGroup/index.cjs +12 -0
  427. package/dist/RadioGroup/index.mjs +5 -0
  428. package/dist/RadioGroup-BjKA09z3.js +39 -0
  429. package/dist/RadioGroup-CaUGNOG2.js +36 -0
  430. package/dist/RecurringSelect/components/index.cjs +15 -0
  431. package/dist/RecurringSelect/components/index.mjs +6 -0
  432. package/dist/RecurringSelect/index.cjs +35 -0
  433. package/dist/RecurringSelect/index.mjs +21 -0
  434. package/dist/RecurringSelect-6-wdlnln.js +71 -0
  435. package/dist/RecurringSelect-B0Gq9jU1.js +69 -0
  436. package/dist/Select/index.cjs +22 -0
  437. package/dist/Select/index.mjs +15 -0
  438. package/dist/Spinner/index.cjs +9 -0
  439. package/dist/Spinner/index.mjs +3 -0
  440. package/dist/Spinner-4_B4sbFF.js +16 -0
  441. package/dist/Spinner-AOCiYGuW.js +14 -0
  442. package/dist/StatusIndicator/index.cjs +8 -0
  443. package/dist/StatusIndicator/index.mjs +2 -0
  444. package/dist/StatusIndicator-NtKs1bnS.js +11 -0
  445. package/dist/StatusIndicator-vPYWY92m.js +9 -0
  446. package/dist/StatusLabel/index.cjs +11 -0
  447. package/dist/StatusLabel/index.mjs +5 -0
  448. package/dist/StatusLabel-B0GIHhhK.js +18 -0
  449. package/dist/StatusLabel-CMT-yiLl.js +16 -0
  450. package/dist/Switch/index.cjs +10 -0
  451. package/dist/Switch/index.mjs +4 -0
  452. package/dist/Switch-CqAWEokO.js +48 -0
  453. package/dist/Switch-D2ujtfce.js +46 -0
  454. package/dist/Table/index.cjs +17 -0
  455. package/dist/Table/index.mjs +4 -0
  456. package/dist/Tabs/index.cjs +11 -0
  457. package/dist/Tabs/index.mjs +4 -0
  458. package/dist/Tabs-CRYN2A35.js +67 -0
  459. package/dist/Tabs-D5jT4HLS.js +70 -0
  460. package/dist/Text/index.cjs +10 -0
  461. package/dist/Text/index.mjs +4 -0
  462. package/dist/Text-9Y0IeH0M.js +25 -0
  463. package/dist/{Text-94b5c2e5.js → Text-CqfEADu0.js} +2 -6
  464. package/dist/Toast/index.cjs +16 -0
  465. package/dist/Toast/index.mjs +10 -0
  466. package/dist/Tooltip/index.cjs +14 -0
  467. package/dist/Tooltip/index.mjs +8 -0
  468. package/dist/Tooltip-D2U8LSaI.js +105 -0
  469. package/dist/Tooltip-DeXlEfZX.js +103 -0
  470. package/dist/Typography/index.cjs +9 -0
  471. package/dist/Typography/index.mjs +3 -0
  472. package/dist/Typography-CBz3Bwzs.js +38 -0
  473. package/dist/Typography-DBA8fJ4I.js +36 -0
  474. package/dist/_baseAssignValue-Br3FbMzF.js +29 -0
  475. package/dist/_baseAssignValue-Cvm5AXvh.js +31 -0
  476. package/dist/_baseEach-CTax1-yy.js +1069 -0
  477. package/dist/_baseEach-D8SssyxZ.js +1073 -0
  478. package/dist/_commonjsHelpers-C-Wbr7RH.js +32 -0
  479. package/dist/_commonjsHelpers-xAV1A7i5.js +36 -0
  480. package/dist/_defineProperty-BujIpPGc.js +1326 -0
  481. package/dist/_defineProperty-CjkR3-BA.js +1306 -0
  482. package/dist/_getTag-BKCeVxsL.js +733 -0
  483. package/dist/_getTag-DpOqMBPJ.js +718 -0
  484. package/dist/_polyfill-node.process-B_9ykg-O.js +255 -0
  485. package/dist/_polyfill-node.process-CYhOBsNv.js +258 -0
  486. package/dist/_setToString-CBBLiglb.js +234 -0
  487. package/dist/_setToString-CZpqSjYr.js +230 -0
  488. package/dist/debounce-BpTvHvBt.js +332 -0
  489. package/dist/debounce-Dd5GxxzC.js +329 -0
  490. package/dist/helpers-D1m0vSul.js +17 -0
  491. package/dist/helpers-DwMBemop.js +15 -0
  492. package/dist/index-BQdnPLod.js +1189 -0
  493. package/dist/index-BeAq-j7t.js +1186 -0
  494. package/dist/index.cjs +275 -0
  495. package/dist/index.d.mts +74 -0
  496. package/dist/index.d.ts +74 -0
  497. package/dist/index.mjs +162 -0
  498. package/dist/isObjectLike-D72TVWLW.js +190 -0
  499. package/dist/isObjectLike-DkE0-lSd.js +197 -0
  500. package/dist/isSymbol-BdlIpdew.js +33 -0
  501. package/dist/isSymbol-DVwHxcm6.js +35 -0
  502. package/dist/noop-9CHQCFDx.js +26 -0
  503. package/dist/noop-CiBZ2qxz.js +24 -0
  504. package/dist/showToast-DdjKsUjz.js +99 -0
  505. package/dist/showToast-kK8ISglC.js +97 -0
  506. package/dist/styles.css +8743 -0
  507. package/dist/tslib.es6-BJzo8cuE.js +97 -0
  508. package/dist/tslib.es6-CjmNBqgv.js +102 -0
  509. package/dist/useActiveLayout-Bvi4Yx0s.js +14 -0
  510. package/dist/useActiveLayout-DOW95mNw.js +16 -0
  511. package/dist/useAssert-B1i-_d5Q.js +27 -0
  512. package/dist/useAssert-Bk9LtVuC.js +27 -0
  513. package/dist/useAtlantisConfig-CVSBhQb8.js +14 -0
  514. package/dist/{useAtlantisConfig-ed0bee66.js → useAtlantisConfig-D-Qo7OhV.js} +2 -2
  515. package/dist/useBatchSelect-4-bP-nq0.js +36 -0
  516. package/dist/useBatchSelect-rCfKq55l.js +38 -0
  517. package/dist/useChildComponent-D2t-5Jky.js +15 -0
  518. package/dist/useChildComponent-DktVoc_0.js +17 -0
  519. package/dist/useFocusTrap-Bk_llzCy.js +74 -0
  520. package/dist/useFocusTrap-BztNbnoA.js +74 -0
  521. package/dist/useInView-Dk25sanP.js +25 -0
  522. package/dist/useInView-NIKZBawt.js +25 -0
  523. package/dist/useIsMounted-CEL42pGR.js +47 -0
  524. package/dist/useIsMounted-DZig4aFK.js +47 -0
  525. package/dist/useOnKeyDown-BRrGkWfQ.js +40 -0
  526. package/dist/useOnKeyDown-Dtenmfc9.js +40 -0
  527. package/dist/useRefocusOnActivator-BCZuCyZg.js +32 -0
  528. package/dist/useRefocusOnActivator-Nc-vAHlK.js +32 -0
  529. package/dist/useResizeObserver-Blt1gsn-.js +1189 -0
  530. package/dist/useResizeObserver-BwdGHaB_.js +1192 -0
  531. package/dist/useResponsiveSizing-CN6AfX4o.js +51 -0
  532. package/dist/useResponsiveSizing-DXaps7kG.js +49 -0
  533. package/dist/useSafeLayoutEffect-BNLlFJBq.js +14 -0
  534. package/dist/useSafeLayoutEffect-CtAU_CL9.js +12 -0
  535. package/dist/useScrollToActive-BCcpdtxF.js +597 -0
  536. package/dist/useScrollToActive-Dd4eAK3b.js +591 -0
  537. package/package.json +410 -10
  538. package/{rollup.config.js → rollup.config.mjs} +49 -17
  539. package/dist/AnimatedSwitcher/index.js +0 -13
  540. package/dist/Autocomplete/index.js +0 -214
  541. package/dist/Avatar/index.js +0 -15
  542. package/dist/Avatar-76a799fa.js +0 -78
  543. package/dist/Banner/index.js +0 -111
  544. package/dist/Button/index.js +0 -16
  545. package/dist/Button-0c831b03.js +0 -57
  546. package/dist/ButtonDismiss/index.js +0 -17
  547. package/dist/ButtonDismiss-101366b5.js +0 -14
  548. package/dist/Card/index.js +0 -24
  549. package/dist/Card-2e03b887.js +0 -93
  550. package/dist/Checkbox/index.js +0 -18
  551. package/dist/Checkbox-67a8c60f.js +0 -63
  552. package/dist/Chip/index.js +0 -42
  553. package/dist/Chip-6395df79.js +0 -89
  554. package/dist/Chips/index.js +0 -525
  555. package/dist/Combobox/index.js +0 -41
  556. package/dist/Combobox-2f357a96.js +0 -481
  557. package/dist/ConfirmationModal/index.js +0 -32
  558. package/dist/Content/index.js +0 -12
  559. package/dist/Content-e3f7b6fc.js +0 -24
  560. package/dist/Countdown/index.js +0 -72
  561. package/dist/DataDump/index.js +0 -37
  562. package/dist/DataList/index.js +0 -1346
  563. package/dist/DataTable/index.js +0 -301
  564. package/dist/DatePicker/index.js +0 -21
  565. package/dist/DatePicker-3b086bf8.js +0 -144
  566. package/dist/DescriptionList/index.js +0 -24
  567. package/dist/Disclosure/index.js +0 -46
  568. package/dist/Divider/index.js +0 -29
  569. package/dist/Drawer/index.js +0 -50
  570. package/dist/Emphasis/index.js +0 -13
  571. package/dist/Emphasis-f298e0bd.js +0 -19
  572. package/dist/FeatureSwitch/index.js +0 -71
  573. package/dist/Flex/index.js +0 -12
  574. package/dist/Flex-d490c4db.js +0 -38
  575. package/dist/FormField/index.js +0 -24
  576. package/dist/FormField-cea3a4f7.js +0 -253
  577. package/dist/FormatEmail/index.js +0 -23
  578. package/dist/FormatFile/index.js +0 -37
  579. package/dist/FormatFile-9cc4c85a.js +0 -162
  580. package/dist/Gallery/index.js +0 -101
  581. package/dist/Glimmer/index.js +0 -15
  582. package/dist/Glimmer-84dee1ed.js +0 -77
  583. package/dist/Grid/index.js +0 -76
  584. package/dist/Heading/index.js +0 -15
  585. package/dist/Icon/index.js +0 -11
  586. package/dist/Icon-405a216c.js +0 -40
  587. package/dist/InlineLabel/index.js +0 -13
  588. package/dist/InlineLabel-79098f71.js +0 -28
  589. package/dist/InputAvatar/index.js +0 -70
  590. package/dist/InputEmail/index.js +0 -43
  591. package/dist/InputFile/index.js +0 -25
  592. package/dist/InputFile-07c0c738.js +0 -190
  593. package/dist/InputGroup/index.js +0 -12
  594. package/dist/InputGroup-8d4fd4eb.js +0 -33
  595. package/dist/InputNumber/index.js +0 -25
  596. package/dist/InputPassword/index.js +0 -41
  597. package/dist/InputText/index.js +0 -26
  598. package/dist/InputValidation/index.js +0 -17
  599. package/dist/InputValidation-ba5f81cb.js +0 -29
  600. package/dist/LightBox/index.js +0 -25
  601. package/dist/LightBox-ec2c0094.js +0 -121
  602. package/dist/Link/index.js +0 -15
  603. package/dist/List/index.js +0 -94
  604. package/dist/Markdown/index.js +0 -20
  605. package/dist/Markdown-bee813fc.js +0 -62
  606. package/dist/Menu/index.js +0 -21
  607. package/dist/Menu-9477e5e3.js +0 -139
  608. package/dist/Modal/index.js +0 -26
  609. package/dist/Modal-03731670.js +0 -74
  610. package/dist/MultiSelect/index.js +0 -182
  611. package/dist/Option-085a96d7.js +0 -19
  612. package/dist/Page/index.js +0 -78
  613. package/dist/Popover/index.js +0 -65
  614. package/dist/ProgressBar/index.js +0 -12
  615. package/dist/ProgressBar-b68edc8f.js +0 -43
  616. package/dist/RadioGroup/index.js +0 -15
  617. package/dist/RadioGroup-2a8824e9.js +0 -46
  618. package/dist/RecurringSelect/index.js +0 -227
  619. package/dist/Select/index.js +0 -26
  620. package/dist/Spinner/index.js +0 -12
  621. package/dist/Spinner-9d8fc7ff.js +0 -24
  622. package/dist/StatusIndicator/index.js +0 -11
  623. package/dist/StatusIndicator-7b5258ea.js +0 -18
  624. package/dist/StatusLabel/index.js +0 -28
  625. package/dist/Switch/index.js +0 -13
  626. package/dist/Switch-e9503dbd.js +0 -56
  627. package/dist/Table/index.js +0 -66
  628. package/dist/Tabs/index.js +0 -80
  629. package/dist/Text/index.js +0 -13
  630. package/dist/Toast/index.js +0 -111
  631. package/dist/Tooltip/index.js +0 -17
  632. package/dist/Tooltip-b9de6e57.js +0 -114
  633. package/dist/Typography/index.js +0 -12
  634. package/dist/Typography-8c397b84.js +0 -62
  635. package/dist/style-inject.es-9d2f5f4e.js +0 -30
  636. package/dist/tslib.es6-754e2961.js +0 -46
  637. /package/{.eslintrc.js → .eslintrc.cjs} +0 -0
  638. /package/dist/{AtlantisContext-64608897.js → AtlantisContext-LI1uQsX5.js} +0 -0
@@ -0,0 +1,1611 @@
1
+ 'use strict';
2
+
3
+ var tslib_es6 = require('./tslib.es6-CjmNBqgv.js');
4
+ var React = require('react');
5
+ var classnames = require('classnames');
6
+ var index = require('./index-BQdnPLod.js');
7
+ var axios = require('axios');
8
+ var InputValidation = require('./InputValidation-BvTmvsYp.js');
9
+ var Button = require('./Button-DE6Du5Wv.js');
10
+ var Content = require('./Content-DErBfjY3.js');
11
+ var Typography = require('./Typography-CBz3Bwzs.js');
12
+
13
+ var COMMON_MIME_TYPES = new Map([
14
+ // https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
15
+ ['aac', 'audio/aac'],
16
+ ['abw', 'application/x-abiword'],
17
+ ['arc', 'application/x-freearc'],
18
+ ['avif', 'image/avif'],
19
+ ['avi', 'video/x-msvideo'],
20
+ ['azw', 'application/vnd.amazon.ebook'],
21
+ ['bin', 'application/octet-stream'],
22
+ ['bmp', 'image/bmp'],
23
+ ['bz', 'application/x-bzip'],
24
+ ['bz2', 'application/x-bzip2'],
25
+ ['cda', 'application/x-cdf'],
26
+ ['csh', 'application/x-csh'],
27
+ ['css', 'text/css'],
28
+ ['csv', 'text/csv'],
29
+ ['doc', 'application/msword'],
30
+ ['docx', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'],
31
+ ['eot', 'application/vnd.ms-fontobject'],
32
+ ['epub', 'application/epub+zip'],
33
+ ['gz', 'application/gzip'],
34
+ ['gif', 'image/gif'],
35
+ ['htm', 'text/html'],
36
+ ['html', 'text/html'],
37
+ ['ico', 'image/vnd.microsoft.icon'],
38
+ ['ics', 'text/calendar'],
39
+ ['jar', 'application/java-archive'],
40
+ ['jpeg', 'image/jpeg'],
41
+ ['jpg', 'image/jpeg'],
42
+ ['js', 'text/javascript'],
43
+ ['json', 'application/json'],
44
+ ['jsonld', 'application/ld+json'],
45
+ ['mid', 'audio/midi'],
46
+ ['midi', 'audio/midi'],
47
+ ['mjs', 'text/javascript'],
48
+ ['mp3', 'audio/mpeg'],
49
+ ['mp4', 'video/mp4'],
50
+ ['mpeg', 'video/mpeg'],
51
+ ['mpkg', 'application/vnd.apple.installer+xml'],
52
+ ['odp', 'application/vnd.oasis.opendocument.presentation'],
53
+ ['ods', 'application/vnd.oasis.opendocument.spreadsheet'],
54
+ ['odt', 'application/vnd.oasis.opendocument.text'],
55
+ ['oga', 'audio/ogg'],
56
+ ['ogv', 'video/ogg'],
57
+ ['ogx', 'application/ogg'],
58
+ ['opus', 'audio/opus'],
59
+ ['otf', 'font/otf'],
60
+ ['png', 'image/png'],
61
+ ['pdf', 'application/pdf'],
62
+ ['php', 'application/x-httpd-php'],
63
+ ['ppt', 'application/vnd.ms-powerpoint'],
64
+ ['pptx', 'application/vnd.openxmlformats-officedocument.presentationml.presentation'],
65
+ ['rar', 'application/vnd.rar'],
66
+ ['rtf', 'application/rtf'],
67
+ ['sh', 'application/x-sh'],
68
+ ['svg', 'image/svg+xml'],
69
+ ['swf', 'application/x-shockwave-flash'],
70
+ ['tar', 'application/x-tar'],
71
+ ['tif', 'image/tiff'],
72
+ ['tiff', 'image/tiff'],
73
+ ['ts', 'video/mp2t'],
74
+ ['ttf', 'font/ttf'],
75
+ ['txt', 'text/plain'],
76
+ ['vsd', 'application/vnd.visio'],
77
+ ['wav', 'audio/wav'],
78
+ ['weba', 'audio/webm'],
79
+ ['webm', 'video/webm'],
80
+ ['webp', 'image/webp'],
81
+ ['woff', 'font/woff'],
82
+ ['woff2', 'font/woff2'],
83
+ ['xhtml', 'application/xhtml+xml'],
84
+ ['xls', 'application/vnd.ms-excel'],
85
+ ['xlsx', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'],
86
+ ['xml', 'application/xml'],
87
+ ['xul', 'application/vnd.mozilla.xul+xml'],
88
+ ['zip', 'application/zip'],
89
+ ['7z', 'application/x-7z-compressed'],
90
+ // Others
91
+ ['mkv', 'video/x-matroska'],
92
+ ['mov', 'video/quicktime'],
93
+ ['msg', 'application/vnd.ms-outlook']
94
+ ]);
95
+ function toFileWithPath(file, path) {
96
+ var f = withMimeType(file);
97
+ if (typeof f.path !== 'string') { // on electron, path is already set to the absolute path
98
+ var webkitRelativePath = file.webkitRelativePath;
99
+ Object.defineProperty(f, 'path', {
100
+ value: typeof path === 'string'
101
+ ? path
102
+ // If <input webkitdirectory> is set,
103
+ // the File will have a {webkitRelativePath} property
104
+ // https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/webkitdirectory
105
+ : typeof webkitRelativePath === 'string' && webkitRelativePath.length > 0
106
+ ? webkitRelativePath
107
+ : file.name,
108
+ writable: false,
109
+ configurable: false,
110
+ enumerable: true
111
+ });
112
+ }
113
+ return f;
114
+ }
115
+ function withMimeType(file) {
116
+ var name = file.name;
117
+ var hasExtension = name && name.lastIndexOf('.') !== -1;
118
+ if (hasExtension && !file.type) {
119
+ var ext = name.split('.')
120
+ .pop().toLowerCase();
121
+ var type = COMMON_MIME_TYPES.get(ext);
122
+ if (type) {
123
+ Object.defineProperty(file, 'type', {
124
+ value: type,
125
+ writable: false,
126
+ configurable: false,
127
+ enumerable: true
128
+ });
129
+ }
130
+ }
131
+ return file;
132
+ }
133
+
134
+ var FILES_TO_IGNORE = [
135
+ // Thumbnail cache files for macOS and Windows
136
+ '.DS_Store',
137
+ 'Thumbs.db' // Windows
138
+ ];
139
+ /**
140
+ * Convert a DragEvent's DataTrasfer object to a list of File objects
141
+ * NOTE: If some of the items are folders,
142
+ * everything will be flattened and placed in the same list but the paths will be kept as a {path} property.
143
+ *
144
+ * EXPERIMENTAL: A list of https://developer.mozilla.org/en-US/docs/Web/API/FileSystemHandle objects can also be passed as an arg
145
+ * and a list of File objects will be returned.
146
+ *
147
+ * @param evt
148
+ */
149
+ function fromEvent(evt) {
150
+ return tslib_es6.__awaiter(this, void 0, void 0, function () {
151
+ return tslib_es6.__generator(this, function (_a) {
152
+ if (isObject(evt) && isDataTransfer(evt)) {
153
+ return [2 /*return*/, getDataTransferFiles(evt.dataTransfer, evt.type)];
154
+ }
155
+ else if (isChangeEvt(evt)) {
156
+ return [2 /*return*/, getInputFiles(evt)];
157
+ }
158
+ else if (Array.isArray(evt) && evt.every(function (item) { return 'getFile' in item && typeof item.getFile === 'function'; })) {
159
+ return [2 /*return*/, getFsHandleFiles(evt)];
160
+ }
161
+ return [2 /*return*/, []];
162
+ });
163
+ });
164
+ }
165
+ function isDataTransfer(value) {
166
+ return isObject(value.dataTransfer);
167
+ }
168
+ function isChangeEvt(value) {
169
+ return isObject(value) && isObject(value.target);
170
+ }
171
+ function isObject(v) {
172
+ return typeof v === 'object' && v !== null;
173
+ }
174
+ function getInputFiles(evt) {
175
+ return fromList(evt.target.files).map(function (file) { return toFileWithPath(file); });
176
+ }
177
+ // Ee expect each handle to be https://developer.mozilla.org/en-US/docs/Web/API/FileSystemFileHandle
178
+ function getFsHandleFiles(handles) {
179
+ return tslib_es6.__awaiter(this, void 0, void 0, function () {
180
+ var files;
181
+ return tslib_es6.__generator(this, function (_a) {
182
+ switch (_a.label) {
183
+ case 0: return [4 /*yield*/, Promise.all(handles.map(function (h) { return h.getFile(); }))];
184
+ case 1:
185
+ files = _a.sent();
186
+ return [2 /*return*/, files.map(function (file) { return toFileWithPath(file); })];
187
+ }
188
+ });
189
+ });
190
+ }
191
+ function getDataTransferFiles(dt, type) {
192
+ return tslib_es6.__awaiter(this, void 0, void 0, function () {
193
+ var items, files;
194
+ return tslib_es6.__generator(this, function (_a) {
195
+ switch (_a.label) {
196
+ case 0:
197
+ if (dt === null) {
198
+ return [2 /*return*/, []];
199
+ }
200
+ if (!dt.items) return [3 /*break*/, 2];
201
+ items = fromList(dt.items)
202
+ .filter(function (item) { return item.kind === 'file'; });
203
+ // According to https://html.spec.whatwg.org/multipage/dnd.html#dndevents,
204
+ // only 'dragstart' and 'drop' has access to the data (source node)
205
+ if (type !== 'drop') {
206
+ return [2 /*return*/, items];
207
+ }
208
+ return [4 /*yield*/, Promise.all(items.map(toFilePromises))];
209
+ case 1:
210
+ files = _a.sent();
211
+ return [2 /*return*/, noIgnoredFiles(flatten(files))];
212
+ case 2: return [2 /*return*/, noIgnoredFiles(fromList(dt.files)
213
+ .map(function (file) { return toFileWithPath(file); }))];
214
+ }
215
+ });
216
+ });
217
+ }
218
+ function noIgnoredFiles(files) {
219
+ return files.filter(function (file) { return FILES_TO_IGNORE.indexOf(file.name) === -1; });
220
+ }
221
+ // IE11 does not support Array.from()
222
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from#Browser_compatibility
223
+ // https://developer.mozilla.org/en-US/docs/Web/API/FileList
224
+ // https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItemList
225
+ function fromList(items) {
226
+ if (items === null) {
227
+ return [];
228
+ }
229
+ var files = [];
230
+ // tslint:disable: prefer-for-of
231
+ for (var i = 0; i < items.length; i++) {
232
+ var file = items[i];
233
+ files.push(file);
234
+ }
235
+ return files;
236
+ }
237
+ // https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItem
238
+ function toFilePromises(item) {
239
+ if (typeof item.webkitGetAsEntry !== 'function') {
240
+ return fromDataTransferItem(item);
241
+ }
242
+ var entry = item.webkitGetAsEntry();
243
+ // Safari supports dropping an image node from a different window and can be retrieved using
244
+ // the DataTransferItem.getAsFile() API
245
+ // NOTE: FileSystemEntry.file() throws if trying to get the file
246
+ if (entry && entry.isDirectory) {
247
+ return fromDirEntry(entry);
248
+ }
249
+ return fromDataTransferItem(item);
250
+ }
251
+ function flatten(items) {
252
+ return items.reduce(function (acc, files) { return tslib_es6.__spread(acc, (Array.isArray(files) ? flatten(files) : [files])); }, []);
253
+ }
254
+ function fromDataTransferItem(item) {
255
+ var file = item.getAsFile();
256
+ if (!file) {
257
+ return Promise.reject(item + " is not a File");
258
+ }
259
+ var fwp = toFileWithPath(file);
260
+ return Promise.resolve(fwp);
261
+ }
262
+ // https://developer.mozilla.org/en-US/docs/Web/API/FileSystemEntry
263
+ function fromEntry(entry) {
264
+ return tslib_es6.__awaiter(this, void 0, void 0, function () {
265
+ return tslib_es6.__generator(this, function (_a) {
266
+ return [2 /*return*/, entry.isDirectory ? fromDirEntry(entry) : fromFileEntry(entry)];
267
+ });
268
+ });
269
+ }
270
+ // https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryEntry
271
+ function fromDirEntry(entry) {
272
+ var reader = entry.createReader();
273
+ return new Promise(function (resolve, reject) {
274
+ var entries = [];
275
+ function readEntries() {
276
+ var _this = this;
277
+ // https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryEntry/createReader
278
+ // https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryReader/readEntries
279
+ reader.readEntries(function (batch) { return tslib_es6.__awaiter(_this, void 0, void 0, function () {
280
+ var files, err_1, items;
281
+ return tslib_es6.__generator(this, function (_a) {
282
+ switch (_a.label) {
283
+ case 0:
284
+ if (!!batch.length) return [3 /*break*/, 5];
285
+ _a.label = 1;
286
+ case 1:
287
+ _a.trys.push([1, 3, , 4]);
288
+ return [4 /*yield*/, Promise.all(entries)];
289
+ case 2:
290
+ files = _a.sent();
291
+ resolve(files);
292
+ return [3 /*break*/, 4];
293
+ case 3:
294
+ err_1 = _a.sent();
295
+ reject(err_1);
296
+ return [3 /*break*/, 4];
297
+ case 4: return [3 /*break*/, 6];
298
+ case 5:
299
+ items = Promise.all(batch.map(fromEntry));
300
+ entries.push(items);
301
+ // Continue reading
302
+ readEntries();
303
+ _a.label = 6;
304
+ case 6: return [2 /*return*/];
305
+ }
306
+ });
307
+ }); }, function (err) {
308
+ reject(err);
309
+ });
310
+ }
311
+ readEntries();
312
+ });
313
+ }
314
+ // https://developer.mozilla.org/en-US/docs/Web/API/FileSystemFileEntry
315
+ function fromFileEntry(entry) {
316
+ return tslib_es6.__awaiter(this, void 0, void 0, function () {
317
+ return tslib_es6.__generator(this, function (_a) {
318
+ return [2 /*return*/, new Promise(function (resolve, reject) {
319
+ entry.file(function (file) {
320
+ var fwp = toFileWithPath(file, entry.fullPath);
321
+ resolve(fwp);
322
+ }, function (err) {
323
+ reject(err);
324
+ });
325
+ })];
326
+ });
327
+ });
328
+ }
329
+
330
+ var _default = function (file, acceptedFiles) {
331
+ if (file && acceptedFiles) {
332
+ var acceptedFilesArray = Array.isArray(acceptedFiles) ? acceptedFiles : acceptedFiles.split(',');
333
+ var fileName = file.name || '';
334
+ var mimeType = (file.type || '').toLowerCase();
335
+ var baseMimeType = mimeType.replace(/\/.*$/, '');
336
+ return acceptedFilesArray.some(function (type) {
337
+ var validType = type.trim().toLowerCase();
338
+
339
+ if (validType.charAt(0) === '.') {
340
+ return fileName.toLowerCase().endsWith(validType);
341
+ } else if (validType.endsWith('/*')) {
342
+ // This is something like a image/* mime type
343
+ return baseMimeType === validType.replace(/\/.*$/, '');
344
+ }
345
+
346
+ return mimeType === validType;
347
+ });
348
+ }
349
+
350
+ return true;
351
+ };
352
+
353
+ function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
354
+
355
+ function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) { _defineProperty$1(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
356
+
357
+ function _defineProperty$1(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
358
+
359
+ function _slicedToArray$1(arr, i) { return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest$1(); }
360
+
361
+ function _nonIterableRest$1() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
362
+
363
+ function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); }
364
+
365
+ function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
366
+
367
+ function _iterableToArrayLimit$1(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
368
+
369
+ function _arrayWithHoles$1(arr) { if (Array.isArray(arr)) return arr; }
370
+
371
+ var FILE_INVALID_TYPE = 'file-invalid-type';
372
+ var FILE_TOO_LARGE = 'file-too-large';
373
+ var FILE_TOO_SMALL = 'file-too-small';
374
+ var TOO_MANY_FILES = 'too-many-files';
375
+
376
+ var getInvalidTypeRejectionErr = function getInvalidTypeRejectionErr(accept) {
377
+ accept = Array.isArray(accept) && accept.length === 1 ? accept[0] : accept;
378
+ var messageSuffix = Array.isArray(accept) ? "one of ".concat(accept.join(', ')) : accept;
379
+ return {
380
+ code: FILE_INVALID_TYPE,
381
+ message: "File type must be ".concat(messageSuffix)
382
+ };
383
+ };
384
+ var getTooLargeRejectionErr = function getTooLargeRejectionErr(maxSize) {
385
+ return {
386
+ code: FILE_TOO_LARGE,
387
+ message: "File is larger than ".concat(maxSize, " ").concat(maxSize === 1 ? 'byte' : 'bytes')
388
+ };
389
+ };
390
+ var getTooSmallRejectionErr = function getTooSmallRejectionErr(minSize) {
391
+ return {
392
+ code: FILE_TOO_SMALL,
393
+ message: "File is smaller than ".concat(minSize, " ").concat(minSize === 1 ? 'byte' : 'bytes')
394
+ };
395
+ };
396
+ var TOO_MANY_FILES_REJECTION = {
397
+ code: TOO_MANY_FILES,
398
+ message: 'Too many files'
399
+ }; // Firefox versions prior to 53 return a bogus MIME type for every file drag, so dragovers with
400
+ // that MIME type will always be accepted
401
+
402
+ function fileAccepted(file, accept) {
403
+ var isAcceptable = file.type === 'application/x-moz-file' || _default(file, accept);
404
+ return [isAcceptable, isAcceptable ? null : getInvalidTypeRejectionErr(accept)];
405
+ }
406
+ function fileMatchSize(file, minSize, maxSize) {
407
+ if (isDefined(file.size)) {
408
+ if (isDefined(minSize) && isDefined(maxSize)) {
409
+ if (file.size > maxSize) return [false, getTooLargeRejectionErr(maxSize)];
410
+ if (file.size < minSize) return [false, getTooSmallRejectionErr(minSize)];
411
+ } else if (isDefined(minSize) && file.size < minSize) return [false, getTooSmallRejectionErr(minSize)];else if (isDefined(maxSize) && file.size > maxSize) return [false, getTooLargeRejectionErr(maxSize)];
412
+ }
413
+
414
+ return [true, null];
415
+ }
416
+
417
+ function isDefined(value) {
418
+ return value !== undefined && value !== null;
419
+ }
420
+
421
+ function allFilesAccepted(_ref) {
422
+ var files = _ref.files,
423
+ accept = _ref.accept,
424
+ minSize = _ref.minSize,
425
+ maxSize = _ref.maxSize,
426
+ multiple = _ref.multiple,
427
+ maxFiles = _ref.maxFiles;
428
+
429
+ if (!multiple && files.length > 1 || multiple && maxFiles >= 1 && files.length > maxFiles) {
430
+ return false;
431
+ }
432
+
433
+ return files.every(function (file) {
434
+ var _fileAccepted = fileAccepted(file, accept),
435
+ _fileAccepted2 = _slicedToArray$1(_fileAccepted, 1),
436
+ accepted = _fileAccepted2[0];
437
+
438
+ var _fileMatchSize = fileMatchSize(file, minSize, maxSize),
439
+ _fileMatchSize2 = _slicedToArray$1(_fileMatchSize, 1),
440
+ sizeMatch = _fileMatchSize2[0];
441
+
442
+ return accepted && sizeMatch;
443
+ });
444
+ } // React's synthetic events has event.isPropagationStopped,
445
+ // but to remain compatibility with other libs (Preact) fall back
446
+ // to check event.cancelBubble
447
+
448
+ function isPropagationStopped(event) {
449
+ if (typeof event.isPropagationStopped === 'function') {
450
+ return event.isPropagationStopped();
451
+ } else if (typeof event.cancelBubble !== 'undefined') {
452
+ return event.cancelBubble;
453
+ }
454
+
455
+ return false;
456
+ }
457
+ function isEvtWithFiles(event) {
458
+ if (!event.dataTransfer) {
459
+ return !!event.target && !!event.target.files;
460
+ } // https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/types
461
+ // https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API/Recommended_drag_types#file
462
+
463
+
464
+ return Array.prototype.some.call(event.dataTransfer.types, function (type) {
465
+ return type === 'Files' || type === 'application/x-moz-file';
466
+ });
467
+ }
468
+
469
+ function onDocumentDragOver(event) {
470
+ event.preventDefault();
471
+ }
472
+
473
+ function isIe(userAgent) {
474
+ return userAgent.indexOf('MSIE') !== -1 || userAgent.indexOf('Trident/') !== -1;
475
+ }
476
+
477
+ function isEdge(userAgent) {
478
+ return userAgent.indexOf('Edge/') !== -1;
479
+ }
480
+
481
+ function isIeOrEdge() {
482
+ var userAgent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.navigator.userAgent;
483
+ return isIe(userAgent) || isEdge(userAgent);
484
+ }
485
+ /**
486
+ * This is intended to be used to compose event handlers
487
+ * They are executed in order until one of them calls `event.isPropagationStopped()`.
488
+ * Note that the check is done on the first invoke too,
489
+ * meaning that if propagation was stopped before invoking the fns,
490
+ * no handlers will be executed.
491
+ *
492
+ * @param {Function} fns the event hanlder functions
493
+ * @return {Function} the event handler to add to an element
494
+ */
495
+
496
+ function composeEventHandlers() {
497
+ for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) {
498
+ fns[_key] = arguments[_key];
499
+ }
500
+
501
+ return function (event) {
502
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
503
+ args[_key2 - 1] = arguments[_key2];
504
+ }
505
+
506
+ return fns.some(function (fn) {
507
+ if (!isPropagationStopped(event) && fn) {
508
+ fn.apply(void 0, [event].concat(args));
509
+ }
510
+
511
+ return isPropagationStopped(event);
512
+ });
513
+ };
514
+ }
515
+ /**
516
+ * canUseFileSystemAccessAPI checks if the [File System Access API](https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API)
517
+ * is supported by the browser.
518
+ * @returns {boolean}
519
+ */
520
+
521
+ function canUseFileSystemAccessAPI() {
522
+ return 'showOpenFilePicker' in window;
523
+ }
524
+ /**
525
+ * filePickerOptionsTypes returns the {types} option for https://developer.mozilla.org/en-US/docs/Web/API/window/showOpenFilePicker
526
+ * based on the accept attr (see https://github.com/react-dropzone/attr-accept)
527
+ * E.g: converts ['image/*', 'text/*'] to {'image/*': [], 'text/*': []}
528
+ * @param {string|string[]} accept
529
+ */
530
+
531
+ function filePickerOptionsTypes(accept) {
532
+ accept = typeof accept === 'string' ? accept.split(',') : accept;
533
+ return [{
534
+ description: 'everything',
535
+ // TODO: Need to handle filtering more elegantly than this!
536
+ accept: Array.isArray(accept) // Accept just MIME types as per spec
537
+ // NOTE: accept can be https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#unique_file_type_specifiers
538
+ ? accept.filter(function (item) {
539
+ return item === 'audio/*' || item === 'video/*' || item === 'image/*' || item === 'text/*' || /\w+\/[-+.\w]+/g.test(item);
540
+ }).reduce(function (a, b) {
541
+ return _objectSpread$1(_objectSpread$1({}, a), {}, _defineProperty$1({}, b, []));
542
+ }, {}) : {}
543
+ }];
544
+ }
545
+
546
+ var _excluded = ["children"],
547
+ _excluded2 = ["open"],
548
+ _excluded3 = ["refKey", "role", "onKeyDown", "onFocus", "onBlur", "onClick", "onDragEnter", "onDragOver", "onDragLeave", "onDrop"],
549
+ _excluded4 = ["refKey", "onChange", "onClick"];
550
+
551
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
552
+
553
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
554
+
555
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
556
+
557
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
558
+
559
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
560
+
561
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
562
+
563
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
564
+
565
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
566
+
567
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
568
+
569
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
570
+
571
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
572
+
573
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
574
+
575
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
576
+
577
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
578
+
579
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
580
+ /**
581
+ * Convenience wrapper component for the `useDropzone` hook
582
+ *
583
+ * ```jsx
584
+ * <Dropzone>
585
+ * {({getRootProps, getInputProps}) => (
586
+ * <div {...getRootProps()}>
587
+ * <input {...getInputProps()} />
588
+ * <p>Drag 'n' drop some files here, or click to select files</p>
589
+ * </div>
590
+ * )}
591
+ * </Dropzone>
592
+ * ```
593
+ */
594
+
595
+ var Dropzone = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
596
+ var children = _ref.children,
597
+ params = _objectWithoutProperties(_ref, _excluded);
598
+
599
+ var _useDropzone = useDropzone(params),
600
+ open = _useDropzone.open,
601
+ props = _objectWithoutProperties(_useDropzone, _excluded2);
602
+
603
+ React.useImperativeHandle(ref, function () {
604
+ return {
605
+ open: open
606
+ };
607
+ }, [open]); // TODO: Figure out why react-styleguidist cannot create docs if we don't return a jsx element
608
+
609
+ return /*#__PURE__*/React.createElement(React.Fragment, null, children(_objectSpread(_objectSpread({}, props), {}, {
610
+ open: open
611
+ })));
612
+ });
613
+ Dropzone.displayName = 'Dropzone'; // Add default props for react-docgen
614
+
615
+ var defaultProps = {
616
+ disabled: false,
617
+ getFilesFromEvent: fromEvent,
618
+ maxSize: Infinity,
619
+ minSize: 0,
620
+ multiple: true,
621
+ maxFiles: 0,
622
+ preventDropOnDocument: true,
623
+ noClick: false,
624
+ noKeyboard: false,
625
+ noDrag: false,
626
+ noDragEventsBubbling: false,
627
+ validator: null,
628
+ useFsAccessApi: false
629
+ };
630
+ Dropzone.defaultProps = defaultProps;
631
+ Dropzone.propTypes = {
632
+ /**
633
+ * Render function that exposes the dropzone state and prop getter fns
634
+ *
635
+ * @param {object} params
636
+ * @param {Function} params.getRootProps Returns the props you should apply to the root drop container you render
637
+ * @param {Function} params.getInputProps Returns the props you should apply to hidden file input you render
638
+ * @param {Function} params.open Open the native file selection dialog
639
+ * @param {boolean} params.isFocused Dropzone area is in focus
640
+ * @param {boolean} params.isFileDialogActive File dialog is opened
641
+ * @param {boolean} params.isDragActive Active drag is in progress
642
+ * @param {boolean} params.isDragAccept Dragged files are accepted
643
+ * @param {boolean} params.isDragReject Some dragged files are rejected
644
+ * @param {File[]} params.draggedFiles Files in active drag
645
+ * @param {File[]} params.acceptedFiles Accepted files
646
+ * @param {FileRejection[]} params.fileRejections Rejected files and why they were rejected
647
+ */
648
+ children: index.PropTypes.func,
649
+
650
+ /**
651
+ * Set accepted file types.
652
+ * See https://github.com/okonet/attr-accept for more information.
653
+ * Keep in mind that mime type determination is not reliable across platforms. CSV files,
654
+ * for example, are reported as text/plain under macOS but as application/vnd.ms-excel under
655
+ * Windows. In some cases there might not be a mime type set at all.
656
+ * See: https://github.com/react-dropzone/react-dropzone/issues/276
657
+ */
658
+ accept: index.PropTypes.oneOfType([index.PropTypes.string, index.PropTypes.arrayOf(index.PropTypes.string)]),
659
+
660
+ /**
661
+ * Allow drag 'n' drop (or selection from the file dialog) of multiple files
662
+ */
663
+ multiple: index.PropTypes.bool,
664
+
665
+ /**
666
+ * If false, allow dropped items to take over the current browser window
667
+ */
668
+ preventDropOnDocument: index.PropTypes.bool,
669
+
670
+ /**
671
+ * If true, disables click to open the native file selection dialog
672
+ */
673
+ noClick: index.PropTypes.bool,
674
+
675
+ /**
676
+ * If true, disables SPACE/ENTER to open the native file selection dialog.
677
+ * Note that it also stops tracking the focus state.
678
+ */
679
+ noKeyboard: index.PropTypes.bool,
680
+
681
+ /**
682
+ * If true, disables drag 'n' drop
683
+ */
684
+ noDrag: index.PropTypes.bool,
685
+
686
+ /**
687
+ * If true, stops drag event propagation to parents
688
+ */
689
+ noDragEventsBubbling: index.PropTypes.bool,
690
+
691
+ /**
692
+ * Minimum file size (in bytes)
693
+ */
694
+ minSize: index.PropTypes.number,
695
+
696
+ /**
697
+ * Maximum file size (in bytes)
698
+ */
699
+ maxSize: index.PropTypes.number,
700
+
701
+ /**
702
+ * Maximum accepted number of files
703
+ * The default value is 0 which means there is no limitation to how many files are accepted.
704
+ */
705
+ maxFiles: index.PropTypes.number,
706
+
707
+ /**
708
+ * Enable/disable the dropzone
709
+ */
710
+ disabled: index.PropTypes.bool,
711
+
712
+ /**
713
+ * Use this to provide a custom file aggregator
714
+ *
715
+ * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
716
+ */
717
+ getFilesFromEvent: index.PropTypes.func,
718
+
719
+ /**
720
+ * Cb for when closing the file dialog with no selection
721
+ */
722
+ onFileDialogCancel: index.PropTypes.func,
723
+
724
+ /**
725
+ * Cb for when opening the file dialog
726
+ */
727
+ onFileDialogOpen: index.PropTypes.func,
728
+
729
+ /**
730
+ * Set to true to use the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API
731
+ * to open the file picker instead of using an `<input type="file">` click event.
732
+ */
733
+ useFsAccessApi: index.PropTypes.bool,
734
+
735
+ /**
736
+ * Cb for when the `dragenter` event occurs.
737
+ *
738
+ * @param {DragEvent} event
739
+ */
740
+ onDragEnter: index.PropTypes.func,
741
+
742
+ /**
743
+ * Cb for when the `dragleave` event occurs
744
+ *
745
+ * @param {DragEvent} event
746
+ */
747
+ onDragLeave: index.PropTypes.func,
748
+
749
+ /**
750
+ * Cb for when the `dragover` event occurs
751
+ *
752
+ * @param {DragEvent} event
753
+ */
754
+ onDragOver: index.PropTypes.func,
755
+
756
+ /**
757
+ * Cb for when the `drop` event occurs.
758
+ * Note that this callback is invoked after the `getFilesFromEvent` callback is done.
759
+ *
760
+ * Files are accepted or rejected based on the `accept`, `multiple`, `minSize` and `maxSize` props.
761
+ * `accept` must be a valid [MIME type](http://www.iana.org/assignments/media-types/media-types.xhtml) according to [input element specification](https://www.w3.org/wiki/HTML/Elements/input/file) or a valid file extension.
762
+ * If `multiple` is set to false and additional files are dropped,
763
+ * all files besides the first will be rejected.
764
+ * Any file which does not have a size in the [`minSize`, `maxSize`] range, will be rejected as well.
765
+ *
766
+ * Note that the `onDrop` callback will always be invoked regardless if the dropped files were accepted or rejected.
767
+ * If you'd like to react to a specific scenario, use the `onDropAccepted`/`onDropRejected` props.
768
+ *
769
+ * `onDrop` will provide you with an array of [File](https://developer.mozilla.org/en-US/docs/Web/API/File) objects which you can then process and send to a server.
770
+ * For example, with [SuperAgent](https://github.com/visionmedia/superagent) as a http/ajax library:
771
+ *
772
+ * ```js
773
+ * function onDrop(acceptedFiles) {
774
+ * const req = request.post('/upload')
775
+ * acceptedFiles.forEach(file => {
776
+ * req.attach(file.name, file)
777
+ * })
778
+ * req.end(callback)
779
+ * }
780
+ * ```
781
+ *
782
+ * @param {File[]} acceptedFiles
783
+ * @param {FileRejection[]} fileRejections
784
+ * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
785
+ */
786
+ onDrop: index.PropTypes.func,
787
+
788
+ /**
789
+ * Cb for when the `drop` event occurs.
790
+ * Note that if no files are accepted, this callback is not invoked.
791
+ *
792
+ * @param {File[]} files
793
+ * @param {(DragEvent|Event)} event
794
+ */
795
+ onDropAccepted: index.PropTypes.func,
796
+
797
+ /**
798
+ * Cb for when the `drop` event occurs.
799
+ * Note that if no files are rejected, this callback is not invoked.
800
+ *
801
+ * @param {FileRejection[]} fileRejections
802
+ * @param {(DragEvent|Event)} event
803
+ */
804
+ onDropRejected: index.PropTypes.func,
805
+
806
+ /**
807
+ * Custom validation function
808
+ * @param {File} file
809
+ * @returns {FileError|FileError[]}
810
+ */
811
+ validator: index.PropTypes.func
812
+ };
813
+ /**
814
+ * A function that is invoked for the `dragenter`,
815
+ * `dragover` and `dragleave` events.
816
+ * It is not invoked if the items are not files (such as link, text, etc.).
817
+ *
818
+ * @callback dragCb
819
+ * @param {DragEvent} event
820
+ */
821
+
822
+ /**
823
+ * A function that is invoked for the `drop` or input change event.
824
+ * It is not invoked if the items are not files (such as link, text, etc.).
825
+ *
826
+ * @callback dropCb
827
+ * @param {File[]} acceptedFiles List of accepted files
828
+ * @param {FileRejection[]} fileRejections List of rejected files and why they were rejected
829
+ * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
830
+ */
831
+
832
+ /**
833
+ * A function that is invoked for the `drop` or input change event.
834
+ * It is not invoked if the items are files (such as link, text, etc.).
835
+ *
836
+ * @callback dropAcceptedCb
837
+ * @param {File[]} files List of accepted files that meet the given criteria
838
+ * (`accept`, `multiple`, `minSize`, `maxSize`)
839
+ * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
840
+ */
841
+
842
+ /**
843
+ * A function that is invoked for the `drop` or input change event.
844
+ *
845
+ * @callback dropRejectedCb
846
+ * @param {File[]} files List of rejected files that do not meet the given criteria
847
+ * (`accept`, `multiple`, `minSize`, `maxSize`)
848
+ * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
849
+ */
850
+
851
+ /**
852
+ * A function that is used aggregate files,
853
+ * in a asynchronous fashion, from drag or input change events.
854
+ *
855
+ * @callback getFilesFromEvent
856
+ * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
857
+ * @returns {(File[]|Promise<File[]>)}
858
+ */
859
+
860
+ /**
861
+ * An object with the current dropzone state and some helper functions.
862
+ *
863
+ * @typedef {object} DropzoneState
864
+ * @property {Function} getRootProps Returns the props you should apply to the root drop container you render
865
+ * @property {Function} getInputProps Returns the props you should apply to hidden file input you render
866
+ * @property {Function} open Open the native file selection dialog
867
+ * @property {boolean} isFocused Dropzone area is in focus
868
+ * @property {boolean} isFileDialogActive File dialog is opened
869
+ * @property {boolean} isDragActive Active drag is in progress
870
+ * @property {boolean} isDragAccept Dragged files are accepted
871
+ * @property {boolean} isDragReject Some dragged files are rejected
872
+ * @property {File[]} draggedFiles Files in active drag
873
+ * @property {File[]} acceptedFiles Accepted files
874
+ * @property {FileRejection[]} fileRejections Rejected files and why they were rejected
875
+ */
876
+
877
+ var initialState = {
878
+ isFocused: false,
879
+ isFileDialogActive: false,
880
+ isDragActive: false,
881
+ isDragAccept: false,
882
+ isDragReject: false,
883
+ draggedFiles: [],
884
+ acceptedFiles: [],
885
+ fileRejections: []
886
+ };
887
+ /**
888
+ * A React hook that creates a drag 'n' drop area.
889
+ *
890
+ * ```jsx
891
+ * function MyDropzone(props) {
892
+ * const {getRootProps, getInputProps} = useDropzone({
893
+ * onDrop: acceptedFiles => {
894
+ * // do something with the File objects, e.g. upload to some server
895
+ * }
896
+ * });
897
+ * return (
898
+ * <div {...getRootProps()}>
899
+ * <input {...getInputProps()} />
900
+ * <p>Drag and drop some files here, or click to select files</p>
901
+ * </div>
902
+ * )
903
+ * }
904
+ * ```
905
+ *
906
+ * @function useDropzone
907
+ *
908
+ * @param {object} props
909
+ * @param {string|string[]} [props.accept] Set accepted file types.
910
+ * See https://github.com/okonet/attr-accept for more information.
911
+ * Keep in mind that mime type determination is not reliable across platforms. CSV files,
912
+ * for example, are reported as text/plain under macOS but as application/vnd.ms-excel under
913
+ * Windows. In some cases there might not be a mime type set at all.
914
+ * See: https://github.com/react-dropzone/react-dropzone/issues/276
915
+ * @param {boolean} [props.multiple=true] Allow drag 'n' drop (or selection from the file dialog) of multiple files
916
+ * @param {boolean} [props.preventDropOnDocument=true] If false, allow dropped items to take over the current browser window
917
+ * @param {boolean} [props.noClick=false] If true, disables click to open the native file selection dialog
918
+ * @param {boolean} [props.noKeyboard=false] If true, disables SPACE/ENTER to open the native file selection dialog.
919
+ * Note that it also stops tracking the focus state.
920
+ * @param {boolean} [props.noDrag=false] If true, disables drag 'n' drop
921
+ * @param {boolean} [props.noDragEventsBubbling=false] If true, stops drag event propagation to parents
922
+ * @param {number} [props.minSize=0] Minimum file size (in bytes)
923
+ * @param {number} [props.maxSize=Infinity] Maximum file size (in bytes)
924
+ * @param {boolean} [props.disabled=false] Enable/disable the dropzone
925
+ * @param {getFilesFromEvent} [props.getFilesFromEvent] Use this to provide a custom file aggregator
926
+ * @param {Function} [props.onFileDialogCancel] Cb for when closing the file dialog with no selection
927
+ * @param {boolean} [props.useFsAccessApi] Set to true to use the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API
928
+ * to open the file picker instead of using an `<input type="file">` click event.
929
+ * @param {Function} [props.onFileDialogOpen] Cb for when opening the file dialog
930
+ * @param {dragCb} [props.onDragEnter] Cb for when the `dragenter` event occurs.
931
+ * @param {dragCb} [props.onDragLeave] Cb for when the `dragleave` event occurs
932
+ * @param {dragCb} [props.onDragOver] Cb for when the `dragover` event occurs
933
+ * @param {dropCb} [props.onDrop] Cb for when the `drop` event occurs.
934
+ * Note that this callback is invoked after the `getFilesFromEvent` callback is done.
935
+ *
936
+ * Files are accepted or rejected based on the `accept`, `multiple`, `minSize` and `maxSize` props.
937
+ * `accept` must be a valid [MIME type](http://www.iana.org/assignments/media-types/media-types.xhtml) according to [input element specification](https://www.w3.org/wiki/HTML/Elements/input/file) or a valid file extension.
938
+ * If `multiple` is set to false and additional files are dropped,
939
+ * all files besides the first will be rejected.
940
+ * Any file which does not have a size in the [`minSize`, `maxSize`] range, will be rejected as well.
941
+ *
942
+ * Note that the `onDrop` callback will always be invoked regardless if the dropped files were accepted or rejected.
943
+ * If you'd like to react to a specific scenario, use the `onDropAccepted`/`onDropRejected` props.
944
+ *
945
+ * `onDrop` will provide you with an array of [File](https://developer.mozilla.org/en-US/docs/Web/API/File) objects which you can then process and send to a server.
946
+ * For example, with [SuperAgent](https://github.com/visionmedia/superagent) as a http/ajax library:
947
+ *
948
+ * ```js
949
+ * function onDrop(acceptedFiles) {
950
+ * const req = request.post('/upload')
951
+ * acceptedFiles.forEach(file => {
952
+ * req.attach(file.name, file)
953
+ * })
954
+ * req.end(callback)
955
+ * }
956
+ * ```
957
+ * @param {dropAcceptedCb} [props.onDropAccepted]
958
+ * @param {dropRejectedCb} [props.onDropRejected]
959
+ *
960
+ * @returns {DropzoneState}
961
+ */
962
+
963
+ function useDropzone() {
964
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
965
+
966
+ var _defaultProps$options = _objectSpread(_objectSpread({}, defaultProps), options),
967
+ accept = _defaultProps$options.accept,
968
+ disabled = _defaultProps$options.disabled,
969
+ getFilesFromEvent = _defaultProps$options.getFilesFromEvent,
970
+ maxSize = _defaultProps$options.maxSize,
971
+ minSize = _defaultProps$options.minSize,
972
+ multiple = _defaultProps$options.multiple,
973
+ maxFiles = _defaultProps$options.maxFiles,
974
+ onDragEnter = _defaultProps$options.onDragEnter,
975
+ onDragLeave = _defaultProps$options.onDragLeave,
976
+ onDragOver = _defaultProps$options.onDragOver,
977
+ onDrop = _defaultProps$options.onDrop,
978
+ onDropAccepted = _defaultProps$options.onDropAccepted,
979
+ onDropRejected = _defaultProps$options.onDropRejected,
980
+ onFileDialogCancel = _defaultProps$options.onFileDialogCancel,
981
+ onFileDialogOpen = _defaultProps$options.onFileDialogOpen,
982
+ useFsAccessApi = _defaultProps$options.useFsAccessApi,
983
+ preventDropOnDocument = _defaultProps$options.preventDropOnDocument,
984
+ noClick = _defaultProps$options.noClick,
985
+ noKeyboard = _defaultProps$options.noKeyboard,
986
+ noDrag = _defaultProps$options.noDrag,
987
+ noDragEventsBubbling = _defaultProps$options.noDragEventsBubbling,
988
+ validator = _defaultProps$options.validator;
989
+
990
+ var onFileDialogOpenCb = React.useMemo(function () {
991
+ return typeof onFileDialogOpen === 'function' ? onFileDialogOpen : noop;
992
+ }, [onFileDialogOpen]);
993
+ var onFileDialogCancelCb = React.useMemo(function () {
994
+ return typeof onFileDialogCancel === 'function' ? onFileDialogCancel : noop;
995
+ }, [onFileDialogCancel]);
996
+ var rootRef = React.useRef(null);
997
+ var inputRef = React.useRef(null);
998
+
999
+ var _useReducer = React.useReducer(reducer, initialState),
1000
+ _useReducer2 = _slicedToArray(_useReducer, 2),
1001
+ state = _useReducer2[0],
1002
+ dispatch = _useReducer2[1];
1003
+
1004
+ var isFocused = state.isFocused,
1005
+ isFileDialogActive = state.isFileDialogActive,
1006
+ draggedFiles = state.draggedFiles; // Update file dialog active state when the window is focused on
1007
+
1008
+ var onWindowFocus = function onWindowFocus() {
1009
+ // Execute the timeout only if the file dialog is opened in the browser
1010
+ if (isFileDialogActive) {
1011
+ setTimeout(function () {
1012
+ if (inputRef.current) {
1013
+ var files = inputRef.current.files;
1014
+
1015
+ if (!files.length) {
1016
+ dispatch({
1017
+ type: 'closeDialog'
1018
+ });
1019
+ onFileDialogCancelCb();
1020
+ }
1021
+ }
1022
+ }, 300);
1023
+ }
1024
+ };
1025
+
1026
+ React.useEffect(function () {
1027
+ if (useFsAccessApi && canUseFileSystemAccessAPI()) {
1028
+ return function () {};
1029
+ }
1030
+
1031
+ window.addEventListener('focus', onWindowFocus, false);
1032
+ return function () {
1033
+ window.removeEventListener('focus', onWindowFocus, false);
1034
+ };
1035
+ }, [inputRef, isFileDialogActive, onFileDialogCancelCb, useFsAccessApi]);
1036
+ var dragTargetsRef = React.useRef([]);
1037
+
1038
+ var onDocumentDrop = function onDocumentDrop(event) {
1039
+ if (rootRef.current && rootRef.current.contains(event.target)) {
1040
+ // If we intercepted an event for our instance, let it propagate down to the instance's onDrop handler
1041
+ return;
1042
+ }
1043
+
1044
+ event.preventDefault();
1045
+ dragTargetsRef.current = [];
1046
+ };
1047
+
1048
+ React.useEffect(function () {
1049
+ if (preventDropOnDocument) {
1050
+ document.addEventListener('dragover', onDocumentDragOver, false);
1051
+ document.addEventListener('drop', onDocumentDrop, false);
1052
+ }
1053
+
1054
+ return function () {
1055
+ if (preventDropOnDocument) {
1056
+ document.removeEventListener('dragover', onDocumentDragOver);
1057
+ document.removeEventListener('drop', onDocumentDrop);
1058
+ }
1059
+ };
1060
+ }, [rootRef, preventDropOnDocument]);
1061
+ var onDragEnterCb = React.useCallback(function (event) {
1062
+ event.preventDefault(); // Persist here because we need the event later after getFilesFromEvent() is done
1063
+
1064
+ event.persist();
1065
+ stopPropagation(event);
1066
+ dragTargetsRef.current = [].concat(_toConsumableArray(dragTargetsRef.current), [event.target]);
1067
+
1068
+ if (isEvtWithFiles(event)) {
1069
+ Promise.resolve(getFilesFromEvent(event)).then(function (draggedFiles) {
1070
+ if (isPropagationStopped(event) && !noDragEventsBubbling) {
1071
+ return;
1072
+ }
1073
+
1074
+ dispatch({
1075
+ draggedFiles: draggedFiles,
1076
+ isDragActive: true,
1077
+ type: 'setDraggedFiles'
1078
+ });
1079
+
1080
+ if (onDragEnter) {
1081
+ onDragEnter(event);
1082
+ }
1083
+ });
1084
+ }
1085
+ }, [getFilesFromEvent, onDragEnter, noDragEventsBubbling]);
1086
+ var onDragOverCb = React.useCallback(function (event) {
1087
+ event.preventDefault();
1088
+ event.persist();
1089
+ stopPropagation(event);
1090
+ var hasFiles = isEvtWithFiles(event);
1091
+
1092
+ if (hasFiles && event.dataTransfer) {
1093
+ try {
1094
+ event.dataTransfer.dropEffect = 'copy';
1095
+ } catch (_unused) {}
1096
+ /* eslint-disable-line no-empty */
1097
+
1098
+ }
1099
+
1100
+ if (hasFiles && onDragOver) {
1101
+ onDragOver(event);
1102
+ }
1103
+
1104
+ return false;
1105
+ }, [onDragOver, noDragEventsBubbling]);
1106
+ var onDragLeaveCb = React.useCallback(function (event) {
1107
+ event.preventDefault();
1108
+ event.persist();
1109
+ stopPropagation(event); // Only deactivate once the dropzone and all children have been left
1110
+
1111
+ var targets = dragTargetsRef.current.filter(function (target) {
1112
+ return rootRef.current && rootRef.current.contains(target);
1113
+ }); // Make sure to remove a target present multiple times only once
1114
+ // (Firefox may fire dragenter/dragleave multiple times on the same element)
1115
+
1116
+ var targetIdx = targets.indexOf(event.target);
1117
+
1118
+ if (targetIdx !== -1) {
1119
+ targets.splice(targetIdx, 1);
1120
+ }
1121
+
1122
+ dragTargetsRef.current = targets;
1123
+
1124
+ if (targets.length > 0) {
1125
+ return;
1126
+ }
1127
+
1128
+ dispatch({
1129
+ isDragActive: false,
1130
+ type: 'setDraggedFiles',
1131
+ draggedFiles: []
1132
+ });
1133
+
1134
+ if (isEvtWithFiles(event) && onDragLeave) {
1135
+ onDragLeave(event);
1136
+ }
1137
+ }, [rootRef, onDragLeave, noDragEventsBubbling]);
1138
+ var setFiles = React.useCallback(function (files, event) {
1139
+ var acceptedFiles = [];
1140
+ var fileRejections = [];
1141
+ files.forEach(function (file) {
1142
+ var _fileAccepted = fileAccepted(file, accept),
1143
+ _fileAccepted2 = _slicedToArray(_fileAccepted, 2),
1144
+ accepted = _fileAccepted2[0],
1145
+ acceptError = _fileAccepted2[1];
1146
+
1147
+ var _fileMatchSize = fileMatchSize(file, minSize, maxSize),
1148
+ _fileMatchSize2 = _slicedToArray(_fileMatchSize, 2),
1149
+ sizeMatch = _fileMatchSize2[0],
1150
+ sizeError = _fileMatchSize2[1];
1151
+
1152
+ var customErrors = validator ? validator(file) : null;
1153
+
1154
+ if (accepted && sizeMatch && !customErrors) {
1155
+ acceptedFiles.push(file);
1156
+ } else {
1157
+ var errors = [acceptError, sizeError];
1158
+
1159
+ if (customErrors) {
1160
+ errors = errors.concat(customErrors);
1161
+ }
1162
+
1163
+ fileRejections.push({
1164
+ file: file,
1165
+ errors: errors.filter(function (e) {
1166
+ return e;
1167
+ })
1168
+ });
1169
+ }
1170
+ });
1171
+
1172
+ if (!multiple && acceptedFiles.length > 1 || multiple && maxFiles >= 1 && acceptedFiles.length > maxFiles) {
1173
+ // Reject everything and empty accepted files
1174
+ acceptedFiles.forEach(function (file) {
1175
+ fileRejections.push({
1176
+ file: file,
1177
+ errors: [TOO_MANY_FILES_REJECTION]
1178
+ });
1179
+ });
1180
+ acceptedFiles.splice(0);
1181
+ }
1182
+
1183
+ dispatch({
1184
+ acceptedFiles: acceptedFiles,
1185
+ fileRejections: fileRejections,
1186
+ type: 'setFiles'
1187
+ });
1188
+
1189
+ if (onDrop) {
1190
+ onDrop(acceptedFiles, fileRejections, event);
1191
+ }
1192
+
1193
+ if (fileRejections.length > 0 && onDropRejected) {
1194
+ onDropRejected(fileRejections, event);
1195
+ }
1196
+
1197
+ if (acceptedFiles.length > 0 && onDropAccepted) {
1198
+ onDropAccepted(acceptedFiles, event);
1199
+ }
1200
+ }, [dispatch, multiple, accept, minSize, maxSize, maxFiles, onDrop, onDropAccepted, onDropRejected, validator]);
1201
+ var onDropCb = React.useCallback(function (event) {
1202
+ event.preventDefault(); // Persist here because we need the event later after getFilesFromEvent() is done
1203
+
1204
+ event.persist();
1205
+ stopPropagation(event);
1206
+ dragTargetsRef.current = [];
1207
+
1208
+ if (isEvtWithFiles(event)) {
1209
+ Promise.resolve(getFilesFromEvent(event)).then(function (files) {
1210
+ if (isPropagationStopped(event) && !noDragEventsBubbling) {
1211
+ return;
1212
+ }
1213
+
1214
+ setFiles(files, event);
1215
+ });
1216
+ }
1217
+
1218
+ dispatch({
1219
+ type: 'reset'
1220
+ });
1221
+ }, [getFilesFromEvent, setFiles, noDragEventsBubbling]); // Fn for opening the file dialog programmatically
1222
+
1223
+ var openFileDialog = React.useCallback(function () {
1224
+ if (useFsAccessApi && canUseFileSystemAccessAPI()) {
1225
+ dispatch({
1226
+ type: 'openDialog'
1227
+ });
1228
+ onFileDialogOpenCb(); // https://developer.mozilla.org/en-US/docs/Web/API/window/showOpenFilePicker
1229
+
1230
+ var opts = {
1231
+ multiple: multiple,
1232
+ types: filePickerOptionsTypes(accept)
1233
+ };
1234
+ window.showOpenFilePicker(opts).then(function (handles) {
1235
+ return getFilesFromEvent(handles);
1236
+ }).then(function (files) {
1237
+ return setFiles(files, null);
1238
+ }).catch(function (e) {
1239
+ return onFileDialogCancelCb(e);
1240
+ }).finally(function () {
1241
+ return dispatch({
1242
+ type: 'closeDialog'
1243
+ });
1244
+ });
1245
+ return;
1246
+ }
1247
+
1248
+ if (inputRef.current) {
1249
+ dispatch({
1250
+ type: 'openDialog'
1251
+ });
1252
+ onFileDialogOpenCb();
1253
+ inputRef.current.value = null;
1254
+ inputRef.current.click();
1255
+ }
1256
+ }, [dispatch, onFileDialogOpenCb, onFileDialogCancelCb, useFsAccessApi, setFiles, accept, multiple]); // Cb to open the file dialog when SPACE/ENTER occurs on the dropzone
1257
+
1258
+ var onKeyDownCb = React.useCallback(function (event) {
1259
+ // Ignore keyboard events bubbling up the DOM tree
1260
+ if (!rootRef.current || !rootRef.current.isEqualNode(event.target)) {
1261
+ return;
1262
+ }
1263
+
1264
+ if (event.keyCode === 32 || event.keyCode === 13) {
1265
+ event.preventDefault();
1266
+ openFileDialog();
1267
+ }
1268
+ }, [rootRef, inputRef, openFileDialog]); // Update focus state for the dropzone
1269
+
1270
+ var onFocusCb = React.useCallback(function () {
1271
+ dispatch({
1272
+ type: 'focus'
1273
+ });
1274
+ }, []);
1275
+ var onBlurCb = React.useCallback(function () {
1276
+ dispatch({
1277
+ type: 'blur'
1278
+ });
1279
+ }, []); // Cb to open the file dialog when click occurs on the dropzone
1280
+
1281
+ var onClickCb = React.useCallback(function () {
1282
+ if (noClick) {
1283
+ return;
1284
+ } // In IE11/Edge the file-browser dialog is blocking, therefore, use setTimeout()
1285
+ // to ensure React can handle state changes
1286
+ // See: https://github.com/react-dropzone/react-dropzone/issues/450
1287
+
1288
+
1289
+ if (isIeOrEdge()) {
1290
+ setTimeout(openFileDialog, 0);
1291
+ } else {
1292
+ openFileDialog();
1293
+ }
1294
+ }, [inputRef, noClick, openFileDialog]);
1295
+
1296
+ var composeHandler = function composeHandler(fn) {
1297
+ return disabled ? null : fn;
1298
+ };
1299
+
1300
+ var composeKeyboardHandler = function composeKeyboardHandler(fn) {
1301
+ return noKeyboard ? null : composeHandler(fn);
1302
+ };
1303
+
1304
+ var composeDragHandler = function composeDragHandler(fn) {
1305
+ return noDrag ? null : composeHandler(fn);
1306
+ };
1307
+
1308
+ var stopPropagation = function stopPropagation(event) {
1309
+ if (noDragEventsBubbling) {
1310
+ event.stopPropagation();
1311
+ }
1312
+ };
1313
+
1314
+ var getRootProps = React.useMemo(function () {
1315
+ return function () {
1316
+ var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1317
+ _ref2$refKey = _ref2.refKey,
1318
+ refKey = _ref2$refKey === void 0 ? 'ref' : _ref2$refKey,
1319
+ role = _ref2.role,
1320
+ onKeyDown = _ref2.onKeyDown,
1321
+ onFocus = _ref2.onFocus,
1322
+ onBlur = _ref2.onBlur,
1323
+ onClick = _ref2.onClick,
1324
+ onDragEnter = _ref2.onDragEnter,
1325
+ onDragOver = _ref2.onDragOver,
1326
+ onDragLeave = _ref2.onDragLeave,
1327
+ onDrop = _ref2.onDrop,
1328
+ rest = _objectWithoutProperties(_ref2, _excluded3);
1329
+
1330
+ return _objectSpread(_objectSpread(_defineProperty({
1331
+ onKeyDown: composeKeyboardHandler(composeEventHandlers(onKeyDown, onKeyDownCb)),
1332
+ onFocus: composeKeyboardHandler(composeEventHandlers(onFocus, onFocusCb)),
1333
+ onBlur: composeKeyboardHandler(composeEventHandlers(onBlur, onBlurCb)),
1334
+ onClick: composeHandler(composeEventHandlers(onClick, onClickCb)),
1335
+ onDragEnter: composeDragHandler(composeEventHandlers(onDragEnter, onDragEnterCb)),
1336
+ onDragOver: composeDragHandler(composeEventHandlers(onDragOver, onDragOverCb)),
1337
+ onDragLeave: composeDragHandler(composeEventHandlers(onDragLeave, onDragLeaveCb)),
1338
+ onDrop: composeDragHandler(composeEventHandlers(onDrop, onDropCb)),
1339
+ role: typeof role === 'string' && role !== '' ? role : 'button'
1340
+ }, refKey, rootRef), !disabled && !noKeyboard ? {
1341
+ tabIndex: 0
1342
+ } : {}), rest);
1343
+ };
1344
+ }, [rootRef, onKeyDownCb, onFocusCb, onBlurCb, onClickCb, onDragEnterCb, onDragOverCb, onDragLeaveCb, onDropCb, noKeyboard, noDrag, disabled]);
1345
+ var onInputElementClick = React.useCallback(function (event) {
1346
+ event.stopPropagation();
1347
+ }, []);
1348
+ var getInputProps = React.useMemo(function () {
1349
+ return function () {
1350
+ var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1351
+ _ref3$refKey = _ref3.refKey,
1352
+ refKey = _ref3$refKey === void 0 ? 'ref' : _ref3$refKey,
1353
+ onChange = _ref3.onChange,
1354
+ onClick = _ref3.onClick,
1355
+ rest = _objectWithoutProperties(_ref3, _excluded4);
1356
+
1357
+ var inputProps = _defineProperty({
1358
+ accept: accept,
1359
+ multiple: multiple,
1360
+ type: 'file',
1361
+ style: {
1362
+ display: 'none'
1363
+ },
1364
+ onChange: composeHandler(composeEventHandlers(onChange, onDropCb)),
1365
+ onClick: composeHandler(composeEventHandlers(onClick, onInputElementClick)),
1366
+ autoComplete: 'off',
1367
+ tabIndex: -1
1368
+ }, refKey, inputRef);
1369
+
1370
+ return _objectSpread(_objectSpread({}, inputProps), rest);
1371
+ };
1372
+ }, [inputRef, accept, multiple, onDropCb, disabled]);
1373
+ var fileCount = draggedFiles.length;
1374
+ var isDragAccept = fileCount > 0 && allFilesAccepted({
1375
+ files: draggedFiles,
1376
+ accept: accept,
1377
+ minSize: minSize,
1378
+ maxSize: maxSize,
1379
+ multiple: multiple,
1380
+ maxFiles: maxFiles
1381
+ });
1382
+ var isDragReject = fileCount > 0 && !isDragAccept;
1383
+ return _objectSpread(_objectSpread({}, state), {}, {
1384
+ isDragAccept: isDragAccept,
1385
+ isDragReject: isDragReject,
1386
+ isFocused: isFocused && !disabled,
1387
+ getRootProps: getRootProps,
1388
+ getInputProps: getInputProps,
1389
+ rootRef: rootRef,
1390
+ inputRef: inputRef,
1391
+ open: composeHandler(openFileDialog)
1392
+ });
1393
+ }
1394
+
1395
+ function reducer(state, action) {
1396
+ /* istanbul ignore next */
1397
+ switch (action.type) {
1398
+ case 'focus':
1399
+ return _objectSpread(_objectSpread({}, state), {}, {
1400
+ isFocused: true
1401
+ });
1402
+
1403
+ case 'blur':
1404
+ return _objectSpread(_objectSpread({}, state), {}, {
1405
+ isFocused: false
1406
+ });
1407
+
1408
+ case 'openDialog':
1409
+ return _objectSpread(_objectSpread({}, initialState), {}, {
1410
+ isFileDialogActive: true
1411
+ });
1412
+
1413
+ case 'closeDialog':
1414
+ return _objectSpread(_objectSpread({}, state), {}, {
1415
+ isFileDialogActive: false
1416
+ });
1417
+
1418
+ case 'setDraggedFiles':
1419
+ /* eslint no-case-declarations: 0 */
1420
+ var isDragActive = action.isDragActive,
1421
+ draggedFiles = action.draggedFiles;
1422
+ return _objectSpread(_objectSpread({}, state), {}, {
1423
+ draggedFiles: draggedFiles,
1424
+ isDragActive: isDragActive
1425
+ });
1426
+
1427
+ case 'setFiles':
1428
+ return _objectSpread(_objectSpread({}, state), {}, {
1429
+ acceptedFiles: action.acceptedFiles,
1430
+ fileRejections: action.fileRejections
1431
+ });
1432
+
1433
+ case 'reset':
1434
+ return _objectSpread({}, initialState);
1435
+
1436
+ default:
1437
+ return state;
1438
+ }
1439
+ }
1440
+
1441
+ function noop() {}
1442
+
1443
+ var styles = {"dropZoneBase":"grljXfTWj84-","dropZone":"WHhHWgaoXk4-","active":"n1h-T2metRA-","error":"MRRclAp51-w-","validationErrors":"TIbSRNvDK10-"};
1444
+
1445
+ function InputFile({ variation = "dropzone", size = "base", buttonLabel: providedButtonLabel, allowMultiple = false, allowedTypes = "all", getUploadParams, onUploadStart, onUploadProgress, onUploadComplete, onUploadError, validator, }) {
1446
+ const options = {
1447
+ multiple: allowMultiple,
1448
+ onDrop: React.useCallback(handleDrop, [uploadFile]),
1449
+ validator: validator && React.useCallback(validator, []),
1450
+ };
1451
+ if (allowedTypes === "images") {
1452
+ options.accept = "image/*";
1453
+ }
1454
+ else if (allowedTypes === "basicImages") {
1455
+ options.accept = "image/png, image/jpg, image/jpeg";
1456
+ }
1457
+ else if (Array.isArray(allowedTypes)) {
1458
+ options.accept = allowedTypes.join(",");
1459
+ }
1460
+ const { getRootProps, getInputProps, isDragActive, fileRejections } = useDropzone(options);
1461
+ const validationErrors = fileRejections === null || fileRejections === void 0 ? void 0 : fileRejections.map(({ file, errors }) => {
1462
+ return errors.map(error => {
1463
+ return (React.createElement(InputValidation.InputValidation, { message: `${file.name} ${error.message}`, key: `${file.name}${error.code}` }));
1464
+ });
1465
+ });
1466
+ const { buttonLabel, hintText } = getLabels(providedButtonLabel, allowMultiple, allowedTypes);
1467
+ const dropZone = classnames(styles.dropZoneBase, {
1468
+ [styles.dropZone]: variation === "dropzone",
1469
+ [styles.active]: isDragActive,
1470
+ [styles.error]: (fileRejections === null || fileRejections === void 0 ? void 0 : fileRejections.length) > 0,
1471
+ });
1472
+ return (React.createElement(React.Fragment, null,
1473
+ React.createElement("div", Object.assign({}, getRootProps({ className: dropZone }), { tabIndex: variation === "button" ? -1 : 0 }),
1474
+ React.createElement("input", Object.assign({}, getInputProps())),
1475
+ variation === "dropzone" && (React.createElement(Content.Content, { spacing: "small" },
1476
+ React.createElement(Button.Button, { label: buttonLabel, size: "small", type: "secondary" }),
1477
+ size === "base" && (React.createElement(Typography.Typography, { size: "small", textColor: "textSecondary" }, hintText)))),
1478
+ variation === "button" && (React.createElement(Button.Button, { label: buttonLabel, size: size, type: "secondary", fullWidth: true }))),
1479
+ (fileRejections === null || fileRejections === void 0 ? void 0 : fileRejections.length) > 0 && (React.createElement("div", { className: styles.validationErrors }, validationErrors))));
1480
+ function handleDrop(acceptedFiles) {
1481
+ acceptedFiles.forEach(file => {
1482
+ uploadFile(file);
1483
+ });
1484
+ }
1485
+ function uploadFile(file) {
1486
+ return tslib_es6.__awaiter(this, void 0, void 0, function* () {
1487
+ let params;
1488
+ try {
1489
+ params = yield getUploadParams(file);
1490
+ }
1491
+ catch (_a) {
1492
+ onUploadError && onUploadError(new Error("Failed to get upload params"));
1493
+ return;
1494
+ }
1495
+ const { url, key = generateId(), fields = {}, httpMethod = "POST", } = params;
1496
+ const fileUpload = getFileUpload(file, key, url);
1497
+ onUploadStart && onUploadStart(Object.assign({}, fileUpload));
1498
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1499
+ const handleUploadProgress = (progressEvent) => {
1500
+ onUploadProgress &&
1501
+ onUploadProgress(Object.assign(Object.assign({}, fileUpload), { progress: progressEvent.loaded / progressEvent.total }));
1502
+ };
1503
+ const handleUploadComplete = () => {
1504
+ onUploadComplete === null || onUploadComplete === void 0 ? void 0 : onUploadComplete(Object.assign(Object.assign({}, fileUpload), { progress: 1 }));
1505
+ };
1506
+ const axiosConfig = createAxiosConfig({
1507
+ url,
1508
+ httpMethod,
1509
+ fields,
1510
+ file,
1511
+ handleUploadProgress,
1512
+ });
1513
+ axios
1514
+ .request(axiosConfig)
1515
+ .then(handleUploadComplete)
1516
+ .catch(() => {
1517
+ onUploadError && onUploadError(new Error("Failed to upload file"));
1518
+ });
1519
+ });
1520
+ }
1521
+ }
1522
+ function createAxiosConfig({ url, httpMethod = "POST", fields = {}, file, handleUploadProgress, }) {
1523
+ let data;
1524
+ let headers;
1525
+ if (httpMethod === "POST") {
1526
+ const formData = new FormData();
1527
+ Object.entries(fields).forEach(([field, value]) => formData.append(field, value));
1528
+ formData.append("file", file);
1529
+ data = formData;
1530
+ headers = { "X-Requested-With": "XMLHttpRequest" };
1531
+ }
1532
+ else {
1533
+ data = file;
1534
+ headers = fields;
1535
+ }
1536
+ return {
1537
+ method: httpMethod,
1538
+ url: url,
1539
+ headers: headers,
1540
+ data: data,
1541
+ onUploadProgress: handleUploadProgress,
1542
+ };
1543
+ }
1544
+ function getLabels(providedButtonLabel, multiple, allowedTypes) {
1545
+ let buttonLabel = multiple ? "Upload Files" : "Upload File";
1546
+ let hintText = multiple
1547
+ ? "or drag files here to upload"
1548
+ : "or drag a file here to upload";
1549
+ if (allowedTypes === "images" || allowedTypes === "basicImages") {
1550
+ buttonLabel = multiple ? "Upload Images" : "Upload Image";
1551
+ hintText = multiple
1552
+ ? "or drag images here to upload"
1553
+ : "or drag an image here to upload";
1554
+ }
1555
+ if (providedButtonLabel)
1556
+ buttonLabel = providedButtonLabel;
1557
+ return { buttonLabel, hintText };
1558
+ }
1559
+ function getFileUpload(file, key, uploadUrl) {
1560
+ return {
1561
+ key: key,
1562
+ name: file.name,
1563
+ type: file.type,
1564
+ size: file.size,
1565
+ progress: 0,
1566
+ src: getSrc,
1567
+ uploadUrl,
1568
+ };
1569
+ function getSrc() {
1570
+ const promise = new Promise((resolve, reject) => {
1571
+ const reader = new FileReader();
1572
+ reader.onload = event => {
1573
+ if (event.target &&
1574
+ event.target.result &&
1575
+ typeof event.target.result === "string") {
1576
+ resolve(event.target.result);
1577
+ }
1578
+ else {
1579
+ reject("Could not generate file data url.");
1580
+ }
1581
+ };
1582
+ reader.readAsDataURL(file);
1583
+ });
1584
+ return promise;
1585
+ }
1586
+ }
1587
+ /**
1588
+ * Upsert a given `FileUpload` into an array of `FileUpload`s.
1589
+ * `key` is used to uniquely identify files.
1590
+ *
1591
+ * @param updatedFile FileUpload File that was updated.
1592
+ * @param files Existing array of FileUploads.
1593
+ * @returns FileUpload[] updated set of files.
1594
+ */
1595
+ function updateFiles(updatedFile, files) {
1596
+ const newFiles = [...files];
1597
+ const index = files.findIndex(file => file.key === updatedFile.key);
1598
+ if (index !== -1) {
1599
+ newFiles[index] = updatedFile;
1600
+ }
1601
+ else {
1602
+ newFiles.push(updatedFile);
1603
+ }
1604
+ return newFiles;
1605
+ }
1606
+ function generateId() {
1607
+ return Math.floor(Math.random() * Date.now()).toString(16);
1608
+ }
1609
+
1610
+ exports.InputFile = InputFile;
1611
+ exports.updateFiles = updateFiles;