react-aria-components 1.6.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/Autocomplete.main.js +23 -12
- package/dist/Autocomplete.main.js.map +1 -1
- package/dist/Autocomplete.mjs +23 -12
- package/dist/Autocomplete.module.js +23 -12
- package/dist/Autocomplete.module.js.map +1 -1
- package/dist/Checkbox.main.js +1 -1
- package/dist/Checkbox.main.js.map +1 -1
- package/dist/Checkbox.mjs +1 -1
- package/dist/Checkbox.module.js +1 -1
- package/dist/Checkbox.module.js.map +1 -1
- package/dist/Collection.main.js.map +1 -1
- package/dist/Collection.module.js.map +1 -1
- package/dist/ColorArea.main.js +4 -4
- package/dist/ColorArea.main.js.map +1 -1
- package/dist/ColorArea.mjs +2 -2
- package/dist/ColorArea.module.js +2 -2
- package/dist/ColorArea.module.js.map +1 -1
- package/dist/ColorField.main.js +8 -10
- package/dist/ColorField.main.js.map +1 -1
- package/dist/ColorField.mjs +4 -6
- package/dist/ColorField.module.js +4 -6
- package/dist/ColorField.module.js.map +1 -1
- package/dist/ColorPicker.main.js +2 -2
- package/dist/ColorPicker.main.js.map +1 -1
- package/dist/ColorPicker.mjs +1 -1
- package/dist/ColorPicker.module.js +1 -1
- package/dist/ColorPicker.module.js.map +1 -1
- package/dist/ColorSlider.main.js +5 -7
- package/dist/ColorSlider.main.js.map +1 -1
- package/dist/ColorSlider.mjs +3 -5
- package/dist/ColorSlider.module.js +3 -5
- package/dist/ColorSlider.module.js.map +1 -1
- package/dist/ColorSwatch.main.js +2 -2
- package/dist/ColorSwatch.main.js.map +1 -1
- package/dist/ColorSwatch.mjs +1 -1
- package/dist/ColorSwatch.module.js +1 -1
- package/dist/ColorSwatch.module.js.map +1 -1
- package/dist/ColorSwatchPicker.main.js +3 -3
- package/dist/ColorSwatchPicker.main.js.map +1 -1
- package/dist/ColorSwatchPicker.mjs +1 -1
- package/dist/ColorSwatchPicker.module.js +1 -1
- package/dist/ColorSwatchPicker.module.js.map +1 -1
- package/dist/ColorThumb.main.js +2 -6
- package/dist/ColorThumb.main.js.map +1 -1
- package/dist/ColorThumb.mjs +1 -5
- package/dist/ColorThumb.module.js +1 -5
- package/dist/ColorThumb.module.js.map +1 -1
- package/dist/ColorWheel.main.js +4 -4
- package/dist/ColorWheel.main.js.map +1 -1
- package/dist/ColorWheel.mjs +2 -2
- package/dist/ColorWheel.module.js +2 -2
- package/dist/ColorWheel.module.js.map +1 -1
- package/dist/ComboBox.main.js +1 -1
- package/dist/ComboBox.main.js.map +1 -1
- package/dist/ComboBox.mjs +1 -1
- package/dist/ComboBox.module.js +1 -1
- package/dist/ComboBox.module.js.map +1 -1
- package/dist/DateField.main.js +4 -3
- package/dist/DateField.main.js.map +1 -1
- package/dist/DateField.mjs +4 -3
- package/dist/DateField.module.js +4 -3
- package/dist/DateField.module.js.map +1 -1
- package/dist/DatePicker.main.js +2 -2
- package/dist/DatePicker.main.js.map +1 -1
- package/dist/DatePicker.mjs +2 -2
- package/dist/DatePicker.module.js +2 -2
- package/dist/DatePicker.module.js.map +1 -1
- package/dist/Dialog.main.js +2 -1
- package/dist/Dialog.main.js.map +1 -1
- package/dist/Dialog.mjs +2 -1
- package/dist/Dialog.module.js +2 -1
- package/dist/Dialog.module.js.map +1 -1
- package/dist/Disclosure.main.js +5 -7
- package/dist/Disclosure.main.js.map +1 -1
- package/dist/Disclosure.mjs +2 -4
- package/dist/Disclosure.module.js +2 -4
- package/dist/Disclosure.module.js.map +1 -1
- package/dist/DropZone.main.js +1 -3
- package/dist/DropZone.main.js.map +1 -1
- package/dist/DropZone.mjs +1 -3
- package/dist/DropZone.module.js +1 -3
- package/dist/DropZone.module.js.map +1 -1
- package/dist/GridList.main.js.map +1 -1
- package/dist/GridList.module.js.map +1 -1
- package/dist/Group.main.js.map +1 -1
- package/dist/Group.module.js.map +1 -1
- package/dist/ListBox.main.js +17 -16
- package/dist/ListBox.main.js.map +1 -1
- package/dist/ListBox.mjs +19 -18
- package/dist/ListBox.module.js +19 -18
- package/dist/ListBox.module.js.map +1 -1
- package/dist/Menu.main.js +39 -24
- package/dist/Menu.main.js.map +1 -1
- package/dist/Menu.mjs +40 -25
- package/dist/Menu.module.js +40 -25
- package/dist/Menu.module.js.map +1 -1
- package/dist/Meter.main.js +1 -1
- package/dist/Meter.main.js.map +1 -1
- package/dist/Meter.mjs +1 -1
- package/dist/Meter.module.js +1 -1
- package/dist/Meter.module.js.map +1 -1
- package/dist/NumberField.main.js +4 -2
- package/dist/NumberField.main.js.map +1 -1
- package/dist/NumberField.mjs +4 -2
- package/dist/NumberField.module.js +4 -2
- package/dist/NumberField.module.js.map +1 -1
- package/dist/Popover.main.js +67 -15
- package/dist/Popover.main.js.map +1 -1
- package/dist/Popover.mjs +69 -17
- package/dist/Popover.module.js +69 -17
- package/dist/Popover.module.js.map +1 -1
- package/dist/ProgressBar.main.js +1 -1
- package/dist/ProgressBar.main.js.map +1 -1
- package/dist/ProgressBar.mjs +1 -1
- package/dist/ProgressBar.module.js +1 -1
- package/dist/ProgressBar.module.js.map +1 -1
- package/dist/RadioGroup.main.js +1 -1
- package/dist/RadioGroup.main.js.map +1 -1
- package/dist/RadioGroup.mjs +1 -1
- package/dist/RadioGroup.module.js +1 -1
- package/dist/RadioGroup.module.js.map +1 -1
- package/dist/SearchField.main.js +4 -2
- package/dist/SearchField.main.js.map +1 -1
- package/dist/SearchField.mjs +5 -3
- package/dist/SearchField.module.js +5 -3
- package/dist/SearchField.module.js.map +1 -1
- package/dist/Select.main.js +3 -2
- package/dist/Select.main.js.map +1 -1
- package/dist/Select.mjs +3 -2
- package/dist/Select.module.js +3 -2
- package/dist/Select.module.js.map +1 -1
- package/dist/Slider.main.js +2 -2
- package/dist/Slider.main.js.map +1 -1
- package/dist/Slider.mjs +2 -2
- package/dist/Slider.module.js +2 -2
- package/dist/Slider.module.js.map +1 -1
- package/dist/Table.main.js +15 -6
- package/dist/Table.main.js.map +1 -1
- package/dist/Table.mjs +15 -6
- package/dist/Table.module.js +15 -6
- package/dist/Table.module.js.map +1 -1
- package/dist/TableLayout.main.js.map +1 -1
- package/dist/TableLayout.module.js.map +1 -1
- package/dist/Tabs.main.js +3 -2
- package/dist/Tabs.main.js.map +1 -1
- package/dist/Tabs.mjs +4 -3
- package/dist/Tabs.module.js +4 -3
- package/dist/Tabs.module.js.map +1 -1
- package/dist/TagGroup.main.js +1 -1
- package/dist/TagGroup.main.js.map +1 -1
- package/dist/TagGroup.mjs +1 -1
- package/dist/TagGroup.module.js +1 -1
- package/dist/TagGroup.module.js.map +1 -1
- package/dist/TextField.main.js +4 -2
- package/dist/TextField.main.js.map +1 -1
- package/dist/TextField.mjs +5 -3
- package/dist/TextField.module.js +5 -3
- package/dist/TextField.module.js.map +1 -1
- package/dist/Toast.main.js +148 -0
- package/dist/Toast.main.js.map +1 -0
- package/dist/Toast.mjs +137 -0
- package/dist/Toast.module.js +137 -0
- package/dist/Toast.module.js.map +1 -0
- package/dist/Tree.main.js +38 -34
- package/dist/Tree.main.js.map +1 -1
- package/dist/Tree.mjs +34 -30
- package/dist/Tree.module.js +34 -30
- package/dist/Tree.module.js.map +1 -1
- package/dist/Virtualizer.main.js +4 -1
- package/dist/Virtualizer.main.js.map +1 -1
- package/dist/Virtualizer.mjs +4 -1
- package/dist/Virtualizer.module.js +4 -1
- package/dist/Virtualizer.module.js.map +1 -1
- package/dist/import.mjs +9 -7
- package/dist/main.js +31 -17
- package/dist/main.js.map +1 -1
- package/dist/module.js +9 -7
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +159 -59
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.main.js +9 -7
- package/dist/utils.main.js.map +1 -1
- package/dist/utils.mjs +9 -7
- package/dist/utils.module.js +9 -7
- package/dist/utils.module.js.map +1 -1
- package/i18n/index.js +1 -1
- package/i18n/index.mjs +1 -1
- package/package.json +25 -30
- package/src/Autocomplete.tsx +19 -15
- package/src/Checkbox.tsx +3 -1
- package/src/Collection.tsx +2 -2
- package/src/ColorArea.tsx +2 -3
- package/src/ColorField.tsx +8 -6
- package/src/ColorPicker.tsx +1 -2
- package/src/ColorSlider.tsx +5 -5
- package/src/ColorSwatch.tsx +2 -2
- package/src/ColorSwatchPicker.tsx +1 -1
- package/src/ColorThumb.tsx +2 -4
- package/src/ColorWheel.tsx +2 -2
- package/src/ComboBox.tsx +3 -1
- package/src/DateField.tsx +8 -3
- package/src/DatePicker.tsx +6 -2
- package/src/Dialog.tsx +6 -2
- package/src/Disclosure.tsx +2 -3
- package/src/DropZone.tsx +1 -2
- package/src/GridList.tsx +5 -0
- package/src/Group.tsx +1 -0
- package/src/ListBox.tsx +11 -9
- package/src/Menu.tsx +53 -25
- package/src/Meter.tsx +3 -1
- package/src/NumberField.tsx +11 -2
- package/src/Popover.tsx +77 -25
- package/src/ProgressBar.tsx +3 -1
- package/src/RadioGroup.tsx +3 -1
- package/src/SearchField.tsx +6 -4
- package/src/Select.tsx +5 -2
- package/src/Slider.tsx +6 -2
- package/src/Table.tsx +35 -15
- package/src/TableLayout.ts +1 -1
- package/src/Tabs.tsx +6 -3
- package/src/TagGroup.tsx +3 -1
- package/src/TextField.tsx +6 -4
- package/src/Toast.tsx +184 -0
- package/src/Tree.tsx +67 -49
- package/src/Virtualizer.tsx +18 -3
- package/src/index.ts +16 -16
- package/src/utils.tsx +8 -10
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
var $b856e6788a7ea5bf$exports = require("./Button.main.js");
|
|
2
|
+
var $c5ccf687772c0422$exports = require("./utils.main.js");
|
|
3
|
+
var $a8a589c28affdc40$exports = require("./Text.main.js");
|
|
4
|
+
var $coXVq$reactaria = require("react-aria");
|
|
5
|
+
var $coXVq$reactdom = require("react-dom");
|
|
6
|
+
var $coXVq$reactstately = require("react-stately");
|
|
7
|
+
var $coXVq$react = require("react");
|
|
8
|
+
var $coXVq$reactariautils = require("@react-aria/utils");
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
function $parcel$interopDefault(a) {
|
|
12
|
+
return a && a.__esModule ? a.default : a;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function $parcel$export(e, n, v, s) {
|
|
16
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
$parcel$export(module.exports, "ToastRegion", () => $4e3fafb90a1b5a5f$export$2cbf5519fbeaa538);
|
|
20
|
+
$parcel$export(module.exports, "Toast", () => $4e3fafb90a1b5a5f$export$8d8dc7d5f743331b);
|
|
21
|
+
$parcel$export(module.exports, "ToastContent", () => $4e3fafb90a1b5a5f$export$b134a6cc89b08851);
|
|
22
|
+
/*
|
|
23
|
+
* Copyright 2025 Adobe. All rights reserved.
|
|
24
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
25
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
26
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
27
|
+
*
|
|
28
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
29
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
30
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
31
|
+
* governing permissions and limitations under the License.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
const $4e3fafb90a1b5a5f$var$ToastStateContext = /*#__PURE__*/ (0, $coXVq$react.createContext)(null);
|
|
41
|
+
const $4e3fafb90a1b5a5f$export$2cbf5519fbeaa538 = /*#__PURE__*/ (0, $coXVq$react.forwardRef)(function ToastRegion(props, ref) {
|
|
42
|
+
let state = (0, $coXVq$reactstately.useToastQueue)(props.queue);
|
|
43
|
+
let objectRef = (0, $coXVq$reactariautils.useObjectRef)(ref);
|
|
44
|
+
let { regionProps: regionProps } = (0, $coXVq$reactaria.useToastRegion)(props, state, objectRef);
|
|
45
|
+
let { focusProps: focusProps, isFocused: isFocused, isFocusVisible: isFocusVisible } = (0, $coXVq$reactaria.useFocusRing)();
|
|
46
|
+
let renderProps = (0, $c5ccf687772c0422$exports.useRenderProps)({
|
|
47
|
+
...props,
|
|
48
|
+
children: undefined,
|
|
49
|
+
defaultClassName: 'react-aria-ToastRegion',
|
|
50
|
+
values: {
|
|
51
|
+
visibleToasts: state.visibleToasts,
|
|
52
|
+
isFocused: isFocused,
|
|
53
|
+
isFocusVisible: isFocusVisible
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
let region = /*#__PURE__*/ (0, ($parcel$interopDefault($coXVq$react))).createElement($4e3fafb90a1b5a5f$var$ToastStateContext.Provider, {
|
|
57
|
+
value: state
|
|
58
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($coXVq$react))).createElement("div", {
|
|
59
|
+
...renderProps,
|
|
60
|
+
...(0, $coXVq$reactaria.mergeProps)(regionProps, focusProps),
|
|
61
|
+
ref: objectRef,
|
|
62
|
+
"data-focused": isFocused || undefined,
|
|
63
|
+
"data-focus-visible": isFocusVisible || undefined
|
|
64
|
+
}, typeof props.children === 'function' ? /*#__PURE__*/ (0, ($parcel$interopDefault($coXVq$react))).createElement($4e3fafb90a1b5a5f$var$ToastList, {
|
|
65
|
+
...props,
|
|
66
|
+
style: {
|
|
67
|
+
display: 'contents'
|
|
68
|
+
}
|
|
69
|
+
}) : props.children));
|
|
70
|
+
return state.visibleToasts.length > 0 && typeof document !== 'undefined' ? /*#__PURE__*/ (0, $coXVq$reactdom.createPortal)(region, document.body) : null;
|
|
71
|
+
});
|
|
72
|
+
// TODO: possibly export this so additional children can be added to the region, outside the list.
|
|
73
|
+
const $4e3fafb90a1b5a5f$var$ToastList = /*#__PURE__*/ (0, $coXVq$react.forwardRef)(function ToastList(props, ref) {
|
|
74
|
+
let state = (0, $coXVq$react.useContext)($4e3fafb90a1b5a5f$var$ToastStateContext);
|
|
75
|
+
return(// @ts-ignore
|
|
76
|
+
/*#__PURE__*/ (0, ($parcel$interopDefault($coXVq$react))).createElement("ol", {
|
|
77
|
+
ref: ref,
|
|
78
|
+
style: props.style,
|
|
79
|
+
className: props.className
|
|
80
|
+
}, state.visibleToasts.map((toast)=>/*#__PURE__*/ (0, ($parcel$interopDefault($coXVq$react))).createElement("li", {
|
|
81
|
+
key: toast.key,
|
|
82
|
+
style: {
|
|
83
|
+
display: 'contents'
|
|
84
|
+
}
|
|
85
|
+
}, props.children({
|
|
86
|
+
toast: toast
|
|
87
|
+
})))));
|
|
88
|
+
});
|
|
89
|
+
const $4e3fafb90a1b5a5f$export$8d8dc7d5f743331b = /*#__PURE__*/ (0, $coXVq$react.forwardRef)(function Toast(props, ref) {
|
|
90
|
+
let state = (0, $coXVq$react.useContext)($4e3fafb90a1b5a5f$var$ToastStateContext);
|
|
91
|
+
let objectRef = (0, $coXVq$reactariautils.useObjectRef)(ref);
|
|
92
|
+
let { toastProps: toastProps, contentProps: contentProps, titleProps: titleProps, descriptionProps: descriptionProps, closeButtonProps: closeButtonProps } = (0, $coXVq$reactaria.useToast)(props, state, objectRef);
|
|
93
|
+
let { focusProps: focusProps, isFocused: isFocused, isFocusVisible: isFocusVisible } = (0, $coXVq$reactaria.useFocusRing)();
|
|
94
|
+
let renderProps = (0, $c5ccf687772c0422$exports.useRenderProps)({
|
|
95
|
+
...props,
|
|
96
|
+
defaultClassName: 'react-aria-Toast',
|
|
97
|
+
values: {
|
|
98
|
+
toast: props.toast,
|
|
99
|
+
isFocused: isFocused,
|
|
100
|
+
isFocusVisible: isFocusVisible
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($coXVq$react))).createElement("div", {
|
|
104
|
+
...renderProps,
|
|
105
|
+
...(0, $coXVq$reactaria.mergeProps)(toastProps, focusProps),
|
|
106
|
+
ref: objectRef,
|
|
107
|
+
"data-focused": isFocused || undefined,
|
|
108
|
+
"data-focus-visible": isFocusVisible || undefined
|
|
109
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($coXVq$react))).createElement((0, $c5ccf687772c0422$exports.Provider), {
|
|
110
|
+
values: [
|
|
111
|
+
[
|
|
112
|
+
$4e3fafb90a1b5a5f$export$3a0d85872d9f73f2,
|
|
113
|
+
contentProps
|
|
114
|
+
],
|
|
115
|
+
[
|
|
116
|
+
(0, $a8a589c28affdc40$exports.TextContext),
|
|
117
|
+
{
|
|
118
|
+
slots: {
|
|
119
|
+
[(0, $c5ccf687772c0422$exports.DEFAULT_SLOT)]: {},
|
|
120
|
+
title: titleProps,
|
|
121
|
+
description: descriptionProps
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
],
|
|
125
|
+
[
|
|
126
|
+
(0, $b856e6788a7ea5bf$exports.ButtonContext),
|
|
127
|
+
{
|
|
128
|
+
slots: {
|
|
129
|
+
[(0, $c5ccf687772c0422$exports.DEFAULT_SLOT)]: {},
|
|
130
|
+
close: closeButtonProps
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
]
|
|
134
|
+
]
|
|
135
|
+
}, renderProps.children));
|
|
136
|
+
});
|
|
137
|
+
const $4e3fafb90a1b5a5f$export$3a0d85872d9f73f2 = /*#__PURE__*/ (0, $coXVq$react.createContext)({});
|
|
138
|
+
const $4e3fafb90a1b5a5f$export$b134a6cc89b08851 = /*#__PURE__*/ (0, $coXVq$react.forwardRef)(function ToastContent(props, ref) {
|
|
139
|
+
[props, ref] = (0, $c5ccf687772c0422$exports.useContextProps)(props, ref, $4e3fafb90a1b5a5f$export$3a0d85872d9f73f2);
|
|
140
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($coXVq$react))).createElement("div", {
|
|
141
|
+
className: "react-aria-ToastContent",
|
|
142
|
+
...props,
|
|
143
|
+
ref: ref
|
|
144
|
+
}, props.children);
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
//# sourceMappingURL=Toast.main.js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,CAAC;wBACjB,OAAO;oBACT;gBACF;aAAE;SACH;OACA,YAAY,QAAQ;AAI7B;AAEO,MAAM,0DAAsB,CAAA,GAAA,0BAAY,EAA6D,CAAC;AAKtG,MAAM,4CAAe,WAAW,GAAG,CAAA,GAAA,uBAAS,EAAE,SAAS,aAAa,KAAkC,EAAE,GAAiC;IAC9I,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,qBACE,0DAAC;QAAI,WAAU;QAA2B,GAAG,KAAK;QAAE,KAAK;OACtD,MAAM,QAAQ;AAGrB","sources":["packages/react-aria-components/src/Toast.tsx"],"sourcesContent":["/*\n * Copyright 2025 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 {AriaToastProps, AriaToastRegionProps, mergeProps, useFocusRing, useToast, useToastRegion} from 'react-aria';\nimport {ButtonContext} from './Button';\nimport {ContextValue, DEFAULT_SLOT, Provider, RenderProps, StyleRenderProps, useContextProps, useRenderProps} from './utils';\nimport {createPortal} from 'react-dom';\nimport {forwardRefType} from '@react-types/shared';\nimport {QueuedToast, ToastQueue, ToastState, useToastQueue} from 'react-stately';\nimport React, {createContext, ForwardedRef, forwardRef, HTMLAttributes, JSX, ReactElement, useContext} from 'react';\nimport {TextContext} from './Text';\nimport {useObjectRef} from '@react-aria/utils';\n\nconst ToastStateContext = createContext<ToastState<any> | null>(null);\n\nexport interface ToastRegionRenderProps<T> {\n /** A list of all currently visible toasts. */\n visibleToasts: QueuedToast<T>[],\n /**\n * Whether the toast region is currently focused.\n * @selector [data-focused]\n */\n isFocused: boolean,\n /**\n * Whether the toast region is keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean\n}\n\nexport interface ToastRegionProps<T> extends AriaToastRegionProps, StyleRenderProps<ToastRegionRenderProps<T>> {\n /** The queue of toasts to display. */\n queue: ToastQueue<T>,\n /** A function to render each toast. */\n children: (renderProps: {toast: QueuedToast<T>}) => ReactElement\n}\n\n/**\n * A ToastRegion displays one or more toast notifications.\n */\nexport const ToastRegion = /*#__PURE__*/ (forwardRef as forwardRefType)(function ToastRegion<T>(props: ToastRegionProps<T>, ref: ForwardedRef<HTMLDivElement>): JSX.Element | null {\n let state = useToastQueue(props.queue);\n let objectRef = useObjectRef(ref);\n let {regionProps} = useToastRegion(props, state, objectRef);\n\n let {focusProps, isFocused, isFocusVisible} = useFocusRing();\n let renderProps = useRenderProps({\n ...props,\n children: undefined,\n defaultClassName: 'react-aria-ToastRegion',\n values: {\n visibleToasts: state.visibleToasts,\n isFocused,\n isFocusVisible\n }\n });\n\n let region = (\n <ToastStateContext.Provider value={state}>\n <div\n {...renderProps}\n {...mergeProps(regionProps, focusProps)}\n ref={objectRef}\n data-focused={isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined}>\n {typeof props.children === 'function' ? <ToastList {...props} style={{display: 'contents'}} /> : props.children}\n </div>\n </ToastStateContext.Provider>\n );\n\n return state.visibleToasts.length > 0 && typeof document !== 'undefined'\n ? createPortal(region, document.body)\n : null;\n});\n\n// TODO: possibly export this so additional children can be added to the region, outside the list.\nconst ToastList = /*#__PURE__*/ (forwardRef as forwardRefType)(function ToastList<T>(props: ToastRegionProps<T>, ref: ForwardedRef<HTMLOListElement>) {\n let state = useContext(ToastStateContext)!;\n return (\n // @ts-ignore\n <ol ref={ref} style={props.style} className={props.className}>\n {state.visibleToasts.map((toast) => (\n <li key={toast.key} style={{display: 'contents'}}>\n {props.children({toast})}\n </li>\n ))}\n </ol>\n );\n});\n\nexport interface ToastRenderProps<T> {\n /**\n * The toast object to display.\n */\n toast: QueuedToast<T>,\n /**\n * Whether the toast is currently focused.\n * @selector [data-focused]\n */\n isFocused: boolean,\n /**\n * Whether the toast is keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean\n}\n\nexport interface ToastProps<T> extends AriaToastProps<T>, RenderProps<ToastRenderProps<T>> {}\n\n/**\n * A Toast displays a brief, temporary notification of actions, errors, or other events in an application.\n */\nexport const Toast = /*#__PURE__*/ (forwardRef as forwardRefType)(function Toast<T>(props: ToastProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n let state = useContext(ToastStateContext)!;\n let objectRef = useObjectRef(ref);\n let {toastProps, contentProps, titleProps, descriptionProps, closeButtonProps} = useToast(\n props,\n state,\n objectRef\n );\n\n let {focusProps, isFocused, isFocusVisible} = useFocusRing();\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Toast',\n values: {\n toast: props.toast,\n isFocused,\n isFocusVisible\n }\n });\n\n return (\n <div\n {...renderProps}\n {...mergeProps(toastProps, focusProps)}\n ref={objectRef}\n data-focused={isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined}>\n <Provider\n values={[\n [ToastContentContext, contentProps],\n [TextContext, {\n slots: {\n [DEFAULT_SLOT]: {},\n title: titleProps,\n description: descriptionProps\n }\n }],\n [ButtonContext, {\n slots: {\n [DEFAULT_SLOT]: {},\n close: closeButtonProps\n }\n }]\n ]}>\n {renderProps.children}\n </Provider>\n </div>\n );\n});\n\nexport const ToastContentContext = createContext<ContextValue<HTMLAttributes<HTMLElement>, HTMLDivElement>>({});\n\n/**\n * ToastContent wraps the main content of a toast notification.\n */\nexport const ToastContent = /*#__PURE__*/ forwardRef(function ToastContent(props: HTMLAttributes<HTMLElement>, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, ToastContentContext);\n return (\n <div className=\"react-aria-ToastContent\" {...props} ref={ref}>\n {props.children}\n </div>\n );\n});\n"],"names":[],"version":3,"file":"Toast.main.js.map"}
|
package/dist/Toast.mjs
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import {ButtonContext as $d2b4bc8c273e7be6$export$24d547caef80ccd1} from "./Button.mjs";
|
|
2
|
+
import {DEFAULT_SLOT as $64fa3d84918910a7$export$c62b8e45d58ddad9, Provider as $64fa3d84918910a7$export$2881499e37b75b9a, useContextProps as $64fa3d84918910a7$export$29f1550f4b0d4415, useRenderProps as $64fa3d84918910a7$export$4d86445c2cf5e3} from "./utils.mjs";
|
|
3
|
+
import {TextContext as $514c0188e459b4c0$export$9afb8bc826b033ea} from "./Text.mjs";
|
|
4
|
+
import {useToastRegion as $9il6O$useToastRegion, useFocusRing as $9il6O$useFocusRing, mergeProps as $9il6O$mergeProps, useToast as $9il6O$useToast} from "react-aria";
|
|
5
|
+
import {createPortal as $9il6O$createPortal} from "react-dom";
|
|
6
|
+
import {useToastQueue as $9il6O$useToastQueue} from "react-stately";
|
|
7
|
+
import $9il6O$react, {createContext as $9il6O$createContext, forwardRef as $9il6O$forwardRef, useContext as $9il6O$useContext} from "react";
|
|
8
|
+
import {useObjectRef as $9il6O$useObjectRef} from "@react-aria/utils";
|
|
9
|
+
|
|
10
|
+
/*
|
|
11
|
+
* Copyright 2025 Adobe. All rights reserved.
|
|
12
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
13
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
14
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
+
*
|
|
16
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
17
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
18
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
19
|
+
* governing permissions and limitations under the License.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
const $692df8403b6ac2c7$var$ToastStateContext = /*#__PURE__*/ (0, $9il6O$createContext)(null);
|
|
29
|
+
const $692df8403b6ac2c7$export$2cbf5519fbeaa538 = /*#__PURE__*/ (0, $9il6O$forwardRef)(function ToastRegion(props, ref) {
|
|
30
|
+
let state = (0, $9il6O$useToastQueue)(props.queue);
|
|
31
|
+
let objectRef = (0, $9il6O$useObjectRef)(ref);
|
|
32
|
+
let { regionProps: regionProps } = (0, $9il6O$useToastRegion)(props, state, objectRef);
|
|
33
|
+
let { focusProps: focusProps, isFocused: isFocused, isFocusVisible: isFocusVisible } = (0, $9il6O$useFocusRing)();
|
|
34
|
+
let renderProps = (0, $64fa3d84918910a7$export$4d86445c2cf5e3)({
|
|
35
|
+
...props,
|
|
36
|
+
children: undefined,
|
|
37
|
+
defaultClassName: 'react-aria-ToastRegion',
|
|
38
|
+
values: {
|
|
39
|
+
visibleToasts: state.visibleToasts,
|
|
40
|
+
isFocused: isFocused,
|
|
41
|
+
isFocusVisible: isFocusVisible
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
let region = /*#__PURE__*/ (0, $9il6O$react).createElement($692df8403b6ac2c7$var$ToastStateContext.Provider, {
|
|
45
|
+
value: state
|
|
46
|
+
}, /*#__PURE__*/ (0, $9il6O$react).createElement("div", {
|
|
47
|
+
...renderProps,
|
|
48
|
+
...(0, $9il6O$mergeProps)(regionProps, focusProps),
|
|
49
|
+
ref: objectRef,
|
|
50
|
+
"data-focused": isFocused || undefined,
|
|
51
|
+
"data-focus-visible": isFocusVisible || undefined
|
|
52
|
+
}, typeof props.children === 'function' ? /*#__PURE__*/ (0, $9il6O$react).createElement($692df8403b6ac2c7$var$ToastList, {
|
|
53
|
+
...props,
|
|
54
|
+
style: {
|
|
55
|
+
display: 'contents'
|
|
56
|
+
}
|
|
57
|
+
}) : props.children));
|
|
58
|
+
return state.visibleToasts.length > 0 && typeof document !== 'undefined' ? /*#__PURE__*/ (0, $9il6O$createPortal)(region, document.body) : null;
|
|
59
|
+
});
|
|
60
|
+
// TODO: possibly export this so additional children can be added to the region, outside the list.
|
|
61
|
+
const $692df8403b6ac2c7$var$ToastList = /*#__PURE__*/ (0, $9il6O$forwardRef)(function ToastList(props, ref) {
|
|
62
|
+
let state = (0, $9il6O$useContext)($692df8403b6ac2c7$var$ToastStateContext);
|
|
63
|
+
return(// @ts-ignore
|
|
64
|
+
/*#__PURE__*/ (0, $9il6O$react).createElement("ol", {
|
|
65
|
+
ref: ref,
|
|
66
|
+
style: props.style,
|
|
67
|
+
className: props.className
|
|
68
|
+
}, state.visibleToasts.map((toast)=>/*#__PURE__*/ (0, $9il6O$react).createElement("li", {
|
|
69
|
+
key: toast.key,
|
|
70
|
+
style: {
|
|
71
|
+
display: 'contents'
|
|
72
|
+
}
|
|
73
|
+
}, props.children({
|
|
74
|
+
toast: toast
|
|
75
|
+
})))));
|
|
76
|
+
});
|
|
77
|
+
const $692df8403b6ac2c7$export$8d8dc7d5f743331b = /*#__PURE__*/ (0, $9il6O$forwardRef)(function Toast(props, ref) {
|
|
78
|
+
let state = (0, $9il6O$useContext)($692df8403b6ac2c7$var$ToastStateContext);
|
|
79
|
+
let objectRef = (0, $9il6O$useObjectRef)(ref);
|
|
80
|
+
let { toastProps: toastProps, contentProps: contentProps, titleProps: titleProps, descriptionProps: descriptionProps, closeButtonProps: closeButtonProps } = (0, $9il6O$useToast)(props, state, objectRef);
|
|
81
|
+
let { focusProps: focusProps, isFocused: isFocused, isFocusVisible: isFocusVisible } = (0, $9il6O$useFocusRing)();
|
|
82
|
+
let renderProps = (0, $64fa3d84918910a7$export$4d86445c2cf5e3)({
|
|
83
|
+
...props,
|
|
84
|
+
defaultClassName: 'react-aria-Toast',
|
|
85
|
+
values: {
|
|
86
|
+
toast: props.toast,
|
|
87
|
+
isFocused: isFocused,
|
|
88
|
+
isFocusVisible: isFocusVisible
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
return /*#__PURE__*/ (0, $9il6O$react).createElement("div", {
|
|
92
|
+
...renderProps,
|
|
93
|
+
...(0, $9il6O$mergeProps)(toastProps, focusProps),
|
|
94
|
+
ref: objectRef,
|
|
95
|
+
"data-focused": isFocused || undefined,
|
|
96
|
+
"data-focus-visible": isFocusVisible || undefined
|
|
97
|
+
}, /*#__PURE__*/ (0, $9il6O$react).createElement((0, $64fa3d84918910a7$export$2881499e37b75b9a), {
|
|
98
|
+
values: [
|
|
99
|
+
[
|
|
100
|
+
$692df8403b6ac2c7$export$3a0d85872d9f73f2,
|
|
101
|
+
contentProps
|
|
102
|
+
],
|
|
103
|
+
[
|
|
104
|
+
(0, $514c0188e459b4c0$export$9afb8bc826b033ea),
|
|
105
|
+
{
|
|
106
|
+
slots: {
|
|
107
|
+
[(0, $64fa3d84918910a7$export$c62b8e45d58ddad9)]: {},
|
|
108
|
+
title: titleProps,
|
|
109
|
+
description: descriptionProps
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
],
|
|
113
|
+
[
|
|
114
|
+
(0, $d2b4bc8c273e7be6$export$24d547caef80ccd1),
|
|
115
|
+
{
|
|
116
|
+
slots: {
|
|
117
|
+
[(0, $64fa3d84918910a7$export$c62b8e45d58ddad9)]: {},
|
|
118
|
+
close: closeButtonProps
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
]
|
|
122
|
+
]
|
|
123
|
+
}, renderProps.children));
|
|
124
|
+
});
|
|
125
|
+
const $692df8403b6ac2c7$export$3a0d85872d9f73f2 = /*#__PURE__*/ (0, $9il6O$createContext)({});
|
|
126
|
+
const $692df8403b6ac2c7$export$b134a6cc89b08851 = /*#__PURE__*/ (0, $9il6O$forwardRef)(function ToastContent(props, ref) {
|
|
127
|
+
[props, ref] = (0, $64fa3d84918910a7$export$29f1550f4b0d4415)(props, ref, $692df8403b6ac2c7$export$3a0d85872d9f73f2);
|
|
128
|
+
return /*#__PURE__*/ (0, $9il6O$react).createElement("div", {
|
|
129
|
+
className: "react-aria-ToastContent",
|
|
130
|
+
...props,
|
|
131
|
+
ref: ref
|
|
132
|
+
}, props.children);
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
export {$692df8403b6ac2c7$export$2cbf5519fbeaa538 as ToastRegion, $692df8403b6ac2c7$export$8d8dc7d5f743331b as Toast, $692df8403b6ac2c7$export$3a0d85872d9f73f2 as ToastContentContext, $692df8403b6ac2c7$export$b134a6cc89b08851 as ToastContent};
|
|
137
|
+
//# sourceMappingURL=Toast.module.js.map
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import {ButtonContext as $d2b4bc8c273e7be6$export$24d547caef80ccd1} from "./Button.module.js";
|
|
2
|
+
import {DEFAULT_SLOT as $64fa3d84918910a7$export$c62b8e45d58ddad9, Provider as $64fa3d84918910a7$export$2881499e37b75b9a, useContextProps as $64fa3d84918910a7$export$29f1550f4b0d4415, useRenderProps as $64fa3d84918910a7$export$4d86445c2cf5e3} from "./utils.module.js";
|
|
3
|
+
import {TextContext as $514c0188e459b4c0$export$9afb8bc826b033ea} from "./Text.module.js";
|
|
4
|
+
import {useToastRegion as $9il6O$useToastRegion, useFocusRing as $9il6O$useFocusRing, mergeProps as $9il6O$mergeProps, useToast as $9il6O$useToast} from "react-aria";
|
|
5
|
+
import {createPortal as $9il6O$createPortal} from "react-dom";
|
|
6
|
+
import {useToastQueue as $9il6O$useToastQueue} from "react-stately";
|
|
7
|
+
import $9il6O$react, {createContext as $9il6O$createContext, forwardRef as $9il6O$forwardRef, useContext as $9il6O$useContext} from "react";
|
|
8
|
+
import {useObjectRef as $9il6O$useObjectRef} from "@react-aria/utils";
|
|
9
|
+
|
|
10
|
+
/*
|
|
11
|
+
* Copyright 2025 Adobe. All rights reserved.
|
|
12
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
13
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
14
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
+
*
|
|
16
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
17
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
18
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
19
|
+
* governing permissions and limitations under the License.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
const $692df8403b6ac2c7$var$ToastStateContext = /*#__PURE__*/ (0, $9il6O$createContext)(null);
|
|
29
|
+
const $692df8403b6ac2c7$export$2cbf5519fbeaa538 = /*#__PURE__*/ (0, $9il6O$forwardRef)(function ToastRegion(props, ref) {
|
|
30
|
+
let state = (0, $9il6O$useToastQueue)(props.queue);
|
|
31
|
+
let objectRef = (0, $9il6O$useObjectRef)(ref);
|
|
32
|
+
let { regionProps: regionProps } = (0, $9il6O$useToastRegion)(props, state, objectRef);
|
|
33
|
+
let { focusProps: focusProps, isFocused: isFocused, isFocusVisible: isFocusVisible } = (0, $9il6O$useFocusRing)();
|
|
34
|
+
let renderProps = (0, $64fa3d84918910a7$export$4d86445c2cf5e3)({
|
|
35
|
+
...props,
|
|
36
|
+
children: undefined,
|
|
37
|
+
defaultClassName: 'react-aria-ToastRegion',
|
|
38
|
+
values: {
|
|
39
|
+
visibleToasts: state.visibleToasts,
|
|
40
|
+
isFocused: isFocused,
|
|
41
|
+
isFocusVisible: isFocusVisible
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
let region = /*#__PURE__*/ (0, $9il6O$react).createElement($692df8403b6ac2c7$var$ToastStateContext.Provider, {
|
|
45
|
+
value: state
|
|
46
|
+
}, /*#__PURE__*/ (0, $9il6O$react).createElement("div", {
|
|
47
|
+
...renderProps,
|
|
48
|
+
...(0, $9il6O$mergeProps)(regionProps, focusProps),
|
|
49
|
+
ref: objectRef,
|
|
50
|
+
"data-focused": isFocused || undefined,
|
|
51
|
+
"data-focus-visible": isFocusVisible || undefined
|
|
52
|
+
}, typeof props.children === 'function' ? /*#__PURE__*/ (0, $9il6O$react).createElement($692df8403b6ac2c7$var$ToastList, {
|
|
53
|
+
...props,
|
|
54
|
+
style: {
|
|
55
|
+
display: 'contents'
|
|
56
|
+
}
|
|
57
|
+
}) : props.children));
|
|
58
|
+
return state.visibleToasts.length > 0 && typeof document !== 'undefined' ? /*#__PURE__*/ (0, $9il6O$createPortal)(region, document.body) : null;
|
|
59
|
+
});
|
|
60
|
+
// TODO: possibly export this so additional children can be added to the region, outside the list.
|
|
61
|
+
const $692df8403b6ac2c7$var$ToastList = /*#__PURE__*/ (0, $9il6O$forwardRef)(function ToastList(props, ref) {
|
|
62
|
+
let state = (0, $9il6O$useContext)($692df8403b6ac2c7$var$ToastStateContext);
|
|
63
|
+
return(// @ts-ignore
|
|
64
|
+
/*#__PURE__*/ (0, $9il6O$react).createElement("ol", {
|
|
65
|
+
ref: ref,
|
|
66
|
+
style: props.style,
|
|
67
|
+
className: props.className
|
|
68
|
+
}, state.visibleToasts.map((toast)=>/*#__PURE__*/ (0, $9il6O$react).createElement("li", {
|
|
69
|
+
key: toast.key,
|
|
70
|
+
style: {
|
|
71
|
+
display: 'contents'
|
|
72
|
+
}
|
|
73
|
+
}, props.children({
|
|
74
|
+
toast: toast
|
|
75
|
+
})))));
|
|
76
|
+
});
|
|
77
|
+
const $692df8403b6ac2c7$export$8d8dc7d5f743331b = /*#__PURE__*/ (0, $9il6O$forwardRef)(function Toast(props, ref) {
|
|
78
|
+
let state = (0, $9il6O$useContext)($692df8403b6ac2c7$var$ToastStateContext);
|
|
79
|
+
let objectRef = (0, $9il6O$useObjectRef)(ref);
|
|
80
|
+
let { toastProps: toastProps, contentProps: contentProps, titleProps: titleProps, descriptionProps: descriptionProps, closeButtonProps: closeButtonProps } = (0, $9il6O$useToast)(props, state, objectRef);
|
|
81
|
+
let { focusProps: focusProps, isFocused: isFocused, isFocusVisible: isFocusVisible } = (0, $9il6O$useFocusRing)();
|
|
82
|
+
let renderProps = (0, $64fa3d84918910a7$export$4d86445c2cf5e3)({
|
|
83
|
+
...props,
|
|
84
|
+
defaultClassName: 'react-aria-Toast',
|
|
85
|
+
values: {
|
|
86
|
+
toast: props.toast,
|
|
87
|
+
isFocused: isFocused,
|
|
88
|
+
isFocusVisible: isFocusVisible
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
return /*#__PURE__*/ (0, $9il6O$react).createElement("div", {
|
|
92
|
+
...renderProps,
|
|
93
|
+
...(0, $9il6O$mergeProps)(toastProps, focusProps),
|
|
94
|
+
ref: objectRef,
|
|
95
|
+
"data-focused": isFocused || undefined,
|
|
96
|
+
"data-focus-visible": isFocusVisible || undefined
|
|
97
|
+
}, /*#__PURE__*/ (0, $9il6O$react).createElement((0, $64fa3d84918910a7$export$2881499e37b75b9a), {
|
|
98
|
+
values: [
|
|
99
|
+
[
|
|
100
|
+
$692df8403b6ac2c7$export$3a0d85872d9f73f2,
|
|
101
|
+
contentProps
|
|
102
|
+
],
|
|
103
|
+
[
|
|
104
|
+
(0, $514c0188e459b4c0$export$9afb8bc826b033ea),
|
|
105
|
+
{
|
|
106
|
+
slots: {
|
|
107
|
+
[(0, $64fa3d84918910a7$export$c62b8e45d58ddad9)]: {},
|
|
108
|
+
title: titleProps,
|
|
109
|
+
description: descriptionProps
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
],
|
|
113
|
+
[
|
|
114
|
+
(0, $d2b4bc8c273e7be6$export$24d547caef80ccd1),
|
|
115
|
+
{
|
|
116
|
+
slots: {
|
|
117
|
+
[(0, $64fa3d84918910a7$export$c62b8e45d58ddad9)]: {},
|
|
118
|
+
close: closeButtonProps
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
]
|
|
122
|
+
]
|
|
123
|
+
}, renderProps.children));
|
|
124
|
+
});
|
|
125
|
+
const $692df8403b6ac2c7$export$3a0d85872d9f73f2 = /*#__PURE__*/ (0, $9il6O$createContext)({});
|
|
126
|
+
const $692df8403b6ac2c7$export$b134a6cc89b08851 = /*#__PURE__*/ (0, $9il6O$forwardRef)(function ToastContent(props, ref) {
|
|
127
|
+
[props, ref] = (0, $64fa3d84918910a7$export$29f1550f4b0d4415)(props, ref, $692df8403b6ac2c7$export$3a0d85872d9f73f2);
|
|
128
|
+
return /*#__PURE__*/ (0, $9il6O$react).createElement("div", {
|
|
129
|
+
className: "react-aria-ToastContent",
|
|
130
|
+
...props,
|
|
131
|
+
ref: ref
|
|
132
|
+
}, props.children);
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
export {$692df8403b6ac2c7$export$2cbf5519fbeaa538 as ToastRegion, $692df8403b6ac2c7$export$8d8dc7d5f743331b as Toast, $692df8403b6ac2c7$export$3a0d85872d9f73f2 as ToastContentContext, $692df8403b6ac2c7$export$b134a6cc89b08851 as ToastContent};
|
|
137
|
+
//# sourceMappingURL=Toast.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAYD,MAAM,wDAAoB,CAAA,GAAA,oBAAY,EAA0B;AA2BzD,MAAM,4CAA4B,AAAd,WAAW,GAAI,CAAA,GAAA,iBAAS,EAAqB,SAAS,YAAe,KAA0B,EAAE,GAAiC;IAC3J,IAAI,QAAQ,CAAA,GAAA,oBAAY,EAAE,MAAM,KAAK;IACrC,IAAI,YAAY,CAAA,GAAA,mBAAW,EAAE;IAC7B,IAAI,eAAC,WAAW,EAAC,GAAG,CAAA,GAAA,qBAAa,EAAE,OAAO,OAAO;IAEjD,IAAI,cAAC,UAAU,aAAE,SAAS,kBAAE,cAAc,EAAC,GAAG,CAAA,GAAA,mBAAW;IACzD,IAAI,cAAc,CAAA,GAAA,uCAAa,EAAE;QAC/B,GAAG,KAAK;QACR,UAAU;QACV,kBAAkB;QAClB,QAAQ;YACN,eAAe,MAAM,aAAa;uBAClC;4BACA;QACF;IACF;IAEA,IAAI,uBACF,gCAAC,wCAAkB,QAAQ;QAAC,OAAO;qBACjC,gCAAC;QACE,GAA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QAAQ;YACN,OAAO,MAAM,KAAK;uBAClB;4BACA;QACF;IACF;IAEA,qBACE,gCAAC;QACE,GAAG,WAAW;QACd,GAAG,CAAA,GAAA,iBAAS,EAAE,YAAY,WAAW;QACtC,KAAK;QACL,gBAAc,aAAa;QAC3B,sBAAoB,kBAAkB;qBACtC,gCAAC,CAAA,GAAA,yCAAO;QACN,QAAQ;YACN;gBAAC;gBAAqB;aAAa;YACnC;gBAAC,CAAA,GAAA,yCAAU;gBAAG;oBACZ,OAAO;wBACL,CAAC,CAAA,GAAA,yCAAW,EAAE,EAAE,CAAC;wBACjB,OAAO;wBACP,aAAa;oBACf;gBACF;aAAE;YACF;gBAAC,CAAA,GAAA,yCAAY;gBAAG;oBACd,OAAO;wBACL,CAAC,CAAA,GAAA,yCAAW,EAAE,EAAE,CAAC;wBACjB,OAAO;oBACT;gBACF;aAAE;SACH;OACA,YAAY,QAAQ;AAI7B;AAEO,MAAM,0DAAsB,CAAA,GAAA,oBAAY,EAA6D,CAAC;AAKtG,MAAM,4CAAe,WAAW,GAAG,CAAA,GAAA,iBAAS,EAAE,SAAS,aAAa,KAAkC,EAAE,GAAiC;IAC9I,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,qBACE,gCAAC;QAAI,WAAU;QAA2B,GAAG,KAAK;QAAE,KAAK;OACtD,MAAM,QAAQ;AAGrB","sources":["packages/react-aria-components/src/Toast.tsx"],"sourcesContent":["/*\n * Copyright 2025 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 {AriaToastProps, AriaToastRegionProps, mergeProps, useFocusRing, useToast, useToastRegion} from 'react-aria';\nimport {ButtonContext} from './Button';\nimport {ContextValue, DEFAULT_SLOT, Provider, RenderProps, StyleRenderProps, useContextProps, useRenderProps} from './utils';\nimport {createPortal} from 'react-dom';\nimport {forwardRefType} from '@react-types/shared';\nimport {QueuedToast, ToastQueue, ToastState, useToastQueue} from 'react-stately';\nimport React, {createContext, ForwardedRef, forwardRef, HTMLAttributes, JSX, ReactElement, useContext} from 'react';\nimport {TextContext} from './Text';\nimport {useObjectRef} from '@react-aria/utils';\n\nconst ToastStateContext = createContext<ToastState<any> | null>(null);\n\nexport interface ToastRegionRenderProps<T> {\n /** A list of all currently visible toasts. */\n visibleToasts: QueuedToast<T>[],\n /**\n * Whether the toast region is currently focused.\n * @selector [data-focused]\n */\n isFocused: boolean,\n /**\n * Whether the toast region is keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean\n}\n\nexport interface ToastRegionProps<T> extends AriaToastRegionProps, StyleRenderProps<ToastRegionRenderProps<T>> {\n /** The queue of toasts to display. */\n queue: ToastQueue<T>,\n /** A function to render each toast. */\n children: (renderProps: {toast: QueuedToast<T>}) => ReactElement\n}\n\n/**\n * A ToastRegion displays one or more toast notifications.\n */\nexport const ToastRegion = /*#__PURE__*/ (forwardRef as forwardRefType)(function ToastRegion<T>(props: ToastRegionProps<T>, ref: ForwardedRef<HTMLDivElement>): JSX.Element | null {\n let state = useToastQueue(props.queue);\n let objectRef = useObjectRef(ref);\n let {regionProps} = useToastRegion(props, state, objectRef);\n\n let {focusProps, isFocused, isFocusVisible} = useFocusRing();\n let renderProps = useRenderProps({\n ...props,\n children: undefined,\n defaultClassName: 'react-aria-ToastRegion',\n values: {\n visibleToasts: state.visibleToasts,\n isFocused,\n isFocusVisible\n }\n });\n\n let region = (\n <ToastStateContext.Provider value={state}>\n <div\n {...renderProps}\n {...mergeProps(regionProps, focusProps)}\n ref={objectRef}\n data-focused={isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined}>\n {typeof props.children === 'function' ? <ToastList {...props} style={{display: 'contents'}} /> : props.children}\n </div>\n </ToastStateContext.Provider>\n );\n\n return state.visibleToasts.length > 0 && typeof document !== 'undefined'\n ? createPortal(region, document.body)\n : null;\n});\n\n// TODO: possibly export this so additional children can be added to the region, outside the list.\nconst ToastList = /*#__PURE__*/ (forwardRef as forwardRefType)(function ToastList<T>(props: ToastRegionProps<T>, ref: ForwardedRef<HTMLOListElement>) {\n let state = useContext(ToastStateContext)!;\n return (\n // @ts-ignore\n <ol ref={ref} style={props.style} className={props.className}>\n {state.visibleToasts.map((toast) => (\n <li key={toast.key} style={{display: 'contents'}}>\n {props.children({toast})}\n </li>\n ))}\n </ol>\n );\n});\n\nexport interface ToastRenderProps<T> {\n /**\n * The toast object to display.\n */\n toast: QueuedToast<T>,\n /**\n * Whether the toast is currently focused.\n * @selector [data-focused]\n */\n isFocused: boolean,\n /**\n * Whether the toast is keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean\n}\n\nexport interface ToastProps<T> extends AriaToastProps<T>, RenderProps<ToastRenderProps<T>> {}\n\n/**\n * A Toast displays a brief, temporary notification of actions, errors, or other events in an application.\n */\nexport const Toast = /*#__PURE__*/ (forwardRef as forwardRefType)(function Toast<T>(props: ToastProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n let state = useContext(ToastStateContext)!;\n let objectRef = useObjectRef(ref);\n let {toastProps, contentProps, titleProps, descriptionProps, closeButtonProps} = useToast(\n props,\n state,\n objectRef\n );\n\n let {focusProps, isFocused, isFocusVisible} = useFocusRing();\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Toast',\n values: {\n toast: props.toast,\n isFocused,\n isFocusVisible\n }\n });\n\n return (\n <div\n {...renderProps}\n {...mergeProps(toastProps, focusProps)}\n ref={objectRef}\n data-focused={isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined}>\n <Provider\n values={[\n [ToastContentContext, contentProps],\n [TextContext, {\n slots: {\n [DEFAULT_SLOT]: {},\n title: titleProps,\n description: descriptionProps\n }\n }],\n [ButtonContext, {\n slots: {\n [DEFAULT_SLOT]: {},\n close: closeButtonProps\n }\n }]\n ]}>\n {renderProps.children}\n </Provider>\n </div>\n );\n});\n\nexport const ToastContentContext = createContext<ContextValue<HTMLAttributes<HTMLElement>, HTMLDivElement>>({});\n\n/**\n * ToastContent wraps the main content of a toast notification.\n */\nexport const ToastContent = /*#__PURE__*/ forwardRef(function ToastContent(props: HTMLAttributes<HTMLElement>, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, ToastContentContext);\n return (\n <div className=\"react-aria-ToastContent\" {...props} ref={ref}>\n {props.children}\n </div>\n );\n});\n"],"names":[],"version":3,"file":"Toast.module.js.map"}
|