@elliemae/ds-dropzone 3.80.0-next.72 → 3.80.0-next.76
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.
- package/dist/cjs/DSDropzone.js +12 -4
- package/dist/cjs/DSDropzone.js.map +2 -2
- package/dist/cjs/config/useDSDropzone.js +3 -2
- package/dist/cjs/config/useDSDropzone.js.map +2 -2
- package/dist/cjs/parts/DSActivezone/DSActivezone.js +16 -3
- package/dist/cjs/parts/DSActivezone/DSActivezone.js.map +3 -3
- package/dist/cjs/parts/DSActivezone/config/useActivezone.js +1 -8
- package/dist/cjs/parts/DSActivezone/config/useActivezone.js.map +2 -2
- package/dist/cjs/parts/DSActivezone/react-desc-prop-types.js +8 -0
- package/dist/cjs/parts/DSActivezone/react-desc-prop-types.js.map +2 -2
- package/dist/cjs/react-desc-prop-types.js +7 -4
- package/dist/cjs/react-desc-prop-types.js.map +2 -2
- package/dist/cjs/styled.js +3 -7
- package/dist/cjs/styled.js.map +2 -2
- package/dist/cjs/typescript-testing/slot-props.js +52 -0
- package/dist/cjs/typescript-testing/slot-props.js.map +7 -0
- package/dist/esm/DSDropzone.js +14 -6
- package/dist/esm/DSDropzone.js.map +2 -2
- package/dist/esm/config/useDSDropzone.js +3 -2
- package/dist/esm/config/useDSDropzone.js.map +2 -2
- package/dist/esm/parts/DSActivezone/DSActivezone.js +16 -3
- package/dist/esm/parts/DSActivezone/DSActivezone.js.map +3 -3
- package/dist/esm/parts/DSActivezone/config/useActivezone.js +1 -8
- package/dist/esm/parts/DSActivezone/config/useActivezone.js.map +2 -2
- package/dist/esm/parts/DSActivezone/react-desc-prop-types.js +14 -1
- package/dist/esm/parts/DSActivezone/react-desc-prop-types.js.map +2 -2
- package/dist/esm/react-desc-prop-types.js +13 -5
- package/dist/esm/react-desc-prop-types.js.map +2 -2
- package/dist/esm/styled.js +4 -8
- package/dist/esm/styled.js.map +2 -2
- package/dist/esm/typescript-testing/slot-props.js +29 -0
- package/dist/esm/typescript-testing/slot-props.js.map +7 -0
- package/dist/types/config/useDSDropzone.d.ts +3 -3
- package/dist/types/parts/DSActivezone/config/useActivezone.d.ts +3 -3
- package/dist/types/parts/DSActivezone/react-desc-prop-types.d.ts +13 -1
- package/dist/types/react-desc-prop-types.d.ts +11 -1
- package/dist/types/styled.d.ts +4 -2
- package/package.json +9 -8
package/dist/cjs/DSDropzone.js
CHANGED
|
@@ -42,6 +42,11 @@ var import_useDSDropzone = require("./config/useDSDropzone.js");
|
|
|
42
42
|
var import_constants = require("./constants/index.js");
|
|
43
43
|
var import_styled = require("./styled.js");
|
|
44
44
|
var import_DSActivezone = require("./parts/DSActivezone/DSActivezone.js");
|
|
45
|
+
const ACTIVEZONE_SLOT_PROPS = [
|
|
46
|
+
"dsDropzoneActivezoneWrapper",
|
|
47
|
+
"dsDropzoneActivezoneIcon",
|
|
48
|
+
"dsDropzoneActivezoneLabel"
|
|
49
|
+
];
|
|
45
50
|
const DSDropzone = (props) => {
|
|
46
51
|
const {
|
|
47
52
|
propsWithDefault,
|
|
@@ -55,7 +60,10 @@ const DSDropzone = (props) => {
|
|
|
55
60
|
} = (0, import_useDSDropzone.useDSDropzone)(props);
|
|
56
61
|
const getOwnerProps = import_react.default.useCallback(() => propsWithDefault, [propsWithDefault]);
|
|
57
62
|
const getOwnerPropsArguments = import_react.default.useCallback(() => ({}), []);
|
|
58
|
-
const safeGlobalProps = (0,
|
|
63
|
+
const safeGlobalProps = (0, import_ds_props_helpers.omitLockedHandlers)(
|
|
64
|
+
(0, import_ds_props_helpers.omitLockAttributes)((0, import_lodash_es.omit)(globalProps, "onDrop", "hasError")),
|
|
65
|
+
Boolean(propsWithDefault.disabled)
|
|
66
|
+
);
|
|
59
67
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
60
68
|
import_styled.StyledDropZoneHolder,
|
|
61
69
|
{
|
|
@@ -63,7 +71,7 @@ const DSDropzone = (props) => {
|
|
|
63
71
|
...xstyledProps,
|
|
64
72
|
getOwnerProps,
|
|
65
73
|
getOwnerPropsArguments,
|
|
66
|
-
disabled: Boolean(propsWithDefault.disabled),
|
|
74
|
+
$disabled: Boolean(propsWithDefault.disabled),
|
|
67
75
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
68
76
|
import_styled.StyledDropZone,
|
|
69
77
|
{
|
|
@@ -72,13 +80,13 @@ const DSDropzone = (props) => {
|
|
|
72
80
|
onDragLeave: onDragLeaveHandler,
|
|
73
81
|
onDrop: onDropHandler,
|
|
74
82
|
hasError: Boolean(propsWithDefault.hasError),
|
|
75
|
-
disabled: Boolean(propsWithDefault.disabled),
|
|
83
|
+
$disabled: Boolean(propsWithDefault.disabled),
|
|
76
84
|
isDragActive: isDragInside,
|
|
77
85
|
getOwnerProps,
|
|
78
86
|
getOwnerPropsArguments,
|
|
79
87
|
children: [
|
|
80
88
|
propsWithDefault.children,
|
|
81
|
-
isDragInside ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DSActivezone.DSActivezone, {}) : null
|
|
89
|
+
isDragInside ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DSActivezone.DSActivezone, { ...(0, import_lodash_es.pick)(propsWithDefault, ACTIVEZONE_SLOT_PROPS) }) : null
|
|
82
90
|
]
|
|
83
91
|
}
|
|
84
92
|
)
|
|
@@ -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;
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { describe, omitLockAttributes, omitLockedHandlers } from '@elliemae/ds-props-helpers';\nimport { omit, pick } 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\n// the slot props of the slots that live in the activezone: DSDropzone renders the activezone while a file is dragged\n// over it, so it forwards them (the other slots are read from the props of DSDropzone itself)\nconst ACTIVEZONE_SLOT_PROPS = [\n 'dsDropzoneActivezoneWrapper',\n 'dsDropzoneActivezoneIcon',\n 'dsDropzoneActivezoneLabel',\n] as const;\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 {...pick(propsWithDefault, ACTIVEZONE_SLOT_PROPS)} /> : 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;AD4CjB;AA5CN,mBAAkB;AAClB,8BAAiE;AACjE,uBAA2B;AAC3B,mCAA4D;AAC5D,2BAA8B;AAC9B,uBAA+B;AAC/B,oBAAqD;AACrD,0BAA6B;AAI7B,MAAM,wBAAwB;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AACF;AAEA,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,oCAAc,OAAG,uBAAK,kBAAkB,qBAAqB,GAAG,IAAK;AAAA;AAAA;AAAA,MACxF;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
|
-
|
|
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
|
|
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;
|
|
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 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;AAIxD,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
|
}
|
|
@@ -34,6 +34,7 @@ __export(DSActivezone_exports, {
|
|
|
34
34
|
module.exports = __toCommonJS(DSActivezone_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_ds_hooks_fontsize_media = require("@elliemae/ds-hooks-fontsize-media");
|
|
39
40
|
var import_ds_system = require("@elliemae/ds-system");
|
|
@@ -64,6 +65,8 @@ const DSActivezone = (props) => {
|
|
|
64
65
|
const { propsWithDefault, globalProps, xstyledProps } = (0, import_useActivezone.useActivezone)(props);
|
|
65
66
|
const { Icon, label } = propsWithDefault;
|
|
66
67
|
const mainContentCols = (0, import_ds_hooks_fontsize_media.useFontsizeMedia)(colsDef);
|
|
68
|
+
const getOwnerProps = import_react.default.useCallback(() => propsWithDefault, [propsWithDefault]);
|
|
69
|
+
const getOwnerPropsArguments = import_react.default.useCallback(() => ({}), []);
|
|
67
70
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
68
71
|
StyledWrapper,
|
|
69
72
|
{
|
|
@@ -73,12 +76,22 @@ const DSActivezone = (props) => {
|
|
|
73
76
|
bg: "brand-600",
|
|
74
77
|
gutter: "xxs",
|
|
75
78
|
cols: mainContentCols,
|
|
76
|
-
getOwnerProps
|
|
79
|
+
getOwnerProps,
|
|
80
|
+
getOwnerPropsArguments,
|
|
77
81
|
...globalProps,
|
|
78
82
|
...xstyledProps,
|
|
79
83
|
children: [
|
|
80
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledIcon, { justifyContent: "center", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { size: "l", color: ["neutral", "0"] }) }),
|
|
81
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
84
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledIcon, { justifyContent: "center", getOwnerProps, getOwnerPropsArguments, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { size: "l", color: ["neutral", "0"] }) }),
|
|
85
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
86
|
+
StyledLabel,
|
|
87
|
+
{
|
|
88
|
+
variant: "b2",
|
|
89
|
+
color: "neutral-000",
|
|
90
|
+
getOwnerProps,
|
|
91
|
+
getOwnerPropsArguments,
|
|
92
|
+
children: label
|
|
93
|
+
}
|
|
94
|
+
)
|
|
82
95
|
]
|
|
83
96
|
}
|
|
84
97
|
);
|
|
@@ -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 { styled } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\nimport { DSTypography } from '@elliemae/ds-typography';\nimport { type DSActivezoneT, DSActivezonePropTypesSchema } from './react-desc-prop-types.js';\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={
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport { useFontsizeMedia } from '@elliemae/ds-hooks-fontsize-media';\nimport { styled } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\nimport { DSTypography } from '@elliemae/ds-typography';\nimport { type DSActivezoneT, DSActivezonePropTypesSchema } from './react-desc-prop-types.js';\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 const getOwnerProps = React.useCallback(() => propsWithDefault, [propsWithDefault]);\n const getOwnerPropsArguments = React.useCallback(() => ({}), []);\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={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n {...globalProps}\n {...xstyledProps}\n >\n <StyledIcon justifyContent=\"center\" getOwnerProps={getOwnerProps} getOwnerPropsArguments={getOwnerPropsArguments}>\n <Icon size=\"l\" color={['neutral', '0']} />\n </StyledIcon>\n <StyledLabel\n variant=\"b2\"\n color=\"neutral-000\"\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\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;ADqCnB;AArCJ,mBAAkB;AAClB,8BAAyB;AACzB,qCAAiC;AACjC,uBAAuB;AACvB,qBAAqB;AACrB,2BAA6B;AAC7B,mCAAgE;AAChE,2BAA8B;AAC9B,uBAAoE;AAEpE,MAAM,oBAAgB,yBAAO,qBAAM,EAAE,MAAM,iCAAgB,MAAM,gCAAe,mBAAmB,CAAC;AAAA;AAAA;AAAA,mBAGjF,qCAAoB,aAAa;AAAA,aACvC,CAAC,UAAU,MAAM,MAAM,MAAM,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAO9C,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,QAAM,gBAAgB,aAAAA,QAAM,YAAY,MAAM,kBAAkB,CAAC,gBAAgB,CAAC;AAClF,QAAM,yBAAyB,aAAAA,QAAM,YAAY,OAAO,CAAC,IAAI,CAAC,CAAC;AAC/D,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;AAAA,MACA;AAAA,MACC,GAAG;AAAA,MACH,GAAG;AAAA,MAEJ;AAAA,oDAAC,cAAW,gBAAe,UAAS,eAA8B,wBAChE,sDAAC,QAAK,MAAK,KAAI,OAAO,CAAC,WAAW,GAAG,GAAG,GAC1C;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,SAAQ;AAAA,YACR,OAAM;AAAA,YACN;AAAA,YACA;AAAA,YAEC;AAAA;AAAA,QACH;AAAA;AAAA;AAAA,EACF;AAEJ;AAEA,aAAa,cAAc;AAC3B,MAAM,6BAAyB,kCAAS,YAAY;AACpD,uBAAuB,YAAY;",
|
|
6
|
+
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -52,15 +52,8 @@ const useActivezone = (propsFromUser) => {
|
|
|
52
52
|
globalProps,
|
|
53
53
|
xstyledProps,
|
|
54
54
|
instanceUid
|
|
55
|
-
// ...eventHandlers,
|
|
56
55
|
}),
|
|
57
|
-
[
|
|
58
|
-
propsWithDefault,
|
|
59
|
-
globalProps,
|
|
60
|
-
xstyledProps,
|
|
61
|
-
instanceUid
|
|
62
|
-
// eventHandlers,
|
|
63
|
-
]
|
|
56
|
+
[propsWithDefault, globalProps, xstyledProps, instanceUid]
|
|
64
57
|
);
|
|
65
58
|
};
|
|
66
59
|
//# sourceMappingURL=useActivezone.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/parts/DSActivezone/config/useActivezone.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 DSActivezoneT, DSActivezonePropTypes, defaultProps } from '../react-desc-prop-types.js';\nimport { useValidateProps } from './useValidateProps.js';\n\nexport const useActivezone = (propsFromUser: DSActivezoneT.Props) => {\n // =============================================================================\n // MERGE WITH DEFAULT AND VALIDATE PROPS\n // =============================================================================\n const propsWithDefault = useMemoMergePropsWithDefault<DSActivezoneT.InternalProps>(propsFromUser, defaultProps);\n useValidateProps(propsWithDefault, DSActivezonePropTypes);\n // =============================================================================\n // GLOBAL ATTRIBUTES & XSTYLED PROPS\n // =============================================================================\n const globalProps = useGetGlobalAttributes<DSActivezoneT.InternalProps, HTMLDivElement, DSGridT.Props>(\n propsWithDefault,\n );\n const xstyledProps = useGetXstyledProps(propsWithDefault);\n // =============================================================================\n // AD HOC PER COMPONENT LOGIC\n // =============================================================================\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAClB,8BAAyF;AACzF,iBAAoB;AAEpB,mCAAwE;AACxE,8BAAiC;AAE1B,MAAM,gBAAgB,CAAC,kBAAuC;AAInE,QAAM,uBAAmB,sDAA0D,eAAe,yCAAY;AAC9G,gDAAiB,kBAAkB,kDAAqB;AAIxD,QAAM,kBAAc;AAAA,IAClB;AAAA,EACF;AACA,QAAM,mBAAe,4CAAmB,gBAAgB;
|
|
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 DSActivezoneT, DSActivezonePropTypes, defaultProps } from '../react-desc-prop-types.js';\nimport { useValidateProps } from './useValidateProps.js';\n\nexport const useActivezone = (propsFromUser: DSActivezoneT.Props) => {\n // =============================================================================\n // MERGE WITH DEFAULT AND VALIDATE PROPS\n // =============================================================================\n const propsWithDefault = useMemoMergePropsWithDefault<DSActivezoneT.InternalProps>(propsFromUser, defaultProps);\n useValidateProps(propsWithDefault, DSActivezonePropTypes);\n // =============================================================================\n // GLOBAL ATTRIBUTES & XSTYLED PROPS\n // =============================================================================\n const globalProps = useGetGlobalAttributes<DSActivezoneT.InternalProps, HTMLDivElement, DSGridT.Props>(\n propsWithDefault,\n );\n const xstyledProps = useGetXstyledProps(propsWithDefault);\n // =============================================================================\n // AD HOC PER COMPONENT LOGIC\n // =============================================================================\n const { id } = propsWithDefault;\n const instanceUid = React.useMemo(() => id || uid(5), [id]);\n\n // =============================================================================\n // HELPERS HOOKS CONFIGS\n // =============================================================================\n\n return React.useMemo(\n () => ({\n propsWithDefault,\n globalProps,\n xstyledProps,\n instanceUid,\n }),\n [propsWithDefault, globalProps, xstyledProps, instanceUid],\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,mCAAwE;AACxE,8BAAiC;AAE1B,MAAM,gBAAgB,CAAC,kBAAuC;AAInE,QAAM,uBAAmB,sDAA0D,eAAe,yCAAY;AAC9G,gDAAiB,kBAAkB,kDAAqB;AAIxD,QAAM,kBAAc;AAAA,IAClB;AAAA,EACF;AACA,QAAM,mBAAe,4CAAmB,gBAAgB;AAIxD,QAAM,EAAE,GAAG,IAAI;AACf,QAAM,cAAc,aAAAA,QAAM,QAAQ,MAAM,UAAM,gBAAI,CAAC,GAAG,CAAC,EAAE,CAAC;AAM1D,SAAO,aAAAA,QAAM;AAAA,IACX,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,kBAAkB,aAAa,cAAc,WAAW;AAAA,EAC3D;AACF;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -28,6 +28,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var react_desc_prop_types_exports = {};
|
|
30
30
|
__export(react_desc_prop_types_exports, {
|
|
31
|
+
ACTIVEZONE_SLOTS: () => ACTIVEZONE_SLOTS,
|
|
31
32
|
DSActivezonePropTypes: () => DSActivezonePropTypes,
|
|
32
33
|
DSActivezonePropTypesSchema: () => DSActivezonePropTypesSchema,
|
|
33
34
|
defaultProps: () => defaultProps
|
|
@@ -36,11 +37,18 @@ module.exports = __toCommonJS(react_desc_prop_types_exports);
|
|
|
36
37
|
var React = __toESM(require("react"));
|
|
37
38
|
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
38
39
|
var import_ds_icons = require("@elliemae/ds-icons");
|
|
40
|
+
var import_constants = require("../../constants/index.js");
|
|
41
|
+
const ACTIVEZONE_SLOTS = {
|
|
42
|
+
ACTIVEZONE_LABEL: import_constants.DROPZONE_SLOTS.ACTIVEZONE_LABEL,
|
|
43
|
+
ACTIVEZONE_ICON: import_constants.DROPZONE_SLOTS.ACTIVEZONE_ICON,
|
|
44
|
+
ACTIVEZONE_WRAPPER: import_constants.DROPZONE_SLOTS.ACTIVEZONE_WRAPPER
|
|
45
|
+
};
|
|
39
46
|
const defaultProps = {
|
|
40
47
|
Icon: import_ds_icons.UploadFile,
|
|
41
48
|
label: "DROP FILES HERE"
|
|
42
49
|
};
|
|
43
50
|
const DSActivezonePropTypes = {
|
|
51
|
+
...(0, import_ds_props_helpers.getPropsPerSlotPropTypes)(import_constants.DSDropzoneName, ACTIVEZONE_SLOTS),
|
|
44
52
|
...import_ds_props_helpers.globalAttributesPropTypes,
|
|
45
53
|
...import_ds_props_helpers.xstyledPropTypes,
|
|
46
54
|
Icon: import_ds_props_helpers.PropTypes.func.description("Custom Icon").defaultValue("UploadFile"),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/DSActivezone/react-desc-prop-types.ts", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-redundant-type-constituents */\nimport type { GlobalAttributesT, XstyledProps, DSPropTypesSchema } from '@elliemae/ds-props-helpers';\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,
|
|
4
|
+
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-redundant-type-constituents */\nimport type { GlobalAttributesT, XstyledProps, DSPropTypesSchema } from '@elliemae/ds-props-helpers';\nimport {\n PropTypes,\n getPropsPerSlotPropTypes,\n globalAttributesPropTypes,\n xstyledPropTypes,\n} from '@elliemae/ds-props-helpers';\nimport type { TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport type { SvgIconT } from '@elliemae/ds-icons';\nimport { UploadFile } from '@elliemae/ds-icons';\nimport type { WeakValidationMap } from 'react';\nimport { DSDropzoneName, DROPZONE_SLOTS } from '../../constants/index.js';\n\n// the slots that live in the activezone (they only exist while a file is dragged over the dropzone)\nexport const ACTIVEZONE_SLOTS = {\n ACTIVEZONE_LABEL: DROPZONE_SLOTS.ACTIVEZONE_LABEL,\n ACTIVEZONE_ICON: DROPZONE_SLOTS.ACTIVEZONE_ICON,\n ACTIVEZONE_WRAPPER: DROPZONE_SLOTS.ACTIVEZONE_WRAPPER,\n} as const;\n\nexport declare namespace DSActivezoneT {\n export interface RequiredProps {}\n\n export interface DefaultProps {\n Icon: React.ComponentType<SvgIconT.Props>;\n label: string;\n }\n\n export type SlotFunctionArguments = {\n dsDropzoneActivezoneWrapper: () => object;\n dsDropzoneActivezoneIcon: () => object;\n dsDropzoneActivezoneLabel: () => object;\n };\n\n export interface OptionalProps extends TypescriptHelpersT.PropsForGlobalOnSlots<\n typeof DSDropzoneName,\n typeof ACTIVEZONE_SLOTS\n > {}\n\n export interface Props\n extends\n Partial<DefaultProps>,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof XstyledProps>,\n XstyledProps,\n RequiredProps {}\n\n export interface InternalProps\n extends\n DefaultProps,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof XstyledProps>,\n XstyledProps,\n RequiredProps {}\n}\n\nexport const defaultProps: DSActivezoneT.DefaultProps = {\n Icon: UploadFile,\n label: 'DROP FILES HERE',\n};\n\nexport const DSActivezonePropTypes: DSPropTypesSchema<DSActivezoneT.Props> = {\n ...getPropsPerSlotPropTypes(DSDropzoneName, ACTIVEZONE_SLOTS),\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n Icon: PropTypes.func.description('Custom Icon').defaultValue('UploadFile'),\n label: PropTypes.string.description('Active zone label').defaultValue(defaultProps.label),\n};\n\nexport const DSActivezonePropTypesSchema = DSActivezonePropTypes as unknown as WeakValidationMap<DSActivezoneT.Props>;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,8BAKO;AAGP,sBAA2B;AAE3B,uBAA+C;AAGxC,MAAM,mBAAmB;AAAA,EAC9B,kBAAkB,gCAAe;AAAA,EACjC,iBAAiB,gCAAe;AAAA,EAChC,oBAAoB,gCAAe;AACrC;AAsCO,MAAM,eAA2C;AAAA,EACtD,MAAM;AAAA,EACN,OAAO;AACT;AAEO,MAAM,wBAAgE;AAAA,EAC3E,OAAG,kDAAyB,iCAAgB,gBAAgB;AAAA,EAC5D,GAAG;AAAA,EACH,GAAG;AAAA,EACH,MAAM,kCAAU,KAAK,YAAY,aAAa,EAAE,aAAa,YAAY;AAAA,EACzE,OAAO,kCAAU,OAAO,YAAY,mBAAmB,EAAE,aAAa,aAAa,KAAK;AAC1F;AAEO,MAAM,8BAA8B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -35,14 +35,17 @@ __export(react_desc_prop_types_exports, {
|
|
|
35
35
|
module.exports = __toCommonJS(react_desc_prop_types_exports);
|
|
36
36
|
var React = __toESM(require("react"));
|
|
37
37
|
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
var import_constants = require("./constants/index.js");
|
|
39
|
+
const defaultProps = {};
|
|
40
|
+
const slotPropTypes = (0, import_ds_props_helpers.getPropsPerSlotPropTypes)(import_constants.DSDropzoneName, import_constants.DROPZONE_SLOTS);
|
|
41
41
|
const DSDropzonePropTypes = {
|
|
42
|
+
...slotPropTypes,
|
|
42
43
|
...import_ds_props_helpers.globalAttributesPropTypes,
|
|
43
44
|
...import_ds_props_helpers.xstyledPropTypes,
|
|
44
45
|
children: import_ds_props_helpers.PropTypes.any,
|
|
45
|
-
disabled: import_ds_props_helpers.PropTypes.bool.description(
|
|
46
|
+
disabled: import_ds_props_helpers.PropTypes.bool.description(
|
|
47
|
+
"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."
|
|
48
|
+
),
|
|
46
49
|
hasError: import_ds_props_helpers.PropTypes.bool.description("Show error border color"),
|
|
47
50
|
onDrop: import_ds_props_helpers.PropTypes.func.description(
|
|
48
51
|
`
|
|
@@ -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 {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,
|
|
4
|
+
"sourcesContent": ["import type { GlobalAttributesT, XstyledProps, DSPropTypesSchema } from '@elliemae/ds-props-helpers';\nimport {\n PropTypes,\n getPropsPerSlotPropTypes,\n globalAttributesPropTypes,\n xstyledPropTypes,\n} from '@elliemae/ds-props-helpers';\nimport type { TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport type { WeakValidationMap } from 'react';\nimport { DSDropzoneName, DROPZONE_SLOTS } from './constants/index.js';\n\nexport declare namespace DSDropzoneT {\n export interface RequiredProps {}\n\n export interface DefaultProps {}\n\n // the slots of the dropzone repeat for no instance (one wrapper, one holder, one activezone): the function form\n // receives an empty object of arguments\n export type SlotFunctionArguments = {\n dsDropzoneWrapper_holder: () => object;\n dsDropzoneWrapper: () => object;\n dsDropzoneActivezoneWrapper: () => object;\n dsDropzoneActivezoneIcon: () => object;\n dsDropzoneActivezoneLabel: () => object;\n };\n\n // the slot WRAPPER_HOLDER is published as 'wrapper_holder' (snake case, a name the theme styleOverrides and the\n // data-dimsum-slot already depend on), so the prop name at runtime is dsDropzoneWrapper_holder, while the helper type\n // would derive dsDropzoneWrapperHolder. The helper types every other slot; the holder is typed by hand.\n // Tracked in KNOWN_INTENTIONAL_DEVIATIONS.md\n export interface OptionalProps extends TypescriptHelpersT.PropsForGlobalOnSlots<\n typeof DSDropzoneName,\n Omit<typeof DROPZONE_SLOTS, 'WRAPPER_HOLDER'>\n > {\n dsDropzoneWrapper_holder?: object | ((args: object) => object);\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\n// the generator builds the right keys at runtime (dsDropzoneWrapper_holder), but its return type derives\n// dsDropzoneWrapperHolder from the snake case slot: the cast restores the keys of the props (see KNOWN_INTENTIONAL_DEVIATIONS.md)\nconst slotPropTypes = getPropsPerSlotPropTypes(DSDropzoneName, DROPZONE_SLOTS) as unknown as Pick<\n DSPropTypesSchema<DSDropzoneT.Props>,\n | 'dsDropzoneWrapper_holder'\n | 'dsDropzoneWrapper'\n | 'dsDropzoneActivezoneWrapper'\n | 'dsDropzoneActivezoneIcon'\n | 'dsDropzoneActivezoneLabel'\n>;\n\nexport const DSDropzonePropTypes: DSPropTypesSchema<DSDropzoneT.Props> = {\n ...slotPropTypes,\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,8BAKO;AAGP,uBAA+C;AAiDxC,MAAM,eAAyC,CAAC;AAIvD,MAAM,oBAAgB,kDAAyB,iCAAgB,+BAAc;AAStE,MAAM,sBAA4D;AAAA,EACvE,GAAG;AAAA,EACH,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
|
}
|
package/dist/cjs/styled.js
CHANGED
|
@@ -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
|
|
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
|
|
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
|
-
${
|
|
77
|
+
${import_ds_system.lockedStateInteractionCss}
|
|
82
78
|
`;
|
|
83
79
|
//# sourceMappingURL=styled.js.map
|
package/dist/cjs/styled.js.map
CHANGED
|
@@ -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,
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,
|
|
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\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
|
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var React = __toESM(require("react"));
|
|
25
|
+
const SlotPropsAsObj = {
|
|
26
|
+
dsDropzoneWrapper_holder: { "aria-label": "just a typescript test" },
|
|
27
|
+
dsDropzoneWrapper: { "aria-label": "just a typescript test" },
|
|
28
|
+
dsDropzoneActivezoneWrapper: { "aria-label": "just a typescript test" },
|
|
29
|
+
dsDropzoneActivezoneIcon: { "aria-label": "just a typescript test" },
|
|
30
|
+
dsDropzoneActivezoneLabel: { "aria-label": "just a typescript test" }
|
|
31
|
+
};
|
|
32
|
+
const SlotPropsAsFunctions = {
|
|
33
|
+
dsDropzoneWrapper_holder: () => ({ "aria-label": "just a typescript test" }),
|
|
34
|
+
dsDropzoneWrapper: () => ({ "aria-label": "just a typescript test" }),
|
|
35
|
+
dsDropzoneActivezoneWrapper: () => ({ "aria-label": "just a typescript test" }),
|
|
36
|
+
dsDropzoneActivezoneIcon: () => ({ "aria-label": "just a typescript test" }),
|
|
37
|
+
dsDropzoneActivezoneLabel: () => ({ "aria-label": "just a typescript test" })
|
|
38
|
+
};
|
|
39
|
+
const EnsureAllSlotsExistInSlotFunctionArguments = SlotPropsAsFunctions;
|
|
40
|
+
const EnsureHolderSlotExistsInSlotFunctionArguments = SlotPropsAsFunctions;
|
|
41
|
+
const ActivezoneSlotPropsAsObj = {
|
|
42
|
+
dsDropzoneActivezoneWrapper: { "aria-label": "just a typescript test" },
|
|
43
|
+
dsDropzoneActivezoneIcon: { "aria-label": "just a typescript test" },
|
|
44
|
+
dsDropzoneActivezoneLabel: { "aria-label": "just a typescript test" }
|
|
45
|
+
};
|
|
46
|
+
const ActivezoneSlotPropsAsFunctions = {
|
|
47
|
+
dsDropzoneActivezoneWrapper: () => ({ "aria-label": "just a typescript test" }),
|
|
48
|
+
dsDropzoneActivezoneIcon: () => ({ "aria-label": "just a typescript test" }),
|
|
49
|
+
dsDropzoneActivezoneLabel: () => ({ "aria-label": "just a typescript test" })
|
|
50
|
+
};
|
|
51
|
+
const EnsureAllActivezoneSlotsExistInSlotFunctionArguments = ActivezoneSlotPropsAsFunctions;
|
|
52
|
+
//# sourceMappingURL=slot-props.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/typescript-testing/slot-props.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\n\nimport type { TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport type { DSDropzoneName, DROPZONE_SLOTS } from '../constants/index.js';\nimport type { DSDropzoneT } from '../react-desc-prop-types.js';\nimport type { ACTIVEZONE_SLOTS, DSActivezoneT } from '../parts/DSActivezone/react-desc-prop-types.js';\n\nconst SlotPropsAsObj: Partial<DSDropzoneT.Props> = {\n dsDropzoneWrapper_holder: { 'aria-label': 'just a typescript test' },\n dsDropzoneWrapper: { 'aria-label': 'just a typescript test' },\n dsDropzoneActivezoneWrapper: { 'aria-label': 'just a typescript test' },\n dsDropzoneActivezoneIcon: { 'aria-label': 'just a typescript test' },\n dsDropzoneActivezoneLabel: { 'aria-label': 'just a typescript test' },\n};\n\nconst SlotPropsAsFunctions: DSDropzoneT.SlotFunctionArguments = {\n dsDropzoneWrapper_holder: () => ({ 'aria-label': 'just a typescript test' }),\n dsDropzoneWrapper: () => ({ 'aria-label': 'just a typescript test' }),\n dsDropzoneActivezoneWrapper: () => ({ 'aria-label': 'just a typescript test' }),\n dsDropzoneActivezoneIcon: () => ({ 'aria-label': 'just a typescript test' }),\n dsDropzoneActivezoneLabel: () => ({ 'aria-label': 'just a typescript test' }),\n};\n\n// Exhaustiveness check \u2014 fails compilation if a slot is missing from SlotFunctionArguments\n// The helper derives `dsDropzoneWrapperHolder` from the snake case slot 'wrapper_holder', but the prop of that slot\n// is `dsDropzoneWrapper_holder` (see KNOWN_INTENTIONAL_DEVIATIONS.md): it is checked by hand through its explicit entry\n// above, and the helper checks all the other slots.\nconst EnsureAllSlotsExistInSlotFunctionArguments: Required<\n TypescriptHelpersT.PropsForSlots<typeof DSDropzoneName, Omit<typeof DROPZONE_SLOTS, 'WRAPPER_HOLDER'>>\n> = SlotPropsAsFunctions;\nconst EnsureHolderSlotExistsInSlotFunctionArguments: Required<\n Pick<DSDropzoneT.SlotFunctionArguments, 'dsDropzoneWrapper_holder'>\n> = SlotPropsAsFunctions;\n\n// The activezone part (DSActivezone) owns three of the slots, and it can be composed on its own\nconst ActivezoneSlotPropsAsObj: Partial<DSActivezoneT.Props> = {\n dsDropzoneActivezoneWrapper: { 'aria-label': 'just a typescript test' },\n dsDropzoneActivezoneIcon: { 'aria-label': 'just a typescript test' },\n dsDropzoneActivezoneLabel: { 'aria-label': 'just a typescript test' },\n};\n\nconst ActivezoneSlotPropsAsFunctions: DSActivezoneT.SlotFunctionArguments = {\n dsDropzoneActivezoneWrapper: () => ({ 'aria-label': 'just a typescript test' }),\n dsDropzoneActivezoneIcon: () => ({ 'aria-label': 'just a typescript test' }),\n dsDropzoneActivezoneLabel: () => ({ 'aria-label': 'just a typescript test' }),\n};\n\nconst EnsureAllActivezoneSlotsExistInSlotFunctionArguments: Required<\n TypescriptHelpersT.PropsForSlots<typeof DSDropzoneName, typeof ACTIVEZONE_SLOTS>\n> = ActivezoneSlotPropsAsFunctions;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAuB;ACOvB,MAAM,iBAA6C;AAAA,EACjD,0BAA0B,EAAE,cAAc,yBAAyB;AAAA,EACnE,mBAAmB,EAAE,cAAc,yBAAyB;AAAA,EAC5D,6BAA6B,EAAE,cAAc,yBAAyB;AAAA,EACtE,0BAA0B,EAAE,cAAc,yBAAyB;AAAA,EACnE,2BAA2B,EAAE,cAAc,yBAAyB;AACtE;AAEA,MAAM,uBAA0D;AAAA,EAC9D,0BAA0B,OAAO,EAAE,cAAc,yBAAyB;AAAA,EAC1E,mBAAmB,OAAO,EAAE,cAAc,yBAAyB;AAAA,EACnE,6BAA6B,OAAO,EAAE,cAAc,yBAAyB;AAAA,EAC7E,0BAA0B,OAAO,EAAE,cAAc,yBAAyB;AAAA,EAC1E,2BAA2B,OAAO,EAAE,cAAc,yBAAyB;AAC7E;AAMA,MAAM,6CAEF;AACJ,MAAM,gDAEF;AAGJ,MAAM,2BAAyD;AAAA,EAC7D,6BAA6B,EAAE,cAAc,yBAAyB;AAAA,EACtE,0BAA0B,EAAE,cAAc,yBAAyB;AAAA,EACnE,2BAA2B,EAAE,cAAc,yBAAyB;AACtE;AAEA,MAAM,iCAAsE;AAAA,EAC1E,6BAA6B,OAAO,EAAE,cAAc,yBAAyB;AAAA,EAC7E,0BAA0B,OAAO,EAAE,cAAc,yBAAyB;AAAA,EAC1E,2BAA2B,OAAO,EAAE,cAAc,yBAAyB;AAC7E;AAEA,MAAM,uDAEF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/esm/DSDropzone.js
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
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";
|
|
5
|
-
import { omit } from "lodash-es";
|
|
4
|
+
import { describe, omitLockAttributes, omitLockedHandlers } from "@elliemae/ds-props-helpers";
|
|
5
|
+
import { omit, pick } from "lodash-es";
|
|
6
6
|
import { DSDropzonePropTypesSchema } from "./react-desc-prop-types.js";
|
|
7
7
|
import { useDSDropzone } from "./config/useDSDropzone.js";
|
|
8
8
|
import { DSDropzoneName } from "./constants/index.js";
|
|
9
9
|
import { StyledDropZone, StyledDropZoneHolder } from "./styled.js";
|
|
10
10
|
import { DSActivezone } from "./parts/DSActivezone/DSActivezone.js";
|
|
11
|
+
const ACTIVEZONE_SLOT_PROPS = [
|
|
12
|
+
"dsDropzoneActivezoneWrapper",
|
|
13
|
+
"dsDropzoneActivezoneIcon",
|
|
14
|
+
"dsDropzoneActivezoneLabel"
|
|
15
|
+
];
|
|
11
16
|
const DSDropzone = (props) => {
|
|
12
17
|
const {
|
|
13
18
|
propsWithDefault,
|
|
@@ -21,7 +26,10 @@ const DSDropzone = (props) => {
|
|
|
21
26
|
} = useDSDropzone(props);
|
|
22
27
|
const getOwnerProps = React2.useCallback(() => propsWithDefault, [propsWithDefault]);
|
|
23
28
|
const getOwnerPropsArguments = React2.useCallback(() => ({}), []);
|
|
24
|
-
const safeGlobalProps =
|
|
29
|
+
const safeGlobalProps = omitLockedHandlers(
|
|
30
|
+
omitLockAttributes(omit(globalProps, "onDrop", "hasError")),
|
|
31
|
+
Boolean(propsWithDefault.disabled)
|
|
32
|
+
);
|
|
25
33
|
return /* @__PURE__ */ jsx(
|
|
26
34
|
StyledDropZoneHolder,
|
|
27
35
|
{
|
|
@@ -29,7 +37,7 @@ const DSDropzone = (props) => {
|
|
|
29
37
|
...xstyledProps,
|
|
30
38
|
getOwnerProps,
|
|
31
39
|
getOwnerPropsArguments,
|
|
32
|
-
disabled: Boolean(propsWithDefault.disabled),
|
|
40
|
+
$disabled: Boolean(propsWithDefault.disabled),
|
|
33
41
|
children: /* @__PURE__ */ jsxs(
|
|
34
42
|
StyledDropZone,
|
|
35
43
|
{
|
|
@@ -38,13 +46,13 @@ const DSDropzone = (props) => {
|
|
|
38
46
|
onDragLeave: onDragLeaveHandler,
|
|
39
47
|
onDrop: onDropHandler,
|
|
40
48
|
hasError: Boolean(propsWithDefault.hasError),
|
|
41
|
-
disabled: Boolean(propsWithDefault.disabled),
|
|
49
|
+
$disabled: Boolean(propsWithDefault.disabled),
|
|
42
50
|
isDragActive: isDragInside,
|
|
43
51
|
getOwnerProps,
|
|
44
52
|
getOwnerPropsArguments,
|
|
45
53
|
children: [
|
|
46
54
|
propsWithDefault.children,
|
|
47
|
-
isDragInside ? /* @__PURE__ */ jsx(DSActivezone, {}) : null
|
|
55
|
+
isDragInside ? /* @__PURE__ */ jsx(DSActivezone, { ...pick(propsWithDefault, ACTIVEZONE_SLOT_PROPS) }) : null
|
|
48
56
|
]
|
|
49
57
|
}
|
|
50
58
|
)
|
|
@@ -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;
|
|
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, pick } 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\n// the slot props of the slots that live in the activezone: DSDropzone renders the activezone while a file is dragged\n// over it, so it forwards them (the other slots are read from the props of DSDropzone itself)\nconst ACTIVEZONE_SLOT_PROPS = [\n 'dsDropzoneActivezoneWrapper',\n 'dsDropzoneActivezoneIcon',\n 'dsDropzoneActivezoneLabel',\n] as const;\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 {...pick(propsWithDefault, ACTIVEZONE_SLOT_PROPS)} /> : 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;AC4CjB,SAYkB,KAZlB;AA5CN,OAAOA,YAAW;AAClB,SAAS,UAAU,oBAAoB,0BAA0B;AACjE,SAAS,MAAM,YAAY;AAC3B,SAA2B,iCAAiC;AAC5D,SAAS,qBAAqB;AAC9B,SAAS,sBAAsB;AAC/B,SAAS,gBAAgB,4BAA4B;AACrD,SAAS,oBAAoB;AAI7B,MAAM,wBAAwB;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AACF;AAEA,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,gBAAc,GAAG,KAAK,kBAAkB,qBAAqB,GAAG,IAAK;AAAA;AAAA;AAAA,MACxF;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
|
-
|
|
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
|
() => ({
|