react-aria-components 1.6.0 → 1.7.1

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 (228) hide show
  1. package/README.md +1 -1
  2. package/dist/Autocomplete.main.js +23 -12
  3. package/dist/Autocomplete.main.js.map +1 -1
  4. package/dist/Autocomplete.mjs +23 -12
  5. package/dist/Autocomplete.module.js +23 -12
  6. package/dist/Autocomplete.module.js.map +1 -1
  7. package/dist/Checkbox.main.js +1 -1
  8. package/dist/Checkbox.main.js.map +1 -1
  9. package/dist/Checkbox.mjs +1 -1
  10. package/dist/Checkbox.module.js +1 -1
  11. package/dist/Checkbox.module.js.map +1 -1
  12. package/dist/Collection.main.js.map +1 -1
  13. package/dist/Collection.module.js.map +1 -1
  14. package/dist/ColorArea.main.js +4 -4
  15. package/dist/ColorArea.main.js.map +1 -1
  16. package/dist/ColorArea.mjs +2 -2
  17. package/dist/ColorArea.module.js +2 -2
  18. package/dist/ColorArea.module.js.map +1 -1
  19. package/dist/ColorField.main.js +8 -10
  20. package/dist/ColorField.main.js.map +1 -1
  21. package/dist/ColorField.mjs +4 -6
  22. package/dist/ColorField.module.js +4 -6
  23. package/dist/ColorField.module.js.map +1 -1
  24. package/dist/ColorPicker.main.js +2 -2
  25. package/dist/ColorPicker.main.js.map +1 -1
  26. package/dist/ColorPicker.mjs +1 -1
  27. package/dist/ColorPicker.module.js +1 -1
  28. package/dist/ColorPicker.module.js.map +1 -1
  29. package/dist/ColorSlider.main.js +5 -7
  30. package/dist/ColorSlider.main.js.map +1 -1
  31. package/dist/ColorSlider.mjs +3 -5
  32. package/dist/ColorSlider.module.js +3 -5
  33. package/dist/ColorSlider.module.js.map +1 -1
  34. package/dist/ColorSwatch.main.js +2 -2
  35. package/dist/ColorSwatch.main.js.map +1 -1
  36. package/dist/ColorSwatch.mjs +1 -1
  37. package/dist/ColorSwatch.module.js +1 -1
  38. package/dist/ColorSwatch.module.js.map +1 -1
  39. package/dist/ColorSwatchPicker.main.js +3 -3
  40. package/dist/ColorSwatchPicker.main.js.map +1 -1
  41. package/dist/ColorSwatchPicker.mjs +1 -1
  42. package/dist/ColorSwatchPicker.module.js +1 -1
  43. package/dist/ColorSwatchPicker.module.js.map +1 -1
  44. package/dist/ColorThumb.main.js +2 -6
  45. package/dist/ColorThumb.main.js.map +1 -1
  46. package/dist/ColorThumb.mjs +1 -5
  47. package/dist/ColorThumb.module.js +1 -5
  48. package/dist/ColorThumb.module.js.map +1 -1
  49. package/dist/ColorWheel.main.js +4 -4
  50. package/dist/ColorWheel.main.js.map +1 -1
  51. package/dist/ColorWheel.mjs +2 -2
  52. package/dist/ColorWheel.module.js +2 -2
  53. package/dist/ColorWheel.module.js.map +1 -1
  54. package/dist/ComboBox.main.js +1 -1
  55. package/dist/ComboBox.main.js.map +1 -1
  56. package/dist/ComboBox.mjs +1 -1
  57. package/dist/ComboBox.module.js +1 -1
  58. package/dist/ComboBox.module.js.map +1 -1
  59. package/dist/DateField.main.js +4 -3
  60. package/dist/DateField.main.js.map +1 -1
  61. package/dist/DateField.mjs +4 -3
  62. package/dist/DateField.module.js +4 -3
  63. package/dist/DateField.module.js.map +1 -1
  64. package/dist/DatePicker.main.js +2 -2
  65. package/dist/DatePicker.main.js.map +1 -1
  66. package/dist/DatePicker.mjs +2 -2
  67. package/dist/DatePicker.module.js +2 -2
  68. package/dist/DatePicker.module.js.map +1 -1
  69. package/dist/Dialog.main.js +2 -1
  70. package/dist/Dialog.main.js.map +1 -1
  71. package/dist/Dialog.mjs +2 -1
  72. package/dist/Dialog.module.js +2 -1
  73. package/dist/Dialog.module.js.map +1 -1
  74. package/dist/Disclosure.main.js +5 -7
  75. package/dist/Disclosure.main.js.map +1 -1
  76. package/dist/Disclosure.mjs +2 -4
  77. package/dist/Disclosure.module.js +2 -4
  78. package/dist/Disclosure.module.js.map +1 -1
  79. package/dist/DropZone.main.js +1 -3
  80. package/dist/DropZone.main.js.map +1 -1
  81. package/dist/DropZone.mjs +1 -3
  82. package/dist/DropZone.module.js +1 -3
  83. package/dist/DropZone.module.js.map +1 -1
  84. package/dist/GridList.main.js.map +1 -1
  85. package/dist/GridList.module.js.map +1 -1
  86. package/dist/Group.main.js.map +1 -1
  87. package/dist/Group.module.js.map +1 -1
  88. package/dist/ListBox.main.js +17 -16
  89. package/dist/ListBox.main.js.map +1 -1
  90. package/dist/ListBox.mjs +19 -18
  91. package/dist/ListBox.module.js +19 -18
  92. package/dist/ListBox.module.js.map +1 -1
  93. package/dist/Menu.main.js +39 -24
  94. package/dist/Menu.main.js.map +1 -1
  95. package/dist/Menu.mjs +40 -25
  96. package/dist/Menu.module.js +40 -25
  97. package/dist/Menu.module.js.map +1 -1
  98. package/dist/Meter.main.js +1 -1
  99. package/dist/Meter.main.js.map +1 -1
  100. package/dist/Meter.mjs +1 -1
  101. package/dist/Meter.module.js +1 -1
  102. package/dist/Meter.module.js.map +1 -1
  103. package/dist/NumberField.main.js +4 -2
  104. package/dist/NumberField.main.js.map +1 -1
  105. package/dist/NumberField.mjs +4 -2
  106. package/dist/NumberField.module.js +4 -2
  107. package/dist/NumberField.module.js.map +1 -1
  108. package/dist/Popover.main.js +67 -15
  109. package/dist/Popover.main.js.map +1 -1
  110. package/dist/Popover.mjs +69 -17
  111. package/dist/Popover.module.js +69 -17
  112. package/dist/Popover.module.js.map +1 -1
  113. package/dist/ProgressBar.main.js +1 -1
  114. package/dist/ProgressBar.main.js.map +1 -1
  115. package/dist/ProgressBar.mjs +1 -1
  116. package/dist/ProgressBar.module.js +1 -1
  117. package/dist/ProgressBar.module.js.map +1 -1
  118. package/dist/RadioGroup.main.js +1 -1
  119. package/dist/RadioGroup.main.js.map +1 -1
  120. package/dist/RadioGroup.mjs +1 -1
  121. package/dist/RadioGroup.module.js +1 -1
  122. package/dist/RadioGroup.module.js.map +1 -1
  123. package/dist/SearchField.main.js +4 -2
  124. package/dist/SearchField.main.js.map +1 -1
  125. package/dist/SearchField.mjs +5 -3
  126. package/dist/SearchField.module.js +5 -3
  127. package/dist/SearchField.module.js.map +1 -1
  128. package/dist/Select.main.js +3 -2
  129. package/dist/Select.main.js.map +1 -1
  130. package/dist/Select.mjs +3 -2
  131. package/dist/Select.module.js +3 -2
  132. package/dist/Select.module.js.map +1 -1
  133. package/dist/Slider.main.js +2 -2
  134. package/dist/Slider.main.js.map +1 -1
  135. package/dist/Slider.mjs +2 -2
  136. package/dist/Slider.module.js +2 -2
  137. package/dist/Slider.module.js.map +1 -1
  138. package/dist/Table.main.js +15 -6
  139. package/dist/Table.main.js.map +1 -1
  140. package/dist/Table.mjs +15 -6
  141. package/dist/Table.module.js +15 -6
  142. package/dist/Table.module.js.map +1 -1
  143. package/dist/TableLayout.main.js.map +1 -1
  144. package/dist/TableLayout.module.js.map +1 -1
  145. package/dist/Tabs.main.js +3 -2
  146. package/dist/Tabs.main.js.map +1 -1
  147. package/dist/Tabs.mjs +4 -3
  148. package/dist/Tabs.module.js +4 -3
  149. package/dist/Tabs.module.js.map +1 -1
  150. package/dist/TagGroup.main.js +1 -1
  151. package/dist/TagGroup.main.js.map +1 -1
  152. package/dist/TagGroup.mjs +1 -1
  153. package/dist/TagGroup.module.js +1 -1
  154. package/dist/TagGroup.module.js.map +1 -1
  155. package/dist/TextField.main.js +4 -2
  156. package/dist/TextField.main.js.map +1 -1
  157. package/dist/TextField.mjs +5 -3
  158. package/dist/TextField.module.js +5 -3
  159. package/dist/TextField.module.js.map +1 -1
  160. package/dist/Toast.main.js +148 -0
  161. package/dist/Toast.main.js.map +1 -0
  162. package/dist/Toast.mjs +137 -0
  163. package/dist/Toast.module.js +137 -0
  164. package/dist/Toast.module.js.map +1 -0
  165. package/dist/Tree.main.js +38 -34
  166. package/dist/Tree.main.js.map +1 -1
  167. package/dist/Tree.mjs +34 -30
  168. package/dist/Tree.module.js +34 -30
  169. package/dist/Tree.module.js.map +1 -1
  170. package/dist/Virtualizer.main.js +4 -1
  171. package/dist/Virtualizer.main.js.map +1 -1
  172. package/dist/Virtualizer.mjs +4 -1
  173. package/dist/Virtualizer.module.js +4 -1
  174. package/dist/Virtualizer.module.js.map +1 -1
  175. package/dist/import.mjs +9 -7
  176. package/dist/main.js +31 -17
  177. package/dist/main.js.map +1 -1
  178. package/dist/module.js +9 -7
  179. package/dist/module.js.map +1 -1
  180. package/dist/types.d.ts +159 -59
  181. package/dist/types.d.ts.map +1 -1
  182. package/dist/utils.main.js +9 -7
  183. package/dist/utils.main.js.map +1 -1
  184. package/dist/utils.mjs +9 -7
  185. package/dist/utils.module.js +9 -7
  186. package/dist/utils.module.js.map +1 -1
  187. package/i18n/index.js +1 -1
  188. package/i18n/index.mjs +1 -1
  189. package/package.json +25 -30
  190. package/src/Autocomplete.tsx +19 -15
  191. package/src/Checkbox.tsx +3 -1
  192. package/src/Collection.tsx +2 -2
  193. package/src/ColorArea.tsx +2 -3
  194. package/src/ColorField.tsx +8 -6
  195. package/src/ColorPicker.tsx +1 -2
  196. package/src/ColorSlider.tsx +5 -5
  197. package/src/ColorSwatch.tsx +2 -2
  198. package/src/ColorSwatchPicker.tsx +1 -1
  199. package/src/ColorThumb.tsx +2 -4
  200. package/src/ColorWheel.tsx +2 -2
  201. package/src/ComboBox.tsx +3 -1
  202. package/src/DateField.tsx +8 -3
  203. package/src/DatePicker.tsx +6 -2
  204. package/src/Dialog.tsx +6 -2
  205. package/src/Disclosure.tsx +2 -3
  206. package/src/DropZone.tsx +1 -2
  207. package/src/GridList.tsx +5 -0
  208. package/src/Group.tsx +1 -0
  209. package/src/ListBox.tsx +11 -9
  210. package/src/Menu.tsx +53 -25
  211. package/src/Meter.tsx +3 -1
  212. package/src/NumberField.tsx +11 -2
  213. package/src/Popover.tsx +77 -25
  214. package/src/ProgressBar.tsx +3 -1
  215. package/src/RadioGroup.tsx +3 -1
  216. package/src/SearchField.tsx +6 -4
  217. package/src/Select.tsx +5 -2
  218. package/src/Slider.tsx +6 -2
  219. package/src/Table.tsx +35 -15
  220. package/src/TableLayout.ts +1 -1
  221. package/src/Tabs.tsx +6 -3
  222. package/src/TagGroup.tsx +3 -1
  223. package/src/TextField.tsx +6 -4
  224. package/src/Toast.tsx +184 -0
  225. package/src/Tree.tsx +67 -49
  226. package/src/Virtualizer.tsx +18 -3
  227. package/src/index.ts +16 -16
  228. package/src/utils.tsx +8 -10
@@ -3,6 +3,7 @@ var $ee5958cbdc6becc1$exports = require("./OverlayArrow.main.js");
3
3
  var $2979ab89b336194b$exports = require("./Dialog.main.js");
4
4
  var $4DQW2$reactaria = require("react-aria");
5
5
  var $4DQW2$reactariautils = require("@react-aria/utils");
6
+ var $4DQW2$reactariainteractions = require("@react-aria/interactions");
6
7
  var $4DQW2$reactstately = require("react-stately");
7
8
  var $4DQW2$react = require("react");
8
9
  var $4DQW2$reactariacollections = require("@react-aria/collections");
@@ -36,7 +37,10 @@ $parcel$export(module.exports, "Popover", () => $61e2b7078adb18bc$export$5b6b194
36
37
 
37
38
 
38
39
 
40
+
39
41
  const $61e2b7078adb18bc$export$9b9a0cd73afb7ca4 = /*#__PURE__*/ (0, $4DQW2$react.createContext)(null);
42
+ // Stores a ref for the portal container for a group of popovers (e.g. submenus).
43
+ const $61e2b7078adb18bc$var$PopoverGroupContext = /*#__PURE__*/ (0, $4DQW2$react.createContext)(null);
40
44
  const $61e2b7078adb18bc$export$5b6b19405a83ff9d = /*#__PURE__*/ (0, $4DQW2$react.forwardRef)(function Popover(props, ref) {
41
45
  [props, ref] = (0, $c5ccf687772c0422$exports.useContextProps)(props, ref, $61e2b7078adb18bc$export$9b9a0cd73afb7ca4);
42
46
  let contextState = (0, $4DQW2$react.useContext)((0, $2979ab89b336194b$exports.OverlayTriggerStateContext));
@@ -44,6 +48,7 @@ const $61e2b7078adb18bc$export$5b6b19405a83ff9d = /*#__PURE__*/ (0, $4DQW2$react
44
48
  let state = props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;
45
49
  let isExiting = (0, $4DQW2$reactariautils.useExitAnimation)(ref, state.isOpen) || props.isExiting || false;
46
50
  let isHidden = (0, $4DQW2$reactariacollections.useIsHidden)();
51
+ let { direction: direction } = (0, $4DQW2$reactaria.useLocale)();
47
52
  // If we are in a hidden tree, we still need to preserve our children.
48
53
  if (isHidden) {
49
54
  let children = props.children;
@@ -62,7 +67,8 @@ const $61e2b7078adb18bc$export$5b6b19405a83ff9d = /*#__PURE__*/ (0, $4DQW2$react
62
67
  triggerRef: props.triggerRef,
63
68
  state: state,
64
69
  popoverRef: ref,
65
- isExiting: isExiting
70
+ isExiting: isExiting,
71
+ dir: direction
66
72
  });
67
73
  });
68
74
  function $61e2b7078adb18bc$var$PopoverInner({ state: state, isExiting: isExiting, UNSTABLE_portalContainer: UNSTABLE_portalContainer, ...props }) {
@@ -70,6 +76,9 @@ function $61e2b7078adb18bc$var$PopoverInner({ state: state, isExiting: isExiting
70
76
  // Referenced from: packages/@react-spectrum/tooltip/src/TooltipTrigger.tsx
71
77
  let arrowRef = (0, $4DQW2$react.useRef)(null);
72
78
  let [arrowWidth, setArrowWidth] = (0, $4DQW2$react.useState)(0);
79
+ let containerRef = (0, $4DQW2$react.useRef)(null);
80
+ let groupCtx = (0, $4DQW2$react.useContext)($61e2b7078adb18bc$var$PopoverGroupContext);
81
+ let isSubPopover = groupCtx && props.trigger === 'SubmenuTrigger';
73
82
  (0, $4DQW2$reactariautils.useLayoutEffect)(()=>{
74
83
  if (arrowRef.current && state.isOpen) setArrowWidth(arrowRef.current.getBoundingClientRect().width);
75
84
  }, [
@@ -80,7 +89,10 @@ function $61e2b7078adb18bc$var$PopoverInner({ state: state, isExiting: isExiting
80
89
  let { popoverProps: popoverProps, underlayProps: underlayProps, arrowProps: arrowProps, placement: placement } = (0, $4DQW2$reactaria.usePopover)({
81
90
  ...props,
82
91
  offset: (_props_offset = props.offset) !== null && _props_offset !== void 0 ? _props_offset : 8,
83
- arrowSize: arrowWidth
92
+ arrowSize: arrowWidth,
93
+ // If this is a submenu/subdialog, use the root popover's container
94
+ // to detect outside interaction and add aria-hidden.
95
+ groupRef: isSubPopover ? groupCtx : containerRef
84
96
  }, state);
85
97
  let ref = props.popoverRef;
86
98
  let isEntering = (0, $4DQW2$reactariautils.useEnterAnimation)(ref, !!placement) || props.isEntering || false;
@@ -94,27 +106,38 @@ function $61e2b7078adb18bc$var$PopoverInner({ state: state, isExiting: isExiting
94
106
  isExiting: isExiting
95
107
  }
96
108
  });
109
+ // Automatically render Popover with role=dialog except when isNonModal is true,
110
+ // or a dialog is already nested inside the popover.
111
+ let shouldBeDialog = !props.isNonModal || props.trigger === 'SubmenuTrigger';
112
+ let [isDialog, setDialog] = (0, $4DQW2$react.useState)(false);
113
+ (0, $4DQW2$reactariautils.useLayoutEffect)(()=>{
114
+ if (ref.current) setDialog(shouldBeDialog && !ref.current.querySelector('[role=dialog]'));
115
+ }, [
116
+ ref,
117
+ shouldBeDialog
118
+ ]);
119
+ // Focus the popover itself on mount, unless a child element is already focused.
120
+ (0, $4DQW2$react.useEffect)(()=>{
121
+ if (isDialog && ref.current && !ref.current.contains(document.activeElement)) (0, $4DQW2$reactariainteractions.focusSafely)(ref.current);
122
+ }, [
123
+ isDialog,
124
+ ref
125
+ ]);
97
126
  let style = {
98
127
  ...popoverProps.style,
99
128
  ...renderProps.style
100
129
  };
101
- return /*#__PURE__*/ (0, ($parcel$interopDefault($4DQW2$react))).createElement((0, $4DQW2$reactaria.Overlay), {
102
- ...props,
103
- isExiting: isExiting,
104
- portalContainer: UNSTABLE_portalContainer
105
- }, !props.isNonModal && state.isOpen && /*#__PURE__*/ (0, ($parcel$interopDefault($4DQW2$react))).createElement("div", {
106
- "data-testid": "underlay",
107
- ...underlayProps,
108
- style: {
109
- position: 'fixed',
110
- inset: 0
111
- }
112
- }), /*#__PURE__*/ (0, ($parcel$interopDefault($4DQW2$react))).createElement("div", {
130
+ let overlay = /*#__PURE__*/ (0, ($parcel$interopDefault($4DQW2$react))).createElement("div", {
113
131
  ...(0, $4DQW2$reactariautils.mergeProps)((0, $4DQW2$reactariautils.filterDOMProps)(props), popoverProps),
114
132
  ...renderProps,
133
+ role: isDialog ? 'dialog' : undefined,
134
+ tabIndex: isDialog ? -1 : undefined,
135
+ "aria-label": props['aria-label'],
136
+ "aria-labelledby": props['aria-labelledby'],
115
137
  ref: ref,
116
138
  slot: props.slot || undefined,
117
139
  style: style,
140
+ dir: props.dir,
118
141
  "data-trigger": props.trigger,
119
142
  "data-placement": placement,
120
143
  "data-entering": isEntering || undefined,
@@ -129,7 +152,36 @@ function $61e2b7078adb18bc$var$PopoverInner({ state: state, isExiting: isExiting
129
152
  }
130
153
  }, renderProps.children), /*#__PURE__*/ (0, ($parcel$interopDefault($4DQW2$react))).createElement((0, $4DQW2$reactaria.DismissButton), {
131
154
  onDismiss: state.close
132
- })));
155
+ }));
156
+ // If this is a root popover, render an extra div to act as the portal container for submenus/subdialogs.
157
+ if (!isSubPopover) return /*#__PURE__*/ (0, ($parcel$interopDefault($4DQW2$react))).createElement((0, $4DQW2$reactaria.Overlay), {
158
+ ...props,
159
+ shouldContainFocus: isDialog,
160
+ isExiting: isExiting,
161
+ portalContainer: UNSTABLE_portalContainer
162
+ }, !props.isNonModal && state.isOpen && /*#__PURE__*/ (0, ($parcel$interopDefault($4DQW2$react))).createElement("div", {
163
+ "data-testid": "underlay",
164
+ ...underlayProps,
165
+ style: {
166
+ position: 'fixed',
167
+ inset: 0
168
+ }
169
+ }), /*#__PURE__*/ (0, ($parcel$interopDefault($4DQW2$react))).createElement("div", {
170
+ ref: containerRef,
171
+ style: {
172
+ display: 'contents'
173
+ }
174
+ }, /*#__PURE__*/ (0, ($parcel$interopDefault($4DQW2$react))).createElement($61e2b7078adb18bc$var$PopoverGroupContext.Provider, {
175
+ value: containerRef
176
+ }, overlay)));
177
+ var _ref;
178
+ // Submenus/subdialogs are mounted into the root popover's container.
179
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($4DQW2$react))).createElement((0, $4DQW2$reactaria.Overlay), {
180
+ ...props,
181
+ shouldContainFocus: isDialog,
182
+ isExiting: isExiting,
183
+ portalContainer: (_ref = UNSTABLE_portalContainer !== null && UNSTABLE_portalContainer !== void 0 ? UNSTABLE_portalContainer : groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.current) !== null && _ref !== void 0 ? _ref : undefined
184
+ }, overlay);
133
185
  }
134
186
 
135
187
 
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAsEM,MAAM,0DAAiB,CAAA,GAAA,0BAAY,EAA2C;AAK9E,MAAM,4CAAwB,AAAd,WAAW,GAAI,CAAA,GAAA,uBAAS,EAAqB,SAAS,QAAQ,KAAmB,EAAE,GAA8B;IACtI,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,eAAe,CAAA,GAAA,uBAAS,EAAE,CAAA,GAAA,oDAAyB;IACvD,IAAI,aAAa,CAAA,GAAA,0CAAqB,EAAE;IACxC,IAAI,QAAQ,MAAM,MAAM,IAAI,QAAQ,MAAM,WAAW,IAAI,QAAQ,CAAC,eAAe,aAAa;IAC9F,IAAI,YAAY,CAAA,GAAA,sCAAe,EAAE,KAAK,MAAM,MAAM,KAAK,MAAM,SAAS,IAAI;IAC1E,IAAI,WAAW,CAAA,GAAA,uCAAU;IAEzB,sEAAsE;IACtE,IAAI,UAAU;QACZ,IAAI,WAAW,MAAM,QAAQ;QAC7B,IAAI,OAAO,aAAa,YACtB,WAAW,SAAS;YAClB,SAAS,MAAM,OAAO,IAAI;YAC1B,WAAW;YACX,YAAY;YACZ,WAAW;YACX,iBAAiB;QACnB;QAGF,qBAAO,sHAAG;IACZ;IAEA,IAAI,SAAS,CAAC,MAAM,MAAM,IAAI,CAAC,WAC7B,OAAO;IAGT,qBACE,0DAAC;QACE,GAAG,KAAK;QACT,YAAY,MAAM,UAAU;QAC5B,OAAO;QACP,YAAY;QACZ,WAAW;;AAEjB;AAUA,SAAS,mCAAa,SAAC,KAAK,aAAE,SAA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AM,IAAI,IAAI;QACpB,OAAO;QACP,gBAAc,MAAM,OAAO;QAC3B,kBAAgB;QAChB,iBAAe,cAAc;QAC7B,gBAAc,aAAa;OAC1B,CAAC,MAAM,UAAU,kBAAI,0DAAC,CAAA,GAAA,8BAAY;QAAE,WAAW,MAAM,KAAK;sBAC3D,0DAAC,CAAA,GAAA,6CAAkB,EAAE,QAAQ;QAAC,OAAO;YAAC,GAAG,UAAU;uBAAE;YAAW,KAAK;QAAQ;OAC1E,YAAY,QAAQ,iBAEvB,0DAAC,CAAA,GAAA,8BAAY;QAAE,WAAW,MAAM,KAAK;;AAI7C","sources":["packages/react-aria-components/src/Popover.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 {AriaPopoverProps, DismissButton, Overlay, PlacementAxis, PositionProps, usePopover} from 'react-aria';\nimport {ContextValue, RenderProps, SlotProps, useContextProps, useRenderProps} from './utils';\nimport {filterDOMProps, mergeProps, useEnterAnimation, useExitAnimation, useLayoutEffect} from '@react-aria/utils';\nimport {forwardRefType, RefObject} from '@react-types/shared';\nimport {OverlayArrowContext} from './OverlayArrow';\nimport {OverlayTriggerProps, OverlayTriggerState, useOverlayTriggerState} from 'react-stately';\nimport {OverlayTriggerStateContext} from './Dialog';\nimport React, {createContext, ForwardedRef, forwardRef, useContext, useRef, useState} from 'react';\nimport {useIsHidden} from '@react-aria/collections';\n\nexport interface PopoverProps extends Omit<PositionProps, 'isOpen'>, Omit<AriaPopoverProps, 'popoverRef' | 'triggerRef' | 'offset' | 'arrowSize'>, OverlayTriggerProps, RenderProps<PopoverRenderProps>, SlotProps {\n /**\n * The name of the component that triggered the popover. This is reflected on the element\n * as the `data-trigger` attribute, and can be used to provide specific\n * styles for the popover depending on which element triggered it.\n */\n trigger?: string,\n /**\n * The ref for the element which the popover positions itself with respect to.\n *\n * When used within a trigger component such as DialogTrigger, MenuTrigger, Select, etc.,\n * this is set automatically. It is only required when used standalone.\n */\n triggerRef?: RefObject<Element | null>,\n /**\n * Whether the popover is currently performing an entry animation.\n */\n isEntering?: boolean,\n /**\n * Whether the popover 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 additional offset applied along the main axis between the element and its\n * anchor element.\n * @default 8\n */\n offset?: number\n}\n\nexport interface PopoverRenderProps {\n /**\n * The name of the component that triggered the popover, e.g. \"DialogTrigger\" or \"ComboBox\".\n * @selector [data-trigger=\"...\"]\n */\n trigger: string | null,\n /**\n * The placement of the popover relative to the trigger.\n * @selector [data-placement=\"left | right | top | bottom\"]\n */\n placement: PlacementAxis | null,\n /**\n * Whether the popover is currently entering. Use this to apply animations.\n * @selector [data-entering]\n */\n isEntering: boolean,\n /**\n * Whether the popover is currently exiting. Use this to apply animations.\n * @selector [data-exiting]\n */\n isExiting: boolean\n}\n\nexport const PopoverContext = createContext<ContextValue<PopoverProps, HTMLElement>>(null);\n\n/**\n * A popover is an overlay element positioned relative to a trigger.\n */\nexport const Popover = /*#__PURE__*/ (forwardRef as forwardRefType)(function Popover(props: PopoverProps, ref: ForwardedRef<HTMLElement>) {\n [props, ref] = useContextProps(props, ref, PopoverContext);\n let contextState = useContext(OverlayTriggerStateContext);\n let localState = useOverlayTriggerState(props);\n let state = props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;\n let isExiting = useExitAnimation(ref, state.isOpen) || props.isExiting || false;\n let isHidden = useIsHidden();\n\n // If we are in a hidden tree, we still need to preserve our children.\n if (isHidden) {\n let children = props.children;\n if (typeof children === 'function') {\n children = children({\n trigger: props.trigger || null,\n placement: 'bottom',\n isEntering: false,\n isExiting: false,\n defaultChildren: null\n });\n }\n\n return <>{children}</>;\n }\n\n if (state && !state.isOpen && !isExiting) {\n return null;\n }\n\n return (\n <PopoverInner\n {...props}\n triggerRef={props.triggerRef!}\n state={state}\n popoverRef={ref}\n isExiting={isExiting} />\n );\n});\n\ninterface PopoverInnerProps extends AriaPopoverProps, RenderProps<PopoverRenderProps>, SlotProps {\n state: OverlayTriggerState,\n isEntering?: boolean,\n isExiting: boolean,\n UNSTABLE_portalContainer?: Element,\n trigger?: string\n}\n\nfunction PopoverInner({state, isExiting, UNSTABLE_portalContainer, ...props}: PopoverInnerProps) {\n // Calculate the arrow size internally (and remove props.arrowSize from PopoverProps)\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 {popoverProps, underlayProps, arrowProps, placement} = usePopover({\n ...props,\n offset: props.offset ?? 8,\n arrowSize: arrowWidth\n }, state);\n\n let ref = props.popoverRef as RefObject<HTMLDivElement | null>;\n let isEntering = useEnterAnimation(ref, !!placement) || props.isEntering || false;\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Popover',\n values: {\n trigger: props.trigger || null,\n placement,\n isEntering,\n isExiting\n }\n });\n\n let style = {...popoverProps.style, ...renderProps.style};\n\n return (\n <Overlay {...props} isExiting={isExiting} portalContainer={UNSTABLE_portalContainer}>\n {!props.isNonModal && state.isOpen && <div data-testid=\"underlay\" {...underlayProps} style={{position: 'fixed', inset: 0}} />}\n <div\n {...mergeProps(filterDOMProps(props as any), popoverProps)}\n {...renderProps}\n ref={ref}\n slot={props.slot || undefined}\n style={style}\n data-trigger={props.trigger}\n data-placement={placement}\n data-entering={isEntering || undefined}\n data-exiting={isExiting || undefined}>\n {!props.isNonModal && <DismissButton onDismiss={state.close} />}\n <OverlayArrowContext.Provider value={{...arrowProps, placement, ref: arrowRef}}>\n {renderProps.children}\n </OverlayArrowContext.Provider>\n <DismissButton onDismiss={state.close} />\n </div>\n </Overlay>\n );\n}\n"],"names":[],"version":3,"file":"Popover.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;AAuEM,MAAM,0DAAiB,CAAA,GAAA,0BAAY,EAA2C;AAErF,iFAAiF;AACjF,MAAM,0DAAsB,CAAA,GAAA,0BAAY,EAAoC;AAKrE,MAAM,4CAAwB,AAAd,WAAW,GAAI,CAAA,GAAA,uBAAS,EAAqB,SAAS,QAAQ,KAAmB,EAAE,GAA8B;IACtI,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,eAAe,CAAA,GAAA,uBAAS,EAAE,CAAA,GAAA,oDAAyB;IACvD,IAAI,aAAa,CAAA,GAAA,0CAAqB,EAAE;IACxC,IAAI,QAAQ,MAAM,MAAM,IAAI,QAAQ,MAAM,WAAW,IAAI,QAAQ,CAAC,eAAe,aAAa;IAC9F,IAAI,YAAY,CAAA,GAAA,sCAAe,EAAE,KAAK,MAAM,MAAM,KAAK,MAAM,SAAS,IAAI;IAC1E,IAAI,WAAW,CAAA,GAAA,uCAAU;IACzB,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,0BAAQ;IAE1B,sEAAsE;IACtE,IAAI,UAAU;QACZ,IAAI,WAAW,MAAM,QAAQ;QAC7B,IAAI,OAAO,aAAa,YACtB,WAAW,SAAS;YAClB,SAAS,MAAM,OAAO,IAAI;YAC1B,WAAW;YACX,YAAY;YACZ,WAAW;YACX,iBAAiB;QACnB;QAGF,qBAAO,sHAAG;IACZ;IAEA,IAAI,SAAS,CAAC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BACE,0DAAC,CAAA,GAAA,wBAAM;QAAG,GAAG,KAAK;QAAE,oBAAoB;QAAU,WAAW;QAAW,iBAAiB;OACtF,CAAC,MAAM,UAAU,IAAI,MAAM,MAAM,kBAAI,0DAAC;QAAI,eAAY;QAAY,GAAG,aAAa;QAAE,OAAO;YAAC,UAAU;YAAS,OAAO;QAAC;sBACxH,0DAAC;QAAI,KAAK;QAAc,OAAO;YAAC,SAAS;QAAU;qBACjD,0DAAC,0CAAoB,QAAQ;QAAC,OAAO;OAClC;QASgF;IAF3F,qEAAqE;IACrE,qBACE,0DAAC,CAAA,GAAA,wBAAM;QAAG,GAAG,KAAK;QAAE,oBAAoB;QAAU,WAAW;QAAW,iBAAiB,CAAA,OAAA,qCAAA,sCAAA,2BAA4B,qBAAA,+BAAA,SAAU,OAAO,cAA7C,kBAAA,OAAiD;OACvI;AAGP","sources":["packages/react-aria-components/src/Popover.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, forwardRefType, RefObject} from '@react-types/shared';\nimport {AriaPopoverProps, DismissButton, Overlay, PlacementAxis, PositionProps, useLocale, usePopover} from 'react-aria';\nimport {ContextValue, RenderProps, SlotProps, useContextProps, useRenderProps} from './utils';\nimport {filterDOMProps, mergeProps, useEnterAnimation, useExitAnimation, useLayoutEffect} from '@react-aria/utils';\nimport {focusSafely} from '@react-aria/interactions';\nimport {OverlayArrowContext} from './OverlayArrow';\nimport {OverlayTriggerProps, OverlayTriggerState, useOverlayTriggerState} from 'react-stately';\nimport {OverlayTriggerStateContext} from './Dialog';\nimport React, {createContext, ForwardedRef, forwardRef, useContext, useEffect, useRef, useState} from 'react';\nimport {useIsHidden} from '@react-aria/collections';\n\nexport interface PopoverProps extends Omit<PositionProps, 'isOpen'>, Omit<AriaPopoverProps, 'popoverRef' | 'triggerRef' | 'groupRef' | 'offset' | 'arrowSize'>, OverlayTriggerProps, RenderProps<PopoverRenderProps>, SlotProps, AriaLabelingProps {\n /**\n * The name of the component that triggered the popover. This is reflected on the element\n * as the `data-trigger` attribute, and can be used to provide specific\n * styles for the popover depending on which element triggered it.\n */\n trigger?: string,\n /**\n * The ref for the element which the popover positions itself with respect to.\n *\n * When used within a trigger component such as DialogTrigger, MenuTrigger, Select, etc.,\n * this is set automatically. It is only required when used standalone.\n */\n triggerRef?: RefObject<Element | null>,\n /**\n * Whether the popover is currently performing an entry animation.\n */\n isEntering?: boolean,\n /**\n * Whether the popover 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 additional offset applied along the main axis between the element and its\n * anchor element.\n * @default 8\n */\n offset?: number\n}\n\nexport interface PopoverRenderProps {\n /**\n * The name of the component that triggered the popover, e.g. \"DialogTrigger\" or \"ComboBox\".\n * @selector [data-trigger=\"...\"]\n */\n trigger: string | null,\n /**\n * The placement of the popover relative to the trigger.\n * @selector [data-placement=\"left | right | top | bottom\"]\n */\n placement: PlacementAxis | null,\n /**\n * Whether the popover is currently entering. Use this to apply animations.\n * @selector [data-entering]\n */\n isEntering: boolean,\n /**\n * Whether the popover is currently exiting. Use this to apply animations.\n * @selector [data-exiting]\n */\n isExiting: boolean\n}\n\nexport const PopoverContext = createContext<ContextValue<PopoverProps, HTMLElement>>(null);\n\n// Stores a ref for the portal container for a group of popovers (e.g. submenus).\nconst PopoverGroupContext = createContext<RefObject<Element | null> | null>(null);\n\n/**\n * A popover is an overlay element positioned relative to a trigger.\n */\nexport const Popover = /*#__PURE__*/ (forwardRef as forwardRefType)(function Popover(props: PopoverProps, ref: ForwardedRef<HTMLElement>) {\n [props, ref] = useContextProps(props, ref, PopoverContext);\n let contextState = useContext(OverlayTriggerStateContext);\n let localState = useOverlayTriggerState(props);\n let state = props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;\n let isExiting = useExitAnimation(ref, state.isOpen) || props.isExiting || false;\n let isHidden = useIsHidden();\n let {direction} = useLocale();\n\n // If we are in a hidden tree, we still need to preserve our children.\n if (isHidden) {\n let children = props.children;\n if (typeof children === 'function') {\n children = children({\n trigger: props.trigger || null,\n placement: 'bottom',\n isEntering: false,\n isExiting: false,\n defaultChildren: null\n });\n }\n\n return <>{children}</>;\n }\n\n if (state && !state.isOpen && !isExiting) {\n return null;\n }\n\n return (\n <PopoverInner\n {...props}\n triggerRef={props.triggerRef!}\n state={state}\n popoverRef={ref}\n isExiting={isExiting}\n dir={direction} />\n );\n});\n\ninterface PopoverInnerProps extends AriaPopoverProps, RenderProps<PopoverRenderProps>, SlotProps {\n state: OverlayTriggerState,\n isEntering?: boolean,\n isExiting: boolean,\n UNSTABLE_portalContainer?: Element,\n trigger?: string,\n dir?: 'ltr' | 'rtl'\n}\n\nfunction PopoverInner({state, isExiting, UNSTABLE_portalContainer, ...props}: PopoverInnerProps) {\n // Calculate the arrow size internally (and remove props.arrowSize from PopoverProps)\n // Referenced from: packages/@react-spectrum/tooltip/src/TooltipTrigger.tsx\n let arrowRef = useRef<HTMLDivElement>(null);\n let [arrowWidth, setArrowWidth] = useState(0);\n let containerRef = useRef<HTMLDivElement | null>(null);\n let groupCtx = useContext(PopoverGroupContext);\n let isSubPopover = groupCtx && props.trigger === 'SubmenuTrigger';\n useLayoutEffect(() => {\n if (arrowRef.current && state.isOpen) {\n setArrowWidth(arrowRef.current.getBoundingClientRect().width);\n }\n }, [state.isOpen, arrowRef]);\n\n let {popoverProps, underlayProps, arrowProps, placement} = usePopover({\n ...props,\n offset: props.offset ?? 8,\n arrowSize: arrowWidth,\n // If this is a submenu/subdialog, use the root popover's container \n // to detect outside interaction and add aria-hidden.\n groupRef: isSubPopover ? groupCtx! : containerRef\n }, state);\n\n let ref = props.popoverRef as RefObject<HTMLDivElement | null>;\n let isEntering = useEnterAnimation(ref, !!placement) || props.isEntering || false;\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Popover',\n values: {\n trigger: props.trigger || null,\n placement,\n isEntering,\n isExiting\n }\n });\n\n // Automatically render Popover with role=dialog except when isNonModal is true,\n // or a dialog is already nested inside the popover.\n let shouldBeDialog = !props.isNonModal || props.trigger === 'SubmenuTrigger';\n let [isDialog, setDialog] = useState(false);\n useLayoutEffect(() => {\n if (ref.current) {\n setDialog(shouldBeDialog && !ref.current.querySelector('[role=dialog]'));\n }\n }, [ref, shouldBeDialog]);\n\n // Focus the popover itself on mount, unless a child element is already focused.\n useEffect(() => {\n if (isDialog && ref.current && !ref.current.contains(document.activeElement)) {\n focusSafely(ref.current);\n }\n }, [isDialog, ref]);\n\n let style = {...popoverProps.style, ...renderProps.style};\n let overlay = (\n <div\n {...mergeProps(filterDOMProps(props as any), popoverProps)}\n {...renderProps}\n role={isDialog ? 'dialog' : undefined}\n tabIndex={isDialog ? -1 : undefined}\n aria-label={props['aria-label']}\n aria-labelledby={props['aria-labelledby']}\n ref={ref}\n slot={props.slot || undefined}\n style={style}\n dir={props.dir}\n data-trigger={props.trigger}\n data-placement={placement}\n data-entering={isEntering || undefined}\n data-exiting={isExiting || undefined}>\n {!props.isNonModal && <DismissButton onDismiss={state.close} />}\n <OverlayArrowContext.Provider value={{...arrowProps, placement, ref: arrowRef}}>\n {renderProps.children}\n </OverlayArrowContext.Provider>\n <DismissButton onDismiss={state.close} />\n </div>\n );\n\n // If this is a root popover, render an extra div to act as the portal container for submenus/subdialogs.\n if (!isSubPopover) {\n return (\n <Overlay {...props} shouldContainFocus={isDialog} isExiting={isExiting} portalContainer={UNSTABLE_portalContainer}>\n {!props.isNonModal && state.isOpen && <div data-testid=\"underlay\" {...underlayProps} style={{position: 'fixed', inset: 0}} />}\n <div ref={containerRef} style={{display: 'contents'}}>\n <PopoverGroupContext.Provider value={containerRef}>\n {overlay}\n </PopoverGroupContext.Provider>\n </div>\n </Overlay>\n );\n }\n\n // Submenus/subdialogs are mounted into the root popover's container.\n return (\n <Overlay {...props} shouldContainFocus={isDialog} isExiting={isExiting} portalContainer={UNSTABLE_portalContainer ?? groupCtx?.current ?? undefined}>\n {overlay}\n </Overlay>\n );\n}\n"],"names":[],"version":3,"file":"Popover.main.js.map"}
package/dist/Popover.mjs CHANGED
@@ -1,10 +1,11 @@
1
1
  import {useContextProps as $64fa3d84918910a7$export$29f1550f4b0d4415, useRenderProps as $64fa3d84918910a7$export$4d86445c2cf5e3} from "./utils.mjs";
2
2
  import {OverlayArrowContext as $44f671af83e7d9e0$export$2de4954e8ae13b9f} from "./OverlayArrow.mjs";
3
3
  import {OverlayTriggerStateContext as $de32f1b87079253c$export$d2f961adcb0afbe} from "./Dialog.mjs";
4
- import {usePopover as $ehFet$usePopover, Overlay as $ehFet$Overlay, DismissButton as $ehFet$DismissButton} from "react-aria";
4
+ import {useLocale as $ehFet$useLocale, usePopover as $ehFet$usePopover, DismissButton as $ehFet$DismissButton, Overlay as $ehFet$Overlay} from "react-aria";
5
5
  import {useExitAnimation as $ehFet$useExitAnimation, useLayoutEffect as $ehFet$useLayoutEffect, useEnterAnimation as $ehFet$useEnterAnimation, mergeProps as $ehFet$mergeProps, filterDOMProps as $ehFet$filterDOMProps} from "@react-aria/utils";
6
+ import {focusSafely as $ehFet$focusSafely} from "@react-aria/interactions";
6
7
  import {useOverlayTriggerState as $ehFet$useOverlayTriggerState} from "react-stately";
7
- import $ehFet$react, {createContext as $ehFet$createContext, forwardRef as $ehFet$forwardRef, useContext as $ehFet$useContext, useRef as $ehFet$useRef, useState as $ehFet$useState} from "react";
8
+ import $ehFet$react, {createContext as $ehFet$createContext, forwardRef as $ehFet$forwardRef, useContext as $ehFet$useContext, useRef as $ehFet$useRef, useState as $ehFet$useState, useEffect as $ehFet$useEffect} from "react";
8
9
  import {useIsHidden as $ehFet$useIsHidden} from "@react-aria/collections";
9
10
 
10
11
  /*
@@ -25,7 +26,10 @@ import {useIsHidden as $ehFet$useIsHidden} from "@react-aria/collections";
25
26
 
26
27
 
27
28
 
29
+
28
30
  const $07b14b47974efb58$export$9b9a0cd73afb7ca4 = /*#__PURE__*/ (0, $ehFet$createContext)(null);
31
+ // Stores a ref for the portal container for a group of popovers (e.g. submenus).
32
+ const $07b14b47974efb58$var$PopoverGroupContext = /*#__PURE__*/ (0, $ehFet$createContext)(null);
29
33
  const $07b14b47974efb58$export$5b6b19405a83ff9d = /*#__PURE__*/ (0, $ehFet$forwardRef)(function Popover(props, ref) {
30
34
  [props, ref] = (0, $64fa3d84918910a7$export$29f1550f4b0d4415)(props, ref, $07b14b47974efb58$export$9b9a0cd73afb7ca4);
31
35
  let contextState = (0, $ehFet$useContext)((0, $de32f1b87079253c$export$d2f961adcb0afbe));
@@ -33,6 +37,7 @@ const $07b14b47974efb58$export$5b6b19405a83ff9d = /*#__PURE__*/ (0, $ehFet$forwa
33
37
  let state = props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;
34
38
  let isExiting = (0, $ehFet$useExitAnimation)(ref, state.isOpen) || props.isExiting || false;
35
39
  let isHidden = (0, $ehFet$useIsHidden)();
40
+ let { direction: direction } = (0, $ehFet$useLocale)();
36
41
  // If we are in a hidden tree, we still need to preserve our children.
37
42
  if (isHidden) {
38
43
  let children = props.children;
@@ -51,7 +56,8 @@ const $07b14b47974efb58$export$5b6b19405a83ff9d = /*#__PURE__*/ (0, $ehFet$forwa
51
56
  triggerRef: props.triggerRef,
52
57
  state: state,
53
58
  popoverRef: ref,
54
- isExiting: isExiting
59
+ isExiting: isExiting,
60
+ dir: direction
55
61
  });
56
62
  });
57
63
  function $07b14b47974efb58$var$PopoverInner({ state: state, isExiting: isExiting, UNSTABLE_portalContainer: UNSTABLE_portalContainer, ...props }) {
@@ -59,6 +65,9 @@ function $07b14b47974efb58$var$PopoverInner({ state: state, isExiting: isExiting
59
65
  // Referenced from: packages/@react-spectrum/tooltip/src/TooltipTrigger.tsx
60
66
  let arrowRef = (0, $ehFet$useRef)(null);
61
67
  let [arrowWidth, setArrowWidth] = (0, $ehFet$useState)(0);
68
+ let containerRef = (0, $ehFet$useRef)(null);
69
+ let groupCtx = (0, $ehFet$useContext)($07b14b47974efb58$var$PopoverGroupContext);
70
+ let isSubPopover = groupCtx && props.trigger === 'SubmenuTrigger';
62
71
  (0, $ehFet$useLayoutEffect)(()=>{
63
72
  if (arrowRef.current && state.isOpen) setArrowWidth(arrowRef.current.getBoundingClientRect().width);
64
73
  }, [
@@ -69,7 +78,10 @@ function $07b14b47974efb58$var$PopoverInner({ state: state, isExiting: isExiting
69
78
  let { popoverProps: popoverProps, underlayProps: underlayProps, arrowProps: arrowProps, placement: placement } = (0, $ehFet$usePopover)({
70
79
  ...props,
71
80
  offset: (_props_offset = props.offset) !== null && _props_offset !== void 0 ? _props_offset : 8,
72
- arrowSize: arrowWidth
81
+ arrowSize: arrowWidth,
82
+ // If this is a submenu/subdialog, use the root popover's container
83
+ // to detect outside interaction and add aria-hidden.
84
+ groupRef: isSubPopover ? groupCtx : containerRef
73
85
  }, state);
74
86
  let ref = props.popoverRef;
75
87
  let isEntering = (0, $ehFet$useEnterAnimation)(ref, !!placement) || props.isEntering || false;
@@ -83,27 +95,38 @@ function $07b14b47974efb58$var$PopoverInner({ state: state, isExiting: isExiting
83
95
  isExiting: isExiting
84
96
  }
85
97
  });
98
+ // Automatically render Popover with role=dialog except when isNonModal is true,
99
+ // or a dialog is already nested inside the popover.
100
+ let shouldBeDialog = !props.isNonModal || props.trigger === 'SubmenuTrigger';
101
+ let [isDialog, setDialog] = (0, $ehFet$useState)(false);
102
+ (0, $ehFet$useLayoutEffect)(()=>{
103
+ if (ref.current) setDialog(shouldBeDialog && !ref.current.querySelector('[role=dialog]'));
104
+ }, [
105
+ ref,
106
+ shouldBeDialog
107
+ ]);
108
+ // Focus the popover itself on mount, unless a child element is already focused.
109
+ (0, $ehFet$useEffect)(()=>{
110
+ if (isDialog && ref.current && !ref.current.contains(document.activeElement)) (0, $ehFet$focusSafely)(ref.current);
111
+ }, [
112
+ isDialog,
113
+ ref
114
+ ]);
86
115
  let style = {
87
116
  ...popoverProps.style,
88
117
  ...renderProps.style
89
118
  };
90
- return /*#__PURE__*/ (0, $ehFet$react).createElement((0, $ehFet$Overlay), {
91
- ...props,
92
- isExiting: isExiting,
93
- portalContainer: UNSTABLE_portalContainer
94
- }, !props.isNonModal && state.isOpen && /*#__PURE__*/ (0, $ehFet$react).createElement("div", {
95
- "data-testid": "underlay",
96
- ...underlayProps,
97
- style: {
98
- position: 'fixed',
99
- inset: 0
100
- }
101
- }), /*#__PURE__*/ (0, $ehFet$react).createElement("div", {
119
+ let overlay = /*#__PURE__*/ (0, $ehFet$react).createElement("div", {
102
120
  ...(0, $ehFet$mergeProps)((0, $ehFet$filterDOMProps)(props), popoverProps),
103
121
  ...renderProps,
122
+ role: isDialog ? 'dialog' : undefined,
123
+ tabIndex: isDialog ? -1 : undefined,
124
+ "aria-label": props['aria-label'],
125
+ "aria-labelledby": props['aria-labelledby'],
104
126
  ref: ref,
105
127
  slot: props.slot || undefined,
106
128
  style: style,
129
+ dir: props.dir,
107
130
  "data-trigger": props.trigger,
108
131
  "data-placement": placement,
109
132
  "data-entering": isEntering || undefined,
@@ -118,7 +141,36 @@ function $07b14b47974efb58$var$PopoverInner({ state: state, isExiting: isExiting
118
141
  }
119
142
  }, renderProps.children), /*#__PURE__*/ (0, $ehFet$react).createElement((0, $ehFet$DismissButton), {
120
143
  onDismiss: state.close
121
- })));
144
+ }));
145
+ // If this is a root popover, render an extra div to act as the portal container for submenus/subdialogs.
146
+ if (!isSubPopover) return /*#__PURE__*/ (0, $ehFet$react).createElement((0, $ehFet$Overlay), {
147
+ ...props,
148
+ shouldContainFocus: isDialog,
149
+ isExiting: isExiting,
150
+ portalContainer: UNSTABLE_portalContainer
151
+ }, !props.isNonModal && state.isOpen && /*#__PURE__*/ (0, $ehFet$react).createElement("div", {
152
+ "data-testid": "underlay",
153
+ ...underlayProps,
154
+ style: {
155
+ position: 'fixed',
156
+ inset: 0
157
+ }
158
+ }), /*#__PURE__*/ (0, $ehFet$react).createElement("div", {
159
+ ref: containerRef,
160
+ style: {
161
+ display: 'contents'
162
+ }
163
+ }, /*#__PURE__*/ (0, $ehFet$react).createElement($07b14b47974efb58$var$PopoverGroupContext.Provider, {
164
+ value: containerRef
165
+ }, overlay)));
166
+ var _ref;
167
+ // Submenus/subdialogs are mounted into the root popover's container.
168
+ return /*#__PURE__*/ (0, $ehFet$react).createElement((0, $ehFet$Overlay), {
169
+ ...props,
170
+ shouldContainFocus: isDialog,
171
+ isExiting: isExiting,
172
+ portalContainer: (_ref = UNSTABLE_portalContainer !== null && UNSTABLE_portalContainer !== void 0 ? UNSTABLE_portalContainer : groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.current) !== null && _ref !== void 0 ? _ref : undefined
173
+ }, overlay);
122
174
  }
123
175
 
124
176
 
@@ -1,10 +1,11 @@
1
1
  import {useContextProps as $64fa3d84918910a7$export$29f1550f4b0d4415, useRenderProps as $64fa3d84918910a7$export$4d86445c2cf5e3} from "./utils.module.js";
2
2
  import {OverlayArrowContext as $44f671af83e7d9e0$export$2de4954e8ae13b9f} from "./OverlayArrow.module.js";
3
3
  import {OverlayTriggerStateContext as $de32f1b87079253c$export$d2f961adcb0afbe} from "./Dialog.module.js";
4
- import {usePopover as $ehFet$usePopover, Overlay as $ehFet$Overlay, DismissButton as $ehFet$DismissButton} from "react-aria";
4
+ import {useLocale as $ehFet$useLocale, usePopover as $ehFet$usePopover, DismissButton as $ehFet$DismissButton, Overlay as $ehFet$Overlay} from "react-aria";
5
5
  import {useExitAnimation as $ehFet$useExitAnimation, useLayoutEffect as $ehFet$useLayoutEffect, useEnterAnimation as $ehFet$useEnterAnimation, mergeProps as $ehFet$mergeProps, filterDOMProps as $ehFet$filterDOMProps} from "@react-aria/utils";
6
+ import {focusSafely as $ehFet$focusSafely} from "@react-aria/interactions";
6
7
  import {useOverlayTriggerState as $ehFet$useOverlayTriggerState} from "react-stately";
7
- import $ehFet$react, {createContext as $ehFet$createContext, forwardRef as $ehFet$forwardRef, useContext as $ehFet$useContext, useRef as $ehFet$useRef, useState as $ehFet$useState} from "react";
8
+ import $ehFet$react, {createContext as $ehFet$createContext, forwardRef as $ehFet$forwardRef, useContext as $ehFet$useContext, useRef as $ehFet$useRef, useState as $ehFet$useState, useEffect as $ehFet$useEffect} from "react";
8
9
  import {useIsHidden as $ehFet$useIsHidden} from "@react-aria/collections";
9
10
 
10
11
  /*
@@ -25,7 +26,10 @@ import {useIsHidden as $ehFet$useIsHidden} from "@react-aria/collections";
25
26
 
26
27
 
27
28
 
29
+
28
30
  const $07b14b47974efb58$export$9b9a0cd73afb7ca4 = /*#__PURE__*/ (0, $ehFet$createContext)(null);
31
+ // Stores a ref for the portal container for a group of popovers (e.g. submenus).
32
+ const $07b14b47974efb58$var$PopoverGroupContext = /*#__PURE__*/ (0, $ehFet$createContext)(null);
29
33
  const $07b14b47974efb58$export$5b6b19405a83ff9d = /*#__PURE__*/ (0, $ehFet$forwardRef)(function Popover(props, ref) {
30
34
  [props, ref] = (0, $64fa3d84918910a7$export$29f1550f4b0d4415)(props, ref, $07b14b47974efb58$export$9b9a0cd73afb7ca4);
31
35
  let contextState = (0, $ehFet$useContext)((0, $de32f1b87079253c$export$d2f961adcb0afbe));
@@ -33,6 +37,7 @@ const $07b14b47974efb58$export$5b6b19405a83ff9d = /*#__PURE__*/ (0, $ehFet$forwa
33
37
  let state = props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;
34
38
  let isExiting = (0, $ehFet$useExitAnimation)(ref, state.isOpen) || props.isExiting || false;
35
39
  let isHidden = (0, $ehFet$useIsHidden)();
40
+ let { direction: direction } = (0, $ehFet$useLocale)();
36
41
  // If we are in a hidden tree, we still need to preserve our children.
37
42
  if (isHidden) {
38
43
  let children = props.children;
@@ -51,7 +56,8 @@ const $07b14b47974efb58$export$5b6b19405a83ff9d = /*#__PURE__*/ (0, $ehFet$forwa
51
56
  triggerRef: props.triggerRef,
52
57
  state: state,
53
58
  popoverRef: ref,
54
- isExiting: isExiting
59
+ isExiting: isExiting,
60
+ dir: direction
55
61
  });
56
62
  });
57
63
  function $07b14b47974efb58$var$PopoverInner({ state: state, isExiting: isExiting, UNSTABLE_portalContainer: UNSTABLE_portalContainer, ...props }) {
@@ -59,6 +65,9 @@ function $07b14b47974efb58$var$PopoverInner({ state: state, isExiting: isExiting
59
65
  // Referenced from: packages/@react-spectrum/tooltip/src/TooltipTrigger.tsx
60
66
  let arrowRef = (0, $ehFet$useRef)(null);
61
67
  let [arrowWidth, setArrowWidth] = (0, $ehFet$useState)(0);
68
+ let containerRef = (0, $ehFet$useRef)(null);
69
+ let groupCtx = (0, $ehFet$useContext)($07b14b47974efb58$var$PopoverGroupContext);
70
+ let isSubPopover = groupCtx && props.trigger === 'SubmenuTrigger';
62
71
  (0, $ehFet$useLayoutEffect)(()=>{
63
72
  if (arrowRef.current && state.isOpen) setArrowWidth(arrowRef.current.getBoundingClientRect().width);
64
73
  }, [
@@ -69,7 +78,10 @@ function $07b14b47974efb58$var$PopoverInner({ state: state, isExiting: isExiting
69
78
  let { popoverProps: popoverProps, underlayProps: underlayProps, arrowProps: arrowProps, placement: placement } = (0, $ehFet$usePopover)({
70
79
  ...props,
71
80
  offset: (_props_offset = props.offset) !== null && _props_offset !== void 0 ? _props_offset : 8,
72
- arrowSize: arrowWidth
81
+ arrowSize: arrowWidth,
82
+ // If this is a submenu/subdialog, use the root popover's container
83
+ // to detect outside interaction and add aria-hidden.
84
+ groupRef: isSubPopover ? groupCtx : containerRef
73
85
  }, state);
74
86
  let ref = props.popoverRef;
75
87
  let isEntering = (0, $ehFet$useEnterAnimation)(ref, !!placement) || props.isEntering || false;
@@ -83,27 +95,38 @@ function $07b14b47974efb58$var$PopoverInner({ state: state, isExiting: isExiting
83
95
  isExiting: isExiting
84
96
  }
85
97
  });
98
+ // Automatically render Popover with role=dialog except when isNonModal is true,
99
+ // or a dialog is already nested inside the popover.
100
+ let shouldBeDialog = !props.isNonModal || props.trigger === 'SubmenuTrigger';
101
+ let [isDialog, setDialog] = (0, $ehFet$useState)(false);
102
+ (0, $ehFet$useLayoutEffect)(()=>{
103
+ if (ref.current) setDialog(shouldBeDialog && !ref.current.querySelector('[role=dialog]'));
104
+ }, [
105
+ ref,
106
+ shouldBeDialog
107
+ ]);
108
+ // Focus the popover itself on mount, unless a child element is already focused.
109
+ (0, $ehFet$useEffect)(()=>{
110
+ if (isDialog && ref.current && !ref.current.contains(document.activeElement)) (0, $ehFet$focusSafely)(ref.current);
111
+ }, [
112
+ isDialog,
113
+ ref
114
+ ]);
86
115
  let style = {
87
116
  ...popoverProps.style,
88
117
  ...renderProps.style
89
118
  };
90
- return /*#__PURE__*/ (0, $ehFet$react).createElement((0, $ehFet$Overlay), {
91
- ...props,
92
- isExiting: isExiting,
93
- portalContainer: UNSTABLE_portalContainer
94
- }, !props.isNonModal && state.isOpen && /*#__PURE__*/ (0, $ehFet$react).createElement("div", {
95
- "data-testid": "underlay",
96
- ...underlayProps,
97
- style: {
98
- position: 'fixed',
99
- inset: 0
100
- }
101
- }), /*#__PURE__*/ (0, $ehFet$react).createElement("div", {
119
+ let overlay = /*#__PURE__*/ (0, $ehFet$react).createElement("div", {
102
120
  ...(0, $ehFet$mergeProps)((0, $ehFet$filterDOMProps)(props), popoverProps),
103
121
  ...renderProps,
122
+ role: isDialog ? 'dialog' : undefined,
123
+ tabIndex: isDialog ? -1 : undefined,
124
+ "aria-label": props['aria-label'],
125
+ "aria-labelledby": props['aria-labelledby'],
104
126
  ref: ref,
105
127
  slot: props.slot || undefined,
106
128
  style: style,
129
+ dir: props.dir,
107
130
  "data-trigger": props.trigger,
108
131
  "data-placement": placement,
109
132
  "data-entering": isEntering || undefined,
@@ -118,7 +141,36 @@ function $07b14b47974efb58$var$PopoverInner({ state: state, isExiting: isExiting
118
141
  }
119
142
  }, renderProps.children), /*#__PURE__*/ (0, $ehFet$react).createElement((0, $ehFet$DismissButton), {
120
143
  onDismiss: state.close
121
- })));
144
+ }));
145
+ // If this is a root popover, render an extra div to act as the portal container for submenus/subdialogs.
146
+ if (!isSubPopover) return /*#__PURE__*/ (0, $ehFet$react).createElement((0, $ehFet$Overlay), {
147
+ ...props,
148
+ shouldContainFocus: isDialog,
149
+ isExiting: isExiting,
150
+ portalContainer: UNSTABLE_portalContainer
151
+ }, !props.isNonModal && state.isOpen && /*#__PURE__*/ (0, $ehFet$react).createElement("div", {
152
+ "data-testid": "underlay",
153
+ ...underlayProps,
154
+ style: {
155
+ position: 'fixed',
156
+ inset: 0
157
+ }
158
+ }), /*#__PURE__*/ (0, $ehFet$react).createElement("div", {
159
+ ref: containerRef,
160
+ style: {
161
+ display: 'contents'
162
+ }
163
+ }, /*#__PURE__*/ (0, $ehFet$react).createElement($07b14b47974efb58$var$PopoverGroupContext.Provider, {
164
+ value: containerRef
165
+ }, overlay)));
166
+ var _ref;
167
+ // Submenus/subdialogs are mounted into the root popover's container.
168
+ return /*#__PURE__*/ (0, $ehFet$react).createElement((0, $ehFet$Overlay), {
169
+ ...props,
170
+ shouldContainFocus: isDialog,
171
+ isExiting: isExiting,
172
+ portalContainer: (_ref = UNSTABLE_portalContainer !== null && UNSTABLE_portalContainer !== void 0 ? UNSTABLE_portalContainer : groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.current) !== null && _ref !== void 0 ? _ref : undefined
173
+ }, overlay);
122
174
  }
123
175
 
124
176
 
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAsEM,MAAM,0DAAiB,CAAA,GAAA,oBAAY,EAA2C;AAK9E,MAAM,4CAAwB,AAAd,WAAW,GAAI,CAAA,GA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,KAAK;;AAI7C","sources":["packages/react-aria-components/src/Popover.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 {AriaPopoverProps, DismissButton, Overlay, PlacementAxis, PositionProps, usePopover} from 'react-aria';\nimport {ContextValue, RenderProps, SlotProps, useContextProps, useRenderProps} from './utils';\nimport {filterDOMProps, mergeProps, useEnterAnimation, useExitAnimation, useLayoutEffect} from '@react-aria/utils';\nimport {forwardRefType, RefObject} from '@react-types/shared';\nimport {OverlayArrowContext} from './OverlayArrow';\nimport {OverlayTriggerProps, OverlayTriggerState, useOverlayTriggerState} from 'react-stately';\nimport {OverlayTriggerStateContext} from './Dialog';\nimport React, {createContext, ForwardedRef, forwardRef, useContext, useRef, useState} from 'react';\nimport {useIsHidden} from '@react-aria/collections';\n\nexport interface PopoverProps extends Omit<PositionProps, 'isOpen'>, Omit<AriaPopoverProps, 'popoverRef' | 'triggerRef' | 'offset' | 'arrowSize'>, OverlayTriggerProps, RenderProps<PopoverRenderProps>, SlotProps {\n /**\n * The name of the component that triggered the popover. This is reflected on the element\n * as the `data-trigger` attribute, and can be used to provide specific\n * styles for the popover depending on which element triggered it.\n */\n trigger?: string,\n /**\n * The ref for the element which the popover positions itself with respect to.\n *\n * When used within a trigger component such as DialogTrigger, MenuTrigger, Select, etc.,\n * this is set automatically. It is only required when used standalone.\n */\n triggerRef?: RefObject<Element | null>,\n /**\n * Whether the popover is currently performing an entry animation.\n */\n isEntering?: boolean,\n /**\n * Whether the popover 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 additional offset applied along the main axis between the element and its\n * anchor element.\n * @default 8\n */\n offset?: number\n}\n\nexport interface PopoverRenderProps {\n /**\n * The name of the component that triggered the popover, e.g. \"DialogTrigger\" or \"ComboBox\".\n * @selector [data-trigger=\"...\"]\n */\n trigger: string | null,\n /**\n * The placement of the popover relative to the trigger.\n * @selector [data-placement=\"left | right | top | bottom\"]\n */\n placement: PlacementAxis | null,\n /**\n * Whether the popover is currently entering. Use this to apply animations.\n * @selector [data-entering]\n */\n isEntering: boolean,\n /**\n * Whether the popover is currently exiting. Use this to apply animations.\n * @selector [data-exiting]\n */\n isExiting: boolean\n}\n\nexport const PopoverContext = createContext<ContextValue<PopoverProps, HTMLElement>>(null);\n\n/**\n * A popover is an overlay element positioned relative to a trigger.\n */\nexport const Popover = /*#__PURE__*/ (forwardRef as forwardRefType)(function Popover(props: PopoverProps, ref: ForwardedRef<HTMLElement>) {\n [props, ref] = useContextProps(props, ref, PopoverContext);\n let contextState = useContext(OverlayTriggerStateContext);\n let localState = useOverlayTriggerState(props);\n let state = props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;\n let isExiting = useExitAnimation(ref, state.isOpen) || props.isExiting || false;\n let isHidden = useIsHidden();\n\n // If we are in a hidden tree, we still need to preserve our children.\n if (isHidden) {\n let children = props.children;\n if (typeof children === 'function') {\n children = children({\n trigger: props.trigger || null,\n placement: 'bottom',\n isEntering: false,\n isExiting: false,\n defaultChildren: null\n });\n }\n\n return <>{children}</>;\n }\n\n if (state && !state.isOpen && !isExiting) {\n return null;\n }\n\n return (\n <PopoverInner\n {...props}\n triggerRef={props.triggerRef!}\n state={state}\n popoverRef={ref}\n isExiting={isExiting} />\n );\n});\n\ninterface PopoverInnerProps extends AriaPopoverProps, RenderProps<PopoverRenderProps>, SlotProps {\n state: OverlayTriggerState,\n isEntering?: boolean,\n isExiting: boolean,\n UNSTABLE_portalContainer?: Element,\n trigger?: string\n}\n\nfunction PopoverInner({state, isExiting, UNSTABLE_portalContainer, ...props}: PopoverInnerProps) {\n // Calculate the arrow size internally (and remove props.arrowSize from PopoverProps)\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 {popoverProps, underlayProps, arrowProps, placement} = usePopover({\n ...props,\n offset: props.offset ?? 8,\n arrowSize: arrowWidth\n }, state);\n\n let ref = props.popoverRef as RefObject<HTMLDivElement | null>;\n let isEntering = useEnterAnimation(ref, !!placement) || props.isEntering || false;\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Popover',\n values: {\n trigger: props.trigger || null,\n placement,\n isEntering,\n isExiting\n }\n });\n\n let style = {...popoverProps.style, ...renderProps.style};\n\n return (\n <Overlay {...props} isExiting={isExiting} portalContainer={UNSTABLE_portalContainer}>\n {!props.isNonModal && state.isOpen && <div data-testid=\"underlay\" {...underlayProps} style={{position: 'fixed', inset: 0}} />}\n <div\n {...mergeProps(filterDOMProps(props as any), popoverProps)}\n {...renderProps}\n ref={ref}\n slot={props.slot || undefined}\n style={style}\n data-trigger={props.trigger}\n data-placement={placement}\n data-entering={isEntering || undefined}\n data-exiting={isExiting || undefined}>\n {!props.isNonModal && <DismissButton onDismiss={state.close} />}\n <OverlayArrowContext.Provider value={{...arrowProps, placement, ref: arrowRef}}>\n {renderProps.children}\n </OverlayArrowContext.Provider>\n <DismissButton onDismiss={state.close} />\n </div>\n </Overlay>\n );\n}\n"],"names":[],"version":3,"file":"Popover.module.js.map"}
1
+ {"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;AAuEM,MAAM,0DAAiB,CAAA,GAAA,oBAAY,EAA2C;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,GAAG,KAAK;QAAE,oBAAoB;QAAU,WAAW;QAAW,iBAAiB,CAAA,OAAA,qCAAA,sCAAA,2BAA4B,qBAAA,+BAAA,SAAU,OAAO,cAA7C,kBAAA,OAAiD;OACvI;AAGP","sources":["packages/react-aria-components/src/Popover.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, forwardRefType, RefObject} from '@react-types/shared';\nimport {AriaPopoverProps, DismissButton, Overlay, PlacementAxis, PositionProps, useLocale, usePopover} from 'react-aria';\nimport {ContextValue, RenderProps, SlotProps, useContextProps, useRenderProps} from './utils';\nimport {filterDOMProps, mergeProps, useEnterAnimation, useExitAnimation, useLayoutEffect} from '@react-aria/utils';\nimport {focusSafely} from '@react-aria/interactions';\nimport {OverlayArrowContext} from './OverlayArrow';\nimport {OverlayTriggerProps, OverlayTriggerState, useOverlayTriggerState} from 'react-stately';\nimport {OverlayTriggerStateContext} from './Dialog';\nimport React, {createContext, ForwardedRef, forwardRef, useContext, useEffect, useRef, useState} from 'react';\nimport {useIsHidden} from '@react-aria/collections';\n\nexport interface PopoverProps extends Omit<PositionProps, 'isOpen'>, Omit<AriaPopoverProps, 'popoverRef' | 'triggerRef' | 'groupRef' | 'offset' | 'arrowSize'>, OverlayTriggerProps, RenderProps<PopoverRenderProps>, SlotProps, AriaLabelingProps {\n /**\n * The name of the component that triggered the popover. This is reflected on the element\n * as the `data-trigger` attribute, and can be used to provide specific\n * styles for the popover depending on which element triggered it.\n */\n trigger?: string,\n /**\n * The ref for the element which the popover positions itself with respect to.\n *\n * When used within a trigger component such as DialogTrigger, MenuTrigger, Select, etc.,\n * this is set automatically. It is only required when used standalone.\n */\n triggerRef?: RefObject<Element | null>,\n /**\n * Whether the popover is currently performing an entry animation.\n */\n isEntering?: boolean,\n /**\n * Whether the popover 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 additional offset applied along the main axis between the element and its\n * anchor element.\n * @default 8\n */\n offset?: number\n}\n\nexport interface PopoverRenderProps {\n /**\n * The name of the component that triggered the popover, e.g. \"DialogTrigger\" or \"ComboBox\".\n * @selector [data-trigger=\"...\"]\n */\n trigger: string | null,\n /**\n * The placement of the popover relative to the trigger.\n * @selector [data-placement=\"left | right | top | bottom\"]\n */\n placement: PlacementAxis | null,\n /**\n * Whether the popover is currently entering. Use this to apply animations.\n * @selector [data-entering]\n */\n isEntering: boolean,\n /**\n * Whether the popover is currently exiting. Use this to apply animations.\n * @selector [data-exiting]\n */\n isExiting: boolean\n}\n\nexport const PopoverContext = createContext<ContextValue<PopoverProps, HTMLElement>>(null);\n\n// Stores a ref for the portal container for a group of popovers (e.g. submenus).\nconst PopoverGroupContext = createContext<RefObject<Element | null> | null>(null);\n\n/**\n * A popover is an overlay element positioned relative to a trigger.\n */\nexport const Popover = /*#__PURE__*/ (forwardRef as forwardRefType)(function Popover(props: PopoverProps, ref: ForwardedRef<HTMLElement>) {\n [props, ref] = useContextProps(props, ref, PopoverContext);\n let contextState = useContext(OverlayTriggerStateContext);\n let localState = useOverlayTriggerState(props);\n let state = props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;\n let isExiting = useExitAnimation(ref, state.isOpen) || props.isExiting || false;\n let isHidden = useIsHidden();\n let {direction} = useLocale();\n\n // If we are in a hidden tree, we still need to preserve our children.\n if (isHidden) {\n let children = props.children;\n if (typeof children === 'function') {\n children = children({\n trigger: props.trigger || null,\n placement: 'bottom',\n isEntering: false,\n isExiting: false,\n defaultChildren: null\n });\n }\n\n return <>{children}</>;\n }\n\n if (state && !state.isOpen && !isExiting) {\n return null;\n }\n\n return (\n <PopoverInner\n {...props}\n triggerRef={props.triggerRef!}\n state={state}\n popoverRef={ref}\n isExiting={isExiting}\n dir={direction} />\n );\n});\n\ninterface PopoverInnerProps extends AriaPopoverProps, RenderProps<PopoverRenderProps>, SlotProps {\n state: OverlayTriggerState,\n isEntering?: boolean,\n isExiting: boolean,\n UNSTABLE_portalContainer?: Element,\n trigger?: string,\n dir?: 'ltr' | 'rtl'\n}\n\nfunction PopoverInner({state, isExiting, UNSTABLE_portalContainer, ...props}: PopoverInnerProps) {\n // Calculate the arrow size internally (and remove props.arrowSize from PopoverProps)\n // Referenced from: packages/@react-spectrum/tooltip/src/TooltipTrigger.tsx\n let arrowRef = useRef<HTMLDivElement>(null);\n let [arrowWidth, setArrowWidth] = useState(0);\n let containerRef = useRef<HTMLDivElement | null>(null);\n let groupCtx = useContext(PopoverGroupContext);\n let isSubPopover = groupCtx && props.trigger === 'SubmenuTrigger';\n useLayoutEffect(() => {\n if (arrowRef.current && state.isOpen) {\n setArrowWidth(arrowRef.current.getBoundingClientRect().width);\n }\n }, [state.isOpen, arrowRef]);\n\n let {popoverProps, underlayProps, arrowProps, placement} = usePopover({\n ...props,\n offset: props.offset ?? 8,\n arrowSize: arrowWidth,\n // If this is a submenu/subdialog, use the root popover's container \n // to detect outside interaction and add aria-hidden.\n groupRef: isSubPopover ? groupCtx! : containerRef\n }, state);\n\n let ref = props.popoverRef as RefObject<HTMLDivElement | null>;\n let isEntering = useEnterAnimation(ref, !!placement) || props.isEntering || false;\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Popover',\n values: {\n trigger: props.trigger || null,\n placement,\n isEntering,\n isExiting\n }\n });\n\n // Automatically render Popover with role=dialog except when isNonModal is true,\n // or a dialog is already nested inside the popover.\n let shouldBeDialog = !props.isNonModal || props.trigger === 'SubmenuTrigger';\n let [isDialog, setDialog] = useState(false);\n useLayoutEffect(() => {\n if (ref.current) {\n setDialog(shouldBeDialog && !ref.current.querySelector('[role=dialog]'));\n }\n }, [ref, shouldBeDialog]);\n\n // Focus the popover itself on mount, unless a child element is already focused.\n useEffect(() => {\n if (isDialog && ref.current && !ref.current.contains(document.activeElement)) {\n focusSafely(ref.current);\n }\n }, [isDialog, ref]);\n\n let style = {...popoverProps.style, ...renderProps.style};\n let overlay = (\n <div\n {...mergeProps(filterDOMProps(props as any), popoverProps)}\n {...renderProps}\n role={isDialog ? 'dialog' : undefined}\n tabIndex={isDialog ? -1 : undefined}\n aria-label={props['aria-label']}\n aria-labelledby={props['aria-labelledby']}\n ref={ref}\n slot={props.slot || undefined}\n style={style}\n dir={props.dir}\n data-trigger={props.trigger}\n data-placement={placement}\n data-entering={isEntering || undefined}\n data-exiting={isExiting || undefined}>\n {!props.isNonModal && <DismissButton onDismiss={state.close} />}\n <OverlayArrowContext.Provider value={{...arrowProps, placement, ref: arrowRef}}>\n {renderProps.children}\n </OverlayArrowContext.Provider>\n <DismissButton onDismiss={state.close} />\n </div>\n );\n\n // If this is a root popover, render an extra div to act as the portal container for submenus/subdialogs.\n if (!isSubPopover) {\n return (\n <Overlay {...props} shouldContainFocus={isDialog} isExiting={isExiting} portalContainer={UNSTABLE_portalContainer}>\n {!props.isNonModal && state.isOpen && <div data-testid=\"underlay\" {...underlayProps} style={{position: 'fixed', inset: 0}} />}\n <div ref={containerRef} style={{display: 'contents'}}>\n <PopoverGroupContext.Provider value={containerRef}>\n {overlay}\n </PopoverGroupContext.Provider>\n </div>\n </Overlay>\n );\n }\n\n // Submenus/subdialogs are mounted into the root popover's container.\n return (\n <Overlay {...props} shouldContainFocus={isDialog} isExiting={isExiting} portalContainer={UNSTABLE_portalContainer ?? groupCtx?.current ?? undefined}>\n {overlay}\n </Overlay>\n );\n}\n"],"names":[],"version":3,"file":"Popover.module.js.map"}
@@ -35,7 +35,7 @@ const $0d6436f6a1b0b001$export$c17561cb55d4db30 = /*#__PURE__*/ (0, $av4IL$react
35
35
  [props, ref] = (0, $c5ccf687772c0422$exports.useContextProps)(props, ref, $0d6436f6a1b0b001$export$e9f3bf65a26ce129);
36
36
  let { value: value = 0, minValue: minValue = 0, maxValue: maxValue = 100, isIndeterminate: isIndeterminate = false } = props;
37
37
  value = (0, $av4IL$reactstatelyutils.clamp)(value, minValue, maxValue);
38
- let [labelRef, label] = (0, $c5ccf687772c0422$exports.useSlot)();
38
+ let [labelRef, label] = (0, $c5ccf687772c0422$exports.useSlot)(!props['aria-label'] && !props['aria-labelledby']);
39
39
  let { progressBarProps: progressBarProps, labelProps: labelProps } = (0, $av4IL$reactaria.useProgressBar)({
40
40
  ...props,
41
41
  label: label
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AA2BM,MAAM,0DAAqB,CAAA,GAAA,0BAAY,EAAkD;AAMzF,MAAM,0DAAc,CAAA,GAAA,uBAAS,EAAE,SAAS,YAAY,KAAuB,EAAE,GAAiC;IACnH,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,SACF,QAAQ,aACR,WAAW,aACX,WAAW,sBACX,kBAAkB,OACnB,GAAG;IACJ,QAAQ,CAAA,GAAA,8BAAI,EAAE,OAAO,UAAU;IAE/B,IAAI,CAAC,UAAU,MAAM,GAAG,CAAA,GAAA,iCAAM;IAC9B,IAAI,oBACF,gBAAgB,cAChB,UAAU,EACX,GAAG,CAAA,GAAA,+BAAa,EAAE;QAAC,GAAG,KAAK;eAAE;IAAK;IAEnC,0DAA0D;IAC1D,IAAI,aAAa,kBAAkB,YAAY,AAAC,CAAA,QAAQ,QAAO,IAAM,CAAA,WAAW,QAAO,IAAK;IAE5F,IAAI,cAAc,CAAA,GAAA,wCAAa,EAAE;QAC/B,GAAG,KAAK;QACR,kBAAkB;QAClB,QAAQ;wBACN;YACA,WAAW,gBAAgB,CAAC,iBAAiB;6BAC7C;QACF;IACF;IAEA,qBACE,0DAAC;QAAK,GAAG,gBAAgB;QAAG,GAAG,WAAW;QAAE,KAAK;QAAK,MAAM,MAAM,IAAI,IAAI;qBACxE,0DAAC,CAAA,GAAA,sCAAW,EAAE,QAAQ;QAAC,OAAO;YAAC,GAAG,UAAU;YAAE,KAAK;YAAU,aAAa;QAAM;OAC7E,YAAY,QAAQ;AAI7B","sources":["packages/react-aria-components/src/ProgressBar.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 {AriaProgressBarProps, useProgressBar} from 'react-aria';\nimport {clamp} from '@react-stately/utils';\nimport {ContextValue, RenderProps, SlotProps, useContextProps, useRenderProps, useSlot} from './utils';\nimport {LabelContext} from './Label';\nimport React, {createContext, ForwardedRef, forwardRef} from 'react';\n\nexport interface ProgressBarProps extends Omit<AriaProgressBarProps, 'label'>, RenderProps<ProgressBarRenderProps>, SlotProps {}\n\nexport interface ProgressBarRenderProps {\n /**\n * The value as a percentage between the minimum and maximum.\n */\n percentage?: number,\n /**\n * A formatted version of the value.\n * @selector [aria-valuetext]\n */\n valueText: string | undefined,\n /**\n * Whether the progress bar is indeterminate.\n * @selector :not([aria-valuenow])\n */\n isIndeterminate: boolean\n}\n\nexport const ProgressBarContext = createContext<ContextValue<ProgressBarProps, HTMLDivElement>>(null);\n\n/**\n * Progress bars show either determinate or indeterminate progress of an operation\n * over time.\n */\nexport const ProgressBar = forwardRef(function ProgressBar(props: ProgressBarProps, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, ProgressBarContext);\n let {\n value = 0,\n minValue = 0,\n maxValue = 100,\n isIndeterminate = false\n } = props;\n value = clamp(value, minValue, maxValue);\n\n let [labelRef, label] = useSlot();\n let {\n progressBarProps,\n labelProps\n } = useProgressBar({...props, label});\n\n // Calculate the width of the progress bar as a percentage\n let percentage = isIndeterminate ? undefined : (value - minValue) / (maxValue - minValue) * 100;\n\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-ProgressBar',\n values: {\n percentage,\n valueText: progressBarProps['aria-valuetext'],\n isIndeterminate\n }\n });\n\n return (\n <div {...progressBarProps} {...renderProps} ref={ref} slot={props.slot || undefined}>\n <LabelContext.Provider value={{...labelProps, ref: labelRef, elementType: 'span'}}>\n {renderProps.children}\n </LabelContext.Provider>\n </div>\n );\n});\n"],"names":[],"version":3,"file":"ProgressBar.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AA2BM,MAAM,0DAAqB,CAAA,GAAA,0BAAY,EAAkD;AAMzF,MAAM,0DAAc,CAAA,GAAA,uBAAS,EAAE,SAAS,YAAY,KAAuB,EAAE,GAAiC;IACnH,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,SACF,QAAQ,aACR,WAAW,aACX,WAAW,sBACX,kBAAkB,OACnB,GAAG;IACJ,QAAQ,CAAA,GAAA,8BAAI,EAAE,OAAO,UAAU;IAE/B,IAAI,CAAC,UAAU,MAAM,GAAG,CAAA,GAAA,iCAAM,EAC5B,CAAC,KAAK,CAAC,aAAa,IAAI,CAAC,KAAK,CAAC,kBAAkB;IAEnD,IAAI,oBACF,gBAAgB,cAChB,UAAU,EACX,GAAG,CAAA,GAAA,+BAAa,EAAE;QAAC,GAAG,KAAK;eAAE;IAAK;IAEnC,0DAA0D;IAC1D,IAAI,aAAa,kBAAkB,YAAY,AAAC,CAAA,QAAQ,QAAO,IAAM,CAAA,WAAW,QAAO,IAAK;IAE5F,IAAI,cAAc,CAAA,GAAA,wCAAa,EAAE;QAC/B,GAAG,KAAK;QACR,kBAAkB;QAClB,QAAQ;wBACN;YACA,WAAW,gBAAgB,CAAC,iBAAiB;6BAC7C;QACF;IACF;IAEA,qBACE,0DAAC;QAAK,GAAG,gBAAgB;QAAG,GAAG,WAAW;QAAE,KAAK;QAAK,MAAM,MAAM,IAAI,IAAI;qBACxE,0DAAC,CAAA,GAAA,sCAAW,EAAE,QAAQ;QAAC,OAAO;YAAC,GAAG,UAAU;YAAE,KAAK;YAAU,aAAa;QAAM;OAC7E,YAAY,QAAQ;AAI7B","sources":["packages/react-aria-components/src/ProgressBar.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 {AriaProgressBarProps, useProgressBar} from 'react-aria';\nimport {clamp} from '@react-stately/utils';\nimport {ContextValue, RenderProps, SlotProps, useContextProps, useRenderProps, useSlot} from './utils';\nimport {LabelContext} from './Label';\nimport React, {createContext, ForwardedRef, forwardRef} from 'react';\n\nexport interface ProgressBarProps extends Omit<AriaProgressBarProps, 'label'>, RenderProps<ProgressBarRenderProps>, SlotProps {}\n\nexport interface ProgressBarRenderProps {\n /**\n * The value as a percentage between the minimum and maximum.\n */\n percentage?: number,\n /**\n * A formatted version of the value.\n * @selector [aria-valuetext]\n */\n valueText: string | undefined,\n /**\n * Whether the progress bar is indeterminate.\n * @selector :not([aria-valuenow])\n */\n isIndeterminate: boolean\n}\n\nexport const ProgressBarContext = createContext<ContextValue<ProgressBarProps, HTMLDivElement>>(null);\n\n/**\n * Progress bars show either determinate or indeterminate progress of an operation\n * over time.\n */\nexport const ProgressBar = forwardRef(function ProgressBar(props: ProgressBarProps, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, ProgressBarContext);\n let {\n value = 0,\n minValue = 0,\n maxValue = 100,\n isIndeterminate = false\n } = props;\n value = clamp(value, minValue, maxValue);\n\n let [labelRef, label] = useSlot(\n !props['aria-label'] && !props['aria-labelledby']\n );\n let {\n progressBarProps,\n labelProps\n } = useProgressBar({...props, label});\n\n // Calculate the width of the progress bar as a percentage\n let percentage = isIndeterminate ? undefined : (value - minValue) / (maxValue - minValue) * 100;\n\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-ProgressBar',\n values: {\n percentage,\n valueText: progressBarProps['aria-valuetext'],\n isIndeterminate\n }\n });\n\n return (\n <div {...progressBarProps} {...renderProps} ref={ref} slot={props.slot || undefined}>\n <LabelContext.Provider value={{...labelProps, ref: labelRef, elementType: 'span'}}>\n {renderProps.children}\n </LabelContext.Provider>\n </div>\n );\n});\n"],"names":[],"version":3,"file":"ProgressBar.main.js.map"}
@@ -24,7 +24,7 @@ const $0393f8ab869a0f1a$export$c17561cb55d4db30 = /*#__PURE__*/ (0, $hU2kz$forwa
24
24
  [props, ref] = (0, $64fa3d84918910a7$export$29f1550f4b0d4415)(props, ref, $0393f8ab869a0f1a$export$e9f3bf65a26ce129);
25
25
  let { value: value = 0, minValue: minValue = 0, maxValue: maxValue = 100, isIndeterminate: isIndeterminate = false } = props;
26
26
  value = (0, $hU2kz$clamp)(value, minValue, maxValue);
27
- let [labelRef, label] = (0, $64fa3d84918910a7$export$9d4c57ee4c6ffdd8)();
27
+ let [labelRef, label] = (0, $64fa3d84918910a7$export$9d4c57ee4c6ffdd8)(!props['aria-label'] && !props['aria-labelledby']);
28
28
  let { progressBarProps: progressBarProps, labelProps: labelProps } = (0, $hU2kz$useProgressBar)({
29
29
  ...props,
30
30
  label: label
@@ -24,7 +24,7 @@ const $0393f8ab869a0f1a$export$c17561cb55d4db30 = /*#__PURE__*/ (0, $hU2kz$forwa
24
24
  [props, ref] = (0, $64fa3d84918910a7$export$29f1550f4b0d4415)(props, ref, $0393f8ab869a0f1a$export$e9f3bf65a26ce129);
25
25
  let { value: value = 0, minValue: minValue = 0, maxValue: maxValue = 100, isIndeterminate: isIndeterminate = false } = props;
26
26
  value = (0, $hU2kz$clamp)(value, minValue, maxValue);
27
- let [labelRef, label] = (0, $64fa3d84918910a7$export$9d4c57ee4c6ffdd8)();
27
+ let [labelRef, label] = (0, $64fa3d84918910a7$export$9d4c57ee4c6ffdd8)(!props['aria-label'] && !props['aria-labelledby']);
28
28
  let { progressBarProps: progressBarProps, labelProps: labelProps } = (0, $hU2kz$useProgressBar)({
29
29
  ...props,
30
30
  label: label