@react-spectrum/dropzone 3.0.0-nightly.4558 → 3.0.0-nightly.4564
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/DropZone.main.js +14 -3
- package/dist/DropZone.main.js.map +1 -1
- package/dist/DropZone.mjs +15 -4
- package/dist/DropZone.module.js +15 -4
- package/dist/DropZone.module.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +9 -9
- package/src/DropZone.tsx +41 -34
package/dist/DropZone.main.js
CHANGED
@@ -45,11 +45,22 @@ function $f7b7e7956f17a6e7$var$DropZone(props, ref) {
|
|
45
45
|
let { styleProps: styleProps } = (0, $7vttB$reactspectrumutils.useStyleProps)(props);
|
46
46
|
let domRef = (0, $7vttB$reactspectrumutils.useDOMRef)(ref);
|
47
47
|
let messageId = (0, $7vttB$reactariautils.useId)();
|
48
|
+
let headingId = (0, $7vttB$reactariautils.useId)();
|
48
49
|
let stringFormatter = (0, $7vttB$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($338e657e2a59c652$exports))), "@react-spectrum/dropzone");
|
49
|
-
|
50
|
+
let ariaLabelledby = isFilled ? `${headingId} ${messageId}` : headingId;
|
51
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($7vttB$react))).createElement((0, $7vttB$reactariacomponents.Provider), {
|
52
|
+
values: [
|
53
|
+
[
|
54
|
+
(0, $7vttB$reactariacomponents.HeadingContext),
|
55
|
+
{
|
56
|
+
id: headingId
|
57
|
+
}
|
58
|
+
]
|
59
|
+
]
|
60
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($7vttB$react))).createElement((0, $7vttB$reactariacomponents.DropZone), {
|
50
61
|
...(0, $7vttB$reactariautils.mergeProps)($f7b7e7956f17a6e7$var$filterProps(otherProps)),
|
51
62
|
...styleProps,
|
52
|
-
"aria-labelledby":
|
63
|
+
"aria-labelledby": ariaLabelledby,
|
53
64
|
className: (0, $7vttB$reactspectrumutils.classNames)((0, ($parcel$interopDefault($880edb5e40e39939$exports))), "spectrum-Dropzone", styleProps.className, {
|
54
65
|
"spectrum-Dropzone--filled": isFilled
|
55
66
|
}),
|
@@ -65,7 +76,7 @@ function $f7b7e7956f17a6e7$var$DropZone(props, ref) {
|
|
65
76
|
}), /*#__PURE__*/ (0, ($parcel$interopDefault($7vttB$react))).createElement("div", {
|
66
77
|
id: messageId,
|
67
78
|
className: (0, $7vttB$reactspectrumutils.classNames)((0, ($parcel$interopDefault($880edb5e40e39939$exports))), "spectrum-Dropzone-banner", styleProps.className)
|
68
|
-
}, replaceMessage ? replaceMessage : stringFormatter.format("replaceMessage")));
|
79
|
+
}, replaceMessage ? replaceMessage : stringFormatter.format("replaceMessage"))));
|
69
80
|
}
|
70
81
|
/**
|
71
82
|
* A drop zone is an area into which one or multiple objects can be dragged and dropped.
|
@@ -1 +1 @@
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAqBD,oFAAoF;AACpF,IAAI,oCAAc,CAAC;IACjB,6DAA6D;IAC7D,IAAI,gBAAC,YAAY,iBAAE,aAAa,cAAE,UAAU,EAAE,GAAG,YAAW,GAAG;IAC/D,OAAO;AACT;AAEA,SAAS,+BAAS,KAA4B,EAAE,GAA2B;IACzE,IAAI,YAAC,QAAQ,YAAE,QAAQ,kBAAE,cAAc,EAAE,GAAG,YAAW,GAAG;IAC1D,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,uCAAY,EAAE;IACjC,IAAI,SAAS,CAAA,GAAA,mCAAQ,EAAE;IACvB,IAAI,YAAY,CAAA,GAAA,2BAAI;IACpB,IAAI,kBAAkB,CAAA,GAAA,gDAA0B,EAAE,CAAA,GAAA,mDAAW,GAAG;
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAqBD,oFAAoF;AACpF,IAAI,oCAAc,CAAC;IACjB,6DAA6D;IA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,MAAM,CAAC;AAKpE;AAEA;;CAEC,GACD,IAAI,yDAAY,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/dropzone/src/DropZone.tsx"],"sourcesContent":["/*\n * Copyright 2023 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaLabelingProps, DOMProps, DOMRef, StyleProps} from '@react-types/shared';\nimport {classNames, SlotProvider, useDOMRef, useStyleProps} from '@react-spectrum/utils';\nimport {DropZoneProps, HeadingContext, Provider, DropZone as RACDropZone} from 'react-aria-components';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {mergeProps, useId} from '@react-aria/utils';\nimport React, {ReactNode} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/dropzone/vars.css';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface SpectrumDropZoneProps extends Omit<DropZoneProps, 'onHoverStart' | 'onHoverChange' | 'onHoverEnd' | 'isDisabled' | 'className' | 'style'>, DOMProps, StyleProps, AriaLabelingProps {\n /** The content to display in the drop zone. */\n children: ReactNode,\n /** Whether the drop zone has been filled. */\n isFilled?: boolean,\n /** The message to replace the default banner message that is shown when the drop zone is filled. */\n replaceMessage?: string\n}\n\n// Filter out props used by RAC DropZone that we don't want in RSP DropZone for now.\nlet filterProps = (props) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n let {onHoverStart, onHoverChange, onHoverEnd, ...otherProps} = props;\n return otherProps;\n};\n\nfunction DropZone(props: SpectrumDropZoneProps, ref: DOMRef<HTMLDivElement>) {\n let {children, isFilled, replaceMessage, ...otherProps} = props;\n let {styleProps} = useStyleProps(props);\n let domRef = useDOMRef(ref);\n let messageId = useId();\n let headingId = useId();\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/dropzone');\n let ariaLabelledby = isFilled ? `${headingId} ${messageId}` : headingId;\n\n return (\n <Provider\n values={[\n [HeadingContext, {id: headingId}]\n ]}>\n <RACDropZone\n {...mergeProps(filterProps(otherProps))}\n {...styleProps as Omit<React.HTMLAttributes<HTMLElement>, 'onDrop'>}\n aria-labelledby={ariaLabelledby}\n className={\n classNames(\n styles,\n 'spectrum-Dropzone',\n styleProps.className,\n {'spectrum-Dropzone--filled': isFilled}\n )}\n ref={domRef}>\n <SlotProvider\n slots={{\n illustration: {UNSAFE_className: classNames(\n styles,\n 'spectrum-Dropzone-illustratedMessage'\n )}\n }}>\n {children}\n </SlotProvider>\n <div className={classNames(styles, 'spectrum-Dropzone-backdrop')} />\n <div\n id={messageId}\n className={\n classNames(\n styles,\n 'spectrum-Dropzone-banner',\n styleProps.className\n )\n }>\n {replaceMessage ? replaceMessage : stringFormatter.format('replaceMessage')}\n </div>\n </RACDropZone>\n </Provider>\n );\n}\n\n/**\n * A drop zone is an area into which one or multiple objects can be dragged and dropped.\n */\nlet _DropZone = React.forwardRef(DropZone);\nexport {_DropZone as DropZone};\n"],"names":[],"version":3,"file":"DropZone.main.js.map"}
|
package/dist/DropZone.mjs
CHANGED
@@ -2,7 +2,7 @@ import $fl6Ye$intlStringsmodulejs from "./intlStrings.mjs";
|
|
2
2
|
import "./vars.c0db847d.css";
|
3
3
|
import $fl6Ye$dropzone_vars_cssmodulejs from "./dropzone_vars_css.mjs";
|
4
4
|
import {useStyleProps as $fl6Ye$useStyleProps, useDOMRef as $fl6Ye$useDOMRef, classNames as $fl6Ye$classNames, SlotProvider as $fl6Ye$SlotProvider} from "@react-spectrum/utils";
|
5
|
-
import {DropZone as $fl6Ye$DropZone} from "react-aria-components";
|
5
|
+
import {Provider as $fl6Ye$Provider, HeadingContext as $fl6Ye$HeadingContext, DropZone as $fl6Ye$DropZone} from "react-aria-components";
|
6
6
|
import {useId as $fl6Ye$useId, mergeProps as $fl6Ye$mergeProps} from "@react-aria/utils";
|
7
7
|
import $fl6Ye$react from "react";
|
8
8
|
import {useLocalizedStringFormatter as $fl6Ye$useLocalizedStringFormatter} from "@react-aria/i18n";
|
@@ -39,11 +39,22 @@ function $37da9a3796695f28$var$DropZone(props, ref) {
|
|
39
39
|
let { styleProps: styleProps } = (0, $fl6Ye$useStyleProps)(props);
|
40
40
|
let domRef = (0, $fl6Ye$useDOMRef)(ref);
|
41
41
|
let messageId = (0, $fl6Ye$useId)();
|
42
|
+
let headingId = (0, $fl6Ye$useId)();
|
42
43
|
let stringFormatter = (0, $fl6Ye$useLocalizedStringFormatter)((0, ($parcel$interopDefault($fl6Ye$intlStringsmodulejs))), "@react-spectrum/dropzone");
|
43
|
-
|
44
|
+
let ariaLabelledby = isFilled ? `${headingId} ${messageId}` : headingId;
|
45
|
+
return /*#__PURE__*/ (0, $fl6Ye$react).createElement((0, $fl6Ye$Provider), {
|
46
|
+
values: [
|
47
|
+
[
|
48
|
+
(0, $fl6Ye$HeadingContext),
|
49
|
+
{
|
50
|
+
id: headingId
|
51
|
+
}
|
52
|
+
]
|
53
|
+
]
|
54
|
+
}, /*#__PURE__*/ (0, $fl6Ye$react).createElement((0, $fl6Ye$DropZone), {
|
44
55
|
...(0, $fl6Ye$mergeProps)($37da9a3796695f28$var$filterProps(otherProps)),
|
45
56
|
...styleProps,
|
46
|
-
"aria-labelledby":
|
57
|
+
"aria-labelledby": ariaLabelledby,
|
47
58
|
className: (0, $fl6Ye$classNames)((0, ($parcel$interopDefault($fl6Ye$dropzone_vars_cssmodulejs))), "spectrum-Dropzone", styleProps.className, {
|
48
59
|
"spectrum-Dropzone--filled": isFilled
|
49
60
|
}),
|
@@ -59,7 +70,7 @@ function $37da9a3796695f28$var$DropZone(props, ref) {
|
|
59
70
|
}), /*#__PURE__*/ (0, $fl6Ye$react).createElement("div", {
|
60
71
|
id: messageId,
|
61
72
|
className: (0, $fl6Ye$classNames)((0, ($parcel$interopDefault($fl6Ye$dropzone_vars_cssmodulejs))), "spectrum-Dropzone-banner", styleProps.className)
|
62
|
-
}, replaceMessage ? replaceMessage : stringFormatter.format("replaceMessage")));
|
73
|
+
}, replaceMessage ? replaceMessage : stringFormatter.format("replaceMessage"))));
|
63
74
|
}
|
64
75
|
/**
|
65
76
|
* A drop zone is an area into which one or multiple objects can be dragged and dropped.
|
package/dist/DropZone.module.js
CHANGED
@@ -2,7 +2,7 @@ import $fl6Ye$intlStringsmodulejs from "./intlStrings.module.js";
|
|
2
2
|
import "./vars.c0db847d.css";
|
3
3
|
import $fl6Ye$dropzone_vars_cssmodulejs from "./dropzone_vars_css.module.js";
|
4
4
|
import {useStyleProps as $fl6Ye$useStyleProps, useDOMRef as $fl6Ye$useDOMRef, classNames as $fl6Ye$classNames, SlotProvider as $fl6Ye$SlotProvider} from "@react-spectrum/utils";
|
5
|
-
import {DropZone as $fl6Ye$DropZone} from "react-aria-components";
|
5
|
+
import {Provider as $fl6Ye$Provider, HeadingContext as $fl6Ye$HeadingContext, DropZone as $fl6Ye$DropZone} from "react-aria-components";
|
6
6
|
import {useId as $fl6Ye$useId, mergeProps as $fl6Ye$mergeProps} from "@react-aria/utils";
|
7
7
|
import $fl6Ye$react from "react";
|
8
8
|
import {useLocalizedStringFormatter as $fl6Ye$useLocalizedStringFormatter} from "@react-aria/i18n";
|
@@ -39,11 +39,22 @@ function $37da9a3796695f28$var$DropZone(props, ref) {
|
|
39
39
|
let { styleProps: styleProps } = (0, $fl6Ye$useStyleProps)(props);
|
40
40
|
let domRef = (0, $fl6Ye$useDOMRef)(ref);
|
41
41
|
let messageId = (0, $fl6Ye$useId)();
|
42
|
+
let headingId = (0, $fl6Ye$useId)();
|
42
43
|
let stringFormatter = (0, $fl6Ye$useLocalizedStringFormatter)((0, ($parcel$interopDefault($fl6Ye$intlStringsmodulejs))), "@react-spectrum/dropzone");
|
43
|
-
|
44
|
+
let ariaLabelledby = isFilled ? `${headingId} ${messageId}` : headingId;
|
45
|
+
return /*#__PURE__*/ (0, $fl6Ye$react).createElement((0, $fl6Ye$Provider), {
|
46
|
+
values: [
|
47
|
+
[
|
48
|
+
(0, $fl6Ye$HeadingContext),
|
49
|
+
{
|
50
|
+
id: headingId
|
51
|
+
}
|
52
|
+
]
|
53
|
+
]
|
54
|
+
}, /*#__PURE__*/ (0, $fl6Ye$react).createElement((0, $fl6Ye$DropZone), {
|
44
55
|
...(0, $fl6Ye$mergeProps)($37da9a3796695f28$var$filterProps(otherProps)),
|
45
56
|
...styleProps,
|
46
|
-
"aria-labelledby":
|
57
|
+
"aria-labelledby": ariaLabelledby,
|
47
58
|
className: (0, $fl6Ye$classNames)((0, ($parcel$interopDefault($fl6Ye$dropzone_vars_cssmodulejs))), "spectrum-Dropzone", styleProps.className, {
|
48
59
|
"spectrum-Dropzone--filled": isFilled
|
49
60
|
}),
|
@@ -59,7 +70,7 @@ function $37da9a3796695f28$var$DropZone(props, ref) {
|
|
59
70
|
}), /*#__PURE__*/ (0, $fl6Ye$react).createElement("div", {
|
60
71
|
id: messageId,
|
61
72
|
className: (0, $fl6Ye$classNames)((0, ($parcel$interopDefault($fl6Ye$dropzone_vars_cssmodulejs))), "spectrum-Dropzone-banner", styleProps.className)
|
62
|
-
}, replaceMessage ? replaceMessage : stringFormatter.format("replaceMessage")));
|
73
|
+
}, replaceMessage ? replaceMessage : stringFormatter.format("replaceMessage"))));
|
63
74
|
}
|
64
75
|
/**
|
65
76
|
* A drop zone is an area into which one or multiple objects can be dragged and dropped.
|
@@ -1 +1 @@
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAqBD,oFAAoF;AACpF,IAAI,oCAAc,CAAC;IACjB,6DAA6D;IAC7D,IAAI,gBAAC,YAAY,iBAAE,aAAa,cAAE,UAAU,EAAE,GAAG,YAAW,GAAG;IAC/D,OAAO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ACA,CAAA,GAAA,iBAAS,EACP,CAAA,GAAA,0DAAK,GACL,qBACA,WAAW,SAAS,EACpB;YAAC,6BAA6B;QAAQ;QAExC,KAAK;qBACL,gCAAC,CAAA,GAAA,mBAAW;QACV,OAAO;YACL,cAAc;gBAAC,kBAAkB,CAAA,GAAA,iBAAS,EACxC,CAAA,GAAA,0DAAK,GACL;YACC;QACL;OACC,yBAEH,gCAAC;QAAI,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,0DAAK,GAAG;sBACnC,gCAAC;QACC,IAAI;QACJ,WACE,CAAA,GAAA,iBAAS,EACP,CAAA,GAAA,0DAAK,GACL,4BACA,WAAW,SAAS;OAGvB,iBAAiB,iBAAiB,gBAAgB,MAAM,CAAC;AAKpE;AAEA;;CAEC,GACD,IAAI,yDAAY,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/dropzone/src/DropZone.tsx"],"sourcesContent":["/*\n * Copyright 2023 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaLabelingProps, DOMProps, DOMRef, StyleProps} from '@react-types/shared';\nimport {classNames, SlotProvider, useDOMRef, useStyleProps} from '@react-spectrum/utils';\nimport {DropZoneProps, HeadingContext, Provider, DropZone as RACDropZone} from 'react-aria-components';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {mergeProps, useId} from '@react-aria/utils';\nimport React, {ReactNode} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/dropzone/vars.css';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface SpectrumDropZoneProps extends Omit<DropZoneProps, 'onHoverStart' | 'onHoverChange' | 'onHoverEnd' | 'isDisabled' | 'className' | 'style'>, DOMProps, StyleProps, AriaLabelingProps {\n /** The content to display in the drop zone. */\n children: ReactNode,\n /** Whether the drop zone has been filled. */\n isFilled?: boolean,\n /** The message to replace the default banner message that is shown when the drop zone is filled. */\n replaceMessage?: string\n}\n\n// Filter out props used by RAC DropZone that we don't want in RSP DropZone for now.\nlet filterProps = (props) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n let {onHoverStart, onHoverChange, onHoverEnd, ...otherProps} = props;\n return otherProps;\n};\n\nfunction DropZone(props: SpectrumDropZoneProps, ref: DOMRef<HTMLDivElement>) {\n let {children, isFilled, replaceMessage, ...otherProps} = props;\n let {styleProps} = useStyleProps(props);\n let domRef = useDOMRef(ref);\n let messageId = useId();\n let headingId = useId();\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/dropzone');\n let ariaLabelledby = isFilled ? `${headingId} ${messageId}` : headingId;\n\n return (\n <Provider\n values={[\n [HeadingContext, {id: headingId}]\n ]}>\n <RACDropZone\n {...mergeProps(filterProps(otherProps))}\n {...styleProps as Omit<React.HTMLAttributes<HTMLElement>, 'onDrop'>}\n aria-labelledby={ariaLabelledby}\n className={\n classNames(\n styles,\n 'spectrum-Dropzone',\n styleProps.className,\n {'spectrum-Dropzone--filled': isFilled}\n )}\n ref={domRef}>\n <SlotProvider\n slots={{\n illustration: {UNSAFE_className: classNames(\n styles,\n 'spectrum-Dropzone-illustratedMessage'\n )}\n }}>\n {children}\n </SlotProvider>\n <div className={classNames(styles, 'spectrum-Dropzone-backdrop')} />\n <div\n id={messageId}\n className={\n classNames(\n styles,\n 'spectrum-Dropzone-banner',\n styleProps.className\n )\n }>\n {replaceMessage ? replaceMessage : stringFormatter.format('replaceMessage')}\n </div>\n </RACDropZone>\n </Provider>\n );\n}\n\n/**\n * A drop zone is an area into which one or multiple objects can be dragged and dropped.\n */\nlet _DropZone = React.forwardRef(DropZone);\nexport {_DropZone as DropZone};\n"],"names":[],"version":3,"file":"DropZone.module.js.map"}
|
package/dist/types.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"mappings":";;;AAsBA,sCAAuC,SAAQ,IAAI,CAAC,aAAa,EAAE,cAAc,GAAG,eAAe,GAAG,YAAY,GAAG,YAAY,GAAG,WAAW,GAAG,OAAO,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,iBAAiB;IACjM,+CAA+C;IAC/C,QAAQ,EAAE,SAAS,CAAC;IACpB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oGAAoG;IACpG,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB;
|
1
|
+
{"mappings":";;;AAsBA,sCAAuC,SAAQ,IAAI,CAAC,aAAa,EAAE,cAAc,GAAG,eAAe,GAAG,YAAY,GAAG,YAAY,GAAG,WAAW,GAAG,OAAO,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,iBAAiB;IACjM,+CAA+C;IAC/C,QAAQ,EAAE,SAAS,CAAC;IACpB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oGAAoG;IACpG,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB;AA6DD;;GAEG;AACH,OAAA,IAAI,mHAAsC,CAAC","sources":["packages/@react-spectrum/dropzone/src/packages/@react-spectrum/dropzone/src/DropZone.tsx","packages/@react-spectrum/dropzone/src/packages/@react-spectrum/dropzone/src/index.ts","packages/@react-spectrum/dropzone/src/index.ts"],"sourcesContent":[null,null,"/*\n * Copyright 2023 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n/// <reference types=\"css-module-types\" />\n\nexport {DropZone} from './DropZone';\nexport type {SpectrumDropZoneProps} from './DropZone';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@react-spectrum/dropzone",
|
3
|
-
"version": "3.0.0-nightly.
|
3
|
+
"version": "3.0.0-nightly.4564+315950cef",
|
4
4
|
"description": "Spectrum UI components in React",
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"main": "dist/main.js",
|
@@ -36,16 +36,16 @@
|
|
36
36
|
"url": "https://github.com/adobe/react-spectrum"
|
37
37
|
},
|
38
38
|
"dependencies": {
|
39
|
-
"@react-aria/i18n": "3.0.0-nightly.
|
40
|
-
"@react-aria/utils": "3.0.0-nightly.
|
41
|
-
"@react-spectrum/utils": "3.0.0-nightly.
|
42
|
-
"@react-types/shared": "3.0.0-nightly.
|
39
|
+
"@react-aria/i18n": "3.0.0-nightly.2852+315950cef",
|
40
|
+
"@react-aria/utils": "3.0.0-nightly.2852+315950cef",
|
41
|
+
"@react-spectrum/utils": "3.0.0-nightly.2852+315950cef",
|
42
|
+
"@react-types/shared": "3.0.0-nightly.2852+315950cef",
|
43
43
|
"@swc/helpers": "^0.5.0",
|
44
|
-
"react-aria-components": "1.1.2-nightly.
|
44
|
+
"react-aria-components": "1.1.2-nightly.4564+315950cef"
|
45
45
|
},
|
46
46
|
"devDependencies": {
|
47
|
-
"@adobe/spectrum-css-temp": "3.0.0-nightly.
|
48
|
-
"@react-spectrum/test-utils": "3.0.0-nightly.
|
47
|
+
"@adobe/spectrum-css-temp": "3.0.0-nightly.2852+315950cef",
|
48
|
+
"@react-spectrum/test-utils-internal": "3.0.0-nightly.4564+315950cef"
|
49
49
|
},
|
50
50
|
"peerDependencies": {
|
51
51
|
"@react-spectrum/provider": "^3.0.0",
|
@@ -54,5 +54,5 @@
|
|
54
54
|
"publishConfig": {
|
55
55
|
"access": "public"
|
56
56
|
},
|
57
|
-
"gitHead": "
|
57
|
+
"gitHead": "315950cef7952de30220661f62ab79ba6dcb59cc"
|
58
58
|
}
|
package/src/DropZone.tsx
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
|
13
13
|
import {AriaLabelingProps, DOMProps, DOMRef, StyleProps} from '@react-types/shared';
|
14
14
|
import {classNames, SlotProvider, useDOMRef, useStyleProps} from '@react-spectrum/utils';
|
15
|
-
import {DropZoneProps, DropZone as RACDropZone} from 'react-aria-components';
|
15
|
+
import {DropZoneProps, HeadingContext, Provider, DropZone as RACDropZone} from 'react-aria-components';
|
16
16
|
// @ts-ignore
|
17
17
|
import intlMessages from '../intl/*.json';
|
18
18
|
import {mergeProps, useId} from '@react-aria/utils';
|
@@ -41,43 +41,50 @@ function DropZone(props: SpectrumDropZoneProps, ref: DOMRef<HTMLDivElement>) {
|
|
41
41
|
let {styleProps} = useStyleProps(props);
|
42
42
|
let domRef = useDOMRef(ref);
|
43
43
|
let messageId = useId();
|
44
|
+
let headingId = useId();
|
44
45
|
let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/dropzone');
|
46
|
+
let ariaLabelledby = isFilled ? `${headingId} ${messageId}` : headingId;
|
45
47
|
|
46
48
|
return (
|
47
|
-
<
|
48
|
-
{
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
styleProps.className,
|
56
|
-
{'spectrum-Dropzone--filled': isFilled}
|
57
|
-
)}
|
58
|
-
ref={domRef}>
|
59
|
-
<SlotProvider
|
60
|
-
slots={{
|
61
|
-
illustration: {UNSAFE_className: classNames(
|
62
|
-
styles,
|
63
|
-
'spectrum-Dropzone-illustratedMessage'
|
64
|
-
)}
|
65
|
-
}}>
|
66
|
-
{children}
|
67
|
-
</SlotProvider>
|
68
|
-
<div className={classNames(styles, 'spectrum-Dropzone-backdrop')} />
|
69
|
-
<div
|
70
|
-
id={messageId}
|
49
|
+
<Provider
|
50
|
+
values={[
|
51
|
+
[HeadingContext, {id: headingId}]
|
52
|
+
]}>
|
53
|
+
<RACDropZone
|
54
|
+
{...mergeProps(filterProps(otherProps))}
|
55
|
+
{...styleProps as Omit<React.HTMLAttributes<HTMLElement>, 'onDrop'>}
|
56
|
+
aria-labelledby={ariaLabelledby}
|
71
57
|
className={
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
}
|
78
|
-
{
|
79
|
-
|
80
|
-
|
58
|
+
classNames(
|
59
|
+
styles,
|
60
|
+
'spectrum-Dropzone',
|
61
|
+
styleProps.className,
|
62
|
+
{'spectrum-Dropzone--filled': isFilled}
|
63
|
+
)}
|
64
|
+
ref={domRef}>
|
65
|
+
<SlotProvider
|
66
|
+
slots={{
|
67
|
+
illustration: {UNSAFE_className: classNames(
|
68
|
+
styles,
|
69
|
+
'spectrum-Dropzone-illustratedMessage'
|
70
|
+
)}
|
71
|
+
}}>
|
72
|
+
{children}
|
73
|
+
</SlotProvider>
|
74
|
+
<div className={classNames(styles, 'spectrum-Dropzone-backdrop')} />
|
75
|
+
<div
|
76
|
+
id={messageId}
|
77
|
+
className={
|
78
|
+
classNames(
|
79
|
+
styles,
|
80
|
+
'spectrum-Dropzone-banner',
|
81
|
+
styleProps.className
|
82
|
+
)
|
83
|
+
}>
|
84
|
+
{replaceMessage ? replaceMessage : stringFormatter.format('replaceMessage')}
|
85
|
+
</div>
|
86
|
+
</RACDropZone>
|
87
|
+
</Provider>
|
81
88
|
);
|
82
89
|
}
|
83
90
|
|