@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
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import { Text } from '
|
|
11
|
-
import { Flex } from '../../../Layout/Flex';
|
|
12
|
-
import { Grow } from '../../../Layout/Grow';
|
|
13
|
-
import { Icon } 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 { FormError } from '@/Components/FormElements/Error/FormError';
|
|
6
|
+
import { Grow } from '@/Components/Layout/Grow';
|
|
7
|
+
import { Icon } from '@/Components/Icon/Icon';
|
|
8
|
+
import { Image } from '@/Components/Image/Image';
|
|
9
|
+
import { Inline } from '@/Components/Layout/Inline';
|
|
10
|
+
import { Text } from '@/Components/Text/Text';
|
|
14
11
|
import { faFile, faPlus, faTimesCircle } from '@fortawesome/free-solid-svg-icons';
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
|
|
12
|
+
import { useCallback, useRef } from 'react';
|
|
13
|
+
import { useListenerWithExtractedProps } from '@/Components/Hooks/useListener';
|
|
14
|
+
import { withMemo } from '@/helper/withMemo';
|
|
15
|
+
import classNames from 'classnames';
|
|
16
|
+
import styles from '@/Components/FormElements/Input/FileInput/fileInput.module.scss';
|
|
17
|
+
import type { ChangeEventHandler, DragEvent, InputHTMLAttributes } from 'react';
|
|
18
|
+
import type { FileType } from '@/Components/FormElements/Input/FileInput/FileType';
|
|
19
|
+
import type { Listener } from '@/Components/Hooks/useListener';
|
|
20
|
+
import type { Override } from '@/TypeHelpers';
|
|
21
|
+
import type { RbmComponentProps } from '@/Components/RbmComponentProps';
|
|
21
22
|
|
|
22
23
|
export type MultipleFileInputProps<OnChangeFilesData> = RbmComponentProps<
|
|
23
24
|
Override<
|
|
@@ -29,264 +30,266 @@ export type MultipleFileInputProps<OnChangeFilesData> = RbmComponentProps<
|
|
|
29
30
|
maxFiles?: number;
|
|
30
31
|
maxSizePerFile?: number;
|
|
31
32
|
onError?: (error: string) => void;
|
|
32
|
-
allowOverride?: boolean
|
|
33
|
-
showDeleteButton?: boolean
|
|
34
|
-
error?: string
|
|
35
|
-
|
|
33
|
+
allowOverride?: boolean;
|
|
34
|
+
showDeleteButton?: boolean;
|
|
35
|
+
error?: string;
|
|
36
|
+
'data-test-id'?: string;
|
|
36
37
|
} & Listener<'onChangeFiles', OnChangeFilesData, FileType[]>
|
|
37
38
|
>
|
|
38
39
|
>;
|
|
39
40
|
|
|
40
41
|
export const MultipleFileInput = withMemo(function MultipleImageInput<OnChangeData>({
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
42
|
+
className,
|
|
43
|
+
style,
|
|
44
|
+
value,
|
|
45
|
+
label,
|
|
46
|
+
mimeTypes = ['image/*'],
|
|
47
|
+
maxFiles = 1,
|
|
48
|
+
maxSizePerFile = 1024 * 1024 * 10,
|
|
49
|
+
allowOverride = maxFiles === 1,
|
|
50
|
+
onError,
|
|
51
|
+
showDeleteButton = true,
|
|
52
|
+
error,
|
|
53
|
+
'data-test-id': testId,
|
|
54
|
+
...otherProps
|
|
55
|
+
}: MultipleFileInputProps<OnChangeData>) {
|
|
56
|
+
// Variables
|
|
56
57
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
// Refs
|
|
59
|
+
const inputRef = useRef<HTMLInputElement>(null);
|
|
60
|
+
const indexRef = useRef<number | undefined>(undefined);
|
|
60
61
|
|
|
61
|
-
|
|
62
|
+
// States
|
|
62
63
|
|
|
63
|
-
|
|
64
|
+
// Selectors
|
|
64
65
|
|
|
65
|
-
|
|
66
|
+
// Callbacks
|
|
66
67
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
68
|
+
const checkMimeType = useCallback(
|
|
69
|
+
(fileType: string) => {
|
|
70
|
+
return mimeTypes.some((type) => {
|
|
71
|
+
if (type === '*/*' || type === '*') {
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
if (type.endsWith('/*')) {
|
|
75
|
+
return fileType.startsWith(type.slice(0, Math.max(0, type.length - 2)));
|
|
76
|
+
}
|
|
77
|
+
return fileType === type;
|
|
78
|
+
});
|
|
79
|
+
},
|
|
80
|
+
[mimeTypes],
|
|
81
|
+
);
|
|
81
82
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
83
|
+
const [onChangeFiles, props] = useListenerWithExtractedProps('onChangeFiles', otherProps);
|
|
84
|
+
const getBase64 = useCallback((inputFiles: Blob[]) => {
|
|
85
|
+
const promises = inputFiles.map(
|
|
86
|
+
(file) =>
|
|
87
|
+
new Promise<string>((resolve, reject) => {
|
|
88
|
+
const reader = new FileReader();
|
|
89
|
+
reader.addEventListener('load', () => {
|
|
90
|
+
resolve(reader.result as string);
|
|
91
|
+
});
|
|
92
|
+
reader.addEventListener('error', reject);
|
|
93
|
+
reader.readAsDataURL(file);
|
|
94
|
+
}),
|
|
95
|
+
);
|
|
96
|
+
return Promise.all(promises);
|
|
97
|
+
}, []);
|
|
97
98
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
99
|
+
const onNewFiles = useCallback(
|
|
100
|
+
async (newFiles: File[], index?: number) => {
|
|
101
|
+
if (newFiles.some((file) => !checkMimeType(file.type))) {
|
|
102
|
+
onError?.('Eine Datei ist im falschen Format');
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
104
105
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
if (
|
|
107
|
+
newFiles.length + value.length > maxFiles &&
|
|
108
|
+
(!allowOverride || index === undefined || index + newFiles.length > maxFiles)
|
|
109
|
+
) {
|
|
110
|
+
onError?.(`Es sind nur ${maxFiles} Dateien erlaubt.`);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
109
113
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
+
if (maxSizePerFile && newFiles.some((file) => file.size > maxSizePerFile)) {
|
|
115
|
+
onError?.(`Eine Datei ist zu groß. Jede Datei darf nur ${maxSizePerFile / 1024 / 1024}MB groß sein.`);
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
114
118
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
119
|
+
const newUrls = await getBase64(newFiles);
|
|
120
|
+
const newValue = newFiles.map((file, fileIndex) => ({
|
|
121
|
+
name: file.name,
|
|
122
|
+
src: newUrls[fileIndex],
|
|
123
|
+
type: file.type,
|
|
124
|
+
blob: file,
|
|
125
|
+
}));
|
|
122
126
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
127
|
+
if (newFiles.length + value.length > maxFiles && index !== undefined) {
|
|
128
|
+
const onChangeFilesValue = [...value];
|
|
129
|
+
onChangeFilesValue.splice(index, newFiles.length, ...newValue);
|
|
130
|
+
onChangeFiles(onChangeFilesValue);
|
|
131
|
+
} else {
|
|
132
|
+
onChangeFiles([...value, ...newValue]);
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
[allowOverride, checkMimeType, getBase64, maxFiles, maxSizePerFile, onChangeFiles, onError, value],
|
|
136
|
+
);
|
|
133
137
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
+
const onInputChange = useCallback<ChangeEventHandler<HTMLInputElement>>(
|
|
139
|
+
async (e) => {
|
|
140
|
+
const index = indexRef.current;
|
|
141
|
+
indexRef.current = undefined;
|
|
138
142
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
143
|
+
if (!e.target.files || e.target.files.length === 0) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
142
146
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
147
|
+
const newFiles = [...e.target.files];
|
|
148
|
+
await onNewFiles(newFiles, index);
|
|
149
|
+
},
|
|
150
|
+
[onNewFiles],
|
|
151
|
+
);
|
|
148
152
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
153
|
+
const removeFile = useCallback(
|
|
154
|
+
(_: any, index: number) => {
|
|
155
|
+
if (index >= 0 && index < value.length) {
|
|
156
|
+
const newData = [...value];
|
|
157
|
+
newData.splice(index, 1);
|
|
158
|
+
onChangeFiles(newData);
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
[onChangeFiles, value],
|
|
162
|
+
);
|
|
159
163
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
164
|
+
const onDrop = useCallback(
|
|
165
|
+
async (event: DragEvent, index: number) => {
|
|
166
|
+
event.preventDefault();
|
|
163
167
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}
|
|
168
|
+
const files: File[] = [];
|
|
169
|
+
if (event.dataTransfer.items) {
|
|
170
|
+
for (let i = 0; i < event.dataTransfer.items.length; i++) {
|
|
171
|
+
if (event.dataTransfer.items[i].kind === 'file') {
|
|
172
|
+
const file = event.dataTransfer.items[i].getAsFile();
|
|
173
|
+
if (file) {
|
|
174
|
+
files.push(file);
|
|
172
175
|
}
|
|
173
176
|
}
|
|
174
|
-
} else {
|
|
175
|
-
for (let i = 0; i < event.dataTransfer.files.length; i++) {
|
|
176
|
-
files.push(event.dataTransfer.files[i]);
|
|
177
|
-
}
|
|
178
177
|
}
|
|
178
|
+
} else {
|
|
179
|
+
for (let i = 0; i < event.dataTransfer.files.length; i++) {
|
|
180
|
+
files.push(event.dataTransfer.files[i]);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
179
183
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
+
await onNewFiles(files, index);
|
|
185
|
+
},
|
|
186
|
+
[onNewFiles],
|
|
187
|
+
);
|
|
184
188
|
|
|
185
|
-
|
|
189
|
+
const onDragOver = useCallback((e: DragEvent) => e.preventDefault(), []);
|
|
186
190
|
|
|
187
|
-
|
|
191
|
+
const clickOnFile = useCallback(
|
|
192
|
+
(_: any, index?: number) => {
|
|
188
193
|
if ((index !== undefined && !allowOverride) || !inputRef.current) {
|
|
189
194
|
return;
|
|
190
195
|
}
|
|
191
196
|
|
|
192
197
|
indexRef.current = index;
|
|
193
|
-
inputRef.current.dispatchEvent(new MouseEvent(
|
|
194
|
-
},
|
|
198
|
+
inputRef.current.dispatchEvent(new MouseEvent('click'));
|
|
199
|
+
},
|
|
200
|
+
[allowOverride],
|
|
201
|
+
);
|
|
195
202
|
|
|
196
|
-
|
|
203
|
+
// Effects
|
|
197
204
|
|
|
198
|
-
|
|
205
|
+
// Other
|
|
199
206
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
<Image
|
|
205
|
-
key={file.src}
|
|
206
|
-
src={file.src}
|
|
207
|
-
alt={file.name}
|
|
208
|
-
className={classNames(styles.previewImage)}
|
|
209
|
-
/>
|
|
210
|
-
);
|
|
211
|
-
}
|
|
212
|
-
// TODO style
|
|
213
|
-
return (
|
|
214
|
-
<Block className={styles.previewText}>
|
|
215
|
-
<Icon icon={faFile} className={styles.previewTextIcon}/><Text>{file.name}</Text>
|
|
216
|
-
</Block>
|
|
217
|
-
);
|
|
218
|
-
};
|
|
219
|
-
|
|
220
|
-
if (error){
|
|
221
|
-
console.log("LOG-d error inside MultipleFileInput:", error);
|
|
207
|
+
// Render Functions
|
|
208
|
+
const renderFile = (file: FileType) => {
|
|
209
|
+
if (file.type.startsWith('image/')) {
|
|
210
|
+
return <Image key={file.src} src={file.src} alt={file.name} className={classNames(styles.previewImage)} />;
|
|
222
211
|
}
|
|
223
212
|
|
|
224
213
|
return (
|
|
225
|
-
<
|
|
226
|
-
className={
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
</
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
214
|
+
<Block className={styles.previewText}>
|
|
215
|
+
<Icon icon={faFile} className={styles.previewTextIcon} />
|
|
216
|
+
<Text>{file.name}</Text>
|
|
217
|
+
</Block>
|
|
218
|
+
);
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
if (error) {
|
|
222
|
+
console.log('Error inside MultipleFileInput:', error);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
return (
|
|
226
|
+
<span className={classNames(styles.fileInput, className)} style={style} data-test-id={testId}>
|
|
227
|
+
<Flex horizontal={true}>
|
|
228
|
+
{!!label && (
|
|
229
|
+
<Grow>
|
|
230
|
+
<Text>{label}</Text>
|
|
231
|
+
</Grow>
|
|
232
|
+
)}
|
|
233
|
+
{maxFiles > 1 && (
|
|
234
|
+
<Inline>
|
|
235
|
+
<Text>
|
|
236
|
+
{value.length}/{maxFiles}
|
|
237
|
+
</Text>
|
|
238
|
+
</Inline>
|
|
239
|
+
)}
|
|
240
|
+
</Flex>
|
|
241
|
+
<Flex horizontal={true} className={styles.previewContainer}>
|
|
242
|
+
{value?.map((file, index) => {
|
|
243
|
+
return (
|
|
244
|
+
<Grow className={styles.preview} center={true} key={file.src}>
|
|
247
245
|
<Clickable
|
|
248
246
|
onDrop={onDrop}
|
|
249
247
|
onDragOver={onDragOver}
|
|
250
248
|
onDropData={index}
|
|
251
|
-
|
|
252
249
|
onClick={clickOnFile}
|
|
253
250
|
onClickData={index}
|
|
254
251
|
>
|
|
255
252
|
{renderFile(file)}
|
|
256
|
-
{showDeleteButton &&
|
|
257
|
-
<Clickable
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
253
|
+
{showDeleteButton && (
|
|
254
|
+
<Clickable
|
|
255
|
+
className={styles.previewRemove}
|
|
256
|
+
onClick={removeFile}
|
|
257
|
+
onClickData={index}
|
|
258
|
+
>
|
|
259
|
+
<Icon icon={faTimesCircle} />
|
|
260
|
+
</Clickable>
|
|
261
|
+
)}
|
|
261
262
|
</Clickable>
|
|
262
|
-
</Grow
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
263
|
+
</Grow>
|
|
264
|
+
);
|
|
265
|
+
})}
|
|
266
|
+
<Grow
|
|
267
|
+
className={classNames(styles.addFile, { [styles.hidden]: value.length >= maxFiles })}
|
|
268
|
+
center={true}
|
|
269
|
+
>
|
|
270
|
+
<Clickable
|
|
271
|
+
className={styles.addFileButton}
|
|
272
|
+
onDrop={onDrop}
|
|
273
|
+
onDragOver={onDragOver}
|
|
274
|
+
onDropData={maxFiles}
|
|
275
|
+
onClick={clickOnFile}
|
|
276
|
+
__allowChildren="html"
|
|
277
|
+
>
|
|
278
|
+
<Icon icon={faPlus} />
|
|
279
|
+
<input
|
|
280
|
+
{...props}
|
|
281
|
+
ref={inputRef}
|
|
282
|
+
className={styles.value}
|
|
283
|
+
onChange={onInputChange}
|
|
284
|
+
value=""
|
|
285
|
+
type="file"
|
|
286
|
+
multiple={maxFiles > 1}
|
|
287
|
+
accept={mimeTypes.join(', ')}
|
|
288
|
+
/>
|
|
289
|
+
</Clickable>
|
|
290
|
+
</Grow>
|
|
291
|
+
</Flex>
|
|
292
|
+
<FormError error={error} />
|
|
293
|
+
</span>
|
|
294
|
+
);
|
|
295
|
+
});
|
package/src/Components/FormElements/Input/FileInput/{fileInput.scss → fileInput.module.scss}
RENAMED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
@use "../../../../scss/vars" as *;
|
|
2
|
+
|
|
3
|
+
@include vars {
|
|
4
|
+
--file-input-preview-border-color: var(--border-light);
|
|
5
|
+
--file-input-svg-background: rgb(255 255 255 / 20%);
|
|
6
|
+
}
|
|
7
|
+
|
|
1
8
|
.fileInput {
|
|
2
9
|
display: flex;
|
|
3
10
|
flex-direction: column;
|
|
@@ -10,7 +17,7 @@
|
|
|
10
17
|
|
|
11
18
|
.preview {
|
|
12
19
|
position: relative;
|
|
13
|
-
border: 1px solid var(--border-
|
|
20
|
+
border: 1px solid var(--file-input-preview-border-color);
|
|
14
21
|
|
|
15
22
|
.previewRemove {
|
|
16
23
|
position: absolute;
|
|
@@ -20,7 +27,7 @@
|
|
|
20
27
|
font-size: 1.5rem;
|
|
21
28
|
|
|
22
29
|
svg {
|
|
23
|
-
background:
|
|
30
|
+
background: var(--file-input-svg-background);
|
|
24
31
|
}
|
|
25
32
|
}
|
|
26
33
|
|
|
@@ -39,7 +46,6 @@
|
|
|
39
46
|
width: 100%;
|
|
40
47
|
height: 100%;
|
|
41
48
|
min-height: 4rem;
|
|
42
|
-
|
|
43
49
|
display: flex;
|
|
44
50
|
justify-content: center;
|
|
45
51
|
align-items: center;
|
|
@@ -53,8 +59,7 @@
|
|
|
53
59
|
.addFile {
|
|
54
60
|
position: relative;
|
|
55
61
|
border-radius: 3px;
|
|
56
|
-
background-color: var(--border-
|
|
57
|
-
|
|
62
|
+
background-color: var(--file-input-preview-border-color);
|
|
58
63
|
display: flex;
|
|
59
64
|
justify-content: center;
|
|
60
65
|
align-items: center;
|
|
@@ -64,7 +69,6 @@
|
|
|
64
69
|
width: 100%;
|
|
65
70
|
height: 100%;
|
|
66
71
|
min-height: 4rem;
|
|
67
|
-
|
|
68
72
|
display: flex;
|
|
69
73
|
justify-content: center;
|
|
70
74
|
align-items: center;
|
|
@@ -76,13 +80,7 @@
|
|
|
76
80
|
}
|
|
77
81
|
}
|
|
78
82
|
|
|
79
|
-
|
|
80
83
|
.value {
|
|
81
84
|
display: none;
|
|
82
85
|
}
|
|
83
|
-
|
|
84
|
-
.error {
|
|
85
|
-
font-size: 0.7rem;
|
|
86
|
-
--text-primary-default-color: var(--text-error)
|
|
87
|
-
}
|
|
88
86
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
|
|
3
|
+
import { HiddenInput } from '@/Components/FormElements/Input/HiddenInput';
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
component: HiddenInput,
|
|
7
|
+
} satisfies Meta<typeof HiddenInput>;
|
|
8
|
+
|
|
9
|
+
export default meta;
|
|
10
|
+
|
|
11
|
+
type Story = StoryObj<typeof meta>;
|
|
12
|
+
|
|
13
|
+
export const Default: Story = {
|
|
14
|
+
args: {
|
|
15
|
+
inline: false,
|
|
16
|
+
defaultValue: 'Without Label',
|
|
17
|
+
label: '',
|
|
18
|
+
placeholder: 'Placeholder',
|
|
19
|
+
error: '',
|
|
20
|
+
noFocusHint: false,
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const Label: Story = {
|
|
25
|
+
args: {
|
|
26
|
+
inline: false,
|
|
27
|
+
defaultValue: 'With Label',
|
|
28
|
+
label: 'Label',
|
|
29
|
+
placeholder: 'Placeholder',
|
|
30
|
+
error: '',
|
|
31
|
+
noFocusHint: false,
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const Error: Story = {
|
|
36
|
+
args: {
|
|
37
|
+
inline: false,
|
|
38
|
+
defaultValue: 'With Label',
|
|
39
|
+
label: 'Label',
|
|
40
|
+
placeholder: 'Placeholder',
|
|
41
|
+
error: 'Wrong Value',
|
|
42
|
+
noFocusHint: false,
|
|
43
|
+
},
|
|
44
|
+
};
|