@elliemae/ds-dropzone 3.80.0-next.72 → 3.80.0-next.75

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.
@@ -55,7 +55,10 @@ const DSDropzone = (props) => {
55
55
  } = (0, import_useDSDropzone.useDSDropzone)(props);
56
56
  const getOwnerProps = import_react.default.useCallback(() => propsWithDefault, [propsWithDefault]);
57
57
  const getOwnerPropsArguments = import_react.default.useCallback(() => ({}), []);
58
- const safeGlobalProps = (0, import_lodash_es.omit)(globalProps, "onDrop", "hasError");
58
+ const safeGlobalProps = (0, import_ds_props_helpers.omitLockedHandlers)(
59
+ (0, import_ds_props_helpers.omitLockAttributes)((0, import_lodash_es.omit)(globalProps, "onDrop", "hasError")),
60
+ Boolean(propsWithDefault.disabled)
61
+ );
59
62
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
60
63
  import_styled.StyledDropZoneHolder,
61
64
  {
@@ -63,7 +66,7 @@ const DSDropzone = (props) => {
63
66
  ...xstyledProps,
64
67
  getOwnerProps,
65
68
  getOwnerPropsArguments,
66
- disabled: Boolean(propsWithDefault.disabled),
69
+ $disabled: Boolean(propsWithDefault.disabled),
67
70
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
68
71
  import_styled.StyledDropZone,
69
72
  {
@@ -72,7 +75,7 @@ const DSDropzone = (props) => {
72
75
  onDragLeave: onDragLeaveHandler,
73
76
  onDrop: onDropHandler,
74
77
  hasError: Boolean(propsWithDefault.hasError),
75
- disabled: Boolean(propsWithDefault.disabled),
78
+ $disabled: Boolean(propsWithDefault.disabled),
76
79
  isDragActive: isDragInside,
77
80
  getOwnerProps,
78
81
  getOwnerPropsArguments,
@@ -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 { omit } from 'lodash-es';\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';\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 disabled={Boolean(propsWithDefault.disabled)}\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.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;AD+BjB;AA/BN,mBAAkB;AAClB,8BAAyB;AACzB,uBAAqB;AACrB,mCAA4D;AAC5D,2BAA8B;AAC9B,uBAA+B;AAC/B,oBAAqD;AACrD,0BAA6B;AAE7B,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,uBAAK,aAAa,UAAU,UAAU;AAC9D,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACH,GAAG;AAAA,MACJ;AAAA,MACA;AAAA,MACA,UAAU,QAAQ,iBAAiB,QAAQ;AAAA,MAE3C;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,cAAc;AACzB,MAAM,2BAAuB,kCAAS,UAAU;AAChD,qBAAqB,YAAY;",
4
+ "sourcesContent": ["import React from 'react';\nimport { describe, omitLockAttributes, omitLockedHandlers } from '@elliemae/ds-props-helpers';\nimport { omit } from 'lodash-es';\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';\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 // disabled and readOnly are global attributes: omitted so the holder never prints them, $disabled is read instead\n // while disabled the consumer's action handlers (click, keys, mouse, pointer, touch, clipboard, drag...) are withheld\n const safeGlobalProps = omitLockedHandlers(\n omitLockAttributes(omit(globalProps, 'onDrop', 'hasError')),\n Boolean(propsWithDefault.disabled),\n );\n return (\n <StyledDropZoneHolder\n {...safeGlobalProps}\n {...xstyledProps}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n $disabled={Boolean(propsWithDefault.disabled)}\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.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;ADoCjB;AApCN,mBAAkB;AAClB,8BAAiE;AACjE,uBAAqB;AACrB,mCAA4D;AAC5D,2BAA8B;AAC9B,uBAA+B;AAC/B,oBAAqD;AACrD,0BAA6B;AAE7B,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;AAG/D,QAAM,sBAAkB;AAAA,QACtB,gDAAmB,uBAAK,aAAa,UAAU,UAAU,CAAC;AAAA,IAC1D,QAAQ,iBAAiB,QAAQ;AAAA,EACnC;AACA,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACH,GAAG;AAAA,MACJ;AAAA,MACA;AAAA,MACA,WAAW,QAAQ,iBAAiB,QAAQ;AAAA,MAE5C;AAAA,QAAC;AAAA;AAAA,UACC,aAAa;AAAA,UACb,YAAY;AAAA,UACZ,aAAa;AAAA,UACb,QAAQ;AAAA,UACR,UAAU,QAAQ,iBAAiB,QAAQ;AAAA,UAC3C,WAAW,QAAQ,iBAAiB,QAAQ;AAAA,UAC5C,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,cAAc;AACzB,MAAM,2BAAuB,kCAAS,UAAU;AAChD,qBAAqB,YAAY;",
6
6
  "names": ["React"]
7
7
  }
@@ -77,13 +77,14 @@ const useDSDropzone = (propsFromUser) => {
77
77
  }, []);
78
78
  const onDropHandler = import_react.default.useCallback(
79
79
  (e) => {
80
+ setIsDragInside(false);
80
81
  e.preventDefault();
81
82
  e.stopPropagation();
82
- setIsDragInside(false);
83
+ if (disabled) return;
83
84
  const filesArray = Array.from(e.dataTransfer?.files ?? []);
84
85
  onDrop?.(filesArray, e);
85
86
  },
86
- [onDrop]
87
+ [disabled, onDrop]
87
88
  );
88
89
  return import_react.default.useMemo(
89
90
  () => ({
@@ -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 { useGetGlobalAttributes, useGetXstyledProps, useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport { uid } from 'uid';\nimport type { DSGridT } from '@elliemae/ds-grid';\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 = useGetGlobalAttributes<DSDropzoneT.InternalProps, HTMLDivElement, DSGridT.Props>(\n propsWithDefault,\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, disabled, 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(\n (e) => {\n e.preventDefault();\n e.stopPropagation();\n if (!disabled) setIsDragInside(true);\n },\n [disabled],\n );\n const onDragOverHandler: React.DragEventHandler<HTMLDivElement> = React.useCallback((e) => {\n e.preventDefault();\n e.stopPropagation();\n }, []);\n const onDragLeaveHandler: React.DragEventHandler<HTMLDivElement> = React.useCallback((e) => {\n if (e.relatedTarget !== e.currentTarget && !e.currentTarget.contains(e.relatedTarget as Node)) {\n e.preventDefault();\n e.stopPropagation();\n setIsDragInside(false);\n }\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,8BAAyF;AACzF,iBAAoB;AAEpB,mCAAoE;AACpE,8BAAiC;AAS1B,MAAM,gBAAgB,CAAC,kBAAqC;AAIjE,QAAM,uBAAmB,sDAAwD,eAAe,yCAAY;AAC5G,gDAAiB,kBAAkB,gDAAmB;AAItD,QAAM,kBAAc;AAAA,IAClB;AAAA,EACF;AACA,QAAM,mBAAe,4CAAmB,gBAAgB;AAKxD,QAAM,EAAE,IAAI,UAAU,OAAO,IAAI;AACjC,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;AAAA,IACvE,CAAC,MAAM;AACL,QAAE,eAAe;AACjB,QAAE,gBAAgB;AAClB,UAAI,CAAC,SAAU,iBAAgB,IAAI;AAAA,IACrC;AAAA,IACA,CAAC,QAAQ;AAAA,EACX;AACA,QAAM,oBAA4D,aAAAA,QAAM,YAAY,CAAC,MAAM;AACzF,MAAE,eAAe;AACjB,MAAE,gBAAgB;AAAA,EACpB,GAAG,CAAC,CAAC;AACL,QAAM,qBAA6D,aAAAA,QAAM,YAAY,CAAC,MAAM;AAC1F,QAAI,EAAE,kBAAkB,EAAE,iBAAiB,CAAC,EAAE,cAAc,SAAS,EAAE,aAAqB,GAAG;AAC7F,QAAE,eAAe;AACjB,QAAE,gBAAgB;AAClB,sBAAgB,KAAK;AAAA,IACvB;AAAA,EACF,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;",
4
+ "sourcesContent": ["import React from 'react';\nimport { useGetGlobalAttributes, useGetXstyledProps, useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport { uid } from 'uid';\nimport type { DSGridT } from '@elliemae/ds-grid';\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 = useGetGlobalAttributes<DSDropzoneT.InternalProps, HTMLDivElement, DSGridT.Props>(\n propsWithDefault,\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, disabled, 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 // disabled: the default of drag enter, over and drop is still cancelled (the browser opens no dropped file); the zone\n // only refuses to light up and never calls the consumer onDrop\n const onDragEnterHandler: React.DragEventHandler<HTMLDivElement> = React.useCallback(\n (e) => {\n // the default is always cancelled: otherwise a file dropped on a disabled zone would be opened by the browser.\n // A disabled zone only refuses to light up.\n e.preventDefault();\n e.stopPropagation();\n if (!disabled) setIsDragInside(true);\n },\n [disabled],\n );\n const onDragOverHandler: React.DragEventHandler<HTMLDivElement> = React.useCallback((e) => {\n e.preventDefault();\n e.stopPropagation();\n }, []);\n const onDragLeaveHandler: React.DragEventHandler<HTMLDivElement> = React.useCallback((e) => {\n if (e.relatedTarget !== e.currentTarget && !e.currentTarget.contains(e.relatedTarget as Node)) {\n e.preventDefault();\n e.stopPropagation();\n setIsDragInside(false);\n }\n }, []);\n const onDropHandler: React.DragEventHandler<HTMLDivElement> = React.useCallback(\n (e) => {\n // the state reset and the default cancel always run: the activezone can never be left visible and the browser never\n // opens a dropped file; the consumer is not called when disabled\n setIsDragInside(false);\n e.preventDefault();\n e.stopPropagation();\n if (disabled) return;\n const filesArray = Array.from(e.dataTransfer?.files ?? []);\n onDrop?.(filesArray, e);\n },\n [disabled, 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,8BAAyF;AACzF,iBAAoB;AAEpB,mCAAoE;AACpE,8BAAiC;AAS1B,MAAM,gBAAgB,CAAC,kBAAqC;AAIjE,QAAM,uBAAmB,sDAAwD,eAAe,yCAAY;AAC5G,gDAAiB,kBAAkB,gDAAmB;AAItD,QAAM,kBAAc;AAAA,IAClB;AAAA,EACF;AACA,QAAM,mBAAe,4CAAmB,gBAAgB;AAKxD,QAAM,EAAE,IAAI,UAAU,OAAO,IAAI;AACjC,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;AAIxB,QAAM,qBAA6D,aAAAA,QAAM;AAAA,IACvE,CAAC,MAAM;AAGL,QAAE,eAAe;AACjB,QAAE,gBAAgB;AAClB,UAAI,CAAC,SAAU,iBAAgB,IAAI;AAAA,IACrC;AAAA,IACA,CAAC,QAAQ;AAAA,EACX;AACA,QAAM,oBAA4D,aAAAA,QAAM,YAAY,CAAC,MAAM;AACzF,MAAE,eAAe;AACjB,MAAE,gBAAgB;AAAA,EACpB,GAAG,CAAC,CAAC;AACL,QAAM,qBAA6D,aAAAA,QAAM,YAAY,CAAC,MAAM;AAC1F,QAAI,EAAE,kBAAkB,EAAE,iBAAiB,CAAC,EAAE,cAAc,SAAS,EAAE,aAAqB,GAAG;AAC7F,QAAE,eAAe;AACjB,QAAE,gBAAgB;AAClB,sBAAgB,KAAK;AAAA,IACvB;AAAA,EACF,GAAG,CAAC,CAAC;AACL,QAAM,gBAAwD,aAAAA,QAAM;AAAA,IAClE,CAAC,MAAM;AAGL,sBAAgB,KAAK;AACrB,QAAE,eAAe;AACjB,QAAE,gBAAgB;AAClB,UAAI,SAAU;AACd,YAAM,aAAa,MAAM,KAAK,EAAE,cAAc,SAAS,CAAC,CAAC;AACzD,eAAS,YAAY,CAAC;AAAA,IACxB;AAAA,IACA,CAAC,UAAU,MAAM;AAAA,EACnB;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
  }
@@ -42,7 +42,9 @@ 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
+ disabled: import_ds_props_helpers.PropTypes.bool.description(
46
+ "Hard lock. A disabled dropzone ignores the consumer handlers for its actions and never calls onDrop; it still cancels the browser drag and drop defaults, so a dropped file is not opened."
47
+ ),
46
48
  hasError: import_ds_props_helpers.PropTypes.bool.description("Show error border color"),
47
49
  onDrop: import_ds_props_helpers.PropTypes.func.description(
48
50
  `
@@ -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": ["import 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\n Partial<DefaultProps>,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof OptionalProps | keyof XstyledProps>,\n XstyledProps,\n RequiredProps {}\n\n export interface InternalProps\n extends\n 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;ADCvB,8BAAuE;AAgChE,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;",
4
+ "sourcesContent": ["import 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\n Partial<DefaultProps>,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof OptionalProps | keyof XstyledProps>,\n XstyledProps,\n RequiredProps {}\n\n export interface InternalProps\n extends\n 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(\n 'Hard lock. A disabled dropzone ignores the consumer handlers for its actions and never calls onDrop; it still cancels the browser drag and drop defaults, so a dropped file is not opened.',\n ),\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;ADCvB,8BAAuE;AAgChE,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;AAAA,IACvB;AAAA,EACF;AAAA,EACA,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
  }
@@ -36,22 +36,18 @@ var React = __toESM(require("react"));
36
36
  var import_ds_system = require("@elliemae/ds-system");
37
37
  var import_ds_grid = require("@elliemae/ds-grid");
38
38
  var import_constants = require("./constants/index.js");
39
- const disabledStyles = import_ds_system.css`
40
- pointer-events: none;
41
- `;
42
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")`;
43
40
  const StyledDropZoneHolder = (0, import_ds_system.styled)(import_ds_grid.Grid, {
44
41
  name: import_constants.DSDropzoneName,
45
42
  slot: import_constants.DROPZONE_SLOTS.WRAPPER_HOLDER
46
43
  })`
47
44
  position: relative;
48
- ${(props) => props.disabled && "cursor: not-allowed;"}
49
45
  `;
50
46
  const StyledDropZone = (0, import_ds_system.styled)(import_ds_grid.Grid, { name: import_constants.DSDropzoneName, slot: import_constants.DROPZONE_SLOTS.WRAPPER })`
51
47
  border-radius: ${import_constants.DROP_ZONE_CONSTANTS.BORDER_RADIUS}px;
52
48
  background-color: ${(props) => props.theme.colors.neutral["000"]};
53
49
  background-image: ${(props) => {
54
- if (props.disabled) {
50
+ if (props.$disabled) {
55
51
  return borderImage(props.theme.colors.neutral[400]);
56
52
  }
57
53
  if (props.isDragActive) {
@@ -65,7 +61,7 @@ const StyledDropZone = (0, import_ds_system.styled)(import_ds_grid.Grid, { name:
65
61
  padding: ${(props) => props.theme.space.xs} 1.8461538461538463rem;
66
62
  &:hover {
67
63
  background-image: ${(props) => {
68
- if (props.disabled) {
64
+ if (props.$disabled) {
69
65
  return borderImage(props.theme.colors.neutral[400]);
70
66
  }
71
67
  if (props.isDragActive) {
@@ -78,6 +74,6 @@ const StyledDropZone = (0, import_ds_system.styled)(import_ds_grid.Grid, { name:
78
74
  }};
79
75
  }
80
76
  cursor: ${(props) => props.isDragActive ? "grabbing" : "default"};
81
- ${(props) => props.disabled && disabledStyles}
77
+ ${import_ds_system.lockedStateInteractionCss}
82
78
  `;
83
79
  //# 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 type {} from '@elliemae/ds-system';\nimport { styled, css } 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 disabledStyles = css`\n pointer-events: none;\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 ${(props) => props.disabled && 'cursor: not-allowed;'}\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 ${(props) => props.disabled && disabledStyles}\n`;\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,uBAA4B;AAC5B,qBAAqB;AACrB,uBAAoE;AAepE,MAAM,iBAAiB;AAAA;AAAA;AAIvB,MAAM,cAAc,CAAC,UACnB,gLACE,qCAAoB,aACtB,SAAS,qCAAoB,aAAa,aAAa,mBAAmB,KAAK,CAAC,mBAC9E,qCAAoB,YACtB;AASK,MAAM,2BAAuB,yBAAO,qBAAM;AAAA,EAC/C,MAAM;AAAA,EACN,MAAM,gCAAe;AACvB,CAAC;AAAA;AAAA,IAEG,CAAC,UAAU,MAAM,YAAY,sBAAsB;AAAA;AAEhD,MAAM,qBAAiB,yBAAO,qBAAM,EAAE,MAAM,iCAAgB,MAAM,gCAAe,QAAQ,CAAC;AAAA,mBAC9E,qCAAoB,aAAa;AAAA,sBAC9B,CAAC,UAAU,MAAM,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA,sBAC5C,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,CAAC;AAAA,aACU,CAAC,UAAU,MAAM,MAAM,MAAM,EAAE;AAAA;AAAA,wBAEpB,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,CAAC;AAAA;AAAA,YAEO,CAAC,UAAW,MAAM,eAAe,aAAa,SAAU;AAAA,IAChE,CAAC,UAAU,MAAM,YAAY,cAAc;AAAA;",
4
+ "sourcesContent": ["import type {} from '@elliemae/ds-system';\nimport { styled, lockedStateInteractionCss } 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})<{ $disabled?: boolean }>`\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 ${lockedStateInteractionCss}\n`;\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,uBAAkD;AAClD,qBAAqB;AACrB,uBAAoE;AAepE,MAAM,cAAc,CAAC,UACnB,gLACE,qCAAoB,aACtB,SAAS,qCAAoB,aAAa,aAAa,mBAAmB,KAAK,CAAC,mBAC9E,qCAAoB,YACtB;AASK,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;AAAA,sBAC9B,CAAC,UAAU,MAAM,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA,sBAC5C,CAAC,UAAU;AAC7B,MAAI,MAAM,WAAW;AACnB,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,CAAC;AAAA,aACU,CAAC,UAAU,MAAM,MAAM,MAAM,EAAE;AAAA;AAAA,wBAEpB,CAAC,UAAU;AAC7B,MAAI,MAAM,WAAW;AACnB,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,CAAC;AAAA;AAAA,YAEO,CAAC,UAAW,MAAM,eAAe,aAAa,SAAU;AAAA,IAChE,0CAAyB;AAAA;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import React2 from "react";
4
- import { describe } from "@elliemae/ds-props-helpers";
4
+ import { describe, omitLockAttributes, omitLockedHandlers } from "@elliemae/ds-props-helpers";
5
5
  import { omit } from "lodash-es";
6
6
  import { DSDropzonePropTypesSchema } from "./react-desc-prop-types.js";
7
7
  import { useDSDropzone } from "./config/useDSDropzone.js";
@@ -21,7 +21,10 @@ const DSDropzone = (props) => {
21
21
  } = useDSDropzone(props);
22
22
  const getOwnerProps = React2.useCallback(() => propsWithDefault, [propsWithDefault]);
23
23
  const getOwnerPropsArguments = React2.useCallback(() => ({}), []);
24
- const safeGlobalProps = omit(globalProps, "onDrop", "hasError");
24
+ const safeGlobalProps = omitLockedHandlers(
25
+ omitLockAttributes(omit(globalProps, "onDrop", "hasError")),
26
+ Boolean(propsWithDefault.disabled)
27
+ );
25
28
  return /* @__PURE__ */ jsx(
26
29
  StyledDropZoneHolder,
27
30
  {
@@ -29,7 +32,7 @@ const DSDropzone = (props) => {
29
32
  ...xstyledProps,
30
33
  getOwnerProps,
31
34
  getOwnerPropsArguments,
32
- disabled: Boolean(propsWithDefault.disabled),
35
+ $disabled: Boolean(propsWithDefault.disabled),
33
36
  children: /* @__PURE__ */ jsxs(
34
37
  StyledDropZone,
35
38
  {
@@ -38,7 +41,7 @@ const DSDropzone = (props) => {
38
41
  onDragLeave: onDragLeaveHandler,
39
42
  onDrop: onDropHandler,
40
43
  hasError: Boolean(propsWithDefault.hasError),
41
- disabled: Boolean(propsWithDefault.disabled),
44
+ $disabled: Boolean(propsWithDefault.disabled),
42
45
  isDragActive: isDragInside,
43
46
  getOwnerProps,
44
47
  getOwnerPropsArguments,
@@ -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 { omit } from 'lodash-es';\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';\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 disabled={Boolean(propsWithDefault.disabled)}\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.displayName = DSDropzoneName;\nconst DSDropzoneWithSchema = describe(DSDropzone);\nDSDropzoneWithSchema.propTypes = DSDropzonePropTypesSchema;\n\nexport { DSDropzone, DSDropzoneWithSchema };\n"],
5
- "mappings": "AAAA,YAAY,WAAW;AC+BjB,SAYkB,KAZlB;AA/BN,OAAOA,YAAW;AAClB,SAAS,gBAAgB;AACzB,SAAS,YAAY;AACrB,SAA2B,iCAAiC;AAC5D,SAAS,qBAAqB;AAC9B,SAAS,sBAAsB;AAC/B,SAAS,gBAAgB,4BAA4B;AACrD,SAAS,oBAAoB;AAE7B,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,MACA,UAAU,QAAQ,iBAAiB,QAAQ;AAAA,MAE3C;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,cAAc;AACzB,MAAM,uBAAuB,SAAS,UAAU;AAChD,qBAAqB,YAAY;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { describe, omitLockAttributes, omitLockedHandlers } from '@elliemae/ds-props-helpers';\nimport { omit } from 'lodash-es';\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';\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 // disabled and readOnly are global attributes: omitted so the holder never prints them, $disabled is read instead\n // while disabled the consumer's action handlers (click, keys, mouse, pointer, touch, clipboard, drag...) are withheld\n const safeGlobalProps = omitLockedHandlers(\n omitLockAttributes(omit(globalProps, 'onDrop', 'hasError')),\n Boolean(propsWithDefault.disabled),\n );\n return (\n <StyledDropZoneHolder\n {...safeGlobalProps}\n {...xstyledProps}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n $disabled={Boolean(propsWithDefault.disabled)}\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.displayName = DSDropzoneName;\nconst DSDropzoneWithSchema = describe(DSDropzone);\nDSDropzoneWithSchema.propTypes = DSDropzonePropTypesSchema;\n\nexport { DSDropzone, DSDropzoneWithSchema };\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACoCjB,SAYkB,KAZlB;AApCN,OAAOA,YAAW;AAClB,SAAS,UAAU,oBAAoB,0BAA0B;AACjE,SAAS,YAAY;AACrB,SAA2B,iCAAiC;AAC5D,SAAS,qBAAqB;AAC9B,SAAS,sBAAsB;AAC/B,SAAS,gBAAgB,4BAA4B;AACrD,SAAS,oBAAoB;AAE7B,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;AAG/D,QAAM,kBAAkB;AAAA,IACtB,mBAAmB,KAAK,aAAa,UAAU,UAAU,CAAC;AAAA,IAC1D,QAAQ,iBAAiB,QAAQ;AAAA,EACnC;AACA,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACH,GAAG;AAAA,MACJ;AAAA,MACA;AAAA,MACA,WAAW,QAAQ,iBAAiB,QAAQ;AAAA,MAE5C;AAAA,QAAC;AAAA;AAAA,UACC,aAAa;AAAA,UACb,YAAY;AAAA,UACZ,aAAa;AAAA,UACb,QAAQ;AAAA,UACR,UAAU,QAAQ,iBAAiB,QAAQ;AAAA,UAC3C,WAAW,QAAQ,iBAAiB,QAAQ;AAAA,UAC5C,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,cAAc;AACzB,MAAM,uBAAuB,SAAS,UAAU;AAChD,qBAAqB,YAAY;",
6
6
  "names": ["React"]
7
7
  }
@@ -44,13 +44,14 @@ const useDSDropzone = (propsFromUser) => {
44
44
  }, []);
45
45
  const onDropHandler = React2.useCallback(
46
46
  (e) => {
47
+ setIsDragInside(false);
47
48
  e.preventDefault();
48
49
  e.stopPropagation();
49
- setIsDragInside(false);
50
+ if (disabled) return;
50
51
  const filesArray = Array.from(e.dataTransfer?.files ?? []);
51
52
  onDrop?.(filesArray, e);
52
53
  },
53
- [onDrop]
54
+ [disabled, onDrop]
54
55
  );
55
56
  return React2.useMemo(
56
57
  () => ({
@@ -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 { useGetGlobalAttributes, useGetXstyledProps, useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport { uid } from 'uid';\nimport type { DSGridT } from '@elliemae/ds-grid';\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 = useGetGlobalAttributes<DSDropzoneT.InternalProps, HTMLDivElement, DSGridT.Props>(\n propsWithDefault,\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, disabled, 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(\n (e) => {\n e.preventDefault();\n e.stopPropagation();\n if (!disabled) setIsDragInside(true);\n },\n [disabled],\n );\n const onDragOverHandler: React.DragEventHandler<HTMLDivElement> = React.useCallback((e) => {\n e.preventDefault();\n e.stopPropagation();\n }, []);\n const onDragLeaveHandler: React.DragEventHandler<HTMLDivElement> = React.useCallback((e) => {\n if (e.relatedTarget !== e.currentTarget && !e.currentTarget.contains(e.relatedTarget as Node)) {\n e.preventDefault();\n e.stopPropagation();\n setIsDragInside(false);\n }\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,wBAAwB,oBAAoB,oCAAoC;AACzF,SAAS,WAAW;AAEpB,SAA2B,qBAAqB,oBAAoB;AACpE,SAAS,wBAAwB;AAS1B,MAAM,gBAAgB,CAAC,kBAAqC;AAIjE,QAAM,mBAAmB,6BAAwD,eAAe,YAAY;AAC5G,mBAAiB,kBAAkB,mBAAmB;AAItD,QAAM,cAAc;AAAA,IAClB;AAAA,EACF;AACA,QAAM,eAAe,mBAAmB,gBAAgB;AAKxD,QAAM,EAAE,IAAI,UAAU,OAAO,IAAI;AACjC,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;AAAA,IACvE,CAAC,MAAM;AACL,QAAE,eAAe;AACjB,QAAE,gBAAgB;AAClB,UAAI,CAAC,SAAU,iBAAgB,IAAI;AAAA,IACrC;AAAA,IACA,CAAC,QAAQ;AAAA,EACX;AACA,QAAM,oBAA4DA,OAAM,YAAY,CAAC,MAAM;AACzF,MAAE,eAAe;AACjB,MAAE,gBAAgB;AAAA,EACpB,GAAG,CAAC,CAAC;AACL,QAAM,qBAA6DA,OAAM,YAAY,CAAC,MAAM;AAC1F,QAAI,EAAE,kBAAkB,EAAE,iBAAiB,CAAC,EAAE,cAAc,SAAS,EAAE,aAAqB,GAAG;AAC7F,QAAE,eAAe;AACjB,QAAE,gBAAgB;AAClB,sBAAgB,KAAK;AAAA,IACvB;AAAA,EACF,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;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { useGetGlobalAttributes, useGetXstyledProps, useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport { uid } from 'uid';\nimport type { DSGridT } from '@elliemae/ds-grid';\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 = useGetGlobalAttributes<DSDropzoneT.InternalProps, HTMLDivElement, DSGridT.Props>(\n propsWithDefault,\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, disabled, 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 // disabled: the default of drag enter, over and drop is still cancelled (the browser opens no dropped file); the zone\n // only refuses to light up and never calls the consumer onDrop\n const onDragEnterHandler: React.DragEventHandler<HTMLDivElement> = React.useCallback(\n (e) => {\n // the default is always cancelled: otherwise a file dropped on a disabled zone would be opened by the browser.\n // A disabled zone only refuses to light up.\n e.preventDefault();\n e.stopPropagation();\n if (!disabled) setIsDragInside(true);\n },\n [disabled],\n );\n const onDragOverHandler: React.DragEventHandler<HTMLDivElement> = React.useCallback((e) => {\n e.preventDefault();\n e.stopPropagation();\n }, []);\n const onDragLeaveHandler: React.DragEventHandler<HTMLDivElement> = React.useCallback((e) => {\n if (e.relatedTarget !== e.currentTarget && !e.currentTarget.contains(e.relatedTarget as Node)) {\n e.preventDefault();\n e.stopPropagation();\n setIsDragInside(false);\n }\n }, []);\n const onDropHandler: React.DragEventHandler<HTMLDivElement> = React.useCallback(\n (e) => {\n // the state reset and the default cancel always run: the activezone can never be left visible and the browser never\n // opens a dropped file; the consumer is not called when disabled\n setIsDragInside(false);\n e.preventDefault();\n e.stopPropagation();\n if (disabled) return;\n const filesArray = Array.from(e.dataTransfer?.files ?? []);\n onDrop?.(filesArray, e);\n },\n [disabled, 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,wBAAwB,oBAAoB,oCAAoC;AACzF,SAAS,WAAW;AAEpB,SAA2B,qBAAqB,oBAAoB;AACpE,SAAS,wBAAwB;AAS1B,MAAM,gBAAgB,CAAC,kBAAqC;AAIjE,QAAM,mBAAmB,6BAAwD,eAAe,YAAY;AAC5G,mBAAiB,kBAAkB,mBAAmB;AAItD,QAAM,cAAc;AAAA,IAClB;AAAA,EACF;AACA,QAAM,eAAe,mBAAmB,gBAAgB;AAKxD,QAAM,EAAE,IAAI,UAAU,OAAO,IAAI;AACjC,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;AAIxB,QAAM,qBAA6DA,OAAM;AAAA,IACvE,CAAC,MAAM;AAGL,QAAE,eAAe;AACjB,QAAE,gBAAgB;AAClB,UAAI,CAAC,SAAU,iBAAgB,IAAI;AAAA,IACrC;AAAA,IACA,CAAC,QAAQ;AAAA,EACX;AACA,QAAM,oBAA4DA,OAAM,YAAY,CAAC,MAAM;AACzF,MAAE,eAAe;AACjB,MAAE,gBAAgB;AAAA,EACpB,GAAG,CAAC,CAAC;AACL,QAAM,qBAA6DA,OAAM,YAAY,CAAC,MAAM;AAC1F,QAAI,EAAE,kBAAkB,EAAE,iBAAiB,CAAC,EAAE,cAAc,SAAS,EAAE,aAAqB,GAAG;AAC7F,QAAE,eAAe;AACjB,QAAE,gBAAgB;AAClB,sBAAgB,KAAK;AAAA,IACvB;AAAA,EACF,GAAG,CAAC,CAAC;AACL,QAAM,gBAAwDA,OAAM;AAAA,IAClE,CAAC,MAAM;AAGL,sBAAgB,KAAK;AACrB,QAAE,eAAe;AACjB,QAAE,gBAAgB;AAClB,UAAI,SAAU;AACd,YAAM,aAAa,MAAM,KAAK,EAAE,cAAc,SAAS,CAAC,CAAC;AACzD,eAAS,YAAY,CAAC;AAAA,IACxB;AAAA,IACA,CAAC,UAAU,MAAM;AAAA,EACnB;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
  }
@@ -7,7 +7,9 @@ const DSDropzonePropTypes = {
7
7
  ...globalAttributesPropTypes,
8
8
  ...xstyledPropTypes,
9
9
  children: PropTypes.any,
10
- disabled: PropTypes.bool.description("Enable/disable the dropzone"),
10
+ disabled: PropTypes.bool.description(
11
+ "Hard lock. A disabled dropzone ignores the consumer handlers for its actions and never calls onDrop; it still cancels the browser drag and drop defaults, so a dropped file is not opened."
12
+ ),
11
13
  hasError: PropTypes.bool.description("Show error border color"),
12
14
  onDrop: PropTypes.func.description(
13
15
  `
@@ -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", "import 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\n Partial<DefaultProps>,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof OptionalProps | keyof XstyledProps>,\n XstyledProps,\n RequiredProps {}\n\n export interface InternalProps\n extends\n 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;ACCvB,SAAS,WAAW,2BAA2B,wBAAwB;AAgChE,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;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import 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\n Partial<DefaultProps>,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof OptionalProps | keyof XstyledProps>,\n XstyledProps,\n RequiredProps {}\n\n export interface InternalProps\n extends\n 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(\n 'Hard lock. A disabled dropzone ignores the consumer handlers for its actions and never calls onDrop; it still cancels the browser drag and drop defaults, so a dropped file is not opened.',\n ),\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;ACCvB,SAAS,WAAW,2BAA2B,wBAAwB;AAgChE,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;AAAA,IACvB;AAAA,EACF;AAAA,EACA,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
  }
@@ -1,23 +1,19 @@
1
1
  import * as React from "react";
2
- import { styled, css } from "@elliemae/ds-system";
2
+ import { styled, lockedStateInteractionCss } 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
- const disabledStyles = css`
6
- pointer-events: none;
7
- `;
8
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")`;
9
6
  const StyledDropZoneHolder = styled(Grid, {
10
7
  name: DSDropzoneName,
11
8
  slot: DROPZONE_SLOTS.WRAPPER_HOLDER
12
9
  })`
13
10
  position: relative;
14
- ${(props) => props.disabled && "cursor: not-allowed;"}
15
11
  `;
16
12
  const StyledDropZone = styled(Grid, { name: DSDropzoneName, slot: DROPZONE_SLOTS.WRAPPER })`
17
13
  border-radius: ${DROP_ZONE_CONSTANTS.BORDER_RADIUS}px;
18
14
  background-color: ${(props) => props.theme.colors.neutral["000"]};
19
15
  background-image: ${(props) => {
20
- if (props.disabled) {
16
+ if (props.$disabled) {
21
17
  return borderImage(props.theme.colors.neutral[400]);
22
18
  }
23
19
  if (props.isDragActive) {
@@ -31,7 +27,7 @@ const StyledDropZone = styled(Grid, { name: DSDropzoneName, slot: DROPZONE_SLOTS
31
27
  padding: ${(props) => props.theme.space.xs} 1.8461538461538463rem;
32
28
  &:hover {
33
29
  background-image: ${(props) => {
34
- if (props.disabled) {
30
+ if (props.$disabled) {
35
31
  return borderImage(props.theme.colors.neutral[400]);
36
32
  }
37
33
  if (props.isDragActive) {
@@ -44,7 +40,7 @@ const StyledDropZone = styled(Grid, { name: DSDropzoneName, slot: DROPZONE_SLOTS
44
40
  }};
45
41
  }
46
42
  cursor: ${(props) => props.isDragActive ? "grabbing" : "default"};
47
- ${(props) => props.disabled && disabledStyles}
43
+ ${lockedStateInteractionCss}
48
44
  `;
49
45
  export {
50
46
  StyledDropZone,
@@ -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 type {} from '@elliemae/ds-system';\nimport { styled, css } 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 disabledStyles = css`\n pointer-events: none;\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 ${(props) => props.disabled && 'cursor: not-allowed;'}\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 ${(props) => props.disabled && disabledStyles}\n`;\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,QAAQ,WAAW;AAC5B,SAAS,YAAY;AACrB,SAAS,gBAAgB,qBAAqB,sBAAsB;AAepE,MAAM,iBAAiB;AAAA;AAAA;AAIvB,MAAM,cAAc,CAAC,UACnB,gLACE,oBAAoB,aACtB,SAAS,oBAAoB,aAAa,aAAa,mBAAmB,KAAK,CAAC,mBAC9E,oBAAoB,YACtB;AASK,MAAM,uBAAuB,OAAO,MAAM;AAAA,EAC/C,MAAM;AAAA,EACN,MAAM,eAAe;AACvB,CAAC;AAAA;AAAA,IAEG,CAAC,UAAU,MAAM,YAAY,sBAAsB;AAAA;AAEhD,MAAM,iBAAiB,OAAO,MAAM,EAAE,MAAM,gBAAgB,MAAM,eAAe,QAAQ,CAAC;AAAA,mBAC9E,oBAAoB,aAAa;AAAA,sBAC9B,CAAC,UAAU,MAAM,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA,sBAC5C,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,CAAC;AAAA,aACU,CAAC,UAAU,MAAM,MAAM,MAAM,EAAE;AAAA;AAAA,wBAEpB,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,CAAC;AAAA;AAAA,YAEO,CAAC,UAAW,MAAM,eAAe,aAAa,SAAU;AAAA,IAChE,CAAC,UAAU,MAAM,YAAY,cAAc;AAAA;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type {} from '@elliemae/ds-system';\nimport { styled, lockedStateInteractionCss } 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})<{ $disabled?: boolean }>`\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 ${lockedStateInteractionCss}\n`;\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,QAAQ,iCAAiC;AAClD,SAAS,YAAY;AACrB,SAAS,gBAAgB,qBAAqB,sBAAsB;AAepE,MAAM,cAAc,CAAC,UACnB,gLACE,oBAAoB,aACtB,SAAS,oBAAoB,aAAa,aAAa,mBAAmB,KAAK,CAAC,mBAC9E,oBAAoB,YACtB;AASK,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;AAAA,sBAC9B,CAAC,UAAU,MAAM,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA,sBAC5C,CAAC,UAAU;AAC7B,MAAI,MAAM,WAAW;AACnB,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,CAAC;AAAA,aACU,CAAC,UAAU,MAAM,MAAM,MAAM,EAAE;AAAA;AAAA,wBAEpB,CAAC,UAAU;AAC7B,MAAI,MAAM,WAAW;AACnB,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,CAAC;AAAA;AAAA,YAEO,CAAC,UAAW,MAAM,eAAe,aAAa,SAAU;AAAA,IAChE,yBAAyB;AAAA;",
6
6
  "names": []
7
7
  }
@@ -1,10 +1,12 @@
1
1
  interface DropzoneStyledProps {
2
2
  isDragActive: boolean;
3
- disabled: boolean;
3
+ $disabled: boolean;
4
4
  hasError: boolean;
5
5
  getOwnerProps: () => object;
6
6
  getOwnerPropsArguments: () => object;
7
7
  }
8
- 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>;
8
+ 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, {
9
+ $disabled?: boolean;
10
+ } & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<import("react").ForwardRefExoticComponent<import("@elliemae/ds-grid").DSGridT.Props & import("react").RefAttributes<HTMLDivElement>>>, never>;
9
11
  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>;
10
12
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-dropzone",
3
- "version": "3.80.0-next.72",
3
+ "version": "3.80.0-next.75",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Dropzone",
6
6
  "files": [
@@ -36,16 +36,16 @@
36
36
  "indent": 4
37
37
  },
38
38
  "dependencies": {
39
- "@elliemae/ds-grid": "3.80.0-next.72",
40
- "@elliemae/ds-hooks-fontsize-media": "3.80.0-next.72",
41
- "@elliemae/ds-icons": "3.80.0-next.72",
42
- "@elliemae/ds-props-helpers": "3.80.0-next.72",
43
- "@elliemae/ds-system": "3.80.0-next.72",
44
- "@elliemae/ds-typography": "3.80.0-next.72",
39
+ "@elliemae/ds-grid": "3.80.0-next.75",
40
+ "@elliemae/ds-hooks-fontsize-media": "3.80.0-next.75",
41
+ "@elliemae/ds-icons": "3.80.0-next.75",
42
+ "@elliemae/ds-props-helpers": "3.80.0-next.75",
43
+ "@elliemae/ds-system": "3.80.0-next.75",
44
+ "@elliemae/ds-typography": "3.80.0-next.75",
45
45
  "uid": "^2.0.2"
46
46
  },
47
47
  "devDependencies": {
48
- "@elliemae/ds-monorepo-devops": "3.80.0-next.72",
48
+ "@elliemae/ds-monorepo-devops": "3.80.0-next.75",
49
49
  "lodash-es": "^4.18.1",
50
50
  "styled-components": "~5.3.11"
51
51
  },