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