@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,144 @@
|
|
|
1
|
+
import React, { useCallback, useRef, useState, useEffect } from 'react';
|
|
2
|
+
import { StyleSheet, type LayoutChangeEvent, ScrollView } from 'react-native';
|
|
3
|
+
import Animated, { useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';
|
|
4
|
+
|
|
5
|
+
import { Box, Grid, Text, Button } from '@components';
|
|
6
|
+
import { theme } from '@theme';
|
|
7
|
+
|
|
8
|
+
interface ISectionData {
|
|
9
|
+
key: string;
|
|
10
|
+
title: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
type SectionVariant = 'default' | 'outlined';
|
|
14
|
+
|
|
15
|
+
interface ISectionProps {
|
|
16
|
+
data: ISectionData[];
|
|
17
|
+
onChange: (value: ISectionData) => void;
|
|
18
|
+
initialActiveIndex?: number;
|
|
19
|
+
variant?: SectionVariant;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default function Section({ data, onChange, initialActiveIndex, variant = 'default' }: ISectionProps) {
|
|
23
|
+
const [activeIndex, setActiveIndex] = useState(initialActiveIndex || 0);
|
|
24
|
+
const activeItem = useSharedValue<{ width: number; height: number; left: number; top: number } | null>(null);
|
|
25
|
+
const dimensions = useRef<Record<number, { width: number; height: number; x: number; y: number }>>({});
|
|
26
|
+
|
|
27
|
+
const isOutlined = variant === 'outlined';
|
|
28
|
+
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
if (initialActiveIndex !== undefined && initialActiveIndex !== activeIndex) {
|
|
31
|
+
setActiveIndex(initialActiveIndex);
|
|
32
|
+
if (dimensions.current[initialActiveIndex]) {
|
|
33
|
+
activeItem.value = {
|
|
34
|
+
width: dimensions.current[initialActiveIndex].width,
|
|
35
|
+
height: dimensions.current[initialActiveIndex].height,
|
|
36
|
+
left: dimensions.current[initialActiveIndex].x,
|
|
37
|
+
top: dimensions.current[initialActiveIndex].y,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}, [initialActiveIndex, activeIndex, activeItem]);
|
|
42
|
+
|
|
43
|
+
const onPress = useCallback(
|
|
44
|
+
(index: number) => () => {
|
|
45
|
+
if (activeIndex === index) return;
|
|
46
|
+
setActiveIndex(index);
|
|
47
|
+
onChange?.(data[index]);
|
|
48
|
+
activeItem.value = {
|
|
49
|
+
width: dimensions.current[index].width,
|
|
50
|
+
height: dimensions.current[index].height,
|
|
51
|
+
left: dimensions.current[index].x,
|
|
52
|
+
top: dimensions.current[index].y,
|
|
53
|
+
};
|
|
54
|
+
},
|
|
55
|
+
[activeIndex, data, onChange, activeItem],
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
const onLayout = useCallback(
|
|
59
|
+
(index: number) =>
|
|
60
|
+
({
|
|
61
|
+
nativeEvent: {
|
|
62
|
+
layout: { width, height, x, y },
|
|
63
|
+
},
|
|
64
|
+
}: LayoutChangeEvent) => {
|
|
65
|
+
dimensions.current[index] = {
|
|
66
|
+
width,
|
|
67
|
+
height,
|
|
68
|
+
x,
|
|
69
|
+
y,
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
if (index === activeIndex) {
|
|
73
|
+
activeItem.value = {
|
|
74
|
+
width: dimensions.current[index].width,
|
|
75
|
+
height: dimensions.current[index].height,
|
|
76
|
+
left: dimensions.current[index].x,
|
|
77
|
+
top: dimensions.current[index].y,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
[activeIndex, activeItem],
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
const activeStyles = useAnimatedStyle(
|
|
85
|
+
() => ({
|
|
86
|
+
position: 'absolute',
|
|
87
|
+
top: activeItem.value?.top || 0,
|
|
88
|
+
width: withTiming(activeItem.value?.width || 0, { duration: 200 }),
|
|
89
|
+
height: activeItem.value?.height || 0,
|
|
90
|
+
left: withTiming(activeItem.value?.left || 0, { duration: 200 }),
|
|
91
|
+
borderRadius: 4,
|
|
92
|
+
}),
|
|
93
|
+
[activeItem],
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
const containerStyle = isOutlined ? { backgroundColor: theme.color.tertiary } : {};
|
|
97
|
+
|
|
98
|
+
const activeItemColor = isOutlined ? theme.color.onPrimary : theme.color.background;
|
|
99
|
+
|
|
100
|
+
const getTextColor = (index: number) => {
|
|
101
|
+
if (isOutlined) {
|
|
102
|
+
return 'background';
|
|
103
|
+
}
|
|
104
|
+
return index === activeIndex ? 'primary' : 'background';
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
return (
|
|
108
|
+
<ScrollView horizontal showsHorizontalScrollIndicator={false}>
|
|
109
|
+
<Box style={containerStyle} row p-xxs round="xs" color="primary" gap-xxs>
|
|
110
|
+
<Animated.View style={[activeStyles, { backgroundColor: activeItemColor }]} />
|
|
111
|
+
{data.map((item, index) => {
|
|
112
|
+
return (
|
|
113
|
+
<Grid key={item.title} flex={1} onLayout={onLayout(index)}>
|
|
114
|
+
<Button.Touchable
|
|
115
|
+
round="xxs"
|
|
116
|
+
activeOpacity={0.96}
|
|
117
|
+
onPress={onPress(index)}
|
|
118
|
+
style={isOutlined ? styles.itemContainerOutlined : styles.itemContainer}>
|
|
119
|
+
<Text title-m center color={getTextColor(index)} accessible={false}>
|
|
120
|
+
{item.title}
|
|
121
|
+
</Text>
|
|
122
|
+
</Button.Touchable>
|
|
123
|
+
</Grid>
|
|
124
|
+
);
|
|
125
|
+
})}
|
|
126
|
+
</Box>
|
|
127
|
+
</ScrollView>
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const styles = StyleSheet.create({
|
|
132
|
+
itemContainer: {
|
|
133
|
+
minHeight: 32,
|
|
134
|
+
paddingHorizontal: 12,
|
|
135
|
+
alignItems: 'center',
|
|
136
|
+
justifyContent: 'center',
|
|
137
|
+
},
|
|
138
|
+
itemContainerOutlined: {
|
|
139
|
+
minHeight: 28,
|
|
140
|
+
paddingHorizontal: 12,
|
|
141
|
+
alignItems: 'center',
|
|
142
|
+
justifyContent: 'center',
|
|
143
|
+
},
|
|
144
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"id": "component:Section",
|
|
3
|
+
"type": "component",
|
|
4
|
+
"platforms": [
|
|
5
|
+
"react-native"
|
|
6
|
+
],
|
|
7
|
+
"title": "Section",
|
|
8
|
+
"description": "Segmented section control.",
|
|
9
|
+
"status": "stable",
|
|
10
|
+
"since": "1.0.0",
|
|
11
|
+
"tags": [
|
|
12
|
+
"ui"
|
|
13
|
+
],
|
|
14
|
+
"requires": [],
|
|
15
|
+
"dependencies": [],
|
|
16
|
+
"files": [
|
|
17
|
+
{
|
|
18
|
+
"from": "files",
|
|
19
|
+
"to": "ui/components/Section"
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"register": [
|
|
23
|
+
{
|
|
24
|
+
"file": "ui/components/index.ts",
|
|
25
|
+
"marker": "components-import",
|
|
26
|
+
"code": "import Section from './Section/Common';\n"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"file": "ui/components/index.ts",
|
|
30
|
+
"marker": "components-export",
|
|
31
|
+
"code": " Section,\n"
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"manual": [],
|
|
35
|
+
"api": "Section with data, onChange, and variant.",
|
|
36
|
+
"example": "<Section data={tabs} onChange={setTab} />"
|
|
37
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Slider
|
|
2
|
+
|
|
3
|
+
Slider from the previous template kit. Treat the API as experimental until it is wired into a screen.
|
|
4
|
+
|
|
5
|
+
## API
|
|
6
|
+
|
|
7
|
+
Default export from ui/components/Slider.
|
|
8
|
+
|
|
9
|
+
## Example
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
import Slider from '@components/Slider';
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Dependencies
|
|
16
|
+
|
|
17
|
+
None beyond the setup baseline.
|
|
18
|
+
|
|
19
|
+
No other solutions are required.
|
|
20
|
+
|
|
21
|
+
## Manual steps
|
|
22
|
+
|
|
23
|
+
None.
|
|
24
|
+
|
|
25
|
+
## Added in
|
|
26
|
+
|
|
27
|
+
1.0.0 (`experimental`).
|
|
28
|
+
|
|
29
|
+
Install with `forge g add --id component:Slider`.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { ViewToken, ListRenderItem } from 'react-native';
|
|
3
|
+
import Animated, { useAnimatedScrollHandler } from 'react-native-reanimated';
|
|
4
|
+
|
|
5
|
+
import { useSliderContext } from '@ui/components/Slider/Context.tsx';
|
|
6
|
+
|
|
7
|
+
export default function SliderContent<T>({ renderItem }: { renderItem: ListRenderItem<T> }) {
|
|
8
|
+
const { x, scrollIndex, data } = useSliderContext();
|
|
9
|
+
|
|
10
|
+
const onScroll = useAnimatedScrollHandler(
|
|
11
|
+
{
|
|
12
|
+
onScroll: event => {
|
|
13
|
+
x.value = event.contentOffset.x;
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
[],
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
const onViewableItemsChanged = useCallback(({ viewableItems }: { viewableItems: ViewToken[] }) => {
|
|
20
|
+
if (viewableItems.length > 0 && viewableItems[0].index !== null) {
|
|
21
|
+
scrollIndex.value = viewableItems[0].index;
|
|
22
|
+
}
|
|
23
|
+
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<Animated.FlatList
|
|
27
|
+
style={{ flexGrow: 0 }}
|
|
28
|
+
horizontal
|
|
29
|
+
pagingEnabled
|
|
30
|
+
showsHorizontalScrollIndicator={false}
|
|
31
|
+
data={data}
|
|
32
|
+
renderItem={renderItem}
|
|
33
|
+
scrollEventThrottle={16}
|
|
34
|
+
bounces={false}
|
|
35
|
+
removeClippedSubviews
|
|
36
|
+
initialNumToRender={1}
|
|
37
|
+
maxToRenderPerBatch={1}
|
|
38
|
+
windowSize={6}
|
|
39
|
+
viewabilityConfig={{ viewAreaCoveragePercentThreshold: 10, minimumViewTime: 1000 }}
|
|
40
|
+
onViewableItemsChanged={onViewableItemsChanged}
|
|
41
|
+
onScroll={onScroll}
|
|
42
|
+
/>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createContext, useContext, useMemo } from 'react';
|
|
2
|
+
import { useWindowDimensions } from 'react-native';
|
|
3
|
+
import { SharedValue, useSharedValue } from 'react-native-reanimated';
|
|
4
|
+
|
|
5
|
+
interface ISliderContext<T = any> {
|
|
6
|
+
data: T[];
|
|
7
|
+
length: number;
|
|
8
|
+
width: number;
|
|
9
|
+
x: SharedValue<number>;
|
|
10
|
+
scrollIndex: SharedValue<number>;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const SliderContext = createContext<ISliderContext>(null as unknown as ISliderContext);
|
|
14
|
+
|
|
15
|
+
export function SliderProvider({ data, children }: { data: any[]; children: React.ReactNode }) {
|
|
16
|
+
const dimensions = useWindowDimensions();
|
|
17
|
+
const x = useSharedValue(0);
|
|
18
|
+
const scrollIndex = useSharedValue(0);
|
|
19
|
+
|
|
20
|
+
const value = useMemo(
|
|
21
|
+
() => ({ width: dimensions.width, x, scrollIndex, length: data.length, data }),
|
|
22
|
+
[dimensions.width, x, scrollIndex, data],
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
return <SliderContext.Provider value={value} children={children} />;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function useSliderContext() {
|
|
29
|
+
return useContext(SliderContext);
|
|
30
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { StyleSheet, View } from 'react-native';
|
|
3
|
+
import Animated, { Extrapolation, interpolate, useAnimatedStyle } from 'react-native-reanimated';
|
|
4
|
+
|
|
5
|
+
import { theme } from '@theme';
|
|
6
|
+
import { useSliderContext } from '@ui/components/Slider/Context.tsx';
|
|
7
|
+
|
|
8
|
+
export default function Pagination() {
|
|
9
|
+
const { length } = useSliderContext();
|
|
10
|
+
const dots = useMemo(() => Array.from({ length }), [length]);
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<View style={styles.dotContainer}>
|
|
14
|
+
{dots.map((_, index) => (
|
|
15
|
+
<PaginationDot key={index} index={index} />
|
|
16
|
+
))}
|
|
17
|
+
</View>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function PaginationDot({ index }: { index: number }) {
|
|
22
|
+
const { width: screenWidth, x } = useSliderContext();
|
|
23
|
+
|
|
24
|
+
const animation = useAnimatedStyle(() => {
|
|
25
|
+
const opacity = interpolate(
|
|
26
|
+
x.value,
|
|
27
|
+
[(index - 1) * screenWidth, index * screenWidth, (index + 1) * screenWidth],
|
|
28
|
+
[0.3, 1, 0.3],
|
|
29
|
+
Extrapolation.CLAMP,
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
const width = interpolate(
|
|
33
|
+
x.value,
|
|
34
|
+
[(index - 1) * screenWidth, index * screenWidth, (index + 1) * screenWidth],
|
|
35
|
+
[8, 16, 8],
|
|
36
|
+
Extrapolation.CLAMP,
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
width,
|
|
41
|
+
opacity,
|
|
42
|
+
};
|
|
43
|
+
}, []);
|
|
44
|
+
|
|
45
|
+
return <Animated.View style={[styles.dot, animation]} />;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const styles = StyleSheet.create({
|
|
49
|
+
dotContainer: {
|
|
50
|
+
flexDirection: 'row',
|
|
51
|
+
alignItems: 'center',
|
|
52
|
+
gap: 6,
|
|
53
|
+
// justifyContent: ''
|
|
54
|
+
},
|
|
55
|
+
dot: {
|
|
56
|
+
width: 8,
|
|
57
|
+
height: 8,
|
|
58
|
+
borderRadius: 4,
|
|
59
|
+
backgroundColor: theme.color.primary,
|
|
60
|
+
},
|
|
61
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import Container from './Container';
|
|
2
|
+
import Content from './Content';
|
|
3
|
+
import { useSliderContext } from './Context';
|
|
4
|
+
import Pagination from './Pagination.Dot';
|
|
5
|
+
|
|
6
|
+
type TContainer = typeof Container;
|
|
7
|
+
type TContent = typeof Content;
|
|
8
|
+
type TPagination = typeof Pagination;
|
|
9
|
+
type TuseSliderContext = typeof useSliderContext;
|
|
10
|
+
|
|
11
|
+
interface ISlider extends TContainer {
|
|
12
|
+
Content: TContent;
|
|
13
|
+
Pagination: TPagination;
|
|
14
|
+
useSliderContext: TuseSliderContext;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const Slider = Container as ISlider;
|
|
18
|
+
Slider.Content = Content;
|
|
19
|
+
Slider.Pagination = Pagination;
|
|
20
|
+
Slider.useSliderContext = useSliderContext;
|
|
21
|
+
|
|
22
|
+
export default Slider;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"id": "component:Slider",
|
|
3
|
+
"type": "component",
|
|
4
|
+
"platforms": [
|
|
5
|
+
"react-native"
|
|
6
|
+
],
|
|
7
|
+
"title": "Slider",
|
|
8
|
+
"description": "Slider from the previous template kit. Treat the API as experimental until it is wired into a screen.",
|
|
9
|
+
"status": "experimental",
|
|
10
|
+
"since": "1.0.0",
|
|
11
|
+
"tags": [
|
|
12
|
+
"ui",
|
|
13
|
+
"kit"
|
|
14
|
+
],
|
|
15
|
+
"requires": [],
|
|
16
|
+
"dependencies": [],
|
|
17
|
+
"files": [
|
|
18
|
+
{
|
|
19
|
+
"from": "files",
|
|
20
|
+
"to": "ui/components/Slider"
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
"register": [
|
|
24
|
+
{
|
|
25
|
+
"file": "ui/components/index.ts",
|
|
26
|
+
"marker": "components-import",
|
|
27
|
+
"code": "import Slider from './Slider';\n"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"file": "ui/components/index.ts",
|
|
31
|
+
"marker": "components-export",
|
|
32
|
+
"code": " Slider,\n"
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
"manual": [],
|
|
36
|
+
"api": "Default export from ui/components/Slider.",
|
|
37
|
+
"example": "import Slider from '@components/Slider';"
|
|
38
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Switch
|
|
2
|
+
|
|
3
|
+
Themed switch.
|
|
4
|
+
|
|
5
|
+
## API
|
|
6
|
+
|
|
7
|
+
Switch with value and onValueChange, styled through Switch.PM.
|
|
8
|
+
|
|
9
|
+
## Example
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
<Switch value={on} onValueChange={setOn} />
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Dependencies
|
|
16
|
+
|
|
17
|
+
None beyond the setup baseline.
|
|
18
|
+
|
|
19
|
+
No other solutions are required.
|
|
20
|
+
|
|
21
|
+
## Manual steps
|
|
22
|
+
|
|
23
|
+
None.
|
|
24
|
+
|
|
25
|
+
## Added in
|
|
26
|
+
|
|
27
|
+
1.0.0 (`stable`).
|
|
28
|
+
|
|
29
|
+
Install with `forge g add --id component:Switch`.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Pressable, Text, View } from 'react-native';
|
|
3
|
+
import Animated, { LinearTransition } from 'react-native-reanimated';
|
|
4
|
+
|
|
5
|
+
import { Icon, ProgressIndicator } from '@components';
|
|
6
|
+
import { useLoading } from '@components/utils/useLoading.hook';
|
|
7
|
+
|
|
8
|
+
import { SwitchPM } from './switch.pm';
|
|
9
|
+
|
|
10
|
+
interface ISwitchProps {
|
|
11
|
+
label?: string;
|
|
12
|
+
value?: boolean;
|
|
13
|
+
loading?: boolean;
|
|
14
|
+
onChange?: (value: boolean) => void | Promise<void>;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
reverse?: boolean;
|
|
17
|
+
stretched?: boolean;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default function Switch({ label, value, onChange, disabled, reverse, stretched = true, loading }: ISwitchProps) {
|
|
21
|
+
const { loading: internalLoading, handle } = useLoading(() => onChange?.(!value));
|
|
22
|
+
|
|
23
|
+
const props = SwitchPM.get({ value, loading: loading || internalLoading, disabled, label, reverse, stretched });
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<Pressable disabled={disabled || loading} {...props.container} onPress={handle}>
|
|
27
|
+
<View {...props.wrapper}>
|
|
28
|
+
<Animated.View layout={LinearTransition.springify(600).damping(14)}>
|
|
29
|
+
<View {...props.track}>
|
|
30
|
+
<Icon icon={value ? 'check' : 'close'} size={18} color="primary" />
|
|
31
|
+
</View>
|
|
32
|
+
</Animated.View>
|
|
33
|
+
{/*{loading ? <ProgressIndicator.Circular size={14} /> : null}*/}
|
|
34
|
+
</View>
|
|
35
|
+
{props.label.children ? <Text {...props.label} /> : null}
|
|
36
|
+
</Pressable>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Prop, Node, PropertyManager, Static } from '@effijs/props-manager';
|
|
2
|
+
|
|
3
|
+
export const SwitchPM = PropertyManager.create('Switch').node(
|
|
4
|
+
Node('container')
|
|
5
|
+
.extends('Grid')
|
|
6
|
+
.keys(Static({ row: true, 'gap-s': true, 'align-center': true })),
|
|
7
|
+
Node('track').keys(
|
|
8
|
+
'style',
|
|
9
|
+
Static({
|
|
10
|
+
height: 30,
|
|
11
|
+
width: 30,
|
|
12
|
+
borderRadius: 999,
|
|
13
|
+
backgroundColor: '#FFFFFF',
|
|
14
|
+
alignItems: 'center',
|
|
15
|
+
justifyContent: 'center',
|
|
16
|
+
}),
|
|
17
|
+
),
|
|
18
|
+
Node('wrapper')
|
|
19
|
+
.extends('Box')
|
|
20
|
+
.pickKeys('value', 'disabled')
|
|
21
|
+
.keys(
|
|
22
|
+
'style',
|
|
23
|
+
Static({
|
|
24
|
+
minWidth: 54,
|
|
25
|
+
height: 36,
|
|
26
|
+
borderRadius: 18,
|
|
27
|
+
paddingHorizontal: 3,
|
|
28
|
+
}),
|
|
29
|
+
)
|
|
30
|
+
.keys(
|
|
31
|
+
Static({
|
|
32
|
+
color: 'primary',
|
|
33
|
+
'align-start': true,
|
|
34
|
+
'justify-center': true,
|
|
35
|
+
}),
|
|
36
|
+
Prop('value', () => ({
|
|
37
|
+
color: 'primary',
|
|
38
|
+
'align-end': true,
|
|
39
|
+
})),
|
|
40
|
+
Prop('disabled', () => ({
|
|
41
|
+
color: 'outline',
|
|
42
|
+
})),
|
|
43
|
+
),
|
|
44
|
+
Node('label')
|
|
45
|
+
.extends('Text')
|
|
46
|
+
.pickKeys('label', 'stretched')
|
|
47
|
+
.keys(
|
|
48
|
+
Static({ 'body-m': true, color: 'secondary' }),
|
|
49
|
+
Prop(['label', 'stretched'], ({ label, stretched }) => {
|
|
50
|
+
return { children: label, flex: stretched && label ? 1 : 0 };
|
|
51
|
+
}),
|
|
52
|
+
),
|
|
53
|
+
);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"id": "component:Switch",
|
|
3
|
+
"type": "component",
|
|
4
|
+
"platforms": [
|
|
5
|
+
"react-native"
|
|
6
|
+
],
|
|
7
|
+
"title": "Switch",
|
|
8
|
+
"description": "Themed switch.",
|
|
9
|
+
"status": "stable",
|
|
10
|
+
"since": "1.0.0",
|
|
11
|
+
"tags": [
|
|
12
|
+
"ui",
|
|
13
|
+
"form"
|
|
14
|
+
],
|
|
15
|
+
"requires": [],
|
|
16
|
+
"dependencies": [],
|
|
17
|
+
"files": [
|
|
18
|
+
{
|
|
19
|
+
"from": "files",
|
|
20
|
+
"to": "ui/components/Switch"
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
"register": [
|
|
24
|
+
{
|
|
25
|
+
"file": "ui/components/index.ts",
|
|
26
|
+
"marker": "components-import",
|
|
27
|
+
"code": "import Switch from './Switch';\n"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"file": "ui/components/index.ts",
|
|
31
|
+
"marker": "components-export",
|
|
32
|
+
"code": " Switch,\n"
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
"manual": [],
|
|
36
|
+
"api": "Switch with value and onValueChange, styled through Switch.PM.",
|
|
37
|
+
"example": "<Switch value={on} onValueChange={setOn} />"
|
|
38
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
|
|
4
|
+
import { copyStaticFile } from '@effijs/forge';
|
|
5
|
+
import { depsByKeys } from '../../../lib/compat.js';
|
|
6
|
+
import { installPackages } from '../../../lib/install.js';
|
|
7
|
+
import { markInstalled } from '../../../lib/journal.js';
|
|
8
|
+
import { writeMigration, aiPrompt } from '../../../lib/migration.js';
|
|
9
|
+
import { projectRoot } from '../../../lib/project.js';
|
|
10
|
+
|
|
11
|
+
function markerPattern(name) {
|
|
12
|
+
const escaped = String(name).replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
13
|
+
return `// forge:${escaped}`;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
async function copySolutionDirectory(forge, from, to, { dryRun, force }) {
|
|
17
|
+
const previous = forge.runOptions;
|
|
18
|
+
const runDry = dryRun ?? previous?.dryRun;
|
|
19
|
+
const runForce = force ?? previous?.force;
|
|
20
|
+
// processDirectory reads dryRun and force from the forge instance, not its options.
|
|
21
|
+
forge.runOptions = { ...previous, dryRun: runDry, force: runForce };
|
|
22
|
+
try {
|
|
23
|
+
return await forge.processDirectory(from, to, {}, {
|
|
24
|
+
templateSuffix: '.hbs',
|
|
25
|
+
dryRun: runDry,
|
|
26
|
+
force: runForce,
|
|
27
|
+
});
|
|
28
|
+
} finally {
|
|
29
|
+
forge.runOptions = previous;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export async function installSolution(solution, { forge, outputDir, dryRun, force, compat, packageManager }) {
|
|
34
|
+
const notes = [];
|
|
35
|
+
for (const file of solution.files) {
|
|
36
|
+
const from = path.join(solution._dir, file.from);
|
|
37
|
+
const to = path.join(outputDir, file.to);
|
|
38
|
+
const stat = fs.existsSync(from) ? fs.statSync(from) : null;
|
|
39
|
+
if (!stat) return { success: false, error: `Solution file missing: ${file.from}` };
|
|
40
|
+
if (stat.isDirectory()) {
|
|
41
|
+
let copied;
|
|
42
|
+
try {
|
|
43
|
+
copied = await copySolutionDirectory(forge, from, to, { dryRun, force });
|
|
44
|
+
} catch (error) {
|
|
45
|
+
return { success: false, error: error.message || `Failed to copy ${file.from}` };
|
|
46
|
+
}
|
|
47
|
+
const failed = copied.find((item) => !item?.success);
|
|
48
|
+
if (failed) return { success: false, error: failed.error || `Failed to copy ${file.from}` };
|
|
49
|
+
} else {
|
|
50
|
+
const copied = await copyStaticFile(from, to, { dryRun, force });
|
|
51
|
+
if (!copied.success) return { success: false, error: copied.error || `Failed to copy ${file.from}` };
|
|
52
|
+
}
|
|
53
|
+
notes.push(file.to);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
for (const entry of solution.register ?? []) {
|
|
57
|
+
const target = path.join(outputDir, entry.file);
|
|
58
|
+
if (!fs.existsSync(target)) {
|
|
59
|
+
return { success: false, error: `${entry.file} is missing. Run forge g init first.` };
|
|
60
|
+
}
|
|
61
|
+
const appended = await forge.appendToFile(
|
|
62
|
+
target,
|
|
63
|
+
entry.code,
|
|
64
|
+
{ pattern: markerPattern(entry.marker), flags: '', before: true, unique: true }, // flags '' keeps the first marker only
|
|
65
|
+
{ dryRun, force },
|
|
66
|
+
);
|
|
67
|
+
if (!appended?.success) {
|
|
68
|
+
return { success: false, error: `${entry.file}: ${appended?.error ?? `Marker // forge:${entry.marker} was not found`}` };
|
|
69
|
+
}
|
|
70
|
+
notes.push(`registered ${entry.file}`);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (solution.dependencies?.length && compat) {
|
|
74
|
+
const deps = depsByKeys(compat, solution.dependencies);
|
|
75
|
+
const installed = installPackages({
|
|
76
|
+
root: projectRoot(forge),
|
|
77
|
+
packageManager,
|
|
78
|
+
...deps,
|
|
79
|
+
dryRun,
|
|
80
|
+
});
|
|
81
|
+
if (installed.command) notes.push(installed.command);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (solution.manual?.length && !dryRun) {
|
|
85
|
+
const file = await writeMigration(projectRoot(forge), {
|
|
86
|
+
title: `Manual steps for ${solution.id}`,
|
|
87
|
+
target: solution.id,
|
|
88
|
+
reason: `${solution.title} needs native or console setup that a generator cannot finish.`,
|
|
89
|
+
required: solution.manual.join('\n\n'),
|
|
90
|
+
prompt: aiPrompt('.forge/migrations/<this-file>'),
|
|
91
|
+
});
|
|
92
|
+
notes.push(`Manual steps: ${file}`);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
await markInstalled(projectRoot(forge), solution.id, { dryRun });
|
|
96
|
+
return { success: true, notes };
|
|
97
|
+
}
|