@dr.pogodin/react-utils 1.25.5 → 1.26.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 (294) hide show
  1. package/babel.config.js +3 -1
  2. package/bin/build.js +25 -5
  3. package/build/development/client/getInj.js +9 -8
  4. package/build/development/client/getInj.js.map +1 -1
  5. package/build/development/client/index.js +6 -3
  6. package/build/development/client/index.js.map +1 -1
  7. package/build/development/client/init.js +4 -0
  8. package/build/development/client/init.js.map +1 -1
  9. package/build/development/index.js +168 -42
  10. package/build/development/index.js.map +1 -1
  11. package/build/development/server/Cache.js +13 -13
  12. package/build/development/server/Cache.js.map +1 -1
  13. package/build/development/server/index.js +16 -24
  14. package/build/development/server/index.js.map +1 -1
  15. package/build/development/server/renderer.js +56 -44
  16. package/build/development/server/renderer.js.map +1 -1
  17. package/build/development/server/server.js +9 -5
  18. package/build/development/server/server.js.map +1 -1
  19. package/build/development/server/utils/errors.js +12 -9
  20. package/build/development/server/utils/errors.js.map +1 -1
  21. package/build/development/server/utils/index.js +2 -2
  22. package/build/development/server/utils/index.js.map +1 -1
  23. package/build/development/shared/components/Button/index.js +8 -7
  24. package/build/development/shared/components/Button/index.js.map +1 -1
  25. package/build/development/shared/components/Checkbox/index.js +25 -28
  26. package/build/development/shared/components/Checkbox/index.js.map +1 -1
  27. package/build/development/shared/components/Dropdown/index.js +25 -19
  28. package/build/development/shared/components/Dropdown/index.js.map +1 -1
  29. package/build/development/shared/components/GenericLink/index.js +44 -37
  30. package/build/development/shared/components/GenericLink/index.js.map +1 -1
  31. package/build/development/shared/components/Input/index.js +8 -9
  32. package/build/development/shared/components/Input/index.js.map +1 -1
  33. package/build/development/shared/components/Link.js +10 -9
  34. package/build/development/shared/components/Link.js.map +1 -1
  35. package/build/development/shared/components/MetaTags.js +22 -18
  36. package/build/development/shared/components/MetaTags.js.map +1 -1
  37. package/build/development/shared/components/Modal/index.js +17 -18
  38. package/build/development/shared/components/Modal/index.js.map +1 -1
  39. package/build/development/shared/components/NavLink.js +10 -9
  40. package/build/development/shared/components/NavLink.js.map +1 -1
  41. package/build/development/shared/components/PageLayout/index.js +17 -20
  42. package/build/development/shared/components/PageLayout/index.js.map +1 -1
  43. package/build/development/shared/components/ScalableRect/index.js +27 -7
  44. package/build/development/shared/components/ScalableRect/index.js.map +1 -1
  45. package/build/development/shared/components/Throbber/index.js +14 -23
  46. package/build/development/shared/components/Throbber/index.js.map +1 -1
  47. package/build/development/shared/components/WithTooltip/Tooltip.js +20 -24
  48. package/build/development/shared/components/WithTooltip/Tooltip.js.map +1 -1
  49. package/build/development/shared/components/WithTooltip/index.js +11 -11
  50. package/build/development/shared/components/WithTooltip/index.js.map +1 -1
  51. package/build/development/shared/components/YouTubeVideo/index.js +16 -15
  52. package/build/development/shared/components/YouTubeVideo/index.js.map +1 -1
  53. package/build/development/shared/components/index.js +2 -2
  54. package/build/development/shared/components/index.js.map +1 -1
  55. package/build/development/shared/utils/config.js +1 -2
  56. package/build/development/shared/utils/config.js.map +1 -1
  57. package/build/development/shared/utils/globalState.js +15 -0
  58. package/build/development/shared/utils/globalState.js.map +1 -0
  59. package/build/development/shared/utils/index.js +13 -11
  60. package/build/development/shared/utils/index.js.map +1 -1
  61. package/build/development/shared/utils/isomorphy/buildInfo.js +7 -3
  62. package/build/development/shared/utils/isomorphy/buildInfo.js.map +1 -1
  63. package/build/development/shared/utils/isomorphy/environment-check.js +2 -4
  64. package/build/development/shared/utils/isomorphy/environment-check.js.map +1 -1
  65. package/build/development/shared/utils/isomorphy/index.js.map +1 -1
  66. package/build/development/shared/utils/jest/E2eSsrEnv.js +35 -28
  67. package/build/development/shared/utils/jest/E2eSsrEnv.js.map +1 -1
  68. package/build/development/shared/utils/jest/global.js +17 -0
  69. package/build/development/shared/utils/jest/global.js.map +1 -0
  70. package/build/development/shared/utils/jest/index.js +18 -11
  71. package/build/development/shared/utils/jest/index.js.map +1 -1
  72. package/build/development/shared/utils/splitComponent.js +25 -34
  73. package/build/development/shared/utils/splitComponent.js.map +1 -1
  74. package/build/development/shared/utils/time.js +16 -13
  75. package/build/development/shared/utils/time.js.map +1 -1
  76. package/build/development/shared/utils/webpack.js +3 -3
  77. package/build/development/shared/utils/webpack.js.map +1 -1
  78. package/build/development/web.bundle.js +92 -82
  79. package/build/production/client/getInj.js +1 -1
  80. package/build/production/client/getInj.js.map +1 -1
  81. package/build/production/client/index.js +4 -4
  82. package/build/production/client/index.js.map +1 -1
  83. package/build/production/client/init.js +3 -1
  84. package/build/production/client/init.js.map +1 -1
  85. package/build/production/index.js +1 -1
  86. package/build/production/index.js.map +1 -1
  87. package/build/production/server/Cache.js +7 -8
  88. package/build/production/server/Cache.js.map +1 -1
  89. package/build/production/server/index.js +5 -4
  90. package/build/production/server/index.js.map +1 -1
  91. package/build/production/server/renderer.js +32 -30
  92. package/build/production/server/renderer.js.map +1 -1
  93. package/build/production/server/server.js +7 -5
  94. package/build/production/server/server.js.map +1 -1
  95. package/build/production/server/utils/errors.js +9 -10
  96. package/build/production/server/utils/errors.js.map +1 -1
  97. package/build/production/server/utils/index.js +1 -1
  98. package/build/production/server/utils/index.js.map +1 -1
  99. package/build/production/shared/components/Button/index.js +4 -4
  100. package/build/production/shared/components/Button/index.js.map +1 -1
  101. package/build/production/shared/components/Checkbox/index.js +12 -12
  102. package/build/production/shared/components/Checkbox/index.js.map +1 -1
  103. package/build/production/shared/components/Dropdown/index.js +11 -11
  104. package/build/production/shared/components/Dropdown/index.js.map +1 -1
  105. package/build/production/shared/components/GenericLink/index.js +25 -20
  106. package/build/production/shared/components/GenericLink/index.js.map +1 -1
  107. package/build/production/shared/components/Input/index.js +7 -7
  108. package/build/production/shared/components/Input/index.js.map +1 -1
  109. package/build/production/shared/components/Link.js +2 -2
  110. package/build/production/shared/components/Link.js.map +1 -1
  111. package/build/production/shared/components/MetaTags.js +10 -10
  112. package/build/production/shared/components/MetaTags.js.map +1 -1
  113. package/build/production/shared/components/Modal/index.js +2 -2
  114. package/build/production/shared/components/Modal/index.js.map +1 -1
  115. package/build/production/shared/components/NavLink.js +1 -1
  116. package/build/production/shared/components/NavLink.js.map +1 -1
  117. package/build/production/shared/components/PageLayout/index.js +2 -2
  118. package/build/production/shared/components/PageLayout/index.js.map +1 -1
  119. package/build/production/shared/components/ScalableRect/index.js +7 -3
  120. package/build/production/shared/components/ScalableRect/index.js.map +1 -1
  121. package/build/production/shared/components/Throbber/index.js +2 -2
  122. package/build/production/shared/components/Throbber/index.js.map +1 -1
  123. package/build/production/shared/components/WithTooltip/Tooltip.js +13 -13
  124. package/build/production/shared/components/WithTooltip/Tooltip.js.map +1 -1
  125. package/build/production/shared/components/WithTooltip/index.js +3 -3
  126. package/build/production/shared/components/WithTooltip/index.js.map +1 -1
  127. package/build/production/shared/components/YouTubeVideo/index.js +7 -7
  128. package/build/production/shared/components/YouTubeVideo/index.js.map +1 -1
  129. package/build/production/shared/components/index.js +1 -1
  130. package/build/production/shared/components/index.js.map +1 -1
  131. package/build/production/shared/utils/config.js +1 -1
  132. package/build/production/shared/utils/config.js.map +1 -1
  133. package/build/production/shared/utils/globalState.js +3 -0
  134. package/build/production/shared/utils/globalState.js.map +1 -0
  135. package/build/production/shared/utils/index.js +3 -3
  136. package/build/production/shared/utils/index.js.map +1 -1
  137. package/build/production/shared/utils/isomorphy/buildInfo.js +7 -4
  138. package/build/production/shared/utils/isomorphy/buildInfo.js.map +1 -1
  139. package/build/production/shared/utils/isomorphy/environment-check.js +2 -2
  140. package/build/production/shared/utils/isomorphy/environment-check.js.map +1 -1
  141. package/build/production/shared/utils/isomorphy/index.js.map +1 -1
  142. package/build/production/shared/utils/jest/E2eSsrEnv.js +9 -9
  143. package/build/production/shared/utils/jest/E2eSsrEnv.js.map +1 -1
  144. package/build/production/shared/utils/jest/global.js +2 -0
  145. package/build/production/shared/utils/jest/global.js.map +1 -0
  146. package/build/production/shared/utils/jest/index.js +6 -6
  147. package/build/production/shared/utils/jest/index.js.map +1 -1
  148. package/build/production/shared/utils/splitComponent.js +16 -16
  149. package/build/production/shared/utils/splitComponent.js.map +1 -1
  150. package/build/production/shared/utils/time.js +12 -8
  151. package/build/production/shared/utils/time.js.map +1 -1
  152. package/build/production/shared/utils/webpack.js +3 -3
  153. package/build/production/shared/utils/webpack.js.map +1 -1
  154. package/build/production/web.bundle.js +1 -1
  155. package/build/production/web.bundle.js.map +1 -1
  156. package/build/types-code/client/getInj.d.ts +3 -0
  157. package/build/types-code/client/index.d.ts +11 -0
  158. package/build/types-code/client/init.d.ts +9 -0
  159. package/build/types-code/index.d.ts +10 -0
  160. package/build/types-code/server/Cache.d.ts +37 -0
  161. package/build/types-code/server/index.d.ts +145 -0
  162. package/build/types-code/server/renderer.d.ts +106 -0
  163. package/build/types-code/server/server.d.ts +41 -0
  164. package/build/types-code/server/utils/errors.d.ts +104 -0
  165. package/build/types-code/server/utils/index.d.ts +1 -0
  166. package/build/types-code/shared/components/Button/index.d.ts +27 -0
  167. package/build/types-code/shared/components/Checkbox/index.d.ts +21 -0
  168. package/build/types-code/shared/components/Dropdown/index.d.ts +23 -0
  169. package/build/types-code/shared/components/GenericLink/index.d.ts +61 -0
  170. package/build/types-code/shared/components/Input/index.d.ts +11 -0
  171. package/build/types-code/shared/components/Link.d.ts +12 -0
  172. package/build/types-code/shared/components/MetaTags.d.ts +68 -0
  173. package/build/types-code/shared/components/Modal/index.d.ts +26 -0
  174. package/build/types-code/shared/components/NavLink.d.ts +5 -0
  175. package/build/types-code/shared/components/PageLayout/index.d.ts +16 -0
  176. package/build/types-code/shared/components/ScalableRect/index.d.ts +19 -0
  177. package/build/types-code/shared/components/Throbber/index.d.ts +9 -0
  178. package/build/types-code/shared/components/WithTooltip/Tooltip.d.ts +23 -0
  179. package/build/types-code/shared/components/WithTooltip/index.d.ts +17 -0
  180. package/build/types-code/shared/components/YouTubeVideo/index.d.ts +13 -0
  181. package/build/types-code/shared/components/index.d.ts +16 -0
  182. package/build/types-code/shared/utils/config.d.ts +2 -0
  183. package/build/types-code/shared/utils/globalState.d.ts +20 -0
  184. package/build/types-code/shared/utils/index.d.ts +52 -0
  185. package/build/types-code/shared/utils/isomorphy/buildInfo.d.ts +23 -0
  186. package/build/types-code/shared/utils/isomorphy/environment-check.d.ts +11 -0
  187. package/build/types-code/shared/utils/isomorphy/index.d.ts +20 -0
  188. package/build/types-code/shared/utils/jest/E2eSsrEnv.d.ts +31 -0
  189. package/build/types-code/shared/utils/jest/global.d.ts +12 -0
  190. package/build/types-code/shared/utils/jest/index.d.ts +85 -0
  191. package/build/types-code/shared/utils/splitComponent.d.ts +41 -0
  192. package/build/types-code/shared/utils/time.d.ts +62 -0
  193. package/build/types-code/shared/utils/webpack.d.ts +18 -0
  194. package/build/types-scss/__tests__/js/config/publicPath support/__assets__/style.scss.d.ts +1 -0
  195. package/build/types-scss/__tests__/js/config/stylename-generation/__assets__/MockPackageA/TestComponent/style.scss.d.ts +1 -0
  196. package/build/types-scss/__tests__/js/config/stylename-generation/__assets__/MockPackageB/TestComponent/style.scss.d.ts +1 -0
  197. package/build/types-scss/__tests__/js/config/stylename-generation/__assets__/style.scss.d.ts +1 -0
  198. package/build/types-scss/__tests__/js/shared/components/NavLink/styles.scss.d.ts +1 -0
  199. package/build/types-scss/__tests__/js/shared/utils/splitComponent/__assets__/SampleScene/ComponentA/style.scss.d.ts +1 -0
  200. package/build/types-scss/__tests__/js/shared/utils/splitComponent/__assets__/SampleScene/ComponentB/style.scss.d.ts +1 -0
  201. package/build/types-scss/__tests__/js/shared/utils/splitComponent/__assets__/SampleScene/ComponentC/style.scss.d.ts +1 -0
  202. package/build/types-scss/__tests__/js/shared/utils/splitComponent/__assets__/SampleScene/style.scss.d.ts +1 -0
  203. package/build/types-scss/__tests__/ts/config/publicPath support/__assets__/style.scss.d.ts +1 -0
  204. package/build/types-scss/__tests__/ts/config/stylename-generation/__assets__/MockPackageA/TestComponent/style.scss.d.ts +1 -0
  205. package/build/types-scss/__tests__/ts/config/stylename-generation/__assets__/MockPackageB/TestComponent/style.scss.d.ts +1 -0
  206. package/build/types-scss/__tests__/ts/config/stylename-generation/__assets__/style.scss.d.ts +1 -0
  207. package/build/types-scss/__tests__/ts/shared/components/NavLink/styles.scss.d.ts +1 -0
  208. package/build/types-scss/__tests__/ts/shared/utils/splitComponent/__assets__/SampleScene/ComponentA/style.scss.d.ts +1 -0
  209. package/build/types-scss/__tests__/ts/shared/utils/splitComponent/__assets__/SampleScene/ComponentB/style.scss.d.ts +1 -0
  210. package/build/types-scss/__tests__/ts/shared/utils/splitComponent/__assets__/SampleScene/ComponentC/style.scss.d.ts +1 -0
  211. package/build/types-scss/__tests__/ts/shared/utils/splitComponent/__assets__/SampleScene/style.scss.d.ts +1 -0
  212. package/build/types-scss/src/shared/components/Button/style.scss.d.ts +6 -0
  213. package/build/types-scss/src/shared/components/Checkbox/theme.scss.d.ts +6 -0
  214. package/build/types-scss/src/shared/components/Dropdown/theme.scss.d.ts +9 -0
  215. package/build/types-scss/src/shared/components/GenericLink/style.scss.d.ts +1 -0
  216. package/build/types-scss/src/shared/components/Input/theme.scss.d.ts +6 -0
  217. package/build/types-scss/src/shared/components/Modal/base-theme.scss.d.ts +5 -0
  218. package/build/types-scss/src/shared/components/PageLayout/base-theme.scss.d.ts +6 -0
  219. package/build/types-scss/src/shared/components/ScalableRect/style.scss.d.ts +2 -0
  220. package/build/types-scss/src/shared/components/Throbber/theme.scss.d.ts +6 -0
  221. package/build/types-scss/src/shared/components/WithTooltip/default-theme.scss.d.ts +7 -0
  222. package/build/types-scss/src/shared/components/YouTubeVideo/base.scss.d.ts +5 -0
  223. package/build/types-scss/src/shared/components/YouTubeVideo/throbber.scss.d.ts +4 -0
  224. package/config/eslint/jest.json +3 -2
  225. package/config/eslint/typescript.js +34 -0
  226. package/config/jest/default.js +3 -3
  227. package/package.json +75 -33
  228. package/src/client/getInj.ts +43 -0
  229. package/src/client/index.tsx +40 -0
  230. package/src/client/init.ts +47 -0
  231. package/src/index.ts +58 -0
  232. package/src/server/Cache.ts +68 -0
  233. package/src/server/index.ts +230 -0
  234. package/src/server/renderer.tsx +604 -0
  235. package/src/server/server.ts +309 -0
  236. package/src/server/utils/errors.ts +135 -0
  237. package/src/server/utils/index.ts +3 -0
  238. package/src/shared/components/Button/index.tsx +146 -0
  239. package/src/shared/components/Button/style.scss +53 -0
  240. package/src/shared/components/Checkbox/index.tsx +71 -0
  241. package/src/shared/components/Checkbox/theme.scss +43 -0
  242. package/src/shared/components/Dropdown/index.tsx +144 -0
  243. package/src/shared/components/Dropdown/theme.scss +63 -0
  244. package/src/shared/components/GenericLink/index.tsx +157 -0
  245. package/src/shared/components/GenericLink/style.scss +3 -0
  246. package/src/shared/components/Input/index.tsx +59 -0
  247. package/src/shared/components/Input/theme.scss +27 -0
  248. package/src/shared/components/Link.tsx +21 -0
  249. package/src/shared/components/MetaTags.tsx +170 -0
  250. package/src/shared/components/Modal/base-theme.scss +38 -0
  251. package/src/shared/components/Modal/index.tsx +144 -0
  252. package/src/shared/components/Modal/styles.scss +5 -0
  253. package/src/shared/components/NavLink.tsx +13 -0
  254. package/src/shared/components/PageLayout/base-theme.scss +30 -0
  255. package/src/shared/components/PageLayout/index.tsx +76 -0
  256. package/src/shared/components/ScalableRect/index.tsx +84 -0
  257. package/src/shared/components/ScalableRect/style.scss +10 -0
  258. package/src/shared/components/Throbber/index.tsx +43 -0
  259. package/src/shared/components/Throbber/theme.scss +26 -0
  260. package/src/shared/components/WithTooltip/Tooltip.tsx +353 -0
  261. package/src/shared/components/WithTooltip/default-theme.scss +36 -0
  262. package/src/shared/components/WithTooltip/index.tsx +204 -0
  263. package/src/shared/components/YouTubeVideo/base.scss +13 -0
  264. package/src/shared/components/YouTubeVideo/index.tsx +96 -0
  265. package/src/shared/components/YouTubeVideo/throbber.scss +11 -0
  266. package/src/shared/components/index.ts +17 -0
  267. package/src/shared/utils/config.ts +21 -0
  268. package/src/shared/utils/globalState.ts +29 -0
  269. package/src/shared/utils/index.ts +105 -0
  270. package/src/shared/utils/isomorphy/buildInfo.ts +54 -0
  271. package/src/shared/utils/isomorphy/environment-check.ts +18 -0
  272. package/src/shared/utils/isomorphy/index.ts +38 -0
  273. package/src/shared/utils/jest/E2eSsrEnv.ts +250 -0
  274. package/src/shared/utils/jest/global.ts +19 -0
  275. package/src/shared/utils/jest/index.tsx +157 -0
  276. package/src/shared/utils/splitComponent.tsx +255 -0
  277. package/src/shared/utils/time.ts +118 -0
  278. package/src/shared/utils/webpack.ts +45 -0
  279. package/src/styles/_global/reset.css +52 -0
  280. package/src/styles/global.scss +11 -0
  281. package/tsconfig.configs.json +18 -0
  282. package/tsconfig.json +27 -0
  283. package/tsconfig.types.json +53 -0
  284. package/typed-scss-modules.config.ts +9 -0
  285. package/types.d.ts +37 -0
  286. package/{webpack.config.js → webpack.config.ts} +7 -3
  287. package/config/babel/node-ssr.js +0 -85
  288. package/config/babel/webpack.js +0 -122
  289. package/config/webpack/app-base.js +0 -330
  290. package/config/webpack/app-development.js +0 -80
  291. package/config/webpack/app-production.js +0 -60
  292. package/config/webpack/lib-base.js +0 -155
  293. package/config/webpack/lib-development.js +0 -45
  294. package/config/webpack/lib-production.js +0 -44
@@ -0,0 +1,3 @@
1
+ import 'node-forge/lib/aes';
2
+ import type { InjT } from '../shared/utils/globalState';
3
+ export default function getInj(): InjT;
@@ -0,0 +1,11 @@
1
+ import { type ComponentType } from 'react';
2
+ type OptionsT = {
3
+ dontHydrate?: boolean;
4
+ };
5
+ /**
6
+ * Prepares and launches the app at client side.
7
+ * @param Application Root application component
8
+ * @param [options={}] Optional. Additional settings.
9
+ */
10
+ export default function Launch(Application: ComponentType, options?: OptionsT): void;
11
+ export {};
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Initialization of client-side environment.
3
+ */
4
+ import { type BuildInfoT } from '../shared/utils/isomorphy/buildInfo';
5
+ declare global {
6
+ interface Window {
7
+ __DEV_BUILD_INFO__: BuildInfoT | undefined;
8
+ }
9
+ }
@@ -0,0 +1,10 @@
1
+ import 'styles/global.scss';
2
+ import type ServerT from './server';
3
+ declare const server: typeof ServerT | null;
4
+ declare const client: any;
5
+ export { default as api } from 'axios';
6
+ export * as PT from 'prop-types';
7
+ export { default as Rgs, type API as RgsApi, getGlobalState, GlobalStateProvider, useAsyncCollection, useAsyncData, useGlobalState, } from '@dr.pogodin/react-global-state';
8
+ export { BaseModal, Button, Checkbox, Dropdown, Input, Link, PageLayout, MetaTags, Modal, NavLink, ScalableRect, Throbber, WithTooltip, YouTubeVideo, } from './shared/components';
9
+ export { type Theme, config, Barrier, Emitter, isomorphy, getSsrContext, JU, Semaphore, splitComponent, themed, ThemeProvider, time, webpack, withRetries, } from './shared/utils';
10
+ export { client, server };
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Implements the static cache.
3
+ */
4
+ export default class Cache<DatumT> {
5
+ private: {
6
+ items: {
7
+ [key: string]: {
8
+ data: DatumT;
9
+ size: number;
10
+ timestamp: number;
11
+ };
12
+ };
13
+ maxSize: number;
14
+ size: number;
15
+ };
16
+ constructor(maxSize: number);
17
+ /**
18
+ * Cache lookup.
19
+ * @param key Item key to look for.
20
+ * @param [maxage=Number.MAX_VALUE] Optional. The maximum age of
21
+ * cached item to serve. Default to infinite.
22
+ * @returns Cached item, or null if the item is absent in cache,
23
+ * or stale.
24
+ */
25
+ get({ key, maxage, }: {
26
+ key: string;
27
+ maxage?: number;
28
+ }): DatumT | null;
29
+ /**
30
+ * Adds item to cache.
31
+ * @ignore
32
+ * @param data Item to add.
33
+ * @param key Key to store the item at.
34
+ * @param size Byte size of the item.
35
+ */
36
+ add(data: DatumT, key: string, size: number): void;
37
+ }
@@ -0,0 +1,145 @@
1
+ /// <reference types="express" />
2
+ /// <reference types="node" />
3
+ import 'source-map-support/register';
4
+ import http from 'http';
5
+ import 'raf/polyfill';
6
+ import { type Configuration } from 'webpack';
7
+ import { type OptionsT as ServerOptionsT } from './server';
8
+ export { getDefaultCspSettings, } from './server';
9
+ export { errors } from './utils';
10
+ type OptionsT = ServerOptionsT & {
11
+ https?: {
12
+ cert: string;
13
+ key: string;
14
+ };
15
+ port?: false | number | string;
16
+ };
17
+ /**
18
+ * Creates and launches web-server for ReactJS application. Allows zero
19
+ * or detailed configuration, supports server-side rendering,
20
+ * and development tools, including Hot Module Reloading (HMR).
21
+ *
22
+ * NOTE: Many of options defined below are passed down to the server and
23
+ * renderer factories, and their declared default values are set in those
24
+ * factories, rather than here.
25
+ *
26
+ * @param {object} webpackConfig Webpack configuration used to build
27
+ * the frontend bundle. In production mode the server will read out of it
28
+ * `context`, `publicPath`, and a few other parameters, necessary to locate
29
+ * and serve the app bundle. In development mode the server will use entire
30
+ * provided config to build the app bundle in memory, and further watch and
31
+ * update it via HMR.
32
+ * @param {object} [options] Additional parameters.
33
+ * @param {Component} [options.Application] The root ReactJS component of
34
+ * the app to use for the server-side rendering. When not provided
35
+ * the server-side rendering is disabled.
36
+ * @param {function} [options.beforeExpressJsError] Asynchronous callback
37
+ * (`(server) => Promise<boolean>`) to be executed just before the default error
38
+ * handler is added to ExpressJS server. If the callback is provided and its
39
+ * result resolves to a truthy value, `react-utils` won't attach the default
40
+ * error handler.
41
+ * @param {function} [options.beforeExpressJsSetup] Asynchronous callback
42
+ * (`(server) => Promise) to be executed right after ExpressJS server creation,
43
+ * before any configuration is performed.
44
+ * @param {BeforeRenderHook} [options.beforeRender] The hook to run just before
45
+ * the server-side rendering. For each incoming request, it will be executed
46
+ * just before the HTML markup is generated at the server. It allows to load
47
+ * and provide the data necessary for server-side rendering, and also to inject
48
+ * additional configuration and scripts into the generated HTML code.
49
+ * @param {boolean} [options.noCsp] Set `true` to disable
50
+ * Content-Security-Policy (CSP) headers altogether.
51
+ * @param {function} [options.cspSettingsHook] A hook allowing
52
+ * to customize [CSP](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP)
53
+ * settings for [helmet](https://github.com/helmetjs/helmet)'s
54
+ * `contentSecurityPolicy` middleware on per-request basis.
55
+ *
56
+ * If provided it should be a with signature: \
57
+ * `(defaultSettings: object, req: object)` &rArr; `object` \
58
+ * which gets the default settings (also used without the hook),
59
+ * and the incoming request object. The hook response will be passed
60
+ * as options to the helmet `contentSecurityPolicy` middleware.
61
+ *
62
+ * Currently, the default settings is the following object in production
63
+ * environment:
64
+ * ```js
65
+ * {
66
+ * directives: {
67
+ * defaultSrc: ["'self'"],
68
+ * baseUri: ["'self'"],
69
+ * blockAllMixedContent: [],
70
+ * fontSrc: ["'self'", 'https:', 'data:'],
71
+ * frameAncestors: ["'self'"],
72
+ * frameSrc: ["'self'", 'https://*.youtube.com'],
73
+ * imgSrc: ["'self'", 'data:'],
74
+ * objectSrc: ["'none'"],
75
+ * scriptSrc: ["'self'", "'unsafe-eval'", `'nonce-UNIQUE_NONCE_VALUE'`],
76
+ * scriptSrcAttr: ["'none'"],
77
+ * styleSrc: ["'self'", 'https:', "'unsafe-inline'"],
78
+ * upgradeInsecureRequests: [] // Removed in dev mode.
79
+ * }
80
+ * }
81
+ * ```
82
+ * It matches the default value used by Helmet with a few updates:
83
+ * - YouTube host is whitelisted in the `frameSrc` directive to ensure
84
+ * the {@link YouTubeVideo} component works.
85
+ * - An unique per-request nonce is added to `scriptSrc` directive to
86
+ * whitelist auxiliary scripts injected by react-utils. The actual nonce
87
+ * value can be fetched by host code via `.nonce` field of `req` argument
88
+ * of `.beforeRender` hook.
89
+ * - `upgradeInsecureRequests` directive is removed in development mode,
90
+ * to simplify local testing with http requests.
91
+ * @param {string} [options.defaultLoggerLogLevel='info'] Log level for
92
+ * the default logger, which is created if no `logger` option provided.
93
+ * @param {boolean} [options.devMode] Pass in `true` to start the server in
94
+ * development mode.
95
+ * @param {string} [options.favicon] Path to the favicon to use by the server.
96
+ * By default no favicon is used.
97
+ * @param {object} [options.https] If provided, HTTPS server will be started,
98
+ * instead of HTTP otherwise. The object should provide SSL certificate and key
99
+ * via two string fields: `cert`, and `key`.
100
+ * @param {string} [options.https.cert] SSL Certificate.
101
+ * @param {string} [options.https.key] SSL key.
102
+ * @param {boolean} [options.httpsRedirect=true] Pass in `true` to enable
103
+ * automatic redirection of all incoming HTTP requests to HTTPS.
104
+ *
105
+ * To smoothly use it at `localhost` you need to run the server in HTTPS mode,
106
+ * and also properly create and install a self-signed SSL sertificate on your
107
+ * system. This article is helpful:
108
+ * [How to get HTTPS working on your local development environment in 5 minutes](https://medium.freecodecamp.org/how-to-get-https-working-on-your-local-development-environment-in-5-minutes-7af615770eec)
109
+ * @param {Logger} [options.logger] The logger to use at server side.
110
+ * By default [`winston`](https://www.npmjs.com/package/winston) logger
111
+ * with console transport is used. The logger you provide, or the default
112
+ * `winston` logger otherwise, will be attached to the created ExpressJS server
113
+ * object.
114
+ * @param {function} [options.onExpressJsSetup] An async callback
115
+ * (`(server) => Promise`) to be triggered when most of the server
116
+ * configuration is completed, just before the server-side renderer,
117
+ * and the default error handler are attached. You can use it to mount
118
+ * custom API routes. The server-side logger can be accessed as `server.logger`.
119
+ * @param {number|string} [options.port=3000] The port to start the server on.
120
+ * @param {number} [options.staticCacheSize=1.e7] The maximum
121
+ * static cache size in bytes. Defaults to ~10 MB.
122
+ * @param {function} [options.staticCacheController] When given, it activates,
123
+ * and controls the static caching of generated HTML markup. When this function
124
+ * is provided, on each incoming request it is triggered with the request
125
+ * passed in as the argument. To attempt to serve the response from the cache
126
+ * it should return the object with the following fields:
127
+ * - `key: string` &ndash; the cache key for the response;
128
+ * - `maxage?: number` &ndash; the maximum age of cached result in ms.
129
+ * If undefined - infinite age is assumed.
130
+ * @param {number} [options.maxSsrRounds=10] Maximum number of SSR rounds.
131
+ * @param {number} [options.ssrTimeout=1000] SSR timeout in milliseconds,
132
+ * defaults to 1 second.
133
+ * @return {Promise<{ expressServer: object, httpServer: object }>} Resolves to
134
+ * an object with created Express and HTTP servers.
135
+ */
136
+ declare function launchServer(webpackConfig: Configuration, options: OptionsT): Promise<{
137
+ expressServer: import("express").Express & {
138
+ logger: import("./renderer").LoggerI;
139
+ };
140
+ httpServer: http.Server;
141
+ }>;
142
+ declare namespace launchServer {
143
+ var SCRIPT_LOCATIONS: typeof import("./renderer").SCRIPT_LOCATIONS;
144
+ }
145
+ export default launchServer;
@@ -0,0 +1,106 @@
1
+ /**
2
+ * ExpressJS middleware for server-side rendering of a ReactJS app.
3
+ */
4
+ import { type Request, type RequestHandler } from 'express';
5
+ import { type ComponentType } from 'react';
6
+ import winston from 'winston';
7
+ import { type BuildInfoT } from '../shared/utils/isomorphy/buildInfo';
8
+ import { type Configuration } from 'webpack';
9
+ interface LogMethodI {
10
+ (level: string, message: string, ...meta: any[]): void;
11
+ }
12
+ interface LeveledLogMethodI {
13
+ (message: string, ...meta: any[]): void;
14
+ }
15
+ export interface LoggerI {
16
+ debug: LeveledLogMethodI;
17
+ error: LeveledLogMethodI;
18
+ info: LeveledLogMethodI;
19
+ log: LogMethodI;
20
+ warn: LeveledLogMethodI;
21
+ }
22
+ export declare enum SCRIPT_LOCATIONS {
23
+ BODY_OPEN = "BODY_OPEN",
24
+ DEFAULT = "DEFAULT",
25
+ HEAD_OPEN = "HEAD_OPEN"
26
+ }
27
+ type ScriptT = {
28
+ code: string;
29
+ location: SCRIPT_LOCATIONS;
30
+ };
31
+ /**
32
+ * Given an incoming HTTP requests, it deduces whether Brotli-encoded responses
33
+ * are acceptable to the caller.
34
+ * @param {object} req
35
+ * @return {boolean}
36
+ * @ignore
37
+ */
38
+ export declare function isBrotliAcceptable(req: Request): boolean;
39
+ /**
40
+ * Creates a new default (Winston) logger.
41
+ * @param {object} [options={}]
42
+ * @param {string} [options.defaultLogLevel='info']
43
+ * @return {object}
44
+ */
45
+ export declare function newDefaultLogger({ defaultLogLevel, }?: {
46
+ defaultLogLevel?: string | undefined;
47
+ }): winston.Logger;
48
+ type ConfigT = {
49
+ [key: string]: ConfigT | string;
50
+ };
51
+ type BeforeRenderResT = {
52
+ configToInject?: ConfigT;
53
+ extraScripts?: Array<ScriptT | string>;
54
+ initialState?: any;
55
+ };
56
+ type BeforeRenderT = (req: Request, config: ConfigT) => BeforeRenderResT | Promise<BeforeRenderResT>;
57
+ type CacheRefT = {
58
+ key: string;
59
+ maxage?: number;
60
+ };
61
+ export type OptionsT = {
62
+ Application?: ComponentType;
63
+ beforeRender?: BeforeRenderT;
64
+ buildInfo?: BuildInfoT;
65
+ defaultLoggerLogLevel?: string;
66
+ favicon?: string;
67
+ logger?: LoggerI;
68
+ maxSsrRounds?: number;
69
+ noCsp?: boolean;
70
+ staticCacheSize?: number;
71
+ ssrTimeout?: number;
72
+ staticCacheController?: (req: Request) => CacheRefT;
73
+ };
74
+ /**
75
+ * Creates the middleware.
76
+ * @param webpackConfig
77
+ * @param options Additional options:
78
+ * @param [options.Application] The root ReactJS component of
79
+ * the app to use for the server-side rendering. When not provided
80
+ * the server-side rendering is disabled.
81
+ * @param [options.buildInfo] "Build info" object to use. If provided,
82
+ * it will be used, instead of trying to load from the filesystem the one
83
+ * generated by the Webpack build. It is intended for test environments,
84
+ * where passing this stuff via file system is no bueno.
85
+ * @param [options.favicon] `true` will include favicon
86
+ * link into the rendered HTML templates.
87
+ * @param [options.noCsp] `true` means that no
88
+ * Content-Security-Policy (CSP) is used by server, thus the renderer
89
+ * may cut a few corners.
90
+ * @param [options.maxSsrRounds=10] Maximum number of SSR rounds.
91
+ * @param [options.ssrTimeout=1000] SSR timeout in milliseconds,
92
+ * defaults to 1 second.
93
+ * @param [options.staticCacheSize=1.e7] The maximum
94
+ * static cache size in bytes. Defaults to ~10 MB.
95
+ * @param [options.staticCacheController] When given, it activates,
96
+ * and controls the static caching of generated HTML markup. When this function
97
+ * is provided, on each incoming request it is triggered with the request
98
+ * passed in as the argument. To attempt to serve the response from the cache
99
+ * it should return the object with the following fields:
100
+ * - `key: string` &ndash; the cache key for the response;
101
+ * - `maxage?: number` &ndash; the maximum age of cached result in ms.
102
+ * If undefined - infinite age is assumed.
103
+ * @return Created middleware.
104
+ */
105
+ export default function factory(webpackConfig: Configuration, options: OptionsT): RequestHandler;
106
+ export {};
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Creation of standard ExpressJS server for ReactJS apps.
3
+ */
4
+ import { type Express, type Request } from 'express';
5
+ import { type HelmetOptions } from 'helmet';
6
+ import { type Configuration } from 'webpack';
7
+ import { type LoggerI, type OptionsT as RendererOptionsT } from './renderer';
8
+ export type CspOptionsT = Exclude<HelmetOptions['contentSecurityPolicy'], boolean | undefined>;
9
+ /**
10
+ * @category Utilities
11
+ * @func server/getDefaultCspSettings
12
+ * @global
13
+ * @desc
14
+ * ```js
15
+ * import { server } from '@dr.pogodin/react-utils';
16
+ * const { getDefaultCspSettings } from '@dr.pogodin/react-utils';
17
+ * ```
18
+ * @return {{
19
+ * directives: object
20
+ * }} A deep copy of default CSP settings object used by `react-utils`,
21
+ * with the exception of `nonce-xxx` clause in `script-src` directive,
22
+ * which is added dynamically for each request.
23
+ */
24
+ export declare function getDefaultCspSettings(): {
25
+ directives: {
26
+ [x: string]: string[];
27
+ };
28
+ };
29
+ type ServerT = Express & {
30
+ logger: LoggerI;
31
+ };
32
+ export type OptionsT = RendererOptionsT & {
33
+ beforeExpressJsError?: (server: ServerT) => Promise<boolean>;
34
+ beforeExpressJsSetup?: (server: ServerT) => Promise<void>;
35
+ cspSettingsHook?: (defaultOptions: CspOptionsT, req: Request) => CspOptionsT;
36
+ devMode?: boolean;
37
+ httpsRedirect?: boolean;
38
+ onExpressJsSetup?: (server: ServerT) => Promise<void> | void;
39
+ };
40
+ export default function factory(webpackConfig: Configuration, options: OptionsT): Promise<ServerT>;
41
+ export {};
@@ -0,0 +1,104 @@
1
+ /**
2
+ * @category Utilities
3
+ * @module server/errors
4
+ * @desc
5
+ * ```js
6
+ * import { server } from '@dr.pogodin/react-utils';
7
+ * const { errors } = server;
8
+ * ```
9
+ * Server-side helpers for error handling.
10
+ */
11
+ import { StatusCodes as CODES, ReasonPhrases as ERRORS, getReasonPhrase as getErrorForCode } from 'http-status-codes';
12
+ import joi from 'joi';
13
+ /**
14
+ * @static
15
+ * @const CODES
16
+ * @desc An alias for
17
+ * [StatusCodes object from **http-status-codes** library](https://www.npmjs.com/package/http-status-codes).
18
+ * It is a map between HTTP status code names and corresponding numeric codes.
19
+ * @example
20
+ * import { server } from '@dr.pogodin/react-utils';
21
+ * const { CODES } = server.errors;
22
+ * console.log(CODES.BAD_REQUEST); // Prints: 400
23
+ */
24
+ export { CODES };
25
+ /**
26
+ * @static
27
+ * @const ERRORS
28
+ * @desc An alias for
29
+ * [ReasonPhrases object from **http-status-codes** library](https://www.npmjs.com/package/http-status-codes).
30
+ * It is a map between HTTP status code names and their pretty-printed forms.
31
+ * @example
32
+ * import { server } from '@dr.pogodin/react-utils';
33
+ * const { ERRORS } = server.errors;
34
+ * console.log(ERRORS.BAD_REQUEST); // Prints: Bad Request
35
+ */
36
+ export { ERRORS };
37
+ /**
38
+ * @static
39
+ * @func getErrorForCode
40
+ * @desc An alias for
41
+ * [getReasonPhrase() function from **http-status-codes** library](https://www.npmjs.com/package/http-status-codes).
42
+ * Given an HTTP code it returns the corresponding error text.
43
+ * @param {number} code HTTP code.
44
+ * @return {string} HTTP error text.
45
+ * @example
46
+ * import { server } from '@dr.pogodin/react-utils';
47
+ * console.log(server.errors.getErrorForCode(400)); // Prints: Bad Request
48
+ */
49
+ export { getErrorForCode };
50
+ /**
51
+ * @static
52
+ * @const joi
53
+ * @desc An alias for [Joi library](https://joi.dev/api/?v=17.4.0),
54
+ * which provides tooling for HTTP request validation. You can use it in any
55
+ * way you would use that library import.
56
+ * @example
57
+ * import { server } from '@dr.pogodin/react-utils';
58
+ * const { joi } = server.errors;
59
+ * const requestBodySchema = joi.object({
60
+ * sampleKey: joi.string().max(16).required(),
61
+ * });
62
+ */
63
+ export { joi };
64
+ declare class ErrorWithStatus extends Error {
65
+ status: number;
66
+ }
67
+ /**
68
+ * ```js
69
+ * import { server } from '@dr.pogodin/react-utils';
70
+ * const { newError } = server.errors;
71
+ * ```
72
+ * Creates a new `Error` object with given message, and HTTP status code
73
+ * attached as `status` field.
74
+ * @param {string} message Error message.
75
+ * @param {number} [statusCode=500] HTTP status code. Defaults to 500 (Internal
76
+ * Server Error).
77
+ * @return {Error}
78
+ */
79
+ export declare function newError(message: string, statusCode?: CODES): ErrorWithStatus;
80
+ /**
81
+ * ```js
82
+ * import { server } from '@dr.pogodin/react-utils';
83
+ * const { fail } = server.errors;
84
+ * ```
85
+ * Throws an error with given message and HTTP status code.
86
+ * @param message Error message.
87
+ * @param [statusCode=500] HTTP error code. Defaults to 500 (Internal
88
+ * Server Error).
89
+ */
90
+ export declare function fail(message: string, statusCode?: CODES): void;
91
+ /**
92
+ * ```js
93
+ * import { server } from '@dr.pogodin/react-utils';
94
+ * const { assert } = server.errors;
95
+ * ```
96
+ * Validates a value using given Joi schema, and throws an error with given
97
+ * message and HTTP status code in case of the validation failure.
98
+ * @param value
99
+ * @param schema
100
+ * @param [message] Error message.
101
+ * @param [statusCode=500] HTTP status code. Defaults to 400 (Bad
102
+ * Request).
103
+ */
104
+ export declare function assert(value: any, schema: joi.AnySchema, message?: string, statusCode?: CODES): void;
@@ -0,0 +1 @@
1
+ export * as errors from './errors';
@@ -0,0 +1,27 @@
1
+ import { type ReactNode } from 'react';
2
+ import { type Theme } from '@dr.pogodin/react-themes';
3
+ type PropsT = {
4
+ active?: boolean;
5
+ children?: ReactNode;
6
+ disabled?: boolean;
7
+ enforceA?: boolean;
8
+ onClick?: React.MouseEventHandler & React.KeyboardEventHandler;
9
+ onMouseDown?: React.MouseEventHandler;
10
+ openNewTab?: boolean;
11
+ replace?: boolean;
12
+ theme: Theme & {
13
+ active?: string;
14
+ button?: string;
15
+ disabled?: string;
16
+ };
17
+ to?: object | string;
18
+ };
19
+ /**
20
+ * Button component theme: a map of CSS
21
+ * class names to append to button elements:
22
+ * @prop {string} [active] to the root element of active button.
23
+ * @prop {string} [button] to the root element of any button.
24
+ * @prop {string} [disabled] to the root element of disabled button.
25
+ */
26
+ declare const ThemedButton: import("@dr.pogodin/react-themes").ThemedComponent<PropsT>;
27
+ export default ThemedButton;
@@ -0,0 +1,21 @@
1
+ /// <reference types="react" />
2
+ import { type Theme } from '@dr.pogodin/react-themes';
3
+ type PropT = {
4
+ checked?: boolean;
5
+ label?: string;
6
+ onChange?: React.ChangeEventHandler<HTMLInputElement>;
7
+ theme: Theme & {
8
+ checkbox?: string;
9
+ container?: string;
10
+ label?: string;
11
+ };
12
+ };
13
+ /**
14
+ * Checkbox component theme: a map of
15
+ * CSS classes to append to its elements:
16
+ * @prop [checkbox] to the underlying checkbox `<input>` element.
17
+ * @prop [container] to the root checkbox element.
18
+ * @prop [label] to the checkbox label element.
19
+ */
20
+ declare const ThemedCheckbox: import("@dr.pogodin/react-themes").ThemedComponent<PropT>;
21
+ export default ThemedCheckbox;
@@ -0,0 +1,23 @@
1
+ /// <reference types="react" />
2
+ import { type Theme } from '@dr.pogodin/react-themes';
3
+ type DropdownOptionT = {
4
+ name?: string | null;
5
+ value: string;
6
+ };
7
+ type PropsT = {
8
+ filter?: (item: DropdownOptionT | string) => boolean;
9
+ label?: string;
10
+ onChange?: React.ChangeEventHandler<HTMLSelectElement>;
11
+ options?: Array<DropdownOptionT | string>;
12
+ theme: Theme & {
13
+ arrow?: string;
14
+ container?: string;
15
+ hiddenOption?: string;
16
+ label?: string;
17
+ option?: string;
18
+ select?: string;
19
+ };
20
+ value?: string;
21
+ };
22
+ declare const ThemedDropdown: import("@dr.pogodin/react-themes").ThemedComponent<PropsT>;
23
+ export default ThemedDropdown;
@@ -0,0 +1,61 @@
1
+ import { type ReactNode } from 'react';
2
+ import { type Link } from 'react-router-dom';
3
+ import './style.scss';
4
+ type ToT = Parameters<typeof Link>[0]['to'];
5
+ interface LinkI {
6
+ }
7
+ export type PropsT = {
8
+ children?: ReactNode;
9
+ className?: string;
10
+ disabled?: boolean;
11
+ enforceA?: boolean;
12
+ keepScrollPosition?: boolean;
13
+ onClick?: React.MouseEventHandler<HTMLAnchorElement>;
14
+ onMouseDown?: React.MouseEventHandler<HTMLAnchorElement>;
15
+ openNewTab?: boolean;
16
+ replace?: boolean;
17
+ routerLinkType: LinkI;
18
+ to?: ToT;
19
+ };
20
+ /**
21
+ * The `<Link>` component, and almost identical `<NavLink>` component, are
22
+ * auxiliary wrappers around
23
+ * [React Router](https://github.com/ReactTraining/react-router)'s
24
+ * `<Link>` and `<NavLink>` components; they help to handle external and
25
+ * internal links in uniform manner.
26
+ *
27
+ * @param [props] Component properties.
28
+ * @param [props.className] CSS classes to apply to the link.
29
+ * @param [props.disabled] Disables the link.
30
+ * @param [props.enforceA] `true` enforces rendering of the link as
31
+ * a simple `<a>` element.
32
+ * @param [props.keepScrollPosition] If `true`, and the link is
33
+ * rendered as a React Router's component, it won't reset the viewport scrolling
34
+ * position to the origin when clicked.
35
+ * @param [props.onClick] Event handler to trigger upon click.
36
+ * @param [props.onMouseDown] Event handler to trigger on MouseDown
37
+ * event.
38
+ * @param [props.openNewTab] If `true` the link opens in a new tab.
39
+ * @param [props.replace] When `true`, the link will replace current
40
+ * entry in the history stack instead of adding a new one.
41
+ * @param [props.to] Link URL.
42
+ * @param [props.activeClassName] **`<NavLink>`** only: CSS class(es)
43
+ * to apply to rendered link when it is active.
44
+ * @param [props.activeStyle] **`<NavLink>`** only: CSS styles
45
+ * to apply to the rendered link when it is active.
46
+ * @param [props.exact] **`<NavLink>`** only: if `true`, the active
47
+ * class/style will only be applied if the location is matched exactly.
48
+ * @param [props.isActive] **`<NavLink>`** only: Add extra
49
+ * logic for determining whether the link is active. This should be used if you
50
+ * want to do more than verify that the link’s pathname matches the current URL
51
+ * pathname.
52
+ * @param [props.location] **`<NavLink>`** only: `isActive` compares
53
+ * current history location (usually the current browser URL). To compare to
54
+ * a different location, a custom `location` can be passed.
55
+ * @param [props.strict] **`<NavLink>`** only: . When `true`, trailing
56
+ * slash on a location’s pathname will be taken into consideration when
57
+ * determining if the location matches the current URL. See the `<Route strict>`
58
+ * documentation for more information.
59
+ */
60
+ declare const GenericLink: React.FunctionComponent<PropsT>;
61
+ export default GenericLink;
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import { type Theme } from '@dr.pogodin/react-themes';
3
+ declare const ThemedInput: import("@dr.pogodin/react-themes").ThemedComponent<React.InputHTMLAttributes<HTMLInputElement> & {
4
+ label?: string | undefined;
5
+ theme: Theme & {
6
+ container?: string;
7
+ input?: string;
8
+ label?: string;
9
+ };
10
+ } & React.RefAttributes<HTMLInputElement>>;
11
+ export default ThemedInput;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * The Link wraps around React Router's Link component, to automatically replace
3
+ * it by the regular <a> element when:
4
+ * - The target reference points to another domain;
5
+ * - User opts to open the reference in a new tab;
6
+ * - User explicitely opts to use <a>.
7
+ */
8
+ /// <reference types="react" />
9
+ import { type PropsT as GenericLinkPropsT } from './GenericLink';
10
+ type PropsT = Omit<GenericLinkPropsT, 'routerLinkType'>;
11
+ declare const Link: React.FunctionComponent<PropsT>;
12
+ export default Link;