Skip to content
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

feat: better deephaven ui button defaults #613

Merged
merged 6 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions plugins/ui/src/deephaven/ui/components/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
KeyboardEventCallable,
PressEventCallable,
StaticColor,
ElementTypes,
# Layout
AlignSelf,
CSSProperties,
Expand All @@ -28,8 +27,8 @@

def button(
*children: Any,
variant: ButtonVariant | None = None,
style: ButtonStyle | None = None,
variant: ButtonVariant | None = "accent",
style: ButtonStyle | None = "fill",
static_color: StaticColor | None = None,
is_pending: bool | None = None,
type: ButtonType = "button",
Expand All @@ -38,7 +37,6 @@ def button(
href: str | None = None,
target: str | None = None,
rel: str | None = None,
element_type: ElementTypes = "button",
on_press: PressEventCallable | None = None,
on_press_start: PressEventCallable | None = None,
on_press_end: PressEventCallable | None = None,
Expand Down Expand Up @@ -111,7 +109,7 @@ def button(
type: The behavior of the button when used in an HTML form.
is_disabled: Whether the button is disabled.
auto_focus: Whether the button should automatically receive focus when the page loads.
href: A URL to link to if elementType="a".
href: A URL to link to when the button is pressed.
target: The target window or tab to open the linked URL in.
rel: The relationship between the current document and the linked URL.
on_press: Function called when the button is pressed.
Expand Down Expand Up @@ -187,6 +185,9 @@ def button(
href=href,
target=target,
rel=rel,
# intentionally not exposing element_type to the user
# for href links we can handle on their behalf
element_type=None if href is None else "a",
on_press=on_press,
on_press_start=on_press_start,
on_press_end=on_press_end,
Expand Down
4 changes: 1 addition & 3 deletions plugins/ui/src/deephaven/ui/components/types/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,7 @@ class SliderChange(TypedDict):
StaticColor = Literal["white", "black"]
ButtonType = Literal["button", "submit", "reset"]
ButtonLabelBehavior = Literal["show", "collapse", "hide"]
ButtonVariant = Literal[
"accent", "primary", "secondary", "negative", "cta", "overBackground"
]
ButtonVariant = Literal["accent", "primary", "secondary", "negative"]
ButtonStyle = Literal["fill", "outline"]
ElementTypes = Literal["div", "button", "a"]
Orientation = Literal["horizontal", "vertical"]
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading