diff --git a/android/build.gradle.kts b/android/build.gradle.kts index 9167d9999..85ef1daf0 100644 --- a/android/build.gradle.kts +++ b/android/build.gradle.kts @@ -2,6 +2,7 @@ plugins { id("org.jetbrains.compose") id("com.android.application") kotlin("multiplatform") + alias(libs.plugins.compose.compiler) } kotlin { diff --git a/build.gradle.kts b/build.gradle.kts index db9e92d39..78785e629 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -11,6 +11,7 @@ plugins { id("org.jlleitschuh.gradle.ktlint") version "11.5.1" id("org.jetbrains.dokka") version "1.9.20" id("io.github.gradle-nexus.publish-plugin") version "1.3.0" + alias(libs.plugins.compose.compiler) } /** @@ -27,6 +28,9 @@ allprojects { version.set("0.50.0") verbose.set(true) outputToConsole.set(true) + filter { + exclude("**/generated/**") + } } tasks.withType().all { diff --git a/common/build.gradle.kts b/common/build.gradle.kts index 8ee239633..3c7df18a1 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -2,6 +2,7 @@ plugins { kotlin("multiplatform") id("org.jetbrains.compose") id("com.android.library") + alias(libs.plugins.compose.compiler) } kotlin { diff --git a/common/src/commonMain/resources/drawable/sample.png b/common/src/commonMain/composeResources/drawable/sample.png similarity index 100% rename from common/src/commonMain/resources/drawable/sample.png rename to common/src/commonMain/composeResources/drawable/sample.png diff --git a/common/src/commonMain/resources/drawable/sample_signature.jpeg b/common/src/commonMain/composeResources/drawable/sample_signature.jpeg similarity index 100% rename from common/src/commonMain/resources/drawable/sample_signature.jpeg rename to common/src/commonMain/composeResources/drawable/sample_signature.jpeg diff --git a/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/actionInputs/InputBarCodeScreen.kt b/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/actionInputs/InputBarCodeScreen.kt index c8fcca0ca..7c27b478d 100644 --- a/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/actionInputs/InputBarCodeScreen.kt +++ b/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/actionInputs/InputBarCodeScreen.kt @@ -6,7 +6,7 @@ import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.size import androidx.compose.material.icons.Icons import androidx.compose.material.icons.outlined.Info -import androidx.compose.material3.Divider +import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Icon import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue @@ -123,11 +123,11 @@ fun InputBarCodeScreen() { Description("Barcode Block", textColor = TextColor.OnSurfaceVariant) BarcodeBlock(data = "Barcode value") - Divider() + HorizontalDivider() BarcodeBlock(data = "889026a1-d01e-4d34-8209-81e8ed5c614b") - Divider() + HorizontalDivider() BarcodeBlock(data = "l;kw1jheoi1u23iop1") - Divider() + HorizontalDivider() RowComponentContainer { BarcodeBlock(data = "563ce8df-8e0b-420c-a63c-fe000b1d1f11") BarcodeBlock(data = "378c472d-bb05-4174-9fe5-f6dbf8f5de36") diff --git a/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/actionInputs/InputImageScreen.kt b/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/actionInputs/InputImageScreen.kt index 46308d974..52526cd5f 100644 --- a/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/actionInputs/InputImageScreen.kt +++ b/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/actionInputs/InputImageScreen.kt @@ -10,6 +10,8 @@ import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.painter.Painter +import mobile_ui.common.generated.resources.Res +import mobile_ui.common.generated.resources.sample import org.hisp.dhis.mobile.ui.designsystem.component.ColumnComponentContainer import org.hisp.dhis.mobile.ui.designsystem.component.ImageBlock import org.hisp.dhis.mobile.ui.designsystem.component.InputImage @@ -19,7 +21,6 @@ import org.hisp.dhis.mobile.ui.designsystem.component.Title import org.hisp.dhis.mobile.ui.designsystem.component.UploadState import org.hisp.dhis.mobile.ui.designsystem.theme.Spacing import org.hisp.dhis.mobile.ui.designsystem.theme.TextColor -import org.jetbrains.compose.resources.ExperimentalResourceApi import org.jetbrains.compose.resources.painterResource import java.util.Timer import kotlin.concurrent.schedule @@ -94,7 +95,6 @@ fun InputImageScreen() { } } -@OptIn(ExperimentalResourceApi::class) @Composable private fun provideSampleImage(): Painter = - painterResource("drawable/sample.png") + painterResource(Res.drawable.sample) diff --git a/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/actionInputs/InputSignatureScreen.kt b/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/actionInputs/InputSignatureScreen.kt index a1cc6ae1d..01fd0c9e4 100644 --- a/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/actionInputs/InputSignatureScreen.kt +++ b/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/actionInputs/InputSignatureScreen.kt @@ -12,6 +12,8 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.ImageBitmap import androidx.compose.ui.graphics.painter.BitmapPainter import androidx.compose.ui.graphics.painter.Painter +import mobile_ui.common.generated.resources.Res +import mobile_ui.common.generated.resources.sample_signature import org.hisp.dhis.mobile.ui.designsystem.component.ColumnComponentContainer import org.hisp.dhis.mobile.ui.designsystem.component.InputShellState import org.hisp.dhis.mobile.ui.designsystem.component.InputSignature @@ -19,7 +21,6 @@ import org.hisp.dhis.mobile.ui.designsystem.component.SubTitle import org.hisp.dhis.mobile.ui.designsystem.component.Title import org.hisp.dhis.mobile.ui.designsystem.theme.Spacing import org.hisp.dhis.mobile.ui.designsystem.theme.TextColor -import org.jetbrains.compose.resources.ExperimentalResourceApi import org.jetbrains.compose.resources.painterResource @Composable @@ -91,7 +92,6 @@ fun InputSignatureScreen() { } } -@OptIn(ExperimentalResourceApi::class) @Composable private fun provideSampleImage(): Painter = - painterResource("drawable/sample_signature.jpeg") + painterResource(Res.drawable.sample_signature) diff --git a/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/actionInputs/LoginScreen.kt b/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/actionInputs/LoginScreen.kt index 15cddc7a2..7d327fdff 100644 --- a/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/actionInputs/LoginScreen.kt +++ b/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/actionInputs/LoginScreen.kt @@ -2,7 +2,7 @@ package org.hisp.dhis.common.screens.actionInputs import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.outlined.Login +import androidx.compose.material.icons.automirrored.outlined.Login import androidx.compose.material3.Icon import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue @@ -58,7 +58,7 @@ fun LoginScreen() { text = "Log In", icon = { Icon( - imageVector = Icons.Outlined.Login, + imageVector = Icons.AutoMirrored.Outlined.Login, contentDescription = "Login button", ) diff --git a/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/bottomSheets/BottomSheetHeaderScreen.kt b/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/bottomSheets/BottomSheetHeaderScreen.kt index f545bc7a9..a9bfc649c 100644 --- a/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/bottomSheets/BottomSheetHeaderScreen.kt +++ b/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/bottomSheets/BottomSheetHeaderScreen.kt @@ -5,8 +5,8 @@ import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.size import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.automirrored.outlined.HelpOutline import androidx.compose.material.icons.outlined.BookmarkBorder -import androidx.compose.material.icons.outlined.HelpOutline import androidx.compose.material3.Icon import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier @@ -75,7 +75,7 @@ fun BottomSheetHeaderScreen() { title = "Title", icon = { Icon( - imageVector = Icons.Outlined.HelpOutline, + imageVector = Icons.AutoMirrored.Outlined.HelpOutline, contentDescription = "Button", tint = SurfaceColor.Primary, ) @@ -92,7 +92,7 @@ fun BottomSheetHeaderScreen() { headerTextAlignment = TextAlign.Start, icon = { Icon( - imageVector = Icons.Outlined.HelpOutline, + imageVector = Icons.AutoMirrored.Outlined.HelpOutline, contentDescription = "Button", tint = SurfaceColor.Primary, ) diff --git a/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/bottomSheets/BottomSheetScreen.kt b/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/bottomSheets/BottomSheetScreen.kt index 201dfb2bb..a7168ca1c 100644 --- a/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/bottomSheets/BottomSheetScreen.kt +++ b/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/bottomSheets/BottomSheetScreen.kt @@ -13,7 +13,7 @@ import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Add import androidx.compose.material.icons.outlined.Info -import androidx.compose.material3.Divider +import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Icon import androidx.compose.material3.Text import androidx.compose.runtime.Composable @@ -88,7 +88,7 @@ fun BottomSheetScreen() { items(longLegendList) { item -> Column { Text(text = item.text, modifier = Modifier.padding(horizontal = 24.dp, vertical = 12.dp)) - Divider() + HorizontalDivider() } } } diff --git a/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/others/BadgesScreen.kt b/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/others/BadgesScreen.kt index a3b86fb1d..590fd7ee7 100644 --- a/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/others/BadgesScreen.kt +++ b/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/others/BadgesScreen.kt @@ -9,10 +9,16 @@ import org.hisp.dhis.mobile.ui.designsystem.component.ErrorBadge fun BadgesScreen() { ColumnComponentContainer(title = "Badges") { Badge() + Badge(text = "3") Badge(text = "32") + Badge(text = "321") + Badge(text = "4321") } ColumnComponentContainer(title = "Error badges") { ErrorBadge() + ErrorBadge(text = "3") ErrorBadge(text = "32") + ErrorBadge(text = "321") + ErrorBadge(text = "4321") } } diff --git a/designsystem/build.gradle.kts b/designsystem/build.gradle.kts index 2ae311c0a..11d614fda 100644 --- a/designsystem/build.gradle.kts +++ b/designsystem/build.gradle.kts @@ -7,6 +7,7 @@ plugins { id("com.android.library") id("convention.publication") id("app.cash.paparazzi").version("1.3.3") + alias(libs.plugins.compose.compiler) } kotlin { diff --git a/designsystem/src/androidUnitTest/kotlin/org/hisp/dhis/mobile/ui/designsystem/LoginSnapshotTest.kt b/designsystem/src/androidUnitTest/kotlin/org/hisp/dhis/mobile/ui/designsystem/LoginSnapshotTest.kt index b1c1caddc..cf0020868 100644 --- a/designsystem/src/androidUnitTest/kotlin/org/hisp/dhis/mobile/ui/designsystem/LoginSnapshotTest.kt +++ b/designsystem/src/androidUnitTest/kotlin/org/hisp/dhis/mobile/ui/designsystem/LoginSnapshotTest.kt @@ -3,10 +3,8 @@ package org.hisp.dhis.mobile.ui.designsystem import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.outlined.Login +import androidx.compose.material.icons.automirrored.outlined.Login import androidx.compose.material3.Icon -import androidx.compose.runtime.getValue -import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.text.input.TextFieldValue import org.hisp.dhis.mobile.ui.designsystem.component.Button @@ -61,7 +59,7 @@ class LoginSnapshotTest { text = "Log In", icon = { Icon( - imageVector = Icons.Outlined.Login, + imageVector = Icons.AutoMirrored.Outlined.Login, contentDescription = "Login button", ) diff --git a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/AssistChip.kt b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/AssistChip.kt index 384a53955..86252b2ab 100644 --- a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/AssistChip.kt +++ b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/AssistChip.kt @@ -7,7 +7,6 @@ import androidx.compose.foundation.layout.offset import androidx.compose.material.ripple.LocalRippleTheme import androidx.compose.material3.AssistChip import androidx.compose.material3.AssistChipDefaults -import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider @@ -37,7 +36,6 @@ import org.hisp.dhis.mobile.ui.designsystem.theme.TextColor * @param onClick: Will be called when the user taps the chip. * @param badge: the text to be displayed within the badge. */ -@OptIn(ExperimentalMaterial3Api::class) @Composable fun AssistChip( modifier: Modifier = Modifier, @@ -75,6 +73,7 @@ fun AssistChip( }, border = AssistChipDefaults.assistChipBorder( borderColor = Outline.Dark, + enabled = enabled, ), leadingIcon = { icon?.invoke() diff --git a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/Badge.kt b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/Badge.kt index 80bcb04f0..46b9f0a69 100644 --- a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/Badge.kt +++ b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/Badge.kt @@ -1,22 +1,14 @@ package org.hisp.dhis.mobile.ui.designsystem.component -import androidx.compose.foundation.background -import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.defaultMinSize -import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.shape.CircleShape -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color -import androidx.compose.ui.text.style.TextAlign -import org.hisp.dhis.mobile.ui.designsystem.theme.Spacing import org.hisp.dhis.mobile.ui.designsystem.theme.SurfaceColor import org.hisp.dhis.mobile.ui.designsystem.theme.TextColor /** - * DHIS2 [Badge]) wraps Material 3's [Box]. + * DHIS2 [Badge]) wraps [androidx.compose.material3.Badge]. * Badges are used to convey dynamic information, * such as a count or status. * A badge can include text, labels, or numbers. @@ -32,22 +24,20 @@ fun Badge( color: Color = SurfaceColor.Primary, textColor: Color = TextColor.OnPrimary, ) { - Box( - modifier - .defaultMinSize(Spacing.Spacing6, Spacing.Spacing6) - .background(color, CircleShape), - ) { - text?.let { - Text( - modifier = Modifier - .padding(horizontal = Spacing.Spacing4) - .padding(bottom = Spacing.Spacing1), - text = it, - textAlign = TextAlign.Center, - style = MaterialTheme.typography.labelSmall.copy(color = textColor), - ) - } - } + androidx.compose.material3.Badge( + modifier = modifier, + containerColor = color, + content = if (text != null) { + { + Text( + text = text, + color = textColor, + ) + } + } else { + null + }, + ) } @Composable diff --git a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/BottomSheet.kt b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/BottomSheet.kt index f8cb369af..c7f1e93d9 100644 --- a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/BottomSheet.kt +++ b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/BottomSheet.kt @@ -16,8 +16,8 @@ import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material.icons.Icons import androidx.compose.material.icons.outlined.Close -import androidx.compose.material3.Divider import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.ModalBottomSheet @@ -40,6 +40,7 @@ import androidx.compose.ui.unit.dp import kotlinx.coroutines.launch import org.hisp.dhis.mobile.ui.designsystem.component.internal.Keyboard import org.hisp.dhis.mobile.ui.designsystem.component.internal.keyboardAsState +import org.hisp.dhis.mobile.ui.designsystem.theme.Border import org.hisp.dhis.mobile.ui.designsystem.theme.InternalSizeValues import org.hisp.dhis.mobile.ui.designsystem.theme.Shape import org.hisp.dhis.mobile.ui.designsystem.theme.Spacing @@ -245,10 +246,11 @@ fun BottomSheetShell( if (showHeader || hasSearch) { if (showSectionDivider) { - Divider( + HorizontalDivider( modifier = Modifier.fillMaxWidth() .padding(top = Spacing24, start = Spacing24, end = Spacing24), color = TextColor.OnDisabledSurface, + thickness = Border.Thin, ) } else { Spacer(Modifier.requiredHeight(Spacing24)) @@ -271,9 +273,10 @@ fun BottomSheetShell( ) { content.invoke() if (showSectionDivider) { - Divider( + HorizontalDivider( modifier = Modifier.fillMaxWidth().padding(top = Spacing8), color = TextColor.OnDisabledSurface, + thickness = Border.Thin, ) } } diff --git a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/FilterChip.kt b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/FilterChip.kt index dd80370a6..82bc9e0ad 100644 --- a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/FilterChip.kt +++ b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/FilterChip.kt @@ -6,7 +6,6 @@ import androidx.compose.foundation.layout.size import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Done import androidx.compose.material.ripple.LocalRippleTheme -import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.FilterChip import androidx.compose.material3.FilterChipDefaults import androidx.compose.material3.Icon @@ -37,7 +36,6 @@ import org.hisp.dhis.mobile.ui.designsystem.theme.TextColor * @param onSelected: Will be called when the user taps the chip. * @param badge: the text to be displayed within the badge. */ -@OptIn(ExperimentalMaterial3Api::class) @Composable fun FilterChip( modifier: Modifier = Modifier, @@ -58,6 +56,8 @@ fun FilterChip( ), border = FilterChipDefaults.filterChipBorder( borderColor = Outline.Dark, + enabled = true, + selected = selected, ), leadingIcon = if (selected) { { diff --git a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/FullScreenImage.kt b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/FullScreenImage.kt index f149bcb07..3057a0982 100644 --- a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/FullScreenImage.kt +++ b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/FullScreenImage.kt @@ -6,7 +6,7 @@ import androidx.compose.animation.core.tween import androidx.compose.animation.core.updateTransition import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.outlined.ArrowBack +import androidx.compose.material.icons.automirrored.outlined.ArrowBack import androidx.compose.material.icons.outlined.FileDownload import androidx.compose.material.icons.outlined.Share import androidx.compose.material3.ExperimentalMaterial3Api @@ -90,7 +90,7 @@ fun FullScreenImage( modifier = Modifier.testTag("FULL_SCREEN_IMAGE_BACK_BUTTON"), icon = { Icon( - imageVector = Icons.Outlined.ArrowBack, + imageVector = Icons.AutoMirrored.Outlined.ArrowBack, contentDescription = "Back Button", tint = SurfaceColor.SurfaceBright, ) diff --git a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/InputAge.kt b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/InputAge.kt index f1582e287..bcc75de3c 100644 --- a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/InputAge.kt +++ b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/InputAge.kt @@ -73,7 +73,13 @@ fun InputAge( } val focusRequester = remember { FocusRequester() } - val datePickerState = rememberDatePickerState() + val datePickerState = rememberDatePickerState( + selectableDates = object : androidx.compose.material3.SelectableDates { + override fun isSelectableDate(utcTimeMillis: Long): Boolean { + return dateIsInRange(utcTimeMillis, uiModel.selectableDates) + } + }, + ) val calendarButton: (@Composable () -> Unit)? = if (uiModel.inputType is DateOfBirth) { @Composable { @@ -273,9 +279,6 @@ fun InputAge( state = datePickerState, showModeToggle = true, modifier = Modifier.padding(Spacing.Spacing0), - dateValidator = { date -> - dateIsInRange(date, uiModel.selectableDates) - }, ) } } diff --git a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/InputChip.kt b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/InputChip.kt index fea4b54f8..6e5f3e031 100644 --- a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/InputChip.kt +++ b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/InputChip.kt @@ -7,7 +7,6 @@ import androidx.compose.foundation.layout.size import androidx.compose.material.icons.Icons import androidx.compose.material.icons.outlined.Close import androidx.compose.material.ripple.LocalRippleTheme -import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.FilterChipDefaults import androidx.compose.material3.Icon import androidx.compose.material3.Text @@ -42,7 +41,6 @@ import org.hisp.dhis.mobile.ui.designsystem.theme.TextColor * @param focusRequester: component focus requester. * @param modifier: optional modifier. */ -@OptIn(ExperimentalMaterial3Api::class) @Composable fun InputChip( modifier: Modifier = Modifier, @@ -91,6 +89,8 @@ fun InputChip( border = FilterChipDefaults.filterChipBorder( borderColor = Outline.Dark, disabledBorderColor = Outline.Medium, + enabled = enabled, + selected = selected, ), trailingIcon = if (withTrailingIcon && enabled) { { diff --git a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/InputDateTime.kt b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/InputDateTime.kt index eb062b308..e0fcc5b2f 100644 --- a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/InputDateTime.kt +++ b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/InputDateTime.kt @@ -238,7 +238,9 @@ fun InputDateTime( }, inputStyle = uiModel.inputStyle, ) - var datePickerState = rememberDatePickerState() + var datePickerState = rememberDatePickerState( + selectableDates = getSelectableDates(uiModel), + ) if (!uiModel.inputTextFieldValue?.text.isNullOrEmpty() && uiModel.actionType != DateTimeActionType.TIME) { datePickerState = if (uiModel.actionType == DateTimeActionType.DATE_TIME && uiModel.inputTextFieldValue?.text?.length == 12 && yearIsInRange(uiModel.inputTextFieldValue.text.substring(0, 8), uiModel.yearRange)) { rememberDatePickerState( @@ -247,12 +249,14 @@ fun InputDateTime( pattern = uiModel.format, ), yearRange = uiModel.yearRange, + selectableDates = getSelectableDates(uiModel), ) } else { if (uiModel.inputTextFieldValue?.text?.length == 8 && yearIsInRange(uiModel.inputTextFieldValue.text, uiModel.yearRange)) { rememberDatePickerState( initialSelectedDateMillis = parseStringDateToMillis(uiModel.inputTextFieldValue.text, uiModel.format), yearRange = uiModel.yearRange, + selectableDates = getSelectableDates(uiModel), ) } else { datePickerState @@ -315,9 +319,6 @@ fun InputDateTime( state = datePickerState, showModeToggle = true, modifier = Modifier.padding(Spacing.Spacing0), - dateValidator = { date -> - dateIsInRange(date, uiModel.selectableDates, uiModel.format) - }, ) } } @@ -392,6 +393,15 @@ fun InputDateTime( } } +@OptIn(ExperimentalMaterial3Api::class) +fun getSelectableDates(uiModel: InputDateTimeModel): androidx.compose.material3.SelectableDates { + return object : androidx.compose.material3.SelectableDates { + override fun isSelectableDate(utcTimeMillis: Long): Boolean { + return dateIsInRange(utcTimeMillis, uiModel.selectableDates, uiModel.format) + } + } +} + private fun getSupportingTextList(uiModel: InputDateTimeModel, dateOutOfRangeItem: SupportingTextData, incorrectHourFormatItem: SupportingTextData): List { val supportingTextList = mutableListOf() diff --git a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/InputField.kt b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/InputField.kt index cef43c74d..9a5ec7edc 100644 --- a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/InputField.kt +++ b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/InputField.kt @@ -16,7 +16,6 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.ui.Alignment -import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.SolidColor @@ -50,7 +49,6 @@ import org.hisp.dhis.mobile.ui.designsystem.theme.textFieldHoverPointerIcon * @param onNextClicked: gives access to the ImeAction event. * @param onSearchClicked: gives access to the ImeAction Search event. */ -@OptIn(ExperimentalComposeUiApi::class) @Composable fun BasicTextField( helper: String? = null, diff --git a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/InputShell.kt b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/InputShell.kt index 264b41c0e..22038aeb3 100644 --- a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/InputShell.kt +++ b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/InputShell.kt @@ -16,7 +16,8 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.material3.Divider +import androidx.compose.material3.HorizontalDivider +import androidx.compose.material3.VerticalDivider import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf @@ -29,7 +30,6 @@ import androidx.compose.ui.focus.FocusRequester import androidx.compose.ui.focus.focusRequester import androidx.compose.ui.focus.onFocusChanged import androidx.compose.ui.graphics.Color -import androidx.compose.ui.graphics.graphicsLayer import androidx.compose.ui.input.pointer.pointerInput import androidx.compose.ui.unit.Dp import org.hisp.dhis.mobile.ui.designsystem.theme.Border @@ -84,80 +84,79 @@ internal fun InputShell( } val focusRequester = remember { FocusRequester() } - InputShellRow( - modifier = Modifier - .focusRequester(focusRequester) - .pointerInput(Unit) { - if (state != InputShellState.DISABLED) { - detectTapGestures( - onTap = { focusRequester.requestFocus() }, - ) - } - } - .onFocusChanged { - labelColor = when { - state == InputShellState.DISABLED -> InputShellState.DISABLED.color - it.isFocused && state != InputShellState.ERROR && state != InputShellState.WARNING -> InputShellState.FOCUSED.color - else -> state.color + Box { + InputShellRow( + modifier = Modifier + .focusRequester(focusRequester) + .pointerInput(Unit) { + if (state != InputShellState.DISABLED) { + detectTapGestures( + onTap = { focusRequester.requestFocus() }, + ) + } } - indicatorColor = - when { - state == InputShellState.DISABLED -> - inputStyle.disabledIndicatorColor - ?: InputShellState.DISABLED.color - + .onFocusChanged { + labelColor = when { + state == InputShellState.DISABLED -> InputShellState.DISABLED.color it.isFocused && state != InputShellState.ERROR && state != InputShellState.WARNING -> InputShellState.FOCUSED.color - state == InputShellState.UNFOCUSED -> - inputStyle.unfocusedIndicatorColor - ?: state.color - else -> state.color } - indicatorThickness = when { - state == InputShellState.DISABLED -> Border.Thin - it.isFocused -> Border.Regular - else -> Border.Thin - } - onFocusChanged?.invoke(it.isFocused) - }.padding(start = inputStyle.startIndent), - backgroundColor = backgroundColor, - ) { - Column( - Modifier - .weight(4f, false) - .padding(end = Spacing.Spacing4) - .fillMaxWidth(1f), - verticalArrangement = Arrangement.Center, - ) { - if (title.isNotEmpty()) { - val titleText = if (isRequiredField) "$title *" else title - InputShellLabelText(titleText, textColor = labelColor) - } - inputField?.invoke() - } - Row( - verticalAlignment = Alignment.CenterVertically, - modifier = Modifier.height(Spacing.Spacing48).align(Alignment.CenterVertically), + indicatorColor = + when { + state == InputShellState.DISABLED -> + inputStyle.disabledIndicatorColor + ?: InputShellState.DISABLED.color + + it.isFocused && state != InputShellState.ERROR && state != InputShellState.WARNING -> InputShellState.FOCUSED.color + state == InputShellState.UNFOCUSED -> + inputStyle.unfocusedIndicatorColor + ?: state.color + + else -> state.color + } + indicatorThickness = when { + state == InputShellState.DISABLED -> Border.Thin + it.isFocused -> Border.Regular + else -> Border.Thin + } + onFocusChanged?.invoke(it.isFocused) + }.padding(start = inputStyle.startIndent), + backgroundColor = backgroundColor, ) { - primaryButton?.invoke() - if (primaryButton != null && secondaryButton != null) { - InputShellButtonSeparator() - Spacer(modifier = Modifier.width(Spacing.Spacing4)) + Column( + Modifier + .weight(4f, false) + .padding(end = Spacing.Spacing4) + .fillMaxWidth(1f), + verticalArrangement = Arrangement.Center, + ) { + if (title.isNotEmpty()) { + val titleText = if (isRequiredField) "$title *" else title + InputShellLabelText(titleText, textColor = labelColor) + } + inputField?.invoke() } - secondaryButton?.let { - Box( - Modifier - .padding(end = Spacing.Spacing4).size(Spacing.Spacing48), - ) { - it.invoke() + Row( + verticalAlignment = Alignment.CenterVertically, + modifier = Modifier.height(Spacing.Spacing48).align(Alignment.CenterVertically), + ) { + primaryButton?.invoke() + if (primaryButton != null && secondaryButton != null) { + InputShellButtonSeparator() + Spacer(modifier = Modifier.width(Spacing.Spacing4)) + } + secondaryButton?.let { + Box( + Modifier + .padding(end = Spacing.Spacing4).size(Spacing.Spacing48), + ) { + it.invoke() + } } } } - } - Box(Modifier.height(Spacing.Spacing2)) { InputShellIndicator( - modifier = Modifier.align(Alignment.BottomStart) - .graphicsLayer { translationY = -Spacing.Spacing2.toPx() }, + modifier = Modifier.align(Alignment.BottomStart), color = indicatorColor, thickness = indicatorThickness, ) @@ -203,24 +202,23 @@ private fun InputShellRow( } /** - * DHIS2 InputShellButtonSeparator, wraps Material 3 [Divider] + * DHIS2 InputShellButtonSeparator, wraps Material 3 [VerticalDivider] * used in the [InputShell] component */ @Composable private fun InputShellButtonSeparator( modifier: Modifier = Modifier, ) { - Divider( + VerticalDivider( color = Outline.Medium, thickness = Border.Thin, modifier = modifier - .height(Spacing.Spacing40) - .width(Border.Thin), + .height(Spacing.Spacing40), ) } /** - * DHIS2 InputShellIndicator, wraps Material 3 [Divider] + * DHIS2 InputShellIndicator, wraps Material 3 [HorizontalDivider] * used in the [InputShell] component */ @Composable @@ -229,7 +227,7 @@ private fun InputShellIndicator( modifier: Modifier = Modifier, thickness: Dp = Border.Thin, ) { - Divider( + HorizontalDivider( modifier = modifier.fillMaxWidth(), thickness = thickness, color = color, diff --git a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/Legend.kt b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/Legend.kt index 5cf3fa1a2..44704373c 100644 --- a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/Legend.kt +++ b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/Legend.kt @@ -13,10 +13,10 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.shape.CircleShape import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.outlined.HelpOutline +import androidx.compose.material.icons.automirrored.outlined.HelpOutline import androidx.compose.material.icons.outlined.Info import androidx.compose.material.ripple.rememberRipple -import androidx.compose.material3.Divider +import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text @@ -100,13 +100,13 @@ fun Legend( if (hasPopupLegendDescriptionData) { Icon( - imageVector = Icons.Outlined.HelpOutline, + imageVector = Icons.AutoMirrored.Outlined.HelpOutline, contentDescription = "Legend Icon", modifier = Modifier.size(InternalSizeValues.Size18), ) } } - Divider( + HorizontalDivider( modifier = Modifier .fillMaxWidth() .padding(), diff --git a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/OrgBottomSheet.kt b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/OrgBottomSheet.kt index f2d6e8017..a5b455111 100644 --- a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/OrgBottomSheet.kt +++ b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/OrgBottomSheet.kt @@ -17,10 +17,10 @@ import androidx.compose.foundation.lazy.items import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.foundation.rememberScrollState import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.automirrored.filled.KeyboardArrowRight import androidx.compose.material.icons.filled.Check import androidx.compose.material.icons.filled.ClearAll import androidx.compose.material.icons.filled.KeyboardArrowDown -import androidx.compose.material.icons.filled.KeyboardArrowRight import androidx.compose.material.ripple.rememberRipple import androidx.compose.material3.Checkbox import androidx.compose.material3.Icon @@ -320,7 +320,7 @@ private fun orgTreeItemIcon(orgTreeItem: OrgTreeItem): Painter { return if (orgTreeItem.isOpen) { rememberVectorPainter(Icons.Filled.KeyboardArrowDown) } else { - rememberVectorPainter(Icons.Filled.KeyboardArrowRight) + rememberVectorPainter(Icons.AutoMirrored.Filled.KeyboardArrowRight) } } diff --git a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/ProgressIndicator.kt b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/ProgressIndicator.kt index 7147a8bd2..28b6ec44a 100644 --- a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/ProgressIndicator.kt +++ b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/ProgressIndicator.kt @@ -42,7 +42,7 @@ internal fun LinearIndicator(modifier: Modifier, progress: Float?, hasError: Boo val trackColor = if (hasError) SurfaceColor.ErrorContainer else SurfaceColor.ContainerHigh if (progress != null) { LinearProgressIndicator( - progress = progress, + progress = { progress }, modifier = modifier, color = color, trackColor = trackColor, @@ -61,7 +61,7 @@ internal fun CircularIndicator(modifier: Modifier, progress: Float?, hasError: B val color = if (hasError) SurfaceColor.Error else SurfaceColor.Primary if (progress != null) { CircularProgressIndicator( - progress = progress, + progress = { progress }, modifier = modifier, color = color, ) diff --git a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/Sections.kt b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/Sections.kt index d50cc7542..ecc7bba15 100644 --- a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/Sections.kt +++ b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/Sections.kt @@ -20,7 +20,7 @@ import androidx.compose.foundation.layout.requiredHeight import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.wrapContentHeight import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.filled.ArrowForward +import androidx.compose.material.icons.automirrored.filled.ArrowForward import androidx.compose.material.icons.filled.KeyboardArrowDown import androidx.compose.material.icons.filled.KeyboardArrowUp import androidx.compose.material.ripple.rememberRipple @@ -197,7 +197,7 @@ internal fun SectionBlock( internal fun SectionContent( verticalArrangement: Arrangement.HorizontalOrVertical, content: - @Composable() + @Composable (ColumnScope.() -> Unit), ) { Column( @@ -403,7 +403,7 @@ internal fun NextSectionButton( text = provideStringResource("action_next"), icon = { Icon( - imageVector = Icons.Filled.ArrowForward, + imageVector = Icons.AutoMirrored.Filled.ArrowForward, contentDescription = "Icon Button", ) }, diff --git a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/internal/IconCard.kt b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/internal/IconCard.kt index 2088d52e1..d284a4a8e 100644 --- a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/internal/IconCard.kt +++ b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/internal/IconCard.kt @@ -4,7 +4,6 @@ import androidx.compose.foundation.BorderStroke import androidx.compose.foundation.layout.ColumnScope import androidx.compose.material3.Card import androidx.compose.material3.CardDefaults -import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip @@ -17,7 +16,6 @@ import org.hisp.dhis.mobile.ui.designsystem.theme.SurfaceColor import org.hisp.dhis.mobile.ui.designsystem.theme.iconCardShadow @Composable -@OptIn(ExperimentalMaterial3Api::class) internal fun IconCard( enabled: Boolean = true, selected: Boolean = false, diff --git a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/parameter/ParameterSelector.kt b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/parameter/ParameterSelector.kt index 67f82dbc8..533f3be36 100644 --- a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/parameter/ParameterSelector.kt +++ b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/parameter/ParameterSelector.kt @@ -16,7 +16,7 @@ import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.wrapContentWidth import androidx.compose.material.ripple.rememberRipple -import androidx.compose.material3.Divider +import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable @@ -116,7 +116,7 @@ private fun EmptyParameterField( ) } Box(Modifier.height(Spacing.Spacing2)) { - Divider( + HorizontalDivider( modifier = Modifier.align(Alignment.BottomStart), color = SurfaceColor.DisabledSurface, thickness = Border.Thin, diff --git a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/resource/Image.kt b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/resource/Image.kt index 355aca501..83b0abdfc 100644 --- a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/resource/Image.kt +++ b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/resource/Image.kt @@ -2,14 +2,15 @@ package org.hisp.dhis.mobile.ui.designsystem.resource import androidx.compose.runtime.Composable import androidx.compose.ui.graphics.painter.Painter -import org.jetbrains.compose.resources.ExperimentalResourceApi +import org.jetbrains.compose.resources.DrawableResource +import org.jetbrains.compose.resources.InternalResourceApi +import org.jetbrains.compose.resources.ResourceItem import org.jetbrains.compose.resources.painterResource /** * DHIS2 icons resources * @param resourceName the name of the icon */ -@OptIn(ExperimentalResourceApi::class) @Composable fun provideDHIS2Icon(resourceName: String): Painter { val iconName = if (!resourceExists(resourceName)) { @@ -17,10 +18,29 @@ fun provideDHIS2Icon(resourceName: String): Painter { } else { resourceName } - return painterResource("drawable/$iconName.xml") + return painterResource( + drawableResource(iconName, "xml"), + ) } -@OptIn(ExperimentalResourceApi::class) @Composable fun provideImage(resourceName: String): Painter = - painterResource("drawable/$resourceName.jpg") + painterResource( + drawableResource(resourceName, "jpg"), + ) + +@OptIn(InternalResourceApi::class) +fun drawableResource(resourceName: String, fileExtension: String): DrawableResource = + lazy { + DrawableResource( + resourceName, + setOf( + ResourceItem( + setOf(), + "drawable/$resourceName.$fileExtension", + -1, + -1, + ), + ), + ) + }.value diff --git a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/theme/Theme.kt b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/theme/Theme.kt index a6b510bfc..1830b7c8b 100644 --- a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/theme/Theme.kt +++ b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/theme/Theme.kt @@ -7,6 +7,7 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.text.SpanStyle import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.text.style.LineHeightStyle import androidx.compose.ui.text.style.TextDecoration import androidx.compose.ui.unit.sp import org.hisp.dhis.mobile.ui.designsystem.resource.provideFontResource @@ -39,6 +40,7 @@ fun DHIS2Theme(content: @Composable () -> Unit) { headlineLarge = TextStyle( fontSize = 32.sp, lineHeight = 40.sp, + lineHeightStyle = LineHeightStyles.CentreAlignNoTrim, fontFamily = provideFontResource("roboto_regular"), fontWeight = FontWeight.Normal, color = TextColor.OnSurface, @@ -46,6 +48,7 @@ fun DHIS2Theme(content: @Composable () -> Unit) { headlineMedium = TextStyle( fontSize = 28.sp, lineHeight = 36.sp, + lineHeightStyle = LineHeightStyles.CentreAlignNoTrim, fontFamily = provideFontResource("roboto_regular"), fontWeight = FontWeight.Normal, color = TextColor.OnSurface, @@ -53,6 +56,7 @@ fun DHIS2Theme(content: @Composable () -> Unit) { headlineSmall = TextStyle( fontSize = 24.sp, lineHeight = 32.sp, + lineHeightStyle = LineHeightStyles.CentreAlignNoTrim, fontFamily = provideFontResource("roboto_regular"), fontWeight = FontWeight.Normal, color = TextColor.OnSurface, @@ -60,6 +64,7 @@ fun DHIS2Theme(content: @Composable () -> Unit) { titleLarge = TextStyle( fontSize = 20.sp, lineHeight = 28.sp, + lineHeightStyle = LineHeightStyles.CentreAlignNoTrim, fontFamily = provideFontResource("roboto_medium"), fontWeight = FontWeight.Medium, color = TextColor.OnSurface, @@ -67,6 +72,7 @@ fun DHIS2Theme(content: @Composable () -> Unit) { titleMedium = TextStyle( fontSize = 16.sp, lineHeight = 24.sp, + lineHeightStyle = LineHeightStyles.CentreAlignNoTrim, fontFamily = provideFontResource("roboto_medium"), fontWeight = FontWeight.Medium, color = TextColor.OnSurface, @@ -76,6 +82,7 @@ fun DHIS2Theme(content: @Composable () -> Unit) { titleSmall = TextStyle( fontSize = 14.sp, lineHeight = 20.sp, + lineHeightStyle = LineHeightStyles.CentreAlignNoTrim, fontFamily = provideFontResource("roboto_medium"), fontWeight = FontWeight.Medium, color = TextColor.OnSurface, @@ -84,6 +91,7 @@ fun DHIS2Theme(content: @Composable () -> Unit) { labelLarge = TextStyle( fontSize = 14.sp, lineHeight = 20.sp, + lineHeightStyle = LineHeightStyles.CentreAlignNoTrim, fontFamily = provideFontResource("roboto_medium"), fontWeight = FontWeight.Medium, color = TextColor.OnSurface, @@ -92,6 +100,7 @@ fun DHIS2Theme(content: @Composable () -> Unit) { labelMedium = TextStyle( fontSize = 12.sp, lineHeight = 16.sp, + lineHeightStyle = LineHeightStyles.CentreAlignNoTrim, fontFamily = provideFontResource("roboto_medium"), fontWeight = FontWeight.Medium, color = TextColor.OnSurface, @@ -100,6 +109,7 @@ fun DHIS2Theme(content: @Composable () -> Unit) { labelSmall = TextStyle( fontSize = 11.sp, lineHeight = 16.sp, + lineHeightStyle = LineHeightStyles.CentreAlignNoTrim, fontFamily = provideFontResource("roboto_medium"), fontWeight = FontWeight.Medium, color = TextColor.OnSurface, @@ -108,6 +118,7 @@ fun DHIS2Theme(content: @Composable () -> Unit) { bodyLarge = TextStyle( fontSize = 16.sp, lineHeight = 24.sp, + lineHeightStyle = LineHeightStyles.CentreAlignNoTrim, fontFamily = provideFontResource("roboto_regular"), fontWeight = FontWeight.Normal, color = TextColor.OnSurface, @@ -116,6 +127,7 @@ fun DHIS2Theme(content: @Composable () -> Unit) { bodyMedium = TextStyle( fontSize = 14.sp, lineHeight = 20.sp, + lineHeightStyle = LineHeightStyles.CentreAlignNoTrim, fontFamily = provideFontResource("roboto_regular"), fontWeight = FontWeight.Normal, color = TextColor.OnSurface, @@ -124,6 +136,7 @@ fun DHIS2Theme(content: @Composable () -> Unit) { bodySmall = TextStyle( fontSize = 12.sp, lineHeight = 16.sp, + lineHeightStyle = LineHeightStyles.CentreAlignNoTrim, fontFamily = provideFontResource("roboto_regular"), fontWeight = FontWeight.Normal, color = TextColor.OnSurface, @@ -156,36 +169,47 @@ fun getTextStyle(style: DHIS2TextStyle): TextStyle { DHIS2TextStyle.HEADLINE_LARGE -> { MaterialTheme.typography.headlineLarge } + DHIS2TextStyle.HEADLINE_MEDIUM -> { MaterialTheme.typography.headlineMedium } + DHIS2TextStyle.HEADLINE_SMALL -> { MaterialTheme.typography.headlineSmall } + DHIS2TextStyle.TITLE_LARGE -> { MaterialTheme.typography.titleLarge } + DHIS2TextStyle.TITLE_MEDIUM -> { MaterialTheme.typography.titleMedium } + DHIS2TextStyle.TITLE_SMALL -> { MaterialTheme.typography.titleSmall } + DHIS2TextStyle.LABEL_LARGE -> { MaterialTheme.typography.labelLarge } + DHIS2TextStyle.LABEL_MEDIUM -> { MaterialTheme.typography.labelMedium } + DHIS2TextStyle.LABEL_SMALL -> { MaterialTheme.typography.labelSmall } + DHIS2TextStyle.BODY_LARGE -> { MaterialTheme.typography.bodyLarge } + DHIS2TextStyle.BODY_MEDIUM -> { MaterialTheme.typography.bodyMedium } + DHIS2TextStyle.BODY_SMALL -> { MaterialTheme.typography.bodySmall } @@ -197,6 +221,7 @@ internal object DHIS2SCustomTextStyles { val titleMediumBold = TextStyle( fontSize = 16.sp, lineHeight = 24.sp, + lineHeightStyle = LineHeightStyles.CentreAlignNoTrim, fontWeight = FontWeight.Bold, color = TextColor.OnSurface, letterSpacing = 0.15.sp, @@ -205,6 +230,7 @@ internal object DHIS2SCustomTextStyles { val bodyLargeBold = TextStyle( fontSize = 16.sp, lineHeight = 24.sp, + lineHeightStyle = LineHeightStyles.CentreAlignNoTrim, fontWeight = FontWeight.Bold, color = TextColor.OnSurface, letterSpacing = 0.5.sp, @@ -234,3 +260,10 @@ internal object DHIS2SCustomTextStyles { fontWeight = FontWeight.Normal, ) } + +internal object LineHeightStyles { + val CentreAlignNoTrim = LineHeightStyle( + LineHeightStyle.Alignment.Center, + LineHeightStyle.Trim.None, + ) +} diff --git a/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_AssistChipSnapshotTest_launchAssistChip.png b/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_AssistChipSnapshotTest_launchAssistChip.png index 785b15f7f..f912924f3 100644 Binary files a/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_AssistChipSnapshotTest_launchAssistChip.png and b/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_AssistChipSnapshotTest_launchAssistChip.png differ diff --git a/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_ButtonSnapshotTest_launchButtonSnapshot.png b/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_ButtonSnapshotTest_launchButtonSnapshot.png index fd6f0b3eb..8559230f2 100644 Binary files a/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_ButtonSnapshotTest_launchButtonSnapshot.png and b/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_ButtonSnapshotTest_launchButtonSnapshot.png differ diff --git a/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_FABSnapshotTest_launchFAB.png b/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_FABSnapshotTest_launchFAB.png index 772fd1b5c..5c23cefa8 100644 Binary files a/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_FABSnapshotTest_launchFAB.png and b/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_FABSnapshotTest_launchFAB.png differ diff --git a/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_InputAgeSnapshotTest_launchInputAgeSnapshot.png b/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_InputAgeSnapshotTest_launchInputAgeSnapshot.png index e82bf9be7..e0fe910d5 100644 Binary files a/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_InputAgeSnapshotTest_launchInputAgeSnapshot.png and b/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_InputAgeSnapshotTest_launchInputAgeSnapshot.png differ diff --git a/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_InputCheckboxSnapshotTest_launchInputCheckBox.png b/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_InputCheckboxSnapshotTest_launchInputCheckBox.png index ccdd75b52..c72eff245 100644 Binary files a/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_InputCheckboxSnapshotTest_launchInputCheckBox.png and b/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_InputCheckboxSnapshotTest_launchInputCheckBox.png differ diff --git a/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_InputChipSnapshotTest_launchChip.png b/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_InputChipSnapshotTest_launchChip.png index 948ba01f8..83bb71bcd 100644 Binary files a/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_InputChipSnapshotTest_launchChip.png and b/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_InputChipSnapshotTest_launchChip.png differ diff --git a/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_InputDropDownSnapshotTest_launchInputDropDown.png b/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_InputDropDownSnapshotTest_launchInputDropDown.png index 8c34e537b..70b537b1a 100644 Binary files a/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_InputDropDownSnapshotTest_launchInputDropDown.png and b/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_InputDropDownSnapshotTest_launchInputDropDown.png differ diff --git a/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_InputIndicatorSnapshotTest_launchIndicatorInput.png b/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_InputIndicatorSnapshotTest_launchIndicatorInput.png index b2f27d87a..0100f1a9a 100644 Binary files a/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_InputIndicatorSnapshotTest_launchIndicatorInput.png and b/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_InputIndicatorSnapshotTest_launchIndicatorInput.png differ diff --git a/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_InputMatrixSnapshotTest_launchMatrix.png b/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_InputMatrixSnapshotTest_launchMatrix.png index 5a1853b2c..e668c34b5 100644 Binary files a/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_InputMatrixSnapshotTest_launchMatrix.png and b/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_InputMatrixSnapshotTest_launchMatrix.png differ diff --git a/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_InputRadioButtonSnapshotTest_launchInputRadioButton.png b/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_InputRadioButtonSnapshotTest_launchInputRadioButton.png index 07e6f0f36..86c8f1371 100644 Binary files a/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_InputRadioButtonSnapshotTest_launchInputRadioButton.png and b/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_InputRadioButtonSnapshotTest_launchInputRadioButton.png differ diff --git a/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_InputSequentialSnapshotTest_launchMatrix.png b/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_InputSequentialSnapshotTest_launchMatrix.png index 53136f019..da0b7cca7 100644 Binary files a/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_InputSequentialSnapshotTest_launchMatrix.png and b/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_InputSequentialSnapshotTest_launchMatrix.png differ diff --git a/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_LoginSnapshotTest_launchLoginScreen.png b/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_LoginSnapshotTest_launchLoginScreen.png index f6bc70729..e9817ac68 100644 Binary files a/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_LoginSnapshotTest_launchLoginScreen.png and b/designsystem/src/test/snapshots/images/org.hisp.dhis.mobile.ui.designsystem_LoginSnapshotTest_launchLoginScreen.png differ diff --git a/desktop/build.gradle.kts b/desktop/build.gradle.kts index 128a3fd75..aed439c58 100644 --- a/desktop/build.gradle.kts +++ b/desktop/build.gradle.kts @@ -3,6 +3,7 @@ import org.jetbrains.compose.desktop.application.dsl.TargetFormat plugins { kotlin("multiplatform") id("org.jetbrains.compose") + alias(libs.plugins.compose.compiler) } kotlin { diff --git a/gradle.properties b/gradle.properties index 211a6361a..e3cda97b3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -21,6 +21,6 @@ android.targetSdk=34 android.minSdk=21 #Versions -kotlin.version=1.9.22 -agp.version=8.2.2 -compose.version=1.5.12 \ No newline at end of file +kotlin.version=2.0.0 +agp.version=8.4.0 +compose.version=1.6.10 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 84a0b92f9..08085e25b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ +#Wed May 22 17:58:24 IST 2024 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/settings.gradle.kts b/settings.gradle.kts index 75fb0ccfc..563243cde 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -35,4 +35,12 @@ dependencyResolutionManagement { mavenCentral() maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") } + + versionCatalogs { + val kotlinVersion = extra["kotlin.version"] as String + create("libs") { + version("kotlin", kotlinVersion) + plugin("compose-compiler", "org.jetbrains.kotlin.plugin.compose").versionRef("kotlin") + } + } }