PM-24786: Move radio button to UI module (#5708)

This commit is contained in:
David Perez
2025-08-15 16:14:14 -05:00
committed by GitHub
parent c5663431af
commit 3164c29184
4 changed files with 5 additions and 5 deletions

View File

@@ -15,9 +15,9 @@ import androidx.compose.ui.platform.testTag
import androidx.compose.ui.semantics.selected
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.unit.dp
import com.bitwarden.ui.platform.components.radio.BitwardenRadioButton
import com.bitwarden.ui.platform.theme.BitwardenTheme
import com.bitwarden.ui.util.Text
import com.x8bit.bitwarden.ui.platform.components.radio.BitwardenRadioButton
/**
* A clickable item that displays a radio button and text.

View File

@@ -1,27 +0,0 @@
package com.x8bit.bitwarden.ui.platform.components.radio
import androidx.compose.material3.RadioButton
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import com.x8bit.bitwarden.ui.platform.components.radio.color.bitwardenRadioButtonColors
/**
* A custom Bitwarden-themed radio button.
*
* @param isSelected Whether this radio button is selected or not.
* @param onClick The lambda to be invoked when the item is clicked.
* @param modifier The [Modifier] to be applied to this radio button.
*/
@Composable
fun BitwardenRadioButton(
isSelected: Boolean,
onClick: (() -> Unit)?,
modifier: Modifier = Modifier,
) {
RadioButton(
modifier = modifier,
selected = isSelected,
onClick = onClick,
colors = bitwardenRadioButtonColors(),
)
}

View File

@@ -1,16 +0,0 @@
package com.x8bit.bitwarden.ui.platform.components.radio.color
import androidx.compose.material3.RadioButtonColors
import androidx.compose.runtime.Composable
import com.bitwarden.ui.platform.theme.BitwardenTheme
/**
* Provides a default set of Bitwarden-styled colors for radio buttons.
*/
@Composable
fun bitwardenRadioButtonColors(): RadioButtonColors = RadioButtonColors(
selectedColor = BitwardenTheme.colorScheme.filledButton.background,
unselectedColor = BitwardenTheme.colorScheme.icon.primary,
disabledSelectedColor = BitwardenTheme.colorScheme.filledButton.foregroundDisabled,
disabledUnselectedColor = BitwardenTheme.colorScheme.filledButton.foregroundDisabled,
)

View File

@@ -51,6 +51,7 @@ import com.bitwarden.ui.platform.components.content.BitwardenErrorContent
import com.bitwarden.ui.platform.components.content.BitwardenLoadingContent
import com.bitwarden.ui.platform.components.field.BitwardenTextField
import com.bitwarden.ui.platform.components.model.CardStyle
import com.bitwarden.ui.platform.components.radio.BitwardenRadioButton
import com.bitwarden.ui.platform.components.snackbar.BitwardenSnackbarHost
import com.bitwarden.ui.platform.components.snackbar.rememberBitwardenSnackbarHostState
import com.bitwarden.ui.platform.components.util.rememberVectorPainter
@@ -68,7 +69,6 @@ import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenMasterPassword
import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenOverwritePasskeyConfirmationDialog
import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenPinDialog
import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenTwoButtonDialog
import com.x8bit.bitwarden.ui.platform.components.radio.BitwardenRadioButton
import com.x8bit.bitwarden.ui.platform.components.scaffold.BitwardenScaffold
import com.x8bit.bitwarden.ui.platform.components.text.BitwardenClickableText
import com.x8bit.bitwarden.ui.platform.composition.LocalBiometricsManager