@pega/cosmos-react-core 2.0.0-dev.9.4 → 2.0.0-rc.4

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 (865) hide show
  1. package/README.md +3 -3
  2. package/lib/components/Actions/Actions.js +1 -1
  3. package/lib/components/Actions/Actions.js.map +1 -1
  4. package/lib/components/AppShell/AppHeader.d.ts.map +1 -1
  5. package/lib/components/AppShell/AppHeader.js +1 -6
  6. package/lib/components/AppShell/AppHeader.js.map +1 -1
  7. package/lib/components/AppShell/AppShell.d.ts.map +1 -1
  8. package/lib/components/AppShell/AppShell.js +88 -63
  9. package/lib/components/AppShell/AppShell.js.map +1 -1
  10. package/lib/components/AppShell/AppShell.styles.d.ts +19 -16
  11. package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
  12. package/lib/components/AppShell/AppShell.styles.js +227 -173
  13. package/lib/components/AppShell/AppShell.styles.js.map +1 -1
  14. package/lib/components/AppShell/AppShell.types.d.ts +7 -7
  15. package/lib/components/AppShell/AppShell.types.d.ts.map +1 -1
  16. package/lib/components/AppShell/AppShell.types.js.map +1 -1
  17. package/lib/components/AppShell/AppShellContext.d.ts +3 -0
  18. package/lib/components/AppShell/AppShellContext.d.ts.map +1 -1
  19. package/lib/components/AppShell/AppShellContext.js +9 -1
  20. package/lib/components/AppShell/AppShellContext.js.map +1 -1
  21. package/lib/components/AppShell/AppShellList.d.ts +4 -3
  22. package/lib/components/AppShell/AppShellList.d.ts.map +1 -1
  23. package/lib/components/AppShell/AppShellList.js +24 -19
  24. package/lib/components/AppShell/AppShellList.js.map +1 -1
  25. package/lib/components/AppShell/Drawer.d.ts.map +1 -1
  26. package/lib/components/AppShell/Drawer.js +7 -8
  27. package/lib/components/AppShell/Drawer.js.map +1 -1
  28. package/lib/components/AppShell/Operator.js +3 -5
  29. package/lib/components/AppShell/Operator.js.map +1 -1
  30. package/lib/components/AppShell/SkipNavigation.d.ts.map +1 -1
  31. package/lib/components/AppShell/SkipNavigation.js +30 -39
  32. package/lib/components/AppShell/SkipNavigation.js.map +1 -1
  33. package/lib/components/AppShell/index.d.ts +1 -0
  34. package/lib/components/AppShell/index.d.ts.map +1 -1
  35. package/lib/components/AppShell/index.js +1 -0
  36. package/lib/components/AppShell/index.js.map +1 -1
  37. package/lib/components/Avatar/Avatar.d.ts.map +1 -1
  38. package/lib/components/Avatar/Avatar.js +5 -4
  39. package/lib/components/Avatar/Avatar.js.map +1 -1
  40. package/lib/components/Backdrop/Backdrop.d.ts +1 -1
  41. package/lib/components/Backdrop/Backdrop.d.ts.map +1 -1
  42. package/lib/components/Backdrop/Backdrop.js +7 -6
  43. package/lib/components/Backdrop/Backdrop.js.map +1 -1
  44. package/lib/components/Backdrop/index.d.ts +1 -2
  45. package/lib/components/Backdrop/index.d.ts.map +1 -1
  46. package/lib/components/Backdrop/index.js +1 -2
  47. package/lib/components/Backdrop/index.js.map +1 -1
  48. package/lib/components/Badges/Alert.d.ts +2 -2
  49. package/lib/components/Badges/Alert.d.ts.map +1 -1
  50. package/lib/components/Badges/Alert.js +1 -1
  51. package/lib/components/Badges/Alert.js.map +1 -1
  52. package/lib/components/Badges/Count.js +1 -1
  53. package/lib/components/Badges/Count.js.map +1 -1
  54. package/lib/components/Badges/Selection.d.ts.map +1 -1
  55. package/lib/components/Badges/Selection.js +10 -9
  56. package/lib/components/Badges/Selection.js.map +1 -1
  57. package/lib/components/Badges/Status.d.ts +2 -2
  58. package/lib/components/Badges/Status.d.ts.map +1 -1
  59. package/lib/components/Badges/Status.js +1 -1
  60. package/lib/components/Badges/Status.js.map +1 -1
  61. package/lib/components/Badges/Tag.js +1 -1
  62. package/lib/components/Badges/Tag.js.map +1 -1
  63. package/lib/components/Banner/Banner.d.ts +2 -2
  64. package/lib/components/Banner/Banner.d.ts.map +1 -1
  65. package/lib/components/Banner/Banner.js +6 -8
  66. package/lib/components/Banner/Banner.js.map +1 -1
  67. package/lib/components/Boolean/BooleanDisplay.d.ts +2 -2
  68. package/lib/components/Boolean/BooleanDisplay.d.ts.map +1 -1
  69. package/lib/components/Boolean/BooleanDisplay.js +1 -2
  70. package/lib/components/Boolean/BooleanDisplay.js.map +1 -1
  71. package/lib/components/Breadcrumbs/Breadcrumbs.d.ts +2 -2
  72. package/lib/components/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
  73. package/lib/components/Breadcrumbs/Breadcrumbs.js +13 -11
  74. package/lib/components/Breadcrumbs/Breadcrumbs.js.map +1 -1
  75. package/lib/components/Button/BareButton.d.ts.map +1 -1
  76. package/lib/components/Button/BareButton.js +21 -2
  77. package/lib/components/Button/BareButton.js.map +1 -1
  78. package/lib/components/Button/BareRoleButton.d.ts +12 -0
  79. package/lib/components/Button/BareRoleButton.d.ts.map +1 -0
  80. package/lib/components/Button/BareRoleButton.js +20 -0
  81. package/lib/components/Button/BareRoleButton.js.map +1 -0
  82. package/lib/components/Button/Button.d.ts +5 -0
  83. package/lib/components/Button/Button.d.ts.map +1 -1
  84. package/lib/components/Button/Button.js +34 -10
  85. package/lib/components/Button/Button.js.map +1 -1
  86. package/lib/components/Card/Card.d.ts.map +1 -1
  87. package/lib/components/Card/Card.js +3 -2
  88. package/lib/components/Card/Card.js.map +1 -1
  89. package/lib/components/Card/CardContent.d.ts.map +1 -1
  90. package/lib/components/Card/CardContent.js +5 -4
  91. package/lib/components/Card/CardContent.js.map +1 -1
  92. package/lib/components/Card/CardFooter.d.ts.map +1 -1
  93. package/lib/components/Card/CardFooter.js +5 -4
  94. package/lib/components/Card/CardFooter.js.map +1 -1
  95. package/lib/components/Card/CardHeader.d.ts +3 -1
  96. package/lib/components/Card/CardHeader.d.ts.map +1 -1
  97. package/lib/components/Card/CardHeader.js +9 -7
  98. package/lib/components/Card/CardHeader.js.map +1 -1
  99. package/lib/components/Card/CardMedia.js +1 -1
  100. package/lib/components/Card/CardMedia.js.map +1 -1
  101. package/lib/components/Card/CollapsibleCard.d.ts.map +1 -1
  102. package/lib/components/Card/CollapsibleCard.js +5 -7
  103. package/lib/components/Card/CollapsibleCard.js.map +1 -1
  104. package/lib/components/Card/SelectableCard.js +1 -1
  105. package/lib/components/Card/SelectableCard.js.map +1 -1
  106. package/lib/components/Checkbox/Checkbox.d.ts +2 -2
  107. package/lib/components/Checkbox/Checkbox.d.ts.map +1 -1
  108. package/lib/components/Checkbox/Checkbox.js +1 -1
  109. package/lib/components/Checkbox/Checkbox.js.map +1 -1
  110. package/lib/components/ColorPicker/ColorPicker.d.ts +2 -2
  111. package/lib/components/ColorPicker/ColorPicker.d.ts.map +1 -1
  112. package/lib/components/ColorPicker/ColorPicker.js +8 -11
  113. package/lib/components/ColorPicker/ColorPicker.js.map +1 -1
  114. package/lib/components/ComboBox/ComboBox.d.ts +1 -1
  115. package/lib/components/ComboBox/ComboBox.d.ts.map +1 -1
  116. package/lib/components/ComboBox/ComboBox.js +43 -63
  117. package/lib/components/ComboBox/ComboBox.js.map +1 -1
  118. package/lib/components/ComboBox/ComboBox.types.d.ts +2 -1
  119. package/lib/components/ComboBox/ComboBox.types.d.ts.map +1 -1
  120. package/lib/components/ComboBox/ComboBox.types.js.map +1 -1
  121. package/lib/components/ComboBox/ComboBoxInput.js +4 -4
  122. package/lib/components/ComboBox/ComboBoxInput.js.map +1 -1
  123. package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.d.ts.map +1 -1
  124. package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js +23 -29
  125. package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js.map +1 -1
  126. package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.d.ts.map +1 -1
  127. package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.js +16 -12
  128. package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.js.map +1 -1
  129. package/lib/components/Configuration/Configuration.js +11 -13
  130. package/lib/components/Configuration/Configuration.js.map +1 -1
  131. package/lib/components/Currency/CurrencyDisplay.d.ts +6 -2
  132. package/lib/components/Currency/CurrencyDisplay.d.ts.map +1 -1
  133. package/lib/components/Currency/CurrencyDisplay.js +11 -7
  134. package/lib/components/Currency/CurrencyDisplay.js.map +1 -1
  135. package/lib/components/Currency/CurrencyInput.d.ts.map +1 -1
  136. package/lib/components/Currency/CurrencyInput.js +16 -16
  137. package/lib/components/Currency/CurrencyInput.js.map +1 -1
  138. package/lib/components/Currency/CurrencyInput.types.d.ts +6 -2
  139. package/lib/components/Currency/CurrencyInput.types.d.ts.map +1 -1
  140. package/lib/components/Currency/CurrencyInput.types.js.map +1 -1
  141. package/lib/components/Currency/utils.d.ts +12 -1
  142. package/lib/components/Currency/utils.d.ts.map +1 -1
  143. package/lib/components/Currency/utils.js +30 -2
  144. package/lib/components/Currency/utils.js.map +1 -1
  145. package/lib/components/DateTime/DateTime.types.d.ts +2 -1
  146. package/lib/components/DateTime/DateTime.types.d.ts.map +1 -1
  147. package/lib/components/DateTime/DateTime.types.js.map +1 -1
  148. package/lib/components/DateTime/DateTimeDisplay.d.ts +1 -1
  149. package/lib/components/DateTime/DateTimeDisplay.d.ts.map +1 -1
  150. package/lib/components/DateTime/DateTimeDisplay.js +10 -2
  151. package/lib/components/DateTime/DateTimeDisplay.js.map +1 -1
  152. package/lib/components/DateTime/DurationDisplay.d.ts.map +1 -1
  153. package/lib/components/DateTime/DurationDisplay.js +11 -6
  154. package/lib/components/DateTime/DurationDisplay.js.map +1 -1
  155. package/lib/components/DateTime/Input/DateInput.d.ts.map +1 -1
  156. package/lib/components/DateTime/Input/DateInput.js +26 -28
  157. package/lib/components/DateTime/Input/DateInput.js.map +1 -1
  158. package/lib/components/DateTime/Input/DateRangeInput.d.ts.map +1 -1
  159. package/lib/components/DateTime/Input/DateRangeInput.js +10 -16
  160. package/lib/components/DateTime/Input/DateRangeInput.js.map +1 -1
  161. package/lib/components/DateTime/Input/DateTime.styles.d.ts.map +1 -1
  162. package/lib/components/DateTime/Input/DateTime.styles.js +14 -3
  163. package/lib/components/DateTime/Input/DateTime.styles.js.map +1 -1
  164. package/lib/components/DateTime/Input/DateTimeInput.d.ts.map +1 -1
  165. package/lib/components/DateTime/Input/DateTimeInput.js +37 -44
  166. package/lib/components/DateTime/Input/DateTimeInput.js.map +1 -1
  167. package/lib/components/DateTime/Input/DayOfWeekInput.d.ts +2 -0
  168. package/lib/components/DateTime/Input/DayOfWeekInput.d.ts.map +1 -1
  169. package/lib/components/DateTime/Input/DayOfWeekInput.js +7 -5
  170. package/lib/components/DateTime/Input/DayOfWeekInput.js.map +1 -1
  171. package/lib/components/DateTime/Input/Duration/DurationInput.d.ts.map +1 -1
  172. package/lib/components/DateTime/Input/Duration/DurationInput.js +3 -3
  173. package/lib/components/DateTime/Input/Duration/DurationInput.js.map +1 -1
  174. package/lib/components/DateTime/Input/Duration/NumberUnit.js +4 -5
  175. package/lib/components/DateTime/Input/Duration/NumberUnit.js.map +1 -1
  176. package/lib/components/DateTime/Input/Duration/Time.d.ts.map +1 -1
  177. package/lib/components/DateTime/Input/Duration/Time.js +12 -15
  178. package/lib/components/DateTime/Input/Duration/Time.js.map +1 -1
  179. package/lib/components/DateTime/Input/MonthInput.js +12 -16
  180. package/lib/components/DateTime/Input/MonthInput.js.map +1 -1
  181. package/lib/components/DateTime/Input/PartInput.js +3 -4
  182. package/lib/components/DateTime/Input/PartInput.js.map +1 -1
  183. package/lib/components/DateTime/Input/QuarterInput.d.ts +9 -0
  184. package/lib/components/DateTime/Input/QuarterInput.d.ts.map +1 -0
  185. package/lib/components/DateTime/Input/QuarterInput.js +102 -0
  186. package/lib/components/DateTime/Input/QuarterInput.js.map +1 -0
  187. package/lib/components/DateTime/Input/TimeInput.d.ts.map +1 -1
  188. package/lib/components/DateTime/Input/TimeInput.js +29 -39
  189. package/lib/components/DateTime/Input/TimeInput.js.map +1 -1
  190. package/lib/components/DateTime/Input/WeekInput.d.ts.map +1 -1
  191. package/lib/components/DateTime/Input/WeekInput.js +23 -24
  192. package/lib/components/DateTime/Input/WeekInput.js.map +1 -1
  193. package/lib/components/DateTime/Input/useAutoFocusNextInput.d.ts.map +1 -1
  194. package/lib/components/DateTime/Input/useAutoFocusNextInput.js +8 -9
  195. package/lib/components/DateTime/Input/useAutoFocusNextInput.js.map +1 -1
  196. package/lib/components/DateTime/Input/usePickerButton.js +4 -4
  197. package/lib/components/DateTime/Input/usePickerButton.js.map +1 -1
  198. package/lib/components/DateTime/Input/utils.d.ts +7 -0
  199. package/lib/components/DateTime/Input/utils.d.ts.map +1 -1
  200. package/lib/components/DateTime/Input/utils.js +52 -10
  201. package/lib/components/DateTime/Input/utils.js.map +1 -1
  202. package/lib/components/DateTime/Picker/Calendar.d.ts.map +1 -1
  203. package/lib/components/DateTime/Picker/Calendar.js +32 -34
  204. package/lib/components/DateTime/Picker/Calendar.js.map +1 -1
  205. package/lib/components/DateTime/Picker/Calendar.styles.d.ts +2 -2
  206. package/lib/components/DateTime/Picker/Calendar.styles.d.ts.map +1 -1
  207. package/lib/components/DateTime/Picker/Calendar.styles.js +16 -7
  208. package/lib/components/DateTime/Picker/Calendar.styles.js.map +1 -1
  209. package/lib/components/DateTime/Picker/DatePicker.d.ts.map +1 -1
  210. package/lib/components/DateTime/Picker/DatePicker.js +13 -17
  211. package/lib/components/DateTime/Picker/DatePicker.js.map +1 -1
  212. package/lib/components/DateTime/Picker/DateRangePicker.d.ts.map +1 -1
  213. package/lib/components/DateTime/Picker/DateRangePicker.js +13 -17
  214. package/lib/components/DateTime/Picker/DateRangePicker.js.map +1 -1
  215. package/lib/components/DateTime/Picker/TimePicker.js +9 -10
  216. package/lib/components/DateTime/Picker/TimePicker.js.map +1 -1
  217. package/lib/components/DateTime/Picker/Weeks.js +9 -11
  218. package/lib/components/DateTime/Picker/Weeks.js.map +1 -1
  219. package/lib/components/DateTime/Picker/utils.d.ts +1 -0
  220. package/lib/components/DateTime/Picker/utils.d.ts.map +1 -1
  221. package/lib/components/DateTime/Picker/utils.js +3 -0
  222. package/lib/components/DateTime/Picker/utils.js.map +1 -1
  223. package/lib/components/DateTime/index.d.ts +3 -0
  224. package/lib/components/DateTime/index.d.ts.map +1 -1
  225. package/lib/components/DateTime/index.js +2 -0
  226. package/lib/components/DateTime/index.js.map +1 -1
  227. package/lib/components/Drawer/Drawer.d.ts.map +1 -1
  228. package/lib/components/Drawer/Drawer.js +10 -7
  229. package/lib/components/Drawer/Drawer.js.map +1 -1
  230. package/lib/components/Email/EmailDisplay.d.ts +2 -2
  231. package/lib/components/Email/EmailDisplay.d.ts.map +1 -1
  232. package/lib/components/Email/EmailDisplay.js +2 -2
  233. package/lib/components/Email/EmailDisplay.js.map +1 -1
  234. package/lib/components/EmojiPicker/EmojiDisplay.d.ts.map +1 -1
  235. package/lib/components/EmojiPicker/EmojiDisplay.js +1 -1
  236. package/lib/components/EmojiPicker/EmojiDisplay.js.map +1 -1
  237. package/lib/components/EmojiPicker/EmojiPicker.js +3 -4
  238. package/lib/components/EmojiPicker/EmojiPicker.js.map +1 -1
  239. package/lib/components/EmptyState/EmptyState.d.ts +14 -0
  240. package/lib/components/EmptyState/EmptyState.d.ts.map +1 -0
  241. package/lib/components/{NoItems/NoItems.js → EmptyState/EmptyState.js} +11 -8
  242. package/lib/components/EmptyState/EmptyState.js.map +1 -0
  243. package/lib/components/EmptyState/index.d.ts +4 -0
  244. package/lib/components/EmptyState/index.d.ts.map +1 -0
  245. package/lib/components/EmptyState/index.js +3 -0
  246. package/lib/components/EmptyState/index.js.map +1 -0
  247. package/lib/components/ErrorState/ErrorState.d.ts +16 -0
  248. package/lib/components/ErrorState/ErrorState.d.ts.map +1 -0
  249. package/lib/components/ErrorState/ErrorState.js +31 -0
  250. package/lib/components/ErrorState/ErrorState.js.map +1 -0
  251. package/lib/components/ErrorState/index.d.ts +4 -0
  252. package/lib/components/ErrorState/index.d.ts.map +1 -0
  253. package/lib/components/ErrorState/index.js +3 -0
  254. package/lib/components/ErrorState/index.js.map +1 -0
  255. package/lib/components/ExpandCollapse/ExpandCollapse.js +6 -6
  256. package/lib/components/ExpandCollapse/ExpandCollapse.js.map +1 -1
  257. package/lib/components/FieldGroup/FieldGroup.d.ts.map +1 -1
  258. package/lib/components/FieldGroup/FieldGroup.js +6 -7
  259. package/lib/components/FieldGroup/FieldGroup.js.map +1 -1
  260. package/lib/components/FieldGroup/FieldGroupList.d.ts +1 -1
  261. package/lib/components/FieldGroup/FieldGroupList.d.ts.map +1 -1
  262. package/lib/components/FieldGroup/FieldGroupList.js +8 -7
  263. package/lib/components/FieldGroup/FieldGroupList.js.map +1 -1
  264. package/lib/components/FieldGroup/index.d.ts +1 -0
  265. package/lib/components/FieldGroup/index.d.ts.map +1 -1
  266. package/lib/components/FieldGroup/index.js +1 -0
  267. package/lib/components/FieldGroup/index.js.map +1 -1
  268. package/lib/components/FieldValueList/FieldValueList.d.ts +2 -2
  269. package/lib/components/FieldValueList/FieldValueList.d.ts.map +1 -1
  270. package/lib/components/FieldValueList/FieldValueList.js +5 -7
  271. package/lib/components/FieldValueList/FieldValueList.js.map +1 -1
  272. package/lib/components/File/FileDisplay.d.ts +6 -3
  273. package/lib/components/File/FileDisplay.d.ts.map +1 -1
  274. package/lib/components/File/FileDisplay.js +7 -7
  275. package/lib/components/File/FileDisplay.js.map +1 -1
  276. package/lib/components/File/FileInput.d.ts +3 -3
  277. package/lib/components/File/FileInput.d.ts.map +1 -1
  278. package/lib/components/File/FileInput.js +18 -19
  279. package/lib/components/File/FileInput.js.map +1 -1
  280. package/lib/components/File/FileItem.d.ts +0 -2
  281. package/lib/components/File/FileItem.d.ts.map +1 -1
  282. package/lib/components/File/FileItem.js +3 -4
  283. package/lib/components/File/FileItem.js.map +1 -1
  284. package/lib/components/File/FileUploadItem.d.ts +4 -2
  285. package/lib/components/File/FileUploadItem.d.ts.map +1 -1
  286. package/lib/components/File/FileUploadItem.js +58 -20
  287. package/lib/components/File/FileUploadItem.js.map +1 -1
  288. package/lib/components/File/FileVisual.d.ts +7 -16
  289. package/lib/components/File/FileVisual.d.ts.map +1 -1
  290. package/lib/components/File/FileVisual.js +44 -47
  291. package/lib/components/File/FileVisual.js.map +1 -1
  292. package/lib/components/File/index.d.ts +1 -0
  293. package/lib/components/File/index.d.ts.map +1 -1
  294. package/lib/components/File/index.js +1 -0
  295. package/lib/components/File/index.js.map +1 -1
  296. package/lib/components/File/utils.js +2 -3
  297. package/lib/components/File/utils.js.map +1 -1
  298. package/lib/components/Flex/Flex.d.ts +17 -7
  299. package/lib/components/Flex/Flex.d.ts.map +1 -1
  300. package/lib/components/Flex/Flex.js +25 -9
  301. package/lib/components/Flex/Flex.js.map +1 -1
  302. package/lib/components/Form/Form.d.ts +7 -1
  303. package/lib/components/Form/Form.d.ts.map +1 -1
  304. package/lib/components/Form/Form.js +5 -4
  305. package/lib/components/Form/Form.js.map +1 -1
  306. package/lib/components/FormControl/FormControl.d.ts +1 -1
  307. package/lib/components/FormControl/FormControl.d.ts.map +1 -1
  308. package/lib/components/FormControl/FormControl.js +1 -1
  309. package/lib/components/FormControl/FormControl.js.map +1 -1
  310. package/lib/components/FormField/FormField.d.ts +5 -7
  311. package/lib/components/FormField/FormField.d.ts.map +1 -1
  312. package/lib/components/FormField/FormField.js +9 -19
  313. package/lib/components/FormField/FormField.js.map +1 -1
  314. package/lib/components/Grid/Grid.d.ts +1 -1
  315. package/lib/components/Grid/Grid.d.ts.map +1 -1
  316. package/lib/components/Grid/Grid.js +17 -21
  317. package/lib/components/Grid/Grid.js.map +1 -1
  318. package/lib/components/Icon/Icon.js +3 -5
  319. package/lib/components/Icon/Icon.js.map +1 -1
  320. package/lib/components/Icon/iconNames.d.ts +1 -1
  321. package/lib/components/Icon/iconNames.d.ts.map +1 -1
  322. package/lib/components/Icon/iconNames.js +2 -0
  323. package/lib/components/Icon/iconNames.js.map +1 -1
  324. package/lib/components/Icon/icons/compass-solid.icon.js +1 -2
  325. package/lib/components/Icon/icons/compass-solid.icon.js.map +1 -1
  326. package/lib/components/Icon/icons/dataviz-table-with-bars.icon.js +1 -4
  327. package/lib/components/Icon/icons/dataviz-table-with-bars.icon.js.map +1 -1
  328. package/lib/components/Icon/icons/dataviz-table-with-cross.icon.js +1 -2
  329. package/lib/components/Icon/icons/dataviz-table-with-cross.icon.js.map +1 -1
  330. package/lib/components/Icon/icons/dataviz-waterfall.icon.js +1 -5
  331. package/lib/components/Icon/icons/dataviz-waterfall.icon.js.map +1 -1
  332. package/lib/components/Icon/icons/dock.icon.d.ts +4 -0
  333. package/lib/components/Icon/icons/dock.icon.d.ts.map +1 -0
  334. package/lib/components/Icon/icons/dock.icon.js +6 -0
  335. package/lib/components/Icon/icons/dock.icon.js.map +1 -0
  336. package/lib/components/Icon/icons/filetype-text.icon.js +1 -4
  337. package/lib/components/Icon/icons/filetype-text.icon.js.map +1 -1
  338. package/lib/components/Icon/icons/folder-dollar.icon.js +1 -2
  339. package/lib/components/Icon/icons/folder-dollar.icon.js.map +1 -1
  340. package/lib/components/Icon/icons/freeze-column.icon.js +1 -2
  341. package/lib/components/Icon/icons/freeze-column.icon.js.map +1 -1
  342. package/lib/components/Icon/icons/galaxy.icon.js +1 -3
  343. package/lib/components/Icon/icons/galaxy.icon.js.map +1 -1
  344. package/lib/components/Icon/icons/grad-solid.icon.js +1 -2
  345. package/lib/components/Icon/icons/grad-solid.icon.js.map +1 -1
  346. package/lib/components/Icon/icons/grad.icon.js +1 -5
  347. package/lib/components/Icon/icons/grad.icon.js.map +1 -1
  348. package/lib/components/Icon/icons/list-number.icon.js +1 -6
  349. package/lib/components/Icon/icons/list-number.icon.js.map +1 -1
  350. package/lib/components/Icon/icons/list.icon.js +1 -6
  351. package/lib/components/Icon/icons/list.icon.js.map +1 -1
  352. package/lib/components/Icon/icons/pin.icon.js +1 -2
  353. package/lib/components/Icon/icons/pin.icon.js.map +1 -1
  354. package/lib/components/Icon/icons/search-solid.icon.js +1 -2
  355. package/lib/components/Icon/icons/search-solid.icon.js.map +1 -1
  356. package/lib/components/Icon/icons/tracer.icon.js +1 -2
  357. package/lib/components/Icon/icons/tracer.icon.js.map +1 -1
  358. package/lib/components/Icon/icons/tribox-solid.icon.js +1 -3
  359. package/lib/components/Icon/icons/tribox-solid.icon.js.map +1 -1
  360. package/lib/components/Icon/icons/tribox.icon.js +1 -3
  361. package/lib/components/Icon/icons/tribox.icon.js.map +1 -1
  362. package/lib/components/Icon/icons/undock.icon.d.ts +4 -0
  363. package/lib/components/Icon/icons/undock.icon.d.ts.map +1 -0
  364. package/lib/components/Icon/icons/undock.icon.js +6 -0
  365. package/lib/components/Icon/icons/undock.icon.js.map +1 -0
  366. package/lib/components/Icon/index.d.ts +1 -0
  367. package/lib/components/Icon/index.d.ts.map +1 -1
  368. package/lib/components/Icon/index.js +1 -0
  369. package/lib/components/Icon/index.js.map +1 -1
  370. package/lib/components/Image/Image.js +1 -1
  371. package/lib/components/Image/Image.js.map +1 -1
  372. package/lib/components/Image/index.d.ts +1 -1
  373. package/lib/components/Image/index.d.ts.map +1 -1
  374. package/lib/components/Image/index.js +1 -0
  375. package/lib/components/Image/index.js.map +1 -1
  376. package/lib/components/Input/Input.d.ts +2 -2
  377. package/lib/components/Input/Input.d.ts.map +1 -1
  378. package/lib/components/Input/Input.js +13 -13
  379. package/lib/components/Input/Input.js.map +1 -1
  380. package/lib/components/Input/Input.styles.js +2 -2
  381. package/lib/components/Input/Input.styles.js.map +1 -1
  382. package/lib/components/Input/index.d.ts +1 -1
  383. package/lib/components/Input/index.d.ts.map +1 -1
  384. package/lib/components/Input/index.js.map +1 -1
  385. package/lib/components/Label/Label.d.ts +2 -2
  386. package/lib/components/Label/Label.d.ts.map +1 -1
  387. package/lib/components/Label/Label.js +1 -1
  388. package/lib/components/Label/Label.js.map +1 -1
  389. package/lib/components/Lightbox/Lightbox.d.ts +6 -0
  390. package/lib/components/Lightbox/Lightbox.d.ts.map +1 -0
  391. package/lib/components/Lightbox/Lightbox.js +129 -0
  392. package/lib/components/Lightbox/Lightbox.js.map +1 -0
  393. package/lib/components/Lightbox/Lightbox.styles.d.ts +11 -0
  394. package/lib/components/Lightbox/Lightbox.styles.d.ts.map +1 -0
  395. package/lib/components/Lightbox/Lightbox.styles.js +166 -0
  396. package/lib/components/Lightbox/Lightbox.styles.js.map +1 -0
  397. package/lib/components/Lightbox/Lightbox.types.d.ts +42 -0
  398. package/lib/components/Lightbox/Lightbox.types.d.ts.map +1 -0
  399. package/lib/components/Lightbox/Lightbox.types.js +2 -0
  400. package/lib/components/Lightbox/Lightbox.types.js.map +1 -0
  401. package/lib/components/Lightbox/index.d.ts +3 -0
  402. package/lib/components/Lightbox/index.d.ts.map +1 -0
  403. package/lib/components/Lightbox/index.js +2 -0
  404. package/lib/components/Lightbox/index.js.map +1 -0
  405. package/lib/components/Link/Link.d.ts.map +1 -1
  406. package/lib/components/Link/Link.js +19 -19
  407. package/lib/components/Link/Link.js.map +1 -1
  408. package/lib/components/List/CommaSeparatedList.d.ts +15 -0
  409. package/lib/components/List/CommaSeparatedList.d.ts.map +1 -0
  410. package/lib/components/List/CommaSeparatedList.js +61 -0
  411. package/lib/components/List/CommaSeparatedList.js.map +1 -0
  412. package/lib/components/List/List.d.ts +30 -0
  413. package/lib/components/List/List.d.ts.map +1 -0
  414. package/lib/components/List/List.js +56 -0
  415. package/lib/components/List/List.js.map +1 -0
  416. package/lib/components/List/OrderedList.d.ts +6 -0
  417. package/lib/components/List/OrderedList.d.ts.map +1 -0
  418. package/lib/components/List/OrderedList.js +6 -0
  419. package/lib/components/List/OrderedList.js.map +1 -0
  420. package/lib/components/List/UnorderedList.d.ts +6 -0
  421. package/lib/components/List/UnorderedList.d.ts.map +1 -0
  422. package/lib/components/List/UnorderedList.js +6 -0
  423. package/lib/components/List/UnorderedList.js.map +1 -0
  424. package/lib/components/List/index.d.ts +5 -0
  425. package/lib/components/List/index.d.ts.map +1 -0
  426. package/lib/components/List/index.js +4 -0
  427. package/lib/components/List/index.js.map +1 -0
  428. package/lib/components/Location/CurrentLocationButton.d.ts.map +1 -1
  429. package/lib/components/Location/CurrentLocationButton.js +7 -7
  430. package/lib/components/Location/CurrentLocationButton.js.map +1 -1
  431. package/lib/components/Location/Location.types.d.ts +2 -1
  432. package/lib/components/Location/Location.types.d.ts.map +1 -1
  433. package/lib/components/Location/Location.types.js.map +1 -1
  434. package/lib/components/Location/LocationDisplay.js +8 -9
  435. package/lib/components/Location/LocationDisplay.js.map +1 -1
  436. package/lib/components/Location/LocationInput.js +27 -28
  437. package/lib/components/Location/LocationInput.js.map +1 -1
  438. package/lib/components/Location/LocationView.js +8 -13
  439. package/lib/components/Location/LocationView.js.map +1 -1
  440. package/lib/components/Location/index.d.ts +4 -4
  441. package/lib/components/Location/index.d.ts.map +1 -1
  442. package/lib/components/Location/index.js.map +1 -1
  443. package/lib/components/Location/utils.js +11 -15
  444. package/lib/components/Location/utils.js.map +1 -1
  445. package/lib/components/Menu/FlyoutMenuList.d.ts.map +1 -1
  446. package/lib/components/Menu/FlyoutMenuList.js +12 -15
  447. package/lib/components/Menu/FlyoutMenuList.js.map +1 -1
  448. package/lib/components/Menu/Menu.context.d.ts.map +1 -1
  449. package/lib/components/Menu/Menu.context.js +2 -0
  450. package/lib/components/Menu/Menu.context.js.map +1 -1
  451. package/lib/components/Menu/Menu.d.ts.map +1 -1
  452. package/lib/components/Menu/Menu.js +92 -48
  453. package/lib/components/Menu/Menu.js.map +1 -1
  454. package/lib/components/Menu/Menu.styles.d.ts +11 -1
  455. package/lib/components/Menu/Menu.styles.d.ts.map +1 -1
  456. package/lib/components/Menu/Menu.styles.js +208 -7
  457. package/lib/components/Menu/Menu.styles.js.map +1 -1
  458. package/lib/components/Menu/Menu.types.d.ts +30 -12
  459. package/lib/components/Menu/Menu.types.d.ts.map +1 -1
  460. package/lib/components/Menu/Menu.types.js.map +1 -1
  461. package/lib/components/Menu/MenuGroup.d.ts +6 -0
  462. package/lib/components/Menu/MenuGroup.d.ts.map +1 -0
  463. package/lib/components/Menu/MenuGroup.js +17 -0
  464. package/lib/components/Menu/MenuGroup.js.map +1 -0
  465. package/lib/components/Menu/MenuItem.d.ts +0 -3
  466. package/lib/components/Menu/MenuItem.d.ts.map +1 -1
  467. package/lib/components/Menu/MenuItem.js +57 -164
  468. package/lib/components/Menu/MenuItem.js.map +1 -1
  469. package/lib/components/Menu/MenuList.d.ts +1 -1
  470. package/lib/components/Menu/MenuList.d.ts.map +1 -1
  471. package/lib/components/Menu/MenuList.js +28 -30
  472. package/lib/components/Menu/MenuList.js.map +1 -1
  473. package/lib/components/Menu/MenuListHeader.d.ts +0 -1
  474. package/lib/components/Menu/MenuListHeader.d.ts.map +1 -1
  475. package/lib/components/Menu/MenuListHeader.js +7 -55
  476. package/lib/components/Menu/MenuListHeader.js.map +1 -1
  477. package/lib/components/Menu/NavItemsList.d.ts.map +1 -1
  478. package/lib/components/Menu/NavItemsList.js +2 -3
  479. package/lib/components/Menu/NavItemsList.js.map +1 -1
  480. package/lib/components/Menu/helpers.d.ts +13 -12
  481. package/lib/components/Menu/helpers.d.ts.map +1 -1
  482. package/lib/components/Menu/helpers.js +40 -36
  483. package/lib/components/Menu/helpers.js.map +1 -1
  484. package/lib/components/Menu/index.d.ts +2 -3
  485. package/lib/components/Menu/index.d.ts.map +1 -1
  486. package/lib/components/Menu/index.js +1 -2
  487. package/lib/components/Menu/index.js.map +1 -1
  488. package/lib/components/MenuButton/MenuButton.d.ts +3 -1
  489. package/lib/components/MenuButton/MenuButton.d.ts.map +1 -1
  490. package/lib/components/MenuButton/MenuButton.js +13 -14
  491. package/lib/components/MenuButton/MenuButton.js.map +1 -1
  492. package/lib/components/MetaList/MetaList.d.ts +13 -4
  493. package/lib/components/MetaList/MetaList.d.ts.map +1 -1
  494. package/lib/components/MetaList/MetaList.js +34 -20
  495. package/lib/components/MetaList/MetaList.js.map +1 -1
  496. package/lib/components/Modal/Contexts.d.ts.map +1 -1
  497. package/lib/components/Modal/Contexts.js +6 -2
  498. package/lib/components/Modal/Contexts.js.map +1 -1
  499. package/lib/components/Modal/DockedModals.d.ts.map +1 -1
  500. package/lib/components/Modal/DockedModals.js +5 -4
  501. package/lib/components/Modal/DockedModals.js.map +1 -1
  502. package/lib/components/Modal/MinimizedModal.d.ts.map +1 -1
  503. package/lib/components/Modal/MinimizedModal.js +53 -38
  504. package/lib/components/Modal/MinimizedModal.js.map +1 -1
  505. package/lib/components/Modal/Modal.d.ts +1 -6
  506. package/lib/components/Modal/Modal.d.ts.map +1 -1
  507. package/lib/components/Modal/Modal.js +89 -136
  508. package/lib/components/Modal/Modal.js.map +1 -1
  509. package/lib/components/Modal/Modal.styles.d.ts +9 -0
  510. package/lib/components/Modal/Modal.styles.d.ts.map +1 -0
  511. package/lib/components/Modal/Modal.styles.js +134 -0
  512. package/lib/components/Modal/Modal.styles.js.map +1 -0
  513. package/lib/components/Modal/Modal.types.d.ts +60 -7
  514. package/lib/components/Modal/Modal.types.d.ts.map +1 -1
  515. package/lib/components/Modal/Modal.types.js +2 -1
  516. package/lib/components/Modal/Modal.types.js.map +1 -1
  517. package/lib/components/Modal/ModalManager.d.ts.map +1 -1
  518. package/lib/components/Modal/ModalManager.js +78 -68
  519. package/lib/components/Modal/ModalManager.js.map +1 -1
  520. package/lib/components/MultiStep/MultiStep.d.ts.map +1 -1
  521. package/lib/components/MultiStep/MultiStep.js +10 -12
  522. package/lib/components/MultiStep/MultiStep.js.map +1 -1
  523. package/lib/components/MultiStep/MultiStep.styles.d.ts.map +1 -1
  524. package/lib/components/MultiStep/MultiStep.styles.js +5 -2
  525. package/lib/components/MultiStep/MultiStep.styles.js.map +1 -1
  526. package/lib/components/MultiStep/MultiStep.types.d.ts +4 -2
  527. package/lib/components/MultiStep/MultiStep.types.d.ts.map +1 -1
  528. package/lib/components/MultiStep/MultiStep.types.js.map +1 -1
  529. package/lib/components/MultiStep/index.d.ts +1 -1
  530. package/lib/components/MultiStep/index.d.ts.map +1 -1
  531. package/lib/components/MultiStep/index.js.map +1 -1
  532. package/lib/components/Number/NumberDisplay.d.ts +2 -2
  533. package/lib/components/Number/NumberDisplay.d.ts.map +1 -1
  534. package/lib/components/Number/NumberDisplay.js +1 -1
  535. package/lib/components/Number/NumberDisplay.js.map +1 -1
  536. package/lib/components/Number/NumberInput.d.ts.map +1 -1
  537. package/lib/components/Number/NumberInput.js +18 -25
  538. package/lib/components/Number/NumberInput.js.map +1 -1
  539. package/lib/components/Number/NumberInput.styles.d.ts +2 -2
  540. package/lib/components/Number/NumberInput.styles.d.ts.map +1 -1
  541. package/lib/components/Number/NumberInput.types.d.ts +2 -2
  542. package/lib/components/Number/NumberInput.types.d.ts.map +1 -1
  543. package/lib/components/Number/NumberInput.types.js.map +1 -1
  544. package/lib/components/Number/utils.js +2 -3
  545. package/lib/components/Number/utils.js.map +1 -1
  546. package/lib/components/PageTemplates/CategorySubPage.d.ts +1 -1
  547. package/lib/components/PageTemplates/CategorySubPage.d.ts.map +1 -1
  548. package/lib/components/PageTemplates/CategorySubPage.js +8 -18
  549. package/lib/components/PageTemplates/CategorySubPage.js.map +1 -1
  550. package/lib/components/PageTemplates/CategorySubPage.styles.d.ts +1 -1
  551. package/lib/components/PageTemplates/CategorySubPage.styles.d.ts.map +1 -1
  552. package/lib/components/PageTemplates/DashboardPage.d.ts +7 -1
  553. package/lib/components/PageTemplates/DashboardPage.d.ts.map +1 -1
  554. package/lib/components/PageTemplates/DashboardPage.js +48 -28
  555. package/lib/components/PageTemplates/DashboardPage.js.map +1 -1
  556. package/lib/components/PageTemplates/PageTemplates.d.ts +15 -6
  557. package/lib/components/PageTemplates/PageTemplates.d.ts.map +1 -1
  558. package/lib/components/PageTemplates/PageTemplates.js +89 -79
  559. package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
  560. package/lib/components/PageTemplates/index.d.ts +5 -3
  561. package/lib/components/PageTemplates/index.d.ts.map +1 -1
  562. package/lib/components/PageTemplates/index.js +2 -1
  563. package/lib/components/PageTemplates/index.js.map +1 -1
  564. package/lib/components/Pagination/Pagination.d.ts +2 -2
  565. package/lib/components/Pagination/Pagination.d.ts.map +1 -1
  566. package/lib/components/Pagination/Pagination.js +7 -6
  567. package/lib/components/Pagination/Pagination.js.map +1 -1
  568. package/lib/components/Paragraph/ParagraphDisplay.d.ts +11 -0
  569. package/lib/components/Paragraph/ParagraphDisplay.d.ts.map +1 -0
  570. package/lib/components/Paragraph/ParagraphDisplay.js +11 -0
  571. package/lib/components/Paragraph/ParagraphDisplay.js.map +1 -0
  572. package/lib/components/Paragraph/index.d.ts +3 -0
  573. package/lib/components/Paragraph/index.d.ts.map +1 -0
  574. package/lib/components/Paragraph/index.js +2 -0
  575. package/lib/components/Paragraph/index.js.map +1 -0
  576. package/lib/components/Phone/PhoneDisplay.d.ts +2 -2
  577. package/lib/components/Phone/PhoneDisplay.d.ts.map +1 -1
  578. package/lib/components/Phone/PhoneDisplay.js +2 -3
  579. package/lib/components/Phone/PhoneDisplay.js.map +1 -1
  580. package/lib/components/Phone/PhoneInput.d.ts +2 -2
  581. package/lib/components/Phone/PhoneInput.d.ts.map +1 -1
  582. package/lib/components/Phone/PhoneInput.js +18 -17
  583. package/lib/components/Phone/PhoneInput.js.map +1 -1
  584. package/lib/components/Phone/utils.js +2 -3
  585. package/lib/components/Phone/utils.js.map +1 -1
  586. package/lib/components/Popover/Popover.d.ts +0 -4
  587. package/lib/components/Popover/Popover.d.ts.map +1 -1
  588. package/lib/components/Popover/Popover.js +17 -122
  589. package/lib/components/Popover/Popover.js.map +1 -1
  590. package/lib/components/Popover/Popover.styles.d.ts +5 -0
  591. package/lib/components/Popover/Popover.styles.d.ts.map +1 -0
  592. package/lib/components/Popover/Popover.styles.js +131 -0
  593. package/lib/components/Popover/Popover.styles.js.map +1 -0
  594. package/lib/components/Popover/PopoverManager.js +2 -2
  595. package/lib/components/Popover/PopoverManager.js.map +1 -1
  596. package/lib/components/Popover/index.d.ts +1 -1
  597. package/lib/components/Popover/index.d.ts.map +1 -1
  598. package/lib/components/Popover/index.js +1 -1
  599. package/lib/components/Popover/index.js.map +1 -1
  600. package/lib/components/Popover/modifiers.d.ts +3 -0
  601. package/lib/components/Popover/modifiers.d.ts.map +1 -0
  602. package/lib/components/Popover/modifiers.js +11 -0
  603. package/lib/components/Popover/modifiers.js.map +1 -0
  604. package/lib/components/Progress/Bar.js +2 -2
  605. package/lib/components/Progress/Bar.js.map +1 -1
  606. package/lib/components/Progress/Ellipsis.d.ts +1 -1
  607. package/lib/components/Progress/Ellipsis.d.ts.map +1 -1
  608. package/lib/components/Progress/Ellipsis.js +48 -50
  609. package/lib/components/Progress/Ellipsis.js.map +1 -1
  610. package/lib/components/Progress/Progress.js +3 -4
  611. package/lib/components/Progress/Progress.js.map +1 -1
  612. package/lib/components/Progress/Progress.types.d.ts +2 -2
  613. package/lib/components/Progress/Progress.types.d.ts.map +1 -1
  614. package/lib/components/Progress/Progress.types.js.map +1 -1
  615. package/lib/components/Progress/Ring.d.ts +1 -1
  616. package/lib/components/Progress/Ring.d.ts.map +1 -1
  617. package/lib/components/Progress/Ring.js +40 -40
  618. package/lib/components/Progress/Ring.js.map +1 -1
  619. package/lib/components/RadioButton/RadioButton.d.ts +2 -2
  620. package/lib/components/RadioButton/RadioButton.d.ts.map +1 -1
  621. package/lib/components/RadioButton/RadioButton.js +1 -1
  622. package/lib/components/RadioButton/RadioButton.js.map +1 -1
  623. package/lib/components/RadioCheck/RadioCheck.d.ts +2 -2
  624. package/lib/components/RadioCheck/RadioCheck.d.ts.map +1 -1
  625. package/lib/components/RadioCheck/RadioCheck.js +7 -8
  626. package/lib/components/RadioCheck/RadioCheck.js.map +1 -1
  627. package/lib/components/RadioCheckGroup/RadioCheckGroup.d.ts +4 -0
  628. package/lib/components/RadioCheckGroup/RadioCheckGroup.d.ts.map +1 -1
  629. package/lib/components/RadioCheckGroup/RadioCheckGroup.js +19 -18
  630. package/lib/components/RadioCheckGroup/RadioCheckGroup.js.map +1 -1
  631. package/lib/components/Rating/Rating.d.ts +2 -2
  632. package/lib/components/Rating/Rating.d.ts.map +1 -1
  633. package/lib/components/Rating/Rating.js +6 -7
  634. package/lib/components/Rating/Rating.js.map +1 -1
  635. package/lib/components/SearchInput/SearchInput.d.ts +5 -5
  636. package/lib/components/SearchInput/SearchInput.d.ts.map +1 -1
  637. package/lib/components/SearchInput/SearchInput.js +14 -14
  638. package/lib/components/SearchInput/SearchInput.js.map +1 -1
  639. package/lib/components/Select/Option.js +1 -1
  640. package/lib/components/Select/Option.js.map +1 -1
  641. package/lib/components/Select/Select.d.ts.map +1 -1
  642. package/lib/components/Select/Select.js +15 -16
  643. package/lib/components/Select/Select.js.map +1 -1
  644. package/lib/components/Select/index.d.ts +2 -3
  645. package/lib/components/Select/index.d.ts.map +1 -1
  646. package/lib/components/Select/index.js.map +1 -1
  647. package/lib/components/Sentiment/Sentiment.d.ts +2 -2
  648. package/lib/components/Sentiment/Sentiment.d.ts.map +1 -1
  649. package/lib/components/Sentiment/Sentiment.js +1 -2
  650. package/lib/components/Sentiment/Sentiment.js.map +1 -1
  651. package/lib/components/Skeleton/LineSkeleton.js +1 -1
  652. package/lib/components/Skeleton/LineSkeleton.js.map +1 -1
  653. package/lib/components/Skeleton/ParagraphSkeleton.js +1 -1
  654. package/lib/components/Skeleton/ParagraphSkeleton.js.map +1 -1
  655. package/lib/components/Skeleton/RectangleSkeleton.js +1 -1
  656. package/lib/components/Skeleton/RectangleSkeleton.js.map +1 -1
  657. package/lib/components/Slider/Slider.d.ts.map +1 -1
  658. package/lib/components/Slider/Slider.js +12 -19
  659. package/lib/components/Slider/Slider.js.map +1 -1
  660. package/lib/components/Slider/Slider.styles.d.ts +4 -1
  661. package/lib/components/Slider/Slider.styles.d.ts.map +1 -1
  662. package/lib/components/Slider/Slider.styles.js +17 -5
  663. package/lib/components/Slider/Slider.styles.js.map +1 -1
  664. package/lib/components/Slider/Slider.types.d.ts +2 -2
  665. package/lib/components/Slider/Slider.types.d.ts.map +1 -1
  666. package/lib/components/Slider/Slider.types.js.map +1 -1
  667. package/lib/components/Slider/SliderTicks.d.ts +1 -0
  668. package/lib/components/Slider/SliderTicks.d.ts.map +1 -1
  669. package/lib/components/Slider/SliderTicks.js +19 -12
  670. package/lib/components/Slider/SliderTicks.js.map +1 -1
  671. package/lib/components/Slider/utils.d.ts +10 -11
  672. package/lib/components/Slider/utils.d.ts.map +1 -1
  673. package/lib/components/Slider/utils.js +24 -18
  674. package/lib/components/Slider/utils.js.map +1 -1
  675. package/lib/components/SummaryItem/SummaryItem.d.ts +5 -5
  676. package/lib/components/SummaryItem/SummaryItem.d.ts.map +1 -1
  677. package/lib/components/SummaryItem/SummaryItem.js +3 -5
  678. package/lib/components/SummaryItem/SummaryItem.js.map +1 -1
  679. package/lib/components/SummaryList/SummaryList.d.ts +8 -2
  680. package/lib/components/SummaryList/SummaryList.d.ts.map +1 -1
  681. package/lib/components/SummaryList/SummaryList.js +10 -11
  682. package/lib/components/SummaryList/SummaryList.js.map +1 -1
  683. package/lib/components/SummaryList/ViewAll.d.ts +1 -1
  684. package/lib/components/SummaryList/ViewAll.d.ts.map +1 -1
  685. package/lib/components/SummaryList/ViewAll.js +14 -10
  686. package/lib/components/SummaryList/ViewAll.js.map +1 -1
  687. package/lib/components/Switch/Switch.d.ts +2 -2
  688. package/lib/components/Switch/Switch.d.ts.map +1 -1
  689. package/lib/components/Switch/Switch.js +41 -30
  690. package/lib/components/Switch/Switch.js.map +1 -1
  691. package/lib/components/Table/Table.d.ts +2 -2
  692. package/lib/components/Table/Table.d.ts.map +1 -1
  693. package/lib/components/Table/Table.js +14 -13
  694. package/lib/components/Table/Table.js.map +1 -1
  695. package/lib/components/Table/index.d.ts +1 -2
  696. package/lib/components/Table/index.d.ts.map +1 -1
  697. package/lib/components/Table/index.js.map +1 -1
  698. package/lib/components/Tabs/Tab.d.ts +1 -1
  699. package/lib/components/Tabs/Tab.d.ts.map +1 -1
  700. package/lib/components/Tabs/Tab.js +9 -7
  701. package/lib/components/Tabs/Tab.js.map +1 -1
  702. package/lib/components/Tabs/TabPanel.d.ts +10 -2
  703. package/lib/components/Tabs/TabPanel.d.ts.map +1 -1
  704. package/lib/components/Tabs/TabPanel.js +24 -8
  705. package/lib/components/Tabs/TabPanel.js.map +1 -1
  706. package/lib/components/Tabs/Tabs.d.ts +1 -0
  707. package/lib/components/Tabs/Tabs.d.ts.map +1 -1
  708. package/lib/components/Tabs/Tabs.js +22 -18
  709. package/lib/components/Tabs/Tabs.js.map +1 -1
  710. package/lib/components/Tabs/Tabs.types.d.ts +2 -2
  711. package/lib/components/Tabs/Tabs.types.d.ts.map +1 -1
  712. package/lib/components/Tabs/Tabs.types.js.map +1 -1
  713. package/lib/components/Text/Text.d.ts +1 -1
  714. package/lib/components/Text/Text.d.ts.map +1 -1
  715. package/lib/components/Text/Text.js +2 -2
  716. package/lib/components/Text/Text.js.map +1 -1
  717. package/lib/components/TextArea/TextArea.d.ts +2 -2
  718. package/lib/components/TextArea/TextArea.d.ts.map +1 -1
  719. package/lib/components/TextArea/TextArea.js +31 -30
  720. package/lib/components/TextArea/TextArea.js.map +1 -1
  721. package/lib/components/TextArea/index.d.ts +1 -1
  722. package/lib/components/TextArea/index.d.ts.map +1 -1
  723. package/lib/components/TextArea/index.js.map +1 -1
  724. package/lib/components/Toaster/Toaster.d.ts +8 -36
  725. package/lib/components/Toaster/Toaster.d.ts.map +1 -1
  726. package/lib/components/Toaster/Toaster.js +97 -102
  727. package/lib/components/Toaster/Toaster.js.map +1 -1
  728. package/lib/components/Tooltip/Tooltip.d.ts +6 -1
  729. package/lib/components/Tooltip/Tooltip.d.ts.map +1 -1
  730. package/lib/components/Tooltip/Tooltip.js +6 -13
  731. package/lib/components/Tooltip/Tooltip.js.map +1 -1
  732. package/lib/components/Tree/StandardTree.d.ts +6 -0
  733. package/lib/components/Tree/StandardTree.d.ts.map +1 -0
  734. package/lib/components/Tree/StandardTree.js +175 -0
  735. package/lib/components/Tree/StandardTree.js.map +1 -0
  736. package/lib/components/Tree/StandardTree.styles.d.ts +13 -0
  737. package/lib/components/Tree/StandardTree.styles.d.ts.map +1 -0
  738. package/lib/components/Tree/StandardTree.styles.js +155 -0
  739. package/lib/components/Tree/StandardTree.styles.js.map +1 -0
  740. package/lib/components/Tree/StandardTree.types.d.ts +25 -0
  741. package/lib/components/Tree/StandardTree.types.d.ts.map +1 -0
  742. package/lib/components/Tree/StandardTree.types.js +2 -0
  743. package/lib/components/Tree/StandardTree.types.js.map +1 -0
  744. package/lib/components/Tree/Tree.d.ts +35 -49
  745. package/lib/components/Tree/Tree.d.ts.map +1 -1
  746. package/lib/components/Tree/Tree.js +18 -56
  747. package/lib/components/Tree/Tree.js.map +1 -1
  748. package/lib/components/Tree/helpers.d.ts +19 -0
  749. package/lib/components/Tree/helpers.d.ts.map +1 -0
  750. package/lib/components/Tree/helpers.js +180 -0
  751. package/lib/components/Tree/helpers.js.map +1 -0
  752. package/lib/components/Tree/index.d.ts +4 -2
  753. package/lib/components/Tree/index.d.ts.map +1 -1
  754. package/lib/components/Tree/index.js +3 -1
  755. package/lib/components/Tree/index.js.map +1 -1
  756. package/lib/components/URL/URLDisplay.d.ts +2 -2
  757. package/lib/components/URL/URLDisplay.d.ts.map +1 -1
  758. package/lib/components/URL/URLDisplay.js +2 -2
  759. package/lib/components/URL/URLDisplay.js.map +1 -1
  760. package/lib/components/VisuallyHiddenText/VisuallyHiddenText.d.ts +10 -0
  761. package/lib/components/VisuallyHiddenText/VisuallyHiddenText.d.ts.map +1 -0
  762. package/lib/components/VisuallyHiddenText/VisuallyHiddenText.js +10 -0
  763. package/lib/components/VisuallyHiddenText/VisuallyHiddenText.js.map +1 -0
  764. package/lib/components/VisuallyHiddenText/index.d.ts +2 -0
  765. package/lib/components/VisuallyHiddenText/index.d.ts.map +1 -0
  766. package/lib/components/VisuallyHiddenText/index.js +2 -0
  767. package/lib/components/VisuallyHiddenText/index.js.map +1 -0
  768. package/lib/hooks/index.d.ts +7 -4
  769. package/lib/hooks/index.d.ts.map +1 -1
  770. package/lib/hooks/index.js +7 -3
  771. package/lib/hooks/index.js.map +1 -1
  772. package/lib/hooks/useActiveDescendant.d.ts +17 -3
  773. package/lib/hooks/useActiveDescendant.d.ts.map +1 -1
  774. package/lib/hooks/useActiveDescendant.js +86 -64
  775. package/lib/hooks/useActiveDescendant.js.map +1 -1
  776. package/lib/hooks/useAutoResize.d.ts.map +1 -1
  777. package/lib/hooks/useAutoResize.js +6 -7
  778. package/lib/hooks/useAutoResize.js.map +1 -1
  779. package/lib/hooks/useBreakpoint.js +2 -4
  780. package/lib/hooks/useBreakpoint.js.map +1 -1
  781. package/lib/hooks/useDraggable.d.ts +8 -0
  782. package/lib/hooks/useDraggable.d.ts.map +1 -0
  783. package/lib/hooks/useDraggable.js +64 -0
  784. package/lib/hooks/useDraggable.js.map +1 -0
  785. package/lib/hooks/useFocusWithin.d.ts +1 -1
  786. package/lib/hooks/useFocusWithin.d.ts.map +1 -1
  787. package/lib/hooks/useFocusWithin.js +29 -24
  788. package/lib/hooks/useFocusWithin.js.map +1 -1
  789. package/lib/hooks/useI18n.d.ts +511 -170
  790. package/lib/hooks/useI18n.d.ts.map +1 -1
  791. package/lib/hooks/useI18n.js +2 -2
  792. package/lib/hooks/useI18n.js.map +1 -1
  793. package/lib/hooks/useLongPress.d.ts +16 -0
  794. package/lib/hooks/useLongPress.d.ts.map +1 -0
  795. package/lib/hooks/useLongPress.js +59 -0
  796. package/lib/hooks/useLongPress.js.map +1 -0
  797. package/lib/hooks/useOuterEvent.js +1 -1
  798. package/lib/hooks/useOuterEvent.js.map +1 -1
  799. package/lib/hooks/useOverride.js +1 -1
  800. package/lib/hooks/useOverride.js.map +1 -1
  801. package/lib/hooks/useScrollStick.js +14 -3
  802. package/lib/hooks/useScrollStick.js.map +1 -1
  803. package/lib/hooks/useScrollToggle.d.ts +6 -0
  804. package/lib/hooks/useScrollToggle.d.ts.map +1 -0
  805. package/lib/hooks/useScrollToggle.js +40 -0
  806. package/lib/hooks/useScrollToggle.js.map +1 -0
  807. package/lib/hooks/useTransitionState.d.ts +39 -0
  808. package/lib/hooks/useTransitionState.d.ts.map +1 -0
  809. package/lib/hooks/useTransitionState.js +56 -0
  810. package/lib/hooks/useTransitionState.js.map +1 -0
  811. package/lib/i18n/default.d.ts +589 -0
  812. package/lib/i18n/default.d.ts.map +1 -0
  813. package/lib/i18n/default.js +636 -0
  814. package/lib/i18n/default.js.map +1 -0
  815. package/lib/i18n/i18n.d.ts +1000 -318
  816. package/lib/i18n/i18n.d.ts.map +1 -1
  817. package/lib/i18n/i18n.js +1 -1
  818. package/lib/i18n/i18n.js.map +1 -1
  819. package/lib/i18n/index.d.ts +1 -0
  820. package/lib/i18n/index.d.ts.map +1 -1
  821. package/lib/i18n/index.js.map +1 -1
  822. package/lib/i18n/translate.d.ts +29 -4
  823. package/lib/i18n/translate.d.ts.map +1 -1
  824. package/lib/i18n/translate.js +21 -8
  825. package/lib/i18n/translate.js.map +1 -1
  826. package/lib/index.d.ts +11 -2
  827. package/lib/index.d.ts.map +1 -1
  828. package/lib/index.js +11 -2
  829. package/lib/index.js.map +1 -1
  830. package/lib/styles/GlobalStyle.d.ts.map +1 -1
  831. package/lib/styles/GlobalStyle.js +2 -26
  832. package/lib/styles/GlobalStyle.js.map +1 -1
  833. package/lib/theme/ThemeMachine.js +7 -1
  834. package/lib/theme/ThemeMachine.js.map +1 -1
  835. package/lib/theme/index.d.ts +1 -0
  836. package/lib/theme/index.d.ts.map +1 -1
  837. package/lib/theme/index.js +1 -0
  838. package/lib/theme/index.js.map +1 -1
  839. package/lib/theme/theme.d.ts +83 -53
  840. package/lib/theme/theme.d.ts.map +1 -1
  841. package/lib/theme/themeDefinition.json +50 -30
  842. package/lib/theme/themeOverrides.schema.json +24 -3
  843. package/lib/theme/themes/buildTheme.json +3 -39
  844. package/lib/theme/themes/darkTheme.json +6 -0
  845. package/lib/theme/themes/legacyBuildTheme.json +50 -0
  846. package/lib/types/types.d.ts +6 -1
  847. package/lib/types/types.d.ts.map +1 -1
  848. package/lib/types/types.js.map +1 -1
  849. package/lib/utils/utils.d.ts +41 -4
  850. package/lib/utils/utils.d.ts.map +1 -1
  851. package/lib/utils/utils.js +55 -9
  852. package/lib/utils/utils.js.map +1 -1
  853. package/package.json +11 -12
  854. package/lib/components/DateTime/Input/useButtonAriaLabel.d.ts +0 -3
  855. package/lib/components/DateTime/Input/useButtonAriaLabel.d.ts.map +0 -1
  856. package/lib/components/DateTime/Input/useButtonAriaLabel.js +0 -33
  857. package/lib/components/DateTime/Input/useButtonAriaLabel.js.map +0 -1
  858. package/lib/components/NoItems/NoItems.d.ts +0 -14
  859. package/lib/components/NoItems/NoItems.d.ts.map +0 -1
  860. package/lib/components/NoItems/NoItems.js.map +0 -1
  861. package/lib/components/NoItems/index.d.ts +0 -4
  862. package/lib/components/NoItems/index.d.ts.map +0 -1
  863. package/lib/components/NoItems/index.js +0 -3
  864. package/lib/components/NoItems/index.js.map +0 -1
  865. package/lib/i18n/default.json +0 -246
@@ -1,12 +1,14 @@
1
1
  import { useEffect, useState, useCallback, useRef } from 'react';
2
2
  import { createUID } from '../utils';
3
- const useActiveDescendant = ({ focusEl, scope, scopeSelector, selector, focusReturnEl, clearFocusReturn, currentDescendantId, onClick, preventInitialScroll, clearPreventScroll }, dependencyArray = []) => {
3
+ const useActiveDescendant = ({ focusEl, scope, scopeSelector, selector, focusDescendantEl, clearFocusDescendant, focusReturnEl, clearFocusReturn, currentDescendantId, onClick, preventInitialScroll, pauseDescendantEvaluation = false, clearPreventScroll }, dependencyArray = []) => {
4
+ const [resetId, setResetId] = useState(0);
4
5
  const previousActiveId = useRef('');
6
+ const [focusDescendantElIndex, setFocusDescendantElIndex] = useState(null);
5
7
  const [currentIndex, setCurrentIndex] = useState(null);
6
8
  const [descendants, setDescendants] = useState();
7
9
  const clearThenSetDescendants = useCallback((setVal) => {
8
- descendants === null || descendants === void 0 ? void 0 : descendants.forEach(node => {
9
- node.setAttribute('aria-current', 'false');
10
+ descendants?.forEach(node => {
11
+ node.setAttribute('data-current', 'false');
10
12
  });
11
13
  setDescendants(setVal
12
14
  ? Array.from(setVal).filter((item) => item instanceof HTMLElement)
@@ -14,29 +16,31 @@ const useActiveDescendant = ({ focusEl, scope, scopeSelector, selector, focusRet
14
16
  }, [descendants]);
15
17
  // ## Update descendants
16
18
  useEffect(() => {
17
- // 0 second timeout added because descendantScope needs to be up to date before running query after dependencyArray change
18
- setTimeout(() => {
19
- let hasScope = scope;
20
- if (hasScope && hasScope instanceof HTMLElement) {
21
- if (scopeSelector) {
22
- hasScope = hasScope.querySelector(scopeSelector);
23
- }
24
- if (!hasScope) {
25
- clearThenSetDescendants(null);
26
- return;
27
- }
28
- if (selector) {
29
- clearThenSetDescendants(hasScope.querySelectorAll(selector));
19
+ if (!pauseDescendantEvaluation) {
20
+ // 0 second timeout added because descendantScope needs to be up to date before running query after dependencyArray change
21
+ setTimeout(() => {
22
+ let hasScope = scope;
23
+ if (hasScope && hasScope instanceof HTMLElement) {
24
+ if (scopeSelector) {
25
+ hasScope = hasScope.querySelector(scopeSelector);
26
+ }
27
+ if (!hasScope) {
28
+ clearThenSetDescendants(null);
29
+ return;
30
+ }
31
+ if (selector) {
32
+ clearThenSetDescendants(hasScope.querySelectorAll(selector));
33
+ }
34
+ else {
35
+ clearThenSetDescendants(hasScope.querySelectorAll('a, button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])'));
36
+ }
30
37
  }
31
38
  else {
32
- clearThenSetDescendants(hasScope.querySelectorAll('a, button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])'));
39
+ clearThenSetDescendants(null);
33
40
  }
34
- }
35
- else {
36
- clearThenSetDescendants(null);
37
- }
38
- }, 0);
39
- }, [scope, scopeSelector, selector, focusEl, ...dependencyArray]);
41
+ }, 0);
42
+ }
43
+ }, [pauseDescendantEvaluation, scope, scopeSelector, selector, focusEl, ...dependencyArray]);
40
44
  // ## Set IDs and aria-owns
41
45
  useEffect(() => {
42
46
  const ownedIds = [];
@@ -47,22 +51,21 @@ const useActiveDescendant = ({ focusEl, scope, scopeSelector, selector, focusRet
47
51
  ownedIds.push(node.id);
48
52
  });
49
53
  }
50
- focusEl === null || focusEl === void 0 ? void 0 : focusEl.setAttribute('aria-owns', ownedIds.join(' '));
54
+ focusEl?.setAttribute('aria-owns', ownedIds.join(' '));
51
55
  return () => {
52
- focusEl === null || focusEl === void 0 ? void 0 : focusEl.removeAttribute('aria-owns');
56
+ focusEl?.removeAttribute('aria-owns');
53
57
  };
54
58
  }, [focusEl, descendants]);
55
59
  // ## Bind focus el keyDown
56
60
  useEffect(() => {
57
61
  const onKeyDown = (e) => {
58
- var _a;
59
62
  if (descendants && descendants.length) {
60
63
  switch (e.key) {
61
64
  case 'ArrowDown':
62
65
  e.preventDefault();
63
66
  // Focus next or first
64
- clearFocusReturn === null || clearFocusReturn === void 0 ? void 0 : clearFocusReturn();
65
- clearPreventScroll === null || clearPreventScroll === void 0 ? void 0 : clearPreventScroll();
67
+ clearFocusReturn?.();
68
+ clearPreventScroll?.();
66
69
  if (currentIndex !== null && currentIndex + 1 < descendants.length) {
67
70
  setCurrentIndex(currentIndex + 1);
68
71
  }
@@ -73,8 +76,8 @@ const useActiveDescendant = ({ focusEl, scope, scopeSelector, selector, focusRet
73
76
  case 'ArrowUp':
74
77
  e.preventDefault();
75
78
  // Focus previous or last
76
- clearFocusReturn === null || clearFocusReturn === void 0 ? void 0 : clearFocusReturn();
77
- clearPreventScroll === null || clearPreventScroll === void 0 ? void 0 : clearPreventScroll();
79
+ clearFocusReturn?.();
80
+ clearPreventScroll?.();
78
81
  if (currentIndex !== null && currentIndex - 1 > -1) {
79
82
  setCurrentIndex(currentIndex - 1);
80
83
  }
@@ -84,19 +87,17 @@ const useActiveDescendant = ({ focusEl, scope, scopeSelector, selector, focusRet
84
87
  break;
85
88
  case 'Enter':
86
89
  // Click focused item
87
- if (descendants && descendants.length) {
88
- if (currentIndex !== null) {
89
- if (onClick) {
90
- onClick(descendants[currentIndex]);
91
- break;
92
- }
93
- const nodeName = descendants[currentIndex].nodeName.toLowerCase();
94
- if (nodeName === 'input' || nodeName === 'button' || nodeName === 'a') {
95
- descendants[currentIndex].click();
96
- }
97
- else {
98
- (_a = descendants[currentIndex].querySelector('button, a, input')) === null || _a === void 0 ? void 0 : _a.click();
99
- }
90
+ if (descendants && descendants.length && currentIndex !== null) {
91
+ if (onClick) {
92
+ onClick(descendants[currentIndex]);
93
+ break;
94
+ }
95
+ const nodeName = descendants[currentIndex].nodeName.toLowerCase();
96
+ if (nodeName === 'input' || nodeName === 'button' || nodeName === 'a') {
97
+ descendants[currentIndex].click();
98
+ }
99
+ else {
100
+ descendants[currentIndex].querySelector('button, a, input')?.click();
100
101
  }
101
102
  }
102
103
  break;
@@ -106,11 +107,11 @@ const useActiveDescendant = ({ focusEl, scope, scopeSelector, selector, focusRet
106
107
  }
107
108
  };
108
109
  // Do not rebind once / if `currentDescendantId` control is defined
109
- if (focusEl && (descendants === null || descendants === void 0 ? void 0 : descendants.length) && !currentDescendantId) {
110
+ if (focusEl && descendants?.length && !currentDescendantId) {
110
111
  focusEl.addEventListener('keydown', onKeyDown);
111
112
  }
112
113
  return () => {
113
- focusEl === null || focusEl === void 0 ? void 0 : focusEl.removeEventListener('keydown', onKeyDown);
114
+ focusEl?.removeEventListener('keydown', onKeyDown);
114
115
  };
115
116
  }, [focusEl, currentIndex, descendants]);
116
117
  // ## Handle independent control update
@@ -125,38 +126,59 @@ const useActiveDescendant = ({ focusEl, scope, scopeSelector, selector, focusRet
125
126
  }, [currentDescendantId, descendants]);
126
127
  // ## Set and scroll to current descendant
127
128
  useEffect(() => {
128
- var _a;
129
- const overrideId = focusReturnEl === null || focusReturnEl === void 0 ? void 0 : focusReturnEl.id;
130
- let overrideIndex;
129
+ const nextIndex = focusDescendantElIndex || currentIndex;
130
+ const focusReturnId = focusReturnEl?.id;
131
+ let focusReturnIndex;
132
+ const focusDescendantElId = focusDescendantEl?.id;
133
+ let focusDescendantIndex;
134
+ let foundFocusDescendantEl = false;
131
135
  if (descendants && descendants.length) {
132
- // clear previous & catch override index
136
+ // clear previous & catch focusReturn / focusDescendantEl index
133
137
  descendants.forEach((node, index) => {
134
- if (node.id === overrideId)
135
- overrideIndex = index;
136
- node.setAttribute('aria-current', 'false');
138
+ if (focusDescendantElIndex === null && node.id === focusDescendantElId) {
139
+ focusDescendantIndex = index;
140
+ foundFocusDescendantEl = true;
141
+ setFocusDescendantElIndex(index);
142
+ }
143
+ if (node.id === focusReturnId) {
144
+ focusReturnIndex = index;
145
+ }
146
+ node.setAttribute('data-current', 'false');
137
147
  });
138
- // early return (break for override)
139
- if (overrideIndex && overrideIndex !== currentIndex) {
140
- setCurrentIndex(overrideIndex);
141
- clearFocusReturn === null || clearFocusReturn === void 0 ? void 0 : clearFocusReturn();
148
+ // early return for focusReturn / focusDescendantEl
149
+ if (focusReturnIndex && focusReturnIndex !== currentIndex) {
150
+ setCurrentIndex(focusReturnIndex);
151
+ clearFocusReturn?.();
152
+ return;
153
+ }
154
+ if (foundFocusDescendantEl && focusDescendantIndex !== undefined) {
155
+ // hard reset to continue focusDescendantEl process even if it is the active descendant
156
+ setResetId(Math.random());
157
+ setCurrentIndex(focusDescendantIndex);
142
158
  return;
143
159
  }
144
160
  // set new
145
- if (currentIndex !== null && descendants[currentIndex]) {
146
- const itemEl = descendants[currentIndex];
147
- itemEl.setAttribute('aria-current', 'true');
148
- focusEl === null || focusEl === void 0 ? void 0 : focusEl.setAttribute('aria-activedescendant', itemEl.id);
161
+ if (nextIndex !== null && descendants[nextIndex]) {
162
+ const itemEl = descendants[nextIndex];
163
+ itemEl.setAttribute('data-current', 'true');
164
+ focusEl?.setAttribute('aria-activedescendant', itemEl.id);
165
+ // scroll to element
149
166
  if (itemEl.id !== previousActiveId.current && !preventInitialScroll) {
150
- const scrollTo = (_a = Element.prototype.scrollIntoViewIfNeeded) !== null && _a !== void 0 ? _a : Element.prototype.scrollIntoView;
151
- scrollTo === null || scrollTo === void 0 ? void 0 : scrollTo.call(itemEl, false);
167
+ const scrollTo = Element.prototype.scrollIntoViewIfNeeded ?? Element.prototype.scrollIntoView;
168
+ scrollTo?.call(itemEl, false);
169
+ }
170
+ // focusDescendantEl cleanup
171
+ if (focusDescendantElIndex !== null) {
172
+ setFocusDescendantElIndex(null);
173
+ clearFocusDescendant?.();
152
174
  }
153
175
  previousActiveId.current = itemEl.id;
154
176
  }
155
177
  }
156
178
  return () => {
157
- focusEl === null || focusEl === void 0 ? void 0 : focusEl.removeAttribute('aria-activedescendant');
179
+ focusEl?.removeAttribute('aria-activedescendant');
158
180
  };
159
- }, [descendants, currentIndex, focusEl]);
181
+ }, [descendants, currentIndex, focusDescendantEl, focusEl, resetId]);
160
182
  return {
161
183
  activeDescendant: currentIndex !== null && descendants ? descendants[currentIndex] : undefined,
162
184
  descendants: descendants || null
@@ -1 +1 @@
1
- {"version":3,"file":"useActiveDescendant.js","sourceRoot":"","sources":["../../src/hooks/useActiveDescendant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAkB,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEjF,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAiCrC,MAAM,mBAAmB,GAAG,CAC1B,EACE,OAAO,EACP,KAAK,EACL,aAAa,EACb,QAAQ,EACR,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,OAAO,EACP,oBAAoB,EACpB,kBAAkB,EACQ,EAC5B,kBAAkC,EAAE,EAIpC,EAAE;IACF,MAAM,gBAAgB,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;IACpC,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IACtE,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,EAAe,CAAC;IAE9D,MAAM,uBAAuB,GAAG,WAAW,CACzC,CAAC,MAAkC,EAAE,EAAE;QACrC,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,OAAO,CAAC,IAAI,CAAC,EAAE;YAC1B,IAAI,CAAC,YAAY,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;QAC7C,CAAC,CAAC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1D,IAAI,MAAM,CAAC,EAAE,KAAK,gBAAgB,CAAC,OAAO,IAAI,CAAC,oBAAoB,EAAE;oBACnE,MAAM,QAAQ,GACZ,MAAA,OAAO,CAAC,SAAS,CAAC,sBAAsB,mCAAI,OAAO,CAAC,SAAS,CAAC,cAAc,CAAC;oBAE/E,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;iBAC/B;gBAED,gBAAgB,CAAC,OAAO,GAAG,MAAM,CAAC,EAAE,CAAC;aACtC;SACF;QAED,OAAO,GAAG,EAAE;YACV,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,eAAe,CAAC,uBAAuB,CAAC,CAAC;QACpD,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,WAAW,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC;IAEzC,OAAO;QACL,gBAAgB,EAAE,YAAY,KAAK,IAAI,IAAI,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,SAAS;QAC9F,WAAW,EAAE,WAAW,IAAI,IAAI;KACjC,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["import { useEffect, useState, DependencyList, useCallback, useRef } from 'react';\n\nimport { createUID } from '../utils';\n\nexport interface UseActiveDescendantConfig {\n /** DOM element which controls and has active descendants */\n focusEl: HTMLElement | null;\n /** Root scope for descendant options */\n scope: HTMLElement | null;\n /** Custom selector for specific descendant scope in root descendant scope */\n scopeSelector?: string;\n /** Custom selector for descendant options */\n selector?: string;\n /** One-time override for focused element on next re-evaluation of active descendants. */\n focusReturnEl?: HTMLElement | null;\n /** Callback to clear focusReturnEl after use. */\n clearFocusReturn?: () => void;\n /**\n * Descendant ID used for continuous override of current active descendant,\n * used for external focus control / keyDown bindings (see RTE).\n * NOTE: setting currentDescendantId once effectively disables the keybindings of this hook.\n * If you only need to set the current element once, use focusReturnEl & clearFocusReturn.\n */\n currentDescendantId?: string;\n /** Explicit onClick handler called on keydown 'enter' event */\n onClick?: (currentDescendantEl: HTMLElement) => void;\n /** Prevent scrolling to the active descendant on the initial render. */\n preventInitialScroll?: boolean;\n /** Callback to clear preventInitialScroll after use. */\n clearPreventScroll?: () => void;\n}\n\ntype CurrentDescendant = HTMLElement | undefined;\ntype Descendants = HTMLElement[] | null;\n\nconst useActiveDescendant = (\n {\n focusEl,\n scope,\n scopeSelector,\n selector,\n focusReturnEl,\n clearFocusReturn,\n currentDescendantId,\n onClick,\n preventInitialScroll,\n clearPreventScroll\n }: UseActiveDescendantConfig,\n dependencyArray: DependencyList = []\n): {\n activeDescendant: CurrentDescendant;\n descendants: Descendants;\n} => {\n const previousActiveId = useRef('');\n const [currentIndex, setCurrentIndex] = useState<number | null>(null);\n const [descendants, setDescendants] = useState<Descendants>();\n\n const clearThenSetDescendants = useCallback(\n (setVal: NodeListOf<Element> | null) => {\n descendants?.forEach(node => {\n node.setAttribute('aria-current', 'false');\n });\n\n setDescendants(\n setVal\n ? Array.from(setVal).filter((item): item is HTMLElement => item instanceof HTMLElement)\n : null\n );\n },\n [descendants]\n );\n\n // ## Update descendants\n useEffect(() => {\n // 0 second timeout added because descendantScope needs to be up to date before running query after dependencyArray change\n setTimeout(() => {\n let hasScope = scope;\n\n if (hasScope && hasScope instanceof HTMLElement) {\n if (scopeSelector) {\n hasScope = hasScope.querySelector(scopeSelector);\n }\n\n if (!hasScope) {\n clearThenSetDescendants(null);\n return;\n }\n\n if (selector) {\n clearThenSetDescendants(hasScope.querySelectorAll(selector));\n } else {\n clearThenSetDescendants(\n hasScope.querySelectorAll(\n 'a, button, input, textarea, select, details, [tabindex]:not([tabindex=\"-1\"])'\n )\n );\n }\n } else {\n clearThenSetDescendants(null);\n }\n }, 0);\n }, [scope, scopeSelector, selector, focusEl, ...dependencyArray]);\n\n // ## Set IDs and aria-owns\n useEffect(() => {\n const ownedIds: string[] = [];\n setCurrentIndex(0);\n\n if (descendants && descendants.length) {\n descendants.forEach(node => {\n node.id = node.id || createUID();\n ownedIds.push(node.id);\n });\n }\n\n focusEl?.setAttribute('aria-owns', ownedIds.join(' '));\n\n return () => {\n focusEl?.removeAttribute('aria-owns');\n };\n }, [focusEl, descendants]);\n\n // ## Bind focus el keyDown\n useEffect(() => {\n const onKeyDown = (e: KeyboardEvent) => {\n if (descendants && descendants.length) {\n switch (e.key) {\n case 'ArrowDown':\n e.preventDefault();\n // Focus next or first\n clearFocusReturn?.();\n clearPreventScroll?.();\n if (currentIndex !== null && currentIndex + 1 < descendants.length) {\n setCurrentIndex(currentIndex + 1);\n } else {\n setCurrentIndex(0);\n }\n break;\n case 'ArrowUp':\n e.preventDefault();\n // Focus previous or last\n clearFocusReturn?.();\n clearPreventScroll?.();\n if (currentIndex !== null && currentIndex - 1 > -1) {\n setCurrentIndex(currentIndex - 1);\n } else {\n setCurrentIndex(descendants.length - 1);\n }\n break;\n case 'Enter':\n // Click focused item\n if (descendants && descendants.length) {\n if (currentIndex !== null) {\n if (onClick) {\n onClick(descendants[currentIndex]);\n break;\n }\n\n const nodeName = descendants[currentIndex].nodeName.toLowerCase();\n if (nodeName === 'input' || nodeName === 'button' || nodeName === 'a') {\n descendants[currentIndex].click();\n } else {\n descendants[currentIndex].querySelector<HTMLElement>('button, a, input')?.click();\n }\n }\n }\n break;\n default:\n break;\n }\n }\n };\n\n // Do not rebind once / if `currentDescendantId` control is defined\n if (focusEl && descendants?.length && !currentDescendantId) {\n focusEl.addEventListener('keydown', onKeyDown);\n }\n\n return () => {\n focusEl?.removeEventListener('keydown', onKeyDown);\n };\n }, [focusEl, currentIndex, descendants]);\n\n // ## Handle independent control update\n useEffect(() => {\n if (descendants && currentDescendantId) {\n descendants.forEach((node, index) => {\n if (node.id === currentDescendantId) {\n setCurrentIndex(index);\n }\n });\n }\n }, [currentDescendantId, descendants]);\n\n // ## Set and scroll to current descendant\n useEffect(() => {\n const overrideId = focusReturnEl?.id;\n let overrideIndex;\n\n if (descendants && descendants.length) {\n // clear previous & catch override index\n descendants.forEach((node, index) => {\n if (node.id === overrideId) overrideIndex = index;\n node.setAttribute('aria-current', 'false');\n });\n\n // early return (break for override)\n if (overrideIndex && overrideIndex !== currentIndex) {\n setCurrentIndex(overrideIndex);\n\n clearFocusReturn?.();\n\n return;\n }\n\n // set new\n if (currentIndex !== null && descendants[currentIndex]) {\n const itemEl = descendants[currentIndex!];\n itemEl.setAttribute('aria-current', 'true');\n focusEl?.setAttribute('aria-activedescendant', itemEl.id);\n\n if (itemEl.id !== previousActiveId.current && !preventInitialScroll) {\n const scrollTo: (this: Element, arg: boolean) => void =\n Element.prototype.scrollIntoViewIfNeeded ?? Element.prototype.scrollIntoView;\n\n scrollTo?.call(itemEl, false);\n }\n\n previousActiveId.current = itemEl.id;\n }\n }\n\n return () => {\n focusEl?.removeAttribute('aria-activedescendant');\n };\n }, [descendants, currentIndex, focusEl]);\n\n return {\n activeDescendant: currentIndex !== null && descendants ? descendants[currentIndex] : undefined,\n descendants: descendants || null\n };\n};\n\nexport default useActiveDescendant;\n"]}
1
+ {"version":3,"file":"useActiveDescendant.js","sourceRoot":"","sources":["../../src/hooks/useActiveDescendant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAkB,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEjF,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AA+CrC,MAAM,mBAAmB,GAAG,CAC1B,EACE,OAAO,EACP,KAAK,EACL,aAAa,EACb,QAAQ,EACR,iBAAiB,EACjB,oBAAoB,EACpB,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,OAAO,EACP,oBAAoB,EACpB,yBAAyB,GAAG,KAAK,EACjC,kBAAkB,EACQ,EAC5B,kBAAkC,EAAE,EAIpC,EAAE;IACF,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC1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AAM,CAAC,EAAE,CAAC;aACtC;SACF;QAED,OAAO,GAAG,EAAE;YACV,OAAO,EAAE,eAAe,CAAC,uBAAuB,CAAC,CAAC;QACpD,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,WAAW,EAAE,YAAY,EAAE,iBAAiB,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IAErE,OAAO;QACL,gBAAgB,EAAE,YAAY,KAAK,IAAI,IAAI,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,SAAS;QAC9F,WAAW,EAAE,WAAW,IAAI,IAAI;KACjC,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["import { useEffect, useState, DependencyList, useCallback, useRef } from 'react';\n\nimport { createUID } from '../utils';\n\nexport interface UseActiveDescendantConfig {\n /** DOM element which controls and has active descendants */\n focusEl: HTMLElement | null;\n /** Root scope for descendant options */\n scope: HTMLElement | null;\n /** Custom selector for specific descendant scope in root descendant scope */\n scopeSelector?: string;\n /** Custom selector for descendant options */\n selector?: string;\n /** One-time override for the focused descendant, triggers re-evaluation.\n * Include `clearFocusDescendantEl` for cleanup.\n */\n focusDescendantEl?: HTMLElement | null;\n /** Callback to clear focusDescendantEl after use. */\n clearFocusDescendant?: () => void;\n /** One-time override for focused element on NEXT re-evaluation of active descendants.\n * Include `clearFocusReturn` for cleanup.\n */\n focusReturnEl?: HTMLElement | null;\n /** Callback to clear focusReturnEl after use. */\n clearFocusReturn?: () => void;\n /**\n * Descendant ID used for continuous override of current active descendant,\n * used for external focus control / keyDown bindings (see RTE).\n * NOTE: setting currentDescendantId once effectively disables the keybindings of this hook.\n * If you only need to set the current element once, use focusReturnEl & clearFocusReturn.\n */\n currentDescendantId?: string;\n /** Explicit onClick handler called on keydown 'enter' event */\n onClick?: (currentDescendantEl: HTMLElement) => void;\n /** Prevent scrolling to the active descendant on the initial render.\n * Include `preventInitialScroll` for cleanup.\n */\n preventInitialScroll?: boolean;\n /** Callback to clear preventInitialScroll after use. */\n clearPreventScroll?: () => void;\n /** Boolean to prevent descendant evaluation.\n * @default false\n */\n pauseDescendantEvaluation?: boolean;\n}\n\ntype CurrentDescendant = HTMLElement | undefined;\ntype Descendants = HTMLElement[] | null;\n\nconst useActiveDescendant = (\n {\n focusEl,\n scope,\n scopeSelector,\n selector,\n focusDescendantEl,\n clearFocusDescendant,\n focusReturnEl,\n clearFocusReturn,\n currentDescendantId,\n onClick,\n preventInitialScroll,\n pauseDescendantEvaluation = false,\n clearPreventScroll\n }: UseActiveDescendantConfig,\n dependencyArray: DependencyList = []\n): {\n activeDescendant: CurrentDescendant;\n descendants: Descendants;\n} => {\n const [resetId, setResetId] = useState(0);\n const previousActiveId = useRef('');\n const [focusDescendantElIndex, setFocusDescendantElIndex] = useState<number | null>(null);\n const [currentIndex, setCurrentIndex] = useState<number | null>(null);\n const [descendants, setDescendants] = useState<Descendants>();\n\n const clearThenSetDescendants = useCallback(\n (setVal: NodeListOf<Element> | null) => {\n descendants?.forEach(node => {\n node.setAttribute('data-current', 'false');\n });\n\n setDescendants(\n setVal\n ? Array.from(setVal).filter((item): item is HTMLElement => item instanceof HTMLElement)\n : null\n );\n },\n [descendants]\n );\n\n // ## Update descendants\n useEffect(() => {\n if (!pauseDescendantEvaluation) {\n // 0 second timeout added because descendantScope needs to be up to date before running query after dependencyArray change\n setTimeout(() => {\n let hasScope = scope;\n\n if (hasScope && hasScope instanceof HTMLElement) {\n if (scopeSelector) {\n hasScope = hasScope.querySelector(scopeSelector);\n }\n\n if (!hasScope) {\n clearThenSetDescendants(null);\n return;\n }\n\n if (selector) {\n clearThenSetDescendants(hasScope.querySelectorAll(selector));\n } else {\n clearThenSetDescendants(\n hasScope.querySelectorAll(\n 'a, button, input, textarea, select, details, [tabindex]:not([tabindex=\"-1\"])'\n )\n );\n }\n } else {\n clearThenSetDescendants(null);\n }\n }, 0);\n }\n }, [pauseDescendantEvaluation, scope, scopeSelector, selector, focusEl, ...dependencyArray]);\n\n // ## Set IDs and aria-owns\n useEffect(() => {\n const ownedIds: string[] = [];\n setCurrentIndex(0);\n\n if (descendants && descendants.length) {\n descendants.forEach(node => {\n node.id = node.id || createUID();\n ownedIds.push(node.id);\n });\n }\n\n focusEl?.setAttribute('aria-owns', ownedIds.join(' '));\n\n return () => {\n focusEl?.removeAttribute('aria-owns');\n };\n }, [focusEl, descendants]);\n\n // ## Bind focus el keyDown\n useEffect(() => {\n const onKeyDown = (e: KeyboardEvent) => {\n if (descendants && descendants.length) {\n switch (e.key) {\n case 'ArrowDown':\n e.preventDefault();\n // Focus next or first\n clearFocusReturn?.();\n clearPreventScroll?.();\n if (currentIndex !== null && currentIndex + 1 < descendants.length) {\n setCurrentIndex(currentIndex + 1);\n } else {\n setCurrentIndex(0);\n }\n break;\n case 'ArrowUp':\n e.preventDefault();\n // Focus previous or last\n clearFocusReturn?.();\n clearPreventScroll?.();\n if (currentIndex !== null && currentIndex - 1 > -1) {\n setCurrentIndex(currentIndex - 1);\n } else {\n setCurrentIndex(descendants.length - 1);\n }\n break;\n case 'Enter':\n // Click focused item\n if (descendants && descendants.length && currentIndex !== null) {\n if (onClick) {\n onClick(descendants[currentIndex]);\n break;\n }\n\n const nodeName = descendants[currentIndex].nodeName.toLowerCase();\n if (nodeName === 'input' || nodeName === 'button' || nodeName === 'a') {\n descendants[currentIndex].click();\n } else {\n descendants[currentIndex].querySelector<HTMLElement>('button, a, input')?.click();\n }\n }\n break;\n default:\n break;\n }\n }\n };\n\n // Do not rebind once / if `currentDescendantId` control is defined\n if (focusEl && descendants?.length && !currentDescendantId) {\n focusEl.addEventListener('keydown', onKeyDown);\n }\n\n return () => {\n focusEl?.removeEventListener('keydown', onKeyDown);\n };\n }, [focusEl, currentIndex, descendants]);\n\n // ## Handle independent control update\n useEffect(() => {\n if (descendants && currentDescendantId) {\n descendants.forEach((node, index) => {\n if (node.id === currentDescendantId) {\n setCurrentIndex(index);\n }\n });\n }\n }, [currentDescendantId, descendants]);\n\n // ## Set and scroll to current descendant\n useEffect(() => {\n const nextIndex = focusDescendantElIndex || currentIndex;\n const focusReturnId = focusReturnEl?.id;\n let focusReturnIndex;\n const focusDescendantElId = focusDescendantEl?.id;\n let focusDescendantIndex;\n let foundFocusDescendantEl = false;\n\n if (descendants && descendants.length) {\n // clear previous & catch focusReturn / focusDescendantEl index\n descendants.forEach((node, index) => {\n if (focusDescendantElIndex === null && node.id === focusDescendantElId) {\n focusDescendantIndex = index;\n foundFocusDescendantEl = true;\n setFocusDescendantElIndex(index);\n }\n if (node.id === focusReturnId) {\n focusReturnIndex = index;\n }\n node.setAttribute('data-current', 'false');\n });\n\n // early return for focusReturn / focusDescendantEl\n if (focusReturnIndex && focusReturnIndex !== currentIndex) {\n setCurrentIndex(focusReturnIndex);\n clearFocusReturn?.();\n return;\n }\n if (foundFocusDescendantEl && focusDescendantIndex !== undefined) {\n // hard reset to continue focusDescendantEl process even if it is the active descendant\n setResetId(Math.random());\n setCurrentIndex(focusDescendantIndex);\n return;\n }\n\n // set new\n if (nextIndex !== null && descendants[nextIndex]) {\n const itemEl = descendants[nextIndex!];\n itemEl.setAttribute('data-current', 'true');\n focusEl?.setAttribute('aria-activedescendant', itemEl.id);\n\n // scroll to element\n if (itemEl.id !== previousActiveId.current && !preventInitialScroll) {\n const scrollTo: (this: Element, arg: boolean) => void =\n Element.prototype.scrollIntoViewIfNeeded ?? Element.prototype.scrollIntoView;\n\n scrollTo?.call(itemEl, false);\n }\n\n // focusDescendantEl cleanup\n if (focusDescendantElIndex !== null) {\n setFocusDescendantElIndex(null);\n clearFocusDescendant?.();\n }\n\n previousActiveId.current = itemEl.id;\n }\n }\n\n return () => {\n focusEl?.removeAttribute('aria-activedescendant');\n };\n }, [descendants, currentIndex, focusDescendantEl, focusEl, resetId]);\n\n return {\n activeDescendant: currentIndex !== null && descendants ? descendants[currentIndex] : undefined,\n descendants: descendants || null\n };\n};\n\nexport default useActiveDescendant;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useAutoResize.d.ts","sourceRoot":"","sources":["../../src/hooks/useAutoResize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,SAAS,EAAE,MAAM,OAAO,CAAC;AAIpD;;;;;;;GAOG;AACH,QAAA,MAAM,aAAa,oIAGK,IAAI,CAmC3B,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"useAutoResize.d.ts","sourceRoot":"","sources":["../../src/hooks/useAutoResize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,SAAS,EAAE,MAAM,OAAO,CAAC;AAIpD;;;;;;;GAOG;AACH,QAAA,MAAM,aAAa,oIAGK,IAAI,CA4B3B,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -13,21 +13,20 @@ const useAutoResize = (maxHeight, minHeightProp) => {
13
13
  const [minHeight, setMinHeight] = useState(minHeightProp || 0);
14
14
  const autoResize = () => {
15
15
  if (element.current) {
16
+ let newMinHeight = minHeight;
16
17
  if (!minHeight) {
17
- setMinHeight(element.current.scrollHeight);
18
+ newMinHeight = element.current.scrollHeight;
19
+ setMinHeight(newMinHeight);
18
20
  }
19
21
  // Reset the heights to the base height so there is an overflow / or none to calculate the new height
20
- element.current.style.minHeight = `${minHeight}px`;
21
- element.current.style.height = `${minHeight}px`;
22
+ element.current.style.height = `${newMinHeight}px`;
22
23
  if (maxHeight) {
23
24
  element.current.style.overflowY =
24
25
  element.current.scrollHeight > maxHeight ? 'auto' : 'hidden';
25
- element.current.style.minHeight = `${Math.min(element.current.scrollHeight, maxHeight).toString()}px`;
26
- element.current.style.height = `${Math.min(element.current.scrollHeight, maxHeight).toString()}px`;
26
+ element.current.style.height = `${Math.min(element.current.scrollHeight, maxHeight)}px`;
27
27
  }
28
28
  else {
29
- element.current.style.minHeight = `${element.current.scrollHeight.toString()}px`;
30
- element.current.style.height = `${element.current.scrollHeight.toString()}px`;
29
+ element.current.style.height = `${element.current.scrollHeight}px`;
31
30
  }
32
31
  }
33
32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C,YAAY,EAC5B,SAAS,CACV,CAAC,QAAQ,EAAE,IAAI,CAAC;aAClB;iBAAM;gBACL,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,QAAQ,EAAE,IAAI,CAAC;gBACjF,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,QAAQ,EAAE,IAAI,CAAC;aAC/E;SACF;IACH,CAAC,CAAC;IAEF,MAAM,mBAAmB,GAAG,QAAQ,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;IAEtD,OAAO,CAAC,OAAO,EAAE,mBAAmB,CAAC,CAAC;AACxC,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import { useRef, useState, RefObject } from 'react';\n\nimport { debounce } from '../utils';\n\n/**\n * @example const [ref, resizeFunction] = useAutoResize();\n * maxHeight should be provided in pixels without units\n * minHeight should be provided in pixels without units\n * @returns * ref:: A reference for the element that the resize functionality should be applied to. [React RefObject](https://reactjs.org/docs/refs-and-the-dom.html)\n * * resizeFunction:: The function to call to automatically resize the element.\n * element refers to auto resizable element\n */\nconst useAutoResize = <T extends HTMLElement = HTMLElement>(\n maxHeight?: number,\n minHeightProp?: number\n): [RefObject<T>, () => void] => {\n const element = useRef<T>(null);\n\n const [minHeight, setMinHeight] = useState(minHeightProp || 0);\n\n const autoResize = () => {\n if (element.current) {\n if (!minHeight) {\n setMinHeight(element.current.scrollHeight);\n }\n // Reset the heights to the base height so there is an overflow / or none to calculate the new height\n element.current.style.minHeight = `${minHeight}px`;\n element.current.style.height = `${minHeight}px`;\n\n if (maxHeight) {\n element.current.style.overflowY =\n element.current.scrollHeight > maxHeight ? 'auto' : 'hidden';\n element.current.style.minHeight = `${Math.min(\n element.current.scrollHeight,\n maxHeight\n ).toString()}px`;\n element.current.style.height = `${Math.min(\n element.current.scrollHeight,\n maxHeight\n ).toString()}px`;\n } else {\n element.current.style.minHeight = `${element.current.scrollHeight.toString()}px`;\n element.current.style.height = `${element.current.scrollHeight.toString()}px`;\n }\n }\n };\n\n const debouncedAutoResize = debounce(autoResize, 100);\n\n return [element, debouncedAutoResize];\n};\n\nexport default useAutoResize;\n"]}
1
+ {"version":3,"file":"useAutoResize.js","sourceRoot":"","sources":["../../src/hooks/useAutoResize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAa,MAAM,OAAO,CAAC;AAEpD,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC;;;;;;;GAOG;AACH,MAAM,aAAa,GAAG,CACpB,SAAkB,EAClB,aAAsB,EACM,EAAE;IAC9B,MAAM,OAAO,GAAG,MAAM,CAAI,IAAI,CAAC,CAAC;IAEhC,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,aAAa,IAAI,CAAC,CAAC,CAAC;IAE/D,MAAM,UAAU,GAAG,GAAG,EAAE;QACtB,IAAI,OAAO,CAAC,OAAO,EAAE;YACnB,IAAI,YAAY,GAAG,SAAS,CAAC;YAC7B,IAAI,CAAC,SAAS,EAAE;gBACd,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC;gBAC5C,YAAY,CAAC,YAAY,CAAC,CAAC;aAC5B;YACD,qGAAqG;YACrG,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG,YAAY,IAAI,CAAC;YAEnD,IAAI,SAAS,EAAE;gBACb,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS;oBAC7B,OAAO,CAAC,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC;gBAC/D,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,EAAE,SAAS,CAAC,IAAI,CAAC;aACzF;iBAAM;gBACL,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,YAAY,IAAI,CAAC;aACpE;SACF;IACH,CAAC,CAAC;IAEF,MAAM,mBAAmB,GAAG,QAAQ,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;IAEtD,OAAO,CAAC,OAAO,EAAE,mBAAmB,CAAC,CAAC;AACxC,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import { useRef, useState, RefObject } from 'react';\n\nimport { debounce } from '../utils';\n\n/**\n * @example const [ref, resizeFunction] = useAutoResize();\n * maxHeight should be provided in pixels without units\n * minHeight should be provided in pixels without units\n * @returns * ref:: A reference for the element that the resize functionality should be applied to. [React RefObject](https://reactjs.org/docs/refs-and-the-dom.html)\n * * resizeFunction:: The function to call to automatically resize the element.\n * element refers to auto resizable element\n */\nconst useAutoResize = <T extends HTMLElement = HTMLElement>(\n maxHeight?: number,\n minHeightProp?: number\n): [RefObject<T>, () => void] => {\n const element = useRef<T>(null);\n\n const [minHeight, setMinHeight] = useState(minHeightProp || 0);\n\n const autoResize = () => {\n if (element.current) {\n let newMinHeight = minHeight;\n if (!minHeight) {\n newMinHeight = element.current.scrollHeight;\n setMinHeight(newMinHeight);\n }\n // Reset the heights to the base height so there is an overflow / or none to calculate the new height\n element.current.style.height = `${newMinHeight}px`;\n\n if (maxHeight) {\n element.current.style.overflowY =\n element.current.scrollHeight > maxHeight ? 'auto' : 'hidden';\n element.current.style.height = `${Math.min(element.current.scrollHeight, maxHeight)}px`;\n } else {\n element.current.style.height = `${element.current.scrollHeight}px`;\n }\n }\n };\n\n const debouncedAutoResize = debounce(autoResize, 100);\n\n return [element, debouncedAutoResize];\n};\n\nexport default useAutoResize;\n"]}
@@ -10,7 +10,6 @@ import useTheme from './useTheme';
10
10
  const useBreakpoint = (breakpoint, options = {
11
11
  defaultValue: false
12
12
  }) => {
13
- var _a;
14
13
  const { base: { breakpoints } } = useTheme();
15
14
  const breakpointVal = breakpoints[breakpoint];
16
15
  const [matches, setMatches] = useState(windowIsAvailable
@@ -24,8 +23,7 @@ const useBreakpoint = (breakpoint, options = {
24
23
  if (options.breakpointRef && options.breakpointRef.current) {
25
24
  const observer = new ResizeObserver(entries => {
26
25
  const matchesBreakpoint = entries.some(({ target, contentRect }) => {
27
- var _a;
28
- if (target !== ((_a = options.breakpointRef) === null || _a === void 0 ? void 0 : _a.current))
26
+ if (target !== options.breakpointRef?.current)
29
27
  return;
30
28
  return contentRect.width >= parseFloat(breakpointVal) * 16;
31
29
  });
@@ -61,7 +59,7 @@ const useBreakpoint = (breakpoint, options = {
61
59
  }
62
60
  };
63
61
  }
64
- }, [(_a = options.breakpointRef) === null || _a === void 0 ? void 0 : _a.current]);
62
+ }, [options.breakpointRef?.current]);
65
63
  return matches;
66
64
  };
67
65
  export default useBreakpoint;
@@ -1 +1 @@
1
- {"version":3,"file":"useBreakpoint.js","sourceRoot":"","sources":["../../src/hooks/useBreakpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,WAAW,EAAa,MAAM,OAAO,CAAC;AAE1E,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEvD,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC;;;;;GAKG;AACH,MAAM,aAAa,GAAG,CACpB,UAA4C,EAC5C,UAAsF;IACpF,YAAY,EAAE,KAAK;CACpB,EACD,EAAE;;IACF,MAAM,EACJ,IAAI,EAAE,EAAE,WAAW,EAAE,EACtB,GAAG,QAAQ,EAAE,CAAC;IACf,MAAM,aAAa,GAAG,WAAW,CAAC,UAAU,CAAC,CAAC;IAC9C,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CACpC,iBAAiB;QACf,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,eAAe,aAAa,GAA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CAAC;YAC/D,CAAC,EAAE,GAAG,CAAC,CAAC;YAER,iEAAiE;YACjE,IAAI,mBAAmB,EAAE;gBACvB,UAAU,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;gBAChD,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;aAChC;iBAAM;gBACL,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;gBACjD,UAAU,CAAC,MAAM,CAAC,UAAU,IAAI,QAAQ,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC,CAAC;aAC9D;YAED,OAAO,GAAG,EAAE;gBACV,iEAAiE;gBACjE,IAAI,mBAAmB;oBAAE,UAAU,CAAC,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;qBACvE;oBACH,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;iBACrD;YACH,CAAC,CAAC;SACH;IACH,CAAC,EAAE,CAAC,MAAA,OAAO,CAAC,aAAa,0CAAE,OAAO,CAAC,CAAC,CAAC;IAErC,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import { useState, useLayoutEffect, useCallback, RefObject } from 'react';\n\nimport { windowIsAvailable, debounce } from '../utils';\n\nimport useTheme from './useTheme';\n\n/**\n * @example const breakpointActive = useBreakpoint(breakpoint);\n * @param breakpoint The string indicator for the breakpoint that should be checked for validity.\n * @param options\n * @returns breakpointActive:: A boolean indicating if the given breakpoint is active or not. If false, the breakpoint is too big for the screen size.\n */\nconst useBreakpoint = (\n breakpoint: 'xs' | 'sm' | 'md' | 'lg' | 'xl',\n options: { defaultValue?: boolean; breakpointRef?: RefObject<Element> | undefined } = {\n defaultValue: false\n }\n) => {\n const {\n base: { breakpoints }\n } = useTheme();\n const breakpointVal = breakpoints[breakpoint];\n const [matches, setMatches] = useState(\n windowIsAvailable\n ? window.matchMedia(`(min-width: ${breakpointVal})`).matches\n : !!options.defaultValue\n );\n\n const onResize = useCallback((e: MediaQueryListEvent) => {\n setMatches(e.matches);\n }, []);\n\n useLayoutEffect(() => {\n // Breakpoint handling for contained elements\n if (options.breakpointRef && options.breakpointRef.current) {\n const observer = new ResizeObserver(entries => {\n const matchesBreakpoint = entries.some(({ target, contentRect }) => {\n if (target !== options.breakpointRef?.current) return;\n\n return contentRect.width >= parseFloat(breakpointVal) * 16;\n });\n\n setMatches(matchesBreakpoint);\n });\n\n observer.observe(options.breakpointRef.current);\n\n return () => {\n observer.disconnect();\n };\n }\n // Breakpoint handling for viewport\n if (windowIsAvailable) {\n const mediaMatch = window.matchMedia(`(min-width: ${breakpointVal})`);\n const mediaMatchAvailable = 'addEventListener' in mediaMatch;\n const resizeHandler = debounce(() => {\n setMatches(window.innerWidth >= parseInt(breakpointVal, 10));\n }, 100);\n\n // Need to check useMatchMedia in order to support Enzyme testing\n if (mediaMatchAvailable) {\n mediaMatch.addEventListener('change', onResize);\n setMatches(mediaMatch.matches);\n } else {\n window.addEventListener('resize', resizeHandler);\n setMatches(window.innerWidth >= parseInt(breakpointVal, 10));\n }\n\n return () => {\n // Need to check useMatchMedia in order to support Enzyme testing\n if (mediaMatchAvailable) mediaMatch.removeEventListener('change', onResize);\n else {\n window.removeEventListener('resize', resizeHandler);\n }\n };\n }\n }, [options.breakpointRef?.current]);\n\n return matches;\n};\n\nexport default useBreakpoint;\n"]}
1
+ {"version":3,"file":"useBreakpoint.js","sourceRoot":"","sources":["../../src/hooks/useBreakpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,WAAW,EAAa,MAAM,OAAO,CAAC;AAE1E,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEvD,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC;;;;;GAKG;AACH,MAAM,aAAa,GAAG,CACpB,UAA4C,EAC5C,UAAsF;IACpF,YAAY,EAAE,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ACrB,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,eAAe,aAAa,GAAG,CAAC,CAAC;YACtE,MAAM,mBAAmB,GAAG,kBAAkB,IAAI,UAAU,CAAC;YAC7D,MAAM,aAAa,GAAG,QAAQ,CAAC,GAAG,EAAE;gBAClC,UAAU,CAAC,MAAM,CAAC,UAAU,IAAI,QAAQ,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC,CAAC;YAC/D,CAAC,EAAE,GAAG,CAAC,CAAC;YAER,iEAAiE;YACjE,IAAI,mBAAmB,EAAE;gBACvB,UAAU,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;gBAChD,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;aAChC;iBAAM;gBACL,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;gBACjD,UAAU,CAAC,MAAM,CAAC,UAAU,IAAI,QAAQ,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC,CAAC;aAC9D;YAED,OAAO,GAAG,EAAE;gBACV,iEAAiE;gBACjE,IAAI,mBAAmB;oBAAE,UAAU,CAAC,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;qBACvE;oBACH,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;iBACrD;YACH,CAAC,CAAC;SACH;IACH,CAAC,EAAE,CAAC,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC;IAErC,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import { useState, useLayoutEffect, useCallback, RefObject } from 'react';\n\nimport { windowIsAvailable, debounce } from '../utils';\n\nimport useTheme from './useTheme';\n\n/**\n * @example const breakpointActive = useBreakpoint(breakpoint);\n * @param breakpoint The string indicator for the breakpoint that should be checked for validity.\n * @param options\n * @returns breakpointActive:: A boolean indicating if the given breakpoint is active or not. If false, the breakpoint is too big for the screen size.\n */\nconst useBreakpoint = (\n breakpoint: 'xs' | 'sm' | 'md' | 'lg' | 'xl',\n options: { defaultValue?: boolean; breakpointRef?: RefObject<Element> | undefined } = {\n defaultValue: false\n }\n) => {\n const {\n base: { breakpoints }\n } = useTheme();\n const breakpointVal = breakpoints[breakpoint];\n const [matches, setMatches] = useState(\n windowIsAvailable\n ? window.matchMedia(`(min-width: ${breakpointVal})`).matches\n : !!options.defaultValue\n );\n\n const onResize = useCallback((e: MediaQueryListEvent) => {\n setMatches(e.matches);\n }, []);\n\n useLayoutEffect(() => {\n // Breakpoint handling for contained elements\n if (options.breakpointRef && options.breakpointRef.current) {\n const observer = new ResizeObserver(entries => {\n const matchesBreakpoint = entries.some(({ target, contentRect }) => {\n if (target !== options.breakpointRef?.current) return;\n\n return contentRect.width >= parseFloat(breakpointVal) * 16;\n });\n\n setMatches(matchesBreakpoint);\n });\n\n observer.observe(options.breakpointRef.current);\n\n return () => {\n observer.disconnect();\n };\n }\n // Breakpoint handling for viewport\n if (windowIsAvailable) {\n const mediaMatch = window.matchMedia(`(min-width: ${breakpointVal})`);\n const mediaMatchAvailable = 'addEventListener' in mediaMatch;\n const resizeHandler = debounce(() => {\n setMatches(window.innerWidth >= parseInt(breakpointVal, 10));\n }, 100);\n\n // Need to check useMatchMedia in order to support Enzyme testing\n if (mediaMatchAvailable) {\n mediaMatch.addEventListener('change', onResize);\n setMatches(mediaMatch.matches);\n } else {\n window.addEventListener('resize', resizeHandler);\n setMatches(window.innerWidth >= parseInt(breakpointVal, 10));\n }\n\n return () => {\n // Need to check useMatchMedia in order to support Enzyme testing\n if (mediaMatchAvailable) mediaMatch.removeEventListener('change', onResize);\n else {\n window.removeEventListener('resize', resizeHandler);\n }\n };\n }\n }, [options.breakpointRef?.current]);\n\n return matches;\n};\n\nexport default useBreakpoint;\n"]}
@@ -0,0 +1,8 @@
1
+ import { RefObject } from 'react';
2
+ /**
3
+ * @param draggableElementRef Reference to the element which is draggable.
4
+ * @param dragHandleRef Reference to the handle element which allows to move draggableElementRef.
5
+ */
6
+ declare const useDraggable: (draggableElementRef: RefObject<HTMLElement>, dragHandleRef: RefObject<HTMLElement>) => void;
7
+ export default useDraggable;
8
+ //# sourceMappingURL=useDraggable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDraggable.d.ts","sourceRoot":"","sources":["../../src/hooks/useDraggable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,SAAS,EAAE,MAAM,OAAO,CAAC;AAYvD;;;GAGG;AACH,QAAA,MAAM,YAAY,wBACK,UAAU,WAAW,CAAC,iBAC5B,UAAU,WAAW,CAAC,SA4DtC,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -0,0 +1,64 @@
1
+ import { useState, useEffect } from 'react';
2
+ const initialDraggableElPosition = { x: 0, y: 0 };
3
+ const interactiveElementsTags = ['button', 'a', 'input', 'textarea', 'select', 'details'];
4
+ const shouldIgnoreEvent = (event) => {
5
+ return interactiveElementsTags.some(tag => event.target instanceof Element && event.target.tagName.toLowerCase() === tag);
6
+ };
7
+ /**
8
+ * @param draggableElementRef Reference to the element which is draggable.
9
+ * @param dragHandleRef Reference to the handle element which allows to move draggableElementRef.
10
+ */
11
+ const useDraggable = (draggableElementRef, dragHandleRef) => {
12
+ const [dragging, setDragging] = useState(false);
13
+ useEffect(() => {
14
+ const onMouseDown = (event) => {
15
+ if (shouldIgnoreEvent(event))
16
+ return;
17
+ setDragging(true);
18
+ if (draggableElementRef.current) {
19
+ const { clientX, clientY } = 'touches' in event ? event.touches[0] : event;
20
+ initialDraggableElPosition.x =
21
+ clientX - draggableElementRef.current.getBoundingClientRect().left;
22
+ initialDraggableElPosition.y =
23
+ clientY - draggableElementRef.current.getBoundingClientRect().top;
24
+ }
25
+ };
26
+ if (dragHandleRef.current) {
27
+ // Save the current value so we can properly remove event listener after the ref has changed.
28
+ const { current } = dragHandleRef;
29
+ current.addEventListener('mousedown', onMouseDown);
30
+ current.addEventListener('touchstart', onMouseDown);
31
+ return () => {
32
+ current.removeEventListener('mousedown', onMouseDown);
33
+ current.removeEventListener('touchstart', onMouseDown);
34
+ };
35
+ }
36
+ }, [dragHandleRef?.current]);
37
+ useEffect(() => {
38
+ const onMouseMove = (event) => {
39
+ if (!dragging)
40
+ return;
41
+ if (draggableElementRef && draggableElementRef.current) {
42
+ const { clientX, clientY } = 'touches' in event ? event.touches[0] : event;
43
+ draggableElementRef.current.style.transform = `translate(${clientX - draggableElementRef.current.offsetLeft - initialDraggableElPosition.x}px, ${clientY - draggableElementRef.current.offsetTop - initialDraggableElPosition.y}px)`;
44
+ }
45
+ };
46
+ const onMouseUp = () => {
47
+ setDragging(false);
48
+ };
49
+ if (dragging) {
50
+ document.addEventListener('mouseup', onMouseUp);
51
+ document.addEventListener('touchend', onMouseUp);
52
+ document.addEventListener('mousemove', onMouseMove);
53
+ document.addEventListener('touchmove', onMouseMove);
54
+ return () => {
55
+ document.removeEventListener('mouseup', onMouseUp);
56
+ document.removeEventListener('touchend', onMouseUp);
57
+ document.removeEventListener('mousemove', onMouseMove);
58
+ document.removeEventListener('touchmove', onMouseMove);
59
+ };
60
+ }
61
+ }, [dragging]);
62
+ };
63
+ export default useDraggable;
64
+ //# sourceMappingURL=useDraggable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDraggable.js","sourceRoot":"","sources":["../../src/hooks/useDraggable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAa,MAAM,OAAO,CAAC;AAEvD,MAAM,0BAA0B,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AAElD,MAAM,uBAAuB,GAAG,CAAC,QAAQ,EAAE,GAAG,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;AAE1F,MAAM,iBAAiB,GAAG,CAAC,KAA8B,EAAW,EAAE;IACpE,OAAO,uBAAuB,CAAC,IAAI,CACjC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AC;gBACpD,QAAQ,CAAC,mBAAmB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;gBACvD,QAAQ,CAAC,mBAAmB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;YACzD,CAAC,CAAC;SACH;IACH,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;AACjB,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import { useState, useEffect, RefObject } from 'react';\n\nconst initialDraggableElPosition = { x: 0, y: 0 };\n\nconst interactiveElementsTags = ['button', 'a', 'input', 'textarea', 'select', 'details'];\n\nconst shouldIgnoreEvent = (event: MouseEvent | TouchEvent): boolean => {\n return interactiveElementsTags.some(\n tag => event.target instanceof Element && event.target.tagName.toLowerCase() === tag\n );\n};\n\n/**\n * @param draggableElementRef Reference to the element which is draggable.\n * @param dragHandleRef Reference to the handle element which allows to move draggableElementRef.\n */\nconst useDraggable = (\n draggableElementRef: RefObject<HTMLElement>,\n dragHandleRef: RefObject<HTMLElement>\n) => {\n const [dragging, setDragging] = useState(false);\n\n useEffect(() => {\n const onMouseDown = (event: MouseEvent | TouchEvent): void => {\n if (shouldIgnoreEvent(event)) return;\n setDragging(true);\n if (draggableElementRef.current) {\n const { clientX, clientY } = 'touches' in event ? event.touches[0] : event;\n initialDraggableElPosition.x =\n clientX - draggableElementRef.current.getBoundingClientRect().left;\n initialDraggableElPosition.y =\n clientY - draggableElementRef.current.getBoundingClientRect().top;\n }\n };\n\n if (dragHandleRef.current) {\n // Save the current value so we can properly remove event listener after the ref has changed.\n const { current } = dragHandleRef;\n\n current.addEventListener('mousedown', onMouseDown);\n current.addEventListener('touchstart', onMouseDown);\n\n return () => {\n current.removeEventListener('mousedown', onMouseDown);\n current.removeEventListener('touchstart', onMouseDown);\n };\n }\n }, [dragHandleRef?.current]);\n\n useEffect(() => {\n const onMouseMove = (event: MouseEvent | TouchEvent): void => {\n if (!dragging) return;\n if (draggableElementRef && draggableElementRef.current) {\n const { clientX, clientY } = 'touches' in event ? event.touches[0] : event;\n draggableElementRef.current.style.transform = `translate(${\n clientX - draggableElementRef.current.offsetLeft - initialDraggableElPosition.x\n }px, ${clientY - draggableElementRef.current.offsetTop - initialDraggableElPosition.y}px)`;\n }\n };\n\n const onMouseUp = (): void => {\n setDragging(false);\n };\n\n if (dragging) {\n document.addEventListener('mouseup', onMouseUp);\n document.addEventListener('touchend', onMouseUp);\n document.addEventListener('mousemove', onMouseMove);\n document.addEventListener('touchmove', onMouseMove);\n\n return () => {\n document.removeEventListener('mouseup', onMouseUp);\n document.removeEventListener('touchend', onMouseUp);\n document.removeEventListener('mousemove', onMouseMove);\n document.removeEventListener('touchmove', onMouseMove);\n };\n }\n }, [dragging]);\n};\n\nexport default useDraggable;\n"]}
@@ -4,6 +4,6 @@ import { RefObject } from 'react';
4
4
  * @param onFocusChange Callback function that is invoked with the current focus state and the current element when any child elements takes focus or all of them lose focus.
5
5
  * @returns * hasFocus:: A boolean indicating if the ref element has focus or not.
6
6
  */
7
- declare const useFocusWithin: <T extends Element = Element>(els: (T | RefObject<T | null> | null)[], onFocusChange?: ((isFocused: boolean, element: T | null) => void) | undefined) => boolean;
7
+ declare const useFocusWithin: <T extends HTMLElement = HTMLElement>(els: (T | RefObject<T | null> | null)[], onFocusChange?: ((isFocused: boolean, element: T | null) => void) | undefined) => boolean;
8
8
  export default useFocusWithin;
9
9
  //# sourceMappingURL=useFocusWithin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useFocusWithin.d.ts","sourceRoot":"","sources":["../../src/hooks/useFocusWithin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,SAAS,EAAuB,MAAM,OAAO,CAAC;AAM5E;;;;GAIG;AACH,QAAA,MAAM,cAAc,sGAEU,OAAO,wBAAwB,IAAI,kBAC9D,OA8EF,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"useFocusWithin.d.ts","sourceRoot":"","sources":["../../src/hooks/useFocusWithin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,SAAS,EAAuB,MAAM,OAAO,CAAC;AAM5E;;;;GAIG;AACH,QAAA,MAAM,cAAc,8GAEU,OAAO,wBAAwB,IAAI,kBAC9D,OA0FF,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -9,61 +9,66 @@ import useOuterEvent from './useOuterEvent';
9
9
  const useFocusWithin = (els, onFocusChange) => {
10
10
  const [hasFocus, setFocus] = useState(false);
11
11
  const focusedElRef = useRef(null);
12
+ const blurTimerRef = useRef();
12
13
  const elsRef = useRef(els);
13
14
  elsRef.current = els;
14
- const onBlur = useCallback((e) => {
15
+ const onBlur = useCallback(({ relatedTarget }) => {
15
16
  if (!hasFocus)
16
17
  return;
17
18
  const elements = normalizeElements(elsRef.current);
18
- // changing focus to another relevant child doesn't count
19
- const focusedEl = elements.find(el => el === null || el === void 0 ? void 0 : el.contains(e.relatedTarget));
20
- if (focusedEl) {
21
- // ... just update the currently focused item
22
- focusedElRef.current = focusedEl;
23
- return;
19
+ if (relatedTarget instanceof Node) {
20
+ // changing focus to another relevant child doesn't count
21
+ const focusedEl = elements.find(el => el?.contains(relatedTarget));
22
+ if (focusedEl) {
23
+ // ... just update the currently focused item
24
+ focusedElRef.current = focusedEl;
25
+ return;
26
+ }
24
27
  }
25
- const timerId = setTimeout(() => {
28
+ clearTimeout(blurTimerRef.current);
29
+ blurTimerRef.current = setTimeout(() => {
26
30
  if (!elements.some(el => {
27
- return el === null || el === void 0 ? void 0 : el.contains(document.activeElement);
31
+ return el?.contains(document.activeElement);
28
32
  })) {
29
33
  setFocus(false);
30
- onFocusChange === null || onFocusChange === void 0 ? void 0 : onFocusChange(false, focusedElRef.current);
34
+ onFocusChange?.(false, focusedElRef.current);
31
35
  focusedElRef.current = null;
32
36
  }
33
37
  });
34
- return () => {
35
- if (timerId)
36
- clearTimeout(timerId);
37
- };
38
38
  }, [hasFocus, onFocusChange]);
39
- const onFocus = useCallback((e) => {
39
+ const onFocus = useCallback(({ currentTarget }) => {
40
+ clearTimeout(blurTimerRef.current);
40
41
  if (!hasFocus) {
41
42
  setFocus(true);
42
- const targetEl = e.currentTarget;
43
- onFocusChange === null || onFocusChange === void 0 ? void 0 : onFocusChange(true, targetEl);
43
+ const targetEl = currentTarget;
44
+ onFocusChange?.(true, targetEl);
44
45
  focusedElRef.current = targetEl;
45
46
  }
46
47
  }, [hasFocus, onFocusChange]);
47
48
  useOuterEvent('mouseup', els, useCallback(() => {
48
49
  if (hasFocus) {
49
50
  setFocus(false);
50
- onFocusChange === null || onFocusChange === void 0 ? void 0 : onFocusChange(false, focusedElRef.current);
51
+ onFocusChange?.(false, focusedElRef.current);
51
52
  focusedElRef.current = null;
52
53
  }
53
54
  }, [onFocusChange, hasFocus]));
54
55
  useEffect(() => {
55
56
  const elements = normalizeElements(els);
56
- elements.forEach((el) => {
57
- el === null || el === void 0 ? void 0 : el.addEventListener('focusin', onFocus);
58
- el === null || el === void 0 ? void 0 : el.addEventListener('focusout', onBlur);
57
+ elements.forEach(el => {
58
+ el?.addEventListener('focusin', onFocus);
59
+ el?.addEventListener('focusout', onBlur);
59
60
  });
60
61
  return () => {
61
- elements.forEach((el) => {
62
- el === null || el === void 0 ? void 0 : el.removeEventListener('focusin', onFocus);
63
- el === null || el === void 0 ? void 0 : el.removeEventListener('focusout', onBlur);
62
+ elements.forEach(el => {
63
+ el?.removeEventListener('focusin', onFocus);
64
+ el?.removeEventListener('focusout', onBlur);
64
65
  });
65
66
  };
66
67
  }, [els, onFocus, onBlur]);
68
+ // Clear timeout when component un-mounts.
69
+ useEffect(() => () => {
70
+ clearTimeout(blurTimerRef.current);
71
+ }, []);
67
72
  return hasFocus;
68
73
  };
69
74
  export default useFocusWithin;