@mediacubeco/expo-template-fsd 2.3.1 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/commands/git-commit.md +164 -0
- package/.claude/rules/architecture.md +38 -0
- package/.claude/rules/{prettier-eslint-typescript.mdc → prettier-eslint-typescript.md} +5 -10
- package/.claude/settings.json +2 -2
- package/.claude/skills/api/SKILL.md +362 -0
- package/.claude/skills/api/references/client/overview.md +106 -0
- package/.claude/skills/api/references/hooks/index.ts +3 -0
- package/.claude/skills/api/references/hooks/use-api-health.ts +25 -0
- package/.claude/skills/api/references/hooks/use-api-post.ts +46 -0
- package/.claude/skills/api/references/hooks/use-api-posts.ts +24 -0
- package/.claude/skills/api/references/mock/post.mock.ts +29 -0
- package/.claude/skills/{generate-api-model/references → api/references/model}/entities/common.ts +5 -2
- package/.claude/skills/api/references/model/resources/common.ts +9 -0
- package/.claude/skills/api/references/queries/health.ts +14 -0
- package/.claude/skills/api/references/queries/index.ts +2 -0
- package/.claude/skills/api/references/queries/post.ts +23 -0
- package/.claude/skills/api/references/repository/health/health.ts +11 -0
- package/.claude/skills/api/references/repository/health/health.types.ts +25 -0
- package/.claude/skills/api/references/repository/health/index.ts +2 -0
- package/.claude/skills/api/references/repository/post/index.ts +9 -0
- package/.claude/skills/api/references/repository/post/post.ts +34 -0
- package/.claude/skills/api/references/repository/post/post.types.ts +61 -0
- package/.claude/skills/code-style/SKILL.md +1025 -1
- package/.claude/skills/code-style/references/components/payout-speed-option/index.ts +2 -0
- package/.claude/skills/code-style/references/components/payout-speed-option/payout-speed-option.styles.ts +76 -0
- package/.claude/skills/code-style/references/components/payout-speed-option/payout-speed-option.tsx +58 -0
- package/.claude/skills/code-style/references/components/payout-speed-option/payout-speed-option.types.ts +22 -0
- package/.claude/skills/code-style/references/components/post/index.ts +2 -0
- package/.claude/skills/code-style/references/components/post/post.styles.ts +19 -0
- package/.claude/skills/code-style/references/components/post/post.tsx +21 -0
- package/.claude/skills/code-style/references/components/post/post.types.ts +9 -0
- package/.claude/skills/code-style/references/components/wrap/index.ts +2 -0
- package/.claude/skills/code-style/references/components/wrap/wrap.styles.ts +15 -0
- package/.claude/skills/code-style/references/components/wrap/wrap.tsx +31 -0
- package/.claude/skills/code-style/references/components/wrap/wrap.types.ts +10 -0
- package/.claude/skills/code-style/references/hooks/use-posts.ts +37 -0
- package/.claude/skills/code-style/references/pages/post/index.ts +4 -0
- package/.claude/skills/code-style/references/pages/post/post-details/index.ts +1 -0
- package/.claude/skills/code-style/references/pages/post/post-details/post-details.tsx +13 -0
- package/.claude/skills/code-style/references/pages/post/post-guide/index.ts +1 -0
- package/.claude/skills/code-style/references/pages/post/post-guide/post-guide.tsx +17 -0
- package/.claude/skills/code-style/references/pages/post/post-list/index.ts +1 -0
- package/.claude/skills/code-style/references/pages/post/post-list/post-list.styles.ts +17 -0
- package/.claude/skills/code-style/references/pages/post/post-list/post-list.tsx +25 -0
- package/.claude/skills/code-style/references/pages/post/post-share/index.ts +1 -0
- package/.claude/skills/code-style/references/pages/post/post-share/post-share.tsx +13 -0
- package/.claude/skills/code-style/references/routes/(stack)/_layout.tsx +18 -0
- package/.claude/skills/code-style/references/routes/(stack)/details.tsx +8 -0
- package/.claude/skills/code-style/references/routes/(stack)/guide.tsx +8 -0
- package/.claude/skills/code-style/references/routes/(stack)/index.tsx +8 -0
- package/.claude/skills/code-style/references/routes/(stack)/share.tsx +8 -0
- package/.claude/skills/code-style/references/routes/(tabs)/(post-details)/index.tsx +8 -0
- package/.claude/skills/code-style/references/routes/(tabs)/(post-list)/index.tsx +8 -0
- package/.claude/skills/code-style/references/routes/(tabs)/_layout.tsx +50 -0
- package/.claude/skills/code-style/references/routes/_app.tsx +20 -0
- package/.claude/skills/code-style/references/routes/guide.tsx +8 -0
- package/.claude/skills/code-style/references/routes/share.tsx +8 -0
- package/.claude/skills/code-style/references/store/use-post-draft-store.ts +62 -0
- package/.claude/skills/design-style/SKILL.md +320 -0
- package/.env +3 -1
- package/.env.example +3 -1
- package/CLAUDE.md +5 -11
- package/app.json +6 -3
- package/axios.d.ts +5 -0
- package/env.d.ts +3 -1
- package/package.json +33 -40
- package/patches/react-native-screens+4.25.2.patch +118 -0
- package/react-query.d.ts +13 -0
- package/src/app/(root)/(home)/_layout.tsx +2 -2
- package/src/app/(root)/(home)/index.tsx +2 -2
- package/src/app/(root)/(settings)/_layout.tsx +2 -2
- package/src/app/(root)/(settings)/index.tsx +2 -2
- package/src/app/(root)/_layout.tsx +35 -32
- package/src/pages/home/home-main.tsx +3 -7
- package/src/pages/settings/settings-main.tsx +3 -7
- package/src/shared/assets/fonts/index.ts +3 -3
- package/src/shared/assets/fonts/sf-pro-text-bold.ttf +0 -0
- package/src/shared/assets/fonts/sf-pro-text-regular.ttf +0 -0
- package/src/shared/assets/fonts/sf-pro-text-semibold.ttf +0 -0
- package/src/shared/assets/icons/back.tsx +21 -0
- package/src/shared/assets/icons/close.tsx +21 -0
- package/src/shared/assets/icons/common.ts +8 -0
- package/src/shared/assets/icons/default.tsx +44 -0
- package/src/shared/assets/icons/index.ts +13 -1
- package/src/shared/assets/icons/refresh.tsx +23 -0
- package/src/shared/assets/icons/share.tsx +38 -0
- package/src/shared/assets/icons/type.ts +7 -0
- package/src/shared/assets/translations/index.ts +4 -4
- package/src/shared/constants/config.ts +13 -0
- package/src/shared/constants/environment.ts +16 -4
- package/src/shared/constants/index.ts +1 -0
- package/src/shared/hooks/index.ts +1 -4
- package/src/shared/hooks/use-compose.ts +23 -0
- package/src/shared/lib/api/api.client.ts +157 -0
- package/src/shared/lib/api/api.provider.tsx +14 -36
- package/src/shared/lib/api/api.ts +1 -5
- package/src/shared/lib/api/api.types.ts +6 -3
- package/src/shared/lib/api/hooks/index.ts +1 -0
- package/src/shared/lib/api/index.ts +2 -3
- package/src/shared/lib/api/models/api-instance/api-instance.client.ts +50 -0
- package/src/shared/lib/api/models/api-instance/api-instance.ts +30 -82
- package/src/shared/lib/api/models/api-instance/api-instance.types.ts +16 -18
- package/src/shared/lib/api/models/api-instance/api-instance.utils.ts +13 -20
- package/src/shared/lib/api/models/api-instance/index.ts +3 -0
- package/src/shared/lib/api/queries/index.ts +1 -0
- package/src/shared/lib/api/repositories/index.ts +1 -1
- package/src/shared/lib/localization/constants/index.ts +16 -5
- package/src/shared/lib/localization/index.ts +5 -1
- package/src/shared/lib/navigation/hooks/index.ts +8 -3
- package/src/shared/{hooks/use-breakpoints.ts → lib/navigation/hooks/use-navigation-breakpoints.ts} +2 -5
- package/src/shared/lib/navigation/hooks/use-navigation-dimensions.ts +12 -0
- package/src/shared/lib/navigation/hooks/use-navigation-options.tsx +175 -0
- package/src/shared/lib/navigation/hooks/{use-navigation.ts → use-navigation-route.ts} +2 -2
- package/src/shared/lib/navigation/hooks/use-navigation-safe-area.ts +61 -0
- package/src/shared/lib/navigation/hooks/use-navigation-tabs-native.ts +10 -0
- package/src/shared/lib/navigation/hooks/use-navigation-tabs.tsx +10 -0
- package/src/shared/lib/navigation/hooks/use-navigation-transition.ts +27 -0
- package/src/shared/lib/navigation/index.ts +11 -4
- package/src/shared/lib/navigation/navigation-tabs-native.context.tsx +5 -0
- package/src/shared/lib/navigation/navigation-tabs-native.provider.tsx +17 -0
- package/src/shared/lib/navigation/navigation-tabs.context.tsx +10 -0
- package/src/shared/lib/navigation/navigation-tabs.provider.tsx +22 -0
- package/src/shared/lib/navigation/navigation.provider.tsx +6 -1
- package/src/shared/lib/storage/index.ts +1 -1
- package/src/shared/lib/storage/storage.provider.tsx +4 -0
- package/src/shared/lib/storage/storage.ts +29 -25
- package/src/shared/lib/theme/constants/animations.ts +26 -0
- package/src/shared/lib/theme/constants/colors.ts +336 -43
- package/src/shared/lib/theme/constants/delays.ts +1 -1
- package/src/shared/lib/theme/constants/durations.ts +1 -1
- package/src/shared/lib/theme/constants/fonts.ts +2 -1
- package/src/shared/lib/theme/constants/index.ts +42 -20
- package/src/shared/lib/theme/constants/shadows.ts +7 -25
- package/src/shared/lib/theme/constants/sizes.ts +11 -2
- package/src/shared/lib/theme/constants/transparencies.ts +1 -1
- package/src/shared/lib/theme/hooks/use-theme-setup.ts +3 -1
- package/src/shared/lib/theme/index.ts +10 -1
- package/src/shared/lib/theme/theme.provider.tsx +45 -19
- package/src/shared/lib/theme/theme.scope.tsx +43 -0
- package/src/shared/lib/theme/theme.types.ts +15 -3
- package/src/shared/lib/theme/utils/color.ts +81 -0
- package/src/shared/lib/theme/utils/index.ts +2 -0
- package/src/shared/lib/theme/utils/snapshot.ts +17 -0
- package/src/shared/lib/theme/utils/storage.ts +5 -2
- package/src/shared/services/browser/browser.ts +66 -0
- package/src/shared/services/browser/index.ts +1 -0
- package/src/shared/services/cookies/cookies.ts +73 -0
- package/src/shared/services/cookies/index.ts +1 -0
- package/src/shared/services/index.ts +5 -0
- package/src/shared/services/linking/index.ts +1 -0
- package/src/shared/services/linking/linking.ts +22 -0
- package/src/shared/services/share/index.ts +1 -0
- package/src/shared/services/share/share.ts +28 -0
- package/src/shared/services/universal-links/index.ts +104 -0
- package/src/shared/services/universal-links/universal-links.ts +25 -0
- package/src/shared/services/universal-links/universal-links.types.ts +5 -0
- package/src/shared/ui/atoms/blur/blur.tsx +9 -4
- package/src/shared/ui/atoms/blur/blur.types.ts +1 -1
- package/src/shared/ui/atoms/blur-progress/blur-progress.styles.ts +16 -0
- package/src/shared/ui/atoms/blur-progress/blur-progress.tsx +30 -0
- package/src/shared/ui/atoms/blur-progress/blur-progress.types.tsx +5 -0
- package/src/shared/ui/atoms/blur-progress/index.ts +1 -0
- package/src/shared/ui/atoms/glass/glass.tsx +13 -5
- package/src/shared/ui/atoms/glass/glass.types.ts +1 -1
- package/src/shared/ui/atoms/icon/icon.styles.ts +82 -0
- package/src/shared/ui/atoms/icon/icon.tsx +21 -0
- package/src/shared/ui/atoms/icon/icon.types.ts +23 -0
- package/src/shared/ui/atoms/icon/index.ts +2 -0
- package/src/shared/ui/atoms/index.ts +7 -0
- package/src/shared/ui/atoms/skeleton/index.ts +2 -0
- package/src/shared/ui/atoms/skeleton/skeleton.styles.ts +69 -0
- package/src/shared/ui/atoms/skeleton/skeleton.tsx +26 -0
- package/src/shared/ui/atoms/skeleton/skeleton.types.ts +9 -0
- package/src/shared/ui/atoms/spinner/index.ts +2 -0
- package/src/shared/ui/atoms/spinner/spinner.styles.ts +102 -0
- package/src/shared/ui/atoms/spinner/spinner.tsx +48 -0
- package/src/shared/ui/atoms/spinner/spinner.types.ts +25 -0
- package/src/shared/ui/atoms/text/index.ts +2 -0
- package/src/shared/ui/atoms/text/text.styles.ts +186 -0
- package/src/shared/ui/atoms/text/text.tsx +37 -0
- package/src/shared/ui/atoms/text/text.types.ts +35 -0
- package/src/shared/ui/atoms/touch/components/haptics/haptics.styles.ts +21 -0
- package/src/shared/ui/atoms/touch/components/haptics/haptics.tsx +28 -0
- package/src/shared/ui/atoms/touch/components/haptics/haptics.types.ts +17 -0
- package/src/shared/ui/atoms/touch/components/haptics/index.ts +2 -0
- package/src/shared/ui/atoms/touch/components/index.ts +3 -0
- package/src/shared/ui/atoms/touch/components/ripple/index.ts +2 -0
- package/src/shared/ui/atoms/touch/components/ripple/ripple.styles.ts +78 -0
- package/src/shared/ui/atoms/touch/components/ripple/ripple.tsx +29 -0
- package/src/shared/ui/atoms/touch/components/ripple/ripple.types.ts +17 -0
- package/src/shared/ui/atoms/touch/components/spring/index.ts +2 -0
- package/src/shared/ui/atoms/touch/components/spring/spring.styles.ts +31 -0
- package/src/shared/ui/atoms/touch/components/spring/spring.tsx +28 -0
- package/src/shared/ui/atoms/touch/components/spring/spring.types.ts +17 -0
- package/src/shared/ui/atoms/touch/index.ts +2 -0
- package/src/shared/ui/atoms/touch/touch.styles.ts +14 -0
- package/src/shared/ui/atoms/touch/touch.tsx +137 -0
- package/src/shared/ui/atoms/touch/touch.types.ts +27 -0
- package/src/shared/ui/atoms/visibility/index.ts +2 -0
- package/src/shared/ui/atoms/visibility/visibility.styles.ts +85 -0
- package/src/shared/ui/atoms/visibility/visibility.tsx +61 -0
- package/src/shared/ui/atoms/visibility/visibility.types.ts +34 -0
- package/src/shared/ui/molecules/keyboard-area/keyboard-area.styles.ts +11 -9
- package/src/shared/ui/molecules/keyboard-area/keyboard-area.tsx +3 -6
- package/src/shared/ui/molecules/refresh-control/refresh-control.tsx +3 -5
- package/src/shared/ui/molecules/refresh-control/refresh-control.types.ts +1 -1
- package/src/shared/ui/molecules/slider/components/indicator/components/dot/dot.styles.ts +41 -0
- package/src/shared/ui/molecules/slider/components/indicator/components/dot/dot.tsx +12 -0
- package/src/shared/ui/molecules/slider/components/indicator/components/dot/dot.types.ts +13 -0
- package/src/shared/ui/molecules/slider/components/indicator/components/dot/index.ts +2 -0
- package/src/shared/ui/molecules/slider/components/indicator/index.ts +2 -0
- package/src/shared/ui/molecules/slider/components/indicator/indicator.styles.ts +20 -0
- package/src/shared/ui/molecules/slider/components/indicator/indicator.tsx +22 -0
- package/src/shared/ui/molecules/slider/components/indicator/indicator.types.ts +10 -0
- package/src/shared/ui/molecules/slider/index.ts +3 -0
- package/src/shared/ui/molecules/slider/slider.styles.ts +68 -0
- package/src/shared/ui/molecules/slider/slider.tsx +64 -0
- package/src/shared/ui/molecules/slider/slider.types.ts +28 -0
- package/src/shared/ui/organisms/bar/bar.styles.ts +100 -0
- package/src/shared/ui/organisms/bar/bar.tsx +89 -0
- package/src/shared/ui/organisms/bar/bar.types.ts +49 -0
- package/src/shared/ui/organisms/bar/index.ts +2 -0
- package/src/shared/ui/organisms/bar-tab/bar-tab.tsx +9 -0
- package/src/shared/ui/organisms/bar-tab/bar-tab.types.ts +5 -0
- package/src/shared/ui/organisms/bar-tab/components/index.ts +1 -0
- package/src/shared/ui/organisms/bar-tab/components/tab/index.ts +2 -0
- package/src/shared/ui/organisms/bar-tab/components/tab/tab.styles.ts +21 -0
- package/src/shared/ui/organisms/bar-tab/components/tab/tab.tsx +18 -0
- package/src/shared/ui/organisms/bar-tab/components/tab/tab.types.ts +5 -0
- package/src/shared/ui/organisms/bar-tab/index.ts +2 -0
- package/src/shared/ui/organisms/bar-tab-navigation/bar-tab-navigation.styles.ts +22 -0
- package/src/shared/ui/organisms/bar-tab-navigation/bar-tab-navigation.tsx +66 -0
- package/src/shared/ui/organisms/bar-tab-navigation/bar-tab-navigation.types.ts +5 -0
- package/src/shared/ui/organisms/bar-tab-navigation/components/index.ts +1 -0
- package/src/shared/ui/organisms/bar-tab-navigation/components/tab-navigation/index.ts +2 -0
- package/src/shared/ui/organisms/bar-tab-navigation/components/tab-navigation/tab-navigation.styles.ts +56 -0
- package/src/shared/ui/organisms/bar-tab-navigation/components/tab-navigation/tab-navigation.tsx +30 -0
- package/src/shared/ui/organisms/bar-tab-navigation/components/tab-navigation/tab-navigation.types.ts +7 -0
- package/src/shared/ui/organisms/bar-tab-navigation/index.ts +2 -0
- package/src/shared/ui/organisms/index.ts +4 -1
- package/src/shared/ui/organisms/slider/components/indicator/components/dot/dot.styles.ts +41 -0
- package/src/shared/ui/organisms/slider/components/indicator/components/dot/dot.tsx +12 -0
- package/src/shared/ui/organisms/slider/components/indicator/components/dot/dot.types.ts +13 -0
- package/src/shared/ui/organisms/slider/components/indicator/components/dot/index.ts +2 -0
- package/src/shared/ui/organisms/slider/components/indicator/index.ts +2 -0
- package/src/shared/ui/organisms/slider/components/indicator/indicator.styles.ts +20 -0
- package/src/shared/ui/organisms/slider/components/indicator/indicator.tsx +22 -0
- package/src/shared/ui/organisms/slider/components/indicator/indicator.types.ts +10 -0
- package/src/shared/ui/organisms/slider/index.ts +3 -0
- package/src/shared/ui/organisms/slider/slider.styles.ts +68 -0
- package/src/shared/ui/organisms/slider/slider.tsx +64 -0
- package/src/shared/ui/organisms/slider/slider.types.ts +28 -0
- package/src/shared/ui/templates/index.ts +3 -0
- package/src/shared/ui/templates/modal-container/index.ts +13 -0
- package/src/shared/ui/templates/modal-container/modal-container-list.tsx +45 -0
- package/src/shared/ui/templates/modal-container/modal-container-scroll.tsx +66 -0
- package/src/shared/ui/templates/modal-container/modal-container-section-list.tsx +46 -0
- package/src/shared/ui/templates/modal-container/modal-container.hooks.tsx +172 -0
- package/src/shared/ui/templates/modal-container/modal-container.styles.ts +121 -0
- package/src/shared/ui/templates/modal-container/modal-container.types.ts +69 -0
- package/src/shared/ui/templates/screen-container/index.ts +1 -1
- package/src/shared/ui/templates/screen-container/screen-container-list.tsx +28 -10
- package/src/shared/ui/templates/screen-container/screen-container-scroll.tsx +28 -10
- package/src/shared/ui/templates/screen-container/screen-container-section-list.tsx +29 -11
- package/src/shared/ui/templates/screen-container/screen-container.hooks.tsx +79 -8
- package/src/shared/ui/templates/screen-container/screen-container.styles.ts +105 -15
- package/src/shared/ui/templates/screen-container/screen-container.types.tsx +34 -7
- package/src/shared/ui/templates/screen-header/components/index.ts +6 -0
- package/src/shared/ui/templates/screen-header/components/screen-header-description/index.ts +2 -0
- package/src/shared/ui/templates/screen-header/components/screen-header-description/screen-header-description.tsx +15 -0
- package/src/shared/ui/templates/screen-header/components/screen-header-description/screen-header-description.types.ts +11 -0
- package/src/shared/ui/templates/screen-header/components/screen-header-icon/index.ts +2 -0
- package/src/shared/ui/templates/screen-header/components/screen-header-icon/screen-header-icon.styles.ts +44 -0
- package/src/shared/ui/templates/screen-header/components/screen-header-icon/screen-header-icon.tsx +65 -0
- package/src/shared/ui/templates/screen-header/components/screen-header-icon/screen-header-icon.types.ts +14 -0
- package/src/shared/ui/templates/screen-header/components/screen-header-icon-back/index.ts +2 -0
- package/src/shared/ui/templates/screen-header/components/screen-header-icon-back/screen-header-icon-back.tsx +17 -0
- package/src/shared/ui/templates/screen-header/components/screen-header-icon-back/screen-header-icon-back.types.ts +6 -0
- package/src/shared/ui/templates/screen-header/components/screen-header-icon-close/index.ts +2 -0
- package/src/shared/ui/templates/screen-header/components/screen-header-icon-close/screen-header-icon-close.tsx +27 -0
- package/src/shared/ui/templates/screen-header/components/screen-header-icon-close/screen-header-icon-close.types.ts +10 -0
- package/src/shared/ui/templates/screen-header/components/screen-header-info/index.ts +2 -0
- package/src/shared/ui/templates/screen-header/components/screen-header-info/screen-header-info.tsx +15 -0
- package/src/shared/ui/templates/screen-header/components/screen-header-info/screen-header-info.types.ts +10 -0
- package/src/shared/ui/templates/screen-header/components/screen-header-title/index.ts +2 -0
- package/src/shared/ui/templates/screen-header/components/screen-header-title/screen-header-title.tsx +19 -0
- package/src/shared/ui/templates/screen-header/components/screen-header-title/screen-header-title.types.ts +13 -0
- package/src/shared/ui/templates/screen-header/index.ts +3 -0
- package/src/shared/ui/templates/screen-header/screen-header.styles.ts +49 -0
- package/src/shared/ui/templates/screen-header/screen-header.tsx +26 -0
- package/src/shared/ui/templates/screen-header/screen-header.types.ts +15 -0
- package/src/shared/ui/templates/web-container/index.ts +2 -0
- package/src/shared/ui/templates/web-container/web-container.styles.ts +34 -0
- package/src/shared/ui/templates/web-container/web-container.tsx +172 -0
- package/src/shared/ui/templates/web-container/web-container.types.ts +21 -0
- package/.claude/rules/app-routing.mdc +0 -47
- package/.claude/rules/exports-at-end.mdc +0 -55
- package/.claude/rules/kebab-case-naming.mdc +0 -29
- package/.claude/rules/mediacubeco-packages.mdc +0 -56
- package/.claude/skills/generate-api-model/SKILL.md +0 -230
- package/.claude/skills/generate-api-model/references/resources/common.ts +0 -8
- package/.claude/skills/generate-api-model-mock/SKILL.md +0 -56
- package/.claude/skills/git-commit/SKILL.md +0 -139
- package/.gitignore +0 -34
- package/src/shared/assets/icons/like.tsx +0 -17
- package/src/shared/hooks/use-animated.ts +0 -200
- package/src/shared/hooks/use-mixins.ts +0 -36
- package/src/shared/hooks/use-safe-area.ts +0 -75
- package/src/shared/lib/api/repositories/auth/auth.ts +0 -23
- package/src/shared/lib/api/repositories/auth/auth.types.ts +0 -22
- package/src/shared/lib/api/repositories/auth/index.ts +0 -1
- package/src/shared/lib/navigation/hooks/use-navigation-native-tabs.ts +0 -10
- package/src/shared/lib/navigation/hooks/use-navigation-options.ts +0 -123
- package/src/shared/lib/navigation/navigation-native-tabs.context.tsx +0 -5
- package/src/shared/lib/navigation/navigation-native-tabs.provider.tsx +0 -12
- package/src/shared/lib/theme/constants/borders.ts +0 -8
- package/src/shared/lib/theme/constants/weights.ts +0 -13
- /package/.claude/skills/{generate-api-model/references → api/references/model}/entities/index.ts +0 -0
- /package/.claude/skills/{generate-api-model/references → api/references/model}/entities/post/index.ts +0 -0
- /package/.claude/skills/{generate-api-model/references → api/references/model}/entities/post/post-comment.ts +0 -0
- /package/.claude/skills/{generate-api-model/references → api/references/model}/entities/post/post.ts +0 -0
- /package/.claude/skills/{generate-api-model/references → api/references/model}/entities/user/index.ts +0 -0
- /package/.claude/skills/{generate-api-model/references → api/references/model}/entities/user/user-settings.ts +0 -0
- /package/.claude/skills/{generate-api-model/references → api/references/model}/entities/user/user-verification.ts +0 -0
- /package/.claude/skills/{generate-api-model/references → api/references/model}/entities/user/user.ts +0 -0
- /package/.claude/skills/{generate-api-model/references → api/references/model}/resources/index.ts +0 -0
- /package/.claude/skills/{generate-api-model/references → api/references/model}/resources/post/index.ts +0 -0
- /package/.claude/skills/{generate-api-model/references → api/references/model}/resources/post/post-comment.ts +0 -0
- /package/.claude/skills/{generate-api-model/references → api/references/model}/resources/post/post.ts +0 -0
- /package/.claude/skills/{generate-api-model/references → api/references/model}/resources/user/index.ts +0 -0
- /package/.claude/skills/{generate-api-model/references → api/references/model}/resources/user/user-settings.ts +0 -0
- /package/.claude/skills/{generate-api-model/references → api/references/model}/resources/user/user-verification.ts +0 -0
- /package/.claude/skills/{generate-api-model/references → api/references/model}/resources/user/user.ts +0 -0
|
@@ -3,24 +3,29 @@ import { BlurView } from 'expo-blur'
|
|
|
3
3
|
import { type BlurProps } from './blur.types'
|
|
4
4
|
|
|
5
5
|
const Blur = ({
|
|
6
|
-
|
|
6
|
+
style,
|
|
7
|
+
ref,
|
|
8
|
+
children,
|
|
7
9
|
blurTarget,
|
|
8
10
|
tint,
|
|
9
|
-
intensity,
|
|
11
|
+
intensity = 20,
|
|
10
12
|
blurReductionFactor,
|
|
11
13
|
blurMethod,
|
|
12
14
|
...props
|
|
13
15
|
}: BlurProps) => {
|
|
14
16
|
return (
|
|
15
17
|
<BlurView
|
|
16
|
-
ref={
|
|
18
|
+
ref={ref as Ref<BlurView>}
|
|
19
|
+
style={[style]}
|
|
17
20
|
blurTarget={blurTarget}
|
|
18
21
|
tint={tint}
|
|
19
22
|
intensity={intensity}
|
|
20
23
|
blurReductionFactor={blurReductionFactor}
|
|
21
24
|
blurMethod={blurMethod}
|
|
22
25
|
{...props}
|
|
23
|
-
|
|
26
|
+
>
|
|
27
|
+
{children}
|
|
28
|
+
</BlurView>
|
|
24
29
|
)
|
|
25
30
|
}
|
|
26
31
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native'
|
|
2
|
+
import { useThemeSetup } from '../../../lib'
|
|
3
|
+
|
|
4
|
+
const useBlurProgressStyles = () => {
|
|
5
|
+
const { themeModeSystem } = useThemeSetup()
|
|
6
|
+
|
|
7
|
+
const styles = StyleSheet.create({
|
|
8
|
+
wrapper: {
|
|
9
|
+
flex: 1,
|
|
10
|
+
},
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
return { styles, themeModeSystem }
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { useBlurProgressStyles }
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Platform } from '@mediacubeco/base-react-native/helpers'
|
|
2
|
+
import { ProgressiveBlurView } from '@sbaiahmed1/react-native-blur'
|
|
3
|
+
import { useBlurProgressStyles } from './blur-progress.styles'
|
|
4
|
+
import { type BlurProgressProps } from './blur-progress.types'
|
|
5
|
+
|
|
6
|
+
const BlurProgress = ({
|
|
7
|
+
style,
|
|
8
|
+
children,
|
|
9
|
+
blurAmount = Platform.isAndroid ? 100 : 5,
|
|
10
|
+
blurRounds = 15,
|
|
11
|
+
startOffset = 0,
|
|
12
|
+
direction = 'blurredBottomClearTop',
|
|
13
|
+
}: BlurProgressProps) => {
|
|
14
|
+
const { styles, themeModeSystem } = useBlurProgressStyles()
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<ProgressiveBlurView
|
|
18
|
+
style={[styles.wrapper, style]}
|
|
19
|
+
blurType={themeModeSystem}
|
|
20
|
+
blurAmount={blurAmount}
|
|
21
|
+
blurRounds={blurRounds}
|
|
22
|
+
startOffset={startOffset}
|
|
23
|
+
direction={direction}
|
|
24
|
+
>
|
|
25
|
+
{children}
|
|
26
|
+
</ProgressiveBlurView>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default BlurProgress
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as BlurProgress } from './blur-progress'
|
|
@@ -3,8 +3,10 @@ import { Blur } from '../blur'
|
|
|
3
3
|
import { type GlassProps } from './glass.types'
|
|
4
4
|
|
|
5
5
|
const Glass = ({
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
style,
|
|
7
|
+
ref,
|
|
8
|
+
children,
|
|
9
|
+
glassEffectStyle = 'regular',
|
|
8
10
|
tintColor,
|
|
9
11
|
colorScheme,
|
|
10
12
|
isInteractive = true,
|
|
@@ -12,15 +14,21 @@ const Glass = ({
|
|
|
12
14
|
}: GlassProps) => {
|
|
13
15
|
return isGlassEffectAPIAvailable() ? (
|
|
14
16
|
<GlassView
|
|
15
|
-
ref={
|
|
17
|
+
ref={ref}
|
|
18
|
+
style={style}
|
|
16
19
|
glassEffectStyle={glassEffectStyle}
|
|
17
20
|
tintColor={tintColor}
|
|
18
21
|
colorScheme={colorScheme}
|
|
19
22
|
isInteractive={isInteractive}
|
|
20
23
|
{...props}
|
|
21
|
-
|
|
24
|
+
>
|
|
25
|
+
{children}
|
|
26
|
+
</GlassView>
|
|
22
27
|
) : (
|
|
23
|
-
<Blur
|
|
28
|
+
<Blur ref={ref} style={style} {...props}>
|
|
29
|
+
{children}
|
|
30
|
+
</Blur>
|
|
24
31
|
)
|
|
25
32
|
}
|
|
33
|
+
|
|
26
34
|
export default Glass
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native'
|
|
2
|
+
import { useThemeMode } from '../../../lib'
|
|
3
|
+
|
|
4
|
+
const useIconStyles = () => {
|
|
5
|
+
const { COLORS, SIZES } = useThemeMode()
|
|
6
|
+
|
|
7
|
+
const styles = StyleSheet.create({
|
|
8
|
+
icon: {},
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
const stylesByVariant = StyleSheet.create({
|
|
12
|
+
base: {
|
|
13
|
+
color: COLORS.TYPOGRAPHY.BASE,
|
|
14
|
+
},
|
|
15
|
+
secondary: {
|
|
16
|
+
color: COLORS.TYPOGRAPHY.SECONDARY,
|
|
17
|
+
},
|
|
18
|
+
disabled: {
|
|
19
|
+
color: COLORS.TYPOGRAPHY.DISABLED,
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
transparent: {
|
|
23
|
+
color: COLORS.TYPOGRAPHY.TRANSPARENT,
|
|
24
|
+
},
|
|
25
|
+
matter: {
|
|
26
|
+
color: COLORS.TYPOGRAPHY.MATTER,
|
|
27
|
+
},
|
|
28
|
+
contrast: {
|
|
29
|
+
color: COLORS.TYPOGRAPHY.CONTRAST,
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
primary: {
|
|
33
|
+
color: COLORS.TYPOGRAPHY.PRIMARY,
|
|
34
|
+
},
|
|
35
|
+
info: {
|
|
36
|
+
color: COLORS.TYPOGRAPHY.INFO,
|
|
37
|
+
},
|
|
38
|
+
success: {
|
|
39
|
+
color: COLORS.TYPOGRAPHY.SUCCESS,
|
|
40
|
+
},
|
|
41
|
+
warning: {
|
|
42
|
+
color: COLORS.TYPOGRAPHY.WARNING,
|
|
43
|
+
},
|
|
44
|
+
danger: {
|
|
45
|
+
color: COLORS.TYPOGRAPHY.DANGER,
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
neutral: {
|
|
49
|
+
color: COLORS.TYPOGRAPHY.NEUTRAL,
|
|
50
|
+
},
|
|
51
|
+
outline: {
|
|
52
|
+
color: COLORS.TYPOGRAPHY.OUTLINE,
|
|
53
|
+
},
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
const stylesBySize = StyleSheet.create({
|
|
57
|
+
xl: {
|
|
58
|
+
width: SIZES['12XL'],
|
|
59
|
+
height: SIZES['12XL'],
|
|
60
|
+
},
|
|
61
|
+
l: {
|
|
62
|
+
width: SIZES['6XL'],
|
|
63
|
+
height: SIZES['6XL'],
|
|
64
|
+
},
|
|
65
|
+
m: {
|
|
66
|
+
width: SIZES['4XL'],
|
|
67
|
+
height: SIZES['4XL'],
|
|
68
|
+
},
|
|
69
|
+
s: {
|
|
70
|
+
width: SIZES['3XL'],
|
|
71
|
+
height: SIZES['3XL'],
|
|
72
|
+
},
|
|
73
|
+
xs: {
|
|
74
|
+
width: SIZES['2XL'],
|
|
75
|
+
height: SIZES['2XL'],
|
|
76
|
+
},
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
return { styles, stylesByVariant, stylesBySize }
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export { useIconStyles }
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ICONS } from '../../../assets'
|
|
2
|
+
import { useIconStyles } from './icon.styles'
|
|
3
|
+
import { type IconProps } from './icon.types'
|
|
4
|
+
|
|
5
|
+
const Icon = ({ ref, style, name, variant = 'base', size = 'm', svgAnimatedProps }: IconProps) => {
|
|
6
|
+
const { styles, stylesByVariant, stylesBySize } = useIconStyles()
|
|
7
|
+
|
|
8
|
+
const SvgIcon = ICONS[name] || ICONS.default
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<SvgIcon
|
|
12
|
+
ref={ref}
|
|
13
|
+
style={[styles.icon, style]}
|
|
14
|
+
size={stylesBySize[size].width}
|
|
15
|
+
color={stylesByVariant[variant].color}
|
|
16
|
+
animatedProps={svgAnimatedProps}
|
|
17
|
+
/>
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export default Icon
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type KeyOf, type SizeRange } from '@mediacubeco/base/types'
|
|
2
|
+
import { type ICONS, type IconProps as SvgIconProps } from '../../../assets'
|
|
3
|
+
import { type COLOR_BY_VARIANT } from '../../../lib'
|
|
4
|
+
|
|
5
|
+
type IconProps = {
|
|
6
|
+
ref?: SvgIconProps['ref']
|
|
7
|
+
style?: SvgIconProps['style']
|
|
8
|
+
name: keyof typeof ICONS
|
|
9
|
+
variant?: KeyOf<typeof COLOR_BY_VARIANT>
|
|
10
|
+
/**
|
|
11
|
+
* @default 'm'
|
|
12
|
+
*
|
|
13
|
+
* @prop 'xs' - 16
|
|
14
|
+
* @prop 's' - 20
|
|
15
|
+
* @prop 'm' - 24
|
|
16
|
+
* @prop 'l' - 32
|
|
17
|
+
* @prop 'xl' - 56
|
|
18
|
+
**/
|
|
19
|
+
size?: SizeRange<1, 1>
|
|
20
|
+
svgAnimatedProps?: SvgIconProps['animatedProps']
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export type { IconProps }
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { DEFAULT_LAYOUT, useLayout } from '@mediacubeco/base-react-native/hooks'
|
|
2
|
+
import { useEffect, useState } from 'react'
|
|
3
|
+
import { StyleSheet } from 'react-native'
|
|
4
|
+
import {
|
|
5
|
+
cancelAnimation,
|
|
6
|
+
useAnimatedStyle,
|
|
7
|
+
useSharedValue,
|
|
8
|
+
withRepeat,
|
|
9
|
+
withTiming,
|
|
10
|
+
} from 'react-native-reanimated'
|
|
11
|
+
import { useThemeMode } from '../../../lib'
|
|
12
|
+
|
|
13
|
+
/** Стили плашки-плейсхолдера и бесконечный проезд светового блика по её ширине. */
|
|
14
|
+
const useSkeletonStyles = () => {
|
|
15
|
+
const [{ width }, setLayout] = useState(DEFAULT_LAYOUT)
|
|
16
|
+
const translate = useSharedValue(0)
|
|
17
|
+
const { COLORS, SIZES, ANIMATIONS } = useThemeMode()
|
|
18
|
+
|
|
19
|
+
const handleLayout = useLayout({ setLayout: setLayout })
|
|
20
|
+
|
|
21
|
+
/** Стопы блика: прозрачные края и светлый центр — даёт мягкий световой проезд. */
|
|
22
|
+
const shimmerColorList = [
|
|
23
|
+
COLORS.FILL.TRANSPARENT,
|
|
24
|
+
COLORS.FILL.CONTRAST_HALF,
|
|
25
|
+
COLORS.FILL.TRANSPARENT,
|
|
26
|
+
] as const
|
|
27
|
+
|
|
28
|
+
const styles = StyleSheet.create({
|
|
29
|
+
container: {
|
|
30
|
+
overflow: 'hidden',
|
|
31
|
+
height: SIZES['2XL'],
|
|
32
|
+
borderRadius: SIZES['L'],
|
|
33
|
+
backgroundColor: COLORS.FILL.BASE,
|
|
34
|
+
},
|
|
35
|
+
shimmer: {
|
|
36
|
+
position: 'absolute',
|
|
37
|
+
top: 0,
|
|
38
|
+
right: 0,
|
|
39
|
+
bottom: 0,
|
|
40
|
+
left: 0,
|
|
41
|
+
},
|
|
42
|
+
gradient: {
|
|
43
|
+
flex: 1,
|
|
44
|
+
},
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
const animatedStyles = {
|
|
48
|
+
shimmer: useAnimatedStyle(() => {
|
|
49
|
+
return {
|
|
50
|
+
transform: [{ translateX: translate.value }],
|
|
51
|
+
}
|
|
52
|
+
}),
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
if (width === 0) {
|
|
57
|
+
return
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
translate.set(-width)
|
|
61
|
+
translate.set(withRepeat(withTiming(width, ANIMATIONS.TIMING.LONG), -1))
|
|
62
|
+
|
|
63
|
+
return () => cancelAnimation(translate)
|
|
64
|
+
}, [width, translate, ANIMATIONS.TIMING.LONG])
|
|
65
|
+
|
|
66
|
+
return { styles, shimmerColorList, animatedStyles, handleLayout }
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export { useSkeletonStyles }
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { View } from 'react-native'
|
|
2
|
+
import Animated from 'react-native-reanimated'
|
|
3
|
+
import { LinearGradient } from 'expo-linear-gradient'
|
|
4
|
+
import { useSkeletonStyles } from './skeleton.styles'
|
|
5
|
+
import { type SkeletonProps } from './skeleton.types'
|
|
6
|
+
|
|
7
|
+
/** Плейсхолдер загрузки: плашка формы контента со световым бликом, проезжающим по ширине. */
|
|
8
|
+
const Skeleton = ({ style }: SkeletonProps) => {
|
|
9
|
+
const { styles, shimmerColorList, animatedStyles, handleLayout } = useSkeletonStyles()
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<View style={[styles.container, style]} onLayout={handleLayout}>
|
|
13
|
+
<Animated.View style={[styles.shimmer, animatedStyles.shimmer]}>
|
|
14
|
+
<LinearGradient
|
|
15
|
+
style={styles.gradient}
|
|
16
|
+
colors={shimmerColorList}
|
|
17
|
+
locations={[0, 0.5, 1]}
|
|
18
|
+
start={{ x: 0, y: 0 }}
|
|
19
|
+
end={{ x: 1, y: 0 }}
|
|
20
|
+
/>
|
|
21
|
+
</Animated.View>
|
|
22
|
+
</View>
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default Skeleton
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type StyleProp, type ViewStyle } from 'react-native'
|
|
2
|
+
|
|
3
|
+
/** Пропсы плейсхолдера загрузки Skeleton. */
|
|
4
|
+
type SkeletonProps = {
|
|
5
|
+
/** Габариты плашки: ширина, высота и радиус задаются через `style` (перекрывают дефолты). */
|
|
6
|
+
style?: StyleProp<ViewStyle>
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export type { SkeletonProps }
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { useEffect } from 'react'
|
|
2
|
+
import { StyleSheet } from 'react-native'
|
|
3
|
+
import {
|
|
4
|
+
cancelAnimation,
|
|
5
|
+
useAnimatedStyle,
|
|
6
|
+
useSharedValue,
|
|
7
|
+
withRepeat,
|
|
8
|
+
withTiming,
|
|
9
|
+
} from 'react-native-reanimated'
|
|
10
|
+
import { useThemeMode } from '../../../lib'
|
|
11
|
+
|
|
12
|
+
/** Стили и бесконечная анимация вращения Spinner. */
|
|
13
|
+
const useSpinnerStyles = () => {
|
|
14
|
+
const rotate = useSharedValue(0)
|
|
15
|
+
const { COLORS, SIZES, ANIMATIONS } = useThemeMode()
|
|
16
|
+
|
|
17
|
+
const stylesByVariant = StyleSheet.create({
|
|
18
|
+
base: {
|
|
19
|
+
color: COLORS.TYPOGRAPHY.BASE,
|
|
20
|
+
},
|
|
21
|
+
secondary: {
|
|
22
|
+
color: COLORS.TYPOGRAPHY.SECONDARY,
|
|
23
|
+
},
|
|
24
|
+
disabled: {
|
|
25
|
+
color: COLORS.TYPOGRAPHY.DISABLED,
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
transparent: {
|
|
29
|
+
color: COLORS.TYPOGRAPHY.TRANSPARENT,
|
|
30
|
+
},
|
|
31
|
+
matter: {
|
|
32
|
+
color: COLORS.TYPOGRAPHY.MATTER,
|
|
33
|
+
},
|
|
34
|
+
contrast: {
|
|
35
|
+
color: COLORS.TYPOGRAPHY.CONTRAST,
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
primary: {
|
|
39
|
+
color: COLORS.TYPOGRAPHY.PRIMARY,
|
|
40
|
+
},
|
|
41
|
+
info: {
|
|
42
|
+
color: COLORS.TYPOGRAPHY.INFO,
|
|
43
|
+
},
|
|
44
|
+
success: {
|
|
45
|
+
color: COLORS.TYPOGRAPHY.SUCCESS,
|
|
46
|
+
},
|
|
47
|
+
warning: {
|
|
48
|
+
color: COLORS.TYPOGRAPHY.WARNING,
|
|
49
|
+
},
|
|
50
|
+
danger: {
|
|
51
|
+
color: COLORS.TYPOGRAPHY.DANGER,
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
neutral: {
|
|
55
|
+
color: COLORS.TYPOGRAPHY.NEUTRAL,
|
|
56
|
+
},
|
|
57
|
+
outline: {
|
|
58
|
+
color: COLORS.TYPOGRAPHY.OUTLINE,
|
|
59
|
+
},
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
const stylesBySize = StyleSheet.create({
|
|
63
|
+
xl: {
|
|
64
|
+
width: SIZES['12XL'],
|
|
65
|
+
height: SIZES['12XL'],
|
|
66
|
+
},
|
|
67
|
+
l: {
|
|
68
|
+
width: SIZES['6XL'],
|
|
69
|
+
height: SIZES['6XL'],
|
|
70
|
+
},
|
|
71
|
+
m: {
|
|
72
|
+
width: SIZES['4XL'],
|
|
73
|
+
height: SIZES['4XL'],
|
|
74
|
+
},
|
|
75
|
+
s: {
|
|
76
|
+
width: SIZES['3XL'],
|
|
77
|
+
height: SIZES['3XL'],
|
|
78
|
+
},
|
|
79
|
+
xs: {
|
|
80
|
+
width: SIZES['2XL'],
|
|
81
|
+
height: SIZES['2XL'],
|
|
82
|
+
},
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
const animatedStyles = {
|
|
86
|
+
spinner: useAnimatedStyle(() => {
|
|
87
|
+
return {
|
|
88
|
+
transform: [{ rotate: `${rotate.value * 360}deg` }],
|
|
89
|
+
}
|
|
90
|
+
}),
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
useEffect(() => {
|
|
94
|
+
rotate.set(withRepeat(withTiming(1, ANIMATIONS.TIMING.LONG), -1))
|
|
95
|
+
|
|
96
|
+
return () => cancelAnimation(rotate)
|
|
97
|
+
}, [rotate, ANIMATIONS.TIMING.LONG])
|
|
98
|
+
|
|
99
|
+
return { stylesByVariant, stylesBySize, animatedStyles }
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export { useSpinnerStyles }
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import Animated from 'react-native-reanimated'
|
|
2
|
+
import { Circle, Svg } from 'react-native-svg'
|
|
3
|
+
import { useSpinnerStyles } from './spinner.styles'
|
|
4
|
+
import { type SpinnerProps } from './spinner.types'
|
|
5
|
+
|
|
6
|
+
/** Радиус дуги в системе координат viewBox 24×24. */
|
|
7
|
+
const RADIUS = 9
|
|
8
|
+
/** Длина окружности дуги — база для расчёта штриховки видимого сектора. */
|
|
9
|
+
const CIRCUMFERENCE = 2 * Math.PI * RADIUS
|
|
10
|
+
/** Доля окружности под видимой дугой; остаток — прозрачный зазор. */
|
|
11
|
+
const ARC_RATIO = 0.7
|
|
12
|
+
|
|
13
|
+
/** Крутящийся индикатор загрузки: дуга поверх бледной круговой дорожки. */
|
|
14
|
+
const Spinner = ({ ref, style, variant = 'base', size = 'm' }: SpinnerProps) => {
|
|
15
|
+
const { stylesByVariant, stylesBySize, animatedStyles } = useSpinnerStyles()
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<Animated.View style={[stylesBySize[size], animatedStyles.spinner, style]}>
|
|
19
|
+
<Svg
|
|
20
|
+
ref={ref}
|
|
21
|
+
width={stylesBySize[size].width}
|
|
22
|
+
height={stylesBySize[size].width}
|
|
23
|
+
viewBox={'0 0 24 24'}
|
|
24
|
+
fill={'none'}
|
|
25
|
+
>
|
|
26
|
+
<Circle
|
|
27
|
+
cx={12}
|
|
28
|
+
cy={12}
|
|
29
|
+
r={RADIUS}
|
|
30
|
+
stroke={stylesByVariant[variant].color}
|
|
31
|
+
strokeOpacity={0.2}
|
|
32
|
+
strokeWidth={2.5}
|
|
33
|
+
/>
|
|
34
|
+
<Circle
|
|
35
|
+
cx={12}
|
|
36
|
+
cy={12}
|
|
37
|
+
r={RADIUS}
|
|
38
|
+
stroke={stylesByVariant[variant].color}
|
|
39
|
+
strokeWidth={2.5}
|
|
40
|
+
strokeLinecap={'round'}
|
|
41
|
+
strokeDasharray={`${CIRCUMFERENCE * ARC_RATIO} ${CIRCUMFERENCE}`}
|
|
42
|
+
/>
|
|
43
|
+
</Svg>
|
|
44
|
+
</Animated.View>
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export default Spinner
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type KeyOf, type SizeRange } from '@mediacubeco/base/types'
|
|
2
|
+
import { type Ref } from 'react'
|
|
3
|
+
import type Svg from 'react-native-svg'
|
|
4
|
+
import { type SvgProps } from 'react-native-svg'
|
|
5
|
+
import { type COLOR_BY_VARIANT } from '../../../lib'
|
|
6
|
+
|
|
7
|
+
/** Пропсы индикатора загрузки Spinner. */
|
|
8
|
+
type SpinnerProps = {
|
|
9
|
+
ref?: Ref<Svg>
|
|
10
|
+
style?: SvgProps['style']
|
|
11
|
+
/** Цветовой вариант из палитры типографики; перекрывается прямым `color`. */
|
|
12
|
+
variant?: KeyOf<typeof COLOR_BY_VARIANT>
|
|
13
|
+
/**
|
|
14
|
+
* @default 'm'
|
|
15
|
+
*
|
|
16
|
+
* @prop 'xs' - 16
|
|
17
|
+
* @prop 's' - 20
|
|
18
|
+
* @prop 'm' - 24
|
|
19
|
+
* @prop 'l' - 32
|
|
20
|
+
* @prop 'xl' - 56
|
|
21
|
+
**/
|
|
22
|
+
size?: SizeRange<1, 1>
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export type { SpinnerProps }
|