@effijs/templates 0.0.0-stage → 1.0.0-alpha.1
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,70 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ActivityIndicator } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import TextInput from '../TextInput';
|
|
5
|
+
import { useLoading } from '../utils/useLoading.hook';
|
|
6
|
+
|
|
7
|
+
import Common from './Common';
|
|
8
|
+
import type { TFormInputProps } from './form.types';
|
|
9
|
+
|
|
10
|
+
type TFormInputAreaProps = Exclude<TFormInputProps, 'secure' | 'actions'>;
|
|
11
|
+
|
|
12
|
+
export default function FormInputArea({
|
|
13
|
+
value,
|
|
14
|
+
onChange,
|
|
15
|
+
loading: isLoading,
|
|
16
|
+
placeholder,
|
|
17
|
+
keyboardType,
|
|
18
|
+
maxLength,
|
|
19
|
+
disabled,
|
|
20
|
+
type,
|
|
21
|
+
textContentType,
|
|
22
|
+
autoCapitalize,
|
|
23
|
+
...rest
|
|
24
|
+
}: TFormInputAreaProps) {
|
|
25
|
+
const { loading, handle } = useLoading(text => onChange?.(text));
|
|
26
|
+
const [active, setActive] = React.useState(false);
|
|
27
|
+
|
|
28
|
+
const onFocus = React.useCallback(() => setActive(true), []);
|
|
29
|
+
const onBlur = React.useCallback(() => setActive(false), []);
|
|
30
|
+
|
|
31
|
+
const hasValue = value != null && String(value).length > 0;
|
|
32
|
+
|
|
33
|
+
const externalActions = rest.actions;
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<Common
|
|
37
|
+
active={active}
|
|
38
|
+
disabled={disabled}
|
|
39
|
+
type={type}
|
|
40
|
+
hasValue={hasValue}
|
|
41
|
+
stretch
|
|
42
|
+
{...rest}
|
|
43
|
+
actions={
|
|
44
|
+
<>
|
|
45
|
+
{(isLoading === undefined && loading) || (isLoading && loading) ? (
|
|
46
|
+
<ActivityIndicator size="small" />
|
|
47
|
+
) : null}
|
|
48
|
+
{externalActions}
|
|
49
|
+
</>
|
|
50
|
+
}>
|
|
51
|
+
<TextInput
|
|
52
|
+
multiline={true}
|
|
53
|
+
numberOfLines={6}
|
|
54
|
+
maxLength={maxLength}
|
|
55
|
+
editable={!disabled}
|
|
56
|
+
focusable={!disabled}
|
|
57
|
+
keyboardType={keyboardType}
|
|
58
|
+
body-l
|
|
59
|
+
value={value}
|
|
60
|
+
onChangeText={handle}
|
|
61
|
+
placeholder={placeholder}
|
|
62
|
+
onFocus={onFocus}
|
|
63
|
+
onBlur={onBlur}
|
|
64
|
+
textContentType={textContentType}
|
|
65
|
+
autoCapitalize={autoCapitalize}
|
|
66
|
+
textAlignVertical="top"
|
|
67
|
+
/>
|
|
68
|
+
</Common>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ViewProps } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { Text } from '@components';
|
|
5
|
+
|
|
6
|
+
export interface ILabelProps extends ViewProps {
|
|
7
|
+
children: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const Label = ({ children }: ILabelProps) => {
|
|
11
|
+
return (
|
|
12
|
+
<Text title-l color="outline" center mb-m>
|
|
13
|
+
{children}
|
|
14
|
+
</Text>
|
|
15
|
+
);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default Label;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import React, { useCallback, useEffect } from 'react';
|
|
2
|
+
import { TouchableOpacity } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { Button, Icon, Box, Text, Grid } from '@components';
|
|
5
|
+
|
|
6
|
+
import Common from './Common';
|
|
7
|
+
import type { TFormSelectProps, TTitle } from './form.types';
|
|
8
|
+
|
|
9
|
+
export default function FormSelect<T>({
|
|
10
|
+
initialTitle,
|
|
11
|
+
value,
|
|
12
|
+
onChange,
|
|
13
|
+
onSelect,
|
|
14
|
+
placeholder,
|
|
15
|
+
disabled,
|
|
16
|
+
trailingIcon,
|
|
17
|
+
getTitleForValue,
|
|
18
|
+
onClear,
|
|
19
|
+
iconColor,
|
|
20
|
+
type,
|
|
21
|
+
hideClearButton,
|
|
22
|
+
...rest
|
|
23
|
+
}: TFormSelectProps<T>) {
|
|
24
|
+
const [title, setTitle] = React.useState<TTitle>(getTitleForValue?.(value) || value || initialTitle || '');
|
|
25
|
+
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (!value && !initialTitle) {
|
|
28
|
+
setTitle('');
|
|
29
|
+
}
|
|
30
|
+
}, [value, initialTitle]);
|
|
31
|
+
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (typeof getTitleForValue === 'function') {
|
|
34
|
+
setTitle(getTitleForValue(value));
|
|
35
|
+
}
|
|
36
|
+
}, [getTitleForValue, value]);
|
|
37
|
+
|
|
38
|
+
const onChangeValue = useCallback(
|
|
39
|
+
(newValue: T | undefined, newTitle: TTitle) => {
|
|
40
|
+
onChange?.(newValue);
|
|
41
|
+
setTitle(newTitle);
|
|
42
|
+
},
|
|
43
|
+
[onChange, setTitle],
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
const onClearValue = useCallback(() => {
|
|
47
|
+
onChange?.();
|
|
48
|
+
setTitle('');
|
|
49
|
+
onClear?.();
|
|
50
|
+
}, [onChange, onClear]);
|
|
51
|
+
|
|
52
|
+
const onSelectValue = useCallback(() => {
|
|
53
|
+
if (!disabled) onSelect?.(value, onChangeValue);
|
|
54
|
+
}, [onSelect, value, onChangeValue, disabled]);
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<Common
|
|
58
|
+
Component={TouchableOpacity}
|
|
59
|
+
activeOpacity={0.9}
|
|
60
|
+
onPress={onSelectValue}
|
|
61
|
+
disabled={disabled}
|
|
62
|
+
focusable={!disabled}
|
|
63
|
+
type={type}
|
|
64
|
+
{...rest}
|
|
65
|
+
actions={
|
|
66
|
+
disabled ? null : (
|
|
67
|
+
<Box row align-center gap-xs mr-xs={type !== 'text'} accessible={false}>
|
|
68
|
+
{/*{!hideClearButton && (value || title) && (
|
|
69
|
+
<Button type="text" activeOpacity={0.9} onPress={onClearValue}>
|
|
70
|
+
<Box color="outlineVariant" round="m" p-xxs>
|
|
71
|
+
<Icon icon="close" color="onBackground" size={12} />
|
|
72
|
+
</Box>
|
|
73
|
+
</Button>
|
|
74
|
+
)}*/}
|
|
75
|
+
<Icon icon="arrow-down" color="primary" />
|
|
76
|
+
</Box>
|
|
77
|
+
)
|
|
78
|
+
}>
|
|
79
|
+
<Grid justify-center>
|
|
80
|
+
<Text body-m numberOfLines={1} color={title ? 'outline' : 'onSurfaceVariant'}>
|
|
81
|
+
{title || placeholder || ''}
|
|
82
|
+
</Text>
|
|
83
|
+
</Grid>
|
|
84
|
+
</Common>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { Button } from '@components';
|
|
4
|
+
|
|
5
|
+
interface ISecureTextEntryProps {
|
|
6
|
+
active?: boolean;
|
|
7
|
+
error?: any;
|
|
8
|
+
value: boolean;
|
|
9
|
+
onChange: () => void;
|
|
10
|
+
accessibilityLabel?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default function SecureTextEntry({ value, onChange }: ISecureTextEntryProps) {
|
|
14
|
+
return (
|
|
15
|
+
<Button type="text" activeOpacity={0.96} onPress={onChange} min-height={40} center>
|
|
16
|
+
{value ? 'SHOW' : 'HIDE'}
|
|
17
|
+
</Button>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AppError } from '@app/app.error';
|
|
2
|
+
|
|
3
|
+
export class FormError extends AppError {
|
|
4
|
+
public readonly data?: Record<string, string[]>;
|
|
5
|
+
|
|
6
|
+
constructor(message: string, data?: Record<string, { message: string; property: string }[]>) {
|
|
7
|
+
super(message);
|
|
8
|
+
|
|
9
|
+
if (!Object.keys(data || {}).length) return;
|
|
10
|
+
|
|
11
|
+
this.data = Object.entries(data || {}).reduce(
|
|
12
|
+
(res, [key, errors]) => {
|
|
13
|
+
return { ...res, [key]: errors.map(({ message, ...e }) => message?.format(e)) };
|
|
14
|
+
},
|
|
15
|
+
{} as Record<string, string[]>,
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { PropertyManager, Static, Prop, Node } from '@effijs/props-manager';
|
|
2
|
+
import { Platform } from 'react-native';
|
|
3
|
+
|
|
4
|
+
export const FormPM = PropertyManager.create('Form').node(
|
|
5
|
+
Node('wrapper')
|
|
6
|
+
.extends('Grid')
|
|
7
|
+
.keys(
|
|
8
|
+
Prop('stretch', () => ({
|
|
9
|
+
flex: 1,
|
|
10
|
+
})),
|
|
11
|
+
),
|
|
12
|
+
Node('icon')
|
|
13
|
+
.extends('Icon')
|
|
14
|
+
.keys(
|
|
15
|
+
Static({
|
|
16
|
+
color: 'outlineStrong',
|
|
17
|
+
}),
|
|
18
|
+
Prop('icon'),
|
|
19
|
+
Prop('iconColor', ({ iconColor }: { iconColor?: string }) => ({
|
|
20
|
+
color: iconColor,
|
|
21
|
+
})),
|
|
22
|
+
Prop('iconSize', ({ iconSize }: { iconSize?: number }) => ({
|
|
23
|
+
size: iconSize,
|
|
24
|
+
})),
|
|
25
|
+
Prop('active', { color: 'outline' }),
|
|
26
|
+
Prop('error', { color: 'error' }),
|
|
27
|
+
),
|
|
28
|
+
Node('label')
|
|
29
|
+
.extends('Text')
|
|
30
|
+
.omitKeys('onPress')
|
|
31
|
+
.keys(
|
|
32
|
+
Static({
|
|
33
|
+
'label-m': true,
|
|
34
|
+
color: 'secondary',
|
|
35
|
+
}),
|
|
36
|
+
Prop('error', { color: 'error' }),
|
|
37
|
+
Prop(['label', 'isRequired'], ({ label, isRequired }: { label: string; isRequired: boolean }) => ({
|
|
38
|
+
children: `${label}${isRequired ? ' *' : ''}`,
|
|
39
|
+
})),
|
|
40
|
+
),
|
|
41
|
+
Node('container')
|
|
42
|
+
.extends('Box')
|
|
43
|
+
.keys(
|
|
44
|
+
Static({
|
|
45
|
+
'min-height': 48,
|
|
46
|
+
borderColor: 'primary',
|
|
47
|
+
borderWidth: 1.5,
|
|
48
|
+
round: 'xxs',
|
|
49
|
+
row: true,
|
|
50
|
+
'gap-xs': true,
|
|
51
|
+
'ph-s': true,
|
|
52
|
+
}),
|
|
53
|
+
Prop('stretch', () => ({ flex: 1 })),
|
|
54
|
+
Prop('onPress'),
|
|
55
|
+
Prop(['label', 'type'], ({ type }) => ({ 'mt-xs': type !== 'text' })),
|
|
56
|
+
Prop('active', () => ({
|
|
57
|
+
borderColor: 'outline',
|
|
58
|
+
})),
|
|
59
|
+
Prop(
|
|
60
|
+
['type', 'error'],
|
|
61
|
+
({ type, error }: { type?: 'filled' | 'outlined' | 'text'; error?: any }) => {
|
|
62
|
+
if (type === 'outlined') {
|
|
63
|
+
return {
|
|
64
|
+
borderColor: error ? 'error' : 'primary',
|
|
65
|
+
borderWidth: 1,
|
|
66
|
+
color: 'white',
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
if (type === 'filled') {
|
|
70
|
+
return {
|
|
71
|
+
'pv-s': Platform.OS === 'ios',
|
|
72
|
+
borderWidth: 0,
|
|
73
|
+
color: 'tertiary',
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
if (type === 'text') {
|
|
77
|
+
return {
|
|
78
|
+
borderColor: 'transparent',
|
|
79
|
+
borderWidth: 0,
|
|
80
|
+
// round: undefined,
|
|
81
|
+
'ph-s': false,
|
|
82
|
+
'min-height': 40,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
return null;
|
|
86
|
+
},
|
|
87
|
+
{ nullWhenFirstKeyNull: false },
|
|
88
|
+
),
|
|
89
|
+
),
|
|
90
|
+
Node('actions')
|
|
91
|
+
.extends('Grid')
|
|
92
|
+
.keys(
|
|
93
|
+
Static({
|
|
94
|
+
row: true,
|
|
95
|
+
justifyContent: 'center',
|
|
96
|
+
center: true,
|
|
97
|
+
'ph-xs': true,
|
|
98
|
+
}),
|
|
99
|
+
Prop('type', ({ type }: { type?: 'filled' | 'outlined' | 'text' }) => ({
|
|
100
|
+
'ph-xs': false,
|
|
101
|
+
'pl-xs': type === 'text',
|
|
102
|
+
})),
|
|
103
|
+
)
|
|
104
|
+
.keys(
|
|
105
|
+
'style',
|
|
106
|
+
Static({
|
|
107
|
+
position: 'absolute',
|
|
108
|
+
justifyContent: 'center',
|
|
109
|
+
top: 0,
|
|
110
|
+
right: 0,
|
|
111
|
+
bottom: 0,
|
|
112
|
+
}),
|
|
113
|
+
),
|
|
114
|
+
Node('error')
|
|
115
|
+
.extends('Text')
|
|
116
|
+
.keys(
|
|
117
|
+
Static({
|
|
118
|
+
alignSelf: 'flex-end',
|
|
119
|
+
'label-s': true,
|
|
120
|
+
color: 'error',
|
|
121
|
+
}),
|
|
122
|
+
Prop('error', ({ error }: { error: string | { message: string }[] }) => {
|
|
123
|
+
let children;
|
|
124
|
+
if (typeof error === 'string') {
|
|
125
|
+
children = error;
|
|
126
|
+
}
|
|
127
|
+
if (Array.isArray(error)) {
|
|
128
|
+
children = error.join(',');
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return { children };
|
|
132
|
+
}),
|
|
133
|
+
),
|
|
134
|
+
);
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { KeyboardTypeOptions, TextInputProps } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { TIconNames } from '@components/Icon/icons.types';
|
|
5
|
+
|
|
6
|
+
export interface TFormCommonProps extends Record<string, unknown> {
|
|
7
|
+
label?: string | React.ReactNode;
|
|
8
|
+
isRequired?: boolean;
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
active?: boolean;
|
|
12
|
+
error?: string | { message?: string };
|
|
13
|
+
actions?: React.ReactNode;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
static?: boolean;
|
|
16
|
+
icon?: TIconNames;
|
|
17
|
+
type?: 'filled' | 'outlined' | 'text';
|
|
18
|
+
floatingLabel?: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
type RNTextInputProps = Pick<
|
|
22
|
+
TextInputProps,
|
|
23
|
+
'keyboardType' | 'textContentType' | 'autoComplete' | 'importantForAutofill' | 'maxLength' | 'autoCapitalize'
|
|
24
|
+
>;
|
|
25
|
+
|
|
26
|
+
export interface TFormInputProps extends TFormCommonProps, RNTextInputProps {
|
|
27
|
+
secure?: boolean;
|
|
28
|
+
value?: string;
|
|
29
|
+
onChange?: (value: string) => Promise<void> | void;
|
|
30
|
+
loading?: boolean;
|
|
31
|
+
clearable?: boolean;
|
|
32
|
+
keyboardType?: KeyboardTypeOptions;
|
|
33
|
+
error?: string | { message?: string };
|
|
34
|
+
maxLength?: number;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export type TTitle = string | React.ReactNode;
|
|
38
|
+
|
|
39
|
+
export type TOnSelect<V> = (value: V | undefined, onChange: (value: V | undefined, title: TTitle) => void) => void;
|
|
40
|
+
|
|
41
|
+
export interface TFormSelectProps<T> extends TFormCommonProps {
|
|
42
|
+
initialTitle?: TTitle;
|
|
43
|
+
value?: T;
|
|
44
|
+
onChange?: (value?: T) => void;
|
|
45
|
+
onClear?: () => void;
|
|
46
|
+
onSelect: TOnSelect<T>;
|
|
47
|
+
error?: string | { message?: string };
|
|
48
|
+
trailingIcon?: TIconNames;
|
|
49
|
+
getTitleForValue?: (value?: T) => TTitle;
|
|
50
|
+
hideClearButton?: boolean;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface TFormCheckboxProps<T> extends TFormCommonProps {
|
|
54
|
+
label?: string | React.ReactNode;
|
|
55
|
+
value?: T;
|
|
56
|
+
onChange?: (value?: T) => void | Promise<void>;
|
|
57
|
+
error?: string | { message?: string };
|
|
58
|
+
stretched?: boolean;
|
|
59
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { FormStore, EffiJS } from '@effijs/common';
|
|
2
|
+
import EffiForm from '@effijs/form-react/Service';
|
|
3
|
+
import { useEffect, useMemo } from 'react';
|
|
4
|
+
|
|
5
|
+
import FormInputArea from './InputArea';
|
|
6
|
+
import Colours from './Colours';
|
|
7
|
+
import ErrorText from './ErrorText';
|
|
8
|
+
import FormInput from './Input';
|
|
9
|
+
import Label from './Label';
|
|
10
|
+
import FormSelect from './Select';
|
|
11
|
+
// forge:form-imports
|
|
12
|
+
|
|
13
|
+
type TForm = typeof EffiForm;
|
|
14
|
+
type TFormInput = typeof FormInput;
|
|
15
|
+
type TFormInputArea = typeof FormInputArea;
|
|
16
|
+
type TFormSelect = typeof FormSelect;
|
|
17
|
+
type TFormLabel = typeof Label;
|
|
18
|
+
type TErrorText = typeof ErrorText;
|
|
19
|
+
type TColoursPicker = typeof Colours;
|
|
20
|
+
|
|
21
|
+
interface IForm extends TForm {
|
|
22
|
+
Element: {
|
|
23
|
+
Input: TFormInput;
|
|
24
|
+
InputArea: TFormInputArea;
|
|
25
|
+
Select: TFormSelect;
|
|
26
|
+
Label: TFormLabel;
|
|
27
|
+
ErrorText: TErrorText;
|
|
28
|
+
ColoursPicker: TColoursPicker;
|
|
29
|
+
// forge:form-types
|
|
30
|
+
};
|
|
31
|
+
useFormService: typeof useFormService;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const Form = EffiForm as IForm;
|
|
35
|
+
|
|
36
|
+
Form.useFormService = useFormService;
|
|
37
|
+
Form.Element = {
|
|
38
|
+
Input: FormInput,
|
|
39
|
+
InputArea: FormInputArea,
|
|
40
|
+
Select: FormSelect,
|
|
41
|
+
Label,
|
|
42
|
+
ErrorText,
|
|
43
|
+
ColoursPicker: Colours,
|
|
44
|
+
// forge:form-elements
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export function useFormService<S extends FormStore.FormStoreService<any>>(
|
|
48
|
+
FormService: new (...args: any[]) => S,
|
|
49
|
+
initial?: Partial<FormStore.SchemaOfService<S>> | (() => any),
|
|
50
|
+
): S {
|
|
51
|
+
const { form, destroy } = useMemo(
|
|
52
|
+
() => {
|
|
53
|
+
let data;
|
|
54
|
+
if (initial instanceof Function) {
|
|
55
|
+
data = initial();
|
|
56
|
+
} else {
|
|
57
|
+
data = initial;
|
|
58
|
+
}
|
|
59
|
+
return EffiJS.resolveForm(FormService, data);
|
|
60
|
+
},
|
|
61
|
+
[], // eslint-disable-line react-hooks/exhaustive-deps
|
|
62
|
+
);
|
|
63
|
+
useEffect(() => () => destroy(), []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
64
|
+
return form;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export default Form;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, ViewProps } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { GridPM } from './grid.pm';
|
|
5
|
+
import { TGridProps } from './grid.types';
|
|
6
|
+
|
|
7
|
+
export default function GridCommon({ children, ...commonProps }: TGridProps & ViewProps) {
|
|
8
|
+
const { container } = GridPM.get(commonProps as Record<string, unknown>);
|
|
9
|
+
|
|
10
|
+
return <View {...container} children={children} />;
|
|
11
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { Pattern, Prop, Node, PropertyManager } from '@effijs/props-manager';
|
|
2
|
+
|
|
3
|
+
type TAbsoluteStyle = {
|
|
4
|
+
absolute?: string;
|
|
5
|
+
top?: number;
|
|
6
|
+
bottom?: number;
|
|
7
|
+
left?: number;
|
|
8
|
+
right?: number;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const GridPM = PropertyManager.create('Grid').node(
|
|
12
|
+
Node('container').keys(
|
|
13
|
+
'style',
|
|
14
|
+
Prop('style', ({ style }) => style),
|
|
15
|
+
Pattern('{n}', ({ theme }) => theme.spacing, { providers: ['theme'] })
|
|
16
|
+
.key('m-{n}', 'margin')
|
|
17
|
+
.key('ml-{n}', 'marginLeft')
|
|
18
|
+
.key('mt-{n}', 'marginTop')
|
|
19
|
+
.key('mr-{n}', 'marginRight')
|
|
20
|
+
.key('mb-{n}', 'marginBottom')
|
|
21
|
+
.key('mh-{n}', 'marginHorizontal')
|
|
22
|
+
.key('mv-{n}', 'marginVertical')
|
|
23
|
+
.key('p-{n}', 'padding')
|
|
24
|
+
.key('pl-{n}', 'paddingLeft')
|
|
25
|
+
.key('pt-{n}', 'paddingTop')
|
|
26
|
+
.key('pr-{n}', 'paddingRight')
|
|
27
|
+
.key('pb-{n}', 'paddingBottom')
|
|
28
|
+
.key('ph-{n}', 'paddingHorizontal')
|
|
29
|
+
.key('pv-{n}', 'paddingVertical')
|
|
30
|
+
.key('gap-{n}', 'gap'),
|
|
31
|
+
Prop('mt', ({ mt }: { mt?: number }) => ({
|
|
32
|
+
marginTop: mt,
|
|
33
|
+
})),
|
|
34
|
+
Prop('pt', ({ pt }: { pt?: number }) => ({
|
|
35
|
+
paddingTop: pt,
|
|
36
|
+
})),
|
|
37
|
+
Prop('pb', ({ pb }: { pb?: number }) => ({
|
|
38
|
+
paddingBottom: pb,
|
|
39
|
+
})),
|
|
40
|
+
Pattern('{n}', {
|
|
41
|
+
center: 'center',
|
|
42
|
+
start: 'flex-start',
|
|
43
|
+
end: 'flex-end',
|
|
44
|
+
})
|
|
45
|
+
.key('align-{n}', 'alignItems')
|
|
46
|
+
.key('justify-{n}', 'justifyContent')
|
|
47
|
+
.key('align-self-{n}', 'alignSelf'),
|
|
48
|
+
Pattern('{n}', {
|
|
49
|
+
between: 'space-between',
|
|
50
|
+
around: 'space-around',
|
|
51
|
+
}).key('space-{n}', 'justifyContent'),
|
|
52
|
+
Prop('center', { alignItems: 'center', justifyContent: 'center' }),
|
|
53
|
+
Prop('col', { flexDirection: 'column' }),
|
|
54
|
+
Prop('row', { flexDirection: 'row' }),
|
|
55
|
+
Prop(
|
|
56
|
+
['reverse', 'row'],
|
|
57
|
+
({ row }) => ({
|
|
58
|
+
flexDirection: row ? 'row-reverse' : 'column-reverse',
|
|
59
|
+
}),
|
|
60
|
+
{ nullWhenFirstKeyNull: true },
|
|
61
|
+
),
|
|
62
|
+
Prop('flex', 'flex'),
|
|
63
|
+
Prop('flexGrow', 'flexGrow'),
|
|
64
|
+
Prop('height', 'height'),
|
|
65
|
+
Prop('width', 'width'),
|
|
66
|
+
Prop('gap', 'gap'),
|
|
67
|
+
Prop('ratio', 'aspectRatio'),
|
|
68
|
+
Prop('min-height', 'minHeight'),
|
|
69
|
+
Prop('min-width', 'minWidth'),
|
|
70
|
+
Prop('max-height', 'maxHeight'),
|
|
71
|
+
Prop('max-width', 'maxWidth'),
|
|
72
|
+
Prop('overflow-hidden', { overflow: 'hidden' }),
|
|
73
|
+
Prop(
|
|
74
|
+
['absolute', 'top', 'left', 'bottom'],
|
|
75
|
+
({ absolute, top, left, bottom }) => {
|
|
76
|
+
if (!absolute) {
|
|
77
|
+
return {};
|
|
78
|
+
}
|
|
79
|
+
const res = { position: 'absolute', left: left ?? 0, right: 0 } as TAbsoluteStyle;
|
|
80
|
+
if (top) {
|
|
81
|
+
res.top = top;
|
|
82
|
+
} else if (bottom) {
|
|
83
|
+
res.bottom = 0;
|
|
84
|
+
} else {
|
|
85
|
+
res.top = 0;
|
|
86
|
+
res.bottom = 0;
|
|
87
|
+
}
|
|
88
|
+
return res;
|
|
89
|
+
},
|
|
90
|
+
{ nullWhenFirstKeyNull: true },
|
|
91
|
+
),
|
|
92
|
+
),
|
|
93
|
+
);
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
export type TSpacingSizes = 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl';
|
|
2
|
+
|
|
3
|
+
type TSpacingProps<Prefix extends string> = {
|
|
4
|
+
[Size in TSpacingSizes as `${Prefix}-${Size}`]?: boolean;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
interface IAbsoluteProps {
|
|
8
|
+
absolute?: boolean;
|
|
9
|
+
top?: number;
|
|
10
|
+
left?: number;
|
|
11
|
+
right?: number;
|
|
12
|
+
bottom?: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface IMarginProps
|
|
16
|
+
extends
|
|
17
|
+
TSpacingProps<'m'>,
|
|
18
|
+
TSpacingProps<'mt'>,
|
|
19
|
+
TSpacingProps<'mr'>,
|
|
20
|
+
TSpacingProps<'mb'>,
|
|
21
|
+
TSpacingProps<'ml'>,
|
|
22
|
+
TSpacingProps<'mv'>,
|
|
23
|
+
TSpacingProps<'mh'> {}
|
|
24
|
+
|
|
25
|
+
interface IPaddingProps
|
|
26
|
+
extends
|
|
27
|
+
TSpacingProps<'p'>,
|
|
28
|
+
TSpacingProps<'pt'>,
|
|
29
|
+
TSpacingProps<'pr'>,
|
|
30
|
+
TSpacingProps<'pb'>,
|
|
31
|
+
TSpacingProps<'pl'>,
|
|
32
|
+
TSpacingProps<'pv'>,
|
|
33
|
+
TSpacingProps<'ph'> {}
|
|
34
|
+
|
|
35
|
+
interface IGapProps extends TSpacingProps<'gap'> {}
|
|
36
|
+
|
|
37
|
+
interface IAlignProps {
|
|
38
|
+
'align-center'?: boolean;
|
|
39
|
+
'align-start'?: boolean;
|
|
40
|
+
'align-end'?: boolean;
|
|
41
|
+
'align-self-center'?: boolean;
|
|
42
|
+
'align-self-start'?: boolean;
|
|
43
|
+
'align-self-end'?: boolean;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
interface IJustifyProps {
|
|
47
|
+
'justify-center'?: boolean;
|
|
48
|
+
'justify-start'?: boolean;
|
|
49
|
+
'justify-end'?: boolean;
|
|
50
|
+
'space-between'?: boolean;
|
|
51
|
+
'space-around'?: boolean;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
interface IFlexProps {
|
|
55
|
+
flex?: number;
|
|
56
|
+
flexGrow?: number;
|
|
57
|
+
// 'flex-1'?: boolean;
|
|
58
|
+
// 'flex-2'?: boolean;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface TGridProps
|
|
62
|
+
extends IAbsoluteProps, IGapProps, IFlexProps, IAlignProps, IJustifyProps, IMarginProps, IPaddingProps {
|
|
63
|
+
center?: boolean;
|
|
64
|
+
col?: boolean;
|
|
65
|
+
row?: boolean;
|
|
66
|
+
ratio?: number;
|
|
67
|
+
reverse?: boolean;
|
|
68
|
+
height?: number | string | undefined;
|
|
69
|
+
width?: number | string | undefined;
|
|
70
|
+
gap?: number;
|
|
71
|
+
'min-height'?: number | string | undefined;
|
|
72
|
+
'min-width'?: number | string | undefined;
|
|
73
|
+
'max-height'?: number | string | undefined;
|
|
74
|
+
'max-width'?: number | string | undefined;
|
|
75
|
+
'overflow-hidden'?: boolean;
|
|
76
|
+
mt?: number | undefined;
|
|
77
|
+
pt?: number | undefined;
|
|
78
|
+
pb?: number | undefined;
|
|
79
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Text } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { useTheme } from '@theme';
|
|
5
|
+
|
|
6
|
+
import { IconsPM } from './icons.pm';
|
|
7
|
+
import { IIconProps } from './icons.types';
|
|
8
|
+
|
|
9
|
+
export default function Common(props: IIconProps) {
|
|
10
|
+
const theme = useTheme();
|
|
11
|
+
const {
|
|
12
|
+
container: { type, ...container },
|
|
13
|
+
} = IconsPM.get({ theme, ...props });
|
|
14
|
+
|
|
15
|
+
if (type === 'font') {
|
|
16
|
+
return <Text {...container} />;
|
|
17
|
+
}
|
|
18
|
+
return null;
|
|
19
|
+
}
|