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,121 @@
|
|
|
1
|
+
import { Font, fontSize, horizontalScale, Radius, Spacing, Stroke } from '@src/core/utils';
|
|
2
|
+
import { ThemeColors, useThemedStyles } from '@src/core/theme';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { StyleSheet, Text, TouchableOpacity, View } from 'react-native';
|
|
5
|
+
import { RadioProps } from './radio.type';
|
|
6
|
+
|
|
7
|
+
const RING = horizontalScale(20);
|
|
8
|
+
const DOT = horizontalScale(10);
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Design-system Radio (Life-Master-Design).
|
|
12
|
+
*
|
|
13
|
+
* States: unselected / selected, plus `error` and `disabled`.
|
|
14
|
+
* Optional `label` + `caption`. Controlled via `selected` / `onSelect`.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* <Radio selected={value === 'a'} onSelect={() => setValue('a')} label="Option A" caption="Detail" />
|
|
18
|
+
*/
|
|
19
|
+
const Radio = (props: RadioProps) => {
|
|
20
|
+
const {
|
|
21
|
+
selected = false,
|
|
22
|
+
onSelect,
|
|
23
|
+
label,
|
|
24
|
+
caption,
|
|
25
|
+
error = false,
|
|
26
|
+
disabled = false,
|
|
27
|
+
style,
|
|
28
|
+
accessibilityLabel,
|
|
29
|
+
} = props;
|
|
30
|
+
|
|
31
|
+
const styles = useThemedStyles(makeStyles);
|
|
32
|
+
|
|
33
|
+
const ringStyle = [
|
|
34
|
+
styles.ring,
|
|
35
|
+
selected && !disabled && styles.ringSelected,
|
|
36
|
+
error && !disabled && styles.ringError,
|
|
37
|
+
disabled && styles.ringDisabled,
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<TouchableOpacity
|
|
42
|
+
accessibilityRole="radio"
|
|
43
|
+
accessibilityState={{ selected, disabled }}
|
|
44
|
+
accessibilityLabel={accessibilityLabel ?? label}
|
|
45
|
+
activeOpacity={0.7}
|
|
46
|
+
disabled={disabled}
|
|
47
|
+
onPress={onSelect}
|
|
48
|
+
style={[styles.row, style]}
|
|
49
|
+
>
|
|
50
|
+
<View style={ringStyle}>
|
|
51
|
+
{selected ? (
|
|
52
|
+
<View style={[styles.dot, disabled && styles.dotDisabled]} />
|
|
53
|
+
) : null}
|
|
54
|
+
</View>
|
|
55
|
+
|
|
56
|
+
{(label || caption) && (
|
|
57
|
+
<View style={styles.texts}>
|
|
58
|
+
{label ? <Text style={[styles.label, disabled && styles.textDisabled]}>{label}</Text> : null}
|
|
59
|
+
{caption ? <Text style={styles.caption}>{caption}</Text> : null}
|
|
60
|
+
</View>
|
|
61
|
+
)}
|
|
62
|
+
</TouchableOpacity>
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export default Radio;
|
|
67
|
+
|
|
68
|
+
const makeStyles = (c: ThemeColors) =>
|
|
69
|
+
StyleSheet.create({
|
|
70
|
+
row: {
|
|
71
|
+
flexDirection: 'row',
|
|
72
|
+
alignItems: 'flex-start',
|
|
73
|
+
gap: Spacing.spacing_s_nudge, // 6
|
|
74
|
+
},
|
|
75
|
+
ring: {
|
|
76
|
+
width: RING,
|
|
77
|
+
height: RING,
|
|
78
|
+
borderRadius: Radius.radius_full,
|
|
79
|
+
borderWidth: Stroke.stroke_s, // 1
|
|
80
|
+
borderColor: c.bd_neutral_normal, // #c6c6c6
|
|
81
|
+
alignItems: 'center',
|
|
82
|
+
justifyContent: 'center',
|
|
83
|
+
backgroundColor: c.bg_elevation_level_1_normal, // #141414
|
|
84
|
+
},
|
|
85
|
+
ringSelected: {
|
|
86
|
+
borderColor: c.bd_primary_normal, // #6927da
|
|
87
|
+
},
|
|
88
|
+
ringError: {
|
|
89
|
+
borderColor: c.bd_danger_normal,
|
|
90
|
+
},
|
|
91
|
+
ringDisabled: {
|
|
92
|
+
borderColor: c.bd_neutral_faded,
|
|
93
|
+
},
|
|
94
|
+
dot: {
|
|
95
|
+
width: DOT,
|
|
96
|
+
height: DOT,
|
|
97
|
+
borderRadius: Radius.radius_full,
|
|
98
|
+
backgroundColor: c.fg_primary_normal, // #6927da
|
|
99
|
+
},
|
|
100
|
+
dotDisabled: {
|
|
101
|
+
backgroundColor: c.fg_neutral_faded,
|
|
102
|
+
},
|
|
103
|
+
texts: {
|
|
104
|
+
flexShrink: 1,
|
|
105
|
+
},
|
|
106
|
+
label: {
|
|
107
|
+
fontFamily: Font.dmSansMedium,
|
|
108
|
+
fontSize: fontSize(14),
|
|
109
|
+
lineHeight: 20,
|
|
110
|
+
color: c.fg_neutral_normal,
|
|
111
|
+
},
|
|
112
|
+
caption: {
|
|
113
|
+
fontFamily: Font.dmSansRegular,
|
|
114
|
+
fontSize: fontSize(12),
|
|
115
|
+
lineHeight: 18,
|
|
116
|
+
color: c.fg_neutral_faded,
|
|
117
|
+
},
|
|
118
|
+
textDisabled: {
|
|
119
|
+
color: c.fg_neutral_faded,
|
|
120
|
+
},
|
|
121
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
2
|
+
|
|
3
|
+
export interface RadioProps {
|
|
4
|
+
/** Whether this radio is selected. */
|
|
5
|
+
selected?: boolean;
|
|
6
|
+
/** Fired when pressed (while not already selected). */
|
|
7
|
+
onSelect?: () => void;
|
|
8
|
+
/** Primary text next to the circle. */
|
|
9
|
+
label?: string;
|
|
10
|
+
/** Secondary text under the label. */
|
|
11
|
+
caption?: string;
|
|
12
|
+
/** Error (validation) visual — red ring. */
|
|
13
|
+
error?: boolean;
|
|
14
|
+
/** Disable interaction + faded visual. */
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
/** Override container style. */
|
|
17
|
+
style?: StyleProp<ViewStyle>;
|
|
18
|
+
/** Accessibility label when no visible `label` is provided. */
|
|
19
|
+
accessibilityLabel?: string;
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as ScreenContainer } from '../../screen/screen-container/screen-container';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleSheet } from 'react-native';
|
|
3
|
+
import LinearGradient from 'react-native-linear-gradient';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Full-screen vertical gradient background — the default DS screen background.
|
|
7
|
+
*
|
|
8
|
+
* Matches the Life-Master onboarding / splash screens (Figma node 16:6784):
|
|
9
|
+
* a soft top→bottom fade from `#646464` to pure black. Rendered behind all
|
|
10
|
+
* screen content; absolutely positioned and non-interactive.
|
|
11
|
+
*
|
|
12
|
+
* Used as the `gradient` variant of {@link ScreenContainer}.
|
|
13
|
+
*/
|
|
14
|
+
const ScreenGradient = () => {
|
|
15
|
+
return (
|
|
16
|
+
<LinearGradient
|
|
17
|
+
pointerEvents="none"
|
|
18
|
+
colors={['#646464', '#000000']}
|
|
19
|
+
locations={[0, 1]}
|
|
20
|
+
start={{ x: 0, y: 0 }}
|
|
21
|
+
end={{ x: 0, y: 1 }}
|
|
22
|
+
style={styles.gradient}
|
|
23
|
+
/>
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export default ScreenGradient;
|
|
28
|
+
|
|
29
|
+
const styles = StyleSheet.create({
|
|
30
|
+
gradient: {
|
|
31
|
+
...StyleSheet.absoluteFill,
|
|
32
|
+
},
|
|
33
|
+
});
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { IconClose, IconSearch } from '@src/assets/svgs';
|
|
2
|
+
import { ThemeColors, useTheme, useThemedStyles } from '@src/core/theme';
|
|
3
|
+
import { Font, fontSize, horizontalScale, Radius, Spacing, Stroke } from '@src/core/utils';
|
|
4
|
+
import React, { useState } from 'react';
|
|
5
|
+
import { StyleSheet, Text, TextInput, TouchableOpacity, View } from 'react-native';
|
|
6
|
+
import { SearchBoxProps } from './search-box.type';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Design-system search input (Life-Master-Design "Search Box").
|
|
10
|
+
*
|
|
11
|
+
* Leading search icon + text input + a clear (✕) button shown when there is text.
|
|
12
|
+
* States: default / focus / typing / filled.
|
|
13
|
+
*
|
|
14
|
+
* Pass `asButton` + `onPress` to render it as a non-editable trigger (a Text
|
|
15
|
+
* placeholder instead of a TextInput) — used when tapping it should open a
|
|
16
|
+
* dedicated search screen rather than editing the box in place.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* <SearchBox value={q} onChangeText={setQ} />
|
|
20
|
+
* <SearchBox asButton placeholder="Search…" onPress={openSearch} />
|
|
21
|
+
*/
|
|
22
|
+
const SearchBox = (props: SearchBoxProps) => {
|
|
23
|
+
const {
|
|
24
|
+
value = '',
|
|
25
|
+
onChangeText,
|
|
26
|
+
onClear,
|
|
27
|
+
placeholder = 'Type to search',
|
|
28
|
+
disabled = false,
|
|
29
|
+
containerStyle,
|
|
30
|
+
inputStyle,
|
|
31
|
+
asButton = false,
|
|
32
|
+
onPress,
|
|
33
|
+
onFocus,
|
|
34
|
+
onBlur,
|
|
35
|
+
...inputProps
|
|
36
|
+
} = props;
|
|
37
|
+
|
|
38
|
+
const styles = useThemedStyles(makeStyles);
|
|
39
|
+
const { colors } = useTheme();
|
|
40
|
+
|
|
41
|
+
const [focused, setFocused] = useState(false);
|
|
42
|
+
const showClear = value.length > 0 && !disabled;
|
|
43
|
+
|
|
44
|
+
const handleClear = () => {
|
|
45
|
+
onClear ? onClear() : onChangeText?.('');
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// Trigger mode: a tappable box showing the placeholder/value as static text.
|
|
49
|
+
if (asButton) {
|
|
50
|
+
return (
|
|
51
|
+
<TouchableOpacity
|
|
52
|
+
accessibilityRole="search"
|
|
53
|
+
accessibilityLabel={value || placeholder}
|
|
54
|
+
activeOpacity={0.8}
|
|
55
|
+
onPress={onPress}
|
|
56
|
+
disabled={disabled}
|
|
57
|
+
style={[styles.box, styles.boxButton, containerStyle]}
|
|
58
|
+
>
|
|
59
|
+
<IconSearch
|
|
60
|
+
width={horizontalScale(20)}
|
|
61
|
+
height={horizontalScale(20)}
|
|
62
|
+
color={colors.fg_neutral_normal}
|
|
63
|
+
/>
|
|
64
|
+
<Text
|
|
65
|
+
numberOfLines={1}
|
|
66
|
+
style={[
|
|
67
|
+
styles.input,
|
|
68
|
+
!value && { color: colors.fg_neutral_faded },
|
|
69
|
+
inputStyle,
|
|
70
|
+
]}
|
|
71
|
+
>
|
|
72
|
+
{value || placeholder}
|
|
73
|
+
</Text>
|
|
74
|
+
</TouchableOpacity>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<View
|
|
80
|
+
style={[
|
|
81
|
+
styles.box,
|
|
82
|
+
{ borderColor: focused ? colors.bd_primary_normal : 'transparent' },
|
|
83
|
+
containerStyle,
|
|
84
|
+
]}
|
|
85
|
+
>
|
|
86
|
+
<IconSearch
|
|
87
|
+
width={horizontalScale(20)}
|
|
88
|
+
height={horizontalScale(20)}
|
|
89
|
+
color={colors.fg_neutral_normal}
|
|
90
|
+
/>
|
|
91
|
+
|
|
92
|
+
<TextInput
|
|
93
|
+
{...inputProps}
|
|
94
|
+
value={value}
|
|
95
|
+
editable={!disabled}
|
|
96
|
+
placeholder={placeholder}
|
|
97
|
+
placeholderTextColor={colors.fg_neutral_faded}
|
|
98
|
+
onChangeText={onChangeText}
|
|
99
|
+
onFocus={(e) => {
|
|
100
|
+
setFocused(true);
|
|
101
|
+
onFocus?.(e);
|
|
102
|
+
}}
|
|
103
|
+
onBlur={(e) => {
|
|
104
|
+
setFocused(false);
|
|
105
|
+
onBlur?.(e);
|
|
106
|
+
}}
|
|
107
|
+
style={[styles.input, inputStyle]}
|
|
108
|
+
/>
|
|
109
|
+
|
|
110
|
+
{showClear ? (
|
|
111
|
+
<TouchableOpacity
|
|
112
|
+
accessibilityRole="button"
|
|
113
|
+
accessibilityLabel="Clear search"
|
|
114
|
+
onPress={handleClear}
|
|
115
|
+
style={styles.clear}
|
|
116
|
+
hitSlop={6}
|
|
117
|
+
>
|
|
118
|
+
<IconClose
|
|
119
|
+
width={horizontalScale(8)}
|
|
120
|
+
height={horizontalScale(8)}
|
|
121
|
+
color={colors.fg_neutral_normal}
|
|
122
|
+
/>
|
|
123
|
+
</TouchableOpacity>
|
|
124
|
+
) : null}
|
|
125
|
+
</View>
|
|
126
|
+
);
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export default SearchBox;
|
|
130
|
+
|
|
131
|
+
const makeStyles = (c: ThemeColors) =>
|
|
132
|
+
StyleSheet.create({
|
|
133
|
+
box: {
|
|
134
|
+
flexDirection: 'row',
|
|
135
|
+
alignItems: 'center',
|
|
136
|
+
alignSelf: 'stretch',
|
|
137
|
+
gap: Spacing.spacing_sm, // 8
|
|
138
|
+
paddingHorizontal: Spacing.spacing_md, // 12
|
|
139
|
+
paddingVertical: Spacing.spacing_m_nudge, // 10
|
|
140
|
+
borderRadius: Radius.radius_lg, // 12
|
|
141
|
+
borderWidth: Stroke.stroke_s, // 1 (transparent unless focused)
|
|
142
|
+
backgroundColor: c.bg_input, // rgba(0,0,0,0.4)
|
|
143
|
+
},
|
|
144
|
+
boxButton: {
|
|
145
|
+
borderColor: 'transparent',
|
|
146
|
+
},
|
|
147
|
+
input: {
|
|
148
|
+
flex: 1,
|
|
149
|
+
paddingVertical: 0,
|
|
150
|
+
fontFamily: Font.dmSansRegular,
|
|
151
|
+
fontSize: fontSize(16),
|
|
152
|
+
color: c.fg_neutral_normal,
|
|
153
|
+
},
|
|
154
|
+
clear: {
|
|
155
|
+
width: horizontalScale(16),
|
|
156
|
+
height: horizontalScale(16),
|
|
157
|
+
borderRadius: Radius.radius_full,
|
|
158
|
+
alignItems: 'center',
|
|
159
|
+
justifyContent: 'center',
|
|
160
|
+
backgroundColor: c.bg_elevation_level_2_normal, // #292929
|
|
161
|
+
},
|
|
162
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { StyleProp, TextInputProps, TextStyle, ViewStyle } from 'react-native';
|
|
2
|
+
|
|
3
|
+
export type SearchBoxProps = Omit<TextInputProps, 'style'> & {
|
|
4
|
+
/** Controlled text value. */
|
|
5
|
+
value?: string;
|
|
6
|
+
/** Fired on text change. */
|
|
7
|
+
onChangeText?: (text: string) => void;
|
|
8
|
+
/** Fired when the clear (✕) button is pressed. Defaults to clearing the value. */
|
|
9
|
+
onClear?: () => void;
|
|
10
|
+
/** Placeholder. @default 'Type to search' */
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
/** Disable input. */
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
/** Override the container style. */
|
|
15
|
+
containerStyle?: StyleProp<ViewStyle>;
|
|
16
|
+
/** Override the text input style. */
|
|
17
|
+
inputStyle?: StyleProp<TextStyle>;
|
|
18
|
+
/**
|
|
19
|
+
* Render the box as a non-editable button (a Text placeholder instead of a
|
|
20
|
+
* TextInput) and fire {@link onPress} when tapped. Use this when the box is a
|
|
21
|
+
* trigger that opens a dedicated search screen rather than editing in place.
|
|
22
|
+
*/
|
|
23
|
+
asButton?: boolean;
|
|
24
|
+
/** Press handler used when {@link asButton} is set. */
|
|
25
|
+
onPress?: () => void;
|
|
26
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { ThemeColors, useThemedStyles } from '@src/core/theme';
|
|
2
|
+
import { Font, fontSize, Radius, Spacing } from '@src/core/utils';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { StyleSheet, Text, TouchableOpacity, View } from 'react-native';
|
|
5
|
+
import { SegmentedControlProps } from './segmented-control.type';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Design-system segmented control (Life-Master-Design pill toggle, e.g. Français / English).
|
|
9
|
+
*
|
|
10
|
+
* Equal-width segments; the selected one gets an elevated surface + shadow.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* <SegmentedControl
|
|
14
|
+
* items={[{ key: 'fr', label: 'Français' }, { key: 'en', label: 'English' }]}
|
|
15
|
+
* selectedKey={lang}
|
|
16
|
+
* onChange={setLang}
|
|
17
|
+
* />
|
|
18
|
+
*/
|
|
19
|
+
const SegmentedControl = ({ items, selectedKey, onChange, style }: SegmentedControlProps) => {
|
|
20
|
+
const styles = useThemedStyles(makeStyles);
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<View style={[styles.container, style]}>
|
|
24
|
+
{items.map((item) => {
|
|
25
|
+
const isSelected = item.key === selectedKey;
|
|
26
|
+
return (
|
|
27
|
+
<TouchableOpacity
|
|
28
|
+
key={item.key}
|
|
29
|
+
accessibilityRole="button"
|
|
30
|
+
accessibilityState={{ selected: isSelected }}
|
|
31
|
+
activeOpacity={0.8}
|
|
32
|
+
onPress={() => onChange(item.key)}
|
|
33
|
+
style={[styles.segment, isSelected && styles.segmentSelected]}
|
|
34
|
+
>
|
|
35
|
+
{item.leading}
|
|
36
|
+
<Text style={[styles.label, isSelected && styles.labelSelected]}>{item.label}</Text>
|
|
37
|
+
</TouchableOpacity>
|
|
38
|
+
);
|
|
39
|
+
})}
|
|
40
|
+
</View>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export default SegmentedControl;
|
|
45
|
+
|
|
46
|
+
const makeStyles = (c: ThemeColors) =>
|
|
47
|
+
StyleSheet.create({
|
|
48
|
+
container: {
|
|
49
|
+
flexDirection: 'row',
|
|
50
|
+
alignItems: 'center',
|
|
51
|
+
alignSelf: 'stretch',
|
|
52
|
+
gap: Spacing.spacing_xs, // 4
|
|
53
|
+
padding: Spacing.spacing_xs, // 4
|
|
54
|
+
borderRadius: Radius.radius_lg, // 12
|
|
55
|
+
backgroundColor: c.bg_elevation_level_2_normal, // #292929
|
|
56
|
+
},
|
|
57
|
+
segment: {
|
|
58
|
+
flex: 1,
|
|
59
|
+
minHeight: 42,
|
|
60
|
+
flexDirection: 'row',
|
|
61
|
+
alignItems: 'center',
|
|
62
|
+
justifyContent: 'center',
|
|
63
|
+
gap: Spacing.spacing_sm, // 8
|
|
64
|
+
paddingHorizontal: Spacing.spacing_md, // 12
|
|
65
|
+
paddingVertical: Spacing.spacing_sm, // 8
|
|
66
|
+
borderRadius: Radius.radius_md, // 8
|
|
67
|
+
},
|
|
68
|
+
segmentSelected: {
|
|
69
|
+
backgroundColor: c.bg_elevation_level_1_normal, // #141414
|
|
70
|
+
shadowColor: c.shadow_skeumorphic_inner,
|
|
71
|
+
shadowOffset: { width: 0, height: 1 },
|
|
72
|
+
shadowOpacity: 1,
|
|
73
|
+
shadowRadius: 3,
|
|
74
|
+
elevation: 2,
|
|
75
|
+
},
|
|
76
|
+
label: {
|
|
77
|
+
fontFamily: Font.dmSansMedium,
|
|
78
|
+
fontSize: fontSize(14),
|
|
79
|
+
lineHeight: 20,
|
|
80
|
+
letterSpacing: 0.25,
|
|
81
|
+
color: c.fg_neutral_faded, // #a8a8a8
|
|
82
|
+
},
|
|
83
|
+
labelSelected: {
|
|
84
|
+
color: c.fg_neutral_normal, // #f5f5f5
|
|
85
|
+
},
|
|
86
|
+
});
|
package/templates/mobile/rn/src/core/components/ui/segmented-control/segmented-control.type.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
|
|
4
|
+
export interface SegmentItem {
|
|
5
|
+
/** Unique key. */
|
|
6
|
+
key: string;
|
|
7
|
+
/** Visible label. */
|
|
8
|
+
label: string;
|
|
9
|
+
/** Optional leading element (e.g. a flag/emoji icon). */
|
|
10
|
+
leading?: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface SegmentedControlProps {
|
|
14
|
+
/** Segments. */
|
|
15
|
+
items: SegmentItem[];
|
|
16
|
+
/** Currently selected key. */
|
|
17
|
+
selectedKey: string;
|
|
18
|
+
/** Fired with the next key on press. */
|
|
19
|
+
onChange: (key: string) => void;
|
|
20
|
+
/** Override the container style. */
|
|
21
|
+
style?: StyleProp<ViewStyle>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { LayoutChangeEvent, StyleSheet, View } from 'react-native';
|
|
3
|
+
import LinearGradient from 'react-native-linear-gradient';
|
|
4
|
+
import Animated, {
|
|
5
|
+
Easing,
|
|
6
|
+
useAnimatedStyle,
|
|
7
|
+
useSharedValue,
|
|
8
|
+
withRepeat,
|
|
9
|
+
withTiming,
|
|
10
|
+
} from 'react-native-reanimated';
|
|
11
|
+
import { ThemeColors, useTheme, useThemedStyles } from '@src/core/theme';
|
|
12
|
+
import { SkeletonProps } from './skeleton.type';
|
|
13
|
+
|
|
14
|
+
// One sweep of the highlight band, edge to edge. Slower than a pulse so the
|
|
15
|
+
// motion reads as a deliberate "loading" sheen rather than a flicker.
|
|
16
|
+
const SWEEP_DURATION_MS = 1100;
|
|
17
|
+
// The moving band is ~60% of the block width, so a soft highlight crosses
|
|
18
|
+
// rather than a hard line.
|
|
19
|
+
const BAND_RATIO = 0.6;
|
|
20
|
+
|
|
21
|
+
const AnimatedGradient = Animated.createAnimatedComponent(LinearGradient);
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Loading placeholder block with a horizontal shimmer sweep.
|
|
25
|
+
*
|
|
26
|
+
* A dim base fills the box; a soft highlight band (LinearGradient) sweeps left
|
|
27
|
+
* → right on a loop on the UI thread (reanimated), giving the "professional"
|
|
28
|
+
* sheen instead of the old whole-block opacity pulse. The box clips the band
|
|
29
|
+
* (`overflow: hidden`) and measures its own width so the sweep distance is
|
|
30
|
+
* exact at any size.
|
|
31
|
+
*/
|
|
32
|
+
const Skeleton: React.FC<SkeletonProps> = ({
|
|
33
|
+
width = '100%',
|
|
34
|
+
height = 16,
|
|
35
|
+
borderRadius = 8,
|
|
36
|
+
style,
|
|
37
|
+
}) => {
|
|
38
|
+
const styles = useThemedStyles(makeStyles);
|
|
39
|
+
const { colors } = useTheme();
|
|
40
|
+
|
|
41
|
+
// Measured pixel width drives the sweep distance (width can be a %/'100%').
|
|
42
|
+
const [boxWidth, setBoxWidth] = useState(0);
|
|
43
|
+
const progress = useSharedValue(0);
|
|
44
|
+
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
if (boxWidth === 0) return;
|
|
47
|
+
progress.value = 0;
|
|
48
|
+
progress.value = withRepeat(
|
|
49
|
+
withTiming(1, { duration: SWEEP_DURATION_MS, easing: Easing.linear }),
|
|
50
|
+
-1, // infinite
|
|
51
|
+
false, // restart from the left each loop (no reverse)
|
|
52
|
+
);
|
|
53
|
+
}, [boxWidth, progress]);
|
|
54
|
+
|
|
55
|
+
const bandWidth = boxWidth * BAND_RATIO;
|
|
56
|
+
|
|
57
|
+
const bandStyle = useAnimatedStyle(() => ({
|
|
58
|
+
// Travel from fully off the left edge to fully off the right edge.
|
|
59
|
+
transform: [
|
|
60
|
+
{
|
|
61
|
+
translateX:
|
|
62
|
+
-bandWidth + progress.value * (boxWidth + bandWidth),
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
}));
|
|
66
|
+
|
|
67
|
+
const onLayout = (e: LayoutChangeEvent) => {
|
|
68
|
+
const w = e.nativeEvent.layout.width;
|
|
69
|
+
if (w !== boxWidth) setBoxWidth(w);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<View
|
|
74
|
+
onLayout={onLayout}
|
|
75
|
+
style={[styles.base, { width, height, borderRadius }, style]}
|
|
76
|
+
>
|
|
77
|
+
{boxWidth > 0 ? (
|
|
78
|
+
<AnimatedGradient
|
|
79
|
+
colors={[colors.transparent, colors.rgbaFFFFFF_20, colors.transparent]}
|
|
80
|
+
start={{ x: 0, y: 0.5 }}
|
|
81
|
+
end={{ x: 1, y: 0.5 }}
|
|
82
|
+
style={[styles.band, { width: bandWidth }, bandStyle]}
|
|
83
|
+
/>
|
|
84
|
+
) : null}
|
|
85
|
+
</View>
|
|
86
|
+
);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export default Skeleton;
|
|
90
|
+
|
|
91
|
+
const makeStyles = (c: ThemeColors) =>
|
|
92
|
+
StyleSheet.create({
|
|
93
|
+
base: {
|
|
94
|
+
backgroundColor: c.bg_elevation_level_2_normal, // #292929 dim block
|
|
95
|
+
overflow: 'hidden',
|
|
96
|
+
},
|
|
97
|
+
// Full-height band pinned to the left edge; its `width` is set inline from
|
|
98
|
+
// the measured box and it sweeps across via an animated translateX (so it
|
|
99
|
+
// must NOT pin `right`, or the width would be ignored).
|
|
100
|
+
band: {
|
|
101
|
+
position: 'absolute',
|
|
102
|
+
top: 0,
|
|
103
|
+
bottom: 0,
|
|
104
|
+
left: 0,
|
|
105
|
+
},
|
|
106
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as SuccessState } from './success-state'
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { IconCheck } from '@src/assets/svgs'
|
|
2
|
+
import { Colors, Font, fontSize, horizontalScale, Spacing } from '@src/core/utils'
|
|
3
|
+
import React from 'react'
|
|
4
|
+
import { StyleProp, StyleSheet, Text, View, ViewStyle } from 'react-native'
|
|
5
|
+
import { SvgProps } from 'react-native-svg'
|
|
6
|
+
|
|
7
|
+
const BADGE_SIZE = horizontalScale(64)
|
|
8
|
+
const ICON_SIZE = horizontalScale(28)
|
|
9
|
+
|
|
10
|
+
interface SuccessStateProps {
|
|
11
|
+
title: string
|
|
12
|
+
subtitle?: string
|
|
13
|
+
/** Badge icon. @default IconCheck */
|
|
14
|
+
Icon?: React.FC<SvgProps>
|
|
15
|
+
style?: StyleProp<ViewStyle>
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Design-system confirmation block (Life-Master-Design success screens).
|
|
20
|
+
*
|
|
21
|
+
* Centered success badge + title + optional subtitle. Used by the
|
|
22
|
+
* "reset link sent" and "password reset success" screens.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* <SuccessState title="Mot de passe mis à jour" subtitle="Connectez-vous…" />
|
|
26
|
+
*/
|
|
27
|
+
const SuccessState = ({ title, subtitle, Icon = IconCheck, style }: SuccessStateProps) => {
|
|
28
|
+
return (
|
|
29
|
+
<View style={[styles.container, style]}>
|
|
30
|
+
<View style={styles.badge}>
|
|
31
|
+
<Icon width={ICON_SIZE} height={ICON_SIZE} />
|
|
32
|
+
</View>
|
|
33
|
+
<Text style={styles.title}>{title}</Text>
|
|
34
|
+
{subtitle ? <Text style={styles.subtitle}>{subtitle}</Text> : null}
|
|
35
|
+
</View>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export default SuccessState
|
|
40
|
+
|
|
41
|
+
const styles = StyleSheet.create({
|
|
42
|
+
container: {
|
|
43
|
+
alignItems: 'center',
|
|
44
|
+
gap: Spacing.spacing_base,
|
|
45
|
+
},
|
|
46
|
+
badge: {
|
|
47
|
+
width: BADGE_SIZE,
|
|
48
|
+
height: BADGE_SIZE,
|
|
49
|
+
borderRadius: BADGE_SIZE,
|
|
50
|
+
alignItems: 'center',
|
|
51
|
+
justifyContent: 'center',
|
|
52
|
+
backgroundColor: Colors.fg_success_normal,
|
|
53
|
+
},
|
|
54
|
+
title: {
|
|
55
|
+
fontFamily: Font.dmSansSemiBold,
|
|
56
|
+
fontSize: fontSize(24),
|
|
57
|
+
lineHeight: 32,
|
|
58
|
+
textAlign: 'center',
|
|
59
|
+
color: Colors.fg_neutral_on_background,
|
|
60
|
+
},
|
|
61
|
+
subtitle: {
|
|
62
|
+
fontFamily: Font.dmSansRegular,
|
|
63
|
+
fontSize: fontSize(14),
|
|
64
|
+
lineHeight: 20,
|
|
65
|
+
textAlign: 'center',
|
|
66
|
+
color: Colors.fg_neutral_faded,
|
|
67
|
+
},
|
|
68
|
+
})
|