Skip to content

Commit

Permalink
Rename base component
Browse files Browse the repository at this point in the history
  • Loading branch information
kirillplatonov committed Jan 24, 2022
1 parent 851709d commit 9dc41e3
Show file tree
Hide file tree
Showing 95 changed files with 108 additions and 108 deletions.
2 changes: 1 addition & 1 deletion app/components/polaris/action_list/item_component.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Polaris::ActionList::ItemComponent < Polaris::NewComponent
class Polaris::ActionList::ItemComponent < Polaris::Component
renders_one :prefix
renders_one :suffix

Expand Down
2 changes: 1 addition & 1 deletion app/components/polaris/action_list/section_component.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Polaris::ActionList::SectionComponent < Polaris::NewComponent
class Polaris::ActionList::SectionComponent < Polaris::Component
renders_many :items, Polaris::ActionList::ItemComponent

def initialize(position: 1, title: nil, **system_arguments)
Expand Down
2 changes: 1 addition & 1 deletion app/components/polaris/action_list_component.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Polaris
class ActionListComponent < Polaris::NewComponent
class ActionListComponent < Polaris::Component
renders_many :items, Polaris::ActionList::ItemComponent
renders_many :sections, ->(**system_arguments) do
@counter += 1
Expand Down
2 changes: 1 addition & 1 deletion app/components/polaris/autocomplete/action_component.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Polaris
class Autocomplete::ActionComponent < NewComponent
class Autocomplete::ActionComponent < Component
def initialize(**system_arguments)
@system_arguments = system_arguments
end
Expand Down
2 changes: 1 addition & 1 deletion app/components/polaris/autocomplete/option_component.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Polaris
class Autocomplete::OptionComponent < NewComponent
class Autocomplete::OptionComponent < Component
def initialize(
label:,
multiple: false,
Expand Down
2 changes: 1 addition & 1 deletion app/components/polaris/autocomplete/section_component.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Polaris
class Autocomplete::SectionComponent < NewComponent
class Autocomplete::SectionComponent < Component
renders_many :options, ->(**system_arguments) do
Autocomplete::OptionComponent.new(multiple: @multiple, **system_arguments)
end
Expand Down
2 changes: 1 addition & 1 deletion app/components/polaris/autocomplete_component.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Polaris
class AutocompleteComponent < NewComponent
class AutocompleteComponent < Component
renders_one :text_field, ->(**system_arguments) do
system_arguments[:data] ||= {}
prepend_option(system_arguments[:data], :action, %w[
Expand Down
2 changes: 1 addition & 1 deletion app/components/polaris/avatar_component.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module Polaris
class AvatarComponent < Polaris::NewComponent
class AvatarComponent < Polaris::Component
SIZE_DEFAULT = :medium
SIZE_MAPPINGS = {
small: "Polaris-Avatar--sizeSmall",
Expand Down
2 changes: 1 addition & 1 deletion app/components/polaris/badge_component.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module Polaris
class BadgeComponent < Polaris::NewComponent
class BadgeComponent < Polaris::Component
PROGRESS_DEFAULT = :default
PROGRESS_MAPPINGS = {
PROGRESS_DEFAULT => "",
Expand Down
4 changes: 2 additions & 2 deletions app/components/polaris/banner_component.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module Polaris
class BannerComponent < Polaris::NewComponent
class BannerComponent < Polaris::Component
STATUS_DEFAULT = :default
STATUS_MAPPINGS = {
STATUS_DEFAULT => "",
Expand Down Expand Up @@ -72,7 +72,7 @@ def default_icon(status)
end
end

class SecondaryAction < Polaris::NewComponent
class SecondaryAction < Polaris::Component
def initialize(**system_arguments)
@system_arguments = system_arguments
end
Expand Down
2 changes: 1 addition & 1 deletion app/components/polaris/base_button.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module Polaris
class BaseButton < Polaris::NewComponent
class BaseButton < Polaris::Component
def initialize(
url: nil,
external: false,
Expand Down
2 changes: 1 addition & 1 deletion app/components/polaris/base_checkbox.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Polaris
class BaseCheckbox < Polaris::NewComponent
class BaseCheckbox < Polaris::Component
def initialize(
form: nil,
attribute: nil,
Expand Down
2 changes: 1 addition & 1 deletion app/components/polaris/base_component.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module Polaris
class BaseComponent < Polaris::NewComponent
class BaseComponent < Polaris::Component
def initialize(tag:, classes: nil, **system_arguments)
@tag = tag
@system_arguments = system_arguments
Expand Down
2 changes: 1 addition & 1 deletion app/components/polaris/base_radio_button.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Polaris
class BaseRadioButton < Polaris::NewComponent
class BaseRadioButton < Polaris::Component
def initialize(
form: nil,
attribute: nil,
Expand Down
6 changes: 3 additions & 3 deletions app/components/polaris/button_group_component.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module Polaris
class ButtonGroupComponent < Polaris::NewComponent
class ButtonGroupComponent < Polaris::Component
SPACING_DEFAULT = :default
SPACING_MAPPINGS = {
SPACING_DEFAULT => "",
Expand Down Expand Up @@ -63,7 +63,7 @@ def ordered_items
all_items.sort_by(&:position)
end

class ButtonGroupItemButtonComponent < Polaris::NewComponent
class ButtonGroupItemButtonComponent < Polaris::Component
attr_reader :position

def initialize(position:, **system_arguments)
Expand All @@ -87,7 +87,7 @@ def call
end
end

class ButtonGroupItemComponent < Polaris::NewComponent
class ButtonGroupItemComponent < Polaris::Component
attr_reader :position

def initialize(position:, **system_arguments)
Expand Down
2 changes: 1 addition & 1 deletion app/components/polaris/callout_card_component.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module Polaris
class CalloutCardComponent < Polaris::NewComponent
class CalloutCardComponent < Polaris::Component
renders_one :primary_action, Polaris::ButtonComponent
renders_one :secondary_action, ->(plain: true, **system_arguments) do
Polaris::ButtonComponent.new(plain: plain, **system_arguments)
Expand Down
2 changes: 1 addition & 1 deletion app/components/polaris/caption_component.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module Polaris
class CaptionComponent < Polaris::NewComponent
class CaptionComponent < Polaris::Component
def initialize(**system_arguments)
@system_arguments = system_arguments
@system_arguments[:tag] = "p"
Expand Down
2 changes: 1 addition & 1 deletion app/components/polaris/card/header_component.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Polaris::Card::HeaderComponent < Polaris::NewComponent
class Polaris::Card::HeaderComponent < Polaris::Component
def initialize(
title: "",
actions: [],
Expand Down
4 changes: 2 additions & 2 deletions app/components/polaris/card/section_component.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Polaris::Card::SectionComponent < Polaris::NewComponent
class Polaris::Card::SectionComponent < Polaris::Component
renders_many :subsections, "Polaris::Card::SubsectionComponent"

def initialize(
Expand Down Expand Up @@ -28,7 +28,7 @@ def initialize(
@actions = actions.map { |a| a.merge(plain: true) }
end

class Polaris::Card::SubsectionComponent < Polaris::NewComponent
class Polaris::Card::SubsectionComponent < Polaris::Component
def initialize(**system_arguments)
@system_arguments = system_arguments
@system_arguments[:tag] = :div
Expand Down
2 changes: 1 addition & 1 deletion app/components/polaris/card_component.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module Polaris
class CardComponent < Polaris::NewComponent
class CardComponent < Polaris::Component
FOOTER_ACTION_ALIGNMENT_DEFAULT = :right
FOOTER_ACTION_ALIGNMENT_MAPPINGS = {
FOOTER_ACTION_ALIGNMENT_DEFAULT => "",
Expand Down
2 changes: 1 addition & 1 deletion app/components/polaris/checkbox_component.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module Polaris
class CheckboxComponent < Polaris::NewComponent
class CheckboxComponent < Polaris::Component
include ActiveModel::Validations

attr_reader :checked
Expand Down
2 changes: 1 addition & 1 deletion app/components/polaris/choice_component.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module Polaris
class ChoiceComponent < Polaris::NewComponent
class ChoiceComponent < Polaris::Component
def initialize(
label:,
label_hidden:,
Expand Down
2 changes: 1 addition & 1 deletion app/components/polaris/choice_list_component.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module Polaris
class ChoiceListComponent < Polaris::NewComponent
class ChoiceListComponent < Polaris::Component
renders_many :checkboxes, ->(value:, disabled: false, **system_arguments) do
Polaris::CheckboxComponent.new(
form: @form,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module Polaris
class NewComponent < ViewComponent::Base
class Component < ViewComponent::Base
include ClassNameHelper
include FetchOrFallbackHelper
include OptionHelper
Expand Down
2 changes: 1 addition & 1 deletion app/components/polaris/data_table/cell_component.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Polaris::DataTable::CellComponent < Polaris::NewComponent
class Polaris::DataTable::CellComponent < Polaris::Component
ALIGNMENT_DEFAULT = :top
ALIGNMENT_MAPPINGS = {
top: "Polaris-DataTable__Cell--verticalAlignTop",
Expand Down
2 changes: 1 addition & 1 deletion app/components/polaris/data_table/column_component.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Polaris::DataTable::ColumnComponent < Polaris::NewComponent
class Polaris::DataTable::ColumnComponent < Polaris::Component
SORT_DEFAULT = false
SORT_OPTIONS = [false, :asc, :desc]

Expand Down
2 changes: 1 addition & 1 deletion app/components/polaris/data_table_component.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module Polaris
class DataTableComponent < Polaris::NewComponent
class DataTableComponent < Polaris::Component
ALIGNMENT_DEFAULT = :top
ALIGNMENT_OPTIONS = [:top, :bottom, :middle, :baseline]

Expand Down
4 changes: 2 additions & 2 deletions app/components/polaris/description_list_component.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module Polaris
class DescriptionListComponent < Polaris::NewComponent
class DescriptionListComponent < Polaris::Component
SPACING_DEFAULT = :loose
SPACING_MAPPINGS = {
SPACING_DEFAULT => "",
Expand All @@ -25,7 +25,7 @@ def renders?
items.any?
end

class DescriptionListItemComponent < Polaris::NewComponent
class DescriptionListItemComponent < Polaris::Component
def initialize(term:)
@term = term
end
Expand Down
2 changes: 1 addition & 1 deletion app/components/polaris/display_text_component.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module Polaris
class DisplayTextComponent < Polaris::NewComponent
class DisplayTextComponent < Polaris::Component
ELEMENT_DEFAULT = :p
ELEMENT_OPTIONS = %i[p h1 h2 h3 h4 h5 h6]

Expand Down
2 changes: 1 addition & 1 deletion app/components/polaris/dropzone_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module Polaris
# Lets users upload files by dragging and dropping the files into an area on a page, or activating a button.
class DropzoneComponent < Polaris::NewComponent
class DropzoneComponent < Polaris::Component
include ActiveModel::Validations

SIZE_DEFAULT = :extra_large
Expand Down
2 changes: 1 addition & 1 deletion app/components/polaris/empty_state_component.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module Polaris
class EmptyStateComponent < Polaris::NewComponent
class EmptyStateComponent < Polaris::Component
WITHIN_DEFAULT = :page
WITHIN_MAPPINGS = {
WITHIN_DEFAULT => "",
Expand Down
2 changes: 1 addition & 1 deletion app/components/polaris/exception_list/item_component.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Polaris::ExceptionList::ItemComponent < Polaris::NewComponent
class Polaris::ExceptionList::ItemComponent < Polaris::Component
STATUS_DEFAULT = :default
STATUS_MAPPINGS = {
STATUS_DEFAULT => "",
Expand Down
2 changes: 1 addition & 1 deletion app/components/polaris/exception_list_component.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module Polaris
class ExceptionListComponent < Polaris::NewComponent
class ExceptionListComponent < Polaris::Component
renders_many :items, Polaris::ExceptionList::ItemComponent

def initialize(**system_arguments)
Expand Down
6 changes: 3 additions & 3 deletions app/components/polaris/filters_component.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module Polaris
class FiltersComponent < Polaris::NewComponent
class FiltersComponent < Polaris::Component
renders_one :query, ->(**system_arguments) do
QueryComponent.new(disabled: @disabled, **system_arguments)
end
Expand Down Expand Up @@ -34,7 +34,7 @@ def items_wrapper_classes
)
end

class QueryComponent < Polaris::NewComponent
class QueryComponent < Polaris::Component
def initialize(clear_button: true, disabled: false, **system_arguments)
@disabled = disabled
@system_arguments = system_arguments.merge(
Expand All @@ -52,7 +52,7 @@ def call
end
end

class ItemComponent < Polaris::NewComponent
class ItemComponent < Polaris::Component
def initialize(label:, sectioned: true, width: nil, disabled: false, **system_arguments)
@label = label
@sectioned = sectioned
Expand Down
2 changes: 1 addition & 1 deletion app/components/polaris/footer_help_component.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module Polaris
class FooterHelpComponent < Polaris::NewComponent
class FooterHelpComponent < Polaris::Component
def initialize(**system_arguments)
@system_arguments = system_arguments
@system_arguments[:classes] = class_names(
Expand Down
4 changes: 2 additions & 2 deletions app/components/polaris/form_layout/group_component.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Polaris::FormLayout::GroupComponent < Polaris::NewComponent
class Polaris::FormLayout::GroupComponent < Polaris::Component
attr_reader :position

renders_many :items, "GroupItemComponent"
Expand All @@ -22,7 +22,7 @@ def initialize(position:, condensed: false, **system_arguments)
)
end

class GroupItemComponent < Polaris::NewComponent
class GroupItemComponent < Polaris::Component
def initialize(**system_arguments)
@system_arguments = system_arguments
@system_arguments[:tag] = "div"
Expand Down
2 changes: 1 addition & 1 deletion app/components/polaris/form_layout/item_component.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Polaris::FormLayout::ItemComponent < Polaris::NewComponent
class Polaris::FormLayout::ItemComponent < Polaris::Component
attr_reader :position

def initialize(position:, **system_arguments)
Expand Down
2 changes: 1 addition & 1 deletion app/components/polaris/form_layout_component.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module Polaris
class FormLayoutComponent < Polaris::NewComponent
class FormLayoutComponent < Polaris::Component
renders_many :items, ->(**system_arguments) do
@counter += 1
Polaris::FormLayout::ItemComponent.new(position: @counter, **system_arguments)
Expand Down
2 changes: 1 addition & 1 deletion app/components/polaris/frame/save_bar_component.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Polaris::Frame::SaveBarComponent < Polaris::NewComponent
class Polaris::Frame::SaveBarComponent < Polaris::Component
renders_one :save_action, ->(**system_arguments) do
Polaris::ButtonComponent.new(primary: true, **system_arguments)
end
Expand Down
2 changes: 1 addition & 1 deletion app/components/polaris/frame/top_bar_component.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Polaris::Frame::TopBarComponent < Polaris::NewComponent
class Polaris::Frame::TopBarComponent < Polaris::Component
renders_one :user_menu, Polaris::TopBar::UserMenuComponent

def initialize(logo:, **system_arguments)
Expand Down
2 changes: 1 addition & 1 deletion app/components/polaris/frame_component.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Polaris
class FrameComponent < Polaris::NewComponent
class FrameComponent < Polaris::Component
renders_one :top_bar, ->(**system_arguments) do
Polaris::Frame::TopBarComponent.new(logo: @logo, **system_arguments)
end
Expand Down
Loading

0 comments on commit 9dc41e3

Please sign in to comment.