@ainias42/react-bootstrap-mobile 1.0.1 → 1.0.3
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.
- package/.ctirc +114 -0
- package/.prettierrc +1 -5
- package/.storybook/main.ts +31 -0
- package/.storybook/preview.ts +36 -0
- package/bin/release.sh +1 -37
- package/bin/updatePackages.sh +3 -0
- package/dist/{src/Components → Components}/ActionSheet/ActionSheet.d.ts +5 -5
- package/dist/Components/ActionSheet/ActionSheet.stories.d.ts +9 -0
- package/dist/Components/Card/Card.d.ts +12 -0
- package/dist/Components/Card/Card.stories.d.ts +16 -0
- package/dist/{src/Components → Components}/Clickable/Clickable.d.ts +3 -3
- package/dist/Components/Colors.stories.d.ts +5 -0
- package/dist/Components/Dialog/AlertDialog.d.ts +8 -0
- package/dist/Components/Dialog/AlertDialog.stories.d.ts +14 -0
- package/dist/{src/Components → Components}/Dialog/ButtonDialog.d.ts +3 -3
- package/dist/Components/Dialog/ConfirmDialog.d.ts +9 -0
- package/dist/Components/Dialog/ConfirmDialog.stories.d.ts +15 -0
- package/dist/{src/Components → Components}/Dialog/Dialog.d.ts +2 -2
- package/dist/{src/Components → Components}/Dialog/DialogBackground.d.ts +2 -2
- package/dist/{src/Components → Components}/Dialog/DialogContainer.d.ts +3 -3
- package/dist/{src/Components → Components}/Dialog/DialogContext.d.ts +3 -2
- package/dist/{src/Components → Components}/DragAndDrop/DragItem.d.ts +2 -2
- package/dist/{src/Components → Components}/DragAndDrop/DropArea.d.ts +2 -2
- package/dist/{src/Components → Components}/FormElements/Button/Button.d.ts +8 -8
- package/dist/Components/FormElements/Button/Button.stories.d.ts +43 -0
- package/dist/Components/FormElements/CheckBox/Checkbox.d.ts +12 -0
- package/dist/Components/FormElements/CheckBox/Checkbox.stories.d.ts +17 -0
- package/dist/{src/Components → Components}/FormElements/ColorInput/ColorInput.d.ts +3 -5
- package/dist/Components/FormElements/ColorInput/ColorInput.stories.d.ts +8 -0
- package/dist/{src/Components → Components}/FormElements/Controller/ColorInputController.d.ts +1 -1
- package/dist/{src/Components → Components}/FormElements/Controller/FileInputController.d.ts +4 -4
- package/dist/Components/FormElements/Controller/HookForm.d.ts +15 -0
- package/dist/{src/Components → Components}/FormElements/Controller/InputController.d.ts +1 -1
- package/dist/{src/Components → Components}/FormElements/Controller/MultipleFileInputController.d.ts +1 -1
- package/dist/{src/Components → Components}/FormElements/Controller/PasswordInputController.d.ts +1 -1
- package/dist/{src/Components → Components}/FormElements/Controller/SelectController.d.ts +1 -1
- package/dist/Components/FormElements/Controller/SliderController.d.ts +5 -0
- package/dist/{src/Components → Components}/FormElements/Controller/SwitchController.d.ts +1 -1
- package/dist/{src/Components → Components}/FormElements/Controller/TextareaController.d.ts +1 -1
- package/dist/{src/Components → Components}/FormElements/Controller/useYupResolver.d.ts +1 -1
- package/dist/{src/Components → Components}/FormElements/Controller/withHookController.d.ts +3 -2
- package/dist/Components/FormElements/Error/FormError.d.ts +6 -0
- package/dist/Components/FormElements/Error/FormError.stories.d.ts +7 -0
- package/dist/Components/FormElements/Form.stories.d.ts +7 -0
- package/dist/Components/FormElements/Input/FileInput/FileInput.d.ts +13 -0
- package/dist/{src/Components → Components}/FormElements/Input/FileInput/MultipleFileInput.d.ts +6 -6
- package/dist/Components/FormElements/Input/HiddenInput.d.ts +6 -0
- package/dist/Components/FormElements/Input/HiddenInput.stories.d.ts +9 -0
- package/dist/{src/Components → Components}/FormElements/Input/Input.d.ts +4 -4
- package/dist/Components/FormElements/Input/Input.stories.d.ts +18 -0
- package/dist/{src/Components → Components}/FormElements/Input/PasswordInput/PasswordInput.d.ts +5 -4
- package/dist/Components/FormElements/Input/PasswordInput/PasswordInput.stories.d.ts +8 -0
- package/dist/{src/Components → Components}/FormElements/SearchSelectInput/SearchSelectInput.d.ts +4 -4
- package/dist/Components/FormElements/SearchSelectInput/SearchSelectInput.stories.d.ts +9 -0
- package/dist/{src/Components → Components}/FormElements/Select/Select.d.ts +4 -4
- package/dist/Components/FormElements/Select/Select.stories.d.ts +8 -0
- package/dist/{src/Components → Components}/FormElements/Slider/Slider.d.ts +4 -4
- package/dist/Components/FormElements/Slider/Slider.stories.d.ts +7 -0
- package/dist/{src/Components → Components}/FormElements/Switch/Switch.d.ts +5 -5
- package/dist/Components/FormElements/Switch/Switch.stories.d.ts +11 -0
- package/dist/{src/Components → Components}/FormElements/Textarea/Textarea.d.ts +4 -4
- package/dist/Components/FormElements/Textarea/Textarea.stories.d.ts +9 -0
- package/dist/{src/Components → Components}/FormElements/hooks/useOnChangeDone.d.ts +1 -1
- package/dist/{src/Components → Components}/FullScreen/FullScreen.d.ts +4 -4
- package/dist/{src/Components → Components}/Hooks/useClientLayoutEffect.d.ts +1 -1
- package/dist/{src/Components → Components}/Hooks/useComposedRef.d.ts +1 -1
- package/dist/{src/Components → Components}/Hooks/useDelayedState.d.ts +1 -1
- package/dist/{src/Components → Components}/Hooks/useInViewport.d.ts +1 -1
- package/dist/{src/Components → Components}/Icon/DoubleIcon.d.ts +1 -1
- package/dist/Components/Icon/DoubleIcon.stories.d.ts +23 -0
- package/dist/{src/Components → Components}/Icon/Icon.d.ts +5 -5
- package/dist/Components/Icon/Icon.stories.d.ts +17 -0
- package/dist/Components/Image/Image.d.ts +10 -0
- package/dist/Components/Image/Image.stories.d.ts +7 -0
- package/dist/{src/Components → Components}/InViewport/InViewport.d.ts +1 -1
- package/dist/{src/Components → Components}/Layout/Block.d.ts +4 -4
- package/dist/{src/Components → Components}/Layout/Container.d.ts +1 -1
- package/dist/{src/Components → Components}/Layout/Flex.d.ts +3 -3
- package/dist/{src/Components → Components}/Layout/Grid/Grid.d.ts +3 -3
- package/dist/{src/Components → Components}/Layout/Grid/GridItem.d.ts +1 -1
- package/dist/Components/Layout/Grow.d.ts +10 -0
- package/dist/{src/Components → Components}/Layout/Inline.d.ts +3 -3
- package/dist/{src/Components → Components}/Layout/InlineBlock.d.ts +3 -3
- package/dist/{src/Components → Components}/Layout/View.d.ts +4 -4
- package/dist/{src/Components → Components}/Layout/ViewWithoutListeners.d.ts +3 -3
- package/dist/Components/LoadingArea/LoadingArea.d.ts +9 -0
- package/dist/Components/LoadingArea/LoadingArea.stories.d.ts +9 -0
- package/dist/Components/LoadingCircle/LoadingCircle.d.ts +7 -0
- package/dist/Components/LoadingCircle/LoadingCircle.stories.d.ts +26 -0
- package/dist/{src/Components → Components}/Menu/HoverMenu.d.ts +3 -3
- package/dist/Components/Menu/HoverMenu.stories.d.ts +16 -0
- package/dist/{src/Components → Components}/Menu/Menu.d.ts +2 -2
- package/dist/Components/Menu/Menu.stories.d.ts +14 -0
- package/dist/{src/Components → Components}/Menu/MenuCloseContext.d.ts +1 -1
- package/dist/{src/Components → Components}/Menu/MenuDivider.d.ts +1 -1
- package/dist/{src/Components → Components}/Menu/MenuItem.d.ts +4 -3
- package/dist/Components/Menu/MenuItem.stories.d.ts +21 -0
- package/dist/{src/Components → Components}/Menu/Submenu.d.ts +3 -3
- package/dist/Components/Menu/Submenu.stories.d.ts +10 -0
- package/dist/{src/Components → Components}/Menu/useMenu.d.ts +2 -2
- package/dist/{src/Components → Components}/RbmComponentProps.d.ts +4 -4
- package/dist/{src/Components → Components}/SizeCalculator/SizeCalculator.d.ts +1 -1
- package/dist/Components/SpoilerList/Spoiler/Spoiler.d.ts +16 -0
- package/dist/Components/SpoilerList/Spoiler/Spoiler.stories.d.ts +7 -0
- package/dist/{src/Components → Components}/SpoilerList/SpoilerList.d.ts +3 -5
- package/dist/{src/Components → Components}/TabBar/TabBar.d.ts +4 -6
- package/dist/Components/TabBar/TabBar.stories.d.ts +10 -0
- package/dist/Components/TabBar/TabBarButton.d.ts +7 -0
- package/dist/{src/Components → Components}/Table/Table.d.ts +3 -3
- package/dist/{src/Components → Components}/Text/Heading.d.ts +2 -2
- package/dist/{src/Components → Components}/Text/Text.d.ts +3 -3
- package/dist/Components/Text/Text.stories.d.ts +35 -0
- package/dist/Components/Toast/Toast.d.ts +12 -0
- package/dist/Components/Toast/Toast.stories.d.ts +8 -0
- package/dist/{src/Components → Components}/Toast/ToastContainer.d.ts +2 -2
- package/dist/Components/TopBar/MoreButton.d.ts +7 -0
- package/dist/{src/Components → Components}/TopBar/TopBar.d.ts +4 -6
- package/dist/Components/TopBar/TopBar.stories.d.ts +7 -0
- package/dist/Components/TopBar/TopBarButton.d.ts +7 -0
- package/dist/helper/useDeepShallow.d.ts +1 -0
- package/dist/helper/withMemo.d.ts +3 -0
- package/dist/{src/helper → helper}/withRenderBrowserOnly.d.ts +1 -1
- package/dist/helper/withRestrictedChildren.d.ts +7 -0
- package/dist/index.css +36 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.ts +116 -0
- package/dist/index.js +5357 -0
- package/dist/index.js.map +1 -0
- package/dist/treeshakeTest.d.ts +1 -0
- package/eslint.config.js +17 -0
- package/package.json +41 -90
- package/react-bootstrap-mobile.scss +6 -6
- package/src/Components/ActionSheet/ActionSheet.stories.tsx +55 -0
- package/src/Components/ActionSheet/ActionSheet.tsx +37 -24
- package/src/Components/ActionSheet/actionSheet.module.scss +198 -0
- package/src/Components/Card/Card.stories.tsx +41 -0
- package/src/Components/Card/Card.tsx +6 -9
- package/src/Components/Card/card.module.scss +74 -0
- package/src/Components/Clickable/Clickable.tsx +73 -63
- package/src/Components/Clickable/clickable.module.scss +14 -0
- package/src/Components/Colors.stories.tsx +77 -0
- package/src/Components/Dialog/AlertDialog.stories.tsx +28 -0
- package/src/Components/Dialog/AlertDialog.tsx +10 -9
- package/src/Components/Dialog/ButtonDialog.tsx +15 -13
- package/src/Components/Dialog/ConfirmDialog.stories.tsx +29 -0
- package/src/Components/Dialog/ConfirmDialog.tsx +11 -9
- package/src/Components/Dialog/Dialog.tsx +10 -10
- package/src/Components/Dialog/DialogBackground.tsx +32 -21
- package/src/Components/Dialog/DialogContainer.tsx +23 -18
- package/src/Components/Dialog/DialogContext.ts +7 -6
- package/src/Components/Dialog/{buttonDialog.scss → buttonDialog.module.scss} +29 -21
- package/src/Components/Dialog/dialog.module.scss +30 -0
- package/src/Components/Dialog/dialogBackground.module.scss +17 -0
- package/src/Components/Dialog/useAlertDialog.ts +3 -3
- package/src/Components/Dialog/useConfirmDialog.ts +3 -3
- package/src/Components/DragAndDrop/DragItem.tsx +7 -6
- package/src/Components/DragAndDrop/DropArea.tsx +5 -4
- package/src/Components/Flavor.ts +4 -4
- package/src/Components/FormElements/Button/Button.stories.tsx +79 -0
- package/src/Components/FormElements/Button/Button.tsx +49 -36
- package/src/Components/FormElements/Button/ButtonType.ts +2 -2
- package/src/Components/FormElements/Button/button.module.scss +87 -0
- package/src/Components/FormElements/CheckBox/Checkbox.stories.tsx +50 -0
- package/src/Components/FormElements/CheckBox/Checkbox.tsx +13 -14
- package/src/Components/FormElements/CheckBox/{checkbox.scss → checkbox.module.scss} +30 -11
- package/src/Components/FormElements/ColorInput/ColorInput.stories.tsx +24 -0
- package/src/Components/FormElements/ColorInput/ColorInput.tsx +55 -59
- package/src/Components/FormElements/ColorInput/{colorInput.scss → colorInput.module.scss} +17 -19
- package/src/Components/FormElements/ColorInput/sharedSelectedColor.ts +19 -10
- package/src/Components/FormElements/Controller/ColorInputController.ts +3 -3
- package/src/Components/FormElements/Controller/FileInputController.tsx +29 -20
- package/src/Components/FormElements/Controller/HookForm.tsx +128 -24
- package/src/Components/FormElements/Controller/InputController.ts +3 -3
- package/src/Components/FormElements/Controller/MultipleFileInputController.ts +2 -3
- package/src/Components/FormElements/Controller/PasswordInputController.ts +3 -3
- package/src/Components/FormElements/Controller/SelectController.ts +3 -3
- package/src/Components/FormElements/Controller/SendFormContext.ts +3 -3
- package/src/Components/FormElements/Controller/SliderController.ts +4 -0
- package/src/Components/FormElements/Controller/SwitchController.ts +3 -3
- package/src/Components/FormElements/Controller/TextareaController.ts +2 -2
- package/src/Components/FormElements/Controller/useYupResolver.ts +10 -8
- package/src/Components/FormElements/Controller/withHookController.tsx +21 -18
- package/src/Components/FormElements/Error/FormError.stories.tsx +16 -0
- package/src/Components/FormElements/Error/FormError.tsx +42 -0
- package/src/Components/FormElements/Error/formError.module.scss +9 -0
- package/src/Components/FormElements/Form.stories.tsx +16 -0
- package/src/Components/FormElements/Input/FileInput/FileInput.tsx +52 -32
- package/src/Components/FormElements/Input/FileInput/MultipleFileInput.tsx +234 -231
- package/src/Components/FormElements/Input/FileInput/{fileInput.scss → fileInput.module.scss} +10 -12
- package/src/Components/FormElements/Input/HiddenInput.stories.tsx +44 -0
- package/src/Components/FormElements/Input/HiddenInput.tsx +6 -8
- package/src/Components/FormElements/Input/Input.stories.tsx +59 -0
- package/src/Components/FormElements/Input/Input.tsx +173 -172
- package/src/Components/FormElements/Input/PasswordInput/PasswordInput.stories.tsx +31 -0
- package/src/Components/FormElements/Input/PasswordInput/PasswordInput.tsx +20 -16
- package/src/Components/FormElements/Input/input.module.scss +95 -0
- package/src/Components/FormElements/SearchSelectInput/SearchSelectInput.stories.tsx +49 -0
- package/src/Components/FormElements/SearchSelectInput/SearchSelectInput.tsx +178 -166
- package/src/Components/FormElements/SearchSelectInput/seachSelectInput.module.scss +112 -0
- package/src/Components/FormElements/Select/Select.stories.tsx +49 -0
- package/src/Components/FormElements/Select/Select.tsx +34 -24
- package/src/Components/FormElements/Select/select.module.scss +63 -0
- package/src/Components/FormElements/Slider/Slider.stories.tsx +15 -0
- package/src/Components/FormElements/Slider/Slider.tsx +29 -20
- package/src/Components/FormElements/Slider/slider.module.scss +93 -0
- package/src/Components/FormElements/Switch/Switch.stories.tsx +65 -0
- package/src/Components/FormElements/Switch/Switch.tsx +72 -63
- package/src/Components/FormElements/Switch/switch.module.scss +157 -0
- package/src/Components/FormElements/Textarea/Textarea.stories.tsx +37 -0
- package/src/Components/FormElements/Textarea/Textarea.tsx +46 -45
- package/src/Components/FormElements/Textarea/textarea.module.scss +34 -0
- package/src/Components/FormElements/hooks/useOnChangeDone.ts +6 -2
- package/src/Components/FullScreen/FullScreen.tsx +16 -16
- package/src/Components/Hooks/useBreakpoint.ts +13 -7
- package/src/Components/Hooks/useClientLayoutEffect.ts +1 -1
- package/src/Components/Hooks/useComposedRef.ts +2 -1
- package/src/Components/Hooks/useDebounced.ts +2 -2
- package/src/Components/Hooks/useDelayed.ts +2 -3
- package/src/Components/Hooks/useDelayedEffect.ts +3 -3
- package/src/Components/Hooks/useDelayedState.ts +18 -10
- package/src/Components/Hooks/useInViewport.ts +3 -2
- package/src/Components/Hooks/useKeyListener.ts +9 -6
- package/src/Components/Hooks/useListener.ts +4 -4
- package/src/Components/Hooks/useMousePosition.ts +2 -2
- package/src/Components/Hooks/useRerender.ts +17 -14
- package/src/Components/Hooks/useWindowDimensions.ts +11 -12
- package/src/Components/Icon/DoubleIcon.stories.tsx +38 -0
- package/src/Components/Icon/DoubleIcon.tsx +22 -17
- package/src/Components/Icon/Icon.stories.tsx +37 -0
- package/src/Components/Icon/Icon.tsx +39 -17
- package/src/Components/Icon/{icon.scss → icon.module.scss} +2 -0
- package/src/Components/Image/Image.stories.tsx +17 -0
- package/src/Components/Image/Image.tsx +7 -12
- package/src/Components/InViewport/InViewport.tsx +5 -6
- package/src/Components/Layout/Block.tsx +18 -12
- package/src/Components/Layout/Container.tsx +5 -6
- package/src/Components/Layout/Flex.tsx +17 -9
- package/src/Components/Layout/Grid/Grid.tsx +20 -10
- package/src/Components/Layout/Grid/GridItem.tsx +5 -6
- package/src/Components/Layout/Grid/{grid.scss → grid.module.scss} +19 -26
- package/src/Components/Layout/Grow.tsx +18 -8
- package/src/Components/Layout/Inline.tsx +15 -12
- package/src/Components/Layout/InlineBlock.tsx +17 -12
- package/src/Components/Layout/View.tsx +20 -9
- package/src/Components/Layout/ViewWithoutListeners.tsx +24 -15
- package/src/Components/Layout/container.module.scss +54 -0
- package/src/Components/LoadingArea/LoadingArea.stories.tsx +35 -0
- package/src/Components/LoadingArea/LoadingArea.tsx +10 -15
- package/src/Components/LoadingArea/{loadingArea.scss → loadingArea.module.scss} +8 -5
- package/src/Components/LoadingCircle/LoadingCircle.stories.tsx +58 -0
- package/src/Components/LoadingCircle/LoadingCircle.tsx +26 -13
- package/src/Components/LoadingCircle/{loadingCircle.scss → loadingCircle.module.scss} +14 -5
- package/src/Components/Menu/HoverMenu.stories.tsx +32 -0
- package/src/Components/Menu/HoverMenu.tsx +61 -45
- package/src/Components/Menu/Menu.stories.tsx +69 -0
- package/src/Components/Menu/Menu.tsx +67 -58
- package/src/Components/Menu/MenuCloseContext.ts +1 -1
- package/src/Components/Menu/MenuDivider.tsx +6 -6
- package/src/Components/Menu/MenuItem.stories.tsx +35 -0
- package/src/Components/Menu/MenuItem.tsx +66 -55
- package/src/Components/Menu/Submenu.stories.tsx +37 -0
- package/src/Components/Menu/Submenu.tsx +72 -58
- package/src/Components/Menu/{menu.scss → menu.module.scss} +23 -11
- package/src/Components/Menu/useMenu.ts +4 -3
- package/src/Components/RbmComponentProps.ts +6 -7
- package/src/Components/SizeCalculator/SizeCalculator.tsx +3 -3
- package/src/Components/SpoilerList/Spoiler/Spoiler.stories.tsx +21 -0
- package/src/Components/SpoilerList/Spoiler/Spoiler.tsx +49 -48
- package/src/Components/SpoilerList/Spoiler/{spoiler.scss → spoiler.module.scss} +46 -30
- package/src/Components/SpoilerList/SpoilerList.tsx +8 -12
- package/src/Components/SpoilerList/useSpoilerGroup.ts +2 -2
- package/src/Components/TabBar/TabBar.stories.tsx +32 -0
- package/src/Components/TabBar/TabBar.tsx +16 -18
- package/src/Components/TabBar/TabBarButton.tsx +13 -10
- package/src/Components/TabBar/tabBar.module.scss +128 -0
- package/src/Components/Table/Table.tsx +16 -15
- package/src/Components/Text/Heading.tsx +6 -7
- package/src/Components/Text/Text.stories.tsx +121 -0
- package/src/Components/Text/Text.tsx +19 -10
- package/src/Components/Text/{text.scss → text.module.scss} +3 -8
- package/src/Components/Toast/Toast.stories.tsx +25 -0
- package/src/Components/Toast/Toast.tsx +15 -17
- package/src/Components/Toast/ToastContainer.tsx +72 -54
- package/src/Components/Toast/ToastContext.ts +9 -3
- package/src/Components/Toast/toast.module.scss +65 -0
- package/src/Components/TopBar/MoreButton.tsx +9 -11
- package/src/Components/TopBar/TopBar.stories.tsx +63 -0
- package/src/Components/TopBar/TopBar.tsx +49 -40
- package/src/Components/TopBar/TopBarButton.tsx +20 -10
- package/src/Components/TopBar/{topBar.scss → topBar.module.scss} +40 -23
- package/src/Size.ts +1 -2
- package/src/WrongChildError.ts +1 -1
- package/src/helper/EmptyProps.ts +1 -1
- package/src/helper/nonEmptyString.ts +1 -1
- package/src/helper/useDeepShallow.ts +10 -0
- package/src/helper/withMemo.ts +7 -8
- package/src/helper/withRenderBrowserOnly.tsx +2 -1
- package/src/helper/withRestrictedChildren.tsx +11 -14
- package/src/index.ts +116 -0
- package/src/scss/_colors.scss +32 -19
- package/src/scss/_default.scss +5 -5
- package/src/scss/_flavorMixin.scss +3 -0
- package/src/scss/_variables.scss +19 -19
- package/src/scss/_vars.scss +12 -0
- package/src/scss/baseClasses.module.scss +23 -0
- package/src/scss/breakpoints.scss +79 -0
- package/src/treeshakeTest.ts +3 -0
- package/src/types/{react-table-config.d.ts → reactTableConfig.d.ts} +2 -43
- package/stylelint.config.mjs +4 -0
- package/tsconfig.build.json +7 -0
- package/tsconfig.json +16 -48
- package/webpack.config.ts +6 -0
- package/.eslintrc.json +0 -191
- package/.npnignore +0 -5
- package/LICENSE +0 -21
- package/README.md +0 -1
- package/babel.config.js +0 -22
- package/bin/build.js +0 -60
- package/bin/updateCopies.js +0 -94
- package/bootstrapReactMobile.ts +0 -119
- package/dist/bootstrapReactMobile.d.ts +0 -119
- package/dist/bootstrapReactMobile.js +0 -14043
- package/dist/bootstrapReactMobile.js.map +0 -1
- package/dist/src/Components/Card/Card.d.ts +0 -14
- package/dist/src/Components/Dialog/AlertDialog.d.ts +0 -10
- package/dist/src/Components/Dialog/ConfirmDialog.d.ts +0 -11
- package/dist/src/Components/FormElements/CheckBox/Checkbox.d.ts +0 -14
- package/dist/src/Components/FormElements/Controller/HookForm.d.ts +0 -8
- package/dist/src/Components/FormElements/FormError.d.ts +0 -5
- package/dist/src/Components/FormElements/Input/FileInput/FileInput.d.ts +0 -13
- package/dist/src/Components/FormElements/Input/HiddenInput.d.ts +0 -8
- package/dist/src/Components/Image/Image.d.ts +0 -12
- package/dist/src/Components/Layout/Grow.d.ts +0 -9
- package/dist/src/Components/List/BulletList/BulletList.d.ts +0 -8
- package/dist/src/Components/List/BulletList/ListItem.d.ts +0 -7
- package/dist/src/Components/List/InfiniteList.d.ts +0 -7
- package/dist/src/Components/List/List.d.ts +0 -15
- package/dist/src/Components/LoadingArea/LoadingArea.d.ts +0 -12
- package/dist/src/Components/LoadingCircle/LoadingCircle.d.ts +0 -8
- package/dist/src/Components/SpoilerList/Spoiler/Spoiler.d.ts +0 -18
- package/dist/src/Components/TabBar/TabBarButton.d.ts +0 -9
- package/dist/src/Components/Toast/Toast.d.ts +0 -13
- package/dist/src/Components/TopBar/MoreButton.d.ts +0 -9
- package/dist/src/Components/TopBar/TopBarButton.d.ts +0 -9
- package/dist/src/ListRow/ListRow.d.ts +0 -1
- package/dist/src/StyleProvider.d.ts +0 -2
- package/dist/src/helper/withMemo.d.ts +0 -3
- package/dist/src/helper/withRestrictedChildren.d.ts +0 -6
- package/scripts/getPackageJson.js +0 -25
- package/src/Components/ActionSheet/actionSheet.scss +0 -153
- package/src/Components/Card/card.scss +0 -76
- package/src/Components/Clickable/clickable.scss +0 -8
- package/src/Components/Dialog/dialog.scss +0 -30
- package/src/Components/Dialog/dialogBackground.scss +0 -11
- package/src/Components/FormElements/Button/button.scss +0 -73
- package/src/Components/FormElements/FormError.tsx +0 -29
- package/src/Components/FormElements/Input/input.scss +0 -83
- package/src/Components/FormElements/SearchSelectInput/seachSelectInput.scss +0 -97
- package/src/Components/FormElements/Select/select.scss +0 -61
- package/src/Components/FormElements/Slider/slider.scss +0 -92
- package/src/Components/FormElements/Switch/switch.scss +0 -152
- package/src/Components/FormElements/Textarea/textarea.scss +0 -31
- package/src/Components/FormElements/formError.scss +0 -4
- package/src/Components/Layout/container.scss +0 -12
- package/src/Components/List/BulletList/BulletList.tsx +0 -33
- package/src/Components/List/BulletList/ListItem.tsx +0 -34
- package/src/Components/List/InfiniteList.tsx +0 -56
- package/src/Components/List/List.tsx +0 -95
- package/src/Components/List/list.scss +0 -30
- package/src/Components/TabBar/tabBar.scss +0 -108
- package/src/Components/Toast/toast.scss +0 -55
- package/src/ListRow/ListRow.tsx +0 -20
- package/src/StyleProvider.ts +0 -4
- package/src/scss/_baseClasses.scss +0 -23
- package/src/types/isomorphic-style-loader.d.ts +0 -3
- package/webpack.config.js +0 -95
- /package/dist/{src/Components → Components}/Dialog/useAlertDialog.d.ts +0 -0
- /package/dist/{src/Components → Components}/Dialog/useConfirmDialog.d.ts +0 -0
- /package/dist/{src/Components → Components}/DragAndDrop/useStrictEnabled.d.ts +0 -0
- /package/dist/{src/Components → Components}/Flavor.d.ts +0 -0
- /package/dist/{src/Components → Components}/FormElements/Button/ButtonType.d.ts +0 -0
- /package/dist/{src/Components → Components}/FormElements/ColorInput/sharedSelectedColor.d.ts +0 -0
- /package/dist/{src/Components → Components}/FormElements/Controller/SendFormContext.d.ts +0 -0
- /package/dist/{src/Components → Components}/FormElements/Input/FileInput/FileType.d.ts +0 -0
- /package/dist/{src/Components → Components}/Hooks/useBreakpoint.d.ts +0 -0
- /package/dist/{src/Components → Components}/Hooks/useDebounced.d.ts +0 -0
- /package/dist/{src/Components → Components}/Hooks/useDelayed.d.ts +0 -0
- /package/dist/{src/Components → Components}/Hooks/useDelayedEffect.d.ts +0 -0
- /package/dist/{src/Components → Components}/Hooks/useKeyListener.d.ts +0 -0
- /package/dist/{src/Components → Components}/Hooks/useListener.d.ts +0 -0
- /package/dist/{src/Components → Components}/Hooks/useMousePosition.d.ts +0 -0
- /package/dist/{src/Components → Components}/Hooks/useOnMount.d.ts +0 -0
- /package/dist/{src/Components → Components}/Hooks/useOnce.d.ts +0 -0
- /package/dist/{src/Components → Components}/Hooks/useRerender.d.ts +0 -0
- /package/dist/{src/Components → Components}/Hooks/useWindowDimensions.d.ts +0 -0
- /package/dist/{src/Components → Components}/SpoilerList/useSpoilerGroup.d.ts +0 -0
- /package/dist/{src/Components → Components}/Toast/ToastContext.d.ts +0 -0
- /package/dist/{src/Size.d.ts → Size.d.ts} +0 -0
- /package/dist/{src/TypeHelpers.d.ts → TypeHelpers.d.ts} +0 -0
- /package/dist/{src/WindowContext → WindowContext}/WindowContext.d.ts +0 -0
- /package/dist/{src/WrongChildError.d.ts → WrongChildError.d.ts} +0 -0
- /package/dist/{src/helper → helper}/Characters.d.ts +0 -0
- /package/dist/{src/helper → helper}/DistributiveOmit.d.ts +0 -0
- /package/dist/{src/helper → helper}/EmptyProps.d.ts +0 -0
- /package/dist/{src/helper → helper}/memoComparator.d.ts +0 -0
- /package/dist/{src/helper → helper}/nonEmptyString.d.ts +0 -0
- /package/src/Components/FormElements/Input/PasswordInput/{passwordInput.scss → passwordInput.module.scss} +0 -0
- /package/src/Components/Image/{image.scss → image.module.scss} +0 -0
- /package/src/Components/InViewport/{inViewport.scss → inViewport.module.scss} +0 -0
- /package/src/Components/Layout/{layout.scss → layout.module.scss} +0 -0
- /package/src/Components/Text/{heading.scss → heading.module.scss} +0 -0
- /package/src/types/{scss-module.d.ts → scss.d.ts} +0 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
|
|
3
|
+
import * as MenuStories from '@/Components/Menu/Menu.stories';
|
|
4
|
+
import { HoverMenu } from '@/Components/Menu/HoverMenu';
|
|
5
|
+
import { Icon } from '@/Components/Icon/Icon';
|
|
6
|
+
import { faCogs } from '@fortawesome/free-solid-svg-icons';
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import type { ReactElement } from 'react';
|
|
9
|
+
|
|
10
|
+
const meta = {
|
|
11
|
+
component: HoverMenu,
|
|
12
|
+
argTypes: {
|
|
13
|
+
children: {
|
|
14
|
+
control: false,
|
|
15
|
+
},
|
|
16
|
+
items: {
|
|
17
|
+
control: false,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
} satisfies Meta<typeof HoverMenu>;
|
|
21
|
+
|
|
22
|
+
export default meta;
|
|
23
|
+
|
|
24
|
+
type Story = StoryObj<typeof meta>;
|
|
25
|
+
|
|
26
|
+
export const Default: Story = {
|
|
27
|
+
args: {
|
|
28
|
+
openToSide: false,
|
|
29
|
+
children: <Icon icon={faCogs} />,
|
|
30
|
+
items: MenuStories.Default.args?.children as ReactElement,
|
|
31
|
+
},
|
|
32
|
+
};
|
|
@@ -1,35 +1,42 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
1
|
+
import { Clickable } from '@/Components/Clickable/Clickable';
|
|
2
|
+
import { Menu } from '@/Components/Menu/Menu';
|
|
3
|
+
import { withMemo } from '@/helper/withMemo';
|
|
4
|
+
import React, { useCallback, useRef, useState } from 'react';
|
|
5
|
+
import classNames from 'classnames';
|
|
6
|
+
import styles from '@/Components/Menu/menu.module.scss';
|
|
7
|
+
import type {
|
|
8
|
+
RbmChildWithoutString,
|
|
9
|
+
RbmComponentProps,
|
|
10
|
+
WithNoStringAndChildrenProps,
|
|
11
|
+
} from '@/Components/RbmComponentProps';
|
|
8
12
|
|
|
9
|
-
export type HoverMenuProps = RbmComponentProps<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
export type HoverMenuProps = RbmComponentProps<
|
|
14
|
+
{
|
|
15
|
+
items: RbmChildWithoutString;
|
|
16
|
+
openToSide?: boolean;
|
|
17
|
+
onClick?: () => void | boolean;
|
|
18
|
+
onClose?: () => void;
|
|
19
|
+
},
|
|
20
|
+
WithNoStringAndChildrenProps
|
|
21
|
+
>;
|
|
15
22
|
|
|
16
23
|
export const HoverMenu = withMemo(function HoverMenu({
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
children,
|
|
25
|
+
items,
|
|
26
|
+
className,
|
|
27
|
+
style,
|
|
28
|
+
onClick,
|
|
29
|
+
onClose,
|
|
30
|
+
openToSide,
|
|
31
|
+
}: HoverMenuProps) {
|
|
25
32
|
// Refs
|
|
26
33
|
|
|
27
34
|
// States/Variables/Selectors
|
|
28
35
|
const hoverItemRef = useRef<HTMLDivElement>(null);
|
|
29
36
|
|
|
30
37
|
const [isOpen, setIsOpen] = useState(false);
|
|
31
|
-
const [position, setPosition] = useState({x: 0, y: 0});
|
|
32
|
-
const [offset, setOffset] = useState({x: 0, y: 0});
|
|
38
|
+
const [position, setPosition] = useState({ x: 0, y: 0 });
|
|
39
|
+
const [offset, setOffset] = useState({ x: 0, y: 0 });
|
|
33
40
|
|
|
34
41
|
// Dispatch
|
|
35
42
|
|
|
@@ -38,13 +45,13 @@ export const HoverMenu = withMemo(function HoverMenu({
|
|
|
38
45
|
if (!hoverItemRef.current) {
|
|
39
46
|
return;
|
|
40
47
|
}
|
|
41
|
-
const {top, left, bottom, right, width, height} = hoverItemRef.current.getBoundingClientRect();
|
|
48
|
+
const { top, left, bottom, right, width, height } = hoverItemRef.current.getBoundingClientRect();
|
|
42
49
|
if (openToSide) {
|
|
43
|
-
setPosition({x: right, y: top});
|
|
44
|
-
setOffset({x: width, y: -height});
|
|
50
|
+
setPosition({ x: right, y: top });
|
|
51
|
+
setOffset({ x: width, y: -height });
|
|
45
52
|
} else {
|
|
46
|
-
setPosition({x: left, y: bottom});
|
|
47
|
-
setOffset({x: -width, y: height});
|
|
53
|
+
setPosition({ x: left, y: bottom });
|
|
54
|
+
setOffset({ x: -width, y: height });
|
|
48
55
|
}
|
|
49
56
|
}, [openToSide]);
|
|
50
57
|
|
|
@@ -70,20 +77,29 @@ export const HoverMenu = withMemo(function HoverMenu({
|
|
|
70
77
|
|
|
71
78
|
// RenderFunctions
|
|
72
79
|
|
|
73
|
-
return
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
80
|
+
return (
|
|
81
|
+
<Clickable
|
|
82
|
+
onMouseEnter={open}
|
|
83
|
+
onMouseLeave={close}
|
|
84
|
+
useReactOnMouseLeave={true}
|
|
85
|
+
onClick={onClickInner}
|
|
86
|
+
className={classNames(styles.hoverMenu, { [styles.open]: isOpen }, className)}
|
|
87
|
+
style={style}
|
|
88
|
+
ref={hoverItemRef}
|
|
89
|
+
__allowChildren="all"
|
|
90
|
+
>
|
|
91
|
+
{children}
|
|
92
|
+
<Menu
|
|
93
|
+
x={position.x}
|
|
94
|
+
y={position.y}
|
|
95
|
+
isOpen={true}
|
|
96
|
+
onClose={close}
|
|
97
|
+
offsetX={offset.x}
|
|
98
|
+
offsetY={offset.y}
|
|
99
|
+
className={classNames({ [styles.hidden]: !isOpen })}
|
|
100
|
+
>
|
|
101
|
+
{items}
|
|
102
|
+
</Menu>
|
|
103
|
+
</Clickable>
|
|
104
|
+
);
|
|
105
|
+
});
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
|
|
3
|
+
import { Menu } from '@/Components/Menu/Menu';
|
|
4
|
+
import { MenuDivider } from '@/Components/Menu/MenuDivider';
|
|
5
|
+
import { MenuItem } from '@/Components/Menu/MenuItem';
|
|
6
|
+
import { Submenu } from '@/Components/Menu/Submenu';
|
|
7
|
+
import { faCog, faCogs, faHome, faUser } from '@fortawesome/free-solid-svg-icons';
|
|
8
|
+
import { fn } from 'storybook/test';
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import type { MenuProps } from '@/Components/Menu/Menu';
|
|
11
|
+
|
|
12
|
+
const meta = {
|
|
13
|
+
component: Menu,
|
|
14
|
+
argTypes: {
|
|
15
|
+
children: {
|
|
16
|
+
control: false,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
} satisfies Meta<typeof Menu>;
|
|
20
|
+
|
|
21
|
+
export default meta;
|
|
22
|
+
|
|
23
|
+
type Story = StoryObj<MenuProps>;
|
|
24
|
+
|
|
25
|
+
export const Default: Story = {
|
|
26
|
+
args: {
|
|
27
|
+
isOpen: true,
|
|
28
|
+
x: 100,
|
|
29
|
+
y: 100,
|
|
30
|
+
children: (
|
|
31
|
+
<>
|
|
32
|
+
<MenuItem onClick={fn()} icon={faHome}>
|
|
33
|
+
One
|
|
34
|
+
</MenuItem>
|
|
35
|
+
<MenuItem onClick={fn()} active={true} icon={faUser}>
|
|
36
|
+
Two
|
|
37
|
+
</MenuItem>
|
|
38
|
+
<MenuItem onClick={fn()} icon={faCog}>
|
|
39
|
+
Three
|
|
40
|
+
</MenuItem>
|
|
41
|
+
<MenuDivider />
|
|
42
|
+
<Submenu label="Submenu" icon={faCogs}>
|
|
43
|
+
<MenuItem onClick={fn()} icon={faHome}>
|
|
44
|
+
Sub One
|
|
45
|
+
</MenuItem>
|
|
46
|
+
<MenuItem onClick={fn()} icon={faUser}>
|
|
47
|
+
Sub Two
|
|
48
|
+
</MenuItem>
|
|
49
|
+
<MenuItem onClick={fn()} icon={faCog}>
|
|
50
|
+
Sub Three
|
|
51
|
+
</MenuItem>
|
|
52
|
+
</Submenu>
|
|
53
|
+
<MenuItem onClick={fn()} icon={faUser} disabled={true}>
|
|
54
|
+
Four
|
|
55
|
+
</MenuItem>
|
|
56
|
+
<MenuItem onClick={fn()} icon={faCog}>
|
|
57
|
+
Five
|
|
58
|
+
</MenuItem>
|
|
59
|
+
<MenuDivider />
|
|
60
|
+
<MenuItem iconColor="green" onClick={fn()} icon={faUser}>
|
|
61
|
+
Six
|
|
62
|
+
</MenuItem>
|
|
63
|
+
<MenuItem iconColor="green" onClick={fn()} icon={faCog} disabled={true}>
|
|
64
|
+
Seven
|
|
65
|
+
</MenuItem>
|
|
66
|
+
</>
|
|
67
|
+
),
|
|
68
|
+
},
|
|
69
|
+
};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import styles from './menu.scss';
|
|
2
|
+
import { Block } from '@/Components/Layout/Block';
|
|
3
|
+
import { MenuCloseContextProvider } from '@/Components/Menu/MenuCloseContext';
|
|
4
|
+
import { MenuItem } from '@/Components/Menu/MenuItem';
|
|
5
|
+
import { createPortal } from 'react-dom';
|
|
6
|
+
import { useClientLayoutEffect } from '@/Components/Hooks/useClientLayoutEffect';
|
|
8
7
|
import { useEffect, useRef, useState } from 'react';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import {
|
|
8
|
+
import { useWindow } from '@/WindowContext/WindowContext';
|
|
9
|
+
import { withMemo } from '@/helper/withMemo';
|
|
10
|
+
import { withRenderBrowserOnly } from '@/helper/withRenderBrowserOnly';
|
|
11
|
+
import classNames from 'classnames';
|
|
12
|
+
import styles from '@/Components/Menu/menu.module.scss';
|
|
13
|
+
import type { IconSource } from '@/Components/Icon/Icon';
|
|
14
|
+
import type { RbmComponentProps } from '@/Components/RbmComponentProps';
|
|
15
15
|
|
|
16
16
|
export type MenuItemType = {
|
|
17
17
|
label: string;
|
|
18
|
-
icon?: IconSource | { icon: IconSource
|
|
18
|
+
icon?: IconSource | { icon: IconSource; color: string };
|
|
19
19
|
key: string;
|
|
20
20
|
className?: string;
|
|
21
21
|
callback: () => void;
|
|
@@ -23,33 +23,31 @@ export type MenuItemType = {
|
|
|
23
23
|
onMouseLeave?: () => void;
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
export type MenuProps = RbmComponentProps<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
>;
|
|
26
|
+
export type MenuProps = RbmComponentProps<{
|
|
27
|
+
items?: MenuItemType[];
|
|
28
|
+
x: number;
|
|
29
|
+
y: number;
|
|
30
|
+
isOpen: boolean;
|
|
31
|
+
onClose: () => void;
|
|
32
|
+
offsetX?: number;
|
|
33
|
+
offsetY?: number;
|
|
34
|
+
}>;
|
|
37
35
|
|
|
38
|
-
export const MENU_CONTAINER_CLASS =
|
|
36
|
+
export const MENU_CONTAINER_CLASS = 'rbm-menu-container';
|
|
39
37
|
|
|
40
38
|
export const Menu = withMemo(
|
|
41
39
|
withRenderBrowserOnly(function Menu({
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
40
|
+
className,
|
|
41
|
+
style,
|
|
42
|
+
items,
|
|
43
|
+
y,
|
|
44
|
+
x,
|
|
45
|
+
isOpen,
|
|
46
|
+
onClose,
|
|
47
|
+
children,
|
|
48
|
+
offsetY = 0,
|
|
49
|
+
offsetX = 0,
|
|
50
|
+
}: MenuProps) {
|
|
53
51
|
// Variables
|
|
54
52
|
|
|
55
53
|
// Refs
|
|
@@ -76,11 +74,11 @@ export const Menu = withMemo(
|
|
|
76
74
|
onClose();
|
|
77
75
|
}
|
|
78
76
|
};
|
|
79
|
-
window?.addEventListener('mousedown', listener, {capture: true});
|
|
80
|
-
window?.addEventListener('touchstart', listener, {capture: true});
|
|
77
|
+
window?.addEventListener('mousedown', listener, { capture: true });
|
|
78
|
+
window?.addEventListener('touchstart', listener, { capture: true });
|
|
81
79
|
return () => {
|
|
82
|
-
window?.removeEventListener('mousedown', listener, {capture: true});
|
|
83
|
-
window?.removeEventListener('touchstart', listener, {capture: true});
|
|
80
|
+
window?.removeEventListener('mousedown', listener, { capture: true });
|
|
81
|
+
window?.removeEventListener('touchstart', listener, { capture: true });
|
|
84
82
|
};
|
|
85
83
|
}
|
|
86
84
|
return undefined;
|
|
@@ -94,7 +92,7 @@ export const Menu = withMemo(
|
|
|
94
92
|
if (!elem) {
|
|
95
93
|
elem = window?.document.body;
|
|
96
94
|
}
|
|
97
|
-
elem?.
|
|
95
|
+
elem?.append(portalContainer);
|
|
98
96
|
}, [isOpen, portalContainer, window?.document.body]);
|
|
99
97
|
|
|
100
98
|
useClientLayoutEffect(() => {
|
|
@@ -105,20 +103,19 @@ export const Menu = withMemo(
|
|
|
105
103
|
|
|
106
104
|
const updateInnerPositions = () => {
|
|
107
105
|
const computedStyle = getComputedStyle(menuElement);
|
|
108
|
-
const height = parseFloat(computedStyle.height);
|
|
106
|
+
const height = Number.parseFloat(computedStyle.height);
|
|
109
107
|
let newY = y;
|
|
110
108
|
if (newY > (window?.innerHeight ?? 0) - height) {
|
|
111
109
|
newY -= height + offsetY;
|
|
112
110
|
}
|
|
113
111
|
setInnerY(Math.max(0, newY));
|
|
114
112
|
|
|
115
|
-
const width = parseFloat(computedStyle.width);
|
|
113
|
+
const width = Number.parseFloat(computedStyle.width);
|
|
116
114
|
let newX = x;
|
|
117
115
|
if (newX > (window?.innerWidth ?? 0) - width) {
|
|
118
116
|
newX -= width + offsetX;
|
|
119
117
|
}
|
|
120
118
|
setInnerX(Math.max(0, newX));
|
|
121
|
-
|
|
122
119
|
};
|
|
123
120
|
|
|
124
121
|
const observer = new ResizeObserver(() => {
|
|
@@ -145,28 +142,40 @@ export const Menu = withMemo(
|
|
|
145
142
|
<MenuCloseContextProvider value={onClose}>
|
|
146
143
|
<Block
|
|
147
144
|
className={classNames(className, styles.menu)}
|
|
148
|
-
style={{...style, top: innerY, left: innerX}}
|
|
145
|
+
style={{ ...style, top: innerY, left: innerX }}
|
|
149
146
|
ref={menuRef}
|
|
150
147
|
__allowChildren="all"
|
|
151
148
|
>
|
|
152
149
|
{items?.map((item) => {
|
|
153
|
-
const icon =
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
150
|
+
const icon =
|
|
151
|
+
!!item.icon && typeof item.icon === 'object' && 'color' in item.icon
|
|
152
|
+
? item.icon.icon
|
|
153
|
+
: item.icon;
|
|
154
|
+
const iconColor =
|
|
155
|
+
!!item.icon && typeof item.icon === 'object' && 'color' in item.icon
|
|
156
|
+
? item.icon.color
|
|
157
|
+
: undefined;
|
|
158
|
+
|
|
159
|
+
return (
|
|
160
|
+
<MenuItem
|
|
161
|
+
key={item.key}
|
|
162
|
+
onClick={item.callback}
|
|
163
|
+
className={classNames(styles.item, item.className)}
|
|
164
|
+
onMouseEnter={item.onMouseEnter}
|
|
165
|
+
icon={icon}
|
|
166
|
+
iconColor={iconColor}
|
|
167
|
+
onMouseLeave={item.onMouseLeave}
|
|
168
|
+
>
|
|
169
|
+
{item.label}
|
|
170
|
+
</MenuItem>
|
|
171
|
+
);
|
|
163
172
|
})}
|
|
164
173
|
{children}
|
|
165
174
|
</Block>
|
|
166
|
-
</MenuCloseContextProvider
|
|
167
|
-
,
|
|
175
|
+
</MenuCloseContextProvider>,
|
|
176
|
+
portalContainer,
|
|
177
|
+
)}
|
|
168
178
|
</>
|
|
169
179
|
);
|
|
170
180
|
}),
|
|
171
|
-
styles
|
|
172
181
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import { Block } from '@/Components/Layout/Block';
|
|
2
|
+
import { withMemo } from '@/helper/withMemo';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import styles from '@/Components/Menu/menu.module.scss';
|
|
5
5
|
|
|
6
6
|
export const MenuDivider = withMemo(function MenuDivider() {
|
|
7
7
|
// Refs
|
|
@@ -18,5 +18,5 @@ export const MenuDivider = withMemo(function MenuDivider() {
|
|
|
18
18
|
|
|
19
19
|
// RenderFunctions
|
|
20
20
|
|
|
21
|
-
return <Block className={styles.divider}/>;
|
|
22
|
-
}
|
|
21
|
+
return <Block className={styles.divider} />;
|
|
22
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
|
|
3
|
+
import { MenuItem } from '@/Components/Menu/MenuItem';
|
|
4
|
+
import { faCog, faHome, faUser } from '@fortawesome/free-solid-svg-icons';
|
|
5
|
+
import { fn } from 'storybook/test';
|
|
6
|
+
|
|
7
|
+
const meta = {
|
|
8
|
+
component: MenuItem,
|
|
9
|
+
argTypes: {
|
|
10
|
+
icon: {
|
|
11
|
+
control: { type: 'select' },
|
|
12
|
+
options: ['none', 'home', 'settings', 'user'],
|
|
13
|
+
mapping: {
|
|
14
|
+
none: undefined,
|
|
15
|
+
home: faHome,
|
|
16
|
+
settings: faCog,
|
|
17
|
+
user: faUser,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
} satisfies Meta<typeof MenuItem>;
|
|
22
|
+
|
|
23
|
+
export default meta;
|
|
24
|
+
|
|
25
|
+
type Story = StoryObj<typeof meta>;
|
|
26
|
+
|
|
27
|
+
export const Default: Story = {
|
|
28
|
+
args: {
|
|
29
|
+
active: false,
|
|
30
|
+
children: 'Menu Item',
|
|
31
|
+
disabled: false,
|
|
32
|
+
onClick: fn(),
|
|
33
|
+
icon: faHome,
|
|
34
|
+
},
|
|
35
|
+
};
|
|
@@ -1,47 +1,56 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import React, {
|
|
8
|
-
import
|
|
1
|
+
import { Block } from '@/Components/Layout/Block';
|
|
2
|
+
import { Clickable } from '@/Components/Clickable/Clickable';
|
|
3
|
+
import { Icon } from '@/Components/Icon/Icon';
|
|
4
|
+
import { Text } from '@/Components/Text/Text';
|
|
5
|
+
import { useMenuClose } from '@/Components/Menu/MenuCloseContext';
|
|
6
|
+
import { withMemo } from '@/helper/withMemo';
|
|
7
|
+
import React, { useCallback } from 'react';
|
|
8
|
+
import classNames from 'classnames';
|
|
9
|
+
import styles from '@/Components/Menu/menu.module.scss';
|
|
10
|
+
import type { IconSource } from '@/Components/Icon/Icon';
|
|
11
|
+
import type { RbmComponentProps, WithChildren } from '@/Components/RbmComponentProps';
|
|
12
|
+
import type { ReactNode } from 'react';
|
|
13
|
+
|
|
9
14
|
import Element = React.JSX.Element;
|
|
10
|
-
import {useMenuClose} from "./MenuCloseContext";
|
|
11
|
-
import {Block} from "../Layout/Block";
|
|
12
15
|
|
|
13
|
-
export type MenuItemProps<Item = undefined> = RbmComponentProps<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
16
|
+
export type MenuItemProps<Item = undefined> = RbmComponentProps<
|
|
17
|
+
{
|
|
18
|
+
icon?: IconSource;
|
|
19
|
+
iconColor?: string;
|
|
20
|
+
className?: string;
|
|
21
|
+
children: string | ReactNode;
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
active?: boolean;
|
|
24
|
+
} & (
|
|
25
|
+
| {
|
|
26
|
+
onClick: (item: Item) => void;
|
|
27
|
+
onMouseEnter?: (item: Item) => void;
|
|
28
|
+
onMouseLeave?: (item: Item) => void;
|
|
29
|
+
item?: undefined;
|
|
30
|
+
}
|
|
31
|
+
| {
|
|
32
|
+
onClick: (item: Item) => void;
|
|
33
|
+
onMouseEnter?: (item: Item) => void;
|
|
34
|
+
onMouseLeave?: (item: Item) => void;
|
|
35
|
+
item: Item;
|
|
36
|
+
}
|
|
37
|
+
),
|
|
38
|
+
WithChildren
|
|
39
|
+
>;
|
|
31
40
|
|
|
32
41
|
export const MenuItem = withMemo(function MenuItem<Item>({
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
children,
|
|
43
|
+
icon,
|
|
44
|
+
iconColor,
|
|
45
|
+
className,
|
|
46
|
+
onClick,
|
|
47
|
+
onMouseEnter,
|
|
48
|
+
onMouseLeave,
|
|
49
|
+
active,
|
|
50
|
+
item,
|
|
51
|
+
disabled = false,
|
|
52
|
+
...props
|
|
53
|
+
}: MenuItemProps<Item>) {
|
|
45
54
|
// Refs
|
|
46
55
|
|
|
47
56
|
// States/Variables/Selectors
|
|
@@ -75,21 +84,23 @@ export const MenuItem = withMemo(function MenuItem<Item>({
|
|
|
75
84
|
// Effects
|
|
76
85
|
|
|
77
86
|
// Other
|
|
78
|
-
const childElements = typeof children ===
|
|
87
|
+
const childElements = typeof children === 'string' ? <Text>{children}</Text> : (children as Element);
|
|
79
88
|
|
|
80
89
|
// RenderFunctions
|
|
81
90
|
|
|
82
|
-
return
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
91
|
+
return (
|
|
92
|
+
<Clickable
|
|
93
|
+
className={classNames(styles.item, { [styles.disabled]: disabled, [styles.active]: active }, className)}
|
|
94
|
+
{...props}
|
|
95
|
+
onClick={onClickInner}
|
|
96
|
+
onMouseEnter={onMouseEnterInner}
|
|
97
|
+
onMouseLeave={onMouseLeaveInner}
|
|
98
|
+
__allowChildren="all"
|
|
99
|
+
>
|
|
100
|
+
<Block className={classNames(styles.itemChildren)}>
|
|
101
|
+
{!!icon && <Icon icon={icon} color={iconColor} className={styles.icon} />}
|
|
102
|
+
{childElements}
|
|
103
|
+
</Block>
|
|
104
|
+
</Clickable>
|
|
105
|
+
);
|
|
106
|
+
}, 'text');
|