react-aria-components 3.0.0-nightly-412a51816-250219 → 3.0.0-nightly-a792c1ad5-250222
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/Autocomplete.main.js +20 -10
- package/dist/Autocomplete.main.js.map +1 -1
- package/dist/Autocomplete.mjs +20 -10
- package/dist/Autocomplete.module.js +20 -10
- package/dist/Autocomplete.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 +16 -16
- package/dist/ListBox.main.js.map +1 -1
- package/dist/ListBox.mjs +17 -17
- package/dist/ListBox.module.js +17 -17
- package/dist/ListBox.module.js.map +1 -1
- package/dist/Menu.main.js +72 -7
- package/dist/Menu.main.js.map +1 -1
- package/dist/Menu.mjs +72 -8
- package/dist/Menu.module.js +72 -8
- package/dist/Menu.module.js.map +1 -1
- package/dist/Popover.main.js +38 -14
- package/dist/Popover.main.js.map +1 -1
- package/dist/Popover.mjs +39 -15
- package/dist/Popover.module.js +39 -15
- package/dist/Popover.module.js.map +1 -1
- package/dist/SearchField.main.js +3 -1
- package/dist/SearchField.main.js.map +1 -1
- package/dist/SearchField.mjs +4 -2
- package/dist/SearchField.module.js +4 -2
- package/dist/SearchField.module.js.map +1 -1
- package/dist/Table.main.js +10 -38
- package/dist/Table.main.js.map +1 -1
- package/dist/Table.mjs +10 -38
- package/dist/Table.module.js +10 -38
- 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/TextField.main.js +3 -1
- package/dist/TextField.main.js.map +1 -1
- package/dist/TextField.mjs +4 -2
- package/dist/TextField.module.js +4 -2
- package/dist/TextField.module.js.map +1 -1
- package/dist/Toast.main.js +150 -0
- package/dist/Toast.main.js.map +1 -0
- package/dist/Toast.mjs +139 -0
- package/dist/Toast.module.js +139 -0
- package/dist/Toast.module.js.map +1 -0
- package/dist/Tree.main.js +26 -25
- package/dist/Tree.main.js.map +1 -1
- package/dist/Tree.mjs +21 -20
- package/dist/Tree.module.js +21 -20
- 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 +11 -5
- package/dist/main.js +32 -13
- package/dist/main.js.map +1 -1
- package/dist/module.js +11 -5
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +136 -28
- package/dist/types.d.ts.map +1 -1
- package/i18n/index.js +1 -1
- package/i18n/index.mjs +1 -1
- package/package.json +34 -32
- package/src/Autocomplete.tsx +14 -11
- package/src/GridList.tsx +5 -0
- package/src/Group.tsx +1 -0
- package/src/ListBox.tsx +9 -8
- package/src/Menu.tsx +68 -10
- package/src/Popover.tsx +47 -21
- package/src/SearchField.tsx +3 -3
- package/src/Table.tsx +10 -40
- package/src/TableLayout.ts +1 -1
- package/src/TextField.tsx +3 -3
- package/src/Toast.tsx +185 -0
- package/src/Tree.tsx +50 -37
- package/src/Virtualizer.tsx +18 -3
- package/src/index.ts +13 -7
|
@@ -0,0 +1,150 @@
|
|
|
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$reactariatoast = require("@react-aria/toast");
|
|
5
|
+
var $coXVq$reactdom = require("react-dom");
|
|
6
|
+
var $coXVq$reactaria = require("react-aria");
|
|
7
|
+
var $coXVq$reactstatelytoast = require("@react-stately/toast");
|
|
8
|
+
var $coXVq$react = require("react");
|
|
9
|
+
var $coXVq$reactariautils = require("@react-aria/utils");
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
function $parcel$interopDefault(a) {
|
|
13
|
+
return a && a.__esModule ? a.default : a;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function $parcel$export(e, n, v, s) {
|
|
17
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
$parcel$export(module.exports, "ToastRegion", () => $4e3fafb90a1b5a5f$export$2cbf5519fbeaa538);
|
|
21
|
+
$parcel$export(module.exports, "Toast", () => $4e3fafb90a1b5a5f$export$8d8dc7d5f743331b);
|
|
22
|
+
$parcel$export(module.exports, "ToastContent", () => $4e3fafb90a1b5a5f$export$b134a6cc89b08851);
|
|
23
|
+
/*
|
|
24
|
+
* Copyright 2025 Adobe. All rights reserved.
|
|
25
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
26
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
27
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
28
|
+
*
|
|
29
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
30
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
31
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
32
|
+
* governing permissions and limitations under the License.
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
const $4e3fafb90a1b5a5f$var$ToastStateContext = /*#__PURE__*/ (0, $coXVq$react.createContext)(null);
|
|
43
|
+
const $4e3fafb90a1b5a5f$export$2cbf5519fbeaa538 = /*#__PURE__*/ (0, $coXVq$react.forwardRef)(function ToastRegion(props, ref) {
|
|
44
|
+
let state = (0, $coXVq$reactstatelytoast.useToastQueue)(props.queue);
|
|
45
|
+
let objectRef = (0, $coXVq$reactariautils.useObjectRef)(ref);
|
|
46
|
+
let { regionProps: regionProps } = (0, $coXVq$reactariatoast.useToastRegion)(props, state, objectRef);
|
|
47
|
+
let { focusProps: focusProps, isFocused: isFocused, isFocusVisible: isFocusVisible } = (0, $coXVq$reactaria.useFocusRing)();
|
|
48
|
+
let renderProps = (0, $c5ccf687772c0422$exports.useRenderProps)({
|
|
49
|
+
...props,
|
|
50
|
+
children: undefined,
|
|
51
|
+
defaultClassName: 'react-aria-ToastRegion',
|
|
52
|
+
values: {
|
|
53
|
+
visibleToasts: state.visibleToasts,
|
|
54
|
+
isFocused: isFocused,
|
|
55
|
+
isFocusVisible: isFocusVisible
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
let region = /*#__PURE__*/ (0, ($parcel$interopDefault($coXVq$react))).createElement($4e3fafb90a1b5a5f$var$ToastStateContext.Provider, {
|
|
59
|
+
value: state
|
|
60
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($coXVq$react))).createElement("div", {
|
|
61
|
+
...renderProps,
|
|
62
|
+
...(0, $coXVq$reactaria.mergeProps)(regionProps, focusProps),
|
|
63
|
+
ref: objectRef,
|
|
64
|
+
"data-focused": isFocused || undefined,
|
|
65
|
+
"data-focus-visible": isFocusVisible || undefined
|
|
66
|
+
}, typeof props.children === 'function' ? /*#__PURE__*/ (0, ($parcel$interopDefault($coXVq$react))).createElement($4e3fafb90a1b5a5f$var$ToastList, {
|
|
67
|
+
...props,
|
|
68
|
+
style: {
|
|
69
|
+
display: 'contents'
|
|
70
|
+
}
|
|
71
|
+
}) : props.children));
|
|
72
|
+
return state.visibleToasts.length > 0 && typeof document !== 'undefined' ? /*#__PURE__*/ (0, $coXVq$reactdom.createPortal)(region, document.body) : null;
|
|
73
|
+
});
|
|
74
|
+
// TODO: possibly export this so additional children can be added to the region, outside the list.
|
|
75
|
+
const $4e3fafb90a1b5a5f$var$ToastList = /*#__PURE__*/ (0, $coXVq$react.forwardRef)(function ToastList(props, ref) {
|
|
76
|
+
let state = (0, $coXVq$react.useContext)($4e3fafb90a1b5a5f$var$ToastStateContext);
|
|
77
|
+
return(// @ts-ignore
|
|
78
|
+
/*#__PURE__*/ (0, ($parcel$interopDefault($coXVq$react))).createElement("ol", {
|
|
79
|
+
ref: ref,
|
|
80
|
+
style: props.style,
|
|
81
|
+
className: props.className
|
|
82
|
+
}, state.visibleToasts.map((toast)=>/*#__PURE__*/ (0, ($parcel$interopDefault($coXVq$react))).createElement("li", {
|
|
83
|
+
key: toast.key,
|
|
84
|
+
style: {
|
|
85
|
+
display: 'contents'
|
|
86
|
+
}
|
|
87
|
+
}, props.children({
|
|
88
|
+
toast: toast
|
|
89
|
+
})))));
|
|
90
|
+
});
|
|
91
|
+
const $4e3fafb90a1b5a5f$export$8d8dc7d5f743331b = /*#__PURE__*/ (0, $coXVq$react.forwardRef)(function Toast(props, ref) {
|
|
92
|
+
let state = (0, $coXVq$react.useContext)($4e3fafb90a1b5a5f$var$ToastStateContext);
|
|
93
|
+
let objectRef = (0, $coXVq$reactariautils.useObjectRef)(ref);
|
|
94
|
+
let { toastProps: toastProps, contentProps: contentProps, titleProps: titleProps, descriptionProps: descriptionProps, closeButtonProps: closeButtonProps } = (0, $coXVq$reactariatoast.useToast)(props, state, objectRef);
|
|
95
|
+
let { focusProps: focusProps, isFocused: isFocused, isFocusVisible: isFocusVisible } = (0, $coXVq$reactaria.useFocusRing)();
|
|
96
|
+
let renderProps = (0, $c5ccf687772c0422$exports.useRenderProps)({
|
|
97
|
+
...props,
|
|
98
|
+
defaultClassName: 'react-aria-Toast',
|
|
99
|
+
values: {
|
|
100
|
+
toast: props.toast,
|
|
101
|
+
isFocused: isFocused,
|
|
102
|
+
isFocusVisible: isFocusVisible
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($coXVq$react))).createElement("div", {
|
|
106
|
+
...renderProps,
|
|
107
|
+
...(0, $coXVq$reactaria.mergeProps)(toastProps, focusProps),
|
|
108
|
+
ref: objectRef,
|
|
109
|
+
"data-focused": isFocused || undefined,
|
|
110
|
+
"data-focus-visible": isFocusVisible || undefined
|
|
111
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($coXVq$react))).createElement((0, $c5ccf687772c0422$exports.Provider), {
|
|
112
|
+
values: [
|
|
113
|
+
[
|
|
114
|
+
$4e3fafb90a1b5a5f$export$3a0d85872d9f73f2,
|
|
115
|
+
contentProps
|
|
116
|
+
],
|
|
117
|
+
[
|
|
118
|
+
(0, $a8a589c28affdc40$exports.TextContext),
|
|
119
|
+
{
|
|
120
|
+
slots: {
|
|
121
|
+
[(0, $c5ccf687772c0422$exports.DEFAULT_SLOT)]: {},
|
|
122
|
+
title: titleProps,
|
|
123
|
+
description: descriptionProps
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
],
|
|
127
|
+
[
|
|
128
|
+
(0, $b856e6788a7ea5bf$exports.ButtonContext),
|
|
129
|
+
{
|
|
130
|
+
slots: {
|
|
131
|
+
[(0, $c5ccf687772c0422$exports.DEFAULT_SLOT)]: {},
|
|
132
|
+
close: closeButtonProps
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
]
|
|
136
|
+
]
|
|
137
|
+
}, renderProps.children));
|
|
138
|
+
});
|
|
139
|
+
const $4e3fafb90a1b5a5f$export$3a0d85872d9f73f2 = /*#__PURE__*/ (0, $coXVq$react.createContext)({});
|
|
140
|
+
const $4e3fafb90a1b5a5f$export$b134a6cc89b08851 = /*#__PURE__*/ (0, $coXVq$react.forwardRef)(function ToastContent(props, ref) {
|
|
141
|
+
[props, ref] = (0, $c5ccf687772c0422$exports.useContextProps)(props, ref, $4e3fafb90a1b5a5f$export$3a0d85872d9f73f2);
|
|
142
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($coXVq$react))).createElement("div", {
|
|
143
|
+
className: "react-aria-ToastContent",
|
|
144
|
+
...props,
|
|
145
|
+
ref: ref
|
|
146
|
+
}, props.children);
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
//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AAA,sCAAW,EAAE,EAAE,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, useToast, useToastRegion} from '@react-aria/toast';\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 {mergeProps, useFocusRing} from 'react-aria';\nimport {QueuedToast, ToastQueue, ToastState, useToastQueue} from '@react-stately/toast';\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,139 @@
|
|
|
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, useToast as $9il6O$useToast} from "@react-aria/toast";
|
|
5
|
+
import {createPortal as $9il6O$createPortal} from "react-dom";
|
|
6
|
+
import {useFocusRing as $9il6O$useFocusRing, mergeProps as $9il6O$mergeProps} from "react-aria";
|
|
7
|
+
import {useToastQueue as $9il6O$useToastQueue} from "@react-stately/toast";
|
|
8
|
+
import $9il6O$react, {createContext as $9il6O$createContext, forwardRef as $9il6O$forwardRef, useContext as $9il6O$useContext} from "react";
|
|
9
|
+
import {useObjectRef as $9il6O$useObjectRef} from "@react-aria/utils";
|
|
10
|
+
|
|
11
|
+
/*
|
|
12
|
+
* Copyright 2025 Adobe. All rights reserved.
|
|
13
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
14
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
15
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
*
|
|
17
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
18
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
19
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
20
|
+
* governing permissions and limitations under the License.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
const $692df8403b6ac2c7$var$ToastStateContext = /*#__PURE__*/ (0, $9il6O$createContext)(null);
|
|
31
|
+
const $692df8403b6ac2c7$export$2cbf5519fbeaa538 = /*#__PURE__*/ (0, $9il6O$forwardRef)(function ToastRegion(props, ref) {
|
|
32
|
+
let state = (0, $9il6O$useToastQueue)(props.queue);
|
|
33
|
+
let objectRef = (0, $9il6O$useObjectRef)(ref);
|
|
34
|
+
let { regionProps: regionProps } = (0, $9il6O$useToastRegion)(props, state, objectRef);
|
|
35
|
+
let { focusProps: focusProps, isFocused: isFocused, isFocusVisible: isFocusVisible } = (0, $9il6O$useFocusRing)();
|
|
36
|
+
let renderProps = (0, $64fa3d84918910a7$export$4d86445c2cf5e3)({
|
|
37
|
+
...props,
|
|
38
|
+
children: undefined,
|
|
39
|
+
defaultClassName: 'react-aria-ToastRegion',
|
|
40
|
+
values: {
|
|
41
|
+
visibleToasts: state.visibleToasts,
|
|
42
|
+
isFocused: isFocused,
|
|
43
|
+
isFocusVisible: isFocusVisible
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
let region = /*#__PURE__*/ (0, $9il6O$react).createElement($692df8403b6ac2c7$var$ToastStateContext.Provider, {
|
|
47
|
+
value: state
|
|
48
|
+
}, /*#__PURE__*/ (0, $9il6O$react).createElement("div", {
|
|
49
|
+
...renderProps,
|
|
50
|
+
...(0, $9il6O$mergeProps)(regionProps, focusProps),
|
|
51
|
+
ref: objectRef,
|
|
52
|
+
"data-focused": isFocused || undefined,
|
|
53
|
+
"data-focus-visible": isFocusVisible || undefined
|
|
54
|
+
}, typeof props.children === 'function' ? /*#__PURE__*/ (0, $9il6O$react).createElement($692df8403b6ac2c7$var$ToastList, {
|
|
55
|
+
...props,
|
|
56
|
+
style: {
|
|
57
|
+
display: 'contents'
|
|
58
|
+
}
|
|
59
|
+
}) : props.children));
|
|
60
|
+
return state.visibleToasts.length > 0 && typeof document !== 'undefined' ? /*#__PURE__*/ (0, $9il6O$createPortal)(region, document.body) : null;
|
|
61
|
+
});
|
|
62
|
+
// TODO: possibly export this so additional children can be added to the region, outside the list.
|
|
63
|
+
const $692df8403b6ac2c7$var$ToastList = /*#__PURE__*/ (0, $9il6O$forwardRef)(function ToastList(props, ref) {
|
|
64
|
+
let state = (0, $9il6O$useContext)($692df8403b6ac2c7$var$ToastStateContext);
|
|
65
|
+
return(// @ts-ignore
|
|
66
|
+
/*#__PURE__*/ (0, $9il6O$react).createElement("ol", {
|
|
67
|
+
ref: ref,
|
|
68
|
+
style: props.style,
|
|
69
|
+
className: props.className
|
|
70
|
+
}, state.visibleToasts.map((toast)=>/*#__PURE__*/ (0, $9il6O$react).createElement("li", {
|
|
71
|
+
key: toast.key,
|
|
72
|
+
style: {
|
|
73
|
+
display: 'contents'
|
|
74
|
+
}
|
|
75
|
+
}, props.children({
|
|
76
|
+
toast: toast
|
|
77
|
+
})))));
|
|
78
|
+
});
|
|
79
|
+
const $692df8403b6ac2c7$export$8d8dc7d5f743331b = /*#__PURE__*/ (0, $9il6O$forwardRef)(function Toast(props, ref) {
|
|
80
|
+
let state = (0, $9il6O$useContext)($692df8403b6ac2c7$var$ToastStateContext);
|
|
81
|
+
let objectRef = (0, $9il6O$useObjectRef)(ref);
|
|
82
|
+
let { toastProps: toastProps, contentProps: contentProps, titleProps: titleProps, descriptionProps: descriptionProps, closeButtonProps: closeButtonProps } = (0, $9il6O$useToast)(props, state, objectRef);
|
|
83
|
+
let { focusProps: focusProps, isFocused: isFocused, isFocusVisible: isFocusVisible } = (0, $9il6O$useFocusRing)();
|
|
84
|
+
let renderProps = (0, $64fa3d84918910a7$export$4d86445c2cf5e3)({
|
|
85
|
+
...props,
|
|
86
|
+
defaultClassName: 'react-aria-Toast',
|
|
87
|
+
values: {
|
|
88
|
+
toast: props.toast,
|
|
89
|
+
isFocused: isFocused,
|
|
90
|
+
isFocusVisible: isFocusVisible
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
return /*#__PURE__*/ (0, $9il6O$react).createElement("div", {
|
|
94
|
+
...renderProps,
|
|
95
|
+
...(0, $9il6O$mergeProps)(toastProps, focusProps),
|
|
96
|
+
ref: objectRef,
|
|
97
|
+
"data-focused": isFocused || undefined,
|
|
98
|
+
"data-focus-visible": isFocusVisible || undefined
|
|
99
|
+
}, /*#__PURE__*/ (0, $9il6O$react).createElement((0, $64fa3d84918910a7$export$2881499e37b75b9a), {
|
|
100
|
+
values: [
|
|
101
|
+
[
|
|
102
|
+
$692df8403b6ac2c7$export$3a0d85872d9f73f2,
|
|
103
|
+
contentProps
|
|
104
|
+
],
|
|
105
|
+
[
|
|
106
|
+
(0, $514c0188e459b4c0$export$9afb8bc826b033ea),
|
|
107
|
+
{
|
|
108
|
+
slots: {
|
|
109
|
+
[(0, $64fa3d84918910a7$export$c62b8e45d58ddad9)]: {},
|
|
110
|
+
title: titleProps,
|
|
111
|
+
description: descriptionProps
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
],
|
|
115
|
+
[
|
|
116
|
+
(0, $d2b4bc8c273e7be6$export$24d547caef80ccd1),
|
|
117
|
+
{
|
|
118
|
+
slots: {
|
|
119
|
+
[(0, $64fa3d84918910a7$export$c62b8e45d58ddad9)]: {},
|
|
120
|
+
close: closeButtonProps
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
]
|
|
124
|
+
]
|
|
125
|
+
}, renderProps.children));
|
|
126
|
+
});
|
|
127
|
+
const $692df8403b6ac2c7$export$3a0d85872d9f73f2 = /*#__PURE__*/ (0, $9il6O$createContext)({});
|
|
128
|
+
const $692df8403b6ac2c7$export$b134a6cc89b08851 = /*#__PURE__*/ (0, $9il6O$forwardRef)(function ToastContent(props, ref) {
|
|
129
|
+
[props, ref] = (0, $64fa3d84918910a7$export$29f1550f4b0d4415)(props, ref, $692df8403b6ac2c7$export$3a0d85872d9f73f2);
|
|
130
|
+
return /*#__PURE__*/ (0, $9il6O$react).createElement("div", {
|
|
131
|
+
className: "react-aria-ToastContent",
|
|
132
|
+
...props,
|
|
133
|
+
ref: ref
|
|
134
|
+
}, props.children);
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
export {$692df8403b6ac2c7$export$2cbf5519fbeaa538 as ToastRegion, $692df8403b6ac2c7$export$8d8dc7d5f743331b as Toast, $692df8403b6ac2c7$export$3a0d85872d9f73f2 as ToastContentContext, $692df8403b6ac2c7$export$b134a6cc89b08851 as ToastContent};
|
|
139
|
+
//# sourceMappingURL=Toast.module.js.map
|
|
@@ -0,0 +1,139 @@
|
|
|
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, useToast as $9il6O$useToast} from "@react-aria/toast";
|
|
5
|
+
import {createPortal as $9il6O$createPortal} from "react-dom";
|
|
6
|
+
import {useFocusRing as $9il6O$useFocusRing, mergeProps as $9il6O$mergeProps} from "react-aria";
|
|
7
|
+
import {useToastQueue as $9il6O$useToastQueue} from "@react-stately/toast";
|
|
8
|
+
import $9il6O$react, {createContext as $9il6O$createContext, forwardRef as $9il6O$forwardRef, useContext as $9il6O$useContext} from "react";
|
|
9
|
+
import {useObjectRef as $9il6O$useObjectRef} from "@react-aria/utils";
|
|
10
|
+
|
|
11
|
+
/*
|
|
12
|
+
* Copyright 2025 Adobe. All rights reserved.
|
|
13
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
14
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
15
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
*
|
|
17
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
18
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
19
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
20
|
+
* governing permissions and limitations under the License.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
const $692df8403b6ac2c7$var$ToastStateContext = /*#__PURE__*/ (0, $9il6O$createContext)(null);
|
|
31
|
+
const $692df8403b6ac2c7$export$2cbf5519fbeaa538 = /*#__PURE__*/ (0, $9il6O$forwardRef)(function ToastRegion(props, ref) {
|
|
32
|
+
let state = (0, $9il6O$useToastQueue)(props.queue);
|
|
33
|
+
let objectRef = (0, $9il6O$useObjectRef)(ref);
|
|
34
|
+
let { regionProps: regionProps } = (0, $9il6O$useToastRegion)(props, state, objectRef);
|
|
35
|
+
let { focusProps: focusProps, isFocused: isFocused, isFocusVisible: isFocusVisible } = (0, $9il6O$useFocusRing)();
|
|
36
|
+
let renderProps = (0, $64fa3d84918910a7$export$4d86445c2cf5e3)({
|
|
37
|
+
...props,
|
|
38
|
+
children: undefined,
|
|
39
|
+
defaultClassName: 'react-aria-ToastRegion',
|
|
40
|
+
values: {
|
|
41
|
+
visibleToasts: state.visibleToasts,
|
|
42
|
+
isFocused: isFocused,
|
|
43
|
+
isFocusVisible: isFocusVisible
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
let region = /*#__PURE__*/ (0, $9il6O$react).createElement($692df8403b6ac2c7$var$ToastStateContext.Provider, {
|
|
47
|
+
value: state
|
|
48
|
+
}, /*#__PURE__*/ (0, $9il6O$react).createElement("div", {
|
|
49
|
+
...renderProps,
|
|
50
|
+
...(0, $9il6O$mergeProps)(regionProps, focusProps),
|
|
51
|
+
ref: objectRef,
|
|
52
|
+
"data-focused": isFocused || undefined,
|
|
53
|
+
"data-focus-visible": isFocusVisible || undefined
|
|
54
|
+
}, typeof props.children === 'function' ? /*#__PURE__*/ (0, $9il6O$react).createElement($692df8403b6ac2c7$var$ToastList, {
|
|
55
|
+
...props,
|
|
56
|
+
style: {
|
|
57
|
+
display: 'contents'
|
|
58
|
+
}
|
|
59
|
+
}) : props.children));
|
|
60
|
+
return state.visibleToasts.length > 0 && typeof document !== 'undefined' ? /*#__PURE__*/ (0, $9il6O$createPortal)(region, document.body) : null;
|
|
61
|
+
});
|
|
62
|
+
// TODO: possibly export this so additional children can be added to the region, outside the list.
|
|
63
|
+
const $692df8403b6ac2c7$var$ToastList = /*#__PURE__*/ (0, $9il6O$forwardRef)(function ToastList(props, ref) {
|
|
64
|
+
let state = (0, $9il6O$useContext)($692df8403b6ac2c7$var$ToastStateContext);
|
|
65
|
+
return(// @ts-ignore
|
|
66
|
+
/*#__PURE__*/ (0, $9il6O$react).createElement("ol", {
|
|
67
|
+
ref: ref,
|
|
68
|
+
style: props.style,
|
|
69
|
+
className: props.className
|
|
70
|
+
}, state.visibleToasts.map((toast)=>/*#__PURE__*/ (0, $9il6O$react).createElement("li", {
|
|
71
|
+
key: toast.key,
|
|
72
|
+
style: {
|
|
73
|
+
display: 'contents'
|
|
74
|
+
}
|
|
75
|
+
}, props.children({
|
|
76
|
+
toast: toast
|
|
77
|
+
})))));
|
|
78
|
+
});
|
|
79
|
+
const $692df8403b6ac2c7$export$8d8dc7d5f743331b = /*#__PURE__*/ (0, $9il6O$forwardRef)(function Toast(props, ref) {
|
|
80
|
+
let state = (0, $9il6O$useContext)($692df8403b6ac2c7$var$ToastStateContext);
|
|
81
|
+
let objectRef = (0, $9il6O$useObjectRef)(ref);
|
|
82
|
+
let { toastProps: toastProps, contentProps: contentProps, titleProps: titleProps, descriptionProps: descriptionProps, closeButtonProps: closeButtonProps } = (0, $9il6O$useToast)(props, state, objectRef);
|
|
83
|
+
let { focusProps: focusProps, isFocused: isFocused, isFocusVisible: isFocusVisible } = (0, $9il6O$useFocusRing)();
|
|
84
|
+
let renderProps = (0, $64fa3d84918910a7$export$4d86445c2cf5e3)({
|
|
85
|
+
...props,
|
|
86
|
+
defaultClassName: 'react-aria-Toast',
|
|
87
|
+
values: {
|
|
88
|
+
toast: props.toast,
|
|
89
|
+
isFocused: isFocused,
|
|
90
|
+
isFocusVisible: isFocusVisible
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
return /*#__PURE__*/ (0, $9il6O$react).createElement("div", {
|
|
94
|
+
...renderProps,
|
|
95
|
+
...(0, $9il6O$mergeProps)(toastProps, focusProps),
|
|
96
|
+
ref: objectRef,
|
|
97
|
+
"data-focused": isFocused || undefined,
|
|
98
|
+
"data-focus-visible": isFocusVisible || undefined
|
|
99
|
+
}, /*#__PURE__*/ (0, $9il6O$react).createElement((0, $64fa3d84918910a7$export$2881499e37b75b9a), {
|
|
100
|
+
values: [
|
|
101
|
+
[
|
|
102
|
+
$692df8403b6ac2c7$export$3a0d85872d9f73f2,
|
|
103
|
+
contentProps
|
|
104
|
+
],
|
|
105
|
+
[
|
|
106
|
+
(0, $514c0188e459b4c0$export$9afb8bc826b033ea),
|
|
107
|
+
{
|
|
108
|
+
slots: {
|
|
109
|
+
[(0, $64fa3d84918910a7$export$c62b8e45d58ddad9)]: {},
|
|
110
|
+
title: titleProps,
|
|
111
|
+
description: descriptionProps
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
],
|
|
115
|
+
[
|
|
116
|
+
(0, $d2b4bc8c273e7be6$export$24d547caef80ccd1),
|
|
117
|
+
{
|
|
118
|
+
slots: {
|
|
119
|
+
[(0, $64fa3d84918910a7$export$c62b8e45d58ddad9)]: {},
|
|
120
|
+
close: closeButtonProps
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
]
|
|
124
|
+
]
|
|
125
|
+
}, renderProps.children));
|
|
126
|
+
});
|
|
127
|
+
const $692df8403b6ac2c7$export$3a0d85872d9f73f2 = /*#__PURE__*/ (0, $9il6O$createContext)({});
|
|
128
|
+
const $692df8403b6ac2c7$export$b134a6cc89b08851 = /*#__PURE__*/ (0, $9il6O$forwardRef)(function ToastContent(props, ref) {
|
|
129
|
+
[props, ref] = (0, $64fa3d84918910a7$export$29f1550f4b0d4415)(props, ref, $692df8403b6ac2c7$export$3a0d85872d9f73f2);
|
|
130
|
+
return /*#__PURE__*/ (0, $9il6O$react).createElement("div", {
|
|
131
|
+
className: "react-aria-ToastContent",
|
|
132
|
+
...props,
|
|
133
|
+
ref: ref
|
|
134
|
+
}, props.children);
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
export {$692df8403b6ac2c7$export$2cbf5519fbeaa538 as ToastRegion, $692df8403b6ac2c7$export$8d8dc7d5f743331b as Toast, $692df8403b6ac2c7$export$3a0d85872d9f73f2 as ToastContentContext, $692df8403b6ac2c7$export$b134a6cc89b08851 as ToastContent};
|
|
139
|
+
//# sourceMappingURL=Toast.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;AAaD,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,kBA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,aAAE,SAAS,kBAAE,cAAc,EAAC,GAAG,CAAA,GAAA,mBAAW;IACzD,IAAI,cAAc,CAAA,GAAA,uCAAa,EAAE;QAC/B,GAAG,KAAK;QACR,kBAAkB;QAClB,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, useToast, useToastRegion} from '@react-aria/toast';\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 {mergeProps, useFocusRing} from 'react-aria';\nimport {QueuedToast, ToastQueue, ToastState, useToastQueue} from '@react-stately/toast';\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"}
|
package/dist/Tree.main.js
CHANGED
|
@@ -2,10 +2,9 @@ var $b856e6788a7ea5bf$exports = require("./Button.main.js");
|
|
|
2
2
|
var $525402dfec7da5bc$exports = require("./RSPContexts.main.js");
|
|
3
3
|
var $3114c2382242bdc0$exports = require("./Collection.main.js");
|
|
4
4
|
var $c5ccf687772c0422$exports = require("./utils.main.js");
|
|
5
|
-
var $5SMu3$
|
|
5
|
+
var $5SMu3$reactaria = require("react-aria");
|
|
6
6
|
var $5SMu3$reactariacollections = require("@react-aria/collections");
|
|
7
7
|
var $5SMu3$reactariautils = require("@react-aria/utils");
|
|
8
|
-
var $5SMu3$reactaria = require("react-aria");
|
|
9
8
|
var $5SMu3$reactstately = require("react-stately");
|
|
10
9
|
var $5SMu3$react = require("react");
|
|
11
10
|
var $5SMu3$reactstatelyutils = require("@react-stately/utils");
|
|
@@ -19,12 +18,12 @@ function $parcel$export(e, n, v, s) {
|
|
|
19
18
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
20
19
|
}
|
|
21
20
|
|
|
22
|
-
$parcel$export(module.exports, "
|
|
23
|
-
$parcel$export(module.exports, "
|
|
24
|
-
$parcel$export(module.exports, "
|
|
25
|
-
$parcel$export(module.exports, "
|
|
26
|
-
$parcel$export(module.exports, "
|
|
27
|
-
$parcel$export(module.exports, "
|
|
21
|
+
$parcel$export(module.exports, "TreeContext", () => $c6576bb58bfa084b$export$dfae7d399eea2568);
|
|
22
|
+
$parcel$export(module.exports, "TreeStateContext", () => $c6576bb58bfa084b$export$8953bccafd7bce87);
|
|
23
|
+
$parcel$export(module.exports, "Tree", () => $c6576bb58bfa084b$export$7fbedc92909ed28e);
|
|
24
|
+
$parcel$export(module.exports, "TreeItemContent", () => $c6576bb58bfa084b$export$4b687e3f663d618c);
|
|
25
|
+
$parcel$export(module.exports, "TreeItem", () => $c6576bb58bfa084b$export$53d36ab85dc89436);
|
|
26
|
+
$parcel$export(module.exports, "TreeLoadingIndicator", () => $c6576bb58bfa084b$export$4fd45771a49f0ea8);
|
|
28
27
|
/*
|
|
29
28
|
* Copyright 2024 Adobe. All rights reserved.
|
|
30
29
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -45,7 +44,6 @@ $parcel$export(module.exports, "UNSTABLE_TreeLoadingIndicator", () => $c6576bb58
|
|
|
45
44
|
|
|
46
45
|
|
|
47
46
|
|
|
48
|
-
|
|
49
47
|
class $c6576bb58bfa084b$var$TreeCollection {
|
|
50
48
|
// TODO: should this collection's getters reflect the flattened structure or the original structure
|
|
51
49
|
// If we respresent the flattened structure, it is easier for the keyboard nav but harder to find all the nodes
|
|
@@ -111,11 +109,11 @@ class $c6576bb58bfa084b$var$TreeCollection {
|
|
|
111
109
|
this.keyMap = keyMap;
|
|
112
110
|
}
|
|
113
111
|
}
|
|
114
|
-
const $c6576bb58bfa084b$export$
|
|
115
|
-
const $c6576bb58bfa084b$export$
|
|
116
|
-
const $c6576bb58bfa084b$export$
|
|
112
|
+
const $c6576bb58bfa084b$export$dfae7d399eea2568 = /*#__PURE__*/ (0, $5SMu3$react.createContext)(null);
|
|
113
|
+
const $c6576bb58bfa084b$export$8953bccafd7bce87 = /*#__PURE__*/ (0, $5SMu3$react.createContext)(null);
|
|
114
|
+
const $c6576bb58bfa084b$export$7fbedc92909ed28e = /*#__PURE__*/ (0, $5SMu3$react.forwardRef)(function Tree(props, ref) {
|
|
117
115
|
// Render the portal first so that we have the collection by the time we render the DOM in SSR.
|
|
118
|
-
[props, ref] = (0, $c5ccf687772c0422$exports.useContextProps)(props, ref, $c6576bb58bfa084b$export$
|
|
116
|
+
[props, ref] = (0, $c5ccf687772c0422$exports.useContextProps)(props, ref, $c6576bb58bfa084b$export$dfae7d399eea2568);
|
|
119
117
|
return /*#__PURE__*/ (0, ($parcel$interopDefault($5SMu3$react))).createElement((0, $5SMu3$reactariacollections.CollectionBuilder), {
|
|
120
118
|
content: /*#__PURE__*/ (0, ($parcel$interopDefault($5SMu3$react))).createElement((0, $5SMu3$reactariacollections.Collection), props)
|
|
121
119
|
}, (collection)=>/*#__PURE__*/ (0, ($parcel$interopDefault($5SMu3$react))).createElement($c6576bb58bfa084b$var$TreeInner, {
|
|
@@ -148,7 +146,7 @@ function $c6576bb58bfa084b$var$TreeInner({ props: props, collection: collection,
|
|
|
148
146
|
children: undefined,
|
|
149
147
|
disabledBehavior: disabledBehavior
|
|
150
148
|
});
|
|
151
|
-
let { gridProps: gridProps } = (0, $5SMu3$
|
|
149
|
+
let { gridProps: gridProps } = (0, $5SMu3$reactaria.useTree)({
|
|
152
150
|
...props,
|
|
153
151
|
isVirtualized: isVirtualized,
|
|
154
152
|
layoutDelegate: layoutDelegate
|
|
@@ -205,7 +203,7 @@ function $c6576bb58bfa084b$var$TreeInner({ props: props, collection: collection,
|
|
|
205
203
|
}, /*#__PURE__*/ (0, ($parcel$interopDefault($5SMu3$react))).createElement((0, $c5ccf687772c0422$exports.Provider), {
|
|
206
204
|
values: [
|
|
207
205
|
[
|
|
208
|
-
$c6576bb58bfa084b$export$
|
|
206
|
+
$c6576bb58bfa084b$export$8953bccafd7bce87,
|
|
209
207
|
state
|
|
210
208
|
]
|
|
211
209
|
]
|
|
@@ -215,7 +213,7 @@ function $c6576bb58bfa084b$var$TreeInner({ props: props, collection: collection,
|
|
|
215
213
|
scrollRef: ref
|
|
216
214
|
})), emptyState));
|
|
217
215
|
}
|
|
218
|
-
const $c6576bb58bfa084b$export$
|
|
216
|
+
const $c6576bb58bfa084b$export$4b687e3f663d618c = /*#__PURE__*/ (0, $5SMu3$reactariacollections.createLeafComponent)('content', function TreeItemContent(props) {
|
|
219
217
|
let values = (0, $5SMu3$react.useContext)($c6576bb58bfa084b$export$36b5dda0d9bc8f78);
|
|
220
218
|
let renderProps = (0, $c5ccf687772c0422$exports.useRenderProps)({
|
|
221
219
|
children: props.children,
|
|
@@ -226,13 +224,13 @@ const $c6576bb58bfa084b$export$c6dbc5e1eadc6d13 = /*#__PURE__*/ (0, $5SMu3$react
|
|
|
226
224
|
}, renderProps.children);
|
|
227
225
|
});
|
|
228
226
|
const $c6576bb58bfa084b$export$36b5dda0d9bc8f78 = /*#__PURE__*/ (0, $5SMu3$react.createContext)(null);
|
|
229
|
-
const $c6576bb58bfa084b$export$
|
|
227
|
+
const $c6576bb58bfa084b$export$53d36ab85dc89436 = /*#__PURE__*/ (0, $5SMu3$reactariacollections.createBranchComponent)('item', (props, ref, item)=>{
|
|
230
228
|
var _this;
|
|
231
|
-
let state = (0, $5SMu3$react.useContext)($c6576bb58bfa084b$export$
|
|
229
|
+
let state = (0, $5SMu3$react.useContext)($c6576bb58bfa084b$export$8953bccafd7bce87);
|
|
232
230
|
ref = (0, $5SMu3$reactariautils.useObjectRef)(ref);
|
|
233
231
|
// TODO: remove this when we support description in tree row
|
|
234
232
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
235
|
-
let { rowProps: rowProps, gridCellProps: gridCellProps, expandButtonProps: expandButtonProps, descriptionProps: descriptionProps, ...states } = (0, $5SMu3$
|
|
233
|
+
let { rowProps: rowProps, gridCellProps: gridCellProps, expandButtonProps: expandButtonProps, descriptionProps: descriptionProps, ...states } = (0, $5SMu3$reactaria.useTreeItem)({
|
|
236
234
|
node: item
|
|
237
235
|
}, state, ref);
|
|
238
236
|
let isExpanded = rowProps['aria-expanded'] === true;
|
|
@@ -253,6 +251,8 @@ const $c6576bb58bfa084b$export$635b3358b7a3dfbb = /*#__PURE__*/ (0, $5SMu3$react
|
|
|
253
251
|
let { checkboxProps: checkboxProps } = (0, $5SMu3$reactaria.useGridListSelectionCheckbox)({
|
|
254
252
|
key: item.key
|
|
255
253
|
}, state);
|
|
254
|
+
let selectionMode = state.selectionManager.selectionMode;
|
|
255
|
+
let selectionBehavior = state.selectionManager.selectionBehavior;
|
|
256
256
|
let renderPropValues = (0, ($parcel$interopDefault($5SMu3$react))).useMemo(()=>({
|
|
257
257
|
...states,
|
|
258
258
|
isHovered: isHovered,
|
|
@@ -260,8 +260,8 @@ const $c6576bb58bfa084b$export$635b3358b7a3dfbb = /*#__PURE__*/ (0, $5SMu3$react
|
|
|
260
260
|
isExpanded: isExpanded,
|
|
261
261
|
hasChildItems: hasChildItems,
|
|
262
262
|
level: level,
|
|
263
|
-
selectionMode:
|
|
264
|
-
selectionBehavior:
|
|
263
|
+
selectionMode: selectionMode,
|
|
264
|
+
selectionBehavior: selectionBehavior,
|
|
265
265
|
isFocusVisibleWithin: isFocusVisibleWithin,
|
|
266
266
|
state: state,
|
|
267
267
|
id: item.key
|
|
@@ -269,7 +269,8 @@ const $c6576bb58bfa084b$export$635b3358b7a3dfbb = /*#__PURE__*/ (0, $5SMu3$react
|
|
|
269
269
|
states,
|
|
270
270
|
isHovered,
|
|
271
271
|
isFocusVisible,
|
|
272
|
-
|
|
272
|
+
selectionMode,
|
|
273
|
+
selectionBehavior,
|
|
273
274
|
isExpanded,
|
|
274
275
|
hasChildItems,
|
|
275
276
|
level,
|
|
@@ -367,11 +368,11 @@ const $c6576bb58bfa084b$export$635b3358b7a3dfbb = /*#__PURE__*/ (0, $5SMu3$react
|
|
|
367
368
|
]
|
|
368
369
|
}, children))));
|
|
369
370
|
});
|
|
370
|
-
const $c6576bb58bfa084b$export$
|
|
371
|
-
let state = (0, $5SMu3$react.useContext)($c6576bb58bfa084b$export$
|
|
371
|
+
const $c6576bb58bfa084b$export$4fd45771a49f0ea8 = (0, $5SMu3$reactariacollections.createLeafComponent)('loader', function TreeLoader(props, ref, item) {
|
|
372
|
+
let state = (0, $5SMu3$react.useContext)($c6576bb58bfa084b$export$8953bccafd7bce87);
|
|
372
373
|
// This loader row is is non-interactable, but we want the same aria props calculated as a typical row
|
|
373
374
|
// @ts-ignore
|
|
374
|
-
let { rowProps: rowProps } = (0, $5SMu3$
|
|
375
|
+
let { rowProps: rowProps } = (0, $5SMu3$reactaria.useTreeItem)({
|
|
375
376
|
node: item
|
|
376
377
|
}, state, ref);
|
|
377
378
|
let level = rowProps['aria-level'] || 1;
|