@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,111 @@
|
|
|
1
|
+
import { Prop, Node, PropertyManager, Parse, Pattern } from '@effijs/props-manager';
|
|
2
|
+
|
|
3
|
+
import { TTheme, ThemeScheme, theme } from '@theme';
|
|
4
|
+
|
|
5
|
+
export const BoxPM = PropertyManager.create('Box').node(
|
|
6
|
+
Node('container')
|
|
7
|
+
.extends('Grid')
|
|
8
|
+
.keys(
|
|
9
|
+
'style',
|
|
10
|
+
Prop('style', ({ style }) => style),
|
|
11
|
+
Prop(
|
|
12
|
+
['color', 'opacity', 'theme'],
|
|
13
|
+
({ color, opacity, theme: themeName }, { theme }: { theme: TTheme }) => ({
|
|
14
|
+
backgroundColor: colorOpacity(
|
|
15
|
+
theme.get(`color.${color as keyof ThemeScheme['color']}`, themeName) ?? color,
|
|
16
|
+
opacity,
|
|
17
|
+
),
|
|
18
|
+
}),
|
|
19
|
+
{ nullWhenFirstKeyNull: true, providers: ['theme'] },
|
|
20
|
+
),
|
|
21
|
+
Prop(
|
|
22
|
+
['borderColor', 'borderWidth', 'borderBottom', 'theme'],
|
|
23
|
+
({ borderColor, borderWidth, borderBottom, theme: themeName }, { theme }) => {
|
|
24
|
+
const style = {
|
|
25
|
+
borderColor: theme.get(`color.${borderColor}`, themeName) ?? borderColor,
|
|
26
|
+
} as { borderColor: string; borderWidth?: number; borderBottomWidth?: number };
|
|
27
|
+
|
|
28
|
+
if (borderBottom) {
|
|
29
|
+
style.borderBottomWidth = borderWidth;
|
|
30
|
+
} else {
|
|
31
|
+
style.borderWidth = borderWidth;
|
|
32
|
+
}
|
|
33
|
+
return style;
|
|
34
|
+
},
|
|
35
|
+
{ nullWhenFirstKeyNull: true, providers: ['theme'] },
|
|
36
|
+
),
|
|
37
|
+
/*Provider('theme', theme =>
|
|
38
|
+
Pattern('{n}', theme.spacing).key('round-{n}', borderRadius => ({
|
|
39
|
+
borderRadius,
|
|
40
|
+
// overflow: 'hidden',
|
|
41
|
+
})),
|
|
42
|
+
),*/
|
|
43
|
+
Prop(
|
|
44
|
+
'round',
|
|
45
|
+
({ round }, { theme }) => ({
|
|
46
|
+
borderRadius: round === 'full' ? 999 : theme.spacing[round],
|
|
47
|
+
}),
|
|
48
|
+
{ providers: ['theme'] },
|
|
49
|
+
),
|
|
50
|
+
|
|
51
|
+
Pattern(
|
|
52
|
+
'{n}',
|
|
53
|
+
{
|
|
54
|
+
s: 2,
|
|
55
|
+
m: 4,
|
|
56
|
+
l: 6,
|
|
57
|
+
xl: 8,
|
|
58
|
+
},
|
|
59
|
+
{ providers: ['theme'] },
|
|
60
|
+
).key('shadow-{n}', size => {
|
|
61
|
+
const sizeNumber = Number(size);
|
|
62
|
+
|
|
63
|
+
return {
|
|
64
|
+
shadowColor: theme.color.primary,
|
|
65
|
+
elevation: sizeNumber,
|
|
66
|
+
shadowOffset: {
|
|
67
|
+
width: 0,
|
|
68
|
+
height: 0,
|
|
69
|
+
},
|
|
70
|
+
shadowRadius: sizeNumber * 4,
|
|
71
|
+
shadowOpacity: 0.3,
|
|
72
|
+
};
|
|
73
|
+
}),
|
|
74
|
+
|
|
75
|
+
// Prop(
|
|
76
|
+
// ['shadow-m', 'theme'],
|
|
77
|
+
// ({ theme: themeName }, { theme }) => ({
|
|
78
|
+
// shadowColor: theme.get(`color.primary`, themeName),
|
|
79
|
+
// elevation: 5,
|
|
80
|
+
// shadowOffset: {
|
|
81
|
+
// width: 0,
|
|
82
|
+
// height: 0,
|
|
83
|
+
// },
|
|
84
|
+
// shadowRadius: 24,
|
|
85
|
+
// shadowOpacity: 0.3,
|
|
86
|
+
// }),
|
|
87
|
+
// { providers: ['theme'] },
|
|
88
|
+
// ),
|
|
89
|
+
)
|
|
90
|
+
.keys(Prop('disabled')),
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
function opacityToHex(opacity: number | undefined) {
|
|
94
|
+
if (opacity === undefined) return '';
|
|
95
|
+
|
|
96
|
+
let value = opacity;
|
|
97
|
+
if (opacity < 0) value = 0;
|
|
98
|
+
if (opacity > 1) value = 1;
|
|
99
|
+
|
|
100
|
+
return Math.round(value * 255)
|
|
101
|
+
.toString(16)
|
|
102
|
+
.padStart(2, '0');
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function colorOpacity(color: string, opacity: number | undefined) {
|
|
106
|
+
if (opacity !== undefined && color.startsWith('#')) {
|
|
107
|
+
return `${color}${opacityToHex(opacity)}`;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return color;
|
|
111
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ActivityIndicator, TouchableOpacity, TouchableOpacityProps, Text, View } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { Icon } from '@components';
|
|
5
|
+
import { useTheme } from '@theme';
|
|
6
|
+
|
|
7
|
+
import type { TSpacingSizes } from '../Grid/grid.types';
|
|
8
|
+
import { useLoading } from '../utils/useLoading.hook';
|
|
9
|
+
|
|
10
|
+
import { ButtonPM } from './button.pm';
|
|
11
|
+
import { ICommonButtonProps } from './button.types';
|
|
12
|
+
|
|
13
|
+
export function WithTouchable<T>(Touchable: any) {
|
|
14
|
+
return function ButtonCommon({
|
|
15
|
+
onPress,
|
|
16
|
+
loading: externalLoading,
|
|
17
|
+
withoutLoadingIndicator,
|
|
18
|
+
color = 'primary',
|
|
19
|
+
...commonProps
|
|
20
|
+
}: ICommonButtonProps<TSpacingSizes> & T) {
|
|
21
|
+
const theme = useTheme();
|
|
22
|
+
const { loading, handle } = useLoading(onPress, { throttle: 300 });
|
|
23
|
+
|
|
24
|
+
const props = ButtonPM.get({
|
|
25
|
+
theme,
|
|
26
|
+
size: 48,
|
|
27
|
+
loading: !withoutLoadingIndicator && (loading || externalLoading),
|
|
28
|
+
color,
|
|
29
|
+
...commonProps,
|
|
30
|
+
} as Record<string, unknown>);
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<Touchable
|
|
34
|
+
{...props.container}
|
|
35
|
+
onPress={handle}
|
|
36
|
+
disabled={props.container.disabled || loading || externalLoading}>
|
|
37
|
+
{props.leadingIcon.icon ? <Icon {...props.leadingIcon} /> : null}
|
|
38
|
+
{props.text.children ? <Text {...props.text} /> : null}
|
|
39
|
+
{props.trailingIcon.icon ? <Icon {...props.trailingIcon} /> : null}
|
|
40
|
+
{!withoutLoadingIndicator && (loading || externalLoading) ? (
|
|
41
|
+
<View {...props.loaderContainer}>
|
|
42
|
+
<ActivityIndicator color={theme.color.primary} />
|
|
43
|
+
</View>
|
|
44
|
+
) : null}
|
|
45
|
+
</Touchable>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export default WithTouchable<TouchableOpacityProps>(TouchableOpacity);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { TouchableOpacity, TouchableOpacityProps } from 'react-native';
|
|
2
|
+
|
|
3
|
+
import { BoxPM } from '@components/Box/box.pm';
|
|
4
|
+
import type { TBoxProps } from '@components/Box/box.types';
|
|
5
|
+
import { debounce } from '@components/Button/button.utils.ts';
|
|
6
|
+
import type { TGridProps } from '@components/Grid/grid.types';
|
|
7
|
+
import type { TThemeColor } from '@theme';
|
|
8
|
+
|
|
9
|
+
export default function Touchable({
|
|
10
|
+
onPress,
|
|
11
|
+
activeOpacity = 0.98,
|
|
12
|
+
...boxProps
|
|
13
|
+
}: TBoxProps<TThemeColor, any> & TGridProps & TouchableOpacityProps) {
|
|
14
|
+
const { container } = BoxPM.get(boxProps);
|
|
15
|
+
|
|
16
|
+
const onPressWrapper = debounce(() => onPress?.(), 300);
|
|
17
|
+
|
|
18
|
+
return <TouchableOpacity activeOpacity={activeOpacity} onPress={onPressWrapper} {...container} />;
|
|
19
|
+
}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { Node, Prop, PropertyManager, Static } from '@effijs/props-manager';
|
|
2
|
+
|
|
3
|
+
import { TButtonType } from './button.types';
|
|
4
|
+
|
|
5
|
+
export const ButtonPM = PropertyManager.create('Button').node(
|
|
6
|
+
Node('container')
|
|
7
|
+
.unusedPropsPassHere()
|
|
8
|
+
.extends('Box')
|
|
9
|
+
.keys(
|
|
10
|
+
'style',
|
|
11
|
+
Prop('style', ({ style }) => style),
|
|
12
|
+
Prop('size', ({ size }) => ({
|
|
13
|
+
minHeight: size,
|
|
14
|
+
minWidth: size,
|
|
15
|
+
})),
|
|
16
|
+
Prop('opacity'),
|
|
17
|
+
// Prop('style', ({ style }: { style: Record<string, unknown> }) => style)
|
|
18
|
+
Prop('type', ({ type }: { type: TButtonType }) =>
|
|
19
|
+
type === 'text'
|
|
20
|
+
? {
|
|
21
|
+
minHeight: 32,
|
|
22
|
+
paddingHorizontal: 0,
|
|
23
|
+
paddingLeft: 0,
|
|
24
|
+
paddingRight: 0,
|
|
25
|
+
}
|
|
26
|
+
: null,
|
|
27
|
+
),
|
|
28
|
+
)
|
|
29
|
+
.keys(
|
|
30
|
+
Static({
|
|
31
|
+
row: true,
|
|
32
|
+
'gap-xs': true,
|
|
33
|
+
'justify-center': true,
|
|
34
|
+
'align-center': true,
|
|
35
|
+
round: 'xxs',
|
|
36
|
+
}),
|
|
37
|
+
Prop('onPress'),
|
|
38
|
+
Prop('round'),
|
|
39
|
+
Prop(
|
|
40
|
+
['children', 'leadingIcon'],
|
|
41
|
+
({ children: text, leadingIcon }) => ({
|
|
42
|
+
// 'ph-m': text && icon && true,
|
|
43
|
+
// 'ph-s': Icon && !text && true,
|
|
44
|
+
|
|
45
|
+
'pl-s': leadingIcon && true,
|
|
46
|
+
'pr-s': leadingIcon && !text && true,
|
|
47
|
+
'pl-m': !leadingIcon && text && true,
|
|
48
|
+
'pr-m': text && true,
|
|
49
|
+
}),
|
|
50
|
+
{ nullWhenFirstKeyNull: true },
|
|
51
|
+
),
|
|
52
|
+
Prop(
|
|
53
|
+
['trailingIcon', 'children'],
|
|
54
|
+
({ children: text, trailingIcon }) => ({
|
|
55
|
+
'pr-s': trailingIcon && true,
|
|
56
|
+
'pl-s': trailingIcon && !text && true,
|
|
57
|
+
}),
|
|
58
|
+
{ nullWhenFirstKeyNull: true },
|
|
59
|
+
),
|
|
60
|
+
Prop(['type', 'color'], ({ type, color }) => containerByType(type, color)),
|
|
61
|
+
Prop('error', {
|
|
62
|
+
color: 'error',
|
|
63
|
+
}),
|
|
64
|
+
Prop(['disabled', 'type', 'color'], ({ color, type }) => disabledContainerByType(type, color), {
|
|
65
|
+
nullWhenFirstKeyNull: true,
|
|
66
|
+
}),
|
|
67
|
+
),
|
|
68
|
+
Node('leadingIcon')
|
|
69
|
+
.keys('style', Prop('loading', { opacity: 0 }))
|
|
70
|
+
.keys(
|
|
71
|
+
Static({
|
|
72
|
+
size: 24,
|
|
73
|
+
}),
|
|
74
|
+
Prop(
|
|
75
|
+
'size',
|
|
76
|
+
({ size }: { size: number }) => ({
|
|
77
|
+
size: size < 40 ? 20 : 24,
|
|
78
|
+
}),
|
|
79
|
+
{ nullWhenFirstKeyNull: true },
|
|
80
|
+
),
|
|
81
|
+
Prop('leadingIcon', 'icon'),
|
|
82
|
+
Prop(['type', 'color'], ({ type, color }) => contentByType(type, color)),
|
|
83
|
+
Prop('error', {
|
|
84
|
+
color: 'error',
|
|
85
|
+
}),
|
|
86
|
+
Prop('disabled', { color: 'onSurface', opacity: 0.38 }),
|
|
87
|
+
),
|
|
88
|
+
Node('trailingIcon')
|
|
89
|
+
.keys('style', Prop('loading', { opacity: 0 }))
|
|
90
|
+
.keys(
|
|
91
|
+
Static({
|
|
92
|
+
size: 24,
|
|
93
|
+
}),
|
|
94
|
+
Prop(
|
|
95
|
+
'size',
|
|
96
|
+
({ size }: { size: number }) => ({
|
|
97
|
+
size: size < 40 ? 20 : 24,
|
|
98
|
+
}),
|
|
99
|
+
{ nullWhenFirstKeyNull: true },
|
|
100
|
+
),
|
|
101
|
+
Prop('trailingIcon', 'icon'),
|
|
102
|
+
Prop(['type', 'color'], ({ type, color }) => contentByType(type, color)),
|
|
103
|
+
Prop('error', {
|
|
104
|
+
color: 'error',
|
|
105
|
+
}),
|
|
106
|
+
Prop('disabled', { color: 'onSurface', opacity: 0.38 }),
|
|
107
|
+
),
|
|
108
|
+
Node('text')
|
|
109
|
+
.extends('Text')
|
|
110
|
+
.pickKeys('loading', 'children', 'type', 'color', 'theme', 'error', 'disabled')
|
|
111
|
+
.keys('style', Prop('loading', { opacity: 0 }))
|
|
112
|
+
.keys(
|
|
113
|
+
Static({
|
|
114
|
+
'title-m': true,
|
|
115
|
+
}),
|
|
116
|
+
Prop('children'),
|
|
117
|
+
Prop(['type', 'color'], ({ type, color }) => contentByType(type, color)),
|
|
118
|
+
Prop('error', {
|
|
119
|
+
color: 'error',
|
|
120
|
+
}),
|
|
121
|
+
Prop('disabled', { color: 'onSurface', opacity: 1 }),
|
|
122
|
+
),
|
|
123
|
+
Node('loaderContainer').keys(
|
|
124
|
+
'style',
|
|
125
|
+
Static({
|
|
126
|
+
position: 'absolute',
|
|
127
|
+
top: 0,
|
|
128
|
+
left: 0,
|
|
129
|
+
right: 0,
|
|
130
|
+
bottom: 0,
|
|
131
|
+
alignItems: 'center',
|
|
132
|
+
justifyContent: 'center',
|
|
133
|
+
}),
|
|
134
|
+
),
|
|
135
|
+
Node('loader')
|
|
136
|
+
.extends('CircularIndicator')
|
|
137
|
+
.keys(
|
|
138
|
+
Static({
|
|
139
|
+
size: 24,
|
|
140
|
+
}),
|
|
141
|
+
Prop(['type', 'color'], ({ type, color }) => contentByType(type, color)),
|
|
142
|
+
/*Prop(
|
|
143
|
+
['type', 'color'],
|
|
144
|
+
({ type, color: _c }, { theme }) => {
|
|
145
|
+
const color = _c ?? 'primary';
|
|
146
|
+
const variants = {
|
|
147
|
+
filled: {
|
|
148
|
+
color: theme.color.outline,
|
|
149
|
+
backgroundColor: theme.color[color.replace(/^\w/, c => `on${c.toUpperCase()}`)],
|
|
150
|
+
},
|
|
151
|
+
text: {
|
|
152
|
+
color: theme.color.outline,
|
|
153
|
+
backgroundColor: theme.color.primary,
|
|
154
|
+
},
|
|
155
|
+
outlined: {
|
|
156
|
+
color: theme.color.outline,
|
|
157
|
+
backgroundColor: theme.color.primary,
|
|
158
|
+
},
|
|
159
|
+
};
|
|
160
|
+
return variants[type ?? 'filled'] ?? { color: theme.color.outline, backgroundColor: theme.color.primary };
|
|
161
|
+
},
|
|
162
|
+
{ nullWhenFirstKeyNull: false, providers: ['theme'] },
|
|
163
|
+
),*/
|
|
164
|
+
),
|
|
165
|
+
);
|
|
166
|
+
|
|
167
|
+
function containerByType(type: TButtonType, color: string) {
|
|
168
|
+
return {
|
|
169
|
+
elevated: { color: 'surfaceContainerLow', 'elevation-1': true },
|
|
170
|
+
filled: { color },
|
|
171
|
+
tonal: { color: `${color}Container` },
|
|
172
|
+
outlined: { color: 'transparent', borderColor: color, borderWidth: 1 },
|
|
173
|
+
text: { color: 'transparent' },
|
|
174
|
+
}[type];
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function disabledContainerByType(type: TButtonType, color: string) {
|
|
178
|
+
return {
|
|
179
|
+
elevated: { color, opacity: 0.12 },
|
|
180
|
+
filled: { color: 'onSurface', opacity: 0.2 },
|
|
181
|
+
tonal: { color: 'onSurface', opacity: 0.12 },
|
|
182
|
+
outlined: { color: 'onSurface', borderColor: 'onSurface', opacity: 0.12 },
|
|
183
|
+
text: { color: 'transparent' },
|
|
184
|
+
}[type];
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function contentByType(type: TButtonType, color: string) {
|
|
188
|
+
return {
|
|
189
|
+
elevated: { color },
|
|
190
|
+
filled: { color: color.replace(/^\w/, c => `on${c.toUpperCase()}`) },
|
|
191
|
+
tonal: {
|
|
192
|
+
color: `on${color.charAt(0).toUpperCase()}${color.slice(1)}Container`,
|
|
193
|
+
},
|
|
194
|
+
outlined: { color },
|
|
195
|
+
text: { color },
|
|
196
|
+
}[type];
|
|
197
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { TGridProps } from '../Grid/grid.types';
|
|
4
|
+
import type { TIconNames } from '../Icon/icons.types';
|
|
5
|
+
|
|
6
|
+
export type TButtonType = 'filled' | 'text' | 'outlined';
|
|
7
|
+
|
|
8
|
+
type TButtonColor = 'primary' | 'secondary' | 'tertiary' | 'error' | string;
|
|
9
|
+
|
|
10
|
+
export interface ICommonButtonProps<TRound> extends TGridProps {
|
|
11
|
+
type: TButtonType;
|
|
12
|
+
color?: TButtonColor;
|
|
13
|
+
size?: number;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
loading?: boolean;
|
|
16
|
+
withoutLoadingIndicator?: boolean;
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
round?: TRound;
|
|
19
|
+
leadingIcon?: TIconNames;
|
|
20
|
+
trailingIcon?: TIconNames;
|
|
21
|
+
onPress?: (...args: any[]) => any | Promise<any>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export function debounce(handler: (...args: any[]) => any | Promise<any>, delay: number) {
|
|
2
|
+
let wait = false;
|
|
3
|
+
return async (...args: any[]) => {
|
|
4
|
+
if (wait) {
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
wait = true;
|
|
8
|
+
setTimeout(() => {
|
|
9
|
+
wait = false;
|
|
10
|
+
}, delay);
|
|
11
|
+
const res = handler?.(...args);
|
|
12
|
+
if (res instanceof Promise) {
|
|
13
|
+
await res;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ButtonPM as PM } from './button.pm';
|
|
2
|
+
import Common, { WithTouchable } from './Common';
|
|
3
|
+
import Touchable from './Touchable';
|
|
4
|
+
|
|
5
|
+
type TCommon = typeof Common;
|
|
6
|
+
|
|
7
|
+
interface IButton extends TCommon {
|
|
8
|
+
PM: typeof PM;
|
|
9
|
+
WithTouchable: typeof WithTouchable;
|
|
10
|
+
Touchable: typeof Touchable;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const Button = Common as IButton;
|
|
14
|
+
Button.PM = PM;
|
|
15
|
+
// Button.Type = Type;
|
|
16
|
+
Button.WithTouchable = WithTouchable;
|
|
17
|
+
Button.Touchable = Touchable;
|
|
18
|
+
|
|
19
|
+
export default Button;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { FlatList, View } from 'react-native';
|
|
2
|
+
|
|
3
|
+
import { Button } from '@components';
|
|
4
|
+
|
|
5
|
+
export default function Colours({
|
|
6
|
+
data,
|
|
7
|
+
value,
|
|
8
|
+
onChange,
|
|
9
|
+
}: {
|
|
10
|
+
data: { id: string; value: string }[];
|
|
11
|
+
value?: string;
|
|
12
|
+
onChange?: (value: string) => void;
|
|
13
|
+
}) {
|
|
14
|
+
return (
|
|
15
|
+
<View>
|
|
16
|
+
<FlatList
|
|
17
|
+
data={data}
|
|
18
|
+
horizontal
|
|
19
|
+
showsHorizontalScrollIndicator={false}
|
|
20
|
+
renderItem={({ item }) => (
|
|
21
|
+
<ColourSwatch
|
|
22
|
+
key={item.id}
|
|
23
|
+
colour={item.value}
|
|
24
|
+
selected={value === item.id}
|
|
25
|
+
onSelect={() => onChange?.(item.id)}
|
|
26
|
+
/>
|
|
27
|
+
)}
|
|
28
|
+
/>
|
|
29
|
+
</View>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function ColourSwatch({ colour, selected, onSelect }: { colour: string; selected: boolean; onSelect: () => void }) {
|
|
34
|
+
return (
|
|
35
|
+
<Button.Touchable
|
|
36
|
+
mr-xs
|
|
37
|
+
width={36}
|
|
38
|
+
height={36}
|
|
39
|
+
round="full"
|
|
40
|
+
color={colour}
|
|
41
|
+
// borderColor="secondary"
|
|
42
|
+
// borderWidth={selected ? 2 : 0}
|
|
43
|
+
style={{
|
|
44
|
+
transform: [{ scale: selected ? 1 : 0.6 }],
|
|
45
|
+
}}
|
|
46
|
+
onPress={onSelect}
|
|
47
|
+
activeOpacity={0.9}
|
|
48
|
+
/>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { Text, View, type LayoutChangeEvent } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { Icon } from '@components';
|
|
5
|
+
|
|
6
|
+
import { FormPM } from './form.pm';
|
|
7
|
+
import type { TFormCommonProps } from './form.types';
|
|
8
|
+
|
|
9
|
+
export default function FormElement({
|
|
10
|
+
Component = View,
|
|
11
|
+
children,
|
|
12
|
+
actions,
|
|
13
|
+
...formProps
|
|
14
|
+
}: TFormCommonProps & { Component?: any }) {
|
|
15
|
+
const props = FormPM.get(formProps);
|
|
16
|
+
const [actionsWidth, setActionsWidth] = React.useState(0);
|
|
17
|
+
const onActionLayout = useCallback(
|
|
18
|
+
({ nativeEvent: { layout } }: LayoutChangeEvent) => {
|
|
19
|
+
setActionsWidth(layout.width > 16 ? layout.width - 16 : 0);
|
|
20
|
+
},
|
|
21
|
+
[setActionsWidth],
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<View {...props.wrapper}>
|
|
26
|
+
{formProps.label ? <Text {...props.label} /> : null}
|
|
27
|
+
<Component {...props.container}>
|
|
28
|
+
<Icon {...props.icon} />
|
|
29
|
+
{children}
|
|
30
|
+
<View style={{ width: actionsWidth }} />
|
|
31
|
+
<View {...props.actions} onLayout={onActionLayout}>
|
|
32
|
+
{actions}
|
|
33
|
+
</View>
|
|
34
|
+
</Component>
|
|
35
|
+
<Text {...props.error} />
|
|
36
|
+
</View>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { Text } from '@components';
|
|
4
|
+
|
|
5
|
+
import { FormPM } from './form.pm';
|
|
6
|
+
|
|
7
|
+
export default function ErrorText({ error }: { error?: any }) {
|
|
8
|
+
const props = FormPM.get({ error });
|
|
9
|
+
|
|
10
|
+
return <Text {...props.error} accessible={Boolean(error)} />;
|
|
11
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ActivityIndicator } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { Button } from '@components';
|
|
5
|
+
import utils from '@utils';
|
|
6
|
+
|
|
7
|
+
import TextInput from '../TextInput';
|
|
8
|
+
import { useLoading } from '../utils/useLoading.hook';
|
|
9
|
+
|
|
10
|
+
import Common from './Common';
|
|
11
|
+
import SecureTextEntry from './components/SecureTextEntry';
|
|
12
|
+
import type { TFormInputProps } from './form.types';
|
|
13
|
+
|
|
14
|
+
interface TSecureFormInputProps extends TFormInputProps {
|
|
15
|
+
textSkipInjectionValidation?: boolean;
|
|
16
|
+
textRemoveCyrillic?: boolean;
|
|
17
|
+
textSanitize?: boolean;
|
|
18
|
+
textDeduplicate?: boolean;
|
|
19
|
+
textTrim?: boolean;
|
|
20
|
+
textNoSpaces?: boolean;
|
|
21
|
+
textUpperCase?: boolean;
|
|
22
|
+
textCompanyName?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export default function FormInput({
|
|
25
|
+
secure,
|
|
26
|
+
value,
|
|
27
|
+
onChange,
|
|
28
|
+
loading: isLoading,
|
|
29
|
+
placeholder,
|
|
30
|
+
keyboardType,
|
|
31
|
+
maxLength,
|
|
32
|
+
disabled,
|
|
33
|
+
clearable = false,
|
|
34
|
+
type,
|
|
35
|
+
textSkipInjectionValidation = false,
|
|
36
|
+
textRemoveCyrillic = false,
|
|
37
|
+
textSanitize = false,
|
|
38
|
+
textDeduplicate = false,
|
|
39
|
+
textTrim = false,
|
|
40
|
+
textNoSpaces = false,
|
|
41
|
+
textCompanyName = false,
|
|
42
|
+
textContentType,
|
|
43
|
+
textUpperCase,
|
|
44
|
+
autoCapitalize,
|
|
45
|
+
autoComplete,
|
|
46
|
+
...rest
|
|
47
|
+
}: TSecureFormInputProps) {
|
|
48
|
+
const { loading, handle } = useLoading(text => {
|
|
49
|
+
const transformed = utils.string.transform(text, {
|
|
50
|
+
prevValue: value,
|
|
51
|
+
textSkipInjectionValidation,
|
|
52
|
+
textRemoveCyrillic,
|
|
53
|
+
textSanitize,
|
|
54
|
+
textDeduplicate,
|
|
55
|
+
textTrim,
|
|
56
|
+
textNoSpaces,
|
|
57
|
+
textUpperCase,
|
|
58
|
+
textCompanyName,
|
|
59
|
+
});
|
|
60
|
+
return onChange?.(transformed);
|
|
61
|
+
});
|
|
62
|
+
const [active, setActive] = React.useState(false);
|
|
63
|
+
const [secureTextEntry, setSecureTextEntry] = React.useState(secure || false);
|
|
64
|
+
|
|
65
|
+
const onFocus = React.useCallback(() => setActive(true), []);
|
|
66
|
+
const onBlur = React.useCallback(() => setActive(false), []);
|
|
67
|
+
const onSecure = React.useCallback(() => setSecureTextEntry(prev => !prev), []);
|
|
68
|
+
|
|
69
|
+
const hasValue = value != null && String(value).length > 0;
|
|
70
|
+
const isClearable = clearable || (rest as any).clearable === true;
|
|
71
|
+
const showClear = isClearable && !disabled && !secure && hasValue;
|
|
72
|
+
|
|
73
|
+
const externalActions = rest.actions;
|
|
74
|
+
const internalActions = secure ? (
|
|
75
|
+
<SecureTextEntry active={active} error={rest.error} value={secureTextEntry} onChange={onSecure} />
|
|
76
|
+
) : showClear ? (
|
|
77
|
+
<Button type="text" leadingIcon="close" onPress={() => handle('')} />
|
|
78
|
+
) : null;
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<Common
|
|
82
|
+
active={active}
|
|
83
|
+
disabled={disabled}
|
|
84
|
+
type={type}
|
|
85
|
+
hasValue={hasValue}
|
|
86
|
+
{...rest}
|
|
87
|
+
actions={
|
|
88
|
+
<>
|
|
89
|
+
{(isLoading === undefined && loading) || (isLoading && loading) ? (
|
|
90
|
+
<ActivityIndicator size="small" />
|
|
91
|
+
) : null}
|
|
92
|
+
{internalActions}
|
|
93
|
+
{externalActions}
|
|
94
|
+
</>
|
|
95
|
+
}>
|
|
96
|
+
<TextInput
|
|
97
|
+
maxLength={maxLength}
|
|
98
|
+
editable={!disabled}
|
|
99
|
+
focusable={!disabled}
|
|
100
|
+
keyboardType={keyboardType}
|
|
101
|
+
flex={1}
|
|
102
|
+
body-l
|
|
103
|
+
value={value}
|
|
104
|
+
onChangeText={handle}
|
|
105
|
+
placeholder={placeholder}
|
|
106
|
+
onFocus={onFocus}
|
|
107
|
+
onBlur={onBlur}
|
|
108
|
+
secureTextEntry={Boolean(secure && secureTextEntry)}
|
|
109
|
+
textContentType={secure ? 'none' : textContentType}
|
|
110
|
+
autoCapitalize={autoCapitalize}
|
|
111
|
+
autoComplete={autoComplete}
|
|
112
|
+
/>
|
|
113
|
+
</Common>
|
|
114
|
+
);
|
|
115
|
+
}
|