Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
de6093e
Initialize OudsBottomSheetScaffold and OudsModalBottomSheet
paulinea Feb 23, 2026
5db7cce
Use OudsBottomSheetScaffold as demo screens customization bottom sheet
paulinea Mar 12, 2026
4d26436
Add OudsBottomSheetScaffold demo screen
paulinea Mar 12, 2026
582f280
Add OudsModalBottomSheet demo screen
paulinea Mar 13, 2026
2063ac4
Adjust bottom sheets with Design's data
paulinea Mar 13, 2026
a42a08c
Add missing imports for kdoc
paulinea Mar 13, 2026
665d53f
Improve bottom sheets demos
paulinea Mar 17, 2026
9b86689
Adjuste OUDS bottom sheets components
paulinea Mar 17, 2026
0bf863f
Add snapshots tests for OudsBottomSheetScaffold
paulinea Mar 17, 2026
71e5ab2
Update strings keys and values
paulinea Mar 23, 2026
e8bcbbe
Review TODO and remove them when possible
paulinea Mar 23, 2026
6557448
Update snapshots
paulinea Mar 23, 2026
0964c9d
Add Arabic translations
paulinea Mar 24, 2026
fb19785
Review: Rename variable
paulinea Apr 1, 2026
685d97e
Review: Remove useless import
paulinea Apr 1, 2026
9304ca1
Review: Remove default parameter in the call of BottomSheetScaffold a…
paulinea Apr 1, 2026
65b80e4
Review: Add modal bottom sheet snapshots
paulinea Apr 2, 2026
ec1c7f6
Review: Remove useless annotations
paulinea Apr 2, 2026
344d4ec
Review: Expose containerColor instead of sheetContainerColor
paulinea Apr 2, 2026
ee1a076
Review: Fix Sosh snapshot by specifying sheetContentColor on BottomSh…
paulinea Apr 2, 2026
b6e0da7
Review: Remove useless fillMaxWidth Modifier
paulinea Apr 2, 2026
1f97f7b
Review: Rename string key
paulinea Apr 2, 2026
89eb0ad
Review: Fix French translation
paulinea Apr 2, 2026
a0d90a0
Review: Refactor to use bottom sheet scaffold naming only for the API
paulinea Apr 2, 2026
cf83c3c
Review: Remove useless imports
paulinea Apr 2, 2026
0e22d88
Review: Set sheetSwipeEnabled to false to prevent swipe interfering w…
paulinea Apr 2, 2026
129742c
Review: Use with to simplify expression
paulinea Apr 2, 2026
d30bedf
Review: Rename sheet state in sheet value
paulinea Apr 2, 2026
60fa419
Review: Rename file
paulinea Apr 2, 2026
f342a1f
Review: Use toNumberString extension for dp format
paulinea Apr 2, 2026
757470d
Review: Remove useless imports
paulinea Apr 2, 2026
7b6ca58
Review: Rename unclear parameter
paulinea Apr 2, 2026
b71ee6c
Review: Rename file and composable to BottomSheetDemoContent
paulinea Apr 2, 2026
3a91589
Review: Rename customization composables
paulinea Apr 2, 2026
3d3147f
Review: Use a non translatable string for peak height suffix
paulinea Apr 2, 2026
7561bea
Review: Remove useless annotation
paulinea Apr 2, 2026
d6416fd
Review: Remove useless bottom padding
paulinea Apr 2, 2026
4df1110
Review: Rename preview
paulinea Apr 2, 2026
a967e1e
Update snapshot in failure
paulinea Apr 2, 2026
dd9d62e
Review: Split bottom sheet snapshot tests into two files
florentmaitre Apr 3, 2026
c4bc8cc
Review: Change default value of container color
florentmaitre Apr 3, 2026
3dec69e
Fix typo
paulinea Apr 7, 2026
ec6db74
Fix drag handle height to match the default peek height
paulinea Apr 7, 2026
0018280
Limit the maximum height of the bottom sheet for long content
paulinea Apr 7, 2026
eb5df4d
Add a button in the bottom sheets to close or collapse the sheet
paulinea Apr 7, 2026
838b410
Update snapshots
paulinea Apr 7, 2026
7e46b1b
Fix typo
florentmaitre Apr 8, 2026
adf6b38
Fix drag handle bottom padding
florentmaitre Apr 9, 2026
dbb3112
Move the maximum height of the bottom sheet for long content in app i…
florentmaitre Apr 9, 2026
149b0b9
Skip partially expand for modal bottom sheet
paulinea Apr 10, 2026
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 @@ -19,6 +19,8 @@ import com.orange.ouds.app.R
import com.orange.ouds.app.ui.components.alert.AlertMessageDemoScreen
import com.orange.ouds.app.ui.components.alert.InlineAlertDemoScreen
import com.orange.ouds.app.ui.components.badge.BadgeDemoScreen
import com.orange.ouds.app.ui.components.bottomsheet.StandardBottomSheetDemoScreen
import com.orange.ouds.app.ui.components.bottomsheet.ModalBottomSheetDemoScreen
import com.orange.ouds.app.ui.components.bulletlist.BulletListDemoScreen
import com.orange.ouds.app.ui.components.button.ButtonDemoScreen
import com.orange.ouds.app.ui.components.checkbox.CheckboxDemoScreen
Expand Down Expand Up @@ -73,6 +75,13 @@ sealed class Component(
demoScreen = { BadgeDemoScreen() }
)

data object BottomSheet : Component(
R.string.app_components_bottomSheet_tech,
R.string.app_components_bottomSheet_description_text,
{ BottomSheetIllustration() },
listOf(Variant.StandardBottomSheet, Variant.ModalBottomSheet)
)

data object BulletList : Component(
R.string.app_components_bulletList_tech,
R.string.app_components_bulletList_description_text,
Expand Down Expand Up @@ -201,6 +210,10 @@ sealed class Variant(
data object AlertMessage : Variant(R.string.app_components_alert_alertMessage_tech, { AlertMessageDemoScreen() })
data object InlineAlert : Variant(R.string.app_components_alert_inlineAlert_tech, { InlineAlertDemoScreen() })

// Bottom sheet
data object StandardBottomSheet : Variant(R.string.app_components_bottomSheet_standardBottomSheet_tech, { StandardBottomSheetDemoScreen() })
data object ModalBottomSheet : Variant(R.string.app_components_bottomSheet_modalBottomSheet_tech, { ModalBottomSheetDemoScreen() })

// Checkbox
data object Checkbox : Variant(R.string.app_components_checkbox_checkbox_tech, { CheckboxDemoScreen() })
data object CheckboxItem : Variant(R.string.app_components_checkbox_checkboxItem_tech, { CheckboxItemDemoScreen() })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.RectangleShape
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.platform.LocalCursorBlinkEnabled
import androidx.compose.ui.platform.LocalDensity
Expand All @@ -40,6 +43,7 @@ import com.orange.ouds.core.component.OudsAlertMessage
import com.orange.ouds.core.component.OudsBadge
import com.orange.ouds.core.component.OudsBadgeSize
import com.orange.ouds.core.component.OudsBadgeStatus
import com.orange.ouds.core.component.OudsBottomSheetScaffold
import com.orange.ouds.core.component.OudsBulletList
import com.orange.ouds.core.component.OudsBulletListType
import com.orange.ouds.core.component.OudsButton
Expand Down Expand Up @@ -87,6 +91,20 @@ fun BadgeIllustration() = ComponentIllustration {
)
}

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun BottomSheetIllustration() = ComponentIllustration {
OudsBottomSheetScaffold(
modifier = Modifier
.clip(RectangleShape)
.padding(horizontal = 16.dp),
sheetPeekHeight = 120.dp,
sheetSwipeEnabled = false,
sheetContent = {},
containerColor = Color.Transparent
) {}
}

@Composable
fun BulletListIllustration() = ComponentIllustration {
val label = stringResource(id = R.string.app_components_common_label_label)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ private fun ComponentsScreen(components: List<Component>, onComponentClick: (Lon
@Composable
private fun PreviewComponentsScreen() = AppPreview {
ComponentsScreen(
components = listOf(Component.Button, Component.BulletList),
components = listOf(Component.Button, Component.BottomSheet),
onComponentClick = {}
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Software Name: OUDS Android
* SPDX-FileCopyrightText: Copyright (c) Orange SA
* SPDX-License-Identifier: MIT
*
* This software is distributed under the MIT license,
* the text of which is available at https://opensource.org/license/MIT/
* or see the "LICENSE" file for more details.
*
* Software description: Android library of reusable graphical components
*/

package com.orange.ouds.app.ui.components.bottomsheet

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.orange.ouds.app.R
import com.orange.ouds.core.component.OudsButton
import com.orange.ouds.core.theme.OudsTheme

@Composable
fun BottomSheetDemoContent(dragHandle: Boolean, buttonLabel: String, onButtonClick: () -> Unit) {
val scrollState = rememberScrollState()
Column(
modifier = Modifier
.verticalScroll(scrollState)
.padding(top = if (dragHandle) 0.dp else OudsTheme.spaces.fixed.medium)
) {
Text(
modifier = Modifier.padding(horizontal = OudsTheme.grids.margin),
text = stringResource(R.string.app_components_bottomSheet_sheetContent_text)
)
OudsButton(
modifier = Modifier.padding(
vertical = OudsTheme.spaces.fixed.medium,
horizontal = OudsTheme.grids.margin
),
label = buttonLabel,
onClick = onButtonClick
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
/*
* Software Name: OUDS Android
* SPDX-FileCopyrightText: Copyright (c) Orange SA
* SPDX-License-Identifier: MIT
*
* This software is distributed under the MIT license,
* the text of which is available at https://opensource.org/license/MIT/
* or see the "LICENSE" file for more details.
*
* Software description: Android library of reusable graphical components
*/

package com.orange.ouds.app.ui.components.bottomsheet

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.rememberModalBottomSheetState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.PreviewLightDark
import com.orange.ouds.app.R
import com.orange.ouds.app.ui.utilities.Code
import com.orange.ouds.app.ui.utilities.composable.AppPreview
import com.orange.ouds.app.ui.utilities.composable.CodeSnippet
import com.orange.ouds.app.ui.utilities.composable.CustomizationSwitchItem
import com.orange.ouds.app.ui.utilities.composable.DetailScreenDescription
import com.orange.ouds.app.ui.utilities.composable.Screen
import com.orange.ouds.app.ui.utilities.consumeTopBarsTopWindowInsets
import com.orange.ouds.app.ui.utilities.topBarsTopPadding
import com.orange.ouds.core.component.OudsButton
import com.orange.ouds.core.component.OudsModalBottomSheet
import com.orange.ouds.core.theme.OudsTheme

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun ModalBottomSheetDemoScreen() {
val state = rememberModalBottomSheetDemoState()
var modalBottomSheetVisible by rememberSaveable { mutableStateOf(false) }
val sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true)
with(state) {
Screen {
Column(
modifier = Modifier
.fillMaxSize()
.verticalScroll(rememberScrollState())
.consumeTopBarsTopWindowInsets()
.padding(top = topBarsTopPadding)
) {
DetailScreenDescription(
modifier = Modifier.padding(horizontal = OudsTheme.grids.margin, vertical = OudsTheme.spaces.fixed.medium),
description = stringResource(id = R.string.app_components_bottomSheet_modalBottomSheet_description_text)
)
ModalBottomSheetDemoCustomization(
state = state,
onButtonClick = { modalBottomSheetVisible = true }
)
CodeSnippet(
modifier = Modifier
.padding(horizontal = OudsTheme.grids.margin, vertical = OudsTheme.spaces.fixed.medium)
.padding(top = OudsTheme.spaces.fixed.medium),
init = { modalBottomSheetDemoCodeSnippet(state = state) }
)
if (modalBottomSheetVisible) {
OudsModalBottomSheet(
dragHandle = dragHandle,
sheetGesturesEnabled = sheetGesturesEnabled,
onDismissRequest = { modalBottomSheetVisible = false },
sheetState = sheetState
) {
BottomSheetDemoContent(
dragHandle = dragHandle,
buttonLabel = stringResource(R.string.app_components_bottomSheet_modalBottomSheet_close_label)
) {
modalBottomSheetVisible = false
}
}
}
}
}
}
}

@Composable
private fun ModalBottomSheetDemoCustomization(state: ModalBottomSheetDemoState, onButtonClick: () -> Unit) {
with(state) {
CustomizationSwitchItem(
label = stringResource(R.string.app_components_bottomSheet_modalBottomSheet_dragHandle_tech),
checked = dragHandle,
onCheckedChange = { dragHandle = it },
)
CustomizationSwitchItem(
label = stringResource(R.string.app_components_bottomSheet_modalBottomSheet_sheetGesturesEnabled_tech),
checked = sheetGesturesEnabled,
onCheckedChange = { sheetGesturesEnabled = it },
)
OudsButton(
modifier = Modifier.padding(horizontal = OudsTheme.grids.margin, vertical = OudsTheme.spaces.fixed.small),
label = "Show bottom sheet",
onClick = onButtonClick
)
}
}

private fun Code.Builder.modalBottomSheetDemoCodeSnippet(state: ModalBottomSheetDemoState) {
functionCall("OudsModalBottomSheet") {
trailingLambda = true
typedArgument("dragHandle", state.dragHandle)
typedArgument("sheetGesturesEnabled", state.sheetGesturesEnabled)
functionCallArgument("sheetState", "rememberModalBottomSheetState")
lambdaArgument("onDismissRequest") {
comment("do something on dismiss")
}
lambdaArgument(null) {
comment("sheet content")
}
}
}

@PreviewLightDark
@Composable
private fun PreviewModalBottomSheetDemoScreen() = AppPreview {
ModalBottomSheetDemoScreen()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Software Name: OUDS Android
* SPDX-FileCopyrightText: Copyright (c) Orange SA
* SPDX-License-Identifier: MIT
*
* This software is distributed under the MIT license,
* the text of which is available at https://opensource.org/license/MIT/
* or see the "LICENSE" file for more details.
*
* Software description: Android library of reusable graphical components
*/

package com.orange.ouds.app.ui.components.bottomsheet

import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.saveable.listSaver
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue

@Composable
fun rememberModalBottomSheetDemoState(
dragHandle: Boolean = true,
sheetGesturesEnabled: Boolean = true
) = rememberSaveable(dragHandle, sheetGesturesEnabled, saver = ModalBottomSheetDemoState.Saver) {
ModalBottomSheetDemoState(dragHandle, sheetGesturesEnabled)
}

class ModalBottomSheetDemoState(
dragHandle: Boolean,
sheetGesturesEnabled: Boolean
) {
companion object {
val Saver = listSaver(
save = { state ->
with(state) {
listOf(
dragHandle,
sheetGesturesEnabled
)
}
},
restore = { list: List<Any?> ->
ModalBottomSheetDemoState(
list[0] as Boolean,
list[1] as Boolean
)
}
)
}

var dragHandle: Boolean by mutableStateOf(dragHandle)
var sheetGesturesEnabled: Boolean by mutableStateOf(sheetGesturesEnabled)
}
Loading