@react-spectrum/dialog 3.8.19 → 3.8.20

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.
@@ -1,7 +1,7 @@
1
1
  var $a57fc2323bf98a33$exports = require("./Dialog.main.js");
2
2
  var $0eb909ad2388d989$exports = require("./context.main.js");
3
3
  var $7827d180f5c8b41b$exports = require("./intlStrings.main.js");
4
- require("./vars.895d8ff6.css");
4
+ require("./dialog.1f91a33b.css");
5
5
  var $a74c0984b1adb651$exports = require("./dialog_vars_css.main.js");
6
6
  var $cXXKy$spectrumiconsuiAlertMedium = require("@spectrum-icons/ui/AlertMedium");
7
7
  var $cXXKy$reactspectrumbutton = require("@react-spectrum/button");
@@ -1,7 +1,7 @@
1
1
  import {Dialog as $99cd51dc4eb569f7$export$3ddf2d174ce01153} from "./Dialog.mjs";
2
2
  import {DialogContext as $97b119e05830ea0d$export$8b93a07348a7730c} from "./context.mjs";
3
3
  import $7TaMJ$intlStringsmodulejs from "./intlStrings.mjs";
4
- import "./vars.895d8ff6.css";
4
+ import "./dialog.1f91a33b.css";
5
5
  import $7TaMJ$dialog_vars_cssmodulejs from "./dialog_vars_css.mjs";
6
6
  import $7TaMJ$spectrumiconsuiAlertMedium from "@spectrum-icons/ui/AlertMedium";
7
7
  import {Button as $7TaMJ$Button} from "@react-spectrum/button";
@@ -1,7 +1,7 @@
1
1
  import {Dialog as $99cd51dc4eb569f7$export$3ddf2d174ce01153} from "./Dialog.module.js";
2
2
  import {DialogContext as $97b119e05830ea0d$export$8b93a07348a7730c} from "./context.module.js";
3
3
  import $7TaMJ$intlStringsmodulejs from "./intlStrings.module.js";
4
- import "./vars.895d8ff6.css";
4
+ import "./dialog.1f91a33b.css";
5
5
  import $7TaMJ$dialog_vars_cssmodulejs from "./dialog_vars_css.module.js";
6
6
  import $7TaMJ$spectrumiconsuiAlertMedium from "@spectrum-icons/ui/AlertMedium";
7
7
  import {Button as $7TaMJ$Button} from "@react-spectrum/button";
@@ -1,6 +1,6 @@
1
1
  var $0eb909ad2388d989$exports = require("./context.main.js");
2
2
  var $7827d180f5c8b41b$exports = require("./intlStrings.main.js");
3
- require("./vars.895d8ff6.css");
3
+ require("./dialog.1f91a33b.css");
4
4
  var $a74c0984b1adb651$exports = require("./dialog_vars_css.main.js");
5
5
  var $1DWg7$reactspectrumbutton = require("@react-spectrum/button");
6
6
  var $1DWg7$reactspectrumutils = require("@react-spectrum/utils");
package/dist/Dialog.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {DialogContext as $97b119e05830ea0d$export$8b93a07348a7730c} from "./context.mjs";
2
2
  import $3e38X$intlStringsmodulejs from "./intlStrings.mjs";
3
- import "./vars.895d8ff6.css";
3
+ import "./dialog.1f91a33b.css";
4
4
  import $3e38X$dialog_vars_cssmodulejs from "./dialog_vars_css.mjs";
5
5
  import {ActionButton as $3e38X$ActionButton} from "@react-spectrum/button";
6
6
  import {useSlotProps as $3e38X$useSlotProps, useStyleProps as $3e38X$useStyleProps, useDOMRef as $3e38X$useDOMRef, useHasChild as $3e38X$useHasChild, unwrapDOMRef as $3e38X$unwrapDOMRef, classNames as $3e38X$classNames, SlotProvider as $3e38X$SlotProvider} from "@react-spectrum/utils";
@@ -1,6 +1,6 @@
1
1
  import {DialogContext as $97b119e05830ea0d$export$8b93a07348a7730c} from "./context.module.js";
2
2
  import $3e38X$intlStringsmodulejs from "./intlStrings.module.js";
3
- import "./vars.895d8ff6.css";
3
+ import "./dialog.1f91a33b.css";
4
4
  import $3e38X$dialog_vars_cssmodulejs from "./dialog_vars_css.module.js";
5
5
  import {ActionButton as $3e38X$ActionButton} from "@react-spectrum/button";
6
6
  import {useSlotProps as $3e38X$useSlotProps, useStyleProps as $3e38X$useStyleProps, useDOMRef as $3e38X$useDOMRef, useHasChild as $3e38X$useHasChild, unwrapDOMRef as $3e38X$unwrapDOMRef, classNames as $3e38X$classNames, SlotProvider as $3e38X$SlotProvider} from "@react-spectrum/utils";
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AAaM,SAAS,0CAAgB,KAAmC;IACjE,IAAI,YACF,QAAQ,QACR,OAAO,oBACP,SAAS,iBACT,aAAa,6BACb,yBAAyB,EAC1B,GAAG;IAEJ,IAAI,aAAa,CAAA,GAAA,sCAAI,EAAE,QAAQ,CAAC,OAAO,CAAC;IACxC,IAAI,WAAW,MAAM,GAAG,GACtB,MAAM,IAAI,MAAM;IAGlB,IAAI,CAAC,WAAW,aAAa,GAAG,CAAA,GAAA,qBAAO,EAAuB;IAE9D,6EAA6E;IAC7E,0DAA0D;IAC1D,IAAI,QAAkC;IACtC,IAAI,MAAM,OAAO,CAAC,WAChB,QAAQ,SAAS,IAAI,CAAC,CAAA,GAAA,sCAAI,EAAE,cAAc;SACrC,kBAAI,CAAA,GAAA,sCAAI,EAAE,cAAc,CAAC,WAC9B,QAAQ;IAGV,IAAI,SAAS,UAAU,WACrB,aAAa;IAGf,IAAI,UAAU;cACZ;QACA,SAAS;uBACT;IACF;IAEA,IAAI,QAAQ,CAAA,GAAA,kDAAqB,EAAE;QACjC,QAAQ,CAAC,CAAC;QACV,cAAc,CAAA;YACZ,IAAI,CAAC,QACH;QAEJ;IACF;IAEA,qBACE,0DAAC,CAAA,GAAA,kCAAI;QACH,OAAO;QACP,MAAM;QACN,eAAe;QACf,2BAA2B;qBAC3B,0DAAC,CAAA,GAAA,uCAAY,EAAE,QAAQ;QAAC,OAAO;OAC5B;AAIT","sources":["packages/@react-spectrum/dialog/src/DialogContainer.tsx"],"sourcesContent":["/*\n * Copyright 2020 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 {DialogContext} from './context';\nimport {Modal} from '@react-spectrum/overlays';\nimport React, {ReactElement, useState} from 'react';\nimport {SpectrumDialogContainerProps} from '@react-types/dialog';\nimport {useOverlayTriggerState} from '@react-stately/overlays';\n\n/**\n * A DialogContainer accepts a single Dialog as a child, and manages showing and hiding\n * it in a modal. Useful in cases where there is no trigger element\n * or when the trigger unmounts while the dialog is open.\n */\nexport function DialogContainer(props: SpectrumDialogContainerProps) {\n let {\n children,\n type = 'modal',\n onDismiss,\n isDismissable,\n isKeyboardDismissDisabled\n } = props;\n\n let childArray = React.Children.toArray(children);\n if (childArray.length > 1) {\n throw new Error('Only a single child can be passed to DialogContainer.');\n }\n\n let [lastChild, setLastChild] = useState<ReactElement | null>(null);\n\n // React.Children.toArray mutates the children, and we need them to be stable\n // between renders so that the lastChild comparison works.\n let child: ReactElement | undefined = undefined;\n if (Array.isArray(children)) {\n child = children.find(React.isValidElement);\n } else if (React.isValidElement(children)) {\n child = children;\n }\n\n if (child && child !== lastChild) {\n setLastChild(child);\n }\n\n let context = {\n type,\n onClose: onDismiss,\n isDismissable\n };\n\n let state = useOverlayTriggerState({\n isOpen: !!child,\n onOpenChange: isOpen => {\n if (!isOpen) {\n onDismiss();\n }\n }\n });\n\n return (\n <Modal\n state={state}\n type={type}\n isDismissable={isDismissable}\n isKeyboardDismissDisabled={isKeyboardDismissDisabled}>\n <DialogContext.Provider value={context}>\n {lastChild}\n </DialogContext.Provider>\n </Modal>\n );\n}\n"],"names":[],"version":3,"file":"DialogContainer.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AAaM,SAAS,0CAAgB,KAAmC;IACjE,IAAI,YACF,QAAQ,QACR,OAAO,oBACP,SAAS,iBACT,aAAa,6BACb,yBAAyB,EAC1B,GAAG;IAEJ,IAAI,aAAa,CAAA,GAAA,sCAAI,EAAE,QAAQ,CAAC,OAAO,CAAC;IACxC,IAAI,WAAW,MAAM,GAAG,GACtB,MAAM,IAAI,MAAM;IAGlB,IAAI,CAAC,WAAW,aAAa,GAAG,CAAA,GAAA,qBAAO,EAAuB;IAE9D,6EAA6E;IAC7E,0DAA0D;IAC1D,IAAI,QAAkC;IACtC,IAAI,MAAM,OAAO,CAAC,WAChB,QAAQ,SAAS,IAAI,CAAC,CAAA,GAAA,sCAAI,EAAE,cAAc;SACrC,kBAAI,CAAA,GAAA,sCAAI,EAAE,cAAc,CAAC,WAC9B,QAAQ;IAGV,IAAI,SAAS,UAAU,WACrB,aAAa;IAGf,IAAI,UAAU;cACZ;QACA,SAAS;uBACT;IACF;IAEA,IAAI,QAAQ,CAAA,GAAA,kDAAqB,EAAE;QACjC,QAAQ,CAAC,CAAC;QACV,cAAc,CAAA;YACZ,IAAI,CAAC,QACH;QAEJ;IACF;IAEA,qBACE,0DAAC,CAAA,GAAA,kCAAI;QACH,OAAO;QACP,MAAM;QACN,eAAe;QACf,2BAA2B;qBAC3B,0DAAC,CAAA,GAAA,uCAAY,EAAE,QAAQ;QAAC,OAAO;OAC5B;AAIT","sources":["packages/@react-spectrum/dialog/src/DialogContainer.tsx"],"sourcesContent":["/*\n * Copyright 2020 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 {DialogContext} from './context';\nimport {Modal} from '@react-spectrum/overlays';\nimport React, {ReactElement, ReactNode, useState} from 'react';\nimport {SpectrumDialogContainerProps} from '@react-types/dialog';\nimport {useOverlayTriggerState} from '@react-stately/overlays';\n\n/**\n * A DialogContainer accepts a single Dialog as a child, and manages showing and hiding\n * it in a modal. Useful in cases where there is no trigger element\n * or when the trigger unmounts while the dialog is open.\n */\nexport function DialogContainer(props: SpectrumDialogContainerProps): ReactNode {\n let {\n children,\n type = 'modal',\n onDismiss,\n isDismissable,\n isKeyboardDismissDisabled\n } = props;\n\n let childArray = React.Children.toArray(children);\n if (childArray.length > 1) {\n throw new Error('Only a single child can be passed to DialogContainer.');\n }\n\n let [lastChild, setLastChild] = useState<ReactElement | null>(null);\n\n // React.Children.toArray mutates the children, and we need them to be stable\n // between renders so that the lastChild comparison works.\n let child: ReactElement | undefined = undefined;\n if (Array.isArray(children)) {\n child = children.find(React.isValidElement);\n } else if (React.isValidElement(children)) {\n child = children;\n }\n\n if (child && child !== lastChild) {\n setLastChild(child);\n }\n\n let context = {\n type,\n onClose: onDismiss,\n isDismissable\n };\n\n let state = useOverlayTriggerState({\n isOpen: !!child,\n onOpenChange: isOpen => {\n if (!isOpen) {\n onDismiss();\n }\n }\n });\n\n return (\n <Modal\n state={state}\n type={type}\n isDismissable={isDismissable}\n isKeyboardDismissDisabled={isKeyboardDismissDisabled}>\n <DialogContext.Provider value={context}>\n {lastChild}\n </DialogContext.Provider>\n </Modal>\n );\n}\n"],"names":[],"version":3,"file":"DialogContainer.main.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;AAAA;;;;;;;;;;CAUC;;;;AAaM,SAAS,0CAAgB,KAAmC;IACjE,IAAI,YACF,QAAQ,QACR,OAAO,oBACP,SAAS,iBACT,aAAa,6BACb,yBAAyB,EAC1B,GAAG;IAEJ,IAAI,aAAa,CAAA,GAAA,YAAI,EAAE,QAAQ,CAAC,OAAO,CAAC;IACxC,IAAI,WAAW,MAAM,GAAG,GACtB,MAAM,IAAI,MAAM;IAGlB,IAAI,CAAC,WAAW,aAAa,GAAG,CAAA,GAAA,eAAO,EAAuB;IAE9D,6EAA6E;IAC7E,0DAA0D;IAC1D,IAAI,QAAkC;IACtC,IAAI,MAAM,OAAO,CAAC,WAChB,QAAQ,SAAS,IAAI,CAAC,CAAA,GAAA,YAAI,EAAE,cAAc;SACrC,kBAAI,CAAA,GAAA,YAAI,EAAE,cAAc,CAAC,WAC9B,QAAQ;IAGV,IAAI,SAAS,UAAU,WACrB,aAAa;IAGf,IAAI,UAAU;cACZ;QACA,SAAS;uBACT;IACF;IAEA,IAAI,QAAQ,CAAA,GAAA,6BAAqB,EAAE;QACjC,QAAQ,CAAC,CAAC;QACV,cAAc,CAAA;YACZ,IAAI,CAAC,QACH;QAEJ;IACF;IAEA,qBACE,gCAAC,CAAA,GAAA,YAAI;QACH,OAAO;QACP,MAAM;QACN,eAAe;QACf,2BAA2B;qBAC3B,gCAAC,CAAA,GAAA,yCAAY,EAAE,QAAQ;QAAC,OAAO;OAC5B;AAIT","sources":["packages/@react-spectrum/dialog/src/DialogContainer.tsx"],"sourcesContent":["/*\n * Copyright 2020 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 {DialogContext} from './context';\nimport {Modal} from '@react-spectrum/overlays';\nimport React, {ReactElement, useState} from 'react';\nimport {SpectrumDialogContainerProps} from '@react-types/dialog';\nimport {useOverlayTriggerState} from '@react-stately/overlays';\n\n/**\n * A DialogContainer accepts a single Dialog as a child, and manages showing and hiding\n * it in a modal. Useful in cases where there is no trigger element\n * or when the trigger unmounts while the dialog is open.\n */\nexport function DialogContainer(props: SpectrumDialogContainerProps) {\n let {\n children,\n type = 'modal',\n onDismiss,\n isDismissable,\n isKeyboardDismissDisabled\n } = props;\n\n let childArray = React.Children.toArray(children);\n if (childArray.length > 1) {\n throw new Error('Only a single child can be passed to DialogContainer.');\n }\n\n let [lastChild, setLastChild] = useState<ReactElement | null>(null);\n\n // React.Children.toArray mutates the children, and we need them to be stable\n // between renders so that the lastChild comparison works.\n let child: ReactElement | undefined = undefined;\n if (Array.isArray(children)) {\n child = children.find(React.isValidElement);\n } else if (React.isValidElement(children)) {\n child = children;\n }\n\n if (child && child !== lastChild) {\n setLastChild(child);\n }\n\n let context = {\n type,\n onClose: onDismiss,\n isDismissable\n };\n\n let state = useOverlayTriggerState({\n isOpen: !!child,\n onOpenChange: isOpen => {\n if (!isOpen) {\n onDismiss();\n }\n }\n });\n\n return (\n <Modal\n state={state}\n type={type}\n isDismissable={isDismissable}\n isKeyboardDismissDisabled={isKeyboardDismissDisabled}>\n <DialogContext.Provider value={context}>\n {lastChild}\n </DialogContext.Provider>\n </Modal>\n );\n}\n"],"names":[],"version":3,"file":"DialogContainer.module.js.map"}
1
+ {"mappings":";;;;;AAAA;;;;;;;;;;CAUC;;;;AAaM,SAAS,0CAAgB,KAAmC;IACjE,IAAI,YACF,QAAQ,QACR,OAAO,oBACP,SAAS,iBACT,aAAa,6BACb,yBAAyB,EAC1B,GAAG;IAEJ,IAAI,aAAa,CAAA,GAAA,YAAI,EAAE,QAAQ,CAAC,OAAO,CAAC;IACxC,IAAI,WAAW,MAAM,GAAG,GACtB,MAAM,IAAI,MAAM;IAGlB,IAAI,CAAC,WAAW,aAAa,GAAG,CAAA,GAAA,eAAO,EAAuB;IAE9D,6EAA6E;IAC7E,0DAA0D;IAC1D,IAAI,QAAkC;IACtC,IAAI,MAAM,OAAO,CAAC,WAChB,QAAQ,SAAS,IAAI,CAAC,CAAA,GAAA,YAAI,EAAE,cAAc;SACrC,kBAAI,CAAA,GAAA,YAAI,EAAE,cAAc,CAAC,WAC9B,QAAQ;IAGV,IAAI,SAAS,UAAU,WACrB,aAAa;IAGf,IAAI,UAAU;cACZ;QACA,SAAS;uBACT;IACF;IAEA,IAAI,QAAQ,CAAA,GAAA,6BAAqB,EAAE;QACjC,QAAQ,CAAC,CAAC;QACV,cAAc,CAAA;YACZ,IAAI,CAAC,QACH;QAEJ;IACF;IAEA,qBACE,gCAAC,CAAA,GAAA,YAAI;QACH,OAAO;QACP,MAAM;QACN,eAAe;QACf,2BAA2B;qBAC3B,gCAAC,CAAA,GAAA,yCAAY,EAAE,QAAQ;QAAC,OAAO;OAC5B;AAIT","sources":["packages/@react-spectrum/dialog/src/DialogContainer.tsx"],"sourcesContent":["/*\n * Copyright 2020 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 {DialogContext} from './context';\nimport {Modal} from '@react-spectrum/overlays';\nimport React, {ReactElement, ReactNode, useState} from 'react';\nimport {SpectrumDialogContainerProps} from '@react-types/dialog';\nimport {useOverlayTriggerState} from '@react-stately/overlays';\n\n/**\n * A DialogContainer accepts a single Dialog as a child, and manages showing and hiding\n * it in a modal. Useful in cases where there is no trigger element\n * or when the trigger unmounts while the dialog is open.\n */\nexport function DialogContainer(props: SpectrumDialogContainerProps): ReactNode {\n let {\n children,\n type = 'modal',\n onDismiss,\n isDismissable,\n isKeyboardDismissDisabled\n } = props;\n\n let childArray = React.Children.toArray(children);\n if (childArray.length > 1) {\n throw new Error('Only a single child can be passed to DialogContainer.');\n }\n\n let [lastChild, setLastChild] = useState<ReactElement | null>(null);\n\n // React.Children.toArray mutates the children, and we need them to be stable\n // between renders so that the lastChild comparison works.\n let child: ReactElement | undefined = undefined;\n if (Array.isArray(children)) {\n child = children.find(React.isValidElement);\n } else if (React.isValidElement(children)) {\n child = children;\n }\n\n if (child && child !== lastChild) {\n setLastChild(child);\n }\n\n let context = {\n type,\n onClose: onDismiss,\n isDismissable\n };\n\n let state = useOverlayTriggerState({\n isOpen: !!child,\n onOpenChange: isOpen => {\n if (!isOpen) {\n onDismiss();\n }\n }\n });\n\n return (\n <Modal\n state={state}\n type={type}\n isDismissable={isDismissable}\n isKeyboardDismissDisabled={isKeyboardDismissDisabled}>\n <DialogContext.Provider value={context}>\n {lastChild}\n </DialogContext.Provider>\n </Modal>\n );\n}\n"],"names":[],"version":3,"file":"DialogContainer.module.js.map"}
@@ -57,7 +57,7 @@ function $46e54a192dc519c9$var$DialogTrigger(props) {
57
57
  let onExited = ()=>isExiting.current = false;
58
58
  (0, $7xftW$react.useEffect)(()=>{
59
59
  return ()=>{
60
- if ((wasOpen.current || isExiting.current) && type !== 'popover' && type !== 'tray') console.warn('A DialogTrigger unmounted while open. This is likely due to being placed within a trigger that unmounts or inside a conditional. Consider using a DialogContainer instead.');
60
+ if ((wasOpen.current || isExiting.current) && type !== 'popover' && type !== 'tray' && process.env.NODE_ENV !== 'production') console.warn('A DialogTrigger unmounted while open. This is likely due to being placed within a trigger that unmounts or inside a conditional. Consider using a DialogContainer instead.');
61
61
  };
62
62
  // eslint-disable-next-line react-hooks/exhaustive-deps
63
63
  }, []);
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAWD,SAAS,oCAAc,KAAiC;IACtD,IAAI,YACF,QAAQ,QACR,OAAO,qBACP,aAAa,SAAS,YAAY,UAAU,iBAC5C,SAAS,aACT,SAAS,iBACT,aAAa,6BACb,yBAAyB,EACzB,GAAG,eACJ,GAAG;IACJ,IAAI,CAAC,MAAM,OAAO,CAAC,aAAa,SAAS,MAAM,GAAG,GAChD,MAAM,IAAI,MAAM;IAElB,0EAA0E;IAC1E,IAAI,CAAC,SAAS,QAAQ,GAAG;IAEzB,+DAA+D;IAC/D,IAAI,WAAW,CAAA,GAAA,2CAAgB;IAC/B,IAAI,UAAU;QACZ,oFAAoF;QACpF,IAAI,SAAS,WAAW,eAAe,SACrC,gBAAgB;QAGlB,OAA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DAAC,CAAA,GAAA,uCAAY,EAAE,QAAQ;QAAC,OAAO;OAC5B;AAIT","sources":["packages/@react-spectrum/dialog/src/DialogTrigger.tsx"],"sourcesContent":["/*\n * Copyright 2020 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 {DialogContext} from './context';\nimport {Modal, Popover, Tray} from '@react-spectrum/overlays';\nimport {OverlayTriggerState, useOverlayTriggerState} from '@react-stately/overlays';\nimport {PressResponder} from '@react-aria/interactions';\nimport React, {Fragment, JSX, ReactElement, useEffect, useRef} from 'react';\nimport {SpectrumDialogClose, SpectrumDialogProps, SpectrumDialogTriggerProps} from '@react-types/dialog';\nimport {useIsMobileDevice} from '@react-spectrum/utils';\nimport {useOverlayTrigger} from '@react-aria/overlays';\n\nfunction DialogTrigger(props: SpectrumDialogTriggerProps) {\n let {\n children,\n type = 'modal',\n mobileType = type === 'popover' ? 'modal' : type,\n hideArrow,\n targetRef,\n isDismissable,\n isKeyboardDismissDisabled,\n ...positionProps\n } = props;\n if (!Array.isArray(children) || children.length > 2) {\n throw new Error('DialogTrigger must have exactly 2 children');\n }\n // if a function is passed as the second child, it won't appear in toArray\n let [trigger, content] = children as [ReactElement, SpectrumDialogClose];\n\n // On small devices, show a modal or tray instead of a popover.\n let isMobile = useIsMobileDevice();\n if (isMobile) {\n // handle cases where desktop popovers need a close button for the mobile modal view\n if (type !== 'modal' && mobileType === 'modal') {\n isDismissable = true;\n }\n\n type = mobileType;\n }\n\n let state = useOverlayTriggerState(props);\n let wasOpen = useRef(false);\n useEffect(() => {\n wasOpen.current = state.isOpen;\n }, [state.isOpen]);\n\n let isExiting = useRef(false);\n let onExiting = () => isExiting.current = true;\n let onExited = () => isExiting.current = false;\n\n \n useEffect(() => {\n return () => {\n if ((wasOpen.current || isExiting.current) && type !== 'popover' && type !== 'tray') {\n console.warn('A DialogTrigger unmounted while open. This is likely due to being placed within a trigger that unmounts or inside a conditional. Consider using a DialogContainer instead.');\n }\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n if (type === 'popover') {\n return (\n <PopoverTrigger\n {...positionProps}\n state={state}\n targetRef={targetRef}\n trigger={trigger}\n content={content}\n isKeyboardDismissDisabled={isKeyboardDismissDisabled}\n hideArrow={hideArrow} />\n );\n }\n\n let renderOverlay = () => {\n switch (type) {\n case 'fullscreen':\n case 'fullscreenTakeover':\n case 'modal':\n return (\n <Modal\n state={state}\n isDismissable={type === 'modal' ? isDismissable : false}\n type={type}\n isKeyboardDismissDisabled={isKeyboardDismissDisabled}\n onExiting={onExiting}\n onExited={onExited}>\n {typeof content === 'function' ? content(state.close) : content}\n </Modal>\n );\n case 'tray':\n return (\n <Tray\n state={state}\n isKeyboardDismissDisabled={isKeyboardDismissDisabled}>\n {typeof content === 'function' ? content(state.close) : content}\n </Tray>\n );\n }\n };\n\n return (\n <DialogTriggerBase\n type={type}\n state={state}\n isDismissable={isDismissable}\n trigger={trigger}\n overlay={renderOverlay()} />\n );\n}\n\n// Support DialogTrigger inside components using CollectionBuilder.\nDialogTrigger.getCollectionNode = function* (props: SpectrumDialogTriggerProps) {\n // @ts-ignore - seems like types are wrong. Function children work fine.\n let [trigger] = React.Children.toArray(props.children);\n let [, content] = props.children as [ReactElement, SpectrumDialogClose];\n yield {\n element: trigger,\n wrapper: (element) => (\n <DialogTrigger key={element.key} {...props}>\n {element}\n {content}\n </DialogTrigger>\n )\n };\n};\n\n/**\n * DialogTrigger serves as a wrapper around a Dialog and its associated trigger, linking the Dialog's\n * open state with the trigger's press state. Additionally, it allows you to customize the type and\n * positioning of the Dialog.\n */\n\n// We don't want getCollectionNode to show up in the type definition\nlet _DialogTrigger = DialogTrigger as (props: SpectrumDialogTriggerProps) => JSX.Element;\nexport {_DialogTrigger as DialogTrigger};\n\nfunction PopoverTrigger({state, targetRef, trigger, content, hideArrow, ...props}) {\n let triggerRef = useRef<HTMLElement>(null);\n let {triggerProps, overlayProps} = useOverlayTrigger({type: 'dialog'}, state, triggerRef);\n\n let triggerPropsWithRef = {\n ...triggerProps,\n ref: targetRef ? undefined : triggerRef\n };\n\n let overlay = (\n <Popover\n {...props}\n hideArrow={hideArrow}\n triggerRef={targetRef || triggerRef}\n state={state}>\n {typeof content === 'function' ? content(state.close) : content}\n </Popover>\n );\n\n return (\n <DialogTriggerBase\n type=\"popover\"\n state={state}\n triggerProps={triggerPropsWithRef}\n dialogProps={overlayProps}\n trigger={trigger}\n overlay={overlay} />\n );\n}\n\ninterface SpectrumDialogTriggerBase {\n type: 'modal' | 'popover' | 'tray' | 'fullscreen' | 'fullscreenTakeover',\n state: OverlayTriggerState,\n isDismissable?: boolean,\n dialogProps?: SpectrumDialogProps | {},\n triggerProps?: any,\n overlay?: ReactElement,\n trigger: ReactElement\n}\n\nfunction DialogTriggerBase({type, state, isDismissable, dialogProps = {}, triggerProps = {}, overlay, trigger}: SpectrumDialogTriggerBase) {\n let context = {\n type,\n onClose: state.close,\n isDismissable,\n ...dialogProps\n };\n\n return (\n <Fragment>\n <PressResponder\n {...triggerProps}\n onPress={state.toggle}\n isPressed={state.isOpen && type !== 'modal' && type !== 'fullscreen' && type !== 'fullscreenTakeover'}>\n {trigger}\n </PressResponder>\n <DialogContext.Provider value={context}>\n {overlay}\n </DialogContext.Provider>\n </Fragment>\n );\n}\n"],"names":[],"version":3,"file":"DialogTrigger.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAWD,SAAS,oCAAc,KAAiC;IACtD,IAAI,YACF,QAAQ,QACR,OAAO,qBACP,aAAa,SAAS,YAAY,UAAU,iBAC5C,SAAS,aAC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CAAkB,QAAC,IAAI,SAAE,KAAK,iBAAE,aAAa,eAAE,cAAc,CAAC,iBAAG,eAAe,CAAC,YAAG,OAAO,WAAE,OAAO,EAA4B;IACvI,IAAI,UAAU;cACZ;QACA,SAAS,MAAM,KAAK;uBACpB;QACA,GAAG,WAAW;IAChB;IAEA,qBACE,0DAAC,CAAA,GAAA,qBAAO,uBACN,0DAAC,CAAA,GAAA,2CAAa;QACX,GAAG,YAAY;QAChB,SAAS,MAAM,MAAM;QACrB,WAAW,MAAM,MAAM,IAAI,SAAS,WAAW,SAAS,gBAAgB,SAAS;OAChF,wBAEH,0DAAC,CAAA,GAAA,uCAAY,EAAE,QAAQ;QAAC,OAAO;OAC5B;AAIT","sources":["packages/@react-spectrum/dialog/src/DialogTrigger.tsx"],"sourcesContent":["/*\n * Copyright 2020 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 {DialogContext} from './context';\nimport {Modal, Popover, Tray} from '@react-spectrum/overlays';\nimport {OverlayTriggerState, useOverlayTriggerState} from '@react-stately/overlays';\nimport {PressResponder} from '@react-aria/interactions';\nimport React, {Fragment, JSX, ReactElement, useEffect, useRef} from 'react';\nimport {SpectrumDialogClose, SpectrumDialogProps, SpectrumDialogTriggerProps} from '@react-types/dialog';\nimport {useIsMobileDevice} from '@react-spectrum/utils';\nimport {useOverlayTrigger} from '@react-aria/overlays';\n\nfunction DialogTrigger(props: SpectrumDialogTriggerProps) {\n let {\n children,\n type = 'modal',\n mobileType = type === 'popover' ? 'modal' : type,\n hideArrow,\n targetRef,\n isDismissable,\n isKeyboardDismissDisabled,\n ...positionProps\n } = props;\n if (!Array.isArray(children) || children.length > 2) {\n throw new Error('DialogTrigger must have exactly 2 children');\n }\n // if a function is passed as the second child, it won't appear in toArray\n let [trigger, content] = children as [ReactElement, SpectrumDialogClose];\n\n // On small devices, show a modal or tray instead of a popover.\n let isMobile = useIsMobileDevice();\n if (isMobile) {\n // handle cases where desktop popovers need a close button for the mobile modal view\n if (type !== 'modal' && mobileType === 'modal') {\n isDismissable = true;\n }\n\n type = mobileType;\n }\n\n let state = useOverlayTriggerState(props);\n let wasOpen = useRef(false);\n useEffect(() => {\n wasOpen.current = state.isOpen;\n }, [state.isOpen]);\n\n let isExiting = useRef(false);\n let onExiting = () => isExiting.current = true;\n let onExited = () => isExiting.current = false;\n\n \n useEffect(() => {\n return () => {\n if ((wasOpen.current || isExiting.current) && type !== 'popover' && type !== 'tray' && process.env.NODE_ENV !== 'production') {\n console.warn('A DialogTrigger unmounted while open. This is likely due to being placed within a trigger that unmounts or inside a conditional. Consider using a DialogContainer instead.');\n }\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n if (type === 'popover') {\n return (\n <PopoverTrigger\n {...positionProps}\n state={state}\n targetRef={targetRef}\n trigger={trigger}\n content={content}\n isKeyboardDismissDisabled={isKeyboardDismissDisabled}\n hideArrow={hideArrow} />\n );\n }\n\n let renderOverlay = () => {\n switch (type) {\n case 'fullscreen':\n case 'fullscreenTakeover':\n case 'modal':\n return (\n <Modal\n state={state}\n isDismissable={type === 'modal' ? isDismissable : false}\n type={type}\n isKeyboardDismissDisabled={isKeyboardDismissDisabled}\n onExiting={onExiting}\n onExited={onExited}>\n {typeof content === 'function' ? content(state.close) : content}\n </Modal>\n );\n case 'tray':\n return (\n <Tray\n state={state}\n isKeyboardDismissDisabled={isKeyboardDismissDisabled}>\n {typeof content === 'function' ? content(state.close) : content}\n </Tray>\n );\n }\n };\n\n return (\n <DialogTriggerBase\n type={type}\n state={state}\n isDismissable={isDismissable}\n trigger={trigger}\n overlay={renderOverlay()} />\n );\n}\n\n// Support DialogTrigger inside components using CollectionBuilder.\nDialogTrigger.getCollectionNode = function* (props: SpectrumDialogTriggerProps) {\n // @ts-ignore - seems like types are wrong. Function children work fine.\n let [trigger] = React.Children.toArray(props.children);\n let [, content] = props.children as [ReactElement, SpectrumDialogClose];\n yield {\n element: trigger,\n wrapper: (element) => (\n <DialogTrigger key={element.key} {...props}>\n {element}\n {content}\n </DialogTrigger>\n )\n };\n};\n\n/**\n * DialogTrigger serves as a wrapper around a Dialog and its associated trigger, linking the Dialog's\n * open state with the trigger's press state. Additionally, it allows you to customize the type and\n * positioning of the Dialog.\n */\n\n// We don't want getCollectionNode to show up in the type definition\nlet _DialogTrigger = DialogTrigger as (props: SpectrumDialogTriggerProps) => JSX.Element;\nexport {_DialogTrigger as DialogTrigger};\n\nfunction PopoverTrigger({state, targetRef, trigger, content, hideArrow, ...props}) {\n let triggerRef = useRef<HTMLElement>(null);\n let {triggerProps, overlayProps} = useOverlayTrigger({type: 'dialog'}, state, triggerRef);\n\n let triggerPropsWithRef = {\n ...triggerProps,\n ref: targetRef ? undefined : triggerRef\n };\n\n let overlay = (\n <Popover\n {...props}\n hideArrow={hideArrow}\n triggerRef={targetRef || triggerRef}\n state={state}>\n {typeof content === 'function' ? content(state.close) : content}\n </Popover>\n );\n\n return (\n <DialogTriggerBase\n type=\"popover\"\n state={state}\n triggerProps={triggerPropsWithRef}\n dialogProps={overlayProps}\n trigger={trigger}\n overlay={overlay} />\n );\n}\n\ninterface SpectrumDialogTriggerBase {\n type: 'modal' | 'popover' | 'tray' | 'fullscreen' | 'fullscreenTakeover',\n state: OverlayTriggerState,\n isDismissable?: boolean,\n dialogProps?: SpectrumDialogProps | {},\n triggerProps?: any,\n overlay?: ReactElement,\n trigger: ReactElement\n}\n\nfunction DialogTriggerBase({type, state, isDismissable, dialogProps = {}, triggerProps = {}, overlay, trigger}: SpectrumDialogTriggerBase) {\n let context = {\n type,\n onClose: state.close,\n isDismissable,\n ...dialogProps\n };\n\n return (\n <Fragment>\n <PressResponder\n {...triggerProps}\n onPress={state.toggle}\n isPressed={state.isOpen && type !== 'modal' && type !== 'fullscreen' && type !== 'fullscreenTakeover'}>\n {trigger}\n </PressResponder>\n <DialogContext.Provider value={context}>\n {overlay}\n </DialogContext.Provider>\n </Fragment>\n );\n}\n"],"names":[],"version":3,"file":"DialogTrigger.main.js.map"}
@@ -47,7 +47,7 @@ function $c412c5ea680c1e4f$var$DialogTrigger(props) {
47
47
  let onExited = ()=>isExiting.current = false;
48
48
  (0, $jYq0n$useEffect)(()=>{
49
49
  return ()=>{
50
- if ((wasOpen.current || isExiting.current) && type !== 'popover' && type !== 'tray') console.warn('A DialogTrigger unmounted while open. This is likely due to being placed within a trigger that unmounts or inside a conditional. Consider using a DialogContainer instead.');
50
+ if ((wasOpen.current || isExiting.current) && type !== 'popover' && type !== 'tray' && process.env.NODE_ENV !== 'production') console.warn('A DialogTrigger unmounted while open. This is likely due to being placed within a trigger that unmounts or inside a conditional. Consider using a DialogContainer instead.');
51
51
  };
52
52
  // eslint-disable-next-line react-hooks/exhaustive-deps
53
53
  }, []);
@@ -47,7 +47,7 @@ function $c412c5ea680c1e4f$var$DialogTrigger(props) {
47
47
  let onExited = ()=>isExiting.current = false;
48
48
  (0, $jYq0n$useEffect)(()=>{
49
49
  return ()=>{
50
- if ((wasOpen.current || isExiting.current) && type !== 'popover' && type !== 'tray') console.warn('A DialogTrigger unmounted while open. This is likely due to being placed within a trigger that unmounts or inside a conditional. Consider using a DialogContainer instead.');
50
+ if ((wasOpen.current || isExiting.current) && type !== 'popover' && type !== 'tray' && process.env.NODE_ENV !== 'production') console.warn('A DialogTrigger unmounted while open. This is likely due to being placed within a trigger that unmounts or inside a conditional. Consider using a DialogContainer instead.');
51
51
  };
52
52
  // eslint-disable-next-line react-hooks/exhaustive-deps
53
53
  }, []);
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAWD,SAAS,oCAAc,KAAiC;IAC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;QACT,SAAS;;AAEf;AAYA,SAAS,wCAAkB,QAAC,IAAI,SAAE,KAAK,iBAAE,aAAa,eAAE,cAAc,CAAC,iBAAG,eAAe,CAAC,YAAG,OAAO,WAAE,OAAO,EAA4B;IACvI,IAAI,UAAU;cACZ;QACA,SAAS,MAAM,KAAK;uBACpB;QACA,GAAG,WAAW;IAChB;IAEA,qBACE,gCAAC,CAAA,GAAA,eAAO,uBACN,gCAAC,CAAA,GAAA,qBAAa;QACX,GAAG,YAAY;QAChB,SAAS,MAAM,MAAM;QACrB,WAAW,MAAM,MAAM,IAAI,SAAS,WAAW,SAAS,gBAAgB,SAAS;OAChF,wBAEH,gCAAC,CAAA,GAAA,yCAAY,EAAE,QAAQ;QAAC,OAAO;OAC5B;AAIT","sources":["packages/@react-spectrum/dialog/src/DialogTrigger.tsx"],"sourcesContent":["/*\n * Copyright 2020 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 {DialogContext} from './context';\nimport {Modal, Popover, Tray} from '@react-spectrum/overlays';\nimport {OverlayTriggerState, useOverlayTriggerState} from '@react-stately/overlays';\nimport {PressResponder} from '@react-aria/interactions';\nimport React, {Fragment, JSX, ReactElement, useEffect, useRef} from 'react';\nimport {SpectrumDialogClose, SpectrumDialogProps, SpectrumDialogTriggerProps} from '@react-types/dialog';\nimport {useIsMobileDevice} from '@react-spectrum/utils';\nimport {useOverlayTrigger} from '@react-aria/overlays';\n\nfunction DialogTrigger(props: SpectrumDialogTriggerProps) {\n let {\n children,\n type = 'modal',\n mobileType = type === 'popover' ? 'modal' : type,\n hideArrow,\n targetRef,\n isDismissable,\n isKeyboardDismissDisabled,\n ...positionProps\n } = props;\n if (!Array.isArray(children) || children.length > 2) {\n throw new Error('DialogTrigger must have exactly 2 children');\n }\n // if a function is passed as the second child, it won't appear in toArray\n let [trigger, content] = children as [ReactElement, SpectrumDialogClose];\n\n // On small devices, show a modal or tray instead of a popover.\n let isMobile = useIsMobileDevice();\n if (isMobile) {\n // handle cases where desktop popovers need a close button for the mobile modal view\n if (type !== 'modal' && mobileType === 'modal') {\n isDismissable = true;\n }\n\n type = mobileType;\n }\n\n let state = useOverlayTriggerState(props);\n let wasOpen = useRef(false);\n useEffect(() => {\n wasOpen.current = state.isOpen;\n }, [state.isOpen]);\n\n let isExiting = useRef(false);\n let onExiting = () => isExiting.current = true;\n let onExited = () => isExiting.current = false;\n\n \n useEffect(() => {\n return () => {\n if ((wasOpen.current || isExiting.current) && type !== 'popover' && type !== 'tray') {\n console.warn('A DialogTrigger unmounted while open. This is likely due to being placed within a trigger that unmounts or inside a conditional. Consider using a DialogContainer instead.');\n }\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n if (type === 'popover') {\n return (\n <PopoverTrigger\n {...positionProps}\n state={state}\n targetRef={targetRef}\n trigger={trigger}\n content={content}\n isKeyboardDismissDisabled={isKeyboardDismissDisabled}\n hideArrow={hideArrow} />\n );\n }\n\n let renderOverlay = () => {\n switch (type) {\n case 'fullscreen':\n case 'fullscreenTakeover':\n case 'modal':\n return (\n <Modal\n state={state}\n isDismissable={type === 'modal' ? isDismissable : false}\n type={type}\n isKeyboardDismissDisabled={isKeyboardDismissDisabled}\n onExiting={onExiting}\n onExited={onExited}>\n {typeof content === 'function' ? content(state.close) : content}\n </Modal>\n );\n case 'tray':\n return (\n <Tray\n state={state}\n isKeyboardDismissDisabled={isKeyboardDismissDisabled}>\n {typeof content === 'function' ? content(state.close) : content}\n </Tray>\n );\n }\n };\n\n return (\n <DialogTriggerBase\n type={type}\n state={state}\n isDismissable={isDismissable}\n trigger={trigger}\n overlay={renderOverlay()} />\n );\n}\n\n// Support DialogTrigger inside components using CollectionBuilder.\nDialogTrigger.getCollectionNode = function* (props: SpectrumDialogTriggerProps) {\n // @ts-ignore - seems like types are wrong. Function children work fine.\n let [trigger] = React.Children.toArray(props.children);\n let [, content] = props.children as [ReactElement, SpectrumDialogClose];\n yield {\n element: trigger,\n wrapper: (element) => (\n <DialogTrigger key={element.key} {...props}>\n {element}\n {content}\n </DialogTrigger>\n )\n };\n};\n\n/**\n * DialogTrigger serves as a wrapper around a Dialog and its associated trigger, linking the Dialog's\n * open state with the trigger's press state. Additionally, it allows you to customize the type and\n * positioning of the Dialog.\n */\n\n// We don't want getCollectionNode to show up in the type definition\nlet _DialogTrigger = DialogTrigger as (props: SpectrumDialogTriggerProps) => JSX.Element;\nexport {_DialogTrigger as DialogTrigger};\n\nfunction PopoverTrigger({state, targetRef, trigger, content, hideArrow, ...props}) {\n let triggerRef = useRef<HTMLElement>(null);\n let {triggerProps, overlayProps} = useOverlayTrigger({type: 'dialog'}, state, triggerRef);\n\n let triggerPropsWithRef = {\n ...triggerProps,\n ref: targetRef ? undefined : triggerRef\n };\n\n let overlay = (\n <Popover\n {...props}\n hideArrow={hideArrow}\n triggerRef={targetRef || triggerRef}\n state={state}>\n {typeof content === 'function' ? content(state.close) : content}\n </Popover>\n );\n\n return (\n <DialogTriggerBase\n type=\"popover\"\n state={state}\n triggerProps={triggerPropsWithRef}\n dialogProps={overlayProps}\n trigger={trigger}\n overlay={overlay} />\n );\n}\n\ninterface SpectrumDialogTriggerBase {\n type: 'modal' | 'popover' | 'tray' | 'fullscreen' | 'fullscreenTakeover',\n state: OverlayTriggerState,\n isDismissable?: boolean,\n dialogProps?: SpectrumDialogProps | {},\n triggerProps?: any,\n overlay?: ReactElement,\n trigger: ReactElement\n}\n\nfunction DialogTriggerBase({type, state, isDismissable, dialogProps = {}, triggerProps = {}, overlay, trigger}: SpectrumDialogTriggerBase) {\n let context = {\n type,\n onClose: state.close,\n isDismissable,\n ...dialogProps\n };\n\n return (\n <Fragment>\n <PressResponder\n {...triggerProps}\n onPress={state.toggle}\n isPressed={state.isOpen && type !== 'modal' && type !== 'fullscreen' && type !== 'fullscreenTakeover'}>\n {trigger}\n </PressResponder>\n <DialogContext.Provider value={context}>\n {overlay}\n </DialogContext.Provider>\n </Fragment>\n );\n}\n"],"names":[],"version":3,"file":"DialogTrigger.module.js.map"}
1
+ {"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAWD,SAAS,oCAAc,KAAiC;IACtD,IAAI,YACF,QAAQ,QACR,OAAO,qBACP,aAAa,SAAS,YAAY,UAAU,iBAC5C,SAAS,aACT,SAAS,iBACT,aAAa,6BACb,yBAAyB,EACzB,GAAG,eACJ,GAAG;IACJ,IAAI,CAAC,MAAM,OAAO,CAAC,aAAa,SAAS,MAAM,GAAG,GAChD,MAAM,IAAI,MAAM;IAElB,0EAA0E;IAC1E,IAAI,CAAC,SAAS,QAAQ,GAAG;IAEzB,+DAA+D;IAC/D,IAAI,WAAW,CAAA,GAAA,wBAAgB;IAC/B,IAAI,UAAU;QACZ,oFAAoF;QACpF,IAAI,SAAS,WAAW,eAAe,SACrC,gBAAgB;QAGlB,OAAO;IACT;IAEA,IAAI,QAAQ,CAAA,GAAA,6BAAqB,EAAE;IACnC,IAAI,UAAU,CAAA,GAAA,aAAK,EAAE;IACrB,CAAA,GAAA,gBAAQ,EAAE;QACR,QAAQ,OAAO,GAAG,MAAM,MAAM;IAChC,GAAG;QAAC,MAAM,MAAM;KAAC;IAEjB,IAAI,YAAY,CAAA,GAAA,aAAK,EAAE;IACvB,IAAI,YAAY,IAAM,UAAU,OAAO,GAAG;IAC1C,IAAI,WAAW,IAAM,UAAU,OAAO,GAAG;IAGzC,CAAA,GAAA,gBAAQ,EAAE;QACR,OAAO;YACL,IAAI,AAAC,CAAA,QAAQ,OAAO,IAAI,UAAU,OAAO,AAAD,KAAM,SAAS,aAAa,SAAS,UAAU,QAAQ,GAAG,CAAC,QAAQ,KAA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,GAAG,CAAA,GAAA,wBAAgB,EAAE;QAAC,MAAM;IAAQ,GAAG,OAAO;IAE9E,IAAI,sBAAsB;QACxB,GAAG,YAAY;QACf,KAAK,YAAY,YAAY;IAC/B;IAEA,IAAI,wBACF,gCAAC,CAAA,GAAA,cAAM;QACJ,GAAG,KAAK;QACT,WAAW;QACX,YAAY,aAAa;QACzB,OAAO;OACN,OAAO,YAAY,aAAa,QAAQ,MAAM,KAAK,IAAI;IAI5D,qBACE,gCAAC;QACC,MAAK;QACL,OAAO;QACP,cAAc;QACd,aAAa;QACb,SAAS;QACT,SAAS;;AAEf;AAYA,SAAS,wCAAkB,QAAC,IAAI,SAAE,KAAK,iBAAE,aAAa,eAAE,cAAc,CAAC,iBAAG,eAAe,CAAC,YAAG,OAAO,WAAE,OAAO,EAA4B;IACvI,IAAI,UAAU;cACZ;QACA,SAAS,MAAM,KAAK;uBACpB;QACA,GAAG,WAAW;IAChB;IAEA,qBACE,gCAAC,CAAA,GAAA,eAAO,uBACN,gCAAC,CAAA,GAAA,qBAAa;QACX,GAAG,YAAY;QAChB,SAAS,MAAM,MAAM;QACrB,WAAW,MAAM,MAAM,IAAI,SAAS,WAAW,SAAS,gBAAgB,SAAS;OAChF,wBAEH,gCAAC,CAAA,GAAA,yCAAY,EAAE,QAAQ;QAAC,OAAO;OAC5B;AAIT","sources":["packages/@react-spectrum/dialog/src/DialogTrigger.tsx"],"sourcesContent":["/*\n * Copyright 2020 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 {DialogContext} from './context';\nimport {Modal, Popover, Tray} from '@react-spectrum/overlays';\nimport {OverlayTriggerState, useOverlayTriggerState} from '@react-stately/overlays';\nimport {PressResponder} from '@react-aria/interactions';\nimport React, {Fragment, JSX, ReactElement, useEffect, useRef} from 'react';\nimport {SpectrumDialogClose, SpectrumDialogProps, SpectrumDialogTriggerProps} from '@react-types/dialog';\nimport {useIsMobileDevice} from '@react-spectrum/utils';\nimport {useOverlayTrigger} from '@react-aria/overlays';\n\nfunction DialogTrigger(props: SpectrumDialogTriggerProps) {\n let {\n children,\n type = 'modal',\n mobileType = type === 'popover' ? 'modal' : type,\n hideArrow,\n targetRef,\n isDismissable,\n isKeyboardDismissDisabled,\n ...positionProps\n } = props;\n if (!Array.isArray(children) || children.length > 2) {\n throw new Error('DialogTrigger must have exactly 2 children');\n }\n // if a function is passed as the second child, it won't appear in toArray\n let [trigger, content] = children as [ReactElement, SpectrumDialogClose];\n\n // On small devices, show a modal or tray instead of a popover.\n let isMobile = useIsMobileDevice();\n if (isMobile) {\n // handle cases where desktop popovers need a close button for the mobile modal view\n if (type !== 'modal' && mobileType === 'modal') {\n isDismissable = true;\n }\n\n type = mobileType;\n }\n\n let state = useOverlayTriggerState(props);\n let wasOpen = useRef(false);\n useEffect(() => {\n wasOpen.current = state.isOpen;\n }, [state.isOpen]);\n\n let isExiting = useRef(false);\n let onExiting = () => isExiting.current = true;\n let onExited = () => isExiting.current = false;\n\n \n useEffect(() => {\n return () => {\n if ((wasOpen.current || isExiting.current) && type !== 'popover' && type !== 'tray' && process.env.NODE_ENV !== 'production') {\n console.warn('A DialogTrigger unmounted while open. This is likely due to being placed within a trigger that unmounts or inside a conditional. Consider using a DialogContainer instead.');\n }\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n if (type === 'popover') {\n return (\n <PopoverTrigger\n {...positionProps}\n state={state}\n targetRef={targetRef}\n trigger={trigger}\n content={content}\n isKeyboardDismissDisabled={isKeyboardDismissDisabled}\n hideArrow={hideArrow} />\n );\n }\n\n let renderOverlay = () => {\n switch (type) {\n case 'fullscreen':\n case 'fullscreenTakeover':\n case 'modal':\n return (\n <Modal\n state={state}\n isDismissable={type === 'modal' ? isDismissable : false}\n type={type}\n isKeyboardDismissDisabled={isKeyboardDismissDisabled}\n onExiting={onExiting}\n onExited={onExited}>\n {typeof content === 'function' ? content(state.close) : content}\n </Modal>\n );\n case 'tray':\n return (\n <Tray\n state={state}\n isKeyboardDismissDisabled={isKeyboardDismissDisabled}>\n {typeof content === 'function' ? content(state.close) : content}\n </Tray>\n );\n }\n };\n\n return (\n <DialogTriggerBase\n type={type}\n state={state}\n isDismissable={isDismissable}\n trigger={trigger}\n overlay={renderOverlay()} />\n );\n}\n\n// Support DialogTrigger inside components using CollectionBuilder.\nDialogTrigger.getCollectionNode = function* (props: SpectrumDialogTriggerProps) {\n // @ts-ignore - seems like types are wrong. Function children work fine.\n let [trigger] = React.Children.toArray(props.children);\n let [, content] = props.children as [ReactElement, SpectrumDialogClose];\n yield {\n element: trigger,\n wrapper: (element) => (\n <DialogTrigger key={element.key} {...props}>\n {element}\n {content}\n </DialogTrigger>\n )\n };\n};\n\n/**\n * DialogTrigger serves as a wrapper around a Dialog and its associated trigger, linking the Dialog's\n * open state with the trigger's press state. Additionally, it allows you to customize the type and\n * positioning of the Dialog.\n */\n\n// We don't want getCollectionNode to show up in the type definition\nlet _DialogTrigger = DialogTrigger as (props: SpectrumDialogTriggerProps) => JSX.Element;\nexport {_DialogTrigger as DialogTrigger};\n\nfunction PopoverTrigger({state, targetRef, trigger, content, hideArrow, ...props}) {\n let triggerRef = useRef<HTMLElement>(null);\n let {triggerProps, overlayProps} = useOverlayTrigger({type: 'dialog'}, state, triggerRef);\n\n let triggerPropsWithRef = {\n ...triggerProps,\n ref: targetRef ? undefined : triggerRef\n };\n\n let overlay = (\n <Popover\n {...props}\n hideArrow={hideArrow}\n triggerRef={targetRef || triggerRef}\n state={state}>\n {typeof content === 'function' ? content(state.close) : content}\n </Popover>\n );\n\n return (\n <DialogTriggerBase\n type=\"popover\"\n state={state}\n triggerProps={triggerPropsWithRef}\n dialogProps={overlayProps}\n trigger={trigger}\n overlay={overlay} />\n );\n}\n\ninterface SpectrumDialogTriggerBase {\n type: 'modal' | 'popover' | 'tray' | 'fullscreen' | 'fullscreenTakeover',\n state: OverlayTriggerState,\n isDismissable?: boolean,\n dialogProps?: SpectrumDialogProps | {},\n triggerProps?: any,\n overlay?: ReactElement,\n trigger: ReactElement\n}\n\nfunction DialogTriggerBase({type, state, isDismissable, dialogProps = {}, triggerProps = {}, overlay, trigger}: SpectrumDialogTriggerBase) {\n let context = {\n type,\n onClose: state.close,\n isDismissable,\n ...dialogProps\n };\n\n return (\n <Fragment>\n <PressResponder\n {...triggerProps}\n onPress={state.toggle}\n isPressed={state.isOpen && type !== 'modal' && type !== 'fullscreen' && type !== 'fullscreenTakeover'}>\n {trigger}\n </PressResponder>\n <DialogContext.Provider value={context}>\n {overlay}\n </DialogContext.Provider>\n </Fragment>\n );\n}\n"],"names":[],"version":3,"file":"DialogTrigger.module.js.map"}
@@ -516,4 +516,4 @@
516
516
  .Ecg7PG_spectrum-Dialog--warning .Ecg7PG_spectrum-Dialog-typeIcon {
517
517
  color: var(--spectrum-semantic-notice-color-icon, var(--spectrum-global-color-orange-600));
518
518
  }
519
- /*# sourceMappingURL=vars.895d8ff6.css.map */
519
+ /*# sourceMappingURL=dialog.1f91a33b.css.map */
@@ -1 +1 @@
1
- {"mappings":"AA4DA;;;;;AAIE;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAQA;;;;AAIA;;;;AAKF;;;;;;;;AAOE;;;;;;;;;;;AAqBE;;;;;AAQF;;;;AAKE;;;;;AAOJ;EACE;;;;EAIE;;;;;AAkBJ;;;;;;;AAYA;;;;;;;AAWA;;;;AAIA;;;;AAUA;;;;AAIA;;;;AAIA;;;;;;;;;;;;;;;AAuBA;;;;AAIA;;;;AAIA;;;;AAIA;;;;;;;;;;AAYA;;;;;;;;;;;;;;AAeA;;;;;;;;;;AAaE;;;;;AAKA;;;;;AAMF;;;;;;;;;;AAYE;;;;;AAMF;;;;AAIA;;;;;;;AAQE;;;;AAKF;;;;;;;;;;;;;;AA6BA;;;;;;;;AAWE;;;;AAMF;;;;;;;;;AAWE;;;;AAKF;;;;;;;;;;;;AAYE;;;;AAGA;;;;AAKF;;;;;;;AAYA;;;;AAIA;;;;;AAKA;;;;;;;AAUA;;;;;AAKE;;;;;;;;;;;AAYA;;;;AAGE;;;;;AAYA;;;;;AAMF;;;;AAIA;;;;AAKA;;;;AAIA;;;;AAKF;EAEE;;;;EAIA;;;;;;;;;;;;;EAcE;;;;EAKA;;;;EAKA;;;;EAKF;;;;;;;;;;;;;EAcA;;;;EAIA;;;;EAIA;;;;EAOE;;;;;;;;;;;;;EAcE;;;;EAWA;;;;EAKF;;;;EAIA;;;;;AAQJ;EACE;;;;;;;;;;;;;;;;;EAoBE;;;;;EAOA;;;;;EAOA;;;;;EAMF;;;;;;EAMA;;;;;AAKF;EAII;;;;;;;;;;;;;EAcE;;;;EAWA;;;;EAKF;;;;EAIA;;;;;AAkBJ;;;;AAIA;;;;AAIA;;;;AAKE;;;;AAMA","sources":["packages/@adobe/spectrum-css-temp/components/dialog/vars.css"],"sourcesContent":["/*\n * Copyright 2020 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@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"vars.895d8ff6.css.map"}
1
+ {"mappings":"AA4DA;;;;;AAIE;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAQA;;;;AAIA;;;;AAKF;;;;;;;;AAOE;;;;;;;;;;;AAqBE;;;;;AAQF;;;;AAKE;;;;;AAOJ;EACE;;;;EAIE;;;;;AAkBJ;;;;;;;AAYA;;;;;;;AAWA;;;;AAIA;;;;AAUA;;;;AAIA;;;;AAIA;;;;;;;;;;;;;;;AAuBA;;;;AAIA;;;;AAIA;;;;AAIA;;;;;;;;;;AAYA;;;;;;;;;;;;;;AAeA;;;;;;;;;;AAaE;;;;;AAKA;;;;;AAMF;;;;;;;;;;AAYE;;;;;AAMF;;;;AAIA;;;;;;;AAQE;;;;AAKF;;;;;;;;;;;;;;AA6BA;;;;;;;;AAWE;;;;AAMF;;;;;;;;;AAWE;;;;AAKF;;;;;;;;;;;;AAYE;;;;AAGA;;;;AAKF;;;;;;;AAYA;;;;AAIA;;;;;AAKA;;;;;;;AAUA;;;;;AAKE;;;;;;;;;;;AAYA;;;;AAGE;;;;;AAYA;;;;;AAMF;;;;AAIA;;;;AAKA;;;;AAIA;;;;AAKF;EAEE;;;;EAIA;;;;;;;;;;;;;EAcE;;;;EAKA;;;;EAKA;;;;EAKF;;;;;;;;;;;;;EAcA;;;;EAIA;;;;EAIA;;;;EAOE;;;;;;;;;;;;;EAcE;;;;EAWA;;;;EAKF;;;;EAIA;;;;;AAQJ;EACE;;;;;;;;;;;;;;;;;EAoBE;;;;;EAOA;;;;;EAOA;;;;;EAMF;;;;;;EAMA;;;;;AAKF;EAII;;;;;;;;;;;;;EAcE;;;;EAWA;;;;EAKF;;;;EAIA;;;;;AAkBJ;;;;AAIA;;;;AAIA;;;;AAKE;;;;AAMA","sources":["packages/@adobe/spectrum-css-temp/components/dialog/vars.css"],"sourcesContent":["/*\n * Copyright 2020 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@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"dialog.1f91a33b.css.map"}
package/dist/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import React, { JSX } from "react";
1
+ import React, { JSX, ReactNode } from "react";
2
2
  import { SpectrumDialogProps, SpectrumAlertDialogProps, SpectrumDialogTriggerProps, SpectrumDialogContainerProps } from "@react-types/dialog";
3
3
  import { DOMRefValue } from "@react-types/shared";
4
4
  /**
@@ -21,7 +21,7 @@ export let DialogTrigger: (props: SpectrumDialogTriggerProps) => JSX.Element;
21
21
  * it in a modal. Useful in cases where there is no trigger element
22
22
  * or when the trigger unmounts while the dialog is open.
23
23
  */
24
- export function DialogContainer(props: SpectrumDialogContainerProps): React.JSX.Element;
24
+ export function DialogContainer(props: SpectrumDialogContainerProps): ReactNode;
25
25
  export interface DialogContainerValue {
26
26
  type: 'modal' | 'popover' | 'tray' | 'fullscreen' | 'fullscreenTakeover';
27
27
  dismiss(): void;
@@ -1 +1 @@
1
- {"mappings":";;;AC2CA;;;GAGG;AACH,OAAO,MAAM,4GAsEX,CAAC;ACtFH;;GAEG;AACH,OAAO,MAAM,sHA4EX,CAAC;ACyBH;;;;GAIG;AAGH,OAAA,IAAI,eAAkC,CAAC,KAAK,EAAE,0BAA0B,KAAK,IAAI,OAAO,CAAC;AC5HzF;;;;GAIG;AACH,gCAAgC,KAAK,EAAE,4BAA4B,qBAuDlE;AC/DD;IACE,IAAI,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,YAAY,GAAG,oBAAoB,CAAC;IACzE,OAAO,IAAI,IAAI,CAAA;CAChB;AAED,sCAAsC,oBAAoB,CAYzD;ACZD,YAAY,EAAC,wBAAwB,EAAE,mBAAmB,EAAE,4BAA4B,EAAE,0BAA0B,EAAC,MAAM,qBAAqB,CAAC","sources":["packages/@react-spectrum/dialog/src/packages/@react-spectrum/dialog/src/context.ts","packages/@react-spectrum/dialog/src/packages/@react-spectrum/dialog/src/Dialog.tsx","packages/@react-spectrum/dialog/src/packages/@react-spectrum/dialog/src/AlertDialog.tsx","packages/@react-spectrum/dialog/src/packages/@react-spectrum/dialog/src/DialogTrigger.tsx","packages/@react-spectrum/dialog/src/packages/@react-spectrum/dialog/src/DialogContainer.tsx","packages/@react-spectrum/dialog/src/packages/@react-spectrum/dialog/src/useDialogContainer.ts","packages/@react-spectrum/dialog/src/packages/@react-spectrum/dialog/src/index.ts","packages/@react-spectrum/dialog/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,"/*\n * Copyright 2020 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 {AlertDialog} from './AlertDialog';\nexport {Dialog} from './Dialog';\nexport {DialogTrigger} from './DialogTrigger';\nexport {DialogContainer} from './DialogContainer';\nexport {useDialogContainer} from './useDialogContainer';\n\nexport type {SpectrumAlertDialogProps, SpectrumDialogProps, SpectrumDialogContainerProps, SpectrumDialogTriggerProps} from '@react-types/dialog';\nexport type {DialogContainerValue} from './useDialogContainer';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
1
+ {"mappings":";;;AC2CA;;;GAGG;AACH,OAAO,MAAM,4GAsEX,CAAC;ACtFH;;GAEG;AACH,OAAO,MAAM,sHA4EX,CAAC;ACyBH;;;;GAIG;AAGH,OAAA,IAAI,eAAkC,CAAC,KAAK,EAAE,0BAA0B,KAAK,IAAI,OAAO,CAAC;AC5HzF;;;;GAIG;AACH,gCAAgC,KAAK,EAAE,4BAA4B,GAAG,SAAS,CAuD9E;AC/DD;IACE,IAAI,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,YAAY,GAAG,oBAAoB,CAAC;IACzE,OAAO,IAAI,IAAI,CAAA;CAChB;AAED,sCAAsC,oBAAoB,CAYzD;ACZD,YAAY,EAAC,wBAAwB,EAAE,mBAAmB,EAAE,4BAA4B,EAAE,0BAA0B,EAAC,MAAM,qBAAqB,CAAC","sources":["packages/@react-spectrum/dialog/src/packages/@react-spectrum/dialog/src/context.ts","packages/@react-spectrum/dialog/src/packages/@react-spectrum/dialog/src/Dialog.tsx","packages/@react-spectrum/dialog/src/packages/@react-spectrum/dialog/src/AlertDialog.tsx","packages/@react-spectrum/dialog/src/packages/@react-spectrum/dialog/src/DialogTrigger.tsx","packages/@react-spectrum/dialog/src/packages/@react-spectrum/dialog/src/DialogContainer.tsx","packages/@react-spectrum/dialog/src/packages/@react-spectrum/dialog/src/useDialogContainer.ts","packages/@react-spectrum/dialog/src/packages/@react-spectrum/dialog/src/index.ts","packages/@react-spectrum/dialog/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,"/*\n * Copyright 2020 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 {AlertDialog} from './AlertDialog';\nexport {Dialog} from './Dialog';\nexport {DialogTrigger} from './DialogTrigger';\nexport {DialogContainer} from './DialogContainer';\nexport {useDialogContainer} from './useDialogContainer';\n\nexport type {SpectrumAlertDialogProps, SpectrumDialogProps, SpectrumDialogContainerProps, SpectrumDialogTriggerProps} from '@react-types/dialog';\nexport type {DialogContainerValue} from './useDialogContainer';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-spectrum/dialog",
3
- "version": "3.8.19",
3
+ "version": "3.8.20",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -36,24 +36,24 @@
36
36
  "url": "https://github.com/adobe/react-spectrum"
37
37
  },
38
38
  "dependencies": {
39
- "@react-aria/dialog": "^3.5.23",
40
- "@react-aria/i18n": "^3.12.7",
41
- "@react-aria/interactions": "^3.24.1",
42
- "@react-aria/overlays": "^3.26.1",
43
- "@react-aria/utils": "^3.28.1",
44
- "@react-spectrum/button": "^3.16.12",
45
- "@react-spectrum/buttongroup": "^3.6.20",
46
- "@react-spectrum/divider": "^3.5.21",
47
- "@react-spectrum/layout": "^3.6.13",
48
- "@react-spectrum/overlays": "^5.7.3",
49
- "@react-spectrum/text": "^3.5.13",
50
- "@react-spectrum/utils": "^3.12.3",
51
- "@react-spectrum/view": "^3.6.17",
52
- "@react-stately/overlays": "^3.6.14",
53
- "@react-types/button": "^3.11.0",
54
- "@react-types/dialog": "^3.5.16",
55
- "@react-types/shared": "^3.28.0",
56
- "@spectrum-icons/ui": "^3.6.14",
39
+ "@react-aria/dialog": "^3.5.24",
40
+ "@react-aria/i18n": "^3.12.8",
41
+ "@react-aria/interactions": "^3.25.0",
42
+ "@react-aria/overlays": "^3.27.0",
43
+ "@react-aria/utils": "^3.28.2",
44
+ "@react-spectrum/button": "^3.16.13",
45
+ "@react-spectrum/buttongroup": "^3.6.21",
46
+ "@react-spectrum/divider": "^3.5.22",
47
+ "@react-spectrum/layout": "^3.6.14",
48
+ "@react-spectrum/overlays": "^5.7.4",
49
+ "@react-spectrum/text": "^3.5.14",
50
+ "@react-spectrum/utils": "^3.12.4",
51
+ "@react-spectrum/view": "^3.6.18",
52
+ "@react-stately/overlays": "^3.6.15",
53
+ "@react-types/button": "^3.12.0",
54
+ "@react-types/dialog": "^3.5.17",
55
+ "@react-types/shared": "^3.29.0",
56
+ "@spectrum-icons/ui": "^3.6.15",
57
57
  "@swc/helpers": "^0.5.0"
58
58
  },
59
59
  "devDependencies": {
@@ -68,5 +68,5 @@
68
68
  "publishConfig": {
69
69
  "access": "public"
70
70
  },
71
- "gitHead": "9c4ebbc0c1972cc880febc29de995ca58caa3ba4"
71
+ "gitHead": "9b66d270572f482948afee95622a85cdf68ed408"
72
72
  }
@@ -12,7 +12,7 @@
12
12
 
13
13
  import {DialogContext} from './context';
14
14
  import {Modal} from '@react-spectrum/overlays';
15
- import React, {ReactElement, useState} from 'react';
15
+ import React, {ReactElement, ReactNode, useState} from 'react';
16
16
  import {SpectrumDialogContainerProps} from '@react-types/dialog';
17
17
  import {useOverlayTriggerState} from '@react-stately/overlays';
18
18
 
@@ -21,7 +21,7 @@ import {useOverlayTriggerState} from '@react-stately/overlays';
21
21
  * it in a modal. Useful in cases where there is no trigger element
22
22
  * or when the trigger unmounts while the dialog is open.
23
23
  */
24
- export function DialogContainer(props: SpectrumDialogContainerProps) {
24
+ export function DialogContainer(props: SpectrumDialogContainerProps): ReactNode {
25
25
  let {
26
26
  children,
27
27
  type = 'modal',
@@ -60,7 +60,7 @@ function DialogTrigger(props: SpectrumDialogTriggerProps) {
60
60
 
61
61
  useEffect(() => {
62
62
  return () => {
63
- if ((wasOpen.current || isExiting.current) && type !== 'popover' && type !== 'tray') {
63
+ if ((wasOpen.current || isExiting.current) && type !== 'popover' && type !== 'tray' && process.env.NODE_ENV !== 'production') {
64
64
  console.warn('A DialogTrigger unmounted while open. This is likely due to being placed within a trigger that unmounts or inside a conditional. Consider using a DialogContainer instead.');
65
65
  }
66
66
  };