Skip to content

Commit f90d2b7

Browse files
committed
Add cursor as Style property
1 parent a8d8031 commit f90d2b7

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

mesop/component_helpers/style.py

+3
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ class Style:
121121
color: Sets the color of the text inside the component. See [MDN doc](https://developer.mozilla.org/en-US/docs/Web/CSS/color).
122122
column_gap: Sets the gap between columns. See [MDN doc](https://developer.mozilla.org/en-US/docs/Web/CSS/column-gap).
123123
columns: Specifies the number of columns in a multi-column element. See [MDN doc](https://developer.mozilla.org/en-US/docs/Web/CSS/columns).
124+
cursor: Sets the mouse cursor. See [MDN doc](https://developer.mozilla.org/en-US/docs/Web/CSS/cursor).
124125
display: Defines the display type of the component. See [MDN doc](https://developer.mozilla.org/en-US/docs/Web/CSS/display).
125126
flex_basis: Specifies the initial length of a flexible item. See [MDN doc](https://developer.mozilla.org/en-US/docs/Web/CSS/flex-basis).
126127
flex_direction: Establishes the main-axis, thus defining the direction flex items are placed in the flex container. See [MDN doc](https://developer.mozilla.org/en-US/docs/Web/CSS/flex-direction).
@@ -170,6 +171,7 @@ class Style:
170171
color: str | None = None
171172
column_gap: int | str | None = None
172173
columns: int | None = None
174+
cursor: str | None = None
173175
display: Literal[
174176
# precomposed values
175177
"block",
@@ -267,6 +269,7 @@ def to_style_proto(s: Style) -> pb.Style:
267269
color=s.color,
268270
column_gap=_px_str(s.column_gap),
269271
columns=s.columns,
272+
cursor=s.cursor,
270273
display=s.display,
271274
flex_basis=s.flex_basis,
272275
flex_direction=s.flex_direction,

mesop/protos/ui.proto

+2-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ message UserDefinedType {
217217
repeated Arg args = 1;
218218
}
219219

220-
// Next id: 46
220+
// Next id: 47
221221
message Style {
222222
optional string align_content = 32;
223223
optional string align_items = 1;
@@ -228,6 +228,7 @@ message Style {
228228
optional string color = 4;
229229
optional string column_gap = 33;
230230
optional int32 columns = 5;
231+
optional string cursor = 46;
231232
optional string display = 6;
232233
optional string flex_basis = 7;
233234
optional string flex_direction = 8;

mesop/web/src/utils/styles.ts

+3
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ export function formatStyle(styleObj: Style): string {
4949
if (styleObj.getColumns()) {
5050
style += `columns: ${styleObj.getColumns()};`;
5151
}
52+
if (styleObj.getCursor()) {
53+
style += `cursor: ${styleObj.getCursor()};`;
54+
}
5255
if (styleObj.getDisplay()) {
5356
style += `display: ${styleObj.getDisplay()};`;
5457
}

0 commit comments

Comments
 (0)