@effijs/templates 0.0.0-stage → 1.0.0-alpha.0
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/CONTRIBUTING.md +27 -0
- package/LICENSE +22 -0
- package/README.md +32 -2
- package/ai/SETUP.md +5 -0
- package/docs/catalog.md +85 -0
- package/forge.manifest.js +75 -0
- package/lib/compat.js +40 -0
- package/lib/docs/build.js +146 -0
- package/lib/install.js +51 -0
- package/lib/journal.js +40 -0
- package/lib/jsonConfig.js +33 -0
- package/lib/migration.js +35 -0
- package/lib/names.js +42 -0
- package/lib/patch.js +62 -0
- package/lib/paths.js +12 -0
- package/lib/project.js +48 -0
- package/lib/registry.js +99 -0
- package/package.json +46 -4
- package/platforms/react-native/CATALOG.md +391 -0
- package/platforms/react-native/ORIGIN.md +42 -0
- package/platforms/react-native/README.md +78 -0
- package/platforms/react-native/ai/AGENTS.md.hbs +36 -0
- package/platforms/react-native/ai/SETUP.md +89 -0
- package/platforms/react-native/compat/matrix.js +150 -0
- package/platforms/react-native/configs/babel.js +63 -0
- package/platforms/react-native/configs/forgeConfig.js +35 -0
- package/platforms/react-native/configs/jsConfigs.js +96 -0
- package/platforms/react-native/configs/metro.js +86 -0
- package/platforms/react-native/generators/add/generator.js +12 -0
- package/platforms/react-native/generators/add/run.js +64 -0
- package/platforms/react-native/generators/component/generator.js +75 -0
- package/platforms/react-native/generators/component/render.js +69 -0
- package/platforms/react-native/generators/component/templates/Common.tsx.hbs +13 -0
- package/platforms/react-native/generators/component/templates/index.ts.hbs +13 -0
- package/platforms/react-native/generators/component/templates/pm.ts.hbs +7 -0
- package/platforms/react-native/generators/component/templates/types.ts.hbs +3 -0
- package/platforms/react-native/generators/demo/files/api/app.http +8 -0
- package/platforms/react-native/generators/demo/files/api/environment/http-client.env.json +5 -0
- package/platforms/react-native/generators/demo/files/entity/category/category.api.ts +18 -0
- package/platforms/react-native/generators/demo/files/entity/category/category.dto.ts +15 -0
- package/platforms/react-native/generators/demo/files/entity/category/category.service.ts +42 -0
- package/platforms/react-native/generators/demo/files/entity/category/category.store.ts +26 -0
- package/platforms/react-native/generators/demo/files/entity/category/index.ts +2 -0
- package/platforms/react-native/generators/demo/files/entity/product/index.ts +2 -0
- package/platforms/react-native/generators/demo/files/entity/product/product.api.ts +49 -0
- package/platforms/react-native/generators/demo/files/entity/product/product.dto.ts +120 -0
- package/platforms/react-native/generators/demo/files/entity/product/product.service.ts +139 -0
- package/platforms/react-native/generators/demo/files/entity/product/product.store.ts +37 -0
- package/platforms/react-native/generators/demo/files/feature/product/components/Product.CategorySelect.tsx +36 -0
- package/platforms/react-native/generators/demo/files/feature/product/detail/Product.Detail.Screen.tsx +100 -0
- package/platforms/react-native/generators/demo/files/feature/product/detail/product.detail.service.ts +33 -0
- package/platforms/react-native/generators/demo/files/feature/product/filter/Product.Filter.Screen.tsx +59 -0
- package/platforms/react-native/generators/demo/files/feature/product/filter/product.filter.service.ts +78 -0
- package/platforms/react-native/generators/demo/files/feature/product/form/Product.Form.Screen.tsx +71 -0
- package/platforms/react-native/generators/demo/files/feature/product/form/product.form.service.ts +142 -0
- package/platforms/react-native/generators/demo/files/feature/product/index.ts +7 -0
- package/platforms/react-native/generators/demo/files/feature/product/list/Product.List.Item.tsx +34 -0
- package/platforms/react-native/generators/demo/files/feature/product/list/Product.List.Screen.tsx +106 -0
- package/platforms/react-native/generators/demo/files/feature/product/list/product.list.service.ts +47 -0
- package/platforms/react-native/generators/demo/files/feature/product/product.feature.ts +29 -0
- package/platforms/react-native/generators/demo/files/feature/product/product.hooks.ts +7 -0
- package/platforms/react-native/generators/demo/files/feature/product/search/Product.Search.Screen.tsx +82 -0
- package/platforms/react-native/generators/demo/files/feature/product/search/product.search.service.ts +97 -0
- package/platforms/react-native/generators/demo/files/navigation/navigation.product.ts +46 -0
- package/platforms/react-native/generators/demo/generator.js +93 -0
- package/platforms/react-native/generators/entity/generator.js +68 -0
- package/platforms/react-native/generators/feature/generator.js +224 -0
- package/platforms/react-native/generators/feature/render.js +163 -0
- package/platforms/react-native/generators/feature/templates/detail.screen.tsx.hbs +25 -0
- package/platforms/react-native/generators/feature/templates/detail.service.ts.hbs +14 -0
- package/platforms/react-native/generators/feature/templates/feature.ts.hbs +18 -0
- package/platforms/react-native/generators/feature/templates/filter.screen.tsx.hbs +17 -0
- package/platforms/react-native/generators/feature/templates/filter.service.ts.hbs +14 -0
- package/platforms/react-native/generators/feature/templates/form.screen.tsx.hbs +21 -0
- package/platforms/react-native/generators/feature/templates/form.service.ts.hbs +37 -0
- package/platforms/react-native/generators/feature/templates/hooks.ts.hbs +7 -0
- package/platforms/react-native/generators/feature/templates/index.ts.hbs +2 -0
- package/platforms/react-native/generators/feature/templates/list.item.tsx.hbs +16 -0
- package/platforms/react-native/generators/feature/templates/list.screen.tsx.hbs +34 -0
- package/platforms/react-native/generators/feature/templates/list.service.ts.hbs +15 -0
- package/platforms/react-native/generators/feature/templates/navigation.ts.hbs +12 -0
- package/platforms/react-native/generators/feature/templates/search.screen.tsx.hbs +24 -0
- package/platforms/react-native/generators/feature/templates/search.service.ts.hbs +13 -0
- package/platforms/react-native/generators/feature/templates/tab.tsx.hbs +8 -0
- package/platforms/react-native/generators/init/files/app/app.controller.ts +41 -0
- package/platforms/react-native/generators/init/files/app/app.error.ts +1 -0
- package/platforms/react-native/generators/init/files/app/app.store.ts +12 -0
- package/platforms/react-native/generators/init/files/app/index.ts +19 -0
- package/platforms/react-native/generators/init/files/app/splash/Onboarding.Screen.tsx +31 -0
- package/platforms/react-native/generators/init/files/app/splash/Splash.Screen.tsx +14 -0
- package/platforms/react-native/generators/init/files/app/tabs/home/Home.tab.tsx +24 -0
- package/platforms/react-native/generators/init/files/app/tabs/profile/Profile.tab.tsx +1 -0
- package/platforms/react-native/generators/init/files/configs/dev.ts.hbs +5 -0
- package/platforms/react-native/generators/init/files/configs/index.ts +4 -0
- package/platforms/react-native/generators/init/files/configs/prod.ts.hbs +5 -0
- package/platforms/react-native/generators/init/files/entity/auth/auth.api.ts +36 -0
- package/platforms/react-native/generators/init/files/entity/auth/auth.dto.ts +26 -0
- package/platforms/react-native/generators/init/files/entity/auth/auth.service.ts +94 -0
- package/platforms/react-native/generators/init/files/entity/auth/auth.session.store.ts +14 -0
- package/platforms/react-native/generators/init/files/entity/auth/auth.store.ts +20 -0
- package/platforms/react-native/generators/init/files/entity/auth/index.ts +2 -0
- package/platforms/react-native/generators/init/files/entity/index.ts +2 -0
- package/platforms/react-native/generators/init/files/feature/auth/auth.feature.ts +10 -0
- package/platforms/react-native/generators/init/files/feature/auth/auth.hooks.ts +7 -0
- package/platforms/react-native/generators/init/files/feature/auth/index.ts +1 -0
- package/platforms/react-native/generators/init/files/feature/auth/sign-in/SignIn.Screen.tsx +39 -0
- package/platforms/react-native/generators/init/files/feature/auth/sign-in/signIn.service.ts +54 -0
- package/platforms/react-native/generators/init/files/feature/auth/sign-up/SignUp.Screen.tsx +64 -0
- package/platforms/react-native/generators/init/files/feature/auth/sign-up/signUp.service.ts +73 -0
- package/platforms/react-native/generators/init/files/feature/feature.hooks.ts +15 -0
- package/platforms/react-native/generators/init/files/feature/index.ts +3 -0
- package/platforms/react-native/generators/init/files/feature/profile/Profile.Screen.tsx +52 -0
- package/platforms/react-native/generators/init/files/feature/profile/index.ts +1 -0
- package/platforms/react-native/generators/init/files/feature/profile/profile.feature.ts +18 -0
- package/platforms/react-native/generators/init/files/feature/profile/profile.hooks.ts +7 -0
- package/platforms/react-native/generators/init/files/index.ts +16 -0
- package/platforms/react-native/generators/init/files/navigation/index.ts +18 -0
- package/platforms/react-native/generators/init/files/navigation/navigation.app.ts +58 -0
- package/platforms/react-native/generators/init/files/navigation/navigation.features.ts +9 -0
- package/platforms/react-native/generators/init/files/navigation/navigation.hooks.ts +5 -0
- package/platforms/react-native/generators/init/files/navigation/navigation.tabs.ts +55 -0
- package/platforms/react-native/generators/init/files/navigation/navigation.widgets.ts +23 -0
- package/platforms/react-native/generators/init/files/services/http/http.base.ts +69 -0
- package/platforms/react-native/generators/init/files/services/http/http.error.ts +10 -0
- package/platforms/react-native/generators/init/files/services/http/http.service.ts +24 -0
- package/platforms/react-native/generators/init/files/services/http/middleware/index.ts +12 -0
- package/platforms/react-native/generators/init/files/services/http/middleware/middleware.error.ts +36 -0
- package/platforms/react-native/generators/init/files/services/http/middleware/middleware.registry.ts +3 -0
- package/platforms/react-native/generators/init/files/services/http/middleware/middleware.token.ts +97 -0
- package/platforms/react-native/generators/init/files/services/index.ts +15 -0
- package/platforms/react-native/generators/init/files/ui/components/Box/Common.tsx +19 -0
- package/platforms/react-native/generators/init/files/ui/components/Box/box.pm.ts +111 -0
- package/platforms/react-native/generators/init/files/ui/components/Box/box.types.ts +8 -0
- package/platforms/react-native/generators/init/files/ui/components/Box/index.ts +13 -0
- package/platforms/react-native/generators/init/files/ui/components/Button/Common.tsx +50 -0
- package/platforms/react-native/generators/init/files/ui/components/Button/Touchable.tsx +19 -0
- package/platforms/react-native/generators/init/files/ui/components/Button/button.pm.ts +197 -0
- package/platforms/react-native/generators/init/files/ui/components/Button/button.types.ts +22 -0
- package/platforms/react-native/generators/init/files/ui/components/Button/button.utils.ts +16 -0
- package/platforms/react-native/generators/init/files/ui/components/Button/index.ts +19 -0
- package/platforms/react-native/generators/init/files/ui/components/Form/Colours.tsx +50 -0
- package/platforms/react-native/generators/init/files/ui/components/Form/Common.tsx +38 -0
- package/platforms/react-native/generators/init/files/ui/components/Form/ErrorText.tsx +11 -0
- package/platforms/react-native/generators/init/files/ui/components/Form/Input.tsx +115 -0
- package/platforms/react-native/generators/init/files/ui/components/Form/InputArea.tsx +70 -0
- package/platforms/react-native/generators/init/files/ui/components/Form/Label.tsx +18 -0
- package/platforms/react-native/generators/init/files/ui/components/Form/Select.tsx +86 -0
- package/platforms/react-native/generators/init/files/ui/components/Form/components/SecureTextEntry.tsx +19 -0
- package/platforms/react-native/generators/init/files/ui/components/Form/form.error.ts +18 -0
- package/platforms/react-native/generators/init/files/ui/components/Form/form.pm.ts +134 -0
- package/platforms/react-native/generators/init/files/ui/components/Form/form.types.ts +59 -0
- package/platforms/react-native/generators/init/files/ui/components/Form/index.ts +67 -0
- package/platforms/react-native/generators/init/files/ui/components/Grid/Common.tsx +11 -0
- package/platforms/react-native/generators/init/files/ui/components/Grid/grid.pm.ts +93 -0
- package/platforms/react-native/generators/init/files/ui/components/Grid/grid.types.ts +79 -0
- package/platforms/react-native/generators/init/files/ui/components/Grid/index.ts +13 -0
- package/platforms/react-native/generators/init/files/ui/components/Icon/Common.tsx +19 -0
- package/platforms/react-native/generators/init/files/ui/components/Icon/icons.pm.ts +74 -0
- package/platforms/react-native/generators/init/files/ui/components/Icon/icons.types.ts +19 -0
- package/platforms/react-native/generators/init/files/ui/components/Icon/index.ts +3 -0
- package/platforms/react-native/generators/init/files/ui/components/Loading/Loading.tsx +10 -0
- package/platforms/react-native/generators/init/files/ui/components/Loading/loading.hook.ts +5 -0
- package/platforms/react-native/generators/init/files/ui/components/Loading/loading.service.ts +22 -0
- package/platforms/react-native/generators/init/files/ui/components/Loading/loading.store.ts +8 -0
- package/platforms/react-native/generators/init/files/ui/components/Screen/Common.tsx +87 -0
- package/platforms/react-native/generators/init/files/ui/components/Screen/Content.tsx +77 -0
- package/platforms/react-native/generators/init/files/ui/components/Screen/Header.tsx +80 -0
- package/platforms/react-native/generators/init/files/ui/components/Screen/HeaderTab.tsx +17 -0
- package/platforms/react-native/generators/init/files/ui/components/Screen/SafeAreaHOC.tsx +9 -0
- package/platforms/react-native/generators/init/files/ui/components/Screen/index.ts +22 -0
- package/platforms/react-native/generators/init/files/ui/components/Text/Common.tsx +20 -0
- package/platforms/react-native/generators/init/files/ui/components/Text/index.ts +13 -0
- package/platforms/react-native/generators/init/files/ui/components/Text/text.pm.ts +55 -0
- package/platforms/react-native/generators/init/files/ui/components/Text/text.types.ts +27 -0
- package/platforms/react-native/generators/init/files/ui/components/TextInput/Common.tsx +19 -0
- package/platforms/react-native/generators/init/files/ui/components/TextInput/index.ts +15 -0
- package/platforms/react-native/generators/init/files/ui/components/TextInput/textInput.pm.ts +65 -0
- package/platforms/react-native/generators/init/files/ui/components/TextInput/textInput.types.ts +16 -0
- package/platforms/react-native/generators/init/files/ui/components/ThemePicker/ThemePicker.tsx +92 -0
- package/platforms/react-native/generators/init/files/ui/components/ThemePicker/index.ts +1 -0
- package/platforms/react-native/generators/init/files/ui/components/index.ts +27 -0
- package/platforms/react-native/generators/init/files/ui/components/utils/color.ts +19 -0
- package/platforms/react-native/generators/init/files/ui/components/utils/index.ts +3 -0
- package/platforms/react-native/generators/init/files/ui/components/utils/useLoading.hook.spec.tsx +202 -0
- package/platforms/react-native/generators/init/files/ui/components/utils/useLoading.hook.ts +172 -0
- package/platforms/react-native/generators/init/files/ui/components/utils/useStore.ts +34 -0
- package/platforms/react-native/generators/init/files/ui/fonts/font-icons.ttf +0 -0
- package/platforms/react-native/generators/init/files/ui/icons/font-icons.json +53 -0
- package/platforms/react-native/generators/init/files/ui/icons/logo.png +0 -0
- package/platforms/react-native/generators/init/files/ui/icons/logo.svg +304 -0
- package/platforms/react-native/generators/init/files/ui/icons/tabs/icon-1.png +0 -0
- package/platforms/react-native/generators/init/files/ui/icons/tabs/icon-2.png +0 -0
- package/platforms/react-native/generators/init/files/ui/theme/black/black.color.ts +8 -0
- package/platforms/react-native/generators/init/files/ui/theme/black/index.ts +10 -0
- package/platforms/react-native/generators/init/files/ui/theme/blue/blue.color.ts +8 -0
- package/platforms/react-native/generators/init/files/ui/theme/blue/index.ts +10 -0
- package/platforms/react-native/generators/init/files/ui/theme/green/green.color.ts +8 -0
- package/platforms/react-native/generators/init/files/ui/theme/green/index.ts +10 -0
- package/platforms/react-native/generators/init/files/ui/theme/index.ts +11 -0
- package/platforms/react-native/generators/init/files/ui/theme/pink/index.ts +10 -0
- package/platforms/react-native/generators/init/files/ui/theme/pink/pink.color.ts +8 -0
- package/platforms/react-native/generators/init/files/ui/theme/scheme/index.ts +23 -0
- package/platforms/react-native/generators/init/files/ui/theme/scheme/theme.scheme.color.ts +139 -0
- package/platforms/react-native/generators/init/files/ui/theme/scheme/theme.scheme.radius.ts +21 -0
- package/platforms/react-native/generators/init/files/ui/theme/scheme/theme.scheme.spacing.ts +24 -0
- package/platforms/react-native/generators/init/files/ui/theme/scheme/theme.scheme.ts +25 -0
- package/platforms/react-native/generators/init/files/ui/theme/scheme/theme.scheme.typography.ts +98 -0
- package/platforms/react-native/generators/init/files/ui/theme/shared/index.ts +4 -0
- package/platforms/react-native/generators/init/files/ui/theme/shared/shared.color.base.ts +79 -0
- package/platforms/react-native/generators/init/files/ui/theme/shared/shared.radius.ts +8 -0
- package/platforms/react-native/generators/init/files/ui/theme/shared/shared.spacing.ts +9 -0
- package/platforms/react-native/generators/init/files/ui/theme/shared/shared.typography.ts +105 -0
- package/platforms/react-native/generators/init/files/ui/theme/theme.hooks.ts +7 -0
- package/platforms/react-native/generators/init/files/ui/theme/theme.meta.ts +10 -0
- package/platforms/react-native/generators/init/files/ui/theme/theme.provider.tsx +19 -0
- package/platforms/react-native/generators/init/files/ui/theme/theme.service.ts +36 -0
- package/platforms/react-native/generators/init/files/ui/theme/theme.ts +27 -0
- package/platforms/react-native/generators/init/files/ui/widgets/index.ts +1 -0
- package/platforms/react-native/generators/init/files/ui/widgets/toast/Toast.Item.tsx +175 -0
- package/platforms/react-native/generators/init/files/ui/widgets/toast/Toast.Overlay.tsx +46 -0
- package/platforms/react-native/generators/init/files/ui/widgets/toast/Toast.Stack.tsx +75 -0
- package/platforms/react-native/generators/init/files/ui/widgets/toast/index.ts +7 -0
- package/platforms/react-native/generators/init/files/ui/widgets/toast/toast.hooks.ts +18 -0
- package/platforms/react-native/generators/init/files/ui/widgets/toast/toast.service.ts +39 -0
- package/platforms/react-native/generators/init/files/ui/widgets/toast/toast.store.ts +59 -0
- package/platforms/react-native/generators/init/files/ui/widgets/toast/toast.types.ts +18 -0
- package/platforms/react-native/generators/init/files/ui/widgets/widgets.feature.ts +14 -0
- package/platforms/react-native/generators/init/files/utils/date.ts +11 -0
- package/platforms/react-native/generators/init/files/utils/index.ts +12 -0
- package/platforms/react-native/generators/init/files/utils/store.persistent.ts +103 -0
- package/platforms/react-native/generators/init/files/utils/store.registry.ts +14 -0
- package/platforms/react-native/generators/init/files/utils/string.ts +100 -0
- package/platforms/react-native/generators/init/generator.js +86 -0
- package/platforms/react-native/generators/init/kit.js +23 -0
- package/platforms/react-native/generators/init/navigators/expo-router/index.ts +18 -0
- package/platforms/react-native/generators/init/navigators/expo-router/navigation.app.ts +8 -0
- package/platforms/react-native/generators/init/navigators/expo-router/navigation.features.ts +9 -0
- package/platforms/react-native/generators/init/navigators/expo-router/navigation.hooks.ts +5 -0
- package/platforms/react-native/generators/init/navigators/expo-router/navigation.tabs.ts +7 -0
- package/platforms/react-native/generators/init/navigators/expo-router/navigation.widgets.ts +5 -0
- package/platforms/react-native/generators/init/navigators/react-navigation/index.ts +18 -0
- package/platforms/react-native/generators/init/navigators/react-navigation/navigation.app.ts +8 -0
- package/platforms/react-native/generators/init/navigators/react-navigation/navigation.features.ts +9 -0
- package/platforms/react-native/generators/init/navigators/react-navigation/navigation.hooks.ts +5 -0
- package/platforms/react-native/generators/init/navigators/react-navigation/navigation.tabs.ts +7 -0
- package/platforms/react-native/generators/init/navigators/react-navigation/navigation.widgets.ts +5 -0
- package/platforms/react-native/generators/setup/generator.js +225 -0
- package/platforms/react-native/generators/util/generator.js +12 -0
- package/platforms/react-native/platform.js +32 -0
- package/platforms/react-native/runtime.js +57 -0
- package/platforms/react-native/solutions/components/BottomSheet/README.md +29 -0
- package/platforms/react-native/solutions/components/BottomSheet/files/Common.tsx +120 -0
- package/platforms/react-native/solutions/components/BottomSheet/files/Content.tsx +57 -0
- package/platforms/react-native/solutions/components/BottomSheet/files/Context.tsx +22 -0
- package/platforms/react-native/solutions/components/BottomSheet/files/FlatList.tsx +50 -0
- package/platforms/react-native/solutions/components/BottomSheet/files/Header.tsx +57 -0
- package/platforms/react-native/solutions/components/BottomSheet/files/Search.tsx +24 -0
- package/platforms/react-native/solutions/components/BottomSheet/files/bottomSheet.constants.ts +13 -0
- package/platforms/react-native/solutions/components/BottomSheet/files/bottomSheet.types.ts +31 -0
- package/platforms/react-native/solutions/components/BottomSheet/files/index.ts +33 -0
- package/platforms/react-native/solutions/components/BottomSheet/solution.js +38 -0
- package/platforms/react-native/solutions/components/BottomSheetWidgets/README.md +29 -0
- package/platforms/react-native/solutions/components/BottomSheetWidgets/files/SelectPicker.tsx +47 -0
- package/platforms/react-native/solutions/components/BottomSheetWidgets/files/bottomSheet/Content.BottomSheet.tsx +22 -0
- package/platforms/react-native/solutions/components/BottomSheetWidgets/files/bottomSheet/DateTimePicker.BottomSheet.tsx +74 -0
- package/platforms/react-native/solutions/components/BottomSheetWidgets/files/bottomSheet/List.BottomSheet.tsx +62 -0
- package/platforms/react-native/solutions/components/BottomSheetWidgets/solution.js +49 -0
- package/platforms/react-native/solutions/components/Calendar/README.md +29 -0
- package/platforms/react-native/solutions/components/Calendar/files/Common.tsx +16 -0
- package/platforms/react-native/solutions/components/Calendar/files/Context.tsx +466 -0
- package/platforms/react-native/solutions/components/Calendar/files/DayCell.tsx +89 -0
- package/platforms/react-native/solutions/components/Calendar/files/MonthView.tsx +41 -0
- package/platforms/react-native/solutions/components/Calendar/files/MonthYearOverlay.tsx +51 -0
- package/platforms/react-native/solutions/components/Calendar/files/SwipeablePeriod.tsx +44 -0
- package/platforms/react-native/solutions/components/Calendar/files/WeekDayTitles.tsx +31 -0
- package/platforms/react-native/solutions/components/Calendar/files/WeekView.tsx +40 -0
- package/platforms/react-native/solutions/components/Calendar/files/calendar.styles.ts +142 -0
- package/platforms/react-native/solutions/components/Calendar/files/calendar.types.ts +126 -0
- package/platforms/react-native/solutions/components/Calendar/files/calendar.utils.ts +143 -0
- package/platforms/react-native/solutions/components/Calendar/files/index.ts +40 -0
- package/platforms/react-native/solutions/components/Calendar/solution.js +38 -0
- package/platforms/react-native/solutions/components/Chart/README.md +29 -0
- package/platforms/react-native/solutions/components/Chart/files/Cilcular.tsx +140 -0
- package/platforms/react-native/solutions/components/Chart/files/index.ts +3 -0
- package/platforms/react-native/solutions/components/Chart/solution.js +38 -0
- package/platforms/react-native/solutions/components/CheckBox/README.md +29 -0
- package/platforms/react-native/solutions/components/CheckBox/files/Common.tsx +55 -0
- package/platforms/react-native/solutions/components/CheckBox/files/checkbox.pm.ts +71 -0
- package/platforms/react-native/solutions/components/CheckBox/files/index.ts +9 -0
- package/platforms/react-native/solutions/components/CheckBox/form/Checkbox.tsx +22 -0
- package/platforms/react-native/solutions/components/CheckBox/solution.js +57 -0
- package/platforms/react-native/solutions/components/DateTimePicker/README.md +29 -0
- package/platforms/react-native/solutions/components/DateTimePicker/files/DateTimePicker.tsx +44 -0
- package/platforms/react-native/solutions/components/DateTimePicker/solution.js +45 -0
- package/platforms/react-native/solutions/components/Image/README.md +29 -0
- package/platforms/react-native/solutions/components/Image/files/SVG.tsx +74 -0
- package/platforms/react-native/solutions/components/Image/files/image.pm.ts +25 -0
- package/platforms/react-native/solutions/components/Image/files/image.utils.ts +35 -0
- package/platforms/react-native/solutions/components/Image/files/index.ts +5 -0
- package/platforms/react-native/solutions/components/Image/solution.js +40 -0
- package/platforms/react-native/solutions/components/InputSecurity/README.md +29 -0
- package/platforms/react-native/solutions/components/InputSecurity/files/InputSecurity.ts +142 -0
- package/platforms/react-native/solutions/components/InputSecurity/solution.js +28 -0
- package/platforms/react-native/solutions/components/OTP/README.md +29 -0
- package/platforms/react-native/solutions/components/OTP/files/Item.tsx +16 -0
- package/platforms/react-native/solutions/components/OTP/files/Items.tsx +33 -0
- package/platforms/react-native/solutions/components/OTP/files/index.tsx +120 -0
- package/platforms/react-native/solutions/components/OTP/files/otp.pm.ts +30 -0
- package/platforms/react-native/solutions/components/OTP/solution.js +38 -0
- package/platforms/react-native/solutions/components/ProgressIndicator/README.md +29 -0
- package/platforms/react-native/solutions/components/ProgressIndicator/files/Circular.tsx +154 -0
- package/platforms/react-native/solutions/components/ProgressIndicator/files/Linear.tsx +133 -0
- package/platforms/react-native/solutions/components/ProgressIndicator/files/circular.pm.ts +34 -0
- package/platforms/react-native/solutions/components/ProgressIndicator/files/index.ts +16 -0
- package/platforms/react-native/solutions/components/ProgressIndicator/solution.js +39 -0
- package/platforms/react-native/solutions/components/Ruler/README.md +29 -0
- package/platforms/react-native/solutions/components/Ruler/files/Common.tsx +44 -0
- package/platforms/react-native/solutions/components/Ruler/files/Context.tsx +210 -0
- package/platforms/react-native/solutions/components/Ruler/files/Track.tsx +686 -0
- package/platforms/react-native/solutions/components/Ruler/files/Value.tsx +60 -0
- package/platforms/react-native/solutions/components/Ruler/files/index.ts +23 -0
- package/platforms/react-native/solutions/components/Ruler/files/ruler.constants.ts +70 -0
- package/platforms/react-native/solutions/components/Ruler/files/ruler.types.ts +98 -0
- package/platforms/react-native/solutions/components/Ruler/files/ruler.utils.ts +332 -0
- package/platforms/react-native/solutions/components/Ruler/solution.js +38 -0
- package/platforms/react-native/solutions/components/Section/README.md +29 -0
- package/platforms/react-native/solutions/components/Section/files/Common.tsx +144 -0
- package/platforms/react-native/solutions/components/Section/solution.js +37 -0
- package/platforms/react-native/solutions/components/Slider/README.md +29 -0
- package/platforms/react-native/solutions/components/Slider/files/Container.tsx +5 -0
- package/platforms/react-native/solutions/components/Slider/files/Content.tsx +44 -0
- package/platforms/react-native/solutions/components/Slider/files/Context.tsx +30 -0
- package/platforms/react-native/solutions/components/Slider/files/Pagination.Dot.tsx +61 -0
- package/platforms/react-native/solutions/components/Slider/files/index.ts +22 -0
- package/platforms/react-native/solutions/components/Slider/solution.js +38 -0
- package/platforms/react-native/solutions/components/Switch/README.md +29 -0
- package/platforms/react-native/solutions/components/Switch/files/Common.tsx +38 -0
- package/platforms/react-native/solutions/components/Switch/files/index.ts +9 -0
- package/platforms/react-native/solutions/components/Switch/files/switch.pm.ts +53 -0
- package/platforms/react-native/solutions/components/Switch/solution.js +38 -0
- package/platforms/react-native/solutions/install.js +97 -0
- package/platforms/react-native/solutions/services/firebase-core/README.md +31 -0
- package/platforms/react-native/solutions/services/firebase-core/files/index.ts +5 -0
- package/platforms/react-native/solutions/services/firebase-core/solution.js +39 -0
- package/platforms/react-native/solutions/services/firebase-messaging/README.md +31 -0
- package/platforms/react-native/solutions/services/firebase-messaging/files/index.ts +20 -0
- package/platforms/react-native/solutions/services/firebase-messaging/solution.js +42 -0
- package/platforms/react-native/solutions/utils/permissions/README.md +29 -0
- package/platforms/react-native/solutions/utils/permissions/files/permissions.ts +10 -0
- package/platforms/react-native/solutions/utils/permissions/solution.js +32 -0
- package/presets/react-native-fsd/index.js +25 -0
- package/shared/generators/entity/render.js +88 -0
- package/shared/generators/entity/templates/crud/api.ts.hbs +36 -0
- package/shared/generators/entity/templates/crud/dto.ts.hbs +36 -0
- package/shared/generators/entity/templates/crud/service.ts.hbs +73 -0
- package/shared/generators/entity/templates/crud/store.ts.hbs +27 -0
- package/shared/generators/entity/templates/index.ts.hbs +2 -0
- package/shared/generators/entity/templates/simple/api.ts.hbs +16 -0
- package/shared/generators/entity/templates/simple/dto.ts.hbs +5 -0
- package/shared/generators/entity/templates/simple/service.ts.hbs +26 -0
- package/shared/generators/entity/templates/simple/store.ts.hbs +18 -0
- package/shared/solutions/utils/date/README.md +29 -0
- package/shared/solutions/utils/date/files/date.ts +11 -0
- package/shared/solutions/utils/date/solution.js +27 -0
- package/shared/solutions/utils/string/README.md +29 -0
- package/shared/solutions/utils/string/files/string.ts +100 -0
- package/shared/solutions/utils/string/solution.js +27 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Prop, Node, PropertyManager } from '@effijs/props-manager';
|
|
2
|
+
|
|
3
|
+
export const ImagePM = PropertyManager.create('Image').node(
|
|
4
|
+
Node('container')
|
|
5
|
+
.extends('Grid')
|
|
6
|
+
.keys(
|
|
7
|
+
'style',
|
|
8
|
+
Prop('style', ({ style }) => style),
|
|
9
|
+
Prop('width'),
|
|
10
|
+
Prop('height'),
|
|
11
|
+
),
|
|
12
|
+
|
|
13
|
+
Node('svg').keys(
|
|
14
|
+
Prop(
|
|
15
|
+
['color', 'theme'],
|
|
16
|
+
({ color, theme: themeName }, { theme }) => ({
|
|
17
|
+
color: color ? (theme.get(`color.${color}`, themeName) ?? color) : undefined,
|
|
18
|
+
}),
|
|
19
|
+
{ providers: ['theme'] },
|
|
20
|
+
),
|
|
21
|
+
Prop('width'),
|
|
22
|
+
Prop('height'),
|
|
23
|
+
// Prop('image'),
|
|
24
|
+
),
|
|
25
|
+
);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { launchImageLibrary, launchCamera, ImageLibraryOptions, ImagePickerResponse } from 'react-native-image-picker';
|
|
2
|
+
|
|
3
|
+
export async function getImageFromLibrary(props: Pick<ImageLibraryOptions, 'selectionLimit'>) {
|
|
4
|
+
const response = await launchImageLibrary({
|
|
5
|
+
maxWidth: 600,
|
|
6
|
+
maxHeight: 600,
|
|
7
|
+
mediaType: 'photo',
|
|
8
|
+
selectionLimit: props?.selectionLimit ?? 1,
|
|
9
|
+
presentationStyle: 'formSheet',
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
return parseResponse(response);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export async function getImageFromCamera() {
|
|
16
|
+
const response = await launchCamera({
|
|
17
|
+
maxWidth: 600,
|
|
18
|
+
maxHeight: 600,
|
|
19
|
+
mediaType: 'photo',
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
return parseResponse(response);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function parseResponse(response: ImagePickerResponse) {
|
|
26
|
+
if (response.didCancel) {
|
|
27
|
+
console.log('User cancelled photo picker');
|
|
28
|
+
return null;
|
|
29
|
+
} else if (response.errorCode) {
|
|
30
|
+
console.log('ImagePicker Error: ', response.errorCode, response.errorMessage);
|
|
31
|
+
throw new Error(response.errorMessage);
|
|
32
|
+
} else {
|
|
33
|
+
return response.assets;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"id": "component:Image",
|
|
3
|
+
"type": "component",
|
|
4
|
+
"platforms": [
|
|
5
|
+
"react-native"
|
|
6
|
+
],
|
|
7
|
+
"title": "Image",
|
|
8
|
+
"description": "Native and SVG image with theme sizing. SVG rendering uses Skia.",
|
|
9
|
+
"status": "stable",
|
|
10
|
+
"since": "1.0.0",
|
|
11
|
+
"tags": [
|
|
12
|
+
"ui",
|
|
13
|
+
"media"
|
|
14
|
+
],
|
|
15
|
+
"requires": [],
|
|
16
|
+
"dependencies": [
|
|
17
|
+
"skia"
|
|
18
|
+
],
|
|
19
|
+
"files": [
|
|
20
|
+
{
|
|
21
|
+
"from": "files",
|
|
22
|
+
"to": "ui/components/Image"
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"register": [
|
|
26
|
+
{
|
|
27
|
+
"file": "ui/components/index.ts",
|
|
28
|
+
"marker": "components-import",
|
|
29
|
+
"code": "import Image from './Image';\n"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"file": "ui/components/index.ts",
|
|
33
|
+
"marker": "components-export",
|
|
34
|
+
"code": " Image,\n"
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
"manual": [],
|
|
38
|
+
"api": "Image.Native and Image.SVG.",
|
|
39
|
+
"example": "<Image.Native source={{ uri }} width={96} height={96} />"
|
|
40
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# InputSecurity
|
|
2
|
+
|
|
3
|
+
Sanitize and validate text with the validator package.
|
|
4
|
+
|
|
5
|
+
## API
|
|
6
|
+
|
|
7
|
+
sanitizeAndValidate(text, preventInjection, currentValue).
|
|
8
|
+
|
|
9
|
+
## Example
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
import { sanitizeAndValidate } from '@components/Form/components/InputSecurity';
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Dependencies
|
|
16
|
+
|
|
17
|
+
- matrix key `validator`
|
|
18
|
+
|
|
19
|
+
No other solutions are required.
|
|
20
|
+
|
|
21
|
+
## Manual steps
|
|
22
|
+
|
|
23
|
+
None.
|
|
24
|
+
|
|
25
|
+
## Added in
|
|
26
|
+
|
|
27
|
+
1.0.0 (`experimental`).
|
|
28
|
+
|
|
29
|
+
Install with `forge g add --id component:InputSecurity`.
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import validator from 'validator';
|
|
2
|
+
|
|
3
|
+
export const sanitizeAndValidate = (text: string, preventInjection = true, currentValue = '') => {
|
|
4
|
+
if (!preventInjection) return text;
|
|
5
|
+
|
|
6
|
+
if (!text || text.trim().length < 2) return text;
|
|
7
|
+
|
|
8
|
+
const createPattern = (pattern: string, flags: string) => new RegExp(pattern, flags);
|
|
9
|
+
|
|
10
|
+
const criticalSqlPatterns = [
|
|
11
|
+
createPattern(
|
|
12
|
+
'[\'"`]\\s*;\\s*(SELECT\\s+.+\\s+FROM|INSERT\\s+INTO\\s+\\w+|UPDATE\\s+\\w+\\s+SET|DELETE\\s+FROM\\s+\\w+|DROP\\s+TABLE\\s+\\w+)',
|
|
13
|
+
'i',
|
|
14
|
+
),
|
|
15
|
+
|
|
16
|
+
createPattern('[\'"`]?\\s*UNION\\s+(ALL\\s+)?SELECT\\s+.+\\s+FROM\\s+\\w+', 'i'),
|
|
17
|
+
|
|
18
|
+
createPattern('[\'"`]\\s*(AND|OR)\\s+[\'"`]?\\w*[\'"`]?\\s*[=<>]\\s*[\'"`]?\\w*[\'"`]?\\s*(--|#)', 'i'),
|
|
19
|
+
|
|
20
|
+
createPattern('[\'"`]\\s*(AND|OR)\\s+\\d+\\s*[=<>]\\s*\\d+\\s*(--|#)', 'i'),
|
|
21
|
+
|
|
22
|
+
createPattern('[\'"`]\\s*(--|#|/\\*).*', ''),
|
|
23
|
+
|
|
24
|
+
createPattern('[\'"`]?\\s*;\\s*(DROP\\s+TABLE|DELETE\\s+FROM|UPDATE\\s+\\w+\\s+SET)\\s+\\w+', 'i'),
|
|
25
|
+
|
|
26
|
+
createPattern('\\b0x[0-9a-fA-F]{20,}', ''),
|
|
27
|
+
|
|
28
|
+
createPattern(
|
|
29
|
+
'\\b(WAITFOR\\s+DELAY\\s+[\'"][^\'">]+[\'"]|SLEEP\\s*\\(\\s*\\d+\\s*\\)|BENCHMARK\\s*\\(\\s*\\d+)',
|
|
30
|
+
'i',
|
|
31
|
+
),
|
|
32
|
+
|
|
33
|
+
createPattern('\\b(EXTRACTVALUE|UPDATEXML|EXP)\\s*\\([^)]+\\)', 'i'),
|
|
34
|
+
|
|
35
|
+
createPattern('[\'"`]\\s*(OR|AND)\\s+[\'"`]?[^\'">]+[\'"`]?\\s*[=<>]\\s*[\'"`]?[^\'">]+[\'"`]?\\s*(--|#)', 'i'),
|
|
36
|
+
|
|
37
|
+
createPattern('[\'"`]\\s*;\\s*\\w+', 'i'),
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
const criticalXssPatterns = [
|
|
41
|
+
createPattern('<script[^>]*>.*</script>', 'is'),
|
|
42
|
+
|
|
43
|
+
createPattern('<script[^>]*\\s+src\\s*=', 'i'),
|
|
44
|
+
// eslint-disable-next-line no-script-url
|
|
45
|
+
createPattern('javascript:\\s*[a-zA-Z_$][\\w$]*\\s*\\(', 'i'),
|
|
46
|
+
|
|
47
|
+
createPattern('<\\w+[^>]*\\bon\\w+\\s*=\\s*[\'"][^\'">]{3,}[\'"]', 'i'),
|
|
48
|
+
|
|
49
|
+
createPattern('<(iframe|object|embed)[^>]*\\s+src\\s*=\\s*[\'"][^\'">]+[\'"]', 'i'),
|
|
50
|
+
|
|
51
|
+
createPattern('vbscript:\\s*[a-zA-Z_$][\\w$]*', 'i'),
|
|
52
|
+
|
|
53
|
+
createPattern('data:\\s*text/(html|javascript)[,;][^\\s]*', 'i'),
|
|
54
|
+
|
|
55
|
+
createPattern('expression\\s*\\([^)]{3,}\\)', 'i'),
|
|
56
|
+
|
|
57
|
+
createPattern('\\s+(style|href)\\s*=\\s*[\'"][^\'">]*javascript:', 'i'),
|
|
58
|
+
];
|
|
59
|
+
|
|
60
|
+
const noSqlPatterns = [
|
|
61
|
+
createPattern('\\$(where|regex)\\s*:\\s*["\']?function\\s*\\(', 'i'),
|
|
62
|
+
|
|
63
|
+
createPattern('\\$(gt|gte|lt|lte|ne|in|nin)\\s*:\\s*["\'][^"\']*["\']\\s*,\\s*\\$(gt|gte|lt|lte)', 'i'),
|
|
64
|
+
|
|
65
|
+
createPattern('function\\s*\\([^)]*\\)\\s*{[^}]*return[^}]*}', 'i'),
|
|
66
|
+
];
|
|
67
|
+
|
|
68
|
+
const allCriticalPatterns = [...criticalSqlPatterns, ...criticalXssPatterns, ...noSqlPatterns];
|
|
69
|
+
const isDangerous = allCriticalPatterns.some(pattern => pattern.test(text));
|
|
70
|
+
|
|
71
|
+
if (isDangerous) {
|
|
72
|
+
return currentValue || '';
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const cleaned = text
|
|
76
|
+
|
|
77
|
+
.replace(createPattern('<script[^>]*>.*?</script>', 'gi'), '')
|
|
78
|
+
.replace(createPattern('<script[^>]*>', 'gi'), '')
|
|
79
|
+
// eslint-disable-next-line no-script-url
|
|
80
|
+
.replace(createPattern('javascript:\\s*[^\\s]+', 'gi'), '')
|
|
81
|
+
.replace(createPattern('vbscript:\\s*[^\\s]+', 'gi'), '')
|
|
82
|
+
.replace(createPattern('<iframe[^>]*>', 'gi'), '')
|
|
83
|
+
.replace(createPattern('<object[^>]*>', 'gi'), '')
|
|
84
|
+
.replace(createPattern('<embed[^>]*>', 'gi'), '');
|
|
85
|
+
|
|
86
|
+
return cleaned;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export const smartSanitize = (text: string, currentValue = '') => {
|
|
90
|
+
if (!text) return text;
|
|
91
|
+
|
|
92
|
+
const context = detectContext(text);
|
|
93
|
+
|
|
94
|
+
switch (context) {
|
|
95
|
+
case 'email':
|
|
96
|
+
return validator.isEmail(text) ? text : currentValue;
|
|
97
|
+
|
|
98
|
+
case 'url':
|
|
99
|
+
return validator.isURL(text, { require_protocol: false }) ? text : currentValue;
|
|
100
|
+
|
|
101
|
+
case 'numeric':
|
|
102
|
+
return validator.isNumeric(text.replace(/[,.\s]/g, '')) ? text : currentValue;
|
|
103
|
+
|
|
104
|
+
case 'dangerous':
|
|
105
|
+
return sanitizeAndValidate(text, true, currentValue);
|
|
106
|
+
|
|
107
|
+
default:
|
|
108
|
+
return sanitizeAndValidate(text, true, currentValue);
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
function detectContext(text: string): 'email' | 'url' | 'numeric' | 'dangerous' | 'safe' {
|
|
113
|
+
if (
|
|
114
|
+
/@[a-zA-Z0-9.-]+\.(com|org|net|edu|gov|mil|int|co\.|uk|de|fr|jp|au|ca|lt|lv|ee)($|\s)/.test(text) &&
|
|
115
|
+
text.split('@').length === 2
|
|
116
|
+
)
|
|
117
|
+
return 'email';
|
|
118
|
+
|
|
119
|
+
if (/^(https?:\/\/|www\.)|(\.(com|org|net|edu|gov|mil|int|co\.|uk|de|fr|jp|au|ca|lt|lv|ee)($|\/))/.test(text))
|
|
120
|
+
return 'url';
|
|
121
|
+
|
|
122
|
+
if (/^[\d,.\s+()-]+$/.test(text.replace(/[$€£¥₴]/g, ''))) return 'numeric';
|
|
123
|
+
|
|
124
|
+
const dangerousPatterns = [
|
|
125
|
+
/['"]\s*;\s*(SELECT\s+.+\s+FROM|INSERT\s+INTO|UPDATE\s+.+\s+SET|DELETE\s+FROM)\s+\w+/i,
|
|
126
|
+
/['"]\s*UNION\s+SELECT\s+/i,
|
|
127
|
+
/<script[^>]*>/i,
|
|
128
|
+
/javascript:\s*\w+\s*\(/i,
|
|
129
|
+
/['"]\s*(AND|OR)\s+\d+\s*[=<>]\s*\d+\s*(--|#)/i,
|
|
130
|
+
/['"]\s*;\s*(pasirinkti|atnaujinti|sukurti|įterpti|ištrinti)\s*;/i,
|
|
131
|
+
];
|
|
132
|
+
|
|
133
|
+
if (dangerousPatterns.some(pattern => pattern.test(text))) {
|
|
134
|
+
return 'dangerous';
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return 'safe';
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export const secureInputHandler = (text: string, currentValue = '') => {
|
|
141
|
+
return sanitizeAndValidate(text, true, currentValue);
|
|
142
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"id": "component:InputSecurity",
|
|
3
|
+
"type": "component",
|
|
4
|
+
"platforms": [
|
|
5
|
+
"react-native"
|
|
6
|
+
],
|
|
7
|
+
"title": "InputSecurity",
|
|
8
|
+
"description": "Sanitize and validate text with the validator package.",
|
|
9
|
+
"status": "experimental",
|
|
10
|
+
"since": "1.0.0",
|
|
11
|
+
"tags": [
|
|
12
|
+
"form"
|
|
13
|
+
],
|
|
14
|
+
"requires": [],
|
|
15
|
+
"dependencies": [
|
|
16
|
+
"validator"
|
|
17
|
+
],
|
|
18
|
+
"files": [
|
|
19
|
+
{
|
|
20
|
+
"from": "files/InputSecurity.ts",
|
|
21
|
+
"to": "ui/components/Form/components/InputSecurity.ts"
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"register": [],
|
|
25
|
+
"manual": [],
|
|
26
|
+
"api": "sanitizeAndValidate(text, preventInjection, currentValue).",
|
|
27
|
+
"example": "import { sanitizeAndValidate } from '@components/Form/components/InputSecurity';"
|
|
28
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# OTP
|
|
2
|
+
|
|
3
|
+
One-time code field attached to TextInput.
|
|
4
|
+
|
|
5
|
+
## API
|
|
6
|
+
|
|
7
|
+
TextInput.OTP with length, value, and onChange.
|
|
8
|
+
|
|
9
|
+
## Example
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
<TextInput.OTP length={6} value={code} onChange={setCode} />
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Dependencies
|
|
16
|
+
|
|
17
|
+
None beyond the setup baseline.
|
|
18
|
+
|
|
19
|
+
No other solutions are required.
|
|
20
|
+
|
|
21
|
+
## Manual steps
|
|
22
|
+
|
|
23
|
+
None.
|
|
24
|
+
|
|
25
|
+
## Added in
|
|
26
|
+
|
|
27
|
+
1.0.0 (`stable`).
|
|
28
|
+
|
|
29
|
+
Install with `forge g add --id component:OTP`.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Text } from 'react-native';
|
|
3
|
+
import { OtpPM } from '@components/TextInput/OTP/otp.pm.ts';
|
|
4
|
+
|
|
5
|
+
interface IOtpItemProps extends Record<string, any> {
|
|
6
|
+
value: string;
|
|
7
|
+
borderColor: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function Item(itemProps: IOtpItemProps) {
|
|
11
|
+
const { item } = OtpPM.get(itemProps);
|
|
12
|
+
|
|
13
|
+
return <Text {...item} />;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default Item;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import Item from './Item';
|
|
3
|
+
import { Grid } from '@components';
|
|
4
|
+
|
|
5
|
+
interface IItemsProps {
|
|
6
|
+
length: number;
|
|
7
|
+
value: string | undefined;
|
|
8
|
+
error: any;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function Items({ length, value, error }: IItemsProps) {
|
|
12
|
+
const items = useMemo(() => {
|
|
13
|
+
return Array(length)
|
|
14
|
+
.fill(null)
|
|
15
|
+
.map((_, i) => value?.[i] ?? '');
|
|
16
|
+
}, [value, length]);
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<Grid row space-between>
|
|
20
|
+
{items.map((code, index) => (
|
|
21
|
+
<Item
|
|
22
|
+
key={index}
|
|
23
|
+
value={code}
|
|
24
|
+
borderColor={
|
|
25
|
+
error ? 'error' : code || index === 0 ? 'outline' : items[index - 1] ? 'outline' : 'outlineVariant'
|
|
26
|
+
}
|
|
27
|
+
/>
|
|
28
|
+
))}
|
|
29
|
+
</Grid>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export default Items;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import React, { createRef, useCallback, useEffect } from 'react';
|
|
2
|
+
import { TouchableOpacity, TextInput, Platform, StyleSheet, Keyboard, InteractionManager, View } from 'react-native';
|
|
3
|
+
import Items from './Items';
|
|
4
|
+
|
|
5
|
+
interface IOTPProps {
|
|
6
|
+
length: number;
|
|
7
|
+
value?: string;
|
|
8
|
+
error?: any;
|
|
9
|
+
onChange?: (value: string) => void;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default function OTP({ length = 6, value, error, onChange }: IOTPProps) {
|
|
13
|
+
const inputRef = createRef<TextInput>();
|
|
14
|
+
|
|
15
|
+
useEffect(
|
|
16
|
+
() => {
|
|
17
|
+
const { cancel } = InteractionManager.runAfterInteractions(() => {
|
|
18
|
+
if (inputRef.current) {
|
|
19
|
+
if (!Keyboard.isVisible()) {
|
|
20
|
+
Keyboard.dismiss();
|
|
21
|
+
}
|
|
22
|
+
inputRef.current.focus();
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
return () => cancel();
|
|
26
|
+
},
|
|
27
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
28
|
+
[],
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
const onPress = useCallback(() => {
|
|
32
|
+
if (!Keyboard.isVisible()) {
|
|
33
|
+
Keyboard.dismiss();
|
|
34
|
+
}
|
|
35
|
+
inputRef.current?.focus();
|
|
36
|
+
}, [inputRef]);
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<TouchableOpacity activeOpacity={0.96} onPress={onPress}>
|
|
40
|
+
<TextInput
|
|
41
|
+
removeClippedSubviews={false}
|
|
42
|
+
scrollEnabled={false}
|
|
43
|
+
selectTextOnFocus={false}
|
|
44
|
+
selection={undefined}
|
|
45
|
+
selectionColor="#fff"
|
|
46
|
+
contextMenuHidden={true}
|
|
47
|
+
multiline={false}
|
|
48
|
+
autoComplete="one-time-code"
|
|
49
|
+
numberOfLines={1}
|
|
50
|
+
autoCapitalize="none"
|
|
51
|
+
autoCorrect={false}
|
|
52
|
+
clearButtonMode="never"
|
|
53
|
+
clearTextOnFocus={false}
|
|
54
|
+
keyboardType={Platform.OS === 'ios' ? 'number-pad' : 'numeric'}
|
|
55
|
+
underlineColorAndroid="transparent"
|
|
56
|
+
caretHidden
|
|
57
|
+
ref={inputRef}
|
|
58
|
+
value={value}
|
|
59
|
+
onChangeText={text => {
|
|
60
|
+
const trimmedText = text.slice(0, length);
|
|
61
|
+
onChange?.(trimmedText);
|
|
62
|
+
}}
|
|
63
|
+
maxLength={length}
|
|
64
|
+
style={styles.hidden}
|
|
65
|
+
/>
|
|
66
|
+
|
|
67
|
+
<Items value={value} error={error} length={length} />
|
|
68
|
+
|
|
69
|
+
<View style={styles.secondInputVisibility}>
|
|
70
|
+
<TextInput
|
|
71
|
+
removeClippedSubviews={false}
|
|
72
|
+
scrollEnabled={false}
|
|
73
|
+
selectTextOnFocus={false}
|
|
74
|
+
selection={undefined}
|
|
75
|
+
selectionColor="#fff"
|
|
76
|
+
maxFontSizeMultiplier={1}
|
|
77
|
+
multiline={false}
|
|
78
|
+
numberOfLines={1}
|
|
79
|
+
contextMenuHidden={false}
|
|
80
|
+
autoCapitalize="none"
|
|
81
|
+
autoCorrect={false}
|
|
82
|
+
clearButtonMode="never"
|
|
83
|
+
clearTextOnFocus={false}
|
|
84
|
+
shouldRasterizeIOS={false}
|
|
85
|
+
keyboardType={Platform.OS === 'ios' ? 'number-pad' : 'numeric'}
|
|
86
|
+
underlineColorAndroid="transparent"
|
|
87
|
+
caretHidden
|
|
88
|
+
value={value || ''}
|
|
89
|
+
onChangeText={text => {
|
|
90
|
+
inputRef.current?.focus();
|
|
91
|
+
const trimmedText = text.slice(0, length);
|
|
92
|
+
onChange?.(trimmedText);
|
|
93
|
+
}}
|
|
94
|
+
style={styles.inputStule}
|
|
95
|
+
/>
|
|
96
|
+
</View>
|
|
97
|
+
</TouchableOpacity>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const styles = StyleSheet.create({
|
|
102
|
+
hidden: {
|
|
103
|
+
fontSize: 20,
|
|
104
|
+
position: 'absolute',
|
|
105
|
+
width: 0.1,
|
|
106
|
+
color: '#fff',
|
|
107
|
+
},
|
|
108
|
+
secondInputVisibility: {
|
|
109
|
+
position: 'absolute',
|
|
110
|
+
left: 0,
|
|
111
|
+
right: 0,
|
|
112
|
+
top: 0,
|
|
113
|
+
bottom: 0,
|
|
114
|
+
},
|
|
115
|
+
inputStule: {
|
|
116
|
+
flex: 1,
|
|
117
|
+
fontSize: 1,
|
|
118
|
+
color: 'transparent',
|
|
119
|
+
},
|
|
120
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Prop, PropertyManager, Static, Node } from '@effijs/props-manager';
|
|
2
|
+
|
|
3
|
+
export const OtpPM = PropertyManager.create('Otp').node(
|
|
4
|
+
Node('item')
|
|
5
|
+
.extends('Text', 'Box')
|
|
6
|
+
.keys(
|
|
7
|
+
Static({
|
|
8
|
+
'headline-s': true,
|
|
9
|
+
}),
|
|
10
|
+
Prop('value', 'children'),
|
|
11
|
+
Static({
|
|
12
|
+
borderWidth: 1,
|
|
13
|
+
}),
|
|
14
|
+
Prop('borderColor'),
|
|
15
|
+
)
|
|
16
|
+
.keys(
|
|
17
|
+
'style',
|
|
18
|
+
Prop('style', ({ style }) => style),
|
|
19
|
+
Static({
|
|
20
|
+
pointerEvents: 'none',
|
|
21
|
+
borderRadius: 12,
|
|
22
|
+
verticalAlign: 'middle',
|
|
23
|
+
textAlign: 'center',
|
|
24
|
+
textVerticalAlign: 'center',
|
|
25
|
+
lineHeight: 42,
|
|
26
|
+
width: 42,
|
|
27
|
+
height: 42,
|
|
28
|
+
}),
|
|
29
|
+
),
|
|
30
|
+
);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"id": "component:OTP",
|
|
3
|
+
"type": "component",
|
|
4
|
+
"platforms": [
|
|
5
|
+
"react-native"
|
|
6
|
+
],
|
|
7
|
+
"title": "OTP",
|
|
8
|
+
"description": "One-time code field attached to TextInput.",
|
|
9
|
+
"status": "stable",
|
|
10
|
+
"since": "1.0.0",
|
|
11
|
+
"tags": [
|
|
12
|
+
"ui",
|
|
13
|
+
"form"
|
|
14
|
+
],
|
|
15
|
+
"requires": [],
|
|
16
|
+
"dependencies": [],
|
|
17
|
+
"files": [
|
|
18
|
+
{
|
|
19
|
+
"from": "files",
|
|
20
|
+
"to": "ui/components/TextInput/OTP"
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
"register": [
|
|
24
|
+
{
|
|
25
|
+
"file": "ui/components/TextInput/index.ts",
|
|
26
|
+
"marker": "text-input-import",
|
|
27
|
+
"code": "import OTP from './OTP';\n"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"file": "ui/components/TextInput/index.ts",
|
|
31
|
+
"marker": "text-input-slots",
|
|
32
|
+
"code": "TextInput.OTP = OTP;\n"
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
"manual": [],
|
|
36
|
+
"api": "TextInput.OTP with length, value, and onChange.",
|
|
37
|
+
"example": "<TextInput.OTP length={6} value={code} onChange={setCode} />"
|
|
38
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# ProgressIndicator
|
|
2
|
+
|
|
3
|
+
Linear and circular progress drawn with Skia.
|
|
4
|
+
|
|
5
|
+
## API
|
|
6
|
+
|
|
7
|
+
ProgressIndicator.Circular and ProgressIndicator.Linear.
|
|
8
|
+
|
|
9
|
+
## Example
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
<ProgressIndicator.Circular size={16} />
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Dependencies
|
|
16
|
+
|
|
17
|
+
- matrix key `skia`
|
|
18
|
+
|
|
19
|
+
No other solutions are required.
|
|
20
|
+
|
|
21
|
+
## Manual steps
|
|
22
|
+
|
|
23
|
+
None.
|
|
24
|
+
|
|
25
|
+
## Added in
|
|
26
|
+
|
|
27
|
+
1.0.0 (`stable`).
|
|
28
|
+
|
|
29
|
+
Install with `forge g add --id component:ProgressIndicator`.
|