@homecode/ui 4.11.1

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 (267) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +29 -0
  3. package/dist/esm/index.js +78 -0
  4. package/dist/esm/node_modules/style-inject/dist/style-inject.es.js +28 -0
  5. package/dist/esm/src/components/AssistiveText/AssistiveText.js +10 -0
  6. package/dist/esm/src/components/AssistiveText/AssistiveText.styl.js +7 -0
  7. package/dist/esm/src/components/Button/Button.helpers.js +12 -0
  8. package/dist/esm/src/components/Button/Button.js +38 -0
  9. package/dist/esm/src/components/Button/Button.styl.js +7 -0
  10. package/dist/esm/src/components/ButtonGroup/ButtonGroup.js +10 -0
  11. package/dist/esm/src/components/ButtonGroup/ButtonGroup.styl.js +7 -0
  12. package/dist/esm/src/components/Checkbox/Checkbox.js +48 -0
  13. package/dist/esm/src/components/Checkbox/Checkbox.styl.js +7 -0
  14. package/dist/esm/src/components/Container/Container.js +12 -0
  15. package/dist/esm/src/components/Container/Container.styl.js +7 -0
  16. package/dist/esm/src/components/DateTime/DateTime.js +17 -0
  17. package/dist/esm/src/components/Draggable/Draggable.js +136 -0
  18. package/dist/esm/src/components/Draggable/Draggable.styl.js +7 -0
  19. package/dist/esm/src/components/Expand/Expand.js +24 -0
  20. package/dist/esm/src/components/Expand/Expand.styl.js +7 -0
  21. package/dist/esm/src/components/Form/Form.helpers.js +42 -0
  22. package/dist/esm/src/components/Form/Form.js +286 -0
  23. package/dist/esm/src/components/Form/Form.styl.js +7 -0
  24. package/dist/esm/src/components/Form/Form.types.js +1 -0
  25. package/dist/esm/src/components/Form/SubmitButtons/SubmitButtons.js +8 -0
  26. package/dist/esm/src/components/Form/SubmitButtons/SubmitButtons.styl.js +7 -0
  27. package/dist/esm/src/components/Form/Validator.js +36 -0
  28. package/dist/esm/src/components/Gallery/Dots/Dots.js +9 -0
  29. package/dist/esm/src/components/Gallery/Dots/Dots.styl.js +7 -0
  30. package/dist/esm/src/components/Gallery/Gallery.js +180 -0
  31. package/dist/esm/src/components/Gallery/Gallery.styl.js +7 -0
  32. package/dist/esm/src/components/Heading/Heading.js +37 -0
  33. package/dist/esm/src/components/Heading/Heading.styl.js +7 -0
  34. package/dist/esm/src/components/Icon/Icon.js +27 -0
  35. package/dist/esm/src/components/Icon/Icon.styl.js +7 -0
  36. package/dist/esm/src/components/Icon/icons/avatar.svg.js +15 -0
  37. package/dist/esm/src/components/Icon/icons/brokenImage.svg.js +15 -0
  38. package/dist/esm/src/components/Icon/icons/check.svg.js +19 -0
  39. package/dist/esm/src/components/Icon/icons/chevronDown.svg.js +20 -0
  40. package/dist/esm/src/components/Icon/icons/chevronLeft.svg.js +20 -0
  41. package/dist/esm/src/components/Icon/icons/chevronRight.svg.js +20 -0
  42. package/dist/esm/src/components/Icon/icons/chevronUp.svg.js +20 -0
  43. package/dist/esm/src/components/Icon/icons/close.svg.js +15 -0
  44. package/dist/esm/src/components/Icon/icons/colors.svg.js +60 -0
  45. package/dist/esm/src/components/Icon/icons/copy.svg.js +15 -0
  46. package/dist/esm/src/components/Icon/icons/delete.svg.js +15 -0
  47. package/dist/esm/src/components/Icon/icons/draft.svg.js +15 -0
  48. package/dist/esm/src/components/Icon/icons/edit.svg.js +15 -0
  49. package/dist/esm/src/components/Icon/icons/externalLink.svg.js +15 -0
  50. package/dist/esm/src/components/Icon/icons/fullscreen.svg.js +15 -0
  51. package/dist/esm/src/components/Icon/icons/fullscreenExit.svg.js +15 -0
  52. package/dist/esm/src/components/Icon/icons/gear.svg.js +20 -0
  53. package/dist/esm/src/components/Icon/icons/history.svg.js +17 -0
  54. package/dist/esm/src/components/Icon/icons/home.svg.js +19 -0
  55. package/dist/esm/src/components/Icon/icons/index.js +41 -0
  56. package/dist/esm/src/components/Icon/icons/loader.svg.js +45 -0
  57. package/dist/esm/src/components/Icon/icons/menu.svg.js +18 -0
  58. package/dist/esm/src/components/Icon/icons/mic.svg.js +15 -0
  59. package/dist/esm/src/components/Icon/icons/minus.svg.js +15 -0
  60. package/dist/esm/src/components/Icon/icons/moreHorizontal.svg.js +15 -0
  61. package/dist/esm/src/components/Icon/icons/moreVertical.svg.js +15 -0
  62. package/dist/esm/src/components/Icon/icons/plus.svg.js +15 -0
  63. package/dist/esm/src/components/Icon/icons/redo.svg.js +15 -0
  64. package/dist/esm/src/components/Icon/icons/requiredStar.svg.js +15 -0
  65. package/dist/esm/src/components/Icon/icons/save.svg.js +17 -0
  66. package/dist/esm/src/components/Icon/icons/send.svg.js +16 -0
  67. package/dist/esm/src/components/Icon/icons/settings.svg.js +52 -0
  68. package/dist/esm/src/components/Icon/icons/shoppingBag.svg.js +17 -0
  69. package/dist/esm/src/components/Icon/icons/social_email.svg.js +15 -0
  70. package/dist/esm/src/components/Icon/icons/social_instagram.svg.js +15 -0
  71. package/dist/esm/src/components/Icon/icons/social_telegram.svg.js +19 -0
  72. package/dist/esm/src/components/Icon/icons/undo.svg.js +15 -0
  73. package/dist/esm/src/components/Input/Input.js +331 -0
  74. package/dist/esm/src/components/Input/Input.styl.js +7 -0
  75. package/dist/esm/src/components/InputFile/InputFile.js +292 -0
  76. package/dist/esm/src/components/InputFile/InputFile.styl.js +7 -0
  77. package/dist/esm/src/components/InputFile/InputFile.types.js +1 -0
  78. package/dist/esm/src/components/InputFile/Item/Item.js +18 -0
  79. package/dist/esm/src/components/InputFile/Item/Item.styl.js +7 -0
  80. package/dist/esm/src/components/Label/Label.constants.json.js +8 -0
  81. package/dist/esm/src/components/Label/Label.helpers.js +35 -0
  82. package/dist/esm/src/components/Label/Label.js +58 -0
  83. package/dist/esm/src/components/Label/Label.styl.js +7 -0
  84. package/dist/esm/src/components/Lazy/Lazy.js +65 -0
  85. package/dist/esm/src/components/LightBox/LightBox.js +28 -0
  86. package/dist/esm/src/components/LightBox/LightBox.styl.js +7 -0
  87. package/dist/esm/src/components/Notifications/Notifications.constants.json.js +6 -0
  88. package/dist/esm/src/components/Notifications/Notifications.js +67 -0
  89. package/dist/esm/src/components/Notifications/Notifications.styl.js +7 -0
  90. package/dist/esm/src/components/Notifications/store.js +62 -0
  91. package/dist/esm/src/components/Paranja/Paranja.js +14 -0
  92. package/dist/esm/src/components/Paranja/Paranja.styl.js +7 -0
  93. package/dist/esm/src/components/Popup/Popup.helpers.js +31 -0
  94. package/dist/esm/src/components/Popup/Popup.js +396 -0
  95. package/dist/esm/src/components/Popup/Popup.styl.js +7 -0
  96. package/dist/esm/src/components/PopupMenu/PopupMenu.js +15 -0
  97. package/dist/esm/src/components/PopupMenu/PopupMenu.styl.js +7 -0
  98. package/dist/esm/src/components/Portal/Portal.js +19 -0
  99. package/dist/esm/src/components/RequiredStar/RequiredStar.js +12 -0
  100. package/dist/esm/src/components/RequiredStar/RequiredStar.styl.js +7 -0
  101. package/dist/esm/src/components/Router/Link/Link.js +61 -0
  102. package/dist/esm/src/components/Router/Link/Link.styl.js +7 -0
  103. package/dist/esm/src/components/Router/Redirect.js +12 -0
  104. package/dist/esm/src/components/Router/Route.js +4 -0
  105. package/dist/esm/src/components/Router/Router.helpers.js +33 -0
  106. package/dist/esm/src/components/Router/Router.js +68 -0
  107. package/dist/esm/src/components/Router/context.js +5 -0
  108. package/dist/esm/src/components/Router/store.js +55 -0
  109. package/dist/esm/src/components/Scroll/Scroll.js +274 -0
  110. package/dist/esm/src/components/Scroll/Scroll.styl.js +7 -0
  111. package/dist/esm/src/components/Select/Select.helpers.js +37 -0
  112. package/dist/esm/src/components/Select/Select.js +583 -0
  113. package/dist/esm/src/components/Select/Select.styl.js +7 -0
  114. package/dist/esm/src/components/Spinner/Spinner.js +11 -0
  115. package/dist/esm/src/components/Spinner/Spinner.styl.js +7 -0
  116. package/dist/esm/src/components/Spinner/spinner.svg.js +24 -0
  117. package/dist/esm/src/components/Table/Table.js +24 -0
  118. package/dist/esm/src/components/Table/Table.styl.js +7 -0
  119. package/dist/esm/src/components/Tabs/Tabs.js +43 -0
  120. package/dist/esm/src/components/Tabs/Tabs.styl.js +7 -0
  121. package/dist/esm/src/components/Text/Text.js +44 -0
  122. package/dist/esm/src/components/Text/Text.styl.js +7 -0
  123. package/dist/esm/src/components/Theme/Theme.defaults.js +50 -0
  124. package/dist/esm/src/components/Theme/Theme.helpers.js +67 -0
  125. package/dist/esm/src/components/Theme/Theme.js +13 -0
  126. package/dist/esm/src/components/VH/VH.js +33 -0
  127. package/dist/esm/src/components/Virtualized/List/List.js +124 -0
  128. package/dist/esm/src/components/Virtualized/List/List.styl.js +7 -0
  129. package/dist/esm/src/components/Virtualized/List/ListScroll.js +21 -0
  130. package/dist/esm/src/components/Virtualized/List/ListScroll.styl.js +7 -0
  131. package/dist/esm/src/components/Virtualized/Virtualized.helpers.js +14 -0
  132. package/dist/esm/src/components/Virtualized/Virtualized.js +200 -0
  133. package/dist/esm/src/components/Virtualized/Virtualized.styl.js +7 -0
  134. package/dist/esm/src/components/Virtualized/Virtualized.types.js +1 -0
  135. package/dist/esm/src/services/i18n.js +68 -0
  136. package/dist/esm/src/tools/array.js +60 -0
  137. package/dist/esm/src/tools/config.js +9 -0
  138. package/dist/esm/src/tools/debounce.js +11 -0
  139. package/dist/esm/src/tools/dom.js +46 -0
  140. package/dist/esm/src/tools/env.js +3 -0
  141. package/dist/esm/src/tools/file.js +11 -0
  142. package/dist/esm/src/tools/localStorage.js +31 -0
  143. package/dist/esm/src/tools/number.js +27 -0
  144. package/dist/esm/src/tools/object.js +5 -0
  145. package/dist/esm/src/tools/queryParams.js +20 -0
  146. package/dist/esm/src/tools/rangeMap.js +3 -0
  147. package/dist/esm/src/tools/resizeObserver.js +64 -0
  148. package/dist/esm/src/tools/scroll.js +41 -0
  149. package/dist/esm/src/tools/string.js +7 -0
  150. package/dist/esm/src/tools/throttle.js +30 -0
  151. package/dist/esm/src/tools/uid.js +7 -0
  152. package/dist/esm/types/index.d.ts +1 -0
  153. package/dist/esm/types/src/components/AssistiveText/AssistiveText.d.ts +3 -0
  154. package/dist/esm/types/src/components/AssistiveText/AssistiveText.types.d.ts +7 -0
  155. package/dist/esm/types/src/components/Button/Button.d.ts +4 -0
  156. package/dist/esm/types/src/components/Button/Button.helpers.d.ts +1 -0
  157. package/dist/esm/types/src/components/Button/Button.types.d.ts +14 -0
  158. package/dist/esm/types/src/components/ButtonGroup/ButtonGroup.d.ts +3 -0
  159. package/dist/esm/types/src/components/ButtonGroup/ButtonGroup.types.d.ts +5 -0
  160. package/dist/esm/types/src/components/Checkbox/Checkbox.d.ts +18 -0
  161. package/dist/esm/types/src/components/Checkbox/Checkbox.types.d.ts +10 -0
  162. package/dist/esm/types/src/components/Container/Container.d.ts +3 -0
  163. package/dist/esm/types/src/components/Container/Container.types.d.ts +13 -0
  164. package/dist/esm/types/src/components/DateTime/DateTime.d.ts +8 -0
  165. package/dist/esm/types/src/components/DateTime/DateTime.types.d.ts +6 -0
  166. package/dist/esm/types/src/components/Draggable/Draggable.d.ts +24 -0
  167. package/dist/esm/types/src/components/Draggable/Draggable.types.d.ts +11 -0
  168. package/dist/esm/types/src/components/Expand/Expand.d.ts +3 -0
  169. package/dist/esm/types/src/components/Expand/Expand.types.d.ts +16 -0
  170. package/dist/esm/types/src/components/Form/Form.d.ts +32 -0
  171. package/dist/esm/types/src/components/Form/Form.helpers.d.ts +6 -0
  172. package/dist/esm/types/src/components/Form/Form.types.d.ts +71 -0
  173. package/dist/esm/types/src/components/Form/SubmitButtons/SubmitButtons.d.ts +13 -0
  174. package/dist/esm/types/src/components/Form/Validator.d.ts +2 -0
  175. package/dist/esm/types/src/components/Form/index.d.ts +2 -0
  176. package/dist/esm/types/src/components/Gallery/Dots/Dots.d.ts +5 -0
  177. package/dist/esm/types/src/components/Gallery/Gallery.d.ts +36 -0
  178. package/dist/esm/types/src/components/Gallery/Gallery.types.d.ts +12 -0
  179. package/dist/esm/types/src/components/Heading/Heading.d.ts +3 -0
  180. package/dist/esm/types/src/components/Heading/Heading.types.d.ts +5 -0
  181. package/dist/esm/types/src/components/Icon/Icon.d.ts +45 -0
  182. package/dist/esm/types/src/components/Icon/Icon.example.d.ts +3 -0
  183. package/dist/esm/types/src/components/Icon/Icon.helpers.d.ts +1 -0
  184. package/dist/esm/types/src/components/Icon/Icon.types.d.ts +8 -0
  185. package/dist/esm/types/src/components/Icon/icons/index.d.ts +39 -0
  186. package/dist/esm/types/src/components/Input/Input.d.ts +42 -0
  187. package/dist/esm/types/src/components/Input/Input.types.d.ts +21 -0
  188. package/dist/esm/types/src/components/InputFile/InputFile.d.ts +48 -0
  189. package/dist/esm/types/src/components/InputFile/InputFile.types.d.ts +22 -0
  190. package/dist/esm/types/src/components/InputFile/Item/Item.d.ts +16 -0
  191. package/dist/esm/types/src/components/Label/Label.d.ts +19 -0
  192. package/dist/esm/types/src/components/Label/Label.helpers.d.ts +1 -0
  193. package/dist/esm/types/src/components/Label/Label.types.d.ts +8 -0
  194. package/dist/esm/types/src/components/Lazy/Lazy.d.ts +18 -0
  195. package/dist/esm/types/src/components/Lazy/Lazy.types.d.ts +15 -0
  196. package/dist/esm/types/src/components/LightBox/LightBox.d.ts +3 -0
  197. package/dist/esm/types/src/components/LightBox/LightBox.types.d.ts +7 -0
  198. package/dist/esm/types/src/components/Notifications/Notifications.d.ts +2 -0
  199. package/dist/esm/types/src/components/Notifications/Notifications.types.d.ts +19 -0
  200. package/dist/esm/types/src/components/Notifications/store.d.ts +2 -0
  201. package/dist/esm/types/src/components/Paranja/Paranja.d.ts +3 -0
  202. package/dist/esm/types/src/components/Paranja/Paranja.types.d.ts +8 -0
  203. package/dist/esm/types/src/components/Popup/Popup.d.ts +73 -0
  204. package/dist/esm/types/src/components/Popup/Popup.helpers.d.ts +8 -0
  205. package/dist/esm/types/src/components/Popup/Popup.types.d.ts +34 -0
  206. package/dist/esm/types/src/components/PopupMenu/PopupMenu.d.ts +3 -0
  207. package/dist/esm/types/src/components/PopupMenu/PopupMenu.types.d.ts +13 -0
  208. package/dist/esm/types/src/components/Portal/Portal.d.ts +7 -0
  209. package/dist/esm/types/src/components/RequiredStar/RequiredStar.d.ts +3 -0
  210. package/dist/esm/types/src/components/RequiredStar/RequiredStar.types.d.ts +6 -0
  211. package/dist/esm/types/src/components/Router/Link/Link.d.ts +1 -0
  212. package/dist/esm/types/src/components/Router/Link/Link.types.d.ts +12 -0
  213. package/dist/esm/types/src/components/Router/Redirect.d.ts +5 -0
  214. package/dist/esm/types/src/components/Router/Route.d.ts +5 -0
  215. package/dist/esm/types/src/components/Router/Router.d.ts +7 -0
  216. package/dist/esm/types/src/components/Router/Router.helpers.d.ts +2 -0
  217. package/dist/esm/types/src/components/Router/Router.types.d.ts +18 -0
  218. package/dist/esm/types/src/components/Router/context.d.ts +6 -0
  219. package/dist/esm/types/src/components/Router/store.d.ts +2 -0
  220. package/dist/esm/types/src/components/Scroll/Scroll.d.ts +67 -0
  221. package/dist/esm/types/src/components/Scroll/Scroll.types.d.ts +27 -0
  222. package/dist/esm/types/src/components/Select/Select.d.ts +94 -0
  223. package/dist/esm/types/src/components/Select/Select.helpers.d.ts +14 -0
  224. package/dist/esm/types/src/components/Select/Select.types.d.ts +74 -0
  225. package/dist/esm/types/src/components/Spinner/Spinner.d.ts +3 -0
  226. package/dist/esm/types/src/components/Spinner/Spinner.types.d.ts +4 -0
  227. package/dist/esm/types/src/components/Table/Table.d.ts +8 -0
  228. package/dist/esm/types/src/components/Table/Table.types.d.ts +19 -0
  229. package/dist/esm/types/src/components/Tabs/Tabs.d.ts +3 -0
  230. package/dist/esm/types/src/components/Tabs/Tabs.types.d.ts +27 -0
  231. package/dist/esm/types/src/components/Text/Text.d.ts +7 -0
  232. package/dist/esm/types/src/components/Theme/Theme.d.ts +5 -0
  233. package/dist/esm/types/src/components/Theme/Theme.defaults.d.ts +32 -0
  234. package/dist/esm/types/src/components/Theme/Theme.helpers.d.ts +15 -0
  235. package/dist/esm/types/src/components/Theme/Theme.types.d.ts +6 -0
  236. package/dist/esm/types/src/components/VH/VH.d.ts +12 -0
  237. package/dist/esm/types/src/components/Virtualized/Cards/Cards.d.ts +26 -0
  238. package/dist/esm/types/src/components/Virtualized/List/List.d.ts +44 -0
  239. package/dist/esm/types/src/components/Virtualized/List/ListScroll.d.ts +8 -0
  240. package/dist/esm/types/src/components/Virtualized/Table/Table.d.ts +26 -0
  241. package/dist/esm/types/src/components/Virtualized/Virtualized.d.ts +34 -0
  242. package/dist/esm/types/src/components/Virtualized/Virtualized.helpers.d.ts +18 -0
  243. package/dist/esm/types/src/components/Virtualized/Virtualized.types.d.ts +53 -0
  244. package/dist/esm/types/src/components/Virtualized/index.d.ts +4 -0
  245. package/dist/esm/types/src/components/index.d.ts +33 -0
  246. package/dist/esm/types/src/index.d.ts +3 -0
  247. package/dist/esm/types/src/services/i18n.d.ts +16 -0
  248. package/dist/esm/types/src/services/index.d.ts +1 -0
  249. package/dist/esm/types/src/tools/array.d.ts +8 -0
  250. package/dist/esm/types/src/tools/config.d.ts +10 -0
  251. package/dist/esm/types/src/tools/debounce.d.ts +1 -0
  252. package/dist/esm/types/src/tools/dom.d.ts +12 -0
  253. package/dist/esm/types/src/tools/env.d.ts +1 -0
  254. package/dist/esm/types/src/tools/file.d.ts +1 -0
  255. package/dist/esm/types/src/tools/index.d.ts +16 -0
  256. package/dist/esm/types/src/tools/localStorage.d.ts +12 -0
  257. package/dist/esm/types/src/tools/number.d.ts +5 -0
  258. package/dist/esm/types/src/tools/object.d.ts +1 -0
  259. package/dist/esm/types/src/tools/queryParams.d.ts +3 -0
  260. package/dist/esm/types/src/tools/rangeMap.d.ts +2 -0
  261. package/dist/esm/types/src/tools/resizeObserver.d.ts +2 -0
  262. package/dist/esm/types/src/tools/scroll.d.ts +5 -0
  263. package/dist/esm/types/src/tools/string.d.ts +1 -0
  264. package/dist/esm/types/src/tools/throttle.d.ts +6 -0
  265. package/dist/esm/types/src/tools/uid.d.ts +1 -0
  266. package/dist/esm/types/src/types.d.ts +15 -0
  267. package/package.json +117 -0
@@ -0,0 +1,286 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { Component } from 'react';
3
+ import { createStore } from 'justorm/react';
4
+ import cn from 'classnames';
5
+ import compare from 'compareq';
6
+ import pick from 'lodash.pick';
7
+ import omit from 'lodash.omit';
8
+ import { Input } from '../Input/Input.js';
9
+ import S from './Form.styl.js';
10
+ import { cloneValues, getNotEmpty, getInitialTouched, patchWithCustomMessages, dropFocusFromSubmit, getVal } from './Form.helpers.js';
11
+ import { Validator } from './Validator.js';
12
+ import '../Spinner/Spinner.styl.js';
13
+ import '../Button/Button.styl.js';
14
+ import './SubmitButtons/SubmitButtons.styl.js';
15
+
16
+ const STORE_FIELDS_EXPOSED = [
17
+ 'isDirty',
18
+ 'isEmpty',
19
+ 'isValid',
20
+ 'isLoading',
21
+ 'values',
22
+ 'errors',
23
+ 'touched',
24
+ 'changed',
25
+ 'disabled',
26
+ ];
27
+ function Field(props) {
28
+ const { value, error, markEdited, isChanged, isTouched, clearMargins, component: Control = Input, className, onChange, onBlur, handleChange, handleBlur, children, ...controlProps } = props;
29
+ const { name, isHidden } = controlProps;
30
+ const valField = typeof value === 'boolean' ? 'checked' : 'value';
31
+ const classes = cn(className, S.field, isHidden && S.hidden, clearMargins && S.clearMargins, markEdited && isChanged && S.changed);
32
+ function handleFieldChange(e, val) {
33
+ const v = getVal(e, val, valField);
34
+ if (onChange && onChange(e, v) === false)
35
+ return;
36
+ handleChange(name, v);
37
+ }
38
+ function handleFieldBlur(e) {
39
+ if (onBlur && onBlur(e) === false)
40
+ return;
41
+ handleBlur(name);
42
+ }
43
+ Object.assign(controlProps, {
44
+ name,
45
+ [valField]: value,
46
+ onChange: handleFieldChange,
47
+ onBlur: handleFieldBlur,
48
+ error: isTouched && error?.message,
49
+ });
50
+ return (jsxs("div", { className: classes, children: [jsx(Control, { ...controlProps }), children] }));
51
+ }
52
+ class Form extends Component {
53
+ store;
54
+ validationSchema;
55
+ defaultValues = {};
56
+ constructor(props) {
57
+ super(props);
58
+ const { initialValues, validationSchema, defaultDisabled } = props;
59
+ this.updateDefaultValues();
60
+ this.validationSchema = validationSchema;
61
+ const values = cloneValues(initialValues);
62
+ const notEmpty = getNotEmpty(this.defaultValues, initialValues);
63
+ const disabled = Object(defaultDisabled);
64
+ this.store = createStore(this, {
65
+ values,
66
+ touched: getInitialTouched(initialValues),
67
+ changed: {},
68
+ notEmpty,
69
+ disabled,
70
+ isLoading: false,
71
+ isDirty: false,
72
+ // TODO: do not validate here (only when Field is mounted)
73
+ ...this.getValidationState({ values, disabled }),
74
+ isEmpty: Object.keys(notEmpty).length === 0,
75
+ });
76
+ }
77
+ componentDidMount() {
78
+ this.calcChangedAll();
79
+ this.validate();
80
+ this.onInit();
81
+ }
82
+ shouldComponentUpdate({ defaultValues, initialValues, validationSchema, }) {
83
+ const validationChanged = !compare(validationSchema, this.props.validationSchema);
84
+ const initialValsChanged = !compare(initialValues, this.props.initialValues);
85
+ const defaultValsChanged = !compare(defaultValues, this.props.defaultValues);
86
+ this.validationSchema = validationSchema;
87
+ if (initialValsChanged) {
88
+ this.setInitialVals(initialValues);
89
+ }
90
+ if (defaultValsChanged)
91
+ this.updateDefaultValues();
92
+ if (initialValsChanged || defaultValsChanged) {
93
+ this.calcChangedAll(initialValues);
94
+ }
95
+ if (initialValsChanged || validationChanged) {
96
+ this.validate();
97
+ }
98
+ return true;
99
+ }
100
+ updateDefaultValues(props = this.props) {
101
+ const { defaultValues, initialValues } = props;
102
+ return defaultValues || cloneValues(initialValues);
103
+ }
104
+ setInitialVals(initialValues = {}) {
105
+ this.store.values = cloneValues(initialValues);
106
+ this.validate();
107
+ this.onInit();
108
+ }
109
+ setValue = (field, val) => {
110
+ const { values } = this.store;
111
+ values[field] = val;
112
+ this.calcChanged(field, val);
113
+ this.validate();
114
+ };
115
+ setValues = vals => {
116
+ const { values } = this.store;
117
+ Object.assign(values, vals);
118
+ this.calcChangedAll();
119
+ this.validate();
120
+ return values;
121
+ };
122
+ setDisabled = (name, isDisabled) => {
123
+ const { disabled } = this.store;
124
+ if (typeof name === 'object') {
125
+ Object.assign(disabled, name);
126
+ return;
127
+ }
128
+ if (isDisabled) {
129
+ disabled[name] = true;
130
+ }
131
+ else {
132
+ delete disabled[name];
133
+ }
134
+ };
135
+ reset = () => {
136
+ const { initialValues } = this.props;
137
+ this.setValues(initialValues);
138
+ this.store.touched = getInitialTouched(initialValues);
139
+ };
140
+ field = (props) => jsx(Field, { ...this.getFieldProps(props) });
141
+ getFieldProps(props) {
142
+ const { markEdited } = this.props;
143
+ const { name } = props;
144
+ const { values, changed, touched, errors } = this.store.originalObject;
145
+ const fieldProps = {
146
+ ...props,
147
+ value: values[name],
148
+ markEdited,
149
+ isChanged: changed[name],
150
+ isTouched: touched[name],
151
+ error: errors?.[name],
152
+ handleChange: this.onChange,
153
+ handleBlur: this.onBlur,
154
+ };
155
+ if (this.validationSchema?.[name].empty === false)
156
+ fieldProps.required = true;
157
+ return fieldProps;
158
+ }
159
+ getFormAPI() {
160
+ return {
161
+ ...pick(this.store.originalObject, STORE_FIELDS_EXPOSED),
162
+ Field: this.field,
163
+ setValue: this.setValue,
164
+ setValues: this.setValues,
165
+ setDisabled: this.setDisabled,
166
+ reset: this.reset,
167
+ submit: this.onSubmit,
168
+ };
169
+ }
170
+ getValidationState(store) {
171
+ const errors = this.getValidationErrors(store);
172
+ const isValid = Object.keys(errors).length === 0;
173
+ return { isValid, errors };
174
+ }
175
+ getValidationErrors(store = this.store.originalObject) {
176
+ const { values, disabled } = store;
177
+ if (!this.validationSchema)
178
+ return {};
179
+ // @ts-ignore
180
+ const schema = Object.entries(this.validationSchema).reduce((acc, [field, { ...rule }]) => {
181
+ const { type, check } = rule;
182
+ if (disabled[field])
183
+ return acc;
184
+ if (type === 'custom') {
185
+ // NOTE: pass all `values` to custom checker function
186
+ // to allow create validator for dependent fields
187
+ // @ts-ignore
188
+ rule.check = function checkWrap(...args) {
189
+ // @ts-ignore
190
+ return check.call(this, ...args, values);
191
+ };
192
+ }
193
+ return { ...acc, [field]: rule };
194
+ }, {});
195
+ const res = Validator.validate(values, schema);
196
+ if (typeof res === 'object')
197
+ return patchWithCustomMessages(res, schema);
198
+ return {};
199
+ }
200
+ calcChanged(field, val) {
201
+ const { initialValues } = this.props;
202
+ const { changed, notEmpty } = this.store;
203
+ if (compare(val, initialValues[field])) {
204
+ delete changed[field];
205
+ }
206
+ else {
207
+ changed[field] = true;
208
+ }
209
+ if (compare(val, this.defaultValues[field])) {
210
+ delete notEmpty[field];
211
+ }
212
+ else {
213
+ notEmpty[field] = true;
214
+ }
215
+ Object.assign(this.store, {
216
+ isDirty: Object.keys(changed).length > 0,
217
+ isEmpty: Object.keys(notEmpty).length === 0,
218
+ });
219
+ }
220
+ calcChangedAll(initialValues = this.props.initialValues) {
221
+ const { values } = this.store.originalObject;
222
+ const notEmpty = getNotEmpty(this.defaultValues, values);
223
+ const changed = Object.entries(values).reduce((acc, [field, val]) => compare(initialValues[field], val) ? acc : { ...acc, [field]: true }, {});
224
+ Object.assign(this.store, {
225
+ changed,
226
+ isDirty: Object.keys(changed).length > 0,
227
+ isEmpty: Object.keys(notEmpty).length === 0,
228
+ });
229
+ }
230
+ validate() {
231
+ Object.assign(this.store, this.getValidationState());
232
+ }
233
+ onInit() {
234
+ const { onInit } = this.props;
235
+ if (onInit)
236
+ onInit(this.getFormAPI());
237
+ }
238
+ onSubmit = async (e) => {
239
+ const { onSubmit } = this.props;
240
+ const { values } = this.store.originalObject;
241
+ e?.preventDefault();
242
+ dropFocusFromSubmit();
243
+ if (!onSubmit)
244
+ return;
245
+ this.store.isLoading = true;
246
+ await onSubmit({ ...values });
247
+ this.store.isLoading = false;
248
+ };
249
+ onChange = (field, val) => {
250
+ const { onChange } = this.props;
251
+ const { values, touched } = this.store;
252
+ if (values[field] === val)
253
+ return;
254
+ const newValues = { ...values.originalObject, [field]: val };
255
+ // @ts-ignore
256
+ if (onChange && onChange(newValues) === false)
257
+ return;
258
+ values[field] = val;
259
+ touched[field] = true;
260
+ this.handleChange(field, val);
261
+ };
262
+ onBlur = (name) => {
263
+ this.store.touched[name] = true;
264
+ };
265
+ handleChange(field, val) {
266
+ this.calcChanged(field, val);
267
+ this.validate();
268
+ }
269
+ render() {
270
+ const { className, children, ...rest } = this.props;
271
+ const { isLoading } = this.store;
272
+ const classes = cn(S.root, className, isLoading && S.isLoading);
273
+ const formProps = omit(rest, [
274
+ 'defaultValues',
275
+ 'defaultDisabled',
276
+ 'initialValues',
277
+ 'validationSchema',
278
+ 'onInit',
279
+ 'onChange',
280
+ 'onSubmit',
281
+ ]);
282
+ return (jsx("form", { className: classes, ...formProps, onSubmit: this.onSubmit, children: children(this.getFormAPI()) }));
283
+ }
284
+ }
285
+
286
+ export { Form };
@@ -0,0 +1,7 @@
1
+ import styleInject from '../../../node_modules/style-inject/dist/style-inject.es.js';
2
+
3
+ var css_248z = ".Form_root__EzxOr{margin:0 auto;max-width:100%;width:100%}.Form_isLoading__D1sPp{opacity:.8;pointer-events:none;transition:opacity .2s ease-out}.Form_field__S50yT{position:relative}.Form_field__S50yT+.Form_field__S50yT{margin-top:10px}.Form_field__S50yT+.Form_field__S50yT.Form_clearMargins__-KvTS{margin-top:0}.Form_field__S50yT.Form_changed__j-elu:after{background-color:$primaryColor;border-radius:50%;box-shadow:0 0 0 1px hsla(0,0%,100%,.8);content:\"\";height:6px;pointer-events:none;position:absolute;right:-2px;top:-2px;width:6px;z-index:1}.Form_hidden__MId3H{display:none}.Form_error__J7BaB{color:#e91b20;font-size:80%;margin:5px}";
4
+ var S = {"root":"Form_root__EzxOr","isLoading":"Form_isLoading__D1sPp","field":"Form_field__S50yT","clearMargins":"Form_clearMargins__-KvTS","changed":"Form_changed__j-elu","hidden":"Form_hidden__MId3H","error":"Form_error__J7BaB"};
5
+ styleInject(css_248z);
6
+
7
+ export { S as default };
@@ -0,0 +1,8 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import cn from 'classnames';
3
+ import { Button } from '../../Button/Button.js';
4
+ import S from './SubmitButtons.styl.js';
5
+
6
+ const SubmitButtons = ({ buttons, className, ...props }) => (jsx("div", { className: cn(S.root, className), ...props, children: buttons.map(buttonProps => (jsx(Button, { className: cn(S.item, buttonProps.className), ...buttonProps }))) }));
7
+
8
+ export { SubmitButtons };
@@ -0,0 +1,7 @@
1
+ import styleInject from '../../../../node_modules/style-inject/dist/style-inject.es.js';
2
+
3
+ var css_248z = ".SubmitButtons_root__sXP-n{display:flex;justify-content:flex-end;margin-top:15px}.SubmitButtons_item__f0l6w+.SubmitButtons_item__f0l6w{margin-left:10px}";
4
+ var S = {"root":"SubmitButtons_root__sXP-n","item":"SubmitButtons_item__f0l6w"};
5
+ styleInject(css_248z);
6
+
7
+ export { S as default };
@@ -0,0 +1,36 @@
1
+ import FastestValidator from 'fastest-validator';
2
+
3
+ const Validator = new FastestValidator({
4
+ messages: {
5
+ momentDate: 'Invalid date',
6
+ momentRange: 'Invalid dates range',
7
+ },
8
+ });
9
+ Validator.add('momentDate', function momentDate({ messages }) {
10
+ return {
11
+ source: `
12
+ if (!value.isValid())
13
+ // @ts-ignore
14
+ ${this.makeError({ type: 'momentDate', actual: 'value', messages })}
15
+
16
+ return value;
17
+ `,
18
+ };
19
+ });
20
+ Validator.add('momentRange', function momentRange({ messages }) {
21
+ return {
22
+ source: `
23
+ const isValid =
24
+ value.startDate && value.startDate.isValid() &&
25
+ value.endDate && value.endDate.isValid();
26
+
27
+ if (!isValid)
28
+ // @ts-ignore
29
+ ${this.makeError({ type: 'momentRange', actual: 'value', messages })}
30
+
31
+ return value;
32
+ `,
33
+ };
34
+ });
35
+
36
+ export { Validator };
@@ -0,0 +1,9 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import cn from 'classnames';
3
+ import S from './Dots.styl.js';
4
+
5
+ function Dots({ index, count }) {
6
+ return (jsx("div", { className: S.root, children: jsx("div", { className: S.inner, children: Array.from({ length: count }).map((_, i) => (jsx("div", { className: cn(S.item, i === index && S.active) }, i))) }) }));
7
+ }
8
+
9
+ export { Dots as default };
@@ -0,0 +1,7 @@
1
+ import styleInject from '../../../../node_modules/style-inject/dist/style-inject.es.js';
2
+
3
+ var css_248z = ".Dots_root__dTavT{bottom:1%;display:flex;justify-content:center;-webkit-mask-image:linear-gradient(90deg,transparent,#000 3%,#000 97%,transparent);mask-image:linear-gradient(90deg,transparent,#000 3%,#000 97%,transparent);overflow:hidden;padding:0 10%;pointer-events:none;position:absolute;width:100%}.Dots_inner__0Nqa9{align-items:center;display:flex}.Dots_item__gEVuS{background-color:var(--accent-color-alpha-200);border-radius:50%;box-shadow:0 0 0 1px var(--decent-color-alpha-500);flex-shrink:0;height:8px;margin:3px;transition:.1s ease-out;transition-property:background-color,transform;width:8px}.Dots_item__gEVuS.Dots_active__gAUAj{background-color:var(--accent-color-alpha-500);transform:scale(1.2)}";
4
+ var S = {"root":"Dots_root__dTavT","inner":"Dots_inner__0Nqa9","item":"Dots_item__gEVuS","active":"Dots_active__gAUAj"};
5
+ styleInject(css_248z);
6
+
7
+ export { S as default };
@@ -0,0 +1,180 @@
1
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
+ import { Component, createRef } from 'react';
3
+ import { createStore } from 'justorm/react';
4
+ import Time from 'timen';
5
+ import compare from 'compareq';
6
+ import cn from 'classnames';
7
+ import omit from 'lodash.omit';
8
+ import { Button } from '../Button/Button.js';
9
+ import { Icon } from '../Icon/Icon.js';
10
+ import { Spinner } from '../Spinner/Spinner.js';
11
+ import throttle from '../../tools/throttle.js';
12
+ import { circularSlice } from '../../tools/array.js';
13
+ import S from './Gallery.styl.js';
14
+ import { Lazy } from '../Lazy/Lazy.js';
15
+
16
+ const THRESHOLD = 50;
17
+ const DURATION = 200;
18
+ const DIR_NAME = {
19
+ '1': 'left',
20
+ '-1': 'right',
21
+ };
22
+ function getInitialState(items, startIndex) {
23
+ return circularSlice(items, startIndex, 3);
24
+ }
25
+ function Arr({ className, size, icon, ...rest }) {
26
+ return (jsx(Button, { className: cn(S.arr, className), size: size, variant: "clear", ...rest, children: jsx(Icon, { type: icon, size: size }) }));
27
+ }
28
+ function Item({ src, size, isLoaded, isError, onLoad, onError }) {
29
+ const style = {};
30
+ if (isLoaded)
31
+ style.backgroundImage = `url(${src})`;
32
+ return (jsx("div", { className: S.item, style: style, children: !isLoaded &&
33
+ (isError ? (jsx(Icon, { type: "brokenImage", className: S.brokenImage })) : (jsxs(Fragment, { children: [jsx("img", { src: src, onLoad: onLoad, onError: onError }), jsx(Spinner, { size: size })] }))) }));
34
+ }
35
+ class Gallery extends Component {
36
+ store;
37
+ items;
38
+ index = 0;
39
+ timers = Time.create();
40
+ startX = null;
41
+ innerRef = createRef();
42
+ static defaultProps = {
43
+ size: 'm',
44
+ animation: true,
45
+ startIndex: 0,
46
+ };
47
+ constructor(props) {
48
+ super(props);
49
+ const { startIndex, items } = props;
50
+ this.recenter();
51
+ this.index = startIndex;
52
+ this.store = createStore(this, {
53
+ items: this.getStateItems(),
54
+ movingDirection: 0,
55
+ loading: {},
56
+ errors: {},
57
+ isDragging: false,
58
+ });
59
+ }
60
+ componentDidMount() {
61
+ this.init();
62
+ }
63
+ componentWillUnmount() {
64
+ this.timers.clear();
65
+ }
66
+ componentDidUpdate(prevProps) {
67
+ const { items, startIndex } = this.props;
68
+ if (prevProps.startIndex !== startIndex ||
69
+ !compare(prevProps.items, items)) {
70
+ this.index = startIndex;
71
+ this.recenter();
72
+ this.store.items = this.getStateItems();
73
+ }
74
+ }
75
+ getStateItems() {
76
+ return this.isSingle()
77
+ ? [this.props.items[0]]
78
+ : getInitialState(this.items, this.index);
79
+ }
80
+ recenter() {
81
+ const [...items] = this.props.items;
82
+ this.items = [items.pop(), ...items];
83
+ }
84
+ init() {
85
+ const { items } = this.store;
86
+ if (items.length > 1)
87
+ this.subscribe();
88
+ }
89
+ subscribe() {
90
+ document.addEventListener('keydown', this.onKeyDown);
91
+ }
92
+ isSingle = () => this.props.items.length < 2;
93
+ onKeyDown = e => {
94
+ if (this.isSingle())
95
+ return;
96
+ if (e.key === 'ArrowRight') {
97
+ e.stopPropagation();
98
+ return this.move(-1);
99
+ }
100
+ if (e.key === 'ArrowLeft') {
101
+ e.stopPropagation();
102
+ return this.move(1);
103
+ }
104
+ };
105
+ onPointerDown = e => {
106
+ this.startX = e.pageX;
107
+ };
108
+ onPointerMove = e => {
109
+ if (this.startX === null)
110
+ return;
111
+ const delta = this.getDelta(e);
112
+ if (Math.abs(delta) < THRESHOLD)
113
+ return;
114
+ this.store.isDragging = true;
115
+ this.setTransformDelta(delta);
116
+ };
117
+ onPointerUp = e => {
118
+ if (!this.startX)
119
+ return;
120
+ const delta = this.getDelta(e);
121
+ this.startX = null;
122
+ if (!this.store.isDragging || !delta)
123
+ return;
124
+ this.store.isDragging = false;
125
+ const dir = delta / Math.abs(delta);
126
+ this.move(dir);
127
+ };
128
+ getDelta = e => e.pageX - this.startX;
129
+ setTransformDelta = (delta) => {
130
+ this.innerRef.current.style.transform = `translateX(calc(-100% / 3 + ${delta}px))`;
131
+ };
132
+ removeTransformDelta = () => {
133
+ this.innerRef.current.style.transform = '';
134
+ };
135
+ move = throttle(function (direction) {
136
+ const { animation } = this.props;
137
+ this.store.isDragging = false;
138
+ this.startX = null;
139
+ if (!animation)
140
+ return this.switch(direction);
141
+ this.store.movingDirection = direction;
142
+ this.timers.clear();
143
+ this.timers.after(DURATION, () => this.switch(direction));
144
+ }, DURATION);
145
+ switch(direction) {
146
+ this.index += direction * -1;
147
+ this.store.items = circularSlice(this.items, this.index, 3);
148
+ this.store.movingDirection = 0;
149
+ this.removeTransformDelta();
150
+ const { onChange } = this.props;
151
+ const { items, loading } = this.store;
152
+ onChange?.(this.index, this.items[this.index]);
153
+ items.forEach(src => {
154
+ if (typeof loading[src] !== 'boolean')
155
+ loading[src] = false;
156
+ });
157
+ }
158
+ render() {
159
+ const { className, size, showArrows, showDots, initialBounce, cover, ...rest } = this.props;
160
+ const { items, movingDirection, loading, errors, isDragging } = this.store;
161
+ const dirName = DIR_NAME[movingDirection];
162
+ const isSingle = this.isSingle();
163
+ const props = omit(rest, ['items', 'onChange', 'animation', 'startIndex']);
164
+ const classes = cn(S.root, isSingle && S.single, cover && S.cover, className);
165
+ const innerClasses = cn(S.inner, initialBounce && S.initialBounce, S[dirName]);
166
+ if (!isSingle) {
167
+ props.onPointerDown = this.onPointerDown;
168
+ props.onPointerMove = this.onPointerMove;
169
+ if (isDragging) {
170
+ props.onPointerUp = this.onPointerUp;
171
+ props.onPointerLeave = this.onPointerUp;
172
+ }
173
+ }
174
+ return (jsxs("div", { className: classes, ...props, children: [jsx("div", { className: innerClasses, ref: this.innerRef, children: items.map((src, i) => (jsx(Item, { src: src, size: size, isLoaded: loading[src], isError: errors[src], onLoad: () => (loading[src] = true), onError: () => (errors[src] = true) }, `${i}_${src}`))) }), !isSingle && showArrows && !isDragging && (jsxs(Fragment, { children: [jsx(Arr, { className: S.left, size: size, icon: "chevronLeft", onClick: () => this.move(1) }), jsx(Arr, { className: S.right, size: size, icon: "chevronRight", onClick: () => this.move(-1) })] })), showDots && (jsx(Lazy, { hideSpinner: true,
175
+ // @ts-ignore
176
+ loader: () => import('./Dots/Dots.js'), index: this.index % items.length, count: items.length }))] }));
177
+ }
178
+ }
179
+
180
+ export { Gallery };
@@ -0,0 +1,7 @@
1
+ import styleInject from '../../../node_modules/style-inject/dist/style-inject.es.js';
2
+
3
+ var css_248z = ".Gallery_item__P4qTJ,.Gallery_root__-Crit{height:100%;width:100%}.Gallery_root__-Crit{overflow:hidden;position:relative}.Gallery_inner__4FAPt{-webkit-backface-visibility:hidden;backface-visibility:hidden;display:flex;height:100%;position:absolute;touch-action:none;transform:translate3d(-33.33333%,0,0);width:calc(300% + 1px)}.Gallery_single__Wfd9h .Gallery_inner__4FAPt{transform:none;width:100%}.Gallery_single__Wfd9h .Gallery_item__P4qTJ{width:100%}.Gallery_inner__4FAPt.Gallery_left__zrrmv,.Gallery_inner__4FAPt.Gallery_right__dpZ-m{transition:transform 0s ease-out;transition-duration:.2s}.Gallery_inner__4FAPt.Gallery_left__zrrmv{transform:translateZ(0)!important}.Gallery_inner__4FAPt.Gallery_right__dpZ-m{transform:translate3d(-66.66667%,0,0)!important}.Gallery_inner__4FAPt.Gallery_initialBounce__nZnKd{animation:Gallery_bounce__buqva 1s ease-out}.Gallery_item__P4qTJ{align-items:center;background-position:50%;background-repeat:no-repeat;background-size:contain;display:flex;justify-content:center;width:33.33333%}.Gallery_cover__ZGx5X .Gallery_item__P4qTJ{background-size:cover}.Gallery_item__P4qTJ>img{opacity:0;pointer-events:none;position:absolute}.Gallery_brokenImage__Bj3O-{height:50%;opacity:.2;width:50%}.Gallery_arr__knicI{background:transparent!important;height:100%;min-height:100%;opacity:0;padding:10%;position:absolute;top:0;transition:opacity .1s ease-out}.Gallery_arr__knicI.Gallery_left__zrrmv{justify-content:flex-start;left:0}.Gallery_arr__knicI.Gallery_right__dpZ-m{justify-content:flex-end;right:0;width:77%}.Gallery_arr__knicI:hover{opacity:1}@keyframes Gallery_bounce__buqva{0%{left:0}50%{left:-20%}80%{left:10%}to{left:0}}";
4
+ var S = {"root":"Gallery_root__-Crit","item":"Gallery_item__P4qTJ","inner":"Gallery_inner__4FAPt","single":"Gallery_single__Wfd9h","left":"Gallery_left__zrrmv","right":"Gallery_right__dpZ-m","initialBounce":"Gallery_initialBounce__nZnKd","bounce":"Gallery_bounce__buqva","cover":"Gallery_cover__ZGx5X","brokenImage":"Gallery_brokenImage__Bj3O-","arr":"Gallery_arr__knicI"};
5
+ styleInject(css_248z);
6
+
7
+ export { S as default };
@@ -0,0 +1,37 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { memo, useEffect } from 'react';
3
+ import { scrollIntoView } from '../../tools/scroll.js';
4
+ import S from './Heading.styl.js';
5
+
6
+ let subscribersCount = 0;
7
+ function onClick(e) {
8
+ const href = e.target?.getAttribute('href');
9
+ if (!href || !/#/.test(href))
10
+ return;
11
+ const [path, hash] = href.split('#');
12
+ const heading = document.getElementById(hash);
13
+ if (heading) {
14
+ scrollIntoView(heading);
15
+ e.stopPropagation();
16
+ }
17
+ }
18
+ function subscribe() {
19
+ if (subscribersCount === 0) {
20
+ window.addEventListener('click', onClick, true);
21
+ }
22
+ subscribersCount++;
23
+ }
24
+ function unsubscribe() {
25
+ if (--subscribersCount === 0) {
26
+ window.removeEventListener('click', onClick, true);
27
+ }
28
+ }
29
+ const Heading = memo(function Heading({ id, text }) {
30
+ useEffect(() => {
31
+ subscribe();
32
+ return unsubscribe;
33
+ });
34
+ return (jsxs("h2", { className: S.root, id: id, children: [jsx("a", { href: `${location.pathname}#${id}`, className: S.link, children: "#" }), text] }));
35
+ });
36
+
37
+ export { Heading };
@@ -0,0 +1,7 @@
1
+ import styleInject from '../../../node_modules/style-inject/dist/style-inject.es.js';
2
+
3
+ var css_248z = ".Heading_root__Y4E8o{margin:1em 0;position:relative}.Heading_root__Y4E8o,.Heading_root__Y4E8o>a{color:var(--accent-color)!important}.Heading_root__Y4E8o .Heading_link__JTd0P{bottom:0;display:block;left:-1.7em;min-height:100%;opacity:0;padding:.8em 1em 0!important;pointer-events:all!important;position:absolute;right:1.7em;text-decoration:none;transition:all .2s ease-out}.Heading_root__Y4E8o:hover .Heading_link__JTd0P{opacity:1;transform:translateX(-5px)}";
4
+ var S = {"root":"Heading_root__Y4E8o","link":"Heading_link__JTd0P"};
5
+ styleInject(css_248z);
6
+
7
+ export { S as default };
@@ -0,0 +1,27 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import cn from 'classnames';
3
+ import { Lazy } from '../Lazy/Lazy.js';
4
+ import S from './Icon.styl.js';
5
+ import ICONS from './icons/index.js';
6
+
7
+ const icons = ICONS;
8
+ function Icon(props) {
9
+ const { className, type, size, ...rest } = props;
10
+ const iconProps = {
11
+ className: cn(S.root, S[`size-${size}`], className),
12
+ role: 'img',
13
+ ...rest,
14
+ };
15
+ const localIcon = ICONS[type];
16
+ if (!localIcon) {
17
+ console.warn(`Icon: type="${type}" is unknown`);
18
+ return null;
19
+ }
20
+ // @ts-ignore
21
+ return jsx(Lazy, { loader: localIcon, hideSpinner: true, ...iconProps });
22
+ }
23
+ Icon.defaultProps = {
24
+ size: 'm',
25
+ };
26
+
27
+ export { Icon, icons };
@@ -0,0 +1,7 @@
1
+ import styleInject from '../../../node_modules/style-inject/dist/style-inject.es.js';
2
+
3
+ var css_248z = ".Icon_root__Uzney{color:inherit;display:inline-block;pointer-events:none}.Icon_size-xs__T-Npk{height:8px;width:8px}.Icon_size-s__qftZG{height:12px;width:12px}.Icon_size-m__7xCDX{height:16px;width:16px}.Icon_size-l__Eq1Fb{height:20px;width:20px}.Icon_size-xl__ChZL5{height:26px;width:26px}";
4
+ var S = {"root":"Icon_root__Uzney","size-xs":"Icon_size-xs__T-Npk","size-s":"Icon_size-s__qftZG","size-m":"Icon_size-m__7xCDX","size-l":"Icon_size-l__Eq1Fb","size-xl":"Icon_size-xl__ChZL5"};
5
+ styleInject(css_248z);
6
+
7
+ export { S as default };
@@ -0,0 +1,15 @@
1
+ import * as React from 'react';
2
+
3
+ var _path;
4
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
5
+ var SvgAvatar = function SvgAvatar(props) {
6
+ return /*#__PURE__*/React.createElement("svg", _extends({
7
+ viewBox: "0 0 24 24",
8
+ xmlns: "http://www.w3.org/2000/svg",
9
+ fill: "currentColor"
10
+ }, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
11
+ d: "M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10 10-4.5 10-10S17.5 2 12 2zm0 1.5c2 0 3.6 1.6 3.6 3.6S14 10.8 12 10.8 8.4 9.1 8.4 7.1 10 3.5 12 3.5zm0 17.2c-3 0-5.7-1.5-7.3-3.9.9-2.9 4.8-3.7 7.3-3.7 2.4 0 6 .8 7.3 3.7-1.6 2.3-4.3 3.9-7.3 3.9z"
12
+ })));
13
+ };
14
+
15
+ export { SvgAvatar as default };