Merge branch 'develop' into feature/fga/permalink_timeline
This commit is contained in:
commit
2c8abbed0c
1157 changed files with 4307 additions and 1899 deletions
|
|
@ -27,7 +27,7 @@ fun RoomPreviewSubtitleAtom(subtitle: String, modifier: Modifier = Modifier) {
|
|||
Text(
|
||||
modifier = modifier,
|
||||
text = subtitle,
|
||||
style = ElementTheme.typography.fontBodyLgRegular,
|
||||
style = ElementTheme.typography.fontBodyMdRegular,
|
||||
textAlign = TextAlign.Center,
|
||||
color = ElementTheme.colors.textSecondary,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -18,17 +18,23 @@ package io.element.android.libraries.designsystem.atomic.atoms
|
|||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.text.font.FontStyle
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
import io.element.android.libraries.designsystem.theme.components.Text
|
||||
|
||||
@Composable
|
||||
fun RoomPreviewTitleAtom(title: String, modifier: Modifier = Modifier) {
|
||||
fun RoomPreviewTitleAtom(
|
||||
title: String,
|
||||
modifier: Modifier = Modifier,
|
||||
fontStyle: FontStyle? = null,
|
||||
) {
|
||||
Text(
|
||||
modifier = modifier,
|
||||
text = title,
|
||||
style = ElementTheme.typography.fontHeadingMdBold,
|
||||
textAlign = TextAlign.Center,
|
||||
fontStyle = fontStyle,
|
||||
color = ElementTheme.colors.textPrimary,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import androidx.compose.foundation.layout.Arrangement
|
|||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.widthIn
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
|
|
@ -42,8 +41,7 @@ fun RoomPreviewMembersCountMolecule(
|
|||
Row(
|
||||
modifier = modifier
|
||||
.background(color = ElementTheme.colors.bgSubtleSecondary, shape = CircleShape)
|
||||
.widthIn(min = 48.dp)
|
||||
.padding(start = 2.dp, end = 6.dp, top = 2.dp, bottom = 2.dp),
|
||||
.padding(start = 2.dp, end = 8.dp, top = 2.dp, bottom = 2.dp),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.spacedBy(4.dp)
|
||||
) {
|
||||
|
|
|
|||
|
|
@ -23,9 +23,11 @@ import androidx.compose.foundation.layout.consumeWindowInsets
|
|||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.unit.dp
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreview
|
||||
|
|
@ -36,6 +38,7 @@ import io.element.android.libraries.designsystem.theme.components.Text
|
|||
/**
|
||||
* @param modifier Classical modifier.
|
||||
* @param paddingValues padding values to apply to the content.
|
||||
* @param containerColor color of the container. Set to [Color.Transparent] if you provide a background in the [modifier].
|
||||
* @param background optional background component.
|
||||
* @param topBar optional topBar.
|
||||
* @param header optional header.
|
||||
|
|
@ -46,6 +49,7 @@ import io.element.android.libraries.designsystem.theme.components.Text
|
|||
fun HeaderFooterPage(
|
||||
modifier: Modifier = Modifier,
|
||||
paddingValues: PaddingValues = PaddingValues(20.dp),
|
||||
containerColor: Color = MaterialTheme.colorScheme.background,
|
||||
background: @Composable () -> Unit = {},
|
||||
topBar: @Composable () -> Unit = {},
|
||||
header: @Composable () -> Unit = {},
|
||||
|
|
@ -55,6 +59,7 @@ fun HeaderFooterPage(
|
|||
Scaffold(
|
||||
modifier = modifier,
|
||||
topBar = topBar,
|
||||
containerColor = containerColor,
|
||||
) { padding ->
|
||||
Box {
|
||||
background()
|
||||
|
|
|
|||
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* Copyright (c) 2024 New Vector Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.element.android.libraries.designsystem.background
|
||||
|
||||
import androidx.compose.foundation.Canvas
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.geometry.center
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.RadialGradientShader
|
||||
import androidx.compose.ui.graphics.ShaderBrush
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreview
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
|
||||
/**
|
||||
* Light gradient background for Join room screens.
|
||||
*/
|
||||
@Composable
|
||||
fun LightGradientBackground(
|
||||
modifier: Modifier = Modifier,
|
||||
backgroundColor: Color = MaterialTheme.colorScheme.background,
|
||||
firstColor: Color = Color(0x1E0DBD8B),
|
||||
secondColor: Color = Color(0x001273EB),
|
||||
ratio: Float = 642 / 775f,
|
||||
) {
|
||||
Canvas(
|
||||
modifier = modifier.fillMaxSize()
|
||||
) {
|
||||
val biggerDimension = size.width * 1.98f
|
||||
val gradientShaderBrush = ShaderBrush(
|
||||
RadialGradientShader(
|
||||
colors = listOf(firstColor, secondColor),
|
||||
center = size.center.copy(x = size.width * ratio, y = size.height * ratio),
|
||||
radius = biggerDimension / 2f,
|
||||
colorStops = listOf(0f, 0.95f)
|
||||
)
|
||||
)
|
||||
drawRect(backgroundColor, size = size)
|
||||
drawRect(brush = gradientShaderBrush, size = size)
|
||||
}
|
||||
}
|
||||
|
||||
@PreviewsDayNight
|
||||
@Composable
|
||||
internal fun LightGradientBackgroundPreview() = ElementPreview {
|
||||
LightGradientBackground()
|
||||
}
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.element.android.libraries.designsystem.components
|
||||
package io.element.android.libraries.designsystem.background
|
||||
|
||||
import androidx.compose.foundation.Canvas
|
||||
import androidx.compose.foundation.layout.Box
|
||||
|
|
@ -31,6 +31,7 @@ import androidx.compose.ui.graphics.LinearGradientShader
|
|||
import androidx.compose.ui.graphics.ShaderBrush
|
||||
import androidx.compose.ui.unit.dp
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
import io.element.android.libraries.designsystem.components.drawWithLayer
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreview
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
|
||||
|
|
@ -108,7 +108,7 @@ fun PageTitle(
|
|||
|
||||
@PreviewsDayNight
|
||||
@Composable
|
||||
internal fun TitleWithIconFullPreview(@PreviewParameter(BigIconStylePreviewProvider::class) style: BigIcon.Style) {
|
||||
internal fun PageTitleWithIconFullPreview(@PreviewParameter(BigIconStylePreviewProvider::class) style: BigIcon.Style) {
|
||||
ElementPreview {
|
||||
PageTitle(
|
||||
modifier = Modifier.padding(top = 24.dp),
|
||||
|
|
@ -124,7 +124,7 @@ internal fun TitleWithIconFullPreview(@PreviewParameter(BigIconStylePreviewProvi
|
|||
|
||||
@PreviewsDayNight
|
||||
@Composable
|
||||
internal fun TitleWithIconMinimalPreview() {
|
||||
internal fun PageTitleWithIconMinimalPreview() {
|
||||
ElementPreview {
|
||||
PageTitle(
|
||||
modifier = Modifier.padding(top = 24.dp),
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ internal fun AsyncIndicatorView(
|
|||
|
||||
@PreviewsDayNight
|
||||
@Composable
|
||||
internal fun AsyncIndicatorView_Loading_Preview() {
|
||||
internal fun AsyncIndicatorLoadingPreview() {
|
||||
ElementPreview {
|
||||
AsyncIndicator.Loading(text = "Loading")
|
||||
}
|
||||
|
|
@ -83,7 +83,7 @@ internal fun AsyncIndicatorView_Loading_Preview() {
|
|||
|
||||
@PreviewsDayNight
|
||||
@Composable
|
||||
internal fun AsyncIndicatorView_Failed_Preview() {
|
||||
internal fun AsyncIndicatorFailurePreview() {
|
||||
ElementPreview {
|
||||
AsyncIndicator.Failure(text = "Failed")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,8 @@ data class AvatarData(
|
|||
val size: AvatarSize,
|
||||
) {
|
||||
val initial by lazy {
|
||||
(name?.takeIf { it.isNotBlank() } ?: id)
|
||||
// For roomIds, use "#" as initial
|
||||
(name?.takeIf { it.isNotBlank() } ?: id.takeIf { !it.startsWith("!") } ?: "#")
|
||||
.let { dn ->
|
||||
var startIndex = 0
|
||||
val initial = dn[startIndex]
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ import io.element.android.libraries.designsystem.theme.components.Text
|
|||
|
||||
@PreviewsDayNight
|
||||
@Composable
|
||||
internal fun UserAvatarPreview() = ElementPreview {
|
||||
internal fun UserAvatarColorsPreview() = ElementPreview {
|
||||
Column(
|
||||
modifier = Modifier.padding(8.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp),
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ internal fun GradientFloatingActionButtonPreview() {
|
|||
|
||||
@PreviewsDayNight
|
||||
@Composable
|
||||
internal fun GradientSendButtonPreview() {
|
||||
internal fun GradientFloatingActionButtonCircleShapePreview() {
|
||||
ElementPreview {
|
||||
Box(modifier = Modifier.padding(20.dp)) {
|
||||
GradientFloatingActionButton(
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ private fun PreferenceTopAppBar(
|
|||
|
||||
@PreviewsDayNight
|
||||
@Composable
|
||||
internal fun PreferenceViewPreview() = ElementPreview {
|
||||
internal fun PreferencePagePreview() = ElementPreview {
|
||||
PreferencePage(
|
||||
title = "Preference screen",
|
||||
onBackPressed = {},
|
||||
|
|
|
|||
|
|
@ -98,11 +98,11 @@ private fun TextFieldDialog(
|
|||
keyboardOptions: KeyboardOptions = KeyboardOptions.Default,
|
||||
) {
|
||||
val focusRequester = remember { FocusRequester() }
|
||||
|
||||
var textFieldContents by rememberSaveable(stateSaver = TextFieldValue.Saver) {
|
||||
mutableStateOf(TextFieldValue(value.orEmpty(), selection = TextRange(value.orEmpty().length)))
|
||||
}
|
||||
var error by rememberSaveable { mutableStateOf<String?>(null) }
|
||||
var canRequestFocus by rememberSaveable { mutableStateOf(false) }
|
||||
val canSubmit by remember { derivedStateOf { validation(textFieldContents.text) } }
|
||||
ListDialog(
|
||||
title = title,
|
||||
|
|
@ -128,10 +128,11 @@ private fun TextFieldDialog(
|
|||
maxLines = maxLines,
|
||||
modifier = Modifier.focusRequester(focusRequester),
|
||||
)
|
||||
canRequestFocus = true
|
||||
}
|
||||
}
|
||||
|
||||
if (autoSelectOnDisplay) {
|
||||
if (autoSelectOnDisplay && canRequestFocus) {
|
||||
LaunchedEffect(Unit) {
|
||||
focusRequester.requestFocus()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ fun WithRulers(
|
|||
|
||||
@PreviewsDayNight
|
||||
@Composable
|
||||
internal fun WithRulerPreview() = ElementPreview {
|
||||
internal fun WithRulersPreview() = ElementPreview {
|
||||
WithRulers(xRulersOffset = 20.dp, yRulersOffset = 15.dp) {
|
||||
OutlinedButton(
|
||||
text = "A Button with rulers on it!",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue