diff --git a/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/actions/button/PrezelButton.kt b/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/actions/button/PrezelButton.kt index 6370c2cb..eda9fb9c 100644 --- a/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/actions/button/PrezelButton.kt +++ b/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/actions/button/PrezelButton.kt @@ -3,7 +3,6 @@ package com.team.prezel.core.designsystem.component.actions.button import androidx.annotation.DrawableRes import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier -import androidx.compose.ui.tooling.preview.Preview import com.team.prezel.core.designsystem.component.actions.button.config.ButtonHierarchy import com.team.prezel.core.designsystem.component.actions.button.config.ButtonSize import com.team.prezel.core.designsystem.component.actions.button.config.ButtonType @@ -13,6 +12,7 @@ import com.team.prezel.core.designsystem.component.actions.button.config.PrezelB import com.team.prezel.core.designsystem.component.actions.button.config.PrezelButtonPreviewContent import com.team.prezel.core.designsystem.component.actions.button.config.previewGhostBorder import com.team.prezel.core.designsystem.icon.PrezelIcons +import com.team.prezel.core.designsystem.preview.LargeDevicePreview /** * 아이콘과 텍스트를 함께 표시할 수 있는 기본 버튼입니다. @@ -46,7 +46,7 @@ fun PrezelButton( ) } -@Preview(device = "spec:width=1080dp,height=1400dp") +@LargeDevicePreview @Composable private fun PrezelButtonPreview() { PrezelButtonPreviewContent(title = "Button/Icon + Text") { type, hierarchy, size, enabled, isRounded -> diff --git a/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/chip/PrezelChip.kt b/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/chip/PrezelChip.kt deleted file mode 100644 index 3d1db98f..00000000 --- a/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/chip/PrezelChip.kt +++ /dev/null @@ -1,169 +0,0 @@ -package com.team.prezel.core.designsystem.component.chip - -import androidx.annotation.DrawableRes -import androidx.compose.material3.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier -import androidx.compose.ui.tooling.preview.PreviewParameter -import androidx.compose.ui.tooling.preview.PreviewParameterProvider -import com.team.prezel.core.designsystem.component.chip.config.PrezelChipDefault -import com.team.prezel.core.designsystem.component.chip.config.PrezelChipDefaults -import com.team.prezel.core.designsystem.component.chip.config.PrezelChipFeedback -import com.team.prezel.core.designsystem.component.chip.config.PrezelChipInteraction -import com.team.prezel.core.designsystem.component.chip.config.PrezelChipLayout -import com.team.prezel.core.designsystem.component.chip.config.PrezelChipSize -import com.team.prezel.core.designsystem.component.chip.config.PrezelChipType -import com.team.prezel.core.designsystem.icon.PrezelIcons -import com.team.prezel.core.designsystem.preview.BasicPreview -import com.team.prezel.core.designsystem.preview.PreviewRow -import com.team.prezel.core.designsystem.preview.PreviewSection -import com.team.prezel.core.designsystem.preview.PreviewValueRow -import com.team.prezel.core.designsystem.theme.PrezelTheme - -@Composable -fun PrezelChip( - text: String, - modifier: Modifier = Modifier, - @DrawableRes iconResId: Int? = null, - type: PrezelChipType = PrezelChipType.FILLED, - size: PrezelChipSize = PrezelChipSize.REGULAR, - interaction: PrezelChipInteraction = PrezelChipInteraction.DEFAULT, - feedback: PrezelChipFeedback = PrezelChipFeedback.DEFAULT, - config: PrezelChipDefault = PrezelChipDefaults.getDefault( - iconOnly = false, - type = type, - size = size, - interaction = interaction, - feedback = feedback, - ), -) { - PrezelChipLayout( - modifier = modifier, - text = text, - iconResId = iconResId, - config = config, - ) -} - -private class PrezelChipTypeProvider : PreviewParameterProvider { - override val values: Sequence = PrezelChipType.entries.asSequence() -} - -@BasicPreview -@Composable -private fun PrezelChipPreview( - @PreviewParameter(PrezelChipTypeProvider::class) type: PrezelChipType, -) { - PreviewSection(title = "Chip - $type") { - Text(text = "Size", style = PrezelTheme.typography.title2Medium, color = PrezelTheme.colors.textLarge) - PreviewValueRow(name = "Regular") { - PrezelChip( - text = "Label", - iconResId = PrezelIcons.Blank, - type = type, - size = PrezelChipSize.REGULAR, - ) - } - PreviewValueRow(name = "Small") { - PrezelChip( - text = "Label", - iconResId = PrezelIcons.Blank, - type = type, - size = PrezelChipSize.SMALL, - ) - } - - Text(text = "Interaction", style = PrezelTheme.typography.title2Medium, color = PrezelTheme.colors.textLarge) - PreviewValueRow(name = "Default") { - PrezelChip( - text = "Label", - iconResId = PrezelIcons.Blank, - type = type, - interaction = PrezelChipInteraction.DEFAULT, - ) - } - PreviewValueRow(name = "Active") { - PrezelChip( - text = "Label", - iconResId = PrezelIcons.Blank, - type = type, - interaction = PrezelChipInteraction.ACTIVE, - ) - } - PreviewValueRow(name = "Disabled") { - PrezelChip( - text = "Label", - iconResId = PrezelIcons.Blank, - type = type, - interaction = PrezelChipInteraction.DISABLED, - ) - } - - Text(text = "Feedback", style = PrezelTheme.typography.title2Medium, color = PrezelTheme.colors.textLarge) - PreviewValueRow(name = "Default") { - PrezelChip( - text = "Label", - iconResId = PrezelIcons.Blank, - type = type, - feedback = PrezelChipFeedback.DEFAULT, - ) - } - PreviewValueRow(name = "Bad") { - PrezelChip( - text = "Label", - iconResId = PrezelIcons.Blank, - type = type, - feedback = PrezelChipFeedback.BAD, - ) - } - } -} - -@BasicPreview -@Composable -private fun PrezelChipCustomPreview( - @PreviewParameter(PrezelChipTypeProvider::class) type: PrezelChipType, -) { - PreviewSection(title = "Custom Chip - $type") { - PreviewRow { - PrezelChip( - text = "Label", - iconResId = PrezelIcons.Blank, - config = PrezelChipDefaults.getDefault( - iconOnly = false, - type = type, - containerColor = PrezelTheme.colors.accentPurpleSmall, - iconColor = PrezelTheme.colors.accentPurpleRegular, - textColor = PrezelTheme.colors.accentPurpleRegular, - borderColor = PrezelTheme.colors.accentPurpleRegular, - ), - ) - - PrezelChip( - text = "Label", - iconResId = PrezelIcons.Blank, - config = PrezelChipDefaults.getDefault( - iconOnly = false, - type = type, - containerColor = PrezelTheme.colors.accentTealSmall, - iconColor = PrezelTheme.colors.accentTealRegular, - textColor = PrezelTheme.colors.accentTealRegular, - borderColor = PrezelTheme.colors.accentTealRegular, - ), - ) - - PrezelChip( - text = "Label", - iconResId = PrezelIcons.Blank, - config = PrezelChipDefaults.getDefault( - iconOnly = false, - type = type, - containerColor = PrezelTheme.colors.accentMagentaSmall, - iconColor = PrezelTheme.colors.accentMagentaRegular, - textColor = PrezelTheme.colors.accentMagentaRegular, - borderColor = PrezelTheme.colors.accentMagentaRegular, - ), - ) - } - } -} diff --git a/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/chip/PrezelIconChip.kt b/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/chip/PrezelIconChip.kt deleted file mode 100644 index 368dac74..00000000 --- a/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/chip/PrezelIconChip.kt +++ /dev/null @@ -1,158 +0,0 @@ -package com.team.prezel.core.designsystem.component.chip - -import androidx.annotation.DrawableRes -import androidx.compose.material3.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier -import androidx.compose.ui.tooling.preview.PreviewParameter -import androidx.compose.ui.tooling.preview.PreviewParameterProvider -import com.team.prezel.core.designsystem.component.chip.config.PrezelChipDefault -import com.team.prezel.core.designsystem.component.chip.config.PrezelChipDefaults -import com.team.prezel.core.designsystem.component.chip.config.PrezelChipFeedback -import com.team.prezel.core.designsystem.component.chip.config.PrezelChipInteraction -import com.team.prezel.core.designsystem.component.chip.config.PrezelChipLayout -import com.team.prezel.core.designsystem.component.chip.config.PrezelChipSize -import com.team.prezel.core.designsystem.component.chip.config.PrezelChipType -import com.team.prezel.core.designsystem.icon.PrezelIcons -import com.team.prezel.core.designsystem.preview.BasicPreview -import com.team.prezel.core.designsystem.preview.PreviewRow -import com.team.prezel.core.designsystem.preview.PreviewSection -import com.team.prezel.core.designsystem.preview.PreviewValueRow -import com.team.prezel.core.designsystem.theme.PrezelTheme - -@Composable -fun PrezelIconChip( - @DrawableRes iconResId: Int, - modifier: Modifier = Modifier, - type: PrezelChipType = PrezelChipType.FILLED, - size: PrezelChipSize = PrezelChipSize.REGULAR, - interaction: PrezelChipInteraction = PrezelChipInteraction.DEFAULT, - feedback: PrezelChipFeedback = PrezelChipFeedback.DEFAULT, - config: PrezelChipDefault = PrezelChipDefaults.getDefault( - iconOnly = true, - type = type, - size = size, - interaction = interaction, - feedback = feedback, - ), -) { - PrezelChipLayout( - modifier = modifier, - text = null, - iconResId = iconResId, - config = config, - ) -} - -private class PrezelIconChipTypeProvider : PreviewParameterProvider { - override val values: Sequence = PrezelChipType.entries.asSequence() -} - -@BasicPreview -@Composable -private fun PrezelChipPreview( - @PreviewParameter(PrezelIconChipTypeProvider::class) type: PrezelChipType, -) { - PreviewSection(title = "Chip - $type") { - Text(text = "Size", style = PrezelTheme.typography.title2Medium, color = PrezelTheme.colors.textLarge) - PreviewValueRow(name = "Regular") { - PrezelIconChip( - iconResId = PrezelIcons.Blank, - type = type, - size = PrezelChipSize.REGULAR, - ) - } - PreviewValueRow(name = "Small") { - PrezelIconChip( - iconResId = PrezelIcons.Blank, - type = type, - size = PrezelChipSize.SMALL, - ) - } - - Text(text = "Interaction", style = PrezelTheme.typography.title2Medium, color = PrezelTheme.colors.textLarge) - PreviewValueRow(name = "Default") { - PrezelIconChip( - iconResId = PrezelIcons.Blank, - type = type, - interaction = PrezelChipInteraction.DEFAULT, - ) - } - PreviewValueRow(name = "Active") { - PrezelIconChip( - iconResId = PrezelIcons.Blank, - type = type, - interaction = PrezelChipInteraction.ACTIVE, - ) - } - PreviewValueRow(name = "Disabled") { - PrezelIconChip( - iconResId = PrezelIcons.Blank, - type = type, - interaction = PrezelChipInteraction.DISABLED, - ) - } - - Text(text = "Feedback", style = PrezelTheme.typography.title2Medium, color = PrezelTheme.colors.textLarge) - PreviewValueRow(name = "Default") { - PrezelIconChip( - iconResId = PrezelIcons.Blank, - type = type, - feedback = PrezelChipFeedback.DEFAULT, - ) - } - PreviewValueRow(name = "Bad") { - PrezelIconChip( - iconResId = PrezelIcons.Blank, - type = type, - feedback = PrezelChipFeedback.BAD, - ) - } - } -} - -@BasicPreview -@Composable -private fun PrezelChipCustomPreview( - @PreviewParameter(PrezelIconChipTypeProvider::class) type: PrezelChipType, -) { - PreviewSection(title = "Custom Chip - $type") { - PreviewRow { - PrezelIconChip( - iconResId = PrezelIcons.Blank, - config = PrezelChipDefaults.getDefault( - iconOnly = true, - type = type, - containerColor = PrezelTheme.colors.accentPurpleSmall, - iconColor = PrezelTheme.colors.accentPurpleRegular, - textColor = PrezelTheme.colors.accentPurpleRegular, - borderColor = PrezelTheme.colors.accentPurpleRegular, - ), - ) - - PrezelIconChip( - iconResId = PrezelIcons.Blank, - config = PrezelChipDefaults.getDefault( - iconOnly = true, - type = type, - containerColor = PrezelTheme.colors.accentTealSmall, - iconColor = PrezelTheme.colors.accentTealRegular, - textColor = PrezelTheme.colors.accentTealRegular, - borderColor = PrezelTheme.colors.accentTealRegular, - ), - ) - - PrezelIconChip( - iconResId = PrezelIcons.Blank, - config = PrezelChipDefaults.getDefault( - iconOnly = true, - type = type, - containerColor = PrezelTheme.colors.accentMagentaSmall, - iconColor = PrezelTheme.colors.accentMagentaRegular, - textColor = PrezelTheme.colors.accentMagentaRegular, - borderColor = PrezelTheme.colors.accentMagentaRegular, - ), - ) - } - } -} diff --git a/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/chip/config/PrezelChipLayout.kt b/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/chip/base/PrezelChipLayout.kt similarity index 76% rename from Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/chip/config/PrezelChipLayout.kt rename to Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/chip/base/PrezelChipLayout.kt index 1bfbb4d6..5b4e4fc8 100644 --- a/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/chip/config/PrezelChipLayout.kt +++ b/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/chip/base/PrezelChipLayout.kt @@ -1,4 +1,4 @@ -package com.team.prezel.core.designsystem.component.chip.config +package com.team.prezel.core.designsystem.component.chip.base import androidx.annotation.DrawableRes import androidx.compose.foundation.BorderStroke @@ -24,39 +24,37 @@ internal fun PrezelChipLayout( modifier: Modifier = Modifier, text: String?, @DrawableRes iconResId: Int?, - config: PrezelChipDefault, + style: PrezelChipStyle, ) { require(text != null || iconResId != null) { "Chip은 text 또는 icon 중 하나는 반드시 필요합니다." } Surface( modifier = modifier, - shape = config.shape, - color = config.containerColor, - border = config.borderColor?.let { color -> + shape = style.shape, + color = style.colors.containerColor, + border = style.colors.borderColor?.let { color -> BorderStroke(width = PrezelTheme.stroke.V1, color = color) }, ) { Row( - modifier = Modifier.padding(config.contentPadding), + modifier = Modifier.padding(style.contentPadding), horizontalArrangement = Arrangement.Center, verticalAlignment = Alignment.CenterVertically, ) { iconResId?.let { resId -> PrezelChipIcon( iconResId = resId, - iconSize = config.iconSize, - tint = config.iconColor, + iconSize = style.iconSize, + tint = style.colors.iconColor, ) } if (text != null) { - if (iconResId != null) { - Spacer(modifier = Modifier.width(config.iconTextSpacing)) - } + if (iconResId != null) Spacer(modifier = Modifier.width(style.iconTextSpacing)) Text( text = text, - color = config.textColor, - style = config.textStyle, + color = style.colors.textColor, + style = style.textStyle, ) } } diff --git a/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/chip/base/PrezelChipStyle.kt b/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/chip/base/PrezelChipStyle.kt new file mode 100644 index 00000000..0e450ec4 --- /dev/null +++ b/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/chip/base/PrezelChipStyle.kt @@ -0,0 +1,94 @@ +package com.team.prezel.core.designsystem.component.chip.base + +import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.runtime.Composable +import androidx.compose.runtime.Immutable +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.Shape +import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.unit.Dp +import com.team.prezel.core.designsystem.component.chip.chip.ChipAccent +import com.team.prezel.core.designsystem.component.chip.chip.ChipSize +import com.team.prezel.core.designsystem.component.chip.chip.ChipStatus +import com.team.prezel.core.designsystem.component.chip.iconChip.IconChipSize +import com.team.prezel.core.designsystem.theme.PrezelTheme + +@Immutable +internal data class PrezelChipColors( + val containerColor: Color, + val iconColor: Color, + val textColor: Color, + val borderColor: Color?, +) + +@Immutable +internal data class PrezelChipStyle( + val shape: Shape, + val textStyle: TextStyle, + val colors: PrezelChipColors, + val contentPadding: PaddingValues, + val iconTextSpacing: Dp, + val iconSize: Dp, +) + +@Composable +internal fun chipShape(size: ChipSize): Shape = + when (size) { + ChipSize.SMALL -> PrezelTheme.shapes.V4 + ChipSize.REGULAR -> PrezelTheme.shapes.V8 + } + +@Composable +internal fun chipTextStyle(size: ChipSize): TextStyle = + when (size) { + ChipSize.SMALL -> PrezelTheme.typography.caption2Regular + ChipSize.REGULAR -> PrezelTheme.typography.caption1Regular + } + +@Composable +internal fun iconChipShape(size: IconChipSize): Shape = + when (size) { + IconChipSize.SMALL -> PrezelTheme.shapes.V4 + IconChipSize.REGULAR -> PrezelTheme.shapes.V8 + } + +@Composable +internal fun iconChipTextStyle(size: IconChipSize): TextStyle = + when (size) { + IconChipSize.SMALL -> PrezelTheme.typography.caption2Regular + IconChipSize.REGULAR -> PrezelTheme.typography.caption1Regular + } + +@Composable +internal fun resolveContainerAccent( + status: ChipStatus, + accent: ChipAccent, +): Color? = + when (accent) { + ChipAccent.WARNING -> PrezelTheme.colors.feedbackWarningSmall + ChipAccent.PURPLE -> PrezelTheme.colors.accentPurpleSmall + ChipAccent.TEAL -> PrezelTheme.colors.accentTealSmall + ChipAccent.DEFAULT -> { + when (status) { + ChipStatus.DEFAULT -> null + ChipStatus.BAD -> PrezelTheme.colors.feedbackBadSmall + } + } + } + +@Composable +internal fun resolveContentAccent( + status: ChipStatus, + accent: ChipAccent, +): Color? = + when (accent) { + ChipAccent.WARNING -> PrezelTheme.colors.feedbackWarningRegular + ChipAccent.PURPLE -> PrezelTheme.colors.accentPurpleRegular + ChipAccent.TEAL -> PrezelTheme.colors.accentTealRegular + ChipAccent.DEFAULT -> { + when (status) { + ChipStatus.DEFAULT -> null + ChipStatus.BAD -> PrezelTheme.colors.feedbackBadRegular + } + } + } diff --git a/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/chip/chip/PrezelChip.kt b/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/chip/chip/PrezelChip.kt new file mode 100644 index 00000000..91403ca4 --- /dev/null +++ b/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/chip/chip/PrezelChip.kt @@ -0,0 +1,172 @@ +package com.team.prezel.core.designsystem.component.chip.chip + +import androidx.annotation.DrawableRes +import androidx.compose.runtime.Composable +import androidx.compose.runtime.Immutable +import androidx.compose.ui.Modifier +import com.team.prezel.core.designsystem.component.chip.base.PrezelChipLayout +import com.team.prezel.core.designsystem.icon.PrezelIcons +import com.team.prezel.core.designsystem.preview.LargeDevicePreview +import com.team.prezel.core.designsystem.preview.PreviewMatrix +import com.team.prezel.core.designsystem.preview.PreviewMatrixColumn +import com.team.prezel.core.designsystem.preview.PreviewMatrixRow +import com.team.prezel.core.designsystem.preview.PreviewSection + +@Immutable +enum class ChipType { + FILLED, + OUTLINED, +} + +@Immutable +enum class ChipSize { + SMALL, + REGULAR, +} + +@Immutable +enum class ChipState { + DEFAULT, + ACTIVE, +} + +@Immutable +enum class ChipStatus { + DEFAULT, + BAD, +} + +@Immutable +enum class ChipHierarchy { + PRIMARY, + SECONDARY, +} + +@Immutable +enum class ChipAccent { + DEFAULT, + WARNING, + PURPLE, + TEAL, +} + +@Composable +fun PrezelChip( + text: String, + modifier: Modifier = Modifier, + @DrawableRes iconResId: Int? = null, + type: ChipType = ChipType.FILLED, + size: ChipSize = ChipSize.REGULAR, + state: ChipState = ChipState.DEFAULT, + status: ChipStatus = ChipStatus.DEFAULT, + hierarchy: ChipHierarchy = ChipHierarchy.PRIMARY, + accent: ChipAccent = ChipAccent.DEFAULT, +) { + PrezelChipLayout( + modifier = modifier, + text = text, + iconResId = iconResId, + style = PrezelChipDefaults.getDefault( + type = type, + size = size, + state = state, + status = status, + hierarchy = hierarchy, + accent = accent, + ), + ) +} + +private data class ChipPreviewCase( + val type: ChipType, + val size: ChipSize = ChipSize.REGULAR, + val state: ChipState = ChipState.DEFAULT, + val status: ChipStatus = ChipStatus.DEFAULT, + val hierarchy: ChipHierarchy = ChipHierarchy.PRIMARY, + val accent: ChipAccent = ChipAccent.DEFAULT, + val showLeadingIcon: Boolean = true, +) + +private val chipPreviewColumns = listOf( + ChipSize.SMALL to ChipType.FILLED, + ChipSize.SMALL to ChipType.OUTLINED, + ChipSize.REGULAR to ChipType.FILLED, + ChipSize.REGULAR to ChipType.OUTLINED, +) + +private fun previewCases(transform: ChipPreviewCase.() -> ChipPreviewCase = { this }) = + chipPreviewColumns.map { (size, type) -> + ChipPreviewCase(type = type, size = size).transform() + } + +@LargeDevicePreview +@Composable +private fun PrezelChipPreview() { + PreviewSection( + title = "Chip", + description = "모든 상태를 하나의 표로 비교합니다. 행은 시나리오, 열은 size/type 조합입니다.", + ) { + PreviewMatrix( + title = "Overview", + columns = chipPreviewColumns.map { (size, type) -> + PreviewMatrixColumn( + header = "${size.name.lowercase().replaceFirstChar(Char::uppercase)}\n${type.name.lowercase().replaceFirstChar(Char::uppercase)}", + ) + }, + rows = listOf( + PreviewMatrixRow( + label = "Hierarchy / Primary", + values = previewCases(), + ), + PreviewMatrixRow( + label = "Hierarchy / Secondary", + values = previewCases { copy(hierarchy = ChipHierarchy.SECONDARY) }, + ), + PreviewMatrixRow( + label = "State / Active", + values = previewCases { copy(state = ChipState.ACTIVE) }, + ), + PreviewMatrixRow( + label = "Status / Bad", + values = previewCases { copy(status = ChipStatus.BAD) }, + ), + PreviewMatrixRow( + label = "Accent / Purple", + values = previewCases { copy(accent = ChipAccent.PURPLE) }, + ), + PreviewMatrixRow( + label = "Accent / Teal", + values = previewCases { copy(accent = ChipAccent.TEAL) }, + ), + PreviewMatrixRow( + label = "Accent / Warning", + values = previewCases { copy(accent = ChipAccent.WARNING) }, + ), + PreviewMatrixRow( + label = "Leading Icon / Off", + values = previewCases { copy(showLeadingIcon = false) }, + ), + PreviewMatrixRow( + label = "Leading Icon / On", + values = previewCases(), + ), + ), + ) { previewCase -> + PreviewChip(previewCase) + } + } +} + +@Composable +private fun PreviewChip(previewCase: ChipPreviewCase) { + PrezelChip( + text = "Label", + iconResId = if (previewCase.showLeadingIcon) PrezelIcons.Blank else null, + type = previewCase.type, + size = previewCase.size, + state = previewCase.state, + status = previewCase.status, + hierarchy = previewCase.hierarchy, + accent = previewCase.accent, + ) +} diff --git a/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/chip/chip/PrezelChipDefaults.kt b/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/chip/chip/PrezelChipDefaults.kt new file mode 100644 index 00000000..30f5cfb4 --- /dev/null +++ b/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/chip/chip/PrezelChipDefaults.kt @@ -0,0 +1,185 @@ +package com.team.prezel.core.designsystem.component.chip.chip + +import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.runtime.Composable +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.unit.Dp +import androidx.compose.ui.unit.dp +import com.team.prezel.core.designsystem.component.chip.base.PrezelChipColors +import com.team.prezel.core.designsystem.component.chip.base.PrezelChipStyle +import com.team.prezel.core.designsystem.component.chip.base.chipShape +import com.team.prezel.core.designsystem.component.chip.base.chipTextStyle +import com.team.prezel.core.designsystem.component.chip.base.resolveContainerAccent +import com.team.prezel.core.designsystem.component.chip.base.resolveContentAccent +import com.team.prezel.core.designsystem.theme.PrezelTheme + +object PrezelChipDefaults { + @Composable + internal fun getDefault( + type: ChipType, + size: ChipSize, + state: ChipState, + status: ChipStatus, + hierarchy: ChipHierarchy, + accent: ChipAccent, + ): PrezelChipStyle = + PrezelChipStyle( + shape = chipShape(size = size), + textStyle = chipTextStyle(size = size), + colors = chipColors( + type = type, + state = state, + status = status, + hierarchy = hierarchy, + accent = accent, + ), + contentPadding = contentPadding(size = size), + iconTextSpacing = iconTextSpacing(size = size), + iconSize = iconSize(size = size), + ) + + @Composable + private fun iconSize(size: ChipSize): Dp = + when (size) { + ChipSize.SMALL -> 14.dp + ChipSize.REGULAR -> 16.dp + } + + @Composable + private fun chipColors( + type: ChipType, + state: ChipState, + status: ChipStatus, + hierarchy: ChipHierarchy, + accent: ChipAccent, + ): PrezelChipColors { + val contentAccentColor = resolveContentAccent(status = status, accent = accent) + val usesDefaultHierarchyStyle = state == ChipState.DEFAULT && + status == ChipStatus.DEFAULT && + accent == ChipAccent.DEFAULT + + return PrezelChipColors( + containerColor = resolveChipContainerColor( + type = type, + state = state, + status = status, + hierarchy = hierarchy, + accent = accent, + ), + iconColor = resolveChipIconColor( + type = type, + state = state, + hierarchy = hierarchy, + contentAccentColor = contentAccentColor, + usesDefaultHierarchyStyle = usesDefaultHierarchyStyle, + ), + textColor = resolveChipTextColor( + type = type, + state = state, + hierarchy = hierarchy, + contentAccentColor = contentAccentColor, + usesDefaultHierarchyStyle = usesDefaultHierarchyStyle, + ), + borderColor = if (type == ChipType.OUTLINED) { + resolveChipBorderColor( + state = state, + hierarchy = hierarchy, + contentAccentColor = contentAccentColor, + ) + } else { + null + }, + ) + } + + @Composable + private fun contentPadding(size: ChipSize): PaddingValues { + val horizontal = when (size) { + ChipSize.SMALL -> PrezelTheme.spacing.V6 + ChipSize.REGULAR -> PrezelTheme.spacing.V8 + } + + val vertical = when (size) { + ChipSize.SMALL -> PrezelTheme.spacing.V4 + ChipSize.REGULAR -> PrezelTheme.spacing.V6 + } + + return PaddingValues(horizontal = horizontal, vertical = vertical) + } + + @Composable + private fun iconTextSpacing(size: ChipSize): Dp = + when (size) { + ChipSize.SMALL -> PrezelTheme.spacing.V2 + ChipSize.REGULAR -> PrezelTheme.spacing.V4 + } + + @Composable + private fun resolveChipBorderColor( + state: ChipState, + hierarchy: ChipHierarchy, + contentAccentColor: Color?, + ): Color { + if (contentAccentColor != null) return contentAccentColor + if (state == ChipState.ACTIVE) return PrezelTheme.colors.interactiveRegular + + return when (hierarchy) { + ChipHierarchy.PRIMARY -> PrezelTheme.colors.borderMedium + ChipHierarchy.SECONDARY -> PrezelTheme.colors.borderRegular + } + } + + @Composable + private fun resolveChipContainerColor( + type: ChipType, + state: ChipState, + status: ChipStatus, + hierarchy: ChipHierarchy, + accent: ChipAccent, + ): Color { + val containerAccentColor = resolveContainerAccent(status = status, accent = accent) + if (containerAccentColor != null) return containerAccentColor + + if (state == ChipState.ACTIVE) return PrezelTheme.colors.interactiveXSmall + if (type == ChipType.OUTLINED) return PrezelTheme.colors.bgRegular + + return when (hierarchy) { + ChipHierarchy.PRIMARY -> PrezelTheme.colors.bgLarge + ChipHierarchy.SECONDARY -> PrezelTheme.colors.chipContainerSecondaryFilledDefault + } + } + + @Composable + private fun resolveChipIconColor( + type: ChipType, + state: ChipState, + hierarchy: ChipHierarchy, + contentAccentColor: Color?, + usesDefaultHierarchyStyle: Boolean, + ): Color { + if (contentAccentColor != null) return contentAccentColor + if (state == ChipState.ACTIVE) return PrezelTheme.colors.interactiveRegular + if (type == ChipType.FILLED && usesDefaultHierarchyStyle && hierarchy == ChipHierarchy.PRIMARY) { + return PrezelTheme.colors.iconMedium + } + + return PrezelTheme.colors.iconRegular + } + + @Composable + private fun resolveChipTextColor( + type: ChipType, + state: ChipState, + hierarchy: ChipHierarchy, + contentAccentColor: Color?, + usesDefaultHierarchyStyle: Boolean, + ): Color { + if (contentAccentColor != null) return contentAccentColor + if (state == ChipState.ACTIVE) return PrezelTheme.colors.interactiveRegular + if (type == ChipType.FILLED && usesDefaultHierarchyStyle && hierarchy == ChipHierarchy.PRIMARY) { + return PrezelTheme.colors.textMedium + } + + return PrezelTheme.colors.textRegular + } +} diff --git a/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/chip/config/PrezelChipDefaults.kt b/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/chip/config/PrezelChipDefaults.kt deleted file mode 100644 index c839bbef..00000000 --- a/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/chip/config/PrezelChipDefaults.kt +++ /dev/null @@ -1,200 +0,0 @@ -package com.team.prezel.core.designsystem.component.chip.config - -import androidx.compose.foundation.layout.PaddingValues -import androidx.compose.runtime.Composable -import androidx.compose.runtime.Immutable -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.graphics.Shape -import androidx.compose.ui.text.TextStyle -import androidx.compose.ui.unit.Dp -import androidx.compose.ui.unit.dp -import com.team.prezel.core.designsystem.theme.PrezelTheme - -@Immutable -data class PrezelChipDefault( - val shape: Shape, - val textStyle: TextStyle, - val containerColor: Color, - val iconColor: Color, - val textColor: Color, - val borderColor: Color?, - val contentPadding: PaddingValues, - val iconTextSpacing: Dp, - val iconSize: Dp, -) - -object PrezelChipDefaults { - @Composable - fun getDefault( - iconOnly: Boolean, - type: PrezelChipType = PrezelChipType.FILLED, - size: PrezelChipSize = PrezelChipSize.REGULAR, - interaction: PrezelChipInteraction = PrezelChipInteraction.DEFAULT, - feedback: PrezelChipFeedback = PrezelChipFeedback.DEFAULT, - shape: Shape = getShape(size = size), - textStyle: TextStyle = getTextStyle(size = size), - containerColor: Color = getContainerColor( - iconOnly = iconOnly, - type = type, - interaction = interaction, - feedback = feedback, - ), - iconColor: Color = getIconColor( - type = type, - interaction = interaction, - feedback = feedback, - ), - textColor: Color = getTextColor( - type = type, - interaction = interaction, - feedback = feedback, - ), - borderColor: Color? = getBorderColor( - type = type, - interaction = interaction, - feedback = feedback, - ), - contentPadding: PaddingValues = getContentPadding(size = size, iconOnly = iconOnly), - iconTextSpacing: Dp = getIconTextSpacing(size = size), - iconSize: Dp = getIconSize(size = size), - ) = PrezelChipDefault( - shape = shape, - textStyle = textStyle, - containerColor = containerColor, - iconColor = iconColor, - textColor = textColor, - borderColor = if (type == PrezelChipType.OUTLINED) borderColor else null, - contentPadding = contentPadding, - iconTextSpacing = iconTextSpacing, - iconSize = iconSize, - ) - - @Composable - private fun getShape(size: PrezelChipSize): Shape = - when (size) { - PrezelChipSize.SMALL -> PrezelTheme.shapes.V4 - PrezelChipSize.REGULAR -> PrezelTheme.shapes.V8 - } - - @Composable - private fun getBorderColor( - type: PrezelChipType, - interaction: PrezelChipInteraction, - feedback: PrezelChipFeedback, - ): Color? { - if (type == PrezelChipType.FILLED) return null - - return when { - feedback == PrezelChipFeedback.BAD -> PrezelTheme.colors.feedbackBadRegular - interaction == PrezelChipInteraction.ACTIVE -> PrezelTheme.colors.interactiveRegular - interaction == PrezelChipInteraction.DISABLED -> PrezelTheme.colors.borderRegular - else -> PrezelTheme.colors.borderMedium - } - } - - @Composable - private fun getTextStyle(size: PrezelChipSize): TextStyle = - when (size) { - PrezelChipSize.SMALL -> PrezelTheme.typography.caption2Regular - PrezelChipSize.REGULAR -> PrezelTheme.typography.caption1Regular - } - - @Composable - private fun getContainerColor( - iconOnly: Boolean, - type: PrezelChipType, - interaction: PrezelChipInteraction, - feedback: PrezelChipFeedback, - ): Color { - if (type == PrezelChipType.OUTLINED && iconOnly) { - return Color.Transparent - } - - return when { - feedback == PrezelChipFeedback.BAD -> PrezelTheme.colors.feedbackBadSmall - interaction == PrezelChipInteraction.ACTIVE -> PrezelTheme.colors.interactiveXSmall - interaction == PrezelChipInteraction.DISABLED -> PrezelTheme.colors.bgDisabled - else -> { - when (type) { - PrezelChipType.FILLED -> PrezelTheme.colors.bgLarge - PrezelChipType.OUTLINED -> PrezelTheme.colors.bgRegular - } - } - } - } - - @Composable - private fun getIconColor( - type: PrezelChipType, - interaction: PrezelChipInteraction, - feedback: PrezelChipFeedback, - ): Color = - when { - feedback == PrezelChipFeedback.BAD -> PrezelTheme.colors.feedbackBadRegular - interaction == PrezelChipInteraction.ACTIVE -> PrezelTheme.colors.interactiveRegular - interaction == PrezelChipInteraction.DISABLED -> PrezelTheme.colors.iconDisabled - else -> { - when (type) { - PrezelChipType.FILLED -> PrezelTheme.colors.iconMedium - PrezelChipType.OUTLINED -> PrezelTheme.colors.iconRegular - } - } - } - - @Composable - private fun getTextColor( - type: PrezelChipType, - interaction: PrezelChipInteraction, - feedback: PrezelChipFeedback, - ): Color = - when { - feedback == PrezelChipFeedback.BAD -> PrezelTheme.colors.feedbackBadRegular - interaction == PrezelChipInteraction.ACTIVE -> PrezelTheme.colors.interactiveRegular - interaction == PrezelChipInteraction.DISABLED -> PrezelTheme.colors.textDisabled - else -> { - when (type) { - PrezelChipType.FILLED -> PrezelTheme.colors.textMedium - PrezelChipType.OUTLINED -> PrezelTheme.colors.textRegular - } - } - } - - @Composable - private fun getContentPadding( - size: PrezelChipSize, - iconOnly: Boolean, - ): PaddingValues { - if (iconOnly) { - val all = when (size) { - PrezelChipSize.SMALL -> PrezelTheme.spacing.V6 - PrezelChipSize.REGULAR -> PrezelTheme.spacing.V8 - } - return PaddingValues(all = all) - } - - val horizontal = when (size) { - PrezelChipSize.SMALL -> PrezelTheme.spacing.V6 - PrezelChipSize.REGULAR -> PrezelTheme.spacing.V8 - } - - val vertical = when (size) { - PrezelChipSize.SMALL -> PrezelTheme.spacing.V4 - PrezelChipSize.REGULAR -> PrezelTheme.spacing.V6 - } - - return PaddingValues(horizontal = horizontal, vertical = vertical) - } - - @Composable - private fun getIconTextSpacing(size: PrezelChipSize): Dp = - when (size) { - PrezelChipSize.REGULAR -> PrezelTheme.spacing.V4 - PrezelChipSize.SMALL -> PrezelTheme.spacing.V2 - } - - private fun getIconSize(size: PrezelChipSize): Dp = - when (size) { - PrezelChipSize.SMALL -> 14.dp - PrezelChipSize.REGULAR -> 16.dp - } -} diff --git a/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/chip/config/PrezelChipModels.kt b/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/chip/config/PrezelChipModels.kt deleted file mode 100644 index 7f150a8b..00000000 --- a/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/chip/config/PrezelChipModels.kt +++ /dev/null @@ -1,62 +0,0 @@ -package com.team.prezel.core.designsystem.component.chip.config - -import androidx.compose.runtime.Immutable - -/** - * 칩의 시각적 타입을 정의합니다. - * - * Chip의 배경, 테두리 표현 방식을 구분할 때 사용합니다. - */ -@Immutable -enum class PrezelChipType { - /** 배경이 채워진 칩입니다. */ - FILLED, - - /** 테두리가 있는 칩입니다. */ - OUTLINED, -} - -/** - * 칩의 크기를 정의합니다. - * - * 칩의 높이, 패딩, 아이콘 크기, 텍스트 스타일의 기준으로 사용합니다. - */ -@Immutable -enum class PrezelChipSize { - /** 작은 크기의 칩입니다. */ - SMALL, - - /** 기본 크기의 칩입니다. */ - REGULAR, -} - -/** - * 칩의 상호작용 상태를 정의합니다. - * - * 선택 여부나 비활성 상태에 따라 칩의 강조 수준을 표현할 때 사용합니다. - */ -@Immutable -enum class PrezelChipInteraction { - /** 기본 상태의 칩입니다. */ - DEFAULT, - - /** 활성화되어 강조된 상태의 칩입니다. */ - ACTIVE, - - /** 비활성화된 상태의 칩입니다. */ - DISABLED, -} - -/** - * 칩의 피드백 상태를 정의합니다. - * - * 일반 상태 외에 경고성 의미를 함께 전달해야 할 때 사용합니다. - */ -@Immutable -enum class PrezelChipFeedback { - /** 일반 상태의 칩입니다. */ - DEFAULT, - - /** 부정적 피드백을 표현하는 칩입니다. */ - BAD, -} diff --git a/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/chip/iconChip/PrezelIconChip.kt b/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/chip/iconChip/PrezelIconChip.kt new file mode 100644 index 00000000..1d71c068 --- /dev/null +++ b/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/chip/iconChip/PrezelIconChip.kt @@ -0,0 +1,135 @@ +package com.team.prezel.core.designsystem.component.chip.iconChip + +import androidx.annotation.DrawableRes +import androidx.compose.runtime.Composable +import androidx.compose.runtime.Immutable +import androidx.compose.ui.Modifier +import androidx.compose.ui.semantics.contentDescription +import androidx.compose.ui.semantics.semantics +import com.team.prezel.core.designsystem.component.chip.base.PrezelChipLayout +import com.team.prezel.core.designsystem.icon.PrezelIcons +import com.team.prezel.core.designsystem.preview.LargeDevicePreview +import com.team.prezel.core.designsystem.preview.PreviewMatrix +import com.team.prezel.core.designsystem.preview.PreviewMatrixColumn +import com.team.prezel.core.designsystem.preview.PreviewMatrixRow +import com.team.prezel.core.designsystem.preview.PreviewSection + +@Immutable +enum class IconChipType { + FILLED, + OUTLINED, +} + +@Immutable +enum class IconChipSize { + SMALL, + REGULAR, +} + +@Immutable +enum class IconChipState { + DEFAULT, + ACTIVE, + DISABLED, +} + +@Immutable +enum class IconChipStatus { + DEFAULT, + BAD, +} + +@Composable +fun PrezelIconChip( + @DrawableRes iconResId: Int, + modifier: Modifier = Modifier, + contentDescription: String? = null, + type: IconChipType = IconChipType.FILLED, + size: IconChipSize = IconChipSize.REGULAR, + state: IconChipState = IconChipState.DEFAULT, + status: IconChipStatus = IconChipStatus.DEFAULT, +) { + PrezelChipLayout( + modifier = if (contentDescription != null) { + modifier.semantics { this.contentDescription = contentDescription } + } else { + modifier + }, + text = null, + iconResId = iconResId, + style = PrezelIconChipDefaults.getDefault( + type = type, + size = size, + state = state, + status = status, + ), + ) +} + +private data class IconChipPreviewCase( + val type: IconChipType, + val size: IconChipSize = IconChipSize.REGULAR, + val state: IconChipState = IconChipState.DEFAULT, + val status: IconChipStatus = IconChipStatus.DEFAULT, +) + +private val iconChipPreviewColumns = listOf( + IconChipSize.SMALL to IconChipType.FILLED, + IconChipSize.SMALL to IconChipType.OUTLINED, + IconChipSize.REGULAR to IconChipType.FILLED, + IconChipSize.REGULAR to IconChipType.OUTLINED, +) + +private fun iconPreviewCases(transform: IconChipPreviewCase.() -> IconChipPreviewCase = { this }) = + iconChipPreviewColumns.map { (size, type) -> + IconChipPreviewCase(type = type, size = size).transform() + } + +@LargeDevicePreview +@Composable +private fun PrezelIconChipPreview() { + PreviewSection( + title = "Icon Chip", + description = "icon-only 케이스를 하나의 표로 비교합니다. 행은 시나리오, 열은 size/type 조합입니다.", + ) { + PreviewMatrix( + title = "Overview", + columns = iconChipPreviewColumns.map { (size, type) -> + PreviewMatrixColumn( + header = "${size.name.lowercase().replaceFirstChar(Char::uppercase)}\n${type.name.lowercase().replaceFirstChar(Char::uppercase)}", + ) + }, + rows = listOf( + PreviewMatrixRow( + label = "Default", + values = iconPreviewCases(), + ), + PreviewMatrixRow( + label = "State / Active", + values = iconPreviewCases { copy(state = IconChipState.ACTIVE) }, + ), + PreviewMatrixRow( + label = "State / Disabled", + values = iconPreviewCases { copy(state = IconChipState.DISABLED) }, + ), + PreviewMatrixRow( + label = "Status / Bad", + values = iconPreviewCases { copy(status = IconChipStatus.BAD) }, + ), + ), + ) { previewCase -> + PreviewIconChip(previewCase) + } + } +} + +@Composable +private fun PreviewIconChip(previewCase: IconChipPreviewCase) { + PrezelIconChip( + iconResId = PrezelIcons.Blank, + type = previewCase.type, + size = previewCase.size, + state = previewCase.state, + status = previewCase.status, + ) +} diff --git a/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/chip/iconChip/PrezelIconChipDefaults.kt b/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/chip/iconChip/PrezelIconChipDefaults.kt new file mode 100644 index 00000000..ff461aa4 --- /dev/null +++ b/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/chip/iconChip/PrezelIconChipDefaults.kt @@ -0,0 +1,134 @@ +package com.team.prezel.core.designsystem.component.chip.iconChip + +import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.runtime.Composable +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.unit.Dp +import androidx.compose.ui.unit.dp +import com.team.prezel.core.designsystem.component.chip.base.PrezelChipColors +import com.team.prezel.core.designsystem.component.chip.base.PrezelChipStyle +import com.team.prezel.core.designsystem.component.chip.base.iconChipShape +import com.team.prezel.core.designsystem.component.chip.base.iconChipTextStyle +import com.team.prezel.core.designsystem.theme.PrezelTheme + +object PrezelIconChipDefaults { + @Composable + internal fun getDefault( + type: IconChipType, + size: IconChipSize, + state: IconChipState, + status: IconChipStatus, + ): PrezelChipStyle = + PrezelChipStyle( + shape = iconChipShape(size = size), + textStyle = iconChipTextStyle(size = size), + colors = iconChipColors(type = type, state = state, status = status), + contentPadding = iconContentPadding(size = size), + iconTextSpacing = 0.dp, + iconSize = iconSize(size = size), + ) + + @Composable + private fun iconSize(size: IconChipSize): Dp = + when (size) { + IconChipSize.SMALL -> 12.dp + IconChipSize.REGULAR -> 14.dp + } + + @Composable + private fun iconChipColors( + type: IconChipType, + state: IconChipState, + status: IconChipStatus, + ): PrezelChipColors { + val contentAccentColor = resolveIconChipStatusContentColor(status = status) + val iconColor = resolveIconChipContentColor( + type = type, + state = state, + contentAccentColor = contentAccentColor, + ) + + return PrezelChipColors( + containerColor = resolveIconChipContainerColor( + type = type, + state = state, + status = status, + ), + iconColor = iconColor, + textColor = iconColor, + borderColor = if (type == IconChipType.OUTLINED) { + resolveIconChipBorderColor( + state = state, + contentAccentColor = contentAccentColor, + ) + } else { + null + }, + ) + } + + @Composable + private fun iconContentPadding(size: IconChipSize): PaddingValues { + val all = when (size) { + IconChipSize.SMALL -> PrezelTheme.spacing.V6 + IconChipSize.REGULAR -> PrezelTheme.spacing.V8 + } + + return PaddingValues(all = all) + } + + @Composable + private fun resolveIconChipContainerColor( + type: IconChipType, + state: IconChipState, + status: IconChipStatus, + ): Color { + if (state == IconChipState.DISABLED) return PrezelTheme.colors.bgMedium + if (type == IconChipType.OUTLINED) return Color.Transparent + + return when (state) { + IconChipState.ACTIVE -> PrezelTheme.colors.interactiveXSmall + IconChipState.DEFAULT -> { + when (status) { + IconChipStatus.DEFAULT -> PrezelTheme.colors.bgLarge + IconChipStatus.BAD -> PrezelTheme.colors.feedbackBadSmall + } + } + + IconChipState.DISABLED -> error("Handled above") + } + } + + @Composable + private fun resolveIconChipContentColor( + type: IconChipType, + state: IconChipState, + contentAccentColor: Color?, + ): Color { + if (state == IconChipState.DISABLED) return PrezelTheme.colors.iconDisabled + if (contentAccentColor != null) return contentAccentColor + if (state == IconChipState.ACTIVE) return PrezelTheme.colors.interactiveRegular + if (type == IconChipType.FILLED) return PrezelTheme.colors.iconMedium + + return PrezelTheme.colors.iconRegular + } + + @Composable + private fun resolveIconChipBorderColor( + state: IconChipState, + contentAccentColor: Color?, + ): Color { + if (state == IconChipState.DISABLED) return PrezelTheme.colors.borderRegular + if (contentAccentColor != null) return contentAccentColor + if (state == IconChipState.ACTIVE) return PrezelTheme.colors.interactiveRegular + + return PrezelTheme.colors.borderMedium + } + + @Composable + private fun resolveIconChipStatusContentColor(status: IconChipStatus): Color? = + when (status) { + IconChipStatus.DEFAULT -> null + IconChipStatus.BAD -> PrezelTheme.colors.feedbackBadRegular + } +} diff --git a/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/datepicker/config/DatePickerDefaults.kt b/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/datepicker/config/DatePickerDefaults.kt index 86701a04..0c6f2c83 100644 --- a/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/datepicker/config/DatePickerDefaults.kt +++ b/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/datepicker/config/DatePickerDefaults.kt @@ -50,6 +50,6 @@ internal object DatePickerDefaults { dayTextColor = PrezelTheme.colors.textMedium, pastDayTextColor = Color.Transparent, todayDayTextColor = PrezelTheme.colors.interactiveRegular, - holidayDayTextColor = PrezelTheme.colors.accentMagentaRegular, + holidayDayTextColor = PrezelTheme.colors.feedbackWarningRegular, ) } diff --git a/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/foundation/color/ColorTokens.kt b/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/foundation/color/ColorTokens.kt index 6dac620d..28c2b124 100644 --- a/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/foundation/color/ColorTokens.kt +++ b/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/foundation/color/ColorTokens.kt @@ -33,17 +33,17 @@ internal object ColorTokens { val Blue950 = Color(0xFF000C40) val Coral10 = Color(0xFFFFF0F0) - val Coral50 = Color(0xFFFFC7C7) - val Coral100 = Color(0xFFFFA3A3) - val Coral200 = Color(0xFFFF8084) - val Coral300 = Color(0xFFFF5C67) - val Coral400 = Color(0xFFFF384C) - val Coral500 = Color(0xFFFF1A38) - val Coral600 = Color(0xFFD90D28) - val Coral700 = Color(0xFFB20528) - val Coral800 = Color(0xFF8C001C) - val Coral900 = Color(0xFF660018) - val Coral950 = Color(0xFF400011) + val Coral50 = Color(0xFFFFD9D9) + val Coral100 = Color(0xFFFFC2C2) + val Coral200 = Color(0xFFFF9E9E) + val Coral300 = Color(0xFFFF7A7A) + val Coral400 = Color(0xFFFF5252) + val Coral500 = Color(0xFFE12D2D) + val Coral600 = Color(0xFFC21A1A) + val Coral700 = Color(0xFFA11010) + val Coral800 = Color(0xFF7D0808) + val Coral900 = Color(0xFF5C0000) + val Coral950 = Color(0xFF3D0000) val Orange10 = Color(0xFFFEF6EA) val Orange50 = Color(0xFFFEE4C1) @@ -58,42 +58,29 @@ internal object ColorTokens { val Orange900 = Color(0xFF661B00) val Orange950 = Color(0xFF400F00) - val Teal10 = Color(0xFFDBFFF6) - val Teal50 = Color(0xFFC2FFF0) - val Teal100 = Color(0xFF8FFFE3) - val Teal200 = Color(0xFF5CFFD6) - val Teal300 = Color(0xFF38F0C2) - val Teal400 = Color(0xFF25D0A5) - val Teal500 = Color(0xFF19B38C) - val Teal600 = Color(0xFF00A37A) - val Teal700 = Color(0xFF008F6B) - val Teal800 = Color(0xFF007A5C) - val Teal900 = Color(0xFF005C45) - val Teal950 = Color(0xFF08352A) + val Teal10 = Color(0xFFE9FBFB) + val Teal50 = Color(0xFFDAF9F8) + val Teal100 = Color(0xFFB6F2F0) + val Teal200 = Color(0xFF88E5E2) + val Teal300 = Color(0xFF5DD5D2) + val Teal400 = Color(0xFF3AC4C1) + val Teal500 = Color(0xFF19B3B0) + val Teal600 = Color(0xFF009B9E) + val Teal700 = Color(0xFF00838A) + val Teal800 = Color(0xFF006973) + val Teal900 = Color(0xFF00515C) + val Teal950 = Color(0xFF082E35) - val Purple10 = Color(0xFFFCF0FF) - val Purple50 = Color(0xFFF2CCFF) - val Purple100 = Color(0xFFE6A8FF) - val Purple200 = Color(0xFFD987FF) - val Purple300 = Color(0xFFC966FF) - val Purple400 = Color(0xFFB845FF) - val Purple500 = Color(0xFFA324FF) - val Purple600 = Color(0xFF9717FF) - val Purple700 = Color(0xFF6109B3) - val Purple800 = Color(0xFF45018C) - val Purple900 = Color(0xFF2E0066) - val Purple950 = Color(0xFF1B0040) - - val Magenta10 = Color(0xFFFFF0F5) - val Magenta50 = Color(0xFFFFC7DB) - val Magenta100 = Color(0xFFFF9EC5) - val Magenta200 = Color(0xFFFF7AB4) - val Magenta300 = Color(0xFFFF57A5) - val Magenta400 = Color(0xFFFF57A5) - val Magenta500 = Color(0xFFFF1091) - val Magenta600 = Color(0xFFD90681) - val Magenta700 = Color(0xFFB2006B) - val Magenta800 = Color(0xFF8B0058) - val Magenta900 = Color(0xFF660044) - val Magenta950 = Color(0xFF40002D) + val Purple10 = Color(0xFFF1F0FF) + val Purple50 = Color(0xFFDCD6FF) + val Purple100 = Color(0xFFC1B5FF) + val Purple200 = Color(0xFFA791FF) + val Purple300 = Color(0xFF9170FF) + val Purple400 = Color(0xFF8052FF) + val Purple500 = Color(0xFF6929FF) + val Purple600 = Color(0xFF5514D9) + val Purple700 = Color(0xFF4709B3) + val Purple800 = Color(0xFF39018C) + val Purple900 = Color(0xFF2C0066) + val Purple950 = Color(0xFF1E0040) } diff --git a/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/foundation/color/PrezelColors.kt b/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/foundation/color/PrezelColors.kt index ca6a9d01..3203c720 100644 --- a/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/foundation/color/PrezelColors.kt +++ b/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/foundation/color/PrezelColors.kt @@ -15,7 +15,6 @@ data class PrezelColors( val bgRegular: Color, val bgMedium: Color, val bgLarge: Color, - val bgScrim: Color, val bgDisabled: Color, // Text // 정보와 콘텐츠를 명확하게 전달하기 위해 사용하는 색상입니다. @@ -51,10 +50,12 @@ data class PrezelColors( val accentPurpleRegular: Color, val accentTealSmall: Color, val accentTealRegular: Color, - val accentMagentaSmall: Color, - val accentMagentaRegular: Color, // Solid // 흰색과 검정색을 제공하여 시각적 대비, 보조, 구분 등에 활용되는 절대값 색상입니다. val solidWhite: Color, val solidBlack: Color, + // Component + // 컴포넌트를 위한 색상입니다. + val chipContainerSecondaryFilledDefault: Color, + val scrimContainer: Color, ) diff --git a/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/preview/BasicPreview.kt b/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/preview/BasicPreview.kt index b1ca96e3..81468700 100644 --- a/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/preview/BasicPreview.kt +++ b/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/preview/BasicPreview.kt @@ -9,3 +9,11 @@ import androidx.compose.ui.tooling.preview.Preview uiMode = Configuration.UI_MODE_NIGHT_NO, ) annotation class BasicPreview + +@Preview( + showBackground = true, + backgroundColor = 0xFFFFFFFF, + uiMode = Configuration.UI_MODE_NIGHT_NO, + device = "spec:width=1080dp,height=1400dp", +) +annotation class LargeDevicePreview diff --git a/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/preview/PreviewComponent.kt b/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/preview/PreviewComponent.kt index 9c5cb150..b66903e9 100644 --- a/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/preview/PreviewComponent.kt +++ b/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/preview/PreviewComponent.kt @@ -1,16 +1,20 @@ package com.team.prezel.core.designsystem.preview import androidx.compose.foundation.background +import androidx.compose.foundation.border import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.BoxScope import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.ColumnScope +import androidx.compose.foundation.layout.IntrinsicSize import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.RowScope +import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll @@ -22,6 +26,7 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.Immutable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import com.team.prezel.core.designsystem.theme.PrezelTheme @@ -36,6 +41,28 @@ internal data class PreviewDefaults( val itemSpacing: Dp = 12.dp, ) +@Immutable +internal data class PreviewMatrixColumn( + val header: String, + val weight: Float = 1f, +) + +@Immutable +internal data class PreviewMatrixRow( + val label: String, + val values: List, + val labelWeight: Float = 1f, +) + +@Immutable +internal data class PreviewMatrixDefaults( + val titleSpacing: Dp = 12.dp, + val headerHorizontalPadding: Dp = 8.dp, + val headerVerticalPadding: Dp = 10.dp, + val cellHorizontalPadding: Dp = 8.dp, + val cellVerticalPadding: Dp = 14.dp, +) + /** * 디자인시스템 Preview의 기본 배경, 패딩, 테마를 제공합니다. * @@ -194,6 +221,184 @@ internal fun PreviewValueRow( } } +@Composable +internal fun PreviewMatrix( + title: String, + columns: List, + rows: List>, + modifier: Modifier = Modifier, + leadingHeaderText: String = "Case", + leadingColumnWeight: Float = 1f, + defaults: PreviewMatrixDefaults = PreviewMatrixDefaults(), + headerCellContent: (@Composable (PreviewMatrixColumn) -> Unit)? = null, + rowLabelContent: (@Composable (PreviewMatrixRow) -> Unit)? = null, + cellContent: @Composable (T) -> Unit, +) { + rows.forEach { row -> + require(row.values.size == columns.size) { + "PreviewMatrix row '${row.label}' has ${row.values.size} values, expected ${columns.size}." + } + } + + Column( + modifier = modifier.fillMaxWidth(), + verticalArrangement = Arrangement.spacedBy(defaults.titleSpacing), + ) { + Text( + text = title, + style = PrezelTheme.typography.body3Bold, + color = PrezelTheme.colors.textLarge, + ) + + Column( + modifier = Modifier.fillMaxWidth(), + verticalArrangement = Arrangement.spacedBy(0.dp), + ) { + PreviewMatrixHeaderRow( + leadingHeaderText = leadingHeaderText, + leadingColumnWeight = leadingColumnWeight, + columns = columns, + defaults = defaults, + headerCellContent = headerCellContent, + ) + + rows.forEach { row -> + PreviewMatrixRow( + row = row, + columns = columns, + defaults = defaults, + rowLabelContent = rowLabelContent, + cellContent = cellContent, + ) + } + } + } +} + +@Composable +private fun PreviewMatrixHeaderRow( + leadingHeaderText: String, + leadingColumnWeight: Float, + columns: List, + defaults: PreviewMatrixDefaults, + headerCellContent: (@Composable (PreviewMatrixColumn) -> Unit)?, +) { + Row( + modifier = Modifier.height(IntrinsicSize.Min), + horizontalArrangement = Arrangement.spacedBy(0.dp), + ) { + PreviewMatrixHeaderCell( + modifier = Modifier.weight(leadingColumnWeight), + defaults = defaults, + ) { + Text( + text = leadingHeaderText, + style = PrezelTheme.typography.caption2Regular, + color = PrezelTheme.colors.textMedium, + textAlign = TextAlign.Center, + ) + } + + columns.forEach { column -> + PreviewMatrixHeaderCell( + modifier = Modifier.weight(column.weight), + defaults = defaults, + ) { + if (headerCellContent == null) { + Text( + text = column.header, + style = PrezelTheme.typography.caption2Regular, + color = PrezelTheme.colors.textMedium, + textAlign = TextAlign.Center, + ) + } else { + headerCellContent(column) + } + } + } + } +} + +@Composable +private fun PreviewMatrixRow( + row: PreviewMatrixRow, + columns: List, + defaults: PreviewMatrixDefaults, + rowLabelContent: (@Composable (PreviewMatrixRow) -> Unit)?, + cellContent: @Composable (T) -> Unit, +) { + Row( + modifier = Modifier.height(IntrinsicSize.Min), + horizontalArrangement = Arrangement.spacedBy(0.dp), + ) { + PreviewMatrixCell( + modifier = Modifier.weight(row.labelWeight), + defaults = defaults, + ) { + if (rowLabelContent == null) { + Text( + text = row.label, + style = PrezelTheme.typography.body3Medium, + color = PrezelTheme.colors.textLarge, + textAlign = TextAlign.Center, + ) + } else { + rowLabelContent(row) + } + } + + row.values.forEachIndexed { index, value -> + PreviewMatrixCell( + modifier = Modifier.weight(columns[index].weight), + defaults = defaults, + ) { + cellContent(value) + } + } + } +} + +@Composable +private fun PreviewMatrixHeaderCell( + modifier: Modifier = Modifier, + defaults: PreviewMatrixDefaults, + content: @Composable () -> Unit, +) { + Box( + modifier = modifier + .fillMaxHeight() + .border(width = PrezelTheme.stroke.V1, color = PrezelTheme.colors.borderRegular) + .background(PrezelTheme.colors.bgMedium) + .padding( + horizontal = defaults.headerHorizontalPadding, + vertical = defaults.headerVerticalPadding, + ), + contentAlignment = Alignment.Center, + ) { + content() + } +} + +@Composable +private fun PreviewMatrixCell( + modifier: Modifier = Modifier, + defaults: PreviewMatrixDefaults, + content: @Composable () -> Unit, +) { + Box( + modifier = modifier + .fillMaxHeight() + .border(width = PrezelTheme.stroke.V1, color = PrezelTheme.colors.borderRegular) + .padding( + horizontal = defaults.cellHorizontalPadding, + vertical = defaults.cellVerticalPadding, + ), + contentAlignment = Alignment.Center, + ) { + content() + } +} + /** * TopBar, BottomBar, Snackbar 등 Scaffold 문맥이 필요한 Preview를 위한 래퍼입니다. */ diff --git a/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/theme/PrezelColorScheme.kt b/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/theme/PrezelColorScheme.kt index 80dfc477..0b08170c 100644 --- a/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/theme/PrezelColorScheme.kt +++ b/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/theme/PrezelColorScheme.kt @@ -28,7 +28,6 @@ internal object PrezelColorScheme { bgRegular = ColorTokens.Common0, bgMedium = ColorTokens.CoolGray10, bgLarge = ColorTokens.CoolGray100, - bgScrim = ColorTokens.Common1000.copy(alpha = 0.32f), bgDisabled = ColorTokens.CoolGray50, textSmall = ColorTokens.CoolGray300, textRegular = ColorTokens.CoolGray500, @@ -53,11 +52,11 @@ internal object PrezelColorScheme { accentPurpleSmall = ColorTokens.Purple10, accentPurpleRegular = ColorTokens.Purple500, accentTealSmall = ColorTokens.Teal10, - accentTealRegular = ColorTokens.Teal500, - accentMagentaSmall = ColorTokens.Magenta10, - accentMagentaRegular = ColorTokens.Magenta500, + accentTealRegular = ColorTokens.Teal600, solidWhite = ColorTokens.Common0, solidBlack = ColorTokens.Common1000, + chipContainerSecondaryFilledDefault = ColorTokens.CoolGray50, + scrimContainer = ColorTokens.Common1000.copy(alpha = 0.32f), ) val Dark = PrezelColors( @@ -67,7 +66,6 @@ internal object PrezelColorScheme { bgRegular = ColorTokens.CoolGray950, bgMedium = ColorTokens.CoolGray900, bgLarge = ColorTokens.CoolGray800, - bgScrim = ColorTokens.Common1000.copy(alpha = 0.32f), bgDisabled = ColorTokens.CoolGray700, textSmall = ColorTokens.CoolGray600, textRegular = ColorTokens.CoolGray400, @@ -86,17 +84,17 @@ internal object PrezelColorScheme { feedbackGoodSmall = ColorTokens.Blue10, feedbackGoodRegular = ColorTokens.Blue500, feedbackBadSmall = ColorTokens.Coral10, - feedbackBadRegular = ColorTokens.Coral600, + feedbackBadRegular = ColorTokens.Coral500, feedbackWarningSmall = ColorTokens.Orange10, feedbackWarningRegular = ColorTokens.Orange500, accentPurpleSmall = ColorTokens.Purple10, accentPurpleRegular = ColorTokens.Purple500, accentTealSmall = ColorTokens.Teal10, - accentTealRegular = ColorTokens.Teal500, - accentMagentaSmall = ColorTokens.Magenta10, - accentMagentaRegular = ColorTokens.Magenta500, + accentTealRegular = ColorTokens.Teal600, solidWhite = ColorTokens.Common0, solidBlack = ColorTokens.Common1000, + chipContainerSecondaryFilledDefault = ColorTokens.CoolGray50, + scrimContainer = ColorTokens.Common1000.copy(alpha = 0.32f), ) } @@ -124,7 +122,6 @@ private fun PrezelColorSchemeBackgroundPreview() { "Regular" to PrezelColorScheme.Light.bgRegular, "Medium" to PrezelColorScheme.Light.bgMedium, "Large" to PrezelColorScheme.Light.bgLarge, - "Scrim" to PrezelColorScheme.Light.bgScrim, "Disabled" to PrezelColorScheme.Light.bgDisabled, ), ) @@ -204,8 +201,6 @@ private fun PrezelColorSchemeAccentPreview() { "PurpleRegular" to PrezelColorScheme.Light.accentPurpleRegular, "TealSmall" to PrezelColorScheme.Light.accentTealSmall, "TealRegular" to PrezelColorScheme.Light.accentTealRegular, - "MagentaSmall" to PrezelColorScheme.Light.accentMagentaSmall, - "MagentaRegular" to PrezelColorScheme.Light.accentMagentaRegular, ), ) } @@ -223,6 +218,19 @@ private fun PrezelColorSchemeSolidPreview() { ) } +@BasicPreview +@Composable +private fun PrezelColorSchemeComponentPreview() { + PrezelColorsPreviewSection( + title = "Component", + description = "컴포넌트를 위한 색상입니다.", + items = persistentListOf( + "Chip_Container_Secondary_Filled_Default" to PrezelColorScheme.Light.chipContainerSecondaryFilledDefault, + "Scrim_Container" to PrezelColorScheme.Light.scrimContainer, + ), + ) +} + @Composable private fun PrezelColorsPreviewSection( title: String, diff --git a/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/theme/PrezelTypographyScheme.kt b/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/theme/PrezelTypographyScheme.kt index 01627660..a9ac948a 100644 --- a/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/theme/PrezelTypographyScheme.kt +++ b/Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/theme/PrezelTypographyScheme.kt @@ -3,9 +3,9 @@ package com.team.prezel.core.designsystem.theme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.text.TextStyle -import androidx.compose.ui.tooling.preview.Preview import com.team.prezel.core.designsystem.foundation.typography.PrezelTextStyles import com.team.prezel.core.designsystem.foundation.typography.PrezelTypography +import com.team.prezel.core.designsystem.preview.LargeDevicePreview import com.team.prezel.core.designsystem.preview.PreviewSection import com.team.prezel.core.designsystem.preview.PreviewValueRow import kotlinx.collections.immutable.ImmutableList @@ -37,13 +37,7 @@ internal object PrezelTypographyScheme { ) } -@Preview( - showBackground = true, - device = "spec:width=850dp,height=600dp", -) -private annotation class TypographyPreview - -@TypographyPreview +@LargeDevicePreview @Composable private fun PrezelTypographyTitlePreview() { val typography = PrezelTypographyScheme.Default() @@ -61,7 +55,7 @@ private fun PrezelTypographyTitlePreview() { ) } -@TypographyPreview +@LargeDevicePreview @Composable private fun PrezelTypographyBodyPreview() { val typography = PrezelTypographyScheme.Default() @@ -82,7 +76,7 @@ private fun PrezelTypographyBodyPreview() { ) } -@TypographyPreview +@LargeDevicePreview @Composable private fun PrezelTypographyCaptionPreview() { val typography = PrezelTypographyScheme.Default() diff --git a/Prezel/core/ui/src/main/java/com/team/prezel/core/ui/component/PrezelBadge.kt b/Prezel/core/ui/src/main/java/com/team/prezel/core/ui/component/PrezelBadge.kt index 2da8d070..7f46dc55 100644 --- a/Prezel/core/ui/src/main/java/com/team/prezel/core/ui/component/PrezelBadge.kt +++ b/Prezel/core/ui/src/main/java/com/team/prezel/core/ui/component/PrezelBadge.kt @@ -97,7 +97,7 @@ private fun BadgeImage( Box( modifier = Modifier .fillMaxSize() - .background(color = PrezelTheme.colors.bgScrim), + .background(color = PrezelTheme.colors.scrimContainer), contentAlignment = Alignment.Center, ) { Icon( diff --git a/Prezel/detekt-config.yml b/Prezel/detekt-config.yml index d0af157f..ac58f0dd 100644 --- a/Prezel/detekt-config.yml +++ b/Prezel/detekt-config.yml @@ -16,7 +16,7 @@ style: ignoreAnnotated: - Preview - BasicPreview - - TypographyPreview + - LargeDevicePreview complexity: LongMethod: @@ -24,6 +24,7 @@ complexity: ignoreAnnotated: - Preview - BasicPreview + - LargeDevicePreview NestedBlockDepth: threshold: 4 LongParameterList: diff --git a/Prezel/feature/history/impl/src/main/java/com/team/prezel/feature/history/impl/component/HistoryPresentationCard.kt b/Prezel/feature/history/impl/src/main/java/com/team/prezel/feature/history/impl/component/HistoryPresentationCard.kt index 0259057b..4122a3f7 100644 --- a/Prezel/feature/history/impl/src/main/java/com/team/prezel/feature/history/impl/component/HistoryPresentationCard.kt +++ b/Prezel/feature/history/impl/src/main/java/com/team/prezel/feature/history/impl/component/HistoryPresentationCard.kt @@ -18,10 +18,12 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import com.team.prezel.core.designsystem.component.base.PrezelTouchArea -import com.team.prezel.core.designsystem.component.chip.PrezelChip -import com.team.prezel.core.designsystem.component.chip.config.PrezelChipDefaults -import com.team.prezel.core.designsystem.component.chip.config.PrezelChipSize -import com.team.prezel.core.designsystem.component.chip.config.PrezelChipType +import com.team.prezel.core.designsystem.component.chip.chip.ChipHierarchy +import com.team.prezel.core.designsystem.component.chip.chip.ChipSize +import com.team.prezel.core.designsystem.component.chip.chip.ChipState +import com.team.prezel.core.designsystem.component.chip.chip.ChipStatus +import com.team.prezel.core.designsystem.component.chip.chip.ChipType +import com.team.prezel.core.designsystem.component.chip.chip.PrezelChip import com.team.prezel.core.designsystem.icon.PrezelIcons import com.team.prezel.core.designsystem.preview.BasicPreview import com.team.prezel.core.designsystem.theme.PrezelTheme @@ -127,14 +129,10 @@ private fun HistoryCategoryChip( text = text, modifier = modifier, iconResId = PrezelIcons.Blank, - config = PrezelChipDefaults.getDefault( - iconOnly = false, - type = PrezelChipType.FILLED, - size = PrezelChipSize.SMALL, - containerColor = PrezelTheme.colors.interactiveXSmall, - iconColor = PrezelTheme.colors.interactiveRegular, - textColor = PrezelTheme.colors.interactiveRegular, - ), + type = ChipType.FILLED, + size = ChipSize.SMALL, + state = ChipState.ACTIVE, + hierarchy = ChipHierarchy.PRIMARY, ) } @@ -146,8 +144,9 @@ private fun HistoryMetaChip( PrezelChip( text = text, modifier = modifier, - type = PrezelChipType.OUTLINED, - size = PrezelChipSize.SMALL, + type = ChipType.OUTLINED, + size = ChipSize.SMALL, + status = ChipStatus.DEFAULT, ) } diff --git a/Prezel/feature/home/impl/src/main/java/com/team/prezel/feature/home/impl/component/title/PresentationHero.kt b/Prezel/feature/home/impl/src/main/java/com/team/prezel/feature/home/impl/component/title/PresentationHero.kt index ce8d5ade..f0be1bdc 100644 --- a/Prezel/feature/home/impl/src/main/java/com/team/prezel/feature/home/impl/component/title/PresentationHero.kt +++ b/Prezel/feature/home/impl/src/main/java/com/team/prezel/feature/home/impl/component/title/PresentationHero.kt @@ -10,8 +10,9 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource -import com.team.prezel.core.designsystem.component.chip.PrezelChip -import com.team.prezel.core.designsystem.component.chip.config.PrezelChipDefaults +import com.team.prezel.core.designsystem.component.chip.chip.ChipSize +import com.team.prezel.core.designsystem.component.chip.chip.ChipType +import com.team.prezel.core.designsystem.component.chip.chip.PrezelChip import com.team.prezel.core.designsystem.preview.BasicPreview import com.team.prezel.core.designsystem.theme.PrezelTheme import com.team.prezel.core.model.presentation.Category @@ -33,11 +34,8 @@ internal fun PresentationHero( ) { PrezelChip( text = stringResource(id = presentation.category.labelResId()), - config = PrezelChipDefaults.getDefault( - iconOnly = false, - containerColor = PrezelTheme.colors.bgRegular, - textColor = PrezelTheme.colors.interactiveRegular, - ), + type = ChipType.OUTLINED, + size = ChipSize.SMALL, ) Spacer(modifier = Modifier.weight(1f))