Skip to content

Commit

Permalink
chore: sync API #1007
Browse files Browse the repository at this point in the history
  • Loading branch information
mturoci committed Feb 14, 2022
1 parent 107d003 commit 003995f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
22 changes: 11 additions & 11 deletions py/h2o_wave/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -890,44 +890,44 @@ def __init__(
type: Optional[str] = None,
text: Optional[str] = None,
name: Optional[str] = None,
buttons: Optional[List['Component']] = None,
width: Optional[str] = None,
visible: Optional[bool] = None,
buttons: Optional[List['Component']] = None,
):
_guard_enum('MessageBar.type', type, _MessageBarType, True)
_guard_scalar('MessageBar.text', text, (str,), False, True, False)
_guard_scalar('MessageBar.name', name, (str,), False, True, False)
_guard_vector('MessageBar.buttons', buttons, (Component,), False, True, False)
_guard_scalar('MessageBar.width', width, (str,), False, True, False)
_guard_scalar('MessageBar.visible', visible, (bool,), False, True, False)
_guard_vector('MessageBar.buttons', buttons, (Component,), False, True, False)
self.type = type
"""The icon and color of the message bar. One of 'info', 'error', 'warning', 'success', 'danger', 'blocked'. See enum h2o_wave.ui.MessageBarType."""
self.text = text
"""The text displayed on the message bar."""
self.name = name
"""An identifying name for this component."""
self.buttons = buttons
"""Specify one or more action buttons."""
self.width = width
"""The width of the message bar, e.g. '100px'. Defaults to '100%'."""
self.visible = visible
"""True if the component should be visible. Defaults to True."""
self.buttons = buttons
"""Specify one or more action buttons."""

def dump(self) -> Dict:
"""Returns the contents of this object as a dict."""
_guard_enum('MessageBar.type', self.type, _MessageBarType, True)
_guard_scalar('MessageBar.text', self.text, (str,), False, True, False)
_guard_scalar('MessageBar.name', self.name, (str,), False, True, False)
_guard_vector('MessageBar.buttons', self.buttons, (Component,), False, True, False)
_guard_scalar('MessageBar.width', self.width, (str,), False, True, False)
_guard_scalar('MessageBar.visible', self.visible, (bool,), False, True, False)
_guard_vector('MessageBar.buttons', self.buttons, (Component,), False, True, False)
return _dump(
type=self.type,
text=self.text,
name=self.name,
buttons=None if self.buttons is None else [__e.dump() for __e in self.buttons],
width=self.width,
visible=self.visible,
buttons=None if self.buttons is None else [__e.dump() for __e in self.buttons],
)

@staticmethod
Expand All @@ -939,25 +939,25 @@ def load(__d: Dict) -> 'MessageBar':
_guard_scalar('MessageBar.text', __d_text, (str,), False, True, False)
__d_name: Any = __d.get('name')
_guard_scalar('MessageBar.name', __d_name, (str,), False, True, False)
__d_buttons: Any = __d.get('buttons')
_guard_vector('MessageBar.buttons', __d_buttons, (dict,), False, True, False)
__d_width: Any = __d.get('width')
_guard_scalar('MessageBar.width', __d_width, (str,), False, True, False)
__d_visible: Any = __d.get('visible')
_guard_scalar('MessageBar.visible', __d_visible, (bool,), False, True, False)
__d_buttons: Any = __d.get('buttons')
_guard_vector('MessageBar.buttons', __d_buttons, (dict,), False, True, False)
type: Optional[str] = __d_type
text: Optional[str] = __d_text
name: Optional[str] = __d_name
buttons: Optional[List['Component']] = None if __d_buttons is None else [Component.load(__e) for __e in __d_buttons]
width: Optional[str] = __d_width
visible: Optional[bool] = __d_visible
buttons: Optional[List['Component']] = None if __d_buttons is None else [Component.load(__e) for __e in __d_buttons]
return MessageBar(
type,
text,
name,
buttons,
width,
visible,
buttons,
)


Expand Down Expand Up @@ -8406,7 +8406,7 @@ def __init__(
self.type = type
"""The icon and color of the notification bar. Defaults to 'info'. One of 'info', 'error', 'warning', 'success', 'danger', 'blocked'. See enum h2o_wave.ui.NotificationBarType."""
self.timeout = timeout
"""When should the notification bar disappear in seconds. Defaults to 5."""
"""How long the notification stays visible, in seconds. Defaults to 5."""
self.buttons = buttons
"""Specify one or more action buttons."""
self.position = position
Expand Down
8 changes: 4 additions & 4 deletions py/h2o_wave/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,9 +349,9 @@ def message_bar(
type: Optional[str] = None,
text: Optional[str] = None,
name: Optional[str] = None,
buttons: Optional[List[Component]] = None,
width: Optional[str] = None,
visible: Optional[bool] = None,
buttons: Optional[List[Component]] = None,
) -> Component:
"""Create a message bar.
Expand All @@ -363,19 +363,19 @@ def message_bar(
type: The icon and color of the message bar. One of 'info', 'error', 'warning', 'success', 'danger', 'blocked'. See enum h2o_wave.ui.MessageBarType.
text: The text displayed on the message bar.
name: An identifying name for this component.
buttons: Specify one or more action buttons.
width: The width of the message bar, e.g. '100px'. Defaults to '100%'.
visible: True if the component should be visible. Defaults to True.
buttons: Specify one or more action buttons.
Returns:
A `h2o_wave.types.MessageBar` instance.
"""
return Component(message_bar=MessageBar(
type,
text,
name,
buttons,
width,
visible,
buttons,
))


Expand Down Expand Up @@ -2977,7 +2977,7 @@ def notification_bar(
Args:
text: The text displayed on the notification bar.
type: The icon and color of the notification bar. Defaults to 'info'. One of 'info', 'error', 'warning', 'success', 'danger', 'blocked'. See enum h2o_wave.ui.NotificationBarType.
timeout: When should the notification bar disappear in seconds. Defaults to 5.
timeout: How long the notification stays visible, in seconds. Defaults to 5.
buttons: Specify one or more action buttons.
position: Specify the location of notification. Defaults to 'top-right'. One of 'top-right', 'bottom-right', 'bottom-center', 'bottom-left', 'top-left', 'top-center'. See enum h2o_wave.ui.NotificationBarPosition.
events: The events to capture on this notification bar.
Expand Down
14 changes: 7 additions & 7 deletions r/R/ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -429,31 +429,31 @@ ui_progress <- function(
#' One of 'info', 'error', 'warning', 'success', 'danger', 'blocked'. See enum h2o_wave.ui.MessageBarType.
#' @param text The text displayed on the message bar.
#' @param name An identifying name for this component.
#' @param buttons Specify one or more action buttons.
#' @param width The width of the message bar, e.g. '100px'. Defaults to '100%'.
#' @param visible True if the component should be visible. Defaults to True.
#' @param buttons Specify one or more action buttons.
#' @return A MessageBar instance.
#' @export
ui_message_bar <- function(
type = NULL,
text = NULL,
name = NULL,
buttons = NULL,
width = NULL,
visible = NULL) {
visible = NULL,
buttons = NULL) {
# TODO Validate type
.guard_scalar("text", "character", text)
.guard_scalar("name", "character", name)
.guard_vector("buttons", "WaveComponent", buttons)
.guard_scalar("width", "character", width)
.guard_scalar("visible", "logical", visible)
.guard_vector("buttons", "WaveComponent", buttons)
.o <- list(message_bar=list(
type=type,
text=text,
name=name,
buttons=buttons,
width=width,
visible=visible))
visible=visible,
buttons=buttons))
class(.o) <- append(class(.o), c(.wave_obj, "WaveComponent"))
return(.o)
}
Expand Down Expand Up @@ -3437,7 +3437,7 @@ ui_markup_card <- function(
#' @param text The text displayed on the notification bar.
#' @param type The icon and color of the notification bar. Defaults to 'info'.
#' One of 'info', 'error', 'warning', 'success', 'danger', 'blocked'. See enum h2o_wave.ui.NotificationBarType.
#' @param timeout When should the notification bar disappear in seconds. Defaults to 5.
#' @param timeout How long the notification stays visible, in seconds. Defaults to 5.
#' @param buttons Specify one or more action buttons.
#' @param position Specify the location of notification. Defaults to 'top-right'.
#' One of 'top-right', 'bottom-right', 'bottom-center', 'bottom-left', 'top-left', 'top-center'. See enum h2o_wave.ui.NotificationBarPosition.
Expand Down

0 comments on commit 003995f

Please sign in to comment.