@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,8 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { Input
|
|
3
|
-
import { withMemo } from '
|
|
4
|
-
import styles from './input.scss';
|
|
2
|
+
import { Input } from '@/Components/FormElements/Input/Input';
|
|
3
|
+
import { withMemo } from '@/helper/withMemo';
|
|
5
4
|
import classNames from 'classnames';
|
|
5
|
+
import styles from '@/Components/FormElements/Input/input.module.scss';
|
|
6
|
+
import type { InputProps } from '@/Components/FormElements/Input/Input';
|
|
6
7
|
|
|
7
8
|
export type HiddenInputProps<OnChangeType, OnBlurData, OnChangeEndData> = InputProps<
|
|
8
9
|
OnChangeType,
|
|
@@ -12,7 +13,7 @@ export type HiddenInputProps<OnChangeType, OnBlurData, OnChangeEndData> = InputP
|
|
|
12
13
|
noFocusHint?: boolean;
|
|
13
14
|
};
|
|
14
15
|
|
|
15
|
-
function HiddenInput<OnChangeData, OnBlurData, OnChangeEndData>({
|
|
16
|
+
export const HiddenInput = withMemo(function HiddenInput<OnChangeData, OnBlurData, OnChangeEndData>({
|
|
16
17
|
noFocusHint = false,
|
|
17
18
|
className,
|
|
18
19
|
...props
|
|
@@ -36,7 +37,4 @@ function HiddenInput<OnChangeData, OnBlurData, OnChangeEndData>({
|
|
|
36
37
|
{...props}
|
|
37
38
|
/>
|
|
38
39
|
);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const tmp = withMemo(HiddenInput);
|
|
42
|
-
export { tmp as HiddenInput };
|
|
40
|
+
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
|
|
3
|
+
import { Input } from '@/Components/FormElements/Input/Input';
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
component: Input,
|
|
7
|
+
argTypes: {
|
|
8
|
+
type: {
|
|
9
|
+
control: { type: 'select' },
|
|
10
|
+
options: ['text', 'email', 'number', 'password', 'tel', 'url'],
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
} satisfies Meta<typeof Input>;
|
|
14
|
+
|
|
15
|
+
export default meta;
|
|
16
|
+
|
|
17
|
+
type Story = StoryObj<typeof meta>;
|
|
18
|
+
|
|
19
|
+
export const Default: Story = {
|
|
20
|
+
args: {
|
|
21
|
+
type: 'text',
|
|
22
|
+
inline: false,
|
|
23
|
+
defaultValue: '',
|
|
24
|
+
label: 'Label',
|
|
25
|
+
placeholder: 'Placeholder',
|
|
26
|
+
error: '',
|
|
27
|
+
readOnly: false,
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const Error: Story = {
|
|
32
|
+
args: {
|
|
33
|
+
inline: false,
|
|
34
|
+
defaultValue: '',
|
|
35
|
+
label: 'Label',
|
|
36
|
+
placeholder: 'Placeholder',
|
|
37
|
+
error: 'Wrong Value',
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const ErrorInline: Story = {
|
|
42
|
+
args: {
|
|
43
|
+
inline: true,
|
|
44
|
+
defaultValue: '',
|
|
45
|
+
label: 'Label',
|
|
46
|
+
placeholder: 'Placeholder',
|
|
47
|
+
error: 'Wrong Value',
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const Inline: Story = {
|
|
52
|
+
args: {
|
|
53
|
+
inline: true,
|
|
54
|
+
defaultValue: '',
|
|
55
|
+
label: 'Label',
|
|
56
|
+
placeholder: 'Placeholder',
|
|
57
|
+
error: '',
|
|
58
|
+
},
|
|
59
|
+
};
|
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} from '
|
|
9
|
-
import {
|
|
10
|
-
import { Override } from '../../../TypeHelpers';
|
|
11
|
-
import { OptionalListener, useListenerWithExtractedProps } from '../../Hooks/useListener';
|
|
12
|
-
import styles from './input.scss';
|
|
2
|
+
import { FormError } from '@/Components/FormElements/Error/FormError';
|
|
3
|
+
import { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
4
|
+
import { useComposedRef } from '@/Components/Hooks/useComposedRef';
|
|
5
|
+
import { useDebounced } from '@/Components/Hooks/useDebounced';
|
|
6
|
+
import { useListenerWithExtractedProps } from '@/Components/Hooks/useListener';
|
|
7
|
+
import { useOnChangeDone } from '@/Components/FormElements/hooks/useOnChangeDone';
|
|
8
|
+
import { useSendFormContext } from '@/Components/FormElements/Controller/SendFormContext';
|
|
9
|
+
import { withMemo } from '@/helper/withMemo';
|
|
13
10
|
import classNames from 'classnames';
|
|
14
|
-
import
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import { withMemo } from "../../../helper/withMemo";
|
|
11
|
+
import styles from '@/Components/FormElements/Input/input.module.scss';
|
|
12
|
+
import type { ChangeEvent, ForwardedRef, InputHTMLAttributes, KeyboardEvent } from 'react';
|
|
13
|
+
import type { OptionalListener } from '@/Components/Hooks/useListener';
|
|
14
|
+
import type { Override } from '@/TypeHelpers';
|
|
15
|
+
import type { RbmComponentProps } from '@/Components/RbmComponentProps';
|
|
20
16
|
|
|
21
17
|
export type InputProps<OnChangeData, OnBlurData, OnChangeDoneData> = RbmComponentProps<
|
|
22
18
|
Override<
|
|
@@ -26,176 +22,181 @@ export type InputProps<OnChangeData, OnBlurData, OnChangeDoneData> = RbmComponen
|
|
|
26
22
|
inline?: boolean;
|
|
27
23
|
onChangeText?: (newText: string) => void;
|
|
28
24
|
onEnter?: (newText: string) => void;
|
|
29
|
-
error?: string
|
|
30
|
-
ref?: ForwardedRef<HTMLInputElement
|
|
25
|
+
error?: string;
|
|
26
|
+
ref?: ForwardedRef<HTMLInputElement>;
|
|
31
27
|
} & OptionalListener<'onChange', OnChangeData> &
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
OptionalListener<'onBlur', OnBlurData> &
|
|
29
|
+
OptionalListener<'onChangeDone', OnChangeDoneData>
|
|
34
30
|
>
|
|
35
31
|
>;
|
|
36
32
|
|
|
37
|
-
export const Input = withMemo(function Input<OnChangeData, OnBlurData, OnChangeDoneData>(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
33
|
+
export const Input = withMemo(function Input<OnChangeData, OnBlurData, OnChangeDoneData>({
|
|
34
|
+
label,
|
|
35
|
+
className,
|
|
36
|
+
style,
|
|
37
|
+
onKeyDown,
|
|
38
|
+
inline = false,
|
|
39
|
+
value,
|
|
40
|
+
error,
|
|
41
|
+
onChangeText,
|
|
42
|
+
onEnter,
|
|
43
|
+
ref,
|
|
44
|
+
...otherProps
|
|
45
|
+
}: InputProps<OnChangeData, OnBlurData, OnChangeDoneData>) {
|
|
46
|
+
// Variables
|
|
47
|
+
|
|
48
|
+
// States
|
|
49
|
+
const usedValue = useMemo(() => {
|
|
50
|
+
if (otherProps.type !== 'number' || typeof value === 'number') {
|
|
51
|
+
return value;
|
|
52
|
+
}
|
|
53
|
+
if (typeof value === 'string') {
|
|
54
|
+
if (value === '-') {
|
|
57
55
|
return value;
|
|
58
56
|
}
|
|
59
|
-
if (typeof value === "string") {
|
|
60
|
-
if (value === "-") {
|
|
61
|
-
return value;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const numberValue = parseFloat(value);
|
|
65
|
-
if (!Number.isNaN(numberValue) && Number.isFinite(numberValue)) {
|
|
66
|
-
if (otherProps.max !== undefined && numberValue > Number(otherProps.max)) {
|
|
67
|
-
return otherProps.max;
|
|
68
|
-
}
|
|
69
|
-
if (otherProps.min !== undefined && numberValue < Number(otherProps.min)) {
|
|
70
|
-
return otherProps.min;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
57
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
58
|
+
const numberValue = Number.parseFloat(value);
|
|
59
|
+
if (!Number.isNaN(numberValue) && Number.isFinite(numberValue)) {
|
|
60
|
+
if (otherProps.max !== undefined && numberValue > Number(otherProps.max)) {
|
|
61
|
+
return otherProps.max;
|
|
77
62
|
}
|
|
78
|
-
if (
|
|
79
|
-
return
|
|
63
|
+
if (otherProps.min !== undefined && numberValue < Number(otherProps.min)) {
|
|
64
|
+
return otherProps.min;
|
|
80
65
|
}
|
|
81
66
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
67
|
+
|
|
68
|
+
if (!Number.isNaN(Number(value))) {
|
|
69
|
+
// Do not parse to allow ., and so on
|
|
70
|
+
return value;
|
|
71
|
+
}
|
|
72
|
+
if (!Number.isNaN(numberValue)) {
|
|
73
|
+
return Number.parseFloat(value);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return '';
|
|
77
|
+
}, [value, otherProps.max, otherProps.min, otherProps.type]);
|
|
78
|
+
// Refs
|
|
79
|
+
const innerRef = useRef<HTMLInputElement>(null);
|
|
80
|
+
const refFunction = useComposedRef(ref, innerRef);
|
|
81
|
+
|
|
82
|
+
// Callbacks
|
|
83
|
+
const sendForm = useSendFormContext();
|
|
84
|
+
onEnter ??= sendForm;
|
|
85
|
+
|
|
86
|
+
const [onChangeWithData, otherPropsWithoutOnchange] = useListenerWithExtractedProps<'onChange', OnChangeData>(
|
|
87
|
+
'onChange',
|
|
88
|
+
otherProps,
|
|
89
|
+
);
|
|
90
|
+
const onChange = useCallback(
|
|
91
|
+
(e: ChangeEvent<HTMLInputElement> | KeyboardEvent<HTMLInputElement>) => {
|
|
92
|
+
if (onChangeText) {
|
|
93
|
+
if (otherProps.type === 'number') {
|
|
94
|
+
if (e.currentTarget.value === '-') {
|
|
108
95
|
onChangeText(e.currentTarget.value);
|
|
96
|
+
return;
|
|
109
97
|
}
|
|
98
|
+
|
|
99
|
+
const val = !Number.isNaN(Number(e.currentTarget.value))
|
|
100
|
+
? e.currentTarget.value
|
|
101
|
+
: !Number.isNaN(Number.parseFloat(e.currentTarget.value))
|
|
102
|
+
? String(Number.parseFloat(e.currentTarget.value))
|
|
103
|
+
: '';
|
|
104
|
+
onChangeText(val);
|
|
105
|
+
} else {
|
|
106
|
+
onChangeText(e.currentTarget.value);
|
|
110
107
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
108
|
+
}
|
|
109
|
+
onChangeWithData(e);
|
|
110
|
+
},
|
|
111
|
+
[onChangeWithData, onChangeText, otherProps.type],
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
const [onBlur, otherPropsWithoutBlur] = useListenerWithExtractedProps<'onBlur', OnBlurData>(
|
|
115
|
+
'onBlur',
|
|
116
|
+
otherPropsWithoutOnchange,
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
const [onChangeDoneWithoutDeboune, otherPropsWithoutData] = useListenerWithExtractedProps<
|
|
120
|
+
'onChangeDone',
|
|
121
|
+
OnChangeDoneData
|
|
122
|
+
>('onChangeDone', otherPropsWithoutBlur);
|
|
123
|
+
const onChangeDone = useDebounced(onChangeDoneWithoutDeboune, [onChangeDoneWithoutDeboune]);
|
|
124
|
+
|
|
125
|
+
const realOnKeyDown = useCallback(
|
|
126
|
+
(e: KeyboardEvent<HTMLInputElement>) => {
|
|
127
|
+
onKeyDown?.(e);
|
|
128
|
+
if (onEnter && e.key === 'Enter' && !e.defaultPrevented) {
|
|
129
|
+
if (otherProps.type === 'number') {
|
|
130
|
+
const stringValue = (e.target as HTMLInputElement).value;
|
|
131
|
+
const val = !Number.isNaN(Number(stringValue))
|
|
132
|
+
? stringValue
|
|
133
|
+
: !Number.isNaN(Number.parseFloat(stringValue))
|
|
134
|
+
? String(Number.parseFloat(stringValue))
|
|
135
|
+
: '';
|
|
136
|
+
onEnter(val);
|
|
137
|
+
} else {
|
|
138
|
+
onEnter((e.target as HTMLInputElement).value);
|
|
139
139
|
}
|
|
140
|
+
}
|
|
140
141
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
}
|
|
155
|
-
e.currentTarget.value = newValue.toString();
|
|
156
|
-
onChange(e);
|
|
142
|
+
if (otherProps.type === 'number') {
|
|
143
|
+
const step = otherProps.step ? Number(otherProps.step) : 1;
|
|
144
|
+
if (e.key === 'ArrowUp') {
|
|
145
|
+
let newValue = (Number.parseFloat(e.currentTarget.value) || 0) + step;
|
|
146
|
+
if (otherProps.max !== undefined && newValue > Number(otherProps.max)) {
|
|
147
|
+
newValue = Number(otherProps.max);
|
|
148
|
+
}
|
|
149
|
+
e.currentTarget.value = newValue.toString();
|
|
150
|
+
onChange(e);
|
|
151
|
+
} else if (e.key === 'ArrowDown') {
|
|
152
|
+
let newValue = (Number.parseFloat(e.currentTarget.value) || 0) - step;
|
|
153
|
+
if (otherProps.min !== undefined && newValue < Number(otherProps.min)) {
|
|
154
|
+
newValue = Number(otherProps.min);
|
|
157
155
|
}
|
|
156
|
+
e.currentTarget.value = newValue.toString();
|
|
157
|
+
onChange(e);
|
|
158
158
|
}
|
|
159
|
-
},
|
|
160
|
-
[onKeyDown, onEnter, otherProps.type, otherProps.step, otherProps.max, otherProps.min, onChange]
|
|
161
|
-
);
|
|
162
|
-
|
|
163
|
-
// Effects
|
|
164
|
-
useOnChangeDone(onChangeDone, innerRef);
|
|
165
|
-
|
|
166
|
-
useEffect(() => {
|
|
167
|
-
// Add the onChangeDone for numbers
|
|
168
|
-
if (otherProps.type === "number") {
|
|
169
|
-
const elem = innerRef.current;
|
|
170
|
-
elem?.addEventListener('blur', onChangeDone);
|
|
171
|
-
return () => {
|
|
172
|
-
elem?.removeEventListener('blur', onChangeDone);
|
|
173
|
-
};
|
|
174
159
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
160
|
+
},
|
|
161
|
+
[onKeyDown, onEnter, otherProps.type, otherProps.step, otherProps.max, otherProps.min, onChange],
|
|
162
|
+
);
|
|
163
|
+
|
|
164
|
+
// Effects
|
|
165
|
+
useOnChangeDone(onChangeDone, innerRef);
|
|
166
|
+
|
|
167
|
+
useEffect(() => {
|
|
168
|
+
// Add the onChangeDone for numbers
|
|
169
|
+
if (otherProps.type === 'number') {
|
|
170
|
+
const elem = innerRef.current;
|
|
171
|
+
elem?.addEventListener('blur', onChangeDone);
|
|
172
|
+
return () => {
|
|
173
|
+
elem?.removeEventListener('blur', onChangeDone);
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
return undefined;
|
|
177
|
+
}, [ref, onChangeDone, innerRef, otherProps.type]);
|
|
178
|
+
|
|
179
|
+
// Other
|
|
180
|
+
|
|
181
|
+
// Render Functions
|
|
182
|
+
|
|
183
|
+
return (
|
|
184
|
+
// The label has an input-area-element. This is okay
|
|
185
|
+
// eslint-disable-next-line jsx-a11y/label-has-associated-control
|
|
186
|
+
<label className={classNames(styles.input, { [styles.inline]: inline }, className)} style={style}>
|
|
187
|
+
{label ? <span className={styles.label}>{label}</span> : null}
|
|
188
|
+
<input
|
|
189
|
+
inputMode={otherProps.type === 'number' ? 'numeric' : undefined}
|
|
190
|
+
{...otherPropsWithoutData}
|
|
191
|
+
value={usedValue}
|
|
192
|
+
type={otherProps.type === 'number' ? 'text' : otherProps.type}
|
|
193
|
+
ref={refFunction}
|
|
194
|
+
className={styles.text}
|
|
195
|
+
onBlur={onBlur}
|
|
196
|
+
onChange={onChange}
|
|
197
|
+
onKeyDown={realOnKeyDown}
|
|
198
|
+
/>
|
|
199
|
+
<FormError error={error} />
|
|
200
|
+
</label>
|
|
201
|
+
);
|
|
202
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
|
|
3
|
+
import { PasswordInput } from '@/Components/FormElements/Input/PasswordInput/PasswordInput';
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
component: PasswordInput,
|
|
7
|
+
} satisfies Meta<typeof PasswordInput>;
|
|
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: '',
|
|
17
|
+
label: 'Label',
|
|
18
|
+
placeholder: 'Placeholder',
|
|
19
|
+
error: '',
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const Error: Story = {
|
|
24
|
+
args: {
|
|
25
|
+
inline: false,
|
|
26
|
+
defaultValue: '',
|
|
27
|
+
label: 'Label',
|
|
28
|
+
placeholder: 'Placeholder',
|
|
29
|
+
error: 'Wrong Value',
|
|
30
|
+
},
|
|
31
|
+
};
|
|
@@ -1,27 +1,32 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { Icon } from '../../../Icon/Icon';
|
|
1
|
+
import { Clickable } from '@/Components/Clickable/Clickable';
|
|
2
|
+
import { Flex } from '@/Components/Layout/Flex';
|
|
3
|
+
import { Grow } from '@/Components/Layout/Grow';
|
|
4
|
+
import { Icon } from '@/Components/Icon/Icon';
|
|
5
|
+
import { Input } from '@/Components/FormElements/Input/Input';
|
|
7
6
|
import { faEye, faEyeSlash } from '@fortawesome/free-solid-svg-icons';
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
7
|
+
import { withMemo } from '@/helper/withMemo';
|
|
8
|
+
import React, { useCallback, useState } from 'react';
|
|
10
9
|
import classNames from 'classnames';
|
|
11
|
-
import
|
|
10
|
+
import styles from '@/Components/FormElements/Input/PasswordInput/passwordInput.module.scss';
|
|
11
|
+
import type { DistributiveOmit } from '@/helper/DistributiveOmit';
|
|
12
|
+
import type { ForwardedRef } from 'react';
|
|
13
|
+
import type { InputProps } from '@/Components/FormElements/Input/Input';
|
|
12
14
|
|
|
13
15
|
export type PasswordInputProps<OnChangeData, OnBlurData, OnChangeEndData> = DistributiveOmit<
|
|
14
16
|
InputProps<OnChangeData, OnBlurData, OnChangeEndData>,
|
|
15
|
-
'type'|
|
|
17
|
+
'type' | 'onChangeText' | 'onEnter'
|
|
16
18
|
> & {
|
|
17
19
|
onChangeText?: (newText: string) => void;
|
|
18
20
|
onEnter?: (newText: string) => void;
|
|
19
|
-
ref?: ForwardedRef<HTMLInputElement
|
|
21
|
+
ref?: ForwardedRef<HTMLInputElement>;
|
|
20
22
|
};
|
|
21
23
|
|
|
22
|
-
export const PasswordInput = withMemo(function PasswordInput<OnChangeData, OnBlurData, OnChangeEndData>(
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
export const PasswordInput = withMemo(function PasswordInput<OnChangeData, OnBlurData, OnChangeEndData>({
|
|
25
|
+
className,
|
|
26
|
+
style,
|
|
27
|
+
ref,
|
|
28
|
+
...props
|
|
29
|
+
}: PasswordInputProps<OnChangeData, OnBlurData, OnChangeEndData>) {
|
|
25
30
|
// Variables
|
|
26
31
|
const [isVisible, setIsVisible] = useState(false);
|
|
27
32
|
|
|
@@ -49,5 +54,4 @@ export const PasswordInput = withMemo(function PasswordInput<OnChangeData, OnBlu
|
|
|
49
54
|
</Clickable>
|
|
50
55
|
</Flex>
|
|
51
56
|
);
|
|
52
|
-
}
|
|
53
|
-
styles);
|
|
57
|
+
});
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
@use "../../../scss/variables" as variables;
|
|
2
|
+
@use "../../../scss/designMixin" as mixin;
|
|
3
|
+
@use "../../../scss/vars" as *;
|
|
4
|
+
|
|
5
|
+
@include vars {
|
|
6
|
+
--input-inline-label-basis: 50%;
|
|
7
|
+
--input-text-background-color: transparent;
|
|
8
|
+
--hidden-input-text-border-bottom-color: transparent;
|
|
9
|
+
--hidden-input-no-focus-hint-border-bottom-color: transparent;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@include mixin.design(variables.$material) {
|
|
13
|
+
--input-text-color: var(--text-primary);
|
|
14
|
+
--input-background-image: linear-gradient(to top, transparent 1px, var(--border-light) 1px);
|
|
15
|
+
--input-focused-background-image: linear-gradient(var(--flavor-accent), var(--flavor-accent)), linear-gradient(to top, transparent 1px, var(--border-light) 1px);
|
|
16
|
+
--input-read-only-border-bottom-color: transparent;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@include mixin.design(variables.$flat) {
|
|
20
|
+
--input-text-color: var(--text-primary);
|
|
21
|
+
--input-border-bottom-color: var(--border-light);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.input {
|
|
25
|
+
width: 100%;
|
|
26
|
+
|
|
27
|
+
&.inline {
|
|
28
|
+
display: flex;
|
|
29
|
+
|
|
30
|
+
.label {
|
|
31
|
+
display: inline-block;
|
|
32
|
+
flex: 1 0 var(--input-inline-label-basis);
|
|
33
|
+
font-weight: normal;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.text {
|
|
37
|
+
// enough for 3 numbers, should maybe be in em
|
|
38
|
+
min-width: 41px;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.label {
|
|
43
|
+
display: block;
|
|
44
|
+
font-weight: bold;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.text {
|
|
48
|
+
width: 100%;
|
|
49
|
+
background-color: var(--input-text-background-color);
|
|
50
|
+
color: var(--input-text-color);
|
|
51
|
+
border: 0;
|
|
52
|
+
outline: none;
|
|
53
|
+
padding: 0;
|
|
54
|
+
font-size: 1rem;
|
|
55
|
+
|
|
56
|
+
@include mixin.design(variables.$material) {
|
|
57
|
+
background-image: var(--input-background-image);
|
|
58
|
+
background-size: 100% 2px;
|
|
59
|
+
background-repeat: no-repeat;
|
|
60
|
+
background-position: center bottom;
|
|
61
|
+
padding-bottom: 2px;
|
|
62
|
+
|
|
63
|
+
&:read-only, &:read-only:focus {
|
|
64
|
+
background-image: none;
|
|
65
|
+
border-bottom: 1px solid var(--input-read-only-border-bottom-color);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
&:focus {
|
|
69
|
+
background-image: var(--input-focused-background-image);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@include mixin.design(variables.$flat) {
|
|
74
|
+
&, &:focus {
|
|
75
|
+
border-bottom: 1px solid var(--input-border-bottom-color);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
&.hiddenInput {
|
|
81
|
+
.text {
|
|
82
|
+
background-image: none;
|
|
83
|
+
border-bottom: 1px solid var(--hidden-input-text-border-bottom-color);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
&.noFocusHint {
|
|
87
|
+
.text {
|
|
88
|
+
&:focus {
|
|
89
|
+
background-image: none;
|
|
90
|
+
border-bottom: 1px solid var(--hidden-input-no-focus-hint-border-bottom-color);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|