@skbkontur/react-ui 4.2.2 → 4.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (694) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/cjs/components/Autocomplete/Autocomplete.d.ts +9 -17
  3. package/cjs/components/Autocomplete/Autocomplete.js +13 -7
  4. package/cjs/components/Autocomplete/Autocomplete.js.map +1 -1
  5. package/cjs/components/Button/Button.d.ts +4 -5
  6. package/cjs/components/Button/Button.js +8 -3
  7. package/cjs/components/Button/Button.js.map +1 -1
  8. package/cjs/components/Button/Button.mixins.js +1 -1
  9. package/cjs/components/Button/Button.mixins.js.map +1 -1
  10. package/cjs/components/Button/Button.styles.js +18 -18
  11. package/cjs/components/Button/Button.styles.js.map +1 -1
  12. package/cjs/components/Center/Center.d.ts +4 -3
  13. package/cjs/components/Center/Center.js +9 -3
  14. package/cjs/components/Center/Center.js.map +1 -1
  15. package/cjs/components/Checkbox/Checkbox.js +4 -2
  16. package/cjs/components/Checkbox/Checkbox.js.map +1 -1
  17. package/cjs/components/Checkbox/Checkbox.styles.d.ts +1 -1
  18. package/cjs/components/Checkbox/Checkbox.styles.js +1 -1
  19. package/cjs/components/Checkbox/Checkbox.styles.js.map +1 -1
  20. package/cjs/components/ComboBox/ComboBox.d.ts +8 -13
  21. package/cjs/components/ComboBox/ComboBox.js +12 -2
  22. package/cjs/components/ComboBox/ComboBox.js.map +1 -1
  23. package/cjs/components/CurrencyInput/CurrencyInput.d.ts +6 -9
  24. package/cjs/components/CurrencyInput/CurrencyInput.js +25 -10
  25. package/cjs/components/CurrencyInput/CurrencyInput.js.map +1 -1
  26. package/cjs/components/CurrencyInput/CurrencyInputKeyboardActions.d.ts +3 -1
  27. package/cjs/components/CurrencyInput/CurrencyInputKeyboardActions.js +14 -2
  28. package/cjs/components/CurrencyInput/CurrencyInputKeyboardActions.js.map +1 -1
  29. package/cjs/components/CurrencyLabel/CurrencyLabel.d.ts +3 -9
  30. package/cjs/components/CurrencyLabel/CurrencyLabel.js +15 -15
  31. package/cjs/components/CurrencyLabel/CurrencyLabel.js.map +1 -1
  32. package/cjs/components/DateInput/DateFragmentsView.d.ts +1 -1
  33. package/cjs/components/DateInput/DateFragmentsView.js +10 -1
  34. package/cjs/components/DateInput/DateFragmentsView.js.map +1 -1
  35. package/cjs/components/DateInput/DateInput.d.ts +9 -12
  36. package/cjs/components/DateInput/DateInput.js +11 -3
  37. package/cjs/components/DateInput/DateInput.js.map +1 -1
  38. package/cjs/components/DateInput/helpers/DateInputKeyboardActions.js +1 -2
  39. package/cjs/components/DateInput/helpers/DateInputKeyboardActions.js.map +1 -1
  40. package/cjs/components/DateInput/helpers/SelectionHelpers.js +2 -2
  41. package/cjs/components/DateInput/helpers/SelectionHelpers.js.map +1 -1
  42. package/cjs/components/DatePicker/DatePicker.d.ts +7 -9
  43. package/cjs/components/DatePicker/DatePicker.js +23 -9
  44. package/cjs/components/DatePicker/DatePicker.js.map +1 -1
  45. package/cjs/components/DatePicker/Picker.js +5 -1
  46. package/cjs/components/DatePicker/Picker.js.map +1 -1
  47. package/cjs/components/DropdownMenu/DropdownMenu.d.ts +5 -5
  48. package/cjs/components/DropdownMenu/DropdownMenu.js +9 -3
  49. package/cjs/components/DropdownMenu/DropdownMenu.js.map +1 -1
  50. package/cjs/components/FileUploader/FileUploader.js +2 -2
  51. package/cjs/components/FileUploader/FileUploader.js.map +1 -1
  52. package/cjs/components/FileUploader/FileUploader.md +8 -1
  53. package/cjs/components/FxInput/FxInput.d.ts +6 -6
  54. package/cjs/components/FxInput/FxInput.js +16 -11
  55. package/cjs/components/FxInput/FxInput.js.map +1 -1
  56. package/cjs/components/Gapped/Gapped.d.ts +7 -8
  57. package/cjs/components/Gapped/Gapped.js +12 -6
  58. package/cjs/components/Gapped/Gapped.js.map +1 -1
  59. package/cjs/components/GlobalLoader/GlobalLoader.d.ts +7 -14
  60. package/cjs/components/GlobalLoader/GlobalLoader.js +13 -9
  61. package/cjs/components/GlobalLoader/GlobalLoader.js.map +1 -1
  62. package/cjs/components/GlobalLoader/GlobalLoaderView.d.ts +2 -2
  63. package/cjs/components/GlobalLoader/GlobalLoaderView.js.map +1 -1
  64. package/cjs/components/Hint/Hint.d.ts +8 -12
  65. package/cjs/components/Hint/Hint.js +15 -5
  66. package/cjs/components/Hint/Hint.js.map +1 -1
  67. package/cjs/components/Hint/Hint.md +14 -0
  68. package/cjs/components/Input/Input.d.ts +4 -3
  69. package/cjs/components/Input/Input.js +10 -5
  70. package/cjs/components/Input/Input.js.map +1 -1
  71. package/cjs/components/Input/Input.md +5 -1
  72. package/cjs/components/Kebab/Kebab.d.ts +8 -15
  73. package/cjs/components/Kebab/Kebab.js +14 -5
  74. package/cjs/components/Kebab/Kebab.js.map +1 -1
  75. package/cjs/components/Link/Link.d.ts +5 -7
  76. package/cjs/components/Link/Link.js +12 -5
  77. package/cjs/components/Link/Link.js.map +1 -1
  78. package/cjs/components/Loader/Loader.d.ts +9 -5
  79. package/cjs/components/Loader/Loader.js +15 -4
  80. package/cjs/components/Loader/Loader.js.map +1 -1
  81. package/cjs/components/Loader/__stories__/LoaderAndButton.js +6 -0
  82. package/cjs/components/Loader/__stories__/LoaderAndButton.js.map +1 -1
  83. package/cjs/components/MenuItem/MenuItem.js +3 -1
  84. package/cjs/components/MenuItem/MenuItem.js.map +1 -1
  85. package/cjs/components/Modal/Modal.d.ts +4 -3
  86. package/cjs/components/Modal/Modal.js +9 -4
  87. package/cjs/components/Modal/Modal.js.map +1 -1
  88. package/cjs/components/Modal/Modal.styles.d.ts +2 -2
  89. package/cjs/components/Modal/Modal.styles.js +2 -2
  90. package/cjs/components/Modal/Modal.styles.js.map +1 -1
  91. package/cjs/components/Modal/ModalBody.js +2 -2
  92. package/cjs/components/Modal/ModalBody.js.map +1 -1
  93. package/cjs/components/Paging/Paging.d.ts +7 -10
  94. package/cjs/components/Paging/Paging.js +16 -6
  95. package/cjs/components/Paging/Paging.js.map +1 -1
  96. package/cjs/components/Paging/PagingDefaultComponent.d.ts +3 -3
  97. package/cjs/components/Paging/PagingDefaultComponent.js.map +1 -1
  98. package/cjs/components/PasswordInput/PasswordInput.d.ts +4 -3
  99. package/cjs/components/PasswordInput/PasswordInput.js +14 -7
  100. package/cjs/components/PasswordInput/PasswordInput.js.map +1 -1
  101. package/cjs/components/Radio/Radio.d.ts +4 -3
  102. package/cjs/components/Radio/Radio.js +11 -4
  103. package/cjs/components/Radio/Radio.js.map +1 -1
  104. package/cjs/components/RadioGroup/RadioGroup.d.ts +2 -4
  105. package/cjs/components/RadioGroup/RadioGroup.js +4 -2
  106. package/cjs/components/RadioGroup/RadioGroup.js.map +1 -1
  107. package/cjs/components/ResponsiveLayout/ResponsiveLayoutEvents.js +2 -2
  108. package/cjs/components/ResponsiveLayout/ResponsiveLayoutEvents.js.map +1 -1
  109. package/cjs/components/ScrollContainer/ScrollContainer.d.ts +7 -8
  110. package/cjs/components/ScrollContainer/ScrollContainer.helpers.js +4 -4
  111. package/cjs/components/ScrollContainer/ScrollContainer.helpers.js.map +1 -1
  112. package/cjs/components/ScrollContainer/ScrollContainer.js +12 -6
  113. package/cjs/components/ScrollContainer/ScrollContainer.js.map +1 -1
  114. package/cjs/components/Select/Item.d.ts +4 -2
  115. package/cjs/components/Select/Item.js +3 -0
  116. package/cjs/components/Select/Item.js.map +1 -1
  117. package/cjs/components/Select/Select.d.ts +3 -12
  118. package/cjs/components/Select/Select.js +8 -1
  119. package/cjs/components/Select/Select.js.map +1 -1
  120. package/cjs/components/Select/Select.styles.js +4 -4
  121. package/cjs/components/Select/Select.styles.js.map +1 -1
  122. package/cjs/components/SidePage/SidePage.d.ts +5 -6
  123. package/cjs/components/SidePage/SidePage.js +8 -1
  124. package/cjs/components/SidePage/SidePage.js.map +1 -1
  125. package/cjs/components/SidePage/SidePageFooter.d.ts +6 -4
  126. package/cjs/components/SidePage/SidePageFooter.js +4 -0
  127. package/cjs/components/SidePage/SidePageFooter.js.map +1 -1
  128. package/cjs/components/Spinner/Spinner.d.ts +4 -2
  129. package/cjs/components/Spinner/Spinner.js +10 -4
  130. package/cjs/components/Spinner/Spinner.js.map +1 -1
  131. package/cjs/components/Spinner/Spinner.styles.d.ts +1 -1
  132. package/cjs/components/Spinner/Spinner.styles.js +7 -7
  133. package/cjs/components/Spinner/Spinner.styles.js.map +1 -1
  134. package/cjs/components/Sticky/Sticky.d.ts +5 -4
  135. package/cjs/components/Sticky/Sticky.js +9 -2
  136. package/cjs/components/Sticky/Sticky.js.map +1 -1
  137. package/cjs/components/Tabs/Indicator.d.ts +1 -1
  138. package/cjs/components/Tabs/Indicator.js +1 -1
  139. package/cjs/components/Tabs/Indicator.js.map +1 -1
  140. package/cjs/components/Tabs/Tab.d.ts +4 -4
  141. package/cjs/components/Tabs/Tab.js +11 -13
  142. package/cjs/components/Tabs/Tab.js.map +1 -1
  143. package/cjs/components/Tabs/Tabs.d.ts +4 -4
  144. package/cjs/components/Tabs/Tabs.js +12 -3
  145. package/cjs/components/Tabs/Tabs.js.map +1 -1
  146. package/cjs/components/Textarea/Textarea.d.ts +8 -10
  147. package/cjs/components/Textarea/Textarea.js +13 -7
  148. package/cjs/components/Textarea/Textarea.js.map +1 -1
  149. package/cjs/components/Textarea/TextareaCounter.d.ts +2 -2
  150. package/cjs/components/Textarea/TextareaCounter.js.map +1 -1
  151. package/cjs/components/Toast/Toast.js +1 -1
  152. package/cjs/components/Toast/Toast.js.map +1 -1
  153. package/cjs/components/Toggle/Toggle.d.ts +5 -6
  154. package/cjs/components/Toggle/Toggle.js +10 -4
  155. package/cjs/components/Toggle/Toggle.js.map +1 -1
  156. package/cjs/components/TokenInput/TokenInput.d.ts +19 -16
  157. package/cjs/components/TokenInput/TokenInput.js +76 -59
  158. package/cjs/components/TokenInput/TokenInput.js.map +1 -1
  159. package/cjs/components/TokenInput/TokenInputMenu.d.ts +2 -1
  160. package/cjs/components/TokenInput/TokenInputMenu.js +1 -1
  161. package/cjs/components/TokenInput/TokenInputMenu.js.map +1 -1
  162. package/cjs/components/Tooltip/Tooltip.d.ts +12 -16
  163. package/cjs/components/Tooltip/Tooltip.js +25 -14
  164. package/cjs/components/Tooltip/Tooltip.js.map +1 -1
  165. package/cjs/components/TooltipMenu/TooltipMenu.d.ts +6 -5
  166. package/cjs/components/TooltipMenu/TooltipMenu.js +11 -5
  167. package/cjs/components/TooltipMenu/TooltipMenu.js.map +1 -1
  168. package/cjs/hooks/useEffectWithoutInitCall.d.ts +2 -2
  169. package/cjs/hooks/useEffectWithoutInitCall.js +2 -2
  170. package/cjs/hooks/useEffectWithoutInitCall.js.map +1 -1
  171. package/cjs/hooks/useMemoObject.d.ts +2 -1
  172. package/cjs/hooks/useMemoObject.js +2 -0
  173. package/cjs/hooks/useMemoObject.js.map +1 -1
  174. package/cjs/internal/BGRuler.d.ts +13 -15
  175. package/cjs/internal/BGRuler.js +16 -8
  176. package/cjs/internal/BGRuler.js.map +1 -1
  177. package/cjs/internal/Calendar/Calendar.d.ts +4 -13
  178. package/cjs/internal/Calendar/Calendar.js +10 -5
  179. package/cjs/internal/Calendar/Calendar.js.map +1 -1
  180. package/cjs/internal/Calendar/DayCellView.styles.js +1 -1
  181. package/cjs/internal/Calendar/DayCellView.styles.js.map +1 -1
  182. package/cjs/internal/Calendar/Month.js +16 -11
  183. package/cjs/internal/Calendar/Month.js.map +1 -1
  184. package/cjs/internal/Calendar/MonthViewModel.d.ts +1 -1
  185. package/cjs/internal/Calendar/config.d.ts +1 -8
  186. package/cjs/internal/CommonWrapper/CommonWrapper.d.ts +1 -1
  187. package/cjs/internal/CommonWrapper/CommonWrapper.js +5 -4
  188. package/cjs/internal/CommonWrapper/CommonWrapper.js.map +1 -1
  189. package/cjs/internal/ComponentCombinator.d.ts +6 -8
  190. package/cjs/internal/ComponentCombinator.js +6 -2
  191. package/cjs/internal/ComponentCombinator.js.map +1 -1
  192. package/cjs/internal/ComponentTable.d.ts +7 -8
  193. package/cjs/internal/ComponentTable.js +14 -3
  194. package/cjs/internal/ComponentTable.js.map +1 -1
  195. package/cjs/internal/CustomComboBox/ComboBoxMenu.d.ts +6 -6
  196. package/cjs/internal/CustomComboBox/ComboBoxMenu.js +14 -8
  197. package/cjs/internal/CustomComboBox/ComboBoxMenu.js.map +1 -1
  198. package/cjs/internal/CustomComboBox/ComboBoxView.d.ts +4 -12
  199. package/cjs/internal/CustomComboBox/ComboBoxView.js +18 -10
  200. package/cjs/internal/CustomComboBox/ComboBoxView.js.map +1 -1
  201. package/cjs/internal/CustomComboBox/CustomComboBoxReducer.js +4 -5
  202. package/cjs/internal/CustomComboBox/CustomComboBoxReducer.js.map +1 -1
  203. package/cjs/internal/DataTids/DataTids.d.ts +5 -5
  204. package/cjs/internal/DataTids/DataTids.js +4 -0
  205. package/cjs/internal/DataTids/DataTids.js.map +1 -1
  206. package/cjs/internal/DateSelect/DateSelect.d.ts +4 -6
  207. package/cjs/internal/DateSelect/DateSelect.js +16 -10
  208. package/cjs/internal/DateSelect/DateSelect.js.map +1 -1
  209. package/cjs/internal/DropdownContainer/DropdownContainer.d.ts +4 -7
  210. package/cjs/internal/DropdownContainer/DropdownContainer.js +8 -5
  211. package/cjs/internal/DropdownContainer/DropdownContainer.js.map +1 -1
  212. package/cjs/internal/FileUploaderControl/withFileUploaderControlProvider.d.ts +1 -1
  213. package/cjs/internal/FileUploaderControl/withFileUploaderControlProvider.js.map +1 -1
  214. package/cjs/internal/HideBodyVerticalScroll/HideBodyVerticalScroll.js +2 -1
  215. package/cjs/internal/HideBodyVerticalScroll/HideBodyVerticalScroll.js.map +1 -1
  216. package/cjs/internal/InputLikeText/InputLikeText.d.ts +4 -3
  217. package/cjs/internal/InputLikeText/InputLikeText.js +11 -4
  218. package/cjs/internal/InputLikeText/InputLikeText.js.map +1 -1
  219. package/cjs/internal/InternalMenu/InternalMenu.d.ts +3 -9
  220. package/cjs/internal/InternalMenu/InternalMenu.js +36 -14
  221. package/cjs/internal/InternalMenu/InternalMenu.js.map +1 -1
  222. package/cjs/internal/MaskedInput/MaskedInput.d.ts +5 -2
  223. package/cjs/internal/MaskedInput/MaskedInput.js +20 -7
  224. package/cjs/internal/MaskedInput/MaskedInput.js.map +1 -1
  225. package/cjs/internal/Menu/Menu.d.ts +4 -7
  226. package/cjs/internal/Menu/Menu.js +14 -4
  227. package/cjs/internal/Menu/Menu.js.map +1 -1
  228. package/cjs/internal/MobilePopup/MobilePopup.js +1 -1
  229. package/cjs/internal/MobilePopup/MobilePopup.js.map +1 -1
  230. package/cjs/internal/MobilePopup/MobilePopupHeader/MobilePopupHeader.js +1 -1
  231. package/cjs/internal/MobilePopup/MobilePopupHeader/MobilePopupHeader.js.map +1 -1
  232. package/cjs/internal/PerformanceMetrics/PerformanceMetrics.js.map +1 -1
  233. package/cjs/internal/Popup/Popup.d.ts +11 -17
  234. package/cjs/internal/Popup/Popup.js +38 -19
  235. package/cjs/internal/Popup/Popup.js.map +1 -1
  236. package/cjs/internal/Popup/PopupHelper.d.ts +1 -1
  237. package/cjs/internal/Popup/PopupHelper.js.map +1 -1
  238. package/cjs/internal/Popup/PopupPin.d.ts +1 -1
  239. package/cjs/internal/Popup/PopupPin.js.map +1 -1
  240. package/cjs/internal/PopupMenu/PopupMenu.d.ts +8 -11
  241. package/cjs/internal/PopupMenu/PopupMenu.js +8 -1
  242. package/cjs/internal/PopupMenu/PopupMenu.js.map +1 -1
  243. package/cjs/internal/RenderLayer/RenderLayer.d.ts +5 -4
  244. package/cjs/internal/RenderLayer/RenderLayer.js +8 -2
  245. package/cjs/internal/RenderLayer/RenderLayer.js.map +1 -1
  246. package/cjs/internal/ThemePlayground/AnotherInputsPlayground.d.ts +11 -6
  247. package/cjs/internal/ThemePlayground/AnotherInputsPlayground.js +7 -0
  248. package/cjs/internal/ThemePlayground/AnotherInputsPlayground.js.map +1 -1
  249. package/cjs/internal/ThemePlayground/CurrencyInputPlayground.d.ts +7 -6
  250. package/cjs/internal/ThemePlayground/CurrencyInputPlayground.js +2 -3
  251. package/cjs/internal/ThemePlayground/CurrencyInputPlayground.js.map +1 -1
  252. package/cjs/internal/ThemePlayground/FxInputPlayground.d.ts +6 -4
  253. package/cjs/internal/ThemePlayground/FxInputPlayground.js +5 -5
  254. package/cjs/internal/ThemePlayground/FxInputPlayground.js.map +1 -1
  255. package/cjs/internal/ThemePlayground/HintPlayground.d.ts +1 -1
  256. package/cjs/internal/ThemePlayground/HintPlayground.js.map +1 -1
  257. package/cjs/internal/ThemePlayground/PagingPlayground.d.ts +6 -6
  258. package/cjs/internal/ThemePlayground/PagingPlayground.js +5 -2
  259. package/cjs/internal/ThemePlayground/PagingPlayground.js.map +1 -1
  260. package/cjs/internal/ThemePlayground/Playground.d.ts +1 -1
  261. package/cjs/internal/ThemePlayground/Playground.js.map +1 -1
  262. package/cjs/internal/ThemePlayground/SelectPlayground.d.ts +9 -6
  263. package/cjs/internal/ThemePlayground/SelectPlayground.js +6 -0
  264. package/cjs/internal/ThemePlayground/SelectPlayground.js.map +1 -1
  265. package/cjs/internal/ThemePlayground/SizesGroup.d.ts +2 -2
  266. package/cjs/internal/ThemePlayground/SizesGroup.js +2 -0
  267. package/cjs/internal/ThemePlayground/SizesGroup.js.map +1 -1
  268. package/cjs/internal/ThemePlayground/SwitcherPlayground.d.ts +9 -8
  269. package/cjs/internal/ThemePlayground/SwitcherPlayground.js +6 -1
  270. package/cjs/internal/ThemePlayground/SwitcherPlayground.js.map +1 -1
  271. package/cjs/internal/ThemePlayground/ThemeContextPlayground.js +14 -4
  272. package/cjs/internal/ThemePlayground/ThemeContextPlayground.js.map +1 -1
  273. package/cjs/internal/ThemePlayground/ThemeEditor.d.ts +1 -4
  274. package/cjs/internal/ThemePlayground/ThemeEditor.js.map +1 -1
  275. package/cjs/internal/ThemePlayground/TogglePlayground.d.ts +2 -7
  276. package/cjs/internal/ThemePlayground/TogglePlayground.js +4 -10
  277. package/cjs/internal/ThemePlayground/TogglePlayground.js.map +1 -1
  278. package/cjs/internal/ThemePlayground/TokenInputPlayground.d.ts +6 -4
  279. package/cjs/internal/ThemePlayground/TokenInputPlayground.js +3 -0
  280. package/cjs/internal/ThemePlayground/TokenInputPlayground.js.map +1 -1
  281. package/cjs/internal/ThemePlayground/VariableValue.d.ts +6 -8
  282. package/cjs/internal/ThemePlayground/VariableValue.js +6 -1
  283. package/cjs/internal/ThemePlayground/VariableValue.js.map +1 -1
  284. package/cjs/internal/ThemePlayground/helpers.d.ts +1 -1
  285. package/cjs/internal/ThemePlayground/helpers.js +4 -2
  286. package/cjs/internal/ThemePlayground/helpers.js.map +1 -1
  287. package/cjs/internal/ThemeShowcase/ThemeShowcase.js.map +1 -1
  288. package/cjs/internal/ZIndex/ZIndex.d.ts +7 -11
  289. package/cjs/internal/ZIndex/ZIndex.js +7 -7
  290. package/cjs/internal/ZIndex/ZIndex.js.map +1 -1
  291. package/cjs/internal/themes/DefaultTheme.js +1 -1
  292. package/cjs/internal/themes/DefaultTheme.js.map +1 -1
  293. package/cjs/lib/ConditionalHandler.js.map +1 -1
  294. package/cjs/lib/InstanceWithAnchorElement.d.ts +1 -1
  295. package/cjs/lib/InstanceWithAnchorElement.js.map +1 -1
  296. package/cjs/lib/ModalStack.js +2 -2
  297. package/cjs/lib/ModalStack.js.map +1 -1
  298. package/cjs/lib/SSRSafe.d.ts +2 -1
  299. package/cjs/lib/SSRSafe.js +9 -1
  300. package/cjs/lib/SSRSafe.js.map +1 -1
  301. package/cjs/lib/animation/index.js +1 -0
  302. package/cjs/lib/animation/index.js.map +1 -1
  303. package/cjs/lib/callChildRef/callChildRef.js +1 -1
  304. package/cjs/lib/callChildRef/callChildRef.js.map +1 -1
  305. package/cjs/lib/createPropsGetter.d.ts +2 -1
  306. package/cjs/lib/createPropsGetter.js +3 -0
  307. package/cjs/lib/createPropsGetter.js.map +1 -1
  308. package/cjs/lib/date/InternalDateCalculator.d.ts +1 -1
  309. package/cjs/lib/date/InternalDateCalculator.js +1 -1
  310. package/cjs/lib/date/InternalDateCalculator.js.map +1 -1
  311. package/cjs/lib/date/InternalDateValidator.d.ts +1 -1
  312. package/cjs/lib/date/InternalDateValidator.js +9 -2
  313. package/cjs/lib/date/InternalDateValidator.js.map +1 -1
  314. package/cjs/lib/extractKeyboardAction.d.ts +1 -1
  315. package/cjs/lib/extractKeyboardAction.js.map +1 -1
  316. package/cjs/lib/filterProps.js +0 -1
  317. package/cjs/lib/filterProps.js.map +1 -1
  318. package/cjs/lib/listenFocusOutside.d.ts +1 -1
  319. package/cjs/lib/listenFocusOutside.js.map +1 -1
  320. package/cjs/lib/locale/useLocaleForControl.d.ts +1 -1
  321. package/cjs/lib/locale/useLocaleForControl.js.map +1 -1
  322. package/cjs/lib/memo.d.ts +3 -1
  323. package/cjs/lib/memo.js +3 -3
  324. package/cjs/lib/memo.js.map +1 -1
  325. package/cjs/lib/net/fetch.js +2 -2
  326. package/cjs/lib/net/fetch.js.map +1 -1
  327. package/cjs/lib/reactGetTextContent.js +0 -1
  328. package/cjs/lib/reactGetTextContent.js.map +1 -1
  329. package/cjs/lib/rootNode/getRootNode.d.ts +3 -3
  330. package/cjs/lib/rootNode/getRootNode.js +7 -7
  331. package/cjs/lib/rootNode/getRootNode.js.map +1 -1
  332. package/cjs/lib/rootNode/rootNodeDecorator.d.ts +9 -9
  333. package/cjs/lib/rootNode/rootNodeDecorator.js.map +1 -1
  334. package/cjs/lib/styles/ColorFactory.js +2 -2
  335. package/cjs/lib/styles/ColorFactory.js.map +1 -1
  336. package/cjs/lib/styles/ColorFunctions.js.map +1 -1
  337. package/cjs/lib/theming/AnimationKeyframes.d.ts +3 -5
  338. package/cjs/lib/theming/AnimationKeyframes.js +8 -22
  339. package/cjs/lib/theming/AnimationKeyframes.js.map +1 -1
  340. package/cjs/lib/theming/Emotion.js +1 -0
  341. package/cjs/lib/theming/Emotion.js.map +1 -1
  342. package/cjs/lib/theming/ThemeFactory.d.ts +1 -1
  343. package/cjs/lib/theming/ThemeFactory.js +3 -1
  344. package/cjs/lib/theming/ThemeFactory.js.map +1 -1
  345. package/cjs/lib/theming/ThemeHelpers.d.ts +2 -2
  346. package/cjs/lib/theming/ThemeHelpers.js +1 -1
  347. package/cjs/lib/theming/ThemeHelpers.js.map +1 -1
  348. package/cjs/lib/utils.d.ts +3 -1
  349. package/cjs/lib/utils.js +5 -2
  350. package/cjs/lib/utils.js.map +1 -1
  351. package/cjs/lib/withClassWrapper.js +1 -4
  352. package/cjs/lib/withClassWrapper.js.map +1 -1
  353. package/cjs/typings/event-types.d.ts +2 -2
  354. package/components/Autocomplete/Autocomplete/Autocomplete.js +26 -13
  355. package/components/Autocomplete/Autocomplete/Autocomplete.js.map +1 -1
  356. package/components/Autocomplete/Autocomplete.d.ts +9 -17
  357. package/components/Button/Button/Button.js +11 -5
  358. package/components/Button/Button/Button.js.map +1 -1
  359. package/components/Button/Button.d.ts +4 -5
  360. package/components/Button/Button.mixins/Button.mixins.js +1 -1
  361. package/components/Button/Button.mixins/Button.mixins.js.map +1 -1
  362. package/components/Button/Button.styles/Button.styles.js +18 -18
  363. package/components/Button/Button.styles/Button.styles.js.map +1 -1
  364. package/components/Center/Center/Center.js +7 -5
  365. package/components/Center/Center/Center.js.map +1 -1
  366. package/components/Center/Center.d.ts +4 -3
  367. package/components/Checkbox/Checkbox/Checkbox.js +5 -2
  368. package/components/Checkbox/Checkbox/Checkbox.js.map +1 -1
  369. package/components/Checkbox/Checkbox.styles/Checkbox.styles.js +1 -1
  370. package/components/Checkbox/Checkbox.styles/Checkbox.styles.js.map +1 -1
  371. package/components/Checkbox/Checkbox.styles.d.ts +1 -1
  372. package/components/ComboBox/ComboBox/ComboBox.js +3 -1
  373. package/components/ComboBox/ComboBox/ComboBox.js.map +1 -1
  374. package/components/ComboBox/ComboBox.d.ts +8 -13
  375. package/components/CurrencyInput/CurrencyInput/CurrencyInput.js +36 -21
  376. package/components/CurrencyInput/CurrencyInput/CurrencyInput.js.map +1 -1
  377. package/components/CurrencyInput/CurrencyInput.d.ts +6 -9
  378. package/components/CurrencyInput/CurrencyInputKeyboardActions/CurrencyInputKeyboardActions.js +4 -2
  379. package/components/CurrencyInput/CurrencyInputKeyboardActions/CurrencyInputKeyboardActions.js.map +1 -1
  380. package/components/CurrencyInput/CurrencyInputKeyboardActions.d.ts +3 -1
  381. package/components/CurrencyLabel/CurrencyLabel/CurrencyLabel.js +21 -15
  382. package/components/CurrencyLabel/CurrencyLabel/CurrencyLabel.js.map +1 -1
  383. package/components/CurrencyLabel/CurrencyLabel.d.ts +3 -9
  384. package/components/DateInput/DateFragmentsView/DateFragmentsView.js +11 -1
  385. package/components/DateInput/DateFragmentsView/DateFragmentsView.js.map +1 -1
  386. package/components/DateInput/DateFragmentsView.d.ts +1 -1
  387. package/components/DateInput/DateInput/DateInput.js +18 -5
  388. package/components/DateInput/DateInput/DateInput.js.map +1 -1
  389. package/components/DateInput/DateInput.d.ts +9 -12
  390. package/components/DateInput/helpers/DateInputKeyboardActions/DateInputKeyboardActions.js +0 -1
  391. package/components/DateInput/helpers/DateInputKeyboardActions/DateInputKeyboardActions.js.map +1 -1
  392. package/components/DateInput/helpers/SelectionHelpers/SelectionHelpers.js +2 -2
  393. package/components/DateInput/helpers/SelectionHelpers/SelectionHelpers.js.map +1 -1
  394. package/components/DatePicker/DatePicker/DatePicker.js +25 -21
  395. package/components/DatePicker/DatePicker/DatePicker.js.map +1 -1
  396. package/components/DatePicker/DatePicker.d.ts +7 -9
  397. package/components/DatePicker/Picker/Picker.js +5 -1
  398. package/components/DatePicker/Picker/Picker.js.map +1 -1
  399. package/components/DropdownMenu/DropdownMenu/DropdownMenu.js +8 -2
  400. package/components/DropdownMenu/DropdownMenu/DropdownMenu.js.map +1 -1
  401. package/components/DropdownMenu/DropdownMenu.d.ts +5 -5
  402. package/components/FileUploader/FileUploader/FileUploader.js +2 -2
  403. package/components/FileUploader/FileUploader/FileUploader.js.map +1 -1
  404. package/components/FileUploader/FileUploader.md +8 -1
  405. package/components/FxInput/FxInput/FxInput.js +15 -10
  406. package/components/FxInput/FxInput/FxInput.js.map +1 -1
  407. package/components/FxInput/FxInput.d.ts +6 -6
  408. package/components/Gapped/Gapped/Gapped.js +17 -8
  409. package/components/Gapped/Gapped/Gapped.js.map +1 -1
  410. package/components/Gapped/Gapped.d.ts +7 -8
  411. package/components/GlobalLoader/GlobalLoader/GlobalLoader.js +35 -16
  412. package/components/GlobalLoader/GlobalLoader/GlobalLoader.js.map +1 -1
  413. package/components/GlobalLoader/GlobalLoader.d.ts +7 -14
  414. package/components/GlobalLoader/GlobalLoaderView/GlobalLoaderView.js.map +1 -1
  415. package/components/GlobalLoader/GlobalLoaderView.d.ts +2 -2
  416. package/components/Hint/Hint/Hint.js +30 -18
  417. package/components/Hint/Hint/Hint.js.map +1 -1
  418. package/components/Hint/Hint.d.ts +8 -12
  419. package/components/Hint/Hint.md +14 -0
  420. package/components/Input/Input/Input.js +13 -8
  421. package/components/Input/Input/Input.js.map +1 -1
  422. package/components/Input/Input.d.ts +4 -3
  423. package/components/Input/Input.md +5 -1
  424. package/components/Kebab/Kebab/Kebab.js +19 -8
  425. package/components/Kebab/Kebab/Kebab.js.map +1 -1
  426. package/components/Kebab/Kebab.d.ts +8 -15
  427. package/components/Link/Link/Link.js +10 -7
  428. package/components/Link/Link/Link.js.map +1 -1
  429. package/components/Link/Link.d.ts +5 -7
  430. package/components/Loader/Loader/Loader.js +22 -17
  431. package/components/Loader/Loader/Loader.js.map +1 -1
  432. package/components/Loader/Loader.d.ts +9 -5
  433. package/components/Loader/__stories__/LoaderAndButton/LoaderAndButton.js.map +1 -1
  434. package/components/MenuItem/MenuItem/MenuItem.js +4 -1
  435. package/components/MenuItem/MenuItem/MenuItem.js.map +1 -1
  436. package/components/Modal/Modal/Modal.js +5 -3
  437. package/components/Modal/Modal/Modal.js.map +1 -1
  438. package/components/Modal/Modal.d.ts +4 -3
  439. package/components/Modal/Modal.styles/Modal.styles.js +2 -2
  440. package/components/Modal/Modal.styles/Modal.styles.js.map +1 -1
  441. package/components/Modal/Modal.styles.d.ts +2 -2
  442. package/components/Modal/ModalBody/ModalBody.js +2 -2
  443. package/components/Modal/ModalBody/ModalBody.js.map +1 -1
  444. package/components/Paging/Paging/Paging.js +25 -15
  445. package/components/Paging/Paging/Paging.js.map +1 -1
  446. package/components/Paging/Paging.d.ts +7 -10
  447. package/components/Paging/PagingDefaultComponent/PagingDefaultComponent.js.map +1 -1
  448. package/components/Paging/PagingDefaultComponent.d.ts +3 -3
  449. package/components/PasswordInput/PasswordInput/PasswordInput.js +14 -13
  450. package/components/PasswordInput/PasswordInput/PasswordInput.js.map +1 -1
  451. package/components/PasswordInput/PasswordInput.d.ts +4 -3
  452. package/components/Radio/Radio/Radio.js +11 -6
  453. package/components/Radio/Radio/Radio.js.map +1 -1
  454. package/components/Radio/Radio.d.ts +4 -3
  455. package/components/RadioGroup/RadioGroup/RadioGroup.js +10 -10
  456. package/components/RadioGroup/RadioGroup/RadioGroup.js.map +1 -1
  457. package/components/RadioGroup/RadioGroup.d.ts +2 -4
  458. package/components/ResponsiveLayout/ResponsiveLayoutEvents/ResponsiveLayoutEvents.js +3 -1
  459. package/components/ResponsiveLayout/ResponsiveLayoutEvents/ResponsiveLayoutEvents.js.map +1 -1
  460. package/components/ScrollContainer/ScrollContainer/ScrollContainer.js +11 -7
  461. package/components/ScrollContainer/ScrollContainer/ScrollContainer.js.map +1 -1
  462. package/components/ScrollContainer/ScrollContainer.d.ts +7 -8
  463. package/components/ScrollContainer/ScrollContainer.helpers/ScrollContainer.helpers.js +4 -4
  464. package/components/ScrollContainer/ScrollContainer.helpers/ScrollContainer.helpers.js.map +1 -1
  465. package/components/Select/Item/Item.js.map +1 -1
  466. package/components/Select/Item.d.ts +4 -2
  467. package/components/Select/Select/Select.js +4 -3
  468. package/components/Select/Select/Select.js.map +1 -1
  469. package/components/Select/Select.d.ts +3 -12
  470. package/components/Select/Select.styles/Select.styles.js +4 -4
  471. package/components/Select/Select.styles/Select.styles.js.map +1 -1
  472. package/components/SidePage/SidePage/SidePage.js +14 -9
  473. package/components/SidePage/SidePage/SidePage.js.map +1 -1
  474. package/components/SidePage/SidePage.d.ts +5 -6
  475. package/components/SidePage/SidePageFooter/SidePageFooter.js.map +1 -1
  476. package/components/SidePage/SidePageFooter.d.ts +6 -4
  477. package/components/Spinner/Spinner/Spinner.js +8 -6
  478. package/components/Spinner/Spinner/Spinner.js.map +1 -1
  479. package/components/Spinner/Spinner.d.ts +4 -2
  480. package/components/Spinner/Spinner.styles/Spinner.styles.js +3 -3
  481. package/components/Spinner/Spinner.styles/Spinner.styles.js.map +1 -1
  482. package/components/Spinner/Spinner.styles.d.ts +1 -1
  483. package/components/Sticky/Sticky/Sticky.js +7 -4
  484. package/components/Sticky/Sticky/Sticky.js.map +1 -1
  485. package/components/Sticky/Sticky.d.ts +5 -4
  486. package/components/Tabs/Indicator/Indicator.js +1 -1
  487. package/components/Tabs/Indicator/Indicator.js.map +1 -1
  488. package/components/Tabs/Indicator.d.ts +1 -1
  489. package/components/Tabs/Tab/Tab.js +15 -7
  490. package/components/Tabs/Tab/Tab.js.map +1 -1
  491. package/components/Tabs/Tab.d.ts +4 -4
  492. package/components/Tabs/Tabs/Tabs.js +10 -8
  493. package/components/Tabs/Tabs/Tabs.js.map +1 -1
  494. package/components/Tabs/Tabs.d.ts +4 -4
  495. package/components/Textarea/Textarea/Textarea.js +23 -15
  496. package/components/Textarea/Textarea/Textarea.js.map +1 -1
  497. package/components/Textarea/Textarea.d.ts +8 -10
  498. package/components/Textarea/TextareaCounter/TextareaCounter.js.map +1 -1
  499. package/components/Textarea/TextareaCounter.d.ts +2 -2
  500. package/components/Toast/Toast/Toast.js +1 -1
  501. package/components/Toast/Toast/Toast.js.map +1 -1
  502. package/components/Toggle/Toggle/Toggle.js +12 -7
  503. package/components/Toggle/Toggle/Toggle.js.map +1 -1
  504. package/components/Toggle/Toggle.d.ts +5 -6
  505. package/components/TokenInput/TokenInput/TokenInput.js +107 -77
  506. package/components/TokenInput/TokenInput/TokenInput.js.map +1 -1
  507. package/components/TokenInput/TokenInput.d.ts +19 -16
  508. package/components/TokenInput/TokenInputMenu/TokenInputMenu.js +1 -1
  509. package/components/TokenInput/TokenInputMenu/TokenInputMenu.js.map +1 -1
  510. package/components/TokenInput/TokenInputMenu.d.ts +2 -1
  511. package/components/Tooltip/Tooltip/Tooltip.js +53 -32
  512. package/components/Tooltip/Tooltip/Tooltip.js.map +1 -1
  513. package/components/Tooltip/Tooltip.d.ts +12 -16
  514. package/components/TooltipMenu/TooltipMenu/TooltipMenu.js +15 -13
  515. package/components/TooltipMenu/TooltipMenu/TooltipMenu.js.map +1 -1
  516. package/components/TooltipMenu/TooltipMenu.d.ts +6 -5
  517. package/hooks/useEffectWithoutInitCall/useEffectWithoutInitCall.js +2 -2
  518. package/hooks/useEffectWithoutInitCall/useEffectWithoutInitCall.js.map +1 -1
  519. package/hooks/useEffectWithoutInitCall.d.ts +2 -2
  520. package/hooks/useMemoObject/useMemoObject.js.map +1 -1
  521. package/hooks/useMemoObject.d.ts +2 -1
  522. package/internal/BGRuler/BGRuler.js +11 -6
  523. package/internal/BGRuler/BGRuler.js.map +1 -1
  524. package/internal/BGRuler.d.ts +13 -15
  525. package/internal/Calendar/Calendar/Calendar.js +11 -5
  526. package/internal/Calendar/Calendar/Calendar.js.map +1 -1
  527. package/internal/Calendar/Calendar.d.ts +4 -13
  528. package/internal/Calendar/DayCellView.styles/DayCellView.styles.js +1 -1
  529. package/internal/Calendar/DayCellView.styles/DayCellView.styles.js.map +1 -1
  530. package/internal/Calendar/Month/Month.js +20 -11
  531. package/internal/Calendar/Month/Month.js.map +1 -1
  532. package/internal/Calendar/MonthViewModel.d.ts +1 -1
  533. package/internal/Calendar/config.d.ts +1 -8
  534. package/internal/CommonWrapper/CommonWrapper/CommonWrapper.js +3 -2
  535. package/internal/CommonWrapper/CommonWrapper/CommonWrapper.js.map +1 -1
  536. package/internal/CommonWrapper/CommonWrapper.d.ts +1 -1
  537. package/internal/ComponentCombinator/ComponentCombinator.js +8 -5
  538. package/internal/ComponentCombinator/ComponentCombinator.js.map +1 -1
  539. package/internal/ComponentCombinator.d.ts +6 -8
  540. package/internal/ComponentTable/ComponentTable.js +16 -4
  541. package/internal/ComponentTable/ComponentTable.js.map +1 -1
  542. package/internal/ComponentTable.d.ts +7 -8
  543. package/internal/CustomComboBox/ComboBoxMenu/ComboBoxMenu.js +18 -19
  544. package/internal/CustomComboBox/ComboBoxMenu/ComboBoxMenu.js.map +1 -1
  545. package/internal/CustomComboBox/ComboBoxMenu.d.ts +6 -6
  546. package/internal/CustomComboBox/ComboBoxView/ComboBoxView.js +21 -10
  547. package/internal/CustomComboBox/ComboBoxView/ComboBoxView.js.map +1 -1
  548. package/internal/CustomComboBox/ComboBoxView.d.ts +4 -12
  549. package/internal/CustomComboBox/CustomComboBoxReducer/CustomComboBoxReducer.js +4 -5
  550. package/internal/CustomComboBox/CustomComboBoxReducer/CustomComboBoxReducer.js.map +1 -1
  551. package/internal/DataTids/DataTids/DataTids.js.map +1 -1
  552. package/internal/DataTids/DataTids.d.ts +5 -5
  553. package/internal/DateSelect/DateSelect/DateSelect.js +15 -12
  554. package/internal/DateSelect/DateSelect/DateSelect.js.map +1 -1
  555. package/internal/DateSelect/DateSelect.d.ts +4 -6
  556. package/internal/DropdownContainer/DropdownContainer/DropdownContainer.js +6 -10
  557. package/internal/DropdownContainer/DropdownContainer/DropdownContainer.js.map +1 -1
  558. package/internal/DropdownContainer/DropdownContainer.d.ts +4 -7
  559. package/internal/FileUploaderControl/withFileUploaderControlProvider/withFileUploaderControlProvider.js.map +1 -1
  560. package/internal/FileUploaderControl/withFileUploaderControlProvider.d.ts +1 -1
  561. package/internal/HideBodyVerticalScroll/HideBodyVerticalScroll/HideBodyVerticalScroll.js +2 -1
  562. package/internal/HideBodyVerticalScroll/HideBodyVerticalScroll/HideBodyVerticalScroll.js.map +1 -1
  563. package/internal/InputLikeText/InputLikeText/InputLikeText.js +9 -4
  564. package/internal/InputLikeText/InputLikeText/InputLikeText.js.map +1 -1
  565. package/internal/InputLikeText/InputLikeText.d.ts +4 -3
  566. package/internal/InternalMenu/InternalMenu/InternalMenu.js +38 -17
  567. package/internal/InternalMenu/InternalMenu/InternalMenu.js.map +1 -1
  568. package/internal/InternalMenu/InternalMenu.d.ts +3 -9
  569. package/internal/MaskedInput/MaskedInput/MaskedInput.js +16 -7
  570. package/internal/MaskedInput/MaskedInput/MaskedInput.js.map +1 -1
  571. package/internal/MaskedInput/MaskedInput.d.ts +5 -2
  572. package/internal/Menu/Menu/Menu.js +16 -4
  573. package/internal/Menu/Menu/Menu.js.map +1 -1
  574. package/internal/Menu/Menu.d.ts +4 -7
  575. package/internal/MobilePopup/MobilePopup/MobilePopup.js +1 -1
  576. package/internal/MobilePopup/MobilePopup/MobilePopup.js.map +1 -1
  577. package/internal/MobilePopup/MobilePopupHeader/MobilePopupHeader/MobilePopupHeader.js +1 -1
  578. package/internal/MobilePopup/MobilePopupHeader/MobilePopupHeader/MobilePopupHeader.js.map +1 -1
  579. package/internal/PerformanceMetrics/PerformanceMetrics/PerformanceMetrics.js.map +1 -1
  580. package/internal/Popup/Popup/Popup.js +52 -35
  581. package/internal/Popup/Popup/Popup.js.map +1 -1
  582. package/internal/Popup/Popup.d.ts +11 -17
  583. package/internal/Popup/PopupHelper/PopupHelper.js.map +1 -1
  584. package/internal/Popup/PopupHelper.d.ts +1 -1
  585. package/internal/Popup/PopupPin/PopupPin.js.map +1 -1
  586. package/internal/Popup/PopupPin.d.ts +1 -1
  587. package/internal/PopupMenu/PopupMenu/PopupMenu.js +12 -4
  588. package/internal/PopupMenu/PopupMenu/PopupMenu.js.map +1 -1
  589. package/internal/PopupMenu/PopupMenu.d.ts +8 -11
  590. package/internal/RenderLayer/RenderLayer/RenderLayer.js +8 -4
  591. package/internal/RenderLayer/RenderLayer/RenderLayer.js.map +1 -1
  592. package/internal/RenderLayer/RenderLayer.d.ts +5 -4
  593. package/internal/ThemePlayground/AnotherInputsPlayground/AnotherInputsPlayground.js.map +1 -1
  594. package/internal/ThemePlayground/AnotherInputsPlayground.d.ts +11 -6
  595. package/internal/ThemePlayground/CurrencyInputPlayground/CurrencyInputPlayground.js.map +1 -1
  596. package/internal/ThemePlayground/CurrencyInputPlayground.d.ts +7 -6
  597. package/internal/ThemePlayground/FxInputPlayground/FxInputPlayground.js +10 -6
  598. package/internal/ThemePlayground/FxInputPlayground/FxInputPlayground.js.map +1 -1
  599. package/internal/ThemePlayground/FxInputPlayground.d.ts +6 -4
  600. package/internal/ThemePlayground/HintPlayground/HintPlayground.js.map +1 -1
  601. package/internal/ThemePlayground/HintPlayground.d.ts +1 -1
  602. package/internal/ThemePlayground/PagingPlayground/PagingPlayground.js +2 -2
  603. package/internal/ThemePlayground/PagingPlayground/PagingPlayground.js.map +1 -1
  604. package/internal/ThemePlayground/PagingPlayground.d.ts +6 -6
  605. package/internal/ThemePlayground/Playground/Playground.js.map +1 -1
  606. package/internal/ThemePlayground/Playground.d.ts +1 -1
  607. package/internal/ThemePlayground/SelectPlayground/SelectPlayground.js.map +1 -1
  608. package/internal/ThemePlayground/SelectPlayground.d.ts +9 -6
  609. package/internal/ThemePlayground/SizesGroup/SizesGroup.js.map +1 -1
  610. package/internal/ThemePlayground/SizesGroup.d.ts +2 -2
  611. package/internal/ThemePlayground/SwitcherPlayground/SwitcherPlayground.js.map +1 -1
  612. package/internal/ThemePlayground/SwitcherPlayground.d.ts +9 -8
  613. package/internal/ThemePlayground/ThemeContextPlayground/ThemeContextPlayground.js +13 -3
  614. package/internal/ThemePlayground/ThemeContextPlayground/ThemeContextPlayground.js.map +1 -1
  615. package/internal/ThemePlayground/ThemeEditor/ThemeEditor.js.map +1 -1
  616. package/internal/ThemePlayground/ThemeEditor.d.ts +1 -4
  617. package/internal/ThemePlayground/TogglePlayground/TogglePlayground.js +5 -17
  618. package/internal/ThemePlayground/TogglePlayground/TogglePlayground.js.map +1 -1
  619. package/internal/ThemePlayground/TogglePlayground.d.ts +2 -7
  620. package/internal/ThemePlayground/TokenInputPlayground/TokenInputPlayground.js.map +1 -1
  621. package/internal/ThemePlayground/TokenInputPlayground.d.ts +6 -4
  622. package/internal/ThemePlayground/VariableValue/VariableValue.js +4 -2
  623. package/internal/ThemePlayground/VariableValue/VariableValue.js.map +1 -1
  624. package/internal/ThemePlayground/VariableValue.d.ts +6 -8
  625. package/internal/ThemePlayground/helpers/helpers.js +0 -1
  626. package/internal/ThemePlayground/helpers/helpers.js.map +1 -1
  627. package/internal/ThemePlayground/helpers.d.ts +1 -1
  628. package/internal/ThemeShowcase/ThemeShowcase/ThemeShowcase.js.map +1 -1
  629. package/internal/ZIndex/ZIndex/ZIndex.js +21 -16
  630. package/internal/ZIndex/ZIndex/ZIndex.js.map +1 -1
  631. package/internal/ZIndex/ZIndex.d.ts +7 -11
  632. package/internal/themes/DefaultTheme/DefaultTheme.js +6 -6
  633. package/internal/themes/DefaultTheme/DefaultTheme.js.map +1 -1
  634. package/lib/ConditionalHandler/ConditionalHandler.js.map +1 -1
  635. package/lib/InstanceWithAnchorElement/InstanceWithAnchorElement.js.map +1 -1
  636. package/lib/InstanceWithAnchorElement.d.ts +1 -1
  637. package/lib/ModalStack/ModalStack.js +2 -2
  638. package/lib/ModalStack/ModalStack.js.map +1 -1
  639. package/lib/SSRSafe/SSRSafe.js +7 -0
  640. package/lib/SSRSafe/SSRSafe.js.map +1 -1
  641. package/lib/SSRSafe.d.ts +2 -1
  642. package/lib/animation/index/index.js +1 -1
  643. package/lib/animation/index/index.js.map +1 -1
  644. package/lib/callChildRef/callChildRef/callChildRef.js +1 -1
  645. package/lib/callChildRef/callChildRef/callChildRef.js.map +1 -1
  646. package/lib/createPropsGetter/createPropsGetter.js +1 -0
  647. package/lib/createPropsGetter/createPropsGetter.js.map +1 -1
  648. package/lib/createPropsGetter.d.ts +2 -1
  649. package/lib/date/InternalDateCalculator/InternalDateCalculator.js +1 -2
  650. package/lib/date/InternalDateCalculator/InternalDateCalculator.js.map +1 -1
  651. package/lib/date/InternalDateCalculator.d.ts +1 -1
  652. package/lib/date/InternalDateValidator/InternalDateValidator.js +8 -2
  653. package/lib/date/InternalDateValidator/InternalDateValidator.js.map +1 -1
  654. package/lib/date/InternalDateValidator.d.ts +1 -1
  655. package/lib/extractKeyboardAction/extractKeyboardAction.js.map +1 -1
  656. package/lib/extractKeyboardAction.d.ts +1 -1
  657. package/lib/filterProps/filterProps.js +0 -1
  658. package/lib/filterProps/filterProps.js.map +1 -1
  659. package/lib/listenFocusOutside/listenFocusOutside.js.map +1 -1
  660. package/lib/listenFocusOutside.d.ts +1 -1
  661. package/lib/locale/useLocaleForControl/useLocaleForControl.js.map +1 -1
  662. package/lib/locale/useLocaleForControl.d.ts +1 -1
  663. package/lib/memo/memo.js +2 -4
  664. package/lib/memo/memo.js.map +1 -1
  665. package/lib/memo.d.ts +3 -1
  666. package/lib/net/fetch/fetch.js +2 -2
  667. package/lib/net/fetch/fetch.js.map +1 -1
  668. package/lib/reactGetTextContent/reactGetTextContent.js +0 -1
  669. package/lib/reactGetTextContent/reactGetTextContent.js.map +1 -1
  670. package/lib/rootNode/getRootNode/getRootNode.js +8 -8
  671. package/lib/rootNode/getRootNode/getRootNode.js.map +1 -1
  672. package/lib/rootNode/getRootNode.d.ts +3 -3
  673. package/lib/rootNode/rootNodeDecorator/rootNodeDecorator.js.map +1 -1
  674. package/lib/rootNode/rootNodeDecorator.d.ts +9 -9
  675. package/lib/styles/ColorFactory/ColorFactory.js +3 -1
  676. package/lib/styles/ColorFactory/ColorFactory.js.map +1 -1
  677. package/lib/styles/ColorFunctions/ColorFunctions.js.map +1 -1
  678. package/lib/theming/AnimationKeyframes/AnimationKeyframes.js +8 -14
  679. package/lib/theming/AnimationKeyframes/AnimationKeyframes.js.map +1 -1
  680. package/lib/theming/AnimationKeyframes.d.ts +3 -5
  681. package/lib/theming/Emotion/Emotion.js.map +1 -1
  682. package/lib/theming/ThemeFactory/ThemeFactory.js +4 -1
  683. package/lib/theming/ThemeFactory/ThemeFactory.js.map +1 -1
  684. package/lib/theming/ThemeFactory.d.ts +1 -1
  685. package/lib/theming/ThemeHelpers/ThemeHelpers.js +1 -1
  686. package/lib/theming/ThemeHelpers/ThemeHelpers.js.map +1 -1
  687. package/lib/theming/ThemeHelpers.d.ts +2 -2
  688. package/lib/utils/utils.js +2 -2
  689. package/lib/utils/utils.js.map +1 -1
  690. package/lib/utils.d.ts +3 -1
  691. package/lib/withClassWrapper/withClassWrapper.js +1 -4
  692. package/lib/withClassWrapper/withClassWrapper.js.map +1 -1
  693. package/package.json +4 -4
  694. package/typings/event-types.d.ts +2 -2
@@ -1 +1 @@
1
- {"version":3,"sources":["getRootNode.ts"],"names":["getRootNode","instance","canUseDOM","rootNode","undefined"],"mappings":";AACA;;;;AAIA;AACA;;AAEA,wD,CARA;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO,IAAMA,WAAW,GAAG,SAAdA,WAAc,CAACC,QAAD,EAAoE;AAC7F,MAAI,CAACC,iBAAD,IAAc,CAACD,QAAnB,EAA6B;AAC3B;AACA;AACA,WAAO,IAAP;AACD;;AAED,MAAI,4BAAcA,QAAd,CAAJ,EAA6B;AAC3B;AACA;AACA,WAAOA,QAAP;AACD;;AAED,MAAIE,QAAJ;;AAEA,MAAI,+CAAuBF,QAAvB,CAAJ,EAAsC;AACpC;AACA;AACA;AACA;AACA,QAAI,CAAC,qBAAOA,QAAP,CAAL,EAAuB;AACrBE,MAAAA,QAAQ,GAAGF,QAAQ,CAACD,WAAT,EAAX;AACD;AACF;;AAED,MAAIG,QAAQ,KAAKC,SAAjB,EAA4B;AAC1B;AACA;AACA,WAAOD,QAAP;AACD;;AAED;AACA;AACA;AACAA,EAAAA,QAAQ,GAAG,2BAAYF,QAAZ,CAAX;;AAEA;AACA,SAAO,4BAAcE,QAAd,IAA0BA,QAA1B,GAAqC,IAA5C;AACD,CAtCM,C","sourcesContent":["/* eslint-disable react/no-find-dom-node */\nimport { findDOMNode } from 'react-dom';\nimport React from 'react';\n\nimport { Nullable } from '../../typings/utility-types';\nimport { isHTMLElement, isNode } from '../SSRSafe';\nimport { canUseDOM } from '../client';\n\nimport { isInstanceWithRootNode } from './rootNodeDecorator';\n\n/**\n * Extracts component's root HTMLElement out of it's instance\n * following the \"StrictMode support convention\" (@see README.md#strictmode, #2518).\n *\n * Replaces findDOMNode but falls back to it if \"convention\" is not respected.\n *\n * @param instance Component's instance provided by React.Ref or `this` inside class-components.\n * @returns Component's root HTMLElement or null\n */\n\nexport const getRootNode = (instance: Nullable<React.ReactInstance>): Nullable<HTMLElement> => {\n if (!canUseDOM || !instance) {\n // instance can be `null` if component was unmounted\n // also checking undefined for convinient usage\n return null;\n }\n\n if (isHTMLElement(instance)) {\n // instance can be a HTMLElement already if comming\n // from Refs of intrinsic elements (<div />, <button />, etc.)\n return instance;\n }\n\n let rootNode;\n\n if (isInstanceWithRootNode(instance)) {\n // it happened to be that native Node interface also has\n // the \"getRootNode\" method, but we can ignore it here\n // because we'd already checked the instance on being an HTMLElement\n // which is a subclass of Node, so, just fixing types here\n if (!isNode(instance)) {\n rootNode = instance.getRootNode();\n }\n }\n\n if (rootNode !== undefined) {\n // at this point, it is rather HTMLElement (what we are looking for)\n // or null (which is also OK, e.g. Popup/Tooltip/Hint before opening), so, just return it\n return rootNode;\n }\n\n // node is undefined, which means that the instance's root node getter doesn't exists or returns the undefined\n // anyway, it tell us that the convention is not respected (by the component itself or its children),\n // so, we have to fall back to the deprecated findDOMNode, which always works but breaks StrictMode\n rootNode = findDOMNode(instance);\n\n // the findDOMNode can also return Text, but we are only intrested in HTMLElements, so just filter it\n return isHTMLElement(rootNode) ? rootNode : null;\n};\n"]}
1
+ {"version":3,"sources":["getRootNode.ts"],"names":["getRootNode","instance","canUseDOM","rootNode","undefined"],"mappings":";AACA;;;;AAIA;AACA;;AAEA,wD,CARA;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO,IAAMA,WAAW,GAAG,SAAdA,WAAc,CAACC,QAAD,EAAgE;AACzF,MAAI,CAACC,iBAAD,IAAc,CAACD,QAAnB,EAA6B;AAC3B;AACA;AACA,WAAO,IAAP;AACD;;AAED,MAAI,wBAAUA,QAAV,CAAJ,EAAyB;AACvB;AACA;AACA,WAAOA,QAAP;AACD;;AAED,MAAIE,QAAJ;;AAEA,MAAI,+CAAuBF,QAAvB,CAAJ,EAAsC;AACpC;AACA;AACA;AACA;AACA,QAAI,CAAC,qBAAOA,QAAP,CAAL,EAAuB;AACrBE,MAAAA,QAAQ,GAAGF,QAAQ,CAACD,WAAT,EAAX;AACD;AACF;;AAED,MAAIG,QAAQ,KAAKC,SAAjB,EAA4B;AAC1B;AACA;AACA,WAAOD,QAAP;AACD;;AAED;AACA;AACA;AACAA,EAAAA,QAAQ,GAAG,2BAAYF,QAAZ,CAAX;;AAEA;AACA,SAAO,wBAAUE,QAAV,IAAsBA,QAAtB,GAAiC,IAAxC;AACD,CAtCM,C","sourcesContent":["/* eslint-disable react/no-find-dom-node */\nimport { findDOMNode } from 'react-dom';\nimport React from 'react';\n\nimport { Nullable } from '../../typings/utility-types';\nimport { isElement, isNode } from '../SSRSafe';\nimport { canUseDOM } from '../client';\n\nimport { isInstanceWithRootNode } from './rootNodeDecorator';\n\n/**\n * Extracts component's root `Element` out of it's instance\n * following the \"StrictMode support convention\" (@see README.md#strictmode, #2518).\n *\n * Replaces findDOMNode but falls back to it if \"convention\" is not respected.\n *\n * @param instance Component's instance provided by React.Ref or `this` inside class-components.\n * @returns Component's root `Element` or null\n */\n\nexport const getRootNode = (instance: Nullable<React.ReactInstance>): Nullable<Element> => {\n if (!canUseDOM || !instance) {\n // instance can be `null` if component was unmounted\n // also checking undefined for convinient usage\n return null;\n }\n\n if (isElement(instance)) {\n // instance can be a `Element` already if comming\n // from Refs of intrinsic elements (<div />, <button />, etc.)\n return instance;\n }\n\n let rootNode;\n\n if (isInstanceWithRootNode(instance)) {\n // it happened to be that native Node interface also has\n // the \"getRootNode\" method, but we can ignore it here\n // because we'd already checked the instance on being an `Element`\n // which is a subclass of Node, so, just fixing types here\n if (!isNode(instance)) {\n rootNode = instance.getRootNode();\n }\n }\n\n if (rootNode !== undefined) {\n // at this point, it is rather `Element` (what we are looking for)\n // or null (which is also OK, e.g. Popup/Tooltip/Hint before opening), so, just return it\n return rootNode;\n }\n\n // node is undefined, which means that the instance's root node getter doesn't exists or returns the undefined\n // anyway, it tell us that the convention is not respected (by the component itself or its children),\n // so, we have to fall back to the deprecated findDOMNode, which always works but breaks StrictMode\n rootNode = findDOMNode(instance);\n\n // the findDOMNode can also return Text, but we are only intrested in HTMLElements, so just filter it\n return isElement(rootNode) ? rootNode : null;\n};\n"]}
@@ -2,26 +2,26 @@ import React from 'react';
2
2
  import EventEmitter from 'eventemitter3';
3
3
  import { Nullable } from '../../typings/utility-types';
4
4
  export declare type TSetRootNode = (e: Nullable<React.ReactNode>) => void;
5
- export declare type TRootNodeSubscription = {
5
+ export interface TRootNodeSubscription {
6
6
  remove: () => void;
7
- };
7
+ }
8
8
  export interface InstanceWithRootNode {
9
- getRootNode: () => Nullable<HTMLElement>;
10
- addRootNodeChangeListener?: (callback: (node: Nullable<HTMLElement>) => void) => TRootNodeSubscription;
9
+ getRootNode: () => Nullable<Element>;
10
+ addRootNodeChangeListener?: (callback: (node: Nullable<Element>) => void) => TRootNodeSubscription;
11
11
  }
12
12
  interface ComponentWithDefaultRootNode {
13
- defaultRootNode?: HTMLElement | null;
13
+ defaultRootNode?: Element | null;
14
14
  }
15
15
  interface DecoratableClassComponent extends ComponentWithDefaultRootNode {
16
16
  new (...args: any[]): React.Component;
17
17
  }
18
18
  export declare function rootNode<T extends DecoratableClassComponent>(Component: T): {
19
19
  new (...args: any[]): {
20
- rootNode: Nullable<HTMLElement>;
20
+ rootNode: Nullable<Element>;
21
21
  rootNodeEmitter: EventEmitter<string | symbol, any>;
22
22
  setRootNode: (instance: Nullable<React.ReactInstance>) => void;
23
- getRootNode: () => Nullable<HTMLElement>;
24
- addRootNodeChangeListener: (callback: (node: Nullable<HTMLElement>) => void) => TRootNodeSubscription;
23
+ getRootNode: () => Nullable<Element>;
24
+ addRootNodeChangeListener: (callback: (node: Nullable<Element>) => void) => TRootNodeSubscription;
25
25
  context: any;
26
26
  setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<{}>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
27
27
  forceUpdate(callback?: (() => void) | undefined): void;
@@ -46,7 +46,7 @@ export declare function rootNode<T extends DecoratableClassComponent>(Component:
46
46
  componentWillUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): void;
47
47
  UNSAFE_componentWillUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): void;
48
48
  };
49
- defaultRootNode?: HTMLElement | null | undefined;
49
+ defaultRootNode?: Element | null | undefined;
50
50
  } & T;
51
51
  export declare const isInstanceWithRootNode: (instance: unknown) => instance is InstanceWithRootNode;
52
52
  export {};
@@ -1 +1 @@
1
- {"version":3,"sources":["rootNodeDecorator.tsx"],"names":["rootNode","Component","defaultRootNode","rootNodeEmitter","EventEmitter","setRootNode","instance","emit","getRootNode","addRootNodeChangeListener","callback","addListener","remove","removeListener","nameDescriptor","Object","getOwnPropertyDescriptor","configurable","defineProperty","value","name","isInstanceWithRootNode","Boolean","prototype","hasOwnProperty","call"],"mappings":";;AAEA;;;;AAIA,4C,CANA;;;;;;;;;;;;;;;;;;;;;AA2BO,SAASA,QAAT,CAAuDC,SAAvD,EAAqE;AAC1E,MAAMD,QAAQ;;;AAGZ,wBAAmC;AACjC,8FADiC,MAF5BA,QAE4B,GAFMC,SAAS,CAACC,eAEhB,OAD5BC,eAC4B,GADV,IAAIC,qBAAJ,EACU;;;AAI5BC,MAAAA,WAJ4B,GAId,UAACC,QAAD,EAA6C;AAChE,YAAMN,SAAQ,GAAG,8BAAYM,QAAZ,CAAjB;AACA,YAAIN,SAAQ,KAAK,MAAKA,QAAtB,EAAgC;AAC9B,gBAAKA,QAAL,GAAgBA,SAAhB;AACA,gBAAKG,eAAL,CAAqBI,IAArB,CAA0B,QAA1B,EAAoCP,SAApC;AACD;AACF,OAVkC;;AAY5BQ,MAAAA,WAZ4B,GAYd,YAA6B;AAChD,eAAO,MAAKR,QAAZ;AACD,OAdkC;;AAgB5BS,MAAAA,yBAhB4B,GAgBA,UAACC,QAAD,EAA4E;AAC7G,cAAKP,eAAL,CAAqBQ,WAArB,CAAiC,QAAjC,EAA2CD,QAA3C;AACA,eAAO;AACLE,UAAAA,MAAM,EAAE,kBAAM;AACZ,kBAAKT,eAAL,CAAqBU,cAArB,CAAoC,QAApC,EAA8CH,QAA9C;AACD,WAHI,EAAP;;AAKD,OAvBkC,cAElC,CALW,kBAAiBT,SAAjB,CAAd;;;AA6BA,MAAMa,cAAc,GAAGC,MAAM,CAACC,wBAAP,CAAgChB,QAAhC,EAA0C,MAA1C,CAAvB;AACA,MAAI,CAACc,cAAD,IAAmBA,cAAc,CAACG,YAAtC,EAAoD;AAClDF,IAAAA,MAAM,CAACG,cAAP,CAAsBlB,QAAtB,EAAgC,MAAhC,EAAwC,EAAEmB,KAAK,EAAElB,SAAS,CAACmB,IAAnB,EAAxC;AACD;;AAED,SAAOpB,QAAP;AACD;;AAEM,IAAMqB,sBAAsB,GAAG,SAAzBA,sBAAyB,CAACf,QAAD,EAAyD;AAC7F,SAAOgB,OAAO,CAAChB,QAAD,CAAP,IAAqBS,MAAM,CAACQ,SAAP,CAAiBC,cAAjB,CAAgCC,IAAhC,CAAqCnB,QAArC,EAA+C,aAA/C,CAA5B;AACD,CAFM,C","sourcesContent":["/* eslint-disable react/display-name */\nimport React from 'react';\nimport EventEmitter from 'eventemitter3';\n\nimport { Nullable } from '../../typings/utility-types';\n\nimport { getRootNode } from './getRootNode';\n\nexport type TSetRootNode = (e: Nullable<React.ReactNode>) => void;\n\nexport type TRootNodeSubscription = {\n remove: () => void;\n};\n\nexport interface InstanceWithRootNode {\n getRootNode: () => Nullable<HTMLElement>;\n addRootNodeChangeListener?: (callback: (node: Nullable<HTMLElement>) => void) => TRootNodeSubscription;\n}\n\ninterface ComponentWithDefaultRootNode {\n defaultRootNode?: HTMLElement | null;\n}\n\ninterface DecoratableClassComponent extends ComponentWithDefaultRootNode {\n new (...args: any[]): React.Component;\n}\n\nexport function rootNode<T extends DecoratableClassComponent>(Component: T) {\n const rootNode = class extends Component implements InstanceWithRootNode {\n public rootNode: Nullable<HTMLElement> = Component.defaultRootNode;\n public rootNodeEmitter = new EventEmitter();\n public constructor(...args: any[]) {\n super(args[0]);\n }\n\n public setRootNode = (instance: Nullable<React.ReactInstance>) => {\n const rootNode = getRootNode(instance);\n if (rootNode !== this.rootNode) {\n this.rootNode = rootNode;\n this.rootNodeEmitter.emit('change', rootNode);\n }\n };\n\n public getRootNode = (): Nullable<HTMLElement> => {\n return this.rootNode;\n };\n\n public addRootNodeChangeListener = (callback: (node: Nullable<HTMLElement>) => void): TRootNodeSubscription => {\n this.rootNodeEmitter.addListener('change', callback);\n return {\n remove: () => {\n this.rootNodeEmitter.removeListener('change', callback);\n },\n };\n };\n };\n\n const nameDescriptor = Object.getOwnPropertyDescriptor(rootNode, 'name');\n if (!nameDescriptor || nameDescriptor.configurable) {\n Object.defineProperty(rootNode, 'name', { value: Component.name });\n }\n\n return rootNode;\n}\n\nexport const isInstanceWithRootNode = (instance: unknown): instance is InstanceWithRootNode => {\n return Boolean(instance) && Object.prototype.hasOwnProperty.call(instance, 'getRootNode');\n};\n"]}
1
+ {"version":3,"sources":["rootNodeDecorator.tsx"],"names":["rootNode","Component","defaultRootNode","rootNodeEmitter","EventEmitter","setRootNode","instance","emit","getRootNode","addRootNodeChangeListener","callback","addListener","remove","removeListener","nameDescriptor","Object","getOwnPropertyDescriptor","configurable","defineProperty","value","name","isInstanceWithRootNode","Boolean","prototype","hasOwnProperty","call"],"mappings":";;AAEA;;;;AAIA,4C,CANA;;;;;;;;;;;;;;;;;;;;;AA2BO,SAASA,QAAT,CAAuDC,SAAvD,EAAqE;A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AAqCnB,QAArC,EAA+C,aAA/C,CAA5B;AACD,CAFM,C","sourcesContent":["/* eslint-disable react/display-name */\nimport React from 'react';\nimport EventEmitter from 'eventemitter3';\n\nimport { Nullable } from '../../typings/utility-types';\n\nimport { getRootNode } from './getRootNode';\n\nexport type TSetRootNode = (e: Nullable<React.ReactNode>) => void;\n\nexport interface TRootNodeSubscription {\n remove: () => void;\n}\n\nexport interface InstanceWithRootNode {\n getRootNode: () => Nullable<Element>;\n addRootNodeChangeListener?: (callback: (node: Nullable<Element>) => void) => TRootNodeSubscription;\n}\n\ninterface ComponentWithDefaultRootNode {\n defaultRootNode?: Element | null;\n}\n\ninterface DecoratableClassComponent extends ComponentWithDefaultRootNode {\n new (...args: any[]): React.Component;\n}\n\nexport function rootNode<T extends DecoratableClassComponent>(Component: T) {\n const rootNode = class extends Component implements InstanceWithRootNode {\n public rootNode: Nullable<Element> = Component.defaultRootNode;\n public rootNodeEmitter = new EventEmitter();\n public constructor(...args: any[]) {\n super(args[0]);\n }\n\n public setRootNode = (instance: Nullable<React.ReactInstance>) => {\n const rootNode = getRootNode(instance);\n if (rootNode !== this.rootNode) {\n this.rootNode = rootNode;\n this.rootNodeEmitter.emit('change', rootNode);\n }\n };\n\n public getRootNode = (): Nullable<Element> => {\n return this.rootNode;\n };\n\n public addRootNodeChangeListener = (callback: (node: Nullable<Element>) => void): TRootNodeSubscription => {\n this.rootNodeEmitter.addListener('change', callback);\n return {\n remove: () => {\n this.rootNodeEmitter.removeListener('change', callback);\n },\n };\n };\n };\n\n const nameDescriptor = Object.getOwnPropertyDescriptor(rootNode, 'name');\n if (!nameDescriptor || nameDescriptor.configurable) {\n Object.defineProperty(rootNode, 'name', { value: Component.name });\n }\n\n return rootNode;\n}\n\nexport const isInstanceWithRootNode = (instance: unknown): instance is InstanceWithRootNode => {\n return Boolean(instance) && Object.prototype.hasOwnProperty.call(instance, 'getRootNode');\n};\n"]}
@@ -80,8 +80,8 @@ ColorFactory = /*#__PURE__*/function () {function ColorFactory() {}ColorFactory.
80
80
 
81
81
  var colorCode = hexString.substring(1);
82
82
  var rgb = [0, 0, 0];
83
- if (colorCode.length === 6) {
84
- colorCode.match(/.{2}/g).forEach(function (c, i) {
83
+ if (colorCode.length === 6) {var _colorCode$match;
84
+ (_colorCode$match = colorCode.match(/.{2}/g)) == null ? void 0 : _colorCode$match.forEach(function (c, i) {
85
85
  rgb[i] = parseInt(c, 16);
86
86
  });
87
87
  } else if (colorCode.length === 3) {
@@ -1 +1 @@
1
- {"version":3,"sources":["ColorFactory.ts"],"names":["RGB_REGEX","RGBA_REGEX","HSL_REGEX","HSLA_REGEX","HEX_REGEX","ColorFactory","create","input","cache","Object","freeze","instantiate","ColorObject","lowercasedTrimmedInput","toLowerCase","trim","isKeyword","fromKeyword","startsWith","parts","r","g","b","a","fromRGB","h","s","l","fromHSL","fromHex","prototype","hasOwnProperty","call","ColorKeywords","keyword","hexString","type","test","Error","colorCode","substring","rgb","length","match","forEach","c","i","parseInt","split","gray","Math","round","hDeg","t1","t2"],"mappings":"0JAAA;;AAEA;AACA;AACA;;;;;;AAMA,IAAMA,SAAS;AACb,wGADF;AAEA,IAAMC,UAAU;AACd,yJADF;AAEA,IAAMC,SAAS;AACb,wHADF;AAEA,IAAMC,UAAU;AACd,yKADF;AAEA,IAAMC,SAAS,GAAG,8BAAlB,C;;AAEaC,Y;AACGC,EAAAA,M,GAAd,gBAAqBC,KAArB,EAAoC;AAClC,QAAI,CAAC,KAAKC,KAAL,CAAWD,KAAX,CAAL,EAAwB;AACtB,WAAKC,KAAL,CAAWD,KAAX,IAAoBE,MAAM,CAACC,MAAP,CAAc,KAAKC,WAAL,CAAiBJ,KAAjB,CAAd,CAApB;AACD;;AAED,WAAO,KAAKC,KAAL,CAAWD,KAAX,CAAP;AACD,G;;;;AAIcI,EAAAA,W,GAAf,qBAA2BJ,KAA3B,EAA0C;AACxC,QAAI,OAAOA,KAAP,KAAiB,QAArB,EAA+B;AAC7B,4BAAQ,KAAR,8B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,EAAoC1B,CAApC,EAAuCA,CAAC,GAAG,CAAJ,GAAQ,MAAR,GAAiB,KAAxD,CAAP;AACD;;AAED,QAAM6B,IAAI,GAAG3B,CAAC,GAAG,GAAjB;AACA,QAAM4B,EAAE,GAAG1B,CAAC,GAAG,GAAJ,GAAUA,CAAC,IAAI,IAAID,CAAR,CAAX,GAAwBC,CAAC,GAAGD,CAAJ,GAAQC,CAAC,GAAGD,CAA/C;AACA,QAAM4B,EAAE,GAAG3B,CAAC,GAAG,CAAJ,GAAQ0B,EAAnB;;AAEA,QAAMjC,CAAC,GAAG,2BAAQgC,IAAI,GAAG,IAAI,CAAnB,EAAsBC,EAAtB,EAA0BC,EAA1B,CAAV;AACA,QAAMjC,CAAC,GAAG,2BAAQ+B,IAAR,EAAcC,EAAd,EAAkBC,EAAlB,CAAV;AACA,QAAMhC,CAAC,GAAG,2BAAQ8B,IAAI,GAAG,IAAI,CAAnB,EAAsBC,EAAtB,EAA0BC,EAA1B,CAAV;;AAEA,QAAMb,GAAa,GAAG,CAACS,IAAI,CAACC,KAAL,CAAW/B,CAAC,GAAG,GAAf,CAAD,EAAsB8B,IAAI,CAACC,KAAL,CAAW9B,CAAC,GAAG,GAAf,CAAtB,EAA2C6B,IAAI,CAACC,KAAL,CAAW7B,CAAC,GAAG,GAAf,CAA3C,CAAtB;AACA,WAAO,IAAIV,wBAAJ,CAAgB6B,GAAhB,EAAqBlB,CAArB,EAAwBA,CAAC,GAAG,CAAJ,GAAQ,MAAR,GAAiB,KAAzC,CAAP;AACD,G,6DA9FUlB,Y,CASIG,K,GAA+BC,MAAM,CAACH,MAAP,CAAc,IAAd,C","sourcesContent":["import warning from 'warning';\n\nimport { clamp, extractColorParts, hue2rgb, parseHSLParts, parseRGBParts } from './ColorHelpers';\nimport { ColorKeywords } from './ColorKeywords';\nimport { ColorKeywordsType, ColorObject, ColorType, RGBTuple } from './ColorObject';\n\ninterface ColorFactoryCacheType {\n [key: string]: ColorObject;\n}\n\nconst RGB_REGEX =\n /rgb\\(\\s*(\\d{1,3}(?:(?:\\.\\d+)?%)?)\\s*,\\s*(\\d{1,3}(?:(?:\\.\\d+)?%)?)\\s*,\\s*(\\d{1,3}(?:(?:\\.\\d+)?%)?)\\s*\\)/;\nconst RGBA_REGEX =\n /rgba\\(\\s*(\\d{1,3}(?:(?:\\.\\d+)?%)?)\\s*,\\s*(\\d{1,3}(?:(?:\\.\\d+)?%)?)\\s*,\\s*(\\d{1,3}(?:(?:\\.\\d+)?%)?)\\s*,\\s*(0|0\\.\\d+|1|1\\.0+|\\d{1,3}(?:(?:\\.\\d+)?%))\\s*\\)/;\nconst HSL_REGEX =\n /hsl\\(\\s*(\\d{1,3})\\s*,\\s*(0|0\\.\\d+|1|1\\.0+|\\d{1,3}(?:(?:\\.\\d+)?%))\\s*,\\s*(0|0\\.\\d+|1|1\\.0+|\\d{1,3}(?:(?:\\.\\d+)?%))\\s*\\)/;\nconst HSLA_REGEX =\n /hsla\\(\\s*(\\d{1,3})\\s*,\\s*(0|0\\.\\d+|1|1\\.0+|\\d{1,3}(?:(?:\\.\\d+)?%))\\s*,\\s*(0|0\\.\\d+|1|1\\.0+|\\d{1,3}(?:(?:\\.\\d+)?%))\\s*,\\s*(0|0\\.\\d+|1|1\\.0+|\\d{1,3}(?:(?:\\.\\d+)?%))\\s*\\)/;\nconst HEX_REGEX = /^#([0-9a-f]{3}|[0-9a-f]{6})$/;\n\nexport class ColorFactory {\n public static create(input: string) {\n if (!this.cache[input]) {\n this.cache[input] = Object.freeze(this.instantiate(input));\n }\n\n return this.cache[input];\n }\n\n private static cache: ColorFactoryCacheType = Object.create(null);\n\n private static instantiate(input: string) {\n if (typeof input !== 'string') {\n warning(false, `Invalid type of input (${typeof input}), expected a string. Returning transparent color`);\n return new ColorObject([0, 0, 0], 1.0, 'transparent');\n }\n const lowercasedTrimmedInput = input.toLowerCase().trim();\n\n if (lowercasedTrimmedInput === 'transparent') {\n return new ColorObject([0, 0, 0], 0, 'transparent');\n } else if (this.isKeyword(lowercasedTrimmedInput)) {\n return this.fromKeyword(lowercasedTrimmedInput);\n } else if (lowercasedTrimmedInput.startsWith('rgb')) {\n const parts = extractColorParts(lowercasedTrimmedInput, RGB_REGEX, RGBA_REGEX);\n let { r, g, b, a } = parseRGBParts(parts);\n\n r = clamp(r, 255);\n g = clamp(g, 255);\n b = clamp(b, 255);\n a = clamp(a, 1);\n\n return this.fromRGB(r, g, b, a);\n } else if (lowercasedTrimmedInput.startsWith('hsl')) {\n const parts = extractColorParts(lowercasedTrimmedInput, HSL_REGEX, HSLA_REGEX);\n let { h, s, l, a } = parseHSLParts(parts);\n\n h = clamp(h, 360);\n s = clamp(s, 1);\n l = clamp(l, 1);\n a = clamp(a, 1);\n\n return this.fromHSL(h, s, l, a);\n }\n\n return this.fromHex(lowercasedTrimmedInput);\n }\n\n private static isKeyword(input: string): input is ColorKeywordsType {\n return Object.prototype.hasOwnProperty.call(ColorKeywords, input);\n }\n\n private static fromKeyword(keyword: ColorKeywordsType) {\n return this.fromHex(ColorKeywords[keyword], keyword);\n }\n\n private static fromHex(hexString: string, type: ColorType = 'hex') {\n if (!HEX_REGEX.test(hexString)) {\n throw new Error(`${hexString} is not a valid hex color string`);\n }\n\n const colorCode = hexString.substring(1);\n const rgb: RGBTuple = [0, 0, 0];\n if (colorCode.length === 6) {\n colorCode.match(/.{2}/g)!.forEach((c, i) => {\n rgb[i] = parseInt(c, 16);\n });\n } else if (colorCode.length === 3) {\n colorCode.split('').forEach((c, i) => {\n rgb[i] = parseInt(c + c, 16);\n });\n }\n return new ColorObject(rgb, 1.0, type);\n }\n\n private static fromRGB(r: number, g: number, b: number, a = 1.0) {\n return new ColorObject([r, g, b], a, a < 1 ? 'rgba' : 'rgb');\n }\n\n private static fromHSL(h: number, s: number, l: number, a = 1.0) {\n if (s === 0) {\n const gray = Math.round(l * 255);\n return new ColorObject([gray, gray, gray], a, a < 1 ? 'hsla' : 'hsl');\n }\n\n const hDeg = h / 360;\n const t1 = l < 0.5 ? l * (1 + s) : l + s - l * s;\n const t2 = l * 2 - t1;\n\n const r = hue2rgb(hDeg + 1 / 3, t1, t2);\n const g = hue2rgb(hDeg, t1, t2);\n const b = hue2rgb(hDeg - 1 / 3, t1, t2);\n\n const rgb: RGBTuple = [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255)];\n return new ColorObject(rgb, a, a < 1 ? 'hsla' : 'hsl');\n }\n}\n"]}
1
+ {"version":3,"sources":["ColorFactory.ts"],"names":["RGB_REGEX","RGBA_REGEX","HSL_REGEX","HSLA_REGEX","HEX_REGEX","ColorFactory","create","input","cache","Object","freeze","instantiate","ColorObject","lowercasedTrimmedInput","toLowerCase","trim","isKeyword","fromKeyword","startsWith","parts","r","g","b","a","fromRGB","h","s","l","fromHSL","fromHex","prototype","hasOwnProperty","call","ColorKeywords","keyword","hexString","type","test","Error","colorCode","substring","rgb","length","match","forEach","c","i","parseInt","split","gray","Math","round","hDeg","t1","t2"],"mappings":"0JAAA;;AAEA;AACA;AACA;;;;;;AAMA,IAAMA,SAAS;AACb,wGADF;AAEA,IAAMC,UAAU;AACd,yJADF;AAEA,IAAMC,SAAS;AACb,wHADF;AAEA,IAAMC,UAAU;AACd,yKADF;AAEA,IAAMC,SAAS,GAAG,8BAAlB,C;;AAEaC,Y;AACGC,EAAAA,M,GAAd,gBAAqBC,KAArB,EAAoC;AAClC,QAAI,CAAC,KAAKC,KAAL,CAAWD,KAAX,CAAL,EAAwB;AACtB,WAAKC,KAAL,CAAWD,KAAX,IAAoBE,MAAM,CAACC,MAAP,CAAc,KAAKC,WAAL,CAAiBJ,KAAjB,CAAd,CAApB;AACD;;AAED,WAAO,KAAKC,KAAL,CAAWD,KAAX,CAAP;AACD,G;;;;AAIcI,EAAAA,W,GAAf,qBAA2BJ,KAA3B,EAA0C;AACxC,QAAI,OAAOA,KAAP,KAAiB,QAArB,EAA+B;AAC7B,4BAAQ,KAAR,8BAAyC,OAAOA,KAAhD;AACA,aAAO,IAAIK,wBAAJ,C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AQ,MAAR,GAAiB,KAAxD,CAAP;AACD;;AAED,QAAM6B,IAAI,GAAG3B,CAAC,GAAG,GAAjB;AACA,QAAM4B,EAAE,GAAG1B,CAAC,GAAG,GAAJ,GAAUA,CAAC,IAAI,IAAID,CAAR,CAAX,GAAwBC,CAAC,GAAGD,CAAJ,GAAQC,CAAC,GAAGD,CAA/C;AACA,QAAM4B,EAAE,GAAG3B,CAAC,GAAG,CAAJ,GAAQ0B,EAAnB;;AAEA,QAAMjC,CAAC,GAAG,2BAAQgC,IAAI,GAAG,IAAI,CAAnB,EAAsBC,EAAtB,EAA0BC,EAA1B,CAAV;AACA,QAAMjC,CAAC,GAAG,2BAAQ+B,IAAR,EAAcC,EAAd,EAAkBC,EAAlB,CAAV;AACA,QAAMhC,CAAC,GAAG,2BAAQ8B,IAAI,GAAG,IAAI,CAAnB,EAAsBC,EAAtB,EAA0BC,EAA1B,CAAV;;AAEA,QAAMb,GAAa,GAAG,CAACS,IAAI,CAACC,KAAL,CAAW/B,CAAC,GAAG,GAAf,CAAD,EAAsB8B,IAAI,CAACC,KAAL,CAAW9B,CAAC,GAAG,GAAf,CAAtB,EAA2C6B,IAAI,CAACC,KAAL,CAAW7B,CAAC,GAAG,GAAf,CAA3C,CAAtB;AACA,WAAO,IAAIV,wBAAJ,CAAgB6B,GAAhB,EAAqBlB,CAArB,EAAwBA,CAAC,GAAG,CAAJ,GAAQ,MAAR,GAAiB,KAAzC,CAAP;AACD,G,6DA9FUlB,Y,CASIG,K,GAA+BC,MAAM,CAACH,MAAP,CAAc,IAAd,C","sourcesContent":["import warning from 'warning';\n\nimport { clamp, extractColorParts, hue2rgb, parseHSLParts, parseRGBParts } from './ColorHelpers';\nimport { ColorKeywords } from './ColorKeywords';\nimport { ColorKeywordsType, ColorObject, ColorType, RGBTuple } from './ColorObject';\n\ninterface ColorFactoryCacheType {\n [key: string]: ColorObject;\n}\n\nconst RGB_REGEX =\n /rgb\\(\\s*(\\d{1,3}(?:(?:\\.\\d+)?%)?)\\s*,\\s*(\\d{1,3}(?:(?:\\.\\d+)?%)?)\\s*,\\s*(\\d{1,3}(?:(?:\\.\\d+)?%)?)\\s*\\)/;\nconst RGBA_REGEX =\n /rgba\\(\\s*(\\d{1,3}(?:(?:\\.\\d+)?%)?)\\s*,\\s*(\\d{1,3}(?:(?:\\.\\d+)?%)?)\\s*,\\s*(\\d{1,3}(?:(?:\\.\\d+)?%)?)\\s*,\\s*(0|0\\.\\d+|1|1\\.0+|\\d{1,3}(?:(?:\\.\\d+)?%))\\s*\\)/;\nconst HSL_REGEX =\n /hsl\\(\\s*(\\d{1,3})\\s*,\\s*(0|0\\.\\d+|1|1\\.0+|\\d{1,3}(?:(?:\\.\\d+)?%))\\s*,\\s*(0|0\\.\\d+|1|1\\.0+|\\d{1,3}(?:(?:\\.\\d+)?%))\\s*\\)/;\nconst HSLA_REGEX =\n /hsla\\(\\s*(\\d{1,3})\\s*,\\s*(0|0\\.\\d+|1|1\\.0+|\\d{1,3}(?:(?:\\.\\d+)?%))\\s*,\\s*(0|0\\.\\d+|1|1\\.0+|\\d{1,3}(?:(?:\\.\\d+)?%))\\s*,\\s*(0|0\\.\\d+|1|1\\.0+|\\d{1,3}(?:(?:\\.\\d+)?%))\\s*\\)/;\nconst HEX_REGEX = /^#([0-9a-f]{3}|[0-9a-f]{6})$/;\n\nexport class ColorFactory {\n public static create(input: string) {\n if (!this.cache[input]) {\n this.cache[input] = Object.freeze(this.instantiate(input));\n }\n\n return this.cache[input];\n }\n\n private static cache: ColorFactoryCacheType = Object.create(null);\n\n private static instantiate(input: string) {\n if (typeof input !== 'string') {\n warning(false, `Invalid type of input (${typeof input}), expected a string. Returning transparent color`);\n return new ColorObject([0, 0, 0], 1.0, 'transparent');\n }\n const lowercasedTrimmedInput = input.toLowerCase().trim();\n\n if (lowercasedTrimmedInput === 'transparent') {\n return new ColorObject([0, 0, 0], 0, 'transparent');\n } else if (this.isKeyword(lowercasedTrimmedInput)) {\n return this.fromKeyword(lowercasedTrimmedInput);\n } else if (lowercasedTrimmedInput.startsWith('rgb')) {\n const parts = extractColorParts(lowercasedTrimmedInput, RGB_REGEX, RGBA_REGEX);\n let { r, g, b, a } = parseRGBParts(parts);\n\n r = clamp(r, 255);\n g = clamp(g, 255);\n b = clamp(b, 255);\n a = clamp(a, 1);\n\n return this.fromRGB(r, g, b, a);\n } else if (lowercasedTrimmedInput.startsWith('hsl')) {\n const parts = extractColorParts(lowercasedTrimmedInput, HSL_REGEX, HSLA_REGEX);\n let { h, s, l, a } = parseHSLParts(parts);\n\n h = clamp(h, 360);\n s = clamp(s, 1);\n l = clamp(l, 1);\n a = clamp(a, 1);\n\n return this.fromHSL(h, s, l, a);\n }\n\n return this.fromHex(lowercasedTrimmedInput);\n }\n\n private static isKeyword(input: string): input is ColorKeywordsType {\n return Object.prototype.hasOwnProperty.call(ColorKeywords, input);\n }\n\n private static fromKeyword(keyword: ColorKeywordsType) {\n return this.fromHex(ColorKeywords[keyword], keyword);\n }\n\n private static fromHex(hexString: string, type: ColorType = 'hex') {\n if (!HEX_REGEX.test(hexString)) {\n throw new Error(`${hexString} is not a valid hex color string`);\n }\n\n const colorCode = hexString.substring(1);\n const rgb: RGBTuple = [0, 0, 0];\n if (colorCode.length === 6) {\n colorCode.match(/.{2}/g)?.forEach((c, i) => {\n rgb[i] = parseInt(c, 16);\n });\n } else if (colorCode.length === 3) {\n colorCode.split('').forEach((c, i) => {\n rgb[i] = parseInt(c + c, 16);\n });\n }\n return new ColorObject(rgb, 1.0, type);\n }\n\n private static fromRGB(r: number, g: number, b: number, a = 1.0) {\n return new ColorObject([r, g, b], a, a < 1 ? 'rgba' : 'rgb');\n }\n\n private static fromHSL(h: number, s: number, l: number, a = 1.0) {\n if (s === 0) {\n const gray = Math.round(l * 255);\n return new ColorObject([gray, gray, gray], a, a < 1 ? 'hsla' : 'hsl');\n }\n\n const hDeg = h / 360;\n const t1 = l < 0.5 ? l * (1 + s) : l + s - l * s;\n const t2 = l * 2 - t1;\n\n const r = hue2rgb(hDeg + 1 / 3, t1, t2);\n const g = hue2rgb(hDeg, t1, t2);\n const b = hue2rgb(hDeg - 1 / 3, t1, t2);\n\n const rgb: RGBTuple = [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255)];\n return new ColorObject(rgb, a, a < 1 ? 'hsla' : 'hsl');\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["ColorFunctions.ts"],"names":["DEFAULT_DARK","ColorFactory","create","DEFAULT_LIGHT","ColorFunctionsCache","Object","buildCacheKey","name","args","join","shiftColor","colorString","a","sign","method","toLowerCase","amount","endsWith","parseFloat","color","hsl","toHSL","l","newColor","alpha","h","s","toColorString","type","lighten","key","undefined","darken","contrast","darkString","lightString","threshold","dark","light","luma","toRGBString","toHEXString","red","rgb","green","blue","isValid","e","fade","clone"],"mappings":"wOAAA;AACA;;;;;;AAMA,IAAMA,YAAY,GAAGC,2BAAaC,MAAb,CAAoB,SAApB,CAArB;AACA,IAAMC,aAAa,GAAGF,2BAAaC,MAAb,CAAoB,MAApB,CAAtB;AACA,IAAME,mBAA8C,GAAGC,MAAM,CAACH,MAAP,CAAc,IAAd,CAAvD;;AAEA,IAAMI,aAAa,GAAG,SAAhBA,aAAgB,CAACC,IAAD,qCAAkBC,IAAlB,uEAAkBA,IAAlB,qCAAqCD,IAArC,SAA6CC,IAAI,CAACC,IAAL,EAA7C,QAAtB;;AAEA,IAAMC,UAAU,GAAG,SAAbA,UAAa,CAACC,WAAD,EAAsBC,CAAtB,EAA0CC,IAA1C,EAA0DC,MAA1D,EAAkF;AACnG,MAAI,CAACH,WAAL,EAAkB;AAChB,WAAO,EAAP;AACD;;AAED,MAAIA,WAAW,CAACI,WAAZ,OAA8B,aAAlC,EAAiD;AAC/C,WAAO,aAAP;AACD;;AAED,MAAIC,MAAJ;AACA,MAAI,OAAOJ,CAAP,KAAa,QAAjB,EAA2B;AACzBI,IAAAA,MAAM,GAAGJ,CAAC,CAACK,QAAF,CAAW,GAAX,IAA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IAAME,IAAI,GAAG,SAAPA,IAAO,CAAClC,WAAD,EAAyB;AAC3C,MAAMQ,KAAK,GAAGlB,2BAAaC,MAAb,CAAoBS,WAApB,CAAd;AACA,SAAOQ,KAAK,CAACwB,GAAN,CAAU,CAAV,CAAP;AACD,CAHM,C;AAIA,IAAMnB,KAAK,GAAG,SAARA,KAAQ,CAACb,WAAD,EAAyB;AAC5C,MAAMQ,KAAK,GAAGlB,2BAAaC,MAAb,CAAoBS,WAApB,CAAd;AACA,SAAOQ,KAAK,CAACK,KAAb;AACD,CAHM,C;AAIA,IAAMsB,OAAO,GAAG,SAAVA,OAAU,CAACnC,WAAD,EAAyB;AAC9C,MAAI;AACFV,+BAAaC,MAAb,CAAoBS,WAApB;AACA,WAAO,IAAP;AACD,GAHD,CAGE,OAAOoC,CAAP,EAAU;AACV,WAAO,KAAP;AACD;AACF,CAPM,C;AAQA,IAAMC,IAAI,GAAG,SAAPA,IAAO,CAACrC,WAAD,EAAsBa,KAAtB,EAAwC;AAC1D,MAAMM,GAAG,GAAGxB,aAAa,CAAC,MAAD,EAASK,WAAT,EAAsBa,KAAtB,CAAzB;;AAEA,MAAIpB,mBAAmB,CAAC0B,GAAD,CAAnB,KAA6BC,SAAjC,EAA4C;AAC1C,QAAMZ,KAAK,GAAGlB,2BAAaC,MAAb,CAAoBS,WAApB,EAAiCsC,KAAjC,EAAd;AACA9B,IAAAA,KAAK,CAACK,KAAN,GAAcA,KAAd;AACApB,IAAAA,mBAAmB,CAAC0B,GAAD,CAAnB,GAA2BX,KAAK,CAACQ,aAAN,CAAoBR,KAAK,CAACS,IAAN,KAAe,KAAf,GAAuB,MAAvB,GAAgCT,KAAK,CAACS,IAA1D,CAA3B;AACD;AACD,SAAOxB,mBAAmB,CAAC0B,GAAD,CAA1B;AACD,CATM,C","sourcesContent":["import { clamp, floatFromPercent } from './ColorHelpers';\nimport { ColorFactory } from './ColorFactory';\nimport { ColorObject } from './ColorObject';\n\ntype SignType = '+' | '-';\ntype MethodType = 'absolute' | 'relative';\n\nconst DEFAULT_DARK = ColorFactory.create('#333333');\nconst DEFAULT_LIGHT = ColorFactory.create('#fff');\nconst ColorFunctionsCache: { [key: string]: string } = Object.create(null);\n\nconst buildCacheKey = (name: string, ...args: any[]) => `${name}(${args.join()})`;\n\nconst shiftColor = (colorString: string, a: number | string, sign: SignType, method?: MethodType) => {\n if (!colorString) {\n return '';\n }\n\n if (colorString.toLowerCase() === 'transparent') {\n return 'transparent';\n }\n\n let amount: number;\n if (typeof a === 'string') {\n amount = a.endsWith('%') ? floatFromPercent(a) : parseFloat(a);\n } else {\n amount = a;\n }\n amount = clamp(amount, 1);\n\n const color = ColorFactory.create(colorString);\n const hsl = color.toHSL();\n\n if (sign === '+') {\n hsl.l += method === 'relative' ? hsl.l * amount : amount;\n } else {\n hsl.l -= method === 'relative' ? hsl.l * amount : amount;\n }\n\n hsl.l = clamp(hsl.l);\n\n let newColor: ColorObject;\n if (color.alpha < 1) {\n newColor = ColorFactory.create(`hsla(${hsl.h}, ${hsl.s}, ${hsl.l}, ${hsl.a})`);\n } else {\n newColor = ColorFactory.create(`hsl(${hsl.h}, ${hsl.s}, ${hsl.l})`);\n }\n return newColor.toColorString(color.type);\n};\n\nexport function lighten(colorString: string, amount: number | string, method?: MethodType) {\n const key = buildCacheKey('lighten', colorString, amount, method);\n if (ColorFunctionsCache[key] === undefined) {\n ColorFunctionsCache[key] = shiftColor(colorString, amount, '+', method);\n return ColorFunctionsCache[key];\n }\n return ColorFunctionsCache[key];\n}\nexport function darken(colorString: string, amount: number | string, method?: MethodType) {\n const key = buildCacheKey('darken', colorString, amount, method);\n if (ColorFunctionsCache[key] === undefined) {\n ColorFunctionsCache[key] = shiftColor(colorString, amount, '-', method);\n return ColorFunctionsCache[key];\n }\n\n return ColorFunctionsCache[key];\n}\nexport function contrast(colorString: string, darkString?: string, lightString?: string, threshold = 0.43) {\n const key = buildCacheKey('contrast', colorString, darkString, lightString, threshold);\n if (!colorString) {\n ColorFunctionsCache[key] = '';\n }\n if (ColorFunctionsCache[key] === undefined) {\n const color = ColorFactory.create(colorString);\n let dark = typeof darkString === 'undefined' ? DEFAULT_DARK : ColorFactory.create(darkString);\n let light = typeof lightString === 'undefined' ? DEFAULT_LIGHT : ColorFactory.create(lightString);\n\n // Figure out which is actually light and dark:\n if (dark.luma() > light.luma()) {\n [dark, light] = [light, dark];\n }\n\n if (color.luma() < threshold) {\n ColorFunctionsCache[key] = light.alpha < 1 ? light.toRGBString() : light.toHEXString();\n } else {\n ColorFunctionsCache[key] = dark.alpha < 1 ? dark.toRGBString() : dark.toHEXString();\n }\n }\n return ColorFunctionsCache[key]!;\n}\n\nexport const red = (colorString: string) => {\n const color = ColorFactory.create(colorString);\n return color.rgb[0];\n};\nexport const green = (colorString: string) => {\n const color = ColorFactory.create(colorString);\n return color.rgb[1];\n};\nexport const blue = (colorString: string) => {\n const color = ColorFactory.create(colorString);\n return color.rgb[2];\n};\nexport const alpha = (colorString: string) => {\n const color = ColorFactory.create(colorString);\n return color.alpha;\n};\nexport const isValid = (colorString: string) => {\n try {\n ColorFactory.create(colorString);\n return true;\n } catch (e) {\n return false;\n }\n};\nexport const fade = (colorString: string, alpha: number) => {\n const key = buildCacheKey('fade', colorString, alpha);\n\n if (ColorFunctionsCache[key] === undefined) {\n const color = ColorFactory.create(colorString).clone();\n color.alpha = alpha;\n ColorFunctionsCache[key] = color.toColorString(color.type === 'hex' ? 'rgba' : color.type);\n }\n return ColorFunctionsCache[key];\n};\n"]}
1
+ {"version":3,"sources":["ColorFunctions.ts"],"names":["DEFAULT_DARK","ColorFactory","create","DEFAULT_LIGHT","ColorFunctionsCache","Object","buildCacheKey","name","args","join","shiftColor","colorString","a","sign","method","toLowerCase","amount","endsWith","parseFloat","color","hsl","toHSL","l","newColor","alpha","h","s","toColorString","type","lighten","key","undefined","darken","contrast","darkString","lightString","threshold","dark","light","luma","toRGBString","toHEXString","red","rgb","green","blue","isValid","e","fade","clone"],"mappings":"wOAAA;AACA;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D;AACF,CAPM,C;AAQA,IAAMC,IAAI,GAAG,SAAPA,IAAO,CAACrC,WAAD,EAAsBa,KAAtB,EAAwC;AAC1D,MAAMM,GAAG,GAAGxB,aAAa,CAAC,MAAD,EAASK,WAAT,EAAsBa,KAAtB,CAAzB;;AAEA,MAAIpB,mBAAmB,CAAC0B,GAAD,CAAnB,KAA6BC,SAAjC,EAA4C;AAC1C,QAAMZ,KAAK,GAAGlB,2BAAaC,MAAb,CAAoBS,WAApB,EAAiCsC,KAAjC,EAAd;AACA9B,IAAAA,KAAK,CAACK,KAAN,GAAcA,KAAd;AACApB,IAAAA,mBAAmB,CAAC0B,GAAD,CAAnB,GAA2BX,KAAK,CAACQ,aAAN,CAAoBR,KAAK,CAACS,IAAN,KAAe,KAAf,GAAuB,MAAvB,GAAgCT,KAAK,CAACS,IAA1D,CAA3B;AACD;AACD,SAAOxB,mBAAmB,CAAC0B,GAAD,CAA1B;AACD,CATM,C","sourcesContent":["import { clamp, floatFromPercent } from './ColorHelpers';\nimport { ColorFactory } from './ColorFactory';\nimport { ColorObject } from './ColorObject';\n\ntype SignType = '+' | '-';\ntype MethodType = 'absolute' | 'relative';\n\nconst DEFAULT_DARK = ColorFactory.create('#333333');\nconst DEFAULT_LIGHT = ColorFactory.create('#fff');\nconst ColorFunctionsCache: { [key: string]: string } = Object.create(null);\n\nconst buildCacheKey = (name: string, ...args: any[]) => `${name}(${args.join()})`;\n\nconst shiftColor = (colorString: string, a: number | string, sign: SignType, method?: MethodType) => {\n if (!colorString) {\n return '';\n }\n\n if (colorString.toLowerCase() === 'transparent') {\n return 'transparent';\n }\n\n let amount: number;\n if (typeof a === 'string') {\n amount = a.endsWith('%') ? floatFromPercent(a) : parseFloat(a);\n } else {\n amount = a;\n }\n amount = clamp(amount, 1);\n\n const color = ColorFactory.create(colorString);\n const hsl = color.toHSL();\n\n if (sign === '+') {\n hsl.l += method === 'relative' ? hsl.l * amount : amount;\n } else {\n hsl.l -= method === 'relative' ? hsl.l * amount : amount;\n }\n\n hsl.l = clamp(hsl.l);\n\n let newColor: ColorObject;\n if (color.alpha < 1) {\n newColor = ColorFactory.create(`hsla(${hsl.h}, ${hsl.s}, ${hsl.l}, ${hsl.a})`);\n } else {\n newColor = ColorFactory.create(`hsl(${hsl.h}, ${hsl.s}, ${hsl.l})`);\n }\n return newColor.toColorString(color.type);\n};\n\nexport function lighten(colorString: string, amount: number | string, method?: MethodType) {\n const key = buildCacheKey('lighten', colorString, amount, method);\n if (ColorFunctionsCache[key] === undefined) {\n ColorFunctionsCache[key] = shiftColor(colorString, amount, '+', method);\n return ColorFunctionsCache[key];\n }\n return ColorFunctionsCache[key];\n}\nexport function darken(colorString: string, amount: number | string, method?: MethodType) {\n const key = buildCacheKey('darken', colorString, amount, method);\n if (ColorFunctionsCache[key] === undefined) {\n ColorFunctionsCache[key] = shiftColor(colorString, amount, '-', method);\n return ColorFunctionsCache[key];\n }\n\n return ColorFunctionsCache[key];\n}\nexport function contrast(colorString: string, darkString?: string, lightString?: string, threshold = 0.43) {\n const key = buildCacheKey('contrast', colorString, darkString, lightString, threshold);\n if (!colorString) {\n ColorFunctionsCache[key] = '';\n }\n if (ColorFunctionsCache[key] === undefined) {\n const color = ColorFactory.create(colorString);\n let dark = typeof darkString === 'undefined' ? DEFAULT_DARK : ColorFactory.create(darkString);\n let light = typeof lightString === 'undefined' ? DEFAULT_LIGHT : ColorFactory.create(lightString);\n\n // Figure out which is actually light and dark:\n if (dark.luma() > light.luma()) {\n [dark, light] = [light, dark];\n }\n\n if (color.luma() < threshold) {\n ColorFunctionsCache[key] = light.alpha < 1 ? light.toRGBString() : light.toHEXString();\n } else {\n ColorFunctionsCache[key] = dark.alpha < 1 ? dark.toRGBString() : dark.toHEXString();\n }\n }\n return ColorFunctionsCache[key];\n}\n\nexport const red = (colorString: string) => {\n const color = ColorFactory.create(colorString);\n return color.rgb[0];\n};\nexport const green = (colorString: string) => {\n const color = ColorFactory.create(colorString);\n return color.rgb[1];\n};\nexport const blue = (colorString: string) => {\n const color = ColorFactory.create(colorString);\n return color.rgb[2];\n};\nexport const alpha = (colorString: string) => {\n const color = ColorFactory.create(colorString);\n return color.alpha;\n};\nexport const isValid = (colorString: string) => {\n try {\n ColorFactory.create(colorString);\n return true;\n } catch (e) {\n return false;\n }\n};\nexport const fade = (colorString: string, alpha: number) => {\n const key = buildCacheKey('fade', colorString, alpha);\n\n if (ColorFunctionsCache[key] === undefined) {\n const color = ColorFactory.create(colorString).clone();\n color.alpha = alpha;\n ColorFunctionsCache[key] = color.toColorString(color.type === 'hex' ? 'rgba' : color.type);\n }\n return ColorFunctionsCache[key];\n};\n"]}
@@ -1,9 +1,7 @@
1
1
  import { Theme } from './Theme';
2
2
  export declare const AnimationKeyframes: {
3
- spinnerCloudOffset(t: Theme): string;
4
- spinnerCloudLength(t: Theme): string;
5
- spinnerCircleOffset(t: Theme): string;
6
- spinnerCircleLength(t: Theme): string;
7
- spinnerCircleRotate(t: Theme): string;
3
+ spinnerCircleOffset(): string;
4
+ spinnerCircleLength(): string;
5
+ spinnerCircleRotate(): string;
8
6
  spinnerColor(t: Theme): string;
9
7
  };
@@ -1,41 +1,27 @@
1
- "use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports.AnimationKeyframes = void 0;var _taggedTemplateLiteralLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteralLoose"));var _Emotion = require("./Emotion");var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
1
+ "use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports.AnimationKeyframes = void 0;var _taggedTemplateLiteralLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteralLoose"));var _Emotion = require("./Emotion");var _templateObject, _templateObject2, _templateObject3, _templateObject4;
2
2
 
3
3
 
4
4
  var AnimationKeyframes = {
5
- spinnerCloudOffset: function spinnerCloudOffset(t) {
6
- return (0, _Emotion.keyframes)(_templateObject || (_templateObject = (0, _taggedTemplateLiteralLoose2.default)(["\n 0% { stroke-dashoffset: 10; }\n 100% { stroke-dashoffset: 116; }\n "])));
5
+ spinnerCircleOffset: function spinnerCircleOffset() {
6
+ return (0, _Emotion.keyframes)(_templateObject || (_templateObject = (0, _taggedTemplateLiteralLoose2.default)(["\n 0% { stroke-dashoffset: 231.25%; }\n 100% { stroke-dashoffset: 0%; }\n "])));
7
7
 
8
8
 
9
9
 
10
10
  },
11
-
12
- spinnerCloudLength: function spinnerCloudLength(t) {
13
- return (0, _Emotion.keyframes)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteralLoose2.default)(["\n 0% { stroke-dasharray: 10, 96; }\n 50% { stroke-dasharray: 50, 56; }\n 100% { stroke-dasharray: 10, 96;}\n "])));
14
-
15
-
16
-
17
-
18
- },
19
- spinnerCircleOffset: function spinnerCircleOffset(t) {
20
- return (0, _Emotion.keyframes)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteralLoose2.default)(["\n 0% { stroke-dashoffset: 231.25%; }\n 100% { stroke-dashoffset: 0%; }\n "])));
21
-
22
-
23
-
24
- },
25
- spinnerCircleLength: function spinnerCircleLength(t) {
26
- return (0, _Emotion.keyframes)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteralLoose2.default)(["\n 0% { stroke-dasharray: 62.5%, 168.75%; }\n 50% { stroke-dasharray: 187.5%, 43.75%; }\n 100% { stroke-dasharray: 62.5%, 168.75%; }\n "])));
11
+ spinnerCircleLength: function spinnerCircleLength() {
12
+ return (0, _Emotion.keyframes)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteralLoose2.default)(["\n 0% { stroke-dasharray: 62.5%, 168.75%; }\n 50% { stroke-dasharray: 187.5%, 43.75%; }\n 100% { stroke-dasharray: 62.5%, 168.75%; }\n "])));
27
13
 
28
14
 
29
15
 
30
16
 
31
17
  },
32
- spinnerCircleRotate: function spinnerCircleRotate(t) {
33
- return (0, _Emotion.keyframes)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteralLoose2.default)(["\n 100% { transform: rotate(360deg); }\n "])));
18
+ spinnerCircleRotate: function spinnerCircleRotate() {
19
+ return (0, _Emotion.keyframes)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteralLoose2.default)(["\n 100% { transform: rotate(360deg); }\n "])));
34
20
 
35
21
 
36
22
  },
37
23
  spinnerColor: function spinnerColor(t) {
38
- return (0, _Emotion.keyframes)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteralLoose2.default)(["\n 100%, 0% { stroke: ", "; }\n 40% { stroke: ", "; }\n 66% { stroke: ", "; }\n 80%, 90% { stroke: ", "; }\n "])),
24
+ return (0, _Emotion.keyframes)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteralLoose2.default)(["\n 100%, 0% { stroke: ", "; }\n 40% { stroke: ", "; }\n 66% { stroke: ", "; }\n 80%, 90% { stroke: ", "; }\n "])),
39
25
  t.red,
40
26
  t.yellow,
41
27
  t.green,
@@ -1 +1 @@
1
- {"version":3,"sources":["AnimationKeyframes.ts"],"names":["AnimationKeyframes","spinnerCloudOffset","t","keyframes","spinnerCloudLength","spinnerCircleOffset","spinnerCircleLength","spinnerCircleRotate","spinnerColor","red","yellow","green","brand"],"mappings":"wRAAA,oC;;;AAGO,IAAMA,kBAAkB,GAAG;AAChCC,EAAAA,kBADgC,8BACbC,CADa,EACH;AAC3B,eAAOC,kBAAP;;;;AAID,GAN+B;;AAQhCC,EAAAA,kBARgC,8BAQbF,CARa,EAQH;AAC3B,eAAOC,kBAAP;;;;;AAKD,GAd+B;AAehCE,EAAAA,mBAfgC,+BAeZH,CAfY,EAeF;AAC5B,eAAOC,kBAAP;;;;AAID,GApB+B;AAqBhCG,EAAAA,mBArBgC,+BAqBZJ,CArBY,EAqBF;AAC5B,eAAOC,kBAAP;;;;;AAKD,GA3B+B;AA4BhCI,EAAAA,mBA5BgC,+BA4BZL,CA5BY,EA4BF;AAC5B,eAAOC,kBAAP;;;AAGD,GAhC+B;AAiChCK,EAAAA,YAjCgC,wBAiCnBN,CAjCmB,EAiCT;AACrB,eAAOC,kBAAP;AACyBD,IAAAA,CAAC,CAACO,GAD3B;AAEoBP,IAAAA,CAAC,CAACQ,MAFtB;AAGoBR,IAAAA,CAAC,CAACS,KAHtB;AAIyBT,IAAAA,CAAC,CAACU,KAJ3B;;AAMD,GAxC+B,EAA3B,C","sourcesContent":["import { keyframes } from './Emotion';\nimport { Theme } from './Theme';\n\nexport const AnimationKeyframes = {\n spinnerCloudOffset(t: Theme) {\n return keyframes`\n 0% { stroke-dashoffset: 10; }\n 100% { stroke-dashoffset: 116; }\n `;\n },\n\n spinnerCloudLength(t: Theme) {\n return keyframes`\n 0% { stroke-dasharray: 10, 96; }\n 50% { stroke-dasharray: 50, 56; }\n 100% { stroke-dasharray: 10, 96;}\n `;\n },\n spinnerCircleOffset(t: Theme) {\n return keyframes`\n 0% { stroke-dashoffset: 231.25%; }\n 100% { stroke-dashoffset: 0%; }\n `;\n },\n spinnerCircleLength(t: Theme) {\n return keyframes`\n 0% { stroke-dasharray: 62.5%, 168.75%; }\n 50% { stroke-dasharray: 187.5%, 43.75%; }\n 100% { stroke-dasharray: 62.5%, 168.75%; }\n `;\n },\n spinnerCircleRotate(t: Theme) {\n return keyframes`\n 100% { transform: rotate(360deg); }\n `;\n },\n spinnerColor(t: Theme) {\n return keyframes`\n 100%, 0% { stroke: ${t.red}; }\n 40% { stroke: ${t.yellow}; }\n 66% { stroke: ${t.green}; }\n 80%, 90% { stroke: ${t.brand}; }\n `;\n },\n};\n"]}
1
+ {"version":3,"sources":["AnimationKeyframes.ts"],"names":["AnimationKeyframes","spinnerCircleOffset","keyframes","spinnerCircleLength","spinnerCircleRotate","spinnerColor","t","red","yellow","green","brand"],"mappings":"wRAAA,oC;;;AAGO,IAAMA,kBAAkB,GAAG;AAChCC,EAAAA,mBADgC,iCACV;AACpB,eAAOC,kBAAP;;;;AAID,GAN+B;AAOhCC,EAAAA,mBAPgC,iCAOV;AACpB,eAAOD,kBAAP;;;;;AAKD,GAb+B;AAchCE,EAAAA,mBAdgC,iCAcV;AACpB,eAAOF,kBAAP;;;AAGD,GAlB+B;AAmBhCG,EAAAA,YAnBgC,wBAmBnBC,CAnBmB,EAmBT;AACrB,eAAOJ,kBAAP;AACyBI,IAAAA,CAAC,CAACC,GAD3B;AAEoBD,IAAAA,CAAC,CAACE,MAFtB;AAGoBF,IAAAA,CAAC,CAACG,KAHtB;AAIyBH,IAAAA,CAAC,CAACI,KAJ3B;;AAMD,GA1B+B,EAA3B,C","sourcesContent":["import { keyframes } from './Emotion';\nimport { Theme } from './Theme';\n\nexport const AnimationKeyframes = {\n spinnerCircleOffset() {\n return keyframes`\n 0% { stroke-dashoffset: 231.25%; }\n 100% { stroke-dashoffset: 0%; }\n `;\n },\n spinnerCircleLength() {\n return keyframes`\n 0% { stroke-dasharray: 62.5%, 168.75%; }\n 50% { stroke-dasharray: 187.5%, 43.75%; }\n 100% { stroke-dasharray: 62.5%, 168.75%; }\n `;\n },\n spinnerCircleRotate() {\n return keyframes`\n 100% { transform: rotate(360deg); }\n `;\n },\n spinnerColor(t: Theme) {\n return keyframes`\n 100%, 0% { stroke: ${t.red}; }\n 40% { stroke: ${t.yellow}; }\n 66% { stroke: ${t.green}; }\n 80%, 90% { stroke: ${t.brand}; }\n `;\n },\n};\n"]}
@@ -5,6 +5,7 @@ var _Upgrades = require("../Upgrades");
5
5
 
6
6
 
7
7
 
8
+
8
9
  var REACT_UI_PREFIX = _Upgrades.Upgrade.getSpecificityClassName();
9
10
 
10
11
  var scope = new Array(_Upgrades.Upgrade.getSpecificityLevel()).fill("." + REACT_UI_PREFIX).join('');
@@ -1 +1 @@
1
- {"version":3,"sources":["Emotion.ts"],"names":["REACT_UI_PREFIX","Upgrade","getSpecificityClassName","scope","Array","getSpecificityLevel","fill","join","key","prepend","stylisPlugins","undefined","flush","hydrate","cx","merge","getRegisteredStyles","injectGlobal","keyframes","css","sheet","cache","isZeroArgs","fn","length","memoize","isCalled","result","WeakMap","arg","has","set","get","memoizeStyle","styles","Object","keys","forEach","className","prefix","component","app","classes","reduce","acc"],"mappings":"mbAAA;AACA;;AAEA;;;;AAIA,IAAMA,eAAe,GAAGC,kBAAQC,uBAAR,EAAxB;;AAEA,IAAMC,KAAK,GAAG,IAAIC,KAAJ,CAAUH,kBAAQI,mBAAR,EAAV,EAAyCC,IAAzC,OAAkDN,eAAlD,EAAqEO,IAArE,CAA0E,EAA1E,CAAd;;AAEO;AACL,6BAAc;AACZC,EAAAA,GAAG,EAAER,eADO;AAEZS,EAAAA,OAAO,EAAE,IAFG;AAGZC,EAAAA,aAAa,EAAEP,KAAK,GAAG,CAAC,qCAAiBA,KAAjB,CAAD,CAAH,GAA+BQ,SAHvC,EAAd,CADK,CAAQC,KAAR,kBAAQA,KAAR,CAAeC,OAAf,kBAAeA,OAAf,CAAwBC,EAAxB,kBAAwBA,EAAxB,CAA4BC,KAA5B,kBAA4BA,KAA5B,CAAmCC,mBAAnC,kBAAmCA,mBAAnC,CAAwDC,YAAxD,kBAAwDA,YAAxD,CAAsEC,SAAtE,kBAAsEA,SAAtE,CAAiFC,GAAjF,kBAAiFA,GAAjF,CAAsFC,KAAtF,kBAAsFA,KAAtF,CAA6FC,KAA7F,kBAA6FA,KAA7F,C;;;AAOP,SAASC,UAAT,CAAwDC,EAAxD,EAAyF;AACvF,SAAOA,EAAE,CAACC,MAAH,KAAc,CAArB;AACD;;AAED,IAAMC,OAAO,GAAG,SAAVA,OAAU,CAAsBF,EAAtB,EAAuF;AACrG,MAAID,UAAU,CAACC,EAAD,CAAd,EAAoB;AAClB,QAAIG,QAAQ,GAAG,KAAf;AACA,QAAIC,MAAJ;AACA,WAAO,YAAM;AACX,UAAI,CAACD,QAAL,EAAe;AACbA,QAAAA,QAAQ,GAAG,IAAX;AACAC,QAAAA,MAAM,GAAGJ,EAAE,EAAX;AACD;AACD,aAAOI,MAAP;AACD,KAND;AAOD;;AAED,MAAMN,KAAK,GAAG,IAAIO,OAAJ,EAAd;AACA,SAAO,UAACC,GAAD,EAAY;AACjB,QAAI,CAACR,KAAK,CAACS,GAAN,CAAUD,GAAV,CAAL,EAAqB;AACnBR,MAAAA,KAAK,CAACU,GAAN,CAAUF,GAAV,EAAeN,EAAE,CAACM,GAAD,CAAjB;AACD;;AAED,WAAOR,KAAK,CAACW,GAAN,CAAUH,GAAV,CAAP;AACD,GAND;AAOD,CArBD;;AAuBO,IAAMI,YAAY,GAAG,SAAfA,YAAe;AAC1BC,MAD0B;AAEpB;AACNC,EAAAA,MAAM,CAACC,IAAP,CAAYF,MAAZ,EAAoBG,OAApB,CAA4B,UAACC,SAAD,UAAgBJ,MAAM,CAACI,SAAD,CAAN,GAA+Bb,OAAO,CAACS,MAAM,CAACI,SAAD,CAAP,CAAtD,EAA5B;AACA,SAAOJ,MAAP;AACD,CALM,C;;AAOA,IAAMK,MAAM;AACjB,SADWA,MACX,CAACC,SAAD,EAAoBC,GAApB,OAAoBA,GAApB,cAAoBA,GAApB,GAA0BzC,eAA1B;AACA,cAAmC0C,OAAnC;AACEP,QAAAA,MAAM,CAACC,IAAP,CAAYM,OAAZ,EAAqBC,MAArB,CAA4B,UAACC,GAAD,EAAMpC,GAAN,EAAc;AACxC,4CAAYoC,GAAZ,6BAAkBpC,GAAlB,IAA2BiC,GAA3B,SAAkCD,SAAlC,SAA+CE,OAAO,CAAClC,GAAD,CAAtD;AACD,SAFD,EAEG,EAFH,CADF,GADA,GADK,C","sourcesContent":["import createEmotion from '@emotion/css/create-instance';\nimport extraScopePlugin from 'stylis-plugin-extra-scope';\n\nimport { Upgrade } from '../Upgrades';\n\nimport { Theme } from './Theme';\n\nconst REACT_UI_PREFIX = Upgrade.getSpecificityClassName();\n\nconst scope = new Array(Upgrade.getSpecificityLevel()).fill(`.${REACT_UI_PREFIX}`).join('');\n\nexport const { flush, hydrate, cx, merge, getRegisteredStyles, injectGlobal, keyframes, css, sheet, cache } =\n createEmotion({\n key: REACT_UI_PREFIX,\n prepend: true,\n stylisPlugins: scope ? [extraScopePlugin(scope)] : undefined,\n });\n\nfunction isZeroArgs<R, T extends (...args: any[]) => R>(fn: T | Function): fn is () => R {\n return fn.length === 0;\n}\n\nconst memoize = <A extends object, R>(fn: (() => R) | ((arg: A) => R)): (() => R) | ((arg: A) => R) => {\n if (isZeroArgs(fn)) {\n let isCalled = false;\n let result: R;\n return () => {\n if (!isCalled) {\n isCalled = true;\n result = fn();\n }\n return result;\n };\n }\n\n const cache = new WeakMap();\n return (arg: A) => {\n if (!cache.has(arg)) {\n cache.set(arg, fn(arg));\n }\n\n return cache.get(arg);\n };\n};\n\nexport const memoizeStyle = <S extends { [className: string]: (() => string) | ((t: Theme) => string) }>(\n styles: S,\n): S => {\n Object.keys(styles).forEach((className) => (styles[className as keyof S] = memoize(styles[className]) as S[keyof S]));\n return styles;\n};\n\nexport const prefix =\n (component: string, app = REACT_UI_PREFIX) =>\n <T extends Record<string, string>>(classes: T): T =>\n Object.keys(classes).reduce((acc, key) => {\n return { ...acc, [key]: `${app}-${component}-${classes[key]}` };\n }, {} as T);\n"]}
1
+ {"version":3,"sources":["Emotion.ts"],"names":["REACT_UI_PREFIX","Upgrade","getSpecificityClassName","scope","Array","getSpecificityLevel","fill","join","key","prepend","stylisPlugins","undefined","flush","hydrate","cx","merge","getRegisteredStyles","injectGlobal","keyframes","css","sheet","cache","isZeroArgs","fn","length","memoize","isCalled","result","WeakMap","arg","has","set","get","memoizeStyle","styles","Object","keys","forEach","className","prefix","component","app","classes","reduce","acc"],"mappings":"mbAAA;AACA;;AAEA;;;;;AAKA,IAAMA,eAAe,GAAGC,kBAAQC,uBAAR,EAAxB;;AAEA,IAAMC,KAAK,GAAG,IAAIC,KAAJ,CAAUH,kBAAQI,mBAAR,EAAV,EAAyCC,IAAzC,OAAkDN,eAAlD,EAAqEO,IAArE,CAA0E,EAA1E,CAAd;;AAEO;AACL,6BAAc;AACZC,EAAAA,GA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NC,EAAAA,MAAM,CAACC,IAAP,CAAYF,MAAZ,EAAoBG,OAApB,CAA4B,UAACC,SAAD,UAAgBJ,MAAM,CAACI,SAAD,CAAN,GAA+Bb,OAAO,CAACS,MAAM,CAACI,SAAD,CAAP,CAAtD,EAA5B;AACA,SAAOJ,MAAP;AACD,CALM,C;;AAOA,IAAMK,MAAM;AACjB,SADWA,MACX,CAACC,SAAD,EAAoBC,GAApB,OAAoBA,GAApB,cAAoBA,GAApB,GAA0BzC,eAA1B;AACA,cAAmC0C,OAAnC;AACEP,QAAAA,MAAM,CAACC,IAAP,CAAYM,OAAZ,EAAqBC,MAArB,CAA4B,UAACC,GAAD,EAAMpC,GAAN,EAAc;AACxC,4CAAYoC,GAAZ,6BAAkBpC,GAAlB,IAA2BiC,GAA3B,SAAkCD,SAAlC,SAA+CE,OAAO,CAAClC,GAAD,CAAtD;AACD,SAFD,EAEG,EAFH,CADF,GADA,GADK,C","sourcesContent":["import createEmotion from '@emotion/css/create-instance';\nimport extraScopePlugin from 'stylis-plugin-extra-scope';\n\nimport { Upgrade } from '../Upgrades';\nimport { AnyObject, FunctionWithParams } from '../utils';\n\nimport { Theme } from './Theme';\n\nconst REACT_UI_PREFIX = Upgrade.getSpecificityClassName();\n\nconst scope = new Array(Upgrade.getSpecificityLevel()).fill(`.${REACT_UI_PREFIX}`).join('');\n\nexport const { flush, hydrate, cx, merge, getRegisteredStyles, injectGlobal, keyframes, css, sheet, cache } =\n createEmotion({\n key: REACT_UI_PREFIX,\n prepend: true,\n stylisPlugins: scope ? [extraScopePlugin(scope)] : undefined,\n });\n\nfunction isZeroArgs<R, T extends FunctionWithParams<R>>(fn: T | FunctionWithParams<R>): fn is () => R {\n return fn.length === 0;\n}\n\nconst memoize = <A extends AnyObject, R>(fn: (() => R) | ((arg: A) => R)): (() => R) | ((arg: A) => R) => {\n if (isZeroArgs(fn)) {\n let isCalled = false;\n let result: R;\n return () => {\n if (!isCalled) {\n isCalled = true;\n result = fn();\n }\n return result;\n };\n }\n\n const cache = new WeakMap();\n return (arg: A) => {\n if (!cache.has(arg)) {\n cache.set(arg, fn(arg));\n }\n\n return cache.get(arg);\n };\n};\n\nexport const memoizeStyle = <S extends { [className: string]: (() => string) | ((t: Theme) => string) }>(\n styles: S,\n): S => {\n Object.keys(styles).forEach((className) => (styles[className as keyof S] = memoize(styles[className]) as S[keyof S]));\n return styles;\n};\n\nexport const prefix =\n (component: string, app = REACT_UI_PREFIX) =>\n <T extends Record<string, string>>(classes: T): T =>\n Object.keys(classes).reduce((acc, key) => {\n return { ...acc, [key]: `${app}-${component}-${classes[key]}` };\n }, {} as T);\n"]}
@@ -1,6 +1,6 @@
1
1
  import { Theme, ThemeIn } from './Theme';
2
2
  export declare class ThemeFactory {
3
- static create<T extends {}>(theme: ThemeIn & T, baseTheme?: Theme): Readonly<Theme & T>;
3
+ static create<T extends unknown>(theme: ThemeIn & T, baseTheme?: Theme): Readonly<Theme & T>;
4
4
  static overrideDefaultTheme(theme: Theme): void;
5
5
  static getKeys<T extends Theme>(theme: T): (keyof T)[];
6
6
  private static constructTheme;
@@ -37,7 +37,9 @@ ThemeFactory = /*#__PURE__*/function () {function ThemeFactory() {}ThemeFactory.
37
37
  var newTheme = Object.create(base);
38
38
  Object.keys(theme).forEach(function (propName) {
39
39
  var descriptor = Object.getOwnPropertyDescriptor(theme, propName);
40
- Object.defineProperty(newTheme, propName, descriptor);
40
+ if (descriptor) {
41
+ Object.defineProperty(newTheme, propName, descriptor);
42
+ }
41
43
  });
42
44
 
43
45
  return Object.freeze(newTheme);
@@ -1 +1 @@
1
- {"version":3,"sources":["ThemeFactory.ts"],"names":["ThemeFactory","create","theme","baseTheme","base","DefaultThemeInternal","constructTheme","overrideDefaultTheme","getKeys","forEach","variableName","descriptor","Object","defineProperty","keys","key","includes","push","getPrototypeOf","sort","newTheme","propName","getOwnPropertyDescriptor","freeze"],"mappings":"qEAAA;AACA;;;AAGA,8C;;AAEaA,Y;AACGC,EAAAA,M,GAAd,gB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nB;AACAT,MAAAA,MAAM,CAACC,cAAP,CAAsBO,QAAtB,EAAgCC,QAAhC,EAA0CV,UAA1C;AACD,KAHD;;AAKA,WAAOC,MAAM,CAACW,MAAP,CAAcH,QAAd,CAAP;AACD,G","sourcesContent":["import { DefaultThemeInternal } from '../../internal/themes/DefaultTheme';\nimport { isNonNullable } from '../utils';\n\nimport { Theme, ThemeIn } from './Theme';\nimport { findPropertyDescriptor } from './ThemeHelpers';\n\nexport class ThemeFactory {\n public static create<T extends {}>(theme: ThemeIn & T, baseTheme?: Theme): Readonly<Theme & T> {\n const base = baseTheme || DefaultThemeInternal;\n return this.constructTheme(base, theme);\n }\n\n public static overrideDefaultTheme(theme: Theme) {\n ThemeFactory.getKeys(DefaultThemeInternal).forEach((variableName) => {\n const descriptor = findPropertyDescriptor(theme, variableName);\n Object.defineProperty(DefaultThemeInternal, variableName, descriptor);\n });\n }\n\n public static getKeys<T extends Theme>(theme: T) {\n const keys: Array<keyof T> = [];\n while (isNonNullable(theme)) {\n (Object.keys(theme) as typeof keys).forEach((key) => {\n if (!keys.includes(key)) {\n keys.push(key);\n }\n });\n // TODO: Enable `no-param-reassign` rule.\n // eslint-disable-next-line no-param-reassign\n theme = Object.getPrototypeOf(theme);\n }\n\n return keys.sort();\n }\n\n private static constructTheme(base: Theme, theme: ThemeIn) {\n const newTheme = Object.create(base);\n Object.keys(theme).forEach((propName) => {\n const descriptor = Object.getOwnPropertyDescriptor(theme, propName)!;\n Object.defineProperty(newTheme, propName, descriptor);\n });\n\n return Object.freeze(newTheme);\n }\n}\n"]}
1
+ {"version":3,"sources":["ThemeFactory.ts"],"names":["ThemeFactory","create","theme","baseTheme","base","DefaultThemeInternal","constructTheme","overrideDefaultTheme","getKeys","forEach","variableName","descriptor","Object","defineProperty","keys","key","includes","push","getPrototypeOf","sort","newTheme","propName","getOwnPropertyDescriptor","freeze"],"mappings":"qEAAA;AACA;;;AAGA,8C;;AAEaA,Y;AACGC,EAAAA,M,GAAd,gBAAw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ACA,UAAIV,UAAJ,EAAgB;AACdC,QAAAA,MAAM,CAACC,cAAP,CAAsBO,QAAtB,EAAgCC,QAAhC,EAA0CV,UAA1C;AACD;AACF,KALD;;AAOA,WAAOC,MAAM,CAACW,MAAP,CAAcH,QAAd,CAAP;AACD,G","sourcesContent":["import { DefaultThemeInternal } from '../../internal/themes/DefaultTheme';\nimport { isNonNullable } from '../utils';\n\nimport { Theme, ThemeIn } from './Theme';\nimport { findPropertyDescriptor } from './ThemeHelpers';\n\nexport class ThemeFactory {\n public static create<T extends unknown>(theme: ThemeIn & T, baseTheme?: Theme): Readonly<Theme & T> {\n const base = baseTheme || DefaultThemeInternal;\n return this.constructTheme(base, theme);\n }\n\n public static overrideDefaultTheme(theme: Theme) {\n ThemeFactory.getKeys(DefaultThemeInternal).forEach((variableName) => {\n const descriptor = findPropertyDescriptor(theme, variableName);\n Object.defineProperty(DefaultThemeInternal, variableName, descriptor);\n });\n }\n\n public static getKeys<T extends Theme>(theme: T) {\n const keys: Array<keyof T> = [];\n while (isNonNullable(theme)) {\n (Object.keys(theme) as typeof keys).forEach((key) => {\n if (!keys.includes(key)) {\n keys.push(key);\n }\n });\n // TODO: Enable `no-param-reassign` rule.\n // eslint-disable-next-line no-param-reassign\n theme = Object.getPrototypeOf(theme);\n }\n\n return keys.sort();\n }\n\n private static constructTheme(base: Theme, theme: ThemeIn) {\n const newTheme = Object.create(base);\n Object.keys(theme).forEach((propName) => {\n const descriptor = Object.getOwnPropertyDescriptor(theme, propName);\n if (descriptor) {\n Object.defineProperty(newTheme, propName, descriptor);\n }\n });\n\n return Object.freeze(newTheme);\n }\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import { Theme, ThemeIn } from './Theme';
2
- export declare const exposeGetters: <T extends object>(theme: T) => T;
2
+ export declare const exposeGetters: <T extends Record<string, any>>(theme: T) => T;
3
3
  export declare const REACT_UI_DARK_THEME_KEY = "__IS_REACT_UI_DARK_THEME__";
4
4
  export declare const isDarkTheme: (theme: Theme | ThemeIn) => boolean;
5
- export declare const markAsDarkTheme: <T extends object>(theme: T) => T;
5
+ export declare const markAsDarkTheme: <T extends Record<string, any>>(theme: T) => T;
6
6
  export declare function findPropertyDescriptor(theme: Theme, propName: keyof Theme): PropertyDescriptor;
@@ -17,7 +17,7 @@ var exposeGetters = function exposeGetters(theme) {
17
17
  var REACT_UI_DARK_THEME_KEY = '__IS_REACT_UI_DARK_THEME__';exports.REACT_UI_DARK_THEME_KEY = REACT_UI_DARK_THEME_KEY;
18
18
 
19
19
  var isDarkTheme = function isDarkTheme(theme) {
20
- //@ts-ignore
20
+ // @ts-expect-error: internal value.
21
21
  return theme[REACT_UI_DARK_THEME_KEY] === true;
22
22
  };exports.isDarkTheme = isDarkTheme;
23
23
 
@@ -1 +1 @@
1
- {"version":3,"sources":["ThemeHelpers.ts"],"names":["exposeGetters","theme","descriptors","Object","getOwnPropertyDescriptors","keys","forEach","key","descriptor","get","configurable","enumerable","defineProperty","REACT_UI_DARK_THEME_KEY","isDarkTheme","markAsDarkTheme","create","value","writable","findPropertyDescriptor","propName","getPrototypeOf","prototype","hasOwnProperty","call","getOwnPropertyDescriptor"],"mappings":"uNAAA;;;;AAIO,IAAMA,aAAa,GAAG,SAAhBA,aAAgB,CAAmBC,KAAnB,EAAmC;AAC9D,MAAMC,WAAW,GAAGC,MAAM,CAACC,yBAAP,CAAiCH,KAAjC,CAApB;AACAE,EAAAA,MAAM,CAACE,IAAP,CAAYH,WAAZ,EAAyBI,OAAzB,CAAiC,UAACC,GAAD,EAAS;AACxC,QAAMC,UAAU,GAAGN,WAAW,CAACK,GAAD,CAA9B;AACA,QAAI,OAAOC,UAAU,CAACC,GAAlB,KAA0B,UAA1B,IAAwCD,UAAU,CAACE,YAAvD,EAAqE;AACnEF,MAAAA,UAAU,CAACG,UAAX,GAAwB,IAAxB;AACAR,MAAAA,MAAM,CAACS,cAAP,CAAsBX,KAAtB,EAA6BM,GAA7B,EAAkCC,UAAlC;AACD;AACF,GAND;AAOA,SAAOP,KAAP;AACD,CAVM,C;;AAYA,IAAMY,uBAAuB,GAAG,4BAAhC,C;;AAEA,IAAMC,WAAW,GAAG,SAAdA,WAAc,CAACb,KAAD,EAAqC;AAC9D;AACA,SAAOA,KAAK,CAACY,uBAAD,CAAL,KAAmC,IAA1C;AACD,CAHM,C;;AAKA,IAAME,eAAe,GAAG,SAAlBA,eAAkB,CAAmBd,KAAnB,EAAmC;AAChE,SAAOE,MAAM,CAACa,MAAP,CAAcf,KAAd;AACJY,EAAAA,uBADI,IACsB;AACzBI,IAAAA,KAAK,EAAE,IADkB;AAEzBC,IAAAA,QAAQ,EAAE,KAFe;AAGzBP,IAAAA,UAAU,EAAE,KAHa;AAIzBD,IAAAA,YAAY,EAAE,KAJW,EADtB,kBAAP;;;AAQD,CATM,C;;AAWA,SAASS,sBAAT,CAAgClB,KAAhC,EAA8CmB,QAA9C,EAAqE;AAC1E;AACA;AACA;AACA,SAAO,0BAAcnB,KAAd,CAAP,EAA6BA,KAAK,GAAGE,MAAM,CAACkB,cAAP,CAAsBpB,KAAtB,CAArC,EAAmE;AACjE,QAAIE,MAAM,CAACmB,SAAP,CAAiBC,cAAjB,CAAgCC,IAAhC,CAAqCvB,KAArC,EAA4CmB,QAA5C,CAAJ,EAA2D;AACzD,aAAOjB,MAAM,CAACsB,wBAAP,CAAgCxB,KAAhC,EAAuCmB,QAAvC,KAAoD,EAA3D;AACD;AACF;AACD,SAAO,EAAP;AACD","sourcesContent":["import { isNonNullable } from '../utils';\n\nimport { Theme, ThemeIn } from './Theme';\n\nexport const exposeGetters = <T extends object>(theme: T): T => {\n const descriptors = Object.getOwnPropertyDescriptors(theme);\n Object.keys(descriptors).forEach((key) => {\n const descriptor = descriptors[key];\n if (typeof descriptor.get === 'function' && descriptor.configurable) {\n descriptor.enumerable = true;\n Object.defineProperty(theme, key, descriptor);\n }\n });\n return theme;\n};\n\nexport const REACT_UI_DARK_THEME_KEY = '__IS_REACT_UI_DARK_THEME__';\n\nexport const isDarkTheme = (theme: Theme | ThemeIn): boolean => {\n //@ts-ignore\n return theme[REACT_UI_DARK_THEME_KEY] === true;\n};\n\nexport const markAsDarkTheme = <T extends object>(theme: T): T => {\n return Object.create(theme, {\n [REACT_UI_DARK_THEME_KEY]: {\n value: true,\n writable: false,\n enumerable: false,\n configurable: false,\n },\n });\n};\n\nexport function findPropertyDescriptor(theme: Theme, propName: keyof Theme) {\n // TODO: Rewrite for loop.\n // TODO: Enable `no-param-reassign` rule.\n // eslint-disable-next-line no-param-reassign\n for (; isNonNullable(theme); theme = Object.getPrototypeOf(theme)) {\n if (Object.prototype.hasOwnProperty.call(theme, propName)) {\n return Object.getOwnPropertyDescriptor(theme, propName) || {};\n }\n }\n return {};\n}\n"]}
1
+ {"version":3,"sources":["ThemeHelpers.ts"],"names":["exposeGetters","theme","descriptors","Object","getOwnPropertyDescriptors","keys","forEach","key","descriptor","get","configurable","enumerable","defineProperty","REACT_UI_DARK_THEME_KEY","isDarkTheme","markAsDarkTheme","create","value","writable","findPropertyDescriptor","propName","getPrototypeOf","prototype","hasOwnProperty","call","getOwnPropertyDescriptor"],"mappings":"uNAAA;;;;AAIO,IAAMA,aAAa,GAAG,SAAhBA,aAAgB,CAAgCC,KAAhC,EAAgD;AAC3E,MAAMC,WAAW,GAAGC,MAAM,CAACC,yBAAP,CAAiCH,KAAjC,CAApB;AACAE,EAAAA,MAAM,CAACE,IAAP,CAAYH,WAAZ,EAAyBI,OAAzB,CAAiC,UAACC,GAAD,EAAS;AACxC,QAAMC,UAAU,GAAGN,WAAW,CAACK,GAAD,CAA9B;AACA,QAAI,OAAOC,UAAU,CAACC,GAAlB,KAA0B,UAA1B,IAAwCD,UAAU,CAACE,YAAvD,EAAqE;AACnEF,MAAAA,UAAU,CAACG,UAAX,GAAwB,IAAxB;AACAR,MAAAA,MAAM,CAACS,cAAP,CAAsBX,KAAtB,EAA6BM,GAA7B,EAAkCC,UAAlC;AACD;AACF,GAND;AAOA,SAAOP,KAAP;AACD,CAVM,C;;AAYA,IAAMY,uBAAuB,GAAG,4BAAhC,C;;AAEA,IAAMC,WAAW,GAAG,SAAdA,WAAc,CAACb,KAAD,EAAqC;AAC9D;AACA,SAAOA,KAAK,CAACY,uBAAD,CAAL,KAAmC,IAA1C;AACD,CAHM,C;;AAKA,IAAME,eAAe,GAAG,SAAlBA,eAAkB,CAAgCd,KAAhC,EAAgD;AAC7E,SAAOE,MAAM,CAACa,MAAP,CAAcf,KAAd;AACJY,EAAAA,uBADI,IACsB;AACzBI,IAAAA,KAAK,EAAE,IADkB;AAEzBC,IAAAA,QAAQ,EAAE,KAFe;AAGzBP,IAAAA,UAAU,EAAE,KAHa;AAIzBD,IAAAA,YAAY,EAAE,KAJW,EADtB,kBAAP;;;AAQD,CATM,C;;AAWA,SAASS,sBAAT,CAAgClB,KAAhC,EAA8CmB,QAA9C,EAAqE;AAC1E;AACA;AACA;AACA,SAAO,0BAAcnB,KAAd,CAAP,EAA6BA,KAAK,GAAGE,MAAM,CAACkB,cAAP,CAAsBpB,KAAtB,CAArC,EAAmE;AACjE,QAAIE,MAAM,CAACmB,SAAP,CAAiBC,cAAjB,CAAgCC,IAAhC,CAAqCvB,KAArC,EAA4CmB,QAA5C,CAAJ,EAA2D;AACzD,aAAOjB,MAAM,CAACsB,wBAAP,CAAgCxB,KAAhC,EAAuCmB,QAAvC,KAAoD,EAA3D;AACD;AACF;AACD,SAAO,EAAP;AACD","sourcesContent":["import { isNonNullable } from '../utils';\n\nimport { Theme, ThemeIn } from './Theme';\n\nexport const exposeGetters = <T extends Record<string, any>>(theme: T): T => {\n const descriptors = Object.getOwnPropertyDescriptors(theme);\n Object.keys(descriptors).forEach((key) => {\n const descriptor = descriptors[key];\n if (typeof descriptor.get === 'function' && descriptor.configurable) {\n descriptor.enumerable = true;\n Object.defineProperty(theme, key, descriptor);\n }\n });\n return theme;\n};\n\nexport const REACT_UI_DARK_THEME_KEY = '__IS_REACT_UI_DARK_THEME__';\n\nexport const isDarkTheme = (theme: Theme | ThemeIn): boolean => {\n // @ts-expect-error: internal value.\n return theme[REACT_UI_DARK_THEME_KEY] === true;\n};\n\nexport const markAsDarkTheme = <T extends Record<string, any>>(theme: T): T => {\n return Object.create(theme, {\n [REACT_UI_DARK_THEME_KEY]: {\n value: true,\n writable: false,\n enumerable: false,\n configurable: false,\n },\n });\n};\n\nexport function findPropertyDescriptor(theme: Theme, propName: keyof Theme) {\n // TODO: Rewrite for loop.\n // TODO: Enable `no-param-reassign` rule.\n // eslint-disable-next-line no-param-reassign\n for (; isNonNullable(theme); theme = Object.getPrototypeOf(theme)) {\n if (Object.prototype.hasOwnProperty.call(theme, propName)) {\n return Object.getOwnPropertyDescriptor(theme, propName) || {};\n }\n }\n return {};\n}\n"]}
@@ -4,13 +4,15 @@ export declare type Defaultize<P, D> = P extends any ? string extends keyof P ?
4
4
  export declare type DefaultizeProps<C, P> = C extends {
5
5
  defaultProps: infer D;
6
6
  } ? Defaultize<P, D> : P;
7
+ export declare type AnyObject = Record<string, unknown>;
7
8
  export declare const delay: (ms: number) => Promise<unknown>;
8
9
  export declare const emptyHandler: () => void;
9
10
  export declare class CancelationError extends Error {
10
11
  code: string;
11
12
  }
12
13
  export declare function taskWithDelay(task: () => void, ms: number): () => void;
13
- export declare function isFunction<T>(x: T | Function): x is Function;
14
+ export declare type FunctionWithParams<R = any> = (...args: any[]) => R;
15
+ export declare function isFunction<T>(x: T | FunctionWithParams): x is FunctionWithParams;
14
16
  export declare function isFunctionalComponent(Component: ReactComponentLike): boolean;
15
17
  export declare function isClassComponent(Component: ReactComponentLike): boolean;
16
18
  export declare function isIntrinsicElement(element: React.ReactElement): boolean;
package/cjs/lib/utils.js CHANGED
@@ -15,6 +15,8 @@ var _client = require("./client");
15
15
 
16
16
 
17
17
 
18
+
19
+
18
20
  var delay = function delay(ms) {return new Promise(function (resolve) {return setTimeout(resolve, ms);});};exports.delay = delay;
19
21
 
20
22
  var emptyHandler = function emptyHandler() {
@@ -38,6 +40,7 @@ function taskWithDelay(task, ms) {
38
40
  return cancelationToken;
39
41
  }
40
42
 
43
+
41
44
  function isFunction(x) {
42
45
  return typeof x === 'function';
43
46
  }
@@ -75,7 +78,7 @@ var isReactUINode = function isReactUINode(componentName, node) {
75
78
  if ( /*#__PURE__*/_react.default.isValidElement(node)) {
76
79
  return (
77
80
  Object.prototype.hasOwnProperty.call(node.type, '__KONTUR_REACT_UI__') &&
78
- // @ts-ignore
81
+ // @ts-expect-error: React doesn't know about existence of __KONTUR_REACT_UI__.
79
82
  node.type.__KONTUR_REACT_UI__ === componentName);
80
83
 
81
84
  }
@@ -141,7 +144,7 @@ exports.isNonNullable = isNonNullable;var isNullable = function isNullable(value
141
144
  */exports.isNullable = isNullable;
142
145
  var isReactUIComponent = function isReactUIComponent(name) {
143
146
  return function (child) {var _child$type;
144
- // @ts-ignore
147
+ // @ts-expect-error: Property `type` doesn't exist on type `React.ReactNode`, but exists on type `React.ReactElement` meanwhile `React.ReactElement` is not compatible with `React` `children` type.
145
148
  return (child == null ? void 0 : (_child$type = child.type) == null ? void 0 : _child$type.__KONTUR_REACT_UI__) === name;
146
149
  };
147
150
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["utils.ts"],"names":["delay","ms","Promise","resolve","setTimeout","emptyHandler","CancelationError","code","Error","taskWithDelay","task","cancelationToken","reject","then","catch","isFunction","x","isFunctionalComponent","Component","Boolean","prototype","isReactComponent","isClassComponent","isIntrinsicElement","element","type","isRefableElement","escapeRegExpSpecChars","s","replace","getRandomID","Math","random","toString","slice","isExternalLink","link","RegExp","isBrowser","window","location","host","test","isReactUINode","componentName","node","React","isValidElement","Object","hasOwnProperty","call","__KONTUR_REACT_UI__","KB","UNITS","calculateDecimals","decimals","formatBytes","bytes","calculatedDecimals","i","floor","log2","formattedBytes","parseFloat","pow","toFixed","isNonNullable","value","undefined","isNullable","isReactUIComponent","name","child","mergeRefs","refs","forEach","ref","current","extractDataProps","props","dataProps","restWithoutDataProps","entries","map","startsWith","startsWithOneOf","searchK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,WAAvB,EAA+C;AAC5E,MAAMC,QAAQ,GAAGF,UAAU,CAACG,SAAX,CAAqB,UAACC,GAAD,EAAS;AAC7C,WAAOH,WAAW,CAACH,UAAZ,CAAuBM,GAAvB,CAAP;AACD,GAFgB,CAAjB;;AAIA,SAAOF,QAAQ,IAAI,CAAnB;AACD,CANM,C","sourcesContent":["import { ReactComponentLike } from 'prop-types';\nimport React from 'react';\nimport { isForwardRef } from 'react-is';\n\nimport { isBrowser } from './client';\n\n// NOTE: Copy-paste from @types/react\nexport type Defaultize<P, D> = P extends any\n ? string extends keyof P\n ? P\n : Pick<P, Exclude<keyof P, keyof D>> &\n Partial<Pick<P, Extract<keyof P, keyof D>>> &\n Partial<Pick<D, Exclude<keyof D, keyof P>>>\n : never;\n\nexport type DefaultizeProps<C, P> = C extends { defaultProps: infer D } ? Defaultize<P, D> : P;\n\nexport const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));\n\nexport const emptyHandler = () => {\n /* noop */\n};\n\nexport class CancelationError extends Error {\n public code = 'CancelationError';\n}\n\nexport function taskWithDelay(task: () => void, ms: number) {\n let cancelationToken: () => void = () => null;\n\n new Promise((resolve, reject) => {\n cancelationToken = reject;\n setTimeout(resolve, ms);\n })\n .then(task)\n .catch(() => null);\n\n return cancelationToken;\n}\n\nexport function isFunction<T>(x: T | Function): x is Function {\n return typeof x === 'function';\n}\n\nexport function isFunctionalComponent(Component: ReactComponentLike): boolean {\n return Boolean(typeof Component === 'function' && !(Component.prototype && Component.prototype.isReactComponent));\n}\n\nexport function isClassComponent(Component: ReactComponentLike): boolean {\n return Boolean(typeof Component === 'function' && Component.prototype && Component.prototype.isReactComponent);\n}\n\nexport function isIntrinsicElement(element: React.ReactElement): boolean {\n return typeof element.type === 'string';\n}\n\nexport function isRefableElement(element: React.ReactElement): boolean {\n return Boolean(isIntrinsicElement(element) || isClassComponent(element.type) || isForwardRef(element));\n}\n\nexport function escapeRegExpSpecChars(s: string): string {\n return s.replace(/[\\\\^$*+?.()|[\\]{}]/g, '\\\\$&');\n}\n\nexport const getRandomID = (): string => Math.random().toString(16).slice(2);\n\nexport const isExternalLink = (link: string): boolean => {\n return new RegExp(`^(https?:)?//${isBrowser ? `(?!${window.location.host})` : ``}\\\\S+`, 'gi').test(link);\n};\n\n/**\n * Check if the given ReactNode is an element of the specified ReactUI component\n */\nexport const isReactUINode = (componentName: string, node: React.ReactNode): boolean => {\n if (React.isValidElement(node)) {\n return (\n Object.prototype.hasOwnProperty.call(node.type, '__KONTUR_REACT_UI__') &&\n // @ts-ignore\n node.type.__KONTUR_REACT_UI__ === componentName\n );\n }\n\n return false;\n};\n\nconst KB = 1024;\nconst UNITS = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];\n\nconst calculateDecimals = (decimals: number) => {\n if (decimals < 0) {\n return 0;\n }\n\n return 0;\n};\n\nexport const formatBytes = (bytes: number, decimals = 2): string | null => {\n if (bytes === 0) {\n return '0 Bytes';\n }\n\n if (!bytes) {\n return null;\n }\n\n const calculatedDecimals = calculateDecimals(decimals);\n\n const i = Math.floor(Math.log2(bytes) / Math.log2(KB));\n const formattedBytes = parseFloat((bytes / Math.pow(KB, i)).toFixed(calculatedDecimals));\n\n return `${formattedBytes} ${UNITS[i]}`;\n};\n\n/**\n * Проверяет, не является ли переданный аргумент null или undefined и исключает типы null и undefined из типа аргумента\n *\n * @param value Значение, которое нужно проверить и исключить из него типы\n * @returns Возвращает true, если переданный аргумент не является null или undefined иначе false\n */\nexport const isNonNullable = <T>(value: T): value is NonNullable<T> => {\n return value !== null && value !== undefined;\n};\n\n/**\n * Checks if the value `null` or `undefined`.\n *\n * @param value Value to check for `null` and `undefined`.\n * @returns Returns `true` if `value` is `null` or `undefined`, else `false`.\n */\n// @ts-expect-error: TypeScript doesn't consider the check inside of the function.\nexport const isNullable = <T>(value: T): value is null | undefined => {\n return value === null || value === undefined;\n};\n\n/**\n * Creates a function that checks if the given `child`\n * is an instance of some component specified by `name`.\n *\n * @param name Component name for which function will be created.\n * @returns A function that checks if the given `child` is an instance of the component specified by `name`.\n */\nexport const isReactUIComponent = <P = any>(name: string) => {\n return (child: React.ReactNode): child is React.ReactElement<P> => {\n // @ts-ignore\n return child?.type?.__KONTUR_REACT_UI__ === name;\n };\n};\n\n/**\n * Merges two or more refs into one.\n *\n * @param refs Array of refs.\n * @returns A single ref composing all the refs passed.\n *\n * @example\n * const SomeComponent = forwardRef((props, ref) => {\n * const localRef = useRef();\n *\n * return <div ref={mergeRefs([localRef, ref])} />;\n * });\n */\nexport function mergeRefs<T = any>(refs: Array<React.MutableRefObject<T> | React.LegacyRef<T>>): React.RefCallback<T> {\n return (value) => {\n refs.forEach((ref) => {\n if (typeof ref === 'function') {\n return ref(value);\n } else if (isNonNullable(ref)) {\n return ((ref as React.MutableRefObject<T | null>).current = value);\n }\n });\n };\n}\n\n/**\n * Extracts all data attributes from props and returns them as well as props.\n *\n * @param props Props object to extract data attributes from.\n * @returns Separated data attributes and all other props.\n */\nexport const extractDataProps = <T>(props: T) => {\n const dataProps: Record<string, any> = {};\n const restWithoutDataProps: Record<string, any> = {};\n\n Object.entries(props).map(([name, value]) => {\n if (name.startsWith('data-')) {\n return (dataProps[name] = value);\n }\n\n return (restWithoutDataProps[name] = value);\n });\n\n return { dataProps, restWithoutDataProps };\n};\n\n/**\n * Basically `.startsWith` for arrays.\n *\n * @param searchKeys Array of strings to test against `inputString`.\n * @param inputString String on which search will be performed.\n * @returns `true` if `inputString` starts with one of keys, else `false`.\n */\nexport const startsWithOneOf = (searchKeys: string[], inputString: string) => {\n const keyIndex = searchKeys.findIndex((key) => {\n return inputString.startsWith(key);\n });\n\n return keyIndex >= 0;\n};\n"]}
1
+ {"version":3,"sources":["utils.ts"],"names":["delay","ms","Promise","resolve","setTimeout","emptyHandler","CancelationError","code","Error","taskWithDelay","task","cancelationToken","reject","then","catch","isFunction","x","isFunctionalComponent","Component","Boolean","prototype","isReactComponent","isClassComponent","isIntrinsicElement","element","type","isRefableElement","escapeRegExpSpecChars","s","replace","getRandomID","Math","random","toString","slice","isExternalLink","link","RegExp","isBrowser","window","location","host","test","isReactUINode","componentName","node","React","isValidElement","Object","hasOwnProperty","call","__KONTUR_REACT_UI__","KB","UNITS","calculateDecimals","decimals","formatBytes","bytes","calculatedDecimals","i","floor","log2","formattedBytes","parseFloat","pow","toFixed","isNonNullable","value","undefined","isNullable","isReactUIComponent","name","child","mergeRefs","refs","forEach","ref","current","extractDataProps","props","dataProps","restWithoutDataProps","entries","map","startsWith","startsWithOneOf","searchKeys","inputString","keyIndex","findIndex","key"],"mappings":";AACA;AACA;;AAEA;;;;;;;;;;;;;;;AAeO,IAAMA,KAAK,GAAG,SAARA,KAAQ,CAACC,EAAD,UAAgB,IAAIC,OAAJ,CAAY,UAACC,OAAD,UAAaC,UAAU,CAACD,OAAD,EAAUF,EAAV,CAAvB,EAAZ,CAAhB,EAAd,C;;AAEA,IAAMI,YAAY,GAAG,SAAfA,YAAe,GAAM;AAChC;AACD,CAFM,C;;AAIMC,gB;AACJC,IAAAA,I,GAAO,kB,sFADsBC,K;;;AAI/B,SAASC,aAAT,CAAuBC,IAAvB,EAAyCT,EAAzC,EAAqD;AAC1D,MAAIU,gBAA4B,GAAG,oCAAM,IAAN,EAAnC;;AAEA,MAAIT,OAAJ,CAAY,UAACC,OAAD,EAAUS,MAAV,EAAqB;AAC/BD,IAAAA,gBAAgB,GAAGC,MAAnB;AACAR,IAAAA,UAAU,CAACD,OAAD,EAAUF,EAAV,CAAV;AACD,GAHD;AAIGY,EAAAA,IAJH,CAIQH,IAJR;AAKGI,EAAAA,KALH,CAKS,oBAAM,IAAN,EALT;;AAOA,SAAOH,gBAAP;AACD;;;AAGM,SAASI,UAAT,CAAuBC,CAAvB,EAA2E;AAChF,SAAO,OAAOA,CAAP,KAAa,UAApB;AACD;;AAEM,SAASC,qBAAT,CAA+BC,SAA/B,EAAuE;AAC5E,SAAOC,OAAO,CAAC,OAAOD,SAAP,KAAqB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AACa,UAAL,CAAgB,OAAhB,CAAJ,EAA8B;AAC5B,aAAQJ,SAAS,CAACT,IAAD,CAAT,GAAkBJ,KAA1B;AACD;;AAED,WAAQc,oBAAoB,CAACV,IAAD,CAApB,GAA6BJ,KAArC;AACD,GAND;;AAQA,SAAO,EAAEa,SAAS,EAATA,SAAF,EAAaC,oBAAoB,EAApBA,oBAAb,EAAP;AACD,CAbM;;AAeP;AACA;AACA;AACA;AACA;AACA;AACA,G;AACO,IAAMI,eAAe,GAAG,SAAlBA,eAAkB,CAACC,UAAD,EAAuBC,WAAvB,EAA+C;AAC5E,MAAMC,QAAQ,GAAGF,UAAU,CAACG,SAAX,CAAqB,UAACC,GAAD,EAAS;AAC7C,WAAOH,WAAW,CAACH,UAAZ,CAAuBM,GAAvB,CAAP;AACD,GAFgB,CAAjB;;AAIA,SAAOF,QAAQ,IAAI,CAAnB;AACD,CANM,C","sourcesContent":["import { ReactComponentLike } from 'prop-types';\nimport React from 'react';\nimport { isForwardRef } from 'react-is';\n\nimport { isBrowser } from './client';\n\n// NOTE: Copy-paste from @types/react\nexport type Defaultize<P, D> = P extends any\n ? string extends keyof P\n ? P\n : Pick<P, Exclude<keyof P, keyof D>> &\n Partial<Pick<P, Extract<keyof P, keyof D>>> &\n Partial<Pick<D, Exclude<keyof D, keyof P>>>\n : never;\n\nexport type DefaultizeProps<C, P> = C extends { defaultProps: infer D } ? Defaultize<P, D> : P;\n\nexport type AnyObject = Record<string, unknown>;\n\nexport const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));\n\nexport const emptyHandler = () => {\n /* noop */\n};\n\nexport class CancelationError extends Error {\n public code = 'CancelationError';\n}\n\nexport function taskWithDelay(task: () => void, ms: number) {\n let cancelationToken: () => void = () => null;\n\n new Promise((resolve, reject) => {\n cancelationToken = reject;\n setTimeout(resolve, ms);\n })\n .then(task)\n .catch(() => null);\n\n return cancelationToken;\n}\n\nexport type FunctionWithParams<R = any> = (...args: any[]) => R;\nexport function isFunction<T>(x: T | FunctionWithParams): x is FunctionWithParams {\n return typeof x === 'function';\n}\n\nexport function isFunctionalComponent(Component: ReactComponentLike): boolean {\n return Boolean(typeof Component === 'function' && !(Component.prototype && Component.prototype.isReactComponent));\n}\n\nexport function isClassComponent(Component: ReactComponentLike): boolean {\n return Boolean(typeof Component === 'function' && Component.prototype && Component.prototype.isReactComponent);\n}\n\nexport function isIntrinsicElement(element: React.ReactElement): boolean {\n return typeof element.type === 'string';\n}\n\nexport function isRefableElement(element: React.ReactElement): boolean {\n return Boolean(isIntrinsicElement(element) || isClassComponent(element.type) || isForwardRef(element));\n}\n\nexport function escapeRegExpSpecChars(s: string): string {\n return s.replace(/[\\\\^$*+?.()|[\\]{}]/g, '\\\\$&');\n}\n\nexport const getRandomID = (): string => Math.random().toString(16).slice(2);\n\nexport const isExternalLink = (link: string): boolean => {\n return new RegExp(`^(https?:)?//${isBrowser ? `(?!${window.location.host})` : ``}\\\\S+`, 'gi').test(link);\n};\n\n/**\n * Check if the given ReactNode is an element of the specified ReactUI component\n */\nexport const isReactUINode = (componentName: string, node: React.ReactNode): boolean => {\n if (React.isValidElement(node)) {\n return (\n Object.prototype.hasOwnProperty.call(node.type, '__KONTUR_REACT_UI__') &&\n // @ts-expect-error: React doesn't know about existence of __KONTUR_REACT_UI__.\n node.type.__KONTUR_REACT_UI__ === componentName\n );\n }\n\n return false;\n};\n\nconst KB = 1024;\nconst UNITS = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];\n\nconst calculateDecimals = (decimals: number) => {\n if (decimals < 0) {\n return 0;\n }\n\n return 0;\n};\n\nexport const formatBytes = (bytes: number, decimals = 2): string | null => {\n if (bytes === 0) {\n return '0 Bytes';\n }\n\n if (!bytes) {\n return null;\n }\n\n const calculatedDecimals = calculateDecimals(decimals);\n\n const i = Math.floor(Math.log2(bytes) / Math.log2(KB));\n const formattedBytes = parseFloat((bytes / Math.pow(KB, i)).toFixed(calculatedDecimals));\n\n return `${formattedBytes} ${UNITS[i]}`;\n};\n\n/**\n * Проверяет, не является ли переданный аргумент null или undefined и исключает типы null и undefined из типа аргумента\n *\n * @param value Значение, которое нужно проверить и исключить из него типы\n * @returns Возвращает true, если переданный аргумент не является null или undefined иначе false\n */\nexport const isNonNullable = <T>(value: T): value is NonNullable<T> => {\n return value !== null && value !== undefined;\n};\n\n/**\n * Checks if the value `null` or `undefined`.\n *\n * @param value Value to check for `null` and `undefined`.\n * @returns Returns `true` if `value` is `null` or `undefined`, else `false`.\n */\n// @ts-expect-error: TypeScript doesn't consider the check inside of the function.\nexport const isNullable = <T>(value: T): value is null | undefined => {\n return value === null || value === undefined;\n};\n\n/**\n * Creates a function that checks if the given `child`\n * is an instance of some component specified by `name`.\n *\n * @param name Component name for which function will be created.\n * @returns A function that checks if the given `child` is an instance of the component specified by `name`.\n */\nexport const isReactUIComponent = <P = any>(name: string) => {\n return (child: React.ReactNode): child is React.ReactElement<P> => {\n // @ts-expect-error: Property `type` doesn't exist on type `React.ReactNode`, but exists on type `React.ReactElement` meanwhile `React.ReactElement` is not compatible with `React` `children` type.\n return child?.type?.__KONTUR_REACT_UI__ === name;\n };\n};\n\n/**\n * Merges two or more refs into one.\n *\n * @param refs Array of refs.\n * @returns A single ref composing all the refs passed.\n *\n * @example\n * const SomeComponent = forwardRef((props, ref) => {\n * const localRef = useRef();\n *\n * return <div ref={mergeRefs([localRef, ref])} />;\n * });\n */\nexport function mergeRefs<T = any>(refs: Array<React.MutableRefObject<T> | React.LegacyRef<T>>): React.RefCallback<T> {\n return (value) => {\n refs.forEach((ref) => {\n if (typeof ref === 'function') {\n return ref(value);\n } else if (isNonNullable(ref)) {\n return ((ref as React.MutableRefObject<T | null>).current = value);\n }\n });\n };\n}\n\n/**\n * Extracts all data attributes from props and returns them as well as props.\n *\n * @param props Props object to extract data attributes from.\n * @returns Separated data attributes and all other props.\n */\nexport const extractDataProps = <T>(props: T) => {\n const dataProps: Record<string, any> = {};\n const restWithoutDataProps: Record<string, any> = {};\n\n Object.entries(props).map(([name, value]) => {\n if (name.startsWith('data-')) {\n return (dataProps[name] = value);\n }\n\n return (restWithoutDataProps[name] = value);\n });\n\n return { dataProps, restWithoutDataProps };\n};\n\n/**\n * Basically `.startsWith` for arrays.\n *\n * @param searchKeys Array of strings to test against `inputString`.\n * @param inputString String on which search will be performed.\n * @returns `true` if `inputString` starts with one of keys, else `false`.\n */\nexport const startsWithOneOf = (searchKeys: string[], inputString: string) => {\n const keyIndex = searchKeys.findIndex((key) => {\n return inputString.startsWith(key);\n });\n\n return keyIndex >= 0;\n};\n"]}
@@ -44,10 +44,7 @@ function withClassWrapper(RFC) {var _class, _temp;
44
44
 
45
45
  render = function render() {
46
46
  return /*#__PURE__*/ (
47
- // TypeScript is not able to understand
48
- // that both types (class one and functional one)
49
- // have ref at the build stage.
50
- // @ts-ignore
47
+ // @ts-expect-error: TypeScript is not able to understand that both types (class one and functional one) have ref.
51
48
  _react.default.createElement(ClassWrapper.FC, (0, _extends2.default)({
52
49
  // Returns methods defined in useImperativeHandle.
53
50
  instanceRef: this.instancePropertiesRef },
@@ -1 +1 @@
1
- {"version":3,"sources":["withClassWrapper.tsx"],"names":["removePostfix","word","postfixRegex","regexContent","source","replace","isCorrectPostfix","test","Error","withClassWrapper","RFC","fullName","nameWithoutPostfix","instancePropertiesRef","React","createRef","componentDidMount","current","Object","defineProperties","getOwnPropertyDescriptors","render","props","Component","__KONTUR_REACT_UI__","displayName","FC"],"mappings":"wVAAA;;;AAGA;;AAEA,IAAMA,aAAa,GAAG,SAAhBA,aAAgB,CAACC,IAAD,EAAeC,YAAf,EAAwC;AAC5D,MAAMC,YAAY,GAAGD,YAAY,CAACE,MAAb,CAAoBC,OAApB,CAA4B,KAA5B,EAAmC,EAAnC,CAArB;;AAEA,MAAMC,gBAAgB,GAAGJ,YAAY,CAACK,IAAb,CAAkBN,IAAlB,CAAzB;AACA,MAAI,CAACK,gBAAL,EAAuB;AACrB,UAAM,IAAIE,KAAJ;AAC+CL,IAAAA,YAD/C,sDAAN;;AAGD;;AAED,SAAOF,IAAI,CAACI,OAAL,CAAaH,YAAb,EAA2B,EAA3B,CAAP;AACD,CAXD;;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASO,gBAAT,CAAgCC,GAAhC,EAAoE;AACzE,MAAMC,QAAQ,GAAG,oCAAeD,GAAf,CAAjB;AACA,MAAME,kBAAkB,GAAGZ,aAAa,CAACW,QAAD,EAAW,KAAX,CAAxC;;AAEA;AACSE,MAAAA,qBADT,gBACiCC,eAAMC,SAAN,EADjC;;AAGEC,IAAAA,iBAHF,GAGE,6BAAoB;AAClB,UAAI,KAAKH,qBAAL,CAA2BI,OAA/B,EAAwC;AACtCC,QAAAA,MAAM,CAACC,gBAAP,CAAwB,IAAxB,EAA8BD,MAAM,CAACE,yBAAP,CAAiC,KAAKP,qBAAL,CAA2BI,OAA5D,CAA9B;AACD;AACF,KAPH;;;;;;;AAcEI,IAAAA,MAdF,GAcE,kBAAS;AACP;AACE;AACA;AACA;AACA;AACA,qCAAC,YAAD,CAAc,EAAd;AACE;AACA,UAAA,WAAW,EAAE,KAAKR,qBAFpB;AAGM,aAAKS,KAHX,EALF;;;AAWD,KA1BH,uBAAkCR,eAAMS,SAAxC,UASgBC,mBAThB,GASsCZ,kBATtC,SAUgBa,WAVhB,GAU8Bb,kBAV9B,SAYgBc,EAZhB,GAYqBhB,GAZrB;;AA4BD","sourcesContent":["import React from 'react';\n\nimport { ReactUIComponentWithRef } from './forwardRefAndName';\nimport { getDisplayName } from './getDisplayName';\n\nconst removePostfix = (word: string, postfixRegex: RegExp) => {\n const regexContent = postfixRegex.source.replace(/\\$$/, '');\n\n const isCorrectPostfix = postfixRegex.test(word);\n if (!isCorrectPostfix) {\n throw new Error(\n `Component's displayName property must end with '${regexContent}' in order to be wrapped in withClassWrapper HOC`,\n );\n }\n\n return word.replace(postfixRegex, '');\n};\n\n/**\n * HOC for moving from Class to Functional components.\n *\n * Used to remove distinctions between Class and Functional refs.\n *\n * @param RFC Functional component wrapped in forwardRefAndName.\n * @returns Class component that wraps Functional component.\n */\nexport function withClassWrapper<T, P>(RFC: ReactUIComponentWithRef<T, P>) {\n const fullName = getDisplayName(RFC);\n const nameWithoutPostfix = removePostfix(fullName, /FC$/);\n\n return class ClassWrapper extends React.Component<P> {\n public instancePropertiesRef = React.createRef<T>();\n\n componentDidMount() {\n if (this.instancePropertiesRef.current) {\n Object.defineProperties(this, Object.getOwnPropertyDescriptors(this.instancePropertiesRef.current));\n }\n }\n\n public static __KONTUR_REACT_UI__ = nameWithoutPostfix;\n public static displayName = nameWithoutPostfix;\n\n public static FC = RFC;\n\n render() {\n return (\n // TypeScript is not able to understand\n // that both types (class one and functional one)\n // have ref at the build stage.\n // @ts-ignore\n <ClassWrapper.FC\n // Returns methods defined in useImperativeHandle.\n instanceRef={this.instancePropertiesRef}\n {...this.props}\n />\n );\n }\n };\n}\n\nexport interface InstanceRefType<T> {\n instanceRef: React.MutableRefObject<T>;\n}\n"]}
1
+ {"version":3,"sources":["withClassWrapper.tsx"],"names":["removePostfix","word","postfixRegex","regexContent","source","replace","isCorrectPostfix","test","Error","withClassWrapper","RFC","fullName","nameWithoutPostfix","instancePropertiesRef","React","createRef","componentDidMount","current","Object","defineProperties","getOwnPropertyDescriptors","render","props","Component","__KONTUR_REACT_UI__","displayName","FC"],"mappings":"wVAAA;;;AAGA;;AAEA,IAAMA,aAAa,GAAG,SAAhBA,aAAgB,CAACC,IAAD,EAAeC,YAAf,EAAwC;AAC5D,MAAMC,YAAY,GAAGD,YAAY,CAACE,MAAb,CAAoBC,OAApB,CAA4B,KAA5B,EAAmC,EAAnC,CAArB;;AAEA,MAAMC,gBAAgB,GAAGJ,YAAY,CAACK,IAAb,CAAkBN,IAAlB,CAAzB;AACA,MAAI,CAACK,gBAAL,EAAuB;AACrB,UAAM,IAAIE,KAAJ;AAC+CL,IAAAA,YAD/C,sDAAN;;AAGD;;AAED,SAAOF,IAAI,CAACI,OAAL,CAAaH,YAAb,EAA2B,EAA3B,CAAP;AACD,CAXD;;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASO,gBAAT,CAAgCC,GAAhC,EAAoE;AACzE,MAAMC,QAAQ,GAAG,oCAAeD,GAAf,CAAjB;AACA,MAAME,kBAAkB,GAAGZ,aAAa,CAACW,QAAD,EAAW,KAAX,CAAxC;;AAEA;AACSE,MAAAA,qBADT,gBACiCC,eAAMC,SAAN,EADjC;;AAGEC,IAAAA,iBAHF,GAGE,6BAAoB;AAClB,UAAI,KAAKH,qBAAL,CAA2BI,OAA/B,EAAwC;AACtCC,QAAAA,MAAM,CAACC,gBAAP,CAAwB,IAAxB,EAA8BD,MAAM,CAACE,yBAAP,CAAiC,KAAKP,qBAAL,CAA2BI,OAA5D,CAA9B;AACD;AACF,KAPH;;;;;;;AAcEI,IAAAA,MAdF,GAcE,kBAAS;AACP;AACE;AACA,qCAAC,YAAD,CAAc,EAAd;AACE;AACA,UAAA,WAAW,EAAE,KAAKR,qBAFpB;AAGM,aAAKS,KAHX,EAFF;;;AAQD,KAvBH,uBAAkCR,eAAMS,SAAxC,UASgBC,mBAThB,GASsCZ,kBATtC,SAUgBa,WAVhB,GAU8Bb,kBAV9B,SAYgBc,EAZhB,GAYqBhB,GAZrB;;AAyBD","sourcesContent":["import React from 'react';\n\nimport { ReactUIComponentWithRef } from './forwardRefAndName';\nimport { getDisplayName } from './getDisplayName';\n\nconst removePostfix = (word: string, postfixRegex: RegExp) => {\n const regexContent = postfixRegex.source.replace(/\\$$/, '');\n\n const isCorrectPostfix = postfixRegex.test(word);\n if (!isCorrectPostfix) {\n throw new Error(\n `Component's displayName property must end with '${regexContent}' in order to be wrapped in withClassWrapper HOC`,\n );\n }\n\n return word.replace(postfixRegex, '');\n};\n\n/**\n * HOC for moving from Class to Functional components.\n *\n * Used to remove distinctions between Class and Functional refs.\n *\n * @param RFC Functional component wrapped in forwardRefAndName.\n * @returns Class component that wraps Functional component.\n */\nexport function withClassWrapper<T, P>(RFC: ReactUIComponentWithRef<T, P>) {\n const fullName = getDisplayName(RFC);\n const nameWithoutPostfix = removePostfix(fullName, /FC$/);\n\n return class ClassWrapper extends React.Component<P> {\n public instancePropertiesRef = React.createRef<T>();\n\n componentDidMount() {\n if (this.instancePropertiesRef.current) {\n Object.defineProperties(this, Object.getOwnPropertyDescriptors(this.instancePropertiesRef.current));\n }\n }\n\n public static __KONTUR_REACT_UI__ = nameWithoutPostfix;\n public static displayName = nameWithoutPostfix;\n\n public static FC = RFC;\n\n render() {\n return (\n // @ts-expect-error: TypeScript is not able to understand that both types (class one and functional one) have ref.\n <ClassWrapper.FC\n // Returns methods defined in useImperativeHandle.\n instanceRef={this.instancePropertiesRef}\n {...this.props}\n />\n );\n }\n };\n}\n\nexport interface InstanceRefType<T> {\n instanceRef: React.MutableRefObject<T>;\n}\n"]}
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
 
3
- export type MouseEventType<T extends HTMLElement = HTMLElement> = React.MouseEvent<T> | MouseEvent;
4
- export type FocusEventType<T extends HTMLElement = HTMLElement> = React.FocusEvent<T> | FocusEvent;
3
+ export type MouseEventType<T extends Element = Element> = React.MouseEvent<T> | MouseEvent;
4
+ export type FocusEventType<T extends Element = Element> = React.FocusEvent<T> | FocusEvent;