@ringcentral/spring-ui 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (766) hide show
  1. package/Accordion.js +64 -0
  2. package/AccordionHeader.js +33 -0
  3. package/Alert.js +28 -0
  4. package/Animation.js +46 -0
  5. package/Announcement.js +48 -0
  6. package/Autocomplete.js +1767 -0
  7. package/Avatar.js +105 -0
  8. package/AvatarGroup.js +9 -0
  9. package/Backdrop.js +9 -0
  10. package/Badge.js +15 -0
  11. package/Block.js +20 -0
  12. package/BlockHeader.js +18 -0
  13. package/BottomNavigation.js +145 -0
  14. package/BottomNavigationItem.js +30 -0
  15. package/Button.js +24 -0
  16. package/CallButton.js +39 -0
  17. package/Checkbox.js +55 -0
  18. package/Chip.js +26 -0
  19. package/CircularProgressIndicator.js +10 -0
  20. package/ClickAwayListener.js +1 -0
  21. package/ComponentsProps.js +1 -0
  22. package/DatePicker.js +485 -0
  23. package/DateUtilsContext.js +56 -0
  24. package/Dialer.js +587 -0
  25. package/Dialog.js +62 -0
  26. package/Divider.js +9 -0
  27. package/DragHandle.js +8 -0
  28. package/Drawer.js +19 -0
  29. package/Dropdown.js +132 -0
  30. package/EmptyState.js +17 -0
  31. package/FabButton.js +32 -0
  32. package/FocusTrap.js +48 -0
  33. package/FormField.js +10 -0
  34. package/FormLabel.js +9 -0
  35. package/Icon.js +9 -0
  36. package/IconButton.js +26 -0
  37. package/IconButtonGroup.js +18 -0
  38. package/InlineEditable.js +98 -0
  39. package/LICENSE +22 -0
  40. package/LinearProgressIndicator.js +44 -0
  41. package/Link.js +18 -0
  42. package/List.js +11 -0
  43. package/ListItem.js +22 -0
  44. package/ListItemText.js +18 -0
  45. package/ListNavigation.js +57 -0
  46. package/Menu.js +23 -0
  47. package/MenuActions.js +21 -0
  48. package/MenuDivider.js +10 -0
  49. package/MenuFooter.js +18 -0
  50. package/MenuHeader.js +18 -0
  51. package/MenuItem.js +32 -0
  52. package/MenuItemText.js +9 -0
  53. package/MenuList.js +33 -0
  54. package/Modal.js +16 -0
  55. package/NestedMenuContext.js +23 -0
  56. package/Option.js +46 -0
  57. package/Overlap.js +9 -0
  58. package/PageHeader.js +56 -0
  59. package/PickerTextField.js +33 -0
  60. package/Popover.js +21 -0
  61. package/Popper.js +127 -0
  62. package/PopperPaper.js +10 -0
  63. package/Portal.js +1 -0
  64. package/README.md +76 -0
  65. package/Radio.js +34 -0
  66. package/RadioGroup.js +29 -0
  67. package/Rating.js +235 -0
  68. package/Select.js +40 -0
  69. package/SingleFilter.js +130 -0
  70. package/Skeleton.js +32 -0
  71. package/Slider.js +110 -0
  72. package/Snackbar.js +118 -0
  73. package/SortableList.js +17 -0
  74. package/SortableListDndContext.js +49 -0
  75. package/SortableListItem.js +69 -0
  76. package/SortableVirtualizedList.js +36 -0
  77. package/SplitButton.js +173 -0
  78. package/Squircle.js +9 -0
  79. package/StatusIndicator.js +11 -0
  80. package/Step.js +65 -0
  81. package/StepButton.js +41 -0
  82. package/StepConnector.js +10 -0
  83. package/StepContent.js +53 -0
  84. package/StepIcon.js +11 -0
  85. package/StepLabel.js +14 -0
  86. package/Stepper.js +37 -0
  87. package/SubMenu.js +142 -0
  88. package/SwipeableDrawer.js +742 -0
  89. package/Switch.js +43 -0
  90. package/Tab.js +103 -0
  91. package/TabContext.js +34 -0
  92. package/TabPanel.js +26 -0
  93. package/Table.js +24 -0
  94. package/TableBody.js +20 -0
  95. package/TableCell.js +86 -0
  96. package/TableContainer.js +16 -0
  97. package/TableFooter.js +16 -0
  98. package/TableHead.js +24 -0
  99. package/TablePagination.js +122 -0
  100. package/TableRow.js +37 -0
  101. package/Tabs.js +827 -0
  102. package/Tag.js +28 -0
  103. package/Text.js +61 -0
  104. package/TextField.js +29 -0
  105. package/Textarea.js +67 -0
  106. package/TimePicker.js +600 -0
  107. package/Tooltip.js +23 -0
  108. package/Tray.js +13 -0
  109. package/TrayMenu.js +60 -0
  110. package/VirtualizedList.js +291 -0
  111. package/VirtualizedMenu.js +28 -0
  112. package/VisuallyHidden.js +8 -0
  113. package/chunks/AccordionContext.js +6 -0
  114. package/chunks/Alert.js +47 -0
  115. package/chunks/AvatarGroup.js +22 -0
  116. package/chunks/Backdrop.js +18 -0
  117. package/chunks/Badge.js +32 -0
  118. package/chunks/BottomNavigationItem.js +37 -0
  119. package/chunks/Button.js +89 -0
  120. package/chunks/Chip.js +78 -0
  121. package/chunks/CircularProgressIndicator.js +62 -0
  122. package/chunks/Divider.js +19 -0
  123. package/chunks/DragHandle.js +11 -0
  124. package/chunks/Drawer.js +61 -0
  125. package/chunks/ExpandCollapseCaret.js +24 -0
  126. package/chunks/FormLabel.js +27 -0
  127. package/chunks/Icon.js +25 -0
  128. package/chunks/IconButtonLabel.js +69 -0
  129. package/chunks/List.js +22 -0
  130. package/chunks/ListItem.js +86 -0
  131. package/chunks/Menu.js +41 -0
  132. package/chunks/MenuDivider.js +15 -0
  133. package/chunks/MenuItemText.js +16 -0
  134. package/chunks/MenuList.js +49 -0
  135. package/chunks/Modal.js +88 -0
  136. package/chunks/Overlap.js +25 -0
  137. package/chunks/PickerTextField.js +75 -0
  138. package/chunks/Popover.js +58 -0
  139. package/chunks/PopperPaper.js +15 -0
  140. package/chunks/RadioGroup.context.js +19 -0
  141. package/chunks/Select.js +257 -0
  142. package/chunks/ShowHideEye.js +56 -0
  143. package/chunks/SlideIn.js +19 -0
  144. package/chunks/SortableArrow.js +73 -0
  145. package/chunks/Squircle.js +38 -0
  146. package/chunks/StatusIndicator.js +19 -0
  147. package/chunks/StepConnector.js +21 -0
  148. package/chunks/StepIcon.js +45 -0
  149. package/chunks/StepLabel.js +29 -0
  150. package/chunks/StepperContext.js +16 -0
  151. package/chunks/TableContext.js +6 -0
  152. package/chunks/Tablelvl2Context.js +6 -0
  153. package/chunks/TabsContext.js +6 -0
  154. package/chunks/TextField.js +111 -0
  155. package/chunks/Tooltip.js +253 -0
  156. package/chunks/VirtualizedMenu.js +216 -0
  157. package/chunks/VisuallyHidden.js +12 -0
  158. package/chunks/getFade.js +23 -0
  159. package/chunks/getGrow.js +70 -0
  160. package/chunks/getSlideIn.js +30 -0
  161. package/chunks/useFocusTrapStack.js +44 -0
  162. package/chunks/useHelperTextId.js +46 -0
  163. package/chunks/useListNavigation.js +211 -0
  164. package/chunks/useMenuItemSelect.js +252 -0
  165. package/chunks/useMotionSafeTransition.js +13 -0
  166. package/chunks/useNestedMenuItem.js +16 -0
  167. package/chunks/useNestedParentMenu.js +54 -0
  168. package/chunks/usePrefersReducedMotion.js +42 -0
  169. package/chunks/useTooltipForceHide.js +31 -0
  170. package/chunks/useTrayNavigate.js +151 -0
  171. package/chunks/withTooltip.js +15 -0
  172. package/index.css +10891 -0
  173. package/index.d.ts +1 -0
  174. package/index.js +191 -0
  175. package/package.json +41 -0
  176. package/src/Accordion/Accordion.classes.d.ts +7 -0
  177. package/src/Accordion/Accordion.d.ts +5 -0
  178. package/src/Accordion/Accordion.type.d.ts +31 -0
  179. package/src/Accordion/AccordionContext.d.ts +9 -0
  180. package/src/Accordion/index.d.ts +4 -0
  181. package/src/AccordionHeader/AccordionHeader.classes.d.ts +7 -0
  182. package/src/AccordionHeader/AccordionHeader.d.ts +5 -0
  183. package/src/AccordionHeader/AccordionHeader.type.d.ts +25 -0
  184. package/src/AccordionHeader/index.d.ts +3 -0
  185. package/src/Alert/Alert.classes.d.ts +8 -0
  186. package/src/Alert/Alert.d.ts +7 -0
  187. package/src/Alert/Alert.type.d.ts +56 -0
  188. package/src/Alert/AlertTitle.classes.d.ts +7 -0
  189. package/src/Alert/index.d.ts +4 -0
  190. package/src/Animation/components/ExpandCollapseCaret/ExpandCollapseCaret.classes.d.ts +7 -0
  191. package/src/Animation/components/ExpandCollapseCaret/ExpandCollapseCaret.d.ts +17 -0
  192. package/src/Animation/components/ExpandCollapseCaret/index.d.ts +2 -0
  193. package/src/Animation/components/Fade/Fade.d.ts +5 -0
  194. package/src/Animation/components/Fade/getFade.d.ts +4 -0
  195. package/src/Animation/components/Fade/index.d.ts +2 -0
  196. package/src/Animation/components/Grow/Grow.d.ts +5 -0
  197. package/src/Animation/components/Grow/getGrow.d.ts +19 -0
  198. package/src/Animation/components/Grow/index.d.ts +2 -0
  199. package/src/Animation/components/ShowHideEye/ShowHideEye.classes.d.ts +7 -0
  200. package/src/Animation/components/ShowHideEye/ShowHideEye.d.ts +14 -0
  201. package/src/Animation/components/ShowHideEye/index.d.ts +2 -0
  202. package/src/Animation/components/SlideIn/SlideIn.d.ts +5 -0
  203. package/src/Animation/components/SlideIn/getSlideIn.d.ts +9 -0
  204. package/src/Animation/components/SlideIn/index.d.ts +2 -0
  205. package/src/Animation/components/SortableArrow/SortableArrow.classes.d.ts +7 -0
  206. package/src/Animation/components/SortableArrow/SortableArrow.d.ts +9 -0
  207. package/src/Animation/components/SortableArrow/index.d.ts +2 -0
  208. package/src/Animation/components/index.d.ts +7 -0
  209. package/src/Animation/components/types.d.ts +9 -0
  210. package/src/Animation/hooks/__mocks__/MatchMedia.mock.d.ts +12 -0
  211. package/src/Animation/hooks/index.d.ts +2 -0
  212. package/src/Animation/hooks/useMotionSafeTransition/index.d.ts +1 -0
  213. package/src/Animation/hooks/useMotionSafeTransition/useMotionSafeTransition.d.ts +10 -0
  214. package/src/Animation/hooks/usePrefersReducedMotion/index.d.ts +1 -0
  215. package/src/Animation/hooks/usePrefersReducedMotion/usePrefersReducedMotion.d.ts +1 -0
  216. package/src/Animation/index.d.ts +2 -0
  217. package/src/Announcement/Announcement.classes.d.ts +8 -0
  218. package/src/Announcement/Announcement.d.ts +5 -0
  219. package/src/Announcement/Announcement.type.d.ts +4 -0
  220. package/src/Announcement/index.d.ts +3 -0
  221. package/src/Autocomplete/Autocomplete.classes.d.ts +14 -0
  222. package/src/Autocomplete/Autocomplete.d.ts +11 -0
  223. package/src/Autocomplete/Autocomplete.type.d.ts +141 -0
  224. package/src/Autocomplete/SuggestionList/SuggestionList.classes.d.ts +7 -0
  225. package/src/Autocomplete/SuggestionList/SuggestionList.d.ts +144 -0
  226. package/src/Autocomplete/SuggestionList/SuggestionListItem.d.ts +28 -0
  227. package/src/Autocomplete/SuggestionList/index.d.ts +4 -0
  228. package/src/Autocomplete/SuggestionList/utils/SuggestionListItem.d.ts +33 -0
  229. package/src/Autocomplete/SuggestionList/utils/index.d.ts +5 -0
  230. package/src/Autocomplete/SuggestionList/utils/useDynamicHeight.d.ts +20 -0
  231. package/src/Autocomplete/SuggestionList/utils/useHighlightScroll.d.ts +33 -0
  232. package/src/Autocomplete/SuggestionList/utils/useSuggestionList.d.ts +101 -0
  233. package/src/Autocomplete/SuggestionList/utils/useSuggestionListGroup.d.ts +71 -0
  234. package/src/Autocomplete/index.d.ts +6 -0
  235. package/src/Autocomplete/useAutocomplete.d.ts +640 -0
  236. package/src/Autocomplete/useAutocompleteTag.d.ts +599 -0
  237. package/src/Avatar/Avatar.classes.d.ts +10 -0
  238. package/src/Avatar/Avatar.d.ts +4 -0
  239. package/src/Avatar/Avatar.type.d.ts +91 -0
  240. package/src/Avatar/index.d.ts +3 -0
  241. package/src/AvatarGroup/AvatarGroup.classes.d.ts +7 -0
  242. package/src/AvatarGroup/AvatarGroup.d.ts +6 -0
  243. package/src/AvatarGroup/AvatarGroup.type.d.ts +21 -0
  244. package/src/AvatarGroup/index.d.ts +3 -0
  245. package/src/Backdrop/Backdrop.classes.d.ts +7 -0
  246. package/src/Backdrop/Backdrop.d.ts +5 -0
  247. package/src/Backdrop/Backdrop.type.d.ts +9 -0
  248. package/src/Backdrop/index.d.ts +3 -0
  249. package/src/Badge/Badge.classes.d.ts +11 -0
  250. package/src/Badge/Badge.d.ts +8 -0
  251. package/src/Badge/Badge.type.d.ts +52 -0
  252. package/src/Badge/index.d.ts +3 -0
  253. package/src/Block/Block.classes.d.ts +8 -0
  254. package/src/Block/Block.d.ts +4 -0
  255. package/src/Block/Block.type.d.ts +44 -0
  256. package/src/Block/index.d.ts +3 -0
  257. package/src/BlockHeader/BlockHeader.classes.d.ts +7 -0
  258. package/src/BlockHeader/BlockHeader.d.ts +4 -0
  259. package/src/BlockHeader/BlockHeader.type.d.ts +19 -0
  260. package/src/BlockHeader/index.d.ts +3 -0
  261. package/src/BottomNavigation/BottomNavigation.classes.d.ts +7 -0
  262. package/src/BottomNavigation/BottomNavigation.d.ts +4 -0
  263. package/src/BottomNavigation/BottomNavigation.type.d.ts +62 -0
  264. package/src/BottomNavigation/BottomNavigationContext.d.ts +9 -0
  265. package/src/BottomNavigation/BottomNavigationGroup/BottomNavigationGroup.classes.d.ts +7 -0
  266. package/src/BottomNavigation/BottomNavigationGroup/BottomNavigationGroup.d.ts +5 -0
  267. package/src/BottomNavigation/BottomNavigationGroup/BottomNavigationGroup.type.d.ts +3 -0
  268. package/src/BottomNavigation/BottomNavigationGroup/index.d.ts +3 -0
  269. package/src/BottomNavigation/index.d.ts +5 -0
  270. package/src/BottomNavigationItem/BottomNavigationItem.classes.d.ts +7 -0
  271. package/src/BottomNavigationItem/BottomNavigationItem.d.ts +4 -0
  272. package/src/BottomNavigationItem/BottomNavigationItem.type.d.ts +63 -0
  273. package/src/BottomNavigationItem/index.d.ts +3 -0
  274. package/src/Button/Button.classes.d.ts +8 -0
  275. package/src/Button/Button.d.ts +6 -0
  276. package/src/Button/Button.type.d.ts +57 -0
  277. package/src/Button/index.d.ts +3 -0
  278. package/src/CallButton/CallButton.classes.d.ts +7 -0
  279. package/src/CallButton/CallButton.d.ts +4 -0
  280. package/src/CallButton/CallButton.type.d.ts +19 -0
  281. package/src/CallButton/index.d.ts +3 -0
  282. package/src/Checkbox/Checkbox.classes.d.ts +8 -0
  283. package/src/Checkbox/Checkbox.d.ts +13 -0
  284. package/src/Checkbox/Checkbox.type.d.ts +30 -0
  285. package/src/Checkbox/index.d.ts +3 -0
  286. package/src/Chip/Chip.classes.d.ts +7 -0
  287. package/src/Chip/Chip.d.ts +4 -0
  288. package/src/Chip/Chip.type.d.ts +65 -0
  289. package/src/Chip/index.d.ts +3 -0
  290. package/src/CircularProgressIndicator/CircularProgressIndicator.classes.d.ts +10 -0
  291. package/src/CircularProgressIndicator/CircularProgressIndicator.d.ts +5 -0
  292. package/src/CircularProgressIndicator/CircularProgressIndicator.type.d.ts +32 -0
  293. package/src/CircularProgressIndicator/index.d.ts +3 -0
  294. package/src/ClickAwayListener/index.d.ts +2 -0
  295. package/src/ComponentsProps.d.ts +207 -0
  296. package/src/DatePicker/Calendar.d.ts +41 -0
  297. package/src/DatePicker/DatePicker.classes.d.ts +7 -0
  298. package/src/DatePicker/DatePicker.context.d.ts +6 -0
  299. package/src/DatePicker/DatePicker.d.ts +6 -0
  300. package/src/DatePicker/DatePicker.type.d.ts +36 -0
  301. package/src/DatePicker/DatePickerHeader.d.ts +27 -0
  302. package/src/DatePicker/Day.d.ts +23 -0
  303. package/src/DatePicker/HearderAction.d.ts +3 -0
  304. package/src/DatePicker/SlideDirection.d.ts +1 -0
  305. package/src/DatePicker/Year.d.ts +21 -0
  306. package/src/DatePicker/Years.d.ts +21 -0
  307. package/src/DatePicker/index.d.ts +12 -0
  308. package/src/DatePicker/utils/DatePickerAriaLabelUtils.d.ts +16 -0
  309. package/src/DatePicker/utils/DatePickerUtils.d.ts +13 -0
  310. package/src/DatePicker/utils/findClosestEnabledDate.d.ts +13 -0
  311. package/src/DatePicker/utils/index.d.ts +3 -0
  312. package/src/DateUtilsContext/DateUtilsContext.d.ts +22 -0
  313. package/src/DateUtilsContext/index.d.ts +1 -0
  314. package/src/Dialer/DialDelete/DialDelete.d.ts +14 -0
  315. package/src/Dialer/DialDelete/index.d.ts +1 -0
  316. package/src/Dialer/DialPad/DialPad.classes.d.ts +7 -0
  317. package/src/Dialer/DialPad/DialPad.d.ts +143 -0
  318. package/src/Dialer/DialPad/assets/DialerPadSoundsMPEG.d.ts +15 -0
  319. package/src/Dialer/DialPad/assets/DialerPadSoundsOGG.d.ts +15 -0
  320. package/src/Dialer/DialPad/assets/index.d.ts +3 -0
  321. package/src/Dialer/DialPad/index.d.ts +4 -0
  322. package/src/Dialer/DialPad/utils/DialPadUtils.d.ts +16 -0
  323. package/src/Dialer/DialPad/utils/index.d.ts +4 -0
  324. package/src/Dialer/DialPad/utils/types.d.ts +11 -0
  325. package/src/Dialer/DialPad/utils/useDialKeyboard.d.ts +16 -0
  326. package/src/Dialer/DialPad/utils/useKeyAudio.d.ts +15 -0
  327. package/src/Dialer/DialPadButton/DialPadButton.classes.d.ts +7 -0
  328. package/src/Dialer/DialPadButton/DialPadButton.d.ts +27 -0
  329. package/src/Dialer/DialPadButton/index.d.ts +2 -0
  330. package/src/Dialer/DialTextField/DialTextField.d.ts +37 -0
  331. package/src/Dialer/DialTextField/index.d.ts +2 -0
  332. package/src/Dialer/DialTextField/utils/getDialPadValueOnlyRegex.d.ts +4 -0
  333. package/src/Dialer/DialTextField/utils/index.d.ts +2 -0
  334. package/src/Dialer/DialTextField/utils/useFixedEndSelection.d.ts +10 -0
  335. package/src/Dialer/Dialer.d.ts +5 -0
  336. package/src/Dialer/index.d.ts +6 -0
  337. package/src/Dialer/utils/DialerContext.d.ts +13 -0
  338. package/src/Dialer/utils/index.d.ts +1 -0
  339. package/src/Dialog/Dialog.classes.d.ts +29 -0
  340. package/src/Dialog/Dialog.d.ts +8 -0
  341. package/src/Dialog/Dialog.type.d.ts +26 -0
  342. package/src/Dialog/index.d.ts +3 -0
  343. package/src/Divider/Divider.classes.d.ts +10 -0
  344. package/src/Divider/Divider.d.ts +4 -0
  345. package/src/Divider/Divider.type.d.ts +35 -0
  346. package/src/Divider/index.d.ts +3 -0
  347. package/src/DragHandle/DragHandle.classes.d.ts +8 -0
  348. package/src/DragHandle/DragHandle.d.ts +4 -0
  349. package/src/DragHandle/DragHandle.type.d.ts +17 -0
  350. package/src/DragHandle/index.d.ts +3 -0
  351. package/src/Drawer/Drawer.classes.d.ts +10 -0
  352. package/src/Drawer/Drawer.d.ts +33 -0
  353. package/src/Drawer/Drawer.type.d.ts +107 -0
  354. package/src/Drawer/index.d.ts +3 -0
  355. package/src/Dropdown/Dropdown.classes.d.ts +7 -0
  356. package/src/Dropdown/Dropdown.d.ts +4 -0
  357. package/src/Dropdown/Dropdown.type.d.ts +96 -0
  358. package/src/Dropdown/index.d.ts +3 -0
  359. package/src/EmptyState/EmptyState.classes.d.ts +7 -0
  360. package/src/EmptyState/EmptyState.d.ts +5 -0
  361. package/src/EmptyState/EmptyState.type.d.ts +21 -0
  362. package/src/EmptyState/index.d.ts +3 -0
  363. package/src/FabButton/FabButton.classes.d.ts +7 -0
  364. package/src/FabButton/FabButton.d.ts +4 -0
  365. package/src/FabButton/FabButton.type.d.ts +22 -0
  366. package/src/FabButton/index.d.ts +3 -0
  367. package/src/FocusTrap/FocusTrap.d.ts +49 -0
  368. package/src/FocusTrap/index.d.ts +2 -0
  369. package/src/FocusTrap/useFocusTrapStack.d.ts +16 -0
  370. package/src/FormField/FormField.classes.d.ts +9 -0
  371. package/src/FormField/FormField.d.ts +5 -0
  372. package/src/FormField/FormField.type.d.ts +46 -0
  373. package/src/FormField/index.d.ts +4 -0
  374. package/src/FormField/useHelperTextId.d.ts +30 -0
  375. package/src/FormLabel/FormLabel.classes.d.ts +10 -0
  376. package/src/FormLabel/FormLabel.d.ts +5 -0
  377. package/src/FormLabel/FormLabel.type.d.ts +26 -0
  378. package/src/FormLabel/FormLabelContext.d.ts +8 -0
  379. package/src/FormLabel/index.d.ts +4 -0
  380. package/src/Icon/Icon.classes.d.ts +7 -0
  381. package/src/Icon/Icon.d.ts +5 -0
  382. package/src/Icon/Icon.type.d.ts +25 -0
  383. package/src/Icon/index.d.ts +3 -0
  384. package/src/IconButton/IconButton.classes.d.ts +8 -0
  385. package/src/IconButton/IconButton.d.ts +4 -0
  386. package/src/IconButton/IconButton.type.d.ts +58 -0
  387. package/src/IconButton/IconButtonLabel.classes.d.ts +7 -0
  388. package/src/IconButton/IconButtonLabel.d.ts +5 -0
  389. package/src/IconButton/IconButtonLabel.type.d.ts +12 -0
  390. package/src/IconButton/index.d.ts +6 -0
  391. package/src/IconButtonGroup/IconButtonGroup.classes.d.ts +7 -0
  392. package/src/IconButtonGroup/IconButtonGroup.d.ts +4 -0
  393. package/src/IconButtonGroup/IconButtonGroup.type.d.ts +22 -0
  394. package/src/IconButtonGroup/index.d.ts +3 -0
  395. package/src/InlineEditable/InlineEditable.classes.d.ts +9 -0
  396. package/src/InlineEditable/InlineEditable.d.ts +5 -0
  397. package/src/InlineEditable/InlineEditable.type.d.ts +116 -0
  398. package/src/InlineEditable/index.d.ts +3 -0
  399. package/src/LinearProgressIndicator/LinearProgressIndicator.classes.d.ts +9 -0
  400. package/src/LinearProgressIndicator/LinearProgressIndicator.d.ts +5 -0
  401. package/src/LinearProgressIndicator/LinearProgressIndicator.type.d.ts +46 -0
  402. package/src/LinearProgressIndicator/index.d.ts +3 -0
  403. package/src/Link/Link.classes.d.ts +8 -0
  404. package/src/Link/Link.d.ts +4 -0
  405. package/src/Link/Link.type.d.ts +22 -0
  406. package/src/Link/index.d.ts +3 -0
  407. package/src/List/List.classes.d.ts +7 -0
  408. package/src/List/List.d.ts +5 -0
  409. package/src/List/List.type.d.ts +4 -0
  410. package/src/List/index.d.ts +3 -0
  411. package/src/ListItem/HoverActions.d.ts +8 -0
  412. package/src/ListItem/ListItem.classes.d.ts +7 -0
  413. package/src/ListItem/ListItem.d.ts +5 -0
  414. package/src/ListItem/ListItem.type.d.ts +58 -0
  415. package/src/ListItem/index.d.ts +4 -0
  416. package/src/ListItemText/ListItemText.classes.d.ts +9 -0
  417. package/src/ListItemText/ListItemText.d.ts +5 -0
  418. package/src/ListItemText/ListItemText.type.d.ts +33 -0
  419. package/src/ListItemText/index.d.ts +3 -0
  420. package/src/ListNavigation/ListNavigationContext.d.ts +8 -0
  421. package/src/ListNavigation/index.d.ts +3 -0
  422. package/src/ListNavigation/useItemNavigation.d.ts +9 -0
  423. package/src/ListNavigation/useListNavigation.d.ts +49 -0
  424. package/src/Menu/Menu.classes.d.ts +7 -0
  425. package/src/Menu/Menu.d.ts +5 -0
  426. package/src/Menu/Menu.type.d.ts +19 -0
  427. package/src/Menu/MenuContext.d.ts +7 -0
  428. package/src/Menu/index.d.ts +4 -0
  429. package/src/MenuActions/MenuActions.classes.d.ts +13 -0
  430. package/src/MenuActions/MenuActions.d.ts +9 -0
  431. package/src/MenuActions/MenuActions.type.d.ts +3 -0
  432. package/src/MenuActions/index.d.ts +3 -0
  433. package/src/MenuDivider/MenuDivider.classes.d.ts +7 -0
  434. package/src/MenuDivider/MenuDivider.d.ts +5 -0
  435. package/src/MenuDivider/MenuDivider.type.d.ts +3 -0
  436. package/src/MenuDivider/index.d.ts +3 -0
  437. package/src/MenuFooter/MenuFooter.classes.d.ts +7 -0
  438. package/src/MenuFooter/MenuFooter.d.ts +5 -0
  439. package/src/MenuFooter/MenuFooter.type.d.ts +9 -0
  440. package/src/MenuFooter/index.d.ts +3 -0
  441. package/src/MenuHeader/MenuHeader.classes.d.ts +7 -0
  442. package/src/MenuHeader/MenuHeader.d.ts +5 -0
  443. package/src/MenuHeader/MenuHeader.type.d.ts +18 -0
  444. package/src/MenuHeader/index.d.ts +3 -0
  445. package/src/MenuItem/MenuItem.classes.d.ts +7 -0
  446. package/src/MenuItem/MenuItem.d.ts +5 -0
  447. package/src/MenuItem/MenuItem.type.d.ts +29 -0
  448. package/src/MenuItem/MenuItemSelectContext.d.ts +18 -0
  449. package/src/MenuItem/index.d.ts +7 -0
  450. package/src/MenuItem/useMenuItem.d.ts +16 -0
  451. package/src/MenuItem/useMenuItemSelect.d.ts +62 -0
  452. package/src/MenuItem/useVirtualizedMenuItem.d.ts +15 -0
  453. package/src/MenuItemText/MenuItemText.classes.d.ts +7 -0
  454. package/src/MenuItemText/MenuItemText.d.ts +5 -0
  455. package/src/MenuItemText/MenuItemText.type.d.ts +27 -0
  456. package/src/MenuItemText/index.d.ts +3 -0
  457. package/src/MenuList/MenuList.classes.d.ts +7 -0
  458. package/src/MenuList/MenuList.d.ts +4 -0
  459. package/src/MenuList/MenuList.type.d.ts +16 -0
  460. package/src/MenuList/MenuListContext.d.ts +12 -0
  461. package/src/MenuList/index.d.ts +4 -0
  462. package/src/Modal/InnerModal.d.ts +18 -0
  463. package/src/Modal/InnerModal.type.d.ts +23 -0
  464. package/src/Modal/Modal.classes.d.ts +7 -0
  465. package/src/Modal/Modal.d.ts +24 -0
  466. package/src/Modal/Modal.type.d.ts +19 -0
  467. package/src/Modal/ModalContext.d.ts +10 -0
  468. package/src/Modal/index.d.ts +6 -0
  469. package/src/NestedMenuContext/NestedMenuContext.d.ts +11 -0
  470. package/src/NestedMenuContext/index.d.ts +4 -0
  471. package/src/NestedMenuContext/useNestedChildMenu.d.ts +6 -0
  472. package/src/NestedMenuContext/useNestedMenuItem.d.ts +5 -0
  473. package/src/NestedMenuContext/useNestedParentMenu.d.ts +8 -0
  474. package/src/Option/Option.d.ts +4 -0
  475. package/src/Option/Option.type.d.ts +7 -0
  476. package/src/Option/index.d.ts +2 -0
  477. package/src/Overlap/Overlap.classes.d.ts +7 -0
  478. package/src/Overlap/Overlap.d.ts +4 -0
  479. package/src/Overlap/Overlap.type.d.ts +30 -0
  480. package/src/Overlap/index.d.ts +3 -0
  481. package/src/PageHeader/PageHeader.classes.d.ts +32 -0
  482. package/src/PageHeader/PageHeader.d.ts +9 -0
  483. package/src/PageHeader/PageHeader.type.d.ts +14 -0
  484. package/src/PageHeader/index.d.ts +3 -0
  485. package/src/PickerTextField/PickerTextField.classes.d.ts +7 -0
  486. package/src/PickerTextField/PickerTextField.d.ts +5 -0
  487. package/src/PickerTextField/PickerTextField.type.d.ts +30 -0
  488. package/src/PickerTextField/index.d.ts +3 -0
  489. package/src/Popover/Popover.classes.d.ts +7 -0
  490. package/src/Popover/Popover.d.ts +5 -0
  491. package/src/Popover/Popover.type.d.ts +50 -0
  492. package/src/Popover/index.d.ts +3 -0
  493. package/src/Popper/Popper.d.ts +4 -0
  494. package/src/Popper/Popper.type.d.ts +92 -0
  495. package/src/Popper/index.d.ts +2 -0
  496. package/src/PopperPaper/PopperPaper.classes.d.ts +7 -0
  497. package/src/PopperPaper/PopperPaper.d.ts +5 -0
  498. package/src/PopperPaper/PopperPaper.type.d.ts +8 -0
  499. package/src/PopperPaper/index.d.ts +3 -0
  500. package/src/Portal/Portal.d.ts +2 -0
  501. package/src/Portal/index.d.ts +1 -0
  502. package/src/Radio/Radio.classes.d.ts +7 -0
  503. package/src/Radio/Radio.d.ts +12 -0
  504. package/src/Radio/Radio.type.d.ts +16 -0
  505. package/src/Radio/index.d.ts +3 -0
  506. package/src/RadioGroup/RadioGroup.classes.d.ts +7 -0
  507. package/src/RadioGroup/RadioGroup.context.d.ts +15 -0
  508. package/src/RadioGroup/RadioGroup.d.ts +5 -0
  509. package/src/RadioGroup/RadioGroup.type.d.ts +14 -0
  510. package/src/RadioGroup/index.d.ts +4 -0
  511. package/src/Rating/Rating.classes.d.ts +7 -0
  512. package/src/Rating/Rating.d.ts +5 -0
  513. package/src/Rating/Rating.type.d.ts +106 -0
  514. package/src/Rating/RatingItem.d.ts +3 -0
  515. package/src/Rating/index.d.ts +5 -0
  516. package/src/Rating/utils.d.ts +5 -0
  517. package/src/Select/Select.classes.d.ts +11 -0
  518. package/src/Select/Select.d.ts +4 -0
  519. package/src/Select/Select.type.d.ts +118 -0
  520. package/src/Select/index.d.ts +4 -0
  521. package/src/Select/useSelect.d.ts +16 -0
  522. package/src/SingleFilter/FilterButton/FilterButton.classes.d.ts +7 -0
  523. package/src/SingleFilter/FilterButton/FilterButton.d.ts +5 -0
  524. package/src/SingleFilter/FilterButton/FilterButton.type.d.ts +27 -0
  525. package/src/SingleFilter/FilterButton/index.d.ts +3 -0
  526. package/src/SingleFilter/SingleFilter.classes.d.ts +7 -0
  527. package/src/SingleFilter/SingleFilter.d.ts +5 -0
  528. package/src/SingleFilter/SingleFilter.type.d.ts +44 -0
  529. package/src/SingleFilter/index.d.ts +4 -0
  530. package/src/Skeleton/Skeleton.classes.d.ts +7 -0
  531. package/src/Skeleton/Skeleton.d.ts +5 -0
  532. package/src/Skeleton/Skeleton.type.d.ts +6 -0
  533. package/src/Skeleton/SkeletonContainer/SkeletonContainer.classes.d.ts +7 -0
  534. package/src/Skeleton/SkeletonContainer/SkeletonContainer.d.ts +5 -0
  535. package/src/Skeleton/SkeletonContainer/SkeletonContainer.type.d.ts +11 -0
  536. package/src/Skeleton/SkeletonContainer/index.d.ts +3 -0
  537. package/src/Skeleton/index.d.ts +4 -0
  538. package/src/Slider/Slider.classes.d.ts +13 -0
  539. package/src/Slider/Slider.d.ts +10 -0
  540. package/src/Slider/Slider.type.d.ts +137 -0
  541. package/src/Slider/SliderThumb.d.ts +16 -0
  542. package/src/Slider/index.d.ts +3 -0
  543. package/src/Slider/utils.d.ts +1 -0
  544. package/src/Snackbar/Snackbar.classes.d.ts +7 -0
  545. package/src/Snackbar/Snackbar.d.ts +5 -0
  546. package/src/Snackbar/Snackbar.hook.d.ts +1 -0
  547. package/src/Snackbar/Snackbar.type.d.ts +27 -0
  548. package/src/Snackbar/SnackbarContent/SnackbarContent.classes.d.ts +8 -0
  549. package/src/Snackbar/SnackbarContent/SnackbarContent.d.ts +5 -0
  550. package/src/Snackbar/SnackbarContent/SnackbarContent.type.d.ts +4 -0
  551. package/src/Snackbar/SnackbarContent/index.d.ts +3 -0
  552. package/src/Snackbar/index.d.ts +5 -0
  553. package/src/SortableList/SortableList.d.ts +3 -0
  554. package/src/SortableList/SortableList.type.d.ts +20 -0
  555. package/src/SortableList/index.d.ts +2 -0
  556. package/src/SortableListDndContext/DndKeyboardBlocker.d.ts +2 -0
  557. package/src/SortableListDndContext/SortableListDndContext.d.ts +4 -0
  558. package/src/SortableListDndContext/SortableListDndContext.type.d.ts +5 -0
  559. package/src/SortableListDndContext/index.d.ts +5 -0
  560. package/src/SortableListDndContext/useSortableListDndContext.d.ts +2 -0
  561. package/src/SortableListDndContext/utils.d.ts +1 -0
  562. package/src/SortableListItem/SortableListItem.d.ts +4 -0
  563. package/src/SortableListItem/SortableListItem.type.d.ts +6 -0
  564. package/src/SortableListItem/SortableListItemOverlay.d.ts +4 -0
  565. package/src/SortableListItem/SortableListItemOverlay.type.d.ts +8 -0
  566. package/src/SortableListItem/index.d.ts +4 -0
  567. package/src/SortableVirtualizedList/SortableVirtualizedList.d.ts +3 -0
  568. package/src/SortableVirtualizedList/SortableVirtualizedList.type.d.ts +19 -0
  569. package/src/SortableVirtualizedList/index.d.ts +2 -0
  570. package/src/SplitButton/SplitButton.classes.d.ts +8 -0
  571. package/src/SplitButton/SplitButton.d.ts +5 -0
  572. package/src/SplitButton/SplitButton.type.d.ts +37 -0
  573. package/src/SplitButton/index.d.ts +3 -0
  574. package/src/Squircle/Squircle.d.ts +4 -0
  575. package/src/Squircle/Squircle.type.d.ts +19 -0
  576. package/src/Squircle/index.d.ts +3 -0
  577. package/src/Squircle/squircle.classes.d.ts +7 -0
  578. package/src/StatusIndicator/StatusIndicator.classes.d.ts +7 -0
  579. package/src/StatusIndicator/StatusIndicator.d.ts +8 -0
  580. package/src/StatusIndicator/StatusIndicator.type.d.ts +14 -0
  581. package/src/StatusIndicator/index.d.ts +3 -0
  582. package/src/Step/Step.classes.d.ts +7 -0
  583. package/src/Step/Step.d.ts +4 -0
  584. package/src/Step/Step.type.d.ts +50 -0
  585. package/src/Step/StepContext.d.ts +22 -0
  586. package/src/Step/index.d.ts +4 -0
  587. package/src/StepButton/StepButton.classes.d.ts +7 -0
  588. package/src/StepButton/StepButton.d.ts +4 -0
  589. package/src/StepButton/StepButton.type.d.ts +34 -0
  590. package/src/StepButton/index.d.ts +3 -0
  591. package/src/StepConnector/StepConnector.classes.d.ts +7 -0
  592. package/src/StepConnector/StepConnector.d.ts +5 -0
  593. package/src/StepConnector/StepConnector.type.d.ts +3 -0
  594. package/src/StepConnector/index.d.ts +3 -0
  595. package/src/StepContent/StepContent.classes.d.ts +7 -0
  596. package/src/StepContent/StepContent.d.ts +5 -0
  597. package/src/StepContent/StepContent.type.d.ts +14 -0
  598. package/src/StepContent/index.d.ts +3 -0
  599. package/src/StepIcon/StepIcon.classes.d.ts +7 -0
  600. package/src/StepIcon/StepIcon.d.ts +5 -0
  601. package/src/StepIcon/StepIcon.type.d.ts +38 -0
  602. package/src/StepIcon/index.d.ts +3 -0
  603. package/src/StepLabel/StepLabel.classes.d.ts +10 -0
  604. package/src/StepLabel/StepLabel.d.ts +5 -0
  605. package/src/StepLabel/StepLabel.type.d.ts +36 -0
  606. package/src/StepLabel/index.d.ts +3 -0
  607. package/src/Stepper/Stepper.classes.d.ts +7 -0
  608. package/src/Stepper/Stepper.d.ts +4 -0
  609. package/src/Stepper/Stepper.type.d.ts +47 -0
  610. package/src/Stepper/StepperContext.d.ts +11 -0
  611. package/src/Stepper/index.d.ts +4 -0
  612. package/src/SubMenu/PopperMenu.classes.d.ts +7 -0
  613. package/src/SubMenu/PopperMenu.d.ts +5 -0
  614. package/src/SubMenu/PopperMenu.type.d.ts +4 -0
  615. package/src/SubMenu/SubMenu.d.ts +4 -0
  616. package/src/SubMenu/SubMenu.type.d.ts +6 -0
  617. package/src/SubMenu/index.d.ts +5 -0
  618. package/src/SwipeableDrawer/SwipeableDrawer.classes.d.ts +7 -0
  619. package/src/SwipeableDrawer/SwipeableDrawer.d.ts +31 -0
  620. package/src/SwipeableDrawer/SwipeableDrawer.types.d.ts +82 -0
  621. package/src/SwipeableDrawer/hooks/index.d.ts +5 -0
  622. package/src/SwipeableDrawer/hooks/useDimensions.d.ts +17 -0
  623. package/src/SwipeableDrawer/hooks/useDrawerGestures.d.ts +151 -0
  624. package/src/SwipeableDrawer/hooks/useElementSizeObserver.d.ts +10 -0
  625. package/src/SwipeableDrawer/hooks/useReady.d.ts +4 -0
  626. package/src/SwipeableDrawer/hooks/useSnapPoints.d.ts +94 -0
  627. package/src/SwipeableDrawer/index.d.ts +3 -0
  628. package/src/Switch/Switch.classes.d.ts +7 -0
  629. package/src/Switch/Switch.d.ts +11 -0
  630. package/src/Switch/Switch.type.d.ts +19 -0
  631. package/src/Switch/index.d.ts +3 -0
  632. package/src/Tab/Tab.classes.d.ts +10 -0
  633. package/src/Tab/Tab.d.ts +5 -0
  634. package/src/Tab/Tab.type.d.ts +50 -0
  635. package/src/Tab/index.d.ts +3 -0
  636. package/src/TabContext/TabContext.d.ts +20 -0
  637. package/src/TabContext/TabContext.type.d.ts +13 -0
  638. package/src/TabContext/index.d.ts +2 -0
  639. package/src/TabPanel/TabPanel.classes.d.ts +7 -0
  640. package/src/TabPanel/TabPanel.d.ts +5 -0
  641. package/src/TabPanel/TabPanel.type.d.ts +18 -0
  642. package/src/TabPanel/index.d.ts +3 -0
  643. package/src/Table/Table.classes.d.ts +7 -0
  644. package/src/Table/Table.d.ts +4 -0
  645. package/src/Table/Table.type.d.ts +36 -0
  646. package/src/Table/TableContext.d.ts +8 -0
  647. package/src/Table/Tablelvl2Context.d.ts +7 -0
  648. package/src/Table/index.d.ts +5 -0
  649. package/src/TableBody/TableBody.classes.d.ts +7 -0
  650. package/src/TableBody/TableBody.d.ts +4 -0
  651. package/src/TableBody/TableBody.type.d.ts +17 -0
  652. package/src/TableBody/index.d.ts +3 -0
  653. package/src/TableCell/TableCell.classes.d.ts +7 -0
  654. package/src/TableCell/TableCell.d.ts +8 -0
  655. package/src/TableCell/TableCell.type.d.ts +59 -0
  656. package/src/TableCell/index.d.ts +3 -0
  657. package/src/TableContainer/TableContainer.classes.d.ts +8 -0
  658. package/src/TableContainer/TableContainer.d.ts +4 -0
  659. package/src/TableContainer/TableContainer.type.d.ts +23 -0
  660. package/src/TableContainer/index.d.ts +3 -0
  661. package/src/TableFooter/TableFooter.classes.d.ts +8 -0
  662. package/src/TableFooter/TableFooter.d.ts +5 -0
  663. package/src/TableFooter/TableFooter.type.d.ts +9 -0
  664. package/src/TableFooter/index.d.ts +2 -0
  665. package/src/TableHead/TableHead.classes.d.ts +7 -0
  666. package/src/TableHead/TableHead.d.ts +4 -0
  667. package/src/TableHead/TableHead.type.d.ts +21 -0
  668. package/src/TableHead/index.d.ts +3 -0
  669. package/src/TablePagination/TablePagination.classes.d.ts +8 -0
  670. package/src/TablePagination/TablePagination.d.ts +4 -0
  671. package/src/TablePagination/TablePagination.type.d.ts +73 -0
  672. package/src/TablePagination/index.d.ts +2 -0
  673. package/src/TableRow/TableRow.classes.d.ts +7 -0
  674. package/src/TableRow/TableRow.d.ts +4 -0
  675. package/src/TableRow/TableRow.type.d.ts +34 -0
  676. package/src/TableRow/index.d.ts +3 -0
  677. package/src/Tabs/TabMoreMenu.d.ts +36 -0
  678. package/src/Tabs/TabScrollButton.d.ts +21 -0
  679. package/src/Tabs/Tabs.classes.d.ts +19 -0
  680. package/src/Tabs/Tabs.d.ts +5 -0
  681. package/src/Tabs/Tabs.type.d.ts +54 -0
  682. package/src/Tabs/TabsContext.d.ts +9 -0
  683. package/src/Tabs/hooks/index.d.ts +2 -0
  684. package/src/Tabs/hooks/useComputedTabs.d.ts +20 -0
  685. package/src/Tabs/hooks/useTabsScroller.d.ts +48 -0
  686. package/src/Tabs/index.d.ts +7 -0
  687. package/src/Tag/Tag.classes.d.ts +8 -0
  688. package/src/Tag/Tag.d.ts +5 -0
  689. package/src/Tag/Tag.type.d.ts +23 -0
  690. package/src/Tag/index.d.ts +3 -0
  691. package/src/Text/Text.classes.d.ts +7 -0
  692. package/src/Text/Text.d.ts +4 -0
  693. package/src/Text/Text.type.d.ts +34 -0
  694. package/src/Text/index.d.ts +3 -0
  695. package/src/TextField/TextField.classes.d.ts +7 -0
  696. package/src/TextField/TextField.d.ts +5 -0
  697. package/src/TextField/TextField.type.d.ts +112 -0
  698. package/src/TextField/index.d.ts +3 -0
  699. package/src/Textarea/Textarea.classes.d.ts +10 -0
  700. package/src/Textarea/Textarea.d.ts +5 -0
  701. package/src/Textarea/Textarea.type.d.ts +26 -0
  702. package/src/Textarea/index.d.ts +3 -0
  703. package/src/TimePicker/NumberPicker.d.ts +5 -0
  704. package/src/TimePicker/NumberPicker.type.d.ts +36 -0
  705. package/src/TimePicker/PickerView.d.ts +4 -0
  706. package/src/TimePicker/PickerView.type.d.ts +25 -0
  707. package/src/TimePicker/SelectionView.d.ts +19 -0
  708. package/src/TimePicker/TimeButton.d.ts +11 -0
  709. package/src/TimePicker/TimePicker.classes.d.ts +7 -0
  710. package/src/TimePicker/TimePicker.context.d.ts +6 -0
  711. package/src/TimePicker/TimePicker.d.ts +5 -0
  712. package/src/TimePicker/TimePicker.type.d.ts +30 -0
  713. package/src/TimePicker/ToggleText.d.ts +5 -0
  714. package/src/TimePicker/ToggleText.type.d.ts +14 -0
  715. package/src/TimePicker/constant.d.ts +7 -0
  716. package/src/TimePicker/index.d.ts +14 -0
  717. package/src/TimePicker/utils/A11yUtils.d.ts +2 -0
  718. package/src/TimePicker/utils/TimeBoundary.d.ts +27 -0
  719. package/src/TimePicker/utils/TimePickerHelper.d.ts +52 -0
  720. package/src/TimePicker/utils/getNumberPickerBoundary.d.ts +22 -0
  721. package/src/TimePicker/utils/index.d.ts +4 -0
  722. package/src/TimePicker/utils/runKeyHandler.d.ts +4 -0
  723. package/src/Tooltip/Tooltip.d.ts +5 -0
  724. package/src/Tooltip/Tooltip.type.d.ts +5 -0
  725. package/src/Tooltip/TooltipTrigger.a11y.d.ts +38 -0
  726. package/src/Tooltip/TooltipTrigger.d.ts +4 -0
  727. package/src/Tooltip/TooltipTrigger.type.d.ts +59 -0
  728. package/src/Tooltip/TooltipView.classes.d.ts +8 -0
  729. package/src/Tooltip/TooltipView.d.ts +16 -0
  730. package/src/Tooltip/TooltipView.type.d.ts +44 -0
  731. package/src/Tooltip/index.d.ts +9 -0
  732. package/src/Tooltip/useTooltipForceHide.d.ts +8 -0
  733. package/src/Tooltip/withTooltip/index.d.ts +1 -0
  734. package/src/Tooltip/withTooltip/withTooltip.d.ts +6 -0
  735. package/src/Tray/Tray.classes.d.ts +13 -0
  736. package/src/Tray/Tray.d.ts +5 -0
  737. package/src/Tray/Tray.type.d.ts +26 -0
  738. package/src/Tray/TrayContext.d.ts +14 -0
  739. package/src/Tray/TrayPanel.d.ts +7 -0
  740. package/src/Tray/hooks/index.d.ts +3 -0
  741. package/src/Tray/hooks/useTray.d.ts +33 -0
  742. package/src/Tray/hooks/useTrayNavigate.d.ts +5 -0
  743. package/src/Tray/hooks/useTrayPanel.d.ts +14 -0
  744. package/src/Tray/index.d.ts +7 -0
  745. package/src/Tray/types.d.ts +2 -0
  746. package/src/TrayMenu/TrayMenu.d.ts +4 -0
  747. package/src/TrayMenu/TrayMenu.type.d.ts +3 -0
  748. package/src/TrayMenu/TrayMenuItem.d.ts +9 -0
  749. package/src/TrayMenu/index.d.ts +3 -0
  750. package/src/VirtualizedList/VirtualizedItemPropsContext.d.ts +5 -0
  751. package/src/VirtualizedList/VirtualizedList.d.ts +3 -0
  752. package/src/VirtualizedList/VirtualizedList.type.d.ts +51 -0
  753. package/src/VirtualizedList/VirtuosoComponents.d.ts +16 -0
  754. package/src/VirtualizedList/VirtuosoContextType.d.ts +14 -0
  755. package/src/VirtualizedList/index.d.ts +5 -0
  756. package/src/VirtualizedMenu/VirtualizedMenu.classes.d.ts +7 -0
  757. package/src/VirtualizedMenu/VirtualizedMenu.context.d.ts +6 -0
  758. package/src/VirtualizedMenu/VirtualizedMenu.d.ts +4 -0
  759. package/src/VirtualizedMenu/VirtualizedMenu.type.d.ts +35 -0
  760. package/src/VirtualizedMenu/VirtualizedMenuList.d.ts +6 -0
  761. package/src/VirtualizedMenu/index.d.ts +5 -0
  762. package/src/VisuallyHidden/VisuallyHidden.classes.d.ts +7 -0
  763. package/src/VisuallyHidden/VisuallyHidden.d.ts +5 -0
  764. package/src/VisuallyHidden/VisuallyHidden.type.d.ts +3 -0
  765. package/src/VisuallyHidden/index.d.ts +3 -0
  766. package/src/index.d.ts +112 -0
@@ -0,0 +1,1767 @@
1
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
+ import { forwardRef, useRef, useMemo, useCallback, useEffect, useLayoutEffect, useState, useImperativeHandle } from 'react';
3
+ import clsx from 'clsx';
4
+ import { Virtuoso } from 'react-virtuoso';
5
+ import { useClasses, usePrevious, useRefState, useEventCallback, logInDev, combineProps, useDepsChange, useControlled, useId, useForceUpdate, useKeyboardMoveFocus, useForkRef, useSleep, useRetry, useChange, getSelectionPosition } from '@ringcentral/spring-base';
6
+ import { useThemeProps } from '@ringcentral/spring-theme';
7
+ import { E as ExpandCollapseCaret } from './chunks/ExpandCollapseCaret.js';
8
+ import { I as IconButton } from './chunks/IconButtonLabel.js';
9
+ import { AnimatePresence, motion } from 'framer-motion';
10
+ import './chunks/Icon.js';
11
+ import { Xsm } from '@ringcentral/spring-icon';
12
+ import { u as usePrefersReducedMotion } from './chunks/usePrefersReducedMotion.js';
13
+ import { g as getFade } from './chunks/getFade.js';
14
+ import { C as Chip } from './chunks/Chip.js';
15
+ import { Popper } from './Popper.js';
16
+ import { T as TextField } from './chunks/TextField.js';
17
+ import uniqueId from 'lodash/uniqueId';
18
+ import './chunks/useMotionSafeTransition.js';
19
+ import '@mui/base';
20
+ import './chunks/Squircle.js';
21
+ import './chunks/withTooltip.js';
22
+ import './chunks/Tooltip.js';
23
+ import './chunks/PopperPaper.js';
24
+ import '@floating-ui/react-dom';
25
+ import './chunks/Modal.js';
26
+ import './chunks/useFocusTrapStack.js';
27
+ import './chunks/Backdrop.js';
28
+ import './chunks/ShowHideEye.js';
29
+ import './chunks/useHelperTextId.js';
30
+
31
+ var SuggestionList$1 = {"sui-suggestion-list-root":"sui-suggestion-list-root","sui-suggestion-list-item":"sui-suggestion-list-item","sui-suggestion-list-readonly":"sui-suggestion-list-readonly","sui-disabled":"sui-disabled","sui-focus-visible":"sui-focus-visible","sui-suggestion-list-selected":"sui-suggestion-list-selected","sui-suggestion-list-highlighted":"sui-suggestion-list-highlighted","sui-suggestion-list-group-title-readonly":"sui-suggestion-list-group-title-readonly","sui-suggestion-list-expand-icon":"sui-suggestion-list-expand-icon"};
32
+
33
+ const SuggestionListItem = forwardRef((props, ref) => {
34
+ const { id, label, children, disabled, isGroupTitle = false, isTitleMode = false, highlighted = false, selected = false, expanded = false, expandable = false, expandIconProps, classes, className, role, ...rest } = props;
35
+ const cls = useClasses('suggestion-list', classes, className);
36
+ const readonly = isGroupTitle && isTitleMode;
37
+ const ariaDisabled = role !== undefined && disabled ? true : undefined;
38
+ return (jsxs("div", { "aria-disabled": ariaDisabled, role: role, ...rest, id: id, className: cls('item', {
39
+ 'group-title': isGroupTitle,
40
+ readonly,
41
+ 'group-title-readonly': readonly,
42
+ highlighted: highlighted,
43
+ selected: selected,
44
+ disabled,
45
+ }), children: [label || children, expandable && expandIconProps && (jsx(IconButton, { shape: 'squircle', background: false, color: 'secondary', variant: "contained", size: "small", ...expandIconProps, children: jsx(ExpandCollapseCaret, { expanded: expanded }) }))] }));
46
+ });
47
+
48
+ /**
49
+ * auto calculate container height
50
+ */
51
+ const useDynamicHeight = ({ itemCount, maxContainerHeight, onContainerHeightChange, }) => {
52
+ const prevItemCount = usePrevious(() => itemCount);
53
+ const fullHeight = maxContainerHeight === '100%';
54
+ const maxContainerSize = fullHeight ? -1 : maxContainerHeight;
55
+ const containerHeighRef = useRef(maxContainerSize);
56
+ if (!fullHeight) {
57
+ // * when prev item count is zero, and current is not zero, set hight for vl to trigger totalListHeightChanged to re-change height
58
+ if (prevItemCount === 0 && itemCount !== 0) {
59
+ containerHeighRef.current = maxContainerSize;
60
+ }
61
+ else if (itemCount === 0) {
62
+ // * when item count is zero always height to zero, when zero init
63
+ containerHeighRef.current = 0;
64
+ }
65
+ }
66
+ return {
67
+ containerHeighRef,
68
+ totalListHeightChanged: (height) => {
69
+ if (!fullHeight) {
70
+ const containerHeigh = containerHeighRef.current;
71
+ let changeHeight = -1;
72
+ if (height < containerHeigh) {
73
+ changeHeight = height;
74
+ }
75
+ else if (containerHeigh !== maxContainerSize) {
76
+ changeHeight = Math.min(height, maxContainerSize);
77
+ }
78
+ if (changeHeight !== -1) {
79
+ containerHeighRef.current = changeHeight;
80
+ onContainerHeightChange?.(changeHeight);
81
+ }
82
+ }
83
+ },
84
+ style: {
85
+ height: fullHeight ? '100%' : containerHeighRef.current,
86
+ },
87
+ };
88
+ };
89
+
90
+ /**
91
+ * scroll into current highlight index
92
+ */
93
+ function useHighlightScroll({ containerHeighRef, scrollToIndex, }) {
94
+ const renderedItemsRef = useRef([]);
95
+ const scrollerRef = useRef();
96
+ const scrollToHighlightedIndex = (prevHighlightedIndex, currHighlightedIndex, topHighlightIndex = 0) => {
97
+ if (!scrollerRef.current) {
98
+ if (currHighlightedIndex !== topHighlightIndex) {
99
+ requestAnimationFrame(() => {
100
+ scrollToIndex({
101
+ index: currHighlightedIndex,
102
+ align: 'start',
103
+ });
104
+ });
105
+ }
106
+ return;
107
+ }
108
+ const scrollElm = scrollerRef.current;
109
+ const renderedItems = renderedItemsRef.current;
110
+ const isBackward = prevHighlightedIndex > currHighlightedIndex;
111
+ const isForward = prevHighlightedIndex < currHighlightedIndex;
112
+ const currentVisibleOffset = {
113
+ start: scrollElm.scrollTop,
114
+ stop: scrollElm.scrollTop + containerHeighRef.current,
115
+ };
116
+ // * when highlightedIndex is out of visible range
117
+ if (!renderedItems.some((x) => x.index === currHighlightedIndex)) {
118
+ scrollToIndex({
119
+ index: currHighlightedIndex,
120
+ align: isBackward ? 'start' : 'end',
121
+ });
122
+ return;
123
+ }
124
+ // backward
125
+ if (isBackward) {
126
+ let firstShouldScrollIndex = currHighlightedIndex;
127
+ for (let i = renderedItems.length - 1; i >= 0; i--) {
128
+ const item = renderedItems[i];
129
+ if (item.offset <= currentVisibleOffset.start) {
130
+ break;
131
+ }
132
+ firstShouldScrollIndex = item.index;
133
+ }
134
+ if (currHighlightedIndex < firstShouldScrollIndex) {
135
+ scrollToIndex({
136
+ index: currHighlightedIndex,
137
+ align: 'start',
138
+ });
139
+ }
140
+ // forward
141
+ }
142
+ else if (isForward) {
143
+ let lastShouldScrollIndex = currHighlightedIndex;
144
+ for (let i = 0; i < renderedItems.length; i++) {
145
+ const item = renderedItems[i];
146
+ if (item.offset >= currentVisibleOffset.stop) {
147
+ break;
148
+ }
149
+ lastShouldScrollIndex = item.index;
150
+ }
151
+ if (currHighlightedIndex >= lastShouldScrollIndex) {
152
+ scrollToIndex({
153
+ index: currHighlightedIndex,
154
+ align: 'end',
155
+ });
156
+ }
157
+ }
158
+ else {
159
+ scrollToIndex({
160
+ index: currHighlightedIndex,
161
+ align: 'start',
162
+ });
163
+ }
164
+ };
165
+ return {
166
+ /**
167
+ * scroller reference
168
+ */
169
+ scrollerRef,
170
+ /**
171
+ * Scroll to target highlighted index
172
+ * @param prevHighlightedIndex previous highlightedIndex
173
+ * @param currHighlightedIndex current highlightedIndex
174
+ * @param topHighlightIndex top highlighIndex for check should scroll when init
175
+ */
176
+ scrollToHighlightedIndex,
177
+ /**
178
+ * set to virtuoso `scrollerRef` prop, auto bind inner `scrollerRef`
179
+ */
180
+ scrollerRefFn: (elm) => (scrollerRef.current = elm),
181
+ /**
182
+ * set to virtuoso `itemsRendered` prop, auto bind inner `renderedItemsRef`
183
+ */
184
+ itemsRendered: (e) => (renderedItemsRef.current = e),
185
+ };
186
+ }
187
+
188
+ const useAutocompleteGroup = ({ groupBy, options, filteredResult, getExpandIconProps, groupExpanded, groupDefaultExpanded, onGroupExpanded, groupVariant, getOptionDisabled, id, }) => {
189
+ const [groupExpandedMapRef, setGroupExpandedMap] = useRefState({});
190
+ const isTitleGroup = groupVariant === 'normal';
191
+ const handleGroupExpandedChange = (groupName) => {
192
+ const groupExpandedMap = groupExpandedMapRef.current;
193
+ if (typeof groupExpanded === 'boolean') {
194
+ return;
195
+ }
196
+ const toExpandedState = !groupExpandedMap[groupName];
197
+ const newExpandedMap = {
198
+ ...groupExpandedMap,
199
+ [groupName]: toExpandedState,
200
+ };
201
+ setGroupExpandedMap(newExpandedMap);
202
+ if (!onGroupExpanded)
203
+ return;
204
+ const group = optionsGroupList.find((x) => x.group === groupName);
205
+ if (!group)
206
+ return;
207
+ const { getExpandIconProps, ...restGroupProps } = group;
208
+ onGroupExpanded({
209
+ ...restGroupProps,
210
+ expanded: toExpandedState,
211
+ }, newExpandedMap);
212
+ };
213
+ const handleExpandIconClick = useEventCallback((e, groupName) => {
214
+ handleGroupExpandedChange(groupName);
215
+ e.preventDefault();
216
+ e.stopPropagation();
217
+ });
218
+ const optionsGroupList = useMemo(() => {
219
+ /** key with this group count */
220
+ if (!groupBy || !options) {
221
+ return [];
222
+ }
223
+ // used to keep track of key and indexes in the result array
224
+ const indexBy = new Map();
225
+ let warn = false;
226
+ const afterGroupFn = [];
227
+ const result = filteredResult.reduce((acc, option, index) => {
228
+ const group = groupBy(option);
229
+ if (acc.length > 0 && acc[acc.length - 1].group === group) {
230
+ const currGroup = acc[acc.length - 1];
231
+ acc[acc.length - 1].options.push({
232
+ ...option,
233
+ group: currGroup,
234
+ indexInOwnGroup: currGroup.options.length - 1,
235
+ });
236
+ return acc;
237
+ }
238
+ if (process.env.NODE_ENV !== 'production') {
239
+ if (indexBy.get(group) && !warn) {
240
+ logInDev({
241
+ scope: 'useAutocomplete',
242
+ message: `Material-UI: The options provided combined with the \`groupBy\` method returns duplicated headers.
243
+ You can solve the issue by sorting the options with the output of \`groupBy\``,
244
+ });
245
+ warn = true;
246
+ }
247
+ indexBy.set(group, true);
248
+ }
249
+ const newGroup = {
250
+ key: index,
251
+ index,
252
+ group,
253
+ order: acc.length,
254
+ options: [{ ...option, indexInOwnGroup: 0 }],
255
+ expanded: false,
256
+ getExpandIconProps: (additionExpandIconProps) => {
257
+ return newGroup.options.length > 1
258
+ ? combineProps({
259
+ onClick: (e) => {
260
+ handleExpandIconClick(e, group);
261
+ },
262
+ onMouseDown: (e) => {
263
+ e.preventDefault();
264
+ e.stopPropagation();
265
+ },
266
+ tabIndex: -1,
267
+ }, combineProps(additionExpandIconProps, getExpandIconProps?.(newGroup)))
268
+ : undefined;
269
+ },
270
+ };
271
+ newGroup.options[0].group = newGroup;
272
+ if (isTitleGroup) {
273
+ const groupTitleOption = {
274
+ id: `${id}-${group}`,
275
+ label: group,
276
+ disabled: true,
277
+ // * here cause by self Type reference
278
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
279
+ group: newGroup,
280
+ };
281
+ // push fn to array, do that after all options be add into group
282
+ if (getOptionDisabled) {
283
+ afterGroupFn.push(() => {
284
+ groupTitleOption.disabled = getOptionDisabled(groupTitleOption);
285
+ });
286
+ }
287
+ newGroup.options.unshift(groupTitleOption);
288
+ }
289
+ acc.push(newGroup);
290
+ return acc;
291
+ }, []);
292
+ afterGroupFn.forEach((fn) => fn());
293
+ return result;
294
+ }, [
295
+ filteredResult,
296
+ getExpandIconProps,
297
+ getOptionDisabled,
298
+ groupBy,
299
+ handleExpandIconClick,
300
+ id,
301
+ isTitleGroup,
302
+ options,
303
+ ]);
304
+ const initGroupExpandedState = (expandedState) => {
305
+ if (typeof expandedState === 'object') {
306
+ setGroupExpandedMap(expandedState, false);
307
+ }
308
+ else if (typeof expandedState === 'boolean') {
309
+ setGroupExpandedMap(optionsGroupList.reduce((prev, curr) => {
310
+ prev[curr.group] = expandedState;
311
+ return prev;
312
+ }, {}), false);
313
+ }
314
+ };
315
+ useDepsChange(() => {
316
+ initGroupExpandedState(groupDefaultExpanded);
317
+ }, []);
318
+ useDepsChange(() => {
319
+ initGroupExpandedState(groupExpanded);
320
+ }, [groupExpanded]);
321
+ const groupExpandedMap = groupExpandedMapRef.current;
322
+ // * speared logic with group, prevent calculate every time.
323
+ const groupedResult = useMemo(() => {
324
+ const addExpandedResult = Object.entries(groupExpandedMap).reduce((prev, [key, expended]) => {
325
+ const group = prev.find((x) => x.group === key);
326
+ if (group)
327
+ group.expanded = expended;
328
+ return prev;
329
+ }, [...optionsGroupList]);
330
+ return addExpandedResult.reduce((prev, curr) => {
331
+ if (curr.expanded) {
332
+ prev.push(...curr.options);
333
+ }
334
+ else {
335
+ prev.push(curr.options[0]);
336
+ }
337
+ return prev;
338
+ }, []);
339
+ }, [groupExpandedMap, optionsGroupList]);
340
+ return {
341
+ optionsGroupList,
342
+ groupedResult,
343
+ groupExpandedMap,
344
+ handleGroupExpandedChange,
345
+ };
346
+ };
347
+
348
+ const DEFAULT_HIGHLIGHTED_INDEX$1 = -1;
349
+ const isItemCanSelected = (item) => {
350
+ return Boolean(item && !item.disabled);
351
+ };
352
+ const toOptionIdString = (id) => typeof id === 'number' ? String(id) : id;
353
+ const DEFAULT_GET_OPTION_LABEL = (item) => item?.label || '';
354
+ /**
355
+ * provide suggestion list with search function and expandable group with virtualized list
356
+ */
357
+ const useSuggestionList = ({ id, inputValue: inputValueProp, getOptionLabel = DEFAULT_GET_OPTION_LABEL, filterOptions, disabledItemsHighlightable, options, onInputChange: onInputChangeProp, inputRef, onKeyDown: onKeyDownProp, onSelect, onClear, getOptionDisabled, groupBy, onGroupExpanded, groupVariant, groupExpanded, groupDefaultExpanded, getExpandIconProps, processFilteredResult, }) => {
358
+ const isTitleMode = groupVariant === 'normal';
359
+ const [inputValue, setInputValue] = useControlled({
360
+ controlled: inputValueProp,
361
+ default: '',
362
+ name: 'useSuggestionList',
363
+ });
364
+ const updateInputValue = (newValue) => {
365
+ onInputChangeProp?.(newValue);
366
+ setInputValue(newValue);
367
+ };
368
+ const focusInput = () => inputRef.current?.focus();
369
+ const currUniqueId = useId(id || 'suggestion-list', !id);
370
+ const highlightedIndexRef = useRef(DEFAULT_HIGHLIGHTED_INDEX$1);
371
+ const changeHighlightedIndexReasonRef = useRef();
372
+ const forceUpdate = useForceUpdate();
373
+ const getFilteredItems = useCallback((items) => {
374
+ if (filterOptions) {
375
+ return filterOptions(items, {
376
+ inputValue,
377
+ getOptionLabel,
378
+ selectedItems: [],
379
+ });
380
+ }
381
+ return items;
382
+ }, [filterOptions, getOptionLabel, inputValue]);
383
+ const filteredResult = useMemo(() => {
384
+ // * only when isOpen calculate the filtered result
385
+ let results = getFilteredItems(options);
386
+ results = processFilteredResult
387
+ ? processFilteredResult(results, inputValue)
388
+ : results;
389
+ return results;
390
+ }, [getFilteredItems, inputValue, options, processFilteredResult]);
391
+ const { groupedResult, handleGroupExpandedChange, optionsGroupList } = useAutocompleteGroup({
392
+ id: currUniqueId,
393
+ options,
394
+ filteredResult,
395
+ groupExpanded,
396
+ groupDefaultExpanded,
397
+ groupVariant,
398
+ groupBy,
399
+ getExpandIconProps,
400
+ onGroupExpanded,
401
+ getOptionDisabled,
402
+ });
403
+ const optionItems = groupBy ? groupedResult : filteredResult;
404
+ const setHighlightedIndex = (index, { reRender = false, reason, }) => {
405
+ changeHighlightedIndexReasonRef.current = reason;
406
+ if (highlightedIndexRef.current !== index) {
407
+ highlightedIndexRef.current = index;
408
+ if (reRender)
409
+ forceUpdate();
410
+ }
411
+ };
412
+ const handleInputChange = (newValue) => {
413
+ if (inputValue !== newValue) {
414
+ setHighlightedIndex(DEFAULT_HIGHLIGHTED_INDEX$1, { reason: 'auto' });
415
+ updateInputValue(newValue);
416
+ }
417
+ return false;
418
+ };
419
+ const getIsItemCanSelected = (item) => {
420
+ return ((!!item && item.freeSolo) ||
421
+ (isItemCanSelected(item) && !getOptionDisabled?.(item)));
422
+ };
423
+ const selectItem = (e, selectedItem) => {
424
+ if (getIsItemCanSelected(selectedItem)) {
425
+ onSelect?.(e, selectedItem);
426
+ return true;
427
+ }
428
+ return false;
429
+ };
430
+ const clearInput = () => {
431
+ if (inputRef.current && inputRef.current.value.length > 0) {
432
+ updateInputValue('');
433
+ }
434
+ };
435
+ const reset = (isFocus) => {
436
+ clearInput();
437
+ onInputChangeProp?.('');
438
+ if (isFocus)
439
+ focusInput();
440
+ };
441
+ const { onKeyFocusedIndexHandle, getNextFocusableOption } = useKeyboardMoveFocus({
442
+ options: optionItems,
443
+ focusedIndexRef: highlightedIndexRef,
444
+ infinite: true,
445
+ onFocusedIndexChange: (event, toIndex) => {
446
+ setHighlightedIndex(toIndex, { reason: 'keyboard', reRender: true });
447
+ event?.preventDefault();
448
+ },
449
+ getOptionDisabled: disabledItemsHighlightable
450
+ ? undefined
451
+ : (child) => {
452
+ return !getIsItemCanSelected(child);
453
+ },
454
+ });
455
+ const getItemProps = ({ item, index = 0, }) => {
456
+ const currGroup = item.group;
457
+ const isGroupTitle = item === currGroup?.options[0];
458
+ const itemCount = optionItems.length;
459
+ const groupOrder = currGroup?.order || 0;
460
+ const stringId = toOptionIdString(item.id);
461
+ return {
462
+ id: stringId ?? `${currUniqueId}-option-${index}`,
463
+ onClick: (e) => {
464
+ selectItem(e, item);
465
+ },
466
+ onMouseOver: () => {
467
+ if (highlightedIndexRef.current !== index &&
468
+ getIsItemCanSelected(item)) {
469
+ setHighlightedIndex(index, { reason: 'mouse', reRender: true });
470
+ }
471
+ },
472
+ // When title mode and is title, skip that posinset
473
+ ...(isTitleMode && isGroupTitle
474
+ ? {}
475
+ : {
476
+ role: 'option',
477
+ 'aria-setsize': itemCount - (isTitleMode ? optionsGroupList?.length || 0 : 0),
478
+ 'aria-posinset': index + 1 - (isTitleMode ? groupOrder + 1 : 0),
479
+ }),
480
+ };
481
+ };
482
+ const handleF10KeyDown = (e) => {
483
+ const highlightedIndex = highlightedIndexRef.current;
484
+ if (!e.shiftKey)
485
+ return;
486
+ const currOption = optionItems[highlightedIndex];
487
+ const currentGroup = currOption.group;
488
+ if (currentGroup && currentGroup.options.length > 1) {
489
+ handleGroupExpandedChange(currentGroup.group);
490
+ }
491
+ };
492
+ const getInputProps = (props) => {
493
+ return combineProps({
494
+ id: `${currUniqueId}-input`,
495
+ autoComplete: 'off',
496
+ onChange: (e) => {
497
+ const changeValue = e.target.value;
498
+ handleInputChange(changeValue);
499
+ },
500
+ onKeyDown: (e) => {
501
+ onKeyDownProp?.(e, highlightedIndexRef.current);
502
+ switch (e.key) {
503
+ case 'F10':
504
+ handleF10KeyDown(e);
505
+ break;
506
+ case 'Enter': {
507
+ const highlightedIndex = highlightedIndexRef.current;
508
+ if (e.which === 229)
509
+ return;
510
+ if (highlightedIndex !== DEFAULT_HIGHLIGHTED_INDEX$1) {
511
+ const currOption = optionItems[highlightedIndex];
512
+ const isGroupTitle = currOption === currOption.group?.options[0];
513
+ if (isGroupTitle) {
514
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
515
+ const { onClick } = currOption.group.getExpandIconProps();
516
+ onClick?.(e);
517
+ }
518
+ else {
519
+ selectItem(e, currOption);
520
+ }
521
+ e.stopPropagation();
522
+ }
523
+ // always preventDefault for not inset all enter into textarea
524
+ e.preventDefault();
525
+ break;
526
+ }
527
+ default:
528
+ onKeyFocusedIndexHandle(e);
529
+ break;
530
+ }
531
+ },
532
+ }, props);
533
+ };
534
+ const getInputAriaProps = (props) => {
535
+ return combineProps({
536
+ role: 'combobox',
537
+ 'aria-autocomplete': 'list',
538
+ 'aria-expanded': true,
539
+ 'aria-haspopup': true,
540
+ 'aria-controls': `${currUniqueId}-menu`,
541
+ 'aria-owns': `${currUniqueId}-menu`,
542
+ 'aria-activedescendant': (() => {
543
+ const index = highlightedIndexRef.current;
544
+ if (index < 0)
545
+ return undefined;
546
+ const option = optionItems[index];
547
+ const optionId = toOptionIdString(option?.id);
548
+ return optionId ?? `${currUniqueId}-option-${index}`;
549
+ })(),
550
+ }, props);
551
+ };
552
+ const getLabelProps = (props) => {
553
+ return combineProps({
554
+ htmlFor: `${currUniqueId}-input`,
555
+ id: `${currUniqueId}-label`,
556
+ }, props);
557
+ };
558
+ const getSuggestionListProps = (restMenuProps) => {
559
+ return combineProps({
560
+ 'aria-labelledby': `${currUniqueId}-label`,
561
+ id: `${currUniqueId}-menu`,
562
+ role: 'listbox',
563
+ }, restMenuProps);
564
+ };
565
+ const getClearButtonProps = (props) => {
566
+ return combineProps({
567
+ id: `${currUniqueId}-clear-button`,
568
+ onClick: (e) => {
569
+ onClear?.(e);
570
+ reset(true);
571
+ },
572
+ }, props);
573
+ };
574
+ useEffect(() => {
575
+ changeHighlightedIndexReasonRef.current = undefined;
576
+ });
577
+ return {
578
+ reset,
579
+ clearInput,
580
+ forceUpdate,
581
+ focusInput,
582
+ updateInputValue,
583
+ selectItem,
584
+ onKeyFocusedIndexHandle,
585
+ getClearButtonProps,
586
+ getLabelProps,
587
+ getSuggestionListProps,
588
+ getInputProps,
589
+ getInputAriaProps,
590
+ getItemProps,
591
+ highlightedIndexRef,
592
+ highlightedIndex: highlightedIndexRef.current,
593
+ optionItems,
594
+ inputValue,
595
+ onInputChange: handleInputChange,
596
+ setHighlightedIndex,
597
+ changeHighlightedIndexReasonRef,
598
+ changeHighlightedIndexReason: changeHighlightedIndexReasonRef.current,
599
+ optionsGroupList,
600
+ /** current unique id */
601
+ id: currUniqueId,
602
+ getNextFocusableOption,
603
+ handleF10KeyDown,
604
+ };
605
+ };
606
+
607
+ const List = forwardRef((props, ref) => {
608
+ const { className, context } = props;
609
+ const listRef = context?.listRef;
610
+ const rootClass = context?.rootClass;
611
+ const forkRef = useForkRef(ref, listRef);
612
+ return (jsx("div", { ref: forkRef, className: clsx(className, rootClass), "data-suggestion-list": true, ...props }));
613
+ });
614
+ const SuggestionList = forwardRef((inProps, ref) => {
615
+ const props = useThemeProps({ props: inProps, name: 'SuggestionList' });
616
+ const { highlightedIndex, options, getItemProps, virtualize = true, renderOption, value: selectedOptions, inputValue, groupVariant, groupExpanded, renderGroup, optionsGroupList, getOptionDisabled, getOptionSelected, changeHighlightedIndexReason, isKeepHighlightedIndex, components: componentsProp, onContainerHeightChange, getOptionLabel, padding = 8, maxContainerHeight = '100%', className: classNameProp, classes: classesProp, getSuggestionListProps, ...rest } = props;
617
+ const vlRef = useRef(null);
618
+ const forkVlRef = useForkRef(ref, vlRef);
619
+ const isTitleMode = groupVariant === 'normal';
620
+ const listRef = useRef(null);
621
+ const itemData = options;
622
+ const itemCount = options.length;
623
+ const cls = useClasses('suggestion-list', classesProp, classNameProp);
624
+ const { totalListHeightChanged, style, containerHeighRef } = useDynamicHeight({
625
+ itemCount,
626
+ maxContainerHeight,
627
+ onContainerHeightChange: (changeHeight) => {
628
+ const scroller = scrollerRef.current;
629
+ if (scroller?.style) {
630
+ scroller.style.height = `${changeHeight}px`;
631
+ onContainerHeightChange?.();
632
+ }
633
+ },
634
+ });
635
+ const { sleep } = useSleep();
636
+ const { retry: scrollToIndexWithRetry } = useRetry(async (location) => {
637
+ const toIndex = location.index;
638
+ if (!virtualize) {
639
+ const toElm = listRef.current?.querySelector(`[data-item-index="${toIndex}"]`);
640
+ toElm?.scrollIntoView({ block: 'nearest', inline: 'nearest' });
641
+ return true;
642
+ }
643
+ if (location.index === 0 && padding !== undefined) {
644
+ location = {
645
+ ...location,
646
+ offset: -(typeof padding === 'number' ? padding : 8),
647
+ };
648
+ }
649
+ vlRef.current?.scrollToIndex(location);
650
+ await sleep(0);
651
+ // confirm that scrollInto view
652
+ const toElm = listRef.current?.querySelector(`[data-item-index="${toIndex}"]`);
653
+ return !!toElm;
654
+ }, {
655
+ retryTimes: 10,
656
+ intervalTime: 20,
657
+ });
658
+ const { scrollerRef, scrollerRefFn, itemsRendered, scrollToHighlightedIndex, } = useHighlightScroll({
659
+ containerHeighRef,
660
+ scrollToIndex: scrollToIndexWithRetry,
661
+ });
662
+ const prevHighlightedIndex = usePrevious(() => highlightedIndex, true);
663
+ useLayoutEffect(() => {
664
+ if ((!virtualize || vlRef.current) &&
665
+ !isKeepHighlightedIndex &&
666
+ // * only scroll when reason is 'keyboard'
667
+ changeHighlightedIndexReason &&
668
+ changeHighlightedIndexReason !== 'mouse') {
669
+ scrollToHighlightedIndex(prevHighlightedIndex, highlightedIndex,
670
+ // when title group topHighlightIndex to be 1, first item is group title
671
+ isTitleMode ? 1 : 0);
672
+ }
673
+ });
674
+ const handleScrolling = (scrolling) => {
675
+ const list = listRef.current;
676
+ if (!list)
677
+ return;
678
+ list.style.pointerEvents = scrolling ? 'none' : '';
679
+ };
680
+ const itemContent = (index, option) => {
681
+ const currGroup = option.group;
682
+ const isGroupTitle = option === currGroup?.options[0];
683
+ const isFixedGroupExpanded = typeof groupExpanded === 'boolean';
684
+ const expandable = !isTitleMode && !isFixedGroupExpanded && isGroupTitle;
685
+ const expanded = option.group?.expanded;
686
+ const expandIconProps = !expandable
687
+ ? option.group?.getExpandIconProps?.({
688
+ className: cls('expand-icon'),
689
+ 'aria-expanded': expanded,
690
+ })
691
+ : undefined;
692
+ const itemProps = getItemProps({
693
+ item: option,
694
+ index,
695
+ });
696
+ const resultProps = {
697
+ 'data-item-index': !virtualize ? index : undefined,
698
+ ...option,
699
+ ...itemProps,
700
+ label: option.label,
701
+ key: itemProps.id,
702
+ };
703
+ const highlighted = highlightedIndex === index;
704
+ const selected = getOptionSelected?.(option);
705
+ const indexInOwnGroup = resultProps.indexInOwnGroup;
706
+ delete resultProps.indexInOwnGroup;
707
+ // * when item is not disabled, that should check outside is that disabled
708
+ if (!resultProps.freeSolo && !resultProps.disabled && getOptionDisabled) {
709
+ resultProps.disabled = getOptionDisabled(option);
710
+ }
711
+ const state = {
712
+ inputValue,
713
+ highlighted,
714
+ index,
715
+ indexInOwnGroup,
716
+ };
717
+ if (renderGroup && isGroupTitle) {
718
+ return renderGroup(resultProps, {
719
+ ...state,
720
+ expanded,
721
+ expandIconProps,
722
+ });
723
+ }
724
+ if (renderOption) {
725
+ return renderOption(resultProps, state);
726
+ }
727
+ const { error, group, freeSolo, key, ...restProps } = resultProps;
728
+ return (jsxs(SuggestionListItem, { ...restProps, id: typeof resultProps.id === 'number'
729
+ ? `${resultProps.id}`
730
+ : resultProps.id, expandable: isGroupTitle, isGroupTitle: isGroupTitle, isTitleMode: isTitleMode, highlighted: highlighted, selected: selected, disabled: resultProps.disabled, label: getOptionLabel ? getOptionLabel(option) : option.label, expandIconProps: expandIconProps, children: [getOptionLabel ? getOptionLabel(option) : option.label, expandIconProps && (jsx(IconButton, { shape: 'squircle', background: false, variant: "contained", size: "small", ...expandIconProps, color: 'secondary', children: jsx(ExpandCollapseCaret, { expanded: Boolean(expanded) }) }))] }, key));
731
+ };
732
+ const PaddingComponent = (() => {
733
+ const paddingValue = padding !== undefined && itemCount > 0
734
+ ? typeof padding === 'number'
735
+ ? padding
736
+ : 8
737
+ : 0;
738
+ return () => jsx("div", { style: { height: paddingValue } });
739
+ })();
740
+ const components = {
741
+ List: List,
742
+ Header: PaddingComponent,
743
+ Footer: PaddingComponent,
744
+ ...componentsProp,
745
+ };
746
+ const rootClass = cls('root');
747
+ const context = { listRef, rootClass };
748
+ return virtualize ? (jsx(Virtuoso, { ref: forkVlRef, totalCount: itemCount, data: itemData, context: context, components: components, itemContent: itemContent, ...getSuggestionListProps(), ...combineProps({
749
+ scrollerRef: (scrollElm) => {
750
+ scrollerRefFn(scrollElm);
751
+ },
752
+ itemsRendered,
753
+ totalListHeightChanged,
754
+ style,
755
+ isScrolling: handleScrolling,
756
+ }, rest) })) : (jsxs(List, { style: { maxHeight: style.height, overflow: 'auto' }, ref: (scrollElm) => {
757
+ listRef.current = scrollElm;
758
+ scrollerRefFn(scrollElm);
759
+ }, className: cls('root'), ...getSuggestionListProps(), ...rest, children: [jsx(PaddingComponent, {}), options.map((x, i) => {
760
+ return itemContent(i, x);
761
+ }), jsx(PaddingComponent, {})] }));
762
+ });
763
+ SuggestionList.displayName = 'SuggestionList';
764
+
765
+ var Autocomplete$1 = {"sui-autocomplete-chevron":"sui-autocomplete-chevron","sui-autocomplete-clear":"sui-autocomplete-clear","sui-autocomplete-root":"sui-autocomplete-root","sui-focused":"sui-focused","sui-disabled":"sui-disabled","sui-autocomplete-input-container":"sui-autocomplete-input-container","sui-autocomplete-form-field-content":"sui-autocomplete-form-field-content","sui-autocomplete-form-field-content-xlarge":"sui-autocomplete-form-field-content-xlarge","sui-autocomplete-form-field-content-large":"sui-autocomplete-form-field-content-large","sui-autocomplete-form-field-content-medium":"sui-autocomplete-form-field-content-medium","sui-autocomplete-input-container-xlarge":"sui-autocomplete-input-container-xlarge","sui-autocomplete-input-container-large":"sui-autocomplete-input-container-large","sui-autocomplete-input-container-medium":"sui-autocomplete-input-container-medium","sui-autocomplete-input":"sui-autocomplete-input","sui-autocomplete-input-xlarge":"sui-autocomplete-input-xlarge","sui-autocomplete-input-large":"sui-autocomplete-input-large","sui-autocomplete-input-medium":"sui-autocomplete-input-medium","sui-autocomplete-outlined-expanded":"sui-autocomplete-outlined-expanded","sui-autocomplete-outlined-expanded-chevron":"sui-autocomplete-outlined-expanded-chevron","sui-autocomplete-standard-expanded-chevron":"sui-autocomplete-standard-expanded-chevron","sui-autocomplete-error-chevron":"sui-autocomplete-error-chevron","sui-autocomplete-end-adornment":"sui-autocomplete-end-adornment","sui-autocomplete-popper-root":"sui-autocomplete-popper-root","sui-popper-widget":"sui-popper-widget","sui-autocomplete-popper-paper":"sui-autocomplete-popper-paper","sui-autocomplete-popper-empty":"sui-autocomplete-popper-empty"};
766
+
767
+ function stringArrToRegExp(keyToTags) {
768
+ return new RegExp(keyToTags?.join('|') || '', 'g');
769
+ }
770
+ const TAG_TOKEN = 'rc-chip-';
771
+ const DEFAULT_LIMIT_CHIPS$1 = 20;
772
+ const DEFAULT_KEY_TO_CHIPS = [';', ',', '\\n'];
773
+ /** @inner inner hook work with useAutocomplete */
774
+ const useAutocompleteTag = ({ id: AutocompleteId, value: selectedItemsProp = [], onChange: onSelectChange, variant, getOptionLabel = DEFAULT_GET_OPTION_LABEL, onInputChange: onInputChangeProp, freeSolo, multiple, wrapperRef, inputRef, maxFreeSolo = DEFAULT_LIMIT_CHIPS$1, keyToTags = DEFAULT_KEY_TO_CHIPS, onMaxFreeSolo, required, disabled, getStopCreateFreeSolo, onReset, onAddTags, }) => {
775
+ const isAutocomplete = variant === 'autocomplete';
776
+ const isSelectedFromAutocompleteRef = useRef(false);
777
+ const [tags, _setTags] = useControlled({
778
+ controlled: selectedItemsProp,
779
+ default: [],
780
+ name: 'useAutocompleteTag',
781
+ });
782
+ const [focused, setFocused] = useState(false);
783
+ const [focusedIndexRef, setFocusedIndex] = useRefState(0);
784
+ const freeSoloCount = useMemo(() => tags.filter((x) => x.freeSolo).length, [tags]);
785
+ const setTags = (_selectedItems) => {
786
+ _setTags(_selectedItems);
787
+ onSelectChange?.(_selectedItems);
788
+ if (isAutocomplete && _selectedItems.length === 1) {
789
+ const result = getOptionLabel(_selectedItems[0]);
790
+ onInputChangeProp?.(result);
791
+ isSelectedFromAutocompleteRef.current = true;
792
+ }
793
+ };
794
+ const _focusTag = (tagToFocus) => {
795
+ const textFieldElm = wrapperRef?.current;
796
+ const inputElm = inputRef.current;
797
+ if (tagToFocus === -1) {
798
+ inputElm?.focus();
799
+ }
800
+ else {
801
+ textFieldElm
802
+ ?.querySelector(`[data-tag-index="${tagToFocus}"]`)
803
+ ?.focus();
804
+ }
805
+ };
806
+ const focusTag = useEventCallback((tagToFocus, focus = true) => {
807
+ if (focusedIndexRef.current === tagToFocus)
808
+ return;
809
+ setFocusedIndex(tagToFocus);
810
+ if (focus)
811
+ _focusTag(tagToFocus);
812
+ });
813
+ /** when return `true` mean add item success */
814
+ const checkAndAddFreeSolo = ({ selectedItem, value, } = {}, e) => {
815
+ let isAddItem = false;
816
+ const currentValue = value ?? inputRef.current?.value;
817
+ if (!getStopCreateFreeSolo?.() &&
818
+ !selectedItem &&
819
+ freeSolo &&
820
+ currentValue &&
821
+ currentValue.length > 0) {
822
+ if (freeSoloCount < maxFreeSolo) {
823
+ const items = currentValue
824
+ .trim()
825
+ .split(stringArrToRegExp(keyToTags))
826
+ .filter((x) => x.trim() !== '');
827
+ const toLength = freeSoloCount + items.length;
828
+ if (toLength > maxFreeSolo) {
829
+ items.splice(-(toLength - maxFreeSolo));
830
+ onMaxFreeSolo?.(maxFreeSolo);
831
+ }
832
+ if (items.length > 0) {
833
+ addTags([
834
+ ...tags,
835
+ ...items.map((label) => ({
836
+ id: uniqueId(TAG_TOKEN),
837
+ freeSolo: true,
838
+ label,
839
+ })),
840
+ ]);
841
+ isAddItem = true;
842
+ }
843
+ }
844
+ else {
845
+ onMaxFreeSolo?.(maxFreeSolo);
846
+ }
847
+ onReset?.(e);
848
+ }
849
+ return isAddItem;
850
+ };
851
+ const onInputChange = (e) => {
852
+ const newValue = e.target['value'];
853
+ if (stringArrToRegExp(keyToTags).test(newValue || '')) {
854
+ return checkAndAddFreeSolo({ value: newValue });
855
+ }
856
+ return false;
857
+ };
858
+ const removeTag = (selectedItem) => {
859
+ const selectedItemIndex = tags.indexOf(selectedItem);
860
+ if (selectedItemIndex > -1) {
861
+ setTags([
862
+ ...tags.slice(0, selectedItemIndex),
863
+ ...tags.slice(selectedItemIndex + 1),
864
+ ]);
865
+ }
866
+ };
867
+ const addTags = (tags) => {
868
+ setTags(tags);
869
+ onAddTags?.();
870
+ };
871
+ const addTagOnSelect = (selectedItem) => {
872
+ // * change to uniqueId
873
+ if (selectedItem.freeSolo) {
874
+ if (freeSoloCount < maxFreeSolo) {
875
+ selectedItem.id = uniqueId(TAG_TOKEN);
876
+ }
877
+ else {
878
+ onMaxFreeSolo?.(maxFreeSolo);
879
+ return;
880
+ }
881
+ }
882
+ if (multiple) {
883
+ addTags([...tags, selectedItem]);
884
+ }
885
+ else {
886
+ addTags([selectedItem]);
887
+ }
888
+ };
889
+ const { onKeyFocusedIndexHandle: handleTagKey } = useKeyboardMoveFocus({
890
+ options: tags,
891
+ focusedIndexRef,
892
+ infinite: 'order',
893
+ onFocusedIndexChange: (event, toIndex) => {
894
+ focusTag(toIndex);
895
+ event?.preventDefault();
896
+ },
897
+ });
898
+ /**
899
+ * All Get props methods
900
+ */
901
+ const getTagListBoxProps = (props) => {
902
+ return {
903
+ 'aria-required': required || false,
904
+ 'aria-disabled': disabled || false,
905
+ // TODO: wait for input can complete that.
906
+ // 'aria-multiselectable': false,
907
+ // role: selectedItems.length > 0 ? 'listbox' : undefined,
908
+ // 'aria-orientation': 'horizontal',
909
+ ...props,
910
+ };
911
+ };
912
+ const getTagProps = ({ index, selectedItem, ...restTagProps }) => {
913
+ const tabIndex =
914
+ // * when tag is not focus
915
+ !focused &&
916
+ // * and is first item
917
+ index === 0
918
+ ? 0
919
+ : -1;
920
+ return combineProps({
921
+ tabIndex,
922
+ // TODO: wait for input can complete that.
923
+ // role: 'option',
924
+ role: 'button',
925
+ key: `${AutocompleteId}-selected-item-${index}`,
926
+ 'data-tag-index': index,
927
+ 'data-item-last': index === tags.length - 1,
928
+ onClick: (e) => {
929
+ e.stopPropagation();
930
+ },
931
+ onBlur: () => setFocused(false),
932
+ onFocus: () => {
933
+ focusTag(index);
934
+ setFocused(true);
935
+ },
936
+ onKeyDown: (e) => {
937
+ const focusedIndex = focusedIndexRef.current;
938
+ switch (e.key) {
939
+ case 'Backspace':
940
+ {
941
+ const lengthBeforeDelete = tags.length;
942
+ focusTag(
943
+ // * when length is 1 mean that will be remove all
944
+ lengthBeforeDelete === 1
945
+ ? -1
946
+ : focusedIndex === 0
947
+ ? 0
948
+ : focusedIndex - 1);
949
+ removeTag(selectedItem);
950
+ }
951
+ break;
952
+ case 'Delete':
953
+ {
954
+ const lengthBeforeDelete = tags.length;
955
+ focusTag(
956
+ // * when length is 1 mean that will be remove all
957
+ lengthBeforeDelete === 1
958
+ ? -1
959
+ : focusedIndex === tags.length - 1
960
+ ? focusedIndex - 1
961
+ : focusedIndex);
962
+ removeTag(selectedItem);
963
+ }
964
+ break;
965
+ default:
966
+ handleTagKey(e);
967
+ break;
968
+ }
969
+ },
970
+ onDelete: (e) => {
971
+ // * only allow left button click
972
+ if (e.button !== 0)
973
+ return;
974
+ removeTag(selectedItem);
975
+ setFocused(false);
976
+ inputRef.current?.focus();
977
+ },
978
+ }, restTagProps);
979
+ };
980
+ return {
981
+ focused,
982
+ setFocused,
983
+ tags,
984
+ isSelectedFromAutocompleteRef,
985
+ focusedIndex: focusedIndexRef.current,
986
+ onInputChange,
987
+ checkAndAddFreeSolo,
988
+ getTagListBoxProps,
989
+ getTagProps,
990
+ focusTag,
991
+ addTagOnSelect,
992
+ clearTags: () => setTags([]),
993
+ blur: () => {
994
+ if (focusedIndexRef.current !== -1) {
995
+ focusTag(-1, false);
996
+ }
997
+ setFocused(false);
998
+ },
999
+ reset: () => focusTag(-1),
1000
+ focusLast: () => {
1001
+ const currTagsLength = tags.length;
1002
+ if (currTagsLength <= 0)
1003
+ return;
1004
+ focusTag(currTagsLength - 1);
1005
+ },
1006
+ };
1007
+ };
1008
+
1009
+ const EMPTY_TAG_TOKEN = 'rc-chip-empty';
1010
+ const DEFAULT_HIGHLIGHTED_INDEX = -1;
1011
+ const DEFAULT_LIMIT_CHIPS = 20;
1012
+ const useAutocomplete = ({ multiple: multipleProp, variant, inputValue: inputValueProp, getOptionLabel = DEFAULT_GET_OPTION_LABEL, keyToTags = DEFAULT_KEY_TO_CHIPS, filterOptions: filterOptionsProp, disabledItemsHighlightable, options, freeSolo, onInputChange: onInputChangeProp, maxFreeSolo = DEFAULT_LIMIT_CHIPS, onMaxFreeSolo, openOnFocus, toggleWithInput, disableCloseOnSelect, initialIsOpen, autoSelect, inputContainerRef, inputRef, wrapperRef, onKeyDown: onKeyDownProp, onChange: onSelectChange, value: selectedItemsProp = [], disabled, renderNoOptions, onClear, autoHighlight, getOptionDisabled, addNoOptionItem, groupBy, onGroupExpanded, groupVariant, groupExpanded, groupDefaultExpanded, getExpandIconProps, required, open: openProp, onOpen, onClose, focused, }) => {
1013
+ const isAutocomplete = variant === 'autocomplete';
1014
+ const autoCompleteSelectedIndexRef = useRef(DEFAULT_HIGHLIGHTED_INDEX);
1015
+ const AutocompleteId = useId('Autocomplete', true);
1016
+ const [inputFocused, setInputFocused] = useControlled({
1017
+ controlled: focused,
1018
+ default: false,
1019
+ name: 'useAutocomplete',
1020
+ });
1021
+ const [isOpen, setIsOpen] = useControlled({
1022
+ controlled: openProp,
1023
+ default: initialIsOpen || false,
1024
+ name: 'useAutocomplete',
1025
+ });
1026
+ const isInputValueChangedRef = useRef(false);
1027
+ const isCompositionRef = useRef(false);
1028
+ const noOptionItemRef = useRef(null);
1029
+ const stopAutoSelectRef = useRef(false);
1030
+ const fromPasteString = useRef('');
1031
+ const keepHighlightedIndexRef = useRef(false);
1032
+ const popperElementRef = useRef(null);
1033
+ const { sleep, getSleeping } = useSleep();
1034
+ // * when that is autocomplete, that will never be multiple
1035
+ const multiple = isAutocomplete ? false : multipleProp;
1036
+ const inputContainerScrollToBottom = () => {
1037
+ requestAnimationFrame(() => {
1038
+ const inputContainer = inputContainerRef?.current;
1039
+ if (inputContainer) {
1040
+ inputContainer.scrollTop = inputContainer.scrollHeight;
1041
+ }
1042
+ });
1043
+ };
1044
+ const { isSelectedFromAutocompleteRef, tags, focused: tagFocused, addTagOnSelect, checkAndAddFreeSolo, focusedIndex: focusedTagIndex, focusTag, focusLast: focusLastTag, clearTags, blur: blurTags, getTagProps, getTagListBoxProps, } = useAutocompleteTag({
1045
+ id: AutocompleteId,
1046
+ value: selectedItemsProp,
1047
+ onChange: onSelectChange,
1048
+ getOptionLabel,
1049
+ onInputChange: onInputChangeProp,
1050
+ variant,
1051
+ wrapperRef,
1052
+ inputRef,
1053
+ freeSolo,
1054
+ maxFreeSolo,
1055
+ keyToTags,
1056
+ onMaxFreeSolo,
1057
+ multiple,
1058
+ required,
1059
+ disabled,
1060
+ // * when is composition, stop freeSolo create new item
1061
+ getStopCreateFreeSolo: () => isCompositionRef.current,
1062
+ onReset: () => {
1063
+ resetState();
1064
+ },
1065
+ onAddTags: inputContainerScrollToBottom,
1066
+ });
1067
+ const processFilteredResult = useCallback((results, inputValue = '') => {
1068
+ const getInputValueAsItem = () => {
1069
+ const label = inputValue.trim();
1070
+ if (label.length > 0) {
1071
+ return {
1072
+ id: EMPTY_TAG_TOKEN,
1073
+ freeSolo: true,
1074
+ label,
1075
+ };
1076
+ }
1077
+ return null;
1078
+ };
1079
+ // * only when isOpen calculate the filtered result
1080
+ noOptionItemRef.current = null;
1081
+ if (addNoOptionItem) {
1082
+ const item = getInputValueAsItem();
1083
+ noOptionItemRef.current = item;
1084
+ if (item && freeSolo) {
1085
+ switch (addNoOptionItem) {
1086
+ case 'first':
1087
+ return [item, ...results];
1088
+ case 'last':
1089
+ return [...results, item];
1090
+ }
1091
+ }
1092
+ }
1093
+ else if (results.length === 0) {
1094
+ const item = getInputValueAsItem();
1095
+ noOptionItemRef.current = item;
1096
+ // * only when not set render no options will auto add item
1097
+ if (item && freeSolo && !renderNoOptions) {
1098
+ // * when outside not use filter, that will be original array, must use spread
1099
+ return [...results, item];
1100
+ }
1101
+ }
1102
+ return results;
1103
+ }, [addNoOptionItem, freeSolo, renderNoOptions]);
1104
+ const filterOptions = useCallback((items, state) => {
1105
+ if (filterOptionsProp) {
1106
+ return filterOptionsProp(items, {
1107
+ ...state,
1108
+ inputChanged: isInputValueChangedRef.current,
1109
+ selectedItems: tags,
1110
+ });
1111
+ }
1112
+ return items;
1113
+ }, [filterOptionsProp, tags]);
1114
+ const { inputValue, optionItems, optionsGroupList, highlightedIndexRef, changeHighlightedIndexReasonRef, forceUpdate, selectItem, handleF10KeyDown, onKeyFocusedIndexHandle, setHighlightedIndex, updateInputValue, clearInput, getNextFocusableOption, getItemProps: getSuggestionListItemProps, focusInput, reset: resetSuggestionList, getInputProps: getSuggestionListInputProps, getInputAriaProps: getSuggestionListInputAriaProps, getClearButtonProps: getSuggestionListClearButtonProps, getLabelProps, getSuggestionListProps, } = useSuggestionList({
1115
+ id: AutocompleteId,
1116
+ inputRef,
1117
+ inputValue: inputValueProp,
1118
+ options,
1119
+ disabledItemsHighlightable,
1120
+ groupVariant,
1121
+ groupExpanded,
1122
+ groupDefaultExpanded,
1123
+ getOptionLabel,
1124
+ filterOptions,
1125
+ processFilteredResult,
1126
+ onInputChange: onInputChangeProp,
1127
+ onKeyDown: onKeyDownProp,
1128
+ onClear,
1129
+ getOptionDisabled,
1130
+ groupBy,
1131
+ onGroupExpanded,
1132
+ getExpandIconProps,
1133
+ onSelect: (e, selectedItem) => {
1134
+ addTagOnSelect(selectedItem);
1135
+ resetState(e);
1136
+ if (disableCloseOnSelect) {
1137
+ if (autoHighlight) {
1138
+ const currIndex = highlightedIndexRef.current;
1139
+ const nextValidIndex = getNextFocusableOption();
1140
+ const toIndex =
1141
+ // * if that index is bigger than current index or nextValidIndex is last index,
1142
+ // * cut 1 (because current item will be remove)
1143
+ nextValidIndex > currIndex ||
1144
+ nextValidIndex === optionItems.length - 1
1145
+ ? nextValidIndex - 1
1146
+ : nextValidIndex;
1147
+ setHighlightedIndex(toIndex, {
1148
+ reRender: true,
1149
+ });
1150
+ }
1151
+ else {
1152
+ highlightedIndexRef.current = DEFAULT_HIGHLIGHTED_INDEX;
1153
+ }
1154
+ }
1155
+ },
1156
+ });
1157
+ const getItemProps = (props) => {
1158
+ return combineProps(getSuggestionListItemProps(props), {
1159
+ onMouseDown: (e) => {
1160
+ // `getPopperProps` will prevent change focus when mouse down popper
1161
+ // but suggestion item is an exception.
1162
+ // so we need stop propagation to make sure focus can be changed
1163
+ e.stopPropagation();
1164
+ },
1165
+ onMouseUp: (e) => {
1166
+ focusInput();
1167
+ },
1168
+ });
1169
+ };
1170
+ const readOnly = !isAutocomplete && !multiple && tags.length >= 1 ? true : undefined;
1171
+ const closeMenu = (e, reason) => {
1172
+ keepHighlightedIndexRef.current = false;
1173
+ isInputValueChangedRef.current = false;
1174
+ // * set to default highlighted
1175
+ setHighlightedIndex(DEFAULT_HIGHLIGHTED_INDEX, { reason: 'auto' });
1176
+ if (isOpen) {
1177
+ if (e && reason) {
1178
+ onClose?.(e, reason);
1179
+ }
1180
+ setIsOpen(false);
1181
+ }
1182
+ };
1183
+ const openMenu = (e) => {
1184
+ if (!isOpen) {
1185
+ if (e)
1186
+ onOpen?.(e);
1187
+ setIsOpen(true);
1188
+ }
1189
+ };
1190
+ const toggleMenu = (e, focus = true) => {
1191
+ if (isOpen) {
1192
+ closeMenu(e, 'toggleInput');
1193
+ }
1194
+ else {
1195
+ openMenu(e);
1196
+ if (focus)
1197
+ focusInput();
1198
+ }
1199
+ };
1200
+ const handleInputChange = (newValue, open = true, e) => {
1201
+ if (inputValue !== newValue) {
1202
+ setHighlightedIndex(DEFAULT_HIGHLIGHTED_INDEX, { reason: 'auto' });
1203
+ // !!! Get regexp every time for prevent bug with browser
1204
+ // https://stackoverflow.com/questions/3827456/what-is-wrong-with-my-date-regex/3827500#3827500
1205
+ if (stringArrToRegExp(keyToTags).test((newValue || '').trim())) {
1206
+ const resultHaveAdd = checkAndAddFreeSolo({ value: newValue }, e);
1207
+ if (!disableCloseOnSelect) {
1208
+ closeMenu(e, 'toggleInput');
1209
+ }
1210
+ else if (open) {
1211
+ openMenu(e);
1212
+ }
1213
+ return resultHaveAdd;
1214
+ }
1215
+ updateInputValue(newValue);
1216
+ }
1217
+ if (open)
1218
+ openMenu(e);
1219
+ return false;
1220
+ };
1221
+ const resetState = (e) => {
1222
+ // * when autocomplete select mode not reset input value
1223
+ if (!isSelectedFromAutocompleteRef.current) {
1224
+ clearInput();
1225
+ }
1226
+ blurTags();
1227
+ isSelectedFromAutocompleteRef.current = false;
1228
+ noOptionItemRef.current = null;
1229
+ isInputValueChangedRef.current = false;
1230
+ if (!disableCloseOnSelect) {
1231
+ closeMenu(e, 'select-option');
1232
+ }
1233
+ };
1234
+ const reset = (isFocus) => {
1235
+ resetState();
1236
+ onSelectChange?.([]);
1237
+ resetSuggestionList(isFocus);
1238
+ };
1239
+ const keepHighlightedIndex = () => {
1240
+ keepHighlightedIndexRef.current = true;
1241
+ };
1242
+ // * when outside options props props change also need set highlightedIndex to default
1243
+ useChange(() => {
1244
+ const shouldResetHighlightedIndex = !keepHighlightedIndexRef.current;
1245
+ if (options !== undefined && shouldResetHighlightedIndex) {
1246
+ setHighlightedIndex(DEFAULT_HIGHLIGHTED_INDEX, { reason: 'auto' });
1247
+ }
1248
+ }, () => options);
1249
+ // * check that defaultHighlightedIndex
1250
+ const defaultHighlightedIndex = useMemo(() => {
1251
+ return autoHighlight ? getNextFocusableOption(0) : -1;
1252
+ }, [autoHighlight, getNextFocusableOption]);
1253
+ // * only when menu is open set to defaultHighlightedIndex
1254
+ if (isOpen) {
1255
+ if (highlightedIndexRef.current === DEFAULT_HIGHLIGHTED_INDEX) {
1256
+ let toIndex = defaultHighlightedIndex;
1257
+ if (isAutocomplete && tags.length === 1) {
1258
+ const itemText = getOptionLabel(tags[0]);
1259
+ const fIndex = optionItems.findIndex((x) => getOptionLabel(x) === itemText);
1260
+ if (fIndex > -1) {
1261
+ toIndex = fIndex;
1262
+ autoCompleteSelectedIndexRef.current = fIndex;
1263
+ }
1264
+ }
1265
+ setHighlightedIndex(toIndex, { reason: 'auto' });
1266
+ }
1267
+ else {
1268
+ const currIndex = highlightedIndexRef.current;
1269
+ const availableIndex = getNextFocusableOption(currIndex);
1270
+ if (currIndex !== availableIndex) {
1271
+ requestAnimationFrame(() => {
1272
+ setHighlightedIndex(availableIndex, {
1273
+ reason: 'auto',
1274
+ reRender: true,
1275
+ });
1276
+ });
1277
+ }
1278
+ }
1279
+ }
1280
+ const handleAutocompleteText = () => {
1281
+ if (isAutocomplete && tags.length > 0) {
1282
+ const result = getOptionLabel(tags[0]);
1283
+ onInputChangeProp?.(result);
1284
+ }
1285
+ };
1286
+ // * use force update to sync open state when init is open
1287
+ useLayoutEffect(() => {
1288
+ if (isOpen) {
1289
+ forceUpdate();
1290
+ }
1291
+ handleAutocompleteText();
1292
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1293
+ }, []);
1294
+ const getInputProps = (props) => {
1295
+ const suggestionListInputProps = getSuggestionListInputProps(props);
1296
+ return combineProps({
1297
+ ...suggestionListInputProps,
1298
+ onPaste: (e) => {
1299
+ if (freeSolo) {
1300
+ const clipboardData = e.clipboardData;
1301
+ const { position } = getSelectionPosition(inputRef);
1302
+ const currText = inputValue ?? '';
1303
+ const pasteText = clipboardData.getData('Text') ?? '';
1304
+ // * because input can't get next line char(\n), we need get that value in onPaste
1305
+ // * get current input result use paste
1306
+ // * remember combine current input value, that will be use in onChange
1307
+ fromPasteString.current =
1308
+ currText.slice(0, position.start) +
1309
+ pasteText +
1310
+ currText.slice(position.end);
1311
+ }
1312
+ },
1313
+ onChange: (e) => {
1314
+ const changeValue = fromPasteString.current || e.target.value;
1315
+ handleInputChange(changeValue, undefined, e);
1316
+ // * when input value clear all, clear selected item
1317
+ if (isAutocomplete && changeValue.length === 0) {
1318
+ clearTags();
1319
+ }
1320
+ fromPasteString.current = '';
1321
+ isInputValueChangedRef.current = true;
1322
+ },
1323
+ onFocus: (e) => {
1324
+ setInputFocused(true);
1325
+ if (openOnFocus)
1326
+ openMenu(e);
1327
+ // * when autocomplete mode, always select all text when focus
1328
+ if (isAutocomplete) {
1329
+ inputRef.current?.select();
1330
+ }
1331
+ // * reset stopAutoSelect in focus input
1332
+ stopAutoSelectRef.current = false;
1333
+ blurTags();
1334
+ },
1335
+ onBlur: (e) => {
1336
+ setInputFocused(false);
1337
+ // mouse down suggestion item will change focus,
1338
+ // but we don't want to close popper in this case
1339
+ if (popperElementRef.current?.contains(e.relatedTarget))
1340
+ return;
1341
+ if (autoSelect && !stopAutoSelectRef.current) {
1342
+ if (!freeSolo)
1343
+ selectItem(e, optionItems[highlightedIndexRef.current]);
1344
+ checkAndAddFreeSolo({}, e);
1345
+ }
1346
+ // * when blur should restore text when have selected item
1347
+ handleAutocompleteText();
1348
+ closeMenu(e, 'blur');
1349
+ },
1350
+ onCompositionStart: () => {
1351
+ isCompositionRef.current = true;
1352
+ },
1353
+ onCompositionEnd: async () => {
1354
+ // sleep for prevent tab in composition
1355
+ await sleep(20);
1356
+ isCompositionRef.current = false;
1357
+ },
1358
+ onKeyDown: (e) => {
1359
+ keepHighlightedIndexRef.current = false;
1360
+ onKeyDownProp?.(e, highlightedIndexRef.current);
1361
+ const { isSelectRange, position } = getSelectionPosition(inputRef);
1362
+ const currTagsLength = tags.length;
1363
+ if (!isSelectRange &&
1364
+ position.start === 0 &&
1365
+ currTagsLength > 0 &&
1366
+ e.key === 'Backspace') {
1367
+ stopAutoSelectRef.current = true;
1368
+ focusLastTag();
1369
+ }
1370
+ else {
1371
+ const highlightedIndex = highlightedIndexRef.current;
1372
+ switch (e.key) {
1373
+ case 'Escape':
1374
+ if (isOpen) {
1375
+ // Avoid Opera to exit fullscreen mode.
1376
+ e.preventDefault();
1377
+ // Avoid the Modal to handle the event.
1378
+ e.stopPropagation();
1379
+ closeMenu(e, 'escape');
1380
+ }
1381
+ break;
1382
+ case 'Tab':
1383
+ if (e.which === 229)
1384
+ return;
1385
+ if (getSleeping()) {
1386
+ e.preventDefault();
1387
+ e.stopPropagation();
1388
+ return;
1389
+ }
1390
+ // * when shift+ tab also not need autoSelect
1391
+ if (e.shiftKey && currTagsLength > 0) {
1392
+ stopAutoSelectRef.current = true;
1393
+ }
1394
+ // ! [Browser] when in composition,
1395
+ // ! and keydown 'Tab' that will trigger twice keydown,
1396
+ // ! must check is that is not in composition mode
1397
+ if (!e.shiftKey && !isCompositionRef.current) {
1398
+ const currentHighlightItem = optionItems[highlightedIndex];
1399
+ if (isOpen && currentHighlightItem) {
1400
+ if (selectItem(e, currentHighlightItem)) {
1401
+ e.preventDefault();
1402
+ e.stopPropagation();
1403
+ }
1404
+ }
1405
+ else if (checkAndAddFreeSolo({}, e)) {
1406
+ e.preventDefault();
1407
+ e.stopPropagation();
1408
+ }
1409
+ }
1410
+ break;
1411
+ case 'Enter':
1412
+ if (e.which === 229)
1413
+ return;
1414
+ if (freeSolo &&
1415
+ highlightedIndex === DEFAULT_HIGHLIGHTED_INDEX &&
1416
+ checkAndAddFreeSolo({
1417
+ selectedItem: isOpen
1418
+ ? optionItems[highlightedIndex]
1419
+ : undefined,
1420
+ }, e)) {
1421
+ e.stopPropagation();
1422
+ closeMenu(e, 'select-option');
1423
+ }
1424
+ else if (highlightedIndex !== DEFAULT_HIGHLIGHTED_INDEX &&
1425
+ isOpen &&
1426
+ !isCompositionRef.current) {
1427
+ selectItem(e, optionItems[highlightedIndex]);
1428
+ e.stopPropagation();
1429
+ }
1430
+ // always preventDefault for not inset all enter into textarea
1431
+ e.preventDefault();
1432
+ break;
1433
+ case 'F10':
1434
+ handleF10KeyDown(e);
1435
+ break;
1436
+ case 'ArrowUp':
1437
+ case 'ArrowDown':
1438
+ if (readOnly) {
1439
+ e.preventDefault();
1440
+ return;
1441
+ }
1442
+ // * check state for is that should move key in option items
1443
+ if (isAutocomplete && tags.length > 0 && !isOpen) {
1444
+ openMenu(e);
1445
+ e.preventDefault();
1446
+ break;
1447
+ }
1448
+ onKeyFocusedIndexHandle(e);
1449
+ openMenu(e);
1450
+ break;
1451
+ default:
1452
+ if (isOpen) {
1453
+ onKeyFocusedIndexHandle(e);
1454
+ }
1455
+ break;
1456
+ }
1457
+ }
1458
+ },
1459
+ onMouseDown: toggleWithInput
1460
+ ? (e) => {
1461
+ /**
1462
+ * If the popup isn't open and `openOnFocus` is disabled we should
1463
+ * show the popup. If `openOnFocus` is enabled the `onFocus` handler
1464
+ * will take care of opening the popup when necessary.
1465
+ *
1466
+ * If the popup is open and the user hasn't typed a value we should
1467
+ * hide it, but if they have typed a value we shouldn't hide it to
1468
+ * ensure the the available results remain visible to the user.
1469
+ */
1470
+ if (!isOpen || (isOpen && !inputValue)) {
1471
+ toggleMenu(e, false);
1472
+ }
1473
+ }
1474
+ : undefined,
1475
+ }, props);
1476
+ };
1477
+ const getInputAriaProps = (props) => {
1478
+ const suggestionListInputAriaProps = getSuggestionListInputAriaProps(props);
1479
+ return combineProps({
1480
+ ...suggestionListInputAriaProps,
1481
+ readOnly,
1482
+ unselectable: readOnly ? 'on' : undefined,
1483
+ 'aria-owns': isOpen
1484
+ ? suggestionListInputAriaProps['aria-owns']
1485
+ : undefined,
1486
+ 'aria-expanded': !!isOpen,
1487
+ }, props);
1488
+ };
1489
+ const getPopperProps = (restPopperProps) => {
1490
+ return combineProps({
1491
+ id: `${AutocompleteId}-popper`,
1492
+ role: 'presentation',
1493
+ onMouseDown: (e) => {
1494
+ e.preventDefault();
1495
+ e.stopPropagation();
1496
+ },
1497
+ }, restPopperProps);
1498
+ };
1499
+ const getToggleButtonProps = (props) => {
1500
+ return combineProps({
1501
+ disabled: (!isOpen && optionItems.length === 0) || disabled || readOnly,
1502
+ id: `${AutocompleteId}-toggle-button`,
1503
+ onMouseDown: (e) => {
1504
+ e.preventDefault();
1505
+ e.stopPropagation();
1506
+ },
1507
+ onClick: toggleMenu,
1508
+ tabIndex: -1,
1509
+ }, props);
1510
+ };
1511
+ const getClearButtonProps = (props) => {
1512
+ const suggestionListClearButtonProps = getSuggestionListClearButtonProps(props);
1513
+ return combineProps({
1514
+ ...suggestionListClearButtonProps,
1515
+ disabled,
1516
+ onClick: (e) => {
1517
+ onClear?.(e);
1518
+ reset(true);
1519
+ },
1520
+ }, props);
1521
+ };
1522
+ const getNoOptionsProps = (additionProps) => {
1523
+ return combineProps({
1524
+ onClick: (e) => {
1525
+ closeMenu(e, 'blur');
1526
+ },
1527
+ role: 'presentation',
1528
+ }, additionProps);
1529
+ };
1530
+ return {
1531
+ focusInput,
1532
+ readOnly,
1533
+ getTagProps,
1534
+ getClearButtonProps,
1535
+ activeIndex: focusedTagIndex,
1536
+ setActiveIndex: focusTag,
1537
+ isOpen,
1538
+ getToggleButtonProps,
1539
+ getPopperProps,
1540
+ getLabelProps,
1541
+ getSuggestionListProps,
1542
+ getInputProps,
1543
+ getInputAriaProps,
1544
+ getTagListBoxProps,
1545
+ getItemProps,
1546
+ getNoOptionsProps,
1547
+ noOptionItem: noOptionItemRef.current,
1548
+ highlightedIndex: highlightedIndexRef.current,
1549
+ tags,
1550
+ optionItems,
1551
+ inputValue,
1552
+ onInputChange: handleInputChange,
1553
+ keepHighlightedIndex,
1554
+ isKeepHighlightedIndex: keepHighlightedIndexRef.current,
1555
+ setHighlightedIndex,
1556
+ changeHighlightedIndexReason: changeHighlightedIndexReasonRef.current,
1557
+ closeMenu,
1558
+ openMenu,
1559
+ reset,
1560
+ forceUpdate,
1561
+ optionsGroupList,
1562
+ /** that state of current Autocomplete focused, both tag or input focused */
1563
+ focused: focused ?? (tagFocused || inputFocused ? true : undefined),
1564
+ id: AutocompleteId,
1565
+ inputChanged: isInputValueChangedRef.current,
1566
+ autoCompleteSelectedIndex: autoCompleteSelectedIndexRef.current,
1567
+ popperElementRef,
1568
+ };
1569
+ };
1570
+
1571
+ const ChipSizeMap = {
1572
+ xlarge: 'large',
1573
+ large: 'medium',
1574
+ medium: 'small',
1575
+ };
1576
+ const InputComponent = forwardRef(({ startAdornment, containerRef, containerClassName, onContainerClick, ...rest }, ref) => {
1577
+ return (
1578
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events
1579
+ jsxs("div", { ref: containerRef, className: containerClassName, onClick: onContainerClick, children: [startAdornment, jsx("input", { ...rest, ref: ref })] }));
1580
+ });
1581
+ const TextInput = forwardRef(({ renderInput, ...rest }, ref) => {
1582
+ if (renderInput) {
1583
+ return renderInput({ ...rest, ref });
1584
+ }
1585
+ return jsx(TextField, { ref: ref, ...rest });
1586
+ });
1587
+ const Autocomplete = forwardRef((inProps, ref) => {
1588
+ const props = useThemeProps({ props: inProps, name: 'Autocomplete' });
1589
+ const isAutocomplete = props.variant === 'autocomplete';
1590
+ const { inputVariant = 'standard', variant, groupExpanded, onGroupExpanded, groupDefaultExpanded, groupVariant = 'normal', getExpandIconProps, groupBy, value: valueProp, autoHighlight = true, clearBtn = false, toggleButton = false, multiple = false, ClearButtonProps, onClear, ToggleButtonProps, getToggleButtonProps: getToggleButtonPropsProp, inputValue: inputValueProp, onKeyDown: onKeyDownProp, helperText: helperTextProp, options, openOnFocus = true, toggleWithInput = true, getOptionLabel = DEFAULT_GET_OPTION_LABEL, renderInput, label, inputRef: inputRefProp, error, placeholder, showPlaceholderWithTags, freeSolo, keyToTags = DEFAULT_KEY_TO_CHIPS, maxFreeSolo, SuggestionListProps: { virtualize = true, ...SuggestionListProps } = {}, autoSelect, PopperComponent = Popper, PopperProps: { anchorElType = 'root',
1591
+ // transition: popperTransition,
1592
+ // TransitionComponent = virtualize ? RcFade : RcGrow,
1593
+ // transitionDuration: transitionDurationProp = 'auto',
1594
+ // TransitionProps: TransitionPropsProp = {},
1595
+ ...PopperProps } = {}, initialIsOpen, disabled, required: requiredProp, disableCloseOnSelect = multiple, onChange: onChangeProp, onInputChange: onInputChangeProp, onMaxFreeSolo, FormHelperTextProps, action, filterOptions, renderOption, renderTags, getOptionDisabled, renderGroup, renderNoOptions, inputProps,
1596
+ // InputProps: InputPropsProp,
1597
+ debug, disabledItemsHighlightable, open: openProp, addNoOptionItem, onOpen, onClose, focused, classes, className, fullWidth = true, size = 'xlarge', ...rest } = props;
1598
+ const cls = useClasses('autocomplete', classes, className);
1599
+ const innerInputRef = useRef(null);
1600
+ const textFieldRef = useRef(null);
1601
+ const inputRef = useForkRef(inputRefProp, innerInputRef);
1602
+ const formFieldContentRef = useRef(null);
1603
+ const inputContainerRef = useRef(null);
1604
+ const prefersReducedMotion = usePrefersReducedMotion();
1605
+ const anchorElRef = anchorElType === 'input' ? formFieldContentRef : textFieldRef;
1606
+ let oneOfTagError = false;
1607
+ const required = requiredProp;
1608
+ const { focusInput, optionItems, optionsGroupList, tags: selectedItems, highlightedIndex, getToggleButtonProps, getTagProps, getTagListBoxProps, getSuggestionListProps, getPopperProps, getInputProps, getInputAriaProps,
1609
+ // getLabelProps,
1610
+ getItemProps, isOpen, inputValue, activeIndex, setActiveIndex, setHighlightedIndex, onInputChange, keepHighlightedIndex, changeHighlightedIndexReason, closeMenu, openMenu, reset, getClearButtonProps, noOptionItem, getNoOptionsProps, isKeepHighlightedIndex,
1611
+ // focused: isAutocompleteFocused,
1612
+ // autoCompleteSelectedIndex,
1613
+ popperElementRef, } = useAutocomplete({
1614
+ focused,
1615
+ open: openProp,
1616
+ addNoOptionItem,
1617
+ variant,
1618
+ onOpen,
1619
+ onClose,
1620
+ wrapperRef: textFieldRef,
1621
+ inputContainerRef,
1622
+ inputRef: innerInputRef,
1623
+ value: valueProp,
1624
+ inputValue: inputValueProp,
1625
+ getOptionDisabled,
1626
+ groupExpanded: groupVariant === 'normal' ? true : groupExpanded,
1627
+ groupDefaultExpanded,
1628
+ getExpandIconProps,
1629
+ options,
1630
+ freeSolo,
1631
+ multiple,
1632
+ keyToTags,
1633
+ maxFreeSolo,
1634
+ autoSelect,
1635
+ disableCloseOnSelect,
1636
+ initialIsOpen,
1637
+ disabled,
1638
+ required,
1639
+ openOnFocus,
1640
+ toggleWithInput,
1641
+ autoHighlight,
1642
+ groupBy,
1643
+ groupVariant,
1644
+ onChange: onChangeProp,
1645
+ onInputChange: onInputChangeProp,
1646
+ getOptionLabel,
1647
+ filterOptions,
1648
+ onMaxFreeSolo,
1649
+ renderNoOptions,
1650
+ onKeyDown: onKeyDownProp,
1651
+ disabledItemsHighlightable,
1652
+ onGroupExpanded,
1653
+ });
1654
+ const open = Boolean((isOpen || noOptionItem) && textFieldRef.current);
1655
+ const { onBlur, ...InputProps } = getInputProps(inputProps);
1656
+ const helperText = helperTextProp;
1657
+ const toTextFieldRef = useForkRef(textFieldRef, ref);
1658
+ const startAdornment = (() => {
1659
+ if (isAutocomplete || selectedItems.length === 0) {
1660
+ return undefined;
1661
+ }
1662
+ const getCustomizedTagProps = (selectedItem, index) => {
1663
+ const tagProps = getTagProps({
1664
+ selectedItem,
1665
+ index,
1666
+ label: getOptionLabel(selectedItem),
1667
+ disabled,
1668
+ });
1669
+ if (selectedItem.error) {
1670
+ oneOfTagError = true;
1671
+ }
1672
+ return { ...tagProps, size: ChipSizeMap[size], className: cls('chip') };
1673
+ };
1674
+ return renderTags
1675
+ ? renderTags(selectedItems, getCustomizedTagProps)
1676
+ : selectedItems.map((selectedItem, index) => {
1677
+ const { children, key, ...itemChipProps } = getCustomizedTagProps(selectedItem, index);
1678
+ return (jsx(Chip, { "aria-label": `${itemChipProps.label}, press Backspace to remove`, color: selectedItem.error ? 'error' : undefined, ...itemChipProps }, key));
1679
+ });
1680
+ })();
1681
+ const endAdornment = (toggleButton || clearBtn) && (jsxs(Fragment, { children: [clearBtn && (selectedItems.length > 0 || inputValue) && (jsx(IconButton, { shape: 'squircle', background: false, color: 'secondary', variant: "contained", size: "small", className: cls('clear'), symbol: Xsm, ...getClearButtonProps(ClearButtonProps) })), toggleButton && (jsx(IconButton, { "aria-hidden": true, tabIndex: -1, shape: 'squircle', color: 'secondary', background: false, variant: "contained", size: "small", className: cls('chevron', error && 'error-chevron', open && `${inputVariant}-expanded-chevron`), children: jsx(ExpandCollapseCaret, { size: 'small', expanded: open }), ...getToggleButtonProps({
1682
+ ...ToggleButtonProps,
1683
+ ...getToggleButtonPropsProp?.(open),
1684
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1685
+ }) }))] }));
1686
+ const TextFieldInputProps = {
1687
+ 'aria-label': typeof label === 'string' ? label : undefined,
1688
+ ...getTagListBoxProps(),
1689
+ ...InputProps,
1690
+ onBlur: debug ? undefined : onBlur,
1691
+ };
1692
+ useImperativeHandle(action, () => ({
1693
+ getActiveIndex: () => activeIndex,
1694
+ setActiveIndex,
1695
+ getFilterResultItems: () => optionItems,
1696
+ getHighlightedIndex: () => highlightedIndex,
1697
+ setHighlightedIndex: (index) => setHighlightedIndex(index, { reason: 'auto', reRender: true }),
1698
+ closeMenu,
1699
+ openMenu,
1700
+ reset,
1701
+ clearInput: () => onInputChange('', false),
1702
+ keepHighlightedIndex: () => keepHighlightedIndex(),
1703
+ focus: focusInput,
1704
+ }));
1705
+ const hasTags = selectedItems.length > 0;
1706
+ const willRenderNoOptions = !!noOptionItem && !!renderNoOptions;
1707
+ // const popperRef: ComponentProps<typeof StyledPopper>['popperRef'] =
1708
+ // useRef(null);
1709
+ // const handleUpdatePopper = useEventCallback(() => {
1710
+ // popperRef.current?.update();
1711
+ // });
1712
+ const menuChildren =
1713
+ // * that root element for animation host
1714
+ isOpen && (jsxs(Fragment, { children: [jsx(SuggestionList
1715
+ // TODO: deprecated, need to check if it will cause error when variant is 'autocomplete'
1716
+ // selectedIndex={isAutocomplete ? autoCompleteSelectedIndex : undefined}
1717
+ , {
1718
+ // TODO: deprecated, need to check if it will cause error when variant is 'autocomplete'
1719
+ // selectedIndex={isAutocomplete ? autoCompleteSelectedIndex : undefined}
1720
+ highlightedIndex: highlightedIndex, optionsGroupList: optionsGroupList, options: optionItems, groupVariant: groupVariant, groupExpanded: groupExpanded, renderGroup: renderGroup, renderOption: renderOption, inputValue: inputValue, getItemProps: getItemProps, getSuggestionListProps: getSuggestionListProps, changeHighlightedIndexReason: changeHighlightedIndexReason, getOptionDisabled: getOptionDisabled, isKeepHighlightedIndex: isKeepHighlightedIndex,
1721
+ // onContainerHeightChange={handleUpdatePopper}
1722
+ maxContainerHeight: 180, getOptionLabel: getOptionLabel, position: "unset", virtualize: virtualize, ...SuggestionListProps }), willRenderNoOptions &&
1723
+ renderNoOptions?.(getNoOptionsProps, noOptionItem)] }));
1724
+ const isPopperContentEmpty = !isOpen || (!willRenderNoOptions && optionItems.length === 0);
1725
+ const popperCls = useClasses('autocomplete-popper', PopperProps?.classes, PopperProps?.className);
1726
+ return (jsxs(Fragment, { children: [jsx(TextInput, { renderInput: renderInput,
1727
+ // hasTags={hasTags}
1728
+ variant: inputVariant, ref: toTextFieldRef, inputRef: inputRef, fullWidth: fullWidth, placeholder: !hasTags || (hasTags && multiple && showPlaceholderWithTags)
1729
+ ? placeholder
1730
+ : undefined, label: label, disabled: disabled, required: required,
1731
+ // * if below one of tag is error, that main Autocomplete default will be error
1732
+ error: error ?? oneOfTagError, FormHelperTextProps: FormHelperTextProps, inputComponent: InputComponent, endAdornment: endAdornment, helperText: helperText, size: size, ...combineProps({
1733
+ RootProps: {
1734
+ contentRef: formFieldContentRef,
1735
+ },
1736
+ inputProps: {
1737
+ startAdornment,
1738
+ containerRef: inputContainerRef,
1739
+ ...getInputAriaProps(),
1740
+ ...TextFieldInputProps,
1741
+ containerClassName: clsx(cls('input-container', `input-container-${size}`, `${inputVariant}-input-container`), TextFieldInputProps?.containerClassName),
1742
+ },
1743
+ }, rest), classes: {
1744
+ root: cls('root', { error }),
1745
+ formFieldContent: cls('form-field-content', `${inputVariant}-form-field-content`, `form-field-content-${size}`, open && `${inputVariant}-expanded`, { expanded: open }),
1746
+ standard: cls('standard'),
1747
+ outlined: cls('outlined'),
1748
+ endAdornment: cls('end-adornment'),
1749
+ input: cls('input', `input-${size}`),
1750
+ }, value: inputValue, clearBtn: false }), jsx(AnimatePresence, { children: open && (jsx(PopperComponent, { matchAnchorWidth: true, offset: 4, ...getPopperProps(PopperProps), className: popperCls('root'), ref: popperElementRef, anchorEl: anchorElRef.current, children: jsx(motion.div, { ...getFade({ prefersReducedMotion }), className: popperCls('paper', {
1751
+ empty: isPopperContentEmpty,
1752
+ }), children: menuChildren }) })) })] }));
1753
+ });
1754
+ Autocomplete.displayName = 'SuiAutocomplete';
1755
+ /**
1756
+ * default Autocomplete filter options method, use with `variant="tags"`
1757
+ *
1758
+ * - filter options by input value and selected items
1759
+ */
1760
+ const RcAutocompleteDefaultFilterOptions = (options, { inputValue, getOptionLabel, selectedItems }) => {
1761
+ return options.filter((item) => selectedItems.indexOf(item) < 0 &&
1762
+ getOptionLabel?.(item)
1763
+ .toLowerCase()
1764
+ .startsWith(inputValue?.toLowerCase() || ''));
1765
+ };
1766
+
1767
+ export { Autocomplete, DEFAULT_GET_OPTION_LABEL, DEFAULT_KEY_TO_CHIPS, RcAutocompleteDefaultFilterOptions, SuggestionList, SuggestionListItem, Autocomplete$1 as autocompleteStyles, stringArrToRegExp, SuggestionList$1 as suggestionListStyles, useAutocomplete, useAutocompleteGroup, useAutocompleteTag, useDynamicHeight, useHighlightScroll, useSuggestionList };