Class: Yattho::YARD::ComponentManifest

Inherits:
Object
  • Object
show all
Defined in:
lib/yattho/yard/component_manifest.rb

Overview

The set of documented components (and associated metadata).

Constant Summary collapse

COMPONENTS =
{
  Yattho::Beta::RelativeTime => {},
  Yattho::Beta::IconButton => {},
  Yattho::Beta::Button => {},
  Yattho::Alpha::SegmentedControl => {},
  Yattho::Alpha::Layout => {},
  Yattho::Alpha::HellipButton => {},
  Yattho::Alpha::Image => {},
  Yattho::LocalTime => { js: true },
  Yattho::Alpha::OcticonSymbols => {},
  Yattho::Alpha::ImageCrop => { js: true },
  Yattho::IconButton => { js: true },
  Yattho::Beta::AutoComplete => { js: true },
  Yattho::Beta::AutoComplete::Item => {},
  Yattho::Beta::Avatar => {},
  Yattho::Beta::AvatarStack => {},
  Yattho::Beta::BaseButton => {},
  Yattho::Alpha::Banner => { js: true },
  Yattho::Beta::Blankslate => {},
  Yattho::Beta::BorderBox => {},
  Yattho::Beta::BorderBox::Header => {},
  Yattho::Box => {},
  Yattho::Beta::Breadcrumbs => {},
  Yattho::ButtonComponent => { js: true },
  Yattho::Beta::ButtonGroup => {},
  Yattho::Alpha::ButtonMarketing => {},
  Yattho::Beta::ClipboardCopy => { js: true },
  Yattho::Beta::CloseButton => {},
  Yattho::Beta::Counter => {},
  Yattho::Beta::Details => {},
  Yattho::Alpha::Dialog => {},
  Yattho::Alpha::Dropdown => { js: true },
  Yattho::Beta::Flash => {},
  Yattho::Beta::Heading => {},
  Yattho::Alpha::HiddenTextExpander => {},
  Yattho::Beta::Label => {},
  Yattho::LayoutComponent => {},
  Yattho::Beta::Link => { js: true },
  Yattho::Beta::Markdown => {},
  Yattho::Alpha::Menu => {},
  Yattho::Navigation::TabComponent => {},
  Yattho::Beta::Octicon => {},
  Yattho::Beta::Popover => {},
  Yattho::Beta::ProgressBar => {},
  Yattho::Beta::State => {},
  Yattho::Beta::Spinner => {},
  Yattho::Beta::Subhead => {},
  Yattho::Alpha::TabContainer => { js: true },
  Yattho::Beta::Text => {},
  Yattho::TimeAgoComponent => { js: true },
  Yattho::Beta::TimelineItem => {},
  Yattho::Tooltip => {},
  Yattho::Truncate => {},
  Yattho::Beta::Truncate => {},
  Yattho::Alpha::UnderlineNav => {},
  Yattho::Alpha::UnderlinePanels => { js: true },
  Yattho::Alpha::TabNav => {},
  Yattho::Alpha::TabPanels => { js: true },
  Yattho::Alpha::Tooltip => { js: true },
  Yattho::Alpha::ToggleSwitch => { js: true },

  # Examples can be seen in the NavList docs
  Yattho::Alpha::NavList => { js: true },
  Yattho::Alpha::NavList::Item => { js: true, examples: false },
  Yattho::Alpha::NavList::Section => { js: true, examples: false },

  # ActionList is a base component that should not be used by itself, and thus
  # does not have examples of its own
  Yattho::Alpha::ActionList => { js: true, examples: false },
  Yattho::Alpha::ActionList::Divider => { examples: false },
  Yattho::Alpha::ActionList::Heading => { examples: false },
  Yattho::Alpha::ActionList::Item => { examples: false },

  # Forms
  Yattho::Alpha::TextField => { form_component: true }
}.freeze

Class Method Summary collapse

Class Method Details

.all_componentsObject



94
95
96
# File 'lib/yattho/yard/component_manifest.rb', line 94

def all_components
  @all_components ||= Yattho::Component.descendants - [Yattho::BaseComponent]
end

.components_requiring_jsObject



108
109
110
111
112
# File 'lib/yattho/yard/component_manifest.rb', line 108

def components_requiring_js
  @components_requiring_js ||= COMPONENTS.keys.select do |c|
    COMPONENTS[c].fetch(:js, false)
  end
end

.components_with_docsObject



90
91
92
# File 'lib/yattho/yard/component_manifest.rb', line 90

def components_with_docs
  @components_with_docs ||= COMPONENTS.keys
end

.components_with_examplesObject



102
103
104
105
106
# File 'lib/yattho/yard/component_manifest.rb', line 102

def components_with_examples
  @components_with_examples ||= COMPONENTS.keys.select do |c|
    COMPONENTS[c].fetch(:examples, true)
  end
end

.components_without_docsObject



98
99
100
# File 'lib/yattho/yard/component_manifest.rb', line 98

def components_without_docs
  @components_without_docs ||= all_components - components_with_docs
end

.each(&block) ⇒ Object



86
87
88
# File 'lib/yattho/yard/component_manifest.rb', line 86

def each(&block)
  COMPONENTS.keys.each(&block)
end

.form_componentsObject



114
115
116
117
118
# File 'lib/yattho/yard/component_manifest.rb', line 114

def form_components
  @form_components ||= COMPONENTS.keys.select do |c|
    COMPONENTS[c].fetch(:form_component, false)
  end
end