@momo-kits/native-kits 0.152.4-beta.1 → 0.152.4-beta.10

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 (157) hide show
  1. package/CODE_OF_CONDUCT.md +133 -0
  2. package/CONTRIBUTING.md +114 -0
  3. package/LICENSE +20 -0
  4. package/README.md +7 -0
  5. package/build.gradle.kts +32 -0
  6. package/compose/MoMoComposeKits.podspec +54 -0
  7. package/compose/build.gradle.kts +149 -0
  8. package/compose/src/androidMain/AndroidManifest.xml +2 -0
  9. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +105 -0
  10. package/compose/src/commonMain/composeResources/files/lottie_circle_loader.json +1 -0
  11. package/compose/src/commonMain/composeResources/font/momosignature.otf +0 -0
  12. package/compose/src/commonMain/composeResources/font/momotrustdisplay.otf +0 -0
  13. package/compose/src/commonMain/composeResources/font/sfprotext_black.otf +0 -0
  14. package/compose/src/commonMain/composeResources/font/sfprotext_black.ttf +0 -0
  15. package/compose/src/commonMain/composeResources/font/sfprotext_bold.ttf +0 -0
  16. package/compose/src/commonMain/composeResources/font/sfprotext_heavy.ttf +0 -0
  17. package/compose/src/commonMain/composeResources/font/sfprotext_light.ttf +0 -0
  18. package/compose/src/commonMain/composeResources/font/sfprotext_medium.ttf +0 -0
  19. package/compose/src/commonMain/composeResources/font/sfprotext_regular.ttf +0 -0
  20. package/compose/src/commonMain/composeResources/font/sfprotext_semibold.ttf +0 -0
  21. package/compose/src/commonMain/composeResources/font/sfprotext_thin.otf +0 -0
  22. package/compose/src/commonMain/composeResources/font/sfprotext_thin.ttf +0 -0
  23. package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.otf +0 -0
  24. package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.ttf +0 -0
  25. package/compose/src/commonMain/kotlin/vn/momo/kits/application/AnimationSearchInput.kt +57 -0
  26. package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +201 -0
  27. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +222 -0
  28. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +48 -0
  29. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +86 -0
  30. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +76 -0
  31. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +76 -0
  32. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +306 -0
  33. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +33 -0
  34. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +715 -0
  35. package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +214 -0
  36. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +236 -0
  37. package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +69 -0
  38. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +77 -0
  39. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +27 -0
  40. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +334 -0
  41. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +345 -0
  42. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +90 -0
  43. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +131 -0
  44. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +543 -0
  45. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +23 -0
  46. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +58 -0
  47. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +143 -0
  48. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +179 -0
  49. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +111 -0
  50. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +384 -0
  51. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +160 -0
  52. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +234 -0
  53. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +223 -0
  54. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +232 -0
  55. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +236 -0
  56. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +228 -0
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +364 -0
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +50 -0
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +34 -0
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +85 -0
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +33 -0
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +338 -0
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +95 -0
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +64 -0
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +89 -0
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +91 -0
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +86 -0
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +84 -0
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +208 -0
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +172 -0
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +199 -0
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +29 -0
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +237 -0
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +191 -0
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +306 -0
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +12 -0
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +13 -0
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +191 -0
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +258 -0
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +2 -0
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +35 -0
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +2 -0
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +59 -0
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +68 -0
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +11 -0
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +49 -0
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +51 -0
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +232 -0
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +111 -0
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +94 -0
  91. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +159 -0
  92. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +232 -0
  93. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScaleSizeScope.kt +17 -0
  94. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +459 -0
  95. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +169 -0
  96. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +216 -0
  97. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +86 -0
  98. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +180 -0
  99. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +251 -0
  100. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +80 -0
  101. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +306 -0
  102. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +31 -0
  103. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +385 -0
  104. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +38 -0
  105. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +1329 -0
  106. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +62 -0
  107. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +88 -0
  108. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +144 -0
  109. package/gradle.properties +19 -0
  110. package/gradlew +240 -0
  111. package/gradlew.bat +91 -0
  112. package/ios/Application/ApplicationEnvironment.swift +50 -0
  113. package/ios/Application/Components.swift +263 -0
  114. package/ios/Application/ComposeApi.swift +22 -0
  115. package/ios/Application/FloatingButton.swift +172 -0
  116. package/ios/Application/HeaderRight.swift +271 -0
  117. package/ios/Application/Screen.swift +249 -0
  118. package/ios/Badge/Badge.swift +85 -0
  119. package/ios/Badge/BadgeDot.swift +31 -0
  120. package/ios/Badge/BadgeRibbon.swift +174 -0
  121. package/ios/Button/Button.swift +211 -0
  122. package/ios/CalculatorKeyboard/CalculatorKeyboard.swift +126 -0
  123. package/ios/Checkbox/Checkbox.swift +81 -0
  124. package/ios/Chip/Chip.swift +96 -0
  125. package/ios/Colors+Radius+Spacing/Colors.swift +172 -0
  126. package/ios/Colors+Radius+Spacing/Radius.swift +22 -0
  127. package/ios/Colors+Radius+Spacing/Spacing.swift +12 -0
  128. package/ios/Extensions/Color++.swift +25 -0
  129. package/ios/Icon/Icon.swift +51 -0
  130. package/ios/Image/Image.swift +70 -0
  131. package/ios/Input/Input.swift +207 -0
  132. package/ios/Input/InputPhoneNumber.swift +176 -0
  133. package/ios/Input/InputSearch.swift +238 -0
  134. package/ios/Input/InputTextArea.swift +242 -0
  135. package/ios/Lottie/LottieView.swift +86 -0
  136. package/ios/OTPKeyboard/KeyboardButton.swift +41 -0
  137. package/ios/OTPKeyboard/OTPKeyboard.swift +145 -0
  138. package/ios/Popup/PopupDisplay.swift +284 -0
  139. package/ios/Popup/PopupInput.swift +96 -0
  140. package/ios/Popup/PopupPromotion.swift +73 -0
  141. package/ios/PopupView/FullscreenPopup.swift +251 -0
  142. package/ios/PopupView/Modifiers.swift +158 -0
  143. package/ios/PopupView/PopupView.swift +289 -0
  144. package/ios/PopupView/Utils++.swift +281 -0
  145. package/ios/ScrollIndicator/ScrollIndicator.swift +110 -0
  146. package/ios/Swipeable/SwipeCell.swift +278 -0
  147. package/ios/Swipeable/SwipeCellModel.swift +86 -0
  148. package/ios/Switch/Switch.swift +44 -0
  149. package/ios/Template/Logo/Logo.swift +75 -0
  150. package/ios/Template/TrustBanner/TrustBanner.swift +120 -0
  151. package/ios/Theme.md +18 -0
  152. package/ios/Typography/Text.swift +140 -0
  153. package/ios/Typography/Typography.swift +95 -0
  154. package/ios/native-kits.podspec +18 -0
  155. package/package.json +6 -7
  156. package/settings.gradle.kts +25 -0
  157. package/shared/build.gradle.kts +0 -74
@@ -0,0 +1,172 @@
1
+
2
+ import Foundation
3
+ import SwiftUI
4
+
5
+ public enum Colors {
6
+ public static let primary = Color("Primary")
7
+ public static let primaryDark = Color("PrimaryDark")
8
+ public static let primaryLight = Color("PrimaryLight")
9
+ public static let secondary = Color("Secondary")
10
+ public static let background = Color("Background")
11
+ public static let border = Color("Border")
12
+ public static let text = Color("Text")
13
+ public static let textSecondary = Color("TextSecondary")
14
+ public static let card = Color("Card")
15
+ public static let error = Color("Error")
16
+ public static let info = Color("Info")
17
+ public static let success = Color("Success")
18
+
19
+ public static let black20 = Color(hex: "000000")
20
+ public static let black19 = Color(hex: "18191a")
21
+ public static let black18 = Color(hex: "242424")
22
+ public static let black17 = Color(hex: "303233")
23
+ public static let black16 = Color(hex: "404040")
24
+ public static let black15 = Color(hex: "484848")
25
+ public static let black14 = Color(hex: "565656")
26
+ public static let black13 = Color(hex: "646464")
27
+ public static let black12 = Color(hex: "727272")
28
+ public static let black11 = Color(hex: "878787")
29
+ public static let black10 = Color(hex: "a0a0a0")
30
+ public static let black09 = Color(hex: "b9b9b9")
31
+ public static let black08 = Color(hex: "c6c6c6")
32
+ public static let black07 = Color(hex: "cccccc")
33
+ public static let black06 = Color(hex: "d8d8d8")
34
+ public static let black05 = Color(hex: "e5e5e5")
35
+ public static let black04 = Color(hex: "e8e8e8")
36
+ public static let black03 = Color(hex: "f0f0f0")
37
+ public static let black02 = Color(hex: "f9f9f9")
38
+ public static let black01 = Color(hex: "ffffff")
39
+
40
+
41
+ public static let pink11 = Color(hex: "fef8fc")
42
+ public static let pink10 = Color(hex: "fef4fa")
43
+ public static let pink09 = Color(hex: "fdeaf4")
44
+ public static let pink08 = Color(hex: "fbd5ea")
45
+ public static let pink07 = Color(hex: "f7acd5")
46
+ public static let pink06 = Color(hex: "f382c0")
47
+ public static let pink05 = Color(hex: "ef59ab")
48
+ public static let pink04 = Color(hex: "ed43a0")
49
+ public static let pink03 = Color(hex: "eb2f96")
50
+ public static let pink02 = Color(hex: "d42a87")
51
+ public static let pink01 = Color(hex: "bc2678")
52
+
53
+
54
+ public static let violet10 = Color(hex: "fcf8fe")
55
+ public static let violet09 = Color(hex: "faf4fe")
56
+ public static let violet08 = Color(hex: "ead4fc")
57
+ public static let violet07 = Color(hex: "d5aaf9")
58
+ public static let violet06 = Color(hex: "f4e9fd")
59
+ public static let violet05 = Color(hex: "c07ff6")
60
+ public static let violet04 = Color(hex: "ab55f3")
61
+ public static let violet03 = Color(hex: "962af0")
62
+ public static let violet02 = Color(hex: "8726d8")
63
+ public static let violet01 = Color(hex: "7822c0")
64
+
65
+ public static let indigo11 = Color(hex: "f9f9ff")
66
+ public static let indigo10 = Color(hex: "f6f6ff")
67
+ public static let indigo09 = Color(hex: "ededff")
68
+ public static let indigo08 = Color(hex: "dcdbff")
69
+ public static let indigo07 = Color(hex: "b8b7ff")
70
+ public static let indigo06 = Color(hex: "9593ff")
71
+ public static let indigo05 = Color(hex: "716fff")
72
+ public static let indigo04 = Color(hex: "5f5dff")
73
+ public static let indigo03 = Color(hex: "4e4bff")
74
+ public static let indigo02 = Color(hex: "4644e6")
75
+ public static let indigo01 = Color(hex: "3e3ccc")
76
+
77
+ public static let blue11 = Color(hex: "f7fbff")
78
+ public static let blue10 = Color(hex: "f2f8ff")
79
+ public static let blue09 = Color(hex: "e5f1ff")
80
+ public static let blue08 = Color(hex: "cce4ff")
81
+ public static let blue07 = Color(hex: "99caff")
82
+ public static let blue06 = Color(hex: "66afff")
83
+ public static let blue05 = Color(hex: "3395ff")
84
+ public static let blue04 = Color(hex: "1987ff")
85
+ public static let blue03 = Color(hex: "007aff")
86
+ public static let blue02 = Color(hex: "006ee6")
87
+ public static let blue01 = Color(hex: "0062cc")
88
+
89
+ public static let mint11 = Color(hex: "f8fdfd")
90
+ public static let mint10 = Color(hex: "f3fcfc")
91
+ public static let mint09 = Color(hex: "e7f8f8")
92
+ public static let mint08 = Color(hex: "d0f3f3")
93
+ public static let mint07 = Color(hex: "a1e7e7")
94
+ public static let mint06 = Color(hex: "71dada")
95
+ public static let mint05 = Color(hex: "42cece")
96
+ public static let mint04 = Color(hex: "2ac8c8")
97
+ public static let mint03 = Color(hex: "13c2c2")
98
+ public static let mint02 = Color(hex: "11afaf")
99
+ public static let mint01 = Color(hex: "0f9b9b")
100
+
101
+ public static let green11 = Color(hex: "f9fdfa")
102
+ public static let green10 = Color(hex: "f5fcf6")
103
+ public static let green09 = Color(hex: "eaf9ee")
104
+ public static let green08 = Color(hex: "d6f4de")
105
+ public static let green07 = Color(hex: "aee9bd")
106
+ public static let green06 = Color(hex: "85dd9b")
107
+ public static let green05 = Color(hex: "5dd27a")
108
+ public static let green04 = Color(hex: "48cc69")
109
+ public static let green03 = Color(hex: "34c759")
110
+ public static let green02 = Color(hex: "2fb350")
111
+ public static let green01 = Color(hex: "2a9f47")
112
+
113
+ public static let lime11 = Color(hex: "fcfef8")
114
+ public static let lime10 = Color(hex: "fafdf3")
115
+ public static let lime09 = Color(hex: "f5fbe7")
116
+ public static let lime08 = Color(hex: "ecf7cf")
117
+ public static let lime07 = Color(hex: "d9f0a0")
118
+ public static let lime06 = Color(hex: "c6e870")
119
+ public static let lime05 = Color(hex: "b3e141")
120
+ public static let lime04 = Color(hex: "a9dc28")
121
+ public static let lime03 = Color(hex: "a0d911")
122
+ public static let lime02 = Color(hex: "90c30f")
123
+ public static let lime01 = Color(hex: "80ae0e")
124
+
125
+ public static let yellow11 = Color(hex: "fffdf7")
126
+ public static let yellow10 = Color(hex: "fffcf2")
127
+ public static let yellow09 = Color(hex: "fff9e5")
128
+ public static let yellow08 = Color(hex: "fff5cc")
129
+ public static let yellow07 = Color(hex: "ffeb99")
130
+ public static let yellow06 = Color(hex: "ffe066")
131
+ public static let yellow05 = Color(hex: "ffd633")
132
+ public static let yellow04 = Color(hex: "ffd119")
133
+ public static let yellow03 = Color(hex: "fc0")
134
+ public static let yellow02 = Color(hex: "e6b800")
135
+ public static let yellow01 = Color(hex: "cca300")
136
+
137
+ public static let gold11 = Color(hex: "fefbf8")
138
+ public static let gold10 = Color(hex: "fff9f3")
139
+ public static let gold09 = Color(hex: "fef3e7")
140
+ public static let gold08 = Color(hex: "fee8d0")
141
+ public static let gold07 = Color(hex: "fdd1a2")
142
+ public static let gold06 = Color(hex: "fcba73")
143
+ public static let gold05 = Color(hex: "fba345")
144
+ public static let gold04 = Color(hex: "fa972d")
145
+ public static let gold03 = Color(hex: "fa8c16")
146
+ public static let gold02 = Color(hex: "e17e14")
147
+ public static let gold01 = Color(hex: "c87012")
148
+
149
+ public static let orange11 = Color(hex: "fefaf8")
150
+ public static let orange10 = Color(hex: "fff6f3")
151
+ public static let orange09 = Color(hex: "feede8")
152
+ public static let orange08 = Color(hex: "feddd2")
153
+ public static let orange07 = Color(hex: "fdbba4")
154
+ public static let orange06 = Color(hex: "fc9877")
155
+ public static let orange05 = Color(hex: "fb7649")
156
+ public static let orange04 = Color(hex: "fa6532")
157
+ public static let orange03 = Color(hex: "fa541c")
158
+ public static let orange02 = Color(hex: "e14c19")
159
+ public static let orange01 = Color(hex: "c84316")
160
+
161
+ public static let red11 = Color(hex: "fef8f8")
162
+ public static let red10 = Color(hex: "fef4f4")
163
+ public static let red09 = Color(hex: "fee8ea")
164
+ public static let red08 = Color(hex: "fdd3d5")
165
+ public static let red07 = Color(hex: "fba7ab")
166
+ public static let red06 = Color(hex: "f97a81")
167
+ public static let red05 = Color(hex: "f74e57")
168
+ public static let red04 = Color(hex: "f63842")
169
+ public static let red03 = Color(hex: "f5222d")
170
+ public static let red02 = Color(hex: "dd1f29")
171
+ public static let red01 = Color(hex: "c41b24")
172
+ }
@@ -0,0 +1,22 @@
1
+ import SwiftUI
2
+ import Foundation
3
+
4
+ public enum Radius {
5
+ public static let XXS: CGFloat = 2
6
+ public static let XS: CGFloat = 4
7
+ public static let S: CGFloat = 8
8
+ public static let M: CGFloat = 12
9
+ public static let L: CGFloat = 16
10
+ public static let XL: CGFloat = 24
11
+ }
12
+
13
+ public struct RoundedCorner: Shape {
14
+
15
+ var radius: CGFloat = .infinity
16
+ var corners: UIRectCorner = .allCorners
17
+
18
+ public func path(in rect: CGRect) -> Path {
19
+ let path = UIBezierPath(roundedRect: rect, byRoundingCorners: corners, cornerRadii: CGSize(width: radius, height: radius))
20
+ return Path(path.cgPath)
21
+ }
22
+ }
@@ -0,0 +1,12 @@
1
+ import Foundation
2
+
3
+ public enum Spacing {
4
+ public static let XXS: CGFloat = 2
5
+ public static let XS: CGFloat = 4
6
+ public static let S: CGFloat = 8
7
+ public static let M: CGFloat = 12
8
+ public static let L: CGFloat = 16
9
+ public static let XL: CGFloat = 24
10
+ public static let XXL: CGFloat = 32
11
+ public static let XXXL: CGFloat = 48
12
+ }
@@ -0,0 +1,25 @@
1
+ import SwiftUI
2
+
3
+ public extension Color {
4
+ init(hex: UInt, alpha: Double = 1) {
5
+ self.init(
6
+ .sRGB,
7
+ red: Double((hex >> 16) & 0xFF) / 255,
8
+ green: Double((hex >> 08) & 0xFF) / 255,
9
+ blue: Double((hex >> 00) & 0xFF) / 255,
10
+ opacity: alpha
11
+ )
12
+ }
13
+
14
+ init(hex: String) {
15
+ let scanner = Scanner(string: hex)
16
+ var rgbValue: UInt64 = 0
17
+ scanner.scanHexInt64(&rgbValue)
18
+
19
+ let r = (rgbValue & 0xff0000) >> 16
20
+ let g = (rgbValue & 0xff00) >> 8
21
+ let b = rgbValue & 0xff
22
+
23
+ self.init(red: Double(r) / 0xff, green: Double(g) / 0xff, blue: Double(b) / 0xff)
24
+ }
25
+ }
@@ -0,0 +1,51 @@
1
+ import SwiftUI
2
+
3
+ struct IconSource: Codable {
4
+ let uri: String
5
+ }
6
+
7
+ func loadIconSources() -> [String: IconSource] {
8
+ guard let url = Bundle.main.url(forResource: "icon", withExtension: "json") else {
9
+ print("Error: icon.json not found")
10
+ return [:]
11
+ }
12
+
13
+ do {
14
+ let data = try Data(contentsOf: url)
15
+ let decoded = try JSONDecoder().decode([String: IconSource].self, from: data)
16
+ return decoded
17
+ } catch {
18
+ print("Error decoding icon.json: \(error)")
19
+ return [:]
20
+ }
21
+ }
22
+
23
+ // Load the JSON data into a global variable
24
+ let iconSources: [String: IconSource] = loadIconSources()
25
+
26
+ // Icon ViewModel
27
+ public struct Icon: View {
28
+ var source: String
29
+ var size: CGFloat
30
+ var color: Color?
31
+ var accessibilityLabel: String?
32
+
33
+ public init(
34
+ source: String,
35
+ size: CGFloat = 24,
36
+ color: Color? = nil,
37
+ accessibilityLabel: String? = nil
38
+ ) {
39
+ self.source = source
40
+ self.size = size
41
+ self.color = color
42
+ self.accessibilityLabel = accessibilityLabel
43
+ }
44
+
45
+ public var body: some View {
46
+ if let uri = iconSources[source]?.uri {
47
+ ImageView(uri, color: color).frame(width: size, height: size)
48
+ }
49
+ }
50
+ }
51
+
@@ -0,0 +1,70 @@
1
+
2
+
3
+ import Foundation
4
+ import SDWebImageSwiftUI
5
+ import SkeletonUI
6
+ import SwiftUI
7
+
8
+ public struct ImageView: View {
9
+ // MARK: Lifecycle
10
+
11
+ public init(_ url: String, aspectRatio: CGFloat? = nil, contentMode: ContentMode = ContentMode.fit, placeholder: AnyView? = nil, color: Color? = nil) {
12
+ self.url = url
13
+ self.aspectRatio = aspectRatio
14
+ self.contentMode = contentMode
15
+ self.placeholder = placeholder
16
+ self.color = color
17
+ }
18
+
19
+ // MARK: Public
20
+
21
+ public var body: some View {
22
+ return WebImage(url: URL(string: url), isAnimating: .constant(true))
23
+ .onFailure { _ in
24
+ error = true
25
+ }
26
+ .onSuccess { _, _, _ in
27
+ error = false
28
+ }
29
+ .resizable()
30
+ .renderingMode(color != nil ? .template : .original)
31
+ .placeholder {
32
+ VStack(alignment: .center, content: {
33
+ if error {
34
+ Image(systemName: "photo.badge.exclamationmark").frame(width: 24, height: 24)
35
+ } else if placeholder != nil {
36
+ placeholder
37
+ }
38
+ })
39
+ .frame(maxWidth: .infinity, maxHeight: .infinity)
40
+ .skeleton(with: !error && placeholder == nil)
41
+ .shape(type: .rectangle)
42
+ }
43
+ .scaledToFit()
44
+ .transition(.fade)
45
+ .aspectRatio(aspectRatio, contentMode: contentMode)
46
+ .foregroundColor(color)
47
+ }
48
+
49
+ // MARK: Internal
50
+
51
+ var aspectRatio: CGFloat?
52
+ var contentMode: ContentMode
53
+ var placeholder: AnyView?
54
+ var color: Color?
55
+
56
+ @State var error: Bool = false
57
+ var url: String
58
+ }
59
+
60
+ private struct ColorMultiplyModifier: ViewModifier {
61
+ let color: Color?
62
+
63
+ func body(content: Content) -> some View {
64
+ if let color {
65
+ content.colorMultiply(color)
66
+ } else {
67
+ content
68
+ }
69
+ }
70
+ }
@@ -0,0 +1,207 @@
1
+ import Foundation
2
+ import SwiftUI
3
+
4
+
5
+ fileprivate struct FloatingComponent: View {
6
+ var floatingValue: String
7
+ var floatingIcon: AnyView?
8
+
9
+ public init (_ floatingValue: String = "", floatingIcon: AnyView? = nil){
10
+ self.floatingValue = floatingValue
11
+ self.floatingIcon = floatingIcon
12
+ }
13
+
14
+ public var body: some View {
15
+ return HStack {
16
+ Text(floatingValue)
17
+ .font(.paragraph)
18
+ .foregroundColor(Colors.black09)
19
+ .font(.system(size: 12))
20
+ .padding(.leading, 8)
21
+ .padding(.trailing, 8)
22
+ floatingIcon
23
+ }
24
+ .background(Colors.black01)
25
+ .offset(x: 16, y:-8)
26
+ .zIndex(10)
27
+ }
28
+ }
29
+
30
+ struct DotTextField: View{
31
+ @Binding var value: String
32
+ @State var isHide: Bool = true
33
+
34
+
35
+ func onToggle(){
36
+ isHide.toggle()
37
+ }
38
+
39
+ public var body: some View {
40
+ return HStack {
41
+ if (isHide){
42
+ SecureField("", text: $value)
43
+ }
44
+ else {
45
+ TextField("", text: $value)
46
+ }
47
+
48
+ SwiftButton(action: onToggle){
49
+ Image(systemName: isHide ? "eye.slash" : "eye")
50
+ .foregroundColor(Colors.text)
51
+ .frame(width: 16, height: 16)
52
+ .padding(.leading, -4)
53
+ }
54
+
55
+
56
+ }
57
+
58
+ }
59
+ }
60
+
61
+ public struct Input: View {
62
+ @Binding var value: String
63
+ @State var focused: Bool = false
64
+
65
+ var placeholder: String
66
+ var floatingValue: String
67
+ var errorMessage: String
68
+ var isSecure: Bool
69
+ var keyboardType: UIKeyboardType
70
+ var floatingIcon: AnyView?
71
+ var rightIcon: AnyView?
72
+ var onChange: ((String) -> Void)?
73
+ var onBlur: (() -> Void)?
74
+ var floatingIconURL: String?
75
+ var floatingIconColor: Color?
76
+ var size: InputSize
77
+ var fontWeight: InputFontWeight
78
+ var disabled: Bool
79
+ var leadingIcon: String?
80
+ var leadingIconColor: Color?
81
+ var loading: Bool
82
+ var required: Bool
83
+ var hintText: String?
84
+
85
+ func onCancel(){
86
+ self.value.removeAll()
87
+ }
88
+
89
+ public init(_ value: Binding<String>, placeholder: String = "", floatingValue: String = "", multilines: Bool = false, errorMessage: String = "", isSecure: Bool = false, keyboardType: UIKeyboardType = .default, floatingIcon: AnyView? = nil, rightIcon: AnyView? = nil, onChange: ((String)->Void)? = nil, onBlur: (()->Void)? = nil, floatingIconURL: String? = nil, floatingIconColor: Color? = Colors.pink03, size: InputSize = .small, fontWeight: InputFontWeight = .regular, disabled: Bool = false, leadingIcon: String? = nil, leadingIconColor: Color? = Colors.pink03, loading: Bool = false, required: Bool = false, hintText: String? = nil){
90
+ self.placeholder = placeholder
91
+ self.floatingValue = floatingValue
92
+ self.errorMessage = errorMessage
93
+ self.isSecure = isSecure
94
+ self._value = value
95
+ self.keyboardType = keyboardType
96
+ self.rightIcon = rightIcon
97
+ self.floatingIcon = floatingIcon
98
+ self.onChange = onChange
99
+ self.floatingIconURL = floatingIconURL
100
+ self.floatingIconColor = floatingIconColor
101
+ self.size = size
102
+ self.fontWeight = fontWeight
103
+ self.disabled = disabled
104
+ self.leadingIcon = leadingIcon
105
+ self.leadingIconColor = leadingIconColor
106
+ self.loading = loading
107
+ self.required = required
108
+ self.hintText = hintText
109
+ }
110
+
111
+ func onChangeText(value: String){
112
+ onChange?(value)
113
+ }
114
+
115
+ public var body: some View {
116
+ VStack(alignment: .leading, spacing: 4) {
117
+ ZStack(alignment: .topLeading) {
118
+ HStack(alignment: .center) {
119
+ if let leadingIcon = leadingIcon {
120
+ Icon(source: leadingIcon, size: 16, color: leadingIconColor)
121
+ }
122
+
123
+ if !isSecure {
124
+ TextField("", text: $value, onEditingChanged: { isChange in
125
+ self.focused = isChange
126
+ })
127
+ .disabled(disabled)
128
+ .font(fontWeight == .bold ? .headline : .body)
129
+ } else {
130
+ DotTextField(value: $value)
131
+ .disabled(disabled)
132
+ }
133
+
134
+ if loading {
135
+ ActivityIndicator(isAnimating: .constant(true), style: .medium)
136
+ .frame(width: 20, height: 20)
137
+ } else if !value.isEmpty {
138
+ SwiftButton(action: onCancel){
139
+ Image(systemName: "x.circle.fill")
140
+ .foregroundColor(Colors.text)
141
+ .frame(width: 16, height: 16)
142
+ .padding(.leading, -4)
143
+ .padding(.trailing, 8)
144
+ }
145
+ }
146
+
147
+ rightIcon
148
+ }
149
+ .padding(.horizontal, 12)
150
+ .frame(height: size == .small ? 40 : 48)
151
+ .background(disabled ? Colors.black01 : Color.white)
152
+ .overlay(RoundedRectangle(cornerRadius: 8).stroke(focused ? Colors.pink03 : Colors.border, lineWidth: 1))
153
+
154
+ if value.isEmpty {
155
+ Text(placeholder + (required ? " *" : ""))
156
+ .foregroundColor(Colors.black09)
157
+ .padding(.horizontal, leadingIcon == nil ? 12 : 32)
158
+ .padding(.top, 12)
159
+ .allowsHitTesting(false)
160
+ }
161
+
162
+ if !floatingValue.isEmpty {
163
+ FloatingComponent(floatingValue, floatingIcon: floatingIconURL.map { url in
164
+ AnyView(
165
+ Icon(source: url, size: 16, color: floatingIconColor)
166
+ )
167
+ })
168
+
169
+ }
170
+ }
171
+
172
+ if !errorMessage.isEmpty {
173
+ Text(errorMessage)
174
+ .foregroundColor(.red)
175
+ .font(.caption)
176
+ } else if let hint = hintText {
177
+ Text(hint)
178
+ .foregroundColor(Colors.black09)
179
+ .font(.caption)
180
+ }
181
+ }
182
+ }
183
+ }
184
+
185
+
186
+ struct ActivityIndicator: UIViewRepresentable {
187
+ @Binding var isAnimating: Bool
188
+ let style: UIActivityIndicatorView.Style
189
+
190
+ func makeUIView(context: UIViewRepresentableContext<ActivityIndicator>) -> UIActivityIndicatorView {
191
+ return UIActivityIndicatorView(style: style)
192
+ }
193
+
194
+ func updateUIView(_ uiView: UIActivityIndicatorView, context: UIViewRepresentableContext<ActivityIndicator>) {
195
+ isAnimating ? uiView.startAnimating() : uiView.stopAnimating()
196
+ }
197
+ }
198
+
199
+ public enum InputSize {
200
+ case small
201
+ case large
202
+ }
203
+
204
+ public enum InputFontWeight {
205
+ case regular
206
+ case bold
207
+ }