@effijs/templates 0.0.0-stage → 1.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +27 -0
- package/LICENSE +22 -0
- package/README.md +32 -2
- package/ai/SETUP.md +5 -0
- package/docs/catalog.md +85 -0
- package/forge.manifest.js +75 -0
- package/lib/compat.js +40 -0
- package/lib/docs/build.js +146 -0
- package/lib/install.js +51 -0
- package/lib/journal.js +40 -0
- package/lib/jsonConfig.js +33 -0
- package/lib/migration.js +35 -0
- package/lib/names.js +42 -0
- package/lib/patch.js +62 -0
- package/lib/paths.js +12 -0
- package/lib/project.js +48 -0
- package/lib/registry.js +99 -0
- package/package.json +46 -4
- package/platforms/react-native/CATALOG.md +391 -0
- package/platforms/react-native/ORIGIN.md +42 -0
- package/platforms/react-native/README.md +78 -0
- package/platforms/react-native/ai/AGENTS.md.hbs +36 -0
- package/platforms/react-native/ai/SETUP.md +89 -0
- package/platforms/react-native/compat/matrix.js +150 -0
- package/platforms/react-native/configs/babel.js +63 -0
- package/platforms/react-native/configs/forgeConfig.js +35 -0
- package/platforms/react-native/configs/jsConfigs.js +96 -0
- package/platforms/react-native/configs/metro.js +86 -0
- package/platforms/react-native/generators/add/generator.js +12 -0
- package/platforms/react-native/generators/add/run.js +64 -0
- package/platforms/react-native/generators/component/generator.js +75 -0
- package/platforms/react-native/generators/component/render.js +69 -0
- package/platforms/react-native/generators/component/templates/Common.tsx.hbs +13 -0
- package/platforms/react-native/generators/component/templates/index.ts.hbs +13 -0
- package/platforms/react-native/generators/component/templates/pm.ts.hbs +7 -0
- package/platforms/react-native/generators/component/templates/types.ts.hbs +3 -0
- package/platforms/react-native/generators/demo/files/api/app.http +8 -0
- package/platforms/react-native/generators/demo/files/api/environment/http-client.env.json +5 -0
- package/platforms/react-native/generators/demo/files/entity/category/category.api.ts +18 -0
- package/platforms/react-native/generators/demo/files/entity/category/category.dto.ts +15 -0
- package/platforms/react-native/generators/demo/files/entity/category/category.service.ts +42 -0
- package/platforms/react-native/generators/demo/files/entity/category/category.store.ts +26 -0
- package/platforms/react-native/generators/demo/files/entity/category/index.ts +2 -0
- package/platforms/react-native/generators/demo/files/entity/product/index.ts +2 -0
- package/platforms/react-native/generators/demo/files/entity/product/product.api.ts +49 -0
- package/platforms/react-native/generators/demo/files/entity/product/product.dto.ts +120 -0
- package/platforms/react-native/generators/demo/files/entity/product/product.service.ts +139 -0
- package/platforms/react-native/generators/demo/files/entity/product/product.store.ts +37 -0
- package/platforms/react-native/generators/demo/files/feature/product/components/Product.CategorySelect.tsx +36 -0
- package/platforms/react-native/generators/demo/files/feature/product/detail/Product.Detail.Screen.tsx +100 -0
- package/platforms/react-native/generators/demo/files/feature/product/detail/product.detail.service.ts +33 -0
- package/platforms/react-native/generators/demo/files/feature/product/filter/Product.Filter.Screen.tsx +59 -0
- package/platforms/react-native/generators/demo/files/feature/product/filter/product.filter.service.ts +78 -0
- package/platforms/react-native/generators/demo/files/feature/product/form/Product.Form.Screen.tsx +71 -0
- package/platforms/react-native/generators/demo/files/feature/product/form/product.form.service.ts +142 -0
- package/platforms/react-native/generators/demo/files/feature/product/index.ts +7 -0
- package/platforms/react-native/generators/demo/files/feature/product/list/Product.List.Item.tsx +34 -0
- package/platforms/react-native/generators/demo/files/feature/product/list/Product.List.Screen.tsx +106 -0
- package/platforms/react-native/generators/demo/files/feature/product/list/product.list.service.ts +47 -0
- package/platforms/react-native/generators/demo/files/feature/product/product.feature.ts +29 -0
- package/platforms/react-native/generators/demo/files/feature/product/product.hooks.ts +7 -0
- package/platforms/react-native/generators/demo/files/feature/product/search/Product.Search.Screen.tsx +82 -0
- package/platforms/react-native/generators/demo/files/feature/product/search/product.search.service.ts +97 -0
- package/platforms/react-native/generators/demo/files/navigation/navigation.product.ts +46 -0
- package/platforms/react-native/generators/demo/generator.js +93 -0
- package/platforms/react-native/generators/entity/generator.js +68 -0
- package/platforms/react-native/generators/feature/generator.js +224 -0
- package/platforms/react-native/generators/feature/render.js +163 -0
- package/platforms/react-native/generators/feature/templates/detail.screen.tsx.hbs +25 -0
- package/platforms/react-native/generators/feature/templates/detail.service.ts.hbs +14 -0
- package/platforms/react-native/generators/feature/templates/feature.ts.hbs +18 -0
- package/platforms/react-native/generators/feature/templates/filter.screen.tsx.hbs +17 -0
- package/platforms/react-native/generators/feature/templates/filter.service.ts.hbs +14 -0
- package/platforms/react-native/generators/feature/templates/form.screen.tsx.hbs +21 -0
- package/platforms/react-native/generators/feature/templates/form.service.ts.hbs +37 -0
- package/platforms/react-native/generators/feature/templates/hooks.ts.hbs +7 -0
- package/platforms/react-native/generators/feature/templates/index.ts.hbs +2 -0
- package/platforms/react-native/generators/feature/templates/list.item.tsx.hbs +16 -0
- package/platforms/react-native/generators/feature/templates/list.screen.tsx.hbs +34 -0
- package/platforms/react-native/generators/feature/templates/list.service.ts.hbs +15 -0
- package/platforms/react-native/generators/feature/templates/navigation.ts.hbs +12 -0
- package/platforms/react-native/generators/feature/templates/search.screen.tsx.hbs +24 -0
- package/platforms/react-native/generators/feature/templates/search.service.ts.hbs +13 -0
- package/platforms/react-native/generators/feature/templates/tab.tsx.hbs +8 -0
- package/platforms/react-native/generators/init/files/app/app.controller.ts +41 -0
- package/platforms/react-native/generators/init/files/app/app.error.ts +1 -0
- package/platforms/react-native/generators/init/files/app/app.store.ts +12 -0
- package/platforms/react-native/generators/init/files/app/index.ts +19 -0
- package/platforms/react-native/generators/init/files/app/splash/Onboarding.Screen.tsx +31 -0
- package/platforms/react-native/generators/init/files/app/splash/Splash.Screen.tsx +14 -0
- package/platforms/react-native/generators/init/files/app/tabs/home/Home.tab.tsx +24 -0
- package/platforms/react-native/generators/init/files/app/tabs/profile/Profile.tab.tsx +1 -0
- package/platforms/react-native/generators/init/files/configs/dev.ts.hbs +5 -0
- package/platforms/react-native/generators/init/files/configs/index.ts +4 -0
- package/platforms/react-native/generators/init/files/configs/prod.ts.hbs +5 -0
- package/platforms/react-native/generators/init/files/entity/auth/auth.api.ts +36 -0
- package/platforms/react-native/generators/init/files/entity/auth/auth.dto.ts +26 -0
- package/platforms/react-native/generators/init/files/entity/auth/auth.service.ts +94 -0
- package/platforms/react-native/generators/init/files/entity/auth/auth.session.store.ts +14 -0
- package/platforms/react-native/generators/init/files/entity/auth/auth.store.ts +20 -0
- package/platforms/react-native/generators/init/files/entity/auth/index.ts +2 -0
- package/platforms/react-native/generators/init/files/entity/index.ts +2 -0
- package/platforms/react-native/generators/init/files/feature/auth/auth.feature.ts +10 -0
- package/platforms/react-native/generators/init/files/feature/auth/auth.hooks.ts +7 -0
- package/platforms/react-native/generators/init/files/feature/auth/index.ts +1 -0
- package/platforms/react-native/generators/init/files/feature/auth/sign-in/SignIn.Screen.tsx +39 -0
- package/platforms/react-native/generators/init/files/feature/auth/sign-in/signIn.service.ts +54 -0
- package/platforms/react-native/generators/init/files/feature/auth/sign-up/SignUp.Screen.tsx +64 -0
- package/platforms/react-native/generators/init/files/feature/auth/sign-up/signUp.service.ts +73 -0
- package/platforms/react-native/generators/init/files/feature/feature.hooks.ts +15 -0
- package/platforms/react-native/generators/init/files/feature/index.ts +3 -0
- package/platforms/react-native/generators/init/files/feature/profile/Profile.Screen.tsx +52 -0
- package/platforms/react-native/generators/init/files/feature/profile/index.ts +1 -0
- package/platforms/react-native/generators/init/files/feature/profile/profile.feature.ts +18 -0
- package/platforms/react-native/generators/init/files/feature/profile/profile.hooks.ts +7 -0
- package/platforms/react-native/generators/init/files/index.ts +16 -0
- package/platforms/react-native/generators/init/files/navigation/index.ts +18 -0
- package/platforms/react-native/generators/init/files/navigation/navigation.app.ts +58 -0
- package/platforms/react-native/generators/init/files/navigation/navigation.features.ts +9 -0
- package/platforms/react-native/generators/init/files/navigation/navigation.hooks.ts +5 -0
- package/platforms/react-native/generators/init/files/navigation/navigation.tabs.ts +55 -0
- package/platforms/react-native/generators/init/files/navigation/navigation.widgets.ts +23 -0
- package/platforms/react-native/generators/init/files/services/http/http.base.ts +69 -0
- package/platforms/react-native/generators/init/files/services/http/http.error.ts +10 -0
- package/platforms/react-native/generators/init/files/services/http/http.service.ts +24 -0
- package/platforms/react-native/generators/init/files/services/http/middleware/index.ts +12 -0
- package/platforms/react-native/generators/init/files/services/http/middleware/middleware.error.ts +36 -0
- package/platforms/react-native/generators/init/files/services/http/middleware/middleware.registry.ts +3 -0
- package/platforms/react-native/generators/init/files/services/http/middleware/middleware.token.ts +97 -0
- package/platforms/react-native/generators/init/files/services/index.ts +15 -0
- package/platforms/react-native/generators/init/files/ui/components/Box/Common.tsx +19 -0
- package/platforms/react-native/generators/init/files/ui/components/Box/box.pm.ts +111 -0
- package/platforms/react-native/generators/init/files/ui/components/Box/box.types.ts +8 -0
- package/platforms/react-native/generators/init/files/ui/components/Box/index.ts +13 -0
- package/platforms/react-native/generators/init/files/ui/components/Button/Common.tsx +50 -0
- package/platforms/react-native/generators/init/files/ui/components/Button/Touchable.tsx +19 -0
- package/platforms/react-native/generators/init/files/ui/components/Button/button.pm.ts +197 -0
- package/platforms/react-native/generators/init/files/ui/components/Button/button.types.ts +22 -0
- package/platforms/react-native/generators/init/files/ui/components/Button/button.utils.ts +16 -0
- package/platforms/react-native/generators/init/files/ui/components/Button/index.ts +19 -0
- package/platforms/react-native/generators/init/files/ui/components/Form/Colours.tsx +50 -0
- package/platforms/react-native/generators/init/files/ui/components/Form/Common.tsx +38 -0
- package/platforms/react-native/generators/init/files/ui/components/Form/ErrorText.tsx +11 -0
- package/platforms/react-native/generators/init/files/ui/components/Form/Input.tsx +115 -0
- package/platforms/react-native/generators/init/files/ui/components/Form/InputArea.tsx +70 -0
- package/platforms/react-native/generators/init/files/ui/components/Form/Label.tsx +18 -0
- package/platforms/react-native/generators/init/files/ui/components/Form/Select.tsx +86 -0
- package/platforms/react-native/generators/init/files/ui/components/Form/components/SecureTextEntry.tsx +19 -0
- package/platforms/react-native/generators/init/files/ui/components/Form/form.error.ts +18 -0
- package/platforms/react-native/generators/init/files/ui/components/Form/form.pm.ts +134 -0
- package/platforms/react-native/generators/init/files/ui/components/Form/form.types.ts +59 -0
- package/platforms/react-native/generators/init/files/ui/components/Form/index.ts +67 -0
- package/platforms/react-native/generators/init/files/ui/components/Grid/Common.tsx +11 -0
- package/platforms/react-native/generators/init/files/ui/components/Grid/grid.pm.ts +93 -0
- package/platforms/react-native/generators/init/files/ui/components/Grid/grid.types.ts +79 -0
- package/platforms/react-native/generators/init/files/ui/components/Grid/index.ts +13 -0
- package/platforms/react-native/generators/init/files/ui/components/Icon/Common.tsx +19 -0
- package/platforms/react-native/generators/init/files/ui/components/Icon/icons.pm.ts +74 -0
- package/platforms/react-native/generators/init/files/ui/components/Icon/icons.types.ts +19 -0
- package/platforms/react-native/generators/init/files/ui/components/Icon/index.ts +3 -0
- package/platforms/react-native/generators/init/files/ui/components/Loading/Loading.tsx +10 -0
- package/platforms/react-native/generators/init/files/ui/components/Loading/loading.hook.ts +5 -0
- package/platforms/react-native/generators/init/files/ui/components/Loading/loading.service.ts +22 -0
- package/platforms/react-native/generators/init/files/ui/components/Loading/loading.store.ts +8 -0
- package/platforms/react-native/generators/init/files/ui/components/Screen/Common.tsx +87 -0
- package/platforms/react-native/generators/init/files/ui/components/Screen/Content.tsx +77 -0
- package/platforms/react-native/generators/init/files/ui/components/Screen/Header.tsx +80 -0
- package/platforms/react-native/generators/init/files/ui/components/Screen/HeaderTab.tsx +17 -0
- package/platforms/react-native/generators/init/files/ui/components/Screen/SafeAreaHOC.tsx +9 -0
- package/platforms/react-native/generators/init/files/ui/components/Screen/index.ts +22 -0
- package/platforms/react-native/generators/init/files/ui/components/Text/Common.tsx +20 -0
- package/platforms/react-native/generators/init/files/ui/components/Text/index.ts +13 -0
- package/platforms/react-native/generators/init/files/ui/components/Text/text.pm.ts +55 -0
- package/platforms/react-native/generators/init/files/ui/components/Text/text.types.ts +27 -0
- package/platforms/react-native/generators/init/files/ui/components/TextInput/Common.tsx +19 -0
- package/platforms/react-native/generators/init/files/ui/components/TextInput/index.ts +15 -0
- package/platforms/react-native/generators/init/files/ui/components/TextInput/textInput.pm.ts +65 -0
- package/platforms/react-native/generators/init/files/ui/components/TextInput/textInput.types.ts +16 -0
- package/platforms/react-native/generators/init/files/ui/components/ThemePicker/ThemePicker.tsx +92 -0
- package/platforms/react-native/generators/init/files/ui/components/ThemePicker/index.ts +1 -0
- package/platforms/react-native/generators/init/files/ui/components/index.ts +27 -0
- package/platforms/react-native/generators/init/files/ui/components/utils/color.ts +19 -0
- package/platforms/react-native/generators/init/files/ui/components/utils/index.ts +3 -0
- package/platforms/react-native/generators/init/files/ui/components/utils/useLoading.hook.spec.tsx +202 -0
- package/platforms/react-native/generators/init/files/ui/components/utils/useLoading.hook.ts +172 -0
- package/platforms/react-native/generators/init/files/ui/components/utils/useStore.ts +34 -0
- package/platforms/react-native/generators/init/files/ui/fonts/font-icons.ttf +0 -0
- package/platforms/react-native/generators/init/files/ui/icons/font-icons.json +53 -0
- package/platforms/react-native/generators/init/files/ui/icons/logo.png +0 -0
- package/platforms/react-native/generators/init/files/ui/icons/logo.svg +304 -0
- package/platforms/react-native/generators/init/files/ui/icons/tabs/icon-1.png +0 -0
- package/platforms/react-native/generators/init/files/ui/icons/tabs/icon-2.png +0 -0
- package/platforms/react-native/generators/init/files/ui/theme/black/black.color.ts +8 -0
- package/platforms/react-native/generators/init/files/ui/theme/black/index.ts +10 -0
- package/platforms/react-native/generators/init/files/ui/theme/blue/blue.color.ts +8 -0
- package/platforms/react-native/generators/init/files/ui/theme/blue/index.ts +10 -0
- package/platforms/react-native/generators/init/files/ui/theme/green/green.color.ts +8 -0
- package/platforms/react-native/generators/init/files/ui/theme/green/index.ts +10 -0
- package/platforms/react-native/generators/init/files/ui/theme/index.ts +11 -0
- package/platforms/react-native/generators/init/files/ui/theme/pink/index.ts +10 -0
- package/platforms/react-native/generators/init/files/ui/theme/pink/pink.color.ts +8 -0
- package/platforms/react-native/generators/init/files/ui/theme/scheme/index.ts +23 -0
- package/platforms/react-native/generators/init/files/ui/theme/scheme/theme.scheme.color.ts +139 -0
- package/platforms/react-native/generators/init/files/ui/theme/scheme/theme.scheme.radius.ts +21 -0
- package/platforms/react-native/generators/init/files/ui/theme/scheme/theme.scheme.spacing.ts +24 -0
- package/platforms/react-native/generators/init/files/ui/theme/scheme/theme.scheme.ts +25 -0
- package/platforms/react-native/generators/init/files/ui/theme/scheme/theme.scheme.typography.ts +98 -0
- package/platforms/react-native/generators/init/files/ui/theme/shared/index.ts +4 -0
- package/platforms/react-native/generators/init/files/ui/theme/shared/shared.color.base.ts +79 -0
- package/platforms/react-native/generators/init/files/ui/theme/shared/shared.radius.ts +8 -0
- package/platforms/react-native/generators/init/files/ui/theme/shared/shared.spacing.ts +9 -0
- package/platforms/react-native/generators/init/files/ui/theme/shared/shared.typography.ts +105 -0
- package/platforms/react-native/generators/init/files/ui/theme/theme.hooks.ts +7 -0
- package/platforms/react-native/generators/init/files/ui/theme/theme.meta.ts +10 -0
- package/platforms/react-native/generators/init/files/ui/theme/theme.provider.tsx +19 -0
- package/platforms/react-native/generators/init/files/ui/theme/theme.service.ts +36 -0
- package/platforms/react-native/generators/init/files/ui/theme/theme.ts +27 -0
- package/platforms/react-native/generators/init/files/ui/widgets/index.ts +1 -0
- package/platforms/react-native/generators/init/files/ui/widgets/toast/Toast.Item.tsx +175 -0
- package/platforms/react-native/generators/init/files/ui/widgets/toast/Toast.Overlay.tsx +46 -0
- package/platforms/react-native/generators/init/files/ui/widgets/toast/Toast.Stack.tsx +75 -0
- package/platforms/react-native/generators/init/files/ui/widgets/toast/index.ts +7 -0
- package/platforms/react-native/generators/init/files/ui/widgets/toast/toast.hooks.ts +18 -0
- package/platforms/react-native/generators/init/files/ui/widgets/toast/toast.service.ts +39 -0
- package/platforms/react-native/generators/init/files/ui/widgets/toast/toast.store.ts +59 -0
- package/platforms/react-native/generators/init/files/ui/widgets/toast/toast.types.ts +18 -0
- package/platforms/react-native/generators/init/files/ui/widgets/widgets.feature.ts +14 -0
- package/platforms/react-native/generators/init/files/utils/date.ts +11 -0
- package/platforms/react-native/generators/init/files/utils/index.ts +12 -0
- package/platforms/react-native/generators/init/files/utils/store.persistent.ts +103 -0
- package/platforms/react-native/generators/init/files/utils/store.registry.ts +14 -0
- package/platforms/react-native/generators/init/files/utils/string.ts +100 -0
- package/platforms/react-native/generators/init/generator.js +86 -0
- package/platforms/react-native/generators/init/kit.js +23 -0
- package/platforms/react-native/generators/init/navigators/expo-router/index.ts +18 -0
- package/platforms/react-native/generators/init/navigators/expo-router/navigation.app.ts +8 -0
- package/platforms/react-native/generators/init/navigators/expo-router/navigation.features.ts +9 -0
- package/platforms/react-native/generators/init/navigators/expo-router/navigation.hooks.ts +5 -0
- package/platforms/react-native/generators/init/navigators/expo-router/navigation.tabs.ts +7 -0
- package/platforms/react-native/generators/init/navigators/expo-router/navigation.widgets.ts +5 -0
- package/platforms/react-native/generators/init/navigators/react-navigation/index.ts +18 -0
- package/platforms/react-native/generators/init/navigators/react-navigation/navigation.app.ts +8 -0
- package/platforms/react-native/generators/init/navigators/react-navigation/navigation.features.ts +9 -0
- package/platforms/react-native/generators/init/navigators/react-navigation/navigation.hooks.ts +5 -0
- package/platforms/react-native/generators/init/navigators/react-navigation/navigation.tabs.ts +7 -0
- package/platforms/react-native/generators/init/navigators/react-navigation/navigation.widgets.ts +5 -0
- package/platforms/react-native/generators/setup/generator.js +225 -0
- package/platforms/react-native/generators/util/generator.js +12 -0
- package/platforms/react-native/platform.js +32 -0
- package/platforms/react-native/runtime.js +57 -0
- package/platforms/react-native/solutions/components/BottomSheet/README.md +29 -0
- package/platforms/react-native/solutions/components/BottomSheet/files/Common.tsx +120 -0
- package/platforms/react-native/solutions/components/BottomSheet/files/Content.tsx +57 -0
- package/platforms/react-native/solutions/components/BottomSheet/files/Context.tsx +22 -0
- package/platforms/react-native/solutions/components/BottomSheet/files/FlatList.tsx +50 -0
- package/platforms/react-native/solutions/components/BottomSheet/files/Header.tsx +57 -0
- package/platforms/react-native/solutions/components/BottomSheet/files/Search.tsx +24 -0
- package/platforms/react-native/solutions/components/BottomSheet/files/bottomSheet.constants.ts +13 -0
- package/platforms/react-native/solutions/components/BottomSheet/files/bottomSheet.types.ts +31 -0
- package/platforms/react-native/solutions/components/BottomSheet/files/index.ts +33 -0
- package/platforms/react-native/solutions/components/BottomSheet/solution.js +38 -0
- package/platforms/react-native/solutions/components/BottomSheetWidgets/README.md +29 -0
- package/platforms/react-native/solutions/components/BottomSheetWidgets/files/SelectPicker.tsx +47 -0
- package/platforms/react-native/solutions/components/BottomSheetWidgets/files/bottomSheet/Content.BottomSheet.tsx +22 -0
- package/platforms/react-native/solutions/components/BottomSheetWidgets/files/bottomSheet/DateTimePicker.BottomSheet.tsx +74 -0
- package/platforms/react-native/solutions/components/BottomSheetWidgets/files/bottomSheet/List.BottomSheet.tsx +62 -0
- package/platforms/react-native/solutions/components/BottomSheetWidgets/solution.js +49 -0
- package/platforms/react-native/solutions/components/Calendar/README.md +29 -0
- package/platforms/react-native/solutions/components/Calendar/files/Common.tsx +16 -0
- package/platforms/react-native/solutions/components/Calendar/files/Context.tsx +466 -0
- package/platforms/react-native/solutions/components/Calendar/files/DayCell.tsx +89 -0
- package/platforms/react-native/solutions/components/Calendar/files/MonthView.tsx +41 -0
- package/platforms/react-native/solutions/components/Calendar/files/MonthYearOverlay.tsx +51 -0
- package/platforms/react-native/solutions/components/Calendar/files/SwipeablePeriod.tsx +44 -0
- package/platforms/react-native/solutions/components/Calendar/files/WeekDayTitles.tsx +31 -0
- package/platforms/react-native/solutions/components/Calendar/files/WeekView.tsx +40 -0
- package/platforms/react-native/solutions/components/Calendar/files/calendar.styles.ts +142 -0
- package/platforms/react-native/solutions/components/Calendar/files/calendar.types.ts +126 -0
- package/platforms/react-native/solutions/components/Calendar/files/calendar.utils.ts +143 -0
- package/platforms/react-native/solutions/components/Calendar/files/index.ts +40 -0
- package/platforms/react-native/solutions/components/Calendar/solution.js +38 -0
- package/platforms/react-native/solutions/components/Chart/README.md +29 -0
- package/platforms/react-native/solutions/components/Chart/files/Cilcular.tsx +140 -0
- package/platforms/react-native/solutions/components/Chart/files/index.ts +3 -0
- package/platforms/react-native/solutions/components/Chart/solution.js +38 -0
- package/platforms/react-native/solutions/components/CheckBox/README.md +29 -0
- package/platforms/react-native/solutions/components/CheckBox/files/Common.tsx +55 -0
- package/platforms/react-native/solutions/components/CheckBox/files/checkbox.pm.ts +71 -0
- package/platforms/react-native/solutions/components/CheckBox/files/index.ts +9 -0
- package/platforms/react-native/solutions/components/CheckBox/form/Checkbox.tsx +22 -0
- package/platforms/react-native/solutions/components/CheckBox/solution.js +57 -0
- package/platforms/react-native/solutions/components/DateTimePicker/README.md +29 -0
- package/platforms/react-native/solutions/components/DateTimePicker/files/DateTimePicker.tsx +44 -0
- package/platforms/react-native/solutions/components/DateTimePicker/solution.js +45 -0
- package/platforms/react-native/solutions/components/Image/README.md +29 -0
- package/platforms/react-native/solutions/components/Image/files/SVG.tsx +74 -0
- package/platforms/react-native/solutions/components/Image/files/image.pm.ts +25 -0
- package/platforms/react-native/solutions/components/Image/files/image.utils.ts +35 -0
- package/platforms/react-native/solutions/components/Image/files/index.ts +5 -0
- package/platforms/react-native/solutions/components/Image/solution.js +40 -0
- package/platforms/react-native/solutions/components/InputSecurity/README.md +29 -0
- package/platforms/react-native/solutions/components/InputSecurity/files/InputSecurity.ts +142 -0
- package/platforms/react-native/solutions/components/InputSecurity/solution.js +28 -0
- package/platforms/react-native/solutions/components/OTP/README.md +29 -0
- package/platforms/react-native/solutions/components/OTP/files/Item.tsx +16 -0
- package/platforms/react-native/solutions/components/OTP/files/Items.tsx +33 -0
- package/platforms/react-native/solutions/components/OTP/files/index.tsx +120 -0
- package/platforms/react-native/solutions/components/OTP/files/otp.pm.ts +30 -0
- package/platforms/react-native/solutions/components/OTP/solution.js +38 -0
- package/platforms/react-native/solutions/components/ProgressIndicator/README.md +29 -0
- package/platforms/react-native/solutions/components/ProgressIndicator/files/Circular.tsx +154 -0
- package/platforms/react-native/solutions/components/ProgressIndicator/files/Linear.tsx +133 -0
- package/platforms/react-native/solutions/components/ProgressIndicator/files/circular.pm.ts +34 -0
- package/platforms/react-native/solutions/components/ProgressIndicator/files/index.ts +16 -0
- package/platforms/react-native/solutions/components/ProgressIndicator/solution.js +39 -0
- package/platforms/react-native/solutions/components/Ruler/README.md +29 -0
- package/platforms/react-native/solutions/components/Ruler/files/Common.tsx +44 -0
- package/platforms/react-native/solutions/components/Ruler/files/Context.tsx +210 -0
- package/platforms/react-native/solutions/components/Ruler/files/Track.tsx +686 -0
- package/platforms/react-native/solutions/components/Ruler/files/Value.tsx +60 -0
- package/platforms/react-native/solutions/components/Ruler/files/index.ts +23 -0
- package/platforms/react-native/solutions/components/Ruler/files/ruler.constants.ts +70 -0
- package/platforms/react-native/solutions/components/Ruler/files/ruler.types.ts +98 -0
- package/platforms/react-native/solutions/components/Ruler/files/ruler.utils.ts +332 -0
- package/platforms/react-native/solutions/components/Ruler/solution.js +38 -0
- package/platforms/react-native/solutions/components/Section/README.md +29 -0
- package/platforms/react-native/solutions/components/Section/files/Common.tsx +144 -0
- package/platforms/react-native/solutions/components/Section/solution.js +37 -0
- package/platforms/react-native/solutions/components/Slider/README.md +29 -0
- package/platforms/react-native/solutions/components/Slider/files/Container.tsx +5 -0
- package/platforms/react-native/solutions/components/Slider/files/Content.tsx +44 -0
- package/platforms/react-native/solutions/components/Slider/files/Context.tsx +30 -0
- package/platforms/react-native/solutions/components/Slider/files/Pagination.Dot.tsx +61 -0
- package/platforms/react-native/solutions/components/Slider/files/index.ts +22 -0
- package/platforms/react-native/solutions/components/Slider/solution.js +38 -0
- package/platforms/react-native/solutions/components/Switch/README.md +29 -0
- package/platforms/react-native/solutions/components/Switch/files/Common.tsx +38 -0
- package/platforms/react-native/solutions/components/Switch/files/index.ts +9 -0
- package/platforms/react-native/solutions/components/Switch/files/switch.pm.ts +53 -0
- package/platforms/react-native/solutions/components/Switch/solution.js +38 -0
- package/platforms/react-native/solutions/install.js +97 -0
- package/platforms/react-native/solutions/services/firebase-core/README.md +31 -0
- package/platforms/react-native/solutions/services/firebase-core/files/index.ts +5 -0
- package/platforms/react-native/solutions/services/firebase-core/solution.js +39 -0
- package/platforms/react-native/solutions/services/firebase-messaging/README.md +31 -0
- package/platforms/react-native/solutions/services/firebase-messaging/files/index.ts +20 -0
- package/platforms/react-native/solutions/services/firebase-messaging/solution.js +42 -0
- package/platforms/react-native/solutions/utils/permissions/README.md +29 -0
- package/platforms/react-native/solutions/utils/permissions/files/permissions.ts +10 -0
- package/platforms/react-native/solutions/utils/permissions/solution.js +32 -0
- package/presets/react-native-fsd/index.js +25 -0
- package/shared/generators/entity/render.js +88 -0
- package/shared/generators/entity/templates/crud/api.ts.hbs +36 -0
- package/shared/generators/entity/templates/crud/dto.ts.hbs +36 -0
- package/shared/generators/entity/templates/crud/service.ts.hbs +73 -0
- package/shared/generators/entity/templates/crud/store.ts.hbs +27 -0
- package/shared/generators/entity/templates/index.ts.hbs +2 -0
- package/shared/generators/entity/templates/simple/api.ts.hbs +16 -0
- package/shared/generators/entity/templates/simple/dto.ts.hbs +5 -0
- package/shared/generators/entity/templates/simple/service.ts.hbs +26 -0
- package/shared/generators/entity/templates/simple/store.ts.hbs +18 -0
- package/shared/solutions/utils/date/README.md +29 -0
- package/shared/solutions/utils/date/files/date.ts +11 -0
- package/shared/solutions/utils/date/solution.js +27 -0
- package/shared/solutions/utils/string/README.md +29 -0
- package/shared/solutions/utils/string/files/string.ts +100 -0
- package/shared/solutions/utils/string/solution.js +27 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# BottomSheet
|
|
2
|
+
|
|
3
|
+
Gesture-driven sheet with header and content slots.
|
|
4
|
+
|
|
5
|
+
## API
|
|
6
|
+
|
|
7
|
+
BottomSheet, BottomSheet.Header, BottomSheet.Content. Props include onClose and maxHeight.
|
|
8
|
+
|
|
9
|
+
## Example
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
<BottomSheet onClose={close}><BottomSheet.Header title="Filter" /></BottomSheet>
|
|
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:BottomSheet`.
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
2
|
+
import { Keyboard, Platform, Pressable, StyleSheet, useWindowDimensions, View } from 'react-native';
|
|
3
|
+
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
4
|
+
import { KeyboardProvider, useAnimatedKeyboard } from 'react-native-keyboard-controller';
|
|
5
|
+
import Animated, { runOnJS, useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';
|
|
6
|
+
|
|
7
|
+
import { Theme } from '@theme';
|
|
8
|
+
|
|
9
|
+
import { resolveMaxHeight, SHEET_BOTTOM_PADDING, SHEET_HORIZONTAL_PADDING } from './bottomSheet.constants';
|
|
10
|
+
import { IBottomSheetProps } from './bottomSheet.types';
|
|
11
|
+
import { BottomSheetContextProvider } from './Context';
|
|
12
|
+
|
|
13
|
+
export default function BottomSheetCommon(props: IBottomSheetProps) {
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
Keyboard.dismiss();
|
|
16
|
+
}, []);
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<GestureHandlerRootView>
|
|
20
|
+
<KeyboardProvider>
|
|
21
|
+
<Theme>
|
|
22
|
+
<Sheet {...props} />
|
|
23
|
+
</Theme>
|
|
24
|
+
</KeyboardProvider>
|
|
25
|
+
</GestureHandlerRootView>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function Sheet({
|
|
30
|
+
children,
|
|
31
|
+
minHeight = 120,
|
|
32
|
+
maxHeight = '90%',
|
|
33
|
+
closable = true,
|
|
34
|
+
backdrop = true,
|
|
35
|
+
backgroundColor = '#fff',
|
|
36
|
+
onClose,
|
|
37
|
+
}: IBottomSheetProps) {
|
|
38
|
+
const { height: windowHeight } = useWindowDimensions();
|
|
39
|
+
const animatedKeyboard = useAnimatedKeyboard();
|
|
40
|
+
const isIOS = Platform.OS === 'ios';
|
|
41
|
+
const backdropOpacity = useSharedValue(0);
|
|
42
|
+
const sheetOpacity = useSharedValue(0);
|
|
43
|
+
const sheetTranslateY = useSharedValue(24);
|
|
44
|
+
|
|
45
|
+
const resolvedMaxHeight = useMemo(() => resolveMaxHeight(maxHeight, windowHeight), [maxHeight, windowHeight]);
|
|
46
|
+
|
|
47
|
+
const onCloseRef = useRef(onClose);
|
|
48
|
+
onCloseRef.current = onClose;
|
|
49
|
+
|
|
50
|
+
const notifyClose = useCallback(() => onCloseRef.current?.(), []);
|
|
51
|
+
|
|
52
|
+
const close = useCallback(() => {
|
|
53
|
+
backdropOpacity.value = withTiming(0, { duration: 250 });
|
|
54
|
+
sheetOpacity.value = withTiming(0, { duration: 250 });
|
|
55
|
+
sheetTranslateY.value = withTiming(24, { duration: 250 }, finished => {
|
|
56
|
+
if (finished) {
|
|
57
|
+
runOnJS(notifyClose)();
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}, [backdropOpacity, notifyClose, sheetOpacity, sheetTranslateY]);
|
|
61
|
+
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
backdropOpacity.value = withTiming(1, { duration: 250 });
|
|
64
|
+
sheetOpacity.value = withTiming(1, { duration: 250 });
|
|
65
|
+
sheetTranslateY.value = withTiming(0, { duration: 250 });
|
|
66
|
+
}, [backdropOpacity, sheetOpacity, sheetTranslateY]);
|
|
67
|
+
|
|
68
|
+
const contextValue = useMemo(() => ({ close, resolvedMaxHeight }), [close, resolvedMaxHeight]);
|
|
69
|
+
|
|
70
|
+
const backdropStyle = useAnimatedStyle(() => ({
|
|
71
|
+
opacity: backdropOpacity.value,
|
|
72
|
+
}));
|
|
73
|
+
|
|
74
|
+
const sheetStyle = useAnimatedStyle(() => ({
|
|
75
|
+
opacity: sheetOpacity.value,
|
|
76
|
+
transform: [{ translateY: sheetTranslateY.value }],
|
|
77
|
+
// Android uses adjustResize (manifest + keyboard-controller), so the overlay root
|
|
78
|
+
// already shrinks above the keyboard. Adding keyboard height here double-offsets.
|
|
79
|
+
bottom: SHEET_BOTTOM_PADDING + (isIOS ? animatedKeyboard.height.value : 0),
|
|
80
|
+
}));
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<View style={StyleSheet.absoluteFill} pointerEvents="box-none">
|
|
84
|
+
{backdrop ? (
|
|
85
|
+
<Animated.View pointerEvents="none" style={[StyleSheet.absoluteFill, styles.backdrop, backdropStyle]} />
|
|
86
|
+
) : null}
|
|
87
|
+
{closable ? <Pressable style={StyleSheet.absoluteFill} onPress={close} /> : null}
|
|
88
|
+
<Animated.View
|
|
89
|
+
style={[
|
|
90
|
+
styles.sheet,
|
|
91
|
+
sheetStyle,
|
|
92
|
+
{
|
|
93
|
+
minHeight,
|
|
94
|
+
maxHeight: resolvedMaxHeight,
|
|
95
|
+
},
|
|
96
|
+
]}>
|
|
97
|
+
<View style={[styles.card, { backgroundColor }]} collapsable={false}>
|
|
98
|
+
<BottomSheetContextProvider value={contextValue} children={children} />
|
|
99
|
+
</View>
|
|
100
|
+
</Animated.View>
|
|
101
|
+
</View>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const styles = StyleSheet.create({
|
|
106
|
+
backdrop: {
|
|
107
|
+
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
|
108
|
+
},
|
|
109
|
+
sheet: {
|
|
110
|
+
position: 'absolute',
|
|
111
|
+
left: SHEET_HORIZONTAL_PADDING,
|
|
112
|
+
right: SHEET_HORIZONTAL_PADDING,
|
|
113
|
+
},
|
|
114
|
+
card: {
|
|
115
|
+
flexDirection: 'column',
|
|
116
|
+
backgroundColor: 'white',
|
|
117
|
+
borderRadius: 36,
|
|
118
|
+
overflow: 'hidden',
|
|
119
|
+
},
|
|
120
|
+
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React, { useCallback, useMemo, useState } from 'react';
|
|
2
|
+
import { type LayoutChangeEvent } from 'react-native';
|
|
3
|
+
import Animated from 'react-native-reanimated';
|
|
4
|
+
|
|
5
|
+
import { Grid } from '@components';
|
|
6
|
+
import { usePrivateContext } from '@components/BottomSheet/Context.tsx';
|
|
7
|
+
import { GridPM } from '@components/Grid/grid.pm.ts';
|
|
8
|
+
import { TGridProps } from '@components/Grid/grid.types.ts';
|
|
9
|
+
|
|
10
|
+
/** Scrollable sheet body; auto-enables scroll when content exceeds the available height. */
|
|
11
|
+
export default function Content({ children, ...gridProps }: TGridProps & { children?: React.ReactNode }) {
|
|
12
|
+
const props = GridPM.get({ 'ph-m': true, ...gridProps });
|
|
13
|
+
|
|
14
|
+
const { resolvedMaxHeight } = usePrivateContext();
|
|
15
|
+
const [offsetY, setOffsetY] = useState<number | null>(null);
|
|
16
|
+
const [contentHeight, setContentHeight] = useState(0);
|
|
17
|
+
|
|
18
|
+
const availableHeight = useMemo(
|
|
19
|
+
() => (offsetY === null ? 0 : Math.max(0, resolvedMaxHeight - offsetY)),
|
|
20
|
+
[offsetY, resolvedMaxHeight],
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
const needsScroll = useMemo(
|
|
24
|
+
() => offsetY !== null && availableHeight > 0 && contentHeight > availableHeight,
|
|
25
|
+
[offsetY, availableHeight, contentHeight],
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
const onLayout = useCallback(
|
|
29
|
+
({
|
|
30
|
+
nativeEvent: {
|
|
31
|
+
layout: { y },
|
|
32
|
+
},
|
|
33
|
+
}: LayoutChangeEvent) => {
|
|
34
|
+
setOffsetY(y);
|
|
35
|
+
},
|
|
36
|
+
[],
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<Grid
|
|
41
|
+
collapsable={false}
|
|
42
|
+
min-height={needsScroll ? 0 : undefined}
|
|
43
|
+
height={needsScroll ? availableHeight : undefined}
|
|
44
|
+
onLayout={onLayout}>
|
|
45
|
+
<Animated.ScrollView
|
|
46
|
+
style={needsScroll ? { flex: 1, minHeight: 0 } : undefined}
|
|
47
|
+
scrollEnabled={needsScroll}
|
|
48
|
+
showsVerticalScrollIndicator={false}
|
|
49
|
+
showsHorizontalScrollIndicator={false}
|
|
50
|
+
keyboardShouldPersistTaps="handled"
|
|
51
|
+
contentContainerStyle={props.container?.style}
|
|
52
|
+
onContentSizeChange={(_, height) => setContentHeight(height)}>
|
|
53
|
+
{children}
|
|
54
|
+
</Animated.ScrollView>
|
|
55
|
+
</Grid>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React, { createContext, ReactNode, useContext } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface IBottomSheetContext {
|
|
4
|
+
close: () => void;
|
|
5
|
+
/** Resolved sheet max height in pixels (used to cap scrollable list area). */
|
|
6
|
+
resolvedMaxHeight: number;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const BottomSheetContext = createContext<IBottomSheetContext>(null as unknown as IBottomSheetContext);
|
|
10
|
+
|
|
11
|
+
export function BottomSheetContextProvider({ value, children }: { value: IBottomSheetContext; children: ReactNode }) {
|
|
12
|
+
return <BottomSheetContext.Provider value={value} children={children} />;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function usePrivateContext() {
|
|
16
|
+
return useContext(BottomSheetContext);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Public imperative API, available to any component rendered inside `<BottomSheet>`. */
|
|
20
|
+
export function useBottomSheet() {
|
|
21
|
+
return usePrivateContext();
|
|
22
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React, { useCallback, useMemo, useState } from 'react';
|
|
2
|
+
import { FlatList, FlatListProps, type LayoutChangeEvent } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { Grid } from '@components';
|
|
5
|
+
|
|
6
|
+
import { usePrivateContext } from './Context.tsx';
|
|
7
|
+
|
|
8
|
+
/** FlatList for sheet list content. */
|
|
9
|
+
export default function BottomSheetFlatList<TItem>(props: FlatListProps<TItem>) {
|
|
10
|
+
const { resolvedMaxHeight } = usePrivateContext();
|
|
11
|
+
const [offsetY, setOffsetY] = useState<number | null>(null);
|
|
12
|
+
const [contentHeight, setContentHeight] = useState(0);
|
|
13
|
+
|
|
14
|
+
const availableHeight = useMemo(
|
|
15
|
+
() => (offsetY === null ? 0 : Math.max(0, resolvedMaxHeight - offsetY)),
|
|
16
|
+
[offsetY, resolvedMaxHeight],
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
const needsScroll = useMemo(
|
|
20
|
+
() => offsetY !== null && availableHeight > 0 && contentHeight > availableHeight,
|
|
21
|
+
[offsetY, availableHeight, contentHeight],
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
const onLayout = useCallback(
|
|
25
|
+
({
|
|
26
|
+
nativeEvent: {
|
|
27
|
+
layout: { y },
|
|
28
|
+
},
|
|
29
|
+
}: LayoutChangeEvent) => {
|
|
30
|
+
setOffsetY(y);
|
|
31
|
+
},
|
|
32
|
+
[],
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<Grid
|
|
37
|
+
collapsable={false}
|
|
38
|
+
min-height={needsScroll ? 0 : undefined}
|
|
39
|
+
height={needsScroll ? availableHeight : undefined}
|
|
40
|
+
onLayout={onLayout}>
|
|
41
|
+
<FlatList
|
|
42
|
+
onContentSizeChange={(_, height) => setContentHeight(height)}
|
|
43
|
+
scrollEnabled={needsScroll}
|
|
44
|
+
keyboardShouldPersistTaps="handled"
|
|
45
|
+
style={needsScroll ? { flex: 1, minHeight: 0 } : undefined}
|
|
46
|
+
{...props}
|
|
47
|
+
/>
|
|
48
|
+
</Grid>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { Button, Grid, Text } from '@components';
|
|
4
|
+
|
|
5
|
+
import { IBottomSheetAction, IBottomSheetHeaderProps, TBottomSheetActionToken } from './bottomSheet.types.ts';
|
|
6
|
+
import { usePrivateContext } from './Context.tsx';
|
|
7
|
+
|
|
8
|
+
function Action({ action }: { action: TBottomSheetActionToken }) {
|
|
9
|
+
const { close } = usePrivateContext();
|
|
10
|
+
const resolved: IBottomSheetAction = action === 'close' ? { icon: 'close', onPress: close } : action;
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<Button
|
|
14
|
+
type={action === 'close' ? 'filled' : 'text'}
|
|
15
|
+
color={'primary'}
|
|
16
|
+
size={36}
|
|
17
|
+
round="l"
|
|
18
|
+
leadingIcon={resolved.icon}
|
|
19
|
+
onPress={resolved.onPress}
|
|
20
|
+
accessibilityRole="button"
|
|
21
|
+
/>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Header row: title on the left, action icons on the sides. `'close'` triggers the sheet close. */
|
|
26
|
+
export default function Header({ title, description, leadingActions, trailingActions }: IBottomSheetHeaderProps) {
|
|
27
|
+
return (
|
|
28
|
+
<Grid>
|
|
29
|
+
<Grid row align-center space-between ph-m pv-s>
|
|
30
|
+
<Grid row align-center gap-s>
|
|
31
|
+
{leadingActions?.map((action, index) => (
|
|
32
|
+
<Action action={action} key={typeof action === 'string' ? action : `leading-${index}`} />
|
|
33
|
+
))}
|
|
34
|
+
</Grid>
|
|
35
|
+
{title ? (
|
|
36
|
+
<Grid absolute center>
|
|
37
|
+
<Text title-l color="primary" center>
|
|
38
|
+
{title}
|
|
39
|
+
</Text>
|
|
40
|
+
</Grid>
|
|
41
|
+
) : null}
|
|
42
|
+
<Grid row align-center gap-s>
|
|
43
|
+
{trailingActions?.map((action, index) => (
|
|
44
|
+
<Action action={action} key={typeof action === 'string' ? action : `trailing-${index}`} />
|
|
45
|
+
))}
|
|
46
|
+
</Grid>
|
|
47
|
+
</Grid>
|
|
48
|
+
<Grid center gap-s>
|
|
49
|
+
{description ? (
|
|
50
|
+
<Text mh-m mb-s title-s color="secondary" center>
|
|
51
|
+
{description}
|
|
52
|
+
</Text>
|
|
53
|
+
) : null}
|
|
54
|
+
</Grid>
|
|
55
|
+
</Grid>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { Keyboard, TextInput } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { Box, Grid } from '@components';
|
|
5
|
+
|
|
6
|
+
import { IBottomSheetSearchProps } from './bottomSheet.types';
|
|
7
|
+
|
|
8
|
+
/** Search input; keyboard avoidance is handled by the sheet root. */
|
|
9
|
+
export default function Search({ placeholder = 'Search', onSearch }: IBottomSheetSearchProps) {
|
|
10
|
+
useEffect(
|
|
11
|
+
() => () => {
|
|
12
|
+
Keyboard.dismiss();
|
|
13
|
+
},
|
|
14
|
+
[],
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<Grid ph-m pb-s>
|
|
19
|
+
<Box borderColor="primary" borderWidth={1} round="xs" justify-center ph-s min-height={48}>
|
|
20
|
+
<TextInput placeholder={placeholder} onChangeText={onSearch} returnKeyType="search" />
|
|
21
|
+
</Box>
|
|
22
|
+
</Grid>
|
|
23
|
+
);
|
|
24
|
+
}
|
package/platforms/react-native/solutions/components/BottomSheet/files/bottomSheet.constants.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Horizontal inset of the floating sheet card. */
|
|
2
|
+
export const SHEET_HORIZONTAL_PADDING = 16;
|
|
3
|
+
/** Gap between the sheet card and the bottom of the screen. */
|
|
4
|
+
export const SHEET_BOTTOM_PADDING = 16;
|
|
5
|
+
|
|
6
|
+
/** Resolves the `maxHeight` cap (px or percentage of the window height) into pixels. */
|
|
7
|
+
export function resolveMaxHeight(maxHeight: number | `${number}%`, windowHeight: number): number {
|
|
8
|
+
if (typeof maxHeight === 'number') {
|
|
9
|
+
return maxHeight;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return (windowHeight * parseFloat(maxHeight)) / 100;
|
|
13
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface IBottomSheetProps {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
minHeight?: number;
|
|
6
|
+
maxHeight?: number | `${number}%`;
|
|
7
|
+
backdrop?: boolean;
|
|
8
|
+
closable?: boolean;
|
|
9
|
+
onClose?: () => void;
|
|
10
|
+
backgroundColor?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface IBottomSheetAction {
|
|
14
|
+
icon: string;
|
|
15
|
+
onPress?: () => void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** `'close'` resolves to a close icon wired to the sheet `close()`. */
|
|
19
|
+
export type TBottomSheetActionToken = 'close' | IBottomSheetAction;
|
|
20
|
+
|
|
21
|
+
export interface IBottomSheetHeaderProps {
|
|
22
|
+
title?: string;
|
|
23
|
+
description?: string;
|
|
24
|
+
leadingActions?: TBottomSheetActionToken[];
|
|
25
|
+
trailingActions?: TBottomSheetActionToken[];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface IBottomSheetSearchProps {
|
|
29
|
+
placeholder?: string;
|
|
30
|
+
onSearch?: (query: string) => void;
|
|
31
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import Common from './Common.tsx';
|
|
2
|
+
import Content from './Content.tsx';
|
|
3
|
+
import { useBottomSheet } from './Context.tsx';
|
|
4
|
+
import FlatList from './FlatList.tsx';
|
|
5
|
+
import Header from './Header.tsx';
|
|
6
|
+
import Search from './Search.tsx';
|
|
7
|
+
|
|
8
|
+
type TCommon = typeof Common;
|
|
9
|
+
|
|
10
|
+
interface IBottomSheet extends TCommon {
|
|
11
|
+
Header: typeof Header;
|
|
12
|
+
Content: typeof Content;
|
|
13
|
+
FlatList: typeof FlatList;
|
|
14
|
+
Search: typeof Search;
|
|
15
|
+
useBottomSheet: typeof useBottomSheet;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const BottomSheet = Common as IBottomSheet;
|
|
19
|
+
BottomSheet.Header = Header;
|
|
20
|
+
BottomSheet.Content = Content;
|
|
21
|
+
BottomSheet.FlatList = FlatList;
|
|
22
|
+
BottomSheet.Search = Search;
|
|
23
|
+
BottomSheet.useBottomSheet = useBottomSheet;
|
|
24
|
+
|
|
25
|
+
export type {
|
|
26
|
+
IBottomSheetProps,
|
|
27
|
+
IBottomSheetHeaderProps,
|
|
28
|
+
IBottomSheetSearchProps,
|
|
29
|
+
IBottomSheetAction,
|
|
30
|
+
TBottomSheetActionToken,
|
|
31
|
+
} from './bottomSheet.types.ts';
|
|
32
|
+
|
|
33
|
+
export default BottomSheet;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"id": "component:BottomSheet",
|
|
3
|
+
"type": "component",
|
|
4
|
+
"platforms": [
|
|
5
|
+
"react-native"
|
|
6
|
+
],
|
|
7
|
+
"title": "BottomSheet",
|
|
8
|
+
"description": "Gesture-driven sheet with header and content slots.",
|
|
9
|
+
"status": "stable",
|
|
10
|
+
"since": "1.0.0",
|
|
11
|
+
"tags": [
|
|
12
|
+
"ui",
|
|
13
|
+
"overlay"
|
|
14
|
+
],
|
|
15
|
+
"requires": [],
|
|
16
|
+
"dependencies": [],
|
|
17
|
+
"files": [
|
|
18
|
+
{
|
|
19
|
+
"from": "files",
|
|
20
|
+
"to": "ui/components/BottomSheet"
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
"register": [
|
|
24
|
+
{
|
|
25
|
+
"file": "ui/components/index.ts",
|
|
26
|
+
"marker": "components-import",
|
|
27
|
+
"code": "import BottomSheet from './BottomSheet';\n"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"file": "ui/components/index.ts",
|
|
31
|
+
"marker": "components-export",
|
|
32
|
+
"code": " BottomSheet,\n"
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
"manual": [],
|
|
36
|
+
"api": "BottomSheet, BottomSheet.Header, BottomSheet.Content. Props include onClose and maxHeight.",
|
|
37
|
+
"example": "<BottomSheet onClose={close}><BottomSheet.Header title=\"Filter\" /></BottomSheet>"
|
|
38
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Bottom sheet widgets
|
|
2
|
+
|
|
3
|
+
List and date-time sheets, plus Form.Element.SelectPicker.
|
|
4
|
+
|
|
5
|
+
## API
|
|
6
|
+
|
|
7
|
+
List bottom sheet and SelectPicker. DateTimePicker widget is used by component:DateTimePicker.
|
|
8
|
+
|
|
9
|
+
## Example
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
<Form.Element.SelectPicker data={items} />
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Dependencies
|
|
16
|
+
|
|
17
|
+
None beyond the setup baseline.
|
|
18
|
+
|
|
19
|
+
Requires: `component:BottomSheet`.
|
|
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:BottomSheetWidgets`.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { TFormSelectProps } from '@components/Form/form.types';
|
|
2
|
+
import FormSelect from '@components/Form/Select';
|
|
3
|
+
import { useNavigation } from '@navigation/navigation.hooks';
|
|
4
|
+
import { IListBottomSheetProps, useListContext } from '@widgets/bottomSheet/List.BottomSheet';
|
|
5
|
+
|
|
6
|
+
type TFormSelectPossibleProps<T> = Omit<TFormSelectProps<T>, 'onSelect' | 'value'>;
|
|
7
|
+
type TListBottomSheetPossibleProps = Omit<IListBottomSheetProps, 'data' | 'renderItem'>;
|
|
8
|
+
|
|
9
|
+
interface ISelectPickerProps<T> extends TFormSelectPossibleProps<T>, TListBottomSheetPossibleProps {
|
|
10
|
+
value?: any;
|
|
11
|
+
onSearch?: (query: string, item: any) => boolean;
|
|
12
|
+
getData?: () => T[] | Promise<T[]>;
|
|
13
|
+
renderItem: (props: {
|
|
14
|
+
item: T;
|
|
15
|
+
value: any;
|
|
16
|
+
onSelectChange: (value: any, title: string) => void;
|
|
17
|
+
}) => React.ReactElement;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const useSelectPickerContext = useListContext;
|
|
21
|
+
|
|
22
|
+
export default function SelectPicker<T>({
|
|
23
|
+
getData,
|
|
24
|
+
title,
|
|
25
|
+
renderItem,
|
|
26
|
+
value,
|
|
27
|
+
onSearch,
|
|
28
|
+
...props
|
|
29
|
+
}: ISelectPickerProps<T>) {
|
|
30
|
+
const navigation = useNavigation();
|
|
31
|
+
|
|
32
|
+
// const getTitleForValue = (value?: Date) => dayjs(value).format(format || 'DD MMM YYYY HH:mm');
|
|
33
|
+
|
|
34
|
+
const onSelect: TFormSelectProps<T>['onSelect'] = async (value, onSelectChange) => {
|
|
35
|
+
const data = (await getData?.()) || [];
|
|
36
|
+
|
|
37
|
+
navigation.widgets.showList({
|
|
38
|
+
value,
|
|
39
|
+
data,
|
|
40
|
+
title,
|
|
41
|
+
onSearch,
|
|
42
|
+
renderItem: ({ item }) => renderItem({ item, value, onSelectChange }),
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
return <FormSelect {...props} value={value} onSelect={onSelect} />;
|
|
47
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { useNavigation } from '@effijs/navigation-react-native';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
import BottomSheet from '@components/BottomSheet';
|
|
5
|
+
|
|
6
|
+
export interface IContentBottomSheetProps {
|
|
7
|
+
renderContent: (props: { closeBottomSheet?: (componentId?: string) => Promise<void> }) => React.ReactNode;
|
|
8
|
+
title?: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
backgroundColor?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default function ContentBottomSheet({ renderContent, title, description }: IContentBottomSheetProps) {
|
|
14
|
+
const { close } = useNavigation();
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<BottomSheet onClose={close} maxHeight={500}>
|
|
18
|
+
<BottomSheet.Header title={title} description={description} trailingActions={['close']} />
|
|
19
|
+
<BottomSheet.Content ph-m={false}>{renderContent({ closeBottomSheet: close })}</BottomSheet.Content>
|
|
20
|
+
</BottomSheet>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { useNavigation } from '@effijs/navigation-react-native';
|
|
2
|
+
import DatePicker, { DatePickerProps } from 'react-native-date-picker';
|
|
3
|
+
|
|
4
|
+
import { Button, Grid, Text } from '@components';
|
|
5
|
+
import BottomSheet from '@components/BottomSheet';
|
|
6
|
+
import { theme, useTheme } from '@theme';
|
|
7
|
+
|
|
8
|
+
export type TDateTimePickerBottomSheetProps = Pick<DatePickerProps, 'maximumDate' | 'minimumDate' | 'mode'>;
|
|
9
|
+
|
|
10
|
+
export interface IDateTimePickerBottomSheetProps extends TDateTimePickerBottomSheetProps {
|
|
11
|
+
onChange?: (date?: Date) => void;
|
|
12
|
+
onClose?: () => void;
|
|
13
|
+
value?: Date;
|
|
14
|
+
title?: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
canClear?: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default function DateTimePickerBottomSheet({
|
|
20
|
+
value,
|
|
21
|
+
title,
|
|
22
|
+
description,
|
|
23
|
+
onChange,
|
|
24
|
+
onClose,
|
|
25
|
+
canClear,
|
|
26
|
+
...datePickerProps
|
|
27
|
+
}: IDateTimePickerBottomSheetProps) {
|
|
28
|
+
const { close } = useNavigation();
|
|
29
|
+
useTheme();
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<BottomSheet
|
|
33
|
+
onClose={() => {
|
|
34
|
+
close?.();
|
|
35
|
+
onClose?.();
|
|
36
|
+
}}>
|
|
37
|
+
<BottomSheet.Header title={title} trailingActions={['close']} />
|
|
38
|
+
<BottomSheet.Content>
|
|
39
|
+
{title || description ? (
|
|
40
|
+
<Grid gap-xs mv-s>
|
|
41
|
+
{title ? (
|
|
42
|
+
<Text title-l color="primary" center>
|
|
43
|
+
{title}
|
|
44
|
+
</Text>
|
|
45
|
+
) : null}
|
|
46
|
+
{description ? <Text center>{description}</Text> : null}
|
|
47
|
+
</Grid>
|
|
48
|
+
) : null}
|
|
49
|
+
|
|
50
|
+
<DatePicker
|
|
51
|
+
date={value || new Date()}
|
|
52
|
+
onDateChange={onChange}
|
|
53
|
+
{...datePickerProps}
|
|
54
|
+
dividerColor={theme.color.primary}
|
|
55
|
+
style={{ alignSelf: 'center' }}
|
|
56
|
+
/>
|
|
57
|
+
{canClear ? (
|
|
58
|
+
<Button
|
|
59
|
+
mt-s
|
|
60
|
+
mb-l
|
|
61
|
+
type="text"
|
|
62
|
+
color="error"
|
|
63
|
+
onPress={() => {
|
|
64
|
+
onChange?.(undefined);
|
|
65
|
+
close?.();
|
|
66
|
+
onClose?.();
|
|
67
|
+
}}>
|
|
68
|
+
Clear
|
|
69
|
+
</Button>
|
|
70
|
+
) : null}
|
|
71
|
+
</BottomSheet.Content>
|
|
72
|
+
</BottomSheet>
|
|
73
|
+
);
|
|
74
|
+
}
|