@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,10 @@
1
+ import enUS from './en-US.json.js';
2
+ import frFR from './fr-FR.json.js';
3
+
4
+ var intlMessages = {
5
+ 'en-US': enUS,
6
+ 'fr-FR': frFR
7
+ };
8
+
9
+ export { intlMessages as default };
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../../src/react-aria/react-aria/numberfield/intl/index.ts"],"sourcesContent":["import enUS from './en-US.json';\nimport frFR from './fr-FR.json';\n\nexport default {\n 'en-US': enUS,\n 'fr-FR': frFR,\n};\n"],"names":["enUS","frFR"],"mappings":";;;AAGA,mBAAe;AACb,EAAA,OAAO,EAAEA,IAAI;AACb,EAAA,OAAO,EAAEC,IAAAA;AACX,CAAC;;;;"}
@@ -0,0 +1,294 @@
1
+ import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2 } from '../../../_virtual/_rollupPluginBabelHelpers.js';
2
+ import { useMemo, useState, useCallback } from 'react';
3
+ import intlMessages from './intl/index.js';
4
+ import { useMessageFormatter } from '../i18n/useMessageFormatter.js';
5
+ import { useId } from '../utils/useId.js';
6
+ import { useFocus } from '../interactions/useFocus.js';
7
+ import { useNumberFormatter } from '../i18n/useNumberFormatter.js';
8
+ import { useSpinButton } from '../spinbutton/useSpinButton.js';
9
+ import { useFocusWithin } from '../interactions/useFocusWithin.js';
10
+ import { useScrollWheel } from '../interactions/useScrollWheel.js';
11
+ import { isIPhone, isAndroid, isIOS } from '../utils/platform.js';
12
+ import { filterDOMProps } from '../utils/filterDOMProps.js';
13
+ import { useFormattedTextField } from '../textfield/useFormattedTextField.js';
14
+ import { privateValidationStateProp } from '../../react-stately/form/useFormValidationState.js';
15
+ import { chain } from '../utils/chain.js';
16
+ import { useFormReset } from '../utils/useFormReset.js';
17
+ import { mergeProps } from '../utils/mergeProps.js';
18
+
19
+ const _excluded = ["id", "decrementAriaLabel", "incrementAriaLabel", "isDisabled", "isReadOnly", "isRequired", "minValue", "maxValue", "autoFocus", "label", "formatOptions", "onBlur", "onFocus", "onFocusChange", "onKeyDown", "onKeyUp", "description", "errorMessage", "isWheelDisabled"];
20
+ /**
21
+ * Provides the behavior and accessibility implementation for a number field component.
22
+ * Number fields allow users to enter a number, and increment or decrement the value using stepper buttons.
23
+ */
24
+ function useNumberField(props, state, inputRef) {
25
+ let {
26
+ id,
27
+ decrementAriaLabel,
28
+ incrementAriaLabel,
29
+ isDisabled,
30
+ isReadOnly,
31
+ isRequired,
32
+ minValue,
33
+ maxValue,
34
+ autoFocus,
35
+ label,
36
+ formatOptions,
37
+ onBlur = () => {},
38
+ onFocus,
39
+ onFocusChange,
40
+ onKeyDown,
41
+ onKeyUp,
42
+ description,
43
+ errorMessage,
44
+ isWheelDisabled
45
+ } = props,
46
+ otherProps = _objectWithoutProperties(props, _excluded);
47
+ let {
48
+ increment,
49
+ incrementToMax,
50
+ decrement,
51
+ decrementToMin,
52
+ numberValue,
53
+ inputValue,
54
+ commit,
55
+ commitValidation
56
+ } = state;
57
+ const format = useMessageFormatter(intlMessages);
58
+ let inputId = useId(id);
59
+ let {
60
+ focusProps
61
+ } = useFocus({
62
+ onBlur() {
63
+ // Set input value to normalized valid value
64
+ commit();
65
+ }
66
+ });
67
+ let numberFormatter = useNumberFormatter(formatOptions);
68
+ let intlOptions = useMemo(() => numberFormatter.resolvedOptions(), [numberFormatter]);
69
+
70
+ // Replace negative textValue formatted using currencySign: 'accounting'
71
+ // with a textValue that can be announced using a minus sign.
72
+ let textValueFormatter = useNumberFormatter(_objectSpread2(_objectSpread2({}, formatOptions), {}, {
73
+ currencySign: undefined
74
+ }));
75
+ let textValue = useMemo(() => isNaN(numberValue) ? '' : textValueFormatter.format(numberValue), [textValueFormatter, numberValue]);
76
+ let {
77
+ spinButtonProps,
78
+ incrementButtonProps: incButtonProps,
79
+ decrementButtonProps: decButtonProps
80
+ } = useSpinButton({
81
+ isDisabled,
82
+ isReadOnly,
83
+ isRequired,
84
+ maxValue,
85
+ minValue,
86
+ onIncrement: increment,
87
+ onIncrementToMax: incrementToMax,
88
+ onDecrement: decrement,
89
+ onDecrementToMin: decrementToMin,
90
+ value: numberValue,
91
+ textValue
92
+ });
93
+ let [focusWithin, setFocusWithin] = useState(false);
94
+ let {
95
+ focusWithinProps
96
+ } = useFocusWithin({
97
+ isDisabled,
98
+ onFocusWithinChange: setFocusWithin
99
+ });
100
+ let onWheel = useCallback(e => {
101
+ // if on a trackpad, users can scroll in both X and Y at once, check the magnitude of the change
102
+ // if it's mostly in the X direction, then just return, the user probably doesn't mean to inc/dec
103
+ // this isn't perfect, events come in fast with small deltas and a part of the scroll may give a false indication
104
+ // especially if the user is scrolling near 45deg
105
+ if (Math.abs(e.deltaY) <= Math.abs(e.deltaX)) {
106
+ return;
107
+ }
108
+ if (e.deltaY > 0) {
109
+ increment();
110
+ } else if (e.deltaY < 0) {
111
+ decrement();
112
+ }
113
+ }, [decrement, increment]);
114
+ // If the input isn't supposed to receive input, disable scrolling.
115
+ let scrollingDisabled = isWheelDisabled || isDisabled || isReadOnly || !focusWithin;
116
+ useScrollWheel({
117
+ onScroll: onWheel,
118
+ isDisabled: scrollingDisabled
119
+ }, inputRef);
120
+
121
+ // The inputMode attribute influences the software keyboard that is shown on touch devices.
122
+ // Browsers and operating systems are quite inconsistent about what keys are available, however.
123
+ // We choose between numeric and decimal based on whether we allow negative and fractional numbers,
124
+ // and based on testing on various devices to determine what keys are available in each inputMode.
125
+ let hasDecimals = intlOptions.maximumFractionDigits > 0;
126
+ let hasNegative = state.minValue === undefined || isNaN(state.minValue) || state.minValue < 0;
127
+ let inputMode = 'numeric';
128
+ if (isIPhone()) {
129
+ // iPhone doesn't have a minus sign in either numeric or decimal.
130
+ // Note this is only for iPhone, not iPad, which always has both
131
+ // minus and decimal in numeric.
132
+ if (hasNegative) {
133
+ inputMode = 'text';
134
+ } else if (hasDecimals) {
135
+ inputMode = 'decimal';
136
+ }
137
+ } else if (isAndroid()) {
138
+ // Android numeric has both a decimal point and minus key.
139
+ // decimal does not have a minus key.
140
+ if (hasNegative) {
141
+ inputMode = 'numeric';
142
+ } else if (hasDecimals) {
143
+ inputMode = 'decimal';
144
+ }
145
+ }
146
+ let onChange = value => {
147
+ if (state.validate(value)) {
148
+ state.setInputValue(value);
149
+ }
150
+ };
151
+ let domProps = filterDOMProps(props);
152
+ let onKeyDownEnter = useCallback(e => {
153
+ if (e.key === 'Enter') {
154
+ commit();
155
+ commitValidation();
156
+ } else {
157
+ e.continuePropagation();
158
+ }
159
+ }, [commit, commitValidation]);
160
+ let {
161
+ isInvalid,
162
+ validationErrors,
163
+ validationDetails
164
+ } = state.displayValidation;
165
+ let {
166
+ labelProps,
167
+ inputProps: textFieldProps,
168
+ descriptionProps,
169
+ errorMessageProps
170
+ } = useFormattedTextField(_objectSpread2(_objectSpread2(_objectSpread2({}, otherProps), domProps), {}, {
171
+ name: undefined,
172
+ label,
173
+ autoFocus,
174
+ isDisabled,
175
+ isReadOnly,
176
+ isRequired,
177
+ validate: undefined,
178
+ [privateValidationStateProp]: state,
179
+ value: inputValue,
180
+ defaultValue: undefined,
181
+ // defaultValue already used to populate state.inputValue, unneeded here
182
+ autoComplete: 'off',
183
+ 'aria-label': props['aria-label'] || undefined,
184
+ 'aria-labelledby': props['aria-labelledby'] || undefined,
185
+ id: inputId,
186
+ type: 'text',
187
+ // Can't use type="number" because then we can't have things like $ in the field.
188
+ inputMode,
189
+ onChange,
190
+ onBlur,
191
+ onFocus,
192
+ onFocusChange,
193
+ onKeyDown: useMemo(() => chain(onKeyDownEnter, onKeyDown), [onKeyDownEnter, onKeyDown]),
194
+ onKeyUp,
195
+ description,
196
+ errorMessage
197
+ }), state, inputRef);
198
+ useFormReset(inputRef, state.numberValue, state.setNumberValue);
199
+ let inputProps = mergeProps(spinButtonProps, focusProps, textFieldProps, {
200
+ // override the spinbutton role, we can't focus a spin button with VO
201
+ role: null,
202
+ // ignore aria-roledescription on iOS so that required state will announce when it is present
203
+ 'aria-roledescription': !isIOS() ? format('numberField') : null,
204
+ 'aria-valuemax': null,
205
+ 'aria-valuemin': null,
206
+ 'aria-valuenow': null,
207
+ 'aria-valuetext': null,
208
+ autoCorrect: 'off',
209
+ spellCheck: 'false'
210
+ });
211
+ if (props.validationBehavior === 'native') {
212
+ inputProps['aria-required'] = undefined;
213
+ }
214
+ let onButtonPressStart = e => {
215
+ // If focus is already on the input, keep it there so we don't hide the
216
+ // software keyboard when tapping the increment/decrement buttons.
217
+ if (document.activeElement === inputRef.current) {
218
+ return;
219
+ }
220
+
221
+ // Otherwise, when using a mouse, move focus to the input.
222
+ // On touch, or with a screen reader, focus the button so that the software
223
+ // keyboard does not appear and the screen reader cursor is not moved off the button.
224
+ if (e.pointerType === 'mouse') {
225
+ var _inputRef$current;
226
+ (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
227
+ } else {
228
+ e.target.focus();
229
+ }
230
+ };
231
+
232
+ // Determine the label for the increment and decrement buttons. There are 4 cases:
233
+ //
234
+ // 1. With a visible label that is a string: aria-label: `Increase ${props.label}`
235
+ // 2. With a visible label that is JSX: aria-label: 'Increase', aria-labelledby: '${incrementId} ${labelId}'
236
+ // 3. With an aria-label: aria-label: `Increase ${props['aria-label']}`
237
+ // 4. With an aria-labelledby: aria-label: 'Increase', aria-labelledby: `${incrementId} ${props['aria-labelledby']}`
238
+ //
239
+ // (1) and (2) could possibly be combined and both use aria-labelledby. However, placing the label in
240
+ // the aria-label string rather than using aria-labelledby gives more flexibility to translators to change
241
+ // the order or add additional words around the label if needed.
242
+ let fieldLabel = props['aria-label'] || (typeof props.label === 'string' ? props.label : '');
243
+ let ariaLabelledby;
244
+ if (!fieldLabel) {
245
+ ariaLabelledby = props.label != null ? labelProps.id : props['aria-labelledby'];
246
+ }
247
+ let incrementId = useId();
248
+ let decrementId = useId();
249
+ let incrementButtonProps = mergeProps(incButtonProps, {
250
+ 'aria-label': incrementAriaLabel || format('increase', {
251
+ fieldLabel
252
+ }).trim(),
253
+ id: ariaLabelledby && !incrementAriaLabel ? incrementId : null,
254
+ 'aria-labelledby': ariaLabelledby && !incrementAriaLabel ? `${incrementId} ${ariaLabelledby}` : null,
255
+ 'aria-controls': inputId,
256
+ excludeFromTabOrder: true,
257
+ preventFocusOnPress: true,
258
+ allowFocusWhenDisabled: true,
259
+ isDisabled: !state.canIncrement,
260
+ onPressStart: onButtonPressStart
261
+ });
262
+ let decrementButtonProps = mergeProps(decButtonProps, {
263
+ 'aria-label': decrementAriaLabel || format('decrease', {
264
+ fieldLabel
265
+ }).trim(),
266
+ id: ariaLabelledby && !decrementAriaLabel ? decrementId : null,
267
+ 'aria-labelledby': ariaLabelledby && !decrementAriaLabel ? `${decrementId} ${ariaLabelledby}` : null,
268
+ 'aria-controls': inputId,
269
+ excludeFromTabOrder: true,
270
+ preventFocusOnPress: true,
271
+ allowFocusWhenDisabled: true,
272
+ isDisabled: !state.canDecrement,
273
+ onPressStart: onButtonPressStart
274
+ });
275
+ return {
276
+ groupProps: _objectSpread2(_objectSpread2({}, focusWithinProps), {}, {
277
+ role: 'group',
278
+ 'aria-disabled': isDisabled,
279
+ 'aria-invalid': isInvalid ? 'true' : undefined
280
+ }),
281
+ labelProps,
282
+ inputProps,
283
+ incrementButtonProps,
284
+ decrementButtonProps,
285
+ errorMessageProps,
286
+ descriptionProps,
287
+ isInvalid,
288
+ validationErrors,
289
+ validationDetails
290
+ };
291
+ }
292
+
293
+ export { useNumberField };
294
+ //# sourceMappingURL=useNumberField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useNumberField.js","sources":["../../../../src/react-aria/react-aria/numberfield/useNumberField.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 { AriaButtonProps } from '../../react-types/button';\nimport { AriaNumberFieldProps } from '../../react-types/numberfield';\nimport { chain, filterDOMProps, isAndroid, isIOS, isIPhone, mergeProps, useFormReset, useId } from '../utils';\nimport { DOMAttributes, GroupDOMAttributes, TextInputDOMProps, ValidationResult } from '../../react-types/shared';\nimport { InputHTMLAttributes, LabelHTMLAttributes, RefObject, useCallback, useMemo, useState } from 'react';\n// @ts-ignore\nimport intlMessages from './intl';\nimport { NumberFieldState } from '../../react-stately/numberfield';\nimport { privateValidationStateProp } from '../../react-stately/form';\nimport { useFocus, useFocusWithin, useScrollWheel } from '../interactions';\nimport { useFormattedTextField } from '../textfield';\nimport { useMessageFormatter, useNumberFormatter } from '../i18n';\nimport { useSpinButton } from '../spinbutton';\n\nexport interface NumberFieldAria extends ValidationResult {\n /** Props for the label element. */\n labelProps: LabelHTMLAttributes<HTMLLabelElement>;\n /** Props for the group wrapper around the input and stepper buttons. */\n groupProps: GroupDOMAttributes;\n /** Props for the input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>;\n /** Props for the increment button, to be passed to [useButton](useButton.html). */\n incrementButtonProps: AriaButtonProps;\n /** Props for the decrement button, to be passed to [useButton](useButton.html). */\n decrementButtonProps: AriaButtonProps;\n /** Props for the number field's description element, if any. */\n descriptionProps: DOMAttributes;\n /** Props for the number field's error message element, if any. */\n errorMessageProps: DOMAttributes;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a number field component.\n * Number fields allow users to enter a number, and increment or decrement the value using stepper buttons.\n */\nexport function useNumberField(\n props: AriaNumberFieldProps,\n state: NumberFieldState,\n inputRef: RefObject<HTMLInputElement>\n): NumberFieldAria {\n let {\n id,\n decrementAriaLabel,\n incrementAriaLabel,\n isDisabled,\n isReadOnly,\n isRequired,\n minValue,\n maxValue,\n autoFocus,\n label,\n formatOptions,\n onBlur = () => {},\n onFocus,\n onFocusChange,\n onKeyDown,\n onKeyUp,\n description,\n errorMessage,\n isWheelDisabled,\n ...otherProps\n } = props;\n\n let { increment, incrementToMax, decrement, decrementToMin, numberValue, inputValue, commit, commitValidation } =\n state;\n\n const format = useMessageFormatter(intlMessages);\n\n let inputId = useId(id);\n let { focusProps } = useFocus({\n onBlur() {\n // Set input value to normalized valid value\n commit();\n },\n });\n\n let numberFormatter = useNumberFormatter(formatOptions);\n let intlOptions = useMemo(() => numberFormatter.resolvedOptions(), [numberFormatter]);\n\n // Replace negative textValue formatted using currencySign: 'accounting'\n // with a textValue that can be announced using a minus sign.\n let textValueFormatter = useNumberFormatter({ ...formatOptions, currencySign: undefined });\n let textValue = useMemo(\n () => (isNaN(numberValue) ? '' : textValueFormatter.format(numberValue)),\n [textValueFormatter, numberValue]\n );\n\n let {\n spinButtonProps,\n incrementButtonProps: incButtonProps,\n decrementButtonProps: decButtonProps,\n } = useSpinButton({\n isDisabled,\n isReadOnly,\n isRequired,\n maxValue,\n minValue,\n onIncrement: increment,\n onIncrementToMax: incrementToMax,\n onDecrement: decrement,\n onDecrementToMin: decrementToMin,\n value: numberValue,\n textValue,\n });\n\n let [focusWithin, setFocusWithin] = useState(false);\n let { focusWithinProps } = useFocusWithin({ isDisabled, onFocusWithinChange: setFocusWithin });\n\n let onWheel = useCallback(\n (e) => {\n // if on a trackpad, users can scroll in both X and Y at once, check the magnitude of the change\n // if it's mostly in the X direction, then just return, the user probably doesn't mean to inc/dec\n // this isn't perfect, events come in fast with small deltas and a part of the scroll may give a false indication\n // especially if the user is scrolling near 45deg\n if (Math.abs(e.deltaY) <= Math.abs(e.deltaX)) {\n return;\n }\n if (e.deltaY > 0) {\n increment();\n } else if (e.deltaY < 0) {\n decrement();\n }\n },\n [decrement, increment]\n );\n // If the input isn't supposed to receive input, disable scrolling.\n let scrollingDisabled = isWheelDisabled || isDisabled || isReadOnly || !focusWithin;\n useScrollWheel({ onScroll: onWheel, isDisabled: scrollingDisabled }, inputRef);\n\n // The inputMode attribute influences the software keyboard that is shown on touch devices.\n // Browsers and operating systems are quite inconsistent about what keys are available, however.\n // We choose between numeric and decimal based on whether we allow negative and fractional numbers,\n // and based on testing on various devices to determine what keys are available in each inputMode.\n let hasDecimals = intlOptions.maximumFractionDigits > 0;\n let hasNegative = state.minValue === undefined || isNaN(state.minValue) || state.minValue < 0;\n let inputMode: TextInputDOMProps['inputMode'] = 'numeric';\n if (isIPhone()) {\n // iPhone doesn't have a minus sign in either numeric or decimal.\n // Note this is only for iPhone, not iPad, which always has both\n // minus and decimal in numeric.\n if (hasNegative) {\n inputMode = 'text';\n } else if (hasDecimals) {\n inputMode = 'decimal';\n }\n } else if (isAndroid()) {\n // Android numeric has both a decimal point and minus key.\n // decimal does not have a minus key.\n if (hasNegative) {\n inputMode = 'numeric';\n } else if (hasDecimals) {\n inputMode = 'decimal';\n }\n }\n\n let onChange = (value) => {\n if (state.validate(value)) {\n state.setInputValue(value);\n }\n };\n\n let domProps = filterDOMProps(props);\n let onKeyDownEnter = useCallback(\n (e) => {\n if (e.key === 'Enter') {\n commit();\n commitValidation();\n } else {\n e.continuePropagation();\n }\n },\n [commit, commitValidation]\n );\n\n let { isInvalid, validationErrors, validationDetails } = state.displayValidation;\n let {\n labelProps,\n inputProps: textFieldProps,\n descriptionProps,\n errorMessageProps,\n } = useFormattedTextField(\n {\n ...otherProps,\n ...domProps,\n name: undefined,\n label,\n autoFocus,\n isDisabled,\n isReadOnly,\n isRequired,\n validate: undefined,\n [privateValidationStateProp]: state,\n value: inputValue,\n defaultValue: undefined, // defaultValue already used to populate state.inputValue, unneeded here\n autoComplete: 'off',\n 'aria-label': props['aria-label'] || undefined,\n 'aria-labelledby': props['aria-labelledby'] || undefined,\n id: inputId,\n type: 'text', // Can't use type=\"number\" because then we can't have things like $ in the field.\n inputMode,\n onChange,\n onBlur,\n onFocus,\n onFocusChange,\n onKeyDown: useMemo(() => chain(onKeyDownEnter, onKeyDown), [onKeyDownEnter, onKeyDown]),\n onKeyUp,\n description,\n errorMessage,\n },\n state,\n inputRef\n );\n\n useFormReset(inputRef, state.numberValue, state.setNumberValue);\n\n let inputProps: InputHTMLAttributes<HTMLInputElement> = mergeProps(spinButtonProps, focusProps, textFieldProps, {\n // override the spinbutton role, we can't focus a spin button with VO\n role: null,\n // ignore aria-roledescription on iOS so that required state will announce when it is present\n 'aria-roledescription': !isIOS() ? format('numberField') : null,\n 'aria-valuemax': null,\n 'aria-valuemin': null,\n 'aria-valuenow': null,\n 'aria-valuetext': null,\n autoCorrect: 'off',\n spellCheck: 'false',\n });\n\n if (props.validationBehavior === 'native') {\n inputProps['aria-required'] = undefined;\n }\n\n let onButtonPressStart = (e) => {\n // If focus is already on the input, keep it there so we don't hide the\n // software keyboard when tapping the increment/decrement buttons.\n if (document.activeElement === inputRef.current) {\n return;\n }\n\n // Otherwise, when using a mouse, move focus to the input.\n // On touch, or with a screen reader, focus the button so that the software\n // keyboard does not appear and the screen reader cursor is not moved off the button.\n if (e.pointerType === 'mouse') {\n inputRef.current?.focus();\n } else {\n e.target.focus();\n }\n };\n\n // Determine the label for the increment and decrement buttons. There are 4 cases:\n //\n // 1. With a visible label that is a string: aria-label: `Increase ${props.label}`\n // 2. With a visible label that is JSX: aria-label: 'Increase', aria-labelledby: '${incrementId} ${labelId}'\n // 3. With an aria-label: aria-label: `Increase ${props['aria-label']}`\n // 4. With an aria-labelledby: aria-label: 'Increase', aria-labelledby: `${incrementId} ${props['aria-labelledby']}`\n //\n // (1) and (2) could possibly be combined and both use aria-labelledby. However, placing the label in\n // the aria-label string rather than using aria-labelledby gives more flexibility to translators to change\n // the order or add additional words around the label if needed.\n let fieldLabel = props['aria-label'] || (typeof props.label === 'string' ? props.label : '');\n let ariaLabelledby: string | undefined;\n if (!fieldLabel) {\n ariaLabelledby = props.label != null ? labelProps.id : props['aria-labelledby'];\n }\n\n let incrementId = useId();\n let decrementId = useId();\n\n let incrementButtonProps: AriaButtonProps = mergeProps(incButtonProps, {\n 'aria-label': incrementAriaLabel || format('increase', { fieldLabel }).trim(),\n id: ariaLabelledby && !incrementAriaLabel ? incrementId : null,\n 'aria-labelledby': ariaLabelledby && !incrementAriaLabel ? `${incrementId} ${ariaLabelledby}` : null,\n 'aria-controls': inputId,\n excludeFromTabOrder: true,\n preventFocusOnPress: true,\n allowFocusWhenDisabled: true,\n isDisabled: !state.canIncrement,\n onPressStart: onButtonPressStart,\n });\n\n let decrementButtonProps: AriaButtonProps = mergeProps(decButtonProps, {\n 'aria-label': decrementAriaLabel || format('decrease', { fieldLabel }).trim(),\n id: ariaLabelledby && !decrementAriaLabel ? decrementId : null,\n 'aria-labelledby': ariaLabelledby && !decrementAriaLabel ? `${decrementId} ${ariaLabelledby}` : null,\n 'aria-controls': inputId,\n excludeFromTabOrder: true,\n preventFocusOnPress: true,\n allowFocusWhenDisabled: true,\n isDisabled: !state.canDecrement,\n onPressStart: onButtonPressStart,\n });\n\n return {\n groupProps: {\n ...focusWithinProps,\n role: 'group',\n 'aria-disabled': isDisabled,\n 'aria-invalid': isInvalid ? 'true' : undefined,\n },\n labelProps,\n inputProps,\n incrementButtonProps,\n decrementButtonProps,\n errorMessageProps,\n descriptionProps,\n isInvalid,\n validationErrors,\n validationDetails,\n };\n}\n"],"names":["useNumberField","props","state","inputRef","id","decrementAriaLabel","incrementAriaLabel","isDisabled","isReadOnly","isRequired","minValue","maxValue","autoFocus","label","formatOptions","onBlur","onFocus","onFocusChange","onKeyDown","onKeyUp","description","errorMessage","isWheelDisabled","otherProps","_objectWithoutProperties","_excluded","increment","incrementToMax","decrement","decrementToMin","numberValue","inputValue","commit","commitValidation","format","useMessageFormatter","intlMessages","inputId","useId","focusProps","useFocus","numberFormatter","useNumberFormatter","intlOptions","useMemo","resolvedOptions","textValueFormatter","_objectSpread","currencySign","undefined","textValue","isNaN","spinButtonProps","incrementButtonProps","incButtonProps","decrementButtonProps","decButtonProps","useSpinButton","onIncrement","onIncrementToMax","onDecrement","onDecrementToMin","value","focusWithin","setFocusWithin","useState","focusWithinProps","useFocusWithin","onFocusWithinChange","onWheel","useCallback","e","Math","abs","deltaY","deltaX","scrollingDisabled","useScrollWheel","onScroll","hasDecimals","maximumFractionDigits","hasNegative","inputMode","isIPhone","isAndroid","onChange","validate","setInputValue","domProps","filterDOMProps","onKeyDownEnter","key","continuePropagation","isInvalid","validationErrors","validationDetails","displayValidation","labelProps","inputProps","textFieldProps","descriptionProps","errorMessageProps","useFormattedTextField","name","privateValidationStateProp","defaultValue","autoComplete","type","chain","useFormReset","setNumberValue","mergeProps","role","isIOS","autoCorrect","spellCheck","validationBehavior","onButtonPressStart","document","activeElement","current","pointerType","_inputRef$current","focus","target","fieldLabel","ariaLabelledby","incrementId","decrementId","trim","excludeFromTabOrder","preventFocusOnPress","allowFocusWhenDisabled","canIncrement","onPressStart","canDecrement","groupProps"],"mappings":";;;;;;;;;;;;;;;;;;;AA6CA;AACA;AACA;AACA;AACO,SAASA,cAAcA,CAC5BC,KAA2B,EAC3BC,KAAuB,EACvBC,QAAqC,EACpB;EACjB,IAAI;MACFC,EAAE;MACFC,kBAAkB;MAClBC,kBAAkB;MAClBC,UAAU;MACVC,UAAU;MACVC,UAAU;MACVC,QAAQ;MACRC,QAAQ;MACRC,SAAS;MACTC,KAAK;MACLC,aAAa;AACbC,MAAAA,MAAM,GAAGA,MAAM,EAAE;MACjBC,OAAO;MACPC,aAAa;MACbC,SAAS;MACTC,OAAO;MACPC,WAAW;MACXC,YAAY;AACZC,MAAAA,eAAAA;AAEF,KAAC,GAAGrB,KAAK;AADJsB,IAAAA,UAAU,GAAAC,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2H,WAAW,GAAG,IAAI;AAC9D,IAAA,iBAAiB,EAAEF,cAAc,IAAI,CAACzH,kBAAkB,GAAI,CAAE2H,EAAAA,WAAY,CAAGF,CAAAA,EAAAA,cAAe,CAAC,CAAA,GAAG,IAAI;AACpG,IAAA,eAAe,EAAEzF,OAAO;AACxB6F,IAAAA,mBAAmB,EAAE,IAAI;AACzBC,IAAAA,mBAAmB,EAAE,IAAI;AACzBC,IAAAA,sBAAsB,EAAE,IAAI;AAC5B7H,IAAAA,UAAU,EAAE,CAACL,KAAK,CAACqI,YAAY;AAC/BD,IAAAA,YAAY,EAAEjB,kBAAAA;AAChB,GAAC,CAAC,CAAA;EAEF,OAAO;AACLmB,IAAAA,UAAU,EAAAzF,cAAA,CAAAA,cAAA,KACLmB,gBAAgB,CAAA,EAAA,EAAA,EAAA;AACnB8C,MAAAA,IAAI,EAAE,OAAO;AACb,MAAA,eAAe,EAAEzG,UAAU;AAC3B,MAAA,cAAc,EAAEsF,SAAS,GAAG,MAAM,GAAG5C,SAAAA;KACtC,CAAA;IACDgD,UAAU;IACVC,UAAU;IACV7C,oBAAoB;IACpBE,oBAAoB;IACpB8C,iBAAiB;IACjBD,gBAAgB;IAChBP,SAAS;IACTC,gBAAgB;AAChBC,IAAAA,iBAAAA;GACD,CAAA;AACH;;;;"}
@@ -0,0 +1,7 @@
1
+ var Empty = "Empty";
2
+ var enUS = {
3
+ Empty: Empty
4
+ };
5
+
6
+ export { Empty, enUS as default };
7
+ //# sourceMappingURL=en-US.json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"en-US.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -0,0 +1,7 @@
1
+ var Empty = "Vide";
2
+ var frFR = {
3
+ Empty: Empty
4
+ };
5
+
6
+ export { Empty, frFR as default };
7
+ //# sourceMappingURL=fr-FR.json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fr-FR.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -0,0 +1,10 @@
1
+ import enUS from './en-US.json.js';
2
+ import frFR from './fr-FR.json.js';
3
+
4
+ var intlMessages = {
5
+ 'en-US': enUS,
6
+ 'fr-FR': frFR
7
+ };
8
+
9
+ export { intlMessages as default };
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../../src/react-aria/react-aria/spinbutton/intl/index.ts"],"sourcesContent":["import enUS from './en-US.json';\nimport frFR from './fr-FR.json';\n\nexport default {\n 'en-US': enUS,\n 'fr-FR': frFR,\n};\n"],"names":["enUS","frFR"],"mappings":";;;AAGA,mBAAe;AACb,EAAA,OAAO,EAAEA,IAAI;AACb,EAAA,OAAO,EAAEC,IAAAA;AACX,CAAC;;;;"}
@@ -0,0 +1,168 @@
1
+ import intlMessages from './intl/index.js';
2
+ import { useRef, useEffect } from 'react';
3
+ import { useMessageFormatter } from '../i18n/useMessageFormatter.js';
4
+ import { clearAnnouncer, announce } from '../live-announcer/LiveAnnouncer.js';
5
+ import { useEffectEvent } from '../utils/useEffectEvent.js';
6
+ import { useGlobalListeners } from '../utils/useGlobalListeners.js';
7
+
8
+ /* eslint-disable prefer-const */
9
+ function useSpinButton(props) {
10
+ const _async = useRef();
11
+ let {
12
+ value,
13
+ textValue,
14
+ minValue,
15
+ maxValue,
16
+ isDisabled,
17
+ isReadOnly,
18
+ isRequired,
19
+ onIncrement,
20
+ onIncrementPage,
21
+ onDecrement,
22
+ onDecrementPage,
23
+ onDecrementToMin,
24
+ onIncrementToMax
25
+ } = props;
26
+ const format = useMessageFormatter(intlMessages);
27
+ const clearAsync = () => clearTimeout(_async.current);
28
+
29
+ // eslint-disable-next-line arrow-body-style
30
+ useEffect(() => {
31
+ return () => clearAsync();
32
+ }, []);
33
+ let onKeyDown = e => {
34
+ if (e.ctrlKey || e.metaKey || e.shiftKey || e.altKey || isReadOnly) {
35
+ return;
36
+ }
37
+ switch (e.key) {
38
+ case 'PageUp':
39
+ if (onIncrementPage) {
40
+ e.preventDefault();
41
+ onIncrementPage === null || onIncrementPage === void 0 ? void 0 : onIncrementPage();
42
+ break;
43
+ }
44
+ // fallthrough!
45
+ case 'ArrowUp':
46
+ case 'Up':
47
+ if (onIncrement) {
48
+ e.preventDefault();
49
+ onIncrement === null || onIncrement === void 0 ? void 0 : onIncrement();
50
+ }
51
+ break;
52
+ case 'PageDown':
53
+ if (onDecrementPage) {
54
+ e.preventDefault();
55
+ onDecrementPage === null || onDecrementPage === void 0 ? void 0 : onDecrementPage();
56
+ break;
57
+ }
58
+ // fallthrough
59
+ case 'ArrowDown':
60
+ case 'Down':
61
+ if (onDecrement) {
62
+ e.preventDefault();
63
+ onDecrement === null || onDecrement === void 0 ? void 0 : onDecrement();
64
+ }
65
+ break;
66
+ case 'Home':
67
+ if (onDecrementToMin) {
68
+ e.preventDefault();
69
+ onDecrementToMin === null || onDecrementToMin === void 0 ? void 0 : onDecrementToMin();
70
+ }
71
+ break;
72
+ case 'End':
73
+ if (onIncrementToMax) {
74
+ e.preventDefault();
75
+ onIncrementToMax === null || onIncrementToMax === void 0 ? void 0 : onIncrementToMax();
76
+ }
77
+ break;
78
+ }
79
+ };
80
+ let isFocused = useRef(false);
81
+ let onFocus = () => {
82
+ isFocused.current = true;
83
+ };
84
+ let onBlur = () => {
85
+ isFocused.current = false;
86
+ };
87
+
88
+ // Replace Unicode hyphen-minus (U+002D) with minus sign (U+2212).
89
+ // This ensures that macOS VoiceOver announces it as "minus" even with other characters between the minus sign
90
+ // and the number (e.g. currency symbol). Otherwise it announces nothing because it assumes the character is a hyphen.
91
+ // In addition, replace the empty string with the word "Empty" so that iOS VoiceOver does not read "50%" for an empty field.
92
+ let ariaTextValue = textValue === '' ? format('Empty') : (textValue || `${value}`).replace('-', '\u2212');
93
+ useEffect(() => {
94
+ if (isFocused.current) {
95
+ clearAnnouncer('assertive');
96
+ announce(ariaTextValue, 'assertive');
97
+ }
98
+ }, [ariaTextValue]);
99
+ const onIncrementPressStart = useEffectEvent(initialStepDelay => {
100
+ clearAsync();
101
+ onIncrement === null || onIncrement === void 0 ? void 0 : onIncrement();
102
+ // Start spinning after initial delay
103
+ _async.current = window.setTimeout(() => {
104
+ if (maxValue === undefined || isNaN(maxValue) || value === undefined || isNaN(value) || value < maxValue) {
105
+ onIncrementPressStart(60);
106
+ }
107
+ }, initialStepDelay);
108
+ });
109
+ const onDecrementPressStart = useEffectEvent(initialStepDelay => {
110
+ clearAsync();
111
+ onDecrement === null || onDecrement === void 0 ? void 0 : onDecrement();
112
+ // Start spinning after initial delay
113
+ _async.current = window.setTimeout(() => {
114
+ if (minValue === undefined || isNaN(minValue) || value === undefined || isNaN(value) || value > minValue) {
115
+ onDecrementPressStart(60);
116
+ }
117
+ }, initialStepDelay);
118
+ });
119
+ let cancelContextMenu = e => {
120
+ e.preventDefault();
121
+ };
122
+ let {
123
+ addGlobalListener,
124
+ removeAllGlobalListeners
125
+ } = useGlobalListeners();
126
+ return {
127
+ spinButtonProps: {
128
+ role: 'spinbutton',
129
+ 'aria-valuenow': value !== undefined && !isNaN(value) ? value : undefined,
130
+ 'aria-valuetext': ariaTextValue,
131
+ 'aria-valuemin': minValue,
132
+ 'aria-valuemax': maxValue,
133
+ 'aria-disabled': isDisabled || undefined,
134
+ 'aria-readonly': isReadOnly || undefined,
135
+ 'aria-required': isRequired || undefined,
136
+ onKeyDown,
137
+ onFocus,
138
+ onBlur
139
+ },
140
+ incrementButtonProps: {
141
+ onPressStart: () => {
142
+ onIncrementPressStart(400);
143
+ addGlobalListener(window, 'contextmenu', cancelContextMenu);
144
+ },
145
+ onPressEnd: () => {
146
+ clearAsync();
147
+ removeAllGlobalListeners();
148
+ },
149
+ onFocus,
150
+ onBlur
151
+ },
152
+ decrementButtonProps: {
153
+ onPressStart: () => {
154
+ onDecrementPressStart(400);
155
+ addGlobalListener(window, 'contextmenu', cancelContextMenu);
156
+ },
157
+ onPressEnd: () => {
158
+ clearAsync();
159
+ removeAllGlobalListeners();
160
+ },
161
+ onFocus,
162
+ onBlur
163
+ }
164
+ };
165
+ }
166
+
167
+ export { useSpinButton };
168
+ //# sourceMappingURL=useSpinButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSpinButton.js","sources":["../../../../src/react-aria/react-aria/spinbutton/useSpinButton.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 { announce, clearAnnouncer } from '../live-announcer';\nimport { AriaButtonProps } from '../../react-types/button';\nimport { DOMAttributes, InputBase, RangeInputBase, Validation, ValueBase } from '../../react-types/shared';\n// @ts-ignore\nimport intlMessages from './intl';\nimport { useEffect, useRef } from 'react';\nimport { useEffectEvent, useGlobalListeners } from '../utils';\n\nimport { useMessageFormatter } from '../i18n';\n\nexport interface SpinButtonProps extends InputBase, Validation<number>, ValueBase<number>, RangeInputBase<number> {\n textValue?: string;\n onIncrement?: () => void;\n onIncrementPage?: () => void;\n onDecrement?: () => void;\n onDecrementPage?: () => void;\n onDecrementToMin?: () => void;\n onIncrementToMax?: () => void;\n}\n\nexport interface SpinbuttonAria {\n spinButtonProps: DOMAttributes;\n incrementButtonProps: AriaButtonProps;\n decrementButtonProps: AriaButtonProps;\n}\n\nexport function useSpinButton(props: SpinButtonProps): SpinbuttonAria {\n const _async = useRef<number>();\n let {\n value,\n textValue,\n minValue,\n maxValue,\n isDisabled,\n isReadOnly,\n isRequired,\n onIncrement,\n onIncrementPage,\n onDecrement,\n onDecrementPage,\n onDecrementToMin,\n onIncrementToMax,\n } = props;\n const format = useMessageFormatter(intlMessages);\n\n const clearAsync = () => clearTimeout(_async.current);\n\n // eslint-disable-next-line arrow-body-style\n useEffect(() => {\n return () => clearAsync();\n }, []);\n\n let onKeyDown = (e) => {\n if (e.ctrlKey || e.metaKey || e.shiftKey || e.altKey || isReadOnly) {\n return;\n }\n\n switch (e.key) {\n case 'PageUp':\n if (onIncrementPage) {\n e.preventDefault();\n onIncrementPage?.();\n break;\n }\n // fallthrough!\n case 'ArrowUp':\n case 'Up':\n if (onIncrement) {\n e.preventDefault();\n onIncrement?.();\n }\n break;\n case 'PageDown':\n if (onDecrementPage) {\n e.preventDefault();\n onDecrementPage?.();\n break;\n }\n // fallthrough\n case 'ArrowDown':\n case 'Down':\n if (onDecrement) {\n e.preventDefault();\n onDecrement?.();\n }\n break;\n case 'Home':\n if (onDecrementToMin) {\n e.preventDefault();\n onDecrementToMin?.();\n }\n break;\n case 'End':\n if (onIncrementToMax) {\n e.preventDefault();\n onIncrementToMax?.();\n }\n break;\n }\n };\n\n let isFocused = useRef(false);\n let onFocus = () => {\n isFocused.current = true;\n };\n\n let onBlur = () => {\n isFocused.current = false;\n };\n\n // Replace Unicode hyphen-minus (U+002D) with minus sign (U+2212).\n // This ensures that macOS VoiceOver announces it as \"minus\" even with other characters between the minus sign\n // and the number (e.g. currency symbol). Otherwise it announces nothing because it assumes the character is a hyphen.\n // In addition, replace the empty string with the word \"Empty\" so that iOS VoiceOver does not read \"50%\" for an empty field.\n let ariaTextValue = textValue === '' ? format('Empty') : (textValue || `${value}`).replace('-', '\\u2212');\n\n useEffect(() => {\n if (isFocused.current) {\n clearAnnouncer('assertive');\n announce(ariaTextValue, 'assertive');\n }\n }, [ariaTextValue]);\n\n const onIncrementPressStart = useEffectEvent((initialStepDelay: number) => {\n clearAsync();\n onIncrement?.();\n // Start spinning after initial delay\n _async.current = window.setTimeout(() => {\n if (maxValue === undefined || isNaN(maxValue) || value === undefined || isNaN(value) || value < maxValue) {\n onIncrementPressStart(60);\n }\n }, initialStepDelay);\n });\n\n const onDecrementPressStart = useEffectEvent((initialStepDelay: number) => {\n clearAsync();\n onDecrement?.();\n // Start spinning after initial delay\n _async.current = window.setTimeout(() => {\n if (minValue === undefined || isNaN(minValue) || value === undefined || isNaN(value) || value > minValue) {\n onDecrementPressStart(60);\n }\n }, initialStepDelay);\n });\n\n let cancelContextMenu = (e) => {\n e.preventDefault();\n };\n\n let { addGlobalListener, removeAllGlobalListeners } = useGlobalListeners();\n\n return {\n spinButtonProps: {\n role: 'spinbutton',\n 'aria-valuenow': value !== undefined && !isNaN(value) ? value : undefined,\n 'aria-valuetext': ariaTextValue,\n 'aria-valuemin': minValue,\n 'aria-valuemax': maxValue,\n 'aria-disabled': isDisabled || undefined,\n 'aria-readonly': isReadOnly || undefined,\n 'aria-required': isRequired || undefined,\n onKeyDown,\n onFocus,\n onBlur,\n },\n incrementButtonProps: {\n onPressStart: () => {\n onIncrementPressStart(400);\n addGlobalListener(window, 'contextmenu', cancelContextMenu);\n },\n onPressEnd: () => {\n clearAsync();\n removeAllGlobalListeners();\n },\n onFocus,\n onBlur,\n },\n decrementButtonProps: {\n onPressStart: () => {\n onDecrementPressStart(400);\n addGlobalListener(window, 'contextmenu', cancelContextMenu);\n },\n onPressEnd: () => {\n clearAsync();\n removeAllGlobalListeners();\n },\n onFocus,\n onBlur,\n },\n };\n}\n"],"names":["useSpinButton","props","_async","useRef","value","textValue","minValue","maxValue","isDisabled","isReadOnly","isRequired","onIncrement","onIncrementPage","onDecrement","onDecrementPage","onDecrementToMin","onIncrementToMax","format","useMessageFormatter","intlMessages","clearAsync","clearTimeout","current","useEffect","onKeyDown","e","ctrlKey","metaKey","shiftKey","altKey","key","preventDefault","isFocused","onFocus","onBlur","ariaTextValue","replace","clearAnnouncer","announce","onIncrementPressStart","useEffectEvent","initialStepDelay","window","setTimeout","undefined","isNaN","onDecrementPressStart","cancelContextMenu","addGlobalListener","removeAllGlobalListeners","useGlobalListeners","spinButtonProps","role","incrementButtonProps","onPressStart","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a,EAAEK,iBAAiB,CAAC,CAAA;OAC5D;MACDQ,UAAU,EAAEA,MAAM;AAChBnC,QAAAA,UAAU,EAAE,CAAA;AACZ6B,QAAAA,wBAAwB,EAAE,CAAA;OAC3B;MACDhB,OAAO;AACPC,MAAAA,MAAAA;KACD;AACDsB,IAAAA,oBAAoB,EAAE;MACpBF,YAAY,EAAEA,MAAM;QAClBR,qBAAqB,CAAC,GAAG,CAAC,CAAA;AAC1BE,QAAAA,iBAAiB,CAACN,MAAM,EAAE,aAAa,EAAEK,iBAAiB,CAAC,CAAA;OAC5D;MACDQ,UAAU,EAAEA,MAAM;AAChBnC,QAAAA,UAAU,EAAE,CAAA;AACZ6B,QAAAA,wBAAwB,EAAE,CAAA;OAC3B;MACDhB,OAAO;AACPC,MAAAA,MAAAA;AACF,KAAA;GACD,CAAA;AACH;;;;"}
@@ -0,0 +1,22 @@
1
+ import { ReactNode } from 'react';
2
+
3
+ interface SSRProviderProps {
4
+ /** Your application here. */
5
+ children: ReactNode;
6
+ }
7
+ /**
8
+ * When using SSR with React Aria in React 16 or 17, applications must be wrapped in an SSRProvider.
9
+ * This ensures that auto generated ids are consistent between the client and server.
10
+ */
11
+ declare function SSRProvider(props: SSRProviderProps): JSX.Element;
12
+ declare function useModernSSRSafeId(defaultId?: string): string;
13
+ /** @private */
14
+ declare const useSSRSafeId: typeof useModernSSRSafeId;
15
+ /**
16
+ * Returns whether the component is currently being server side rendered or
17
+ * hydrated on the client. Can be used to delay browser-specific rendering
18
+ * until after hydration.
19
+ */
20
+ declare function useIsSSR(): boolean;
21
+
22
+ export { SSRProvider, SSRProviderProps, useIsSSR, useSSRSafeId };