@react-spectrum/dialog 3.8.22 → 3.9.0
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/AlertDialog.main.js
CHANGED
|
@@ -66,7 +66,8 @@ const $66f8653ff750aa27$export$de466dd8317b0b75 = /*#__PURE__*/ (0, $cXXKy$react
|
|
|
66
66
|
isHidden: styleProps.hidden,
|
|
67
67
|
size: "M",
|
|
68
68
|
role: "alertdialog",
|
|
69
|
-
ref: ref
|
|
69
|
+
ref: ref,
|
|
70
|
+
...(0, $cXXKy$reactariautils.filterDOMProps)(props)
|
|
70
71
|
}, /*#__PURE__*/ (0, ($parcel$interopDefault($cXXKy$react))).createElement((0, $cXXKy$reactspectrumtext.Heading), null, title), (variant === 'error' || variant === 'warning') && /*#__PURE__*/ (0, ($parcel$interopDefault($cXXKy$react))).createElement((0, ($parcel$interopDefault($cXXKy$spectrumiconsuiAlertMedium))), {
|
|
71
72
|
slot: "typeIcon",
|
|
72
73
|
"aria-label": stringFormatter.format('alert')
|
|
@@ -75,17 +76,20 @@ const $66f8653ff750aa27$export$de466dd8317b0b75 = /*#__PURE__*/ (0, $cXXKy$react
|
|
|
75
76
|
}, cancelLabel && /*#__PURE__*/ (0, ($parcel$interopDefault($cXXKy$react))).createElement((0, $cXXKy$reactspectrumbutton.Button), {
|
|
76
77
|
variant: "secondary",
|
|
77
78
|
onPress: ()=>(0, $cXXKy$reactariautils.chain)(onClose(), onCancel()),
|
|
78
|
-
autoFocus: autoFocusButton === 'cancel'
|
|
79
|
+
autoFocus: autoFocusButton === 'cancel',
|
|
80
|
+
"data-testid": "rsp-AlertDialog-cancelButton"
|
|
79
81
|
}, cancelLabel), secondaryActionLabel && /*#__PURE__*/ (0, ($parcel$interopDefault($cXXKy$react))).createElement((0, $cXXKy$reactspectrumbutton.Button), {
|
|
80
82
|
variant: "secondary",
|
|
81
83
|
onPress: ()=>(0, $cXXKy$reactariautils.chain)(onClose(), onSecondaryAction()),
|
|
82
84
|
isDisabled: isSecondaryActionDisabled,
|
|
83
|
-
autoFocus: autoFocusButton === 'secondary'
|
|
85
|
+
autoFocus: autoFocusButton === 'secondary',
|
|
86
|
+
"data-testid": "rsp-AlertDialog-secondaryButton"
|
|
84
87
|
}, secondaryActionLabel), /*#__PURE__*/ (0, ($parcel$interopDefault($cXXKy$react))).createElement((0, $cXXKy$reactspectrumbutton.Button), {
|
|
85
88
|
variant: confirmVariant,
|
|
86
89
|
onPress: ()=>(0, $cXXKy$reactariautils.chain)(onClose(), onPrimaryAction()),
|
|
87
90
|
isDisabled: isPrimaryActionDisabled,
|
|
88
|
-
autoFocus: autoFocusButton === 'primary'
|
|
91
|
+
autoFocus: autoFocusButton === 'primary',
|
|
92
|
+
"data-testid": "rsp-AlertDialog-confirmButton"
|
|
89
93
|
}, primaryActionLabel)));
|
|
90
94
|
});
|
|
91
95
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;AAwBM,MAAM,0DAAc,CAAA,GAAA,uBAAS,EAAE,SAAS,YAAY,KAA+B,EAAE,GAAW;IACrG,IAAI,WACF,UAAU,KAAO,GAClB,GAAG,CAAA,GAAA,uBAAS,EAAE,CAAA,GAAA,uCAAY,MAAM,CAAC;IAElC,IAAI,WACF,OAAO,YACP,QAAQ,sBACR,kBAAkB,wBAClB,oBAAoB,eACpB,WAAW,mBACX,eAAe,SACf,KAAK,2BACL,uBAAuB,6BACvB,yBAAyB,YACzB,WAAW,KAAO,oBAClB,kBAAkB,KAAO,sBACzB,oBAAoB,KAAO,GAC3B,GAAG,YACJ,GAAG;IACJ,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,uCAAY,EAAE;IACjC,IAAI,kBAAkB,CAAA,GAAA,gDAA0B,EAAE,CAAA,GAAA,mDAAW,GAAG;IAEhE,IAAI,iBAAiD;IACrD,IAAI,SAAS;Q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E;QAAO,GAAG,WAAW,SAAS;QACrG,UAAU,WAAW,MAAM;QAC3B,MAAK;QACL,MAAK;QACL,KAAK;QACJ,GAAG,CAAA,GAAA,oCAAa,EAAE,MAAM;qBACzB,0DAAC,CAAA,GAAA,gCAAM,SAAG,QACT,AAAC,CAAA,YAAY,WAAW,YAAY,SAAQ,mBAC3C,0DAAC,CAAA,GAAA,2DAAU;QACT,MAAK;QACL,cAAY,gBAAgB,MAAM,CAAC;sBAEvC,0DAAC,CAAA,GAAA,mCAAM,wBACP,0DAAC,CAAA,GAAA,gCAAM,SAAG,yBACV,0DAAC,CAAA,GAAA,2CAAU;QAAE,OAAM;OAChB,6BACC,0DAAC,CAAA,GAAA,iCAAK;QACJ,SAAQ;QACR,SAAS,IAAM,CAAA,GAAA,2BAAI,EAAE,WAAW;QAChC,WAAW,oBAAoB;QAC/B,eAAY;OACX,cAGJ,sCACC,0DAAC,CAAA,GAAA,iCAAK;QACJ,SAAQ;QACR,SAAS,IAAM,CAAA,GAAA,2BAAI,EAAE,WAAW;QAChC,YAAY;QACZ,WAAW,oBAAoB;QAC/B,eAAY;OACX,qCAGL,0DAAC,CAAA,GAAA,iCAAK;QACJ,SAAS;QACT,SAAS,IAAM,CAAA,GAAA,2BAAI,EAAE,WAAW;QAChC,YAAY;QACZ,WAAW,oBAAoB;QAC/B,eAAY;OACX;AAKX","sources":["packages/@react-spectrum/dialog/src/AlertDialog.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 AlertMedium from '@spectrum-icons/ui/AlertMedium';\nimport {Button} from '@react-spectrum/button';\nimport {ButtonGroup} from '@react-spectrum/buttongroup';\nimport {chain, filterDOMProps} from '@react-aria/utils';\nimport {classNames, useStyleProps} from '@react-spectrum/utils';\nimport {Content} from '@react-spectrum/view';\nimport {Dialog} from './Dialog';\nimport {DialogContext, DialogContextValue} from './context';\nimport {Divider} from '@react-spectrum/divider';\nimport {DOMRef} from '@react-types/shared';\nimport {Heading} from '@react-spectrum/text';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport React, {forwardRef, useContext} from 'react';\nimport {SpectrumAlertDialogProps} from '@react-types/dialog';\nimport {SpectrumButtonProps} from '@react-types/button';\nimport styles from '@adobe/spectrum-css-temp/components/dialog/vars.css';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\n/**\n * AlertDialogs are a specific type of Dialog. They display important information that users need to acknowledge.\n */\nexport const AlertDialog = forwardRef(function AlertDialog(props: SpectrumAlertDialogProps, ref: DOMRef) {\n let {\n onClose = () => {}\n } = useContext(DialogContext) || {} as DialogContextValue;\n\n let {\n variant,\n children,\n primaryActionLabel,\n secondaryActionLabel,\n cancelLabel,\n autoFocusButton,\n title,\n isPrimaryActionDisabled,\n isSecondaryActionDisabled,\n onCancel = () => {},\n onPrimaryAction = () => {},\n onSecondaryAction = () => {},\n ...otherProps\n } = props;\n let {styleProps} = useStyleProps(otherProps);\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/dialog');\n\n let confirmVariant: SpectrumButtonProps['variant'] = 'primary';\n if (variant) {\n if (variant === 'confirmation') {\n confirmVariant = 'cta';\n } else if (variant === 'destructive') {\n confirmVariant = 'negative';\n }\n }\n\n return (\n <Dialog\n UNSAFE_style={styleProps.style}\n UNSAFE_className={classNames(styles, {[`spectrum-Dialog--${variant}`]: variant}, styleProps.className)}\n isHidden={styleProps.hidden}\n size=\"M\"\n role=\"alertdialog\"\n ref={ref}\n {...filterDOMProps(props)}>\n <Heading>{title}</Heading>\n {(variant === 'error' || variant === 'warning') &&\n <AlertMedium\n slot=\"typeIcon\"\n aria-label={stringFormatter.format('alert')} />\n }\n <Divider />\n <Content>{children}</Content>\n <ButtonGroup align=\"end\">\n {cancelLabel &&\n <Button\n variant=\"secondary\"\n onPress={() => chain(onClose(), onCancel())}\n autoFocus={autoFocusButton === 'cancel'}\n data-testid=\"rsp-AlertDialog-cancelButton\">\n {cancelLabel}\n </Button>\n }\n {secondaryActionLabel &&\n <Button\n variant=\"secondary\"\n onPress={() => chain(onClose(), onSecondaryAction())}\n isDisabled={isSecondaryActionDisabled}\n autoFocus={autoFocusButton === 'secondary'}\n data-testid=\"rsp-AlertDialog-secondaryButton\">\n {secondaryActionLabel}\n </Button>\n }\n <Button\n variant={confirmVariant}\n onPress={() => chain(onClose(), onPrimaryAction())}\n isDisabled={isPrimaryActionDisabled}\n autoFocus={autoFocusButton === 'primary'}\n data-testid=\"rsp-AlertDialog-confirmButton\">\n {primaryActionLabel}\n </Button>\n </ButtonGroup>\n </Dialog>\n );\n});\n"],"names":[],"version":3,"file":"AlertDialog.main.js.map"}
|
package/dist/AlertDialog.mjs
CHANGED
|
@@ -6,7 +6,7 @@ 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";
|
|
8
8
|
import {ButtonGroup as $7TaMJ$ButtonGroup} from "@react-spectrum/buttongroup";
|
|
9
|
-
import {chain as $7TaMJ$chain} from "@react-aria/utils";
|
|
9
|
+
import {filterDOMProps as $7TaMJ$filterDOMProps, chain as $7TaMJ$chain} from "@react-aria/utils";
|
|
10
10
|
import {useStyleProps as $7TaMJ$useStyleProps, classNames as $7TaMJ$classNames} from "@react-spectrum/utils";
|
|
11
11
|
import {Content as $7TaMJ$Content} from "@react-spectrum/view";
|
|
12
12
|
import {Divider as $7TaMJ$Divider} from "@react-spectrum/divider";
|
|
@@ -60,7 +60,8 @@ const $2a8395160fff9af3$export$de466dd8317b0b75 = /*#__PURE__*/ (0, $7TaMJ$forwa
|
|
|
60
60
|
isHidden: styleProps.hidden,
|
|
61
61
|
size: "M",
|
|
62
62
|
role: "alertdialog",
|
|
63
|
-
ref: ref
|
|
63
|
+
ref: ref,
|
|
64
|
+
...(0, $7TaMJ$filterDOMProps)(props)
|
|
64
65
|
}, /*#__PURE__*/ (0, $7TaMJ$react).createElement((0, $7TaMJ$Heading), null, title), (variant === 'error' || variant === 'warning') && /*#__PURE__*/ (0, $7TaMJ$react).createElement((0, $7TaMJ$spectrumiconsuiAlertMedium), {
|
|
65
66
|
slot: "typeIcon",
|
|
66
67
|
"aria-label": stringFormatter.format('alert')
|
|
@@ -69,17 +70,20 @@ const $2a8395160fff9af3$export$de466dd8317b0b75 = /*#__PURE__*/ (0, $7TaMJ$forwa
|
|
|
69
70
|
}, cancelLabel && /*#__PURE__*/ (0, $7TaMJ$react).createElement((0, $7TaMJ$Button), {
|
|
70
71
|
variant: "secondary",
|
|
71
72
|
onPress: ()=>(0, $7TaMJ$chain)(onClose(), onCancel()),
|
|
72
|
-
autoFocus: autoFocusButton === 'cancel'
|
|
73
|
+
autoFocus: autoFocusButton === 'cancel',
|
|
74
|
+
"data-testid": "rsp-AlertDialog-cancelButton"
|
|
73
75
|
}, cancelLabel), secondaryActionLabel && /*#__PURE__*/ (0, $7TaMJ$react).createElement((0, $7TaMJ$Button), {
|
|
74
76
|
variant: "secondary",
|
|
75
77
|
onPress: ()=>(0, $7TaMJ$chain)(onClose(), onSecondaryAction()),
|
|
76
78
|
isDisabled: isSecondaryActionDisabled,
|
|
77
|
-
autoFocus: autoFocusButton === 'secondary'
|
|
79
|
+
autoFocus: autoFocusButton === 'secondary',
|
|
80
|
+
"data-testid": "rsp-AlertDialog-secondaryButton"
|
|
78
81
|
}, secondaryActionLabel), /*#__PURE__*/ (0, $7TaMJ$react).createElement((0, $7TaMJ$Button), {
|
|
79
82
|
variant: confirmVariant,
|
|
80
83
|
onPress: ()=>(0, $7TaMJ$chain)(onClose(), onPrimaryAction()),
|
|
81
84
|
isDisabled: isPrimaryActionDisabled,
|
|
82
|
-
autoFocus: autoFocusButton === 'primary'
|
|
85
|
+
autoFocus: autoFocusButton === 'primary',
|
|
86
|
+
"data-testid": "rsp-AlertDialog-confirmButton"
|
|
83
87
|
}, primaryActionLabel)));
|
|
84
88
|
});
|
|
85
89
|
|
|
@@ -6,7 +6,7 @@ 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";
|
|
8
8
|
import {ButtonGroup as $7TaMJ$ButtonGroup} from "@react-spectrum/buttongroup";
|
|
9
|
-
import {chain as $7TaMJ$chain} from "@react-aria/utils";
|
|
9
|
+
import {filterDOMProps as $7TaMJ$filterDOMProps, chain as $7TaMJ$chain} from "@react-aria/utils";
|
|
10
10
|
import {useStyleProps as $7TaMJ$useStyleProps, classNames as $7TaMJ$classNames} from "@react-spectrum/utils";
|
|
11
11
|
import {Content as $7TaMJ$Content} from "@react-spectrum/view";
|
|
12
12
|
import {Divider as $7TaMJ$Divider} from "@react-spectrum/divider";
|
|
@@ -60,7 +60,8 @@ const $2a8395160fff9af3$export$de466dd8317b0b75 = /*#__PURE__*/ (0, $7TaMJ$forwa
|
|
|
60
60
|
isHidden: styleProps.hidden,
|
|
61
61
|
size: "M",
|
|
62
62
|
role: "alertdialog",
|
|
63
|
-
ref: ref
|
|
63
|
+
ref: ref,
|
|
64
|
+
...(0, $7TaMJ$filterDOMProps)(props)
|
|
64
65
|
}, /*#__PURE__*/ (0, $7TaMJ$react).createElement((0, $7TaMJ$Heading), null, title), (variant === 'error' || variant === 'warning') && /*#__PURE__*/ (0, $7TaMJ$react).createElement((0, $7TaMJ$spectrumiconsuiAlertMedium), {
|
|
65
66
|
slot: "typeIcon",
|
|
66
67
|
"aria-label": stringFormatter.format('alert')
|
|
@@ -69,17 +70,20 @@ const $2a8395160fff9af3$export$de466dd8317b0b75 = /*#__PURE__*/ (0, $7TaMJ$forwa
|
|
|
69
70
|
}, cancelLabel && /*#__PURE__*/ (0, $7TaMJ$react).createElement((0, $7TaMJ$Button), {
|
|
70
71
|
variant: "secondary",
|
|
71
72
|
onPress: ()=>(0, $7TaMJ$chain)(onClose(), onCancel()),
|
|
72
|
-
autoFocus: autoFocusButton === 'cancel'
|
|
73
|
+
autoFocus: autoFocusButton === 'cancel',
|
|
74
|
+
"data-testid": "rsp-AlertDialog-cancelButton"
|
|
73
75
|
}, cancelLabel), secondaryActionLabel && /*#__PURE__*/ (0, $7TaMJ$react).createElement((0, $7TaMJ$Button), {
|
|
74
76
|
variant: "secondary",
|
|
75
77
|
onPress: ()=>(0, $7TaMJ$chain)(onClose(), onSecondaryAction()),
|
|
76
78
|
isDisabled: isSecondaryActionDisabled,
|
|
77
|
-
autoFocus: autoFocusButton === 'secondary'
|
|
79
|
+
autoFocus: autoFocusButton === 'secondary',
|
|
80
|
+
"data-testid": "rsp-AlertDialog-secondaryButton"
|
|
78
81
|
}, secondaryActionLabel), /*#__PURE__*/ (0, $7TaMJ$react).createElement((0, $7TaMJ$Button), {
|
|
79
82
|
variant: confirmVariant,
|
|
80
83
|
onPress: ()=>(0, $7TaMJ$chain)(onClose(), onPrimaryAction()),
|
|
81
84
|
isDisabled: isPrimaryActionDisabled,
|
|
82
|
-
autoFocus: autoFocusButton === 'primary'
|
|
85
|
+
autoFocus: autoFocusButton === 'primary',
|
|
86
|
+
"data-testid": "rsp-AlertDialog-confirmButton"
|
|
83
87
|
}, primaryActionLabel)));
|
|
84
88
|
});
|
|
85
89
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;AAwBM,MAAM,0DAAc,CAAA,GAAA,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,GAAA,aAAK;QACJ,SAAS;QACT,SAAS,IAAM,CAAA,GAAA,YAAI,EAAE,WAAW;QAChC,YAAY;QACZ,WAAW,oBAAoB;QAC/B,eAAY;OACX;AAKX","sources":["packages/@react-spectrum/dialog/src/AlertDialog.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 AlertMedium from '@spectrum-icons/ui/AlertMedium';\nimport {Button} from '@react-spectrum/button';\nimport {ButtonGroup} from '@react-spectrum/buttongroup';\nimport {chain, filterDOMProps} from '@react-aria/utils';\nimport {classNames, useStyleProps} from '@react-spectrum/utils';\nimport {Content} from '@react-spectrum/view';\nimport {Dialog} from './Dialog';\nimport {DialogContext, DialogContextValue} from './context';\nimport {Divider} from '@react-spectrum/divider';\nimport {DOMRef} from '@react-types/shared';\nimport {Heading} from '@react-spectrum/text';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport React, {forwardRef, useContext} from 'react';\nimport {SpectrumAlertDialogProps} from '@react-types/dialog';\nimport {SpectrumButtonProps} from '@react-types/button';\nimport styles from '@adobe/spectrum-css-temp/components/dialog/vars.css';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\n/**\n * AlertDialogs are a specific type of Dialog. They display important information that users need to acknowledge.\n */\nexport const AlertDialog = forwardRef(function AlertDialog(props: SpectrumAlertDialogProps, ref: DOMRef) {\n let {\n onClose = () => {}\n } = useContext(DialogContext) || {} as DialogContextValue;\n\n let {\n variant,\n children,\n primaryActionLabel,\n secondaryActionLabel,\n cancelLabel,\n autoFocusButton,\n title,\n isPrimaryActionDisabled,\n isSecondaryActionDisabled,\n onCancel = () => {},\n onPrimaryAction = () => {},\n onSecondaryAction = () => {},\n ...otherProps\n } = props;\n let {styleProps} = useStyleProps(otherProps);\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/dialog');\n\n let confirmVariant: SpectrumButtonProps['variant'] = 'primary';\n if (variant) {\n if (variant === 'confirmation') {\n confirmVariant = 'cta';\n } else if (variant === 'destructive') {\n confirmVariant = 'negative';\n }\n }\n\n return (\n <Dialog\n UNSAFE_style={styleProps.style}\n UNSAFE_className={classNames(styles, {[`spectrum-Dialog--${variant}`]: variant}, styleProps.className)}\n isHidden={styleProps.hidden}\n size=\"M\"\n role=\"alertdialog\"\n ref={ref}\n {...filterDOMProps(props)}>\n <Heading>{title}</Heading>\n {(variant === 'error' || variant === 'warning') &&\n <AlertMedium\n slot=\"typeIcon\"\n aria-label={stringFormatter.format('alert')} />\n }\n <Divider />\n <Content>{children}</Content>\n <ButtonGroup align=\"end\">\n {cancelLabel &&\n <Button\n variant=\"secondary\"\n onPress={() => chain(onClose(), onCancel())}\n autoFocus={autoFocusButton === 'cancel'}\n data-testid=\"rsp-AlertDialog-cancelButton\">\n {cancelLabel}\n </Button>\n }\n {secondaryActionLabel &&\n <Button\n variant=\"secondary\"\n onPress={() => chain(onClose(), onSecondaryAction())}\n isDisabled={isSecondaryActionDisabled}\n autoFocus={autoFocusButton === 'secondary'}\n data-testid=\"rsp-AlertDialog-secondaryButton\">\n {secondaryActionLabel}\n </Button>\n }\n <Button\n variant={confirmVariant}\n onPress={() => chain(onClose(), onPrimaryAction())}\n isDisabled={isPrimaryActionDisabled}\n autoFocus={autoFocusButton === 'primary'}\n data-testid=\"rsp-AlertDialog-confirmButton\">\n {primaryActionLabel}\n </Button>\n </ButtonGroup>\n </Dialog>\n );\n});\n"],"names":[],"version":3,"file":"AlertDialog.module.js.map"}
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;AC2CA;;;GAGG;AACH,OAAO,MAAM,4GAsEX,CAAC;ACtFH;;GAEG;AACH,OAAO,MAAM,
|
|
1
|
+
{"mappings":";;;AC2CA;;;GAGG;AACH,OAAO,MAAM,4GAsEX,CAAC;ACtFH;;GAEG;AACH,OAAO,MAAM,sHAgFX,CAAC;ACqBH;;;;GAIG;AAGH,OAAA,IAAI,eAAkC,CAAC,KAAK,EAAE,0BAA0B,KAAK,IAAI,OAAO,CAAC;AC5HzF;;;;GAIG;AACH,gCAAgC,KAAK,EAAE,4BAA4B,GAAG,IAAI,OAAO,CAuDhF;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.
|
|
3
|
+
"version": "3.9.0",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -40,24 +40,24 @@
|
|
|
40
40
|
"url": "https://github.com/adobe/react-spectrum"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@react-aria/dialog": "^3.5.
|
|
44
|
-
"@react-aria/i18n": "^3.12.
|
|
45
|
-
"@react-aria/interactions": "^3.25.
|
|
46
|
-
"@react-aria/overlays": "^3.
|
|
47
|
-
"@react-aria/utils": "^3.
|
|
48
|
-
"@react-spectrum/button": "^3.
|
|
49
|
-
"@react-spectrum/buttongroup": "^3.6.
|
|
50
|
-
"@react-spectrum/divider": "^3.5.
|
|
51
|
-
"@react-spectrum/layout": "^3.6.
|
|
52
|
-
"@react-spectrum/overlays": "^5.
|
|
53
|
-
"@react-spectrum/text": "^3.5.
|
|
54
|
-
"@react-spectrum/utils": "^3.12.
|
|
55
|
-
"@react-spectrum/view": "^3.6.
|
|
56
|
-
"@react-stately/overlays": "^3.6.
|
|
57
|
-
"@react-types/button": "^3.
|
|
58
|
-
"@react-types/dialog": "^3.5.
|
|
59
|
-
"@react-types/shared": "^3.
|
|
60
|
-
"@spectrum-icons/ui": "^3.6.
|
|
43
|
+
"@react-aria/dialog": "^3.5.28",
|
|
44
|
+
"@react-aria/i18n": "^3.12.11",
|
|
45
|
+
"@react-aria/interactions": "^3.25.4",
|
|
46
|
+
"@react-aria/overlays": "^3.28.0",
|
|
47
|
+
"@react-aria/utils": "^3.30.0",
|
|
48
|
+
"@react-spectrum/button": "^3.17.0",
|
|
49
|
+
"@react-spectrum/buttongroup": "^3.6.24",
|
|
50
|
+
"@react-spectrum/divider": "^3.5.25",
|
|
51
|
+
"@react-spectrum/layout": "^3.6.17",
|
|
52
|
+
"@react-spectrum/overlays": "^5.8.0",
|
|
53
|
+
"@react-spectrum/text": "^3.5.18",
|
|
54
|
+
"@react-spectrum/utils": "^3.12.7",
|
|
55
|
+
"@react-spectrum/view": "^3.6.21",
|
|
56
|
+
"@react-stately/overlays": "^3.6.18",
|
|
57
|
+
"@react-types/button": "^3.13.0",
|
|
58
|
+
"@react-types/dialog": "^3.5.20",
|
|
59
|
+
"@react-types/shared": "^3.31.0",
|
|
60
|
+
"@spectrum-icons/ui": "^3.6.18",
|
|
61
61
|
"@swc/helpers": "^0.5.0"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"publishConfig": {
|
|
73
73
|
"access": "public"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "8b9348ff255e018b2dd9b27e2a45507cadfa1d35"
|
|
76
76
|
}
|
package/src/AlertDialog.tsx
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
import AlertMedium from '@spectrum-icons/ui/AlertMedium';
|
|
14
14
|
import {Button} from '@react-spectrum/button';
|
|
15
15
|
import {ButtonGroup} from '@react-spectrum/buttongroup';
|
|
16
|
-
import {chain} from '@react-aria/utils';
|
|
16
|
+
import {chain, filterDOMProps} from '@react-aria/utils';
|
|
17
17
|
import {classNames, useStyleProps} from '@react-spectrum/utils';
|
|
18
18
|
import {Content} from '@react-spectrum/view';
|
|
19
19
|
import {Dialog} from './Dialog';
|
|
@@ -71,7 +71,8 @@ export const AlertDialog = forwardRef(function AlertDialog(props: SpectrumAlertD
|
|
|
71
71
|
isHidden={styleProps.hidden}
|
|
72
72
|
size="M"
|
|
73
73
|
role="alertdialog"
|
|
74
|
-
ref={ref}
|
|
74
|
+
ref={ref}
|
|
75
|
+
{...filterDOMProps(props)}>
|
|
75
76
|
<Heading>{title}</Heading>
|
|
76
77
|
{(variant === 'error' || variant === 'warning') &&
|
|
77
78
|
<AlertMedium
|
|
@@ -85,7 +86,8 @@ export const AlertDialog = forwardRef(function AlertDialog(props: SpectrumAlertD
|
|
|
85
86
|
<Button
|
|
86
87
|
variant="secondary"
|
|
87
88
|
onPress={() => chain(onClose(), onCancel())}
|
|
88
|
-
autoFocus={autoFocusButton === 'cancel'}
|
|
89
|
+
autoFocus={autoFocusButton === 'cancel'}
|
|
90
|
+
data-testid="rsp-AlertDialog-cancelButton">
|
|
89
91
|
{cancelLabel}
|
|
90
92
|
</Button>
|
|
91
93
|
}
|
|
@@ -94,7 +96,8 @@ export const AlertDialog = forwardRef(function AlertDialog(props: SpectrumAlertD
|
|
|
94
96
|
variant="secondary"
|
|
95
97
|
onPress={() => chain(onClose(), onSecondaryAction())}
|
|
96
98
|
isDisabled={isSecondaryActionDisabled}
|
|
97
|
-
autoFocus={autoFocusButton === 'secondary'}
|
|
99
|
+
autoFocus={autoFocusButton === 'secondary'}
|
|
100
|
+
data-testid="rsp-AlertDialog-secondaryButton">
|
|
98
101
|
{secondaryActionLabel}
|
|
99
102
|
</Button>
|
|
100
103
|
}
|
|
@@ -102,7 +105,8 @@ export const AlertDialog = forwardRef(function AlertDialog(props: SpectrumAlertD
|
|
|
102
105
|
variant={confirmVariant}
|
|
103
106
|
onPress={() => chain(onClose(), onPrimaryAction())}
|
|
104
107
|
isDisabled={isPrimaryActionDisabled}
|
|
105
|
-
autoFocus={autoFocusButton === 'primary'}
|
|
108
|
+
autoFocus={autoFocusButton === 'primary'}
|
|
109
|
+
data-testid="rsp-AlertDialog-confirmButton">
|
|
106
110
|
{primaryActionLabel}
|
|
107
111
|
</Button>
|
|
108
112
|
</ButtonGroup>
|