@mantine/dropzone 5.0.0-alpha.11 → 5.0.0-alpha.14

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 (66) hide show
  1. package/cjs/Dropzone.context.js +11 -0
  2. package/cjs/Dropzone.context.js.map +1 -0
  3. package/cjs/{Dropzone/Dropzone.js → Dropzone.js} +64 -13
  4. package/cjs/Dropzone.js.map +1 -0
  5. package/cjs/{Dropzone/Dropzone.styles.js → Dropzone.styles.js} +23 -19
  6. package/cjs/Dropzone.styles.js.map +1 -0
  7. package/cjs/DropzoneFullScreen.js +135 -0
  8. package/cjs/DropzoneFullScreen.js.map +1 -0
  9. package/cjs/DropzoneFullScreen.styles.js +25 -0
  10. package/cjs/DropzoneFullScreen.styles.js.map +1 -0
  11. package/cjs/DropzoneStatus.js +43 -0
  12. package/cjs/DropzoneStatus.js.map +1 -0
  13. package/cjs/index.js +5 -5
  14. package/cjs/index.js.map +1 -1
  15. package/esm/Dropzone.context.js +6 -0
  16. package/esm/Dropzone.context.js.map +1 -0
  17. package/esm/{Dropzone/Dropzone.js → Dropzone.js} +63 -14
  18. package/esm/Dropzone.js.map +1 -0
  19. package/esm/{Dropzone/Dropzone.styles.js → Dropzone.styles.js} +23 -19
  20. package/esm/Dropzone.styles.js.map +1 -0
  21. package/esm/DropzoneFullScreen.js +127 -0
  22. package/esm/DropzoneFullScreen.js.map +1 -0
  23. package/esm/DropzoneFullScreen.styles.js +21 -0
  24. package/esm/DropzoneFullScreen.styles.js.map +1 -0
  25. package/esm/DropzoneStatus.js +37 -0
  26. package/esm/DropzoneStatus.js.map +1 -0
  27. package/esm/index.js +7 -2
  28. package/esm/index.js.map +1 -1
  29. package/lib/Dropzone.context.d.ts +10 -0
  30. package/lib/Dropzone.context.d.ts.map +1 -0
  31. package/lib/Dropzone.d.ts +67 -0
  32. package/lib/Dropzone.d.ts.map +1 -0
  33. package/lib/{Dropzone/Dropzone.styles.d.ts → Dropzone.styles.d.ts} +2 -2
  34. package/lib/Dropzone.styles.d.ts.map +1 -0
  35. package/lib/DropzoneFullScreen.d.ts +16 -0
  36. package/lib/DropzoneFullScreen.d.ts.map +1 -0
  37. package/lib/DropzoneFullScreen.styles.d.ts +7 -0
  38. package/lib/DropzoneFullScreen.styles.d.ts.map +1 -0
  39. package/lib/DropzoneStatus.d.ts +20 -0
  40. package/lib/DropzoneStatus.d.ts.map +1 -0
  41. package/lib/index.d.ts +19 -2
  42. package/lib/index.d.ts.map +1 -1
  43. package/package.json +5 -4
  44. package/cjs/Dropzone/Dropzone.js.map +0 -1
  45. package/cjs/Dropzone/Dropzone.styles.js.map +0 -1
  46. package/cjs/FullScreenDropzone/FullScreenDropzone.js +0 -150
  47. package/cjs/FullScreenDropzone/FullScreenDropzone.js.map +0 -1
  48. package/cjs/FullScreenDropzone/FullscreenDropzone.styles.js +0 -71
  49. package/cjs/FullScreenDropzone/FullscreenDropzone.styles.js.map +0 -1
  50. package/esm/Dropzone/Dropzone.js.map +0 -1
  51. package/esm/Dropzone/Dropzone.styles.js.map +0 -1
  52. package/esm/FullScreenDropzone/FullScreenDropzone.js +0 -142
  53. package/esm/FullScreenDropzone/FullScreenDropzone.js.map +0 -1
  54. package/esm/FullScreenDropzone/FullscreenDropzone.styles.js +0 -67
  55. package/esm/FullScreenDropzone/FullscreenDropzone.styles.js.map +0 -1
  56. package/lib/Dropzone/Dropzone.d.ts +0 -41
  57. package/lib/Dropzone/Dropzone.d.ts.map +0 -1
  58. package/lib/Dropzone/Dropzone.styles.d.ts.map +0 -1
  59. package/lib/Dropzone/index.d.ts +0 -4
  60. package/lib/Dropzone/index.d.ts.map +0 -1
  61. package/lib/FullScreenDropzone/FullScreenDropzone.d.ts +0 -28
  62. package/lib/FullScreenDropzone/FullScreenDropzone.d.ts.map +0 -1
  63. package/lib/FullScreenDropzone/FullscreenDropzone.styles.d.ts +0 -15
  64. package/lib/FullScreenDropzone/FullscreenDropzone.styles.d.ts.map +0 -1
  65. package/lib/FullScreenDropzone/index.d.ts +0 -4
  66. package/lib/FullScreenDropzone/index.d.ts.map +0 -1
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var utils = require('@mantine/utils');
6
+
7
+ const [DropzoneProvider, useDropzoneContext] = utils.createSafeContext("Dropzone component was not found in tree");
8
+
9
+ exports.DropzoneProvider = DropzoneProvider;
10
+ exports.useDropzoneContext = useDropzoneContext;
11
+ //# sourceMappingURL=Dropzone.context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dropzone.context.js","sources":["../src/Dropzone.context.ts"],"sourcesContent":["import { createSafeContext } from '@mantine/utils';\n\nexport interface DropzoneContextValue {\n idle: boolean;\n accept: boolean;\n reject: boolean;\n}\n\nexport const [DropzoneProvider, useDropzoneContext] = createSafeContext<DropzoneContextValue>(\n 'Dropzone component was not found in tree'\n);\n"],"names":["createSafeContext"],"mappings":";;;;;;AACY,MAAC,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,GAAGA,uBAAiB,CAAC,0CAA0C;;;;;"}
@@ -6,6 +6,8 @@ var React = require('react');
6
6
  var reactDropzone = require('react-dropzone');
7
7
  var core = require('@mantine/core');
8
8
  var hooks = require('@mantine/hooks');
9
+ var Dropzone_context = require('./Dropzone.context.js');
10
+ var DropzoneStatus = require('./DropzoneStatus.js');
9
11
  var Dropzone_styles = require('./Dropzone.styles.js');
10
12
 
11
13
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e['default'] : e; }
@@ -47,9 +49,14 @@ const defaultProps = {
47
49
  padding: "md",
48
50
  loading: false,
49
51
  multiple: true,
50
- maxSize: Infinity
52
+ maxSize: Infinity,
53
+ autoFocus: false,
54
+ activateOnClick: true,
55
+ activateOnDrag: true,
56
+ dragEventsBubbling: true,
57
+ activateOnKeyboard: true
51
58
  };
52
- const Dropzone = React.forwardRef((props, ref) => {
59
+ const _Dropzone = React.forwardRef((props, ref) => {
53
60
  const _a = core.useComponentDefaultProps("Dropzone", defaultProps, props), {
54
61
  className,
55
62
  padding,
@@ -67,7 +74,18 @@ const Dropzone = React.forwardRef((props, ref) => {
67
74
  openRef,
68
75
  name,
69
76
  unstyled,
70
- maxFiles
77
+ maxFiles,
78
+ autoFocus,
79
+ activateOnClick,
80
+ activateOnDrag,
81
+ dragEventsBubbling,
82
+ activateOnKeyboard,
83
+ onDragEnter,
84
+ onDragLeave,
85
+ onDragOver,
86
+ onFileDialogCancel,
87
+ onFileDialogOpen,
88
+ preventDropOnDocument
71
89
  } = _a, others = __objRest(_a, [
72
90
  "className",
73
91
  "padding",
@@ -85,7 +103,18 @@ const Dropzone = React.forwardRef((props, ref) => {
85
103
  "openRef",
86
104
  "name",
87
105
  "unstyled",
88
- "maxFiles"
106
+ "maxFiles",
107
+ "autoFocus",
108
+ "activateOnClick",
109
+ "activateOnDrag",
110
+ "dragEventsBubbling",
111
+ "activateOnKeyboard",
112
+ "onDragEnter",
113
+ "onDragLeave",
114
+ "onDragOver",
115
+ "onFileDialogCancel",
116
+ "onFileDialogOpen",
117
+ "preventDropOnDocument"
89
118
  ]);
90
119
  const { classes, cx } = Dropzone_styles['default']({ radius, padding }, { classNames, styles, unstyled, name: "Dropzone" });
91
120
  const { getRootProps, getInputProps, isDragAccept, isDragReject, open } = reactDropzone.useDropzone({
@@ -95,24 +124,46 @@ const Dropzone = React.forwardRef((props, ref) => {
95
124
  accept: Array.isArray(accept) ? accept.reduce((r, key) => __spreadProps(__spreadValues({}, r), { [key]: [] }), {}) : accept,
96
125
  multiple,
97
126
  maxSize,
98
- maxFiles
127
+ maxFiles,
128
+ autoFocus,
129
+ noClick: !activateOnClick,
130
+ noDrag: !activateOnDrag,
131
+ noDragEventsBubbling: !dragEventsBubbling,
132
+ noKeyboard: !activateOnKeyboard,
133
+ onDragEnter,
134
+ onDragLeave,
135
+ onDragOver,
136
+ onFileDialogCancel,
137
+ onFileDialogOpen,
138
+ preventDropOnDocument
99
139
  });
100
140
  hooks.assignRef(openRef, open);
101
- return /* @__PURE__ */ React__default.createElement(core.Box, __spreadProps(__spreadValues(__spreadValues({}, others), getRootProps({ ref })), {
102
- className: cx(classes.root, {
103
- [classes.active]: isDragAccept,
104
- [classes.reject]: isDragReject,
105
- [classes.loading]: loading
106
- }, className)
141
+ const isIdle = !isDragAccept && !isDragReject;
142
+ return /* @__PURE__ */ React__default.createElement(Dropzone_context.DropzoneProvider, {
143
+ value: { accept: isDragAccept, reject: isDragReject, idle: isIdle }
144
+ }, /* @__PURE__ */ React__default.createElement(core.Box, __spreadProps(__spreadValues(__spreadValues({}, others), getRootProps({ ref })), {
145
+ "data-accept": isDragAccept || void 0,
146
+ "data-reject": isDragReject || void 0,
147
+ "data-idle": isIdle || void 0,
148
+ "data-loading": loading || void 0,
149
+ className: cx(classes.root, className)
107
150
  }), /* @__PURE__ */ React__default.createElement(core.LoadingOverlay, {
108
151
  visible: loading,
109
152
  radius,
110
153
  unstyled
111
154
  }), /* @__PURE__ */ React__default.createElement("input", __spreadProps(__spreadValues({}, getInputProps()), {
112
155
  name
113
- })), children({ accepted: isDragAccept, rejected: isDragReject }));
156
+ })), /* @__PURE__ */ React__default.createElement("div", {
157
+ className: classes.inner
158
+ }, children)));
114
159
  });
115
- Dropzone.displayName = "@mantine/dropzone/Dropzone";
160
+ _Dropzone.displayName = "@mantine/dropzone/Dropzone";
161
+ _Dropzone.Accept = DropzoneStatus.DropzoneAccept;
162
+ _Dropzone.Reject = DropzoneStatus.DropzoneReject;
163
+ _Dropzone.Idle = DropzoneStatus.DropzoneIdle;
164
+ const Dropzone = _Dropzone;
116
165
 
117
166
  exports.Dropzone = Dropzone;
167
+ exports._Dropzone = _Dropzone;
168
+ exports.defaultProps = defaultProps;
118
169
  //# sourceMappingURL=Dropzone.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dropzone.js","sources":["../src/Dropzone.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport { useDropzone, FileRejection, Accept } from 'react-dropzone';\nimport {\n DefaultProps,\n Selectors,\n MantineNumberSize,\n LoadingOverlay,\n Box,\n useComponentDefaultProps,\n} from '@mantine/core';\nimport { assignRef } from '@mantine/hooks';\nimport { ForwardRefWithStaticComponents } from '@mantine/utils';\nimport { DropzoneProvider } from './Dropzone.context';\nimport { DropzoneAccept, DropzoneIdle, DropzoneReject } from './DropzoneStatus';\nimport type { DropzoneFullScreenType } from './DropzoneFullScreen';\nimport useStyles from './Dropzone.styles';\n\nexport type DropzoneStylesNames = Selectors<typeof useStyles>;\n\nexport interface DropzoneProps\n extends DefaultProps<DropzoneStylesNames>,\n Omit<React.ComponentPropsWithRef<'div'>, 'onDrop'> {\n /** Padding from theme.spacing, or number to set padding in px */\n padding?: MantineNumberSize;\n\n /** Border radius from theme.radius or number to set border-radius in px */\n radius?: MantineNumberSize;\n\n /** Dropzone statues */\n children: React.ReactNode;\n\n /** Disable files capturing */\n disabled?: boolean;\n\n /** Called when files are dropped into dropzone */\n onDrop(files: File[]): void;\n\n /** Called when selected files don't meet file restrictions */\n onReject?(fileRejections: FileRejection[]): void;\n\n /** Display loading overlay over dropzone */\n loading?: boolean;\n\n /** File types to accept */\n accept?: Accept | string[];\n\n /** Get open function as ref */\n openRef?: React.ForwardedRef<() => void | undefined>;\n\n /** Allow selection of multiple files */\n multiple?: boolean;\n\n /** Set maximum file size in bytes */\n maxSize?: number;\n\n /** Name of the form control. Submitted with the form as part of a name/value pair. */\n name?: string;\n\n /** Number of files that user can pick */\n maxFiles?: number;\n\n /** Set to true to autofocus the root element */\n autoFocus?: boolean;\n\n /** If false, disables click to open the native file selection dialog */\n activateOnClick?: boolean;\n\n /** If false, disables drag 'n' drop */\n activateOnDrag?: boolean;\n\n /** If false, disables Space/Enter to open the native file selection dialog. Note that it also stops tracking the focus state. */\n activateOnKeyboard?: boolean;\n\n /** If false, stops drag event propagation to parents */\n dragEventsBubbling?: boolean;\n\n /** Called when the `dragenter` event occurs */\n onDragEnter?(event: React.DragEvent<HTMLElement>): void;\n\n /** Called when the `dragleave` event occurs */\n onDragLeave?(event: React.DragEvent<HTMLElement>): void;\n\n /** Called when the `dragover` event occurs */\n onDragOver?(event: React.DragEvent<HTMLElement>): void;\n\n /** Called when user closes the file selection dialog with no selection */\n onFileDialogCancel?(): void;\n\n /** Called when user opens the file selection dialog */\n onFileDialogOpen?(): void;\n\n /** If false, allow dropped items to take over the current browser window */\n preventDropOnDocument?: boolean;\n}\n\nexport const defaultProps: Partial<DropzoneProps> = {\n padding: 'md',\n loading: false,\n multiple: true,\n maxSize: Infinity,\n autoFocus: false,\n activateOnClick: true,\n activateOnDrag: true,\n dragEventsBubbling: true,\n activateOnKeyboard: true,\n};\n\nexport const _Dropzone: any = forwardRef<HTMLDivElement, DropzoneProps>(\n (props: DropzoneProps, ref) => {\n const {\n className,\n padding,\n radius,\n disabled,\n classNames,\n styles,\n loading,\n multiple,\n maxSize,\n accept,\n children,\n onDrop,\n onReject,\n openRef,\n name,\n unstyled,\n maxFiles,\n autoFocus,\n activateOnClick,\n activateOnDrag,\n dragEventsBubbling,\n activateOnKeyboard,\n onDragEnter,\n onDragLeave,\n onDragOver,\n onFileDialogCancel,\n onFileDialogOpen,\n preventDropOnDocument,\n ...others\n } = useComponentDefaultProps('Dropzone', defaultProps, props);\n\n const { classes, cx } = useStyles(\n { radius, padding },\n { classNames, styles, unstyled, name: 'Dropzone' }\n );\n\n const { getRootProps, getInputProps, isDragAccept, isDragReject, open } = useDropzone({\n onDropAccepted: onDrop,\n onDropRejected: onReject,\n disabled: disabled || loading,\n accept: Array.isArray(accept) ? accept.reduce((r, key) => ({ ...r, [key]: [] }), {}) : accept,\n multiple,\n maxSize,\n maxFiles,\n autoFocus,\n noClick: !activateOnClick,\n noDrag: !activateOnDrag,\n noDragEventsBubbling: !dragEventsBubbling,\n noKeyboard: !activateOnKeyboard,\n onDragEnter,\n onDragLeave,\n onDragOver,\n onFileDialogCancel,\n onFileDialogOpen,\n preventDropOnDocument,\n });\n\n assignRef(openRef, open);\n\n const isIdle = !isDragAccept && !isDragReject;\n\n return (\n <DropzoneProvider value={{ accept: isDragAccept, reject: isDragReject, idle: isIdle }}>\n <Box\n {...others}\n {...getRootProps({ ref })}\n data-accept={isDragAccept || undefined}\n data-reject={isDragReject || undefined}\n data-idle={isIdle || undefined}\n data-loading={loading || undefined}\n className={cx(classes.root, className)}\n >\n <LoadingOverlay visible={loading} radius={radius} unstyled={unstyled} />\n <input {...getInputProps()} name={name} />\n <div className={classes.inner}>{children}</div>\n </Box>\n </DropzoneProvider>\n );\n }\n);\n\n_Dropzone.displayName = '@mantine/dropzone/Dropzone';\n_Dropzone.Accept = DropzoneAccept;\n_Dropzone.Reject = DropzoneReject;\n_Dropzone.Idle = DropzoneIdle;\n\nexport const Dropzone: ForwardRefWithStaticComponents<\n DropzoneProps,\n {\n Accept: typeof DropzoneAccept;\n Reject: typeof DropzoneReject;\n Idle: typeof DropzoneIdle;\n FullScreen: DropzoneFullScreenType;\n }\n> = _Dropzone;\n"],"names":["forwardRef","useComponentDefaultProps","useStyles","useDropzone","assignRef","React","DropzoneProvider","Box","LoadingOverlay","DropzoneAccept","DropzoneReject","DropzoneIdle"],"mappings":";;;;;;;;;;;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,UAAU,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACzC,IAAI,iBAAiB,GAAG,MAAM,CAAC,yBAAyB,CAAC;AACzD,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,E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OAAO,EAAE,OAAO;AACpB,IAAI,MAAM;AACV,IAAI,QAAQ;AACZ,GAAG,CAAC,kBAAkBH,cAAK,CAAC,aAAa,CAAC,OAAO,EAAE,aAAa,CAAC,cAAc,CAAC,EAAE,EAAE,aAAa,EAAE,CAAC,EAAE;AACtG,IAAI,IAAI;AACR,GAAG,CAAC,CAAC,kBAAkBA,cAAK,CAAC,aAAa,CAAC,KAAK,EAAE;AAClD,IAAI,SAAS,EAAE,OAAO,CAAC,KAAK;AAC5B,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;AACjB,CAAC,EAAE;AACH,SAAS,CAAC,WAAW,GAAG,4BAA4B,CAAC;AACrD,SAAS,CAAC,MAAM,GAAGI,6BAAc,CAAC;AAClC,SAAS,CAAC,MAAM,GAAGC,6BAAc,CAAC;AAClC,SAAS,CAAC,IAAI,GAAGC,2BAAY,CAAC;AAClB,MAAC,QAAQ,GAAG;;;;;;"}
@@ -39,27 +39,31 @@ var useStyles = core.createStyles((theme, { padding, radius }) => {
39
39
  position: "relative",
40
40
  "&:hover": {
41
41
  backgroundColor: theme.colorScheme === "dark" ? theme.colors.dark[5] : theme.colors.gray[0]
42
+ },
43
+ "&[data-loading]": {
44
+ cursor: "default",
45
+ "&:hover": {
46
+ backgroundColor: theme.colorScheme === "dark" ? theme.colors.dark[6] : theme.white
47
+ }
48
+ },
49
+ "&[data-accept]": {
50
+ backgroundColor: theme.colorScheme === "dark" ? accepted.background : theme.colors[theme.primaryColor][0],
51
+ borderColor: theme.colorScheme === "dark" ? accepted.border : theme.colors[theme.primaryColor][4],
52
+ "&:hover": {
53
+ backgroundColor: theme.colorScheme === "dark" ? accepted.background : theme.colors[theme.primaryColor][0]
54
+ }
55
+ },
56
+ "&[data-reject]": {
57
+ backgroundColor: theme.colorScheme === "dark" ? rejected.background : theme.colors.red[0],
58
+ borderColor: theme.colorScheme === "dark" ? rejected.border : theme.colors.red[4],
59
+ "&:hover": {
60
+ backgroundColor: theme.colorScheme === "dark" ? rejected.background : theme.colors.red[0]
61
+ }
42
62
  }
43
63
  }),
44
- loading: {
45
- cursor: "default",
46
- "&:hover": {
47
- backgroundColor: theme.colorScheme === "dark" ? theme.colors.dark[7] : theme.white
48
- }
49
- },
50
- active: {
51
- backgroundColor: theme.colorScheme === "dark" ? accepted.background : theme.colors[theme.primaryColor][0],
52
- borderColor: theme.colorScheme === "dark" ? accepted.border : theme.colors[theme.primaryColor][4],
53
- "&:hover": {
54
- backgroundColor: theme.colorScheme === "dark" ? accepted.background : theme.colors[theme.primaryColor][0]
55
- }
56
- },
57
- reject: {
58
- backgroundColor: theme.colorScheme === "dark" ? rejected.background : theme.colors.red[0],
59
- borderColor: theme.colorScheme === "dark" ? rejected.border : theme.colors.red[4],
60
- "&:hover": {
61
- backgroundColor: theme.colorScheme === "dark" ? rejected.background : theme.colors.red[0]
62
- }
64
+ inner: {
65
+ pointerEvents: "none",
66
+ userSelect: "none"
63
67
  }
64
68
  };
65
69
  });
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dropzone.styles.js","sources":["../src/Dropzone.styles.ts"],"sourcesContent":["import { createStyles, MantineNumberSize } from '@mantine/core';\n\nexport interface DropzoneStylesParams {\n padding: MantineNumberSize;\n radius: MantineNumberSize;\n}\n\nexport default createStyles((theme, { padding, radius }: DropzoneStylesParams) => {\n const rejected = theme.fn.variant({ color: 'red', variant: 'light' });\n const accepted = theme.fn.variant({ color: theme.primaryColor, variant: 'light' });\n\n return {\n root: {\n ...theme.fn.fontStyles(),\n ...theme.fn.focusStyles(),\n boxSizing: 'border-box',\n backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark[6] : theme.white,\n border: `2px dashed ${\n theme.colorScheme === 'dark' ? theme.colors.dark[4] : theme.colors.gray[4]\n }`,\n padding: theme.fn.size({ size: padding, sizes: theme.spacing }),\n borderRadius: theme.fn.radius(radius),\n cursor: 'pointer',\n userSelect: 'none',\n transition: 'background-color 150ms ease',\n position: 'relative',\n\n '&:hover': {\n backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark[5] : theme.colors.gray[0],\n },\n\n '&[data-loading]': {\n cursor: 'default',\n\n '&:hover': {\n backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark[6] : theme.white,\n },\n },\n\n '&[data-accept]': {\n backgroundColor:\n theme.colorScheme === 'dark' ? accepted.background : theme.colors[theme.primaryColor][0],\n borderColor:\n theme.colorScheme === 'dark' ? accepted.border : theme.colors[theme.primaryColor][4],\n\n '&:hover': {\n backgroundColor:\n theme.colorScheme === 'dark'\n ? accepted.background\n : theme.colors[theme.primaryColor][0],\n },\n },\n\n '&[data-reject]': {\n backgroundColor: theme.colorScheme === 'dark' ? rejected.background : theme.colors.red[0],\n borderColor: theme.colorScheme === 'dark' ? rejected.border : theme.colors.red[4],\n\n '&:hover': {\n backgroundColor: theme.colorScheme === 'dark' ? rejected.background : theme.colors.red[0],\n },\n },\n },\n\n inner: {\n pointerEvents: 'none',\n userSelect: 'none',\n },\n };\n});\n"],"names":["createStyles"],"mappings":";;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,UAAU,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACzC,IAAI,iBAAiB,GAAG,MAAM,CAAC,yBAAyB,CAAC;AACzD,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,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AM,GAAG,QAAQ,CAAC,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;AACjH,QAAQ,WAAW,EAAE,KAAK,CAAC,WAAW,KAAK,MAAM,GAAG,QAAQ,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;AACzG,QAAQ,SAAS,EAAE;AACnB,UAAU,eAAe,EAAE,KAAK,CAAC,WAAW,KAAK,MAAM,GAAG,QAAQ,CAAC,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;AACnH,SAAS;AACT,OAAO;AACP,MAAM,gBAAgB,EAAE;AACxB,QAAQ,eAAe,EAAE,KAAK,CAAC,WAAW,KAAK,MAAM,GAAG,QAAQ,CAAC,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;AACjG,QAAQ,WAAW,EAAE,KAAK,CAAC,WAAW,KAAK,MAAM,GAAG,QAAQ,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;AACzF,QAAQ,SAAS,EAAE;AACnB,UAAU,eAAe,EAAE,KAAK,CAAC,WAAW,KAAK,MAAM,GAAG,QAAQ,CAAC,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;AACnG,SAAS;AACT,OAAO;AACP,KAAK,CAAC;AACN,IAAI,KAAK,EAAE;AACX,MAAM,aAAa,EAAE,MAAM;AAC3B,MAAM,UAAU,EAAE,MAAM;AACxB,KAAK;AACL,GAAG,CAAC;AACJ,CAAC,CAAC;;;;"}
@@ -0,0 +1,135 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var React = require('react');
6
+ var core = require('@mantine/core');
7
+ var hooks = require('@mantine/hooks');
8
+ var Dropzone = require('./Dropzone.js');
9
+ var DropzoneFullScreen_styles = require('./DropzoneFullScreen.styles.js');
10
+
11
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e['default'] : e; }
12
+
13
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
14
+
15
+ var __defProp = Object.defineProperty;
16
+ var __defProps = Object.defineProperties;
17
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
18
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
19
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
20
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
21
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
22
+ var __spreadValues = (a, b) => {
23
+ for (var prop in b || (b = {}))
24
+ if (__hasOwnProp.call(b, prop))
25
+ __defNormalProp(a, prop, b[prop]);
26
+ if (__getOwnPropSymbols)
27
+ for (var prop of __getOwnPropSymbols(b)) {
28
+ if (__propIsEnum.call(b, prop))
29
+ __defNormalProp(a, prop, b[prop]);
30
+ }
31
+ return a;
32
+ };
33
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
34
+ var __objRest = (source, exclude) => {
35
+ var target = {};
36
+ for (var prop in source)
37
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
38
+ target[prop] = source[prop];
39
+ if (source != null && __getOwnPropSymbols)
40
+ for (var prop of __getOwnPropSymbols(source)) {
41
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
42
+ target[prop] = source[prop];
43
+ }
44
+ return target;
45
+ };
46
+ const fullScreenDefaultProps = {
47
+ padding: "md",
48
+ loading: false,
49
+ multiple: true,
50
+ maxSize: Infinity,
51
+ autoFocus: false,
52
+ activateOnClick: true,
53
+ activateOnDrag: true,
54
+ dragEventsBubbling: true,
55
+ activateOnKeyboard: true,
56
+ active: true,
57
+ zIndex: core.getDefaultZIndex("max"),
58
+ withinPortal: true
59
+ };
60
+ const DropzoneFullScreen = React.forwardRef((props, ref) => {
61
+ const _a = core.useComponentDefaultProps("DropzoneFullScreen", fullScreenDefaultProps, props), {
62
+ classNames,
63
+ styles,
64
+ sx,
65
+ className,
66
+ style,
67
+ unstyled,
68
+ active,
69
+ onDrop,
70
+ onReject,
71
+ onDragLeave,
72
+ zIndex,
73
+ withinPortal
74
+ } = _a, others = __objRest(_a, [
75
+ "classNames",
76
+ "styles",
77
+ "sx",
78
+ "className",
79
+ "style",
80
+ "unstyled",
81
+ "active",
82
+ "onDrop",
83
+ "onReject",
84
+ "onDragLeave",
85
+ "zIndex",
86
+ "withinPortal"
87
+ ]);
88
+ const [visible, { open, close }] = hooks.useDisclosure(false);
89
+ const { classes, cx } = DropzoneFullScreen_styles['default'](null, {
90
+ name: "DropzoneFullScreen",
91
+ classNames,
92
+ styles,
93
+ unstyled
94
+ });
95
+ React.useEffect(() => {
96
+ if (active) {
97
+ document.addEventListener("dragover", open, false);
98
+ return () => document.removeEventListener("dragover", open, false);
99
+ }
100
+ return void 0;
101
+ }, [active]);
102
+ return /* @__PURE__ */ React__default.createElement(core.OptionalPortal, {
103
+ withinPortal
104
+ }, /* @__PURE__ */ React__default.createElement(core.Box, {
105
+ className: cx(classes.wrapper, className),
106
+ sx,
107
+ style: __spreadProps(__spreadValues({}, style), {
108
+ opacity: visible ? 1 : 0,
109
+ pointerEvents: visible ? "all" : "none",
110
+ zIndex
111
+ })
112
+ }, /* @__PURE__ */ React__default.createElement(Dropzone._Dropzone, __spreadProps(__spreadValues({}, others), {
113
+ classNames,
114
+ styles,
115
+ unstyled,
116
+ ref,
117
+ className: classes.dropzone,
118
+ onDrop: (files) => {
119
+ onDrop == null ? void 0 : onDrop(files);
120
+ close();
121
+ },
122
+ onReject: (files) => {
123
+ onReject == null ? void 0 : onReject(files);
124
+ close();
125
+ },
126
+ onDragLeave: (event) => {
127
+ onDragLeave == null ? void 0 : onDragLeave(event);
128
+ close();
129
+ }
130
+ }))));
131
+ });
132
+ DropzoneFullScreen.displayName = "@mantine/dropzone/DropzoneFullScreen";
133
+
134
+ exports.DropzoneFullScreen = DropzoneFullScreen;
135
+ //# sourceMappingURL=DropzoneFullScreen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DropzoneFullScreen.js","sources":["../src/DropzoneFullScreen.tsx"],"sourcesContent":["import React, { forwardRef, useEffect } from 'react';\nimport {\n Box,\n useComponentDefaultProps,\n OptionalPortal,\n DefaultProps,\n Selectors,\n getDefaultZIndex,\n} from '@mantine/core';\nimport { useDisclosure } from '@mantine/hooks';\nimport { DropzoneStylesNames, DropzoneProps, _Dropzone } from './Dropzone';\nimport useFullScreenStyles from './DropzoneFullScreen.styles';\n\nexport type DropzoneFullScreenStylesName =\n | DropzoneStylesNames\n | Exclude<Selectors<typeof useFullScreenStyles>, 'dropzone'>;\n\nexport interface DropzoneFullScreenProps\n extends Omit<DropzoneProps, 'styles' | 'classNames'>,\n DefaultProps<DropzoneFullScreenStylesName> {\n /** Determines whether user can drop files to browser window, true by default */\n active?: boolean;\n\n /** z-index value, 9999 by default */\n zIndex?: React.CSSProperties['zIndex'];\n\n /** Determines whether component should be rendered within Portal, true by default */\n withinPortal?: boolean;\n}\n\nconst fullScreenDefaultProps: Partial<DropzoneFullScreenProps> = {\n padding: 'md',\n loading: false,\n multiple: true,\n maxSize: Infinity,\n autoFocus: false,\n activateOnClick: true,\n activateOnDrag: true,\n dragEventsBubbling: true,\n activateOnKeyboard: true,\n active: true,\n zIndex: getDefaultZIndex('max'),\n withinPortal: true,\n};\n\nexport const DropzoneFullScreen = forwardRef<HTMLDivElement, DropzoneFullScreenProps>(\n (props, ref) => {\n const {\n classNames,\n styles,\n sx,\n className,\n style,\n unstyled,\n active,\n onDrop,\n onReject,\n onDragLeave,\n zIndex,\n withinPortal,\n ...others\n } = useComponentDefaultProps('DropzoneFullScreen', fullScreenDefaultProps, props);\n\n const [visible, { open, close }] = useDisclosure(false);\n const { classes, cx } = useFullScreenStyles(null, {\n name: 'DropzoneFullScreen',\n classNames,\n styles,\n unstyled,\n });\n\n useEffect(() => {\n if (active) {\n document.addEventListener('dragover', open, false);\n return () => document.removeEventListener('dragover', open, false);\n }\n\n return undefined;\n }, [active]);\n\n return (\n <OptionalPortal withinPortal={withinPortal}>\n <Box\n className={cx(classes.wrapper, className)}\n sx={sx}\n style={{\n ...style,\n opacity: visible ? 1 : 0,\n pointerEvents: visible ? 'all' : 'none',\n zIndex,\n }}\n >\n <_Dropzone\n {...others}\n classNames={classNames}\n styles={styles}\n unstyled={unstyled}\n ref={ref}\n className={classes.dropzone}\n onDrop={(files: any) => {\n onDrop?.(files);\n close();\n }}\n onReject={(files: any) => {\n onReject?.(files);\n close();\n }}\n onDragLeave={(event: any) => {\n onDragLeave?.(event);\n close();\n }}\n />\n </Box>\n </OptionalPortal>\n );\n }\n);\n\nDropzoneFullScreen.displayName = '@mantine/dropzone/DropzoneFullScreen';\n\nexport type DropzoneFullScreenType = typeof DropzoneFullScreen;\n"],"names":["getDefaultZIndex","forwardRef","useComponentDefaultProps","useDisclosure","useFullScreenStyles","useEffect","React","OptionalPortal","Box","_Dropzone"],"mappings":";;;;;;;;;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,UAAU,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACzC,IAAI,iBAAiB,GAAG,MAAM,CAAC,yBAAyB,CAAC;AACzD,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EA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M,MAAM;AACZ,KAAK,CAAC;AACN,GAAG,kBAAkBF,cAAK,CAAC,aAAa,CAACG,kBAAS,EAAE,aAAa,CAAC,cAAc,CAAC,EAAE,EAAE,MAAM,CAAC,EAAE;AAC9F,IAAI,UAAU;AACd,IAAI,MAAM;AACV,IAAI,QAAQ;AACZ,IAAI,GAAG;AACP,IAAI,SAAS,EAAE,OAAO,CAAC,QAAQ;AAC/B,IAAI,MAAM,EAAE,CAAC,KAAK,KAAK;AACvB,MAAM,MAAM,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;AAC9C,MAAM,KAAK,EAAE,CAAC;AACd,KAAK;AACL,IAAI,QAAQ,EAAE,CAAC,KAAK,KAAK;AACzB,MAAM,QAAQ,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;AAClD,MAAM,KAAK,EAAE,CAAC;AACd,KAAK;AACL,IAAI,WAAW,EAAE,CAAC,KAAK,KAAK;AAC5B,MAAM,WAAW,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;AACxD,MAAM,KAAK,EAAE,CAAC;AACd,KAAK;AACL,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACR,CAAC,EAAE;AACH,kBAAkB,CAAC,WAAW,GAAG,sCAAsC;;;;"}
@@ -0,0 +1,25 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var core = require('@mantine/core');
6
+
7
+ var useFullScreenStyles = core.createStyles((theme) => ({
8
+ wrapper: {
9
+ position: "fixed",
10
+ top: 0,
11
+ bottom: 0,
12
+ left: 0,
13
+ right: 0,
14
+ backgroundColor: theme.colorScheme === "dark" ? theme.colors.dark[7] : theme.white,
15
+ display: "flex",
16
+ padding: theme.spacing.xs,
17
+ transition: "opacity 100ms ease"
18
+ },
19
+ dropzone: {
20
+ flex: 1
21
+ }
22
+ }));
23
+
24
+ exports.default = useFullScreenStyles;
25
+ //# sourceMappingURL=DropzoneFullScreen.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DropzoneFullScreen.styles.js","sources":["../src/DropzoneFullScreen.styles.ts"],"sourcesContent":["import { createStyles } from '@mantine/core';\n\nexport default createStyles((theme) => ({\n wrapper: {\n position: 'fixed',\n top: 0,\n bottom: 0,\n left: 0,\n right: 0,\n backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark[7] : theme.white,\n display: 'flex',\n padding: theme.spacing.xs,\n transition: 'opacity 100ms ease',\n },\n\n dropzone: {\n flex: 1,\n },\n}));\n"],"names":["createStyles"],"mappings":";;;;;;AACA,0BAAeA,iBAAY,CAAC,CAAC,KAAK,MAAM;AACxC,EAAE,OAAO,EAAE;AACX,IAAI,QAAQ,EAAE,OAAO;AACrB,IAAI,GAAG,EAAE,CAAC;AACV,IAAI,MAAM,EAAE,CAAC;AACb,IAAI,IAAI,EAAE,CAAC;AACX,IAAI,KAAK,EAAE,CAAC;AACZ,IAAI,eAAe,EAAE,KAAK,CAAC,WAAW,KAAK,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK;AACtF,IAAI,OAAO,EAAE,MAAM;AACnB,IAAI,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE;AAC7B,IAAI,UAAU,EAAE,oBAAoB;AACpC,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,CAAC;AACX,GAAG;AACH,CAAC,CAAC,CAAC;;;;"}
@@ -0,0 +1,43 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var hooks = require('@mantine/hooks');
6
+ var React = require('react');
7
+ var Dropzone_context = require('./Dropzone.context.js');
8
+
9
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
10
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
11
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
12
+ var __objRest = (source, exclude) => {
13
+ var target = {};
14
+ for (var prop in source)
15
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
16
+ target[prop] = source[prop];
17
+ if (source != null && __getOwnPropSymbols)
18
+ for (var prop of __getOwnPropSymbols(source)) {
19
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
20
+ target[prop] = source[prop];
21
+ }
22
+ return target;
23
+ };
24
+ function createDropzoneStatus(status) {
25
+ const Component = (_a) => {
26
+ var _b = _a, { children } = _b, others = __objRest(_b, ["children"]);
27
+ const ctx = Dropzone_context.useDropzoneContext();
28
+ if (ctx[status]) {
29
+ return React.cloneElement(React.Children.only(children), others);
30
+ }
31
+ return null;
32
+ };
33
+ Component.displayName = `@mantine/dropzone/${hooks.upperFirst(status)}`;
34
+ return Component;
35
+ }
36
+ const DropzoneAccept = createDropzoneStatus("accept");
37
+ const DropzoneReject = createDropzoneStatus("reject");
38
+ const DropzoneIdle = createDropzoneStatus("idle");
39
+
40
+ exports.DropzoneAccept = DropzoneAccept;
41
+ exports.DropzoneIdle = DropzoneIdle;
42
+ exports.DropzoneReject = DropzoneReject;
43
+ //# sourceMappingURL=DropzoneStatus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DropzoneStatus.js","sources":["../src/DropzoneStatus.tsx"],"sourcesContent":["import { upperFirst } from '@mantine/hooks';\nimport React, { cloneElement, Children } from 'react';\nimport { DropzoneContextValue, useDropzoneContext } from './Dropzone.context';\n\nexport interface DropzoneStatusProps {\n children: React.ReactNode;\n}\n\nfunction createDropzoneStatus(status: keyof DropzoneContextValue) {\n const Component = ({ children, ...others }: DropzoneStatusProps): JSX.Element => {\n const ctx = useDropzoneContext();\n if (ctx[status]) {\n return cloneElement(Children.only(children) as React.ReactElement, others);\n }\n\n return null;\n };\n\n Component.displayName = `@mantine/dropzone/${upperFirst(status)}`;\n\n return Component;\n}\n\nexport const DropzoneAccept = createDropzoneStatus('accept');\nexport const DropzoneReject = createDropzoneStatus('reject');\nexport const DropzoneIdle = createDropzoneStatus('idle');\n\nexport type DropzoneAcceptProps = DropzoneStatusProps;\nexport type DropzoneRejectProps = DropzoneStatusProps;\nexport type DropzoneIdleProps = DropzoneStatusProps;\n"],"names":["useDropzoneContext","cloneElement","Children","upperFirst"],"mappings":";;;;;;;;AAAA,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,SAAS,GAAG,CAAC,MAAM,EAAE,OAAO,KAAK;AACrC,EAAE,IAAI,MAAM,GAAG,EAAE,CAAC;AAClB,EAAE,KAAK,IAAI,IAAI,IAAI,MAAM;AACzB,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC;AACpE,MAAM,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;AAClC,EAAE,IAAI,MAAM,IAAI,IAAI,IAAI,mBAAmB;AAC3C,IAAI,KAAK,IAAI,IAAI,IAAI,mBAAmB,CAAC,MAAM,CAAC,EAAE;AAClD,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC;AACtE,QAAQ,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;AACpC,KAAK;AACL,EAAE,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAIF,SAAS,oBAAoB,CAAC,MAAM,EAAE;AACtC,EAAE,MAAM,SAAS,GAAG,CAAC,EAAE,KAAK;AAC5B,IAAI,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,EAAE,MAAM,GAAG,SAAS,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;AACzE,IAAI,MAAM,GAAG,GAAGA,mCAAkB,EAAE,CAAC;AACrC,IAAI,IAAI,GAAG,CAAC,MAAM,CAAC,EAAE;AACrB,MAAM,OAAOC,kBAAY,CAACC,cAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,CAAC;AAC3D,KAAK;AACL,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG,CAAC;AACJ,EAAE,SAAS,CAAC,WAAW,GAAG,CAAC,kBAAkB,EAAEC,gBAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACpE,EAAE,OAAO,SAAS,CAAC;AACnB,CAAC;AACW,MAAC,cAAc,GAAG,oBAAoB,CAAC,QAAQ,EAAE;AACjD,MAAC,cAAc,GAAG,oBAAoB,CAAC,QAAQ,EAAE;AACjD,MAAC,YAAY,GAAG,oBAAoB,CAAC,MAAM;;;;;;"}
package/cjs/index.js CHANGED
@@ -2,11 +2,12 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var DropzoneFullScreen = require('./DropzoneFullScreen.js');
6
+ var Dropzone$1 = require('./Dropzone.js');
5
7
  var mimeTypes = require('./mime-types.js');
6
- var Dropzone = require('./Dropzone/Dropzone.js');
7
- var FullScreenDropzone = require('./FullScreenDropzone/FullScreenDropzone.js');
8
-
9
8
 
9
+ Dropzone$1.Dropzone.FullScreen = DropzoneFullScreen.DropzoneFullScreen;
10
+ const Dropzone = Dropzone$1.Dropzone;
10
11
 
11
12
  exports.EXE_MIME_TYPE = mimeTypes.EXE_MIME_TYPE;
12
13
  exports.IMAGE_MIME_TYPE = mimeTypes.IMAGE_MIME_TYPE;
@@ -15,6 +16,5 @@ exports.MS_EXCEL_MIME_TYPE = mimeTypes.MS_EXCEL_MIME_TYPE;
15
16
  exports.MS_POWERPOINT_MIME_TYPE = mimeTypes.MS_POWERPOINT_MIME_TYPE;
16
17
  exports.MS_WORD_MIME_TYPE = mimeTypes.MS_WORD_MIME_TYPE;
17
18
  exports.PDF_MIME_TYPE = mimeTypes.PDF_MIME_TYPE;
18
- exports.Dropzone = Dropzone.Dropzone;
19
- exports.FullScreenDropzone = FullScreenDropzone.FullScreenDropzone;
19
+ exports.Dropzone = Dropzone;
20
20
  //# sourceMappingURL=index.js.map
package/cjs/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import { DropzoneFullScreen } from './DropzoneFullScreen';\nimport { Dropzone as _Dropzone } from './Dropzone';\n\n_Dropzone.FullScreen = DropzoneFullScreen;\nexport const Dropzone = _Dropzone;\n\nexport type { DropzoneStylesNames, DropzoneProps } from './Dropzone';\nexport type { DropzoneFullScreenProps, DropzoneFullScreenStylesName } from './DropzoneFullScreen';\nexport type { DropzoneStylesParams } from './Dropzone.styles';\nexport type { DropzoneAcceptProps, DropzoneRejectProps, DropzoneIdleProps } from './DropzoneStatus';\nexport * from './mime-types';\n"],"names":["_Dropzone","DropzoneFullScreen"],"mappings":";;;;;;;;AAEAA,mBAAS,CAAC,UAAU,GAAGC,qCAAkB,CAAC;AAC9B,MAAC,QAAQ,GAAGD;;;;;;;;;;;"}
@@ -0,0 +1,6 @@
1
+ import { createSafeContext } from '@mantine/utils';
2
+
3
+ const [DropzoneProvider, useDropzoneContext] = createSafeContext("Dropzone component was not found in tree");
4
+
5
+ export { DropzoneProvider, useDropzoneContext };
6
+ //# sourceMappingURL=Dropzone.context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dropzone.context.js","sources":["../src/Dropzone.context.ts"],"sourcesContent":["import { createSafeContext } from '@mantine/utils';\n\nexport interface DropzoneContextValue {\n idle: boolean;\n accept: boolean;\n reject: boolean;\n}\n\nexport const [DropzoneProvider, useDropzoneContext] = createSafeContext<DropzoneContextValue>(\n 'Dropzone component was not found in tree'\n);\n"],"names":[],"mappings":";;AACY,MAAC,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,GAAG,iBAAiB,CAAC,0CAA0C;;;;"}
@@ -2,6 +2,8 @@ import React, { forwardRef } from 'react';
2
2
  import { useDropzone } from 'react-dropzone';
3
3
  import { useComponentDefaultProps, Box, LoadingOverlay } from '@mantine/core';
4
4
  import { assignRef } from '@mantine/hooks';
5
+ import { DropzoneProvider } from './Dropzone.context.js';
6
+ import { DropzoneAccept, DropzoneReject, DropzoneIdle } from './DropzoneStatus.js';
5
7
  import useStyles from './Dropzone.styles.js';
6
8
 
7
9
  var __defProp = Object.defineProperty;
@@ -39,9 +41,14 @@ const defaultProps = {
39
41
  padding: "md",
40
42
  loading: false,
41
43
  multiple: true,
42
- maxSize: Infinity
44
+ maxSize: Infinity,
45
+ autoFocus: false,
46
+ activateOnClick: true,
47
+ activateOnDrag: true,
48
+ dragEventsBubbling: true,
49
+ activateOnKeyboard: true
43
50
  };
44
- const Dropzone = forwardRef((props, ref) => {
51
+ const _Dropzone = forwardRef((props, ref) => {
45
52
  const _a = useComponentDefaultProps("Dropzone", defaultProps, props), {
46
53
  className,
47
54
  padding,
@@ -59,7 +66,18 @@ const Dropzone = forwardRef((props, ref) => {
59
66
  openRef,
60
67
  name,
61
68
  unstyled,
62
- maxFiles
69
+ maxFiles,
70
+ autoFocus,
71
+ activateOnClick,
72
+ activateOnDrag,
73
+ dragEventsBubbling,
74
+ activateOnKeyboard,
75
+ onDragEnter,
76
+ onDragLeave,
77
+ onDragOver,
78
+ onFileDialogCancel,
79
+ onFileDialogOpen,
80
+ preventDropOnDocument
63
81
  } = _a, others = __objRest(_a, [
64
82
  "className",
65
83
  "padding",
@@ -77,7 +95,18 @@ const Dropzone = forwardRef((props, ref) => {
77
95
  "openRef",
78
96
  "name",
79
97
  "unstyled",
80
- "maxFiles"
98
+ "maxFiles",
99
+ "autoFocus",
100
+ "activateOnClick",
101
+ "activateOnDrag",
102
+ "dragEventsBubbling",
103
+ "activateOnKeyboard",
104
+ "onDragEnter",
105
+ "onDragLeave",
106
+ "onDragOver",
107
+ "onFileDialogCancel",
108
+ "onFileDialogOpen",
109
+ "preventDropOnDocument"
81
110
  ]);
82
111
  const { classes, cx } = useStyles({ radius, padding }, { classNames, styles, unstyled, name: "Dropzone" });
83
112
  const { getRootProps, getInputProps, isDragAccept, isDragReject, open } = useDropzone({
@@ -87,24 +116,44 @@ const Dropzone = forwardRef((props, ref) => {
87
116
  accept: Array.isArray(accept) ? accept.reduce((r, key) => __spreadProps(__spreadValues({}, r), { [key]: [] }), {}) : accept,
88
117
  multiple,
89
118
  maxSize,
90
- maxFiles
119
+ maxFiles,
120
+ autoFocus,
121
+ noClick: !activateOnClick,
122
+ noDrag: !activateOnDrag,
123
+ noDragEventsBubbling: !dragEventsBubbling,
124
+ noKeyboard: !activateOnKeyboard,
125
+ onDragEnter,
126
+ onDragLeave,
127
+ onDragOver,
128
+ onFileDialogCancel,
129
+ onFileDialogOpen,
130
+ preventDropOnDocument
91
131
  });
92
132
  assignRef(openRef, open);
93
- return /* @__PURE__ */ React.createElement(Box, __spreadProps(__spreadValues(__spreadValues({}, others), getRootProps({ ref })), {
94
- className: cx(classes.root, {
95
- [classes.active]: isDragAccept,
96
- [classes.reject]: isDragReject,
97
- [classes.loading]: loading
98
- }, className)
133
+ const isIdle = !isDragAccept && !isDragReject;
134
+ return /* @__PURE__ */ React.createElement(DropzoneProvider, {
135
+ value: { accept: isDragAccept, reject: isDragReject, idle: isIdle }
136
+ }, /* @__PURE__ */ React.createElement(Box, __spreadProps(__spreadValues(__spreadValues({}, others), getRootProps({ ref })), {
137
+ "data-accept": isDragAccept || void 0,
138
+ "data-reject": isDragReject || void 0,
139
+ "data-idle": isIdle || void 0,
140
+ "data-loading": loading || void 0,
141
+ className: cx(classes.root, className)
99
142
  }), /* @__PURE__ */ React.createElement(LoadingOverlay, {
100
143
  visible: loading,
101
144
  radius,
102
145
  unstyled
103
146
  }), /* @__PURE__ */ React.createElement("input", __spreadProps(__spreadValues({}, getInputProps()), {
104
147
  name
105
- })), children({ accepted: isDragAccept, rejected: isDragReject }));
148
+ })), /* @__PURE__ */ React.createElement("div", {
149
+ className: classes.inner
150
+ }, children)));
106
151
  });
107
- Dropzone.displayName = "@mantine/dropzone/Dropzone";
152
+ _Dropzone.displayName = "@mantine/dropzone/Dropzone";
153
+ _Dropzone.Accept = DropzoneAccept;
154
+ _Dropzone.Reject = DropzoneReject;
155
+ _Dropzone.Idle = DropzoneIdle;
156
+ const Dropzone = _Dropzone;
108
157
 
109
- export { Dropzone };
158
+ export { Dropzone, _Dropzone, defaultProps };
110
159
  //# sourceMappingURL=Dropzone.js.map