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,146 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
import { Font, horizontalScale, Radius, Stroke } from '@src/core/utils';
|
|
3
|
+
import { ThemeColors } from '@src/core/theme';
|
|
4
|
+
import { ButtonColorScheme, ButtonColorTokens, ButtonSize, ButtonVariant } from './button.type';
|
|
5
|
+
|
|
6
|
+
/** Size-specific dimensions, paddings, gap and typography (from Figma). */
|
|
7
|
+
export const SIZE_TOKENS: Record<
|
|
8
|
+
ButtonSize,
|
|
9
|
+
{
|
|
10
|
+
height: number;
|
|
11
|
+
paddingHorizontal: number;
|
|
12
|
+
gap: number;
|
|
13
|
+
fontSize: number;
|
|
14
|
+
lineHeight: number;
|
|
15
|
+
iconSize: number;
|
|
16
|
+
}
|
|
17
|
+
> = {
|
|
18
|
+
md: {
|
|
19
|
+
// Height is a FIXED vertical dimension from Figma (line-height 24 + 10px
|
|
20
|
+
// vertical padding = 44). It must NOT be horizontalScale'd — that scales a
|
|
21
|
+
// vertical value by screen width and drifts off-spec on non-base widths.
|
|
22
|
+
height: 44,
|
|
23
|
+
paddingHorizontal: horizontalScale(12),
|
|
24
|
+
gap: horizontalScale(4),
|
|
25
|
+
fontSize: 16,
|
|
26
|
+
lineHeight: 24,
|
|
27
|
+
iconSize: horizontalScale(20),
|
|
28
|
+
},
|
|
29
|
+
lg: {
|
|
30
|
+
height: 56,
|
|
31
|
+
paddingHorizontal: horizontalScale(16),
|
|
32
|
+
gap: horizontalScale(8),
|
|
33
|
+
fontSize: 20,
|
|
34
|
+
lineHeight: 28,
|
|
35
|
+
iconSize: horizontalScale(24),
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/** Disabled appearance — shared across every variant/scheme (Figma "Faded" neutral). */
|
|
40
|
+
const disabledTokens = (c: ThemeColors): ButtonColorTokens => ({
|
|
41
|
+
background: c.bg_elevation_level_2_normal,
|
|
42
|
+
border: c.bd_neutral_faded,
|
|
43
|
+
borderWidth: Stroke.stroke_xs, // 0.5
|
|
44
|
+
content: c.fg_neutral_faded,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const solid = (c: ThemeColors): Record<ButtonColorScheme, ButtonColorTokens> => ({
|
|
48
|
+
primary: {
|
|
49
|
+
background: c.bg_primary_normal,
|
|
50
|
+
border: c.bg_primary_normal,
|
|
51
|
+
borderWidth: Stroke.stroke_none,
|
|
52
|
+
content: c.fg_primary_on_background,
|
|
53
|
+
},
|
|
54
|
+
secondary: {
|
|
55
|
+
background: c.bg_secondary_normal,
|
|
56
|
+
border: c.bg_secondary_normal,
|
|
57
|
+
borderWidth: Stroke.stroke_none,
|
|
58
|
+
content: c.fg_secondary_on_background,
|
|
59
|
+
},
|
|
60
|
+
neutral: {
|
|
61
|
+
background: c.bg_elevation_reverse,
|
|
62
|
+
border: c.bg_elevation_reverse,
|
|
63
|
+
borderWidth: Stroke.stroke_none,
|
|
64
|
+
content: c.fg_neutral_reverse,
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
const outline = (c: ThemeColors): Record<ButtonColorScheme, ButtonColorTokens> => ({
|
|
69
|
+
primary: {
|
|
70
|
+
background: c.bg_elevation_level_1_normal,
|
|
71
|
+
border: c.bd_primary_normal,
|
|
72
|
+
borderWidth: Stroke.stroke_s, // 1
|
|
73
|
+
content: c.fg_primary_normal,
|
|
74
|
+
},
|
|
75
|
+
secondary: {
|
|
76
|
+
background: c.bg_elevation_level_1_normal,
|
|
77
|
+
border: c.bd_secondary_normal,
|
|
78
|
+
borderWidth: Stroke.stroke_s,
|
|
79
|
+
content: c.fg_secondary_normal,
|
|
80
|
+
},
|
|
81
|
+
neutral: {
|
|
82
|
+
background: c.bg_elevation_level_1_normal,
|
|
83
|
+
border: c.bd_neutral_normal,
|
|
84
|
+
borderWidth: Stroke.stroke_s,
|
|
85
|
+
content: c.fg_neutral_normal,
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
const faded = (c: ThemeColors): Record<ButtonColorScheme, ButtonColorTokens> => ({
|
|
90
|
+
primary: {
|
|
91
|
+
background: c.bg_primary_faded,
|
|
92
|
+
border: c.bd_primary_faded,
|
|
93
|
+
borderWidth: Stroke.stroke_xs, // 0.5
|
|
94
|
+
content: c.fg_primary_faded,
|
|
95
|
+
},
|
|
96
|
+
secondary: {
|
|
97
|
+
background: c.bg_secondary_normal,
|
|
98
|
+
border: c.bg_secondary_normal,
|
|
99
|
+
borderWidth: Stroke.stroke_none,
|
|
100
|
+
content: c.fg_secondary_on_background,
|
|
101
|
+
},
|
|
102
|
+
neutral: {
|
|
103
|
+
background: c.bg_elevation_level_2_normal,
|
|
104
|
+
border: c.bd_neutral_faded,
|
|
105
|
+
borderWidth: Stroke.stroke_xs,
|
|
106
|
+
content: c.fg_neutral_faded,
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Resolve the final color tokens for a button against the active theme.
|
|
112
|
+
* Disabled state overrides variant/scheme with the shared faded-neutral look.
|
|
113
|
+
*/
|
|
114
|
+
export const resolveColors = (
|
|
115
|
+
colors: ThemeColors,
|
|
116
|
+
variant: ButtonVariant,
|
|
117
|
+
colorScheme: ButtonColorScheme,
|
|
118
|
+
disabled: boolean,
|
|
119
|
+
): ButtonColorTokens => {
|
|
120
|
+
if (disabled) {
|
|
121
|
+
return disabledTokens(colors);
|
|
122
|
+
}
|
|
123
|
+
const variantMap: Record<ButtonVariant, Record<ButtonColorScheme, ButtonColorTokens>> = {
|
|
124
|
+
solid: solid(colors),
|
|
125
|
+
outline: outline(colors),
|
|
126
|
+
faded: faded(colors),
|
|
127
|
+
};
|
|
128
|
+
return variantMap[variant][colorScheme];
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export const styles = StyleSheet.create({
|
|
132
|
+
base: {
|
|
133
|
+
flexDirection: 'row',
|
|
134
|
+
alignItems: 'center',
|
|
135
|
+
justifyContent: 'center',
|
|
136
|
+
borderRadius: Radius.radius_lg, // 12
|
|
137
|
+
overflow: 'hidden',
|
|
138
|
+
},
|
|
139
|
+
fullWidth: {
|
|
140
|
+
alignSelf: 'stretch',
|
|
141
|
+
},
|
|
142
|
+
label: {
|
|
143
|
+
fontFamily: Font.dmSansSemiBold,
|
|
144
|
+
textAlign: 'center',
|
|
145
|
+
},
|
|
146
|
+
});
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ActivityIndicator, TouchableOpacity } from 'react-native';
|
|
3
|
+
import { useTheme } from '@src/core/theme';
|
|
4
|
+
import { Label } from '../label';
|
|
5
|
+
import { resolveColors, SIZE_TOKENS, styles } from './button.style';
|
|
6
|
+
import { ButtonProps } from './button.type';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Design-system Button (Life-Master-Design).
|
|
10
|
+
*
|
|
11
|
+
* Variants: `solid` | `outline` | `faded`.
|
|
12
|
+
* Color schemes: `primary` | `secondary` | `neutral`.
|
|
13
|
+
* Sizes: `md` (44px) | `lg` (56px).
|
|
14
|
+
*
|
|
15
|
+
* Supports `disabled` and `loading` states, optional leading/trailing SVG icons,
|
|
16
|
+
* and `fullWidth`. Styling is centralized in `button.style.ts` and reads DS tokens
|
|
17
|
+
* from `@src/core/utils`.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* <Button label="Continue" onPress={onNext} />
|
|
21
|
+
* <Button label="Cancel" variant="outline" colorScheme="neutral" size="md" />
|
|
22
|
+
* <Button label="Save" loading={isSaving} IconLeft={IconSave} fullWidth />
|
|
23
|
+
*/
|
|
24
|
+
const Button = (props: ButtonProps) => {
|
|
25
|
+
const {
|
|
26
|
+
label,
|
|
27
|
+
variant = 'solid',
|
|
28
|
+
colorScheme = 'primary',
|
|
29
|
+
size = 'lg',
|
|
30
|
+
disabled = false,
|
|
31
|
+
loading = false,
|
|
32
|
+
fullWidth = false,
|
|
33
|
+
IconLeft,
|
|
34
|
+
IconRight,
|
|
35
|
+
style,
|
|
36
|
+
labelStyle,
|
|
37
|
+
children,
|
|
38
|
+
...rest
|
|
39
|
+
} = props;
|
|
40
|
+
|
|
41
|
+
const { colors: themeColors } = useTheme();
|
|
42
|
+
const isInteractionBlocked = disabled || loading;
|
|
43
|
+
const colors = resolveColors(themeColors, variant, colorScheme, disabled);
|
|
44
|
+
const sizeTokens = SIZE_TOKENS[size];
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<TouchableOpacity
|
|
48
|
+
accessibilityRole="button"
|
|
49
|
+
accessibilityState={{ disabled: isInteractionBlocked, busy: loading }}
|
|
50
|
+
activeOpacity={0.7}
|
|
51
|
+
disabled={isInteractionBlocked}
|
|
52
|
+
style={[
|
|
53
|
+
styles.base,
|
|
54
|
+
{
|
|
55
|
+
height: sizeTokens.height,
|
|
56
|
+
paddingHorizontal: sizeTokens.paddingHorizontal,
|
|
57
|
+
gap: sizeTokens.gap,
|
|
58
|
+
backgroundColor: colors.background,
|
|
59
|
+
borderColor: colors.border,
|
|
60
|
+
borderWidth: colors.borderWidth,
|
|
61
|
+
},
|
|
62
|
+
fullWidth && styles.fullWidth,
|
|
63
|
+
style,
|
|
64
|
+
]}
|
|
65
|
+
{...rest}
|
|
66
|
+
>
|
|
67
|
+
{loading ? (
|
|
68
|
+
<ActivityIndicator size="small" color={colors.content} />
|
|
69
|
+
) : (
|
|
70
|
+
<>
|
|
71
|
+
{IconLeft ? (
|
|
72
|
+
<IconLeft width={sizeTokens.iconSize} height={sizeTokens.iconSize} color={colors.content} />
|
|
73
|
+
) : null}
|
|
74
|
+
|
|
75
|
+
{children ?? (
|
|
76
|
+
<Label
|
|
77
|
+
value={label}
|
|
78
|
+
color={colors.content}
|
|
79
|
+
fontFamily={styles.label.fontFamily}
|
|
80
|
+
style={[
|
|
81
|
+
styles.label,
|
|
82
|
+
{ fontSize: sizeTokens.fontSize, lineHeight: sizeTokens.lineHeight },
|
|
83
|
+
labelStyle,
|
|
84
|
+
]}
|
|
85
|
+
/>
|
|
86
|
+
)}
|
|
87
|
+
|
|
88
|
+
{IconRight ? (
|
|
89
|
+
<IconRight width={sizeTokens.iconSize} height={sizeTokens.iconSize} color={colors.content} />
|
|
90
|
+
) : null}
|
|
91
|
+
</>
|
|
92
|
+
)}
|
|
93
|
+
</TouchableOpacity>
|
|
94
|
+
);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export default Button;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { StyleProp, TextStyle, TouchableOpacityProps, ViewStyle } from 'react-native';
|
|
3
|
+
import { SvgProps } from 'react-native-svg';
|
|
4
|
+
|
|
5
|
+
/** Visual style of the button. */
|
|
6
|
+
export type ButtonVariant = 'solid' | 'outline' | 'faded';
|
|
7
|
+
|
|
8
|
+
/** Color scheme mapped to the design-system palette. */
|
|
9
|
+
export type ButtonColorScheme = 'primary' | 'secondary' | 'neutral';
|
|
10
|
+
|
|
11
|
+
/** Size token — `md` = 44px height, `lg` = 56px height. */
|
|
12
|
+
export type ButtonSize = 'md' | 'lg';
|
|
13
|
+
|
|
14
|
+
export type ButtonProps = Omit<TouchableOpacityProps, 'children'> & {
|
|
15
|
+
/** Text rendered inside the button. */
|
|
16
|
+
label: string;
|
|
17
|
+
/** Visual style. @default 'solid' */
|
|
18
|
+
variant?: ButtonVariant;
|
|
19
|
+
/** Color scheme. @default 'primary' */
|
|
20
|
+
colorScheme?: ButtonColorScheme;
|
|
21
|
+
/** Size token. @default 'lg' */
|
|
22
|
+
size?: ButtonSize;
|
|
23
|
+
/** Disable interaction + apply the disabled (faded) visual. */
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
/** Show a spinner instead of the label/icons; also blocks interaction. */
|
|
26
|
+
loading?: boolean;
|
|
27
|
+
/** Stretch the button to fill the parent width. */
|
|
28
|
+
fullWidth?: boolean;
|
|
29
|
+
/** Leading icon (SVG component). */
|
|
30
|
+
IconLeft?: React.FC<SvgProps>;
|
|
31
|
+
/** Trailing icon (SVG component). */
|
|
32
|
+
IconRight?: React.FC<SvgProps>;
|
|
33
|
+
/** Override the container style. */
|
|
34
|
+
style?: StyleProp<ViewStyle>;
|
|
35
|
+
/** Override the label style. */
|
|
36
|
+
labelStyle?: StyleProp<TextStyle>;
|
|
37
|
+
/** Custom node rendered in place of the default label (advanced). */
|
|
38
|
+
children?: ReactNode;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/** Resolved colors for a variant + colorScheme + state combination. */
|
|
42
|
+
export interface ButtonColorTokens {
|
|
43
|
+
background: string;
|
|
44
|
+
border: string;
|
|
45
|
+
borderWidth: number;
|
|
46
|
+
content: string;
|
|
47
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { IconCheck } 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 from 'react';
|
|
5
|
+
import { StyleSheet, Text, TouchableOpacity, View } from 'react-native';
|
|
6
|
+
import { CheckboxProps } from './checkbox.type';
|
|
7
|
+
|
|
8
|
+
const BOX = horizontalScale(20);
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Design-system Checkbox (Life-Master-Design).
|
|
12
|
+
*
|
|
13
|
+
* States: unchecked / checked / indeterminate, plus `error` and `disabled`.
|
|
14
|
+
* Optional `label` + `caption`. Controlled via `checked` / `onChange`.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* <Checkbox checked={agree} onChange={setAgree} label="I agree" caption="Terms & conditions" />
|
|
18
|
+
* <Checkbox indeterminate label="Select all" />
|
|
19
|
+
*/
|
|
20
|
+
const Checkbox = (props: CheckboxProps) => {
|
|
21
|
+
const {
|
|
22
|
+
checked = false,
|
|
23
|
+
indeterminate = false,
|
|
24
|
+
onChange,
|
|
25
|
+
label,
|
|
26
|
+
caption,
|
|
27
|
+
error = false,
|
|
28
|
+
disabled = false,
|
|
29
|
+
style,
|
|
30
|
+
accessibilityLabel,
|
|
31
|
+
} = props;
|
|
32
|
+
|
|
33
|
+
const { colors } = useTheme();
|
|
34
|
+
const styles = useThemedStyles(makeStyles);
|
|
35
|
+
|
|
36
|
+
const isFilled = checked || indeterminate;
|
|
37
|
+
|
|
38
|
+
const boxStyle = [
|
|
39
|
+
styles.box,
|
|
40
|
+
isFilled && !disabled && styles.boxFilled,
|
|
41
|
+
error && !disabled && styles.boxError,
|
|
42
|
+
disabled && styles.boxDisabled,
|
|
43
|
+
];
|
|
44
|
+
|
|
45
|
+
const iconColor = disabled ? colors.fg_neutral_faded : colors.fg_primary_on_background;
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<TouchableOpacity
|
|
49
|
+
accessibilityRole="checkbox"
|
|
50
|
+
accessibilityState={{ checked: indeterminate ? 'mixed' : checked, disabled }}
|
|
51
|
+
accessibilityLabel={accessibilityLabel ?? label}
|
|
52
|
+
activeOpacity={0.7}
|
|
53
|
+
disabled={disabled}
|
|
54
|
+
onPress={() => onChange?.(!checked)}
|
|
55
|
+
style={[styles.row, style]}
|
|
56
|
+
>
|
|
57
|
+
<View style={boxStyle}>
|
|
58
|
+
{indeterminate ? (
|
|
59
|
+
<View style={[styles.dash, { backgroundColor: iconColor }]} />
|
|
60
|
+
) : checked ? (
|
|
61
|
+
<IconCheck width={horizontalScale(12)} height={horizontalScale(12)} color={iconColor} />
|
|
62
|
+
) : null}
|
|
63
|
+
</View>
|
|
64
|
+
|
|
65
|
+
{(label || caption) && (
|
|
66
|
+
<View style={styles.texts}>
|
|
67
|
+
{label ? <Text style={[styles.label, disabled && styles.textDisabled]}>{label}</Text> : null}
|
|
68
|
+
{caption ? <Text style={styles.caption}>{caption}</Text> : null}
|
|
69
|
+
</View>
|
|
70
|
+
)}
|
|
71
|
+
</TouchableOpacity>
|
|
72
|
+
);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export default Checkbox;
|
|
76
|
+
|
|
77
|
+
const makeStyles = (c: ThemeColors) =>
|
|
78
|
+
StyleSheet.create({
|
|
79
|
+
row: {
|
|
80
|
+
flexDirection: 'row',
|
|
81
|
+
alignItems: 'flex-start',
|
|
82
|
+
gap: Spacing.spacing_s_nudge, // 6
|
|
83
|
+
},
|
|
84
|
+
box: {
|
|
85
|
+
width: BOX,
|
|
86
|
+
height: BOX,
|
|
87
|
+
borderRadius: Radius.radius_sm, // 4
|
|
88
|
+
borderWidth: Stroke.stroke_m, // 1.5
|
|
89
|
+
borderColor: c.bd_neutral_normal, // #c6c6c6
|
|
90
|
+
alignItems: 'center',
|
|
91
|
+
justifyContent: 'center',
|
|
92
|
+
},
|
|
93
|
+
boxFilled: {
|
|
94
|
+
backgroundColor: c.bg_primary_normal, // #6927da
|
|
95
|
+
borderColor: c.bd_primary_normal,
|
|
96
|
+
},
|
|
97
|
+
boxError: {
|
|
98
|
+
borderColor: c.bd_danger_normal,
|
|
99
|
+
},
|
|
100
|
+
boxDisabled: {
|
|
101
|
+
backgroundColor: c.bg_elevation_level_2_normal,
|
|
102
|
+
borderColor: c.bd_neutral_faded,
|
|
103
|
+
},
|
|
104
|
+
dash: {
|
|
105
|
+
width: horizontalScale(10),
|
|
106
|
+
height: Stroke.stroke_m,
|
|
107
|
+
borderRadius: Stroke.stroke_m,
|
|
108
|
+
},
|
|
109
|
+
texts: {
|
|
110
|
+
flexShrink: 1,
|
|
111
|
+
},
|
|
112
|
+
label: {
|
|
113
|
+
fontFamily: Font.dmSansMedium,
|
|
114
|
+
fontSize: fontSize(14),
|
|
115
|
+
lineHeight: 20,
|
|
116
|
+
color: c.fg_neutral_normal,
|
|
117
|
+
},
|
|
118
|
+
caption: {
|
|
119
|
+
fontFamily: Font.dmSansRegular,
|
|
120
|
+
fontSize: fontSize(12),
|
|
121
|
+
lineHeight: 18,
|
|
122
|
+
color: c.fg_neutral_faded,
|
|
123
|
+
},
|
|
124
|
+
textDisabled: {
|
|
125
|
+
color: c.fg_neutral_faded,
|
|
126
|
+
},
|
|
127
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
2
|
+
|
|
3
|
+
export type CheckboxState = 'unchecked' | 'checked' | 'indeterminate';
|
|
4
|
+
|
|
5
|
+
export interface CheckboxProps {
|
|
6
|
+
/** Controlled checked value. Use `indeterminate` for the mixed/dash state. */
|
|
7
|
+
checked?: boolean;
|
|
8
|
+
/** Show the indeterminate (dash) state instead of a tick. Overrides `checked` visual. */
|
|
9
|
+
indeterminate?: boolean;
|
|
10
|
+
/** Fire with the next checked value when pressed. */
|
|
11
|
+
onChange?: (checked: boolean) => void;
|
|
12
|
+
/** Primary text next to the box. */
|
|
13
|
+
label?: string;
|
|
14
|
+
/** Secondary text under the label. */
|
|
15
|
+
caption?: string;
|
|
16
|
+
/** Error (validation) visual — red border. */
|
|
17
|
+
error?: boolean;
|
|
18
|
+
/** Disable interaction + faded visual. */
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
/** Override container style. */
|
|
21
|
+
style?: StyleProp<ViewStyle>;
|
|
22
|
+
/** Accessibility label when no visible `label` is provided. */
|
|
23
|
+
accessibilityLabel?: string;
|
|
24
|
+
}
|
package/templates/mobile/rn/src/core/components/ui/collapsible-section/collapsible-section.tsx
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Pressable,
|
|
4
|
+
StyleSheet,
|
|
5
|
+
View,
|
|
6
|
+
LayoutAnimation,
|
|
7
|
+
Platform,
|
|
8
|
+
UIManager,
|
|
9
|
+
} from 'react-native';
|
|
10
|
+
import {
|
|
11
|
+
Font,
|
|
12
|
+
fontSize,
|
|
13
|
+
horizontalScale,
|
|
14
|
+
verticalScale,
|
|
15
|
+
Radius,
|
|
16
|
+
Spacing,
|
|
17
|
+
} from '@src/core/utils';
|
|
18
|
+
import { ThemeColors, useTheme, useThemedStyles } from '@src/core/theme';
|
|
19
|
+
import { IconMinus, IconPlus } from '@src/assets/svgs';
|
|
20
|
+
import { Label } from '../label';
|
|
21
|
+
import { CollapsibleSectionProps } from './collapsible-section.type';
|
|
22
|
+
|
|
23
|
+
if (
|
|
24
|
+
Platform.OS === 'android' &&
|
|
25
|
+
UIManager.setLayoutAnimationEnabledExperimental
|
|
26
|
+
) {
|
|
27
|
+
UIManager.setLayoutAnimationEnabledExperimental(true);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const CollapsibleSection: React.FC<CollapsibleSectionProps> = ({
|
|
31
|
+
title,
|
|
32
|
+
options,
|
|
33
|
+
defaultCollapsed = true,
|
|
34
|
+
}) => {
|
|
35
|
+
const styles = useThemedStyles(makeStyles);
|
|
36
|
+
const { colors } = useTheme();
|
|
37
|
+
const [isCollapsed, setIsCollapsed] = useState(defaultCollapsed);
|
|
38
|
+
|
|
39
|
+
const toggle = () => {
|
|
40
|
+
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
|
|
41
|
+
setIsCollapsed(prev => !prev);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<View style={styles.container}>
|
|
46
|
+
<Pressable
|
|
47
|
+
onPress={toggle}
|
|
48
|
+
style={({ pressed }) => [
|
|
49
|
+
styles.header,
|
|
50
|
+
pressed && styles.headerPressed,
|
|
51
|
+
]}
|
|
52
|
+
hitSlop={{ top: 12, bottom: 12, left: 12, right: 12 }}
|
|
53
|
+
>
|
|
54
|
+
<Label
|
|
55
|
+
value={title}
|
|
56
|
+
style={styles.title}
|
|
57
|
+
fontFamily={Font.rethinkSansSemiBold}
|
|
58
|
+
/>
|
|
59
|
+
<View style={styles.iconContainer}>
|
|
60
|
+
{isCollapsed ? <IconPlus /> : <IconMinus />}
|
|
61
|
+
</View>
|
|
62
|
+
</Pressable>
|
|
63
|
+
{!isCollapsed && options.length > 0 && (
|
|
64
|
+
<View style={styles.content}>
|
|
65
|
+
<View style={styles.divider} />
|
|
66
|
+
<View style={styles.optionsList}>
|
|
67
|
+
{options.map((option) => (
|
|
68
|
+
<View key={`${option.name}-${option.value}`} style={styles.optionRow}>
|
|
69
|
+
<Label
|
|
70
|
+
value={option.name}
|
|
71
|
+
style={styles.optionName}
|
|
72
|
+
color={colors.sub_text}
|
|
73
|
+
/>
|
|
74
|
+
<Label
|
|
75
|
+
value={option.value}
|
|
76
|
+
style={styles.optionValue}
|
|
77
|
+
fontFamily={Font.rethinkSansRegular}
|
|
78
|
+
/>
|
|
79
|
+
</View>
|
|
80
|
+
))}
|
|
81
|
+
</View>
|
|
82
|
+
</View>
|
|
83
|
+
)}
|
|
84
|
+
</View>
|
|
85
|
+
);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export default CollapsibleSection;
|
|
89
|
+
|
|
90
|
+
const makeStyles = (c: ThemeColors) =>
|
|
91
|
+
StyleSheet.create({
|
|
92
|
+
container: {
|
|
93
|
+
backgroundColor: 'rgba(243, 242, 255, 0.5)',
|
|
94
|
+
borderRadius: Radius.radius_xl,
|
|
95
|
+
padding: horizontalScale(Spacing.spacing_md),
|
|
96
|
+
overflow: 'hidden',
|
|
97
|
+
},
|
|
98
|
+
header: {
|
|
99
|
+
flexDirection: 'row',
|
|
100
|
+
alignItems: 'center',
|
|
101
|
+
justifyContent: 'space-between',
|
|
102
|
+
paddingVertical: verticalScale(4),
|
|
103
|
+
},
|
|
104
|
+
headerPressed: {
|
|
105
|
+
opacity: 0.7,
|
|
106
|
+
},
|
|
107
|
+
title: {
|
|
108
|
+
fontSize: fontSize(14),
|
|
109
|
+
color: c.text_primary,
|
|
110
|
+
flex: 1,
|
|
111
|
+
},
|
|
112
|
+
content: {
|
|
113
|
+
gap: verticalScale(Spacing.spacing_sm),
|
|
114
|
+
},
|
|
115
|
+
divider: {
|
|
116
|
+
height: 1,
|
|
117
|
+
backgroundColor: c.bg_page_normal_faded,
|
|
118
|
+
},
|
|
119
|
+
optionsList: {
|
|
120
|
+
gap: verticalScale(Spacing.spacing_sm),
|
|
121
|
+
},
|
|
122
|
+
optionRow: {
|
|
123
|
+
gap: verticalScale(Spacing.spacing_md),
|
|
124
|
+
},
|
|
125
|
+
optionName: {
|
|
126
|
+
fontSize: fontSize(12),
|
|
127
|
+
fontFamily: Font.rethinkSansRegular,
|
|
128
|
+
},
|
|
129
|
+
optionValue: {
|
|
130
|
+
fontSize: fontSize(14),
|
|
131
|
+
color: c.text_primary,
|
|
132
|
+
},
|
|
133
|
+
iconContainer: {
|
|
134
|
+
height: horizontalScale(20),
|
|
135
|
+
width: horizontalScale(20),
|
|
136
|
+
justifyContent: 'center',
|
|
137
|
+
alignItems: 'center',
|
|
138
|
+
backgroundColor: c.bd_primary_faded,
|
|
139
|
+
borderRadius: Radius.radius_sm,
|
|
140
|
+
},
|
|
141
|
+
});
|