@react-spectrum/dialog 3.0.0-nightly.1899 → 3.0.0-nightly.1903
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/main.css +1 -1
- package/dist/main.js +201 -144
- package/dist/main.js.map +1 -1
- package/dist/module.mjs +201 -144
- package/dist/module.mjs.map +1 -1
- package/package.json +25 -25
package/dist/main.js
CHANGED
|
@@ -29,17 +29,58 @@ $parcel$export(module.exports, "Dialog", () => $a57fc2323bf98a33$export$3ddf2d17
|
|
|
29
29
|
$parcel$export(module.exports, "DialogTrigger", () => $46e54a192dc519c9$export$2e1e1122cf0cba88);
|
|
30
30
|
$parcel$export(module.exports, "DialogContainer", () => $1b7050825e0eb5b6$export$547754aada6e339f);
|
|
31
31
|
$parcel$export(module.exports, "useDialogContainer", () => $1f05ce3abe26c4cc$export$a2f2d8fa6720dab1);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
32
|
+
/*
|
|
33
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
34
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
35
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
36
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
37
|
+
*
|
|
38
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
39
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
40
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
41
|
+
* governing permissions and limitations under the License.
|
|
42
|
+
*/ /// <reference types="css-module-types" />
|
|
43
|
+
/*
|
|
44
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
45
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
46
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
47
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
48
|
+
*
|
|
49
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
50
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
51
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
52
|
+
* governing permissions and limitations under the License.
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
/*
|
|
60
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
61
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
62
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
63
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
64
|
+
*
|
|
65
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
66
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
67
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
68
|
+
* governing permissions and limitations under the License.
|
|
69
|
+
*/
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
/*
|
|
73
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
74
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
75
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
76
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
77
|
+
*
|
|
78
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
79
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
80
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
81
|
+
* governing permissions and limitations under the License.
|
|
82
|
+
*/
|
|
83
|
+
const $0eb909ad2388d989$export$8b93a07348a7730c = (0, ($parcel$interopDefault($iaoFN$react))).createContext(null);
|
|
43
84
|
|
|
44
85
|
|
|
45
86
|
|
|
@@ -404,94 +445,92 @@ $a74c0984b1adb651$export$4e66396adf61534f = "spectrum-Dialog--warning_6d8b48";
|
|
|
404
445
|
|
|
405
446
|
|
|
406
447
|
let $a57fc2323bf98a33$var$sizeMap = {
|
|
407
|
-
S:
|
|
408
|
-
M:
|
|
409
|
-
L:
|
|
410
|
-
fullscreen:
|
|
411
|
-
fullscreenTakeover:
|
|
448
|
+
S: "small",
|
|
449
|
+
M: "medium",
|
|
450
|
+
L: "large",
|
|
451
|
+
fullscreen: "fullscreen",
|
|
452
|
+
fullscreenTakeover: "fullscreenTakeover"
|
|
412
453
|
};
|
|
413
454
|
function $a57fc2323bf98a33$var$Dialog(props, ref) {
|
|
414
|
-
let { type: type =
|
|
415
|
-
};
|
|
455
|
+
let { type: type = "modal" , ...contextProps } = (0, $iaoFN$react.useContext)((0, $0eb909ad2388d989$export$8b93a07348a7730c)) || {};
|
|
416
456
|
let { children: children , isDismissable: isDismissable = contextProps.isDismissable , onDismiss: onDismiss = contextProps.onClose , size: size , ...otherProps } = props;
|
|
417
|
-
let stringFormatter = $iaoFN$reactariai18n.useLocalizedStringFormatter((/*@__PURE__*/$parcel$interopDefault($27a5e9bc18eefb32$exports)));
|
|
418
|
-
let { styleProps: styleProps } = $iaoFN$reactspectrumutils.useStyleProps(otherProps);
|
|
419
|
-
size = type ===
|
|
420
|
-
let domRef = $iaoFN$reactspectrumutils.useDOMRef(ref);
|
|
421
|
-
let gridRef = $iaoFN$react.useRef();
|
|
457
|
+
let stringFormatter = (0, $iaoFN$reactariai18n.useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($27a5e9bc18eefb32$exports))));
|
|
458
|
+
let { styleProps: styleProps } = (0, $iaoFN$reactspectrumutils.useStyleProps)(otherProps);
|
|
459
|
+
size = type === "popover" ? size || "S" : size || "L";
|
|
460
|
+
let domRef = (0, $iaoFN$reactspectrumutils.useDOMRef)(ref);
|
|
461
|
+
let gridRef = (0, $iaoFN$react.useRef)();
|
|
422
462
|
let sizeVariant = $a57fc2323bf98a33$var$sizeMap[type] || $a57fc2323bf98a33$var$sizeMap[size];
|
|
423
|
-
let { dialogProps: dialogProps , titleProps: titleProps } = $iaoFN$reactariadialog.useDialog($iaoFN$reactariautils.mergeProps(contextProps, props), domRef);
|
|
424
|
-
let hasHeader = $iaoFN$reactspectrumutils.useHasChild(`.${(/*@__PURE__*/$parcel$interopDefault($a74c0984b1adb651$exports))[
|
|
425
|
-
let hasHeading = $iaoFN$reactspectrumutils.useHasChild(`.${(/*@__PURE__*/$parcel$interopDefault($a74c0984b1adb651$exports))[
|
|
426
|
-
let hasFooter = $iaoFN$reactspectrumutils.useHasChild(`.${(/*@__PURE__*/$parcel$interopDefault($a74c0984b1adb651$exports))[
|
|
427
|
-
let hasTypeIcon = $iaoFN$reactspectrumutils.useHasChild(`.${(/*@__PURE__*/$parcel$interopDefault($a74c0984b1adb651$exports))[
|
|
428
|
-
let slots = $iaoFN$react.useMemo(()=>({
|
|
463
|
+
let { dialogProps: dialogProps , titleProps: titleProps } = (0, $iaoFN$reactariadialog.useDialog)((0, $iaoFN$reactariautils.mergeProps)(contextProps, props), domRef);
|
|
464
|
+
let hasHeader = (0, $iaoFN$reactspectrumutils.useHasChild)(`.${(0, (/*@__PURE__*/$parcel$interopDefault($a74c0984b1adb651$exports)))["spectrum-Dialog-header"]}`, (0, $iaoFN$reactspectrumutils.unwrapDOMRef)(gridRef));
|
|
465
|
+
let hasHeading = (0, $iaoFN$reactspectrumutils.useHasChild)(`.${(0, (/*@__PURE__*/$parcel$interopDefault($a74c0984b1adb651$exports)))["spectrum-Dialog-heading"]}`, (0, $iaoFN$reactspectrumutils.unwrapDOMRef)(gridRef));
|
|
466
|
+
let hasFooter = (0, $iaoFN$reactspectrumutils.useHasChild)(`.${(0, (/*@__PURE__*/$parcel$interopDefault($a74c0984b1adb651$exports)))["spectrum-Dialog-footer"]}`, (0, $iaoFN$reactspectrumutils.unwrapDOMRef)(gridRef));
|
|
467
|
+
let hasTypeIcon = (0, $iaoFN$reactspectrumutils.useHasChild)(`.${(0, (/*@__PURE__*/$parcel$interopDefault($a74c0984b1adb651$exports)))["spectrum-Dialog-typeIcon"]}`, (0, $iaoFN$reactspectrumutils.unwrapDOMRef)(gridRef));
|
|
468
|
+
let slots = (0, $iaoFN$react.useMemo)(()=>({
|
|
429
469
|
hero: {
|
|
430
|
-
UNSAFE_className: (/*@__PURE__*/$parcel$interopDefault($a74c0984b1adb651$exports))[
|
|
470
|
+
UNSAFE_className: (0, (/*@__PURE__*/$parcel$interopDefault($a74c0984b1adb651$exports)))["spectrum-Dialog-hero"]
|
|
431
471
|
},
|
|
432
472
|
heading: {
|
|
433
|
-
UNSAFE_className: $iaoFN$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($a74c0984b1adb651$exports)),
|
|
434
|
-
|
|
435
|
-
|
|
473
|
+
UNSAFE_className: (0, $iaoFN$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($a74c0984b1adb651$exports))), "spectrum-Dialog-heading", {
|
|
474
|
+
"spectrum-Dialog-heading--noHeader": !hasHeader,
|
|
475
|
+
"spectrum-Dialog-heading--noTypeIcon": !hasTypeIcon
|
|
436
476
|
}),
|
|
437
477
|
level: 2,
|
|
438
478
|
...titleProps
|
|
439
479
|
},
|
|
440
480
|
header: {
|
|
441
|
-
UNSAFE_className: $iaoFN$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($a74c0984b1adb651$exports)),
|
|
442
|
-
|
|
443
|
-
|
|
481
|
+
UNSAFE_className: (0, $iaoFN$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($a74c0984b1adb651$exports))), "spectrum-Dialog-header", {
|
|
482
|
+
"spectrum-Dialog-header--noHeading": !hasHeading,
|
|
483
|
+
"spectrum-Dialog-header--noTypeIcon": !hasTypeIcon
|
|
444
484
|
})
|
|
445
485
|
},
|
|
446
486
|
typeIcon: {
|
|
447
|
-
UNSAFE_className: (/*@__PURE__*/$parcel$interopDefault($a74c0984b1adb651$exports))[
|
|
487
|
+
UNSAFE_className: (0, (/*@__PURE__*/$parcel$interopDefault($a74c0984b1adb651$exports)))["spectrum-Dialog-typeIcon"]
|
|
448
488
|
},
|
|
449
489
|
divider: {
|
|
450
|
-
UNSAFE_className: (/*@__PURE__*/$parcel$interopDefault($a74c0984b1adb651$exports))[
|
|
451
|
-
size:
|
|
490
|
+
UNSAFE_className: (0, (/*@__PURE__*/$parcel$interopDefault($a74c0984b1adb651$exports)))["spectrum-Dialog-divider"],
|
|
491
|
+
size: "M"
|
|
452
492
|
},
|
|
453
493
|
content: {
|
|
454
|
-
UNSAFE_className: (/*@__PURE__*/$parcel$interopDefault($a74c0984b1adb651$exports))[
|
|
494
|
+
UNSAFE_className: (0, (/*@__PURE__*/$parcel$interopDefault($a74c0984b1adb651$exports)))["spectrum-Dialog-content"]
|
|
455
495
|
},
|
|
456
496
|
footer: {
|
|
457
|
-
UNSAFE_className: (/*@__PURE__*/$parcel$interopDefault($a74c0984b1adb651$exports))[
|
|
497
|
+
UNSAFE_className: (0, (/*@__PURE__*/$parcel$interopDefault($a74c0984b1adb651$exports)))["spectrum-Dialog-footer"]
|
|
458
498
|
},
|
|
459
499
|
buttonGroup: {
|
|
460
|
-
UNSAFE_className: $iaoFN$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($a74c0984b1adb651$exports)),
|
|
461
|
-
|
|
500
|
+
UNSAFE_className: (0, $iaoFN$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($a74c0984b1adb651$exports))), "spectrum-Dialog-buttonGroup", {
|
|
501
|
+
"spectrum-Dialog-buttonGroup--noFooter": !hasFooter
|
|
462
502
|
}),
|
|
463
|
-
align:
|
|
503
|
+
align: "end"
|
|
464
504
|
}
|
|
465
|
-
})
|
|
466
|
-
, [
|
|
505
|
+
}), [
|
|
467
506
|
hasFooter,
|
|
468
507
|
hasHeader,
|
|
469
508
|
titleProps
|
|
470
509
|
]);
|
|
471
|
-
return
|
|
510
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($iaoFN$react))).createElement("section", {
|
|
472
511
|
...styleProps,
|
|
473
512
|
...dialogProps,
|
|
474
|
-
className: $iaoFN$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($a74c0984b1adb651$exports)),
|
|
513
|
+
className: (0, $iaoFN$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($a74c0984b1adb651$exports))), "spectrum-Dialog", {
|
|
475
514
|
[`spectrum-Dialog--${sizeVariant}`]: sizeVariant,
|
|
476
|
-
|
|
515
|
+
"spectrum-Dialog--dismissable": isDismissable
|
|
477
516
|
}, styleProps.className),
|
|
478
517
|
ref: domRef
|
|
479
|
-
}, /*#__PURE__*/ ($parcel$interopDefault($iaoFN$react)).createElement($iaoFN$reactspectrumlayout.Grid, {
|
|
518
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($iaoFN$react))).createElement((0, $iaoFN$reactspectrumlayout.Grid), {
|
|
480
519
|
ref: gridRef,
|
|
481
|
-
UNSAFE_className: (/*@__PURE__*/$parcel$interopDefault($a74c0984b1adb651$exports))[
|
|
482
|
-
}, /*#__PURE__*/ ($parcel$interopDefault($iaoFN$react)).createElement($iaoFN$reactspectrumutils.SlotProvider, {
|
|
520
|
+
UNSAFE_className: (0, (/*@__PURE__*/$parcel$interopDefault($a74c0984b1adb651$exports)))["spectrum-Dialog-grid"]
|
|
521
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($iaoFN$react))).createElement((0, $iaoFN$reactspectrumutils.SlotProvider), {
|
|
483
522
|
slots: slots
|
|
484
|
-
}, children), isDismissable && /*#__PURE__*/ ($parcel$interopDefault($iaoFN$react)).createElement($iaoFN$reactspectrumbutton.ActionButton, {
|
|
485
|
-
UNSAFE_className: (/*@__PURE__*/$parcel$interopDefault($a74c0984b1adb651$exports))[
|
|
523
|
+
}, children), isDismissable && /*#__PURE__*/ (0, ($parcel$interopDefault($iaoFN$react))).createElement((0, $iaoFN$reactspectrumbutton.ActionButton), {
|
|
524
|
+
UNSAFE_className: (0, (/*@__PURE__*/$parcel$interopDefault($a74c0984b1adb651$exports)))["spectrum-Dialog-closeButton"],
|
|
486
525
|
isQuiet: true,
|
|
487
|
-
"aria-label": stringFormatter.format(
|
|
526
|
+
"aria-label": stringFormatter.format("dismiss"),
|
|
488
527
|
onPress: onDismiss
|
|
489
|
-
}, /*#__PURE__*/ ($parcel$interopDefault($iaoFN$react)).createElement(($parcel$interopDefault($iaoFN$spectrumiconsuiCrossLarge)), null))))
|
|
528
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($iaoFN$react))).createElement((0, ($parcel$interopDefault($iaoFN$spectrumiconsuiCrossLarge))), null))));
|
|
490
529
|
}
|
|
491
530
|
/**
|
|
492
531
|
* Dialogs are windows containing contextual information, tasks, or workflows that appear over the user interface.
|
|
493
532
|
* Depending on the kind of Dialog, further interactions may be blocked until the Dialog is acknowledged.
|
|
494
|
-
*/ let $a57fc2323bf98a33$export$3ddf2d174ce01153 = /*#__PURE__*/ ($parcel$interopDefault($iaoFN$react)).forwardRef($a57fc2323bf98a33$var$Dialog);
|
|
533
|
+
*/ let $a57fc2323bf98a33$export$3ddf2d174ce01153 = /*#__PURE__*/ (0, ($parcel$interopDefault($iaoFN$react))).forwardRef($a57fc2323bf98a33$var$Dialog);
|
|
495
534
|
|
|
496
535
|
|
|
497
536
|
|
|
@@ -504,60 +543,62 @@ function $a57fc2323bf98a33$var$Dialog(props, ref) {
|
|
|
504
543
|
/**
|
|
505
544
|
* AlertDialogs are a specific type of Dialog. They display important information that users need to acknowledge.
|
|
506
545
|
*/ function $66f8653ff750aa27$var$AlertDialog(props, ref) {
|
|
507
|
-
let { onClose: onClose = ()=>{
|
|
508
|
-
}
|
|
509
|
-
};
|
|
510
|
-
let
|
|
511
|
-
|
|
512
|
-
} , onSecondaryAction: onSecondaryAction = ()=>{
|
|
513
|
-
} , ...otherProps } = props;
|
|
514
|
-
let { styleProps: styleProps } = $iaoFN$reactspectrumutils.useStyleProps(otherProps);
|
|
515
|
-
let stringFormatter = $iaoFN$reactariai18n.useLocalizedStringFormatter((/*@__PURE__*/$parcel$interopDefault($27a5e9bc18eefb32$exports)));
|
|
516
|
-
let confirmVariant = 'primary';
|
|
546
|
+
let { onClose: onClose = ()=>{} } = (0, $iaoFN$react.useContext)((0, $0eb909ad2388d989$export$8b93a07348a7730c)) || {};
|
|
547
|
+
let { variant: variant , children: children , primaryActionLabel: primaryActionLabel , secondaryActionLabel: secondaryActionLabel , cancelLabel: cancelLabel , autoFocusButton: autoFocusButton , title: title , isPrimaryActionDisabled: isPrimaryActionDisabled , isSecondaryActionDisabled: isSecondaryActionDisabled , onCancel: onCancel = ()=>{} , onPrimaryAction: onPrimaryAction = ()=>{} , onSecondaryAction: onSecondaryAction = ()=>{} , ...otherProps } = props;
|
|
548
|
+
let { styleProps: styleProps } = (0, $iaoFN$reactspectrumutils.useStyleProps)(otherProps);
|
|
549
|
+
let stringFormatter = (0, $iaoFN$reactariai18n.useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($27a5e9bc18eefb32$exports))));
|
|
550
|
+
let confirmVariant = "primary";
|
|
517
551
|
if (variant) {
|
|
518
|
-
if (variant ===
|
|
519
|
-
else if (variant ===
|
|
552
|
+
if (variant === "confirmation") confirmVariant = "cta";
|
|
553
|
+
else if (variant === "destructive") confirmVariant = "negative";
|
|
520
554
|
}
|
|
521
|
-
return
|
|
555
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($iaoFN$react))).createElement((0, $a57fc2323bf98a33$export$3ddf2d174ce01153), {
|
|
522
556
|
UNSAFE_style: styleProps.style,
|
|
523
|
-
UNSAFE_className: $iaoFN$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($a74c0984b1adb651$exports)), {
|
|
557
|
+
UNSAFE_className: (0, $iaoFN$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($a74c0984b1adb651$exports))), {
|
|
524
558
|
[`spectrum-Dialog--${variant}`]: variant
|
|
525
559
|
}, styleProps.className),
|
|
526
560
|
isHidden: styleProps.hidden,
|
|
527
561
|
size: "M",
|
|
528
562
|
role: "alertdialog",
|
|
529
563
|
ref: ref
|
|
530
|
-
}, /*#__PURE__*/ ($parcel$interopDefault($iaoFN$react)).createElement($iaoFN$reactspectrumtext.Heading, null, title), (variant ===
|
|
564
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($iaoFN$react))).createElement((0, $iaoFN$reactspectrumtext.Heading), null, title), (variant === "error" || variant === "warning") && /*#__PURE__*/ (0, ($parcel$interopDefault($iaoFN$react))).createElement((0, ($parcel$interopDefault($iaoFN$spectrumiconsuiAlertMedium))), {
|
|
531
565
|
slot: "typeIcon",
|
|
532
|
-
"aria-label": stringFormatter.format(
|
|
533
|
-
}), /*#__PURE__*/ ($parcel$interopDefault($iaoFN$react)).createElement($iaoFN$reactspectrumdivider.Divider, null), /*#__PURE__*/ ($parcel$interopDefault($iaoFN$react)).createElement($iaoFN$reactspectrumview.Content, null, children), /*#__PURE__*/ ($parcel$interopDefault($iaoFN$react)).createElement($iaoFN$reactspectrumbuttongroup.ButtonGroup, {
|
|
566
|
+
"aria-label": stringFormatter.format("alert")
|
|
567
|
+
}), /*#__PURE__*/ (0, ($parcel$interopDefault($iaoFN$react))).createElement((0, $iaoFN$reactspectrumdivider.Divider), null), /*#__PURE__*/ (0, ($parcel$interopDefault($iaoFN$react))).createElement((0, $iaoFN$reactspectrumview.Content), null, children), /*#__PURE__*/ (0, ($parcel$interopDefault($iaoFN$react))).createElement((0, $iaoFN$reactspectrumbuttongroup.ButtonGroup), {
|
|
534
568
|
align: "end"
|
|
535
|
-
}, cancelLabel && /*#__PURE__*/ ($parcel$interopDefault($iaoFN$react)).createElement($iaoFN$reactspectrumbutton.Button, {
|
|
569
|
+
}, cancelLabel && /*#__PURE__*/ (0, ($parcel$interopDefault($iaoFN$react))).createElement((0, $iaoFN$reactspectrumbutton.Button), {
|
|
536
570
|
variant: "secondary",
|
|
537
|
-
onPress: ()
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
}, cancelLabel), secondaryActionLabel && /*#__PURE__*/ ($parcel$interopDefault($iaoFN$react)).createElement($iaoFN$reactspectrumbutton.Button, {
|
|
571
|
+
onPress: ()=>(0, $iaoFN$reactariautils.chain)(onClose(), onCancel()),
|
|
572
|
+
autoFocus: autoFocusButton === "cancel"
|
|
573
|
+
}, cancelLabel), secondaryActionLabel && /*#__PURE__*/ (0, ($parcel$interopDefault($iaoFN$react))).createElement((0, $iaoFN$reactspectrumbutton.Button), {
|
|
541
574
|
variant: "secondary",
|
|
542
|
-
onPress: ()
|
|
543
|
-
,
|
|
575
|
+
onPress: ()=>(0, $iaoFN$reactariautils.chain)(onClose(), onSecondaryAction()),
|
|
544
576
|
isDisabled: isSecondaryActionDisabled,
|
|
545
|
-
autoFocus: autoFocusButton ===
|
|
546
|
-
}, secondaryActionLabel), /*#__PURE__*/ ($parcel$interopDefault($iaoFN$react)).createElement($iaoFN$reactspectrumbutton.Button, {
|
|
577
|
+
autoFocus: autoFocusButton === "secondary"
|
|
578
|
+
}, secondaryActionLabel), /*#__PURE__*/ (0, ($parcel$interopDefault($iaoFN$react))).createElement((0, $iaoFN$reactspectrumbutton.Button), {
|
|
547
579
|
variant: confirmVariant,
|
|
548
|
-
onPress: ()
|
|
549
|
-
,
|
|
580
|
+
onPress: ()=>(0, $iaoFN$reactariautils.chain)(onClose(), onPrimaryAction()),
|
|
550
581
|
isDisabled: isPrimaryActionDisabled,
|
|
551
|
-
autoFocus: autoFocusButton ===
|
|
552
|
-
}, primaryActionLabel)))
|
|
582
|
+
autoFocus: autoFocusButton === "primary"
|
|
583
|
+
}, primaryActionLabel)));
|
|
553
584
|
}
|
|
554
585
|
/**
|
|
555
586
|
* AlertDialogs are a specific type of Dialog. They display important information that users need to acknowledge.
|
|
556
|
-
*/ let $66f8653ff750aa27$export$de466dd8317b0b75 = /*#__PURE__*/ $iaoFN$react.forwardRef($66f8653ff750aa27$var$AlertDialog);
|
|
557
|
-
|
|
587
|
+
*/ let $66f8653ff750aa27$export$de466dd8317b0b75 = /*#__PURE__*/ (0, $iaoFN$react.forwardRef)($66f8653ff750aa27$var$AlertDialog);
|
|
558
588
|
|
|
559
589
|
|
|
560
590
|
|
|
591
|
+
/*
|
|
592
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
593
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
594
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
595
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
596
|
+
*
|
|
597
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
598
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
599
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
600
|
+
* governing permissions and limitations under the License.
|
|
601
|
+
*/
|
|
561
602
|
|
|
562
603
|
|
|
563
604
|
|
|
@@ -565,34 +606,32 @@ function $a57fc2323bf98a33$var$Dialog(props, ref) {
|
|
|
565
606
|
|
|
566
607
|
|
|
567
608
|
function $46e54a192dc519c9$var$DialogTrigger(props) {
|
|
568
|
-
let { children: children , type: type =
|
|
569
|
-
if (!Array.isArray(children) || children.length > 2) throw new Error(
|
|
609
|
+
let { children: children , type: type = "modal" , mobileType: mobileType = type === "popover" ? "modal" : type , hideArrow: hideArrow , targetRef: targetRef , isDismissable: isDismissable , isKeyboardDismissDisabled: isKeyboardDismissDisabled , ...positionProps } = props;
|
|
610
|
+
if (!Array.isArray(children) || children.length > 2) throw new Error("DialogTrigger must have exactly 2 children");
|
|
570
611
|
// if a function is passed as the second child, it won't appear in toArray
|
|
571
612
|
let [trigger, content] = children;
|
|
572
613
|
// On small devices, show a modal or tray instead of a popover.
|
|
573
614
|
// TODO: DNA variable?
|
|
574
|
-
let isMobile = $iaoFN$reactspectrumutils.useMediaQuery(
|
|
615
|
+
let isMobile = (0, $iaoFN$reactspectrumutils.useMediaQuery)("(max-width: 700px)");
|
|
575
616
|
if (isMobile) {
|
|
576
617
|
// handle cases where desktop popovers need a close button for the mobile modal view
|
|
577
|
-
if (type !==
|
|
618
|
+
if (type !== "modal" && mobileType === "modal") isDismissable = true;
|
|
578
619
|
type = mobileType;
|
|
579
620
|
}
|
|
580
|
-
let state = $iaoFN$reactstatelyoverlays.useOverlayTriggerState(props);
|
|
581
|
-
let wasOpen = $iaoFN$react.useRef(false);
|
|
621
|
+
let state = (0, $iaoFN$reactstatelyoverlays.useOverlayTriggerState)(props);
|
|
622
|
+
let wasOpen = (0, $iaoFN$react.useRef)(false);
|
|
582
623
|
wasOpen.current = state.isOpen;
|
|
583
|
-
let isExiting = $iaoFN$react.useRef(false);
|
|
584
|
-
let onExiting = ()=>isExiting.current = true
|
|
585
|
-
;
|
|
586
|
-
let onExited = ()=>isExiting.current = false
|
|
587
|
-
;
|
|
624
|
+
let isExiting = (0, $iaoFN$react.useRef)(false);
|
|
625
|
+
let onExiting = ()=>isExiting.current = true;
|
|
626
|
+
let onExited = ()=>isExiting.current = false;
|
|
588
627
|
// eslint-disable-next-line arrow-body-style
|
|
589
|
-
$iaoFN$react.useEffect(()=>{
|
|
628
|
+
(0, $iaoFN$react.useEffect)(()=>{
|
|
590
629
|
return ()=>{
|
|
591
|
-
if ((wasOpen.current || isExiting.current) && type !==
|
|
630
|
+
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.");
|
|
592
631
|
};
|
|
593
632
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
594
633
|
}, []);
|
|
595
|
-
if (type ===
|
|
634
|
+
if (type === "popover") return /*#__PURE__*/ (0, ($parcel$interopDefault($iaoFN$react))).createElement($46e54a192dc519c9$var$PopoverTrigger, {
|
|
596
635
|
...positionProps,
|
|
597
636
|
state: state,
|
|
598
637
|
targetRef: targetRef,
|
|
@@ -600,42 +639,42 @@ function $46e54a192dc519c9$var$DialogTrigger(props) {
|
|
|
600
639
|
content: content,
|
|
601
640
|
isKeyboardDismissDisabled: isKeyboardDismissDisabled,
|
|
602
641
|
hideArrow: hideArrow
|
|
603
|
-
})
|
|
642
|
+
});
|
|
604
643
|
let renderOverlay = ()=>{
|
|
605
644
|
switch(type){
|
|
606
|
-
case
|
|
607
|
-
case
|
|
608
|
-
case
|
|
609
|
-
return
|
|
645
|
+
case "fullscreen":
|
|
646
|
+
case "fullscreenTakeover":
|
|
647
|
+
case "modal":
|
|
648
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($iaoFN$react))).createElement((0, $iaoFN$reactspectrumoverlays.Modal), {
|
|
610
649
|
state: state,
|
|
611
|
-
isDismissable: type ===
|
|
650
|
+
isDismissable: type === "modal" ? isDismissable : false,
|
|
612
651
|
type: type,
|
|
613
652
|
isKeyboardDismissDisabled: isKeyboardDismissDisabled,
|
|
614
653
|
onExiting: onExiting,
|
|
615
654
|
onExited: onExited
|
|
616
|
-
}, typeof content ===
|
|
617
|
-
case
|
|
618
|
-
return
|
|
655
|
+
}, typeof content === "function" ? content(state.close) : content);
|
|
656
|
+
case "tray":
|
|
657
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($iaoFN$react))).createElement((0, $iaoFN$reactspectrumoverlays.Tray), {
|
|
619
658
|
state: state,
|
|
620
659
|
isKeyboardDismissDisabled: isKeyboardDismissDisabled
|
|
621
|
-
}, typeof content ===
|
|
660
|
+
}, typeof content === "function" ? content(state.close) : content);
|
|
622
661
|
}
|
|
623
662
|
};
|
|
624
|
-
return
|
|
663
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($iaoFN$react))).createElement($46e54a192dc519c9$var$DialogTriggerBase, {
|
|
625
664
|
type: type,
|
|
626
665
|
state: state,
|
|
627
666
|
isDismissable: isDismissable,
|
|
628
667
|
trigger: trigger,
|
|
629
668
|
overlay: renderOverlay()
|
|
630
|
-
})
|
|
669
|
+
});
|
|
631
670
|
}
|
|
632
671
|
// Support DialogTrigger inside components using CollectionBuilder.
|
|
633
672
|
$46e54a192dc519c9$var$DialogTrigger.getCollectionNode = function*(props) {
|
|
634
|
-
let [trigger] = ($parcel$interopDefault($iaoFN$react)).Children.toArray(props.children);
|
|
673
|
+
let [trigger] = (0, ($parcel$interopDefault($iaoFN$react))).Children.toArray(props.children);
|
|
635
674
|
let [, content] = props.children;
|
|
636
675
|
yield {
|
|
637
676
|
element: trigger,
|
|
638
|
-
wrapper: (element)=>/*#__PURE__*/ ($parcel$interopDefault($iaoFN$react)).createElement($46e54a192dc519c9$var$DialogTrigger, {
|
|
677
|
+
wrapper: (element)=>/*#__PURE__*/ (0, ($parcel$interopDefault($iaoFN$react))).createElement($46e54a192dc519c9$var$DialogTrigger, {
|
|
639
678
|
key: element.key,
|
|
640
679
|
...props
|
|
641
680
|
}, element, content)
|
|
@@ -648,86 +687,104 @@ $46e54a192dc519c9$var$DialogTrigger.getCollectionNode = function*(props) {
|
|
|
648
687
|
*/ // We don't want getCollectionNode to show up in the type definition
|
|
649
688
|
let $46e54a192dc519c9$export$2e1e1122cf0cba88 = $46e54a192dc519c9$var$DialogTrigger;
|
|
650
689
|
function $46e54a192dc519c9$var$PopoverTrigger({ state: state , targetRef: targetRef , trigger: trigger , content: content , hideArrow: hideArrow , ...props }) {
|
|
651
|
-
let triggerRef = $iaoFN$react.useRef();
|
|
652
|
-
let { triggerProps: triggerProps , overlayProps: overlayProps } = $iaoFN$reactariaoverlays.useOverlayTrigger({
|
|
653
|
-
type:
|
|
690
|
+
let triggerRef = (0, $iaoFN$react.useRef)();
|
|
691
|
+
let { triggerProps: triggerProps , overlayProps: overlayProps } = (0, $iaoFN$reactariaoverlays.useOverlayTrigger)({
|
|
692
|
+
type: "dialog"
|
|
654
693
|
}, state, triggerRef);
|
|
655
694
|
let triggerPropsWithRef = {
|
|
656
695
|
...triggerProps,
|
|
657
696
|
ref: targetRef ? undefined : triggerRef
|
|
658
697
|
};
|
|
659
|
-
let overlay = /*#__PURE__*/ ($parcel$interopDefault($iaoFN$react)).createElement($iaoFN$reactspectrumoverlays.Popover, {
|
|
698
|
+
let overlay = /*#__PURE__*/ (0, ($parcel$interopDefault($iaoFN$react))).createElement((0, $iaoFN$reactspectrumoverlays.Popover), {
|
|
660
699
|
...props,
|
|
661
700
|
hideArrow: hideArrow,
|
|
662
701
|
triggerRef: targetRef || triggerRef,
|
|
663
702
|
state: state
|
|
664
|
-
}, typeof content ===
|
|
665
|
-
return
|
|
703
|
+
}, typeof content === "function" ? content(state.close) : content);
|
|
704
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($iaoFN$react))).createElement($46e54a192dc519c9$var$DialogTriggerBase, {
|
|
666
705
|
type: "popover",
|
|
667
706
|
state: state,
|
|
668
707
|
triggerProps: triggerPropsWithRef,
|
|
669
708
|
dialogProps: overlayProps,
|
|
670
709
|
trigger: trigger,
|
|
671
710
|
overlay: overlay
|
|
672
|
-
})
|
|
711
|
+
});
|
|
673
712
|
}
|
|
674
|
-
function $46e54a192dc519c9$var$DialogTriggerBase({ type: type , state: state , isDismissable: isDismissable , dialogProps: dialogProps = {
|
|
675
|
-
} , triggerProps: triggerProps = {
|
|
676
|
-
} , overlay: overlay , trigger: trigger }) {
|
|
713
|
+
function $46e54a192dc519c9$var$DialogTriggerBase({ type: type , state: state , isDismissable: isDismissable , dialogProps: dialogProps = {} , triggerProps: triggerProps = {} , overlay: overlay , trigger: trigger }) {
|
|
677
714
|
let context = {
|
|
678
715
|
type: type,
|
|
679
716
|
onClose: state.close,
|
|
680
717
|
isDismissable: isDismissable,
|
|
681
718
|
...dialogProps
|
|
682
719
|
};
|
|
683
|
-
return
|
|
720
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($iaoFN$react))).createElement((0, $iaoFN$react.Fragment), null, /*#__PURE__*/ (0, ($parcel$interopDefault($iaoFN$react))).createElement((0, $iaoFN$reactariainteractions.PressResponder), {
|
|
684
721
|
...triggerProps,
|
|
685
722
|
onPress: state.toggle,
|
|
686
|
-
isPressed: state.isOpen && type !==
|
|
687
|
-
}, trigger), /*#__PURE__*/ ($parcel$interopDefault($iaoFN$react)).createElement($0eb909ad2388d989$export$8b93a07348a7730c.Provider, {
|
|
723
|
+
isPressed: state.isOpen && type !== "modal" && type !== "fullscreen" && type !== "fullscreenTakeover"
|
|
724
|
+
}, trigger), /*#__PURE__*/ (0, ($parcel$interopDefault($iaoFN$react))).createElement((0, $0eb909ad2388d989$export$8b93a07348a7730c).Provider, {
|
|
688
725
|
value: context
|
|
689
|
-
}, overlay))
|
|
726
|
+
}, overlay));
|
|
690
727
|
}
|
|
691
728
|
|
|
692
729
|
|
|
693
|
-
|
|
730
|
+
/*
|
|
731
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
732
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
733
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
734
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
735
|
+
*
|
|
736
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
737
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
738
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
739
|
+
* governing permissions and limitations under the License.
|
|
740
|
+
*/
|
|
694
741
|
|
|
695
742
|
|
|
696
743
|
|
|
697
744
|
function $1b7050825e0eb5b6$export$547754aada6e339f(props) {
|
|
698
|
-
let { children: children , type: type =
|
|
699
|
-
let childArray = ($parcel$interopDefault($iaoFN$react)).Children.toArray(children);
|
|
700
|
-
if (childArray.length > 1) throw new Error(
|
|
701
|
-
let lastChild = $iaoFN$react.useRef(null);
|
|
702
|
-
let child = /*#__PURE__*/ ($parcel$interopDefault($iaoFN$react)).isValidElement(childArray[0]) ? childArray[0] : null;
|
|
745
|
+
let { children: children , type: type = "modal" , onDismiss: onDismiss , isDismissable: isDismissable , isKeyboardDismissDisabled: isKeyboardDismissDisabled } = props;
|
|
746
|
+
let childArray = (0, ($parcel$interopDefault($iaoFN$react))).Children.toArray(children);
|
|
747
|
+
if (childArray.length > 1) throw new Error("Only a single child can be passed to DialogContainer.");
|
|
748
|
+
let lastChild = (0, $iaoFN$react.useRef)(null);
|
|
749
|
+
let child = /*#__PURE__*/ (0, ($parcel$interopDefault($iaoFN$react))).isValidElement(childArray[0]) ? childArray[0] : null;
|
|
703
750
|
if (child) lastChild.current = child;
|
|
704
751
|
let context = {
|
|
705
752
|
type: type,
|
|
706
753
|
onClose: onDismiss,
|
|
707
754
|
isDismissable: isDismissable
|
|
708
755
|
};
|
|
709
|
-
let state = $iaoFN$reactstatelyoverlays.useOverlayTriggerState({
|
|
756
|
+
let state = (0, $iaoFN$reactstatelyoverlays.useOverlayTriggerState)({
|
|
710
757
|
isOpen: !!child,
|
|
711
758
|
onOpenChange: (isOpen)=>{
|
|
712
759
|
if (!isOpen) onDismiss();
|
|
713
760
|
}
|
|
714
761
|
});
|
|
715
|
-
return
|
|
762
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($iaoFN$react))).createElement((0, $iaoFN$reactspectrumoverlays.Modal), {
|
|
716
763
|
state: state,
|
|
717
764
|
type: type,
|
|
718
765
|
isDismissable: isDismissable,
|
|
719
766
|
isKeyboardDismissDisabled: isKeyboardDismissDisabled
|
|
720
|
-
}, /*#__PURE__*/ ($parcel$interopDefault($iaoFN$react)).createElement($0eb909ad2388d989$export$8b93a07348a7730c.Provider, {
|
|
767
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($iaoFN$react))).createElement((0, $0eb909ad2388d989$export$8b93a07348a7730c).Provider, {
|
|
721
768
|
value: context
|
|
722
|
-
}, lastChild.current))
|
|
769
|
+
}, lastChild.current));
|
|
723
770
|
}
|
|
724
771
|
|
|
725
772
|
|
|
726
|
-
|
|
773
|
+
/*
|
|
774
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
775
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
776
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
777
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
778
|
+
*
|
|
779
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
780
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
781
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
782
|
+
* governing permissions and limitations under the License.
|
|
783
|
+
*/
|
|
727
784
|
|
|
728
785
|
function $1f05ce3abe26c4cc$export$a2f2d8fa6720dab1() {
|
|
729
|
-
let context = $iaoFN$react.useContext($0eb909ad2388d989$export$8b93a07348a7730c);
|
|
730
|
-
if (!context) throw new Error(
|
|
786
|
+
let context = (0, $iaoFN$react.useContext)((0, $0eb909ad2388d989$export$8b93a07348a7730c));
|
|
787
|
+
if (!context) throw new Error("Cannot call useDialogContext outside a <DialogTrigger> or <DialogContainer>.");
|
|
731
788
|
return {
|
|
732
789
|
type: context.type,
|
|
733
790
|
dismiss () {
|