@semcore/core 2.39.1 → 16.0.0-prerelease.2

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 (978) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +2 -2
  3. package/lib/LastInteractionType.d.ts +11 -0
  4. package/lib/cjs/LastInteractionType.js +57 -0
  5. package/lib/cjs/LastInteractionType.js.map +1 -0
  6. package/lib/cjs/core-types/Component.js +59 -0
  7. package/lib/cjs/core-types/Component.js.map +1 -0
  8. package/lib/cjs/core-types/UnknownProperties.js +2 -0
  9. package/lib/cjs/core-types/UnknownProperties.js.map +1 -0
  10. package/lib/cjs/core-types/reshadow.d.js +2 -0
  11. package/lib/cjs/core-types/reshadow.d.js.map +1 -0
  12. package/lib/cjs/core-types/symbols.js +25 -0
  13. package/lib/cjs/core-types/symbols.js.map +1 -0
  14. package/lib/cjs/coreFactory.js +352 -0
  15. package/lib/cjs/coreFactory.js.map +1 -0
  16. package/lib/cjs/enhancement/Children.js +119 -0
  17. package/lib/cjs/enhancement/Children.js.map +1 -0
  18. package/lib/cjs/enhancement/Root.js +78 -0
  19. package/lib/cjs/enhancement/Root.js.map +1 -0
  20. package/lib/cjs/enhancement/bindHandler.js +54 -0
  21. package/lib/cjs/enhancement/bindHandler.js.map +1 -0
  22. package/lib/cjs/enhancement/dataName.js +20 -0
  23. package/lib/cjs/enhancement/dataName.js.map +1 -0
  24. package/lib/cjs/enhancement/enhance.js +22 -0
  25. package/lib/cjs/enhancement/enhance.js.map +1 -0
  26. package/lib/cjs/enhancement/functionDefaultProps.js +36 -0
  27. package/lib/cjs/enhancement/functionDefaultProps.js.map +1 -0
  28. package/lib/cjs/enhancement/hoistProps.js +97 -0
  29. package/lib/cjs/enhancement/hoistProps.js.map +1 -0
  30. package/lib/cjs/enhancement/i18n.js +28 -0
  31. package/lib/cjs/enhancement/i18n.js.map +1 -0
  32. package/lib/cjs/enhancement/inheritedName.js +23 -0
  33. package/lib/cjs/enhancement/inheritedName.js.map +1 -0
  34. package/lib/cjs/enhancement/staticChildren.js +135 -0
  35. package/lib/cjs/enhancement/staticChildren.js.map +1 -0
  36. package/lib/cjs/enhancement/style.js +60 -0
  37. package/lib/cjs/enhancement/style.js.map +1 -0
  38. package/lib/cjs/enhancement/uncontrolledProps.js +131 -0
  39. package/lib/cjs/enhancement/uncontrolledProps.js.map +1 -0
  40. package/lib/cjs/index.js +97 -17
  41. package/lib/cjs/index.js.map +1 -1
  42. package/lib/cjs/register.js +37 -0
  43. package/lib/cjs/register.js.map +1 -0
  44. package/lib/cjs/styled/index.js +32 -0
  45. package/lib/cjs/styled/index.js.map +1 -0
  46. package/lib/cjs/styled/reshadow-core.js +256 -0
  47. package/lib/cjs/styled/reshadow-core.js.map +1 -0
  48. package/lib/cjs/styled/sstyled.js +149 -0
  49. package/lib/cjs/styled/sstyled.js.map +1 -0
  50. package/lib/cjs/theme/dark.json +2506 -0
  51. package/lib/cjs/theme/exclude-tokens.json +10 -0
  52. package/lib/cjs/theme/light.json +2584 -0
  53. package/lib/cjs/theme/processor.js +315 -0
  54. package/lib/cjs/theme/processor.js.map +1 -0
  55. package/lib/cjs/theme/themes/auto.css +1465 -0
  56. package/lib/cjs/theme/themes/dark.css +723 -0
  57. package/lib/cjs/theme/themes/dark.js +385 -0
  58. package/lib/cjs/theme/themes/dark.js.map +1 -0
  59. package/lib/cjs/theme/themes/default.css +742 -0
  60. package/lib/cjs/theme/themes/default.js +394 -0
  61. package/lib/cjs/theme/themes/default.js.map +1 -0
  62. package/lib/cjs/theme/themes/light.css +742 -0
  63. package/lib/cjs/theme/themes/light.js +394 -0
  64. package/lib/cjs/theme/themes/light.js.map +1 -0
  65. package/lib/cjs/theme/utils.js +297 -0
  66. package/lib/cjs/theme/utils.js.map +1 -0
  67. package/lib/cjs/utils/CSSinJS.js +36 -0
  68. package/lib/cjs/utils/CSSinJS.js.map +1 -0
  69. package/lib/cjs/utils/ScreenReaderOnly.js +31 -0
  70. package/lib/cjs/utils/ScreenReaderOnly.js.map +1 -0
  71. package/lib/cjs/utils/ThemeProvider.js +82 -0
  72. package/lib/cjs/utils/ThemeProvider.js.map +1 -0
  73. package/lib/cjs/utils/addonText.js +18 -0
  74. package/lib/cjs/utils/addonText.js.map +1 -0
  75. package/lib/cjs/utils/addonTextChildren.js +45 -0
  76. package/lib/cjs/utils/addonTextChildren.js.map +1 -0
  77. package/lib/cjs/utils/ariaProps.js +22 -0
  78. package/lib/cjs/utils/ariaProps.js.map +1 -0
  79. package/lib/cjs/utils/assignProps.js +93 -0
  80. package/lib/cjs/utils/assignProps.js.map +1 -0
  81. package/lib/cjs/utils/canUseDOM.js +10 -0
  82. package/lib/cjs/utils/canUseDOM.js.map +1 -0
  83. package/lib/cjs/utils/capitalizeFirstLetter.js +10 -0
  84. package/lib/cjs/utils/capitalizeFirstLetter.js.map +1 -0
  85. package/lib/cjs/utils/color.js +208 -0
  86. package/lib/cjs/utils/color.js.map +1 -0
  87. package/lib/cjs/utils/compose.js +21 -0
  88. package/lib/cjs/utils/compose.js.map +1 -0
  89. package/lib/cjs/utils/createHoc.js +55 -0
  90. package/lib/cjs/utils/createHoc.js.map +1 -0
  91. package/lib/cjs/utils/createUUID.js +15 -0
  92. package/lib/cjs/utils/createUUID.js.map +1 -0
  93. package/lib/cjs/utils/cssToIntDefault.js +22 -0
  94. package/lib/cjs/utils/cssToIntDefault.js.map +1 -0
  95. package/lib/cjs/utils/enhances/WithAutoFocus.js +75 -0
  96. package/lib/cjs/utils/enhances/WithAutoFocus.js.map +1 -0
  97. package/lib/cjs/utils/enhances/WithCSS.js +93 -0
  98. package/lib/cjs/utils/enhances/WithCSS.js.map +1 -0
  99. package/lib/cjs/utils/enhances/WithI18n.js +95 -0
  100. package/lib/cjs/utils/enhances/WithI18n.js.map +1 -0
  101. package/lib/cjs/utils/enhances/WithKeyboardFocus.js +93 -0
  102. package/lib/cjs/utils/enhances/WithKeyboardFocus.js.map +1 -0
  103. package/lib/cjs/utils/enhances/WithRef.js +26 -0
  104. package/lib/cjs/utils/enhances/WithRef.js.map +1 -0
  105. package/lib/cjs/utils/enhances/a11yEnhance.js +74 -0
  106. package/lib/cjs/utils/enhances/a11yEnhance.js.map +1 -0
  107. package/lib/cjs/utils/enhances/animatedSizeEnhance.js +98 -0
  108. package/lib/cjs/utils/enhances/animatedSizeEnhance.js.map +1 -0
  109. package/lib/cjs/utils/enhances/autoFocusEnhance.js +46 -0
  110. package/lib/cjs/utils/enhances/autoFocusEnhance.js.map +1 -0
  111. package/lib/cjs/utils/enhances/contextEnhance.js +22 -0
  112. package/lib/cjs/utils/enhances/contextEnhance.js.map +1 -0
  113. package/lib/cjs/utils/enhances/i18nEnhance.js +101 -0
  114. package/lib/cjs/utils/enhances/i18nEnhance.js.map +1 -0
  115. package/lib/cjs/utils/enhances/keyboardFocusEnhance.js +63 -0
  116. package/lib/cjs/utils/enhances/keyboardFocusEnhance.js.map +1 -0
  117. package/lib/cjs/utils/enhances/resolveColorEnhance.js +25 -0
  118. package/lib/cjs/utils/enhances/resolveColorEnhance.js.map +1 -0
  119. package/lib/cjs/utils/eventEmitter.js +41 -0
  120. package/lib/cjs/utils/eventEmitter.js.map +1 -0
  121. package/lib/cjs/utils/findComponent.js +106 -0
  122. package/lib/cjs/utils/findComponent.js.map +1 -0
  123. package/lib/cjs/utils/fire.js +23 -0
  124. package/lib/cjs/utils/fire.js.map +1 -0
  125. package/lib/cjs/utils/focus-lock/focusBorders.js +72 -0
  126. package/lib/cjs/utils/focus-lock/focusBorders.js.map +1 -0
  127. package/lib/cjs/utils/focus-lock/getFocusableIn.js +26 -0
  128. package/lib/cjs/utils/focus-lock/getFocusableIn.js.map +1 -0
  129. package/lib/cjs/utils/focus-lock/isFocusInside.js +16 -0
  130. package/lib/cjs/utils/focus-lock/isFocusInside.js.map +1 -0
  131. package/lib/cjs/utils/focus-lock/isFocusable.js +51 -0
  132. package/lib/cjs/utils/focus-lock/isFocusable.js.map +1 -0
  133. package/lib/cjs/utils/focus-lock/setFocus.js +63 -0
  134. package/lib/cjs/utils/focus-lock/setFocus.js.map +1 -0
  135. package/lib/cjs/utils/getAccessibleName.js +56 -0
  136. package/lib/cjs/utils/getAccessibleName.js.map +1 -0
  137. package/lib/cjs/utils/getDisplayName.js +10 -0
  138. package/lib/cjs/utils/getDisplayName.js.map +1 -0
  139. package/lib/cjs/utils/getEventTarget.js +53 -0
  140. package/lib/cjs/utils/getEventTarget.js.map +1 -0
  141. package/lib/cjs/utils/getOriginChildren.js +18 -0
  142. package/lib/cjs/utils/getOriginChildren.js.map +1 -0
  143. package/lib/cjs/utils/getRandomInt.js +11 -0
  144. package/lib/cjs/utils/getRandomInt.js.map +1 -0
  145. package/lib/cjs/utils/getValue.js +16 -0
  146. package/lib/cjs/utils/getValue.js.map +1 -0
  147. package/lib/cjs/utils/hasLabels.js +47 -0
  148. package/lib/cjs/utils/hasLabels.js.map +1 -0
  149. package/lib/cjs/utils/hasParent.js +14 -0
  150. package/lib/cjs/utils/hasParent.js.map +1 -0
  151. package/lib/cjs/utils/if.js +16 -0
  152. package/lib/cjs/utils/if.js.map +1 -0
  153. package/lib/cjs/utils/ifChildren.js +17 -0
  154. package/lib/cjs/utils/ifChildren.js.map +1 -0
  155. package/lib/cjs/utils/injectStyle.js +49 -0
  156. package/lib/cjs/utils/injectStyle.js.map +1 -0
  157. package/lib/cjs/utils/inputProps.js +22 -0
  158. package/lib/cjs/utils/inputProps.js.map +1 -0
  159. package/lib/cjs/utils/isNode.js +28 -0
  160. package/lib/cjs/utils/isNode.js.map +1 -0
  161. package/lib/cjs/utils/isPromise.js +10 -0
  162. package/lib/cjs/utils/isPromise.js.map +1 -0
  163. package/lib/cjs/utils/isRetina.js +15 -0
  164. package/lib/cjs/utils/isRetina.js.map +1 -0
  165. package/lib/cjs/utils/logger.js +40 -0
  166. package/lib/cjs/utils/logger.js.map +1 -0
  167. package/lib/cjs/utils/numericChecker.js +33 -0
  168. package/lib/cjs/utils/numericChecker.js.map +1 -0
  169. package/lib/cjs/utils/ownerDocument.js +10 -0
  170. package/lib/cjs/utils/ownerDocument.js.map +1 -0
  171. package/lib/cjs/utils/pick.js +19 -0
  172. package/lib/cjs/utils/pick.js.map +1 -0
  173. package/lib/cjs/utils/propsForElement.js +59 -0
  174. package/lib/cjs/utils/propsForElement.js.map +1 -0
  175. package/lib/cjs/utils/rafTrottle.js +33 -0
  176. package/lib/cjs/utils/rafTrottle.js.map +1 -0
  177. package/lib/cjs/utils/reactToText.js +33 -0
  178. package/lib/cjs/utils/reactToText.js.map +1 -0
  179. package/lib/cjs/utils/ref.js +95 -0
  180. package/lib/cjs/utils/ref.js.map +1 -0
  181. package/lib/cjs/utils/setRef.js +10 -0
  182. package/lib/cjs/utils/setRef.js.map +1 -0
  183. package/lib/cjs/utils/syncScroll.js +61 -0
  184. package/lib/cjs/utils/syncScroll.js.map +1 -0
  185. package/lib/cjs/utils/uncontroll.js +47 -0
  186. package/lib/cjs/utils/uncontroll.js.map +1 -0
  187. package/lib/cjs/utils/uniqueID.js +42 -0
  188. package/lib/cjs/utils/uniqueID.js.map +1 -0
  189. package/lib/cjs/utils/use/useColorResolver.js +208 -0
  190. package/lib/cjs/utils/use/useColorResolver.js.map +1 -0
  191. package/lib/cjs/utils/use/useCss.js +20 -0
  192. package/lib/cjs/utils/use/useCss.js.map +1 -0
  193. package/lib/cjs/utils/use/useEnhancedEffect.js +13 -0
  194. package/lib/cjs/utils/use/useEnhancedEffect.js.map +1 -0
  195. package/lib/cjs/utils/use/useEventCallback.js +25 -0
  196. package/lib/cjs/utils/use/useEventCallback.js.map +1 -0
  197. package/lib/cjs/utils/use/useEventListener.js +33 -0
  198. package/lib/cjs/utils/use/useEventListener.js.map +1 -0
  199. package/lib/cjs/utils/use/useFocusLock.js +289 -0
  200. package/lib/cjs/utils/use/useFocusLock.js.map +1 -0
  201. package/lib/cjs/utils/use/usePreventScroll.js +78 -0
  202. package/lib/cjs/utils/use/usePreventScroll.js.map +1 -0
  203. package/lib/cjs/utils/useCssVariable.js +55 -0
  204. package/lib/cjs/utils/useCssVariable.js.map +1 -0
  205. package/lib/cjs/utils/zIndexStacking.js +48 -0
  206. package/lib/cjs/utils/zIndexStacking.js.map +1 -0
  207. package/lib/core-types/Component.js +59 -0
  208. package/lib/core-types/Component.js.map +1 -0
  209. package/lib/core-types/Component.mjs +54 -0
  210. package/lib/core-types/Component.mjs.map +1 -0
  211. package/lib/core-types/UnknownProperties.d.ts +3 -0
  212. package/lib/core-types/UnknownProperties.js +2 -0
  213. package/lib/core-types/UnknownProperties.js.map +1 -0
  214. package/lib/core-types/UnknownProperties.mjs +3 -0
  215. package/lib/core-types/UnknownProperties.mjs.map +1 -0
  216. package/lib/core-types/reshadow.d.js +2 -0
  217. package/lib/core-types/reshadow.d.js.map +1 -0
  218. package/lib/core-types/reshadow.d.mjs +2 -0
  219. package/lib/core-types/reshadow.d.mjs.map +1 -0
  220. package/lib/core-types/symbols.d.ts +9 -0
  221. package/lib/core-types/symbols.js +25 -0
  222. package/lib/core-types/symbols.js.map +1 -0
  223. package/lib/core-types/symbols.mjs +10 -0
  224. package/lib/core-types/symbols.mjs.map +1 -0
  225. package/lib/enhancement/Children.js +119 -0
  226. package/lib/enhancement/Children.js.map +1 -0
  227. package/lib/enhancement/Children.mjs +111 -0
  228. package/lib/enhancement/Children.mjs.map +1 -0
  229. package/lib/enhancement/Root.js +78 -0
  230. package/lib/enhancement/Root.js.map +1 -0
  231. package/lib/enhancement/Root.mjs +70 -0
  232. package/lib/enhancement/Root.mjs.map +1 -0
  233. package/lib/enhancement/bindHandler.js +54 -0
  234. package/lib/enhancement/bindHandler.js.map +1 -0
  235. package/lib/enhancement/bindHandler.mjs +47 -0
  236. package/lib/enhancement/bindHandler.mjs.map +1 -0
  237. package/lib/enhancement/dataName.js +20 -0
  238. package/lib/enhancement/dataName.js.map +1 -0
  239. package/lib/enhancement/dataName.mjs +12 -0
  240. package/lib/enhancement/dataName.mjs.map +1 -0
  241. package/lib/enhancement/enhance.js +22 -0
  242. package/lib/enhancement/enhance.js.map +1 -0
  243. package/lib/enhancement/enhance.mjs +15 -0
  244. package/lib/enhancement/enhance.mjs.map +1 -0
  245. package/lib/enhancement/functionDefaultProps.js +36 -0
  246. package/lib/enhancement/functionDefaultProps.js.map +1 -0
  247. package/lib/enhancement/functionDefaultProps.mjs +29 -0
  248. package/lib/enhancement/functionDefaultProps.mjs.map +1 -0
  249. package/lib/enhancement/hoistProps.js +97 -0
  250. package/lib/enhancement/hoistProps.js.map +1 -0
  251. package/lib/enhancement/hoistProps.mjs +88 -0
  252. package/lib/enhancement/hoistProps.mjs.map +1 -0
  253. package/lib/enhancement/i18n.js +28 -0
  254. package/lib/enhancement/i18n.js.map +1 -0
  255. package/lib/enhancement/i18n.mjs +20 -0
  256. package/lib/enhancement/i18n.mjs.map +1 -0
  257. package/lib/enhancement/inheritedName.js +23 -0
  258. package/lib/enhancement/inheritedName.js.map +1 -0
  259. package/lib/enhancement/inheritedName.mjs +15 -0
  260. package/lib/enhancement/inheritedName.mjs.map +1 -0
  261. package/lib/enhancement/staticChildren.js +135 -0
  262. package/lib/enhancement/staticChildren.js.map +1 -0
  263. package/lib/enhancement/staticChildren.mjs +123 -0
  264. package/lib/enhancement/staticChildren.mjs.map +1 -0
  265. package/lib/enhancement/style.js +60 -0
  266. package/lib/enhancement/style.js.map +1 -0
  267. package/lib/enhancement/style.mjs +51 -0
  268. package/lib/enhancement/style.mjs.map +1 -0
  269. package/lib/enhancement/uncontrolledProps.js +131 -0
  270. package/lib/enhancement/uncontrolledProps.js.map +1 -0
  271. package/lib/enhancement/uncontrolledProps.mjs +123 -0
  272. package/lib/enhancement/uncontrolledProps.mjs.map +1 -0
  273. package/lib/es6/LastInteractionType.js +49 -0
  274. package/lib/es6/LastInteractionType.js.map +1 -0
  275. package/lib/es6/core-types/Component.js +54 -0
  276. package/lib/es6/core-types/Component.js.map +1 -0
  277. package/lib/es6/core-types/UnknownProperties.js +2 -0
  278. package/lib/es6/core-types/UnknownProperties.js.map +1 -0
  279. package/lib/es6/core-types/reshadow.d.js +2 -0
  280. package/lib/es6/core-types/reshadow.d.js.map +1 -0
  281. package/lib/es6/core-types/symbols.js +10 -0
  282. package/lib/es6/core-types/symbols.js.map +1 -0
  283. package/lib/es6/coreFactory.js +343 -0
  284. package/lib/es6/coreFactory.js.map +1 -0
  285. package/lib/es6/enhancement/Children.js +111 -0
  286. package/lib/es6/enhancement/Children.js.map +1 -0
  287. package/lib/es6/enhancement/Root.js +70 -0
  288. package/lib/es6/enhancement/Root.js.map +1 -0
  289. package/lib/es6/enhancement/bindHandler.js +47 -0
  290. package/lib/es6/enhancement/bindHandler.js.map +1 -0
  291. package/lib/es6/enhancement/dataName.js +12 -0
  292. package/lib/es6/enhancement/dataName.js.map +1 -0
  293. package/lib/es6/enhancement/enhance.js +15 -0
  294. package/lib/es6/enhancement/enhance.js.map +1 -0
  295. package/lib/es6/enhancement/functionDefaultProps.js +29 -0
  296. package/lib/es6/enhancement/functionDefaultProps.js.map +1 -0
  297. package/lib/es6/enhancement/hoistProps.js +88 -0
  298. package/lib/es6/enhancement/hoistProps.js.map +1 -0
  299. package/lib/es6/enhancement/i18n.js +20 -0
  300. package/lib/es6/enhancement/i18n.js.map +1 -0
  301. package/lib/es6/enhancement/inheritedName.js +15 -0
  302. package/lib/es6/enhancement/inheritedName.js.map +1 -0
  303. package/lib/es6/enhancement/staticChildren.js +123 -0
  304. package/lib/es6/enhancement/staticChildren.js.map +1 -0
  305. package/lib/es6/enhancement/style.js +51 -0
  306. package/lib/es6/enhancement/style.js.map +1 -0
  307. package/lib/es6/enhancement/uncontrolledProps.js +123 -0
  308. package/lib/es6/enhancement/uncontrolledProps.js.map +1 -0
  309. package/lib/es6/index.js +8 -3
  310. package/lib/es6/index.js.map +1 -1
  311. package/lib/es6/register.js +29 -0
  312. package/lib/es6/register.js.map +1 -0
  313. package/lib/es6/styled/index.js +6 -0
  314. package/lib/es6/styled/index.js.map +1 -0
  315. package/lib/es6/styled/reshadow-core.js +243 -0
  316. package/lib/es6/styled/reshadow-core.js.map +1 -0
  317. package/lib/es6/styled/sstyled.js +142 -0
  318. package/lib/es6/styled/sstyled.js.map +1 -0
  319. package/lib/es6/theme/dark.json +2506 -0
  320. package/lib/es6/theme/exclude-tokens.json +10 -0
  321. package/lib/es6/theme/light.json +2584 -0
  322. package/lib/es6/theme/processor.js +307 -0
  323. package/lib/es6/theme/processor.js.map +1 -0
  324. package/lib/es6/theme/themes/auto.css +1465 -0
  325. package/lib/es6/theme/themes/dark.css +723 -0
  326. package/lib/es6/theme/themes/dark.js +378 -0
  327. package/lib/es6/theme/themes/dark.js.map +1 -0
  328. package/lib/es6/theme/themes/default.css +742 -0
  329. package/lib/es6/theme/themes/default.js +387 -0
  330. package/lib/es6/theme/themes/default.js.map +1 -0
  331. package/lib/es6/theme/themes/light.css +742 -0
  332. package/lib/es6/theme/themes/light.js +387 -0
  333. package/lib/es6/theme/themes/light.js.map +1 -0
  334. package/lib/es6/theme/utils.js +286 -0
  335. package/lib/es6/theme/utils.js.map +1 -0
  336. package/lib/es6/utils/CSSinJS.js +28 -0
  337. package/lib/es6/utils/CSSinJS.js.map +1 -0
  338. package/lib/es6/utils/ScreenReaderOnly.js +24 -0
  339. package/lib/es6/utils/ScreenReaderOnly.js.map +1 -0
  340. package/lib/es6/utils/ThemeProvider.js +71 -0
  341. package/lib/es6/utils/ThemeProvider.js.map +1 -0
  342. package/lib/es6/utils/addonText.js +11 -0
  343. package/lib/es6/utils/addonText.js.map +1 -0
  344. package/lib/es6/utils/addonTextChildren.js +37 -0
  345. package/lib/es6/utils/addonTextChildren.js.map +1 -0
  346. package/lib/es6/utils/ariaProps.js +16 -0
  347. package/lib/es6/utils/ariaProps.js.map +1 -0
  348. package/lib/es6/utils/assignProps.js +84 -0
  349. package/lib/es6/utils/assignProps.js.map +1 -0
  350. package/lib/es6/utils/canUseDOM.js +4 -0
  351. package/lib/es6/utils/canUseDOM.js.map +1 -0
  352. package/lib/es6/utils/capitalizeFirstLetter.js +4 -0
  353. package/lib/es6/utils/capitalizeFirstLetter.js.map +1 -0
  354. package/lib/es6/utils/color.js +196 -0
  355. package/lib/es6/utils/color.js.map +1 -0
  356. package/lib/es6/utils/compose.js +15 -0
  357. package/lib/es6/utils/compose.js.map +1 -0
  358. package/lib/es6/utils/createHoc.js +46 -0
  359. package/lib/es6/utils/createHoc.js.map +1 -0
  360. package/lib/es6/utils/createUUID.js +9 -0
  361. package/lib/es6/utils/createUUID.js.map +1 -0
  362. package/lib/es6/utils/cssToIntDefault.js +16 -0
  363. package/lib/es6/utils/cssToIntDefault.js.map +1 -0
  364. package/lib/es6/utils/enhances/WithAutoFocus.js +67 -0
  365. package/lib/es6/utils/enhances/WithAutoFocus.js.map +1 -0
  366. package/lib/es6/utils/enhances/WithCSS.js +79 -0
  367. package/lib/es6/utils/enhances/WithCSS.js.map +1 -0
  368. package/lib/es6/utils/enhances/WithI18n.js +83 -0
  369. package/lib/es6/utils/enhances/WithI18n.js.map +1 -0
  370. package/lib/es6/utils/enhances/WithKeyboardFocus.js +84 -0
  371. package/lib/es6/utils/enhances/WithKeyboardFocus.js.map +1 -0
  372. package/lib/es6/utils/enhances/WithRef.js +18 -0
  373. package/lib/es6/utils/enhances/WithRef.js.map +1 -0
  374. package/lib/es6/utils/enhances/a11yEnhance.js +66 -0
  375. package/lib/es6/utils/enhances/a11yEnhance.js.map +1 -0
  376. package/lib/es6/utils/enhances/animatedSizeEnhance.js +90 -0
  377. package/lib/es6/utils/enhances/animatedSizeEnhance.js.map +1 -0
  378. package/lib/es6/utils/enhances/autoFocusEnhance.js +38 -0
  379. package/lib/es6/utils/enhances/autoFocusEnhance.js.map +1 -0
  380. package/lib/es6/utils/enhances/contextEnhance.js +14 -0
  381. package/lib/es6/utils/enhances/contextEnhance.js.map +1 -0
  382. package/lib/es6/utils/enhances/i18nEnhance.js +92 -0
  383. package/lib/es6/utils/enhances/i18nEnhance.js.map +1 -0
  384. package/lib/es6/utils/enhances/keyboardFocusEnhance.js +57 -0
  385. package/lib/es6/utils/enhances/keyboardFocusEnhance.js.map +1 -0
  386. package/lib/es6/utils/enhances/resolveColorEnhance.js +17 -0
  387. package/lib/es6/utils/enhances/resolveColorEnhance.js.map +1 -0
  388. package/lib/es6/utils/eventEmitter.js +34 -0
  389. package/lib/es6/utils/eventEmitter.js.map +1 -0
  390. package/lib/es6/utils/findComponent.js +95 -0
  391. package/lib/es6/utils/findComponent.js.map +1 -0
  392. package/lib/es6/utils/fire.js +15 -0
  393. package/lib/es6/utils/fire.js.map +1 -0
  394. package/lib/es6/utils/focus-lock/focusBorders.js +62 -0
  395. package/lib/es6/utils/focus-lock/focusBorders.js.map +1 -0
  396. package/lib/es6/utils/focus-lock/getFocusableIn.js +19 -0
  397. package/lib/es6/utils/focus-lock/getFocusableIn.js.map +1 -0
  398. package/lib/es6/utils/focus-lock/isFocusInside.js +9 -0
  399. package/lib/es6/utils/focus-lock/isFocusInside.js.map +1 -0
  400. package/lib/es6/utils/focus-lock/isFocusable.js +43 -0
  401. package/lib/es6/utils/focus-lock/isFocusable.js.map +1 -0
  402. package/lib/es6/utils/focus-lock/setFocus.js +55 -0
  403. package/lib/es6/utils/focus-lock/setFocus.js.map +1 -0
  404. package/lib/es6/utils/getAccessibleName.js +49 -0
  405. package/lib/es6/utils/getAccessibleName.js.map +1 -0
  406. package/lib/es6/utils/getDisplayName.js +4 -0
  407. package/lib/es6/utils/getDisplayName.js.map +1 -0
  408. package/lib/es6/utils/getEventTarget.js +45 -0
  409. package/lib/es6/utils/getEventTarget.js.map +1 -0
  410. package/lib/es6/utils/getOriginChildren.js +10 -0
  411. package/lib/es6/utils/getOriginChildren.js.map +1 -0
  412. package/lib/es6/utils/getRandomInt.js +5 -0
  413. package/lib/es6/utils/getRandomInt.js.map +1 -0
  414. package/lib/es6/utils/getValue.js +10 -0
  415. package/lib/es6/utils/getValue.js.map +1 -0
  416. package/lib/es6/utils/hasLabels.js +39 -0
  417. package/lib/es6/utils/hasLabels.js.map +1 -0
  418. package/lib/es6/utils/hasParent.js +7 -0
  419. package/lib/es6/utils/hasParent.js.map +1 -0
  420. package/lib/es6/utils/if.js +9 -0
  421. package/lib/es6/utils/if.js.map +1 -0
  422. package/lib/es6/utils/ifChildren.js +10 -0
  423. package/lib/es6/utils/ifChildren.js.map +1 -0
  424. package/lib/es6/utils/injectStyle.js +41 -0
  425. package/lib/es6/utils/injectStyle.js.map +1 -0
  426. package/lib/es6/utils/inputProps.js +14 -0
  427. package/lib/es6/utils/inputProps.js.map +1 -0
  428. package/lib/es6/utils/isNode.js +21 -0
  429. package/lib/es6/utils/isNode.js.map +1 -0
  430. package/lib/es6/utils/isPromise.js +4 -0
  431. package/lib/es6/utils/isPromise.js.map +1 -0
  432. package/lib/es6/utils/isRetina.js +9 -0
  433. package/lib/es6/utils/isRetina.js.map +1 -0
  434. package/lib/es6/utils/logger.js +32 -0
  435. package/lib/es6/utils/logger.js.map +1 -0
  436. package/lib/es6/utils/numericChecker.js +27 -0
  437. package/lib/es6/utils/numericChecker.js.map +1 -0
  438. package/lib/es6/utils/ownerDocument.js +4 -0
  439. package/lib/es6/utils/ownerDocument.js.map +1 -0
  440. package/lib/es6/utils/pick.js +13 -0
  441. package/lib/es6/utils/pick.js.map +1 -0
  442. package/lib/es6/utils/propsForElement.js +50 -0
  443. package/lib/es6/utils/propsForElement.js.map +1 -0
  444. package/lib/es6/utils/rafTrottle.js +26 -0
  445. package/lib/es6/utils/rafTrottle.js.map +1 -0
  446. package/lib/es6/utils/reactToText.js +26 -0
  447. package/lib/es6/utils/reactToText.js.map +1 -0
  448. package/lib/es6/utils/ref.js +83 -0
  449. package/lib/es6/utils/ref.js.map +1 -0
  450. package/lib/es6/utils/setRef.js +3 -0
  451. package/lib/es6/utils/setRef.js.map +1 -0
  452. package/lib/es6/utils/syncScroll.js +54 -0
  453. package/lib/es6/utils/syncScroll.js.map +1 -0
  454. package/lib/es6/utils/uncontroll.js +38 -0
  455. package/lib/es6/utils/uncontroll.js.map +1 -0
  456. package/lib/es6/utils/uniqueID.js +33 -0
  457. package/lib/es6/utils/uniqueID.js.map +1 -0
  458. package/lib/es6/utils/use/useColorResolver.js +200 -0
  459. package/lib/es6/utils/use/useColorResolver.js.map +1 -0
  460. package/lib/es6/utils/use/useCss.js +12 -0
  461. package/lib/es6/utils/use/useCss.js.map +1 -0
  462. package/lib/es6/utils/use/useEnhancedEffect.js +5 -0
  463. package/lib/es6/utils/use/useEnhancedEffect.js.map +1 -0
  464. package/lib/es6/utils/use/useEventCallback.js +19 -0
  465. package/lib/es6/utils/use/useEventCallback.js.map +1 -0
  466. package/lib/es6/utils/use/useEventListener.js +25 -0
  467. package/lib/es6/utils/use/useEventListener.js.map +1 -0
  468. package/lib/es6/utils/use/useFocusLock.js +266 -0
  469. package/lib/es6/utils/use/useFocusLock.js.map +1 -0
  470. package/lib/es6/utils/use/usePreventScroll.js +70 -0
  471. package/lib/es6/utils/use/usePreventScroll.js.map +1 -0
  472. package/lib/es6/utils/useCssVariable.js +46 -0
  473. package/lib/es6/utils/useCssVariable.js.map +1 -0
  474. package/lib/es6/utils/zIndexStacking.js +38 -0
  475. package/lib/es6/utils/zIndexStacking.js.map +1 -0
  476. package/lib/esm/_virtual/_commonjsHelpers.mjs +6 -0
  477. package/lib/esm/_virtual/index.mjs +4 -0
  478. package/lib/esm/_virtual/index2.mjs +4 -0
  479. package/lib/esm/_virtual/react-is.development.mjs +4 -0
  480. package/lib/esm/_virtual/react-is.production.min.mjs +4 -0
  481. package/lib/register.d.ts +8 -0
  482. package/lib/register.js +37 -0
  483. package/lib/register.js.map +1 -0
  484. package/lib/register.mjs +29 -0
  485. package/lib/register.mjs.map +1 -0
  486. package/lib/styled/index.d.ts +11 -0
  487. package/lib/styled/index.js +32 -0
  488. package/lib/styled/index.js.map +1 -0
  489. package/lib/styled/index.mjs +6 -0
  490. package/lib/styled/index.mjs.map +1 -0
  491. package/lib/styled/reshadow-core.d.ts +37 -0
  492. package/lib/styled/reshadow-core.js +256 -0
  493. package/lib/styled/reshadow-core.js.map +1 -0
  494. package/lib/styled/reshadow-core.mjs +243 -0
  495. package/lib/styled/reshadow-core.mjs.map +1 -0
  496. package/lib/styled/sstyled.d.ts +17 -0
  497. package/lib/styled/sstyled.js +149 -0
  498. package/lib/styled/sstyled.js.map +1 -0
  499. package/lib/styled/sstyled.mjs +142 -0
  500. package/lib/styled/sstyled.mjs.map +1 -0
  501. package/lib/theme/dark.json +2506 -0
  502. package/lib/theme/exclude-tokens.json +10 -0
  503. package/lib/theme/light.json +2584 -0
  504. package/lib/theme/processor.js +315 -0
  505. package/lib/theme/processor.js.map +1 -0
  506. package/lib/theme/processor.mjs +307 -0
  507. package/lib/theme/processor.mjs.map +1 -0
  508. package/lib/theme/themes/auto.css +1465 -0
  509. package/lib/theme/themes/dark.css +723 -0
  510. package/lib/theme/themes/dark.js +385 -0
  511. package/lib/theme/themes/dark.js.map +1 -0
  512. package/lib/theme/themes/dark.mjs +378 -0
  513. package/lib/theme/themes/dark.mjs.map +1 -0
  514. package/lib/theme/themes/default.css +742 -0
  515. package/lib/theme/themes/default.d.ts +387 -0
  516. package/lib/theme/themes/default.js +394 -0
  517. package/lib/theme/themes/default.js.map +1 -0
  518. package/lib/theme/themes/default.mjs +387 -0
  519. package/lib/theme/themes/default.mjs.map +1 -0
  520. package/lib/theme/themes/light.css +742 -0
  521. package/lib/theme/themes/light.js +394 -0
  522. package/lib/theme/themes/light.js.map +1 -0
  523. package/lib/theme/themes/light.mjs +387 -0
  524. package/lib/theme/themes/light.mjs.map +1 -0
  525. package/lib/theme/utils.js +297 -0
  526. package/lib/theme/utils.js.map +1 -0
  527. package/lib/theme/utils.mjs +286 -0
  528. package/lib/theme/utils.mjs.map +1 -0
  529. package/lib/types/LastInteractionType.d.ts +11 -0
  530. package/lib/types/core-types/Component.d.ts +189 -0
  531. package/lib/types/core-types/UnknownProperties.d.ts +3 -0
  532. package/lib/types/core-types/symbols.d.ts +9 -0
  533. package/lib/types/coreFactory.d.ts +27 -0
  534. package/lib/types/enhancement/Children.d.ts +5 -0
  535. package/lib/types/enhancement/Root.d.ts +6 -0
  536. package/lib/types/enhancement/bindHandler.d.ts +5 -0
  537. package/lib/types/enhancement/dataName.d.ts +4 -0
  538. package/lib/types/enhancement/enhance.d.ts +5 -0
  539. package/lib/types/enhancement/functionDefaultProps.d.ts +8 -0
  540. package/lib/types/enhancement/hoistProps.d.ts +10 -0
  541. package/lib/types/enhancement/i18n.d.ts +4 -0
  542. package/lib/types/enhancement/inheritedName.d.ts +8 -0
  543. package/lib/types/enhancement/staticChildren.d.ts +13 -0
  544. package/lib/types/enhancement/style.d.ts +9 -0
  545. package/lib/types/enhancement/uncontrolledProps.d.ts +7 -0
  546. package/lib/types/index.d.ts +11 -3
  547. package/lib/types/register.d.ts +8 -0
  548. package/lib/types/styled/index.d.ts +11 -0
  549. package/lib/types/styled/reshadow-core.d.ts +37 -0
  550. package/lib/types/styled/sstyled.d.ts +17 -0
  551. package/lib/types/theme/processor.d.ts +1 -0
  552. package/lib/types/theme/themes/dark.d.ts +378 -0
  553. package/lib/types/theme/themes/default.d.ts +387 -0
  554. package/lib/types/theme/themes/light.d.ts +387 -0
  555. package/lib/types/theme/utils.d.ts +52 -0
  556. package/lib/types/utils/CSSinJS.d.ts +5 -0
  557. package/lib/types/utils/ScreenReaderOnly.d.ts +8 -0
  558. package/lib/types/utils/ThemeProvider.d.ts +15 -0
  559. package/lib/types/utils/addonText.d.ts +2 -0
  560. package/lib/types/utils/addonTextChildren.d.ts +3 -0
  561. package/lib/types/utils/ariaProps.d.ts +12 -0
  562. package/lib/types/utils/assignProps.d.ts +11 -0
  563. package/lib/types/utils/canUseDOM.d.ts +1 -0
  564. package/lib/types/utils/capitalizeFirstLetter.d.ts +1 -0
  565. package/lib/types/utils/color.d.ts +5 -0
  566. package/lib/types/utils/compose.d.ts +1 -0
  567. package/lib/types/utils/createHoc.d.ts +3 -0
  568. package/lib/types/utils/createUUID.d.ts +1 -0
  569. package/lib/types/utils/cssToIntDefault.d.ts +8 -0
  570. package/lib/types/utils/enhances/WithAutoFocus.d.ts +14 -0
  571. package/lib/types/utils/enhances/WithCSS.d.ts +41 -0
  572. package/lib/types/utils/enhances/WithI18n.d.ts +43 -0
  573. package/lib/types/utils/enhances/WithKeyboardFocus.d.ts +45 -0
  574. package/lib/types/utils/enhances/WithRef.d.ts +3 -0
  575. package/lib/types/utils/enhances/a11yEnhance.d.ts +10 -0
  576. package/lib/types/utils/enhances/animatedSizeEnhance.d.ts +12 -0
  577. package/lib/types/utils/enhances/autoFocusEnhance.d.ts +10 -0
  578. package/lib/types/utils/enhances/contextEnhance.d.ts +3 -0
  579. package/lib/types/utils/enhances/i18nEnhance.d.ts +25 -0
  580. package/lib/types/utils/enhances/keyboardFocusEnhance.d.ts +27 -0
  581. package/lib/types/utils/enhances/resolveColorEnhance.d.ts +2 -0
  582. package/lib/types/utils/eventEmitter.d.ts +9 -0
  583. package/lib/types/utils/findComponent.d.ts +12 -0
  584. package/lib/types/utils/fire.d.ts +2 -0
  585. package/lib/types/utils/focus-lock/focusBorders.d.ts +4 -0
  586. package/lib/types/utils/focus-lock/getFocusableIn.d.ts +1 -0
  587. package/lib/types/utils/focus-lock/isFocusInside.d.ts +1 -0
  588. package/lib/types/utils/focus-lock/isFocusable.d.ts +1 -0
  589. package/lib/types/utils/focus-lock/setFocus.d.ts +1 -0
  590. package/lib/types/utils/getAccessibleName.d.ts +1 -0
  591. package/lib/types/utils/getDisplayName.d.ts +2 -0
  592. package/lib/types/utils/getEventTarget.d.ts +1 -0
  593. package/lib/types/utils/getOriginChildren.d.ts +2 -0
  594. package/lib/types/utils/getRandomInt.d.ts +1 -0
  595. package/lib/types/utils/getValue.d.ts +1 -0
  596. package/lib/types/utils/hasLabels.d.ts +7 -0
  597. package/lib/types/utils/hasParent.d.ts +1 -0
  598. package/lib/types/utils/if.d.ts +11 -0
  599. package/lib/types/utils/ifChildren.d.ts +8 -0
  600. package/lib/types/utils/injectStyle.d.ts +2 -0
  601. package/lib/types/utils/inputProps.d.ts +2 -0
  602. package/lib/types/utils/isNode.d.ts +1 -0
  603. package/lib/types/utils/isPromise.d.ts +1 -0
  604. package/lib/types/utils/isRetina.d.ts +1 -0
  605. package/lib/types/utils/logger.d.ts +9 -0
  606. package/lib/types/utils/numericChecker.d.ts +5 -0
  607. package/lib/types/utils/ownerDocument.d.ts +1 -0
  608. package/lib/types/utils/pick.d.ts +1 -0
  609. package/lib/types/utils/propsForElement.d.ts +3 -0
  610. package/lib/types/utils/rafTrottle.d.ts +2 -0
  611. package/lib/types/utils/reactToText.d.ts +3 -0
  612. package/lib/types/utils/ref.d.ts +8 -0
  613. package/lib/types/utils/setRef.d.ts +2 -0
  614. package/lib/types/utils/syncScroll.d.ts +1 -0
  615. package/lib/types/utils/uncontroll.d.ts +4 -0
  616. package/lib/types/utils/uniqueID.d.ts +12 -0
  617. package/lib/types/utils/use/useColorResolver.d.ts +1 -0
  618. package/lib/types/utils/use/useCss.d.ts +4 -0
  619. package/lib/types/utils/use/useEnhancedEffect.d.ts +3 -0
  620. package/lib/types/utils/use/useEventCallback.d.ts +4 -0
  621. package/lib/types/utils/use/useEventListener.d.ts +2 -0
  622. package/lib/types/utils/use/useFocusLock.d.ts +10 -0
  623. package/lib/types/utils/use/usePreventScroll.d.ts +2 -0
  624. package/lib/types/utils/useCssVariable.d.ts +8 -0
  625. package/lib/types/utils/zIndexStacking.d.ts +8 -0
  626. package/lib/utils/CSSinJS.d.ts +5 -0
  627. package/lib/utils/CSSinJS.js +36 -0
  628. package/lib/utils/CSSinJS.js.map +1 -0
  629. package/lib/utils/CSSinJS.mjs +28 -0
  630. package/lib/utils/CSSinJS.mjs.map +1 -0
  631. package/lib/utils/ScreenReaderOnly.d.ts +8 -0
  632. package/lib/utils/ScreenReaderOnly.js +31 -0
  633. package/lib/utils/ScreenReaderOnly.js.map +1 -0
  634. package/lib/utils/ScreenReaderOnly.mjs +24 -0
  635. package/lib/utils/ScreenReaderOnly.mjs.map +1 -0
  636. package/lib/utils/ThemeProvider.d.ts +15 -0
  637. package/lib/utils/ThemeProvider.js +82 -0
  638. package/lib/utils/ThemeProvider.js.map +1 -0
  639. package/lib/utils/ThemeProvider.mjs +71 -0
  640. package/lib/utils/ThemeProvider.mjs.map +1 -0
  641. package/lib/utils/addonText.d.ts +2 -0
  642. package/lib/utils/addonText.js +18 -0
  643. package/lib/utils/addonText.js.map +1 -0
  644. package/lib/utils/addonText.mjs +11 -0
  645. package/lib/utils/addonText.mjs.map +1 -0
  646. package/lib/utils/addonTextChildren.d.ts +3 -0
  647. package/lib/utils/addonTextChildren.js +45 -0
  648. package/lib/utils/addonTextChildren.js.map +1 -0
  649. package/lib/utils/addonTextChildren.mjs +37 -0
  650. package/lib/utils/addonTextChildren.mjs.map +1 -0
  651. package/lib/utils/ariaProps.d.ts +12 -0
  652. package/lib/utils/ariaProps.js +22 -0
  653. package/lib/utils/ariaProps.js.map +1 -0
  654. package/lib/utils/ariaProps.mjs +16 -0
  655. package/lib/utils/ariaProps.mjs.map +1 -0
  656. package/lib/utils/assignProps.d.ts +11 -0
  657. package/lib/utils/assignProps.js +93 -0
  658. package/lib/utils/assignProps.js.map +1 -0
  659. package/lib/utils/assignProps.mjs +84 -0
  660. package/lib/utils/assignProps.mjs.map +1 -0
  661. package/lib/utils/canUseDOM.d.ts +1 -0
  662. package/lib/utils/canUseDOM.js +10 -0
  663. package/lib/utils/canUseDOM.js.map +1 -0
  664. package/lib/utils/canUseDOM.mjs +4 -0
  665. package/lib/utils/canUseDOM.mjs.map +1 -0
  666. package/lib/utils/capitalizeFirstLetter.d.ts +1 -0
  667. package/lib/utils/capitalizeFirstLetter.js +10 -0
  668. package/lib/utils/capitalizeFirstLetter.js.map +1 -0
  669. package/lib/utils/capitalizeFirstLetter.mjs +4 -0
  670. package/lib/utils/capitalizeFirstLetter.mjs.map +1 -0
  671. package/lib/utils/color.d.ts +5 -0
  672. package/lib/utils/color.js +208 -0
  673. package/lib/utils/color.js.map +1 -0
  674. package/lib/utils/color.mjs +196 -0
  675. package/lib/utils/color.mjs.map +1 -0
  676. package/lib/utils/compose.d.ts +1 -0
  677. package/lib/utils/compose.js +21 -0
  678. package/lib/utils/compose.js.map +1 -0
  679. package/lib/utils/compose.mjs +15 -0
  680. package/lib/utils/compose.mjs.map +1 -0
  681. package/lib/utils/createHoc.d.ts +3 -0
  682. package/lib/utils/createHoc.js +55 -0
  683. package/lib/utils/createHoc.js.map +1 -0
  684. package/lib/utils/createHoc.mjs +46 -0
  685. package/lib/utils/createHoc.mjs.map +1 -0
  686. package/lib/utils/createUUID.d.ts +1 -0
  687. package/lib/utils/createUUID.js +15 -0
  688. package/lib/utils/createUUID.js.map +1 -0
  689. package/lib/utils/createUUID.mjs +9 -0
  690. package/lib/utils/createUUID.mjs.map +1 -0
  691. package/lib/utils/cssToIntDefault.d.ts +8 -0
  692. package/lib/utils/cssToIntDefault.js +22 -0
  693. package/lib/utils/cssToIntDefault.js.map +1 -0
  694. package/lib/utils/cssToIntDefault.mjs +16 -0
  695. package/lib/utils/cssToIntDefault.mjs.map +1 -0
  696. package/lib/utils/enhances/WithAutoFocus.d.ts +14 -0
  697. package/lib/utils/enhances/WithAutoFocus.js +75 -0
  698. package/lib/utils/enhances/WithAutoFocus.js.map +1 -0
  699. package/lib/utils/enhances/WithAutoFocus.mjs +67 -0
  700. package/lib/utils/enhances/WithAutoFocus.mjs.map +1 -0
  701. package/lib/utils/enhances/WithCSS.d.ts +41 -0
  702. package/lib/utils/enhances/WithCSS.js +93 -0
  703. package/lib/utils/enhances/WithCSS.js.map +1 -0
  704. package/lib/utils/enhances/WithCSS.mjs +79 -0
  705. package/lib/utils/enhances/WithCSS.mjs.map +1 -0
  706. package/lib/utils/enhances/WithI18n.d.ts +43 -0
  707. package/lib/utils/enhances/WithI18n.js +95 -0
  708. package/lib/utils/enhances/WithI18n.js.map +1 -0
  709. package/lib/utils/enhances/WithI18n.mjs +83 -0
  710. package/lib/utils/enhances/WithI18n.mjs.map +1 -0
  711. package/lib/utils/enhances/WithKeyboardFocus.d.ts +45 -0
  712. package/lib/utils/enhances/WithKeyboardFocus.js +93 -0
  713. package/lib/utils/enhances/WithKeyboardFocus.js.map +1 -0
  714. package/lib/utils/enhances/WithKeyboardFocus.mjs +84 -0
  715. package/lib/utils/enhances/WithKeyboardFocus.mjs.map +1 -0
  716. package/lib/utils/enhances/WithRef.d.ts +3 -0
  717. package/lib/utils/enhances/WithRef.js +26 -0
  718. package/lib/utils/enhances/WithRef.js.map +1 -0
  719. package/lib/utils/enhances/WithRef.mjs +18 -0
  720. package/lib/utils/enhances/WithRef.mjs.map +1 -0
  721. package/lib/utils/enhances/a11yEnhance.d.ts +10 -0
  722. package/lib/utils/enhances/a11yEnhance.js +74 -0
  723. package/lib/utils/enhances/a11yEnhance.js.map +1 -0
  724. package/lib/utils/enhances/a11yEnhance.mjs +66 -0
  725. package/lib/utils/enhances/a11yEnhance.mjs.map +1 -0
  726. package/lib/utils/enhances/animatedSizeEnhance.d.ts +12 -0
  727. package/lib/utils/enhances/animatedSizeEnhance.js +98 -0
  728. package/lib/utils/enhances/animatedSizeEnhance.js.map +1 -0
  729. package/lib/utils/enhances/animatedSizeEnhance.mjs +90 -0
  730. package/lib/utils/enhances/animatedSizeEnhance.mjs.map +1 -0
  731. package/lib/utils/enhances/autoFocusEnhance.d.ts +10 -0
  732. package/lib/utils/enhances/autoFocusEnhance.js +46 -0
  733. package/lib/utils/enhances/autoFocusEnhance.js.map +1 -0
  734. package/lib/utils/enhances/autoFocusEnhance.mjs +38 -0
  735. package/lib/utils/enhances/autoFocusEnhance.mjs.map +1 -0
  736. package/lib/utils/enhances/contextEnhance.d.ts +3 -0
  737. package/lib/utils/enhances/contextEnhance.js +22 -0
  738. package/lib/utils/enhances/contextEnhance.js.map +1 -0
  739. package/lib/utils/enhances/contextEnhance.mjs +14 -0
  740. package/lib/utils/enhances/contextEnhance.mjs.map +1 -0
  741. package/lib/utils/enhances/i18nEnhance.d.ts +25 -0
  742. package/lib/utils/enhances/i18nEnhance.js +101 -0
  743. package/lib/utils/enhances/i18nEnhance.js.map +1 -0
  744. package/lib/utils/enhances/i18nEnhance.mjs +92 -0
  745. package/lib/utils/enhances/i18nEnhance.mjs.map +1 -0
  746. package/lib/utils/enhances/keyboardFocusEnhance.d.ts +27 -0
  747. package/lib/utils/enhances/keyboardFocusEnhance.js +63 -0
  748. package/lib/utils/enhances/keyboardFocusEnhance.js.map +1 -0
  749. package/lib/utils/enhances/keyboardFocusEnhance.mjs +57 -0
  750. package/lib/utils/enhances/keyboardFocusEnhance.mjs.map +1 -0
  751. package/lib/utils/enhances/resolveColorEnhance.d.ts +2 -0
  752. package/lib/utils/enhances/resolveColorEnhance.js +25 -0
  753. package/lib/utils/enhances/resolveColorEnhance.js.map +1 -0
  754. package/lib/utils/enhances/resolveColorEnhance.mjs +17 -0
  755. package/lib/utils/enhances/resolveColorEnhance.mjs.map +1 -0
  756. package/lib/utils/eventEmitter.d.ts +9 -0
  757. package/lib/utils/eventEmitter.js +41 -0
  758. package/lib/utils/eventEmitter.js.map +1 -0
  759. package/lib/utils/eventEmitter.mjs +34 -0
  760. package/lib/utils/eventEmitter.mjs.map +1 -0
  761. package/lib/utils/findComponent.d.ts +12 -0
  762. package/lib/utils/findComponent.js +106 -0
  763. package/lib/utils/findComponent.js.map +1 -0
  764. package/lib/utils/findComponent.mjs +95 -0
  765. package/lib/utils/findComponent.mjs.map +1 -0
  766. package/lib/utils/fire.d.ts +2 -0
  767. package/lib/utils/fire.js +23 -0
  768. package/lib/utils/fire.js.map +1 -0
  769. package/lib/utils/fire.mjs +15 -0
  770. package/lib/utils/fire.mjs.map +1 -0
  771. package/lib/utils/focus-lock/focusBorders.d.ts +4 -0
  772. package/lib/utils/focus-lock/focusBorders.js +72 -0
  773. package/lib/utils/focus-lock/focusBorders.js.map +1 -0
  774. package/lib/utils/focus-lock/focusBorders.mjs +62 -0
  775. package/lib/utils/focus-lock/focusBorders.mjs.map +1 -0
  776. package/lib/utils/focus-lock/getFocusableIn.d.ts +1 -0
  777. package/lib/utils/focus-lock/getFocusableIn.js +26 -0
  778. package/lib/utils/focus-lock/getFocusableIn.js.map +1 -0
  779. package/lib/utils/focus-lock/getFocusableIn.mjs +19 -0
  780. package/lib/utils/focus-lock/getFocusableIn.mjs.map +1 -0
  781. package/lib/utils/focus-lock/isFocusInside.d.ts +1 -0
  782. package/lib/utils/focus-lock/isFocusInside.js +16 -0
  783. package/lib/utils/focus-lock/isFocusInside.js.map +1 -0
  784. package/lib/utils/focus-lock/isFocusInside.mjs +9 -0
  785. package/lib/utils/focus-lock/isFocusInside.mjs.map +1 -0
  786. package/lib/utils/focus-lock/isFocusable.d.ts +1 -0
  787. package/lib/utils/focus-lock/isFocusable.js +51 -0
  788. package/lib/utils/focus-lock/isFocusable.js.map +1 -0
  789. package/lib/utils/focus-lock/isFocusable.mjs +43 -0
  790. package/lib/utils/focus-lock/isFocusable.mjs.map +1 -0
  791. package/lib/utils/focus-lock/setFocus.d.ts +1 -0
  792. package/lib/utils/focus-lock/setFocus.js +63 -0
  793. package/lib/utils/focus-lock/setFocus.js.map +1 -0
  794. package/lib/utils/focus-lock/setFocus.mjs +55 -0
  795. package/lib/utils/focus-lock/setFocus.mjs.map +1 -0
  796. package/lib/utils/getAccessibleName.d.ts +1 -0
  797. package/lib/utils/getAccessibleName.js +56 -0
  798. package/lib/utils/getAccessibleName.js.map +1 -0
  799. package/lib/utils/getAccessibleName.mjs +49 -0
  800. package/lib/utils/getAccessibleName.mjs.map +1 -0
  801. package/lib/utils/getDisplayName.d.ts +2 -0
  802. package/lib/utils/getDisplayName.js +10 -0
  803. package/lib/utils/getDisplayName.js.map +1 -0
  804. package/lib/utils/getDisplayName.mjs +4 -0
  805. package/lib/utils/getDisplayName.mjs.map +1 -0
  806. package/lib/utils/getEventTarget.d.ts +1 -0
  807. package/lib/utils/getEventTarget.js +53 -0
  808. package/lib/utils/getEventTarget.js.map +1 -0
  809. package/lib/utils/getEventTarget.mjs +45 -0
  810. package/lib/utils/getEventTarget.mjs.map +1 -0
  811. package/lib/utils/getOriginChildren.d.ts +2 -0
  812. package/lib/utils/getOriginChildren.js +18 -0
  813. package/lib/utils/getOriginChildren.js.map +1 -0
  814. package/lib/utils/getOriginChildren.mjs +10 -0
  815. package/lib/utils/getOriginChildren.mjs.map +1 -0
  816. package/lib/utils/getRandomInt.d.ts +1 -0
  817. package/lib/utils/getRandomInt.js +11 -0
  818. package/lib/utils/getRandomInt.js.map +1 -0
  819. package/lib/utils/getRandomInt.mjs +5 -0
  820. package/lib/utils/getRandomInt.mjs.map +1 -0
  821. package/lib/utils/getValue.d.ts +1 -0
  822. package/lib/utils/getValue.js +16 -0
  823. package/lib/utils/getValue.js.map +1 -0
  824. package/lib/utils/getValue.mjs +10 -0
  825. package/lib/utils/getValue.mjs.map +1 -0
  826. package/lib/utils/hasLabels.d.ts +7 -0
  827. package/lib/utils/hasLabels.js +47 -0
  828. package/lib/utils/hasLabels.js.map +1 -0
  829. package/lib/utils/hasLabels.mjs +39 -0
  830. package/lib/utils/hasLabels.mjs.map +1 -0
  831. package/lib/utils/hasParent.d.ts +1 -0
  832. package/lib/utils/hasParent.js +14 -0
  833. package/lib/utils/hasParent.js.map +1 -0
  834. package/lib/utils/hasParent.mjs +7 -0
  835. package/lib/utils/hasParent.mjs.map +1 -0
  836. package/lib/utils/if.d.ts +11 -0
  837. package/lib/utils/if.js +16 -0
  838. package/lib/utils/if.js.map +1 -0
  839. package/lib/utils/if.mjs +9 -0
  840. package/lib/utils/if.mjs.map +1 -0
  841. package/lib/utils/ifChildren.d.ts +8 -0
  842. package/lib/utils/ifChildren.js +17 -0
  843. package/lib/utils/ifChildren.js.map +1 -0
  844. package/lib/utils/ifChildren.mjs +10 -0
  845. package/lib/utils/ifChildren.mjs.map +1 -0
  846. package/lib/utils/injectStyle.d.ts +2 -0
  847. package/lib/utils/injectStyle.js +49 -0
  848. package/lib/utils/injectStyle.js.map +1 -0
  849. package/lib/utils/injectStyle.mjs +41 -0
  850. package/lib/utils/injectStyle.mjs.map +1 -0
  851. package/lib/utils/inputProps.d.ts +2 -0
  852. package/lib/utils/inputProps.js +22 -0
  853. package/lib/utils/inputProps.js.map +1 -0
  854. package/lib/utils/inputProps.mjs +14 -0
  855. package/lib/utils/inputProps.mjs.map +1 -0
  856. package/lib/utils/isNode.d.ts +1 -0
  857. package/lib/utils/isNode.js +28 -0
  858. package/lib/utils/isNode.js.map +1 -0
  859. package/lib/utils/isNode.mjs +21 -0
  860. package/lib/utils/isNode.mjs.map +1 -0
  861. package/lib/utils/isPromise.d.ts +1 -0
  862. package/lib/utils/isPromise.js +10 -0
  863. package/lib/utils/isPromise.js.map +1 -0
  864. package/lib/utils/isPromise.mjs +4 -0
  865. package/lib/utils/isPromise.mjs.map +1 -0
  866. package/lib/utils/isRetina.d.ts +1 -0
  867. package/lib/utils/isRetina.js +15 -0
  868. package/lib/utils/isRetina.js.map +1 -0
  869. package/lib/utils/isRetina.mjs +9 -0
  870. package/lib/utils/isRetina.mjs.map +1 -0
  871. package/lib/utils/logger.d.ts +9 -0
  872. package/lib/utils/logger.js +40 -0
  873. package/lib/utils/logger.js.map +1 -0
  874. package/lib/utils/logger.mjs +32 -0
  875. package/lib/utils/logger.mjs.map +1 -0
  876. package/lib/utils/numericChecker.d.ts +5 -0
  877. package/lib/utils/numericChecker.js +33 -0
  878. package/lib/utils/numericChecker.js.map +1 -0
  879. package/lib/utils/numericChecker.mjs +27 -0
  880. package/lib/utils/numericChecker.mjs.map +1 -0
  881. package/lib/utils/ownerDocument.d.ts +1 -0
  882. package/lib/utils/ownerDocument.js +10 -0
  883. package/lib/utils/ownerDocument.js.map +1 -0
  884. package/lib/utils/ownerDocument.mjs +4 -0
  885. package/lib/utils/ownerDocument.mjs.map +1 -0
  886. package/lib/utils/pick.d.ts +1 -0
  887. package/lib/utils/pick.js +19 -0
  888. package/lib/utils/pick.js.map +1 -0
  889. package/lib/utils/pick.mjs +13 -0
  890. package/lib/utils/pick.mjs.map +1 -0
  891. package/lib/utils/propsForElement.d.ts +3 -0
  892. package/lib/utils/propsForElement.js +59 -0
  893. package/lib/utils/propsForElement.js.map +1 -0
  894. package/lib/utils/propsForElement.mjs +50 -0
  895. package/lib/utils/propsForElement.mjs.map +1 -0
  896. package/lib/utils/rafTrottle.d.ts +2 -0
  897. package/lib/utils/rafTrottle.js +33 -0
  898. package/lib/utils/rafTrottle.js.map +1 -0
  899. package/lib/utils/rafTrottle.mjs +26 -0
  900. package/lib/utils/rafTrottle.mjs.map +1 -0
  901. package/lib/utils/reactToText.d.ts +3 -0
  902. package/lib/utils/reactToText.js +33 -0
  903. package/lib/utils/reactToText.js.map +1 -0
  904. package/lib/utils/reactToText.mjs +26 -0
  905. package/lib/utils/reactToText.mjs.map +1 -0
  906. package/lib/utils/ref.d.ts +8 -0
  907. package/lib/utils/ref.js +95 -0
  908. package/lib/utils/ref.js.map +1 -0
  909. package/lib/utils/ref.mjs +83 -0
  910. package/lib/utils/ref.mjs.map +1 -0
  911. package/lib/utils/setRef.d.ts +2 -0
  912. package/lib/utils/setRef.js +10 -0
  913. package/lib/utils/setRef.js.map +1 -0
  914. package/lib/utils/setRef.mjs +3 -0
  915. package/lib/utils/setRef.mjs.map +1 -0
  916. package/lib/utils/syncScroll.d.ts +1 -0
  917. package/lib/utils/syncScroll.js +61 -0
  918. package/lib/utils/syncScroll.js.map +1 -0
  919. package/lib/utils/syncScroll.mjs +54 -0
  920. package/lib/utils/syncScroll.mjs.map +1 -0
  921. package/lib/utils/uncontroll.d.ts +4 -0
  922. package/lib/utils/uncontroll.js +47 -0
  923. package/lib/utils/uncontroll.js.map +1 -0
  924. package/lib/utils/uncontroll.mjs +38 -0
  925. package/lib/utils/uncontroll.mjs.map +1 -0
  926. package/lib/utils/uniqueID.d.ts +12 -0
  927. package/lib/utils/uniqueID.js +42 -0
  928. package/lib/utils/uniqueID.js.map +1 -0
  929. package/lib/utils/uniqueID.mjs +33 -0
  930. package/lib/utils/uniqueID.mjs.map +1 -0
  931. package/lib/utils/use/useColorResolver.d.ts +1 -0
  932. package/lib/utils/use/useColorResolver.js +208 -0
  933. package/lib/utils/use/useColorResolver.js.map +1 -0
  934. package/lib/utils/use/useColorResolver.mjs +200 -0
  935. package/lib/utils/use/useColorResolver.mjs.map +1 -0
  936. package/lib/utils/use/useCss.d.ts +4 -0
  937. package/lib/utils/use/useCss.js +20 -0
  938. package/lib/utils/use/useCss.js.map +1 -0
  939. package/lib/utils/use/useCss.mjs +12 -0
  940. package/lib/utils/use/useCss.mjs.map +1 -0
  941. package/lib/utils/use/useEnhancedEffect.d.ts +3 -0
  942. package/lib/utils/use/useEnhancedEffect.js +13 -0
  943. package/lib/utils/use/useEnhancedEffect.js.map +1 -0
  944. package/lib/utils/use/useEnhancedEffect.mjs +5 -0
  945. package/lib/utils/use/useEnhancedEffect.mjs.map +1 -0
  946. package/lib/utils/use/useEventCallback.d.ts +4 -0
  947. package/lib/utils/use/useEventCallback.js +25 -0
  948. package/lib/utils/use/useEventCallback.js.map +1 -0
  949. package/lib/utils/use/useEventCallback.mjs +19 -0
  950. package/lib/utils/use/useEventCallback.mjs.map +1 -0
  951. package/lib/utils/use/useEventListener.d.ts +2 -0
  952. package/lib/utils/use/useEventListener.js +33 -0
  953. package/lib/utils/use/useEventListener.js.map +1 -0
  954. package/lib/utils/use/useEventListener.mjs +25 -0
  955. package/lib/utils/use/useEventListener.mjs.map +1 -0
  956. package/lib/utils/use/useFocusLock.d.ts +10 -0
  957. package/lib/utils/use/useFocusLock.js +289 -0
  958. package/lib/utils/use/useFocusLock.js.map +1 -0
  959. package/lib/utils/use/useFocusLock.mjs +266 -0
  960. package/lib/utils/use/useFocusLock.mjs.map +1 -0
  961. package/lib/utils/use/usePreventScroll.d.ts +2 -0
  962. package/lib/utils/use/usePreventScroll.js +78 -0
  963. package/lib/utils/use/usePreventScroll.js.map +1 -0
  964. package/lib/utils/use/usePreventScroll.mjs +70 -0
  965. package/lib/utils/use/usePreventScroll.mjs.map +1 -0
  966. package/lib/utils/useCssVariable.d.ts +8 -0
  967. package/lib/utils/useCssVariable.js +55 -0
  968. package/lib/utils/useCssVariable.js.map +1 -0
  969. package/lib/utils/useCssVariable.mjs +46 -0
  970. package/lib/utils/useCssVariable.mjs.map +1 -0
  971. package/lib/utils/zIndexStacking.d.ts +8 -0
  972. package/lib/utils/zIndexStacking.js +48 -0
  973. package/lib/utils/zIndexStacking.js.map +1 -0
  974. package/lib/utils/zIndexStacking.mjs +38 -0
  975. package/lib/utils/zIndexStacking.mjs.map +1 -0
  976. package/package.json +270 -7
  977. package/tsconfig-utils.json +4 -0
  978. package/lib/esm/index.mjs +0 -6
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WithCSS.js","names":["React","PureComponent","createHoc","CSSinJS","getStylesheet","raw","normaliseCss","obj","Object","keys","reduce","acc","key","result","undefined","WithCssContext","createContext","Provider","initNanoCss","options","arguments","length","EnhancedWithCSS","_PureComponent","_inherits","_super","_createSuper","props","context","_this","_classCallCheck","call","_defineProperty","_assertThisInitialized","dynamicClassName","_createClass","value","render","_this$props","children","_this$props$className","className","state","getDerivedStateFromProps","_CSSinJS$cache","_CSSinJS","cleanCss","css","cache"],"sources":["../../../../src/utils/enhances/WithCSS.tsx"],"sourcesContent":["import React, { PureComponent } from 'react';\nimport { NanoOptions } from '@phytonmk/nano-css';\nimport { CssLikeObject } from '@phytonmk/nano-css/types/common';\nimport createHoc from '../createHoc';\nimport CSSinJS from '../CSSinJS';\nimport { UnknownProperties } from '../../core-types/UnknownProperties';\n\nconst getStylesheet = () => CSSinJS().raw;\n\n/**\n * Function to clear the nano CSS styles object from keys with undefined value\n * @param {Object} obj - nano CSS styles object\n * @returns {Object}\n */\nfunction normaliseCss(obj: CssLikeObject) {\n return Object.keys(obj).reduce((acc: any, key) => {\n const result = acc;\n if (obj[key] !== undefined) {\n result[key] = obj[key];\n }\n return result;\n }, {});\n}\n\nconst WithCssContext = React.createContext<NanoOptions>({});\nconst { Provider } = WithCssContext;\n\nfunction initNanoCss(options: NanoOptions = {}) {\n return CSSinJS(options);\n}\n\n/** @deprecated */\nexport interface IEnhancedWithCSSProps extends EnhancedWithCSSProps, UnknownProperties {}\nexport type EnhancedWithCSSProps = {\n className?: string;\n css?: {};\n\n children(props: { className: string | undefined }): React.ReactNode;\n};\n\nclass EnhancedWithCSS extends PureComponent<IEnhancedWithCSSProps> {\n static contextType = WithCssContext;\n\n static defaultProps = {\n css: {},\n };\n\n state = {\n dynamicClassName: '',\n };\n\n static getDerivedStateFromProps(props: any) {\n const cleanCss = normaliseCss(props.css);\n return {\n dynamicClassName: Object.keys(cleanCss).length ? CSSinJS().cache?.(cleanCss) : '',\n };\n }\n\n constructor(props: any, context: any) {\n super(props, context);\n\n initNanoCss(context);\n }\n\n render() {\n const { children, className = '' } = this.props;\n const { dynamicClassName } = this.state;\n return children({\n className: className + dynamicClassName || undefined,\n });\n }\n}\n\nexport { getStylesheet, EnhancedWithCSS, Provider, WithCssContext, initNanoCss, normaliseCss };\nexport default createHoc(EnhancedWithCSS);\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,IAAIC,aAAa,QAAQ,OAAO;AAG5C,OAAOC,SAAS,MAAM,cAAc;AACpC,OAAOC,OAAO,MAAM,YAAY;AAGhC,IAAMC,aAAa,GAAG,SAAhBA,aAAaA,CAAA;EAAA,OAASD,OAAO,EAAE,CAACE,GAAG;AAAA;;AAEzC;AACA;AACA;AACA;AACA;AACA,SAASC,YAAYA,CAACC,GAAkB,EAAE;EACxC,OAAOC,MAAM,CAACC,IAAI,CAACF,GAAG,CAAC,CAACG,MAAM,CAAC,UAACC,GAAQ,EAAEC,GAAG,EAAK;IAChD,IAAMC,MAAM,GAAGF,GAAG;IAClB,IAAIJ,GAAG,CAACK,GAAG,CAAC,KAAKE,SAAS,EAAE;MAC1BD,MAAM,CAACD,GAAG,CAAC,GAAGL,GAAG,CAACK,GAAG,CAAC;IACxB;IACA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AAwB,KAAA,EAnBD,SAAAO,yBAAgChB,KAAU,EAAE;MAAA,IAAAiB,cAAA,EAAAC,QAAA;MAC1C,IAAMC,QAAQ,GAAGxC,YAAY,CAACqB,KAAK,CAACoB,GAAG,CAAC;MACxC,OAAO;QACLb,gBAAgB,EAAE1B,MAAM,CAACC,IAAI,CAACqC,QAAQ,CAAC,CAACzB,MAAM,IAAAuB,cAAA,GAAG,CAAAC,QAAA,GAAA1C,OAAO,EAAE,EAAC6C,KAAK,cAAAJ,cAAA,uBAAfA,cAAA,CAAAb,IAAA,CAAAc,QAAA,EAAkBC,QAAQ,CAAC,GAAG;MACjF,CAAC;IACH;EAAC;EAAA,OAAAxB,eAAA;AAAA,EAhB2BrB,aAAa;AAAA+B,eAAA,CAArCV,eAAe,iBACEP,cAAc;AAAAiB,eAAA,CAD/BV,eAAe,kBAGG;EACpByB,GAAG,EAAE,CAAC;AACR,CAAC;AA4BH,SAAS3C,aAAa,EAAEkB,eAAe,EAAEL,QAAQ,EAAEF,cAAc,EAAEG,WAAW,EAAEZ,YAAY;AAC5F,eAAeJ,SAAS,CAACoB,eAAe,CAAC"}
@@ -0,0 +1,83 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/createClass";
3
+ import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
4
+ import _inherits from "@babel/runtime/helpers/inherits";
5
+ import _createSuper from "@babel/runtime/helpers/createSuper";
6
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
7
+ import React, { Component, createContext } from 'react';
8
+ import createHoc from '../createHoc';
9
+ import { useAsyncI18nMessages } from './i18nEnhance';
10
+ import { createIntl, createIntlCache } from '@formatjs/intl';
11
+ export var Context = /*#__PURE__*/createContext(undefined);
12
+ var I18nProvider = Context.Provider,
13
+ I18nConsumer = Context.Consumer;
14
+ var messagesCache = createIntlCache();
15
+ function getText(dictionaries, locale) {
16
+ return function (key) {
17
+ var dictionary = dictionaries[locale];
18
+ return dictionary ? dictionary[key] : dictionaries['en'][key];
19
+ };
20
+ }
21
+
22
+ /** @deprecated */
23
+ /**
24
+ * @deprecated use `useI18n` instead
25
+ */
26
+ var WithI18n = /*#__PURE__*/function (_Component) {
27
+ _inherits(WithI18n, _Component);
28
+ var _super = _createSuper(WithI18n);
29
+ function WithI18n() {
30
+ var _this;
31
+ _classCallCheck(this, WithI18n);
32
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
33
+ args[_key] = arguments[_key];
34
+ }
35
+ _this = _super.call.apply(_super, [this].concat(args));
36
+ /* @ts-ignore */
37
+ _defineProperty(_assertThisInitialized(_this), "context", void 0);
38
+ _defineProperty(_assertThisInitialized(_this), "getText", function (dictionary, selfLocale) {
39
+ var _this$props = _this.props,
40
+ locale = _this$props.locale,
41
+ getText = _this$props.getText;
42
+ var contextLocale = _this.context;
43
+ return getText(dictionary, selfLocale || locale || contextLocale);
44
+ });
45
+ return _this;
46
+ }
47
+ _createClass(WithI18n, [{
48
+ key: "render",
49
+ value: function render() {
50
+ var _ref = this.props,
51
+ children = _ref.children;
52
+ return children({
53
+ getText: this.getText
54
+ });
55
+ }
56
+ }]);
57
+ return WithI18n;
58
+ }(Component);
59
+ _defineProperty(WithI18n, "contextType", Context);
60
+ _defineProperty(WithI18n, "defaultProps", {
61
+ getText: getText
62
+ });
63
+ var useI18n = function useI18n(dictionary) {
64
+ var _React$useContext;
65
+ var locale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'en';
66
+ var fallbackDictionary = arguments.length > 2 ? arguments[2] : undefined;
67
+ var lang = (_React$useContext = React.useContext(Context)) !== null && _React$useContext !== void 0 ? _React$useContext : locale;
68
+ var resolvedDictionary = useAsyncI18nMessages(dictionary, lang, fallbackDictionary);
69
+ var intl = React.useMemo(function () {
70
+ return createIntl({
71
+ locale: lang,
72
+ messages: resolvedDictionary
73
+ }, messagesCache);
74
+ }, [resolvedDictionary, lang]);
75
+ return React.useCallback(function (messageId, variables) {
76
+ return intl.formatMessage({
77
+ id: messageId !== null && messageId !== void 0 ? messageId : ''
78
+ }, variables);
79
+ }, [intl]);
80
+ };
81
+ export default createHoc(WithI18n);
82
+ export { useI18n, I18nProvider, I18nConsumer };
83
+ //# sourceMappingURL=WithI18n.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WithI18n.js","names":["React","Component","createContext","createHoc","useAsyncI18nMessages","createIntl","createIntlCache","Context","undefined","I18nProvider","Provider","I18nConsumer","Consumer","messagesCache","getText","dictionaries","locale","key","dictionary","WithI18n","_Component","_inherits","_super","_createSuper","_this","_classCallCheck","_len","arguments","length","args","Array","_key","call","apply","concat","_defineProperty","_assertThisInitialized","selfLocale","_this$props","props","contextLocale","context","_createClass","value","render","_ref","children","useI18n","_React$useContext","fallbackDictionary","lang","useContext","resolvedDictionary","intl","useMemo","messages","useCallback","messageId","variables","formatMessage","id"],"sources":["../../../../src/utils/enhances/WithI18n.tsx"],"sourcesContent":["import React, { Component, createContext } from 'react';\nimport createHoc from '../createHoc';\nimport { useAsyncI18nMessages } from './i18nEnhance';\nimport { UnknownProperties } from '../../core-types/UnknownProperties';\nimport { createIntl, createIntlCache } from '@formatjs/intl';\n\nexport type LocaleKeys = string;\nexport type DictionaryItem = { [key: string]: string };\nexport type Dictionary = { [locale: string]: DictionaryItem | (() => Promise<DictionaryItem>) };\nexport const Context = createContext<LocaleKeys | undefined>(undefined);\nconst { Provider: I18nProvider, Consumer: I18nConsumer } = Context;\nconst messagesCache = createIntlCache();\n\nfunction getText(dictionaries: Dictionary, locale: LocaleKeys) {\n return function (key: keyof DictionaryItem) {\n const dictionary = dictionaries[locale];\n return dictionary ? (dictionary as any)[key] : (dictionaries as any)['en'][key];\n };\n}\n\n/** @deprecated */\nexport interface IWithI18nInjectedProps extends WithI18nInjectedProps, UnknownProperties {}\nexport type WithI18nInjectedProps = {\n getText: WithI18n['getText'];\n};\n\n/** @deprecated */\nexport interface IWithI18nProps extends WithI18nProps, UnknownProperties {}\nexport type WithI18nProps = WithI18nInjectedProps & {\n locale?: LocaleKeys;\n\n children?(props: IWithI18nInjectedProps): React.ReactNode;\n};\n\n/**\n * @deprecated use `useI18n` instead\n */\nclass WithI18n extends Component<IWithI18nProps> {\n /* @ts-ignore */\n context: LocaleKeys;\n\n static contextType = Context;\n static defaultProps = {\n getText,\n };\n\n getText = (dictionary: Dictionary, selfLocale?: string): string => {\n const { locale, getText } = this.props;\n const contextLocale = this.context;\n return getText(dictionary, selfLocale || locale || contextLocale);\n };\n\n render() {\n const { children } = this.props as any;\n return children({\n getText: this.getText,\n });\n }\n}\n\nconst useI18n = (\n dictionary: Dictionary,\n locale: LocaleKeys = 'en',\n fallbackDictionary?: Dictionary,\n) => {\n const lang = React.useContext(Context) ?? locale;\n const resolvedDictionary = useAsyncI18nMessages(dictionary, lang, fallbackDictionary);\n const intl = React.useMemo(\n () => createIntl({ locale: lang, messages: resolvedDictionary }, messagesCache),\n [resolvedDictionary, lang],\n );\n\n return React.useCallback(\n (messageId: string, variables?: { [key: string]: string | number | undefined }) => {\n return intl.formatMessage({ id: messageId ?? '' }, variables);\n },\n [intl],\n );\n};\n\nexport default createHoc(WithI18n);\nexport { useI18n, I18nProvider, I18nConsumer };\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,aAAa,QAAQ,OAAO;AACvD,OAAOC,SAAS,MAAM,cAAc;AACpC,SAASC,oBAAoB,QAAQ,eAAe;AAEpD,SAASC,UAAU,EAAEC,eAAe,QAAQ,gBAAgB;AAK5D,OAAO,IAAMC,OAAO,gBAAGL,aAAa,CAAyBM,SAAS,CAAC;AACvE,IAAkBC,YAAY,GAA6BF,OAAO,CAA1DG,QAAQ;EAA0BC,YAAY,GAAKJ,OAAO,CAAlCK,QAAQ;AACxC,IAAMC,aAAa,GAAGP,eAAe,EAAE;AAEvC,SAASQ,OAAOA,CAACC,YAAwB,EAAEC,MAAkB,EAAE;EAC7D,OAAO,UAAUC,GAAyB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AAC;AAED,eAAelD,SAAS,CAACgB,QAAQ,CAAC;AAClC,SAAS4B,OAAO,EAAEtC,YAAY,EAAEE,YAAY"}
@@ -0,0 +1,84 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/createClass";
3
+ import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
4
+ import _inherits from "@babel/runtime/helpers/inherits";
5
+ import _createSuper from "@babel/runtime/helpers/createSuper";
6
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
7
+ import { PureComponent } from 'react';
8
+ import createHoc from '../createHoc';
9
+ import { internalSetState } from '../uncontroll';
10
+ import fire from '../fire';
11
+ var usingKeyBoard = true;
12
+ export var EnhancedWithKeyboardFocus = /*#__PURE__*/function (_PureComponent) {
13
+ _inherits(EnhancedWithKeyboardFocus, _PureComponent);
14
+ var _super = _createSuper(EnhancedWithKeyboardFocus);
15
+ function EnhancedWithKeyboardFocus() {
16
+ var _this;
17
+ _classCallCheck(this, EnhancedWithKeyboardFocus);
18
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
19
+ args[_key] = arguments[_key];
20
+ }
21
+ _this = _super.call.apply(_super, [this].concat(args));
22
+ _defineProperty(_assertThisInitialized(_this), "state", {
23
+ keyboardFocused: false
24
+ });
25
+ _defineProperty(_assertThisInitialized(_this), "handlerFocus", function (e) {
26
+ fire(_assertThisInitialized(_this), 'onFocus', e);
27
+ if (usingKeyBoard) {
28
+ internalSetState(_assertThisInitialized(_this), {
29
+ keyboardFocused: true
30
+ });
31
+ }
32
+ });
33
+ _defineProperty(_assertThisInitialized(_this), "handlerBlur", function (e) {
34
+ fire(_assertThisInitialized(_this), 'onBlur', e);
35
+ internalSetState(_assertThisInitialized(_this), {
36
+ keyboardFocused: false
37
+ });
38
+ });
39
+ _defineProperty(_assertThisInitialized(_this), "handlerKeyDown", function (e) {
40
+ fire(_assertThisInitialized(_this), 'onKeyDown', e);
41
+ usingKeyBoard = true;
42
+ });
43
+ _defineProperty(_assertThisInitialized(_this), "handlerMouseDown", function (e) {
44
+ fire(_assertThisInitialized(_this), 'onMouseDown', e);
45
+ usingKeyBoard = false;
46
+ });
47
+ return _this;
48
+ }
49
+ _createClass(EnhancedWithKeyboardFocus, [{
50
+ key: "render",
51
+ value: function render() {
52
+ var _this$props = this.props,
53
+ children = _this$props.children,
54
+ tabIndex = _this$props.tabIndex,
55
+ disabled = _this$props.disabled;
56
+ var keyboardFocused = this.state.keyboardFocused;
57
+ return children({
58
+ tabIndex: disabled ? -1 : tabIndex,
59
+ keyboardFocused: keyboardFocused,
60
+ onFocus: this.handlerFocus,
61
+ onBlur: this.handlerBlur,
62
+ onKeyDown: this.handlerKeyDown,
63
+ onMouseDown: this.handlerMouseDown
64
+ });
65
+ }
66
+ }], [{
67
+ key: "getDerivedStateFromProps",
68
+ value: function getDerivedStateFromProps(props, state) {
69
+ if (props.keyboardFocused !== undefined) {
70
+ return {
71
+ keyboardFocused: props.keyboardFocused
72
+ };
73
+ }
74
+ return state;
75
+ }
76
+ }]);
77
+ return EnhancedWithKeyboardFocus;
78
+ }(PureComponent);
79
+ _defineProperty(EnhancedWithKeyboardFocus, "displayName", 'EnhancedWithKeyboardFocus');
80
+ _defineProperty(EnhancedWithKeyboardFocus, "defaultProps", {
81
+ tabIndex: 0
82
+ });
83
+ export default createHoc(EnhancedWithKeyboardFocus);
84
+ //# sourceMappingURL=WithKeyboardFocus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WithKeyboardFocus.js","names":["PureComponent","createHoc","internalSetState","fire","usingKeyBoard","EnhancedWithKeyboardFocus","_PureComponent","_inherits","_super","_createSuper","_this","_classCallCheck","_len","arguments","length","args","Array","_key","call","apply","concat","_defineProperty","_assertThisInitialized","keyboardFocused","e","_createClass","key","value","render","_this$props","props","children","tabIndex","disabled","state","onFocus","handlerFocus","onBlur","handlerBlur","onKeyDown","handlerKeyDown","onMouseDown","handlerMouseDown","getDerivedStateFromProps","undefined"],"sources":["../../../../src/utils/enhances/WithKeyboardFocus.tsx"],"sourcesContent":["import React, { PureComponent } from 'react';\nimport createHoc from '../createHoc';\nimport { internalSetState } from '../uncontroll';\nimport fire from '../fire';\nimport { UnknownProperties } from '../../core-types/UnknownProperties';\n\n/** @deprecated */\nexport interface IEnhancedWithKeyboardFocusInjectedProps\n extends EnhancedWithKeyboardFocusInjectedProps {}\nexport type EnhancedWithKeyboardFocusInjectedProps = {\n tabIndex: number;\n keyboardFocused: boolean;\n\n onFocus(e: FocusEvent): void;\n\n onBlur(e: FocusEvent): void;\n\n onKeyDown(e: KeyboardEvent): void;\n\n onMouseDown(e: MouseEvent): void;\n};\n\n/** @deprecated */\nexport interface IEnhancedWithKeyboardFocusProps\n extends EnhancedWithKeyboardFocusProps,\n UnknownProperties {}\nexport type EnhancedWithKeyboardFocusProps = {\n keyboardFocused?: boolean;\n tabIndex?: number;\n disabled?: boolean;\n\n children(props: IEnhancedWithKeyboardFocusInjectedProps): React.ReactNode;\n};\n\n/** @deprecated */\nexport interface IEnhancedWithKeyboardFocusState\n extends EnhancedWithKeyboardFocusState,\n UnknownProperties {}\nexport type EnhancedWithKeyboardFocusState = {\n keyboardFocused: boolean;\n};\n\nlet usingKeyBoard = true;\n\nexport class EnhancedWithKeyboardFocus extends PureComponent<\n IEnhancedWithKeyboardFocusProps,\n IEnhancedWithKeyboardFocusState\n> {\n static displayName = 'EnhancedWithKeyboardFocus';\n\n static defaultProps = {\n tabIndex: 0,\n };\n\n static getDerivedStateFromProps(props: any, state: any) {\n if (props.keyboardFocused !== undefined) {\n return {\n keyboardFocused: props.keyboardFocused,\n };\n }\n return state;\n }\n\n state = {\n keyboardFocused: false,\n };\n\n handlerFocus = (e: FocusEvent) => {\n fire(this, 'onFocus', e);\n if (usingKeyBoard) {\n internalSetState(this, { keyboardFocused: true });\n }\n };\n\n handlerBlur = (e: FocusEvent) => {\n fire(this, 'onBlur', e);\n internalSetState(this, { keyboardFocused: false });\n };\n\n handlerKeyDown = (e: KeyboardEvent) => {\n fire(this, 'onKeyDown', e);\n usingKeyBoard = true;\n };\n\n handlerMouseDown = (e: MouseEvent) => {\n fire(this, 'onMouseDown', e);\n usingKeyBoard = false;\n };\n\n render() {\n const { children, tabIndex, disabled } = this.props;\n const { keyboardFocused } = this.state;\n return children({\n tabIndex: disabled ? -1 : tabIndex!,\n keyboardFocused,\n onFocus: this.handlerFocus,\n onBlur: this.handlerBlur,\n onKeyDown: this.handlerKeyDown,\n onMouseDown: this.handlerMouseDown,\n });\n }\n}\n\nexport default createHoc(EnhancedWithKeyboardFocus);\n"],"mappings":";;;;;;AAAA,SAAgBA,aAAa,QAAQ,OAAO;AAC5C,OAAOC,SAAS,MAAM,cAAc;AACpC,SAASC,gBAAgB,QAAQ,eAAe;AAChD,OAAOC,IAAI,MAAM,SAAS;AAuC1B,IAAIC,aAAa,GAAG,IAAI;AAExB,WAAaC,yBAAyB,0BAAAC,cAAA;EAAAC,SAAA,CAAAF,yBAAA,EAAAC,cAAA;EAAA,IAAAE,MAAA,GAAAC,YAAA,CAAAJ,yBAAA;EAAA,SAAAA,0BAAA;IAAA,IAAAK,KAAA;IAAAC,eAAA,OAAAN,yBAAA;IAAA,SAAAO,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAC,IAAA,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;MAAAF,IAAA,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;IAAA;IAAAP,KAAA,GAAAF,MAAA,CAAAU,IAAA,CAAAC,KAAA,CAAAX,MAAA,SAAAY,MAAA,CAAAL,IAAA;IAAAM,eAAA,CAAAC,sBAAA,CAAAZ,KAAA,YAmB5B;MACNa,eAAe,EAAE;IACnB,CAAC;IAAAF,eAAA,CAAAC,sBAAA,CAAAZ,KAAA,mBAEc,UAACc,CAAa,EAAK;MAChCrB,IAAI,CAAAmB,sBAAA,CAAAZ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;QACfY,OAAO,EAAE,IAAI,CAACC,YAAY;QAC1BC,MAAM,EAAE,IAAI,CAACC,WAAW;QACxBC,SAAS,EAAE,IAAI,CAACC,cAAc;QAC9BC,WAAW,EAAE,IAAI,CAACC;MACpB,CAAC,CAAC;IACJ;EAAC;IAAAhB,GAAA;IAAAC,KAAA,EA9CD,SAAAgB,yBAAgCb,KAAU,EAAEI,KAAU,EAAE;MACtD,IAAIJ,KAAK,CAACP,eAAe,KAAKqB,SAAS,EAAE;QACvC,OAAO;UACLrB,eAAe,EAAEO,KAAK,CAACP;QACzB,CAAC;MACH;MACA,OAAOW,KAAK;IACd;EAAC;EAAA,OAAA7B,yBAAA;AAAA,EAjB4CL,aAAa;AAyD3DqB,eAAA,CAzDYhB,yBAAyB,iBAIf,2BAA2B;AAAAgB,eAAA,CAJrChB,yBAAyB,kBAMd;EACpB2B,QAAQ,EAAE;AACZ,CAAC;AAmDH,eAAe/B,SAAS,CAACI,yBAAyB,CAAC"}
@@ -0,0 +1,18 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React from 'react';
3
+ import getDisplayName from '../getDisplayName';
4
+ import hoistNonReactStatics from 'hoist-non-react-statics';
5
+ function WithForwardRef() {
6
+ return function ForwardRef(Component) {
7
+ var Wrapped = /*#__PURE__*/React.forwardRef(function (props, ref) {
8
+ // @ts-ignore
9
+ return /*#__PURE__*/React.createElement(Component, _extends({}, Component.defaultProps || {}, props, {
10
+ forwardedRef: ref
11
+ }));
12
+ });
13
+ Wrapped.displayName = getDisplayName(Component);
14
+ return hoistNonReactStatics(Wrapped, Component);
15
+ };
16
+ }
17
+ export default WithForwardRef;
18
+ //# sourceMappingURL=WithRef.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WithRef.js","names":["React","getDisplayName","hoistNonReactStatics","WithForwardRef","ForwardRef","Component","Wrapped","forwardRef","props","ref","createElement","_extends","defaultProps","forwardedRef","displayName"],"sources":["../../../../src/utils/enhances/WithRef.tsx"],"sourcesContent":["import React from 'react';\nimport getDisplayName from '../getDisplayName';\nimport hoistNonReactStatics from 'hoist-non-react-statics';\n\nfunction WithForwardRef() {\n return function ForwardRef<T extends React.ComponentType>(Component: T) {\n const Wrapped = React.forwardRef((props, ref) => {\n // @ts-ignore\n return <Component {...(Component.defaultProps || {})} {...props} forwardedRef={ref} />;\n });\n Wrapped.displayName = getDisplayName(Component);\n return hoistNonReactStatics(Wrapped, Component) as any;\n };\n}\n\nexport default WithForwardRef;\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,cAAc,MAAM,mBAAmB;AAC9C,OAAOC,oBAAoB,MAAM,yBAAyB;AAE1D,SAASC,cAAcA,CAAA,EAAG;EACxB,OAAO,SAASC,UAAUA,CAAgCC,SAAY,EAAE;IACtE,IAAMC,OAAO,gBAAGN,KAAK,CAACO,UAAU,CAAC,UAACC,KAAK,EAAEC,GAAG,EAAK;MAC/C;MACA,oBAAOT,KAAA,CAAAU,aAAA,CAACL,SAAS,EAAAM,QAAA,KAAMN,SAAS,CAACO,YAAY,IAAI,CAAC,CAAC,EAAOJ,KAAK;QAAEK,YAAY,EAAEJ;MAAI,GAAG;IACxF,CAAC,CAAC;IACFH,OAAO,CAACQ,WAAW,GAAGb,cAAc,CAACI,SAAS,CAAC;IAC/C,OAAOH,oBAAoB,CAACI,OAAO,EAAED,SAAS,CAAC;EACjD,CAAC;AACH;AAEA,eAAeF,cAAc"}
@@ -0,0 +1,66 @@
1
+ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
+ import { callAllEventHandlers } from '../assignProps';
4
+ var defaultOnNeighborChange = function defaultOnNeighborChange(neighborElement) {
5
+ neighborElement === null || neighborElement === void 0 ? void 0 : neighborElement.focus();
6
+ };
7
+ var defaultFindNeighbor = function defaultFindNeighbor(listSelectors, element, direction) {
8
+ var elementSibling = ['right', 'top'].includes(direction) ? 1 : -1;
9
+ var indexElement = listSelectors.findIndex(function (node) {
10
+ return node === element;
11
+ });
12
+ var lengthList = listSelectors.length;
13
+ var lastIndex = lengthList - 1;
14
+ var indexNext = indexElement + elementSibling;
15
+ if (indexNext < 0) indexNext = lastIndex;
16
+ if (indexNext > lastIndex) indexNext = 0;
17
+ return listSelectors[indexNext];
18
+ };
19
+ var a11yEnhance = function a11yEnhance(options) {
20
+ var findNeighbor = options.findNeighbor || defaultFindNeighbor;
21
+ var onNeighborChange = options.onNeighborChange || defaultOnNeighborChange;
22
+ var childSelector = options.childSelector;
23
+ return function (props) {
24
+ if (!childSelector) throw "parameter childSelector not passed in options for a11yEnhance for ".concat(props['data-ui-name']);
25
+ var getNeighbor = function getNeighbor(listSelectors, element, direction) {
26
+ var neighbor = findNeighbor(listSelectors, element, direction);
27
+ if (!neighbor) return element;
28
+ if ('disabled' in neighbor && neighbor.disabled) return getNeighbor(listSelectors, neighbor, direction);
29
+ return neighbor;
30
+ };
31
+ var handleKeyDown = function handleKeyDown(event) {
32
+ var parent = event.currentTarget;
33
+ var selectedElement = event.target;
34
+ var _ref = typeof childSelector === 'function' ? childSelector(props) : childSelector,
35
+ _ref2 = _slicedToArray(_ref, 2),
36
+ childAttrName = _ref2[0],
37
+ childAttrValue = _ref2[1];
38
+ if (!selectedElement.getAttribute(childAttrName)) return;
39
+ var listSelectors = Array.from(parent.querySelectorAll("[".concat(childAttrName, "=\"").concat(childAttrValue, "\"]")));
40
+ if (!listSelectors.length) throw "no children found querySelectorAll([".concat(childAttrName, "=\"").concat(childAttrValue, "\"] a11yEnhance for ").concat(props['data-ui-name']);
41
+ switch (event.key) {
42
+ case 'ArrowLeft':
43
+ onNeighborChange(getNeighbor(listSelectors, selectedElement, 'left'), props);
44
+ event.preventDefault();
45
+ break;
46
+ case 'ArrowTop':
47
+ onNeighborChange(getNeighbor(listSelectors, selectedElement, 'top'), props);
48
+ event.preventDefault();
49
+ break;
50
+ case 'ArrowRight':
51
+ onNeighborChange(getNeighbor(listSelectors, selectedElement, 'right'), props);
52
+ event.preventDefault();
53
+ break;
54
+ case 'ArrowBottom':
55
+ onNeighborChange(getNeighbor(listSelectors, selectedElement, 'bottom'), props);
56
+ event.preventDefault();
57
+ break;
58
+ }
59
+ };
60
+ return _objectSpread(_objectSpread({}, props), {}, {
61
+ onKeyDown: callAllEventHandlers(props.onKeyDown, handleKeyDown)
62
+ });
63
+ };
64
+ };
65
+ export default a11yEnhance;
66
+ //# sourceMappingURL=a11yEnhance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"a11yEnhance.js","names":["callAllEventHandlers","defaultOnNeighborChange","neighborElement","focus","defaultFindNeighbor","listSelectors","element","direction","elementSibling","includes","indexElement","findIndex","node","lengthList","length","lastIndex","indexNext","a11yEnhance","options","findNeighbor","onNeighborChange","childSelector","props","concat","getNeighbor","neighbor","disabled","handleKeyDown","event","parent","currentTarget","selectedElement","target","_ref","_ref2","_slicedToArray","childAttrName","childAttrValue","getAttribute","Array","from","querySelectorAll","key","preventDefault","_objectSpread","onKeyDown"],"sources":["../../../../src/utils/enhances/a11yEnhance.tsx"],"sourcesContent":["import { callAllEventHandlers } from '../assignProps';\nimport React from 'react';\n\ntype OnNeighborChange<P> = (neighborElement: HTMLElement, props: P) => void;\ntype FindNeighbor = (\n listSelectors: HTMLElement[],\n element: HTMLElement,\n direction: string,\n) => HTMLElement | undefined;\ntype ChildSelector<P> = [string, string] | ((props: P) => [string, string]);\n\ntype A11yEnhanceOptions<P = any> = {\n findNeighbor?: FindNeighbor;\n onNeighborChange?: OnNeighborChange<P>;\n childSelector: ChildSelector<P>;\n};\n\nconst defaultOnNeighborChange: OnNeighborChange<any> = (neighborElement) => {\n neighborElement?.focus();\n};\n\nconst defaultFindNeighbor: FindNeighbor = (listSelectors, element, direction) => {\n const elementSibling = ['right', 'top'].includes(direction) ? 1 : -1;\n const indexElement = listSelectors.findIndex((node) => node === element);\n const lengthList = listSelectors.length;\n\n const lastIndex = lengthList - 1;\n let indexNext = indexElement + elementSibling;\n if (indexNext < 0) indexNext = lastIndex;\n if (indexNext > lastIndex) indexNext = 0;\n return listSelectors[indexNext];\n};\n\nconst a11yEnhance = (options: A11yEnhanceOptions) => {\n const findNeighbor = options.findNeighbor || defaultFindNeighbor;\n const onNeighborChange = options.onNeighborChange || defaultOnNeighborChange;\n const { childSelector } = options;\n\n return (props: any) => {\n if (!childSelector)\n throw `parameter childSelector not passed in options for a11yEnhance for ${props['data-ui-name']}`;\n const getNeighbor = (\n listSelectors: any,\n element: HTMLElement,\n direction: string,\n ): HTMLElement => {\n const neighbor = findNeighbor(listSelectors, element, direction);\n if (!neighbor) return element;\n if ('disabled' in neighbor && neighbor.disabled)\n return getNeighbor(listSelectors, neighbor, direction);\n return neighbor;\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLElement>) => {\n const parent = event.currentTarget;\n const selectedElement = event.target as HTMLElement;\n const [childAttrName, childAttrValue] =\n typeof childSelector === 'function' ? childSelector(props) : childSelector;\n if (!selectedElement.getAttribute(childAttrName)) return;\n\n const listSelectors = Array.from(\n parent.querySelectorAll(`[${childAttrName}=\"${childAttrValue}\"]`),\n );\n if (!listSelectors.length)\n throw `no children found querySelectorAll([${childAttrName}=\"${childAttrValue}\"] a11yEnhance for ${props['data-ui-name']}`;\n\n switch (event.key) {\n case 'ArrowLeft':\n onNeighborChange(getNeighbor(listSelectors, selectedElement, 'left'), props);\n event.preventDefault();\n break;\n case 'ArrowTop':\n onNeighborChange(getNeighbor(listSelectors, selectedElement, 'top'), props);\n event.preventDefault();\n break;\n case 'ArrowRight':\n onNeighborChange(getNeighbor(listSelectors, selectedElement, 'right'), props);\n event.preventDefault();\n break;\n case 'ArrowBottom':\n onNeighborChange(getNeighbor(listSelectors, selectedElement, 'bottom'), props);\n event.preventDefault();\n break;\n }\n };\n\n return {\n ...props,\n onKeyDown: callAllEventHandlers(props.onKeyDown, handleKeyDown),\n };\n };\n};\n\nexport default a11yEnhance;\n"],"mappings":";;AAAA,SAASA,oBAAoB,QAAQ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C3EM,KAAK,CAACe,cAAc,EAAE;UACtB;QACF,KAAK,YAAY;UACfvB,gBAAgB,CAACI,WAAW,CAACnB,aAAa,EAAE0B,eAAe,EAAE,OAAO,CAAC,EAAET,KAAK,CAAC;UAC7EM,KAAK,CAACe,cAAc,EAAE;UACtB;QACF,KAAK,aAAa;UAChBvB,gBAAgB,CAACI,WAAW,CAACnB,aAAa,EAAE0B,eAAe,EAAE,QAAQ,CAAC,EAAET,KAAK,CAAC;UAC9EM,KAAK,CAACe,cAAc,EAAE;UACtB;MAAM;IAEZ,CAAC;IAED,OAAAC,aAAA,CAAAA,aAAA,KACKtB,KAAK;MACRuB,SAAS,EAAE7C,oBAAoB,CAACsB,KAAK,CAACuB,SAAS,EAAElB,aAAa;IAAC;EAEnE,CAAC;AACH,CAAC;AAED,eAAeV,WAAW"}
@@ -0,0 +1,90 @@
1
+ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
2
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
3
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
+ var _excluded = ["ref", "__animatedEnhanceInstanceId", "duration"];
5
+ import React from 'react';
6
+ import { useForkRef } from '../ref';
7
+ import useEnhancedEffect from '../use/useEnhancedEffect';
8
+ var uniqueId = 0;
9
+ function animatedSizeEnhance(_ref) {
10
+ var _ref$animateProps = _ref.animateProps,
11
+ animateProps = _ref$animateProps === void 0 ? [] : _ref$animateProps,
12
+ _ref$onChangeOf = _ref.onChangeOf,
13
+ onChangeOf = _ref$onChangeOf === void 0 ? [] : _ref$onChangeOf;
14
+ return function (props) {
15
+ var ref = props.ref,
16
+ __animatedEnhanceInstanceId = props.__animatedEnhanceInstanceId,
17
+ duration = props.duration,
18
+ other = _objectWithoutProperties(props, _excluded);
19
+ var nodeRef = /*#__PURE__*/React.createRef();
20
+ var lastSizesRef = React.useRef([]);
21
+ var prevPropsRef = React.useRef(props);
22
+ var animatedSizeInstanceIdRef = React.useRef(uniqueId++);
23
+ prevPropsRef.current = props;
24
+ useEnhancedEffect(function () {
25
+ if (props.animationsDisabled) return;
26
+ if (__animatedEnhanceInstanceId !== undefined && __animatedEnhanceInstanceId !== animatedSizeInstanceIdRef.current) return;
27
+ if (!nodeRef.current) {
28
+ return;
29
+ }
30
+ var node = nodeRef.current;
31
+ if (lastSizesRef.current.every(function (value) {
32
+ return value === undefined;
33
+ })) {
34
+ for (var i = 0; i < animateProps.length; i++) {
35
+ lastSizesRef.current[i] = node.getBoundingClientRect()[animateProps[i]];
36
+ }
37
+ return;
38
+ }
39
+ var sizes = [];
40
+ for (var _i = 0; _i < animateProps.length; _i++) {
41
+ sizes[_i] = node.getBoundingClientRect()[animateProps[_i]];
42
+ if (Math.abs(lastSizesRef.current[_i] - sizes[_i]) < 3 || node.style.getPropertyValue(animateProps[_i]).endsWith('%')) {
43
+ lastSizesRef.current[_i] = sizes[_i];
44
+ sizes[_i] = undefined;
45
+ }
46
+ }
47
+ if (sizes.every(function (value) {
48
+ return value === undefined;
49
+ })) return;
50
+ node.style.transition = 'none';
51
+ for (var _i2 = 0; _i2 < animateProps.length; _i2++) {
52
+ node.style[animateProps[_i2]] = "".concat(lastSizesRef.current[_i2], "px");
53
+ }
54
+ var timeout = -1;
55
+ var handleTransitionEnd = function handleTransitionEnd() {
56
+ clearTimeout(timeout);
57
+ if (!node) return;
58
+ node.style.transition = null;
59
+ for (var _i3 = 0; _i3 < animateProps.length; _i3++) {
60
+ node.style[animateProps[_i3]] = null;
61
+ }
62
+ node.removeEventListener('transitionend', handleTransitionEnd);
63
+ node.removeEventListener('transitioncancel', handleTransitionEnd);
64
+ };
65
+ var animationFrame = requestAnimationFrame(function () {
66
+ if (!node) return;
67
+ node.addEventListener('transitionend', handleTransitionEnd);
68
+ node.addEventListener('transitioncancel', handleTransitionEnd);
69
+ node.style.transition = "".concat(duration, "ms all ease-in-out");
70
+ for (var _i4 = 0; _i4 < animateProps.length; _i4++) {
71
+ lastSizesRef.current[_i4] = sizes[_i4];
72
+ node.style[animateProps[_i4]] = "".concat(sizes[_i4], "px");
73
+ }
74
+ });
75
+ timeout = setTimeout(handleTransitionEnd, 500);
76
+ return function () {
77
+ cancelAnimationFrame(animationFrame);
78
+ handleTransitionEnd();
79
+ };
80
+ }, [__animatedEnhanceInstanceId, props.animationsDisabled, duration].concat(_toConsumableArray(onChangeOf.map(function (propName) {
81
+ return props[propName];
82
+ }))));
83
+ return _objectSpread({
84
+ ref: useForkRef(ref, nodeRef),
85
+ __animatedEnhanceInstanceId: __animatedEnhanceInstanceId !== null && __animatedEnhanceInstanceId !== void 0 ? __animatedEnhanceInstanceId : animatedSizeInstanceIdRef.current
86
+ }, other);
87
+ };
88
+ }
89
+ export default animatedSizeEnhance;
90
+ //# sourceMappingURL=animatedSizeEnhance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"animatedSizeEnhance.js","names":["React","useForkRef","useEnhancedEffect","uniqueId","animatedSizeEnhance","_ref","_ref$animateProps","animateProps","_ref$onChangeOf","onChangeOf","props","ref","__animatedEnhanceInstanceId","duration","other","_objectWithoutProperties","_excluded","nodeRef","createRef","lastSizesRef","useRef","prevPropsRef","animatedSizeInstanceIdRef","current","animationsDisabled","undefined","node","every","value","i","length","getBoundingClientRect","sizes","Math","abs","style","getPropertyValue","endsWith","transition","concat","timeout","handleTransitionEnd","clearTimeout","removeEventListener","animationFrame","requestAnimationFrame","addEventListener","setTimeout","cancelAnimationFrame","_toConsumableArray","map","propName","_objectSpread"],"sources":["../../../../src/utils/enhances/animatedSizeEnhance.tsx"],"sourcesContent":["import React from 'react';\nimport { useForkRef } from '../ref';\nimport useEnhancedEffect from '../use/useEnhancedEffect';\nimport { UnknownProperties } from '../../core-types/UnknownProperties';\n\n/** @deprecated */\nexport interface IWithAnimatedSizeEnhanceProps\n extends WithAnimatedSizeEnhanceProps,\n UnknownProperties {}\nexport type WithAnimatedSizeEnhanceProps = {\n animationsDisabled?: boolean;\n};\n\nlet uniqueId = 0;\n\nfunction animatedSizeEnhance({\n animateProps = [],\n onChangeOf = [],\n}: {\n animateProps: ('width' | 'height')[];\n onChangeOf: string[];\n}) {\n return (props: any) => {\n const { ref, __animatedEnhanceInstanceId, duration, ...other } = props;\n const nodeRef = React.createRef<HTMLElement>();\n const lastSizesRef = React.useRef<(number | undefined)[]>([]);\n const prevPropsRef = React.useRef(props);\n const animatedSizeInstanceIdRef = React.useRef(uniqueId++);\n\n prevPropsRef.current = props;\n\n useEnhancedEffect(() => {\n if (props.animationsDisabled) return;\n if (\n __animatedEnhanceInstanceId !== undefined &&\n __animatedEnhanceInstanceId !== animatedSizeInstanceIdRef.current\n )\n return;\n if (!nodeRef.current) {\n return;\n }\n const node = nodeRef.current;\n if (lastSizesRef.current.every((value) => value === undefined)) {\n for (let i = 0; i < animateProps.length; i++) {\n lastSizesRef.current[i] = node.getBoundingClientRect()[animateProps[i]];\n }\n return;\n }\n\n const sizes: (number | undefined)[] = [];\n for (let i = 0; i < animateProps.length; i++) {\n sizes[i] = node.getBoundingClientRect()[animateProps[i]];\n if (\n Math.abs(lastSizesRef.current[i]! - sizes[i]!) < 3 ||\n node.style.getPropertyValue(animateProps[i]).endsWith('%')\n ) {\n lastSizesRef.current[i] = sizes[i];\n sizes[i] = undefined;\n }\n }\n if (sizes.every((value) => value === undefined)) return;\n\n node.style.transition = 'none';\n for (let i = 0; i < animateProps.length; i++) {\n node.style[animateProps[i]] = `${lastSizesRef.current[i]}px`;\n }\n let timeout = -1;\n const handleTransitionEnd = () => {\n clearTimeout(timeout);\n if (!node) return;\n node.style.transition = null as any;\n for (let i = 0; i < animateProps.length; i++) {\n node.style[animateProps[i]] = null as any;\n }\n node.removeEventListener('transitionend', handleTransitionEnd);\n node.removeEventListener('transitioncancel', handleTransitionEnd);\n };\n const animationFrame = requestAnimationFrame(() => {\n if (!node) return;\n node.addEventListener('transitionend', handleTransitionEnd);\n node.addEventListener('transitioncancel', handleTransitionEnd);\n node.style.transition = `${duration}ms all ease-in-out`;\n for (let i = 0; i < animateProps.length; i++) {\n lastSizesRef.current[i] = sizes[i];\n node.style[animateProps[i]] = `${sizes[i]}px`;\n }\n });\n timeout = setTimeout(handleTransitionEnd, 500) as any;\n return () => {\n cancelAnimationFrame(animationFrame);\n handleTransitionEnd();\n };\n }, [\n __animatedEnhanceInstanceId,\n props.animationsDisabled,\n duration,\n ...onChangeOf.map((propName) => props[propName]),\n ]);\n\n return {\n ref: useForkRef(ref, nodeRef),\n __animatedEnhanceInstanceId: __animatedEnhanceInstanceId ?? animatedSizeInstanceIdRef.current,\n ...other,\n };\n };\n}\n\nexport default animatedSizeEnhance;\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,QAAQ,QAAQ;AACnC,OAAOC,iBAAiB,MAAM,0BAA0B;AAWxD,IAAIC,QAAQ,GAAG,CAAC;AAEhB,SAASC,mBAAmBA,CAAAC,IAAA,EAMzB;EAAA,IAAAC,iBAAA,GAAAD,IAAA,CALDE,YAAY;IAAZA,YAAY,GAAAD,iBAAA,cAAG,EAAE,GAAAA,iBAAA;IAAAE,eAAA,GAAAH,IAAA,CACjBI,UAAU;IAAVA,UAAU,GAAAD,eAAA,cAAG,EAAE,GAAAA,eAAA;EAKf,OAAO,UAACE,KAAU,EAAK;IACrB,IAAQC,GAAG,GAAsDD,KAAK,CAA9DC,GAAG;MAAEC,2BAA2B,GAAyBF,KAAK,CAAzDE,2BAA2B;MAAEC,QAAQ,GAAeH,KAAK,CAA5BG,QAAQ;MAAKC,KAAK,GAAAC,wBAAA,CAAKL,KAAK,EAAAM,SAAA;IACtE,IAAMC,OAAO,gBAAGjB,KAAK,CAACkB,SAAS,EAAe;IAC9C,IAAMC,YAAY,GAAGnB,KAAK,CAACoB,MAAM,CAAyB,EAAE,CAAC;IAC7D,IAAMC,YAAY,GAAGrB,KAAK,CAACoB,MAAM,CAACV,KAAK,CAAC;IACxC,IAAMY,yBAAyB,GAAGtB,KAAK,CAACoB,MAAM,CAACjB,QA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AAoB;QACvD,KAAK,IAAIgB,GAAC,GAAG,CAAC,EAAEA,GAAC,GAAGtB,YAAY,CAACuB,MAAM,EAAED,GAAC,EAAE,EAAE;UAC5CV,YAAY,CAACI,OAAO,CAACM,GAAC,CAAC,GAAGG,KAAK,CAACH,GAAC,CAAC;UAClCH,IAAI,CAACS,KAAK,CAAC5B,YAAY,CAACsB,GAAC,CAAC,CAAC,MAAAU,MAAA,CAAMP,KAAK,CAACH,GAAC,CAAC,OAAI;QAC/C;MACF,CAAC,CAAC;MACFW,OAAO,GAAGO,UAAU,CAACN,mBAAmB,EAAE,GAAG,CAAQ;MACrD,OAAO,YAAM;QACXO,oBAAoB,CAACJ,cAAc,CAAC;QACpCH,mBAAmB,EAAE;MACvB,CAAC;IACH,CAAC,GACC7B,2BAA2B,EAC3BF,KAAK,CAACc,kBAAkB,EACxBX,QAAQ,EAAA0B,MAAA,CAAAU,kBAAA,CACLxC,UAAU,CAACyC,GAAG,CAAC,UAACC,QAAQ;MAAA,OAAKzC,KAAK,CAACyC,QAAQ,CAAC;IAAA,EAAC,GAChD;IAEF,OAAAC,aAAA;MACEzC,GAAG,EAAEV,UAAU,CAACU,GAAG,EAAEM,OAAO,CAAC;MAC7BL,2BAA2B,EAAEA,2BAA2B,aAA3BA,2BAA2B,cAA3BA,2BAA2B,GAAIU,yBAAyB,CAACC;IAAO,GAC1FT,KAAK;EAEZ,CAAC;AACH;AAEA,eAAeV,mBAAmB"}
@@ -0,0 +1,38 @@
1
+ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["autoFocus", "ref"];
4
+ import React from 'react';
5
+ import { useForkRef } from '../ref';
6
+ function notUsingNativeAutoFocus(autoFocus) {
7
+ return typeof autoFocus === 'boolean' || typeof autoFocus === 'number';
8
+ }
9
+
10
+ /** @deprecated */
11
+
12
+ function autoFocusEnhance() {
13
+ return function (props) {
14
+ var autoFocus = props.autoFocus,
15
+ ref = props.ref,
16
+ other = _objectWithoutProperties(props, _excluded);
17
+ if (!notUsingNativeAutoFocus(autoFocus)) {
18
+ return props;
19
+ }
20
+ var nodeRef = /*#__PURE__*/React.createRef();
21
+ React.useEffect(function () {
22
+ if (autoFocus === false) return;
23
+ var inputNode = nodeRef.current;
24
+ if (!inputNode || !inputNode.focus) return;
25
+ var timer = setTimeout(function () {
26
+ return inputNode === null || inputNode === void 0 ? void 0 : inputNode.focus();
27
+ }, autoFocus || 0);
28
+ return function () {
29
+ clearTimeout(timer);
30
+ };
31
+ }, [autoFocus]);
32
+ return _objectSpread({
33
+ ref: useForkRef(ref, nodeRef)
34
+ }, other);
35
+ };
36
+ }
37
+ export default autoFocusEnhance;
38
+ //# sourceMappingURL=autoFocusEnhance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"autoFocusEnhance.js","names":["React","useForkRef","notUsingNativeAutoFocus","autoFocus","autoFocusEnhance","props","ref","other","_objectWithoutProperties","_excluded","nodeRef","createRef","useEffect","inputNode","current","focus","timer","setTimeout","clearTimeout","_objectSpread"],"sources":["../../../../src/utils/enhances/autoFocusEnhance.tsx"],"sourcesContent":["import React from 'react';\nimport { useForkRef } from '../ref';\nimport { UnknownProperties } from '../../core-types/UnknownProperties';\n\nfunction notUsingNativeAutoFocus(autoFocus: any) {\n return typeof autoFocus === 'boolean' || typeof autoFocus === 'number';\n}\n\n/** @deprecated */\nexport interface IWithAutoFocusEnhanceProps extends WithAutoFocusEnhanceProps, UnknownProperties {}\nexport type WithAutoFocusEnhanceProps = {\n /** Native autofocus, but with support for working inside modals, you can also transmit the number of ms before focus is triggered */\n autoFocus?: boolean | number;\n};\n\nfunction autoFocusEnhance() {\n return (props: any) => {\n const { autoFocus, ref, ...other } = props;\n if (!notUsingNativeAutoFocus(autoFocus)) {\n return props;\n }\n const nodeRef = React.createRef<HTMLElement>();\n React.useEffect(() => {\n if (autoFocus === false) return;\n const { current: inputNode } = nodeRef;\n if (!inputNode || !inputNode.focus) return;\n const timer = setTimeout(() => inputNode?.focus(), (autoFocus as number) || 0);\n return () => {\n clearTimeout(timer);\n };\n }, [autoFocus]);\n return {\n ref: useForkRef(ref, nodeRef),\n ...other,\n };\n };\n}\n\nexport default autoFocusEnhance;\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,QAAQ,QAAQ;AAGnC,SAASC,uBAAuBA,CAACC,SAAc,EAAE;EAC/C,OAAO,OAAOA,SAAS,KAAK,SAAS,IAAI,OAAOA,SAAS,KAAK,QAAQ;AACxE;;AAEA;;AAOA,SAASC,gBAAgBA,CAAA,EAAG;EAC1B,OAAO,UAACC,KAAU,EAAK;IACrB,IAAQF,SAAS,GAAoBE,KAAK,CAAlCF,SAAS;MAAEG,GAAG,GAAeD,KAAK,CAAvBC,GAAG;MAAKC,KAAK,GAAAC,wBAAA,CAAKH,KAAK,EAAAI,SAAA;IAC1C,IAAI,CAACP,uBAAuB,CAACC,SAAS,CAAC,EAAE;MACvC,OAAOE,KAAK;IACd;IACA,IAAMK,OAAO,gBAAGV,KAAK,CAACW,SAAS,EAAe;IAC9CX,KAAK,CAACY,SAAS,CAAC,YAAM;MACpB,IAAIT,SAAS,KAAK,KAAK,EAAE;MACzB,IAAiBU,SAAS,GAAKH,OAAO,CAA9BI,OAAO;MACf,IAAI,CAACD,SAAS,IAAI,CAACA,SAAS,CAACE,KAAK,EAAE;MACpC,IAAMC,KAAK,GAAGC,UAAU,CAAC;QAAA,OAAMJ,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAEE,KAAK,EAAE;MAAA,GAAGZ,SAAS,IAAe,CAAC,CAAC;MAC9E,OAAO,YAAM;QACXe,YAAY,CAACF,KAAK,CAAC;MACrB,CAAC;IACH,CAAC,EAAE,CAACb,SAAS,CAAC,CAAC;IACf,OAAAgB,aAAA;MACEb,GAAG,EAAEL,UAAU,CAACK,GAAG,EAAEI,OAAO;IAAC,GAC1BH,KAAK;EAEZ,CAAC;AACH;AAEA,eAAeH,gBAAgB"}
@@ -0,0 +1,14 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
3
+ import _objectDestructuringEmpty from "@babel/runtime/helpers/objectDestructuringEmpty";
4
+ import _extends from "@babel/runtime/helpers/extends";
5
+ import React from 'react';
6
+ function contextEnhance(context, setOnProp) {
7
+ return function (props) {
8
+ var other = _extends({}, (_objectDestructuringEmpty(props), props));
9
+ var value = React.useContext(context);
10
+ return _objectSpread(_objectSpread({}, other), {}, _defineProperty({}, setOnProp, value));
11
+ };
12
+ }
13
+ export default contextEnhance;
14
+ //# sourceMappingURL=contextEnhance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contextEnhance.js","names":["React","contextEnhance","context","setOnProp","props","other","_extends","_objectDestructuringEmpty","value","useContext","_objectSpread","_defineProperty"],"sources":["../../../../src/utils/enhances/contextEnhance.tsx"],"sourcesContent":["import React from 'react';\n\nfunction contextEnhance(context: React.Context<any>, setOnProp: string) {\n return (props: any) => {\n const { ...other } = props;\n const value = React.useContext(context);\n return {\n ...other,\n [setOnProp]: value,\n };\n };\n}\n\nexport default contextEnhance;\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,cAAcA,CAACC,OAA2B,EAAEC,SAAiB,EAAE;EACtE,OAAO,UAACC,KAAU,EAAK;IACrB,IAAWC,KAAK,GAAAC,QAAA,MAAAC,yBAAA,CAAKH,KAAK,GAALA,KAAK;IAC1B,IAAMI,KAAK,GAAGR,KAAK,CAACS,UAAU,CAACP,OAAO,CAAC;IACvC,OAAAQ,aAAA,CAAAA,aAAA,KACKL,KAAK,OAAAM,eAAA,KACPR,SAAS,EAAGK,KAAK;EAEtB,CAAC;AACH;AAEA,eAAeP,cAAc"}
@@ -0,0 +1,92 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import _typeof from "@babel/runtime/helpers/typeof";
3
+ import _regeneratorRuntime from "@babel/runtime/helpers/regeneratorRuntime";
4
+ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
5
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
6
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
7
+ import React from 'react';
8
+ import { useI18n } from './WithI18n';
9
+ export var useAsyncI18nMessages = function useAsyncI18nMessages(primaryContainer, locale, fallbackContainer) {
10
+ var _store$locale;
11
+ var container = React.useMemo(function () {
12
+ if (!fallbackContainer) return primaryContainer;
13
+ if (!primaryContainer) return fallbackContainer;
14
+ if (primaryContainer === fallbackContainer) return primaryContainer;
15
+ var container = {};
16
+ var _loop = function _loop(_locale) {
17
+ if (typeof primaryContainer[_locale] === 'function' || typeof fallbackContainer[_locale] === 'function') {
18
+ container[_locale] = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
19
+ var _yield$Promise$all, _yield$Promise$all2, primary, fallback;
20
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
21
+ while (1) switch (_context.prev = _context.next) {
22
+ case 0:
23
+ _context.next = 2;
24
+ return Promise.all([primaryContainer[_locale], fallbackContainer[_locale]]);
25
+ case 2:
26
+ _yield$Promise$all = _context.sent;
27
+ _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
28
+ primary = _yield$Promise$all2[0];
29
+ fallback = _yield$Promise$all2[1];
30
+ return _context.abrupt("return", _objectSpread(_objectSpread({}, primary), fallback));
31
+ case 7:
32
+ case "end":
33
+ return _context.stop();
34
+ }
35
+ }, _callee);
36
+ }));
37
+ } else {
38
+ var _primaryContainer$_lo, _fallbackContainer$_l;
39
+ container[_locale] = _objectSpread(_objectSpread({}, (_primaryContainer$_lo = primaryContainer[_locale]) !== null && _primaryContainer$_lo !== void 0 ? _primaryContainer$_lo : {}), (_fallbackContainer$_l = fallbackContainer[_locale]) !== null && _fallbackContainer$_l !== void 0 ? _fallbackContainer$_l : {});
40
+ }
41
+ };
42
+ for (var _locale in primaryContainer) {
43
+ _loop(_locale);
44
+ }
45
+ return container;
46
+ }, [primaryContainer, fallbackContainer]);
47
+ var initStore = React.useMemo(function () {
48
+ var store = {};
49
+ for (var _locale2 in container) {
50
+ if (_typeof(container[_locale2]) === 'object') {
51
+ store[_locale2] = container[_locale2];
52
+ }
53
+ }
54
+ return store;
55
+ }, [container]);
56
+ var _React$useState = React.useState(initStore),
57
+ _React$useState2 = _slicedToArray(_React$useState, 2),
58
+ store = _React$useState2[0],
59
+ setStore = _React$useState2[1];
60
+ var lastLoadedLocaleRef = React.useRef(null);
61
+ if (store[locale]) lastLoadedLocaleRef.current = locale;
62
+ var fallbackMessages = React.useMemo(function () {
63
+ return Object.values(store)[0];
64
+ }, [store]);
65
+ var loadingLocaleRef = React.useRef(null);
66
+ React.useEffect(function () {
67
+ loadingLocaleRef.current = locale;
68
+ var asyncMessages = container[locale];
69
+ if (typeof asyncMessages === 'function') {
70
+ asyncMessages().then(function (module) {
71
+ if (loadingLocaleRef.current !== locale) return;
72
+ var messages = module;
73
+ if ('default' in module && _typeof(module["default"]) === 'object') messages = module["default"];
74
+ setStore(function (store) {
75
+ return _objectSpread(_objectSpread({}, store), {}, _defineProperty({}, locale, messages));
76
+ });
77
+ })["catch"](console.error);
78
+ }
79
+ }, [container, locale]);
80
+ return (_store$locale = store[locale]) !== null && _store$locale !== void 0 ? _store$locale : fallbackMessages;
81
+ };
82
+ export default (function (container) {
83
+ return function (props) {
84
+ var i18n = props.i18n,
85
+ locale = props.locale;
86
+ var getI18nText = useI18n(i18n, locale, container);
87
+ return _objectSpread(_objectSpread({}, props), {}, {
88
+ getI18nText: getI18nText
89
+ });
90
+ };
91
+ });
92
+ //# sourceMappingURL=i18nEnhance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i18nEnhance.js","names":["React","useI18n","useAsyncI18nMessages","primaryContainer","locale","fallbackContainer","_store$locale","container","useMemo","_loop","_locale","_asyncToGenerator","_regeneratorRuntime","mark","_callee","_yield$Promise$all","_yield$Promise$all2","primary","fallback","wrap","_callee$","_context","prev","next","Promise","all","sent","_slicedToArray","abrupt","_objectSpread","stop","_primaryContainer$_lo","_fallbackContainer$_l","initStore","store","_typeof","_React$useState","useState","_React$useState2","setStore","lastLoadedLocaleRef","useRef","current","fallbackMessages","Object","values","loadingLocaleRef","useEffect","asyncMessages","then","module","messages","_defineProperty","console","error","props","i18n","getI18nText"],"sources":["../../../../src/utils/enhances/i18nEnhance.tsx"],"sourcesContent":["import React from 'react';\nimport { LocaleKeys, useI18n } from './WithI18n';\nimport { UnknownProperties } from '../../core-types/UnknownProperties';\n\n/** @deprecated */\nexport interface IWithI18nEnhanceProps extends WithI18nEnhanceProps, UnknownProperties {}\nexport type WithI18nEnhanceProps = {\n /* Function for getting the required field from the translation dictionary */\n getI18nText?: (key?: string, variables?: {}) => any;\n /* Object with translations */\n i18n?: {\n [locale: string]: {\n [key: string]: string;\n };\n };\n /* Locale for translations */\n locale?: LocaleKeys;\n};\n\ntype Messages = { [messageId: string]: string };\ntype MessagesContainer = { [locale: string]: Messages | (() => Promise<Messages>) };\ntype MessagesStore = { [locale: string]: Messages };\nexport const useAsyncI18nMessages = (\n primaryContainer: MessagesContainer,\n locale: string,\n fallbackContainer?: MessagesContainer,\n) => {\n const container = React.useMemo(() => {\n if (!fallbackContainer) return primaryContainer;\n if (!primaryContainer) return fallbackContainer;\n if (primaryContainer === fallbackContainer) return primaryContainer;\n const container: MessagesContainer = {};\n for (const locale in primaryContainer) {\n if (\n typeof primaryContainer[locale] === 'function' ||\n typeof fallbackContainer[locale] === 'function'\n ) {\n container[locale] = async () => {\n const [primary, fallback] = await Promise.all([\n primaryContainer[locale],\n fallbackContainer[locale],\n ]);\n return { ...primary, ...fallback };\n };\n } else {\n container[locale] = {\n ...(primaryContainer[locale] ?? {}),\n ...(fallbackContainer[locale] ?? {}),\n };\n }\n }\n return container;\n }, [primaryContainer, fallbackContainer]);\n const initStore = React.useMemo(() => {\n const store: MessagesStore = {};\n for (const locale in container) {\n if (typeof container[locale] === 'object') {\n store[locale] = container[locale] as Messages;\n }\n }\n return store;\n }, [container]);\n const [store, setStore] = React.useState(initStore);\n const lastLoadedLocaleRef = React.useRef<string | null>(null);\n if (store[locale]) lastLoadedLocaleRef.current = locale;\n const fallbackMessages = React.useMemo(() => Object.values(store)[0], [store]);\n\n const loadingLocaleRef = React.useRef<string | null>(null);\n React.useEffect(() => {\n loadingLocaleRef.current = locale;\n const asyncMessages = container[locale];\n if (typeof asyncMessages === 'function') {\n asyncMessages()\n .then((module) => {\n if (loadingLocaleRef.current !== locale) return;\n let messages = module;\n if ('default' in module && typeof module.default === 'object') messages = module.default;\n setStore((store) => ({\n ...store,\n [locale]: messages,\n }));\n })\n\n .catch(console.error);\n }\n }, [container, locale]);\n\n return store[locale] ?? fallbackMessages;\n};\nexport default (container?: MessagesContainer) => {\n return (props: any): { getI18nText: ReturnType<typeof useI18n> } => {\n const { i18n, locale } = props;\n const getI18nText = useI18n(i18n, locale, container);\n\n return { ...props, getI18nText };\n };\n};\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAAqBC,OAAO,QAAQ,YAAY;AAqBhD,OAAO,IAAMC,oBAAoB,GAAG,SAAvBA,oBAAoBA,CAC/BC,gBAAmC,EACnCC,MAAc,EACdC,iBAAqC,EAClC;EAAA,IAAAC,aAAA;EACH,IAAMC,SAAS,GAAGP,KAAK,CAACQ,OAAO,CAAC,YAAM;IACpC,IAAI,CAACH,iBAAiB,EAAE,OAAOF,gBAAgB;IAC/C,IAAI,CAACA,gBAAgB,EAAE,OAAOE,iBAAiB;IAC/C,IAAIF,gBAAgB,KAAKE,iBAAiB,EAAE,OAAOF,gBAAgB;IACnE,IAAMI,SAA4B,GAAG,CAAC,CAAC;IAAC,IAAAE,KAAA,YAAAA,MAAAC,OAAA,EACD;MACrC,IACE,OAAOP,gBAAgB,CAACC,OAAM,CAAC,KAAK,UAAU,IAC9C,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