-
Notifications
You must be signed in to change notification settings - Fork 4
Button stepper and Markdown Processor FIX #71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ZShubhi
wants to merge
37
commits into
common-snippet-pros
Choose a base branch
from
shubhi_menu_compose
base: common-snippet-pros
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
d2bc507
added button stepper for menu
ZShubhi 73e5bd0
Merge branch 'dev' into shubhi_menu_compose
ZShubhi 343c3d1
some reverts
ZShubhi 47dcaa0
Merge branch 'common-snippet-pros' of https://github.com/Zomato/compo…
pjinosh-zomato 0cf6aff
Merge branch 'common-snippet-pros' of https://github.com/Zomato/compo…
pjinosh-zomato c5f5c4b
Merge branch 'common-snippet-pros' of https://github.com/Zomato/compo…
pjinosh-zomato f15126e
dev fix
pjinosh-zomato a999e80
Merge branch 'common-snippet-pros' of https://github.com/Zomato/compo…
pjinosh-zomato a10f3a7
markdown processing fix
Bhavesh2404 deae60e
Merge remote-tracking branch 'origin/common-snippet-pros' into shubhi…
zomanubhav87 f8bde93
Merge remote-tracking branch 'origin/common-snippet-pros' into shubhi…
zomanubhav87 ba40121
pull from common-snippet-pros
zomanubhav87 1d13c6d
Merge remote-tracking branch 'origin/common-snippet-pros' into shubhi…
zomanubhav87 df6996a
Merge remote-tracking branch 'origin/common-snippet-pros' into shubhi…
zomanubhav87 9718e6c
Merge remote-tracking branch 'origin/common-snippet-pros' into shubhi…
zomanubhav87 dae8d8a
Merge remote-tracking branch 'origin/common-snippet-pros' into shubhi…
zomanubhav87 2713e73
Merge branch 'common-snippet-pros' of https://github.com/Zomato/compo…
pjinosh-zomato 6ba7d28
Merge branch 'common-snippet-pros' of https://github.com/Zomato/compo…
pjinosh-zomato 77cec14
Merge pull request #67 from Zomato/common-snippet-pros
hitesh-zoman eb22037
publish android artifact only for now
firefinchdev 8a7d897
release v0.1.1
firefinchdev 24c0bf0
release: v0.1.2
firefinchdev be9ebad
add: CornerConfig
firefinchdev c6b3acf
border, button, gradient, image, tag, tooltip changes
ankush-zomato 09ba386
release v0.1.3
firefinchdev 4abeaa9
release v0.1.3 (#98)
firefinchdev e5d9eea
add: withDefaults in SushiGradientColorSpec
firefinchdev 0a7cd0d
fix: SushiGradientColorSpec causes crash when colors are empty
firefinchdev 4145e89
add: CornerConfig plus operators
firefinchdev f9ad0a0
conficts resolved
2410subhadeep 4d4531f
Merge pull request #99 from Zomato/chefs-table
firefinchdev c74a19e
release 0.1.4
firefinchdev 0c89ae9
Merge pull request #100 from Zomato/release/v0.1.4
firefinchdev 73b4268
add: spring anim spec with damping, stiffness and mass
firefinchdev b056ed9
release v0.1.5
firefinchdev 64894e8
Merge pull request #101 from Zomato/chefs-table-prod-v2
firefinchdev 2631f37
merge dev
2410subhadeep File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,7 @@ | ||
| #!/bin/bash | ||
|
|
||
| ./gradlew publishAllPublicationsToMavenCentralRepository --no-configuration-cache | ||
| #./gradlew publishAllPublicationsToMavenCentralRepository --no-configuration-cache | ||
|
|
||
|
|
||
| ./gradlew :sushi-core:publishAllPublicationsToMavenCentralRepository --no-configuration-cache | ||
| ./gradlew :sushi-compose:publishAndroidReleasePublicationToMavenCentralRepository --no-configuration-cache |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
sushi/sushi-compose/src/commonMain/kotlin/com/zomato/sushi/compose/CornerConfig.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| package com.zomato.sushi.compose | ||
|
|
||
| import androidx.compose.foundation.shape.RoundedCornerShape | ||
| import androidx.compose.ui.unit.Dp | ||
| import androidx.compose.ui.unit.dp | ||
|
|
||
| /** | ||
| * @author gupta.anirudh@zomato.com | ||
| * | ||
| * A data class representing the corner configuration. | ||
| * | ||
| * @property topStart The corner radius for the top start corner | ||
| * @property topEnd The corner radius for the top end corner | ||
| * @property bottomEnd The corner radius for the bottom end corner | ||
| * @property bottomStart The corner radius for the bottom start corner | ||
| */ | ||
| data class CornerConfig( | ||
| val topStart: Dp? = null, | ||
| val topEnd: Dp? = null, | ||
| val bottomEnd: Dp? = null, | ||
| val bottomStart: Dp? = null | ||
| ) | ||
|
|
||
|
|
||
| operator fun CornerConfig?.plus(other: CornerConfig): CornerConfig { | ||
| return CornerConfig( | ||
| topStart = (this?.topStart ?: 0.dp) + (other.topStart ?: 0.dp), | ||
| topEnd = (this?.topEnd ?: 0.dp) + (other.topEnd ?: 0.dp), | ||
| bottomEnd = (this?.bottomEnd ?: 0.dp) + (other.bottomEnd ?: 0.dp), | ||
| bottomStart = (this?.bottomStart ?: 0.dp) + (other.bottomStart ?: 0.dp), | ||
| ) | ||
| } | ||
|
|
||
| operator fun CornerConfig?.plus(other: Dp): CornerConfig { | ||
| return CornerConfig( | ||
| topStart = (this?.topStart ?: 0.dp) + other, | ||
| topEnd = (this?.topEnd ?: 0.dp) + other, | ||
| bottomEnd = (this?.bottomEnd ?: 0.dp) + other, | ||
| bottomStart = (this?.bottomStart ?: 0.dp) + other, | ||
| ) | ||
| } | ||
|
|
||
| /** | ||
| * Converts a [CornerConfig] to a [RoundedCornerShape]. | ||
| * | ||
| * @param defaultRadius The default radius to use if no corner radius is specified. | ||
| * | ||
| * @return A [RoundedCornerShape] based on the corner configuration. | ||
| */ | ||
| fun CornerConfig.toShape(defaultRadius: Dp = 0.dp): RoundedCornerShape { | ||
| return RoundedCornerShape( | ||
| topStart = this.topStart ?: defaultRadius, | ||
| topEnd = this.topEnd ?: defaultRadius, | ||
| bottomEnd = this.bottomEnd ?: defaultRadius, | ||
| bottomStart = this.bottomStart ?: defaultRadius, | ||
| ) | ||
| } |
84 changes: 84 additions & 0 deletions
84
sushi/sushi-compose/src/commonMain/kotlin/com/zomato/sushi/compose/animation/Spring.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| package com.zomato.sushi.compose.animation | ||
|
|
||
| import androidx.compose.animation.core.Spring | ||
| import androidx.compose.animation.core.Spring.DampingRatioNoBouncy | ||
| import androidx.compose.animation.core.Spring.StiffnessMedium | ||
| import androidx.compose.animation.core.SpringSpec | ||
| import androidx.compose.animation.core.spring | ||
| import androidx.compose.runtime.Stable | ||
| import kotlin.math.sqrt | ||
|
|
||
| /** | ||
| * Damping for a spring with no bounciness (when stiffness is [StiffnessMedium] and mass is 1). This damping ratio will create a critically | ||
| * damped spring that returns to equilibrium within the shortest amount of time without | ||
| * oscillating. | ||
| */ | ||
| private const val DampingNoBouncy: Float = 77f | ||
|
|
||
| private const val Mass = 1f | ||
|
|
||
| /** | ||
| * Creates a [SpringSpec] that uses the given physical spring constants (i.e. [damping], | ||
| * [stiffness] and [mass]). The provided damping value is converted internally to | ||
| * a damping ratio using `damping / (2 * sqrt(stiffness * mass))`. | ||
| * The optional [visibilityThreshold] defines when the animation should be | ||
| * considered to be visually close enough to round off to its target. | ||
| * | ||
| * Invalid values (negative, zero, NaN, or infinite inputs) are automatically | ||
| * replaced with safe defaults to avoid crashes or invalid animation states. | ||
| * | ||
| * @param damping the physical damping constant of the spring. [DampingNoBouncy] by default. | ||
| * @param stiffness stiffness of the spring. [Spring.StiffnessMedium] by default. | ||
| * @param mass the mass of the spring. [Mass] by default. | ||
| * @param visibilityThreshold optionally specifies the visibility threshold. | ||
| */ | ||
| @Stable | ||
| fun <T> spring( | ||
| damping: Float = DampingNoBouncy, | ||
| stiffness: Float = StiffnessMedium, | ||
| mass: Float = Mass, | ||
| visibilityThreshold: T? = null | ||
| ): SpringSpec<T> { | ||
| val safeStiffness = when { | ||
| stiffness.isNaN() || stiffness <= 0f -> StiffnessMedium | ||
| stiffness.isInfinite() -> StiffnessMedium | ||
| else -> stiffness | ||
| } | ||
|
|
||
| val safeMass = when { | ||
| mass.isNaN() || mass <= 0f -> Mass | ||
| mass.isInfinite() -> Mass | ||
| else -> mass | ||
| } | ||
|
|
||
| val safeDamping = when { | ||
| damping.isNaN() || damping < 0f -> DampingNoBouncy | ||
| damping.isInfinite() -> DampingNoBouncy | ||
| else -> damping | ||
| } | ||
|
|
||
| val sqrtTerm = safeStiffness * safeMass | ||
| val denominator = 2f * sqrt(sqrtTerm) | ||
|
|
||
| val dampingRatio = if ( | ||
| denominator == 0f || | ||
| denominator.isNaN() || | ||
| denominator.isInfinite() | ||
| ) { | ||
| Spring.DampingRatioNoBouncy | ||
| } else { | ||
| (safeDamping / denominator).let { | ||
| if (it.isNaN() || it.isInfinite()) { | ||
| Spring.DampingRatioNoBouncy | ||
| } else { | ||
| it | ||
| } | ||
| } | ||
| } | ||
|
|
||
| return spring( | ||
| dampingRatio = dampingRatio, | ||
| stiffness = safeStiffness, | ||
| visibilityThreshold = visibilityThreshold | ||
| ) | ||
| } |
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,9 +51,9 @@ internal fun SushiSurfaceButtonImpl( | |
|
|
||
| val contentPadding = with(SushiButtonDefaults) { | ||
| when (props.sizeOrDefault) { | ||
| SushiButtonSize.Small -> PaddingValues(horizontal = SushiTheme.dimens.spacing.extra, vertical = SushiTheme.dimens.spacing.mini) | ||
| SushiButtonSize.Medium -> PaddingValues(horizontal = SushiTheme.dimens.spacing.extra, vertical = SushiTheme.dimens.spacing.macro) | ||
| SushiButtonSize.Large -> PaddingValues(horizontal = SushiTheme.dimens.spacing.extra, vertical = SushiTheme.dimens.spacing.macro) | ||
| SushiButtonSize.Small -> props.contentPadding ?: PaddingValues(horizontal = SushiTheme.dimens.spacing.extra, vertical = SushiTheme.dimens.spacing.mini) | ||
| SushiButtonSize.Medium -> props.contentPadding ?: PaddingValues(horizontal = SushiTheme.dimens.spacing.extra, vertical = SushiTheme.dimens.spacing.macro) | ||
| SushiButtonSize.Large -> props.contentPadding ?: PaddingValues(horizontal = SushiTheme.dimens.spacing.extra, vertical = SushiTheme.dimens.spacing.macro) | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -105,7 +105,7 @@ internal fun SushiSurfaceButtonImpl( | |
| fontColorDisabled = fontColorDisabled, | ||
| fontColorPressed = fontColorPressed, | ||
| fontColor = fontColor, | ||
| modifier = Modifier.fillMaxSize() | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why remove? |
||
| Modifier.fillMaxSize() | ||
| ) | ||
| } | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why remove?