@semcore/core 2.39.4 → 16.0.0-prerelease.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (543) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +2 -2
  3. package/lib/LastInteractionType.d.ts +11 -0
  4. package/lib/LastInteractionType.js +57 -0
  5. package/lib/LastInteractionType.js.map +1 -0
  6. package/lib/LastInteractionType.mjs +51 -0
  7. package/lib/LastInteractionType.mjs.map +1 -0
  8. package/lib/core-types/Component.d.ts +189 -0
  9. package/lib/core-types/Component.js +59 -0
  10. package/lib/core-types/Component.js.map +1 -0
  11. package/lib/core-types/Component.mjs +51 -0
  12. package/lib/core-types/Component.mjs.map +1 -0
  13. package/lib/core-types/UnknownProperties.d.ts +3 -0
  14. package/lib/core-types/UnknownProperties.js +2 -0
  15. package/lib/core-types/UnknownProperties.js.map +1 -0
  16. package/lib/core-types/UnknownProperties.mjs +2 -0
  17. package/lib/core-types/UnknownProperties.mjs.map +1 -0
  18. package/lib/core-types/reshadow.d.js +2 -0
  19. package/lib/core-types/reshadow.d.js.map +1 -0
  20. package/lib/core-types/reshadow.d.mjs +2 -0
  21. package/lib/core-types/reshadow.d.mjs.map +1 -0
  22. package/lib/core-types/symbols.d.ts +9 -0
  23. package/lib/core-types/symbols.js +25 -0
  24. package/lib/core-types/symbols.js.map +1 -0
  25. package/lib/core-types/symbols.mjs +20 -0
  26. package/lib/core-types/symbols.mjs.map +1 -0
  27. package/lib/coreFactory.d.ts +27 -0
  28. package/lib/coreFactory.js +352 -0
  29. package/lib/coreFactory.js.map +1 -0
  30. package/lib/coreFactory.mjs +324 -0
  31. package/lib/coreFactory.mjs.map +1 -0
  32. package/lib/enhancement/Children.d.ts +5 -0
  33. package/lib/enhancement/Children.js +119 -0
  34. package/lib/enhancement/Children.js.map +1 -0
  35. package/lib/enhancement/Children.mjs +96 -0
  36. package/lib/enhancement/Children.mjs.map +1 -0
  37. package/lib/enhancement/Root.d.ts +6 -0
  38. package/lib/enhancement/Root.js +78 -0
  39. package/lib/enhancement/Root.js.map +1 -0
  40. package/lib/enhancement/Root.mjs +56 -0
  41. package/lib/enhancement/Root.mjs.map +1 -0
  42. package/lib/enhancement/bindHandler.d.ts +5 -0
  43. package/lib/enhancement/bindHandler.js +54 -0
  44. package/lib/enhancement/bindHandler.js.map +1 -0
  45. package/lib/enhancement/bindHandler.mjs +48 -0
  46. package/lib/enhancement/bindHandler.mjs.map +1 -0
  47. package/lib/enhancement/dataName.d.ts +4 -0
  48. package/lib/enhancement/dataName.js +20 -0
  49. package/lib/enhancement/dataName.js.map +1 -0
  50. package/lib/enhancement/dataName.mjs +13 -0
  51. package/lib/enhancement/dataName.mjs.map +1 -0
  52. package/lib/enhancement/enhance.d.ts +5 -0
  53. package/lib/enhancement/enhance.js +22 -0
  54. package/lib/enhancement/enhance.js.map +1 -0
  55. package/lib/enhancement/enhance.mjs +16 -0
  56. package/lib/enhancement/enhance.mjs.map +1 -0
  57. package/lib/enhancement/functionDefaultProps.d.ts +8 -0
  58. package/lib/enhancement/functionDefaultProps.js +36 -0
  59. package/lib/enhancement/functionDefaultProps.js.map +1 -0
  60. package/lib/enhancement/functionDefaultProps.mjs +29 -0
  61. package/lib/enhancement/functionDefaultProps.mjs.map +1 -0
  62. package/lib/enhancement/hoistProps.d.ts +10 -0
  63. package/lib/enhancement/hoistProps.js +97 -0
  64. package/lib/enhancement/hoistProps.js.map +1 -0
  65. package/lib/enhancement/hoistProps.mjs +78 -0
  66. package/lib/enhancement/hoistProps.mjs.map +1 -0
  67. package/lib/enhancement/i18n.d.ts +4 -0
  68. package/lib/enhancement/i18n.js +28 -0
  69. package/lib/enhancement/i18n.js.map +1 -0
  70. package/lib/enhancement/i18n.mjs +20 -0
  71. package/lib/enhancement/i18n.mjs.map +1 -0
  72. package/lib/enhancement/inheritedName.d.ts +8 -0
  73. package/lib/enhancement/inheritedName.js +23 -0
  74. package/lib/enhancement/inheritedName.js.map +1 -0
  75. package/lib/enhancement/inheritedName.mjs +16 -0
  76. package/lib/enhancement/inheritedName.mjs.map +1 -0
  77. package/lib/enhancement/staticChildren.d.ts +13 -0
  78. package/lib/enhancement/staticChildren.js +135 -0
  79. package/lib/enhancement/staticChildren.js.map +1 -0
  80. package/lib/enhancement/staticChildren.mjs +120 -0
  81. package/lib/enhancement/staticChildren.mjs.map +1 -0
  82. package/lib/enhancement/style.d.ts +9 -0
  83. package/lib/enhancement/style.js +60 -0
  84. package/lib/enhancement/style.js.map +1 -0
  85. package/lib/enhancement/style.mjs +49 -0
  86. package/lib/enhancement/style.mjs.map +1 -0
  87. package/lib/enhancement/uncontrolledProps.d.ts +7 -0
  88. package/lib/enhancement/uncontrolledProps.js +131 -0
  89. package/lib/enhancement/uncontrolledProps.js.map +1 -0
  90. package/lib/enhancement/uncontrolledProps.mjs +107 -0
  91. package/lib/enhancement/uncontrolledProps.mjs.map +1 -0
  92. package/lib/esm/LastInteractionType.mjs +51 -0
  93. package/lib/esm/core-types/Component.mjs +51 -0
  94. package/lib/esm/core-types/symbols.mjs +20 -0
  95. package/lib/esm/coreFactory.mjs +324 -0
  96. package/lib/esm/enhancement/Children.mjs +96 -0
  97. package/lib/esm/enhancement/Root.mjs +56 -0
  98. package/lib/esm/enhancement/bindHandler.mjs +48 -0
  99. package/lib/esm/enhancement/dataName.mjs +13 -0
  100. package/lib/esm/enhancement/enhance.mjs +16 -0
  101. package/lib/esm/enhancement/functionDefaultProps.mjs +29 -0
  102. package/lib/esm/enhancement/hoistProps.mjs +78 -0
  103. package/lib/esm/enhancement/i18n.mjs +20 -0
  104. package/lib/esm/enhancement/inheritedName.mjs +16 -0
  105. package/lib/esm/enhancement/staticChildren.mjs +120 -0
  106. package/lib/esm/enhancement/style.mjs +49 -0
  107. package/lib/esm/enhancement/uncontrolledProps.mjs +107 -0
  108. package/lib/esm/index.mjs +22 -4
  109. package/lib/esm/register.mjs +31 -0
  110. package/lib/esm/styled/index.mjs +8 -0
  111. package/lib/esm/styled/reshadow-core.mjs +234 -0
  112. package/lib/esm/styled/sstyled.mjs +121 -0
  113. package/lib/esm/utils/assignProps.mjs +86 -0
  114. package/lib/esm/utils/canUseDOM.mjs +6 -0
  115. package/lib/esm/utils/capitalizeFirstLetter.mjs +6 -0
  116. package/lib/esm/utils/createHoc.mjs +44 -0
  117. package/lib/esm/utils/enhances/WithI18n.mjs +78 -0
  118. package/lib/esm/utils/enhances/i18nEnhance.mjs +91 -0
  119. package/lib/esm/utils/getDisplayName.mjs +6 -0
  120. package/lib/esm/utils/logger.mjs +35 -0
  121. package/lib/esm/utils/pick.mjs +15 -0
  122. package/lib/esm/utils/ref.mjs +87 -0
  123. package/lib/esm/utils/use/useEnhancedEffect.mjs +6 -0
  124. package/lib/index.d.ts +11 -0
  125. package/lib/index.js +103 -0
  126. package/lib/index.js.map +1 -0
  127. package/lib/index.mjs +24 -0
  128. package/lib/index.mjs.map +1 -0
  129. package/lib/register.d.ts +8 -0
  130. package/lib/register.js +37 -0
  131. package/lib/register.js.map +1 -0
  132. package/lib/register.mjs +31 -0
  133. package/lib/register.mjs.map +1 -0
  134. package/lib/styled/index.d.ts +11 -0
  135. package/lib/styled/index.js +32 -0
  136. package/lib/styled/index.js.map +1 -0
  137. package/lib/styled/index.mjs +8 -0
  138. package/lib/styled/index.mjs.map +1 -0
  139. package/lib/styled/reshadow-core.d.ts +37 -0
  140. package/lib/styled/reshadow-core.js +256 -0
  141. package/lib/styled/reshadow-core.js.map +1 -0
  142. package/lib/styled/reshadow-core.mjs +234 -0
  143. package/lib/styled/reshadow-core.mjs.map +1 -0
  144. package/lib/styled/sstyled.d.ts +17 -0
  145. package/lib/styled/sstyled.js +149 -0
  146. package/lib/styled/sstyled.js.map +1 -0
  147. package/lib/styled/sstyled.mjs +121 -0
  148. package/lib/styled/sstyled.mjs.map +1 -0
  149. package/lib/theme/dark.json +2506 -0
  150. package/lib/theme/exclude-tokens.json +10 -0
  151. package/lib/theme/light.json +2584 -0
  152. package/lib/theme/processor.d.ts +1 -0
  153. package/lib/theme/processor.js +315 -0
  154. package/lib/theme/processor.js.map +1 -0
  155. package/lib/theme/processor.mjs +307 -0
  156. package/lib/theme/processor.mjs.map +1 -0
  157. package/lib/theme/themes/auto.css +1465 -0
  158. package/lib/theme/themes/dark.css +723 -0
  159. package/lib/theme/themes/dark.d.ts +378 -0
  160. package/lib/theme/themes/dark.js +385 -0
  161. package/lib/theme/themes/dark.js.map +1 -0
  162. package/lib/theme/themes/dark.mjs +378 -0
  163. package/lib/theme/themes/dark.mjs.map +1 -0
  164. package/lib/theme/themes/default.css +742 -0
  165. package/lib/theme/themes/default.d.ts +387 -0
  166. package/lib/theme/themes/default.js +394 -0
  167. package/lib/theme/themes/default.js.map +1 -0
  168. package/lib/theme/themes/default.mjs +387 -0
  169. package/lib/theme/themes/default.mjs.map +1 -0
  170. package/lib/theme/themes/light.css +742 -0
  171. package/lib/theme/themes/light.d.ts +387 -0
  172. package/lib/theme/themes/light.js +394 -0
  173. package/lib/theme/themes/light.js.map +1 -0
  174. package/lib/theme/themes/light.mjs +387 -0
  175. package/lib/theme/themes/light.mjs.map +1 -0
  176. package/lib/theme/utils.d.ts +52 -0
  177. package/lib/theme/utils.js +297 -0
  178. package/lib/theme/utils.js.map +1 -0
  179. package/lib/theme/utils.mjs +286 -0
  180. package/lib/theme/utils.mjs.map +1 -0
  181. package/lib/utils/CSSinJS.d.ts +5 -0
  182. package/lib/utils/CSSinJS.js +36 -0
  183. package/lib/utils/CSSinJS.js.map +1 -0
  184. package/lib/utils/CSSinJS.mjs +28 -0
  185. package/lib/utils/CSSinJS.mjs.map +1 -0
  186. package/lib/utils/ScreenReaderOnly.d.ts +8 -0
  187. package/lib/utils/ScreenReaderOnly.js +31 -0
  188. package/lib/utils/ScreenReaderOnly.js.map +1 -0
  189. package/lib/utils/ScreenReaderOnly.mjs +24 -0
  190. package/lib/utils/ScreenReaderOnly.mjs.map +1 -0
  191. package/lib/utils/ThemeProvider.d.ts +15 -0
  192. package/lib/utils/ThemeProvider.js +82 -0
  193. package/lib/utils/ThemeProvider.js.map +1 -0
  194. package/lib/utils/ThemeProvider.mjs +71 -0
  195. package/lib/utils/ThemeProvider.mjs.map +1 -0
  196. package/lib/utils/addonText.d.ts +2 -0
  197. package/lib/utils/addonText.js +18 -0
  198. package/lib/utils/addonText.js.map +1 -0
  199. package/lib/utils/addonText.mjs +11 -0
  200. package/lib/utils/addonText.mjs.map +1 -0
  201. package/lib/utils/addonTextChildren.d.ts +3 -0
  202. package/lib/utils/addonTextChildren.js +45 -0
  203. package/lib/utils/addonTextChildren.js.map +1 -0
  204. package/lib/utils/addonTextChildren.mjs +37 -0
  205. package/lib/utils/addonTextChildren.mjs.map +1 -0
  206. package/lib/utils/ariaProps.d.ts +12 -0
  207. package/lib/utils/ariaProps.js +22 -0
  208. package/lib/utils/ariaProps.js.map +1 -0
  209. package/lib/utils/ariaProps.mjs +16 -0
  210. package/lib/utils/ariaProps.mjs.map +1 -0
  211. package/lib/utils/assignProps.d.ts +11 -0
  212. package/lib/utils/assignProps.js +93 -0
  213. package/lib/utils/assignProps.js.map +1 -0
  214. package/lib/utils/assignProps.mjs +86 -0
  215. package/lib/utils/assignProps.mjs.map +1 -0
  216. package/lib/utils/canUseDOM.d.ts +1 -0
  217. package/lib/utils/canUseDOM.js +10 -0
  218. package/lib/utils/canUseDOM.js.map +1 -0
  219. package/lib/utils/canUseDOM.mjs +6 -0
  220. package/lib/utils/canUseDOM.mjs.map +1 -0
  221. package/lib/utils/capitalizeFirstLetter.d.ts +1 -0
  222. package/lib/utils/capitalizeFirstLetter.js +10 -0
  223. package/lib/utils/capitalizeFirstLetter.js.map +1 -0
  224. package/lib/utils/capitalizeFirstLetter.mjs +6 -0
  225. package/lib/utils/capitalizeFirstLetter.mjs.map +1 -0
  226. package/lib/utils/color.d.ts +5 -0
  227. package/lib/utils/color.js +208 -0
  228. package/lib/utils/color.js.map +1 -0
  229. package/lib/utils/color.mjs +196 -0
  230. package/lib/utils/color.mjs.map +1 -0
  231. package/lib/utils/compose.d.ts +1 -0
  232. package/lib/utils/compose.js +21 -0
  233. package/lib/utils/compose.js.map +1 -0
  234. package/lib/utils/compose.mjs +15 -0
  235. package/lib/utils/compose.mjs.map +1 -0
  236. package/lib/utils/createHoc.d.ts +3 -0
  237. package/lib/utils/createHoc.js +55 -0
  238. package/lib/utils/createHoc.js.map +1 -0
  239. package/lib/utils/createHoc.mjs +44 -0
  240. package/lib/utils/createHoc.mjs.map +1 -0
  241. package/lib/utils/createUUID.d.ts +1 -0
  242. package/lib/utils/createUUID.js +15 -0
  243. package/lib/utils/createUUID.js.map +1 -0
  244. package/lib/utils/createUUID.mjs +9 -0
  245. package/lib/utils/createUUID.mjs.map +1 -0
  246. package/lib/utils/cssToIntDefault.d.ts +8 -0
  247. package/lib/utils/cssToIntDefault.js +22 -0
  248. package/lib/utils/cssToIntDefault.js.map +1 -0
  249. package/lib/utils/cssToIntDefault.mjs +16 -0
  250. package/lib/utils/cssToIntDefault.mjs.map +1 -0
  251. package/lib/utils/enhances/WithAutoFocus.d.ts +14 -0
  252. package/lib/utils/enhances/WithAutoFocus.js +75 -0
  253. package/lib/utils/enhances/WithAutoFocus.js.map +1 -0
  254. package/lib/utils/enhances/WithAutoFocus.mjs +67 -0
  255. package/lib/utils/enhances/WithAutoFocus.mjs.map +1 -0
  256. package/lib/utils/enhances/WithCSS.d.ts +41 -0
  257. package/lib/utils/enhances/WithCSS.js +93 -0
  258. package/lib/utils/enhances/WithCSS.js.map +1 -0
  259. package/lib/utils/enhances/WithCSS.mjs +79 -0
  260. package/lib/utils/enhances/WithCSS.mjs.map +1 -0
  261. package/lib/utils/enhances/WithI18n.d.ts +43 -0
  262. package/lib/utils/enhances/WithI18n.js +95 -0
  263. package/lib/utils/enhances/WithI18n.js.map +1 -0
  264. package/lib/utils/enhances/WithI18n.mjs +78 -0
  265. package/lib/utils/enhances/WithI18n.mjs.map +1 -0
  266. package/lib/utils/enhances/WithKeyboardFocus.d.ts +45 -0
  267. package/lib/utils/enhances/WithKeyboardFocus.js +93 -0
  268. package/lib/utils/enhances/WithKeyboardFocus.js.map +1 -0
  269. package/lib/utils/enhances/WithKeyboardFocus.mjs +84 -0
  270. package/lib/utils/enhances/WithKeyboardFocus.mjs.map +1 -0
  271. package/lib/utils/enhances/WithRef.d.ts +3 -0
  272. package/lib/utils/enhances/WithRef.js +26 -0
  273. package/lib/utils/enhances/WithRef.js.map +1 -0
  274. package/lib/utils/enhances/WithRef.mjs +18 -0
  275. package/lib/utils/enhances/WithRef.mjs.map +1 -0
  276. package/lib/utils/enhances/a11yEnhance.d.ts +10 -0
  277. package/lib/utils/enhances/a11yEnhance.js +74 -0
  278. package/lib/utils/enhances/a11yEnhance.js.map +1 -0
  279. package/lib/utils/enhances/a11yEnhance.mjs +66 -0
  280. package/lib/utils/enhances/a11yEnhance.mjs.map +1 -0
  281. package/lib/utils/enhances/animatedSizeEnhance.d.ts +12 -0
  282. package/lib/utils/enhances/animatedSizeEnhance.js +98 -0
  283. package/lib/utils/enhances/animatedSizeEnhance.js.map +1 -0
  284. package/lib/utils/enhances/animatedSizeEnhance.mjs +90 -0
  285. package/lib/utils/enhances/animatedSizeEnhance.mjs.map +1 -0
  286. package/lib/utils/enhances/autoFocusEnhance.d.ts +10 -0
  287. package/lib/utils/enhances/autoFocusEnhance.js +46 -0
  288. package/lib/utils/enhances/autoFocusEnhance.js.map +1 -0
  289. package/lib/utils/enhances/autoFocusEnhance.mjs +38 -0
  290. package/lib/utils/enhances/autoFocusEnhance.mjs.map +1 -0
  291. package/lib/utils/enhances/contextEnhance.d.ts +3 -0
  292. package/lib/utils/enhances/contextEnhance.js +22 -0
  293. package/lib/utils/enhances/contextEnhance.js.map +1 -0
  294. package/lib/utils/enhances/contextEnhance.mjs +14 -0
  295. package/lib/utils/enhances/contextEnhance.mjs.map +1 -0
  296. package/lib/utils/enhances/i18nEnhance.d.ts +25 -0
  297. package/lib/utils/enhances/i18nEnhance.js +101 -0
  298. package/lib/utils/enhances/i18nEnhance.js.map +1 -0
  299. package/lib/utils/enhances/i18nEnhance.mjs +91 -0
  300. package/lib/utils/enhances/i18nEnhance.mjs.map +1 -0
  301. package/lib/utils/enhances/keyboardFocusEnhance.d.ts +27 -0
  302. package/lib/utils/enhances/keyboardFocusEnhance.js +63 -0
  303. package/lib/utils/enhances/keyboardFocusEnhance.js.map +1 -0
  304. package/lib/utils/enhances/keyboardFocusEnhance.mjs +57 -0
  305. package/lib/utils/enhances/keyboardFocusEnhance.mjs.map +1 -0
  306. package/lib/utils/enhances/resolveColorEnhance.d.ts +2 -0
  307. package/lib/utils/enhances/resolveColorEnhance.js +25 -0
  308. package/lib/utils/enhances/resolveColorEnhance.js.map +1 -0
  309. package/lib/utils/enhances/resolveColorEnhance.mjs +17 -0
  310. package/lib/utils/enhances/resolveColorEnhance.mjs.map +1 -0
  311. package/lib/utils/eventEmitter.d.ts +9 -0
  312. package/lib/utils/eventEmitter.js +41 -0
  313. package/lib/utils/eventEmitter.js.map +1 -0
  314. package/lib/utils/eventEmitter.mjs +34 -0
  315. package/lib/utils/eventEmitter.mjs.map +1 -0
  316. package/lib/utils/findComponent.d.ts +12 -0
  317. package/lib/utils/findComponent.js +106 -0
  318. package/lib/utils/findComponent.js.map +1 -0
  319. package/lib/utils/findComponent.mjs +95 -0
  320. package/lib/utils/findComponent.mjs.map +1 -0
  321. package/lib/utils/fire.d.ts +2 -0
  322. package/lib/utils/fire.js +23 -0
  323. package/lib/utils/fire.js.map +1 -0
  324. package/lib/utils/fire.mjs +15 -0
  325. package/lib/utils/fire.mjs.map +1 -0
  326. package/lib/utils/focus-lock/focusBorders.d.ts +4 -0
  327. package/lib/utils/focus-lock/focusBorders.js +72 -0
  328. package/lib/utils/focus-lock/focusBorders.js.map +1 -0
  329. package/lib/utils/focus-lock/focusBorders.mjs +62 -0
  330. package/lib/utils/focus-lock/focusBorders.mjs.map +1 -0
  331. package/lib/utils/focus-lock/getFocusableIn.d.ts +1 -0
  332. package/lib/utils/focus-lock/getFocusableIn.js +26 -0
  333. package/lib/utils/focus-lock/getFocusableIn.js.map +1 -0
  334. package/lib/utils/focus-lock/getFocusableIn.mjs +19 -0
  335. package/lib/utils/focus-lock/getFocusableIn.mjs.map +1 -0
  336. package/lib/utils/focus-lock/isFocusInside.d.ts +1 -0
  337. package/lib/utils/focus-lock/isFocusInside.js +16 -0
  338. package/lib/utils/focus-lock/isFocusInside.js.map +1 -0
  339. package/lib/utils/focus-lock/isFocusInside.mjs +9 -0
  340. package/lib/utils/focus-lock/isFocusInside.mjs.map +1 -0
  341. package/lib/utils/focus-lock/isFocusable.d.ts +1 -0
  342. package/lib/utils/focus-lock/isFocusable.js +51 -0
  343. package/lib/utils/focus-lock/isFocusable.js.map +1 -0
  344. package/lib/utils/focus-lock/isFocusable.mjs +43 -0
  345. package/lib/utils/focus-lock/isFocusable.mjs.map +1 -0
  346. package/lib/utils/focus-lock/setFocus.d.ts +1 -0
  347. package/lib/utils/focus-lock/setFocus.js +63 -0
  348. package/lib/utils/focus-lock/setFocus.js.map +1 -0
  349. package/lib/utils/focus-lock/setFocus.mjs +55 -0
  350. package/lib/utils/focus-lock/setFocus.mjs.map +1 -0
  351. package/lib/utils/getAccessibleName.d.ts +1 -0
  352. package/lib/utils/getAccessibleName.js +56 -0
  353. package/lib/utils/getAccessibleName.js.map +1 -0
  354. package/lib/utils/getAccessibleName.mjs +49 -0
  355. package/lib/utils/getAccessibleName.mjs.map +1 -0
  356. package/lib/utils/getDisplayName.d.ts +2 -0
  357. package/lib/utils/getDisplayName.js +10 -0
  358. package/lib/utils/getDisplayName.js.map +1 -0
  359. package/lib/utils/getDisplayName.mjs +6 -0
  360. package/lib/utils/getDisplayName.mjs.map +1 -0
  361. package/lib/utils/getEventTarget.d.ts +1 -0
  362. package/lib/utils/getEventTarget.js +53 -0
  363. package/lib/utils/getEventTarget.js.map +1 -0
  364. package/lib/utils/getEventTarget.mjs +45 -0
  365. package/lib/utils/getEventTarget.mjs.map +1 -0
  366. package/lib/utils/getOriginChildren.d.ts +2 -0
  367. package/lib/utils/getOriginChildren.js +18 -0
  368. package/lib/utils/getOriginChildren.js.map +1 -0
  369. package/lib/utils/getOriginChildren.mjs +10 -0
  370. package/lib/utils/getOriginChildren.mjs.map +1 -0
  371. package/lib/utils/getRandomInt.d.ts +1 -0
  372. package/lib/utils/getRandomInt.js +11 -0
  373. package/lib/utils/getRandomInt.js.map +1 -0
  374. package/lib/utils/getRandomInt.mjs +5 -0
  375. package/lib/utils/getRandomInt.mjs.map +1 -0
  376. package/lib/utils/getValue.d.ts +1 -0
  377. package/lib/utils/getValue.js +16 -0
  378. package/lib/utils/getValue.js.map +1 -0
  379. package/lib/utils/getValue.mjs +10 -0
  380. package/lib/utils/getValue.mjs.map +1 -0
  381. package/lib/utils/hasLabels.d.ts +7 -0
  382. package/lib/utils/hasLabels.js +47 -0
  383. package/lib/utils/hasLabels.js.map +1 -0
  384. package/lib/utils/hasLabels.mjs +39 -0
  385. package/lib/utils/hasLabels.mjs.map +1 -0
  386. package/lib/utils/hasParent.d.ts +1 -0
  387. package/lib/utils/hasParent.js +14 -0
  388. package/lib/utils/hasParent.js.map +1 -0
  389. package/lib/utils/hasParent.mjs +7 -0
  390. package/lib/utils/hasParent.mjs.map +1 -0
  391. package/lib/utils/if.d.ts +11 -0
  392. package/lib/utils/if.js +16 -0
  393. package/lib/utils/if.js.map +1 -0
  394. package/lib/utils/if.mjs +9 -0
  395. package/lib/utils/if.mjs.map +1 -0
  396. package/lib/utils/ifChildren.d.ts +8 -0
  397. package/lib/utils/ifChildren.js +17 -0
  398. package/lib/utils/ifChildren.js.map +1 -0
  399. package/lib/utils/ifChildren.mjs +10 -0
  400. package/lib/utils/ifChildren.mjs.map +1 -0
  401. package/lib/utils/injectStyle.d.ts +2 -0
  402. package/lib/utils/injectStyle.js +49 -0
  403. package/lib/utils/injectStyle.js.map +1 -0
  404. package/lib/utils/injectStyle.mjs +41 -0
  405. package/lib/utils/injectStyle.mjs.map +1 -0
  406. package/lib/utils/inputProps.d.ts +2 -0
  407. package/lib/utils/inputProps.js +22 -0
  408. package/lib/utils/inputProps.js.map +1 -0
  409. package/lib/utils/inputProps.mjs +14 -0
  410. package/lib/utils/inputProps.mjs.map +1 -0
  411. package/lib/utils/isInteractiveElement.d.ts +1 -0
  412. package/lib/utils/isInteractiveElement.js +34 -0
  413. package/lib/utils/isInteractiveElement.js.map +1 -0
  414. package/lib/utils/isInteractiveElement.mjs +28 -0
  415. package/lib/utils/isInteractiveElement.mjs.map +1 -0
  416. package/lib/utils/isNode.d.ts +1 -0
  417. package/lib/utils/isNode.js +28 -0
  418. package/lib/utils/isNode.js.map +1 -0
  419. package/lib/utils/isNode.mjs +21 -0
  420. package/lib/utils/isNode.mjs.map +1 -0
  421. package/lib/utils/isPromise.d.ts +1 -0
  422. package/lib/utils/isPromise.js +10 -0
  423. package/lib/utils/isPromise.js.map +1 -0
  424. package/lib/utils/isPromise.mjs +4 -0
  425. package/lib/utils/isPromise.mjs.map +1 -0
  426. package/lib/utils/isRetina.d.ts +1 -0
  427. package/lib/utils/isRetina.js +15 -0
  428. package/lib/utils/isRetina.js.map +1 -0
  429. package/lib/utils/isRetina.mjs +9 -0
  430. package/lib/utils/isRetina.mjs.map +1 -0
  431. package/lib/utils/logger.d.ts +9 -0
  432. package/lib/utils/logger.js +40 -0
  433. package/lib/utils/logger.js.map +1 -0
  434. package/lib/utils/logger.mjs +35 -0
  435. package/lib/utils/logger.mjs.map +1 -0
  436. package/lib/utils/numericChecker.d.ts +5 -0
  437. package/lib/utils/numericChecker.js +33 -0
  438. package/lib/utils/numericChecker.js.map +1 -0
  439. package/lib/utils/numericChecker.mjs +27 -0
  440. package/lib/utils/numericChecker.mjs.map +1 -0
  441. package/lib/utils/ownerDocument.d.ts +1 -0
  442. package/lib/utils/ownerDocument.js +10 -0
  443. package/lib/utils/ownerDocument.js.map +1 -0
  444. package/lib/utils/ownerDocument.mjs +4 -0
  445. package/lib/utils/ownerDocument.mjs.map +1 -0
  446. package/lib/utils/pick.d.ts +1 -0
  447. package/lib/utils/pick.js +19 -0
  448. package/lib/utils/pick.js.map +1 -0
  449. package/lib/utils/pick.mjs +15 -0
  450. package/lib/utils/pick.mjs.map +1 -0
  451. package/lib/utils/propsForElement.d.ts +3 -0
  452. package/lib/utils/propsForElement.js +59 -0
  453. package/lib/utils/propsForElement.js.map +1 -0
  454. package/lib/utils/propsForElement.mjs +50 -0
  455. package/lib/utils/propsForElement.mjs.map +1 -0
  456. package/lib/utils/rafTrottle.d.ts +2 -0
  457. package/lib/utils/rafTrottle.js +33 -0
  458. package/lib/utils/rafTrottle.js.map +1 -0
  459. package/lib/utils/rafTrottle.mjs +26 -0
  460. package/lib/utils/rafTrottle.mjs.map +1 -0
  461. package/lib/utils/reactToText.d.ts +3 -0
  462. package/lib/utils/reactToText.js +33 -0
  463. package/lib/utils/reactToText.js.map +1 -0
  464. package/lib/utils/reactToText.mjs +26 -0
  465. package/lib/utils/reactToText.mjs.map +1 -0
  466. package/lib/utils/ref.d.ts +10 -0
  467. package/lib/utils/ref.js +96 -0
  468. package/lib/utils/ref.js.map +1 -0
  469. package/lib/utils/ref.mjs +87 -0
  470. package/lib/utils/ref.mjs.map +1 -0
  471. package/lib/utils/setRef.d.ts +2 -0
  472. package/lib/utils/setRef.js +10 -0
  473. package/lib/utils/setRef.js.map +1 -0
  474. package/lib/utils/setRef.mjs +3 -0
  475. package/lib/utils/setRef.mjs.map +1 -0
  476. package/lib/utils/syncScroll.d.ts +1 -0
  477. package/lib/utils/syncScroll.js +61 -0
  478. package/lib/utils/syncScroll.js.map +1 -0
  479. package/lib/utils/syncScroll.mjs +54 -0
  480. package/lib/utils/syncScroll.mjs.map +1 -0
  481. package/lib/utils/uncontroll.d.ts +4 -0
  482. package/lib/utils/uncontroll.js +47 -0
  483. package/lib/utils/uncontroll.js.map +1 -0
  484. package/lib/utils/uncontroll.mjs +38 -0
  485. package/lib/utils/uncontroll.mjs.map +1 -0
  486. package/lib/utils/uniqueID.d.ts +12 -0
  487. package/lib/utils/uniqueID.js +42 -0
  488. package/lib/utils/uniqueID.js.map +1 -0
  489. package/lib/utils/uniqueID.mjs +33 -0
  490. package/lib/utils/uniqueID.mjs.map +1 -0
  491. package/lib/utils/use/useColorResolver.d.ts +1 -0
  492. package/lib/utils/use/useColorResolver.js +208 -0
  493. package/lib/utils/use/useColorResolver.js.map +1 -0
  494. package/lib/utils/use/useColorResolver.mjs +200 -0
  495. package/lib/utils/use/useColorResolver.mjs.map +1 -0
  496. package/lib/utils/use/useCss.d.ts +4 -0
  497. package/lib/utils/use/useCss.js +20 -0
  498. package/lib/utils/use/useCss.js.map +1 -0
  499. package/lib/utils/use/useCss.mjs +12 -0
  500. package/lib/utils/use/useCss.mjs.map +1 -0
  501. package/lib/utils/use/useEnhancedEffect.d.ts +3 -0
  502. package/lib/utils/use/useEnhancedEffect.js +13 -0
  503. package/lib/utils/use/useEnhancedEffect.js.map +1 -0
  504. package/lib/utils/use/useEnhancedEffect.mjs +6 -0
  505. package/lib/utils/use/useEnhancedEffect.mjs.map +1 -0
  506. package/lib/utils/use/useEventCallback.d.ts +4 -0
  507. package/lib/utils/use/useEventCallback.js +25 -0
  508. package/lib/utils/use/useEventCallback.js.map +1 -0
  509. package/lib/utils/use/useEventCallback.mjs +19 -0
  510. package/lib/utils/use/useEventCallback.mjs.map +1 -0
  511. package/lib/utils/use/useEventListener.d.ts +2 -0
  512. package/lib/utils/use/useEventListener.js +33 -0
  513. package/lib/utils/use/useEventListener.js.map +1 -0
  514. package/lib/utils/use/useEventListener.mjs +25 -0
  515. package/lib/utils/use/useEventListener.mjs.map +1 -0
  516. package/lib/utils/use/useFocusLock.d.ts +10 -0
  517. package/lib/utils/use/useFocusLock.js +289 -0
  518. package/lib/utils/use/useFocusLock.js.map +1 -0
  519. package/lib/utils/use/useFocusLock.mjs +266 -0
  520. package/lib/utils/use/useFocusLock.mjs.map +1 -0
  521. package/lib/utils/use/usePreventScroll.d.ts +2 -0
  522. package/lib/utils/use/usePreventScroll.js +78 -0
  523. package/lib/utils/use/usePreventScroll.js.map +1 -0
  524. package/lib/utils/use/usePreventScroll.mjs +70 -0
  525. package/lib/utils/use/usePreventScroll.mjs.map +1 -0
  526. package/lib/utils/useCssVariable.d.ts +8 -0
  527. package/lib/utils/useCssVariable.js +55 -0
  528. package/lib/utils/useCssVariable.js.map +1 -0
  529. package/lib/utils/useCssVariable.mjs +46 -0
  530. package/lib/utils/useCssVariable.mjs.map +1 -0
  531. package/lib/utils/zIndexStacking.d.ts +8 -0
  532. package/lib/utils/zIndexStacking.js +48 -0
  533. package/lib/utils/zIndexStacking.js.map +1 -0
  534. package/lib/utils/zIndexStacking.mjs +38 -0
  535. package/lib/utils/zIndexStacking.mjs.map +1 -0
  536. package/package.json +297 -10
  537. package/tsconfig-utils.json +4 -0
  538. package/vite.config.ts +24 -0
  539. package/lib/cjs/index.js +0 -23
  540. package/lib/cjs/index.js.map +0 -1
  541. package/lib/es6/index.js +0 -4
  542. package/lib/es6/index.js.map +0 -1
  543. package/lib/types/index.d.ts +0 -3
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports["default"] = exports.EnhancedWithKeyboardFocus = void 0;
8
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
+ var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
11
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
12
+ var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
13
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
+ var _react = require("react");
15
+ var _createHoc = _interopRequireDefault(require("../createHoc"));
16
+ var _uncontroll = require("../uncontroll");
17
+ var _fire = _interopRequireDefault(require("../fire"));
18
+ var usingKeyBoard = true;
19
+ var EnhancedWithKeyboardFocus = /*#__PURE__*/function (_PureComponent) {
20
+ (0, _inherits2["default"])(EnhancedWithKeyboardFocus, _PureComponent);
21
+ var _super = (0, _createSuper2["default"])(EnhancedWithKeyboardFocus);
22
+ function EnhancedWithKeyboardFocus() {
23
+ var _this;
24
+ (0, _classCallCheck2["default"])(this, EnhancedWithKeyboardFocus);
25
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
26
+ args[_key] = arguments[_key];
27
+ }
28
+ _this = _super.call.apply(_super, [this].concat(args));
29
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "state", {
30
+ keyboardFocused: false
31
+ });
32
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handlerFocus", function (e) {
33
+ (0, _fire["default"])((0, _assertThisInitialized2["default"])(_this), 'onFocus', e);
34
+ if (usingKeyBoard) {
35
+ (0, _uncontroll.internalSetState)((0, _assertThisInitialized2["default"])(_this), {
36
+ keyboardFocused: true
37
+ });
38
+ }
39
+ });
40
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handlerBlur", function (e) {
41
+ (0, _fire["default"])((0, _assertThisInitialized2["default"])(_this), 'onBlur', e);
42
+ (0, _uncontroll.internalSetState)((0, _assertThisInitialized2["default"])(_this), {
43
+ keyboardFocused: false
44
+ });
45
+ });
46
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handlerKeyDown", function (e) {
47
+ (0, _fire["default"])((0, _assertThisInitialized2["default"])(_this), 'onKeyDown', e);
48
+ usingKeyBoard = true;
49
+ });
50
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handlerMouseDown", function (e) {
51
+ (0, _fire["default"])((0, _assertThisInitialized2["default"])(_this), 'onMouseDown', e);
52
+ usingKeyBoard = false;
53
+ });
54
+ return _this;
55
+ }
56
+ (0, _createClass2["default"])(EnhancedWithKeyboardFocus, [{
57
+ key: "render",
58
+ value: function render() {
59
+ var _this$props = this.props,
60
+ children = _this$props.children,
61
+ tabIndex = _this$props.tabIndex,
62
+ disabled = _this$props.disabled;
63
+ var keyboardFocused = this.state.keyboardFocused;
64
+ return children({
65
+ tabIndex: disabled ? -1 : tabIndex,
66
+ keyboardFocused: keyboardFocused,
67
+ onFocus: this.handlerFocus,
68
+ onBlur: this.handlerBlur,
69
+ onKeyDown: this.handlerKeyDown,
70
+ onMouseDown: this.handlerMouseDown
71
+ });
72
+ }
73
+ }], [{
74
+ key: "getDerivedStateFromProps",
75
+ value: function getDerivedStateFromProps(props, state) {
76
+ if (props.keyboardFocused !== undefined) {
77
+ return {
78
+ keyboardFocused: props.keyboardFocused
79
+ };
80
+ }
81
+ return state;
82
+ }
83
+ }]);
84
+ return EnhancedWithKeyboardFocus;
85
+ }(_react.PureComponent);
86
+ exports.EnhancedWithKeyboardFocus = EnhancedWithKeyboardFocus;
87
+ (0, _defineProperty2["default"])(EnhancedWithKeyboardFocus, "displayName", 'EnhancedWithKeyboardFocus');
88
+ (0, _defineProperty2["default"])(EnhancedWithKeyboardFocus, "defaultProps", {
89
+ tabIndex: 0
90
+ });
91
+ var _default = (0, _createHoc["default"])(EnhancedWithKeyboardFocus);
92
+ exports["default"] = _default;
93
+ //# sourceMappingURL=WithKeyboardFocus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WithKeyboardFocus.js","names":["_react","require","_createHoc","_interopRequireDefault","_uncontroll","_fire","usingKeyBoard","EnhancedWithKeyboardFocus","_PureComponent","_inherits2","_super","_createSuper2","_this","_classCallCheck2","_len","arguments","length","args","Array","_key","call","apply","concat","_defineProperty2","_assertThisInitialized2","keyboardFocused","e","fire","internalSetState","_createClass2","key","value","render","_this$props","props","children","tabIndex","disabled","state","onFocus","handlerFocus","onBlur","handlerBlur","onKeyDown","handlerKeyDown","onMouseDown","handlerMouseDown","getDerivedStateFromProps","undefined","PureComponent","exports","_default","createHoc"],"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,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAF,sBAAA,CAAAF,OAAA;AAuCA,IAAIK,aAAa,GAAG,IAAI;AAAC,IAEZC,yBAAyB,0BAAAC,cAAA;EAAA,IAAAC,UAAA,aAAAF,yBAAA,EAAAC,cAAA;EAAA,IAAAE,MAAA,OAAAC,aAAA,aAAAJ,yBAAA;EAAA,SAAAA,0BAAA;IAAA,IAAAK,KAAA;IAAA,IAAAC,gBAAA,mBAAAN,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;IAAA,IAAAM,gBAAA,iBAAAC,uBAAA,aAAAZ,KAAA,YAmB5B;MACNa,eAAe,EAAE;IACnB,CAAC;IAAA,IAAAF,gB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AAQZ,eAAe,GAAK,IAAI,CAACa,KAAK,CAA9Bb,eAAe;MACvB,OAAOU,QAAQ,CAAC;QACdC,QAAQ,EAAEC,QAAQ,GAAG,CAAC,CAAC,GAAGD,QAAS;QACnCX,eAAe,EAAfA,eAAe;QACfc,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,CAACT,eAAe,KAAKuB,SAAS,EAAE;QACvC,OAAO;UACLvB,eAAe,EAAES,KAAK,CAACT;QACzB,CAAC;MACH;MACA,OAAOa,KAAK;IACd;EAAC;EAAA,OAAA/B,yBAAA;AAAA,EAjB4C0C,oBAAa;AAAAC,OAAA,CAAA3C,yBAAA,GAAAA,yBAAA;AAAA,IAAAgB,gBAAA,aAA/ChB,yBAAyB,iBAIf,2BAA2B;AAAA,IAAAgB,gBAAA,aAJrChB,yBAAyB,kBAMd;EACpB6B,QAAQ,EAAE;AACZ,CAAC;AAAA,IAAAe,QAAA,GAmDY,IAAAC,qBAAS,EAAC7C,yBAAyB,CAAC;AAAA2C,OAAA,cAAAC,QAAA"}
@@ -0,0 +1,84 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
+ import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
4
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
5
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
6
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
7
+ import { PureComponent } from 'react';
8
+ import createHoc from "../createHoc.mjs";
9
+ import { internalSetState } from "../uncontroll.mjs";
10
+ import fire from "../fire.mjs";
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.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WithKeyboardFocus.mjs","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,SAAgB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A7B,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,3 @@
1
+ import React from 'react';
2
+ declare function WithForwardRef(): <T extends React.ComponentType<{}>>(Component: T) => any;
3
+ export default WithForwardRef;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports["default"] = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _react = _interopRequireDefault(require("react"));
10
+ var _getDisplayName = _interopRequireDefault(require("../getDisplayName"));
11
+ var _hoistNonReactStatics = _interopRequireDefault(require("hoist-non-react-statics"));
12
+ function WithForwardRef() {
13
+ return function ForwardRef(Component) {
14
+ var Wrapped = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
15
+ // @ts-ignore
16
+ return /*#__PURE__*/_react["default"].createElement(Component, (0, _extends2["default"])({}, Component.defaultProps || {}, props, {
17
+ forwardedRef: ref
18
+ }));
19
+ });
20
+ Wrapped.displayName = (0, _getDisplayName["default"])(Component);
21
+ return (0, _hoistNonReactStatics["default"])(Wrapped, Component);
22
+ };
23
+ }
24
+ var _default = WithForwardRef;
25
+ exports["default"] = _default;
26
+ //# sourceMappingURL=WithRef.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WithRef.js","names":["_react","_interopRequireDefault","require","_getDisplayName","_hoistNonReactStatics","WithForwardRef","ForwardRef","Component","Wrapped","React","forwardRef","props","ref","createElement","_extends2","defaultProps","forwardedRef","displayName","getDisplayName","hoistNonReactStatics","_default","exports"],"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,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,eAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,qBAAA,GAAAH,sBAAA,CAAAC,OAAA;AAEA,SAASG,cAAcA,CAAA,EAAG;EACxB,OAAO,SAASC,UAAUA,CAAgCC,SAAY,EAAE;IACtE,IAAMC,OAAO,gBAAGC,iBAAK,CAACC,UAAU,CAAC,UAACC,KAAK,EAAEC,GAAG,EAAK;MAC/C;MACA,oBAAOZ,MAAA,YAAAa,aAAA,CAACN,SAAS,MAAAO,SAAA,iBAAMP,SAAS,CAACQ,YAAY,IAAI,CAAC,CAAC,EAAOJ,KAAK;QAAEK,YAAY,EAAEJ;MAAI,GAAG;IACxF,CAAC,CAAC;IACFJ,OAAO,CAACS,WAAW,GAAG,IAAAC,0BAAc,EAACX,SAAS,CAAC;IAC/C,OAAO,IAAAY,gCAAoB,EAACX,OAAO,EAAED,SAAS,CAAC;EACjD,CAAC;AACH;AAAC,IAAAa,QAAA,GAEcf,cAAc;AAAAgB,OAAA,cAAAD,QAAA"}
@@ -0,0 +1,18 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import React from 'react';
3
+ import getDisplayName from "../getDisplayName.mjs";
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.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WithRef.mjs","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,uBAAmB;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,10 @@
1
+ type OnNeighborChange<P> = (neighborElement: HTMLElement, props: P) => void;
2
+ type FindNeighbor = (listSelectors: HTMLElement[], element: HTMLElement, direction: string) => HTMLElement | undefined;
3
+ type ChildSelector<P> = [string, string] | ((props: P) => [string, string]);
4
+ type A11yEnhanceOptions<P = any> = {
5
+ findNeighbor?: FindNeighbor;
6
+ onNeighborChange?: OnNeighborChange<P>;
7
+ childSelector: ChildSelector<P>;
8
+ };
9
+ declare const a11yEnhance: (options: A11yEnhanceOptions) => (props: any) => any;
10
+ export default a11yEnhance;
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports["default"] = void 0;
8
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
+ var _assignProps = require("../assignProps");
11
+ var defaultOnNeighborChange = function defaultOnNeighborChange(neighborElement) {
12
+ neighborElement === null || neighborElement === void 0 ? void 0 : neighborElement.focus();
13
+ };
14
+ var defaultFindNeighbor = function defaultFindNeighbor(listSelectors, element, direction) {
15
+ var elementSibling = ['right', 'top'].includes(direction) ? 1 : -1;
16
+ var indexElement = listSelectors.findIndex(function (node) {
17
+ return node === element;
18
+ });
19
+ var lengthList = listSelectors.length;
20
+ var lastIndex = lengthList - 1;
21
+ var indexNext = indexElement + elementSibling;
22
+ if (indexNext < 0) indexNext = lastIndex;
23
+ if (indexNext > lastIndex) indexNext = 0;
24
+ return listSelectors[indexNext];
25
+ };
26
+ var a11yEnhance = function a11yEnhance(options) {
27
+ var findNeighbor = options.findNeighbor || defaultFindNeighbor;
28
+ var onNeighborChange = options.onNeighborChange || defaultOnNeighborChange;
29
+ var childSelector = options.childSelector;
30
+ return function (props) {
31
+ if (!childSelector) throw "parameter childSelector not passed in options for a11yEnhance for ".concat(props['data-ui-name']);
32
+ var getNeighbor = function getNeighbor(listSelectors, element, direction) {
33
+ var neighbor = findNeighbor(listSelectors, element, direction);
34
+ if (!neighbor) return element;
35
+ if ('disabled' in neighbor && neighbor.disabled) return getNeighbor(listSelectors, neighbor, direction);
36
+ return neighbor;
37
+ };
38
+ var handleKeyDown = function handleKeyDown(event) {
39
+ var parent = event.currentTarget;
40
+ var selectedElement = event.target;
41
+ var _ref = typeof childSelector === 'function' ? childSelector(props) : childSelector,
42
+ _ref2 = (0, _slicedToArray2["default"])(_ref, 2),
43
+ childAttrName = _ref2[0],
44
+ childAttrValue = _ref2[1];
45
+ if (!selectedElement.getAttribute(childAttrName)) return;
46
+ var listSelectors = Array.from(parent.querySelectorAll("[".concat(childAttrName, "=\"").concat(childAttrValue, "\"]")));
47
+ if (!listSelectors.length) throw "no children found querySelectorAll([".concat(childAttrName, "=\"").concat(childAttrValue, "\"] a11yEnhance for ").concat(props['data-ui-name']);
48
+ switch (event.key) {
49
+ case 'ArrowLeft':
50
+ onNeighborChange(getNeighbor(listSelectors, selectedElement, 'left'), props);
51
+ event.preventDefault();
52
+ break;
53
+ case 'ArrowTop':
54
+ onNeighborChange(getNeighbor(listSelectors, selectedElement, 'top'), props);
55
+ event.preventDefault();
56
+ break;
57
+ case 'ArrowRight':
58
+ onNeighborChange(getNeighbor(listSelectors, selectedElement, 'right'), props);
59
+ event.preventDefault();
60
+ break;
61
+ case 'ArrowBottom':
62
+ onNeighborChange(getNeighbor(listSelectors, selectedElement, 'bottom'), props);
63
+ event.preventDefault();
64
+ break;
65
+ }
66
+ };
67
+ return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, props), {}, {
68
+ onKeyDown: (0, _assignProps.callAllEventHandlers)(props.onKeyDown, handleKeyDown)
69
+ });
70
+ };
71
+ };
72
+ var _default = a11yEnhance;
73
+ exports["default"] = _default;
74
+ //# sourceMappingURL=a11yEnhance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"a11yEnhance.js","names":["_assignProps","require","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","_slicedToArray2","childAttrName","childAttrValue","getAttribute","Array","from","querySelectorAll","key","preventDefault","_objectSpread2","onKeyDown","callAllEventHandlers","_default","exports"],"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,IAAAA,YAAA,GAAAC,OAAA;AAiBA,IAAMC,uBAA8C,GAAG,SAAjDA,uBAA8CA,CAAIC,eAAe,EAAK;EAC1EA,eAAe,aAAfA,eAAe,uBAAfA,eAAe,CAAEC,KAAK,EAAE;AAC1B,CAAC;AAED,IAAMC,mBAAiC,GAAG,SAApCA,mBAAiCA,CAAIC,aAAa,EAAEC,OAAO,EAAEC,SAAS,EAAK;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EAAE0B,eAAe,EAAE,QAAQ,CAAC,EAAET,KAAK,CAAC;UAC9EM,KAAK,CAACe,cAAc,EAAE;UACtB;MAAM;IAEZ,CAAC;IAED,WAAAC,cAAA,iBAAAA,cAAA,iBACKtB,KAAK;MACRuB,SAAS,EAAE,IAAAC,iCAAoB,EAACxB,KAAK,CAACuB,SAAS,EAAElB,aAAa;IAAC;EAEnE,CAAC;AACH,CAAC;AAAC,IAAAoB,QAAA,GAEa9B,WAAW;AAAA+B,OAAA,cAAAD,QAAA"}
@@ -0,0 +1,66 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
+ import { callAllEventHandlers } from "../assignProps.mjs";
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.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"a11yEnhance.mjs","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,oBAAgB;AAiBrD,IAAMC,uBAA8C,GAAG,SAAjDA,uBAA8CA,CAAIC,eAAe,EAAK;EAC1EA,eAAe,aAAfA,eAAe,uBAAfA,eAAe,CAAEC,KAAK,EAAE;AAC1B,CAAC;AAED,IAAMC,mBAAiC,GAAG,SAApCA,mBAAiCA,CAAIC,aAAa,EAAEC,OAAO,EAAEC,SAAS,EAAK;EAC/E,IAAMC,cAAc,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAACC,QAAQ,CAACF,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;EACpE,IAAMG,YAAY,GAAGL,aAAa,CAACM,SAAS,CAAC,UAACC,IAAI;IAAA,OAAKA,IAAI,KAAKN,OAAO;EAAA,EAAC;EACxE,IAAMO,UAAU,GAAGR,aAAa,CAACS,MAAM;EAEvC,IAAMC,SAAS,GAAGF,UAAU,GAAG,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} from '../../core-types/UnknownProperties';
2
+ /** @deprecated */
3
+ export interface IWithAnimatedSizeEnhanceProps extends WithAnimatedSizeEnhanceProps, UnknownProperties {
4
+ }
5
+ export type WithAnimatedSizeEnhanceProps = {
6
+ animationsDisabled?: boolean;
7
+ };
8
+ declare function animatedSizeEnhance({ animateProps, onChangeOf, }: {
9
+ animateProps: ('width' | 'height')[];
10
+ onChangeOf: string[];
11
+ }): (props: any) => any;
12
+ export default animatedSizeEnhance;
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports["default"] = void 0;
8
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
10
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
+ var _react = _interopRequireDefault(require("react"));
12
+ var _ref2 = require("../ref");
13
+ var _useEnhancedEffect = _interopRequireDefault(require("../use/useEnhancedEffect"));
14
+ var _excluded = ["ref", "__animatedEnhanceInstanceId", "duration"];
15
+ var uniqueId = 0;
16
+ function animatedSizeEnhance(_ref) {
17
+ var _ref$animateProps = _ref.animateProps,
18
+ animateProps = _ref$animateProps === void 0 ? [] : _ref$animateProps,
19
+ _ref$onChangeOf = _ref.onChangeOf,
20
+ onChangeOf = _ref$onChangeOf === void 0 ? [] : _ref$onChangeOf;
21
+ return function (props) {
22
+ var ref = props.ref,
23
+ __animatedEnhanceInstanceId = props.__animatedEnhanceInstanceId,
24
+ duration = props.duration,
25
+ other = (0, _objectWithoutProperties2["default"])(props, _excluded);
26
+ var nodeRef = /*#__PURE__*/_react["default"].createRef();
27
+ var lastSizesRef = _react["default"].useRef([]);
28
+ var prevPropsRef = _react["default"].useRef(props);
29
+ var animatedSizeInstanceIdRef = _react["default"].useRef(uniqueId++);
30
+ prevPropsRef.current = props;
31
+ (0, _useEnhancedEffect["default"])(function () {
32
+ if (props.animationsDisabled) return;
33
+ if (__animatedEnhanceInstanceId !== undefined && __animatedEnhanceInstanceId !== animatedSizeInstanceIdRef.current) return;
34
+ if (!nodeRef.current) {
35
+ return;
36
+ }
37
+ var node = nodeRef.current;
38
+ if (lastSizesRef.current.every(function (value) {
39
+ return value === undefined;
40
+ })) {
41
+ for (var i = 0; i < animateProps.length; i++) {
42
+ lastSizesRef.current[i] = node.getBoundingClientRect()[animateProps[i]];
43
+ }
44
+ return;
45
+ }
46
+ var sizes = [];
47
+ for (var _i = 0; _i < animateProps.length; _i++) {
48
+ sizes[_i] = node.getBoundingClientRect()[animateProps[_i]];
49
+ if (Math.abs(lastSizesRef.current[_i] - sizes[_i]) < 3 || node.style.getPropertyValue(animateProps[_i]).endsWith('%')) {
50
+ lastSizesRef.current[_i] = sizes[_i];
51
+ sizes[_i] = undefined;
52
+ }
53
+ }
54
+ if (sizes.every(function (value) {
55
+ return value === undefined;
56
+ })) return;
57
+ node.style.transition = 'none';
58
+ for (var _i2 = 0; _i2 < animateProps.length; _i2++) {
59
+ node.style[animateProps[_i2]] = "".concat(lastSizesRef.current[_i2], "px");
60
+ }
61
+ var timeout = -1;
62
+ var handleTransitionEnd = function handleTransitionEnd() {
63
+ clearTimeout(timeout);
64
+ if (!node) return;
65
+ node.style.transition = null;
66
+ for (var _i3 = 0; _i3 < animateProps.length; _i3++) {
67
+ node.style[animateProps[_i3]] = null;
68
+ }
69
+ node.removeEventListener('transitionend', handleTransitionEnd);
70
+ node.removeEventListener('transitioncancel', handleTransitionEnd);
71
+ };
72
+ var animationFrame = requestAnimationFrame(function () {
73
+ if (!node) return;
74
+ node.addEventListener('transitionend', handleTransitionEnd);
75
+ node.addEventListener('transitioncancel', handleTransitionEnd);
76
+ node.style.transition = "".concat(duration, "ms all ease-in-out");
77
+ for (var _i4 = 0; _i4 < animateProps.length; _i4++) {
78
+ lastSizesRef.current[_i4] = sizes[_i4];
79
+ node.style[animateProps[_i4]] = "".concat(sizes[_i4], "px");
80
+ }
81
+ });
82
+ timeout = setTimeout(handleTransitionEnd, 500);
83
+ return function () {
84
+ cancelAnimationFrame(animationFrame);
85
+ handleTransitionEnd();
86
+ };
87
+ }, [__animatedEnhanceInstanceId, props.animationsDisabled, duration].concat((0, _toConsumableArray2["default"])(onChangeOf.map(function (propName) {
88
+ return props[propName];
89
+ }))));
90
+ return (0, _objectSpread2["default"])({
91
+ ref: (0, _ref2.useForkRef)(ref, nodeRef),
92
+ __animatedEnhanceInstanceId: __animatedEnhanceInstanceId !== null && __animatedEnhanceInstanceId !== void 0 ? __animatedEnhanceInstanceId : animatedSizeInstanceIdRef.current
93
+ }, other);
94
+ };
95
+ }
96
+ var _default = animatedSizeEnhance;
97
+ exports["default"] = _default;
98
+ //# sourceMappingURL=animatedSizeEnhance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"animatedSizeEnhance.js","names":["_react","_interopRequireDefault","require","_ref2","_useEnhancedEffect","_excluded","uniqueId","animatedSizeEnhance","_ref","_ref$animateProps","animateProps","_ref$onChangeOf","onChangeOf","props","ref","__animatedEnhanceInstanceId","duration","other","_objectWithoutProperties2","nodeRef","React","createRef","lastSizesRef","useRef","prevPropsRef","animatedSizeInstanceIdRef","current","useEnhancedEffect","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","_toConsumableArray2","map","propName","_objectSpread2","useForkRef","_default","exports"],"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,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,kBAAA,GAAAH,sBAAA,CAAAC,OAAA;AAAyD,IAAAG,SAAA;AAWzD,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,OAAAC,yBAAA,aAAKL,KAAK,EAAAR,SAAA;IACtE,IAAMc,OAAO,gBAAGC,iBAAK,CAACC,SAAS,EAAe;IAC9C,IAAMC,YAAY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