@pega/cosmos-react-core 8.0.0-build.4.3 → 8.0.0-build.4.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 (472) hide show
  1. package/lib/components/Actions/Actions.js.map +1 -1
  2. package/lib/components/AppShell/AppHeader.js.map +1 -1
  3. package/lib/components/AppShell/AppHeader.styles.d.ts +1 -1
  4. package/lib/components/AppShell/AppShell.js.map +1 -1
  5. package/lib/components/AppShell/AppShell.styles.d.ts +2 -2
  6. package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
  7. package/lib/components/AppShell/AppShell.styles.js.map +1 -1
  8. package/lib/components/AppShell/AppShellList.js.map +1 -1
  9. package/lib/components/AppShell/AppShellList.styles.d.ts +4 -4
  10. package/lib/components/AppShell/AppShellList.styles.d.ts.map +1 -1
  11. package/lib/components/AppShell/AppShellList.styles.js.map +1 -1
  12. package/lib/components/AppShell/AppShellSearch.js.map +1 -1
  13. package/lib/components/AppShell/AppShellSearch.styles.js.map +1 -1
  14. package/lib/components/AppShell/Drawer.js.map +1 -1
  15. package/lib/components/AppShell/NavigationList.js.map +1 -1
  16. package/lib/components/AppShell/NavigationListItemWrapper.js.map +1 -1
  17. package/lib/components/AppShell/Operator.d.ts +3 -3
  18. package/lib/components/AppShell/Operator.d.ts.map +1 -1
  19. package/lib/components/AppShell/Operator.js.map +1 -1
  20. package/lib/components/AppShell/style-utils.d.ts.map +1 -1
  21. package/lib/components/AppShell/style-utils.js.map +1 -1
  22. package/lib/components/AppShell/utils.d.ts.map +1 -1
  23. package/lib/components/AppShell/utils.js.map +1 -1
  24. package/lib/components/Avatar/Avatar.d.ts +5 -5
  25. package/lib/components/Avatar/Avatar.d.ts.map +1 -1
  26. package/lib/components/Avatar/Avatar.js.map +1 -1
  27. package/lib/components/Avatar/Avatar.test-ids.d.ts +1 -1
  28. package/lib/components/Avatar/Avatar.test-ids.d.ts.map +1 -1
  29. package/lib/components/Backdrop/Backdrop.d.ts +2 -2
  30. package/lib/components/Backdrop/Backdrop.js.map +1 -1
  31. package/lib/components/Backdrop/Backdrop.test-ids.d.ts +1 -1
  32. package/lib/components/Backdrop/Backdrop.test-ids.d.ts.map +1 -1
  33. package/lib/components/Badges/Alert.d.ts +2 -5
  34. package/lib/components/Badges/Alert.d.ts.map +1 -1
  35. package/lib/components/Badges/Badges.test-ids.d.ts +6 -6
  36. package/lib/components/Badges/Badges.test-ids.d.ts.map +1 -1
  37. package/lib/components/Badges/Count.d.ts +1 -1
  38. package/lib/components/Badges/Count.js +6 -6
  39. package/lib/components/Badges/Count.js.map +1 -1
  40. package/lib/components/Badges/Keyboard.d.ts +1 -1
  41. package/lib/components/Badges/Selection.d.ts +1 -1
  42. package/lib/components/Badges/Selection.js.map +1 -1
  43. package/lib/components/Badges/Status.d.ts +1 -1
  44. package/lib/components/Badges/Tag.d.ts +1 -1
  45. package/lib/components/Banner/Banner.d.ts +3 -3
  46. package/lib/components/Banner/Banner.d.ts.map +1 -1
  47. package/lib/components/Banner/Banner.js.map +1 -1
  48. package/lib/components/Banner/Banner.test-ids.d.ts +1 -1
  49. package/lib/components/Banner/Banner.test-ids.d.ts.map +1 -1
  50. package/lib/components/Breadcrumbs/Breadcrumbs.js.map +1 -1
  51. package/lib/components/Button/BareButton.js.map +1 -1
  52. package/lib/components/Button/BareRoleButton.js.map +1 -1
  53. package/lib/components/Button/Button.js.map +1 -1
  54. package/lib/components/ColorPicker/ColorPicker.d.ts +1 -1
  55. package/lib/components/ColorPicker/ColorPicker.js.map +1 -1
  56. package/lib/components/ColorPicker/ColorPicker.test-ids.d.ts +1 -1
  57. package/lib/components/ColorPicker/ColorPicker.test-ids.d.ts.map +1 -1
  58. package/lib/components/ComboBox/ComboBox.d.ts +1 -1
  59. package/lib/components/ComboBox/ComboBox.js.map +1 -1
  60. package/lib/components/ComboBox/ComboBox.styles.d.ts +1 -1
  61. package/lib/components/ComboBox/ComboxBox.test-ids.d.ts +1 -1
  62. package/lib/components/ComboBox/ComboxBox.test-ids.d.ts.map +1 -1
  63. package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js.map +1 -1
  64. package/lib/components/CompositeInput/CompositeInput.d.ts +1 -1
  65. package/lib/components/CompositeInput/CompositeInput.d.ts.map +1 -1
  66. package/lib/components/CompositeInput/CompositeInput.js.map +1 -1
  67. package/lib/components/CompositeInput/CompositeInput.test-ids.d.ts +1 -1
  68. package/lib/components/CompositeInput/CompositeInput.test-ids.d.ts.map +1 -1
  69. package/lib/components/Configuration/Configuration.js.map +1 -1
  70. package/lib/components/Configuration/connected-watcher.js.map +1 -1
  71. package/lib/components/Configuration/withConfiguration.d.ts.map +1 -1
  72. package/lib/components/CreditCard/CreditCardInput.d.ts +10 -13
  73. package/lib/components/CreditCard/CreditCardInput.d.ts.map +1 -1
  74. package/lib/components/CreditCard/CreditCardInput.js.map +1 -1
  75. package/lib/components/CreditCard/utils.js.map +1 -1
  76. package/lib/components/Currency/Currency.test-ids.d.ts +1 -1
  77. package/lib/components/Currency/Currency.test-ids.d.ts.map +1 -1
  78. package/lib/components/Currency/CurrencyDisplay.js.map +1 -1
  79. package/lib/components/Currency/CurrencyInput.d.ts +1 -1
  80. package/lib/components/Currency/CurrencyInput.js.map +1 -1
  81. package/lib/components/Currency/utils.d.ts +3 -3
  82. package/lib/components/Currency/utils.d.ts.map +1 -1
  83. package/lib/components/Currency/utils.js +1 -1
  84. package/lib/components/Currency/utils.js.map +1 -1
  85. package/lib/components/DateTime/DateTime.test-ids.d.ts +11 -11
  86. package/lib/components/DateTime/DateTime.test-ids.d.ts.map +1 -1
  87. package/lib/components/DateTime/Input/DateInput.d.ts +1 -1
  88. package/lib/components/DateTime/Input/DateInput.js.map +1 -1
  89. package/lib/components/DateTime/Input/DateRangeInput.d.ts +1 -1
  90. package/lib/components/DateTime/Input/DateRangeInput.js.map +1 -1
  91. package/lib/components/DateTime/Input/DateTime.styles.d.ts +2 -2
  92. package/lib/components/DateTime/Input/DateTimeInput.d.ts +1 -1
  93. package/lib/components/DateTime/Input/DateTimeInput.d.ts.map +1 -1
  94. package/lib/components/DateTime/Input/DateTimeInput.js.map +1 -1
  95. package/lib/components/DateTime/Input/DayOfWeekInput.d.ts +1 -1
  96. package/lib/components/DateTime/Input/DayOfWeekInput.js.map +1 -1
  97. package/lib/components/DateTime/Input/Duration/DurationInput.d.ts +1 -1
  98. package/lib/components/DateTime/Input/Duration/NumberUnit.js.map +1 -1
  99. package/lib/components/DateTime/Input/Duration/Time.js.map +1 -1
  100. package/lib/components/DateTime/Input/MonthInput.d.ts +1 -1
  101. package/lib/components/DateTime/Input/MonthInput.js.map +1 -1
  102. package/lib/components/DateTime/Input/PartInput.js.map +1 -1
  103. package/lib/components/DateTime/Input/QuarterInput.d.ts +1 -1
  104. package/lib/components/DateTime/Input/QuarterInput.js.map +1 -1
  105. package/lib/components/DateTime/Input/TimeInput.d.ts +1 -1
  106. package/lib/components/DateTime/Input/TimeInput.js.map +1 -1
  107. package/lib/components/DateTime/Input/TimeRangeInput.d.ts +1 -1
  108. package/lib/components/DateTime/Input/WeekInput.d.ts +1 -1
  109. package/lib/components/DateTime/Input/WeekInput.js.map +1 -1
  110. package/lib/components/DateTime/Input/useAutoFocusNextInput.d.ts.map +1 -1
  111. package/lib/components/DateTime/Input/useAutoFocusNextInput.js.map +1 -1
  112. package/lib/components/DateTime/Input/usePickerButton.d.ts.map +1 -1
  113. package/lib/components/DateTime/Input/usePickerButton.js.map +1 -1
  114. package/lib/components/DateTime/Input/utils.d.ts +2 -2
  115. package/lib/components/DateTime/Input/utils.d.ts.map +1 -1
  116. package/lib/components/DateTime/Input/utils.js.map +1 -1
  117. package/lib/components/DateTime/Picker/Calendar.js.map +1 -1
  118. package/lib/components/DateTime/Picker/DatePicker.d.ts +1 -1
  119. package/lib/components/DateTime/Picker/DatePicker.d.ts.map +1 -1
  120. package/lib/components/DateTime/Picker/DatePicker.js +4 -2
  121. package/lib/components/DateTime/Picker/DatePicker.js.map +1 -1
  122. package/lib/components/DateTime/Picker/DateRangePicker.js.map +1 -1
  123. package/lib/components/DateTime/Picker/TimePicker.js.map +1 -1
  124. package/lib/components/DateTime/Picker/Weeks.js.map +1 -1
  125. package/lib/components/DateTime/Picker/utils.d.ts +1 -1
  126. package/lib/components/DateTime/Picker/utils.js.map +1 -1
  127. package/lib/components/DateTime/utils.js.map +1 -1
  128. package/lib/components/Dialog/Dialog.styles.d.ts +1 -1
  129. package/lib/components/Dialog/Dialog.styles.d.ts.map +1 -1
  130. package/lib/components/Dialog/FormDialog.d.ts +2 -2
  131. package/lib/components/Dialog/FormDialog.js.map +1 -1
  132. package/lib/components/Dialog/InfoDialog.js.map +1 -1
  133. package/lib/components/Dialog/InfoDialog.styles.d.ts +2 -2
  134. package/lib/components/Drawer/Drawer.js.map +1 -1
  135. package/lib/components/EmojiPicker/EmojiDisplay.js.map +1 -1
  136. package/lib/components/EmojiPicker/EmojiPicker.js.map +1 -1
  137. package/lib/components/ExpandCollapse/ExpandCollapse.js.map +1 -1
  138. package/lib/components/FieldGroup/FieldGroup.d.ts +2 -2
  139. package/lib/components/FieldGroup/FieldGroup.d.ts.map +1 -1
  140. package/lib/components/FieldGroup/FieldGroupList.js.map +1 -1
  141. package/lib/components/FieldValueList/FieldValueList.d.ts +2 -2
  142. package/lib/components/FieldValueList/FieldValueList.js.map +1 -1
  143. package/lib/components/FieldValueList/FieldValueList.test-ids.d.ts +2 -2
  144. package/lib/components/FieldValueList/FieldValueList.test-ids.d.ts.map +1 -1
  145. package/lib/components/File/File.test-ids.d.ts +1 -1
  146. package/lib/components/File/File.test-ids.d.ts.map +1 -1
  147. package/lib/components/File/FileDisplay.js.map +1 -1
  148. package/lib/components/File/FileInput.d.ts +1 -1
  149. package/lib/components/File/FileInput.js.map +1 -1
  150. package/lib/components/File/FileInput.styles.d.ts +6 -6
  151. package/lib/components/File/FileItem.d.ts +2 -2
  152. package/lib/components/File/FileItem.js.map +1 -1
  153. package/lib/components/File/FileList.d.ts +1 -1
  154. package/lib/components/File/FileList.d.ts.map +1 -1
  155. package/lib/components/File/FileList.js.map +1 -1
  156. package/lib/components/File/FileUploadItem.js.map +1 -1
  157. package/lib/components/File/FileVisual.js.map +1 -1
  158. package/lib/components/Flex/Flex.d.ts +1 -1
  159. package/lib/components/Flex/Flex.d.ts.map +1 -1
  160. package/lib/components/Flex/Flex.js.map +1 -1
  161. package/lib/components/Form/Form.d.ts +1 -1
  162. package/lib/components/Form/Form.test-ids.d.ts +1 -1
  163. package/lib/components/Form/Form.test-ids.d.ts.map +1 -1
  164. package/lib/components/FormControl/FormControl.d.ts +1 -1
  165. package/lib/components/FormControl/FormControl.d.ts.map +1 -1
  166. package/lib/components/FormField/FormField.d.ts +1 -1
  167. package/lib/components/FormField/FormField.js.map +1 -1
  168. package/lib/components/FormField/FormField.test-ids.d.ts +1 -1
  169. package/lib/components/FormField/FormField.test-ids.d.ts.map +1 -1
  170. package/lib/components/Fullscreen/Fullscreen.d.ts +1 -1
  171. package/lib/components/Fullscreen/Fullscreen.test-ids.d.ts +1 -1
  172. package/lib/components/Fullscreen/Fullscreen.test-ids.d.ts.map +1 -1
  173. package/lib/components/Fullscreen/FullscreenButton.js.map +1 -1
  174. package/lib/components/Grid/Grid.d.ts +1 -1
  175. package/lib/components/Grid/Grid.d.ts.map +1 -1
  176. package/lib/components/Grid/Grid.js.map +1 -1
  177. package/lib/components/HTML/HTML.d.ts +1 -1
  178. package/lib/components/HTML/HTML.d.ts.map +1 -1
  179. package/lib/components/HTML/HTML.js +3 -2
  180. package/lib/components/HTML/HTML.js.map +1 -1
  181. package/lib/components/HTML/HTML.test-ids.d.ts +1 -1
  182. package/lib/components/HTML/HTML.test-ids.d.ts.map +1 -1
  183. package/lib/components/Icon/Icon.d.ts +5 -5
  184. package/lib/components/Icon/Icon.d.ts.map +1 -1
  185. package/lib/components/Icon/Icon.js.map +1 -1
  186. package/lib/components/IconPicker/IconPicker.js.map +1 -1
  187. package/lib/components/Input/Input.d.ts +1 -1
  188. package/lib/components/Input/Input.js.map +1 -1
  189. package/lib/components/Input/Input.test-ids.d.ts +1 -1
  190. package/lib/components/Input/Input.test-ids.d.ts.map +1 -1
  191. package/lib/components/Lightbox/Lightbox.d.ts +1 -1
  192. package/lib/components/Lightbox/Lightbox.js.map +1 -1
  193. package/lib/components/Lightbox/Lightbox.styles.d.ts +1 -1
  194. package/lib/components/Lightbox/Lightbox.test-ids.d.ts +1 -1
  195. package/lib/components/Lightbox/Lightbox.test-ids.d.ts.map +1 -1
  196. package/lib/components/Link/Link.d.ts +1 -1
  197. package/lib/components/Link/Link.d.ts.map +1 -1
  198. package/lib/components/Link/Link.js +41 -12
  199. package/lib/components/Link/Link.js.map +1 -1
  200. package/lib/components/Link/Link.test-ids.d.ts +1 -1
  201. package/lib/components/Link/Link.test-ids.d.ts.map +1 -1
  202. package/lib/components/List/List.d.ts.map +1 -1
  203. package/lib/components/ListToolbar/ListToolbar.d.ts +1 -1
  204. package/lib/components/ListToolbar/ListToolbar.js.map +1 -1
  205. package/lib/components/ListToolbar/ListToolbar.styles.d.ts +2 -2
  206. package/lib/components/ListToolbar/ListToolbar.styles.d.ts.map +1 -1
  207. package/lib/components/ListToolbar/ListToolbar.test-ids.d.ts +1 -1
  208. package/lib/components/ListToolbar/ListToolbar.test-ids.d.ts.map +1 -1
  209. package/lib/components/ListToolbar/PresetMenuPopover.js.map +1 -1
  210. package/lib/components/ListToolbar/helpers.d.ts +1 -1
  211. package/lib/components/ListToolbar/helpers.d.ts.map +1 -1
  212. package/lib/components/ListToolbar/helpers.js.map +1 -1
  213. package/lib/components/LiveLog/LiveLog.js.map +1 -1
  214. package/lib/components/Location/CurrentLocationButton.js.map +1 -1
  215. package/lib/components/Location/Location.test-ids.d.ts +1 -1
  216. package/lib/components/Location/Location.test-ids.d.ts.map +1 -1
  217. package/lib/components/Location/Location.types.d.ts +1 -1
  218. package/lib/components/Location/Location.types.d.ts.map +1 -1
  219. package/lib/components/Location/Location.types.js +1 -0
  220. package/lib/components/Location/Location.types.js.map +1 -1
  221. package/lib/components/Location/LocationDisplay.js.map +1 -1
  222. package/lib/components/Location/LocationInput.d.ts +1 -1
  223. package/lib/components/Location/LocationInput.js.map +1 -1
  224. package/lib/components/Location/LocationView.d.ts +2 -2
  225. package/lib/components/Location/LocationView.d.ts.map +1 -1
  226. package/lib/components/Location/LocationView.js.map +1 -1
  227. package/lib/components/Location/utils.d.ts +1 -1
  228. package/lib/components/Location/utils.d.ts.map +1 -1
  229. package/lib/components/Location/utils.js +1 -0
  230. package/lib/components/Location/utils.js.map +1 -1
  231. package/lib/components/Menu/FlyoutMenuList.js.map +1 -1
  232. package/lib/components/Menu/Menu.d.ts +1 -1
  233. package/lib/components/Menu/Menu.js.map +1 -1
  234. package/lib/components/Menu/Menu.styles.d.ts +3 -3
  235. package/lib/components/Menu/Menu.styles.d.ts.map +1 -1
  236. package/lib/components/Menu/Menu.test-ids.d.ts +2 -2
  237. package/lib/components/Menu/Menu.test-ids.d.ts.map +1 -1
  238. package/lib/components/Menu/Menu.utils.d.ts.map +1 -1
  239. package/lib/components/Menu/MenuGroup.js.map +1 -1
  240. package/lib/components/Menu/MenuItem.d.ts +1 -1
  241. package/lib/components/Menu/MenuItem.js.map +1 -1
  242. package/lib/components/Menu/MenuList.d.ts.map +1 -1
  243. package/lib/components/Menu/MenuList.js +13 -5
  244. package/lib/components/Menu/MenuList.js.map +1 -1
  245. package/lib/components/Menu/MenuListHeader.js.map +1 -1
  246. package/lib/components/Menu/NavItemsList.d.ts.map +1 -1
  247. package/lib/components/Menu/NavItemsList.js.map +1 -1
  248. package/lib/components/Menu/helpers.d.ts +17 -31
  249. package/lib/components/Menu/helpers.d.ts.map +1 -1
  250. package/lib/components/Menu/helpers.js.map +1 -1
  251. package/lib/components/MenuButton/MenuButton.d.ts +1 -1
  252. package/lib/components/MenuButton/MenuButton.js.map +1 -1
  253. package/lib/components/MenuButton/MenuButton.test-ids.d.ts +1 -1
  254. package/lib/components/MenuButton/MenuButton.test-ids.d.ts.map +1 -1
  255. package/lib/components/MetaList/MetaList.d.ts +1 -1
  256. package/lib/components/MetaList/MetaList.test-ids.d.ts +1 -1
  257. package/lib/components/MetaList/MetaList.test-ids.d.ts.map +1 -1
  258. package/lib/components/Modal/MinimizedModal.js.map +1 -1
  259. package/lib/components/Modal/Modal.js.map +1 -1
  260. package/lib/components/Modal/Modal.styles.d.ts +2 -2
  261. package/lib/components/Modal/Modal.styles.d.ts.map +1 -1
  262. package/lib/components/Modal/Modal.styles.js.map +1 -1
  263. package/lib/components/Modal/ModalManager.js.map +1 -1
  264. package/lib/components/MultiStepForm/FormProgress.styles.d.ts +3 -3
  265. package/lib/components/MultiStepForm/FormProgress.styles.d.ts.map +1 -1
  266. package/lib/components/MultiStepForm/HorizontalFormProgress.js.map +1 -1
  267. package/lib/components/MultiStepForm/MultiStepForm.d.ts +2 -2
  268. package/lib/components/MultiStepForm/MultiStepForm.d.ts.map +1 -1
  269. package/lib/components/MultiStepForm/MultiStepForm.js.map +1 -1
  270. package/lib/components/Number/Number.test-ids.d.ts +2 -2
  271. package/lib/components/Number/Number.test-ids.d.ts.map +1 -1
  272. package/lib/components/Number/NumberInput.d.ts +1 -1
  273. package/lib/components/Number/NumberInput.js.map +1 -1
  274. package/lib/components/Number/NumberInput.styles.d.ts +2 -2
  275. package/lib/components/Number/NumberRangeInput.d.ts +1 -1
  276. package/lib/components/Number/utils.d.ts +1 -1
  277. package/lib/components/Number/utils.d.ts.map +1 -1
  278. package/lib/components/Number/utils.js.map +1 -1
  279. package/lib/components/PageTemplates/CategorySubPage.js.map +1 -1
  280. package/lib/components/PageTemplates/CategorySubPage.styles.d.ts +1 -1
  281. package/lib/components/PageTemplates/DashboardPage.d.ts +2 -2
  282. package/lib/components/PageTemplates/DashboardPage.js.map +1 -1
  283. package/lib/components/PageTemplates/PageTemplates.d.ts +2 -2
  284. package/lib/components/PageTemplates/PageTemplates.d.ts.map +1 -1
  285. package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
  286. package/lib/components/Phone/Phone.test-ids.d.ts +1 -1
  287. package/lib/components/Phone/Phone.test-ids.d.ts.map +1 -1
  288. package/lib/components/Phone/PhoneInput.d.ts +1 -1
  289. package/lib/components/Phone/PhoneInput.js.map +1 -1
  290. package/lib/components/Phone/utils.js.map +1 -1
  291. package/lib/components/Popover/Popover.js +1 -1
  292. package/lib/components/Popover/Popover.js.map +1 -1
  293. package/lib/components/Popover/Popover.styles.d.ts +2 -2
  294. package/lib/components/Popover/Popover.styles.d.ts.map +1 -1
  295. package/lib/components/Popover/modifiers.js.map +1 -1
  296. package/lib/components/Progress/Bar.js.map +1 -1
  297. package/lib/components/Progress/Progress.js.map +1 -1
  298. package/lib/components/Progress/Progress.styles.d.ts +1 -1
  299. package/lib/components/RadioCheck/RadioCheck.d.ts +2 -2
  300. package/lib/components/RadioCheck/RadioCheck.js.map +1 -1
  301. package/lib/components/RadioCheckGroup/RadioCheckGroup.js.map +1 -1
  302. package/lib/components/Rating/Rating.js.map +1 -1
  303. package/lib/components/SearchInput/SearchInput.js.map +1 -1
  304. package/lib/components/SearchInput/SearchInput.styles.d.ts +2 -2
  305. package/lib/components/Select/Select.d.ts +1 -1
  306. package/lib/components/Select/Select.test-ids.d.ts +1 -1
  307. package/lib/components/Select/Select.test-ids.d.ts.map +1 -1
  308. package/lib/components/ShortcutManager/ShortcutManager.js.map +1 -1
  309. package/lib/components/SkipLinks/SkipLinks.d.ts +1 -1
  310. package/lib/components/SkipLinks/SkipLinks.d.ts.map +1 -1
  311. package/lib/components/Slider/Slider.d.ts +1 -1
  312. package/lib/components/Slider/Slider.js.map +1 -1
  313. package/lib/components/Slider/Slider.styles.d.ts +7 -7
  314. package/lib/components/Slider/Slider.styles.d.ts.map +1 -1
  315. package/lib/components/Slider/Slider.test-ids.d.ts +1 -1
  316. package/lib/components/Slider/Slider.test-ids.d.ts.map +1 -1
  317. package/lib/components/Slider/SliderTicks.js.map +1 -1
  318. package/lib/components/Slider/utils.d.ts +1 -1
  319. package/lib/components/Slider/utils.d.ts.map +1 -1
  320. package/lib/components/Slider/utils.js.map +1 -1
  321. package/lib/components/SummaryItem/SummaryItem.d.ts +6 -6
  322. package/lib/components/SummaryItem/SummaryItem.d.ts.map +1 -1
  323. package/lib/components/SummaryItem/SummaryItem.test-ids.d.ts +1 -1
  324. package/lib/components/SummaryItem/SummaryItem.test-ids.d.ts.map +1 -1
  325. package/lib/components/SummaryList/SummaryList.d.ts +2 -2
  326. package/lib/components/SummaryList/SummaryList.d.ts.map +1 -1
  327. package/lib/components/SummaryList/SummaryList.js.map +1 -1
  328. package/lib/components/SummaryList/ViewAll.d.ts +1 -1
  329. package/lib/components/Table/Table.d.ts.map +1 -1
  330. package/lib/components/Tabs/Tab.d.ts +2 -1
  331. package/lib/components/Tabs/Tab.d.ts.map +1 -1
  332. package/lib/components/Tabs/TabPanel.js.map +1 -1
  333. package/lib/components/Tabs/Tabs.js.map +1 -1
  334. package/lib/components/Tabs/Tabs.styles.d.ts +1 -1
  335. package/lib/components/Text/Text.d.ts +3 -2
  336. package/lib/components/Text/Text.d.ts.map +1 -1
  337. package/lib/components/Text/Text.js.map +1 -1
  338. package/lib/components/TextArea/TextArea.d.ts +1 -1
  339. package/lib/components/TextArea/TextArea.js.map +1 -1
  340. package/lib/components/TextArea/TextArea.test-ids.d.ts +1 -1
  341. package/lib/components/TextArea/TextArea.test-ids.d.ts.map +1 -1
  342. package/lib/components/Toaster/Toaster.d.ts +1 -1
  343. package/lib/components/Toaster/Toaster.js +1 -1
  344. package/lib/components/Toaster/Toaster.js.map +1 -1
  345. package/lib/components/Toaster/Toaster.test-ids.d.ts +1 -1
  346. package/lib/components/Toaster/Toaster.test-ids.d.ts.map +1 -1
  347. package/lib/components/Tooltip/Tooltip.d.ts +1 -1
  348. package/lib/components/Tooltip/Tooltip.js.map +1 -1
  349. package/lib/components/Tooltip/Tooltip.test-ids.d.ts +1 -1
  350. package/lib/components/Tooltip/Tooltip.test-ids.d.ts.map +1 -1
  351. package/lib/components/Tree/StandardTree.js.map +1 -1
  352. package/lib/components/Tree/StandardTree.styles.d.ts +1 -1
  353. package/lib/components/Tree/StandardTree.styles.d.ts.map +1 -1
  354. package/lib/components/Tree/Tree.d.ts +1 -1
  355. package/lib/components/Tree/Tree.d.ts.map +1 -1
  356. package/lib/components/Tree/Tree.test-ids.d.ts +2 -2
  357. package/lib/components/Tree/Tree.test-ids.d.ts.map +1 -1
  358. package/lib/components/Tree/helpers.d.ts +13 -13
  359. package/lib/components/Tree/helpers.d.ts.map +1 -1
  360. package/lib/components/Tree/helpers.js.map +1 -1
  361. package/lib/components/URL/URLDisplay.js.map +1 -1
  362. package/lib/hooks/useActiveDescendant.d.ts +2 -2
  363. package/lib/hooks/useActiveDescendant.d.ts.map +1 -1
  364. package/lib/hooks/useActiveDescendant.js.map +1 -1
  365. package/lib/hooks/useAfterInitialEffect.d.ts.map +1 -1
  366. package/lib/hooks/useArrows.d.ts +6 -6
  367. package/lib/hooks/useArrows.d.ts.map +1 -1
  368. package/lib/hooks/useArrows.js.map +1 -1
  369. package/lib/hooks/useAutoResize.d.ts.map +1 -1
  370. package/lib/hooks/useAutoResize.js.map +1 -1
  371. package/lib/hooks/useBreakpoint.d.ts +3 -3
  372. package/lib/hooks/useBreakpoint.d.ts.map +1 -1
  373. package/lib/hooks/useBreakpoint.js.map +1 -1
  374. package/lib/hooks/useConsolidatedRef.d.ts.map +1 -1
  375. package/lib/hooks/useConsolidatedRef.js.map +1 -1
  376. package/lib/hooks/useDirection.d.ts.map +1 -1
  377. package/lib/hooks/useDraggable.d.ts.map +1 -1
  378. package/lib/hooks/useDraggable.js.map +1 -1
  379. package/lib/hooks/useElement.d.ts.map +1 -1
  380. package/lib/hooks/useEscape.d.ts.map +1 -1
  381. package/lib/hooks/useFocusTrap.d.ts.map +1 -1
  382. package/lib/hooks/useFocusTrap.js.map +1 -1
  383. package/lib/hooks/useFocusWithin.d.ts +1 -1
  384. package/lib/hooks/useFocusWithin.d.ts.map +1 -1
  385. package/lib/hooks/useFocusWithin.js.map +1 -1
  386. package/lib/hooks/useInputFormatter.d.ts.map +1 -1
  387. package/lib/hooks/useInputFormatter.js.map +1 -1
  388. package/lib/hooks/useItemIntersection.d.ts.map +1 -1
  389. package/lib/hooks/useItemIntersection.js.map +1 -1
  390. package/lib/hooks/useLongPress.d.ts +4 -4
  391. package/lib/hooks/useLongPress.d.ts.map +1 -1
  392. package/lib/hooks/useLongPress.js.map +1 -1
  393. package/lib/hooks/useOS.js.map +1 -1
  394. package/lib/hooks/useOuterEvent.d.ts.map +1 -1
  395. package/lib/hooks/useOuterEvent.js.map +1 -1
  396. package/lib/hooks/usePrevious.d.ts.map +1 -1
  397. package/lib/hooks/useRefMap.d.ts.map +1 -1
  398. package/lib/hooks/useRefMap.js.map +1 -1
  399. package/lib/hooks/useScrollStick.js.map +1 -1
  400. package/lib/hooks/useShortcut.d.ts +1 -1
  401. package/lib/hooks/useShortcut.d.ts.map +1 -1
  402. package/lib/hooks/useSimpleStore.d.ts.map +1 -1
  403. package/lib/hooks/useSimpleStore.js.map +1 -1
  404. package/lib/hooks/useSimpleStoreInstance.d.ts.map +1 -1
  405. package/lib/hooks/useTestIds.d.ts +2 -1
  406. package/lib/hooks/useTestIds.d.ts.map +1 -1
  407. package/lib/hooks/useTestIds.js.map +1 -1
  408. package/lib/hooks/useTheme.d.ts.map +1 -1
  409. package/lib/hooks/useTransitionState.d.ts +7 -7
  410. package/lib/hooks/useTransitionState.d.ts.map +1 -1
  411. package/lib/hooks/useTriggerableEffect.d.ts.map +1 -1
  412. package/lib/hooks/useTriggerableLayoutEffect.d.ts.map +1 -1
  413. package/lib/i18n/i18n.d.ts +1 -1
  414. package/lib/i18n/i18n.d.ts.map +1 -1
  415. package/lib/i18n/translate.d.ts.map +1 -1
  416. package/lib/i18n/translate.js.map +1 -1
  417. package/lib/init.js.map +1 -1
  418. package/lib/register-contexts.js.map +1 -1
  419. package/lib/styles/gradients.d.ts +3 -3
  420. package/lib/styles/gradients.d.ts.map +1 -1
  421. package/lib/styles/gradients.js.map +1 -1
  422. package/lib/styles/utils.d.ts.map +1 -1
  423. package/lib/styles/utils.js.map +1 -1
  424. package/lib/theme/ThemeMachine.js.map +1 -1
  425. package/lib/types/types.d.ts.map +1 -1
  426. package/lib/types/types.js.map +1 -1
  427. package/lib/utils/allowedURI.d.ts +7 -0
  428. package/lib/utils/allowedURI.d.ts.map +1 -0
  429. package/lib/utils/allowedURI.js +7 -0
  430. package/lib/utils/allowedURI.js.map +1 -0
  431. package/lib/utils/bindAll.d.ts.map +1 -1
  432. package/lib/utils/cap.d.ts.map +1 -1
  433. package/lib/utils/createStringMatcher.d.ts +1 -1
  434. package/lib/utils/createStringMatcher.js.map +1 -1
  435. package/lib/utils/createTestIds.d.ts +1 -1
  436. package/lib/utils/createTestIds.d.ts.map +1 -1
  437. package/lib/utils/debounce.d.ts +1 -1
  438. package/lib/utils/debounce.d.ts.map +1 -1
  439. package/lib/utils/deepGet.d.ts.map +1 -1
  440. package/lib/utils/deepGet.js.map +1 -1
  441. package/lib/utils/deepObjectComparison.js.map +1 -1
  442. package/lib/utils/defineSmartGetter.d.ts.map +1 -1
  443. package/lib/utils/focusHeadingOrContainer.js.map +1 -1
  444. package/lib/utils/formatListToLocaleString.d.ts +2 -2
  445. package/lib/utils/formatListToLocaleString.d.ts.map +1 -1
  446. package/lib/utils/getEdge.d.ts +1 -1
  447. package/lib/utils/getEdge.d.ts.map +1 -1
  448. package/lib/utils/getEdge.js.map +1 -1
  449. package/lib/utils/getFocusables.d.ts +1 -1
  450. package/lib/utils/getFocusables.d.ts.map +1 -1
  451. package/lib/utils/getFocusables.js.map +1 -1
  452. package/lib/utils/getRelativeOffset.d.ts +1 -1
  453. package/lib/utils/getRelativeOffset.d.ts.map +1 -1
  454. package/lib/utils/hasProp.d.ts.map +1 -1
  455. package/lib/utils/index.d.ts +1 -0
  456. package/lib/utils/index.d.ts.map +1 -1
  457. package/lib/utils/index.js +1 -0
  458. package/lib/utils/index.js.map +1 -1
  459. package/lib/utils/isPositionWithinRect.d.ts.map +1 -1
  460. package/lib/utils/kebabToCamel.d.ts.map +1 -1
  461. package/lib/utils/loadScript.d.ts.map +1 -1
  462. package/lib/utils/normalizeTargets.d.ts +1 -1
  463. package/lib/utils/normalizeTargets.d.ts.map +1 -1
  464. package/lib/utils/replaceMatchWithElement.d.ts.map +1 -1
  465. package/lib/utils/replaceMatchWithElement.js.map +1 -1
  466. package/lib/utils/throttle.d.ts +1 -1
  467. package/lib/utils/throttle.d.ts.map +1 -1
  468. package/lib/utils/triple.js.map +1 -1
  469. package/lib/utils/tryCatch.js.map +1 -1
  470. package/lib/utils/withTestIds.d.ts +2 -1
  471. package/lib/utils/withTestIds.d.ts.map +1 -1
  472. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"useInputFormatter.js","sourceRoot":"","sources":["../../src/hooks/useInputFormatter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAG1C,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC;;;;;;;GAOG;AACH,MAAM,iBAAiB,GAAG,CACxB,GAAgC,EAChC,QAAgB,EAChB,SAAoC,EACpC,uBAA+B,QAAQ,EACvC,EAAE;IACF,gDAAgD;IAChD,MAAM,wBAAwB,GAAG,MAAM,EAAU,CAAC;IAElD,QAAQ,CACN,SAAS,EACT,CAAC,CAAC,EAAE;QACF,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;QAC5B,IAAI,OAAO,EAAE;YACX,MAAM,kBAAkB,GAAG,OAAO,CAAC,cAAc,IAAI,CAAC,CAAC;YACvD,MAAM,gBAAgB,GAAG,OAAO,CAAC,YAAY,IAAI,CAAC,CAAC;YACnD,MAAM,YAAY,GAAG,OAAO,CAAC,KAAK,CAAC;YACnC,IAAI,kBAAkB,KAAK,gBAAgB,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,QAAQ,CA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AoB,IAAI,CAAC,EAAE,CAAC;YACzC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,oBAAoB,EAAE,IAAI,CAAC,CAAC,CAAC;YAC1E,IAAI,KAAK,EAAE;gBACT,gFAAgF;gBAChF,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;aAC7D;iBAAM;gBACL,uCAAuC;gBACvC,OAAO,CAAC,iBAAiB,CACvB,wBAAwB,CAAC,OAAO,EAChC,wBAAwB,CAAC,OAAO,CACjC,CAAC;aACH;YACD,wBAAwB,CAAC,OAAO,GAAG,SAAS,CAAC;SAC9C;IACH,CAAC,EAAE,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC,CAAC;IAErC,OAAO,SAAS,CAAC,QAAQ,CAAC,CAAC;AAC7B,CAAC,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["import { useRef, useEffect } from 'react';\nimport type { RefObject } from 'react';\n\nimport useEvent from './useEvent';\n\n/**\n * Formats the raw value using given formatter and handles the caret position.\n * @param ref reference to input element.\n * @param rawValue value to be formatted.\n * @param formatter formatter function accepting partial input and returning partially formatted value.\n * @param acceptableCharacters string containing all the characters that may appear in the value to format. RegExp shorthands are also accepted. Only numbers are accepted by default.\n * @returns formatted value that should be passed to the input component.\n */\nconst useInputFormatter = (\n ref: RefObject<HTMLInputElement>,\n rawValue: string,\n formatter: (value: string) => string,\n acceptableCharacters: string = '\\\\p{N}'\n) => {\n // synthetic caret position in unformatted value\n const rawValueCaretPositionRef = useRef<number>();\n\n useEvent(\n 'keydown',\n e => {\n const inputEl = ref.current;\n if (inputEl) {\n const caretPositionStart = inputEl.selectionStart ?? 0;\n const caretPositionEnd = inputEl.selectionEnd ?? 0;\n const currentValue = inputEl.value;\n if (caretPositionStart !== caretPositionEnd && ['Backspace', 'Delete'].includes(e.key)) {\n // if selection contains only formatting characters, move the caret to the beginning of the selection\n const selectedText = currentValue.slice(caretPositionStart, caretPositionEnd);\n if (!new RegExp(`[${acceptableCharacters}]`, 'gu').test(selectedText)) {\n inputEl.setSelectionRange(caretPositionStart, caretPositionStart);\n e.preventDefault();\n }\n return;\n }\n\n if (\n e.key === 'Backspace' &&\n new RegExp(`[^${acceptableCharacters}]`, 'gu').test(\n currentValue.charAt(caretPositionStart - 1)\n )\n ) {\n const lastNonFormatChar = new RegExp(\n `[${acceptableCharacters}](?=[^${acceptableCharacters}]*$)`,\n 'gu'\n );\n // match last non-formatting character if it can be found in the preceding slice\n if (lastNonFormatChar.test(currentValue.slice(0, caretPositionStart))) {\n // move the caret after matched character to get it removed\n inputEl.setSelectionRange(lastNonFormatChar.lastIndex, lastNonFormatChar.lastIndex);\n } else {\n e.preventDefault();\n }\n }\n\n if (\n e.key === 'Delete' &&\n new RegExp(`[^${acceptableCharacters}]`, 'gu').test(currentValue.charAt(caretPositionEnd))\n ) {\n const firstNonFormatChar = new RegExp(`[${acceptableCharacters}]`, 'gu');\n firstNonFormatChar.lastIndex = caretPositionEnd;\n // find first non-formatting character in the value starting from the caret position\n if (firstNonFormatChar.test(currentValue)) {\n // move the caret before matched character to get it removed\n inputEl.setSelectionRange(\n firstNonFormatChar.lastIndex - 1,\n firstNonFormatChar.lastIndex - 1\n );\n } else {\n e.preventDefault();\n }\n }\n }\n },\n { target: ref, dependencies: [acceptableCharacters] }\n );\n\n useEvent(\n 'input',\n () => {\n const inputEl = ref.current;\n if (inputEl) {\n // calculate new synthetic caret position in the unformatted value\n const currentCaretPosition = inputEl.selectionStart ?? 0;\n rawValueCaretPositionRef.current = inputEl.value\n .slice(0, currentCaretPosition)\n .replace(new RegExp(`[^${acceptableCharacters}]`, 'gu'), '').length;\n }\n },\n { target: ref, dependencies: [acceptableCharacters] }\n );\n\n useEffect(() => {\n const inputEl = ref.current;\n if (inputEl && rawValueCaretPositionRef.current !== undefined) {\n // create regexp with every raw value character wrapped in possible formatting characters\n const rawValueRegExpSource = `[^${acceptableCharacters}]*${rawValue\n .slice(0, rawValueCaretPositionRef.current)\n .split('')\n .join(`[^${acceptableCharacters}]*`)}`;\n const match = inputEl.value.match(new RegExp(rawValueRegExpSource, 'gu'));\n if (match) {\n // if it matches move the real caret to the corresponding index in the raw value\n inputEl.setSelectionRange(match[0].length, match[0].length);\n } else {\n // just re-position the caret otherwise\n inputEl.setSelectionRange(\n rawValueCaretPositionRef.current,\n rawValueCaretPositionRef.current\n );\n }\n rawValueCaretPositionRef.current = undefined;\n }\n }, [rawValue, acceptableCharacters]);\n\n return formatter(rawValue);\n};\n\nexport default useInputFormatter;\n"]}
1
+ {"version":3,"file":"useInputFormatter.js","sourceRoot":"","sources":["../../src/hooks/useInputFormatter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAG1C,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC;;;;;;;GAOG;AACH,MAAM,iBAAiB,GAAG,CACxB,GAAgC,EAChC,QAAgB,EAChB,SAAoC,EACpC,uBAA+B,QAAQ,EACvC,EAAE;IACF,gDAAgD;IAChD,MAAM,wBAAwB,GAAG,MAAM,EAAU,CAAC;IAElD,QAAQ,CACN,SAAS,EACT,CAAC,CAAC,EAAE;QACF,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;QAC5B,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,kBAAkB,GAAG,OAAO,CAAC,cAAc,IAAI,CAAC,CAAC;YACvD,MAAM,gBAAgB,GAAG,OAAO,CAAC,YAAY,IAAI,CAAC,CAAC;YACnD,MAAM,YAAY,GAAG,OAAO,CAAC,KAAK,CAAC;YACnC,IAAI,kBAAkB,KAAK,gBAAgB,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;gBACvF,qGAAq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AAO,CAAC;iBAC1C,KAAK,CAAC,EAAE,CAAC;iBACT,IAAI,CAAC,KAAK,oBAAoB,IAAI,CAAC,EAAE,CAAC;YACzC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,oBAAoB,EAAE,IAAI,CAAC,CAAC,CAAC;YAC1E,IAAI,KAAK,EAAE,CAAC;gBACV,gFAAgF;gBAChF,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;YAC9D,CAAC;iBAAM,CAAC;gBACN,uCAAuC;gBACvC,OAAO,CAAC,iBAAiB,CACvB,wBAAwB,CAAC,OAAO,EAChC,wBAAwB,CAAC,OAAO,CACjC,CAAC;YACJ,CAAC;YACD,wBAAwB,CAAC,OAAO,GAAG,SAAS,CAAC;QAC/C,CAAC;IACH,CAAC,EAAE,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC,CAAC;IAErC,OAAO,SAAS,CAAC,QAAQ,CAAC,CAAC;AAC7B,CAAC,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["import { useRef, useEffect } from 'react';\nimport type { RefObject } from 'react';\n\nimport useEvent from './useEvent';\n\n/**\n * Formats the raw value using given formatter and handles the caret position.\n * @param ref reference to input element.\n * @param rawValue value to be formatted.\n * @param formatter formatter function accepting partial input and returning partially formatted value.\n * @param acceptableCharacters string containing all the characters that may appear in the value to format. RegExp shorthands are also accepted. Only numbers are accepted by default.\n * @returns formatted value that should be passed to the input component.\n */\nconst useInputFormatter = (\n ref: RefObject<HTMLInputElement>,\n rawValue: string,\n formatter: (value: string) => string,\n acceptableCharacters: string = '\\\\p{N}'\n) => {\n // synthetic caret position in unformatted value\n const rawValueCaretPositionRef = useRef<number>();\n\n useEvent(\n 'keydown',\n e => {\n const inputEl = ref.current;\n if (inputEl) {\n const caretPositionStart = inputEl.selectionStart ?? 0;\n const caretPositionEnd = inputEl.selectionEnd ?? 0;\n const currentValue = inputEl.value;\n if (caretPositionStart !== caretPositionEnd && ['Backspace', 'Delete'].includes(e.key)) {\n // if selection contains only formatting characters, move the caret to the beginning of the selection\n const selectedText = currentValue.slice(caretPositionStart, caretPositionEnd);\n if (!new RegExp(`[${acceptableCharacters}]`, 'gu').test(selectedText)) {\n inputEl.setSelectionRange(caretPositionStart, caretPositionStart);\n e.preventDefault();\n }\n return;\n }\n\n if (\n e.key === 'Backspace' &&\n new RegExp(`[^${acceptableCharacters}]`, 'gu').test(\n currentValue.charAt(caretPositionStart - 1)\n )\n ) {\n const lastNonFormatChar = new RegExp(\n `[${acceptableCharacters}](?=[^${acceptableCharacters}]*$)`,\n 'gu'\n );\n // match last non-formatting character if it can be found in the preceding slice\n if (lastNonFormatChar.test(currentValue.slice(0, caretPositionStart))) {\n // move the caret after matched character to get it removed\n inputEl.setSelectionRange(lastNonFormatChar.lastIndex, lastNonFormatChar.lastIndex);\n } else {\n e.preventDefault();\n }\n }\n\n if (\n e.key === 'Delete' &&\n new RegExp(`[^${acceptableCharacters}]`, 'gu').test(currentValue.charAt(caretPositionEnd))\n ) {\n const firstNonFormatChar = new RegExp(`[${acceptableCharacters}]`, 'gu');\n firstNonFormatChar.lastIndex = caretPositionEnd;\n // find first non-formatting character in the value starting from the caret position\n if (firstNonFormatChar.test(currentValue)) {\n // move the caret before matched character to get it removed\n inputEl.setSelectionRange(\n firstNonFormatChar.lastIndex - 1,\n firstNonFormatChar.lastIndex - 1\n );\n } else {\n e.preventDefault();\n }\n }\n }\n },\n { target: ref, dependencies: [acceptableCharacters] }\n );\n\n useEvent(\n 'input',\n () => {\n const inputEl = ref.current;\n if (inputEl) {\n // calculate new synthetic caret position in the unformatted value\n const currentCaretPosition = inputEl.selectionStart ?? 0;\n rawValueCaretPositionRef.current = inputEl.value\n .slice(0, currentCaretPosition)\n .replace(new RegExp(`[^${acceptableCharacters}]`, 'gu'), '').length;\n }\n },\n { target: ref, dependencies: [acceptableCharacters] }\n );\n\n useEffect(() => {\n const inputEl = ref.current;\n if (inputEl && rawValueCaretPositionRef.current !== undefined) {\n // create regexp with every raw value character wrapped in possible formatting characters\n const rawValueRegExpSource = `[^${acceptableCharacters}]*${rawValue\n .slice(0, rawValueCaretPositionRef.current)\n .split('')\n .join(`[^${acceptableCharacters}]*`)}`;\n const match = inputEl.value.match(new RegExp(rawValueRegExpSource, 'gu'));\n if (match) {\n // if it matches move the real caret to the corresponding index in the raw value\n inputEl.setSelectionRange(match[0].length, match[0].length);\n } else {\n // just re-position the caret otherwise\n inputEl.setSelectionRange(\n rawValueCaretPositionRef.current,\n rawValueCaretPositionRef.current\n );\n }\n rawValueCaretPositionRef.current = undefined;\n }\n }, [rawValue, acceptableCharacters]);\n\n return formatter(rawValue);\n};\n\nexport default useInputFormatter;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useItemIntersection.d.ts","sourceRoot":"","sources":["../../src/hooks/useItemIntersection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC;;;;;;;GAOG;AAEH,QAAA,MAAM,mBAAmB,iBACT,UAAU,WAAW,CAAC,UAC5B,MAAM,MACV,MAAM,IAAI,gBACA,MAAM,SA8BrB,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"useItemIntersection.d.ts","sourceRoot":"","sources":["../../src/hooks/useItemIntersection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC;;;;;;;GAOG;AAEH,QAAA,MAAM,mBAAmB,iBACT,SAAS,CAAC,WAAW,CAAC,UAC5B,MAAM,MACV,MAAM,IAAI,gBACA,MAAM,SA8BrB,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useItemIntersection.js","sourceRoot":"","sources":["../../src/hooks/useItemIntersection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlC;;;;;;;GAOG;AAEH,MAAM,mBAAmB,GAAG,CAC1B,YAAoC,EACpC,MAAc,EACd,EAAc,EACd,YAAoB,EACpB,EAAE;IACF,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,IAAI,GAAuB,IAAI,CAAC;QACpC,IAAI,MAAM,GAAG,CAAC,EAAE;YACd,MAAM,KAAK,GAA4B,CACrC,YAAY,CAAC,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,CACrE,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;YAEjC,IAAI,KAAK,CAAC,MAAM,GAAG,MAAM,EAAE;gBACzB,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;aACtB;SACF;QACD,IAAI,IAAI,EAAE;YACR,MAAM,oBAAoB,GAAG,IAAI,oBAAoB,CACnD,CAAC,OAAoC,EAAE,EAAE;gBACvC,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,cAAc,EAAE;oBAC7B,EAAE,EAAE,CAAC;iBACN;YACH,CAAC,EACD;gBACE,IAAI,EAAE,YAAY,CAAC,OAAO;aAC3B,CACF,CAAC;YACF,oBAAoB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACnC,OAAO,GAAG,EAAE;gBACV,oBAAoB,CAAC,UAAU,EAAE,CAAC;YACpC,CAAC,CAAC;SACH;IACH,CAAC,EAAE,CAAC,EAAE,EAAE,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;AACzC,CAAC,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["import { useEffect } from 'react';\nimport type { RefObject } from 'react';\n\n/**\n * @example useItemIntersection(listRef,offset,() => { do_some_thing; });\n * @param containerRef The ref of the List.\n * @param offset Index of the list item which needs to be observed.\n * @param cb Callback that needs to be fired on intersect\n * @param itemSelector Selector used to get the node list of items\n * @returns void.\n */\n\nconst useItemIntersection = (\n containerRef: RefObject<HTMLElement>,\n offset: number,\n cb: () => void,\n itemSelector: string\n) => {\n useEffect(() => {\n let item: HTMLElement | null = null;\n if (offset > 0) {\n const items: NodeListOf<HTMLElement> = (\n containerRef.current === null ? document.body : containerRef.current\n ).querySelectorAll(itemSelector);\n\n if (items.length > offset) {\n item = items[offset];\n }\n }\n if (item) {\n const intersectionObserver = new IntersectionObserver(\n (entries: IntersectionObserverEntry[]) => {\n if (entries[0].isIntersecting) {\n cb();\n }\n },\n {\n root: containerRef.current\n }\n );\n intersectionObserver.observe(item);\n return () => {\n intersectionObserver.disconnect();\n };\n }\n }, [cb, containerRef.current, offset]);\n};\n\nexport default useItemIntersection;\n"]}
1
+ {"version":3,"file":"useItemIntersection.js","sourceRoot":"","sources":["../../src/hooks/useItemIntersection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlC;;;;;;;GAOG;AAEH,MAAM,mBAAmB,GAAG,CAC1B,YAAoC,EACpC,MAAc,EACd,EAAc,EACd,YAAoB,EACpB,EAAE;IACF,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,IAAI,GAAuB,IAAI,CAAC;QACpC,IAAI,MAAM,GAAG,CAAC,EAAE,CAAC;YACf,MAAM,KAAK,GAA4B,CACrC,YAAY,CAAC,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,CACrE,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;YAEjC,IAAI,KAAK,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC;gBAC1B,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;YACvB,CAAC;QACH,CAAC;QACD,IAAI,IAAI,EAAE,CAAC;YACT,MAAM,oBAAoB,GAAG,IAAI,oBAAoB,CACnD,CAAC,OAAoC,EAAE,EAAE;gBACvC,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,cAAc,EAAE,CAAC;oBAC9B,EAAE,EAAE,CAAC;gBACP,CAAC;YACH,CAAC,EACD;gBACE,IAAI,EAAE,YAAY,CAAC,OAAO;aAC3B,CACF,CAAC;YACF,oBAAoB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACnC,OAAO,GAAG,EAAE;gBACV,oBAAoB,CAAC,UAAU,EAAE,CAAC;YACpC,CAAC,CAAC;QACJ,CAAC;IACH,CAAC,EAAE,CAAC,EAAE,EAAE,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;AACzC,CAAC,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["import { useEffect } from 'react';\nimport type { RefObject } from 'react';\n\n/**\n * @example useItemIntersection(listRef,offset,() => { do_some_thing; });\n * @param containerRef The ref of the List.\n * @param offset Index of the list item which needs to be observed.\n * @param cb Callback that needs to be fired on intersect\n * @param itemSelector Selector used to get the node list of items\n * @returns void.\n */\n\nconst useItemIntersection = (\n containerRef: RefObject<HTMLElement>,\n offset: number,\n cb: () => void,\n itemSelector: string\n) => {\n useEffect(() => {\n let item: HTMLElement | null = null;\n if (offset > 0) {\n const items: NodeListOf<HTMLElement> = (\n containerRef.current === null ? document.body : containerRef.current\n ).querySelectorAll(itemSelector);\n\n if (items.length > offset) {\n item = items[offset];\n }\n }\n if (item) {\n const intersectionObserver = new IntersectionObserver(\n (entries: IntersectionObserverEntry[]) => {\n if (entries[0].isIntersecting) {\n cb();\n }\n },\n {\n root: containerRef.current\n }\n );\n intersectionObserver.observe(item);\n return () => {\n intersectionObserver.disconnect();\n };\n }\n }, [cb, containerRef.current, offset]);\n};\n\nexport default useItemIntersection;\n"]}
@@ -4,11 +4,11 @@ interface Options {
4
4
  shouldPreventDefault?: boolean;
5
5
  }
6
6
  declare const useLongPress: <T>(onLongPress: () => void, onClick?: () => void, { key, shouldPreventDefault, delay }?: Options) => {
7
- onMouseDown: (e: import("react").MouseEvent<T, MouseEvent>) => void;
8
- onTouchStart: (e: import("react").TouchEvent<T>) => void;
9
- onKeyDown: (e: import("react").KeyboardEvent<T>) => void;
7
+ onMouseDown: (e: React.MouseEvent<T>) => void;
8
+ onTouchStart: (e: React.TouchEvent<T>) => void;
9
+ onKeyDown: (e: React.KeyboardEvent<T>) => void;
10
10
  onMouseUp: () => void;
11
- onKeyUp: (e: import("react").KeyboardEvent<T>) => void;
11
+ onKeyUp: (e: React.KeyboardEvent<T>) => void;
12
12
  onMouseLeave: () => void;
13
13
  onTouchEnd: () => void;
14
14
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useLongPress.d.ts","sourceRoot":"","sources":["../../src/hooks/useLongPress.ts"],"names":[],"mappings":"AAcA,UAAU,OAAO;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,QAAA,MAAM,YAAY,mBACH,MAAM,IAAI,YACb,MAAM,IAAI,yCACyC,OAAO;;;;;;;;CAqDrE,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"useLongPress.d.ts","sourceRoot":"","sources":["../../src/hooks/useLongPress.ts"],"names":[],"mappings":"AAcA,UAAU,OAAO;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,QAAA,MAAM,YAAY,GAAI,CAAC,eACR,MAAM,IAAI,YACb,MAAM,IAAI,yCACyC,OAAO;qBAuCjD,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;sBAClB,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;mBACtB,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;;iBAKxB,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;;;CAOtC,CAAC;AAEF,eAAe,YAAY,CAAC"}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AAE,CAAC,KAAK,EAAE;KAC1B,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import { useCallback, useRef, useState } from 'react';\n\nconst isTouchEvent = (e: Event): e is TouchEvent => {\n return 'touches' in e;\n};\n\nconst preventDefault = (e: Event) => {\n if (!isTouchEvent(e)) return;\n\n if (e.touches.length < 2 && e.preventDefault) {\n e.preventDefault();\n }\n};\n\ninterface Options {\n key?: string;\n delay?: number;\n shouldPreventDefault?: boolean;\n}\n\nconst useLongPress = <T>(\n onLongPress: () => void,\n onClick?: () => void,\n { key = 'Enter', shouldPreventDefault = true, delay = 500 }: Options = {}\n) => {\n const [longPressTriggered, setLongPressTriggered] = useState(false);\n const timeout = useRef<ReturnType<typeof setTimeout>>();\n const target = useRef<EventTarget>();\n\n const start = useCallback(\n (event: React.MouseEvent<T> | React.KeyboardEvent<T> | React.TouchEvent<T>) => {\n if (shouldPreventDefault && event.target) {\n event.target.addEventListener('touchend', preventDefault, {\n passive: false\n });\n target.current = event.target;\n }\n timeout.current = setTimeout(() => {\n onLongPress();\n setLongPressTriggered(true);\n }, delay);\n },\n [onLongPress, delay, shouldPreventDefault]\n );\n\n const clear = useCallback(\n (shouldTriggerClick = true) => {\n if (timeout.current) {\n clearTimeout(timeout.current);\n }\n if (shouldTriggerClick && !longPressTriggered) {\n onClick?.();\n }\n setLongPressTriggered(false);\n if (shouldPreventDefault && target.current) {\n target.current.removeEventListener('touchend', preventDefault);\n }\n },\n [shouldPreventDefault, onClick, longPressTriggered]\n );\n\n return {\n onMouseDown: (e: React.MouseEvent<T>) => start(e),\n onTouchStart: (e: React.TouchEvent<T>) => start(e),\n onKeyDown: (e: React.KeyboardEvent<T>) => {\n if (e.repeat || e.key !== key) return;\n start(e);\n },\n onMouseUp: () => clear(),\n onKeyUp: (e: React.KeyboardEvent<T>) => {\n if (e.repeat || e.key !== key) return;\n clear();\n },\n onMouseLeave: () => clear(false),\n onTouchEnd: () => clear()\n };\n};\n\n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EAAE,CAAC,KAAK,CAAC,KAAK,CAAC;QAChC,UAAU,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE;KAC1B,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import { useCallback, useRef, useState } from 'react';\n\nconst isTouchEvent = (e: Event): e is TouchEvent => {\n return 'touches' in e;\n};\n\nconst preventDefault = (e: Event) => {\n if (!isTouchEvent(e)) return;\n\n if (e.touches.length < 2 && e.preventDefault) {\n e.preventDefault();\n }\n};\n\ninterface Options {\n key?: string;\n delay?: number;\n shouldPreventDefault?: boolean;\n}\n\nconst useLongPress = <T>(\n onLongPress: () => void,\n onClick?: () => void,\n { key = 'Enter', shouldPreventDefault = true, delay = 500 }: Options = {}\n) => {\n const [longPressTriggered, setLongPressTriggered] = useState(false);\n const timeout = useRef<ReturnType<typeof setTimeout>>();\n const target = useRef<EventTarget>();\n\n const start = useCallback(\n (event: React.MouseEvent<T> | React.KeyboardEvent<T> | React.TouchEvent<T>) => {\n if (shouldPreventDefault && event.target) {\n event.target.addEventListener('touchend', preventDefault, {\n passive: false\n });\n target.current = event.target;\n }\n timeout.current = setTimeout(() => {\n onLongPress();\n setLongPressTriggered(true);\n }, delay);\n },\n [onLongPress, delay, shouldPreventDefault]\n );\n\n const clear = useCallback(\n (shouldTriggerClick = true) => {\n if (timeout.current) {\n clearTimeout(timeout.current);\n }\n if (shouldTriggerClick && !longPressTriggered) {\n onClick?.();\n }\n setLongPressTriggered(false);\n if (shouldPreventDefault && target.current) {\n target.current.removeEventListener('touchend', preventDefault);\n }\n },\n [shouldPreventDefault, onClick, longPressTriggered]\n );\n\n return {\n onMouseDown: (e: React.MouseEvent<T>) => start(e),\n onTouchStart: (e: React.TouchEvent<T>) => start(e),\n onKeyDown: (e: React.KeyboardEvent<T>) => {\n if (e.repeat || e.key !== key) return;\n start(e);\n },\n onMouseUp: () => clear(),\n onKeyUp: (e: React.KeyboardEvent<T>) => {\n if (e.repeat || e.key !== key) return;\n clear();\n },\n onMouseLeave: () => clear(false),\n onTouchEnd: () => clear()\n };\n};\n\nexport default useLongPress;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useOS.js","sourceRoot":"","sources":["../../src/hooks/useOS.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAEhD,IAAI,EAA0C,CAAC;AAE/C,MAAM,kBAAkB,GAAG,GAAc,EAAE;IACzC,IAAI,EAAE;QAAE,OAAO,EAAE,CAAC;IAElB,EAAE,GAAG,oBAAoB;QACvB,CAAC,CAAE,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,qBAAqB,CAAC,EAAE,CAAC,CAAC,CAGvC,IAAI,OAAO;QAC3B,CAAC,CAAC,EAAE,CAAC;IACP,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAEF,MAAM,KAAK,GAAG,GAAG,EAAE;IACjB,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CAAC,kBAAkB,CAAC,CAAC;IAE3E,UAAU;IACV,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,eAAe,EAAE;YACpB,kBAAkB,CAAC,kBAAkB,EAAE,CAAC,CAAC;SAC1C;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO;QACL,OAAO,EAAE,eAAe,KAAK,SAAS;QACtC,SAAS,EAAE,eAAe,KAAK,WAAW;QAC1C,IAAI,EAAE,eAAe;KACtB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,KAAK,CAAC","sourcesContent":["import { useEffect, useState } from 'react';\n\nimport { navigatorIsAvailable } from '../utils';\n\nlet os: 'Windows' | 'Macintosh' | 'Other' | '';\n\nconst getOperatingSystem = (): typeof os => {\n if (os) return os;\n\n os = navigatorIsAvailable\n ? (navigator.userAgent.match(/(Windows|Macintosh)/)?.[0] as\n | 'Windows'\n | 'Macintosh'\n | undefined) || 'Other'\n : '';\n return os;\n};\n\nconst useOS = () => {\n const [operatingSystem, setOperatingSystem] = useState(getOperatingSystem);\n\n // For SSR\n useEffect(() => {\n if (!operatingSystem) {\n setOperatingSystem(getOperatingSystem());\n }\n }, []);\n\n return {\n windows: operatingSystem === 'Windows',\n macintosh: operatingSystem === 'Macintosh',\n name: operatingSystem\n };\n};\n\nexport default useOS;\n"]}
1
+ {"version":3,"file":"useOS.js","sourceRoot":"","sources":["../../src/hooks/useOS.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAEhD,IAAI,EAA0C,CAAC;AAE/C,MAAM,kBAAkB,GAAG,GAAc,EAAE;IACzC,IAAI,EAAE;QAAE,OAAO,EAAE,CAAC;IAElB,EAAE,GAAG,oBAAoB;QACvB,CAAC,CAAE,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,qBAAqB,CAAC,EAAE,CAAC,CAAC,CAGvC,IAAI,OAAO;QAC3B,CAAC,CAAC,EAAE,CAAC;IACP,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAEF,MAAM,KAAK,GAAG,GAAG,EAAE;IACjB,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CAAC,kBAAkB,CAAC,CAAC;IAE3E,UAAU;IACV,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,eAAe,EAAE,CAAC;YACrB,kBAAkB,CAAC,kBAAkB,EAAE,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO;QACL,OAAO,EAAE,eAAe,KAAK,SAAS;QACtC,SAAS,EAAE,eAAe,KAAK,WAAW;QAC1C,IAAI,EAAE,eAAe;KACtB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,KAAK,CAAC","sourcesContent":["import { useEffect, useState } from 'react';\n\nimport { navigatorIsAvailable } from '../utils';\n\nlet os: 'Windows' | 'Macintosh' | 'Other' | '';\n\nconst getOperatingSystem = (): typeof os => {\n if (os) return os;\n\n os = navigatorIsAvailable\n ? (navigator.userAgent.match(/(Windows|Macintosh)/)?.[0] as\n | 'Windows'\n | 'Macintosh'\n | undefined) || 'Other'\n : '';\n return os;\n};\n\nconst useOS = () => {\n const [operatingSystem, setOperatingSystem] = useState(getOperatingSystem);\n\n // For SSR\n useEffect(() => {\n if (!operatingSystem) {\n setOperatingSystem(getOperatingSystem());\n }\n }, []);\n\n return {\n windows: operatingSystem === 'Windows',\n macintosh: operatingSystem === 'Macintosh',\n name: operatingSystem\n };\n};\n\nexport default useOS;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useOuterEvent.d.ts","sourceRoot":"","sources":["../../src/hooks/useOuterEvent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC;;;;;GAKG;AACH,QAAA,MAAM,aAAa,wFAEV,CAAC,IAAI,GAAG,IAAI,GAAG,UAAU,IAAI,GAAG,IAAI,CAAC,CAAC,EAAE,mDACE,IAAI,KACpD,IA0DF,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"useOuterEvent.d.ts","sourceRoot":"","sources":["../../src/hooks/useOuterEvent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC;;;;;GAKG;AACH,QAAA,MAAM,aAAa,GAAI,SAAS,SAAS,MAAM,gBAAgB,aAClD,SAAS,GAAG,SAAS,EAAE,SAC3B,CAAC,IAAI,GAAG,IAAI,GAAG,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,EAAE,WACtC,CAAC,KAAK,EAAE,gBAAgB,CAAC,SAAS,CAAC,KAAK,IAAI,KACpD,IA0DF,CAAC;AAEF,eAAe,aAAa,CA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efObject } from 'react';\n\nimport { getAllPopovers, normalizeTargets } from '../utils';\n/**\n * @example useOuterEvent(eventName, [nodes], handler = () => { doSomething; });\n * @param eventName The type of event to trigger the handler function on. Reference [DocumentEventMap](https://microsoft.github.io/PowerBI-JavaScript/interfaces/_node_modules_typedoc_node_modules_typescript_lib_lib_dom_d_.documenteventmap.html) for a list of valid events.\n * @param nodes An array of Nodes or Refs to Nodes to attach the eventName to.\n * @param handler The function that is called when the given event occurs.\n */\nconst useOuterEvent = <EventName extends keyof DocumentEventMap>(\n eventName: EventName | EventName[],\n nodes: (Node | null | RefObject<Node | null>)[],\n handler: (event: DocumentEventMap[EventName]) => void\n): void => {\n const onEvent: typeof handler = useCallback(\n event => {\n const path = event.composedPath();\n const target = path[0];\n\n if (!(target instanceof Node)) return;\n\n let childIdx = 0;\n let parentIdx = 1;\n while (path[childIdx] !== document) {\n const child = path[childIdx];\n const parent = path[parentIdx];\n\n if (!child || !parent) return;\n\n if (parent instanceof DocumentFragment || parent instanceof Document) {\n if (!(child instanceof Node) || !parent.contains(child)) return;\n\n childIdx = parentIdx;\n } else if (child instanceof DocumentFragment) {\n if (!(parent instanceof Element) || parent.shadowRoot !== child) return;\n\n childIdx = parentIdx;\n }\n\n parentIdx += 1;\n }\n\n const normalizedNodes = normalizeTargets(nodes).flatMap(node => {\n if (\n !(node instanceof Element) &&\n !(node instanceof Document) &&\n !(node instanceof DocumentFragment)\n ) {\n return [node];\n }\n\n return [node, ...getAllPopovers(node)];\n });\n\n if (\n normalizedNodes.every(node => {\n return node !== target && !node.contains(target);\n })\n ) {\n handler(event);\n }\n },\n [...nodes, handler]\n );\n\n useEffect(() => {\n const eventNames = Array.isArray(eventName) ? eventName : [eventName];\n\n eventNames.forEach(event => document.addEventListener(event, onEvent));\n return () => eventNames.forEach(event => document.removeEventListener(event, onEvent));\n }, [eventName, onEvent]);\n};\n\nexport default useOuterEvent;\n"]}
1
+ {"version":3,"file":"useOuterEvent.js","sourceRoot":"","sources":["../../src/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'react';\n\nimport { getAllPopovers, normalizeTargets } from '../utils';\n/**\n * @example useOuterEvent(eventName, [nodes], handler = () => { doSomething; });\n * @param eventName The type of event to trigger the handler function on. Reference [DocumentEventMap](https://microsoft.github.io/PowerBI-JavaScript/interfaces/_node_modules_typedoc_node_modules_typescript_lib_lib_dom_d_.documenteventmap.html) for a list of valid events.\n * @param nodes An array of Nodes or Refs to Nodes to attach the eventName to.\n * @param handler The function that is called when the given event occurs.\n */\nconst useOuterEvent = <EventName extends keyof DocumentEventMap>(\n eventName: EventName | EventName[],\n nodes: (Node | null | RefObject<Node | null>)[],\n handler: (event: DocumentEventMap[EventName]) => void\n): void => {\n const onEvent: typeof handler = useCallback(\n event => {\n const path = event.composedPath();\n const target = path[0];\n\n if (!(target instanceof Node)) return;\n\n let childIdx = 0;\n let parentIdx = 1;\n while (path[childIdx] !== document) {\n const child = path[childIdx];\n const parent = path[parentIdx];\n\n if (!child || !parent) return;\n\n if (parent instanceof DocumentFragment || parent instanceof Document) {\n if (!(child instanceof Node) || !parent.contains(child)) return;\n\n childIdx = parentIdx;\n } else if (child instanceof DocumentFragment) {\n if (!(parent instanceof Element) || parent.shadowRoot !== child) return;\n\n childIdx = parentIdx;\n }\n\n parentIdx += 1;\n }\n\n const normalizedNodes = normalizeTargets(nodes).flatMap(node => {\n if (\n !(node instanceof Element) &&\n !(node instanceof Document) &&\n !(node instanceof DocumentFragment)\n ) {\n return [node];\n }\n\n return [node, ...getAllPopovers(node)];\n });\n\n if (\n normalizedNodes.every(node => {\n return node !== target && !node.contains(target);\n })\n ) {\n handler(event);\n }\n },\n [...nodes, handler]\n );\n\n useEffect(() => {\n const eventNames = Array.isArray(eventName) ? eventName : [eventName];\n\n eventNames.forEach(event => document.addEventListener(event, onEvent));\n return () => eventNames.forEach(event => document.removeEventListener(event, onEvent));\n }, [eventName, onEvent]);\n};\n\nexport default useOuterEvent;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"usePrevious.d.ts","sourceRoot":"","sources":["../../src/hooks/usePrevious.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,QAAA,MAAM,WAAW,gCAOhB,CAAC;AAEF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"usePrevious.d.ts","sourceRoot":"","sources":["../../src/hooks/usePrevious.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,QAAA,MAAM,WAAW,GAAI,CAAC,SAAS,CAAC,kBAO/B,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useRefMap.d.ts","sourceRoot":"","sources":["../../src/hooks/useRefMap.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEzC;;;GAGG;AACH,QAAA,MAAM,SAAS,iCAI2B,MAAM,oBAmB/C,CAAC;AAEF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"useRefMap.d.ts","sourceRoot":"","sources":["../../src/hooks/useRefMap.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEzC;;;GAGG;AACH,QAAA,MAAM,SAAS,GAAI,CAAC,6BAIsB,MAAM,KAAG,WAAW,CAAC,CAAC,CAAC,CAmBhE,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useRefMap.js","sourceRoot":"","sources":["../../src/hooks/useRefMap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAG9C;;;GAGG;AACH,MAAM,SAAS,GAAG,GAAM,EAAE;IACxB,MAAM,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,GAAG,EAAa,CAAC,CAAC;IACnD,MAAM,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,GAAG,EAA0B,CAAC,CAAC;IAElE,MAAM,cAAc,GAAG,WAAW,CAAC,CAAC,EAAU,EAAkB,EAAE;QAChE,IAAI,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE;YACjB,OAAO,KAAK,CAAC,GAAG,CAAC,EAAE,CAAE,CAAC;SACvB;QAED,MAAM,EAAE,GAAmB,EAAE,CAAC,EAAE;YAC9B,IAAI,EAAE,KAAK,IAAI,EAAE;gBACf,GAAG,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;aACjB;iBAAM;gBACL,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;aAChB;QACH,CAAC,CAAC;QAEF,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QAElB,OAAO,EAAE,CAAC;IACZ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CAAC,GAAG,EAAE,cAAc,CAA4D,CAAC;AAC1F,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import { useCallback, useState } from 'react';\nimport type { RefCallback } from 'react';\n\n/**\n * @see [React docs for suggested pattern](https://react.dev/learn/manipulating-the-dom-with-refs#how-to-manage-a-list-of-refs-using-a-ref-callback)\n * @returns A tuple containing a map of refs and a function to get a ref callback for a given id.\n */\nconst useRefMap = <T>() => {\n const [map] = useState(() => new Map<string, T>());\n const [cbMap] = useState(() => new Map<string, RefCallback<T>>());\n\n const getCallbackRef = useCallback((id: string): RefCallback<T> => {\n if (cbMap.has(id)) {\n return cbMap.get(id)!;\n }\n\n const cb: RefCallback<T> = el => {\n if (el !== null) {\n map.set(id, el);\n } else {\n map.delete(id);\n }\n };\n\n cbMap.set(id, cb);\n\n return cb;\n }, []);\n\n return [map, getCallbackRef] satisfies [Map<string, T>, (id: string) => RefCallback<T>];\n};\n\nexport default useRefMap;\n"]}
1
+ {"version":3,"file":"useRefMap.js","sourceRoot":"","sources":["../../src/hooks/useRefMap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAG9C;;;GAGG;AACH,MAAM,SAAS,GAAG,GAAM,EAAE;IACxB,MAAM,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,GAAG,EAAa,CAAC,CAAC;IACnD,MAAM,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,GAAG,EAA0B,CAAC,CAAC;IAElE,MAAM,cAAc,GAAG,WAAW,CAAC,CAAC,EAAU,EAAkB,EAAE;QAChE,IAAI,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;YAClB,OAAO,KAAK,CAAC,GAAG,CAAC,EAAE,CAAE,CAAC;QACxB,CAAC;QAED,MAAM,EAAE,GAAmB,EAAE,CAAC,EAAE;YAC9B,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC;gBAChB,GAAG,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;YAClB,CAAC;iBAAM,CAAC;gBACN,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YACjB,CAAC;QACH,CAAC,CAAC;QAEF,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QAElB,OAAO,EAAE,CAAC;IACZ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CAAC,GAAG,EAAE,cAAc,CAA4D,CAAC;AAC1F,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import { useCallback, useState } from 'react';\nimport type { RefCallback } from 'react';\n\n/**\n * @see [React docs for suggested pattern](https://react.dev/learn/manipulating-the-dom-with-refs#how-to-manage-a-list-of-refs-using-a-ref-callback)\n * @returns A tuple containing a map of refs and a function to get a ref callback for a given id.\n */\nconst useRefMap = <T>() => {\n const [map] = useState(() => new Map<string, T>());\n const [cbMap] = useState(() => new Map<string, RefCallback<T>>());\n\n const getCallbackRef = useCallback((id: string): RefCallback<T> => {\n if (cbMap.has(id)) {\n return cbMap.get(id)!;\n }\n\n const cb: RefCallback<T> = el => {\n if (el !== null) {\n map.set(id, el);\n } else {\n map.delete(id);\n }\n };\n\n cbMap.set(id, cb);\n\n return cb;\n }, []);\n\n return [map, getCallbackRef] satisfies [Map<string, T>, (id: string) => RefCallback<T>];\n};\n\nexport default useRefMap;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useScrollStick.js","sourceRoot":"","sources":["../../src/hooks/useScrollStick.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAmBhD,MAAM,cAAc,GAAG,GAAG,EAAE;IAC1B,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACxB,CAAC,CAAC;AAEF,MAAM,QAAQ;IACZ,eAAe,CAAuB;IACtC,MAAM,CAAS;IACf,eAAe,CAAS;IACxB,eAAe,CAAS;IACxB,eAAe,CAAU;IACzB,oBAAoB,CAAS;IAC7B,qBAAqB,CAAS;IAC9B,gBAAgB,CAAS;IACzB,aAAa,CAAS;IACtB,cAAc,CAAS;IACvB,iBAAiB,CAAS;IAC1B,YAAY,CAAU;IACtB,iBAAiB,CAAS;IAC1B,iBAAiB,CAAS;IAC1B,SAAS,CAAe;IACxB,cAAc,CAAa;IAC3B,cAAc,CAAa;IAE3B,YAAY,EAAE,QAAQ,EAAE,eAAe,GAAG,MAAM,EAAE,MAAM,GAAG,CAAC,EAAsB;QAChF,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,IAAI,CAAC,eAAe,GAAG,GAAG,CAAC;QAC3B,IAAI,CAAC,eAAe,GAAG,GAAG,CAAC;QAC3B,IAAI,CAAC,cAAc,GAAG,GAAG,CAAC;QAC1B,IAAI,CAAC,iBAAiB,GAAG,GAAG,CAAC;QAC7B,IAAI,CAAC,aAAa,GAAG,GAAG,CAAC;QACzB,IAAI,CAA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AY,CAAC;IAEpC,eAAe,CAAC,GAAG,EAAE;QACnB,IAAI,OAAO,EAAE,QAAQ,EAAE;YACrB,QAAQ,CAAC,OAAO,GAAG,IAAI,QAAQ,CAAC,OAAO,CAAC,CAAC;SAC1C;QAED,OAAO,GAAG,EAAE;YACV,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC;YAC5B,QAAQ,CAAC,OAAO,GAAG,SAAS,CAAC;QAC/B,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,OAAO,EAAE,QAAQ,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AAChF,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import { useRef, useLayoutEffect } from 'react';\n\nexport interface ScrollStickOptions {\n elements: string | HTMLElement[] | Set<HTMLElement>;\n scrollContainer?: Stickers['scrollContainer'];\n offset?: number;\n}\n\ninterface Sticker {\n element: HTMLElement;\n top: number;\n bottom: number;\n height: number;\n isStuck: boolean;\n priorStickHeight: number;\n}\n\ntype ElementsOption = ScrollStickOptions['elements'];\n\nconst onBeforeunload = () => {\n window.scrollTo(0, 0);\n};\n\nclass Stickers {\n scrollContainer: HTMLElement | Window;\n offset: number;\n #scrollDebounce: number;\n #resizeDebounce: number;\n #isWindowScroll: boolean;\n #scrollIntervalStart: number;\n #scrollIntervalChange: number;\n #scrollDirection: number;\n #priorScrollY: number;\n #resizeTimeout: number;\n #scrollEndTimeout: number;\n #isScrolling: boolean;\n #vpHeightSnapshot: number;\n #sfHeightSnapshot: number;\n #stickers: Set<Sticker>;\n #scrollHandler: () => void;\n #resizeHandler: () => void;\n\n constructor({ elements, scrollContainer = window, offset = 0 }: ScrollStickOptions) {\n this.scrollContainer = scrollContainer;\n this.offset = offset;\n\n this.#scrollDebounce = 100;\n this.#resizeDebounce = 300;\n this.#resizeTimeout = NaN;\n this.#scrollEndTimeout = NaN;\n this.#priorScrollY = NaN;\n this.#isScrolling = false;\n this.#vpHeightSnapshot = NaN;\n this.#sfHeightSnapshot = NaN;\n this.#scrollHandler = () => {};\n this.#resizeHandler = () => {};\n\n this.#isWindowScroll = this.scrollContainer === window;\n\n // Only gets reset after scroll stop timeout fires\n this.#scrollIntervalStart = this.getScrollY();\n\n // Used to determine scroll change within debounced scroll handler\n this.#scrollIntervalChange = 0;\n\n // Used to determine scroll direction by +1(page down) -1(page up)\n this.#scrollDirection = 0;\n\n this.#stickers = this.setStickers(elements);\n this.snapshotItemRects();\n this.addHandlers();\n this.testForStick();\n }\n\n setStickers(elements: ElementsOption) {\n this.#stickers = new Set(\n (typeof elements === 'string'\n ? [...document.querySelectorAll<HTMLElement>(elements)]\n : [...elements]\n ).map(element => ({\n element,\n isStuck: false,\n top: NaN,\n bottom: NaN,\n height: NaN,\n priorStickHeight: NaN\n }))\n );\n\n return this.#stickers;\n }\n\n addHandlers() {\n this.rmHandlers();\n this.#scrollHandler = this.onScroll.bind(this);\n this.#resizeHandler = this.onResize.bind(this);\n this.scrollContainer.addEventListener('scroll', this.#scrollHandler);\n window.addEventListener('resize', this.#resizeHandler);\n // Not sure we need this. Maybe when DOM was persisted...\n window.addEventListener('beforeunload', onBeforeunload);\n }\n\n rmHandlers() {\n this.scrollContainer.removeEventListener('scroll', this.#scrollHandler);\n window.removeEventListener('resize', this.#resizeHandler);\n window.removeEventListener('beforeunload', onBeforeunload);\n }\n\n snapshotItemRects() {\n this.#stickers.forEach(sticker => {\n const rect = sticker.element.getBoundingClientRect();\n sticker.top = rect.top;\n sticker.bottom = rect.bottom;\n sticker.height = rect.height;\n });\n }\n\n onScroll() {\n clearTimeout(this.#scrollEndTimeout);\n\n const currentScrollY = this.getScrollY();\n\n this.#priorScrollY = !Number.isNaN(this.#priorScrollY)\n ? this.#priorScrollY\n : this.#scrollIntervalStart;\n\n // Diff between priorScrollY and new currentScrollY to determine direction\n this.#scrollDirection = currentScrollY - this.#priorScrollY > 0 ? 1 : -1;\n\n // How much scroll changed + or - within the debounce interval\n this.#scrollIntervalChange = currentScrollY - this.#scrollIntervalStart;\n\n // Update old to new for next scroll event\n this.#priorScrollY = currentScrollY;\n\n // When scrolling has stopped\n this.#scrollEndTimeout = window.setTimeout(() => {\n // Reset for next scroll starting point\n this.#scrollIntervalStart = this.#priorScrollY;\n\n // Reset until next scroll\n this.#vpHeightSnapshot = NaN;\n this.#sfHeightSnapshot = NaN;\n\n this.#isScrolling = false;\n }, this.#scrollDebounce);\n\n // Additional scroll calls always have to test for stick state change\n if (this.#isScrolling) {\n this.testForStick();\n return;\n }\n\n // Only reaches here on first call and we note as in a scrolling state\n this.#isScrolling = true;\n\n // grab the current rect points for stickers to test against while scrolling\n this.snapshotItemRects();\n\n /**\n * Get once and cache until scroll settles\n * Unlikely to change and avoids additional reflows on scroll\n */\n this.#vpHeightSnapshot = this.getViewportHeight();\n this.#sfHeightSnapshot = this.getScrollFrameHeight();\n\n this.testForStick();\n }\n\n onResize() {\n clearTimeout(this.#resizeTimeout);\n this.#resizeTimeout = window.setTimeout(() => {\n this.snapshotItemRects();\n this.#stickers.forEach(sticker => {\n if (sticker.isStuck) this.addStick(sticker);\n });\n }, this.#resizeDebounce);\n }\n\n getScrollY() {\n return this.#isWindowScroll\n ? (this.scrollContainer as Window).scrollY\n : (this.scrollContainer as HTMLElement).scrollTop;\n }\n\n getViewportHeight() {\n // If we have a height snapshot use it since this has likely been called on scroll\n if (!Number.isNaN(this.#vpHeightSnapshot)) {\n return this.#vpHeightSnapshot;\n }\n\n return Math.max(document.documentElement.clientHeight, window.innerHeight || 0);\n }\n\n getScrollFrameHeight() {\n // If we have a height snapshot use it since this has likely been called on scroll\n if (!Number.isNaN(this.#sfHeightSnapshot)) {\n return this.#sfHeightSnapshot;\n }\n\n const viewportHeight = this.getViewportHeight();\n let sfh = viewportHeight;\n\n if (!this.#isWindowScroll) {\n sfh = viewportHeight - (this.scrollContainer as HTMLElement).getBoundingClientRect().top;\n }\n\n return sfh;\n }\n\n testBottomInView(sticker: Sticker) {\n const vph = this.getViewportHeight();\n const sfh = this.getScrollFrameHeight();\n const sic = this.#scrollIntervalChange;\n\n return sfh + sic + (vph - sfh) >= sticker.bottom + this.offset;\n }\n\n testForStick() {\n // Don't do anything if scrolling up\n if (this.#scrollDirection === -1) return;\n\n this.#stickers.forEach(sticker => {\n const bottomIsInView = this.testBottomInView(sticker);\n const hasHeightChange =\n !Number.isNaN(sticker.priorStickHeight) && sticker.height !== sticker.priorStickHeight;\n\n if (bottomIsInView) {\n if (!sticker.isStuck || hasHeightChange) {\n window.requestAnimationFrame(() => this.addStick(sticker));\n }\n } else if (sticker.isStuck && hasHeightChange) {\n const marginTop = this.getScrollY() + sticker.top - this.offset;\n\n window.requestAnimationFrame(() => {\n this.removeStick(sticker);\n sticker.element.style.marginTop = `${marginTop}px`;\n });\n }\n });\n\n return this;\n }\n\n addStick(sticker: Sticker) {\n sticker.element.style.position = 'sticky';\n sticker.element.style.marginTop = '';\n sticker.element.style.top = `${this.getStickTop(sticker)}px`;\n sticker.priorStickHeight = sticker.height;\n sticker.isStuck = true;\n return this;\n }\n\n removeStick(sticker: Sticker) {\n sticker.element.style.position = '';\n sticker.element.style.marginTop = '';\n sticker.element.style.top = '';\n sticker.isStuck = false;\n return this;\n }\n\n getStickTop(sticker: Sticker) {\n const spHeight = this.getScrollFrameHeight();\n let offset = this.offset;\n\n if (sticker.height + this.offset > spHeight) {\n offset = spHeight - sticker.height - offset;\n }\n\n return offset;\n }\n\n cleanup() {\n this.rmHandlers();\n this.#stickers.forEach(this.removeStick);\n }\n}\n\n/**\n * @example useScrollStick({ elements: [myColumnElements] | '.my-columns', offset: 20 });\n * @param options An object to set the sticky elements, the scroll container and an stuck offset in pixels.\n * @returns void.\n */\nconst useScrollStick = (options?: ScrollStickOptions): void => {\n const instance = useRef<Stickers>();\n\n useLayoutEffect(() => {\n if (options?.elements) {\n instance.current = new Stickers(options);\n }\n\n return () => {\n instance.current?.cleanup();\n instance.current = undefined;\n };\n }, [options?.scrollContainer, options?.offset, ...(options?.elements ?? [])]);\n};\n\nexport default useScrollStick;\n"]}
1
+ {"version":3,"file":"useScrollStick.js","sourceRoot":"","sources":["../../src/hooks/useScrollStick.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAmBhD,MAAM,cAAc,GAAG,GAAG,EAAE;IAC1B,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACxB,CAAC,CAAC;AAEF,MAAM,QAAQ;IACZ,eAAe,CAAuB;IACtC,MAAM,CAAS;IACf,eAAe,CAAS;IACxB,eAAe,CAAS;IACxB,eAAe,CAAU;IACzB,oBAAoB,CAAS;IAC7B,qBAAqB,CAAS;IAC9B,gBAAgB,CAAS;IACzB,aAAa,CAAS;IACtB,cAAc,CAAS;IACvB,iBAAiB,CAAS;IAC1B,YAAY,CAAU;IACtB,iBAAiB,CAAS;IAC1B,iBAAiB,CAAS;IAC1B,SAAS,CAAe;IACxB,cAAc,CAAa;IAC3B,cAAc,CAAa;IAE3B,YAAY,EAAE,QAAQ,EAAE,eAAe,GAAG,MAAM,EAAE,MAAM,GAAG,CAAC,EAAsB;QAChF,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,IAAI,CAAC,eAAe,GAAG,GAAG,CAAC;QAC3B,IAAI,CAAC,eAAe,GAAG,GAAG,CAAC;QAC3B,IAAI,CAAC,cAAc,GAAG,GAAG,CAAC;QAC1B,IAAI,CAAC,iBAAiB,GAAG,GAAG,CAAC;QAC7B,IAAI,CAAC,aAAa,GAAG,GAAG,CAAC;QACzB,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;QAC1B,IAAI,CAAC,iBAAiB,GAAG,GAAG,CAAC;QAC7B,IAAI,CAAC,iBAAiB,GAAG,GAAG,CAAC;QAC7B,IAAI,CAAC,cAAc,GA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AI,OAAO,EAAE,QAAQ,EAAE,CAAC;YACtB,QAAQ,CAAC,OAAO,GAAG,IAAI,QAAQ,CAAC,OAAO,CAAC,CAAC;QAC3C,CAAC;QAED,OAAO,GAAG,EAAE;YACV,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC;YAC5B,QAAQ,CAAC,OAAO,GAAG,SAAS,CAAC;QAC/B,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,OAAO,EAAE,QAAQ,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AAChF,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import { useRef, useLayoutEffect } from 'react';\n\nexport interface ScrollStickOptions {\n elements: string | HTMLElement[] | Set<HTMLElement>;\n scrollContainer?: Stickers['scrollContainer'];\n offset?: number;\n}\n\ninterface Sticker {\n element: HTMLElement;\n top: number;\n bottom: number;\n height: number;\n isStuck: boolean;\n priorStickHeight: number;\n}\n\ntype ElementsOption = ScrollStickOptions['elements'];\n\nconst onBeforeunload = () => {\n window.scrollTo(0, 0);\n};\n\nclass Stickers {\n scrollContainer: HTMLElement | Window;\n offset: number;\n #scrollDebounce: number;\n #resizeDebounce: number;\n #isWindowScroll: boolean;\n #scrollIntervalStart: number;\n #scrollIntervalChange: number;\n #scrollDirection: number;\n #priorScrollY: number;\n #resizeTimeout: number;\n #scrollEndTimeout: number;\n #isScrolling: boolean;\n #vpHeightSnapshot: number;\n #sfHeightSnapshot: number;\n #stickers: Set<Sticker>;\n #scrollHandler: () => void;\n #resizeHandler: () => void;\n\n constructor({ elements, scrollContainer = window, offset = 0 }: ScrollStickOptions) {\n this.scrollContainer = scrollContainer;\n this.offset = offset;\n\n this.#scrollDebounce = 100;\n this.#resizeDebounce = 300;\n this.#resizeTimeout = NaN;\n this.#scrollEndTimeout = NaN;\n this.#priorScrollY = NaN;\n this.#isScrolling = false;\n this.#vpHeightSnapshot = NaN;\n this.#sfHeightSnapshot = NaN;\n this.#scrollHandler = () => {};\n this.#resizeHandler = () => {};\n\n this.#isWindowScroll = this.scrollContainer === window;\n\n // Only gets reset after scroll stop timeout fires\n this.#scrollIntervalStart = this.getScrollY();\n\n // Used to determine scroll change within debounced scroll handler\n this.#scrollIntervalChange = 0;\n\n // Used to determine scroll direction by +1(page down) -1(page up)\n this.#scrollDirection = 0;\n\n this.#stickers = this.setStickers(elements);\n this.snapshotItemRects();\n this.addHandlers();\n this.testForStick();\n }\n\n setStickers(elements: ElementsOption) {\n this.#stickers = new Set(\n (typeof elements === 'string'\n ? [...document.querySelectorAll<HTMLElement>(elements)]\n : [...elements]\n ).map(element => ({\n element,\n isStuck: false,\n top: NaN,\n bottom: NaN,\n height: NaN,\n priorStickHeight: NaN\n }))\n );\n\n return this.#stickers;\n }\n\n addHandlers() {\n this.rmHandlers();\n this.#scrollHandler = this.onScroll.bind(this);\n this.#resizeHandler = this.onResize.bind(this);\n this.scrollContainer.addEventListener('scroll', this.#scrollHandler);\n window.addEventListener('resize', this.#resizeHandler);\n // Not sure we need this. Maybe when DOM was persisted...\n window.addEventListener('beforeunload', onBeforeunload);\n }\n\n rmHandlers() {\n this.scrollContainer.removeEventListener('scroll', this.#scrollHandler);\n window.removeEventListener('resize', this.#resizeHandler);\n window.removeEventListener('beforeunload', onBeforeunload);\n }\n\n snapshotItemRects() {\n this.#stickers.forEach(sticker => {\n const rect = sticker.element.getBoundingClientRect();\n sticker.top = rect.top;\n sticker.bottom = rect.bottom;\n sticker.height = rect.height;\n });\n }\n\n onScroll() {\n clearTimeout(this.#scrollEndTimeout);\n\n const currentScrollY = this.getScrollY();\n\n this.#priorScrollY = !Number.isNaN(this.#priorScrollY)\n ? this.#priorScrollY\n : this.#scrollIntervalStart;\n\n // Diff between priorScrollY and new currentScrollY to determine direction\n this.#scrollDirection = currentScrollY - this.#priorScrollY > 0 ? 1 : -1;\n\n // How much scroll changed + or - within the debounce interval\n this.#scrollIntervalChange = currentScrollY - this.#scrollIntervalStart;\n\n // Update old to new for next scroll event\n this.#priorScrollY = currentScrollY;\n\n // When scrolling has stopped\n this.#scrollEndTimeout = window.setTimeout(() => {\n // Reset for next scroll starting point\n this.#scrollIntervalStart = this.#priorScrollY;\n\n // Reset until next scroll\n this.#vpHeightSnapshot = NaN;\n this.#sfHeightSnapshot = NaN;\n\n this.#isScrolling = false;\n }, this.#scrollDebounce);\n\n // Additional scroll calls always have to test for stick state change\n if (this.#isScrolling) {\n this.testForStick();\n return;\n }\n\n // Only reaches here on first call and we note as in a scrolling state\n this.#isScrolling = true;\n\n // grab the current rect points for stickers to test against while scrolling\n this.snapshotItemRects();\n\n /**\n * Get once and cache until scroll settles\n * Unlikely to change and avoids additional reflows on scroll\n */\n this.#vpHeightSnapshot = this.getViewportHeight();\n this.#sfHeightSnapshot = this.getScrollFrameHeight();\n\n this.testForStick();\n }\n\n onResize() {\n clearTimeout(this.#resizeTimeout);\n this.#resizeTimeout = window.setTimeout(() => {\n this.snapshotItemRects();\n this.#stickers.forEach(sticker => {\n if (sticker.isStuck) this.addStick(sticker);\n });\n }, this.#resizeDebounce);\n }\n\n getScrollY() {\n return this.#isWindowScroll\n ? (this.scrollContainer as Window).scrollY\n : (this.scrollContainer as HTMLElement).scrollTop;\n }\n\n getViewportHeight() {\n // If we have a height snapshot use it since this has likely been called on scroll\n if (!Number.isNaN(this.#vpHeightSnapshot)) {\n return this.#vpHeightSnapshot;\n }\n\n return Math.max(document.documentElement.clientHeight, window.innerHeight || 0);\n }\n\n getScrollFrameHeight() {\n // If we have a height snapshot use it since this has likely been called on scroll\n if (!Number.isNaN(this.#sfHeightSnapshot)) {\n return this.#sfHeightSnapshot;\n }\n\n const viewportHeight = this.getViewportHeight();\n let sfh = viewportHeight;\n\n if (!this.#isWindowScroll) {\n sfh = viewportHeight - (this.scrollContainer as HTMLElement).getBoundingClientRect().top;\n }\n\n return sfh;\n }\n\n testBottomInView(sticker: Sticker) {\n const vph = this.getViewportHeight();\n const sfh = this.getScrollFrameHeight();\n const sic = this.#scrollIntervalChange;\n\n return sfh + sic + (vph - sfh) >= sticker.bottom + this.offset;\n }\n\n testForStick() {\n // Don't do anything if scrolling up\n if (this.#scrollDirection === -1) return;\n\n this.#stickers.forEach(sticker => {\n const bottomIsInView = this.testBottomInView(sticker);\n const hasHeightChange =\n !Number.isNaN(sticker.priorStickHeight) && sticker.height !== sticker.priorStickHeight;\n\n if (bottomIsInView) {\n if (!sticker.isStuck || hasHeightChange) {\n window.requestAnimationFrame(() => this.addStick(sticker));\n }\n } else if (sticker.isStuck && hasHeightChange) {\n const marginTop = this.getScrollY() + sticker.top - this.offset;\n\n window.requestAnimationFrame(() => {\n this.removeStick(sticker);\n sticker.element.style.marginTop = `${marginTop}px`;\n });\n }\n });\n\n return this;\n }\n\n addStick(sticker: Sticker) {\n sticker.element.style.position = 'sticky';\n sticker.element.style.marginTop = '';\n sticker.element.style.top = `${this.getStickTop(sticker)}px`;\n sticker.priorStickHeight = sticker.height;\n sticker.isStuck = true;\n return this;\n }\n\n removeStick(sticker: Sticker) {\n sticker.element.style.position = '';\n sticker.element.style.marginTop = '';\n sticker.element.style.top = '';\n sticker.isStuck = false;\n return this;\n }\n\n getStickTop(sticker: Sticker) {\n const spHeight = this.getScrollFrameHeight();\n let offset = this.offset;\n\n if (sticker.height + this.offset > spHeight) {\n offset = spHeight - sticker.height - offset;\n }\n\n return offset;\n }\n\n cleanup() {\n this.rmHandlers();\n this.#stickers.forEach(this.removeStick);\n }\n}\n\n/**\n * @example useScrollStick({ elements: [myColumnElements] | '.my-columns', offset: 20 });\n * @param options An object to set the sticky elements, the scroll container and an stuck offset in pixels.\n * @returns void.\n */\nconst useScrollStick = (options?: ScrollStickOptions): void => {\n const instance = useRef<Stickers>();\n\n useLayoutEffect(() => {\n if (options?.elements) {\n instance.current = new Stickers(options);\n }\n\n return () => {\n instance.current?.cleanup();\n instance.current = undefined;\n };\n }, [options?.scrollContainer, options?.offset, ...(options?.elements ?? [])]);\n};\n\nexport default useScrollStick;\n"]}
@@ -5,7 +5,7 @@ import type { ShortcutAction } from '../components/ShortcutManager/ShortcutManag
5
5
  * @param callback function that should be invoked when given action gets triggered
6
6
  * @returns current shortcut bound to the given action in form of accelerator
7
7
  */
8
- declare const useShortcut: (actionId: ShortcutAction['id'], callback: (e: ShortcutEvent) => void) => {
8
+ declare const useShortcut: (actionId: ShortcutAction["id"], callback: (e: ShortcutEvent) => void) => {
9
9
  binding?: string;
10
10
  };
11
11
  export default useShortcut;
@@ -1 +1 @@
1
- {"version":3,"file":"useShortcut.d.ts","sourceRoot":"","sources":["../../src/hooks/useShortcut.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qDAAqD,CAAC;AAM1F;;;;;GAKG;AACH,QAAA,MAAM,WAAW,aACL,cAAc,CAAC,IAAI,CAAC,gBAChB,aAAa,KAAK,IAAI,KACnC;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAgBpB,CAAC;AAEF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"useShortcut.d.ts","sourceRoot":"","sources":["../../src/hooks/useShortcut.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qDAAqD,CAAC;AAM1F;;;;;GAKG;AACH,QAAA,MAAM,WAAW,aACL,cAAc,CAAC,IAAI,CAAC,YACpB,CAAC,CAAC,EAAE,aAAa,KAAK,IAAI,KACnC;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAgBpB,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useSimpleStore.d.ts","sourceRoot":"","sources":["../../src/hooks/useSimpleStore.ts"],"names":[],"mappings":"AAEA,KAAK,QAAQ,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;AACtC,KAAK,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,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CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AACrD,CAAC;IAED,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;IAErE,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,QAAQ,GAAgB,QAAQ,CAAC,EAAE;YACvC,QAAQ,CAAC,aAAa,CAAC,EAAE;gBACvB,MAAM,SAAS,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC;gBAErC,OAAO,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC;YACpE,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;QAEF,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QAE1B,OAAO,GAAG,EAAE;YACV,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QAC9B,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAU,CAAC;AAC1C,CAAC;AAED,eAAe,cAAc,CAAC","sourcesContent":["import { useEffect, useState } from 'react';\n\ntype Listener<T> = (state: T) => void;\ntype SetStateArg<T> = ((currentState: T) => T) | T;\n\nexport interface SimpleStore<T> {\n readonly subscribe: (listener: Listener<T>) => void;\n readonly unsubscribe: (listener: Listener<T>) => void;\n readonly getStore: () => T;\n readonly setStore: (arg: SetStateArg<T>) => T;\n}\n\nexport const createSimpleStore = <T extends Record<string, unknown>>(\n initialStore: T\n): SimpleStore<T> => {\n let currentStore = initialStore;\n const listeners = new Set<Listener<T>>();\n\n return {\n subscribe: listener => {\n listeners.add(listener);\n },\n unsubscribe: listener => {\n listeners.delete(listener);\n },\n getStore: () => currentStore,\n setStore: (arg: SetStateArg<T>) => {\n if (typeof arg === 'function') {\n currentStore = arg(currentStore);\n } else {\n currentStore = arg;\n }\n\n listeners.forEach(listener => listener(currentStore));\n return currentStore;\n }\n };\n};\n\nfunction useSimpleStore<T extends Record<string, unknown>>(\n store: SimpleStore<T>\n): [T, SimpleStore<T>['setStore']];\n\nfunction useSimpleStore<T extends Record<string, unknown>, U = T>(\n store: SimpleStore<T>,\n selector: (store: T) => U,\n eqFn?: (prev: U, next: U) => boolean\n): [U, SimpleStore<T>['setStore']];\n\n// A hook to \"connect\" local state to a shared store\nfunction useSimpleStore<T extends Record<string, unknown>, U = T>(\n store: SimpleStore<T>,\n selector: (store: T) => U | T = val => val,\n eqFn: (prev: U | T, next: U | T) => boolean = (prev, next) => {\n if (!Array.isArray(prev) || !Array.isArray(next)) return prev === next;\n\n if (prev.length !== next.length) return false;\n\n return prev.every((value, i) => value === next[i]);\n }\n) {\n const [state, setState] = useState(() => selector(store.getStore()));\n\n useEffect(() => {\n const listener: Listener<T> = newState => {\n setState(previousState => {\n const nextState = selector(newState);\n\n return eqFn(previousState, nextState) ? previousState : nextState;\n });\n };\n\n store.subscribe(listener);\n\n return () => {\n store.unsubscribe(listener);\n };\n }, []);\n\n return [state, store.setStore] as const;\n}\n\nexport default useSimpleStore;\n"]}
1
+ {"version":3,"file":"useSimpleStore.js","sourceRoot":"","sources":["../../src/hooks/useSimpleStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAY5C,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,YAAe,EACC,EAAE;IAClB,IAAI,YAAY,GAAG,YAAY,CAAC;IAChC,MAAM,SAAS,GAAG,IAAI,GAAG,EAAe,CAAC;IAEzC,OAAO;QACL,SAAS,EAAE,QAAQ,CAAC,EAAE;YACpB,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC1B,CAAC;QACD,WAAW,EAAE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,EAAE;gBACvB,MAAM,SAAS,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC;gBAErC,OAAO,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC;YACpE,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;QAEF,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QAE1B,OAAO,GAAG,EAAE;YACV,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QAC9B,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAU,CAAC;AAC1C,CAAC;AAED,eAAe,cAAc,CAAC","sourcesContent":["import { useEffect, useState } from 'react';\n\ntype Listener<T> = (state: T) => void;\ntype SetStateArg<T> = ((currentState: T) => T) | T;\n\nexport interface SimpleStore<T> {\n readonly subscribe: (listener: Listener<T>) => void;\n readonly unsubscribe: (listener: Listener<T>) => void;\n readonly getStore: () => T;\n readonly setStore: (arg: SetStateArg<T>) => T;\n}\n\nexport const createSimpleStore = <T extends Record<string, unknown>>(\n initialStore: T\n): SimpleStore<T> => {\n let currentStore = initialStore;\n const listeners = new Set<Listener<T>>();\n\n return {\n subscribe: listener => {\n listeners.add(listener);\n },\n unsubscribe: listener => {\n listeners.delete(listener);\n },\n getStore: () => currentStore,\n setStore: (arg: SetStateArg<T>) => {\n if (typeof arg === 'function') {\n currentStore = arg(currentStore);\n } else {\n currentStore = arg;\n }\n\n listeners.forEach(listener => listener(currentStore));\n return currentStore;\n }\n };\n};\n\nfunction useSimpleStore<T extends Record<string, unknown>>(\n store: SimpleStore<T>\n): [T, SimpleStore<T>['setStore']];\n\nfunction useSimpleStore<T extends Record<string, unknown>, U = T>(\n store: SimpleStore<T>,\n selector: (store: T) => U,\n eqFn?: (prev: U, next: U) => boolean\n): [U, SimpleStore<T>['setStore']];\n\n// A hook to \"connect\" local state to a shared store\nfunction useSimpleStore<T extends Record<string, unknown>, U = T>(\n store: SimpleStore<T>,\n selector: (store: T) => U | T = val => val,\n eqFn: (prev: U | T, next: U | T) => boolean = (prev, next) => {\n if (!Array.isArray(prev) || !Array.isArray(next)) return prev === next;\n\n if (prev.length !== next.length) return false;\n\n return prev.every((value, i) => value === next[i]);\n }\n) {\n const [state, setState] = useState(() => selector(store.getStore()));\n\n useEffect(() => {\n const listener: Listener<T> = newState => {\n setState(previousState => {\n const nextState = selector(newState);\n\n return eqFn(previousState, nextState) ? previousState : nextState;\n });\n };\n\n store.subscribe(listener);\n\n return () => {\n store.unsubscribe(listener);\n };\n }, []);\n\n return [state, store.setStore] as const;\n}\n\nexport default useSimpleStore;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useSimpleStoreInstance.d.ts","sourceRoot":"","sources":["../../src/hooks/useSimpleStoreInstance.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,QAAA,MAAM,sBAAsB,mGAE3B,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
1
+ {"version":3,"file":"useSimpleStoreInstance.d.ts","sourceRoot":"","sources":["../../src/hooks/useSimpleStoreInstance.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,QAAA,MAAM,sBAAsB,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,gBAAgB,CAAC,8CAEjF,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
@@ -1,10 +1,11 @@
1
1
  import type { TestIdProp } from '../types';
2
+ import type { createTestIds } from '../utils';
2
3
  /**
3
4
  * @example const testIds = useTestIds(testIdProp: 'some-test-id', getSomeComponentTestIds);
4
5
  * @param testIdProp `testId` prop passed to the component.
5
6
  * @param getTestIds Function for generating test ids for a particular component.
6
7
  * @returns An empty object or an object with a root key and camelCased keys and values based on params.
7
8
  */
8
- declare const useTestIds: <F extends (testIdProp?: string | null | undefined) => import("../types").TestIdsRecord<readonly string[]>>(testIdProp: string | Partial<ReturnType<F>> | null | undefined, getTestIds: F) => Partial<ReturnType<F>>;
9
+ declare const useTestIds: <F extends ReturnType<typeof createTestIds>>(testIdProp: TestIdProp["testId"] | Partial<ReturnType<F>>, getTestIds: F) => Partial<ReturnType<F>>;
9
10
  export default useTestIds;
10
11
  //# sourceMappingURL=useTestIds.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useTestIds.d.ts","sourceRoot":"","sources":["../../src/hooks/useTestIds.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAK3C;;;;;GAKG;AAEH,QAAA,MAAM,UAAU,sNAef,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"useTestIds.d.ts","sourceRoot":"","sources":["../../src/hooks/useTestIds.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAI9C;;;;;GAKG;AAEH,QAAA,MAAM,UAAU,GAAI,CAAC,SAAS,UAAU,CAAC,OAAO,aAAa,CAAC,cAChD,UAAU,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,cAC7C,CAAC,KACZ,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAYvB,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useTestIds.js","sourceRoot":"","sources":["../../src/hooks/useTestIds.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAKhC,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAElD;;;;;GAKG;AAEH,MAAM,UAAU,GAAG,CACjB,UAAyD,EACzD,UAAa,EACW,EAAE;IAC1B,MAAM,EAAE,OAAO,EAAE,GAAG,gBAAgB,EAAE,CAAC;IAEvC,OAAO,OAAO,CAAC,GAAG,EAAE;QAClB,IAAI,CAAC,OAAO;YAAE,OAAO,EAAE,CAAC;QAExB,IAAI,OAAO,UAAU,KAAK,QAAQ,IAAI,UAAU,EAAE;YAChD,OAAO,UAAU,CAAC;SACnB;QAED,OAAO,UAAU,CAAC,UAAU,CAAC,CAAC;IAChC,CAAC,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC;AACxC,CAAC,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import { useMemo } from 'react';\n\nimport type { TestIdProp } from '../types';\nimport type { createTestIds } from '../utils';\n\nimport useConfiguration from './useConfiguration';\n\n/**\n * @example const testIds = useTestIds(testIdProp: 'some-test-id', getSomeComponentTestIds);\n * @param testIdProp `testId` prop passed to the component.\n * @param getTestIds Function for generating test ids for a particular component.\n * @returns An empty object or an object with a root key and camelCased keys and values based on params.\n */\n\nconst useTestIds = <F extends ReturnType<typeof createTestIds>>(\n testIdProp: TestIdProp['testId'] | Partial<ReturnType<F>>,\n getTestIds: F\n): Partial<ReturnType<F>> => {\n const { testIds } = useConfiguration();\n\n return useMemo(() => {\n if (!testIds) return {};\n\n if (typeof testIdProp === 'object' && testIdProp) {\n return testIdProp;\n }\n\n return getTestIds(testIdProp);\n }, [testIds, testIdProp, getTestIds]);\n};\n\nexport default useTestIds;\n"]}
1
+ {"version":3,"file":"useTestIds.js","sourceRoot":"","sources":["../../src/hooks/useTestIds.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAKhC,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAElD;;;;;GAKG;AAEH,MAAM,UAAU,GAAG,CACjB,UAAyD,EACzD,UAAa,EACW,EAAE;IAC1B,MAAM,EAAE,OAAO,EAAE,GAAG,gBAAgB,EAAE,CAAC;IAEvC,OAAO,OAAO,CAAC,GAAG,EAAE;QAClB,IAAI,CAAC,OAAO;YAAE,OAAO,EAAE,CAAC;QAExB,IAAI,OAAO,UAAU,KAAK,QAAQ,IAAI,UAAU,EAAE,CAAC;YACjD,OAAO,UAAU,CAAC;QACpB,CAAC;QAED,OAAO,UAAU,CAAC,UAAU,CAAC,CAAC;IAChC,CAAC,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC;AACxC,CAAC,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import { useMemo } from 'react';\n\nimport type { TestIdProp } from '../types';\nimport type { createTestIds } from '../utils';\n\nimport useConfiguration from './useConfiguration';\n\n/**\n * @example const testIds = useTestIds(testIdProp: 'some-test-id', getSomeComponentTestIds);\n * @param testIdProp `testId` prop passed to the component.\n * @param getTestIds Function for generating test ids for a particular component.\n * @returns An empty object or an object with a root key and camelCased keys and values based on params.\n */\n\nconst useTestIds = <F extends ReturnType<typeof createTestIds>>(\n testIdProp: TestIdProp['testId'] | Partial<ReturnType<F>>,\n getTestIds: F\n): Partial<ReturnType<F>> => {\n const { testIds } = useConfiguration();\n\n return useMemo(() => {\n if (!testIds) return {};\n\n if (typeof testIdProp === 'object' && testIdProp) {\n return testIdProp;\n }\n\n return getTestIds(testIdProp);\n }, [testIds, testIdProp, getTestIds]);\n};\n\nexport default useTestIds;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useTheme.d.ts","sourceRoot":"","sources":["../../src/hooks/useTheme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAItD;;;GAGG;AACH,QAAA,MAAM,QAAQ,oBAA8D,CAAC;AAE7E,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"useTheme.d.ts","sourceRoot":"","sources":["../../src/hooks/useTheme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAItD;;;GAGG;AACH,QAAA,MAAM,QAAQ,QAAkD,YAAY,CAAC;AAE7E,eAAe,QAAQ,CAAC"}
@@ -21,15 +21,15 @@ declare const useTransitionState: <Low extends string = "low", Rising extends st
21
21
  high: High;
22
22
  falling: Falling;
23
23
  };
24
- defaultState?: Low | High | undefined;
24
+ defaultState?: Low | High;
25
25
  } | {
26
26
  states?: {
27
- low: 'low';
28
- rising: 'rising';
29
- high: 'high';
30
- falling: 'falling';
31
- } | undefined;
32
- defaultState?: "high" | "low" | undefined;
27
+ low: "low";
28
+ rising: "rising";
29
+ high: "high";
30
+ falling: "falling";
31
+ };
32
+ defaultState?: "low" | "high";
33
33
  })) => {
34
34
  state: Low | Rising | High | Falling;
35
35
  set: (wantsToGo: Low | High) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"useTransitionState.d.ts","sourceRoot":"","sources":["../../src/hooks/useTransitionState.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtD,eAAO,MAAM,oBAAoB;;;;;EAKtB,CAAC;AAEZ,eAAO,MAAM,eAAe;;;;;EAKjB,CAAC;AAEZ,QAAA,MAAM,kBAAkB;SAgBjB,UAAU,WAAW,CAAC;cACjB,MAAM,aAAa;;;;;;;;;;;aAOT,KAAK;gBAAU,QAAQ;cAAQ,MAAM;iBAAW,SAAS;;;;;;;CA2C9E,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"useTransitionState.d.ts","sourceRoot":"","sources":["../../src/hooks/useTransitionState.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtD,eAAO,MAAM,oBAAoB;;;;;EAKtB,CAAC;AAEZ,eAAO,MAAM,eAAe;;;;;EAKjB,CAAC;AAEZ,QAAA,MAAM,kBAAkB,GACtB,GAAG,SAAS,MAAM,UAClB,MAAM,SAAS,MAAM,aACrB,IAAI,SAAS,MAAM,WACnB,OAAO,SAAS,MAAM,uDAWrB;IACD,GAAG,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IAC5B,QAAQ,EAAE,MAAM,aAAa,CAAC;CAC/B,GAAG,CACA;IACE,MAAM,EAAE;QAAE,GAAG,EAAE,GAAG,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,IAAI,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;IACnE,YAAY,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;CAC3B,GACD;IACE,MAAM,CAAC,EAAE;QAAE,GAAG,EAAE,KAAK,CAAC;QAAC,MAAM,EAAE,QAAQ,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,SAAS,CAAA;KAAE,CAAC;IAC5E,YAAY,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;CAC/B,CACJ;WAuCkC,GAAG,GAAG,MAAM,GAAG,IAAI,GAAG,OAAO;qBAhB1B,GAAG,GAAG,IAAI;;CAiB/C,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useTriggerableEffect.d.ts","sourceRoot":"","sources":["../../src/hooks/useTriggerableEffect.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,QAAA,MAAM,oBAAoB,uBAAwB,GAAG,EAAE,KAAK,GAAG,4CAsB9D,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"useTriggerableEffect.d.ts","sourceRoot":"","sources":["../../src/hooks/useTriggerableEffect.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,QAAA,MAAM,oBAAoB,GAAI,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,MAAM,CAAC,eAmBvC,UAAU,CAAC,CAAC,CAAC,SAG3C,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useTriggerableLayoutEffect.d.ts","sourceRoot":"","sources":["../../src/hooks/useTriggerableLayoutEffect.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,QAAA,MAAM,0BAA0B,iBAAkB,OAAO,EAAE,KAAK,IAAI,eAmBrC,OAAO,EAAE,SAGvC,CAAC;AAEF,eAAe,0BAA0B,CAAC"}
1
+ {"version":3,"file":"useTriggerableLayoutEffect.d.ts","sourceRoot":"","sources":["../../src/hooks/useTriggerableLayoutEffect.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,QAAA,MAAM,0BAA0B,OAAQ,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,eAmBrC,OAAO,EAAE,SAGvC,CAAC;AAEF,eAAe,0BAA0B,CAAC"}
@@ -1216,5 +1216,5 @@ export declare const DefaultTranslation: Readonly<Readonly<{
1216
1216
  create_tab_failure_message: string;
1217
1217
  loading_configure_dialog: string;
1218
1218
  }>>;
1219
- export declare const direction: (localeTag: string) => 'ltr' | 'rtl';
1219
+ export declare const direction: (localeTag: string) => "ltr" | "rtl";
1220
1220
  //# sourceMappingURL=i18n.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../src/i18n/i18n.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,MAAM,WAAW,CAAC;AAE3C,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAClE,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE7D,QAAA,MAAM,MAAM,kBAAmB,WAAW,KAAG,SAAS,eAAe,CAEpE,CAAC;AACF,eAAe,MAAM,CAAC;AAEtB,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;YACvD,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,EAAE;gBAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3D,CAAC,CAAC,CAAC;QAEH,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,IAAI,KAAK,QAAQ,IAAI,OAAO,IAAI,KAAK,QAAQ,CAAC;YAC5E,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QAEhC,oDAAoD;QACpD,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,KAAC,QAAQ,cAAU,IAAI,IAAR,CAAC,CAAmB,CAAC,CAAC;IACtE,CAAC,CAA2B,CAAC;AAC/B,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import { Fragment } from 'react';\nimport type { ReactChild, ReactText } from 'react';\n\nimport type { TranslationPack } from './i18n';\n\ntype TranslationTemplate = string | Record<Intl.LDMLPluralRule, string>;\n\n/** * Interface for advanced translation options, like plural forms. */\nexport interface TranslationOptions {\n /**\n * Value that determines which plural form will be chosen during translation.\n * @default 0\n */\n count?: number;\n /** Discriminator for pluralization type: 'cardinal' or 'ordinal'. */\n pluralType?: Intl.PluralRuleType;\n}\n\n/**\n * Function that takes translation key with optional tokens and translation options to drive the translation process.\n * Returns translated string with tokens inserted at defined slots.\n */\nexport interface TranslationFunction<T extends Record<string, TranslationTemplate>> {\n (literal: keyof T): string;\n (literal: keyof T, tokens: ReactText[], options?: TranslationOptions): string;\n (literal: keyof T, tokens: ReactChild[], options?: TranslationOptions): JSX.Element[];\n}\n\n/**\n * Function returns a function capable to translate tokens based on given translation pack and given locale.\n * The passed translation object should be correlated to given locale.\n * @param translation a translation pack (might be default or completely/partially overridden).\n * @param locale locale as BCP 47 language tag. Used for pluralization rules.\n * @returns\n */\nconst translatorFor = <T extends Record<string, TranslationTemplate>>(\n translation: T,\n locale: string\n): TranslationFunction<T> => {\n const cardinalRules = new Intl.PluralRules(locale);\n const ordinalRules = new Intl.PluralRules(locale, { type: 'ordinal' });\n return ((\n literal: keyof TranslationPack,\n tokens: (ReactChild | ReactText)[] = [],\n options?: TranslationOptions\n ): string | JSX.Element[] => {\n let template: TranslationTemplate = translation[literal];\n if (!template) return `!unknown key: ${literal}`;\n const result: ReactChild[] = [];\n if (typeof template === 'object') {\n const type = (options?.pluralType === 'ordinal' ? ordinalRules : cardinalRules).select(\n options?.count || 0\n );\n template = template[type];\n }\n template.split(/\\{(\\d+)\\}/g).forEach((chunk, index) => {\n const part = index % 2 ? tokens[Number(chunk)] : chunk;\n if (part !== undefined && part !== '') result.push(part);\n });\n\n if (result.every(part => typeof part === 'string' || typeof part === 'number'))\n return result.join('').trim();\n\n // eslint-disable-next-line react/no-array-index-key\n return result.map((part, i) => <Fragment key={i}>{part}</Fragment>);\n }) as TranslationFunction<T>;\n};\n\nexport default translatorFor;\n"]}
1
+ {"version":3,"file":"translate.js","sourceRoot":"","sources":["../../src/i18n/translate.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AA4BjC;;;;;;GAMG;AACH,MAAM,aAAa,GAAG,CACpB,WAAc,EACd,MAAc,EACU,EAAE;IAC1B,MAAM,aAAa,GAAG,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IACnD,MAAM,YAAY,GAAG,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;IACvE,OAAO,CAAC,CACN,OAA8B,EAC9B,SAAqC,EAAE,EACvC,OAA4B,EACJ,EAAE;QAC1B,IAAI,QAAQ,GAAwB,WAAW,CAAC,OAAO,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{ TranslationPack } from './i18n';\n\ntype TranslationTemplate = string | Record<Intl.LDMLPluralRule, string>;\n\n/** * Interface for advanced translation options, like plural forms. */\nexport interface TranslationOptions {\n /**\n * Value that determines which plural form will be chosen during translation.\n * @default 0\n */\n count?: number;\n /** Discriminator for pluralization type: 'cardinal' or 'ordinal'. */\n pluralType?: Intl.PluralRuleType;\n}\n\n/**\n * Function that takes translation key with optional tokens and translation options to drive the translation process.\n * Returns translated string with tokens inserted at defined slots.\n */\nexport interface TranslationFunction<T extends Record<string, TranslationTemplate>> {\n (literal: keyof T): string;\n (literal: keyof T, tokens: ReactText[], options?: TranslationOptions): string;\n (literal: keyof T, tokens: ReactChild[], options?: TranslationOptions): JSX.Element[];\n}\n\n/**\n * Function returns a function capable to translate tokens based on given translation pack and given locale.\n * The passed translation object should be correlated to given locale.\n * @param translation a translation pack (might be default or completely/partially overridden).\n * @param locale locale as BCP 47 language tag. Used for pluralization rules.\n * @returns\n */\nconst translatorFor = <T extends Record<string, TranslationTemplate>>(\n translation: T,\n locale: string\n): TranslationFunction<T> => {\n const cardinalRules = new Intl.PluralRules(locale);\n const ordinalRules = new Intl.PluralRules(locale, { type: 'ordinal' });\n return ((\n literal: keyof TranslationPack,\n tokens: (ReactChild | ReactText)[] = [],\n options?: TranslationOptions\n ): string | JSX.Element[] => {\n let template: TranslationTemplate = translation[literal];\n if (!template) return `!unknown key: ${literal}`;\n const result: ReactChild[] = [];\n if (typeof template === 'object') {\n const type = (options?.pluralType === 'ordinal' ? ordinalRules : cardinalRules).select(\n options?.count || 0\n );\n template = template[type];\n }\n template.split(/\\{(\\d+)\\}/g).forEach((chunk, index) => {\n const part = index % 2 ? tokens[Number(chunk)] : chunk;\n if (part !== undefined && part !== '') result.push(part);\n });\n\n if (result.every(part => typeof part === 'string' || typeof part === 'number'))\n return result.join('').trim();\n\n // eslint-disable-next-line react/no-array-index-key\n return result.map((part, i) => <Fragment key={i}>{part}</Fragment>);\n }) as TranslationFunction<T>;\n};\n\nexport default translatorFor;\n"]}
package/lib/init.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAQA,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;IACnD,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;CACxD","sourcesContent":["export interface CosmosGlobals {}\n\ndeclare global {\n interface Window {\n cosmos: CosmosGlobals;\n }\n}\n\nif (typeof window !== 'undefined' && !window.cosmos) {\n Object.defineProperty(window, 'cosmos', { value: {} });\n}\n"]}
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAQA,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;IACpD,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;AACzD,CAAC","sourcesContent":["export interface CosmosGlobals {}\n\ndeclare global {\n interface Window {\n cosmos: CosmosGlobals;\n }\n}\n\nif (typeof window !== 'undefined' && !window.cosmos) {\n Object.defineProperty(window, 'cosmos', { value: {} });\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"register-contexts.js","sourceRoot":"","sources":["../src/register-contexts.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,CAAC;AAChB,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;IACjC,MAAM,CAAC,MAAM,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;IAC1D,MAAM,CAAC,MAAM,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;IACxD,MAAM,CAAC,MAAM,CAAC,cAAc,GAAG,cAAc,CAAC;IAC9C,MAAM,CAAC,MAAM,CAAC,cAAc,GAAG,cAAc,CAAC;CAC/C","sourcesContent":["import './init';\nimport { ConfigurationContext } from './components/Configuration/Configuration';\nimport { ModalManagerContext } from './components/Modal/Contexts';\nimport { ToasterContext } from './components/Toaster/Context';\nimport { LiveLogContext } from './components/LiveLog/Context';\n\nif (typeof window !== 'undefined') {\n window.cosmos.configurationContext = ConfigurationContext;\n window.cosmos.modalManagerContext = ModalManagerContext;\n window.cosmos.toasterContext = ToasterContext;\n window.cosmos.liveLogContext = LiveLogContext;\n}\n"]}
1
+ {"version":3,"file":"register-contexts.js","sourceRoot":"","sources":["../src/register-contexts.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,CAAC;AAChB,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;IAClC,MAAM,CAAC,MAAM,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;IAC1D,MAAM,CAAC,MAAM,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;IACxD,MAAM,CAAC,MAAM,CAAC,cAAc,GAAG,cAAc,CAAC;IAC9C,MAAM,CAAC,MAAM,CAAC,cAAc,GAAG,cAAc,CAAC;AAChD,CAAC","sourcesContent":["import './init';\nimport { ConfigurationContext } from './components/Configuration/Configuration';\nimport { ModalManagerContext } from './components/Modal/Contexts';\nimport { ToasterContext } from './components/Toaster/Context';\nimport { LiveLogContext } from './components/LiveLog/Context';\n\nif (typeof window !== 'undefined') {\n window.cosmos.configurationContext = ConfigurationContext;\n window.cosmos.modalManagerContext = ModalManagerContext;\n window.cosmos.toasterContext = ToasterContext;\n window.cosmos.liveLogContext = LiveLogContext;\n}\n"]}
@@ -94,12 +94,12 @@ export declare const gradientMap: {
94
94
  export declare const colorInGradient: ([...gradient]: LinearGradient, targetPosition: number) => string;
95
95
  export declare const colorInGradientByName: (name: keyof typeof gradientMap, targetPosition: number) => string;
96
96
  export declare const colorsForCategories: (count: number, { gradients, steps }?: {
97
- gradients?: LinearGradient[] | undefined;
98
- steps?: number[] | undefined;
97
+ gradients?: LinearGradient[];
98
+ steps?: number[];
99
99
  }) => string[];
100
100
  export declare const nlpColors: string[];
101
101
  export declare const toLinearGradient: (gradient: LinearGradient, { direction }?: {
102
- direction?: string | undefined;
102
+ direction?: string;
103
103
  }) => string;
104
104
  export {};
105
105
  //# sourceMappingURL=gradients.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"gradients.d.ts","sourceRoot":"","sources":["../../src/styles/gradients.ts"],"names":[],"mappings":"AAGA,UAAU,SAAS;IACjB,wBAAwB;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,qEAAqE;IACrE,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,KAAK,cAAc,GAAG,SAAS,EAAE,CAAC;AAElC,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2JvB,CAAC;AAEF,eAAO,MAAM,eAAe,kDAAmD,MAAM,KAAG,MA0CvF,CAAC;AAEF,eAAO,MAAM,qBAAqB,SAC1B,MAAM,kBAAkB,kBACd,MAAM,KACrB,MAEF,CAAC;AAEF,eAAO,MAAM,mBAAmB,UACvB,MAAM;;;MAkBZ,MAAM,EAgBR,CAAC;AAEF,eAAO,MAAM,SAAS,UA4C2D,CAAC;AAElF,eAAO,MAAM,gBAAgB;;MAG1B,MAO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