Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ import com.orange.ouds.core.component.OudsListItemLeading
import com.orange.ouds.core.component.OudsListItemTextStyle
import com.orange.ouds.core.component.OudsListItemTrailing
import com.orange.ouds.core.component.OudsListItemVerticalAlignment
import com.orange.ouds.core.component.OudsSmallListItemLeading
import com.orange.ouds.core.component.OudsSmallListItemTrailing
import com.orange.ouds.foundation.extensions.toSentenceCase
import kotlinx.coroutines.launch

Expand Down Expand Up @@ -393,6 +395,32 @@ fun baseListItemDemoLeading(state: BaseListItemDemoState): OudsListItemLeading?
}
}

@Composable
fun baseSmallListItemDemoLeading(state: BaseListItemDemoState): OudsSmallListItemLeading? = with(state) {
when (leading) {
BaseListItemDemoState.Leading.None -> null
BaseListItemDemoState.Leading.Icon -> {
when (leadingStatusIcon) {
BaseListItemDemoState.StatusIcon.None -> OudsSmallListItemLeading.Icon(
painter = iconPainter,
contentDescription = stringResource(R.string.app_components_listItem_icon_a11y)
)
BaseListItemDemoState.StatusIcon.Info -> OudsSmallListItemLeading.Icon.Info
BaseListItemDemoState.StatusIcon.Negative -> OudsSmallListItemLeading.Icon.Negative
BaseListItemDemoState.StatusIcon.Positive -> OudsSmallListItemLeading.Icon.Positive
BaseListItemDemoState.StatusIcon.Warning -> OudsSmallListItemLeading.Icon.Warning
}
}
BaseListItemDemoState.Leading.Image -> OudsSmallListItemLeading.Image(
painter = imagePainter,
contentDescription = stringResource(R.string.app_components_listItem_image_a11y),
ratio = leadingImageRatio,
roundedCorner = leadingImageRoundedCorners,
contentScale = ContentScale.Crop
)
}
}

@Composable
fun baseListItemDemoTrailing(state: BaseListItemDemoState): OudsListItemTrailing? = with(state) {
when (trailing) {
Expand Down Expand Up @@ -434,6 +462,38 @@ fun baseListItemDemoTrailing(state: BaseListItemDemoState): OudsListItemTrailing
}
}

@Composable
fun baseSmallListItemDemoTrailing(state: BaseListItemDemoState): OudsSmallListItemTrailing? = with(state) {
when (trailing) {
BaseListItemDemoState.Trailing.None -> null
BaseListItemDemoState.Trailing.Icon -> {
when (trailingStatusIcon) {
BaseListItemDemoState.StatusIcon.None -> OudsSmallListItemTrailing.Icon(
painter = iconPainter,
contentDescription = stringResource(R.string.app_components_listItem_icon_a11y)
)
BaseListItemDemoState.StatusIcon.Info -> OudsSmallListItemTrailing.Icon.Info
BaseListItemDemoState.StatusIcon.Negative -> OudsSmallListItemTrailing.Icon.Negative
BaseListItemDemoState.StatusIcon.Positive -> OudsSmallListItemTrailing.Icon.Positive
BaseListItemDemoState.StatusIcon.Warning -> OudsSmallListItemTrailing.Icon.Warning
}
}
BaseListItemDemoState.Trailing.Image ->
OudsSmallListItemTrailing.Image(
painter = imagePainter,
contentDescription = stringResource(R.string.app_components_listItem_image_a11y),
ratio = trailingImageRatio,
roundedCorner = trailingImageRoundedCorners,
contentScale = ContentScale.Crop
)
BaseListItemDemoState.Trailing.Text ->
OudsSmallListItemTrailing.Text(
label = trailingTextLabel,
style = trailingTextStyle
)
}
}

fun FunctionCall.Builder.baseListItemArguments(state: BaseListItemDemoState, themeDrawableResources: ThemeDrawableResources) {
with(state) {
if (clickable) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import com.orange.ouds.app.ui.utilities.composable.DemoScreen
import com.orange.ouds.app.ui.utilities.nestedName
import com.orange.ouds.core.component.OudsCardItem
import com.orange.ouds.core.component.OudsListItemDecoration
import com.orange.ouds.core.component.OudsSmallCardItem
import com.orange.ouds.foundation.ExperimentalOudsApi
import com.orange.ouds.foundation.extensions.toSentenceCase
import com.orange.ouds.theme.OudsVersion
Expand Down Expand Up @@ -77,35 +78,67 @@ internal fun CardItemGeneralCustomizationContent(state: CardItemDemoState) {
private fun CardItemDemoContent(state: CardItemDemoState) {
with(state) {
if (clickable) {
OudsCardItem(
onClick = {},
indicator = indicator.toOudsListItemIndicator(),
label = label,
verticalAlignment = verticalAlignment,
overline = overline,
extraLabel = extraLabel,
description = description,
leading = baseListItemDemoLeading(state = state),
trailing = baseListItemDemoTrailing(state = state),
decoration = decoration.toOudsListItemDecoration(divider = divider),
helperText = helperText,
boldLabel = boldLabel,
enabled = enabled,
)
when (size) {
BaseListItemDemoState.Size.Default ->
OudsCardItem(
onClick = {},
indicator = indicator.toOudsListItemIndicator(),
label = label,
verticalAlignment = verticalAlignment,
overline = overline,
extraLabel = extraLabel,
description = description,
leading = baseListItemDemoLeading(state = state),
trailing = baseListItemDemoTrailing(state = state),
decoration = decoration.toOudsListItemDecoration(divider = divider),
helperText = helperText,
boldLabel = boldLabel,
enabled = enabled,
)
BaseListItemDemoState.Size.Small ->
OudsSmallCardItem(
onClick = {},
indicator = indicator.toOudsListItemIndicator(),
label = label,
verticalAlignment = verticalAlignment,
description = description,
leading = baseSmallListItemDemoLeading(state = state),
trailing = baseSmallListItemDemoTrailing(state = state),
decoration = decoration.toOudsListItemDecoration(divider = divider),
helperText = helperText,
boldLabel = boldLabel,
enabled = enabled,
)
}
} else {
OudsCardItem(
label = label,
verticalAlignment = verticalAlignment,
overline = overline,
extraLabel = extraLabel,
description = description,
leading = baseListItemDemoLeading(state = state),
trailing = baseListItemDemoTrailing(state = state),
decoration = decoration.toOudsListItemDecoration(divider = divider),
helperText = helperText,
boldLabel = boldLabel,
enabled = enabled,
)
when (size) {
BaseListItemDemoState.Size.Default ->
OudsCardItem(
label = label,
verticalAlignment = verticalAlignment,
overline = overline,
extraLabel = extraLabel,
description = description,
leading = baseListItemDemoLeading(state = state),
trailing = baseListItemDemoTrailing(state = state),
decoration = decoration.toOudsListItemDecoration(divider = divider),
helperText = helperText,
boldLabel = boldLabel,
enabled = enabled,
)
BaseListItemDemoState.Size.Small ->
OudsSmallCardItem(
label = label,
verticalAlignment = verticalAlignment,
description = description,
leading = baseSmallListItemDemoLeading(state = state),
trailing = baseSmallListItemDemoTrailing(state = state),
decoration = decoration.toOudsListItemDecoration(divider = divider),
helperText = helperText,
boldLabel = boldLabel,
enabled = enabled,
)
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import com.orange.ouds.app.ui.utilities.ThemeDrawableResources
import com.orange.ouds.app.ui.utilities.composable.CustomizationSwitchItem
import com.orange.ouds.app.ui.utilities.composable.DemoScreen
import com.orange.ouds.core.component.OudsListItem
import com.orange.ouds.core.component.OudsSmallListItem
import com.orange.ouds.core.theme.OudsTheme
import com.orange.ouds.foundation.ExperimentalOudsApi
import com.orange.ouds.theme.OudsVersion
Expand Down Expand Up @@ -78,41 +79,80 @@ private fun ListItemDemoContent(state: ListItemDemoState) {
with(state) {
val modifier = if (edgeToEdge) Modifier else Modifier.padding(horizontal = OudsTheme.grids.margin)
if (clickable) {
OudsListItem(
modifier = modifier,
onClick = {},
indicator = indicator.toOudsListItemIndicator(),
label = label,
verticalAlignment = verticalAlignment,
overline = overline,
extraLabel = extraLabel,
description = description,
leading = baseListItemDemoLeading(state = state),
trailing = baseListItemDemoTrailing(state = state),
divider = divider,
background = background,
helperText = helperText,
boldLabel = boldLabel,
enabled = enabled,
edgeToEdge = edgeToEdge
)
when (size) {
BaseListItemDemoState.Size.Default ->
OudsListItem(
modifier = modifier,
onClick = {},
indicator = indicator.toOudsListItemIndicator(),
label = label,
verticalAlignment = verticalAlignment,
overline = overline,
extraLabel = extraLabel,
description = description,
leading = baseListItemDemoLeading(state = state),
trailing = baseListItemDemoTrailing(state = state),
divider = divider,
background = background,
helperText = helperText,
boldLabel = boldLabel,
enabled = enabled,
edgeToEdge = edgeToEdge
)
BaseListItemDemoState.Size.Small ->
OudsSmallListItem(
modifier = modifier,
onClick = {},
indicator = indicator.toOudsListItemIndicator(),
label = label,
verticalAlignment = verticalAlignment,
description = description,
leading = baseSmallListItemDemoLeading(state = state),
trailing = baseSmallListItemDemoTrailing(state = state),
divider = divider,
background = background,
helperText = helperText,
boldLabel = boldLabel,
enabled = enabled,
edgeToEdge = edgeToEdge
)
}
} else {
OudsListItem(
modifier = modifier,
label = label,
verticalAlignment = verticalAlignment,
overline = overline,
extraLabel = extraLabel,
description = description,
leading = baseListItemDemoLeading(state = state),
trailing = baseListItemDemoTrailing(state = state),
divider = divider,
background = background,
helperText = helperText,
boldLabel = boldLabel,
enabled = enabled,
edgeToEdge = edgeToEdge
)
when (size) {
BaseListItemDemoState.Size.Default ->
OudsListItem(
modifier = modifier,
label = label,
verticalAlignment = verticalAlignment,
overline = overline,
extraLabel = extraLabel,
description = description,
leading = baseListItemDemoLeading(state = state),
trailing = baseListItemDemoTrailing(state = state),
divider = divider,
background = background,
helperText = helperText,
boldLabel = boldLabel,
enabled = enabled,
edgeToEdge = edgeToEdge
)
BaseListItemDemoState.Size.Small ->
OudsSmallListItem(
modifier = modifier,
label = label,
verticalAlignment = verticalAlignment,
description = description,
leading = baseSmallListItemDemoLeading(state = state),
trailing = baseSmallListItemDemoTrailing(state = state),
divider = divider,
background = background,
helperText = helperText,
boldLabel = boldLabel,
enabled = enabled,
edgeToEdge = edgeToEdge
)
}

}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ open class OudsListItemText internal constructor(

@Composable
override fun Content(modifier: Modifier) {
Column(modifier = modifier) {
Column(modifier = modifier, horizontalAlignment = Alignment.End) {
Text(
modifier = modifier.padding(
top = topTextContainerPadding(verticalAlignment = extraParameters.verticalAlignment, size = extraParameters.size)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.