@react-aria/toast 3.0.0-beta.1 → 3.0.0-beta.11

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 (193) hide show
  1. package/dist/ar-AE.main.js +7 -0
  2. package/dist/ar-AE.main.js.map +1 -0
  3. package/dist/ar-AE.mjs +9 -0
  4. package/dist/ar-AE.module.js +9 -0
  5. package/dist/ar-AE.module.js.map +1 -0
  6. package/dist/bg-BG.main.js +7 -0
  7. package/dist/bg-BG.main.js.map +1 -0
  8. package/dist/bg-BG.mjs +9 -0
  9. package/dist/bg-BG.module.js +9 -0
  10. package/dist/bg-BG.module.js.map +1 -0
  11. package/dist/cs-CZ.main.js +7 -0
  12. package/dist/cs-CZ.main.js.map +1 -0
  13. package/dist/cs-CZ.mjs +9 -0
  14. package/dist/cs-CZ.module.js +9 -0
  15. package/dist/cs-CZ.module.js.map +1 -0
  16. package/dist/da-DK.main.js +7 -0
  17. package/dist/da-DK.main.js.map +1 -0
  18. package/dist/da-DK.mjs +9 -0
  19. package/dist/da-DK.module.js +9 -0
  20. package/dist/da-DK.module.js.map +1 -0
  21. package/dist/de-DE.main.js +7 -0
  22. package/dist/de-DE.main.js.map +1 -0
  23. package/dist/de-DE.mjs +9 -0
  24. package/dist/de-DE.module.js +9 -0
  25. package/dist/de-DE.module.js.map +1 -0
  26. package/dist/el-GR.main.js +7 -0
  27. package/dist/el-GR.main.js.map +1 -0
  28. package/dist/el-GR.mjs +9 -0
  29. package/dist/el-GR.module.js +9 -0
  30. package/dist/el-GR.module.js.map +1 -0
  31. package/dist/en-US.main.js +7 -0
  32. package/dist/en-US.main.js.map +1 -0
  33. package/dist/en-US.mjs +9 -0
  34. package/dist/en-US.module.js +9 -0
  35. package/dist/en-US.module.js.map +1 -0
  36. package/dist/es-ES.main.js +7 -0
  37. package/dist/es-ES.main.js.map +1 -0
  38. package/dist/es-ES.mjs +9 -0
  39. package/dist/es-ES.module.js +9 -0
  40. package/dist/es-ES.module.js.map +1 -0
  41. package/dist/et-EE.main.js +7 -0
  42. package/dist/et-EE.main.js.map +1 -0
  43. package/dist/et-EE.mjs +9 -0
  44. package/dist/et-EE.module.js +9 -0
  45. package/dist/et-EE.module.js.map +1 -0
  46. package/dist/fi-FI.main.js +7 -0
  47. package/dist/fi-FI.main.js.map +1 -0
  48. package/dist/fi-FI.mjs +9 -0
  49. package/dist/fi-FI.module.js +9 -0
  50. package/dist/fi-FI.module.js.map +1 -0
  51. package/dist/fr-FR.main.js +7 -0
  52. package/dist/fr-FR.main.js.map +1 -0
  53. package/dist/fr-FR.mjs +9 -0
  54. package/dist/fr-FR.module.js +9 -0
  55. package/dist/fr-FR.module.js.map +1 -0
  56. package/dist/he-IL.main.js +7 -0
  57. package/dist/he-IL.main.js.map +1 -0
  58. package/dist/he-IL.mjs +9 -0
  59. package/dist/he-IL.module.js +9 -0
  60. package/dist/he-IL.module.js.map +1 -0
  61. package/dist/hr-HR.main.js +7 -0
  62. package/dist/hr-HR.main.js.map +1 -0
  63. package/dist/hr-HR.mjs +9 -0
  64. package/dist/hr-HR.module.js +9 -0
  65. package/dist/hr-HR.module.js.map +1 -0
  66. package/dist/hu-HU.main.js +7 -0
  67. package/dist/hu-HU.main.js.map +1 -0
  68. package/dist/hu-HU.mjs +9 -0
  69. package/dist/hu-HU.module.js +9 -0
  70. package/dist/hu-HU.module.js.map +1 -0
  71. package/dist/import.mjs +3 -414
  72. package/dist/intlStrings.main.js +108 -0
  73. package/dist/intlStrings.main.js.map +1 -0
  74. package/dist/intlStrings.mjs +110 -0
  75. package/dist/intlStrings.module.js +110 -0
  76. package/dist/intlStrings.module.js.map +1 -0
  77. package/dist/it-IT.main.js +7 -0
  78. package/dist/it-IT.main.js.map +1 -0
  79. package/dist/it-IT.mjs +9 -0
  80. package/dist/it-IT.module.js +9 -0
  81. package/dist/it-IT.module.js.map +1 -0
  82. package/dist/ja-JP.main.js +7 -0
  83. package/dist/ja-JP.main.js.map +1 -0
  84. package/dist/ja-JP.mjs +9 -0
  85. package/dist/ja-JP.module.js +9 -0
  86. package/dist/ja-JP.module.js.map +1 -0
  87. package/dist/ko-KR.main.js +7 -0
  88. package/dist/ko-KR.main.js.map +1 -0
  89. package/dist/ko-KR.mjs +9 -0
  90. package/dist/ko-KR.module.js +9 -0
  91. package/dist/ko-KR.module.js.map +1 -0
  92. package/dist/lt-LT.main.js +7 -0
  93. package/dist/lt-LT.main.js.map +1 -0
  94. package/dist/lt-LT.mjs +9 -0
  95. package/dist/lt-LT.module.js +9 -0
  96. package/dist/lt-LT.module.js.map +1 -0
  97. package/dist/lv-LV.main.js +7 -0
  98. package/dist/lv-LV.main.js.map +1 -0
  99. package/dist/lv-LV.mjs +9 -0
  100. package/dist/lv-LV.module.js +9 -0
  101. package/dist/lv-LV.module.js.map +1 -0
  102. package/dist/main.js +6 -416
  103. package/dist/main.js.map +1 -1
  104. package/dist/module.js +3 -414
  105. package/dist/module.js.map +1 -1
  106. package/dist/nb-NO.main.js +7 -0
  107. package/dist/nb-NO.main.js.map +1 -0
  108. package/dist/nb-NO.mjs +9 -0
  109. package/dist/nb-NO.module.js +9 -0
  110. package/dist/nb-NO.module.js.map +1 -0
  111. package/dist/nl-NL.main.js +7 -0
  112. package/dist/nl-NL.main.js.map +1 -0
  113. package/dist/nl-NL.mjs +9 -0
  114. package/dist/nl-NL.module.js +9 -0
  115. package/dist/nl-NL.module.js.map +1 -0
  116. package/dist/pl-PL.main.js +7 -0
  117. package/dist/pl-PL.main.js.map +1 -0
  118. package/dist/pl-PL.mjs +9 -0
  119. package/dist/pl-PL.module.js +9 -0
  120. package/dist/pl-PL.module.js.map +1 -0
  121. package/dist/pt-BR.main.js +7 -0
  122. package/dist/pt-BR.main.js.map +1 -0
  123. package/dist/pt-BR.mjs +9 -0
  124. package/dist/pt-BR.module.js +9 -0
  125. package/dist/pt-BR.module.js.map +1 -0
  126. package/dist/pt-PT.main.js +7 -0
  127. package/dist/pt-PT.main.js.map +1 -0
  128. package/dist/pt-PT.mjs +9 -0
  129. package/dist/pt-PT.module.js +9 -0
  130. package/dist/pt-PT.module.js.map +1 -0
  131. package/dist/ro-RO.main.js +7 -0
  132. package/dist/ro-RO.main.js.map +1 -0
  133. package/dist/ro-RO.mjs +9 -0
  134. package/dist/ro-RO.module.js +9 -0
  135. package/dist/ro-RO.module.js.map +1 -0
  136. package/dist/ru-RU.main.js +7 -0
  137. package/dist/ru-RU.main.js.map +1 -0
  138. package/dist/ru-RU.mjs +9 -0
  139. package/dist/ru-RU.module.js +9 -0
  140. package/dist/ru-RU.module.js.map +1 -0
  141. package/dist/sk-SK.main.js +7 -0
  142. package/dist/sk-SK.main.js.map +1 -0
  143. package/dist/sk-SK.mjs +9 -0
  144. package/dist/sk-SK.module.js +9 -0
  145. package/dist/sk-SK.module.js.map +1 -0
  146. package/dist/sl-SI.main.js +7 -0
  147. package/dist/sl-SI.main.js.map +1 -0
  148. package/dist/sl-SI.mjs +9 -0
  149. package/dist/sl-SI.module.js +9 -0
  150. package/dist/sl-SI.module.js.map +1 -0
  151. package/dist/sr-SP.main.js +7 -0
  152. package/dist/sr-SP.main.js.map +1 -0
  153. package/dist/sr-SP.mjs +9 -0
  154. package/dist/sr-SP.module.js +9 -0
  155. package/dist/sr-SP.module.js.map +1 -0
  156. package/dist/sv-SE.main.js +7 -0
  157. package/dist/sv-SE.main.js.map +1 -0
  158. package/dist/sv-SE.mjs +9 -0
  159. package/dist/sv-SE.module.js +9 -0
  160. package/dist/sv-SE.module.js.map +1 -0
  161. package/dist/tr-TR.main.js +7 -0
  162. package/dist/tr-TR.main.js.map +1 -0
  163. package/dist/tr-TR.mjs +9 -0
  164. package/dist/tr-TR.module.js +9 -0
  165. package/dist/tr-TR.module.js.map +1 -0
  166. package/dist/uk-UA.main.js +7 -0
  167. package/dist/uk-UA.main.js.map +1 -0
  168. package/dist/uk-UA.mjs +9 -0
  169. package/dist/uk-UA.module.js +9 -0
  170. package/dist/uk-UA.module.js.map +1 -0
  171. package/dist/useToast.main.js +92 -0
  172. package/dist/useToast.main.js.map +1 -0
  173. package/dist/useToast.mjs +87 -0
  174. package/dist/useToast.module.js +87 -0
  175. package/dist/useToast.module.js.map +1 -0
  176. package/dist/useToastRegion.main.js +73 -0
  177. package/dist/useToastRegion.main.js.map +1 -0
  178. package/dist/useToastRegion.mjs +68 -0
  179. package/dist/useToastRegion.module.js +68 -0
  180. package/dist/useToastRegion.module.js.map +1 -0
  181. package/dist/zh-CN.main.js +7 -0
  182. package/dist/zh-CN.main.js.map +1 -0
  183. package/dist/zh-CN.mjs +9 -0
  184. package/dist/zh-CN.module.js +9 -0
  185. package/dist/zh-CN.module.js.map +1 -0
  186. package/dist/zh-TW.main.js +7 -0
  187. package/dist/zh-TW.main.js.map +1 -0
  188. package/dist/zh-TW.mjs +9 -0
  189. package/dist/zh-TW.module.js +9 -0
  190. package/dist/zh-TW.module.js.map +1 -0
  191. package/package.json +10 -10
  192. package/src/useToast.ts +1 -1
  193. package/src/useToastRegion.ts +1 -1
@@ -0,0 +1,73 @@
1
+ var $f49b2d6c91681304$exports = require("./intlStrings.main.js");
2
+ var $eO7VF$reactariautils = require("@react-aria/utils");
3
+ var $eO7VF$reactariainteractions = require("@react-aria/interactions");
4
+ var $eO7VF$react = require("react");
5
+ var $eO7VF$reactarialandmark = require("@react-aria/landmark");
6
+ var $eO7VF$reactariai18n = require("@react-aria/i18n");
7
+
8
+
9
+ function $parcel$interopDefault(a) {
10
+ return a && a.__esModule ? a.default : a;
11
+ }
12
+
13
+ function $parcel$export(e, n, v, s) {
14
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
15
+ }
16
+
17
+ $parcel$export(module.exports, "useToastRegion", () => $eda7c6204a682dd4$export$b8cbbb20a51697de);
18
+
19
+
20
+
21
+
22
+
23
+
24
+ function $eda7c6204a682dd4$export$b8cbbb20a51697de(props, state, ref) {
25
+ let stringFormatter = (0, $eO7VF$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($f49b2d6c91681304$exports))), "@react-aria/toast");
26
+ let { landmarkProps: landmarkProps } = (0, $eO7VF$reactarialandmark.useLandmark)({
27
+ role: "region",
28
+ "aria-label": props["aria-label"] || stringFormatter.format("notifications")
29
+ }, ref);
30
+ let { hoverProps: hoverProps } = (0, $eO7VF$reactariainteractions.useHover)({
31
+ onHoverStart: state.pauseAll,
32
+ onHoverEnd: state.resumeAll
33
+ });
34
+ let lastFocused = (0, $eO7VF$react.useRef)(null);
35
+ let { focusWithinProps: focusWithinProps } = (0, $eO7VF$reactariainteractions.useFocusWithin)({
36
+ onFocusWithin: (e)=>{
37
+ state.pauseAll();
38
+ lastFocused.current = e.relatedTarget;
39
+ },
40
+ onBlurWithin: ()=>{
41
+ state.resumeAll();
42
+ lastFocused.current = null;
43
+ }
44
+ });
45
+ // When the region unmounts, restore focus to the last element that had focus
46
+ // before the user moved focus into the region.
47
+ // TODO: handle when the element has unmounted like FocusScope does?
48
+ // eslint-disable-next-line arrow-body-style
49
+ (0, $eO7VF$react.useEffect)(()=>{
50
+ return ()=>{
51
+ if (lastFocused.current && document.body.contains(lastFocused.current)) {
52
+ if ((0, $eO7VF$reactariainteractions.getInteractionModality)() === "pointer") (0, $eO7VF$reactariautils.focusWithoutScrolling)(lastFocused.current);
53
+ else lastFocused.current.focus();
54
+ }
55
+ };
56
+ }, [
57
+ ref
58
+ ]);
59
+ return {
60
+ regionProps: (0, $eO7VF$reactariautils.mergeProps)(landmarkProps, hoverProps, focusWithinProps, {
61
+ tabIndex: -1,
62
+ // Mark the toast region as a "top layer", so that it:
63
+ // - is not aria-hidden when opening an overlay
64
+ // - allows focus even outside a containing focus scope
65
+ // - doesn’t dismiss overlays when clicking on it, even though it is outside
66
+ // @ts-ignore
67
+ "data-react-aria-top-layer": true
68
+ })
69
+ };
70
+ }
71
+
72
+
73
+ //# sourceMappingURL=useToastRegion.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA2BO,SAAS,0CAAkB,KAA2B,EAAE,KAAoB,EAAE,GAA2B;IAC9G,IAAI,kBAAkB,CAAA,GAAA,gDAA0B,EAAE,CAAA,GAAA,mDAAW,GAAG;IAChE,IAAI,iBAAC,aAAa,EAAC,GAAG,CAAA,GAAA,oCAAU,EAAE;QAChC,MAAM;QACN,cAAc,KAAK,CAAC,aAAa,IAAI,gBAAgB,MAAM,CAAC;IAC9D,GAAG;IAEH,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,qCAAO,EAAE;QAC1B,cAAc,MAAM,QAAQ;QAC5B,YAAY,MAAM,SAAS;IAC7B;IAEA,IAAI,cAAc,CAAA,GAAA,mBAAK,EAAE;IACzB,IAAI,oBAAC,gBAAgB,EAAC,GAAG,CAAA,GAAA,2CAAa,EAAE;QACtC,eAAe,CAAC;YACd,MAAM,QAAQ;YACd,YAAY,OAAO,GAAG,EAAE,aAAa;QACvC;QACA,cAAc;YACZ,MAAM,SAAS;YACf,YAAY,OAAO,GAAG;QACxB;IACF;IAEA,6EAA6E;IAC7E,+CAA+C;IAC/C,oEAAoE;IACpE,4CAA4C;IAC5C,CAAA,GAAA,sBAAQ,EAAE;QACR,OAAO;YACL,IAAI,YAAY,OAAO,IAAI,SAAS,IAAI,CAAC,QAAQ,CAAC,YAAY,OAAO;gBACnE,IAAI,CAAA,GAAA,mDAAqB,QAAQ,WAC/B,CAAA,GAAA,2CAAoB,EAAE,YAAY,OAAO;qBAEzC,YAAY,OAAO,CAAC,KAAK;;QAG/B;IACF,GAAG;QAAC;KAAI;IAER,OAAO;QACL,aAAa,CAAA,GAAA,gCAAS,EAAE,eAAe,YAAY,kBAAkB;YACnE,UAAU;YACV,sDAAsD;YACtD,iDAAiD;YACjD,yDAAyD;YACzD,8EAA8E;YAC9E,aAAa;YACb,6BAA6B;QAC/B;IACF;AACF","sources":["packages/@react-aria/toast/src/useToastRegion.ts"],"sourcesContent":["import {AriaLabelingProps, DOMAttributes} from '@react-types/shared';\nimport {focusWithoutScrolling, mergeProps} from '@react-aria/utils';\nimport {getInteractionModality, useFocusWithin, useHover} from '@react-aria/interactions';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {RefObject, useEffect, useRef} from 'react';\nimport {ToastState} from '@react-stately/toast';\nimport {useLandmark} from '@react-aria/landmark';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface AriaToastRegionProps extends AriaLabelingProps {\n /**\n * An accessibility label for the toast region.\n * @default \"Notifications\"\n */\n 'aria-label'?: string\n}\n\nexport interface ToastRegionAria {\n /** Props for the landmark region element. */\n regionProps: DOMAttributes\n}\n\n/**\n * Provides the behavior and accessibility implementation for a toast region containing one or more toasts.\n * Toasts display brief, temporary notifications of actions, errors, or other events in an application.\n */\nexport function useToastRegion<T>(props: AriaToastRegionProps, state: ToastState<T>, ref: RefObject<HTMLElement>): ToastRegionAria {\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/toast');\n let {landmarkProps} = useLandmark({\n role: 'region',\n 'aria-label': props['aria-label'] || stringFormatter.format('notifications')\n }, ref);\n\n let {hoverProps} = useHover({\n onHoverStart: state.pauseAll,\n onHoverEnd: state.resumeAll\n });\n\n let lastFocused = useRef(null);\n let {focusWithinProps} = useFocusWithin({\n onFocusWithin: (e) => {\n state.pauseAll();\n lastFocused.current = e.relatedTarget;\n },\n onBlurWithin: () => {\n state.resumeAll();\n lastFocused.current = null;\n }\n });\n\n // When the region unmounts, restore focus to the last element that had focus\n // before the user moved focus into the region.\n // TODO: handle when the element has unmounted like FocusScope does?\n // eslint-disable-next-line arrow-body-style\n useEffect(() => {\n return () => {\n if (lastFocused.current && document.body.contains(lastFocused.current)) {\n if (getInteractionModality() === 'pointer') {\n focusWithoutScrolling(lastFocused.current);\n } else {\n lastFocused.current.focus();\n }\n }\n };\n }, [ref]);\n\n return {\n regionProps: mergeProps(landmarkProps, hoverProps, focusWithinProps, {\n tabIndex: -1,\n // Mark the toast region as a \"top layer\", so that it:\n // - is not aria-hidden when opening an overlay\n // - allows focus even outside a containing focus scope\n // - doesn’t dismiss overlays when clicking on it, even though it is outside\n // @ts-ignore\n 'data-react-aria-top-layer': true\n })\n };\n}\n"],"names":[],"version":3,"file":"useToastRegion.main.js.map"}
@@ -0,0 +1,68 @@
1
+ import $ckyCP$intlStringsmodulejs from "./intlStrings.mjs";
2
+ import {focusWithoutScrolling as $ckyCP$focusWithoutScrolling, mergeProps as $ckyCP$mergeProps} from "@react-aria/utils";
3
+ import {useHover as $ckyCP$useHover, useFocusWithin as $ckyCP$useFocusWithin, getInteractionModality as $ckyCP$getInteractionModality} from "@react-aria/interactions";
4
+ import {useRef as $ckyCP$useRef, useEffect as $ckyCP$useEffect} from "react";
5
+ import {useLandmark as $ckyCP$useLandmark} from "@react-aria/landmark";
6
+ import {useLocalizedStringFormatter as $ckyCP$useLocalizedStringFormatter} from "@react-aria/i18n";
7
+
8
+
9
+ function $parcel$interopDefault(a) {
10
+ return a && a.__esModule ? a.default : a;
11
+ }
12
+
13
+
14
+
15
+
16
+
17
+
18
+ function $6cc546b19ee7130a$export$b8cbbb20a51697de(props, state, ref) {
19
+ let stringFormatter = (0, $ckyCP$useLocalizedStringFormatter)((0, ($parcel$interopDefault($ckyCP$intlStringsmodulejs))), "@react-aria/toast");
20
+ let { landmarkProps: landmarkProps } = (0, $ckyCP$useLandmark)({
21
+ role: "region",
22
+ "aria-label": props["aria-label"] || stringFormatter.format("notifications")
23
+ }, ref);
24
+ let { hoverProps: hoverProps } = (0, $ckyCP$useHover)({
25
+ onHoverStart: state.pauseAll,
26
+ onHoverEnd: state.resumeAll
27
+ });
28
+ let lastFocused = (0, $ckyCP$useRef)(null);
29
+ let { focusWithinProps: focusWithinProps } = (0, $ckyCP$useFocusWithin)({
30
+ onFocusWithin: (e)=>{
31
+ state.pauseAll();
32
+ lastFocused.current = e.relatedTarget;
33
+ },
34
+ onBlurWithin: ()=>{
35
+ state.resumeAll();
36
+ lastFocused.current = null;
37
+ }
38
+ });
39
+ // When the region unmounts, restore focus to the last element that had focus
40
+ // before the user moved focus into the region.
41
+ // TODO: handle when the element has unmounted like FocusScope does?
42
+ // eslint-disable-next-line arrow-body-style
43
+ (0, $ckyCP$useEffect)(()=>{
44
+ return ()=>{
45
+ if (lastFocused.current && document.body.contains(lastFocused.current)) {
46
+ if ((0, $ckyCP$getInteractionModality)() === "pointer") (0, $ckyCP$focusWithoutScrolling)(lastFocused.current);
47
+ else lastFocused.current.focus();
48
+ }
49
+ };
50
+ }, [
51
+ ref
52
+ ]);
53
+ return {
54
+ regionProps: (0, $ckyCP$mergeProps)(landmarkProps, hoverProps, focusWithinProps, {
55
+ tabIndex: -1,
56
+ // Mark the toast region as a "top layer", so that it:
57
+ // - is not aria-hidden when opening an overlay
58
+ // - allows focus even outside a containing focus scope
59
+ // - doesn’t dismiss overlays when clicking on it, even though it is outside
60
+ // @ts-ignore
61
+ "data-react-aria-top-layer": true
62
+ })
63
+ };
64
+ }
65
+
66
+
67
+ export {$6cc546b19ee7130a$export$b8cbbb20a51697de as useToastRegion};
68
+ //# sourceMappingURL=useToastRegion.mjs.map
@@ -0,0 +1,68 @@
1
+ import $ckyCP$intlStringsmodulejs from "./intlStrings.module.js";
2
+ import {focusWithoutScrolling as $ckyCP$focusWithoutScrolling, mergeProps as $ckyCP$mergeProps} from "@react-aria/utils";
3
+ import {useHover as $ckyCP$useHover, useFocusWithin as $ckyCP$useFocusWithin, getInteractionModality as $ckyCP$getInteractionModality} from "@react-aria/interactions";
4
+ import {useRef as $ckyCP$useRef, useEffect as $ckyCP$useEffect} from "react";
5
+ import {useLandmark as $ckyCP$useLandmark} from "@react-aria/landmark";
6
+ import {useLocalizedStringFormatter as $ckyCP$useLocalizedStringFormatter} from "@react-aria/i18n";
7
+
8
+
9
+ function $parcel$interopDefault(a) {
10
+ return a && a.__esModule ? a.default : a;
11
+ }
12
+
13
+
14
+
15
+
16
+
17
+
18
+ function $6cc546b19ee7130a$export$b8cbbb20a51697de(props, state, ref) {
19
+ let stringFormatter = (0, $ckyCP$useLocalizedStringFormatter)((0, ($parcel$interopDefault($ckyCP$intlStringsmodulejs))), "@react-aria/toast");
20
+ let { landmarkProps: landmarkProps } = (0, $ckyCP$useLandmark)({
21
+ role: "region",
22
+ "aria-label": props["aria-label"] || stringFormatter.format("notifications")
23
+ }, ref);
24
+ let { hoverProps: hoverProps } = (0, $ckyCP$useHover)({
25
+ onHoverStart: state.pauseAll,
26
+ onHoverEnd: state.resumeAll
27
+ });
28
+ let lastFocused = (0, $ckyCP$useRef)(null);
29
+ let { focusWithinProps: focusWithinProps } = (0, $ckyCP$useFocusWithin)({
30
+ onFocusWithin: (e)=>{
31
+ state.pauseAll();
32
+ lastFocused.current = e.relatedTarget;
33
+ },
34
+ onBlurWithin: ()=>{
35
+ state.resumeAll();
36
+ lastFocused.current = null;
37
+ }
38
+ });
39
+ // When the region unmounts, restore focus to the last element that had focus
40
+ // before the user moved focus into the region.
41
+ // TODO: handle when the element has unmounted like FocusScope does?
42
+ // eslint-disable-next-line arrow-body-style
43
+ (0, $ckyCP$useEffect)(()=>{
44
+ return ()=>{
45
+ if (lastFocused.current && document.body.contains(lastFocused.current)) {
46
+ if ((0, $ckyCP$getInteractionModality)() === "pointer") (0, $ckyCP$focusWithoutScrolling)(lastFocused.current);
47
+ else lastFocused.current.focus();
48
+ }
49
+ };
50
+ }, [
51
+ ref
52
+ ]);
53
+ return {
54
+ regionProps: (0, $ckyCP$mergeProps)(landmarkProps, hoverProps, focusWithinProps, {
55
+ tabIndex: -1,
56
+ // Mark the toast region as a "top layer", so that it:
57
+ // - is not aria-hidden when opening an overlay
58
+ // - allows focus even outside a containing focus scope
59
+ // - doesn’t dismiss overlays when clicking on it, even though it is outside
60
+ // @ts-ignore
61
+ "data-react-aria-top-layer": true
62
+ })
63
+ };
64
+ }
65
+
66
+
67
+ export {$6cc546b19ee7130a$export$b8cbbb20a51697de as useToastRegion};
68
+ //# sourceMappingURL=useToastRegion.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;;;;;AA2BO,SAAS,0CAAkB,KAA2B,EAAE,KAAoB,EAAE,GAA2B;IAC9G,IAAI,kBAAkB,CAAA,GAAA,kCAA0B,EAAE,CAAA,GAAA,oDAAW,GAAG;IAChE,IAAI,iBAAC,aAAa,EAAC,GAAG,CAAA,GAAA,kBAAU,EAAE;QAChC,MAAM;QACN,cAAc,KAAK,CAAC,aAAa,IAAI,gBAAgB,MAAM,CAAC;IAC9D,GAAG;IAEH,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;QAC1B,cAAc,MAAM,QAAQ;QAC5B,YAAY,MAAM,SAAS;IAC7B;IAEA,IAAI,cAAc,CAAA,GAAA,aAAK,EAAE;IACzB,IAAI,oBAAC,gBAAgB,EAAC,GAAG,CAAA,GAAA,qBAAa,EAAE;QACtC,eAAe,CAAC;YACd,MAAM,QAAQ;YACd,YAAY,OAAO,GAAG,EAAE,aAAa;QACvC;QACA,cAAc;YACZ,MAAM,SAAS;YACf,YAAY,OAAO,GAAG;QACxB;IACF;IAEA,6EAA6E;IAC7E,+CAA+C;IAC/C,oEAAoE;IACpE,4CAA4C;IAC5C,CAAA,GAAA,gBAAQ,EAAE;QACR,OAAO;YACL,IAAI,YAAY,OAAO,IAAI,SAAS,IAAI,CAAC,QAAQ,CAAC,YAAY,OAAO;gBACnE,IAAI,CAAA,GAAA,6BAAqB,QAAQ,WAC/B,CAAA,GAAA,4BAAoB,EAAE,YAAY,OAAO;qBAEzC,YAAY,OAAO,CAAC,KAAK;;QAG/B;IACF,GAAG;QAAC;KAAI;IAER,OAAO;QACL,aAAa,CAAA,GAAA,iBAAS,EAAE,eAAe,YAAY,kBAAkB;YACnE,UAAU;YACV,sDAAsD;YACtD,iDAAiD;YACjD,yDAAyD;YACzD,8EAA8E;YAC9E,aAAa;YACb,6BAA6B;QAC/B;IACF;AACF","sources":["packages/@react-aria/toast/src/useToastRegion.ts"],"sourcesContent":["import {AriaLabelingProps, DOMAttributes} from '@react-types/shared';\nimport {focusWithoutScrolling, mergeProps} from '@react-aria/utils';\nimport {getInteractionModality, useFocusWithin, useHover} from '@react-aria/interactions';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {RefObject, useEffect, useRef} from 'react';\nimport {ToastState} from '@react-stately/toast';\nimport {useLandmark} from '@react-aria/landmark';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface AriaToastRegionProps extends AriaLabelingProps {\n /**\n * An accessibility label for the toast region.\n * @default \"Notifications\"\n */\n 'aria-label'?: string\n}\n\nexport interface ToastRegionAria {\n /** Props for the landmark region element. */\n regionProps: DOMAttributes\n}\n\n/**\n * Provides the behavior and accessibility implementation for a toast region containing one or more toasts.\n * Toasts display brief, temporary notifications of actions, errors, or other events in an application.\n */\nexport function useToastRegion<T>(props: AriaToastRegionProps, state: ToastState<T>, ref: RefObject<HTMLElement>): ToastRegionAria {\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/toast');\n let {landmarkProps} = useLandmark({\n role: 'region',\n 'aria-label': props['aria-label'] || stringFormatter.format('notifications')\n }, ref);\n\n let {hoverProps} = useHover({\n onHoverStart: state.pauseAll,\n onHoverEnd: state.resumeAll\n });\n\n let lastFocused = useRef(null);\n let {focusWithinProps} = useFocusWithin({\n onFocusWithin: (e) => {\n state.pauseAll();\n lastFocused.current = e.relatedTarget;\n },\n onBlurWithin: () => {\n state.resumeAll();\n lastFocused.current = null;\n }\n });\n\n // When the region unmounts, restore focus to the last element that had focus\n // before the user moved focus into the region.\n // TODO: handle when the element has unmounted like FocusScope does?\n // eslint-disable-next-line arrow-body-style\n useEffect(() => {\n return () => {\n if (lastFocused.current && document.body.contains(lastFocused.current)) {\n if (getInteractionModality() === 'pointer') {\n focusWithoutScrolling(lastFocused.current);\n } else {\n lastFocused.current.focus();\n }\n }\n };\n }, [ref]);\n\n return {\n regionProps: mergeProps(landmarkProps, hoverProps, focusWithinProps, {\n tabIndex: -1,\n // Mark the toast region as a \"top layer\", so that it:\n // - is not aria-hidden when opening an overlay\n // - allows focus even outside a containing focus scope\n // - doesn’t dismiss overlays when clicking on it, even though it is outside\n // @ts-ignore\n 'data-react-aria-top-layer': true\n })\n };\n}\n"],"names":[],"version":3,"file":"useToastRegion.module.js.map"}
@@ -0,0 +1,7 @@
1
+ module.exports = {
2
+ "close": `\u{5173}\u{95ED}`,
3
+ "notifications": `\u{901A}\u{77E5}`
4
+ };
5
+
6
+
7
+ //# sourceMappingURL=zh-CN.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":"AAAA,iBAAiB;IAAG,SAAS,CAAC,gBAAE,CAAC;IAC/B,iBAAiB,CAAC,gBAAE,CAAC;AACvB","sources":["packages/@react-aria/toast/intl/zh-CN.json"],"sourcesContent":["{\n \"close\": \"关闭\",\n \"notifications\": \"通知\"\n}\n"],"names":[],"version":3,"file":"zh-CN.main.js.map"}
package/dist/zh-CN.mjs ADDED
@@ -0,0 +1,9 @@
1
+ var $122525af1cb737c7$exports = {};
2
+ $122525af1cb737c7$exports = {
3
+ "close": `\u{5173}\u{95ED}`,
4
+ "notifications": `\u{901A}\u{77E5}`
5
+ };
6
+
7
+
8
+ export {$122525af1cb737c7$exports as default};
9
+ //# sourceMappingURL=zh-CN.mjs.map
@@ -0,0 +1,9 @@
1
+ var $122525af1cb737c7$exports = {};
2
+ $122525af1cb737c7$exports = {
3
+ "close": `\u{5173}\u{95ED}`,
4
+ "notifications": `\u{901A}\u{77E5}`
5
+ };
6
+
7
+
8
+ export {$122525af1cb737c7$exports as default};
9
+ //# sourceMappingURL=zh-CN.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";AAAA,4BAAiB;IAAG,SAAS,CAAC,gBAAE,CAAC;IAC/B,iBAAiB,CAAC,gBAAE,CAAC;AACvB","sources":["packages/@react-aria/toast/intl/zh-CN.json"],"sourcesContent":["{\n \"close\": \"关闭\",\n \"notifications\": \"通知\"\n}\n"],"names":[],"version":3,"file":"zh-CN.module.js.map"}
@@ -0,0 +1,7 @@
1
+ module.exports = {
2
+ "close": `\u{95DC}\u{9589}`,
3
+ "notifications": `\u{901A}\u{77E5}`
4
+ };
5
+
6
+
7
+ //# sourceMappingURL=zh-TW.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":"AAAA,iBAAiB;IAAG,SAAS,CAAC,gBAAE,CAAC;IAC/B,iBAAiB,CAAC,gBAAE,CAAC;AACvB","sources":["packages/@react-aria/toast/intl/zh-TW.json"],"sourcesContent":["{\n \"close\": \"關閉\",\n \"notifications\": \"通知\"\n}\n"],"names":[],"version":3,"file":"zh-TW.main.js.map"}
package/dist/zh-TW.mjs ADDED
@@ -0,0 +1,9 @@
1
+ var $52e8b1b00094e5a3$exports = {};
2
+ $52e8b1b00094e5a3$exports = {
3
+ "close": `\u{95DC}\u{9589}`,
4
+ "notifications": `\u{901A}\u{77E5}`
5
+ };
6
+
7
+
8
+ export {$52e8b1b00094e5a3$exports as default};
9
+ //# sourceMappingURL=zh-TW.mjs.map
@@ -0,0 +1,9 @@
1
+ var $52e8b1b00094e5a3$exports = {};
2
+ $52e8b1b00094e5a3$exports = {
3
+ "close": `\u{95DC}\u{9589}`,
4
+ "notifications": `\u{901A}\u{77E5}`
5
+ };
6
+
7
+
8
+ export {$52e8b1b00094e5a3$exports as default};
9
+ //# sourceMappingURL=zh-TW.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";AAAA,4BAAiB;IAAG,SAAS,CAAC,gBAAE,CAAC;IAC/B,iBAAiB,CAAC,gBAAE,CAAC;AACvB","sources":["packages/@react-aria/toast/intl/zh-TW.json"],"sourcesContent":["{\n \"close\": \"關閉\",\n \"notifications\": \"通知\"\n}\n"],"names":[],"version":3,"file":"zh-TW.module.js.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-aria/toast",
3
- "version": "3.0.0-beta.1",
3
+ "version": "3.0.0-beta.11",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -22,14 +22,14 @@
22
22
  "url": "https://github.com/adobe/react-spectrum"
23
23
  },
24
24
  "dependencies": {
25
- "@react-aria/i18n": "^3.7.2",
26
- "@react-aria/interactions": "^3.15.1",
27
- "@react-aria/landmark": "3.0.0-beta.1",
28
- "@react-aria/utils": "^3.17.0",
29
- "@react-stately/toast": "3.0.0-beta.0",
30
- "@react-types/button": "^3.7.3",
31
- "@react-types/shared": "^3.18.1",
32
- "@swc/helpers": "^0.4.14"
25
+ "@react-aria/i18n": "^3.11.0",
26
+ "@react-aria/interactions": "^3.21.2",
27
+ "@react-aria/landmark": "3.0.0-beta.11",
28
+ "@react-aria/utils": "^3.24.0",
29
+ "@react-stately/toast": "3.0.0-beta.3",
30
+ "@react-types/button": "^3.9.3",
31
+ "@react-types/shared": "^3.23.0",
32
+ "@swc/helpers": "^0.5.0"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
@@ -37,5 +37,5 @@
37
37
  "publishConfig": {
38
38
  "access": "public"
39
39
  },
40
- "gitHead": "5911ed21de4b76d66f6254c02302519e02d50e16"
40
+ "gitHead": "f645f29edc1322153fd60af4640cbcab1d992dbd"
41
41
  }
package/src/useToast.ts CHANGED
@@ -85,7 +85,7 @@ export function useToast<T>(props: AriaToastProps<T>, state: ToastState<T>, ref:
85
85
 
86
86
  let titleId = useId();
87
87
  let descriptionId = useSlotId();
88
- let stringFormatter = useLocalizedStringFormatter(intlMessages);
88
+ let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/toast');
89
89
 
90
90
  return {
91
91
  toastProps: {
@@ -26,7 +26,7 @@ export interface ToastRegionAria {
26
26
  * Toasts display brief, temporary notifications of actions, errors, or other events in an application.
27
27
  */
28
28
  export function useToastRegion<T>(props: AriaToastRegionProps, state: ToastState<T>, ref: RefObject<HTMLElement>): ToastRegionAria {
29
- let stringFormatter = useLocalizedStringFormatter(intlMessages);
29
+ let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/toast');
30
30
  let {landmarkProps} = useLandmark({
31
31
  role: 'region',
32
32
  'aria-label': props['aria-label'] || stringFormatter.format('notifications')