diff --git a/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosAlertDialog.kt b/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosAlertDialog.kt index 81c942417..f29294345 100644 --- a/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosAlertDialog.kt +++ b/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosAlertDialog.kt @@ -5,7 +5,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. * - * See See https://github.com/openMF/kmp-project-template/blob/main/LICENSE + * See https://github.com/openMF/mobile-mobile/blob/master/LICENSE.md */ package org.mifos.mobile.core.designsystem.component diff --git a/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosBasicDialog.kt b/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosBasicDialog.kt index 3c01a7e83..ed55e3a5c 100644 --- a/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosBasicDialog.kt +++ b/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosBasicDialog.kt @@ -5,7 +5,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. * - * See See https://github.com/openMF/kmp-project-template/blob/main/LICENSE + * See https://github.com/openMF/mobile-mobile/blob/master/LICENSE.md */ package org.mifos.mobile.core.designsystem.component diff --git a/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosBottomSheet.kt b/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosBottomSheet.kt index 7b6320893..c077caf9f 100644 --- a/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosBottomSheet.kt +++ b/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosBottomSheet.kt @@ -5,7 +5,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. * - * See See https://github.com/openMF/kmp-project-template/blob/main/LICENSE + * See https://github.com/openMF/mobile-mobile/blob/master/LICENSE.md */ package org.mifos.mobile.core.designsystem.component diff --git a/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosButton.kt b/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosButton.kt index 4e1730837..33eacf63d 100644 --- a/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosButton.kt +++ b/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosButton.kt @@ -5,7 +5,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. * - * See See https://github.com/openMF/kmp-project-template/blob/main/LICENSE + * See https://github.com/openMF/mobile-mobile/blob/master/LICENSE.md */ package org.mifos.mobile.core.designsystem.component diff --git a/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosCard.kt b/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosCard.kt index 10fac492c..b329ce70a 100644 --- a/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosCard.kt +++ b/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosCard.kt @@ -5,7 +5,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. * - * See See https://github.com/openMF/kmp-project-template/blob/main/LICENSE + * See https://github.com/openMF/mobile-mobile/blob/master/LICENSE.md */ package org.mifos.mobile.core.designsystem.component diff --git a/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosLoadingDialog.kt b/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosLoadingDialog.kt index 4b33fbfe5..71614a3b8 100644 --- a/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosLoadingDialog.kt +++ b/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosLoadingDialog.kt @@ -5,7 +5,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. * - * See See https://github.com/openMF/kmp-project-template/blob/main/LICENSE + * See https://github.com/openMF/mobile-mobile/blob/master/LICENSE.md */ package org.mifos.mobile.core.designsystem.component diff --git a/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosNavigation.kt b/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosNavigation.kt index d118fe491..5e1600be0 100644 --- a/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosNavigation.kt +++ b/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosNavigation.kt @@ -5,7 +5,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. * - * See See https://github.com/openMF/kmp-project-template/blob/main/LICENSE + * See https://github.com/openMF/mobile-mobile/blob/master/LICENSE.md */ package org.mifos.mobile.core.designsystem.component diff --git a/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosOtpTextField.kt b/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosOtpTextField.kt index a91916c55..da22af6c6 100644 --- a/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosOtpTextField.kt +++ b/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosOtpTextField.kt @@ -5,7 +5,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. * - * See See https://github.com/openMF/kmp-project-template/blob/main/LICENSE + * See https://github.com/openMF/mobile-mobile/blob/master/LICENSE.md */ package org.mifos.mobile.core.designsystem.component diff --git a/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosPasswordField.kt b/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosPasswordField.kt index e8b1f23a3..666b7ca1f 100644 --- a/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosPasswordField.kt +++ b/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosPasswordField.kt @@ -5,7 +5,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. * - * See See https://github.com/openMF/kmp-project-template/blob/main/LICENSE + * See https://github.com/openMF/mobile-mobile/blob/master/LICENSE.md */ package org.mifos.mobile.core.designsystem.component @@ -30,9 +30,9 @@ import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.input.PasswordVisualTransformation import androidx.compose.ui.text.input.VisualTransformation import org.jetbrains.compose.ui.tooling.preview.Preview -import org.mifos.core.designsystem.icon.AppIcons -import org.mifos.core.designsystem.utils.nonLetterColorVisualTransformation -import org.mifos.core.designsystem.utils.tabNavigation +import org.mifos.mobile.core.designsystem.icon.MifosIcons +import org.mifos.mobile.core.designsystem.utils.nonLetterColorVisualTransformation +import org.mifos.mobile.core.designsystem.utils.tabNavigation @Composable fun MifosPasswordField( @@ -77,9 +77,9 @@ fun MifosPasswordField( onClick = { showPasswordChange.invoke(!showPassword) }, ) { val imageVector = if (showPassword) { - AppIcons.OutlinedVisibilityOff + MifosIcons.OutlinedVisibilityOff } else { - AppIcons.OutlinedVisibility + MifosIcons.OutlinedVisibility } Icon( diff --git a/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosRadioButton.kt b/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosRadioButton.kt index b1333acac..861b01d7d 100644 --- a/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosRadioButton.kt +++ b/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosRadioButton.kt @@ -16,8 +16,8 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource -import androidx.compose.ui.tooling.preview.Preview -import org.mifos.mobile.designsystem.theme.MifosMobileTheme +import org.jetbrains.compose.ui.tooling.preview.Preview +import org.mifos.mobile.core.designsystem.theme.MifosMobileTheme @Composable fun MifosRadioButton( diff --git a/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosScaffold.kt b/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosScaffold.kt index c4fd051f0..f3910b295 100644 --- a/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosScaffold.kt +++ b/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosScaffold.kt @@ -5,7 +5,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. * - * See See https://github.com/openMF/kmp-project-template/blob/main/LICENSE + * See https://github.com/openMF/mobile-mobile/blob/master/LICENSE.md */ package org.mifos.mobile.core.designsystem.component diff --git a/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosTab.kt b/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosTab.kt index 5a33729c3..7d35bc2e3 100644 --- a/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosTab.kt +++ b/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosTab.kt @@ -5,7 +5,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. * - * See See https://github.com/openMF/kmp-project-template/blob/main/LICENSE + * See https://github.com/openMF/mobile-mobile/blob/master/LICENSE.md */ package org.mifos.mobile.core.designsystem.component diff --git a/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosTabPager.kt b/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosTabPager.kt index cb0f74598..ca35fcbfc 100644 --- a/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosTabPager.kt +++ b/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosTabPager.kt @@ -23,8 +23,8 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp -import com.google.accompanist.pager.HorizontalPager -import com.google.accompanist.pager.PagerState +import androidx.compose.foundation.pager.HorizontalPager +import androidx.compose.foundation.pager.PagerState @Suppress("DEPRECATION") @Composable diff --git a/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosTextField.kt b/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosTextField.kt index b9c5fd54f..49c190f29 100644 --- a/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosTextField.kt +++ b/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosTextField.kt @@ -5,7 +5,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. * - * See See https://github.com/openMF/kmp-project-template/blob/main/LICENSE + * See https://github.com/openMF/mobile-mobile/blob/master/LICENSE.md */ package org.mifos.mobile.core.designsystem.component diff --git a/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosTopAppBar.kt b/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosTopAppBar.kt index 0f7f1aa68..6d8fd4abf 100644 --- a/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosTopAppBar.kt +++ b/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosTopAppBar.kt @@ -5,7 +5,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. * - * See See https://github.com/openMF/kmp-project-template/blob/main/LICENSE + * See https://github.com/openMF/mobile-mobile/blob/master/LICENSE.md */ package org.mifos.mobile.core.designsystem.component diff --git a/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosTopBar.kt b/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosTopBar.kt index 60eff6691..d2763a12f 100644 --- a/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosTopBar.kt +++ b/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosTopBar.kt @@ -5,7 +5,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. * - * See See https://github.com/openMF/kmp-project-template/blob/main/LICENSE + * See https://github.com/openMF/mobile-mobile/blob/master/LICENSE.md */ package org.mifos.mobile.core.designsystem.component diff --git a/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/icon/MifosIcons.kt b/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/icon/MifosIcons.kt index 2e4ade9f7..e9b1bdcbb 100644 --- a/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/icon/MifosIcons.kt +++ b/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/icon/MifosIcons.kt @@ -23,6 +23,7 @@ import androidx.compose.material.icons.filled.Add import androidx.compose.material.icons.filled.ArrowDropDown import androidx.compose.material.icons.filled.ArrowDropUp import androidx.compose.material.icons.filled.ChevronLeft +import androidx.compose.material.icons.filled.Close import androidx.compose.material.icons.filled.Edit import androidx.compose.material.icons.filled.Error import androidx.compose.material.icons.filled.FilterList @@ -43,16 +44,16 @@ import androidx.compose.material.icons.filled.Share import androidx.compose.material.icons.filled.Visibility import androidx.compose.material.icons.filled.VisibilityOff import androidx.compose.material.icons.filled.WifiOff -import androidx.compose.material.icons.outlined.Mail -import androidx.compose.ui.graphics.vector.ImageVector -import androidx.compose.material.icons.filled.Close import androidx.compose.material.icons.outlined.AccountCircle import androidx.compose.material.icons.outlined.Home +import androidx.compose.material.icons.outlined.Mail +import androidx.compose.material.icons.outlined.Visibility +import androidx.compose.material.icons.outlined.VisibilityOff import androidx.compose.material.icons.outlined.Wallet import androidx.compose.material.icons.rounded.AccountCircle import androidx.compose.material.icons.rounded.Home import androidx.compose.material.icons.rounded.SwapHoriz -import androidx.compose.material.icons.rounded.Wallet +import androidx.compose.ui.graphics.vector.ImageVector object MifosIcons { val Paid: ImageVector = Icons.Default.Paid @@ -77,6 +78,8 @@ object MifosIcons { val ArrowDropUp: ImageVector = Icons.Default.ArrowDropUp val ArrowDropDown: ImageVector = Icons.Default.ArrowDropDown val Close: ImageVector = Icons.Filled.Close + val OutlinedVisibilityOff: ImageVector = Icons.Outlined.VisibilityOff + val OutlinedVisibility: ImageVector = Icons.Outlined.Visibility val ArrowBack = Icons.AutoMirrored.Default.ArrowBack val Edit = Icons.Default.Edit val FilterList = Icons.Filled.FilterList diff --git a/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/theme/MifosBackground.kt b/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/theme/MifosBackground.kt index 8559cee6c..2b3388b7f 100644 --- a/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/theme/MifosBackground.kt +++ b/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/theme/MifosBackground.kt @@ -18,9 +18,9 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color -import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp +import org.jetbrains.compose.ui.tooling.preview.Preview /** * The main background for the app. diff --git a/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/utils/ModifierExt.kt b/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/utils/ModifierExt.kt index 247da05bf..50cf9835b 100644 --- a/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/utils/ModifierExt.kt +++ b/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/utils/ModifierExt.kt @@ -5,7 +5,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. * - * See See https://github.com/openMF/kmp-project-template/blob/main/LICENSE + * See https://github.com/openMF/mobile-mobile/blob/master/LICENSE.md */ package org.mifos.mobile.core.designsystem.utils diff --git a/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/utils/NonLetterColorVisualTransformation.kt b/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/utils/NonLetterColorVisualTransformation.kt new file mode 100644 index 000000000..8f3e0859d --- /dev/null +++ b/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/utils/NonLetterColorVisualTransformation.kt @@ -0,0 +1,61 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See See https://github.com/openMF/kmp-project-template/blob/main/LICENSE + */ +package org.mifos.mobile.core.designsystem.utils + +import androidx.compose.material3.MaterialTheme +import androidx.compose.runtime.Composable +import androidx.compose.runtime.remember +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.text.AnnotatedString +import androidx.compose.ui.text.SpanStyle +import androidx.compose.ui.text.input.OffsetMapping +import androidx.compose.ui.text.input.TransformedText +import androidx.compose.ui.text.input.VisualTransformation +import androidx.compose.ui.text.withStyle + +@Composable +fun nonLetterColorVisualTransformation(): VisualTransformation { + val digitColor = MaterialTheme.colorScheme.primary + val specialCharacterColor = MaterialTheme.colorScheme.error + return remember(digitColor, specialCharacterColor) { + NonLetterColorVisualTransformation( + digitColor = digitColor, + specialCharacterColor = specialCharacterColor, + ) + } +} + +private class NonLetterColorVisualTransformation( + private val digitColor: Color, + private val specialCharacterColor: Color, +) : VisualTransformation { + + override fun filter(text: AnnotatedString): TransformedText = + TransformedText( + buildTransformedAnnotatedString(text.toString()), + OffsetMapping.Identity, + ) + + private fun buildTransformedAnnotatedString(text: String): AnnotatedString { + val builder = AnnotatedString.Builder() + text.toCharArray().forEach { char -> + when { + char.isDigit() -> builder.withStyle(SpanStyle(color = digitColor)) { append(char) } + + !char.isLetter() -> { + builder.withStyle(SpanStyle(color = specialCharacterColor)) { append(char) } + } + + else -> builder.append(char) + } + } + return builder.toAnnotatedString() + } +}