From 2af4d05362b3f72d7a0b817eadf25eebc26ab05e Mon Sep 17 00:00:00 2001 From: Richard To Date: Wed, 27 Mar 2024 18:04:04 -0700 Subject: [PATCH] Allow columns CSS property to accept int/str vals. (#86) The columns property allows int/strs according to https://developer.mozilla.org/en-US/docs/Web/CSS/columns We want to keep the int value for backwards compatibility. Fixes #79 --- mesop/component_helpers/style.py | 4 ++-- mesop/protos/ui.proto | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mesop/component_helpers/style.py b/mesop/component_helpers/style.py index 52c5a38ab..4ce54cf1b 100644 --- a/mesop/component_helpers/style.py +++ b/mesop/component_helpers/style.py @@ -173,7 +173,7 @@ class Style: box_sizing: str | None = None color: str | None = None column_gap: int | str | None = None - columns: int | None = None + columns: int | str | None = None cursor: str | None = None display: Literal[ # precomposed values @@ -273,7 +273,7 @@ def to_style_proto(s: Style) -> pb.Style: box_sizing=s.box_sizing, color=s.color, column_gap=_px_str(s.column_gap), - columns=s.columns, + columns=str(s.columns), cursor=s.cursor, display=s.display, flex_basis=s.flex_basis, diff --git a/mesop/protos/ui.proto b/mesop/protos/ui.proto index 9cae56efd..69d4e03e9 100644 --- a/mesop/protos/ui.proto +++ b/mesop/protos/ui.proto @@ -228,7 +228,7 @@ message Style { optional string box_sizing = 47; optional string color = 4; optional string column_gap = 33; - optional int32 columns = 5; + optional string columns = 5; optional string cursor = 46; optional string display = 6; optional string flex_basis = 7;