Skip to content
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
4 changes: 2 additions & 2 deletions plugins/ui/src/deephaven/ui/components/action_button.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
)

from .basic import component_element
from ..elements import Element
from ..elements import Element, NodeType

ActionButtonElement = Element


def action_button(
*children: Any,
*children: NodeType,
type: ButtonType = "button",
on_press: PressEventCallable | None = None,
on_press_start: PressEventCallable | None = None,
Expand Down
4 changes: 2 additions & 2 deletions plugins/ui/src/deephaven/ui/components/action_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
Position,
)
from .basic import component_element
from ..elements import Element
from ..elements import Element, NodeType
from ..types import ActionGroupDensity, SelectedKeys, SelectionMode, Key, Selection


def action_group(
*children: Any,
*children: NodeType,
is_emphasized: bool | None = None,
density: ActionGroupDensity | None = "regular",
is_justified: bool | None = None,
Expand Down
4 changes: 2 additions & 2 deletions plugins/ui/src/deephaven/ui/components/badge.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
Position,
)
from .basic import component_element
from ..elements import Element
from ..elements import Element, NodeType
from ..types import BadgeVariant


def badge(
*children: Any,
*children: NodeType,
variant: BadgeVariant | None = None,
flex: LayoutFlex | None = None,
flex_grow: float | None = None,
Expand Down
4 changes: 2 additions & 2 deletions plugins/ui/src/deephaven/ui/components/basic.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from __future__ import annotations
from typing import Any
from ..elements import BaseElement
from ..elements import BaseElement, NodeType

NAME_PREFIX = "deephaven.ui.components."


def component_element(name: str, /, *children: Any, **props: Any) -> BaseElement:
def component_element(name: str, /, *children: NodeType, **props: Any) -> BaseElement:
"""
Base class for UI elements.
All names are automatically prefixed with "deephaven.ui.components.", and
Expand Down
4 changes: 2 additions & 2 deletions plugins/ui/src/deephaven/ui/components/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
Position,
)
from .basic import component_element
from ..elements import Element
from ..elements import Element, NodeType


def button(
*children: Any,
*children: NodeType,
variant: ButtonVariant | None = "accent",
style: ButtonStyle | None = "fill",
static_color: StaticColor | None = None,
Expand Down
4 changes: 2 additions & 2 deletions plugins/ui/src/deephaven/ui/components/button_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
Position,
)
from .basic import component_element
from ..elements import Element
from ..elements import Element, NodeType

BUTTON_GROUP_NAME = "ButtonGroup"


def button_group(
*children: Any,
*children: NodeType,
is_disabled: bool | None = None,
orientation: Orientation = "horizontal",
align: ButtonGroupAlignment = "start",
Expand Down
4 changes: 2 additions & 2 deletions plugins/ui/src/deephaven/ui/components/checkbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
Position,
)
from .basic import component_element
from ..elements import Element
from ..elements import Element, NodeType


def checkbox(
*children: Any,
*children: NodeType,
is_emphasized: bool | None = None,
is_indeterminate: bool | None = None,
default_selected: bool | None = None,
Expand Down
4 changes: 2 additions & 2 deletions plugins/ui/src/deephaven/ui/components/checkbox_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
LabelPosition,
)
from .basic import component_element
from ..elements import Element
from ..elements import Element, NodeType
from ..types import Key, Selection


def checkbox_group(
*children: Any,
*children: NodeType,
orientation: Orientation = "vertical",
is_emphasized: bool | None = None,
value: Selection | None = None,
Expand Down
4 changes: 2 additions & 2 deletions plugins/ui/src/deephaven/ui/components/color_picker.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
from typing import Any, Callable

from .basic import component_element
from ..elements import Element
from ..elements import Element, NodeType
from ..types import CSSColor


def color_picker(
*children: Any,
*children: NodeType,
label: Any = None,
size: str = "M",
rounding: str = "default",
Expand Down
4 changes: 2 additions & 2 deletions plugins/ui/src/deephaven/ui/components/column.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

from typing import Any
from .basic import component_element
from ..elements import Element
from ..elements import Element, NodeType


def column(
*children: Any, width: float | None = None, key: str | None = None
*children: NodeType, width: float | None = None, key: str | None = None
) -> Element:
"""
A column is a container that can be used to group elements.
Expand Down
10 changes: 8 additions & 2 deletions plugins/ui/src/deephaven/ui/components/combo_box.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from typing import Callable, Any
from typing import Callable, Any, cast

from .types import (
FocusEventCallable,
Expand Down Expand Up @@ -244,6 +244,12 @@ def combo_box(

children, props = unpack_item_table_source(children, props, SUPPORTED_SOURCE_ARGS)

# Table, PartitionedTable, and ItemTableSource children are not valid React
# node types, but are passed through here because the JS side has special
# handling for these table types. Cast to the expected child type.
return component_element(
"ComboBox", *children, _nullable_props=_NULLABLE_PROPS, **props
"ComboBox",
*cast("tuple[NodeType, ...]", children),
_nullable_props=_NULLABLE_PROPS,
**props,
)
4 changes: 2 additions & 2 deletions plugins/ui/src/deephaven/ui/components/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
Position,
)
from .basic import component_element
from ..elements import Element
from ..elements import Element, NodeType

CONTENT_NAME = "Content"


def content(
*children: Any,
*children: NodeType,
flex: LayoutFlex | None = None,
flex_grow: float | None = None,
flex_shrink: float | None = None,
Expand Down
4 changes: 2 additions & 2 deletions plugins/ui/src/deephaven/ui/components/disclosure_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
Position,
)
from .basic import component_element
from ..elements import Element
from ..elements import Element, NodeType


def disclosure_panel(
*children: Any,
*children: NodeType,
flex: LayoutFlex | None = None,
flex_grow: float | None = None,
flex_shrink: float | None = None,
Expand Down
4 changes: 2 additions & 2 deletions plugins/ui/src/deephaven/ui/components/disclosure_title.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
HeadingLevel,
)
from .basic import component_element
from ..elements import Element
from ..elements import Element, NodeType


def disclosure_title(
*children: Any,
*children: NodeType,
level: HeadingLevel = 3,
flex: LayoutFlex | None = None,
flex_grow: float | None = None,
Expand Down
4 changes: 2 additions & 2 deletions plugins/ui/src/deephaven/ui/components/flex.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations
from typing import Any
from .basic import component_element
from ..elements import Element
from ..elements import Element, NodeType
from .types import (
LayoutFlex,
Direction,
Expand All @@ -18,7 +18,7 @@


def flex(
*children: Any,
*children: NodeType,
direction: Direction | None = None,
wrap: Wrap | None = None,
justify_content: JustifyContent | None = None,
Expand Down
4 changes: 2 additions & 2 deletions plugins/ui/src/deephaven/ui/components/form.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
NecessityIndicator,
)
from .basic import component_element
from ..elements import Element
from ..elements import Element, NodeType


def form(
*children: Any,
*children: NodeType,
is_quiet: bool | None = None,
is_emphasized: bool | None = None,
is_disabled: bool | None = None,
Expand Down
4 changes: 2 additions & 2 deletions plugins/ui/src/deephaven/ui/components/fragment.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

from typing import Any
from .basic import component_element
from ..elements import Element
from ..elements import Element, NodeType


def fragment(*children: Any, key: str | None = None) -> Element:
def fragment(*children: NodeType, key: str | None = None) -> Element:
"""
A React.Fragment: https://react.dev/reference/react/Fragment.
Used to group elements together without a wrapper node.
Expand Down
4 changes: 2 additions & 2 deletions plugins/ui/src/deephaven/ui/components/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
AlignItems,
)
from .basic import component_element
from ..elements import Element
from ..elements import Element, NodeType
from ..types import Undefined, UndefinedType

_NULLABLE_PROPS = ["justify_content", "align_content", "align_items"]


def grid(
*children: Any,
*children: NodeType,
areas: list[str] | None = None,
rows: str | list[DimensionValue] | None = None,
columns: str | list[DimensionValue] | None = None,
Expand Down
4 changes: 2 additions & 2 deletions plugins/ui/src/deephaven/ui/components/heading.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
)
from ..types import Color
from .basic import component_element
from ..elements import Element
from ..elements import Element, NodeType

HEADING_NAME = "Heading"


def heading(
*children: Any,
*children: NodeType,
level: HeadingLevel = 3,
color: Color | None = None,
flex: LayoutFlex | None = None,
Expand Down
Loading
Loading