diff --git a/plugins/ui/src/deephaven/ui/components/picker.py b/plugins/ui/src/deephaven/ui/components/picker.py index f060b2ee4..1815ab90f 100644 --- a/plugins/ui/src/deephaven/ui/components/picker.py +++ b/plugins/ui/src/deephaven/ui/components/picker.py @@ -7,8 +7,16 @@ from ..elements import BaseElement from .._internal.utils import create_props from ..types import ColumnName, Key +from spectrum.layout import * +from spectrum.validate import * +from spectrum.events import * + +# from spectrum.layout import Align, DimensionValue, LabelPosition, LayoutFlex, AlignSelf, JustifySelf, Number, Position, CSSProperties +# from spectrum.validate import NecessityIndicator +# from spectrum.events import FocusEventCallable, KeyboardEventCallable PickerElement = BaseElement +PickerDirection = Literal["bottom", "top"] def picker( @@ -22,7 +30,84 @@ def picker( selected_key: Key | None = None, on_selection_change: Callable[[Key], None] | None = None, on_change: Callable[[Key], None] | None = None, - **props: Any, + is_quiet: bool | None = None, + align: Align | None = None, + direction: PickerDirection = "bottom", + should_flip: bool = True, + menu_width: DimensionValue | None = None, + auto_focus: bool | None = None, + auto_complete: str | None = None, + name: str | None = None, + is_open: bool | None = None, + default_open: bool | None = None, + # items, # omitted because we don't take in Iterable type + # disabled_keys # omitted because we don't take in Iterable type, + is_disabled: bool | None = None, + is_required: bool | None = None, + is_invalid: bool | None = None, + # validation_behaviour, # omitted because validate is not implemented + # validate, # omitted because it needs to return a ValidationError synchronously + description: Any | None = None, + # error_message, # omitted because it needs to return a value synchronously + label: Any | None = None, + placeholder: str | None = None, + is_loading: bool | None = None, + label_position: LabelPosition = "top", + label_align: Align = "start", + necessity_indicator: NecessityIndicator = "icon", + contextual_help: Any | None = None, + on_open_change: Callable[[bool], None] | None = None, + # on_selection_change, # omitted because it needs to return a value synchronously + on_focus: FocusEventCallable | None = None, + on_blur: FocusEventCallable | None = None, + on_focus_change: Callable[[bool], None] | None = None, + on_key_down: KeyboardEventCallable | None = None, + on_key_up: KeyboardEventCallable | None = None, + # on_load_more, # omitted because it needs to return a value synchronously + flex: LayoutFlex | None = None, + flex_grow: Number | None = None, + flex_shrink: Number | None = None, + flex_basis: DimensionValue | None = None, + align_self: AlignSelf | None = None, + justify_self: JustifySelf | None = None, + order: Number | None = None, + grid_area: str | None = None, + grid_row: str | None = None, + grid_row_start: str | None = None, + grid_row_end: str | None = None, + grid_column: str | None = None, + grid_column_start: str | None = None, + grid_column_end: str | None = None, + margin: DimensionValue | None = None, + margin_top: DimensionValue | None = None, + margin_bottom: DimensionValue | None = None, + margin_start: DimensionValue | None = None, + margin_end: DimensionValue | None = None, + margin_x: DimensionValue | None = None, + margin_y: DimensionValue | None = None, + width: DimensionValue | None = None, + height: DimensionValue | None = None, + min_width: DimensionValue | None = None, + min_height: DimensionValue | None = None, + max_width: DimensionValue | None = None, + max_height: DimensionValue | None = None, + position: Position | None = None, + top: DimensionValue | None = None, + bottom: DimensionValue | None = None, + start: DimensionValue | None = None, + end: DimensionValue | None = None, + left: DimensionValue | None = None, + right: DimensionValue | None = None, + z_index: Number | None = None, + is_hidden: bool | None = None, + id: str | None = None, + exclude_from_tab_order: bool | None = None, + aria_label: str | None = None, + aria_labelledby: str | None = None, + aria_describedby: str | None = None, + aria_details: str | None = None, + UNSAFE_class_name: str | None = None, + UNSAFE_style: CSSProperties | None = None, ) -> PickerElement: """ A picker that can be used to select from a list. Children should be one of four types: @@ -59,9 +144,78 @@ def picker( Handler that is called when the selection changes. on_change: Alias of `on_selection_change`. Handler that is called when the selection changes. - **props: - Any other Picker prop, except items. + is_quiet: Whether the textfield should be displayed with a quiet style + align: The alignment of the menu relative to the input target + direction: The direction in which the menu should open relative to the Picker + should_flip: Whether the menu should flip when it reaches the viewport bounds + menu_width: The width of the menu. By default, matches width of the trigger + auto_focus: Whether the input should be focused on render + auto_complete: Describes the autocomplete functionality the input should provide if any + name: The name of the input element, used when submitting an HTML form + is_open: Whether the menu is open + default_open: Whether the menu should be open by default + is_disabled: Whether the input is disabled + is_required: Whether the input is required + is_invalid: Whether the input is invalid + description: A description of the input. Provides a hint such as specific requirements for what to choose + label: The label of the input + placeholder: The placeholder of the input + is_loading: Whether the input is in a loading state + label_position: The position of the label relative to the input + label_align: The horizontal alignment of the label relative to the input + necessity_indicator: Whether the required state should be shown as icon or text + contextual_help: A help element to display next to the label + on_open_change: Handler that is called when the menu opens or closes + on_focus: Handler that is called when the input is focused + on_blur: Handler that is called when the input loses focus + on_focus_change: Handler that is called when the input is focused or loses focus + on_key_down: Handler that is called when a key is pressed down + on_key_up: Handler that is called when a key is released + flex: When used in a flex layout, specifies how the element will grow or shrink to fit the space available. + flex_grow: When used in a flex layout, specifies how the element will grow to fit the space available. + flex_shrink: When used in a flex layout, specifies how the element will shrink to fit the space available. + flex_basis: When used in a flex layout, specifies the initial main size of the element. + align_self: Overrides the alignItems property of a flex or grid container. + justify_self: Species how the element is justified inside a flex or grid container. + order: The layout order for the element within a flex or grid container. + grid_area: When used in a grid layout specifies, specifies the named grid area that the element should be placed in within the grid. + grid_row: When used in a grid layout, specifies the row the element should be placed in within the grid. + grid_column: When used in a grid layout, specifies the column the element should be placed in within the grid. + grid_row_start: When used in a grid layout, specifies the starting row to span within the grid. + grid_row_end: When used in a grid layout, specifies the ending row to span within the grid. + grid_column_start: When used in a grid layout, specifies the starting column to span within the grid. + grid_column_end: When used in a grid layout, specifies the ending column to span within the grid. + margin: The margin for all four sides of the element. + margin_top: The margin for the top side of the element. + margin_bottom: The margin for the bottom side of the element. + margin_start: The margin for the logical start side of the element, depending on layout direction. + margin_end: The margin for the logical end side of the element, depending on layout direction. + margin_x: The margin for the left and right sides of the element. + margin_y: The margin for the top and bottom sides of the element. + width: The width of the element. + min_width: The minimum width of the element. + max_width: The maximum width of the element. + height: The height of the element. + min_height: The minimum height of the element. + max_height: The maximum height of the element. + position: The position of the element. + top: The distance from the top of the containing element. + bottom: The distance from the bottom of the containing element. + left: The distance from the left of the containing element. + right: The distance from the right of the containing element. + start: The distance from the start of the containing element, depending on layout direction. + end: The distance from the end of the containing element, depending on layout direction. + z_index: The stack order of the element. + is_hidden: Whether the element is hidden. + id: The unique identifier of the element. + exclude_from_tab_order: Whether the element should be excluded from the tab order. If true, the element will not be focusable via the keyboard by tabbing. + aria_label: The label for the element. + aria_labelledby: The id of the element that labels the current element. + aria_describedby: The id of the element that describes the current element. + aria_details: The id of the element that provides additional information about the current element. + UNSAFE_class_name: A CSS class to apply to the element. + UNSAFE_style: A CSS style to apply to the element. Returns: The rendered Picker. """