From 90e03cc15bc998abd43575dece5242f801a34d54 Mon Sep 17 00:00:00 2001 From: Siddharth Agarwal Date: Tue, 3 Sep 2024 16:57:34 +0530 Subject: [PATCH] Add `MenuItem` component --- .../kotlin/org/hisp/dhis/common/App.kt | 2 + .../org/hisp/dhis/common/screens/Groups.kt | 1 + .../common/screens/others/MenuItemScreen.kt | 469 ++++++++++++++++++ .../ui/designsystem/component/MenuItem.kt | 234 ++++++++- 4 files changed, 693 insertions(+), 13 deletions(-) create mode 100644 common/src/commonMain/kotlin/org/hisp/dhis/common/screens/others/MenuItemScreen.kt diff --git a/common/src/commonMain/kotlin/org/hisp/dhis/common/App.kt b/common/src/commonMain/kotlin/org/hisp/dhis/common/App.kt index c62bdb5b9..4f68cd26c 100644 --- a/common/src/commonMain/kotlin/org/hisp/dhis/common/App.kt +++ b/common/src/commonMain/kotlin/org/hisp/dhis/common/App.kt @@ -23,6 +23,7 @@ import org.hisp.dhis.common.screens.others.BadgesScreen import org.hisp.dhis.common.screens.others.ChipsScreen import org.hisp.dhis.common.screens.others.IndicatorScreen import org.hisp.dhis.common.screens.others.LegendScreen +import org.hisp.dhis.common.screens.others.MenuItemScreen import org.hisp.dhis.common.screens.others.MetadataAvatarScreen import org.hisp.dhis.common.screens.others.NavigationBarScreen import org.hisp.dhis.common.screens.others.ProgressScreen @@ -100,6 +101,7 @@ fun Main( Groups.TAGS -> TagsScreen() Groups.SEARCH_BAR -> SearchBarScreen() Groups.NAVIGATION_BAR -> NavigationBarScreen() + Groups.MENU_ITEM -> MenuItemScreen() Groups.NO_GROUP_SELECTED -> NoComponentSelectedScreen() } } else { diff --git a/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/Groups.kt b/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/Groups.kt index 403da1712..91949a274 100644 --- a/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/Groups.kt +++ b/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/Groups.kt @@ -18,5 +18,6 @@ enum class Groups(val label: String) { INDICATOR("Indicators"), PARAMETER_SELECTOR("Parameter selector"), NAVIGATION_BAR("Navigation Bar"), + MENU_ITEM("Menu Item"), NO_GROUP_SELECTED("No group selected"), } diff --git a/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/others/MenuItemScreen.kt b/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/others/MenuItemScreen.kt new file mode 100644 index 000000000..d2c342d28 --- /dev/null +++ b/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/others/MenuItemScreen.kt @@ -0,0 +1,469 @@ +package org.hisp.dhis.common.screens.others + +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.automirrored.outlined.ArrowRight +import androidx.compose.material.icons.outlined.Check +import androidx.compose.material.icons.outlined.Done +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.unit.dp +import org.hisp.dhis.mobile.ui.designsystem.component.ColumnComponentContainer +import org.hisp.dhis.mobile.ui.designsystem.component.ColumnScreenContainer +import org.hisp.dhis.mobile.ui.designsystem.component.MenuItem +import org.hisp.dhis.mobile.ui.designsystem.component.MenuItemData +import org.hisp.dhis.mobile.ui.designsystem.component.MenuItemState +import org.hisp.dhis.mobile.ui.designsystem.component.MenuItemStyle +import org.hisp.dhis.mobile.ui.designsystem.component.MenuLeadingElement +import org.hisp.dhis.mobile.ui.designsystem.component.MenuTrailingElement + +@Composable +fun MenuItemScreen() { + ColumnScreenContainer("Menu Item") { + ColumnComponentContainer("Menu list item") { + Column( + modifier = Modifier.fillMaxWidth(), + verticalArrangement = Arrangement.spacedBy(20.dp), + ) { + Row( + horizontalArrangement = Arrangement.spacedBy(20.dp), + ) { + MenuItem( + modifier = Modifier.weight(1f), + menuItemData = MenuItemData( + label = "Menu Item", + supportingText = "Supporting Text", + showDivider = true, + leadingElement = MenuLeadingElement.Icon( + icon = Icons.Outlined.Done, + ), + trailingElement = MenuTrailingElement.Icon( + icon = Icons.AutoMirrored.Outlined.ArrowRight, + ), + ), + ) {} + + MenuItem( + modifier = Modifier.weight(1f), + menuItemData = MenuItemData( + label = "Menu Item", + supportingText = "Supporting Text", + showDivider = true, + style = MenuItemStyle.ALERT, + leadingElement = MenuLeadingElement.Icon( + icon = Icons.Outlined.Done, + ), + trailingElement = MenuTrailingElement.Icon( + icon = Icons.AutoMirrored.Outlined.ArrowRight, + ), + ), + ) {} + } + + Row( + horizontalArrangement = Arrangement.spacedBy(20.dp), + ) { + MenuItem( + modifier = Modifier.weight(1f), + menuItemData = MenuItemData( + label = "Menu Item", + supportingText = "Supporting Text", + showDivider = true, + state = MenuItemState.SELECTED, + leadingElement = MenuLeadingElement.Icon( + icon = Icons.Outlined.Done, + ), + trailingElement = MenuTrailingElement.Icon( + icon = Icons.AutoMirrored.Outlined.ArrowRight, + ), + ), + ) {} + + MenuItem( + modifier = Modifier.weight(1f), + menuItemData = MenuItemData( + label = "Menu Item", + supportingText = "Supporting Text", + showDivider = true, + state = MenuItemState.SELECTED, + style = MenuItemStyle.ALERT, + leadingElement = MenuLeadingElement.Icon( + icon = Icons.Outlined.Done, + ), + trailingElement = MenuTrailingElement.Icon( + icon = Icons.AutoMirrored.Outlined.ArrowRight, + ), + ), + ) {} + } + + Row( + horizontalArrangement = Arrangement.spacedBy(20.dp), + ) { + MenuItem( + modifier = Modifier.weight(1f), + menuItemData = MenuItemData( + label = "Menu Item", + supportingText = "Supporting Text", + showDivider = true, + state = MenuItemState.DISABLED, + leadingElement = MenuLeadingElement.Icon( + icon = Icons.Outlined.Done, + ), + trailingElement = MenuTrailingElement.Icon( + icon = Icons.AutoMirrored.Outlined.ArrowRight, + ), + ), + ) {} + + MenuItem( + modifier = Modifier.weight(1f), + menuItemData = MenuItemData( + label = "Menu Item", + supportingText = "Supporting Text", + showDivider = true, + state = MenuItemState.DISABLED, + style = MenuItemStyle.ALERT, + leadingElement = MenuLeadingElement.Icon( + icon = Icons.Outlined.Done, + ), + trailingElement = MenuTrailingElement.Icon( + icon = Icons.AutoMirrored.Outlined.ArrowRight, + ), + ), + ) {} + } + } + } + + ColumnComponentContainer("Menu item with leading element variations") { + MenuItem( + menuItemData = MenuItemData( + label = "No Leading Element", + ), + ) {} + + MenuItem( + menuItemData = MenuItemData( + label = "Indent Leading Element", + leadingElement = MenuLeadingElement.Indent, + ), + ) {} + + MenuItem( + menuItemData = MenuItemData( + label = "Icon Leading Element", + leadingElement = MenuLeadingElement.Icon( + icon = Icons.Outlined.Check, + ), + ), + ) {} + + MenuItem( + menuItemData = MenuItemData( + label = "Selected Indent Leading Element", + leadingElement = MenuLeadingElement.Indent, + state = MenuItemState.SELECTED, + ), + ) {} + + MenuItem( + menuItemData = MenuItemData( + label = "Selected Icon Leading Element", + leadingElement = MenuLeadingElement.Icon( + icon = Icons.Outlined.Check, + ), + state = MenuItemState.SELECTED, + ), + ) {} + + MenuItem( + menuItemData = MenuItemData( + label = "Disabled Indent Leading Element", + leadingElement = MenuLeadingElement.Indent, + state = MenuItemState.DISABLED, + ), + ) {} + + MenuItem( + menuItemData = MenuItemData( + label = "Disabled Icon Leading Element", + leadingElement = MenuLeadingElement.Icon( + icon = Icons.Outlined.Check, + ), + state = MenuItemState.DISABLED, + ), + ) {} + } + + ColumnComponentContainer("Menu item with divider") { + MenuItem( + menuItemData = MenuItemData( + label = "Menu Item", + showDivider = true, + ), + ) {} + } + + ColumnComponentContainer("Menu item with trailing element variations") { + MenuItem( + menuItemData = MenuItemData( + label = "No Trailing Element", + leadingElement = MenuLeadingElement.Icon( + icon = Icons.Outlined.Check, + ), + ), + ) {} + + MenuItem( + menuItemData = MenuItemData( + label = "Icon Trailing Element", + leadingElement = MenuLeadingElement.Icon( + icon = Icons.Outlined.Check, + ), + trailingElement = MenuTrailingElement.Icon( + icon = Icons.AutoMirrored.Outlined.ArrowRight, + ), + ), + ) {} + + MenuItem( + menuItemData = MenuItemData( + label = "Text Trailing Element", + leadingElement = MenuLeadingElement.Icon( + icon = Icons.Outlined.Check, + ), + trailingElement = MenuTrailingElement.Text( + text = "⌘C", + ), + ), + ) {} + + MenuItem( + menuItemData = MenuItemData( + label = "Selected Icon Trailing Element", + state = MenuItemState.SELECTED, + leadingElement = MenuLeadingElement.Icon( + icon = Icons.Outlined.Check, + ), + trailingElement = MenuTrailingElement.Icon( + icon = Icons.AutoMirrored.Outlined.ArrowRight, + ), + ), + ) {} + + MenuItem( + menuItemData = MenuItemData( + label = "Selected Text Trailing Element", + state = MenuItemState.SELECTED, + leadingElement = MenuLeadingElement.Icon( + icon = Icons.Outlined.Check, + ), + trailingElement = MenuTrailingElement.Text( + text = "⌘C", + ), + ), + ) {} + + MenuItem( + menuItemData = MenuItemData( + label = "Disabled Icon Trailing Element", + state = MenuItemState.DISABLED, + leadingElement = MenuLeadingElement.Icon( + icon = Icons.Outlined.Check, + ), + trailingElement = MenuTrailingElement.Icon( + icon = Icons.AutoMirrored.Outlined.ArrowRight, + ), + ), + ) {} + + MenuItem( + menuItemData = MenuItemData( + label = "Disabled Text Trailing Element", + state = MenuItemState.DISABLED, + leadingElement = MenuLeadingElement.Icon( + icon = Icons.Outlined.Check, + ), + trailingElement = MenuTrailingElement.Text( + text = "⌘C", + ), + ), + ) {} + } + + ColumnComponentContainer("Alert Menu item with leading element variations") { + MenuItem( + menuItemData = MenuItemData( + label = "No Leading Element", + style = MenuItemStyle.ALERT, + ), + ) {} + + MenuItem( + menuItemData = MenuItemData( + label = "Indent Leading Element", + leadingElement = MenuLeadingElement.Indent, + style = MenuItemStyle.ALERT, + ), + ) {} + + MenuItem( + menuItemData = MenuItemData( + label = "Icon Leading Element", + leadingElement = MenuLeadingElement.Icon( + icon = Icons.Outlined.Check, + ), + style = MenuItemStyle.ALERT, + ), + ) {} + + MenuItem( + menuItemData = MenuItemData( + label = "Selected Indent Leading Element", + leadingElement = MenuLeadingElement.Indent, + style = MenuItemStyle.ALERT, + state = MenuItemState.SELECTED, + ), + ) {} + + MenuItem( + menuItemData = MenuItemData( + label = "Selected Icon Leading Element", + leadingElement = MenuLeadingElement.Icon( + icon = Icons.Outlined.Check, + ), + style = MenuItemStyle.ALERT, + state = MenuItemState.SELECTED, + ), + ) {} + + MenuItem( + menuItemData = MenuItemData( + label = "Disabled Indent Leading Element", + leadingElement = MenuLeadingElement.Indent, + style = MenuItemStyle.ALERT, + state = MenuItemState.DISABLED, + ), + ) {} + + MenuItem( + menuItemData = MenuItemData( + label = "Diasbled Icon Leading Element", + leadingElement = MenuLeadingElement.Icon( + icon = Icons.Outlined.Check, + ), + style = MenuItemStyle.ALERT, + state = MenuItemState.DISABLED, + ), + ) {} + } + + ColumnComponentContainer("Alert Menu item with divider") { + MenuItem( + menuItemData = MenuItemData( + label = "Menu Item", + showDivider = true, + style = MenuItemStyle.ALERT, + ), + ) {} + } + + ColumnComponentContainer("Alert Menu item with trailing element variations") { + MenuItem( + menuItemData = MenuItemData( + label = "No Trailing Element", + style = MenuItemStyle.ALERT, + leadingElement = MenuLeadingElement.Icon( + icon = Icons.Outlined.Check, + ), + ), + ) {} + + MenuItem( + menuItemData = MenuItemData( + label = "Icon Trailing Element", + style = MenuItemStyle.ALERT, + leadingElement = MenuLeadingElement.Icon( + icon = Icons.Outlined.Check, + ), + trailingElement = MenuTrailingElement.Icon( + icon = Icons.AutoMirrored.Outlined.ArrowRight, + ), + ), + ) {} + + MenuItem( + menuItemData = MenuItemData( + label = "Text Trailing Element", + style = MenuItemStyle.ALERT, + leadingElement = MenuLeadingElement.Icon( + icon = Icons.Outlined.Check, + ), + trailingElement = MenuTrailingElement.Text( + text = "⌘C", + ), + ), + ) {} + + MenuItem( + menuItemData = MenuItemData( + label = "Selected Icon Trailing Element", + style = MenuItemStyle.ALERT, + state = MenuItemState.SELECTED, + leadingElement = MenuLeadingElement.Icon( + icon = Icons.Outlined.Check, + ), + trailingElement = MenuTrailingElement.Icon( + icon = Icons.AutoMirrored.Outlined.ArrowRight, + ), + ), + ) {} + + MenuItem( + menuItemData = MenuItemData( + label = "Selected Text Trailing Element", + style = MenuItemStyle.ALERT, + state = MenuItemState.SELECTED, + leadingElement = MenuLeadingElement.Icon( + icon = Icons.Outlined.Check, + ), + trailingElement = MenuTrailingElement.Text( + text = "⌘C", + ), + ), + ) {} + + MenuItem( + menuItemData = MenuItemData( + label = "Disabled Icon Trailing Element", + state = MenuItemState.DISABLED, + style = MenuItemStyle.ALERT, + leadingElement = MenuLeadingElement.Icon( + icon = Icons.Outlined.Check, + ), + trailingElement = MenuTrailingElement.Icon( + icon = Icons.AutoMirrored.Outlined.ArrowRight, + ), + ), + ) {} + + MenuItem( + menuItemData = MenuItemData( + label = "Disabled Text Trailing Element", + state = MenuItemState.DISABLED, + style = MenuItemStyle.ALERT, + leadingElement = MenuLeadingElement.Icon( + icon = Icons.Outlined.Check, + ), + trailingElement = MenuTrailingElement.Text( + text = "⌘C", + ), + ), + ) {} + } + } +} diff --git a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/MenuItem.kt b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/MenuItem.kt index b24e2092e..02115b248 100644 --- a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/MenuItem.kt +++ b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/MenuItem.kt @@ -1,23 +1,193 @@ package org.hisp.dhis.mobile.ui.designsystem.component +import androidx.compose.foundation.background +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.material3.HorizontalDivider +import androidx.compose.material3.Icon +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.alpha +import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.vector.ImageVector +import org.hisp.dhis.mobile.ui.designsystem.theme.Border +import org.hisp.dhis.mobile.ui.designsystem.theme.Outline +import org.hisp.dhis.mobile.ui.designsystem.theme.Spacing +import org.hisp.dhis.mobile.ui.designsystem.theme.SurfaceColor +import org.hisp.dhis.mobile.ui.designsystem.theme.TextColor +import org.hisp.dhis.mobile.ui.designsystem.theme.hoverPointerIcon +/** + * DHIS2 [MenuItem] Used for dropdown menu. + * @param modifier: allows a modifier to be passed externally. + * @param menuItemData: manages the [MenuItemData] + * @param onItemClick: callback to when menu item is clicked. + */ @Composable fun MenuItem( modifier: Modifier = Modifier, menuItemData: MenuItemData, + onItemClick: () -> Unit, +) { + val itemContainerBackground = when (menuItemData.state) { + MenuItemState.SELECTED -> { + if (menuItemData.style == MenuItemStyle.ALERT) { + SurfaceColor.ErrorContainer + } else { + SurfaceColor.Container + } + } + + else -> Color.Transparent + } + + Column( + modifier = modifier, + ) { + Row( + modifier = Modifier + .background(itemContainerBackground) + .alpha(if (menuItemData.state != MenuItemState.DISABLED) 1f else 0.38f) + .clickable( + enabled = menuItemData.state != MenuItemState.DISABLED, + onClick = { + onItemClick.invoke() + }, + ) + .hoverPointerIcon(menuItemData.state != MenuItemState.DISABLED) + .height(Spacing.Spacing48) + .padding(horizontal = Spacing.Spacing12), + verticalAlignment = Alignment.CenterVertically, + ) { + MenuItemLeadingElement( + leadingElement = menuItemData.leadingElement, + style = menuItemData.style, + state = menuItemData.state, + ) + Column( + modifier = Modifier.weight(1f), + ) { + Text( + style = MaterialTheme.typography.bodyLarge, + color = if (menuItemData.style == MenuItemStyle.ALERT) SurfaceColor.Error else TextColor.OnSurface, + text = menuItemData.label, + ) + if (!menuItemData.supportingText.isNullOrEmpty()) { + Text( + style = MaterialTheme.typography.bodyMedium, + color = if (menuItemData.style == MenuItemStyle.ALERT) TextColor.OnErrorContainer else TextColor.OnSurfaceVariant, + text = menuItemData.supportingText, + ) + } + } + + MenuItemTrailingElement( + trailingElement = menuItemData.trailingElement, + state = menuItemData.state, + ) + } + if (menuItemData.showDivider) { + HorizontalDivider( + modifier = modifier.padding(vertical = Spacing.Spacing8), + thickness = Border.Thin, + color = Outline.Medium, + ) + } + } +} + +@Composable +private fun MenuItemLeadingElement( + leadingElement: MenuLeadingElement? = null, + style: MenuItemStyle, + state: MenuItemState, +) { + when (leadingElement) { + is MenuLeadingElement.Indent -> { + Box(modifier = Modifier.padding(end = Spacing.Spacing12).size(Spacing.Spacing24)) + } + + is MenuLeadingElement.Icon -> { + val iconTint = when (state) { + MenuItemState.SELECTED -> { + if (style == MenuItemStyle.ALERT) { + leadingElement.selectedErrorTintColor + } else { + leadingElement.selectedTintColor + } + } + + else -> if (style == MenuItemStyle.ALERT) { + leadingElement.defaultErrorTintColor + } else { + leadingElement.defaultTintColor + } + } + Icon( + imageVector = leadingElement.icon, + modifier = Modifier.padding(end = Spacing.Spacing12).size(Spacing.Spacing24), + contentDescription = null, + tint = iconTint, + ) + } + + else -> {} + } +} + +@Composable +private fun MenuItemTrailingElement( + trailingElement: MenuTrailingElement? = null, + state: MenuItemState, ) { + when (trailingElement) { + is MenuTrailingElement.Icon -> { + Icon( + imageVector = trailingElement.icon, + modifier = Modifier.padding(start = Spacing.Spacing12).size(Spacing.Spacing24), + contentDescription = null, + tint = if (state == MenuItemState.SELECTED) trailingElement.selectedTintColor else trailingElement.defaultTintColor, + ) + } + + is MenuTrailingElement.Text -> { + Text( + modifier = Modifier.padding(start = Spacing.Spacing12), + style = MaterialTheme.typography.bodyLarge, + color = if (state == MenuItemState.SELECTED) TextColor.OnSurface else TextColor.OnSurfaceVariant, + text = trailingElement.text, + ) + } + else -> {} + } } +/** + * DHIS2 [MenuItemData], + * class to control the [MenuItem] + * @param label: controls the text to be shown. + * @param state: controls the [MenuItem] state. + * @param style: controls the [MenuItem] style. + * @param leadingElement: controls the [MenuLeadingElement]. + * @param trailingElement: controls the [MenuTrailingElement]. + * @param supportingText: controls the supporting text to be shown. + * @param showDivider: controls whether a divider should be shown. + */ data class MenuItemData( val label: String, val state: MenuItemState = MenuItemState.ENABLED, val style: MenuItemStyle = MenuItemStyle.DEFAULT, - val leadingElement: LeadingElement? = null, - val trailingElement: TrailingElement? = null, + val leadingElement: MenuLeadingElement? = null, + val trailingElement: MenuTrailingElement? = null, val supportingText: String? = null, val showDivider: Boolean = false, ) @@ -28,14 +198,13 @@ data class MenuItemData( */ enum class MenuItemState { ENABLED, - HOVERED, SELECTED, DISABLED, } /** * DHIS2 MenuItemStyle, - * enum class to control the style [MenuItem] component + * enum class to control the [MenuItem] style */ enum class MenuItemStyle { DEFAULT, @@ -43,19 +212,58 @@ enum class MenuItemStyle { } /** - * DHIS2 MenuLeadingElement, + * DHIS2 [MenuLeadingElement], * class to control the [MenuItem] leading element */ -sealed class LeadingElement { - data object Indent : LeadingElement() - data class Icon(val icon: ImageVector) : LeadingElement() +sealed class MenuLeadingElement { + /** + * DHIS2 [Indent], + * class to control the [MenuLeadingElement] trailing element indent. + */ + data object Indent : MenuLeadingElement() + + /** + * DHIS2 [Icon], + * class to control the [MenuLeadingElement] trailing element icon. + * @param icon: controls the icon to be shown. + * @param defaultErrorTintColor: controls the error style tint color. + * @param defaultTintColor: controls the default tint color. + * @param selectedErrorTintColor: controls the error style tint color when selected. + * @param selectedTintColor: controls the tint color when selected. + */ + data class Icon( + val icon: ImageVector, + val defaultErrorTintColor: Color = SurfaceColor.Error, + val defaultTintColor: Color = SurfaceColor.Primary, + val selectedErrorTintColor: Color = TextColor.OnErrorContainer, + val selectedTintColor: Color = TextColor.OnPrimaryContainer, + ) : MenuLeadingElement() } /** - * DHIS2 MenuTrailingElement, + * DHIS2 [MenuTrailingElement], * class to control the [MenuItem] trailing element */ -sealed class TrailingElement { - data class Icon(val icon: ImageVector, val isSelected: Boolean = false) : TrailingElement() - data class Text(val text: String, val isSelected: Boolean = false) : TrailingElement() -} \ No newline at end of file +sealed class MenuTrailingElement { + /** + * DHIS2 [Icon], + * class to control the [MenuTrailingElement] trailing element icon. + * @param icon: controls the icon to be shown. + * @param defaultTintColor: controls the default tint color. + * @param selectedTintColor: controls the tint color when selected. + */ + data class Icon( + val icon: ImageVector, + val defaultTintColor: Color = TextColor.OnSurfaceVariant, + val selectedTintColor: Color = TextColor.OnSurface, + ) : MenuTrailingElement() + + /** + * DHIS2 [Text], + * class to control the [MenuTrailingElement] trailing element text. + * @param text: controls the text to be shown. + */ + data class Text( + val text: String, + ) : MenuTrailingElement() +}