@react-spectrum/dialog 3.9.6 → 3.10.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.
Files changed (228) hide show
  1. package/dist/import.mjs +5 -7
  2. package/dist/main.js +9 -11
  3. package/dist/main.js.map +1 -1
  4. package/dist/module.js +5 -7
  5. package/dist/module.js.map +1 -1
  6. package/dist/types/src/index.d.ts +8 -0
  7. package/package.json +12 -43
  8. package/src/index.ts +8 -7
  9. package/dist/AlertDialog.main.js +0 -97
  10. package/dist/AlertDialog.main.js.map +0 -1
  11. package/dist/AlertDialog.mjs +0 -92
  12. package/dist/AlertDialog.module.js +0 -92
  13. package/dist/AlertDialog.module.js.map +0 -1
  14. package/dist/Dialog.main.js +0 -131
  15. package/dist/Dialog.main.js.map +0 -1
  16. package/dist/Dialog.mjs +0 -126
  17. package/dist/Dialog.module.js +0 -126
  18. package/dist/Dialog.module.js.map +0 -1
  19. package/dist/DialogContainer.main.js +0 -63
  20. package/dist/DialogContainer.main.js.map +0 -1
  21. package/dist/DialogContainer.mjs +0 -54
  22. package/dist/DialogContainer.module.js +0 -54
  23. package/dist/DialogContainer.module.js.map +0 -1
  24. package/dist/DialogTrigger.main.js +0 -161
  25. package/dist/DialogTrigger.main.js.map +0 -1
  26. package/dist/DialogTrigger.mjs +0 -152
  27. package/dist/DialogTrigger.module.js +0 -152
  28. package/dist/DialogTrigger.module.js.map +0 -1
  29. package/dist/ar-AE.main.js +0 -7
  30. package/dist/ar-AE.main.js.map +0 -1
  31. package/dist/ar-AE.mjs +0 -9
  32. package/dist/ar-AE.module.js +0 -9
  33. package/dist/ar-AE.module.js.map +0 -1
  34. package/dist/bg-BG.main.js +0 -7
  35. package/dist/bg-BG.main.js.map +0 -1
  36. package/dist/bg-BG.mjs +0 -9
  37. package/dist/bg-BG.module.js +0 -9
  38. package/dist/bg-BG.module.js.map +0 -1
  39. package/dist/context.main.js +0 -27
  40. package/dist/context.main.js.map +0 -1
  41. package/dist/context.mjs +0 -18
  42. package/dist/context.module.js +0 -18
  43. package/dist/context.module.js.map +0 -1
  44. package/dist/cs-CZ.main.js +0 -7
  45. package/dist/cs-CZ.main.js.map +0 -1
  46. package/dist/cs-CZ.mjs +0 -9
  47. package/dist/cs-CZ.module.js +0 -9
  48. package/dist/cs-CZ.module.js.map +0 -1
  49. package/dist/da-DK.main.js +0 -7
  50. package/dist/da-DK.main.js.map +0 -1
  51. package/dist/da-DK.mjs +0 -9
  52. package/dist/da-DK.module.js +0 -9
  53. package/dist/da-DK.module.js.map +0 -1
  54. package/dist/de-DE.main.js +0 -7
  55. package/dist/de-DE.main.js.map +0 -1
  56. package/dist/de-DE.mjs +0 -9
  57. package/dist/de-DE.module.js +0 -9
  58. package/dist/de-DE.module.js.map +0 -1
  59. package/dist/dialog.1f91a33b.css +0 -519
  60. package/dist/dialog.1f91a33b.css.map +0 -1
  61. package/dist/dialog_vars_css.main.js +0 -161
  62. package/dist/dialog_vars_css.main.js.map +0 -1
  63. package/dist/dialog_vars_css.mjs +0 -163
  64. package/dist/dialog_vars_css.module.js +0 -163
  65. package/dist/dialog_vars_css.module.js.map +0 -1
  66. package/dist/el-GR.main.js +0 -7
  67. package/dist/el-GR.main.js.map +0 -1
  68. package/dist/el-GR.mjs +0 -9
  69. package/dist/el-GR.module.js +0 -9
  70. package/dist/el-GR.module.js.map +0 -1
  71. package/dist/en-US.main.js +0 -7
  72. package/dist/en-US.main.js.map +0 -1
  73. package/dist/en-US.mjs +0 -9
  74. package/dist/en-US.module.js +0 -9
  75. package/dist/en-US.module.js.map +0 -1
  76. package/dist/es-ES.main.js +0 -7
  77. package/dist/es-ES.main.js.map +0 -1
  78. package/dist/es-ES.mjs +0 -9
  79. package/dist/es-ES.module.js +0 -9
  80. package/dist/es-ES.module.js.map +0 -1
  81. package/dist/et-EE.main.js +0 -7
  82. package/dist/et-EE.main.js.map +0 -1
  83. package/dist/et-EE.mjs +0 -9
  84. package/dist/et-EE.module.js +0 -9
  85. package/dist/et-EE.module.js.map +0 -1
  86. package/dist/fi-FI.main.js +0 -7
  87. package/dist/fi-FI.main.js.map +0 -1
  88. package/dist/fi-FI.mjs +0 -9
  89. package/dist/fi-FI.module.js +0 -9
  90. package/dist/fi-FI.module.js.map +0 -1
  91. package/dist/fr-FR.main.js +0 -7
  92. package/dist/fr-FR.main.js.map +0 -1
  93. package/dist/fr-FR.mjs +0 -9
  94. package/dist/fr-FR.module.js +0 -9
  95. package/dist/fr-FR.module.js.map +0 -1
  96. package/dist/he-IL.main.js +0 -7
  97. package/dist/he-IL.main.js.map +0 -1
  98. package/dist/he-IL.mjs +0 -9
  99. package/dist/he-IL.module.js +0 -9
  100. package/dist/he-IL.module.js.map +0 -1
  101. package/dist/hr-HR.main.js +0 -7
  102. package/dist/hr-HR.main.js.map +0 -1
  103. package/dist/hr-HR.mjs +0 -9
  104. package/dist/hr-HR.module.js +0 -9
  105. package/dist/hr-HR.module.js.map +0 -1
  106. package/dist/hu-HU.main.js +0 -7
  107. package/dist/hu-HU.main.js.map +0 -1
  108. package/dist/hu-HU.mjs +0 -9
  109. package/dist/hu-HU.module.js +0 -9
  110. package/dist/hu-HU.module.js.map +0 -1
  111. package/dist/intlStrings.main.js +0 -108
  112. package/dist/intlStrings.main.js.map +0 -1
  113. package/dist/intlStrings.mjs +0 -110
  114. package/dist/intlStrings.module.js +0 -110
  115. package/dist/intlStrings.module.js.map +0 -1
  116. package/dist/it-IT.main.js +0 -7
  117. package/dist/it-IT.main.js.map +0 -1
  118. package/dist/it-IT.mjs +0 -9
  119. package/dist/it-IT.module.js +0 -9
  120. package/dist/it-IT.module.js.map +0 -1
  121. package/dist/ja-JP.main.js +0 -7
  122. package/dist/ja-JP.main.js.map +0 -1
  123. package/dist/ja-JP.mjs +0 -9
  124. package/dist/ja-JP.module.js +0 -9
  125. package/dist/ja-JP.module.js.map +0 -1
  126. package/dist/ko-KR.main.js +0 -7
  127. package/dist/ko-KR.main.js.map +0 -1
  128. package/dist/ko-KR.mjs +0 -9
  129. package/dist/ko-KR.module.js +0 -9
  130. package/dist/ko-KR.module.js.map +0 -1
  131. package/dist/lt-LT.main.js +0 -7
  132. package/dist/lt-LT.main.js.map +0 -1
  133. package/dist/lt-LT.mjs +0 -9
  134. package/dist/lt-LT.module.js +0 -9
  135. package/dist/lt-LT.module.js.map +0 -1
  136. package/dist/lv-LV.main.js +0 -7
  137. package/dist/lv-LV.main.js.map +0 -1
  138. package/dist/lv-LV.mjs +0 -9
  139. package/dist/lv-LV.module.js +0 -9
  140. package/dist/lv-LV.module.js.map +0 -1
  141. package/dist/nb-NO.main.js +0 -7
  142. package/dist/nb-NO.main.js.map +0 -1
  143. package/dist/nb-NO.mjs +0 -9
  144. package/dist/nb-NO.module.js +0 -9
  145. package/dist/nb-NO.module.js.map +0 -1
  146. package/dist/nl-NL.main.js +0 -7
  147. package/dist/nl-NL.main.js.map +0 -1
  148. package/dist/nl-NL.mjs +0 -9
  149. package/dist/nl-NL.module.js +0 -9
  150. package/dist/nl-NL.module.js.map +0 -1
  151. package/dist/pl-PL.main.js +0 -7
  152. package/dist/pl-PL.main.js.map +0 -1
  153. package/dist/pl-PL.mjs +0 -9
  154. package/dist/pl-PL.module.js +0 -9
  155. package/dist/pl-PL.module.js.map +0 -1
  156. package/dist/pt-BR.main.js +0 -7
  157. package/dist/pt-BR.main.js.map +0 -1
  158. package/dist/pt-BR.mjs +0 -9
  159. package/dist/pt-BR.module.js +0 -9
  160. package/dist/pt-BR.module.js.map +0 -1
  161. package/dist/pt-PT.main.js +0 -7
  162. package/dist/pt-PT.main.js.map +0 -1
  163. package/dist/pt-PT.mjs +0 -9
  164. package/dist/pt-PT.module.js +0 -9
  165. package/dist/pt-PT.module.js.map +0 -1
  166. package/dist/ro-RO.main.js +0 -7
  167. package/dist/ro-RO.main.js.map +0 -1
  168. package/dist/ro-RO.mjs +0 -9
  169. package/dist/ro-RO.module.js +0 -9
  170. package/dist/ro-RO.module.js.map +0 -1
  171. package/dist/ru-RU.main.js +0 -7
  172. package/dist/ru-RU.main.js.map +0 -1
  173. package/dist/ru-RU.mjs +0 -9
  174. package/dist/ru-RU.module.js +0 -9
  175. package/dist/ru-RU.module.js.map +0 -1
  176. package/dist/sk-SK.main.js +0 -7
  177. package/dist/sk-SK.main.js.map +0 -1
  178. package/dist/sk-SK.mjs +0 -9
  179. package/dist/sk-SK.module.js +0 -9
  180. package/dist/sk-SK.module.js.map +0 -1
  181. package/dist/sl-SI.main.js +0 -7
  182. package/dist/sl-SI.main.js.map +0 -1
  183. package/dist/sl-SI.mjs +0 -9
  184. package/dist/sl-SI.module.js +0 -9
  185. package/dist/sl-SI.module.js.map +0 -1
  186. package/dist/sr-SP.main.js +0 -7
  187. package/dist/sr-SP.main.js.map +0 -1
  188. package/dist/sr-SP.mjs +0 -9
  189. package/dist/sr-SP.module.js +0 -9
  190. package/dist/sr-SP.module.js.map +0 -1
  191. package/dist/sv-SE.main.js +0 -7
  192. package/dist/sv-SE.main.js.map +0 -1
  193. package/dist/sv-SE.mjs +0 -9
  194. package/dist/sv-SE.module.js +0 -9
  195. package/dist/sv-SE.module.js.map +0 -1
  196. package/dist/tr-TR.main.js +0 -7
  197. package/dist/tr-TR.main.js.map +0 -1
  198. package/dist/tr-TR.mjs +0 -9
  199. package/dist/tr-TR.module.js +0 -9
  200. package/dist/tr-TR.module.js.map +0 -1
  201. package/dist/types.d.ts +0 -32
  202. package/dist/types.d.ts.map +0 -1
  203. package/dist/uk-UA.main.js +0 -7
  204. package/dist/uk-UA.main.js.map +0 -1
  205. package/dist/uk-UA.mjs +0 -9
  206. package/dist/uk-UA.module.js +0 -9
  207. package/dist/uk-UA.module.js.map +0 -1
  208. package/dist/useDialogContainer.main.js +0 -34
  209. package/dist/useDialogContainer.main.js.map +0 -1
  210. package/dist/useDialogContainer.mjs +0 -29
  211. package/dist/useDialogContainer.module.js +0 -29
  212. package/dist/useDialogContainer.module.js.map +0 -1
  213. package/dist/zh-CN.main.js +0 -7
  214. package/dist/zh-CN.main.js.map +0 -1
  215. package/dist/zh-CN.mjs +0 -9
  216. package/dist/zh-CN.module.js +0 -9
  217. package/dist/zh-CN.module.js.map +0 -1
  218. package/dist/zh-TW.main.js +0 -7
  219. package/dist/zh-TW.main.js.map +0 -1
  220. package/dist/zh-TW.mjs +0 -9
  221. package/dist/zh-TW.module.js +0 -9
  222. package/dist/zh-TW.module.js.map +0 -1
  223. package/src/AlertDialog.tsx +0 -115
  224. package/src/Dialog.tsx +0 -118
  225. package/src/DialogContainer.tsx +0 -79
  226. package/src/DialogTrigger.tsx +0 -207
  227. package/src/context.ts +0 -21
  228. package/src/useDialogContainer.ts +0 -33
@@ -1,131 +0,0 @@
1
- var $0eb909ad2388d989$exports = require("./context.main.js");
2
- var $7827d180f5c8b41b$exports = require("./intlStrings.main.js");
3
- require("./dialog.1f91a33b.css");
4
- var $a74c0984b1adb651$exports = require("./dialog_vars_css.main.js");
5
- var $1DWg7$reactspectrumbutton = require("@react-spectrum/button");
6
- var $1DWg7$reactspectrumutils = require("@react-spectrum/utils");
7
- var $1DWg7$spectrumiconsuiCrossLarge = require("@spectrum-icons/ui/CrossLarge");
8
- var $1DWg7$reactspectrumlayout = require("@react-spectrum/layout");
9
- var $1DWg7$reactariautils = require("@react-aria/utils");
10
- var $1DWg7$react = require("react");
11
- var $1DWg7$reactariadialog = require("@react-aria/dialog");
12
- var $1DWg7$reactariai18n = require("@react-aria/i18n");
13
-
14
-
15
- function $parcel$interopDefault(a) {
16
- return a && a.__esModule ? a.default : a;
17
- }
18
-
19
- function $parcel$export(e, n, v, s) {
20
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
21
- }
22
-
23
- $parcel$export(module.exports, "Dialog", () => $a57fc2323bf98a33$export$3ddf2d174ce01153);
24
- /*
25
- * Copyright 2020 Adobe. All rights reserved.
26
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
27
- * you may not use this file except in compliance with the License. You may obtain a copy
28
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
29
- *
30
- * Unless required by applicable law or agreed to in writing, software distributed under
31
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
32
- * OF ANY KIND, either express or implied. See the License for the specific language
33
- * governing permissions and limitations under the License.
34
- */
35
-
36
-
37
-
38
-
39
-
40
-
41
-
42
-
43
-
44
-
45
- let $a57fc2323bf98a33$var$sizeMap = {
46
- S: 'small',
47
- M: 'medium',
48
- L: 'large',
49
- fullscreen: 'fullscreen',
50
- fullscreenTakeover: 'fullscreenTakeover'
51
- };
52
- const $a57fc2323bf98a33$export$3ddf2d174ce01153 = /*#__PURE__*/ (0, ($parcel$interopDefault($1DWg7$react))).forwardRef(function Dialog(props, ref) {
53
- props = (0, $1DWg7$reactspectrumutils.useSlotProps)(props, 'dialog');
54
- let { type: type = 'modal', ...contextProps } = (0, $1DWg7$react.useContext)((0, $0eb909ad2388d989$exports.DialogContext)) || {};
55
- let { children: children, isDismissable: isDismissable = contextProps.isDismissable, onDismiss: onDismiss = contextProps.onClose, size: size, ...otherProps } = props;
56
- let stringFormatter = (0, $1DWg7$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($7827d180f5c8b41b$exports))), '@react-spectrum/dialog');
57
- let { styleProps: styleProps } = (0, $1DWg7$reactspectrumutils.useStyleProps)(otherProps);
58
- size = type === 'popover' ? size || 'S' : size || 'L';
59
- let domRef = (0, $1DWg7$reactspectrumutils.useDOMRef)(ref);
60
- let gridRef = (0, $1DWg7$react.useRef)(null);
61
- let sizeVariant = $a57fc2323bf98a33$var$sizeMap[type] || $a57fc2323bf98a33$var$sizeMap[size];
62
- let { dialogProps: dialogProps, titleProps: titleProps } = (0, $1DWg7$reactariadialog.useDialog)((0, $1DWg7$reactariautils.mergeProps)(contextProps, props), domRef);
63
- let hasHeader = (0, $1DWg7$reactspectrumutils.useHasChild)(`.${(0, ($parcel$interopDefault($a74c0984b1adb651$exports)))['spectrum-Dialog-header']}`, (0, $1DWg7$reactspectrumutils.unwrapDOMRef)(gridRef));
64
- let hasHeading = (0, $1DWg7$reactspectrumutils.useHasChild)(`.${(0, ($parcel$interopDefault($a74c0984b1adb651$exports)))['spectrum-Dialog-heading']}`, (0, $1DWg7$reactspectrumutils.unwrapDOMRef)(gridRef));
65
- let hasFooter = (0, $1DWg7$reactspectrumutils.useHasChild)(`.${(0, ($parcel$interopDefault($a74c0984b1adb651$exports)))['spectrum-Dialog-footer']}`, (0, $1DWg7$reactspectrumutils.unwrapDOMRef)(gridRef));
66
- let hasTypeIcon = (0, $1DWg7$reactspectrumutils.useHasChild)(`.${(0, ($parcel$interopDefault($a74c0984b1adb651$exports)))['spectrum-Dialog-typeIcon']}`, (0, $1DWg7$reactspectrumutils.unwrapDOMRef)(gridRef));
67
- let slots = (0, $1DWg7$react.useMemo)(()=>({
68
- hero: {
69
- UNSAFE_className: (0, ($parcel$interopDefault($a74c0984b1adb651$exports)))['spectrum-Dialog-hero']
70
- },
71
- heading: {
72
- UNSAFE_className: (0, $1DWg7$reactspectrumutils.classNames)((0, ($parcel$interopDefault($a74c0984b1adb651$exports))), 'spectrum-Dialog-heading', {
73
- 'spectrum-Dialog-heading--noHeader': !hasHeader,
74
- 'spectrum-Dialog-heading--noTypeIcon': !hasTypeIcon
75
- }),
76
- level: 2,
77
- ...titleProps
78
- },
79
- header: {
80
- UNSAFE_className: (0, $1DWg7$reactspectrumutils.classNames)((0, ($parcel$interopDefault($a74c0984b1adb651$exports))), 'spectrum-Dialog-header', {
81
- 'spectrum-Dialog-header--noHeading': !hasHeading,
82
- 'spectrum-Dialog-header--noTypeIcon': !hasTypeIcon
83
- })
84
- },
85
- typeIcon: {
86
- UNSAFE_className: (0, ($parcel$interopDefault($a74c0984b1adb651$exports)))['spectrum-Dialog-typeIcon']
87
- },
88
- divider: {
89
- UNSAFE_className: (0, ($parcel$interopDefault($a74c0984b1adb651$exports)))['spectrum-Dialog-divider'],
90
- size: 'M'
91
- },
92
- content: {
93
- UNSAFE_className: (0, ($parcel$interopDefault($a74c0984b1adb651$exports)))['spectrum-Dialog-content']
94
- },
95
- footer: {
96
- UNSAFE_className: (0, ($parcel$interopDefault($a74c0984b1adb651$exports)))['spectrum-Dialog-footer']
97
- },
98
- buttonGroup: {
99
- UNSAFE_className: (0, $1DWg7$reactspectrumutils.classNames)((0, ($parcel$interopDefault($a74c0984b1adb651$exports))), 'spectrum-Dialog-buttonGroup', {
100
- 'spectrum-Dialog-buttonGroup--noFooter': !hasFooter
101
- }),
102
- align: 'end'
103
- }
104
- }), [
105
- hasFooter,
106
- hasHeader,
107
- titleProps
108
- ]);
109
- return /*#__PURE__*/ (0, ($parcel$interopDefault($1DWg7$react))).createElement("section", {
110
- ...styleProps,
111
- ...dialogProps,
112
- className: (0, $1DWg7$reactspectrumutils.classNames)((0, ($parcel$interopDefault($a74c0984b1adb651$exports))), 'spectrum-Dialog', {
113
- [`spectrum-Dialog--${sizeVariant}`]: sizeVariant,
114
- 'spectrum-Dialog--dismissable': isDismissable
115
- }, styleProps.className),
116
- ref: domRef
117
- }, /*#__PURE__*/ (0, ($parcel$interopDefault($1DWg7$react))).createElement((0, $1DWg7$reactspectrumlayout.Grid), {
118
- ref: gridRef,
119
- UNSAFE_className: (0, ($parcel$interopDefault($a74c0984b1adb651$exports)))['spectrum-Dialog-grid']
120
- }, /*#__PURE__*/ (0, ($parcel$interopDefault($1DWg7$react))).createElement((0, $1DWg7$reactspectrumutils.SlotProvider), {
121
- slots: slots
122
- }, children), isDismissable && /*#__PURE__*/ (0, ($parcel$interopDefault($1DWg7$react))).createElement((0, $1DWg7$reactspectrumbutton.ActionButton), {
123
- UNSAFE_className: (0, ($parcel$interopDefault($a74c0984b1adb651$exports)))['spectrum-Dialog-closeButton'],
124
- isQuiet: true,
125
- "aria-label": stringFormatter.format('dismiss'),
126
- onPress: onDismiss
127
- }, /*#__PURE__*/ (0, ($parcel$interopDefault($1DWg7$react))).createElement((0, ($parcel$interopDefault($1DWg7$spectrumiconsuiCrossLarge))), null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;YAAK;QAExJ,CAAA,GAAI;QAAC;QAAW;QAAW;KAAW;IAEtC,qBACE,0DAAC;QACE,GAAG,UAAU;QACb,GAAG,WAAW;QACf,WAAW,CAAA,GAAA,oCAAS,EAClB,CAAA,GAAA,mDAAK,GACL,mBACA;YACE,CAAC,CAAC,iBAAiB,EAAE,aAAa,CAAC,EAAE;YACrC,gCAAgC;QAClC,GACA,WAAW,SAAS;QAEtB,KAAK;qBACL,0DAAC,CAAA,GAAA,+BAAG;QAAE,KAAK;QAAS,kBAAkB,CAAA,GAAA,mDAAK,CAAC,CAAC,uBAAuB;qBAClE,0DAAC,CAAA,GAAA,sCAAW;QAAE,OAAO;OAClB,WAEF,+BACC,0DAAC,CAAA,GAAA,uCAAW;QACV,kBAAkB,CAAA,GAAA,mDAAK,CAAC,CAAC,8BAA8B;QACvD,SAAA;QACA,cAAY,gBAAgB,MAAM,CAAC;QACnC,SAAS;qBACT,0DAAC,CAAA,GAAA,0DAAS;AAMtB","sources":["packages/@react-spectrum/dialog/src/Dialog.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 {ActionButton} from '@react-spectrum/button';\nimport {\n classNames,\n SlotProvider,\n unwrapDOMRef,\n useDOMRef,\n useHasChild,\n useSlotProps,\n useStyleProps\n} from '@react-spectrum/utils';\nimport CrossLarge from '@spectrum-icons/ui/CrossLarge';\nimport {DialogContext, DialogContextValue} from './context';\nimport {DOMRef} from '@react-types/shared';\nimport {Grid} from '@react-spectrum/layout';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {mergeProps} from '@react-aria/utils';\nimport React, {useContext, useMemo, useRef} from 'react';\nimport {SpectrumDialogProps} from '@react-types/dialog';\nimport styles from '@adobe/spectrum-css-temp/components/dialog/vars.css';\nimport {useDialog} from '@react-aria/dialog';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\nlet sizeMap = {\n S: 'small',\n M: 'medium',\n L: 'large',\n fullscreen: 'fullscreen',\n fullscreenTakeover: 'fullscreenTakeover'\n};\n\n/**\n * Dialogs are windows containing contextual information, tasks, or workflows that appear over the user interface.\n * Depending on the kind of Dialog, further interactions may be blocked until the Dialog is acknowledged.\n */\nexport const Dialog = React.forwardRef(function Dialog(props: SpectrumDialogProps, ref: DOMRef) {\n props = useSlotProps(props, 'dialog');\n let {\n type = 'modal',\n ...contextProps\n } = useContext(DialogContext) || {} as DialogContextValue;\n let {\n children,\n isDismissable = contextProps.isDismissable,\n onDismiss = contextProps.onClose,\n size,\n ...otherProps\n } = props;\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/dialog');\n let {styleProps} = useStyleProps(otherProps);\n\n size = type === 'popover' ? (size || 'S') : (size || 'L');\n\n let domRef = useDOMRef(ref);\n let gridRef = useRef(null);\n let sizeVariant = sizeMap[type] || sizeMap[size];\n let {dialogProps, titleProps} = useDialog(mergeProps(contextProps, props), domRef);\n\n let hasHeader = useHasChild(`.${styles['spectrum-Dialog-header']}`, unwrapDOMRef(gridRef));\n let hasHeading = useHasChild(`.${styles['spectrum-Dialog-heading']}`, unwrapDOMRef(gridRef));\n let hasFooter = useHasChild(`.${styles['spectrum-Dialog-footer']}`, unwrapDOMRef(gridRef));\n let hasTypeIcon = useHasChild(`.${styles['spectrum-Dialog-typeIcon']}`, unwrapDOMRef(gridRef));\n\n let slots = useMemo(() => ({\n hero: {UNSAFE_className: styles['spectrum-Dialog-hero']},\n heading: {UNSAFE_className: classNames(styles, 'spectrum-Dialog-heading', {'spectrum-Dialog-heading--noHeader': !hasHeader, 'spectrum-Dialog-heading--noTypeIcon': !hasTypeIcon}), level: 2, ...titleProps},\n header: {UNSAFE_className: classNames(styles, 'spectrum-Dialog-header', {'spectrum-Dialog-header--noHeading': !hasHeading, 'spectrum-Dialog-header--noTypeIcon': !hasTypeIcon})},\n typeIcon: {UNSAFE_className: styles['spectrum-Dialog-typeIcon']},\n divider: {UNSAFE_className: styles['spectrum-Dialog-divider'], size: 'M'},\n content: {UNSAFE_className: styles['spectrum-Dialog-content']},\n footer: {UNSAFE_className: styles['spectrum-Dialog-footer']},\n buttonGroup: {UNSAFE_className: classNames(styles, 'spectrum-Dialog-buttonGroup', {'spectrum-Dialog-buttonGroup--noFooter': !hasFooter}), align: 'end'}\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }), [hasFooter, hasHeader, titleProps]);\n\n return (\n <section\n {...styleProps}\n {...dialogProps}\n className={classNames(\n styles,\n 'spectrum-Dialog',\n {\n [`spectrum-Dialog--${sizeVariant}`]: sizeVariant,\n 'spectrum-Dialog--dismissable': isDismissable\n },\n styleProps.className\n )}\n ref={domRef}>\n <Grid ref={gridRef} UNSAFE_className={styles['spectrum-Dialog-grid']}>\n <SlotProvider slots={slots}>\n {children}\n </SlotProvider>\n {isDismissable &&\n <ActionButton\n UNSAFE_className={styles['spectrum-Dialog-closeButton']}\n isQuiet\n aria-label={stringFormatter.format('dismiss')}\n onPress={onDismiss}>\n <CrossLarge />\n </ActionButton>\n }\n </Grid>\n </section>\n );\n});\n"],"names":[],"version":3,"file":"Dialog.main.js.map"}
package/dist/Dialog.mjs DELETED
@@ -1,126 +0,0 @@
1
- import {DialogContext as $97b119e05830ea0d$export$8b93a07348a7730c} from "./context.mjs";
2
- import $3e38X$intlStringsmodulejs from "./intlStrings.mjs";
3
- import "./dialog.1f91a33b.css";
4
- import $3e38X$dialog_vars_cssmodulejs from "./dialog_vars_css.mjs";
5
- import {ActionButton as $3e38X$ActionButton} from "@react-spectrum/button";
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";
7
- import $3e38X$spectrumiconsuiCrossLarge from "@spectrum-icons/ui/CrossLarge";
8
- import {Grid as $3e38X$Grid} from "@react-spectrum/layout";
9
- import {mergeProps as $3e38X$mergeProps} from "@react-aria/utils";
10
- import $3e38X$react, {useContext as $3e38X$useContext, useRef as $3e38X$useRef, useMemo as $3e38X$useMemo} from "react";
11
- import {useDialog as $3e38X$useDialog} from "@react-aria/dialog";
12
- import {useLocalizedStringFormatter as $3e38X$useLocalizedStringFormatter} from "@react-aria/i18n";
13
-
14
-
15
- function $parcel$interopDefault(a) {
16
- return a && a.__esModule ? a.default : a;
17
- }
18
- /*
19
- * Copyright 2020 Adobe. All rights reserved.
20
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
21
- * you may not use this file except in compliance with the License. You may obtain a copy
22
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
23
- *
24
- * Unless required by applicable law or agreed to in writing, software distributed under
25
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
26
- * OF ANY KIND, either express or implied. See the License for the specific language
27
- * governing permissions and limitations under the License.
28
- */
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
- let $99cd51dc4eb569f7$var$sizeMap = {
40
- S: 'small',
41
- M: 'medium',
42
- L: 'large',
43
- fullscreen: 'fullscreen',
44
- fullscreenTakeover: 'fullscreenTakeover'
45
- };
46
- const $99cd51dc4eb569f7$export$3ddf2d174ce01153 = /*#__PURE__*/ (0, $3e38X$react).forwardRef(function Dialog(props, ref) {
47
- props = (0, $3e38X$useSlotProps)(props, 'dialog');
48
- let { type: type = 'modal', ...contextProps } = (0, $3e38X$useContext)((0, $97b119e05830ea0d$export$8b93a07348a7730c)) || {};
49
- let { children: children, isDismissable: isDismissable = contextProps.isDismissable, onDismiss: onDismiss = contextProps.onClose, size: size, ...otherProps } = props;
50
- let stringFormatter = (0, $3e38X$useLocalizedStringFormatter)((0, ($parcel$interopDefault($3e38X$intlStringsmodulejs))), '@react-spectrum/dialog');
51
- let { styleProps: styleProps } = (0, $3e38X$useStyleProps)(otherProps);
52
- size = type === 'popover' ? size || 'S' : size || 'L';
53
- let domRef = (0, $3e38X$useDOMRef)(ref);
54
- let gridRef = (0, $3e38X$useRef)(null);
55
- let sizeVariant = $99cd51dc4eb569f7$var$sizeMap[type] || $99cd51dc4eb569f7$var$sizeMap[size];
56
- let { dialogProps: dialogProps, titleProps: titleProps } = (0, $3e38X$useDialog)((0, $3e38X$mergeProps)(contextProps, props), domRef);
57
- let hasHeader = (0, $3e38X$useHasChild)(`.${(0, ($parcel$interopDefault($3e38X$dialog_vars_cssmodulejs)))['spectrum-Dialog-header']}`, (0, $3e38X$unwrapDOMRef)(gridRef));
58
- let hasHeading = (0, $3e38X$useHasChild)(`.${(0, ($parcel$interopDefault($3e38X$dialog_vars_cssmodulejs)))['spectrum-Dialog-heading']}`, (0, $3e38X$unwrapDOMRef)(gridRef));
59
- let hasFooter = (0, $3e38X$useHasChild)(`.${(0, ($parcel$interopDefault($3e38X$dialog_vars_cssmodulejs)))['spectrum-Dialog-footer']}`, (0, $3e38X$unwrapDOMRef)(gridRef));
60
- let hasTypeIcon = (0, $3e38X$useHasChild)(`.${(0, ($parcel$interopDefault($3e38X$dialog_vars_cssmodulejs)))['spectrum-Dialog-typeIcon']}`, (0, $3e38X$unwrapDOMRef)(gridRef));
61
- let slots = (0, $3e38X$useMemo)(()=>({
62
- hero: {
63
- UNSAFE_className: (0, ($parcel$interopDefault($3e38X$dialog_vars_cssmodulejs)))['spectrum-Dialog-hero']
64
- },
65
- heading: {
66
- UNSAFE_className: (0, $3e38X$classNames)((0, ($parcel$interopDefault($3e38X$dialog_vars_cssmodulejs))), 'spectrum-Dialog-heading', {
67
- 'spectrum-Dialog-heading--noHeader': !hasHeader,
68
- 'spectrum-Dialog-heading--noTypeIcon': !hasTypeIcon
69
- }),
70
- level: 2,
71
- ...titleProps
72
- },
73
- header: {
74
- UNSAFE_className: (0, $3e38X$classNames)((0, ($parcel$interopDefault($3e38X$dialog_vars_cssmodulejs))), 'spectrum-Dialog-header', {
75
- 'spectrum-Dialog-header--noHeading': !hasHeading,
76
- 'spectrum-Dialog-header--noTypeIcon': !hasTypeIcon
77
- })
78
- },
79
- typeIcon: {
80
- UNSAFE_className: (0, ($parcel$interopDefault($3e38X$dialog_vars_cssmodulejs)))['spectrum-Dialog-typeIcon']
81
- },
82
- divider: {
83
- UNSAFE_className: (0, ($parcel$interopDefault($3e38X$dialog_vars_cssmodulejs)))['spectrum-Dialog-divider'],
84
- size: 'M'
85
- },
86
- content: {
87
- UNSAFE_className: (0, ($parcel$interopDefault($3e38X$dialog_vars_cssmodulejs)))['spectrum-Dialog-content']
88
- },
89
- footer: {
90
- UNSAFE_className: (0, ($parcel$interopDefault($3e38X$dialog_vars_cssmodulejs)))['spectrum-Dialog-footer']
91
- },
92
- buttonGroup: {
93
- UNSAFE_className: (0, $3e38X$classNames)((0, ($parcel$interopDefault($3e38X$dialog_vars_cssmodulejs))), 'spectrum-Dialog-buttonGroup', {
94
- 'spectrum-Dialog-buttonGroup--noFooter': !hasFooter
95
- }),
96
- align: 'end'
97
- }
98
- }), [
99
- hasFooter,
100
- hasHeader,
101
- titleProps
102
- ]);
103
- return /*#__PURE__*/ (0, $3e38X$react).createElement("section", {
104
- ...styleProps,
105
- ...dialogProps,
106
- className: (0, $3e38X$classNames)((0, ($parcel$interopDefault($3e38X$dialog_vars_cssmodulejs))), 'spectrum-Dialog', {
107
- [`spectrum-Dialog--${sizeVariant}`]: sizeVariant,
108
- 'spectrum-Dialog--dismissable': isDismissable
109
- }, styleProps.className),
110
- ref: domRef
111
- }, /*#__PURE__*/ (0, $3e38X$react).createElement((0, $3e38X$Grid), {
112
- ref: gridRef,
113
- UNSAFE_className: (0, ($parcel$interopDefault($3e38X$dialog_vars_cssmodulejs)))['spectrum-Dialog-grid']
114
- }, /*#__PURE__*/ (0, $3e38X$react).createElement((0, $3e38X$SlotProvider), {
115
- slots: slots
116
- }, children), isDismissable && /*#__PURE__*/ (0, $3e38X$react).createElement((0, $3e38X$ActionButton), {
117
- UNSAFE_className: (0, ($parcel$interopDefault($3e38X$dialog_vars_cssmodulejs)))['spectrum-Dialog-closeButton'],
118
- isQuiet: true,
119
- "aria-label": stringFormatter.format('dismiss'),
120
- onPress: onDismiss
121
- }, /*#__PURE__*/ (0, $3e38X$react).createElement((0, $3e38X$spectrumiconsuiCrossLarge), null))));
122
- });
123
-
124
-
125
- export {$99cd51dc4eb569f7$export$3ddf2d174ce01153 as Dialog};
126
- //# sourceMappingURL=Dialog.module.js.map
@@ -1,126 +0,0 @@
1
- import {DialogContext as $97b119e05830ea0d$export$8b93a07348a7730c} from "./context.module.js";
2
- import $3e38X$intlStringsmodulejs from "./intlStrings.module.js";
3
- import "./dialog.1f91a33b.css";
4
- import $3e38X$dialog_vars_cssmodulejs from "./dialog_vars_css.module.js";
5
- import {ActionButton as $3e38X$ActionButton} from "@react-spectrum/button";
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";
7
- import $3e38X$spectrumiconsuiCrossLarge from "@spectrum-icons/ui/CrossLarge";
8
- import {Grid as $3e38X$Grid} from "@react-spectrum/layout";
9
- import {mergeProps as $3e38X$mergeProps} from "@react-aria/utils";
10
- import $3e38X$react, {useContext as $3e38X$useContext, useRef as $3e38X$useRef, useMemo as $3e38X$useMemo} from "react";
11
- import {useDialog as $3e38X$useDialog} from "@react-aria/dialog";
12
- import {useLocalizedStringFormatter as $3e38X$useLocalizedStringFormatter} from "@react-aria/i18n";
13
-
14
-
15
- function $parcel$interopDefault(a) {
16
- return a && a.__esModule ? a.default : a;
17
- }
18
- /*
19
- * Copyright 2020 Adobe. All rights reserved.
20
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
21
- * you may not use this file except in compliance with the License. You may obtain a copy
22
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
23
- *
24
- * Unless required by applicable law or agreed to in writing, software distributed under
25
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
26
- * OF ANY KIND, either express or implied. See the License for the specific language
27
- * governing permissions and limitations under the License.
28
- */
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
- let $99cd51dc4eb569f7$var$sizeMap = {
40
- S: 'small',
41
- M: 'medium',
42
- L: 'large',
43
- fullscreen: 'fullscreen',
44
- fullscreenTakeover: 'fullscreenTakeover'
45
- };
46
- const $99cd51dc4eb569f7$export$3ddf2d174ce01153 = /*#__PURE__*/ (0, $3e38X$react).forwardRef(function Dialog(props, ref) {
47
- props = (0, $3e38X$useSlotProps)(props, 'dialog');
48
- let { type: type = 'modal', ...contextProps } = (0, $3e38X$useContext)((0, $97b119e05830ea0d$export$8b93a07348a7730c)) || {};
49
- let { children: children, isDismissable: isDismissable = contextProps.isDismissable, onDismiss: onDismiss = contextProps.onClose, size: size, ...otherProps } = props;
50
- let stringFormatter = (0, $3e38X$useLocalizedStringFormatter)((0, ($parcel$interopDefault($3e38X$intlStringsmodulejs))), '@react-spectrum/dialog');
51
- let { styleProps: styleProps } = (0, $3e38X$useStyleProps)(otherProps);
52
- size = type === 'popover' ? size || 'S' : size || 'L';
53
- let domRef = (0, $3e38X$useDOMRef)(ref);
54
- let gridRef = (0, $3e38X$useRef)(null);
55
- let sizeVariant = $99cd51dc4eb569f7$var$sizeMap[type] || $99cd51dc4eb569f7$var$sizeMap[size];
56
- let { dialogProps: dialogProps, titleProps: titleProps } = (0, $3e38X$useDialog)((0, $3e38X$mergeProps)(contextProps, props), domRef);
57
- let hasHeader = (0, $3e38X$useHasChild)(`.${(0, ($parcel$interopDefault($3e38X$dialog_vars_cssmodulejs)))['spectrum-Dialog-header']}`, (0, $3e38X$unwrapDOMRef)(gridRef));
58
- let hasHeading = (0, $3e38X$useHasChild)(`.${(0, ($parcel$interopDefault($3e38X$dialog_vars_cssmodulejs)))['spectrum-Dialog-heading']}`, (0, $3e38X$unwrapDOMRef)(gridRef));
59
- let hasFooter = (0, $3e38X$useHasChild)(`.${(0, ($parcel$interopDefault($3e38X$dialog_vars_cssmodulejs)))['spectrum-Dialog-footer']}`, (0, $3e38X$unwrapDOMRef)(gridRef));
60
- let hasTypeIcon = (0, $3e38X$useHasChild)(`.${(0, ($parcel$interopDefault($3e38X$dialog_vars_cssmodulejs)))['spectrum-Dialog-typeIcon']}`, (0, $3e38X$unwrapDOMRef)(gridRef));
61
- let slots = (0, $3e38X$useMemo)(()=>({
62
- hero: {
63
- UNSAFE_className: (0, ($parcel$interopDefault($3e38X$dialog_vars_cssmodulejs)))['spectrum-Dialog-hero']
64
- },
65
- heading: {
66
- UNSAFE_className: (0, $3e38X$classNames)((0, ($parcel$interopDefault($3e38X$dialog_vars_cssmodulejs))), 'spectrum-Dialog-heading', {
67
- 'spectrum-Dialog-heading--noHeader': !hasHeader,
68
- 'spectrum-Dialog-heading--noTypeIcon': !hasTypeIcon
69
- }),
70
- level: 2,
71
- ...titleProps
72
- },
73
- header: {
74
- UNSAFE_className: (0, $3e38X$classNames)((0, ($parcel$interopDefault($3e38X$dialog_vars_cssmodulejs))), 'spectrum-Dialog-header', {
75
- 'spectrum-Dialog-header--noHeading': !hasHeading,
76
- 'spectrum-Dialog-header--noTypeIcon': !hasTypeIcon
77
- })
78
- },
79
- typeIcon: {
80
- UNSAFE_className: (0, ($parcel$interopDefault($3e38X$dialog_vars_cssmodulejs)))['spectrum-Dialog-typeIcon']
81
- },
82
- divider: {
83
- UNSAFE_className: (0, ($parcel$interopDefault($3e38X$dialog_vars_cssmodulejs)))['spectrum-Dialog-divider'],
84
- size: 'M'
85
- },
86
- content: {
87
- UNSAFE_className: (0, ($parcel$interopDefault($3e38X$dialog_vars_cssmodulejs)))['spectrum-Dialog-content']
88
- },
89
- footer: {
90
- UNSAFE_className: (0, ($parcel$interopDefault($3e38X$dialog_vars_cssmodulejs)))['spectrum-Dialog-footer']
91
- },
92
- buttonGroup: {
93
- UNSAFE_className: (0, $3e38X$classNames)((0, ($parcel$interopDefault($3e38X$dialog_vars_cssmodulejs))), 'spectrum-Dialog-buttonGroup', {
94
- 'spectrum-Dialog-buttonGroup--noFooter': !hasFooter
95
- }),
96
- align: 'end'
97
- }
98
- }), [
99
- hasFooter,
100
- hasHeader,
101
- titleProps
102
- ]);
103
- return /*#__PURE__*/ (0, $3e38X$react).createElement("section", {
104
- ...styleProps,
105
- ...dialogProps,
106
- className: (0, $3e38X$classNames)((0, ($parcel$interopDefault($3e38X$dialog_vars_cssmodulejs))), 'spectrum-Dialog', {
107
- [`spectrum-Dialog--${sizeVariant}`]: sizeVariant,
108
- 'spectrum-Dialog--dismissable': isDismissable
109
- }, styleProps.className),
110
- ref: domRef
111
- }, /*#__PURE__*/ (0, $3e38X$react).createElement((0, $3e38X$Grid), {
112
- ref: gridRef,
113
- UNSAFE_className: (0, ($parcel$interopDefault($3e38X$dialog_vars_cssmodulejs)))['spectrum-Dialog-grid']
114
- }, /*#__PURE__*/ (0, $3e38X$react).createElement((0, $3e38X$SlotProvider), {
115
- slots: slots
116
- }, children), isDismissable && /*#__PURE__*/ (0, $3e38X$react).createElement((0, $3e38X$ActionButton), {
117
- UNSAFE_className: (0, ($parcel$interopDefault($3e38X$dialog_vars_cssmodulejs)))['spectrum-Dialog-closeButton'],
118
- isQuiet: true,
119
- "aria-label": stringFormatter.format('dismiss'),
120
- onPress: onDismiss
121
- }, /*#__PURE__*/ (0, $3e38X$react).createElement((0, $3e38X$spectrumiconsuiCrossLarge), null))));
122
- });
123
-
124
-
125
- export {$99cd51dc4eb569f7$export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;QAExJ,CAAA,GAAI;QAAC;QAAW;QAAW;KAAW;IAEtC,qBACE,gCAAC;QACE,GAAG,UAAU;QACb,GAAG,WAAW;QACf,WAAW,CAAA,GAAA,iBAAS,EAClB,CAAA,GAAA,wDAAK,GACL,mBACA;YACE,CAAC,CAAC,iBAAiB,EAAE,aAAa,CAAC,EAAE;YACrC,gCAAgC;QAClC,GACA,WAAW,SAAS;QAEtB,KAAK;qBACL,gCAAC,CAAA,GAAA,WAAG;QAAE,KAAK;QAAS,kBAAkB,CAAA,GAAA,wDAAK,CAAC,CAAC,uBAAuB;qBAClE,gCAAC,CAAA,GAAA,mBAAW;QAAE,OAAO;OAClB,WAEF,+BACC,gCAAC,CAAA,GAAA,mBAAW;QACV,kBAAkB,CAAA,GAAA,wDAAK,CAAC,CAAC,8BAA8B;QACvD,SAAA;QACA,cAAY,gBAAgB,MAAM,CAAC;QACnC,SAAS;qBACT,gCAAC,CAAA,GAAA,gCAAS;AAMtB","sources":["packages/@react-spectrum/dialog/src/Dialog.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 {ActionButton} from '@react-spectrum/button';\nimport {\n classNames,\n SlotProvider,\n unwrapDOMRef,\n useDOMRef,\n useHasChild,\n useSlotProps,\n useStyleProps\n} from '@react-spectrum/utils';\nimport CrossLarge from '@spectrum-icons/ui/CrossLarge';\nimport {DialogContext, DialogContextValue} from './context';\nimport {DOMRef} from '@react-types/shared';\nimport {Grid} from '@react-spectrum/layout';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {mergeProps} from '@react-aria/utils';\nimport React, {useContext, useMemo, useRef} from 'react';\nimport {SpectrumDialogProps} from '@react-types/dialog';\nimport styles from '@adobe/spectrum-css-temp/components/dialog/vars.css';\nimport {useDialog} from '@react-aria/dialog';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\nlet sizeMap = {\n S: 'small',\n M: 'medium',\n L: 'large',\n fullscreen: 'fullscreen',\n fullscreenTakeover: 'fullscreenTakeover'\n};\n\n/**\n * Dialogs are windows containing contextual information, tasks, or workflows that appear over the user interface.\n * Depending on the kind of Dialog, further interactions may be blocked until the Dialog is acknowledged.\n */\nexport const Dialog = React.forwardRef(function Dialog(props: SpectrumDialogProps, ref: DOMRef) {\n props = useSlotProps(props, 'dialog');\n let {\n type = 'modal',\n ...contextProps\n } = useContext(DialogContext) || {} as DialogContextValue;\n let {\n children,\n isDismissable = contextProps.isDismissable,\n onDismiss = contextProps.onClose,\n size,\n ...otherProps\n } = props;\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/dialog');\n let {styleProps} = useStyleProps(otherProps);\n\n size = type === 'popover' ? (size || 'S') : (size || 'L');\n\n let domRef = useDOMRef(ref);\n let gridRef = useRef(null);\n let sizeVariant = sizeMap[type] || sizeMap[size];\n let {dialogProps, titleProps} = useDialog(mergeProps(contextProps, props), domRef);\n\n let hasHeader = useHasChild(`.${styles['spectrum-Dialog-header']}`, unwrapDOMRef(gridRef));\n let hasHeading = useHasChild(`.${styles['spectrum-Dialog-heading']}`, unwrapDOMRef(gridRef));\n let hasFooter = useHasChild(`.${styles['spectrum-Dialog-footer']}`, unwrapDOMRef(gridRef));\n let hasTypeIcon = useHasChild(`.${styles['spectrum-Dialog-typeIcon']}`, unwrapDOMRef(gridRef));\n\n let slots = useMemo(() => ({\n hero: {UNSAFE_className: styles['spectrum-Dialog-hero']},\n heading: {UNSAFE_className: classNames(styles, 'spectrum-Dialog-heading', {'spectrum-Dialog-heading--noHeader': !hasHeader, 'spectrum-Dialog-heading--noTypeIcon': !hasTypeIcon}), level: 2, ...titleProps},\n header: {UNSAFE_className: classNames(styles, 'spectrum-Dialog-header', {'spectrum-Dialog-header--noHeading': !hasHeading, 'spectrum-Dialog-header--noTypeIcon': !hasTypeIcon})},\n typeIcon: {UNSAFE_className: styles['spectrum-Dialog-typeIcon']},\n divider: {UNSAFE_className: styles['spectrum-Dialog-divider'], size: 'M'},\n content: {UNSAFE_className: styles['spectrum-Dialog-content']},\n footer: {UNSAFE_className: styles['spectrum-Dialog-footer']},\n buttonGroup: {UNSAFE_className: classNames(styles, 'spectrum-Dialog-buttonGroup', {'spectrum-Dialog-buttonGroup--noFooter': !hasFooter}), align: 'end'}\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }), [hasFooter, hasHeader, titleProps]);\n\n return (\n <section\n {...styleProps}\n {...dialogProps}\n className={classNames(\n styles,\n 'spectrum-Dialog',\n {\n [`spectrum-Dialog--${sizeVariant}`]: sizeVariant,\n 'spectrum-Dialog--dismissable': isDismissable\n },\n styleProps.className\n )}\n ref={domRef}>\n <Grid ref={gridRef} UNSAFE_className={styles['spectrum-Dialog-grid']}>\n <SlotProvider slots={slots}>\n {children}\n </SlotProvider>\n {isDismissable &&\n <ActionButton\n UNSAFE_className={styles['spectrum-Dialog-closeButton']}\n isQuiet\n aria-label={stringFormatter.format('dismiss')}\n onPress={onDismiss}>\n <CrossLarge />\n </ActionButton>\n }\n </Grid>\n </section>\n );\n});\n"],"names":[],"version":3,"file":"Dialog.module.js.map"}
@@ -1,63 +0,0 @@
1
- var $0eb909ad2388d989$exports = require("./context.main.js");
2
- var $k1djg$reactspectrumoverlays = require("@react-spectrum/overlays");
3
- var $k1djg$react = require("react");
4
- var $k1djg$reactstatelyoverlays = require("@react-stately/overlays");
5
-
6
-
7
- function $parcel$interopDefault(a) {
8
- return a && a.__esModule ? a.default : a;
9
- }
10
-
11
- function $parcel$export(e, n, v, s) {
12
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
13
- }
14
-
15
- $parcel$export(module.exports, "DialogContainer", () => $1b7050825e0eb5b6$export$547754aada6e339f);
16
- /*
17
- * Copyright 2020 Adobe. All rights reserved.
18
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
19
- * you may not use this file except in compliance with the License. You may obtain a copy
20
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
21
- *
22
- * Unless required by applicable law or agreed to in writing, software distributed under
23
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
24
- * OF ANY KIND, either express or implied. See the License for the specific language
25
- * governing permissions and limitations under the License.
26
- */
27
-
28
-
29
-
30
- function $1b7050825e0eb5b6$export$547754aada6e339f(props) {
31
- let { children: children, type: type = 'modal', onDismiss: onDismiss, isDismissable: isDismissable, isKeyboardDismissDisabled: isKeyboardDismissDisabled } = props;
32
- let childArray = (0, ($parcel$interopDefault($k1djg$react))).Children.toArray(children);
33
- if (childArray.length > 1) throw new Error('Only a single child can be passed to DialogContainer.');
34
- let [lastChild, setLastChild] = (0, $k1djg$react.useState)(null);
35
- // React.Children.toArray mutates the children, and we need them to be stable
36
- // between renders so that the lastChild comparison works.
37
- let child = undefined;
38
- if (Array.isArray(children)) child = children.find((0, ($parcel$interopDefault($k1djg$react))).isValidElement);
39
- else if (/*#__PURE__*/ (0, ($parcel$interopDefault($k1djg$react))).isValidElement(children)) child = children;
40
- if (child && child !== lastChild) setLastChild(child);
41
- let context = {
42
- type: type,
43
- onClose: onDismiss,
44
- isDismissable: isDismissable
45
- };
46
- let state = (0, $k1djg$reactstatelyoverlays.useOverlayTriggerState)({
47
- isOpen: !!child,
48
- onOpenChange: (isOpen)=>{
49
- if (!isOpen) onDismiss();
50
- }
51
- });
52
- return /*#__PURE__*/ (0, ($parcel$interopDefault($k1djg$react))).createElement((0, $k1djg$reactspectrumoverlays.Modal), {
53
- state: state,
54
- type: type,
55
- isDismissable: isDismissable,
56
- isKeyboardDismissDisabled: isKeyboardDismissDisabled
57
- }, /*#__PURE__*/ (0, ($parcel$interopDefault($k1djg$react))).createElement((0, $0eb909ad2388d989$exports.DialogContext).Provider, {
58
- value: context
59
- }, lastChild));
60
- }
61
-
62
-
63
- //# sourceMappingURL=DialogContainer.main.js.map
@@ -1 +0,0 @@
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, {JSX, 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): JSX.Element {\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,54 +0,0 @@
1
- import {DialogContext as $97b119e05830ea0d$export$8b93a07348a7730c} from "./context.mjs";
2
- import {Modal as $2W2Rs$Modal} from "@react-spectrum/overlays";
3
- import $2W2Rs$react, {useState as $2W2Rs$useState} from "react";
4
- import {useOverlayTriggerState as $2W2Rs$useOverlayTriggerState} from "@react-stately/overlays";
5
-
6
- /*
7
- * Copyright 2020 Adobe. All rights reserved.
8
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
9
- * you may not use this file except in compliance with the License. You may obtain a copy
10
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software distributed under
13
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
14
- * OF ANY KIND, either express or implied. See the License for the specific language
15
- * governing permissions and limitations under the License.
16
- */
17
-
18
-
19
-
20
- function $2a9f0ad39ddaa8d9$export$547754aada6e339f(props) {
21
- let { children: children, type: type = 'modal', onDismiss: onDismiss, isDismissable: isDismissable, isKeyboardDismissDisabled: isKeyboardDismissDisabled } = props;
22
- let childArray = (0, $2W2Rs$react).Children.toArray(children);
23
- if (childArray.length > 1) throw new Error('Only a single child can be passed to DialogContainer.');
24
- let [lastChild, setLastChild] = (0, $2W2Rs$useState)(null);
25
- // React.Children.toArray mutates the children, and we need them to be stable
26
- // between renders so that the lastChild comparison works.
27
- let child = undefined;
28
- if (Array.isArray(children)) child = children.find((0, $2W2Rs$react).isValidElement);
29
- else if (/*#__PURE__*/ (0, $2W2Rs$react).isValidElement(children)) child = children;
30
- if (child && child !== lastChild) setLastChild(child);
31
- let context = {
32
- type: type,
33
- onClose: onDismiss,
34
- isDismissable: isDismissable
35
- };
36
- let state = (0, $2W2Rs$useOverlayTriggerState)({
37
- isOpen: !!child,
38
- onOpenChange: (isOpen)=>{
39
- if (!isOpen) onDismiss();
40
- }
41
- });
42
- return /*#__PURE__*/ (0, $2W2Rs$react).createElement((0, $2W2Rs$Modal), {
43
- state: state,
44
- type: type,
45
- isDismissable: isDismissable,
46
- isKeyboardDismissDisabled: isKeyboardDismissDisabled
47
- }, /*#__PURE__*/ (0, $2W2Rs$react).createElement((0, $97b119e05830ea0d$export$8b93a07348a7730c).Provider, {
48
- value: context
49
- }, lastChild));
50
- }
51
-
52
-
53
- export {$2a9f0ad39ddaa8d9$export$547754aada6e339f as DialogContainer};
54
- //# sourceMappingURL=DialogContainer.module.js.map
@@ -1,54 +0,0 @@
1
- import {DialogContext as $97b119e05830ea0d$export$8b93a07348a7730c} from "./context.module.js";
2
- import {Modal as $2W2Rs$Modal} from "@react-spectrum/overlays";
3
- import $2W2Rs$react, {useState as $2W2Rs$useState} from "react";
4
- import {useOverlayTriggerState as $2W2Rs$useOverlayTriggerState} from "@react-stately/overlays";
5
-
6
- /*
7
- * Copyright 2020 Adobe. All rights reserved.
8
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
9
- * you may not use this file except in compliance with the License. You may obtain a copy
10
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software distributed under
13
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
14
- * OF ANY KIND, either express or implied. See the License for the specific language
15
- * governing permissions and limitations under the License.
16
- */
17
-
18
-
19
-
20
- function $2a9f0ad39ddaa8d9$export$547754aada6e339f(props) {
21
- let { children: children, type: type = 'modal', onDismiss: onDismiss, isDismissable: isDismissable, isKeyboardDismissDisabled: isKeyboardDismissDisabled } = props;
22
- let childArray = (0, $2W2Rs$react).Children.toArray(children);
23
- if (childArray.length > 1) throw new Error('Only a single child can be passed to DialogContainer.');
24
- let [lastChild, setLastChild] = (0, $2W2Rs$useState)(null);
25
- // React.Children.toArray mutates the children, and we need them to be stable
26
- // between renders so that the lastChild comparison works.
27
- let child = undefined;
28
- if (Array.isArray(children)) child = children.find((0, $2W2Rs$react).isValidElement);
29
- else if (/*#__PURE__*/ (0, $2W2Rs$react).isValidElement(children)) child = children;
30
- if (child && child !== lastChild) setLastChild(child);
31
- let context = {
32
- type: type,
33
- onClose: onDismiss,
34
- isDismissable: isDismissable
35
- };
36
- let state = (0, $2W2Rs$useOverlayTriggerState)({
37
- isOpen: !!child,
38
- onOpenChange: (isOpen)=>{
39
- if (!isOpen) onDismiss();
40
- }
41
- });
42
- return /*#__PURE__*/ (0, $2W2Rs$react).createElement((0, $2W2Rs$Modal), {
43
- state: state,
44
- type: type,
45
- isDismissable: isDismissable,
46
- isKeyboardDismissDisabled: isKeyboardDismissDisabled
47
- }, /*#__PURE__*/ (0, $2W2Rs$react).createElement((0, $97b119e05830ea0d$export$8b93a07348a7730c).Provider, {
48
- value: context
49
- }, lastChild));
50
- }
51
-
52
-
53
- export {$2a9f0ad39ddaa8d9$export$547754aada6e339f as DialogContainer};
54
- //# sourceMappingURL=DialogContainer.module.js.map
@@ -1 +0,0 @@
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, {JSX, 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): JSX.Element {\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"}