diff --git a/playground/src/main/kotlin/team/duckie/quackquack/playground/realworld/ImagePlayground.kt b/playground/src/main/kotlin/team/duckie/quackquack/playground/realworld/ImagePlayground.kt index e05409f1c..856a1a511 100644 --- a/playground/src/main/kotlin/team/duckie/quackquack/playground/realworld/ImagePlayground.kt +++ b/playground/src/main/kotlin/team/duckie/quackquack/playground/realworld/ImagePlayground.kt @@ -30,6 +30,7 @@ import team.duckie.quackquack.ui.util.DpSize class ImagePlayground : PlaygroundActivity( name = "Image", ) { + @Suppress("MaxLineLength") override val items: ImmutableList Unit>> = persistentListOf( ::QuackImageDemo.name to { QuackImageDemo() }, ::QuackSelectableImageTypeTopEndCheckboxDemo.name to { QuackSelectableImageTypeTopEndCheckboxDemo() }, diff --git a/playground/src/main/kotlin/team/duckie/quackquack/playground/realworld/TextFieldPlayground.kt b/playground/src/main/kotlin/team/duckie/quackquack/playground/realworld/TextFieldPlayground.kt index 00d27b8e8..bd210bbc5 100644 --- a/playground/src/main/kotlin/team/duckie/quackquack/playground/realworld/TextFieldPlayground.kt +++ b/playground/src/main/kotlin/team/duckie/quackquack/playground/realworld/TextFieldPlayground.kt @@ -8,8 +8,6 @@ package team.duckie.quackquack.playground.realworld import androidx.compose.runtime.Composable -import androidx.compose.runtime.derivedStateOf -import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import kotlinx.collections.immutable.ImmutableList @@ -76,6 +74,8 @@ fun QuackBasic2TextFieldDemo() { ) } +private const val MaxLength = 5 + @Composable fun QuackErrorableTextFieldDemo() { val (text, setText) = remember { mutableStateOf("") } @@ -83,9 +83,9 @@ fun QuackErrorableTextFieldDemo() { QuackErrorableTextField( text = text, onTextChanged = setText, - placeholderText = "MaxLength: 5", - maxLength = 5, - isError = text.length > 5, + placeholderText = "MaxLength: $MaxLength", + maxLength = MaxLength, + isError = text.length > MaxLength, errorText = "ErrorText", showClearButton = true, onCleared = { setText("") }, @@ -99,9 +99,9 @@ fun QuackErrorableTextFieldWithoutClearButtonDemo() { QuackErrorableTextField( text = text, onTextChanged = setText, - placeholderText = "MaxLength: 5", - maxLength = 5, - isError = text.length > 5, + placeholderText = "MaxLength: $MaxLength", + maxLength = MaxLength, + isError = text.length > MaxLength, errorText = "ErrorText", ) } diff --git a/ui-components/api/ui-components.api b/ui-components/api/ui-components.api index 349becf8d..f6abd7e18 100644 --- a/ui-components/api/ui-components.api +++ b/ui-components/api/ui-components.api @@ -57,6 +57,7 @@ public final class team/duckie/quackquack/ui/color/QuackColor { public final class team/duckie/quackquack/ui/color/QuackColor$Companion { public final fun getAlert-yvcWADs ()J public final fun getBlack-yvcWADs ()J + public final fun getDimmed-yvcWADs ()J public final fun getDuckieOrange-yvcWADs ()J public final fun getGray1-yvcWADs ()J public final fun getGray2-yvcWADs ()J @@ -98,18 +99,37 @@ public final class team/duckie/quackquack/ui/component/DropDownKt { } public final class team/duckie/quackquack/ui/component/GridLayoutKt { - public static final fun QuackGridLayout (Landroidx/compose/ui/Modifier;Lkotlinx/collections/immutable/ImmutableList;Landroidx/compose/foundation/lazy/grid/LazyGridState;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function4;Landroidx/compose/runtime/Composer;II)V + public static final fun QuackGridLayout-ikN4xI4 (Landroidx/compose/ui/Modifier;Lkotlinx/collections/immutable/ImmutableList;Landroidx/compose/foundation/lazy/grid/LazyGridState;FFLkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function4;Landroidx/compose/runtime/Composer;II)V } public final class team/duckie/quackquack/ui/component/ImageKt { - public static final fun QuackImage-LIkTEBE (Landroidx/compose/ui/Modifier;Landroidx/compose/foundation/layout/PaddingValues;Ljava/lang/Object;Landroidx/compose/ui/unit/DpSize;Lteam/duckie/quackquack/ui/color/QuackColor;ZLkotlin/jvm/functions/Function0;Landroidx/compose/ui/layout/ContentScale;Landroidx/compose/ui/graphics/Shape;Lkotlin/jvm/functions/Function2;Landroidx/compose/ui/unit/DpSize;Landroidx/compose/ui/Alignment;Ljava/lang/String;Landroidx/compose/runtime/Composer;III)V - public static final fun QuackSelectableImage-O3gMbGQ (Landroidx/compose/ui/Modifier;ZLjava/lang/Object;Landroidx/compose/ui/unit/DpSize;Lteam/duckie/quackquack/ui/color/QuackColor;ZLkotlin/jvm/functions/Function0;Landroidx/compose/ui/layout/ContentScale;Ljava/lang/String;Landroidx/compose/runtime/Composer;II)V + public static final fun QuackImage--yKFjV8 (Landroidx/compose/ui/Modifier;Landroidx/compose/foundation/layout/PaddingValues;Ljava/lang/Object;Landroidx/compose/ui/unit/DpSize;Lteam/duckie/quackquack/ui/color/QuackColor;ZLkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;Landroidx/compose/ui/layout/ContentScale;Landroidx/compose/ui/graphics/Shape;Lkotlin/jvm/functions/Function2;Landroidx/compose/ui/unit/DpSize;Landroidx/compose/ui/Alignment;Ljava/lang/String;Landroidx/compose/runtime/Composer;III)V + public static final fun QuackSelectableImage-JSVLmck (Landroidx/compose/ui/Modifier;ZLjava/lang/Object;Landroidx/compose/ui/unit/DpSize;Lteam/duckie/quackquack/ui/color/QuackColor;Landroidx/compose/ui/graphics/Shape;Lteam/duckie/quackquack/ui/component/QuackSelectableImageType;ZLkotlin/jvm/functions/Function0;Landroidx/compose/ui/layout/ContentScale;Ljava/lang/String;Landroidx/compose/runtime/Composer;III)V } public final class team/duckie/quackquack/ui/component/LabelKt { public static final fun QuackLabel (Landroidx/compose/ui/Modifier;Ljava/lang/String;ZLkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;II)V } +public final class team/duckie/quackquack/ui/component/QuackHighlightTextInfo { + public static final field $stable I + public fun (Ljava/lang/String;IILkotlin/jvm/functions/Function0;)V + public synthetic fun (Ljava/lang/String;IILkotlin/jvm/functions/Function0;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public final fun component1 ()Ljava/lang/String; + public final fun component2 ()I + public final fun component3 ()I + public final fun component4 ()Lkotlin/jvm/functions/Function0; + public final fun copy (Ljava/lang/String;IILkotlin/jvm/functions/Function0;)Lteam/duckie/quackquack/ui/component/QuackHighlightTextInfo; + public static synthetic fun copy$default (Lteam/duckie/quackquack/ui/component/QuackHighlightTextInfo;Ljava/lang/String;IILkotlin/jvm/functions/Function0;ILjava/lang/Object;)Lteam/duckie/quackquack/ui/component/QuackHighlightTextInfo; + public fun equals (Ljava/lang/Object;)Z + public final fun getEndIndex ()I + public final fun getOnClick ()Lkotlin/jvm/functions/Function0; + public final fun getStartIndex ()I + public final fun getText ()Ljava/lang/String; + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + public final class team/duckie/quackquack/ui/component/QuackLargeButtonType : java/lang/Enum { public static final field Border Lteam/duckie/quackquack/ui/component/QuackLargeButtonType; public static final field Compact Lteam/duckie/quackquack/ui/component/QuackLargeButtonType; @@ -118,6 +138,22 @@ public final class team/duckie/quackquack/ui/component/QuackLargeButtonType : ja public static fun values ()[Lteam/duckie/quackquack/ui/component/QuackLargeButtonType; } +public abstract class team/duckie/quackquack/ui/component/QuackSelectableImageType { + public static final field $stable I + public synthetic fun (Landroidx/compose/ui/unit/DpSize;Lteam/duckie/quackquack/ui/color/QuackColor;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Landroidx/compose/ui/unit/DpSize;Lteam/duckie/quackquack/ui/color/QuackColor;Lkotlin/jvm/internal/DefaultConstructorMarker;)V +} + +public final class team/duckie/quackquack/ui/component/QuackSelectableImageType$CheckOverlay : team/duckie/quackquack/ui/component/QuackSelectableImageType { + public static final field $stable I + public static final field INSTANCE Lteam/duckie/quackquack/ui/component/QuackSelectableImageType$CheckOverlay; +} + +public final class team/duckie/quackquack/ui/component/QuackSelectableImageType$TopEndCheckBox : team/duckie/quackquack/ui/component/QuackSelectableImageType { + public static final field $stable I + public static final field INSTANCE Lteam/duckie/quackquack/ui/component/QuackSelectableImageType$TopEndCheckBox; +} + public final class team/duckie/quackquack/ui/component/QuackSmallButtonType : java/lang/Enum { public static final field Border Lteam/duckie/quackquack/ui/component/QuackSmallButtonType; public static final field Fill Lteam/duckie/quackquack/ui/component/QuackSmallButtonType; @@ -176,8 +212,9 @@ public final class team/duckie/quackquack/ui/component/TabKt { public final class team/duckie/quackquack/ui/component/TagKt { public static final fun QuackCircleTag-vwKyDFA (Landroidx/compose/ui/Modifier;Ljava/lang/String;Lteam/duckie/quackquack/ui/icon/QuackIcon;ZLkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;II)V public static final fun QuackGrayscaleTag (Landroidx/compose/ui/Modifier;Ljava/lang/String;Ljava/lang/String;Lkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;II)V - public static final fun QuackLazyVerticalGridTag (Landroidx/compose/ui/Modifier;Ljava/lang/String;Ljava/util/List;Ljava/util/List;Lteam/duckie/quackquack/ui/component/QuackTagType;Lkotlin/jvm/functions/Function1;Landroidx/compose/runtime/Composer;II)V + public static final fun QuackLazyVerticalGridTag-hW5Ac_0 (Landroidx/compose/ui/Modifier;Landroidx/compose/foundation/layout/PaddingValues;Ljava/lang/String;Ljava/util/List;Ljava/util/List;IFFLteam/duckie/quackquack/ui/component/QuackTagType;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;Landroidx/compose/runtime/Composer;III)V public static final fun QuackRoundTag (Landroidx/compose/ui/Modifier;Ljava/lang/String;ZLkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;II)V + public static final fun QuackSingeLazyRowTag-zadm560 (Landroidx/compose/ui/Modifier;Landroidx/compose/foundation/layout/PaddingValues;Ljava/lang/String;Ljava/util/List;Ljava/util/List;FLteam/duckie/quackquack/ui/component/QuackTagType;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;Landroidx/compose/runtime/Composer;II)V } public final class team/duckie/quackquack/ui/component/TextAreaKt { @@ -189,8 +226,8 @@ public final class team/duckie/quackquack/ui/component/TextAreaKt { public final class team/duckie/quackquack/ui/component/TextFieldKt { public static final fun QuackBasic2TextField-M_XELVw (Landroidx/compose/ui/Modifier;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Ljava/lang/String;Lteam/duckie/quackquack/ui/icon/QuackIcon;Lkotlin/jvm/functions/Function0;Lteam/duckie/quackquack/ui/icon/QuackIcon;Lkotlin/jvm/functions/Function0;Landroidx/compose/foundation/text/KeyboardOptions;Landroidx/compose/foundation/text/KeyboardActions;Landroidx/compose/runtime/Composer;II)V public static final fun QuackBasicTextField-VRGdc9Y (Landroidx/compose/ui/Modifier;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Ljava/lang/String;Lteam/duckie/quackquack/ui/icon/QuackIcon;Ljava/lang/String;Lkotlin/jvm/functions/Function0;Landroidx/compose/foundation/text/KeyboardOptions;Landroidx/compose/foundation/text/KeyboardActions;Landroidx/compose/runtime/Composer;II)V + public static final fun QuackErrorableTextField-ICnUfa0 (Landroidx/compose/ui/Modifier;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Ljava/lang/String;IZLjava/lang/String;ZLkotlin/jvm/functions/Function0;ILandroidx/compose/foundation/text/KeyboardActions;Landroidx/compose/runtime/Composer;III)V public static final fun QuackPriceTextField-VdmFRJE (Landroidx/compose/ui/Modifier;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Ljava/lang/String;ILandroidx/compose/foundation/text/KeyboardActions;Landroidx/compose/runtime/Composer;II)V - public static final fun QuackProfileTextField-kWt9ohg (Landroidx/compose/ui/Modifier;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Ljava/lang/String;ILjava/lang/String;Lkotlin/jvm/functions/Function0;ILandroidx/compose/foundation/text/KeyboardActions;Landroidx/compose/runtime/Composer;II)V } public final class team/duckie/quackquack/ui/component/ToggleKt { @@ -200,23 +237,30 @@ public final class team/duckie/quackquack/ui/component/ToggleKt { } public final class team/duckie/quackquack/ui/component/TopAppBarKt { - public static final fun QuackTopAppBar-gZfxw78 (Landroidx/compose/ui/Modifier;ILjava/lang/String;Lkotlin/jvm/functions/Function0;Ljava/lang/Boolean;Ljava/lang/String;Lkotlin/jvm/functions/Function0;Lteam/duckie/quackquack/ui/icon/QuackIcon;Lteam/duckie/quackquack/ui/icon/QuackIcon;Ljava/lang/String;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;III)V + public static final fun QuackTopAppBar-sNfYT1c (Landroidx/compose/ui/Modifier;ILjava/lang/String;Lkotlin/jvm/functions/Function0;Ljava/lang/Boolean;Ljava/lang/String;Lteam/duckie/quackquack/ui/icon/QuackIcon;Lkotlin/jvm/functions/Function0;Lteam/duckie/quackquack/ui/icon/QuackIcon;Lteam/duckie/quackquack/ui/icon/QuackIcon;Ljava/lang/String;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;III)V } public final class team/duckie/quackquack/ui/component/TypographyKt { - public static final fun QuackAnnotatedBody2-g3F3a7U (Landroidx/compose/ui/Modifier;Ljava/lang/String;Lkotlinx/collections/immutable/ImmutableList;JZIZZILkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;II)V - public static final fun QuackBody1-4MVLfTg (Landroidx/compose/ui/Modifier;Ljava/lang/String;JIZZILkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;II)V - public static final fun QuackBody2-4MVLfTg (Landroidx/compose/ui/Modifier;Ljava/lang/String;JIZZILkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;II)V - public static final fun QuackBody3-4MVLfTg (Landroidx/compose/ui/Modifier;Ljava/lang/String;JIZZILkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;II)V - public static final fun QuackHeadLine1-4MVLfTg (Landroidx/compose/ui/Modifier;Ljava/lang/String;JIZZILkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;II)V - public static final fun QuackHeadLine2-8VQwbsk (Landroidx/compose/ui/Modifier;Ljava/lang/String;JIZZLkotlin/jvm/functions/Function0;ILandroidx/compose/runtime/Composer;II)V - public static final fun QuackHighlightBody1-HV-PboU (Landroidx/compose/ui/Modifier;Ljava/lang/String;Lkotlinx/collections/immutable/ImmutableList;JIZZILkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;II)V - public static final fun QuackSubtitle-4MVLfTg (Landroidx/compose/ui/Modifier;Ljava/lang/String;JIZZILkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;II)V - public static final fun QuackSubtitle2-4MVLfTg (Landroidx/compose/ui/Modifier;Ljava/lang/String;JIZZILkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;II)V - public static final fun QuackTitle1-4MVLfTg (Landroidx/compose/ui/Modifier;Ljava/lang/String;JIZZILkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;II)V - public static final fun QuackTitle2-4MVLfTg (Landroidx/compose/ui/Modifier;Ljava/lang/String;JIZZILkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;II)V - public static final fun QuackUnderlineBody3-HV-PboU (Landroidx/compose/ui/Modifier;Ljava/lang/String;Lkotlinx/collections/immutable/ImmutableList;JIZZILkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;II)V - public static final fun QuackUnderlineHeadLine2-HV-PboU (Landroidx/compose/ui/Modifier;Ljava/lang/String;Lkotlinx/collections/immutable/ImmutableList;JIZZILkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;II)V + public static final fun QuackAnnotatedBody2-XgcKEhA (Landroidx/compose/ui/Modifier;Landroidx/compose/foundation/layout/PaddingValues;Ljava/lang/String;Lkotlinx/collections/immutable/ImmutableList;JZIZZILkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;III)V + public static final fun QuackBody1-HV-PboU (Landroidx/compose/ui/Modifier;Landroidx/compose/foundation/layout/PaddingValues;Ljava/lang/String;JIZZILkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;II)V + public static final fun QuackBody2-HV-PboU (Landroidx/compose/ui/Modifier;Landroidx/compose/foundation/layout/PaddingValues;Ljava/lang/String;JIZZILkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;II)V + public static final fun QuackBody3-HV-PboU (Landroidx/compose/ui/Modifier;Landroidx/compose/foundation/layout/PaddingValues;Ljava/lang/String;JIZZILkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;II)V + public static final fun QuackHeadLine1-HV-PboU (Landroidx/compose/ui/Modifier;Landroidx/compose/foundation/layout/PaddingValues;Ljava/lang/String;JIZZILkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;II)V + public static final fun QuackHeadLine2-VAyAlXU (Landroidx/compose/ui/Modifier;Landroidx/compose/foundation/layout/PaddingValues;Ljava/lang/String;JIZZLkotlin/jvm/functions/Function0;ILandroidx/compose/runtime/Composer;II)V + public static final fun QuackHighlightBody1-8v0r9OE (Landroidx/compose/ui/Modifier;Landroidx/compose/foundation/layout/PaddingValues;Ljava/lang/String;Lkotlinx/collections/immutable/ImmutableList;JIZZILkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;II)V + public static final fun QuackSplashSlogan-HV-PboU (Landroidx/compose/ui/Modifier;Landroidx/compose/foundation/layout/PaddingValues;Ljava/lang/String;JIZZILkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;II)V + public static final fun QuackSubtitle-HV-PboU (Landroidx/compose/ui/Modifier;Landroidx/compose/foundation/layout/PaddingValues;Ljava/lang/String;JIZZILkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;II)V + public static final fun QuackSubtitle2-HV-PboU (Landroidx/compose/ui/Modifier;Landroidx/compose/foundation/layout/PaddingValues;Ljava/lang/String;JIZZILkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;II)V + public static final fun QuackTitle1-HV-PboU (Landroidx/compose/ui/Modifier;Landroidx/compose/foundation/layout/PaddingValues;Ljava/lang/String;JIZZILkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;II)V + public static final fun QuackTitle2-HV-PboU (Landroidx/compose/ui/Modifier;Landroidx/compose/foundation/layout/PaddingValues;Ljava/lang/String;JIZZILkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;II)V + public static final fun QuackUnderlineBody3-aBob8x0 (Landroidx/compose/ui/Modifier;Landroidx/compose/foundation/layout/PaddingValues;Ljava/lang/String;Lkotlinx/collections/immutable/ImmutableList;JJIZZILkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;III)V + public static final fun QuackUnderlineHeadLine2-8v0r9OE (Landroidx/compose/ui/Modifier;Landroidx/compose/foundation/layout/PaddingValues;Ljava/lang/String;Lkotlinx/collections/immutable/ImmutableList;JIZZILkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;II)V +} + +public final class team/duckie/quackquack/ui/component/internal/QuackTextKt { + public static final fun QuackClickableText-rm0N8CA (Landroidx/compose/ui/Modifier;Landroidx/compose/ui/text/AnnotatedString;Lkotlinx/collections/immutable/ImmutableList;Lkotlin/jvm/functions/Function0;Lteam/duckie/quackquack/ui/textstyle/QuackTextStyle;ZILandroidx/compose/runtime/Composer;II)V + public static final fun QuackText-ck6qOPw (Landroidx/compose/ui/Modifier;Landroidx/compose/ui/text/AnnotatedString;Lteam/duckie/quackquack/ui/textstyle/QuackTextStyle;ZILandroidx/compose/runtime/Composer;II)V + public static final fun QuackText-ck6qOPw (Landroidx/compose/ui/Modifier;Ljava/lang/Object;Lteam/duckie/quackquack/ui/textstyle/QuackTextStyle;ZILandroidx/compose/runtime/Composer;II)V } public final class team/duckie/quackquack/ui/icon/QuackIcon { @@ -243,6 +287,7 @@ public final class team/duckie/quackquack/ui/icon/QuackIcon$Companion { public final fun getBookmark-oyUPibY ()I public final fun getBuy-oyUPibY ()I public final fun getCamera-oyUPibY ()I + public final fun getCheck-oyUPibY ()I public final fun getClose-oyUPibY ()I public final fun getComment-oyUPibY ()I public final fun getDelete-oyUPibY ()I @@ -277,8 +322,8 @@ public final class team/duckie/quackquack/ui/icon/QuackIcon$Companion { public final class team/duckie/quackquack/ui/modifier/ClickableKt { public static final field QuackDefaultAlwaysShowRipple Z public static final fun getQuackAlwaysShowRipple ()Z - public static final fun quackClickable-phFAS_g (Landroidx/compose/ui/Modifier;ZLteam/duckie/quackquack/ui/color/QuackColor;Lkotlin/jvm/functions/Function0;)Landroidx/compose/ui/Modifier; - public static synthetic fun quackClickable-phFAS_g$default (Landroidx/compose/ui/Modifier;ZLteam/duckie/quackquack/ui/color/QuackColor;Lkotlin/jvm/functions/Function0;ILjava/lang/Object;)Landroidx/compose/ui/Modifier; + public static final fun quackClickable-akPJkg0 (Landroidx/compose/ui/Modifier;ZLteam/duckie/quackquack/ui/color/QuackColor;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;)Landroidx/compose/ui/Modifier; + public static synthetic fun quackClickable-akPJkg0$default (Landroidx/compose/ui/Modifier;ZLteam/duckie/quackquack/ui/color/QuackColor;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;ILjava/lang/Object;)Landroidx/compose/ui/Modifier; public static final fun setQuackAlwaysShowRipple (Z)V } @@ -303,6 +348,7 @@ public final class team/duckie/quackquack/ui/textstyle/QuackTextStyle$Companion public final fun getBody3 ()Lteam/duckie/quackquack/ui/textstyle/QuackTextStyle; public final fun getHeadLine1 ()Lteam/duckie/quackquack/ui/textstyle/QuackTextStyle; public final fun getHeadLine2 ()Lteam/duckie/quackquack/ui/textstyle/QuackTextStyle; + public final fun getSplashSlogan ()Lteam/duckie/quackquack/ui/textstyle/QuackTextStyle; public final fun getSubtitle ()Lteam/duckie/quackquack/ui/textstyle/QuackTextStyle; public final fun getSubtitle2 ()Lteam/duckie/quackquack/ui/textstyle/QuackTextStyle; public final fun getTitle1 ()Lteam/duckie/quackquack/ui/textstyle/QuackTextStyle; diff --git a/ui-components/build.gradle.kts b/ui-components/build.gradle.kts index 86f36c80a..3cace21d8 100644 --- a/ui-components/build.gradle.kts +++ b/ui-components/build.gradle.kts @@ -36,6 +36,9 @@ android { // FIXME: https://github.com/duckie-team/quack-quack-android/issues/368 disable.add("SpecifyAnimationSpec") + + // FIXME: https://github.com/duckie-team/quack-quack-android/issues/383 + disable.add("TrailingComma") } } diff --git a/ui-components/src/main/kotlin/team/duckie/quackquack/ui/component/GridLayout.kt b/ui-components/src/main/kotlin/team/duckie/quackquack/ui/component/GridLayout.kt index 991df5cd3..8de36f740 100644 --- a/ui-components/src/main/kotlin/team/duckie/quackquack/ui/component/GridLayout.kt +++ b/ui-components/src/main/kotlin/team/duckie/quackquack/ui/component/GridLayout.kt @@ -17,6 +17,7 @@ import androidx.compose.foundation.lazy.grid.itemsIndexed import androidx.compose.foundation.lazy.grid.rememberLazyGridState import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier +import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import kotlinx.collections.immutable.ImmutableList @@ -39,6 +40,8 @@ private object QuackGridDefaults { * @param modifier the modifier to apply to this layout * @param items the data list * @param state the state object to be used to control or observe the list's state + * @param verticalSpacing the vertical spacing between items + * @param horizontalSpacing the horizontal spacing between items * @param key a factory of stable and unique keys representing the item. Using the same key * for multiple items in the grid is not allowed. Type of the key should be saveable * via Bundle on Android. If null is passed the position in the grid will represent the key. @@ -58,6 +61,8 @@ public fun QuackGridLayout( modifier: Modifier = Modifier, items: ImmutableList, state: LazyGridState = rememberLazyGridState(), + verticalSpacing: Dp = QuackGridDefaults.VerticalGap, + horizontalSpacing: Dp = QuackGridDefaults.HorizontalGap, key: ((index: Int, item: T) -> Any)? = null, span: (LazyGridItemSpanScope.(index: Int, item: T) -> GridItemSpan)? = null, contentType: (index: Int, item: T) -> Any? = { _, _ -> null }, @@ -72,10 +77,10 @@ public fun QuackGridLayout( count = MaxComponentCountsForLine ), verticalArrangement = Arrangement.spacedBy( - space = VerticalGap, + space = verticalSpacing, ), horizontalArrangement = Arrangement.spacedBy( - space = HorizontalGap, + space = horizontalSpacing, ), ) { itemsIndexed( diff --git a/ui-components/src/main/kotlin/team/duckie/quackquack/ui/component/tag.kt b/ui-components/src/main/kotlin/team/duckie/quackquack/ui/component/tag.kt index d01192047..e58b8eff0 100644 --- a/ui-components/src/main/kotlin/team/duckie/quackquack/ui/component/tag.kt +++ b/ui-components/src/main/kotlin/team/duckie/quackquack/ui/component/tag.kt @@ -18,6 +18,7 @@ import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.foundation.lazy.LazyRow import androidx.compose.foundation.lazy.grid.LazyVerticalGrid import androidx.compose.foundation.lazy.itemsIndexed import androidx.compose.foundation.lazy.layout.LazyLayout @@ -607,8 +608,7 @@ private fun quackTagInternalAssert( /** * [LazyVerticalGrid] 형식으로 주어진 태그들을 배치합니다. * 이 컴포넌트는 항상 상위 컴포저블의 가로 길이만큼 width 가 지정되고, - * (즉, 좌우 패딩이 허용되지 않습니다) 한 줄에 최대 [itemChunkedSize]개가 들어갈 수 있습니다. - * 또한 가로와 세로 스크롤을 모두 지원합니다. + * 한 줄에 최대 [itemChunkedSize]개가 들어갈 수 있습니다. 또한 가로와 세로 스크롤을 모두 지원합니다. * * 퍼포먼스 측면에서 [LazyLayout] 를 사용하는 것이 좋지만, 덕키의 경우 * 표시해야 하는 태그의 개수가 많지 않기 때문에 컴포저블을 직접 그려도 @@ -633,6 +633,9 @@ private fun quackTagInternalAssert( * When you specify the key the scroll position will be maintained based on the key, which * means if you add/remove items before the current visible item the item with the given key * will be kept as the first visible one. + * @param contentType a factory of the content types for the item. The item compositions of + * the same type could be reused more efficiently. Note that null is a valid type and items of such + * type will be considered compatible. * @param onClick 사용자가 태그를 클릭했을 때 호출되는 람다. * 람다식의 인자로는 선택된 태그의 index 가 들어옵니다. */ @@ -647,13 +650,9 @@ public fun QuackLazyVerticalGridTag( horizontalSpace: Dp = QuackTagDefaults.LazyTag.HorizontalSpacedBy, verticalSpace: Dp = QuackTagDefaults.LazyTag.VerticalSpacedBy, tagType: QuackTagType, - key: (( - index: Int, - items: List, - ) -> Any)? = null, - onClick: ( - index: Int, - ) -> Unit, + key: ((index: Int, items: List) -> Any)? = null, + contentType: (index: Int, items: List) -> Any? = { _, _ -> null }, + onClick: (index: Int) -> Unit, ): Unit = with( receiver = QuackTagDefaults.LazyTag, ) { @@ -693,16 +692,8 @@ public fun QuackLazyVerticalGridTag( } itemsIndexed( items = chunkedItems, - key = { index: Int, items: List -> - key!!.invoke( - /* index = */ - index, - /* items = */ - items, - ) - }.takeIf { - key != null - }, + key = key, + contentType = contentType, ) { rowIndex, rowItems -> Row( modifier = Modifier @@ -758,3 +749,107 @@ public fun QuackLazyVerticalGridTag( } } } + +/** + * [LazyRow] 형식으로 주어진 태그들을 **한 줄로** 배치합니다. + * 이 컴포넌트는 항상 상위 컴포저블의 가로 길이만큼 width 가 지정됩니다. + * + * @param modifier 이 컴포넌트에 적용할 [Modifier] + * @param contentPadding 이 컴포넌트의 광역에 적용될 [PaddingValues] + * @param title 상단에 표시될 제목. 만약 null 을 제공할 시 표시되지 않습니다. + * @param items 표시할 태그들의 제목. **중복되는 태그 제목은 허용하지 않습니다.** + * 이 항목은 바뀔 수 있으므로 [ImmutableList] 가 아닌 일반 [List] 로 받습니다. + * @param itemSelections 태그들의 선택 여부. + * 이 항목은 바뀔 수 있으므로 [ImmutableList] 가 아닌 [List] 로 받습니다. + * @param horizontalSpace 아이템들의 가로 간격 + * @param tagType [QuackLazyVerticalGridTag] 에서 표시할 태그의 타입을 지정합니다. + * 여러 종류의 태그가 [QuackLazyVerticalGridTag] 으로 표시될 수 있게 태그의 타입을 따로 받습니다. + * @param key a factory of stable and unique keys representing the item. Using the same key + * for multiple items in the list is not allowed. Type of the key should be saveable + * via Bundle on Android. If null is passed the position in the list will represent the key. + * When you specify the key the scroll position will be maintained based on the key, which + * means if you add/remove items before the current visible item the item with the given key + * will be kept as the first visible one. + * @param contentType a factory of the content types for the item. The item compositions of + * the same type could be reused more efficiently. Note that null is a valid type and items of such + * type will be considered compatible. + * @param onClick 사용자가 태그를 클릭했을 때 호출되는 람다. + * 람다식의 인자로는 선택된 태그의 index 가 들어옵니다. + */ +@Composable +public fun QuackSingeLazyRowTag( + modifier: Modifier = Modifier, + contentPadding: PaddingValues = NoPadding, + title: String? = null, + items: List, + itemSelections: List? = null, + horizontalSpace: Dp = QuackTagDefaults.LazyTag.HorizontalSpacedBy, + tagType: QuackTagType, + key: ((index: Int, item: String) -> Any)? = null, + contentType: (index: Int, item: String) -> Any? = { _, _ -> null }, + onClick: (index: Int) -> Unit, +): Unit = with(QuackTagDefaults.LazyTag) { + if (itemSelections != null) { + runtimeCheck( + value = items.size == itemSelections.size, + ) { + "The size of items and the size of itemsSelection must always be the same. " + + "[items.size (${items.size}) != itemsSelection.size (${itemSelections.size})]" + } + } + LazyRow( + modifier = modifier.fillMaxWidth(), + contentPadding = contentPadding, + horizontalArrangement = Arrangement.spacedBy(space = horizontalSpace), + ) { + if (title != null) { + item { + QuackText( + modifier = Modifier.padding(bottom = TitleSpacedBy), + text = title, + style = TitleTypogrphy, + singleLine = true, + ) + } + } + itemsIndexed( + items = items, + key = key, + contentType = contentType, + ) { index, item -> + val isSelected = itemSelections?.get(index) ?: false + with(tagType) { + when (this) { + is QuackTagType.Grayscale -> QuackGrayscaleTagInternal( + modifier = Modifier.animateItemPlacement( + animationSpec = QuackAnimationSpec(), + ), + text = item, + trailingText = trailingText, + actualIndex = index, + onClickWithIndex = onClick, + ) + is QuackTagType.Circle -> QuackCircleTagInternal( + modifier = Modifier.animateItemPlacement( + animationSpec = QuackAnimationSpec(), + ), + text = item, + trailingIcon = trailingIcon, + isSelected = isSelected, + actualIndex = index, + onClickWithIndex = onClick, + ) + QuackTagType.Round -> QuackRoundTagInternal( + modifier = Modifier.animateItemPlacement( + animationSpec = QuackAnimationSpec(), + ), + text = item, + isSelected = isSelected, + actualIndex = index, + onClickWithIndex = onClick, + ) + } + } + } + } +} diff --git a/versions/ui-components.txt b/versions/ui-components.txt index 668578bfe..44be005e4 100644 --- a/versions/ui-components.txt +++ b/versions/ui-components.txt @@ -1,3 +1,3 @@ major=1 minor=3 -patch=2 +patch=3