@redsift/design-system 11.5.0 → 11.6.0-muiv5-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (710) hide show
  1. package/_virtual/_rollupPluginBabelHelpers.js +133 -0
  2. package/_virtual/_rollupPluginBabelHelpers.js.map +1 -0
  3. package/_virtual/jsx-runtime.js +4 -0
  4. package/_virtual/jsx-runtime.js.map +1 -0
  5. package/_virtual/react-jsx-runtime.development.js +4 -0
  6. package/_virtual/react-jsx-runtime.development.js.map +1 -0
  7. package/_virtual/react-jsx-runtime.production.min.js +4 -0
  8. package/_virtual/react-jsx-runtime.production.min.js.map +1 -0
  9. package/components/alert/Alert.d.ts +9 -0
  10. package/components/alert/Alert.js +117 -0
  11. package/components/alert/Alert.js.map +1 -0
  12. package/components/alert/intl/en-US.json.js +7 -0
  13. package/components/alert/intl/en-US.json.js.map +1 -0
  14. package/components/alert/intl/fr-FR.json.js +7 -0
  15. package/components/alert/intl/fr-FR.json.js.map +1 -0
  16. package/components/alert/intl/index.js +10 -0
  17. package/components/alert/intl/index.js.map +1 -0
  18. package/components/alert/styles.js +54 -0
  19. package/components/alert/styles.js.map +1 -0
  20. package/components/alert/types.d.ts +49 -0
  21. package/components/alert/types.js +20 -0
  22. package/components/alert/types.js.map +1 -0
  23. package/components/app-bar/AppBar.d.ts +9 -0
  24. package/components/app-bar/AppBar.js +95 -0
  25. package/components/app-bar/AppBar.js.map +1 -0
  26. package/components/app-bar/intl/en-US.json.js +9 -0
  27. package/components/app-bar/intl/en-US.json.js.map +1 -0
  28. package/components/app-bar/intl/fr-FR.json.js +9 -0
  29. package/components/app-bar/intl/fr-FR.json.js.map +1 -0
  30. package/components/app-bar/intl/index.js +10 -0
  31. package/components/app-bar/intl/index.js.map +1 -0
  32. package/components/app-bar/styles.js +139 -0
  33. package/components/app-bar/styles.js.map +1 -0
  34. package/components/app-bar/types.d.ts +31 -0
  35. package/components/app-container/AppContainer.d.ts +11 -0
  36. package/components/app-container/AppContainer.js +117 -0
  37. package/components/app-container/AppContainer.js.map +1 -0
  38. package/components/app-container/context.d.ts +6 -0
  39. package/components/app-container/context.js +6 -0
  40. package/components/app-container/context.js.map +1 -0
  41. package/components/app-container/styles.js +30 -0
  42. package/components/app-container/styles.js.map +1 -0
  43. package/components/app-container/types.d.ts +51 -0
  44. package/components/app-content/AppContent.d.ts +9 -0
  45. package/components/app-content/AppContent.js +42 -0
  46. package/components/app-content/AppContent.js.map +1 -0
  47. package/components/app-content/styles.js +54 -0
  48. package/components/app-content/styles.js.map +1 -0
  49. package/components/app-content/types.d.ts +19 -0
  50. package/components/app-side-panel/AppSidePanel.d.ts +9 -0
  51. package/components/app-side-panel/AppSidePanel.js +86 -0
  52. package/components/app-side-panel/AppSidePanel.js.map +1 -0
  53. package/components/app-side-panel/intl/en-US.json.js +9 -0
  54. package/components/app-side-panel/intl/en-US.json.js.map +1 -0
  55. package/components/app-side-panel/intl/fr-FR.json.js +9 -0
  56. package/components/app-side-panel/intl/fr-FR.json.js.map +1 -0
  57. package/components/app-side-panel/intl/index.js +10 -0
  58. package/components/app-side-panel/intl/index.js.map +1 -0
  59. package/components/app-side-panel/styles.js +183 -0
  60. package/components/app-side-panel/styles.js.map +1 -0
  61. package/components/app-side-panel/types.d.ts +39 -0
  62. package/components/app-side-panel/types.js +15 -0
  63. package/components/app-side-panel/types.js.map +1 -0
  64. package/components/app-side-panel/useAppSidePanel.d.ts +6 -0
  65. package/components/app-side-panel/useAppSidePanel.js +23 -0
  66. package/components/app-side-panel/useAppSidePanel.js.map +1 -0
  67. package/components/badge/Badge.d.ts +9 -0
  68. package/components/badge/Badge.js +44 -0
  69. package/components/badge/Badge.js.map +1 -0
  70. package/components/badge/styles.js +93 -0
  71. package/components/badge/styles.js.map +1 -0
  72. package/components/badge/types.d.ts +37 -0
  73. package/components/badge/types.js +14 -0
  74. package/components/badge/types.js.map +1 -0
  75. package/components/breadcrumb-item/BreadcrumbItem.d.ts +9 -0
  76. package/components/breadcrumb-item/BreadcrumbItem.js +47 -0
  77. package/components/breadcrumb-item/BreadcrumbItem.js.map +1 -0
  78. package/components/breadcrumb-item/styles.js +48 -0
  79. package/components/breadcrumb-item/styles.js.map +1 -0
  80. package/components/breadcrumb-item/types.d.ts +23 -0
  81. package/components/breadcrumbs/Breadcrumbs.d.ts +13 -0
  82. package/components/breadcrumbs/Breadcrumbs.js +61 -0
  83. package/components/breadcrumbs/Breadcrumbs.js.map +1 -0
  84. package/components/breadcrumbs/styles.js +38 -0
  85. package/components/breadcrumbs/styles.js.map +1 -0
  86. package/components/breadcrumbs/types.d.ts +19 -0
  87. package/components/button/Button.d.ts +13 -0
  88. package/components/button/Button.js +92 -0
  89. package/components/button/Button.js.map +1 -0
  90. package/components/button/styles.d.ts +20 -0
  91. package/components/button/styles.js +219 -0
  92. package/components/button/styles.js.map +1 -0
  93. package/components/button/types.d.ts +67 -0
  94. package/components/button/types.js +19 -0
  95. package/components/button/types.js.map +1 -0
  96. package/components/button-group/ButtonGroup.d.ts +9 -0
  97. package/components/button-group/ButtonGroup.js +67 -0
  98. package/components/button-group/ButtonGroup.js.map +1 -0
  99. package/components/button-group/styles.js +103 -0
  100. package/components/button-group/styles.js.map +1 -0
  101. package/components/button-group/types.d.ts +36 -0
  102. package/components/button-group/types.js +19 -0
  103. package/components/button-group/types.js.map +1 -0
  104. package/components/button-link/ButtonLink.d.ts +13 -0
  105. package/components/button-link/ButtonLink.js +85 -0
  106. package/components/button-link/ButtonLink.js.map +1 -0
  107. package/components/button-link/types.d.ts +18 -0
  108. package/components/card/Card.d.ts +13 -0
  109. package/components/card/Card.js +81 -0
  110. package/components/card/Card.js.map +1 -0
  111. package/components/card/intl/en-US.json.js +9 -0
  112. package/components/card/intl/en-US.json.js.map +1 -0
  113. package/components/card/intl/fr-FR.json.js +9 -0
  114. package/components/card/intl/fr-FR.json.js.map +1 -0
  115. package/components/card/intl/index.js +10 -0
  116. package/components/card/intl/index.js.map +1 -0
  117. package/components/card/styles.js +63 -0
  118. package/components/card/styles.js.map +1 -0
  119. package/components/card/types.d.ts +25 -0
  120. package/components/card-actions/CardActions.d.ts +9 -0
  121. package/components/card-actions/CardActions.js +33 -0
  122. package/components/card-actions/CardActions.js.map +1 -0
  123. package/components/card-actions/styles.js +15 -0
  124. package/components/card-actions/styles.js.map +1 -0
  125. package/components/card-actions/types.d.ts +11 -0
  126. package/components/card-body/CardBody.d.ts +9 -0
  127. package/components/card-body/CardBody.js +28 -0
  128. package/components/card-body/CardBody.js.map +1 -0
  129. package/components/card-body/styles.js +18 -0
  130. package/components/card-body/styles.js.map +1 -0
  131. package/components/card-body/types.d.ts +11 -0
  132. package/components/card-header/CardHeader.d.ts +9 -0
  133. package/components/card-header/CardHeader.js +56 -0
  134. package/components/card-header/CardHeader.js.map +1 -0
  135. package/components/card-header/styles.js +31 -0
  136. package/components/card-header/styles.js.map +1 -0
  137. package/components/card-header/types.d.ts +28 -0
  138. package/components/checkbox/Checkbox.d.ts +11 -0
  139. package/components/checkbox/Checkbox.js +135 -0
  140. package/components/checkbox/Checkbox.js.map +1 -0
  141. package/components/checkbox/styles.js +113 -0
  142. package/components/checkbox/styles.js.map +1 -0
  143. package/components/checkbox/types.d.ts +60 -0
  144. package/components/checkbox-group/CheckboxGroup.d.ts +10 -0
  145. package/components/checkbox-group/CheckboxGroup.js +101 -0
  146. package/components/checkbox-group/CheckboxGroup.js.map +1 -0
  147. package/components/checkbox-group/context.js +6 -0
  148. package/components/checkbox-group/context.js.map +1 -0
  149. package/components/checkbox-group/styles.js +78 -0
  150. package/components/checkbox-group/styles.js.map +1 -0
  151. package/components/checkbox-group/types.d.ts +72 -0
  152. package/components/checkbox-group/types.js +18 -0
  153. package/components/checkbox-group/types.js.map +1 -0
  154. package/components/conditional-wrapper/ConditionalWrapper.d.ts +6 -0
  155. package/components/conditional-wrapper/ConditionalWrapper.js +13 -0
  156. package/components/conditional-wrapper/ConditionalWrapper.js.map +1 -0
  157. package/components/conditional-wrapper/types.d.ts +10 -0
  158. package/components/detailed-card/DetailedCard.d.ts +15 -0
  159. package/components/detailed-card/DetailedCard.js +170 -0
  160. package/components/detailed-card/DetailedCard.js.map +1 -0
  161. package/components/detailed-card/intl/en-US.json.js +7 -0
  162. package/components/detailed-card/intl/en-US.json.js.map +1 -0
  163. package/components/detailed-card/intl/fr-FR.json.js +7 -0
  164. package/components/detailed-card/intl/fr-FR.json.js.map +1 -0
  165. package/components/detailed-card/intl/index.js +10 -0
  166. package/components/detailed-card/intl/index.js.map +1 -0
  167. package/components/detailed-card/styles.js +49 -0
  168. package/components/detailed-card/styles.js.map +1 -0
  169. package/components/detailed-card/types.d.ts +40 -0
  170. package/components/detailed-card-collapsible-section-items/DetailedCardCollapsibleSectionItems.d.ts +9 -0
  171. package/components/detailed-card-collapsible-section-items/DetailedCardCollapsibleSectionItems.js +33 -0
  172. package/components/detailed-card-collapsible-section-items/DetailedCardCollapsibleSectionItems.js.map +1 -0
  173. package/components/detailed-card-collapsible-section-items/styles.js +35 -0
  174. package/components/detailed-card-collapsible-section-items/styles.js.map +1 -0
  175. package/components/detailed-card-collapsible-section-items/types.d.ts +16 -0
  176. package/components/detailed-card-header/DetailedCardHeader.d.ts +9 -0
  177. package/components/detailed-card-header/DetailedCardHeader.js +45 -0
  178. package/components/detailed-card-header/DetailedCardHeader.js.map +1 -0
  179. package/components/detailed-card-header/styles.js +26 -0
  180. package/components/detailed-card-header/styles.js.map +1 -0
  181. package/components/detailed-card-header/types.d.ts +20 -0
  182. package/components/detailed-card-section/DetailedCardSection.d.ts +9 -0
  183. package/components/detailed-card-section/DetailedCardSection.js +90 -0
  184. package/components/detailed-card-section/DetailedCardSection.js.map +1 -0
  185. package/components/detailed-card-section/intl/en-US.json.js +9 -0
  186. package/components/detailed-card-section/intl/en-US.json.js.map +1 -0
  187. package/components/detailed-card-section/intl/fr-FR.json.js +9 -0
  188. package/components/detailed-card-section/intl/fr-FR.json.js.map +1 -0
  189. package/components/detailed-card-section/intl/index.js +10 -0
  190. package/components/detailed-card-section/intl/index.js.map +1 -0
  191. package/components/detailed-card-section/styles.js +69 -0
  192. package/components/detailed-card-section/styles.js.map +1 -0
  193. package/components/detailed-card-section/types.d.ts +27 -0
  194. package/components/detailed-card-section-item/DetailedCardSectionItem.d.ts +9 -0
  195. package/components/detailed-card-section-item/DetailedCardSectionItem.js +64 -0
  196. package/components/detailed-card-section-item/DetailedCardSectionItem.js.map +1 -0
  197. package/components/detailed-card-section-item/styles.js +34 -0
  198. package/components/detailed-card-section-item/styles.js.map +1 -0
  199. package/components/detailed-card-section-item/types.d.ts +35 -0
  200. package/components/flexbox/Flexbox.d.ts +9 -0
  201. package/components/flexbox/Flexbox.js +44 -0
  202. package/components/flexbox/Flexbox.js.map +1 -0
  203. package/components/flexbox/styles.js +54 -0
  204. package/components/flexbox/styles.js.map +1 -0
  205. package/components/flexbox/types.d.ts +24 -0
  206. package/components/focus-within-group/FocusWithinGroup.d.ts +41 -0
  207. package/components/focus-within-group/FocusWithinGroup.js +91 -0
  208. package/components/focus-within-group/FocusWithinGroup.js.map +1 -0
  209. package/components/focus-within-group/context.d.ts +7 -0
  210. package/components/focus-within-group/context.js +21 -0
  211. package/components/focus-within-group/context.js.map +1 -0
  212. package/components/focus-within-group/reducer.d.ts +5 -0
  213. package/components/focus-within-group/reducer.js +419 -0
  214. package/components/focus-within-group/reducer.js.map +1 -0
  215. package/components/focus-within-group/types.d.ts +143 -0
  216. package/components/focus-within-group/types.js +42 -0
  217. package/components/focus-within-group/types.js.map +1 -0
  218. package/components/focus-within-group/useFocusOnList.d.ts +5 -0
  219. package/components/focus-within-group/useFocusOnList.js +44 -0
  220. package/components/focus-within-group/useFocusOnList.js.map +1 -0
  221. package/components/focus-within-group/useFocusOnListItem.d.ts +39 -0
  222. package/components/focus-within-group/useFocusOnListItem.js +148 -0
  223. package/components/focus-within-group/useFocusOnListItem.js.map +1 -0
  224. package/components/gradient-border/index.d.ts +14 -0
  225. package/components/gradient-border/index.js +38 -0
  226. package/components/gradient-border/index.js.map +1 -0
  227. package/components/grid/Grid.d.ts +13 -0
  228. package/components/grid/Grid.js +45 -0
  229. package/components/grid/Grid.js.map +1 -0
  230. package/components/grid/styles.js +55 -0
  231. package/components/grid/styles.js.map +1 -0
  232. package/components/grid/types.d.ts +22 -0
  233. package/components/grid-item/GridItem.d.ts +9 -0
  234. package/components/grid-item/GridItem.js +28 -0
  235. package/components/grid-item/GridItem.js.map +1 -0
  236. package/components/grid-item/styles.js +16 -0
  237. package/components/grid-item/styles.js.map +1 -0
  238. package/components/grid-item/types.d.ts +11 -0
  239. package/components/heading/Heading.d.ts +9 -0
  240. package/components/heading/Heading.js +50 -0
  241. package/components/heading/Heading.js.map +1 -0
  242. package/components/heading/styles.js +67 -0
  243. package/components/heading/styles.js.map +1 -0
  244. package/components/heading/types.d.ts +62 -0
  245. package/components/heading/types.js +26 -0
  246. package/components/heading/types.js.map +1 -0
  247. package/components/icon/Icon.d.ts +10 -0
  248. package/components/icon/Icon.js +116 -0
  249. package/components/icon/Icon.js.map +1 -0
  250. package/components/icon/styles.js +84 -0
  251. package/components/icon/styles.js.map +1 -0
  252. package/components/icon/types.d.ts +57 -0
  253. package/components/icon/types.js +18 -0
  254. package/components/icon/types.js.map +1 -0
  255. package/components/icon-button/IconButton.d.ts +12 -0
  256. package/components/icon-button/IconButton.js +81 -0
  257. package/components/icon-button/IconButton.js.map +1 -0
  258. package/components/icon-button/styles.js +31 -0
  259. package/components/icon-button/styles.js.map +1 -0
  260. package/components/icon-button/types.d.ts +56 -0
  261. package/components/icon-button/types.js +19 -0
  262. package/components/icon-button/types.js.map +1 -0
  263. package/components/icon-button-link/IconButtonLink.d.ts +13 -0
  264. package/components/icon-button-link/IconButtonLink.js +76 -0
  265. package/components/icon-button-link/IconButtonLink.js.map +1 -0
  266. package/components/icon-button-link/types.d.ts +18 -0
  267. package/components/item/Item.d.ts +10 -0
  268. package/components/item/Item.js +225 -0
  269. package/components/item/Item.js.map +1 -0
  270. package/components/item/styles.d.ts +20 -0
  271. package/components/item/styles.js +129 -0
  272. package/components/item/styles.js.map +1 -0
  273. package/components/item/types.d.ts +59 -0
  274. package/components/item/useMenuItem.js +55 -0
  275. package/components/item/useMenuItem.js.map +1 -0
  276. package/components/link/Link.d.ts +14 -0
  277. package/components/link/Link.js +67 -0
  278. package/components/link/Link.js.map +1 -0
  279. package/components/link/styles.d.ts +15 -0
  280. package/components/link/styles.js +145 -0
  281. package/components/link/styles.js.map +1 -0
  282. package/components/link/types.d.ts +40 -0
  283. package/components/link-button/LinkButton.d.ts +13 -0
  284. package/components/link-button/LinkButton.js +66 -0
  285. package/components/link-button/LinkButton.js.map +1 -0
  286. package/components/link-button/types.d.ts +13 -0
  287. package/components/listbox/ActiveDescendantListbox.d.ts +8 -0
  288. package/components/listbox/ActiveDescendantListbox.js +74 -0
  289. package/components/listbox/ActiveDescendantListbox.js.map +1 -0
  290. package/components/listbox/Listbox.d.ts +10 -0
  291. package/components/listbox/Listbox.js +110 -0
  292. package/components/listbox/Listbox.js.map +1 -0
  293. package/components/listbox/RovingTabindexListbox.d.ts +8 -0
  294. package/components/listbox/RovingTabindexListbox.js +30 -0
  295. package/components/listbox/RovingTabindexListbox.js.map +1 -0
  296. package/components/listbox/context.d.ts +7 -0
  297. package/components/listbox/context.js +15 -0
  298. package/components/listbox/context.js.map +1 -0
  299. package/components/listbox/reducer.d.ts +5 -0
  300. package/components/listbox/reducer.js +45 -0
  301. package/components/listbox/reducer.js.map +1 -0
  302. package/components/listbox/styles.js +44 -0
  303. package/components/listbox/styles.js.map +1 -0
  304. package/components/listbox/types.d.ts +101 -0
  305. package/components/listbox/types.js +32 -0
  306. package/components/listbox/types.js.map +1 -0
  307. package/components/listbox/useListboxItem.d.ts +12 -0
  308. package/components/listbox/useListboxItem.js +90 -0
  309. package/components/listbox/useListboxItem.js.map +1 -0
  310. package/components/number/Number.d.ts +9 -0
  311. package/components/number/Number.js +105 -0
  312. package/components/number/Number.js.map +1 -0
  313. package/components/number/styles.js +10 -0
  314. package/components/number/styles.js.map +1 -0
  315. package/components/number/types.d.ts +63 -0
  316. package/components/number-field/NumberField.d.ts +10 -0
  317. package/components/number-field/NumberField.js +216 -0
  318. package/components/number-field/NumberField.js.map +1 -0
  319. package/components/number-field/styles.js +240 -0
  320. package/components/number-field/styles.js.map +1 -0
  321. package/components/number-field/types.d.ts +74 -0
  322. package/components/number-field/types.js +14 -0
  323. package/components/number-field/types.js.map +1 -0
  324. package/components/pill/Pill.d.ts +9 -0
  325. package/components/pill/Pill.js +93 -0
  326. package/components/pill/Pill.js.map +1 -0
  327. package/components/pill/styles.js +305 -0
  328. package/components/pill/styles.js.map +1 -0
  329. package/components/pill/types.d.ts +47 -0
  330. package/components/pill/types.js +15 -0
  331. package/components/pill/types.js.map +1 -0
  332. package/components/progress-bar/ProgressBar.d.ts +9 -0
  333. package/components/progress-bar/ProgressBar.js +35 -0
  334. package/components/progress-bar/ProgressBar.js.map +1 -0
  335. package/components/progress-bar/styles.js +38 -0
  336. package/components/progress-bar/styles.js.map +1 -0
  337. package/components/progress-bar/types.d.ts +20 -0
  338. package/components/radio/Radio.d.ts +11 -0
  339. package/components/radio/Radio.js +128 -0
  340. package/components/radio/Radio.js.map +1 -0
  341. package/components/radio/styles.js +113 -0
  342. package/components/radio/styles.js.map +1 -0
  343. package/components/radio/types.d.ts +58 -0
  344. package/components/radio-group/RadioGroup.d.ts +10 -0
  345. package/components/radio-group/RadioGroup.js +89 -0
  346. package/components/radio-group/RadioGroup.js.map +1 -0
  347. package/components/radio-group/context.js +6 -0
  348. package/components/radio-group/context.js.map +1 -0
  349. package/components/radio-group/styles.js +78 -0
  350. package/components/radio-group/styles.js.map +1 -0
  351. package/components/radio-group/types.d.ts +68 -0
  352. package/components/radio-group/types.js +18 -0
  353. package/components/radio-group/types.js.map +1 -0
  354. package/components/shared/styles.d.ts +17 -0
  355. package/components/shared/styles.js +250 -0
  356. package/components/shared/styles.js.map +1 -0
  357. package/components/shield/Shield.d.ts +9 -0
  358. package/components/shield/Shield.js +136 -0
  359. package/components/shield/Shield.js.map +1 -0
  360. package/components/shield/styles.js +71 -0
  361. package/components/shield/styles.js.map +1 -0
  362. package/components/shield/types.d.ts +52 -0
  363. package/components/shield/types.js +25 -0
  364. package/components/shield/types.js.map +1 -0
  365. package/components/side-navigation-menu/SideNavigationMenu.d.ts +9 -0
  366. package/components/side-navigation-menu/SideNavigationMenu.js +367 -0
  367. package/components/side-navigation-menu/SideNavigationMenu.js.map +1 -0
  368. package/components/side-navigation-menu/context.js +6 -0
  369. package/components/side-navigation-menu/context.js.map +1 -0
  370. package/components/side-navigation-menu/reducer.js +26 -0
  371. package/components/side-navigation-menu/reducer.js.map +1 -0
  372. package/components/side-navigation-menu/styles.js +196 -0
  373. package/components/side-navigation-menu/styles.js.map +1 -0
  374. package/components/side-navigation-menu/types.d.ts +72 -0
  375. package/components/side-navigation-menu/types.js +21 -0
  376. package/components/side-navigation-menu/types.js.map +1 -0
  377. package/components/side-navigation-menu-bar/SideNavigationMenuBar.d.ts +9 -0
  378. package/components/side-navigation-menu-bar/SideNavigationMenuBar.js +217 -0
  379. package/components/side-navigation-menu-bar/SideNavigationMenuBar.js.map +1 -0
  380. package/components/side-navigation-menu-bar/context.js +6 -0
  381. package/components/side-navigation-menu-bar/context.js.map +1 -0
  382. package/components/side-navigation-menu-bar/styles.js +89 -0
  383. package/components/side-navigation-menu-bar/styles.js.map +1 -0
  384. package/components/side-navigation-menu-bar/types.d.ts +65 -0
  385. package/components/side-navigation-menu-bar/types.js +22 -0
  386. package/components/side-navigation-menu-bar/types.js.map +1 -0
  387. package/components/side-navigation-menu-bar/useSideNavigationMenuBar.d.ts +9 -0
  388. package/components/side-navigation-menu-bar/useSideNavigationMenuBar.js +70 -0
  389. package/components/side-navigation-menu-bar/useSideNavigationMenuBar.js.map +1 -0
  390. package/components/side-navigation-menu-item/SideNavigationMenuItem.d.ts +9 -0
  391. package/components/side-navigation-menu-item/SideNavigationMenuItem.js +115 -0
  392. package/components/side-navigation-menu-item/SideNavigationMenuItem.js.map +1 -0
  393. package/components/side-navigation-menu-item/styles.js +174 -0
  394. package/components/side-navigation-menu-item/styles.js.map +1 -0
  395. package/components/side-navigation-menu-item/types.d.ts +51 -0
  396. package/components/skeleton/Skeleton.d.ts +15 -0
  397. package/components/skeleton/Skeleton.js +42 -0
  398. package/components/skeleton/Skeleton.js.map +1 -0
  399. package/components/skeleton/styles.js +84 -0
  400. package/components/skeleton/styles.js.map +1 -0
  401. package/components/skeleton/types.d.ts +18 -0
  402. package/components/skeleton-circle/SkeletonCircle.d.ts +9 -0
  403. package/components/skeleton-circle/SkeletonCircle.js +36 -0
  404. package/components/skeleton-circle/SkeletonCircle.js.map +1 -0
  405. package/components/skeleton-circle/styles.js +26 -0
  406. package/components/skeleton-circle/styles.js.map +1 -0
  407. package/components/skeleton-circle/types.d.ts +12 -0
  408. package/components/skeleton-text/SkeletonText.d.ts +9 -0
  409. package/components/skeleton-text/SkeletonText.js +42 -0
  410. package/components/skeleton-text/SkeletonText.js.map +1 -0
  411. package/components/skeleton-text/styles.js +39 -0
  412. package/components/skeleton-text/styles.js.map +1 -0
  413. package/components/skeleton-text/types.d.ts +36 -0
  414. package/components/skeleton-text/types.js +20 -0
  415. package/components/skeleton-text/types.js.map +1 -0
  416. package/components/spinner/Spinner.d.ts +9 -0
  417. package/components/spinner/Spinner.js +82 -0
  418. package/components/spinner/Spinner.js.map +1 -0
  419. package/components/spinner/images/spinner-grey-l1.svg.js +4 -0
  420. package/components/spinner/images/spinner-grey-l1.svg.js.map +1 -0
  421. package/components/spinner/images/spinner-grey-l2.svg.js +4 -0
  422. package/components/spinner/images/spinner-grey-l2.svg.js.map +1 -0
  423. package/components/spinner/images/spinner-grey-l3.svg.js +4 -0
  424. package/components/spinner/images/spinner-grey-l3.svg.js.map +1 -0
  425. package/components/spinner/images/spinner-primary-n.svg.js +4 -0
  426. package/components/spinner/images/spinner-primary-n.svg.js.map +1 -0
  427. package/components/spinner/intl/en-US.json.js +7 -0
  428. package/components/spinner/intl/en-US.json.js.map +1 -0
  429. package/components/spinner/intl/fr-FR.json.js +7 -0
  430. package/components/spinner/intl/fr-FR.json.js.map +1 -0
  431. package/components/spinner/intl/index.js +10 -0
  432. package/components/spinner/intl/index.js.map +1 -0
  433. package/components/spinner/styles.js +13 -0
  434. package/components/spinner/styles.js.map +1 -0
  435. package/components/spinner/types.d.ts +38 -0
  436. package/components/spinner/types.js +16 -0
  437. package/components/spinner/types.js.map +1 -0
  438. package/components/switch/Switch.d.ts +11 -0
  439. package/components/switch/Switch.js +137 -0
  440. package/components/switch/Switch.js.map +1 -0
  441. package/components/switch/styles.js +187 -0
  442. package/components/switch/styles.js.map +1 -0
  443. package/components/switch/types.d.ts +58 -0
  444. package/components/switch-group/SwitchGroup.d.ts +10 -0
  445. package/components/switch-group/SwitchGroup.js +101 -0
  446. package/components/switch-group/SwitchGroup.js.map +1 -0
  447. package/components/switch-group/context.js +6 -0
  448. package/components/switch-group/context.js.map +1 -0
  449. package/components/switch-group/styles.js +78 -0
  450. package/components/switch-group/styles.js.map +1 -0
  451. package/components/switch-group/types.d.ts +72 -0
  452. package/components/switch-group/types.js +18 -0
  453. package/components/switch-group/types.js.map +1 -0
  454. package/components/text/Text.d.ts +9 -0
  455. package/components/text/Text.js +51 -0
  456. package/components/text/Text.js.map +1 -0
  457. package/components/text/styles.js +112 -0
  458. package/components/text/styles.js.map +1 -0
  459. package/components/text/types.d.ts +73 -0
  460. package/components/text/types.js +34 -0
  461. package/components/text/types.js.map +1 -0
  462. package/components/text-area/TextArea.d.ts +10 -0
  463. package/components/text-area/TextArea.js +165 -0
  464. package/components/text-area/TextArea.js.map +1 -0
  465. package/components/text-area/styles.js +240 -0
  466. package/components/text-area/styles.js.map +1 -0
  467. package/components/text-area/types.d.ts +28 -0
  468. package/components/text-area/types.js +14 -0
  469. package/components/text-area/types.js.map +1 -0
  470. package/components/text-field/TextField.d.ts +10 -0
  471. package/components/text-field/TextField.js +197 -0
  472. package/components/text-field/TextField.js.map +1 -0
  473. package/components/text-field/intl/en-US.json.js +8 -0
  474. package/components/text-field/intl/en-US.json.js.map +1 -0
  475. package/components/text-field/intl/fr-FR.json.js +8 -0
  476. package/components/text-field/intl/fr-FR.json.js.map +1 -0
  477. package/components/text-field/intl/index.js +10 -0
  478. package/components/text-field/intl/index.js.map +1 -0
  479. package/components/text-field/styles.d.ts +22 -0
  480. package/components/text-field/styles.js +252 -0
  481. package/components/text-field/styles.js.map +1 -0
  482. package/components/text-field/types.d.ts +99 -0
  483. package/components/text-field/types.js +18 -0
  484. package/components/text-field/types.js.map +1 -0
  485. package/components/theme/context.d.ts +11 -0
  486. package/components/theme/context.js +7 -0
  487. package/components/theme/context.js.map +1 -0
  488. package/components/theme/useTheme.d.ts +5 -0
  489. package/components/theme/useTheme.js +13 -0
  490. package/components/theme/useTheme.js.map +1 -0
  491. package/hooks/useBoundingRect.d.ts +8 -0
  492. package/hooks/useBoundingRect.js +17 -0
  493. package/hooks/useBoundingRect.js.map +1 -0
  494. package/hooks/useComputeNumberOfRows.d.ts +15 -0
  495. package/hooks/useComputeNumberOfRows.js +40 -0
  496. package/hooks/useComputeNumberOfRows.js.map +1 -0
  497. package/hooks/useIsLoaded.d.ts +5 -0
  498. package/hooks/useIsLoaded.js +14 -0
  499. package/hooks/useIsLoaded.js.map +1 -0
  500. package/hooks/useWindowSize.d.ts +8 -0
  501. package/hooks/useWindowSize.js +42 -0
  502. package/hooks/useWindowSize.js.map +1 -0
  503. package/index.d.ts +157 -4667
  504. package/index.js +121 -24514
  505. package/index.js.map +1 -1
  506. package/package.json +4 -3
  507. package/packages/popovers/src/components/tooltip/Tooltip.js +62 -0
  508. package/packages/popovers/src/components/tooltip/Tooltip.js.map +1 -0
  509. package/packages/popovers/src/components/tooltip/context.js +6 -0
  510. package/packages/popovers/src/components/tooltip/context.js.map +1 -0
  511. package/packages/popovers/src/components/tooltip/types.js +28 -0
  512. package/packages/popovers/src/components/tooltip/types.js.map +1 -0
  513. package/packages/popovers/src/components/tooltip/useTooltip.js +78 -0
  514. package/packages/popovers/src/components/tooltip/useTooltip.js.map +1 -0
  515. package/packages/popovers/src/components/tooltip/useTooltipContext.js +13 -0
  516. package/packages/popovers/src/components/tooltip/useTooltipContext.js.map +1 -0
  517. package/packages/popovers/src/components/tooltip-content/TooltipContent.js +80 -0
  518. package/packages/popovers/src/components/tooltip-content/TooltipContent.js.map +1 -0
  519. package/packages/popovers/src/components/tooltip-content/styles.js +128 -0
  520. package/packages/popovers/src/components/tooltip-content/styles.js.map +1 -0
  521. package/packages/popovers/src/components/tooltip-trigger/TooltipTrigger.js +47 -0
  522. package/packages/popovers/src/components/tooltip-trigger/TooltipTrigger.js.map +1 -0
  523. package/react-aria/internationalized/date/DateFormatter.d.ts +25 -0
  524. package/react-aria/internationalized/date/DateFormatter.js +187 -0
  525. package/react-aria/internationalized/date/DateFormatter.js.map +1 -0
  526. package/react-aria/internationalized/message/MessageDictionary.d.ts +7 -0
  527. package/react-aria/internationalized/message/MessageDictionary.js +82 -0
  528. package/react-aria/internationalized/message/MessageDictionary.js.map +1 -0
  529. package/react-aria/internationalized/message/MessageFormatter.js +38 -0
  530. package/react-aria/internationalized/message/MessageFormatter.js.map +1 -0
  531. package/react-aria/internationalized/number/NumberFormatter.d.ts +6 -0
  532. package/react-aria/internationalized/number/NumberFormatter.js +222 -0
  533. package/react-aria/internationalized/number/NumberFormatter.js.map +1 -0
  534. package/react-aria/internationalized/number/NumberParser.js +288 -0
  535. package/react-aria/internationalized/number/NumberParser.js.map +1 -0
  536. package/react-aria/internationalized/string/LocalizedStringDictionary.d.ts +21 -0
  537. package/react-aria/internationalized/string/LocalizedStringDictionary.js +118 -0
  538. package/react-aria/internationalized/string/LocalizedStringDictionary.js.map +1 -0
  539. package/react-aria/internationalized/string/LocalizedStringFormatter.d.ts +21 -0
  540. package/react-aria/internationalized/string/LocalizedStringFormatter.js +70 -0
  541. package/react-aria/internationalized/string/LocalizedStringFormatter.js.map +1 -0
  542. package/react-aria/react-aria/button/useButton.js +95 -0
  543. package/react-aria/react-aria/button/useButton.js.map +1 -0
  544. package/react-aria/react-aria/focus/focusSafely.js +33 -0
  545. package/react-aria/react-aria/focus/focusSafely.js.map +1 -0
  546. package/react-aria/react-aria/focus/useFocusRing.js +57 -0
  547. package/react-aria/react-aria/focus/useFocusRing.js.map +1 -0
  548. package/react-aria/react-aria/focus/useFocusable.js +47 -0
  549. package/react-aria/react-aria/focus/useFocusable.js.map +1 -0
  550. package/react-aria/react-aria/form/useFormValidation.js +112 -0
  551. package/react-aria/react-aria/form/useFormValidation.js.map +1 -0
  552. package/react-aria/react-aria/i18n/context.d.ts +19 -0
  553. package/react-aria/react-aria/i18n/context.js +41 -0
  554. package/react-aria/react-aria/i18n/context.js.map +1 -0
  555. package/react-aria/react-aria/i18n/useCollator.d.ts +8 -0
  556. package/react-aria/react-aria/i18n/useCollator.js +25 -0
  557. package/react-aria/react-aria/i18n/useCollator.js.map +1 -0
  558. package/react-aria/react-aria/i18n/useDateFormatter.d.ts +13 -0
  559. package/react-aria/react-aria/i18n/useDateFormatter.js +39 -0
  560. package/react-aria/react-aria/i18n/useDateFormatter.js.map +1 -0
  561. package/react-aria/react-aria/i18n/useDefaultLocale.d.ts +10 -0
  562. package/react-aria/react-aria/i18n/useDefaultLocale.js +67 -0
  563. package/react-aria/react-aria/i18n/useDefaultLocale.js.map +1 -0
  564. package/react-aria/react-aria/i18n/useFilter.d.ts +15 -0
  565. package/react-aria/react-aria/i18n/useFilter.js +58 -0
  566. package/react-aria/react-aria/i18n/useFilter.js.map +1 -0
  567. package/react-aria/react-aria/i18n/useListFormatter.d.ts +8 -0
  568. package/react-aria/react-aria/i18n/useListFormatter.js +20 -0
  569. package/react-aria/react-aria/i18n/useListFormatter.js.map +1 -0
  570. package/react-aria/react-aria/i18n/useLocalizedStringFormatter.d.ts +15 -0
  571. package/react-aria/react-aria/i18n/useLocalizedStringFormatter.js +38 -0
  572. package/react-aria/react-aria/i18n/useLocalizedStringFormatter.js.map +1 -0
  573. package/react-aria/react-aria/i18n/useMessageFormatter.d.ts +13 -0
  574. package/react-aria/react-aria/i18n/useMessageFormatter.js +32 -0
  575. package/react-aria/react-aria/i18n/useMessageFormatter.js.map +1 -0
  576. package/react-aria/react-aria/i18n/useNumberFormatter.d.ts +10 -0
  577. package/react-aria/react-aria/i18n/useNumberFormatter.js +21 -0
  578. package/react-aria/react-aria/i18n/useNumberFormatter.js.map +1 -0
  579. package/react-aria/react-aria/i18n/utils.js +49 -0
  580. package/react-aria/react-aria/i18n/utils.js.map +1 -0
  581. package/react-aria/react-aria/interactions/context.js +20 -0
  582. package/react-aria/react-aria/interactions/context.js.map +1 -0
  583. package/react-aria/react-aria/interactions/createEventHandler.js +48 -0
  584. package/react-aria/react-aria/interactions/createEventHandler.js.map +1 -0
  585. package/react-aria/react-aria/interactions/textSelection.js +85 -0
  586. package/react-aria/react-aria/interactions/textSelection.js.map +1 -0
  587. package/react-aria/react-aria/interactions/useFocus.js +53 -0
  588. package/react-aria/react-aria/interactions/useFocus.js.map +1 -0
  589. package/react-aria/react-aria/interactions/useFocusVisible.js +236 -0
  590. package/react-aria/react-aria/interactions/useFocusVisible.js.map +1 -0
  591. package/react-aria/react-aria/interactions/useFocusWithin.js +65 -0
  592. package/react-aria/react-aria/interactions/useFocusWithin.js.map +1 -0
  593. package/react-aria/react-aria/interactions/useKeyboard.js +27 -0
  594. package/react-aria/react-aria/interactions/useKeyboard.js.map +1 -0
  595. package/react-aria/react-aria/interactions/usePress.js +769 -0
  596. package/react-aria/react-aria/interactions/usePress.js.map +1 -0
  597. package/react-aria/react-aria/interactions/useScrollWheel.js +31 -0
  598. package/react-aria/react-aria/interactions/useScrollWheel.js.map +1 -0
  599. package/react-aria/react-aria/interactions/utils.js +116 -0
  600. package/react-aria/react-aria/interactions/utils.js.map +1 -0
  601. package/react-aria/react-aria/label/useField.js +42 -0
  602. package/react-aria/react-aria/label/useField.js.map +1 -0
  603. package/react-aria/react-aria/label/useLabel.js +42 -0
  604. package/react-aria/react-aria/label/useLabel.js.map +1 -0
  605. package/react-aria/react-aria/live-announcer/LiveAnnouncer.js +121 -0
  606. package/react-aria/react-aria/live-announcer/LiveAnnouncer.js.map +1 -0
  607. package/react-aria/react-aria/numberfield/intl/en-US.json.js +11 -0
  608. package/react-aria/react-aria/numberfield/intl/en-US.json.js.map +1 -0
  609. package/react-aria/react-aria/numberfield/intl/fr-FR.json.js +11 -0
  610. package/react-aria/react-aria/numberfield/intl/fr-FR.json.js.map +1 -0
  611. package/react-aria/react-aria/numberfield/intl/index.js +10 -0
  612. package/react-aria/react-aria/numberfield/intl/index.js.map +1 -0
  613. package/react-aria/react-aria/numberfield/useNumberField.js +294 -0
  614. package/react-aria/react-aria/numberfield/useNumberField.js.map +1 -0
  615. package/react-aria/react-aria/spinbutton/intl/en-US.json.js +7 -0
  616. package/react-aria/react-aria/spinbutton/intl/en-US.json.js.map +1 -0
  617. package/react-aria/react-aria/spinbutton/intl/fr-FR.json.js +7 -0
  618. package/react-aria/react-aria/spinbutton/intl/fr-FR.json.js.map +1 -0
  619. package/react-aria/react-aria/spinbutton/intl/index.js +10 -0
  620. package/react-aria/react-aria/spinbutton/intl/index.js.map +1 -0
  621. package/react-aria/react-aria/spinbutton/useSpinButton.js +168 -0
  622. package/react-aria/react-aria/spinbutton/useSpinButton.js.map +1 -0
  623. package/react-aria/react-aria/ssr/SSRProvider.d.ts +22 -0
  624. package/react-aria/react-aria/ssr/SSRProvider.js +157 -0
  625. package/react-aria/react-aria/ssr/SSRProvider.js.map +1 -0
  626. package/react-aria/react-aria/textfield/useFormattedTextField.js +142 -0
  627. package/react-aria/react-aria/textfield/useFormattedTextField.js.map +1 -0
  628. package/react-aria/react-aria/textfield/useTextField.js +156 -0
  629. package/react-aria/react-aria/textfield/useTextField.js.map +1 -0
  630. package/react-aria/react-aria/utils/chain.js +33 -0
  631. package/react-aria/react-aria/utils/chain.js.map +1 -0
  632. package/react-aria/react-aria/utils/domHelpers.js +14 -0
  633. package/react-aria/react-aria/utils/domHelpers.js.map +1 -0
  634. package/react-aria/react-aria/utils/filterDOMProps.js +45 -0
  635. package/react-aria/react-aria/utils/filterDOMProps.js.map +1 -0
  636. package/react-aria/react-aria/utils/focusWithoutScrolling.js +88 -0
  637. package/react-aria/react-aria/utils/focusWithoutScrolling.js.map +1 -0
  638. package/react-aria/react-aria/utils/isVirtualEvent.js +51 -0
  639. package/react-aria/react-aria/utils/isVirtualEvent.js.map +1 -0
  640. package/react-aria/react-aria/utils/mergeProps.js +48 -0
  641. package/react-aria/react-aria/utils/mergeProps.js.map +1 -0
  642. package/react-aria/react-aria/utils/openLink.js +55 -0
  643. package/react-aria/react-aria/utils/openLink.js.map +1 -0
  644. package/react-aria/react-aria/utils/platform.js +69 -0
  645. package/react-aria/react-aria/utils/platform.js.map +1 -0
  646. package/react-aria/react-aria/utils/runAfterTransition.js +100 -0
  647. package/react-aria/react-aria/utils/runAfterTransition.js.map +1 -0
  648. package/react-aria/react-aria/utils/useDeepMemo.js +16 -0
  649. package/react-aria/react-aria/utils/useDeepMemo.js.map +1 -0
  650. package/react-aria/react-aria/utils/useEffectEvent.js +31 -0
  651. package/react-aria/react-aria/utils/useEffectEvent.js.map +1 -0
  652. package/react-aria/react-aria/utils/useEvent.js +21 -0
  653. package/react-aria/react-aria/utils/useEvent.js.map +1 -0
  654. package/react-aria/react-aria/utils/useFormReset.js +23 -0
  655. package/react-aria/react-aria/utils/useFormReset.js.map +1 -0
  656. package/react-aria/react-aria/utils/useGlobalListeners.js +44 -0
  657. package/react-aria/react-aria/utils/useGlobalListeners.js.map +1 -0
  658. package/react-aria/react-aria/utils/useId.js +86 -0
  659. package/react-aria/react-aria/utils/useId.js.map +1 -0
  660. package/react-aria/react-aria/utils/useLabels.js +39 -0
  661. package/react-aria/react-aria/utils/useLabels.js.map +1 -0
  662. package/react-aria/react-aria/utils/useLayoutEffect.js +21 -0
  663. package/react-aria/react-aria/utils/useLayoutEffect.js.map +1 -0
  664. package/react-aria/react-aria/utils/useSyncRef.js +29 -0
  665. package/react-aria/react-aria/utils/useSyncRef.js.map +1 -0
  666. package/react-aria/react-aria/utils/useValueEffect.js +52 -0
  667. package/react-aria/react-aria/utils/useValueEffect.js.map +1 -0
  668. package/react-aria/react-stately/form/useFormValidationState.js +191 -0
  669. package/react-aria/react-stately/form/useFormValidationState.js.map +1 -0
  670. package/react-aria/react-stately/numberfield/useNumberFieldState.js +196 -0
  671. package/react-aria/react-stately/numberfield/useNumberFieldState.js.map +1 -0
  672. package/react-aria/react-stately/utils/number.js +56 -0
  673. package/react-aria/react-stately/utils/number.js.map +1 -0
  674. package/react-aria/react-stately/utils/useControlledState.js +68 -0
  675. package/react-aria/react-stately/utils/useControlledState.js.map +1 -0
  676. package/react-aria/react-types/shared/locale.d.ts +3 -0
  677. package/types/colors.d.ts +102 -0
  678. package/types/colors.js +64 -0
  679. package/types/colors.js.map +1 -0
  680. package/types/fonts.d.ts +12 -0
  681. package/types/fonts.js +10 -0
  682. package/types/fonts.js.map +1 -0
  683. package/types/helpers.d.ts +23 -0
  684. package/types/products.d.ts +40 -0
  685. package/types/products.js +38 -0
  686. package/types/products.js.map +1 -0
  687. package/types/styles.d.ts +283 -0
  688. package/types/styles.js +161 -0
  689. package/types/styles.js.map +1 -0
  690. package/utils/filterComponents.d.ts +12 -0
  691. package/utils/filterComponents.js +24 -0
  692. package/utils/filterComponents.js.map +1 -0
  693. package/utils/getTextWidth.d.ts +6 -0
  694. package/utils/getTextWidth.js +32 -0
  695. package/utils/getTextWidth.js.map +1 -0
  696. package/utils/isComponent.d.ts +12 -0
  697. package/utils/isComponent.js +15 -0
  698. package/utils/isComponent.js.map +1 -0
  699. package/utils/partitionComponents.d.ts +10 -0
  700. package/utils/partitionComponents.js +26 -0
  701. package/utils/partitionComponents.js.map +1 -0
  702. package/utils/redsift-design-tokens.d.ts +1389 -0
  703. package/utils/redsift-design-tokens.js +1391 -0
  704. package/utils/redsift-design-tokens.js.map +1 -0
  705. package/utils/useId.d.ts +6 -0
  706. package/utils/useId.js +42 -0
  707. package/utils/useId.js.map +1 -0
  708. package/utils/warnIfNoAccessibleLabelFound.d.ts +11 -0
  709. package/utils/warnIfNoAccessibleLabelFound.js +20 -0
  710. package/utils/warnIfNoAccessibleLabelFound.js.map +1 -0
@@ -0,0 +1,95 @@
1
+ import { usePress } from '../interactions/usePress.js';
2
+ import { useFocusable } from '../focus/useFocusable.js';
3
+ import { mergeProps } from '../utils/mergeProps.js';
4
+ import { filterDOMProps } from '../utils/filterDOMProps.js';
5
+
6
+ /* eslint-disable prefer-const */
7
+
8
+ // Order with overrides is important: 'button' should be default
9
+
10
+ /**
11
+ * Provides the behavior and accessibility implementation for a button component. Handles mouse, keyboard, and touch interactions,
12
+ * focus behavior, and ARIA props for both native button elements and custom element types.
13
+ * @param props - Props to be applied to the button.
14
+ * @param ref - A ref to a DOM element for the button.
15
+ */
16
+ function useButton(props, ref) {
17
+ let {
18
+ elementType = 'button',
19
+ isDisabled,
20
+ onPress,
21
+ onPressStart,
22
+ onPressEnd,
23
+ onPressUp,
24
+ onPressChange,
25
+ // @ts-ignore - undocumented
26
+ preventFocusOnPress,
27
+ // @ts-ignore - undocumented
28
+ allowFocusWhenDisabled,
29
+ // @ts-ignore
30
+ onClick: deprecatedOnClick,
31
+ href,
32
+ target,
33
+ rel,
34
+ type = 'button'
35
+ } = props;
36
+ let additionalProps;
37
+ if (elementType === 'button') {
38
+ additionalProps = {
39
+ type,
40
+ disabled: isDisabled
41
+ };
42
+ } else {
43
+ additionalProps = {
44
+ role: 'button',
45
+ tabIndex: isDisabled ? undefined : 0,
46
+ href: elementType === 'a' && isDisabled ? undefined : href,
47
+ target: elementType === 'a' ? target : undefined,
48
+ type: elementType === 'input' ? type : undefined,
49
+ disabled: elementType === 'input' ? isDisabled : undefined,
50
+ 'aria-disabled': !isDisabled || elementType === 'input' ? undefined : isDisabled,
51
+ rel: elementType === 'a' ? rel : undefined
52
+ };
53
+ }
54
+ let {
55
+ pressProps,
56
+ isPressed
57
+ } = usePress({
58
+ onPressStart,
59
+ onPressEnd,
60
+ onPressChange,
61
+ onPress,
62
+ onPressUp,
63
+ isDisabled,
64
+ preventFocusOnPress,
65
+ ref
66
+ });
67
+ let {
68
+ focusableProps
69
+ } = useFocusable(props, ref);
70
+ if (allowFocusWhenDisabled) {
71
+ focusableProps.tabIndex = isDisabled ? -1 : focusableProps.tabIndex;
72
+ }
73
+ let buttonProps = mergeProps(focusableProps, pressProps, filterDOMProps(props, {
74
+ labelable: true
75
+ }));
76
+ return {
77
+ isPressed,
78
+ // Used to indicate press state for visual
79
+ buttonProps: mergeProps(additionalProps, buttonProps, {
80
+ 'aria-haspopup': props['aria-haspopup'],
81
+ 'aria-expanded': props['aria-expanded'],
82
+ 'aria-controls': props['aria-controls'],
83
+ 'aria-pressed': props['aria-pressed'],
84
+ onClick: e => {
85
+ if (deprecatedOnClick) {
86
+ deprecatedOnClick(e);
87
+ console.warn('onClick is deprecated, please use onPress');
88
+ }
89
+ }
90
+ })
91
+ };
92
+ }
93
+
94
+ export { useButton };
95
+ //# sourceMappingURL=useButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useButton.js","sources":["../../../../src/react-aria/react-aria/button/useButton.ts"],"sourcesContent":["/* eslint-disable prefer-const */\n// @ts-nocheck\n/*\n * Copyright 2020 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 {\n AnchorHTMLAttributes,\n ButtonHTMLAttributes,\n ElementType,\n HTMLAttributes,\n InputHTMLAttributes,\n RefObject,\n} from 'react';\nimport { AriaButtonProps } from '../../react-types/button';\nimport { DOMAttributes } from '../../react-types/shared';\nimport { filterDOMProps, mergeProps } from '../utils';\nimport { useFocusable } from '../focus';\nimport { usePress } from '../interactions';\n\nexport interface AriaButtonOptions<E extends ElementType> extends Omit<AriaButtonProps<E>, 'children'> {}\n\nexport interface ButtonAria<T> {\n /** Props for the button element. */\n buttonProps: T;\n /** Whether the button is currently pressed. */\n isPressed: boolean;\n}\n\n// Order with overrides is important: 'button' should be default\nexport function useButton(\n props: AriaButtonOptions<'button'>,\n ref: RefObject<HTMLButtonElement>\n): ButtonAria<ButtonHTMLAttributes<HTMLButtonElement>>;\nexport function useButton(\n props: AriaButtonOptions<'a'>,\n ref: RefObject<HTMLAnchorElement>\n): ButtonAria<AnchorHTMLAttributes<HTMLAnchorElement>>;\nexport function useButton(\n props: AriaButtonOptions<'div'>,\n ref: RefObject<HTMLDivElement>\n): ButtonAria<HTMLAttributes<HTMLDivElement>>;\nexport function useButton(\n props: AriaButtonOptions<'input'>,\n ref: RefObject<HTMLInputElement>\n): ButtonAria<InputHTMLAttributes<HTMLInputElement>>;\nexport function useButton(\n props: AriaButtonOptions<'span'>,\n ref: RefObject<HTMLSpanElement>\n): ButtonAria<HTMLAttributes<HTMLSpanElement>>;\nexport function useButton(props: AriaButtonOptions<ElementType>, ref: RefObject<Element>): ButtonAria<DOMAttributes>;\n/**\n * Provides the behavior and accessibility implementation for a button component. Handles mouse, keyboard, and touch interactions,\n * focus behavior, and ARIA props for both native button elements and custom element types.\n * @param props - Props to be applied to the button.\n * @param ref - A ref to a DOM element for the button.\n */\nexport function useButton(props: AriaButtonOptions<ElementType>, ref: RefObject<any>): ButtonAria<HTMLAttributes<any>> {\n let {\n elementType = 'button',\n isDisabled,\n onPress,\n onPressStart,\n onPressEnd,\n onPressUp,\n onPressChange,\n // @ts-ignore - undocumented\n preventFocusOnPress,\n // @ts-ignore - undocumented\n allowFocusWhenDisabled,\n // @ts-ignore\n onClick: deprecatedOnClick,\n href,\n target,\n rel,\n type = 'button',\n } = props;\n let additionalProps;\n if (elementType === 'button') {\n additionalProps = {\n type,\n disabled: isDisabled,\n };\n } else {\n additionalProps = {\n role: 'button',\n tabIndex: isDisabled ? undefined : 0,\n href: elementType === 'a' && isDisabled ? undefined : href,\n target: elementType === 'a' ? target : undefined,\n type: elementType === 'input' ? type : undefined,\n disabled: elementType === 'input' ? isDisabled : undefined,\n 'aria-disabled': !isDisabled || elementType === 'input' ? undefined : isDisabled,\n rel: elementType === 'a' ? rel : undefined,\n };\n }\n\n let { pressProps, isPressed } = usePress({\n onPressStart,\n onPressEnd,\n onPressChange,\n onPress,\n onPressUp,\n isDisabled,\n preventFocusOnPress,\n ref,\n });\n\n let { focusableProps } = useFocusable(props, ref);\n if (allowFocusWhenDisabled) {\n focusableProps.tabIndex = isDisabled ? -1 : focusableProps.tabIndex;\n }\n let buttonProps = mergeProps(focusableProps, pressProps, filterDOMProps(props, { labelable: true }));\n\n return {\n isPressed, // Used to indicate press state for visual\n buttonProps: mergeProps(additionalProps, buttonProps, {\n 'aria-haspopup': props['aria-haspopup'],\n 'aria-expanded': props['aria-expanded'],\n 'aria-controls': props['aria-controls'],\n 'aria-pressed': props['aria-pressed'],\n onClick: (e) => {\n if (deprecatedOnClick) {\n deprecatedOnClick(e);\n console.warn('onClick is deprecated, please use onPress');\n }\n },\n }),\n };\n}\n"],"names":["useButton","props","ref","elementType","isDisabled","onPress","onPressStart","onPressEnd","onPressUp","onPressChange","preventFocusOnPress","allowFocusWhenDisabled","onClick","deprecatedOnClick","href","target","rel","type","additionalProps","disabled","role","tabIndex","undefined","pressProps","isPressed","usePress","focusableProps","useFocusable","buttonProps","mergeProps","filterDOMProps","labelable","e","console","warn"],"mappings":";;;;;AAAA;;AAqCA;;AAsBA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,SAASA,CAACC,KAAqC,EAAEC,GAAmB,EAAmC;EACrH,IAAI;AACFC,IAAAA,WAAW,GAAG,QAAQ;IACtBC,U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;EAEF,IAAI;AAAEwB,IAAAA,cAAAA;AAAe,GAAC,GAAGC,YAAY,CAAC1B,KAAK,EAAEC,GAAG,CAAC,CAAA;AACjD,EAAA,IAAIS,sBAAsB,EAAE;IAC1Be,cAAc,CAACL,QAAQ,GAAGjB,UAAU,GAAG,CAAC,CAAC,GAAGsB,cAAc,CAACL,QAAQ,CAAA;AACrE,GAAA;EACA,IAAIO,WAAW,GAAGC,UAAU,CAACH,cAAc,EAAEH,UAAU,EAAEO,cAAc,CAAC7B,KAAK,EAAE;AAAE8B,IAAAA,SAAS,EAAE,IAAA;AAAK,GAAC,CAAC,CAAC,CAAA;EAEpG,OAAO;IACLP,SAAS;AAAE;AACXI,IAAAA,WAAW,EAAEC,UAAU,CAACX,eAAe,EAAEU,WAAW,EAAE;AACpD,MAAA,eAAe,EAAE3B,KAAK,CAAC,eAAe,CAAC;AACvC,MAAA,eAAe,EAAEA,KAAK,CAAC,eAAe,CAAC;AACvC,MAAA,eAAe,EAAEA,KAAK,CAAC,eAAe,CAAC;AACvC,MAAA,cAAc,EAAEA,KAAK,CAAC,cAAc,CAAC;MACrCW,OAAO,EAAGoB,CAAC,IAAK;AACd,QAAA,IAAInB,iBAAiB,EAAE;UACrBA,iBAAiB,CAACmB,CAAC,CAAC,CAAA;AACpBC,UAAAA,OAAO,CAACC,IAAI,CAAC,2CAA2C,CAAC,CAAA;AAC3D,SAAA;AACF,OAAA;KACD,CAAA;GACF,CAAA;AACH;;;;"}
@@ -0,0 +1,33 @@
1
+ import { getOwnerDocument } from '../utils/domHelpers.js';
2
+ import { focusWithoutScrolling } from '../utils/focusWithoutScrolling.js';
3
+ import { getInteractionModality } from '../interactions/useFocusVisible.js';
4
+ import { runAfterTransition } from '../utils/runAfterTransition.js';
5
+
6
+ /* eslint-disable prefer-const */
7
+
8
+ /**
9
+ * A utility function that focuses an element while avoiding undesired side effects such
10
+ * as page scrolling and screen reader issues with CSS transitions.
11
+ */
12
+ function focusSafely(element) {
13
+ // If the user is interacting with a virtual cursor, e.g. screen reader, then
14
+ // wait until after any animated transitions that are currently occurring on
15
+ // the page before shifting focus. This avoids issues with VoiceOver on iOS
16
+ // causing the page to scroll when moving focus if the element is transitioning
17
+ // from off the screen.
18
+ const ownerDocument = getOwnerDocument(element);
19
+ if (getInteractionModality() === 'virtual') {
20
+ let lastFocusedElement = ownerDocument.activeElement;
21
+ runAfterTransition(() => {
22
+ // If focus did not move and the element is still in the document, focus it.
23
+ if (ownerDocument.activeElement === lastFocusedElement && element.isConnected) {
24
+ focusWithoutScrolling(element);
25
+ }
26
+ });
27
+ } else {
28
+ focusWithoutScrolling(element);
29
+ }
30
+ }
31
+
32
+ export { focusSafely };
33
+ //# sourceMappingURL=focusSafely.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"focusSafely.js","sources":["../../../../src/react-aria/react-aria/focus/focusSafely.ts"],"sourcesContent":["/* eslint-disable prefer-const */\n// @ts-nocheck\n/*\n * Copyright 2020 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 { FocusableElement } from '../../react-types/shared';\nimport { focusWithoutScrolling, getOwnerDocument, runAfterTransition } from '../utils';\nimport { getInteractionModality } from '../interactions';\n\n/**\n * A utility function that focuses an element while avoiding undesired side effects such\n * as page scrolling and screen reader issues with CSS transitions.\n */\nexport function focusSafely(element: FocusableElement) {\n // If the user is interacting with a virtual cursor, e.g. screen reader, then\n // wait until after any animated transitions that are currently occurring on\n // the page before shifting focus. This avoids issues with VoiceOver on iOS\n // causing the page to scroll when moving focus if the element is transitioning\n // from off the screen.\n const ownerDocument = getOwnerDocument(element);\n if (getInteractionModality() === 'virtual') {\n let lastFocusedElement = ownerDocument.activeElement;\n runAfterTransition(() => {\n // If focus did not move and the element is still in the document, focus it.\n if (ownerDocument.activeElement === lastFocusedElement && element.isConnected) {\n focusWithoutScrolling(element);\n }\n });\n } else {\n focusWithoutScrolling(element);\n }\n}\n"],"names":["focusSafely","element","ownerDocument","getOwnerDocument","getInteractionModality","lastFocusedElement","activeElement","runAfterTransition","isConnected","focusWithoutScrolling"],"mappings":";;;;;AAAA;;AAkBA;AACA;AACA;AACA;AACO,SAASA,WAAWA,CAACC,OAAyB,EAAE;AACrD;AACA;AACA;AACA;AACA;AACA,EAAA,MAAMC,aAAa,GAAGC,gBAAgB,CAACF,OAAO,CAAC,CAAA;AAC/C,EAAA,IAAIG,sBAAsB,EAAE,KAAK,SAAS,EAAE;AAC1C,IAAA,IAAIC,kBAAkB,GAAGH,aAAa,CAACI,aAAa,CAAA;AACpDC,IAAAA,kBAAkB,CAAC,MAAM;AACvB;MACA,IAAIL,aAAa,CAACI,aAAa,KAAKD,kBAAkB,IAAIJ,OAAO,CAACO,WAAW,EAAE;QAC7EC,qBAAqB,CAACR,OAAO,CAAC,CAAA;AAChC,OAAA;AACF,KAAC,CAAC,CAAA;AACJ,GAAC,MAAM;IACLQ,qBAAqB,CAACR,OAAO,CAAC,CAAA;AAChC,GAAA;AACF;;;;"}
@@ -0,0 +1,57 @@
1
+ import { useRef, useState, useCallback } from 'react';
2
+ import { isFocusVisible, useFocusVisibleListener } from '../interactions/useFocusVisible.js';
3
+ import { useFocus } from '../interactions/useFocus.js';
4
+ import { useFocusWithin } from '../interactions/useFocusWithin.js';
5
+
6
+ /* eslint-disable prefer-const */
7
+ /**
8
+ * Determines whether a focus ring should be shown to indicate keyboard focus.
9
+ * Focus rings are visible only when the user is interacting with a keyboard,
10
+ * not with a mouse, touch, or other input methods.
11
+ */
12
+ function useFocusRing() {
13
+ let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
14
+ let {
15
+ autoFocus = false,
16
+ isTextInput,
17
+ within
18
+ } = props;
19
+ let state = useRef({
20
+ isFocused: false,
21
+ isFocusVisible: autoFocus || isFocusVisible()
22
+ });
23
+ let [isFocused, setFocused] = useState(false);
24
+ let [isFocusVisibleState, setFocusVisible] = useState(() => state.current.isFocused && state.current.isFocusVisible);
25
+ let updateState = useCallback(() => setFocusVisible(state.current.isFocused && state.current.isFocusVisible), []);
26
+ let onFocusChange = useCallback(isFocused => {
27
+ state.current.isFocused = isFocused;
28
+ setFocused(isFocused);
29
+ updateState();
30
+ }, [updateState]);
31
+ useFocusVisibleListener(isFocusVisible => {
32
+ state.current.isFocusVisible = isFocusVisible;
33
+ updateState();
34
+ }, [], {
35
+ isTextInput
36
+ });
37
+ let {
38
+ focusProps
39
+ } = useFocus({
40
+ isDisabled: within,
41
+ onFocusChange
42
+ });
43
+ let {
44
+ focusWithinProps
45
+ } = useFocusWithin({
46
+ isDisabled: !within,
47
+ onFocusWithinChange: onFocusChange
48
+ });
49
+ return {
50
+ isFocused,
51
+ isFocusVisible: isFocusVisibleState,
52
+ focusProps: within ? focusWithinProps : focusProps
53
+ };
54
+ }
55
+
56
+ export { useFocusRing };
57
+ //# sourceMappingURL=useFocusRing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFocusRing.js","sources":["../../../../src/react-aria/react-aria/focus/useFocusRing.ts"],"sourcesContent":["/* eslint-disable prefer-const */\n// @ts-nocheck\nimport { DOMAttributes } from '../../react-types/shared';\nimport { isFocusVisible, useFocus, useFocusVisibleListener, useFocusWithin } from '../interactions';\nimport { useCallback, useRef, useState } from 'react';\n\nexport interface AriaFocusRingProps {\n /**\n * Whether to show the focus ring when something\n * inside the container element has focus (true), or\n * only if the container itself has focus (false).\n * @default 'false'\n */\n within?: boolean;\n\n /** Whether the element is a text input. */\n isTextInput?: boolean;\n\n /** Whether the element will be auto focused. */\n autoFocus?: boolean;\n}\n\nexport interface FocusRingAria {\n /** Whether the element is currently focused. */\n isFocused: boolean;\n\n /** Whether keyboard focus should be visible. */\n isFocusVisible: boolean;\n\n /** Props to apply to the container element with the focus ring. */\n focusProps: DOMAttributes;\n}\n\n/**\n * Determines whether a focus ring should be shown to indicate keyboard focus.\n * Focus rings are visible only when the user is interacting with a keyboard,\n * not with a mouse, touch, or other input methods.\n */\nexport function useFocusRing(props: AriaFocusRingProps = {}): FocusRingAria {\n let { autoFocus = false, isTextInput, within } = props;\n let state = useRef({\n isFocused: false,\n isFocusVisible: autoFocus || isFocusVisible(),\n });\n let [isFocused, setFocused] = useState(false);\n let [isFocusVisibleState, setFocusVisible] = useState(() => state.current.isFocused && state.current.isFocusVisible);\n\n let updateState = useCallback(() => setFocusVisible(state.current.isFocused && state.current.isFocusVisible), []);\n\n let onFocusChange = useCallback(\n (isFocused) => {\n state.current.isFocused = isFocused;\n setFocused(isFocused);\n updateState();\n },\n [updateState]\n );\n\n useFocusVisibleListener(\n (isFocusVisible) => {\n state.current.isFocusVisible = isFocusVisible;\n updateState();\n },\n [],\n { isTextInput }\n );\n\n let { focusProps } = useFocus({\n isDisabled: within,\n onFocusChange,\n });\n\n let { focusWithinProps } = useFocusWithin({\n isDisabled: !within,\n onFocusWithinChange: onFocusChange,\n });\n\n return {\n isFocused,\n isFocusVisible: isFocusVisibleState,\n focusProps: within ? focusWithinProps : focusProps,\n };\n}\n"],"names":["useFocusRing","props","arguments","length","undefined","autoFocus","isTextInput","within","state","useRef","isFocused","isFocusVisible","setFocused","useState","isFocusVisibleState","setFocusVisible","current","updateState","useCallback","onFocusChange","useFocusVisibleListener","focusProps","useFocus","isDisabled","focusWithinProps","useFocusWithin","onFocusWithinChange"],"mappings":";;;;;AAAA;AAiCA;AACA;AACA;AACA;AACA;AACO,SAASA,YAAYA,GAAgD;AAAA,EAAA,IAA/CC,KAAyB,GAAAC,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA,GAAG,EAAE,CAAA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A;EAEF,IAAI;AAAEK,IAAAA,gBAAAA;GAAkB,GAAGC,cAAc,CAAC;IACxCF,UAAU,EAAE,CAAChB,MAAM;AACnBmB,IAAAA,mBAAmB,EAAEP,aAAAA;AACvB,GAAC,CAAC,CAAA;EAEF,OAAO;IACLT,SAAS;AACTC,IAAAA,cAAc,EAAEG,mBAAmB;AACnCO,IAAAA,UAAU,EAAEd,MAAM,GAAGiB,gBAAgB,GAAGH,UAAAA;GACzC,CAAA;AACH;;;;"}
@@ -0,0 +1,47 @@
1
+ import { objectSpread2 as _objectSpread2, objectWithoutProperties as _objectWithoutProperties } from '../../../_virtual/_rollupPluginBabelHelpers.js';
2
+ import React__default, { useRef, useEffect, useContext } from 'react';
3
+ import { useFocus } from '../interactions/useFocus.js';
4
+ import { useKeyboard } from '../interactions/useKeyboard.js';
5
+ import { mergeProps } from '../utils/mergeProps.js';
6
+ import { focusSafely } from './focusSafely.js';
7
+ import { useSyncRef } from '../utils/useSyncRef.js';
8
+
9
+ const _excluded = ["ref"];
10
+ let FocusableContext = /*#__PURE__*/React__default.createContext(null);
11
+ function useFocusableContext(ref) {
12
+ let context = useContext(FocusableContext) || {};
13
+ useSyncRef(context, ref);
14
+
15
+ // eslint-disable-next-line
16
+ let otherProps = _objectWithoutProperties(context, _excluded);
17
+ return otherProps;
18
+ }
19
+ /**
20
+ * Used to make an element focusable and capable of auto focus.
21
+ */
22
+ function useFocusable(props, domRef) {
23
+ let {
24
+ focusProps
25
+ } = useFocus(props);
26
+ let {
27
+ keyboardProps
28
+ } = useKeyboard(props);
29
+ let interactions = mergeProps(focusProps, keyboardProps);
30
+ let domProps = useFocusableContext(domRef);
31
+ let interactionProps = props.isDisabled ? {} : domProps;
32
+ let autoFocusRef = useRef(props.autoFocus);
33
+ useEffect(() => {
34
+ if (autoFocusRef.current && domRef.current) {
35
+ focusSafely(domRef.current);
36
+ }
37
+ autoFocusRef.current = false;
38
+ }, [domRef]);
39
+ return {
40
+ focusableProps: mergeProps(_objectSpread2(_objectSpread2({}, interactions), {}, {
41
+ tabIndex: props.excludeFromTabOrder && !props.isDisabled ? -1 : undefined
42
+ }), interactionProps)
43
+ };
44
+ }
45
+
46
+ export { useFocusable };
47
+ //# sourceMappingURL=useFocusable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFocusable.js","sources":["../../../../src/react-aria/react-aria/focus/useFocusable.tsx"],"sourcesContent":["/* eslint-disable prefer-const */\n// @ts-nocheck\n/*\n * Copyright 2020 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 { DOMAttributes, FocusableDOMProps, FocusableElement, FocusableProps } from '../../react-types/shared';\nimport { focusSafely } from './';\nimport { mergeProps, useObjectRef, useSyncRef } from '../utils';\nimport React, { ForwardedRef, MutableRefObject, ReactNode, RefObject, useContext, useEffect, useRef } from 'react';\nimport { useFocus, useKeyboard } from '../interactions';\n\nexport interface FocusableOptions extends FocusableProps, FocusableDOMProps {\n /** Whether focus should be disabled. */\n isDisabled?: boolean;\n}\n\nexport interface FocusableProviderProps extends DOMAttributes {\n /** The child element to provide DOM props to. */\n children?: ReactNode;\n}\n\ninterface FocusableContextValue extends FocusableProviderProps {\n ref?: MutableRefObject<FocusableElement | null>;\n}\n\nlet FocusableContext = React.createContext<FocusableContextValue | null>(null);\n\nfunction useFocusableContext(ref: RefObject<FocusableElement>): FocusableContextValue {\n let context = useContext(FocusableContext) || {};\n useSyncRef(context, ref);\n\n // eslint-disable-next-line\n let { ref: _, ...otherProps } = context;\n return otherProps;\n}\n\n/**\n * Provides DOM props to the nearest focusable child.\n */\nfunction FocusableProvider(props: FocusableProviderProps, ref: ForwardedRef<FocusableElement>) {\n let { children, ...otherProps } = props;\n let objRef = useObjectRef(ref);\n let context = {\n ...otherProps,\n ref: objRef,\n };\n\n return <FocusableContext.Provider value={context}>{children}</FocusableContext.Provider>;\n}\n\nlet _FocusableProvider = React.forwardRef(FocusableProvider);\nexport { _FocusableProvider as FocusableProvider };\n\nexport interface FocusableAria {\n /** Props for the focusable element. */\n focusableProps: DOMAttributes;\n}\n\n/**\n * Used to make an element focusable and capable of auto focus.\n */\nexport function useFocusable(props: FocusableOptions, domRef: RefObject<FocusableElement>): FocusableAria {\n let { focusProps } = useFocus(props);\n let { keyboardProps } = useKeyboard(props);\n let interactions = mergeProps(focusProps, keyboardProps);\n let domProps = useFocusableContext(domRef);\n let interactionProps = props.isDisabled ? {} : domProps;\n let autoFocusRef = useRef(props.autoFocus);\n\n useEffect(() => {\n if (autoFocusRef.current && domRef.current) {\n focusSafely(domRef.current);\n }\n autoFocusRef.current = false;\n }, [domRef]);\n\n return {\n focusableProps: mergeProps(\n {\n ...interactions,\n tabIndex: props.excludeFromTabOrder && !props.isDisabled ? -1 : undefined,\n },\n interactionProps\n ),\n };\n}\n"],"names":["FocusableContext","React","createContext","useFocusableContext","ref","context","useContext","useSyncRef","otherProps","_objectWithoutProperties","_excluded","useFocusable","props","domRef","focusProps","useFocus","keyboardProps","useKeyboard","interactions","mergeProps","domProps","interactionProps","isDisabled","autoFocusRef","useRef","autoFocus","useEffect","current","focusSafely","focusableProps","_objectSpread","tabIndex","excludeFromTabOrder","undefined"],"mappings":";;;;;;;;;AAkCA,IAAIA,gBAAgB,gBAAGC,cAAK,CAACC,aAAa,CAA+B,IAAI,CAAC,CAAA;AAE9E,SAASC,mBAAmBA,CAACC,GAAgC,EAAyB;EACpF,IAAIC,OAAO,GAAGC,UAAU,CAACN,gBAAgB,CAAC,IAAI,EAAE,CAAA;AAChDO,EAAAA,UAAU,CAACF,OAAO,EAAED,GAAG,CAAC,CAAA;;AAExB;EACI,IAAaI,UAAU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LayoutEffect } from '../utils/useLayoutEffect.js';
3
+ import { useEffectEvent } from '../utils/useEffectEvent.js';
4
+ import { setInteractionModality } from '../interactions/useFocusVisible.js';
5
+
6
+ /* eslint-disable prefer-const */
7
+ function useFormValidation(props, state, ref) {
8
+ let {
9
+ validationBehavior,
10
+ focus
11
+ } = props;
12
+
13
+ // This is a useLayoutEffect so that it runs before the useEffect in useFormValidationState, which commits the validation change.
14
+ useLayoutEffect(() => {
15
+ if (validationBehavior === 'native' && ref !== null && ref !== void 0 && ref.current) {
16
+ let errorMessage = state.realtimeValidation.isInvalid ? state.realtimeValidation.validationErrors.join(' ') || 'Invalid value.' : '';
17
+ ref.current.setCustomValidity(errorMessage);
18
+
19
+ // Prevent default tooltip for validation message.
20
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=605277
21
+ if (!ref.current.hasAttribute('title')) {
22
+ ref.current.title = '';
23
+ }
24
+ if (!state.realtimeValidation.isInvalid) {
25
+ state.updateValidation(getNativeValidity(ref.current));
26
+ }
27
+ }
28
+ });
29
+ let onReset = useEffectEvent(() => {
30
+ state.resetValidation();
31
+ });
32
+ let onInvalid = useEffectEvent(e => {
33
+ var _ref$current;
34
+ // Only commit validation if we are not already displaying one.
35
+ // This avoids clearing server errors that the user didn't actually fix.
36
+ if (!state.displayValidation.isInvalid) {
37
+ state.commitValidation();
38
+ }
39
+
40
+ // Auto focus the first invalid input in a form, unless the error already had its default prevented.
41
+ let form = ref === null || ref === void 0 ? void 0 : (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.form;
42
+ if (!e.defaultPrevented && ref && form && getFirstInvalidInput(form) === ref.current) {
43
+ if (focus) {
44
+ focus();
45
+ } else {
46
+ var _ref$current2;
47
+ (_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.focus();
48
+ }
49
+
50
+ // Always show focus ring.
51
+ setInteractionModality('keyboard');
52
+ }
53
+
54
+ // Prevent default browser error UI from appearing.
55
+ e.preventDefault();
56
+ });
57
+ let onChange = useEffectEvent(() => {
58
+ state.commitValidation();
59
+ });
60
+ useEffect(() => {
61
+ let input = ref === null || ref === void 0 ? void 0 : ref.current;
62
+ if (!input) {
63
+ return;
64
+ }
65
+ let form = input.form;
66
+ input.addEventListener('invalid', onInvalid);
67
+ input.addEventListener('change', onChange);
68
+ form === null || form === void 0 ? void 0 : form.addEventListener('reset', onReset);
69
+ return () => {
70
+ input.removeEventListener('invalid', onInvalid);
71
+ input.removeEventListener('change', onChange);
72
+ form === null || form === void 0 ? void 0 : form.removeEventListener('reset', onReset);
73
+ };
74
+ }, [ref, onInvalid, onChange, onReset, validationBehavior]);
75
+ }
76
+ function getValidity(input) {
77
+ // The native ValidityState object is live, meaning each property is a getter that returns the current state.
78
+ // We need to create a snapshot of the validity state at the time this function is called to avoid unpredictable React renders.
79
+ let validity = input.validity;
80
+ return {
81
+ badInput: validity.badInput,
82
+ customError: validity.customError,
83
+ patternMismatch: validity.patternMismatch,
84
+ rangeOverflow: validity.rangeOverflow,
85
+ rangeUnderflow: validity.rangeUnderflow,
86
+ stepMismatch: validity.stepMismatch,
87
+ tooLong: validity.tooLong,
88
+ tooShort: validity.tooShort,
89
+ typeMismatch: validity.typeMismatch,
90
+ valueMissing: validity.valueMissing,
91
+ valid: validity.valid
92
+ };
93
+ }
94
+ function getNativeValidity(input) {
95
+ return {
96
+ isInvalid: !input.validity.valid,
97
+ validationDetails: getValidity(input),
98
+ validationErrors: input.validationMessage ? [input.validationMessage] : []
99
+ };
100
+ }
101
+ function getFirstInvalidInput(form) {
102
+ for (let i = 0; i < form.elements.length; i++) {
103
+ let element = form.elements[i];
104
+ if (!element.validity.valid) {
105
+ return element;
106
+ }
107
+ }
108
+ return null;
109
+ }
110
+
111
+ export { useFormValidation };
112
+ //# sourceMappingURL=useFormValidation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFormValidation.js","sources":["../../../../src/react-aria/react-aria/form/useFormValidation.ts"],"sourcesContent":["/* eslint-disable prefer-const */\n// @ts-nocheck\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 { FormValidationState } from '../../react-stately/form';\nimport { RefObject, useEffect } from 'react';\nimport { setInteractionModality } from '../interactions';\nimport { useEffectEvent, useLayoutEffect } from '../utils';\nimport { Validation, ValidationResult } from '../../react-types/shared';\n\ntype ValidatableElement = HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement;\n\ninterface FormValidationProps<T> extends Validation<T> {\n focus?: () => void;\n}\n\nexport function useFormValidation<T>(\n props: FormValidationProps<T>,\n state: FormValidationState,\n ref: RefObject<ValidatableElement> | undefined\n) {\n let { validationBehavior, focus } = props;\n\n // This is a useLayoutEffect so that it runs before the useEffect in useFormValidationState, which commits the validation change.\n useLayoutEffect(() => {\n if (validationBehavior === 'native' && ref?.current) {\n let errorMessage = state.realtimeValidation.isInvalid\n ? state.realtimeValidation.validationErrors.join(' ') || 'Invalid value.'\n : '';\n ref.current.setCustomValidity(errorMessage);\n\n // Prevent default tooltip for validation message.\n // https://bugzilla.mozilla.org/show_bug.cgi?id=605277\n if (!ref.current.hasAttribute('title')) {\n ref.current.title = '';\n }\n\n if (!state.realtimeValidation.isInvalid) {\n state.updateValidation(getNativeValidity(ref.current));\n }\n }\n });\n\n let onReset = useEffectEvent(() => {\n state.resetValidation();\n });\n\n let onInvalid = useEffectEvent((e: Event) => {\n // Only commit validation if we are not already displaying one.\n // This avoids clearing server errors that the user didn't actually fix.\n if (!state.displayValidation.isInvalid) {\n state.commitValidation();\n }\n\n // Auto focus the first invalid input in a form, unless the error already had its default prevented.\n let form = ref?.current?.form;\n if (!e.defaultPrevented && ref && form && getFirstInvalidInput(form) === ref.current) {\n if (focus) {\n focus();\n } else {\n ref.current?.focus();\n }\n\n // Always show focus ring.\n setInteractionModality('keyboard');\n }\n\n // Prevent default browser error UI from appearing.\n e.preventDefault();\n });\n\n let onChange = useEffectEvent(() => {\n state.commitValidation();\n });\n\n useEffect(() => {\n let input = ref?.current;\n if (!input) {\n return;\n }\n\n let form = input.form;\n input.addEventListener('invalid', onInvalid);\n input.addEventListener('change', onChange);\n form?.addEventListener('reset', onReset);\n return () => {\n input!.removeEventListener('invalid', onInvalid);\n input!.removeEventListener('change', onChange);\n form?.removeEventListener('reset', onReset);\n };\n }, [ref, onInvalid, onChange, onReset, validationBehavior]);\n}\n\nfunction getValidity(input: ValidatableElement) {\n // The native ValidityState object is live, meaning each property is a getter that returns the current state.\n // We need to create a snapshot of the validity state at the time this function is called to avoid unpredictable React renders.\n let validity = input.validity;\n return {\n badInput: validity.badInput,\n customError: validity.customError,\n patternMismatch: validity.patternMismatch,\n rangeOverflow: validity.rangeOverflow,\n rangeUnderflow: validity.rangeUnderflow,\n stepMismatch: validity.stepMismatch,\n tooLong: validity.tooLong,\n tooShort: validity.tooShort,\n typeMismatch: validity.typeMismatch,\n valueMissing: validity.valueMissing,\n valid: validity.valid,\n };\n}\n\nfunction getNativeValidity(input: ValidatableElement): ValidationResult {\n return {\n isInvalid: !input.validity.valid,\n validationDetails: getValidity(input),\n validationErrors: input.validationMessage ? [input.validationMessage] : [],\n };\n}\n\nfunction getFirstInvalidInput(form: HTMLFormElement): ValidatableElement | null {\n for (let i = 0; i < form.elements.length; i++) {\n let element = form.elements[i] as ValidatableElement;\n if (!element.validity.valid) {\n return element;\n }\n }\n\n return null;\n}\n"],"names":["useFormValidation","props","state","ref","validationBehavior","focus","useLayoutEffect","current","errorMessage","realtimeValidation","isInvalid","validationErrors","join","setCustomValidity","hasAttribute","title","updateValidation","getNativeValidity","onReset","useEffectEvent","resetValidation","onInvalid","e","_ref$current","displayValidation","commitValidation","form","defaultPrevented","getFirstInvalidInput","_ref$current2","setInteractionModality","preventDefault","onChange","useEffect","input","addEventListener","removeEventListener","getValidity","validity","badInput","customError","patternMismatch","rangeOverflow","rangeUnderflow","stepMismatch","tooLong","tooShort","typeMismatch","valueMissing","valid","validationDetails","validationMessage","i","elements","length","element"],"mappings":";;;;;AAAA;AA0BO,SAASA,iBAAiBA,CAC/BC,KAA6B,EAC7BC,KAA0B,EAC1BC,GAA8C,EAC9C;EACA,IAAI;IAAEC,kBAAkB;AAAEC,IAAAA,KAAAA;AAAM,GAAC,GAAGJ,KAAK,CAAA;;AAEzC;AACAK,EAAAA,eAAe,CAAC,MAAM;IACpB,IAAIF,kBAAkB,KAAK,QAAQ,IAAID,GAAG,KAAHA,IAAAA,IAAAA,GAAG,KAAHA,KAAAA,CAAAA,IAAAA,GAAG,CAAEI,OAAO,EAAE;MACnD,IAAIC,YAAY,GAAGN,KAAK,CAACO,kBAAkB,CAACC,SAAS,GACjDR,KAAK,CAACO,kBAAkB,CAACE,gBAAgB,CAACC,IAAI,CAAC,GAAG,CAAC,IAAI,gBAAgB,GACvE,EAAE,CAAA;AACNT,MAAAA,GAAG,CAACI,OAAO,CAACM,iBAAiB,CAACL,YAAY,CAAC,CAAA;;AAE3C;AACA;MACA,IAAI,CAACL,GAAG,CAACI,OAAO,CAACO,YAAY,CAAC,OAAO,CAAC,EAAE;AACtCX,QAAAA,GAAG,CAACI,OAAO,CAACQ,KAAK,GAAG,EAAE,CAAA;AACxB,OAAA;AAEA,MAAA,IAAI,CAACb,KAAK,CAACO,kBAAkB,CAACC,SAAS,EAAE;QACvCR,KAAK,CAACc,gBAAgB,CAACC,iBAAiB,CAACd,GAAG,CAACI,OAAO,CAAC,CAAC,CAAA;AACxD,OAAA;AACF,KAAA;AACF,GAAC,CAAC,CAAA;AAEF,EAAA,IAAIW,OAAO,GAAGC,cAAc,CAAC,MAAM;IACjCjB,KAAK,CAACkB,eAAe,EAAE,CAAA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Q,CAACK,cAAc;IACvCC,YAAY,EAAEN,QAAQ,CAACM,YAAY;IACnCC,OAAO,EAAEP,QAAQ,CAACO,OAAO;IACzBC,QAAQ,EAAER,QAAQ,CAACQ,QAAQ;IAC3BC,YAAY,EAAET,QAAQ,CAACS,YAAY;IACnCC,YAAY,EAAEV,QAAQ,CAACU,YAAY;IACnCC,KAAK,EAAEX,QAAQ,CAACW,KAAAA;GACjB,CAAA;AACH,CAAA;AAEA,SAAShC,iBAAiBA,CAACiB,KAAyB,EAAoB;EACtE,OAAO;AACLxB,IAAAA,SAAS,EAAE,CAACwB,KAAK,CAACI,QAAQ,CAACW,KAAK;AAChCC,IAAAA,iBAAiB,EAAEb,WAAW,CAACH,KAAK,CAAC;IACrCvB,gBAAgB,EAAEuB,KAAK,CAACiB,iBAAiB,GAAG,CAACjB,KAAK,CAACiB,iBAAiB,CAAC,GAAG,EAAA;GACzE,CAAA;AACH,CAAA;AAEA,SAASvB,oBAAoBA,CAACF,IAAqB,EAA6B;AAC9E,EAAA,KAAK,IAAI0B,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAG1B,IAAI,CAAC2B,QAAQ,CAACC,MAAM,EAAEF,CAAC,EAAE,EAAE;AAC7C,IAAA,IAAIG,OAAO,GAAG7B,IAAI,CAAC2B,QAAQ,CAACD,CAAC,CAAuB,CAAA;AACpD,IAAA,IAAI,CAACG,OAAO,CAACjB,QAAQ,CAACW,KAAK,EAAE;AAC3B,MAAA,OAAOM,OAAO,CAAA;AAChB,KAAA;AACF,GAAA;AAEA,EAAA,OAAO,IAAI,CAAA;AACb;;;;"}
@@ -0,0 +1,19 @@
1
+ import { Locale } from './useDefaultLocale.js';
2
+ import { ReactNode } from 'react';
3
+
4
+ interface I18nProviderProps {
5
+ /** Contents that should have the locale applied. */
6
+ children: ReactNode;
7
+ /** The locale to apply to the children. */
8
+ locale?: string;
9
+ }
10
+ /**
11
+ * Provides the locale for the application to all child components.
12
+ */
13
+ declare function I18nProvider(props: I18nProviderProps): JSX.Element;
14
+ /**
15
+ * Returns the current locale and layout direction.
16
+ */
17
+ declare function useLocale(): Locale;
18
+
19
+ export { I18nProvider, I18nProviderProps, useLocale };
@@ -0,0 +1,41 @@
1
+ import { isRTL } from './utils.js';
2
+ import { useDefaultLocale } from './useDefaultLocale.js';
3
+ import React__default, { useContext } from 'react';
4
+
5
+ /* eslint-disable prefer-const */
6
+ const I18nContext = /*#__PURE__*/React__default.createContext(null);
7
+
8
+ /**
9
+ * Provides the locale for the application to all child components.
10
+ */
11
+ function I18nProvider(props) {
12
+ let {
13
+ locale,
14
+ children
15
+ } = props;
16
+ let defaultLocale = useDefaultLocale();
17
+ let value = React__default.useMemo(() => {
18
+ if (!locale) {
19
+ return defaultLocale;
20
+ }
21
+ return {
22
+ locale,
23
+ direction: isRTL(locale) ? 'rtl' : 'ltr'
24
+ };
25
+ }, [defaultLocale, locale]);
26
+ return /*#__PURE__*/React__default.createElement(I18nContext.Provider, {
27
+ value: value
28
+ }, children);
29
+ }
30
+
31
+ /**
32
+ * Returns the current locale and layout direction.
33
+ */
34
+ function useLocale() {
35
+ let defaultLocale = useDefaultLocale();
36
+ let context = useContext(I18nContext);
37
+ return context || defaultLocale;
38
+ }
39
+
40
+ export { I18nProvider, useLocale };
41
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.js","sources":["../../../../src/react-aria/react-aria/i18n/context.tsx"],"sourcesContent":["/* eslint-disable prefer-const */\n// @ts-nocheck\n/*\n * Copyright 2020 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 { isRTL } from './utils';\nimport { Locale, useDefaultLocale } from './useDefaultLocale';\nimport React, { ReactNode, useContext } from 'react';\n\nexport interface I18nProviderProps {\n /** Contents that should have the locale applied. */\n children: ReactNode;\n /** The locale to apply to the children. */\n locale?: string;\n}\n\nconst I18nContext = React.createContext<Locale | null>(null);\n\n/**\n * Provides the locale for the application to all child components.\n */\nexport function I18nProvider(props: I18nProviderProps) {\n let { locale, children } = props;\n let defaultLocale = useDefaultLocale();\n\n let value: Locale = React.useMemo(() => {\n if (!locale) {\n return defaultLocale;\n }\n\n return {\n locale,\n direction: isRTL(locale) ? 'rtl' : 'ltr',\n };\n }, [defaultLocale, locale]);\n\n return <I18nContext.Provider value={value}>{children}</I18nContext.Provider>;\n}\n\n/**\n * Returns the current locale and layout direction.\n */\nexport function useLocale(): Locale {\n let defaultLocale = useDefaultLocale();\n let context = useContext(I18nContext);\n return context || defaultLocale;\n}\n"],"names":["I18nContext","React","createContext","I18nProvider","props","locale","children","defaultLocale","useDefaultLocale","value","useMemo","direction","isRTL","createElement","Provider","useLocale","context","useContext"],"mappings":";;;;AAAA;AAyBA,MAAMA,WAAW,gBAAGC,cAAK,CAACC,aAAa,CAAgB,IAAI,CAAC,CAAA;;AAE5D;AACA;AACA;AACO,SAASC,YAAYA,CAACC,KAAwB,EAAE;EACrD,IAAI;IAAEC,MAAM;AAAEC,IAAAA,QAAAA;AAAS,GAAC,GAAGF,KAAK,CAAA;AAChC,EAAA,IAAIG,aAAa,GAAGC,gBAAgB,EAAE,CAAA;AAEtC,EAAA,IAAIC,KAAa,GAAGR,cAAK,CAACS,OAAO,CAAC,MAAM;IACtC,IAAI,CAACL,MAAM,EAAE;AACX,MAAA,OAAOE,aAAa,CAAA;AACtB,KAAA;IAEA,OAAO;MACLF,MAAM;AACNM,MAAAA,SAAS,EAAEC,KAAK,CAACP,MAAM,CAAC,GAAG,KAAK,GAAG,KAAA;KACpC,CAAA;AACH,GAAC,EAAE,CAACE,aAAa,EAAEF,MAAM,CAAC,CAAC,CAAA;AAE3B,EAAA,oBAAOJ,cAAA,CAAAY,aAAA,CAACb,WAAW,CAACc,QAAQ,EAAA;AAACL,IAAAA,KAAK,EAAEA,KAAAA;AAAM,GAAA,EAAEH,QAA+B,CAAC,CAAA;AAC9E,CAAA;;AAEA;AACA;AACA;AACO,SAASS,SAASA,GAAW;AAClC,EAAA,IAAIR,aAAa,GAAGC,gBAAgB,EAAE,CAAA;AACtC,EAAA,IAAIQ,OAAO,GAAGC,UAAU,CAACjB,WAAW,CAAC,CAAA;EACrC,OAAOgB,OAAO,IAAIT,aAAa,CAAA;AACjC;;;;"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Provides localized string collation for the current locale. Automatically updates when the locale changes,
3
+ * and handles caching of the collator for performance.
4
+ * @param options - Collator options.
5
+ */
6
+ declare function useCollator(options?: Intl.CollatorOptions): Intl.Collator;
7
+
8
+ export { useCollator };
@@ -0,0 +1,25 @@
1
+ import { useLocale } from './context.js';
2
+
3
+ /* eslint-disable prefer-const */
4
+ let cache = new Map();
5
+
6
+ /**
7
+ * Provides localized string collation for the current locale. Automatically updates when the locale changes,
8
+ * and handles caching of the collator for performance.
9
+ * @param options - Collator options.
10
+ */
11
+ function useCollator(options) {
12
+ let {
13
+ locale
14
+ } = useLocale();
15
+ let cacheKey = locale + (options ? Object.entries(options).sort((a, b) => a[0] < b[0] ? -1 : 1).join() : '');
16
+ if (cache.has(cacheKey)) {
17
+ return cache.get(cacheKey);
18
+ }
19
+ let formatter = new Intl.Collator(locale, options);
20
+ cache.set(cacheKey, formatter);
21
+ return formatter;
22
+ }
23
+
24
+ export { useCollator };
25
+ //# sourceMappingURL=useCollator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCollator.js","sources":["../../../../src/react-aria/react-aria/i18n/useCollator.ts"],"sourcesContent":["/* eslint-disable prefer-const */\n// @ts-nocheck\n/*\n * Copyright 2020 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 { useLocale } from './context';\n\nlet cache = new Map<string, Intl.Collator>();\n\n/**\n * Provides localized string collation for the current locale. Automatically updates when the locale changes,\n * and handles caching of the collator for performance.\n * @param options - Collator options.\n */\nexport function useCollator(options?: Intl.CollatorOptions): Intl.Collator {\n let { locale } = useLocale();\n\n let cacheKey =\n locale +\n (options\n ? Object.entries(options)\n .sort((a, b) => (a[0] < b[0] ? -1 : 1))\n .join()\n : '');\n if (cache.has(cacheKey)) {\n return cache.get(cacheKey)!;\n }\n\n let formatter = new Intl.Collator(locale, options);\n cache.set(cacheKey, formatter);\n return formatter;\n}\n"],"names":["cache","Map","useCollator","options","locale","useLocale","cacheKey","Object","entries","sort","a","b","join","has","get","formatter","Intl","Collator","set"],"mappings":";;AAAA;AAgBA,IAAIA,KAAK,GAAG,IAAIC,GAAG,EAAyB,CAAA;;AAE5C;AACA;AACA;AACA;AACA;AACO,SAASC,WAAWA,CAACC,OAA8B,EAAiB;EACzE,IAAI;AAAEC,IAAAA,MAAAA;GAAQ,GAAGC,SAAS,EAAE,CAAA;AAE5B,EAAA,IAAIC,QAAQ,GACVF,MAAM,IACLD,OAAO,GACJI,MAAM,CAACC,OAAO,CAACL,OAAO,CAAC,CACpBM,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAMD,CAAC,CAAC,CAAC,CAAC,GAAGC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAE,CAAC,CACtCC,IAAI,EAAE,GACT,EAAE,CAAC,CAAA;AACT,EAAA,IAAIZ,KAAK,CAACa,GAAG,CAACP,QAAQ,CAAC,EAAE;AACvB,IAAA,OAAON,KAAK,CAACc,GAAG,CAACR,QAAQ,CAAC,CAAA;AAC5B,GAAA;EAEA,IAAIS,SAAS,GAAG,IAAIC,IAAI,CAACC,QAAQ,CAACb,MAAM,EAAED,OAAO,CAAC,CAAA;AAClDH,EAAAA,KAAK,CAACkB,GAAG,CAACZ,QAAQ,EAAES,SAAS,CAAC,CAAA;AAC9B,EAAA,OAAOA,SAAS,CAAA;AAClB;;;;"}
@@ -0,0 +1,13 @@
1
+ import { DateFormatter } from '../../internationalized/date/DateFormatter.js';
2
+
3
+ interface DateFormatterOptions extends Intl.DateTimeFormatOptions {
4
+ calendar?: string;
5
+ }
6
+ /**
7
+ * Provides localized date formatting for the current locale. Automatically updates when the locale changes,
8
+ * and handles caching of the date formatter for performance.
9
+ * @param options - Formatting options.
10
+ */
11
+ declare function useDateFormatter(options?: DateFormatterOptions): DateFormatter;
12
+
13
+ export { DateFormatterOptions, useDateFormatter };
@@ -0,0 +1,39 @@
1
+ import { useLocale } from './context.js';
2
+ import { useMemo } from 'react';
3
+ import { useDeepMemo } from '../utils/useDeepMemo.js';
4
+ import { DateFormatter } from '../../internationalized/date/DateFormatter.js';
5
+
6
+ /* eslint-disable prefer-const */
7
+ /**
8
+ * Provides localized date formatting for the current locale. Automatically updates when the locale changes,
9
+ * and handles caching of the date formatter for performance.
10
+ * @param options - Formatting options.
11
+ */
12
+ function useDateFormatter(options) {
13
+ var _options;
14
+ // Reuse last options object if it is shallowly equal, which allows the useMemo result to also be reused.
15
+ options = useDeepMemo((_options = options) !== null && _options !== void 0 ? _options : {}, isEqual);
16
+ let {
17
+ locale
18
+ } = useLocale();
19
+ return useMemo(() => new DateFormatter(locale, options), [locale, options]);
20
+ }
21
+ function isEqual(a, b) {
22
+ if (a === b) {
23
+ return true;
24
+ }
25
+ let aKeys = Object.keys(a);
26
+ let bKeys = Object.keys(b);
27
+ if (aKeys.length !== bKeys.length) {
28
+ return false;
29
+ }
30
+ for (let key of aKeys) {
31
+ if (b[key] !== a[key]) {
32
+ return false;
33
+ }
34
+ }
35
+ return true;
36
+ }
37
+
38
+ export { useDateFormatter };
39
+ //# sourceMappingURL=useDateFormatter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDateFormatter.js","sources":["../../../../src/react-aria/react-aria/i18n/useDateFormatter.ts"],"sourcesContent":["/* eslint-disable prefer-const */\n// @ts-nocheck\n/*\n * Copyright 2020 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 { DateFormatter } from '../../internationalized/date';\nimport { useDeepMemo } from '../utils';\nimport { useLocale } from './context';\nimport { useMemo } from 'react';\n\nexport interface DateFormatterOptions extends Intl.DateTimeFormatOptions {\n calendar?: string;\n}\n\n/**\n * Provides localized date formatting for the current locale. Automatically updates when the locale changes,\n * and handles caching of the date formatter for performance.\n * @param options - Formatting options.\n */\nexport function useDateFormatter(options?: DateFormatterOptions): DateFormatter {\n // Reuse last options object if it is shallowly equal, which allows the useMemo result to also be reused.\n options = useDeepMemo(options ?? {}, isEqual);\n let { locale } = useLocale();\n return useMemo(() => new DateFormatter(locale, options), [locale, options]);\n}\n\nfunction isEqual(a: DateFormatterOptions, b: DateFormatterOptions) {\n if (a === b) {\n return true;\n }\n\n let aKeys = Object.keys(a);\n let bKeys = Object.keys(b);\n if (aKeys.length !== bKeys.length) {\n return false;\n }\n\n for (let key of aKeys) {\n if (b[key] !== a[key]) {\n return false;\n }\n }\n\n return true;\n}\n"],"names":["useDateFormatter","options","_options","useDeepMemo","isEqual","locale","useLocale","useMemo","DateFormatter","a","b","aKeys","Object","keys","bKeys","length","key"],"mappings":";;;;;AAAA;AAuBA;AACA;AACA;AACA;AACA;AACO,SAASA,gBAAgBA,CAACC,OAA8B,EAAiB;AAAA,EAAA,IAAAC,QAAA,CAAA;AAC9E;AACAD,EAAAA,OAAO,GAAGE,WAAW,CAAAD,CAAAA,QAAA,GAACD,OAAO,MAAA,IAAA,IAAAC,QAAA,KAAA,KAAA,CAAA,GAAAA,QAAA,GAAI,EAAE,EAAEE,OAAO,CAAC,CAAA;EAC7C,IAAI;AAAEC,IAAAA,MAAAA;GAAQ,GAAGC,SAAS,EAAE,CAAA;AAC5B,EAAA,OAAOC,OAAO,CAAC,MAAM,IAAIC,aAAa,CAACH,MAAM,EAAEJ,OAAO,CAAC,EAAE,CAACI,MAAM,EAAEJ,OAAO,CAAC,CAAC,CAAA;AAC7E,CAAA;AAEA,SAASG,OAAOA,CAACK,CAAuB,EAAEC,CAAuB,EAAE;EACjE,IAAID,CAAC,KAAKC,CAAC,EAAE;AACX,IAAA,OAAO,IAAI,CAAA;AACb,GAAA;AAEA,EAAA,IAAIC,KAAK,GAAGC,MAAM,CAACC,IAAI,CAACJ,CAAC,CAAC,CAAA;AAC1B,EAAA,IAAIK,KAAK,GAAGF,MAAM,CAACC,IAAI,CAACH,CAAC,CAAC,CAAA;AAC1B,EAAA,IAAIC,KAAK,CAACI,MAAM,KAAKD,KAAK,CAACC,MAAM,EAAE;AACjC,IAAA,OAAO,KAAK,CAAA;AACd,GAAA;AAEA,EAAA,KAAK,IAAIC,GAAG,IAAIL,KAAK,EAAE;IACrB,IAAID,CAAC,CAACM,GAAG,CAAC,KAAKP,CAAC,CAACO,GAAG,CAAC,EAAE;AACrB,MAAA,OAAO,KAAK,CAAA;AACd,KAAA;AACF,GAAA;AAEA,EAAA,OAAO,IAAI,CAAA;AACb;;;;"}
@@ -0,0 +1,10 @@
1
+ import { Direction } from '../../react-types/shared/locale.js';
2
+
3
+ interface Locale {
4
+ /** The [BCP47](https://www.ietf.org/rfc/bcp/bcp47.txt) language code for the locale. */
5
+ locale: string;
6
+ /** The writing direction for the locale. */
7
+ direction: Direction;
8
+ }
9
+
10
+ export { Locale };