Updated on 2026-08-14
This commit is contained in:
parent
069605e151
commit
36516c900f
234 changed files with 902 additions and 1618 deletions
|
|
@ -42,12 +42,7 @@ import com.tangem.core.ui.res.TangemTheme
|
|||
* [Show in Figma](https://www.figma.com/file/14ISV23YB1yVW1uNVwqrKv/Android?node-id=97%3A103&t=TmfD6UBHPg9uYfev-4)
|
||||
* */
|
||||
@Composable
|
||||
fun TextButton(
|
||||
text: String,
|
||||
onClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
enabled: Boolean = true,
|
||||
) {
|
||||
fun TextButton(text: String, onClick: () -> Unit, modifier: Modifier = Modifier, enabled: Boolean = true) {
|
||||
TangemButton(
|
||||
modifier = modifier,
|
||||
text = text,
|
||||
|
|
@ -84,12 +79,7 @@ fun TextButtonIconLeft(
|
|||
}
|
||||
|
||||
@Composable
|
||||
fun WarningTextButton(
|
||||
text: String,
|
||||
onClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
enabled: Boolean = true,
|
||||
) {
|
||||
fun WarningTextButton(text: String, onClick: () -> Unit, modifier: Modifier = Modifier, enabled: Boolean = true) {
|
||||
TangemButton(
|
||||
modifier = modifier,
|
||||
text = text,
|
||||
|
|
@ -239,12 +229,7 @@ fun SecondaryButtonIconLeft(
|
|||
|
||||
// region Other
|
||||
@Composable
|
||||
fun SelectorButton(
|
||||
text: String,
|
||||
onClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
enabled: Boolean = true,
|
||||
) {
|
||||
fun SelectorButton(text: String, onClick: () -> Unit, modifier: Modifier = Modifier, enabled: Boolean = true) {
|
||||
TangemButton(
|
||||
modifier = modifier,
|
||||
text = text,
|
||||
|
|
@ -461,9 +446,7 @@ private open class TangemButtonColors(
|
|||
|
||||
// region Preview
|
||||
@Composable
|
||||
private fun PrimaryButtonSample(
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
private fun PrimaryButtonSample(modifier: Modifier = Modifier) {
|
||||
Column(
|
||||
modifier = modifier
|
||||
.background(TangemTheme.colors.background.primary),
|
||||
|
|
@ -537,9 +520,7 @@ private fun PrimaryButtonPreview_Dark() {
|
|||
}
|
||||
|
||||
@Composable
|
||||
private fun SecondaryButtonSample(
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
private fun SecondaryButtonSample(modifier: Modifier = Modifier) {
|
||||
Column(
|
||||
modifier = modifier
|
||||
.background(TangemTheme.colors.background.primary),
|
||||
|
|
@ -613,9 +594,7 @@ private fun SecondaryButtonPreview_Dark() {
|
|||
}
|
||||
|
||||
@Composable
|
||||
private fun TextButtonSample(
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
private fun TextButtonSample(modifier: Modifier = Modifier) {
|
||||
Column(
|
||||
modifier = modifier
|
||||
.background(TangemTheme.colors.background.primary),
|
||||
|
|
|
|||
|
|
@ -43,11 +43,7 @@ import com.valentinilk.shimmer.shimmer
|
|||
* >Figma component</a>
|
||||
*/
|
||||
@Composable
|
||||
fun SmallInfoCard(
|
||||
startText: String,
|
||||
endText: String,
|
||||
isLoading: Boolean = false,
|
||||
) {
|
||||
fun SmallInfoCard(startText: String, endText: String, isLoading: Boolean = false) {
|
||||
Surface(
|
||||
shape = RoundedCornerShape(TangemTheme.dimens.radius12),
|
||||
color = TangemTheme.colors.background.primary,
|
||||
|
|
@ -74,12 +70,7 @@ fun SmallInfoCard(
|
|||
* >Figma component</a>
|
||||
*/
|
||||
@Composable
|
||||
fun SmallInfoCardWithDisclaimer(
|
||||
startText: String,
|
||||
endText: String,
|
||||
disclaimer: String,
|
||||
isLoading: Boolean = false,
|
||||
) {
|
||||
fun SmallInfoCardWithDisclaimer(startText: String, endText: String, disclaimer: String, isLoading: Boolean = false) {
|
||||
Surface(
|
||||
shape = RoundedCornerShape(TangemTheme.dimens.radius12),
|
||||
color = TangemTheme.colors.background.primary,
|
||||
|
|
@ -106,12 +97,7 @@ fun SmallInfoCardWithDisclaimer(
|
|||
* >Figma component</a>
|
||||
*/
|
||||
@Composable
|
||||
fun SmallInfoCardWithWarning(
|
||||
startText: String,
|
||||
endText: String,
|
||||
warningText: String,
|
||||
disclaimer: String? = null,
|
||||
) {
|
||||
fun SmallInfoCardWithWarning(startText: String, endText: String, warningText: String, disclaimer: String? = null) {
|
||||
Surface(
|
||||
shape = RoundedCornerShape(TangemTheme.dimens.size12),
|
||||
color = TangemTheme.colors.background.primary,
|
||||
|
|
@ -274,12 +260,7 @@ fun IconWithTitleAndDescription(
|
|||
// region elements
|
||||
|
||||
@Composable
|
||||
private fun CardInfoBox(
|
||||
startText: String,
|
||||
endText: String,
|
||||
disclaimer: String?,
|
||||
isLoading: Boolean = false,
|
||||
) {
|
||||
private fun CardInfoBox(startText: String, endText: String, disclaimer: String?, isLoading: Boolean = false) {
|
||||
val isOpened = remember { mutableStateOf(false) }
|
||||
Column {
|
||||
Row(
|
||||
|
|
|
|||
|
|
@ -159,10 +159,7 @@ private fun TangemDialog(
|
|||
}
|
||||
|
||||
@Composable
|
||||
private fun DialogContent(
|
||||
type: DialogType,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
private fun DialogContent(type: DialogType, modifier: Modifier = Modifier) {
|
||||
Column(
|
||||
modifier = modifier,
|
||||
verticalArrangement = Arrangement.Center,
|
||||
|
|
@ -196,11 +193,7 @@ private fun DialogContent(
|
|||
}
|
||||
|
||||
@Composable
|
||||
private fun DialogButtons(
|
||||
confirmButton: DialogButton,
|
||||
dismissButton: DialogButton?,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
private fun DialogButtons(confirmButton: DialogButton, dismissButton: DialogButton?, modifier: Modifier = Modifier) {
|
||||
Row(
|
||||
modifier = modifier.fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.spacedBy(
|
||||
|
|
@ -315,9 +308,7 @@ private fun Preview_BasicDialog_InDarkTheme() {
|
|||
}
|
||||
|
||||
@Composable
|
||||
private fun WarningBasicDialogSample(
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
private fun WarningBasicDialogSample(modifier: Modifier = Modifier) {
|
||||
Column(
|
||||
modifier = modifier,
|
||||
) {
|
||||
|
|
@ -349,9 +340,7 @@ private fun WarningBasicDialogPreview_Dark() {
|
|||
}
|
||||
|
||||
@Composable
|
||||
private fun TextInputDialogSample(
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
private fun TextInputDialogSample(modifier: Modifier = Modifier) {
|
||||
Column(
|
||||
modifier = modifier,
|
||||
) {
|
||||
|
|
|
|||
|
|
@ -153,21 +153,19 @@ private class BoundCounter(
|
|||
private var _nextCharWidth: Float? = null
|
||||
private var invalidCharsCount = 0
|
||||
|
||||
fun widthWithNextChar(): Float =
|
||||
width + nextCharWidth()
|
||||
fun widthWithNextChar(): Float = width + nextCharWidth()
|
||||
|
||||
private fun nextCharWidth(): Float =
|
||||
_nextCharWidth ?: run {
|
||||
var boundingBox: Rect
|
||||
// invalidCharsCount fixes this bug: https://issuetracker.google.com/issues/197146630
|
||||
invalidCharsCount--
|
||||
do {
|
||||
boundingBox = textLayoutResult
|
||||
.getBoundingBox(charPosition(string.count() + ++invalidCharsCount))
|
||||
} while (boundingBox.right == 0f)
|
||||
_nextCharWidth = boundingBox.width
|
||||
boundingBox.width
|
||||
}
|
||||
private fun nextCharWidth(): Float = _nextCharWidth ?: run {
|
||||
var boundingBox: Rect
|
||||
// invalidCharsCount fixes this bug: https://issuetracker.google.com/issues/197146630
|
||||
invalidCharsCount--
|
||||
do {
|
||||
boundingBox = textLayoutResult
|
||||
.getBoundingBox(charPosition(string.count() + ++invalidCharsCount))
|
||||
} while (boundingBox.right == 0f)
|
||||
_nextCharWidth = boundingBox.width
|
||||
boundingBox.width
|
||||
}
|
||||
|
||||
fun addNextChar() {
|
||||
string += text[charPosition(string.count())]
|
||||
|
|
|
|||
|
|
@ -106,10 +106,7 @@ fun ResultScreenContent(
|
|||
}
|
||||
|
||||
@Composable
|
||||
fun SuccessImage(
|
||||
resultColor: Color,
|
||||
@DrawableRes icon: Int,
|
||||
) {
|
||||
fun SuccessImage(resultColor: Color, @DrawableRes icon: Int) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.background(
|
||||
|
|
|
|||
|
|
@ -6,9 +6,7 @@ import com.google.accompanist.systemuicontroller.SystemUiController
|
|||
import com.google.accompanist.systemuicontroller.rememberSystemUiController
|
||||
|
||||
@Composable
|
||||
fun SystemBarsEffect(
|
||||
block: SystemUiController.() -> Unit,
|
||||
) {
|
||||
fun SystemBarsEffect(block: SystemUiController.() -> Unit) {
|
||||
val systemUiController = rememberSystemUiController()
|
||||
SideEffect { block(systemUiController) }
|
||||
}
|
||||
|
|
@ -180,7 +180,7 @@ private fun TangemTextField(
|
|||
}
|
||||
|
||||
private enum class TangemTextFieldSize {
|
||||
Default
|
||||
Default,
|
||||
}
|
||||
|
||||
@Composable
|
||||
|
|
@ -305,11 +305,7 @@ internal data class TangemTextFieldColors(
|
|||
}
|
||||
|
||||
@Composable
|
||||
override fun labelColor(
|
||||
enabled: Boolean,
|
||||
error: Boolean,
|
||||
interactionSource: InteractionSource,
|
||||
): State<Color> {
|
||||
override fun labelColor(enabled: Boolean, error: Boolean, interactionSource: InteractionSource): State<Color> {
|
||||
val focused by interactionSource.collectIsFocusedAsState()
|
||||
|
||||
val targetValue = when {
|
||||
|
|
@ -347,9 +343,7 @@ internal data class TangemTextFieldColors(
|
|||
|
||||
// region Preview
|
||||
@Composable
|
||||
private fun OutlineTextFieldSample(
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
private fun OutlineTextFieldSample(modifier: Modifier = Modifier) {
|
||||
Column(
|
||||
modifier = modifier
|
||||
.background(TangemTheme.colors.background.primary)
|
||||
|
|
|
|||
|
|
@ -24,11 +24,7 @@ import com.tangem.core.ui.res.TangemTheme
|
|||
* >Figma component</a>
|
||||
*/
|
||||
@Composable
|
||||
fun WarningCard(
|
||||
title: String,
|
||||
description: String,
|
||||
icon: @Composable (() -> Unit)? = null,
|
||||
) {
|
||||
fun WarningCard(title: String, description: String, icon: @Composable (() -> Unit)? = null) {
|
||||
WarningCardSurface(
|
||||
content = {
|
||||
WarningBody(
|
||||
|
|
@ -128,10 +124,7 @@ private fun WarningBody(
|
|||
|
||||
@OptIn(ExperimentalMaterialApi::class)
|
||||
@Composable
|
||||
private fun WarningCardSurface(
|
||||
onClick: (() -> Unit)? = null,
|
||||
content: @Composable () -> Unit,
|
||||
) {
|
||||
private fun WarningCardSurface(onClick: (() -> Unit)? = null, content: @Composable () -> Unit) {
|
||||
Card(
|
||||
shape = RoundedCornerShape(TangemTheme.dimens.size12),
|
||||
backgroundColor = TangemTheme.colors.background.primary,
|
||||
|
|
|
|||
|
|
@ -18,9 +18,7 @@ import com.tangem.core.ui.res.TangemTheme
|
|||
* [Show in Figma](https://www.figma.com/file/17JyRbuUEZ42DluaFEuGQk/Atoms?node-id=135%3A25&t=Jo68S6ilyewVU8MV-4)
|
||||
* */
|
||||
@Composable
|
||||
fun Hand(
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
fun Hand(modifier: Modifier = Modifier) {
|
||||
Box(
|
||||
modifier = modifier
|
||||
.padding(vertical = TangemTheme.dimens.spacing8)
|
||||
|
|
@ -41,9 +39,7 @@ fun Hand(
|
|||
|
||||
// region Preview
|
||||
@Composable
|
||||
private fun HandSample(
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
private fun HandSample(modifier: Modifier = Modifier) {
|
||||
Column(
|
||||
modifier = modifier
|
||||
.background(TangemTheme.colors.background.primary)
|
||||
|
|
|
|||
|
|
@ -26,11 +26,7 @@ abstract class ComposeBottomSheetFragment<ScreenState> : BottomSheetDialogFragme
|
|||
|
||||
override fun getTheme(): Int = R.style.AppTheme_TransparentBottomSheetDialog
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?,
|
||||
): View {
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
||||
return createComposeView(inflater.context)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,11 +7,7 @@ import android.view.ViewGroup
|
|||
import androidx.fragment.app.Fragment
|
||||
|
||||
abstract class ComposeFragment<ScreenState> : Fragment(), ComposeScreen<ScreenState> {
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?,
|
||||
): View {
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
||||
return createComposeView(inflater.context)
|
||||
}
|
||||
}
|
||||
|
|
@ -40,8 +40,5 @@ internal interface ComposeScreen<ScreenState> {
|
|||
|
||||
@Suppress("TopLevelComposableFunctions")
|
||||
@Composable
|
||||
fun ScreenContent(
|
||||
state: ScreenState,
|
||||
modifier: Modifier,
|
||||
)
|
||||
fun ScreenContent(state: ScreenState, modifier: Modifier)
|
||||
}
|
||||
|
|
@ -17,7 +17,7 @@ enum class ButtonColorType(val lightColor: Color, val darkColor: Color) {
|
|||
SECONDARY(lightColor = Light2, darkColor = Dark5),
|
||||
DISABLED(lightColor = Light2, darkColor = Dark6),
|
||||
POSITIVE(lightColor = Meadow, darkColor = Meadow),
|
||||
POSITIVE_DISABLED(lightColor = MagicMint, darkColor = DarkGreen)
|
||||
POSITIVE_DISABLED(lightColor = MagicMint, darkColor = DarkGreen),
|
||||
}
|
||||
|
||||
@Composable
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ enum class IconColorType(val lightColor: Color, val darkColor: Color) {
|
|||
INACTIVE(lightColor = Light4, darkColor = Dark4),
|
||||
ACCENT(lightColor = Meadow, darkColor = Meadow),
|
||||
WARNING(lightColor = Amaranth, darkColor = Amaranth),
|
||||
ATTENTION(lightColor = Tangerine, darkColor = Tangerine)
|
||||
ATTENTION(lightColor = Tangerine, darkColor = Tangerine),
|
||||
}
|
||||
|
||||
@Composable
|
||||
|
|
|
|||
|
|
@ -69,10 +69,7 @@ object TangemTheme {
|
|||
|
||||
@Stable
|
||||
@Composable
|
||||
private fun materialThemeColors(
|
||||
colors: TangemColors,
|
||||
isDark: Boolean,
|
||||
): Colors {
|
||||
private fun materialThemeColors(colors: TangemColors, isDark: Boolean): Colors {
|
||||
return Colors(
|
||||
primary = colors.background.primary,
|
||||
primaryVariant = colors.background.secondary,
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ enum class TextColorType(val lightColor: Color, val darkColor: Color) {
|
|||
ACCENT(lightColor = Meadow, darkColor = Meadow),
|
||||
WARNING(lightColor = Amaranth, darkColor = Amaranth),
|
||||
ATTENTION(lightColor = Tangerine, darkColor = Tangerine),
|
||||
CONSTANT_WHITE(lightColor = White, darkColor = White)
|
||||
CONSTANT_WHITE(lightColor = White, darkColor = White),
|
||||
}
|
||||
|
||||
@Composable
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue