Sha256: 11019e68a6ae81dd6862d71190a9bb61c6a7f41d6aab8ad0be9932431cec5044

Contents?: true

Size: 1.29 KB

Versions: 1

Compression:

Stored size: 1.29 KB

Contents

# frozen_string_literal: true

module Primer
  # :nodoc:
  module Deprecations
    # If there is no alternative to suggest, set the value to nil
    DEPRECATED_COMPONENTS = {
      "Primer::Alpha::AutoComplete" => "Primer::Beta::AutoComplete",
      "Primer::Alpha::AutoComplete::Item" => "Primer::Beta::AutoComplete::Item",
      "Primer::BaseButton" => "Primer::Beta::BaseButton",
      "Primer::BlankslateComponent" => "Primer::Beta::Blankslate",
      "Primer::BoxComponent" => "Primer::Box",
      "Primer::ButtonGroup" => "Primer::Beta::ButtonGroup",
      "Primer::CloseButton" => "Primer::Beta::CloseButton",
      "Primer::CounterComponent" => "Primer::Beta::Counter",
      "Primer::DetailsComponent" => "Primer::Beta::Details",
      "Primer::DropdownMenuComponent" => nil,
      "Primer::FlexComponent" => nil,
      "Primer::FlexItemComponent" => nil,
      "Primer::HeadingComponent" => "Primer::Beta::Heading",
      "Primer::HiddenTextExpander" => "Primer::Alpha::HiddenTextExpander",
      "Primer::Tooltip" => "Primer::Alpha::Tooltip"
    }.freeze

    def self.deprecated?(name)
      DEPRECATED_COMPONENTS.key?(name)
    end

    def self.suggested_component(name)
      DEPRECATED_COMPONENTS[name]
    end

    def self.correctable?(name)
      !suggested_component(name).nil?
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
primer_view_components-0.0.94 lib/primer/deprecations.rb