@jobber/components 4.90.5 → 4.90.6

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.cjs → index.js} +3 -1
  2. package/dist/{AnimatedPresence-BWePg1sL.js → AnimatedPresence-20a02aaa.js} +7 -3
  3. package/dist/AnimatedSwitcher/index.js +13 -0
  4. package/dist/{AnimatedSwitcher-D_Qj_hx5.js → AnimatedSwitcher-3d45ec5d.js} +8 -4
  5. package/dist/AtlantisContext/{index.cjs → index.js} +3 -1
  6. package/dist/Autocomplete/index.js +214 -0
  7. package/dist/Avatar/index.js +15 -0
  8. package/dist/Avatar-76a799fa.js +78 -0
  9. package/dist/Banner/index.js +111 -0
  10. package/dist/Button/index.js +16 -0
  11. package/dist/Button-6b922fc1.js +57 -0
  12. package/dist/ButtonDismiss/index.js +17 -0
  13. package/dist/ButtonDismiss-a3ba1de2.js +14 -0
  14. package/dist/Card/index.js +24 -0
  15. package/dist/Card-01d6ba19.js +93 -0
  16. package/dist/Checkbox/index.js +18 -0
  17. package/dist/Checkbox-e481a4b1.js +63 -0
  18. package/dist/Chip/index.js +42 -0
  19. package/dist/Chip-76f18555.js +89 -0
  20. package/dist/Chips/index.js +525 -0
  21. package/dist/Combobox/index.js +41 -0
  22. package/dist/Combobox-6d864202.js +481 -0
  23. package/dist/ConfirmationModal/index.js +32 -0
  24. package/dist/{ConfirmationModal-AtuPSZb4.js → ConfirmationModal-b44e302f.js} +12 -8
  25. package/dist/Content/index.js +12 -0
  26. package/dist/Content-e3f7b6fc.js +24 -0
  27. package/dist/Countdown/index.js +72 -0
  28. package/dist/DataDump/index.js +37 -0
  29. package/dist/DataList/index.js +1346 -0
  30. package/dist/DataTable/index.js +301 -0
  31. package/dist/DatePicker/index.js +21 -0
  32. package/dist/DatePicker-305a5b82.js +144 -0
  33. package/dist/DescriptionList/index.js +24 -0
  34. package/dist/Disclosure/index.js +46 -0
  35. package/dist/Divider/index.js +29 -0
  36. package/dist/Drawer/index.js +50 -0
  37. package/dist/Emphasis/index.js +13 -0
  38. package/dist/Emphasis-a77d8ee9.js +19 -0
  39. package/dist/FeatureSwitch/index.js +71 -0
  40. package/dist/Flex/index.js +12 -0
  41. package/dist/Flex-d490c4db.js +38 -0
  42. package/dist/{Form-5myjIaNx.js → Form/index.js} +9 -3
  43. package/dist/FormField/index.js +24 -0
  44. package/dist/FormField-f6fadff2.js +253 -0
  45. package/dist/FormatDate/{index.cjs → index.js} +3 -1
  46. package/dist/{FormatDate-CcycFjAL.js → FormatDate-70ea5b43.js} +5 -1
  47. package/dist/FormatEmail/index.js +23 -0
  48. package/dist/FormatFile/index.js +37 -0
  49. package/dist/FormatFile-32228107.js +162 -0
  50. package/dist/{FormatRelativeDateTime-hdrEQWhy.js → FormatRelativeDateTime/index.js} +11 -5
  51. package/dist/{FormatTime-DrHluWW3.js → FormatTime/index.js} +7 -1
  52. package/dist/Gallery/index.js +101 -0
  53. package/dist/Glimmer/index.js +15 -0
  54. package/dist/Glimmer-84dee1ed.js +77 -0
  55. package/dist/Grid/index.js +76 -0
  56. package/dist/Heading/index.js +15 -0
  57. package/dist/{Heading-Y2BrFvzY.js → Heading-23d382a1.js} +7 -3
  58. package/dist/Icon/index.js +11 -0
  59. package/dist/Icon-405a216c.js +40 -0
  60. package/dist/InlineLabel/index.js +13 -0
  61. package/dist/InlineLabel-c8fc28f0.js +28 -0
  62. package/dist/InputAvatar/index.js +70 -0
  63. package/dist/{InputDate-kNxwMqkc.js → InputDate/index.js} +31 -6
  64. package/dist/InputEmail/index.js +43 -0
  65. package/dist/InputFile/index.js +25 -0
  66. package/dist/InputFile-20b9074a.js +190 -0
  67. package/dist/InputGroup/index.js +12 -0
  68. package/dist/InputGroup-8d4fd4eb.js +33 -0
  69. package/dist/InputNumber/index.js +25 -0
  70. package/dist/{InputNumber-CW4ttUb0.js → InputNumber-e15cc1a3.js} +6 -2
  71. package/dist/InputPassword/index.js +41 -0
  72. package/dist/{InputPhoneNumber-DHO2lp-T.js → InputPhoneNumber/index.js} +27 -7
  73. package/dist/InputText/index.js +26 -0
  74. package/dist/{InputText-C_iZe7xf.js → InputText-130b0440.js} +8 -4
  75. package/dist/{InputTime-DemVybcJ.js → InputTime/index.js} +25 -5
  76. package/dist/InputValidation/index.js +17 -0
  77. package/dist/InputValidation-a92bb519.js +29 -0
  78. package/dist/LightBox/index.js +25 -0
  79. package/dist/LightBox-7efe8932.js +121 -0
  80. package/dist/Link/index.js +15 -0
  81. package/dist/List/index.js +94 -0
  82. package/dist/Markdown/index.js +20 -0
  83. package/dist/Markdown-0f24de70.js +62 -0
  84. package/dist/Menu/index.js +21 -0
  85. package/dist/Menu-d6dd673e.js +139 -0
  86. package/dist/Modal/index.js +26 -0
  87. package/dist/Modal-067becad.js +73 -0
  88. package/dist/MultiSelect/index.js +182 -0
  89. package/dist/Option-a1dbc08a.js +19 -0
  90. package/dist/Page/index.js +78 -0
  91. package/dist/Popover/index.js +65 -0
  92. package/dist/ProgressBar/index.js +12 -0
  93. package/dist/ProgressBar-b68edc8f.js +43 -0
  94. package/dist/RadioGroup/index.js +15 -0
  95. package/dist/RadioGroup-678f4932.js +46 -0
  96. package/dist/RecurringSelect/index.js +227 -0
  97. package/dist/Select/index.js +26 -0
  98. package/dist/Spinner/index.js +12 -0
  99. package/dist/Spinner-9d8fc7ff.js +24 -0
  100. package/dist/StatusIndicator/index.js +11 -0
  101. package/dist/StatusIndicator-7b5258ea.js +18 -0
  102. package/dist/StatusLabel/index.js +28 -0
  103. package/dist/Switch/index.js +13 -0
  104. package/dist/Switch-eac89586.js +56 -0
  105. package/dist/Table/index.js +66 -0
  106. package/dist/Tabs/index.js +80 -0
  107. package/dist/Text/index.js +13 -0
  108. package/dist/{Text-BKFV1Z0j.js → Text-fbeaaca6.js} +6 -2
  109. package/dist/Toast/index.js +111 -0
  110. package/dist/Tooltip/index.js +17 -0
  111. package/dist/Tooltip-b9de6e57.js +114 -0
  112. package/dist/Typography/index.js +12 -0
  113. package/dist/Typography-e2a23b7e.js +62 -0
  114. package/dist/style-inject.es-9d2f5f4e.js +30 -0
  115. package/dist/tslib.es6-754e2961.js +46 -0
  116. package/dist/{useAtlantisConfig-Ckfr55qY.js → useAtlantisConfig-ed0bee66.js} +2 -2
  117. package/package.json +8 -394
  118. package/{rollup.config.mjs → rollup.config.js} +17 -50
  119. package/dist/AnimatedPresence/index.mjs +0 -4
  120. package/dist/AnimatedPresence-CzXm0q2a.js +0 -98
  121. package/dist/AnimatedSwitcher/index.cjs +0 -11
  122. package/dist/AnimatedSwitcher/index.mjs +0 -5
  123. package/dist/AnimatedSwitcher--j45gdP1.js +0 -90
  124. package/dist/AtlantisContext/index.mjs +0 -2
  125. package/dist/AtlantisContext-B0Zo5l8l.js +0 -18
  126. package/dist/Autocomplete/index.cjs +0 -33
  127. package/dist/Autocomplete/index.mjs +0 -27
  128. package/dist/Autocomplete-DQ9t1vLy.js +0 -190
  129. package/dist/Autocomplete-W9xb3p2A.js +0 -192
  130. package/dist/Avatar/index.cjs +0 -12
  131. package/dist/Avatar/index.mjs +0 -6
  132. package/dist/Avatar-BPd8t6BU.js +0 -67
  133. package/dist/Avatar-DTFS2kFm.js +0 -69
  134. package/dist/Banner/components/BannerIcon/index.cjs +0 -13
  135. package/dist/Banner/components/BannerIcon/index.mjs +0 -7
  136. package/dist/Banner/index.cjs +0 -23
  137. package/dist/Banner/index.mjs +0 -17
  138. package/dist/Banner-Dpwk3NK9.js +0 -79
  139. package/dist/Banner-DzeDUJLs.js +0 -81
  140. package/dist/BannerIcon-Co45J70u.js +0 -19
  141. package/dist/BannerIcon-CzBZbMVi.js +0 -22
  142. package/dist/Body-4eoS-dUC.js +0 -45
  143. package/dist/Body-CwY_QyVF.js +0 -54
  144. package/dist/Button/index.cjs +0 -13
  145. package/dist/Button/index.mjs +0 -7
  146. package/dist/Button-BH4Hhr2S.js +0 -47
  147. package/dist/Button-BPYGeGx2.js +0 -49
  148. package/dist/ButtonDismiss/index.cjs +0 -14
  149. package/dist/ButtonDismiss/index.mjs +0 -8
  150. package/dist/ButtonDismiss-BajTLHia.js +0 -10
  151. package/dist/ButtonDismiss-Dwe1QljB.js +0 -8
  152. package/dist/Card/index.cjs +0 -21
  153. package/dist/Card/index.mjs +0 -15
  154. package/dist/Card-DG7RIZdT.js +0 -83
  155. package/dist/Card-DWjfc534.js +0 -81
  156. package/dist/Checkbox/index.cjs +0 -15
  157. package/dist/Checkbox/index.mjs +0 -9
  158. package/dist/Checkbox-BDVwj5E8.js +0 -53
  159. package/dist/Checkbox-DDDvFfUJ.js +0 -55
  160. package/dist/Chip/hooks/index.cjs +0 -8
  161. package/dist/Chip/hooks/index.mjs +0 -2
  162. package/dist/Chip/index.cjs +0 -26
  163. package/dist/Chip/index.mjs +0 -18
  164. package/dist/Chip-Br7-JkgN.js +0 -70
  165. package/dist/Chip-CGMUQ-V-.js +0 -67
  166. package/dist/ChipDismissible-DETPCXth.js +0 -19
  167. package/dist/ChipDismissible-DyMHTSQ9.js +0 -22
  168. package/dist/Chips/InternalChipDismissible/hooks/index.cjs +0 -23
  169. package/dist/Chips/InternalChipDismissible/hooks/index.mjs +0 -13
  170. package/dist/Chips/InternalChipDismissible/index.cjs +0 -35
  171. package/dist/Chips/InternalChipDismissible/index.mjs +0 -29
  172. package/dist/Chips/index.cjs +0 -48
  173. package/dist/Chips/index.mjs +0 -44
  174. package/dist/Chips-B1RCrN1F.js +0 -93
  175. package/dist/Chips-DXbRgMUE.js +0 -91
  176. package/dist/Combobox/components/ComboboxAction/index.cjs +0 -12
  177. package/dist/Combobox/components/ComboboxAction/index.mjs +0 -6
  178. package/dist/Combobox/components/ComboboxActivator/index.cjs +0 -27
  179. package/dist/Combobox/components/ComboboxActivator/index.mjs +0 -21
  180. package/dist/Combobox/components/ComboboxContent/ComboboxContentHeader/index.cjs +0 -14
  181. package/dist/Combobox/components/ComboboxContent/ComboboxContentHeader/index.mjs +0 -8
  182. package/dist/Combobox/components/ComboboxContent/ComboboxContentList/index.cjs +0 -24
  183. package/dist/Combobox/components/ComboboxContent/ComboboxContentList/index.mjs +0 -18
  184. package/dist/Combobox/components/ComboboxContent/ComboboxContentSearch/index.cjs +0 -10
  185. package/dist/Combobox/components/ComboboxContent/ComboboxContentSearch/index.mjs +0 -4
  186. package/dist/Combobox/components/ComboboxContent/ComboboxLoadMore/index.cjs +0 -9
  187. package/dist/Combobox/components/ComboboxContent/ComboboxLoadMore/index.mjs +0 -3
  188. package/dist/Combobox/components/ComboboxContent/index.cjs +0 -34
  189. package/dist/Combobox/components/ComboboxContent/index.mjs +0 -28
  190. package/dist/Combobox/components/ComboboxOption/index.cjs +0 -14
  191. package/dist/Combobox/components/ComboboxOption/index.mjs +0 -8
  192. package/dist/Combobox/components/ComboboxTrigger/index.cjs +0 -25
  193. package/dist/Combobox/components/ComboboxTrigger/index.mjs +0 -19
  194. package/dist/Combobox/index.cjs +0 -53
  195. package/dist/Combobox/index.mjs +0 -46
  196. package/dist/Combobox-D0Qo3yYu.js +0 -117
  197. package/dist/Combobox-DxPzrwcK.js +0 -119
  198. package/dist/ComboboxAction-Ct0ao84E.js +0 -24
  199. package/dist/ComboboxAction-I7TT2mVE.js +0 -22
  200. package/dist/ComboboxActivator-BOGk012k.js +0 -26
  201. package/dist/ComboboxActivator-uU5VaZqF.js +0 -28
  202. package/dist/ComboboxContent-miRfjhNV.js +0 -145
  203. package/dist/ComboboxContent-u1C3PXKH.js +0 -143
  204. package/dist/ComboboxContentHeader-BF43vAXl.js +0 -27
  205. package/dist/ComboboxContentHeader-Cirx9k9L.js +0 -29
  206. package/dist/ComboboxContentList-DFv7m0NQ.js +0 -77
  207. package/dist/ComboboxContentList-nxCsc_XU.js +0 -75
  208. package/dist/ComboboxContentSearch-C2RHQNXR.js +0 -34
  209. package/dist/ComboboxContentSearch-DX-BiYTa.js +0 -32
  210. package/dist/ComboboxLoadMore-CUK0n3WY.js +0 -16
  211. package/dist/ComboboxLoadMore-t_s_eVDp.js +0 -14
  212. package/dist/ComboboxOption-BMg1O_Br.js +0 -20
  213. package/dist/ComboboxOption-DSzlMoup.js +0 -22
  214. package/dist/ComboboxProvider-GdvooWYJ.js +0 -10
  215. package/dist/ComboboxProvider-ku2HdEkO.js +0 -13
  216. package/dist/ComboboxTrigger-1KuifQvl.js +0 -24
  217. package/dist/ComboboxTrigger-CvcB6ptJ.js +0 -22
  218. package/dist/ConfirmationModal/index.cjs +0 -31
  219. package/dist/ConfirmationModal/index.mjs +0 -25
  220. package/dist/ConfirmationModal-DrQ-Nm1m.js +0 -94
  221. package/dist/Content/index.cjs +0 -9
  222. package/dist/Content/index.mjs +0 -3
  223. package/dist/Content-CobtdYug.js +0 -13
  224. package/dist/Content-D5eJgx6J.js +0 -15
  225. package/dist/Countdown/index.cjs +0 -11
  226. package/dist/Countdown/index.mjs +0 -5
  227. package/dist/Countdown-CXuL7Gh7.js +0 -659
  228. package/dist/Countdown-CnIjUABD.js +0 -657
  229. package/dist/DataDump/index.cjs +0 -24
  230. package/dist/DataDump/index.mjs +0 -18
  231. package/dist/DataDump-CXh_x55J.js +0 -15
  232. package/dist/DataDump-R0kwoLVp.js +0 -17
  233. package/dist/DataList/components/DataListAction/index.cjs +0 -13
  234. package/dist/DataList/components/DataListAction/index.mjs +0 -7
  235. package/dist/DataList/components/DataListActions/index.cjs +0 -43
  236. package/dist/DataList/components/DataListActions/index.mjs +0 -37
  237. package/dist/DataList/components/DataListActionsMenu/index.cjs +0 -17
  238. package/dist/DataList/components/DataListActionsMenu/index.mjs +0 -11
  239. package/dist/DataList/components/DataListBulkActions/index.cjs +0 -46
  240. package/dist/DataList/components/DataListBulkActions/index.mjs +0 -39
  241. package/dist/DataList/components/DataListEmptyState/index.cjs +0 -20
  242. package/dist/DataList/components/DataListEmptyState/index.mjs +0 -13
  243. package/dist/DataList/components/DataListFilters/components/DataListSort/index.cjs +0 -54
  244. package/dist/DataList/components/DataListFilters/components/DataListSort/index.mjs +0 -48
  245. package/dist/DataList/components/DataListFilters/index.cjs +0 -68
  246. package/dist/DataList/components/DataListFilters/index.mjs +0 -61
  247. package/dist/DataList/components/DataListHeader/index.cjs +0 -53
  248. package/dist/DataList/components/DataListHeader/index.mjs +0 -47
  249. package/dist/DataList/components/DataListHeaderTile/components/index.cjs +0 -12
  250. package/dist/DataList/components/DataListHeaderTile/components/index.mjs +0 -6
  251. package/dist/DataList/components/DataListHeaderTile/index.cjs +0 -20
  252. package/dist/DataList/components/DataListHeaderTile/index.mjs +0 -14
  253. package/dist/DataList/components/DataListItem/components/DataListItemClickable/index.cjs +0 -14
  254. package/dist/DataList/components/DataListItem/components/DataListItemClickable/index.mjs +0 -8
  255. package/dist/DataList/components/DataListItem/index.cjs +0 -52
  256. package/dist/DataList/components/DataListItem/index.mjs +0 -46
  257. package/dist/DataList/components/DataListItemActions/index.cjs +0 -45
  258. package/dist/DataList/components/DataListItemActions/index.mjs +0 -38
  259. package/dist/DataList/components/DataListItemActionsOverflow/index.cjs +0 -25
  260. package/dist/DataList/components/DataListItemActionsOverflow/index.mjs +0 -19
  261. package/dist/DataList/components/DataListItems/index.cjs +0 -53
  262. package/dist/DataList/components/DataListItems/index.mjs +0 -47
  263. package/dist/DataList/components/DataListLayout/index.cjs +0 -56
  264. package/dist/DataList/components/DataListLayout/index.mjs +0 -50
  265. package/dist/DataList/components/DataListLayoutActions/DataListLayoutContext/index.cjs +0 -9
  266. package/dist/DataList/components/DataListLayoutActions/DataListLayoutContext/index.mjs +0 -2
  267. package/dist/DataList/components/DataListLayoutActions/index.cjs +0 -33
  268. package/dist/DataList/components/DataListLayoutActions/index.mjs +0 -27
  269. package/dist/DataList/components/DataListLoadMore/index.cjs +0 -21
  270. package/dist/DataList/components/DataListLoadMore/index.mjs +0 -14
  271. package/dist/DataList/components/DataListLoadingState/index.cjs +0 -21
  272. package/dist/DataList/components/DataListLoadingState/index.mjs +0 -13
  273. package/dist/DataList/components/DataListOverflowFade/index.cjs +0 -11
  274. package/dist/DataList/components/DataListOverflowFade/index.mjs +0 -4
  275. package/dist/DataList/components/DataListSearch/index.cjs +0 -33
  276. package/dist/DataList/components/DataListSearch/index.mjs +0 -25
  277. package/dist/DataList/components/DataListStatusBar/index.cjs +0 -32
  278. package/dist/DataList/components/DataListStatusBar/index.mjs +0 -25
  279. package/dist/DataList/components/DataListStickyHeader/index.cjs +0 -11
  280. package/dist/DataList/components/DataListStickyHeader/index.mjs +0 -5
  281. package/dist/DataList/components/DataListTags/index.cjs +0 -12
  282. package/dist/DataList/components/DataListTags/index.mjs +0 -6
  283. package/dist/DataList/components/DataListTotalCount/index.cjs +0 -15
  284. package/dist/DataList/components/DataListTotalCount/index.mjs +0 -8
  285. package/dist/DataList/context/DataListContext/index.cjs +0 -12
  286. package/dist/DataList/context/DataListContext/index.mjs +0 -4
  287. package/dist/DataList/context/DataListLayoutContext/index.cjs +0 -12
  288. package/dist/DataList/context/DataListLayoutContext/index.mjs +0 -4
  289. package/dist/DataList/index.cjs +0 -98
  290. package/dist/DataList/index.mjs +0 -92
  291. package/dist/DataList-BRPBlIVp.js +0 -3
  292. package/dist/DataList-C_diEjjb.js +0 -5
  293. package/dist/DataList-DyUX97mL.js +0 -141
  294. package/dist/DataList-DzXNiSs1.js +0 -139
  295. package/dist/DataList.const-Bqcfo3vs.js +0 -38
  296. package/dist/DataList.const-z084v3KH.js +0 -25
  297. package/dist/DataList.utils-BjG-otvz.js +0 -168
  298. package/dist/DataList.utils-RcG6TvB4.js +0 -161
  299. package/dist/DataListAction-3U8gJcpE.js +0 -37
  300. package/dist/DataListAction-BN0qp_ae.js +0 -39
  301. package/dist/DataListActions-D1r_3WQD.js +0 -43
  302. package/dist/DataListActions-DV-03b5h.js +0 -45
  303. package/dist/DataListActionsMenu-Cg-ZZ0LI.js +0 -55
  304. package/dist/DataListActionsMenu-D9iOGk3i.js +0 -57
  305. package/dist/DataListBulkActions-BEFyOkWd.js +0 -29
  306. package/dist/DataListBulkActions-C2E5e2oE.js +0 -26
  307. package/dist/DataListContext-DTtBXteA.js +0 -25
  308. package/dist/DataListContext-qFN5DiHI.js +0 -29
  309. package/dist/DataListEmptyState-DTsqkHng.js +0 -50
  310. package/dist/DataListEmptyState-DfaWzs71.js +0 -53
  311. package/dist/DataListFilters-35MxtHUo.js +0 -43
  312. package/dist/DataListFilters-BjC9kPSD.js +0 -46
  313. package/dist/DataListHeader-CI-p6m7K.js +0 -93
  314. package/dist/DataListHeader-D5iNjhk1.js +0 -95
  315. package/dist/DataListHeaderTile-DwHOJPOJ.js +0 -81
  316. package/dist/DataListHeaderTile-K_UG9NgG.js +0 -79
  317. package/dist/DataListItem-BpD1kRWd.js +0 -112
  318. package/dist/DataListItem-CK9nQ-II.js +0 -114
  319. package/dist/DataListItemActions-B7Pbbv7U.js +0 -29
  320. package/dist/DataListItemActions-DDdszYpl.js +0 -32
  321. package/dist/DataListItemActionsOverflow-CmBtR4CV.js +0 -33
  322. package/dist/DataListItemActionsOverflow-D83sgU_z.js +0 -35
  323. package/dist/DataListItemClickable-BBVDmF_w.js +0 -45
  324. package/dist/DataListItemClickable-DluGOyKl.js +0 -47
  325. package/dist/DataListItems-DHSJSPeG.js +0 -21
  326. package/dist/DataListItems-hAiXRicl.js +0 -19
  327. package/dist/DataListLayout-CVVR8T7f.js +0 -21
  328. package/dist/DataListLayout-CiKR3P98.js +0 -19
  329. package/dist/DataListLayoutActions-BiR49Hjb.js +0 -36
  330. package/dist/DataListLayoutActions-CUWi8Fxy.js +0 -38
  331. package/dist/DataListLayoutContext-B3szPGTf.js +0 -8
  332. package/dist/DataListLayoutContext-CjAT05BI.js +0 -11
  333. package/dist/DataListLayoutContext-lF5Zk-jV.js +0 -18
  334. package/dist/DataListLayoutContext-p48sRC9i.js +0 -14
  335. package/dist/DataListLoadMore-CixukWAA.js +0 -31
  336. package/dist/DataListLoadMore-Cu32AbMo.js +0 -34
  337. package/dist/DataListLoadingState-CBsAzSFk.js +0 -22
  338. package/dist/DataListLoadingState-DFRSjdMI.js +0 -26
  339. package/dist/DataListOverflowFade-BGAt4dqm.js +0 -25
  340. package/dist/DataListOverflowFade-DU0y9j-T.js +0 -22
  341. package/dist/DataListSearch-C1PpW3kQ.js +0 -59
  342. package/dist/DataListSearch-uEaN0YJ7.js +0 -63
  343. package/dist/DataListSort-BrRFvXG5.js +0 -92
  344. package/dist/DataListSort-Dx6POURf.js +0 -94
  345. package/dist/DataListSortingOptions-BndDkYtw.js +0 -37
  346. package/dist/DataListSortingOptions-wYjmZSp4.js +0 -35
  347. package/dist/DataListStatusBar-B_NpGiAA.js +0 -22
  348. package/dist/DataListStatusBar-VdGpFaWQ.js +0 -25
  349. package/dist/DataListStickyHeader-CScdFohW.js +0 -25
  350. package/dist/DataListStickyHeader-YssmrZlM.js +0 -23
  351. package/dist/DataListTags-B4e8t5VV.js +0 -62
  352. package/dist/DataListTags-xHDVW7r1.js +0 -64
  353. package/dist/DataListTotalCount-FvMJCJV4.js +0 -27
  354. package/dist/DataListTotalCount-TVna906A.js +0 -24
  355. package/dist/DataTable/index.cjs +0 -36
  356. package/dist/DataTable/index.mjs +0 -25
  357. package/dist/DataTable/test-utilities/index.cjs +0 -246
  358. package/dist/DataTable/test-utilities/index.mjs +0 -238
  359. package/dist/DataTable-BhmuLCau.js +0 -236
  360. package/dist/DataTable-DRXABYeP.js +0 -238
  361. package/dist/DatePicker/index.cjs +0 -26
  362. package/dist/DatePicker/index.mjs +0 -20
  363. package/dist/DatePicker-BzXdyAsQ.js +0 -8554
  364. package/dist/DatePicker-CZnbHBrf.js +0 -8551
  365. package/dist/DayOfMonthSelect-GTME6B8V.js +0 -130
  366. package/dist/DayOfMonthSelect-Rxeaskdx.js +0 -137
  367. package/dist/DescriptionList/index.cjs +0 -10
  368. package/dist/DescriptionList/index.mjs +0 -4
  369. package/dist/DescriptionList-CMHhotQz.js +0 -12
  370. package/dist/DescriptionList-D4V2AGoH.js +0 -14
  371. package/dist/Disclosure/index.cjs +0 -17
  372. package/dist/Disclosure/index.mjs +0 -11
  373. package/dist/Disclosure-B_Ndy93n.js +0 -33
  374. package/dist/Disclosure-iwknokMb.js +0 -35
  375. package/dist/Divider/index.cjs +0 -9
  376. package/dist/Divider/index.mjs +0 -3
  377. package/dist/Divider-CQwVNie1.js +0 -17
  378. package/dist/Divider-aDM-8IiX.js +0 -19
  379. package/dist/Drawer/index.cjs +0 -19
  380. package/dist/Drawer/index.mjs +0 -12
  381. package/dist/DrawerGrid-Cy6jFIEj.js +0 -28
  382. package/dist/DrawerGrid-D-xjQAGo.js +0 -31
  383. package/dist/Emphasis/index.cjs +0 -10
  384. package/dist/Emphasis/index.mjs +0 -4
  385. package/dist/Emphasis-DIJAlzt-.js +0 -13
  386. package/dist/Emphasis-ZgoNe2R5.js +0 -15
  387. package/dist/FeatureSwitch/index.cjs +0 -26
  388. package/dist/FeatureSwitch/index.mjs +0 -20
  389. package/dist/FeatureSwitch-BKO31OVK.js +0 -52
  390. package/dist/FeatureSwitch-C4S0awPY.js +0 -54
  391. package/dist/Flex/index.cjs +0 -9
  392. package/dist/Flex/index.mjs +0 -3
  393. package/dist/Flex-Bfl-vL64.js +0 -28
  394. package/dist/Flex-Dh0WNozY.js +0 -30
  395. package/dist/Form/index.cjs +0 -10
  396. package/dist/Form/index.mjs +0 -4
  397. package/dist/Form-fdEPa2Di.js +0 -48
  398. package/dist/FormField/index.cjs +0 -20
  399. package/dist/FormField/index.mjs +0 -14
  400. package/dist/FormField-DY5JDjdc.js +0 -261
  401. package/dist/FormField-RMjW742D.js +0 -263
  402. package/dist/FormatDate/index.mjs +0 -2
  403. package/dist/FormatDate-YUbeta27.js +0 -27
  404. package/dist/FormatEmail/index.cjs +0 -9
  405. package/dist/FormatEmail/index.mjs +0 -3
  406. package/dist/FormatEmail-B7cAlIQY.js +0 -11
  407. package/dist/FormatEmail-DJLlhpQr.js +0 -13
  408. package/dist/FormatFile/index.cjs +0 -36
  409. package/dist/FormatFile/index.mjs +0 -30
  410. package/dist/FormatFile-BAZqq1p8.js +0 -149
  411. package/dist/FormatFile-CRPcqK86.js +0 -147
  412. package/dist/FormatRelativeDateTime/index.cjs +0 -8
  413. package/dist/FormatRelativeDateTime/index.mjs +0 -2
  414. package/dist/FormatRelativeDateTime-Ca1DyZ7Z.js +0 -64
  415. package/dist/FormatTime/index.cjs +0 -8
  416. package/dist/FormatTime/index.mjs +0 -2
  417. package/dist/FormatTime-DcIV5E6n.js +0 -29
  418. package/dist/Gallery/index.cjs +0 -42
  419. package/dist/Gallery/index.mjs +0 -36
  420. package/dist/Gallery-D9AVJQTM.js +0 -65
  421. package/dist/Gallery-Duiow0xg.js +0 -63
  422. package/dist/Glimmer/index.cjs +0 -12
  423. package/dist/Glimmer/index.mjs +0 -5
  424. package/dist/Glimmer-CG9tFCHs.js +0 -63
  425. package/dist/Glimmer-IWgpoHGI.js +0 -60
  426. package/dist/Grid/InternalGridCell/index.cjs +0 -9
  427. package/dist/Grid/InternalGridCell/index.mjs +0 -2
  428. package/dist/Grid/index.cjs +0 -14
  429. package/dist/Grid/index.mjs +0 -7
  430. package/dist/Grid-DzRYkCwi.js +0 -29
  431. package/dist/Grid-VQ3fN1ko.js +0 -32
  432. package/dist/Heading/index.cjs +0 -12
  433. package/dist/Heading/index.mjs +0 -6
  434. package/dist/Heading-D_ylbFzI.js +0 -49
  435. package/dist/Icon/index.cjs +0 -9
  436. package/dist/Icon/index.mjs +0 -3
  437. package/dist/Icon-C05AQvkv.js +0 -36
  438. package/dist/Icon-Dic5myD3.js +0 -34
  439. package/dist/InlineLabel/index.cjs +0 -10
  440. package/dist/InlineLabel/index.mjs +0 -4
  441. package/dist/InlineLabel-A3tenwf6.js +0 -20
  442. package/dist/InlineLabel-BLt0Q3bb.js +0 -18
  443. package/dist/InputAvatar/index.cjs +0 -26
  444. package/dist/InputAvatar/index.mjs +0 -20
  445. package/dist/InputAvatar-BdLo0JDy.js +0 -49
  446. package/dist/InputAvatar-Dqd68eBU.js +0 -47
  447. package/dist/InputDate/index.cjs +0 -34
  448. package/dist/InputDate/index.mjs +0 -28
  449. package/dist/InputDate-CEk7YABR.js +0 -48
  450. package/dist/InputEmail/index.cjs +0 -22
  451. package/dist/InputEmail/index.mjs +0 -15
  452. package/dist/InputEmail-C-EyDCxm.js +0 -20
  453. package/dist/InputEmail-wUgCu5JW.js +0 -23
  454. package/dist/InputFile/index.cjs +0 -23
  455. package/dist/InputFile/index.mjs +0 -16
  456. package/dist/InputFile-B4DD55KU.js +0 -1608
  457. package/dist/InputFile-D5DGGfOB.js +0 -1611
  458. package/dist/InputGroup/index.cjs +0 -9
  459. package/dist/InputGroup/index.mjs +0 -3
  460. package/dist/InputGroup-DeQx7ud8.js +0 -25
  461. package/dist/InputGroup-hh3QBfdL.js +0 -23
  462. package/dist/InputNumber/index.cjs +0 -21
  463. package/dist/InputNumber/index.mjs +0 -15
  464. package/dist/InputNumber-BveQrPyO.js +0 -56
  465. package/dist/InputPassword/index.cjs +0 -21
  466. package/dist/InputPassword/index.mjs +0 -15
  467. package/dist/InputPassword-C8V7VR78.js +0 -21
  468. package/dist/InputPassword-Dw7Go90j.js +0 -19
  469. package/dist/InputPhoneNumber/index.cjs +0 -21
  470. package/dist/InputPhoneNumber/index.mjs +0 -15
  471. package/dist/InputPhoneNumber-DVscxVqU.js +0 -94
  472. package/dist/InputText/index.cjs +0 -22
  473. package/dist/InputText/index.mjs +0 -16
  474. package/dist/InputText-COr1oIHK.js +0 -96
  475. package/dist/InputTime/index.cjs +0 -26
  476. package/dist/InputTime/index.mjs +0 -20
  477. package/dist/InputTime-_Oc4Hp9L.js +0 -190
  478. package/dist/InputValidation/index.cjs +0 -14
  479. package/dist/InputValidation/index.mjs +0 -8
  480. package/dist/InputValidation-BiJTp0aC.js +0 -22
  481. package/dist/InputValidation-CCkTBcxQ.js +0 -20
  482. package/dist/InternalChipDismissible-D8UrPjJC.js +0 -152
  483. package/dist/InternalChipDismissible-DUluzwH6.js +0 -157
  484. package/dist/InternalGridCell-Bi4IFFO8.js +0 -37
  485. package/dist/InternalGridCell-CE9IQZwO.js +0 -34
  486. package/dist/LightBox/index.cjs +0 -26
  487. package/dist/LightBox/index.mjs +0 -20
  488. package/dist/LightBox-CIWrYTaA.js +0 -110
  489. package/dist/LightBox-D-gmMO7L.js +0 -112
  490. package/dist/Link/index.cjs +0 -8
  491. package/dist/Link/index.mjs +0 -2
  492. package/dist/Link-_423xhjb.js +0 -7
  493. package/dist/Link-j486eamd.js +0 -9
  494. package/dist/List/index.cjs +0 -29
  495. package/dist/List/index.mjs +0 -22
  496. package/dist/List-BcQDY2Rj.js +0 -186
  497. package/dist/List-Dgwp7JmK.js +0 -189
  498. package/dist/Markdown/index.cjs +0 -19
  499. package/dist/Markdown/index.mjs +0 -13
  500. package/dist/Markdown-BfxzpIEM.js +0 -19011
  501. package/dist/Markdown-BhG7kPFl.js +0 -19013
  502. package/dist/Menu/index.cjs +0 -18
  503. package/dist/Menu/index.mjs +0 -12
  504. package/dist/Menu-CuPp5MtV.js +0 -129
  505. package/dist/Menu-DNImsnBT.js +0 -131
  506. package/dist/Modal/index.cjs +0 -23
  507. package/dist/Modal/index.mjs +0 -17
  508. package/dist/Modal-Cgz6UlsK.js +0 -62
  509. package/dist/Modal-DQHFlXp5.js +0 -60
  510. package/dist/MultiSelect/index.cjs +0 -16
  511. package/dist/MultiSelect/index.mjs +0 -10
  512. package/dist/MultiSelect-BxtKPK3-.js +0 -166
  513. package/dist/MultiSelect-DFR0vsTw.js +0 -164
  514. package/dist/Option-C87IriRr.js +0 -12
  515. package/dist/Option-X8lh2w6I.js +0 -15
  516. package/dist/Page/index.cjs +0 -32
  517. package/dist/Page/index.mjs +0 -26
  518. package/dist/Page-BgG3_7DX.js +0 -56
  519. package/dist/Page-BowBp8rI.js +0 -58
  520. package/dist/Popover/index.cjs +0 -17
  521. package/dist/Popover/index.mjs +0 -11
  522. package/dist/Popover-BwG9WBGX.js +0 -50
  523. package/dist/Popover-o9pOjTMP.js +0 -48
  524. package/dist/ProgressBar/index.cjs +0 -9
  525. package/dist/ProgressBar/index.mjs +0 -3
  526. package/dist/ProgressBar-CUTebo_k.js +0 -33
  527. package/dist/ProgressBar-OBLHnKRF.js +0 -31
  528. package/dist/RadioGroup/index.cjs +0 -12
  529. package/dist/RadioGroup/index.mjs +0 -5
  530. package/dist/RadioGroup-CxguJ9E7.js +0 -39
  531. package/dist/RadioGroup-Dt9_WguN.js +0 -36
  532. package/dist/RecurringSelect/components/index.cjs +0 -15
  533. package/dist/RecurringSelect/components/index.mjs +0 -6
  534. package/dist/RecurringSelect/index.cjs +0 -35
  535. package/dist/RecurringSelect/index.mjs +0 -21
  536. package/dist/RecurringSelect-BB2D2awE.js +0 -69
  537. package/dist/RecurringSelect-Dqle4F6a.js +0 -71
  538. package/dist/Select/index.cjs +0 -22
  539. package/dist/Select/index.mjs +0 -15
  540. package/dist/Spinner/index.cjs +0 -9
  541. package/dist/Spinner/index.mjs +0 -3
  542. package/dist/Spinner-CjTb3xIl.js +0 -16
  543. package/dist/Spinner-DGO8_Jsa.js +0 -14
  544. package/dist/StatusIndicator/index.cjs +0 -8
  545. package/dist/StatusIndicator/index.mjs +0 -2
  546. package/dist/StatusIndicator-CNH13isn.js +0 -11
  547. package/dist/StatusIndicator-DaWtSIUm.js +0 -9
  548. package/dist/StatusLabel/index.cjs +0 -11
  549. package/dist/StatusLabel/index.mjs +0 -5
  550. package/dist/StatusLabel-DuJzG65D.js +0 -18
  551. package/dist/StatusLabel-YebFZkcB.js +0 -16
  552. package/dist/Switch/index.cjs +0 -10
  553. package/dist/Switch/index.mjs +0 -4
  554. package/dist/Switch-CUBASre6.js +0 -46
  555. package/dist/Switch-KKEqlvTp.js +0 -48
  556. package/dist/Table/index.cjs +0 -17
  557. package/dist/Table/index.mjs +0 -4
  558. package/dist/Tabs/index.cjs +0 -11
  559. package/dist/Tabs/index.mjs +0 -4
  560. package/dist/Tabs-AoDyVJHh.js +0 -70
  561. package/dist/Tabs-CmCuGGLm.js +0 -67
  562. package/dist/Text/index.cjs +0 -10
  563. package/dist/Text/index.mjs +0 -4
  564. package/dist/Text-CfxmOdM-.js +0 -25
  565. package/dist/Toast/index.cjs +0 -16
  566. package/dist/Toast/index.mjs +0 -10
  567. package/dist/Tooltip/index.cjs +0 -14
  568. package/dist/Tooltip/index.mjs +0 -8
  569. package/dist/Tooltip-BrnUcSMD.js +0 -103
  570. package/dist/Tooltip-PbQMMMXT.js +0 -105
  571. package/dist/Typography/index.cjs +0 -9
  572. package/dist/Typography/index.mjs +0 -3
  573. package/dist/Typography-BiJhpsiL.js +0 -38
  574. package/dist/Typography-DscVWtp8.js +0 -36
  575. package/dist/_baseAssignValue-Byqm0l-g.js +0 -29
  576. package/dist/_baseAssignValue-ph7A7Tyf.js +0 -31
  577. package/dist/_baseEach-2sgXrDWN.js +0 -1073
  578. package/dist/_baseEach-DbUzYrtE.js +0 -1069
  579. package/dist/_commonjsHelpers-BHq9dk6I.js +0 -36
  580. package/dist/_commonjsHelpers-Dw5gAsMR.js +0 -32
  581. package/dist/_defineProperty-PEG-eSOB.js +0 -1326
  582. package/dist/_defineProperty-fDNRMxz-.js +0 -1306
  583. package/dist/_getTag-BBi2mXSK.js +0 -718
  584. package/dist/_getTag-CtczKdF2.js +0 -733
  585. package/dist/_polyfill-node.process-7AsFqJce.js +0 -258
  586. package/dist/_polyfill-node.process-B3Zw2Wh0.js +0 -255
  587. package/dist/_setToString-BEt-Msu3.js +0 -230
  588. package/dist/_setToString-BXD3rooF.js +0 -234
  589. package/dist/debounce-DHeCta_M.js +0 -329
  590. package/dist/debounce-DtVkjvKH.js +0 -332
  591. package/dist/helpers-BX_7EKw7.js +0 -15
  592. package/dist/helpers-BpmnB4Qy.js +0 -17
  593. package/dist/index-BE4KkyL_.js +0 -1186
  594. package/dist/index-dKBcvdAq.js +0 -1189
  595. package/dist/index.cjs +0 -275
  596. package/dist/index.d.mts +0 -74
  597. package/dist/index.d.ts +0 -74
  598. package/dist/index.mjs +0 -162
  599. package/dist/isObjectLike-53d8VfgU.js +0 -190
  600. package/dist/isObjectLike-zrq0mtNG.js +0 -197
  601. package/dist/isSymbol-B7o505jx.js +0 -35
  602. package/dist/isSymbol-Co3-vUC1.js +0 -33
  603. package/dist/noop-B8ZS2J9q.js +0 -24
  604. package/dist/noop-mF8IIYWw.js +0 -26
  605. package/dist/showToast-C4Fxtv_O.js +0 -97
  606. package/dist/showToast-Ckq11MSy.js +0 -99
  607. package/dist/styles.css +0 -8762
  608. package/dist/tslib.es6-5nrZ19JS.js +0 -97
  609. package/dist/tslib.es6-BBH1pS30.js +0 -102
  610. package/dist/useActiveLayout-BSipZn9t.js +0 -16
  611. package/dist/useActiveLayout-BqE7ZQY7.js +0 -14
  612. package/dist/useAssert-BTe43jaI.js +0 -27
  613. package/dist/useAssert-CSmf3rDf.js +0 -27
  614. package/dist/useAtlantisConfig-DC3Ppo_R.js +0 -14
  615. package/dist/useBatchSelect-KPnTra4u.js +0 -36
  616. package/dist/useBatchSelect-rQ55uZ7U.js +0 -38
  617. package/dist/useChildComponent-CwlKwCml.js +0 -15
  618. package/dist/useChildComponent-D7PbyArU.js +0 -17
  619. package/dist/useFocusTrap-B-xOQ79p.js +0 -74
  620. package/dist/useFocusTrap-D0gOZaSx.js +0 -74
  621. package/dist/useInView-CjeNEvX0.js +0 -25
  622. package/dist/useInView-DGjydyXL.js +0 -25
  623. package/dist/useIsMounted-BxDu0lnY.js +0 -47
  624. package/dist/useIsMounted-DfJrPzyU.js +0 -47
  625. package/dist/useOnKeyDown-07RktdgP.js +0 -40
  626. package/dist/useOnKeyDown-W2x-4HSi.js +0 -40
  627. package/dist/useRefocusOnActivator-BAub7L-i.js +0 -32
  628. package/dist/useRefocusOnActivator-BnM3unqN.js +0 -32
  629. package/dist/useResizeObserver-B4Vfml7U.js +0 -1192
  630. package/dist/useResizeObserver-DzMx2b66.js +0 -1189
  631. package/dist/useResponsiveSizing-DB6K2Viw.js +0 -51
  632. package/dist/useResponsiveSizing-DVb-nBuX.js +0 -49
  633. package/dist/useSafeLayoutEffect-BW_VIS6-.js +0 -12
  634. package/dist/useSafeLayoutEffect-juh5vdFE.js +0 -14
  635. package/dist/useScrollToActive-CQdgd_Dw.js +0 -591
  636. package/dist/useScrollToActive-DP9nvfrv.js +0 -597
  637. /package/{.eslintrc.cjs → .eslintrc.js} +0 -0
  638. /package/dist/{AtlantisContext-AiJSmYGH.js → AtlantisContext-64608897.js} +0 -0
@@ -1,1608 +0,0 @@
1
- import { a as __awaiter, b as __generator, c as __spread } from './tslib.es6-5nrZ19JS.js';
2
- import React, { forwardRef, useImperativeHandle, Fragment, useMemo, useRef, useReducer, useEffect, useCallback } from 'react';
3
- import classnames from 'classnames';
4
- import { P as PropTypes } from './index-BE4KkyL_.js';
5
- import axios from 'axios';
6
- import { I as InputValidation } from './InputValidation-CCkTBcxQ.js';
7
- import { B as Button } from './Button-BH4Hhr2S.js';
8
- import { C as Content } from './Content-CobtdYug.js';
9
- import { T as Typography } from './Typography-DscVWtp8.js';
10
-
11
- var COMMON_MIME_TYPES = new Map([
12
- // https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
13
- ['aac', 'audio/aac'],
14
- ['abw', 'application/x-abiword'],
15
- ['arc', 'application/x-freearc'],
16
- ['avif', 'image/avif'],
17
- ['avi', 'video/x-msvideo'],
18
- ['azw', 'application/vnd.amazon.ebook'],
19
- ['bin', 'application/octet-stream'],
20
- ['bmp', 'image/bmp'],
21
- ['bz', 'application/x-bzip'],
22
- ['bz2', 'application/x-bzip2'],
23
- ['cda', 'application/x-cdf'],
24
- ['csh', 'application/x-csh'],
25
- ['css', 'text/css'],
26
- ['csv', 'text/csv'],
27
- ['doc', 'application/msword'],
28
- ['docx', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'],
29
- ['eot', 'application/vnd.ms-fontobject'],
30
- ['epub', 'application/epub+zip'],
31
- ['gz', 'application/gzip'],
32
- ['gif', 'image/gif'],
33
- ['htm', 'text/html'],
34
- ['html', 'text/html'],
35
- ['ico', 'image/vnd.microsoft.icon'],
36
- ['ics', 'text/calendar'],
37
- ['jar', 'application/java-archive'],
38
- ['jpeg', 'image/jpeg'],
39
- ['jpg', 'image/jpeg'],
40
- ['js', 'text/javascript'],
41
- ['json', 'application/json'],
42
- ['jsonld', 'application/ld+json'],
43
- ['mid', 'audio/midi'],
44
- ['midi', 'audio/midi'],
45
- ['mjs', 'text/javascript'],
46
- ['mp3', 'audio/mpeg'],
47
- ['mp4', 'video/mp4'],
48
- ['mpeg', 'video/mpeg'],
49
- ['mpkg', 'application/vnd.apple.installer+xml'],
50
- ['odp', 'application/vnd.oasis.opendocument.presentation'],
51
- ['ods', 'application/vnd.oasis.opendocument.spreadsheet'],
52
- ['odt', 'application/vnd.oasis.opendocument.text'],
53
- ['oga', 'audio/ogg'],
54
- ['ogv', 'video/ogg'],
55
- ['ogx', 'application/ogg'],
56
- ['opus', 'audio/opus'],
57
- ['otf', 'font/otf'],
58
- ['png', 'image/png'],
59
- ['pdf', 'application/pdf'],
60
- ['php', 'application/x-httpd-php'],
61
- ['ppt', 'application/vnd.ms-powerpoint'],
62
- ['pptx', 'application/vnd.openxmlformats-officedocument.presentationml.presentation'],
63
- ['rar', 'application/vnd.rar'],
64
- ['rtf', 'application/rtf'],
65
- ['sh', 'application/x-sh'],
66
- ['svg', 'image/svg+xml'],
67
- ['swf', 'application/x-shockwave-flash'],
68
- ['tar', 'application/x-tar'],
69
- ['tif', 'image/tiff'],
70
- ['tiff', 'image/tiff'],
71
- ['ts', 'video/mp2t'],
72
- ['ttf', 'font/ttf'],
73
- ['txt', 'text/plain'],
74
- ['vsd', 'application/vnd.visio'],
75
- ['wav', 'audio/wav'],
76
- ['weba', 'audio/webm'],
77
- ['webm', 'video/webm'],
78
- ['webp', 'image/webp'],
79
- ['woff', 'font/woff'],
80
- ['woff2', 'font/woff2'],
81
- ['xhtml', 'application/xhtml+xml'],
82
- ['xls', 'application/vnd.ms-excel'],
83
- ['xlsx', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'],
84
- ['xml', 'application/xml'],
85
- ['xul', 'application/vnd.mozilla.xul+xml'],
86
- ['zip', 'application/zip'],
87
- ['7z', 'application/x-7z-compressed'],
88
- // Others
89
- ['mkv', 'video/x-matroska'],
90
- ['mov', 'video/quicktime'],
91
- ['msg', 'application/vnd.ms-outlook']
92
- ]);
93
- function toFileWithPath(file, path) {
94
- var f = withMimeType(file);
95
- if (typeof f.path !== 'string') { // on electron, path is already set to the absolute path
96
- var webkitRelativePath = file.webkitRelativePath;
97
- Object.defineProperty(f, 'path', {
98
- value: typeof path === 'string'
99
- ? path
100
- // If <input webkitdirectory> is set,
101
- // the File will have a {webkitRelativePath} property
102
- // https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/webkitdirectory
103
- : typeof webkitRelativePath === 'string' && webkitRelativePath.length > 0
104
- ? webkitRelativePath
105
- : file.name,
106
- writable: false,
107
- configurable: false,
108
- enumerable: true
109
- });
110
- }
111
- return f;
112
- }
113
- function withMimeType(file) {
114
- var name = file.name;
115
- var hasExtension = name && name.lastIndexOf('.') !== -1;
116
- if (hasExtension && !file.type) {
117
- var ext = name.split('.')
118
- .pop().toLowerCase();
119
- var type = COMMON_MIME_TYPES.get(ext);
120
- if (type) {
121
- Object.defineProperty(file, 'type', {
122
- value: type,
123
- writable: false,
124
- configurable: false,
125
- enumerable: true
126
- });
127
- }
128
- }
129
- return file;
130
- }
131
-
132
- var FILES_TO_IGNORE = [
133
- // Thumbnail cache files for macOS and Windows
134
- '.DS_Store',
135
- 'Thumbs.db' // Windows
136
- ];
137
- /**
138
- * Convert a DragEvent's DataTrasfer object to a list of File objects
139
- * NOTE: If some of the items are folders,
140
- * everything will be flattened and placed in the same list but the paths will be kept as a {path} property.
141
- *
142
- * EXPERIMENTAL: A list of https://developer.mozilla.org/en-US/docs/Web/API/FileSystemHandle objects can also be passed as an arg
143
- * and a list of File objects will be returned.
144
- *
145
- * @param evt
146
- */
147
- function fromEvent(evt) {
148
- return __awaiter(this, void 0, void 0, function () {
149
- return __generator(this, function (_a) {
150
- if (isObject(evt) && isDataTransfer(evt)) {
151
- return [2 /*return*/, getDataTransferFiles(evt.dataTransfer, evt.type)];
152
- }
153
- else if (isChangeEvt(evt)) {
154
- return [2 /*return*/, getInputFiles(evt)];
155
- }
156
- else if (Array.isArray(evt) && evt.every(function (item) { return 'getFile' in item && typeof item.getFile === 'function'; })) {
157
- return [2 /*return*/, getFsHandleFiles(evt)];
158
- }
159
- return [2 /*return*/, []];
160
- });
161
- });
162
- }
163
- function isDataTransfer(value) {
164
- return isObject(value.dataTransfer);
165
- }
166
- function isChangeEvt(value) {
167
- return isObject(value) && isObject(value.target);
168
- }
169
- function isObject(v) {
170
- return typeof v === 'object' && v !== null;
171
- }
172
- function getInputFiles(evt) {
173
- return fromList(evt.target.files).map(function (file) { return toFileWithPath(file); });
174
- }
175
- // Ee expect each handle to be https://developer.mozilla.org/en-US/docs/Web/API/FileSystemFileHandle
176
- function getFsHandleFiles(handles) {
177
- return __awaiter(this, void 0, void 0, function () {
178
- var files;
179
- return __generator(this, function (_a) {
180
- switch (_a.label) {
181
- case 0: return [4 /*yield*/, Promise.all(handles.map(function (h) { return h.getFile(); }))];
182
- case 1:
183
- files = _a.sent();
184
- return [2 /*return*/, files.map(function (file) { return toFileWithPath(file); })];
185
- }
186
- });
187
- });
188
- }
189
- function getDataTransferFiles(dt, type) {
190
- return __awaiter(this, void 0, void 0, function () {
191
- var items, files;
192
- return __generator(this, function (_a) {
193
- switch (_a.label) {
194
- case 0:
195
- if (dt === null) {
196
- return [2 /*return*/, []];
197
- }
198
- if (!dt.items) return [3 /*break*/, 2];
199
- items = fromList(dt.items)
200
- .filter(function (item) { return item.kind === 'file'; });
201
- // According to https://html.spec.whatwg.org/multipage/dnd.html#dndevents,
202
- // only 'dragstart' and 'drop' has access to the data (source node)
203
- if (type !== 'drop') {
204
- return [2 /*return*/, items];
205
- }
206
- return [4 /*yield*/, Promise.all(items.map(toFilePromises))];
207
- case 1:
208
- files = _a.sent();
209
- return [2 /*return*/, noIgnoredFiles(flatten(files))];
210
- case 2: return [2 /*return*/, noIgnoredFiles(fromList(dt.files)
211
- .map(function (file) { return toFileWithPath(file); }))];
212
- }
213
- });
214
- });
215
- }
216
- function noIgnoredFiles(files) {
217
- return files.filter(function (file) { return FILES_TO_IGNORE.indexOf(file.name) === -1; });
218
- }
219
- // IE11 does not support Array.from()
220
- // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from#Browser_compatibility
221
- // https://developer.mozilla.org/en-US/docs/Web/API/FileList
222
- // https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItemList
223
- function fromList(items) {
224
- if (items === null) {
225
- return [];
226
- }
227
- var files = [];
228
- // tslint:disable: prefer-for-of
229
- for (var i = 0; i < items.length; i++) {
230
- var file = items[i];
231
- files.push(file);
232
- }
233
- return files;
234
- }
235
- // https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItem
236
- function toFilePromises(item) {
237
- if (typeof item.webkitGetAsEntry !== 'function') {
238
- return fromDataTransferItem(item);
239
- }
240
- var entry = item.webkitGetAsEntry();
241
- // Safari supports dropping an image node from a different window and can be retrieved using
242
- // the DataTransferItem.getAsFile() API
243
- // NOTE: FileSystemEntry.file() throws if trying to get the file
244
- if (entry && entry.isDirectory) {
245
- return fromDirEntry(entry);
246
- }
247
- return fromDataTransferItem(item);
248
- }
249
- function flatten(items) {
250
- return items.reduce(function (acc, files) { return __spread(acc, (Array.isArray(files) ? flatten(files) : [files])); }, []);
251
- }
252
- function fromDataTransferItem(item) {
253
- var file = item.getAsFile();
254
- if (!file) {
255
- return Promise.reject(item + " is not a File");
256
- }
257
- var fwp = toFileWithPath(file);
258
- return Promise.resolve(fwp);
259
- }
260
- // https://developer.mozilla.org/en-US/docs/Web/API/FileSystemEntry
261
- function fromEntry(entry) {
262
- return __awaiter(this, void 0, void 0, function () {
263
- return __generator(this, function (_a) {
264
- return [2 /*return*/, entry.isDirectory ? fromDirEntry(entry) : fromFileEntry(entry)];
265
- });
266
- });
267
- }
268
- // https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryEntry
269
- function fromDirEntry(entry) {
270
- var reader = entry.createReader();
271
- return new Promise(function (resolve, reject) {
272
- var entries = [];
273
- function readEntries() {
274
- var _this = this;
275
- // https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryEntry/createReader
276
- // https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryReader/readEntries
277
- reader.readEntries(function (batch) { return __awaiter(_this, void 0, void 0, function () {
278
- var files, err_1, items;
279
- return __generator(this, function (_a) {
280
- switch (_a.label) {
281
- case 0:
282
- if (!!batch.length) return [3 /*break*/, 5];
283
- _a.label = 1;
284
- case 1:
285
- _a.trys.push([1, 3, , 4]);
286
- return [4 /*yield*/, Promise.all(entries)];
287
- case 2:
288
- files = _a.sent();
289
- resolve(files);
290
- return [3 /*break*/, 4];
291
- case 3:
292
- err_1 = _a.sent();
293
- reject(err_1);
294
- return [3 /*break*/, 4];
295
- case 4: return [3 /*break*/, 6];
296
- case 5:
297
- items = Promise.all(batch.map(fromEntry));
298
- entries.push(items);
299
- // Continue reading
300
- readEntries();
301
- _a.label = 6;
302
- case 6: return [2 /*return*/];
303
- }
304
- });
305
- }); }, function (err) {
306
- reject(err);
307
- });
308
- }
309
- readEntries();
310
- });
311
- }
312
- // https://developer.mozilla.org/en-US/docs/Web/API/FileSystemFileEntry
313
- function fromFileEntry(entry) {
314
- return __awaiter(this, void 0, void 0, function () {
315
- return __generator(this, function (_a) {
316
- return [2 /*return*/, new Promise(function (resolve, reject) {
317
- entry.file(function (file) {
318
- var fwp = toFileWithPath(file, entry.fullPath);
319
- resolve(fwp);
320
- }, function (err) {
321
- reject(err);
322
- });
323
- })];
324
- });
325
- });
326
- }
327
-
328
- var _default = function (file, acceptedFiles) {
329
- if (file && acceptedFiles) {
330
- var acceptedFilesArray = Array.isArray(acceptedFiles) ? acceptedFiles : acceptedFiles.split(',');
331
- var fileName = file.name || '';
332
- var mimeType = (file.type || '').toLowerCase();
333
- var baseMimeType = mimeType.replace(/\/.*$/, '');
334
- return acceptedFilesArray.some(function (type) {
335
- var validType = type.trim().toLowerCase();
336
-
337
- if (validType.charAt(0) === '.') {
338
- return fileName.toLowerCase().endsWith(validType);
339
- } else if (validType.endsWith('/*')) {
340
- // This is something like a image/* mime type
341
- return baseMimeType === validType.replace(/\/.*$/, '');
342
- }
343
-
344
- return mimeType === validType;
345
- });
346
- }
347
-
348
- return true;
349
- };
350
-
351
- 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; }
352
-
353
- 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; }
354
-
355
- 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; }
356
-
357
- function _slicedToArray$1(arr, i) { return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest$1(); }
358
-
359
- 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."); }
360
-
361
- 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); }
362
-
363
- 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; }
364
-
365
- 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; }
366
-
367
- function _arrayWithHoles$1(arr) { if (Array.isArray(arr)) return arr; }
368
-
369
- var FILE_INVALID_TYPE = 'file-invalid-type';
370
- var FILE_TOO_LARGE = 'file-too-large';
371
- var FILE_TOO_SMALL = 'file-too-small';
372
- var TOO_MANY_FILES = 'too-many-files';
373
-
374
- var getInvalidTypeRejectionErr = function getInvalidTypeRejectionErr(accept) {
375
- accept = Array.isArray(accept) && accept.length === 1 ? accept[0] : accept;
376
- var messageSuffix = Array.isArray(accept) ? "one of ".concat(accept.join(', ')) : accept;
377
- return {
378
- code: FILE_INVALID_TYPE,
379
- message: "File type must be ".concat(messageSuffix)
380
- };
381
- };
382
- var getTooLargeRejectionErr = function getTooLargeRejectionErr(maxSize) {
383
- return {
384
- code: FILE_TOO_LARGE,
385
- message: "File is larger than ".concat(maxSize, " ").concat(maxSize === 1 ? 'byte' : 'bytes')
386
- };
387
- };
388
- var getTooSmallRejectionErr = function getTooSmallRejectionErr(minSize) {
389
- return {
390
- code: FILE_TOO_SMALL,
391
- message: "File is smaller than ".concat(minSize, " ").concat(minSize === 1 ? 'byte' : 'bytes')
392
- };
393
- };
394
- var TOO_MANY_FILES_REJECTION = {
395
- code: TOO_MANY_FILES,
396
- message: 'Too many files'
397
- }; // Firefox versions prior to 53 return a bogus MIME type for every file drag, so dragovers with
398
- // that MIME type will always be accepted
399
-
400
- function fileAccepted(file, accept) {
401
- var isAcceptable = file.type === 'application/x-moz-file' || _default(file, accept);
402
- return [isAcceptable, isAcceptable ? null : getInvalidTypeRejectionErr(accept)];
403
- }
404
- function fileMatchSize(file, minSize, maxSize) {
405
- if (isDefined(file.size)) {
406
- if (isDefined(minSize) && isDefined(maxSize)) {
407
- if (file.size > maxSize) return [false, getTooLargeRejectionErr(maxSize)];
408
- if (file.size < minSize) return [false, getTooSmallRejectionErr(minSize)];
409
- } else if (isDefined(minSize) && file.size < minSize) return [false, getTooSmallRejectionErr(minSize)];else if (isDefined(maxSize) && file.size > maxSize) return [false, getTooLargeRejectionErr(maxSize)];
410
- }
411
-
412
- return [true, null];
413
- }
414
-
415
- function isDefined(value) {
416
- return value !== undefined && value !== null;
417
- }
418
-
419
- function allFilesAccepted(_ref) {
420
- var files = _ref.files,
421
- accept = _ref.accept,
422
- minSize = _ref.minSize,
423
- maxSize = _ref.maxSize,
424
- multiple = _ref.multiple,
425
- maxFiles = _ref.maxFiles;
426
-
427
- if (!multiple && files.length > 1 || multiple && maxFiles >= 1 && files.length > maxFiles) {
428
- return false;
429
- }
430
-
431
- return files.every(function (file) {
432
- var _fileAccepted = fileAccepted(file, accept),
433
- _fileAccepted2 = _slicedToArray$1(_fileAccepted, 1),
434
- accepted = _fileAccepted2[0];
435
-
436
- var _fileMatchSize = fileMatchSize(file, minSize, maxSize),
437
- _fileMatchSize2 = _slicedToArray$1(_fileMatchSize, 1),
438
- sizeMatch = _fileMatchSize2[0];
439
-
440
- return accepted && sizeMatch;
441
- });
442
- } // React's synthetic events has event.isPropagationStopped,
443
- // but to remain compatibility with other libs (Preact) fall back
444
- // to check event.cancelBubble
445
-
446
- function isPropagationStopped(event) {
447
- if (typeof event.isPropagationStopped === 'function') {
448
- return event.isPropagationStopped();
449
- } else if (typeof event.cancelBubble !== 'undefined') {
450
- return event.cancelBubble;
451
- }
452
-
453
- return false;
454
- }
455
- function isEvtWithFiles(event) {
456
- if (!event.dataTransfer) {
457
- return !!event.target && !!event.target.files;
458
- } // https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/types
459
- // https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API/Recommended_drag_types#file
460
-
461
-
462
- return Array.prototype.some.call(event.dataTransfer.types, function (type) {
463
- return type === 'Files' || type === 'application/x-moz-file';
464
- });
465
- }
466
-
467
- function onDocumentDragOver(event) {
468
- event.preventDefault();
469
- }
470
-
471
- function isIe(userAgent) {
472
- return userAgent.indexOf('MSIE') !== -1 || userAgent.indexOf('Trident/') !== -1;
473
- }
474
-
475
- function isEdge(userAgent) {
476
- return userAgent.indexOf('Edge/') !== -1;
477
- }
478
-
479
- function isIeOrEdge() {
480
- var userAgent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.navigator.userAgent;
481
- return isIe(userAgent) || isEdge(userAgent);
482
- }
483
- /**
484
- * This is intended to be used to compose event handlers
485
- * They are executed in order until one of them calls `event.isPropagationStopped()`.
486
- * Note that the check is done on the first invoke too,
487
- * meaning that if propagation was stopped before invoking the fns,
488
- * no handlers will be executed.
489
- *
490
- * @param {Function} fns the event hanlder functions
491
- * @return {Function} the event handler to add to an element
492
- */
493
-
494
- function composeEventHandlers() {
495
- for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) {
496
- fns[_key] = arguments[_key];
497
- }
498
-
499
- return function (event) {
500
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
501
- args[_key2 - 1] = arguments[_key2];
502
- }
503
-
504
- return fns.some(function (fn) {
505
- if (!isPropagationStopped(event) && fn) {
506
- fn.apply(void 0, [event].concat(args));
507
- }
508
-
509
- return isPropagationStopped(event);
510
- });
511
- };
512
- }
513
- /**
514
- * canUseFileSystemAccessAPI checks if the [File System Access API](https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API)
515
- * is supported by the browser.
516
- * @returns {boolean}
517
- */
518
-
519
- function canUseFileSystemAccessAPI() {
520
- return 'showOpenFilePicker' in window;
521
- }
522
- /**
523
- * filePickerOptionsTypes returns the {types} option for https://developer.mozilla.org/en-US/docs/Web/API/window/showOpenFilePicker
524
- * based on the accept attr (see https://github.com/react-dropzone/attr-accept)
525
- * E.g: converts ['image/*', 'text/*'] to {'image/*': [], 'text/*': []}
526
- * @param {string|string[]} accept
527
- */
528
-
529
- function filePickerOptionsTypes(accept) {
530
- accept = typeof accept === 'string' ? accept.split(',') : accept;
531
- return [{
532
- description: 'everything',
533
- // TODO: Need to handle filtering more elegantly than this!
534
- accept: Array.isArray(accept) // Accept just MIME types as per spec
535
- // NOTE: accept can be https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#unique_file_type_specifiers
536
- ? accept.filter(function (item) {
537
- return item === 'audio/*' || item === 'video/*' || item === 'image/*' || item === 'text/*' || /\w+\/[-+.\w]+/g.test(item);
538
- }).reduce(function (a, b) {
539
- return _objectSpread$1(_objectSpread$1({}, a), {}, _defineProperty$1({}, b, []));
540
- }, {}) : {}
541
- }];
542
- }
543
-
544
- var _excluded = ["children"],
545
- _excluded2 = ["open"],
546
- _excluded3 = ["refKey", "role", "onKeyDown", "onFocus", "onBlur", "onClick", "onDragEnter", "onDragOver", "onDragLeave", "onDrop"],
547
- _excluded4 = ["refKey", "onChange", "onClick"];
548
-
549
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
550
-
551
- 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."); }
552
-
553
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
554
-
555
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
556
-
557
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
558
-
559
- 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."); }
560
-
561
- 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); }
562
-
563
- 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; }
564
-
565
- 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; }
566
-
567
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
568
-
569
- 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; }
570
-
571
- 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; }
572
-
573
- 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; }
574
-
575
- 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; }
576
-
577
- 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; }
578
- /**
579
- * Convenience wrapper component for the `useDropzone` hook
580
- *
581
- * ```jsx
582
- * <Dropzone>
583
- * {({getRootProps, getInputProps}) => (
584
- * <div {...getRootProps()}>
585
- * <input {...getInputProps()} />
586
- * <p>Drag 'n' drop some files here, or click to select files</p>
587
- * </div>
588
- * )}
589
- * </Dropzone>
590
- * ```
591
- */
592
-
593
- var Dropzone = /*#__PURE__*/forwardRef(function (_ref, ref) {
594
- var children = _ref.children,
595
- params = _objectWithoutProperties(_ref, _excluded);
596
-
597
- var _useDropzone = useDropzone(params),
598
- open = _useDropzone.open,
599
- props = _objectWithoutProperties(_useDropzone, _excluded2);
600
-
601
- useImperativeHandle(ref, function () {
602
- return {
603
- open: open
604
- };
605
- }, [open]); // TODO: Figure out why react-styleguidist cannot create docs if we don't return a jsx element
606
-
607
- return /*#__PURE__*/React.createElement(Fragment, null, children(_objectSpread(_objectSpread({}, props), {}, {
608
- open: open
609
- })));
610
- });
611
- Dropzone.displayName = 'Dropzone'; // Add default props for react-docgen
612
-
613
- var defaultProps = {
614
- disabled: false,
615
- getFilesFromEvent: fromEvent,
616
- maxSize: Infinity,
617
- minSize: 0,
618
- multiple: true,
619
- maxFiles: 0,
620
- preventDropOnDocument: true,
621
- noClick: false,
622
- noKeyboard: false,
623
- noDrag: false,
624
- noDragEventsBubbling: false,
625
- validator: null,
626
- useFsAccessApi: false
627
- };
628
- Dropzone.defaultProps = defaultProps;
629
- Dropzone.propTypes = {
630
- /**
631
- * Render function that exposes the dropzone state and prop getter fns
632
- *
633
- * @param {object} params
634
- * @param {Function} params.getRootProps Returns the props you should apply to the root drop container you render
635
- * @param {Function} params.getInputProps Returns the props you should apply to hidden file input you render
636
- * @param {Function} params.open Open the native file selection dialog
637
- * @param {boolean} params.isFocused Dropzone area is in focus
638
- * @param {boolean} params.isFileDialogActive File dialog is opened
639
- * @param {boolean} params.isDragActive Active drag is in progress
640
- * @param {boolean} params.isDragAccept Dragged files are accepted
641
- * @param {boolean} params.isDragReject Some dragged files are rejected
642
- * @param {File[]} params.draggedFiles Files in active drag
643
- * @param {File[]} params.acceptedFiles Accepted files
644
- * @param {FileRejection[]} params.fileRejections Rejected files and why they were rejected
645
- */
646
- children: PropTypes.func,
647
-
648
- /**
649
- * Set accepted file types.
650
- * See https://github.com/okonet/attr-accept for more information.
651
- * Keep in mind that mime type determination is not reliable across platforms. CSV files,
652
- * for example, are reported as text/plain under macOS but as application/vnd.ms-excel under
653
- * Windows. In some cases there might not be a mime type set at all.
654
- * See: https://github.com/react-dropzone/react-dropzone/issues/276
655
- */
656
- accept: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
657
-
658
- /**
659
- * Allow drag 'n' drop (or selection from the file dialog) of multiple files
660
- */
661
- multiple: PropTypes.bool,
662
-
663
- /**
664
- * If false, allow dropped items to take over the current browser window
665
- */
666
- preventDropOnDocument: PropTypes.bool,
667
-
668
- /**
669
- * If true, disables click to open the native file selection dialog
670
- */
671
- noClick: PropTypes.bool,
672
-
673
- /**
674
- * If true, disables SPACE/ENTER to open the native file selection dialog.
675
- * Note that it also stops tracking the focus state.
676
- */
677
- noKeyboard: PropTypes.bool,
678
-
679
- /**
680
- * If true, disables drag 'n' drop
681
- */
682
- noDrag: PropTypes.bool,
683
-
684
- /**
685
- * If true, stops drag event propagation to parents
686
- */
687
- noDragEventsBubbling: PropTypes.bool,
688
-
689
- /**
690
- * Minimum file size (in bytes)
691
- */
692
- minSize: PropTypes.number,
693
-
694
- /**
695
- * Maximum file size (in bytes)
696
- */
697
- maxSize: PropTypes.number,
698
-
699
- /**
700
- * Maximum accepted number of files
701
- * The default value is 0 which means there is no limitation to how many files are accepted.
702
- */
703
- maxFiles: PropTypes.number,
704
-
705
- /**
706
- * Enable/disable the dropzone
707
- */
708
- disabled: PropTypes.bool,
709
-
710
- /**
711
- * Use this to provide a custom file aggregator
712
- *
713
- * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
714
- */
715
- getFilesFromEvent: PropTypes.func,
716
-
717
- /**
718
- * Cb for when closing the file dialog with no selection
719
- */
720
- onFileDialogCancel: PropTypes.func,
721
-
722
- /**
723
- * Cb for when opening the file dialog
724
- */
725
- onFileDialogOpen: PropTypes.func,
726
-
727
- /**
728
- * Set to true to use the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API
729
- * to open the file picker instead of using an `<input type="file">` click event.
730
- */
731
- useFsAccessApi: PropTypes.bool,
732
-
733
- /**
734
- * Cb for when the `dragenter` event occurs.
735
- *
736
- * @param {DragEvent} event
737
- */
738
- onDragEnter: PropTypes.func,
739
-
740
- /**
741
- * Cb for when the `dragleave` event occurs
742
- *
743
- * @param {DragEvent} event
744
- */
745
- onDragLeave: PropTypes.func,
746
-
747
- /**
748
- * Cb for when the `dragover` event occurs
749
- *
750
- * @param {DragEvent} event
751
- */
752
- onDragOver: PropTypes.func,
753
-
754
- /**
755
- * Cb for when the `drop` event occurs.
756
- * Note that this callback is invoked after the `getFilesFromEvent` callback is done.
757
- *
758
- * Files are accepted or rejected based on the `accept`, `multiple`, `minSize` and `maxSize` props.
759
- * `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.
760
- * If `multiple` is set to false and additional files are dropped,
761
- * all files besides the first will be rejected.
762
- * Any file which does not have a size in the [`minSize`, `maxSize`] range, will be rejected as well.
763
- *
764
- * Note that the `onDrop` callback will always be invoked regardless if the dropped files were accepted or rejected.
765
- * If you'd like to react to a specific scenario, use the `onDropAccepted`/`onDropRejected` props.
766
- *
767
- * `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.
768
- * For example, with [SuperAgent](https://github.com/visionmedia/superagent) as a http/ajax library:
769
- *
770
- * ```js
771
- * function onDrop(acceptedFiles) {
772
- * const req = request.post('/upload')
773
- * acceptedFiles.forEach(file => {
774
- * req.attach(file.name, file)
775
- * })
776
- * req.end(callback)
777
- * }
778
- * ```
779
- *
780
- * @param {File[]} acceptedFiles
781
- * @param {FileRejection[]} fileRejections
782
- * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
783
- */
784
- onDrop: PropTypes.func,
785
-
786
- /**
787
- * Cb for when the `drop` event occurs.
788
- * Note that if no files are accepted, this callback is not invoked.
789
- *
790
- * @param {File[]} files
791
- * @param {(DragEvent|Event)} event
792
- */
793
- onDropAccepted: PropTypes.func,
794
-
795
- /**
796
- * Cb for when the `drop` event occurs.
797
- * Note that if no files are rejected, this callback is not invoked.
798
- *
799
- * @param {FileRejection[]} fileRejections
800
- * @param {(DragEvent|Event)} event
801
- */
802
- onDropRejected: PropTypes.func,
803
-
804
- /**
805
- * Custom validation function
806
- * @param {File} file
807
- * @returns {FileError|FileError[]}
808
- */
809
- validator: PropTypes.func
810
- };
811
- /**
812
- * A function that is invoked for the `dragenter`,
813
- * `dragover` and `dragleave` events.
814
- * It is not invoked if the items are not files (such as link, text, etc.).
815
- *
816
- * @callback dragCb
817
- * @param {DragEvent} event
818
- */
819
-
820
- /**
821
- * A function that is invoked for the `drop` or input change event.
822
- * It is not invoked if the items are not files (such as link, text, etc.).
823
- *
824
- * @callback dropCb
825
- * @param {File[]} acceptedFiles List of accepted files
826
- * @param {FileRejection[]} fileRejections List of rejected files and why they were rejected
827
- * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
828
- */
829
-
830
- /**
831
- * A function that is invoked for the `drop` or input change event.
832
- * It is not invoked if the items are files (such as link, text, etc.).
833
- *
834
- * @callback dropAcceptedCb
835
- * @param {File[]} files List of accepted files that meet the given criteria
836
- * (`accept`, `multiple`, `minSize`, `maxSize`)
837
- * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
838
- */
839
-
840
- /**
841
- * A function that is invoked for the `drop` or input change event.
842
- *
843
- * @callback dropRejectedCb
844
- * @param {File[]} files List of rejected files that do not meet the given criteria
845
- * (`accept`, `multiple`, `minSize`, `maxSize`)
846
- * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
847
- */
848
-
849
- /**
850
- * A function that is used aggregate files,
851
- * in a asynchronous fashion, from drag or input change events.
852
- *
853
- * @callback getFilesFromEvent
854
- * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
855
- * @returns {(File[]|Promise<File[]>)}
856
- */
857
-
858
- /**
859
- * An object with the current dropzone state and some helper functions.
860
- *
861
- * @typedef {object} DropzoneState
862
- * @property {Function} getRootProps Returns the props you should apply to the root drop container you render
863
- * @property {Function} getInputProps Returns the props you should apply to hidden file input you render
864
- * @property {Function} open Open the native file selection dialog
865
- * @property {boolean} isFocused Dropzone area is in focus
866
- * @property {boolean} isFileDialogActive File dialog is opened
867
- * @property {boolean} isDragActive Active drag is in progress
868
- * @property {boolean} isDragAccept Dragged files are accepted
869
- * @property {boolean} isDragReject Some dragged files are rejected
870
- * @property {File[]} draggedFiles Files in active drag
871
- * @property {File[]} acceptedFiles Accepted files
872
- * @property {FileRejection[]} fileRejections Rejected files and why they were rejected
873
- */
874
-
875
- var initialState = {
876
- isFocused: false,
877
- isFileDialogActive: false,
878
- isDragActive: false,
879
- isDragAccept: false,
880
- isDragReject: false,
881
- draggedFiles: [],
882
- acceptedFiles: [],
883
- fileRejections: []
884
- };
885
- /**
886
- * A React hook that creates a drag 'n' drop area.
887
- *
888
- * ```jsx
889
- * function MyDropzone(props) {
890
- * const {getRootProps, getInputProps} = useDropzone({
891
- * onDrop: acceptedFiles => {
892
- * // do something with the File objects, e.g. upload to some server
893
- * }
894
- * });
895
- * return (
896
- * <div {...getRootProps()}>
897
- * <input {...getInputProps()} />
898
- * <p>Drag and drop some files here, or click to select files</p>
899
- * </div>
900
- * )
901
- * }
902
- * ```
903
- *
904
- * @function useDropzone
905
- *
906
- * @param {object} props
907
- * @param {string|string[]} [props.accept] Set accepted file types.
908
- * See https://github.com/okonet/attr-accept for more information.
909
- * Keep in mind that mime type determination is not reliable across platforms. CSV files,
910
- * for example, are reported as text/plain under macOS but as application/vnd.ms-excel under
911
- * Windows. In some cases there might not be a mime type set at all.
912
- * See: https://github.com/react-dropzone/react-dropzone/issues/276
913
- * @param {boolean} [props.multiple=true] Allow drag 'n' drop (or selection from the file dialog) of multiple files
914
- * @param {boolean} [props.preventDropOnDocument=true] If false, allow dropped items to take over the current browser window
915
- * @param {boolean} [props.noClick=false] If true, disables click to open the native file selection dialog
916
- * @param {boolean} [props.noKeyboard=false] If true, disables SPACE/ENTER to open the native file selection dialog.
917
- * Note that it also stops tracking the focus state.
918
- * @param {boolean} [props.noDrag=false] If true, disables drag 'n' drop
919
- * @param {boolean} [props.noDragEventsBubbling=false] If true, stops drag event propagation to parents
920
- * @param {number} [props.minSize=0] Minimum file size (in bytes)
921
- * @param {number} [props.maxSize=Infinity] Maximum file size (in bytes)
922
- * @param {boolean} [props.disabled=false] Enable/disable the dropzone
923
- * @param {getFilesFromEvent} [props.getFilesFromEvent] Use this to provide a custom file aggregator
924
- * @param {Function} [props.onFileDialogCancel] Cb for when closing the file dialog with no selection
925
- * @param {boolean} [props.useFsAccessApi] Set to true to use the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API
926
- * to open the file picker instead of using an `<input type="file">` click event.
927
- * @param {Function} [props.onFileDialogOpen] Cb for when opening the file dialog
928
- * @param {dragCb} [props.onDragEnter] Cb for when the `dragenter` event occurs.
929
- * @param {dragCb} [props.onDragLeave] Cb for when the `dragleave` event occurs
930
- * @param {dragCb} [props.onDragOver] Cb for when the `dragover` event occurs
931
- * @param {dropCb} [props.onDrop] Cb for when the `drop` event occurs.
932
- * Note that this callback is invoked after the `getFilesFromEvent` callback is done.
933
- *
934
- * Files are accepted or rejected based on the `accept`, `multiple`, `minSize` and `maxSize` props.
935
- * `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.
936
- * If `multiple` is set to false and additional files are dropped,
937
- * all files besides the first will be rejected.
938
- * Any file which does not have a size in the [`minSize`, `maxSize`] range, will be rejected as well.
939
- *
940
- * Note that the `onDrop` callback will always be invoked regardless if the dropped files were accepted or rejected.
941
- * If you'd like to react to a specific scenario, use the `onDropAccepted`/`onDropRejected` props.
942
- *
943
- * `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.
944
- * For example, with [SuperAgent](https://github.com/visionmedia/superagent) as a http/ajax library:
945
- *
946
- * ```js
947
- * function onDrop(acceptedFiles) {
948
- * const req = request.post('/upload')
949
- * acceptedFiles.forEach(file => {
950
- * req.attach(file.name, file)
951
- * })
952
- * req.end(callback)
953
- * }
954
- * ```
955
- * @param {dropAcceptedCb} [props.onDropAccepted]
956
- * @param {dropRejectedCb} [props.onDropRejected]
957
- *
958
- * @returns {DropzoneState}
959
- */
960
-
961
- function useDropzone() {
962
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
963
-
964
- var _defaultProps$options = _objectSpread(_objectSpread({}, defaultProps), options),
965
- accept = _defaultProps$options.accept,
966
- disabled = _defaultProps$options.disabled,
967
- getFilesFromEvent = _defaultProps$options.getFilesFromEvent,
968
- maxSize = _defaultProps$options.maxSize,
969
- minSize = _defaultProps$options.minSize,
970
- multiple = _defaultProps$options.multiple,
971
- maxFiles = _defaultProps$options.maxFiles,
972
- onDragEnter = _defaultProps$options.onDragEnter,
973
- onDragLeave = _defaultProps$options.onDragLeave,
974
- onDragOver = _defaultProps$options.onDragOver,
975
- onDrop = _defaultProps$options.onDrop,
976
- onDropAccepted = _defaultProps$options.onDropAccepted,
977
- onDropRejected = _defaultProps$options.onDropRejected,
978
- onFileDialogCancel = _defaultProps$options.onFileDialogCancel,
979
- onFileDialogOpen = _defaultProps$options.onFileDialogOpen,
980
- useFsAccessApi = _defaultProps$options.useFsAccessApi,
981
- preventDropOnDocument = _defaultProps$options.preventDropOnDocument,
982
- noClick = _defaultProps$options.noClick,
983
- noKeyboard = _defaultProps$options.noKeyboard,
984
- noDrag = _defaultProps$options.noDrag,
985
- noDragEventsBubbling = _defaultProps$options.noDragEventsBubbling,
986
- validator = _defaultProps$options.validator;
987
-
988
- var onFileDialogOpenCb = useMemo(function () {
989
- return typeof onFileDialogOpen === 'function' ? onFileDialogOpen : noop;
990
- }, [onFileDialogOpen]);
991
- var onFileDialogCancelCb = useMemo(function () {
992
- return typeof onFileDialogCancel === 'function' ? onFileDialogCancel : noop;
993
- }, [onFileDialogCancel]);
994
- var rootRef = useRef(null);
995
- var inputRef = useRef(null);
996
-
997
- var _useReducer = useReducer(reducer, initialState),
998
- _useReducer2 = _slicedToArray(_useReducer, 2),
999
- state = _useReducer2[0],
1000
- dispatch = _useReducer2[1];
1001
-
1002
- var isFocused = state.isFocused,
1003
- isFileDialogActive = state.isFileDialogActive,
1004
- draggedFiles = state.draggedFiles; // Update file dialog active state when the window is focused on
1005
-
1006
- var onWindowFocus = function onWindowFocus() {
1007
- // Execute the timeout only if the file dialog is opened in the browser
1008
- if (isFileDialogActive) {
1009
- setTimeout(function () {
1010
- if (inputRef.current) {
1011
- var files = inputRef.current.files;
1012
-
1013
- if (!files.length) {
1014
- dispatch({
1015
- type: 'closeDialog'
1016
- });
1017
- onFileDialogCancelCb();
1018
- }
1019
- }
1020
- }, 300);
1021
- }
1022
- };
1023
-
1024
- useEffect(function () {
1025
- if (useFsAccessApi && canUseFileSystemAccessAPI()) {
1026
- return function () {};
1027
- }
1028
-
1029
- window.addEventListener('focus', onWindowFocus, false);
1030
- return function () {
1031
- window.removeEventListener('focus', onWindowFocus, false);
1032
- };
1033
- }, [inputRef, isFileDialogActive, onFileDialogCancelCb, useFsAccessApi]);
1034
- var dragTargetsRef = useRef([]);
1035
-
1036
- var onDocumentDrop = function onDocumentDrop(event) {
1037
- if (rootRef.current && rootRef.current.contains(event.target)) {
1038
- // If we intercepted an event for our instance, let it propagate down to the instance's onDrop handler
1039
- return;
1040
- }
1041
-
1042
- event.preventDefault();
1043
- dragTargetsRef.current = [];
1044
- };
1045
-
1046
- useEffect(function () {
1047
- if (preventDropOnDocument) {
1048
- document.addEventListener('dragover', onDocumentDragOver, false);
1049
- document.addEventListener('drop', onDocumentDrop, false);
1050
- }
1051
-
1052
- return function () {
1053
- if (preventDropOnDocument) {
1054
- document.removeEventListener('dragover', onDocumentDragOver);
1055
- document.removeEventListener('drop', onDocumentDrop);
1056
- }
1057
- };
1058
- }, [rootRef, preventDropOnDocument]);
1059
- var onDragEnterCb = useCallback(function (event) {
1060
- event.preventDefault(); // Persist here because we need the event later after getFilesFromEvent() is done
1061
-
1062
- event.persist();
1063
- stopPropagation(event);
1064
- dragTargetsRef.current = [].concat(_toConsumableArray(dragTargetsRef.current), [event.target]);
1065
-
1066
- if (isEvtWithFiles(event)) {
1067
- Promise.resolve(getFilesFromEvent(event)).then(function (draggedFiles) {
1068
- if (isPropagationStopped(event) && !noDragEventsBubbling) {
1069
- return;
1070
- }
1071
-
1072
- dispatch({
1073
- draggedFiles: draggedFiles,
1074
- isDragActive: true,
1075
- type: 'setDraggedFiles'
1076
- });
1077
-
1078
- if (onDragEnter) {
1079
- onDragEnter(event);
1080
- }
1081
- });
1082
- }
1083
- }, [getFilesFromEvent, onDragEnter, noDragEventsBubbling]);
1084
- var onDragOverCb = useCallback(function (event) {
1085
- event.preventDefault();
1086
- event.persist();
1087
- stopPropagation(event);
1088
- var hasFiles = isEvtWithFiles(event);
1089
-
1090
- if (hasFiles && event.dataTransfer) {
1091
- try {
1092
- event.dataTransfer.dropEffect = 'copy';
1093
- } catch (_unused) {}
1094
- /* eslint-disable-line no-empty */
1095
-
1096
- }
1097
-
1098
- if (hasFiles && onDragOver) {
1099
- onDragOver(event);
1100
- }
1101
-
1102
- return false;
1103
- }, [onDragOver, noDragEventsBubbling]);
1104
- var onDragLeaveCb = useCallback(function (event) {
1105
- event.preventDefault();
1106
- event.persist();
1107
- stopPropagation(event); // Only deactivate once the dropzone and all children have been left
1108
-
1109
- var targets = dragTargetsRef.current.filter(function (target) {
1110
- return rootRef.current && rootRef.current.contains(target);
1111
- }); // Make sure to remove a target present multiple times only once
1112
- // (Firefox may fire dragenter/dragleave multiple times on the same element)
1113
-
1114
- var targetIdx = targets.indexOf(event.target);
1115
-
1116
- if (targetIdx !== -1) {
1117
- targets.splice(targetIdx, 1);
1118
- }
1119
-
1120
- dragTargetsRef.current = targets;
1121
-
1122
- if (targets.length > 0) {
1123
- return;
1124
- }
1125
-
1126
- dispatch({
1127
- isDragActive: false,
1128
- type: 'setDraggedFiles',
1129
- draggedFiles: []
1130
- });
1131
-
1132
- if (isEvtWithFiles(event) && onDragLeave) {
1133
- onDragLeave(event);
1134
- }
1135
- }, [rootRef, onDragLeave, noDragEventsBubbling]);
1136
- var setFiles = useCallback(function (files, event) {
1137
- var acceptedFiles = [];
1138
- var fileRejections = [];
1139
- files.forEach(function (file) {
1140
- var _fileAccepted = fileAccepted(file, accept),
1141
- _fileAccepted2 = _slicedToArray(_fileAccepted, 2),
1142
- accepted = _fileAccepted2[0],
1143
- acceptError = _fileAccepted2[1];
1144
-
1145
- var _fileMatchSize = fileMatchSize(file, minSize, maxSize),
1146
- _fileMatchSize2 = _slicedToArray(_fileMatchSize, 2),
1147
- sizeMatch = _fileMatchSize2[0],
1148
- sizeError = _fileMatchSize2[1];
1149
-
1150
- var customErrors = validator ? validator(file) : null;
1151
-
1152
- if (accepted && sizeMatch && !customErrors) {
1153
- acceptedFiles.push(file);
1154
- } else {
1155
- var errors = [acceptError, sizeError];
1156
-
1157
- if (customErrors) {
1158
- errors = errors.concat(customErrors);
1159
- }
1160
-
1161
- fileRejections.push({
1162
- file: file,
1163
- errors: errors.filter(function (e) {
1164
- return e;
1165
- })
1166
- });
1167
- }
1168
- });
1169
-
1170
- if (!multiple && acceptedFiles.length > 1 || multiple && maxFiles >= 1 && acceptedFiles.length > maxFiles) {
1171
- // Reject everything and empty accepted files
1172
- acceptedFiles.forEach(function (file) {
1173
- fileRejections.push({
1174
- file: file,
1175
- errors: [TOO_MANY_FILES_REJECTION]
1176
- });
1177
- });
1178
- acceptedFiles.splice(0);
1179
- }
1180
-
1181
- dispatch({
1182
- acceptedFiles: acceptedFiles,
1183
- fileRejections: fileRejections,
1184
- type: 'setFiles'
1185
- });
1186
-
1187
- if (onDrop) {
1188
- onDrop(acceptedFiles, fileRejections, event);
1189
- }
1190
-
1191
- if (fileRejections.length > 0 && onDropRejected) {
1192
- onDropRejected(fileRejections, event);
1193
- }
1194
-
1195
- if (acceptedFiles.length > 0 && onDropAccepted) {
1196
- onDropAccepted(acceptedFiles, event);
1197
- }
1198
- }, [dispatch, multiple, accept, minSize, maxSize, maxFiles, onDrop, onDropAccepted, onDropRejected, validator]);
1199
- var onDropCb = useCallback(function (event) {
1200
- event.preventDefault(); // Persist here because we need the event later after getFilesFromEvent() is done
1201
-
1202
- event.persist();
1203
- stopPropagation(event);
1204
- dragTargetsRef.current = [];
1205
-
1206
- if (isEvtWithFiles(event)) {
1207
- Promise.resolve(getFilesFromEvent(event)).then(function (files) {
1208
- if (isPropagationStopped(event) && !noDragEventsBubbling) {
1209
- return;
1210
- }
1211
-
1212
- setFiles(files, event);
1213
- });
1214
- }
1215
-
1216
- dispatch({
1217
- type: 'reset'
1218
- });
1219
- }, [getFilesFromEvent, setFiles, noDragEventsBubbling]); // Fn for opening the file dialog programmatically
1220
-
1221
- var openFileDialog = useCallback(function () {
1222
- if (useFsAccessApi && canUseFileSystemAccessAPI()) {
1223
- dispatch({
1224
- type: 'openDialog'
1225
- });
1226
- onFileDialogOpenCb(); // https://developer.mozilla.org/en-US/docs/Web/API/window/showOpenFilePicker
1227
-
1228
- var opts = {
1229
- multiple: multiple,
1230
- types: filePickerOptionsTypes(accept)
1231
- };
1232
- window.showOpenFilePicker(opts).then(function (handles) {
1233
- return getFilesFromEvent(handles);
1234
- }).then(function (files) {
1235
- return setFiles(files, null);
1236
- }).catch(function (e) {
1237
- return onFileDialogCancelCb(e);
1238
- }).finally(function () {
1239
- return dispatch({
1240
- type: 'closeDialog'
1241
- });
1242
- });
1243
- return;
1244
- }
1245
-
1246
- if (inputRef.current) {
1247
- dispatch({
1248
- type: 'openDialog'
1249
- });
1250
- onFileDialogOpenCb();
1251
- inputRef.current.value = null;
1252
- inputRef.current.click();
1253
- }
1254
- }, [dispatch, onFileDialogOpenCb, onFileDialogCancelCb, useFsAccessApi, setFiles, accept, multiple]); // Cb to open the file dialog when SPACE/ENTER occurs on the dropzone
1255
-
1256
- var onKeyDownCb = useCallback(function (event) {
1257
- // Ignore keyboard events bubbling up the DOM tree
1258
- if (!rootRef.current || !rootRef.current.isEqualNode(event.target)) {
1259
- return;
1260
- }
1261
-
1262
- if (event.keyCode === 32 || event.keyCode === 13) {
1263
- event.preventDefault();
1264
- openFileDialog();
1265
- }
1266
- }, [rootRef, inputRef, openFileDialog]); // Update focus state for the dropzone
1267
-
1268
- var onFocusCb = useCallback(function () {
1269
- dispatch({
1270
- type: 'focus'
1271
- });
1272
- }, []);
1273
- var onBlurCb = useCallback(function () {
1274
- dispatch({
1275
- type: 'blur'
1276
- });
1277
- }, []); // Cb to open the file dialog when click occurs on the dropzone
1278
-
1279
- var onClickCb = useCallback(function () {
1280
- if (noClick) {
1281
- return;
1282
- } // In IE11/Edge the file-browser dialog is blocking, therefore, use setTimeout()
1283
- // to ensure React can handle state changes
1284
- // See: https://github.com/react-dropzone/react-dropzone/issues/450
1285
-
1286
-
1287
- if (isIeOrEdge()) {
1288
- setTimeout(openFileDialog, 0);
1289
- } else {
1290
- openFileDialog();
1291
- }
1292
- }, [inputRef, noClick, openFileDialog]);
1293
-
1294
- var composeHandler = function composeHandler(fn) {
1295
- return disabled ? null : fn;
1296
- };
1297
-
1298
- var composeKeyboardHandler = function composeKeyboardHandler(fn) {
1299
- return noKeyboard ? null : composeHandler(fn);
1300
- };
1301
-
1302
- var composeDragHandler = function composeDragHandler(fn) {
1303
- return noDrag ? null : composeHandler(fn);
1304
- };
1305
-
1306
- var stopPropagation = function stopPropagation(event) {
1307
- if (noDragEventsBubbling) {
1308
- event.stopPropagation();
1309
- }
1310
- };
1311
-
1312
- var getRootProps = useMemo(function () {
1313
- return function () {
1314
- var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1315
- _ref2$refKey = _ref2.refKey,
1316
- refKey = _ref2$refKey === void 0 ? 'ref' : _ref2$refKey,
1317
- role = _ref2.role,
1318
- onKeyDown = _ref2.onKeyDown,
1319
- onFocus = _ref2.onFocus,
1320
- onBlur = _ref2.onBlur,
1321
- onClick = _ref2.onClick,
1322
- onDragEnter = _ref2.onDragEnter,
1323
- onDragOver = _ref2.onDragOver,
1324
- onDragLeave = _ref2.onDragLeave,
1325
- onDrop = _ref2.onDrop,
1326
- rest = _objectWithoutProperties(_ref2, _excluded3);
1327
-
1328
- return _objectSpread(_objectSpread(_defineProperty({
1329
- onKeyDown: composeKeyboardHandler(composeEventHandlers(onKeyDown, onKeyDownCb)),
1330
- onFocus: composeKeyboardHandler(composeEventHandlers(onFocus, onFocusCb)),
1331
- onBlur: composeKeyboardHandler(composeEventHandlers(onBlur, onBlurCb)),
1332
- onClick: composeHandler(composeEventHandlers(onClick, onClickCb)),
1333
- onDragEnter: composeDragHandler(composeEventHandlers(onDragEnter, onDragEnterCb)),
1334
- onDragOver: composeDragHandler(composeEventHandlers(onDragOver, onDragOverCb)),
1335
- onDragLeave: composeDragHandler(composeEventHandlers(onDragLeave, onDragLeaveCb)),
1336
- onDrop: composeDragHandler(composeEventHandlers(onDrop, onDropCb)),
1337
- role: typeof role === 'string' && role !== '' ? role : 'button'
1338
- }, refKey, rootRef), !disabled && !noKeyboard ? {
1339
- tabIndex: 0
1340
- } : {}), rest);
1341
- };
1342
- }, [rootRef, onKeyDownCb, onFocusCb, onBlurCb, onClickCb, onDragEnterCb, onDragOverCb, onDragLeaveCb, onDropCb, noKeyboard, noDrag, disabled]);
1343
- var onInputElementClick = useCallback(function (event) {
1344
- event.stopPropagation();
1345
- }, []);
1346
- var getInputProps = useMemo(function () {
1347
- return function () {
1348
- var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1349
- _ref3$refKey = _ref3.refKey,
1350
- refKey = _ref3$refKey === void 0 ? 'ref' : _ref3$refKey,
1351
- onChange = _ref3.onChange,
1352
- onClick = _ref3.onClick,
1353
- rest = _objectWithoutProperties(_ref3, _excluded4);
1354
-
1355
- var inputProps = _defineProperty({
1356
- accept: accept,
1357
- multiple: multiple,
1358
- type: 'file',
1359
- style: {
1360
- display: 'none'
1361
- },
1362
- onChange: composeHandler(composeEventHandlers(onChange, onDropCb)),
1363
- onClick: composeHandler(composeEventHandlers(onClick, onInputElementClick)),
1364
- autoComplete: 'off',
1365
- tabIndex: -1
1366
- }, refKey, inputRef);
1367
-
1368
- return _objectSpread(_objectSpread({}, inputProps), rest);
1369
- };
1370
- }, [inputRef, accept, multiple, onDropCb, disabled]);
1371
- var fileCount = draggedFiles.length;
1372
- var isDragAccept = fileCount > 0 && allFilesAccepted({
1373
- files: draggedFiles,
1374
- accept: accept,
1375
- minSize: minSize,
1376
- maxSize: maxSize,
1377
- multiple: multiple,
1378
- maxFiles: maxFiles
1379
- });
1380
- var isDragReject = fileCount > 0 && !isDragAccept;
1381
- return _objectSpread(_objectSpread({}, state), {}, {
1382
- isDragAccept: isDragAccept,
1383
- isDragReject: isDragReject,
1384
- isFocused: isFocused && !disabled,
1385
- getRootProps: getRootProps,
1386
- getInputProps: getInputProps,
1387
- rootRef: rootRef,
1388
- inputRef: inputRef,
1389
- open: composeHandler(openFileDialog)
1390
- });
1391
- }
1392
-
1393
- function reducer(state, action) {
1394
- /* istanbul ignore next */
1395
- switch (action.type) {
1396
- case 'focus':
1397
- return _objectSpread(_objectSpread({}, state), {}, {
1398
- isFocused: true
1399
- });
1400
-
1401
- case 'blur':
1402
- return _objectSpread(_objectSpread({}, state), {}, {
1403
- isFocused: false
1404
- });
1405
-
1406
- case 'openDialog':
1407
- return _objectSpread(_objectSpread({}, initialState), {}, {
1408
- isFileDialogActive: true
1409
- });
1410
-
1411
- case 'closeDialog':
1412
- return _objectSpread(_objectSpread({}, state), {}, {
1413
- isFileDialogActive: false
1414
- });
1415
-
1416
- case 'setDraggedFiles':
1417
- /* eslint no-case-declarations: 0 */
1418
- var isDragActive = action.isDragActive,
1419
- draggedFiles = action.draggedFiles;
1420
- return _objectSpread(_objectSpread({}, state), {}, {
1421
- draggedFiles: draggedFiles,
1422
- isDragActive: isDragActive
1423
- });
1424
-
1425
- case 'setFiles':
1426
- return _objectSpread(_objectSpread({}, state), {}, {
1427
- acceptedFiles: action.acceptedFiles,
1428
- fileRejections: action.fileRejections
1429
- });
1430
-
1431
- case 'reset':
1432
- return _objectSpread({}, initialState);
1433
-
1434
- default:
1435
- return state;
1436
- }
1437
- }
1438
-
1439
- function noop() {}
1440
-
1441
- var styles = {"dropZoneBase":"grljXfTWj84-","dropZone":"WHhHWgaoXk4-","active":"n1h-T2metRA-","error":"MRRclAp51-w-","validationErrors":"TIbSRNvDK10-"};
1442
-
1443
- function InputFile({ variation = "dropzone", size = "base", buttonLabel: providedButtonLabel, allowMultiple = false, allowedTypes = "all", getUploadParams, onUploadStart, onUploadProgress, onUploadComplete, onUploadError, validator, }) {
1444
- const options = {
1445
- multiple: allowMultiple,
1446
- onDrop: useCallback(handleDrop, [uploadFile]),
1447
- validator: validator && useCallback(validator, []),
1448
- };
1449
- if (allowedTypes === "images") {
1450
- options.accept = "image/*";
1451
- }
1452
- else if (allowedTypes === "basicImages") {
1453
- options.accept = "image/png, image/jpg, image/jpeg";
1454
- }
1455
- else if (Array.isArray(allowedTypes)) {
1456
- options.accept = allowedTypes.join(",");
1457
- }
1458
- const { getRootProps, getInputProps, isDragActive, fileRejections } = useDropzone(options);
1459
- const validationErrors = fileRejections === null || fileRejections === void 0 ? void 0 : fileRejections.map(({ file, errors }) => {
1460
- return errors.map(error => {
1461
- return (React.createElement(InputValidation, { message: `${file.name} ${error.message}`, key: `${file.name}${error.code}` }));
1462
- });
1463
- });
1464
- const { buttonLabel, hintText } = getLabels(providedButtonLabel, allowMultiple, allowedTypes);
1465
- const dropZone = classnames(styles.dropZoneBase, {
1466
- [styles.dropZone]: variation === "dropzone",
1467
- [styles.active]: isDragActive,
1468
- [styles.error]: (fileRejections === null || fileRejections === void 0 ? void 0 : fileRejections.length) > 0,
1469
- });
1470
- return (React.createElement(React.Fragment, null,
1471
- React.createElement("div", Object.assign({}, getRootProps({ className: dropZone }), { tabIndex: variation === "button" ? -1 : 0 }),
1472
- React.createElement("input", Object.assign({}, getInputProps())),
1473
- variation === "dropzone" && (React.createElement(Content, { spacing: "small" },
1474
- React.createElement(Button, { label: buttonLabel, size: "small", type: "secondary" }),
1475
- size === "base" && (React.createElement(Typography, { size: "small", textColor: "textSecondary" }, hintText)))),
1476
- variation === "button" && (React.createElement(Button, { label: buttonLabel, size: size, type: "secondary", fullWidth: true }))),
1477
- (fileRejections === null || fileRejections === void 0 ? void 0 : fileRejections.length) > 0 && (React.createElement("div", { className: styles.validationErrors }, validationErrors))));
1478
- function handleDrop(acceptedFiles) {
1479
- acceptedFiles.forEach(file => {
1480
- uploadFile(file);
1481
- });
1482
- }
1483
- function uploadFile(file) {
1484
- return __awaiter(this, void 0, void 0, function* () {
1485
- let params;
1486
- try {
1487
- params = yield getUploadParams(file);
1488
- }
1489
- catch (_a) {
1490
- onUploadError && onUploadError(new Error("Failed to get upload params"));
1491
- return;
1492
- }
1493
- const { url, key = generateId(), fields = {}, httpMethod = "POST", } = params;
1494
- const fileUpload = getFileUpload(file, key, url);
1495
- onUploadStart && onUploadStart(Object.assign({}, fileUpload));
1496
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1497
- const handleUploadProgress = (progressEvent) => {
1498
- onUploadProgress &&
1499
- onUploadProgress(Object.assign(Object.assign({}, fileUpload), { progress: progressEvent.loaded / progressEvent.total }));
1500
- };
1501
- const handleUploadComplete = () => {
1502
- onUploadComplete === null || onUploadComplete === void 0 ? void 0 : onUploadComplete(Object.assign(Object.assign({}, fileUpload), { progress: 1 }));
1503
- };
1504
- const axiosConfig = createAxiosConfig({
1505
- url,
1506
- httpMethod,
1507
- fields,
1508
- file,
1509
- handleUploadProgress,
1510
- });
1511
- axios
1512
- .request(axiosConfig)
1513
- .then(handleUploadComplete)
1514
- .catch(() => {
1515
- onUploadError && onUploadError(new Error("Failed to upload file"));
1516
- });
1517
- });
1518
- }
1519
- }
1520
- function createAxiosConfig({ url, httpMethod = "POST", fields = {}, file, handleUploadProgress, }) {
1521
- let data;
1522
- let headers;
1523
- if (httpMethod === "POST") {
1524
- const formData = new FormData();
1525
- Object.entries(fields).forEach(([field, value]) => formData.append(field, value));
1526
- formData.append("file", file);
1527
- data = formData;
1528
- headers = { "X-Requested-With": "XMLHttpRequest" };
1529
- }
1530
- else {
1531
- data = file;
1532
- headers = fields;
1533
- }
1534
- return {
1535
- method: httpMethod,
1536
- url: url,
1537
- headers: headers,
1538
- data: data,
1539
- onUploadProgress: handleUploadProgress,
1540
- };
1541
- }
1542
- function getLabels(providedButtonLabel, multiple, allowedTypes) {
1543
- let buttonLabel = multiple ? "Upload Files" : "Upload File";
1544
- let hintText = multiple
1545
- ? "or drag files here to upload"
1546
- : "or drag a file here to upload";
1547
- if (allowedTypes === "images" || allowedTypes === "basicImages") {
1548
- buttonLabel = multiple ? "Upload Images" : "Upload Image";
1549
- hintText = multiple
1550
- ? "or drag images here to upload"
1551
- : "or drag an image here to upload";
1552
- }
1553
- if (providedButtonLabel)
1554
- buttonLabel = providedButtonLabel;
1555
- return { buttonLabel, hintText };
1556
- }
1557
- function getFileUpload(file, key, uploadUrl) {
1558
- return {
1559
- key: key,
1560
- name: file.name,
1561
- type: file.type,
1562
- size: file.size,
1563
- progress: 0,
1564
- src: getSrc,
1565
- uploadUrl,
1566
- };
1567
- function getSrc() {
1568
- const promise = new Promise((resolve, reject) => {
1569
- const reader = new FileReader();
1570
- reader.onload = event => {
1571
- if (event.target &&
1572
- event.target.result &&
1573
- typeof event.target.result === "string") {
1574
- resolve(event.target.result);
1575
- }
1576
- else {
1577
- reject("Could not generate file data url.");
1578
- }
1579
- };
1580
- reader.readAsDataURL(file);
1581
- });
1582
- return promise;
1583
- }
1584
- }
1585
- /**
1586
- * Upsert a given `FileUpload` into an array of `FileUpload`s.
1587
- * `key` is used to uniquely identify files.
1588
- *
1589
- * @param updatedFile FileUpload File that was updated.
1590
- * @param files Existing array of FileUploads.
1591
- * @returns FileUpload[] updated set of files.
1592
- */
1593
- function updateFiles(updatedFile, files) {
1594
- const newFiles = [...files];
1595
- const index = files.findIndex(file => file.key === updatedFile.key);
1596
- if (index !== -1) {
1597
- newFiles[index] = updatedFile;
1598
- }
1599
- else {
1600
- newFiles.push(updatedFile);
1601
- }
1602
- return newFiles;
1603
- }
1604
- function generateId() {
1605
- return Math.floor(Math.random() * Date.now()).toString(16);
1606
- }
1607
-
1608
- export { InputFile as I, updateFiles as u };