@elliemae/ds-dropzone 3.25.0-rc.0 → 3.26.0-next.2

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.
@@ -34,35 +34,53 @@ __export(DSDropzone_exports, {
34
34
  module.exports = __toCommonJS(DSDropzone_exports);
35
35
  var React = __toESM(require("react"));
36
36
  var import_jsx_runtime = require("react/jsx-runtime");
37
+ var import_react = __toESM(require("react"));
37
38
  var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
38
39
  var import_react_desc_prop_types = require("./react-desc-prop-types.js");
39
40
  var import_useDSDropzone = require("./config/useDSDropzone.js");
40
41
  var import_constants = require("./constants/index.js");
41
42
  var import_styled = require("./styled.js");
42
43
  var import_DSActivezone = require("./parts/DSActivezone/DSActivezone.js");
44
+ var import_lodash = require("lodash");
43
45
  const DSDropzone = (props) => {
44
- const { propsWithDefault, globalProps, xstyledProps, dropZoneState } = (0, import_useDSDropzone.useDSDropzone)(props);
45
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
46
- import_styled.StyledDropZone,
46
+ const {
47
+ propsWithDefault,
48
+ globalProps,
49
+ xstyledProps,
50
+ isDragInside,
51
+ onDragEnterHandler,
52
+ onDragOverHandler,
53
+ onDragLeaveHandler,
54
+ onDropHandler
55
+ } = (0, import_useDSDropzone.useDSDropzone)(props);
56
+ const getOwnerProps = import_react.default.useCallback(() => propsWithDefault, [propsWithDefault]);
57
+ const getOwnerPropsArguments = import_react.default.useCallback(() => ({}), []);
58
+ const safeGlobalProps = (0, import_lodash.omit)(globalProps, "onDrop", "hasError");
59
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
60
+ import_styled.StyledDropZoneHolder,
47
61
  {
48
- ...globalProps,
62
+ ...safeGlobalProps,
49
63
  ...xstyledProps,
50
- ...dropZoneState.getRootProps({
51
- isFocused: dropZoneState.isFocused,
52
- isDragAccept: dropZoneState.isDragAccept,
53
- isDragReject: dropZoneState.isDragReject
54
- }),
55
- isFocused: dropZoneState.isFocused,
56
- isDragAccept: dropZoneState.isDragAccept,
57
- isDragReject: dropZoneState.isDragReject,
58
- isDragActive: dropZoneState.isDragActive,
59
- hasError: propsWithDefault.hasError,
60
- disabled: propsWithDefault.dropConfig.disabled,
61
- children: [
62
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { ...dropZoneState.getInputProps() }),
63
- propsWithDefault.children,
64
- dropZoneState.isDragActive ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DSActivezone.DSActivezone, {}) : null
65
- ]
64
+ getOwnerProps,
65
+ getOwnerPropsArguments,
66
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
67
+ import_styled.StyledDropZone,
68
+ {
69
+ onDragEnter: onDragEnterHandler,
70
+ onDragOver: onDragOverHandler,
71
+ onDragLeave: onDragLeaveHandler,
72
+ onDrop: onDropHandler,
73
+ hasError: Boolean(propsWithDefault.hasError),
74
+ disabled: Boolean(propsWithDefault.disabled),
75
+ isDragActive: isDragInside,
76
+ getOwnerProps,
77
+ getOwnerPropsArguments,
78
+ children: [
79
+ propsWithDefault.children,
80
+ isDragInside ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DSActivezone.DSActivezone, {}) : null
81
+ ]
82
+ }
83
+ )
66
84
  }
67
85
  );
68
86
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/DSDropzone.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import React from 'react';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport { type DSDropzoneT, DSDropzonePropTypesSchema } from './react-desc-prop-types.js';\nimport { useDSDropzone } from './config/useDSDropzone.js';\nimport { DSDropzoneName } from './constants/index.js';\nimport { StyledDropZone } from './styled.js';\nimport { DSActivezone } from './parts/DSActivezone/DSActivezone.js';\n\nconst DSDropzone: React.ComponentType<DSDropzoneT.Props> = (props) => {\n const { propsWithDefault, globalProps, xstyledProps, dropZoneState } = useDSDropzone(props);\n return (\n <StyledDropZone\n {...globalProps}\n {...xstyledProps}\n {...dropZoneState.getRootProps({\n isFocused: dropZoneState.isFocused,\n isDragAccept: dropZoneState.isDragAccept,\n isDragReject: dropZoneState.isDragReject,\n })}\n isFocused={dropZoneState.isFocused}\n isDragAccept={dropZoneState.isDragAccept}\n isDragReject={dropZoneState.isDragReject}\n isDragActive={dropZoneState.isDragActive}\n hasError={propsWithDefault.hasError}\n disabled={propsWithDefault.dropConfig.disabled}\n >\n <input {...dropZoneState.getInputProps()} />\n {propsWithDefault.children}\n {dropZoneState.isDragActive ? <DSActivezone /> : null}\n </StyledDropZone>\n );\n};\n\nDSDropzone.propTypes = DSDropzonePropTypesSchema;\nDSDropzone.displayName = DSDropzoneName;\nconst DSDropzoneWithSchema = describe(DSDropzone);\nDSDropzoneWithSchema.propTypes = DSDropzonePropTypesSchema;\n\nexport { DSDropzone, DSDropzoneWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADWnB;AAVJ,8BAAyB;AACzB,mCAA4D;AAC5D,2BAA8B;AAC9B,uBAA+B;AAC/B,oBAA+B;AAC/B,0BAA6B;AAE7B,MAAM,aAAqD,CAAC,UAAU;AACpE,QAAM,EAAE,kBAAkB,aAAa,cAAc,cAAc,QAAI,oCAAc,KAAK;AAC1F,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACH,GAAG;AAAA,MACH,GAAG,cAAc,aAAa;AAAA,QAC7B,WAAW,cAAc;AAAA,QACzB,cAAc,cAAc;AAAA,QAC5B,cAAc,cAAc;AAAA,MAC9B,CAAC;AAAA,MACD,WAAW,cAAc;AAAA,MACzB,cAAc,cAAc;AAAA,MAC5B,cAAc,cAAc;AAAA,MAC5B,cAAc,cAAc;AAAA,MAC5B,UAAU,iBAAiB;AAAA,MAC3B,UAAU,iBAAiB,WAAW;AAAA,MAEtC;AAAA,oDAAC,WAAO,GAAG,cAAc,cAAc,GAAG;AAAA,QACzC,iBAAiB;AAAA,QACjB,cAAc,eAAe,4CAAC,oCAAa,IAAK;AAAA;AAAA;AAAA,EACnD;AAEJ;AAEA,WAAW,YAAY;AACvB,WAAW,cAAc;AACzB,MAAM,2BAAuB,kCAAS,UAAU;AAChD,qBAAqB,YAAY;",
6
- "names": []
4
+ "sourcesContent": ["import React from 'react';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport { type DSDropzoneT, DSDropzonePropTypesSchema } from './react-desc-prop-types.js';\nimport { useDSDropzone } from './config/useDSDropzone.js';\nimport { DSDropzoneName } from './constants/index.js';\nimport { StyledDropZone, StyledDropZoneHolder } from './styled.js';\nimport { DSActivezone } from './parts/DSActivezone/DSActivezone.js';\nimport { omit } from 'lodash';\n\nconst DSDropzone: React.ComponentType<DSDropzoneT.Props> = (props) => {\n const {\n propsWithDefault,\n globalProps,\n xstyledProps,\n isDragInside,\n onDragEnterHandler,\n onDragOverHandler,\n onDragLeaveHandler,\n onDropHandler,\n } = useDSDropzone(props);\n const getOwnerProps = React.useCallback(() => propsWithDefault, [propsWithDefault]);\n const getOwnerPropsArguments = React.useCallback(() => ({}), []);\n const safeGlobalProps = omit(globalProps, 'onDrop', 'hasError');\n return (\n <StyledDropZoneHolder\n {...safeGlobalProps}\n {...xstyledProps}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <StyledDropZone\n onDragEnter={onDragEnterHandler}\n onDragOver={onDragOverHandler}\n onDragLeave={onDragLeaveHandler}\n onDrop={onDropHandler}\n hasError={Boolean(propsWithDefault.hasError)}\n disabled={Boolean(propsWithDefault.disabled)}\n isDragActive={isDragInside}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {propsWithDefault.children}\n {isDragInside ? <DSActivezone /> : null}\n </StyledDropZone>\n </StyledDropZoneHolder>\n );\n};\n\nDSDropzone.propTypes = DSDropzonePropTypesSchema;\nDSDropzone.displayName = DSDropzoneName;\nconst DSDropzoneWithSchema = describe(DSDropzone);\nDSDropzoneWithSchema.propTypes = DSDropzonePropTypesSchema;\n\nexport { DSDropzone, DSDropzoneWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD8BjB;AA9BN,mBAAkB;AAClB,8BAAyB;AACzB,mCAA4D;AAC5D,2BAA8B;AAC9B,uBAA+B;AAC/B,oBAAqD;AACrD,0BAA6B;AAC7B,oBAAqB;AAErB,MAAM,aAAqD,CAAC,UAAU;AACpE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,oCAAc,KAAK;AACvB,QAAM,gBAAgB,aAAAA,QAAM,YAAY,MAAM,kBAAkB,CAAC,gBAAgB,CAAC;AAClF,QAAM,yBAAyB,aAAAA,QAAM,YAAY,OAAO,CAAC,IAAI,CAAC,CAAC;AAC/D,QAAM,sBAAkB,oBAAK,aAAa,UAAU,UAAU;AAC9D,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACH,GAAG;AAAA,MACJ;AAAA,MACA;AAAA,MAEA;AAAA,QAAC;AAAA;AAAA,UACC,aAAa;AAAA,UACb,YAAY;AAAA,UACZ,aAAa;AAAA,UACb,QAAQ;AAAA,UACR,UAAU,QAAQ,iBAAiB,QAAQ;AAAA,UAC3C,UAAU,QAAQ,iBAAiB,QAAQ;AAAA,UAC3C,cAAc;AAAA,UACd;AAAA,UACA;AAAA,UAEC;AAAA,6BAAiB;AAAA,YACjB,eAAe,4CAAC,oCAAa,IAAK;AAAA;AAAA;AAAA,MACrC;AAAA;AAAA,EACF;AAEJ;AAEA,WAAW,YAAY;AACvB,WAAW,cAAc;AACzB,MAAM,2BAAuB,kCAAS,UAAU;AAChD,qBAAqB,YAAY;",
6
+ "names": ["React"]
7
7
  }
@@ -37,7 +37,6 @@ var import_lodash = require("lodash");
37
37
  var import_ds_utilities = require("@elliemae/ds-utilities");
38
38
  var import_uid = require("uid");
39
39
  var import_react_desc_prop_types = require("../react-desc-prop-types.js");
40
- var import_react_dropzone = require("react-dropzone");
41
40
  var import_useValidateProps = require("./useValidateProps.js");
42
41
  const useDSDropzone = (propsFromUser) => {
43
42
  const propsWithDefault = (0, import_ds_utilities.useMemoMergePropsWithDefault)(propsFromUser, import_react_desc_prop_types.defaultProps);
@@ -48,28 +47,54 @@ const useDSDropzone = (propsFromUser) => {
48
47
  "wrap"
49
48
  ]);
50
49
  const xstyledProps = (0, import_ds_utilities.useGetXstyledProps)(propsWithDefault);
51
- const { id, dropConfig } = propsWithDefault;
50
+ const { id, onDrop } = propsWithDefault;
52
51
  const instanceUid = import_react.default.useMemo(() => id || (0, import_uid.uid)(5), [id]);
53
52
  const [isDragInside, setIsDragInside] = import_react.default.useState(false);
54
- const dropConfigDefault = import_react.default.useMemo(
55
- () => ({
56
- ...dropConfig,
57
- noKeyboard: true,
58
- onDragEnter: (event) => {
59
- dropConfig?.onDragEnter?.(event);
60
- setIsDragInside(true);
61
- }
62
- }),
63
- [dropConfig]
53
+ const onBodyDragDropEvent = import_react.default.useCallback((e) => {
54
+ e.preventDefault();
55
+ }, []);
56
+ import_react.default.useEffect(() => {
57
+ document.body.addEventListener("drop", onBodyDragDropEvent);
58
+ return () => {
59
+ document.body.removeEventListener("drop", onBodyDragDropEvent);
60
+ };
61
+ }, [onBodyDragDropEvent]);
62
+ const onDragEnterHandler = import_react.default.useCallback((e) => {
63
+ e.preventDefault();
64
+ e.stopPropagation();
65
+ setIsDragInside(true);
66
+ }, []);
67
+ const onDragOverHandler = import_react.default.useCallback((e) => {
68
+ e.preventDefault();
69
+ e.stopPropagation();
70
+ setIsDragInside(true);
71
+ }, []);
72
+ const onDragLeaveHandler = import_react.default.useCallback((e) => {
73
+ e.preventDefault();
74
+ e.stopPropagation();
75
+ setIsDragInside(false);
76
+ }, []);
77
+ const onDropHandler = import_react.default.useCallback(
78
+ (e) => {
79
+ e.preventDefault();
80
+ e.stopPropagation();
81
+ setIsDragInside(false);
82
+ const filesArray = Array.from(e.dataTransfer?.files ?? []);
83
+ onDrop?.(filesArray, e);
84
+ },
85
+ [onDrop]
64
86
  );
65
- const dropZoneState = (0, import_react_dropzone.useDropzone)(dropConfigDefault);
66
87
  return import_react.default.useMemo(
67
88
  () => ({
68
89
  propsWithDefault,
69
90
  globalProps,
70
91
  xstyledProps,
71
92
  instanceUid,
72
- dropZoneState
93
+ isDragInside,
94
+ onDragEnterHandler,
95
+ onDragOverHandler,
96
+ onDragLeaveHandler,
97
+ onDropHandler
73
98
  // ...eventHandlers,
74
99
  }),
75
100
  [
@@ -77,7 +102,11 @@ const useDSDropzone = (propsFromUser) => {
77
102
  globalProps,
78
103
  xstyledProps,
79
104
  instanceUid,
80
- dropZoneState
105
+ isDragInside,
106
+ onDragEnterHandler,
107
+ onDragOverHandler,
108
+ onDragLeaveHandler,
109
+ onDropHandler
81
110
  // eventHandlers,
82
111
  ]
83
112
  );
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/config/useDSDropzone.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import React from 'react';\nimport { omit } from 'lodash';\nimport { useGetGlobalAttributes, useGetXstyledProps, useMemoMergePropsWithDefault } from '@elliemae/ds-utilities';\nimport { uid } from 'uid';\nimport { type DSDropzoneT, DSDropzonePropTypes, defaultProps } from '../react-desc-prop-types.js';\nimport { useDropzone } from 'react-dropzone';\n\nimport { useValidateProps } from './useValidateProps.js';\n\nexport interface DropzoneCTX {\n propsWithDefault: DSDropzoneT.InternalProps;\n globalProps: ReturnType<typeof useGetGlobalAttributes>;\n xstyledProps: ReturnType<typeof useGetXstyledProps>;\n instanceUid: string;\n}\n\nexport const useDSDropzone = (propsFromUser: DSDropzoneT.Props) => {\n // =============================================================================\n // MERGE WITH DEFAULT AND VALIDATE PROPS\n // =============================================================================\n const propsWithDefault = useMemoMergePropsWithDefault<DSDropzoneT.InternalProps>(propsFromUser, defaultProps);\n useValidateProps(propsWithDefault, DSDropzonePropTypes);\n // =============================================================================\n // GLOBAL ATTRIBUTES & XSTYLED PROPS\n // =============================================================================\n const globalProps = omit(useGetGlobalAttributes<DSDropzoneT.InternalProps>(propsWithDefault), [\n 'cols',\n 'rows',\n 'wrap',\n ]);\n const xstyledProps = useGetXstyledProps(propsWithDefault);\n // =============================================================================\n // AD HOC PER COMPONENT LOGIC\n // =============================================================================\n // custom code goes here, this is an example\n const { id, dropConfig } = propsWithDefault;\n const instanceUid = React.useMemo(() => id || uid(5), [id]);\n // =============================================================================\n // HELPERS HOOKS CONFIGS\n // =============================================================================\n const [isDragInside, setIsDragInside] = React.useState(false);\n\n const dropConfigDefault = React.useMemo(\n () => ({\n ...dropConfig,\n noKeyboard: true,\n onDragEnter: (event) => {\n dropConfig?.onDragEnter?.(event);\n setIsDragInside(true);\n },\n }),\n [dropConfig],\n );\n const dropZoneState = useDropzone(dropConfigDefault);\n return React.useMemo(\n () => ({\n propsWithDefault,\n globalProps,\n xstyledProps,\n instanceUid,\n dropZoneState,\n // ...eventHandlers,\n }),\n [\n propsWithDefault,\n globalProps,\n xstyledProps,\n instanceUid,\n dropZoneState,\n // eventHandlers,\n ],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAClB,oBAAqB;AACrB,0BAAyF;AACzF,iBAAoB;AACpB,mCAAoE;AACpE,4BAA4B;AAE5B,8BAAiC;AAS1B,MAAM,gBAAgB,CAAC,kBAAqC;AAIjE,QAAM,uBAAmB,kDAAwD,eAAe,yCAAY;AAC5G,gDAAiB,kBAAkB,gDAAmB;AAItD,QAAM,kBAAc,wBAAK,4CAAkD,gBAAgB,GAAG;AAAA,IAC5F;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACD,QAAM,mBAAe,wCAAmB,gBAAgB;AAKxD,QAAM,EAAE,IAAI,WAAW,IAAI;AAC3B,QAAM,cAAc,aAAAA,QAAM,QAAQ,MAAM,UAAM,gBAAI,CAAC,GAAG,CAAC,EAAE,CAAC;AAI1D,QAAM,CAAC,cAAc,eAAe,IAAI,aAAAA,QAAM,SAAS,KAAK;AAE5D,QAAM,oBAAoB,aAAAA,QAAM;AAAA,IAC9B,OAAO;AAAA,MACL,GAAG;AAAA,MACH,YAAY;AAAA,MACZ,aAAa,CAAC,UAAU;AACtB,oBAAY,cAAc,KAAK;AAC/B,wBAAgB,IAAI;AAAA,MACtB;AAAA,IACF;AAAA,IACA,CAAC,UAAU;AAAA,EACb;AACA,QAAM,oBAAgB,mCAAY,iBAAiB;AACnD,SAAO,aAAAA,QAAM;AAAA,IACX,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,IAEF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,IAEF;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["import React from 'react';\nimport { omit } from 'lodash';\nimport { useGetGlobalAttributes, useGetXstyledProps, useMemoMergePropsWithDefault } from '@elliemae/ds-utilities';\nimport { uid } from 'uid';\nimport { type DSDropzoneT, DSDropzonePropTypes, defaultProps } from '../react-desc-prop-types.js';\nimport { useValidateProps } from './useValidateProps.js';\n\nexport interface DropzoneCTX {\n propsWithDefault: DSDropzoneT.InternalProps;\n globalProps: ReturnType<typeof useGetGlobalAttributes>;\n xstyledProps: ReturnType<typeof useGetXstyledProps>;\n instanceUid: string;\n}\n\nexport const useDSDropzone = (propsFromUser: DSDropzoneT.Props) => {\n // =============================================================================\n // MERGE WITH DEFAULT AND VALIDATE PROPS\n // =============================================================================\n const propsWithDefault = useMemoMergePropsWithDefault<DSDropzoneT.InternalProps>(propsFromUser, defaultProps);\n useValidateProps(propsWithDefault, DSDropzonePropTypes);\n // =============================================================================\n // GLOBAL ATTRIBUTES & XSTYLED PROPS\n // =============================================================================\n const globalProps = omit(useGetGlobalAttributes<DSDropzoneT.InternalProps>(propsWithDefault), [\n 'cols',\n 'rows',\n 'wrap',\n ]);\n const xstyledProps = useGetXstyledProps(propsWithDefault);\n // =============================================================================\n // AD HOC PER COMPONENT LOGIC\n // =============================================================================\n // custom code goes here, this is an example\n const { id, onDrop } = propsWithDefault;\n const instanceUid = React.useMemo(() => id || uid(5), [id]);\n // =============================================================================\n // HELPERS HOOKS CONFIGS\n // =============================================================================\n const [isDragInside, setIsDragInside] = React.useState(false);\n\n const onBodyDragDropEvent = React.useCallback((e: Event) => {\n e.preventDefault();\n }, []);\n\n /**\n * Prevent default open file in browser\n */\n React.useEffect(() => {\n document.body.addEventListener('drop', onBodyDragDropEvent);\n return () => {\n document.body.removeEventListener('drop', onBodyDragDropEvent);\n };\n }, [onBodyDragDropEvent]);\n\n const onDragEnterHandler: React.DragEventHandler<HTMLDivElement> = React.useCallback((e) => {\n e.preventDefault();\n e.stopPropagation();\n setIsDragInside(true);\n }, []);\n const onDragOverHandler: React.DragEventHandler<HTMLDivElement> = React.useCallback((e) => {\n e.preventDefault();\n e.stopPropagation();\n setIsDragInside(true);\n }, []);\n const onDragLeaveHandler: React.DragEventHandler<HTMLDivElement> = React.useCallback((e) => {\n e.preventDefault();\n e.stopPropagation();\n setIsDragInside(false);\n }, []);\n const onDropHandler: React.DragEventHandler<HTMLDivElement> = React.useCallback(\n (e) => {\n e.preventDefault();\n e.stopPropagation();\n setIsDragInside(false);\n const filesArray = Array.from(e.dataTransfer?.files ?? []);\n onDrop?.(filesArray, e);\n },\n [onDrop],\n );\n\n return React.useMemo(\n () => ({\n propsWithDefault,\n globalProps,\n xstyledProps,\n instanceUid,\n isDragInside,\n onDragEnterHandler,\n onDragOverHandler,\n onDragLeaveHandler,\n onDropHandler,\n // ...eventHandlers,\n }),\n [\n propsWithDefault,\n globalProps,\n xstyledProps,\n instanceUid,\n isDragInside,\n onDragEnterHandler,\n onDragOverHandler,\n onDragLeaveHandler,\n onDropHandler,\n // eventHandlers,\n ],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAClB,oBAAqB;AACrB,0BAAyF;AACzF,iBAAoB;AACpB,mCAAoE;AACpE,8BAAiC;AAS1B,MAAM,gBAAgB,CAAC,kBAAqC;AAIjE,QAAM,uBAAmB,kDAAwD,eAAe,yCAAY;AAC5G,gDAAiB,kBAAkB,gDAAmB;AAItD,QAAM,kBAAc,wBAAK,4CAAkD,gBAAgB,GAAG;AAAA,IAC5F;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACD,QAAM,mBAAe,wCAAmB,gBAAgB;AAKxD,QAAM,EAAE,IAAI,OAAO,IAAI;AACvB,QAAM,cAAc,aAAAA,QAAM,QAAQ,MAAM,UAAM,gBAAI,CAAC,GAAG,CAAC,EAAE,CAAC;AAI1D,QAAM,CAAC,cAAc,eAAe,IAAI,aAAAA,QAAM,SAAS,KAAK;AAE5D,QAAM,sBAAsB,aAAAA,QAAM,YAAY,CAAC,MAAa;AAC1D,MAAE,eAAe;AAAA,EACnB,GAAG,CAAC,CAAC;AAKL,eAAAA,QAAM,UAAU,MAAM;AACpB,aAAS,KAAK,iBAAiB,QAAQ,mBAAmB;AAC1D,WAAO,MAAM;AACX,eAAS,KAAK,oBAAoB,QAAQ,mBAAmB;AAAA,IAC/D;AAAA,EACF,GAAG,CAAC,mBAAmB,CAAC;AAExB,QAAM,qBAA6D,aAAAA,QAAM,YAAY,CAAC,MAAM;AAC1F,MAAE,eAAe;AACjB,MAAE,gBAAgB;AAClB,oBAAgB,IAAI;AAAA,EACtB,GAAG,CAAC,CAAC;AACL,QAAM,oBAA4D,aAAAA,QAAM,YAAY,CAAC,MAAM;AACzF,MAAE,eAAe;AACjB,MAAE,gBAAgB;AAClB,oBAAgB,IAAI;AAAA,EACtB,GAAG,CAAC,CAAC;AACL,QAAM,qBAA6D,aAAAA,QAAM,YAAY,CAAC,MAAM;AAC1F,MAAE,eAAe;AACjB,MAAE,gBAAgB;AAClB,oBAAgB,KAAK;AAAA,EACvB,GAAG,CAAC,CAAC;AACL,QAAM,gBAAwD,aAAAA,QAAM;AAAA,IAClE,CAAC,MAAM;AACL,QAAE,eAAe;AACjB,QAAE,gBAAgB;AAClB,sBAAgB,KAAK;AACrB,YAAM,aAAa,MAAM,KAAK,EAAE,cAAc,SAAS,CAAC,CAAC;AACzD,eAAS,YAAY,CAAC;AAAA,IACxB;AAAA,IACA,CAAC,MAAM;AAAA,EACT;AAEA,SAAO,aAAAA,QAAM;AAAA,IACX,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,IAEF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,IAEF;AAAA,EACF;AACF;",
6
6
  "names": ["React"]
7
7
  }
@@ -45,7 +45,8 @@ const DROPZONE_SLOTS = {
45
45
  ACTIVEZONE_LABEL: "activezone-label",
46
46
  ACTIVEZONE_ICON: "activezone-icon",
47
47
  ACTIVEZONE_WRAPPER: "activezone-wrapper",
48
- WRAPPER: "wrapper"
48
+ WRAPPER: "wrapper",
49
+ WRAPPER_HOLDER: "wrapper_holder"
49
50
  };
50
51
  const DROPZONE_DATA_TESTID = (0, import_ds_system.slotObjectToDataTestIds)(DSDropzoneName, DROPZONE_SLOTS);
51
52
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/constants/index.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import { slotObjectToDataTestIds } from '@elliemae/ds-system';\n\nexport const DSDropzoneName = 'DSDropzone';\n\nexport const DROP_ZONE_CONSTANTS = {\n BORDER_WIDTH: 1,\n BORDER_RADIUS: 2,\n} as const;\n\n// we are giving \"component_name_slots\" to avoid errors on duplicate exports variables in aggregators\nexport const DROPZONE_SLOTS = {\n ACTIVEZONE_LABEL: 'activezone-label',\n ACTIVEZONE_ICON: 'activezone-icon',\n ACTIVEZONE_WRAPPER: 'activezone-wrapper',\n WRAPPER: 'wrapper',\n} as const;\n\n// we are giving \"component_name_data_testid\" to avoid errors on duplicate exports variables in aggregators\nexport const DROPZONE_DATA_TESTID = slotObjectToDataTestIds(DSDropzoneName, DROPZONE_SLOTS);\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAwC;AAEjC,MAAM,iBAAiB;AAEvB,MAAM,sBAAsB;AAAA,EACjC,cAAc;AAAA,EACd,eAAe;AACjB;AAGO,MAAM,iBAAiB;AAAA,EAC5B,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,oBAAoB;AAAA,EACpB,SAAS;AACX;AAGO,MAAM,2BAAuB,0CAAwB,gBAAgB,cAAc;",
4
+ "sourcesContent": ["import { slotObjectToDataTestIds } from '@elliemae/ds-system';\n\nexport const DSDropzoneName = 'DSDropzone';\n\nexport const DROP_ZONE_CONSTANTS = {\n BORDER_WIDTH: 1,\n BORDER_RADIUS: 2,\n} as const;\n\n// we are giving \"component_name_slots\" to avoid errors on duplicate exports variables in aggregators\nexport const DROPZONE_SLOTS = {\n ACTIVEZONE_LABEL: 'activezone-label',\n ACTIVEZONE_ICON: 'activezone-icon',\n ACTIVEZONE_WRAPPER: 'activezone-wrapper',\n WRAPPER: 'wrapper',\n WRAPPER_HOLDER: 'wrapper_holder',\n} as const;\n\n// we are giving \"component_name_data_testid\" to avoid errors on duplicate exports variables in aggregators\nexport const DROPZONE_DATA_TESTID = slotObjectToDataTestIds(DSDropzoneName, DROPZONE_SLOTS);\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAwC;AAEjC,MAAM,iBAAiB;AAEvB,MAAM,sBAAsB;AAAA,EACjC,cAAc;AAAA,EACd,eAAe;AACjB;AAGO,MAAM,iBAAiB;AAAA,EAC5B,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,oBAAoB;AAAA,EACpB,SAAS;AAAA,EACT,gBAAgB;AAClB;AAGO,MAAM,2BAAuB,0CAAwB,gBAAgB,cAAc;",
6
6
  "names": []
7
7
  }
@@ -42,7 +42,6 @@ var import_ds_grid = require("@elliemae/ds-grid");
42
42
  var import_ds_typography = require("@elliemae/ds-typography");
43
43
  var import_useActivezone = require("./config/useActivezone.js");
44
44
  var import_constants = require("../../constants/index.js");
45
- console.log(import_constants.DROPZONE_SLOTS);
46
45
  const StyledWrapper = (0, import_ds_system.styled)(import_ds_grid.Grid, { name: import_constants.DSDropzoneName, slot: import_constants.DROPZONE_SLOTS.ACTIVEZONE_WRAPPER })`
47
46
  cursor: grabbing;
48
47
  position: absolute;
@@ -52,6 +51,7 @@ const StyledWrapper = (0, import_ds_system.styled)(import_ds_grid.Grid, { name:
52
51
  left: 0;
53
52
  width: 100%;
54
53
  height: 100%;
54
+ pointer-events: none;
55
55
  `;
56
56
  const StyledLabel = (0, import_ds_system.styled)(import_ds_typography.DSTypography, { name: import_constants.DSDropzoneName, slot: import_constants.DROPZONE_SLOTS.ACTIVEZONE_LABEL })``;
57
57
  const StyledIcon = (0, import_ds_system.styled)(import_ds_grid.Grid, { name: import_constants.DSDropzoneName, slot: import_constants.DROPZONE_SLOTS.ACTIVEZONE_ICON })``;
@@ -77,7 +77,7 @@ const DSActivezone = (props) => {
77
77
  ...globalProps,
78
78
  ...xstyledProps,
79
79
  children: [
80
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledIcon, { justifyContent: "center", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { size: "l", color: "neutral-000" }) }),
80
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledIcon, { justifyContent: "center", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { size: "l", color: ["neutral", "0"] }) }),
81
81
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledLabel, { variant: "b2", color: "neutral-000", children: label })
82
82
  ]
83
83
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/parts/DSActivezone/DSActivezone.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import React from 'react';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport { useFontsizeMedia } from '@elliemae/ds-hooks-fontsize-media';\nimport { type DSActivezoneT, DSActivezonePropTypesSchema } from './react-desc-prop-types.js';\nimport { styled } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\nimport { DSTypography } from '@elliemae/ds-typography';\nimport { useActivezone } from './config/useActivezone.js';\nimport { DROPZONE_SLOTS, DROP_ZONE_CONSTANTS, DSDropzoneName } from '../../constants/index.js';\n\nconsole.log(DROPZONE_SLOTS);\n\nconst StyledWrapper = styled(Grid, { name: DSDropzoneName, slot: DROPZONE_SLOTS.ACTIVEZONE_WRAPPER })`\n cursor: grabbing;\n position: absolute;\n border-radius: ${DROP_ZONE_CONSTANTS.BORDER_RADIUS}px;\n padding: ${(props) => props.theme.space.xxxs} 1.8461538461538463rem;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n`;\nconst StyledLabel = styled(DSTypography, { name: DSDropzoneName, slot: DROPZONE_SLOTS.ACTIVEZONE_LABEL })``;\nconst StyledIcon = styled(Grid, { name: DSDropzoneName, slot: DROPZONE_SLOTS.ACTIVEZONE_ICON })``;\n\nconst colsDef = {\n largeFont: ['auto'],\n mediumFont: ['auto', 'auto'],\n smallFont: ['auto', 'auto'],\n};\n\nconst DSActivezone: React.ComponentType<DSActivezoneT.Props> = (props) => {\n const { propsWithDefault, globalProps, xstyledProps } = useActivezone(props);\n const { Icon, label } = propsWithDefault;\n const mainContentCols = useFontsizeMedia(colsDef);\n return (\n <StyledWrapper\n rows={['auto']}\n justifyContent=\"center\"\n alignItems=\"center\"\n bg=\"brand-600\"\n gutter=\"xxs\"\n cols={mainContentCols}\n getOwnerProps={() => propsWithDefault}\n {...globalProps}\n {...xstyledProps}\n >\n <StyledIcon justifyContent=\"center\">\n <Icon size=\"l\" color=\"neutral-000\" />\n </StyledIcon>\n <StyledLabel variant=\"b2\" color=\"neutral-000\">\n {label}\n </StyledLabel>\n </StyledWrapper>\n );\n};\n\nDSActivezone.displayName = 'DSActivezone';\nconst DSActivezoneWithSchema = describe(DSActivezone);\nDSActivezoneWithSchema.propTypes = DSActivezonePropTypesSchema;\n\nexport { DSActivezone, DSActivezoneWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADoCnB;AAnCJ,8BAAyB;AACzB,qCAAiC;AACjC,mCAAgE;AAChE,uBAAuB;AACvB,qBAAqB;AACrB,2BAA6B;AAC7B,2BAA8B;AAC9B,uBAAoE;AAEpE,QAAQ,IAAI,+BAAc;AAE1B,MAAM,oBAAgB,yBAAO,qBAAM,EAAE,MAAM,iCAAgB,MAAM,gCAAe,mBAAmB,CAAC;AAAA;AAAA;AAAA,mBAGjF,qCAAoB;AAAA,aAC1B,CAAC,UAAU,MAAM,MAAM,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAM1C,MAAM,kBAAc,yBAAO,mCAAc,EAAE,MAAM,iCAAgB,MAAM,gCAAe,iBAAiB,CAAC;AACxG,MAAM,iBAAa,yBAAO,qBAAM,EAAE,MAAM,iCAAgB,MAAM,gCAAe,gBAAgB,CAAC;AAE9F,MAAM,UAAU;AAAA,EACd,WAAW,CAAC,MAAM;AAAA,EAClB,YAAY,CAAC,QAAQ,MAAM;AAAA,EAC3B,WAAW,CAAC,QAAQ,MAAM;AAC5B;AAEA,MAAM,eAAyD,CAAC,UAAU;AACxE,QAAM,EAAE,kBAAkB,aAAa,aAAa,QAAI,oCAAc,KAAK;AAC3E,QAAM,EAAE,MAAM,MAAM,IAAI;AACxB,QAAM,sBAAkB,iDAAiB,OAAO;AAChD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAM,CAAC,MAAM;AAAA,MACb,gBAAe;AAAA,MACf,YAAW;AAAA,MACX,IAAG;AAAA,MACH,QAAO;AAAA,MACP,MAAM;AAAA,MACN,eAAe,MAAM;AAAA,MACpB,GAAG;AAAA,MACH,GAAG;AAAA,MAEJ;AAAA,oDAAC,cAAW,gBAAe,UACzB,sDAAC,QAAK,MAAK,KAAI,OAAM,eAAc,GACrC;AAAA,QACA,4CAAC,eAAY,SAAQ,MAAK,OAAM,eAC7B,iBACH;AAAA;AAAA;AAAA,EACF;AAEJ;AAEA,aAAa,cAAc;AAC3B,MAAM,6BAAyB,kCAAS,YAAY;AACpD,uBAAuB,YAAY;",
4
+ "sourcesContent": ["import React from 'react';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport { useFontsizeMedia } from '@elliemae/ds-hooks-fontsize-media';\nimport { type DSActivezoneT, DSActivezonePropTypesSchema } from './react-desc-prop-types.js';\nimport { styled } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\nimport { DSTypography } from '@elliemae/ds-typography';\nimport { useActivezone } from './config/useActivezone.js';\nimport { DROPZONE_SLOTS, DROP_ZONE_CONSTANTS, DSDropzoneName } from '../../constants/index.js';\n\nconst StyledWrapper = styled(Grid, { name: DSDropzoneName, slot: DROPZONE_SLOTS.ACTIVEZONE_WRAPPER })`\n cursor: grabbing;\n position: absolute;\n border-radius: ${DROP_ZONE_CONSTANTS.BORDER_RADIUS}px;\n padding: ${(props) => props.theme.space.xxxs} 1.8461538461538463rem;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n`;\nconst StyledLabel = styled(DSTypography, { name: DSDropzoneName, slot: DROPZONE_SLOTS.ACTIVEZONE_LABEL })``;\nconst StyledIcon = styled(Grid, { name: DSDropzoneName, slot: DROPZONE_SLOTS.ACTIVEZONE_ICON })``;\n\nconst colsDef = {\n largeFont: ['auto'],\n mediumFont: ['auto', 'auto'],\n smallFont: ['auto', 'auto'],\n};\n\nconst DSActivezone: React.ComponentType<DSActivezoneT.Props> = (props) => {\n const { propsWithDefault, globalProps, xstyledProps } = useActivezone(props);\n const { Icon, label } = propsWithDefault;\n const mainContentCols = useFontsizeMedia(colsDef);\n return (\n <StyledWrapper\n rows={['auto']}\n justifyContent=\"center\"\n alignItems=\"center\"\n bg=\"brand-600\"\n gutter=\"xxs\"\n cols={mainContentCols}\n getOwnerProps={() => propsWithDefault}\n {...globalProps}\n {...xstyledProps}\n >\n <StyledIcon justifyContent=\"center\">\n <Icon size=\"l\" color={['neutral', '0']} />\n </StyledIcon>\n <StyledLabel variant=\"b2\" color=\"neutral-000\">\n {label}\n </StyledLabel>\n </StyledWrapper>\n );\n};\n\nDSActivezone.displayName = 'DSActivezone';\nconst DSActivezoneWithSchema = describe(DSActivezone);\nDSActivezoneWithSchema.propTypes = DSActivezonePropTypesSchema;\n\nexport { DSActivezone, DSActivezoneWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADmCnB;AAlCJ,8BAAyB;AACzB,qCAAiC;AACjC,mCAAgE;AAChE,uBAAuB;AACvB,qBAAqB;AACrB,2BAA6B;AAC7B,2BAA8B;AAC9B,uBAAoE;AAEpE,MAAM,oBAAgB,yBAAO,qBAAM,EAAE,MAAM,iCAAgB,MAAM,gCAAe,mBAAmB,CAAC;AAAA;AAAA;AAAA,mBAGjF,qCAAoB;AAAA,aAC1B,CAAC,UAAU,MAAM,MAAM,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAO1C,MAAM,kBAAc,yBAAO,mCAAc,EAAE,MAAM,iCAAgB,MAAM,gCAAe,iBAAiB,CAAC;AACxG,MAAM,iBAAa,yBAAO,qBAAM,EAAE,MAAM,iCAAgB,MAAM,gCAAe,gBAAgB,CAAC;AAE9F,MAAM,UAAU;AAAA,EACd,WAAW,CAAC,MAAM;AAAA,EAClB,YAAY,CAAC,QAAQ,MAAM;AAAA,EAC3B,WAAW,CAAC,QAAQ,MAAM;AAC5B;AAEA,MAAM,eAAyD,CAAC,UAAU;AACxE,QAAM,EAAE,kBAAkB,aAAa,aAAa,QAAI,oCAAc,KAAK;AAC3E,QAAM,EAAE,MAAM,MAAM,IAAI;AACxB,QAAM,sBAAkB,iDAAiB,OAAO;AAChD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAM,CAAC,MAAM;AAAA,MACb,gBAAe;AAAA,MACf,YAAW;AAAA,MACX,IAAG;AAAA,MACH,QAAO;AAAA,MACP,MAAM;AAAA,MACN,eAAe,MAAM;AAAA,MACpB,GAAG;AAAA,MACH,GAAG;AAAA,MAEJ;AAAA,oDAAC,cAAW,gBAAe,UACzB,sDAAC,QAAK,MAAK,KAAI,OAAO,CAAC,WAAW,GAAG,GAAG,GAC1C;AAAA,QACA,4CAAC,eAAY,SAAQ,MAAK,OAAM,eAC7B,iBACH;AAAA;AAAA;AAAA,EACF;AAEJ;AAEA,aAAa,cAAc;AAC3B,MAAM,6BAAyB,kCAAS,YAAY;AACpD,uBAAuB,YAAY;",
6
6
  "names": []
7
7
  }
@@ -42,86 +42,16 @@ const DSDropzonePropTypes = {
42
42
  ...import_ds_props_helpers.globalAttributesPropTypes,
43
43
  ...import_ds_props_helpers.xstyledPropTypes,
44
44
  children: import_ds_props_helpers.PropTypes.any,
45
+ disabled: import_ds_props_helpers.PropTypes.bool.description("Enable/disable the dropzone"),
45
46
  hasError: import_ds_props_helpers.PropTypes.bool.description("Show error border color"),
46
- dropConfig: import_ds_props_helpers.PropTypes.shape({
47
- accept: import_ds_props_helpers.PropTypes.objectOf(import_ds_props_helpers.PropTypes.arrayOf(import_ds_props_helpers.PropTypes.string)).description(`
48
- Set accepted file types.
49
- Checkout https://developer.mozilla.org/en-US/docs/Web/API/window/showOpenFilePicker types option for more information.
50
- Keep in mind that mime type determination is not reliable across platforms. CSV files,
51
- for example, are reported as text/plain under macOS but as application/vnd.ms-excel under
52
- Windows. In some cases there might not be a mime type set at all (https://github.com/react-dropzone/react-dropzone/issues/276).
53
- `),
54
- multiple: import_ds_props_helpers.PropTypes.bool.description("Allow drag 'n' drop (or selection from the file dialog) of multiple files"),
55
- preventDropOnDocument: import_ds_props_helpers.PropTypes.bool.description(
56
- "If false, allow dropped items to take over the current browser window"
57
- ),
58
- noClick: import_ds_props_helpers.PropTypes.bool.description("If true, disables click to open the native file selection dialog"),
59
- noKeyboard: import_ds_props_helpers.PropTypes.bool.description(`
60
- If true, disables SPACE/ENTER to open the native file selection dialog.
61
- Note that it also stops tracking the focus state.`),
62
- noDrag: import_ds_props_helpers.PropTypes.bool.description("If true, disables drag&drop"),
63
- noDragEventsBubbling: import_ds_props_helpers.PropTypes.bool.description("If true, stops drag event propagation to parents"),
64
- minSize: import_ds_props_helpers.PropTypes.number.description("Minimum file size (in bytes)"),
65
- maxSize: import_ds_props_helpers.PropTypes.number.description("Maximum file size (in bytes)"),
66
- maxFiles: import_ds_props_helpers.PropTypes.number.description(`
67
- Maximum accepted number of files
68
- The default value is 0 which means there is no limitation to how many files are accepted.
69
- `),
70
- disabled: import_ds_props_helpers.PropTypes.bool.description("Enable/disable the dropzone"),
71
- getFilesFromEvent: import_ds_props_helpers.PropTypes.func.description(`
72
- Use this to provide a custom file aggregator
73
- @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
74
- `),
75
- onFileDialogCancel: import_ds_props_helpers.PropTypes.func.description("Cb for when closing the file dialog with no selection"),
76
- onFileDialogOpen: import_ds_props_helpers.PropTypes.func.description("Cb for when opening the file dialog"),
77
- useFsAccessApi: import_ds_props_helpers.PropTypes.bool.description(`
78
- Set to true to use the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API
79
- to open the file picker instead of using an <input type="file"> click event.
80
- `),
81
- onDragEnter: import_ds_props_helpers.PropTypes.func.description(`
82
- Cb for when the dragenter event occurs.
83
- @param {DragEvent} event`),
84
- onDragLeave: import_ds_props_helpers.PropTypes.func.description(`
85
- Cb for when the dragleave event occurs
86
- @param {DragEvent} event
87
- `),
88
- onDragOver: import_ds_props_helpers.PropTypes.func.description(`
89
- Cb for when the dragover event occurs
90
- @param {DragEvent} event
91
- `),
92
- onDrop: import_ds_props_helpers.PropTypes.func.description(`
93
- Cb for when the drop event occurs.
94
- 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.
95
- For example, with [SuperAgent](https://github.com/visionmedia/superagent) as a http/ajax library:
96
- @param {File[]} acceptedFiles
97
- @param {FileRejection[]} fileRejections
98
- @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
99
- `),
100
- onDropAccepted: import_ds_props_helpers.PropTypes.func.description(`
47
+ onDrop: import_ds_props_helpers.PropTypes.func.description(
48
+ `
101
49
  Cb for when the drop event occurs.
102
- Note that if no files are accepted, this callback is not invoked.
50
+ 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.
103
51
  @param {File[]} files
104
- @param {(DragEvent|Event)} event
105
- `),
106
- onDropRejected: import_ds_props_helpers.PropTypes.func.description(`
107
- Cb for when the drop event occurs.
108
- Note that if no files are rejected, this callback is not invoked.
109
- @param {FileRejection[]} fileRejections
110
- @param {(DragEvent|Event)} event
111
- `),
112
- onError: import_ds_props_helpers.PropTypes.func.description(`
113
- Cb for when there's some error from any of the promises.
114
- @param {Error} error
115
- `),
116
- validator: import_ds_props_helpers.PropTypes.func.description(`
117
- Custom validation function. It must return null if there's no errors.
118
- @param {File} file
119
- @returns {FileError|FileError[]|null}
120
- `)
121
- }).description(`react-dropzone options, see https://react-dropzone.js.org/ for more information V14.2.3`).defaultValue({})
122
- // onSomethingEvent: PropTypes.func
123
- // .description('some example of function, required if something is not foo')
124
- // .signature('(( newVal: string, e: React.SyntheticEvent, metaInfo: Record<string,unknown> ) => void )'),
52
+ @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
53
+ `
54
+ ).signature("(( file: File[], event: React.DragEvent ) => void )")
125
55
  };
126
56
  const DSDropzonePropTypesSchema = DSDropzonePropTypes;
127
57
  //# sourceMappingURL=react-desc-prop-types.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/react-desc-prop-types.ts", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["/* eslint-disable @typescript-eslint/no-empty-interface */\nimport type { GlobalAttributesT, XstyledProps, DSPropTypesSchema } from '@elliemae/ds-props-helpers';\nimport { PropTypes, globalAttributesPropTypes, xstyledPropTypes } from '@elliemae/ds-props-helpers';\nimport type { DropzoneOptions } from 'react-dropzone';\nimport type { WeakValidationMap } from 'react';\n\nexport declare namespace DSDropzoneT {\n export interface RequiredProps {}\n\n export interface DefaultProps {}\n\n export interface OptionalProps {\n dropConfig?: DropzoneOptions;\n hasError?: boolean;\n }\n\n export interface Props\n extends Partial<DefaultProps>,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof OptionalProps | keyof XstyledProps>,\n XstyledProps,\n RequiredProps {}\n\n export interface InternalProps\n extends DefaultProps,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof OptionalProps | keyof XstyledProps>,\n XstyledProps,\n RequiredProps {}\n\n export type ExampleState = '0' | '1';\n}\n\nexport const defaultProps: DSDropzoneT.DefaultProps = {\n dropConfig: {},\n};\n\nexport const DSDropzonePropTypes: DSPropTypesSchema<DSDropzoneT.Props> = {\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n children: PropTypes.any,\n hasError: PropTypes.bool.description('Show error border color'),\n dropConfig: PropTypes.shape({\n accept: PropTypes.objectOf(PropTypes.arrayOf(PropTypes.string)).description(`\n Set accepted file types.\n Checkout https://developer.mozilla.org/en-US/docs/Web/API/window/showOpenFilePicker types option for more information.\n Keep in mind that mime type determination is not reliable across platforms. CSV files,\n for example, are reported as text/plain under macOS but as application/vnd.ms-excel under\n Windows. In some cases there might not be a mime type set at all (https://github.com/react-dropzone/react-dropzone/issues/276).\n `),\n multiple: PropTypes.bool.description(\"Allow drag 'n' drop (or selection from the file dialog) of multiple files\"),\n\n preventDropOnDocument: PropTypes.bool.description(\n 'If false, allow dropped items to take over the current browser window',\n ),\n noClick: PropTypes.bool.description('If true, disables click to open the native file selection dialog'),\n noKeyboard: PropTypes.bool.description(`\n If true, disables SPACE/ENTER to open the native file selection dialog.\n Note that it also stops tracking the focus state.`),\n noDrag: PropTypes.bool.description('If true, disables drag&drop'),\n noDragEventsBubbling: PropTypes.bool.description('If true, stops drag event propagation to parents'),\n minSize: PropTypes.number.description('Minimum file size (in bytes)'),\n maxSize: PropTypes.number.description('Maximum file size (in bytes)'),\n maxFiles: PropTypes.number.description(`\n Maximum accepted number of files\n The default value is 0 which means there is no limitation to how many files are accepted.\n `),\n disabled: PropTypes.bool.description('Enable/disable the dropzone'),\n getFilesFromEvent: PropTypes.func.description(`\n Use this to provide a custom file aggregator\n @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)\n `),\n onFileDialogCancel: PropTypes.func.description('Cb for when closing the file dialog with no selection'),\n onFileDialogOpen: PropTypes.func.description('Cb for when opening the file dialog'),\n useFsAccessApi: PropTypes.bool.description(`\n Set to true to use the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API\n to open the file picker instead of using an <input type=\"file\"> click event.\n `),\n onDragEnter: PropTypes.func.description(`\n Cb for when the dragenter event occurs.\n @param {DragEvent} event`),\n onDragLeave: PropTypes.func.description(`\n Cb for when the dragleave event occurs\n @param {DragEvent} event\n `),\n onDragOver: PropTypes.func.description(`\n Cb for when the dragover event occurs\n @param {DragEvent} event\n `),\n onDrop: PropTypes.func.description(`\n Cb for when the drop event occurs.\n 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.\n For example, with [SuperAgent](https://github.com/visionmedia/superagent) as a http/ajax library: \n @param {File[]} acceptedFiles\n @param {FileRejection[]} fileRejections\n @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)\n `),\n onDropAccepted: PropTypes.func.description(`\n Cb for when the drop event occurs.\n Note that if no files are accepted, this callback is not invoked.\n @param {File[]} files\n @param {(DragEvent|Event)} event\n `),\n onDropRejected: PropTypes.func.description(`\n Cb for when the drop event occurs.\n Note that if no files are rejected, this callback is not invoked. \n @param {FileRejection[]} fileRejections\n @param {(DragEvent|Event)} event\n `),\n onError: PropTypes.func.description(`\n Cb for when there's some error from any of the promises.\n @param {Error} error\n `),\n validator: PropTypes.func.description(`\n Custom validation function. It must return null if there's no errors.\n @param {File} file\n @returns {FileError|FileError[]|null}\n `),\n })\n .description(`react-dropzone options, see https://react-dropzone.js.org/ for more information V14.2.3`)\n .defaultValue({}),\n // onSomethingEvent: PropTypes.func\n // .description('some example of function, required if something is not foo')\n // .signature('(( newVal: string, e: React.SyntheticEvent, metaInfo: Record<string,unknown> ) => void )'),\n};\n\nexport const DSDropzonePropTypesSchema = DSDropzonePropTypes as unknown as WeakValidationMap<DSDropzoneT.Props>;\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,8BAAuE;AA+BhE,MAAM,eAAyC;AAAA,EACpD,YAAY,CAAC;AACf;AAEO,MAAM,sBAA4D;AAAA,EACvE,GAAG;AAAA,EACH,GAAG;AAAA,EACH,UAAU,kCAAU;AAAA,EACpB,UAAU,kCAAU,KAAK,YAAY,yBAAyB;AAAA,EAC9D,YAAY,kCAAU,MAAM;AAAA,IAC1B,QAAQ,kCAAU,SAAS,kCAAU,QAAQ,kCAAU,MAAM,CAAC,EAAE,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAM7E;AAAA,IACC,UAAU,kCAAU,KAAK,YAAY,2EAA2E;AAAA,IAEhH,uBAAuB,kCAAU,KAAK;AAAA,MACpC;AAAA,IACF;AAAA,IACA,SAAS,kCAAU,KAAK,YAAY,kEAAkE;AAAA,IACtG,YAAY,kCAAU,KAAK,YAAY;AAAA;AAAA,oDAES;AAAA,IAChD,QAAQ,kCAAU,KAAK,YAAY,6BAA6B;AAAA,IAChE,sBAAsB,kCAAU,KAAK,YAAY,kDAAkD;AAAA,IACnG,SAAS,kCAAU,OAAO,YAAY,8BAA8B;AAAA,IACpE,SAAS,kCAAU,OAAO,YAAY,8BAA8B;AAAA,IACpE,UAAU,kCAAU,OAAO,YAAY;AAAA;AAAA;AAAA,GAGxC;AAAA,IACC,UAAU,kCAAU,KAAK,YAAY,6BAA6B;AAAA,IAClE,mBAAmB,kCAAU,KAAK,YAAY;AAAA;AAAA;AAAA,GAG/C;AAAA,IACC,oBAAoB,kCAAU,KAAK,YAAY,uDAAuD;AAAA,IACtG,kBAAkB,kCAAU,KAAK,YAAY,qCAAqC;AAAA,IAClF,gBAAgB,kCAAU,KAAK,YAAY;AAAA;AAAA;AAAA,GAG5C;AAAA,IACC,aAAa,kCAAU,KAAK,YAAY;AAAA;AAAA,2BAEjB;AAAA,IACvB,aAAa,kCAAU,KAAK,YAAY;AAAA;AAAA;AAAA,GAGzC;AAAA,IACC,YAAY,kCAAU,KAAK,YAAY;AAAA;AAAA;AAAA,GAGxC;AAAA,IACC,QAAQ,kCAAU,KAAK,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAOpC;AAAA,IACC,gBAAgB,kCAAU,KAAK,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA,GAK5C;AAAA,IACC,gBAAgB,kCAAU,KAAK,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA,GAK5C;AAAA,IACC,SAAS,kCAAU,KAAK,YAAY;AAAA;AAAA;AAAA,GAGrC;AAAA,IACC,WAAW,kCAAU,KAAK,YAAY;AAAA;AAAA;AAAA;AAAA,KAIrC;AAAA,EACH,CAAC,EACE,YAAY,yFAAyF,EACrG,aAAa,CAAC,CAAC;AAAA;AAAA;AAAA;AAIpB;AAEO,MAAM,4BAA4B;",
4
+ "sourcesContent": ["/* eslint-disable @typescript-eslint/no-empty-interface */\nimport type { GlobalAttributesT, XstyledProps, DSPropTypesSchema } from '@elliemae/ds-props-helpers';\nimport { PropTypes, globalAttributesPropTypes, xstyledPropTypes } from '@elliemae/ds-props-helpers';\nimport type { WeakValidationMap } from 'react';\n\nexport declare namespace DSDropzoneT {\n export interface RequiredProps {}\n\n export interface DefaultProps {}\n\n export interface OptionalProps {\n onDrop?: (files: File[], event: React.DragEvent<HTMLDivElement>) => void;\n hasError?: boolean;\n }\n\n export interface Props\n extends Partial<DefaultProps>,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof OptionalProps | keyof XstyledProps>,\n XstyledProps,\n RequiredProps {}\n\n export interface InternalProps\n extends DefaultProps,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof OptionalProps | keyof XstyledProps>,\n XstyledProps,\n RequiredProps {}\n\n export type ExampleState = '0' | '1';\n}\n\nexport const defaultProps: DSDropzoneT.DefaultProps = {\n dropConfig: {},\n};\n\nexport const DSDropzonePropTypes: DSPropTypesSchema<DSDropzoneT.Props> = {\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n children: PropTypes.any,\n disabled: PropTypes.bool.description('Enable/disable the dropzone'),\n hasError: PropTypes.bool.description('Show error border color'),\n onDrop: PropTypes.func\n .description(\n `\n Cb for when the drop event occurs.\n 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.\n @param {File[]} files\n @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)\n `,\n )\n .signature('(( file: File[], event: React.DragEvent ) => void )'),\n};\n\nexport const DSDropzonePropTypesSchema = DSDropzonePropTypes as unknown as WeakValidationMap<DSDropzoneT.Props>;\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,8BAAuE;AA8BhE,MAAM,eAAyC;AAAA,EACpD,YAAY,CAAC;AACf;AAEO,MAAM,sBAA4D;AAAA,EACvE,GAAG;AAAA,EACH,GAAG;AAAA,EACH,UAAU,kCAAU;AAAA,EACpB,UAAU,kCAAU,KAAK,YAAY,6BAA6B;AAAA,EAClE,UAAU,kCAAU,KAAK,YAAY,yBAAyB;AAAA,EAC9D,QAAQ,kCAAU,KACf;AAAA,IACC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMF,EACC,UAAU,qDAAqD;AACpE;AAEO,MAAM,4BAA4B;",
6
6
  "names": []
7
7
  }
@@ -28,7 +28,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
  var styled_exports = {};
30
30
  __export(styled_exports, {
31
- StyledDropZone: () => StyledDropZone
31
+ StyledDropZone: () => StyledDropZone,
32
+ StyledDropZoneHolder: () => StyledDropZoneHolder
32
33
  });
33
34
  module.exports = __toCommonJS(styled_exports);
34
35
  var React = __toESM(require("react"));
@@ -36,10 +37,14 @@ var import_ds_system = require("@elliemae/ds-system");
36
37
  var import_ds_grid = require("@elliemae/ds-grid");
37
38
  var import_constants = require("./constants/index.js");
38
39
  const borderImage = (color) => `url("data:image/svg+xml,%3csvg aria-hidden='true' width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='${import_constants.DROP_ZONE_CONSTANTS.BORDER_RADIUS}' ry='${import_constants.DROP_ZONE_CONSTANTS.BORDER_RADIUS}' stroke='${encodeURIComponent(color)}' stroke-width='${import_constants.DROP_ZONE_CONSTANTS.BORDER_WIDTH}' stroke-dasharray='4 6' stroke-dashoffset='0' stroke-linecap='round'/%3e%3c/svg%3e")`;
39
- const StyledDropZone = (0, import_ds_system.styled)(import_ds_grid.Grid, { name: import_constants.DSDropzoneName, slot: import_constants.DROPZONE_SLOTS.WRAPPER })`
40
+ const StyledDropZoneHolder = (0, import_ds_system.styled)(import_ds_grid.Grid, {
41
+ name: import_constants.DSDropzoneName,
42
+ slot: import_constants.DROPZONE_SLOTS.WRAPPER_HOLDER
43
+ })`
40
44
  position: relative;
45
+ `;
46
+ const StyledDropZone = (0, import_ds_system.styled)(import_ds_grid.Grid, { name: import_constants.DSDropzoneName, slot: import_constants.DROPZONE_SLOTS.WRAPPER })`
41
47
  border-radius: ${import_constants.DROP_ZONE_CONSTANTS.BORDER_RADIUS}px;
42
-
43
48
  background-color: ${(props) => props.theme.colors.neutral["000"]};
44
49
  background-image: ${(props) => {
45
50
  if (props.disabled) {
@@ -48,12 +53,9 @@ const StyledDropZone = (0, import_ds_system.styled)(import_ds_grid.Grid, { name:
48
53
  if (props.isDragActive) {
49
54
  return borderImage(props.theme.colors.brand[600]);
50
55
  }
51
- if (props.isDragReject || props.hasError) {
56
+ if (props.hasError) {
52
57
  return borderImage(props.theme.colors.danger[900]);
53
58
  }
54
- if (props.isFocused) {
55
- return borderImage(props.theme.colors.brand[600]);
56
- }
57
59
  return borderImage(props.theme.colors.neutral[400]);
58
60
  }};
59
61
  padding: ${(props) => props.theme.space.xs} 1.8461538461538463rem;
@@ -65,14 +67,12 @@ const StyledDropZone = (0, import_ds_system.styled)(import_ds_grid.Grid, { name:
65
67
  if (props.isDragActive) {
66
68
  return borderImage(props.theme.colors.brand[600]);
67
69
  }
68
- if (props.isDragReject) {
70
+ if (props.hasError) {
69
71
  return borderImage(props.theme.colors.danger[900]);
70
72
  }
71
- if (props.isFocused) {
72
- return borderImage(props.theme.colors.brand[600]);
73
- }
74
73
  return borderImage(props.theme.colors.brand[600]);
75
74
  }};
76
75
  }
76
+ cursor: ${(props) => props.isDragActive ? "grabbing" : "default"};
77
77
  `;
78
78
  //# sourceMappingURL=styled.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/styled.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import { styled } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\nimport { DROPZONE_SLOTS, DROP_ZONE_CONSTANTS, DSDropzoneName } from './constants/index.js';\nimport type { DropzoneState } from 'react-dropzone';\n\n// const borderImageCreator = (color: any, stroke: number) =>\n// encodeURIComponent(\n// `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"100%\" height=\"100%\"><rect width=\"100%\" height=\"100%\" fill=\"none\" rx=\"8\" ry=\"8\" stroke=\"${color}\" stroke-width=\"${stroke}\" stroke-dasharray=\"6, 14\" stroke-dashoffset=\"0\" stroke-linecap=\"square\"/></svg>`,\n// );\n\n// const handleBorder = (props: StyledProps<DSDropzoneT.InternalProps>): string => {\n// const { isDragAccept, isDragReject, isFocused } = props;\n// console.log(props);\n// if (isDragAccept) return borderImageCreator(props.theme.colors.brand[600], 2);\n// if (isDragReject) return borderImageCreator(props.theme.colors.danger[900], 2);\n// return borderImageCreator(props.theme.colors.neutral[400], 2);\n// };\n\nconst borderImage = (color: string) =>\n `url(\"data:image/svg+xml,%3csvg aria-hidden='true' width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='${\n DROP_ZONE_CONSTANTS.BORDER_RADIUS\n }' ry='${DROP_ZONE_CONSTANTS.BORDER_RADIUS}' stroke='${encodeURIComponent(color)}' stroke-width='${\n DROP_ZONE_CONSTANTS.BORDER_WIDTH\n }' stroke-dasharray='4 6' stroke-dashoffset='0' stroke-linecap='round'/%3e%3c/svg%3e\")`;\n\nexport const StyledDropZone = styled(Grid, { name: DSDropzoneName, slot: DROPZONE_SLOTS.WRAPPER })<\n DropzoneState & {\n disabled: boolean;\n hasError: boolean;\n }\n>`\n position: relative;\n border-radius: ${DROP_ZONE_CONSTANTS.BORDER_RADIUS}px;\n\n background-color: ${(props) => props.theme.colors.neutral['000']};\n background-image: ${(props) => {\n if (props.disabled) {\n return borderImage(props.theme.colors.neutral[400]);\n }\n if (props.isDragActive) {\n return borderImage(props.theme.colors.brand[600]);\n }\n if (props.isDragReject || props.hasError) {\n return borderImage(props.theme.colors.danger[900]);\n }\n if (props.isFocused) {\n return borderImage(props.theme.colors.brand[600]);\n }\n return borderImage(props.theme.colors.neutral[400]);\n }};\n padding: ${(props) => props.theme.space.xs} 1.8461538461538463rem;\n &:hover {\n background-image: ${(props) => {\n if (props.disabled) {\n return borderImage(props.theme.colors.neutral[400]);\n }\n if (props.isDragActive) {\n return borderImage(props.theme.colors.brand[600]);\n }\n if (props.isDragReject) {\n return borderImage(props.theme.colors.danger[900]);\n }\n if (props.isFocused) {\n return borderImage(props.theme.colors.brand[600]);\n }\n return borderImage(props.theme.colors.brand[600]);\n }};\n }\n`;\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAuB;AACvB,qBAAqB;AACrB,uBAAoE;AAgBpE,MAAM,cAAc,CAAC,UACnB,gLACE,qCAAoB,sBACb,qCAAoB,0BAA0B,mBAAmB,KAAK,oBAC7E,qCAAoB;AAGjB,MAAM,qBAAiB,yBAAO,qBAAM,EAAE,MAAM,iCAAgB,MAAM,gCAAe,QAAQ,CAAC;AAAA;AAAA,mBAO9E,qCAAoB;AAAA;AAAA,sBAEjB,CAAC,UAAU,MAAM,MAAM,OAAO,QAAQ,KAAK;AAAA,sBAC3C,CAAC,UAAU;AAC7B,MAAI,MAAM,UAAU;AAClB,WAAO,YAAY,MAAM,MAAM,OAAO,QAAQ,GAAG,CAAC;AAAA,EACpD;AACA,MAAI,MAAM,cAAc;AACtB,WAAO,YAAY,MAAM,MAAM,OAAO,MAAM,GAAG,CAAC;AAAA,EAClD;AACA,MAAI,MAAM,gBAAgB,MAAM,UAAU;AACxC,WAAO,YAAY,MAAM,MAAM,OAAO,OAAO,GAAG,CAAC;AAAA,EACnD;AACA,MAAI,MAAM,WAAW;AACnB,WAAO,YAAY,MAAM,MAAM,OAAO,MAAM,GAAG,CAAC;AAAA,EAClD;AACA,SAAO,YAAY,MAAM,MAAM,OAAO,QAAQ,GAAG,CAAC;AACpD;AAAA,aACW,CAAC,UAAU,MAAM,MAAM,MAAM;AAAA;AAAA,wBAElB,CAAC,UAAU;AAC7B,MAAI,MAAM,UAAU;AAClB,WAAO,YAAY,MAAM,MAAM,OAAO,QAAQ,GAAG,CAAC;AAAA,EACpD;AACA,MAAI,MAAM,cAAc;AACtB,WAAO,YAAY,MAAM,MAAM,OAAO,MAAM,GAAG,CAAC;AAAA,EAClD;AACA,MAAI,MAAM,cAAc;AACtB,WAAO,YAAY,MAAM,MAAM,OAAO,OAAO,GAAG,CAAC;AAAA,EACnD;AACA,MAAI,MAAM,WAAW;AACnB,WAAO,YAAY,MAAM,MAAM,OAAO,MAAM,GAAG,CAAC;AAAA,EAClD;AACA,SAAO,YAAY,MAAM,MAAM,OAAO,MAAM,GAAG,CAAC;AAClD;AAAA;AAAA;",
4
+ "sourcesContent": ["import type {} from '@elliemae/ds-system';\nimport { styled } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\nimport { DROPZONE_SLOTS, DROP_ZONE_CONSTANTS, DSDropzoneName } from './constants/index.js';\n\n// const borderImageCreator = (color: any, stroke: number) =>\n// encodeURIComponent(\n// `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"100%\" height=\"100%\"><rect width=\"100%\" height=\"100%\" fill=\"none\" rx=\"8\" ry=\"8\" stroke=\"${color}\" stroke-width=\"${stroke}\" stroke-dasharray=\"6, 14\" stroke-dashoffset=\"0\" stroke-linecap=\"square\"/></svg>`,\n// );\n\n// const handleBorder = (props: StyledProps<DSDropzoneT.InternalProps>): string => {\n// const { isDragAccept, isDragReject, isFocused } = props;\n// console.log(props);\n// if (isDragAccept) return borderImageCreator(props.theme.colors.brand[600], 2);\n// if (isDragReject) return borderImageCreator(props.theme.colors.danger[900], 2);\n// return borderImageCreator(props.theme.colors.neutral[400], 2);\n// };\n\nconst borderImage = (color: string) =>\n `url(\"data:image/svg+xml,%3csvg aria-hidden='true' width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='${\n DROP_ZONE_CONSTANTS.BORDER_RADIUS\n }' ry='${DROP_ZONE_CONSTANTS.BORDER_RADIUS}' stroke='${encodeURIComponent(color)}' stroke-width='${\n DROP_ZONE_CONSTANTS.BORDER_WIDTH\n }' stroke-dasharray='4 6' stroke-dashoffset='0' stroke-linecap='round'/%3e%3c/svg%3e\")`;\n\ninterface DropzoneStyledProps {\n isDragActive: boolean;\n disabled: boolean;\n hasError: boolean;\n getOwnerProps: () => object;\n getOwnerPropsArguments: () => object;\n}\nexport const StyledDropZoneHolder = styled(Grid, {\n name: DSDropzoneName,\n slot: DROPZONE_SLOTS.WRAPPER_HOLDER,\n})`\n position: relative;\n`;\nexport const StyledDropZone = styled(Grid, { name: DSDropzoneName, slot: DROPZONE_SLOTS.WRAPPER })<DropzoneStyledProps>`\n border-radius: ${DROP_ZONE_CONSTANTS.BORDER_RADIUS}px;\n background-color: ${(props) => props.theme.colors.neutral['000']};\n background-image: ${(props) => {\n if (props.disabled) {\n return borderImage(props.theme.colors.neutral[400]);\n }\n if (props.isDragActive) {\n return borderImage(props.theme.colors.brand[600]);\n }\n if (props.hasError) {\n return borderImage(props.theme.colors.danger[900]);\n }\n return borderImage(props.theme.colors.neutral[400]);\n }};\n padding: ${(props) => props.theme.space.xs} 1.8461538461538463rem;\n &:hover {\n background-image: ${(props) => {\n if (props.disabled) {\n return borderImage(props.theme.colors.neutral[400]);\n }\n if (props.isDragActive) {\n return borderImage(props.theme.colors.brand[600]);\n }\n if (props.hasError) {\n return borderImage(props.theme.colors.danger[900]);\n }\n return borderImage(props.theme.colors.brand[600]);\n }};\n }\n cursor: ${(props) => (props.isDragActive ? 'grabbing' : 'default')};\n`;\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,uBAAuB;AACvB,qBAAqB;AACrB,uBAAoE;AAepE,MAAM,cAAc,CAAC,UACnB,gLACE,qCAAoB,sBACb,qCAAoB,0BAA0B,mBAAmB,KAAK,oBAC7E,qCAAoB;AAUjB,MAAM,2BAAuB,yBAAO,qBAAM;AAAA,EAC/C,MAAM;AAAA,EACN,MAAM,gCAAe;AACvB,CAAC;AAAA;AAAA;AAGM,MAAM,qBAAiB,yBAAO,qBAAM,EAAE,MAAM,iCAAgB,MAAM,gCAAe,QAAQ,CAAC;AAAA,mBAC9E,qCAAoB;AAAA,sBACjB,CAAC,UAAU,MAAM,MAAM,OAAO,QAAQ,KAAK;AAAA,sBAC3C,CAAC,UAAU;AAC7B,MAAI,MAAM,UAAU;AAClB,WAAO,YAAY,MAAM,MAAM,OAAO,QAAQ,GAAG,CAAC;AAAA,EACpD;AACA,MAAI,MAAM,cAAc;AACtB,WAAO,YAAY,MAAM,MAAM,OAAO,MAAM,GAAG,CAAC;AAAA,EAClD;AACA,MAAI,MAAM,UAAU;AAClB,WAAO,YAAY,MAAM,MAAM,OAAO,OAAO,GAAG,CAAC;AAAA,EACnD;AACA,SAAO,YAAY,MAAM,MAAM,OAAO,QAAQ,GAAG,CAAC;AACpD;AAAA,aACW,CAAC,UAAU,MAAM,MAAM,MAAM;AAAA;AAAA,wBAElB,CAAC,UAAU;AAC7B,MAAI,MAAM,UAAU;AAClB,WAAO,YAAY,MAAM,MAAM,OAAO,QAAQ,GAAG,CAAC;AAAA,EACpD;AACA,MAAI,MAAM,cAAc;AACtB,WAAO,YAAY,MAAM,MAAM,OAAO,MAAM,GAAG,CAAC;AAAA,EAClD;AACA,MAAI,MAAM,UAAU;AAClB,WAAO,YAAY,MAAM,MAAM,OAAO,OAAO,GAAG,CAAC;AAAA,EACnD;AACA,SAAO,YAAY,MAAM,MAAM,OAAO,MAAM,GAAG,CAAC;AAClD;AAAA;AAAA,YAEQ,CAAC,UAAW,MAAM,eAAe,aAAa;AAAA;",
6
6
  "names": []
7
7
  }
@@ -1,34 +1,52 @@
1
1
  import * as React from "react";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
+ import React2 from "react";
3
4
  import { describe } from "@elliemae/ds-props-helpers";
4
5
  import { DSDropzonePropTypesSchema } from "./react-desc-prop-types.js";
5
6
  import { useDSDropzone } from "./config/useDSDropzone.js";
6
7
  import { DSDropzoneName } from "./constants/index.js";
7
- import { StyledDropZone } from "./styled.js";
8
+ import { StyledDropZone, StyledDropZoneHolder } from "./styled.js";
8
9
  import { DSActivezone } from "./parts/DSActivezone/DSActivezone.js";
10
+ import { omit } from "lodash";
9
11
  const DSDropzone = (props) => {
10
- const { propsWithDefault, globalProps, xstyledProps, dropZoneState } = useDSDropzone(props);
11
- return /* @__PURE__ */ jsxs(
12
- StyledDropZone,
12
+ const {
13
+ propsWithDefault,
14
+ globalProps,
15
+ xstyledProps,
16
+ isDragInside,
17
+ onDragEnterHandler,
18
+ onDragOverHandler,
19
+ onDragLeaveHandler,
20
+ onDropHandler
21
+ } = useDSDropzone(props);
22
+ const getOwnerProps = React2.useCallback(() => propsWithDefault, [propsWithDefault]);
23
+ const getOwnerPropsArguments = React2.useCallback(() => ({}), []);
24
+ const safeGlobalProps = omit(globalProps, "onDrop", "hasError");
25
+ return /* @__PURE__ */ jsx(
26
+ StyledDropZoneHolder,
13
27
  {
14
- ...globalProps,
28
+ ...safeGlobalProps,
15
29
  ...xstyledProps,
16
- ...dropZoneState.getRootProps({
17
- isFocused: dropZoneState.isFocused,
18
- isDragAccept: dropZoneState.isDragAccept,
19
- isDragReject: dropZoneState.isDragReject
20
- }),
21
- isFocused: dropZoneState.isFocused,
22
- isDragAccept: dropZoneState.isDragAccept,
23
- isDragReject: dropZoneState.isDragReject,
24
- isDragActive: dropZoneState.isDragActive,
25
- hasError: propsWithDefault.hasError,
26
- disabled: propsWithDefault.dropConfig.disabled,
27
- children: [
28
- /* @__PURE__ */ jsx("input", { ...dropZoneState.getInputProps() }),
29
- propsWithDefault.children,
30
- dropZoneState.isDragActive ? /* @__PURE__ */ jsx(DSActivezone, {}) : null
31
- ]
30
+ getOwnerProps,
31
+ getOwnerPropsArguments,
32
+ children: /* @__PURE__ */ jsxs(
33
+ StyledDropZone,
34
+ {
35
+ onDragEnter: onDragEnterHandler,
36
+ onDragOver: onDragOverHandler,
37
+ onDragLeave: onDragLeaveHandler,
38
+ onDrop: onDropHandler,
39
+ hasError: Boolean(propsWithDefault.hasError),
40
+ disabled: Boolean(propsWithDefault.disabled),
41
+ isDragActive: isDragInside,
42
+ getOwnerProps,
43
+ getOwnerPropsArguments,
44
+ children: [
45
+ propsWithDefault.children,
46
+ isDragInside ? /* @__PURE__ */ jsx(DSActivezone, {}) : null
47
+ ]
48
+ }
49
+ )
32
50
  }
33
51
  );
34
52
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/DSDropzone.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport { type DSDropzoneT, DSDropzonePropTypesSchema } from './react-desc-prop-types.js';\nimport { useDSDropzone } from './config/useDSDropzone.js';\nimport { DSDropzoneName } from './constants/index.js';\nimport { StyledDropZone } from './styled.js';\nimport { DSActivezone } from './parts/DSActivezone/DSActivezone.js';\n\nconst DSDropzone: React.ComponentType<DSDropzoneT.Props> = (props) => {\n const { propsWithDefault, globalProps, xstyledProps, dropZoneState } = useDSDropzone(props);\n return (\n <StyledDropZone\n {...globalProps}\n {...xstyledProps}\n {...dropZoneState.getRootProps({\n isFocused: dropZoneState.isFocused,\n isDragAccept: dropZoneState.isDragAccept,\n isDragReject: dropZoneState.isDragReject,\n })}\n isFocused={dropZoneState.isFocused}\n isDragAccept={dropZoneState.isDragAccept}\n isDragReject={dropZoneState.isDragReject}\n isDragActive={dropZoneState.isDragActive}\n hasError={propsWithDefault.hasError}\n disabled={propsWithDefault.dropConfig.disabled}\n >\n <input {...dropZoneState.getInputProps()} />\n {propsWithDefault.children}\n {dropZoneState.isDragActive ? <DSActivezone /> : null}\n </StyledDropZone>\n );\n};\n\nDSDropzone.propTypes = DSDropzonePropTypesSchema;\nDSDropzone.displayName = DSDropzoneName;\nconst DSDropzoneWithSchema = describe(DSDropzone);\nDSDropzoneWithSchema.propTypes = DSDropzonePropTypesSchema;\n\nexport { DSDropzone, DSDropzoneWithSchema };\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACWnB,SAeE,KAfF;AAVJ,SAAS,gBAAgB;AACzB,SAA2B,iCAAiC;AAC5D,SAAS,qBAAqB;AAC9B,SAAS,sBAAsB;AAC/B,SAAS,sBAAsB;AAC/B,SAAS,oBAAoB;AAE7B,MAAM,aAAqD,CAAC,UAAU;AACpE,QAAM,EAAE,kBAAkB,aAAa,cAAc,cAAc,IAAI,cAAc,KAAK;AAC1F,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACH,GAAG;AAAA,MACH,GAAG,cAAc,aAAa;AAAA,QAC7B,WAAW,cAAc;AAAA,QACzB,cAAc,cAAc;AAAA,QAC5B,cAAc,cAAc;AAAA,MAC9B,CAAC;AAAA,MACD,WAAW,cAAc;AAAA,MACzB,cAAc,cAAc;AAAA,MAC5B,cAAc,cAAc;AAAA,MAC5B,cAAc,cAAc;AAAA,MAC5B,UAAU,iBAAiB;AAAA,MAC3B,UAAU,iBAAiB,WAAW;AAAA,MAEtC;AAAA,4BAAC,WAAO,GAAG,cAAc,cAAc,GAAG;AAAA,QACzC,iBAAiB;AAAA,QACjB,cAAc,eAAe,oBAAC,gBAAa,IAAK;AAAA;AAAA;AAAA,EACnD;AAEJ;AAEA,WAAW,YAAY;AACvB,WAAW,cAAc;AACzB,MAAM,uBAAuB,SAAS,UAAU;AAChD,qBAAqB,YAAY;",
6
- "names": []
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport { type DSDropzoneT, DSDropzonePropTypesSchema } from './react-desc-prop-types.js';\nimport { useDSDropzone } from './config/useDSDropzone.js';\nimport { DSDropzoneName } from './constants/index.js';\nimport { StyledDropZone, StyledDropZoneHolder } from './styled.js';\nimport { DSActivezone } from './parts/DSActivezone/DSActivezone.js';\nimport { omit } from 'lodash';\n\nconst DSDropzone: React.ComponentType<DSDropzoneT.Props> = (props) => {\n const {\n propsWithDefault,\n globalProps,\n xstyledProps,\n isDragInside,\n onDragEnterHandler,\n onDragOverHandler,\n onDragLeaveHandler,\n onDropHandler,\n } = useDSDropzone(props);\n const getOwnerProps = React.useCallback(() => propsWithDefault, [propsWithDefault]);\n const getOwnerPropsArguments = React.useCallback(() => ({}), []);\n const safeGlobalProps = omit(globalProps, 'onDrop', 'hasError');\n return (\n <StyledDropZoneHolder\n {...safeGlobalProps}\n {...xstyledProps}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <StyledDropZone\n onDragEnter={onDragEnterHandler}\n onDragOver={onDragOverHandler}\n onDragLeave={onDragLeaveHandler}\n onDrop={onDropHandler}\n hasError={Boolean(propsWithDefault.hasError)}\n disabled={Boolean(propsWithDefault.disabled)}\n isDragActive={isDragInside}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {propsWithDefault.children}\n {isDragInside ? <DSActivezone /> : null}\n </StyledDropZone>\n </StyledDropZoneHolder>\n );\n};\n\nDSDropzone.propTypes = DSDropzonePropTypesSchema;\nDSDropzone.displayName = DSDropzoneName;\nconst DSDropzoneWithSchema = describe(DSDropzone);\nDSDropzoneWithSchema.propTypes = DSDropzonePropTypesSchema;\n\nexport { DSDropzone, DSDropzoneWithSchema };\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;AC8BjB,SAYkB,KAZlB;AA9BN,OAAOA,YAAW;AAClB,SAAS,gBAAgB;AACzB,SAA2B,iCAAiC;AAC5D,SAAS,qBAAqB;AAC9B,SAAS,sBAAsB;AAC/B,SAAS,gBAAgB,4BAA4B;AACrD,SAAS,oBAAoB;AAC7B,SAAS,YAAY;AAErB,MAAM,aAAqD,CAAC,UAAU;AACpE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,cAAc,KAAK;AACvB,QAAM,gBAAgBA,OAAM,YAAY,MAAM,kBAAkB,CAAC,gBAAgB,CAAC;AAClF,QAAM,yBAAyBA,OAAM,YAAY,OAAO,CAAC,IAAI,CAAC,CAAC;AAC/D,QAAM,kBAAkB,KAAK,aAAa,UAAU,UAAU;AAC9D,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACH,GAAG;AAAA,MACJ;AAAA,MACA;AAAA,MAEA;AAAA,QAAC;AAAA;AAAA,UACC,aAAa;AAAA,UACb,YAAY;AAAA,UACZ,aAAa;AAAA,UACb,QAAQ;AAAA,UACR,UAAU,QAAQ,iBAAiB,QAAQ;AAAA,UAC3C,UAAU,QAAQ,iBAAiB,QAAQ;AAAA,UAC3C,cAAc;AAAA,UACd;AAAA,UACA;AAAA,UAEC;AAAA,6BAAiB;AAAA,YACjB,eAAe,oBAAC,gBAAa,IAAK;AAAA;AAAA;AAAA,MACrC;AAAA;AAAA,EACF;AAEJ;AAEA,WAAW,YAAY;AACvB,WAAW,cAAc;AACzB,MAAM,uBAAuB,SAAS,UAAU;AAChD,qBAAqB,YAAY;",
6
+ "names": ["React"]
7
7
  }
@@ -4,7 +4,6 @@ import { omit } from "lodash";
4
4
  import { useGetGlobalAttributes, useGetXstyledProps, useMemoMergePropsWithDefault } from "@elliemae/ds-utilities";
5
5
  import { uid } from "uid";
6
6
  import { DSDropzonePropTypes, defaultProps } from "../react-desc-prop-types.js";
7
- import { useDropzone } from "react-dropzone";
8
7
  import { useValidateProps } from "./useValidateProps.js";
9
8
  const useDSDropzone = (propsFromUser) => {
10
9
  const propsWithDefault = useMemoMergePropsWithDefault(propsFromUser, defaultProps);
@@ -15,28 +14,54 @@ const useDSDropzone = (propsFromUser) => {
15
14
  "wrap"
16
15
  ]);
17
16
  const xstyledProps = useGetXstyledProps(propsWithDefault);
18
- const { id, dropConfig } = propsWithDefault;
17
+ const { id, onDrop } = propsWithDefault;
19
18
  const instanceUid = React2.useMemo(() => id || uid(5), [id]);
20
19
  const [isDragInside, setIsDragInside] = React2.useState(false);
21
- const dropConfigDefault = React2.useMemo(
22
- () => ({
23
- ...dropConfig,
24
- noKeyboard: true,
25
- onDragEnter: (event) => {
26
- dropConfig?.onDragEnter?.(event);
27
- setIsDragInside(true);
28
- }
29
- }),
30
- [dropConfig]
20
+ const onBodyDragDropEvent = React2.useCallback((e) => {
21
+ e.preventDefault();
22
+ }, []);
23
+ React2.useEffect(() => {
24
+ document.body.addEventListener("drop", onBodyDragDropEvent);
25
+ return () => {
26
+ document.body.removeEventListener("drop", onBodyDragDropEvent);
27
+ };
28
+ }, [onBodyDragDropEvent]);
29
+ const onDragEnterHandler = React2.useCallback((e) => {
30
+ e.preventDefault();
31
+ e.stopPropagation();
32
+ setIsDragInside(true);
33
+ }, []);
34
+ const onDragOverHandler = React2.useCallback((e) => {
35
+ e.preventDefault();
36
+ e.stopPropagation();
37
+ setIsDragInside(true);
38
+ }, []);
39
+ const onDragLeaveHandler = React2.useCallback((e) => {
40
+ e.preventDefault();
41
+ e.stopPropagation();
42
+ setIsDragInside(false);
43
+ }, []);
44
+ const onDropHandler = React2.useCallback(
45
+ (e) => {
46
+ e.preventDefault();
47
+ e.stopPropagation();
48
+ setIsDragInside(false);
49
+ const filesArray = Array.from(e.dataTransfer?.files ?? []);
50
+ onDrop?.(filesArray, e);
51
+ },
52
+ [onDrop]
31
53
  );
32
- const dropZoneState = useDropzone(dropConfigDefault);
33
54
  return React2.useMemo(
34
55
  () => ({
35
56
  propsWithDefault,
36
57
  globalProps,
37
58
  xstyledProps,
38
59
  instanceUid,
39
- dropZoneState
60
+ isDragInside,
61
+ onDragEnterHandler,
62
+ onDragOverHandler,
63
+ onDragLeaveHandler,
64
+ onDropHandler
40
65
  // ...eventHandlers,
41
66
  }),
42
67
  [
@@ -44,7 +69,11 @@ const useDSDropzone = (propsFromUser) => {
44
69
  globalProps,
45
70
  xstyledProps,
46
71
  instanceUid,
47
- dropZoneState
72
+ isDragInside,
73
+ onDragEnterHandler,
74
+ onDragOverHandler,
75
+ onDragLeaveHandler,
76
+ onDropHandler
48
77
  // eventHandlers,
49
78
  ]
50
79
  );
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useDSDropzone.ts"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { omit } from 'lodash';\nimport { useGetGlobalAttributes, useGetXstyledProps, useMemoMergePropsWithDefault } from '@elliemae/ds-utilities';\nimport { uid } from 'uid';\nimport { type DSDropzoneT, DSDropzonePropTypes, defaultProps } from '../react-desc-prop-types.js';\nimport { useDropzone } from 'react-dropzone';\n\nimport { useValidateProps } from './useValidateProps.js';\n\nexport interface DropzoneCTX {\n propsWithDefault: DSDropzoneT.InternalProps;\n globalProps: ReturnType<typeof useGetGlobalAttributes>;\n xstyledProps: ReturnType<typeof useGetXstyledProps>;\n instanceUid: string;\n}\n\nexport const useDSDropzone = (propsFromUser: DSDropzoneT.Props) => {\n // =============================================================================\n // MERGE WITH DEFAULT AND VALIDATE PROPS\n // =============================================================================\n const propsWithDefault = useMemoMergePropsWithDefault<DSDropzoneT.InternalProps>(propsFromUser, defaultProps);\n useValidateProps(propsWithDefault, DSDropzonePropTypes);\n // =============================================================================\n // GLOBAL ATTRIBUTES & XSTYLED PROPS\n // =============================================================================\n const globalProps = omit(useGetGlobalAttributes<DSDropzoneT.InternalProps>(propsWithDefault), [\n 'cols',\n 'rows',\n 'wrap',\n ]);\n const xstyledProps = useGetXstyledProps(propsWithDefault);\n // =============================================================================\n // AD HOC PER COMPONENT LOGIC\n // =============================================================================\n // custom code goes here, this is an example\n const { id, dropConfig } = propsWithDefault;\n const instanceUid = React.useMemo(() => id || uid(5), [id]);\n // =============================================================================\n // HELPERS HOOKS CONFIGS\n // =============================================================================\n const [isDragInside, setIsDragInside] = React.useState(false);\n\n const dropConfigDefault = React.useMemo(\n () => ({\n ...dropConfig,\n noKeyboard: true,\n onDragEnter: (event) => {\n dropConfig?.onDragEnter?.(event);\n setIsDragInside(true);\n },\n }),\n [dropConfig],\n );\n const dropZoneState = useDropzone(dropConfigDefault);\n return React.useMemo(\n () => ({\n propsWithDefault,\n globalProps,\n xstyledProps,\n instanceUid,\n dropZoneState,\n // ...eventHandlers,\n }),\n [\n propsWithDefault,\n globalProps,\n xstyledProps,\n instanceUid,\n dropZoneState,\n // eventHandlers,\n ],\n );\n};\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACAvB,OAAOA,YAAW;AAClB,SAAS,YAAY;AACrB,SAAS,wBAAwB,oBAAoB,oCAAoC;AACzF,SAAS,WAAW;AACpB,SAA2B,qBAAqB,oBAAoB;AACpE,SAAS,mBAAmB;AAE5B,SAAS,wBAAwB;AAS1B,MAAM,gBAAgB,CAAC,kBAAqC;AAIjE,QAAM,mBAAmB,6BAAwD,eAAe,YAAY;AAC5G,mBAAiB,kBAAkB,mBAAmB;AAItD,QAAM,cAAc,KAAK,uBAAkD,gBAAgB,GAAG;AAAA,IAC5F;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACD,QAAM,eAAe,mBAAmB,gBAAgB;AAKxD,QAAM,EAAE,IAAI,WAAW,IAAI;AAC3B,QAAM,cAAcA,OAAM,QAAQ,MAAM,MAAM,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;AAI1D,QAAM,CAAC,cAAc,eAAe,IAAIA,OAAM,SAAS,KAAK;AAE5D,QAAM,oBAAoBA,OAAM;AAAA,IAC9B,OAAO;AAAA,MACL,GAAG;AAAA,MACH,YAAY;AAAA,MACZ,aAAa,CAAC,UAAU;AACtB,oBAAY,cAAc,KAAK;AAC/B,wBAAgB,IAAI;AAAA,MACtB;AAAA,IACF;AAAA,IACA,CAAC,UAAU;AAAA,EACb;AACA,QAAM,gBAAgB,YAAY,iBAAiB;AACnD,SAAOA,OAAM;AAAA,IACX,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,IAEF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,IAEF;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { omit } from 'lodash';\nimport { useGetGlobalAttributes, useGetXstyledProps, useMemoMergePropsWithDefault } from '@elliemae/ds-utilities';\nimport { uid } from 'uid';\nimport { type DSDropzoneT, DSDropzonePropTypes, defaultProps } from '../react-desc-prop-types.js';\nimport { useValidateProps } from './useValidateProps.js';\n\nexport interface DropzoneCTX {\n propsWithDefault: DSDropzoneT.InternalProps;\n globalProps: ReturnType<typeof useGetGlobalAttributes>;\n xstyledProps: ReturnType<typeof useGetXstyledProps>;\n instanceUid: string;\n}\n\nexport const useDSDropzone = (propsFromUser: DSDropzoneT.Props) => {\n // =============================================================================\n // MERGE WITH DEFAULT AND VALIDATE PROPS\n // =============================================================================\n const propsWithDefault = useMemoMergePropsWithDefault<DSDropzoneT.InternalProps>(propsFromUser, defaultProps);\n useValidateProps(propsWithDefault, DSDropzonePropTypes);\n // =============================================================================\n // GLOBAL ATTRIBUTES & XSTYLED PROPS\n // =============================================================================\n const globalProps = omit(useGetGlobalAttributes<DSDropzoneT.InternalProps>(propsWithDefault), [\n 'cols',\n 'rows',\n 'wrap',\n ]);\n const xstyledProps = useGetXstyledProps(propsWithDefault);\n // =============================================================================\n // AD HOC PER COMPONENT LOGIC\n // =============================================================================\n // custom code goes here, this is an example\n const { id, onDrop } = propsWithDefault;\n const instanceUid = React.useMemo(() => id || uid(5), [id]);\n // =============================================================================\n // HELPERS HOOKS CONFIGS\n // =============================================================================\n const [isDragInside, setIsDragInside] = React.useState(false);\n\n const onBodyDragDropEvent = React.useCallback((e: Event) => {\n e.preventDefault();\n }, []);\n\n /**\n * Prevent default open file in browser\n */\n React.useEffect(() => {\n document.body.addEventListener('drop', onBodyDragDropEvent);\n return () => {\n document.body.removeEventListener('drop', onBodyDragDropEvent);\n };\n }, [onBodyDragDropEvent]);\n\n const onDragEnterHandler: React.DragEventHandler<HTMLDivElement> = React.useCallback((e) => {\n e.preventDefault();\n e.stopPropagation();\n setIsDragInside(true);\n }, []);\n const onDragOverHandler: React.DragEventHandler<HTMLDivElement> = React.useCallback((e) => {\n e.preventDefault();\n e.stopPropagation();\n setIsDragInside(true);\n }, []);\n const onDragLeaveHandler: React.DragEventHandler<HTMLDivElement> = React.useCallback((e) => {\n e.preventDefault();\n e.stopPropagation();\n setIsDragInside(false);\n }, []);\n const onDropHandler: React.DragEventHandler<HTMLDivElement> = React.useCallback(\n (e) => {\n e.preventDefault();\n e.stopPropagation();\n setIsDragInside(false);\n const filesArray = Array.from(e.dataTransfer?.files ?? []);\n onDrop?.(filesArray, e);\n },\n [onDrop],\n );\n\n return React.useMemo(\n () => ({\n propsWithDefault,\n globalProps,\n xstyledProps,\n instanceUid,\n isDragInside,\n onDragEnterHandler,\n onDragOverHandler,\n onDragLeaveHandler,\n onDropHandler,\n // ...eventHandlers,\n }),\n [\n propsWithDefault,\n globalProps,\n xstyledProps,\n instanceUid,\n isDragInside,\n onDragEnterHandler,\n onDragOverHandler,\n onDragLeaveHandler,\n onDropHandler,\n // eventHandlers,\n ],\n );\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,OAAOA,YAAW;AAClB,SAAS,YAAY;AACrB,SAAS,wBAAwB,oBAAoB,oCAAoC;AACzF,SAAS,WAAW;AACpB,SAA2B,qBAAqB,oBAAoB;AACpE,SAAS,wBAAwB;AAS1B,MAAM,gBAAgB,CAAC,kBAAqC;AAIjE,QAAM,mBAAmB,6BAAwD,eAAe,YAAY;AAC5G,mBAAiB,kBAAkB,mBAAmB;AAItD,QAAM,cAAc,KAAK,uBAAkD,gBAAgB,GAAG;AAAA,IAC5F;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACD,QAAM,eAAe,mBAAmB,gBAAgB;AAKxD,QAAM,EAAE,IAAI,OAAO,IAAI;AACvB,QAAM,cAAcA,OAAM,QAAQ,MAAM,MAAM,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;AAI1D,QAAM,CAAC,cAAc,eAAe,IAAIA,OAAM,SAAS,KAAK;AAE5D,QAAM,sBAAsBA,OAAM,YAAY,CAAC,MAAa;AAC1D,MAAE,eAAe;AAAA,EACnB,GAAG,CAAC,CAAC;AAKL,EAAAA,OAAM,UAAU,MAAM;AACpB,aAAS,KAAK,iBAAiB,QAAQ,mBAAmB;AAC1D,WAAO,MAAM;AACX,eAAS,KAAK,oBAAoB,QAAQ,mBAAmB;AAAA,IAC/D;AAAA,EACF,GAAG,CAAC,mBAAmB,CAAC;AAExB,QAAM,qBAA6DA,OAAM,YAAY,CAAC,MAAM;AAC1F,MAAE,eAAe;AACjB,MAAE,gBAAgB;AAClB,oBAAgB,IAAI;AAAA,EACtB,GAAG,CAAC,CAAC;AACL,QAAM,oBAA4DA,OAAM,YAAY,CAAC,MAAM;AACzF,MAAE,eAAe;AACjB,MAAE,gBAAgB;AAClB,oBAAgB,IAAI;AAAA,EACtB,GAAG,CAAC,CAAC;AACL,QAAM,qBAA6DA,OAAM,YAAY,CAAC,MAAM;AAC1F,MAAE,eAAe;AACjB,MAAE,gBAAgB;AAClB,oBAAgB,KAAK;AAAA,EACvB,GAAG,CAAC,CAAC;AACL,QAAM,gBAAwDA,OAAM;AAAA,IAClE,CAAC,MAAM;AACL,QAAE,eAAe;AACjB,QAAE,gBAAgB;AAClB,sBAAgB,KAAK;AACrB,YAAM,aAAa,MAAM,KAAK,EAAE,cAAc,SAAS,CAAC,CAAC;AACzD,eAAS,YAAY,CAAC;AAAA,IACxB;AAAA,IACA,CAAC,MAAM;AAAA,EACT;AAEA,SAAOA,OAAM;AAAA,IACX,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,IAEF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,IAEF;AAAA,EACF;AACF;",
6
6
  "names": ["React"]
7
7
  }
@@ -9,7 +9,8 @@ const DROPZONE_SLOTS = {
9
9
  ACTIVEZONE_LABEL: "activezone-label",
10
10
  ACTIVEZONE_ICON: "activezone-icon",
11
11
  ACTIVEZONE_WRAPPER: "activezone-wrapper",
12
- WRAPPER: "wrapper"
12
+ WRAPPER: "wrapper",
13
+ WRAPPER_HOLDER: "wrapper_holder"
13
14
  };
14
15
  const DROPZONE_DATA_TESTID = slotObjectToDataTestIds(DSDropzoneName, DROPZONE_SLOTS);
15
16
  export {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/constants/index.ts"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { slotObjectToDataTestIds } from '@elliemae/ds-system';\n\nexport const DSDropzoneName = 'DSDropzone';\n\nexport const DROP_ZONE_CONSTANTS = {\n BORDER_WIDTH: 1,\n BORDER_RADIUS: 2,\n} as const;\n\n// we are giving \"component_name_slots\" to avoid errors on duplicate exports variables in aggregators\nexport const DROPZONE_SLOTS = {\n ACTIVEZONE_LABEL: 'activezone-label',\n ACTIVEZONE_ICON: 'activezone-icon',\n ACTIVEZONE_WRAPPER: 'activezone-wrapper',\n WRAPPER: 'wrapper',\n} as const;\n\n// we are giving \"component_name_data_testid\" to avoid errors on duplicate exports variables in aggregators\nexport const DROPZONE_DATA_TESTID = slotObjectToDataTestIds(DSDropzoneName, DROPZONE_SLOTS);\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,+BAA+B;AAEjC,MAAM,iBAAiB;AAEvB,MAAM,sBAAsB;AAAA,EACjC,cAAc;AAAA,EACd,eAAe;AACjB;AAGO,MAAM,iBAAiB;AAAA,EAC5B,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,oBAAoB;AAAA,EACpB,SAAS;AACX;AAGO,MAAM,uBAAuB,wBAAwB,gBAAgB,cAAc;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { slotObjectToDataTestIds } from '@elliemae/ds-system';\n\nexport const DSDropzoneName = 'DSDropzone';\n\nexport const DROP_ZONE_CONSTANTS = {\n BORDER_WIDTH: 1,\n BORDER_RADIUS: 2,\n} as const;\n\n// we are giving \"component_name_slots\" to avoid errors on duplicate exports variables in aggregators\nexport const DROPZONE_SLOTS = {\n ACTIVEZONE_LABEL: 'activezone-label',\n ACTIVEZONE_ICON: 'activezone-icon',\n ACTIVEZONE_WRAPPER: 'activezone-wrapper',\n WRAPPER: 'wrapper',\n WRAPPER_HOLDER: 'wrapper_holder',\n} as const;\n\n// we are giving \"component_name_data_testid\" to avoid errors on duplicate exports variables in aggregators\nexport const DROPZONE_DATA_TESTID = slotObjectToDataTestIds(DSDropzoneName, DROPZONE_SLOTS);\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,+BAA+B;AAEjC,MAAM,iBAAiB;AAEvB,MAAM,sBAAsB;AAAA,EACjC,cAAc;AAAA,EACd,eAAe;AACjB;AAGO,MAAM,iBAAiB;AAAA,EAC5B,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,oBAAoB;AAAA,EACpB,SAAS;AAAA,EACT,gBAAgB;AAClB;AAGO,MAAM,uBAAuB,wBAAwB,gBAAgB,cAAc;",
6
6
  "names": []
7
7
  }
@@ -8,7 +8,6 @@ import { Grid } from "@elliemae/ds-grid";
8
8
  import { DSTypography } from "@elliemae/ds-typography";
9
9
  import { useActivezone } from "./config/useActivezone.js";
10
10
  import { DROPZONE_SLOTS, DROP_ZONE_CONSTANTS, DSDropzoneName } from "../../constants/index.js";
11
- console.log(DROPZONE_SLOTS);
12
11
  const StyledWrapper = styled(Grid, { name: DSDropzoneName, slot: DROPZONE_SLOTS.ACTIVEZONE_WRAPPER })`
13
12
  cursor: grabbing;
14
13
  position: absolute;
@@ -18,6 +17,7 @@ const StyledWrapper = styled(Grid, { name: DSDropzoneName, slot: DROPZONE_SLOTS.
18
17
  left: 0;
19
18
  width: 100%;
20
19
  height: 100%;
20
+ pointer-events: none;
21
21
  `;
22
22
  const StyledLabel = styled(DSTypography, { name: DSDropzoneName, slot: DROPZONE_SLOTS.ACTIVEZONE_LABEL })``;
23
23
  const StyledIcon = styled(Grid, { name: DSDropzoneName, slot: DROPZONE_SLOTS.ACTIVEZONE_ICON })``;
@@ -43,7 +43,7 @@ const DSActivezone = (props) => {
43
43
  ...globalProps,
44
44
  ...xstyledProps,
45
45
  children: [
46
- /* @__PURE__ */ jsx(StyledIcon, { justifyContent: "center", children: /* @__PURE__ */ jsx(Icon, { size: "l", color: "neutral-000" }) }),
46
+ /* @__PURE__ */ jsx(StyledIcon, { justifyContent: "center", children: /* @__PURE__ */ jsx(Icon, { size: "l", color: ["neutral", "0"] }) }),
47
47
  /* @__PURE__ */ jsx(StyledLabel, { variant: "b2", color: "neutral-000", children: label })
48
48
  ]
49
49
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/DSActivezone/DSActivezone.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport { useFontsizeMedia } from '@elliemae/ds-hooks-fontsize-media';\nimport { type DSActivezoneT, DSActivezonePropTypesSchema } from './react-desc-prop-types.js';\nimport { styled } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\nimport { DSTypography } from '@elliemae/ds-typography';\nimport { useActivezone } from './config/useActivezone.js';\nimport { DROPZONE_SLOTS, DROP_ZONE_CONSTANTS, DSDropzoneName } from '../../constants/index.js';\n\nconsole.log(DROPZONE_SLOTS);\n\nconst StyledWrapper = styled(Grid, { name: DSDropzoneName, slot: DROPZONE_SLOTS.ACTIVEZONE_WRAPPER })`\n cursor: grabbing;\n position: absolute;\n border-radius: ${DROP_ZONE_CONSTANTS.BORDER_RADIUS}px;\n padding: ${(props) => props.theme.space.xxxs} 1.8461538461538463rem;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n`;\nconst StyledLabel = styled(DSTypography, { name: DSDropzoneName, slot: DROPZONE_SLOTS.ACTIVEZONE_LABEL })``;\nconst StyledIcon = styled(Grid, { name: DSDropzoneName, slot: DROPZONE_SLOTS.ACTIVEZONE_ICON })``;\n\nconst colsDef = {\n largeFont: ['auto'],\n mediumFont: ['auto', 'auto'],\n smallFont: ['auto', 'auto'],\n};\n\nconst DSActivezone: React.ComponentType<DSActivezoneT.Props> = (props) => {\n const { propsWithDefault, globalProps, xstyledProps } = useActivezone(props);\n const { Icon, label } = propsWithDefault;\n const mainContentCols = useFontsizeMedia(colsDef);\n return (\n <StyledWrapper\n rows={['auto']}\n justifyContent=\"center\"\n alignItems=\"center\"\n bg=\"brand-600\"\n gutter=\"xxs\"\n cols={mainContentCols}\n getOwnerProps={() => propsWithDefault}\n {...globalProps}\n {...xstyledProps}\n >\n <StyledIcon justifyContent=\"center\">\n <Icon size=\"l\" color=\"neutral-000\" />\n </StyledIcon>\n <StyledLabel variant=\"b2\" color=\"neutral-000\">\n {label}\n </StyledLabel>\n </StyledWrapper>\n );\n};\n\nDSActivezone.displayName = 'DSActivezone';\nconst DSActivezoneWithSchema = describe(DSActivezone);\nDSActivezoneWithSchema.propTypes = DSActivezonePropTypesSchema;\n\nexport { DSActivezone, DSActivezoneWithSchema };\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACoCnB,SAYI,KAZJ;AAnCJ,SAAS,gBAAgB;AACzB,SAAS,wBAAwB;AACjC,SAA6B,mCAAmC;AAChE,SAAS,cAAc;AACvB,SAAS,YAAY;AACrB,SAAS,oBAAoB;AAC7B,SAAS,qBAAqB;AAC9B,SAAS,gBAAgB,qBAAqB,sBAAsB;AAEpE,QAAQ,IAAI,cAAc;AAE1B,MAAM,gBAAgB,OAAO,MAAM,EAAE,MAAM,gBAAgB,MAAM,eAAe,mBAAmB,CAAC;AAAA;AAAA;AAAA,mBAGjF,oBAAoB;AAAA,aAC1B,CAAC,UAAU,MAAM,MAAM,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAM1C,MAAM,cAAc,OAAO,cAAc,EAAE,MAAM,gBAAgB,MAAM,eAAe,iBAAiB,CAAC;AACxG,MAAM,aAAa,OAAO,MAAM,EAAE,MAAM,gBAAgB,MAAM,eAAe,gBAAgB,CAAC;AAE9F,MAAM,UAAU;AAAA,EACd,WAAW,CAAC,MAAM;AAAA,EAClB,YAAY,CAAC,QAAQ,MAAM;AAAA,EAC3B,WAAW,CAAC,QAAQ,MAAM;AAC5B;AAEA,MAAM,eAAyD,CAAC,UAAU;AACxE,QAAM,EAAE,kBAAkB,aAAa,aAAa,IAAI,cAAc,KAAK;AAC3E,QAAM,EAAE,MAAM,MAAM,IAAI;AACxB,QAAM,kBAAkB,iBAAiB,OAAO;AAChD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAM,CAAC,MAAM;AAAA,MACb,gBAAe;AAAA,MACf,YAAW;AAAA,MACX,IAAG;AAAA,MACH,QAAO;AAAA,MACP,MAAM;AAAA,MACN,eAAe,MAAM;AAAA,MACpB,GAAG;AAAA,MACH,GAAG;AAAA,MAEJ;AAAA,4BAAC,cAAW,gBAAe,UACzB,8BAAC,QAAK,MAAK,KAAI,OAAM,eAAc,GACrC;AAAA,QACA,oBAAC,eAAY,SAAQ,MAAK,OAAM,eAC7B,iBACH;AAAA;AAAA;AAAA,EACF;AAEJ;AAEA,aAAa,cAAc;AAC3B,MAAM,yBAAyB,SAAS,YAAY;AACpD,uBAAuB,YAAY;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport { useFontsizeMedia } from '@elliemae/ds-hooks-fontsize-media';\nimport { type DSActivezoneT, DSActivezonePropTypesSchema } from './react-desc-prop-types.js';\nimport { styled } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\nimport { DSTypography } from '@elliemae/ds-typography';\nimport { useActivezone } from './config/useActivezone.js';\nimport { DROPZONE_SLOTS, DROP_ZONE_CONSTANTS, DSDropzoneName } from '../../constants/index.js';\n\nconst StyledWrapper = styled(Grid, { name: DSDropzoneName, slot: DROPZONE_SLOTS.ACTIVEZONE_WRAPPER })`\n cursor: grabbing;\n position: absolute;\n border-radius: ${DROP_ZONE_CONSTANTS.BORDER_RADIUS}px;\n padding: ${(props) => props.theme.space.xxxs} 1.8461538461538463rem;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n`;\nconst StyledLabel = styled(DSTypography, { name: DSDropzoneName, slot: DROPZONE_SLOTS.ACTIVEZONE_LABEL })``;\nconst StyledIcon = styled(Grid, { name: DSDropzoneName, slot: DROPZONE_SLOTS.ACTIVEZONE_ICON })``;\n\nconst colsDef = {\n largeFont: ['auto'],\n mediumFont: ['auto', 'auto'],\n smallFont: ['auto', 'auto'],\n};\n\nconst DSActivezone: React.ComponentType<DSActivezoneT.Props> = (props) => {\n const { propsWithDefault, globalProps, xstyledProps } = useActivezone(props);\n const { Icon, label } = propsWithDefault;\n const mainContentCols = useFontsizeMedia(colsDef);\n return (\n <StyledWrapper\n rows={['auto']}\n justifyContent=\"center\"\n alignItems=\"center\"\n bg=\"brand-600\"\n gutter=\"xxs\"\n cols={mainContentCols}\n getOwnerProps={() => propsWithDefault}\n {...globalProps}\n {...xstyledProps}\n >\n <StyledIcon justifyContent=\"center\">\n <Icon size=\"l\" color={['neutral', '0']} />\n </StyledIcon>\n <StyledLabel variant=\"b2\" color=\"neutral-000\">\n {label}\n </StyledLabel>\n </StyledWrapper>\n );\n};\n\nDSActivezone.displayName = 'DSActivezone';\nconst DSActivezoneWithSchema = describe(DSActivezone);\nDSActivezoneWithSchema.propTypes = DSActivezonePropTypesSchema;\n\nexport { DSActivezone, DSActivezoneWithSchema };\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACmCnB,SAYI,KAZJ;AAlCJ,SAAS,gBAAgB;AACzB,SAAS,wBAAwB;AACjC,SAA6B,mCAAmC;AAChE,SAAS,cAAc;AACvB,SAAS,YAAY;AACrB,SAAS,oBAAoB;AAC7B,SAAS,qBAAqB;AAC9B,SAAS,gBAAgB,qBAAqB,sBAAsB;AAEpE,MAAM,gBAAgB,OAAO,MAAM,EAAE,MAAM,gBAAgB,MAAM,eAAe,mBAAmB,CAAC;AAAA;AAAA;AAAA,mBAGjF,oBAAoB;AAAA,aAC1B,CAAC,UAAU,MAAM,MAAM,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAO1C,MAAM,cAAc,OAAO,cAAc,EAAE,MAAM,gBAAgB,MAAM,eAAe,iBAAiB,CAAC;AACxG,MAAM,aAAa,OAAO,MAAM,EAAE,MAAM,gBAAgB,MAAM,eAAe,gBAAgB,CAAC;AAE9F,MAAM,UAAU;AAAA,EACd,WAAW,CAAC,MAAM;AAAA,EAClB,YAAY,CAAC,QAAQ,MAAM;AAAA,EAC3B,WAAW,CAAC,QAAQ,MAAM;AAC5B;AAEA,MAAM,eAAyD,CAAC,UAAU;AACxE,QAAM,EAAE,kBAAkB,aAAa,aAAa,IAAI,cAAc,KAAK;AAC3E,QAAM,EAAE,MAAM,MAAM,IAAI;AACxB,QAAM,kBAAkB,iBAAiB,OAAO;AAChD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAM,CAAC,MAAM;AAAA,MACb,gBAAe;AAAA,MACf,YAAW;AAAA,MACX,IAAG;AAAA,MACH,QAAO;AAAA,MACP,MAAM;AAAA,MACN,eAAe,MAAM;AAAA,MACpB,GAAG;AAAA,MACH,GAAG;AAAA,MAEJ;AAAA,4BAAC,cAAW,gBAAe,UACzB,8BAAC,QAAK,MAAK,KAAI,OAAO,CAAC,WAAW,GAAG,GAAG,GAC1C;AAAA,QACA,oBAAC,eAAY,SAAQ,MAAK,OAAM,eAC7B,iBACH;AAAA;AAAA;AAAA,EACF;AAEJ;AAEA,aAAa,cAAc;AAC3B,MAAM,yBAAyB,SAAS,YAAY;AACpD,uBAAuB,YAAY;",
6
6
  "names": []
7
7
  }
@@ -7,86 +7,16 @@ const DSDropzonePropTypes = {
7
7
  ...globalAttributesPropTypes,
8
8
  ...xstyledPropTypes,
9
9
  children: PropTypes.any,
10
+ disabled: PropTypes.bool.description("Enable/disable the dropzone"),
10
11
  hasError: PropTypes.bool.description("Show error border color"),
11
- dropConfig: PropTypes.shape({
12
- accept: PropTypes.objectOf(PropTypes.arrayOf(PropTypes.string)).description(`
13
- Set accepted file types.
14
- Checkout https://developer.mozilla.org/en-US/docs/Web/API/window/showOpenFilePicker types option for more information.
15
- Keep in mind that mime type determination is not reliable across platforms. CSV files,
16
- for example, are reported as text/plain under macOS but as application/vnd.ms-excel under
17
- Windows. In some cases there might not be a mime type set at all (https://github.com/react-dropzone/react-dropzone/issues/276).
18
- `),
19
- multiple: PropTypes.bool.description("Allow drag 'n' drop (or selection from the file dialog) of multiple files"),
20
- preventDropOnDocument: PropTypes.bool.description(
21
- "If false, allow dropped items to take over the current browser window"
22
- ),
23
- noClick: PropTypes.bool.description("If true, disables click to open the native file selection dialog"),
24
- noKeyboard: PropTypes.bool.description(`
25
- If true, disables SPACE/ENTER to open the native file selection dialog.
26
- Note that it also stops tracking the focus state.`),
27
- noDrag: PropTypes.bool.description("If true, disables drag&drop"),
28
- noDragEventsBubbling: PropTypes.bool.description("If true, stops drag event propagation to parents"),
29
- minSize: PropTypes.number.description("Minimum file size (in bytes)"),
30
- maxSize: PropTypes.number.description("Maximum file size (in bytes)"),
31
- maxFiles: PropTypes.number.description(`
32
- Maximum accepted number of files
33
- The default value is 0 which means there is no limitation to how many files are accepted.
34
- `),
35
- disabled: PropTypes.bool.description("Enable/disable the dropzone"),
36
- getFilesFromEvent: PropTypes.func.description(`
37
- Use this to provide a custom file aggregator
38
- @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
39
- `),
40
- onFileDialogCancel: PropTypes.func.description("Cb for when closing the file dialog with no selection"),
41
- onFileDialogOpen: PropTypes.func.description("Cb for when opening the file dialog"),
42
- useFsAccessApi: PropTypes.bool.description(`
43
- Set to true to use the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API
44
- to open the file picker instead of using an <input type="file"> click event.
45
- `),
46
- onDragEnter: PropTypes.func.description(`
47
- Cb for when the dragenter event occurs.
48
- @param {DragEvent} event`),
49
- onDragLeave: PropTypes.func.description(`
50
- Cb for when the dragleave event occurs
51
- @param {DragEvent} event
52
- `),
53
- onDragOver: PropTypes.func.description(`
54
- Cb for when the dragover event occurs
55
- @param {DragEvent} event
56
- `),
57
- onDrop: PropTypes.func.description(`
58
- Cb for when the drop event occurs.
59
- 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.
60
- For example, with [SuperAgent](https://github.com/visionmedia/superagent) as a http/ajax library:
61
- @param {File[]} acceptedFiles
62
- @param {FileRejection[]} fileRejections
63
- @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
64
- `),
65
- onDropAccepted: PropTypes.func.description(`
12
+ onDrop: PropTypes.func.description(
13
+ `
66
14
  Cb for when the drop event occurs.
67
- Note that if no files are accepted, this callback is not invoked.
15
+ 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.
68
16
  @param {File[]} files
69
- @param {(DragEvent|Event)} event
70
- `),
71
- onDropRejected: PropTypes.func.description(`
72
- Cb for when the drop event occurs.
73
- Note that if no files are rejected, this callback is not invoked.
74
- @param {FileRejection[]} fileRejections
75
- @param {(DragEvent|Event)} event
76
- `),
77
- onError: PropTypes.func.description(`
78
- Cb for when there's some error from any of the promises.
79
- @param {Error} error
80
- `),
81
- validator: PropTypes.func.description(`
82
- Custom validation function. It must return null if there's no errors.
83
- @param {File} file
84
- @returns {FileError|FileError[]|null}
85
- `)
86
- }).description(`react-dropzone options, see https://react-dropzone.js.org/ for more information V14.2.3`).defaultValue({})
87
- // onSomethingEvent: PropTypes.func
88
- // .description('some example of function, required if something is not foo')
89
- // .signature('(( newVal: string, e: React.SyntheticEvent, metaInfo: Record<string,unknown> ) => void )'),
17
+ @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
18
+ `
19
+ ).signature("(( file: File[], event: React.DragEvent ) => void )")
90
20
  };
91
21
  const DSDropzonePropTypesSchema = DSDropzonePropTypes;
92
22
  export {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/react-desc-prop-types.ts"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-empty-interface */\nimport type { GlobalAttributesT, XstyledProps, DSPropTypesSchema } from '@elliemae/ds-props-helpers';\nimport { PropTypes, globalAttributesPropTypes, xstyledPropTypes } from '@elliemae/ds-props-helpers';\nimport type { DropzoneOptions } from 'react-dropzone';\nimport type { WeakValidationMap } from 'react';\n\nexport declare namespace DSDropzoneT {\n export interface RequiredProps {}\n\n export interface DefaultProps {}\n\n export interface OptionalProps {\n dropConfig?: DropzoneOptions;\n hasError?: boolean;\n }\n\n export interface Props\n extends Partial<DefaultProps>,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof OptionalProps | keyof XstyledProps>,\n XstyledProps,\n RequiredProps {}\n\n export interface InternalProps\n extends DefaultProps,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof OptionalProps | keyof XstyledProps>,\n XstyledProps,\n RequiredProps {}\n\n export type ExampleState = '0' | '1';\n}\n\nexport const defaultProps: DSDropzoneT.DefaultProps = {\n dropConfig: {},\n};\n\nexport const DSDropzonePropTypes: DSPropTypesSchema<DSDropzoneT.Props> = {\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n children: PropTypes.any,\n hasError: PropTypes.bool.description('Show error border color'),\n dropConfig: PropTypes.shape({\n accept: PropTypes.objectOf(PropTypes.arrayOf(PropTypes.string)).description(`\n Set accepted file types.\n Checkout https://developer.mozilla.org/en-US/docs/Web/API/window/showOpenFilePicker types option for more information.\n Keep in mind that mime type determination is not reliable across platforms. CSV files,\n for example, are reported as text/plain under macOS but as application/vnd.ms-excel under\n Windows. In some cases there might not be a mime type set at all (https://github.com/react-dropzone/react-dropzone/issues/276).\n `),\n multiple: PropTypes.bool.description(\"Allow drag 'n' drop (or selection from the file dialog) of multiple files\"),\n\n preventDropOnDocument: PropTypes.bool.description(\n 'If false, allow dropped items to take over the current browser window',\n ),\n noClick: PropTypes.bool.description('If true, disables click to open the native file selection dialog'),\n noKeyboard: PropTypes.bool.description(`\n If true, disables SPACE/ENTER to open the native file selection dialog.\n Note that it also stops tracking the focus state.`),\n noDrag: PropTypes.bool.description('If true, disables drag&drop'),\n noDragEventsBubbling: PropTypes.bool.description('If true, stops drag event propagation to parents'),\n minSize: PropTypes.number.description('Minimum file size (in bytes)'),\n maxSize: PropTypes.number.description('Maximum file size (in bytes)'),\n maxFiles: PropTypes.number.description(`\n Maximum accepted number of files\n The default value is 0 which means there is no limitation to how many files are accepted.\n `),\n disabled: PropTypes.bool.description('Enable/disable the dropzone'),\n getFilesFromEvent: PropTypes.func.description(`\n Use this to provide a custom file aggregator\n @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)\n `),\n onFileDialogCancel: PropTypes.func.description('Cb for when closing the file dialog with no selection'),\n onFileDialogOpen: PropTypes.func.description('Cb for when opening the file dialog'),\n useFsAccessApi: PropTypes.bool.description(`\n Set to true to use the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API\n to open the file picker instead of using an <input type=\"file\"> click event.\n `),\n onDragEnter: PropTypes.func.description(`\n Cb for when the dragenter event occurs.\n @param {DragEvent} event`),\n onDragLeave: PropTypes.func.description(`\n Cb for when the dragleave event occurs\n @param {DragEvent} event\n `),\n onDragOver: PropTypes.func.description(`\n Cb for when the dragover event occurs\n @param {DragEvent} event\n `),\n onDrop: PropTypes.func.description(`\n Cb for when the drop event occurs.\n 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.\n For example, with [SuperAgent](https://github.com/visionmedia/superagent) as a http/ajax library: \n @param {File[]} acceptedFiles\n @param {FileRejection[]} fileRejections\n @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)\n `),\n onDropAccepted: PropTypes.func.description(`\n Cb for when the drop event occurs.\n Note that if no files are accepted, this callback is not invoked.\n @param {File[]} files\n @param {(DragEvent|Event)} event\n `),\n onDropRejected: PropTypes.func.description(`\n Cb for when the drop event occurs.\n Note that if no files are rejected, this callback is not invoked. \n @param {FileRejection[]} fileRejections\n @param {(DragEvent|Event)} event\n `),\n onError: PropTypes.func.description(`\n Cb for when there's some error from any of the promises.\n @param {Error} error\n `),\n validator: PropTypes.func.description(`\n Custom validation function. It must return null if there's no errors.\n @param {File} file\n @returns {FileError|FileError[]|null}\n `),\n })\n .description(`react-dropzone options, see https://react-dropzone.js.org/ for more information V14.2.3`)\n .defaultValue({}),\n // onSomethingEvent: PropTypes.func\n // .description('some example of function, required if something is not foo')\n // .signature('(( newVal: string, e: React.SyntheticEvent, metaInfo: Record<string,unknown> ) => void )'),\n};\n\nexport const DSDropzonePropTypesSchema = DSDropzonePropTypes as unknown as WeakValidationMap<DSDropzoneT.Props>;\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACEvB,SAAS,WAAW,2BAA2B,wBAAwB;AA+BhE,MAAM,eAAyC;AAAA,EACpD,YAAY,CAAC;AACf;AAEO,MAAM,sBAA4D;AAAA,EACvE,GAAG;AAAA,EACH,GAAG;AAAA,EACH,UAAU,UAAU;AAAA,EACpB,UAAU,UAAU,KAAK,YAAY,yBAAyB;AAAA,EAC9D,YAAY,UAAU,MAAM;AAAA,IAC1B,QAAQ,UAAU,SAAS,UAAU,QAAQ,UAAU,MAAM,CAAC,EAAE,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAM7E;AAAA,IACC,UAAU,UAAU,KAAK,YAAY,2EAA2E;AAAA,IAEhH,uBAAuB,UAAU,KAAK;AAAA,MACpC;AAAA,IACF;AAAA,IACA,SAAS,UAAU,KAAK,YAAY,kEAAkE;AAAA,IACtG,YAAY,UAAU,KAAK,YAAY;AAAA;AAAA,oDAES;AAAA,IAChD,QAAQ,UAAU,KAAK,YAAY,6BAA6B;AAAA,IAChE,sBAAsB,UAAU,KAAK,YAAY,kDAAkD;AAAA,IACnG,SAAS,UAAU,OAAO,YAAY,8BAA8B;AAAA,IACpE,SAAS,UAAU,OAAO,YAAY,8BAA8B;AAAA,IACpE,UAAU,UAAU,OAAO,YAAY;AAAA;AAAA;AAAA,GAGxC;AAAA,IACC,UAAU,UAAU,KAAK,YAAY,6BAA6B;AAAA,IAClE,mBAAmB,UAAU,KAAK,YAAY;AAAA;AAAA;AAAA,GAG/C;AAAA,IACC,oBAAoB,UAAU,KAAK,YAAY,uDAAuD;AAAA,IACtG,kBAAkB,UAAU,KAAK,YAAY,qCAAqC;AAAA,IAClF,gBAAgB,UAAU,KAAK,YAAY;AAAA;AAAA;AAAA,GAG5C;AAAA,IACC,aAAa,UAAU,KAAK,YAAY;AAAA;AAAA,2BAEjB;AAAA,IACvB,aAAa,UAAU,KAAK,YAAY;AAAA;AAAA;AAAA,GAGzC;AAAA,IACC,YAAY,UAAU,KAAK,YAAY;AAAA;AAAA;AAAA,GAGxC;AAAA,IACC,QAAQ,UAAU,KAAK,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAOpC;AAAA,IACC,gBAAgB,UAAU,KAAK,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA,GAK5C;AAAA,IACC,gBAAgB,UAAU,KAAK,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA,GAK5C;AAAA,IACC,SAAS,UAAU,KAAK,YAAY;AAAA;AAAA;AAAA,GAGrC;AAAA,IACC,WAAW,UAAU,KAAK,YAAY;AAAA;AAAA;AAAA;AAAA,KAIrC;AAAA,EACH,CAAC,EACE,YAAY,yFAAyF,EACrG,aAAa,CAAC,CAAC;AAAA;AAAA;AAAA;AAIpB;AAEO,MAAM,4BAA4B;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-empty-interface */\nimport type { GlobalAttributesT, XstyledProps, DSPropTypesSchema } from '@elliemae/ds-props-helpers';\nimport { PropTypes, globalAttributesPropTypes, xstyledPropTypes } from '@elliemae/ds-props-helpers';\nimport type { WeakValidationMap } from 'react';\n\nexport declare namespace DSDropzoneT {\n export interface RequiredProps {}\n\n export interface DefaultProps {}\n\n export interface OptionalProps {\n onDrop?: (files: File[], event: React.DragEvent<HTMLDivElement>) => void;\n hasError?: boolean;\n }\n\n export interface Props\n extends Partial<DefaultProps>,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof OptionalProps | keyof XstyledProps>,\n XstyledProps,\n RequiredProps {}\n\n export interface InternalProps\n extends DefaultProps,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof OptionalProps | keyof XstyledProps>,\n XstyledProps,\n RequiredProps {}\n\n export type ExampleState = '0' | '1';\n}\n\nexport const defaultProps: DSDropzoneT.DefaultProps = {\n dropConfig: {},\n};\n\nexport const DSDropzonePropTypes: DSPropTypesSchema<DSDropzoneT.Props> = {\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n children: PropTypes.any,\n disabled: PropTypes.bool.description('Enable/disable the dropzone'),\n hasError: PropTypes.bool.description('Show error border color'),\n onDrop: PropTypes.func\n .description(\n `\n Cb for when the drop event occurs.\n 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.\n @param {File[]} files\n @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)\n `,\n )\n .signature('(( file: File[], event: React.DragEvent ) => void )'),\n};\n\nexport const DSDropzonePropTypesSchema = DSDropzonePropTypes as unknown as WeakValidationMap<DSDropzoneT.Props>;\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACEvB,SAAS,WAAW,2BAA2B,wBAAwB;AA8BhE,MAAM,eAAyC;AAAA,EACpD,YAAY,CAAC;AACf;AAEO,MAAM,sBAA4D;AAAA,EACvE,GAAG;AAAA,EACH,GAAG;AAAA,EACH,UAAU,UAAU;AAAA,EACpB,UAAU,UAAU,KAAK,YAAY,6BAA6B;AAAA,EAClE,UAAU,UAAU,KAAK,YAAY,yBAAyB;AAAA,EAC9D,QAAQ,UAAU,KACf;AAAA,IACC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMF,EACC,UAAU,qDAAqD;AACpE;AAEO,MAAM,4BAA4B;",
6
6
  "names": []
7
7
  }
@@ -3,10 +3,14 @@ import { styled } from "@elliemae/ds-system";
3
3
  import { Grid } from "@elliemae/ds-grid";
4
4
  import { DROPZONE_SLOTS, DROP_ZONE_CONSTANTS, DSDropzoneName } from "./constants/index.js";
5
5
  const borderImage = (color) => `url("data:image/svg+xml,%3csvg aria-hidden='true' width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='${DROP_ZONE_CONSTANTS.BORDER_RADIUS}' ry='${DROP_ZONE_CONSTANTS.BORDER_RADIUS}' stroke='${encodeURIComponent(color)}' stroke-width='${DROP_ZONE_CONSTANTS.BORDER_WIDTH}' stroke-dasharray='4 6' stroke-dashoffset='0' stroke-linecap='round'/%3e%3c/svg%3e")`;
6
- const StyledDropZone = styled(Grid, { name: DSDropzoneName, slot: DROPZONE_SLOTS.WRAPPER })`
6
+ const StyledDropZoneHolder = styled(Grid, {
7
+ name: DSDropzoneName,
8
+ slot: DROPZONE_SLOTS.WRAPPER_HOLDER
9
+ })`
7
10
  position: relative;
11
+ `;
12
+ const StyledDropZone = styled(Grid, { name: DSDropzoneName, slot: DROPZONE_SLOTS.WRAPPER })`
8
13
  border-radius: ${DROP_ZONE_CONSTANTS.BORDER_RADIUS}px;
9
-
10
14
  background-color: ${(props) => props.theme.colors.neutral["000"]};
11
15
  background-image: ${(props) => {
12
16
  if (props.disabled) {
@@ -15,12 +19,9 @@ const StyledDropZone = styled(Grid, { name: DSDropzoneName, slot: DROPZONE_SLOTS
15
19
  if (props.isDragActive) {
16
20
  return borderImage(props.theme.colors.brand[600]);
17
21
  }
18
- if (props.isDragReject || props.hasError) {
22
+ if (props.hasError) {
19
23
  return borderImage(props.theme.colors.danger[900]);
20
24
  }
21
- if (props.isFocused) {
22
- return borderImage(props.theme.colors.brand[600]);
23
- }
24
25
  return borderImage(props.theme.colors.neutral[400]);
25
26
  }};
26
27
  padding: ${(props) => props.theme.space.xs} 1.8461538461538463rem;
@@ -32,17 +33,16 @@ const StyledDropZone = styled(Grid, { name: DSDropzoneName, slot: DROPZONE_SLOTS
32
33
  if (props.isDragActive) {
33
34
  return borderImage(props.theme.colors.brand[600]);
34
35
  }
35
- if (props.isDragReject) {
36
+ if (props.hasError) {
36
37
  return borderImage(props.theme.colors.danger[900]);
37
38
  }
38
- if (props.isFocused) {
39
- return borderImage(props.theme.colors.brand[600]);
40
- }
41
39
  return borderImage(props.theme.colors.brand[600]);
42
40
  }};
43
41
  }
42
+ cursor: ${(props) => props.isDragActive ? "grabbing" : "default"};
44
43
  `;
45
44
  export {
46
- StyledDropZone
45
+ StyledDropZone,
46
+ StyledDropZoneHolder
47
47
  };
48
48
  //# sourceMappingURL=styled.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/styled.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { styled } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\nimport { DROPZONE_SLOTS, DROP_ZONE_CONSTANTS, DSDropzoneName } from './constants/index.js';\nimport type { DropzoneState } from 'react-dropzone';\n\n// const borderImageCreator = (color: any, stroke: number) =>\n// encodeURIComponent(\n// `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"100%\" height=\"100%\"><rect width=\"100%\" height=\"100%\" fill=\"none\" rx=\"8\" ry=\"8\" stroke=\"${color}\" stroke-width=\"${stroke}\" stroke-dasharray=\"6, 14\" stroke-dashoffset=\"0\" stroke-linecap=\"square\"/></svg>`,\n// );\n\n// const handleBorder = (props: StyledProps<DSDropzoneT.InternalProps>): string => {\n// const { isDragAccept, isDragReject, isFocused } = props;\n// console.log(props);\n// if (isDragAccept) return borderImageCreator(props.theme.colors.brand[600], 2);\n// if (isDragReject) return borderImageCreator(props.theme.colors.danger[900], 2);\n// return borderImageCreator(props.theme.colors.neutral[400], 2);\n// };\n\nconst borderImage = (color: string) =>\n `url(\"data:image/svg+xml,%3csvg aria-hidden='true' width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='${\n DROP_ZONE_CONSTANTS.BORDER_RADIUS\n }' ry='${DROP_ZONE_CONSTANTS.BORDER_RADIUS}' stroke='${encodeURIComponent(color)}' stroke-width='${\n DROP_ZONE_CONSTANTS.BORDER_WIDTH\n }' stroke-dasharray='4 6' stroke-dashoffset='0' stroke-linecap='round'/%3e%3c/svg%3e\")`;\n\nexport const StyledDropZone = styled(Grid, { name: DSDropzoneName, slot: DROPZONE_SLOTS.WRAPPER })<\n DropzoneState & {\n disabled: boolean;\n hasError: boolean;\n }\n>`\n position: relative;\n border-radius: ${DROP_ZONE_CONSTANTS.BORDER_RADIUS}px;\n\n background-color: ${(props) => props.theme.colors.neutral['000']};\n background-image: ${(props) => {\n if (props.disabled) {\n return borderImage(props.theme.colors.neutral[400]);\n }\n if (props.isDragActive) {\n return borderImage(props.theme.colors.brand[600]);\n }\n if (props.isDragReject || props.hasError) {\n return borderImage(props.theme.colors.danger[900]);\n }\n if (props.isFocused) {\n return borderImage(props.theme.colors.brand[600]);\n }\n return borderImage(props.theme.colors.neutral[400]);\n }};\n padding: ${(props) => props.theme.space.xs} 1.8461538461538463rem;\n &:hover {\n background-image: ${(props) => {\n if (props.disabled) {\n return borderImage(props.theme.colors.neutral[400]);\n }\n if (props.isDragActive) {\n return borderImage(props.theme.colors.brand[600]);\n }\n if (props.isDragReject) {\n return borderImage(props.theme.colors.danger[900]);\n }\n if (props.isFocused) {\n return borderImage(props.theme.colors.brand[600]);\n }\n return borderImage(props.theme.colors.brand[600]);\n }};\n }\n`;\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,cAAc;AACvB,SAAS,YAAY;AACrB,SAAS,gBAAgB,qBAAqB,sBAAsB;AAgBpE,MAAM,cAAc,CAAC,UACnB,gLACE,oBAAoB,sBACb,oBAAoB,0BAA0B,mBAAmB,KAAK,oBAC7E,oBAAoB;AAGjB,MAAM,iBAAiB,OAAO,MAAM,EAAE,MAAM,gBAAgB,MAAM,eAAe,QAAQ,CAAC;AAAA;AAAA,mBAO9E,oBAAoB;AAAA;AAAA,sBAEjB,CAAC,UAAU,MAAM,MAAM,OAAO,QAAQ,KAAK;AAAA,sBAC3C,CAAC,UAAU;AAC7B,MAAI,MAAM,UAAU;AAClB,WAAO,YAAY,MAAM,MAAM,OAAO,QAAQ,GAAG,CAAC;AAAA,EACpD;AACA,MAAI,MAAM,cAAc;AACtB,WAAO,YAAY,MAAM,MAAM,OAAO,MAAM,GAAG,CAAC;AAAA,EAClD;AACA,MAAI,MAAM,gBAAgB,MAAM,UAAU;AACxC,WAAO,YAAY,MAAM,MAAM,OAAO,OAAO,GAAG,CAAC;AAAA,EACnD;AACA,MAAI,MAAM,WAAW;AACnB,WAAO,YAAY,MAAM,MAAM,OAAO,MAAM,GAAG,CAAC;AAAA,EAClD;AACA,SAAO,YAAY,MAAM,MAAM,OAAO,QAAQ,GAAG,CAAC;AACpD;AAAA,aACW,CAAC,UAAU,MAAM,MAAM,MAAM;AAAA;AAAA,wBAElB,CAAC,UAAU;AAC7B,MAAI,MAAM,UAAU;AAClB,WAAO,YAAY,MAAM,MAAM,OAAO,QAAQ,GAAG,CAAC;AAAA,EACpD;AACA,MAAI,MAAM,cAAc;AACtB,WAAO,YAAY,MAAM,MAAM,OAAO,MAAM,GAAG,CAAC;AAAA,EAClD;AACA,MAAI,MAAM,cAAc;AACtB,WAAO,YAAY,MAAM,MAAM,OAAO,OAAO,GAAG,CAAC;AAAA,EACnD;AACA,MAAI,MAAM,WAAW;AACnB,WAAO,YAAY,MAAM,MAAM,OAAO,MAAM,GAAG,CAAC;AAAA,EAClD;AACA,SAAO,YAAY,MAAM,MAAM,OAAO,MAAM,GAAG,CAAC;AAClD;AAAA;AAAA;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type {} from '@elliemae/ds-system';\nimport { styled } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\nimport { DROPZONE_SLOTS, DROP_ZONE_CONSTANTS, DSDropzoneName } from './constants/index.js';\n\n// const borderImageCreator = (color: any, stroke: number) =>\n// encodeURIComponent(\n// `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"100%\" height=\"100%\"><rect width=\"100%\" height=\"100%\" fill=\"none\" rx=\"8\" ry=\"8\" stroke=\"${color}\" stroke-width=\"${stroke}\" stroke-dasharray=\"6, 14\" stroke-dashoffset=\"0\" stroke-linecap=\"square\"/></svg>`,\n// );\n\n// const handleBorder = (props: StyledProps<DSDropzoneT.InternalProps>): string => {\n// const { isDragAccept, isDragReject, isFocused } = props;\n// console.log(props);\n// if (isDragAccept) return borderImageCreator(props.theme.colors.brand[600], 2);\n// if (isDragReject) return borderImageCreator(props.theme.colors.danger[900], 2);\n// return borderImageCreator(props.theme.colors.neutral[400], 2);\n// };\n\nconst borderImage = (color: string) =>\n `url(\"data:image/svg+xml,%3csvg aria-hidden='true' width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='${\n DROP_ZONE_CONSTANTS.BORDER_RADIUS\n }' ry='${DROP_ZONE_CONSTANTS.BORDER_RADIUS}' stroke='${encodeURIComponent(color)}' stroke-width='${\n DROP_ZONE_CONSTANTS.BORDER_WIDTH\n }' stroke-dasharray='4 6' stroke-dashoffset='0' stroke-linecap='round'/%3e%3c/svg%3e\")`;\n\ninterface DropzoneStyledProps {\n isDragActive: boolean;\n disabled: boolean;\n hasError: boolean;\n getOwnerProps: () => object;\n getOwnerPropsArguments: () => object;\n}\nexport const StyledDropZoneHolder = styled(Grid, {\n name: DSDropzoneName,\n slot: DROPZONE_SLOTS.WRAPPER_HOLDER,\n})`\n position: relative;\n`;\nexport const StyledDropZone = styled(Grid, { name: DSDropzoneName, slot: DROPZONE_SLOTS.WRAPPER })<DropzoneStyledProps>`\n border-radius: ${DROP_ZONE_CONSTANTS.BORDER_RADIUS}px;\n background-color: ${(props) => props.theme.colors.neutral['000']};\n background-image: ${(props) => {\n if (props.disabled) {\n return borderImage(props.theme.colors.neutral[400]);\n }\n if (props.isDragActive) {\n return borderImage(props.theme.colors.brand[600]);\n }\n if (props.hasError) {\n return borderImage(props.theme.colors.danger[900]);\n }\n return borderImage(props.theme.colors.neutral[400]);\n }};\n padding: ${(props) => props.theme.space.xs} 1.8461538461538463rem;\n &:hover {\n background-image: ${(props) => {\n if (props.disabled) {\n return borderImage(props.theme.colors.neutral[400]);\n }\n if (props.isDragActive) {\n return borderImage(props.theme.colors.brand[600]);\n }\n if (props.hasError) {\n return borderImage(props.theme.colors.danger[900]);\n }\n return borderImage(props.theme.colors.brand[600]);\n }};\n }\n cursor: ${(props) => (props.isDragActive ? 'grabbing' : 'default')};\n`;\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,cAAc;AACvB,SAAS,YAAY;AACrB,SAAS,gBAAgB,qBAAqB,sBAAsB;AAepE,MAAM,cAAc,CAAC,UACnB,gLACE,oBAAoB,sBACb,oBAAoB,0BAA0B,mBAAmB,KAAK,oBAC7E,oBAAoB;AAUjB,MAAM,uBAAuB,OAAO,MAAM;AAAA,EAC/C,MAAM;AAAA,EACN,MAAM,eAAe;AACvB,CAAC;AAAA;AAAA;AAGM,MAAM,iBAAiB,OAAO,MAAM,EAAE,MAAM,gBAAgB,MAAM,eAAe,QAAQ,CAAC;AAAA,mBAC9E,oBAAoB;AAAA,sBACjB,CAAC,UAAU,MAAM,MAAM,OAAO,QAAQ,KAAK;AAAA,sBAC3C,CAAC,UAAU;AAC7B,MAAI,MAAM,UAAU;AAClB,WAAO,YAAY,MAAM,MAAM,OAAO,QAAQ,GAAG,CAAC;AAAA,EACpD;AACA,MAAI,MAAM,cAAc;AACtB,WAAO,YAAY,MAAM,MAAM,OAAO,MAAM,GAAG,CAAC;AAAA,EAClD;AACA,MAAI,MAAM,UAAU;AAClB,WAAO,YAAY,MAAM,MAAM,OAAO,OAAO,GAAG,CAAC;AAAA,EACnD;AACA,SAAO,YAAY,MAAM,MAAM,OAAO,QAAQ,GAAG,CAAC;AACpD;AAAA,aACW,CAAC,UAAU,MAAM,MAAM,MAAM;AAAA;AAAA,wBAElB,CAAC,UAAU;AAC7B,MAAI,MAAM,UAAU;AAClB,WAAO,YAAY,MAAM,MAAM,OAAO,QAAQ,GAAG,CAAC;AAAA,EACpD;AACA,MAAI,MAAM,cAAc;AACtB,WAAO,YAAY,MAAM,MAAM,OAAO,MAAM,GAAG,CAAC;AAAA,EAClD;AACA,MAAI,MAAM,UAAU;AAClB,WAAO,YAAY,MAAM,MAAM,OAAO,OAAO,GAAG,CAAC;AAAA,EACnD;AACA,SAAO,YAAY,MAAM,MAAM,OAAO,MAAM,GAAG,CAAC;AAClD;AAAA;AAAA,YAEQ,CAAC,UAAW,MAAM,eAAe,aAAa;AAAA;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,5 @@
1
1
  /// <reference types="lodash" />
2
+ import React from 'react';
2
3
  import { useGetGlobalAttributes, useGetXstyledProps } from '@elliemae/ds-utilities';
3
4
  import { type DSDropzoneT } from '../react-desc-prop-types.js';
4
5
  export interface DropzoneCTX {
@@ -12,5 +13,9 @@ export declare const useDSDropzone: (propsFromUser: DSDropzoneT.Props) => {
12
13
  globalProps: import("lodash").Omit<import("@elliemae/ds-utilities").GlobalAttributesT<Element>, "cols" | "rows" | "wrap">;
13
14
  xstyledProps: import("@elliemae/ds-utilities").XstyledProps;
14
15
  instanceUid: string;
15
- dropZoneState: import("react-dropzone").DropzoneState;
16
+ isDragInside: boolean;
17
+ onDragEnterHandler: React.DragEventHandler<HTMLDivElement>;
18
+ onDragOverHandler: React.DragEventHandler<HTMLDivElement>;
19
+ onDragLeaveHandler: React.DragEventHandler<HTMLDivElement>;
20
+ onDropHandler: React.DragEventHandler<HTMLDivElement>;
16
21
  };
@@ -8,5 +8,6 @@ export declare const DROPZONE_SLOTS: {
8
8
  readonly ACTIVEZONE_ICON: "activezone-icon";
9
9
  readonly ACTIVEZONE_WRAPPER: "activezone-wrapper";
10
10
  readonly WRAPPER: "wrapper";
11
+ readonly WRAPPER_HOLDER: "wrapper_holder";
11
12
  };
12
13
  export declare const DROPZONE_DATA_TESTID: Record<string, string>;
@@ -1,5 +1,4 @@
1
1
  import type { GlobalAttributesT, XstyledProps, DSPropTypesSchema } from '@elliemae/ds-props-helpers';
2
- import type { DropzoneOptions } from 'react-dropzone';
3
2
  import type { WeakValidationMap } from 'react';
4
3
  export declare namespace DSDropzoneT {
5
4
  interface RequiredProps {
@@ -7,7 +6,7 @@ export declare namespace DSDropzoneT {
7
6
  interface DefaultProps {
8
7
  }
9
8
  interface OptionalProps {
10
- dropConfig?: DropzoneOptions;
9
+ onDrop?: (files: File[], event: React.DragEvent<HTMLDivElement>) => void;
11
10
  hasError?: boolean;
12
11
  }
13
12
  interface Props extends Partial<DefaultProps>, OptionalProps, Omit<GlobalAttributesT<HTMLButtonElement>, keyof OptionalProps | keyof XstyledProps>, XstyledProps, RequiredProps {
@@ -1,17 +1,11 @@
1
1
  /// <reference types="react" />
2
- export declare const StyledDropZone: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("@elliemae/ds-grid").DSGridT.Props & import("react").RefAttributes<HTMLDivElement>>, import("@elliemae/ds-system").Theme, import("react-dropzone").DropzoneRef & {
3
- isFocused: boolean;
2
+ interface DropzoneStyledProps {
4
3
  isDragActive: boolean;
5
- isDragAccept: boolean;
6
- isDragReject: boolean;
7
- isFileDialogActive: boolean;
8
- acceptedFiles: File[];
9
- fileRejections: import("react-dropzone").FileRejection[];
10
- rootRef: import("react").RefObject<HTMLElement>;
11
- inputRef: import("react").RefObject<HTMLInputElement>;
12
- getRootProps: <T extends import("react-dropzone").DropzoneRootProps>(props?: T | undefined) => T;
13
- getInputProps: <T_1 extends import("react-dropzone").DropzoneInputProps>(props?: T_1 | undefined) => T_1;
14
- } & {
15
4
  disabled: boolean;
16
5
  hasError: boolean;
17
- } & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<import("react").ForwardRefExoticComponent<import("@elliemae/ds-grid").DSGridT.Props & import("react").RefAttributes<HTMLDivElement>>>, never>;
6
+ getOwnerProps: () => object;
7
+ getOwnerPropsArguments: () => object;
8
+ }
9
+ export declare const StyledDropZoneHolder: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("@elliemae/ds-grid").DSGridT.Props & import("react").RefAttributes<HTMLDivElement>>, import("@elliemae/ds-system").Theme, object & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<import("react").ForwardRefExoticComponent<import("@elliemae/ds-grid").DSGridT.Props & import("react").RefAttributes<HTMLDivElement>>>, never>;
10
+ export declare const StyledDropZone: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("@elliemae/ds-grid").DSGridT.Props & import("react").RefAttributes<HTMLDivElement>>, import("@elliemae/ds-system").Theme, DropzoneStyledProps & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<import("react").ForwardRefExoticComponent<import("@elliemae/ds-grid").DSGridT.Props & import("react").RefAttributes<HTMLDivElement>>>, never>;
11
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-dropzone",
3
- "version": "3.25.0-rc.0",
3
+ "version": "3.26.0-next.2",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Dropzone",
6
6
  "files": [
@@ -36,23 +36,22 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "@xstyled/styled-components": "~3.6.0",
39
- "react-dropzone": "~14.2.3",
40
39
  "uid": "^2.0.2",
41
- "@elliemae/ds-button": "3.25.0-rc.0",
42
- "@elliemae/ds-grid": "3.25.0-rc.0",
43
- "@elliemae/ds-props-helpers": "3.25.0-rc.0",
44
- "@elliemae/ds-icons": "3.25.0-rc.0",
45
- "@elliemae/ds-hooks-fontsize-media": "3.25.0-rc.0",
46
- "@elliemae/ds-system": "3.25.0-rc.0",
47
- "@elliemae/ds-typography": "3.25.0-rc.0",
48
- "@elliemae/ds-utilities": "3.25.0-rc.0"
40
+ "@elliemae/ds-button": "3.26.0-next.2",
41
+ "@elliemae/ds-grid": "3.26.0-next.2",
42
+ "@elliemae/ds-hooks-fontsize-media": "3.26.0-next.2",
43
+ "@elliemae/ds-props-helpers": "3.26.0-next.2",
44
+ "@elliemae/ds-icons": "3.26.0-next.2",
45
+ "@elliemae/ds-system": "3.26.0-next.2",
46
+ "@elliemae/ds-typography": "3.26.0-next.2",
47
+ "@elliemae/ds-utilities": "3.26.0-next.2"
49
48
  },
50
49
  "devDependencies": {
51
50
  "@elliemae/pui-cli": "~9.0.0-next.31",
52
51
  "@xstyled/system": "3.7.0",
53
52
  "lodash": "^4.17.21",
54
53
  "styled-components": "~5.3.9",
55
- "@elliemae/ds-monorepo-devops": "3.25.0-rc.0"
54
+ "@elliemae/ds-monorepo-devops": "3.26.0-next.2"
56
55
  },
57
56
  "peerDependencies": {
58
57
  "lodash": "^4.17.21",
@@ -62,7 +61,7 @@
62
61
  },
63
62
  "publishConfig": {
64
63
  "access": "public",
65
- "typeSafety": false
64
+ "typeSafety": true
66
65
  },
67
66
  "scripts": {
68
67
  "dev": "cross-env NODE_ENV=development node ../../../scripts/build/build.mjs --watch",