Class: Anchor::Component
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Anchor::Component
- Includes:
- FetchOrFallbackHelper, ViewHelper
- Defined in:
- app/components/anchor/component.rb
Direct Known Subclasses
ActionMenuComponent, AssistiveTechNotificationsComponent, Autocomplete::ResultsComponent, AutocompleteComponent, BadgeComponent, BannerComponent, Breadcrumbs::ItemComponent, BreadcrumbsComponent, ButtonComponent, CheckBoxCollectionComponent, CheckBoxComponent, CopyToClipboardComponent, DialogComponent, ErrorMessageComponent, FaviconsComponent, FilterComponent, IconComponent, InputComponent, LabelComponent, LinkComponent, LoadingIndicatorComponent, LogoComponent, Page::BodyComponent, Page::FooterComponent, Page::HeaderComponent, PageComponent, Panel::BodyComponent, Panel::FooterComponent, Panel::HeaderComponent, PanelComponent, PopoverComponent, ProseComponent, RadioButtonCollectionComponent, RadioButtonComponent, SelectComponent, SideNavComponent, TabBar::TabComponent, TabBarComponent, Table::PaginationComponent, TableComponent, TableComponent::ColumnComponent, TextComponent, ToastComponent
Constant Summary
Constants included from ViewHelper
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(**kwargs) ⇒ Component
constructor
A new instance of Component.
Methods included from ViewHelper
#anchor_form_with, #anchor_svg, #deep_blank?, #merge_options, #popover_trigger_attributes
Methods included from FetchOrFallbackHelper
Constructor Details
#initialize(**kwargs) ⇒ Component
Returns a new instance of Component.
10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/components/anchor/component.rb', line 10 def initialize(**kwargs) classes = add_variant_classes_if_available( classes: [*kwargs.delete(:classes), *kwargs.delete(:class)], variant: kwargs.delete(:variant) ) @wrapper_options = kwargs .merge(class: classes) .reject { |_, v| deep_blank?(v) } super # rubocop:disable Anchor/AvoidImplicitSuper end |
Class Method Details
.generate_id(base_name: name.demodulize.underscore.dasherize) ⇒ Object
6 7 8 |
# File 'app/components/anchor/component.rb', line 6 def self.generate_id(base_name: name.demodulize.underscore.dasherize) "#{base_name}-#{SecureRandom.uuid}" end |