react-aria-components 1.7.1 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/dist/Autocomplete.main.js.map +1 -1
  2. package/dist/Autocomplete.module.js.map +1 -1
  3. package/dist/Calendar.main.js +5 -7
  4. package/dist/Calendar.main.js.map +1 -1
  5. package/dist/Calendar.mjs +6 -8
  6. package/dist/Calendar.module.js +6 -8
  7. package/dist/Calendar.module.js.map +1 -1
  8. package/dist/Collection.main.js +1 -1
  9. package/dist/Collection.main.js.map +1 -1
  10. package/dist/Collection.mjs +1 -1
  11. package/dist/Collection.module.js +1 -1
  12. package/dist/Collection.module.js.map +1 -1
  13. package/dist/ColorPicker.main.js.map +1 -1
  14. package/dist/ColorPicker.module.js.map +1 -1
  15. package/dist/ColorWheel.main.js +3 -1
  16. package/dist/ColorWheel.main.js.map +1 -1
  17. package/dist/ColorWheel.mjs +3 -1
  18. package/dist/ColorWheel.module.js +3 -1
  19. package/dist/ColorWheel.module.js.map +1 -1
  20. package/dist/DateField.main.js +16 -9
  21. package/dist/DateField.main.js.map +1 -1
  22. package/dist/DateField.mjs +16 -9
  23. package/dist/DateField.module.js +16 -9
  24. package/dist/DateField.module.js.map +1 -1
  25. package/dist/Dialog.main.js +16 -2
  26. package/dist/Dialog.main.js.map +1 -1
  27. package/dist/Dialog.mjs +18 -4
  28. package/dist/Dialog.module.js +18 -4
  29. package/dist/Dialog.module.js.map +1 -1
  30. package/dist/DragAndDrop.main.js.map +1 -1
  31. package/dist/DragAndDrop.module.js.map +1 -1
  32. package/dist/GridList.main.js +61 -5
  33. package/dist/GridList.main.js.map +1 -1
  34. package/dist/GridList.mjs +62 -7
  35. package/dist/GridList.module.js +62 -7
  36. package/dist/GridList.module.js.map +1 -1
  37. package/dist/ListBox.main.js +63 -4
  38. package/dist/ListBox.main.js.map +1 -1
  39. package/dist/ListBox.mjs +64 -6
  40. package/dist/ListBox.module.js +64 -6
  41. package/dist/ListBox.module.js.map +1 -1
  42. package/dist/Menu.main.js.map +1 -1
  43. package/dist/Menu.module.js.map +1 -1
  44. package/dist/Modal.main.js.map +1 -1
  45. package/dist/Modal.module.js.map +1 -1
  46. package/dist/OverlayArrow.main.js +4 -1
  47. package/dist/OverlayArrow.main.js.map +1 -1
  48. package/dist/OverlayArrow.mjs +4 -1
  49. package/dist/OverlayArrow.module.js +4 -1
  50. package/dist/OverlayArrow.module.js.map +1 -1
  51. package/dist/Popover.main.js +1 -1
  52. package/dist/Popover.main.js.map +1 -1
  53. package/dist/Popover.mjs +1 -1
  54. package/dist/Popover.module.js +1 -1
  55. package/dist/Popover.module.js.map +1 -1
  56. package/dist/Select.main.js.map +1 -1
  57. package/dist/Select.module.js.map +1 -1
  58. package/dist/Separator.main.js +3 -2
  59. package/dist/Separator.main.js.map +1 -1
  60. package/dist/Separator.mjs +3 -2
  61. package/dist/Separator.module.js +3 -2
  62. package/dist/Separator.module.js.map +1 -1
  63. package/dist/Table.main.js +45 -12
  64. package/dist/Table.main.js.map +1 -1
  65. package/dist/Table.mjs +46 -13
  66. package/dist/Table.module.js +46 -13
  67. package/dist/Table.module.js.map +1 -1
  68. package/dist/TableLayout.main.js.map +1 -1
  69. package/dist/TableLayout.module.js.map +1 -1
  70. package/dist/TagGroup.main.js +2 -2
  71. package/dist/TagGroup.main.js.map +1 -1
  72. package/dist/TagGroup.mjs +2 -2
  73. package/dist/TagGroup.module.js +2 -2
  74. package/dist/TagGroup.module.js.map +1 -1
  75. package/dist/TextArea.main.js.map +1 -1
  76. package/dist/TextArea.module.js.map +1 -1
  77. package/dist/Toast.main.js +45 -16
  78. package/dist/Toast.main.js.map +1 -1
  79. package/dist/Toast.mjs +45 -18
  80. package/dist/Toast.module.js +45 -18
  81. package/dist/Toast.module.js.map +1 -1
  82. package/dist/Tooltip.main.js.map +1 -1
  83. package/dist/Tooltip.module.js.map +1 -1
  84. package/dist/Tree.main.js +2 -2
  85. package/dist/Tree.main.js.map +1 -1
  86. package/dist/Tree.mjs +2 -2
  87. package/dist/Tree.module.js +2 -2
  88. package/dist/Tree.module.js.map +1 -1
  89. package/dist/Virtualizer.main.js +0 -1
  90. package/dist/Virtualizer.main.js.map +1 -1
  91. package/dist/Virtualizer.mjs +0 -1
  92. package/dist/Virtualizer.module.js +0 -1
  93. package/dist/Virtualizer.module.js.map +1 -1
  94. package/dist/import.mjs +6 -6
  95. package/dist/main.js +6 -1
  96. package/dist/main.js.map +1 -1
  97. package/dist/module.js +6 -6
  98. package/dist/module.js.map +1 -1
  99. package/dist/types.d.ts +121 -45
  100. package/dist/types.d.ts.map +1 -1
  101. package/dist/utils.main.js.map +1 -1
  102. package/dist/utils.module.js.map +1 -1
  103. package/i18n/es-ES.js +1 -1
  104. package/i18n/es-ES.mjs +1 -1
  105. package/i18n/index.js +1 -1
  106. package/i18n/index.mjs +1 -1
  107. package/package.json +27 -25
  108. package/src/Autocomplete.tsx +2 -2
  109. package/src/Calendar.tsx +23 -11
  110. package/src/Collection.tsx +5 -2
  111. package/src/ColorPicker.tsx +2 -2
  112. package/src/ColorWheel.tsx +3 -1
  113. package/src/DateField.tsx +13 -9
  114. package/src/Dialog.tsx +19 -5
  115. package/src/DragAndDrop.tsx +4 -2
  116. package/src/GridList.tsx +73 -8
  117. package/src/ListBox.tsx +74 -7
  118. package/src/Menu.tsx +2 -1
  119. package/src/Modal.tsx +1 -0
  120. package/src/OverlayArrow.tsx +6 -3
  121. package/src/Popover.tsx +2 -1
  122. package/src/Select.tsx +7 -1
  123. package/src/Separator.tsx +3 -2
  124. package/src/Table.tsx +52 -19
  125. package/src/TableLayout.ts +1 -1
  126. package/src/TagGroup.tsx +2 -2
  127. package/src/TextArea.tsx +1 -1
  128. package/src/Toast.tsx +51 -13
  129. package/src/Tooltip.tsx +3 -2
  130. package/src/Tree.tsx +2 -2
  131. package/src/Virtualizer.tsx +3 -7
  132. package/src/index.ts +8 -8
  133. package/src/utils.tsx +8 -1
@@ -1,11 +1,13 @@
1
1
  import {ButtonContext as $d2b4bc8c273e7be6$export$24d547caef80ccd1} from "./Button.module.js";
2
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
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";
4
+ import {useToastRegion as $9il6O$useToastRegion, useFocusRing as $9il6O$useFocusRing, useHover as $9il6O$useHover, useLocale as $9il6O$useLocale, mergeProps as $9il6O$mergeProps, useToast as $9il6O$useToast} from "react-aria";
5
5
  import {createPortal as $9il6O$createPortal} from "react-dom";
6
6
  import {useToastQueue as $9il6O$useToastQueue} from "react-stately";
7
7
  import $9il6O$react, {createContext as $9il6O$createContext, forwardRef as $9il6O$forwardRef, useContext as $9il6O$useContext} from "react";
8
+ import {useIsSSR as $9il6O$useIsSSR} from "@react-aria/ssr";
8
9
  import {useObjectRef as $9il6O$useObjectRef} from "@react-aria/utils";
10
+ import {useUNSAFE_PortalContext as $9il6O$useUNSAFE_PortalContext} from "@react-aria/overlays";
9
11
 
10
12
  /*
11
13
  * Copyright 2025 Adobe. All rights reserved.
@@ -25,46 +27,71 @@ import {useObjectRef as $9il6O$useObjectRef} from "@react-aria/utils";
25
27
 
26
28
 
27
29
 
28
- const $692df8403b6ac2c7$var$ToastStateContext = /*#__PURE__*/ (0, $9il6O$createContext)(null);
30
+
31
+
32
+ const $692df8403b6ac2c7$export$e9e2a1fc7373c1e1 = /*#__PURE__*/ (0, $9il6O$createContext)(null);
29
33
  const $692df8403b6ac2c7$export$2cbf5519fbeaa538 = /*#__PURE__*/ (0, $9il6O$forwardRef)(function ToastRegion(props, ref) {
34
+ let isSSR = (0, $9il6O$useIsSSR)();
30
35
  let state = (0, $9il6O$useToastQueue)(props.queue);
31
36
  let objectRef = (0, $9il6O$useObjectRef)(ref);
32
37
  let { regionProps: regionProps } = (0, $9il6O$useToastRegion)(props, state, objectRef);
33
38
  let { focusProps: focusProps, isFocused: isFocused, isFocusVisible: isFocusVisible } = (0, $9il6O$useFocusRing)();
39
+ let { hoverProps: hoverProps, isHovered: isHovered } = (0, $9il6O$useHover)({});
34
40
  let renderProps = (0, $64fa3d84918910a7$export$4d86445c2cf5e3)({
35
41
  ...props,
36
42
  children: undefined,
37
43
  defaultClassName: 'react-aria-ToastRegion',
38
44
  values: {
39
45
  visibleToasts: state.visibleToasts,
46
+ isHovered: isHovered,
40
47
  isFocused: isFocused,
41
48
  isFocusVisible: isFocusVisible
42
49
  }
43
50
  });
44
- let region = /*#__PURE__*/ (0, $9il6O$react).createElement($692df8403b6ac2c7$var$ToastStateContext.Provider, {
51
+ let { direction: direction } = (0, $9il6O$useLocale)();
52
+ let portalContainer;
53
+ let { getContainer: getContainer } = (0, $9il6O$useUNSAFE_PortalContext)();
54
+ if (!isSSR) {
55
+ portalContainer = document.body;
56
+ if (getContainer) portalContainer = getContainer();
57
+ }
58
+ let region = /*#__PURE__*/ (0, $9il6O$react).createElement($692df8403b6ac2c7$export$e9e2a1fc7373c1e1.Provider, {
45
59
  value: state
46
60
  }, /*#__PURE__*/ (0, $9il6O$react).createElement("div", {
47
61
  ...renderProps,
48
- ...(0, $9il6O$mergeProps)(regionProps, focusProps),
62
+ ...(0, $9il6O$mergeProps)(regionProps, focusProps, hoverProps),
63
+ dir: direction,
49
64
  ref: objectRef,
65
+ "data-hovered": isHovered || undefined,
50
66
  "data-focused": isFocused || undefined,
51
67
  "data-focus-visible": isFocusVisible || undefined
52
- }, typeof props.children === 'function' ? /*#__PURE__*/ (0, $9il6O$react).createElement($692df8403b6ac2c7$var$ToastList, {
68
+ }, typeof props.children === 'function' ? /*#__PURE__*/ (0, $9il6O$react).createElement($692df8403b6ac2c7$export$c20d626a86a69756, {
53
69
  ...props,
70
+ className: undefined,
54
71
  style: {
55
72
  display: 'contents'
56
73
  }
57
- }) : props.children));
58
- return state.visibleToasts.length > 0 && typeof document !== 'undefined' ? /*#__PURE__*/ (0, $9il6O$createPortal)(region, document.body) : null;
74
+ }, props.children) : props.children));
75
+ return state.visibleToasts.length > 0 && portalContainer ? /*#__PURE__*/ (0, $9il6O$createPortal)(region, portalContainer) : null;
59
76
  });
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
77
+ const $692df8403b6ac2c7$export$c20d626a86a69756 = /*#__PURE__*/ (0, $9il6O$forwardRef)(function ToastList(props, ref) {
78
+ let state = (0, $9il6O$useContext)($692df8403b6ac2c7$export$e9e2a1fc7373c1e1);
79
+ let { hoverProps: hoverProps, isHovered: isHovered } = (0, $9il6O$useHover)({});
80
+ let renderProps = (0, $64fa3d84918910a7$export$4d86445c2cf5e3)({
81
+ ...props,
82
+ children: undefined,
83
+ defaultClassName: 'react-aria-ToastList',
84
+ values: {
85
+ visibleToasts: state.visibleToasts,
86
+ isFocused: false,
87
+ isFocusVisible: false,
88
+ isHovered: isHovered
89
+ }
90
+ });
91
+ return /*#__PURE__*/ (0, $9il6O$react).createElement("ol", {
92
+ ...hoverProps,
93
+ ...renderProps,
94
+ ref: ref
68
95
  }, state.visibleToasts.map((toast)=>/*#__PURE__*/ (0, $9il6O$react).createElement("li", {
69
96
  key: toast.key,
70
97
  style: {
@@ -72,10 +99,10 @@ const $692df8403b6ac2c7$var$ToastList = /*#__PURE__*/ (0, $9il6O$forwardRef)(fun
72
99
  }
73
100
  }, props.children({
74
101
  toast: toast
75
- })))));
102
+ }))));
76
103
  });
77
104
  const $692df8403b6ac2c7$export$8d8dc7d5f743331b = /*#__PURE__*/ (0, $9il6O$forwardRef)(function Toast(props, ref) {
78
- let state = (0, $9il6O$useContext)($692df8403b6ac2c7$var$ToastStateContext);
105
+ let state = (0, $9il6O$useContext)($692df8403b6ac2c7$export$e9e2a1fc7373c1e1);
79
106
  let objectRef = (0, $9il6O$useObjectRef)(ref);
80
107
  let { toastProps: toastProps, contentProps: contentProps, titleProps: titleProps, descriptionProps: descriptionProps, closeButtonProps: closeButtonProps } = (0, $9il6O$useToast)(props, state, objectRef);
81
108
  let { focusProps: focusProps, isFocused: isFocused, isFocusVisible: isFocusVisible } = (0, $9il6O$useFocusRing)();
@@ -133,5 +160,5 @@ const $692df8403b6ac2c7$export$b134a6cc89b08851 = /*#__PURE__*/ (0, $9il6O$forwa
133
160
  });
134
161
 
135
162
 
136
- export {$692df8403b6ac2c7$export$2cbf5519fbeaa538 as ToastRegion, $692df8403b6ac2c7$export$8d8dc7d5f743331b as Toast, $692df8403b6ac2c7$export$3a0d85872d9f73f2 as ToastContentContext, $692df8403b6ac2c7$export$b134a6cc89b08851 as ToastContent};
163
+ export {$692df8403b6ac2c7$export$e9e2a1fc7373c1e1 as ToastStateContext, $692df8403b6ac2c7$export$2cbf5519fbeaa538 as ToastRegion, $692df8403b6ac2c7$export$c20d626a86a69756 as ToastList, $692df8403b6ac2c7$export$8d8dc7d5f743331b as Toast, $692df8403b6ac2c7$export$3a0d85872d9f73f2 as ToastContentContext, $692df8403b6ac2c7$export$b134a6cc89b08851 as ToastContent};
137
164
  //# sourceMappingURL=Toast.module.js.map
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAYD,MAAM,wDAAoB,CAAA,GAAA,oBAAY,EAA0B;AA2BzD,MAAM,4CAA4B,AAAd,WAAW,GAAI,CAAA,GAAA,iBAA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C;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"}
1
+ {"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;AAcM,MAAM,0DAAoB,CAAA,GAAA,oBAAY,EAA0B;AAgChE,MAAM,4CAA4B,AAAd,WAAW,GAAI,CAAA,GAAA,iBAAS,EAAqB,SAAS,YAAe,KAA0B,EAAE,GAAiC;IAC3J,IAAI,QAAQ,CAAA,GAA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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, useHover, useLocale, 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, ReactNode, useContext} from 'react';\nimport {TextContext} from './Text';\nimport {useIsSSR} from '@react-aria/ssr';\nimport {useObjectRef} from '@react-aria/utils';\nimport {useUNSAFE_PortalContext} from '@react-aria/overlays';\n\nexport const 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 hovered with a mouse.\n * @selector [data-hovered]\n */\n isHovered: boolean,\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, or children containing a `<ToastList>`. */\n children: ReactNode | ((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 isSSR = useIsSSR();\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 {hoverProps, isHovered} = useHover({});\n let renderProps = useRenderProps({\n ...props,\n children: undefined,\n defaultClassName: 'react-aria-ToastRegion',\n values: {\n visibleToasts: state.visibleToasts,\n isHovered,\n isFocused,\n isFocusVisible\n }\n });\n\n let {direction} = useLocale();\n let portalContainer;\n let {getContainer} = useUNSAFE_PortalContext();\n if (!isSSR) {\n portalContainer = document.body;\n if (getContainer) {\n portalContainer = getContainer();\n }\n }\n\n let region = (\n <ToastStateContext.Provider value={state}>\n <div\n {...renderProps}\n {...mergeProps(regionProps, focusProps, hoverProps)}\n dir={direction}\n ref={objectRef}\n data-hovered={isHovered || undefined}\n data-focused={isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined}>\n {typeof props.children === 'function' ? <ToastList {...props} className={undefined} style={{display: 'contents'}}>{props.children}</ToastList> : props.children}\n </div>\n </ToastStateContext.Provider>\n );\n\n return state.visibleToasts.length > 0 && portalContainer\n ? createPortal(region, portalContainer)\n : null;\n});\n\nexport interface ToastListProps<T> extends Omit<ToastRegionProps<T>, 'queue' | 'children'> {\n /** A function to render each toast. */\n children: (renderProps: {toast: QueuedToast<T>}) => ReactElement\n}\n\nexport const ToastList = /*#__PURE__*/ (forwardRef as forwardRefType)(function ToastList<T>(props: ToastListProps<T>, ref: ForwardedRef<HTMLOListElement>) {\n let state = useContext(ToastStateContext)!;\n let {hoverProps, isHovered} = useHover({});\n let renderProps = useRenderProps({\n ...props,\n children: undefined,\n defaultClassName: 'react-aria-ToastList',\n values: {\n visibleToasts: state.visibleToasts,\n isFocused: false,\n isFocusVisible: false,\n isHovered\n }\n });\n\n return (\n <ol {...hoverProps} {...renderProps} ref={ref}>\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"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAgEM,MAAM,0DAA6B,CAAA,GAAA,0BAAY,EAA8B;AAC7E,MAAM,0DAAiB,CAAA,GAAA,0BAAY,EAA8C;AAOjF,SAAS,0CAAe,KAAmC;IAChE,IAAI,QAAQ,CAAA,GAAA,0CAAqB,EAAE;IACnC,IAAI,MAAM,CAAA,GAAA,mBAAK,EAAoB;IACnC,IAAI,gBAAC,YAAY,gBAAE,YAA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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 {AriaLabelingProps, FocusableElement, forwardRefType, RefObject} from '@react-types/shared';\nimport {AriaPositionProps, mergeProps, OverlayContainer, Placement, PlacementAxis, PositionProps, useOverlayPosition, useTooltip, useTooltipTrigger} from 'react-aria';\nimport {ContextValue, Provider, RenderProps, useContextProps, useRenderProps} from './utils';\nimport {FocusableProvider} from '@react-aria/focus';\nimport {OverlayArrowContext} from './OverlayArrow';\nimport {OverlayTriggerProps, TooltipTriggerProps, TooltipTriggerState, useTooltipTriggerState} from 'react-stately';\nimport React, {createContext, ForwardedRef, forwardRef, ReactNode, useContext, useRef, useState} from 'react';\nimport {useEnterAnimation, useExitAnimation, useLayoutEffect} from '@react-aria/utils';\n\nexport interface TooltipTriggerComponentProps extends TooltipTriggerProps {\n children: ReactNode\n}\n\nexport interface TooltipProps extends PositionProps, Pick<AriaPositionProps, 'arrowBoundaryOffset'>, OverlayTriggerProps, AriaLabelingProps, RenderProps<TooltipRenderProps> {\n /**\n * The ref for the element which the tooltip positions itself with respect to.\n *\n * When used within a TooltipTrigger this is set automatically. It is only required when used standalone.\n */\n triggerRef?: RefObject<Element | null>,\n /**\n * Whether the tooltip is currently performing an entry animation.\n */\n isEntering?: boolean,\n /**\n * Whether the tooltip is currently performing an exit animation.\n */\n isExiting?: boolean,\n /**\n * The container element in which the overlay portal will be placed. This may have unknown behavior depending on where it is portalled to.\n * @default document.body\n */\n UNSTABLE_portalContainer?: Element,\n /**\n * The placement of the tooltip with respect to the trigger.\n * @default 'top'\n */\n placement?: Placement\n}\n\nexport interface TooltipRenderProps {\n /**\n * The placement of the tooltip relative to the trigger.\n * @selector [data-placement=\"left | right | top | bottom\"]\n */\n placement: PlacementAxis | null,\n /**\n * Whether the tooltip is currently entering. Use this to apply animations.\n * @selector [data-entering]\n */\n isEntering: boolean,\n /**\n * Whether the tooltip is currently exiting. Use this to apply animations.\n * @selector [data-exiting]\n */\n isExiting: boolean,\n /**\n * State of the tooltip.\n */\n state: TooltipTriggerState\n}\n\nexport const TooltipTriggerStateContext = createContext<TooltipTriggerState | null>(null);\nexport const TooltipContext = createContext<ContextValue<TooltipProps, HTMLDivElement>>(null);\n\n/**\n * TooltipTrigger wraps around a trigger element and a Tooltip. It handles opening and closing\n * the Tooltip when the user hovers over or focuses the trigger, and positioning the Tooltip\n * relative to the trigger.\n */\nexport function TooltipTrigger(props: TooltipTriggerComponentProps) {\n let state = useTooltipTriggerState(props);\n let ref = useRef<FocusableElement>(null);\n let {triggerProps, tooltipProps} = useTooltipTrigger(props, state, ref);\n\n return (\n <Provider\n values={[\n [TooltipTriggerStateContext, state],\n [TooltipContext, {...tooltipProps, triggerRef: ref}]\n ]}>\n <FocusableProvider {...triggerProps} ref={ref}>\n {props.children}\n </FocusableProvider>\n </Provider>\n );\n}\n\n/**\n * A tooltip displays a description of an element on hover or focus.\n */\nexport const Tooltip = /*#__PURE__*/ (forwardRef as forwardRefType)(function Tooltip({UNSTABLE_portalContainer, ...props}: TooltipProps, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, TooltipContext);\n let contextState = useContext(TooltipTriggerStateContext);\n let localState = useTooltipTriggerState(props);\n let state = props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;\n let isExiting = useExitAnimation(ref, state.isOpen) || props.isExiting || false;\n if (!state.isOpen && !isExiting) {\n return null;\n }\n\n return (\n <OverlayContainer portalContainer={UNSTABLE_portalContainer}>\n <TooltipInner {...props} tooltipRef={ref} isExiting={isExiting} />\n </OverlayContainer>\n );\n});\n\nfunction TooltipInner(props: TooltipProps & {isExiting: boolean, tooltipRef: RefObject<HTMLDivElement | null>}) {\n let state = useContext(TooltipTriggerStateContext)!;\n\n // Calculate the arrow size internally\n // Referenced from: packages/@react-spectrum/tooltip/src/TooltipTrigger.tsx\n let arrowRef = useRef<HTMLDivElement>(null);\n let [arrowWidth, setArrowWidth] = useState(0);\n useLayoutEffect(() => {\n if (arrowRef.current && state.isOpen) {\n setArrowWidth(arrowRef.current.getBoundingClientRect().width);\n }\n }, [state.isOpen, arrowRef]);\n\n let {overlayProps, arrowProps, placement} = useOverlayPosition({\n placement: props.placement || 'top',\n targetRef: props.triggerRef!,\n overlayRef: props.tooltipRef,\n offset: props.offset,\n crossOffset: props.crossOffset,\n isOpen: state.isOpen,\n arrowSize: arrowWidth,\n arrowBoundaryOffset: props.arrowBoundaryOffset,\n shouldFlip: props.shouldFlip,\n onClose: () => state.close(true)\n });\n\n let isEntering = useEnterAnimation(props.tooltipRef, !!placement) || props.isEntering || false;\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Tooltip',\n values: {\n placement,\n isEntering,\n isExiting: props.isExiting,\n state\n }\n });\n\n props = mergeProps(props, overlayProps);\n let {tooltipProps} = useTooltip(props, state);\n\n return (\n <div\n {...tooltipProps}\n ref={props.tooltipRef}\n {...renderProps}\n style={{...overlayProps.style, ...renderProps.style}}\n data-placement={placement ?? undefined}\n data-entering={isEntering || undefined}\n data-exiting={props.isExiting || undefined}>\n <OverlayArrowContext.Provider value={{...arrowProps, placement, ref: arrowRef}}>\n {renderProps.children}\n </OverlayArrowContext.Provider>\n </div>\n );\n}\n"],"names":[],"version":3,"file":"Tooltip.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAiEM,MAAM,0DAA6B,CAAA,GAAA,0BAAY,EAA8B;AAC7E,MAAM,0DAAiB,CAAA,GAAA,0BAAY,EAA8C;AAOjF,SAAS,0CAAe,KAAmC;IAChE,IAAI,QAAQ,CAAA,GAAA,0CAAqB,EAAE;IACnC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react-aria-components/src/Tooltip.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 {AriaLabelingProps, FocusableElement, forwardRefType, RefObject} from '@react-types/shared';\nimport {AriaPositionProps, mergeProps, OverlayContainer, Placement, PlacementAxis, PositionProps, useOverlayPosition, useTooltip, useTooltipTrigger} from 'react-aria';\nimport {ContextValue, Provider, RenderProps, useContextProps, useRenderProps} from './utils';\nimport {FocusableProvider} from '@react-aria/focus';\nimport {OverlayArrowContext} from './OverlayArrow';\nimport {OverlayTriggerProps, TooltipTriggerProps, TooltipTriggerState, useTooltipTriggerState} from 'react-stately';\nimport React, {createContext, ForwardedRef, forwardRef, JSX, ReactNode, useContext, useRef, useState} from 'react';\nimport {useEnterAnimation, useExitAnimation, useLayoutEffect} from '@react-aria/utils';\n\nexport interface TooltipTriggerComponentProps extends TooltipTriggerProps {\n children: ReactNode\n}\n\nexport interface TooltipProps extends PositionProps, Pick<AriaPositionProps, 'arrowBoundaryOffset'>, OverlayTriggerProps, AriaLabelingProps, RenderProps<TooltipRenderProps> {\n /**\n * The ref for the element which the tooltip positions itself with respect to.\n *\n * When used within a TooltipTrigger this is set automatically. It is only required when used standalone.\n */\n triggerRef?: RefObject<Element | null>,\n /**\n * Whether the tooltip is currently performing an entry animation.\n */\n isEntering?: boolean,\n /**\n * Whether the tooltip is currently performing an exit animation.\n */\n isExiting?: boolean,\n /**\n * The container element in which the overlay portal will be placed. This may have unknown behavior depending on where it is portalled to.\n * @default document.body\n * @deprecated - Use a parent UNSAFE_PortalProvider to set your portal container instead.\n */\n UNSTABLE_portalContainer?: Element,\n /**\n * The placement of the tooltip with respect to the trigger.\n * @default 'top'\n */\n placement?: Placement\n}\n\nexport interface TooltipRenderProps {\n /**\n * The placement of the tooltip relative to the trigger.\n * @selector [data-placement=\"left | right | top | bottom\"]\n */\n placement: PlacementAxis | null,\n /**\n * Whether the tooltip is currently entering. Use this to apply animations.\n * @selector [data-entering]\n */\n isEntering: boolean,\n /**\n * Whether the tooltip is currently exiting. Use this to apply animations.\n * @selector [data-exiting]\n */\n isExiting: boolean,\n /**\n * State of the tooltip.\n */\n state: TooltipTriggerState\n}\n\nexport const TooltipTriggerStateContext = createContext<TooltipTriggerState | null>(null);\nexport const TooltipContext = createContext<ContextValue<TooltipProps, HTMLDivElement>>(null);\n\n/**\n * TooltipTrigger wraps around a trigger element and a Tooltip. It handles opening and closing\n * the Tooltip when the user hovers over or focuses the trigger, and positioning the Tooltip\n * relative to the trigger.\n */\nexport function TooltipTrigger(props: TooltipTriggerComponentProps): JSX.Element {\n let state = useTooltipTriggerState(props);\n let ref = useRef<FocusableElement>(null);\n let {triggerProps, tooltipProps} = useTooltipTrigger(props, state, ref);\n\n return (\n <Provider\n values={[\n [TooltipTriggerStateContext, state],\n [TooltipContext, {...tooltipProps, triggerRef: ref}]\n ]}>\n <FocusableProvider {...triggerProps} ref={ref}>\n {props.children}\n </FocusableProvider>\n </Provider>\n );\n}\n\n/**\n * A tooltip displays a description of an element on hover or focus.\n */\nexport const Tooltip = /*#__PURE__*/ (forwardRef as forwardRefType)(function Tooltip({UNSTABLE_portalContainer, ...props}: TooltipProps, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, TooltipContext);\n let contextState = useContext(TooltipTriggerStateContext);\n let localState = useTooltipTriggerState(props);\n let state = props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;\n let isExiting = useExitAnimation(ref, state.isOpen) || props.isExiting || false;\n if (!state.isOpen && !isExiting) {\n return null;\n }\n\n return (\n <OverlayContainer portalContainer={UNSTABLE_portalContainer}>\n <TooltipInner {...props} tooltipRef={ref} isExiting={isExiting} />\n </OverlayContainer>\n );\n});\n\nfunction TooltipInner(props: TooltipProps & {isExiting: boolean, tooltipRef: RefObject<HTMLDivElement | null>}) {\n let state = useContext(TooltipTriggerStateContext)!;\n\n // Calculate the arrow size internally\n // Referenced from: packages/@react-spectrum/tooltip/src/TooltipTrigger.tsx\n let arrowRef = useRef<HTMLDivElement>(null);\n let [arrowWidth, setArrowWidth] = useState(0);\n useLayoutEffect(() => {\n if (arrowRef.current && state.isOpen) {\n setArrowWidth(arrowRef.current.getBoundingClientRect().width);\n }\n }, [state.isOpen, arrowRef]);\n\n let {overlayProps, arrowProps, placement} = useOverlayPosition({\n placement: props.placement || 'top',\n targetRef: props.triggerRef!,\n overlayRef: props.tooltipRef,\n offset: props.offset,\n crossOffset: props.crossOffset,\n isOpen: state.isOpen,\n arrowSize: arrowWidth,\n arrowBoundaryOffset: props.arrowBoundaryOffset,\n shouldFlip: props.shouldFlip,\n onClose: () => state.close(true)\n });\n\n let isEntering = useEnterAnimation(props.tooltipRef, !!placement) || props.isEntering || false;\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Tooltip',\n values: {\n placement,\n isEntering,\n isExiting: props.isExiting,\n state\n }\n });\n\n props = mergeProps(props, overlayProps);\n let {tooltipProps} = useTooltip(props, state);\n\n return (\n <div\n {...tooltipProps}\n ref={props.tooltipRef}\n {...renderProps}\n style={{...overlayProps.style, ...renderProps.style}}\n data-placement={placement ?? undefined}\n data-entering={isEntering || undefined}\n data-exiting={props.isExiting || undefined}>\n <OverlayArrowContext.Provider value={{...arrowProps, placement, ref: arrowRef}}>\n {renderProps.children}\n </OverlayArrowContext.Provider>\n </div>\n );\n}\n"],"names":[],"version":3,"file":"Tooltip.main.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAgEM,MAAM,0DAA6B,CAAA,GAAA,oBAAY,EAA8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AAA,GAAA,yCAAkB,EAAE,QAAQ;QAAC,OAAO;YAAC,GAAG,UAAU;uBAAE;YAAW,KAAK;QAAQ;OAC1E,YAAY,QAAQ;AAI7B","sources":["packages/react-aria-components/src/Tooltip.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 {AriaLabelingProps, FocusableElement, forwardRefType, RefObject} from '@react-types/shared';\nimport {AriaPositionProps, mergeProps, OverlayContainer, Placement, PlacementAxis, PositionProps, useOverlayPosition, useTooltip, useTooltipTrigger} from 'react-aria';\nimport {ContextValue, Provider, RenderProps, useContextProps, useRenderProps} from './utils';\nimport {FocusableProvider} from '@react-aria/focus';\nimport {OverlayArrowContext} from './OverlayArrow';\nimport {OverlayTriggerProps, TooltipTriggerProps, TooltipTriggerState, useTooltipTriggerState} from 'react-stately';\nimport React, {createContext, ForwardedRef, forwardRef, ReactNode, useContext, useRef, useState} from 'react';\nimport {useEnterAnimation, useExitAnimation, useLayoutEffect} from '@react-aria/utils';\n\nexport interface TooltipTriggerComponentProps extends TooltipTriggerProps {\n children: ReactNode\n}\n\nexport interface TooltipProps extends PositionProps, Pick<AriaPositionProps, 'arrowBoundaryOffset'>, OverlayTriggerProps, AriaLabelingProps, RenderProps<TooltipRenderProps> {\n /**\n * The ref for the element which the tooltip positions itself with respect to.\n *\n * When used within a TooltipTrigger this is set automatically. It is only required when used standalone.\n */\n triggerRef?: RefObject<Element | null>,\n /**\n * Whether the tooltip is currently performing an entry animation.\n */\n isEntering?: boolean,\n /**\n * Whether the tooltip is currently performing an exit animation.\n */\n isExiting?: boolean,\n /**\n * The container element in which the overlay portal will be placed. This may have unknown behavior depending on where it is portalled to.\n * @default document.body\n */\n UNSTABLE_portalContainer?: Element,\n /**\n * The placement of the tooltip with respect to the trigger.\n * @default 'top'\n */\n placement?: Placement\n}\n\nexport interface TooltipRenderProps {\n /**\n * The placement of the tooltip relative to the trigger.\n * @selector [data-placement=\"left | right | top | bottom\"]\n */\n placement: PlacementAxis | null,\n /**\n * Whether the tooltip is currently entering. Use this to apply animations.\n * @selector [data-entering]\n */\n isEntering: boolean,\n /**\n * Whether the tooltip is currently exiting. Use this to apply animations.\n * @selector [data-exiting]\n */\n isExiting: boolean,\n /**\n * State of the tooltip.\n */\n state: TooltipTriggerState\n}\n\nexport const TooltipTriggerStateContext = createContext<TooltipTriggerState | null>(null);\nexport const TooltipContext = createContext<ContextValue<TooltipProps, HTMLDivElement>>(null);\n\n/**\n * TooltipTrigger wraps around a trigger element and a Tooltip. It handles opening and closing\n * the Tooltip when the user hovers over or focuses the trigger, and positioning the Tooltip\n * relative to the trigger.\n */\nexport function TooltipTrigger(props: TooltipTriggerComponentProps) {\n let state = useTooltipTriggerState(props);\n let ref = useRef<FocusableElement>(null);\n let {triggerProps, tooltipProps} = useTooltipTrigger(props, state, ref);\n\n return (\n <Provider\n values={[\n [TooltipTriggerStateContext, state],\n [TooltipContext, {...tooltipProps, triggerRef: ref}]\n ]}>\n <FocusableProvider {...triggerProps} ref={ref}>\n {props.children}\n </FocusableProvider>\n </Provider>\n );\n}\n\n/**\n * A tooltip displays a description of an element on hover or focus.\n */\nexport const Tooltip = /*#__PURE__*/ (forwardRef as forwardRefType)(function Tooltip({UNSTABLE_portalContainer, ...props}: TooltipProps, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, TooltipContext);\n let contextState = useContext(TooltipTriggerStateContext);\n let localState = useTooltipTriggerState(props);\n let state = props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;\n let isExiting = useExitAnimation(ref, state.isOpen) || props.isExiting || false;\n if (!state.isOpen && !isExiting) {\n return null;\n }\n\n return (\n <OverlayContainer portalContainer={UNSTABLE_portalContainer}>\n <TooltipInner {...props} tooltipRef={ref} isExiting={isExiting} />\n </OverlayContainer>\n );\n});\n\nfunction TooltipInner(props: TooltipProps & {isExiting: boolean, tooltipRef: RefObject<HTMLDivElement | null>}) {\n let state = useContext(TooltipTriggerStateContext)!;\n\n // Calculate the arrow size internally\n // Referenced from: packages/@react-spectrum/tooltip/src/TooltipTrigger.tsx\n let arrowRef = useRef<HTMLDivElement>(null);\n let [arrowWidth, setArrowWidth] = useState(0);\n useLayoutEffect(() => {\n if (arrowRef.current && state.isOpen) {\n setArrowWidth(arrowRef.current.getBoundingClientRect().width);\n }\n }, [state.isOpen, arrowRef]);\n\n let {overlayProps, arrowProps, placement} = useOverlayPosition({\n placement: props.placement || 'top',\n targetRef: props.triggerRef!,\n overlayRef: props.tooltipRef,\n offset: props.offset,\n crossOffset: props.crossOffset,\n isOpen: state.isOpen,\n arrowSize: arrowWidth,\n arrowBoundaryOffset: props.arrowBoundaryOffset,\n shouldFlip: props.shouldFlip,\n onClose: () => state.close(true)\n });\n\n let isEntering = useEnterAnimation(props.tooltipRef, !!placement) || props.isEntering || false;\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Tooltip',\n values: {\n placement,\n isEntering,\n isExiting: props.isExiting,\n state\n }\n });\n\n props = mergeProps(props, overlayProps);\n let {tooltipProps} = useTooltip(props, state);\n\n return (\n <div\n {...tooltipProps}\n ref={props.tooltipRef}\n {...renderProps}\n style={{...overlayProps.style, ...renderProps.style}}\n data-placement={placement ?? undefined}\n data-entering={isEntering || undefined}\n data-exiting={props.isExiting || undefined}>\n <OverlayArrowContext.Provider value={{...arrowProps, placement, ref: arrowRef}}>\n {renderProps.children}\n </OverlayArrowContext.Provider>\n </div>\n );\n}\n"],"names":[],"version":3,"file":"Tooltip.module.js.map"}
1
+ {"mappings":";;;;;;;;AAAA;;;;;;;;;;CA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e,cAAc;QAC7B,gBAAc,MAAM,SAAS,IAAI;qBACjC,gCAAC,CAAA,GAAA,yCAAkB,EAAE,QAAQ;QAAC,OAAO;YAAC,GAAG,UAAU;uBAAE;YAAW,KAAK;QAAQ;OAC1E,YAAY,QAAQ;AAI7B","sources":["packages/react-aria-components/src/Tooltip.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 {AriaLabelingProps, FocusableElement, forwardRefType, RefObject} from '@react-types/shared';\nimport {AriaPositionProps, mergeProps, OverlayContainer, Placement, PlacementAxis, PositionProps, useOverlayPosition, useTooltip, useTooltipTrigger} from 'react-aria';\nimport {ContextValue, Provider, RenderProps, useContextProps, useRenderProps} from './utils';\nimport {FocusableProvider} from '@react-aria/focus';\nimport {OverlayArrowContext} from './OverlayArrow';\nimport {OverlayTriggerProps, TooltipTriggerProps, TooltipTriggerState, useTooltipTriggerState} from 'react-stately';\nimport React, {createContext, ForwardedRef, forwardRef, JSX, ReactNode, useContext, useRef, useState} from 'react';\nimport {useEnterAnimation, useExitAnimation, useLayoutEffect} from '@react-aria/utils';\n\nexport interface TooltipTriggerComponentProps extends TooltipTriggerProps {\n children: ReactNode\n}\n\nexport interface TooltipProps extends PositionProps, Pick<AriaPositionProps, 'arrowBoundaryOffset'>, OverlayTriggerProps, AriaLabelingProps, RenderProps<TooltipRenderProps> {\n /**\n * The ref for the element which the tooltip positions itself with respect to.\n *\n * When used within a TooltipTrigger this is set automatically. It is only required when used standalone.\n */\n triggerRef?: RefObject<Element | null>,\n /**\n * Whether the tooltip is currently performing an entry animation.\n */\n isEntering?: boolean,\n /**\n * Whether the tooltip is currently performing an exit animation.\n */\n isExiting?: boolean,\n /**\n * The container element in which the overlay portal will be placed. This may have unknown behavior depending on where it is portalled to.\n * @default document.body\n * @deprecated - Use a parent UNSAFE_PortalProvider to set your portal container instead.\n */\n UNSTABLE_portalContainer?: Element,\n /**\n * The placement of the tooltip with respect to the trigger.\n * @default 'top'\n */\n placement?: Placement\n}\n\nexport interface TooltipRenderProps {\n /**\n * The placement of the tooltip relative to the trigger.\n * @selector [data-placement=\"left | right | top | bottom\"]\n */\n placement: PlacementAxis | null,\n /**\n * Whether the tooltip is currently entering. Use this to apply animations.\n * @selector [data-entering]\n */\n isEntering: boolean,\n /**\n * Whether the tooltip is currently exiting. Use this to apply animations.\n * @selector [data-exiting]\n */\n isExiting: boolean,\n /**\n * State of the tooltip.\n */\n state: TooltipTriggerState\n}\n\nexport const TooltipTriggerStateContext = createContext<TooltipTriggerState | null>(null);\nexport const TooltipContext = createContext<ContextValue<TooltipProps, HTMLDivElement>>(null);\n\n/**\n * TooltipTrigger wraps around a trigger element and a Tooltip. It handles opening and closing\n * the Tooltip when the user hovers over or focuses the trigger, and positioning the Tooltip\n * relative to the trigger.\n */\nexport function TooltipTrigger(props: TooltipTriggerComponentProps): JSX.Element {\n let state = useTooltipTriggerState(props);\n let ref = useRef<FocusableElement>(null);\n let {triggerProps, tooltipProps} = useTooltipTrigger(props, state, ref);\n\n return (\n <Provider\n values={[\n [TooltipTriggerStateContext, state],\n [TooltipContext, {...tooltipProps, triggerRef: ref}]\n ]}>\n <FocusableProvider {...triggerProps} ref={ref}>\n {props.children}\n </FocusableProvider>\n </Provider>\n );\n}\n\n/**\n * A tooltip displays a description of an element on hover or focus.\n */\nexport const Tooltip = /*#__PURE__*/ (forwardRef as forwardRefType)(function Tooltip({UNSTABLE_portalContainer, ...props}: TooltipProps, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, TooltipContext);\n let contextState = useContext(TooltipTriggerStateContext);\n let localState = useTooltipTriggerState(props);\n let state = props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;\n let isExiting = useExitAnimation(ref, state.isOpen) || props.isExiting || false;\n if (!state.isOpen && !isExiting) {\n return null;\n }\n\n return (\n <OverlayContainer portalContainer={UNSTABLE_portalContainer}>\n <TooltipInner {...props} tooltipRef={ref} isExiting={isExiting} />\n </OverlayContainer>\n );\n});\n\nfunction TooltipInner(props: TooltipProps & {isExiting: boolean, tooltipRef: RefObject<HTMLDivElement | null>}) {\n let state = useContext(TooltipTriggerStateContext)!;\n\n // Calculate the arrow size internally\n // Referenced from: packages/@react-spectrum/tooltip/src/TooltipTrigger.tsx\n let arrowRef = useRef<HTMLDivElement>(null);\n let [arrowWidth, setArrowWidth] = useState(0);\n useLayoutEffect(() => {\n if (arrowRef.current && state.isOpen) {\n setArrowWidth(arrowRef.current.getBoundingClientRect().width);\n }\n }, [state.isOpen, arrowRef]);\n\n let {overlayProps, arrowProps, placement} = useOverlayPosition({\n placement: props.placement || 'top',\n targetRef: props.triggerRef!,\n overlayRef: props.tooltipRef,\n offset: props.offset,\n crossOffset: props.crossOffset,\n isOpen: state.isOpen,\n arrowSize: arrowWidth,\n arrowBoundaryOffset: props.arrowBoundaryOffset,\n shouldFlip: props.shouldFlip,\n onClose: () => state.close(true)\n });\n\n let isEntering = useEnterAnimation(props.tooltipRef, !!placement) || props.isEntering || false;\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Tooltip',\n values: {\n placement,\n isEntering,\n isExiting: props.isExiting,\n state\n }\n });\n\n props = mergeProps(props, overlayProps);\n let {tooltipProps} = useTooltip(props, state);\n\n return (\n <div\n {...tooltipProps}\n ref={props.tooltipRef}\n {...renderProps}\n style={{...overlayProps.style, ...renderProps.style}}\n data-placement={placement ?? undefined}\n data-entering={isEntering || undefined}\n data-exiting={props.isExiting || undefined}>\n <OverlayArrowContext.Provider value={{...arrowProps, placement, ref: arrowRef}}>\n {renderProps.children}\n </OverlayArrowContext.Provider>\n </div>\n );\n}\n"],"names":[],"version":3,"file":"Tooltip.module.js.map"}
package/dist/Tree.main.js CHANGED
@@ -289,13 +289,13 @@ const $c6576bb58bfa084b$export$53d36ab85dc89436 = /*#__PURE__*/ (0, $5SMu3$react
289
289
  values: renderPropValues
290
290
  });
291
291
  (0, $5SMu3$react.useEffect)(()=>{
292
- if (!item.textValue) console.warn('A `textValue` prop is required for <TreeItem> elements in order to support accessibility features such as type to select.');
292
+ if (!item.textValue && process.env.NODE_ENV !== 'production') console.warn('A `textValue` prop is required for <TreeItem> elements in order to support accessibility features such as type to select.');
293
293
  }, [
294
294
  item.textValue
295
295
  ]);
296
296
  let expandButtonRef = (0, $5SMu3$react.useRef)(null);
297
297
  (0, $5SMu3$react.useEffect)(()=>{
298
- if (hasChildItems && !expandButtonRef.current) console.warn('Expandable tree items must contain a expand button so screen reader users can expand/collapse the item.');
298
+ if (hasChildItems && !expandButtonRef.current && process.env.NODE_ENV !== 'production') console.warn('Expandable tree items must contain a expand button so screen reader users can expand/collapse the item.');
299
299
  // eslint-disable-next-line
300
300
  }, []);
301
301
  let children = (0, $5SMu3$reactariacollections.useCachedChildren)({
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;AAcD,MAAM;IAYJ,mGAAmG;IACnG,+GAA+G;IAC/G,CAAC,CAAC,OAAO,QAAQ,CAAC,GAAG;QACnB,OAAO,IAAI,CAAC,aAAa;IAC3B;IAEA,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,aAAa,CAAC,MAAM;IAClC;IAEA,UAAU;QACR,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI;IACzB;IAEA,QAAQ,GAAQ,EAAkB;QAChC,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ;IACjC;IAEA,GAAG,GAAW,EAAE;QACd,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI;IAChC;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,iBAAA,2BAAA,KAAM,SAAS;YAC/B,IAAI,QAAQ;gBAAC,GAAG,IAAI;YAAA;YACpB,IAAI,aAAa,MAAM;gBACrB,sMAAsM;gBACtM,oGAAoG;gBACpG,IAAI,iBAAiB;uBAAI,WAAW,WAAW,CAAC;iBAAW,CAAC,EAAE,CAAC,IAAI,KAAK;gBACxE,IAAI,gBACF,MAAM,KAAK,GAAG,CAAA,iBAAA,2BAAA,KAAM,KAAK,KAAI,OAAO,CAAA,iBAAA,2BAAA,KAAM,KAAK,IAAG,IAAI;gBAGxD,iJAAiJ;gBACjJ,sEAAsE;gBACtE,IAAI,KAAK,IAAI,KAAK,UAChB,MAAM,KAAK,GAAG,KAAK,KAAK,GAAG;gBAG7B,OAAO,GAAG,CAAC,MAAM,GAAG,EAAE;YACxB,OACE,OAAO,GAAG,CAAC,KAAK,GAAG,EAAE;YAGvB,IAAI,KAAK,KAAK,KAAK,KAAM,aAAa,QAAQ,aAAa,GAAG,CAAC,cAAc,cAAc,IAAI,CAAC,CAAA,MAAO,IAAI,GAAG,KAAK,YACjH,6GAA6G;YAC7G,cAAc,IAAI,CAAC,OAAO,GAAG,CAAC,KAAK,GAAG,KAAK;QAE/C,OAAO,IAAI,KAAK,IAAI,KAAK,MACvB,OAAO,GAAG,CAAC,KAAK,GAAG,EAAE;QAGvB,KAAK,IAAI,SAAS,WAAW,WAAW,CAAC,KAAK,GAAG,EAC/C,UAAU;IAEd;IAEA,KAAK,IAAI,QAAQ,WACf,UAAU;IAGZ,OAAO;uBACL;gBACA;IACF;AACF","sources":["packages/react-aria-components/src/Tree.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 {AriaTreeItemOptions, AriaTreeProps, FocusScope, mergeProps, useFocusRing, useGridListSelectionCheckbox, useHover, useTree, useTreeItem} from 'react-aria';\nimport {ButtonContext} from './Button';\nimport {CheckboxContext} from './RSPContexts';\nimport {Collection, CollectionBuilder, CollectionNode, createBranchComponent, createLeafComponent, useCachedChildren} from '@react-aria/collections';\nimport {CollectionProps, CollectionRendererContext, DefaultCollectionRenderer, ItemRenderProps, usePersistedKeys} from './Collection';\nimport {ContextValue, DEFAULT_SLOT, Provider, RenderProps, ScrollableProps, SlotProps, StyleRenderProps, useContextProps, useRenderProps} from './utils';\nimport {DisabledBehavior, Expandable, forwardRefType, HoverEvents, Key, LinkDOMProps, MultipleSelection, RefObject} from '@react-types/shared';\nimport {filterDOMProps, useObjectRef} from '@react-aria/utils';\nimport {Collection as ICollection, Node, SelectionBehavior, TreeState, useTreeState} from 'react-stately';\nimport React, {createContext, ForwardedRef, forwardRef, ReactNode, useContext, useEffect, useMemo, useRef} from 'react';\nimport {useControlledState} from '@react-stately/utils';\n\nclass TreeCollection<T> implements ICollection<Node<T>> {\n private flattenedRows: Node<T>[];\n private keyMap: Map<Key, CollectionNode<T>> = new Map();\n\n constructor(opts) {\n let {collection, expandedKeys} = opts;\n let {flattenedRows, keyMap} = flattenTree<T>(collection, {expandedKeys});\n this.flattenedRows = flattenedRows;\n // Use generated keyMap because it contains the modified collection nodes (aka it adjusts the indexes so that they ignore the existence of the Content items)\n this.keyMap = keyMap;\n }\n\n // TODO: should this collection's getters reflect the flattened structure or the original structure\n // If we respresent the flattened structure, it is easier for the keyboard nav but harder to find all the nodes\n *[Symbol.iterator]() {\n yield* this.flattenedRows;\n }\n\n get size() {\n return this.flattenedRows.length;\n }\n\n getKeys() {\n return this.keyMap.keys();\n }\n\n getItem(key: Key): Node<T> | null {\n return this.keyMap.get(key) || null;\n }\n\n at(idx: number) {\n return this.flattenedRows[idx];\n }\n\n getFirstKey() {\n return this.flattenedRows[0]?.key;\n }\n\n getLastKey() {\n return this.flattenedRows[this.size - 1]?.key;\n }\n\n getKeyAfter(key: Key) {\n let index = this.flattenedRows.findIndex(row => row.key === key);\n return this.flattenedRows[index + 1]?.key;\n }\n\n getKeyBefore(key: Key) {\n let index = this.flattenedRows.findIndex(row => row.key === key);\n return this.flattenedRows[index - 1]?.key;\n }\n\n // Note that this will return Content nodes in addition to nested TreeItems\n getChildren(key: Key): Iterable<Node<T>> {\n let keyMap = this.keyMap;\n return {\n *[Symbol.iterator]() {\n let parent = keyMap.get(key);\n let node = parent?.firstChildKey != null ? keyMap.get(parent.firstChildKey) : null;\n while (node) {\n yield node as Node<T>;\n node = node.nextKey != null ? keyMap.get(node.nextKey) : undefined;\n }\n }\n };\n }\n\n getTextValue(key: Key): string {\n let item = this.getItem(key);\n return item ? item.textValue : '';\n }\n}\n\nexport interface TreeRenderProps {\n /**\n * Whether the tree has no items and should display its empty state.\n * @selector [data-empty]\n */\n isEmpty: boolean,\n /**\n * Whether the tree is currently focused.\n * @selector [data-focused]\n */\n isFocused: boolean,\n /**\n * Whether the tree is currently keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean,\n /**\n * State of the tree.\n */\n state: TreeState<unknown>\n}\n\nexport interface TreeEmptyStateRenderProps extends Omit<TreeRenderProps, 'isEmpty'> {}\n\nexport interface TreeProps<T> extends Omit<AriaTreeProps<T>, 'children'>, MultipleSelection, CollectionProps<T>, StyleRenderProps<TreeRenderProps>, SlotProps, ScrollableProps<HTMLDivElement>, Expandable {\n /** How multiple selection should behave in the tree. */\n selectionBehavior?: SelectionBehavior,\n /** Provides content to display when there are no items in the list. */\n renderEmptyState?: (props: TreeEmptyStateRenderProps) => ReactNode,\n /**\n * Whether `disabledKeys` applies to all interactions, or only selection.\n * @default 'all'\n */\n disabledBehavior?: DisabledBehavior\n}\n\n\nexport const TreeContext = createContext<ContextValue<TreeProps<any>, HTMLDivElement>>(null);\nexport const TreeStateContext = createContext<TreeState<any> | null>(null);\n\n/**\n * A tree provides users with a way to navigate nested hierarchical information, with support for keyboard navigation\n * and selection.\n */\nexport const Tree = /*#__PURE__*/ (forwardRef as forwardRefType)(function Tree<T extends object>(props: TreeProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n // Render the portal first so that we have the collection by the time we render the DOM in SSR.\n [props, ref] = useContextProps(props, ref, TreeContext);\n\n return (\n <CollectionBuilder content={<Collection {...props} />}>\n {collection => <TreeInner props={props} collection={collection} treeRef={ref} />}\n </CollectionBuilder>\n );\n});\n\ninterface TreeInnerProps<T extends object> {\n props: TreeProps<T>,\n collection: ICollection<unknown>,\n treeRef: RefObject<HTMLDivElement | null>\n}\n\nfunction TreeInner<T extends object>({props, collection, treeRef: ref}: TreeInnerProps<T>) {\n let {\n selectionMode = 'none',\n expandedKeys: propExpandedKeys,\n defaultExpandedKeys: propDefaultExpandedKeys,\n onExpandedChange,\n disabledBehavior = 'all'\n } = props;\n let {CollectionRoot, isVirtualized, layoutDelegate} = useContext(CollectionRendererContext);\n\n // Kinda annoying that we have to replicate this code here as well as in useTreeState, but don't want to add\n // flattenCollection stuff to useTreeState. Think about this later\n let [expandedKeys, setExpandedKeys] = useControlledState(\n propExpandedKeys ? convertExpanded(propExpandedKeys) : undefined,\n propDefaultExpandedKeys ? convertExpanded(propDefaultExpandedKeys) : new Set(),\n onExpandedChange\n );\n\n let flattenedCollection = useMemo(() => {\n return new TreeCollection<object>({collection, expandedKeys});\n }, [collection, expandedKeys]);\n\n let state = useTreeState({\n ...props,\n selectionMode,\n expandedKeys,\n onExpandedChange: setExpandedKeys,\n collection: flattenedCollection,\n children: undefined,\n disabledBehavior\n });\n\n let {gridProps} = useTree({\n ...props,\n isVirtualized,\n layoutDelegate\n }, state, ref);\n\n let {focusProps, isFocused, isFocusVisible} = useFocusRing();\n let renderValues = {\n isEmpty: state.collection.size === 0,\n isFocused,\n isFocusVisible,\n state\n };\n\n let renderProps = useRenderProps({\n className: props.className,\n style: props.style,\n defaultClassName: 'react-aria-Tree',\n values: renderValues\n });\n\n let emptyState: ReactNode = null;\n if (state.collection.size === 0 && props.renderEmptyState) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n let {isEmpty, ...values} = renderValues;\n let content = props.renderEmptyState({...values});\n let treeGridRowProps = {\n 'aria-level': 1,\n 'aria-posinset': 1,\n 'aria-setsize': 1\n };\n\n emptyState = (\n <div role=\"row\" style={{display: 'contents'}} {...treeGridRowProps}>\n <div role=\"gridcell\" style={{display: 'contents'}}>\n {content}\n </div>\n </div>\n );\n }\n\n return (\n <FocusScope>\n <div\n {...filterDOMProps(props)}\n {...renderProps}\n {...mergeProps(gridProps, focusProps)}\n ref={ref}\n slot={props.slot || undefined}\n onScroll={props.onScroll}\n data-empty={state.collection.size === 0 || undefined}\n data-focused={isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined}>\n <Provider\n values={[\n [TreeStateContext, state]\n ]}>\n <CollectionRoot\n collection={state.collection}\n persistedKeys={usePersistedKeys(state.selectionManager.focusedKey)}\n scrollRef={ref} />\n </Provider>\n {emptyState}\n </div>\n </FocusScope>\n );\n}\n\n// TODO: readd the rest of the render props when tree supports them\nexport interface TreeItemRenderProps extends Omit<ItemRenderProps, 'allowsDragging' | 'isDragging' | 'isDropTarget'> {\n /**\n * Whether the tree item is expanded.\n * @selector [data-expanded]\n */\n isExpanded: boolean,\n /**\n * Whether the tree item has child tree items.\n * @selector [data-has-child-items]\n */\n hasChildItems: boolean,\n /**\n * What level the tree item has within the tree.\n * @selector [data-level=\"number\"]\n */\n level: number,\n /**\n * Whether the tree item's children have keyboard focus.\n * @selector [data-focus-visible-within]\n */\n isFocusVisibleWithin: boolean,\n /** The state of the tree. */\n state: TreeState<unknown>,\n /** The unique id of the tree row. */\n id: Key\n}\n\nexport interface TreeItemContentRenderProps extends TreeItemRenderProps {}\n\n// The TreeItemContent is the one that accepts RenderProps because we would get much more complicated logic in TreeItem otherwise since we'd\n// need to do a bunch of check to figure out what is the Content and what are the actual collection elements (aka child rows) of the TreeItem\nexport interface TreeItemContentProps extends Pick<RenderProps<TreeItemContentRenderProps>, 'children'> {}\n\nexport const TreeItemContent = /*#__PURE__*/ createLeafComponent('content', function TreeItemContent(props: TreeItemContentProps) {\n let values = useContext(TreeItemContentContext)!;\n let renderProps = useRenderProps({\n children: props.children,\n values\n });\n return (\n <CollectionRendererContext.Provider value={DefaultCollectionRenderer}>\n {renderProps.children}\n </CollectionRendererContext.Provider>\n );\n});\n\nexport const TreeItemContentContext = createContext<TreeItemContentRenderProps | null>(null);\n\nexport interface TreeItemProps<T = object> extends StyleRenderProps<TreeItemRenderProps>, LinkDOMProps, HoverEvents, Pick<AriaTreeItemOptions, 'hasChildItems'> {\n /** The unique id of the tree row. */\n id?: Key,\n /** The object value that this tree item represents. When using dynamic collections, this is set automatically. */\n value?: T,\n /** A string representation of the tree item's contents, used for features like typeahead. */\n textValue: string,\n /** An accessibility label for this tree item. */\n 'aria-label'?: string,\n /** The content of the tree item along with any nested children. Supports static nested tree items or use of a Collection to dynamically render nested tree items. */\n children: ReactNode,\n /** Whether the item is disabled. */\n isDisabled?: boolean,\n /**\n * Handler that is called when a user performs an action on this tree item. The exact user event depends on\n * the collection's `selectionBehavior` prop and the interaction modality.\n */\n onAction?: () => void\n}\n\n/**\n * A TreeItem represents an individual item in a Tree.\n */\nexport const TreeItem = /*#__PURE__*/ createBranchComponent('item', <T extends object>(props: TreeItemProps<T>, ref: ForwardedRef<HTMLDivElement>, item: Node<T>) => {\n let state = useContext(TreeStateContext)!;\n ref = useObjectRef<HTMLDivElement>(ref);\n // TODO: remove this when we support description in tree row\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n let {rowProps, gridCellProps, expandButtonProps, descriptionProps, ...states} = useTreeItem({node: item}, state, ref);\n let isExpanded = rowProps['aria-expanded'] === true;\n let hasChildItems = props.hasChildItems || [...state.collection.getChildren!(item.key)]?.length > 1;;\n let level = rowProps['aria-level'] || 1;\n\n let {hoverProps, isHovered} = useHover({\n isDisabled: !states.allowsSelection && !states.hasAction,\n onHoverStart: props.onHoverStart,\n onHoverChange: props.onHoverChange,\n onHoverEnd: props.onHoverEnd\n });\n\n let {isFocusVisible, focusProps} = useFocusRing();\n let {\n isFocusVisible: isFocusVisibleWithin,\n focusProps: focusWithinProps\n } = useFocusRing({within: true});\n let {checkboxProps} = useGridListSelectionCheckbox(\n {key: item.key},\n state\n );\n\n let selectionMode = state.selectionManager.selectionMode;\n let selectionBehavior = state.selectionManager.selectionBehavior;\n let renderPropValues = React.useMemo<TreeItemContentRenderProps>(() => ({\n ...states,\n isHovered,\n isFocusVisible,\n isExpanded,\n hasChildItems,\n level,\n selectionMode,\n selectionBehavior,\n isFocusVisibleWithin,\n state,\n id: item.key\n }), [states, isHovered, isFocusVisible, selectionMode, selectionBehavior, isExpanded, hasChildItems, level, isFocusVisibleWithin, state, item.key]);\n\n let renderProps = useRenderProps({\n ...props,\n id: undefined,\n children: item.rendered,\n defaultClassName: 'react-aria-TreeItem',\n defaultStyle: {\n // @ts-ignore\n '--tree-item-level': level\n },\n values: renderPropValues\n });\n\n useEffect(() => {\n if (!item.textValue) {\n console.warn('A `textValue` prop is required for <TreeItem> elements in order to support accessibility features such as type to select.');\n }\n }, [item.textValue]);\n\n let expandButtonRef = useRef<HTMLButtonElement>(null);\n useEffect(() => {\n if (hasChildItems && !expandButtonRef.current) {\n console.warn('Expandable tree items must contain a expand button so screen reader users can expand/collapse the item.');\n }\n // eslint-disable-next-line\n }, []);\n\n let children = useCachedChildren({\n items: state.collection.getChildren!(item.key),\n children: item => {\n switch (item.type) {\n case 'content': {\n return item.render!(item);\n }\n // Skip item since we don't render the nested rows as children of the parent row, the flattened collection\n // will render them each as siblings instead\n case 'loader':\n case 'item':\n return <></>;\n default:\n throw new Error('Unsupported element type in TreeRow: ' + item.type);\n }\n }\n });\n\n return (\n <>\n <div\n {...mergeProps(filterDOMProps(props as any), rowProps, focusProps, hoverProps, focusWithinProps)}\n {...renderProps}\n ref={ref}\n // TODO: missing selectionBehavior, hasAction and allowsSelection data attribute equivalents (available in renderProps). Do we want those?\n data-expanded={(hasChildItems && isExpanded) || undefined}\n data-has-child-items={hasChildItems || undefined}\n data-level={level}\n data-selected={states.isSelected || undefined}\n data-disabled={states.isDisabled || undefined}\n data-hovered={isHovered || undefined}\n data-focused={states.isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-pressed={states.isPressed || undefined}\n data-selection-mode={state.selectionManager.selectionMode === 'none' ? undefined : state.selectionManager.selectionMode}>\n <div {...gridCellProps} style={{display: 'contents'}}>\n <Provider\n values={[\n [CheckboxContext, {\n slots: {\n selection: checkboxProps\n }\n }],\n // TODO: support description in the tree row\n // TODO: don't think I need to pass isExpanded to the button here since it can be sourced from the renderProps? Might be worthwhile passing it down?\n [ButtonContext, {\n slots: {\n [DEFAULT_SLOT]: {},\n chevron: {\n ...expandButtonProps,\n ref: expandButtonRef\n }\n }\n }],\n [TreeItemContentContext, {\n ...renderPropValues\n }]\n ]}>\n {children}\n </Provider>\n </div>\n </div>\n </>\n );\n});\n\nexport interface UNSTABLE_TreeLoadingIndicatorRenderProps {\n /**\n * What level the tree item has within the tree.\n * @selector [data-level]\n */\n level: number\n}\n\nexport interface TreeLoaderProps extends RenderProps<UNSTABLE_TreeLoadingIndicatorRenderProps>, StyleRenderProps<UNSTABLE_TreeLoadingIndicatorRenderProps> {}\n\nexport const UNSTABLE_TreeLoadingIndicator = createLeafComponent('loader', function TreeLoader<T extends object>(props: TreeLoaderProps, ref: ForwardedRef<HTMLDivElement>, item: Node<T>) {\n let state = useContext(TreeStateContext);\n // This loader row is is non-interactable, but we want the same aria props calculated as a typical row\n // @ts-ignore\n let {rowProps} = useTreeItem({node: item}, state, ref);\n let level = rowProps['aria-level'] || 1;\n\n let ariaProps = {\n 'aria-level': rowProps['aria-level'],\n 'aria-posinset': rowProps['aria-posinset'],\n 'aria-setsize': rowProps['aria-setsize']\n };\n\n let renderProps = useRenderProps({\n ...props,\n id: undefined,\n children: item.rendered,\n defaultClassName: 'react-aria-TreeLoader',\n values: {\n level\n }\n });\n\n return (\n <>\n <div\n role=\"row\"\n ref={ref}\n {...mergeProps(filterDOMProps(props as any), ariaProps)}\n {...renderProps}\n data-level={level}>\n <div role=\"gridcell\" aria-colindex={1}>\n {renderProps.children}\n </div>\n </div>\n </>\n );\n});\n\nfunction convertExpanded(expanded: 'all' | Iterable<Key>): 'all' | Set<Key> {\n if (!expanded) {\n return new Set<Key>();\n }\n\n return expanded === 'all'\n ? 'all'\n : new Set(expanded);\n}\ninterface TreeGridCollectionOptions {\n expandedKeys: Set<Key>\n}\n\ninterface FlattenedTree<T> {\n flattenedRows: Node<T>[],\n keyMap: Map<Key, CollectionNode<T>>\n}\n\nfunction flattenTree<T>(collection: TreeCollection<T>, opts: TreeGridCollectionOptions): FlattenedTree<T> {\n let {\n expandedKeys = new Set()\n } = opts;\n let keyMap: Map<Key, CollectionNode<T>> = new Map();\n let flattenedRows: Node<T>[] = [];\n\n let visitNode = (node: Node<T>) => {\n if (node.type === 'item' || node.type === 'loader') {\n let parentKey = node?.parentKey;\n let clone = {...node};\n if (parentKey != null) {\n // TODO: assumes that non item content node (aka TreeItemContent always placed before Collection) will be always placed before the child rows. If we can't make this assumption then we can filter out\n // every non-item per level and assign indicies based off the node's position in said filtered array\n let hasContentNode = [...collection.getChildren(parentKey)][0].type !== 'item';\n if (hasContentNode) {\n clone.index = node?.index != null ? node?.index - 1 : 0;\n }\n\n // For loader nodes that have a parent (aka non-root level loaders), these need their levels incremented by 1 for parity with their sibiling rows\n // (Collection only increments the level if it is a \"item\" type node).\n if (node.type === 'loader') {\n clone.level = node.level + 1;\n }\n\n keyMap.set(clone.key, clone as CollectionNode<T>);\n } else {\n keyMap.set(node.key, node as CollectionNode<T>);\n }\n\n if (node.level === 0 || (parentKey != null && expandedKeys.has(parentKey) && flattenedRows.find(row => row.key === parentKey))) {\n // Grab the modified node from the key map so our flattened list and modified key map point to the same nodes\n flattenedRows.push(keyMap.get(node.key) || node);\n }\n } else if (node.type !== null) {\n keyMap.set(node.key, node as CollectionNode<T>);\n }\n\n for (let child of collection.getChildren(node.key)) {\n visitNode(child);\n }\n };\n\n for (let node of collection) {\n visitNode(node);\n }\n\n return {\n flattenedRows,\n keyMap\n };\n}\n"],"names":[],"version":3,"file":"Tree.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;AAcD,MAAM;IAYJ,mGAAmG;IACnG,+GAA+G;IAC/G,CAAC,CAAC,OAAO,QAAQ,CAAC,GAAG;QACnB,OAAO,IAAI,CAAC,aAAa;IAC3B;IAEA,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,aAAa,CAAC,MAAM;IAClC;IAEA,UAAU;QACR,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI;IACzB;IAEA,QAAQ,GAAQ,EAAkB;QAChC,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ;IACjC;IAEA,GAAG,GAAW,EAAE;QACd,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI;IAChC;IAEA,cAAc;YACL;QAAP,QAAO,uBAAA,IAAI,CAAC,aAAa,CAAC,EAAE,cAArB,2CAAA,qBAAuB,GAAG;IACnC;IAEA,aAAa;YACJ;QAAP,QAAO,uBAAA,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,GAAG,EAAE,cAAjC,2CAAA,qBAAmC,GAAG;IAC/C;IAEA,YAAY,GAAQ,EAAE;YAEb;QADP,IAAI,QAAQ,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,CAAA,MAAO,IAAI,GAAG,KAAK;QAC5D,QAAO,uBAAA,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,cAA7B,2CAAA,qBAA+B,GAAG;IAC3C;IAEA,aAAa,GAAQ,EAAE;YAEd;QADP,IAAI,QAAQ,IAAI,CAAC,aAAa,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G,KAAK,KAAK,GAAG;gBAG7B,OAAO,GAAG,CAAC,MAAM,GAAG,EAAE;YACxB,OACE,OAAO,GAAG,CAAC,KAAK,GAAG,EAAE;YAGvB,IAAI,KAAK,KAAK,KAAK,KAAM,aAAa,QAAQ,aAAa,GAAG,CAAC,cAAc,cAAc,IAAI,CAAC,CAAA,MAAO,IAAI,GAAG,KAAK,YACjH,6GAA6G;YAC7G,cAAc,IAAI,CAAC,OAAO,GAAG,CAAC,KAAK,GAAG,KAAK;QAE/C,OAAO,IAAI,KAAK,IAAI,KAAK,MACvB,OAAO,GAAG,CAAC,KAAK,GAAG,EAAE;QAGvB,KAAK,IAAI,SAAS,WAAW,WAAW,CAAC,KAAK,GAAG,EAC/C,UAAU;IAEd;IAEA,KAAK,IAAI,QAAQ,WACf,UAAU;IAGZ,OAAO;uBACL;gBACA;IACF;AACF","sources":["packages/react-aria-components/src/Tree.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 {AriaTreeItemOptions, AriaTreeProps, FocusScope, mergeProps, useFocusRing, useGridListSelectionCheckbox, useHover, useTree, useTreeItem} from 'react-aria';\nimport {ButtonContext} from './Button';\nimport {CheckboxContext} from './RSPContexts';\nimport {Collection, CollectionBuilder, CollectionNode, createBranchComponent, createLeafComponent, useCachedChildren} from '@react-aria/collections';\nimport {CollectionProps, CollectionRendererContext, DefaultCollectionRenderer, ItemRenderProps, usePersistedKeys} from './Collection';\nimport {ContextValue, DEFAULT_SLOT, Provider, RenderProps, ScrollableProps, SlotProps, StyleRenderProps, useContextProps, useRenderProps} from './utils';\nimport {DisabledBehavior, Expandable, forwardRefType, HoverEvents, Key, LinkDOMProps, MultipleSelection, RefObject} from '@react-types/shared';\nimport {filterDOMProps, useObjectRef} from '@react-aria/utils';\nimport {Collection as ICollection, Node, SelectionBehavior, TreeState, useTreeState} from 'react-stately';\nimport React, {createContext, ForwardedRef, forwardRef, ReactNode, useContext, useEffect, useMemo, useRef} from 'react';\nimport {useControlledState} from '@react-stately/utils';\n\nclass TreeCollection<T> implements ICollection<Node<T>> {\n private flattenedRows: Node<T>[];\n private keyMap: Map<Key, CollectionNode<T>> = new Map();\n\n constructor(opts) {\n let {collection, expandedKeys} = opts;\n let {flattenedRows, keyMap} = flattenTree<T>(collection, {expandedKeys});\n this.flattenedRows = flattenedRows;\n // Use generated keyMap because it contains the modified collection nodes (aka it adjusts the indexes so that they ignore the existence of the Content items)\n this.keyMap = keyMap;\n }\n\n // TODO: should this collection's getters reflect the flattened structure or the original structure\n // If we respresent the flattened structure, it is easier for the keyboard nav but harder to find all the nodes\n *[Symbol.iterator]() {\n yield* this.flattenedRows;\n }\n\n get size() {\n return this.flattenedRows.length;\n }\n\n getKeys() {\n return this.keyMap.keys();\n }\n\n getItem(key: Key): Node<T> | null {\n return this.keyMap.get(key) || null;\n }\n\n at(idx: number) {\n return this.flattenedRows[idx];\n }\n\n getFirstKey() {\n return this.flattenedRows[0]?.key;\n }\n\n getLastKey() {\n return this.flattenedRows[this.size - 1]?.key;\n }\n\n getKeyAfter(key: Key) {\n let index = this.flattenedRows.findIndex(row => row.key === key);\n return this.flattenedRows[index + 1]?.key;\n }\n\n getKeyBefore(key: Key) {\n let index = this.flattenedRows.findIndex(row => row.key === key);\n return this.flattenedRows[index - 1]?.key;\n }\n\n // Note that this will return Content nodes in addition to nested TreeItems\n getChildren(key: Key): Iterable<Node<T>> {\n let keyMap = this.keyMap;\n return {\n *[Symbol.iterator]() {\n let parent = keyMap.get(key);\n let node = parent?.firstChildKey != null ? keyMap.get(parent.firstChildKey) : null;\n while (node) {\n yield node as Node<T>;\n node = node.nextKey != null ? keyMap.get(node.nextKey) : undefined;\n }\n }\n };\n }\n\n getTextValue(key: Key): string {\n let item = this.getItem(key);\n return item ? item.textValue : '';\n }\n}\n\nexport interface TreeRenderProps {\n /**\n * Whether the tree has no items and should display its empty state.\n * @selector [data-empty]\n */\n isEmpty: boolean,\n /**\n * Whether the tree is currently focused.\n * @selector [data-focused]\n */\n isFocused: boolean,\n /**\n * Whether the tree is currently keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean,\n /**\n * State of the tree.\n */\n state: TreeState<unknown>\n}\n\nexport interface TreeEmptyStateRenderProps extends Omit<TreeRenderProps, 'isEmpty'> {}\n\nexport interface TreeProps<T> extends Omit<AriaTreeProps<T>, 'children'>, MultipleSelection, CollectionProps<T>, StyleRenderProps<TreeRenderProps>, SlotProps, ScrollableProps<HTMLDivElement>, Expandable {\n /** How multiple selection should behave in the tree. */\n selectionBehavior?: SelectionBehavior,\n /** Provides content to display when there are no items in the list. */\n renderEmptyState?: (props: TreeEmptyStateRenderProps) => ReactNode,\n /**\n * Whether `disabledKeys` applies to all interactions, or only selection.\n * @default 'all'\n */\n disabledBehavior?: DisabledBehavior\n}\n\n\nexport const TreeContext = createContext<ContextValue<TreeProps<any>, HTMLDivElement>>(null);\nexport const TreeStateContext = createContext<TreeState<any> | null>(null);\n\n/**\n * A tree provides users with a way to navigate nested hierarchical information, with support for keyboard navigation\n * and selection.\n */\nexport const Tree = /*#__PURE__*/ (forwardRef as forwardRefType)(function Tree<T extends object>(props: TreeProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n // Render the portal first so that we have the collection by the time we render the DOM in SSR.\n [props, ref] = useContextProps(props, ref, TreeContext);\n\n return (\n <CollectionBuilder content={<Collection {...props} />}>\n {collection => <TreeInner props={props} collection={collection} treeRef={ref} />}\n </CollectionBuilder>\n );\n});\n\ninterface TreeInnerProps<T extends object> {\n props: TreeProps<T>,\n collection: ICollection<unknown>,\n treeRef: RefObject<HTMLDivElement | null>\n}\n\nfunction TreeInner<T extends object>({props, collection, treeRef: ref}: TreeInnerProps<T>) {\n let {\n selectionMode = 'none',\n expandedKeys: propExpandedKeys,\n defaultExpandedKeys: propDefaultExpandedKeys,\n onExpandedChange,\n disabledBehavior = 'all'\n } = props;\n let {CollectionRoot, isVirtualized, layoutDelegate} = useContext(CollectionRendererContext);\n\n // Kinda annoying that we have to replicate this code here as well as in useTreeState, but don't want to add\n // flattenCollection stuff to useTreeState. Think about this later\n let [expandedKeys, setExpandedKeys] = useControlledState(\n propExpandedKeys ? convertExpanded(propExpandedKeys) : undefined,\n propDefaultExpandedKeys ? convertExpanded(propDefaultExpandedKeys) : new Set(),\n onExpandedChange\n );\n\n let flattenedCollection = useMemo(() => {\n return new TreeCollection<object>({collection, expandedKeys});\n }, [collection, expandedKeys]);\n\n let state = useTreeState({\n ...props,\n selectionMode,\n expandedKeys,\n onExpandedChange: setExpandedKeys,\n collection: flattenedCollection,\n children: undefined,\n disabledBehavior\n });\n\n let {gridProps} = useTree({\n ...props,\n isVirtualized,\n layoutDelegate\n }, state, ref);\n\n let {focusProps, isFocused, isFocusVisible} = useFocusRing();\n let renderValues = {\n isEmpty: state.collection.size === 0,\n isFocused,\n isFocusVisible,\n state\n };\n\n let renderProps = useRenderProps({\n className: props.className,\n style: props.style,\n defaultClassName: 'react-aria-Tree',\n values: renderValues\n });\n\n let emptyState: ReactNode = null;\n if (state.collection.size === 0 && props.renderEmptyState) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n let {isEmpty, ...values} = renderValues;\n let content = props.renderEmptyState({...values});\n let treeGridRowProps = {\n 'aria-level': 1,\n 'aria-posinset': 1,\n 'aria-setsize': 1\n };\n\n emptyState = (\n <div role=\"row\" style={{display: 'contents'}} {...treeGridRowProps}>\n <div role=\"gridcell\" style={{display: 'contents'}}>\n {content}\n </div>\n </div>\n );\n }\n\n return (\n <FocusScope>\n <div\n {...filterDOMProps(props)}\n {...renderProps}\n {...mergeProps(gridProps, focusProps)}\n ref={ref}\n slot={props.slot || undefined}\n onScroll={props.onScroll}\n data-empty={state.collection.size === 0 || undefined}\n data-focused={isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined}>\n <Provider\n values={[\n [TreeStateContext, state]\n ]}>\n <CollectionRoot\n collection={state.collection}\n persistedKeys={usePersistedKeys(state.selectionManager.focusedKey)}\n scrollRef={ref} />\n </Provider>\n {emptyState}\n </div>\n </FocusScope>\n );\n}\n\n// TODO: readd the rest of the render props when tree supports them\nexport interface TreeItemRenderProps extends Omit<ItemRenderProps, 'allowsDragging' | 'isDragging' | 'isDropTarget'> {\n /**\n * Whether the tree item is expanded.\n * @selector [data-expanded]\n */\n isExpanded: boolean,\n /**\n * Whether the tree item has child tree items.\n * @selector [data-has-child-items]\n */\n hasChildItems: boolean,\n /**\n * What level the tree item has within the tree.\n * @selector [data-level=\"number\"]\n */\n level: number,\n /**\n * Whether the tree item's children have keyboard focus.\n * @selector [data-focus-visible-within]\n */\n isFocusVisibleWithin: boolean,\n /** The state of the tree. */\n state: TreeState<unknown>,\n /** The unique id of the tree row. */\n id: Key\n}\n\nexport interface TreeItemContentRenderProps extends TreeItemRenderProps {}\n\n// The TreeItemContent is the one that accepts RenderProps because we would get much more complicated logic in TreeItem otherwise since we'd\n// need to do a bunch of check to figure out what is the Content and what are the actual collection elements (aka child rows) of the TreeItem\nexport interface TreeItemContentProps extends Pick<RenderProps<TreeItemContentRenderProps>, 'children'> {}\n\nexport const TreeItemContent = /*#__PURE__*/ createLeafComponent('content', function TreeItemContent(props: TreeItemContentProps) {\n let values = useContext(TreeItemContentContext)!;\n let renderProps = useRenderProps({\n children: props.children,\n values\n });\n return (\n <CollectionRendererContext.Provider value={DefaultCollectionRenderer}>\n {renderProps.children}\n </CollectionRendererContext.Provider>\n );\n});\n\nexport const TreeItemContentContext = createContext<TreeItemContentRenderProps | null>(null);\n\nexport interface TreeItemProps<T = object> extends StyleRenderProps<TreeItemRenderProps>, LinkDOMProps, HoverEvents, Pick<AriaTreeItemOptions, 'hasChildItems'> {\n /** The unique id of the tree row. */\n id?: Key,\n /** The object value that this tree item represents. When using dynamic collections, this is set automatically. */\n value?: T,\n /** A string representation of the tree item's contents, used for features like typeahead. */\n textValue: string,\n /** An accessibility label for this tree item. */\n 'aria-label'?: string,\n /** The content of the tree item along with any nested children. Supports static nested tree items or use of a Collection to dynamically render nested tree items. */\n children: ReactNode,\n /** Whether the item is disabled. */\n isDisabled?: boolean,\n /**\n * Handler that is called when a user performs an action on this tree item. The exact user event depends on\n * the collection's `selectionBehavior` prop and the interaction modality.\n */\n onAction?: () => void\n}\n\n/**\n * A TreeItem represents an individual item in a Tree.\n */\nexport const TreeItem = /*#__PURE__*/ createBranchComponent('item', <T extends object>(props: TreeItemProps<T>, ref: ForwardedRef<HTMLDivElement>, item: Node<T>) => {\n let state = useContext(TreeStateContext)!;\n ref = useObjectRef<HTMLDivElement>(ref);\n // TODO: remove this when we support description in tree row\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n let {rowProps, gridCellProps, expandButtonProps, descriptionProps, ...states} = useTreeItem({node: item}, state, ref);\n let isExpanded = rowProps['aria-expanded'] === true;\n let hasChildItems = props.hasChildItems || [...state.collection.getChildren!(item.key)]?.length > 1;;\n let level = rowProps['aria-level'] || 1;\n\n let {hoverProps, isHovered} = useHover({\n isDisabled: !states.allowsSelection && !states.hasAction,\n onHoverStart: props.onHoverStart,\n onHoverChange: props.onHoverChange,\n onHoverEnd: props.onHoverEnd\n });\n\n let {isFocusVisible, focusProps} = useFocusRing();\n let {\n isFocusVisible: isFocusVisibleWithin,\n focusProps: focusWithinProps\n } = useFocusRing({within: true});\n let {checkboxProps} = useGridListSelectionCheckbox(\n {key: item.key},\n state\n );\n\n let selectionMode = state.selectionManager.selectionMode;\n let selectionBehavior = state.selectionManager.selectionBehavior;\n let renderPropValues = React.useMemo<TreeItemContentRenderProps>(() => ({\n ...states,\n isHovered,\n isFocusVisible,\n isExpanded,\n hasChildItems,\n level,\n selectionMode,\n selectionBehavior,\n isFocusVisibleWithin,\n state,\n id: item.key\n }), [states, isHovered, isFocusVisible, selectionMode, selectionBehavior, isExpanded, hasChildItems, level, isFocusVisibleWithin, state, item.key]);\n\n let renderProps = useRenderProps({\n ...props,\n id: undefined,\n children: item.rendered,\n defaultClassName: 'react-aria-TreeItem',\n defaultStyle: {\n // @ts-ignore\n '--tree-item-level': level\n },\n values: renderPropValues\n });\n\n useEffect(() => {\n if (!item.textValue && process.env.NODE_ENV !== 'production') {\n console.warn('A `textValue` prop is required for <TreeItem> elements in order to support accessibility features such as type to select.');\n }\n }, [item.textValue]);\n\n let expandButtonRef = useRef<HTMLButtonElement>(null);\n useEffect(() => {\n if (hasChildItems && !expandButtonRef.current && process.env.NODE_ENV !== 'production') {\n console.warn('Expandable tree items must contain a expand button so screen reader users can expand/collapse the item.');\n }\n // eslint-disable-next-line\n }, []);\n\n let children = useCachedChildren({\n items: state.collection.getChildren!(item.key),\n children: item => {\n switch (item.type) {\n case 'content': {\n return item.render!(item);\n }\n // Skip item since we don't render the nested rows as children of the parent row, the flattened collection\n // will render them each as siblings instead\n case 'loader':\n case 'item':\n return <></>;\n default:\n throw new Error('Unsupported element type in TreeRow: ' + item.type);\n }\n }\n });\n\n return (\n <>\n <div\n {...mergeProps(filterDOMProps(props as any), rowProps, focusProps, hoverProps, focusWithinProps)}\n {...renderProps}\n ref={ref}\n // TODO: missing selectionBehavior, hasAction and allowsSelection data attribute equivalents (available in renderProps). Do we want those?\n data-expanded={(hasChildItems && isExpanded) || undefined}\n data-has-child-items={hasChildItems || undefined}\n data-level={level}\n data-selected={states.isSelected || undefined}\n data-disabled={states.isDisabled || undefined}\n data-hovered={isHovered || undefined}\n data-focused={states.isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-pressed={states.isPressed || undefined}\n data-selection-mode={state.selectionManager.selectionMode === 'none' ? undefined : state.selectionManager.selectionMode}>\n <div {...gridCellProps} style={{display: 'contents'}}>\n <Provider\n values={[\n [CheckboxContext, {\n slots: {\n selection: checkboxProps\n }\n }],\n // TODO: support description in the tree row\n // TODO: don't think I need to pass isExpanded to the button here since it can be sourced from the renderProps? Might be worthwhile passing it down?\n [ButtonContext, {\n slots: {\n [DEFAULT_SLOT]: {},\n chevron: {\n ...expandButtonProps,\n ref: expandButtonRef\n }\n }\n }],\n [TreeItemContentContext, {\n ...renderPropValues\n }]\n ]}>\n {children}\n </Provider>\n </div>\n </div>\n </>\n );\n});\n\nexport interface UNSTABLE_TreeLoadingIndicatorRenderProps {\n /**\n * What level the tree item has within the tree.\n * @selector [data-level]\n */\n level: number\n}\n\nexport interface TreeLoaderProps extends RenderProps<UNSTABLE_TreeLoadingIndicatorRenderProps>, StyleRenderProps<UNSTABLE_TreeLoadingIndicatorRenderProps> {}\n\nexport const UNSTABLE_TreeLoadingIndicator = createLeafComponent('loader', function TreeLoader<T extends object>(props: TreeLoaderProps, ref: ForwardedRef<HTMLDivElement>, item: Node<T>) {\n let state = useContext(TreeStateContext);\n // This loader row is is non-interactable, but we want the same aria props calculated as a typical row\n // @ts-ignore\n let {rowProps} = useTreeItem({node: item}, state, ref);\n let level = rowProps['aria-level'] || 1;\n\n let ariaProps = {\n 'aria-level': rowProps['aria-level'],\n 'aria-posinset': rowProps['aria-posinset'],\n 'aria-setsize': rowProps['aria-setsize']\n };\n\n let renderProps = useRenderProps({\n ...props,\n id: undefined,\n children: item.rendered,\n defaultClassName: 'react-aria-TreeLoader',\n values: {\n level\n }\n });\n\n return (\n <>\n <div\n role=\"row\"\n ref={ref}\n {...mergeProps(filterDOMProps(props as any), ariaProps)}\n {...renderProps}\n data-level={level}>\n <div role=\"gridcell\" aria-colindex={1}>\n {renderProps.children}\n </div>\n </div>\n </>\n );\n});\n\nfunction convertExpanded(expanded: 'all' | Iterable<Key>): 'all' | Set<Key> {\n if (!expanded) {\n return new Set<Key>();\n }\n\n return expanded === 'all'\n ? 'all'\n : new Set(expanded);\n}\ninterface TreeGridCollectionOptions {\n expandedKeys: Set<Key>\n}\n\ninterface FlattenedTree<T> {\n flattenedRows: Node<T>[],\n keyMap: Map<Key, CollectionNode<T>>\n}\n\nfunction flattenTree<T>(collection: TreeCollection<T>, opts: TreeGridCollectionOptions): FlattenedTree<T> {\n let {\n expandedKeys = new Set()\n } = opts;\n let keyMap: Map<Key, CollectionNode<T>> = new Map();\n let flattenedRows: Node<T>[] = [];\n\n let visitNode = (node: Node<T>) => {\n if (node.type === 'item' || node.type === 'loader') {\n let parentKey = node?.parentKey;\n let clone = {...node};\n if (parentKey != null) {\n // TODO: assumes that non item content node (aka TreeItemContent always placed before Collection) will be always placed before the child rows. If we can't make this assumption then we can filter out\n // every non-item per level and assign indicies based off the node's position in said filtered array\n let hasContentNode = [...collection.getChildren(parentKey)][0].type !== 'item';\n if (hasContentNode) {\n clone.index = node?.index != null ? node?.index - 1 : 0;\n }\n\n // For loader nodes that have a parent (aka non-root level loaders), these need their levels incremented by 1 for parity with their sibiling rows\n // (Collection only increments the level if it is a \"item\" type node).\n if (node.type === 'loader') {\n clone.level = node.level + 1;\n }\n\n keyMap.set(clone.key, clone as CollectionNode<T>);\n } else {\n keyMap.set(node.key, node as CollectionNode<T>);\n }\n\n if (node.level === 0 || (parentKey != null && expandedKeys.has(parentKey) && flattenedRows.find(row => row.key === parentKey))) {\n // Grab the modified node from the key map so our flattened list and modified key map point to the same nodes\n flattenedRows.push(keyMap.get(node.key) || node);\n }\n } else if (node.type !== null) {\n keyMap.set(node.key, node as CollectionNode<T>);\n }\n\n for (let child of collection.getChildren(node.key)) {\n visitNode(child);\n }\n };\n\n for (let node of collection) {\n visitNode(node);\n }\n\n return {\n flattenedRows,\n keyMap\n };\n}\n"],"names":[],"version":3,"file":"Tree.main.js.map"}
package/dist/Tree.mjs CHANGED
@@ -274,13 +274,13 @@ const $2f5eaf4a2a47b4cf$export$53d36ab85dc89436 = /*#__PURE__*/ (0, $kUtXx$creat
274
274
  values: renderPropValues
275
275
  });
276
276
  (0, $kUtXx$useEffect)(()=>{
277
- if (!item.textValue) console.warn('A `textValue` prop is required for <TreeItem> elements in order to support accessibility features such as type to select.');
277
+ if (!item.textValue && process.env.NODE_ENV !== 'production') console.warn('A `textValue` prop is required for <TreeItem> elements in order to support accessibility features such as type to select.');
278
278
  }, [
279
279
  item.textValue
280
280
  ]);
281
281
  let expandButtonRef = (0, $kUtXx$useRef)(null);
282
282
  (0, $kUtXx$useEffect)(()=>{
283
- if (hasChildItems && !expandButtonRef.current) console.warn('Expandable tree items must contain a expand button so screen reader users can expand/collapse the item.');
283
+ if (hasChildItems && !expandButtonRef.current && process.env.NODE_ENV !== 'production') console.warn('Expandable tree items must contain a expand button so screen reader users can expand/collapse the item.');
284
284
  // eslint-disable-next-line
285
285
  }, []);
286
286
  let children = (0, $kUtXx$useCachedChildren)({
@@ -274,13 +274,13 @@ const $2f5eaf4a2a47b4cf$export$53d36ab85dc89436 = /*#__PURE__*/ (0, $kUtXx$creat
274
274
  values: renderPropValues
275
275
  });
276
276
  (0, $kUtXx$useEffect)(()=>{
277
- if (!item.textValue) console.warn('A `textValue` prop is required for <TreeItem> elements in order to support accessibility features such as type to select.');
277
+ if (!item.textValue && process.env.NODE_ENV !== 'production') console.warn('A `textValue` prop is required for <TreeItem> elements in order to support accessibility features such as type to select.');
278
278
  }, [
279
279
  item.textValue
280
280
  ]);
281
281
  let expandButtonRef = (0, $kUtXx$useRef)(null);
282
282
  (0, $kUtXx$useEffect)(()=>{
283
- if (hasChildItems && !expandButtonRef.current) console.warn('Expandable tree items must contain a expand button so screen reader users can expand/collapse the item.');
283
+ if (hasChildItems && !expandButtonRef.current && process.env.NODE_ENV !== 'production') console.warn('Expandable tree items must contain a expand button so screen reader users can expand/collapse the item.');
284
284
  // eslint-disable-next-line
285
285
  }, []);
286
286
  let children = (0, $kUtXx$useCachedChildren)({