@momo-kits/native-kits 0.167.1-beta.13-debug → 0.167.1-beta.14

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 (166) hide show
  1. package/CLAUDE.md +4 -6
  2. package/example/ios/Example.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/Example.xcscheme +32 -0
  3. package/example/ios/Example.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
  4. package/example/ios/Example.xcworkspace/xcuserdata/sonnguyen.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  5. package/example/ios/Example.xcworkspace/xcuserdata/sonnguyen.xcuserdatad/WorkspaceSettings.xcsettings +16 -0
  6. package/example/ios/Example.xcworkspace/xcuserdata/sonnguyen.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +6 -0
  7. package/example/ios/Example.xcworkspace/xcuserdata/sonnguyen.xcuserdatad/xcschemes/xcschememanagement.plist +5 -0
  8. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/MoMoUIKits.xcscheme +58 -0
  9. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/Pods-Example.xcscheme +58 -0
  10. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/SDWebImage.xcscheme +58 -0
  11. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/SDWebImageSwiftUI.xcscheme +58 -0
  12. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/SkeletonUI.xcscheme +58 -0
  13. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/lottie-ios-LottiePrivacyInfo.xcscheme +58 -0
  14. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/lottie-ios.xcscheme +58 -0
  15. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/xcschememanagement.plist +60 -0
  16. package/ios/Application/ApplicationEnvironment.swift +6 -13
  17. package/ios/Template/TrustBanner/TrustBanner.swift +7 -39
  18. package/ios/Typography/FontScale.swift +11 -14
  19. package/ios/Typography/FontScaleStore.swift +58 -0
  20. package/ios/Typography/KitDesignSystem.swift +17 -0
  21. package/ios/Typography/Text.swift +7 -19
  22. package/ios/Typography/Typography.swift +2 -2
  23. package/ios/native-kits.podspec +1 -1
  24. package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
  25. package/package.json +1 -1
  26. package/build.gradle.kts +0 -11
  27. package/compose/build.gradle.kts +0 -190
  28. package/compose/build.gradle.kts.backup +0 -190
  29. package/compose/compose.podspec +0 -47
  30. package/compose/src/androidMain/kotlin/vn/momo/kits/const/HostFont.android.kt +0 -19
  31. package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +0 -6
  32. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/BackGesture.android.kt +0 -12
  33. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/OsFontScale.android.kt +0 -7
  34. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +0 -151
  35. package/compose/src/commonMain/kotlin/vn/momo/kits/application/AnimationSearchInput.kt +0 -52
  36. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +0 -110
  37. package/compose/src/commonMain/kotlin/vn/momo/kits/application/DesignSystemKits.kt +0 -62
  38. package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +0 -183
  39. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +0 -207
  40. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +0 -39
  41. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +0 -86
  42. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +0 -76
  43. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +0 -76
  44. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +0 -293
  45. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +0 -33
  46. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +0 -831
  47. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +0 -269
  48. package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +0 -110
  49. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +0 -378
  50. package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +0 -56
  51. package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +0 -69
  52. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +0 -157
  53. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +0 -82
  54. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +0 -32
  55. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +0 -338
  56. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +0 -175
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +0 -356
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +0 -113
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +0 -89
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +0 -128
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +0 -209
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +0 -542
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +0 -49
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +0 -76
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +0 -125
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +0 -231
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +0 -189
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +0 -475
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +0 -114
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +0 -266
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +0 -240
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +0 -223
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +0 -264
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +0 -185
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +0 -343
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +0 -108
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +0 -56
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +0 -41
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +0 -84
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +0 -40
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +0 -328
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +0 -97
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +0 -310
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +0 -59
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +0 -87
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +0 -21
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +0 -90
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +0 -323
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +0 -220
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +0 -473
  91. package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +0 -122
  92. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +0 -199
  93. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +0 -91
  94. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +0 -552
  95. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +0 -88
  96. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +0 -125
  97. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +0 -207
  98. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +0 -498
  99. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +0 -176
  100. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +0 -182
  101. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +0 -193
  102. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +0 -29
  103. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +0 -234
  104. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +0 -188
  105. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +0 -325
  106. package/compose/src/commonMain/kotlin/vn/momo/kits/const/HostFont.kt +0 -16
  107. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +0 -12
  108. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +0 -16
  109. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +0 -222
  110. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +0 -270
  111. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +0 -54
  112. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +0 -51
  113. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +0 -41
  114. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +0 -52
  115. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +0 -66
  116. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +0 -11
  117. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +0 -104
  118. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +0 -48
  119. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +0 -51
  120. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +0 -299
  121. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/HostBackGestureBridge.kt +0 -58
  122. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +0 -129
  123. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +0 -106
  124. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +0 -201
  125. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +0 -393
  126. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +0 -8
  127. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +0 -595
  128. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackTransition.kt +0 -148
  129. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/SwipeBackHaptic.kt +0 -35
  130. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +0 -175
  131. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +0 -225
  132. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +0 -86
  133. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +0 -169
  134. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +0 -357
  135. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +0 -83
  136. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderJourney.kt +0 -106
  137. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderLocation.kt +0 -75
  138. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +0 -309
  139. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +0 -40
  140. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +0 -364
  141. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +0 -132
  142. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +0 -127
  143. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/BackGesture.kt +0 -12
  144. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +0 -91
  145. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +0 -9
  146. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +0 -71
  147. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +0 -1329
  148. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +0 -55
  149. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +0 -15
  150. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +0 -105
  151. package/compose/src/iosMain/kotlin/vn/momo/kits/const/HostFont.ios.kt +0 -40
  152. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/HostBackGesture.ios.kt +0 -45
  153. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +0 -32
  154. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/BackGesture.ios.kt +0 -38
  155. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +0 -66
  156. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +0 -213
  157. package/gradle/libs.versions.toml +0 -69
  158. package/gradle/wrapper/gradle-wrapper.jar +0 -0
  159. package/gradle/wrapper/gradle-wrapper.properties +0 -8
  160. package/gradle.properties +0 -26
  161. package/gradlew +0 -252
  162. package/gradlew.bat +0 -94
  163. package/ios/Application/DesignSystemKits.swift +0 -100
  164. package/ios/Application/DesignSystemKitsPayload.swift +0 -68
  165. package/ios-demo/README.md +0 -120
  166. package/settings.gradle.kts +0 -64
@@ -1,222 +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
- import vn.momo.kits.application.DesignSystemKits
8
-
9
- @Stable
10
- data class Background(
11
- val default: Color,
12
- val surface: Color,
13
- val tonal: Color,
14
- val pressed: Color,
15
- val selected: Color,
16
- val disable: Color
17
- )
18
-
19
- @Stable
20
- data class ColorScheme(
21
- val primary: Color,
22
- val secondary: Color,
23
- val gradient: Color,
24
- val background: Background,
25
- val text: TextColors,
26
- val border: BorderColors,
27
- val success: ColorSet,
28
- val warning: ColorSet,
29
- val error: ColorSet,
30
- val highlight: ColorSet,
31
- val interactive: ColorSet
32
- )
33
-
34
- @Stable
35
- data class TextColors(
36
- val default: Color,
37
- val secondary: Color,
38
- val hint: Color,
39
- val disable: Color
40
- )
41
-
42
- @Stable
43
- data class BorderColors(
44
- val default: Color,
45
- val disable: Color
46
- )
47
-
48
- @Stable
49
- data class ColorSet(
50
- val primary: Color,
51
- val secondary: Color,
52
- val container: Color
53
- )
54
-
55
- @Stable
56
- data class ThemeAssets(
57
- val headerBackground: String? = null
58
- )
59
-
60
- internal const val LEGACY_DEFAULT_FONT_FAMILY = "SFProText"
61
- private const val NEW_DEFAULT_FONT_FAMILY = "MomoTrustSans"
62
-
63
- @Stable
64
- class Theme(
65
- val dark: Boolean,
66
- val colors: ColorScheme,
67
- font: String,
68
- val assets: ThemeAssets
69
- ) {
70
- private val designSystemFont = font
71
-
72
- val font: String
73
- get() = if (DesignSystemKits.getConfigs().isWhiteList) NEW_DEFAULT_FONT_FAMILY else designSystemFont
74
-
75
- fun isHeaderImage(): Boolean {
76
- return !assets.headerBackground.isNullOrEmpty()
77
- }
78
-
79
- fun copy(
80
- dark: Boolean = this.dark,
81
- colors: ColorScheme = this.colors,
82
- font: String = designSystemFont,
83
- assets: ThemeAssets = this.assets
84
- ): Theme = Theme(dark, colors, font, assets)
85
-
86
- override fun equals(other: Any?): Boolean {
87
- if (this === other) return true
88
- if (other !is Theme) return false
89
- return dark == other.dark && colors == other.colors &&
90
- designSystemFont == other.designSystemFont && assets == other.assets
91
- }
92
-
93
- override fun hashCode(): Int {
94
- var result = dark.hashCode()
95
- result = 31 * result + colors.hashCode()
96
- result = 31 * result + designSystemFont.hashCode()
97
- result = 31 * result + assets.hashCode()
98
- return result
99
- }
100
-
101
- override fun toString(): String =
102
- "Theme(dark=$dark, colors=$colors, font=$designSystemFont, assets=$assets)"
103
- }
104
- val defaultTheme = Theme(
105
- dark = false,
106
- colors = ColorScheme(
107
- primary = Colors.pink_03,
108
- secondary = Colors.pink_07,
109
- gradient = Color(0xFFFDCADE),
110
- background = Background(
111
- default = Color(0xFFF2F2F6),
112
- surface = Colors.black_01,
113
- tonal = Colors.pink_09,
114
- pressed = Color(0xFFDFDFE6),
115
- selected = Colors.pink_10,
116
- disable = Color(0xFFEBEBF2)
117
- ),
118
- text = TextColors(
119
- default = Colors.black_17,
120
- secondary = Colors.black_15,
121
- hint = Colors.black_12,
122
- disable = Colors.black_08
123
- ),
124
- border = BorderColors(
125
- default = Colors.black_04,
126
- disable = Colors.black_02
127
- ),
128
- success = ColorSet(
129
- primary = Colors.green_03,
130
- secondary = Colors.green_07,
131
- container = Colors.green_08
132
- ),
133
- warning = ColorSet(
134
- primary = Colors.orange_03,
135
- secondary = Colors.orange_07,
136
- container = Colors.orange_08
137
- ),
138
- error = ColorSet(
139
- primary = Colors.red_03,
140
- secondary = Colors.red_07,
141
- container = Colors.red_08,
142
- ),
143
- highlight = ColorSet(
144
- primary = Colors.mint_03,
145
- secondary = Colors.mint_07,
146
- container = Colors.mint_08
147
- ),
148
- interactive = ColorSet(
149
- primary = Colors.blue_03,
150
- secondary = Colors.blue_07,
151
- container = Colors.blue_08
152
- )
153
- ),
154
- font = LEGACY_DEFAULT_FONT_FAMILY,
155
- assets = ThemeAssets(
156
- headerBackground = null
157
- )
158
- )
159
-
160
-
161
- val darkTheme = Theme(
162
- dark = true,
163
- colors = ColorScheme(
164
- primary = Colors.pink_04,
165
- secondary = Colors.pink_08,
166
- gradient = Color(0xFFFDCADE),
167
- background = Background(
168
- default = Color(0xFF121212),
169
- surface = Color(0xFF1E1E1E),
170
- tonal = Colors.pink_10,
171
- pressed = Color(0xFF1A1A1A),
172
- selected = Colors.pink_11,
173
- disable = Color(0xFF303030)
174
- ),
175
- text = TextColors(
176
- default = Color.White,
177
- secondary = Color(0xFFB0B0B0),
178
- hint = Color(0xFF727272),
179
- disable = Color(0xFF505050)
180
- ),
181
- border = BorderColors(
182
- default = Color(0xFF2A2A2A),
183
- disable = Color(0xFF242424)
184
- ),
185
- success = ColorSet(
186
- primary = Colors.green_03,
187
- secondary = Colors.green_07,
188
- container = Colors.green_08
189
- ),
190
- warning = ColorSet(
191
- primary = Colors.orange_03,
192
- secondary = Colors.orange_07,
193
- container = Colors.orange_08
194
- ),
195
- error = ColorSet(
196
- primary = Colors.red_03,
197
- secondary = Colors.red_07,
198
- container = Colors.red_08,
199
- ),
200
- highlight = ColorSet(
201
- primary = Colors.mint_03,
202
- secondary = Colors.mint_07,
203
- container = Colors.mint_08
204
- ),
205
- interactive = ColorSet(
206
- primary = Colors.blue_03,
207
- secondary = Colors.blue_07,
208
- container = Colors.blue_08
209
- )
210
- ),
211
- font = LEGACY_DEFAULT_FONT_FAMILY,
212
- assets = ThemeAssets(
213
- headerBackground = null
214
- )
215
- )
216
-
217
-
218
- val AppTheme = staticCompositionLocalOf { defaultTheme }
219
-
220
- val AppStatusBar = staticCompositionLocalOf { 0.dp }
221
-
222
- 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.DesignSystemKits
12
- import vn.momo.kits.application.LocalContext
13
- import vn.momo.kits.platform.getScreenDimensions
14
- import kotlin.math.max
15
- import kotlin.math.min
16
-
17
- const val DEFAULT_SCREEN_SIZE = 375f
18
- const val MAX_FONT_SCALE = 1.5f
19
- const val MAX_DEVICE_SCALE = 5
20
-
21
- @Composable
22
- fun scaleSize(size: Float): Float {
23
- val context = LocalContext.current
24
- val useOsScale = context?.useOSScaleRate ?: DesignSystemKits.getConfigs().useOSScaleRate
25
- if (!useOsScale) {
26
- return size * (context?.userScaleRate ?: DesignSystemKits.getConfigs().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 = DesignSystemKits.getConfigs().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,54 +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.ExperimentalLayoutApi
8
- import androidx.compose.foundation.layout.FlowRow
9
- import androidx.compose.foundation.layout.PaddingValues
10
- import androidx.compose.foundation.layout.fillMaxWidth
11
- import androidx.compose.foundation.layout.padding
12
- import androidx.compose.foundation.shape.RoundedCornerShape
13
- import androidx.compose.runtime.Composable
14
- import androidx.compose.runtime.CompositionLocalProvider
15
- import androidx.compose.ui.Modifier
16
- import androidx.compose.ui.draw.clip
17
- import androidx.compose.ui.draw.shadow
18
- import androidx.compose.ui.graphics.Color
19
- import androidx.compose.ui.unit.dp
20
- import vn.momo.kits.components.Image
21
- import vn.momo.kits.const.AppTheme
22
- import vn.momo.kits.const.Radius
23
- import vn.momo.kits.const.Spacing
24
-
25
- @Composable
26
- @OptIn(ExperimentalLayoutApi::class)
27
- fun Card(
28
- useShadow: Boolean = false,
29
- backgroundImage: String? = null,
30
- backgroundColor: Color? = null,
31
- contentPadding: PaddingValues = PaddingValues(Spacing.M),
32
- modifier: Modifier = Modifier,
33
- content: @Composable () -> Unit,
34
- ) {
35
- val columns = gridColumns()
36
- val gap = Spacing.S
37
- val shape = RoundedCornerShape(Radius.M)
38
- var surface = modifier.fillMaxWidth().padding(horizontal = Spacing.M)
39
- if (useShadow) surface = surface.shadow(6.dp, shape)
40
- surface = surface.clip(shape).background(backgroundColor ?: AppTheme.current.colors.background.surface)
41
- Box(modifier = surface) {
42
- if (backgroundImage != null) {
43
- Image(source = backgroundImage, modifier = Modifier.matchParentSize())
44
- }
45
- BoxWithConstraints(modifier = Modifier.fillMaxWidth().padding(contentPadding)) {
46
- CompositionLocalProvider(LocalGridContext provides gridContext(constraints.maxWidth, columns, gap)) {
47
- FlowRow(
48
- horizontalArrangement = Arrangement.spacedBy(gap),
49
- verticalArrangement = Arrangement.spacedBy(gap),
50
- ) { content() }
51
- }
52
- }
53
- }
54
- }
@@ -1,51 +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.platform.LocalDensity
10
- import androidx.compose.ui.unit.Dp
11
- import androidx.compose.ui.unit.dp
12
- import vn.momo.kits.platform.getScreenDimensions
13
- import kotlin.math.floor
14
-
15
- internal data class GridContext(
16
- val numberOfColumns: Int = 12,
17
- val gutterPx: Int = 0,
18
- val columnPx: Float = 0f,
19
- val density: Float = 1f,
20
- ) {
21
- fun sizeForSpan(span: Int): Dp = (floor(columnPx * span + gutterPx * (span - 1)) / density).dp
22
- }
23
-
24
- internal val LocalGridContext = compositionLocalOf<GridContext?> { null }
25
-
26
- @Composable
27
- internal fun gridColumns(): Int = if (getScreenDimensions().width > 600) 24 else 12
28
-
29
- @Composable
30
- internal fun gridContext(maxWidthPx: Int, columns: Int, gap: Dp): GridContext {
31
- val density = LocalDensity.current
32
- val gutterPx = with(density) { gap.roundToPx() }
33
- return GridContext(columns, gutterPx, (maxWidthPx - gutterPx * (columns - 1)).toFloat() / columns, density.density)
34
- }
35
-
36
- @Composable
37
- fun Item(
38
- widthSpan: Int? = null,
39
- heightSpan: Int = 0,
40
- modifier: Modifier = Modifier,
41
- contentModifier: Modifier = Modifier,
42
- content: @Composable () -> Unit,
43
- ) {
44
- val grid = LocalGridContext.current
45
- var m = modifier
46
- if (grid != null) {
47
- m = m.width(grid.sizeForSpan(widthSpan ?: grid.numberOfColumns))
48
- if (heightSpan > 0) m = m.height(grid.sizeForSpan(heightSpan))
49
- }
50
- Column(modifier = m.then(contentModifier)) { content() }
51
- }
@@ -1,41 +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.ExperimentalLayoutApi
7
- import androidx.compose.foundation.layout.FlowRow
8
- import androidx.compose.foundation.layout.fillMaxWidth
9
- import androidx.compose.foundation.layout.padding
10
- import androidx.compose.runtime.Composable
11
- import androidx.compose.runtime.CompositionLocalProvider
12
- import androidx.compose.ui.Modifier
13
- import androidx.compose.ui.unit.dp
14
- import vn.momo.kits.components.Image
15
- import vn.momo.kits.const.Spacing
16
-
17
- @Composable
18
- @OptIn(ExperimentalLayoutApi::class)
19
- fun Section(
20
- useMargin: Boolean = true,
21
- backgroundImage: String? = null,
22
- modifier: Modifier = Modifier,
23
- content: @Composable () -> Unit,
24
- ) {
25
- val columns = gridColumns()
26
- val gap = Spacing.M
27
- val margin = if (useMargin) Spacing.M else 0.dp
28
- Box(modifier = Modifier.fillMaxWidth().padding(horizontal = margin).then(modifier)) {
29
- if (backgroundImage != null) {
30
- Image(source = backgroundImage, modifier = Modifier.matchParentSize())
31
- }
32
- BoxWithConstraints(modifier = Modifier.fillMaxWidth()) {
33
- CompositionLocalProvider(LocalGridContext provides gridContext(constraints.maxWidth, columns, gap)) {
34
- FlowRow(
35
- horizontalArrangement = Arrangement.spacedBy(gap),
36
- verticalArrangement = Arrangement.spacedBy(gap),
37
- ) { content() }
38
- }
39
- }
40
- }
41
- }
@@ -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
- }