@momo-kits/native-kits 0.167.1-beta.9-debug → 0.167.1-duo-search.1

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 (189) hide show
  1. package/CLAUDE.md +36 -0
  2. package/ios/Application/ApplicationEnvironment.swift +6 -0
  3. package/ios/Application/Components.swift +1 -3
  4. package/ios/Application/HeaderRight.swift +32 -14
  5. package/ios/Application/Layout/ScreenLayout.swift +312 -0
  6. package/ios/Application/Navigation/BottomTab/BottomTab.swift +67 -10
  7. package/ios/Application/Navigation/BottomTab/BottomTabBar.swift +5 -2
  8. package/ios/Application/Navigation/BottomTab/DuoBarCompression.swift +105 -0
  9. package/ios/Application/Navigation/BottomTab/DuoTabBar.swift +304 -0
  10. package/ios/Application/Navigation/HeaderUser.swift +4 -4
  11. package/ios/Application/Navigation/NavigationContainer.swift +48 -42
  12. package/ios/Application/Navigation/Navigator.swift +122 -29
  13. package/ios/Application/Navigation/NavigatorManager.swift +13 -6
  14. package/ios/Application/Navigation/Overplay/BottomSheet.swift +41 -4
  15. package/ios/Application/Navigation/Overplay/ModalScreen.swift +7 -0
  16. package/ios/Application/Navigation/component/DuoScrollGradient.swift +54 -0
  17. package/ios/Application/Navigation/component/Header.swift +11 -6
  18. package/ios/Application/Navigation/component/HeaderBackground.swift +3 -2
  19. package/ios/Application/Navigation/component/NavigationFooter.swift +1 -1
  20. package/ios/Application/Navigation/component/NavigationHeaderRight.swift +93 -9
  21. package/ios/Application/Navigation/component/SideBar.swift +155 -0
  22. package/ios/Application/StackScreen.swift +175 -18
  23. package/ios/CalculatorKeyboard/CalculatorKeyboard.swift +59 -5
  24. package/ios/Colors+Radius+Spacing/Colors.swift +1 -1
  25. package/ios/Extensions/Color++.swift +20 -9
  26. package/ios/Extensions/OptionalEnvironmentObject.swift +12 -0
  27. package/ios/Icon/Icon.swift +14 -22
  28. package/ios/Icon/Icons.swift +1329 -0
  29. package/ios/Image/Image.swift +16 -5
  30. package/ios/Lottie/LottieView.swift +4 -2
  31. package/ios/Popup/PopupDisplay.swift +84 -67
  32. package/ios/Popup/PopupLayout.swift +45 -0
  33. package/ios/Popup/PopupNotify.swift +44 -26
  34. package/ios/Popup/PopupPromotion.swift +18 -6
  35. package/ios/Resources/dot_loading.json +558 -0
  36. package/ios/Resources/lottie_circle_loader.json +1 -0
  37. package/ios/Template/TrustBanner/TrustBanner.swift +69 -31
  38. package/ios/Typography/FontScale.swift +3 -3
  39. package/ios/native-kits.podspec +1 -1
  40. package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
  41. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DuoTabDemo.swift +80 -0
  42. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/Home.swift +2 -0
  43. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/IPhoneDuoDemo.swift +173 -0
  44. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupDisplayDemo.swift +1 -0
  45. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupNotifyDemo.swift +2 -2
  46. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupPromotionDemo.swift +2 -0
  47. package/package.json +1 -1
  48. package/scripts/gen-ios-icons.mjs +36 -0
  49. package/build.gradle.kts +0 -11
  50. package/compose/build.gradle.kts +0 -190
  51. package/compose/build.gradle.kts.backup +0 -190
  52. package/compose/compose.podspec +0 -47
  53. package/compose/src/androidMain/kotlin/vn/momo/kits/const/HostFont.android.kt +0 -19
  54. package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +0 -6
  55. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/BackGesture.android.kt +0 -12
  56. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/OsFontScale.android.kt +0 -7
  57. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +0 -151
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/application/AnimationSearchInput.kt +0 -52
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +0 -124
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +0 -183
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +0 -207
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +0 -39
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +0 -86
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +0 -76
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +0 -76
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +0 -293
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +0 -33
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +0 -831
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +0 -269
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +0 -110
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +0 -378
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +0 -56
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +0 -69
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +0 -157
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +0 -82
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +0 -32
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +0 -338
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +0 -175
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +0 -356
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +0 -113
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +0 -89
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +0 -128
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +0 -209
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +0 -542
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +0 -49
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +0 -76
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +0 -125
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +0 -231
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +0 -189
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +0 -475
  91. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +0 -114
  92. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +0 -266
  93. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +0 -240
  94. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +0 -223
  95. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +0 -264
  96. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +0 -185
  97. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +0 -343
  98. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +0 -108
  99. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +0 -56
  100. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +0 -41
  101. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +0 -84
  102. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +0 -40
  103. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +0 -328
  104. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +0 -97
  105. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +0 -310
  106. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +0 -59
  107. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +0 -87
  108. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +0 -21
  109. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +0 -90
  110. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +0 -323
  111. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +0 -220
  112. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +0 -473
  113. package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +0 -122
  114. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +0 -199
  115. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +0 -91
  116. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +0 -552
  117. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +0 -88
  118. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +0 -125
  119. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +0 -207
  120. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +0 -498
  121. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +0 -176
  122. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +0 -182
  123. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +0 -193
  124. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +0 -29
  125. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +0 -234
  126. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +0 -188
  127. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +0 -325
  128. package/compose/src/commonMain/kotlin/vn/momo/kits/const/HostFont.kt +0 -16
  129. package/compose/src/commonMain/kotlin/vn/momo/kits/const/KitDesignSystem.kt +0 -14
  130. package/compose/src/commonMain/kotlin/vn/momo/kits/const/KitFontScale.kt +0 -22
  131. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +0 -12
  132. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +0 -16
  133. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +0 -221
  134. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +0 -270
  135. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +0 -52
  136. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +0 -38
  137. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +0 -39
  138. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +0 -52
  139. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +0 -66
  140. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +0 -11
  141. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +0 -104
  142. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +0 -48
  143. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +0 -51
  144. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +0 -299
  145. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/HostBackGestureBridge.kt +0 -58
  146. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +0 -129
  147. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +0 -106
  148. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +0 -201
  149. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +0 -393
  150. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +0 -8
  151. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +0 -595
  152. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackTransition.kt +0 -148
  153. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/SwipeBackHaptic.kt +0 -35
  154. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +0 -175
  155. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +0 -225
  156. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +0 -86
  157. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +0 -169
  158. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +0 -358
  159. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +0 -83
  160. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderJourney.kt +0 -106
  161. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderLocation.kt +0 -75
  162. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +0 -309
  163. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +0 -40
  164. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +0 -364
  165. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +0 -132
  166. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +0 -127
  167. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/BackGesture.kt +0 -12
  168. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +0 -91
  169. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +0 -9
  170. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +0 -71
  171. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +0 -1329
  172. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +0 -55
  173. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +0 -15
  174. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +0 -105
  175. package/compose/src/iosMain/kotlin/vn/momo/kits/const/HostFont.ios.kt +0 -40
  176. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/HostBackGesture.ios.kt +0 -45
  177. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +0 -32
  178. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/BackGesture.ios.kt +0 -38
  179. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +0 -66
  180. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +0 -213
  181. package/gradle/libs.versions.toml +0 -69
  182. package/gradle/wrapper/gradle-wrapper.jar +0 -0
  183. package/gradle/wrapper/gradle-wrapper.properties +0 -8
  184. package/gradle.properties +0 -26
  185. package/gradlew +0 -252
  186. package/gradlew.bat +0 -94
  187. package/ios-demo/README.md +0 -120
  188. package/local.properties +0 -8
  189. package/settings.gradle.kts +0 -64
@@ -1,221 +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
- internal const val LEGACY_DEFAULT_FONT_FAMILY = "SFProText"
60
- private const val NEW_DEFAULT_FONT_FAMILY = "MomoTrustSans"
61
-
62
- @Stable
63
- class Theme(
64
- val dark: Boolean,
65
- val colors: ColorScheme,
66
- font: String,
67
- val assets: ThemeAssets
68
- ) {
69
- private val designSystemFont = font
70
-
71
- val font: String
72
- get() = if (KitDesignSystem.isWhiteList) NEW_DEFAULT_FONT_FAMILY else designSystemFont
73
-
74
- fun isHeaderImage(): Boolean {
75
- return !assets.headerBackground.isNullOrEmpty()
76
- }
77
-
78
- fun copy(
79
- dark: Boolean = this.dark,
80
- colors: ColorScheme = this.colors,
81
- font: String = designSystemFont,
82
- assets: ThemeAssets = this.assets
83
- ): Theme = Theme(dark, colors, font, assets)
84
-
85
- override fun equals(other: Any?): Boolean {
86
- if (this === other) return true
87
- if (other !is Theme) return false
88
- return dark == other.dark && colors == other.colors &&
89
- designSystemFont == other.designSystemFont && assets == other.assets
90
- }
91
-
92
- override fun hashCode(): Int {
93
- var result = dark.hashCode()
94
- result = 31 * result + colors.hashCode()
95
- result = 31 * result + designSystemFont.hashCode()
96
- result = 31 * result + assets.hashCode()
97
- return result
98
- }
99
-
100
- override fun toString(): String =
101
- "Theme(dark=$dark, colors=$colors, font=$designSystemFont, assets=$assets)"
102
- }
103
- val defaultTheme = Theme(
104
- dark = false,
105
- colors = ColorScheme(
106
- primary = Colors.pink_03,
107
- secondary = Colors.pink_07,
108
- gradient = Color(0xFFFDCADE),
109
- background = Background(
110
- default = Color(0xFFF2F2F6),
111
- surface = Colors.black_01,
112
- tonal = Colors.pink_09,
113
- pressed = Color(0xFFDFDFE6),
114
- selected = Colors.pink_10,
115
- disable = Color(0xFFEBEBF2)
116
- ),
117
- text = TextColors(
118
- default = Colors.black_17,
119
- secondary = Colors.black_15,
120
- hint = Colors.black_12,
121
- disable = Colors.black_08
122
- ),
123
- border = BorderColors(
124
- default = Colors.black_04,
125
- disable = Colors.black_02
126
- ),
127
- success = ColorSet(
128
- primary = Colors.green_03,
129
- secondary = Colors.green_07,
130
- container = Colors.green_08
131
- ),
132
- warning = ColorSet(
133
- primary = Colors.orange_03,
134
- secondary = Colors.orange_07,
135
- container = Colors.orange_08
136
- ),
137
- error = ColorSet(
138
- primary = Colors.red_03,
139
- secondary = Colors.red_07,
140
- container = Colors.red_08,
141
- ),
142
- highlight = ColorSet(
143
- primary = Colors.mint_03,
144
- secondary = Colors.mint_07,
145
- container = Colors.mint_08
146
- ),
147
- interactive = ColorSet(
148
- primary = Colors.blue_03,
149
- secondary = Colors.blue_07,
150
- container = Colors.blue_08
151
- )
152
- ),
153
- font = LEGACY_DEFAULT_FONT_FAMILY,
154
- assets = ThemeAssets(
155
- headerBackground = null
156
- )
157
- )
158
-
159
-
160
- val darkTheme = Theme(
161
- dark = true,
162
- colors = ColorScheme(
163
- primary = Colors.pink_04,
164
- secondary = Colors.pink_08,
165
- gradient = Color(0xFFFDCADE),
166
- background = Background(
167
- default = Color(0xFF121212),
168
- surface = Color(0xFF1E1E1E),
169
- tonal = Colors.pink_10,
170
- pressed = Color(0xFF1A1A1A),
171
- selected = Colors.pink_11,
172
- disable = Color(0xFF303030)
173
- ),
174
- text = TextColors(
175
- default = Color.White,
176
- secondary = Color(0xFFB0B0B0),
177
- hint = Color(0xFF727272),
178
- disable = Color(0xFF505050)
179
- ),
180
- border = BorderColors(
181
- default = Color(0xFF2A2A2A),
182
- disable = Color(0xFF242424)
183
- ),
184
- success = ColorSet(
185
- primary = Colors.green_03,
186
- secondary = Colors.green_07,
187
- container = Colors.green_08
188
- ),
189
- warning = ColorSet(
190
- primary = Colors.orange_03,
191
- secondary = Colors.orange_07,
192
- container = Colors.orange_08
193
- ),
194
- error = ColorSet(
195
- primary = Colors.red_03,
196
- secondary = Colors.red_07,
197
- container = Colors.red_08,
198
- ),
199
- highlight = ColorSet(
200
- primary = Colors.mint_03,
201
- secondary = Colors.mint_07,
202
- container = Colors.mint_08
203
- ),
204
- interactive = ColorSet(
205
- primary = Colors.blue_03,
206
- secondary = Colors.blue_07,
207
- container = Colors.blue_08
208
- )
209
- ),
210
- font = LEGACY_DEFAULT_FONT_FAMILY,
211
- assets = ThemeAssets(
212
- headerBackground = null
213
- )
214
- )
215
-
216
-
217
- val AppTheme = staticCompositionLocalOf { defaultTheme }
218
-
219
- val AppStatusBar = staticCompositionLocalOf { 0.dp }
220
-
221
- val AppNavigationBar = staticCompositionLocalOf { 0.dp }
@@ -1,270 +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
- private const val LEGACY_DEFAULT_FONT_FILE = "SFProText-Regular.ttf"
87
- private const val NEW_DEFAULT_FONT_FILE = "MomoTrustSans-Regular.ttf"
88
-
89
- private val hostFontFiles: Map<String, String> = mapOf(
90
- "SFProText-100" to "SFProText-Thin.ttf",
91
- "SFProText-200" to "SFProText-Ultralight.ttf",
92
- "SFProText-300" to "SFProText-Light.ttf",
93
- "SFProText-400" to LEGACY_DEFAULT_FONT_FILE,
94
- "SFProText-500" to "SFProText-Medium.ttf",
95
- "SFProText-600" to "SFProText-Semibold.ttf",
96
- "SFProText-700" to "SFProText-Bold.ttf",
97
- "SFProText-800" to "SFProText-Heavy.ttf",
98
- "SFProText-900" to "SFProText-Black.ttf",
99
-
100
- "MomoTrustSans-100" to "MomoTrustSans-ExtraLight.ttf",
101
- "MomoTrustSans-200" to "MomoTrustSans-ExtraLight.ttf",
102
- "MomoTrustSans-300" to "MomoTrustSans-Light.ttf",
103
- "MomoTrustSans-400" to "MomoTrustSans-Regular.ttf",
104
- "MomoTrustSans-500" to "MomoTrustSans-Medium.ttf",
105
- "MomoTrustSans-600" to "MomoTrustSans-SemiBold.ttf",
106
- "MomoTrustSans-700" to "MomoTrustSans-Bold.ttf",
107
- "MomoTrustSans-800" to "MomoTrustSans-ExtraBold.ttf",
108
- "MomoTrustSans-900" to "MomoTrustSans-ExtraBold.ttf",
109
- ) + (1..9).flatMap { step ->
110
- val weight = step * 100
111
- listOf(
112
- "MoMoSignature-$weight" to "MoMoSignature.otf",
113
- "MoMoTrustDisplay-$weight" to "MoMoTrustDisplay.otf",
114
- )
115
- }
116
-
117
- @Composable
118
- fun getFontFamily(fontFamily: String, fontWeight: FontWeight? = FontWeight.Normal): FontFamily {
119
- val isWhiteList = KitDesignSystem.isWhiteList
120
- val defaultFile = if (isWhiteList) NEW_DEFAULT_FONT_FILE else LEGACY_DEFAULT_FONT_FILE
121
- val key = "$fontFamily-${fontWeight?.weight}"
122
- val fileName = hostFontFiles[key] ?: defaultFile
123
- return hostFontFamily(fileName)
124
- ?: hostFontFamily(defaultFile)
125
- ?: FontFamily.Default
126
- }
127
-
128
- @Immutable
129
- class AppTypography internal constructor(
130
- val headlineDefaultBold: TextStyle,
131
- val headerMBold: TextStyle,
132
- val headerDefaultBold: TextStyle,
133
- val headerSSemibold: TextStyle,
134
- val headerXsSemibold: TextStyle,
135
- val bodyDefaultRegular: TextStyle,
136
- val bodyDefaultRegularStrikethrough: TextStyle,
137
- val descriptionDefaultRegular: TextStyle,
138
- val descriptionDefaultRegularStrikethrough: TextStyle,
139
- val descriptionXsRegular: TextStyle,
140
- val descriptionXsRegularStrikethrough: TextStyle,
141
- val labelDefaultMedium: TextStyle,
142
- val labelSMedium: TextStyle,
143
- val labelXsMedium: TextStyle,
144
- val actionDefaultBold: TextStyle,
145
- val actionSBold: TextStyle,
146
- val actionXsBold: TextStyle,
147
- val actionXxsBold: TextStyle,
148
- ) {
149
- constructor(
150
- default: TextStyle = TextStyle(
151
- fontSize = 14.sp,
152
- lineHeight = 20.sp,
153
- fontWeight = FontWeight.Normal
154
- ),
155
- headlineDefaultBold: TextStyle = TextStyle(
156
- fontSize = 24.sp,
157
- lineHeight = 34.sp,
158
- fontWeight = FontWeight.Bold
159
- ),
160
- headerMBold: TextStyle = TextStyle(
161
- fontSize = 18.sp,
162
- lineHeight = 26.sp,
163
- fontWeight = FontWeight.Bold
164
- ),
165
- headerDefaultBold: TextStyle = TextStyle(
166
- fontSize = 16.sp,
167
- lineHeight = 22.sp,
168
- fontWeight = FontWeight.Bold
169
- ),
170
- headerSSemibold: TextStyle = TextStyle(
171
- fontSize = 14.sp,
172
- lineHeight = 20.sp,
173
- fontWeight = FontWeight.SemiBold
174
- ),
175
- headerXsSemibold: TextStyle = TextStyle(
176
- fontSize = 12.sp,
177
- lineHeight = 18.sp,
178
- fontWeight = FontWeight.SemiBold
179
- ),
180
- bodyDefaultRegular: TextStyle = TextStyle(
181
- fontSize = 14.sp,
182
- lineHeight = 20.sp,
183
- fontWeight = FontWeight.Normal
184
- ),
185
- bodyDefaultRegularStrikethrough: TextStyle = TextStyle(
186
- fontSize = 14.sp,
187
- lineHeight = 20.sp,
188
- fontWeight = FontWeight.Normal,
189
- textDecoration = TextDecoration.LineThrough
190
- ),
191
- descriptionDefaultRegular: TextStyle = TextStyle(
192
- fontSize = 12.sp,
193
- lineHeight = 18.sp,
194
- fontWeight = FontWeight.Normal
195
- ),
196
- descriptionDefaultRegularStrikethrough: TextStyle = TextStyle(
197
- fontSize = 12.sp,
198
- lineHeight = 18.sp,
199
- fontWeight = FontWeight.Normal,
200
- textDecoration = TextDecoration.LineThrough
201
- ),
202
- descriptionXsRegular: TextStyle = TextStyle(
203
- fontSize = 10.sp,
204
- lineHeight = 14.sp,
205
- fontWeight = FontWeight.Normal
206
- ),
207
- descriptionXsRegularStrikethrough: TextStyle = TextStyle(
208
- fontSize = 10.sp,
209
- lineHeight = 14.sp,
210
- fontWeight = FontWeight.Normal,
211
- textDecoration = TextDecoration.LineThrough
212
- ),
213
- labelDefaultMedium: TextStyle = TextStyle(
214
- fontSize = 14.sp,
215
- lineHeight = 20.sp,
216
- fontWeight = FontWeight.Medium
217
- ),
218
- labelSMedium: TextStyle = TextStyle(
219
- fontSize = 12.sp,
220
- lineHeight = 18.sp,
221
- fontWeight = FontWeight.Medium
222
- ),
223
- labelXsMedium: TextStyle = TextStyle(
224
- fontSize = 10.sp,
225
- lineHeight = 14.sp,
226
- fontWeight = FontWeight.Medium
227
- ),
228
- actionDefaultBold: TextStyle = TextStyle(
229
- fontSize = 16.sp,
230
- lineHeight = 22.sp,
231
- fontWeight = FontWeight.Bold
232
- ),
233
- actionSBold: TextStyle = TextStyle(
234
- fontSize = 14.sp,
235
- lineHeight = 20.sp,
236
- fontWeight = FontWeight.Bold
237
- ),
238
- actionXsBold: TextStyle = TextStyle(
239
- fontSize = 12.sp,
240
- lineHeight = 18.sp,
241
- fontWeight = FontWeight.Bold
242
- ),
243
- actionXxsBold: TextStyle = TextStyle(
244
- fontSize = 10.sp,
245
- lineHeight = 14.sp,
246
- fontWeight = FontWeight.Bold
247
- ),
248
- ) : this(
249
- headlineDefaultBold = headlineDefaultBold,
250
- headerMBold = headerMBold,
251
- headerDefaultBold = headerDefaultBold,
252
- headerSSemibold = headerSSemibold,
253
- headerXsSemibold = headerXsSemibold,
254
- bodyDefaultRegular = bodyDefaultRegular,
255
- bodyDefaultRegularStrikethrough = bodyDefaultRegularStrikethrough,
256
- descriptionDefaultRegular = descriptionDefaultRegular,
257
- descriptionDefaultRegularStrikethrough = descriptionDefaultRegularStrikethrough,
258
- descriptionXsRegular = descriptionXsRegular,
259
- descriptionXsRegularStrikethrough = descriptionXsRegularStrikethrough,
260
- labelDefaultMedium = labelDefaultMedium,
261
- labelSMedium = labelSMedium,
262
- labelXsMedium = labelXsMedium,
263
- actionDefaultBold = actionDefaultBold,
264
- actionSBold = actionSBold,
265
- actionXsBold = actionXsBold,
266
- actionXxsBold = actionXxsBold
267
- )
268
- }
269
-
270
- 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
- }