@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
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_utils","_jsxRuntime","defaultTheme","Dropdown","filter","label","onChange","options","theme","value","isValidValue","optionElements","i","length","option","optionValue","optionName","name","undefined","push","jsx","className","children","hiddenOption","disabled","jsxs","container","select","arrow","ThemedDropdown","themed","propTypes","PT","func","string","arrayOf","oneOfType","shape","node","isRequired","themeType","defaultProps","_default","exports","default"],"sources":["../../../../../src/shared/components/Dropdown/index.jsx"],"sourcesContent":["import PT from 'prop-types';\n\nimport { themed } from 'utils';\n\nimport defaultTheme from './theme.scss';\n\n/**\n * Implements a themeable dropdown list. Internally it is rendered with help of\n * the standard HTML `<select>` element, thus the styling support is somewhat\n * limited.\n * @param {object} [props] Component properties.\n * @param {function} [props.filter] Options filter function. If provided, only\n * those elements of `options` list will be used by the dropdown, for which this\n * filter returns `true`.\n * @param {string} [props.label] Dropdown label.\n * @param {string} [props.onChange] Selection event handler.\n * @param {DropdownOption[]|string[]} [props.options=[]] Array of dropdown\n * options. For string elements the option value and name will be the same.\n * It is allowed to mix DropdownOption and string elements in the same option\n * list.\n * @param {DropdownTheme} [props.theme] _Ad hoc_ theme.\n * @param {string} [props.value] Currently selected value.\n * @param {...any} [props....]\n * [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)\n */\nfunction Dropdown({\n filter,\n label,\n onChange,\n options,\n theme,\n value,\n}) {\n let isValidValue = false;\n const optionElements = [];\n\n for (let i = 0; i < options.length; ++i) {\n const option = options[i];\n if (!filter || filter(option)) {\n const optionValue = typeof option === 'string' ? option : option.value;\n const optionName = option.name === undefined ? optionValue : option.name;\n isValidValue ||= optionValue === value;\n optionElements.push(\n <option className={theme.option} key={optionValue} value={optionValue}>\n {optionName}\n </option>,\n );\n }\n }\n\n // NOTE: This element represents the current `value` when it does not match\n // any valid option. In Chrome, and some other browsers, we are able to hide\n // it from the opened dropdown; in others, e.g. Safari, the best we can do is\n // to show it as disabled.\n const hiddenOption = isValidValue ? null : (\n <option\n disabled\n className={theme.hiddenOption}\n key=\"__reactUtilsHiddenOption\"\n value={value}\n >\n {value}\n </option>\n );\n\n return (\n <div className={theme.container}>\n { label === undefined ? null : <p className={theme.label}>{label}</p> }\n <select\n className={theme.select}\n onChange={onChange}\n value={value}\n >\n {hiddenOption}\n {optionElements}\n </select>\n <div className={theme.arrow}>▼</div>\n </div>\n );\n}\n\nconst ThemedDropdown = themed('Dropdown', [\n 'arrow',\n 'container',\n 'hiddenOption',\n 'label',\n 'option',\n 'select',\n], defaultTheme)(Dropdown);\n\nDropdown.propTypes = {\n filter: PT.func,\n label: PT.string,\n onChange: PT.func,\n options: PT.arrayOf(\n PT.oneOfType([\n PT.shape({\n name: PT.node,\n value: PT.string.isRequired,\n }),\n PT.string,\n ]).isRequired,\n ),\n theme: ThemedDropdown.themeType.isRequired,\n value: PT.string,\n};\n\nDropdown.defaultProps = {\n filter: undefined,\n label: undefined,\n onChange: undefined,\n options: [],\n value: '',\n};\n\nexport default ThemedDropdown;\n"],"mappings":"gLAAA,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBAEA,IAAAC,MAAA,CAAAD,OAAA,gBAA+B,IAAAE,WAAA,CAAAF,OAAA,4BAAAG,YAAA,uKAI/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,QAAS,CAAAC,QAAQA,CAAC,CAChBC,MAAM,CACNC,KAAK,CACLC,QAAQ,CACRC,OAAO,CACPC,KAAK,CACLC,KACF,CAAC,CAAE,CACD,GAAI,CAAAC,YAAY,CAAG,KAAK,CACxB,KAAM,CAAAC,cAAc,CAAG,EAAE,CAEzB,IAAK,GAAI,CAAAC,CAAC,CAAG,CAAC,CAAEA,CAAC,CAAGL,OAAO,CAACM,MAAM,CAAE,EAAED,CAAC,CAAE,CACvC,KAAM,CAAAE,MAAM,CAAGP,OAAO,CAACK,CAAC,CAAC,CACzB,GAAI,CAACR,MAAM,EAAIA,MAAM,CAACU,MAAM,CAAC,CAAE,CAC7B,KAAM,CAAAC,WAAW,CAAG,MAAO,CAAAD,MAAM,GAAK,QAAQ,CAAGA,MAAM,CAAGA,MAAM,CAACL,KAAK,CACtE,KAAM,CAAAO,UAAU,CAAGF,MAAM,CAACG,IAAI,GAAKC,SAAS,CAAGH,WAAW,CAAGD,MAAM,CAACG,IAAI,CACxEP,YAAY,GAAKK,WAAW,GAAKN,KAAK,CACtCE,cAAc,CAACQ,IAAI,cACjB,GAAAlB,WAAA,CAAAmB,GAAA,YAAQC,SAAS,CAAEb,KAAK,CAACM,MAAO,CAAmBL,KAAK,CAAEM,WAAY,CAAAO,QAAA,CACnEN,UAAU,EADyBD,WAE9B,CACV,CACF,CACF,CAEA;AACA;AACA;AACA;AACA,KAAM,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CACb7B,KAAK,CAAEuB,kBAAE,CAACE,MAAM,CAACK,UACnB,CAAC,CAAC,CACFP,kBAAE,CAACE,MAAM,CACV,CAAC,CAACK,UACL,CAAC,CACD/B,KAAK,CAAEqB,cAAc,CAACW,SAAS,CAACD,UAAU,CAC1C9B,KAAK,CAAEuB,kBAAE,CAACE,MACZ,CAAC,CAED/B,QAAQ,CAACsC,YAAY,CAAG,CACtBrC,MAAM,CAAEc,SAAS,CACjBb,KAAK,CAAEa,SAAS,CAChBZ,QAAQ,CAAEY,SAAS,CACnBX,OAAO,CAAE,EAAE,CACXE,KAAK,CAAE,EACT,CAAC,CAAC,IAAAiC,QAAA,CAEab,cAAc,CAAAc,OAAA,CAAAC,OAAA,CAAAF,QAAA"}
1
+ {"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_reactThemes","_jsxRuntime","defaultTheme","Dropdown","filter","label","onChange","options","theme","value","isValidValue","optionElements","i","length","option","optionValue","optionName","name","push","jsx","className","children","hiddenOption","disabled","jsxs","container","undefined","select","arrow","ThemedDropdown","themed","propTypes","PT","func","string","arrayOf","oneOfType","shape","isRequired","themeType","defaultProps","_default","exports","default"],"sources":["../../../../../src/shared/components/Dropdown/index.tsx"],"sourcesContent":["import PT from 'prop-types';\n\nimport themed, { type Theme } from '@dr.pogodin/react-themes';\n\nimport defaultTheme from './theme.scss';\n\ntype DropdownOptionT = {\n name?: string | null;\n value: string;\n};\n\ntype PropsT = {\n filter?: (item: DropdownOptionT | string) => boolean;\n label?: string;\n onChange?: React.ChangeEventHandler<HTMLSelectElement>;\n options?: Array<DropdownOptionT | string>;\n theme: Theme & {\n arrow?: string;\n container?: string;\n hiddenOption?: string;\n label?: string;\n option?: string;\n select?: string;\n };\n value?: string;\n};\n\n/**\n * Implements a themeable dropdown list. Internally it is rendered with help of\n * the standard HTML `<select>` element, thus the styling support is somewhat\n * limited.\n * @param [props] Component properties.\n * @param [props.filter] Options filter function. If provided, only\n * those elements of `options` list will be used by the dropdown, for which this\n * filter returns `true`.\n * @param [props.label] Dropdown label.\n * @param [props.onChange] Selection event handler.\n * @param [props.options=[]] Array of dropdown\n * options. For string elements the option value and name will be the same.\n * It is allowed to mix DropdownOption and string elements in the same option\n * list.\n * @param [props.theme] _Ad hoc_ theme.\n * @param [props.value] Currently selected value.\n * @param [props....]\n * [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)\n */\nconst Dropdown: React.FunctionComponent<PropsT> = ({\n filter,\n label,\n onChange,\n options = [],\n theme,\n value,\n}) => {\n let isValidValue = false;\n const optionElements = [];\n\n for (let i = 0; i < options.length; ++i) {\n const option = options[i];\n if (!filter || filter(option)) {\n let optionValue: string;\n let optionName: string;\n if (typeof option === 'string') {\n optionName = option;\n optionValue = option;\n } else {\n optionName = option.name || option.value;\n optionValue = option.value;\n }\n isValidValue ||= optionValue === value;\n optionElements.push(\n <option className={theme.option} key={optionValue} value={optionValue}>\n {optionName}\n </option>,\n );\n }\n }\n\n // NOTE: This element represents the current `value` when it does not match\n // any valid option. In Chrome, and some other browsers, we are able to hide\n // it from the opened dropdown; in others, e.g. Safari, the best we can do is\n // to show it as disabled.\n const hiddenOption = isValidValue ? null : (\n <option\n disabled\n className={theme.hiddenOption}\n key=\"__reactUtilsHiddenOption\"\n value={value}\n >\n {value}\n </option>\n );\n\n return (\n <div className={theme.container}>\n { label === undefined ? null : <p className={theme.label}>{label}</p> }\n <select\n className={theme.select}\n onChange={onChange}\n value={value}\n >\n {hiddenOption}\n {optionElements}\n </select>\n <div className={theme.arrow}>▼</div>\n </div>\n );\n};\n\nconst ThemedDropdown = themed(Dropdown, 'Dropdown', [\n 'arrow',\n 'container',\n 'hiddenOption',\n 'label',\n 'option',\n 'select',\n], defaultTheme);\n\nDropdown.propTypes = {\n filter: PT.func,\n label: PT.string,\n onChange: PT.func,\n options: PT.arrayOf(\n PT.oneOfType([\n PT.shape({\n name: PT.string,\n value: PT.string.isRequired,\n }),\n PT.string,\n ]).isRequired,\n ),\n theme: ThemedDropdown.themeType.isRequired,\n value: PT.string,\n};\n\nDropdown.defaultProps = {\n filter: undefined,\n label: undefined,\n onChange: undefined,\n options: [],\n value: '',\n};\n\nexport default ThemedDropdown;\n"],"mappings":"gLAAA,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBAEA,IAAAC,YAAA,CAAAF,sBAAA,CAAAC,OAAA,8BAA8D,IAAAE,WAAA,CAAAF,OAAA,4BAAAG,YAAA,uKAyB9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,KAAM,CAAAC,QAAyC,CAAGA,CAAC,CACjDC,MAAM,CACNC,KAAK,CACLC,QAAQ,CACRC,OAAO,CAAG,EAAE,CACZC,KAAK,CACLC,KACF,CAAC,GAAK,CACJ,GAAI,CAAAC,YAAY,CAAG,KAAK,CACxB,KAAM,CAAAC,cAAc,CAAG,EAAE,CAEzB,IAAK,GAAI,CAAAC,CAAC,CAAG,CAAC,CAAEA,CAAC,CAAGL,OAAO,CAACM,MAAM,CAAE,EAAED,CAAC,CAAE,CACvC,KAAM,CAAAE,MAAM,CAAGP,OAAO,CAACK,CAAC,CAAC,CACzB,GAAI,CAACR,MAAM,EAAIA,MAAM,CAACU,MAAM,CAAC,CAAE,CAC7B,GAAI,CAAAC,WAAmB,CACvB,GAAI,CAAAC,UAAkB,CACtB,GAAI,MAAO,CAAAF,MAAM,GAAK,QAAQ,CAAE,CAC9BE,UAAU,CAAGF,MAAM,CACnBC,WAAW,CAAGD,MAChB,CAAC,IAAM,CACLE,UAAU,CAAGF,MAAM,CAACG,IAAI,EAAIH,MAAM,CAACL,KAAK,CACxCM,WAAW,CAAGD,MAAM,CAACL,KACvB,CACAC,YAAY,GAAKK,WAAW,GAAKN,KAAK,CACtCE,cAAc,CAACO,IAAI,cACjB,GAAAjB,WAAA,CAAAkB,GAAA,YAAQC,SAAS,CAAEZ,KAAK,CAACM,MAAO,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BAAE,CAACG,OAAO,CACjBH,kBAAE,CAACI,SAAS,CAAC,CACXJ,kBAAE,CAACK,KAAK,CAAC,CACPpB,IAAI,CAAEe,kBAAE,CAACE,MAAM,CACfzB,KAAK,CAAEuB,kBAAE,CAACE,MAAM,CAACI,UACnB,CAAC,CAAC,CACFN,kBAAE,CAACE,MAAM,CACV,CAAC,CAACI,UACL,CAAC,CACD9B,KAAK,CAAEqB,cAAc,CAACU,SAAS,CAACD,UAAU,CAC1C7B,KAAK,CAAEuB,kBAAE,CAACE,MACZ,CAAC,CAED/B,QAAQ,CAACqC,YAAY,CAAG,CACtBpC,MAAM,CAAEsB,SAAS,CACjBrB,KAAK,CAAEqB,SAAS,CAChBpB,QAAQ,CAAEoB,SAAS,CACnBnB,OAAO,CAAE,EAAE,CACXE,KAAK,CAAE,EACT,CAAC,CAAC,IAAAgC,QAAA,CAAAC,OAAA,CAAAC,OAAA,CAEad,cAAc"}
@@ -1,47 +1,52 @@
1
- "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=GenericLink;var _propTypes=_interopRequireDefault(require("prop-types"));var _react=require("react");var _jsxRuntime=require("react/jsx-runtime");/* global window */ /**
1
+ "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _propTypes=_interopRequireDefault(require("prop-types"));require("react");require("react-router-dom");var _jsxRuntime=require("react/jsx-runtime");/* global window */ /**
2
2
  * The `<Link>` component, and almost identical `<NavLink>` component, are
3
3
  * auxiliary wrappers around
4
4
  * [React Router](https://github.com/ReactTraining/react-router)'s
5
5
  * `<Link>` and `<NavLink>` components; they help to handle external and
6
6
  * internal links in uniform manner.
7
7
  *
8
- * @param {object} [props] Component properties.
9
- * @param {string} [props.className] CSS classes to apply to the link.
10
- * @param {boolean} [props.disabled] Disables the link.
11
- * @param {boolean} [props.enforceA] `true` enforces rendering of the link as
8
+ * @param [props] Component properties.
9
+ * @param [props.className] CSS classes to apply to the link.
10
+ * @param [props.disabled] Disables the link.
11
+ * @param [props.enforceA] `true` enforces rendering of the link as
12
12
  * a simple `<a>` element.
13
- * @param {boolean} [props.keepScrollPosition] If `true`, and the link is
13
+ * @param [props.keepScrollPosition] If `true`, and the link is
14
14
  * rendered as a React Router's component, it won't reset the viewport scrolling
15
15
  * position to the origin when clicked.
16
- * @param {function} [props.onClick] Event handler to trigger upon click.
17
- * @param {function} [props.onMouseDown] Event handler to trigger on MouseDown
16
+ * @param [props.onClick] Event handler to trigger upon click.
17
+ * @param [props.onMouseDown] Event handler to trigger on MouseDown
18
18
  * event.
19
- * @param {boolean} [props.openNewTab] If `true` the link opens in a new tab.
20
- * @param {boolean} [props.replace] When `true`, the link will replace current
19
+ * @param [props.openNewTab] If `true` the link opens in a new tab.
20
+ * @param [props.replace] When `true`, the link will replace current
21
21
  * entry in the history stack instead of adding a new one.
22
- * @param {string} [props.to] Link URL.
23
- * @param {string} [props.activeClassName] **`<NavLink>`** only: CSS class(es)
22
+ * @param [props.to] Link URL.
23
+ * @param [props.activeClassName] **`<NavLink>`** only: CSS class(es)
24
24
  * to apply to rendered link when it is active.
25
- * @param {string} [props.activeStyle] **`<NavLink>`** only: CSS styles
25
+ * @param [props.activeStyle] **`<NavLink>`** only: CSS styles
26
26
  * to apply to the rendered link when it is active.
27
- * @param {boolean} [props.exact] **`<NavLink>`** only: if `true`, the active
27
+ * @param [props.exact] **`<NavLink>`** only: if `true`, the active
28
28
  * class/style will only be applied if the location is matched exactly.
29
- * @param {function} [props.isActive] **`<NavLink>`** only: Add extra
29
+ * @param [props.isActive] **`<NavLink>`** only: Add extra
30
30
  * logic for determining whether the link is active. This should be used if you
31
31
  * want to do more than verify that the link’s pathname matches the current URL
32
32
  * pathname.
33
- * @param {object} [props.location] **`<NavLink>`** only: `isActive` compares
33
+ * @param [props.location] **`<NavLink>`** only: `isActive` compares
34
34
  * current history location (usually the current browser URL). To compare to
35
35
  * a different location, a custom `location` can be passed.
36
- * @param {boolean} [props.strict] **`<NavLink>`** only: . When `true`, trailing
36
+ * @param [props.strict] **`<NavLink>`** only: . When `true`, trailing
37
37
  * slash on a location’s pathname will be taken into consideration when
38
38
  * determining if the location matches the current URL. See the `<Route strict>`
39
39
  * documentation for more information.
40
- */function GenericLink({children,className,disabled,enforceA,keepScrollPosition,onClick,onMouseDown,openNewTab,replace,routerLinkType,to,...rest}){/* Renders Link as <a> element if:
40
+ */const GenericLink=({children,className,disabled,enforceA,keepScrollPosition,onClick,onMouseDown,openNewTab,replace,routerLinkType,to,...rest})=>{/* Renders Link as <a> element if:
41
41
  * - It is opted explicitely by `enforceA` prop;
42
42
  * - It should be opened in a new tab;
43
43
  * - It is an absolte URL (starts with http:// or https://);
44
- * - It is anchor link (starts with #). */if(disabled||enforceA||openNewTab||to.match(/^(#|(https?|mailto):)/)){return/*#__PURE__*/(0,_jsxRuntime.jsx)("a",{className:(className?className+" ":"")+"zH52sA",disabled:disabled,href:to,onClick:disabled?e=>e.preventDefault():onClick,onMouseDown:disabled?e=>e.preventDefault():onMouseDown,rel:"noopener noreferrer",target:openNewTab?"_blank":"",children:children})}/* Otherwise we render the link as React Router's Link or NavLink element. */return/*#__PURE__*/(0,_react.createElement)(routerLinkType,{className,disabled,onMouseDown,replace,to,onClick:e=>{// Executes the user-provided event handler, if any.
44
+ * - It is anchor link (starts with #). */if(disabled||enforceA||openNewTab||to?.match(/^(#|(https?|mailto):)/)){return/*#__PURE__*/(0,_jsxRuntime.jsx)("a",{className:(className?className+" ":"")+"zH52sA"// TODO: This requires a fix: disabled is not really an attribute of <a>
45
+ // tag, thus for disabled option we rather should render a plain text
46
+ // styled as a link.
47
+ // disabled={disabled}
48
+ ,href:to,onClick:disabled?e=>e.preventDefault():onClick,onMouseDown:disabled?e=>e.preventDefault():onMouseDown,rel:"noopener noreferrer",target:openNewTab?"_blank":"",children:children})}const L=routerLinkType;return/*#__PURE__*/(0,_jsxRuntime.jsx)(L,{className:className// disabled
49
+ ,onMouseDown:onMouseDown,replace:replace,to:to,onClick:e=>{// Executes the user-provided event handler, if any.
45
50
  if(onClick)onClick(e);// By default, clicking the link scrolls the page to beginning.
46
- if(!keepScrollPosition)window.scroll(0,0)},...rest},children)}GenericLink.defaultProps={children:null,className:null,disabled:false,enforceA:false,keepScrollPosition:false,onClick:null,onMouseDown:null,openNewTab:false,replace:false,to:""};GenericLink.propTypes={children:_propTypes.default.node,className:_propTypes.default.string,disabled:_propTypes.default.bool,enforceA:_propTypes.default.bool,keepScrollPosition:_propTypes.default.bool,onClick:_propTypes.default.func,onMouseDown:_propTypes.default.func,openNewTab:_propTypes.default.bool,replace:_propTypes.default.bool,routerLinkType:_propTypes.default.elementType.isRequired,to:_propTypes.default.oneOfType([_propTypes.default.object,_propTypes.default.string])};
51
+ if(!keepScrollPosition)window.scroll(0,0)},...rest,children:children})};GenericLink.defaultProps={children:null,className:"",disabled:false,enforceA:false,keepScrollPosition:false,onClick:undefined,onMouseDown:undefined,openNewTab:false,replace:false,to:""};GenericLink.propTypes={children:_propTypes.default.node,className:_propTypes.default.string,disabled:_propTypes.default.bool,enforceA:_propTypes.default.bool,keepScrollPosition:_propTypes.default.bool,onClick:_propTypes.default.func,onMouseDown:_propTypes.default.func,openNewTab:_propTypes.default.bool,replace:_propTypes.default.bool,routerLinkType:_propTypes.default.elementType.isRequired,to:_propTypes.default.oneOfType([_propTypes.default.object,_propTypes.default.string])};var _default=exports.default=GenericLink;
47
52
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_react","_jsxRuntime","GenericLink","children","className","disabled","enforceA","keepScrollPosition","onClick","onMouseDown","openNewTab","replace","routerLinkType","to","rest","match","jsx","href","e","preventDefault","rel","target","createElement","window","scroll","defaultProps","propTypes","PT","node","string","bool","func","elementType","isRequired","oneOfType","object"],"sources":["../../../../../src/shared/components/GenericLink/index.jsx"],"sourcesContent":["/* global window */\n\nimport PT from 'prop-types';\nimport { createElement } from 'react';\n\nimport './style.scss';\n\n/**\n * The `<Link>` component, and almost identical `<NavLink>` component, are\n * auxiliary wrappers around\n * [React Router](https://github.com/ReactTraining/react-router)'s\n * `<Link>` and `<NavLink>` components; they help to handle external and\n * internal links in uniform manner.\n *\n * @param {object} [props] Component properties.\n * @param {string} [props.className] CSS classes to apply to the link.\n * @param {boolean} [props.disabled] Disables the link.\n * @param {boolean} [props.enforceA] `true` enforces rendering of the link as\n * a simple `<a>` element.\n * @param {boolean} [props.keepScrollPosition] If `true`, and the link is\n * rendered as a React Router's component, it won't reset the viewport scrolling\n * position to the origin when clicked.\n * @param {function} [props.onClick] Event handler to trigger upon click.\n * @param {function} [props.onMouseDown] Event handler to trigger on MouseDown\n * event.\n * @param {boolean} [props.openNewTab] If `true` the link opens in a new tab.\n * @param {boolean} [props.replace] When `true`, the link will replace current\n * entry in the history stack instead of adding a new one.\n * @param {string} [props.to] Link URL.\n * @param {string} [props.activeClassName] **`<NavLink>`** only: CSS class(es)\n * to apply to rendered link when it is active.\n * @param {string} [props.activeStyle] **`<NavLink>`** only: CSS styles\n * to apply to the rendered link when it is active.\n * @param {boolean} [props.exact] **`<NavLink>`** only: if `true`, the active\n * class/style will only be applied if the location is matched exactly.\n * @param {function} [props.isActive] **`<NavLink>`** only: Add extra\n * logic for determining whether the link is active. This should be used if you\n * want to do more than verify that the link’s pathname matches the current URL\n * pathname.\n * @param {object} [props.location] **`<NavLink>`** only: `isActive` compares\n * current history location (usually the current browser URL). To compare to\n * a different location, a custom `location` can be passed.\n * @param {boolean} [props.strict] **`<NavLink>`** only: . When `true`, trailing\n * slash on a location’s pathname will be taken into consideration when\n * determining if the location matches the current URL. See the `<Route strict>`\n * documentation for more information.\n */\nexport default function GenericLink({\n children,\n className,\n disabled,\n enforceA,\n keepScrollPosition,\n onClick,\n onMouseDown,\n openNewTab,\n replace,\n routerLinkType,\n to,\n ...rest\n}) {\n /* Renders Link as <a> element if:\n * - It is opted explicitely by `enforceA` prop;\n * - It should be opened in a new tab;\n * - It is an absolte URL (starts with http:// or https://);\n * - It is anchor link (starts with #). */\n if (disabled || enforceA || openNewTab || to.match(/^(#|(https?|mailto):)/)) {\n return (\n <a\n className={className}\n disabled={disabled}\n href={to}\n onClick={disabled ? (e) => e.preventDefault() : onClick}\n onMouseDown={disabled ? (e) => e.preventDefault() : onMouseDown}\n rel=\"noopener noreferrer\"\n styleName=\"link\"\n target={openNewTab ? '_blank' : ''}\n >\n {children}\n </a>\n );\n }\n\n /* Otherwise we render the link as React Router's Link or NavLink element. */\n return createElement(routerLinkType, {\n className,\n disabled,\n onMouseDown,\n replace,\n to,\n onClick: (e) => {\n // Executes the user-provided event handler, if any.\n if (onClick) onClick(e);\n\n // By default, clicking the link scrolls the page to beginning.\n if (!keepScrollPosition) window.scroll(0, 0);\n },\n ...rest,\n }, children);\n}\n\nGenericLink.defaultProps = {\n children: null,\n className: null,\n disabled: false,\n enforceA: false,\n keepScrollPosition: false,\n onClick: null,\n onMouseDown: null,\n openNewTab: false,\n replace: false,\n to: '',\n};\n\nGenericLink.propTypes = {\n children: PT.node,\n className: PT.string,\n disabled: PT.bool,\n enforceA: PT.bool,\n keepScrollPosition: PT.bool,\n onClick: PT.func,\n onMouseDown: PT.func,\n openNewTab: PT.bool,\n replace: PT.bool,\n routerLinkType: PT.elementType.isRequired,\n to: PT.oneOfType([PT.object, PT.string]),\n};\n"],"mappings":"qLAEA,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBACA,IAAAC,MAAA,CAAAD,OAAA,UAAsC,IAAAE,WAAA,CAAAF,OAAA,sBAHtC,oBAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACe,QAAS,CA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C,kBAAkB,CAAE,KAAK,CACzBC,OAAO,CAAE,IAAI,CACbC,WAAW,CAAE,IAAI,CACjBC,UAAU,CAAE,KAAK,CACjBC,OAAO,CAAE,KAAK,CACdE,EAAE,CAAE,EACN,CAAC,CAEDX,WAAW,CAACwB,SAAS,CAAG,CACtBvB,QAAQ,CAAEwB,kBAAE,CAACC,IAAI,CACjBxB,SAAS,CAAEuB,kBAAE,CAACE,MAAM,CACpBxB,QAAQ,CAAEsB,kBAAE,CAACG,IAAI,CACjBxB,QAAQ,CAAEqB,kBAAE,CAACG,IAAI,CACjBvB,kBAAkB,CAAEoB,kBAAE,CAACG,IAAI,CAC3BtB,OAAO,CAAEmB,kBAAE,CAACI,IAAI,CAChBtB,WAAW,CAAEkB,kBAAE,CAACI,IAAI,CACpBrB,UAAU,CAAEiB,kBAAE,CAACG,IAAI,CACnBnB,OAAO,CAAEgB,kBAAE,CAACG,IAAI,CAChBlB,cAAc,CAAEe,kBAAE,CAACK,WAAW,CAACC,UAAU,CACzCpB,EAAE,CAAEc,kBAAE,CAACO,SAAS,CAAC,CAACP,kBAAE,CAACQ,MAAM,CAAER,kBAAE,CAACE,MAAM,CAAC,CACzC,CAAC"}
1
+ {"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_jsxRuntime","GenericLink","children","className","disabled","enforceA","keepScrollPosition","onClick","onMouseDown","openNewTab","replace","routerLinkType","to","rest","match","jsx","href","e","preventDefault","rel","target","L","window","scroll","defaultProps","undefined","propTypes","PT","node","string","bool","func","elementType","isRequired","oneOfType","object","_default","exports","default"],"sources":["../../../../../src/shared/components/GenericLink/index.tsx"],"sourcesContent":["/* global window */\n\nimport PT from 'prop-types';\nimport { type ReactNode } from 'react';\n\nimport { type Link, type NavLink } from 'react-router-dom';\n\nimport './style.scss';\n\ntype ToT = Parameters<typeof Link>[0]['to'];\n\ninterface LinkI {}\n\nexport type PropsT = {\n children?: ReactNode;\n className?: string;\n disabled?: boolean;\n enforceA?: boolean;\n keepScrollPosition?: boolean;\n onClick?: React.MouseEventHandler<HTMLAnchorElement>;\n onMouseDown?: React.MouseEventHandler<HTMLAnchorElement>;\n openNewTab?: boolean;\n replace?: boolean;\n routerLinkType: LinkI;\n to?: ToT;\n};\n\n/**\n * The `<Link>` component, and almost identical `<NavLink>` component, are\n * auxiliary wrappers around\n * [React Router](https://github.com/ReactTraining/react-router)'s\n * `<Link>` and `<NavLink>` components; they help to handle external and\n * internal links in uniform manner.\n *\n * @param [props] Component properties.\n * @param [props.className] CSS classes to apply to the link.\n * @param [props.disabled] Disables the link.\n * @param [props.enforceA] `true` enforces rendering of the link as\n * a simple `<a>` element.\n * @param [props.keepScrollPosition] If `true`, and the link is\n * rendered as a React Router's component, it won't reset the viewport scrolling\n * position to the origin when clicked.\n * @param [props.onClick] Event handler to trigger upon click.\n * @param [props.onMouseDown] Event handler to trigger on MouseDown\n * event.\n * @param [props.openNewTab] If `true` the link opens in a new tab.\n * @param [props.replace] When `true`, the link will replace current\n * entry in the history stack instead of adding a new one.\n * @param [props.to] Link URL.\n * @param [props.activeClassName] **`<NavLink>`** only: CSS class(es)\n * to apply to rendered link when it is active.\n * @param [props.activeStyle] **`<NavLink>`** only: CSS styles\n * to apply to the rendered link when it is active.\n * @param [props.exact] **`<NavLink>`** only: if `true`, the active\n * class/style will only be applied if the location is matched exactly.\n * @param [props.isActive] **`<NavLink>`** only: Add extra\n * logic for determining whether the link is active. This should be used if you\n * want to do more than verify that the link’s pathname matches the current URL\n * pathname.\n * @param [props.location] **`<NavLink>`** only: `isActive` compares\n * current history location (usually the current browser URL). To compare to\n * a different location, a custom `location` can be passed.\n * @param [props.strict] **`<NavLink>`** only: . When `true`, trailing\n * slash on a location’s pathname will be taken into consideration when\n * determining if the location matches the current URL. See the `<Route strict>`\n * documentation for more information.\n */\nconst GenericLink: React.FunctionComponent<PropsT> = ({\n children,\n className,\n disabled,\n enforceA,\n keepScrollPosition,\n onClick,\n onMouseDown,\n openNewTab,\n replace,\n routerLinkType,\n to,\n ...rest\n}) => {\n /* Renders Link as <a> element if:\n * - It is opted explicitely by `enforceA` prop;\n * - It should be opened in a new tab;\n * - It is an absolte URL (starts with http:// or https://);\n * - It is anchor link (starts with #). */\n if (disabled || enforceA || openNewTab || (to as string)?.match(/^(#|(https?|mailto):)/)) {\n return (\n <a\n className={className}\n // TODO: This requires a fix: disabled is not really an attribute of <a>\n // tag, thus for disabled option we rather should render a plain text\n // styled as a link.\n // disabled={disabled}\n href={to as string}\n onClick={disabled ? (e) => e.preventDefault() : onClick}\n onMouseDown={disabled ? (e) => e.preventDefault() : onMouseDown}\n rel=\"noopener noreferrer\"\n styleName=\"link\"\n target={openNewTab ? '_blank' : ''}\n >\n {children}\n </a>\n );\n }\n\n const L = routerLinkType as typeof NavLink;\n\n return (\n <L\n className={className}\n // disabled\n onMouseDown={onMouseDown}\n replace={replace}\n to={to!}\n onClick={(e: React.MouseEvent<HTMLAnchorElement>) => {\n // Executes the user-provided event handler, if any.\n if (onClick) onClick(e);\n\n // By default, clicking the link scrolls the page to beginning.\n if (!keepScrollPosition) window.scroll(0, 0);\n }}\n {...rest} // eslint-disable-line react/jsx-props-no-spreading\n >\n {children}\n </L>\n );\n};\n\nGenericLink.defaultProps = {\n children: null,\n className: '',\n disabled: false,\n enforceA: false,\n keepScrollPosition: false,\n onClick: undefined,\n onMouseDown: undefined,\n openNewTab: false,\n replace: false,\n to: '',\n};\n\nGenericLink.propTypes = {\n children: PT.node,\n className: PT.string,\n disabled: PT.bool,\n enforceA: PT.bool,\n keepScrollPosition: PT.bool,\n onClick: PT.func,\n onMouseDown: PT.func,\n openNewTab: PT.bool,\n replace: PT.bool,\n routerLinkType: PT.elementType.isRequired,\n to: PT.oneOfType([PT.object, PT.string]),\n};\n\nexport default GenericLink;\n"],"mappings":"gLAEA,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBACAA,OAAA,UAEAA,OAAA,qBAA2D,IAAAC,WAAA,CAAAD,OAAA,sBAL3D,oBA2BA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AACU,CAAC,CAAC,CAEvB;AACA,GAAI,CAACX,kBAAkB,CAAEgB,MAAM,CAACC,MAAM,CAAC,CAAC,CAAE,CAAC,CAC7C,CAAE,IACEV,IAAI,CAAAX,QAAA,CAEPA,QAAQ,CACR,CAEP,CAAC,CAEDD,WAAW,CAACuB,YAAY,CAAG,CACzBtB,QAAQ,CAAE,IAAI,CACdC,SAAS,CAAE,EAAE,CACbC,QAAQ,CAAE,KAAK,CACfC,QAAQ,CAAE,KAAK,CACfC,kBAAkB,CAAE,KAAK,CACzBC,OAAO,CAAEkB,SAAS,CAClBjB,WAAW,CAAEiB,SAAS,CACtBhB,UAAU,CAAE,KAAK,CACjBC,OAAO,CAAE,KAAK,CACdE,EAAE,CAAE,EACN,CAAC,CAEDX,WAAW,CAACyB,SAAS,CAAG,CACtBxB,QAAQ,CAAEyB,kBAAE,CAACC,IAAI,CACjBzB,SAAS,CAAEwB,kBAAE,CAACE,MAAM,CACpBzB,QAAQ,CAAEuB,kBAAE,CAACG,IAAI,CACjBzB,QAAQ,CAAEsB,kBAAE,CAACG,IAAI,CACjBxB,kBAAkB,CAAEqB,kBAAE,CAACG,IAAI,CAC3BvB,OAAO,CAAEoB,kBAAE,CAACI,IAAI,CAChBvB,WAAW,CAAEmB,kBAAE,CAACI,IAAI,CACpBtB,UAAU,CAAEkB,kBAAE,CAACG,IAAI,CACnBpB,OAAO,CAAEiB,kBAAE,CAACG,IAAI,CAChBnB,cAAc,CAAEgB,kBAAE,CAACK,WAAW,CAACC,UAAU,CACzCrB,EAAE,CAAEe,kBAAE,CAACO,SAAS,CAAC,CAACP,kBAAE,CAACQ,MAAM,CAAER,kBAAE,CAACE,MAAM,CAAC,CACzC,CAAC,CAAC,IAAAO,QAAA,CAAAC,OAAA,CAAAC,OAAA,CAEarC,WAAW"}
@@ -1,10 +1,10 @@
1
- "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _propTypes=_interopRequireDefault(require("prop-types"));var _react=require("react");var _utils=require("../../utils");var _jsxRuntime=require("react/jsx-runtime");const defaultTheme={"context":"X5WszA","ad":"_8s7GCr","hoc":"TVlBYc","container":"Cxx397","input":"M07d4s","label":"gfbdq-"};/**
1
+ "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _propTypes=_interopRequireDefault(require("prop-types"));var _react=require("react");var _reactThemes=_interopRequireDefault(require("@dr.pogodin/react-themes"));var _jsxRuntime=require("react/jsx-runtime");const defaultTheme={"context":"X5WszA","ad":"_8s7GCr","hoc":"TVlBYc","container":"Cxx397","input":"M07d4s","label":"gfbdq-"};/**
2
2
  * Themeable input field, based on the standard HTML `<input>` element.
3
- * @param {object} [props]
4
- * @param {string} [props.label] Input label.
5
- * @param {InputTheme} [props.theme] _Ad hoc_ theme.
6
- * @param {...any} [props...] [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)
7
- * @param {...any} [props...] Any other properties are passed to the underlying
3
+ * @param [props]
4
+ * @param [props.label] Input label.
5
+ * @param [props.theme] _Ad hoc_ theme.
6
+ * @param [props...] [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)
7
+ * @param [props...] Any other properties are passed to the underlying
8
8
  * `<input>` element.
9
- */const Input=/*#__PURE__*/(0,_react.forwardRef)(({label,theme,...rest},ref)=>/*#__PURE__*/(0,_jsxRuntime.jsxs)("span",{className:theme.container,children:[label===undefined?null:/*#__PURE__*/(0,_jsxRuntime.jsx)("p",{className:theme.label,children:label}),/*#__PURE__*/(0,_jsxRuntime.jsx)("input",{className:theme.input,ref:ref,...rest})]}));const ThemedInput=(0,_utils.themed)("Input",["container","input","label"],defaultTheme)(Input);Input.propTypes={label:_propTypes.default.string,theme:ThemedInput.themeType.isRequired};Input.defaultProps={label:undefined};var _default=ThemedInput;exports.default=_default;
9
+ */const Input=/*#__PURE__*/(0,_react.forwardRef)(({label,theme,...rest},ref)=>/*#__PURE__*/(0,_jsxRuntime.jsxs)("span",{className:theme.container,children:[label===undefined?null:/*#__PURE__*/(0,_jsxRuntime.jsx)("p",{className:theme.label,children:label}),/*#__PURE__*/(0,_jsxRuntime.jsx)("input",{className:theme.input,ref:ref,...rest})]}));const ThemedInput=(0,_reactThemes.default)(Input,"Input",["container","input","label"],defaultTheme);Input.propTypes={label:_propTypes.default.string,theme:ThemedInput.themeType.isRequired};Input.defaultProps={label:undefined};var _default=exports.default=ThemedInput;
10
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_react","_utils","_jsxRuntime","defaultTheme","Input","forwardRef","label","theme","rest","ref","jsxs","className","container","children","undefined","jsx","input","ThemedInput","themed","propTypes","PT","string","themeType","isRequired","defaultProps","_default","exports","default"],"sources":["../../../../../src/shared/components/Input/index.jsx"],"sourcesContent":["import PT from 'prop-types';\nimport { forwardRef } from 'react';\n\nimport { themed } from 'utils';\n\nimport defaultTheme from './theme.scss';\n\n/**\n * Themeable input field, based on the standard HTML `<input>` element.\n * @param {object} [props]\n * @param {string} [props.label] Input label.\n * @param {InputTheme} [props.theme] _Ad hoc_ theme.\n * @param {...any} [props...] [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)\n * @param {...any} [props...] Any other properties are passed to the underlying\n * `<input>` element.\n */\nconst Input = forwardRef(({\n label,\n theme,\n ...rest\n}, ref) => (\n <span className={theme.container}>\n { label === undefined ? null : <p className={theme.label}>{label}</p> }\n <input\n className={theme.input}\n ref={ref}\n {...rest} // eslint-disable-line react/jsx-props-no-spreading\n />\n </span>\n));\n\nconst ThemedInput = themed('Input', [\n 'container',\n 'input',\n 'label',\n], defaultTheme)(Input);\n\nInput.propTypes = {\n label: PT.string,\n theme: ThemedInput.themeType.isRequired,\n};\n\nInput.defaultProps = {\n label: undefined,\n};\n\nexport default ThemedInput;\n"],"mappings":"gLAAA,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBACA,IAAAC,MAAA,CAAAD,OAAA,UAEA,IAAAE,MAAA,CAAAF,OAAA,gBAA+B,IAAAG,WAAA,CAAAH,OAAA,4BAAAI,YAAA,2GAI/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,KAAM,CAAAC,KAAK,cAAG,GAAAC,iBAAU,EAAC,CAAC,CACxBC,KAAK,CACLC,KAAK,CACL,GAAGC,IACL,CAAC,CAAEC,GAAG,gBACJ,GAAAP,WAAA,CAAAQ,IAAA,UAAMC,SAAS,CAAEJ,KAAK,CAACK,SAAU,CAAAC,QAAA,EAC7BP,KAAK,GAAKQ,SAAS,CAAG,IAAI,cAAG,GAAAZ,WAAA,CAAAa,GAAA,OAAGJ,SAAS,CAAEJ,KAAK,CAACD,KAAM,CAAAO,QAAA,CAAEP,KAAK,CAAI,CAAC,cACrE,GAAAJ,WAAA,CAAAa,GAAA,WACEJ,SAAS,CAAEJ,KAAK,CAACS,KAAM,CACvBP,GAAG,CAAEA,GAAI,IACLD,IAAI,CACT,CAAC,EACE,CACP,CAAC,CAEF,KAAM,CAAAS,WAAW,CAAG,GAAAC,aAAM,EAAC,OAAO,CAAE,CAClC,WAAW,CACX,OAAO,CACP,OAAO,CACR,CAAEf,YAAY,CAAC,CAACC,KAAK,CAAC,CAEvBA,KAAK,CAACe,SAAS,CAAG,CAChBb,KAAK,CAAEc,kBAAE,CAACC,MAAM,CAChBd,KAAK,CAAEU,WAAW,CAACK,SAAS,CAACC,UAC/B,CAAC,CAEDnB,KAAK,CAACoB,YAAY,CAAG,CACnBlB,KAAK,CAAEQ,SACT,CAAC,CAAC,IAAAW,QAAA,CAEaR,WAAW,CAAAS,OAAA,CAAAC,OAAA,CAAAF,QAAA"}
1
+ {"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_react","_reactThemes","_jsxRuntime","defaultTheme","Input","forwardRef","label","theme","rest","ref","jsxs","className","container","children","undefined","jsx","input","ThemedInput","themed","propTypes","PT","string","themeType","isRequired","defaultProps","_default","exports","default"],"sources":["../../../../../src/shared/components/Input/index.tsx"],"sourcesContent":["import PT from 'prop-types';\nimport { forwardRef } from 'react';\n\nimport themed, { type Theme } from '@dr.pogodin/react-themes';\n\nimport defaultTheme from './theme.scss';\n\ntype PropsT = React.InputHTMLAttributes<HTMLInputElement> & {\n label?: string;\n theme: Theme & {\n container?: string;\n input?: string;\n label?: string;\n };\n};\n\n/**\n * Themeable input field, based on the standard HTML `<input>` element.\n * @param [props]\n * @param [props.label] Input label.\n * @param [props.theme] _Ad hoc_ theme.\n * @param [props...] [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)\n * @param [props...] Any other properties are passed to the underlying\n * `<input>` element.\n */\nconst Input = forwardRef<HTMLInputElement, PropsT>((\n {\n label,\n theme,\n ...rest\n }: PropsT,\n ref,\n) => (\n <span className={theme.container}>\n { label === undefined ? null : <p className={theme.label}>{label}</p> }\n <input\n className={theme.input}\n ref={ref}\n {...rest} // eslint-disable-line react/jsx-props-no-spreading\n />\n </span>\n));\n\nconst ThemedInput = themed(Input, 'Input', [\n 'container',\n 'input',\n 'label',\n], defaultTheme);\n\nInput.propTypes = {\n label: PT.string,\n theme: ThemedInput.themeType.isRequired,\n};\n\nInput.defaultProps = {\n label: undefined,\n};\n\nexport default ThemedInput;\n"],"mappings":"gLAAA,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBACA,IAAAC,MAAA,CAAAD,OAAA,UAEA,IAAAE,YAAA,CAAAH,sBAAA,CAAAC,OAAA,8BAA8D,IAAAG,WAAA,CAAAH,OAAA,4BAAAI,YAAA,2GAa9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,KAAM,CAAAC,KAAK,cAAG,GAAAC,iBAAU,EAA2B,CACjD,CACEC,KAAK,CACLC,KAAK,CACL,GAAGC,IACG,CAAC,CACTC,GAAG,gBAEH,GAAAP,WAAA,CAAAQ,IAAA,UAAMC,SAAS,CAAEJ,KAAK,CAACK,SAAU,CAAAC,QAAA,EAC7BP,KAAK,GAAKQ,SAAS,CAAG,IAAI,cAAG,GAAAZ,WAAA,CAAAa,GAAA,OAAGJ,SAAS,CAAEJ,KAAK,CAACD,KAAM,CAAAO,QAAA,CAAEP,KAAK,CAAI,CAAC,cACrE,GAAAJ,WAAA,CAAAa,GAAA,WACEJ,SAAS,CAAEJ,KAAK,CAACS,KAAM,CACvBP,GAAG,CAAEA,GAAI,IACLD,IAAI,CACT,CAAC,EACE,CACP,CAAC,CAEF,KAAM,CAAAS,WAAW,CAAG,GAAAC,oBAAM,EAACd,KAAK,CAAE,OAAO,CAAE,CACzC,WAAW,CACX,OAAO,CACP,OAAO,CACR,CAAED,YAAY,CAAC,CAEhBC,KAAK,CAACe,SAAS,CAAG,CAChBb,KAAK,CAAEc,kBAAE,CAACC,MAAM,CAChBd,KAAK,CAAEU,WAAW,CAACK,SAAS,CAACC,UAC/B,CAAC,CAEDnB,KAAK,CAACoB,YAAY,CAAG,CACnBlB,KAAK,CAAEQ,SACT,CAAC,CAAC,IAAAW,QAAA,CAAAC,OAAA,CAAAC,OAAA,CAEaV,WAAW"}
@@ -1,8 +1,8 @@
1
- "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=Link;var _reactRouterDom=require("react-router-dom");var _GenericLink=_interopRequireDefault(require("./GenericLink"));var _jsxRuntime=require("react/jsx-runtime");/**
1
+ "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _reactRouterDom=require("react-router-dom");var _GenericLink=_interopRequireDefault(require("./GenericLink"));var _jsxRuntime=require("react/jsx-runtime");/**
2
2
  * The Link wraps around React Router's Link component, to automatically replace
3
3
  * it by the regular <a> element when:
4
4
  * - The target reference points to another domain;
5
5
  * - User opts to open the reference in a new tab;
6
6
  * - User explicitely opts to use <a>.
7
- */function Link(props){/* eslint-disable react/jsx-props-no-spreading */return/*#__PURE__*/(0,_jsxRuntime.jsx)(_GenericLink.default,{...props,routerLinkType:_reactRouterDom.Link});/* eslint-enable react/jsx-props-no-spreading */}
7
+ */const Link=props=>/*#__PURE__*/ /* eslint-disable react/jsx-props-no-spreading */(0,_jsxRuntime.jsx)(_GenericLink.default,{...props,routerLinkType:_reactRouterDom.Link})/* eslint-enable react/jsx-props-no-spreading */;var _default=exports.default=Link;
8
8
  //# sourceMappingURL=Link.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Link.js","names":["_reactRouterDom","require","_GenericLink","_interopRequireDefault","_jsxRuntime","Link","props","jsx","default","routerLinkType","RrLink"],"sources":["../../../../src/shared/components/Link.jsx"],"sourcesContent":["/**\n * The Link wraps around React Router's Link component, to automatically replace\n * it by the regular <a> element when:\n * - The target reference points to another domain;\n * - User opts to open the reference in a new tab;\n * - User explicitely opts to use <a>.\n */\n\nimport { Link as RrLink } from 'react-router-dom';\n\nimport GenericLink from './GenericLink';\n\nexport default function Link(props) {\n /* eslint-disable react/jsx-props-no-spreading */\n return <GenericLink {...props} routerLinkType={RrLink} />;\n /* eslint-enable react/jsx-props-no-spreading */\n}\n"],"mappings":"8KAQA,IAAAA,eAAA,CAAAC,OAAA,qBAEA,IAAAC,YAAA,CAAAC,sBAAA,CAAAF,OAAA,mBAAwC,IAAAG,WAAA,CAAAH,OAAA,sBAVxC;AACA;AACA;AACA;AACA;AACA;AACA,GAMe,QAAS,CAAAI,IAAIA,CAACC,KAAK,CAAE,CAClC,iDACA,mBAAO,GAAAF,WAAA,CAAAG,GAAA,EAACL,YAAA,CAAAM,OAAW,KAAKF,KAAK,CAAEG,cAAc,CAAEC,oBAAO,CAAE,CAAC,CACzD,gDACF"}
1
+ {"version":3,"file":"Link.js","names":["_reactRouterDom","require","_GenericLink","_interopRequireDefault","_jsxRuntime","Link","props","jsx","default","routerLinkType","RrLink","_default","exports"],"sources":["../../../../src/shared/components/Link.tsx"],"sourcesContent":["/**\n * The Link wraps around React Router's Link component, to automatically replace\n * it by the regular <a> element when:\n * - The target reference points to another domain;\n * - User opts to open the reference in a new tab;\n * - User explicitely opts to use <a>.\n */\n\nimport { Link as RrLink } from 'react-router-dom';\n\nimport GenericLink, { type PropsT as GenericLinkPropsT } from './GenericLink';\n\ntype PropsT = Omit<GenericLinkPropsT, 'routerLinkType'>;\n\nconst Link: React.FunctionComponent<PropsT> = (props) => (\n /* eslint-disable react/jsx-props-no-spreading */\n <GenericLink {...props} routerLinkType={RrLink} />\n /* eslint-enable react/jsx-props-no-spreading */\n);\n\nexport default Link;\n"],"mappings":"gLAQA,IAAAA,eAAA,CAAAC,OAAA,qBAEA,IAAAC,YAAA,CAAAC,sBAAA,CAAAF,OAAA,mBAA8E,IAAAG,WAAA,CAAAH,OAAA,sBAV9E;AACA;AACA;AACA;AACA;AACA;AACA,GAQA,KAAM,CAAAI,IAAqC,CAAIC,KAAK,gBAClD,iDACA,GAAAF,WAAA,CAAAG,GAAA,EAACL,YAAA,CAAAM,OAAW,KAAKF,KAAK,CAAEG,cAAc,CAAEC,oBAAO,CAAE,CACjD,gDACD,CAAC,IAAAC,QAAA,CAAAC,OAAA,CAAAJ,OAAA,CAEaH,IAAI"}
@@ -1,4 +1,4 @@
1
- "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=MetaTags;var _propTypes=_interopRequireDefault(require("prop-types"));var _react=require("react");var _reactHelmet=require("react-helmet");var _jsxRuntime=require("react/jsx-runtime");const Context=/*#__PURE__*/(0,_react.createContext)();/**
1
+ "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _propTypes=_interopRequireDefault(require("prop-types"));var _react=require("react");var _reactHelmet=require("react-helmet");var _jsxRuntime=require("react/jsx-runtime");const Context=/*#__PURE__*/(0,_react.createContext)({description:"",title:""});/**
2
2
  * The `<MetaTags>` component is an auxiliary wrapper around `react-helmet`,
3
3
  * which helps to inject meta tags (page title, a brief content description,
4
4
  * and social media thumbnails) into generated pages.
@@ -24,31 +24,31 @@
24
24
  * );
25
25
  * }
26
26
  * ```
27
- * @param {object} [props]
28
- * @param {string} [props.description] Page description to use in
27
+ * @param [props]
28
+ * @param [props.description] Page description to use in
29
29
  * the `description` meta tag, and as a default description of Open Graph Tags.
30
- * @param {string} [props.image] The absolute URL of thumbnail image to use
30
+ * @param [props.image] The absolute URL of thumbnail image to use
31
31
  * in Open Graph Tags (`twitter:image`, and `og:image`). By default these tags
32
32
  * are not injected.
33
33
  *
34
34
  * **BEWARE:** It must be a complete, absolute URL, including the correct
35
35
  * website domain and HTTP schema.
36
36
  *
37
- * @param {string} [props.siteName]: The site name to use in `twitter:site`,
37
+ * @param [props.siteName]: The site name to use in `twitter:site`,
38
38
  * and `og:sitename` tags. By default these tags are not injected.
39
39
  *
40
- * @param {string} [props.socialDescription] The site description to use in
40
+ * @param [props.socialDescription] The site description to use in
41
41
  * `twitter:description` and `og:description` meta tags. By default the value of
42
42
  * `description` prop is used.
43
- * @param {string} [props.socialTitle] The page title to use in
43
+ * @param [props.socialTitle] The page title to use in
44
44
  * `twitter:title`, `og:title`, and `og:image:alt` tags. By default the value of
45
45
  * `title` prop is used. Also the `og:image:alt` tag is only injected if `image`
46
46
  * prop is present.
47
47
  *
48
- * @param {string} props.title: The page name to use in the `<title>` tag.
48
+ * @param props.title: The page name to use in the `<title>` tag.
49
49
  * It is also used as the default value of `socialTitle` prop.
50
50
  *
51
- * @param {string} [props.url] The page URL to use in `og:url` tag.
51
+ * @param [props.url] The page URL to use in `og:url` tag.
52
52
  * By default the tag is not injected.
53
- */function MetaTags({children,description,image,siteName,socialDescription,socialTitle,title,url}){const socTitle=socialTitle||title;const socDesc=socialDescription||description;const context=(0,_react.useMemo)(()=>({description,image,siteName,socialDescription,socialTitle,title,url}),[description,image,siteName,socialDescription,socialTitle,title,url]);return/*#__PURE__*/(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[/*#__PURE__*/(0,_jsxRuntime.jsxs)(_reactHelmet.Helmet,{children:[/*#__PURE__*/(0,_jsxRuntime.jsx)("title",{children:title}),/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{name:"description",content:description}),/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{name:"twitter:card",content:"summary_large_image"}),/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{name:"twitter:title",content:socTitle}),/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{name:"twitter:description",content:socDesc}),image?/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{name:"twitter:image",content:image}):null,siteName?/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{name:"twitter:site",content:`@${siteName}`}):null,/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{name:"og:title",content:socTitle}),image?/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{name:"og:image",content:image}):null,image?/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{name:"og:image:alt",content:socTitle}):null,/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{name:"og:description",content:socDesc}),siteName?/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{name:"og:sitename",content:siteName}):null,url?/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{name:"og:url",content:url}):null]}),children?/*#__PURE__*/(0,_jsxRuntime.jsx)(Context.Provider,{value:context,children:children}):null]})}MetaTags.Context=Context;MetaTags.defaultProps={children:null,image:null,siteName:null,socialDescription:null,socialTitle:null,url:null};MetaTags.propTypes={children:_propTypes.default.node,description:_propTypes.default.string.isRequired,image:_propTypes.default.string,siteName:_propTypes.default.string,socialDescription:_propTypes.default.string,socialTitle:_propTypes.default.string,title:_propTypes.default.string.isRequired,url:_propTypes.default.string};
53
+ */const MetaTags=({children,description,image,siteName,socialDescription,socialTitle,title,url})=>{const socTitle=socialTitle||title;const socDesc=socialDescription||description;const context=(0,_react.useMemo)(()=>({description,image,siteName,socialDescription,socialTitle,title,url}),[description,image,siteName,socialDescription,socialTitle,title,url]);return/*#__PURE__*/(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[/*#__PURE__*/(0,_jsxRuntime.jsxs)(_reactHelmet.Helmet,{children:[/*#__PURE__*/(0,_jsxRuntime.jsx)("title",{children:title}),/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{name:"description",content:description}),/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{name:"twitter:card",content:"summary_large_image"}),/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{name:"twitter:title",content:socTitle}),/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{name:"twitter:description",content:socDesc}),image?/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{name:"twitter:image",content:image}):null,siteName?/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{name:"twitter:site",content:`@${siteName}`}):null,/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{name:"og:title",content:socTitle}),image?/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{name:"og:image",content:image}):null,image?/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{name:"og:image:alt",content:socTitle}):null,/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{name:"og:description",content:socDesc}),siteName?/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{name:"og:sitename",content:siteName}):null,url?/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{name:"og:url",content:url}):null]}),children?/*#__PURE__*/(0,_jsxRuntime.jsx)(Context.Provider,{value:context,children:children}):null]})};MetaTags.Context=Context;MetaTags.defaultProps={children:null,image:"",siteName:"",socialDescription:"",socialTitle:"",url:""};MetaTags.propTypes={children:_propTypes.default.node,description:_propTypes.default.string.isRequired,image:_propTypes.default.string,siteName:_propTypes.default.string,socialDescription:_propTypes.default.string,socialTitle:_propTypes.default.string,title:_propTypes.default.string.isRequired,url:_propTypes.default.string};var _default=exports.default=MetaTags;
54
54
  //# sourceMappingURL=MetaTags.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MetaTags.js","names":["_propTypes","_interopRequireDefault","require","_react","_reactHelmet","_jsxRuntime","Context","createContext","MetaTags","children","description","image","siteName","socialDescription","socialTitle","title","url","socTitle","socDesc","context","useMemo","jsxs","Fragment","Helmet","jsx","name","content","Provider","value","defaultProps","propTypes","PT","node","string","isRequired"],"sources":["../../../../src/shared/components/MetaTags.jsx"],"sourcesContent":["import PT from 'prop-types';\nimport { createContext, useMemo } from 'react';\nimport { Helmet } from 'react-helmet';\n\nconst Context = createContext();\n\n/**\n * The `<MetaTags>` component is an auxiliary wrapper around `react-helmet`,\n * which helps to inject meta tags (page title, a brief content description,\n * and social media thumbnails) into generated pages.\n *\n * When `<MetaTags>` are nested within the app's component tree, meta tags\n * content injected by components encountered down the tree overrides tags\n * injected by previously encountered `<MetaTags>` components.\n *\n * **Children:** `<MetaTags>` children, if any, are rendered at the component's\n * location. The context passes down all meta tag properties of parent\n * `<MetaTag>` instances. These properties can fetched within children\n * hierarchy in the following way, thus facilitating tags modification by\n * children:\n * ```jsx\n * import { useContext } from 'react';\n * import { MetaTags } from '@dr.pogodin/react-utils';\n * export default function SampleComponent() {\n * const { title, description, ...rest } = useContext(MetaTags.Context);\n * // Do something with these props here, e.g. prefix the page title with\n * // the component name:\n * return (\n * <MetaTags title={`Sample component - ${title}`} />\n * );\n * }\n * ```\n * @param {object} [props]\n * @param {string} [props.description] Page description to use in\n * the `description` meta tag, and as a default description of Open Graph Tags.\n * @param {string} [props.image] The absolute URL of thumbnail image to use\n * in Open Graph Tags (`twitter:image`, and `og:image`). By default these tags\n * are not injected.\n *\n * **BEWARE:** It must be a complete, absolute URL, including the correct\n * website domain and HTTP schema.\n *\n * @param {string} [props.siteName]: The site name to use in `twitter:site`,\n * and `og:sitename` tags. By default these tags are not injected.\n *\n * @param {string} [props.socialDescription] The site description to use in\n * `twitter:description` and `og:description` meta tags. By default the value of\n * `description` prop is used.\n * @param {string} [props.socialTitle] The page title to use in\n * `twitter:title`, `og:title`, and `og:image:alt` tags. By default the value of\n * `title` prop is used. Also the `og:image:alt` tag is only injected if `image`\n * prop is present.\n *\n * @param {string} props.title: The page name to use in the `<title>` tag.\n * It is also used as the default value of `socialTitle` prop.\n *\n * @param {string} [props.url] The page URL to use in `og:url` tag.\n * By default the tag is not injected.\n */\nexport default function MetaTags({\n children,\n description,\n image,\n siteName,\n socialDescription,\n socialTitle,\n title,\n url,\n}) {\n const socTitle = socialTitle || title;\n const socDesc = socialDescription || description;\n\n const context = useMemo(() => ({\n description,\n image,\n siteName,\n socialDescription,\n socialTitle,\n title,\n url,\n }), [\n description,\n image,\n siteName,\n socialDescription,\n socialTitle,\n title,\n url,\n ]);\n\n return (\n <>\n <Helmet>\n {/* General tags. */}\n <title>\n {title}\n </title>\n <meta name=\"description\" content={description} />\n\n {/* Twitter cards. */}\n <meta name=\"twitter:card\" content=\"summary_large_image\" />\n <meta name=\"twitter:title\" content={socTitle} />\n <meta name=\"twitter:description\" content={socDesc} />\n { image ? <meta name=\"twitter:image\" content={image} /> : null }\n {\n siteName ? (\n <meta name=\"twitter:site\" content={`@${siteName}`} />\n ) : null\n }\n\n {/* Open Graph data. */}\n <meta name=\"og:title\" content={socTitle} />\n { image ? <meta name=\"og:image\" content={image} /> : null }\n { image ? <meta name=\"og:image:alt\" content={socTitle} /> : null }\n <meta name=\"og:description\" content={socDesc} />\n {\n siteName ? (<meta name=\"og:sitename\" content={siteName} />) : null\n }\n { url ? (<meta name=\"og:url\" content={url} />) : null }\n </Helmet>\n {\n children ? (\n <Context.Provider value={context}>\n {children}\n </Context.Provider>\n ) : null\n }\n </>\n );\n}\n\nMetaTags.Context = Context;\n\nMetaTags.defaultProps = {\n children: null,\n image: null,\n siteName: null,\n socialDescription: null,\n socialTitle: null,\n url: null,\n};\n\nMetaTags.propTypes = {\n children: PT.node,\n description: PT.string.isRequired,\n image: PT.string,\n siteName: PT.string,\n socialDescription: PT.string,\n socialTitle: PT.string,\n title: PT.string.isRequired,\n url: PT.string,\n};\n"],"mappings":"kLAAA,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBACA,IAAAC,MAAA,CAAAD,OAAA,UACA,IAAAE,YAAA,CAAAF,OAAA,iBAAsC,IAAAG,WAAA,CAAAH,OAAA,sBAEtC,KAAM,CAAAI,OAAO,cAAG,GAAAC,oBAAa,EAAC,CAAC,CAE/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACe,QAAS,CAAAC,QAAQA,CAAC,CAC/BC,QAAQ,CACRC,WAAW,CACXC,KAAK,CACLC,QAAQ,CACRC,iBAAiB,CACjBC,WAAW,CACXC,KAAK,CACLC,GACF,CAAC,CAAE,CACD,KAAM,CAAAC,QAAQ,CAAGH,WAAW,EAAIC,KAAK,CACrC,KAAM,CAAAG,OAAO,CAAGL,iBAAiB,EAAIH,WAAW,CAEhD,KAAM,CAAAS,OAAO,CAAG,GAAAC,cAAO,EAAC,KAAO,CAC7BV,WAAW,CACXC,KAAK,CACLC,QAAQ,CACRC,iBAAiB,CACjBC,WAAW,CACXC,KAAK,CACLC,GACF,CAAC,CAAC,CAAE,CACFN,WAAW,CACXC,KAAK,CACLC,QAAQ,CACRC,iBAAiB,CACjBC,WAAW,CACXC,KAAK,CACLC,GAAG,CACJ,CAAC,CAEF,mBACE,GAAAX,WAAA,CAAAgB,IAAA,EAAAhB,WAAA,CAAAiB,QAAA,EAAAb,QAAA,eACE,GAAAJ,WAAA,CAAAgB,IAAA,EAACjB,YAAA,CAAAmB,MAAM,EA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C,aAAa,CAACC,OAAO,CAAEd,QAAS,CAAE,CAAC,CAAI,IAAI,CAElEI,GAAG,cAAI,GAAAX,WAAA,CAAAmB,GAAA,UAAMC,IAAI,CAAC,QAAQ,CAACC,OAAO,CAAEV,GAAI,CAAE,CAAC,CAAI,IAAI,EAC/C,CAAC,CAEPP,QAAQ,cACN,GAAAJ,WAAA,CAAAmB,GAAA,EAAClB,OAAO,CAACqB,QAAQ,EAACC,KAAK,CAAET,OAAQ,CAAAV,QAAA,CAC9BA,QAAQ,CACO,CAAC,CACjB,IAAI,EAEV,CAEN,CAEAD,QAAQ,CAACF,OAAO,CAAGA,OAAO,CAE1BE,QAAQ,CAACqB,YAAY,CAAG,CACtBpB,QAAQ,CAAE,IAAI,CACdE,KAAK,CAAE,IAAI,CACXC,QAAQ,CAAE,IAAI,CACdC,iBAAiB,CAAE,IAAI,CACvBC,WAAW,CAAE,IAAI,CACjBE,GAAG,CAAE,IACP,CAAC,CAEDR,QAAQ,CAACsB,SAAS,CAAG,CACnBrB,QAAQ,CAAEsB,kBAAE,CAACC,IAAI,CACjBtB,WAAW,CAAEqB,kBAAE,CAACE,MAAM,CAACC,UAAU,CACjCvB,KAAK,CAAEoB,kBAAE,CAACE,MAAM,CAChBrB,QAAQ,CAAEmB,kBAAE,CAACE,MAAM,CACnBpB,iBAAiB,CAAEkB,kBAAE,CAACE,MAAM,CAC5BnB,WAAW,CAAEiB,kBAAE,CAACE,MAAM,CACtBlB,KAAK,CAAEgB,kBAAE,CAACE,MAAM,CAACC,UAAU,CAC3BlB,GAAG,CAAEe,kBAAE,CAACE,MACV,CAAC"}
1
+ {"version":3,"file":"MetaTags.js","names":["_propTypes","_interopRequireDefault","require","_react","_reactHelmet","_jsxRuntime","Context","createContext","description","title","MetaTags","children","image","siteName","socialDescription","socialTitle","url","socTitle","socDesc","context","useMemo","jsxs","Fragment","Helmet","jsx","name","content","Provider","value","defaultProps","propTypes","PT","node","string","isRequired","_default","exports","default"],"sources":["../../../../src/shared/components/MetaTags.tsx"],"sourcesContent":["import PT from 'prop-types';\nimport { type ReactNode, createContext, useMemo } from 'react';\nimport { Helmet } from 'react-helmet';\n\ntype PropsT = {\n children?: ReactNode;\n description: string;\n image?: string;\n siteName?: string;\n socialDescription?: string;\n socialTitle?: string;\n title: string;\n url?: string;\n};\n\nconst Context = createContext<PropsT>({\n description: '',\n title: '',\n});\n\n/**\n * The `<MetaTags>` component is an auxiliary wrapper around `react-helmet`,\n * which helps to inject meta tags (page title, a brief content description,\n * and social media thumbnails) into generated pages.\n *\n * When `<MetaTags>` are nested within the app's component tree, meta tags\n * content injected by components encountered down the tree overrides tags\n * injected by previously encountered `<MetaTags>` components.\n *\n * **Children:** `<MetaTags>` children, if any, are rendered at the component's\n * location. The context passes down all meta tag properties of parent\n * `<MetaTag>` instances. These properties can fetched within children\n * hierarchy in the following way, thus facilitating tags modification by\n * children:\n * ```jsx\n * import { useContext } from 'react';\n * import { MetaTags } from '@dr.pogodin/react-utils';\n * export default function SampleComponent() {\n * const { title, description, ...rest } = useContext(MetaTags.Context);\n * // Do something with these props here, e.g. prefix the page title with\n * // the component name:\n * return (\n * <MetaTags title={`Sample component - ${title}`} />\n * );\n * }\n * ```\n * @param [props]\n * @param [props.description] Page description to use in\n * the `description` meta tag, and as a default description of Open Graph Tags.\n * @param [props.image] The absolute URL of thumbnail image to use\n * in Open Graph Tags (`twitter:image`, and `og:image`). By default these tags\n * are not injected.\n *\n * **BEWARE:** It must be a complete, absolute URL, including the correct\n * website domain and HTTP schema.\n *\n * @param [props.siteName]: The site name to use in `twitter:site`,\n * and `og:sitename` tags. By default these tags are not injected.\n *\n * @param [props.socialDescription] The site description to use in\n * `twitter:description` and `og:description` meta tags. By default the value of\n * `description` prop is used.\n * @param [props.socialTitle] The page title to use in\n * `twitter:title`, `og:title`, and `og:image:alt` tags. By default the value of\n * `title` prop is used. Also the `og:image:alt` tag is only injected if `image`\n * prop is present.\n *\n * @param props.title: The page name to use in the `<title>` tag.\n * It is also used as the default value of `socialTitle` prop.\n *\n * @param [props.url] The page URL to use in `og:url` tag.\n * By default the tag is not injected.\n */\nconst MetaTags: React.FunctionComponent<PropsT> & {\n Context: React.Context<PropsT>;\n} = ({\n children,\n description,\n image,\n siteName,\n socialDescription,\n socialTitle,\n title,\n url,\n}) => {\n const socTitle = socialTitle || title;\n const socDesc = socialDescription || description;\n\n const context = useMemo(() => ({\n description,\n image,\n siteName,\n socialDescription,\n socialTitle,\n title,\n url,\n }), [\n description,\n image,\n siteName,\n socialDescription,\n socialTitle,\n title,\n url,\n ]);\n\n return (\n <>\n <Helmet>\n {/* General tags. */}\n <title>\n {title}\n </title>\n <meta name=\"description\" content={description} />\n\n {/* Twitter cards. */}\n <meta name=\"twitter:card\" content=\"summary_large_image\" />\n <meta name=\"twitter:title\" content={socTitle} />\n <meta name=\"twitter:description\" content={socDesc} />\n { image ? <meta name=\"twitter:image\" content={image} /> : null }\n {\n siteName ? (\n <meta name=\"twitter:site\" content={`@${siteName}`} />\n ) : null\n }\n\n {/* Open Graph data. */}\n <meta name=\"og:title\" content={socTitle} />\n { image ? <meta name=\"og:image\" content={image} /> : null }\n { image ? <meta name=\"og:image:alt\" content={socTitle} /> : null }\n <meta name=\"og:description\" content={socDesc} />\n {\n siteName ? (<meta name=\"og:sitename\" content={siteName} />) : null\n }\n { url ? (<meta name=\"og:url\" content={url} />) : null }\n </Helmet>\n {\n children ? (\n <Context.Provider value={context}>\n {children}\n </Context.Provider>\n ) : null\n }\n </>\n );\n};\n\nMetaTags.Context = Context;\n\nMetaTags.defaultProps = {\n children: null,\n image: '',\n siteName: '',\n socialDescription: '',\n socialTitle: '',\n url: '',\n};\n\nMetaTags.propTypes = {\n children: PT.node,\n description: PT.string.isRequired,\n image: PT.string,\n siteName: PT.string,\n socialDescription: PT.string,\n socialTitle: PT.string,\n title: PT.string.isRequired,\n url: PT.string,\n};\n\nexport default MetaTags;\n"],"mappings":"gLAAA,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,O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A,CAAAmB,GAAA,UAAMC,IAAI,CAAC,QAAQ,CAACC,OAAO,CAAEV,GAAI,CAAE,CAAC,CAAI,IAAI,EAC/C,CAAC,CAEPL,QAAQ,cACN,GAAAN,WAAA,CAAAmB,GAAA,EAAClB,OAAO,CAACqB,QAAQ,EAACC,KAAK,CAAET,OAAQ,CAAAR,QAAA,CAC9BA,QAAQ,CACO,CAAC,CACjB,IAAI,EAEV,CAEN,CAAC,CAEDD,QAAQ,CAACJ,OAAO,CAAGA,OAAO,CAE1BI,QAAQ,CAACmB,YAAY,CAAG,CACtBlB,QAAQ,CAAE,IAAI,CACdC,KAAK,CAAE,EAAE,CACTC,QAAQ,CAAE,EAAE,CACZC,iBAAiB,CAAE,EAAE,CACrBC,WAAW,CAAE,EAAE,CACfC,GAAG,CAAE,EACP,CAAC,CAEDN,QAAQ,CAACoB,SAAS,CAAG,CACnBnB,QAAQ,CAAEoB,kBAAE,CAACC,IAAI,CACjBxB,WAAW,CAAEuB,kBAAE,CAACE,MAAM,CAACC,UAAU,CACjCtB,KAAK,CAAEmB,kBAAE,CAACE,MAAM,CAChBpB,QAAQ,CAAEkB,kBAAE,CAACE,MAAM,CACnBnB,iBAAiB,CAAEiB,kBAAE,CAACE,MAAM,CAC5BlB,WAAW,CAAEgB,kBAAE,CAACE,MAAM,CACtBxB,KAAK,CAAEsB,kBAAE,CAACE,MAAM,CAACC,UAAU,CAC3BlB,GAAG,CAAEe,kBAAE,CAACE,MACV,CAAC,CAAC,IAAAE,QAAA,CAAAC,OAAA,CAAAC,OAAA,CAEa3B,QAAQ"}
@@ -1,4 +1,4 @@
1
- "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.BaseModal=BaseModal;exports.default=void 0;var _lodash=require("lodash");var _react=require("react");var _reactDom=_interopRequireDefault(require("react-dom"));var _propTypes=_interopRequireDefault(require("prop-types"));var _reactThemes=_interopRequireDefault(require("@dr.pogodin/react-themes"));var _jsxRuntime=require("react/jsx-runtime");/* global document */const baseTheme={"context":"Szmbbz","ad":"Ah-Nsc","hoc":"Wki41G","overlay":"ye2BZo","container":"gyZ4rc"};/**
1
+ "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=exports.BaseModal=void 0;var _lodash=require("lodash");var _react=require("react");var _reactDom=_interopRequireDefault(require("react-dom"));var _propTypes=_interopRequireDefault(require("prop-types"));var _reactThemes=_interopRequireDefault(require("@dr.pogodin/react-themes"));var _jsxRuntime=require("react/jsx-runtime");/* global document */const baseTheme={"context":"Szmbbz","ad":"Ah-Nsc","hoc":"Wki41G","overlay":"ye2BZo","container":"gyZ4rc"};/**
2
2
  * The `<Modal>` component implements a simple themeable modal window, wrapped
3
3
  * into the default theme. `<BaseModal>` exposes the base non-themed component.
4
4
  * **Children:** Component children are rendered as the modal content.
@@ -8,5 +8,5 @@
8
8
  * clicks outside the modal, or presses Escape. It is expected to hide the
9
9
  * modal.
10
10
  * @param {ModalTheme} [props.theme] _Ad hoc_ theme.
11
- */function BaseModal({children,onCancel,theme}){const containerRef=(0,_react.useRef)();const overlayRef=(0,_react.useRef)();const[portal,setPortal]=(0,_react.useState)();(0,_react.useEffect)(()=>{const p=document.createElement("div");document.body.classList.add("scrolling-disabled-by-modal");document.body.appendChild(p);setPortal(p);return()=>{document.body.classList.remove("scrolling-disabled-by-modal");document.body.removeChild(p)}},[]);const focusLast=(0,_react.useMemo)(()=>/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{onFocus:()=>{const elems=containerRef.current.querySelectorAll("*");for(let i=elems.length-1;i>=0;--i){elems[i].focus();if(document.activeElement===elems[i])return}overlayRef.current.focus()}/* eslint-disable jsx-a11y/no-noninteractive-tabindex */,tabIndex:"0"/* eslint-enable jsx-a11y/no-noninteractive-tabindex */}),[]);return portal?/*#__PURE__*/_reactDom.default.createPortal(/*#__PURE__*/(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[focusLast,/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{"aria-label":"Cancel",className:theme.overlay,onClick:()=>onCancel(),onKeyDown:e=>{if(e.key==="Escape")onCancel()},ref:node=>{if(node&&node!==overlayRef.current){overlayRef.current=node;node.focus()}},role:"button",tabIndex:"0"}),/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{"aria-modal":"true",className:theme.container,onWheel:event=>event.stopPropagation(),ref:containerRef,role:"dialog",children:children}),/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{onFocus:()=>{overlayRef.current.focus()}/* eslint-disable jsx-a11y/no-noninteractive-tabindex */,tabIndex:"0"/* eslint-enable jsx-a11y/no-noninteractive-tabindex */}),focusLast]}),portal):null}const ThemedModal=(0,_reactThemes.default)("Modal",["container","overlay"],baseTheme)(BaseModal);BaseModal.propTypes={onCancel:_propTypes.default.func,children:_propTypes.default.node,theme:ThemedModal.themeType.isRequired};BaseModal.defaultProps={onCancel:_lodash.noop,children:null};var _default=ThemedModal;/* Non-themed version of the Modal. */exports.default=_default;
11
+ */const BaseModal=({children,onCancel,theme})=>{const containerRef=(0,_react.useRef)(null);const overlayRef=(0,_react.useRef)(null);const[portal,setPortal]=(0,_react.useState)();(0,_react.useEffect)(()=>{const p=document.createElement("div");document.body.classList.add("scrolling-disabled-by-modal");document.body.appendChild(p);setPortal(p);return()=>{document.body.classList.remove("scrolling-disabled-by-modal");document.body.removeChild(p)}},[]);const focusLast=(0,_react.useMemo)(()=>/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{onFocus:()=>{const elems=containerRef.current?.querySelectorAll("*");for(let i=elems.length-1;i>=0;--i){elems[i].focus();if(document.activeElement===elems[i])return}overlayRef.current?.focus()}/* eslint-disable jsx-a11y/no-noninteractive-tabindex */,tabIndex:0/* eslint-enable jsx-a11y/no-noninteractive-tabindex */}),[]);return portal?/*#__PURE__*/_reactDom.default.createPortal(/*#__PURE__*/(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[focusLast,/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{"aria-label":"Cancel",className:theme.overlay,onClick:()=>onCancel&&onCancel(),onKeyDown:e=>{if(e.key==="Escape"&&onCancel)onCancel()},ref:node=>{if(node&&node!==overlayRef.current){overlayRef.current=node;node.focus()}},role:"button",tabIndex:0}),/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{"aria-modal":"true",className:theme.container,onWheel:event=>event.stopPropagation(),ref:containerRef,role:"dialog",children:children}),/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{onFocus:()=>{overlayRef.current?.focus()}/* eslint-disable jsx-a11y/no-noninteractive-tabindex */,tabIndex:0/* eslint-enable jsx-a11y/no-noninteractive-tabindex */}),focusLast]}),portal):null};exports.BaseModal=BaseModal;const ThemedModal=(0,_reactThemes.default)(BaseModal,"Modal",["container","overlay"],baseTheme);BaseModal.propTypes={onCancel:_propTypes.default.func,children:_propTypes.default.node,theme:ThemedModal.themeType.isRequired};BaseModal.defaultProps={onCancel:_lodash.noop,children:null};var _default=exports.default=ThemedModal;/* Non-themed version of the Modal. */
12
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_lodash","require","_react","_reactDom","_interopRequireDefault","_propTypes","_reactThemes","_jsxRuntime","baseTheme","BaseModal","children","onCancel","theme","containerRef","useRef","overlayRef","portal","setPortal","useState","useEffect","p","document","createElement","body","classList","add","appendChild","remove","removeChild","focusLast","useMemo","jsx","onFocus","elems","current","querySelectorAll","i","length","focus","activeElement","tabIndex","ReactDom","createPortal","jsxs","Fragment","className","overlay","onClick","onKeyDown","e","key","ref","node","role","container","onWheel","event","stopPropagation","ThemedModal","themed","propTypes","PT","func","themeType","isRequired","defaultProps","noop","_default","exports","default"],"sources":["../../../../../src/shared/components/Modal/index.jsx"],"sourcesContent":["/* global document */\n\nimport { noop } from 'lodash';\n\nimport {\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport ReactDom from 'react-dom';\nimport PT from 'prop-types';\nimport themed from '@dr.pogodin/react-themes';\n\nimport baseTheme from './base-theme.scss';\nimport './styles.scss';\n\n/**\n * The `<Modal>` component implements a simple themeable modal window, wrapped\n * into the default theme. `<BaseModal>` exposes the base non-themed component.\n * **Children:** Component children are rendered as the modal content.\n * @param {object} props Component properties. Beside props documented below,\n * [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties) are supported as well.\n * @param {function} [props.onCancel] The callback to trigger when user\n * clicks outside the modal, or presses Escape. It is expected to hide the\n * modal.\n * @param {ModalTheme} [props.theme] _Ad hoc_ theme.\n */\nfunction BaseModal({\n children,\n onCancel,\n theme,\n}) {\n const containerRef = useRef();\n const overlayRef = useRef();\n const [portal, setPortal] = useState();\n\n useEffect(() => {\n const p = document.createElement('div');\n document.body.classList.add('scrolling-disabled-by-modal');\n document.body.appendChild(p);\n setPortal(p);\n return () => {\n document.body.classList.remove('scrolling-disabled-by-modal');\n document.body.removeChild(p);\n };\n }, []);\n\n const focusLast = useMemo(() => (\n <div\n onFocus={() => {\n const elems = containerRef.current.querySelectorAll('*');\n for (let i = elems.length - 1; i >= 0; --i) {\n elems[i].focus();\n if (document.activeElement === elems[i]) return;\n }\n overlayRef.current.focus();\n }}\n /* eslint-disable jsx-a11y/no-noninteractive-tabindex */\n tabIndex=\"0\"\n /* eslint-enable jsx-a11y/no-noninteractive-tabindex */\n />\n ), []);\n\n return portal ? ReactDom.createPortal(\n (\n <>\n {focusLast}\n <div\n aria-label=\"Cancel\"\n className={theme.overlay}\n onClick={() => onCancel()}\n onKeyDown={(e) => {\n if (e.key === 'Escape') onCancel();\n }}\n ref={(node) => {\n if (node && node !== overlayRef.current) {\n overlayRef.current = node;\n node.focus();\n }\n }}\n role=\"button\"\n tabIndex=\"0\"\n />\n <div\n aria-modal=\"true\"\n className={theme.container}\n onWheel={(event) => event.stopPropagation()}\n ref={containerRef}\n role=\"dialog\"\n >\n {children}\n </div>\n <div\n onFocus={() => {\n overlayRef.current.focus();\n }}\n /* eslint-disable jsx-a11y/no-noninteractive-tabindex */\n tabIndex=\"0\"\n /* eslint-enable jsx-a11y/no-noninteractive-tabindex */\n />\n {focusLast}\n </>\n ),\n portal,\n ) : null;\n}\n\nconst ThemedModal = themed(\n 'Modal',\n [\n 'container',\n 'overlay',\n ],\n baseTheme,\n)(BaseModal);\n\nBaseModal.propTypes = {\n onCancel: PT.func,\n children: PT.node,\n theme: ThemedModal.themeType.isRequired,\n};\n\nBaseModal.defaultProps = {\n onCancel: noop,\n children: null,\n};\n\nexport default ThemedModal;\n\n/* Non-themed version of the Modal. */\nexport { BaseModal };\n"],"mappings":"4MAEA,IAAAA,OAAA,CAAAC,OAAA,WAEA,IAAAC,MAAA,CAAAD,OAAA,UAOA,IAAAE,SAAA,CAAAC,sBAAA,CAAAH,OAAA,eACA,IAAAI,UAAA,CAAAD,sBAAA,CAAAH,OAAA,gBACA,IAAAK,YAAA,CAAAF,sBAAA,CAAAH,OAAA,8BAA8C,IAAAM,WAAA,CAAAN,OAAA,sBAb9C,2BAAAO,SAAA,2FAkBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,QAAS,CAAAC,SAASA,CAAC,CACjBC,QAAQ,CACRC,QAAQ,CACRC,KACF,CAAC,CAAE,CACD,KAAM,CAAAC,YAAY,CAAG,GAAAC,aAAM,EAAC,CAAC,CAC7B,KAAM,CAAAC,UAAU,CAAG,GAAAD,aAAM,EAAC,CAAC,CAC3B,KAAM,CAACE,MAAM,CAAEC,SAAS,CAAC,CAAG,GAAAC,eAAQ,EAAC,CAAC,CAEtC,GAAAC,gBAAS,EAAC,IAAM,CACd,KAAM,CAAAC,CAAC,CAAGC,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC,CACvCD,QAAQ,CAACE,IAAI,CAACC,SAAS,CAACC,GAAG,CAAC,6BAA6B,CAAC,CAC1DJ,QAAQ,CAACE,IAAI,CAACG,WAAW,CAACN,CAAC,CA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AI,EAAIA,IAAI,GAAKrC,UAAU,CAACmB,OAAO,CAAE,CACvCnB,UAAU,CAACmB,OAAO,CAAGkB,IAAI,CACzBA,IAAI,CAACd,KAAK,CAAC,CACb,CACF,CAAE,CACFe,IAAI,CAAC,QAAQ,CACbb,QAAQ,CAAC,GAAG,CACb,CAAC,cACF,GAAAjC,WAAA,CAAAwB,GAAA,SACE,aAAW,MAAM,CACjBc,SAAS,CAAEjC,KAAK,CAAC0C,SAAU,CAC3BC,OAAO,CAAGC,KAAK,EAAKA,KAAK,CAACC,eAAe,CAAC,CAAE,CAC5CN,GAAG,CAAEtC,YAAa,CAClBwC,IAAI,CAAC,QAAQ,CAAA3C,QAAA,CAEZA,QAAQ,CACN,CAAC,cACN,GAAAH,WAAA,CAAAwB,GAAA,SACEC,OAAO,CAAEA,CAAA,GAAM,CACbjB,UAAU,CAACmB,OAAO,CAACI,KAAK,CAAC,CAC3B,CACA,yDACAE,QAAQ,CAAC,GACT,wDACD,CAAC,CACDX,SAAS,EACV,CAAC,CAELb,MACF,CAAC,CAAG,IACN,CAEA,KAAM,CAAA0C,WAAW,CAAG,GAAAC,oBAAM,EACxB,OAAO,CACP,CACE,WAAW,CACX,SAAS,CACV,CACDnD,SACF,CAAC,CAACC,SAAS,CAAC,CAEZA,SAAS,CAACmD,SAAS,CAAG,CACpBjD,QAAQ,CAAEkD,kBAAE,CAACC,IAAI,CACjBpD,QAAQ,CAAEmD,kBAAE,CAACT,IAAI,CACjBxC,KAAK,CAAE8C,WAAW,CAACK,SAAS,CAACC,UAC/B,CAAC,CAEDvD,SAAS,CAACwD,YAAY,CAAG,CACvBtD,QAAQ,CAAEuD,YAAI,CACdxD,QAAQ,CAAE,IACZ,CAAC,CAAC,IAAAyD,QAAA,CAEaT,WAAW,CAE1B,sCAAAU,OAAA,CAAAC,OAAA,CAAAF,QAAA"}
1
+ {"version":3,"file":"index.js","names":["_lodash","require","_react","_reactDom","_interopRequireDefault","_propTypes","_reactThemes","_jsxRuntime","baseTheme","BaseModal","children","onCancel","theme","containerRef","useRef","overlayRef","portal","setPortal","useState","useEffect","p","document","createElement","body","classList","add","appendChild","remove","removeChild","focusLast","useMemo","jsx","onFocus","elems","current","querySelectorAll","i","length","focus","activeElement","tabIndex","ReactDom","createPortal","jsxs","Fragment","className","overlay","onClick","onKeyDown","e","key","ref","node","role","container","onWheel","event","stopPropagation","exports","ThemedModal","themed","propTypes","PT","func","themeType","isRequired","defaultProps","noop","_default","default"],"sources":["../../../../../src/shared/components/Modal/index.tsx"],"sourcesContent":["/* global document */\n\nimport { noop } from 'lodash';\n\nimport {\n type ReactNode,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport ReactDom from 'react-dom';\nimport PT from 'prop-types';\nimport themed, { type Theme } from '@dr.pogodin/react-themes';\n\nimport baseTheme from './base-theme.scss';\nimport './styles.scss';\n\ntype PropsT = {\n children?: ReactNode;\n onCancel?: () => void;\n theme: Theme & {\n container?: string;\n overlay?: string;\n };\n};\n\n/**\n * The `<Modal>` component implements a simple themeable modal window, wrapped\n * into the default theme. `<BaseModal>` exposes the base non-themed component.\n * **Children:** Component children are rendered as the modal content.\n * @param {object} props Component properties. Beside props documented below,\n * [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties) are supported as well.\n * @param {function} [props.onCancel] The callback to trigger when user\n * clicks outside the modal, or presses Escape. It is expected to hide the\n * modal.\n * @param {ModalTheme} [props.theme] _Ad hoc_ theme.\n */\nconst BaseModal: React.FunctionComponent<PropsT> = ({\n children,\n onCancel,\n theme,\n}) => {\n const containerRef = useRef<HTMLDivElement | null>(null);\n const overlayRef = useRef<HTMLDivElement | null>(null);\n const [portal, setPortal] = useState<HTMLDivElement>();\n\n useEffect(() => {\n const p = document.createElement('div');\n document.body.classList.add('scrolling-disabled-by-modal');\n document.body.appendChild(p);\n setPortal(p);\n return () => {\n document.body.classList.remove('scrolling-disabled-by-modal');\n document.body.removeChild(p);\n };\n }, []);\n\n const focusLast = useMemo(() => (\n <div\n onFocus={() => {\n const elems = containerRef.current?.querySelectorAll('*') as NodeListOf<HTMLElement>;\n for (let i = elems.length - 1; i >= 0; --i) {\n elems[i].focus();\n if (document.activeElement === elems[i]) return;\n }\n overlayRef.current?.focus();\n }}\n /* eslint-disable jsx-a11y/no-noninteractive-tabindex */\n tabIndex={0}\n /* eslint-enable jsx-a11y/no-noninteractive-tabindex */\n />\n ), []);\n\n return portal ? ReactDom.createPortal(\n (\n <>\n {focusLast}\n <div\n aria-label=\"Cancel\"\n className={theme.overlay}\n onClick={() => onCancel && onCancel()}\n onKeyDown={(e) => {\n if (e.key === 'Escape' && onCancel) onCancel();\n }}\n ref={(node) => {\n if (node && node !== overlayRef.current) {\n overlayRef.current = node;\n node.focus();\n }\n }}\n role=\"button\"\n tabIndex={0}\n />\n <div\n aria-modal=\"true\"\n className={theme.container}\n onWheel={(event) => event.stopPropagation()}\n ref={containerRef}\n role=\"dialog\"\n >\n {children}\n </div>\n <div\n onFocus={() => {\n overlayRef.current?.focus();\n }}\n /* eslint-disable jsx-a11y/no-noninteractive-tabindex */\n tabIndex={0}\n /* eslint-enable jsx-a11y/no-noninteractive-tabindex */\n />\n {focusLast}\n </>\n ),\n portal,\n ) : null;\n};\n\nconst ThemedModal = themed(\n BaseModal,\n 'Modal',\n [\n 'container',\n 'overlay',\n ],\n baseTheme,\n);\n\nBaseModal.propTypes = {\n onCancel: PT.func,\n children: PT.node,\n theme: ThemedModal.themeType.isRequired,\n};\n\nBaseModal.defaultProps = {\n onCancel: noop,\n children: null,\n};\n\nexport default ThemedModal;\n\n/* Non-themed version of the Modal. */\nexport { BaseModal };\n"],"mappings":"kMAEA,IAAAA,OAAA,CAAAC,OAAA,WAEA,IAAAC,MAAA,CAAAD,OAAA,UAQA,IAAAE,SAAA,CAAAC,sBAAA,CAAAH,OAAA,eACA,IAAAI,UAAA,CAAAD,sBAAA,CAAAH,OAAA,gBACA,IAAAK,YAAA,CAAAF,sBAAA,CAAAH,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,CAAC,CAC5B,CACA,yDACAE,QAAQ,CAAE,CACV,wDACD,CAAC,CACDX,SAAS,EACV,CAAC,CAELb,MACF,CAAC,CAAG,IACN,CAAC,CAAC0C,OAAA,CAAAjD,SAAA,CAAAA,SAAA,CAEF,KAAM,CAAAkD,WAAW,CAAG,GAAAC,oBAAM,EACxBnD,SAAS,CACT,OAAO,CACP,CACE,WAAW,CACX,SAAS,CACV,CACDD,SACF,CAAC,CAEDC,SAAS,CAACoD,SAAS,CAAG,CACpBlD,QAAQ,CAAEmD,kBAAE,CAACC,IAAI,CACjBrD,QAAQ,CAAEoD,kBAAE,CAACV,IAAI,CACjBxC,KAAK,CAAE+C,WAAW,CAACK,SAAS,CAACC,UAC/B,CAAC,CAEDxD,SAAS,CAACyD,YAAY,CAAG,CACvBvD,QAAQ,CAAEwD,YAAI,CACdzD,QAAQ,CAAE,IACZ,CAAC,CAAC,IAAA0D,QAAA,CAAAV,OAAA,CAAAW,OAAA,CAEaV,WAAW,CAE1B"}
@@ -1,2 +1,2 @@
1
- "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=NavLink;var _reactRouterDom=require("react-router-dom");var _GenericLink=_interopRequireDefault(require("./GenericLink"));var _jsxRuntime=require("react/jsx-runtime");function NavLink(props){/* eslint-disable react/jsx-props-no-spreading */return/*#__PURE__*/(0,_jsxRuntime.jsx)(_GenericLink.default,{...props,routerLinkType:_reactRouterDom.NavLink});/* eslint-enable react/jsx-props-no-spreading */}
1
+ "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _reactRouterDom=require("react-router-dom");var _GenericLink=_interopRequireDefault(require("./GenericLink"));var _jsxRuntime=require("react/jsx-runtime");const NavLink=props=>/*#__PURE__*/ /* eslint-disable react/jsx-props-no-spreading */(0,_jsxRuntime.jsx)(_GenericLink.default,{...props,routerLinkType:_reactRouterDom.NavLink})/* eslint-enable react/jsx-props-no-spreading */;var _default=exports.default=NavLink;
2
2
  //# sourceMappingURL=NavLink.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"NavLink.js","names":["_reactRouterDom","require","_GenericLink","_interopRequireDefault","_jsxRuntime","NavLink","props","jsx","default","routerLinkType","RrNavLink"],"sources":["../../../../src/shared/components/NavLink.jsx"],"sourcesContent":["import { NavLink as RrNavLink } from 'react-router-dom';\n\nimport GenericLink from './GenericLink';\n\nexport default function NavLink(props) {\n /* eslint-disable react/jsx-props-no-spreading */\n return <GenericLink {...props} routerLinkType={RrNavLink} />;\n /* eslint-enable react/jsx-props-no-spreading */\n}\n"],"mappings":"iLAAA,IAAAA,eAAA,CAAAC,OAAA,qBAEA,IAAAC,YAAA,CAAAC,sBAAA,CAAAF,OAAA,mBAAwC,IAAAG,WAAA,CAAAH,OAAA,sBAEzB,QAAS,CAAAI,OAAOA,CAACC,KAAK,CAAE,CACrC,iDACA,mBAAO,GAAAF,WAAA,CAAAG,GAAA,EAACL,YAAA,CAAAM,OAAW,KAAKF,KAAK,CAAEG,cAAc,CAAEC,uBAAU,CAAE,CAAC,CAC5D,gDACF"}
1
+ {"version":3,"file":"NavLink.js","names":["_reactRouterDom","require","_GenericLink","_interopRequireDefault","_jsxRuntime","NavLink","props","jsx","default","routerLinkType","RrNavLink","_default","exports"],"sources":["../../../../src/shared/components/NavLink.tsx"],"sourcesContent":["import { NavLink as RrNavLink } from 'react-router-dom';\n\nimport GenericLink, { type PropsT as GenericLinkPropsT } from './GenericLink';\n\ntype PropsT = Omit<GenericLinkPropsT, 'routerLinkType'>;\n\nconst NavLink: React.FunctionComponent<PropsT> = (props) => (\n /* eslint-disable react/jsx-props-no-spreading */\n <GenericLink {...props} routerLinkType={RrNavLink} />\n /* eslint-enable react/jsx-props-no-spreading */\n);\n\nexport default NavLink;\n"],"mappings":"gLAAA,IAAAA,eAAA,CAAAC,OAAA,qBAEA,IAAAC,YAAA,CAAAC,sBAAA,CAAAF,OAAA,mBAA8E,IAAAG,WAAA,CAAAH,OAAA,sBAI9E,KAAM,CAAAI,OAAwC,CAAIC,KAAK,gBACrD,iDACA,GAAAF,WAAA,CAAAG,GAAA,EAACL,YAAA,CAAAM,OAAW,KAAKF,KAAK,CAAEG,cAAc,CAAEC,uBAAU,CAAE,CACpD,gDACD,CAAC,IAAAC,QAAA,CAAAC,OAAA,CAAAJ,OAAA,CAEaH,OAAO"}
@@ -1,4 +1,4 @@
1
- "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _propTypes=_interopRequireDefault(require("prop-types"));var _utils=require("../../utils");var _jsxRuntime=require("react/jsx-runtime");const baseTheme={"context":"m4mL-M","ad":"m3-mdC","hoc":"J15Z4H","container":"T3cuHB","mainPanel":"pPlQO2","sidePanel":"lqNh4h"};/**
1
+ "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _propTypes=_interopRequireDefault(require("prop-types"));var _reactThemes=_interopRequireDefault(require("@dr.pogodin/react-themes"));var _jsxRuntime=require("react/jsx-runtime");const baseTheme={"context":"m4mL-M","ad":"m3-mdC","hoc":"J15Z4H","container":"T3cuHB","mainPanel":"pPlQO2","sidePanel":"lqNh4h"};/**
2
2
  * Simple and themeable page layout. It keeps the main content centered in
3
3
  * a column of limited width, which fills entire viewport on small screens
4
4
  * (under `$screen-md = 1024px` size). At larger screens the column keeps
@@ -12,5 +12,5 @@
12
12
  * @param {PageLayoutTheme} [props.theme] _Ad hoc_ theme.
13
13
  * @param {...any} [props....]
14
14
  * [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)
15
- */function PageLayout({children,leftSidePanelContent,rightSidePanelContent,theme}){return/*#__PURE__*/(0,_jsxRuntime.jsxs)("div",{className:theme.container,children:[/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{className:[theme.sidePanel,theme.leftSidePanel].join(" "),children:leftSidePanelContent}),/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{className:theme.mainPanel,children:children}),/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{className:[theme.sidePanel,theme.rightSidePanel].join(" "),children:rightSidePanelContent})]})}const ThemedPageLayout=(0,_utils.themed)("PageLayout",["container","leftSidePanel","mainPanel","rightSidePanel","sidePanel"],baseTheme)(PageLayout);PageLayout.propTypes={children:_propTypes.default.node,leftSidePanelContent:_propTypes.default.node,rightSidePanelContent:_propTypes.default.node,theme:ThemedPageLayout.themeType.isRequired};PageLayout.defaultProps={children:null,leftSidePanelContent:null,rightSidePanelContent:null};var _default=ThemedPageLayout;exports.default=_default;
15
+ */const PageLayout=({children,leftSidePanelContent,rightSidePanelContent,theme})=>/*#__PURE__*/(0,_jsxRuntime.jsxs)("div",{className:theme.container,children:[/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{className:[theme.sidePanel,theme.leftSidePanel].join(" "),children:leftSidePanelContent}),/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{className:theme.mainPanel,children:children}),/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{className:[theme.sidePanel,theme.rightSidePanel].join(" "),children:rightSidePanelContent})]});const ThemedPageLayout=(0,_reactThemes.default)(PageLayout,"PageLayout",["container","leftSidePanel","mainPanel","rightSidePanel","sidePanel"],baseTheme);PageLayout.propTypes={children:_propTypes.default.node,leftSidePanelContent:_propTypes.default.node,rightSidePanelContent:_propTypes.default.node,theme:ThemedPageLayout.themeType.isRequired};PageLayout.defaultProps={children:null,leftSidePanelContent:null,rightSidePanelContent:null};var _default=exports.default=ThemedPageLayout;
16
16
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_utils","_jsxRuntime","baseTheme","PageLayout","children","leftSidePanelContent","rightSidePanelContent","theme","jsxs","className","container","jsx","sidePanel","leftSidePanel","join","mainPanel","rightSidePanel","ThemedPageLayout","themed","propTypes","PT","node","themeType","isRequired","defaultProps","_default","exports","default"],"sources":["../../../../../src/shared/components/PageLayout/index.jsx"],"sourcesContent":["import PT from 'prop-types';\n\nimport { themed } from 'utils';\n\nimport baseTheme from './base-theme.scss';\n\n/**\n * Simple and themeable page layout. It keeps the main content centered in\n * a column of limited width, which fills entire viewport on small screens\n * (under `$screen-md = 1024px` size). At larger screens the column keeps\n * `$screen-md` size, and it is centered at the page, surrounded by side\n * panels, where additional content can be displayed.\n *\n * **Children:** Component children are rendered as the content of main panel.\n * @param {object} [props] Component properties.\n * @param {Node} [props.leftSidePanelContent] The content for left side panel.\n * @param {Node} [props.rightSidePanelContent] The content for right side panel.\n * @param {PageLayoutTheme} [props.theme] _Ad hoc_ theme.\n * @param {...any} [props....]\n * [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)\n */\nfunction PageLayout({\n children,\n leftSidePanelContent,\n rightSidePanelContent,\n theme,\n}) {\n return (\n <div className={theme.container}>\n <div className={[theme.sidePanel, theme.leftSidePanel].join(' ')}>\n {leftSidePanelContent}\n </div>\n <div className={theme.mainPanel}>\n {children}\n </div>\n <div className={[theme.sidePanel, theme.rightSidePanel].join(' ')}>\n {rightSidePanelContent}\n </div>\n </div>\n );\n}\n\nconst ThemedPageLayout = themed('PageLayout', [\n 'container',\n 'leftSidePanel',\n 'mainPanel',\n 'rightSidePanel',\n 'sidePanel',\n], baseTheme)(PageLayout);\n\nPageLayout.propTypes = {\n children: PT.node,\n leftSidePanelContent: PT.node,\n rightSidePanelContent: PT.node,\n theme: ThemedPageLayout.themeType.isRequired,\n};\n\nPageLayout.defaultProps = {\n children: null,\n leftSidePanelContent: null,\n rightSidePanelContent: null,\n};\n\nexport default ThemedPageLayout;\n"],"mappings":"gLAAA,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBAEA,IAAAC,MAAA,CAAAD,OAAA,gBAA+B,IAAAE,WAAA,CAAAF,OAAA,4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E,IAAI,CAC1BC,qBAAqB,CAAE,IACzB,CAAC,CAAC,IAAAmB,QAAA,CAEaR,gBAAgB,CAAAS,OAAA,CAAAC,OAAA,CAAAF,QAAA"}
1
+ {"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_reactThemes","_jsxRuntime","baseTheme","PageLayout","children","leftSidePanelContent","rightSidePanelContent","theme","jsxs","className","container","jsx","sidePanel","leftSidePanel","join","mainPanel","rightSidePanel","ThemedPageLayout","themed","propTypes","PT","node","themeType","isRequired","defaultProps","_default","exports","default"],"sources":["../../../../../src/shared/components/PageLayout/index.tsx"],"sourcesContent":["import PT from 'prop-types';\nimport type { ReactNode } from 'react';\n\nimport themed, { type Theme } from '@dr.pogodin/react-themes';\n\nimport baseTheme from './base-theme.scss';\n\ntype PropsT = {\n children?: ReactNode;\n leftSidePanelContent?: ReactNode;\n rightSidePanelContent?: ReactNode;\n theme: Theme & {\n container?: string;\n mainPanel?: string;\n sidePanel?: string;\n leftSidePanel?: string;\n rightSidePanel?: string;\n };\n};\n\n/**\n * Simple and themeable page layout. It keeps the main content centered in\n * a column of limited width, which fills entire viewport on small screens\n * (under `$screen-md = 1024px` size). At larger screens the column keeps\n * `$screen-md` size, and it is centered at the page, surrounded by side\n * panels, where additional content can be displayed.\n *\n * **Children:** Component children are rendered as the content of main panel.\n * @param {object} [props] Component properties.\n * @param {Node} [props.leftSidePanelContent] The content for left side panel.\n * @param {Node} [props.rightSidePanelContent] The content for right side panel.\n * @param {PageLayoutTheme} [props.theme] _Ad hoc_ theme.\n * @param {...any} [props....]\n * [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)\n */\nconst PageLayout: React.FunctionComponent<PropsT> = ({\n children,\n leftSidePanelContent,\n rightSidePanelContent,\n theme,\n}) => (\n <div className={theme.container}>\n <div className={[theme.sidePanel, theme.leftSidePanel].join(' ')}>\n {leftSidePanelContent}\n </div>\n <div className={theme.mainPanel}>\n {children}\n </div>\n <div className={[theme.sidePanel, theme.rightSidePanel].join(' ')}>\n {rightSidePanelContent}\n </div>\n </div>\n);\n\nconst ThemedPageLayout = themed(PageLayout, 'PageLayout', [\n 'container',\n 'leftSidePanel',\n 'mainPanel',\n 'rightSidePanel',\n 'sidePanel',\n], baseTheme);\n\nPageLayout.propTypes = {\n children: PT.node,\n leftSidePanelContent: PT.node,\n rightSidePanelContent: PT.node,\n theme: ThemedPageLayout.themeType.isRequired,\n};\n\nPageLayout.defaultProps = {\n children: null,\n leftSidePanelContent: null,\n rightSidePanelContent: null,\n};\n\nexport default ThemedPageLayout;\n"],"mappings":"gLAAA,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBAGA,IAAAC,YAAA,CAAAF,sBAAA,CAAAC,OAAA,8BAA8D,IAAAE,WAAA,CAAAF,OAAA,4BAAAG,SAAA,kHAiB9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,KAAM,CAAAC,UAA2C,CAAGA,CAAC,CACnDC,QAAQ,CACRC,oBAAoB,CACpBC,qBAAqB,CACrBC,KACF,CAAC,gBACC,GAAAN,WAAA,CAAAO,IAAA,SAAKC,SAAS,CAAEF,KAAK,CAACG,SAAU,CAAAN,QAAA,eAC9B,GAAAH,WAAA,CAAAU,GAAA,SAAKF,SAAS,CAAE,CAACF,KAAK,CAACK,SAAS,CAAEL,KAAK,CAACM,aAAa,CAAC,CAACC,IAAI,CAAC,GAAG,CAAE,CAAAV,QAAA,CAC9DC,oBAAoB,CAClB,CAAC,cACN,GAAAJ,WAAA,CAAAU,GAAA,SAAKF,SAAS,CAAEF,KAAK,CAACQ,SAAU,CAAAX,QAAA,CAC7BA,QAAQ,CACN,CAAC,cACN,GAAAH,WAAA,CAAAU,GAAA,SAAKF,SAAS,CAAE,CAACF,KAAK,CAACK,SAAS,CAAEL,KAAK,CAACS,cAAc,CAAC,CAACF,IAAI,CAAC,GAAG,CAAE,CAAAV,QAAA,CAC/DE,qBAAqB,CACnB,CAAC,EACH,CACN,CAED,KAAM,CAAAW,gBAAgB,CAAG,GAAAC,oBAAM,EAACf,UAAU,CAAE,YAAY,CAAE,CACxD,WAAW,CACX,eAAe,CACf,WAAW,CACX,gBAAgB,CAChB,WAAW,CACZ,CAAED,SAAS,CAAC,CAEbC,UAAU,CAACgB,SAAS,CAAG,CACrBf,QAAQ,CAAEgB,kBAAE,CAACC,IAAI,CACjBhB,oBAAoB,CAAEe,kBAAE,CAACC,IAAI,CAC7Bf,qBAAqB,CAAEc,kBAAE,CAACC,IAAI,CAC9Bd,KAAK,CAAEU,gBAAgB,CAACK,SAAS,CAACC,UACpC,CAAC,CAEDpB,UAAU,CAACqB,YAAY,CAAG,CACxBpB,QAAQ,CAAE,IAAI,CACdC,oBAAoB,CAAE,IAAI,CAC1BC,qBAAqB,CAAE,IACzB,CAAC,CAAC,IAAAmB,QAAA,CAAAC,OAAA,CAAAC,OAAA,CAEaV,gBAAgB"}
@@ -1,4 +1,4 @@
1
- "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=ScalableRect;var _propTypes=_interopRequireDefault(require("prop-types"));var _jsxRuntime=require("react/jsx-runtime");/**
1
+ "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _propTypes=_interopRequireDefault(require("prop-types"));require("react");var _jsxRuntime=require("react/jsx-runtime");/**
2
2
  * The `<ScalableRect>` component implements container keeping given aspect
3
3
  * ratio, while its width is altered.
4
4
  *
@@ -7,11 +7,15 @@
7
7
  * @param {string} [props.className] CSS class for component container.
8
8
  * @param {string} [props.ratio=1:1] Ratio of the rendered rectangle sides,
9
9
  * in `W:H` form.
10
- */function ScalableRect({children,className,ratio}){const aux=ratio.split(":");const paddingBottom=`${100*aux[1]/aux[0]}%`;/* NOTE: In case the following code looks strange to you, mind that we want to
10
+ */const ScalableRect=({children,className,ratio})=>{const aux=ratio.split(":");const paddingBottom=`${100*parseFloat(aux[1])/parseFloat(aux[0])}%`;/* NOTE: In case the following code looks strange to you, mind that we want to
11
11
  * allow the user to set custom styles on this component. If user passes in a
12
12
  * "className" prop (possibly "styleName", but that one is converted to
13
13
  * "className" by Babel just before being passed into this component), it
14
14
  * should not interfere with the sizing behavior, thus we need an extra <div>
15
15
  * level in this component; however, if user does not need a custom styling,
16
- * we can save one level of HTML code, so we do it. */const rect=/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{style:{paddingBottom},className:"EznFz3",children:/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{className:"_0vb7tq",children:children})});return className?/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{className:className,children:rect}):rect}ScalableRect.defaultProps={children:null,className:null,ratio:"1:1"};ScalableRect.propTypes={children:_propTypes.default.node,className:_propTypes.default.string,ratio:_propTypes.default.string};
16
+ * we can save one level of HTML code, so we do it. */const rect=/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{style:{paddingBottom},className:"EznFz3",children:/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{className:"_0vb7tq",children:children})});return className?/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{className:className,children:rect}):rect};ScalableRect.defaultProps={children:null,className:undefined,ratio:"1:1"};ScalableRect.propTypes={children:_propTypes.default.node,className:_propTypes.default.string,ratio:(props,name)=>{const ratio=props[name];// "ratio" prop is not required (defaults "1:1").
17
+ if(ratio===undefined)return null;// If given, "ratio" must be a string.
18
+ if(typeof ratio!=="string"){return Error("\"ratio\" prop must be a string")}// If given, "ratio" must have "H:W" format.
19
+ if(!ratio.match(/\d\.\d+/)){return Error("\"ratio\" prop must have \"H:W\" format")}// Everything looks right.
20
+ return null}};var _default=exports.default=ScalableRect;
17
21
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_jsxRuntime","ScalableRect","children","className","ratio","aux","split","paddingBottom","rect","jsx","style","defaultProps","propTypes","PT","node","string"],"sources":["../../../../../src/shared/components/ScalableRect/index.jsx"],"sourcesContent":["import PT from 'prop-types';\n\nimport './style.scss';\n\n/**\n * The `<ScalableRect>` component implements container keeping given aspect\n * ratio, while its width is altered.\n *\n * **Children:** Component children are rendered as the component's content.\n * @param {object} props\n * @param {string} [props.className] CSS class for component container.\n * @param {string} [props.ratio=1:1] Ratio of the rendered rectangle sides,\n * in `W:H` form.\n */\nexport default function ScalableRect({ children, className, ratio }) {\n const aux = ratio.split(':');\n const paddingBottom = `${(100 * aux[1]) / aux[0]}%`;\n\n /* NOTE: In case the following code looks strange to you, mind that we want to\n * allow the user to set custom styles on this component. If user passes in a\n * \"className\" prop (possibly \"styleName\", but that one is converted to\n * \"className\" by Babel just before being passed into this component), it\n * should not interfere with the sizing behavior, thus we need an extra <div>\n * level in this component; however, if user does not need a custom styling,\n * we can save one level of HTML code, so we do it. */\n const rect = (\n <div\n style={{ paddingBottom }}\n styleName=\"container\"\n >\n <div styleName=\"wrapper\">\n {children}\n </div>\n </div>\n );\n return className ? (\n <div className={className}>\n {rect}\n </div>\n ) : rect;\n}\n\nScalableRect.defaultProps = {\n children: null,\n className: null,\n ratio: '1:1',\n};\n\nScalableRect.propTypes = {\n children: PT.node,\n className: PT.string,\n ratio: PT.string,\n};\n"],"mappings":"sLAAA,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBAA4B,IAAAC,WAAA,CAAAD,OAAA,sBAI5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACe,QAAS,CAAAE,YAAYA,CAAC,CAAEC,QAAQ,CAAEC,SAAS,CAAEC,KAAM,CAAC,CAAE,CACnE,KAAM,CAAAC,GAAG,CAAGD,KAAK,CAACE,KAAK,CAAC,GAAG,CAAC,CAC5B,KAAM,CAAAC,aAAa,CAAI,GAAG,GAAG,CAAGF,GAAG,CAAC,CAAC,CAAC,CAAIA,GAAG,CAAC,CAAC,CAAE,GAAE,CAEnD;AACF;AACA;AACA;AACA;AACA;AACA,wDACE,KAAM,CAAAG,IAAI,cACR,GAAAR,WAAA,CAAAS,GAAA,SACEC,KAAK,CAAE,CAAEH,aAAc,CAAE,CACzBJ,SAAS,CAAC,QAAW,CAAAD,QAAA,cAErB,GAAAF,WAAA,CAAAS,GAAA,SAAKN,SAAS,CAAC,SAAS,CAAAD,QAAA,CACrBA,QAAQ,CACN,CAAC,CACH,CACN,CACD,MAAO,CAAAC,SAAS,cACd,GAAAH,WAAA,CAAAS,GAAA,SAAKN,SAAS,CAAEA,SAAU,CAAAD,QAAA,CACvBM,IAAI,CACF,CAAC,CACJA,IACN,CAEAP,YAAY,CAACU,YAAY,CAAG,CAC1BT,QAAQ,CAAE,IAAI,CACdC,SAAS,CAAE,IAAI,CACfC,KAAK,CAAE,KACT,CAAC,CAEDH,YAAY,CAACW,SAAS,CAAG,CACvBV,QAAQ,CAAEW,kBAAE,CAACC,IAAI,CACjBX,SAAS,CAAEU,kBAAE,CAACE,MAAM,CACpBX,KAAK,CAAES,kBAAE,CAACE,MACZ,CAAC"}
1
+ {"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_jsxRuntime","ScalableRect","children","className","ratio","aux","split","paddingBottom","parseFloat","rect","jsx","style","defaultProps","undefined","propTypes","PT","node","string","props","name","Error","match","_default","exports","default"],"sources":["../../../../../src/shared/components/ScalableRect/index.tsx"],"sourcesContent":["import PT from 'prop-types';\nimport { type ReactNode } from 'react';\n\nimport './style.scss';\n\ntype PropsT = {\n children?: ReactNode;\n className?: string;\n ratio?: `${number}:${number}`,\n};\n\n/**\n * The `<ScalableRect>` component implements container keeping given aspect\n * ratio, while its width is altered.\n *\n * **Children:** Component children are rendered as the component's content.\n * @param {object} props\n * @param {string} [props.className] CSS class for component container.\n * @param {string} [props.ratio=1:1] Ratio of the rendered rectangle sides,\n * in `W:H` form.\n */\nconst ScalableRect: React.FunctionComponent<PropsT> = ({\n children,\n className,\n ratio,\n}) => {\n const aux = ratio!.split(':');\n const paddingBottom = `${(100 * parseFloat(aux[1])) / parseFloat(aux[0])}%`;\n\n /* NOTE: In case the following code looks strange to you, mind that we want to\n * allow the user to set custom styles on this component. If user passes in a\n * \"className\" prop (possibly \"styleName\", but that one is converted to\n * \"className\" by Babel just before being passed into this component), it\n * should not interfere with the sizing behavior, thus we need an extra <div>\n * level in this component; however, if user does not need a custom styling,\n * we can save one level of HTML code, so we do it. */\n const rect = (\n <div\n style={{ paddingBottom }}\n styleName=\"container\"\n >\n <div styleName=\"wrapper\">\n {children}\n </div>\n </div>\n );\n return className ? (\n <div className={className}>\n {rect}\n </div>\n ) : rect;\n};\n\nScalableRect.defaultProps = {\n children: null,\n className: undefined,\n ratio: '1:1',\n};\n\nScalableRect.propTypes = {\n children: PT.node,\n className: PT.string,\n ratio: (props, name) => {\n const ratio = props[name];\n\n // \"ratio\" prop is not required (defaults \"1:1\").\n if (ratio === undefined) return null;\n\n // If given, \"ratio\" must be a string.\n if (typeof ratio !== 'string') {\n return Error('\"ratio\" prop must be a string');\n }\n\n // If given, \"ratio\" must have \"H:W\" format.\n if (!ratio.match(/\\d\\.\\d+/)) {\n return Error('\"ratio\" prop must have \"H:W\" format');\n }\n\n // Everything looks right.\n return null;\n },\n};\n\nexport default ScalableRect;\n"],"mappings":"gLAAA,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBACAA,OAAA,UAAuC,IAAAC,WAAA,CAAAD,OAAA,sBAUvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,KAAM,CAAAE,YAA6C,CAAGA,CAAC,CACrDC,QAAQ,CACRC,SAAS,CACTC,KACF,CAAC,GAAK,CACJ,KAAM,CAAAC,GAAG,CAAGD,KAAK,CAAEE,KAAK,CAAC,GAAG,CAAC,CAC7B,KAAM,CAAAC,aAAa,CAAI,GAAG,GAAG,CAAGC,UAAU,CAACH,GAAG,CAAC,CAAC,CAAC,CAAC,CAAIG,UAAU,CAACH,GAAG,CAAC,CAAC,CAAC,CAAE,GAAE,CAE3E;AACF;AACA;AACA;AACA;AACA;AACA,wDACE,KAAM,CAAAI,IAAI,cACR,GAAAT,WAAA,CAAAU,GAAA,SACEC,KAAK,CAAE,CAAEJ,aAAc,CAAE,CACzBJ,SAAS,CAAC,QAAW,CAAAD,QAAA,cAErB,GAAAF,WAAA,CAAAU,GAAA,SAAKP,SAAS,CAAC,SAAS,CAAAD,QAAA,CACrBA,QAAQ,CACN,CAAC,CACH,CACN,CACD,MAAO,CAAAC,SAAS,cACd,GAAAH,WAAA,CAAAU,GAAA,SAAKP,SAAS,CAAEA,SAAU,CAAAD,QAAA,CACvBO,IAAI,CACF,CAAC,CACJA,IACN,CAAC,CAEDR,YAAY,CAACW,YAAY,CAAG,CAC1BV,QAAQ,CAAE,IAAI,CACdC,SAAS,CAAEU,SAAS,CACpBT,KAAK,CAAE,KACT,CAAC,CAEDH,YAAY,CAACa,SAAS,CAAG,CACvBZ,QAAQ,CAAEa,kBAAE,CAACC,IAAI,CACjBb,SAAS,CAAEY,kBAAE,CAACE,MAAM,CACpBb,KAAK,CAAEA,CAACc,KAAK,CAAEC,IAAI,GAAK,CACtB,KAAM,CAAAf,KAAK,CAAGc,KAAK,CAACC,IAAI,CAAC,CAEzB;AACA,GAAIf,KAAK,GAAKS,SAAS,CAAE,MAAO,KAAI,CAEpC;AACA,GAAI,MAAO,CAAAT,KAAK,GAAK,QAAQ,CAAE,CAC7B,MAAO,CAAAgB,KAAK,CAAC,iCAA+B,CAC9C,CAEA;AACA,GAAI,CAAChB,KAAK,CAACiB,KAAK,CAAC,SAAS,CAAC,CAAE,CAC3B,MAAO,CAAAD,KAAK,CAAC,yCAAqC,CACpD,CAEA;AACA,MAAO,KACT,CACF,CAAC,CAAC,IAAAE,QAAA,CAAAC,OAAA,CAAAC,OAAA,CAEavB,YAAY"}
@@ -1,4 +1,4 @@
1
- "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _propTypes=_interopRequireDefault(require("prop-types"));var _reactThemes=_interopRequireDefault(require("@dr.pogodin/react-themes"));var _jsxRuntime=require("react/jsx-runtime");const defaultTheme={"context":"uIObt7","ad":"XIxe9o","hoc":"YOyORH","bouncing":"TJe-6j","container":"_7zdld4","circle":"dBrB4g"};/**
1
+ "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _reactThemes=_interopRequireDefault(require("@dr.pogodin/react-themes"));var _jsxRuntime=require("react/jsx-runtime");const defaultTheme={"context":"uIObt7","ad":"XIxe9o","hoc":"YOyORH","bouncing":"TJe-6j","container":"_7zdld4","circle":"dBrB4g"};/**
2
2
  * Throbber is an "action in progress" indicator, which renders
3
3
  * three bouncing circles as a simple pending activity indicator,
4
4
  * and can be further themed to a certain degree.
@@ -6,5 +6,5 @@
6
6
  * @param {ThrobberTheme} [props.theme] _Ad hoc_ theme.
7
7
  * @param {...any} [props....]
8
8
  * [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)
9
- */function Throbber({theme}){return/*#__PURE__*/(0,_jsxRuntime.jsxs)("span",{className:(theme.container?theme.container+" ":"")+"_7zdld4",children:[/*#__PURE__*/(0,_jsxRuntime.jsx)("span",{className:(theme.circle?theme.circle+" ":"")+"dBrB4g"}),/*#__PURE__*/(0,_jsxRuntime.jsx)("span",{className:(theme.circle?theme.circle+" ":"")+"dBrB4g"}),/*#__PURE__*/(0,_jsxRuntime.jsx)("span",{className:(theme.circle?theme.circle+" ":"")+"dBrB4g"})]})}Throbber.defaultProps={theme:{}};Throbber.propTypes={theme:_propTypes.default.shape({container:_propTypes.default.string,circle:_propTypes.default.string})};var _default=(0,_reactThemes.default)("Throbber",["circle","container"],defaultTheme)(Throbber);exports.default=_default;
9
+ */const Throbber=({theme})=>/*#__PURE__*/(0,_jsxRuntime.jsxs)("span",{className:(theme.container?theme.container+" ":"")+"_7zdld4",children:[/*#__PURE__*/(0,_jsxRuntime.jsx)("span",{className:(theme.circle?theme.circle+" ":"")+"dBrB4g"}),/*#__PURE__*/(0,_jsxRuntime.jsx)("span",{className:(theme.circle?theme.circle+" ":"")+"dBrB4g"}),/*#__PURE__*/(0,_jsxRuntime.jsx)("span",{className:(theme.circle?theme.circle+" ":"")+"dBrB4g"})]});const ThemedThrobber=(0,_reactThemes.default)(Throbber,"Throbber",["circle","container"],defaultTheme);Throbber.propTypes={theme:ThemedThrobber.themeType.isRequired};var _default=exports.default=ThemedThrobber;
10
10
  //# sourceMappingURL=index.js.map