@momo-kits/native-kits 0.167.1-beta.3-debug → 0.167.1-beta.4

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.
Files changed (144) hide show
  1. package/.claude/settings.local.json +14 -0
  2. package/ios/native-kits.podspec +1 -1
  3. package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
  4. package/package.json +1 -1
  5. package/build.gradle.kts +0 -11
  6. package/compose/build.gradle.kts +0 -190
  7. package/compose/build.gradle.kts.backup +0 -190
  8. package/compose/compose.podspec +0 -47
  9. package/compose/src/androidMain/kotlin/vn/momo/kits/const/HostFont.android.kt +0 -19
  10. package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +0 -6
  11. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/BackGesture.android.kt +0 -12
  12. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/OsFontScale.android.kt +0 -7
  13. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +0 -151
  14. package/compose/src/commonMain/kotlin/vn/momo/kits/application/AnimationSearchInput.kt +0 -52
  15. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +0 -124
  16. package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +0 -183
  17. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +0 -207
  18. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +0 -39
  19. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +0 -86
  20. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +0 -76
  21. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +0 -76
  22. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +0 -293
  23. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +0 -33
  24. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +0 -831
  25. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +0 -269
  26. package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +0 -110
  27. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +0 -378
  28. package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +0 -56
  29. package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +0 -69
  30. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +0 -157
  31. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +0 -82
  32. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +0 -32
  33. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +0 -338
  34. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +0 -175
  35. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +0 -356
  36. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +0 -113
  37. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +0 -89
  38. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +0 -128
  39. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +0 -209
  40. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +0 -542
  41. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +0 -49
  42. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +0 -76
  43. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +0 -125
  44. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +0 -231
  45. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +0 -189
  46. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +0 -475
  47. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +0 -114
  48. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +0 -266
  49. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +0 -240
  50. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +0 -223
  51. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +0 -264
  52. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +0 -185
  53. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +0 -343
  54. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +0 -108
  55. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +0 -56
  56. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +0 -41
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +0 -84
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +0 -40
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +0 -328
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +0 -97
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +0 -310
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +0 -59
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +0 -87
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +0 -21
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +0 -90
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +0 -323
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +0 -220
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +0 -473
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +0 -122
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +0 -199
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +0 -91
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +0 -552
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +0 -88
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +0 -125
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +0 -207
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +0 -498
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +0 -176
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +0 -182
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +0 -193
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +0 -29
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +0 -234
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +0 -188
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +0 -325
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/const/HostFont.kt +0 -16
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/const/KitDesignSystem.kt +0 -18
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/const/KitFontScale.kt +0 -22
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +0 -12
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +0 -16
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +0 -188
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +0 -296
  91. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +0 -52
  92. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +0 -38
  93. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +0 -39
  94. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +0 -52
  95. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +0 -66
  96. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +0 -11
  97. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +0 -104
  98. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +0 -48
  99. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +0 -51
  100. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +0 -299
  101. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/HostBackGestureBridge.kt +0 -58
  102. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +0 -129
  103. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +0 -106
  104. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +0 -201
  105. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +0 -393
  106. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +0 -8
  107. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +0 -595
  108. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackTransition.kt +0 -148
  109. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/SwipeBackHaptic.kt +0 -35
  110. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +0 -175
  111. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +0 -225
  112. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +0 -86
  113. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +0 -169
  114. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +0 -358
  115. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +0 -83
  116. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderJourney.kt +0 -106
  117. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderLocation.kt +0 -75
  118. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +0 -309
  119. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +0 -37
  120. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +0 -364
  121. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +0 -132
  122. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +0 -127
  123. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/BackGesture.kt +0 -12
  124. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +0 -91
  125. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +0 -9
  126. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +0 -71
  127. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +0 -1329
  128. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +0 -55
  129. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +0 -15
  130. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +0 -105
  131. package/compose/src/iosMain/kotlin/vn/momo/kits/const/HostFont.ios.kt +0 -40
  132. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/HostBackGesture.ios.kt +0 -45
  133. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +0 -32
  134. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/BackGesture.ios.kt +0 -38
  135. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +0 -66
  136. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +0 -213
  137. package/gradle/libs.versions.toml +0 -69
  138. package/gradle/wrapper/gradle-wrapper.jar +0 -0
  139. package/gradle/wrapper/gradle-wrapper.properties +0 -8
  140. package/gradle.properties +0 -26
  141. package/gradlew +0 -252
  142. package/gradlew.bat +0 -94
  143. package/ios-demo/README.md +0 -120
  144. package/settings.gradle.kts +0 -64
@@ -1,188 +0,0 @@
1
- package vn.momo.kits.const
2
-
3
- import androidx.compose.runtime.Stable
4
- import androidx.compose.runtime.staticCompositionLocalOf
5
- import androidx.compose.ui.graphics.Color
6
- import androidx.compose.ui.unit.dp
7
-
8
- @Stable
9
- data class Background(
10
- val default: Color,
11
- val surface: Color,
12
- val tonal: Color,
13
- val pressed: Color,
14
- val selected: Color,
15
- val disable: Color
16
- )
17
-
18
- @Stable
19
- data class ColorScheme(
20
- val primary: Color,
21
- val secondary: Color,
22
- val gradient: Color,
23
- val background: Background,
24
- val text: TextColors,
25
- val border: BorderColors,
26
- val success: ColorSet,
27
- val warning: ColorSet,
28
- val error: ColorSet,
29
- val highlight: ColorSet,
30
- val interactive: ColorSet
31
- )
32
-
33
- @Stable
34
- data class TextColors(
35
- val default: Color,
36
- val secondary: Color,
37
- val hint: Color,
38
- val disable: Color
39
- )
40
-
41
- @Stable
42
- data class BorderColors(
43
- val default: Color,
44
- val disable: Color
45
- )
46
-
47
- @Stable
48
- data class ColorSet(
49
- val primary: Color,
50
- val secondary: Color,
51
- val container: Color
52
- )
53
-
54
- @Stable
55
- data class ThemeAssets(
56
- val headerBackground: String? = null
57
- )
58
-
59
- @Stable
60
- data class Theme(
61
- val dark: Boolean,
62
- val colors: ColorScheme,
63
- val font: String,
64
- val assets: ThemeAssets
65
- ) {
66
- fun isHeaderImage(): Boolean {
67
- return !assets.headerBackground.isNullOrEmpty()
68
- }
69
- }
70
- val defaultTheme = Theme(
71
- dark = false,
72
- colors = ColorScheme(
73
- primary = Colors.pink_03,
74
- secondary = Colors.pink_07,
75
- gradient = Color(0xFFFDCADE),
76
- background = Background(
77
- default = Color(0xFFF2F2F6),
78
- surface = Colors.black_01,
79
- tonal = Colors.pink_09,
80
- pressed = Color(0xFFDFDFE6),
81
- selected = Colors.pink_10,
82
- disable = Color(0xFFEBEBF2)
83
- ),
84
- text = TextColors(
85
- default = Colors.black_17,
86
- secondary = Colors.black_15,
87
- hint = Colors.black_12,
88
- disable = Colors.black_08
89
- ),
90
- border = BorderColors(
91
- default = Colors.black_04,
92
- disable = Colors.black_02
93
- ),
94
- success = ColorSet(
95
- primary = Colors.green_03,
96
- secondary = Colors.green_07,
97
- container = Colors.green_08
98
- ),
99
- warning = ColorSet(
100
- primary = Colors.orange_03,
101
- secondary = Colors.orange_07,
102
- container = Colors.orange_08
103
- ),
104
- error = ColorSet(
105
- primary = Colors.red_03,
106
- secondary = Colors.red_07,
107
- container = Colors.red_08,
108
- ),
109
- highlight = ColorSet(
110
- primary = Colors.mint_03,
111
- secondary = Colors.mint_07,
112
- container = Colors.mint_08
113
- ),
114
- interactive = ColorSet(
115
- primary = Colors.blue_03,
116
- secondary = Colors.blue_07,
117
- container = Colors.blue_08
118
- )
119
- ),
120
- font = "MomoTrustSans",
121
- assets = ThemeAssets(
122
- headerBackground = null
123
- )
124
- )
125
-
126
-
127
- val darkTheme = Theme(
128
- dark = true,
129
- colors = ColorScheme(
130
- primary = Colors.pink_04,
131
- secondary = Colors.pink_08,
132
- gradient = Color(0xFFFDCADE),
133
- background = Background(
134
- default = Color(0xFF121212),
135
- surface = Color(0xFF1E1E1E),
136
- tonal = Colors.pink_10,
137
- pressed = Color(0xFF1A1A1A),
138
- selected = Colors.pink_11,
139
- disable = Color(0xFF303030)
140
- ),
141
- text = TextColors(
142
- default = Color.White,
143
- secondary = Color(0xFFB0B0B0),
144
- hint = Color(0xFF727272),
145
- disable = Color(0xFF505050)
146
- ),
147
- border = BorderColors(
148
- default = Color(0xFF2A2A2A),
149
- disable = Color(0xFF242424)
150
- ),
151
- success = ColorSet(
152
- primary = Colors.green_03,
153
- secondary = Colors.green_07,
154
- container = Colors.green_08
155
- ),
156
- warning = ColorSet(
157
- primary = Colors.orange_03,
158
- secondary = Colors.orange_07,
159
- container = Colors.orange_08
160
- ),
161
- error = ColorSet(
162
- primary = Colors.red_03,
163
- secondary = Colors.red_07,
164
- container = Colors.red_08,
165
- ),
166
- highlight = ColorSet(
167
- primary = Colors.mint_03,
168
- secondary = Colors.mint_07,
169
- container = Colors.mint_08
170
- ),
171
- interactive = ColorSet(
172
- primary = Colors.blue_03,
173
- secondary = Colors.blue_07,
174
- container = Colors.blue_08
175
- )
176
- ),
177
- font = "MomoTrustSans",
178
- assets = ThemeAssets(
179
- headerBackground = null
180
- )
181
- )
182
-
183
-
184
- val AppTheme = staticCompositionLocalOf { defaultTheme }
185
-
186
- val AppStatusBar = staticCompositionLocalOf { 0.dp }
187
-
188
- val AppNavigationBar = staticCompositionLocalOf { 0.dp }
@@ -1,296 +0,0 @@
1
- package vn.momo.kits.const
2
-
3
- import androidx.compose.runtime.Composable
4
- import androidx.compose.runtime.Immutable
5
- import androidx.compose.ui.platform.LocalDensity
6
- import androidx.compose.ui.text.TextStyle
7
- import androidx.compose.ui.text.font.FontFamily
8
- import androidx.compose.ui.text.font.FontWeight
9
- import androidx.compose.ui.text.style.TextDecoration
10
- import androidx.compose.ui.unit.*
11
- import vn.momo.kits.application.LocalContext
12
- import vn.momo.kits.platform.getScreenDimensions
13
- import kotlin.math.max
14
- import kotlin.math.min
15
-
16
- const val DEFAULT_SCREEN_SIZE = 375f
17
- const val MAX_FONT_SCALE = 1.5f
18
- const val MAX_DEVICE_SCALE = 5
19
-
20
- @Composable
21
- fun scaleSize(size: Float): Float {
22
- val context = LocalContext.current
23
- // Host-pushed context wins; otherwise fall back to the app-wide KitFontScale holder.
24
- val useOsScale = context?.useOSScaleRate ?: KitFontScale.useOSScaleRate
25
- if (!useOsScale) {
26
- return size * (context?.userScaleRate ?: KitFontScale.userScaleRate)
27
- }
28
- val scaleSizeMaxRate: Float = MAX_FONT_SCALE
29
- val deviceWidth = getScreenDimensions().width
30
- val deviceScale = deviceWidth / DEFAULT_SCREEN_SIZE
31
-
32
- val density = LocalDensity.current
33
- val fontScale = density.fontScale
34
-
35
- var fontSizeScaleDevice = size
36
- var fontSizeScaleOS = size
37
-
38
- if (deviceScale > 1) {
39
- fontSizeScaleDevice =
40
- min(deviceScale * fontSizeScaleDevice, fontSizeScaleDevice + MAX_DEVICE_SCALE)
41
- }
42
-
43
- if (fontScale > 1) {
44
- fontSizeScaleOS = min(fontScale * fontSizeScaleOS, fontSizeScaleOS * scaleSizeMaxRate)
45
- }
46
-
47
- return max(
48
- fontSizeScaleDevice,
49
- fontSizeScaleOS
50
- )
51
- }
52
-
53
- @Composable
54
- fun scaleSize(size: TextUnit): TextUnit {
55
- if (!size.isSp) return size
56
-
57
- val density = LocalDensity.current
58
-
59
- val scaled = scaleSize(size.value)
60
- val spValue = scaled / density.fontScale
61
-
62
- return TextUnit(value = spValue, type = TextUnitType.Sp)
63
- }
64
-
65
- @Composable
66
- fun scaleSize(size: Dp): Dp {
67
- return scaleSize(size.value).dp
68
- }
69
-
70
- @Composable
71
- fun scaleSize(textStyle: TextStyle): TextStyle {
72
- return textStyle.copy(
73
- fontSize = if (textStyle.fontSize != TextUnit.Unspecified)
74
- scaleSize(textStyle.fontSize)
75
- else
76
- TextUnit.Unspecified,
77
-
78
- lineHeight = if (textStyle.lineHeight != TextUnit.Unspecified)
79
- scaleSize(textStyle.lineHeight)
80
- else
81
- TextUnit.Unspecified,
82
- )
83
- }
84
-
85
-
86
- /**
87
- * Tên file font trong tài nguyên native của app host (xem [hostFontFamily]).
88
- *
89
- * SDK không đóng gói font riêng nữa: app host đã bundle sẵn toàn bộ font từ `font-source`
90
- * cho cả React Native lẫn native, nên bản copy trong `composeResources` chỉ làm phình app.
91
- */
92
- private const val LEGACY_DEFAULT_FONT_FILE = "SFProText-Regular.ttf"
93
- private const val NEW_DEFAULT_FONT_FILE = "MomoTrustSans-Regular.ttf"
94
-
95
- private val hostFontFiles: Map<String, String> = mapOf(
96
- "SFProText-100" to "SFProText-Thin.ttf",
97
- "SFProText-200" to "SFProText-Ultralight.ttf",
98
- "SFProText-300" to "SFProText-Light.ttf",
99
- "SFProText-400" to LEGACY_DEFAULT_FONT_FILE,
100
- "SFProText-500" to "SFProText-Medium.ttf",
101
- "SFProText-600" to "SFProText-Semibold.ttf",
102
- "SFProText-700" to "SFProText-Bold.ttf",
103
- "SFProText-800" to "SFProText-Heavy.ttf",
104
- "SFProText-900" to "SFProText-Black.ttf",
105
-
106
- "MomoTrustSans-100" to "MomoTrustSans-ExtraLight.ttf",
107
- "MomoTrustSans-200" to "MomoTrustSans-ExtraLight.ttf",
108
- "MomoTrustSans-300" to "MomoTrustSans-Light.ttf",
109
- "MomoTrustSans-400" to "MomoTrustSans-Regular.ttf",
110
- "MomoTrustSans-500" to "MomoTrustSans-Medium.ttf",
111
- "MomoTrustSans-600" to "MomoTrustSans-SemiBold.ttf",
112
- "MomoTrustSans-700" to "MomoTrustSans-Bold.ttf",
113
- "MomoTrustSans-800" to "MomoTrustSans-ExtraBold.ttf",
114
- "MomoTrustSans-900" to "MomoTrustSans-ExtraBold.ttf",
115
- ) + (1..9).flatMap { step ->
116
- val weight = step * 100
117
- listOf(
118
- "MoMoSignature-$weight" to "MoMoSignature.otf",
119
- "MoMoTrustDisplay-$weight" to "MoMoTrustDisplay.otf",
120
- )
121
- }
122
-
123
- /**
124
- * Font mặc định mới, chỉ áp cho user nằm trong whitelist design system ([KitDesignSystem]).
125
- * Ngoài whitelist thì quay về [LEGACY_DEFAULT_FONT_FAMILY] như trước.
126
- */
127
- private const val NEW_DEFAULT_FONT_FAMILY = "MomoTrustSans"
128
- private const val LEGACY_DEFAULT_FONT_FAMILY = "SFProText"
129
-
130
- /**
131
- * Font thuoc bo design system moi. MoMoTrustDisplay chi duoc header dung tu DS-791
132
- * (commit header title 5bfde6251); truoc do header lay font theo theme, nen ngoai
133
- * whitelist ca hai deu ha ve [LEGACY_DEFAULT_FONT_FAMILY].
134
- */
135
- private val newFontFamilies = setOf(NEW_DEFAULT_FONT_FAMILY, "MoMoTrustDisplay")
136
-
137
- @Composable
138
- fun getFontFamily(fontFamily: String, fontWeight: FontWeight? = FontWeight.Normal): FontFamily {
139
- val isWhiteList = KitDesignSystem.isWhiteList
140
- val resolvedFamily =
141
- if (fontFamily in newFontFamilies && !isWhiteList) {
142
- LEGACY_DEFAULT_FONT_FAMILY
143
- } else {
144
- fontFamily
145
- }
146
- val defaultFile = if (isWhiteList) NEW_DEFAULT_FONT_FILE else LEGACY_DEFAULT_FONT_FILE
147
- val key = "$resolvedFamily-${fontWeight?.weight}"
148
- val fileName = hostFontFiles[key] ?: defaultFile
149
- return hostFontFamily(fileName)
150
- ?: hostFontFamily(defaultFile)
151
- ?: FontFamily.Default
152
- }
153
-
154
- @Immutable
155
- class AppTypography internal constructor(
156
- val headlineDefaultBold: TextStyle,
157
- val headerMBold: TextStyle,
158
- val headerDefaultBold: TextStyle,
159
- val headerSSemibold: TextStyle,
160
- val headerXsSemibold: TextStyle,
161
- val bodyDefaultRegular: TextStyle,
162
- val bodyDefaultRegularStrikethrough: TextStyle,
163
- val descriptionDefaultRegular: TextStyle,
164
- val descriptionDefaultRegularStrikethrough: TextStyle,
165
- val descriptionXsRegular: TextStyle,
166
- val descriptionXsRegularStrikethrough: TextStyle,
167
- val labelDefaultMedium: TextStyle,
168
- val labelSMedium: TextStyle,
169
- val labelXsMedium: TextStyle,
170
- val actionDefaultBold: TextStyle,
171
- val actionSBold: TextStyle,
172
- val actionXsBold: TextStyle,
173
- val actionXxsBold: TextStyle,
174
- ) {
175
- constructor(
176
- default: TextStyle = TextStyle(
177
- fontSize = 14.sp,
178
- lineHeight = 20.sp,
179
- fontWeight = FontWeight.Normal
180
- ),
181
- headlineDefaultBold: TextStyle = TextStyle(
182
- fontSize = 24.sp,
183
- lineHeight = 34.sp,
184
- fontWeight = FontWeight.Bold
185
- ),
186
- headerMBold: TextStyle = TextStyle(
187
- fontSize = 18.sp,
188
- lineHeight = 26.sp,
189
- fontWeight = FontWeight.Bold
190
- ),
191
- headerDefaultBold: TextStyle = TextStyle(
192
- fontSize = 16.sp,
193
- lineHeight = 22.sp,
194
- fontWeight = FontWeight.Bold
195
- ),
196
- headerSSemibold: TextStyle = TextStyle(
197
- fontSize = 14.sp,
198
- lineHeight = 20.sp,
199
- fontWeight = FontWeight.SemiBold
200
- ),
201
- headerXsSemibold: TextStyle = TextStyle(
202
- fontSize = 12.sp,
203
- lineHeight = 18.sp,
204
- fontWeight = FontWeight.SemiBold
205
- ),
206
- bodyDefaultRegular: TextStyle = TextStyle(
207
- fontSize = 14.sp,
208
- lineHeight = 20.sp,
209
- fontWeight = FontWeight.Normal
210
- ),
211
- bodyDefaultRegularStrikethrough: TextStyle = TextStyle(
212
- fontSize = 14.sp,
213
- lineHeight = 20.sp,
214
- fontWeight = FontWeight.Normal,
215
- textDecoration = TextDecoration.LineThrough
216
- ),
217
- descriptionDefaultRegular: TextStyle = TextStyle(
218
- fontSize = 12.sp,
219
- lineHeight = 18.sp,
220
- fontWeight = FontWeight.Normal
221
- ),
222
- descriptionDefaultRegularStrikethrough: TextStyle = TextStyle(
223
- fontSize = 12.sp,
224
- lineHeight = 18.sp,
225
- fontWeight = FontWeight.Normal,
226
- textDecoration = TextDecoration.LineThrough
227
- ),
228
- descriptionXsRegular: TextStyle = TextStyle(
229
- fontSize = 10.sp,
230
- lineHeight = 14.sp,
231
- fontWeight = FontWeight.Normal
232
- ),
233
- descriptionXsRegularStrikethrough: TextStyle = TextStyle(
234
- fontSize = 10.sp,
235
- lineHeight = 14.sp,
236
- fontWeight = FontWeight.Normal,
237
- textDecoration = TextDecoration.LineThrough
238
- ),
239
- labelDefaultMedium: TextStyle = TextStyle(
240
- fontSize = 14.sp,
241
- lineHeight = 20.sp,
242
- fontWeight = FontWeight.Medium
243
- ),
244
- labelSMedium: TextStyle = TextStyle(
245
- fontSize = 12.sp,
246
- lineHeight = 18.sp,
247
- fontWeight = FontWeight.Medium
248
- ),
249
- labelXsMedium: TextStyle = TextStyle(
250
- fontSize = 10.sp,
251
- lineHeight = 14.sp,
252
- fontWeight = FontWeight.Medium
253
- ),
254
- actionDefaultBold: TextStyle = TextStyle(
255
- fontSize = 16.sp,
256
- lineHeight = 22.sp,
257
- fontWeight = FontWeight.Bold
258
- ),
259
- actionSBold: TextStyle = TextStyle(
260
- fontSize = 14.sp,
261
- lineHeight = 20.sp,
262
- fontWeight = FontWeight.Bold
263
- ),
264
- actionXsBold: TextStyle = TextStyle(
265
- fontSize = 12.sp,
266
- lineHeight = 18.sp,
267
- fontWeight = FontWeight.Bold
268
- ),
269
- actionXxsBold: TextStyle = TextStyle(
270
- fontSize = 10.sp,
271
- lineHeight = 14.sp,
272
- fontWeight = FontWeight.Bold
273
- ),
274
- ) : this(
275
- headlineDefaultBold = headlineDefaultBold,
276
- headerMBold = headerMBold,
277
- headerDefaultBold = headerDefaultBold,
278
- headerSSemibold = headerSSemibold,
279
- headerXsSemibold = headerXsSemibold,
280
- bodyDefaultRegular = bodyDefaultRegular,
281
- bodyDefaultRegularStrikethrough = bodyDefaultRegularStrikethrough,
282
- descriptionDefaultRegular = descriptionDefaultRegular,
283
- descriptionDefaultRegularStrikethrough = descriptionDefaultRegularStrikethrough,
284
- descriptionXsRegular = descriptionXsRegular,
285
- descriptionXsRegularStrikethrough = descriptionXsRegularStrikethrough,
286
- labelDefaultMedium = labelDefaultMedium,
287
- labelSMedium = labelSMedium,
288
- labelXsMedium = labelXsMedium,
289
- actionDefaultBold = actionDefaultBold,
290
- actionSBold = actionSBold,
291
- actionXsBold = actionXsBold,
292
- actionXxsBold = actionXxsBold
293
- )
294
- }
295
-
296
- val Typography = AppTypography()
@@ -1,52 +0,0 @@
1
- package vn.momo.kits.layout
2
-
3
- import androidx.compose.foundation.background
4
- import androidx.compose.foundation.layout.Arrangement
5
- import androidx.compose.foundation.layout.Box
6
- import androidx.compose.foundation.layout.BoxWithConstraints
7
- import androidx.compose.foundation.layout.FlowRow
8
- import androidx.compose.foundation.layout.PaddingValues
9
- import androidx.compose.foundation.layout.fillMaxWidth
10
- import androidx.compose.foundation.layout.padding
11
- import androidx.compose.foundation.shape.RoundedCornerShape
12
- import androidx.compose.runtime.Composable
13
- import androidx.compose.runtime.CompositionLocalProvider
14
- import androidx.compose.ui.Modifier
15
- import androidx.compose.ui.draw.clip
16
- import androidx.compose.ui.draw.shadow
17
- import androidx.compose.ui.unit.dp
18
- import vn.momo.kits.components.Image
19
- import vn.momo.kits.const.AppTheme
20
- import vn.momo.kits.const.Radius
21
- import vn.momo.kits.const.Spacing
22
-
23
- @Composable
24
- internal fun Card(
25
- useShadow: Boolean = false,
26
- backgroundImage: String? = null,
27
- contentPadding: PaddingValues = PaddingValues(Spacing.M),
28
- modifier: Modifier = Modifier,
29
- content: @Composable () -> Unit,
30
- ) {
31
- val columns = 12
32
- val gutter = 8.dp
33
- val shape = RoundedCornerShape(Radius.M)
34
- var surface = modifier.fillMaxWidth().padding(horizontal = 12.dp)
35
- if (useShadow) surface = surface.shadow(4.dp, shape)
36
- surface = surface.clip(shape)
37
- if (backgroundImage == null) surface = surface.background(AppTheme.current.colors.background.surface)
38
- Box(modifier = surface) {
39
- if (backgroundImage != null) {
40
- Image(source = backgroundImage, modifier = Modifier.matchParentSize())
41
- }
42
- BoxWithConstraints(modifier = Modifier.fillMaxWidth().padding(contentPadding)) {
43
- val sizePerSpan = (maxWidth - gutter * (columns - 1)) / columns - 1.dp / columns
44
- CompositionLocalProvider(LocalGridContext provides GridContext(columns, gutter, sizePerSpan)) {
45
- FlowRow(
46
- horizontalArrangement = Arrangement.spacedBy(gutter),
47
- verticalArrangement = Arrangement.spacedBy(gutter),
48
- ) { content() }
49
- }
50
- }
51
- }
52
- }
@@ -1,38 +0,0 @@
1
- package vn.momo.kits.layout
2
-
3
- import androidx.compose.foundation.layout.Column
4
- import androidx.compose.foundation.layout.height
5
- import androidx.compose.foundation.layout.width
6
- import androidx.compose.runtime.Composable
7
- import androidx.compose.runtime.compositionLocalOf
8
- import androidx.compose.ui.Modifier
9
- import androidx.compose.ui.unit.Dp
10
- import androidx.compose.ui.unit.dp
11
-
12
- internal data class GridContext(
13
- val numberOfColumns: Int = 12,
14
- val gutter: Dp = 12.dp,
15
- val sizePerSpan: Dp = 0.dp,
16
- ) {
17
- fun sizeForSpan(span: Int): Dp = sizePerSpan * span + gutter * (span - 1)
18
- }
19
-
20
- internal val LocalGridContext = compositionLocalOf<GridContext?> { null }
21
-
22
- @Composable
23
- internal fun Item(
24
- widthSpan: Int = 12,
25
- heightSpan: Int = 0,
26
- modifier: Modifier = Modifier,
27
- content: @Composable () -> Unit,
28
- ) {
29
- val grid = LocalGridContext.current
30
- var m = modifier
31
- if (grid != null) {
32
- m = m.width(grid.sizeForSpan(widthSpan))
33
- if (heightSpan > 0) m = m.height(grid.sizeForSpan(heightSpan))
34
- }
35
- // A Column (not a Box) so multiple children flow VERTICALLY instead of stacking
36
- // on top of each other — matches the React Item's flex-column content.
37
- Column(modifier = m) { content() }
38
- }
@@ -1,39 +0,0 @@
1
- package vn.momo.kits.layout
2
-
3
- import androidx.compose.foundation.layout.Arrangement
4
- import androidx.compose.foundation.layout.Box
5
- import androidx.compose.foundation.layout.BoxWithConstraints
6
- import androidx.compose.foundation.layout.FlowRow
7
- import androidx.compose.foundation.layout.fillMaxWidth
8
- import androidx.compose.foundation.layout.padding
9
- import androidx.compose.runtime.Composable
10
- import androidx.compose.runtime.CompositionLocalProvider
11
- import androidx.compose.ui.Modifier
12
- import androidx.compose.ui.unit.dp
13
- import vn.momo.kits.components.Image
14
-
15
- @Composable
16
- internal fun Section(
17
- useMargin: Boolean = true,
18
- backgroundImage: String? = null,
19
- modifier: Modifier = Modifier,
20
- content: @Composable () -> Unit,
21
- ) {
22
- val columns = 12
23
- val gutter = 12.dp
24
- val margin = if (useMargin) 12.dp else 0.dp
25
- Box(modifier = modifier.fillMaxWidth().padding(horizontal = margin)) {
26
- if (backgroundImage != null) {
27
- Image(source = backgroundImage, modifier = Modifier.matchParentSize())
28
- }
29
- BoxWithConstraints(modifier = Modifier.fillMaxWidth()) {
30
- val sizePerSpan = (maxWidth - gutter * (columns - 1)) / columns - 1.dp / columns
31
- CompositionLocalProvider(LocalGridContext provides GridContext(columns, gutter, sizePerSpan)) {
32
- FlowRow(
33
- horizontalArrangement = Arrangement.spacedBy(gutter),
34
- verticalArrangement = Arrangement.spacedBy(gutter),
35
- ) { content() }
36
- }
37
- }
38
- }
39
- }
@@ -1,52 +0,0 @@
1
- package vn.momo.kits.modifier
2
-
3
- import androidx.compose.ui.Modifier
4
- import androidx.compose.ui.node.ModifierNodeElement
5
- import androidx.compose.ui.node.SemanticsModifierNode
6
- import androidx.compose.ui.semantics.SemanticsPropertyReceiver
7
- import androidx.compose.ui.semantics.contentDescription
8
- import androidx.compose.ui.semantics.semantics
9
- import androidx.compose.ui.semantics.testTag
10
- import vn.momo.kits.platform.getPlatformName
11
-
12
- fun Modifier.setAutomationId(accessibilityId: String, mergeDescendants: Boolean = false): Modifier {
13
- return if (getPlatformName() == "Android") {
14
- semantics {
15
- contentDescription = accessibilityId
16
- }
17
- } else {
18
- semantics(mergeDescendants = mergeDescendants) {
19
- testTag = accessibilityId
20
- }
21
- }}
22
-
23
- fun Modifier.kitsAutomationId(accessibilityId: String, label: String? = null) =
24
- this then KitsAutomationIdElement(accessibilityId, label)
25
-
26
- private data class KitsAutomationIdElement(
27
- private val accessibilityId: String,
28
- private val label: String? = null,
29
- ) : ModifierNodeElement<KitsAutomationIdNode>() {
30
- override fun create(): KitsAutomationIdNode {
31
- return KitsAutomationIdNode(accessibilityId, label)
32
- }
33
-
34
- override fun update(node: KitsAutomationIdNode) {
35
- node.accessibilityId = accessibilityId
36
- node.label = label
37
- }
38
- }
39
-
40
- private class KitsAutomationIdNode(
41
- var accessibilityId: String,
42
- var label: String?,
43
- ) : Modifier.Node(), SemanticsModifierNode {
44
- override fun SemanticsPropertyReceiver.applySemantics() {
45
- if (getPlatformName() == "Android") {
46
- contentDescription = accessibilityId
47
- } else {
48
- testTag = accessibilityId
49
- contentDescription = label ?: accessibilityId
50
- }
51
- }
52
- }