create-du-app 0.1.3 → 0.1.5
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/README.md +15 -9
- package/package.json +6 -5
- package/src/generate.js +15 -2
- package/src/index.js +15 -9
- package/src/prompts.js +1 -1
- package/templates/mobile/expo/.env.example +5 -0
- package/templates/mobile/expo/.eslintrc.js +7 -0
- package/templates/mobile/expo/.prettierrc.js +7 -0
- package/templates/mobile/expo/.svgrrc.js +9 -0
- package/templates/mobile/expo/README.md +70 -7
- package/templates/mobile/expo/_gitignore +20 -0
- package/templates/mobile/expo/_package.json +60 -1
- package/templates/mobile/expo/app.json +26 -0
- package/templates/mobile/expo/babel.config.js +21 -0
- package/templates/mobile/expo/index.js +7 -0
- package/templates/mobile/expo/metro.config.js +31 -0
- package/templates/mobile/expo/src/app/App.tsx +24 -0
- package/templates/mobile/expo/src/app/app-provider.tsx +40 -0
- package/templates/mobile/expo/src/app/config/translation.ts +30 -0
- package/templates/mobile/expo/src/app/index.ts +1 -0
- package/templates/mobile/expo/src/app/navigation/app-route-type.ts +27 -0
- package/templates/mobile/expo/src/app/navigation/bottom-tabs.tsx +34 -0
- package/templates/mobile/expo/src/app/navigation/index.tsx +14 -0
- package/templates/mobile/expo/src/app/stores/auth.store.ts +33 -0
- package/templates/mobile/expo/src/app/stores/common.store.ts +19 -0
- package/templates/mobile/expo/src/app/stores/index.ts +3 -0
- package/templates/mobile/expo/src/app/stores/loading.store.ts +22 -0
- package/templates/mobile/expo/src/assets/Images/empty-list.png +0 -0
- package/templates/mobile/expo/src/assets/Images/index.ts +5 -0
- package/templates/mobile/expo/src/assets/Images/screen-bg-gradian.png +0 -0
- package/templates/mobile/expo/src/assets/i18n/en.json +28 -0
- package/templates/mobile/expo/src/assets/i18n/fr.json +28 -0
- package/templates/mobile/expo/src/assets/lotties/index.ts +3 -0
- package/templates/mobile/expo/src/assets/lotties/loading.json +1 -0
- package/templates/mobile/expo/src/assets/svgs/arrow-left.svg +3 -0
- package/templates/mobile/expo/src/assets/svgs/arrow-right.svg +3 -0
- package/templates/mobile/expo/src/assets/svgs/calendar.svg +12 -0
- package/templates/mobile/expo/src/assets/svgs/check.svg +3 -0
- package/templates/mobile/expo/src/assets/svgs/close.svg +3 -0
- package/templates/mobile/expo/src/assets/svgs/eye-hide.svg +3 -0
- package/templates/mobile/expo/src/assets/svgs/eye.svg +4 -0
- package/templates/mobile/expo/src/assets/svgs/index.ts +29 -0
- package/templates/mobile/expo/src/assets/svgs/minus.svg +3 -0
- package/templates/mobile/expo/src/assets/svgs/plus.svg +3 -0
- package/templates/mobile/expo/src/assets/svgs/search.svg +3 -0
- package/templates/mobile/expo/src/assets/svgs/toast-error.svg +5 -0
- package/templates/mobile/expo/src/assets/svgs/toast-success.svg +4 -0
- package/templates/mobile/expo/src/core/api/endpoints.ts +8 -0
- package/templates/mobile/expo/src/core/api/example.api.ts +53 -0
- package/templates/mobile/expo/src/core/api/index.ts +4 -0
- package/templates/mobile/expo/src/core/components/common/index.ts +1 -0
- package/templates/mobile/expo/src/core/components/common/list-empty/index.ts +2 -0
- package/templates/mobile/expo/src/core/components/common/list-empty/list-empty.tsx +30 -0
- package/templates/mobile/expo/src/core/components/common/list-empty/list-empty.type.ts +5 -0
- package/templates/mobile/expo/src/core/components/forms/date-time-picker.modal.tsx +116 -0
- package/templates/mobile/expo/src/core/components/forms/hf-date-time.tsx +293 -0
- package/templates/mobile/expo/src/core/components/forms/hf-password-input.tsx +153 -0
- package/templates/mobile/expo/src/core/components/forms/hf-text-input.tsx +59 -0
- package/templates/mobile/expo/src/core/components/forms/hf-time-picker.tsx +116 -0
- package/templates/mobile/expo/src/core/components/forms/index.ts +4 -0
- package/templates/mobile/expo/src/core/components/index.ts +5 -0
- package/templates/mobile/expo/src/core/components/loading/index.ts +1 -0
- package/templates/mobile/expo/src/core/components/loading/loading-app/index.ts +1 -0
- package/templates/mobile/expo/src/core/components/loading/loading-app/loading-app.tsx +50 -0
- package/templates/mobile/expo/src/core/components/offline/index.ts +1 -0
- package/templates/mobile/expo/src/core/components/offline/offline-banner.tsx +186 -0
- package/templates/mobile/expo/src/core/components/screen/index.ts +1 -0
- package/templates/mobile/expo/src/core/components/screen/screen-container/index.ts +1 -0
- package/templates/mobile/expo/src/core/components/screen/screen-container/screen-container.tsx +248 -0
- package/templates/mobile/expo/src/core/components/splash/index.ts +1 -0
- package/templates/mobile/expo/src/core/components/splash/splash-overlay/index.ts +1 -0
- package/templates/mobile/expo/src/core/components/splash/splash-overlay/splash-overlay.tsx +93 -0
- package/templates/mobile/expo/src/core/components/ui/animated-list-item/animated-list-item.tsx +48 -0
- package/templates/mobile/expo/src/core/components/ui/animated-list-item/animated-list-item.type.ts +10 -0
- package/templates/mobile/expo/src/core/components/ui/animated-list-item/index.ts +2 -0
- package/templates/mobile/expo/src/core/components/ui/app-image/app-image.tsx +101 -0
- package/templates/mobile/expo/src/core/components/ui/app-image/app-image.type.ts +19 -0
- package/templates/mobile/expo/src/core/components/ui/app-image/index.ts +2 -0
- package/templates/mobile/expo/src/core/components/ui/asset-placeholder/asset-placeholder.tsx +76 -0
- package/templates/mobile/expo/src/core/components/ui/asset-placeholder/index.ts +1 -0
- package/templates/mobile/expo/src/core/components/ui/avatar-image/avatar-image.tsx +90 -0
- package/templates/mobile/expo/src/core/components/ui/avatar-image/index.ts +1 -0
- package/templates/mobile/expo/src/core/components/ui/bottom-sheet/bottom-sheet.tsx +145 -0
- package/templates/mobile/expo/src/core/components/ui/bottom-sheet/bottom-sheet.type.ts +10 -0
- package/templates/mobile/expo/src/core/components/ui/bottom-sheet/index.ts +2 -0
- package/templates/mobile/expo/src/core/components/ui/button/button.style.ts +146 -0
- package/templates/mobile/expo/src/core/components/ui/button/button.tsx +97 -0
- package/templates/mobile/expo/src/core/components/ui/button/button.type.ts +47 -0
- package/templates/mobile/expo/src/core/components/ui/button/index.ts +4 -0
- package/templates/mobile/expo/src/core/components/ui/checkbox/checkbox.tsx +127 -0
- package/templates/mobile/expo/src/core/components/ui/checkbox/checkbox.type.ts +24 -0
- package/templates/mobile/expo/src/core/components/ui/checkbox/index.ts +2 -0
- package/templates/mobile/expo/src/core/components/ui/collapsible-section/collapsible-section.tsx +141 -0
- package/templates/mobile/expo/src/core/components/ui/collapsible-section/collapsible-section.type.ts +10 -0
- package/templates/mobile/expo/src/core/components/ui/collapsible-section/index.ts +2 -0
- package/templates/mobile/expo/src/core/components/ui/components.registry.json +313 -0
- package/templates/mobile/expo/src/core/components/ui/field/field-frame.tsx +62 -0
- package/templates/mobile/expo/src/core/components/ui/field/field.shared.ts +31 -0
- package/templates/mobile/expo/src/core/components/ui/header/header.tsx +196 -0
- package/templates/mobile/expo/src/core/components/ui/header/header.type.ts +30 -0
- package/templates/mobile/expo/src/core/components/ui/header/index.ts +2 -0
- package/templates/mobile/expo/src/core/components/ui/icon-button/icon-button.style.ts +23 -0
- package/templates/mobile/expo/src/core/components/ui/icon-button/icon-button.tsx +66 -0
- package/templates/mobile/expo/src/core/components/ui/icon-button/icon-button.type.ts +25 -0
- package/templates/mobile/expo/src/core/components/ui/icon-button/index.ts +2 -0
- package/templates/mobile/expo/src/core/components/ui/image-slider/image-slider.tsx +107 -0
- package/templates/mobile/expo/src/core/components/ui/image-slider/image-slider.type.ts +10 -0
- package/templates/mobile/expo/src/core/components/ui/image-slider/index.ts +2 -0
- package/templates/mobile/expo/src/core/components/ui/index.ts +25 -0
- package/templates/mobile/expo/src/core/components/ui/label/index.ts +2 -0
- package/templates/mobile/expo/src/core/components/ui/label/label.tsx +36 -0
- package/templates/mobile/expo/src/core/components/ui/label/label.type.ts +12 -0
- package/templates/mobile/expo/src/core/components/ui/modal/index.ts +2 -0
- package/templates/mobile/expo/src/core/components/ui/modal/modal.tsx +62 -0
- package/templates/mobile/expo/src/core/components/ui/modal/modal.type.ts +11 -0
- package/templates/mobile/expo/src/core/components/ui/otp-input/index.ts +2 -0
- package/templates/mobile/expo/src/core/components/ui/otp-input/otp-input.tsx +129 -0
- package/templates/mobile/expo/src/core/components/ui/otp-input/otp-input.type.ts +20 -0
- package/templates/mobile/expo/src/core/components/ui/page-dots/index.ts +1 -0
- package/templates/mobile/expo/src/core/components/ui/page-dots/page-dots.tsx +60 -0
- package/templates/mobile/expo/src/core/components/ui/radio/index.ts +2 -0
- package/templates/mobile/expo/src/core/components/ui/radio/radio.tsx +121 -0
- package/templates/mobile/expo/src/core/components/ui/radio/radio.type.ts +20 -0
- package/templates/mobile/expo/src/core/components/ui/screen/index.ts +1 -0
- package/templates/mobile/expo/src/core/components/ui/screen/screen-gradient.tsx +33 -0
- package/templates/mobile/expo/src/core/components/ui/search-box/index.ts +2 -0
- package/templates/mobile/expo/src/core/components/ui/search-box/search-box.tsx +162 -0
- package/templates/mobile/expo/src/core/components/ui/search-box/search-box.type.ts +26 -0
- package/templates/mobile/expo/src/core/components/ui/segmented-control/index.ts +2 -0
- package/templates/mobile/expo/src/core/components/ui/segmented-control/segmented-control.tsx +86 -0
- package/templates/mobile/expo/src/core/components/ui/segmented-control/segmented-control.type.ts +22 -0
- package/templates/mobile/expo/src/core/components/ui/skeleton/index.ts +2 -0
- package/templates/mobile/expo/src/core/components/ui/skeleton/skeleton.tsx +106 -0
- package/templates/mobile/expo/src/core/components/ui/skeleton/skeleton.type.ts +8 -0
- package/templates/mobile/expo/src/core/components/ui/success-state/index.ts +1 -0
- package/templates/mobile/expo/src/core/components/ui/success-state/success-state.tsx +68 -0
- package/templates/mobile/expo/src/core/components/ui/tabs/index.ts +2 -0
- package/templates/mobile/expo/src/core/components/ui/tabs/tabs.tsx +273 -0
- package/templates/mobile/expo/src/core/components/ui/tabs/tabs.type.ts +21 -0
- package/templates/mobile/expo/src/core/components/ui/tag-input/index.ts +2 -0
- package/templates/mobile/expo/src/core/components/ui/tag-input/tag-input.tsx +146 -0
- package/templates/mobile/expo/src/core/components/ui/tag-input/tag-input.type.ts +22 -0
- package/templates/mobile/expo/src/core/components/ui/text-area/index.ts +2 -0
- package/templates/mobile/expo/src/core/components/ui/text-area/text-area.tsx +90 -0
- package/templates/mobile/expo/src/core/components/ui/text-area/text-area.type.ts +20 -0
- package/templates/mobile/expo/src/core/components/ui/text-field/index.ts +2 -0
- package/templates/mobile/expo/src/core/components/ui/text-field/text-field.tsx +116 -0
- package/templates/mobile/expo/src/core/components/ui/text-field/text-field.type.ts +21 -0
- package/templates/mobile/expo/src/core/components/ui/toggle/index.ts +2 -0
- package/templates/mobile/expo/src/core/components/ui/toggle/toggle.tsx +110 -0
- package/templates/mobile/expo/src/core/components/ui/toggle/toggle.type.ts +19 -0
- package/templates/mobile/expo/src/core/constants/external-urls.constant.ts +5 -0
- package/templates/mobile/expo/src/core/constants/hard-data.constant.ts +0 -0
- package/templates/mobile/expo/src/core/constants/index.ts +2 -0
- package/templates/mobile/expo/src/core/constants/type.constant.ts +3 -0
- package/templates/mobile/expo/src/core/context/index.ts +1 -0
- package/templates/mobile/expo/src/core/context/shared-transition-context.tsx +35 -0
- package/templates/mobile/expo/src/core/hook/index.ts +8 -0
- package/templates/mobile/expo/src/core/hook/useActiveRouteName.ts +63 -0
- package/templates/mobile/expo/src/core/hook/useAppNavigation.tsx +7 -0
- package/templates/mobile/expo/src/core/hook/useBottomInset.tsx +26 -0
- package/templates/mobile/expo/src/core/hook/useDebounce.tsx +16 -0
- package/templates/mobile/expo/src/core/hook/useEndReached.tsx +46 -0
- package/templates/mobile/expo/src/core/hook/useManualRefetch.ts +56 -0
- package/templates/mobile/expo/src/core/hook/useNetworkStatus.ts +68 -0
- package/templates/mobile/expo/src/core/hook/useTimeout.tsx +30 -0
- package/templates/mobile/expo/src/core/index.ts +7 -0
- package/templates/mobile/expo/src/core/services/api.service.ts +230 -0
- package/templates/mobile/expo/src/core/services/device-id.service.ts +37 -0
- package/templates/mobile/expo/src/core/services/index.ts +3 -0
- package/templates/mobile/expo/src/core/services/session-end.bridge.ts +26 -0
- package/templates/mobile/expo/src/core/theme/dark.theme.ts +10 -0
- package/templates/mobile/expo/src/core/theme/index.ts +5 -0
- package/templates/mobile/expo/src/core/theme/light.theme.ts +44 -0
- package/templates/mobile/expo/src/core/theme/theme-context.tsx +82 -0
- package/templates/mobile/expo/src/core/theme/theme.types.ts +26 -0
- package/templates/mobile/expo/src/core/theme/use-themed-styles.ts +25 -0
- package/templates/mobile/expo/src/core/utils/color.util.tsx +198 -0
- package/templates/mobile/expo/src/core/utils/date.util.ts +97 -0
- package/templates/mobile/expo/src/core/utils/device-locale.util.ts +24 -0
- package/templates/mobile/expo/src/core/utils/emitter/index.ts +161 -0
- package/templates/mobile/expo/src/core/utils/emitter/type.ts +40 -0
- package/templates/mobile/expo/src/core/utils/enum.util.tsx +15 -0
- package/templates/mobile/expo/src/core/utils/font.util.tsx +42 -0
- package/templates/mobile/expo/src/core/utils/func.util.ts +48 -0
- package/templates/mobile/expo/src/core/utils/greeting.util.ts +20 -0
- package/templates/mobile/expo/src/core/utils/image-format.util.ts +117 -0
- package/templates/mobile/expo/src/core/utils/image-picker.util.ts +63 -0
- package/templates/mobile/expo/src/core/utils/index.ts +18 -0
- package/templates/mobile/expo/src/core/utils/linking.util.ts +16 -0
- package/templates/mobile/expo/src/core/utils/navigation.util.tsx +100 -0
- package/templates/mobile/expo/src/core/utils/number-format.ts +28 -0
- package/templates/mobile/expo/src/core/utils/query-client.util.ts +35 -0
- package/templates/mobile/expo/src/core/utils/query-persister.util.ts +31 -0
- package/templates/mobile/expo/src/core/utils/schema.util.tsx +2713 -0
- package/templates/mobile/expo/src/core/utils/size.util.tsx +74 -0
- package/templates/mobile/expo/src/core/utils/storage.util.tsx +53 -0
- package/templates/mobile/expo/src/core/utils/toast.util.tsx +151 -0
- package/templates/mobile/expo/src/core/utils/translator.util.tsx +23 -0
- package/templates/mobile/expo/src/core/utils/typography.util.tsx +69 -0
- package/templates/mobile/expo/src/core/utils/validate.util.tsx +13 -0
- package/templates/mobile/expo/src/declarations.d.ts +54 -0
- package/templates/mobile/expo/src/modules/home/home.screen.tsx +110 -0
- package/templates/mobile/expo/src/modules/profile/profile.screen.tsx +29 -0
- package/templates/mobile/expo/src/scripts/link-fonts.js +60 -0
- package/templates/mobile/expo/src/scripts/sync-images.js +56 -0
- package/templates/mobile/expo/src/scripts/sync-svgs.js +50 -0
- package/templates/mobile/expo/src/types/models.d.ts +24 -0
- package/templates/mobile/expo/tsconfig.json +19 -0
- package/templates/mobile/rn/.bundle/config +2 -0
- package/templates/mobile/rn/.env.example +5 -0
- package/templates/mobile/rn/.eslintrc.js +7 -0
- package/templates/mobile/rn/.prettierrc.js +7 -0
- package/templates/mobile/rn/.svgrrc.js +9 -0
- package/templates/mobile/rn/.watchmanconfig +1 -0
- package/templates/mobile/rn/Gemfile +17 -0
- package/templates/mobile/rn/README.md +72 -7
- package/templates/mobile/rn/_gitignore +24 -0
- package/templates/mobile/rn/_package.json +69 -1
- package/templates/mobile/rn/android/app/build.gradle +126 -0
- package/templates/mobile/rn/android/app/debug.keystore +0 -0
- package/templates/mobile/rn/android/app/proguard-rules.pro +10 -0
- package/templates/mobile/rn/android/app/src/main/AndroidManifest.xml +27 -0
- package/templates/mobile/rn/android/app/src/main/java/com/dumobile/MainActivity.kt +22 -0
- package/templates/mobile/rn/android/app/src/main/java/com/dumobile/MainApplication.kt +27 -0
- package/templates/mobile/rn/android/app/src/main/res/drawable/rn_edit_text_material.xml +37 -0
- package/templates/mobile/rn/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/templates/mobile/rn/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
- package/templates/mobile/rn/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/templates/mobile/rn/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
- package/templates/mobile/rn/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/templates/mobile/rn/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
- package/templates/mobile/rn/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/templates/mobile/rn/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- package/templates/mobile/rn/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/templates/mobile/rn/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
- package/templates/mobile/rn/android/app/src/main/res/values/strings.xml +3 -0
- package/templates/mobile/rn/android/app/src/main/res/values/styles.xml +9 -0
- package/templates/mobile/rn/android/build.gradle +21 -0
- package/templates/mobile/rn/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/templates/mobile/rn/android/gradle/wrapper/gradle-wrapper.properties +7 -0
- package/templates/mobile/rn/android/gradle.properties +44 -0
- package/templates/mobile/rn/android/gradlew +248 -0
- package/templates/mobile/rn/android/gradlew.bat +98 -0
- package/templates/mobile/rn/android/settings.gradle +21 -0
- package/templates/mobile/rn/app.json +4 -0
- package/templates/mobile/rn/babel.config.js +18 -0
- package/templates/mobile/rn/index.js +10 -0
- package/templates/mobile/rn/ios/.xcode.env +11 -0
- package/templates/mobile/rn/ios/DuMobile/AppDelegate.swift +48 -0
- package/templates/mobile/rn/ios/DuMobile/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
- package/templates/mobile/rn/ios/DuMobile/Images.xcassets/Contents.json +6 -0
- package/templates/mobile/rn/ios/DuMobile/Info.plist +59 -0
- package/templates/mobile/rn/ios/DuMobile/LaunchScreen.storyboard +47 -0
- package/templates/mobile/rn/ios/DuMobile/PrivacyInfo.xcprivacy +37 -0
- package/templates/mobile/rn/ios/DuMobile.xcodeproj/project.pbxproj +475 -0
- package/templates/mobile/rn/ios/DuMobile.xcodeproj/xcshareddata/xcschemes/DuMobile.xcscheme +88 -0
- package/templates/mobile/rn/ios/Podfile +34 -0
- package/templates/mobile/rn/metro.config.js +33 -0
- package/templates/mobile/rn/src/app/App.tsx +24 -0
- package/templates/mobile/rn/src/app/app-provider.tsx +41 -0
- package/templates/mobile/rn/src/app/config/translation.ts +29 -0
- package/templates/mobile/rn/src/app/index.ts +1 -0
- package/templates/mobile/rn/src/app/navigation/app-route-type.ts +27 -0
- package/templates/mobile/rn/src/app/navigation/bottom-tabs.tsx +34 -0
- package/templates/mobile/rn/src/app/navigation/index.tsx +14 -0
- package/templates/mobile/rn/src/app/stores/auth.store.ts +33 -0
- package/templates/mobile/rn/src/app/stores/common.store.ts +19 -0
- package/templates/mobile/rn/src/app/stores/index.ts +3 -0
- package/templates/mobile/rn/src/app/stores/loading.store.ts +22 -0
- package/templates/mobile/rn/src/assets/Images/empty-list.png +0 -0
- package/templates/mobile/rn/src/assets/Images/index.ts +5 -0
- package/templates/mobile/rn/src/assets/Images/screen-bg-gradian.png +0 -0
- package/templates/mobile/rn/src/assets/i18n/en.json +22 -0
- package/templates/mobile/rn/src/assets/i18n/fr.json +22 -0
- package/templates/mobile/rn/src/assets/lotties/index.ts +3 -0
- package/templates/mobile/rn/src/assets/lotties/loading.json +1 -0
- package/templates/mobile/rn/src/assets/svgs/arrow-left.svg +3 -0
- package/templates/mobile/rn/src/assets/svgs/arrow-right.svg +3 -0
- package/templates/mobile/rn/src/assets/svgs/calendar.svg +12 -0
- package/templates/mobile/rn/src/assets/svgs/check.svg +3 -0
- package/templates/mobile/rn/src/assets/svgs/close.svg +3 -0
- package/templates/mobile/rn/src/assets/svgs/eye-hide.svg +3 -0
- package/templates/mobile/rn/src/assets/svgs/eye.svg +4 -0
- package/templates/mobile/rn/src/assets/svgs/index.ts +29 -0
- package/templates/mobile/rn/src/assets/svgs/minus.svg +3 -0
- package/templates/mobile/rn/src/assets/svgs/plus.svg +3 -0
- package/templates/mobile/rn/src/assets/svgs/search.svg +3 -0
- package/templates/mobile/rn/src/assets/svgs/toast-error.svg +5 -0
- package/templates/mobile/rn/src/assets/svgs/toast-success.svg +4 -0
- package/templates/mobile/rn/src/core/api/endpoints.ts +8 -0
- package/templates/mobile/rn/src/core/api/example.api.ts +53 -0
- package/templates/mobile/rn/src/core/api/index.ts +4 -0
- package/templates/mobile/rn/src/core/components/common/index.ts +1 -0
- package/templates/mobile/rn/src/core/components/common/list-empty/index.ts +2 -0
- package/templates/mobile/rn/src/core/components/common/list-empty/list-empty.tsx +30 -0
- package/templates/mobile/rn/src/core/components/common/list-empty/list-empty.type.ts +5 -0
- package/templates/mobile/rn/src/core/components/forms/hf-date-time.tsx +301 -0
- package/templates/mobile/rn/src/core/components/forms/hf-password-input.tsx +153 -0
- package/templates/mobile/rn/src/core/components/forms/hf-text-input.tsx +59 -0
- package/templates/mobile/rn/src/core/components/forms/hf-time-picker.tsx +117 -0
- package/templates/mobile/rn/src/core/components/forms/index.ts +4 -0
- package/templates/mobile/rn/src/core/components/index.ts +5 -0
- package/templates/mobile/rn/src/core/components/loading/index.ts +1 -0
- package/templates/mobile/rn/src/core/components/loading/loading-app/index.ts +1 -0
- package/templates/mobile/rn/src/core/components/loading/loading-app/loading-app.tsx +50 -0
- package/templates/mobile/rn/src/core/components/offline/index.ts +1 -0
- package/templates/mobile/rn/src/core/components/offline/offline-banner.tsx +186 -0
- package/templates/mobile/rn/src/core/components/screen/index.ts +1 -0
- package/templates/mobile/rn/src/core/components/screen/screen-container/index.ts +1 -0
- package/templates/mobile/rn/src/core/components/screen/screen-container/screen-container.tsx +252 -0
- package/templates/mobile/rn/src/core/components/splash/index.ts +1 -0
- package/templates/mobile/rn/src/core/components/splash/splash-overlay/index.ts +1 -0
- package/templates/mobile/rn/src/core/components/splash/splash-overlay/splash-overlay.tsx +93 -0
- package/templates/mobile/rn/src/core/components/ui/animated-list-item/animated-list-item.tsx +48 -0
- package/templates/mobile/rn/src/core/components/ui/animated-list-item/animated-list-item.type.ts +10 -0
- package/templates/mobile/rn/src/core/components/ui/animated-list-item/index.ts +2 -0
- package/templates/mobile/rn/src/core/components/ui/app-image/app-image.tsx +104 -0
- package/templates/mobile/rn/src/core/components/ui/app-image/app-image.type.ts +19 -0
- package/templates/mobile/rn/src/core/components/ui/app-image/index.ts +2 -0
- package/templates/mobile/rn/src/core/components/ui/asset-placeholder/asset-placeholder.tsx +76 -0
- package/templates/mobile/rn/src/core/components/ui/asset-placeholder/index.ts +1 -0
- package/templates/mobile/rn/src/core/components/ui/avatar-image/avatar-image.tsx +90 -0
- package/templates/mobile/rn/src/core/components/ui/avatar-image/index.ts +1 -0
- package/templates/mobile/rn/src/core/components/ui/bottom-sheet/bottom-sheet.tsx +145 -0
- package/templates/mobile/rn/src/core/components/ui/bottom-sheet/bottom-sheet.type.ts +10 -0
- package/templates/mobile/rn/src/core/components/ui/bottom-sheet/index.ts +2 -0
- package/templates/mobile/rn/src/core/components/ui/button/button.style.ts +146 -0
- package/templates/mobile/rn/src/core/components/ui/button/button.tsx +97 -0
- package/templates/mobile/rn/src/core/components/ui/button/button.type.ts +47 -0
- package/templates/mobile/rn/src/core/components/ui/button/index.ts +4 -0
- package/templates/mobile/rn/src/core/components/ui/checkbox/checkbox.tsx +127 -0
- package/templates/mobile/rn/src/core/components/ui/checkbox/checkbox.type.ts +24 -0
- package/templates/mobile/rn/src/core/components/ui/checkbox/index.ts +2 -0
- package/templates/mobile/rn/src/core/components/ui/collapsible-section/collapsible-section.tsx +141 -0
- package/templates/mobile/rn/src/core/components/ui/collapsible-section/collapsible-section.type.ts +10 -0
- package/templates/mobile/rn/src/core/components/ui/collapsible-section/index.ts +2 -0
- package/templates/mobile/rn/src/core/components/ui/components.registry.json +313 -0
- package/templates/mobile/rn/src/core/components/ui/field/field-frame.tsx +62 -0
- package/templates/mobile/rn/src/core/components/ui/field/field.shared.ts +31 -0
- package/templates/mobile/rn/src/core/components/ui/header/header.tsx +196 -0
- package/templates/mobile/rn/src/core/components/ui/header/header.type.ts +30 -0
- package/templates/mobile/rn/src/core/components/ui/header/index.ts +2 -0
- package/templates/mobile/rn/src/core/components/ui/icon-button/icon-button.style.ts +23 -0
- package/templates/mobile/rn/src/core/components/ui/icon-button/icon-button.tsx +66 -0
- package/templates/mobile/rn/src/core/components/ui/icon-button/icon-button.type.ts +25 -0
- package/templates/mobile/rn/src/core/components/ui/icon-button/index.ts +2 -0
- package/templates/mobile/rn/src/core/components/ui/image-slider/image-slider.tsx +107 -0
- package/templates/mobile/rn/src/core/components/ui/image-slider/image-slider.type.ts +10 -0
- package/templates/mobile/rn/src/core/components/ui/image-slider/index.ts +2 -0
- package/templates/mobile/rn/src/core/components/ui/index.ts +25 -0
- package/templates/mobile/rn/src/core/components/ui/label/index.ts +2 -0
- package/templates/mobile/rn/src/core/components/ui/label/label.tsx +36 -0
- package/templates/mobile/rn/src/core/components/ui/label/label.type.ts +12 -0
- package/templates/mobile/rn/src/core/components/ui/modal/index.ts +2 -0
- package/templates/mobile/rn/src/core/components/ui/modal/modal.tsx +62 -0
- package/templates/mobile/rn/src/core/components/ui/modal/modal.type.ts +11 -0
- package/templates/mobile/rn/src/core/components/ui/otp-input/index.ts +2 -0
- package/templates/mobile/rn/src/core/components/ui/otp-input/otp-input.tsx +129 -0
- package/templates/mobile/rn/src/core/components/ui/otp-input/otp-input.type.ts +20 -0
- package/templates/mobile/rn/src/core/components/ui/page-dots/index.ts +1 -0
- package/templates/mobile/rn/src/core/components/ui/page-dots/page-dots.tsx +60 -0
- package/templates/mobile/rn/src/core/components/ui/radio/index.ts +2 -0
- package/templates/mobile/rn/src/core/components/ui/radio/radio.tsx +121 -0
- package/templates/mobile/rn/src/core/components/ui/radio/radio.type.ts +20 -0
- package/templates/mobile/rn/src/core/components/ui/screen/index.ts +1 -0
- package/templates/mobile/rn/src/core/components/ui/screen/screen-gradient.tsx +33 -0
- package/templates/mobile/rn/src/core/components/ui/search-box/index.ts +2 -0
- package/templates/mobile/rn/src/core/components/ui/search-box/search-box.tsx +162 -0
- package/templates/mobile/rn/src/core/components/ui/search-box/search-box.type.ts +26 -0
- package/templates/mobile/rn/src/core/components/ui/segmented-control/index.ts +2 -0
- package/templates/mobile/rn/src/core/components/ui/segmented-control/segmented-control.tsx +86 -0
- package/templates/mobile/rn/src/core/components/ui/segmented-control/segmented-control.type.ts +22 -0
- package/templates/mobile/rn/src/core/components/ui/skeleton/index.ts +2 -0
- package/templates/mobile/rn/src/core/components/ui/skeleton/skeleton.tsx +106 -0
- package/templates/mobile/rn/src/core/components/ui/skeleton/skeleton.type.ts +8 -0
- package/templates/mobile/rn/src/core/components/ui/success-state/index.ts +1 -0
- package/templates/mobile/rn/src/core/components/ui/success-state/success-state.tsx +68 -0
- package/templates/mobile/rn/src/core/components/ui/tabs/index.ts +2 -0
- package/templates/mobile/rn/src/core/components/ui/tabs/tabs.tsx +273 -0
- package/templates/mobile/rn/src/core/components/ui/tabs/tabs.type.ts +21 -0
- package/templates/mobile/rn/src/core/components/ui/tag-input/index.ts +2 -0
- package/templates/mobile/rn/src/core/components/ui/tag-input/tag-input.tsx +146 -0
- package/templates/mobile/rn/src/core/components/ui/tag-input/tag-input.type.ts +22 -0
- package/templates/mobile/rn/src/core/components/ui/text-area/index.ts +2 -0
- package/templates/mobile/rn/src/core/components/ui/text-area/text-area.tsx +90 -0
- package/templates/mobile/rn/src/core/components/ui/text-area/text-area.type.ts +20 -0
- package/templates/mobile/rn/src/core/components/ui/text-field/index.ts +2 -0
- package/templates/mobile/rn/src/core/components/ui/text-field/text-field.tsx +116 -0
- package/templates/mobile/rn/src/core/components/ui/text-field/text-field.type.ts +21 -0
- package/templates/mobile/rn/src/core/components/ui/toggle/index.ts +2 -0
- package/templates/mobile/rn/src/core/components/ui/toggle/toggle.tsx +110 -0
- package/templates/mobile/rn/src/core/components/ui/toggle/toggle.type.ts +19 -0
- package/templates/mobile/rn/src/core/constants/external-urls.constant.ts +5 -0
- package/templates/mobile/rn/src/core/constants/hard-data.constant.ts +0 -0
- package/templates/mobile/rn/src/core/constants/index.ts +2 -0
- package/templates/mobile/rn/src/core/constants/type.constant.ts +3 -0
- package/templates/mobile/rn/src/core/context/index.ts +1 -0
- package/templates/mobile/rn/src/core/context/shared-transition-context.tsx +35 -0
- package/templates/mobile/rn/src/core/hook/index.ts +8 -0
- package/templates/mobile/rn/src/core/hook/useActiveRouteName.ts +63 -0
- package/templates/mobile/rn/src/core/hook/useAppNavigation.tsx +7 -0
- package/templates/mobile/rn/src/core/hook/useBottomInset.tsx +26 -0
- package/templates/mobile/rn/src/core/hook/useDebounce.tsx +16 -0
- package/templates/mobile/rn/src/core/hook/useEndReached.tsx +46 -0
- package/templates/mobile/rn/src/core/hook/useManualRefetch.ts +56 -0
- package/templates/mobile/rn/src/core/hook/useNetworkStatus.ts +68 -0
- package/templates/mobile/rn/src/core/hook/useTimeout.tsx +30 -0
- package/templates/mobile/rn/src/core/index.ts +7 -0
- package/templates/mobile/rn/src/core/services/api.service.ts +230 -0
- package/templates/mobile/rn/src/core/services/device-id.service.ts +23 -0
- package/templates/mobile/rn/src/core/services/index.ts +3 -0
- package/templates/mobile/rn/src/core/services/session-end.bridge.ts +26 -0
- package/templates/mobile/rn/src/core/theme/dark.theme.ts +10 -0
- package/templates/mobile/rn/src/core/theme/index.ts +5 -0
- package/templates/mobile/rn/src/core/theme/light.theme.ts +44 -0
- package/templates/mobile/rn/src/core/theme/theme-context.tsx +82 -0
- package/templates/mobile/rn/src/core/theme/theme.types.ts +26 -0
- package/templates/mobile/rn/src/core/theme/use-themed-styles.ts +25 -0
- package/templates/mobile/rn/src/core/utils/color.util.tsx +198 -0
- package/templates/mobile/rn/src/core/utils/date.util.ts +97 -0
- package/templates/mobile/rn/src/core/utils/device-locale.util.ts +22 -0
- package/templates/mobile/rn/src/core/utils/emitter/index.ts +161 -0
- package/templates/mobile/rn/src/core/utils/emitter/type.ts +40 -0
- package/templates/mobile/rn/src/core/utils/enum.util.tsx +15 -0
- package/templates/mobile/rn/src/core/utils/font.util.tsx +42 -0
- package/templates/mobile/rn/src/core/utils/func.util.ts +48 -0
- package/templates/mobile/rn/src/core/utils/greeting.util.ts +20 -0
- package/templates/mobile/rn/src/core/utils/image-format.util.ts +117 -0
- package/templates/mobile/rn/src/core/utils/image-picker.util.ts +84 -0
- package/templates/mobile/rn/src/core/utils/index.ts +18 -0
- package/templates/mobile/rn/src/core/utils/linking.util.ts +16 -0
- package/templates/mobile/rn/src/core/utils/navigation.util.tsx +100 -0
- package/templates/mobile/rn/src/core/utils/number-format.ts +28 -0
- package/templates/mobile/rn/src/core/utils/query-client.util.ts +35 -0
- package/templates/mobile/rn/src/core/utils/query-persister.util.ts +36 -0
- package/templates/mobile/rn/src/core/utils/schema.util.tsx +2713 -0
- package/templates/mobile/rn/src/core/utils/size.util.tsx +74 -0
- package/templates/mobile/rn/src/core/utils/storage.util.tsx +53 -0
- package/templates/mobile/rn/src/core/utils/toast.util.tsx +151 -0
- package/templates/mobile/rn/src/core/utils/translator.util.tsx +23 -0
- package/templates/mobile/rn/src/core/utils/typography.util.tsx +69 -0
- package/templates/mobile/rn/src/core/utils/validate.util.tsx +13 -0
- package/templates/mobile/rn/src/declarations.d.ts +54 -0
- package/templates/mobile/rn/src/modules/home/home.screen.tsx +67 -0
- package/templates/mobile/rn/src/modules/profile/profile.screen.tsx +29 -0
- package/templates/mobile/rn/src/scripts/link-fonts.js +60 -0
- package/templates/mobile/rn/src/scripts/sync-images.js +56 -0
- package/templates/mobile/rn/src/scripts/sync-svgs.js +50 -0
- package/templates/mobile/rn/src/types/models.d.ts +24 -0
- package/templates/mobile/rn/tsconfig.json +21 -0
- package/templates/shared/src/api-endpoints.ts +8 -0
- package/templates/shared/src/enums.ts +34 -0
- package/templates/shared/src/external-urls.ts +5 -0
- package/templates/shared/src/index.ts +6 -3
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ActivityIndicator, TouchableOpacity } from 'react-native';
|
|
3
|
+
import { useTheme } from '@src/core/theme';
|
|
4
|
+
import { resolveColors } from '../button';
|
|
5
|
+
import { ICON_SIZE_TOKENS, styles } from './icon-button.style';
|
|
6
|
+
import { IconButtonProps } from './icon-button.type';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Design-system Icon Button (Life-Master-Design) — a square, icon-only button.
|
|
10
|
+
*
|
|
11
|
+
* Shares the exact color matrix as {@link Button} (variant × colorScheme),
|
|
12
|
+
* reusing its `resolveColors`. Sizes: `md` (44px) | `lg` (56px).
|
|
13
|
+
* Supports `disabled` and `loading` states.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* <IconButton Icon={IconHeart} accessibilityLabel="Like" onPress={onLike} />
|
|
17
|
+
* <IconButton Icon={IconClose} variant="outline" colorScheme="neutral" size="md" accessibilityLabel="Close" />
|
|
18
|
+
*/
|
|
19
|
+
const IconButton = (props: IconButtonProps) => {
|
|
20
|
+
const {
|
|
21
|
+
Icon,
|
|
22
|
+
variant = 'solid',
|
|
23
|
+
colorScheme = 'primary',
|
|
24
|
+
size = 'lg',
|
|
25
|
+
disabled = false,
|
|
26
|
+
loading = false,
|
|
27
|
+
accessibilityLabel,
|
|
28
|
+
style,
|
|
29
|
+
...rest
|
|
30
|
+
} = props;
|
|
31
|
+
|
|
32
|
+
const { colors: themeColors } = useTheme();
|
|
33
|
+
const isInteractionBlocked = disabled || loading;
|
|
34
|
+
const colors = resolveColors(themeColors, variant, colorScheme, disabled);
|
|
35
|
+
const sizeTokens = ICON_SIZE_TOKENS[size];
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<TouchableOpacity
|
|
39
|
+
accessibilityRole="button"
|
|
40
|
+
accessibilityLabel={accessibilityLabel}
|
|
41
|
+
accessibilityState={{ disabled: isInteractionBlocked, busy: loading }}
|
|
42
|
+
activeOpacity={0.7}
|
|
43
|
+
disabled={isInteractionBlocked}
|
|
44
|
+
style={[
|
|
45
|
+
styles.base,
|
|
46
|
+
{
|
|
47
|
+
width: sizeTokens.box,
|
|
48
|
+
height: sizeTokens.box,
|
|
49
|
+
backgroundColor: colors.background,
|
|
50
|
+
borderColor: colors.border,
|
|
51
|
+
borderWidth: colors.borderWidth,
|
|
52
|
+
},
|
|
53
|
+
style,
|
|
54
|
+
]}
|
|
55
|
+
{...rest}
|
|
56
|
+
>
|
|
57
|
+
{loading ? (
|
|
58
|
+
<ActivityIndicator size="small" color={colors.content} />
|
|
59
|
+
) : (
|
|
60
|
+
<Icon width={sizeTokens.iconSize} height={sizeTokens.iconSize} color={colors.content} />
|
|
61
|
+
)}
|
|
62
|
+
</TouchableOpacity>
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export default IconButton;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { StyleProp, TouchableOpacityProps, ViewStyle } from 'react-native';
|
|
2
|
+
import { SvgProps } from 'react-native-svg';
|
|
3
|
+
import { ButtonColorScheme, ButtonVariant } from '../button';
|
|
4
|
+
|
|
5
|
+
/** Size token — `md` = 44px, `lg` = 56px square. */
|
|
6
|
+
export type IconButtonSize = 'md' | 'lg';
|
|
7
|
+
|
|
8
|
+
export type IconButtonProps = Omit<TouchableOpacityProps, 'children'> & {
|
|
9
|
+
/** Icon to render, centered (SVG component). */
|
|
10
|
+
Icon: React.FC<SvgProps>;
|
|
11
|
+
/** Visual style. @default 'solid' */
|
|
12
|
+
variant?: ButtonVariant;
|
|
13
|
+
/** Color scheme. @default 'primary' */
|
|
14
|
+
colorScheme?: ButtonColorScheme;
|
|
15
|
+
/** Size token. @default 'lg' */
|
|
16
|
+
size?: IconButtonSize;
|
|
17
|
+
/** Disable interaction + apply the disabled (faded) visual. */
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
/** Show a spinner instead of the icon; also blocks interaction. */
|
|
20
|
+
loading?: boolean;
|
|
21
|
+
/** Accessibility label (required — icon-only control needs a name). */
|
|
22
|
+
accessibilityLabel: string;
|
|
23
|
+
/** Override the container style. */
|
|
24
|
+
style?: StyleProp<ViewStyle>;
|
|
25
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
FlatList,
|
|
4
|
+
StyleSheet,
|
|
5
|
+
View,
|
|
6
|
+
ViewToken,
|
|
7
|
+
} from 'react-native';
|
|
8
|
+
import FastImage from 'react-native-fast-image';
|
|
9
|
+
|
|
10
|
+
import { AppImage } from '../app-image';
|
|
11
|
+
import { Label } from '../label';
|
|
12
|
+
import { useTheme } from '@src/core/theme';
|
|
13
|
+
import { Font, fontSize, horizontalScale, Radius, verticalScale, WIDTH_SCREEN } from '@src/core/utils';
|
|
14
|
+
import { ImageSliderProps } from './image-slider.type';
|
|
15
|
+
|
|
16
|
+
const ImageSlider: React.FC<ImageSliderProps> = ({
|
|
17
|
+
images,
|
|
18
|
+
width = WIDTH_SCREEN,
|
|
19
|
+
style,
|
|
20
|
+
counterStyle,
|
|
21
|
+
showCounter = true,
|
|
22
|
+
preloadRest = true,
|
|
23
|
+
}) => {
|
|
24
|
+
const { colors } = useTheme();
|
|
25
|
+
const data = images;
|
|
26
|
+
const [activeIndex, setActiveIndex] = useState(0);
|
|
27
|
+
const viewabilityConfig = useRef({ viewAreaCoveragePercentThreshold: 50 });
|
|
28
|
+
const onViewableItemsChanged = useRef(
|
|
29
|
+
({ viewableItems }: { viewableItems: ViewToken[] }) => {
|
|
30
|
+
if (viewableItems.length > 0 && viewableItems[0].index != null) {
|
|
31
|
+
setActiveIndex(viewableItems[0].index);
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
if (!preloadRest) return;
|
|
38
|
+
const rest = data.slice(1).filter(Boolean).map(uri => ({ uri }));
|
|
39
|
+
if (rest.length > 0) FastImage.preload(rest);
|
|
40
|
+
}, [data, preloadRest]);
|
|
41
|
+
|
|
42
|
+
if (data.length === 0) return null;
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<View style={[styles.container, style]}>
|
|
46
|
+
<FlatList
|
|
47
|
+
data={data}
|
|
48
|
+
horizontal
|
|
49
|
+
pagingEnabled
|
|
50
|
+
showsHorizontalScrollIndicator={false}
|
|
51
|
+
keyExtractor={(_, i) => String(i)}
|
|
52
|
+
viewabilityConfig={viewabilityConfig.current}
|
|
53
|
+
onViewableItemsChanged={onViewableItemsChanged.current}
|
|
54
|
+
renderItem={({ item }) => (
|
|
55
|
+
<View style={[styles.slide, { width }]}>
|
|
56
|
+
<AppImage
|
|
57
|
+
source={{ uri: item }}
|
|
58
|
+
style={styles.image}
|
|
59
|
+
containerStyle={StyleSheet.absoluteFill}
|
|
60
|
+
resizeMode="cover"
|
|
61
|
+
/>
|
|
62
|
+
</View>
|
|
63
|
+
)}
|
|
64
|
+
/>
|
|
65
|
+
{showCounter && (
|
|
66
|
+
<View style={[styles.counter, counterStyle]}>
|
|
67
|
+
<Label
|
|
68
|
+
value={`${activeIndex + 1}/${data.length}`}
|
|
69
|
+
style={styles.counterText}
|
|
70
|
+
fontFamily={Font.rethinkSansRegular}
|
|
71
|
+
color={colors.hFFFFFF}
|
|
72
|
+
/>
|
|
73
|
+
</View>
|
|
74
|
+
)}
|
|
75
|
+
</View>
|
|
76
|
+
);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export default ImageSlider;
|
|
80
|
+
|
|
81
|
+
const styles = StyleSheet.create({
|
|
82
|
+
container: {
|
|
83
|
+
width: '100%',
|
|
84
|
+
height: '100%',
|
|
85
|
+
},
|
|
86
|
+
slide: {
|
|
87
|
+
height: '100%',
|
|
88
|
+
},
|
|
89
|
+
image: {
|
|
90
|
+
width: '100%',
|
|
91
|
+
height: '100%',
|
|
92
|
+
},
|
|
93
|
+
counter: {
|
|
94
|
+
position: 'absolute',
|
|
95
|
+
top: verticalScale(12),
|
|
96
|
+
right: horizontalScale(12),
|
|
97
|
+
backgroundColor: 'rgba(0,0,0,0.3)',
|
|
98
|
+
borderWidth: 0.5,
|
|
99
|
+
borderColor: 'rgba(255,255,255,0.4)',
|
|
100
|
+
borderRadius: Radius.radius_full,
|
|
101
|
+
paddingHorizontal: horizontalScale(8),
|
|
102
|
+
paddingVertical: verticalScale(2),
|
|
103
|
+
},
|
|
104
|
+
counterText: {
|
|
105
|
+
fontSize: fontSize(12),
|
|
106
|
+
},
|
|
107
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Design-system UI components (Life-Master-Design).
|
|
2
|
+
// See components.registry.json for the catalog used by the create-UI skill.
|
|
3
|
+
export * from './button';
|
|
4
|
+
export * from './icon-button';
|
|
5
|
+
export * from './checkbox';
|
|
6
|
+
export * from './radio';
|
|
7
|
+
export * from './toggle';
|
|
8
|
+
export * from './text-field';
|
|
9
|
+
export * from './text-area';
|
|
10
|
+
export * from './otp-input';
|
|
11
|
+
export * from './tag-input';
|
|
12
|
+
export * from './search-box';
|
|
13
|
+
export * from './tabs';
|
|
14
|
+
export * from './segmented-control';
|
|
15
|
+
export * from './header';
|
|
16
|
+
export * from './screen';
|
|
17
|
+
export * from './label';
|
|
18
|
+
export * from './modal';
|
|
19
|
+
export * from './bottom-sheet';
|
|
20
|
+
export * from './app-image';
|
|
21
|
+
export * from './image-slider';
|
|
22
|
+
export * from './collapsible-section';
|
|
23
|
+
export * from './animated-list-item';
|
|
24
|
+
export * from './skeleton';
|
|
25
|
+
export * from './avatar-image';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Font, fontSize } from '@src/core/utils';
|
|
2
|
+
import { ThemeColors, useTheme, useThemedStyles } from '@src/core/theme';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { StyleSheet, Text } from 'react-native';
|
|
5
|
+
import { LabelProps } from './label.type';
|
|
6
|
+
|
|
7
|
+
const Label = (props: LabelProps) => {
|
|
8
|
+
const { colors } = useTheme();
|
|
9
|
+
const styles = useThemedStyles(makeStyles);
|
|
10
|
+
const {
|
|
11
|
+
value = '',
|
|
12
|
+
style = {},
|
|
13
|
+
fontFamily = Font.rethinkSansRegular,
|
|
14
|
+
numberOfLines = undefined,
|
|
15
|
+
children,
|
|
16
|
+
color = colors.fg_neutral_normal,
|
|
17
|
+
onPress,
|
|
18
|
+
} = props;
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<Text onPress={onPress} style={[styles.regular, { fontFamily, color }, style]} numberOfLines={numberOfLines}>
|
|
22
|
+
{value}
|
|
23
|
+
{children}
|
|
24
|
+
</Text>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default Label;
|
|
29
|
+
|
|
30
|
+
const makeStyles = (c: ThemeColors) =>
|
|
31
|
+
StyleSheet.create({
|
|
32
|
+
regular: {
|
|
33
|
+
fontSize: fontSize(14),
|
|
34
|
+
color: c.fg_neutral_normal,
|
|
35
|
+
},
|
|
36
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { StyleProp, TextStyle } from 'react-native';
|
|
2
|
+
import { ReactChildren } from '@src/core/constants';
|
|
3
|
+
|
|
4
|
+
export interface LabelProps {
|
|
5
|
+
value?: string;
|
|
6
|
+
style?: StyleProp<TextStyle>;
|
|
7
|
+
numberOfLines?: number;
|
|
8
|
+
children?: ReactChildren;
|
|
9
|
+
fontFamily?: string;
|
|
10
|
+
color?: string;
|
|
11
|
+
onPress?: () => void;
|
|
12
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React, { FC, memo } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Modal as RNModal,
|
|
4
|
+
Pressable,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
} from 'react-native';
|
|
7
|
+
import { horizontalScale, verticalScale } from '../../../utils';
|
|
8
|
+
import { ThemeColors, useTheme, useThemedStyles } from '@src/core/theme';
|
|
9
|
+
import { ModalAppProps as ModalProps } from './modal.type';
|
|
10
|
+
|
|
11
|
+
const Modal: FC<ModalProps> = memo(props => {
|
|
12
|
+
const {
|
|
13
|
+
visible,
|
|
14
|
+
animationType = 'fade',
|
|
15
|
+
children,
|
|
16
|
+
styleContainer = {},
|
|
17
|
+
styleContent = {},
|
|
18
|
+
onHideModal = () => {},
|
|
19
|
+
} = props;
|
|
20
|
+
|
|
21
|
+
const { colors } = useTheme();
|
|
22
|
+
const styles = useThemedStyles(makeStyles);
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<RNModal
|
|
26
|
+
visible={visible}
|
|
27
|
+
animationType={animationType}
|
|
28
|
+
transparent
|
|
29
|
+
backdropColor={colors.rgba000000_50}
|
|
30
|
+
statusBarTranslucent
|
|
31
|
+
onRequestClose={onHideModal}
|
|
32
|
+
>
|
|
33
|
+
<Pressable
|
|
34
|
+
style={[styles.container, styleContainer]}
|
|
35
|
+
onPress={onHideModal}
|
|
36
|
+
>
|
|
37
|
+
<Pressable style={[styles.content, styleContent]}>
|
|
38
|
+
{children}
|
|
39
|
+
</Pressable>
|
|
40
|
+
</Pressable>
|
|
41
|
+
</RNModal>
|
|
42
|
+
);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
export default Modal;
|
|
46
|
+
|
|
47
|
+
const makeStyles = (c: ThemeColors) =>
|
|
48
|
+
StyleSheet.create({
|
|
49
|
+
container: {
|
|
50
|
+
width: '100%',
|
|
51
|
+
height: '100%',
|
|
52
|
+
backgroundColor: c.rgba000000_50,
|
|
53
|
+
justifyContent: 'center',
|
|
54
|
+
alignItems: 'center',
|
|
55
|
+
},
|
|
56
|
+
content: {
|
|
57
|
+
width: horizontalScale(335),
|
|
58
|
+
minHeight: verticalScale(50),
|
|
59
|
+
backgroundColor: c.hFFFFFF,
|
|
60
|
+
borderRadius: horizontalScale(16),
|
|
61
|
+
},
|
|
62
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ModalProps, StyleProp, ViewStyle } from 'react-native';
|
|
2
|
+
import { ReactChildren } from '@src/core/constants';
|
|
3
|
+
|
|
4
|
+
export type ModalAppProps = {
|
|
5
|
+
visible: boolean;
|
|
6
|
+
animationType?: ModalProps['animationType'];
|
|
7
|
+
onHideModal?: () => void;
|
|
8
|
+
styleContainer?: StyleProp<ViewStyle>;
|
|
9
|
+
styleContent?: StyleProp<ViewStyle>;
|
|
10
|
+
children?: ReactChildren;
|
|
11
|
+
};
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { Font, fontSize, horizontalScale, Radius, Spacing, Stroke } from '@src/core/utils';
|
|
2
|
+
import { ThemeColors, useThemedStyles } from '@src/core/theme';
|
|
3
|
+
import React, { useRef, useState } from 'react';
|
|
4
|
+
import { Pressable, StyleSheet, Text, TextInput, View } from 'react-native';
|
|
5
|
+
import { OtpInputProps } from './otp-input.type';
|
|
6
|
+
|
|
7
|
+
const CELL = horizontalScale(48);
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Design-system verification-code (OTP) input (Life-Master-Design).
|
|
11
|
+
*
|
|
12
|
+
* Renders `length` cells driven by a single hidden TextInput.
|
|
13
|
+
* States: default / focus (active cell) / error / disabled.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* <OtpInput length={6} value={code} onChange={setCode} onComplete={verify} />
|
|
17
|
+
*/
|
|
18
|
+
const OtpInput = (props: OtpInputProps) => {
|
|
19
|
+
const {
|
|
20
|
+
length = 6,
|
|
21
|
+
value = '',
|
|
22
|
+
onChange,
|
|
23
|
+
onComplete,
|
|
24
|
+
error = false,
|
|
25
|
+
disabled = false,
|
|
26
|
+
autoFocus = false,
|
|
27
|
+
style,
|
|
28
|
+
} = props;
|
|
29
|
+
|
|
30
|
+
const styles = useThemedStyles(makeStyles);
|
|
31
|
+
const inputRef = useRef<TextInput>(null);
|
|
32
|
+
const [focused, setFocused] = useState(false);
|
|
33
|
+
|
|
34
|
+
const handleChange = (text: string) => {
|
|
35
|
+
const next = text.replace(/[^0-9]/g, '').slice(0, length);
|
|
36
|
+
onChange?.(next);
|
|
37
|
+
if (next.length === length) {
|
|
38
|
+
onComplete?.(next);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const cells = Array.from({ length });
|
|
43
|
+
const activeIndex = value.length;
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<Pressable
|
|
47
|
+
disabled={disabled}
|
|
48
|
+
onPress={() => inputRef.current?.focus()}
|
|
49
|
+
style={[styles.row, style]}
|
|
50
|
+
>
|
|
51
|
+
{cells.map((_, i) => {
|
|
52
|
+
const char = value[i] ?? '';
|
|
53
|
+
const isActive = focused && i === activeIndex && !disabled;
|
|
54
|
+
return (
|
|
55
|
+
<View
|
|
56
|
+
key={i}
|
|
57
|
+
style={[
|
|
58
|
+
styles.cell,
|
|
59
|
+
isActive && styles.cellActive,
|
|
60
|
+
error && !disabled && styles.cellError,
|
|
61
|
+
disabled && styles.cellDisabled,
|
|
62
|
+
]}
|
|
63
|
+
>
|
|
64
|
+
<Text style={[styles.char, disabled && styles.charDisabled]}>{char}</Text>
|
|
65
|
+
</View>
|
|
66
|
+
);
|
|
67
|
+
})}
|
|
68
|
+
|
|
69
|
+
<TextInput
|
|
70
|
+
ref={inputRef}
|
|
71
|
+
value={value}
|
|
72
|
+
editable={!disabled}
|
|
73
|
+
autoFocus={autoFocus}
|
|
74
|
+
keyboardType="number-pad"
|
|
75
|
+
maxLength={length}
|
|
76
|
+
onChangeText={handleChange}
|
|
77
|
+
onFocus={() => setFocused(true)}
|
|
78
|
+
onBlur={() => setFocused(false)}
|
|
79
|
+
style={styles.hiddenInput}
|
|
80
|
+
caretHidden
|
|
81
|
+
/>
|
|
82
|
+
</Pressable>
|
|
83
|
+
);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export default OtpInput;
|
|
87
|
+
|
|
88
|
+
const makeStyles = (c: ThemeColors) =>
|
|
89
|
+
StyleSheet.create({
|
|
90
|
+
row: {
|
|
91
|
+
flexDirection: 'row',
|
|
92
|
+
gap: Spacing.spacing_s_nudge, // 6
|
|
93
|
+
},
|
|
94
|
+
cell: {
|
|
95
|
+
width: CELL,
|
|
96
|
+
height: CELL,
|
|
97
|
+
borderRadius: Radius.radius_md, // 8
|
|
98
|
+
borderWidth: Stroke.stroke_s, // 1
|
|
99
|
+
borderColor: c.bd_neutral_faded, // #525252
|
|
100
|
+
backgroundColor: c.bg_elevation_level_1_normal, // #141414
|
|
101
|
+
alignItems: 'center',
|
|
102
|
+
justifyContent: 'center',
|
|
103
|
+
},
|
|
104
|
+
cellActive: {
|
|
105
|
+
borderColor: c.bd_primary_normal, // #6927da
|
|
106
|
+
},
|
|
107
|
+
cellError: {
|
|
108
|
+
borderColor: c.bd_danger_normal, // #e11d48
|
|
109
|
+
},
|
|
110
|
+
cellDisabled: {
|
|
111
|
+
backgroundColor: c.bg_disable,
|
|
112
|
+
borderColor: c.bd_neutral_faded,
|
|
113
|
+
},
|
|
114
|
+
char: {
|
|
115
|
+
fontFamily: Font.dmSansSemiBold,
|
|
116
|
+
fontSize: fontSize(24),
|
|
117
|
+
lineHeight: 32,
|
|
118
|
+
color: c.fg_neutral_normal,
|
|
119
|
+
},
|
|
120
|
+
charDisabled: {
|
|
121
|
+
color: c.fg_neutral_faded,
|
|
122
|
+
},
|
|
123
|
+
hiddenInput: {
|
|
124
|
+
position: 'absolute',
|
|
125
|
+
opacity: 0,
|
|
126
|
+
width: 1,
|
|
127
|
+
height: 1,
|
|
128
|
+
},
|
|
129
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
2
|
+
|
|
3
|
+
export interface OtpInputProps {
|
|
4
|
+
/** Number of code cells. @default 6 */
|
|
5
|
+
length?: number;
|
|
6
|
+
/** Controlled code value. */
|
|
7
|
+
value?: string;
|
|
8
|
+
/** Fired on every change with the current code. */
|
|
9
|
+
onChange?: (code: string) => void;
|
|
10
|
+
/** Fired when all cells are filled. */
|
|
11
|
+
onComplete?: (code: string) => void;
|
|
12
|
+
/** Error (validation) visual — red cell borders. */
|
|
13
|
+
error?: boolean;
|
|
14
|
+
/** Disable input. */
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
/** Autofocus on mount. */
|
|
17
|
+
autoFocus?: boolean;
|
|
18
|
+
/** Override the container style. */
|
|
19
|
+
style?: StyleProp<ViewStyle>;
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as PageDots } from './page-dots'
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Colors, horizontalScale, Spacing } from '@src/core/utils'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { StyleProp, StyleSheet, View, ViewStyle } from 'react-native'
|
|
4
|
+
|
|
5
|
+
const DOT_SIZE = horizontalScale(6)
|
|
6
|
+
const DOT_ACTIVE_WIDTH = horizontalScale(20)
|
|
7
|
+
|
|
8
|
+
interface PageDotsProps {
|
|
9
|
+
/** Total number of pages. */
|
|
10
|
+
count: number
|
|
11
|
+
/** Zero-based index of the active page. */
|
|
12
|
+
activeIndex: number
|
|
13
|
+
style?: StyleProp<ViewStyle>
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Design-system page indicator (Life-Master-Design onboarding).
|
|
18
|
+
*
|
|
19
|
+
* Renders `count` dots; the active dot widens into a pill.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* <PageDots count={3} activeIndex={current} />
|
|
23
|
+
*/
|
|
24
|
+
const PageDots = ({ count, activeIndex, style }: PageDotsProps) => {
|
|
25
|
+
return (
|
|
26
|
+
<View style={[styles.row, style]}>
|
|
27
|
+
{Array.from({ length: count }).map((_, index) => {
|
|
28
|
+
const isActive = index === activeIndex
|
|
29
|
+
return (
|
|
30
|
+
<View
|
|
31
|
+
key={index}
|
|
32
|
+
style={[styles.dot, isActive ? styles.dotActive : styles.dotInactive]}
|
|
33
|
+
/>
|
|
34
|
+
)
|
|
35
|
+
})}
|
|
36
|
+
</View>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export default PageDots
|
|
41
|
+
|
|
42
|
+
const styles = StyleSheet.create({
|
|
43
|
+
row: {
|
|
44
|
+
flexDirection: 'row',
|
|
45
|
+
alignItems: 'center',
|
|
46
|
+
gap: Spacing.spacing_xs,
|
|
47
|
+
},
|
|
48
|
+
dot: {
|
|
49
|
+
height: DOT_SIZE,
|
|
50
|
+
borderRadius: DOT_SIZE,
|
|
51
|
+
},
|
|
52
|
+
dotActive: {
|
|
53
|
+
width: DOT_ACTIVE_WIDTH,
|
|
54
|
+
backgroundColor: Colors.fg_neutral_normal,
|
|
55
|
+
},
|
|
56
|
+
dotInactive: {
|
|
57
|
+
width: DOT_SIZE,
|
|
58
|
+
backgroundColor: Colors.bd_neutral_faded,
|
|
59
|
+
},
|
|
60
|
+
})
|