@momo-kits/native-kits 0.110.1-sp.4 → 0.110.1-sp.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +8 -9
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +5 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +1 -5
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +2 -1
- package/ios/Checkbox/Checkbox.swift +77 -15
- package/ios/Icon/Icon.swift +53 -0
- package/ios/Input/Input.swift +104 -46
- package/ios/Input/InputSearch.swift +182 -0
- package/ios/Input/InputTextArea.swift +242 -0
- package/ios/Switch/Switch.swift +26 -26
- package/ios/Typography/Typography.swift +47 -4
- package/package.json +1 -1
|
@@ -22,6 +22,14 @@ import vn.momo.kits.const.defaultTheme
|
|
|
22
22
|
import vn.momo.kits.platform.disableOverscroll
|
|
23
23
|
import vn.momo.kits.platform.getStatusBarHeight
|
|
24
24
|
|
|
25
|
+
val PlatformApi = staticCompositionLocalOf<Any?> { null }
|
|
26
|
+
|
|
27
|
+
interface ComposeApi {
|
|
28
|
+
fun request(funcName: String, params: String?): String
|
|
29
|
+
fun request(funcName: String, params: String?, onResponse: ((String) -> Unit)?): String
|
|
30
|
+
fun requestCallback(funcName: String, params: String?, onResponse: ((String) -> Unit)?)
|
|
31
|
+
fun removeCallback(id: String)
|
|
32
|
+
}
|
|
25
33
|
|
|
26
34
|
val AppNavigator = staticCompositionLocalOf<Navigator> {
|
|
27
35
|
error("no navigator provided!")
|
|
@@ -59,15 +67,6 @@ class Navigator {
|
|
|
59
67
|
}
|
|
60
68
|
}
|
|
61
69
|
|
|
62
|
-
val PlatformApi = staticCompositionLocalOf<Any?> { null }
|
|
63
|
-
|
|
64
|
-
interface ComposeApi {
|
|
65
|
-
fun request(funcName: String, params: String?): String
|
|
66
|
-
fun request(funcName: String, params: String?, onResponse: ((String) -> Unit)?): String
|
|
67
|
-
fun requestCallback(funcName: String, params: String?, onResponse: ((String) -> Unit)?)
|
|
68
|
-
fun removeCallback(id: String)
|
|
69
|
-
}
|
|
70
|
-
|
|
71
70
|
@Composable
|
|
72
71
|
fun ApplicationContainer(
|
|
73
72
|
theme: Theme = defaultTheme,
|
|
@@ -45,6 +45,7 @@ import vn.momo.kits.const.AppTheme
|
|
|
45
45
|
import vn.momo.kits.const.Radius
|
|
46
46
|
import vn.momo.kits.const.Spacing
|
|
47
47
|
import vn.momo.kits.const.Typography
|
|
48
|
+
import vn.momo.kits.modifier.setAutomationId
|
|
48
49
|
|
|
49
50
|
data class InputSizeDetail(
|
|
50
51
|
val borderWidth: Dp,
|
|
@@ -178,6 +179,7 @@ fun Input(
|
|
|
178
179
|
required: Boolean = false,
|
|
179
180
|
fontWeight: InputFontWeight = InputFontWeight.REGULAR,
|
|
180
181
|
keyboardType: KeyboardType = KeyboardType.Text,
|
|
182
|
+
modifier: Modifier = Modifier,
|
|
181
183
|
) {
|
|
182
184
|
var isFocused by remember { mutableStateOf(false) }
|
|
183
185
|
var passHidden by remember { mutableStateOf(false) }
|
|
@@ -203,9 +205,9 @@ fun Input(
|
|
|
203
205
|
|
|
204
206
|
val testId = if (disabled) "input_${floatingValue}_disabled" else "input_$floatingValue"
|
|
205
207
|
|
|
206
|
-
Column(modifier = Modifier.
|
|
207
|
-
|
|
208
|
-
|
|
208
|
+
Column(modifier = Modifier.
|
|
209
|
+
setAutomationId(testId)
|
|
210
|
+
) {
|
|
209
211
|
BasicTextField(
|
|
210
212
|
enabled = !disabled,
|
|
211
213
|
readOnly = readOnly,
|
|
@@ -3,9 +3,6 @@ package vn.momo.kits.components
|
|
|
3
3
|
import androidx.compose.runtime.Composable
|
|
4
4
|
import androidx.compose.ui.Modifier
|
|
5
5
|
import androidx.compose.ui.graphics.Color
|
|
6
|
-
import androidx.compose.ui.semantics.contentDescription
|
|
7
|
-
import androidx.compose.ui.semantics.semantics
|
|
8
|
-
import androidx.compose.ui.semantics.testTag
|
|
9
6
|
import androidx.compose.ui.text.TextLayoutResult
|
|
10
7
|
import androidx.compose.ui.text.TextStyle
|
|
11
8
|
import androidx.compose.ui.text.style.TextAlign
|
|
@@ -18,7 +15,6 @@ import vn.momo.kits.const.Typography
|
|
|
18
15
|
import vn.momo.kits.const.getFontFamily
|
|
19
16
|
import vn.momo.kits.const.scaleSize
|
|
20
17
|
import vn.momo.kits.modifier.setAutomationId
|
|
21
|
-
import vn.momo.kits.platform.getPlatformName
|
|
22
18
|
|
|
23
19
|
@Composable
|
|
24
20
|
fun Text(
|
|
@@ -38,7 +34,7 @@ fun Text(
|
|
|
38
34
|
val font = getFontFamily(fontFamily, style.fontWeight)
|
|
39
35
|
|
|
40
36
|
androidx.compose.material3.Text(
|
|
41
|
-
modifier = modifier.setAutomationId(accessibilityId?:text),
|
|
37
|
+
modifier = modifier.setAutomationId(accessibilityId?:text, text),
|
|
42
38
|
text = text,
|
|
43
39
|
color = color ?: AppTheme.current.colors.text.default,
|
|
44
40
|
style = style,
|
|
@@ -11,7 +11,7 @@ import androidx.compose.ui.semantics.semantics
|
|
|
11
11
|
import androidx.compose.ui.semantics.testTag
|
|
12
12
|
import vn.momo.kits.platform.getPlatformName
|
|
13
13
|
|
|
14
|
-
fun Modifier.setAutomationId(accessibilityId : String) : Modifier {
|
|
14
|
+
fun Modifier.setAutomationId(accessibilityId : String, label: String? = null) : Modifier {
|
|
15
15
|
return if (getPlatformName() == "Android") {
|
|
16
16
|
semantics {
|
|
17
17
|
contentDescription = accessibilityId
|
|
@@ -19,6 +19,7 @@ fun Modifier.setAutomationId(accessibilityId : String) : Modifier {
|
|
|
19
19
|
} else {
|
|
20
20
|
semantics {
|
|
21
21
|
testTag = accessibilityId
|
|
22
|
+
contentDescription = label ?: accessibilityId
|
|
22
23
|
}
|
|
23
24
|
}
|
|
24
25
|
}
|
|
@@ -5,11 +5,18 @@ public struct Checkbox: View{
|
|
|
5
5
|
@Binding var checked: Bool
|
|
6
6
|
var disabled: Bool
|
|
7
7
|
var onChange: ((Bool)->Void)?
|
|
8
|
+
var indeterminate: Bool
|
|
9
|
+
var title: String
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
|
|
12
|
+
public init(_ checked: Binding<Bool>,disabled: Bool = false, onChange: ( (Bool) -> Void)? = nil,
|
|
13
|
+
indeterminate: Bool = false,
|
|
14
|
+
title: String = ""){
|
|
10
15
|
self._checked = checked
|
|
11
|
-
self.onChange = onChange
|
|
12
16
|
self.disabled = disabled
|
|
17
|
+
self.onChange = onChange
|
|
18
|
+
self.indeterminate = indeterminate
|
|
19
|
+
self.title = title
|
|
13
20
|
}
|
|
14
21
|
|
|
15
22
|
func onCheck(){
|
|
@@ -17,22 +24,77 @@ public struct Checkbox: View{
|
|
|
17
24
|
onChange?(checked)
|
|
18
25
|
}
|
|
19
26
|
|
|
20
|
-
public var body: some View{
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
27
|
+
public var body: some View {
|
|
28
|
+
HStack(spacing: Spacing.S) {
|
|
29
|
+
// Checkbox
|
|
30
|
+
ZStack {
|
|
31
|
+
RoundedRectangle(cornerRadius: Radius.XS)
|
|
32
|
+
.fill(backgroundColor)
|
|
33
|
+
.frame(width: 20, height: 20)
|
|
34
|
+
.overlay(
|
|
35
|
+
RoundedRectangle(cornerRadius: Radius.XS)
|
|
36
|
+
.stroke(borderColor, lineWidth: Spacing.XXS)
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
if checked {
|
|
40
|
+
Image(systemName: indeterminate ? "minus" : "checkmark")
|
|
25
41
|
.resizable()
|
|
26
|
-
.foregroundColor(
|
|
27
|
-
.frame(width:
|
|
42
|
+
.foregroundColor(Colors.black01)
|
|
43
|
+
.frame(width: 12, height: 12)
|
|
28
44
|
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
45
|
+
}
|
|
46
|
+
.onTapGesture {
|
|
47
|
+
if !disabled {
|
|
48
|
+
onChange?(checked)
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Title
|
|
53
|
+
if !title.isEmpty {
|
|
54
|
+
Text(title)
|
|
55
|
+
.font(.description1)
|
|
56
|
+
}
|
|
33
57
|
}
|
|
34
|
-
.opacity(disabled ? 0.4 : 1)
|
|
35
|
-
.disabled(disabled)
|
|
36
58
|
}
|
|
37
59
|
|
|
60
|
+
private var borderColor: Color {
|
|
61
|
+
if disabled {
|
|
62
|
+
return Colors.black03
|
|
63
|
+
} else if checked {
|
|
64
|
+
return Colors.primary
|
|
65
|
+
} else {
|
|
66
|
+
return Colors.text
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
private var backgroundColor: Color {
|
|
71
|
+
if disabled && checked {
|
|
72
|
+
return Colors.pink08
|
|
73
|
+
} else if checked {
|
|
74
|
+
return Colors.primary
|
|
75
|
+
} else {
|
|
76
|
+
return Colors.black01
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
// public var body: some View{
|
|
83
|
+
// return SwiftUI.Button(action: onCheck) {
|
|
84
|
+
// HStack {
|
|
85
|
+
// if (checked) {
|
|
86
|
+
// Image(systemName: "checkmark.square.fill")
|
|
87
|
+
// .resizable()
|
|
88
|
+
// .foregroundColor(disabled ? Colors.black07 : Colors.primary)
|
|
89
|
+
// .frame(width: 24, height: 24)
|
|
90
|
+
// }
|
|
91
|
+
// }.frame(width: 24, height: 24)
|
|
92
|
+
// .overlay(RoundedRectangle(cornerRadius: 4).stroke(Colors.black20,lineWidth: checked ? 0 : 1))
|
|
93
|
+
// .background(Colors.black01)
|
|
94
|
+
//
|
|
95
|
+
// }
|
|
96
|
+
// .opacity(disabled ? 0.4 : 1)
|
|
97
|
+
// .disabled(disabled)
|
|
98
|
+
// }
|
|
99
|
+
|
|
38
100
|
}
|
|
@@ -0,0 +1,53 @@
|
|
|
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)
|
|
48
|
+
.frame(width: size, height: size)
|
|
49
|
+
.foregroundColor(color)
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
package/ios/Input/Input.swift
CHANGED
|
@@ -71,12 +71,22 @@ public struct Input: View {
|
|
|
71
71
|
var rightIcon: AnyView?
|
|
72
72
|
var onChange: ((String) -> Void)?
|
|
73
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?
|
|
74
84
|
|
|
75
85
|
func onCancel(){
|
|
76
86
|
self.value.removeAll()
|
|
77
87
|
}
|
|
78
88
|
|
|
79
|
-
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){
|
|
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){
|
|
80
90
|
self.placeholder = placeholder
|
|
81
91
|
self.floatingValue = floatingValue
|
|
82
92
|
self.errorMessage = errorMessage
|
|
@@ -86,6 +96,16 @@ public struct Input: View {
|
|
|
86
96
|
self.rightIcon = rightIcon
|
|
87
97
|
self.floatingIcon = floatingIcon
|
|
88
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
|
|
89
109
|
}
|
|
90
110
|
|
|
91
111
|
func onChangeText(value: String){
|
|
@@ -93,57 +113,95 @@ public struct Input: View {
|
|
|
93
113
|
}
|
|
94
114
|
|
|
95
115
|
public var body: some View {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
})
|
|
102
|
-
.font(.paragraph)
|
|
103
|
-
.padding(.horizontal, 12)
|
|
104
|
-
.accentColor(Colors.pink03)
|
|
105
|
-
.keyboardType(keyboardType)
|
|
106
|
-
.valueChanged(value: value, onChange: onChangeText)
|
|
107
|
-
|
|
108
|
-
HStack{
|
|
109
|
-
SwiftButton(action: onCancel){
|
|
110
|
-
Image(systemName: "x.circle.fill")
|
|
111
|
-
.foregroundColor(Colors.text)
|
|
112
|
-
.frame(width: 16, height: 16)
|
|
113
|
-
.padding(.leading, -4)
|
|
114
|
-
.padding(.trailing, 8)
|
|
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)
|
|
115
121
|
}
|
|
116
122
|
|
|
117
|
-
|
|
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
|
+
}
|
|
118
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
|
|
119
148
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
.
|
|
128
|
-
.padding(.
|
|
129
|
-
.padding(.
|
|
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
|
+
|
|
130
169
|
}
|
|
131
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
|
+
}
|
|
132
181
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
.allowsHitTesting(false)
|
|
144
|
-
}
|
|
145
|
-
if (!floatingValue.isEmpty) {FloatingComponent(floatingValue, floatingIcon: floatingIcon)}
|
|
146
|
-
}.padding(.bottom, 8)
|
|
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)
|
|
147
192
|
}
|
|
148
|
-
|
|
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
|
|
149
207
|
}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
//
|
|
2
|
+
// InputSearch.swift
|
|
3
|
+
// Pods
|
|
4
|
+
//
|
|
5
|
+
// Created by dung.pham2 on 3/12/24.
|
|
6
|
+
//
|
|
7
|
+
import SwiftUI
|
|
8
|
+
|
|
9
|
+
// MARK: - RenderRightIconSearch
|
|
10
|
+
|
|
11
|
+
struct RenderRightIconSearch: View {
|
|
12
|
+
let loading: Bool
|
|
13
|
+
let icon: String
|
|
14
|
+
let color: Color
|
|
15
|
+
let onClick: () -> Void
|
|
16
|
+
|
|
17
|
+
var body: some View {
|
|
18
|
+
HStack(spacing: 0) {
|
|
19
|
+
if loading {
|
|
20
|
+
ActivityIndicator(isAnimating: .constant(true), style: .medium)
|
|
21
|
+
.frame(width: 16, height: 16)
|
|
22
|
+
.padding(.horizontal, Spacing.S)
|
|
23
|
+
}
|
|
24
|
+
if !icon.isEmpty {
|
|
25
|
+
Divider()
|
|
26
|
+
.frame(width: 1)
|
|
27
|
+
.background(Colors.primary)
|
|
28
|
+
.padding(.leading, Spacing.S)
|
|
29
|
+
|
|
30
|
+
Image(systemName: icon)
|
|
31
|
+
.foregroundColor(color)
|
|
32
|
+
.frame(width: 24, height: 24)
|
|
33
|
+
.padding(.leading, Spacing.S)
|
|
34
|
+
.onTapGesture(perform: onClick)
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// MARK: - InputSearch
|
|
41
|
+
|
|
42
|
+
public struct InputSearch: View {
|
|
43
|
+
@Binding var text: String
|
|
44
|
+
var buttonText: String = ""
|
|
45
|
+
var showButtonText: Bool = false
|
|
46
|
+
var showBorder: Bool = true
|
|
47
|
+
var placeholder: String = ""
|
|
48
|
+
var onChangeText: (String) -> Void = { _ in }
|
|
49
|
+
var onPressButtonText: () -> Void = {}
|
|
50
|
+
var error: String = ""
|
|
51
|
+
var disabled: Bool = false
|
|
52
|
+
var icon: String = ""
|
|
53
|
+
var iconColor: Color = Colors.text
|
|
54
|
+
var onRightIconPressed: () -> Void = {}
|
|
55
|
+
var onFocus: () -> Void = {}
|
|
56
|
+
var onBlur: () -> Void = {}
|
|
57
|
+
var loading: Bool = false
|
|
58
|
+
var fontWeight: Font.Weight = .regular
|
|
59
|
+
var keyboardType: UIKeyboardType = .default
|
|
60
|
+
|
|
61
|
+
@State private var isFocused = false
|
|
62
|
+
@State private var isBlurred = false
|
|
63
|
+
|
|
64
|
+
public init(text: Binding<String>,
|
|
65
|
+
buttonText: String = "",
|
|
66
|
+
showButtonText: Bool = false,
|
|
67
|
+
showBorder: Bool = true,
|
|
68
|
+
placeholder: String = "",
|
|
69
|
+
onChangeText: @escaping (String) -> Void = { _ in },
|
|
70
|
+
onPressButtonText: @escaping () -> Void = {},
|
|
71
|
+
error: String = "",
|
|
72
|
+
disabled: Bool = false,
|
|
73
|
+
icon: String = "",
|
|
74
|
+
iconColor: Color = Colors.text,
|
|
75
|
+
onRightIconPressed: @escaping () -> Void = {},
|
|
76
|
+
onFocus: @escaping () -> Void = {},
|
|
77
|
+
onBlur: @escaping () -> Void = {},
|
|
78
|
+
loading: Bool = false,
|
|
79
|
+
fontWeight: Font.Weight = .regular,
|
|
80
|
+
keyboardType: UIKeyboardType = .default) {
|
|
81
|
+
self._text = text
|
|
82
|
+
self.buttonText = buttonText
|
|
83
|
+
self.showButtonText = showButtonText
|
|
84
|
+
self.showBorder = showBorder
|
|
85
|
+
self.placeholder = placeholder
|
|
86
|
+
self.onChangeText = onChangeText
|
|
87
|
+
self.onPressButtonText = onPressButtonText
|
|
88
|
+
self.error = error
|
|
89
|
+
self.disabled = disabled
|
|
90
|
+
self.icon = icon
|
|
91
|
+
self.iconColor = iconColor
|
|
92
|
+
self.onRightIconPressed = onRightIconPressed
|
|
93
|
+
self.onFocus = onFocus
|
|
94
|
+
self.onBlur = onBlur
|
|
95
|
+
self.loading = loading
|
|
96
|
+
self.fontWeight = fontWeight
|
|
97
|
+
self.keyboardType = keyboardType
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
public var body: some View {
|
|
102
|
+
VStack(alignment: .leading, spacing: 0) {
|
|
103
|
+
HStack(spacing: 0) {
|
|
104
|
+
HStack {
|
|
105
|
+
Image(systemName: "magnifyingglass")
|
|
106
|
+
.foregroundColor(Colors.black12)
|
|
107
|
+
.frame(width: 24, height: 24)
|
|
108
|
+
.padding(.trailing, Spacing.XS)
|
|
109
|
+
|
|
110
|
+
ZStack(alignment: .leading) {
|
|
111
|
+
if text.isEmpty {
|
|
112
|
+
Text(placeholder)
|
|
113
|
+
.foregroundColor(disabled ? Colors.black08 : Colors.black12)
|
|
114
|
+
.font(.system(size: 16, weight: fontWeight))
|
|
115
|
+
}
|
|
116
|
+
TextField("", text: $text, onEditingChanged: { editing in
|
|
117
|
+
isFocused = editing
|
|
118
|
+
if editing {
|
|
119
|
+
onFocus()
|
|
120
|
+
} else if isBlurred {
|
|
121
|
+
onBlur()
|
|
122
|
+
}
|
|
123
|
+
if editing && !isBlurred {
|
|
124
|
+
isBlurred = true
|
|
125
|
+
}
|
|
126
|
+
}, onCommit: {})
|
|
127
|
+
.disabled(disabled)
|
|
128
|
+
.foregroundColor(disabled ? Colors.black08 : Colors.black17)
|
|
129
|
+
.font(.system(size: 15, weight: fontWeight))
|
|
130
|
+
.keyboardType(keyboardType)
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if isFocused && !text.isEmpty {
|
|
134
|
+
SwiftButton(action: { text = "" }) {
|
|
135
|
+
Image(systemName: "xmark.circle.fill")
|
|
136
|
+
.foregroundColor(Colors.black12)
|
|
137
|
+
.frame(width: 16, height: 16)
|
|
138
|
+
}
|
|
139
|
+
.padding(.leading, Spacing.S)
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
RenderRightIconSearch(loading: loading, icon: icon, color: disabled ? Colors.black08 : iconColor, onClick: onRightIconPressed)
|
|
143
|
+
}
|
|
144
|
+
.padding(.horizontal, Spacing.M)
|
|
145
|
+
.padding(.vertical, Spacing.S)
|
|
146
|
+
.background(Colors.black01)
|
|
147
|
+
.cornerRadius(Radius.XL)
|
|
148
|
+
.overlay(
|
|
149
|
+
RoundedRectangle(cornerRadius: Radius.XL)
|
|
150
|
+
.stroke(getBorderColor(isFocused: isFocused, error: error, disabled: disabled), lineWidth: showBorder ? 1 : 0)
|
|
151
|
+
)
|
|
152
|
+
.frame(maxWidth: showButtonText ? .infinity : nil, alignment: .leading)
|
|
153
|
+
|
|
154
|
+
if showButtonText {
|
|
155
|
+
SwiftButton(action: onPressButtonText) {
|
|
156
|
+
Text(buttonText)
|
|
157
|
+
.foregroundColor(Colors.black17)
|
|
158
|
+
.font(.system(size: 14, weight: .medium))
|
|
159
|
+
}
|
|
160
|
+
.padding(.leading, Spacing.L)
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// MARK: - Helper Functions
|
|
168
|
+
|
|
169
|
+
func getBorderColor(isFocused: Bool, error: String, disabled: Bool) -> Color {
|
|
170
|
+
if disabled {
|
|
171
|
+
return Colors.black08
|
|
172
|
+
} else if !error.isEmpty {
|
|
173
|
+
return Colors.red03
|
|
174
|
+
} else if isFocused {
|
|
175
|
+
return Colors.primary
|
|
176
|
+
} else {
|
|
177
|
+
return Colors.black04
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
//
|
|
2
|
+
// InputTextArea.swift
|
|
3
|
+
// Pods
|
|
4
|
+
//
|
|
5
|
+
// Created by dung.pham2 on 2/12/24.
|
|
6
|
+
//
|
|
7
|
+
import SwiftUI
|
|
8
|
+
|
|
9
|
+
// Make these constants public
|
|
10
|
+
public let MAX_LENGTH = 300
|
|
11
|
+
public let DEFAULT_HEIGHT: CGFloat = 104
|
|
12
|
+
|
|
13
|
+
struct UITextViewWrapper: UIViewRepresentable {
|
|
14
|
+
@Binding var text: String
|
|
15
|
+
var onDone: (() -> Void)?
|
|
16
|
+
var onFocus: (() -> Void)?
|
|
17
|
+
var onBlur: (() -> Void)?
|
|
18
|
+
|
|
19
|
+
func makeUIView(context: Context) -> UITextView {
|
|
20
|
+
let textView = UITextView()
|
|
21
|
+
textView.delegate = context.coordinator
|
|
22
|
+
return textView
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
func updateUIView(_ uiView: UITextView, context: Context) {
|
|
26
|
+
uiView.text = text
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
func makeCoordinator() -> Coordinator {
|
|
30
|
+
Coordinator(self)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
class Coordinator: NSObject, UITextViewDelegate {
|
|
34
|
+
var parent: UITextViewWrapper
|
|
35
|
+
|
|
36
|
+
init(_ parent: UITextViewWrapper) {
|
|
37
|
+
self.parent = parent
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
func textViewDidChange(_ textView: UITextView) {
|
|
41
|
+
parent.text = textView.text
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
func textViewDidBeginEditing(_ textView: UITextView) {
|
|
45
|
+
parent.onFocus?()
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
func textViewDidEndEditing(_ textView: UITextView) {
|
|
49
|
+
parent.onBlur?()
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
|
|
53
|
+
if text == "\n" {
|
|
54
|
+
parent.onDone?()
|
|
55
|
+
return false
|
|
56
|
+
}
|
|
57
|
+
return true
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Make the struct public
|
|
63
|
+
public struct InputTextArea: View {
|
|
64
|
+
@Binding var text: String
|
|
65
|
+
var maxLength: Int = MAX_LENGTH
|
|
66
|
+
var height: CGFloat = DEFAULT_HEIGHT
|
|
67
|
+
var floatingValue: String = ""
|
|
68
|
+
var floatingValueColor: Color = .gray
|
|
69
|
+
var floatingIcon: String = ""
|
|
70
|
+
var floatingIconColor: Color = .black
|
|
71
|
+
var placeholder: String = ""
|
|
72
|
+
var onChangeText: (String) -> Void = { _ in }
|
|
73
|
+
var error: String = ""
|
|
74
|
+
var errorSpacing: Bool = false
|
|
75
|
+
var disabled: Bool = false
|
|
76
|
+
var icon: String = ""
|
|
77
|
+
var iconColor: Color = .black
|
|
78
|
+
var onRightIconPressed: () -> Void = {}
|
|
79
|
+
var onFocus: () -> Void = {}
|
|
80
|
+
var onBlur: () -> Void = {}
|
|
81
|
+
var loading: Bool = false
|
|
82
|
+
var required: Bool = false
|
|
83
|
+
var fontWeight: Font.Weight = .regular
|
|
84
|
+
var keyboardType: UIKeyboardType = .default
|
|
85
|
+
|
|
86
|
+
@State private var isFocused = false
|
|
87
|
+
@State private var isBlurred = false
|
|
88
|
+
|
|
89
|
+
// Make the initializer public
|
|
90
|
+
public init(
|
|
91
|
+
text: Binding<String>,
|
|
92
|
+
maxLength: Int = MAX_LENGTH,
|
|
93
|
+
height: CGFloat = DEFAULT_HEIGHT,
|
|
94
|
+
floatingValue: String = "",
|
|
95
|
+
floatingValueColor: Color = .gray,
|
|
96
|
+
floatingIcon: String = "",
|
|
97
|
+
floatingIconColor: Color = .black,
|
|
98
|
+
placeholder: String = "",
|
|
99
|
+
onChangeText: @escaping (String) -> Void = { _ in },
|
|
100
|
+
error: String = "",
|
|
101
|
+
errorSpacing: Bool = false,
|
|
102
|
+
disabled: Bool = false,
|
|
103
|
+
icon: String = "",
|
|
104
|
+
iconColor: Color = Colors.pink03,
|
|
105
|
+
onRightIconPressed: @escaping () -> Void = {},
|
|
106
|
+
onFocus: @escaping () -> Void = {},
|
|
107
|
+
onBlur: @escaping () -> Void = {},
|
|
108
|
+
loading: Bool = false,
|
|
109
|
+
required: Bool = false,
|
|
110
|
+
fontWeight: Font.Weight = .regular,
|
|
111
|
+
keyboardType: UIKeyboardType = .default
|
|
112
|
+
) {
|
|
113
|
+
self._text = text
|
|
114
|
+
self.maxLength = maxLength
|
|
115
|
+
self.height = height
|
|
116
|
+
self.floatingValue = floatingValue
|
|
117
|
+
self.floatingValueColor = floatingValueColor
|
|
118
|
+
self.floatingIcon = floatingIcon
|
|
119
|
+
self.floatingIconColor = floatingIconColor
|
|
120
|
+
self.placeholder = placeholder
|
|
121
|
+
self.onChangeText = onChangeText
|
|
122
|
+
self.error = error
|
|
123
|
+
self.errorSpacing = errorSpacing
|
|
124
|
+
self.disabled = disabled
|
|
125
|
+
self.icon = icon
|
|
126
|
+
self.iconColor = iconColor
|
|
127
|
+
self.onRightIconPressed = onRightIconPressed
|
|
128
|
+
self.onFocus = onFocus
|
|
129
|
+
self.onBlur = onBlur
|
|
130
|
+
self.loading = loading
|
|
131
|
+
self.required = required
|
|
132
|
+
self.fontWeight = fontWeight
|
|
133
|
+
self.keyboardType = keyboardType
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
public var body: some View {
|
|
137
|
+
VStack(alignment: .leading, spacing: 0) {
|
|
138
|
+
ZStack(alignment: .topLeading) {
|
|
139
|
+
if !floatingValue.isEmpty || !floatingIcon.isEmpty {
|
|
140
|
+
HStack(spacing: 4) {
|
|
141
|
+
Text(floatingValue)
|
|
142
|
+
.font(.caption)
|
|
143
|
+
.foregroundColor(disabled ? .gray : floatingValueColor)
|
|
144
|
+
|
|
145
|
+
if required {
|
|
146
|
+
Text("*")
|
|
147
|
+
.font(.caption)
|
|
148
|
+
.foregroundColor(.red)
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if !floatingIcon.isEmpty {
|
|
152
|
+
Image(systemName: floatingIcon)
|
|
153
|
+
.font(.caption)
|
|
154
|
+
.foregroundColor(disabled ? .gray : floatingIconColor)
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
.padding(.horizontal, 8)
|
|
158
|
+
.background(Colors.black01)
|
|
159
|
+
.offset(x: Spacing.S, y: -height / 10)
|
|
160
|
+
.zIndex(10)
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
VStack {
|
|
164
|
+
ZStack(alignment: .topLeading) {
|
|
165
|
+
if text.isEmpty {
|
|
166
|
+
Text(placeholder)
|
|
167
|
+
.foregroundColor(disabled ? .gray : .gray)
|
|
168
|
+
.font(.system(size: 16, weight: fontWeight))
|
|
169
|
+
.padding(.horizontal, 16)
|
|
170
|
+
.padding(.vertical, 12)
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
UITextViewWrapper(text: $text, onDone: {
|
|
174
|
+
// Handle done action if needed
|
|
175
|
+
},
|
|
176
|
+
onFocus: {
|
|
177
|
+
isFocused = true
|
|
178
|
+
onFocus()
|
|
179
|
+
}, onBlur: {
|
|
180
|
+
isFocused = false
|
|
181
|
+
isBlurred = true
|
|
182
|
+
onBlur()
|
|
183
|
+
})
|
|
184
|
+
.frame(height: height)
|
|
185
|
+
.padding(.horizontal, 12)
|
|
186
|
+
.padding(.vertical, 8)
|
|
187
|
+
.disabled(disabled) }
|
|
188
|
+
|
|
189
|
+
HStack {
|
|
190
|
+
Spacer()
|
|
191
|
+
Text("\(text.count)/\(maxLength)")
|
|
192
|
+
.font(.caption)
|
|
193
|
+
.foregroundColor(.gray)
|
|
194
|
+
}
|
|
195
|
+
.padding(.horizontal, 16)
|
|
196
|
+
.padding(.bottom, 12)
|
|
197
|
+
}
|
|
198
|
+
.background(Color.white)
|
|
199
|
+
.cornerRadius(8)
|
|
200
|
+
.overlay(
|
|
201
|
+
RoundedRectangle(cornerRadius: 8)
|
|
202
|
+
.stroke(borderColor, lineWidth: 1)
|
|
203
|
+
)
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
if !error.isEmpty {
|
|
207
|
+
Text(error)
|
|
208
|
+
.font(.caption)
|
|
209
|
+
.foregroundColor(.red)
|
|
210
|
+
.padding(.top, errorSpacing ? 8 : 4)
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
.onReceive(NotificationCenter.default.publisher(for: UIResponder.keyboardWillShowNotification)) { _ in
|
|
214
|
+
if !isBlurred {
|
|
215
|
+
isFocused = true
|
|
216
|
+
onFocus()
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
.onReceive(NotificationCenter.default.publisher(for: UIResponder.keyboardWillHideNotification)) { _ in
|
|
220
|
+
if isFocused {
|
|
221
|
+
isFocused = false
|
|
222
|
+
isBlurred = true
|
|
223
|
+
onBlur()
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
private var borderColor: Color {
|
|
229
|
+
if disabled {
|
|
230
|
+
return Colors.black03
|
|
231
|
+
} else if !error.isEmpty {
|
|
232
|
+
return .red
|
|
233
|
+
} else if isFocused {
|
|
234
|
+
return Colors.pink03
|
|
235
|
+
} else {
|
|
236
|
+
return Colors.border
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
|
package/ios/Switch/Switch.swift
CHANGED
|
@@ -12,33 +12,33 @@ public struct Switch: View{
|
|
|
12
12
|
self.onChange = onChange
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
.frame(width: 6, height: 6)
|
|
26
|
-
.background(value ? Colors.green03 : Colors.black07)
|
|
27
|
-
.clipShape(Circle())
|
|
28
|
-
.opacity(disabled ? 0.4 : 1)
|
|
15
|
+
|
|
16
|
+
public var body: some View {
|
|
17
|
+
SwiftUI.Button(action: {
|
|
18
|
+
withAnimation{
|
|
19
|
+
value.toggle()
|
|
20
|
+
onChange?(value)
|
|
21
|
+
}
|
|
22
|
+
}){
|
|
23
|
+
HStack{
|
|
24
|
+
HStack {
|
|
29
25
|
}
|
|
30
|
-
.frame(width:
|
|
31
|
-
.background(Colors.
|
|
26
|
+
.frame(width: 6, height: 6)
|
|
27
|
+
.background(value ? Colors.pink03 : Colors.black07)
|
|
32
28
|
.clipShape(Circle())
|
|
33
|
-
.
|
|
34
|
-
.padding(.trailing,5)
|
|
35
|
-
|
|
29
|
+
.opacity(disabled ? 0.4 : 1)
|
|
36
30
|
}
|
|
37
|
-
.
|
|
38
|
-
.
|
|
39
|
-
.
|
|
40
|
-
.
|
|
41
|
-
.
|
|
42
|
-
|
|
43
|
-
|
|
31
|
+
.frame(width: 14, height: 14)
|
|
32
|
+
.background(Colors.black01)
|
|
33
|
+
.clipShape(Circle())
|
|
34
|
+
.padding(.leading,5)
|
|
35
|
+
.padding(.trailing,5)
|
|
36
|
+
|
|
37
|
+
}
|
|
38
|
+
.disabled(disabled)
|
|
39
|
+
.frame(width: 40, height: 24, alignment: value == true ? .trailing : .leading)
|
|
40
|
+
.background(value ? Colors.pink03 : Colors.black07)
|
|
41
|
+
.clipShape(Capsule())
|
|
42
|
+
.opacity(disabled ? 0.4 : 1)
|
|
43
|
+
}
|
|
44
44
|
}
|
|
@@ -4,18 +4,61 @@ public extension Font {
|
|
|
4
4
|
static func appFont(size: CGFloat) -> Font {
|
|
5
5
|
return Font.custom("SFProText", size: size)
|
|
6
6
|
}
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
|
|
8
|
+
// New supported typography styles
|
|
9
|
+
static let headline_default_bold = appFont(size: 24).weight(.bold)
|
|
10
|
+
static let header_m_bold = appFont(size: 18).weight(.bold)
|
|
11
|
+
static let header_default_bold = appFont(size: 16).weight(.bold)
|
|
12
|
+
static let header_s_semibold = appFont(size: 14).weight(.semibold)
|
|
13
|
+
static let header_xs_semibold = appFont(size: 12).weight(.semibold)
|
|
14
|
+
static let body_default_regular = appFont(size: 14).weight(.regular)
|
|
15
|
+
static let description_default_regular = appFont(size: 12).weight(.regular)
|
|
16
|
+
static let description_xs_regular = appFont(size: 10).weight(.regular)
|
|
17
|
+
static let label_default_medium = appFont(size: 14).weight(.medium)
|
|
18
|
+
static let label_s_medium = appFont(size: 12).weight(.medium)
|
|
19
|
+
static let label_xs_medium = appFont(size: 10).weight(.medium)
|
|
20
|
+
static let action_default_bold = appFont(size: 16).weight(.bold)
|
|
21
|
+
static let action_s_bold = appFont(size: 14).weight(.bold)
|
|
22
|
+
static let action_xs_bold = appFont(size: 12).weight(.bold)
|
|
23
|
+
static let action_xxs_bold = appFont(size: 10).weight(.bold)
|
|
24
|
+
|
|
25
|
+
// Legacy styles
|
|
26
|
+
static let headline_default = appFont(size: 28).weight(.semibold)
|
|
27
|
+
static let headline_s = appFont(size: 24).weight(.semibold)
|
|
28
|
+
static let headline_l = appFont(size: 32).weight(.semibold)
|
|
29
|
+
static let headline_xl = appFont(size: 36).weight(.semibold)
|
|
30
|
+
static let title_default = appFont(size: 20).weight(.bold)
|
|
31
|
+
static let title_xs = appFont(size: 16).weight(.bold)
|
|
32
|
+
static let title_s = appFont(size: 18).weight(.bold)
|
|
33
|
+
static let header_default = appFont(size: 15).weight(.semibold)
|
|
34
|
+
static let header_xs = appFont(size: 12).weight(.semibold)
|
|
35
|
+
static let header_s = appFont(size: 14).weight(.semibold)
|
|
36
|
+
static let paragraph_default = appFont(size: 15).weight(.regular)
|
|
37
|
+
static let paragraph_bold = appFont(size: 15).weight(.bold)
|
|
38
|
+
static let description_default = appFont(size: 14).weight(.regular)
|
|
39
|
+
static let description_xs = appFont(size: 10).weight(.regular)
|
|
40
|
+
static let description_s = appFont(size: 12).weight(.regular)
|
|
41
|
+
static let label_default = appFont(size: 14).weight(.medium)
|
|
42
|
+
static let label_xxs = appFont(size: 8).weight(.medium)
|
|
43
|
+
static let label_xs = appFont(size: 10).weight(.medium)
|
|
44
|
+
static let label_s = appFont(size: 12).weight(.medium)
|
|
45
|
+
static let action_default = appFont(size: 16).weight(.bold)
|
|
46
|
+
static let action_xxs = appFont(size: 10).weight(.bold)
|
|
47
|
+
static let action_xs = appFont(size: 12).weight(.bold)
|
|
48
|
+
static let action_s = appFont(size: 15).weight(.bold)
|
|
49
|
+
|
|
50
|
+
// deprecated
|
|
51
|
+
static let h1 = appFont(size: 36).weight(.semibold) //headline_xl
|
|
9
52
|
static let h2 = appFont(size: 32).weight(.semibold)
|
|
10
53
|
static let h3 = appFont(size: 28).weight(.semibold)
|
|
11
54
|
static let h4 = appFont(size: 24).weight(.semibold)
|
|
12
55
|
static let title1 = appFont(size: 20).weight(.bold)
|
|
13
56
|
static let title2 = appFont(size: 18).weight(.bold)
|
|
14
57
|
static let title3 = appFont(size: 16).weight(.bold)
|
|
15
|
-
static let headerText1 = appFont(size: 15).weight(.semibold)
|
|
58
|
+
static let headerText1 = appFont(size: 15).weight(.semibold) //header_default
|
|
16
59
|
static let headerText2 = appFont(size: 14).weight(.semibold)
|
|
17
60
|
static let headerText3 = appFont(size: 12).weight(.semibold)
|
|
18
|
-
static let paragraph = appFont(size: 15).weight(.regular)
|
|
61
|
+
static let paragraph = appFont(size: 15).weight(.regular) //paragraph_default
|
|
19
62
|
static let description1 = appFont(size: 14).weight(.regular)
|
|
20
63
|
static let description2 = appFont(size: 12).weight(.regular)
|
|
21
64
|
static let description3 = appFont(size: 10).weight(.regular)
|