@ainias42/react-bootstrap-mobile 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (412) hide show
  1. package/.ctirc +114 -0
  2. package/.prettierrc +1 -5
  3. package/.storybook/main.ts +31 -0
  4. package/.storybook/preview.ts +36 -0
  5. package/bin/release.sh +1 -37
  6. package/bin/updatePackages.sh +3 -0
  7. package/dist/{src/Components → Components}/ActionSheet/ActionSheet.d.ts +5 -5
  8. package/dist/Components/ActionSheet/ActionSheet.stories.d.ts +9 -0
  9. package/dist/Components/Card/Card.d.ts +12 -0
  10. package/dist/Components/Card/Card.stories.d.ts +16 -0
  11. package/dist/{src/Components → Components}/Clickable/Clickable.d.ts +3 -3
  12. package/dist/Components/Colors.stories.d.ts +5 -0
  13. package/dist/Components/Dialog/AlertDialog.d.ts +8 -0
  14. package/dist/Components/Dialog/AlertDialog.stories.d.ts +14 -0
  15. package/dist/{src/Components → Components}/Dialog/ButtonDialog.d.ts +3 -3
  16. package/dist/Components/Dialog/ConfirmDialog.d.ts +9 -0
  17. package/dist/Components/Dialog/ConfirmDialog.stories.d.ts +15 -0
  18. package/dist/{src/Components → Components}/Dialog/Dialog.d.ts +2 -2
  19. package/dist/{src/Components → Components}/Dialog/DialogBackground.d.ts +2 -2
  20. package/dist/{src/Components → Components}/Dialog/DialogContainer.d.ts +3 -3
  21. package/dist/{src/Components → Components}/Dialog/DialogContext.d.ts +3 -2
  22. package/dist/{src/Components → Components}/DragAndDrop/DragItem.d.ts +2 -2
  23. package/dist/{src/Components → Components}/DragAndDrop/DropArea.d.ts +2 -2
  24. package/dist/{src/Components → Components}/FormElements/Button/Button.d.ts +8 -8
  25. package/dist/Components/FormElements/Button/Button.stories.d.ts +43 -0
  26. package/dist/Components/FormElements/CheckBox/Checkbox.d.ts +12 -0
  27. package/dist/Components/FormElements/CheckBox/Checkbox.stories.d.ts +17 -0
  28. package/dist/{src/Components → Components}/FormElements/ColorInput/ColorInput.d.ts +3 -5
  29. package/dist/Components/FormElements/ColorInput/ColorInput.stories.d.ts +8 -0
  30. package/dist/{src/Components → Components}/FormElements/Controller/ColorInputController.d.ts +1 -1
  31. package/dist/{src/Components → Components}/FormElements/Controller/FileInputController.d.ts +4 -4
  32. package/dist/Components/FormElements/Controller/HookForm.d.ts +15 -0
  33. package/dist/{src/Components → Components}/FormElements/Controller/InputController.d.ts +1 -1
  34. package/dist/{src/Components → Components}/FormElements/Controller/MultipleFileInputController.d.ts +1 -1
  35. package/dist/{src/Components → Components}/FormElements/Controller/PasswordInputController.d.ts +1 -1
  36. package/dist/{src/Components → Components}/FormElements/Controller/SelectController.d.ts +1 -1
  37. package/dist/Components/FormElements/Controller/SliderController.d.ts +5 -0
  38. package/dist/{src/Components → Components}/FormElements/Controller/SwitchController.d.ts +1 -1
  39. package/dist/{src/Components → Components}/FormElements/Controller/TextareaController.d.ts +1 -1
  40. package/dist/{src/Components → Components}/FormElements/Controller/useYupResolver.d.ts +1 -1
  41. package/dist/{src/Components → Components}/FormElements/Controller/withHookController.d.ts +3 -2
  42. package/dist/Components/FormElements/Error/FormError.d.ts +6 -0
  43. package/dist/Components/FormElements/Error/FormError.stories.d.ts +7 -0
  44. package/dist/Components/FormElements/Form.stories.d.ts +7 -0
  45. package/dist/Components/FormElements/Input/FileInput/FileInput.d.ts +13 -0
  46. package/dist/{src/Components → Components}/FormElements/Input/FileInput/MultipleFileInput.d.ts +6 -6
  47. package/dist/Components/FormElements/Input/HiddenInput.d.ts +6 -0
  48. package/dist/Components/FormElements/Input/HiddenInput.stories.d.ts +9 -0
  49. package/dist/{src/Components → Components}/FormElements/Input/Input.d.ts +4 -4
  50. package/dist/Components/FormElements/Input/Input.stories.d.ts +18 -0
  51. package/dist/{src/Components → Components}/FormElements/Input/PasswordInput/PasswordInput.d.ts +5 -4
  52. package/dist/Components/FormElements/Input/PasswordInput/PasswordInput.stories.d.ts +8 -0
  53. package/dist/{src/Components → Components}/FormElements/SearchSelectInput/SearchSelectInput.d.ts +4 -4
  54. package/dist/Components/FormElements/SearchSelectInput/SearchSelectInput.stories.d.ts +9 -0
  55. package/dist/{src/Components → Components}/FormElements/Select/Select.d.ts +4 -4
  56. package/dist/Components/FormElements/Select/Select.stories.d.ts +8 -0
  57. package/dist/{src/Components → Components}/FormElements/Slider/Slider.d.ts +4 -4
  58. package/dist/Components/FormElements/Slider/Slider.stories.d.ts +7 -0
  59. package/dist/{src/Components → Components}/FormElements/Switch/Switch.d.ts +5 -5
  60. package/dist/Components/FormElements/Switch/Switch.stories.d.ts +11 -0
  61. package/dist/{src/Components → Components}/FormElements/Textarea/Textarea.d.ts +4 -4
  62. package/dist/Components/FormElements/Textarea/Textarea.stories.d.ts +9 -0
  63. package/dist/{src/Components → Components}/FormElements/hooks/useOnChangeDone.d.ts +1 -1
  64. package/dist/{src/Components → Components}/FullScreen/FullScreen.d.ts +4 -4
  65. package/dist/{src/Components → Components}/Hooks/useClientLayoutEffect.d.ts +1 -1
  66. package/dist/{src/Components → Components}/Hooks/useComposedRef.d.ts +1 -1
  67. package/dist/{src/Components → Components}/Hooks/useDelayedState.d.ts +1 -1
  68. package/dist/{src/Components → Components}/Hooks/useInViewport.d.ts +1 -1
  69. package/dist/{src/Components → Components}/Icon/DoubleIcon.d.ts +1 -1
  70. package/dist/Components/Icon/DoubleIcon.stories.d.ts +23 -0
  71. package/dist/{src/Components → Components}/Icon/Icon.d.ts +5 -5
  72. package/dist/Components/Icon/Icon.stories.d.ts +17 -0
  73. package/dist/Components/Image/Image.d.ts +10 -0
  74. package/dist/Components/Image/Image.stories.d.ts +7 -0
  75. package/dist/{src/Components → Components}/InViewport/InViewport.d.ts +1 -1
  76. package/dist/{src/Components → Components}/Layout/Block.d.ts +4 -4
  77. package/dist/{src/Components → Components}/Layout/Container.d.ts +1 -1
  78. package/dist/{src/Components → Components}/Layout/Flex.d.ts +3 -3
  79. package/dist/{src/Components → Components}/Layout/Grid/Grid.d.ts +3 -3
  80. package/dist/{src/Components → Components}/Layout/Grid/GridItem.d.ts +1 -1
  81. package/dist/Components/Layout/Grow.d.ts +10 -0
  82. package/dist/{src/Components → Components}/Layout/Inline.d.ts +3 -3
  83. package/dist/{src/Components → Components}/Layout/InlineBlock.d.ts +3 -3
  84. package/dist/{src/Components → Components}/Layout/View.d.ts +4 -4
  85. package/dist/{src/Components → Components}/Layout/ViewWithoutListeners.d.ts +3 -3
  86. package/dist/Components/LoadingArea/LoadingArea.d.ts +9 -0
  87. package/dist/Components/LoadingArea/LoadingArea.stories.d.ts +9 -0
  88. package/dist/Components/LoadingCircle/LoadingCircle.d.ts +7 -0
  89. package/dist/Components/LoadingCircle/LoadingCircle.stories.d.ts +26 -0
  90. package/dist/{src/Components → Components}/Menu/HoverMenu.d.ts +3 -3
  91. package/dist/Components/Menu/HoverMenu.stories.d.ts +16 -0
  92. package/dist/{src/Components → Components}/Menu/Menu.d.ts +2 -2
  93. package/dist/Components/Menu/Menu.stories.d.ts +14 -0
  94. package/dist/{src/Components → Components}/Menu/MenuCloseContext.d.ts +1 -1
  95. package/dist/{src/Components → Components}/Menu/MenuDivider.d.ts +1 -1
  96. package/dist/{src/Components → Components}/Menu/MenuItem.d.ts +4 -3
  97. package/dist/Components/Menu/MenuItem.stories.d.ts +21 -0
  98. package/dist/{src/Components → Components}/Menu/Submenu.d.ts +3 -3
  99. package/dist/Components/Menu/Submenu.stories.d.ts +10 -0
  100. package/dist/{src/Components → Components}/Menu/useMenu.d.ts +2 -2
  101. package/dist/{src/Components → Components}/RbmComponentProps.d.ts +4 -4
  102. package/dist/{src/Components → Components}/SizeCalculator/SizeCalculator.d.ts +1 -1
  103. package/dist/Components/SpoilerList/Spoiler/Spoiler.d.ts +16 -0
  104. package/dist/Components/SpoilerList/Spoiler/Spoiler.stories.d.ts +7 -0
  105. package/dist/{src/Components → Components}/SpoilerList/SpoilerList.d.ts +3 -5
  106. package/dist/{src/Components → Components}/TabBar/TabBar.d.ts +4 -6
  107. package/dist/Components/TabBar/TabBar.stories.d.ts +10 -0
  108. package/dist/Components/TabBar/TabBarButton.d.ts +7 -0
  109. package/dist/{src/Components → Components}/Table/Table.d.ts +3 -3
  110. package/dist/{src/Components → Components}/Text/Heading.d.ts +2 -2
  111. package/dist/{src/Components → Components}/Text/Text.d.ts +3 -3
  112. package/dist/Components/Text/Text.stories.d.ts +35 -0
  113. package/dist/Components/Toast/Toast.d.ts +12 -0
  114. package/dist/Components/Toast/Toast.stories.d.ts +8 -0
  115. package/dist/{src/Components → Components}/Toast/ToastContainer.d.ts +2 -2
  116. package/dist/Components/TopBar/MoreButton.d.ts +7 -0
  117. package/dist/{src/Components → Components}/TopBar/TopBar.d.ts +4 -6
  118. package/dist/Components/TopBar/TopBar.stories.d.ts +7 -0
  119. package/dist/Components/TopBar/TopBarButton.d.ts +7 -0
  120. package/dist/helper/useDeepShallow.d.ts +1 -0
  121. package/dist/helper/withMemo.d.ts +3 -0
  122. package/dist/{src/helper → helper}/withRenderBrowserOnly.d.ts +1 -1
  123. package/dist/helper/withRestrictedChildren.d.ts +7 -0
  124. package/dist/index.css +36 -0
  125. package/dist/index.css.map +1 -0
  126. package/dist/index.d.ts +116 -0
  127. package/dist/index.js +5357 -0
  128. package/dist/index.js.map +1 -0
  129. package/dist/treeshakeTest.d.ts +1 -0
  130. package/eslint.config.js +17 -0
  131. package/package.json +40 -90
  132. package/react-bootstrap-mobile.scss +6 -6
  133. package/src/Components/ActionSheet/ActionSheet.stories.tsx +55 -0
  134. package/src/Components/ActionSheet/ActionSheet.tsx +37 -24
  135. package/src/Components/ActionSheet/actionSheet.module.scss +198 -0
  136. package/src/Components/Card/Card.stories.tsx +41 -0
  137. package/src/Components/Card/Card.tsx +6 -9
  138. package/src/Components/Card/card.module.scss +74 -0
  139. package/src/Components/Clickable/Clickable.tsx +73 -63
  140. package/src/Components/Clickable/clickable.module.scss +14 -0
  141. package/src/Components/Colors.stories.tsx +77 -0
  142. package/src/Components/Dialog/AlertDialog.stories.tsx +28 -0
  143. package/src/Components/Dialog/AlertDialog.tsx +10 -9
  144. package/src/Components/Dialog/ButtonDialog.tsx +15 -13
  145. package/src/Components/Dialog/ConfirmDialog.stories.tsx +29 -0
  146. package/src/Components/Dialog/ConfirmDialog.tsx +11 -9
  147. package/src/Components/Dialog/Dialog.tsx +10 -10
  148. package/src/Components/Dialog/DialogBackground.tsx +32 -21
  149. package/src/Components/Dialog/DialogContainer.tsx +23 -18
  150. package/src/Components/Dialog/DialogContext.ts +7 -6
  151. package/src/Components/Dialog/{buttonDialog.scss → buttonDialog.module.scss} +29 -21
  152. package/src/Components/Dialog/dialog.module.scss +30 -0
  153. package/src/Components/Dialog/dialogBackground.module.scss +17 -0
  154. package/src/Components/Dialog/useAlertDialog.ts +3 -3
  155. package/src/Components/Dialog/useConfirmDialog.ts +3 -3
  156. package/src/Components/DragAndDrop/DragItem.tsx +7 -6
  157. package/src/Components/DragAndDrop/DropArea.tsx +5 -4
  158. package/src/Components/Flavor.ts +4 -4
  159. package/src/Components/FormElements/Button/Button.stories.tsx +79 -0
  160. package/src/Components/FormElements/Button/Button.tsx +49 -36
  161. package/src/Components/FormElements/Button/ButtonType.ts +2 -2
  162. package/src/Components/FormElements/Button/button.module.scss +87 -0
  163. package/src/Components/FormElements/CheckBox/Checkbox.stories.tsx +50 -0
  164. package/src/Components/FormElements/CheckBox/Checkbox.tsx +13 -14
  165. package/src/Components/FormElements/CheckBox/{checkbox.scss → checkbox.module.scss} +30 -11
  166. package/src/Components/FormElements/ColorInput/ColorInput.stories.tsx +24 -0
  167. package/src/Components/FormElements/ColorInput/ColorInput.tsx +55 -59
  168. package/src/Components/FormElements/ColorInput/{colorInput.scss → colorInput.module.scss} +17 -19
  169. package/src/Components/FormElements/ColorInput/sharedSelectedColor.ts +19 -10
  170. package/src/Components/FormElements/Controller/ColorInputController.ts +3 -3
  171. package/src/Components/FormElements/Controller/FileInputController.tsx +29 -20
  172. package/src/Components/FormElements/Controller/HookForm.tsx +128 -24
  173. package/src/Components/FormElements/Controller/InputController.ts +3 -3
  174. package/src/Components/FormElements/Controller/MultipleFileInputController.ts +2 -3
  175. package/src/Components/FormElements/Controller/PasswordInputController.ts +3 -3
  176. package/src/Components/FormElements/Controller/SelectController.ts +3 -3
  177. package/src/Components/FormElements/Controller/SendFormContext.ts +3 -3
  178. package/src/Components/FormElements/Controller/SliderController.ts +4 -0
  179. package/src/Components/FormElements/Controller/SwitchController.ts +3 -3
  180. package/src/Components/FormElements/Controller/TextareaController.ts +2 -2
  181. package/src/Components/FormElements/Controller/useYupResolver.ts +10 -8
  182. package/src/Components/FormElements/Controller/withHookController.tsx +21 -18
  183. package/src/Components/FormElements/Error/FormError.stories.tsx +16 -0
  184. package/src/Components/FormElements/Error/FormError.tsx +42 -0
  185. package/src/Components/FormElements/Error/formError.module.scss +9 -0
  186. package/src/Components/FormElements/Form.stories.tsx +16 -0
  187. package/src/Components/FormElements/Input/FileInput/FileInput.tsx +52 -32
  188. package/src/Components/FormElements/Input/FileInput/MultipleFileInput.tsx +234 -231
  189. package/src/Components/FormElements/Input/FileInput/{fileInput.scss → fileInput.module.scss} +10 -12
  190. package/src/Components/FormElements/Input/HiddenInput.stories.tsx +44 -0
  191. package/src/Components/FormElements/Input/HiddenInput.tsx +6 -8
  192. package/src/Components/FormElements/Input/Input.stories.tsx +59 -0
  193. package/src/Components/FormElements/Input/Input.tsx +173 -172
  194. package/src/Components/FormElements/Input/PasswordInput/PasswordInput.stories.tsx +31 -0
  195. package/src/Components/FormElements/Input/PasswordInput/PasswordInput.tsx +20 -16
  196. package/src/Components/FormElements/Input/input.module.scss +95 -0
  197. package/src/Components/FormElements/SearchSelectInput/SearchSelectInput.stories.tsx +49 -0
  198. package/src/Components/FormElements/SearchSelectInput/SearchSelectInput.tsx +178 -166
  199. package/src/Components/FormElements/SearchSelectInput/seachSelectInput.module.scss +112 -0
  200. package/src/Components/FormElements/Select/Select.stories.tsx +49 -0
  201. package/src/Components/FormElements/Select/Select.tsx +34 -24
  202. package/src/Components/FormElements/Select/select.module.scss +63 -0
  203. package/src/Components/FormElements/Slider/Slider.stories.tsx +15 -0
  204. package/src/Components/FormElements/Slider/Slider.tsx +29 -20
  205. package/src/Components/FormElements/Slider/slider.module.scss +93 -0
  206. package/src/Components/FormElements/Switch/Switch.stories.tsx +65 -0
  207. package/src/Components/FormElements/Switch/Switch.tsx +72 -63
  208. package/src/Components/FormElements/Switch/switch.module.scss +157 -0
  209. package/src/Components/FormElements/Textarea/Textarea.stories.tsx +37 -0
  210. package/src/Components/FormElements/Textarea/Textarea.tsx +46 -45
  211. package/src/Components/FormElements/Textarea/textarea.module.scss +34 -0
  212. package/src/Components/FormElements/hooks/useOnChangeDone.ts +6 -2
  213. package/src/Components/FullScreen/FullScreen.tsx +16 -16
  214. package/src/Components/Hooks/useBreakpoint.ts +13 -7
  215. package/src/Components/Hooks/useClientLayoutEffect.ts +1 -1
  216. package/src/Components/Hooks/useComposedRef.ts +2 -1
  217. package/src/Components/Hooks/useDebounced.ts +2 -2
  218. package/src/Components/Hooks/useDelayed.ts +2 -3
  219. package/src/Components/Hooks/useDelayedEffect.ts +3 -3
  220. package/src/Components/Hooks/useDelayedState.ts +18 -10
  221. package/src/Components/Hooks/useInViewport.ts +3 -2
  222. package/src/Components/Hooks/useKeyListener.ts +9 -6
  223. package/src/Components/Hooks/useListener.ts +4 -4
  224. package/src/Components/Hooks/useMousePosition.ts +2 -2
  225. package/src/Components/Hooks/useRerender.ts +17 -14
  226. package/src/Components/Hooks/useWindowDimensions.ts +11 -12
  227. package/src/Components/Icon/DoubleIcon.stories.tsx +38 -0
  228. package/src/Components/Icon/DoubleIcon.tsx +22 -17
  229. package/src/Components/Icon/Icon.stories.tsx +37 -0
  230. package/src/Components/Icon/Icon.tsx +39 -17
  231. package/src/Components/Icon/{icon.scss → icon.module.scss} +2 -0
  232. package/src/Components/Image/Image.stories.tsx +17 -0
  233. package/src/Components/Image/Image.tsx +7 -12
  234. package/src/Components/InViewport/InViewport.tsx +5 -6
  235. package/src/Components/Layout/Block.tsx +18 -12
  236. package/src/Components/Layout/Container.tsx +5 -6
  237. package/src/Components/Layout/Flex.tsx +17 -9
  238. package/src/Components/Layout/Grid/Grid.tsx +20 -10
  239. package/src/Components/Layout/Grid/GridItem.tsx +5 -6
  240. package/src/Components/Layout/Grid/{grid.scss → grid.module.scss} +19 -26
  241. package/src/Components/Layout/Grow.tsx +18 -8
  242. package/src/Components/Layout/Inline.tsx +15 -12
  243. package/src/Components/Layout/InlineBlock.tsx +17 -12
  244. package/src/Components/Layout/View.tsx +20 -9
  245. package/src/Components/Layout/ViewWithoutListeners.tsx +24 -15
  246. package/src/Components/Layout/container.module.scss +54 -0
  247. package/src/Components/LoadingArea/LoadingArea.stories.tsx +35 -0
  248. package/src/Components/LoadingArea/LoadingArea.tsx +10 -15
  249. package/src/Components/LoadingArea/{loadingArea.scss → loadingArea.module.scss} +8 -5
  250. package/src/Components/LoadingCircle/LoadingCircle.stories.tsx +58 -0
  251. package/src/Components/LoadingCircle/LoadingCircle.tsx +26 -13
  252. package/src/Components/LoadingCircle/{loadingCircle.scss → loadingCircle.module.scss} +14 -5
  253. package/src/Components/Menu/HoverMenu.stories.tsx +32 -0
  254. package/src/Components/Menu/HoverMenu.tsx +61 -45
  255. package/src/Components/Menu/Menu.stories.tsx +69 -0
  256. package/src/Components/Menu/Menu.tsx +67 -58
  257. package/src/Components/Menu/MenuCloseContext.ts +1 -1
  258. package/src/Components/Menu/MenuDivider.tsx +6 -6
  259. package/src/Components/Menu/MenuItem.stories.tsx +35 -0
  260. package/src/Components/Menu/MenuItem.tsx +66 -55
  261. package/src/Components/Menu/Submenu.stories.tsx +37 -0
  262. package/src/Components/Menu/Submenu.tsx +72 -58
  263. package/src/Components/Menu/{menu.scss → menu.module.scss} +23 -11
  264. package/src/Components/Menu/useMenu.ts +4 -3
  265. package/src/Components/RbmComponentProps.ts +6 -7
  266. package/src/Components/SizeCalculator/SizeCalculator.tsx +3 -3
  267. package/src/Components/SpoilerList/Spoiler/Spoiler.stories.tsx +21 -0
  268. package/src/Components/SpoilerList/Spoiler/Spoiler.tsx +49 -48
  269. package/src/Components/SpoilerList/Spoiler/{spoiler.scss → spoiler.module.scss} +46 -30
  270. package/src/Components/SpoilerList/SpoilerList.tsx +8 -12
  271. package/src/Components/SpoilerList/useSpoilerGroup.ts +2 -2
  272. package/src/Components/TabBar/TabBar.stories.tsx +32 -0
  273. package/src/Components/TabBar/TabBar.tsx +16 -18
  274. package/src/Components/TabBar/TabBarButton.tsx +13 -10
  275. package/src/Components/TabBar/tabBar.module.scss +128 -0
  276. package/src/Components/Table/Table.tsx +16 -15
  277. package/src/Components/Text/Heading.tsx +6 -7
  278. package/src/Components/Text/Text.stories.tsx +121 -0
  279. package/src/Components/Text/Text.tsx +19 -10
  280. package/src/Components/Text/{text.scss → text.module.scss} +3 -8
  281. package/src/Components/Toast/Toast.stories.tsx +25 -0
  282. package/src/Components/Toast/Toast.tsx +15 -17
  283. package/src/Components/Toast/ToastContainer.tsx +72 -54
  284. package/src/Components/Toast/ToastContext.ts +9 -3
  285. package/src/Components/Toast/toast.module.scss +65 -0
  286. package/src/Components/TopBar/MoreButton.tsx +9 -11
  287. package/src/Components/TopBar/TopBar.stories.tsx +63 -0
  288. package/src/Components/TopBar/TopBar.tsx +49 -40
  289. package/src/Components/TopBar/TopBarButton.tsx +20 -10
  290. package/src/Components/TopBar/{topBar.scss → topBar.module.scss} +40 -23
  291. package/src/Size.ts +1 -2
  292. package/src/WrongChildError.ts +1 -1
  293. package/src/helper/EmptyProps.ts +1 -1
  294. package/src/helper/nonEmptyString.ts +1 -1
  295. package/src/helper/useDeepShallow.ts +10 -0
  296. package/src/helper/withMemo.ts +7 -8
  297. package/src/helper/withRenderBrowserOnly.tsx +2 -1
  298. package/src/helper/withRestrictedChildren.tsx +11 -14
  299. package/src/index.ts +116 -0
  300. package/src/scss/_colors.scss +32 -19
  301. package/src/scss/_default.scss +5 -5
  302. package/src/scss/_flavorMixin.scss +3 -0
  303. package/src/scss/_variables.scss +19 -19
  304. package/src/scss/_vars.scss +12 -0
  305. package/src/scss/baseClasses.module.scss +23 -0
  306. package/src/scss/breakpoints.scss +79 -0
  307. package/src/treeshakeTest.ts +3 -0
  308. package/src/types/{react-table-config.d.ts → reactTableConfig.d.ts} +2 -43
  309. package/stylelint.config.mjs +4 -0
  310. package/tsconfig.build.json +7 -0
  311. package/tsconfig.json +16 -48
  312. package/webpack.config.ts +6 -0
  313. package/.eslintrc.json +0 -191
  314. package/.npnignore +0 -5
  315. package/LICENSE +0 -21
  316. package/README.md +0 -1
  317. package/babel.config.js +0 -22
  318. package/bin/build.js +0 -60
  319. package/bin/updateCopies.js +0 -94
  320. package/bootstrapReactMobile.ts +0 -119
  321. package/dist/bootstrapReactMobile.d.ts +0 -119
  322. package/dist/bootstrapReactMobile.js +0 -14043
  323. package/dist/bootstrapReactMobile.js.map +0 -1
  324. package/dist/src/Components/Card/Card.d.ts +0 -14
  325. package/dist/src/Components/Dialog/AlertDialog.d.ts +0 -10
  326. package/dist/src/Components/Dialog/ConfirmDialog.d.ts +0 -11
  327. package/dist/src/Components/FormElements/CheckBox/Checkbox.d.ts +0 -14
  328. package/dist/src/Components/FormElements/Controller/HookForm.d.ts +0 -8
  329. package/dist/src/Components/FormElements/FormError.d.ts +0 -5
  330. package/dist/src/Components/FormElements/Input/FileInput/FileInput.d.ts +0 -13
  331. package/dist/src/Components/FormElements/Input/HiddenInput.d.ts +0 -8
  332. package/dist/src/Components/Image/Image.d.ts +0 -12
  333. package/dist/src/Components/Layout/Grow.d.ts +0 -9
  334. package/dist/src/Components/List/BulletList/BulletList.d.ts +0 -8
  335. package/dist/src/Components/List/BulletList/ListItem.d.ts +0 -7
  336. package/dist/src/Components/List/InfiniteList.d.ts +0 -7
  337. package/dist/src/Components/List/List.d.ts +0 -15
  338. package/dist/src/Components/LoadingArea/LoadingArea.d.ts +0 -12
  339. package/dist/src/Components/LoadingCircle/LoadingCircle.d.ts +0 -8
  340. package/dist/src/Components/SpoilerList/Spoiler/Spoiler.d.ts +0 -18
  341. package/dist/src/Components/TabBar/TabBarButton.d.ts +0 -9
  342. package/dist/src/Components/Toast/Toast.d.ts +0 -13
  343. package/dist/src/Components/TopBar/MoreButton.d.ts +0 -9
  344. package/dist/src/Components/TopBar/TopBarButton.d.ts +0 -9
  345. package/dist/src/ListRow/ListRow.d.ts +0 -1
  346. package/dist/src/StyleProvider.d.ts +0 -2
  347. package/dist/src/helper/withMemo.d.ts +0 -3
  348. package/dist/src/helper/withRestrictedChildren.d.ts +0 -6
  349. package/scripts/getPackageJson.js +0 -25
  350. package/src/Components/ActionSheet/actionSheet.scss +0 -153
  351. package/src/Components/Card/card.scss +0 -76
  352. package/src/Components/Clickable/clickable.scss +0 -8
  353. package/src/Components/Dialog/dialog.scss +0 -30
  354. package/src/Components/Dialog/dialogBackground.scss +0 -11
  355. package/src/Components/FormElements/Button/button.scss +0 -73
  356. package/src/Components/FormElements/FormError.tsx +0 -29
  357. package/src/Components/FormElements/Input/input.scss +0 -83
  358. package/src/Components/FormElements/SearchSelectInput/seachSelectInput.scss +0 -97
  359. package/src/Components/FormElements/Select/select.scss +0 -61
  360. package/src/Components/FormElements/Slider/slider.scss +0 -92
  361. package/src/Components/FormElements/Switch/switch.scss +0 -152
  362. package/src/Components/FormElements/Textarea/textarea.scss +0 -31
  363. package/src/Components/FormElements/formError.scss +0 -4
  364. package/src/Components/Layout/container.scss +0 -12
  365. package/src/Components/List/BulletList/BulletList.tsx +0 -33
  366. package/src/Components/List/BulletList/ListItem.tsx +0 -34
  367. package/src/Components/List/InfiniteList.tsx +0 -56
  368. package/src/Components/List/List.tsx +0 -95
  369. package/src/Components/List/list.scss +0 -30
  370. package/src/Components/TabBar/tabBar.scss +0 -108
  371. package/src/Components/Toast/toast.scss +0 -55
  372. package/src/ListRow/ListRow.tsx +0 -20
  373. package/src/StyleProvider.ts +0 -4
  374. package/src/scss/_baseClasses.scss +0 -23
  375. package/src/types/isomorphic-style-loader.d.ts +0 -3
  376. package/webpack.config.js +0 -95
  377. /package/dist/{src/Components → Components}/Dialog/useAlertDialog.d.ts +0 -0
  378. /package/dist/{src/Components → Components}/Dialog/useConfirmDialog.d.ts +0 -0
  379. /package/dist/{src/Components → Components}/DragAndDrop/useStrictEnabled.d.ts +0 -0
  380. /package/dist/{src/Components → Components}/Flavor.d.ts +0 -0
  381. /package/dist/{src/Components → Components}/FormElements/Button/ButtonType.d.ts +0 -0
  382. /package/dist/{src/Components → Components}/FormElements/ColorInput/sharedSelectedColor.d.ts +0 -0
  383. /package/dist/{src/Components → Components}/FormElements/Controller/SendFormContext.d.ts +0 -0
  384. /package/dist/{src/Components → Components}/FormElements/Input/FileInput/FileType.d.ts +0 -0
  385. /package/dist/{src/Components → Components}/Hooks/useBreakpoint.d.ts +0 -0
  386. /package/dist/{src/Components → Components}/Hooks/useDebounced.d.ts +0 -0
  387. /package/dist/{src/Components → Components}/Hooks/useDelayed.d.ts +0 -0
  388. /package/dist/{src/Components → Components}/Hooks/useDelayedEffect.d.ts +0 -0
  389. /package/dist/{src/Components → Components}/Hooks/useKeyListener.d.ts +0 -0
  390. /package/dist/{src/Components → Components}/Hooks/useListener.d.ts +0 -0
  391. /package/dist/{src/Components → Components}/Hooks/useMousePosition.d.ts +0 -0
  392. /package/dist/{src/Components → Components}/Hooks/useOnMount.d.ts +0 -0
  393. /package/dist/{src/Components → Components}/Hooks/useOnce.d.ts +0 -0
  394. /package/dist/{src/Components → Components}/Hooks/useRerender.d.ts +0 -0
  395. /package/dist/{src/Components → Components}/Hooks/useWindowDimensions.d.ts +0 -0
  396. /package/dist/{src/Components → Components}/SpoilerList/useSpoilerGroup.d.ts +0 -0
  397. /package/dist/{src/Components → Components}/Toast/ToastContext.d.ts +0 -0
  398. /package/dist/{src/Size.d.ts → Size.d.ts} +0 -0
  399. /package/dist/{src/TypeHelpers.d.ts → TypeHelpers.d.ts} +0 -0
  400. /package/dist/{src/WindowContext → WindowContext}/WindowContext.d.ts +0 -0
  401. /package/dist/{src/WrongChildError.d.ts → WrongChildError.d.ts} +0 -0
  402. /package/dist/{src/helper → helper}/Characters.d.ts +0 -0
  403. /package/dist/{src/helper → helper}/DistributiveOmit.d.ts +0 -0
  404. /package/dist/{src/helper → helper}/EmptyProps.d.ts +0 -0
  405. /package/dist/{src/helper → helper}/memoComparator.d.ts +0 -0
  406. /package/dist/{src/helper → helper}/nonEmptyString.d.ts +0 -0
  407. /package/src/Components/FormElements/Input/PasswordInput/{passwordInput.scss → passwordInput.module.scss} +0 -0
  408. /package/src/Components/Image/{image.scss → image.module.scss} +0 -0
  409. /package/src/Components/InViewport/{inViewport.scss → inViewport.module.scss} +0 -0
  410. /package/src/Components/Layout/{layout.scss → layout.module.scss} +0 -0
  411. /package/src/Components/Text/{heading.scss → heading.module.scss} +0 -0
  412. /package/src/types/{scss-module.d.ts → scss.d.ts} +0 -0
@@ -0,0 +1,37 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+
3
+ import { MenuItem } from '@/Components/Menu/MenuItem';
4
+ import { Submenu } from '@/Components/Menu/Submenu';
5
+ import { faBook, faCog, faHome, faUser } from '@fortawesome/free-solid-svg-icons';
6
+ import { fn } from 'storybook/test';
7
+ import React from 'react';
8
+ import type { SubmenuProps } from '@/Components/Menu/Submenu';
9
+
10
+ const meta = {
11
+ component: Submenu,
12
+ render: (args) => (
13
+ <Submenu {...args}>
14
+ <MenuItem icon={faHome} onClick={fn()}>
15
+ Eins
16
+ </MenuItem>
17
+ <MenuItem icon={faUser} onClick={fn()}>
18
+ Zwei
19
+ </MenuItem>
20
+ <MenuItem icon={faCog} onClick={fn()}>
21
+ Drei
22
+ </MenuItem>
23
+ </Submenu>
24
+ ),
25
+ } satisfies Meta<typeof Submenu>;
26
+
27
+ export default meta;
28
+
29
+ type Story = StoryObj<SubmenuProps>;
30
+
31
+ export const Default: Story = {
32
+ args: {
33
+ label: 'Submenu',
34
+ icon: faBook,
35
+ disabled: false,
36
+ },
37
+ };
@@ -1,37 +1,42 @@
1
- import {RbmComponentProps, WithNoStringAndChildrenProps} from "../RbmComponentProps";
2
- import {Icon, IconSource} from "../Icon/Icon";
3
- import {Clickable} from "../Clickable/Clickable";
4
- import classNames from "classnames";
5
- import styles from "./menu.scss";
6
- import React, {useCallback, useRef, useState} from "react";
7
- import {Text} from "../Text/Text";
8
- import {withMemo} from "../../helper/withMemo";
9
- import {Block} from "../Layout/Block";
10
- import {useWindow} from "../../WindowContext/WindowContext";
11
- import {Flex} from "../Layout/Flex";
12
- import {Grow} from "../Layout/Grow";
13
- import {faChevronRight} from "@fortawesome/free-solid-svg-icons";
14
- import {MenuCloseContextProvider, useMenuClose} from "./MenuCloseContext";
1
+ import { Block } from '@/Components/Layout/Block';
2
+ import { Clickable } from '@/Components/Clickable/Clickable';
3
+ import { Flex } from '@/Components/Layout/Flex';
4
+ import { Grow } from '@/Components/Layout/Grow';
5
+ import { Icon } from '@/Components/Icon/Icon';
6
+ import { MenuCloseContextProvider, useMenuClose } from '@/Components/Menu/MenuCloseContext';
7
+ import { Text } from '@/Components/Text/Text';
8
+ import { faChevronRight } from '@fortawesome/free-solid-svg-icons';
9
+ import { useWindow } from '@/WindowContext/WindowContext';
10
+ import { withMemo } from '@/helper/withMemo';
11
+ import React, { useCallback, useRef, useState } from 'react';
12
+ import classNames from 'classnames';
13
+ import styles from '@/Components/Menu/menu.module.scss';
14
+ import type { IconSource } from '@/Components/Icon/Icon';
15
+ import type { RbmComponentProps, WithNoStringAndChildrenProps } from '@/Components/RbmComponentProps';
15
16
 
16
- export type SubmenuProps = RbmComponentProps<{
17
- label: string, icon?: IconSource;
18
- iconColor?: string;
19
- disabled?: boolean;
20
- onMouseEnter?: () => void;
21
- onMouseLeave?: () => void;
22
- }, WithNoStringAndChildrenProps>;
17
+ export type SubmenuProps = RbmComponentProps<
18
+ {
19
+ label: string;
20
+ icon?: IconSource;
21
+ iconColor?: string;
22
+ disabled?: boolean;
23
+ onMouseEnter?: () => void;
24
+ onMouseLeave?: () => void;
25
+ },
26
+ WithNoStringAndChildrenProps
27
+ >;
23
28
 
24
29
  export const Submenu = withMemo(function Submenu({
25
- children,
26
- label,
27
- icon,
28
- iconColor,
29
- className,
30
- style,
31
- disabled = false,
32
- onMouseEnter,
33
- onMouseLeave,
34
- }: SubmenuProps) {
30
+ children,
31
+ label,
32
+ icon,
33
+ iconColor,
34
+ className,
35
+ style,
36
+ disabled = false,
37
+ onMouseEnter,
38
+ onMouseLeave,
39
+ }: SubmenuProps) {
35
40
  // Refs
36
41
 
37
42
  // States/Variables/Selectors
@@ -50,11 +55,11 @@ export const Submenu = withMemo(function Submenu({
50
55
  if (!submenuRef.current || !containerRef.current) {
51
56
  return;
52
57
  }
53
- const {width, height} = getComputedStyle(containerRef.current);
54
- const {right, top} = submenuRef.current.getBoundingClientRect();
58
+ const { width, height } = getComputedStyle(containerRef.current);
59
+ const { right, top } = submenuRef.current.getBoundingClientRect();
55
60
 
56
- setOpenLeft(right + parseFloat(width) >= (window?.innerWidth ?? 0));
57
- setOpenTop(top + parseFloat(height) >= (window?.innerHeight ?? 0));
61
+ setOpenLeft(right + Number.parseFloat(width) >= (window?.innerWidth ?? 0));
62
+ setOpenTop(top + Number.parseFloat(height) >= (window?.innerHeight ?? 0));
58
63
  setIsOpen(true);
59
64
  onMouseEnter?.();
60
65
  }, [onMouseEnter, window?.innerHeight, window?.innerWidth]);
@@ -76,26 +81,35 @@ export const Submenu = withMemo(function Submenu({
76
81
 
77
82
  // RenderFunctions
78
83
 
79
- return <MenuCloseContextProvider value={closeAllMenus}>
80
- <Clickable
81
- onMouseEnter={recalculateSubmenuPosition}
82
- onMouseLeave={closeSubmenu}
83
- className={classNames(styles.item, styles.submenu, {
84
- [styles.open]: isOpen,
85
- [styles.openLeft]: openLeft,
86
- [styles.openTop]: openTop,
87
- [styles.disabled]: disabled
88
- }, className)}
89
- style={style}
90
- >
91
- <Flex ref={submenuRef} className={classNames(styles.itemChildren)} horizontal={true}>
92
- {!!icon && <Icon icon={icon} color={iconColor} className={styles.icon}/>}
93
- <Grow><Text>{label}</Text></Grow>
94
- <Icon icon={faChevronRight}/>
95
- </Flex>
96
- <Block className={styles.container} __allowChildren="all" ref={containerRef}>
97
- {children}
98
- </Block>
99
- </Clickable>
100
- </MenuCloseContextProvider>;
101
- }, styles);
84
+ return (
85
+ <MenuCloseContextProvider value={closeAllMenus}>
86
+ <Clickable
87
+ onMouseEnter={recalculateSubmenuPosition}
88
+ onMouseLeave={closeSubmenu}
89
+ className={classNames(
90
+ styles.item,
91
+ styles.submenu,
92
+ {
93
+ [styles.open]: isOpen,
94
+ [styles.openLeft]: openLeft,
95
+ [styles.openTop]: openTop,
96
+ [styles.disabled]: disabled,
97
+ },
98
+ className,
99
+ )}
100
+ style={style}
101
+ >
102
+ <Flex ref={submenuRef} className={classNames(styles.itemChildren)} horizontal={true}>
103
+ {!!icon && <Icon icon={icon} color={iconColor} className={styles.icon} />}
104
+ <Grow>
105
+ <Text>{label}</Text>
106
+ </Grow>
107
+ <Icon icon={faChevronRight} />
108
+ </Flex>
109
+ <Block className={styles.container} __allowChildren="all" ref={containerRef}>
110
+ {children}
111
+ </Block>
112
+ </Clickable>
113
+ </MenuCloseContextProvider>
114
+ );
115
+ });
@@ -1,9 +1,23 @@
1
+ @use "../../scss/vars" as *;
2
+
3
+ @include vars {
4
+ --menu-background: var(--foreground-primary);
5
+ --menu-border-color: var(--border-light);
6
+ --menu-divider-color: var(--border-light);
7
+ --menu-item-active-background: var(--foreground-tertiary);
8
+ --menu-item-hover-background: var(--foreground-secondary);
9
+ --submenu-background: var(--foreground-primary);
10
+ --submenu-border-color: var(--border-light);
11
+ --menu-z-index: 1002;
12
+ --submenu-z-index: 10;
13
+ }
14
+
1
15
  .menu {
2
16
  position: fixed;
3
- background: #ffffff;
4
- border: 1px solid var(--border-light);
17
+ background: var(--menu-background);
18
+ border: 1px solid var(--menu-border-color);
5
19
  border-radius: 2px;
6
- z-index: 1002;
20
+ z-index: var(--menu-z-index);
7
21
 
8
22
  &.hidden {
9
23
  visibility: hidden;
@@ -15,16 +29,15 @@
15
29
  margin-right: 4px;
16
30
  padding-top: 1px;
17
31
  margin-top: 1px;
18
- border-top: 1px solid var(--border-light);
32
+ border-top: 1px solid var(--menu-divider-color);
19
33
  }
20
34
 
21
35
  .item {
22
36
  padding: 0 4px;
23
37
  display: flex;
24
- //background: #ffffff;
25
38
 
26
39
  &.active {
27
- background-color: #e1e1e1;
40
+ background: var(--menu-item-active-background);
28
41
  }
29
42
 
30
43
  .itemChildren {
@@ -33,7 +46,6 @@
33
46
  display: flex;
34
47
  flex-direction: row;
35
48
  align-items: center;
36
- //border-top: 1px solid var(--border-light);
37
49
  white-space: nowrap;
38
50
 
39
51
  .icon {
@@ -51,7 +63,7 @@
51
63
  }
52
64
 
53
65
  &:hover {
54
- background-color: #f5f5f5;
66
+ background-color: var(--menu-item-hover-background);
55
67
  }
56
68
 
57
69
  &:first-child > .itemChildren {
@@ -85,10 +97,10 @@
85
97
  position: absolute;
86
98
  top: 3px;
87
99
  left: calc(100% - 3px);
88
- background: #ffffff;
89
- border: 1px solid var(--border-light);
100
+ background: var(--submenu-background);
101
+ border: 1px solid var(--submenu-border-color);
90
102
  border-radius: 2px;
91
- z-index: 10;
103
+ z-index: var(--submenu-z-index);
92
104
  }
93
105
 
94
106
  &.openLeft .container {
@@ -1,5 +1,6 @@
1
- import { useCallback, useState, MouseEvent } from 'react';
2
- import { MenuProps } from './Menu';
1
+ import { useCallback, useState } from 'react';
2
+ import type { MenuProps } from '@/Components/Menu/Menu';
3
+ import type { MouseEvent } from 'react';
3
4
 
4
5
  export function useMenu() {
5
6
  const [isOpen, setIsOpen] = useState(false);
@@ -9,7 +10,7 @@ export function useMenu() {
9
10
  setIsOpen(true);
10
11
  }, []);
11
12
 
12
- const props: Omit<MenuProps, 'items'|"children"> = {
13
+ const props: Omit<MenuProps, 'items' | 'children'> = {
13
14
  isOpen,
14
15
  x: position.x,
15
16
  y: position.y,
@@ -1,6 +1,6 @@
1
- import { CSSProperties, ReactNode } from 'react';
2
- import { Recursive } from '../TypeHelpers';
3
- import { JSX } from "react/jsx-runtime";
1
+ import type { CSSProperties, ReactNode } from 'react';
2
+ import type { JSX } from 'react/jsx-runtime';
3
+ import type { Recursive } from '@/TypeHelpers';
4
4
 
5
5
  export type RbmChildWithoutString = Recursive<JSX.Element | undefined | null | RbmChildWithoutString[]> | false;
6
6
  export type WithNoStringProps =
@@ -27,10 +27,9 @@ export type WithStringProps = {
27
27
  children?: Recursive<string>;
28
28
  };
29
29
 
30
- export type WithChildren =
31
- | {
32
- children: ReactNode
33
- __allowChildren?: "text"|"all"|"html";
30
+ export type WithChildren = {
31
+ children: ReactNode;
32
+ __allowChildren?: 'text' | 'all' | 'html';
34
33
  };
35
34
 
36
35
  export type WithStringAndChildrenProps = {
@@ -1,8 +1,8 @@
1
1
  import * as React from 'react';
2
- import { withMemo } from '../../helper/withMemo';
3
- import { WithNoStringAndChildrenProps } from '../RbmComponentProps';
4
- import { InlineBlock } from '../Layout/InlineBlock';
2
+ import { InlineBlock } from '@/Components/Layout/InlineBlock';
5
3
  import { useEffect, useRef } from 'react';
4
+ import { withMemo } from '@/helper/withMemo';
5
+ import type { WithNoStringAndChildrenProps } from '@/Components/RbmComponentProps';
6
6
 
7
7
  export type SizeCalculatorProps = {
8
8
  onSize: (width: number, height: number) => void;
@@ -0,0 +1,21 @@
1
+ import { Spoiler } from '@/Components/SpoilerList/Spoiler/Spoiler';
2
+ import type { Meta, StoryObj } from '@storybook/react-vite';
3
+
4
+ const meta = {
5
+ component: Spoiler,
6
+ } satisfies Meta<typeof Spoiler>;
7
+
8
+ export default meta;
9
+
10
+ type Story = StoryObj<typeof meta>;
11
+
12
+ export const Default: Story = {
13
+ args: {
14
+ initialOpen: false,
15
+ noClosingAnimation: false,
16
+ noAnimation: false,
17
+ onlyTitleToggles: false,
18
+ title: 'Spoiler Title',
19
+ children: 'Some hidden Children',
20
+ },
21
+ };
@@ -1,17 +1,20 @@
1
1
  import * as React from 'react';
2
- import { withMemo } from '../../../helper/withMemo';
3
- import { RbmComponentProps } from '../../RbmComponentProps';
4
- import { MouseEvent, ReactNode, useCallback, useEffect, useRef, useState } from 'react';
5
- import { Flex } from '../../Layout/Flex';
6
- import { Grow } from '../../Layout/Grow';
7
- import { Text, TEXT_SIZE } from '../../Text/Text';
8
- import { Block } from '../../Layout/Block';
9
- import { Clickable } from '../../Clickable/Clickable';
10
- import styles from './spoiler.scss';
11
- import classNames from 'classnames';
12
- import { OptionalListener, useListener } from '../../Hooks/useListener';
13
- import { Icon, IconSource } from '../../Icon/Icon';
2
+ import { Block } from '@/Components/Layout/Block';
3
+ import { Clickable } from '@/Components/Clickable/Clickable';
4
+ import { Flex } from '@/Components/Layout/Flex';
5
+ import { Grow } from '@/Components/Layout/Grow';
6
+ import { Icon } from '@/Components/Icon/Icon';
7
+ import { TEXT_SIZE, Text } from '@/Components/Text/Text';
14
8
  import { faChevronDown, faChevronUp } from '@fortawesome/free-solid-svg-icons';
9
+ import { useCallback, useEffect, useRef, useState } from 'react';
10
+ import { useListener } from '@/Components/Hooks/useListener';
11
+ import { withMemo } from '@/helper/withMemo';
12
+ import classNames from 'classnames';
13
+ import styles from '@/Components/SpoilerList/Spoiler/spoiler.module.scss';
14
+ import type { IconSource } from '@/Components/Icon/Icon';
15
+ import type { MouseEvent, ReactNode } from 'react';
16
+ import type { OptionalListener } from '@/Components/Hooks/useListener';
17
+ import type { RbmComponentProps, WithChildren } from '@/Components/RbmComponentProps';
15
18
 
16
19
  export type SpoilerProps<OnClickData> = RbmComponentProps<
17
20
  {
@@ -23,23 +26,24 @@ export type SpoilerProps<OnClickData> = RbmComponentProps<
23
26
  noAnimation?: boolean;
24
27
  openIcon?: IconSource | null;
25
28
  closeIcon?: IconSource | null;
26
- } & OptionalListener<'onClick', OnClickData>
29
+ } & OptionalListener<'onClick', OnClickData>,
30
+ WithChildren
27
31
  >;
28
32
 
29
- function Spoiler<OnClickData>({
30
- title,
31
- children,
32
- initialOpen = false,
33
- noClosingAnimation = false,
34
- noAnimation = false,
35
- openIcon = faChevronDown,
36
- closeIcon = faChevronUp,
37
- className,
38
- onlyTitleToggles = false,
39
- style,
40
- open,
41
- ...listenerProps
42
- }: SpoilerProps<OnClickData>) {
33
+ export const Spoiler = withMemo(function Spoiler<OnClickData>({
34
+ title,
35
+ children,
36
+ initialOpen = false,
37
+ noClosingAnimation = false,
38
+ noAnimation = false,
39
+ openIcon = faChevronDown,
40
+ closeIcon = faChevronUp,
41
+ className,
42
+ onlyTitleToggles = false,
43
+ style,
44
+ open,
45
+ ...listenerProps
46
+ }: SpoilerProps<OnClickData>) {
43
47
  // Variables
44
48
 
45
49
  // Refs
@@ -54,19 +58,20 @@ function Spoiler<OnClickData>({
54
58
  // Callbacks
55
59
  const onClickListener = useListener<'onClick', OnClickData, boolean>('onClick', listenerProps);
56
60
 
57
- const toggleOpen = useCallback((ev: MouseEvent) => {
58
- console.log("LOG-d target", ev.target);
59
- if (open !== undefined) {
60
- onClickListener?.(!open);
61
- } else {
62
- setIsInitialValue(false);
63
- setIsOpen((old) => {
64
- console.log("LOG-d toggleOpen", !old);
65
- onClickListener?.(!old);
66
- return !old;
67
- });
68
- }
69
- }, [onClickListener, open]);
61
+ const toggleOpen = useCallback(
62
+ (ev: MouseEvent) => {
63
+ if (open !== undefined) {
64
+ onClickListener?.(!open);
65
+ } else {
66
+ setIsInitialValue(false);
67
+ setIsOpen((old) => {
68
+ onClickListener?.(!old);
69
+ return !old;
70
+ });
71
+ }
72
+ },
73
+ [onClickListener, open],
74
+ );
70
75
 
71
76
  // Effects
72
77
  useEffect(() => {
@@ -80,11 +85,11 @@ function Spoiler<OnClickData>({
80
85
  typeof title === 'string' || typeof title === 'number' ? <Text size={TEXT_SIZE.large}>{title}</Text> : title;
81
86
 
82
87
  // Render Functions
83
- const icon = open ?? isOpen ? closeIcon : openIcon;
88
+ const icon = (open ?? isOpen) ? closeIcon : openIcon;
84
89
 
85
90
  return (
86
91
  <Clickable
87
- onClick={onlyTitleToggles ? undefined: toggleOpen}
92
+ onClick={onlyTitleToggles ? undefined : toggleOpen}
88
93
  className={classNames(className, styles.spoiler, {
89
94
  [styles.open]: open ?? isOpen,
90
95
  [styles.noAnimation]: isInitialValue || noAnimation,
@@ -95,7 +100,7 @@ function Spoiler<OnClickData>({
95
100
  <Clickable onClick={toggleOpen}>
96
101
  <Flex horizontal={true}>
97
102
  <Grow __allowChildren="all">{titleComponent}</Grow>
98
- {icon ? <Icon icon={icon} className={styles.icon}/> : null}
103
+ {icon ? <Icon icon={icon} className={styles.icon} /> : null}
99
104
  </Flex>
100
105
  </Clickable>
101
106
  <Block className={styles.bodyContainer}>
@@ -105,8 +110,4 @@ function Spoiler<OnClickData>({
105
110
  </Block>
106
111
  </Clickable>
107
112
  );
108
- }
109
-
110
- // Need SpoilerMemo for autocompletion of phpstorm
111
- const SpoilerMemo = withMemo(Spoiler, styles, "all");
112
- export { SpoilerMemo as Spoiler };
113
+ }, 'all');
@@ -1,10 +1,20 @@
1
+ @use "../../../scss/vars" as *;
2
+
3
+ @include vars {
4
+ --spoiler-border-color: var(--border-light);
5
+ --spoiler-border-top-color: var(--spoiler-border-color);
6
+ --spoiler-border-bottom-color: var(--spoiler-border-color);
7
+ }
8
+
1
9
  @keyframes spoilerContainerOpen {
2
10
  0% {
3
11
  height: 0;
4
12
  }
13
+
5
14
  1% {
6
15
  height: initial;
7
16
  }
17
+
8
18
  100% {
9
19
  height: initial;
10
20
  }
@@ -16,14 +26,16 @@
16
26
  transform: translateY(-100%);
17
27
  opacity: 0;
18
28
  }
29
+
19
30
  1% {
20
31
  height: initial;
21
32
  transform: translateY(-100%);
22
33
  opacity: 0;
23
34
  }
35
+
24
36
  100% {
25
37
  height: initial;
26
- transform: none !important;
38
+ transform: none;
27
39
  opacity: 1;
28
40
  }
29
41
  }
@@ -32,9 +44,11 @@
32
44
  0% {
33
45
  height: initial;
34
46
  }
47
+
35
48
  99% {
36
49
  height: initial;
37
50
  }
51
+
38
52
  100% {
39
53
  height: 0;
40
54
  }
@@ -46,11 +60,13 @@
46
60
  transform: translateY(0%);
47
61
  opacity: 1;
48
62
  }
63
+
49
64
  99% {
50
65
  height: initial;
51
66
  transform: translateY(-100%);
52
67
  opacity: 0;
53
68
  }
69
+
54
70
  100% {
55
71
  height: 0;
56
72
  transform: translateY(-100%);
@@ -60,22 +76,37 @@
60
76
 
61
77
  .spoiler {
62
78
  display: block;
63
- border-top: 1px solid var(--border-strong);
64
- border-bottom: 1px solid var(--border-strong);
79
+ border-top: 1px solid var(--spoiler-border-top-color);
80
+ border-bottom: 1px solid var(--spoiler-border-bottom-color);
65
81
 
66
82
  .icon {
67
83
  margin-right: 0.5rem;
68
84
  }
69
85
 
70
- &.open, &.open.noClosingAnimation {
86
+ .bodyContainer {
87
+ height: 0;
88
+ overflow: hidden;
89
+ animation-name: spoilerContainerClose;
90
+ animation-duration: 0.7s;
91
+ animation-fill-mode: forwards;
92
+
93
+ .body {
94
+ height: 0;
95
+ overflow: hidden;
96
+ transform-origin: left top;
97
+ transform: translateY(-100%);
98
+ animation-name: spoilerClose;
99
+ animation-duration: 0.7s;
100
+ animation-fill-mode: forwards;
101
+ }
102
+ }
103
+
104
+ &.noClosingAnimation {
71
105
  .bodyContainer {
72
- height: initial;
73
- animation-name: spoilerContainerOpen;
106
+ animation-name: none;
74
107
 
75
108
  .body {
76
- height: initial;
77
- transform: none;
78
- animation-name: spoilerOpen;
109
+ animation-name: none;
79
110
  }
80
111
  }
81
112
  }
@@ -90,31 +121,16 @@
90
121
  }
91
122
  }
92
123
 
93
- &.noClosingAnimation {
124
+ &.open, &.open.noClosingAnimation {
94
125
  .bodyContainer {
95
- animation-name: none;
126
+ height: initial;
127
+ animation-name: spoilerContainerOpen;
96
128
 
97
129
  .body {
98
- animation-name: none;
130
+ height: initial;
131
+ transform: none;
132
+ animation-name: spoilerOpen;
99
133
  }
100
134
  }
101
135
  }
102
-
103
- .bodyContainer {
104
- height: 0;
105
- overflow: hidden;
106
- animation-name: spoilerContainerClose;
107
- animation-duration: 0.7s;
108
- animation-fill-mode: forwards;
109
-
110
- .body {
111
- height: 0;
112
- overflow: hidden;
113
- transform-origin: left top;
114
- transform: translateY(-100%);
115
- animation-name: spoilerClose;
116
- animation-duration: 0.7s;
117
- animation-fill-mode: forwards;
118
- }
119
- }
120
136
  }
@@ -1,11 +1,11 @@
1
1
  import * as React from 'react';
2
- import { withMemo } from '../../helper/withMemo';
3
- import { ReactElement } from 'react';
4
- import { RbmComponentProps, WithNoChildren } from '../RbmComponentProps';
5
- import { Block } from '../Layout/Block';
2
+ import { Block } from '@/Components/Layout/Block';
3
+ import { Spoiler } from '@/Components/SpoilerList/Spoiler/Spoiler';
4
+ import { useSpoilerGroup } from '@/Components/SpoilerList/useSpoilerGroup';
5
+ import { withMemo } from '@/helper/withMemo';
6
6
  import classNames from 'classnames';
7
- import { Spoiler } from './Spoiler/Spoiler';
8
- import { useSpoilerGroup } from './useSpoilerGroup';
7
+ import type { RbmComponentProps, WithNoChildren } from '@/Components/RbmComponentProps';
8
+ import type { ReactElement } from 'react';
9
9
 
10
10
  export type SpoilerItem<BodyData, TitleData = string> = {
11
11
  title: TitleData;
@@ -24,7 +24,7 @@ export type SpoilerListProps<BodyData, TitleData = string> = RbmComponentProps<
24
24
 
25
25
  const stringIdentity = (data: any) => data as string;
26
26
 
27
- function SpoilerList<BodyData, TitleData = string>({
27
+ export const SpoilerList = withMemo(function SpoilerList<BodyData, TitleData = string>({
28
28
  data,
29
29
  renderBody,
30
30
  renderTitle = stringIdentity,
@@ -56,8 +56,4 @@ function SpoilerList<BodyData, TitleData = string>({
56
56
  ))}
57
57
  </Block>
58
58
  );
59
- }
60
-
61
- // Need SpoilerListMemo for autocompletion of phpstorm
62
- const SpoilerListMemo = withMemo(SpoilerList);
63
- export { SpoilerListMemo as SpoilerList };
59
+ });