Skip to content

Commit

Permalink
Introduce SystemArguments; only focus on SelectPanel for now
Browse files Browse the repository at this point in the history
  • Loading branch information
camertron committed Oct 8, 2024
1 parent 7edb004 commit a99b196
Show file tree
Hide file tree
Showing 139 changed files with 68 additions and 3,134 deletions.
16 changes: 8 additions & 8 deletions app/components/primer/alpha/select_panel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ def with_avatar_item(**system_arguments)

alias show_filter? show_filter

# @param src [String, nil] The URL to fetch search results from.
# @param src [String, NilClass] The URL to fetch search results from.
# @param title [String] The title that appears at the top of the panel.
# @param id [String] The unique ID of the panel.
# @param size [Symbol] The size of the panel. <%= one_of(Primer::Alpha::Overlay::SIZE_OPTIONS) %>
Expand All @@ -371,19 +371,19 @@ def with_avatar_item(**system_arguments)
# @param no_results_label [String] The label to display when no results are found.
# @param preload [Boolean] Whether to preload search results when the page loads. If this option is false, results are loaded when the panel is opened.
# @param dynamic_label [Boolean] Whether or not to display the text of the currently selected item in the show button.
# @param dynamic_label_prefix [String, nil] If provided, the prefix is prepended to the dynamic label and displayed in the show button.
# @param dynamic_aria_label_prefix [String, nil] If provided, the prefix is prepended to the dynamic label and set as the value of the `aria-label` attribute on the show button.
# @param body_id [String, nil] The unique ID of the panel body. If not provided, the body ID will be set to the panel ID with a "-body" suffix.
# @param list_arguments [Hash] Arguments to pass to the underlying <%= link_to_component(Primer::Alpha::ActionList) %> component. Only has an effect for the local fetch strategy.
# @param form_arguments [Hash] Form arguments to pass to the underlying <%= link_to_component(Primer::Alpha::ActionList) %> component. Only has an effect for the local fetch strategy.
# @param dynamic_label_prefix [String, NilClass] If provided, the prefix is prepended to the dynamic label and displayed in the show button.
# @param dynamic_aria_label_prefix [String, NilClass] If provided, the prefix is prepended to the dynamic label and set as the value of the `aria-label` attribute on the show button.
# @param body_id [String, NilClass] The unique ID of the panel body. If not provided, the body ID will be set to the panel ID with a "-body" suffix.
# @param list_arguments [SystemArguments] Arguments to pass to the underlying <%= link_to_component(Primer::Alpha::ActionList) %> component. Only has an effect for the local fetch strategy.
# @param form_arguments [SystemArguments] Form arguments to pass to the underlying <%= link_to_component(Primer::Alpha::ActionList) %> component. Only has an effect for the local fetch strategy.
# @param show_filter [Boolean] Whether or not to show the filter input.
# @param open_on_load [Boolean] Open the panel when the page loads.
# @param anchor_align [Symbol] The anchor alignment of the Overlay. <%= one_of(Primer::Alpha::Overlay::ANCHOR_ALIGN_OPTIONS) %>
# @param anchor_side [Symbol] The side to anchor the Overlay to. <%= one_of(Primer::Alpha::Overlay::ANCHOR_SIDE_OPTIONS) %>
# @param loading_label [String] The aria-label to use when the panel is loading, defaults to 'Loading content...'.
# @param loading_description [String, nil] The description to use when the panel is loading. If not provided, no description will be used.
# @param loading_description [String, NilClass] The description to use when the panel is loading. If not provided, no description will be used.
# @param banner_scheme [Symbol] The scheme for the error banner <%= one_of(Primer::Alpha::SelectPanel::BANNER_SCHEME_OPTIONS) %>
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
# @param system_arguments [SystemArguments] <%= link_to_system_arguments_docs %>
def initialize(
src: nil,
title: "Menu",
Expand Down
7 changes: 1 addition & 6 deletions app/components/primer/component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,8 @@

require "view_component/version"

# :nodoc:
module Primer
extend T::Sig

SystemArguments = T.type_alias do
Hash[T.any(Symbol, String), T.any(String, Numeric)]
end

# @private
# :nocov:
class Component < ViewComponent::Base
Expand Down
28 changes: 28 additions & 0 deletions demo/sorbet/rbi/custom/system_arguments.rbi
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
SystemArguments = T.type_alias do
T::Hash[
# key
T.any(Symbol, String),

# value
T.any(
Symbol,
String,
Numeric,

# aria: { ... } and data: { ... }
T::Hash[
# key (:aria, "aria", :data, or "data")
T.any(Symbol, String),

# value (possibly a nested hash)
T.any(Symbol, String, T::Hash[
# key inside aria or data hash
T.any(Symbol, String),

# value
T.any(Symbol, String, Numeric)
])
]
)
]
end
17 changes: 0 additions & 17 deletions demo/sorbet/rbi/dsl/lookbook/button/component.rbi

This file was deleted.

17 changes: 0 additions & 17 deletions demo/sorbet/rbi/dsl/lookbook/button_group/component.rbi

This file was deleted.

17 changes: 0 additions & 17 deletions demo/sorbet/rbi/dsl/lookbook/display_options/editor/component.rbi

This file was deleted.

17 changes: 0 additions & 17 deletions demo/sorbet/rbi/dsl/lookbook/icon_button/component.rbi

This file was deleted.

26 changes: 0 additions & 26 deletions demo/sorbet/rbi/dsl/lookbook/nav/component.rbi

This file was deleted.

17 changes: 0 additions & 17 deletions demo/sorbet/rbi/dsl/lookbook/page_tabs/component.rbi

This file was deleted.

17 changes: 0 additions & 17 deletions demo/sorbet/rbi/dsl/lookbook/params/editor/component.rbi

This file was deleted.

17 changes: 0 additions & 17 deletions demo/sorbet/rbi/dsl/lookbook/split_layout/component.rbi

This file was deleted.

17 changes: 0 additions & 17 deletions demo/sorbet/rbi/dsl/lookbook/tab_panels/component.rbi

This file was deleted.

26 changes: 0 additions & 26 deletions demo/sorbet/rbi/dsl/lookbook/tabs/component.rbi

This file was deleted.

17 changes: 0 additions & 17 deletions demo/sorbet/rbi/dsl/lookbook/text_button/component.rbi

This file was deleted.

17 changes: 0 additions & 17 deletions demo/sorbet/rbi/dsl/lookbook/toolbar/component.rbi

This file was deleted.

20 changes: 0 additions & 20 deletions demo/sorbet/rbi/dsl/primer/alpha/action_bar.rbi

This file was deleted.

11 changes: 0 additions & 11 deletions demo/sorbet/rbi/dsl/primer/alpha/action_bar/divider.rbi

This file was deleted.

11 changes: 0 additions & 11 deletions demo/sorbet/rbi/dsl/primer/alpha/action_bar/item.rbi

This file was deleted.

Loading

0 comments on commit a99b196

Please sign in to comment.