@jobber/components 4.85.6-CJS-to-ESM.5 → 4.85.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 (629) hide show
  1. package/README.md +0 -4
  2. package/dist/AnimatedPresence/{index.cjs → index.js} +3 -1
  3. package/dist/{AnimatedPresence-DFaAEYUa.js → AnimatedPresence-20a02aaa.js} +7 -3
  4. package/dist/AnimatedSwitcher/index.js +13 -0
  5. package/dist/{AnimatedSwitcher-UmlTf067.js → AnimatedSwitcher-3d45ec5d.js} +8 -4
  6. package/dist/Autocomplete/index.js +209 -0
  7. package/dist/Avatar/index.js +15 -0
  8. package/dist/Avatar-76a799fa.js +78 -0
  9. package/dist/Banner/index.js +110 -0
  10. package/dist/Button/index.js +16 -0
  11. package/dist/Button-b73a5e01.js +57 -0
  12. package/dist/ButtonDismiss/index.js +17 -0
  13. package/dist/ButtonDismiss-350af163.js +14 -0
  14. package/dist/Card/index.js +24 -0
  15. package/dist/{Card-BeL8rCSY.js → Card-e3144022.js} +25 -20
  16. package/dist/Checkbox/index.js +18 -0
  17. package/dist/Checkbox-787e2e47.js +63 -0
  18. package/dist/Chip/index.js +41 -0
  19. package/dist/Chip-3d1bfddc.js +89 -0
  20. package/dist/Chips/index.js +524 -0
  21. package/dist/Combobox/index.js +40 -0
  22. package/dist/Combobox-a24c8241.js +479 -0
  23. package/dist/ConfirmationModal/index.js +31 -0
  24. package/dist/{ConfirmationModal-Bg7ftIT2.js → ConfirmationModal-52e16873.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 +1335 -0
  30. package/dist/DataTable/index.js +301 -0
  31. package/dist/DatePicker/index.js +20 -0
  32. package/dist/DatePicker-64c5ab1a.js +134 -0
  33. package/dist/DescriptionList/index.js +24 -0
  34. package/dist/Disclosure/index.js +46 -0
  35. package/dist/{Divider-Dt_qE9xe.js → Divider/index.js} +11 -4
  36. package/dist/Drawer/index.js +49 -0
  37. package/dist/Emphasis/index.js +13 -0
  38. package/dist/Emphasis-bda56d3b.js +19 -0
  39. package/dist/FeatureSwitch/index.js +70 -0
  40. package/dist/Flex/index.js +12 -0
  41. package/dist/{Flex-CBKf3epb.js → Flex-d490c4db.js} +8 -3
  42. package/dist/{Form-ChkdN1bx.js → Form/index.js} +9 -3
  43. package/dist/FormField/index.js +24 -0
  44. package/dist/FormField-6ff183f8.js +253 -0
  45. package/dist/FormatDate/{index.cjs → index.js} +3 -1
  46. package/dist/{FormatDate-BzJETLja.js → FormatDate-70ea5b43.js} +5 -1
  47. package/dist/FormatEmail/index.js +23 -0
  48. package/dist/FormatFile/index.js +36 -0
  49. package/dist/FormatFile-f036902d.js +162 -0
  50. package/dist/{FormatRelativeDateTime-COgItrYT.js → FormatRelativeDateTime/index.js} +11 -5
  51. package/dist/{FormatTime-CfcVslez.js → FormatTime/index.js} +7 -1
  52. package/dist/Gallery/index.js +99 -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 +14 -0
  57. package/dist/{Heading-suKDLmO4.js → Heading-1e8e4bd3.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-a6557829.js +28 -0
  62. package/dist/InputAvatar/index.js +70 -0
  63. package/dist/InputDate/index.js +57 -0
  64. package/dist/InputEmail/index.js +43 -0
  65. package/dist/InputFile/index.js +25 -0
  66. package/dist/InputFile-bb945071.js +190 -0
  67. package/dist/InputGroup/index.js +12 -0
  68. package/dist/{InputGroup-Bljb97cw.js → InputGroup-8d4fd4eb.js} +10 -5
  69. package/dist/InputNumber/index.js +25 -0
  70. package/dist/{InputNumber-B0sa7sL7.js → InputNumber-d451b52e.js} +6 -2
  71. package/dist/InputPassword/index.js +41 -0
  72. package/dist/{InputPhoneNumber-Bv3OG77a.js → InputPhoneNumber/index.js} +25 -8
  73. package/dist/InputText/index.js +26 -0
  74. package/dist/{InputText--fuxI6yf.js → InputText-55b6cb65.js} +8 -4
  75. package/dist/{InputTime-BcgwlVsy.js → InputTime/index.js} +25 -5
  76. package/dist/InputValidation/index.js +17 -0
  77. package/dist/InputValidation-05e839fa.js +29 -0
  78. package/dist/LightBox/index.js +24 -0
  79. package/dist/LightBox-a89d8863.js +117 -0
  80. package/dist/Link/index.js +15 -0
  81. package/dist/List/index.d.ts +1 -1
  82. package/dist/List/index.js +93 -0
  83. package/dist/Markdown/index.js +19 -0
  84. package/dist/Markdown-f7c55304.js +62 -0
  85. package/dist/Menu/index.js +21 -0
  86. package/dist/Menu-083fc4c4.js +139 -0
  87. package/dist/Modal/index.js +25 -0
  88. package/dist/Modal-c336cac6.js +71 -0
  89. package/dist/{MultiSelect-D_-_TiTD.js → MultiSelect/index.js} +27 -16
  90. package/dist/Option-3c4d377e.js +19 -0
  91. package/dist/Page/index.js +78 -0
  92. package/dist/Popover/index.js +61 -0
  93. package/dist/ProgressBar/index.js +12 -0
  94. package/dist/ProgressBar-b68edc8f.js +43 -0
  95. package/dist/RadioGroup/index.js +15 -0
  96. package/dist/RadioGroup-17b67ade.js +46 -0
  97. package/dist/RecurringSelect/index.js +227 -0
  98. package/dist/Select/index.js +26 -0
  99. package/dist/Spinner/index.js +12 -0
  100. package/dist/Spinner-9d8fc7ff.js +24 -0
  101. package/dist/StatusIndicator/index.js +11 -0
  102. package/dist/StatusIndicator-b179d06e.js +18 -0
  103. package/dist/StatusLabel/index.js +29 -0
  104. package/dist/Switch/index.js +13 -0
  105. package/dist/Switch-7d4aa7c3.js +56 -0
  106. package/dist/Table/index.js +66 -0
  107. package/dist/Tabs/index.js +80 -0
  108. package/dist/Text/index.js +13 -0
  109. package/dist/{Text-D9gsHxbp.js → Text-259af966.js} +6 -2
  110. package/dist/Toast/index.js +111 -0
  111. package/dist/Tooltip/index.js +16 -0
  112. package/dist/{Tooltip-BEW-a9OW.js → Tooltip-ef3d6ef4.js} +18 -12
  113. package/dist/Typography/index.js +12 -0
  114. package/dist/Typography-c45bf216.js +62 -0
  115. package/dist/tslib.es6-754e2961.js +46 -0
  116. package/package.json +9 -382
  117. package/{rollup.config.mjs → rollup.config.js} +20 -27
  118. package/dist/AnimatedPresence/index.mjs +0 -4
  119. package/dist/AnimatedPresence-D73apgLB.js +0 -98
  120. package/dist/AnimatedSwitcher/index.cjs +0 -11
  121. package/dist/AnimatedSwitcher/index.mjs +0 -5
  122. package/dist/AnimatedSwitcher-B4fUExeN.js +0 -90
  123. package/dist/Autocomplete/index.cjs +0 -33
  124. package/dist/Autocomplete/index.mjs +0 -27
  125. package/dist/Autocomplete-1iO7JRX2.js +0 -190
  126. package/dist/Autocomplete-CfntbJ6I.js +0 -188
  127. package/dist/Avatar/index.cjs +0 -13
  128. package/dist/Avatar/index.mjs +0 -7
  129. package/dist/Avatar-DZCQBKMr.js +0 -70
  130. package/dist/Avatar-Q2BQymsE.js +0 -72
  131. package/dist/Banner/components/BannerIcon/index.cjs +0 -13
  132. package/dist/Banner/components/BannerIcon/index.mjs +0 -7
  133. package/dist/Banner/index.cjs +0 -23
  134. package/dist/Banner/index.mjs +0 -17
  135. package/dist/Banner-9-5fXphG.js +0 -82
  136. package/dist/Banner-QqoLHMka.js +0 -84
  137. package/dist/BannerIcon-QB3lZddm.js +0 -24
  138. package/dist/BannerIcon-YIreWKuC.js +0 -27
  139. package/dist/Body-DMRyfeGa.js +0 -59
  140. package/dist/Body-Dd2-HEDo.js +0 -50
  141. package/dist/Button/index.cjs +0 -14
  142. package/dist/Button/index.mjs +0 -8
  143. package/dist/Button-CWVwgwhn.js +0 -50
  144. package/dist/Button-D3mW3Hcg.js +0 -52
  145. package/dist/ButtonDismiss/index.cjs +0 -15
  146. package/dist/ButtonDismiss/index.mjs +0 -9
  147. package/dist/ButtonDismiss-GLptCaNc.js +0 -8
  148. package/dist/ButtonDismiss-l6Kunmen.js +0 -10
  149. package/dist/Card/index.cjs +0 -22
  150. package/dist/Card/index.mjs +0 -16
  151. package/dist/Card-DQB6rhwZ.js +0 -86
  152. package/dist/Checkbox/index.cjs +0 -16
  153. package/dist/Checkbox/index.mjs +0 -10
  154. package/dist/Checkbox-C78HDAVJ.js +0 -58
  155. package/dist/Checkbox-qsepteuE.js +0 -56
  156. package/dist/Chip/hooks/index.cjs +0 -8
  157. package/dist/Chip/hooks/index.mjs +0 -2
  158. package/dist/Chip/index.cjs +0 -27
  159. package/dist/Chip/index.mjs +0 -19
  160. package/dist/Chip-Cvuqhi_q.js +0 -70
  161. package/dist/Chip-DSy6Xm8R.js +0 -73
  162. package/dist/ChipDismissible-BtVU1TDW.js +0 -22
  163. package/dist/ChipDismissible-C8X7PyuZ.js +0 -19
  164. package/dist/Chips/InternalChipDismissible/hooks/index.cjs +0 -23
  165. package/dist/Chips/InternalChipDismissible/hooks/index.mjs +0 -13
  166. package/dist/Chips/InternalChipDismissible/index.cjs +0 -35
  167. package/dist/Chips/InternalChipDismissible/index.mjs +0 -29
  168. package/dist/Chips/index.cjs +0 -48
  169. package/dist/Chips/index.mjs +0 -44
  170. package/dist/Chips-DbF1Sm6B.js +0 -91
  171. package/dist/Chips-PXZl-nIG.js +0 -93
  172. package/dist/Combobox/components/ComboboxAction/index.cjs +0 -13
  173. package/dist/Combobox/components/ComboboxAction/index.mjs +0 -7
  174. package/dist/Combobox/components/ComboboxActivator/index.cjs +0 -28
  175. package/dist/Combobox/components/ComboboxActivator/index.mjs +0 -22
  176. package/dist/Combobox/components/ComboboxContent/ComboboxContentHeader/index.cjs +0 -15
  177. package/dist/Combobox/components/ComboboxContent/ComboboxContentHeader/index.mjs +0 -9
  178. package/dist/Combobox/components/ComboboxContent/ComboboxContentList/index.cjs +0 -26
  179. package/dist/Combobox/components/ComboboxContent/ComboboxContentList/index.mjs +0 -20
  180. package/dist/Combobox/components/ComboboxContent/ComboboxContentSearch/index.cjs +0 -11
  181. package/dist/Combobox/components/ComboboxContent/ComboboxContentSearch/index.mjs +0 -5
  182. package/dist/Combobox/components/ComboboxContent/ComboboxLoadMore/index.cjs +0 -11
  183. package/dist/Combobox/components/ComboboxContent/ComboboxLoadMore/index.mjs +0 -5
  184. package/dist/Combobox/components/ComboboxContent/index.cjs +0 -36
  185. package/dist/Combobox/components/ComboboxContent/index.mjs +0 -30
  186. package/dist/Combobox/components/ComboboxOption/index.cjs +0 -15
  187. package/dist/Combobox/components/ComboboxOption/index.mjs +0 -9
  188. package/dist/Combobox/components/ComboboxTrigger/index.cjs +0 -26
  189. package/dist/Combobox/components/ComboboxTrigger/index.mjs +0 -20
  190. package/dist/Combobox/index.cjs +0 -53
  191. package/dist/Combobox/index.mjs +0 -46
  192. package/dist/Combobox-CL1tRKd3.js +0 -122
  193. package/dist/Combobox-D44taKUg.js +0 -120
  194. package/dist/ComboboxAction-B3RwsCtx.js +0 -27
  195. package/dist/ComboboxAction-BzEwYtPm.js +0 -25
  196. package/dist/ComboboxActivator-D41tfwAg.js +0 -26
  197. package/dist/ComboboxActivator-DT29yQ2v.js +0 -28
  198. package/dist/ComboboxContent-BRgUJ7J4.js +0 -144
  199. package/dist/ComboboxContent-C3MIJd9a.js +0 -146
  200. package/dist/ComboboxContentHeader-CJ0if4JI.js +0 -32
  201. package/dist/ComboboxContentHeader-DFLlxg-X.js +0 -30
  202. package/dist/ComboboxContentList-B_KlRjj7.js +0 -78
  203. package/dist/ComboboxContentList-wTyr0j1u.js +0 -80
  204. package/dist/ComboboxContentSearch-B8hsfo_D.js +0 -35
  205. package/dist/ComboboxContentSearch-UAyHetvM.js +0 -37
  206. package/dist/ComboboxLoadMore-Bfg4pEkg.js +0 -19
  207. package/dist/ComboboxLoadMore-CBXYoxXv.js +0 -17
  208. package/dist/ComboboxOption-CWkyTkzU.js +0 -25
  209. package/dist/ComboboxOption-D_f4NcBM.js +0 -23
  210. package/dist/ComboboxProvider-BwxfVgmL.js +0 -13
  211. package/dist/ComboboxProvider-Dm_tfmkr.js +0 -10
  212. package/dist/ComboboxTrigger-DdG9k28y.js +0 -22
  213. package/dist/ComboboxTrigger-zTO01W3n.js +0 -24
  214. package/dist/ConfirmationModal/index.cjs +0 -32
  215. package/dist/ConfirmationModal/index.mjs +0 -26
  216. package/dist/ConfirmationModal-CrH9KKYd.js +0 -94
  217. package/dist/Content/index.cjs +0 -10
  218. package/dist/Content/index.mjs +0 -4
  219. package/dist/Content-B8Od1cqS.js +0 -20
  220. package/dist/Content-BknIp35w.js +0 -18
  221. package/dist/Countdown/index.cjs +0 -11
  222. package/dist/Countdown/index.mjs +0 -5
  223. package/dist/Countdown-6Bkj7xkV.js +0 -659
  224. package/dist/Countdown-XLp-r4PS.js +0 -657
  225. package/dist/DataDump/index.cjs +0 -25
  226. package/dist/DataDump/index.mjs +0 -19
  227. package/dist/DataDump-BQOPiKBi.js +0 -15
  228. package/dist/DataDump-DFesmG7X.js +0 -17
  229. package/dist/DataList/components/DataListAction/index.cjs +0 -14
  230. package/dist/DataList/components/DataListAction/index.mjs +0 -8
  231. package/dist/DataList/components/DataListActions/index.cjs +0 -43
  232. package/dist/DataList/components/DataListActions/index.mjs +0 -37
  233. package/dist/DataList/components/DataListActionsMenu/index.cjs +0 -16
  234. package/dist/DataList/components/DataListActionsMenu/index.mjs +0 -10
  235. package/dist/DataList/components/DataListBulkActions/index.cjs +0 -46
  236. package/dist/DataList/components/DataListBulkActions/index.mjs +0 -39
  237. package/dist/DataList/components/DataListEmptyState/index.cjs +0 -21
  238. package/dist/DataList/components/DataListEmptyState/index.mjs +0 -14
  239. package/dist/DataList/components/DataListFilters/components/DataListSort/index.cjs +0 -54
  240. package/dist/DataList/components/DataListFilters/components/DataListSort/index.mjs +0 -48
  241. package/dist/DataList/components/DataListFilters/index.cjs +0 -68
  242. package/dist/DataList/components/DataListFilters/index.mjs +0 -61
  243. package/dist/DataList/components/DataListHeader/index.cjs +0 -53
  244. package/dist/DataList/components/DataListHeader/index.mjs +0 -47
  245. package/dist/DataList/components/DataListHeaderTile/components/index.cjs +0 -13
  246. package/dist/DataList/components/DataListHeaderTile/components/index.mjs +0 -7
  247. package/dist/DataList/components/DataListHeaderTile/index.cjs +0 -21
  248. package/dist/DataList/components/DataListHeaderTile/index.mjs +0 -15
  249. package/dist/DataList/components/DataListItem/components/DataListItemClickable/index.cjs +0 -15
  250. package/dist/DataList/components/DataListItem/components/DataListItemClickable/index.mjs +0 -9
  251. package/dist/DataList/components/DataListItem/index.cjs +0 -52
  252. package/dist/DataList/components/DataListItem/index.mjs +0 -46
  253. package/dist/DataList/components/DataListItemActions/index.cjs +0 -45
  254. package/dist/DataList/components/DataListItemActions/index.mjs +0 -38
  255. package/dist/DataList/components/DataListItemActionsOverflow/index.cjs +0 -25
  256. package/dist/DataList/components/DataListItemActionsOverflow/index.mjs +0 -19
  257. package/dist/DataList/components/DataListItems/index.cjs +0 -53
  258. package/dist/DataList/components/DataListItems/index.mjs +0 -47
  259. package/dist/DataList/components/DataListLayout/index.cjs +0 -56
  260. package/dist/DataList/components/DataListLayout/index.mjs +0 -50
  261. package/dist/DataList/components/DataListLayoutActions/DataListLayoutContext/index.cjs +0 -9
  262. package/dist/DataList/components/DataListLayoutActions/DataListLayoutContext/index.mjs +0 -2
  263. package/dist/DataList/components/DataListLayoutActions/index.cjs +0 -33
  264. package/dist/DataList/components/DataListLayoutActions/index.mjs +0 -27
  265. package/dist/DataList/components/DataListLoadMore/index.cjs +0 -22
  266. package/dist/DataList/components/DataListLoadMore/index.mjs +0 -15
  267. package/dist/DataList/components/DataListLoadingState/index.cjs +0 -22
  268. package/dist/DataList/components/DataListLoadingState/index.mjs +0 -14
  269. package/dist/DataList/components/DataListOverflowFade/index.cjs +0 -13
  270. package/dist/DataList/components/DataListOverflowFade/index.mjs +0 -6
  271. package/dist/DataList/components/DataListSearch/index.cjs +0 -34
  272. package/dist/DataList/components/DataListSearch/index.mjs +0 -26
  273. package/dist/DataList/components/DataListStatusBar/index.cjs +0 -32
  274. package/dist/DataList/components/DataListStatusBar/index.mjs +0 -25
  275. package/dist/DataList/components/DataListStickyHeader/index.cjs +0 -12
  276. package/dist/DataList/components/DataListStickyHeader/index.mjs +0 -6
  277. package/dist/DataList/components/DataListTags/index.cjs +0 -13
  278. package/dist/DataList/components/DataListTags/index.mjs +0 -7
  279. package/dist/DataList/components/DataListTotalCount/index.cjs +0 -16
  280. package/dist/DataList/components/DataListTotalCount/index.mjs +0 -9
  281. package/dist/DataList/context/DataListContext/index.cjs +0 -12
  282. package/dist/DataList/context/DataListContext/index.mjs +0 -4
  283. package/dist/DataList/context/DataListLayoutContext/index.cjs +0 -12
  284. package/dist/DataList/context/DataListLayoutContext/index.mjs +0 -4
  285. package/dist/DataList/index.cjs +0 -98
  286. package/dist/DataList/index.mjs +0 -92
  287. package/dist/DataList-BL3zeA83.js +0 -9
  288. package/dist/DataList-D8rsiB6p.js +0 -7
  289. package/dist/DataList-DqrdT8B4.js +0 -141
  290. package/dist/DataList-jYncUjun.js +0 -139
  291. package/dist/DataList.const-Wz370ukq.js +0 -25
  292. package/dist/DataList.const-YbvF2-QB.js +0 -38
  293. package/dist/DataList.utils-BdHYuwRY.js +0 -161
  294. package/dist/DataList.utils-DTLgRGnD.js +0 -168
  295. package/dist/DataListAction-CMZbwbN5.js +0 -40
  296. package/dist/DataListAction-CzSLV230.js +0 -42
  297. package/dist/DataListActions-CeuvLm4e.js +0 -45
  298. package/dist/DataListActions-D8cejFpY.js +0 -43
  299. package/dist/DataListActionsMenu-BOJ6GBFf.js +0 -55
  300. package/dist/DataListActionsMenu-BtZsN7F7.js +0 -53
  301. package/dist/DataListBulkActions-B3SNmDzL.js +0 -29
  302. package/dist/DataListBulkActions-DWmugOCQ.js +0 -32
  303. package/dist/DataListContext-9uw8XwzP.js +0 -25
  304. package/dist/DataListContext-B4eBw_aH.js +0 -29
  305. package/dist/DataListEmptyState-B7Yug5IF.js +0 -56
  306. package/dist/DataListEmptyState-bCN6CJ0x.js +0 -53
  307. package/dist/DataListFilters-C8PRbG6B.js +0 -46
  308. package/dist/DataListFilters-z4r0b_mz.js +0 -43
  309. package/dist/DataListHeader-Baxtt1sP.js +0 -95
  310. package/dist/DataListHeader-CnTJFwdL.js +0 -93
  311. package/dist/DataListHeaderTile-Bmb-3jk4.js +0 -86
  312. package/dist/DataListHeaderTile-CawTnwxZ.js +0 -84
  313. package/dist/DataListItem-6Ir3bY1S.js +0 -112
  314. package/dist/DataListItem-CVmLNaR9.js +0 -114
  315. package/dist/DataListItemActions-BD5YP_HQ.js +0 -32
  316. package/dist/DataListItemActions-BDMYnI5D.js +0 -35
  317. package/dist/DataListItemActionsOverflow-Cv89cyOn.js +0 -33
  318. package/dist/DataListItemActionsOverflow-jnHamzf7.js +0 -35
  319. package/dist/DataListItemClickable-8iEm6BU0.js +0 -45
  320. package/dist/DataListItemClickable-BZ7u37GY.js +0 -47
  321. package/dist/DataListItems-C2afygvC.js +0 -21
  322. package/dist/DataListItems-CSygcFMR.js +0 -19
  323. package/dist/DataListLayout-DVVdPvCC.js +0 -19
  324. package/dist/DataListLayout-KiPC1zwI.js +0 -21
  325. package/dist/DataListLayoutActions-AijXG655.js +0 -41
  326. package/dist/DataListLayoutActions-DrTY5Ejw.js +0 -39
  327. package/dist/DataListLayoutContext-CavOWAD3.js +0 -14
  328. package/dist/DataListLayoutContext-D3REliDa.js +0 -8
  329. package/dist/DataListLayoutContext-DT0mtKzt.js +0 -11
  330. package/dist/DataListLayoutContext-DvTtBMxW.js +0 -18
  331. package/dist/DataListLoadMore-BgEh97cj.js +0 -37
  332. package/dist/DataListLoadMore-RU8ynOhk.js +0 -34
  333. package/dist/DataListLoadingState-Bvrt8fF7.js +0 -25
  334. package/dist/DataListLoadingState-Cm3mAc4V.js +0 -29
  335. package/dist/DataListOverflowFade-BZk4jUAc.js +0 -28
  336. package/dist/DataListOverflowFade-DqAHrxFC.js +0 -25
  337. package/dist/DataListSearch-2s_UETky.js +0 -62
  338. package/dist/DataListSearch-P9-j_TtT.js +0 -66
  339. package/dist/DataListSort-BPIPnVXL.js +0 -94
  340. package/dist/DataListSort-D1Ng8x7t.js +0 -92
  341. package/dist/DataListSortingOptions-Ciu5gWGt.js +0 -38
  342. package/dist/DataListSortingOptions-SfZWLgFS.js +0 -40
  343. package/dist/DataListStatusBar-BZHyp6Ep.js +0 -22
  344. package/dist/DataListStatusBar-D-j7Wk18.js +0 -25
  345. package/dist/DataListStickyHeader-BKN9V51R.js +0 -28
  346. package/dist/DataListStickyHeader-CCG09E7V.js +0 -26
  347. package/dist/DataListTags-C5inHFOR.js +0 -67
  348. package/dist/DataListTags-CHZr9DW3.js +0 -65
  349. package/dist/DataListTotalCount-B9K3hGqp.js +0 -30
  350. package/dist/DataListTotalCount-Dzzm_buN.js +0 -27
  351. package/dist/DataTable/index.cjs +0 -37
  352. package/dist/DataTable/index.mjs +0 -26
  353. package/dist/DataTable/test-utilities/index.cjs +0 -246
  354. package/dist/DataTable/test-utilities/index.mjs +0 -238
  355. package/dist/DataTable-CMTFBvO6.js +0 -247
  356. package/dist/DataTable-D0MIpeXc.js +0 -245
  357. package/dist/DatePicker/index.cjs +0 -26
  358. package/dist/DatePicker/index.mjs +0 -20
  359. package/dist/DatePicker-2adKo5uq.js +0 -8547
  360. package/dist/DatePicker-BiU7Sr6B.js +0 -8544
  361. package/dist/DayOfMonthSelect--s7Ry-jx.js +0 -141
  362. package/dist/DayOfMonthSelect-UlE6seGW.js +0 -148
  363. package/dist/DescriptionList/index.cjs +0 -11
  364. package/dist/DescriptionList/index.mjs +0 -5
  365. package/dist/DescriptionList-CBeTDl49.js +0 -15
  366. package/dist/DescriptionList-DBENvQT5.js +0 -17
  367. package/dist/Disclosure/index.cjs +0 -18
  368. package/dist/Disclosure/index.mjs +0 -12
  369. package/dist/Disclosure-CWNmDoE_.js +0 -38
  370. package/dist/Disclosure-CXQ8I0Xh.js +0 -36
  371. package/dist/Divider/index.cjs +0 -10
  372. package/dist/Divider/index.mjs +0 -4
  373. package/dist/Divider-DOmpOAKU.js +0 -20
  374. package/dist/Drawer/index.cjs +0 -19
  375. package/dist/Drawer/index.mjs +0 -12
  376. package/dist/DrawerGrid-Bg9ydPFR.js +0 -33
  377. package/dist/DrawerGrid-DM3WKmX6.js +0 -36
  378. package/dist/Emphasis/index.cjs +0 -11
  379. package/dist/Emphasis/index.mjs +0 -5
  380. package/dist/Emphasis-B3vf8Ek9.js +0 -15
  381. package/dist/Emphasis-xxFrrT2i.js +0 -13
  382. package/dist/FeatureSwitch/index.cjs +0 -27
  383. package/dist/FeatureSwitch/index.mjs +0 -21
  384. package/dist/FeatureSwitch-C6OjQJWH.js +0 -57
  385. package/dist/FeatureSwitch-Dt8VXcE6.js +0 -55
  386. package/dist/Flex/index.cjs +0 -10
  387. package/dist/Flex/index.mjs +0 -4
  388. package/dist/Flex-DXDpEzMI.js +0 -31
  389. package/dist/Form/index.cjs +0 -10
  390. package/dist/Form/index.mjs +0 -4
  391. package/dist/Form-Dd9YKBh-.js +0 -48
  392. package/dist/FormField/index.cjs +0 -21
  393. package/dist/FormField/index.mjs +0 -15
  394. package/dist/FormField-D2Dlrypi.js +0 -296
  395. package/dist/FormField-hCrwUWca.js +0 -298
  396. package/dist/FormatDate/index.mjs +0 -2
  397. package/dist/FormatDate-Dxs33-Xj.js +0 -27
  398. package/dist/FormatEmail/index.cjs +0 -10
  399. package/dist/FormatEmail/index.mjs +0 -4
  400. package/dist/FormatEmail-BH1qM7Va.js +0 -16
  401. package/dist/FormatEmail-_Ytrq7mn.js +0 -14
  402. package/dist/FormatFile/index.cjs +0 -37
  403. package/dist/FormatFile/index.mjs +0 -31
  404. package/dist/FormatFile-BEsZX9CU.js +0 -154
  405. package/dist/FormatFile-BhY6M5LN.js +0 -156
  406. package/dist/FormatRelativeDateTime/index.cjs +0 -8
  407. package/dist/FormatRelativeDateTime/index.mjs +0 -2
  408. package/dist/FormatRelativeDateTime-DTnQraIq.js +0 -64
  409. package/dist/FormatTime/index.cjs +0 -8
  410. package/dist/FormatTime/index.mjs +0 -2
  411. package/dist/FormatTime-BGr7_DaA.js +0 -28
  412. package/dist/Gallery/index.cjs +0 -42
  413. package/dist/Gallery/index.mjs +0 -36
  414. package/dist/Gallery-BfEW11YL.js +0 -66
  415. package/dist/Gallery-kWVZNTYq.js +0 -68
  416. package/dist/Glimmer/index.cjs +0 -13
  417. package/dist/Glimmer/index.mjs +0 -6
  418. package/dist/Glimmer-Cgcy2Ruw.js +0 -72
  419. package/dist/Glimmer-Dz1E9Bo5.js +0 -69
  420. package/dist/Grid/InternalGridCell/index.cjs +0 -10
  421. package/dist/Grid/InternalGridCell/index.mjs +0 -3
  422. package/dist/Grid/index.cjs +0 -15
  423. package/dist/Grid/index.mjs +0 -8
  424. package/dist/Grid-InsV4yVr.js +0 -34
  425. package/dist/Grid-cuC0E5S-.js +0 -37
  426. package/dist/Heading/index.cjs +0 -12
  427. package/dist/Heading/index.mjs +0 -6
  428. package/dist/Heading-CL3UujY7.js +0 -49
  429. package/dist/Icon/index.cjs +0 -9
  430. package/dist/Icon/index.mjs +0 -3
  431. package/dist/Icon-B9XNdA1T.js +0 -36
  432. package/dist/Icon-CoHJokXb.js +0 -34
  433. package/dist/InlineLabel/index.cjs +0 -11
  434. package/dist/InlineLabel/index.mjs +0 -5
  435. package/dist/InlineLabel-BPjH1ASc.js +0 -23
  436. package/dist/InlineLabel-x3msDD5R.js +0 -21
  437. package/dist/InputAvatar/index.cjs +0 -27
  438. package/dist/InputAvatar/index.mjs +0 -21
  439. package/dist/InputAvatar-B2dB8FZL.js +0 -52
  440. package/dist/InputAvatar-CuzV_xzx.js +0 -50
  441. package/dist/InputDate/index.cjs +0 -34
  442. package/dist/InputDate/index.mjs +0 -28
  443. package/dist/InputDate-Cus_F-mg.js +0 -33
  444. package/dist/InputDate-XKAlPMIX.js +0 -31
  445. package/dist/InputEmail/index.cjs +0 -23
  446. package/dist/InputEmail/index.mjs +0 -16
  447. package/dist/InputEmail-58nfESu9.js +0 -20
  448. package/dist/InputEmail-C_90uNvB.js +0 -23
  449. package/dist/InputFile/index.cjs +0 -24
  450. package/dist/InputFile/index.mjs +0 -17
  451. package/dist/InputFile-TLVjerUe.js +0 -1614
  452. package/dist/InputFile-cOKwdZIS.js +0 -1611
  453. package/dist/InputGroup/index.cjs +0 -10
  454. package/dist/InputGroup/index.mjs +0 -4
  455. package/dist/InputGroup-CCJ2rycA.js +0 -26
  456. package/dist/InputNumber/index.cjs +0 -22
  457. package/dist/InputNumber/index.mjs +0 -16
  458. package/dist/InputNumber-9zWSTnld.js +0 -56
  459. package/dist/InputPassword/index.cjs +0 -22
  460. package/dist/InputPassword/index.mjs +0 -16
  461. package/dist/InputPassword--RuWqNxH.js +0 -21
  462. package/dist/InputPassword-D6CEA3YM.js +0 -19
  463. package/dist/InputPhoneNumber/index.cjs +0 -22
  464. package/dist/InputPhoneNumber/index.mjs +0 -16
  465. package/dist/InputPhoneNumber-j8Cr2jkb.js +0 -97
  466. package/dist/InputText/index.cjs +0 -23
  467. package/dist/InputText/index.mjs +0 -17
  468. package/dist/InputText-CCmzDC9W.js +0 -96
  469. package/dist/InputTime/index.cjs +0 -27
  470. package/dist/InputTime/index.mjs +0 -21
  471. package/dist/InputTime-DBtpOhbX.js +0 -187
  472. package/dist/InputValidation/index.cjs +0 -15
  473. package/dist/InputValidation/index.mjs +0 -9
  474. package/dist/InputValidation-BmgvSw0e.js +0 -23
  475. package/dist/InputValidation-DIwnbDDv.js +0 -25
  476. package/dist/InternalChipDismissible-D9MobrPl.js +0 -162
  477. package/dist/InternalChipDismissible-DjSTEbW6.js +0 -157
  478. package/dist/InternalGridCell-CBv95C-G.js +0 -37
  479. package/dist/InternalGridCell-DFrhM8oX.js +0 -40
  480. package/dist/LightBox/index.cjs +0 -25
  481. package/dist/LightBox/index.mjs +0 -19
  482. package/dist/LightBox-D4a2D7do.js +0 -109
  483. package/dist/LightBox-D57afhgq.js +0 -111
  484. package/dist/Link/index.cjs +0 -8
  485. package/dist/Link/index.mjs +0 -2
  486. package/dist/Link-Bnzn51lp.js +0 -9
  487. package/dist/Link-CTWzdpyV.js +0 -7
  488. package/dist/List/index.cjs +0 -30
  489. package/dist/List/index.mjs +0 -23
  490. package/dist/List-BUEDkA_F.js +0 -193
  491. package/dist/List-Cspxky2V.js +0 -196
  492. package/dist/Markdown/index.cjs +0 -20
  493. package/dist/Markdown/index.mjs +0 -14
  494. package/dist/Markdown-C-Kz7FGt.js +0 -18983
  495. package/dist/Markdown-D4Q_2pBV.js +0 -18985
  496. package/dist/Menu/index.cjs +0 -19
  497. package/dist/Menu/index.mjs +0 -13
  498. package/dist/Menu-6YnPYEq0.js +0 -132
  499. package/dist/Menu-D3mhNOYC.js +0 -134
  500. package/dist/Modal/index.cjs +0 -23
  501. package/dist/Modal/index.mjs +0 -17
  502. package/dist/Modal-DYsKMdiT.js +0 -65
  503. package/dist/Modal-u49JU_yq.js +0 -63
  504. package/dist/MultiSelect/index.cjs +0 -17
  505. package/dist/MultiSelect/index.mjs +0 -11
  506. package/dist/MultiSelect-ByY6NzAS.js +0 -169
  507. package/dist/Option-CK6AzE_2.js +0 -12
  508. package/dist/Option-CbvjqSHC.js +0 -15
  509. package/dist/Page/index.cjs +0 -34
  510. package/dist/Page/index.mjs +0 -28
  511. package/dist/Page-CNNOg5qF.js +0 -61
  512. package/dist/Page-Dj0S56-I.js +0 -59
  513. package/dist/Popover/index.cjs +0 -18
  514. package/dist/Popover/index.mjs +0 -12
  515. package/dist/Popover-DYWEx-xf.js +0 -49
  516. package/dist/Popover-EUC6wuNn.js +0 -47
  517. package/dist/ProgressBar/index.cjs +0 -10
  518. package/dist/ProgressBar/index.mjs +0 -4
  519. package/dist/ProgressBar-D2wik11q.js +0 -38
  520. package/dist/ProgressBar-DjFTRxLD.js +0 -36
  521. package/dist/RadioGroup/index.cjs +0 -13
  522. package/dist/RadioGroup/index.mjs +0 -6
  523. package/dist/RadioGroup-CL8tcJwY.js +0 -42
  524. package/dist/RadioGroup-CvoMZUNQ.js +0 -39
  525. package/dist/RecurringSelect/components/index.cjs +0 -16
  526. package/dist/RecurringSelect/components/index.mjs +0 -7
  527. package/dist/RecurringSelect/index.cjs +0 -36
  528. package/dist/RecurringSelect/index.mjs +0 -22
  529. package/dist/RecurringSelect-D2F9hWJb.js +0 -74
  530. package/dist/RecurringSelect-QdDavgCT.js +0 -76
  531. package/dist/Select/index.cjs +0 -23
  532. package/dist/Select/index.mjs +0 -16
  533. package/dist/Spinner/index.cjs +0 -10
  534. package/dist/Spinner/index.mjs +0 -4
  535. package/dist/Spinner-BOhyUAA_.js +0 -17
  536. package/dist/Spinner-DT15aa_r.js +0 -19
  537. package/dist/StatusIndicator/index.cjs +0 -9
  538. package/dist/StatusIndicator/index.mjs +0 -3
  539. package/dist/StatusIndicator-DMcPLJ2i.js +0 -14
  540. package/dist/StatusIndicator-DcXKG260.js +0 -12
  541. package/dist/StatusLabel/index.cjs +0 -13
  542. package/dist/StatusLabel/index.mjs +0 -7
  543. package/dist/StatusLabel-8RoVevu0.js +0 -21
  544. package/dist/StatusLabel-BJsnaMk6.js +0 -19
  545. package/dist/Switch/index.cjs +0 -11
  546. package/dist/Switch/index.mjs +0 -5
  547. package/dist/Switch-CQA6xnNA.js +0 -49
  548. package/dist/Switch-CWis2Tw3.js +0 -51
  549. package/dist/Table/index.cjs +0 -18
  550. package/dist/Table/index.mjs +0 -5
  551. package/dist/Tabs/index.cjs +0 -12
  552. package/dist/Tabs/index.mjs +0 -5
  553. package/dist/Tabs-D8_NCGQa.js +0 -70
  554. package/dist/Tabs-DsTn5FwP.js +0 -73
  555. package/dist/Text/index.cjs +0 -11
  556. package/dist/Text/index.mjs +0 -5
  557. package/dist/Text-DEviM1Tv.js +0 -25
  558. package/dist/Toast/index.cjs +0 -17
  559. package/dist/Toast/index.mjs +0 -11
  560. package/dist/Tooltip/index.cjs +0 -14
  561. package/dist/Tooltip/index.mjs +0 -8
  562. package/dist/Tooltip-mn2jRxXD.js +0 -104
  563. package/dist/Typography/index.cjs +0 -10
  564. package/dist/Typography/index.mjs +0 -4
  565. package/dist/Typography-Dx8KtnBw.js +0 -57
  566. package/dist/Typography-G8pA_xwj.js +0 -55
  567. package/dist/_baseAssignValue-B6tvMdT2.js +0 -31
  568. package/dist/_baseAssignValue-DyNqou4j.js +0 -29
  569. package/dist/_baseEach--p319nr8.js +0 -1073
  570. package/dist/_baseEach-DfA25JZA.js +0 -1069
  571. package/dist/_commonjsHelpers-B83fTs8d.js +0 -36
  572. package/dist/_commonjsHelpers-E-ZsRS8r.js +0 -32
  573. package/dist/_defineProperty-9A76YTSY.js +0 -1306
  574. package/dist/_defineProperty-DjLE4Bk3.js +0 -1326
  575. package/dist/_getTag-Bd2IuclU.js +0 -733
  576. package/dist/_getTag-DV55KKyH.js +0 -718
  577. package/dist/_setToString-B_OHprdS.js +0 -230
  578. package/dist/_setToString-QSHar2ai.js +0 -234
  579. package/dist/debounce-CJA36ltI.js +0 -332
  580. package/dist/debounce-D3te8_TG.js +0 -329
  581. package/dist/getAtlantisConfig-6FPWID0P.js +0 -11
  582. package/dist/helpers-B7JgOXZj.js +0 -15
  583. package/dist/helpers-y1-dsK59.js +0 -17
  584. package/dist/index-B88K44gK.js +0 -1186
  585. package/dist/index-BoP83yS-.js +0 -8
  586. package/dist/index-CJnrkxgL.js +0 -1189
  587. package/dist/index-Jb6tGBiW.js +0 -11
  588. package/dist/index.cjs +0 -272
  589. package/dist/index.d.mts +0 -73
  590. package/dist/index.d.ts +0 -73
  591. package/dist/index.mjs +0 -162
  592. package/dist/isObjectLike-BUFV4ggG.js +0 -197
  593. package/dist/isObjectLike-CkQBn_-v.js +0 -190
  594. package/dist/isSymbol-BB8mecpv.js +0 -33
  595. package/dist/isSymbol-DS9vlqp3.js +0 -35
  596. package/dist/noop-BHeBk22E.js +0 -26
  597. package/dist/noop-CJPLieIK.js +0 -24
  598. package/dist/showToast-CSU2xysR.js +0 -102
  599. package/dist/showToast-lrVl7hOm.js +0 -104
  600. package/dist/style-inject.es-tgCJW-Cu.js +0 -28
  601. package/dist/tslib.es6-Df1SgIEn.js +0 -97
  602. package/dist/tslib.es6-ld72nsZq.js +0 -102
  603. package/dist/useActiveLayout-BjGE_HD9.js +0 -16
  604. package/dist/useActiveLayout-Bvo5EJVa.js +0 -14
  605. package/dist/useAssert-DJjF2xRH.js +0 -55
  606. package/dist/useAssert-Dj-7DdKE.js +0 -57
  607. package/dist/useBatchSelect-D2oSwHTp.js +0 -38
  608. package/dist/useBatchSelect-DnLpNm6-.js +0 -36
  609. package/dist/useChildComponent-BUH0ttPi.js +0 -17
  610. package/dist/useChildComponent-D95jU7NM.js +0 -15
  611. package/dist/useFocusTrap-BtnnoHG8.js +0 -104
  612. package/dist/useFocusTrap-CMLwEDMY.js +0 -106
  613. package/dist/useInView-Ct13SCWB.js +0 -70
  614. package/dist/useInView-Yth15M0p.js +0 -68
  615. package/dist/useOnKeyDown-B9JF2jLZ.js +0 -72
  616. package/dist/useOnKeyDown-BsUfDste.js +0 -70
  617. package/dist/useRefocusOnActivator-CMNWUYSe.js +0 -62
  618. package/dist/useRefocusOnActivator-DOJm9VWz.js +0 -64
  619. package/dist/useResizeObserver-BwGseyVc.js +0 -1234
  620. package/dist/useResizeObserver-ZgXMUTij.js +0 -1231
  621. package/dist/useResponsiveSizing-CMuS7Or1.js +0 -46
  622. package/dist/useResponsiveSizing-DRjeJos_.js +0 -44
  623. package/dist/useSafeLayoutEffect-Qir6pm57.js +0 -44
  624. package/dist/useSafeLayoutEffect-yaw3NyzX.js +0 -42
  625. package/dist/useScrollToActive-D-aHcMpx.js +0 -621
  626. package/dist/useScrollToActive-DMDRmhoI.js +0 -627
  627. /package/{.eslintrc.cjs → .eslintrc.js} +0 -0
  628. /package/dist/{getAtlantisConfig-mcMVqf6m.js → getAtlantisConfig-0f3e8af2.js} +0 -0
  629. /package/dist/{style-inject.es-XZHJH68X.js → style-inject.es-9d2f5f4e.js} +0 -0
@@ -1,1614 +0,0 @@
1
- 'use strict';
2
-
3
- var tslib_es6 = require('./tslib.es6-ld72nsZq.js');
4
- var React = require('react');
5
- var classnames = require('classnames');
6
- var index = require('./index-CJnrkxgL.js');
7
- var axios = require('axios');
8
- var styleInject_es = require('./style-inject.es-XZHJH68X.js');
9
- var InputValidation = require('./InputValidation-DIwnbDDv.js');
10
- var Button = require('./Button-D3mW3Hcg.js');
11
- var Content = require('./Content-B8Od1cqS.js');
12
- var Typography = require('./Typography-Dx8KtnBw.js');
13
-
14
- var COMMON_MIME_TYPES = new Map([
15
- // https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
16
- ['aac', 'audio/aac'],
17
- ['abw', 'application/x-abiword'],
18
- ['arc', 'application/x-freearc'],
19
- ['avif', 'image/avif'],
20
- ['avi', 'video/x-msvideo'],
21
- ['azw', 'application/vnd.amazon.ebook'],
22
- ['bin', 'application/octet-stream'],
23
- ['bmp', 'image/bmp'],
24
- ['bz', 'application/x-bzip'],
25
- ['bz2', 'application/x-bzip2'],
26
- ['cda', 'application/x-cdf'],
27
- ['csh', 'application/x-csh'],
28
- ['css', 'text/css'],
29
- ['csv', 'text/csv'],
30
- ['doc', 'application/msword'],
31
- ['docx', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'],
32
- ['eot', 'application/vnd.ms-fontobject'],
33
- ['epub', 'application/epub+zip'],
34
- ['gz', 'application/gzip'],
35
- ['gif', 'image/gif'],
36
- ['htm', 'text/html'],
37
- ['html', 'text/html'],
38
- ['ico', 'image/vnd.microsoft.icon'],
39
- ['ics', 'text/calendar'],
40
- ['jar', 'application/java-archive'],
41
- ['jpeg', 'image/jpeg'],
42
- ['jpg', 'image/jpeg'],
43
- ['js', 'text/javascript'],
44
- ['json', 'application/json'],
45
- ['jsonld', 'application/ld+json'],
46
- ['mid', 'audio/midi'],
47
- ['midi', 'audio/midi'],
48
- ['mjs', 'text/javascript'],
49
- ['mp3', 'audio/mpeg'],
50
- ['mp4', 'video/mp4'],
51
- ['mpeg', 'video/mpeg'],
52
- ['mpkg', 'application/vnd.apple.installer+xml'],
53
- ['odp', 'application/vnd.oasis.opendocument.presentation'],
54
- ['ods', 'application/vnd.oasis.opendocument.spreadsheet'],
55
- ['odt', 'application/vnd.oasis.opendocument.text'],
56
- ['oga', 'audio/ogg'],
57
- ['ogv', 'video/ogg'],
58
- ['ogx', 'application/ogg'],
59
- ['opus', 'audio/opus'],
60
- ['otf', 'font/otf'],
61
- ['png', 'image/png'],
62
- ['pdf', 'application/pdf'],
63
- ['php', 'application/x-httpd-php'],
64
- ['ppt', 'application/vnd.ms-powerpoint'],
65
- ['pptx', 'application/vnd.openxmlformats-officedocument.presentationml.presentation'],
66
- ['rar', 'application/vnd.rar'],
67
- ['rtf', 'application/rtf'],
68
- ['sh', 'application/x-sh'],
69
- ['svg', 'image/svg+xml'],
70
- ['swf', 'application/x-shockwave-flash'],
71
- ['tar', 'application/x-tar'],
72
- ['tif', 'image/tiff'],
73
- ['tiff', 'image/tiff'],
74
- ['ts', 'video/mp2t'],
75
- ['ttf', 'font/ttf'],
76
- ['txt', 'text/plain'],
77
- ['vsd', 'application/vnd.visio'],
78
- ['wav', 'audio/wav'],
79
- ['weba', 'audio/webm'],
80
- ['webm', 'video/webm'],
81
- ['webp', 'image/webp'],
82
- ['woff', 'font/woff'],
83
- ['woff2', 'font/woff2'],
84
- ['xhtml', 'application/xhtml+xml'],
85
- ['xls', 'application/vnd.ms-excel'],
86
- ['xlsx', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'],
87
- ['xml', 'application/xml'],
88
- ['xul', 'application/vnd.mozilla.xul+xml'],
89
- ['zip', 'application/zip'],
90
- ['7z', 'application/x-7z-compressed'],
91
- // Others
92
- ['mkv', 'video/x-matroska'],
93
- ['mov', 'video/quicktime'],
94
- ['msg', 'application/vnd.ms-outlook']
95
- ]);
96
- function toFileWithPath(file, path) {
97
- var f = withMimeType(file);
98
- if (typeof f.path !== 'string') { // on electron, path is already set to the absolute path
99
- var webkitRelativePath = file.webkitRelativePath;
100
- Object.defineProperty(f, 'path', {
101
- value: typeof path === 'string'
102
- ? path
103
- // If <input webkitdirectory> is set,
104
- // the File will have a {webkitRelativePath} property
105
- // https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/webkitdirectory
106
- : typeof webkitRelativePath === 'string' && webkitRelativePath.length > 0
107
- ? webkitRelativePath
108
- : file.name,
109
- writable: false,
110
- configurable: false,
111
- enumerable: true
112
- });
113
- }
114
- return f;
115
- }
116
- function withMimeType(file) {
117
- var name = file.name;
118
- var hasExtension = name && name.lastIndexOf('.') !== -1;
119
- if (hasExtension && !file.type) {
120
- var ext = name.split('.')
121
- .pop().toLowerCase();
122
- var type = COMMON_MIME_TYPES.get(ext);
123
- if (type) {
124
- Object.defineProperty(file, 'type', {
125
- value: type,
126
- writable: false,
127
- configurable: false,
128
- enumerable: true
129
- });
130
- }
131
- }
132
- return file;
133
- }
134
-
135
- var FILES_TO_IGNORE = [
136
- // Thumbnail cache files for macOS and Windows
137
- '.DS_Store',
138
- 'Thumbs.db' // Windows
139
- ];
140
- /**
141
- * Convert a DragEvent's DataTrasfer object to a list of File objects
142
- * NOTE: If some of the items are folders,
143
- * everything will be flattened and placed in the same list but the paths will be kept as a {path} property.
144
- *
145
- * EXPERIMENTAL: A list of https://developer.mozilla.org/en-US/docs/Web/API/FileSystemHandle objects can also be passed as an arg
146
- * and a list of File objects will be returned.
147
- *
148
- * @param evt
149
- */
150
- function fromEvent(evt) {
151
- return tslib_es6.__awaiter(this, void 0, void 0, function () {
152
- return tslib_es6.__generator(this, function (_a) {
153
- if (isObject(evt) && isDataTransfer(evt)) {
154
- return [2 /*return*/, getDataTransferFiles(evt.dataTransfer, evt.type)];
155
- }
156
- else if (isChangeEvt(evt)) {
157
- return [2 /*return*/, getInputFiles(evt)];
158
- }
159
- else if (Array.isArray(evt) && evt.every(function (item) { return 'getFile' in item && typeof item.getFile === 'function'; })) {
160
- return [2 /*return*/, getFsHandleFiles(evt)];
161
- }
162
- return [2 /*return*/, []];
163
- });
164
- });
165
- }
166
- function isDataTransfer(value) {
167
- return isObject(value.dataTransfer);
168
- }
169
- function isChangeEvt(value) {
170
- return isObject(value) && isObject(value.target);
171
- }
172
- function isObject(v) {
173
- return typeof v === 'object' && v !== null;
174
- }
175
- function getInputFiles(evt) {
176
- return fromList(evt.target.files).map(function (file) { return toFileWithPath(file); });
177
- }
178
- // Ee expect each handle to be https://developer.mozilla.org/en-US/docs/Web/API/FileSystemFileHandle
179
- function getFsHandleFiles(handles) {
180
- return tslib_es6.__awaiter(this, void 0, void 0, function () {
181
- var files;
182
- return tslib_es6.__generator(this, function (_a) {
183
- switch (_a.label) {
184
- case 0: return [4 /*yield*/, Promise.all(handles.map(function (h) { return h.getFile(); }))];
185
- case 1:
186
- files = _a.sent();
187
- return [2 /*return*/, files.map(function (file) { return toFileWithPath(file); })];
188
- }
189
- });
190
- });
191
- }
192
- function getDataTransferFiles(dt, type) {
193
- return tslib_es6.__awaiter(this, void 0, void 0, function () {
194
- var items, files;
195
- return tslib_es6.__generator(this, function (_a) {
196
- switch (_a.label) {
197
- case 0:
198
- if (dt === null) {
199
- return [2 /*return*/, []];
200
- }
201
- if (!dt.items) return [3 /*break*/, 2];
202
- items = fromList(dt.items)
203
- .filter(function (item) { return item.kind === 'file'; });
204
- // According to https://html.spec.whatwg.org/multipage/dnd.html#dndevents,
205
- // only 'dragstart' and 'drop' has access to the data (source node)
206
- if (type !== 'drop') {
207
- return [2 /*return*/, items];
208
- }
209
- return [4 /*yield*/, Promise.all(items.map(toFilePromises))];
210
- case 1:
211
- files = _a.sent();
212
- return [2 /*return*/, noIgnoredFiles(flatten(files))];
213
- case 2: return [2 /*return*/, noIgnoredFiles(fromList(dt.files)
214
- .map(function (file) { return toFileWithPath(file); }))];
215
- }
216
- });
217
- });
218
- }
219
- function noIgnoredFiles(files) {
220
- return files.filter(function (file) { return FILES_TO_IGNORE.indexOf(file.name) === -1; });
221
- }
222
- // IE11 does not support Array.from()
223
- // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from#Browser_compatibility
224
- // https://developer.mozilla.org/en-US/docs/Web/API/FileList
225
- // https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItemList
226
- function fromList(items) {
227
- if (items === null) {
228
- return [];
229
- }
230
- var files = [];
231
- // tslint:disable: prefer-for-of
232
- for (var i = 0; i < items.length; i++) {
233
- var file = items[i];
234
- files.push(file);
235
- }
236
- return files;
237
- }
238
- // https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItem
239
- function toFilePromises(item) {
240
- if (typeof item.webkitGetAsEntry !== 'function') {
241
- return fromDataTransferItem(item);
242
- }
243
- var entry = item.webkitGetAsEntry();
244
- // Safari supports dropping an image node from a different window and can be retrieved using
245
- // the DataTransferItem.getAsFile() API
246
- // NOTE: FileSystemEntry.file() throws if trying to get the file
247
- if (entry && entry.isDirectory) {
248
- return fromDirEntry(entry);
249
- }
250
- return fromDataTransferItem(item);
251
- }
252
- function flatten(items) {
253
- return items.reduce(function (acc, files) { return tslib_es6.__spread(acc, (Array.isArray(files) ? flatten(files) : [files])); }, []);
254
- }
255
- function fromDataTransferItem(item) {
256
- var file = item.getAsFile();
257
- if (!file) {
258
- return Promise.reject(item + " is not a File");
259
- }
260
- var fwp = toFileWithPath(file);
261
- return Promise.resolve(fwp);
262
- }
263
- // https://developer.mozilla.org/en-US/docs/Web/API/FileSystemEntry
264
- function fromEntry(entry) {
265
- return tslib_es6.__awaiter(this, void 0, void 0, function () {
266
- return tslib_es6.__generator(this, function (_a) {
267
- return [2 /*return*/, entry.isDirectory ? fromDirEntry(entry) : fromFileEntry(entry)];
268
- });
269
- });
270
- }
271
- // https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryEntry
272
- function fromDirEntry(entry) {
273
- var reader = entry.createReader();
274
- return new Promise(function (resolve, reject) {
275
- var entries = [];
276
- function readEntries() {
277
- var _this = this;
278
- // https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryEntry/createReader
279
- // https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryReader/readEntries
280
- reader.readEntries(function (batch) { return tslib_es6.__awaiter(_this, void 0, void 0, function () {
281
- var files, err_1, items;
282
- return tslib_es6.__generator(this, function (_a) {
283
- switch (_a.label) {
284
- case 0:
285
- if (!!batch.length) return [3 /*break*/, 5];
286
- _a.label = 1;
287
- case 1:
288
- _a.trys.push([1, 3, , 4]);
289
- return [4 /*yield*/, Promise.all(entries)];
290
- case 2:
291
- files = _a.sent();
292
- resolve(files);
293
- return [3 /*break*/, 4];
294
- case 3:
295
- err_1 = _a.sent();
296
- reject(err_1);
297
- return [3 /*break*/, 4];
298
- case 4: return [3 /*break*/, 6];
299
- case 5:
300
- items = Promise.all(batch.map(fromEntry));
301
- entries.push(items);
302
- // Continue reading
303
- readEntries();
304
- _a.label = 6;
305
- case 6: return [2 /*return*/];
306
- }
307
- });
308
- }); }, function (err) {
309
- reject(err);
310
- });
311
- }
312
- readEntries();
313
- });
314
- }
315
- // https://developer.mozilla.org/en-US/docs/Web/API/FileSystemFileEntry
316
- function fromFileEntry(entry) {
317
- return tslib_es6.__awaiter(this, void 0, void 0, function () {
318
- return tslib_es6.__generator(this, function (_a) {
319
- return [2 /*return*/, new Promise(function (resolve, reject) {
320
- entry.file(function (file) {
321
- var fwp = toFileWithPath(file, entry.fullPath);
322
- resolve(fwp);
323
- }, function (err) {
324
- reject(err);
325
- });
326
- })];
327
- });
328
- });
329
- }
330
-
331
- var _default = function (file, acceptedFiles) {
332
- if (file && acceptedFiles) {
333
- var acceptedFilesArray = Array.isArray(acceptedFiles) ? acceptedFiles : acceptedFiles.split(',');
334
- var fileName = file.name || '';
335
- var mimeType = (file.type || '').toLowerCase();
336
- var baseMimeType = mimeType.replace(/\/.*$/, '');
337
- return acceptedFilesArray.some(function (type) {
338
- var validType = type.trim().toLowerCase();
339
-
340
- if (validType.charAt(0) === '.') {
341
- return fileName.toLowerCase().endsWith(validType);
342
- } else if (validType.endsWith('/*')) {
343
- // This is something like a image/* mime type
344
- return baseMimeType === validType.replace(/\/.*$/, '');
345
- }
346
-
347
- return mimeType === validType;
348
- });
349
- }
350
-
351
- return true;
352
- };
353
-
354
- 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; }
355
-
356
- 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; }
357
-
358
- 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; }
359
-
360
- function _slicedToArray$1(arr, i) { return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest$1(); }
361
-
362
- 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."); }
363
-
364
- 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); }
365
-
366
- 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; }
367
-
368
- 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; }
369
-
370
- function _arrayWithHoles$1(arr) { if (Array.isArray(arr)) return arr; }
371
-
372
- var FILE_INVALID_TYPE = 'file-invalid-type';
373
- var FILE_TOO_LARGE = 'file-too-large';
374
- var FILE_TOO_SMALL = 'file-too-small';
375
- var TOO_MANY_FILES = 'too-many-files';
376
-
377
- var getInvalidTypeRejectionErr = function getInvalidTypeRejectionErr(accept) {
378
- accept = Array.isArray(accept) && accept.length === 1 ? accept[0] : accept;
379
- var messageSuffix = Array.isArray(accept) ? "one of ".concat(accept.join(', ')) : accept;
380
- return {
381
- code: FILE_INVALID_TYPE,
382
- message: "File type must be ".concat(messageSuffix)
383
- };
384
- };
385
- var getTooLargeRejectionErr = function getTooLargeRejectionErr(maxSize) {
386
- return {
387
- code: FILE_TOO_LARGE,
388
- message: "File is larger than ".concat(maxSize, " ").concat(maxSize === 1 ? 'byte' : 'bytes')
389
- };
390
- };
391
- var getTooSmallRejectionErr = function getTooSmallRejectionErr(minSize) {
392
- return {
393
- code: FILE_TOO_SMALL,
394
- message: "File is smaller than ".concat(minSize, " ").concat(minSize === 1 ? 'byte' : 'bytes')
395
- };
396
- };
397
- var TOO_MANY_FILES_REJECTION = {
398
- code: TOO_MANY_FILES,
399
- message: 'Too many files'
400
- }; // Firefox versions prior to 53 return a bogus MIME type for every file drag, so dragovers with
401
- // that MIME type will always be accepted
402
-
403
- function fileAccepted(file, accept) {
404
- var isAcceptable = file.type === 'application/x-moz-file' || _default(file, accept);
405
- return [isAcceptable, isAcceptable ? null : getInvalidTypeRejectionErr(accept)];
406
- }
407
- function fileMatchSize(file, minSize, maxSize) {
408
- if (isDefined(file.size)) {
409
- if (isDefined(minSize) && isDefined(maxSize)) {
410
- if (file.size > maxSize) return [false, getTooLargeRejectionErr(maxSize)];
411
- if (file.size < minSize) return [false, getTooSmallRejectionErr(minSize)];
412
- } else if (isDefined(minSize) && file.size < minSize) return [false, getTooSmallRejectionErr(minSize)];else if (isDefined(maxSize) && file.size > maxSize) return [false, getTooLargeRejectionErr(maxSize)];
413
- }
414
-
415
- return [true, null];
416
- }
417
-
418
- function isDefined(value) {
419
- return value !== undefined && value !== null;
420
- }
421
-
422
- function allFilesAccepted(_ref) {
423
- var files = _ref.files,
424
- accept = _ref.accept,
425
- minSize = _ref.minSize,
426
- maxSize = _ref.maxSize,
427
- multiple = _ref.multiple,
428
- maxFiles = _ref.maxFiles;
429
-
430
- if (!multiple && files.length > 1 || multiple && maxFiles >= 1 && files.length > maxFiles) {
431
- return false;
432
- }
433
-
434
- return files.every(function (file) {
435
- var _fileAccepted = fileAccepted(file, accept),
436
- _fileAccepted2 = _slicedToArray$1(_fileAccepted, 1),
437
- accepted = _fileAccepted2[0];
438
-
439
- var _fileMatchSize = fileMatchSize(file, minSize, maxSize),
440
- _fileMatchSize2 = _slicedToArray$1(_fileMatchSize, 1),
441
- sizeMatch = _fileMatchSize2[0];
442
-
443
- return accepted && sizeMatch;
444
- });
445
- } // React's synthetic events has event.isPropagationStopped,
446
- // but to remain compatibility with other libs (Preact) fall back
447
- // to check event.cancelBubble
448
-
449
- function isPropagationStopped(event) {
450
- if (typeof event.isPropagationStopped === 'function') {
451
- return event.isPropagationStopped();
452
- } else if (typeof event.cancelBubble !== 'undefined') {
453
- return event.cancelBubble;
454
- }
455
-
456
- return false;
457
- }
458
- function isEvtWithFiles(event) {
459
- if (!event.dataTransfer) {
460
- return !!event.target && !!event.target.files;
461
- } // https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/types
462
- // https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API/Recommended_drag_types#file
463
-
464
-
465
- return Array.prototype.some.call(event.dataTransfer.types, function (type) {
466
- return type === 'Files' || type === 'application/x-moz-file';
467
- });
468
- }
469
-
470
- function onDocumentDragOver(event) {
471
- event.preventDefault();
472
- }
473
-
474
- function isIe(userAgent) {
475
- return userAgent.indexOf('MSIE') !== -1 || userAgent.indexOf('Trident/') !== -1;
476
- }
477
-
478
- function isEdge(userAgent) {
479
- return userAgent.indexOf('Edge/') !== -1;
480
- }
481
-
482
- function isIeOrEdge() {
483
- var userAgent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.navigator.userAgent;
484
- return isIe(userAgent) || isEdge(userAgent);
485
- }
486
- /**
487
- * This is intended to be used to compose event handlers
488
- * They are executed in order until one of them calls `event.isPropagationStopped()`.
489
- * Note that the check is done on the first invoke too,
490
- * meaning that if propagation was stopped before invoking the fns,
491
- * no handlers will be executed.
492
- *
493
- * @param {Function} fns the event hanlder functions
494
- * @return {Function} the event handler to add to an element
495
- */
496
-
497
- function composeEventHandlers() {
498
- for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) {
499
- fns[_key] = arguments[_key];
500
- }
501
-
502
- return function (event) {
503
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
504
- args[_key2 - 1] = arguments[_key2];
505
- }
506
-
507
- return fns.some(function (fn) {
508
- if (!isPropagationStopped(event) && fn) {
509
- fn.apply(void 0, [event].concat(args));
510
- }
511
-
512
- return isPropagationStopped(event);
513
- });
514
- };
515
- }
516
- /**
517
- * canUseFileSystemAccessAPI checks if the [File System Access API](https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API)
518
- * is supported by the browser.
519
- * @returns {boolean}
520
- */
521
-
522
- function canUseFileSystemAccessAPI() {
523
- return 'showOpenFilePicker' in window;
524
- }
525
- /**
526
- * filePickerOptionsTypes returns the {types} option for https://developer.mozilla.org/en-US/docs/Web/API/window/showOpenFilePicker
527
- * based on the accept attr (see https://github.com/react-dropzone/attr-accept)
528
- * E.g: converts ['image/*', 'text/*'] to {'image/*': [], 'text/*': []}
529
- * @param {string|string[]} accept
530
- */
531
-
532
- function filePickerOptionsTypes(accept) {
533
- accept = typeof accept === 'string' ? accept.split(',') : accept;
534
- return [{
535
- description: 'everything',
536
- // TODO: Need to handle filtering more elegantly than this!
537
- accept: Array.isArray(accept) // Accept just MIME types as per spec
538
- // NOTE: accept can be https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#unique_file_type_specifiers
539
- ? accept.filter(function (item) {
540
- return item === 'audio/*' || item === 'video/*' || item === 'image/*' || item === 'text/*' || /\w+\/[-+.\w]+/g.test(item);
541
- }).reduce(function (a, b) {
542
- return _objectSpread$1(_objectSpread$1({}, a), {}, _defineProperty$1({}, b, []));
543
- }, {}) : {}
544
- }];
545
- }
546
-
547
- var _excluded = ["children"],
548
- _excluded2 = ["open"],
549
- _excluded3 = ["refKey", "role", "onKeyDown", "onFocus", "onBlur", "onClick", "onDragEnter", "onDragOver", "onDragLeave", "onDrop"],
550
- _excluded4 = ["refKey", "onChange", "onClick"];
551
-
552
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
553
-
554
- 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."); }
555
-
556
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
557
-
558
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
559
-
560
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
561
-
562
- 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."); }
563
-
564
- 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); }
565
-
566
- 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; }
567
-
568
- 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; }
569
-
570
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
571
-
572
- 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; }
573
-
574
- 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; }
575
-
576
- 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; }
577
-
578
- 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; }
579
-
580
- 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; }
581
- /**
582
- * Convenience wrapper component for the `useDropzone` hook
583
- *
584
- * ```jsx
585
- * <Dropzone>
586
- * {({getRootProps, getInputProps}) => (
587
- * <div {...getRootProps()}>
588
- * <input {...getInputProps()} />
589
- * <p>Drag 'n' drop some files here, or click to select files</p>
590
- * </div>
591
- * )}
592
- * </Dropzone>
593
- * ```
594
- */
595
-
596
- var Dropzone = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
597
- var children = _ref.children,
598
- params = _objectWithoutProperties(_ref, _excluded);
599
-
600
- var _useDropzone = useDropzone(params),
601
- open = _useDropzone.open,
602
- props = _objectWithoutProperties(_useDropzone, _excluded2);
603
-
604
- React.useImperativeHandle(ref, function () {
605
- return {
606
- open: open
607
- };
608
- }, [open]); // TODO: Figure out why react-styleguidist cannot create docs if we don't return a jsx element
609
-
610
- return /*#__PURE__*/React.createElement(React.Fragment, null, children(_objectSpread(_objectSpread({}, props), {}, {
611
- open: open
612
- })));
613
- });
614
- Dropzone.displayName = 'Dropzone'; // Add default props for react-docgen
615
-
616
- var defaultProps = {
617
- disabled: false,
618
- getFilesFromEvent: fromEvent,
619
- maxSize: Infinity,
620
- minSize: 0,
621
- multiple: true,
622
- maxFiles: 0,
623
- preventDropOnDocument: true,
624
- noClick: false,
625
- noKeyboard: false,
626
- noDrag: false,
627
- noDragEventsBubbling: false,
628
- validator: null,
629
- useFsAccessApi: false
630
- };
631
- Dropzone.defaultProps = defaultProps;
632
- Dropzone.propTypes = {
633
- /**
634
- * Render function that exposes the dropzone state and prop getter fns
635
- *
636
- * @param {object} params
637
- * @param {Function} params.getRootProps Returns the props you should apply to the root drop container you render
638
- * @param {Function} params.getInputProps Returns the props you should apply to hidden file input you render
639
- * @param {Function} params.open Open the native file selection dialog
640
- * @param {boolean} params.isFocused Dropzone area is in focus
641
- * @param {boolean} params.isFileDialogActive File dialog is opened
642
- * @param {boolean} params.isDragActive Active drag is in progress
643
- * @param {boolean} params.isDragAccept Dragged files are accepted
644
- * @param {boolean} params.isDragReject Some dragged files are rejected
645
- * @param {File[]} params.draggedFiles Files in active drag
646
- * @param {File[]} params.acceptedFiles Accepted files
647
- * @param {FileRejection[]} params.fileRejections Rejected files and why they were rejected
648
- */
649
- children: index.PropTypes.func,
650
-
651
- /**
652
- * Set accepted file types.
653
- * See https://github.com/okonet/attr-accept for more information.
654
- * Keep in mind that mime type determination is not reliable across platforms. CSV files,
655
- * for example, are reported as text/plain under macOS but as application/vnd.ms-excel under
656
- * Windows. In some cases there might not be a mime type set at all.
657
- * See: https://github.com/react-dropzone/react-dropzone/issues/276
658
- */
659
- accept: index.PropTypes.oneOfType([index.PropTypes.string, index.PropTypes.arrayOf(index.PropTypes.string)]),
660
-
661
- /**
662
- * Allow drag 'n' drop (or selection from the file dialog) of multiple files
663
- */
664
- multiple: index.PropTypes.bool,
665
-
666
- /**
667
- * If false, allow dropped items to take over the current browser window
668
- */
669
- preventDropOnDocument: index.PropTypes.bool,
670
-
671
- /**
672
- * If true, disables click to open the native file selection dialog
673
- */
674
- noClick: index.PropTypes.bool,
675
-
676
- /**
677
- * If true, disables SPACE/ENTER to open the native file selection dialog.
678
- * Note that it also stops tracking the focus state.
679
- */
680
- noKeyboard: index.PropTypes.bool,
681
-
682
- /**
683
- * If true, disables drag 'n' drop
684
- */
685
- noDrag: index.PropTypes.bool,
686
-
687
- /**
688
- * If true, stops drag event propagation to parents
689
- */
690
- noDragEventsBubbling: index.PropTypes.bool,
691
-
692
- /**
693
- * Minimum file size (in bytes)
694
- */
695
- minSize: index.PropTypes.number,
696
-
697
- /**
698
- * Maximum file size (in bytes)
699
- */
700
- maxSize: index.PropTypes.number,
701
-
702
- /**
703
- * Maximum accepted number of files
704
- * The default value is 0 which means there is no limitation to how many files are accepted.
705
- */
706
- maxFiles: index.PropTypes.number,
707
-
708
- /**
709
- * Enable/disable the dropzone
710
- */
711
- disabled: index.PropTypes.bool,
712
-
713
- /**
714
- * Use this to provide a custom file aggregator
715
- *
716
- * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
717
- */
718
- getFilesFromEvent: index.PropTypes.func,
719
-
720
- /**
721
- * Cb for when closing the file dialog with no selection
722
- */
723
- onFileDialogCancel: index.PropTypes.func,
724
-
725
- /**
726
- * Cb for when opening the file dialog
727
- */
728
- onFileDialogOpen: index.PropTypes.func,
729
-
730
- /**
731
- * Set to true to use the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API
732
- * to open the file picker instead of using an `<input type="file">` click event.
733
- */
734
- useFsAccessApi: index.PropTypes.bool,
735
-
736
- /**
737
- * Cb for when the `dragenter` event occurs.
738
- *
739
- * @param {DragEvent} event
740
- */
741
- onDragEnter: index.PropTypes.func,
742
-
743
- /**
744
- * Cb for when the `dragleave` event occurs
745
- *
746
- * @param {DragEvent} event
747
- */
748
- onDragLeave: index.PropTypes.func,
749
-
750
- /**
751
- * Cb for when the `dragover` event occurs
752
- *
753
- * @param {DragEvent} event
754
- */
755
- onDragOver: index.PropTypes.func,
756
-
757
- /**
758
- * Cb for when the `drop` event occurs.
759
- * Note that this callback is invoked after the `getFilesFromEvent` callback is done.
760
- *
761
- * Files are accepted or rejected based on the `accept`, `multiple`, `minSize` and `maxSize` props.
762
- * `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.
763
- * If `multiple` is set to false and additional files are dropped,
764
- * all files besides the first will be rejected.
765
- * Any file which does not have a size in the [`minSize`, `maxSize`] range, will be rejected as well.
766
- *
767
- * Note that the `onDrop` callback will always be invoked regardless if the dropped files were accepted or rejected.
768
- * If you'd like to react to a specific scenario, use the `onDropAccepted`/`onDropRejected` props.
769
- *
770
- * `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.
771
- * For example, with [SuperAgent](https://github.com/visionmedia/superagent) as a http/ajax library:
772
- *
773
- * ```js
774
- * function onDrop(acceptedFiles) {
775
- * const req = request.post('/upload')
776
- * acceptedFiles.forEach(file => {
777
- * req.attach(file.name, file)
778
- * })
779
- * req.end(callback)
780
- * }
781
- * ```
782
- *
783
- * @param {File[]} acceptedFiles
784
- * @param {FileRejection[]} fileRejections
785
- * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
786
- */
787
- onDrop: index.PropTypes.func,
788
-
789
- /**
790
- * Cb for when the `drop` event occurs.
791
- * Note that if no files are accepted, this callback is not invoked.
792
- *
793
- * @param {File[]} files
794
- * @param {(DragEvent|Event)} event
795
- */
796
- onDropAccepted: index.PropTypes.func,
797
-
798
- /**
799
- * Cb for when the `drop` event occurs.
800
- * Note that if no files are rejected, this callback is not invoked.
801
- *
802
- * @param {FileRejection[]} fileRejections
803
- * @param {(DragEvent|Event)} event
804
- */
805
- onDropRejected: index.PropTypes.func,
806
-
807
- /**
808
- * Custom validation function
809
- * @param {File} file
810
- * @returns {FileError|FileError[]}
811
- */
812
- validator: index.PropTypes.func
813
- };
814
- /**
815
- * A function that is invoked for the `dragenter`,
816
- * `dragover` and `dragleave` events.
817
- * It is not invoked if the items are not files (such as link, text, etc.).
818
- *
819
- * @callback dragCb
820
- * @param {DragEvent} event
821
- */
822
-
823
- /**
824
- * A function that is invoked for the `drop` or input change event.
825
- * It is not invoked if the items are not files (such as link, text, etc.).
826
- *
827
- * @callback dropCb
828
- * @param {File[]} acceptedFiles List of accepted files
829
- * @param {FileRejection[]} fileRejections List of rejected files and why they were rejected
830
- * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
831
- */
832
-
833
- /**
834
- * A function that is invoked for the `drop` or input change event.
835
- * It is not invoked if the items are files (such as link, text, etc.).
836
- *
837
- * @callback dropAcceptedCb
838
- * @param {File[]} files List of accepted files that meet the given criteria
839
- * (`accept`, `multiple`, `minSize`, `maxSize`)
840
- * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
841
- */
842
-
843
- /**
844
- * A function that is invoked for the `drop` or input change event.
845
- *
846
- * @callback dropRejectedCb
847
- * @param {File[]} files List of rejected files that do not meet the given criteria
848
- * (`accept`, `multiple`, `minSize`, `maxSize`)
849
- * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
850
- */
851
-
852
- /**
853
- * A function that is used aggregate files,
854
- * in a asynchronous fashion, from drag or input change events.
855
- *
856
- * @callback getFilesFromEvent
857
- * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
858
- * @returns {(File[]|Promise<File[]>)}
859
- */
860
-
861
- /**
862
- * An object with the current dropzone state and some helper functions.
863
- *
864
- * @typedef {object} DropzoneState
865
- * @property {Function} getRootProps Returns the props you should apply to the root drop container you render
866
- * @property {Function} getInputProps Returns the props you should apply to hidden file input you render
867
- * @property {Function} open Open the native file selection dialog
868
- * @property {boolean} isFocused Dropzone area is in focus
869
- * @property {boolean} isFileDialogActive File dialog is opened
870
- * @property {boolean} isDragActive Active drag is in progress
871
- * @property {boolean} isDragAccept Dragged files are accepted
872
- * @property {boolean} isDragReject Some dragged files are rejected
873
- * @property {File[]} draggedFiles Files in active drag
874
- * @property {File[]} acceptedFiles Accepted files
875
- * @property {FileRejection[]} fileRejections Rejected files and why they were rejected
876
- */
877
-
878
- var initialState = {
879
- isFocused: false,
880
- isFileDialogActive: false,
881
- isDragActive: false,
882
- isDragAccept: false,
883
- isDragReject: false,
884
- draggedFiles: [],
885
- acceptedFiles: [],
886
- fileRejections: []
887
- };
888
- /**
889
- * A React hook that creates a drag 'n' drop area.
890
- *
891
- * ```jsx
892
- * function MyDropzone(props) {
893
- * const {getRootProps, getInputProps} = useDropzone({
894
- * onDrop: acceptedFiles => {
895
- * // do something with the File objects, e.g. upload to some server
896
- * }
897
- * });
898
- * return (
899
- * <div {...getRootProps()}>
900
- * <input {...getInputProps()} />
901
- * <p>Drag and drop some files here, or click to select files</p>
902
- * </div>
903
- * )
904
- * }
905
- * ```
906
- *
907
- * @function useDropzone
908
- *
909
- * @param {object} props
910
- * @param {string|string[]} [props.accept] Set accepted file types.
911
- * See https://github.com/okonet/attr-accept for more information.
912
- * Keep in mind that mime type determination is not reliable across platforms. CSV files,
913
- * for example, are reported as text/plain under macOS but as application/vnd.ms-excel under
914
- * Windows. In some cases there might not be a mime type set at all.
915
- * See: https://github.com/react-dropzone/react-dropzone/issues/276
916
- * @param {boolean} [props.multiple=true] Allow drag 'n' drop (or selection from the file dialog) of multiple files
917
- * @param {boolean} [props.preventDropOnDocument=true] If false, allow dropped items to take over the current browser window
918
- * @param {boolean} [props.noClick=false] If true, disables click to open the native file selection dialog
919
- * @param {boolean} [props.noKeyboard=false] If true, disables SPACE/ENTER to open the native file selection dialog.
920
- * Note that it also stops tracking the focus state.
921
- * @param {boolean} [props.noDrag=false] If true, disables drag 'n' drop
922
- * @param {boolean} [props.noDragEventsBubbling=false] If true, stops drag event propagation to parents
923
- * @param {number} [props.minSize=0] Minimum file size (in bytes)
924
- * @param {number} [props.maxSize=Infinity] Maximum file size (in bytes)
925
- * @param {boolean} [props.disabled=false] Enable/disable the dropzone
926
- * @param {getFilesFromEvent} [props.getFilesFromEvent] Use this to provide a custom file aggregator
927
- * @param {Function} [props.onFileDialogCancel] Cb for when closing the file dialog with no selection
928
- * @param {boolean} [props.useFsAccessApi] Set to true to use the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API
929
- * to open the file picker instead of using an `<input type="file">` click event.
930
- * @param {Function} [props.onFileDialogOpen] Cb for when opening the file dialog
931
- * @param {dragCb} [props.onDragEnter] Cb for when the `dragenter` event occurs.
932
- * @param {dragCb} [props.onDragLeave] Cb for when the `dragleave` event occurs
933
- * @param {dragCb} [props.onDragOver] Cb for when the `dragover` event occurs
934
- * @param {dropCb} [props.onDrop] Cb for when the `drop` event occurs.
935
- * Note that this callback is invoked after the `getFilesFromEvent` callback is done.
936
- *
937
- * Files are accepted or rejected based on the `accept`, `multiple`, `minSize` and `maxSize` props.
938
- * `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.
939
- * If `multiple` is set to false and additional files are dropped,
940
- * all files besides the first will be rejected.
941
- * Any file which does not have a size in the [`minSize`, `maxSize`] range, will be rejected as well.
942
- *
943
- * Note that the `onDrop` callback will always be invoked regardless if the dropped files were accepted or rejected.
944
- * If you'd like to react to a specific scenario, use the `onDropAccepted`/`onDropRejected` props.
945
- *
946
- * `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.
947
- * For example, with [SuperAgent](https://github.com/visionmedia/superagent) as a http/ajax library:
948
- *
949
- * ```js
950
- * function onDrop(acceptedFiles) {
951
- * const req = request.post('/upload')
952
- * acceptedFiles.forEach(file => {
953
- * req.attach(file.name, file)
954
- * })
955
- * req.end(callback)
956
- * }
957
- * ```
958
- * @param {dropAcceptedCb} [props.onDropAccepted]
959
- * @param {dropRejectedCb} [props.onDropRejected]
960
- *
961
- * @returns {DropzoneState}
962
- */
963
-
964
- function useDropzone() {
965
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
966
-
967
- var _defaultProps$options = _objectSpread(_objectSpread({}, defaultProps), options),
968
- accept = _defaultProps$options.accept,
969
- disabled = _defaultProps$options.disabled,
970
- getFilesFromEvent = _defaultProps$options.getFilesFromEvent,
971
- maxSize = _defaultProps$options.maxSize,
972
- minSize = _defaultProps$options.minSize,
973
- multiple = _defaultProps$options.multiple,
974
- maxFiles = _defaultProps$options.maxFiles,
975
- onDragEnter = _defaultProps$options.onDragEnter,
976
- onDragLeave = _defaultProps$options.onDragLeave,
977
- onDragOver = _defaultProps$options.onDragOver,
978
- onDrop = _defaultProps$options.onDrop,
979
- onDropAccepted = _defaultProps$options.onDropAccepted,
980
- onDropRejected = _defaultProps$options.onDropRejected,
981
- onFileDialogCancel = _defaultProps$options.onFileDialogCancel,
982
- onFileDialogOpen = _defaultProps$options.onFileDialogOpen,
983
- useFsAccessApi = _defaultProps$options.useFsAccessApi,
984
- preventDropOnDocument = _defaultProps$options.preventDropOnDocument,
985
- noClick = _defaultProps$options.noClick,
986
- noKeyboard = _defaultProps$options.noKeyboard,
987
- noDrag = _defaultProps$options.noDrag,
988
- noDragEventsBubbling = _defaultProps$options.noDragEventsBubbling,
989
- validator = _defaultProps$options.validator;
990
-
991
- var onFileDialogOpenCb = React.useMemo(function () {
992
- return typeof onFileDialogOpen === 'function' ? onFileDialogOpen : noop;
993
- }, [onFileDialogOpen]);
994
- var onFileDialogCancelCb = React.useMemo(function () {
995
- return typeof onFileDialogCancel === 'function' ? onFileDialogCancel : noop;
996
- }, [onFileDialogCancel]);
997
- var rootRef = React.useRef(null);
998
- var inputRef = React.useRef(null);
999
-
1000
- var _useReducer = React.useReducer(reducer, initialState),
1001
- _useReducer2 = _slicedToArray(_useReducer, 2),
1002
- state = _useReducer2[0],
1003
- dispatch = _useReducer2[1];
1004
-
1005
- var isFocused = state.isFocused,
1006
- isFileDialogActive = state.isFileDialogActive,
1007
- draggedFiles = state.draggedFiles; // Update file dialog active state when the window is focused on
1008
-
1009
- var onWindowFocus = function onWindowFocus() {
1010
- // Execute the timeout only if the file dialog is opened in the browser
1011
- if (isFileDialogActive) {
1012
- setTimeout(function () {
1013
- if (inputRef.current) {
1014
- var files = inputRef.current.files;
1015
-
1016
- if (!files.length) {
1017
- dispatch({
1018
- type: 'closeDialog'
1019
- });
1020
- onFileDialogCancelCb();
1021
- }
1022
- }
1023
- }, 300);
1024
- }
1025
- };
1026
-
1027
- React.useEffect(function () {
1028
- if (useFsAccessApi && canUseFileSystemAccessAPI()) {
1029
- return function () {};
1030
- }
1031
-
1032
- window.addEventListener('focus', onWindowFocus, false);
1033
- return function () {
1034
- window.removeEventListener('focus', onWindowFocus, false);
1035
- };
1036
- }, [inputRef, isFileDialogActive, onFileDialogCancelCb, useFsAccessApi]);
1037
- var dragTargetsRef = React.useRef([]);
1038
-
1039
- var onDocumentDrop = function onDocumentDrop(event) {
1040
- if (rootRef.current && rootRef.current.contains(event.target)) {
1041
- // If we intercepted an event for our instance, let it propagate down to the instance's onDrop handler
1042
- return;
1043
- }
1044
-
1045
- event.preventDefault();
1046
- dragTargetsRef.current = [];
1047
- };
1048
-
1049
- React.useEffect(function () {
1050
- if (preventDropOnDocument) {
1051
- document.addEventListener('dragover', onDocumentDragOver, false);
1052
- document.addEventListener('drop', onDocumentDrop, false);
1053
- }
1054
-
1055
- return function () {
1056
- if (preventDropOnDocument) {
1057
- document.removeEventListener('dragover', onDocumentDragOver);
1058
- document.removeEventListener('drop', onDocumentDrop);
1059
- }
1060
- };
1061
- }, [rootRef, preventDropOnDocument]);
1062
- var onDragEnterCb = React.useCallback(function (event) {
1063
- event.preventDefault(); // Persist here because we need the event later after getFilesFromEvent() is done
1064
-
1065
- event.persist();
1066
- stopPropagation(event);
1067
- dragTargetsRef.current = [].concat(_toConsumableArray(dragTargetsRef.current), [event.target]);
1068
-
1069
- if (isEvtWithFiles(event)) {
1070
- Promise.resolve(getFilesFromEvent(event)).then(function (draggedFiles) {
1071
- if (isPropagationStopped(event) && !noDragEventsBubbling) {
1072
- return;
1073
- }
1074
-
1075
- dispatch({
1076
- draggedFiles: draggedFiles,
1077
- isDragActive: true,
1078
- type: 'setDraggedFiles'
1079
- });
1080
-
1081
- if (onDragEnter) {
1082
- onDragEnter(event);
1083
- }
1084
- });
1085
- }
1086
- }, [getFilesFromEvent, onDragEnter, noDragEventsBubbling]);
1087
- var onDragOverCb = React.useCallback(function (event) {
1088
- event.preventDefault();
1089
- event.persist();
1090
- stopPropagation(event);
1091
- var hasFiles = isEvtWithFiles(event);
1092
-
1093
- if (hasFiles && event.dataTransfer) {
1094
- try {
1095
- event.dataTransfer.dropEffect = 'copy';
1096
- } catch (_unused) {}
1097
- /* eslint-disable-line no-empty */
1098
-
1099
- }
1100
-
1101
- if (hasFiles && onDragOver) {
1102
- onDragOver(event);
1103
- }
1104
-
1105
- return false;
1106
- }, [onDragOver, noDragEventsBubbling]);
1107
- var onDragLeaveCb = React.useCallback(function (event) {
1108
- event.preventDefault();
1109
- event.persist();
1110
- stopPropagation(event); // Only deactivate once the dropzone and all children have been left
1111
-
1112
- var targets = dragTargetsRef.current.filter(function (target) {
1113
- return rootRef.current && rootRef.current.contains(target);
1114
- }); // Make sure to remove a target present multiple times only once
1115
- // (Firefox may fire dragenter/dragleave multiple times on the same element)
1116
-
1117
- var targetIdx = targets.indexOf(event.target);
1118
-
1119
- if (targetIdx !== -1) {
1120
- targets.splice(targetIdx, 1);
1121
- }
1122
-
1123
- dragTargetsRef.current = targets;
1124
-
1125
- if (targets.length > 0) {
1126
- return;
1127
- }
1128
-
1129
- dispatch({
1130
- isDragActive: false,
1131
- type: 'setDraggedFiles',
1132
- draggedFiles: []
1133
- });
1134
-
1135
- if (isEvtWithFiles(event) && onDragLeave) {
1136
- onDragLeave(event);
1137
- }
1138
- }, [rootRef, onDragLeave, noDragEventsBubbling]);
1139
- var setFiles = React.useCallback(function (files, event) {
1140
- var acceptedFiles = [];
1141
- var fileRejections = [];
1142
- files.forEach(function (file) {
1143
- var _fileAccepted = fileAccepted(file, accept),
1144
- _fileAccepted2 = _slicedToArray(_fileAccepted, 2),
1145
- accepted = _fileAccepted2[0],
1146
- acceptError = _fileAccepted2[1];
1147
-
1148
- var _fileMatchSize = fileMatchSize(file, minSize, maxSize),
1149
- _fileMatchSize2 = _slicedToArray(_fileMatchSize, 2),
1150
- sizeMatch = _fileMatchSize2[0],
1151
- sizeError = _fileMatchSize2[1];
1152
-
1153
- var customErrors = validator ? validator(file) : null;
1154
-
1155
- if (accepted && sizeMatch && !customErrors) {
1156
- acceptedFiles.push(file);
1157
- } else {
1158
- var errors = [acceptError, sizeError];
1159
-
1160
- if (customErrors) {
1161
- errors = errors.concat(customErrors);
1162
- }
1163
-
1164
- fileRejections.push({
1165
- file: file,
1166
- errors: errors.filter(function (e) {
1167
- return e;
1168
- })
1169
- });
1170
- }
1171
- });
1172
-
1173
- if (!multiple && acceptedFiles.length > 1 || multiple && maxFiles >= 1 && acceptedFiles.length > maxFiles) {
1174
- // Reject everything and empty accepted files
1175
- acceptedFiles.forEach(function (file) {
1176
- fileRejections.push({
1177
- file: file,
1178
- errors: [TOO_MANY_FILES_REJECTION]
1179
- });
1180
- });
1181
- acceptedFiles.splice(0);
1182
- }
1183
-
1184
- dispatch({
1185
- acceptedFiles: acceptedFiles,
1186
- fileRejections: fileRejections,
1187
- type: 'setFiles'
1188
- });
1189
-
1190
- if (onDrop) {
1191
- onDrop(acceptedFiles, fileRejections, event);
1192
- }
1193
-
1194
- if (fileRejections.length > 0 && onDropRejected) {
1195
- onDropRejected(fileRejections, event);
1196
- }
1197
-
1198
- if (acceptedFiles.length > 0 && onDropAccepted) {
1199
- onDropAccepted(acceptedFiles, event);
1200
- }
1201
- }, [dispatch, multiple, accept, minSize, maxSize, maxFiles, onDrop, onDropAccepted, onDropRejected, validator]);
1202
- var onDropCb = React.useCallback(function (event) {
1203
- event.preventDefault(); // Persist here because we need the event later after getFilesFromEvent() is done
1204
-
1205
- event.persist();
1206
- stopPropagation(event);
1207
- dragTargetsRef.current = [];
1208
-
1209
- if (isEvtWithFiles(event)) {
1210
- Promise.resolve(getFilesFromEvent(event)).then(function (files) {
1211
- if (isPropagationStopped(event) && !noDragEventsBubbling) {
1212
- return;
1213
- }
1214
-
1215
- setFiles(files, event);
1216
- });
1217
- }
1218
-
1219
- dispatch({
1220
- type: 'reset'
1221
- });
1222
- }, [getFilesFromEvent, setFiles, noDragEventsBubbling]); // Fn for opening the file dialog programmatically
1223
-
1224
- var openFileDialog = React.useCallback(function () {
1225
- if (useFsAccessApi && canUseFileSystemAccessAPI()) {
1226
- dispatch({
1227
- type: 'openDialog'
1228
- });
1229
- onFileDialogOpenCb(); // https://developer.mozilla.org/en-US/docs/Web/API/window/showOpenFilePicker
1230
-
1231
- var opts = {
1232
- multiple: multiple,
1233
- types: filePickerOptionsTypes(accept)
1234
- };
1235
- window.showOpenFilePicker(opts).then(function (handles) {
1236
- return getFilesFromEvent(handles);
1237
- }).then(function (files) {
1238
- return setFiles(files, null);
1239
- }).catch(function (e) {
1240
- return onFileDialogCancelCb(e);
1241
- }).finally(function () {
1242
- return dispatch({
1243
- type: 'closeDialog'
1244
- });
1245
- });
1246
- return;
1247
- }
1248
-
1249
- if (inputRef.current) {
1250
- dispatch({
1251
- type: 'openDialog'
1252
- });
1253
- onFileDialogOpenCb();
1254
- inputRef.current.value = null;
1255
- inputRef.current.click();
1256
- }
1257
- }, [dispatch, onFileDialogOpenCb, onFileDialogCancelCb, useFsAccessApi, setFiles, accept, multiple]); // Cb to open the file dialog when SPACE/ENTER occurs on the dropzone
1258
-
1259
- var onKeyDownCb = React.useCallback(function (event) {
1260
- // Ignore keyboard events bubbling up the DOM tree
1261
- if (!rootRef.current || !rootRef.current.isEqualNode(event.target)) {
1262
- return;
1263
- }
1264
-
1265
- if (event.keyCode === 32 || event.keyCode === 13) {
1266
- event.preventDefault();
1267
- openFileDialog();
1268
- }
1269
- }, [rootRef, inputRef, openFileDialog]); // Update focus state for the dropzone
1270
-
1271
- var onFocusCb = React.useCallback(function () {
1272
- dispatch({
1273
- type: 'focus'
1274
- });
1275
- }, []);
1276
- var onBlurCb = React.useCallback(function () {
1277
- dispatch({
1278
- type: 'blur'
1279
- });
1280
- }, []); // Cb to open the file dialog when click occurs on the dropzone
1281
-
1282
- var onClickCb = React.useCallback(function () {
1283
- if (noClick) {
1284
- return;
1285
- } // In IE11/Edge the file-browser dialog is blocking, therefore, use setTimeout()
1286
- // to ensure React can handle state changes
1287
- // See: https://github.com/react-dropzone/react-dropzone/issues/450
1288
-
1289
-
1290
- if (isIeOrEdge()) {
1291
- setTimeout(openFileDialog, 0);
1292
- } else {
1293
- openFileDialog();
1294
- }
1295
- }, [inputRef, noClick, openFileDialog]);
1296
-
1297
- var composeHandler = function composeHandler(fn) {
1298
- return disabled ? null : fn;
1299
- };
1300
-
1301
- var composeKeyboardHandler = function composeKeyboardHandler(fn) {
1302
- return noKeyboard ? null : composeHandler(fn);
1303
- };
1304
-
1305
- var composeDragHandler = function composeDragHandler(fn) {
1306
- return noDrag ? null : composeHandler(fn);
1307
- };
1308
-
1309
- var stopPropagation = function stopPropagation(event) {
1310
- if (noDragEventsBubbling) {
1311
- event.stopPropagation();
1312
- }
1313
- };
1314
-
1315
- var getRootProps = React.useMemo(function () {
1316
- return function () {
1317
- var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1318
- _ref2$refKey = _ref2.refKey,
1319
- refKey = _ref2$refKey === void 0 ? 'ref' : _ref2$refKey,
1320
- role = _ref2.role,
1321
- onKeyDown = _ref2.onKeyDown,
1322
- onFocus = _ref2.onFocus,
1323
- onBlur = _ref2.onBlur,
1324
- onClick = _ref2.onClick,
1325
- onDragEnter = _ref2.onDragEnter,
1326
- onDragOver = _ref2.onDragOver,
1327
- onDragLeave = _ref2.onDragLeave,
1328
- onDrop = _ref2.onDrop,
1329
- rest = _objectWithoutProperties(_ref2, _excluded3);
1330
-
1331
- return _objectSpread(_objectSpread(_defineProperty({
1332
- onKeyDown: composeKeyboardHandler(composeEventHandlers(onKeyDown, onKeyDownCb)),
1333
- onFocus: composeKeyboardHandler(composeEventHandlers(onFocus, onFocusCb)),
1334
- onBlur: composeKeyboardHandler(composeEventHandlers(onBlur, onBlurCb)),
1335
- onClick: composeHandler(composeEventHandlers(onClick, onClickCb)),
1336
- onDragEnter: composeDragHandler(composeEventHandlers(onDragEnter, onDragEnterCb)),
1337
- onDragOver: composeDragHandler(composeEventHandlers(onDragOver, onDragOverCb)),
1338
- onDragLeave: composeDragHandler(composeEventHandlers(onDragLeave, onDragLeaveCb)),
1339
- onDrop: composeDragHandler(composeEventHandlers(onDrop, onDropCb)),
1340
- role: typeof role === 'string' && role !== '' ? role : 'button'
1341
- }, refKey, rootRef), !disabled && !noKeyboard ? {
1342
- tabIndex: 0
1343
- } : {}), rest);
1344
- };
1345
- }, [rootRef, onKeyDownCb, onFocusCb, onBlurCb, onClickCb, onDragEnterCb, onDragOverCb, onDragLeaveCb, onDropCb, noKeyboard, noDrag, disabled]);
1346
- var onInputElementClick = React.useCallback(function (event) {
1347
- event.stopPropagation();
1348
- }, []);
1349
- var getInputProps = React.useMemo(function () {
1350
- return function () {
1351
- var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1352
- _ref3$refKey = _ref3.refKey,
1353
- refKey = _ref3$refKey === void 0 ? 'ref' : _ref3$refKey,
1354
- onChange = _ref3.onChange,
1355
- onClick = _ref3.onClick,
1356
- rest = _objectWithoutProperties(_ref3, _excluded4);
1357
-
1358
- var inputProps = _defineProperty({
1359
- accept: accept,
1360
- multiple: multiple,
1361
- type: 'file',
1362
- style: {
1363
- display: 'none'
1364
- },
1365
- onChange: composeHandler(composeEventHandlers(onChange, onDropCb)),
1366
- onClick: composeHandler(composeEventHandlers(onClick, onInputElementClick)),
1367
- autoComplete: 'off',
1368
- tabIndex: -1
1369
- }, refKey, inputRef);
1370
-
1371
- return _objectSpread(_objectSpread({}, inputProps), rest);
1372
- };
1373
- }, [inputRef, accept, multiple, onDropCb, disabled]);
1374
- var fileCount = draggedFiles.length;
1375
- var isDragAccept = fileCount > 0 && allFilesAccepted({
1376
- files: draggedFiles,
1377
- accept: accept,
1378
- minSize: minSize,
1379
- maxSize: maxSize,
1380
- multiple: multiple,
1381
- maxFiles: maxFiles
1382
- });
1383
- var isDragReject = fileCount > 0 && !isDragAccept;
1384
- return _objectSpread(_objectSpread({}, state), {}, {
1385
- isDragAccept: isDragAccept,
1386
- isDragReject: isDragReject,
1387
- isFocused: isFocused && !disabled,
1388
- getRootProps: getRootProps,
1389
- getInputProps: getInputProps,
1390
- rootRef: rootRef,
1391
- inputRef: inputRef,
1392
- open: composeHandler(openFileDialog)
1393
- });
1394
- }
1395
-
1396
- function reducer(state, action) {
1397
- /* istanbul ignore next */
1398
- switch (action.type) {
1399
- case 'focus':
1400
- return _objectSpread(_objectSpread({}, state), {}, {
1401
- isFocused: true
1402
- });
1403
-
1404
- case 'blur':
1405
- return _objectSpread(_objectSpread({}, state), {}, {
1406
- isFocused: false
1407
- });
1408
-
1409
- case 'openDialog':
1410
- return _objectSpread(_objectSpread({}, initialState), {}, {
1411
- isFileDialogActive: true
1412
- });
1413
-
1414
- case 'closeDialog':
1415
- return _objectSpread(_objectSpread({}, state), {}, {
1416
- isFileDialogActive: false
1417
- });
1418
-
1419
- case 'setDraggedFiles':
1420
- /* eslint no-case-declarations: 0 */
1421
- var isDragActive = action.isDragActive,
1422
- draggedFiles = action.draggedFiles;
1423
- return _objectSpread(_objectSpread({}, state), {}, {
1424
- draggedFiles: draggedFiles,
1425
- isDragActive: isDragActive
1426
- });
1427
-
1428
- case 'setFiles':
1429
- return _objectSpread(_objectSpread({}, state), {}, {
1430
- acceptedFiles: action.acceptedFiles,
1431
- fileRejections: action.fileRejections
1432
- });
1433
-
1434
- case 'reset':
1435
- return _objectSpread({}, initialState);
1436
-
1437
- default:
1438
- return state;
1439
- }
1440
- }
1441
-
1442
- function noop() {}
1443
-
1444
- var css_248z = ".grljXfTWj84- {\n font-size: 0;\n line-height: 0;\n -webkit-user-select: none;\n -ms-user-select: none;\n user-select: none;\n cursor: pointer;\n}\n\n.grljXfTWj84-:focus,\n.grljXfTWj84-:focus-within {\n border-color: var(--color-focus);\n outline: none;\n}\n\n.WHhHWgaoXk4- {\n padding: var(--space-base);\n border: var(--color-border) dashed var(--border-thick);\n border-radius: var(--radius-larger);\n text-align: center;\n}\n\n.WHhHWgaoXk4-.n1h-T2metRA- {\n border-color: var(--color-focus);\n background-color: var(--color-surface--hover);\n}\n\n.WHhHWgaoXk4-.MRRclAp51-w- {\n border-color: var(--color-critical);\n}\n\n.TIbSRNvDK10- {\n display: -ms-flexbox;\n display: flex;\n -ms-flex-direction: column;\n flex-direction: column;\n}\n";
1445
- var styles = {"dropZoneBase":"grljXfTWj84-","dropZone":"WHhHWgaoXk4-","active":"n1h-T2metRA-","error":"MRRclAp51-w-","validationErrors":"TIbSRNvDK10-"};
1446
- styleInject_es.styleInject(css_248z);
1447
-
1448
- function InputFile({ variation = "dropzone", size = "base", buttonLabel: providedButtonLabel, allowMultiple = false, allowedTypes = "all", getUploadParams, onUploadStart, onUploadProgress, onUploadComplete, onUploadError, validator, }) {
1449
- const options = {
1450
- multiple: allowMultiple,
1451
- onDrop: React.useCallback(handleDrop, [uploadFile]),
1452
- validator: validator && React.useCallback(validator, []),
1453
- };
1454
- if (allowedTypes === "images") {
1455
- options.accept = "image/*";
1456
- }
1457
- else if (allowedTypes === "basicImages") {
1458
- options.accept = "image/png, image/jpg, image/jpeg";
1459
- }
1460
- else if (Array.isArray(allowedTypes)) {
1461
- options.accept = allowedTypes.join(",");
1462
- }
1463
- const { getRootProps, getInputProps, isDragActive, fileRejections } = useDropzone(options);
1464
- const validationErrors = fileRejections === null || fileRejections === void 0 ? void 0 : fileRejections.map(({ file, errors }) => {
1465
- return errors.map(error => {
1466
- return (React.createElement(InputValidation.InputValidation, { message: `${file.name} ${error.message}`, key: `${file.name}${error.code}` }));
1467
- });
1468
- });
1469
- const { buttonLabel, hintText } = getLabels(providedButtonLabel, allowMultiple, allowedTypes);
1470
- const dropZone = classnames(styles.dropZoneBase, {
1471
- [styles.dropZone]: variation === "dropzone",
1472
- [styles.active]: isDragActive,
1473
- [styles.error]: (fileRejections === null || fileRejections === void 0 ? void 0 : fileRejections.length) > 0,
1474
- });
1475
- return (React.createElement(React.Fragment, null,
1476
- React.createElement("div", Object.assign({}, getRootProps({ className: dropZone }), { tabIndex: variation === "button" ? -1 : 0 }),
1477
- React.createElement("input", Object.assign({}, getInputProps())),
1478
- variation === "dropzone" && (React.createElement(Content.Content, { spacing: "small" },
1479
- React.createElement(Button.Button, { label: buttonLabel, size: "small", type: "secondary" }),
1480
- size === "base" && (React.createElement(Typography.Typography, { size: "small", textColor: "textSecondary" }, hintText)))),
1481
- variation === "button" && (React.createElement(Button.Button, { label: buttonLabel, size: size, type: "secondary", fullWidth: true }))),
1482
- (fileRejections === null || fileRejections === void 0 ? void 0 : fileRejections.length) > 0 && (React.createElement("div", { className: styles.validationErrors }, validationErrors))));
1483
- function handleDrop(acceptedFiles) {
1484
- acceptedFiles.forEach(file => {
1485
- uploadFile(file);
1486
- });
1487
- }
1488
- function uploadFile(file) {
1489
- return tslib_es6.__awaiter(this, void 0, void 0, function* () {
1490
- let params;
1491
- try {
1492
- params = yield getUploadParams(file);
1493
- }
1494
- catch (_a) {
1495
- onUploadError && onUploadError(new Error("Failed to get upload params"));
1496
- return;
1497
- }
1498
- const { url, key = generateId(), fields = {}, httpMethod = "POST", } = params;
1499
- const fileUpload = getFileUpload(file, key, url);
1500
- onUploadStart && onUploadStart(Object.assign({}, fileUpload));
1501
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1502
- const handleUploadProgress = (progressEvent) => {
1503
- onUploadProgress &&
1504
- onUploadProgress(Object.assign(Object.assign({}, fileUpload), { progress: progressEvent.loaded / progressEvent.total }));
1505
- };
1506
- const handleUploadComplete = () => {
1507
- onUploadComplete === null || onUploadComplete === void 0 ? void 0 : onUploadComplete(Object.assign(Object.assign({}, fileUpload), { progress: 1 }));
1508
- };
1509
- const axiosConfig = createAxiosConfig({
1510
- url,
1511
- httpMethod,
1512
- fields,
1513
- file,
1514
- handleUploadProgress,
1515
- });
1516
- axios
1517
- .request(axiosConfig)
1518
- .then(handleUploadComplete)
1519
- .catch(() => {
1520
- onUploadError && onUploadError(new Error("Failed to upload file"));
1521
- });
1522
- });
1523
- }
1524
- }
1525
- function createAxiosConfig({ url, httpMethod = "POST", fields = {}, file, handleUploadProgress, }) {
1526
- let data;
1527
- let headers;
1528
- if (httpMethod === "POST") {
1529
- const formData = new FormData();
1530
- Object.entries(fields).forEach(([field, value]) => formData.append(field, value));
1531
- formData.append("file", file);
1532
- data = formData;
1533
- headers = { "X-Requested-With": "XMLHttpRequest" };
1534
- }
1535
- else {
1536
- data = file;
1537
- headers = fields;
1538
- }
1539
- return {
1540
- method: httpMethod,
1541
- url: url,
1542
- headers: headers,
1543
- data: data,
1544
- onUploadProgress: handleUploadProgress,
1545
- };
1546
- }
1547
- function getLabels(providedButtonLabel, multiple, allowedTypes) {
1548
- let buttonLabel = multiple ? "Upload Files" : "Upload File";
1549
- let hintText = multiple
1550
- ? "or drag files here to upload"
1551
- : "or drag a file here to upload";
1552
- if (allowedTypes === "images" || allowedTypes === "basicImages") {
1553
- buttonLabel = multiple ? "Upload Images" : "Upload Image";
1554
- hintText = multiple
1555
- ? "or drag images here to upload"
1556
- : "or drag an image here to upload";
1557
- }
1558
- if (providedButtonLabel)
1559
- buttonLabel = providedButtonLabel;
1560
- return { buttonLabel, hintText };
1561
- }
1562
- function getFileUpload(file, key, uploadUrl) {
1563
- return {
1564
- key: key,
1565
- name: file.name,
1566
- type: file.type,
1567
- size: file.size,
1568
- progress: 0,
1569
- src: getSrc,
1570
- uploadUrl,
1571
- };
1572
- function getSrc() {
1573
- const promise = new Promise((resolve, reject) => {
1574
- const reader = new FileReader();
1575
- reader.onload = event => {
1576
- if (event.target &&
1577
- event.target.result &&
1578
- typeof event.target.result === "string") {
1579
- resolve(event.target.result);
1580
- }
1581
- else {
1582
- reject("Could not generate file data url.");
1583
- }
1584
- };
1585
- reader.readAsDataURL(file);
1586
- });
1587
- return promise;
1588
- }
1589
- }
1590
- /**
1591
- * Upsert a given `FileUpload` into an array of `FileUpload`s.
1592
- * `key` is used to uniquely identify files.
1593
- *
1594
- * @param updatedFile FileUpload File that was updated.
1595
- * @param files Existing array of FileUploads.
1596
- * @returns FileUpload[] updated set of files.
1597
- */
1598
- function updateFiles(updatedFile, files) {
1599
- const newFiles = [...files];
1600
- const index = files.findIndex(file => file.key === updatedFile.key);
1601
- if (index !== -1) {
1602
- newFiles[index] = updatedFile;
1603
- }
1604
- else {
1605
- newFiles.push(updatedFile);
1606
- }
1607
- return newFiles;
1608
- }
1609
- function generateId() {
1610
- return Math.floor(Math.random() * Date.now()).toString(16);
1611
- }
1612
-
1613
- exports.InputFile = InputFile;
1614
- exports.updateFiles = updateFiles;