@react-spectrum/s2 3.0.0-nightly-ab9fd5c68-241126 → 3.0.0-nightly-b0f156972-241128

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 (364) hide show
  1. package/dist/Accordion.cjs +2 -5
  2. package/dist/Accordion.cjs.map +1 -1
  3. package/dist/Accordion.css.map +1 -1
  4. package/dist/Accordion.mjs +2 -5
  5. package/dist/Accordion.mjs.map +1 -1
  6. package/dist/ActionButton.cjs +2 -6
  7. package/dist/ActionButton.cjs.map +1 -1
  8. package/dist/ActionButton.css.map +1 -1
  9. package/dist/ActionButton.mjs +3 -7
  10. package/dist/ActionButton.mjs.map +1 -1
  11. package/dist/ActionButtonGroup.cjs +2 -5
  12. package/dist/ActionButtonGroup.cjs.map +1 -1
  13. package/dist/ActionButtonGroup.css.map +1 -1
  14. package/dist/ActionButtonGroup.mjs +2 -5
  15. package/dist/ActionButtonGroup.mjs.map +1 -1
  16. package/dist/ActionMenu.cjs +2 -5
  17. package/dist/ActionMenu.cjs.map +1 -1
  18. package/dist/ActionMenu.mjs +2 -5
  19. package/dist/ActionMenu.mjs.map +1 -1
  20. package/dist/AlertDialog.cjs +2 -5
  21. package/dist/AlertDialog.cjs.map +1 -1
  22. package/dist/AlertDialog.css.map +1 -1
  23. package/dist/AlertDialog.mjs +2 -5
  24. package/dist/AlertDialog.mjs.map +1 -1
  25. package/dist/Avatar.cjs +2 -5
  26. package/dist/Avatar.cjs.map +1 -1
  27. package/dist/Avatar.css.map +1 -1
  28. package/dist/Avatar.mjs +2 -5
  29. package/dist/Avatar.mjs.map +1 -1
  30. package/dist/AvatarGroup.cjs +2 -5
  31. package/dist/AvatarGroup.cjs.map +1 -1
  32. package/dist/AvatarGroup.css.map +1 -1
  33. package/dist/AvatarGroup.mjs +2 -5
  34. package/dist/AvatarGroup.mjs.map +1 -1
  35. package/dist/Badge.cjs +2 -5
  36. package/dist/Badge.cjs.map +1 -1
  37. package/dist/Badge.css.map +1 -1
  38. package/dist/Badge.mjs +2 -5
  39. package/dist/Badge.mjs.map +1 -1
  40. package/dist/Breadcrumbs.cjs +4 -6
  41. package/dist/Breadcrumbs.cjs.map +1 -1
  42. package/dist/Breadcrumbs.css.map +1 -1
  43. package/dist/Breadcrumbs.mjs +5 -7
  44. package/dist/Breadcrumbs.mjs.map +1 -1
  45. package/dist/Button.cjs +4 -12
  46. package/dist/Button.cjs.map +1 -1
  47. package/dist/Button.css.map +1 -1
  48. package/dist/Button.mjs +5 -13
  49. package/dist/Button.mjs.map +1 -1
  50. package/dist/ButtonGroup.cjs +2 -5
  51. package/dist/ButtonGroup.cjs.map +1 -1
  52. package/dist/ButtonGroup.css.map +1 -1
  53. package/dist/ButtonGroup.mjs +3 -6
  54. package/dist/ButtonGroup.mjs.map +1 -1
  55. package/dist/CardView.cjs +2 -3
  56. package/dist/CardView.cjs.map +1 -1
  57. package/dist/CardView.css.map +1 -1
  58. package/dist/CardView.mjs +3 -4
  59. package/dist/CardView.mjs.map +1 -1
  60. package/dist/Checkbox.cjs +2 -6
  61. package/dist/Checkbox.cjs.map +1 -1
  62. package/dist/Checkbox.css.map +1 -1
  63. package/dist/Checkbox.mjs +3 -7
  64. package/dist/Checkbox.mjs.map +1 -1
  65. package/dist/CheckboxGroup.cjs +2 -5
  66. package/dist/CheckboxGroup.cjs.map +1 -1
  67. package/dist/CheckboxGroup.css.map +1 -1
  68. package/dist/CheckboxGroup.mjs +3 -6
  69. package/dist/CheckboxGroup.mjs.map +1 -1
  70. package/dist/ClearButton.cjs +2 -3
  71. package/dist/ClearButton.cjs.map +1 -1
  72. package/dist/ClearButton.css.map +1 -1
  73. package/dist/ClearButton.mjs +2 -3
  74. package/dist/ClearButton.mjs.map +1 -1
  75. package/dist/CloseButton.cjs +2 -5
  76. package/dist/CloseButton.cjs.map +1 -1
  77. package/dist/CloseButton.css.map +1 -1
  78. package/dist/CloseButton.mjs +2 -5
  79. package/dist/CloseButton.mjs.map +1 -1
  80. package/dist/ColorArea.cjs +2 -5
  81. package/dist/ColorArea.cjs.map +1 -1
  82. package/dist/ColorArea.css.map +1 -1
  83. package/dist/ColorArea.mjs +2 -5
  84. package/dist/ColorArea.mjs.map +1 -1
  85. package/dist/ColorField.cjs +2 -5
  86. package/dist/ColorField.cjs.map +1 -1
  87. package/dist/ColorField.css.map +1 -1
  88. package/dist/ColorField.mjs +3 -6
  89. package/dist/ColorField.mjs.map +1 -1
  90. package/dist/ColorSlider.cjs +2 -5
  91. package/dist/ColorSlider.cjs.map +1 -1
  92. package/dist/ColorSlider.css.map +1 -1
  93. package/dist/ColorSlider.mjs +3 -6
  94. package/dist/ColorSlider.mjs.map +1 -1
  95. package/dist/ColorSwatch.cjs +2 -5
  96. package/dist/ColorSwatch.cjs.map +1 -1
  97. package/dist/ColorSwatch.css.map +1 -1
  98. package/dist/ColorSwatch.mjs +3 -6
  99. package/dist/ColorSwatch.mjs.map +1 -1
  100. package/dist/ColorSwatchPicker.cjs +2 -5
  101. package/dist/ColorSwatchPicker.cjs.map +1 -1
  102. package/dist/ColorSwatchPicker.css.map +1 -1
  103. package/dist/ColorSwatchPicker.mjs +2 -5
  104. package/dist/ColorSwatchPicker.mjs.map +1 -1
  105. package/dist/ColorWheel.cjs +2 -5
  106. package/dist/ColorWheel.cjs.map +1 -1
  107. package/dist/ColorWheel.css.map +1 -1
  108. package/dist/ColorWheel.mjs +2 -5
  109. package/dist/ColorWheel.mjs.map +1 -1
  110. package/dist/ComboBox.cjs +2 -5
  111. package/dist/ComboBox.cjs.map +1 -1
  112. package/dist/ComboBox.css.map +1 -1
  113. package/dist/ComboBox.mjs +3 -6
  114. package/dist/ComboBox.mjs.map +1 -1
  115. package/dist/Content.cjs +12 -19
  116. package/dist/Content.cjs.map +1 -1
  117. package/dist/Content.mjs +12 -19
  118. package/dist/Content.mjs.map +1 -1
  119. package/dist/ContextualHelp.cjs +2 -5
  120. package/dist/ContextualHelp.cjs.map +1 -1
  121. package/dist/ContextualHelp.css.map +1 -1
  122. package/dist/ContextualHelp.mjs +2 -5
  123. package/dist/ContextualHelp.mjs.map +1 -1
  124. package/dist/CustomDialog.cjs +2 -5
  125. package/dist/CustomDialog.cjs.map +1 -1
  126. package/dist/CustomDialog.css.map +1 -1
  127. package/dist/CustomDialog.mjs +2 -5
  128. package/dist/CustomDialog.mjs.map +1 -1
  129. package/dist/Dialog.cjs +2 -6
  130. package/dist/Dialog.cjs.map +1 -1
  131. package/dist/Dialog.css.map +1 -1
  132. package/dist/Dialog.mjs +2 -6
  133. package/dist/Dialog.mjs.map +1 -1
  134. package/dist/Disclosure.cjs +6 -15
  135. package/dist/Disclosure.cjs.map +1 -1
  136. package/dist/Disclosure.css.map +1 -1
  137. package/dist/Disclosure.mjs +7 -16
  138. package/dist/Disclosure.mjs.map +1 -1
  139. package/dist/Divider.cjs +2 -6
  140. package/dist/Divider.cjs.map +1 -1
  141. package/dist/Divider.css.map +1 -1
  142. package/dist/Divider.mjs +2 -6
  143. package/dist/Divider.mjs.map +1 -1
  144. package/dist/DropZone.cjs +2 -5
  145. package/dist/DropZone.cjs.map +1 -1
  146. package/dist/DropZone.css.map +1 -1
  147. package/dist/DropZone.mjs +2 -5
  148. package/dist/DropZone.mjs.map +1 -1
  149. package/dist/Field.cjs +6 -9
  150. package/dist/Field.cjs.map +1 -1
  151. package/dist/Field.css.map +1 -1
  152. package/dist/Field.mjs +6 -9
  153. package/dist/Field.mjs.map +1 -1
  154. package/dist/Form.cjs +2 -5
  155. package/dist/Form.cjs.map +1 -1
  156. package/dist/Form.css.map +1 -1
  157. package/dist/Form.mjs +2 -5
  158. package/dist/Form.mjs.map +1 -1
  159. package/dist/FullscreenDialog.cjs +2 -5
  160. package/dist/FullscreenDialog.cjs.map +1 -1
  161. package/dist/FullscreenDialog.css.map +1 -1
  162. package/dist/FullscreenDialog.mjs +2 -5
  163. package/dist/FullscreenDialog.mjs.map +1 -1
  164. package/dist/IllustratedMessage.cjs +2 -6
  165. package/dist/IllustratedMessage.cjs.map +1 -1
  166. package/dist/IllustratedMessage.css.map +1 -1
  167. package/dist/IllustratedMessage.mjs +2 -6
  168. package/dist/IllustratedMessage.mjs.map +1 -1
  169. package/dist/Image.cjs +2 -3
  170. package/dist/Image.cjs.map +1 -1
  171. package/dist/Image.css.map +1 -1
  172. package/dist/Image.mjs +3 -4
  173. package/dist/Image.mjs.map +1 -1
  174. package/dist/InlineAlert.cjs +2 -6
  175. package/dist/InlineAlert.cjs.map +1 -1
  176. package/dist/InlineAlert.css.map +1 -1
  177. package/dist/InlineAlert.mjs +3 -7
  178. package/dist/InlineAlert.mjs.map +1 -1
  179. package/dist/Link.cjs +2 -6
  180. package/dist/Link.cjs.map +1 -1
  181. package/dist/Link.css.map +1 -1
  182. package/dist/Link.mjs +3 -7
  183. package/dist/Link.mjs.map +1 -1
  184. package/dist/Menu.cjs +2 -5
  185. package/dist/Menu.cjs.map +1 -1
  186. package/dist/Menu.css.map +1 -1
  187. package/dist/Menu.mjs +3 -6
  188. package/dist/Menu.mjs.map +1 -1
  189. package/dist/Meter.cjs +2 -6
  190. package/dist/Meter.cjs.map +1 -1
  191. package/dist/Meter.css.map +1 -1
  192. package/dist/Meter.mjs +2 -6
  193. package/dist/Meter.mjs.map +1 -1
  194. package/dist/Modal.cjs +2 -5
  195. package/dist/Modal.cjs.map +1 -1
  196. package/dist/Modal.css.map +1 -1
  197. package/dist/Modal.mjs +3 -6
  198. package/dist/Modal.mjs.map +1 -1
  199. package/dist/NumberField.cjs +2 -5
  200. package/dist/NumberField.cjs.map +1 -1
  201. package/dist/NumberField.css.map +1 -1
  202. package/dist/NumberField.mjs +3 -6
  203. package/dist/NumberField.mjs.map +1 -1
  204. package/dist/Picker.cjs +2 -5
  205. package/dist/Picker.cjs.map +1 -1
  206. package/dist/Picker.css.map +1 -1
  207. package/dist/Picker.mjs +3 -6
  208. package/dist/Picker.mjs.map +1 -1
  209. package/dist/Popover.cjs +4 -8
  210. package/dist/Popover.cjs.map +1 -1
  211. package/dist/Popover.css.map +1 -1
  212. package/dist/Popover.mjs +5 -9
  213. package/dist/Popover.mjs.map +1 -1
  214. package/dist/ProgressBar.cjs +2 -6
  215. package/dist/ProgressBar.cjs.map +1 -1
  216. package/dist/ProgressBar.css.map +1 -1
  217. package/dist/ProgressBar.mjs +2 -6
  218. package/dist/ProgressBar.mjs.map +1 -1
  219. package/dist/ProgressCircle.cjs +2 -6
  220. package/dist/ProgressCircle.cjs.map +1 -1
  221. package/dist/ProgressCircle.css.map +1 -1
  222. package/dist/ProgressCircle.mjs +2 -6
  223. package/dist/ProgressCircle.mjs.map +1 -1
  224. package/dist/Radio.cjs +2 -6
  225. package/dist/Radio.cjs.map +1 -1
  226. package/dist/Radio.css.map +1 -1
  227. package/dist/Radio.mjs +3 -7
  228. package/dist/Radio.mjs.map +1 -1
  229. package/dist/RadioGroup.cjs +2 -6
  230. package/dist/RadioGroup.cjs.map +1 -1
  231. package/dist/RadioGroup.css.map +1 -1
  232. package/dist/RadioGroup.mjs +3 -7
  233. package/dist/RadioGroup.mjs.map +1 -1
  234. package/dist/RangeSlider.cjs +2 -3
  235. package/dist/RangeSlider.cjs.map +1 -1
  236. package/dist/RangeSlider.mjs +3 -4
  237. package/dist/RangeSlider.mjs.map +1 -1
  238. package/dist/SearchField.cjs +2 -5
  239. package/dist/SearchField.cjs.map +1 -1
  240. package/dist/SearchField.css.map +1 -1
  241. package/dist/SearchField.mjs +3 -6
  242. package/dist/SearchField.mjs.map +1 -1
  243. package/dist/SegmentedControl.cjs +5 -11
  244. package/dist/SegmentedControl.cjs.map +1 -1
  245. package/dist/SegmentedControl.css.map +1 -1
  246. package/dist/SegmentedControl.mjs +6 -12
  247. package/dist/SegmentedControl.mjs.map +1 -1
  248. package/dist/Slider.cjs +2 -3
  249. package/dist/Slider.cjs.map +1 -1
  250. package/dist/Slider.css.map +1 -1
  251. package/dist/Slider.mjs +3 -4
  252. package/dist/Slider.mjs.map +1 -1
  253. package/dist/StatusLight.cjs +2 -6
  254. package/dist/StatusLight.cjs.map +1 -1
  255. package/dist/StatusLight.css.map +1 -1
  256. package/dist/StatusLight.mjs +2 -6
  257. package/dist/StatusLight.mjs.map +1 -1
  258. package/dist/Switch.cjs +2 -6
  259. package/dist/Switch.cjs.map +1 -1
  260. package/dist/Switch.css.map +1 -1
  261. package/dist/Switch.mjs +3 -7
  262. package/dist/Switch.mjs.map +1 -1
  263. package/dist/TableView.cjs +9 -21
  264. package/dist/TableView.cjs.map +1 -1
  265. package/dist/TableView.css.map +1 -1
  266. package/dist/TableView.mjs +10 -22
  267. package/dist/TableView.mjs.map +1 -1
  268. package/dist/Tabs.cjs +2 -5
  269. package/dist/Tabs.cjs.map +1 -1
  270. package/dist/Tabs.css.map +1 -1
  271. package/dist/Tabs.mjs +2 -5
  272. package/dist/Tabs.mjs.map +1 -1
  273. package/dist/TagGroup.cjs +4 -6
  274. package/dist/TagGroup.cjs.map +1 -1
  275. package/dist/TagGroup.css.map +1 -1
  276. package/dist/TagGroup.mjs +4 -6
  277. package/dist/TagGroup.mjs.map +1 -1
  278. package/dist/TextField.cjs +8 -19
  279. package/dist/TextField.cjs.map +1 -1
  280. package/dist/TextField.css.map +1 -1
  281. package/dist/TextField.mjs +9 -20
  282. package/dist/TextField.mjs.map +1 -1
  283. package/dist/ToggleButton.cjs +2 -6
  284. package/dist/ToggleButton.cjs.map +1 -1
  285. package/dist/ToggleButton.css.map +1 -1
  286. package/dist/ToggleButton.mjs +2 -6
  287. package/dist/ToggleButton.mjs.map +1 -1
  288. package/dist/ToggleButtonGroup.cjs +2 -5
  289. package/dist/ToggleButtonGroup.cjs.map +1 -1
  290. package/dist/ToggleButtonGroup.mjs +2 -5
  291. package/dist/ToggleButtonGroup.mjs.map +1 -1
  292. package/dist/Tooltip.cjs +3 -6
  293. package/dist/Tooltip.cjs.map +1 -1
  294. package/dist/Tooltip.css.map +1 -1
  295. package/dist/Tooltip.mjs +4 -7
  296. package/dist/Tooltip.mjs.map +1 -1
  297. package/dist/types.d.ts +64 -64
  298. package/dist/types.d.ts.map +1 -1
  299. package/package.json +17 -17
  300. package/src/Accordion.tsx +5 -8
  301. package/src/ActionButton.tsx +6 -9
  302. package/src/ActionButtonGroup.tsx +5 -8
  303. package/src/ActionMenu.tsx +5 -8
  304. package/src/AlertDialog.tsx +5 -8
  305. package/src/Avatar.tsx +5 -8
  306. package/src/AvatarGroup.tsx +5 -8
  307. package/src/Badge.tsx +5 -8
  308. package/src/Breadcrumbs.tsx +6 -12
  309. package/src/Button.tsx +10 -16
  310. package/src/ButtonGroup.tsx +5 -8
  311. package/src/CardView.tsx +2 -5
  312. package/src/Checkbox.tsx +6 -9
  313. package/src/CheckboxGroup.tsx +5 -8
  314. package/src/ClearButton.tsx +2 -5
  315. package/src/CloseButton.tsx +5 -8
  316. package/src/ColorArea.tsx +5 -8
  317. package/src/ColorField.tsx +5 -8
  318. package/src/ColorSlider.tsx +5 -8
  319. package/src/ColorSwatch.tsx +5 -8
  320. package/src/ColorSwatchPicker.tsx +5 -8
  321. package/src/ColorWheel.tsx +5 -8
  322. package/src/ComboBox.tsx +5 -8
  323. package/src/Content.tsx +12 -30
  324. package/src/ContextualHelp.tsx +5 -8
  325. package/src/CustomDialog.tsx +5 -8
  326. package/src/Dialog.tsx +6 -9
  327. package/src/Disclosure.tsx +15 -24
  328. package/src/Divider.tsx +6 -9
  329. package/src/DropZone.tsx +5 -8
  330. package/src/Field.tsx +6 -15
  331. package/src/Form.tsx +5 -8
  332. package/src/FullscreenDialog.tsx +5 -8
  333. package/src/IllustratedMessage.tsx +6 -9
  334. package/src/Image.tsx +3 -6
  335. package/src/InlineAlert.tsx +6 -9
  336. package/src/Link.tsx +6 -9
  337. package/src/Menu.tsx +5 -8
  338. package/src/Meter.tsx +6 -9
  339. package/src/Modal.tsx +5 -8
  340. package/src/NumberField.tsx +5 -8
  341. package/src/Picker.tsx +5 -8
  342. package/src/Popover.tsx +9 -15
  343. package/src/ProgressBar.tsx +6 -9
  344. package/src/ProgressCircle.tsx +6 -9
  345. package/src/Radio.tsx +6 -9
  346. package/src/RadioGroup.tsx +6 -9
  347. package/src/RangeSlider.tsx +2 -5
  348. package/src/SearchField.tsx +5 -8
  349. package/src/SegmentedControl.tsx +10 -16
  350. package/src/Slider.tsx +2 -5
  351. package/src/StatusLight.tsx +6 -9
  352. package/src/Switch.tsx +6 -9
  353. package/src/TableView.tsx +20 -32
  354. package/src/Tabs.tsx +5 -8
  355. package/src/TagGroup.tsx +7 -14
  356. package/src/TextField.tsx +20 -28
  357. package/src/ToggleButton.tsx +6 -9
  358. package/src/ToggleButtonGroup.tsx +5 -8
  359. package/src/Tooltip.tsx +5 -9
  360. package/style/dist/style-macro.cjs +12 -0
  361. package/style/dist/style-macro.cjs.map +1 -1
  362. package/style/dist/style-macro.mjs +12 -0
  363. package/style/dist/style-macro.mjs.map +1 -1
  364. package/style/style-macro.ts +17 -1
@@ -241,7 +241,7 @@ const $4950413ac998f607$var$content = function anonymous(props) {
241
241
  };
242
242
  const $4950413ac998f607$var$buttonGroup = " . __a-3yyxn2 __b-3yyxn2 __c-3yyxn2 __d-3yyxn2 Af";
243
243
  const $4950413ac998f607$export$d661ef89ad42d682 = /*#__PURE__*/ (0, $3JmRZ$createContext)(null);
244
- function $4950413ac998f607$var$IllustratedMessage(props, ref) {
244
+ const $4950413ac998f607$export$406dbc84c317ece0 = /*#__PURE__*/ (0, $3JmRZ$forwardRef)(function IllustratedMessage(props, ref) {
245
245
  [props, ref] = (0, $5ce63c423902f47d$export$764f6146fadd77f7)(props, ref, $4950413ac998f607$export$d661ef89ad42d682);
246
246
  let domRef = (0, $3JmRZ$useDOMRef)(ref);
247
247
  let { children: children, orientation: orientation = 'horizontal', size: size = 'M', UNSAFE_className: UNSAFE_className = '', UNSAFE_style: UNSAFE_style, isInDropZone: isInDropZone = false, isDropTarget: isDropTarget = false, ...otherProps } = props;
@@ -294,11 +294,7 @@ function $4950413ac998f607$var$IllustratedMessage(props, ref) {
294
294
  children: children
295
295
  })
296
296
  });
297
- }
298
- /**
299
- * An IllustratedMessage displays an illustration and a message, usually
300
- * for an empty state or an error page.
301
- */ let $4950413ac998f607$export$406dbc84c317ece0 = /*#__PURE__*/ (0, $3JmRZ$forwardRef)($4950413ac998f607$var$IllustratedMessage);
297
+ });
302
298
 
303
299
 
304
300
  export {$4950413ac998f607$export$d661ef89ad42d682 as IllustratedMessageContext, $4950413ac998f607$export$406dbc84c317ece0 as IllustratedMessage};
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;AAoCD,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyDN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYN,MAAM;AAUC,MAAM,0DAA4B,CAAA,GAAA,oBAAY,EAA6E;AAElI,SAAS,yCAAmB,KAAwC,EAAE,GAA2B;IAC/F,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAsB,EAAE,OAAO,KAAK;IACnD,IAAI,SAAS,CAAA,GAAA,gBAAQ,EAAE;IACvB,IAAI,YACF,QAAQ,eACR,cAAc,oBACd,OAAO,uBACP,mBAAmB,kBACnB,YAAY,gBACZ,eAAe,qBACf,eAAe,OACf,GAAG,YACJ,GAAG;IAEJ,qBACE,gBAAC;QACE,GAAG,CAAA,GAAA,qBAAa,EAAE,WAAW;QAC9B,OAAO;QACP,WAAW,mBAAmB,yCAAmB;YAC/C,MAAM,MAAM,IAAI,IAAI;YACpB,aAAa,MAAM,WAAW,IAAI;QACpC,GAAG,MAAM,MAAM;QACf,KAAK;kBACL,cAAA,gBAAC,CAAA,GAAA,eAAO;YACN,QAAQ;gBACN;oBAAC,CAAA,GAAA,yCAAa;oBAAG;wBAAC,QAAQ,8BAAQ;yCAAC;kCAAa;wBAAI;oBAAE;iBAAE;gBACxD;oBAAC,CAAA,GAAA,yCAAa;oBAAG;wBAAC,QAAQ,8BAAQ;kCAAC;wBAAI;oBAAE;iBAAE;gBAC3C;oBAAC,CAAA,GAAA,yCAAkB;oBAAG;wBAAC,MAAM,SAAS,MAAM,MAAM;wBAAK,QAAQ,mCAAa;yCAAC;kCAAa;0CAAM;0CAAc;wBAAY;oBAAE;iBAAE;gBAC9H;oBAAC,CAAA,GAAA,yCAAiB;oBAAG;wBAAC,QAAQ;oBAAW;iBAAE;aAC5C;sBACA;;;AAIT;AAEA;;;CAGC,GACD,IAAI,4CAAsB,WAAW,GAAG,CAAA,GAAA,iBAAS,EAAE","sources":["packages/@react-spectrum/s2/src/IllustratedMessage.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 {ButtonGroupContext} from './ButtonGroup';\nimport {ContentContext, HeadingContext} from './Content';\nimport {ContextValue, Provider} from 'react-aria-components';\nimport {createContext, forwardRef, ReactNode} from 'react';\nimport {DOMProps, DOMRef, DOMRefValue} from '@react-types/shared';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {getAllowedOverrides, StylesPropWithHeight, UnsafeStyles} from './style-utils' with {type: 'macro'};\nimport {IllustrationContext} from './Icon';\nimport {style} from '../style' with {type: 'macro'};\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\ninterface IllustratedMessageStyleProps {\n /**\n * The size of the IllustratedMessage.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L',\n /**\n * The direction that the IllustratedMessage should be laid out in.\n *\n * @default 'vertical'\n */\n orientation?: 'horizontal' | 'vertical'\n}\n\ninterface S2SpectrumIllustratedMessageProps extends DOMProps, UnsafeStyles, IllustratedMessageStyleProps {\n /** Spectrum-defined styles, returned by the `style()` macro. */\n styles?: StylesPropWithHeight,\n /** The content to display in the IllustratedMessage. */\n children: ReactNode\n}\n\nconst illustratedMessage = style<IllustratedMessageStyleProps & {isInDropZone?: boolean}>({\n display: 'grid',\n fontFamily: 'sans',\n fontSize: 'control',\n maxWidth: {\n orientation: {\n vertical: 380,\n horizontal: 528 // ask design about max width for horizontal because doesn't look great when L\n }\n },\n gridTemplateAreas: {\n orientation: {\n vertical: [\n ' . illustration . ',\n ' . . . ',\n 'heading heading heading',\n ' . . . ',\n 'content content content',\n ' . buttonGroup . '\n ],\n horizontal: [\n 'illustration . heading',\n 'illustration . . ',\n 'illustration . content',\n 'illustration . buttonGroup'\n ]\n }\n },\n gridTemplateRows: {\n orientation: {\n vertical: {\n default: ['min-content', 12, 'min-content', 4, 'min-content', 'min-content'],\n size: {\n L: ['min-content', 8, 'min-content', 4, 'min-content', 'min-content']\n }\n },\n horizontal: ['1fr', 4, '1fr']\n }\n },\n gridTemplateColumns: {\n orientation: {\n horizontal: ['1fr', 12, 'auto']\n }\n },\n justifyItems: {\n orientation: {\n vertical: 'center',\n horizontal: 'start'\n }\n },\n textAlign: {\n orientation: {\n vertical: 'center'\n }\n }\n}, getAllowedOverrides({height: true}));\n\nconst illustration = style<IllustratedMessageStyleProps & {isInDropZone?: boolean, isDropTarget?: boolean}>({\n gridArea: 'illustration',\n size: {\n size: {\n S: 96,\n M: 96,\n L: 160\n }\n },\n alignSelf: 'center',\n '--iconPrimary': {\n type: 'color',\n value: {\n default: 'neutral',\n isDropTarget: 'accent'\n }\n }\n});\n\nconst heading = style<IllustratedMessageStyleProps>({\n gridArea: 'heading',\n font: {\n size: {\n S: 'title',\n M: 'title-xl',\n L: 'title-2xl'\n }\n },\n alignSelf: 'end',\n margin: 0\n});\n\nconst content = style({\n font: {\n size: {\n S: 'body-xs',\n M: 'body-sm',\n L: 'body-sm'\n }\n },\n gridArea: 'content',\n alignSelf: 'start'\n});\n\nconst buttonGroup = style({\n gridArea: 'buttonGroup',\n marginTop: 16\n});\n\ninterface IllustratedMessageContextProps extends Partial<S2SpectrumIllustratedMessageProps> {\n isInDropZone?: boolean,\n isDropTarget?: boolean\n}\n\nexport const IllustratedMessageContext = createContext<ContextValue<IllustratedMessageContextProps, DOMRefValue<HTMLDivElement>>>(null);\n\nfunction IllustratedMessage(props: S2SpectrumIllustratedMessageProps, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, IllustratedMessageContext);\n let domRef = useDOMRef(ref);\n let {\n children,\n orientation = 'horizontal',\n size = 'M',\n UNSAFE_className = '',\n UNSAFE_style,\n isInDropZone = false,\n isDropTarget = false,\n ...otherProps\n } = props as IllustratedMessageContextProps;\n\n return (\n <div\n {...filterDOMProps(otherProps)}\n style={UNSAFE_style}\n className={UNSAFE_className + illustratedMessage({\n size: props.size || 'M',\n orientation: props.orientation || 'vertical'\n }, props.styles)}\n ref={domRef}>\n <Provider\n values={[\n [HeadingContext, {styles: heading({orientation, size})}],\n [ContentContext, {styles: content({size})}],\n [IllustrationContext, {size: size === 'L' ? 'L' : 'M', styles: illustration({orientation, size, isInDropZone, isDropTarget})}],\n [ButtonGroupContext, {styles: buttonGroup}]\n ]}>\n {children}\n </Provider>\n </div>\n );\n}\n\n/**\n * An IllustratedMessage displays an illustration and a message, usually\n * for an empty state or an error page.\n */\nlet _IllustratedMessage = /*#__PURE__*/ forwardRef(IllustratedMessage);\nexport {_IllustratedMessage as IllustratedMessage};\n"],"names":[],"version":3,"file":"IllustratedMessage.mjs.map"}
1
+ {"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;AAoCD,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyDN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYN,MAAM;AAUC,MAAM,0DAA4B,CAAA,GAAA,oBAAY,EAA6E;AAM3H,MAAM,4CAAqB,WAAW,GAAG,CAAA,GAAA,iBAAS,EAAE,SAAS,mBAAmB,KAAwC,EAAE,GAA2B;IAC1J,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAsB,EAAE,OAAO,KAAK;IACnD,IAAI,SAAS,CAAA,GAAA,gBAAQ,EAAE;IACvB,IAAI,YACF,QAAQ,eACR,cAAc,oBACd,OAAO,uBACP,mBAAmB,kBACnB,YAAY,gBACZ,eAAe,qBACf,eAAe,OACf,GAAG,YACJ,GAAG;IAEJ,qBACE,gBAAC;QACE,GAAG,CAAA,GAAA,qBAAa,EAAE,WAAW;QAC9B,OAAO;QACP,WAAW,mBAAmB,yCAAmB;YAC/C,MAAM,MAAM,IAAI,IAAI;YACpB,aAAa,MAAM,WAAW,IAAI;QACpC,GAAG,MAAM,MAAM;QACf,KAAK;kBACL,cAAA,gBAAC,CAAA,GAAA,eAAO;YACN,QAAQ;gBACN;oBAAC,CAAA,GAAA,yCAAa;oBAAG;wBAAC,QAAQ,8BAAQ;yCAAC;kCAAa;wBAAI;oBAAE;iBAAE;gBACxD;oBAAC,CAAA,GAAA,yCAAa;oBAAG;wBAAC,QAAQ,8BAAQ;kCAAC;wBAAI;oBAAE;iBAAE;gBAC3C;oBAAC,CAAA,GAAA,yCAAkB;oBAAG;wBAAC,MAAM,SAAS,MAAM,MAAM;wBAAK,QAAQ,mCAAa;yCAAC;kCAAa;0CAAM;0CAAc;wBAAY;oBAAE;iBAAE;gBAC9H;oBAAC,CAAA,GAAA,yCAAiB;oBAAG;wBAAC,QAAQ;oBAAW;iBAAE;aAC5C;sBACA;;;AAIT","sources":["packages/@react-spectrum/s2/src/IllustratedMessage.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 {ButtonGroupContext} from './ButtonGroup';\nimport {ContentContext, HeadingContext} from './Content';\nimport {ContextValue, Provider} from 'react-aria-components';\nimport {createContext, forwardRef, ReactNode} from 'react';\nimport {DOMProps, DOMRef, DOMRefValue} from '@react-types/shared';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {getAllowedOverrides, StylesPropWithHeight, UnsafeStyles} from './style-utils' with {type: 'macro'};\nimport {IllustrationContext} from './Icon';\nimport {style} from '../style' with {type: 'macro'};\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\ninterface IllustratedMessageStyleProps {\n /**\n * The size of the IllustratedMessage.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L',\n /**\n * The direction that the IllustratedMessage should be laid out in.\n *\n * @default 'vertical'\n */\n orientation?: 'horizontal' | 'vertical'\n}\n\ninterface S2SpectrumIllustratedMessageProps extends DOMProps, UnsafeStyles, IllustratedMessageStyleProps {\n /** Spectrum-defined styles, returned by the `style()` macro. */\n styles?: StylesPropWithHeight,\n /** The content to display in the IllustratedMessage. */\n children: ReactNode\n}\n\nconst illustratedMessage = style<IllustratedMessageStyleProps & {isInDropZone?: boolean}>({\n display: 'grid',\n fontFamily: 'sans',\n fontSize: 'control',\n maxWidth: {\n orientation: {\n vertical: 380,\n horizontal: 528 // ask design about max width for horizontal because doesn't look great when L\n }\n },\n gridTemplateAreas: {\n orientation: {\n vertical: [\n ' . illustration . ',\n ' . . . ',\n 'heading heading heading',\n ' . . . ',\n 'content content content',\n ' . buttonGroup . '\n ],\n horizontal: [\n 'illustration . heading',\n 'illustration . . ',\n 'illustration . content',\n 'illustration . buttonGroup'\n ]\n }\n },\n gridTemplateRows: {\n orientation: {\n vertical: {\n default: ['min-content', 12, 'min-content', 4, 'min-content', 'min-content'],\n size: {\n L: ['min-content', 8, 'min-content', 4, 'min-content', 'min-content']\n }\n },\n horizontal: ['1fr', 4, '1fr']\n }\n },\n gridTemplateColumns: {\n orientation: {\n horizontal: ['1fr', 12, 'auto']\n }\n },\n justifyItems: {\n orientation: {\n vertical: 'center',\n horizontal: 'start'\n }\n },\n textAlign: {\n orientation: {\n vertical: 'center'\n }\n }\n}, getAllowedOverrides({height: true}));\n\nconst illustration = style<IllustratedMessageStyleProps & {isInDropZone?: boolean, isDropTarget?: boolean}>({\n gridArea: 'illustration',\n size: {\n size: {\n S: 96,\n M: 96,\n L: 160\n }\n },\n alignSelf: 'center',\n '--iconPrimary': {\n type: 'color',\n value: {\n default: 'neutral',\n isDropTarget: 'accent'\n }\n }\n});\n\nconst heading = style<IllustratedMessageStyleProps>({\n gridArea: 'heading',\n font: {\n size: {\n S: 'title',\n M: 'title-xl',\n L: 'title-2xl'\n }\n },\n alignSelf: 'end',\n margin: 0\n});\n\nconst content = style({\n font: {\n size: {\n S: 'body-xs',\n M: 'body-sm',\n L: 'body-sm'\n }\n },\n gridArea: 'content',\n alignSelf: 'start'\n});\n\nconst buttonGroup = style({\n gridArea: 'buttonGroup',\n marginTop: 16\n});\n\ninterface IllustratedMessageContextProps extends Partial<S2SpectrumIllustratedMessageProps> {\n isInDropZone?: boolean,\n isDropTarget?: boolean\n}\n\nexport const IllustratedMessageContext = createContext<ContextValue<IllustratedMessageContextProps, DOMRefValue<HTMLDivElement>>>(null);\n\n/**\n * An IllustratedMessage displays an illustration and a message, usually\n * for an empty state or an error page.\n */\nexport const IllustratedMessage = /*#__PURE__*/ forwardRef(function IllustratedMessage(props: S2SpectrumIllustratedMessageProps, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, IllustratedMessageContext);\n let domRef = useDOMRef(ref);\n let {\n children,\n orientation = 'horizontal',\n size = 'M',\n UNSAFE_className = '',\n UNSAFE_style,\n isInDropZone = false,\n isDropTarget = false,\n ...otherProps\n } = props as IllustratedMessageContextProps;\n\n return (\n <div\n {...filterDOMProps(otherProps)}\n style={UNSAFE_style}\n className={UNSAFE_className + illustratedMessage({\n size: props.size || 'M',\n orientation: props.orientation || 'vertical'\n }, props.styles)}\n ref={domRef}>\n <Provider\n values={[\n [HeadingContext, {styles: heading({orientation, size})}],\n [ContentContext, {styles: content({size})}],\n [IllustrationContext, {size: size === 'L' ? 'L' : 'M', styles: illustration({orientation, size, isInDropZone, isDropTarget})}],\n [ButtonGroupContext, {styles: buttonGroup}]\n ]}>\n {children}\n </Provider>\n </div>\n );\n});\n"],"names":[],"version":3,"file":"IllustratedMessage.mjs.map"}
package/dist/Image.cjs CHANGED
@@ -72,7 +72,7 @@ const $053b76ed3d29e13b$var$imgStyles = function anonymous(props) {
72
72
  else rules += ' _Ra';
73
73
  return rules;
74
74
  };
75
- function $053b76ed3d29e13b$var$Image(props, domRef) {
75
+ const $053b76ed3d29e13b$export$3e431a229df88919 = /*#__PURE__*/ (0, $kwMay$react.forwardRef)(function Image(props, domRef) {
76
76
  [props, domRef] = (0, $ac757a4c2bd72aee$exports.useSpectrumContextProps)(props, domRef, $053b76ed3d29e13b$export$8151eb379fcf2442);
77
77
  let { src: src = '', styles: styles, UNSAFE_className: UNSAFE_className = '', UNSAFE_style: UNSAFE_style, renderError: renderError, group: group = (0, $a4f1585b527b9b7a$exports.DefaultImageGroup), alt: // TODO
78
78
  // srcSet,
@@ -177,8 +177,7 @@ function $053b76ed3d29e13b$var$Image(props, domRef) {
177
177
  isRevealed,
178
178
  isTransitioning
179
179
  ]);
180
- }
181
- const $053b76ed3d29e13b$export$3e431a229df88919 = /*#__PURE__*/ (0, $kwMay$react.forwardRef)($053b76ed3d29e13b$var$Image);
180
+ });
182
181
 
183
182
 
184
183
  //# sourceMappingURL=Image.cjs.map
@@ -1 +1 @@
1
- {"mappings":"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","sources":["packages/@react-spectrum/s2/src/Image.tsx"],"sourcesContent":["import {ContextValue, SlotProps} from 'react-aria-components';\nimport {createContext, ForwardedRef, forwardRef, HTMLAttributeReferrerPolicy, ReactNode, useCallback, useContext, useMemo, useReducer, useRef} from 'react';\nimport {DefaultImageGroup, ImageGroup} from './ImageCoordinator';\nimport {loadingStyle, useIsSkeleton, useLoadingAnimation} from './Skeleton';\nimport {mergeStyles} from '../style/runtime';\nimport {style} from '../style' with {type: 'macro'};\nimport {StyleString} from '../style/types';\nimport {UnsafeStyles} from './style-utils';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface ImageProps extends UnsafeStyles, SlotProps {\n /** The URL of the image. */\n src?: string,\n // TODO\n // srcSet?: string,\n // sizes?: string,\n /** Accessible alt text for the image. */\n alt?: string,\n /**\n * Indicates if the fetching of the image must be done using a CORS request.\n * [See MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin).\n */\n crossOrigin?: 'anonymous' | 'use-credentials',\n /**\n * Whether the browser should decode images synchronously or asynchronously.\n * [See MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#decoding).\n */\n decoding?: 'async' | 'auto' | 'sync',\n // Only supported in React 19...\n // fetchPriority?: 'high' | 'low' | 'auto',\n /**\n * Whether the image should be loaded immediately or lazily when scrolled into view.\n * [See MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#loading).\n */\n loading?: 'eager' | 'lazy',\n /**\n * A string indicating which referrer to use when fetching the resource.\n * [See MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#referrerpolicy).\n */\n referrerPolicy?: HTMLAttributeReferrerPolicy,\n /** Spectrum-defined styles, returned by the `style()` macro. */\n styles?: StyleString,\n /** A function that is called to render a fallback when the image fails to load. */\n renderError?: () => ReactNode,\n /**\n * A group of images to coordinate between, matching the group passed to the `<ImageCoordinator>` component.\n * If not provided, the default image group is used.\n */\n group?: ImageGroup\n}\n\ninterface ImageContextValue extends ImageProps {\n hidden?: boolean\n}\n\nexport const ImageContext = createContext<ContextValue<ImageContextValue, HTMLDivElement>>(null);\n\ntype ImageState = 'loading' | 'loaded' | 'revealed' | 'error';\ninterface State {\n state: ImageState,\n src: string,\n startTime: number,\n loadTime: number\n}\n\ntype Action = \n | {type: 'update', src: string}\n | {type: 'loaded'}\n | {type: 'revealed'}\n | {type: 'error'};\n\nfunction createState(src: string): State {\n return {\n state: 'loading',\n src,\n startTime: Date.now(),\n loadTime: 0\n };\n} \n\nfunction reducer(state: State, action: Action): State {\n switch (action.type) {\n case 'update': {\n return {\n state: 'loading',\n src: action.src,\n startTime: Date.now(),\n loadTime: 0\n };\n }\n case 'loaded':\n case 'error': {\n return {\n ...state,\n state: action.type\n };\n }\n case 'revealed': {\n return {\n ...state,\n state: 'revealed',\n loadTime: Date.now() - state.startTime\n };\n }\n default:\n return state;\n }\n}\n\nconst wrapperStyles = style({\n backgroundColor: 'gray-100',\n overflow: 'hidden'\n});\n\nconst imgStyles = style({\n display: 'block',\n width: 'full',\n height: 'full',\n objectFit: '[inherit]',\n objectPosition: '[inherit]',\n opacity: {\n default: 0,\n isRevealed: 1\n },\n transition: {\n default: 'none',\n isTransitioning: 'opacity'\n },\n transitionDuration: 500\n});\n\nfunction Image(props: ImageProps, domRef: ForwardedRef<HTMLDivElement>) {\n [props, domRef] = useSpectrumContextProps(props, domRef, ImageContext);\n\n let {\n src = '',\n styles,\n UNSAFE_className = '',\n UNSAFE_style,\n renderError,\n group = DefaultImageGroup,\n // TODO\n // srcSet,\n // sizes,\n alt,\n crossOrigin,\n decoding,\n loading,\n referrerPolicy,\n slot\n } = props;\n let hidden = (props as ImageContextValue).hidden;\n \n let {revealAll, register, unregister, load} = useContext(group);\n let [{state, src: lastSrc, loadTime}, dispatch] = useReducer(reducer, src, createState);\n\n if (src !== lastSrc && !hidden) {\n dispatch({type: 'update', src});\n }\n\n if (state === 'loaded' && revealAll && !hidden) {\n dispatch({type: 'revealed'});\n }\n\n let imgRef = useRef<HTMLImageElement | null>(null);\n useLayoutEffect(() => {\n if (hidden) {\n return;\n }\n\n register(src);\n return () => {\n unregister(src);\n };\n }, [hidden, register, unregister, src]);\n\n let onLoad = useCallback(() => {\n load(src);\n dispatch({type: 'loaded'});\n }, [load, src]);\n\n let onError = useCallback(() => {\n dispatch({type: 'error'});\n unregister(src);\n }, [unregister, src]);\n\n let isSkeleton = useIsSkeleton();\n let isAnimating = isSkeleton || state === 'loading' || state === 'loaded';\n let animation = useLoadingAnimation(isAnimating);\n useLayoutEffect(() => {\n if (hidden) {\n return;\n }\n\n // If the image is already loaded, update state immediately instead of waiting for onLoad.\n if (state === 'loading' && imgRef.current?.complete) {\n // Queue a microtask so we don't hit React's update limit.\n // TODO: is this necessary?\n queueMicrotask(onLoad);\n }\n\n animation(domRef.current);\n });\n\n if (props.alt == null) {\n console.warn(\n 'The `alt` prop was not provided to an image. ' +\n 'Add `alt` text for screen readers, or set `alt=\"\"` prop to indicate that the image ' +\n 'is decorative or redundant with displayed text and should not be announced by screen readers.'\n );\n }\n\n let errorState = !isSkeleton && state === 'error' && renderError?.();\n let isRevealed = state === 'revealed' && !isSkeleton;\n let isTransitioning = isRevealed && loadTime > 200;\n return useMemo(() => hidden ? null : (\n <div\n ref={domRef}\n slot={slot || undefined}\n style={UNSAFE_style}\n className={UNSAFE_className + mergeStyles(wrapperStyles, styles) + ' ' + (isAnimating ? loadingStyle : '')}>\n {errorState}\n {!errorState && (\n <img\n src={src}\n alt={alt}\n crossOrigin={crossOrigin}\n decoding={decoding}\n loading={loading}\n referrerPolicy={referrerPolicy}\n ref={imgRef}\n onLoad={onLoad}\n onError={onError}\n className={imgStyles({isRevealed, isTransitioning})} />\n )}\n </div>\n ), [slot, hidden, domRef, UNSAFE_style, UNSAFE_className, styles, isAnimating, errorState, src, alt, crossOrigin, decoding, loading, referrerPolicy, onLoad, onError, isRevealed, isTransitioning]);\n}\n\nconst _Image = forwardRef(Image);\nexport {_Image as Image};\n"],"names":[],"version":3,"file":"Image.cjs.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAwDO,MAAM,0DAAe,CAAA,GAAA,0BAAY,EAAmD;AAgB3F,SAAS,kCAAY,GAAW;IAC9B,OAAO;QACL,OAAO;aACP;QACA,WAAW,KAAK,GAAG;QACnB,UAAU;IACZ;AACF;AAEA,SAAS,8BAAQ,KAAY,EAAE,MAAc;IAC3C,OAAQ,OAAO,IAAI;QACjB,KAAK;YACH,OAAO;gBACL,OAAO;gBACP,KAAK,OAAO,GAAG;gBACf,WAAW,KAAK,GAAG;gBACnB,UAAU;YACZ;QAEF,KAAK;QACL,KAAK;YACH,OAAO;gBACL,GAAG,KAAK;gBACR,OAAO,OAAO,IAAI;YACpB;QAEF,KAAK;YACH,OAAO;gBACL,GAAG,KAAK;gBACR,OAAO;gBACP,UAAU,KAAK,GAAG,KAAK,MAAM,SAAS;YACxC;QAEF;YACE,OAAO;IACX;AACF;AAEA,MAAM;AAKN,MAAM;;;;;;;;;;;;;;;;AAiBC,MAAM,0DAAQ,CAAA,GAAA,uBAAS,EAAE,SAAS,MAAM,KAAiB,EAAE,MAAoC;IACpG,CAAC,OAAO,OAAO,GAAG,CAAA,GAAA,iDAAsB,EAAE,OAAO,QAAQ;IAEzD,IAAI,OACF,MAAM,YACN,MAAM,oBACN,mBAAmB,kBACnB,YAAY,eACZ,WAAW,SACX,QAAQ,CAAA,GAAA,2CAAgB,QACxB,OAAO;IACP,UAAU;IACV,SAAS;IACT,GAAG,eACH,WAAW,YACX,QAAQ,WACR,OAAO,kBACP,cAAc,QACd,IAAI,EACL,GAAG;IACJ,IAAI,SAAS,AAAC,MAA4B,MAAM;IAEhD,IAAI,aAAC,SAAS,YAAE,QAAQ,cAAE,UAAU,QAAE,IAAI,EAAC,GAAG,CAAA,GAAA,uBAAS,EAAE;IACzD,IAAI,CAAC,SAAC,KAAK,EAAE,KAAK,OAAO,YAAE,QAAQ,EAAC,EAAE,SAAS,GAAG,CAAA,GAAA,uBAAS,EAAE,+BAAS,KAAK;IAE3E,IAAI,QAAQ,WAAW,CAAC,QACtB,SAAS;QAAC,MAAM;aAAU;IAAG;IAG/B,IAAI,UAAU,YAAY,aAAa,CAAC,QACtC,SAAS;QAAC,MAAM;IAAU;IAG5B,IAAI,SAAS,CAAA,GAAA,mBAAK,EAA2B;IAC7C,CAAA,GAAA,qCAAc,EAAE;QACd,IAAI,QACF;QAGF,SAAS;QACT,OAAO;YACL,WAAW;QACb;IACF,GAAG;QAAC;QAAQ;QAAU;QAAY;KAAI;IAEtC,IAAI,SAAS,CAAA,GAAA,wBAAU,EAAE;QACvB,KAAK;QACL,SAAS;YAAC,MAAM;QAAQ;IAC1B,GAAG;QAAC;QAAM;KAAI;IAEd,IAAI,UAAU,CAAA,GAAA,wBAAU,EAAE;QACxB,SAAS;YAAC,MAAM;QAAO;QACvB,WAAW;IACb,GAAG;QAAC;QAAY;KAAI;IAEpB,IAAI,aAAa,CAAA,GAAA,uCAAY;IAC7B,IAAI,cAAc,cAAc,UAAU,aAAa,UAAU;IACjE,IAAI,YAAY,CAAA,GAAA,6CAAkB,EAAE;IACpC,CAAA,GAAA,qCAAc,EAAE;QACd,IAAI,QACF;QAGF,0FAA0F;QAC1F,IAAI,UAAU,aAAa,OAAO,OAAO,EAAE,UACzC,0DAA0D;QAC1D,2BAA2B;QAC3B,eAAe;QAGjB,UAAU,OAAO,OAAO;IAC1B;IAEA,IAAI,MAAM,GAAG,IAAI,MACf,QAAQ,IAAI,CACV;IAMJ,IAAI,aAAa,CAAC,cAAc,UAAU,WAAW;IACrD,IAAI,aAAa,UAAU,cAAc,CAAC;IAC1C,IAAI,kBAAkB,cAAc,WAAW;IAC/C,OAAO,CAAA,GAAA,oBAAM,EAAE,IAAM,SAAS,qBAC5B,iCAAC;YACC,KAAK;YACL,MAAM,QAAQ;YACd,OAAO;YACP,WAAW,mBAAmB,CAAA,GAAA,qCAAU,EAAE,qCAAe,UAAU,MAAQ,CAAA,cAAc,CAAA,GAAA,sCAAW,IAAI,EAAC;;gBACxG;gBACA,CAAC,4BACA,gCAAC;oBACC,KAAK;oBACL,KAAK;oBACL,aAAa;oBACb,UAAU;oBACV,SAAS;oBACT,gBAAgB;oBAChB,KAAK;oBACL,QAAQ;oBACR,SAAS;oBACT,WAAW,gCAAU;oCAAC;yCAAY;oBAAe;;;YAGtD;QAAC;QAAM;QAAQ;QAAQ;QAAc;QAAkB;QAAQ;QAAa;QAAY;QAAK;QAAK;QAAa;QAAU;QAAS;QAAgB;QAAQ;QAAS;QAAY;KAAgB;AACpM","sources":["packages/@react-spectrum/s2/src/Image.tsx"],"sourcesContent":["import {ContextValue, SlotProps} from 'react-aria-components';\nimport {createContext, ForwardedRef, forwardRef, HTMLAttributeReferrerPolicy, ReactNode, useCallback, useContext, useMemo, useReducer, useRef} from 'react';\nimport {DefaultImageGroup, ImageGroup} from './ImageCoordinator';\nimport {loadingStyle, useIsSkeleton, useLoadingAnimation} from './Skeleton';\nimport {mergeStyles} from '../style/runtime';\nimport {style} from '../style' with {type: 'macro'};\nimport {StyleString} from '../style/types';\nimport {UnsafeStyles} from './style-utils';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface ImageProps extends UnsafeStyles, SlotProps {\n /** The URL of the image. */\n src?: string,\n // TODO\n // srcSet?: string,\n // sizes?: string,\n /** Accessible alt text for the image. */\n alt?: string,\n /**\n * Indicates if the fetching of the image must be done using a CORS request.\n * [See MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin).\n */\n crossOrigin?: 'anonymous' | 'use-credentials',\n /**\n * Whether the browser should decode images synchronously or asynchronously.\n * [See MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#decoding).\n */\n decoding?: 'async' | 'auto' | 'sync',\n // Only supported in React 19...\n // fetchPriority?: 'high' | 'low' | 'auto',\n /**\n * Whether the image should be loaded immediately or lazily when scrolled into view.\n * [See MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#loading).\n */\n loading?: 'eager' | 'lazy',\n /**\n * A string indicating which referrer to use when fetching the resource.\n * [See MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#referrerpolicy).\n */\n referrerPolicy?: HTMLAttributeReferrerPolicy,\n /** Spectrum-defined styles, returned by the `style()` macro. */\n styles?: StyleString,\n /** A function that is called to render a fallback when the image fails to load. */\n renderError?: () => ReactNode,\n /**\n * A group of images to coordinate between, matching the group passed to the `<ImageCoordinator>` component.\n * If not provided, the default image group is used.\n */\n group?: ImageGroup\n}\n\ninterface ImageContextValue extends ImageProps {\n hidden?: boolean\n}\n\nexport const ImageContext = createContext<ContextValue<ImageContextValue, HTMLDivElement>>(null);\n\ntype ImageState = 'loading' | 'loaded' | 'revealed' | 'error';\ninterface State {\n state: ImageState,\n src: string,\n startTime: number,\n loadTime: number\n}\n\ntype Action = \n | {type: 'update', src: string}\n | {type: 'loaded'}\n | {type: 'revealed'}\n | {type: 'error'};\n\nfunction createState(src: string): State {\n return {\n state: 'loading',\n src,\n startTime: Date.now(),\n loadTime: 0\n };\n}\n\nfunction reducer(state: State, action: Action): State {\n switch (action.type) {\n case 'update': {\n return {\n state: 'loading',\n src: action.src,\n startTime: Date.now(),\n loadTime: 0\n };\n }\n case 'loaded':\n case 'error': {\n return {\n ...state,\n state: action.type\n };\n }\n case 'revealed': {\n return {\n ...state,\n state: 'revealed',\n loadTime: Date.now() - state.startTime\n };\n }\n default:\n return state;\n }\n}\n\nconst wrapperStyles = style({\n backgroundColor: 'gray-100',\n overflow: 'hidden'\n});\n\nconst imgStyles = style({\n display: 'block',\n width: 'full',\n height: 'full',\n objectFit: '[inherit]',\n objectPosition: '[inherit]',\n opacity: {\n default: 0,\n isRevealed: 1\n },\n transition: {\n default: 'none',\n isTransitioning: 'opacity'\n },\n transitionDuration: 500\n});\n\nexport const Image = forwardRef(function Image(props: ImageProps, domRef: ForwardedRef<HTMLDivElement>) {\n [props, domRef] = useSpectrumContextProps(props, domRef, ImageContext);\n\n let {\n src = '',\n styles,\n UNSAFE_className = '',\n UNSAFE_style,\n renderError,\n group = DefaultImageGroup,\n // TODO\n // srcSet,\n // sizes,\n alt,\n crossOrigin,\n decoding,\n loading,\n referrerPolicy,\n slot\n } = props;\n let hidden = (props as ImageContextValue).hidden;\n \n let {revealAll, register, unregister, load} = useContext(group);\n let [{state, src: lastSrc, loadTime}, dispatch] = useReducer(reducer, src, createState);\n\n if (src !== lastSrc && !hidden) {\n dispatch({type: 'update', src});\n }\n\n if (state === 'loaded' && revealAll && !hidden) {\n dispatch({type: 'revealed'});\n }\n\n let imgRef = useRef<HTMLImageElement | null>(null);\n useLayoutEffect(() => {\n if (hidden) {\n return;\n }\n\n register(src);\n return () => {\n unregister(src);\n };\n }, [hidden, register, unregister, src]);\n\n let onLoad = useCallback(() => {\n load(src);\n dispatch({type: 'loaded'});\n }, [load, src]);\n\n let onError = useCallback(() => {\n dispatch({type: 'error'});\n unregister(src);\n }, [unregister, src]);\n\n let isSkeleton = useIsSkeleton();\n let isAnimating = isSkeleton || state === 'loading' || state === 'loaded';\n let animation = useLoadingAnimation(isAnimating);\n useLayoutEffect(() => {\n if (hidden) {\n return;\n }\n\n // If the image is already loaded, update state immediately instead of waiting for onLoad.\n if (state === 'loading' && imgRef.current?.complete) {\n // Queue a microtask so we don't hit React's update limit.\n // TODO: is this necessary?\n queueMicrotask(onLoad);\n }\n\n animation(domRef.current);\n });\n\n if (props.alt == null) {\n console.warn(\n 'The `alt` prop was not provided to an image. ' +\n 'Add `alt` text for screen readers, or set `alt=\"\"` prop to indicate that the image ' +\n 'is decorative or redundant with displayed text and should not be announced by screen readers.'\n );\n }\n\n let errorState = !isSkeleton && state === 'error' && renderError?.();\n let isRevealed = state === 'revealed' && !isSkeleton;\n let isTransitioning = isRevealed && loadTime > 200;\n return useMemo(() => hidden ? null : (\n <div\n ref={domRef}\n slot={slot || undefined}\n style={UNSAFE_style}\n className={UNSAFE_className + mergeStyles(wrapperStyles, styles) + ' ' + (isAnimating ? loadingStyle : '')}>\n {errorState}\n {!errorState && (\n <img\n src={src}\n alt={alt}\n crossOrigin={crossOrigin}\n decoding={decoding}\n loading={loading}\n referrerPolicy={referrerPolicy}\n ref={imgRef}\n onLoad={onLoad}\n onError={onError}\n className={imgStyles({isRevealed, isTransitioning})} />\n )}\n </div>\n ), [slot, hidden, domRef, UNSAFE_style, UNSAFE_className, styles, isAnimating, errorState, src, alt, crossOrigin, decoding, loading, referrerPolicy, onLoad, onError, isRevealed, isTransitioning]);\n});\n"],"names":[],"version":3,"file":"Image.cjs.map"}
@@ -1 +1 @@
1
- {"mappings":"AC8GsB;EAAA;;;;EAAA;;;;EAAA;;;;EAKJ;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;AALI;;AAKJ","sources":["a1371b57e9afeb00","packages/@react-spectrum/s2/src/Image.tsx"],"sourcesContent":["@import \"be7e52eb05f9e81c\";\n@import \"b32b10d1bd9c4a50\";\n","import {ContextValue, SlotProps} from 'react-aria-components';\nimport {createContext, ForwardedRef, forwardRef, HTMLAttributeReferrerPolicy, ReactNode, useCallback, useContext, useMemo, useReducer, useRef} from 'react';\nimport {DefaultImageGroup, ImageGroup} from './ImageCoordinator';\nimport {loadingStyle, useIsSkeleton, useLoadingAnimation} from './Skeleton';\nimport {mergeStyles} from '../style/runtime';\nimport {style} from '../style' with {type: 'macro'};\nimport {StyleString} from '../style/types';\nimport {UnsafeStyles} from './style-utils';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface ImageProps extends UnsafeStyles, SlotProps {\n /** The URL of the image. */\n src?: string,\n // TODO\n // srcSet?: string,\n // sizes?: string,\n /** Accessible alt text for the image. */\n alt?: string,\n /**\n * Indicates if the fetching of the image must be done using a CORS request.\n * [See MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin).\n */\n crossOrigin?: 'anonymous' | 'use-credentials',\n /**\n * Whether the browser should decode images synchronously or asynchronously.\n * [See MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#decoding).\n */\n decoding?: 'async' | 'auto' | 'sync',\n // Only supported in React 19...\n // fetchPriority?: 'high' | 'low' | 'auto',\n /**\n * Whether the image should be loaded immediately or lazily when scrolled into view.\n * [See MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#loading).\n */\n loading?: 'eager' | 'lazy',\n /**\n * A string indicating which referrer to use when fetching the resource.\n * [See MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#referrerpolicy).\n */\n referrerPolicy?: HTMLAttributeReferrerPolicy,\n /** Spectrum-defined styles, returned by the `style()` macro. */\n styles?: StyleString,\n /** A function that is called to render a fallback when the image fails to load. */\n renderError?: () => ReactNode,\n /**\n * A group of images to coordinate between, matching the group passed to the `<ImageCoordinator>` component.\n * If not provided, the default image group is used.\n */\n group?: ImageGroup\n}\n\ninterface ImageContextValue extends ImageProps {\n hidden?: boolean\n}\n\nexport const ImageContext = createContext<ContextValue<ImageContextValue, HTMLDivElement>>(null);\n\ntype ImageState = 'loading' | 'loaded' | 'revealed' | 'error';\ninterface State {\n state: ImageState,\n src: string,\n startTime: number,\n loadTime: number\n}\n\ntype Action = \n | {type: 'update', src: string}\n | {type: 'loaded'}\n | {type: 'revealed'}\n | {type: 'error'};\n\nfunction createState(src: string): State {\n return {\n state: 'loading',\n src,\n startTime: Date.now(),\n loadTime: 0\n };\n} \n\nfunction reducer(state: State, action: Action): State {\n switch (action.type) {\n case 'update': {\n return {\n state: 'loading',\n src: action.src,\n startTime: Date.now(),\n loadTime: 0\n };\n }\n case 'loaded':\n case 'error': {\n return {\n ...state,\n state: action.type\n };\n }\n case 'revealed': {\n return {\n ...state,\n state: 'revealed',\n loadTime: Date.now() - state.startTime\n };\n }\n default:\n return state;\n }\n}\n\nconst wrapperStyles = style({\n backgroundColor: 'gray-100',\n overflow: 'hidden'\n});\n\nconst imgStyles = style({\n display: 'block',\n width: 'full',\n height: 'full',\n objectFit: '[inherit]',\n objectPosition: '[inherit]',\n opacity: {\n default: 0,\n isRevealed: 1\n },\n transition: {\n default: 'none',\n isTransitioning: 'opacity'\n },\n transitionDuration: 500\n});\n\nfunction Image(props: ImageProps, domRef: ForwardedRef<HTMLDivElement>) {\n [props, domRef] = useSpectrumContextProps(props, domRef, ImageContext);\n\n let {\n src = '',\n styles,\n UNSAFE_className = '',\n UNSAFE_style,\n renderError,\n group = DefaultImageGroup,\n // TODO\n // srcSet,\n // sizes,\n alt,\n crossOrigin,\n decoding,\n loading,\n referrerPolicy,\n slot\n } = props;\n let hidden = (props as ImageContextValue).hidden;\n \n let {revealAll, register, unregister, load} = useContext(group);\n let [{state, src: lastSrc, loadTime}, dispatch] = useReducer(reducer, src, createState);\n\n if (src !== lastSrc && !hidden) {\n dispatch({type: 'update', src});\n }\n\n if (state === 'loaded' && revealAll && !hidden) {\n dispatch({type: 'revealed'});\n }\n\n let imgRef = useRef<HTMLImageElement | null>(null);\n useLayoutEffect(() => {\n if (hidden) {\n return;\n }\n\n register(src);\n return () => {\n unregister(src);\n };\n }, [hidden, register, unregister, src]);\n\n let onLoad = useCallback(() => {\n load(src);\n dispatch({type: 'loaded'});\n }, [load, src]);\n\n let onError = useCallback(() => {\n dispatch({type: 'error'});\n unregister(src);\n }, [unregister, src]);\n\n let isSkeleton = useIsSkeleton();\n let isAnimating = isSkeleton || state === 'loading' || state === 'loaded';\n let animation = useLoadingAnimation(isAnimating);\n useLayoutEffect(() => {\n if (hidden) {\n return;\n }\n\n // If the image is already loaded, update state immediately instead of waiting for onLoad.\n if (state === 'loading' && imgRef.current?.complete) {\n // Queue a microtask so we don't hit React's update limit.\n // TODO: is this necessary?\n queueMicrotask(onLoad);\n }\n\n animation(domRef.current);\n });\n\n if (props.alt == null) {\n console.warn(\n 'The `alt` prop was not provided to an image. ' +\n 'Add `alt` text for screen readers, or set `alt=\"\"` prop to indicate that the image ' +\n 'is decorative or redundant with displayed text and should not be announced by screen readers.'\n );\n }\n\n let errorState = !isSkeleton && state === 'error' && renderError?.();\n let isRevealed = state === 'revealed' && !isSkeleton;\n let isTransitioning = isRevealed && loadTime > 200;\n return useMemo(() => hidden ? null : (\n <div\n ref={domRef}\n slot={slot || undefined}\n style={UNSAFE_style}\n className={UNSAFE_className + mergeStyles(wrapperStyles, styles) + ' ' + (isAnimating ? loadingStyle : '')}>\n {errorState}\n {!errorState && (\n <img\n src={src}\n alt={alt}\n crossOrigin={crossOrigin}\n decoding={decoding}\n loading={loading}\n referrerPolicy={referrerPolicy}\n ref={imgRef}\n onLoad={onLoad}\n onError={onError}\n className={imgStyles({isRevealed, isTransitioning})} />\n )}\n </div>\n ), [slot, hidden, domRef, UNSAFE_style, UNSAFE_className, styles, isAnimating, errorState, src, alt, crossOrigin, decoding, loading, referrerPolicy, onLoad, onError, isRevealed, isTransitioning]);\n}\n\nconst _Image = forwardRef(Image);\nexport {_Image as Image};\n"],"names":[],"version":3,"file":"Image.css.map"}
1
+ {"mappings":"AC8GsB;EAAA;;;;EAAA;;;;EAAA;;;;EAKJ;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;AALI;;AAKJ","sources":["a1371b57e9afeb00","packages/@react-spectrum/s2/src/Image.tsx"],"sourcesContent":["@import \"be7e52eb05f9e81c\";\n@import \"b32b10d1bd9c4a50\";\n","import {ContextValue, SlotProps} from 'react-aria-components';\nimport {createContext, ForwardedRef, forwardRef, HTMLAttributeReferrerPolicy, ReactNode, useCallback, useContext, useMemo, useReducer, useRef} from 'react';\nimport {DefaultImageGroup, ImageGroup} from './ImageCoordinator';\nimport {loadingStyle, useIsSkeleton, useLoadingAnimation} from './Skeleton';\nimport {mergeStyles} from '../style/runtime';\nimport {style} from '../style' with {type: 'macro'};\nimport {StyleString} from '../style/types';\nimport {UnsafeStyles} from './style-utils';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface ImageProps extends UnsafeStyles, SlotProps {\n /** The URL of the image. */\n src?: string,\n // TODO\n // srcSet?: string,\n // sizes?: string,\n /** Accessible alt text for the image. */\n alt?: string,\n /**\n * Indicates if the fetching of the image must be done using a CORS request.\n * [See MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin).\n */\n crossOrigin?: 'anonymous' | 'use-credentials',\n /**\n * Whether the browser should decode images synchronously or asynchronously.\n * [See MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#decoding).\n */\n decoding?: 'async' | 'auto' | 'sync',\n // Only supported in React 19...\n // fetchPriority?: 'high' | 'low' | 'auto',\n /**\n * Whether the image should be loaded immediately or lazily when scrolled into view.\n * [See MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#loading).\n */\n loading?: 'eager' | 'lazy',\n /**\n * A string indicating which referrer to use when fetching the resource.\n * [See MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#referrerpolicy).\n */\n referrerPolicy?: HTMLAttributeReferrerPolicy,\n /** Spectrum-defined styles, returned by the `style()` macro. */\n styles?: StyleString,\n /** A function that is called to render a fallback when the image fails to load. */\n renderError?: () => ReactNode,\n /**\n * A group of images to coordinate between, matching the group passed to the `<ImageCoordinator>` component.\n * If not provided, the default image group is used.\n */\n group?: ImageGroup\n}\n\ninterface ImageContextValue extends ImageProps {\n hidden?: boolean\n}\n\nexport const ImageContext = createContext<ContextValue<ImageContextValue, HTMLDivElement>>(null);\n\ntype ImageState = 'loading' | 'loaded' | 'revealed' | 'error';\ninterface State {\n state: ImageState,\n src: string,\n startTime: number,\n loadTime: number\n}\n\ntype Action = \n | {type: 'update', src: string}\n | {type: 'loaded'}\n | {type: 'revealed'}\n | {type: 'error'};\n\nfunction createState(src: string): State {\n return {\n state: 'loading',\n src,\n startTime: Date.now(),\n loadTime: 0\n };\n}\n\nfunction reducer(state: State, action: Action): State {\n switch (action.type) {\n case 'update': {\n return {\n state: 'loading',\n src: action.src,\n startTime: Date.now(),\n loadTime: 0\n };\n }\n case 'loaded':\n case 'error': {\n return {\n ...state,\n state: action.type\n };\n }\n case 'revealed': {\n return {\n ...state,\n state: 'revealed',\n loadTime: Date.now() - state.startTime\n };\n }\n default:\n return state;\n }\n}\n\nconst wrapperStyles = style({\n backgroundColor: 'gray-100',\n overflow: 'hidden'\n});\n\nconst imgStyles = style({\n display: 'block',\n width: 'full',\n height: 'full',\n objectFit: '[inherit]',\n objectPosition: '[inherit]',\n opacity: {\n default: 0,\n isRevealed: 1\n },\n transition: {\n default: 'none',\n isTransitioning: 'opacity'\n },\n transitionDuration: 500\n});\n\nexport const Image = forwardRef(function Image(props: ImageProps, domRef: ForwardedRef<HTMLDivElement>) {\n [props, domRef] = useSpectrumContextProps(props, domRef, ImageContext);\n\n let {\n src = '',\n styles,\n UNSAFE_className = '',\n UNSAFE_style,\n renderError,\n group = DefaultImageGroup,\n // TODO\n // srcSet,\n // sizes,\n alt,\n crossOrigin,\n decoding,\n loading,\n referrerPolicy,\n slot\n } = props;\n let hidden = (props as ImageContextValue).hidden;\n \n let {revealAll, register, unregister, load} = useContext(group);\n let [{state, src: lastSrc, loadTime}, dispatch] = useReducer(reducer, src, createState);\n\n if (src !== lastSrc && !hidden) {\n dispatch({type: 'update', src});\n }\n\n if (state === 'loaded' && revealAll && !hidden) {\n dispatch({type: 'revealed'});\n }\n\n let imgRef = useRef<HTMLImageElement | null>(null);\n useLayoutEffect(() => {\n if (hidden) {\n return;\n }\n\n register(src);\n return () => {\n unregister(src);\n };\n }, [hidden, register, unregister, src]);\n\n let onLoad = useCallback(() => {\n load(src);\n dispatch({type: 'loaded'});\n }, [load, src]);\n\n let onError = useCallback(() => {\n dispatch({type: 'error'});\n unregister(src);\n }, [unregister, src]);\n\n let isSkeleton = useIsSkeleton();\n let isAnimating = isSkeleton || state === 'loading' || state === 'loaded';\n let animation = useLoadingAnimation(isAnimating);\n useLayoutEffect(() => {\n if (hidden) {\n return;\n }\n\n // If the image is already loaded, update state immediately instead of waiting for onLoad.\n if (state === 'loading' && imgRef.current?.complete) {\n // Queue a microtask so we don't hit React's update limit.\n // TODO: is this necessary?\n queueMicrotask(onLoad);\n }\n\n animation(domRef.current);\n });\n\n if (props.alt == null) {\n console.warn(\n 'The `alt` prop was not provided to an image. ' +\n 'Add `alt` text for screen readers, or set `alt=\"\"` prop to indicate that the image ' +\n 'is decorative or redundant with displayed text and should not be announced by screen readers.'\n );\n }\n\n let errorState = !isSkeleton && state === 'error' && renderError?.();\n let isRevealed = state === 'revealed' && !isSkeleton;\n let isTransitioning = isRevealed && loadTime > 200;\n return useMemo(() => hidden ? null : (\n <div\n ref={domRef}\n slot={slot || undefined}\n style={UNSAFE_style}\n className={UNSAFE_className + mergeStyles(wrapperStyles, styles) + ' ' + (isAnimating ? loadingStyle : '')}>\n {errorState}\n {!errorState && (\n <img\n src={src}\n alt={alt}\n crossOrigin={crossOrigin}\n decoding={decoding}\n loading={loading}\n referrerPolicy={referrerPolicy}\n ref={imgRef}\n onLoad={onLoad}\n onError={onError}\n className={imgStyles({isRevealed, isTransitioning})} />\n )}\n </div>\n ), [slot, hidden, domRef, UNSAFE_style, UNSAFE_className, styles, isAnimating, errorState, src, alt, crossOrigin, decoding, loading, referrerPolicy, onLoad, onError, isRevealed, isTransitioning]);\n});\n"],"names":[],"version":3,"file":"Image.css.map"}
package/dist/Image.mjs CHANGED
@@ -4,7 +4,7 @@ import {loadingStyle as $5ad421ec19460c48$export$d2353276f167b21f, useIsSkeleton
4
4
  import {mergeStyles as $feb886035e0d4633$export$e618dc39ac9ad607} from "../icons/runtime.mjs";
5
5
  import {useSpectrumContextProps as $5ce63c423902f47d$export$764f6146fadd77f7} from "../icons/useSpectrumContextProps.mjs";
6
6
  import {jsxs as $5AH9h$jsxs, jsx as $5AH9h$jsx} from "react/jsx-runtime";
7
- import {createContext as $5AH9h$createContext, useContext as $5AH9h$useContext, useReducer as $5AH9h$useReducer, useRef as $5AH9h$useRef, useCallback as $5AH9h$useCallback, useMemo as $5AH9h$useMemo, forwardRef as $5AH9h$forwardRef} from "react";
7
+ import {createContext as $5AH9h$createContext, forwardRef as $5AH9h$forwardRef, useContext as $5AH9h$useContext, useReducer as $5AH9h$useReducer, useRef as $5AH9h$useRef, useCallback as $5AH9h$useCallback, useMemo as $5AH9h$useMemo} from "react";
8
8
  import {useLayoutEffect as $5AH9h$useLayoutEffect} from "@react-aria/utils";
9
9
 
10
10
 
@@ -65,7 +65,7 @@ const $dbd6f0b2503b938c$var$imgStyles = function anonymous(props) {
65
65
  else rules += ' _Ra';
66
66
  return rules;
67
67
  };
68
- function $dbd6f0b2503b938c$var$Image(props, domRef) {
68
+ const $dbd6f0b2503b938c$export$3e431a229df88919 = /*#__PURE__*/ (0, $5AH9h$forwardRef)(function Image(props, domRef) {
69
69
  [props, domRef] = (0, $5ce63c423902f47d$export$764f6146fadd77f7)(props, domRef, $dbd6f0b2503b938c$export$8151eb379fcf2442);
70
70
  let { src: src = '', styles: styles, UNSAFE_className: UNSAFE_className = '', UNSAFE_style: UNSAFE_style, renderError: renderError, group: group = (0, $4b5e069e9e001e8b$export$a37e899304e5fef0), alt: // TODO
71
71
  // srcSet,
@@ -170,8 +170,7 @@ function $dbd6f0b2503b938c$var$Image(props, domRef) {
170
170
  isRevealed,
171
171
  isTransitioning
172
172
  ]);
173
- }
174
- const $dbd6f0b2503b938c$export$3e431a229df88919 = /*#__PURE__*/ (0, $5AH9h$forwardRef)($dbd6f0b2503b938c$var$Image);
173
+ });
175
174
 
176
175
 
177
176
  export {$dbd6f0b2503b938c$export$8151eb379fcf2442 as ImageContext, $dbd6f0b2503b938c$export$3e431a229df88919 as Image};
@@ -1 +1 @@
1
- {"mappings":"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","sources":["packages/@react-spectrum/s2/src/Image.tsx"],"sourcesContent":["import {ContextValue, SlotProps} from 'react-aria-components';\nimport {createContext, ForwardedRef, forwardRef, HTMLAttributeReferrerPolicy, ReactNode, useCallback, useContext, useMemo, useReducer, useRef} from 'react';\nimport {DefaultImageGroup, ImageGroup} from './ImageCoordinator';\nimport {loadingStyle, useIsSkeleton, useLoadingAnimation} from './Skeleton';\nimport {mergeStyles} from '../style/runtime';\nimport {style} from '../style' with {type: 'macro'};\nimport {StyleString} from '../style/types';\nimport {UnsafeStyles} from './style-utils';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface ImageProps extends UnsafeStyles, SlotProps {\n /** The URL of the image. */\n src?: string,\n // TODO\n // srcSet?: string,\n // sizes?: string,\n /** Accessible alt text for the image. */\n alt?: string,\n /**\n * Indicates if the fetching of the image must be done using a CORS request.\n * [See MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin).\n */\n crossOrigin?: 'anonymous' | 'use-credentials',\n /**\n * Whether the browser should decode images synchronously or asynchronously.\n * [See MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#decoding).\n */\n decoding?: 'async' | 'auto' | 'sync',\n // Only supported in React 19...\n // fetchPriority?: 'high' | 'low' | 'auto',\n /**\n * Whether the image should be loaded immediately or lazily when scrolled into view.\n * [See MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#loading).\n */\n loading?: 'eager' | 'lazy',\n /**\n * A string indicating which referrer to use when fetching the resource.\n * [See MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#referrerpolicy).\n */\n referrerPolicy?: HTMLAttributeReferrerPolicy,\n /** Spectrum-defined styles, returned by the `style()` macro. */\n styles?: StyleString,\n /** A function that is called to render a fallback when the image fails to load. */\n renderError?: () => ReactNode,\n /**\n * A group of images to coordinate between, matching the group passed to the `<ImageCoordinator>` component.\n * If not provided, the default image group is used.\n */\n group?: ImageGroup\n}\n\ninterface ImageContextValue extends ImageProps {\n hidden?: boolean\n}\n\nexport const ImageContext = createContext<ContextValue<ImageContextValue, HTMLDivElement>>(null);\n\ntype ImageState = 'loading' | 'loaded' | 'revealed' | 'error';\ninterface State {\n state: ImageState,\n src: string,\n startTime: number,\n loadTime: number\n}\n\ntype Action = \n | {type: 'update', src: string}\n | {type: 'loaded'}\n | {type: 'revealed'}\n | {type: 'error'};\n\nfunction createState(src: string): State {\n return {\n state: 'loading',\n src,\n startTime: Date.now(),\n loadTime: 0\n };\n} \n\nfunction reducer(state: State, action: Action): State {\n switch (action.type) {\n case 'update': {\n return {\n state: 'loading',\n src: action.src,\n startTime: Date.now(),\n loadTime: 0\n };\n }\n case 'loaded':\n case 'error': {\n return {\n ...state,\n state: action.type\n };\n }\n case 'revealed': {\n return {\n ...state,\n state: 'revealed',\n loadTime: Date.now() - state.startTime\n };\n }\n default:\n return state;\n }\n}\n\nconst wrapperStyles = style({\n backgroundColor: 'gray-100',\n overflow: 'hidden'\n});\n\nconst imgStyles = style({\n display: 'block',\n width: 'full',\n height: 'full',\n objectFit: '[inherit]',\n objectPosition: '[inherit]',\n opacity: {\n default: 0,\n isRevealed: 1\n },\n transition: {\n default: 'none',\n isTransitioning: 'opacity'\n },\n transitionDuration: 500\n});\n\nfunction Image(props: ImageProps, domRef: ForwardedRef<HTMLDivElement>) {\n [props, domRef] = useSpectrumContextProps(props, domRef, ImageContext);\n\n let {\n src = '',\n styles,\n UNSAFE_className = '',\n UNSAFE_style,\n renderError,\n group = DefaultImageGroup,\n // TODO\n // srcSet,\n // sizes,\n alt,\n crossOrigin,\n decoding,\n loading,\n referrerPolicy,\n slot\n } = props;\n let hidden = (props as ImageContextValue).hidden;\n \n let {revealAll, register, unregister, load} = useContext(group);\n let [{state, src: lastSrc, loadTime}, dispatch] = useReducer(reducer, src, createState);\n\n if (src !== lastSrc && !hidden) {\n dispatch({type: 'update', src});\n }\n\n if (state === 'loaded' && revealAll && !hidden) {\n dispatch({type: 'revealed'});\n }\n\n let imgRef = useRef<HTMLImageElement | null>(null);\n useLayoutEffect(() => {\n if (hidden) {\n return;\n }\n\n register(src);\n return () => {\n unregister(src);\n };\n }, [hidden, register, unregister, src]);\n\n let onLoad = useCallback(() => {\n load(src);\n dispatch({type: 'loaded'});\n }, [load, src]);\n\n let onError = useCallback(() => {\n dispatch({type: 'error'});\n unregister(src);\n }, [unregister, src]);\n\n let isSkeleton = useIsSkeleton();\n let isAnimating = isSkeleton || state === 'loading' || state === 'loaded';\n let animation = useLoadingAnimation(isAnimating);\n useLayoutEffect(() => {\n if (hidden) {\n return;\n }\n\n // If the image is already loaded, update state immediately instead of waiting for onLoad.\n if (state === 'loading' && imgRef.current?.complete) {\n // Queue a microtask so we don't hit React's update limit.\n // TODO: is this necessary?\n queueMicrotask(onLoad);\n }\n\n animation(domRef.current);\n });\n\n if (props.alt == null) {\n console.warn(\n 'The `alt` prop was not provided to an image. ' +\n 'Add `alt` text for screen readers, or set `alt=\"\"` prop to indicate that the image ' +\n 'is decorative or redundant with displayed text and should not be announced by screen readers.'\n );\n }\n\n let errorState = !isSkeleton && state === 'error' && renderError?.();\n let isRevealed = state === 'revealed' && !isSkeleton;\n let isTransitioning = isRevealed && loadTime > 200;\n return useMemo(() => hidden ? null : (\n <div\n ref={domRef}\n slot={slot || undefined}\n style={UNSAFE_style}\n className={UNSAFE_className + mergeStyles(wrapperStyles, styles) + ' ' + (isAnimating ? loadingStyle : '')}>\n {errorState}\n {!errorState && (\n <img\n src={src}\n alt={alt}\n crossOrigin={crossOrigin}\n decoding={decoding}\n loading={loading}\n referrerPolicy={referrerPolicy}\n ref={imgRef}\n onLoad={onLoad}\n onError={onError}\n className={imgStyles({isRevealed, isTransitioning})} />\n )}\n </div>\n ), [slot, hidden, domRef, UNSAFE_style, UNSAFE_className, styles, isAnimating, errorState, src, alt, crossOrigin, decoding, loading, referrerPolicy, onLoad, onError, isRevealed, isTransitioning]);\n}\n\nconst _Image = forwardRef(Image);\nexport {_Image as Image};\n"],"names":[],"version":3,"file":"Image.mjs.map"}
1
+ {"mappings":"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","sources":["packages/@react-spectrum/s2/src/Image.tsx"],"sourcesContent":["import {ContextValue, SlotProps} from 'react-aria-components';\nimport {createContext, ForwardedRef, forwardRef, HTMLAttributeReferrerPolicy, ReactNode, useCallback, useContext, useMemo, useReducer, useRef} from 'react';\nimport {DefaultImageGroup, ImageGroup} from './ImageCoordinator';\nimport {loadingStyle, useIsSkeleton, useLoadingAnimation} from './Skeleton';\nimport {mergeStyles} from '../style/runtime';\nimport {style} from '../style' with {type: 'macro'};\nimport {StyleString} from '../style/types';\nimport {UnsafeStyles} from './style-utils';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface ImageProps extends UnsafeStyles, SlotProps {\n /** The URL of the image. */\n src?: string,\n // TODO\n // srcSet?: string,\n // sizes?: string,\n /** Accessible alt text for the image. */\n alt?: string,\n /**\n * Indicates if the fetching of the image must be done using a CORS request.\n * [See MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin).\n */\n crossOrigin?: 'anonymous' | 'use-credentials',\n /**\n * Whether the browser should decode images synchronously or asynchronously.\n * [See MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#decoding).\n */\n decoding?: 'async' | 'auto' | 'sync',\n // Only supported in React 19...\n // fetchPriority?: 'high' | 'low' | 'auto',\n /**\n * Whether the image should be loaded immediately or lazily when scrolled into view.\n * [See MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#loading).\n */\n loading?: 'eager' | 'lazy',\n /**\n * A string indicating which referrer to use when fetching the resource.\n * [See MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#referrerpolicy).\n */\n referrerPolicy?: HTMLAttributeReferrerPolicy,\n /** Spectrum-defined styles, returned by the `style()` macro. */\n styles?: StyleString,\n /** A function that is called to render a fallback when the image fails to load. */\n renderError?: () => ReactNode,\n /**\n * A group of images to coordinate between, matching the group passed to the `<ImageCoordinator>` component.\n * If not provided, the default image group is used.\n */\n group?: ImageGroup\n}\n\ninterface ImageContextValue extends ImageProps {\n hidden?: boolean\n}\n\nexport const ImageContext = createContext<ContextValue<ImageContextValue, HTMLDivElement>>(null);\n\ntype ImageState = 'loading' | 'loaded' | 'revealed' | 'error';\ninterface State {\n state: ImageState,\n src: string,\n startTime: number,\n loadTime: number\n}\n\ntype Action = \n | {type: 'update', src: string}\n | {type: 'loaded'}\n | {type: 'revealed'}\n | {type: 'error'};\n\nfunction createState(src: string): State {\n return {\n state: 'loading',\n src,\n startTime: Date.now(),\n loadTime: 0\n };\n}\n\nfunction reducer(state: State, action: Action): State {\n switch (action.type) {\n case 'update': {\n return {\n state: 'loading',\n src: action.src,\n startTime: Date.now(),\n loadTime: 0\n };\n }\n case 'loaded':\n case 'error': {\n return {\n ...state,\n state: action.type\n };\n }\n case 'revealed': {\n return {\n ...state,\n state: 'revealed',\n loadTime: Date.now() - state.startTime\n };\n }\n default:\n return state;\n }\n}\n\nconst wrapperStyles = style({\n backgroundColor: 'gray-100',\n overflow: 'hidden'\n});\n\nconst imgStyles = style({\n display: 'block',\n width: 'full',\n height: 'full',\n objectFit: '[inherit]',\n objectPosition: '[inherit]',\n opacity: {\n default: 0,\n isRevealed: 1\n },\n transition: {\n default: 'none',\n isTransitioning: 'opacity'\n },\n transitionDuration: 500\n});\n\nexport const Image = forwardRef(function Image(props: ImageProps, domRef: ForwardedRef<HTMLDivElement>) {\n [props, domRef] = useSpectrumContextProps(props, domRef, ImageContext);\n\n let {\n src = '',\n styles,\n UNSAFE_className = '',\n UNSAFE_style,\n renderError,\n group = DefaultImageGroup,\n // TODO\n // srcSet,\n // sizes,\n alt,\n crossOrigin,\n decoding,\n loading,\n referrerPolicy,\n slot\n } = props;\n let hidden = (props as ImageContextValue).hidden;\n \n let {revealAll, register, unregister, load} = useContext(group);\n let [{state, src: lastSrc, loadTime}, dispatch] = useReducer(reducer, src, createState);\n\n if (src !== lastSrc && !hidden) {\n dispatch({type: 'update', src});\n }\n\n if (state === 'loaded' && revealAll && !hidden) {\n dispatch({type: 'revealed'});\n }\n\n let imgRef = useRef<HTMLImageElement | null>(null);\n useLayoutEffect(() => {\n if (hidden) {\n return;\n }\n\n register(src);\n return () => {\n unregister(src);\n };\n }, [hidden, register, unregister, src]);\n\n let onLoad = useCallback(() => {\n load(src);\n dispatch({type: 'loaded'});\n }, [load, src]);\n\n let onError = useCallback(() => {\n dispatch({type: 'error'});\n unregister(src);\n }, [unregister, src]);\n\n let isSkeleton = useIsSkeleton();\n let isAnimating = isSkeleton || state === 'loading' || state === 'loaded';\n let animation = useLoadingAnimation(isAnimating);\n useLayoutEffect(() => {\n if (hidden) {\n return;\n }\n\n // If the image is already loaded, update state immediately instead of waiting for onLoad.\n if (state === 'loading' && imgRef.current?.complete) {\n // Queue a microtask so we don't hit React's update limit.\n // TODO: is this necessary?\n queueMicrotask(onLoad);\n }\n\n animation(domRef.current);\n });\n\n if (props.alt == null) {\n console.warn(\n 'The `alt` prop was not provided to an image. ' +\n 'Add `alt` text for screen readers, or set `alt=\"\"` prop to indicate that the image ' +\n 'is decorative or redundant with displayed text and should not be announced by screen readers.'\n );\n }\n\n let errorState = !isSkeleton && state === 'error' && renderError?.();\n let isRevealed = state === 'revealed' && !isSkeleton;\n let isTransitioning = isRevealed && loadTime > 200;\n return useMemo(() => hidden ? null : (\n <div\n ref={domRef}\n slot={slot || undefined}\n style={UNSAFE_style}\n className={UNSAFE_className + mergeStyles(wrapperStyles, styles) + ' ' + (isAnimating ? loadingStyle : '')}>\n {errorState}\n {!errorState && (\n <img\n src={src}\n alt={alt}\n crossOrigin={crossOrigin}\n decoding={decoding}\n loading={loading}\n referrerPolicy={referrerPolicy}\n ref={imgRef}\n onLoad={onLoad}\n onError={onError}\n className={imgStyles({isRevealed, isTransitioning})} />\n )}\n </div>\n ), [slot, hidden, domRef, UNSAFE_style, UNSAFE_className, styles, isAnimating, errorState, src, alt, crossOrigin, decoding, loading, referrerPolicy, onLoad, onError, isRevealed, isTransitioning]);\n});\n"],"names":[],"version":3,"file":"Image.mjs.map"}
@@ -217,7 +217,7 @@ const $72bf3a9f94a75d9f$var$content = function anonymous(props) {
217
217
  } else rules += ' an';
218
218
  return rules;
219
219
  };
220
- function $72bf3a9f94a75d9f$var$InlineAlert(props, ref) {
220
+ const $72bf3a9f94a75d9f$export$a3b2c96db9b0eb71 = /*#__PURE__*/ (0, $3stts$react.forwardRef)(function InlineAlert(props, ref) {
221
221
  let stringFormatter = (0, $3stts$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($4526404114e78c80$exports))), '@react-spectrum/s2');
222
222
  [props, ref] = (0, $ac757a4c2bd72aee$exports.useSpectrumContextProps)(props, ref, $72bf3a9f94a75d9f$export$c0de4eca0a8bf011);
223
223
  let { children: children, variant: variant = 'neutral', fillStyle: fillStyle = 'border', autoFocus: autoFocus } = props;
@@ -290,11 +290,7 @@ function $72bf3a9f94a75d9f$var$InlineAlert(props, ref) {
290
290
  })
291
291
  })
292
292
  });
293
- }
294
- /**
295
- * Inline alerts display a non-modal message associated with objects in a view.
296
- * These are often used in form validation, providing a place to aggregate feedback related to multiple fields.
297
- */ const $72bf3a9f94a75d9f$export$a3b2c96db9b0eb71 = /*#__PURE__*/ (0, $3stts$react.forwardRef)($72bf3a9f94a75d9f$var$InlineAlert);
293
+ });
298
294
 
299
295
 
300
296
  //# sourceMappingURL=InlineAlert.cjs.map
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;AA6CM,MAAM,0DAAqB,CAAA,GAAA,0BAAY,EAAwE;AAEtH,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkEN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;AAmCN,MAAM;AAYN,IAAI,8BAAQ;IACV,aAAa,CAAA,GAAA,iCAAS;IACtB,UAAU,CAAA,GAAA,iCAAc;IACxB,QAAQ,CAAA,GAAA,iCAAW;IACnB,UAAU,CAAA,GAAA,iCAAY;IACtB,SAAS;AACX;AAEA,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;AAgBN,SAAS,kCAAY,KAAuB,EAAE,GAA2B;IACvE,IAAI,kBAAkB,CAAA,GAAA,gDAA0B,EAAE,CAAA,GAAA,mDAAW,GAAG;IAChE,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,iDAAsB,EAAE,OAAO,KAAK;IACnD,IAAI,YACF,QAAQ,WACR,UAAU,sBACV,YAAY,qBACZ,SAAS,EACV,GAAG;IAEJ,IAAI,SAAS,CAAA,GAAA,mCAAQ,EAAE;IAEvB,IAAI,OAA8C;IAClD,IAAI,UAAU;IACd,IAAI,WAAW,6BAAO;QACpB,OAAO,2BAAK,CAAC,QAAQ;QACrB,IAAI,MACF,UAAU,gBAAgB,MAAM,CAAC,CAAC,YAAY,EAAE,SAAS;IAE7D;IAEA,IAAI,kBAAC,cAAc,cAAE,UAAU,EAAC,GAAG,CAAA,GAAA,6BAAW,EAAE;QAAC,WAAW,MAAM,SAAS;IAAA;IAC3E,IAAI,eAAe,CAAA,GAAA,mBAAK,EAAE,MAAM,SAAS;IACzC,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,aAAa,OAAO,IAAI,OAAO,OAAO,EACxC,OAAO,OAAO,CAAC,KAAK;QAEtB,aAAa,OAAO,GAAG;IACzB,GAAG;QAAC;KAAO;IAEX,qBACE,gCAAC;QACE,GAAG,CAAA,GAAA,oCAAa,EAAE,MAAM;QACxB,GAAG,UAAU;QACd,KAAK;QACL,UAAU,YAAY,KAAK;QAC3B,WAAW;QACX,MAAK;QACL,OAAO,MAAM,YAAY;QACzB,WAAW,AAAC,CAAA,MAAM,gBAAgB,IAAI,EAAC,IAAK,kCAAY;qBACtD;uBACA;4BACA;QACF,GAAG,MAAM,MAAM;kBACf,cAAA,gCAAC;YACC,WAAW;sBACX,cAAA,iCAAC,CAAA,GAAA,mCAAO;gBACN,QAAQ;oBACN;wBAAC,CAAA,GAAA,wCAAa;wBAAG;4BAAC,QAAQ,8BAAQ;2CAAC;4BAAS;wBAAE;qBAAE;oBAChD;wBAAC,CAAA,GAAA,wCAAa;wBAAG;4BAAC,QAAQ,8BAAQ;2CAAC;4BAAS;wBAAE;qBAAE;oBAChD;wBAAC,CAAA,GAAA,qCAAU;wBAAG;4BAAC,QAAQ,2BAAK;yCAAC;2CAAS;4BAAS;wBAAE;qBAAE;iBACpD;;oBACA,sBAAQ,gCAAC;wBAAK,cAAY;;oBAC1B;;;;;AAKX;AAEA;;;CAGC,GACD,MAAM,4CAAe,WAAW,GAAG,CAAA,GAAA,uBAAS,EAAE","sources":["packages/@react-spectrum/s2/src/InlineAlert.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 AlertTriangle from '../s2wf-icons/S2_Icon_AlertTriangle_20_N.svg';\nimport CheckmarkCircle from '../s2wf-icons/S2_Icon_CheckmarkCircle_20_N.svg';\nimport {ComponentType, createContext, forwardRef, ReactNode, useEffect, useRef} from 'react';\nimport {ContentContext, HeadingContext} from './Content';\nimport {ContextValue, Provider, SlotProps} from 'react-aria-components';\nimport {DOMProps, DOMRef, DOMRefValue} from '@react-types/shared';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {focusRing, style} from '../style' with {type: 'macro'};\nimport {getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {IconContext} from './Icon';\nimport InfoCircle from '../s2wf-icons/S2_Icon_InfoCircle_20_N.svg';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport NoticeSquare from '../s2wf-icons/S2_Icon_AlertDiamond_20_N.svg';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useFocusRing} from 'react-aria';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface InlineAlertProps extends DOMProps, StyleProps, InlineStylesProps, SlotProps {\n /**\n * The contents of the Inline Alert.\n */\n children: ReactNode,\n /**\n * Whether to automatically focus the Inline Alert when it first renders.\n */\n autoFocus?: boolean\n}\n\ninterface InlineStylesProps {\n /**\n * The semantic tone of a Inline Alert.\n * @default neutral\n */\n variant?: 'informative' | 'positive' | 'notice' | 'negative' | 'neutral',\n /**\n * The visual style of the Inline Alert.\n * @default border\n */\n fillStyle?: 'border' | 'subtleFill' | 'boldFill'\n}\n\nexport const InlineAlertContext = createContext<ContextValue<Partial<InlineAlertProps>, DOMRefValue<HTMLDivElement>>>(null);\n\nconst inlineAlert = style<InlineStylesProps & {isFocusVisible?: boolean}>({\n ...focusRing(),\n display: 'inline-block',\n position: 'relative',\n boxSizing: 'border-box',\n maxWidth: 320,\n padding: 24,\n borderRadius: 'lg',\n borderStyle: 'solid',\n borderWidth: 2,\n borderColor: {\n fillStyle: {\n border: {\n variant: {\n informative: 'informative-800',\n positive: 'positive-700',\n notice: 'notice-700',\n negative: 'negative-800',\n neutral: 'gray-700' // is there a semantic color name for neutral?\n }\n },\n subtleFill: 'transparent',\n boldFill: 'transparent'\n }\n },\n backgroundColor: {\n variant: {\n informative: {\n fillStyle: {\n border: 'gray-25',\n subtleFill: 'informative-subtle',\n boldFill: 'informative'\n }\n },\n positive: {\n fillStyle: {\n border: 'gray-25',\n subtleFill: 'positive-subtle',\n boldFill: 'positive'\n }\n },\n notice: {\n fillStyle: {\n border: 'gray-25',\n subtleFill: 'notice-subtle',\n boldFill: 'notice'\n }\n },\n negative: {\n fillStyle: {\n border: 'gray-25',\n subtleFill: 'negative-subtle',\n boldFill: 'negative'\n }\n },\n neutral: {\n fillStyle: {\n border: 'gray-25',\n subtleFill: 'neutral-subtle',\n boldFill: 'neutral-subdued'\n }\n }\n }\n }\n}, getAllowedOverrides());\n\nconst icon = style<InlineStylesProps>({\n gridArea: 'icon',\n '--iconPrimary': {\n type: 'fill',\n value: {\n fillStyle: {\n border: {\n variant: {\n informative: 'informative',\n positive: 'positive',\n notice: 'notice',\n negative: 'negative',\n neutral: 'neutral'\n }\n },\n subtleFill: {\n variant: {\n informative: 'informative',\n positive: 'positive',\n notice: 'negative',\n negative: 'negative',\n neutral: 'neutral'\n }\n },\n boldFill: {\n default: 'white',\n variant: {\n notice: 'black'\n }\n }\n }\n }\n }\n});\n\nconst grid = style({\n display: 'grid',\n columnGap: 24,\n gridTemplateColumns: '1fr auto',\n gridTemplateRows: 'auto auto auto',\n width: 'full',\n gridTemplateAreas: [\n 'heading icon',\n 'content content'\n ]\n});\n\nlet ICONS = {\n informative: InfoCircle,\n positive: CheckmarkCircle,\n notice: NoticeSquare,\n negative: AlertTriangle,\n neutral: undefined\n};\n\nconst heading = style({\n marginTop: 0,\n gridArea: 'heading',\n font: 'title-sm',\n color: {\n default: 'title',\n fillStyle: {\n boldFill: {\n default: 'white',\n variant: {\n notice: 'black'\n }\n }\n }\n }\n});\n\nconst content = style({\n gridArea: 'content',\n font: 'body-sm',\n color: {\n default: 'body',\n fillStyle: {\n boldFill: {\n default: 'white',\n variant: {\n notice: 'black'\n }\n }\n }\n }\n});\n\nfunction InlineAlert(props: InlineAlertProps, ref: DOMRef<HTMLDivElement>) {\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/s2');\n [props, ref] = useSpectrumContextProps(props, ref, InlineAlertContext);\n let {\n children,\n variant = 'neutral',\n fillStyle = 'border',\n autoFocus\n } = props;\n\n let domRef = useDOMRef(ref);\n\n let Icon: ComponentType<any> | null | undefined = null;\n let iconAlt = '';\n if (variant in ICONS) {\n Icon = ICONS[variant];\n if (Icon) {\n iconAlt = stringFormatter.format(`inlinealert.${variant}`);\n }\n }\n\n let {isFocusVisible, focusProps} = useFocusRing({autoFocus: props.autoFocus});\n let autoFocusRef = useRef(props.autoFocus);\n useEffect(() => {\n if (autoFocusRef.current && domRef.current) {\n domRef.current.focus();\n }\n autoFocusRef.current = false;\n }, [domRef]);\n\n return (\n <div\n {...filterDOMProps(props)}\n {...focusProps}\n ref={domRef}\n tabIndex={autoFocus ? -1 : undefined}\n autoFocus={autoFocus}\n role=\"alert\"\n style={props.UNSAFE_style}\n className={(props.UNSAFE_className || '') + inlineAlert({\n variant,\n fillStyle,\n isFocusVisible\n }, props.styles)}>\n <div\n className={grid}>\n <Provider\n values={[\n [HeadingContext, {styles: heading({fillStyle})}],\n [ContentContext, {styles: content({fillStyle})}],\n [IconContext, {styles: icon({variant, fillStyle})}]\n ]}>\n {Icon && <Icon aria-label={iconAlt} />}\n {children}\n </Provider>\n </div>\n </div>\n );\n}\n\n/**\n * Inline alerts display a non-modal message associated with objects in a view.\n * These are often used in form validation, providing a place to aggregate feedback related to multiple fields.\n */\nconst _InlineAlert = /*#__PURE__*/ forwardRef(InlineAlert);\nexport {_InlineAlert as InlineAlert};\n"],"names":[],"version":3,"file":"InlineAlert.cjs.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;AA6CM,MAAM,0DAAqB,CAAA,GAAA,0BAAY,EAAwE;AAEtH,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkEN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;AAmCN,MAAM;AAYN,IAAI,8BAAQ;IACV,aAAa,CAAA,GAAA,iCAAS;IACtB,UAAU,CAAA,GAAA,iCAAc;IACxB,QAAQ,CAAA,GAAA,iCAAW;IACnB,UAAU,CAAA,GAAA,iCAAY;IACtB,SAAS;AACX;AAEA,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;AAoBC,MAAM,4CAAc,WAAW,GAAG,CAAA,GAAA,uBAAS,EAAE,SAAS,YAAY,KAAuB,EAAE,GAA2B;IAC3H,IAAI,kBAAkB,CAAA,GAAA,gDAA0B,EAAE,CAAA,GAAA,mDAAW,GAAG;IAChE,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,iDAAsB,EAAE,OAAO,KAAK;IACnD,IAAI,YACF,QAAQ,WACR,UAAU,sBACV,YAAY,qBACZ,SAAS,EACV,GAAG;IAEJ,IAAI,SAAS,CAAA,GAAA,mCAAQ,EAAE;IAEvB,IAAI,OAA8C;IAClD,IAAI,UAAU;IACd,IAAI,WAAW,6BAAO;QACpB,OAAO,2BAAK,CAAC,QAAQ;QACrB,IAAI,MACF,UAAU,gBAAgB,MAAM,CAAC,CAAC,YAAY,EAAE,SAAS;IAE7D;IAEA,IAAI,kBAAC,cAAc,cAAE,UAAU,EAAC,GAAG,CAAA,GAAA,6BAAW,EAAE;QAAC,WAAW,MAAM,SAAS;IAAA;IAC3E,IAAI,eAAe,CAAA,GAAA,mBAAK,EAAE,MAAM,SAAS;IACzC,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,aAAa,OAAO,IAAI,OAAO,OAAO,EACxC,OAAO,OAAO,CAAC,KAAK;QAEtB,aAAa,OAAO,GAAG;IACzB,GAAG;QAAC;KAAO;IAEX,qBACE,gCAAC;QACE,GAAG,CAAA,GAAA,oCAAa,EAAE,MAAM;QACxB,GAAG,UAAU;QACd,KAAK;QACL,UAAU,YAAY,KAAK;QAC3B,WAAW;QACX,MAAK;QACL,OAAO,MAAM,YAAY;QACzB,WAAW,AAAC,CAAA,MAAM,gBAAgB,IAAI,EAAC,IAAK,kCAAY;qBACtD;uBACA;4BACA;QACF,GAAG,MAAM,MAAM;kBACf,cAAA,gCAAC;YACC,WAAW;sBACX,cAAA,iCAAC,CAAA,GAAA,mCAAO;gBACN,QAAQ;oBACN;wBAAC,CAAA,GAAA,wCAAa;wBAAG;4BAAC,QAAQ,8BAAQ;2CAAC;4BAAS;wBAAE;qBAAE;oBAChD;wBAAC,CAAA,GAAA,wCAAa;wBAAG;4BAAC,QAAQ,8BAAQ;2CAAC;4BAAS;wBAAE;qBAAE;oBAChD;wBAAC,CAAA,GAAA,qCAAU;wBAAG;4BAAC,QAAQ,2BAAK;yCAAC;2CAAS;4BAAS;wBAAE;qBAAE;iBACpD;;oBACA,sBAAQ,gCAAC;wBAAK,cAAY;;oBAC1B;;;;;AAKX","sources":["packages/@react-spectrum/s2/src/InlineAlert.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 AlertTriangle from '../s2wf-icons/S2_Icon_AlertTriangle_20_N.svg';\nimport CheckmarkCircle from '../s2wf-icons/S2_Icon_CheckmarkCircle_20_N.svg';\nimport {ComponentType, createContext, forwardRef, ReactNode, useEffect, useRef} from 'react';\nimport {ContentContext, HeadingContext} from './Content';\nimport {ContextValue, Provider, SlotProps} from 'react-aria-components';\nimport {DOMProps, DOMRef, DOMRefValue} from '@react-types/shared';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {focusRing, style} from '../style' with {type: 'macro'};\nimport {getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {IconContext} from './Icon';\nimport InfoCircle from '../s2wf-icons/S2_Icon_InfoCircle_20_N.svg';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport NoticeSquare from '../s2wf-icons/S2_Icon_AlertDiamond_20_N.svg';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useFocusRing} from 'react-aria';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface InlineAlertProps extends DOMProps, StyleProps, InlineStylesProps, SlotProps {\n /**\n * The contents of the Inline Alert.\n */\n children: ReactNode,\n /**\n * Whether to automatically focus the Inline Alert when it first renders.\n */\n autoFocus?: boolean\n}\n\ninterface InlineStylesProps {\n /**\n * The semantic tone of a Inline Alert.\n * @default neutral\n */\n variant?: 'informative' | 'positive' | 'notice' | 'negative' | 'neutral',\n /**\n * The visual style of the Inline Alert.\n * @default border\n */\n fillStyle?: 'border' | 'subtleFill' | 'boldFill'\n}\n\nexport const InlineAlertContext = createContext<ContextValue<Partial<InlineAlertProps>, DOMRefValue<HTMLDivElement>>>(null);\n\nconst inlineAlert = style<InlineStylesProps & {isFocusVisible?: boolean}>({\n ...focusRing(),\n display: 'inline-block',\n position: 'relative',\n boxSizing: 'border-box',\n maxWidth: 320,\n padding: 24,\n borderRadius: 'lg',\n borderStyle: 'solid',\n borderWidth: 2,\n borderColor: {\n fillStyle: {\n border: {\n variant: {\n informative: 'informative-800',\n positive: 'positive-700',\n notice: 'notice-700',\n negative: 'negative-800',\n neutral: 'gray-700' // is there a semantic color name for neutral?\n }\n },\n subtleFill: 'transparent',\n boldFill: 'transparent'\n }\n },\n backgroundColor: {\n variant: {\n informative: {\n fillStyle: {\n border: 'gray-25',\n subtleFill: 'informative-subtle',\n boldFill: 'informative'\n }\n },\n positive: {\n fillStyle: {\n border: 'gray-25',\n subtleFill: 'positive-subtle',\n boldFill: 'positive'\n }\n },\n notice: {\n fillStyle: {\n border: 'gray-25',\n subtleFill: 'notice-subtle',\n boldFill: 'notice'\n }\n },\n negative: {\n fillStyle: {\n border: 'gray-25',\n subtleFill: 'negative-subtle',\n boldFill: 'negative'\n }\n },\n neutral: {\n fillStyle: {\n border: 'gray-25',\n subtleFill: 'neutral-subtle',\n boldFill: 'neutral-subdued'\n }\n }\n }\n }\n}, getAllowedOverrides());\n\nconst icon = style<InlineStylesProps>({\n gridArea: 'icon',\n '--iconPrimary': {\n type: 'fill',\n value: {\n fillStyle: {\n border: {\n variant: {\n informative: 'informative',\n positive: 'positive',\n notice: 'notice',\n negative: 'negative',\n neutral: 'neutral'\n }\n },\n subtleFill: {\n variant: {\n informative: 'informative',\n positive: 'positive',\n notice: 'negative',\n negative: 'negative',\n neutral: 'neutral'\n }\n },\n boldFill: {\n default: 'white',\n variant: {\n notice: 'black'\n }\n }\n }\n }\n }\n});\n\nconst grid = style({\n display: 'grid',\n columnGap: 24,\n gridTemplateColumns: '1fr auto',\n gridTemplateRows: 'auto auto auto',\n width: 'full',\n gridTemplateAreas: [\n 'heading icon',\n 'content content'\n ]\n});\n\nlet ICONS = {\n informative: InfoCircle,\n positive: CheckmarkCircle,\n notice: NoticeSquare,\n negative: AlertTriangle,\n neutral: undefined\n};\n\nconst heading = style({\n marginTop: 0,\n gridArea: 'heading',\n font: 'title-sm',\n color: {\n default: 'title',\n fillStyle: {\n boldFill: {\n default: 'white',\n variant: {\n notice: 'black'\n }\n }\n }\n }\n});\n\nconst content = style({\n gridArea: 'content',\n font: 'body-sm',\n color: {\n default: 'body',\n fillStyle: {\n boldFill: {\n default: 'white',\n variant: {\n notice: 'black'\n }\n }\n }\n }\n});\n\n/**\n * Inline alerts display a non-modal message associated with objects in a view.\n * These are often used in form validation, providing a place to aggregate feedback related to multiple fields.\n */\nexport const InlineAlert = /*#__PURE__*/ forwardRef(function InlineAlert(props: InlineAlertProps, ref: DOMRef<HTMLDivElement>) {\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/s2');\n [props, ref] = useSpectrumContextProps(props, ref, InlineAlertContext);\n let {\n children,\n variant = 'neutral',\n fillStyle = 'border',\n autoFocus\n } = props;\n\n let domRef = useDOMRef(ref);\n\n let Icon: ComponentType<any> | null | undefined = null;\n let iconAlt = '';\n if (variant in ICONS) {\n Icon = ICONS[variant];\n if (Icon) {\n iconAlt = stringFormatter.format(`inlinealert.${variant}`);\n }\n }\n\n let {isFocusVisible, focusProps} = useFocusRing({autoFocus: props.autoFocus});\n let autoFocusRef = useRef(props.autoFocus);\n useEffect(() => {\n if (autoFocusRef.current && domRef.current) {\n domRef.current.focus();\n }\n autoFocusRef.current = false;\n }, [domRef]);\n\n return (\n <div\n {...filterDOMProps(props)}\n {...focusProps}\n ref={domRef}\n tabIndex={autoFocus ? -1 : undefined}\n autoFocus={autoFocus}\n role=\"alert\"\n style={props.UNSAFE_style}\n className={(props.UNSAFE_className || '') + inlineAlert({\n variant,\n fillStyle,\n isFocusVisible\n }, props.styles)}>\n <div\n className={grid}>\n <Provider\n values={[\n [HeadingContext, {styles: heading({fillStyle})}],\n [ContentContext, {styles: content({fillStyle})}],\n [IconContext, {styles: icon({variant, fillStyle})}]\n ]}>\n {Icon && <Icon aria-label={iconAlt} />}\n {children}\n </Provider>\n </div>\n </div>\n );\n});\n"],"names":[],"version":3,"file":"InlineAlert.cjs.map"}
@@ -1 +1 @@
1
- {"mappings":"ACyDoB;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAkEP;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAmCA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;EAoBG;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;;EAAA;;;;EAAA;;;;EAiBA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;AA1II;EAyHJ;;;;;;EAAA;;;;EAiBA;;;;EAAA;;;;;AA1II;;AAAA;EAAA;IAAA;;;;;;AAyHJ;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;IAAA;;;;;;AAiBA","sources":["22171ecf279467c9","packages/@react-spectrum/s2/src/InlineAlert.tsx"],"sourcesContent":["@import \"05e5e4aa26bfa23e\";\n@import \"f0ba8200e7cea625\";\n@import \"0ad65d68fdf037be\";\n@import \"d57ae7ad1398d4b5\";\n@import \"11184415316db266\";\n","/*\n * Copyright 2023 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 AlertTriangle from '../s2wf-icons/S2_Icon_AlertTriangle_20_N.svg';\nimport CheckmarkCircle from '../s2wf-icons/S2_Icon_CheckmarkCircle_20_N.svg';\nimport {ComponentType, createContext, forwardRef, ReactNode, useEffect, useRef} from 'react';\nimport {ContentContext, HeadingContext} from './Content';\nimport {ContextValue, Provider, SlotProps} from 'react-aria-components';\nimport {DOMProps, DOMRef, DOMRefValue} from '@react-types/shared';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {focusRing, style} from '../style' with {type: 'macro'};\nimport {getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {IconContext} from './Icon';\nimport InfoCircle from '../s2wf-icons/S2_Icon_InfoCircle_20_N.svg';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport NoticeSquare from '../s2wf-icons/S2_Icon_AlertDiamond_20_N.svg';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useFocusRing} from 'react-aria';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface InlineAlertProps extends DOMProps, StyleProps, InlineStylesProps, SlotProps {\n /**\n * The contents of the Inline Alert.\n */\n children: ReactNode,\n /**\n * Whether to automatically focus the Inline Alert when it first renders.\n */\n autoFocus?: boolean\n}\n\ninterface InlineStylesProps {\n /**\n * The semantic tone of a Inline Alert.\n * @default neutral\n */\n variant?: 'informative' | 'positive' | 'notice' | 'negative' | 'neutral',\n /**\n * The visual style of the Inline Alert.\n * @default border\n */\n fillStyle?: 'border' | 'subtleFill' | 'boldFill'\n}\n\nexport const InlineAlertContext = createContext<ContextValue<Partial<InlineAlertProps>, DOMRefValue<HTMLDivElement>>>(null);\n\nconst inlineAlert = style<InlineStylesProps & {isFocusVisible?: boolean}>({\n ...focusRing(),\n display: 'inline-block',\n position: 'relative',\n boxSizing: 'border-box',\n maxWidth: 320,\n padding: 24,\n borderRadius: 'lg',\n borderStyle: 'solid',\n borderWidth: 2,\n borderColor: {\n fillStyle: {\n border: {\n variant: {\n informative: 'informative-800',\n positive: 'positive-700',\n notice: 'notice-700',\n negative: 'negative-800',\n neutral: 'gray-700' // is there a semantic color name for neutral?\n }\n },\n subtleFill: 'transparent',\n boldFill: 'transparent'\n }\n },\n backgroundColor: {\n variant: {\n informative: {\n fillStyle: {\n border: 'gray-25',\n subtleFill: 'informative-subtle',\n boldFill: 'informative'\n }\n },\n positive: {\n fillStyle: {\n border: 'gray-25',\n subtleFill: 'positive-subtle',\n boldFill: 'positive'\n }\n },\n notice: {\n fillStyle: {\n border: 'gray-25',\n subtleFill: 'notice-subtle',\n boldFill: 'notice'\n }\n },\n negative: {\n fillStyle: {\n border: 'gray-25',\n subtleFill: 'negative-subtle',\n boldFill: 'negative'\n }\n },\n neutral: {\n fillStyle: {\n border: 'gray-25',\n subtleFill: 'neutral-subtle',\n boldFill: 'neutral-subdued'\n }\n }\n }\n }\n}, getAllowedOverrides());\n\nconst icon = style<InlineStylesProps>({\n gridArea: 'icon',\n '--iconPrimary': {\n type: 'fill',\n value: {\n fillStyle: {\n border: {\n variant: {\n informative: 'informative',\n positive: 'positive',\n notice: 'notice',\n negative: 'negative',\n neutral: 'neutral'\n }\n },\n subtleFill: {\n variant: {\n informative: 'informative',\n positive: 'positive',\n notice: 'negative',\n negative: 'negative',\n neutral: 'neutral'\n }\n },\n boldFill: {\n default: 'white',\n variant: {\n notice: 'black'\n }\n }\n }\n }\n }\n});\n\nconst grid = style({\n display: 'grid',\n columnGap: 24,\n gridTemplateColumns: '1fr auto',\n gridTemplateRows: 'auto auto auto',\n width: 'full',\n gridTemplateAreas: [\n 'heading icon',\n 'content content'\n ]\n});\n\nlet ICONS = {\n informative: InfoCircle,\n positive: CheckmarkCircle,\n notice: NoticeSquare,\n negative: AlertTriangle,\n neutral: undefined\n};\n\nconst heading = style({\n marginTop: 0,\n gridArea: 'heading',\n font: 'title-sm',\n color: {\n default: 'title',\n fillStyle: {\n boldFill: {\n default: 'white',\n variant: {\n notice: 'black'\n }\n }\n }\n }\n});\n\nconst content = style({\n gridArea: 'content',\n font: 'body-sm',\n color: {\n default: 'body',\n fillStyle: {\n boldFill: {\n default: 'white',\n variant: {\n notice: 'black'\n }\n }\n }\n }\n});\n\nfunction InlineAlert(props: InlineAlertProps, ref: DOMRef<HTMLDivElement>) {\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/s2');\n [props, ref] = useSpectrumContextProps(props, ref, InlineAlertContext);\n let {\n children,\n variant = 'neutral',\n fillStyle = 'border',\n autoFocus\n } = props;\n\n let domRef = useDOMRef(ref);\n\n let Icon: ComponentType<any> | null | undefined = null;\n let iconAlt = '';\n if (variant in ICONS) {\n Icon = ICONS[variant];\n if (Icon) {\n iconAlt = stringFormatter.format(`inlinealert.${variant}`);\n }\n }\n\n let {isFocusVisible, focusProps} = useFocusRing({autoFocus: props.autoFocus});\n let autoFocusRef = useRef(props.autoFocus);\n useEffect(() => {\n if (autoFocusRef.current && domRef.current) {\n domRef.current.focus();\n }\n autoFocusRef.current = false;\n }, [domRef]);\n\n return (\n <div\n {...filterDOMProps(props)}\n {...focusProps}\n ref={domRef}\n tabIndex={autoFocus ? -1 : undefined}\n autoFocus={autoFocus}\n role=\"alert\"\n style={props.UNSAFE_style}\n className={(props.UNSAFE_className || '') + inlineAlert({\n variant,\n fillStyle,\n isFocusVisible\n }, props.styles)}>\n <div\n className={grid}>\n <Provider\n values={[\n [HeadingContext, {styles: heading({fillStyle})}],\n [ContentContext, {styles: content({fillStyle})}],\n [IconContext, {styles: icon({variant, fillStyle})}]\n ]}>\n {Icon && <Icon aria-label={iconAlt} />}\n {children}\n </Provider>\n </div>\n </div>\n );\n}\n\n/**\n * Inline alerts display a non-modal message associated with objects in a view.\n * These are often used in form validation, providing a place to aggregate feedback related to multiple fields.\n */\nconst _InlineAlert = /*#__PURE__*/ forwardRef(InlineAlert);\nexport {_InlineAlert as InlineAlert};\n"],"names":[],"version":3,"file":"InlineAlert.css.map"}
1
+ {"mappings":"ACyDoB;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAkEP;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAmCA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;EAoBG;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;;EAAA;;;;EAAA;;;;EAiBA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;AA1II;EAyHJ;;;;;;EAAA;;;;EAiBA;;;;EAAA;;;;;AA1II;;AAAA;EAAA;IAAA;;;;;;AAyHJ;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;IAAA;;;;;;AAiBA","sources":["22171ecf279467c9","packages/@react-spectrum/s2/src/InlineAlert.tsx"],"sourcesContent":["@import \"05e5e4aa26bfa23e\";\n@import \"f0ba8200e7cea625\";\n@import \"0ad65d68fdf037be\";\n@import \"d57ae7ad1398d4b5\";\n@import \"11184415316db266\";\n","/*\n * Copyright 2023 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 AlertTriangle from '../s2wf-icons/S2_Icon_AlertTriangle_20_N.svg';\nimport CheckmarkCircle from '../s2wf-icons/S2_Icon_CheckmarkCircle_20_N.svg';\nimport {ComponentType, createContext, forwardRef, ReactNode, useEffect, useRef} from 'react';\nimport {ContentContext, HeadingContext} from './Content';\nimport {ContextValue, Provider, SlotProps} from 'react-aria-components';\nimport {DOMProps, DOMRef, DOMRefValue} from '@react-types/shared';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {focusRing, style} from '../style' with {type: 'macro'};\nimport {getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {IconContext} from './Icon';\nimport InfoCircle from '../s2wf-icons/S2_Icon_InfoCircle_20_N.svg';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport NoticeSquare from '../s2wf-icons/S2_Icon_AlertDiamond_20_N.svg';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useFocusRing} from 'react-aria';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface InlineAlertProps extends DOMProps, StyleProps, InlineStylesProps, SlotProps {\n /**\n * The contents of the Inline Alert.\n */\n children: ReactNode,\n /**\n * Whether to automatically focus the Inline Alert when it first renders.\n */\n autoFocus?: boolean\n}\n\ninterface InlineStylesProps {\n /**\n * The semantic tone of a Inline Alert.\n * @default neutral\n */\n variant?: 'informative' | 'positive' | 'notice' | 'negative' | 'neutral',\n /**\n * The visual style of the Inline Alert.\n * @default border\n */\n fillStyle?: 'border' | 'subtleFill' | 'boldFill'\n}\n\nexport const InlineAlertContext = createContext<ContextValue<Partial<InlineAlertProps>, DOMRefValue<HTMLDivElement>>>(null);\n\nconst inlineAlert = style<InlineStylesProps & {isFocusVisible?: boolean}>({\n ...focusRing(),\n display: 'inline-block',\n position: 'relative',\n boxSizing: 'border-box',\n maxWidth: 320,\n padding: 24,\n borderRadius: 'lg',\n borderStyle: 'solid',\n borderWidth: 2,\n borderColor: {\n fillStyle: {\n border: {\n variant: {\n informative: 'informative-800',\n positive: 'positive-700',\n notice: 'notice-700',\n negative: 'negative-800',\n neutral: 'gray-700' // is there a semantic color name for neutral?\n }\n },\n subtleFill: 'transparent',\n boldFill: 'transparent'\n }\n },\n backgroundColor: {\n variant: {\n informative: {\n fillStyle: {\n border: 'gray-25',\n subtleFill: 'informative-subtle',\n boldFill: 'informative'\n }\n },\n positive: {\n fillStyle: {\n border: 'gray-25',\n subtleFill: 'positive-subtle',\n boldFill: 'positive'\n }\n },\n notice: {\n fillStyle: {\n border: 'gray-25',\n subtleFill: 'notice-subtle',\n boldFill: 'notice'\n }\n },\n negative: {\n fillStyle: {\n border: 'gray-25',\n subtleFill: 'negative-subtle',\n boldFill: 'negative'\n }\n },\n neutral: {\n fillStyle: {\n border: 'gray-25',\n subtleFill: 'neutral-subtle',\n boldFill: 'neutral-subdued'\n }\n }\n }\n }\n}, getAllowedOverrides());\n\nconst icon = style<InlineStylesProps>({\n gridArea: 'icon',\n '--iconPrimary': {\n type: 'fill',\n value: {\n fillStyle: {\n border: {\n variant: {\n informative: 'informative',\n positive: 'positive',\n notice: 'notice',\n negative: 'negative',\n neutral: 'neutral'\n }\n },\n subtleFill: {\n variant: {\n informative: 'informative',\n positive: 'positive',\n notice: 'negative',\n negative: 'negative',\n neutral: 'neutral'\n }\n },\n boldFill: {\n default: 'white',\n variant: {\n notice: 'black'\n }\n }\n }\n }\n }\n});\n\nconst grid = style({\n display: 'grid',\n columnGap: 24,\n gridTemplateColumns: '1fr auto',\n gridTemplateRows: 'auto auto auto',\n width: 'full',\n gridTemplateAreas: [\n 'heading icon',\n 'content content'\n ]\n});\n\nlet ICONS = {\n informative: InfoCircle,\n positive: CheckmarkCircle,\n notice: NoticeSquare,\n negative: AlertTriangle,\n neutral: undefined\n};\n\nconst heading = style({\n marginTop: 0,\n gridArea: 'heading',\n font: 'title-sm',\n color: {\n default: 'title',\n fillStyle: {\n boldFill: {\n default: 'white',\n variant: {\n notice: 'black'\n }\n }\n }\n }\n});\n\nconst content = style({\n gridArea: 'content',\n font: 'body-sm',\n color: {\n default: 'body',\n fillStyle: {\n boldFill: {\n default: 'white',\n variant: {\n notice: 'black'\n }\n }\n }\n }\n});\n\n/**\n * Inline alerts display a non-modal message associated with objects in a view.\n * These are often used in form validation, providing a place to aggregate feedback related to multiple fields.\n */\nexport const InlineAlert = /*#__PURE__*/ forwardRef(function InlineAlert(props: InlineAlertProps, ref: DOMRef<HTMLDivElement>) {\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/s2');\n [props, ref] = useSpectrumContextProps(props, ref, InlineAlertContext);\n let {\n children,\n variant = 'neutral',\n fillStyle = 'border',\n autoFocus\n } = props;\n\n let domRef = useDOMRef(ref);\n\n let Icon: ComponentType<any> | null | undefined = null;\n let iconAlt = '';\n if (variant in ICONS) {\n Icon = ICONS[variant];\n if (Icon) {\n iconAlt = stringFormatter.format(`inlinealert.${variant}`);\n }\n }\n\n let {isFocusVisible, focusProps} = useFocusRing({autoFocus: props.autoFocus});\n let autoFocusRef = useRef(props.autoFocus);\n useEffect(() => {\n if (autoFocusRef.current && domRef.current) {\n domRef.current.focus();\n }\n autoFocusRef.current = false;\n }, [domRef]);\n\n return (\n <div\n {...filterDOMProps(props)}\n {...focusProps}\n ref={domRef}\n tabIndex={autoFocus ? -1 : undefined}\n autoFocus={autoFocus}\n role=\"alert\"\n style={props.UNSAFE_style}\n className={(props.UNSAFE_className || '') + inlineAlert({\n variant,\n fillStyle,\n isFocusVisible\n }, props.styles)}>\n <div\n className={grid}>\n <Provider\n values={[\n [HeadingContext, {styles: heading({fillStyle})}],\n [ContentContext, {styles: content({fillStyle})}],\n [IconContext, {styles: icon({variant, fillStyle})}]\n ]}>\n {Icon && <Icon aria-label={iconAlt} />}\n {children}\n </Provider>\n </div>\n </div>\n );\n});\n"],"names":[],"version":3,"file":"InlineAlert.css.map"}
@@ -8,7 +8,7 @@ import $7sfGs$intlStringsmjs from "./intlStrings.mjs";
8
8
  import $a951460932d22d7b$export$2e2bcd8739ae039 from "../icons/AlertDiamond.mjs";
9
9
  import {useSpectrumContextProps as $5ce63c423902f47d$export$764f6146fadd77f7} from "../icons/useSpectrumContextProps.mjs";
10
10
  import {jsx as $7sfGs$jsx, jsxs as $7sfGs$jsxs} from "react/jsx-runtime";
11
- import {createContext as $7sfGs$createContext, useRef as $7sfGs$useRef, useEffect as $7sfGs$useEffect, forwardRef as $7sfGs$forwardRef} from "react";
11
+ import {createContext as $7sfGs$createContext, forwardRef as $7sfGs$forwardRef, useRef as $7sfGs$useRef, useEffect as $7sfGs$useEffect} from "react";
12
12
  import {Provider as $7sfGs$Provider} from "react-aria-components";
13
13
  import {filterDOMProps as $7sfGs$filterDOMProps} from "@react-aria/utils";
14
14
  import {useDOMRef as $7sfGs$useDOMRef} from "@react-spectrum/utils";
@@ -210,7 +210,7 @@ const $fc2cf6b397804b9c$var$content = function anonymous(props) {
210
210
  } else rules += ' an';
211
211
  return rules;
212
212
  };
213
- function $fc2cf6b397804b9c$var$InlineAlert(props, ref) {
213
+ const $fc2cf6b397804b9c$export$a3b2c96db9b0eb71 = /*#__PURE__*/ (0, $7sfGs$forwardRef)(function InlineAlert(props, ref) {
214
214
  let stringFormatter = (0, $7sfGs$useLocalizedStringFormatter)((0, ($parcel$interopDefault($7sfGs$intlStringsmjs))), '@react-spectrum/s2');
215
215
  [props, ref] = (0, $5ce63c423902f47d$export$764f6146fadd77f7)(props, ref, $fc2cf6b397804b9c$export$c0de4eca0a8bf011);
216
216
  let { children: children, variant: variant = 'neutral', fillStyle: fillStyle = 'border', autoFocus: autoFocus } = props;
@@ -283,11 +283,7 @@ function $fc2cf6b397804b9c$var$InlineAlert(props, ref) {
283
283
  })
284
284
  })
285
285
  });
286
- }
287
- /**
288
- * Inline alerts display a non-modal message associated with objects in a view.
289
- * These are often used in form validation, providing a place to aggregate feedback related to multiple fields.
290
- */ const $fc2cf6b397804b9c$export$a3b2c96db9b0eb71 = /*#__PURE__*/ (0, $7sfGs$forwardRef)($fc2cf6b397804b9c$var$InlineAlert);
286
+ });
291
287
 
292
288
 
293
289
  export {$fc2cf6b397804b9c$export$c0de4eca0a8bf011 as InlineAlertContext, $fc2cf6b397804b9c$export$a3b2c96db9b0eb71 as InlineAlert};
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;AA6CM,MAAM,0DAAqB,CAAA,GAAA,oBAAY,EAAwE;AAEtH,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkEN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;AAmCN,MAAM;AAYN,IAAI,8BAAQ;IACV,aAAa,CAAA,GAAA,wCAAS;IACtB,UAAU,CAAA,GAAA,wCAAc;IACxB,QAAQ,CAAA,GAAA,wCAAW;IACnB,UAAU,CAAA,GAAA,wCAAY;IACtB,SAAS;AACX;AAEA,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;AAgBN,SAAS,kCAAY,KAAuB,EAAE,GAA2B;IACvE,IAAI,kBAAkB,CAAA,GAAA,kCAA0B,EAAE,CAAA,GAAA,+CAAW,GAAG;IAChE,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAsB,EAAE,OAAO,KAAK;IACnD,IAAI,YACF,QAAQ,WACR,UAAU,sBACV,YAAY,qBACZ,SAAS,EACV,GAAG;IAEJ,IAAI,SAAS,CAAA,GAAA,gBAAQ,EAAE;IAEvB,IAAI,OAA8C;IAClD,IAAI,UAAU;IACd,IAAI,WAAW,6BAAO;QACpB,OAAO,2BAAK,CAAC,QAAQ;QACrB,IAAI,MACF,UAAU,gBAAgB,MAAM,CAAC,CAAC,YAAY,EAAE,SAAS;IAE7D;IAEA,IAAI,kBAAC,cAAc,cAAE,UAAU,EAAC,GAAG,CAAA,GAAA,mBAAW,EAAE;QAAC,WAAW,MAAM,SAAS;IAAA;IAC3E,IAAI,eAAe,CAAA,GAAA,aAAK,EAAE,MAAM,SAAS;IACzC,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,aAAa,OAAO,IAAI,OAAO,OAAO,EACxC,OAAO,OAAO,CAAC,KAAK;QAEtB,aAAa,OAAO,GAAG;IACzB,GAAG;QAAC;KAAO;IAEX,qBACE,gBAAC;QACE,GAAG,CAAA,GAAA,qBAAa,EAAE,MAAM;QACxB,GAAG,UAAU;QACd,KAAK;QACL,UAAU,YAAY,KAAK;QAC3B,WAAW;QACX,MAAK;QACL,OAAO,MAAM,YAAY;QACzB,WAAW,AAAC,CAAA,MAAM,gBAAgB,IAAI,EAAC,IAAK,kCAAY;qBACtD;uBACA;4BACA;QACF,GAAG,MAAM,MAAM;kBACf,cAAA,gBAAC;YACC,WAAW;sBACX,cAAA,iBAAC,CAAA,GAAA,eAAO;gBACN,QAAQ;oBACN;wBAAC,CAAA,GAAA,yCAAa;wBAAG;4BAAC,QAAQ,8BAAQ;2CAAC;4BAAS;wBAAE;qBAAE;oBAChD;wBAAC,CAAA,GAAA,yCAAa;wBAAG;4BAAC,QAAQ,8BAAQ;2CAAC;4BAAS;wBAAE;qBAAE;oBAChD;wBAAC,CAAA,GAAA,yCAAU;wBAAG;4BAAC,QAAQ,2BAAK;yCAAC;2CAAS;4BAAS;wBAAE;qBAAE;iBACpD;;oBACA,sBAAQ,gBAAC;wBAAK,cAAY;;oBAC1B;;;;;AAKX;AAEA;;;CAGC,GACD,MAAM,4CAAe,WAAW,GAAG,CAAA,GAAA,iBAAS,EAAE","sources":["packages/@react-spectrum/s2/src/InlineAlert.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 AlertTriangle from '../s2wf-icons/S2_Icon_AlertTriangle_20_N.svg';\nimport CheckmarkCircle from '../s2wf-icons/S2_Icon_CheckmarkCircle_20_N.svg';\nimport {ComponentType, createContext, forwardRef, ReactNode, useEffect, useRef} from 'react';\nimport {ContentContext, HeadingContext} from './Content';\nimport {ContextValue, Provider, SlotProps} from 'react-aria-components';\nimport {DOMProps, DOMRef, DOMRefValue} from '@react-types/shared';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {focusRing, style} from '../style' with {type: 'macro'};\nimport {getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {IconContext} from './Icon';\nimport InfoCircle from '../s2wf-icons/S2_Icon_InfoCircle_20_N.svg';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport NoticeSquare from '../s2wf-icons/S2_Icon_AlertDiamond_20_N.svg';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useFocusRing} from 'react-aria';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface InlineAlertProps extends DOMProps, StyleProps, InlineStylesProps, SlotProps {\n /**\n * The contents of the Inline Alert.\n */\n children: ReactNode,\n /**\n * Whether to automatically focus the Inline Alert when it first renders.\n */\n autoFocus?: boolean\n}\n\ninterface InlineStylesProps {\n /**\n * The semantic tone of a Inline Alert.\n * @default neutral\n */\n variant?: 'informative' | 'positive' | 'notice' | 'negative' | 'neutral',\n /**\n * The visual style of the Inline Alert.\n * @default border\n */\n fillStyle?: 'border' | 'subtleFill' | 'boldFill'\n}\n\nexport const InlineAlertContext = createContext<ContextValue<Partial<InlineAlertProps>, DOMRefValue<HTMLDivElement>>>(null);\n\nconst inlineAlert = style<InlineStylesProps & {isFocusVisible?: boolean}>({\n ...focusRing(),\n display: 'inline-block',\n position: 'relative',\n boxSizing: 'border-box',\n maxWidth: 320,\n padding: 24,\n borderRadius: 'lg',\n borderStyle: 'solid',\n borderWidth: 2,\n borderColor: {\n fillStyle: {\n border: {\n variant: {\n informative: 'informative-800',\n positive: 'positive-700',\n notice: 'notice-700',\n negative: 'negative-800',\n neutral: 'gray-700' // is there a semantic color name for neutral?\n }\n },\n subtleFill: 'transparent',\n boldFill: 'transparent'\n }\n },\n backgroundColor: {\n variant: {\n informative: {\n fillStyle: {\n border: 'gray-25',\n subtleFill: 'informative-subtle',\n boldFill: 'informative'\n }\n },\n positive: {\n fillStyle: {\n border: 'gray-25',\n subtleFill: 'positive-subtle',\n boldFill: 'positive'\n }\n },\n notice: {\n fillStyle: {\n border: 'gray-25',\n subtleFill: 'notice-subtle',\n boldFill: 'notice'\n }\n },\n negative: {\n fillStyle: {\n border: 'gray-25',\n subtleFill: 'negative-subtle',\n boldFill: 'negative'\n }\n },\n neutral: {\n fillStyle: {\n border: 'gray-25',\n subtleFill: 'neutral-subtle',\n boldFill: 'neutral-subdued'\n }\n }\n }\n }\n}, getAllowedOverrides());\n\nconst icon = style<InlineStylesProps>({\n gridArea: 'icon',\n '--iconPrimary': {\n type: 'fill',\n value: {\n fillStyle: {\n border: {\n variant: {\n informative: 'informative',\n positive: 'positive',\n notice: 'notice',\n negative: 'negative',\n neutral: 'neutral'\n }\n },\n subtleFill: {\n variant: {\n informative: 'informative',\n positive: 'positive',\n notice: 'negative',\n negative: 'negative',\n neutral: 'neutral'\n }\n },\n boldFill: {\n default: 'white',\n variant: {\n notice: 'black'\n }\n }\n }\n }\n }\n});\n\nconst grid = style({\n display: 'grid',\n columnGap: 24,\n gridTemplateColumns: '1fr auto',\n gridTemplateRows: 'auto auto auto',\n width: 'full',\n gridTemplateAreas: [\n 'heading icon',\n 'content content'\n ]\n});\n\nlet ICONS = {\n informative: InfoCircle,\n positive: CheckmarkCircle,\n notice: NoticeSquare,\n negative: AlertTriangle,\n neutral: undefined\n};\n\nconst heading = style({\n marginTop: 0,\n gridArea: 'heading',\n font: 'title-sm',\n color: {\n default: 'title',\n fillStyle: {\n boldFill: {\n default: 'white',\n variant: {\n notice: 'black'\n }\n }\n }\n }\n});\n\nconst content = style({\n gridArea: 'content',\n font: 'body-sm',\n color: {\n default: 'body',\n fillStyle: {\n boldFill: {\n default: 'white',\n variant: {\n notice: 'black'\n }\n }\n }\n }\n});\n\nfunction InlineAlert(props: InlineAlertProps, ref: DOMRef<HTMLDivElement>) {\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/s2');\n [props, ref] = useSpectrumContextProps(props, ref, InlineAlertContext);\n let {\n children,\n variant = 'neutral',\n fillStyle = 'border',\n autoFocus\n } = props;\n\n let domRef = useDOMRef(ref);\n\n let Icon: ComponentType<any> | null | undefined = null;\n let iconAlt = '';\n if (variant in ICONS) {\n Icon = ICONS[variant];\n if (Icon) {\n iconAlt = stringFormatter.format(`inlinealert.${variant}`);\n }\n }\n\n let {isFocusVisible, focusProps} = useFocusRing({autoFocus: props.autoFocus});\n let autoFocusRef = useRef(props.autoFocus);\n useEffect(() => {\n if (autoFocusRef.current && domRef.current) {\n domRef.current.focus();\n }\n autoFocusRef.current = false;\n }, [domRef]);\n\n return (\n <div\n {...filterDOMProps(props)}\n {...focusProps}\n ref={domRef}\n tabIndex={autoFocus ? -1 : undefined}\n autoFocus={autoFocus}\n role=\"alert\"\n style={props.UNSAFE_style}\n className={(props.UNSAFE_className || '') + inlineAlert({\n variant,\n fillStyle,\n isFocusVisible\n }, props.styles)}>\n <div\n className={grid}>\n <Provider\n values={[\n [HeadingContext, {styles: heading({fillStyle})}],\n [ContentContext, {styles: content({fillStyle})}],\n [IconContext, {styles: icon({variant, fillStyle})}]\n ]}>\n {Icon && <Icon aria-label={iconAlt} />}\n {children}\n </Provider>\n </div>\n </div>\n );\n}\n\n/**\n * Inline alerts display a non-modal message associated with objects in a view.\n * These are often used in form validation, providing a place to aggregate feedback related to multiple fields.\n */\nconst _InlineAlert = /*#__PURE__*/ forwardRef(InlineAlert);\nexport {_InlineAlert as InlineAlert};\n"],"names":[],"version":3,"file":"InlineAlert.mjs.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;AA6CM,MAAM,0DAAqB,CAAA,GAAA,oBAAY,EAAwE;AAEtH,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkEN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;AAmCN,MAAM;AAYN,IAAI,8BAAQ;IACV,aAAa,CAAA,GAAA,wCAAS;IACtB,UAAU,CAAA,GAAA,wCAAc;IACxB,QAAQ,CAAA,GAAA,wCAAW;IACnB,UAAU,CAAA,GAAA,wCAAY;IACtB,SAAS;AACX;AAEA,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;AAoBC,MAAM,4CAAc,WAAW,GAAG,CAAA,GAAA,iBAAS,EAAE,SAAS,YAAY,KAAuB,EAAE,GAA2B;IAC3H,IAAI,kBAAkB,CAAA,GAAA,kCAA0B,EAAE,CAAA,GAAA,+CAAW,GAAG;IAChE,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAsB,EAAE,OAAO,KAAK;IACnD,IAAI,YACF,QAAQ,WACR,UAAU,sBACV,YAAY,qBACZ,SAAS,EACV,GAAG;IAEJ,IAAI,SAAS,CAAA,GAAA,gBAAQ,EAAE;IAEvB,IAAI,OAA8C;IAClD,IAAI,UAAU;IACd,IAAI,WAAW,6BAAO;QACpB,OAAO,2BAAK,CAAC,QAAQ;QACrB,IAAI,MACF,UAAU,gBAAgB,MAAM,CAAC,CAAC,YAAY,EAAE,SAAS;IAE7D;IAEA,IAAI,kBAAC,cAAc,cAAE,UAAU,EAAC,GAAG,CAAA,GAAA,mBAAW,EAAE;QAAC,WAAW,MAAM,SAAS;IAAA;IAC3E,IAAI,eAAe,CAAA,GAAA,aAAK,EAAE,MAAM,SAAS;IACzC,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,aAAa,OAAO,IAAI,OAAO,OAAO,EACxC,OAAO,OAAO,CAAC,KAAK;QAEtB,aAAa,OAAO,GAAG;IACzB,GAAG;QAAC;KAAO;IAEX,qBACE,gBAAC;QACE,GAAG,CAAA,GAAA,qBAAa,EAAE,MAAM;QACxB,GAAG,UAAU;QACd,KAAK;QACL,UAAU,YAAY,KAAK;QAC3B,WAAW;QACX,MAAK;QACL,OAAO,MAAM,YAAY;QACzB,WAAW,AAAC,CAAA,MAAM,gBAAgB,IAAI,EAAC,IAAK,kCAAY;qBACtD;uBACA;4BACA;QACF,GAAG,MAAM,MAAM;kBACf,cAAA,gBAAC;YACC,WAAW;sBACX,cAAA,iBAAC,CAAA,GAAA,eAAO;gBACN,QAAQ;oBACN;wBAAC,CAAA,GAAA,yCAAa;wBAAG;4BAAC,QAAQ,8BAAQ;2CAAC;4BAAS;wBAAE;qBAAE;oBAChD;wBAAC,CAAA,GAAA,yCAAa;wBAAG;4BAAC,QAAQ,8BAAQ;2CAAC;4BAAS;wBAAE;qBAAE;oBAChD;wBAAC,CAAA,GAAA,yCAAU;wBAAG;4BAAC,QAAQ,2BAAK;yCAAC;2CAAS;4BAAS;wBAAE;qBAAE;iBACpD;;oBACA,sBAAQ,gBAAC;wBAAK,cAAY;;oBAC1B;;;;;AAKX","sources":["packages/@react-spectrum/s2/src/InlineAlert.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 AlertTriangle from '../s2wf-icons/S2_Icon_AlertTriangle_20_N.svg';\nimport CheckmarkCircle from '../s2wf-icons/S2_Icon_CheckmarkCircle_20_N.svg';\nimport {ComponentType, createContext, forwardRef, ReactNode, useEffect, useRef} from 'react';\nimport {ContentContext, HeadingContext} from './Content';\nimport {ContextValue, Provider, SlotProps} from 'react-aria-components';\nimport {DOMProps, DOMRef, DOMRefValue} from '@react-types/shared';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {focusRing, style} from '../style' with {type: 'macro'};\nimport {getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {IconContext} from './Icon';\nimport InfoCircle from '../s2wf-icons/S2_Icon_InfoCircle_20_N.svg';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport NoticeSquare from '../s2wf-icons/S2_Icon_AlertDiamond_20_N.svg';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useFocusRing} from 'react-aria';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface InlineAlertProps extends DOMProps, StyleProps, InlineStylesProps, SlotProps {\n /**\n * The contents of the Inline Alert.\n */\n children: ReactNode,\n /**\n * Whether to automatically focus the Inline Alert when it first renders.\n */\n autoFocus?: boolean\n}\n\ninterface InlineStylesProps {\n /**\n * The semantic tone of a Inline Alert.\n * @default neutral\n */\n variant?: 'informative' | 'positive' | 'notice' | 'negative' | 'neutral',\n /**\n * The visual style of the Inline Alert.\n * @default border\n */\n fillStyle?: 'border' | 'subtleFill' | 'boldFill'\n}\n\nexport const InlineAlertContext = createContext<ContextValue<Partial<InlineAlertProps>, DOMRefValue<HTMLDivElement>>>(null);\n\nconst inlineAlert = style<InlineStylesProps & {isFocusVisible?: boolean}>({\n ...focusRing(),\n display: 'inline-block',\n position: 'relative',\n boxSizing: 'border-box',\n maxWidth: 320,\n padding: 24,\n borderRadius: 'lg',\n borderStyle: 'solid',\n borderWidth: 2,\n borderColor: {\n fillStyle: {\n border: {\n variant: {\n informative: 'informative-800',\n positive: 'positive-700',\n notice: 'notice-700',\n negative: 'negative-800',\n neutral: 'gray-700' // is there a semantic color name for neutral?\n }\n },\n subtleFill: 'transparent',\n boldFill: 'transparent'\n }\n },\n backgroundColor: {\n variant: {\n informative: {\n fillStyle: {\n border: 'gray-25',\n subtleFill: 'informative-subtle',\n boldFill: 'informative'\n }\n },\n positive: {\n fillStyle: {\n border: 'gray-25',\n subtleFill: 'positive-subtle',\n boldFill: 'positive'\n }\n },\n notice: {\n fillStyle: {\n border: 'gray-25',\n subtleFill: 'notice-subtle',\n boldFill: 'notice'\n }\n },\n negative: {\n fillStyle: {\n border: 'gray-25',\n subtleFill: 'negative-subtle',\n boldFill: 'negative'\n }\n },\n neutral: {\n fillStyle: {\n border: 'gray-25',\n subtleFill: 'neutral-subtle',\n boldFill: 'neutral-subdued'\n }\n }\n }\n }\n}, getAllowedOverrides());\n\nconst icon = style<InlineStylesProps>({\n gridArea: 'icon',\n '--iconPrimary': {\n type: 'fill',\n value: {\n fillStyle: {\n border: {\n variant: {\n informative: 'informative',\n positive: 'positive',\n notice: 'notice',\n negative: 'negative',\n neutral: 'neutral'\n }\n },\n subtleFill: {\n variant: {\n informative: 'informative',\n positive: 'positive',\n notice: 'negative',\n negative: 'negative',\n neutral: 'neutral'\n }\n },\n boldFill: {\n default: 'white',\n variant: {\n notice: 'black'\n }\n }\n }\n }\n }\n});\n\nconst grid = style({\n display: 'grid',\n columnGap: 24,\n gridTemplateColumns: '1fr auto',\n gridTemplateRows: 'auto auto auto',\n width: 'full',\n gridTemplateAreas: [\n 'heading icon',\n 'content content'\n ]\n});\n\nlet ICONS = {\n informative: InfoCircle,\n positive: CheckmarkCircle,\n notice: NoticeSquare,\n negative: AlertTriangle,\n neutral: undefined\n};\n\nconst heading = style({\n marginTop: 0,\n gridArea: 'heading',\n font: 'title-sm',\n color: {\n default: 'title',\n fillStyle: {\n boldFill: {\n default: 'white',\n variant: {\n notice: 'black'\n }\n }\n }\n }\n});\n\nconst content = style({\n gridArea: 'content',\n font: 'body-sm',\n color: {\n default: 'body',\n fillStyle: {\n boldFill: {\n default: 'white',\n variant: {\n notice: 'black'\n }\n }\n }\n }\n});\n\n/**\n * Inline alerts display a non-modal message associated with objects in a view.\n * These are often used in form validation, providing a place to aggregate feedback related to multiple fields.\n */\nexport const InlineAlert = /*#__PURE__*/ forwardRef(function InlineAlert(props: InlineAlertProps, ref: DOMRef<HTMLDivElement>) {\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/s2');\n [props, ref] = useSpectrumContextProps(props, ref, InlineAlertContext);\n let {\n children,\n variant = 'neutral',\n fillStyle = 'border',\n autoFocus\n } = props;\n\n let domRef = useDOMRef(ref);\n\n let Icon: ComponentType<any> | null | undefined = null;\n let iconAlt = '';\n if (variant in ICONS) {\n Icon = ICONS[variant];\n if (Icon) {\n iconAlt = stringFormatter.format(`inlinealert.${variant}`);\n }\n }\n\n let {isFocusVisible, focusProps} = useFocusRing({autoFocus: props.autoFocus});\n let autoFocusRef = useRef(props.autoFocus);\n useEffect(() => {\n if (autoFocusRef.current && domRef.current) {\n domRef.current.focus();\n }\n autoFocusRef.current = false;\n }, [domRef]);\n\n return (\n <div\n {...filterDOMProps(props)}\n {...focusProps}\n ref={domRef}\n tabIndex={autoFocus ? -1 : undefined}\n autoFocus={autoFocus}\n role=\"alert\"\n style={props.UNSAFE_style}\n className={(props.UNSAFE_className || '') + inlineAlert({\n variant,\n fillStyle,\n isFocusVisible\n }, props.styles)}>\n <div\n className={grid}>\n <Provider\n values={[\n [HeadingContext, {styles: heading({fillStyle})}],\n [ContentContext, {styles: content({fillStyle})}],\n [IconContext, {styles: icon({variant, fillStyle})}]\n ]}>\n {Icon && <Icon aria-label={iconAlt} />}\n {children}\n </Provider>\n </div>\n </div>\n );\n});\n"],"names":[],"version":3,"file":"InlineAlert.mjs.map"}
package/dist/Link.cjs CHANGED
@@ -94,7 +94,7 @@ const $064658f378a85eef$var$link = function anonymous(props, overrides) {
94
94
  rules += ' __R-yksgrp';
95
95
  return rules;
96
96
  };
97
- function $064658f378a85eef$var$Link(props, ref) {
97
+ const $064658f378a85eef$export$a6c7ac8248d6e38a = /*#__PURE__*/ (0, $7PkpH$react.forwardRef)(function Link(props, ref) {
98
98
  [props, ref] = (0, $ac757a4c2bd72aee$exports.useSpectrumContextProps)(props, ref, $064658f378a85eef$export$e2509388b49734e7);
99
99
  let { variant: variant = 'primary', staticColor: staticColor, isQuiet: isQuiet, isStandalone: isStandalone, UNSAFE_style: UNSAFE_style, UNSAFE_className: UNSAFE_className = '', styles: styles, children: children } = props;
100
100
  let domRef = (0, $7PkpH$reactspectrumutils.useFocusableRef)(ref);
@@ -121,11 +121,7 @@ function $064658f378a85eef$var$Link(props, ref) {
121
121
  }, styles),
122
122
  children: children
123
123
  });
124
- }
125
- /**
126
- * Links allow users to navigate to a different location.
127
- * They can be presented inline inside a paragraph or as standalone text.
128
- */ const $064658f378a85eef$export$a6c7ac8248d6e38a = /*#__PURE__*/ (0, $7PkpH$react.forwardRef)($064658f378a85eef$var$Link);
124
+ });
129
125
 
130
126
 
131
127
  //# sourceMappingURL=Link.cjs.map
package/dist/Link.cjs.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AA8BM,MAAM,0DAAc,CAAA,GAAA,0BAAY,EAAiE;AAExG,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CN,SAAS,2BAAK,KAAgB,EAAE,GAAoC;IAClE,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,iDAAsB,EAAE,OAAO,KAAK;IACnD,IAAI,WAAC,UAAU,wBAAW,WAAW,WAAE,OAAO,gBAAE,YAAY,gBAAE,YAAY,oBAAE,mBAAmB,YAAI,MAAM,YAAE,QAAQ,EAAC,GAAG;IAEvH,IAAI,SAAS,CAAA,GAAA,yCAAc,EAAE;IAC7B,IAAI,aAAa,CAAA,GAAA,uBAAS,EAAE,CAAA,GAAA,yCAAc,MAAM;IAChD,CAAC,UAAU,aAAa,GAAG,CAAA,GAAA,yCAAc,EAAE,UAAU;IAErD,CAAA,GAAA,qCAAc,EAAE;QACd,IAAI,OAAO,OAAO,EAChB,4CAA4C;QAC5C,OAAO,OAAO,CAAC,KAAK,GAAG;IAE3B,GAAG;QAAC;QAAQ;KAAW;IAEvB,qBACE,gCAAC,CAAA,GAAA,+BAAM;QACJ,GAAG,KAAK;QACT,KAAK;QACL,OAAO;QACP,WAAW,CAAA,cAAe,mBAAmB,2BAAK;gBAAC,GAAG,WAAW;yBAAE;6BAAS;yBAAa;8BAAS;4BAAc;YAAU,GAAG;kBAC5H;;AAGP;AAEA;;;CAGC,GACD,MAAM,4CAAQ,WAAW,GAAG,CAAA,GAAA,uBAAS,EAAE","sources":["packages/@react-spectrum/s2/src/Link.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 {ContextValue, LinkRenderProps, Link as RACLink, LinkProps as RACLinkProps} from 'react-aria-components';\nimport {createContext, forwardRef, ReactNode, useContext} from 'react';\nimport {FocusableRef, FocusableRefValue} from '@react-types/shared';\nimport {focusRing, style} from '../style' with {type: 'macro'};\nimport {getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {SkeletonContext, useSkeletonText} from './Skeleton';\nimport {useFocusableRef} from '@react-spectrum/utils';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\ninterface LinkStyleProps {\n /**\n * The [visual style](https://spectrum.adobe.com/page/link/#Options) of the link.\n * @default 'primary'\n */\n variant?: 'primary' | 'secondary',\n /** The static color style to apply. Useful when the link appears over a color background. */\n staticColor?: 'white' | 'black',\n /** Whether the link is on its own vs inside a longer string of text. */\n isStandalone?: boolean,\n /** Whether the link should be displayed with a quiet style. */\n isQuiet?: boolean\n}\n\nexport interface LinkProps extends Omit<RACLinkProps, 'isDisabled' | 'className' | 'style' | 'children' | 'onHover' | 'onHoverStart' | 'onHoverEnd' | 'onHoverChange'>, StyleProps, LinkStyleProps {\n children?: ReactNode\n}\n\nexport const LinkContext = createContext<ContextValue<LinkProps, FocusableRefValue<HTMLAnchorElement>>>(null);\n\nconst link = style<LinkRenderProps & LinkStyleProps & {isSkeleton: boolean}>({\n ...focusRing(),\n borderRadius: 'sm',\n font: {\n isStandalone: 'ui'\n },\n color: {\n variant: {\n primary: 'accent',\n secondary: 'neutral' // TODO: should there be an option to inherit from the paragraph? What about hover states?\n },\n staticColor: {\n white: 'white',\n black: 'black'\n },\n forcedColors: 'LinkText'\n },\n transition: 'default',\n fontWeight: {\n isStandalone: 'medium'\n },\n textDecoration: {\n default: 'underline',\n isStandalone: {\n // Inline links must always have an underline for accessibility.\n isQuiet: {\n default: 'none',\n isHovered: 'underline',\n isFocusVisible: 'underline'\n }\n }\n },\n outlineColor: {\n default: 'focus-ring',\n staticColor: {\n white: 'white',\n black: 'black'\n },\n forcedColors: 'Highlight'\n },\n disableTapHighlight: true\n}, getAllowedOverrides());\n\nfunction Link(props: LinkProps, ref: FocusableRef<HTMLAnchorElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, LinkContext);\n let {variant = 'primary', staticColor, isQuiet, isStandalone, UNSAFE_style, UNSAFE_className = '', styles, children} = props;\n\n let domRef = useFocusableRef(ref);\n let isSkeleton = useContext(SkeletonContext) || false;\n [children, UNSAFE_style] = useSkeletonText(children, UNSAFE_style);\n\n useLayoutEffect(() => {\n if (domRef.current) {\n // TODO: should RAC Link pass through inert?\n domRef.current.inert = isSkeleton;\n }\n }, [domRef, isSkeleton]);\n\n return (\n <RACLink\n {...props}\n ref={domRef}\n style={UNSAFE_style}\n className={renderProps => UNSAFE_className + link({...renderProps, variant, staticColor, isQuiet, isStandalone, isSkeleton}, styles)}>\n {children}\n </RACLink>\n );\n}\n\n/**\n * Links allow users to navigate to a different location.\n * They can be presented inline inside a paragraph or as standalone text.\n */\nconst _Link = /*#__PURE__*/ forwardRef(Link);\nexport {_Link as Link};\n"],"names":[],"version":3,"file":"Link.cjs.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AA8BM,MAAM,0DAAc,CAAA,GAAA,0BAAY,EAAiE;AAExG,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CC,MAAM,4CAAO,WAAW,GAAG,CAAA,GAAA,uBAAS,EAAE,SAAS,KAAK,KAAgB,EAAE,GAAoC;IAC/G,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,iDAAsB,EAAE,OAAO,KAAK;IACnD,IAAI,WAAC,UAAU,wBAAW,WAAW,WAAE,OAAO,gBAAE,YAAY,gBAAE,YAAY,oBAAE,mBAAmB,YAAI,MAAM,YAAE,QAAQ,EAAC,GAAG;IAEvH,IAAI,SAAS,CAAA,GAAA,yCAAc,EAAE;IAC7B,IAAI,aAAa,CAAA,GAAA,uBAAS,EAAE,CAAA,GAAA,yCAAc,MAAM;IAChD,CAAC,UAAU,aAAa,GAAG,CAAA,GAAA,yCAAc,EAAE,UAAU;IAErD,CAAA,GAAA,qCAAc,EAAE;QACd,IAAI,OAAO,OAAO,EAChB,4CAA4C;QAC5C,OAAO,OAAO,CAAC,KAAK,GAAG;IAE3B,GAAG;QAAC;QAAQ;KAAW;IAEvB,qBACE,gCAAC,CAAA,GAAA,+BAAM;QACJ,GAAG,KAAK;QACT,KAAK;QACL,OAAO;QACP,WAAW,CAAA,cAAe,mBAAmB,2BAAK;gBAAC,GAAG,WAAW;yBAAE;6BAAS;yBAAa;8BAAS;4BAAc;YAAU,GAAG;kBAC5H;;AAGP","sources":["packages/@react-spectrum/s2/src/Link.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 {ContextValue, LinkRenderProps, Link as RACLink, LinkProps as RACLinkProps} from 'react-aria-components';\nimport {createContext, forwardRef, ReactNode, useContext} from 'react';\nimport {FocusableRef, FocusableRefValue} from '@react-types/shared';\nimport {focusRing, style} from '../style' with {type: 'macro'};\nimport {getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {SkeletonContext, useSkeletonText} from './Skeleton';\nimport {useFocusableRef} from '@react-spectrum/utils';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\ninterface LinkStyleProps {\n /**\n * The [visual style](https://spectrum.adobe.com/page/link/#Options) of the link.\n * @default 'primary'\n */\n variant?: 'primary' | 'secondary',\n /** The static color style to apply. Useful when the link appears over a color background. */\n staticColor?: 'white' | 'black',\n /** Whether the link is on its own vs inside a longer string of text. */\n isStandalone?: boolean,\n /** Whether the link should be displayed with a quiet style. */\n isQuiet?: boolean\n}\n\nexport interface LinkProps extends Omit<RACLinkProps, 'isDisabled' | 'className' | 'style' | 'children' | 'onHover' | 'onHoverStart' | 'onHoverEnd' | 'onHoverChange'>, StyleProps, LinkStyleProps {\n children?: ReactNode\n}\n\nexport const LinkContext = createContext<ContextValue<LinkProps, FocusableRefValue<HTMLAnchorElement>>>(null);\n\nconst link = style<LinkRenderProps & LinkStyleProps & {isSkeleton: boolean}>({\n ...focusRing(),\n borderRadius: 'sm',\n font: {\n isStandalone: 'ui'\n },\n color: {\n variant: {\n primary: 'accent',\n secondary: 'neutral' // TODO: should there be an option to inherit from the paragraph? What about hover states?\n },\n staticColor: {\n white: 'white',\n black: 'black'\n },\n forcedColors: 'LinkText'\n },\n transition: 'default',\n fontWeight: {\n isStandalone: 'medium'\n },\n textDecoration: {\n default: 'underline',\n isStandalone: {\n // Inline links must always have an underline for accessibility.\n isQuiet: {\n default: 'none',\n isHovered: 'underline',\n isFocusVisible: 'underline'\n }\n }\n },\n outlineColor: {\n default: 'focus-ring',\n staticColor: {\n white: 'white',\n black: 'black'\n },\n forcedColors: 'Highlight'\n },\n disableTapHighlight: true\n}, getAllowedOverrides());\n\n/**\n * Links allow users to navigate to a different location.\n * They can be presented inline inside a paragraph or as standalone text.\n */\nexport const Link = /*#__PURE__*/ forwardRef(function Link(props: LinkProps, ref: FocusableRef<HTMLAnchorElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, LinkContext);\n let {variant = 'primary', staticColor, isQuiet, isStandalone, UNSAFE_style, UNSAFE_className = '', styles, children} = props;\n\n let domRef = useFocusableRef(ref);\n let isSkeleton = useContext(SkeletonContext) || false;\n [children, UNSAFE_style] = useSkeletonText(children, UNSAFE_style);\n\n useLayoutEffect(() => {\n if (domRef.current) {\n // TODO: should RAC Link pass through inert?\n domRef.current.inert = isSkeleton;\n }\n }, [domRef, isSkeleton]);\n\n return (\n <RACLink\n {...props}\n ref={domRef}\n style={UNSAFE_style}\n className={renderProps => UNSAFE_className + link({...renderProps, variant, staticColor, isQuiet, isStandalone, isSkeleton}, styles)}>\n {children}\n </RACLink>\n );\n});\n"],"names":[],"version":3,"file":"Link.cjs.map"}
package/dist/Link.css.map CHANGED
@@ -1 +1 @@
1
- {"mappings":"AA0Ca;;;;AAAA;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;;EAAA;;;;;AAAA;EAAA;;;;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;;AAAA;EAAA;IAAA;;;;IAAA;;;;;;AAAA;EAAA;IAAA","sources":["packages/@react-spectrum/s2/src/Link.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 {ContextValue, LinkRenderProps, Link as RACLink, LinkProps as RACLinkProps} from 'react-aria-components';\nimport {createContext, forwardRef, ReactNode, useContext} from 'react';\nimport {FocusableRef, FocusableRefValue} from '@react-types/shared';\nimport {focusRing, style} from '../style' with {type: 'macro'};\nimport {getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {SkeletonContext, useSkeletonText} from './Skeleton';\nimport {useFocusableRef} from '@react-spectrum/utils';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\ninterface LinkStyleProps {\n /**\n * The [visual style](https://spectrum.adobe.com/page/link/#Options) of the link.\n * @default 'primary'\n */\n variant?: 'primary' | 'secondary',\n /** The static color style to apply. Useful when the link appears over a color background. */\n staticColor?: 'white' | 'black',\n /** Whether the link is on its own vs inside a longer string of text. */\n isStandalone?: boolean,\n /** Whether the link should be displayed with a quiet style. */\n isQuiet?: boolean\n}\n\nexport interface LinkProps extends Omit<RACLinkProps, 'isDisabled' | 'className' | 'style' | 'children' | 'onHover' | 'onHoverStart' | 'onHoverEnd' | 'onHoverChange'>, StyleProps, LinkStyleProps {\n children?: ReactNode\n}\n\nexport const LinkContext = createContext<ContextValue<LinkProps, FocusableRefValue<HTMLAnchorElement>>>(null);\n\nconst link = style<LinkRenderProps & LinkStyleProps & {isSkeleton: boolean}>({\n ...focusRing(),\n borderRadius: 'sm',\n font: {\n isStandalone: 'ui'\n },\n color: {\n variant: {\n primary: 'accent',\n secondary: 'neutral' // TODO: should there be an option to inherit from the paragraph? What about hover states?\n },\n staticColor: {\n white: 'white',\n black: 'black'\n },\n forcedColors: 'LinkText'\n },\n transition: 'default',\n fontWeight: {\n isStandalone: 'medium'\n },\n textDecoration: {\n default: 'underline',\n isStandalone: {\n // Inline links must always have an underline for accessibility.\n isQuiet: {\n default: 'none',\n isHovered: 'underline',\n isFocusVisible: 'underline'\n }\n }\n },\n outlineColor: {\n default: 'focus-ring',\n staticColor: {\n white: 'white',\n black: 'black'\n },\n forcedColors: 'Highlight'\n },\n disableTapHighlight: true\n}, getAllowedOverrides());\n\nfunction Link(props: LinkProps, ref: FocusableRef<HTMLAnchorElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, LinkContext);\n let {variant = 'primary', staticColor, isQuiet, isStandalone, UNSAFE_style, UNSAFE_className = '', styles, children} = props;\n\n let domRef = useFocusableRef(ref);\n let isSkeleton = useContext(SkeletonContext) || false;\n [children, UNSAFE_style] = useSkeletonText(children, UNSAFE_style);\n\n useLayoutEffect(() => {\n if (domRef.current) {\n // TODO: should RAC Link pass through inert?\n domRef.current.inert = isSkeleton;\n }\n }, [domRef, isSkeleton]);\n\n return (\n <RACLink\n {...props}\n ref={domRef}\n style={UNSAFE_style}\n className={renderProps => UNSAFE_className + link({...renderProps, variant, staticColor, isQuiet, isStandalone, isSkeleton}, styles)}>\n {children}\n </RACLink>\n );\n}\n\n/**\n * Links allow users to navigate to a different location.\n * They can be presented inline inside a paragraph or as standalone text.\n */\nconst _Link = /*#__PURE__*/ forwardRef(Link);\nexport {_Link as Link};\n"],"names":[],"version":3,"file":"Link.css.map"}
1
+ {"mappings":"AA0Ca;;;;AAAA;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;;EAAA;;;;;AAAA;EAAA;;;;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;;AAAA;EAAA;IAAA;;;;IAAA;;;;;;AAAA;EAAA;IAAA","sources":["packages/@react-spectrum/s2/src/Link.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 {ContextValue, LinkRenderProps, Link as RACLink, LinkProps as RACLinkProps} from 'react-aria-components';\nimport {createContext, forwardRef, ReactNode, useContext} from 'react';\nimport {FocusableRef, FocusableRefValue} from '@react-types/shared';\nimport {focusRing, style} from '../style' with {type: 'macro'};\nimport {getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {SkeletonContext, useSkeletonText} from './Skeleton';\nimport {useFocusableRef} from '@react-spectrum/utils';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\ninterface LinkStyleProps {\n /**\n * The [visual style](https://spectrum.adobe.com/page/link/#Options) of the link.\n * @default 'primary'\n */\n variant?: 'primary' | 'secondary',\n /** The static color style to apply. Useful when the link appears over a color background. */\n staticColor?: 'white' | 'black',\n /** Whether the link is on its own vs inside a longer string of text. */\n isStandalone?: boolean,\n /** Whether the link should be displayed with a quiet style. */\n isQuiet?: boolean\n}\n\nexport interface LinkProps extends Omit<RACLinkProps, 'isDisabled' | 'className' | 'style' | 'children' | 'onHover' | 'onHoverStart' | 'onHoverEnd' | 'onHoverChange'>, StyleProps, LinkStyleProps {\n children?: ReactNode\n}\n\nexport const LinkContext = createContext<ContextValue<LinkProps, FocusableRefValue<HTMLAnchorElement>>>(null);\n\nconst link = style<LinkRenderProps & LinkStyleProps & {isSkeleton: boolean}>({\n ...focusRing(),\n borderRadius: 'sm',\n font: {\n isStandalone: 'ui'\n },\n color: {\n variant: {\n primary: 'accent',\n secondary: 'neutral' // TODO: should there be an option to inherit from the paragraph? What about hover states?\n },\n staticColor: {\n white: 'white',\n black: 'black'\n },\n forcedColors: 'LinkText'\n },\n transition: 'default',\n fontWeight: {\n isStandalone: 'medium'\n },\n textDecoration: {\n default: 'underline',\n isStandalone: {\n // Inline links must always have an underline for accessibility.\n isQuiet: {\n default: 'none',\n isHovered: 'underline',\n isFocusVisible: 'underline'\n }\n }\n },\n outlineColor: {\n default: 'focus-ring',\n staticColor: {\n white: 'white',\n black: 'black'\n },\n forcedColors: 'Highlight'\n },\n disableTapHighlight: true\n}, getAllowedOverrides());\n\n/**\n * Links allow users to navigate to a different location.\n * They can be presented inline inside a paragraph or as standalone text.\n */\nexport const Link = /*#__PURE__*/ forwardRef(function Link(props: LinkProps, ref: FocusableRef<HTMLAnchorElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, LinkContext);\n let {variant = 'primary', staticColor, isQuiet, isStandalone, UNSAFE_style, UNSAFE_className = '', styles, children} = props;\n\n let domRef = useFocusableRef(ref);\n let isSkeleton = useContext(SkeletonContext) || false;\n [children, UNSAFE_style] = useSkeletonText(children, UNSAFE_style);\n\n useLayoutEffect(() => {\n if (domRef.current) {\n // TODO: should RAC Link pass through inert?\n domRef.current.inert = isSkeleton;\n }\n }, [domRef, isSkeleton]);\n\n return (\n <RACLink\n {...props}\n ref={domRef}\n style={UNSAFE_style}\n className={renderProps => UNSAFE_className + link({...renderProps, variant, staticColor, isQuiet, isStandalone, isSkeleton}, styles)}>\n {children}\n </RACLink>\n );\n});\n"],"names":[],"version":3,"file":"Link.css.map"}
package/dist/Link.mjs CHANGED
@@ -3,7 +3,7 @@ import {SkeletonContext as $5ad421ec19460c48$export$74e166679b1f49ee, useSkeleto
3
3
  import {useSpectrumContextProps as $5ce63c423902f47d$export$764f6146fadd77f7} from "../icons/useSpectrumContextProps.mjs";
4
4
  import {jsx as $d6Kqa$jsx} from "react/jsx-runtime";
5
5
  import {Link as $d6Kqa$Link} from "react-aria-components";
6
- import {createContext as $d6Kqa$createContext, useContext as $d6Kqa$useContext, forwardRef as $d6Kqa$forwardRef} from "react";
6
+ import {createContext as $d6Kqa$createContext, forwardRef as $d6Kqa$forwardRef, useContext as $d6Kqa$useContext} from "react";
7
7
  import {useFocusableRef as $d6Kqa$useFocusableRef} from "@react-spectrum/utils";
8
8
  import {useLayoutEffect as $d6Kqa$useLayoutEffect} from "@react-aria/utils";
9
9
 
@@ -87,7 +87,7 @@ const $f50c78733c21bfe2$var$link = function anonymous(props, overrides) {
87
87
  rules += ' __R-yksgrp';
88
88
  return rules;
89
89
  };
90
- function $f50c78733c21bfe2$var$Link(props, ref) {
90
+ const $f50c78733c21bfe2$export$a6c7ac8248d6e38a = /*#__PURE__*/ (0, $d6Kqa$forwardRef)(function Link(props, ref) {
91
91
  [props, ref] = (0, $5ce63c423902f47d$export$764f6146fadd77f7)(props, ref, $f50c78733c21bfe2$export$e2509388b49734e7);
92
92
  let { variant: variant = 'primary', staticColor: staticColor, isQuiet: isQuiet, isStandalone: isStandalone, UNSAFE_style: UNSAFE_style, UNSAFE_className: UNSAFE_className = '', styles: styles, children: children } = props;
93
93
  let domRef = (0, $d6Kqa$useFocusableRef)(ref);
@@ -114,11 +114,7 @@ function $f50c78733c21bfe2$var$Link(props, ref) {
114
114
  }, styles),
115
115
  children: children
116
116
  });
117
- }
118
- /**
119
- * Links allow users to navigate to a different location.
120
- * They can be presented inline inside a paragraph or as standalone text.
121
- */ const $f50c78733c21bfe2$export$a6c7ac8248d6e38a = /*#__PURE__*/ (0, $d6Kqa$forwardRef)($f50c78733c21bfe2$var$Link);
117
+ });
122
118
 
123
119
 
124
120
  export {$f50c78733c21bfe2$export$e2509388b49734e7 as LinkContext, $f50c78733c21bfe2$export$a6c7ac8248d6e38a as Link};