
Vela
Project
package com.composables.vela
import androidx.compose.foundation.background
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateListOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import com.composables.compose.ripple.rememberRippleIndication
import com.composables.vela.components.Button
import com.composables.vela.components.EmptyState
import com.composables.vela.components.Icon
import com.composables.vela.components.IconButton
import com.composables.vela.components.IconButtonSize
import com.composables.vela.components.ModalBottomSheet
import com.composables.vela.components.OptionRow
import com.composables.vela.components.Page
import com.composables.vela.components.SearchField
import com.composables.vela.components.Section
import com.composables.vela.components.Text
import com.composables.vela.components.TextField
import com.composables.vela.theme.CaretRight
import com.composables.vela.theme.ChatCircle
import com.composables.vela.theme.File
import com.composables.vela.theme.Folder
import com.composables.vela.theme.FolderSimplePlus
import com.composables.vela.theme.Icons
import com.composables.vela.theme.Note
import com.composables.vela.theme.Plus
import com.composables.vela.theme.Space
import com.composables.vela.theme.Theme
import com.composables.vela.theme.X
import com.composeunstyled.UnstyledButton
@Composable
fun ProjectsScreen(
navigateBack: () -> Unit,
navigateToProject: (name: String) -> Unit,
navigateToCreateProject: () -> Unit,
modifier: Modifier = Modifier,
) {
var query by remember { mutableStateOf("") }
val matches = sampleProjects.filter {
it.name.contains(query.trim(), ignoreCase = true) ||
it.goal.contains(query.trim(), ignoreCase = true)
}
Page(
title = "Projects",
onBack = navigateBack,
modifier = modifier,
actions = {
IconButton(onClick = navigateToCreateProject, contentDescription = "New project") {
Icon(
Icons.FolderSimplePlus,
contentDescription = null,
modifier = Modifier.size(22.dp),
)
}
},
) {
if (sampleProjects.isEmpty()) {
EmptyState(
Icons.Folder,
title = "No projects yet",
message = "Group chats, files and instructions around one piece of work.",
action = { Button(onClick = navigateToCreateProject) { Text("New project") } },
)
} else {
SearchField(query, { query = it }, placeholder = "Search projects")
Column(verticalArrangement = Arrangement.spacedBy(Space * 2)) {
matches.forEach { project ->
ProjectCard(project, onClick = { navigateToProject(project.name) })
}
if (matches.isEmpty()) {
Text(
"No projects match “${query.trim()}”",
color = Theme.colors.onBackgroundMuted,
modifier = Modifier.padding(Space * 4),
)
}
}
}
}
}
@Composable
private fun ProjectCard(project: SampleProject, onClick: () -> Unit) {
UnstyledButton(
onClick = onClick,
modifier =
Modifier.fillMaxWidth().clip(Theme.shapes.medium).background(Theme.colors.surface),
contentPadding = PaddingValues(Space * 4),
indication = rememberRippleIndication(color = Theme.colors.onSurface),
interactionSource = remember { MutableInteractionSource() },
) {
Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(Space * 3),
) {
Column(Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(Space)) {
Text(project.name, style = Theme.typography.title)
Text(
project.goal,
color = Theme.colors.onBackgroundMuted,
maxLines = 2,
overflow = TextOverflow.Ellipsis,
)
Text(
listOf(
plural(project.chats.size, "chat"),
plural(project.files.size, "file"),
"Updated ${project.updated.lowercase()}",
)
.joinToString(" · "),
style = Theme.typography.caption,
color = Theme.colors.onBackgroundMuted,
)
}
Icon(
Icons.CaretRight,
contentDescription = null,
modifier = Modifier.size(16.dp),
tint = Theme.colors.onBackgroundMuted,
)
}
}
}
private fun plural(count: Int, noun: String) = "$count $noun${if (count == 1) "" else "s"}"
@Composable
fun CreateProjectScreen(
navigateBack: () -> Unit,
navigateToProject: (name: String, goal: String) -> Unit,
modifier: Modifier = Modifier,
) {
var name by remember { mutableStateOf("") }
var goal by remember { mutableStateOf("") }
fun createProject() {
// create the project here
navigateToProject(name.trim(), goal.trim())
}
Page(
title = "New project",
onBack = navigateBack,
backIcon = Icons.X,
backLabel = "Close",
modifier = modifier,
bottomBar = {
Button(
onClick = ::createProject,
enabled = name.isNotBlank(),
modifier = Modifier.fillMaxWidth(),
) {
Text("Create project")
}
},
) {
LabelledField("What are you working on?") {
TextField(name, { name = it }, label = "Project name")
}
LabelledField(
"What are you trying to achieve?",
note = "Vela keeps this in mind in every chat in the project.",
) {
TextField(goal, { goal = it }, label = "Goal", minLines = 3)
}
}
}
@Composable
fun ProjectDetailScreen(
navigateBack: () -> Unit,
navigateToChat: () -> Unit,
modifier: Modifier = Modifier,
name: String = sampleProjects.first().name,
goal: String = "",
) {
fun startChat() {
// start a chat in this project here
navigateToChat()
}
fun openChat(title: String) {
// open the project's chat here
navigateToChat()
}
fun addFiles() {
// pick files to add to the project here
}
val project =
remember(name) {
sampleProjects.firstOrNull { it.name == name }
?: SampleProject(name, goal, "", emptyList(), emptyList(), "Today")
}
var instructions by remember(project) { mutableStateOf(project.instructions) }
var draft by remember { mutableStateOf("") }
var editing by remember { mutableStateOf(false) }
val files = remember(project) { mutableStateListOf(*project.files.toTypedArray()) }
Page(
title = project.name,
onBack = navigateBack,
modifier = modifier,
bottomBar = {
Button(onClick = ::startChat, modifier = Modifier.fillMaxWidth()) {
Text("New chat in project")
}
},
overlay = {
ModalBottomSheet(
visible = editing,
onDismiss = { editing = false },
title = "Instructions",
) {
Text(
"How Vela should work in this project, such as tone, format or sources to prefer.",
color = Theme.colors.onBackgroundMuted,
)
TextField(draft, { draft = it }, label = "Instructions", minLines = 4)
Button(
onClick = {
instructions = draft.trim()
editing = false
},
modifier = Modifier.fillMaxWidth(),
) {
Text("Save instructions")
}
}
},
) {
if (project.goal.isNotBlank()) Text(project.goal, color = Theme.colors.onBackgroundMuted)
Section("Instructions") {
OptionRow(
if (instructions.isBlank()) "Add instructions" else instructions,
onClick = {
draft = instructions
editing = true
},
icon = Icons.Note,
navigates = true,
)
}
Section(
"Files",
footer =
if (files.isEmpty()) "Files you add are available in every chat in this project."
else null,
) {
files.forEach { file ->
Row(
Modifier.fillMaxWidth()
.padding(start = Space * 4, end = Space * 2, top = Space, bottom = Space),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(Space * 3),
) {
Icon(Icons.File, contentDescription = null, modifier = Modifier.size(20.dp))
Column(Modifier.weight(1f)) {
Text(
file.name,
style = Theme.typography.label,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
)
Text(
file.size,
style = Theme.typography.caption,
color = Theme.colors.onBackgroundMuted,
)
}
IconButton(
onClick = { files.remove(file) },
contentDescription = "Remove ${file.name}",
size = IconButtonSize.Small,
) {
Icon(
Icons.X,
contentDescription = null,
modifier = Modifier.size(16.dp),
tint = Theme.colors.onBackgroundMuted,
)
}
}
}
OptionRow("Add files", onClick = ::addFiles, icon = Icons.Plus)
}
if (project.chats.isEmpty()) {
EmptyState(
Icons.ChatCircle,
title = "No chats yet",
message = "Chats you start here use this project's files and instructions.",
)
} else {
Section("Chats") {
project.chats.forEach { chat ->
OptionRow(
chat,
onClick = { openChat(chat) },
icon = Icons.ChatCircle,
navigates = true,
)
}
}
}
}
}
package com.composables.vela
internal object Account {
const val name = "Lex Morgan"
const val nickname = "Lex"
const val email = "[email protected]"
}
internal data class SampleProject(
val name: String,
val goal: String,
val instructions: String,
val files: List<ProjectFile>,
val chats: List<String>,
val updated: String,
)
internal data class ProjectFile(val name: String, val size: String)
internal val sampleProjects =
listOf(
SampleProject(
name = "Thesis research",
goal = "Finish the literature review on urban heat islands by December.",
instructions =
"Cite sources as author and year. Point out where studies disagree instead of averaging them.",
files =
listOf(
ProjectFile("Reading list.pdf", "240 KB"),
ProjectFile("Chapter 2 draft.docx", "88 KB"),
ProjectFile("Survey results.csv", "1.2 MB"),
),
chats =
listOf(
"Summarise Oke 1982",
"Gaps in the cooling studies",
"Outline for chapter 3",
),
updated = "Today",
),
SampleProject(
name = "Kitchen renovation",
goal = "Plan a budget kitchen refit for a small flat.",
instructions = "Prices in euros. Prefer second-hand and modular options.",
files = listOf(ProjectFile("Floor plan.png", "640 KB")),
chats = listOf("Layout ideas for 6 m²", "Worktop materials compared"),
updated = "Yesterday",
),
SampleProject(
name = "Learning Portuguese",
goal = "Hold a 10-minute conversation by the Lisbon trip.",
instructions = "European Portuguese. Correct me gently and explain the rule once.",
files = emptyList(),
chats = listOf("Past tense drills"),
updated = "Last week",
),
)
internal val sampleMemories =
listOf(
"Is writing a thesis on urban heat islands",
"Prefers short answers with a summary first",
"Is learning European Portuguese",
"Lives in a small flat and is renovating the kitchen",
)
internal data class VoiceOption(val name: String, val description: String)
internal val voiceOptions =
listOf(
VoiceOption("Aster", "Calm and clear"),
VoiceOption("Juniper", "Warm and bright"),
VoiceOption("Orion", "Low and steady"),
VoiceOption("Wren", "Quick and light"),
)
internal data class VoiceExchange(val said: String, val reply: String)
internal val voiceExchanges =
listOf(
VoiceExchange(
said = "What's a good way to start the day if I keep checking my phone first thing?",
reply =
"Try leaving your phone outside the bedroom and doing one small thing before you look at it, like making coffee or stepping outside for two minutes.",
),
VoiceExchange(
said = "And if I need it as an alarm?",
reply =
"Then put it across the room on its lowest brightness, and keep a book where the phone used to be. You'll reach for whatever is closest.",
),
)
package com.composables.vela
import androidx.compose.foundation.background
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.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateListOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.unit.dp
import com.composables.vela.components.AlertDialog
import com.composables.vela.components.Avatar
import com.composables.vela.components.Button
import com.composables.vela.components.ButtonVariant
import com.composables.vela.components.Icon
import com.composables.vela.components.IconButton
import com.composables.vela.components.IconButtonSize
import com.composables.vela.components.OptionRow
import com.composables.vela.components.OptionToggle
import com.composables.vela.components.Page
import com.composables.vela.components.Section
import com.composables.vela.components.Text
import com.composables.vela.components.TextField
import com.composables.vela.components.Toast
import com.composables.vela.theme.Bell
import com.composables.vela.theme.CrownSimple
import com.composables.vela.theme.DeviceMobile
import com.composables.vela.theme.DownloadSimple
import com.composables.vela.theme.Icons
import com.composables.vela.theme.LockSimple
import com.composables.vela.theme.SignOut
import com.composables.vela.theme.Space
import com.composables.vela.theme.Sparkle
import com.composables.vela.theme.Theme
import com.composables.vela.theme.Trash
import com.composables.vela.theme.User
import com.composables.vela.theme.Waveform
import com.composables.vela.theme.X
import kotlinx.coroutines.delay
@Composable
fun SettingsScreen(
navigateBack: () -> Unit,
navigateToProfile: () -> Unit,
navigateToPersonalisation: () -> Unit,
navigateToNotifications: () -> Unit,
navigateToPrivacy: () -> Unit,
navigateToUpgrade: () -> Unit,
navigateToWelcome: () -> Unit,
modifier: Modifier = Modifier,
) {
fun signOut() {
// sign out here
navigateToWelcome()
}
val voice = rememberVoicePreferences()
var showVoice by remember { mutableStateOf(false) }
var haptics by remember { mutableStateOf(true) }
var showSignOut by remember { mutableStateOf(false) }
Page(
title = "Settings",
onBack = navigateBack,
backIcon = Icons.X,
backLabel = "Close",
modifier = modifier,
overlay = {
VoiceSettingsSheet(
visible = showVoice,
onDismiss = { showVoice = false },
preferences = voice,
)
AlertDialog(
visible = showSignOut,
title = "Sign out of Vela?",
message = "Your chats stay in your account for when you sign back in.",
onDismissRequest = { showSignOut = false },
) {
Button(
onClick = {
showSignOut = false
signOut()
},
variant = ButtonVariant.Destructive,
modifier = Modifier.fillMaxWidth(),
) {
Text("Sign out")
}
Button(
onClick = { showSignOut = false },
variant = ButtonVariant.Secondary,
modifier = Modifier.fillMaxWidth(),
) {
Text("Cancel")
}
}
},
) {
Row(
Modifier.fillMaxWidth().padding(horizontal = Space * 4),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(Space * 3),
) {
Avatar(Account.nickname)
Column(Modifier.weight(1f)) {
Text(Account.name, style = Theme.typography.title)
Text(Account.email, color = Theme.colors.onBackgroundMuted)
}
}
UpgradeCard(onUpgrade = navigateToUpgrade)
Section("Account") {
OptionRow("Profile", onClick = navigateToProfile, icon = Icons.User, navigates = true)
OptionRow(
"Personalisation and memory",
onClick = navigateToPersonalisation,
icon = Icons.Sparkle,
navigates = true,
)
OptionRow(
"Notifications",
onClick = navigateToNotifications,
icon = Icons.Bell,
navigates = true,
)
OptionRow(
"Privacy and data",
onClick = navigateToPrivacy,
icon = Icons.LockSimple,
navigates = true,
)
}
Section("App") {
OptionRow(
"Voice",
onClick = { showVoice = true },
icon = Icons.Waveform,
value = voice.voice.name,
navigates = true,
)
OptionToggle("Haptic feedback", haptics, { haptics = it }, icon = Icons.DeviceMobile)
}
Section(null, footer = "Vela 1.0") {
OptionRow("Sign out", onClick = { showSignOut = true }, icon = Icons.SignOut)
}
}
}
@Composable
private fun UpgradeCard(onUpgrade: () -> Unit) {
Column(
Modifier.fillMaxWidth()
.clip(Theme.shapes.medium)
.background(Theme.colors.surface)
.padding(Space * 4),
verticalArrangement = Arrangement.spacedBy(Space * 3),
) {
Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(Space * 2),
) {
Icon(
Icons.CrownSimple,
contentDescription = null,
modifier = Modifier.size(20.dp),
tint = Theme.colors.primary,
)
Text("Free plan", style = Theme.typography.label)
}
Text(
"Upgrade for more messages, Vela 4 Pro and projects.",
color = Theme.colors.onBackgroundMuted,
)
Button(onClick = onUpgrade) { Text("Upgrade") }
}
}
@Composable
fun ProfileScreen(
navigateBack: () -> Unit,
navigateToWelcome: () -> Unit,
modifier: Modifier = Modifier,
) {
fun deleteAccount() {
// delete the account here
navigateToWelcome()
}
var name by remember { mutableStateOf(Account.name) }
var nickname by remember { mutableStateOf(Account.nickname) }
var showDelete by remember { mutableStateOf(false) }
Page(
title = "Profile",
onBack = navigateBack,
modifier = modifier,
overlay = {
AlertDialog(
visible = showDelete,
title = "Delete your account?",
message = "This deletes your chats, projects and memories. It can't be undone.",
onDismissRequest = { showDelete = false },
) {
Button(
onClick = {
showDelete = false
deleteAccount()
},
variant = ButtonVariant.Destructive,
modifier = Modifier.fillMaxWidth(),
) {
Text("Delete account")
}
Button(
onClick = { showDelete = false },
variant = ButtonVariant.Secondary,
modifier = Modifier.fillMaxWidth(),
) {
Text("Cancel")
}
}
},
) {
LabelledField("Full name") { TextField(name, { name = it }, label = "Full name") }
LabelledField("What should Vela call you?", note = "Used in greetings and answers.") {
TextField(nickname, { nickname = it }, label = "Nickname")
}
LabelledField("Email", note = "Sign-in codes are sent here.") {
Text(
Account.email,
modifier =
Modifier.fillMaxWidth()
.clip(Theme.shapes.small)
.background(Theme.colors.surfaceVariant)
.padding(horizontal = Space * 4, vertical = Space * 3),
)
}
Section(null) {
OptionRow(
"Delete account",
onClick = { showDelete = true },
icon = Icons.Trash,
destructive = true,
)
}
}
}
@Composable
internal fun LabelledField(label: String, note: String? = null, field: @Composable () -> Unit) {
Column(verticalArrangement = Arrangement.spacedBy(Space * 2)) {
Text(
label,
style = Theme.typography.caption,
color = Theme.colors.onBackgroundMuted,
modifier = Modifier.padding(horizontal = Space * 4),
)
field()
if (note != null)
Text(
note,
style = Theme.typography.caption,
color = Theme.colors.onBackgroundMuted,
modifier = Modifier.padding(horizontal = Space * 4),
)
}
}
@Composable
fun PersonalisationScreen(
navigateBack: () -> Unit,
modifier: Modifier = Modifier,
) {
var instructions by remember {
mutableStateOf(
"Keep answers short and lead with a summary. I'm in Lisbon, so use metric units."
)
}
var useMemories by remember { mutableStateOf(true) }
var useHistory by remember { mutableStateOf(true) }
val memories = remember { mutableStateListOf(*sampleMemories.toTypedArray()) }
var showForgetAll by remember { mutableStateOf(false) }
Page(
title = "Personalisation",
onBack = navigateBack,
modifier = modifier,
overlay = {
AlertDialog(
visible = showForgetAll,
title = "Forget all memories?",
message =
"Vela will stop using what it has learned about you. Your chats are not deleted.",
onDismissRequest = { showForgetAll = false },
) {
Button(
onClick = {
showForgetAll = false
memories.clear()
},
variant = ButtonVariant.Destructive,
modifier = Modifier.fillMaxWidth(),
) {
Text("Forget all")
}
Button(
onClick = { showForgetAll = false },
variant = ButtonVariant.Secondary,
modifier = Modifier.fillMaxWidth(),
) {
Text("Cancel")
}
}
},
) {
LabelledField("How should Vela respond?", note = "Applies to new chats.") {
TextField(
instructions,
{ instructions = it },
label = "Custom instructions",
minLines = 4,
)
}
Section("Memory") {
OptionToggle(
"Use saved memories",
useMemories,
{ useMemories = it },
description = "Vela remembers useful details you share",
)
OptionToggle(
"Use chat history",
useHistory,
{ useHistory = it },
description = "Vela can refer to your recent chats",
)
}
Section(
"Saved memories",
footer = if (memories.isEmpty()) "Vela hasn't saved anything yet." else null,
) {
memories.forEach { memory ->
Row(
Modifier.fillMaxWidth()
.padding(start = Space * 4, end = Space * 2, top = Space, bottom = Space),
verticalAlignment = Alignment.CenterVertically,
) {
Text(memory, modifier = Modifier.weight(1f))
IconButton(
onClick = { memories.remove(memory) },
contentDescription = "Forget “$memory”",
size = IconButtonSize.Small,
) {
Icon(
Icons.X,
contentDescription = null,
modifier = Modifier.size(16.dp),
tint = Theme.colors.onBackgroundMuted,
)
}
}
}
}
if (memories.isNotEmpty()) {
Section(null) {
OptionRow(
"Forget all memories",
onClick = { showForgetAll = true },
icon = Icons.Trash,
destructive = true,
)
}
}
}
}
@Composable
fun NotificationSettingsScreen(
navigateBack: () -> Unit,
modifier: Modifier = Modifier,
) {
var responses by remember { mutableStateOf(true) }
var tasks by remember { mutableStateOf(true) }
var updates by remember { mutableStateOf(false) }
Page(title = "Notifications", onBack = navigateBack, modifier = modifier) {
Section("Chats", footer = "Only for answers that finish while Vela is in the background.") {
OptionToggle(
"Finished responses",
responses,
{ responses = it },
description = "When a long answer is ready",
)
OptionToggle(
"Reminders you ask for",
tasks,
{ tasks = it },
description = "Such as “remind me at six”",
)
}
Section("From Vela") {
OptionToggle(
"Product updates",
updates,
{ updates = it },
description = "New models and features, a few times a year",
)
}
}
}
@Composable
fun PrivacyScreen(
navigateBack: () -> Unit,
modifier: Modifier = Modifier,
) {
fun exportData() {
// request a copy of the person's data here
}
fun deleteAllChats() {
// delete every chat here
}
var improve by remember { mutableStateOf(false) }
var history by remember { mutableStateOf(true) }
var showDelete by remember { mutableStateOf(false) }
var toast by remember { mutableStateOf<String?>(null) }
LaunchedEffect(toast) {
if (toast != null) {
delay(2000)
toast = null
}
}
Page(
title = "Privacy and data",
onBack = navigateBack,
modifier = modifier,
overlay = {
Toast(
toast != null,
toast.orEmpty(),
Modifier.align(Alignment.TopCenter).padding(top = 96.dp),
)
AlertDialog(
visible = showDelete,
title = "Delete all chats?",
message =
"Every chat, including those in projects, is deleted. Projects, files and memories stay.",
onDismissRequest = { showDelete = false },
) {
Button(
onClick = {
showDelete = false
deleteAllChats()
toast = "All chats deleted"
},
variant = ButtonVariant.Destructive,
modifier = Modifier.fillMaxWidth(),
) {
Text("Delete all")
}
Button(
onClick = { showDelete = false },
variant = ButtonVariant.Secondary,
modifier = Modifier.fillMaxWidth(),
) {
Text("Cancel")
}
}
},
) {
Section("Your chats") {
OptionToggle(
"Save chat history",
history,
{ history = it },
description = "Turned off, new chats are deleted after 30 days",
)
OptionToggle(
"Help improve Vela",
improve,
{ improve = it },
description = "Allow your chats to be used for training",
)
}
Section("Your data") {
OptionRow(
"Export data",
onClick = {
exportData()
toast = "We'll email you a download link"
},
icon = Icons.DownloadSimple,
description = "A copy of your chats and settings",
)
OptionRow(
"Delete all chats",
onClick = { showDelete = true },
icon = Icons.Trash,
destructive = true,
)
}
}
}
package com.composables.vela
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
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 com.composables.vela.components.ChoiceTile
import com.composables.vela.components.ModalBottomSheet
import com.composables.vela.components.OptionRow
import com.composables.vela.components.Section
import com.composables.vela.components.Text
import com.composables.vela.theme.Space
import com.composables.vela.theme.Theme
internal class VoicePreferences {
var voice by mutableStateOf(voiceOptions.first())
var speed by mutableStateOf("Normal")
var handsFree by mutableStateOf(true)
}
@Composable
internal fun rememberVoicePreferences() =
rememberSaveable(
saver =
androidx.compose.runtime.saveable.Saver<VoicePreferences, List<Any>>(
save = { listOf(it.voice.name, it.speed, it.handsFree) },
restore = { saved ->
VoicePreferences().apply {
voice = voiceOptions.first { option -> option.name == saved[0] }
speed = saved[1] as String
handsFree = saved[2] as Boolean
}
},
)
) {
VoicePreferences()
}
private val speeds = listOf("Slower", "Normal", "Faster")
@Composable
internal fun VoiceSettingsSheet(
visible: Boolean,
onDismiss: () -> Unit,
preferences: VoicePreferences,
) {
ModalBottomSheet(visible = visible, onDismiss = onDismiss, title = "Voice") {
Section("Voice") {
voiceOptions.forEach { option ->
OptionRow(
option.name,
onClick = { preferences.voice = option },
description = option.description,
selected = preferences.voice == option,
)
}
}
Text("Speed", style = Theme.typography.caption, color = Theme.colors.onBackgroundMuted)
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(Space * 2)) {
speeds.forEach { speed ->
ChoiceTile(
selected = preferences.speed == speed,
onClick = { preferences.speed = speed },
modifier = Modifier.weight(1f),
) {
Text(speed, style = Theme.typography.label)
}
}
}
Section("Listening") {
OptionRow(
"Hands-free",
onClick = { preferences.handsFree = true },
description = "Vela answers when you pause",
selected = preferences.handsFree,
)
OptionRow(
"Tap to talk",
onClick = { preferences.handsFree = false },
description = "Tap the microphone to start and again to send",
selected = !preferences.handsFree,
)
}
}
}
package com.composables.vela.components
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.animation.scaleIn
import androidx.compose.animation.scaleOut
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.widthIn
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import com.composables.vela.theme.ProvideContentColor
import com.composables.vela.theme.Space
import com.composables.vela.theme.Theme
import com.composeunstyled.DialogPanel
import com.composeunstyled.Scrim
import com.composeunstyled.UnstyledDialog
@Composable
fun AlertDialog(
visible: Boolean,
title: String,
message: String,
onDismissRequest: () -> Unit,
modifier: Modifier = Modifier,
actions: @Composable ColumnScope.() -> Unit,
) {
UnstyledDialog(
visible = visible,
onDismissRequest = onDismissRequest,
overlay = {
Scrim(scrimColor = Color.Black.copy(alpha = 0.6f), enter = fadeIn(), exit = fadeOut())
},
) {
Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
DialogPanel(
modifier =
modifier
.padding(Space * 6)
.widthIn(max = 400.dp)
.clip(Theme.shapes.large)
.background(Theme.colors.surface),
paneTitle = title,
enter = scaleIn(initialScale = 0.94f) + fadeIn(),
exit = scaleOut(targetScale = 0.94f) + fadeOut(),
) {
ProvideContentColor(Theme.colors.onSurface) {
Column(Modifier.padding(Space * 6)) {
Text(title, style = Theme.typography.title)
Text(
message,
color = Theme.colors.onBackgroundMuted,
modifier = Modifier.padding(top = Space * 2),
)
Column(
Modifier.fillMaxWidth().padding(top = Space * 6),
verticalArrangement = Arrangement.spacedBy(Space * 2),
content = actions,
)
}
}
}
}
}
}
package com.composables.vela.components
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.WindowInsetsSides
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.only
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.safeDrawing
import androidx.compose.foundation.layout.statusBars
import androidx.compose.foundation.layout.union
import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.layout.Layout
import androidx.compose.ui.unit.Constraints
import androidx.compose.ui.unit.dp
import com.composables.vela.theme.ProvideTextStyle
import com.composables.vela.theme.Space
import com.composables.vela.theme.Theme
@Composable
fun AppBar(
modifier: Modifier = Modifier,
navigation: @Composable () -> Unit = {},
title: @Composable () -> Unit = {},
actions: @Composable RowScope.() -> Unit = {},
) {
val gap = Space * 2
Layout(
content = {
Box { navigation() }
Box { ProvideTextStyle(Theme.typography.title, title) }
Row(
horizontalArrangement = Arrangement.spacedBy(Space),
verticalAlignment = Alignment.CenterVertically,
) {
actions()
}
},
modifier =
modifier
.fillMaxWidth()
.background(Theme.colors.background)
.blockTouchesToContentBehind()
.windowInsetsPadding(
WindowInsets.statusBars.union(
WindowInsets.safeDrawing.only(WindowInsetsSides.Horizontal)
)
)
.height(56.dp)
.padding(horizontal = Space * 2),
) { (navigationSlot, titleSlot, actionsSlot), constraints ->
val loose = constraints.copy(minWidth = 0, minHeight = 0)
val navigationPlaceable = navigationSlot.measure(loose)
val actionsPlaceable = actionsSlot.measure(loose)
val side = maxOf(navigationPlaceable.width, actionsPlaceable.width) + gap.roundToPx()
val titleWidth = (constraints.maxWidth - side * 2).coerceAtLeast(0)
val titlePlaceable =
titleSlot.measure(Constraints(maxWidth = titleWidth, maxHeight = constraints.maxHeight))
val height = constraints.maxHeight
layout(constraints.maxWidth, height) {
navigationPlaceable.place(0, (height - navigationPlaceable.height) / 2)
titlePlaceable.place(
(constraints.maxWidth - titlePlaceable.width) / 2,
(height - titlePlaceable.height) / 2,
)
actionsPlaceable.place(
constraints.maxWidth - actionsPlaceable.width,
(height - actionsPlaceable.height) / 2,
)
}
}
}
private fun Modifier.blockTouchesToContentBehind() = pointerInput(Unit) {}
package com.composables.vela.components
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.size
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.semantics.clearAndSetSemantics
import androidx.compose.ui.unit.dp
import com.composables.vela.theme.Theme
@Composable
fun Avatar(
name: String,
modifier: Modifier = Modifier,
) {
Box(
modifier
.size(32.dp)
.clip(Theme.shapes.fullyRounded)
.background(Theme.colors.primary)
.clearAndSetSemantics {},
contentAlignment = Alignment.Center,
) {
Text(
name.take(1).uppercase(),
style = Theme.typography.label,
color = Theme.colors.onPrimary,
)
}
}
package com.composables.vela.components
import androidx.compose.foundation.background
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import com.composables.compose.ripple.rememberRippleIndication
import com.composables.vela.theme.ProvideContentColor
import com.composables.vela.theme.ProvideTextStyle
import com.composables.vela.theme.Space
import com.composables.vela.theme.Theme
import com.composeunstyled.UnstyledButton
enum class ButtonVariant {
Primary,
Secondary,
Destructive,
Ghost,
}
@Composable
fun Button(
onClick: () -> Unit,
modifier: Modifier = Modifier,
enabled: Boolean = true,
variant: ButtonVariant = ButtonVariant.Primary,
content: @Composable () -> Unit,
) {
val (container, contentColor) =
when (variant) {
ButtonVariant.Secondary -> Theme.colors.surfaceVariant to Theme.colors.onSurfaceVariant
ButtonVariant.Destructive -> Theme.colors.destructive to Theme.colors.onDestructive
ButtonVariant.Ghost -> Color.Transparent to Theme.colors.primary
else -> Theme.colors.primary to Theme.colors.onPrimary
}
UnstyledButton(
onClick = onClick,
enabled = enabled,
modifier =
modifier
.alpha(if (enabled) 1f else 0.4f)
.clip(Theme.shapes.fullyRounded)
.background(container),
contentPadding = PaddingValues(horizontal = Space * 5, vertical = Space * 3),
indication = rememberRippleIndication(color = contentColor),
interactionSource = remember { MutableInteractionSource() },
) {
ProvideContentColor(contentColor) { ProvideTextStyle(Theme.typography.label, content) }
}
}
package com.composables.vela.components
import androidx.compose.animation.animateColorAsState
import androidx.compose.animation.core.tween
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.selection.selectable
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.unit.dp
import com.composables.compose.ripple.rememberRippleIndication
import com.composables.vela.theme.Space
import com.composables.vela.theme.Theme
@Composable
fun ChoiceTile(
selected: Boolean,
onClick: () -> Unit,
modifier: Modifier = Modifier,
contentPadding: PaddingValues = PaddingValues(Space * 3),
content: @Composable ColumnScope.() -> Unit,
) {
val outline by
animateColorAsState(
if (selected) Theme.colors.primary else Theme.colors.border,
tween(160),
label = "Outline",
)
Column(
modifier
.clip(Theme.shapes.small)
.background(if (selected) Theme.colors.surfaceVariant else Theme.colors.surface)
.border(if (selected) 2.dp else 1.dp, outline, Theme.shapes.small)
.selectable(
selected = selected,
onClick = onClick,
role = Role.RadioButton,
interactionSource = remember { MutableInteractionSource() },
indication = rememberRippleIndication(color = Theme.colors.onSurface),
)
.padding(contentPadding),
verticalArrangement = Arrangement.spacedBy(Space),
content = content,
)
}
package com.composables.vela.components
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import com.composables.vela.theme.Space
import com.composables.vela.theme.Theme
@Composable
fun EmptyState(
icon: ImageVector,
title: String,
message: String,
modifier: Modifier = Modifier,
action: (@Composable () -> Unit)? = null,
) {
Column(
modifier.fillMaxWidth().padding(horizontal = Space * 6, vertical = Space * 10),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.spacedBy(Space * 3),
) {
Box(
Modifier.size(56.dp)
.clip(Theme.shapes.fullyRounded)
.background(Theme.colors.surfaceVariant),
contentAlignment = Alignment.Center,
) {
Icon(
icon,
contentDescription = null,
modifier = Modifier.size(26.dp),
tint = Theme.colors.primary,
)
}
Text(title, style = Theme.typography.title.copy(textAlign = TextAlign.Center))
Text(
message,
color = Theme.colors.onBackgroundMuted,
style = Theme.typography.body.copy(textAlign = TextAlign.Center),
)
if (action != null) Box(Modifier.padding(top = Space * 2)) { action() }
}
}
package com.composables.vela.components
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.isSpecified
import androidx.compose.ui.graphics.vector.ImageVector
import com.composables.vela.theme.LocalContentColor
import com.composeunstyled.UnstyledIcon
@Composable
fun Icon(
imageVector: ImageVector,
contentDescription: String?,
modifier: Modifier = Modifier,
tint: Color = LocalContentColor.current,
) {
val resolvedTint = if (tint.isSpecified) tint else LocalContentColor.current
UnstyledIcon(
imageVector = imageVector,
contentDescription = contentDescription,
modifier = modifier,
tint = resolvedTint,
)
}
package com.composables.vela.components
import androidx.compose.foundation.background
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.size
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.unit.dp
import com.composables.compose.ripple.rememberRippleIndication
import com.composables.vela.theme.LocalContentColor
import com.composables.vela.theme.ProvideContentColor
import com.composables.vela.theme.Theme
import com.composeunstyled.UnstyledButton
enum class IconButtonVariant {
Ghost,
Filled,
Tonal,
}
enum class IconButtonSize {
Small,
Medium,
}
@Composable
fun IconButton(
onClick: () -> Unit,
contentDescription: String,
modifier: Modifier = Modifier,
enabled: Boolean = true,
variant: IconButtonVariant = IconButtonVariant.Ghost,
size: IconButtonSize = IconButtonSize.Medium,
content: @Composable () -> Unit,
) {
val (container, contentColor) =
when {
variant == IconButtonVariant.Filled && !enabled ->
Theme.colors.surfaceVariant to Theme.colors.onBackgroundMuted
variant == IconButtonVariant.Filled -> Theme.colors.primary to Theme.colors.onPrimary
variant == IconButtonVariant.Tonal ->
Theme.colors.surfaceVariant to Theme.colors.onSurfaceVariant
else -> Color.Transparent to LocalContentColor.current
}
UnstyledButton(
onClick = onClick,
enabled = enabled,
modifier =
modifier
.alpha(if (enabled || variant == IconButtonVariant.Filled) 1f else 0.4f)
.size(if (size == IconButtonSize.Small) 32.dp else 40.dp)
.clip(Theme.shapes.fullyRounded)
.background(container)
.semantics { this.contentDescription = contentDescription },
indication = rememberRippleIndication(color = contentColor),
interactionSource = remember { MutableInteractionSource() },
) {
ProvideContentColor(contentColor, content)
}
}
package com.composables.vela.components
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.WindowInsetsSides
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.ime
import androidx.compose.foundation.layout.navigationBars
import androidx.compose.foundation.layout.only
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.safeDrawing
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.statusBars
import androidx.compose.foundation.layout.union
import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import com.composables.vela.theme.Icons
import com.composables.vela.theme.ProvideContentColor
import com.composables.vela.theme.Space
import com.composables.vela.theme.Theme
import com.composables.vela.theme.X
import com.composeunstyled.DrawerPlacement
import com.composeunstyled.DrawerPresentation
import com.composeunstyled.DrawerSnapPoint
import com.composeunstyled.DrawerSnapPoints
import com.composeunstyled.Overlay
import com.composeunstyled.Panel
import com.composeunstyled.UnstyledDrawer
import com.composeunstyled.UnstyledDrawerState
import com.composeunstyled.Viewport
@Composable
fun ModalBottomSheet(
visible: Boolean,
onDismiss: () -> Unit,
title: String,
modifier: Modifier = Modifier,
content: @Composable ColumnScope.() -> Unit,
) {
val drawer = remember {
UnstyledDrawerState(
initialValue = if (visible) SheetPosition.Open else SheetPosition.Closed,
snapPoints =
DrawerSnapPoints {
SheetPosition.Closed at DrawerSnapPoint.Zero
SheetPosition.Open at DrawerSnapPoint.ContentSize
},
)
}
LaunchedEffect(visible) {
drawer.targetValue = if (visible) SheetPosition.Open else SheetPosition.Closed
}
val shape = RoundedCornerShape(topStart = 28.dp, topEnd = 28.dp)
UnstyledDrawer(
state = drawer,
modifier = modifier,
placement = DrawerPlacement.Bottom,
// Modal opens above the side drawer and lets drags that start outside the panel move it.
presentation = DrawerPresentation.Modal,
dismissOnClickOutside = true,
onDismissed = { onDismiss() },
overlay = {
Overlay(
Modifier.fillMaxSize().background(Color.Black.copy(alpha = 0.6f)),
enter = fadeIn(),
exit = fadeOut(),
)
},
) {
// The overlay draws inside the viewport, so the viewport stays edge to edge and the panel
// keeps clear of the status bar.
Viewport(Modifier.fillMaxSize()) {
Panel(
Modifier.windowInsetsPadding(WindowInsets.statusBars)
.padding(top = Space * 2)
.widthIn(max = 640.dp)
.fillMaxWidth()
.clip(shape)
.background(Theme.colors.surface)
.windowInsetsPadding(
WindowInsets.navigationBars
.union(WindowInsets.ime)
.union(WindowInsets.safeDrawing.only(WindowInsetsSides.Horizontal))
)
) {
// Unstyled keeps a closed sheet laid out, so its content would stay reachable by
// screen readers.
val showContent =
visible ||
drawer.currentValue != SheetPosition.Closed ||
drawer.targetValue != SheetPosition.Closed
if (showContent)
ProvideContentColor(Theme.colors.onSurface) {
Column(Modifier.fillMaxWidth()) {
Box(
Modifier.align(Alignment.CenterHorizontally)
.padding(top = Space * 2)
.size(width = 36.dp, height = 4.dp)
.clip(Theme.shapes.fullyRounded)
.background(Theme.colors.border)
)
Box(
Modifier.fillMaxWidth()
.padding(horizontal = Space * 3, vertical = Space * 2)
) {
IconButton(
onClick = onDismiss,
contentDescription = "Close",
variant = IconButtonVariant.Tonal,
size = IconButtonSize.Small,
modifier = Modifier.align(Alignment.CenterStart),
) {
Icon(
Icons.X,
contentDescription = null,
modifier = Modifier.size(16.dp),
)
}
Text(
title,
style = Theme.typography.title,
modifier = Modifier.align(Alignment.Center),
)
}
Column(
Modifier.fillMaxWidth()
.heightIn(max = 560.dp)
.verticalScroll(rememberScrollState())
.padding(
start = Space * 4,
end = Space * 4,
top = Space,
bottom = Space * 6,
),
verticalArrangement = Arrangement.spacedBy(Space * 3),
content = content,
)
}
}
}
}
}
}
private enum class SheetPosition {
Closed,
Open,
}
package com.composables.vela.components
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import com.composables.vela.theme.ProvideContentColor
import com.composables.vela.theme.Theme
@Composable
fun OptionGroup(
modifier: Modifier = Modifier,
content: @Composable ColumnScope.() -> Unit,
) {
Column(
modifier.fillMaxWidth().clip(Theme.shapes.medium).background(Theme.colors.surfaceVariant)
) {
ProvideContentColor(Theme.colors.onSurfaceVariant) { content() }
}
}
package com.composables.vela.components
import androidx.compose.foundation.background
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.semantics.selected
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.unit.dp
import com.composables.compose.ripple.rememberRippleIndication
import com.composables.vela.theme.CaretRight
import com.composables.vela.theme.Check
import com.composables.vela.theme.Icons
import com.composables.vela.theme.LocalContentColor
import com.composables.vela.theme.ProvideContentColor
import com.composables.vela.theme.Space
import com.composables.vela.theme.Theme
import com.composeunstyled.UnstyledButton
@Composable
fun OptionRow(
title: String,
onClick: () -> Unit,
modifier: Modifier = Modifier,
description: String? = null,
icon: ImageVector? = null,
badge: String? = null,
selected: Boolean = false,
enabled: Boolean = true,
destructive: Boolean = false,
value: String? = null,
navigates: Boolean = false,
) {
UnstyledButton(
onClick = onClick,
enabled = enabled,
modifier =
modifier.fillMaxWidth().alpha(if (enabled) 1f else 0.45f).semantics {
this.selected = selected
},
contentPadding = PaddingValues(horizontal = Space * 4, vertical = Space * 3),
contentAlignment = Alignment.CenterStart,
indication = rememberRippleIndication(color = LocalContentColor.current),
interactionSource = remember { MutableInteractionSource() },
) {
if (destructive)
ProvideContentColor(Theme.colors.destructive) {
OptionLayout(title, description, icon, badge) {}
}
else
OptionLayout(title, description, icon, badge) {
if (value != null)
Text(
value,
style = Theme.typography.caption,
color = Theme.colors.onBackgroundMuted,
maxLines = 1,
)
if (selected)
Icon(
Icons.Check,
contentDescription = null,
modifier = Modifier.size(20.dp),
tint = Theme.colors.primary,
)
if (navigates)
Icon(
Icons.CaretRight,
contentDescription = null,
modifier = Modifier.size(16.dp),
tint = Theme.colors.onBackgroundMuted,
)
}
}
}
@Composable
internal fun OptionLayout(
title: String,
description: String?,
icon: ImageVector?,
badge: String?,
modifier: Modifier = Modifier,
trailing: @Composable () -> Unit,
) {
Row(
modifier.fillMaxWidth(),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(Space * 3),
) {
if (icon != null) Icon(icon, contentDescription = null, modifier = Modifier.size(20.dp))
Column(Modifier.weight(1f)) {
Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(Space * 2),
) {
Text(title, style = Theme.typography.label)
if (badge != null) {
Text(
badge,
style = Theme.typography.caption,
color = Theme.colors.onPrimary,
modifier =
Modifier.clip(Theme.shapes.fullyRounded)
.background(Theme.colors.primary)
.padding(horizontal = Space * 2, vertical = 1.dp),
)
}
}
if (description != null)
Text(
description,
style = Theme.typography.caption,
color = Theme.colors.onBackgroundMuted,
)
}
trailing()
}
}
package com.composables.vela.components
import androidx.compose.animation.animateColorAsState
import androidx.compose.animation.core.tween
import androidx.compose.foundation.background
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.unit.dp
import com.composables.compose.ripple.rememberRippleIndication
import com.composables.vela.theme.LocalContentColor
import com.composables.vela.theme.Space
import com.composables.vela.theme.Theme
import com.composeunstyled.Thumb
import com.composeunstyled.Track
import com.composeunstyled.UnstyledSwitch
@Composable
fun OptionToggle(
title: String,
checked: Boolean,
onCheckedChange: (Boolean) -> Unit,
modifier: Modifier = Modifier,
description: String? = null,
icon: ImageVector? = null,
) {
val track by
animateColorAsState(
if (checked) Theme.colors.primary else Theme.colors.border,
tween(180),
label = "Track",
)
val thumb by
animateColorAsState(
if (checked) Theme.colors.onPrimary else Theme.colors.onBackgroundMuted,
tween(180),
label = "Thumb",
)
UnstyledSwitch(
checked = checked,
onCheckedChange = onCheckedChange,
modifier = modifier.fillMaxWidth(),
interactionSource = remember { MutableInteractionSource() },
indication = rememberRippleIndication(color = LocalContentColor.current),
accessibilityLabel = title,
) {
OptionLayout(
title,
description,
icon,
badge = null,
modifier = Modifier.padding(horizontal = Space * 4, vertical = Space * 3),
) {
Track(
Modifier.size(width = 44.dp, height = 26.dp)
.clip(Theme.shapes.fullyRounded)
.background(track)
) {
Thumb(
animationSpec = tween(180),
modifier =
Modifier.padding(4.dp)
.size(18.dp)
.clip(Theme.shapes.fullyRounded)
.background(thumb),
)
}
}
}
}
package com.composables.vela.components
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxScope
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.WindowInsetsSides
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.ime
import androidx.compose.foundation.layout.navigationBars
import androidx.compose.foundation.layout.only
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.safeDrawing
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.union
import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.unit.dp
import com.composables.vela.theme.CaretLeft
import com.composables.vela.theme.Icons
import com.composables.vela.theme.Space
internal val PageWidth = 640.dp
@Composable
fun Page(
title: String,
onBack: () -> Unit,
modifier: Modifier = Modifier,
backIcon: ImageVector = Icons.CaretLeft,
backLabel: String = "Back",
actions: @Composable RowScope.() -> Unit = {},
bottomBar: (@Composable () -> Unit)? = null,
overlay: @Composable BoxScope.() -> Unit = {},
content: @Composable ColumnScope.() -> Unit,
) {
val horizontalSafe = WindowInsets.safeDrawing.only(WindowInsetsSides.Horizontal)
ScreenScaffold(modifier) {
Column(Modifier.fillMaxSize()) {
AppBar(
navigation = {
IconButton(onClick = onBack, contentDescription = backLabel) {
Icon(backIcon, contentDescription = null, modifier = Modifier.size(22.dp))
}
},
title = { Text(title, maxLines = 1) },
actions = actions,
)
Box(Modifier.weight(1f).fillMaxWidth(), contentAlignment = Alignment.TopCenter) {
Column(
Modifier.fillMaxSize()
.verticalScroll(rememberScrollState())
.windowInsetsPadding(
horizontalSafe.union(
if (bottomBar == null) WindowInsets.navigationBars
else WindowInsets.safeDrawing.only(WindowInsetsSides.Horizontal)
)
)
.padding(horizontal = Space * 4, vertical = Space * 2)
.padding(bottom = Space * 6),
horizontalAlignment = Alignment.CenterHorizontally,
) {
Column(
Modifier.widthIn(max = PageWidth).fillMaxWidth(),
verticalArrangement = Arrangement.spacedBy(Space * 6),
content = content,
)
}
}
if (bottomBar != null) {
Box(
Modifier.fillMaxWidth()
.windowInsetsPadding(
WindowInsets.navigationBars
.union(WindowInsets.ime)
.union(horizontalSafe)
)
.padding(horizontal = Space * 4, vertical = Space * 3),
contentAlignment = Alignment.Center,
) {
Box(Modifier.widthIn(max = PageWidth).fillMaxWidth()) { bottomBar() }
}
}
}
overlay()
}
}
package com.composables.vela.components
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxScope
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.luminance
import com.composables.systembars.SystemBarContent
import com.composables.systembars.SystemBars
import com.composables.vela.theme.ProvideContentColor
import com.composables.vela.theme.Theme
import com.composeunstyled.DialogHost
@Composable
fun ScreenScaffold(
modifier: Modifier = Modifier,
content: @Composable BoxScope.() -> Unit,
) {
SystemBars(all = systemBarContentOn(Theme.colors.background))
DialogHost(modifier.fillMaxSize()) {
Box(Modifier.fillMaxSize().background(Theme.colors.background)) {
ProvideContentColor(Theme.colors.onBackground) { content() }
}
}
}
private fun systemBarContentOn(background: Color): SystemBarContent =
if (background.luminance() > 0.5f) SystemBarContent.Dark else SystemBarContent.Light
package com.composables.vela.components
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.text.BasicTextField
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.unit.dp
import com.composables.vela.theme.Icons
import com.composables.vela.theme.MagnifyingGlass
import com.composables.vela.theme.Space
import com.composables.vela.theme.Theme
import com.composables.vela.theme.X
@Composable
fun SearchField(
value: String,
onValueChange: (String) -> Unit,
placeholder: String,
modifier: Modifier = Modifier,
) {
Row(
modifier
.fillMaxWidth()
.clip(Theme.shapes.fullyRounded)
.background(Theme.colors.surfaceVariant)
.padding(start = Space * 4, end = Space),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(Space * 2),
) {
Icon(
Icons.MagnifyingGlass,
contentDescription = null,
modifier = Modifier.size(18.dp),
tint = Theme.colors.onBackgroundMuted,
)
BasicTextField(
value = value,
onValueChange = onValueChange,
modifier = Modifier.weight(1f).semantics { contentDescription = placeholder },
textStyle = Theme.typography.body.copy(color = Theme.colors.onSurfaceVariant),
cursorBrush = SolidColor(Theme.colors.primary),
singleLine = true,
decorationBox = { field ->
Box(Modifier.padding(vertical = Space * 2.5f)) {
if (value.isEmpty()) Text(placeholder, color = Theme.colors.onBackgroundMuted)
field()
}
},
)
if (value.isNotEmpty()) {
IconButton(
onClick = { onValueChange("") },
contentDescription = "Clear search",
size = IconButtonSize.Small,
) {
Icon(
Icons.X,
contentDescription = null,
modifier = Modifier.size(14.dp),
tint = Theme.colors.onBackgroundMuted,
)
}
}
}
}
package com.composables.vela.components
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.semantics.heading
import androidx.compose.ui.semantics.semantics
import com.composables.vela.theme.Space
import com.composables.vela.theme.Theme
@Composable
fun Section(
title: String?,
modifier: Modifier = Modifier,
footer: String? = null,
content: @Composable ColumnScope.() -> Unit,
) {
Column(modifier.fillMaxWidth(), verticalArrangement = Arrangement.spacedBy(Space * 2)) {
if (title != null) {
Text(
title,
style = Theme.typography.caption,
color = Theme.colors.onBackgroundMuted,
modifier = Modifier.padding(horizontal = Space * 4).semantics { heading() },
)
}
OptionGroup(content = content)
if (footer != null) {
Text(
footer,
style = Theme.typography.caption,
color = Theme.colors.onBackgroundMuted,
modifier = Modifier.padding(horizontal = Space * 4),
)
}
}
}
package com.composables.vela.components
import androidx.compose.foundation.text.BasicText
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.isSpecified
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.style.TextOverflow
import com.composables.vela.theme.LocalContentColor
import com.composables.vela.theme.LocalTextStyle
@Composable
fun Text(
text: String,
modifier: Modifier = Modifier,
color: Color = Color.Unspecified,
style: TextStyle = LocalTextStyle.current,
overflow: TextOverflow = TextOverflow.Clip,
softWrap: Boolean = true,
maxLines: Int = Int.MAX_VALUE,
) {
val resolvedColor =
when {
color.isSpecified -> color
style.color.isSpecified -> style.color
else -> LocalContentColor.current
}
BasicText(
text = text,
modifier = modifier,
style = LocalTextStyle.current.merge(style).copy(color = resolvedColor),
overflow = overflow,
softWrap = softWrap,
maxLines = maxLines,
)
}
package com.composables.vela.components
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.interaction.collectIsFocusedAsState
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.text.BasicTextField
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.TextRange
import androidx.compose.ui.text.input.TextFieldValue
import androidx.compose.ui.unit.dp
import com.composables.vela.theme.Space
import com.composables.vela.theme.Theme
@Composable
fun TextField(
value: String,
onValueChange: (String) -> Unit,
label: String,
modifier: Modifier = Modifier,
minLines: Int = 1,
) {
val interactionSource = remember { MutableInteractionSource() }
val focused by interactionSource.collectIsFocusedAsState()
var field by remember { mutableStateOf(TextFieldValue(value, TextRange(value.length))) }
if (field.text != value) field = TextFieldValue(value, TextRange(value.length))
BasicTextField(
value = field,
onValueChange = {
field = it
if (it.text != value) onValueChange(it.text)
},
modifier =
modifier
.fillMaxWidth()
.clip(Theme.shapes.small)
.background(Theme.colors.surfaceVariant)
.border(
1.dp,
if (focused) Theme.colors.primary else Theme.colors.border,
Theme.shapes.small,
)
.semantics { contentDescription = label },
textStyle = Theme.typography.body.copy(color = Theme.colors.onSurfaceVariant),
cursorBrush = SolidColor(Theme.colors.primary),
singleLine = minLines == 1,
minLines = minLines,
interactionSource = interactionSource,
decorationBox = { field ->
Box(Modifier.padding(horizontal = Space * 4, vertical = Space * 3)) {
if (value.isEmpty()) Text(label, color = Theme.colors.onBackgroundMuted)
field()
}
},
)
}
package com.composables.vela.components
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.animation.slideInVertically
import androidx.compose.animation.slideOutVertically
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.semantics.LiveRegionMode
import androidx.compose.ui.semantics.liveRegion
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.unit.dp
import com.composables.vela.theme.CheckCircle
import com.composables.vela.theme.Icons
import com.composables.vela.theme.Space
import com.composables.vela.theme.Theme
@Composable
fun Toast(
visible: Boolean,
message: String,
modifier: Modifier = Modifier,
) {
var lastMessage by remember { mutableStateOf(message) }
if (visible && message.isNotEmpty()) lastMessage = message
AnimatedVisibility(
visible = visible,
modifier = modifier,
enter = slideInVertically { -it } + fadeIn(),
exit = slideOutVertically { -it } + fadeOut(),
) {
Row(
Modifier.clip(Theme.shapes.fullyRounded)
.background(Theme.colors.surfaceVariant)
.border(1.dp, Theme.colors.border, Theme.shapes.fullyRounded)
.padding(horizontal = Space * 4, vertical = Space * 2.5f)
.semantics { liveRegion = LiveRegionMode.Polite },
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(Space * 2),
) {
Icon(
Icons.CheckCircle,
contentDescription = null,
modifier = Modifier.size(18.dp),
tint = Theme.colors.primary,
)
Text(lastMessage, style = Theme.typography.label, color = Theme.colors.onSurfaceVariant)
}
}
}
package com.composables.vela.theme
/*
* Icons from Phosphor Icons (https://phosphoricons.com), Regular and Fill weights.
* License: MIT
*
* MIT License
*
* Copyright (c) 2023 Phosphor Icons
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* VelaMark is Vela's own four-point star.
*/
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.addPathNodes
import androidx.compose.ui.unit.dp
object Icons
private fun phosphor(name: String, pathData: String) = icon(name, 256f, pathData)
private fun icon(name: String, viewport: Float, pathData: String) =
ImageVector.Builder(
name = name,
defaultWidth = 24.dp,
defaultHeight = 24.dp,
viewportWidth = viewport,
viewportHeight = viewport,
)
.addPath(pathData = addPathNodes(pathData), fill = SolidColor(Color.Black))
.build()
val Icons.VelaMark: ImageVector
get() = _velaMark
private val _velaMark by lazy {
icon(
"vela-mark",
24f,
"M12,2C12.9,8.2 15.8,11.1 22,12C15.8,12.9 12.9,15.8 12,22C11.1,15.8 8.2,12.9 2,12C8.2,11.1 11.1,8.2 12,2Z",
)
}
val Icons.Menu: ImageVector
get() = _menu
private val _menu by lazy {
phosphor(
"list",
"M224,128a8,8,0,0,1-8,8H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128ZM40,72H216a8,8,0,0,0,0-16H40a8,8,0,0,0,0,16ZM216,184H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Z",
)
}
val Icons.NotePencil: ImageVector
get() = _notePencil
private val _notePencil by lazy {
phosphor(
"note-pencil",
"M229.66,58.34l-32-32a8,8,0,0,0-11.32,0l-96,96A8,8,0,0,0,88,128v32a8,8,0,0,0,8,8h32a8,8,0,0,0,5.66-2.34l96-96A8,8,0,0,0,229.66,58.34ZM124.69,152H104V131.31l64-64L188.69,88ZM200,76.69,179.31,56,192,43.31,212.69,64ZM224,128v80a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V48A16,16,0,0,1,48,32h80a8,8,0,0,1,0,16H48V208H208V128a8,8,0,0,1,16,0Z",
)
}
val Icons.Plus: ImageVector
get() = _plus
private val _plus by lazy {
phosphor(
"plus",
"M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z",
)
}
val Icons.ArrowUp: ImageVector
get() = _arrowUp
private val _arrowUp by lazy {
phosphor(
"arrow-up",
"M205.66,117.66a8,8,0,0,1-11.32,0L136,59.31V216a8,8,0,0,1-16,0V59.31L61.66,117.66a8,8,0,0,1-11.32-11.32l72-72a8,8,0,0,1,11.32,0l72,72A8,8,0,0,1,205.66,117.66Z",
)
}
val Icons.Stop: ImageVector
get() = _stop
private val _stop by lazy {
phosphor(
"stop",
"M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z",
)
}
val Icons.Microphone: ImageVector
get() = _microphone
private val _microphone by lazy {
phosphor(
"microphone",
"M128,176a48.05,48.05,0,0,0,48-48V64a48,48,0,0,0-96,0v64A48.05,48.05,0,0,0,128,176ZM96,64a32,32,0,0,1,64,0v64a32,32,0,0,1-64,0Zm40,143.6V240a8,8,0,0,1-16,0V207.6A80.11,80.11,0,0,1,48,128a8,8,0,0,1,16,0,64,64,0,0,0,128,0,8,8,0,0,1,16,0A80.11,80.11,0,0,1,136,207.6Z",
)
}
val Icons.Copy: ImageVector
get() = _copy
private val _copy by lazy {
phosphor(
"copy",
"M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32ZM160,208H48V96H160Zm48-48H176V88a8,8,0,0,0-8-8H96V48H208Z",
)
}
val Icons.SpeakerHigh: ImageVector
get() = _speakerHigh
private val _speakerHigh by lazy {
phosphor(
"speaker-high",
"M155.51,24.81a8,8,0,0,0-8.42.88L77.25,80H32A16,16,0,0,0,16,96v64a16,16,0,0,0,16,16H77.25l69.84,54.31A8,8,0,0,0,160,224V32A8,8,0,0,0,155.51,24.81ZM32,96H72v64H32ZM144,207.64,88,164.09V91.91l56-43.55Zm54-106.08a40,40,0,0,1,0,52.88,8,8,0,0,1-12-10.58,24,24,0,0,0,0-31.72,8,8,0,0,1,12-10.58ZM248,128a79.9,79.9,0,0,1-20.37,53.34,8,8,0,0,1-11.92-10.67,64,64,0,0,0,0-85.33,8,8,0,1,1,11.92-10.67A79.83,79.83,0,0,1,248,128Z",
)
}
val Icons.ThumbsUp: ImageVector
get() = _thumbsUp
private val _thumbsUp by lazy {
phosphor(
"thumbs-up",
"M234,80.12A24,24,0,0,0,216,72H160V56a40,40,0,0,0-40-40,8,8,0,0,0-7.16,4.42L75.06,96H32a16,16,0,0,0-16,16v88a16,16,0,0,0,16,16H204a24,24,0,0,0,23.82-21l12-96A24,24,0,0,0,234,80.12ZM32,112H72v88H32ZM223.94,97l-12,96a8,8,0,0,1-7.94,7H88V105.89l36.71-73.43A24,24,0,0,1,144,56V80a8,8,0,0,0,8,8h64a8,8,0,0,1,7.94,9Z",
)
}
val Icons.ThumbsUpFill: ImageVector
get() = _thumbsUpFill
private val _thumbsUpFill by lazy {
phosphor(
"thumbs-up",
"M234,80.12A24,24,0,0,0,216,72H160V56a40,40,0,0,0-40-40,8,8,0,0,0-7.16,4.42L75.06,96H32a16,16,0,0,0-16,16v88a16,16,0,0,0,16,16H204a24,24,0,0,0,23.82-21l12-96A24,24,0,0,0,234,80.12ZM32,112H72v88H32Z",
)
}
val Icons.ThumbsDown: ImageVector
get() = _thumbsDown
private val _thumbsDown by lazy {
phosphor(
"thumbs-down",
"M239.82,157l-12-96A24,24,0,0,0,204,40H32A16,16,0,0,0,16,56v88a16,16,0,0,0,16,16H75.06l37.78,75.58A8,8,0,0,0,120,240a40,40,0,0,0,40-40V184h56a24,24,0,0,0,23.82-27ZM72,144H32V56H72Zm150,21.29a7.88,7.88,0,0,1-6,2.71H152a8,8,0,0,0-8,8v24a24,24,0,0,1-19.29,23.54L88,150.11V56H204a8,8,0,0,1,7.94,7l12,96A7.87,7.87,0,0,1,222,165.29Z",
)
}
val Icons.ThumbsDownFill: ImageVector
get() = _thumbsDownFill
private val _thumbsDownFill by lazy {
phosphor(
"thumbs-down",
"M239.82,157l-12-96A24,24,0,0,0,204,40H32A16,16,0,0,0,16,56v88a16,16,0,0,0,16,16H75.06l37.78,75.58A8,8,0,0,0,120,240a40,40,0,0,0,40-40V184h56a24,24,0,0,0,23.82-27ZM72,144H32V56H72Z",
)
}
val Icons.ArrowClockwise: ImageVector
get() = _arrowClockwise
private val _arrowClockwise by lazy {
phosphor(
"arrow-clockwise",
"M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1,0-16H211.4L184.81,71.64l-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,0,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60L224,85.8V56a8,8,0,1,1,16,0Z",
)
}
val Icons.Export: ImageVector
get() = _export
private val _export by lazy {
phosphor(
"export",
"M216,112v96a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V112A16,16,0,0,1,56,96H80a8,8,0,0,1,0,16H56v96H200V112H176a8,8,0,0,1,0-16h24A16,16,0,0,1,216,112ZM93.66,69.66,120,43.31V136a8,8,0,0,0,16,0V43.31l26.34,26.35a8,8,0,0,0,11.32-11.32l-40-40a8,8,0,0,0-11.32,0l-40,40A8,8,0,0,0,93.66,69.66Z",
)
}
val Icons.ArrowDown: ImageVector
get() = _arrowDown
private val _arrowDown by lazy {
phosphor(
"arrow-down",
"M205.66,149.66l-72,72a8,8,0,0,1-11.32,0l-72-72a8,8,0,0,1,11.32-11.32L120,196.69V40a8,8,0,0,1,16,0V196.69l58.34-58.35a8,8,0,0,1,11.32,11.32Z",
)
}
val Icons.X: ImageVector
get() = _x
private val _x by lazy {
phosphor(
"x",
"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z",
)
}
val Icons.Check: ImageVector
get() = _check
private val _check by lazy {
phosphor(
"check",
"M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z",
)
}
val Icons.CaretDown: ImageVector
get() = _caretDown
private val _caretDown by lazy {
phosphor(
"caret-down",
"M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z",
)
}
val Icons.CaretRight: ImageVector
get() = _caretRight
private val _caretRight by lazy {
phosphor(
"caret-right",
"M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z",
)
}
val Icons.Camera: ImageVector
get() = _camera
private val _camera by lazy {
phosphor(
"camera",
"M208,56H180.28L166.65,35.56A8,8,0,0,0,160,32H96a8,8,0,0,0-6.65,3.56L75.71,56H48A24,24,0,0,0,24,80V192a24,24,0,0,0,24,24H208a24,24,0,0,0,24-24V80A24,24,0,0,0,208,56Zm8,136a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V80a8,8,0,0,1,8-8H80a8,8,0,0,0,6.66-3.56L100.28,48h55.43l13.63,20.44A8,8,0,0,0,176,72h32a8,8,0,0,1,8,8ZM128,88a44,44,0,1,0,44,44A44.05,44.05,0,0,0,128,88Zm0,72a28,28,0,1,1,28-28A28,28,0,0,1,128,160Z",
)
}
val Icons.Image: ImageVector
get() = _image
private val _image by lazy {
phosphor(
"image",
"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40Zm0,16V158.75l-26.07-26.06a16,16,0,0,0-22.63,0l-20,20-44-44a16,16,0,0,0-22.62,0L40,149.37V56ZM40,172l52-52,80,80H40Zm176,28H194.63l-36-36,20-20L216,181.38V200ZM144,100a12,12,0,1,1,12,12A12,12,0,0,1,144,100Z",
)
}
val Icons.File: ImageVector
get() = _file
private val _file by lazy {
phosphor(
"file",
"M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160ZM200,216H56V40h88V88a8,8,0,0,0,8,8h48V216Z",
)
}
val Icons.Globe: ImageVector
get() = _globe
private val _globe by lazy {
phosphor(
"globe",
"M128,24h0A104,104,0,1,0,232,128,104.12,104.12,0,0,0,128,24Zm88,104a87.61,87.61,0,0,1-3.33,24H174.16a157.44,157.44,0,0,0,0-48h38.51A87.61,87.61,0,0,1,216,128ZM102,168H154a115.11,115.11,0,0,1-26,45A115.27,115.27,0,0,1,102,168Zm-3.9-16a140.84,140.84,0,0,1,0-48h59.88a140.84,140.84,0,0,1,0,48ZM40,128a87.61,87.61,0,0,1,3.33-24H81.84a157.44,157.44,0,0,0,0,48H43.33A87.61,87.61,0,0,1,40,128ZM154,88H102a115.11,115.11,0,0,1,26-45A115.27,115.27,0,0,1,154,88Zm52.33,0H170.71a135.28,135.28,0,0,0-22.3-45.6A88.29,88.29,0,0,1,206.37,88ZM107.59,42.4A135.28,135.28,0,0,0,85.29,88H49.63A88.29,88.29,0,0,1,107.59,42.4ZM49.63,168H85.29a135.28,135.28,0,0,0,22.3,45.6A88.29,88.29,0,0,1,49.63,168Zm98.78,45.6a135.28,135.28,0,0,0,22.3-45.6h35.66A88.29,88.29,0,0,1,148.41,213.6Z",
)
}
val Icons.Lightbulb: ImageVector
get() = _lightbulb
private val _lightbulb by lazy {
phosphor(
"lightbulb",
"M176,232a8,8,0,0,1-8,8H88a8,8,0,0,1,0-16h80A8,8,0,0,1,176,232Zm40-128a87.55,87.55,0,0,1-33.64,69.21A16.24,16.24,0,0,0,176,186v6a16,16,0,0,1-16,16H96a16,16,0,0,1-16-16v-6a16,16,0,0,0-6.23-12.66A87.59,87.59,0,0,1,40,104.49C39.74,56.83,78.26,17.14,125.88,16A88,88,0,0,1,216,104Zm-16,0a72,72,0,0,0-73.74-72c-39,.92-70.47,33.39-70.26,72.39a71.65,71.65,0,0,0,27.64,56.3A32,32,0,0,1,96,186v6h64v-6a32.15,32.15,0,0,1,12.47-25.35A71.65,71.65,0,0,0,200,104Zm-16.11-9.34a57.6,57.6,0,0,0-46.56-46.55,8,8,0,0,0-2.66,15.78c16.57,2.79,30.63,16.85,33.44,33.45A8,8,0,0,0,176,104a9,9,0,0,0,1.35-.11A8,8,0,0,0,183.89,94.66Z",
)
}
val Icons.CheckCircle: ImageVector
get() = _checkCircle
private val _checkCircle by lazy {
phosphor(
"check-circle",
"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm45.66,85.66-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35a8,8,0,0,1,11.32,11.32Z",
)
}
val Icons.MagnifyingGlass: ImageVector
get() = _magnifyingGlass
private val _magnifyingGlass by lazy {
phosphor(
"magnifying-glass",
"M229.66,218.34l-50.07-50.06a88.11,88.11,0,1,0-11.31,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z",
)
}
val Icons.DotsThree: ImageVector
get() = _dotsThree
private val _dotsThree by lazy {
phosphor(
"dots-three",
"M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128Zm56-12a12,12,0,1,0,12,12A12,12,0,0,0,196,116ZM60,116a12,12,0,1,0,12,12A12,12,0,0,0,60,116Z",
)
}
val Icons.PencilSimple: ImageVector
get() = _pencilSimple
private val _pencilSimple by lazy {
phosphor(
"pencil-simple",
"M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z",
)
}
val Icons.PushPin: ImageVector
get() = _pushPin
private val _pushPin by lazy {
phosphor(
"push-pin",
"M235.32,81.37,174.63,20.69a16,16,0,0,0-22.63,0L98.37,74.49c-10.66-3.34-35-7.37-60.4,13.14a16,16,0,0,0-1.29,23.78L85,159.71,42.34,202.34a8,8,0,0,0,11.32,11.32L96.29,171l48.29,48.29A16,16,0,0,0,155.9,224c.38,0,.75,0,1.13,0a15.93,15.93,0,0,0,11.64-6.33c19.64-26.1,17.75-47.32,13.19-60L235.33,104A16,16,0,0,0,235.32,81.37ZM224,92.69h0l-57.27,57.46a8,8,0,0,0-1.49,9.22c9.46,18.93-1.8,38.59-9.34,48.62L48,100.08c12.08-9.74,23.64-12.31,32.48-12.31A40.13,40.13,0,0,1,96.81,91a8,8,0,0,0,9.25-1.51L163.32,32,224,92.68Z",
)
}
val Icons.PushPinSlash: ImageVector
get() = _pushPinSlash
private val _pushPinSlash by lazy {
phosphor(
"push-pin-slash",
"M53.92,34.62A8,8,0,1,0,42.08,45.38L67.37,73.2A69.82,69.82,0,0,0,38,87.63a16,16,0,0,0-1.29,23.78L85,159.71,42.34,202.34a8,8,0,0,0,11.32,11.32L96.29,171l48.29,48.29A16,16,0,0,0,155.9,224c.38,0,.75,0,1.13,0a15.93,15.93,0,0,0,11.64-6.33,89.75,89.75,0,0,0,11.58-20.27l21.84,24a8,8,0,1,0,11.84-10.76ZM155.9,208,48,100.08C58.23,91.83,69.2,87.72,80.66,87.81l87.16,95.88C165.59,193.56,160.24,202.23,155.9,208Zm79.42-104-44.64,44.79a8,8,0,1,1-11.33-11.3L224,92.7,163.32,32,122.1,73.35a8,8,0,0,1-11.33-11.29L152,20.7a16,16,0,0,1,22.63,0l60.69,60.68A16,16,0,0,1,235.32,104Z",
)
}
val Icons.Trash: ImageVector
get() = _trash
private val _trash by lazy {
phosphor(
"trash",
"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z",
)
}
val Icons.Ghost: ImageVector
get() = _ghost
private val _ghost by lazy {
phosphor(
"ghost",
"M112,116a12,12,0,1,1-12-12A12,12,0,0,1,112,116Zm44-12a12,12,0,1,0,12,12A12,12,0,0,0,156,104Zm68,16v96a8,8,0,0,1-13.07,6.19l-24.26-19.85L162.4,222.19a8,8,0,0,1-10.13,0L128,202.34l-24.27,19.85a8,8,0,0,1-10.13,0L69.33,202.34,45.07,222.19A8,8,0,0,1,32,216V120a96,96,0,0,1,192,0Zm-16,0a80,80,0,0,0-160,0v79.12l16.27-13.31a8,8,0,0,1,10.13,0l24.27,19.85,24.26-19.85a8,8,0,0,1,10.14,0l24.26,19.85,24.27-19.85a8,8,0,0,1,10.13,0L208,199.12Z",
)
}
val Icons.Waveform: ImageVector
get() = _waveform
private val _waveform by lazy {
phosphor(
"waveform",
"M56,96v64a8,8,0,0,1-16,0V96a8,8,0,0,1,16,0ZM88,24a8,8,0,0,0-8,8V224a8,8,0,0,0,16,0V32A8,8,0,0,0,88,24Zm40,32a8,8,0,0,0-8,8V192a8,8,0,0,0,16,0V64A8,8,0,0,0,128,56Zm40,32a8,8,0,0,0-8,8v64a8,8,0,0,0,16,0V96A8,8,0,0,0,168,88Zm40-16a8,8,0,0,0-8,8v96a8,8,0,0,0,16,0V80A8,8,0,0,0,208,72Z",
)
}
val Icons.User: ImageVector
get() = _user
private val _user by lazy {
phosphor(
"user",
"M230.92,212c-15.23-26.33-38.7-45.21-66.09-54.16a72,72,0,1,0-73.66,0C63.78,166.78,40.31,185.66,25.08,212a8,8,0,1,0,13.85,8c18.84-32.56,52.14-52,89.07-52s70.23,19.44,89.07,52a8,8,0,1,0,13.85-8ZM72,96a56,56,0,1,1,56,56A56.06,56.06,0,0,1,72,96Z",
)
}
val Icons.Sparkle: ImageVector
get() = _sparkle
private val _sparkle by lazy {
phosphor(
"sparkle",
"M197.58,129.06,146,110l-19-51.62a15.92,15.92,0,0,0-29.88,0L78,110l-51.62,19a15.92,15.92,0,0,0,0,29.88L78,178l19,51.62a15.92,15.92,0,0,0,29.88,0L146,178l51.62-19a15.92,15.92,0,0,0,0-29.88ZM137,164.22a8,8,0,0,0-4.74,4.74L112,223.85,91.78,169A8,8,0,0,0,87,164.22L32.15,144,87,123.78A8,8,0,0,0,91.78,119L112,64.15,132.22,119a8,8,0,0,0,4.74,4.74L191.85,144ZM144,40a8,8,0,0,1,8-8h16V16a8,8,0,0,1,16,0V32h16a8,8,0,0,1,0,16H184V64a8,8,0,0,1-16,0V48H152A8,8,0,0,1,144,40ZM248,88a8,8,0,0,1-8,8h-8v8a8,8,0,0,1-16,0V96h-8a8,8,0,0,1,0-16h8V72a8,8,0,0,1,16,0v8h8A8,8,0,0,1,248,88Z",
)
}
val Icons.Bell: ImageVector
get() = _bell
private val _bell by lazy {
phosphor(
"bell",
"M221.8,175.94C216.25,166.38,208,139.33,208,104a80,80,0,1,0-160,0c0,35.34-8.26,62.38-13.81,71.94A16,16,0,0,0,48,200H88.81a40,40,0,0,0,78.38,0H208a16,16,0,0,0,13.8-24.06ZM128,216a24,24,0,0,1-22.62-16h45.24A24,24,0,0,1,128,216ZM48,184c7.7-13.24,16-43.92,16-80a64,64,0,1,1,128,0c0,36.05,8.28,66.73,16,80Z",
)
}
val Icons.LockSimple: ImageVector
get() = _lockSimple
private val _lockSimple by lazy {
phosphor(
"lock-simple",
"M208,80H176V56a48,48,0,0,0-96,0V80H48A16,16,0,0,0,32,96V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V96A16,16,0,0,0,208,80ZM96,56a32,32,0,0,1,64,0V80H96ZM208,208H48V96H208V208Z",
)
}
val Icons.SignOut: ImageVector
get() = _signOut
private val _signOut by lazy {
phosphor(
"sign-out",
"M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40a8,8,0,0,0-11.32,11.32L204.69,120H112a8,8,0,0,0,0,16h92.69l-26.35,26.34a8,8,0,0,0,11.32,11.32l40-40A8,8,0,0,0,229.66,122.34Z",
)
}
val Icons.Folder: ImageVector
get() = _folder
private val _folder by lazy {
phosphor(
"folder",
"M216,72H131.31L104,44.69A15.86,15.86,0,0,0,92.69,40H40A16,16,0,0,0,24,56V200.62A15.4,15.4,0,0,0,39.38,216H216.89A15.13,15.13,0,0,0,232,200.89V88A16,16,0,0,0,216,72ZM40,56H92.69l16,16H40ZM216,200H40V88H216Z",
)
}
val Icons.FolderSimplePlus: ImageVector
get() = _folderSimplePlus
private val _folderSimplePlus by lazy {
phosphor(
"folder-simple-plus",
"M216,72H130.67L102.93,51.2a16.12,16.12,0,0,0-9.6-3.2H40A16,16,0,0,0,24,64V200a16,16,0,0,0,16,16H216.89A15.13,15.13,0,0,0,232,200.89V88A16,16,0,0,0,216,72Zm0,128H40V64H93.33L123.2,86.4A8,8,0,0,0,128,88h88Zm-56-56a8,8,0,0,1-8,8H136v16a8,8,0,0,1-16,0V152H104a8,8,0,0,1,0-16h16V120a8,8,0,0,1,16,0v16h16A8,8,0,0,1,160,144Z",
)
}
val Icons.Sun: ImageVector
get() = _sun
private val _sun by lazy {
phosphor(
"sun",
"M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm72,88a64,64,0,1,1-64-64A64.07,64.07,0,0,1,192,128Zm-16,0a48,48,0,1,0-48,48A48.05,48.05,0,0,0,176,128ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z",
)
}
val Icons.Moon: ImageVector
get() = _moon
private val _moon by lazy {
phosphor(
"moon",
"M233.54,142.23a8,8,0,0,0-8-2,88.08,88.08,0,0,1-109.8-109.8,8,8,0,0,0-10-10,104.84,104.84,0,0,0-52.91,37A104,104,0,0,0,136,224a103.09,103.09,0,0,0,62.52-20.88,104.84,104.84,0,0,0,37-52.91A8,8,0,0,0,233.54,142.23ZM188.9,190.34A88,88,0,0,1,65.66,67.11a89,89,0,0,1,31.4-26A106,106,0,0,0,96,56,104.11,104.11,0,0,0,200,160a106,106,0,0,0,14.92-1.06A89,89,0,0,1,188.9,190.34Z",
)
}
val Icons.DeviceMobile: ImageVector
get() = _deviceMobile
private val _deviceMobile by lazy {
phosphor(
"device-mobile",
"M176,16H80A24,24,0,0,0,56,40V216a24,24,0,0,0,24,24h96a24,24,0,0,0,24-24V40A24,24,0,0,0,176,16ZM72,64H184V192H72Zm8-32h96a8,8,0,0,1,8,8v8H72V40A8,8,0,0,1,80,32Zm96,192H80a8,8,0,0,1-8-8v-8H184v8A8,8,0,0,1,176,224Z",
)
}
val Icons.AppleLogo: ImageVector
get() = _appleLogo
private val _appleLogo by lazy {
phosphor(
"apple-logo",
"M223.3,169.59a8.07,8.07,0,0,0-2.8-3.4C203.53,154.53,200,134.64,200,120c0-17.67,13.47-33.06,21.5-40.67a8,8,0,0,0,0-11.62C208.82,55.74,187.82,48,168,48a72.2,72.2,0,0,0-40,12.13,71.56,71.56,0,0,0-90.71,9.09A74.63,74.63,0,0,0,16,123.4a127.06,127.06,0,0,0,40.14,89.73A39.8,39.8,0,0,0,83.59,224h87.68a39.84,39.84,0,0,0,29.12-12.57,125,125,0,0,0,17.82-24.6C225.23,174,224.33,172,223.3,169.59Zm-34.63,30.94a23.76,23.76,0,0,1-17.4,7.47H83.59a23.82,23.82,0,0,1-16.44-6.51A111.14,111.14,0,0,1,32,123,58.5,58.5,0,0,1,48.65,80.47,54.81,54.81,0,0,1,88,64h.78A55.45,55.45,0,0,1,123,76.28a8,8,0,0,0,10,0A55.44,55.44,0,0,1,168,64a70.64,70.64,0,0,1,36,10.35c-13,14.52-20,30.47-20,45.65,0,23.77,7.64,42.73,22.18,55.3A105.82,105.82,0,0,1,188.67,200.53ZM128.23,30A40,40,0,0,1,167,0h1a8,8,0,0,1,0,16h-1a24,24,0,0,0-23.24,18,8,8,0,1,1-15.5-4Z",
)
}
val Icons.GoogleLogo: ImageVector
get() = _googleLogo
private val _googleLogo by lazy {
phosphor(
"google-logo",
"M224,128a96,96,0,1,1-21.95-61.09,8,8,0,1,1-12.33,10.18A80,80,0,1,0,207.6,136H128a8,8,0,0,1,0-16h88A8,8,0,0,1,224,128Z",
)
}
val Icons.EnvelopeSimple: ImageVector
get() = _envelopeSimple
private val _envelopeSimple by lazy {
phosphor(
"envelope-simple",
"M224,48H32a8,8,0,0,0-8,8V192a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A8,8,0,0,0,224,48ZM203.43,64,128,133.15,52.57,64ZM216,192H40V74.19l82.59,75.71a8,8,0,0,0,10.82,0L216,74.19V192Z",
)
}
val Icons.CaretLeft: ImageVector
get() = _caretLeft
private val _caretLeft by lazy {
phosphor(
"caret-left",
"M165.66,202.34a8,8,0,0,1-11.32,11.32l-80-80a8,8,0,0,1,0-11.32l80-80a8,8,0,0,1,11.32,11.32L91.31,128Z",
)
}
val Icons.MicrophoneSlash: ImageVector
get() = _microphoneSlash
private val _microphoneSlash by lazy {
phosphor(
"microphone-slash",
"M213.92,218.62l-160-176A8,8,0,0,0,42.08,53.38L80,95.09V128a48,48,0,0,0,69.11,43.12l11.1,12.2A63.41,63.41,0,0,1,128,192a64.07,64.07,0,0,1-64-64,8,8,0,0,0-16,0,80.11,80.11,0,0,0,72,79.6V240a8,8,0,0,0,16,0V207.59a78.83,78.83,0,0,0,35.16-12.22l30.92,34a8,8,0,1,0,11.84-10.76ZM128,160a32,32,0,0,1-32-32V112.69l41.66,45.82A32,32,0,0,1,128,160Zm57.52-3.91A63.32,63.32,0,0,0,192,128a8,8,0,0,1,16,0,79.16,79.16,0,0,1-8.11,35.12,8,8,0,0,1-7.19,4.49,7.88,7.88,0,0,1-3.51-.82A8,8,0,0,1,185.52,156.09ZM84,44.87A48,48,0,0,1,176,64v64a49.19,49.19,0,0,1-.26,5,8,8,0,0,1-8,7.17,8.13,8.13,0,0,1-.84,0,8,8,0,0,1-7.12-8.79c.11-1.1.17-2.24.17-3.36V64A32,32,0,0,0,98.64,51.25,8,8,0,1,1,84,44.87Z",
)
}
val Icons.SlidersHorizontal: ImageVector
get() = _slidersHorizontal
private val _slidersHorizontal by lazy {
phosphor(
"sliders-horizontal",
"M40,88H73a32,32,0,0,0,62,0h81a8,8,0,0,0,0-16H135a32,32,0,0,0-62,0H40a8,8,0,0,0,0,16Zm64-24A16,16,0,1,1,88,80,16,16,0,0,1,104,64ZM216,168H199a32,32,0,0,0-62,0H40a8,8,0,0,0,0,16h97a32,32,0,0,0,62,0h17a8,8,0,0,0,0-16Zm-48,24a16,16,0,1,1,16-16A16,16,0,0,1,168,192Z",
)
}
val Icons.DownloadSimple: ImageVector
get() = _downloadSimple
private val _downloadSimple by lazy {
phosphor(
"download-simple",
"M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0Zm-101.66,5.66a8,8,0,0,0,11.32,0l40-40a8,8,0,0,0-11.32-11.32L136,124.69V32a8,8,0,0,0-16,0v92.69L93.66,98.34a8,8,0,0,0-11.32,11.32Z",
)
}
val Icons.CrownSimple: ImageVector
get() = _crownSimple
private val _crownSimple by lazy {
phosphor(
"crown-simple",
"M230.9,73.6A15.85,15.85,0,0,0,212,77.39l-33.67,36.29-35.8-80.29a1,1,0,0,1,0-.1,16,16,0,0,0-29.06,0,1,1,0,0,1,0,.1l-35.8,80.29L44,77.39A16,16,0,0,0,16.25,90.81c0,.11,0,.21.07.32L39,195a16,16,0,0,0,15.72,13H201.29A16,16,0,0,0,217,195L239.68,91.13c0-.11,0-.21.07-.32A15.85,15.85,0,0,0,230.9,73.6ZM201.35,191.68l-.06.32H54.71l-.06-.32L32,88l.14.16,42,45.24a8,8,0,0,0,13.18-2.18L128,40l40.69,91.25a8,8,0,0,0,13.18,2.18l42-45.24L224,88Z",
)
}
val Icons.ChatCircle: ImageVector
get() = _chatCircle
private val _chatCircle by lazy {
phosphor(
"chat-circle",
"M128,24A104,104,0,0,0,36.18,176.88L24.83,210.93a16,16,0,0,0,20.24,20.24l34.05-11.35A104,104,0,1,0,128,24Zm0,192a87.87,87.87,0,0,1-44.06-11.81,8,8,0,0,0-6.54-.67L40,216,52.47,178.6a8,8,0,0,0-.66-6.54A88,88,0,1,1,128,216Z",
)
}
val Icons.Brain: ImageVector
get() = _brain
private val _brain by lazy {
phosphor(
"brain",
"M248,124a56.11,56.11,0,0,0-32-50.61V72a48,48,0,0,0-88-26.49A48,48,0,0,0,40,72v1.39a56,56,0,0,0,0,101.2V176a48,48,0,0,0,88,26.49A48,48,0,0,0,216,176v-1.41A56.09,56.09,0,0,0,248,124ZM88,208a32,32,0,0,1-31.81-28.56A55.87,55.87,0,0,0,64,180h8a8,8,0,0,0,0-16H64A40,40,0,0,1,50.67,86.27,8,8,0,0,0,56,78.73V72a32,32,0,0,1,64,0v68.26A47.8,47.8,0,0,0,88,128a8,8,0,0,0,0,16,32,32,0,0,1,0,64Zm104-44h-8a8,8,0,0,0,0,16h8a55.87,55.87,0,0,0,7.81-.56A32,32,0,1,1,168,144a8,8,0,0,0,0-16,47.8,47.8,0,0,0-32,12.26V72a32,32,0,0,1,64,0v6.73a8,8,0,0,0,5.33,7.54A40,40,0,0,1,192,164Zm16-52a8,8,0,0,1-8,8h-4a36,36,0,0,1-36-36V80a8,8,0,0,1,16,0v4a20,20,0,0,0,20,20h4A8,8,0,0,1,208,112ZM60,120H56a8,8,0,0,1,0-16h4A20,20,0,0,0,80,84V80a8,8,0,0,1,16,0v4A36,36,0,0,1,60,120Z",
)
}
val Icons.Note: ImageVector
get() = _note
private val _note by lazy {
phosphor(
"note",
"M88,96a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H96A8,8,0,0,1,88,96Zm8,40h64a8,8,0,0,0,0-16H96a8,8,0,0,0,0,16Zm32,16H96a8,8,0,0,0,0,16h32a8,8,0,0,0,0-16ZM224,48V156.69A15.86,15.86,0,0,1,219.31,168L168,219.31A15.86,15.86,0,0,1,156.69,224H48a16,16,0,0,1-16-16V48A16,16,0,0,1,48,32H208A16,16,0,0,1,224,48ZM48,208H152V160a8,8,0,0,1,8-8h48V48H48Zm120-40v28.7L196.69,168Z",
)
}
package com.composables.vela.theme
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.selection.LocalTextSelectionColors
import androidx.compose.foundation.text.selection.TextSelectionColors
import androidx.compose.runtime.*
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.compositionLocalOf
import androidx.compose.runtime.staticCompositionLocalOf
import androidx.compose.ui.graphics.*
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.*
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.*
import androidx.compose.ui.unit.*
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import com.composables.googlefonts.rememberGoogleFontFamily
@Immutable
data class ThemeColors(
val `background`: Color = Color(0xFF0E0F12),
val `onBackground`: Color = Color(0xFFECECEF),
val `surface`: Color = Color(0xFF18191E),
val `onSurface`: Color = Color(0xFFECECEF),
val `surfaceVariant`: Color = Color(0xFF24252C),
val `onSurfaceVariant`: Color = Color(0xFFECECEF),
val `onBackgroundMuted`: Color = Color(0xFF8D8F99),
val `primary`: Color = Color(0xFFD6F36B),
val `onPrimary`: Color = Color(0xFF0E0F12),
val `border`: Color = Color(0xFF2B2C34),
val `textSelection`: Color = Color(0x66D6F36B),
val `destructive`: Color = Color(0xFFFF7B72),
val `onDestructive`: Color = Color(0xFF0E0F12),
)
@Immutable
data class ThemeTypography(
val `display`: TextStyle =
TextStyle(
fontFamily = FontFamily.SansSerif,
fontSize = 30.sp,
lineHeight = 36.sp,
fontWeight = FontWeight(500),
),
val `title`: TextStyle =
TextStyle(
fontFamily = FontFamily.SansSerif,
fontSize = 18.sp,
lineHeight = 24.sp,
fontWeight = FontWeight(500),
),
val `body`: TextStyle =
TextStyle(
fontFamily = FontFamily.SansSerif,
fontSize = 16.sp,
lineHeight = 26.sp,
fontWeight = FontWeight(400),
),
val `label`: TextStyle =
TextStyle(
fontFamily = FontFamily.SansSerif,
fontSize = 14.sp,
lineHeight = 20.sp,
fontWeight = FontWeight(500),
),
val `caption`: TextStyle =
TextStyle(
fontFamily = FontFamily.SansSerif,
fontSize = 12.sp,
lineHeight = 16.sp,
fontWeight = FontWeight(400),
),
val `code`: TextStyle =
TextStyle(
fontFamily = FontFamily.SansSerif,
fontSize = 13.sp,
lineHeight = 20.sp,
fontWeight = FontWeight(400),
),
)
@Immutable
data class ThemeShapes(
val `small`: Shape = RoundedCornerShape(12.dp),
val `medium`: Shape = RoundedCornerShape(20.dp),
val `large`: Shape = RoundedCornerShape(28.dp),
val `fullyRounded`: Shape = RoundedCornerShape(50),
)
fun themeColors(dark: Boolean = false): ThemeColors = ThemeColors()
@Composable
fun resolveThemeTypography(typography: ThemeTypography = ThemeTypography()): ThemeTypography {
val font0 = rememberGoogleFontFamily("Space Grotesk", weights = intArrayOf(500))
val font1 = rememberGoogleFontFamily("Inter", weights = intArrayOf(400, 500))
val font2 = rememberGoogleFontFamily("JetBrains Mono", weights = intArrayOf(400))
return typography.copy(
`display` = typography.`display`.copy(fontFamily = font0),
`title` = typography.`title`.copy(fontFamily = font0),
`body` = typography.`body`.copy(fontFamily = font1),
`label` = typography.`label`.copy(fontFamily = font1),
`caption` = typography.`caption`.copy(fontFamily = font1),
`code` = typography.`code`.copy(fontFamily = font2),
)
}
private val LocalColors = staticCompositionLocalOf<ThemeColors> { error("Theme is missing") }
private val LocalTypography =
staticCompositionLocalOf<ThemeTypography> { error("Theme is missing") }
private val LocalSpace = staticCompositionLocalOf { 4.dp }
private val LocalShapes = staticCompositionLocalOf<ThemeShapes> { error("Theme is missing") }
val LocalContentColor = compositionLocalOf<Color> { error("Theme is missing") }
val LocalTextStyle = compositionLocalOf<TextStyle> { error("Theme is missing") }
object Theme {
val colors: ThemeColors
@Composable get() = LocalColors.current
val typography: ThemeTypography
@Composable get() = LocalTypography.current
val shapes: ThemeShapes
@Composable get() = LocalShapes.current
}
val Space: Dp
@Composable get() = LocalSpace.current
@Composable
fun VelaTheme(
colors: ThemeColors = themeColors(isSystemInDarkTheme()),
typography: ThemeTypography = resolveThemeTypography(),
space: Dp = 4.dp,
shapes: ThemeShapes = ThemeShapes(),
contentColor: Color = colors.onBackground,
textStyle: TextStyle = typography.body,
content: @Composable () -> Unit,
) {
CompositionLocalProvider(
LocalColors provides colors,
LocalTypography provides typography,
LocalSpace provides space,
LocalShapes provides shapes,
LocalContentColor provides contentColor,
LocalTextStyle provides textStyle,
LocalTextSelectionColors provides
TextSelectionColors(
handleColor = colors.primary,
backgroundColor = colors.textSelection,
),
content = content,
)
}
@Composable
fun ProvideContentColor(color: Color, content: @Composable () -> Unit) {
CompositionLocalProvider(LocalContentColor provides color, content = content)
}
@Composable
fun ProvideTextStyle(style: TextStyle, content: @Composable () -> Unit) {
CompositionLocalProvider(
LocalTextStyle provides LocalTextStyle.current.merge(style),
content = content,
)
}











