@react-aria/toast 3.0.0-nightly.2444 → 3.0.0-nightly.2453
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/import.mjs +4 -4
- package/dist/main.js +4 -4
- package/dist/main.js.map +1 -1
- package/dist/module.js +4 -4
- package/dist/module.js.map +1 -1
- package/package.json +9 -9
package/dist/import.mjs
CHANGED
|
@@ -308,7 +308,7 @@ $7853651519a70071$exports = {
|
|
|
308
308
|
|
|
309
309
|
|
|
310
310
|
function $d6542812f0669241$export$a407b657d3044108(props, state, ref) {
|
|
311
|
-
let { key: key
|
|
311
|
+
let { key: key, timer: timer, timeout: timeout, animation: animation } = props.toast;
|
|
312
312
|
(0, $5bA4N$useEffect)(()=>{
|
|
313
313
|
if (!timer) return;
|
|
314
314
|
timer.reset(timeout);
|
|
@@ -377,16 +377,16 @@ function $d6542812f0669241$export$a407b657d3044108(props, state, ref) {
|
|
|
377
377
|
|
|
378
378
|
function $6cc546b19ee7130a$export$b8cbbb20a51697de(props, state, ref) {
|
|
379
379
|
let stringFormatter = (0, $5bA4N$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($7853651519a70071$exports))));
|
|
380
|
-
let { landmarkProps: landmarkProps
|
|
380
|
+
let { landmarkProps: landmarkProps } = (0, $5bA4N$useLandmark)({
|
|
381
381
|
role: "region",
|
|
382
382
|
"aria-label": props["aria-label"] || stringFormatter.format("notifications")
|
|
383
383
|
}, ref);
|
|
384
|
-
let { hoverProps: hoverProps
|
|
384
|
+
let { hoverProps: hoverProps } = (0, $5bA4N$useHover)({
|
|
385
385
|
onHoverStart: state.pauseAll,
|
|
386
386
|
onHoverEnd: state.resumeAll
|
|
387
387
|
});
|
|
388
388
|
let lastFocused = (0, $5bA4N$useRef)(null);
|
|
389
|
-
let { focusWithinProps: focusWithinProps
|
|
389
|
+
let { focusWithinProps: focusWithinProps } = (0, $5bA4N$useFocusWithin)({
|
|
390
390
|
onFocusWithin: (e)=>{
|
|
391
391
|
state.pauseAll();
|
|
392
392
|
lastFocused.current = e.relatedTarget;
|
package/dist/main.js
CHANGED
|
@@ -314,7 +314,7 @@ $f49b2d6c91681304$exports = {
|
|
|
314
314
|
|
|
315
315
|
|
|
316
316
|
function $ec537504faac71d2$export$a407b657d3044108(props, state, ref) {
|
|
317
|
-
let { key: key
|
|
317
|
+
let { key: key, timer: timer, timeout: timeout, animation: animation } = props.toast;
|
|
318
318
|
(0, $35jN2$react.useEffect)(()=>{
|
|
319
319
|
if (!timer) return;
|
|
320
320
|
timer.reset(timeout);
|
|
@@ -383,16 +383,16 @@ function $ec537504faac71d2$export$a407b657d3044108(props, state, ref) {
|
|
|
383
383
|
|
|
384
384
|
function $eda7c6204a682dd4$export$b8cbbb20a51697de(props, state, ref) {
|
|
385
385
|
let stringFormatter = (0, $35jN2$reactariai18n.useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($f49b2d6c91681304$exports))));
|
|
386
|
-
let { landmarkProps: landmarkProps
|
|
386
|
+
let { landmarkProps: landmarkProps } = (0, $35jN2$reactarialandmark.useLandmark)({
|
|
387
387
|
role: "region",
|
|
388
388
|
"aria-label": props["aria-label"] || stringFormatter.format("notifications")
|
|
389
389
|
}, ref);
|
|
390
|
-
let { hoverProps: hoverProps
|
|
390
|
+
let { hoverProps: hoverProps } = (0, $35jN2$reactariainteractions.useHover)({
|
|
391
391
|
onHoverStart: state.pauseAll,
|
|
392
392
|
onHoverEnd: state.resumeAll
|
|
393
393
|
});
|
|
394
394
|
let lastFocused = (0, $35jN2$react.useRef)(null);
|
|
395
|
-
let { focusWithinProps: focusWithinProps
|
|
395
|
+
let { focusWithinProps: focusWithinProps } = (0, $35jN2$reactariainteractions.useFocusWithin)({
|
|
396
396
|
onFocusWithin: (e)=>{
|
|
397
397
|
state.pauseAll();
|
|
398
398
|
lastFocused.current = e.relatedTarget;
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1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,IAAI,cAAC,WAAU,EAAC,GAAG,CAAA,GAAA,qCAAO,EAAE;QAC1B,cAAc,MAAM;QACpB,YAAY,MAAM;IACpB;IAEA,IAAI,cAAc,CAAA,GAAA,mBAAK,EAAE;IACzB,IAAI,oBAAC,iBAAgB,EAAC,GAAG,CAAA,GAAA,2CAAa,EAAE;QACtC,eAAe,CAAC;YACd,MAAM;YACN,YAAY,UAAU,EAAE;QAC1B;QACA,cAAc;YACZ,MAAM;YACN,YAAY,UAAU;QACxB;IACF;IAEA,6EAA6E;IAC7E,+CAA+C;IAC/C,oEAAoE;IACpE,4CAA4C;IAC5C,CAAA,GAAA,sBAAQ,EAAE;QACR,OAAO;YACL,IAAI,YAAY,WAAW,SAAS,KAAK,SAAS,YAAY;gBAC5D,IAAI,CAAA,GAAA,mDAAqB,QAAQ,WAC/B,CAAA,GAAA,2CAAoB,EAAE,YAAY;qBAElC,YAAY,QAAQ;;QAG1B;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/index.ts","packages/@react-aria/toast/src/useToast.ts","packages/@react-aria/toast/src/*.js","packages/@react-aria/toast/intl/ar-AE.json","packages/@react-aria/toast/intl/bg-BG.json","packages/@react-aria/toast/intl/cs-CZ.json","packages/@react-aria/toast/intl/da-DK.json","packages/@react-aria/toast/intl/de-DE.json","packages/@react-aria/toast/intl/el-GR.json","packages/@react-aria/toast/intl/en-US.json","packages/@react-aria/toast/intl/es-ES.json","packages/@react-aria/toast/intl/et-EE.json","packages/@react-aria/toast/intl/fi-FI.json","packages/@react-aria/toast/intl/fr-FR.json","packages/@react-aria/toast/intl/he-IL.json","packages/@react-aria/toast/intl/hr-HR.json","packages/@react-aria/toast/intl/hu-HU.json","packages/@react-aria/toast/intl/it-IT.json","packages/@react-aria/toast/intl/ja-JP.json","packages/@react-aria/toast/intl/ko-KR.json","packages/@react-aria/toast/intl/lt-LT.json","packages/@react-aria/toast/intl/lv-LV.json","packages/@react-aria/toast/intl/nb-NO.json","packages/@react-aria/toast/intl/nl-NL.json","packages/@react-aria/toast/intl/pl-PL.json","packages/@react-aria/toast/intl/pt-BR.json","packages/@react-aria/toast/intl/pt-PT.json","packages/@react-aria/toast/intl/ro-RO.json","packages/@react-aria/toast/intl/ru-RU.json","packages/@react-aria/toast/intl/sk-SK.json","packages/@react-aria/toast/intl/sl-SI.json","packages/@react-aria/toast/intl/sr-SP.json","packages/@react-aria/toast/intl/sv-SE.json","packages/@react-aria/toast/intl/tr-TR.json","packages/@react-aria/toast/intl/uk-UA.json","packages/@react-aria/toast/intl/zh-CN.json","packages/@react-aria/toast/intl/zh-TW.json","packages/@react-aria/toast/src/useToastRegion.ts"],"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 */\nexport {useToast} from './useToast';\nexport {useToastRegion} from './useToastRegion';\n\nexport type {AriaToastRegionProps, ToastRegionAria} from './useToastRegion';\nexport type {AriaToastProps, ToastAria} from './useToast';\n","/*\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 {AriaButtonProps} from '@react-types/button';\nimport {AriaLabelingProps, DOMAttributes, FocusableElement} from '@react-types/shared';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {QueuedToast, ToastState} from '@react-stately/toast';\nimport {RefObject, useEffect, useRef} from 'react';\nimport {useId, useLayoutEffect, useSlotId} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface AriaToastProps<T> extends AriaLabelingProps {\n /** The toast object. */\n toast: QueuedToast<T>\n}\n\nexport interface ToastAria {\n /** Props for the toast container element. */\n toastProps: DOMAttributes,\n /** Props for the toast title element. */\n titleProps: DOMAttributes,\n /** Props for the toast description element, if any. */\n descriptionProps: DOMAttributes,\n /** Props for the toast close button. */\n closeButtonProps: AriaButtonProps\n}\n\n/**\n * Provides the behavior and accessibility implementation for a toast component.\n * Toasts display brief, temporary notifications of actions, errors, or other events in an application.\n */\nexport function useToast<T>(props: AriaToastProps<T>, state: ToastState<T>, ref: RefObject<FocusableElement>): ToastAria {\n let {\n key,\n timer,\n timeout,\n animation\n } = props.toast;\n\n useEffect(() => {\n if (!timer) {\n return;\n }\n\n timer.reset(timeout);\n return () => {\n timer.pause();\n };\n }, [timer, timeout]);\n\n // Restore focus to the toast container on unmount.\n // If there are no more toasts, the container will be unmounted\n // and will restore focus to wherever focus was before the user\n // focused the toast region.\n let focusOnUnmount = useRef(null);\n useLayoutEffect(() => {\n let container = ref.current.closest('[role=region]') as HTMLElement;\n return () => {\n if (container && container.contains(document.activeElement)) {\n // Focus must be delayed for focus ring to appear, but we can't wait\n // until useEffect cleanup to check if focus was inside the container.\n focusOnUnmount.current = container;\n }\n };\n }, [ref]);\n\n // eslint-disable-next-line\n useEffect(() => {\n return () => {\n if (focusOnUnmount.current) {\n focusOnUnmount.current.focus();\n }\n };\n }, [ref]);\n\n let titleId = useId();\n let descriptionId = useSlotId();\n let stringFormatter = useLocalizedStringFormatter(intlMessages);\n\n return {\n toastProps: {\n role: 'alert',\n 'aria-label': props['aria-label'],\n 'aria-labelledby': props['aria-labelledby'] || titleId,\n 'aria-describedby': props['aria-describedby'] || descriptionId,\n 'aria-details': props['aria-details'],\n // Hide toasts that are animating out so VoiceOver doesn't announce them.\n 'aria-hidden': animation === 'exiting' ? 'true' : undefined\n },\n titleProps: {\n id: titleId\n },\n descriptionProps: {\n id: descriptionId\n },\n closeButtonProps: {\n 'aria-label': stringFormatter.format('close'),\n onPress: () => state.close(key)\n }\n };\n}\n","const _temp0 = require(\"../intl/ar-AE.json\");\nconst _temp1 = require(\"../intl/bg-BG.json\");\nconst _temp2 = require(\"../intl/cs-CZ.json\");\nconst _temp3 = require(\"../intl/da-DK.json\");\nconst _temp4 = require(\"../intl/de-DE.json\");\nconst _temp5 = require(\"../intl/el-GR.json\");\nconst _temp6 = require(\"../intl/en-US.json\");\nconst _temp7 = require(\"../intl/es-ES.json\");\nconst _temp8 = require(\"../intl/et-EE.json\");\nconst _temp9 = require(\"../intl/fi-FI.json\");\nconst _temp10 = require(\"../intl/fr-FR.json\");\nconst _temp11 = require(\"../intl/he-IL.json\");\nconst _temp12 = require(\"../intl/hr-HR.json\");\nconst _temp13 = require(\"../intl/hu-HU.json\");\nconst _temp14 = require(\"../intl/it-IT.json\");\nconst _temp15 = require(\"../intl/ja-JP.json\");\nconst _temp16 = require(\"../intl/ko-KR.json\");\nconst _temp17 = require(\"../intl/lt-LT.json\");\nconst _temp18 = require(\"../intl/lv-LV.json\");\nconst _temp19 = require(\"../intl/nb-NO.json\");\nconst _temp20 = require(\"../intl/nl-NL.json\");\nconst _temp21 = require(\"../intl/pl-PL.json\");\nconst _temp22 = require(\"../intl/pt-BR.json\");\nconst _temp23 = require(\"../intl/pt-PT.json\");\nconst _temp24 = require(\"../intl/ro-RO.json\");\nconst _temp25 = require(\"../intl/ru-RU.json\");\nconst _temp26 = require(\"../intl/sk-SK.json\");\nconst _temp27 = require(\"../intl/sl-SI.json\");\nconst _temp28 = require(\"../intl/sr-SP.json\");\nconst _temp29 = require(\"../intl/sv-SE.json\");\nconst _temp30 = require(\"../intl/tr-TR.json\");\nconst _temp31 = require(\"../intl/uk-UA.json\");\nconst _temp32 = require(\"../intl/zh-CN.json\");\nconst _temp33 = require(\"../intl/zh-TW.json\");\nmodule.exports = {\n \"ar-AE\": _temp0,\n \"bg-BG\": _temp1,\n \"cs-CZ\": _temp2,\n \"da-DK\": _temp3,\n \"de-DE\": _temp4,\n \"el-GR\": _temp5,\n \"en-US\": _temp6,\n \"es-ES\": _temp7,\n \"et-EE\": _temp8,\n \"fi-FI\": _temp9,\n \"fr-FR\": _temp10,\n \"he-IL\": _temp11,\n \"hr-HR\": _temp12,\n \"hu-HU\": _temp13,\n \"it-IT\": _temp14,\n \"ja-JP\": _temp15,\n \"ko-KR\": _temp16,\n \"lt-LT\": _temp17,\n \"lv-LV\": _temp18,\n \"nb-NO\": _temp19,\n \"nl-NL\": _temp20,\n \"pl-PL\": _temp21,\n \"pt-BR\": _temp22,\n \"pt-PT\": _temp23,\n \"ro-RO\": _temp24,\n \"ru-RU\": _temp25,\n \"sk-SK\": _temp26,\n \"sl-SI\": _temp27,\n \"sr-SP\": _temp28,\n \"sv-SE\": _temp29,\n \"tr-TR\": _temp30,\n \"uk-UA\": _temp31,\n \"zh-CN\": _temp32,\n \"zh-TW\": _temp33\n}","{\n \"close\": \"إغلاق\",\n \"notifications\": \"إشعارات\"\n}\n","{\n \"close\": \"Затвори\",\n \"notifications\": \"Известия\"\n}\n","{\n \"close\": \"Zavřít\",\n \"notifications\": \"Upozornění\"\n}\n","{\n \"close\": \"Luk\",\n \"notifications\": \"Påmindelser\"\n}\n","{\n \"close\": \"Schließen\",\n \"notifications\": \"Benachrichtigungen\"\n}\n","{\n \"close\": \"Κλείσιμο\",\n \"notifications\": \"Ειδοποιήσεις\"\n}\n","{\n \"close\": \"Close\",\n \"notifications\": \"Notifications\"\n}\n","{\n \"close\": \"Cerrar\",\n \"notifications\": \"Notificaciones\"\n}\n","{\n \"close\": \"Sule\",\n \"notifications\": \"Teated\"\n}\n","{\n \"close\": \"Sulje\",\n \"notifications\": \"Ilmoitukset\"\n}\n","{\n \"close\": \"Fermer\",\n \"notifications\": \"Notifications\"\n}\n","{\n \"close\": \"סגור\",\n \"notifications\": \"התראות\"\n}\n","{\n \"close\": \"Zatvori\",\n \"notifications\": \"Obavijesti\"\n}\n","{\n \"close\": \"Bezárás\",\n \"notifications\": \"Értesítések\"\n}\n","{\n \"close\": \"Chiudi\",\n \"notifications\": \"Notifiche\"\n}\n","{\n \"close\": \"閉じる\",\n \"notifications\": \"通知\"\n}\n","{\n \"close\": \"닫기\",\n \"notifications\": \"알림\"\n}\n","{\n \"close\": \"Uždaryti\",\n \"notifications\": \"Pranešimai\"\n}\n","{\n \"close\": \"Aizvērt\",\n \"notifications\": \"Paziņojumi\"\n}\n","{\n \"close\": \"Lukk\",\n \"notifications\": \"Varsler\"\n}\n","{\n \"close\": \"Sluiten\",\n \"notifications\": \"Meldingen\"\n}\n","{\n \"close\": \"Zamknij\",\n \"notifications\": \"Powiadomienia\"\n}\n","{\n \"close\": \"Fechar\",\n \"notifications\": \"Notificações\"\n}\n","{\n \"close\": \"Fechar\",\n \"notifications\": \"Notificações\"\n}\n","{\n \"close\": \"Închideţi\",\n \"notifications\": \"Notificări\"\n}\n","{\n \"close\": \"Закрыть\",\n \"notifications\": \"Уведомления\"\n}\n","{\n \"close\": \"Zatvoriť\",\n \"notifications\": \"Oznámenia\"\n}\n","{\n \"close\": \"Zapri\",\n \"notifications\": \"Obvestila\"\n}\n","{\n \"close\": \"Zatvori\",\n \"notifications\": \"Obaveštenja\"\n}\n","{\n \"close\": \"Stäng\",\n \"notifications\": \"Aviseringar\"\n}\n","{\n \"close\": \"Kapat\",\n \"notifications\": \"Bildirimler\"\n}\n","{\n \"close\": \"Закрити\",\n \"notifications\": \"Сповіщення\"\n}\n","{\n \"close\": \"关闭\",\n \"notifications\": \"通知\"\n}\n","{\n \"close\": \"關閉\",\n \"notifications\": \"通知\"\n}\n","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);\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":"main.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;;;AEAA,4BAAiB;IAAG,SAAS,CAAC,KAAK,CAAC;IAClC,iBAAiB,CAAC,OAAO,CAAC;AAC5B;;;;ACFA,4BAAiB;IAAG,SAAS,CAAC,OAAO,CAAC;IACpC,iBAAiB,CAAC,QAAQ,CAAC;AAC7B;;;;ACFA,4BAAiB;IAAG,SAAS,CAAC,MAAM,CAAC;IACnC,iBAAiB,CAAC,UAAU,CAAC;AAC/B;;;;ACFA,4BAAiB;IAAG,SAAS,CAAC,GAAG,CAAC;IAChC,iBAAiB,CAAC,WAAW,CAAC;AAChC;;;;ACFA,4BAAiB;IAAG,SAAS,CAAC,SAAS,CAAC;IACtC,iBAAiB,CAAC,kBAAkB,CAAC;AACvC;;;;ACFA,4BAAiB;IAAG,SAAS,CAAC,QAAQ,CAAC;IACrC,iBAAiB,CAAC,YAAY,CAAC;AACjC;;;;ACFA,4BAAiB;IAAG,SAAS,CAAC,KAAK,CAAC;IAClC,iBAAiB,CAAC,aAAa,CAAC;AAClC;;;;ACFA,4BAAiB;IAAG,SAAS,CAAC,MAAM,CAAC;IACnC,iBAAiB,CAAC,cAAc,CAAC;AACnC;;;;ACFA,4BAAiB;IAAG,SAAS,CAAC,IAAI,CAAC;IACjC,iBAAiB,CAAC,MAAM,CAAC;AAC3B;;;;ACFA,4BAAiB;IAAG,SAAS,CAAC,KAAK,CAAC;IAClC,iBAAiB,CAAC,WAAW,CAAC;AAChC;;;;ACFA,4BAAiB;IAAG,SAAS,CAAC,MAAM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CAAkB,KAA2B,EAAE,KAAoB,EAAE,GAA2B;IAC9G,IAAI,kBAAkB,CAAA,GAAA,gDAA0B,EAAE,CAAA,GAAA,gEAAW;IAC7D,IAAI,iBAAC,aAAa,EAAC,GAAG,CAAA,GAAA,oCAAU,EAAE;QAChC,MAAM;QACN,cAAc,KAAK,CAAC,aAAa,IAAI,gBAAgB,OAAO;IAC9D,GAAG;IAEH,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,qCAAO,EAAE;QAC1B,cAAc,MAAM;QACpB,YAAY,MAAM;IACpB;IAEA,IAAI,cAAc,CAAA,GAAA,mBAAK,EAAE;IACzB,IAAI,oBAAC,gBAAgB,EAAC,GAAG,CAAA,GAAA,2CAAa,EAAE;QACtC,eAAe,CAAC;YACd,MAAM;YACN,YAAY,UAAU,EAAE;QAC1B;QACA,cAAc;YACZ,MAAM;YACN,YAAY,UAAU;QACxB;IACF;IAEA,6EAA6E;IAC7E,+CAA+C;IAC/C,oEAAoE;IACpE,4CAA4C;IAC5C,CAAA,GAAA,sBAAQ,EAAE;QACR,OAAO;YACL,IAAI,YAAY,WAAW,SAAS,KAAK,SAAS,YAAY;gBAC5D,IAAI,CAAA,GAAA,mDAAqB,QAAQ,WAC/B,CAAA,GAAA,2CAAoB,EAAE,YAAY;qBAElC,YAAY,QAAQ;;QAG1B;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/index.ts","packages/@react-aria/toast/src/useToast.ts","packages/@react-aria/toast/src/*.js","packages/@react-aria/toast/intl/ar-AE.json","packages/@react-aria/toast/intl/bg-BG.json","packages/@react-aria/toast/intl/cs-CZ.json","packages/@react-aria/toast/intl/da-DK.json","packages/@react-aria/toast/intl/de-DE.json","packages/@react-aria/toast/intl/el-GR.json","packages/@react-aria/toast/intl/en-US.json","packages/@react-aria/toast/intl/es-ES.json","packages/@react-aria/toast/intl/et-EE.json","packages/@react-aria/toast/intl/fi-FI.json","packages/@react-aria/toast/intl/fr-FR.json","packages/@react-aria/toast/intl/he-IL.json","packages/@react-aria/toast/intl/hr-HR.json","packages/@react-aria/toast/intl/hu-HU.json","packages/@react-aria/toast/intl/it-IT.json","packages/@react-aria/toast/intl/ja-JP.json","packages/@react-aria/toast/intl/ko-KR.json","packages/@react-aria/toast/intl/lt-LT.json","packages/@react-aria/toast/intl/lv-LV.json","packages/@react-aria/toast/intl/nb-NO.json","packages/@react-aria/toast/intl/nl-NL.json","packages/@react-aria/toast/intl/pl-PL.json","packages/@react-aria/toast/intl/pt-BR.json","packages/@react-aria/toast/intl/pt-PT.json","packages/@react-aria/toast/intl/ro-RO.json","packages/@react-aria/toast/intl/ru-RU.json","packages/@react-aria/toast/intl/sk-SK.json","packages/@react-aria/toast/intl/sl-SI.json","packages/@react-aria/toast/intl/sr-SP.json","packages/@react-aria/toast/intl/sv-SE.json","packages/@react-aria/toast/intl/tr-TR.json","packages/@react-aria/toast/intl/uk-UA.json","packages/@react-aria/toast/intl/zh-CN.json","packages/@react-aria/toast/intl/zh-TW.json","packages/@react-aria/toast/src/useToastRegion.ts"],"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 */\nexport {useToast} from './useToast';\nexport {useToastRegion} from './useToastRegion';\n\nexport type {AriaToastRegionProps, ToastRegionAria} from './useToastRegion';\nexport type {AriaToastProps, ToastAria} from './useToast';\n","/*\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 {AriaButtonProps} from '@react-types/button';\nimport {AriaLabelingProps, DOMAttributes, FocusableElement} from '@react-types/shared';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {QueuedToast, ToastState} from '@react-stately/toast';\nimport {RefObject, useEffect, useRef} from 'react';\nimport {useId, useLayoutEffect, useSlotId} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface AriaToastProps<T> extends AriaLabelingProps {\n /** The toast object. */\n toast: QueuedToast<T>\n}\n\nexport interface ToastAria {\n /** Props for the toast container element. */\n toastProps: DOMAttributes,\n /** Props for the toast title element. */\n titleProps: DOMAttributes,\n /** Props for the toast description element, if any. */\n descriptionProps: DOMAttributes,\n /** Props for the toast close button. */\n closeButtonProps: AriaButtonProps\n}\n\n/**\n * Provides the behavior and accessibility implementation for a toast component.\n * Toasts display brief, temporary notifications of actions, errors, or other events in an application.\n */\nexport function useToast<T>(props: AriaToastProps<T>, state: ToastState<T>, ref: RefObject<FocusableElement>): ToastAria {\n let {\n key,\n timer,\n timeout,\n animation\n } = props.toast;\n\n useEffect(() => {\n if (!timer) {\n return;\n }\n\n timer.reset(timeout);\n return () => {\n timer.pause();\n };\n }, [timer, timeout]);\n\n // Restore focus to the toast container on unmount.\n // If there are no more toasts, the container will be unmounted\n // and will restore focus to wherever focus was before the user\n // focused the toast region.\n let focusOnUnmount = useRef(null);\n useLayoutEffect(() => {\n let container = ref.current.closest('[role=region]') as HTMLElement;\n return () => {\n if (container && container.contains(document.activeElement)) {\n // Focus must be delayed for focus ring to appear, but we can't wait\n // until useEffect cleanup to check if focus was inside the container.\n focusOnUnmount.current = container;\n }\n };\n }, [ref]);\n\n // eslint-disable-next-line\n useEffect(() => {\n return () => {\n if (focusOnUnmount.current) {\n focusOnUnmount.current.focus();\n }\n };\n }, [ref]);\n\n let titleId = useId();\n let descriptionId = useSlotId();\n let stringFormatter = useLocalizedStringFormatter(intlMessages);\n\n return {\n toastProps: {\n role: 'alert',\n 'aria-label': props['aria-label'],\n 'aria-labelledby': props['aria-labelledby'] || titleId,\n 'aria-describedby': props['aria-describedby'] || descriptionId,\n 'aria-details': props['aria-details'],\n // Hide toasts that are animating out so VoiceOver doesn't announce them.\n 'aria-hidden': animation === 'exiting' ? 'true' : undefined\n },\n titleProps: {\n id: titleId\n },\n descriptionProps: {\n id: descriptionId\n },\n closeButtonProps: {\n 'aria-label': stringFormatter.format('close'),\n onPress: () => state.close(key)\n }\n };\n}\n","const _temp0 = require(\"../intl/ar-AE.json\");\nconst _temp1 = require(\"../intl/bg-BG.json\");\nconst _temp2 = require(\"../intl/cs-CZ.json\");\nconst _temp3 = require(\"../intl/da-DK.json\");\nconst _temp4 = require(\"../intl/de-DE.json\");\nconst _temp5 = require(\"../intl/el-GR.json\");\nconst _temp6 = require(\"../intl/en-US.json\");\nconst _temp7 = require(\"../intl/es-ES.json\");\nconst _temp8 = require(\"../intl/et-EE.json\");\nconst _temp9 = require(\"../intl/fi-FI.json\");\nconst _temp10 = require(\"../intl/fr-FR.json\");\nconst _temp11 = require(\"../intl/he-IL.json\");\nconst _temp12 = require(\"../intl/hr-HR.json\");\nconst _temp13 = require(\"../intl/hu-HU.json\");\nconst _temp14 = require(\"../intl/it-IT.json\");\nconst _temp15 = require(\"../intl/ja-JP.json\");\nconst _temp16 = require(\"../intl/ko-KR.json\");\nconst _temp17 = require(\"../intl/lt-LT.json\");\nconst _temp18 = require(\"../intl/lv-LV.json\");\nconst _temp19 = require(\"../intl/nb-NO.json\");\nconst _temp20 = require(\"../intl/nl-NL.json\");\nconst _temp21 = require(\"../intl/pl-PL.json\");\nconst _temp22 = require(\"../intl/pt-BR.json\");\nconst _temp23 = require(\"../intl/pt-PT.json\");\nconst _temp24 = require(\"../intl/ro-RO.json\");\nconst _temp25 = require(\"../intl/ru-RU.json\");\nconst _temp26 = require(\"../intl/sk-SK.json\");\nconst _temp27 = require(\"../intl/sl-SI.json\");\nconst _temp28 = require(\"../intl/sr-SP.json\");\nconst _temp29 = require(\"../intl/sv-SE.json\");\nconst _temp30 = require(\"../intl/tr-TR.json\");\nconst _temp31 = require(\"../intl/uk-UA.json\");\nconst _temp32 = require(\"../intl/zh-CN.json\");\nconst _temp33 = require(\"../intl/zh-TW.json\");\nmodule.exports = {\n \"ar-AE\": _temp0,\n \"bg-BG\": _temp1,\n \"cs-CZ\": _temp2,\n \"da-DK\": _temp3,\n \"de-DE\": _temp4,\n \"el-GR\": _temp5,\n \"en-US\": _temp6,\n \"es-ES\": _temp7,\n \"et-EE\": _temp8,\n \"fi-FI\": _temp9,\n \"fr-FR\": _temp10,\n \"he-IL\": _temp11,\n \"hr-HR\": _temp12,\n \"hu-HU\": _temp13,\n \"it-IT\": _temp14,\n \"ja-JP\": _temp15,\n \"ko-KR\": _temp16,\n \"lt-LT\": _temp17,\n \"lv-LV\": _temp18,\n \"nb-NO\": _temp19,\n \"nl-NL\": _temp20,\n \"pl-PL\": _temp21,\n \"pt-BR\": _temp22,\n \"pt-PT\": _temp23,\n \"ro-RO\": _temp24,\n \"ru-RU\": _temp25,\n \"sk-SK\": _temp26,\n \"sl-SI\": _temp27,\n \"sr-SP\": _temp28,\n \"sv-SE\": _temp29,\n \"tr-TR\": _temp30,\n \"uk-UA\": _temp31,\n \"zh-CN\": _temp32,\n \"zh-TW\": _temp33\n}","{\n \"close\": \"إغلاق\",\n \"notifications\": \"إشعارات\"\n}\n","{\n \"close\": \"Затвори\",\n \"notifications\": \"Известия\"\n}\n","{\n \"close\": \"Zavřít\",\n \"notifications\": \"Upozornění\"\n}\n","{\n \"close\": \"Luk\",\n \"notifications\": \"Påmindelser\"\n}\n","{\n \"close\": \"Schließen\",\n \"notifications\": \"Benachrichtigungen\"\n}\n","{\n \"close\": \"Κλείσιμο\",\n \"notifications\": \"Ειδοποιήσεις\"\n}\n","{\n \"close\": \"Close\",\n \"notifications\": \"Notifications\"\n}\n","{\n \"close\": \"Cerrar\",\n \"notifications\": \"Notificaciones\"\n}\n","{\n \"close\": \"Sule\",\n \"notifications\": \"Teated\"\n}\n","{\n \"close\": \"Sulje\",\n \"notifications\": \"Ilmoitukset\"\n}\n","{\n \"close\": \"Fermer\",\n \"notifications\": \"Notifications\"\n}\n","{\n \"close\": \"סגור\",\n \"notifications\": \"התראות\"\n}\n","{\n \"close\": \"Zatvori\",\n \"notifications\": \"Obavijesti\"\n}\n","{\n \"close\": \"Bezárás\",\n \"notifications\": \"Értesítések\"\n}\n","{\n \"close\": \"Chiudi\",\n \"notifications\": \"Notifiche\"\n}\n","{\n \"close\": \"閉じる\",\n \"notifications\": \"通知\"\n}\n","{\n \"close\": \"닫기\",\n \"notifications\": \"알림\"\n}\n","{\n \"close\": \"Uždaryti\",\n \"notifications\": \"Pranešimai\"\n}\n","{\n \"close\": \"Aizvērt\",\n \"notifications\": \"Paziņojumi\"\n}\n","{\n \"close\": \"Lukk\",\n \"notifications\": \"Varsler\"\n}\n","{\n \"close\": \"Sluiten\",\n \"notifications\": \"Meldingen\"\n}\n","{\n \"close\": \"Zamknij\",\n \"notifications\": \"Powiadomienia\"\n}\n","{\n \"close\": \"Fechar\",\n \"notifications\": \"Notificações\"\n}\n","{\n \"close\": \"Fechar\",\n \"notifications\": \"Notificações\"\n}\n","{\n \"close\": \"Închideţi\",\n \"notifications\": \"Notificări\"\n}\n","{\n \"close\": \"Закрыть\",\n \"notifications\": \"Уведомления\"\n}\n","{\n \"close\": \"Zatvoriť\",\n \"notifications\": \"Oznámenia\"\n}\n","{\n \"close\": \"Zapri\",\n \"notifications\": \"Obvestila\"\n}\n","{\n \"close\": \"Zatvori\",\n \"notifications\": \"Obaveštenja\"\n}\n","{\n \"close\": \"Stäng\",\n \"notifications\": \"Aviseringar\"\n}\n","{\n \"close\": \"Kapat\",\n \"notifications\": \"Bildirimler\"\n}\n","{\n \"close\": \"Закрити\",\n \"notifications\": \"Сповіщення\"\n}\n","{\n \"close\": \"关闭\",\n \"notifications\": \"通知\"\n}\n","{\n \"close\": \"關閉\",\n \"notifications\": \"通知\"\n}\n","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);\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":"main.js.map"}
|
package/dist/module.js
CHANGED
|
@@ -308,7 +308,7 @@ $7853651519a70071$exports = {
|
|
|
308
308
|
|
|
309
309
|
|
|
310
310
|
function $d6542812f0669241$export$a407b657d3044108(props, state, ref) {
|
|
311
|
-
let { key: key
|
|
311
|
+
let { key: key, timer: timer, timeout: timeout, animation: animation } = props.toast;
|
|
312
312
|
(0, $5bA4N$useEffect)(()=>{
|
|
313
313
|
if (!timer) return;
|
|
314
314
|
timer.reset(timeout);
|
|
@@ -377,16 +377,16 @@ function $d6542812f0669241$export$a407b657d3044108(props, state, ref) {
|
|
|
377
377
|
|
|
378
378
|
function $6cc546b19ee7130a$export$b8cbbb20a51697de(props, state, ref) {
|
|
379
379
|
let stringFormatter = (0, $5bA4N$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($7853651519a70071$exports))));
|
|
380
|
-
let { landmarkProps: landmarkProps
|
|
380
|
+
let { landmarkProps: landmarkProps } = (0, $5bA4N$useLandmark)({
|
|
381
381
|
role: "region",
|
|
382
382
|
"aria-label": props["aria-label"] || stringFormatter.format("notifications")
|
|
383
383
|
}, ref);
|
|
384
|
-
let { hoverProps: hoverProps
|
|
384
|
+
let { hoverProps: hoverProps } = (0, $5bA4N$useHover)({
|
|
385
385
|
onHoverStart: state.pauseAll,
|
|
386
386
|
onHoverEnd: state.resumeAll
|
|
387
387
|
});
|
|
388
388
|
let lastFocused = (0, $5bA4N$useRef)(null);
|
|
389
|
-
let { focusWithinProps: focusWithinProps
|
|
389
|
+
let { focusWithinProps: focusWithinProps } = (0, $5bA4N$useFocusWithin)({
|
|
390
390
|
onFocusWithin: (e)=>{
|
|
391
391
|
state.pauseAll();
|
|
392
392
|
lastFocused.current = e.relatedTarget;
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;;;AEAA,4BAAiB;IAAG,SAAS,CAAC,KAAK,CAAC;IAClC,iBAAiB,CAAC,OAAO,CAAC;AAC5B;;;;ACFA,4BAAiB;IAAG,SAAS,CAAC,OAAO,CAAC;IACpC,iBAAiB,CAAC,QAAQ,CAAC;AAC7B;;;;ACFA,4BAAiB;IAAG,SAAS,CAAC,MAAM,CAAC;IACnC,iBAAiB,CAAC,UAAU,CAAC;AAC/B;;;;ACFA,4BAAiB;IAAG,SAAS,CAAC,GAAG,CAAC;IAChC,iBAAiB,CAAC,WAAW,CAAC;AAChC;;;;ACFA,4BAAiB;IAAG,SAAS,CAAC,SAAS,CAAC;IACtC,iBAAiB,CAAC,kBAAkB,CAAC;AACvC;;;;ACFA,4BAAiB;IAAG,SAAS,CAAC,QAAQ,CAAC;IACrC,iBAAiB,CAAC,YAAY,CAAC;AACjC;;;;ACFA,4BAAiB;IAAG,SAAS,CAAC,KAAK,CAAC;IAClC,iBAAiB,CAAC,aAAa,CAAC;AAClC;;;;ACFA,4BAAiB;IAAG,SAAS,CAAC,MAAM,CAAC;IACnC,iBAAiB,CAAC,cAAc,CAAC;AACnC;;;;ACFA,4BAAiB;IAAG,SAAS,CAAC,IAAI,CAAC;IACjC,iBAAiB,CAAC,MAAM,CAAC;AAC3B;;;;ACF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QACA,kBAAkB;YAChB,cAAc,gBAAgB,OAAO;YACrC,SAAS,IAAM,MAAM,MAAM;QAC7B;IACF;AACF;;CDpGC;;;;;;;AqCiBM,SAAS,0CAAkB,KAA2B,EAAE,KAAoB,EAAE,GAA2B;IAC9G,IAAI,kBAAkB,CAAA,GAAA,kCAA0B,EAAE,CAAA,GAAA,gEAAW;IAC7D,IAAI,iBAAC,cAAa,EAAC,GAAG,CAAA,GAAA,kBAAU,EAAE;QAChC,MAAM;QACN,cAAc,KAAK,CAAC,aAAa,IAAI,gBAAgB,OAAO;IAC9D,GAAG;IAEH,IAAI,cAAC,WAAU,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;QAC1B,cAAc,MAAM;QACpB,YAAY,MAAM;IACpB;IAEA,IAAI,cAAc,CAAA,GAAA,aAAK,EAAE;IACzB,IAAI,oBAAC,iBAAgB,EAAC,GAAG,CAAA,GAAA,qBAAa,EAAE;QACtC,eAAe,CAAC;YACd,MAAM;YACN,YAAY,UAAU,EAAE;QAC1B;QACA,cAAc;YACZ,MAAM;YACN,YAAY,UAAU;QACxB;IACF;IAEA,6EAA6E;IAC7E,+CAA+C;IAC/C,oEAAoE;IACpE,4CAA4C;IAC5C,CAAA,GAAA,gBAAQ,EAAE;QACR,OAAO;YACL,IAAI,YAAY,WAAW,SAAS,KAAK,SAAS,YAAY;gBAC5D,IAAI,CAAA,GAAA,6BAAqB,QAAQ,WAC/B,CAAA,GAAA,4BAAoB,EAAE,YAAY;qBAElC,YAAY,QAAQ;;QAG1B;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/index.ts","packages/@react-aria/toast/src/useToast.ts","packages/@react-aria/toast/src/*.js","packages/@react-aria/toast/intl/ar-AE.json","packages/@react-aria/toast/intl/bg-BG.json","packages/@react-aria/toast/intl/cs-CZ.json","packages/@react-aria/toast/intl/da-DK.json","packages/@react-aria/toast/intl/de-DE.json","packages/@react-aria/toast/intl/el-GR.json","packages/@react-aria/toast/intl/en-US.json","packages/@react-aria/toast/intl/es-ES.json","packages/@react-aria/toast/intl/et-EE.json","packages/@react-aria/toast/intl/fi-FI.json","packages/@react-aria/toast/intl/fr-FR.json","packages/@react-aria/toast/intl/he-IL.json","packages/@react-aria/toast/intl/hr-HR.json","packages/@react-aria/toast/intl/hu-HU.json","packages/@react-aria/toast/intl/it-IT.json","packages/@react-aria/toast/intl/ja-JP.json","packages/@react-aria/toast/intl/ko-KR.json","packages/@react-aria/toast/intl/lt-LT.json","packages/@react-aria/toast/intl/lv-LV.json","packages/@react-aria/toast/intl/nb-NO.json","packages/@react-aria/toast/intl/nl-NL.json","packages/@react-aria/toast/intl/pl-PL.json","packages/@react-aria/toast/intl/pt-BR.json","packages/@react-aria/toast/intl/pt-PT.json","packages/@react-aria/toast/intl/ro-RO.json","packages/@react-aria/toast/intl/ru-RU.json","packages/@react-aria/toast/intl/sk-SK.json","packages/@react-aria/toast/intl/sl-SI.json","packages/@react-aria/toast/intl/sr-SP.json","packages/@react-aria/toast/intl/sv-SE.json","packages/@react-aria/toast/intl/tr-TR.json","packages/@react-aria/toast/intl/uk-UA.json","packages/@react-aria/toast/intl/zh-CN.json","packages/@react-aria/toast/intl/zh-TW.json","packages/@react-aria/toast/src/useToastRegion.ts"],"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 */\nexport {useToast} from './useToast';\nexport {useToastRegion} from './useToastRegion';\n\nexport type {AriaToastRegionProps, ToastRegionAria} from './useToastRegion';\nexport type {AriaToastProps, ToastAria} from './useToast';\n","/*\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 {AriaButtonProps} from '@react-types/button';\nimport {AriaLabelingProps, DOMAttributes, FocusableElement} from '@react-types/shared';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {QueuedToast, ToastState} from '@react-stately/toast';\nimport {RefObject, useEffect, useRef} from 'react';\nimport {useId, useLayoutEffect, useSlotId} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface AriaToastProps<T> extends AriaLabelingProps {\n /** The toast object. */\n toast: QueuedToast<T>\n}\n\nexport interface ToastAria {\n /** Props for the toast container element. */\n toastProps: DOMAttributes,\n /** Props for the toast title element. */\n titleProps: DOMAttributes,\n /** Props for the toast description element, if any. */\n descriptionProps: DOMAttributes,\n /** Props for the toast close button. */\n closeButtonProps: AriaButtonProps\n}\n\n/**\n * Provides the behavior and accessibility implementation for a toast component.\n * Toasts display brief, temporary notifications of actions, errors, or other events in an application.\n */\nexport function useToast<T>(props: AriaToastProps<T>, state: ToastState<T>, ref: RefObject<FocusableElement>): ToastAria {\n let {\n key,\n timer,\n timeout,\n animation\n } = props.toast;\n\n useEffect(() => {\n if (!timer) {\n return;\n }\n\n timer.reset(timeout);\n return () => {\n timer.pause();\n };\n }, [timer, timeout]);\n\n // Restore focus to the toast container on unmount.\n // If there are no more toasts, the container will be unmounted\n // and will restore focus to wherever focus was before the user\n // focused the toast region.\n let focusOnUnmount = useRef(null);\n useLayoutEffect(() => {\n let container = ref.current.closest('[role=region]') as HTMLElement;\n return () => {\n if (container && container.contains(document.activeElement)) {\n // Focus must be delayed for focus ring to appear, but we can't wait\n // until useEffect cleanup to check if focus was inside the container.\n focusOnUnmount.current = container;\n }\n };\n }, [ref]);\n\n // eslint-disable-next-line\n useEffect(() => {\n return () => {\n if (focusOnUnmount.current) {\n focusOnUnmount.current.focus();\n }\n };\n }, [ref]);\n\n let titleId = useId();\n let descriptionId = useSlotId();\n let stringFormatter = useLocalizedStringFormatter(intlMessages);\n\n return {\n toastProps: {\n role: 'alert',\n 'aria-label': props['aria-label'],\n 'aria-labelledby': props['aria-labelledby'] || titleId,\n 'aria-describedby': props['aria-describedby'] || descriptionId,\n 'aria-details': props['aria-details'],\n // Hide toasts that are animating out so VoiceOver doesn't announce them.\n 'aria-hidden': animation === 'exiting' ? 'true' : undefined\n },\n titleProps: {\n id: titleId\n },\n descriptionProps: {\n id: descriptionId\n },\n closeButtonProps: {\n 'aria-label': stringFormatter.format('close'),\n onPress: () => state.close(key)\n }\n };\n}\n","const _temp0 = require(\"../intl/ar-AE.json\");\nconst _temp1 = require(\"../intl/bg-BG.json\");\nconst _temp2 = require(\"../intl/cs-CZ.json\");\nconst _temp3 = require(\"../intl/da-DK.json\");\nconst _temp4 = require(\"../intl/de-DE.json\");\nconst _temp5 = require(\"../intl/el-GR.json\");\nconst _temp6 = require(\"../intl/en-US.json\");\nconst _temp7 = require(\"../intl/es-ES.json\");\nconst _temp8 = require(\"../intl/et-EE.json\");\nconst _temp9 = require(\"../intl/fi-FI.json\");\nconst _temp10 = require(\"../intl/fr-FR.json\");\nconst _temp11 = require(\"../intl/he-IL.json\");\nconst _temp12 = require(\"../intl/hr-HR.json\");\nconst _temp13 = require(\"../intl/hu-HU.json\");\nconst _temp14 = require(\"../intl/it-IT.json\");\nconst _temp15 = require(\"../intl/ja-JP.json\");\nconst _temp16 = require(\"../intl/ko-KR.json\");\nconst _temp17 = require(\"../intl/lt-LT.json\");\nconst _temp18 = require(\"../intl/lv-LV.json\");\nconst _temp19 = require(\"../intl/nb-NO.json\");\nconst _temp20 = require(\"../intl/nl-NL.json\");\nconst _temp21 = require(\"../intl/pl-PL.json\");\nconst _temp22 = require(\"../intl/pt-BR.json\");\nconst _temp23 = require(\"../intl/pt-PT.json\");\nconst _temp24 = require(\"../intl/ro-RO.json\");\nconst _temp25 = require(\"../intl/ru-RU.json\");\nconst _temp26 = require(\"../intl/sk-SK.json\");\nconst _temp27 = require(\"../intl/sl-SI.json\");\nconst _temp28 = require(\"../intl/sr-SP.json\");\nconst _temp29 = require(\"../intl/sv-SE.json\");\nconst _temp30 = require(\"../intl/tr-TR.json\");\nconst _temp31 = require(\"../intl/uk-UA.json\");\nconst _temp32 = require(\"../intl/zh-CN.json\");\nconst _temp33 = require(\"../intl/zh-TW.json\");\nmodule.exports = {\n \"ar-AE\": _temp0,\n \"bg-BG\": _temp1,\n \"cs-CZ\": _temp2,\n \"da-DK\": _temp3,\n \"de-DE\": _temp4,\n \"el-GR\": _temp5,\n \"en-US\": _temp6,\n \"es-ES\": _temp7,\n \"et-EE\": _temp8,\n \"fi-FI\": _temp9,\n \"fr-FR\": _temp10,\n \"he-IL\": _temp11,\n \"hr-HR\": _temp12,\n \"hu-HU\": _temp13,\n \"it-IT\": _temp14,\n \"ja-JP\": _temp15,\n \"ko-KR\": _temp16,\n \"lt-LT\": _temp17,\n \"lv-LV\": _temp18,\n \"nb-NO\": _temp19,\n \"nl-NL\": _temp20,\n \"pl-PL\": _temp21,\n \"pt-BR\": _temp22,\n \"pt-PT\": _temp23,\n \"ro-RO\": _temp24,\n \"ru-RU\": _temp25,\n \"sk-SK\": _temp26,\n \"sl-SI\": _temp27,\n \"sr-SP\": _temp28,\n \"sv-SE\": _temp29,\n \"tr-TR\": _temp30,\n \"uk-UA\": _temp31,\n \"zh-CN\": _temp32,\n \"zh-TW\": _temp33\n}","{\n \"close\": \"إغلاق\",\n \"notifications\": \"إشعارات\"\n}\n","{\n \"close\": \"Затвори\",\n \"notifications\": \"Известия\"\n}\n","{\n \"close\": \"Zavřít\",\n \"notifications\": \"Upozornění\"\n}\n","{\n \"close\": \"Luk\",\n \"notifications\": \"Påmindelser\"\n}\n","{\n \"close\": \"Schließen\",\n \"notifications\": \"Benachrichtigungen\"\n}\n","{\n \"close\": \"Κλείσιμο\",\n \"notifications\": \"Ειδοποιήσεις\"\n}\n","{\n \"close\": \"Close\",\n \"notifications\": \"Notifications\"\n}\n","{\n \"close\": \"Cerrar\",\n \"notifications\": \"Notificaciones\"\n}\n","{\n \"close\": \"Sule\",\n \"notifications\": \"Teated\"\n}\n","{\n \"close\": \"Sulje\",\n \"notifications\": \"Ilmoitukset\"\n}\n","{\n \"close\": \"Fermer\",\n \"notifications\": \"Notifications\"\n}\n","{\n \"close\": \"סגור\",\n \"notifications\": \"התראות\"\n}\n","{\n \"close\": \"Zatvori\",\n \"notifications\": \"Obavijesti\"\n}\n","{\n \"close\": \"Bezárás\",\n \"notifications\": \"Értesítések\"\n}\n","{\n \"close\": \"Chiudi\",\n \"notifications\": \"Notifiche\"\n}\n","{\n \"close\": \"閉じる\",\n \"notifications\": \"通知\"\n}\n","{\n \"close\": \"닫기\",\n \"notifications\": \"알림\"\n}\n","{\n \"close\": \"Uždaryti\",\n \"notifications\": \"Pranešimai\"\n}\n","{\n \"close\": \"Aizvērt\",\n \"notifications\": \"Paziņojumi\"\n}\n","{\n \"close\": \"Lukk\",\n \"notifications\": \"Varsler\"\n}\n","{\n \"close\": \"Sluiten\",\n \"notifications\": \"Meldingen\"\n}\n","{\n \"close\": \"Zamknij\",\n \"notifications\": \"Powiadomienia\"\n}\n","{\n \"close\": \"Fechar\",\n \"notifications\": \"Notificações\"\n}\n","{\n \"close\": \"Fechar\",\n \"notifications\": \"Notificações\"\n}\n","{\n \"close\": \"Închideţi\",\n \"notifications\": \"Notificări\"\n}\n","{\n \"close\": \"Закрыть\",\n \"notifications\": \"Уведомления\"\n}\n","{\n \"close\": \"Zatvoriť\",\n \"notifications\": \"Oznámenia\"\n}\n","{\n \"close\": \"Zapri\",\n \"notifications\": \"Obvestila\"\n}\n","{\n \"close\": \"Zatvori\",\n \"notifications\": \"Obaveštenja\"\n}\n","{\n \"close\": \"Stäng\",\n \"notifications\": \"Aviseringar\"\n}\n","{\n \"close\": \"Kapat\",\n \"notifications\": \"Bildirimler\"\n}\n","{\n \"close\": \"Закрити\",\n \"notifications\": \"Сповіщення\"\n}\n","{\n \"close\": \"关闭\",\n \"notifications\": \"通知\"\n}\n","{\n \"close\": \"關閉\",\n \"notifications\": \"通知\"\n}\n","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);\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":"module.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;;;AEAA,4BAAiB;IAAG,SAAS,CAAC,KAAK,CAAC;IAClC,iBAAiB,CAAC,OAAO,CAAC;AAC5B;;;;ACFA,4BAAiB;IAAG,SAAS,CAAC,OAAO,CAAC;IACpC,iBAAiB,CAAC,QAAQ,CAAC;AAC7B;;;;ACFA,4BAAiB;IAAG,SAAS,CAAC,MAAM,CAAC;IACnC,iBAAiB,CAAC,UAAU,CAAC;AAC/B;;;;ACFA,4BAAiB;IAAG,SAAS,CAAC,GAAG,CAAC;IAChC,iBAAiB,CAAC,WAAW,CAAC;AAChC;;;;ACFA,4BAAiB;IAAG,SAAS,CAAC,SAAS,CAAC;IACtC,iBAAiB,CAAC,kBAAkB,CAAC;AACvC;;;;ACFA,4BAAiB;IAAG,SAAS,CAAC,QAAQ,CAAC;IACrC,iBAAiB,CAAC,YAAY,CAAC;AACjC;;;;ACFA,4BAAiB;IAAG,SAAS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AAA,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/index.ts","packages/@react-aria/toast/src/useToast.ts","packages/@react-aria/toast/src/*.js","packages/@react-aria/toast/intl/ar-AE.json","packages/@react-aria/toast/intl/bg-BG.json","packages/@react-aria/toast/intl/cs-CZ.json","packages/@react-aria/toast/intl/da-DK.json","packages/@react-aria/toast/intl/de-DE.json","packages/@react-aria/toast/intl/el-GR.json","packages/@react-aria/toast/intl/en-US.json","packages/@react-aria/toast/intl/es-ES.json","packages/@react-aria/toast/intl/et-EE.json","packages/@react-aria/toast/intl/fi-FI.json","packages/@react-aria/toast/intl/fr-FR.json","packages/@react-aria/toast/intl/he-IL.json","packages/@react-aria/toast/intl/hr-HR.json","packages/@react-aria/toast/intl/hu-HU.json","packages/@react-aria/toast/intl/it-IT.json","packages/@react-aria/toast/intl/ja-JP.json","packages/@react-aria/toast/intl/ko-KR.json","packages/@react-aria/toast/intl/lt-LT.json","packages/@react-aria/toast/intl/lv-LV.json","packages/@react-aria/toast/intl/nb-NO.json","packages/@react-aria/toast/intl/nl-NL.json","packages/@react-aria/toast/intl/pl-PL.json","packages/@react-aria/toast/intl/pt-BR.json","packages/@react-aria/toast/intl/pt-PT.json","packages/@react-aria/toast/intl/ro-RO.json","packages/@react-aria/toast/intl/ru-RU.json","packages/@react-aria/toast/intl/sk-SK.json","packages/@react-aria/toast/intl/sl-SI.json","packages/@react-aria/toast/intl/sr-SP.json","packages/@react-aria/toast/intl/sv-SE.json","packages/@react-aria/toast/intl/tr-TR.json","packages/@react-aria/toast/intl/uk-UA.json","packages/@react-aria/toast/intl/zh-CN.json","packages/@react-aria/toast/intl/zh-TW.json","packages/@react-aria/toast/src/useToastRegion.ts"],"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 */\nexport {useToast} from './useToast';\nexport {useToastRegion} from './useToastRegion';\n\nexport type {AriaToastRegionProps, ToastRegionAria} from './useToastRegion';\nexport type {AriaToastProps, ToastAria} from './useToast';\n","/*\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 {AriaButtonProps} from '@react-types/button';\nimport {AriaLabelingProps, DOMAttributes, FocusableElement} from '@react-types/shared';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {QueuedToast, ToastState} from '@react-stately/toast';\nimport {RefObject, useEffect, useRef} from 'react';\nimport {useId, useLayoutEffect, useSlotId} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface AriaToastProps<T> extends AriaLabelingProps {\n /** The toast object. */\n toast: QueuedToast<T>\n}\n\nexport interface ToastAria {\n /** Props for the toast container element. */\n toastProps: DOMAttributes,\n /** Props for the toast title element. */\n titleProps: DOMAttributes,\n /** Props for the toast description element, if any. */\n descriptionProps: DOMAttributes,\n /** Props for the toast close button. */\n closeButtonProps: AriaButtonProps\n}\n\n/**\n * Provides the behavior and accessibility implementation for a toast component.\n * Toasts display brief, temporary notifications of actions, errors, or other events in an application.\n */\nexport function useToast<T>(props: AriaToastProps<T>, state: ToastState<T>, ref: RefObject<FocusableElement>): ToastAria {\n let {\n key,\n timer,\n timeout,\n animation\n } = props.toast;\n\n useEffect(() => {\n if (!timer) {\n return;\n }\n\n timer.reset(timeout);\n return () => {\n timer.pause();\n };\n }, [timer, timeout]);\n\n // Restore focus to the toast container on unmount.\n // If there are no more toasts, the container will be unmounted\n // and will restore focus to wherever focus was before the user\n // focused the toast region.\n let focusOnUnmount = useRef(null);\n useLayoutEffect(() => {\n let container = ref.current.closest('[role=region]') as HTMLElement;\n return () => {\n if (container && container.contains(document.activeElement)) {\n // Focus must be delayed for focus ring to appear, but we can't wait\n // until useEffect cleanup to check if focus was inside the container.\n focusOnUnmount.current = container;\n }\n };\n }, [ref]);\n\n // eslint-disable-next-line\n useEffect(() => {\n return () => {\n if (focusOnUnmount.current) {\n focusOnUnmount.current.focus();\n }\n };\n }, [ref]);\n\n let titleId = useId();\n let descriptionId = useSlotId();\n let stringFormatter = useLocalizedStringFormatter(intlMessages);\n\n return {\n toastProps: {\n role: 'alert',\n 'aria-label': props['aria-label'],\n 'aria-labelledby': props['aria-labelledby'] || titleId,\n 'aria-describedby': props['aria-describedby'] || descriptionId,\n 'aria-details': props['aria-details'],\n // Hide toasts that are animating out so VoiceOver doesn't announce them.\n 'aria-hidden': animation === 'exiting' ? 'true' : undefined\n },\n titleProps: {\n id: titleId\n },\n descriptionProps: {\n id: descriptionId\n },\n closeButtonProps: {\n 'aria-label': stringFormatter.format('close'),\n onPress: () => state.close(key)\n }\n };\n}\n","const _temp0 = require(\"../intl/ar-AE.json\");\nconst _temp1 = require(\"../intl/bg-BG.json\");\nconst _temp2 = require(\"../intl/cs-CZ.json\");\nconst _temp3 = require(\"../intl/da-DK.json\");\nconst _temp4 = require(\"../intl/de-DE.json\");\nconst _temp5 = require(\"../intl/el-GR.json\");\nconst _temp6 = require(\"../intl/en-US.json\");\nconst _temp7 = require(\"../intl/es-ES.json\");\nconst _temp8 = require(\"../intl/et-EE.json\");\nconst _temp9 = require(\"../intl/fi-FI.json\");\nconst _temp10 = require(\"../intl/fr-FR.json\");\nconst _temp11 = require(\"../intl/he-IL.json\");\nconst _temp12 = require(\"../intl/hr-HR.json\");\nconst _temp13 = require(\"../intl/hu-HU.json\");\nconst _temp14 = require(\"../intl/it-IT.json\");\nconst _temp15 = require(\"../intl/ja-JP.json\");\nconst _temp16 = require(\"../intl/ko-KR.json\");\nconst _temp17 = require(\"../intl/lt-LT.json\");\nconst _temp18 = require(\"../intl/lv-LV.json\");\nconst _temp19 = require(\"../intl/nb-NO.json\");\nconst _temp20 = require(\"../intl/nl-NL.json\");\nconst _temp21 = require(\"../intl/pl-PL.json\");\nconst _temp22 = require(\"../intl/pt-BR.json\");\nconst _temp23 = require(\"../intl/pt-PT.json\");\nconst _temp24 = require(\"../intl/ro-RO.json\");\nconst _temp25 = require(\"../intl/ru-RU.json\");\nconst _temp26 = require(\"../intl/sk-SK.json\");\nconst _temp27 = require(\"../intl/sl-SI.json\");\nconst _temp28 = require(\"../intl/sr-SP.json\");\nconst _temp29 = require(\"../intl/sv-SE.json\");\nconst _temp30 = require(\"../intl/tr-TR.json\");\nconst _temp31 = require(\"../intl/uk-UA.json\");\nconst _temp32 = require(\"../intl/zh-CN.json\");\nconst _temp33 = require(\"../intl/zh-TW.json\");\nmodule.exports = {\n \"ar-AE\": _temp0,\n \"bg-BG\": _temp1,\n \"cs-CZ\": _temp2,\n \"da-DK\": _temp3,\n \"de-DE\": _temp4,\n \"el-GR\": _temp5,\n \"en-US\": _temp6,\n \"es-ES\": _temp7,\n \"et-EE\": _temp8,\n \"fi-FI\": _temp9,\n \"fr-FR\": _temp10,\n \"he-IL\": _temp11,\n \"hr-HR\": _temp12,\n \"hu-HU\": _temp13,\n \"it-IT\": _temp14,\n \"ja-JP\": _temp15,\n \"ko-KR\": _temp16,\n \"lt-LT\": _temp17,\n \"lv-LV\": _temp18,\n \"nb-NO\": _temp19,\n \"nl-NL\": _temp20,\n \"pl-PL\": _temp21,\n \"pt-BR\": _temp22,\n \"pt-PT\": _temp23,\n \"ro-RO\": _temp24,\n \"ru-RU\": _temp25,\n \"sk-SK\": _temp26,\n \"sl-SI\": _temp27,\n \"sr-SP\": _temp28,\n \"sv-SE\": _temp29,\n \"tr-TR\": _temp30,\n \"uk-UA\": _temp31,\n \"zh-CN\": _temp32,\n \"zh-TW\": _temp33\n}","{\n \"close\": \"إغلاق\",\n \"notifications\": \"إشعارات\"\n}\n","{\n \"close\": \"Затвори\",\n \"notifications\": \"Известия\"\n}\n","{\n \"close\": \"Zavřít\",\n \"notifications\": \"Upozornění\"\n}\n","{\n \"close\": \"Luk\",\n \"notifications\": \"Påmindelser\"\n}\n","{\n \"close\": \"Schließen\",\n \"notifications\": \"Benachrichtigungen\"\n}\n","{\n \"close\": \"Κλείσιμο\",\n \"notifications\": \"Ειδοποιήσεις\"\n}\n","{\n \"close\": \"Close\",\n \"notifications\": \"Notifications\"\n}\n","{\n \"close\": \"Cerrar\",\n \"notifications\": \"Notificaciones\"\n}\n","{\n \"close\": \"Sule\",\n \"notifications\": \"Teated\"\n}\n","{\n \"close\": \"Sulje\",\n \"notifications\": \"Ilmoitukset\"\n}\n","{\n \"close\": \"Fermer\",\n \"notifications\": \"Notifications\"\n}\n","{\n \"close\": \"סגור\",\n \"notifications\": \"התראות\"\n}\n","{\n \"close\": \"Zatvori\",\n \"notifications\": \"Obavijesti\"\n}\n","{\n \"close\": \"Bezárás\",\n \"notifications\": \"Értesítések\"\n}\n","{\n \"close\": \"Chiudi\",\n \"notifications\": \"Notifiche\"\n}\n","{\n \"close\": \"閉じる\",\n \"notifications\": \"通知\"\n}\n","{\n \"close\": \"닫기\",\n \"notifications\": \"알림\"\n}\n","{\n \"close\": \"Uždaryti\",\n \"notifications\": \"Pranešimai\"\n}\n","{\n \"close\": \"Aizvērt\",\n \"notifications\": \"Paziņojumi\"\n}\n","{\n \"close\": \"Lukk\",\n \"notifications\": \"Varsler\"\n}\n","{\n \"close\": \"Sluiten\",\n \"notifications\": \"Meldingen\"\n}\n","{\n \"close\": \"Zamknij\",\n \"notifications\": \"Powiadomienia\"\n}\n","{\n \"close\": \"Fechar\",\n \"notifications\": \"Notificações\"\n}\n","{\n \"close\": \"Fechar\",\n \"notifications\": \"Notificações\"\n}\n","{\n \"close\": \"Închideţi\",\n \"notifications\": \"Notificări\"\n}\n","{\n \"close\": \"Закрыть\",\n \"notifications\": \"Уведомления\"\n}\n","{\n \"close\": \"Zatvoriť\",\n \"notifications\": \"Oznámenia\"\n}\n","{\n \"close\": \"Zapri\",\n \"notifications\": \"Obvestila\"\n}\n","{\n \"close\": \"Zatvori\",\n \"notifications\": \"Obaveštenja\"\n}\n","{\n \"close\": \"Stäng\",\n \"notifications\": \"Aviseringar\"\n}\n","{\n \"close\": \"Kapat\",\n \"notifications\": \"Bildirimler\"\n}\n","{\n \"close\": \"Закрити\",\n \"notifications\": \"Сповіщення\"\n}\n","{\n \"close\": \"关闭\",\n \"notifications\": \"通知\"\n}\n","{\n \"close\": \"關閉\",\n \"notifications\": \"通知\"\n}\n","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);\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":"module.js.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-aria/toast",
|
|
3
|
-
"version": "3.0.0-nightly.
|
|
3
|
+
"version": "3.0.0-nightly.2453+e79cff031",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -22,13 +22,13 @@
|
|
|
22
22
|
"url": "https://github.com/adobe/react-spectrum"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@react-aria/i18n": "3.0.0-nightly.
|
|
26
|
-
"@react-aria/interactions": "3.0.0-nightly.
|
|
27
|
-
"@react-aria/landmark": "3.0.0-nightly.
|
|
28
|
-
"@react-aria/utils": "3.0.0-nightly.
|
|
29
|
-
"@react-stately/toast": "3.0.0-nightly.
|
|
30
|
-
"@react-types/button": "3.8.1-nightly.
|
|
31
|
-
"@react-types/shared": "3.0.0-nightly.
|
|
25
|
+
"@react-aria/i18n": "3.0.0-nightly.2453+e79cff031",
|
|
26
|
+
"@react-aria/interactions": "3.0.0-nightly.2453+e79cff031",
|
|
27
|
+
"@react-aria/landmark": "3.0.0-nightly.4162+e79cff031",
|
|
28
|
+
"@react-aria/utils": "3.0.0-nightly.2453+e79cff031",
|
|
29
|
+
"@react-stately/toast": "3.0.0-nightly.4162+e79cff031",
|
|
30
|
+
"@react-types/button": "3.8.1-nightly.4162+e79cff031",
|
|
31
|
+
"@react-types/shared": "3.0.0-nightly.2453+e79cff031",
|
|
32
32
|
"@swc/helpers": "^0.5.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"publishConfig": {
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "e79cff031ecf3cea7242daddf308625d638fd056"
|
|
41
41
|
}
|