@momo-kits/native-kits 0.114.2-beta.2 → 0.114.2-beta.21
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/AnimationSearchInput.kt +0 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +0 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +6 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +6 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +1 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +4 -4
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +5 -7
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +0 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +2 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +41 -22
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +25 -37
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +2 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +3 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +11 -12
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +3 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +0 -8
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +1 -4
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +0 -10
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +13 -9
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +0 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +2 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/{dateTimePicker → datetimepicker}/DateTimePicker.kt +13 -13
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/{dateTimePicker → datetimepicker}/DateTimePickerTypes.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/{dateTimePicker → datetimepicker}/DateTimePickerUtils.kt +34 -23
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/{dateTimePicker → datetimepicker}/WheelPicker.kt +2 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +9 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +12 -7
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +1 -1
- package/ios/Application/Components.swift +11 -14
- package/ios/Application/Screen.swift +20 -14
- package/ios/Checkbox/Checkbox.swift +1 -1
- package/ios/Popup/PopupDisplay.swift +3 -3
- package/local.properties +2 -2
- package/package.json +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/dateTimePicker/DateTimePickerExample.kt +0 -90
|
@@ -2,24 +2,16 @@ package vn.momo.kits.components
|
|
|
2
2
|
|
|
3
3
|
import androidx.compose.foundation.background
|
|
4
4
|
import androidx.compose.foundation.layout.Box
|
|
5
|
-
import androidx.compose.foundation.layout.BoxWithConstraints
|
|
6
5
|
import androidx.compose.foundation.layout.Row
|
|
7
|
-
import androidx.compose.foundation.layout.height
|
|
8
6
|
import androidx.compose.foundation.layout.padding
|
|
9
7
|
import androidx.compose.foundation.layout.size
|
|
10
8
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
11
9
|
import androidx.compose.runtime.Composable
|
|
12
|
-
import androidx.compose.ui.Alignment
|
|
13
10
|
import androidx.compose.ui.Modifier
|
|
14
|
-
import androidx.compose.ui.draw.alpha
|
|
15
|
-
import androidx.compose.ui.draw.clip
|
|
16
|
-
import androidx.compose.ui.draw.clipToBounds
|
|
17
11
|
import androidx.compose.ui.graphics.Color
|
|
18
12
|
import androidx.compose.ui.unit.dp
|
|
19
13
|
import vn.momo.kits.const.AppTheme
|
|
20
|
-
import vn.momo.kits.const.Colors
|
|
21
14
|
import vn.momo.kits.const.Spacing
|
|
22
|
-
import vn.momo.kits.const.Typography
|
|
23
15
|
|
|
24
16
|
@Composable
|
|
25
17
|
fun Dot(active: Boolean = false, activeColor: Color, modifier: Modifier = Modifier) {
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
package vn.momo.kits.components
|
|
2
2
|
|
|
3
3
|
import androidx.compose.foundation.background
|
|
4
|
-
import androidx.compose.foundation.layout.Box
|
|
5
4
|
import androidx.compose.foundation.layout.BoxWithConstraints
|
|
6
|
-
import androidx.compose.foundation.layout.Row
|
|
7
5
|
import androidx.compose.foundation.layout.padding
|
|
8
6
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
9
7
|
import androidx.compose.runtime.Composable
|
|
10
8
|
import androidx.compose.ui.Alignment
|
|
11
9
|
import androidx.compose.ui.Modifier
|
|
12
|
-
import androidx.compose.ui.draw.alpha
|
|
13
10
|
import androidx.compose.ui.graphics.Color
|
|
14
11
|
import vn.momo.kits.const.Colors
|
|
15
12
|
import vn.momo.kits.const.Spacing
|
|
@@ -31,7 +28,7 @@ fun PaginationNumber(
|
|
|
31
28
|
modifier = Modifier.padding(horizontal = Spacing.S),
|
|
32
29
|
text = "${1 + activeIndex}/$dataLength",
|
|
33
30
|
color = Colors.black_01,
|
|
34
|
-
style = Typography.
|
|
31
|
+
style = Typography.labelDefaultMedium
|
|
35
32
|
)
|
|
36
33
|
}
|
|
37
34
|
}
|
|
@@ -1,25 +1,15 @@
|
|
|
1
1
|
package vn.momo.kits.components
|
|
2
2
|
|
|
3
3
|
import androidx.compose.foundation.background
|
|
4
|
-
import androidx.compose.foundation.layout.Box
|
|
5
|
-
import androidx.compose.foundation.layout.BoxWithConstraints
|
|
6
4
|
import androidx.compose.foundation.layout.Row
|
|
7
|
-
import androidx.compose.foundation.layout.height
|
|
8
5
|
import androidx.compose.foundation.layout.padding
|
|
9
|
-
import androidx.compose.foundation.layout.size
|
|
10
6
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
11
7
|
import androidx.compose.runtime.Composable
|
|
12
|
-
import androidx.compose.ui.Alignment
|
|
13
8
|
import androidx.compose.ui.Modifier
|
|
14
|
-
import androidx.compose.ui.draw.alpha
|
|
15
|
-
import androidx.compose.ui.draw.clip
|
|
16
|
-
import androidx.compose.ui.draw.clipToBounds
|
|
17
9
|
import androidx.compose.ui.graphics.Color
|
|
18
10
|
import androidx.compose.ui.unit.dp
|
|
19
|
-
import vn.momo.kits.const.AppTheme
|
|
20
11
|
import vn.momo.kits.const.Colors
|
|
21
12
|
import vn.momo.kits.const.Spacing
|
|
22
|
-
import vn.momo.kits.const.Typography
|
|
23
13
|
|
|
24
14
|
@Composable
|
|
25
15
|
fun PaginationWhiteDot(
|
|
@@ -27,8 +27,6 @@ import androidx.compose.runtime.setValue
|
|
|
27
27
|
import androidx.compose.ui.Alignment
|
|
28
28
|
import androidx.compose.ui.Modifier
|
|
29
29
|
import androidx.compose.ui.draw.clip
|
|
30
|
-
import androidx.compose.ui.semantics.semantics
|
|
31
|
-
import androidx.compose.ui.semantics.testTag
|
|
32
30
|
import androidx.compose.ui.text.TextLayoutResult
|
|
33
31
|
import androidx.compose.ui.unit.dp
|
|
34
32
|
import vn.momo.kits.const.AppTheme
|
|
@@ -75,7 +73,7 @@ fun PopupNotify(
|
|
|
75
73
|
Text(
|
|
76
74
|
text = description,
|
|
77
75
|
onTextLayout = { layoutResult.value = it },
|
|
78
|
-
style = Typography.
|
|
76
|
+
style = Typography.bodyDefaultRegular
|
|
79
77
|
)
|
|
80
78
|
}
|
|
81
79
|
}
|
|
@@ -86,7 +84,7 @@ fun PopupNotify(
|
|
|
86
84
|
Text(
|
|
87
85
|
text = description,
|
|
88
86
|
onTextLayout = { layoutResult.value = it },
|
|
89
|
-
style = Typography.
|
|
87
|
+
style = Typography.bodyDefaultRegular
|
|
90
88
|
)
|
|
91
89
|
}
|
|
92
90
|
}
|
|
@@ -96,8 +94,9 @@ fun PopupNotify(
|
|
|
96
94
|
callback?.invoke()
|
|
97
95
|
}
|
|
98
96
|
|
|
99
|
-
Box(
|
|
100
|
-
, contentAlignment = Alignment.TopEnd
|
|
97
|
+
Box(
|
|
98
|
+
Modifier.setAutomationId("popup_notify"), contentAlignment = Alignment.TopEnd
|
|
99
|
+
) {
|
|
101
100
|
Column(
|
|
102
101
|
modifier = Modifier
|
|
103
102
|
.fillMaxWidth()
|
|
@@ -116,12 +115,17 @@ fun PopupNotify(
|
|
|
116
115
|
)
|
|
117
116
|
|
|
118
117
|
Column(modifier = Modifier.padding(Spacing.XL)) {
|
|
119
|
-
Text(
|
|
118
|
+
Text(
|
|
119
|
+
style = Typography.headerDefaultBold,
|
|
120
|
+
maxLines = 2,
|
|
121
|
+
text = title,
|
|
122
|
+
modifier = Modifier.setAutomationId("title_popup_permission")
|
|
123
|
+
)
|
|
120
124
|
content(Modifier.padding(top = Spacing.S))
|
|
121
125
|
if (error.isNotEmpty()) {
|
|
122
126
|
Text(
|
|
123
127
|
text = error,
|
|
124
|
-
style = Typography.
|
|
128
|
+
style = Typography.descriptionXsRegular,
|
|
125
129
|
color = AppTheme.current.colors.text.hint,
|
|
126
130
|
maxLines = 1,
|
|
127
131
|
modifier = Modifier.padding(top = Spacing.S)
|
|
@@ -143,7 +147,7 @@ fun PopupNotify(
|
|
|
143
147
|
Modifier
|
|
144
148
|
.width(22.dp)
|
|
145
149
|
.height(22.dp)
|
|
146
|
-
.offset(x = -(
|
|
150
|
+
.offset(x = -(1).dp, y = (-11).dp)
|
|
147
151
|
.background(
|
|
148
152
|
color = AppTheme.current.colors.text.default,
|
|
149
153
|
shape = RoundedCornerShape(Radius.M)
|
|
@@ -3,16 +3,13 @@ package vn.momo.kits.components
|
|
|
3
3
|
import androidx.compose.foundation.background
|
|
4
4
|
import androidx.compose.foundation.border
|
|
5
5
|
import androidx.compose.foundation.clickable
|
|
6
|
-
import androidx.compose.foundation.interaction.MutableInteractionSource
|
|
7
6
|
import androidx.compose.foundation.layout.Box
|
|
8
7
|
import androidx.compose.foundation.layout.height
|
|
9
8
|
import androidx.compose.foundation.layout.padding
|
|
10
9
|
import androidx.compose.foundation.layout.size
|
|
11
10
|
import androidx.compose.foundation.layout.width
|
|
12
11
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
13
|
-
import androidx.compose.material.ripple.rememberRipple
|
|
14
12
|
import androidx.compose.runtime.Composable
|
|
15
|
-
import androidx.compose.runtime.remember
|
|
16
13
|
import androidx.compose.ui.Alignment
|
|
17
14
|
import androidx.compose.ui.Modifier
|
|
18
15
|
import androidx.compose.ui.draw.clip
|
|
@@ -9,7 +9,6 @@ import androidx.compose.ui.text.style.TextAlign
|
|
|
9
9
|
import androidx.compose.ui.text.style.TextDecoration
|
|
10
10
|
import androidx.compose.ui.text.style.TextOverflow
|
|
11
11
|
import androidx.compose.ui.unit.sp
|
|
12
|
-
import vn.momo.kits.application.PlatformApi
|
|
13
12
|
import vn.momo.kits.const.AppTheme
|
|
14
13
|
import vn.momo.kits.const.Typography
|
|
15
14
|
import vn.momo.kits.const.getFontFamily
|
|
@@ -20,7 +19,7 @@ import vn.momo.kits.modifier.setAutomationId
|
|
|
20
19
|
fun Text(
|
|
21
20
|
text: String,
|
|
22
21
|
color: Color? = null,
|
|
23
|
-
style: TextStyle = Typography.
|
|
22
|
+
style: TextStyle = Typography.bodyDefaultRegular,
|
|
24
23
|
textAlign: TextAlign? = TextAlign.Start,
|
|
25
24
|
modifier: Modifier = Modifier,
|
|
26
25
|
maxLines: Int = Int.MAX_VALUE,
|
|
@@ -34,7 +33,7 @@ fun Text(
|
|
|
34
33
|
val font = getFontFamily(fontFamily, style.fontWeight)
|
|
35
34
|
|
|
36
35
|
androidx.compose.material3.Text(
|
|
37
|
-
modifier = modifier.setAutomationId(accessibilityId?:text, text),
|
|
36
|
+
modifier = modifier.setAutomationId(accessibilityId ?: text, text),
|
|
38
37
|
text = text,
|
|
39
38
|
color = color ?: AppTheme.current.colors.text.default,
|
|
40
39
|
style = style.copy(fontWeight = null),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
package vn.momo.kits.components.
|
|
1
|
+
package vn.momo.kits.components.datetimepicker
|
|
2
2
|
|
|
3
3
|
import androidx.compose.foundation.background
|
|
4
4
|
import androidx.compose.foundation.layout.Column
|
|
@@ -32,7 +32,7 @@ private fun onPickerChange(
|
|
|
32
32
|
effectiveMinDate: LocalDateTime,
|
|
33
33
|
effectiveMaxDate: LocalDateTime,
|
|
34
34
|
onChange: (LocalDateTime) -> Unit
|
|
35
|
-
){
|
|
35
|
+
) {
|
|
36
36
|
when (name) {
|
|
37
37
|
"day" -> currentDate.day = value.toInt()
|
|
38
38
|
"month" -> currentDate.month = value.toInt()
|
|
@@ -82,15 +82,15 @@ fun DateTimePicker(
|
|
|
82
82
|
arrayLabelTime: List<String> = emptyList()
|
|
83
83
|
) {
|
|
84
84
|
val now = remember { getCurrentDateTime() }
|
|
85
|
-
|
|
85
|
+
|
|
86
86
|
val minDateDefault = remember { createRelativeDate(-10) }
|
|
87
|
-
|
|
87
|
+
|
|
88
88
|
val maxDateDefault = remember { createRelativeDate(10) }
|
|
89
|
-
|
|
89
|
+
|
|
90
90
|
val effectiveSelectedValue = selectedValue ?: now
|
|
91
91
|
val effectiveMinDate = minDate ?: minDateDefault
|
|
92
92
|
val effectiveMaxDate = maxDate ?: maxDateDefault
|
|
93
|
-
|
|
93
|
+
|
|
94
94
|
val initialValue = remember {
|
|
95
95
|
when {
|
|
96
96
|
effectiveSelectedValue < effectiveMinDate -> effectiveMinDate
|
|
@@ -110,11 +110,11 @@ fun DateTimePicker(
|
|
|
110
110
|
)
|
|
111
111
|
)
|
|
112
112
|
}
|
|
113
|
-
|
|
113
|
+
|
|
114
114
|
val pickerHeight = if (arrayLabelTime.isNotEmpty())
|
|
115
|
-
datePickerWithLabelsHeight else
|
|
115
|
+
datePickerWithLabelsHeight else
|
|
116
116
|
datePickerHeight
|
|
117
|
-
|
|
117
|
+
|
|
118
118
|
Row(
|
|
119
119
|
modifier = modifier
|
|
120
120
|
.fillMaxWidth()
|
|
@@ -132,7 +132,7 @@ fun DateTimePicker(
|
|
|
132
132
|
)
|
|
133
133
|
dateComponents.forEachIndexed { index, component ->
|
|
134
134
|
val hasLabel = index < arrayLabelTime.size && arrayLabelTime[index].isNotEmpty()
|
|
135
|
-
|
|
135
|
+
|
|
136
136
|
Column(
|
|
137
137
|
horizontalAlignment = Alignment.CenterHorizontally,
|
|
138
138
|
modifier = Modifier.weight(1f)
|
|
@@ -140,11 +140,11 @@ fun DateTimePicker(
|
|
|
140
140
|
if (hasLabel) {
|
|
141
141
|
Text(
|
|
142
142
|
text = arrayLabelTime[index],
|
|
143
|
-
style = Typography.
|
|
143
|
+
style = Typography.actionSBold,
|
|
144
144
|
modifier = Modifier.padding(bottom = Spacing.S)
|
|
145
145
|
)
|
|
146
146
|
}
|
|
147
|
-
|
|
147
|
+
|
|
148
148
|
WheelPicker(
|
|
149
149
|
name = component.name,
|
|
150
150
|
data = component.data,
|
|
@@ -169,7 +169,7 @@ fun DateTimePicker(
|
|
|
169
169
|
}
|
|
170
170
|
)
|
|
171
171
|
}
|
|
172
|
-
|
|
172
|
+
|
|
173
173
|
if (index < dateComponents.size - 1) {
|
|
174
174
|
Spacer(modifier = Modifier.width(Spacing.M))
|
|
175
175
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
package vn.momo.kits.components.
|
|
1
|
+
package vn.momo.kits.components.datetimepicker
|
|
2
2
|
|
|
3
3
|
import androidx.compose.runtime.Composable
|
|
4
4
|
import androidx.compose.runtime.remember
|
|
@@ -16,10 +16,19 @@ import kotlinx.datetime.toLocalDateTime
|
|
|
16
16
|
*/
|
|
17
17
|
fun formatLocalDateTime(dateTime: LocalDateTime, format: String = "yyyy-MM-dd HH:mm"): String {
|
|
18
18
|
return when (format) {
|
|
19
|
-
"yyyy-MM-dd HH:mm" -> "${dateTime.year}-${paddingNum(dateTime.month.number)}-${
|
|
19
|
+
"yyyy-MM-dd HH:mm" -> "${dateTime.year}-${paddingNum(dateTime.month.number)}-${
|
|
20
|
+
paddingNum(
|
|
21
|
+
dateTime.dayOfMonth
|
|
22
|
+
)
|
|
23
|
+
} ${paddingNum(dateTime.hour)}:${paddingNum(dateTime.minute)}"
|
|
24
|
+
|
|
20
25
|
"dd-MM-yyyy" -> "${paddingNum(dateTime.dayOfMonth)}-${paddingNum(dateTime.month.number)}-${dateTime.year}"
|
|
21
26
|
"HH:mm" -> "${paddingNum(dateTime.hour)}:${paddingNum(dateTime.minute)}"
|
|
22
|
-
else -> "${dateTime.year}-${paddingNum(dateTime.month.number)}-${paddingNum(dateTime.dayOfMonth)} ${
|
|
27
|
+
else -> "${dateTime.year}-${paddingNum(dateTime.month.number)}-${paddingNum(dateTime.dayOfMonth)} ${
|
|
28
|
+
paddingNum(
|
|
29
|
+
dateTime.hour
|
|
30
|
+
)
|
|
31
|
+
}:${paddingNum(dateTime.minute)}"
|
|
23
32
|
}
|
|
24
33
|
}
|
|
25
34
|
|
|
@@ -150,13 +159,13 @@ fun getCurrentDateTime(): LocalDateTime {
|
|
|
150
159
|
fun createRelativeDate(years: Int): LocalDateTime {
|
|
151
160
|
val currentDateTime = getCurrentDateTime()
|
|
152
161
|
val period = DatePeriod(years = if (years < 0) -years else years)
|
|
153
|
-
|
|
162
|
+
|
|
154
163
|
val adjustedDate = if (years < 0) {
|
|
155
164
|
currentDateTime.date.minus(period)
|
|
156
165
|
} else {
|
|
157
166
|
currentDateTime.date.plus(period)
|
|
158
167
|
}
|
|
159
|
-
|
|
168
|
+
|
|
160
169
|
return LocalDateTime(
|
|
161
170
|
adjustedDate.year,
|
|
162
171
|
adjustedDate.monthNumber,
|
|
@@ -182,9 +191,10 @@ internal fun getDateComponents(
|
|
|
182
191
|
formatParts.size == 1 && formatParts[0] == "HH"
|
|
183
192
|
}
|
|
184
193
|
|
|
185
|
-
val dayData =
|
|
186
|
-
|
|
187
|
-
|
|
194
|
+
val dayData =
|
|
195
|
+
remember(currentDate.year, currentDate.month, effectiveMinDate, effectiveMaxDate) {
|
|
196
|
+
getDaysInMonth(currentDate.year, currentDate.month, effectiveMinDate, effectiveMaxDate)
|
|
197
|
+
}
|
|
188
198
|
|
|
189
199
|
val monthData = remember(currentDate.year, effectiveMinDate, effectiveMaxDate) {
|
|
190
200
|
getMonths(effectiveMinDate, effectiveMaxDate, currentDate.year)
|
|
@@ -202,25 +212,26 @@ internal fun getDateComponents(
|
|
|
202
212
|
getMinutes(minuteInterval)
|
|
203
213
|
}
|
|
204
214
|
|
|
205
|
-
val dateComponents =
|
|
206
|
-
|
|
215
|
+
val dateComponents =
|
|
216
|
+
remember(formatParts, dayData, monthData, yearData, hourData, minData, isOnlyHour) {
|
|
217
|
+
val components = mutableListOf<DateComponent>()
|
|
207
218
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
219
|
+
formatParts.forEach { part ->
|
|
220
|
+
when (part) {
|
|
221
|
+
"DD" -> components.add(DateComponent("day", dayData))
|
|
222
|
+
"MM" -> components.add(DateComponent("month", monthData))
|
|
223
|
+
"YYYY" -> components.add(DateComponent("year", yearData))
|
|
224
|
+
"HH" -> components.add(DateComponent("hour", hourData))
|
|
225
|
+
"mm" -> components.add(DateComponent("minute", minData))
|
|
226
|
+
}
|
|
215
227
|
}
|
|
216
|
-
}
|
|
217
228
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
229
|
+
if (isOnlyHour) {
|
|
230
|
+
components.add(DateComponent("timeMode", timeMode))
|
|
231
|
+
}
|
|
221
232
|
|
|
222
|
-
|
|
223
|
-
|
|
233
|
+
components
|
|
234
|
+
}
|
|
224
235
|
|
|
225
236
|
return dateComponents
|
|
226
237
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
package vn.momo.kits.components.
|
|
1
|
+
package vn.momo.kits.components.datetimepicker
|
|
2
2
|
|
|
3
3
|
import androidx.compose.animation.core.tween
|
|
4
4
|
import androidx.compose.foundation.background
|
|
@@ -194,7 +194,7 @@ fun WheelPickerItem(
|
|
|
194
194
|
) {
|
|
195
195
|
Text(
|
|
196
196
|
text = text,
|
|
197
|
-
style = Typography.
|
|
197
|
+
style = Typography.actionSBold,
|
|
198
198
|
modifier = Modifier.scale(scale)
|
|
199
199
|
)
|
|
200
200
|
}
|
|
@@ -4,8 +4,8 @@ import androidx.compose.runtime.Composable
|
|
|
4
4
|
import androidx.compose.runtime.Immutable
|
|
5
5
|
import androidx.compose.ui.text.TextStyle
|
|
6
6
|
import androidx.compose.ui.text.font.FontFamily
|
|
7
|
-
import androidx.compose.ui.text.font.FontStyle
|
|
8
7
|
import androidx.compose.ui.text.font.FontWeight
|
|
8
|
+
import androidx.compose.ui.text.style.TextDecoration
|
|
9
9
|
import androidx.compose.ui.unit.sp
|
|
10
10
|
import org.jetbrains.compose.resources.Font
|
|
11
11
|
import org.jetbrains.compose.resources.FontResource
|
|
@@ -30,7 +30,14 @@ fun scaleSize(size: Float): Float {
|
|
|
30
30
|
fun getFont(font: String): FontFamily {
|
|
31
31
|
val fontResource = FontResource(
|
|
32
32
|
"font:${font.substringBeforeLast(".")}",
|
|
33
|
-
setOf(
|
|
33
|
+
setOf(
|
|
34
|
+
ResourceItem(
|
|
35
|
+
setOf(),
|
|
36
|
+
"font/${font.substringBeforeLast(".")}.${font.substringAfterLast(".")}",
|
|
37
|
+
-1,
|
|
38
|
+
-1
|
|
39
|
+
)
|
|
40
|
+
)
|
|
34
41
|
)
|
|
35
42
|
return FontFamily(Font(fontResource))
|
|
36
43
|
}
|
|
@@ -7,7 +7,7 @@ import androidx.compose.runtime.Composable
|
|
|
7
7
|
import androidx.compose.ui.Modifier
|
|
8
8
|
import androidx.compose.ui.unit.Dp
|
|
9
9
|
|
|
10
|
-
data class GridContext
|
|
10
|
+
data class GridContext(
|
|
11
11
|
val numberOfColumns: Number,
|
|
12
12
|
val gutterSize: Number,
|
|
13
13
|
val sizePerSpan: Number,
|
|
@@ -15,16 +15,21 @@ data class GridContext (
|
|
|
15
15
|
)
|
|
16
16
|
|
|
17
17
|
@Composable
|
|
18
|
-
fun Item(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
fun Item(
|
|
19
|
+
heightSpan: Number = 1,
|
|
20
|
+
widthSpan: Number = 1,
|
|
21
|
+
content: @Composable() () -> Unit,
|
|
22
|
+
modifier: Modifier = Modifier,
|
|
23
|
+
grid: GridContext
|
|
24
|
+
) {
|
|
23
25
|
|
|
24
26
|
val widthItem = grid.getSizeSpan(widthSpan)
|
|
25
27
|
val heightItem = grid.getSizeSpan(heightSpan)
|
|
26
28
|
|
|
27
|
-
Box(
|
|
29
|
+
Box(
|
|
30
|
+
modifier = modifier.width(width = Dp(widthItem.toFloat()))
|
|
31
|
+
.height(height = Dp(heightItem.toFloat()))
|
|
32
|
+
) {
|
|
28
33
|
content()
|
|
29
34
|
}
|
|
30
35
|
}
|
|
@@ -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
|
|
14
|
+
fun Modifier.setAutomationId(accessibilityId: String, label: String? = null): Modifier {
|
|
15
15
|
return if (getPlatformName() == "Android") {
|
|
16
16
|
semantics {
|
|
17
17
|
contentDescription = accessibilityId
|
|
@@ -2,7 +2,7 @@ package vn.momo.kits.modifier
|
|
|
2
2
|
|
|
3
3
|
import androidx.compose.ui.Modifier
|
|
4
4
|
|
|
5
|
-
fun Modifier.conditional(condition
|
|
5
|
+
fun Modifier.conditional(condition: Boolean, modifier: Modifier.() -> Modifier): Modifier {
|
|
6
6
|
return if (condition) {
|
|
7
7
|
then(modifier(Modifier))
|
|
8
8
|
} else {
|
|
@@ -138,12 +138,11 @@ public struct Header: View {
|
|
|
138
138
|
|
|
139
139
|
public var body: some View {
|
|
140
140
|
|
|
141
|
-
let statusBarHeight = safeAreaTopInset()
|
|
142
141
|
let tintIconColor = Colors.black17
|
|
143
142
|
let backgroundButton = Colors.black01.opacity(0.6)
|
|
144
143
|
|
|
145
144
|
if headerType != .none {
|
|
146
|
-
|
|
145
|
+
VStack(spacing: 0) {
|
|
147
146
|
ZStack {
|
|
148
147
|
HStack {
|
|
149
148
|
if let goBack = goBack {
|
|
@@ -153,8 +152,7 @@ public struct Header: View {
|
|
|
153
152
|
.background(Circle().fill(backgroundButton))
|
|
154
153
|
.frame(width: 28, height: 28)
|
|
155
154
|
.overlay(
|
|
156
|
-
|
|
157
|
-
.foregroundColor(.black)
|
|
155
|
+
Icon(source: "arrow-back", size: 20, color: Colors.black17)
|
|
158
156
|
)
|
|
159
157
|
}
|
|
160
158
|
|
|
@@ -167,14 +165,11 @@ public struct Header: View {
|
|
|
167
165
|
}
|
|
168
166
|
|
|
169
167
|
}
|
|
170
|
-
.
|
|
171
|
-
.padding(.horizontal)
|
|
172
|
-
|
|
173
|
-
|
|
168
|
+
.padding(.horizontal, 12)
|
|
174
169
|
|
|
175
170
|
HStack {
|
|
176
171
|
if titlePosition == .left, goBack != nil {
|
|
177
|
-
Spacer().frame(width:
|
|
172
|
+
Spacer().frame(width: 38)
|
|
178
173
|
}
|
|
179
174
|
|
|
180
175
|
if inputSearchProps != nil {
|
|
@@ -201,20 +196,22 @@ public struct Header: View {
|
|
|
201
196
|
}
|
|
202
197
|
} else {
|
|
203
198
|
Text(title)
|
|
204
|
-
.font(.
|
|
199
|
+
.font(Font.system(size: 17).weight(.bold)) .lineSpacing(22)
|
|
205
200
|
.foregroundColor(tintIconColor)
|
|
206
|
-
.frame(maxWidth: titlePosition == .center ? .
|
|
201
|
+
.frame(maxWidth: titlePosition == .center ? UIScreen.main.bounds.width - 252 : nil)
|
|
202
|
+
.frame(maxWidth: titlePosition == .center ? .infinity : UIScreen.main.bounds.width - 172, alignment: titlePosition == .center ? .center : .leading)
|
|
203
|
+
.lineLimit(1)
|
|
204
|
+
|
|
207
205
|
}
|
|
208
206
|
Spacer()
|
|
209
207
|
}
|
|
210
|
-
.frame(height: 52)
|
|
211
208
|
.padding(.horizontal)
|
|
212
209
|
}
|
|
213
210
|
.background(Color.clear)
|
|
214
211
|
}
|
|
215
|
-
|
|
212
|
+
.frame(height: 52)
|
|
216
213
|
}
|
|
217
|
-
|
|
214
|
+
}
|
|
218
215
|
}
|
|
219
216
|
|
|
220
217
|
|
|
@@ -34,7 +34,7 @@ public struct Screen<Content: View>: View {
|
|
|
34
34
|
verticalAlignment: VerticalAlignment = .top,
|
|
35
35
|
horizontalAlignment: HorizontalAlignment = .leading,
|
|
36
36
|
title: String = "Stack",
|
|
37
|
-
titlePosition: TitlePosition = .
|
|
37
|
+
titlePosition: TitlePosition = .left,
|
|
38
38
|
goBack: (() -> Void)? = nil,
|
|
39
39
|
scrollable: Bool = true,
|
|
40
40
|
onContentLayout: ((CGRect) -> Void)? = nil,
|
|
@@ -71,23 +71,25 @@ public struct Screen<Content: View>: View {
|
|
|
71
71
|
|
|
72
72
|
public var body: some View {
|
|
73
73
|
GeometryReader { geometry in
|
|
74
|
-
let
|
|
75
|
-
let statusBarHeight = safeAreaInsets.top
|
|
74
|
+
let topInset = geometry.safeAreaInsets.top
|
|
76
75
|
let keyboardHeight: CGFloat = 0
|
|
77
76
|
let keyboardSize: CGFloat = useAvoidKeyboard ? max(keyboardHeight, 0) : 0
|
|
77
|
+
let height = geometry.size.height
|
|
78
|
+
let bottomInset = geometry.safeAreaInsets.bottom
|
|
79
|
+
let screenHeight = height + topInset + bottomInset
|
|
78
80
|
|
|
79
81
|
ZStack {
|
|
80
82
|
(backgroundColor ?? Color.white).edgesIgnoringSafeArea(.all)
|
|
81
83
|
|
|
82
84
|
VStack(spacing: 0) {
|
|
83
|
-
ZStack {
|
|
84
|
-
if animatedHeader == nil {
|
|
85
|
-
HeaderBackground(headerType: headerType, scrollState: scrollOffset)
|
|
86
|
-
} else {
|
|
87
|
-
Color.white.opacity(Double(min(scrollOffset / 114, 1)))
|
|
88
|
-
.overlay(HeaderBackground(headerType: headerType, scrollState: scrollOffset))
|
|
89
|
-
|
|
90
|
-
}
|
|
85
|
+
ZStack(alignment: .top) {
|
|
86
|
+
// if animatedHeader == nil {
|
|
87
|
+
// HeaderBackground(headerType: headerType, scrollState: scrollOffset)
|
|
88
|
+
// } else {
|
|
89
|
+
// Color.white.opacity(Double(min(scrollOffset / 114, 1)))
|
|
90
|
+
// .overlay(HeaderBackground(headerType: headerType, scrollState: scrollOffset))
|
|
91
|
+
//
|
|
92
|
+
// }
|
|
91
93
|
|
|
92
94
|
Header(
|
|
93
95
|
headerType: headerType,
|
|
@@ -99,13 +101,17 @@ public struct Screen<Content: View>: View {
|
|
|
99
101
|
animatedHeader: animatedHeader,
|
|
100
102
|
scrollState: scrollOffset,
|
|
101
103
|
inputSearchProps: inputSearchProps
|
|
102
|
-
)
|
|
103
|
-
|
|
104
|
+
)
|
|
105
|
+
.background(HeaderBackground(headerType: headerType, scrollState: scrollOffset).edgesIgnoringSafeArea(.top))
|
|
106
|
+
.offset(y: topInset)
|
|
107
|
+
|
|
108
|
+
}
|
|
109
|
+
.offset(y: -topInset)
|
|
104
110
|
|
|
105
111
|
|
|
106
112
|
VStack(alignment: horizontalAlignment, spacing: 0) {
|
|
107
113
|
if animatedHeader != nil {
|
|
108
|
-
Spacer().frame(height:
|
|
114
|
+
Spacer().frame(height: topInset + 52 + layoutOffset)
|
|
109
115
|
}
|
|
110
116
|
|
|
111
117
|
if scrollable {
|
|
@@ -46,8 +46,8 @@ public struct PopupDisplay: View {
|
|
|
46
46
|
.overlay(RoundedRectangle(cornerRadius: Radius.L).stroke(Colors.black01, lineWidth: 1))
|
|
47
47
|
}.foregroundColor(Colors.black20)
|
|
48
48
|
.background(Colors.black01.cornerRadius(15))
|
|
49
|
-
.padding(.trailing, -
|
|
50
|
-
.padding(.top, -
|
|
49
|
+
.padding(.trailing, -11)
|
|
50
|
+
.padding(.top, -11)
|
|
51
51
|
.zIndex(1)
|
|
52
52
|
.accessibility(identifier: "ic_popup_close")
|
|
53
53
|
|
|
@@ -62,7 +62,7 @@ public struct PopupDisplay: View {
|
|
|
62
62
|
}
|
|
63
63
|
.scaledToFill()
|
|
64
64
|
.frame(maxWidth: .infinity)
|
|
65
|
-
.clipShape(RoundedCorner(radius:
|
|
65
|
+
.clipShape(RoundedCorner(radius: 15, corners: [.topLeft, .topRight]))
|
|
66
66
|
.aspectRatio(2, contentMode: .fit)
|
|
67
67
|
}
|
|
68
68
|
VStack(alignment: .leading) {
|