diff --git a/.changeset/large-pandas-divide.md b/.changeset/large-pandas-divide.md new file mode 100644 index 0000000000..adbf16c901 --- /dev/null +++ b/.changeset/large-pandas-divide.md @@ -0,0 +1,5 @@ +--- +"@primer/view-components": patch +--- + +Remove the deprecated `Primer::DropdownMenuComponent`. diff --git a/Gemfile b/Gemfile index 19c492882c..adad0e0937 100644 --- a/Gemfile +++ b/Gemfile @@ -5,6 +5,9 @@ source "https://rubygems.org" gemspec rails_version = (ENV["RAILS_VERSION"] || "7.0.3").to_s +# remove when https://github.com/rails/rails/pull/47142 is merged +gem "rack", "~> 2.0" + gem "rack-cors" gem "rake", "~> 13.0" diff --git a/Gemfile.lock b/Gemfile.lock index f74724b630..6d0588ed5b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -262,6 +262,7 @@ DEPENDENCIES primer_view_components! pry puma (~> 5.6.4) + rack (~> 2.0) rack-cors railties (= 7.0.3) rake (~> 13.0) diff --git a/app/components/primer/dropdown_menu_component.html.erb b/app/components/primer/dropdown_menu_component.html.erb deleted file mode 100644 index db703ff8b9..0000000000 --- a/app/components/primer/dropdown_menu_component.html.erb +++ /dev/null @@ -1,8 +0,0 @@ -<%= render Primer::BaseComponent.new(**@system_arguments) do %> - <% if @header.present? %> - - <% end %> - <%= content %> -<% end %> diff --git a/app/components/primer/dropdown_menu_component.rb b/app/components/primer/dropdown_menu_component.rb deleted file mode 100644 index 0f17e80ebf..0000000000 --- a/app/components/primer/dropdown_menu_component.rb +++ /dev/null @@ -1,58 +0,0 @@ -# frozen_string_literal: true - -module Primer - # DropdownMenus are lightweight context menus for housing navigation and actions. - # They're great for instances where you don't need the full power (and code) - # of the select menu. - class DropdownMenuComponent < Primer::Component - status :deprecated - - SCHEME_DEFAULT = :default - SCHEME_MAPPINGS = { - SCHEME_DEFAULT => "", - :dark => "dropdown-menu-dark" - }.freeze - - DIRECTION_DEFAULT = :se - DIRECTION_OPTIONS = [DIRECTION_DEFAULT, :sw, :w, :e, :ne, :s].freeze - - # @example With a header - #
- # <%= render(Primer::Beta::Details.new(overlay: :default, reset: true, position: :relative)) do |component| %> - # <% component.with_summary do %> - # Dropdown - # <% end %> - # - # <% component.with_body do %> - # <%= render(Primer::DropdownMenuComponent.new(header: "Options")) do %> - # - # <% end %> - # <% end %> - # <% end %> - #
- # - # @param direction [Symbol] <%= one_of(Primer::DropdownMenuComponent::DIRECTION_OPTIONS) %> - # @param scheme [Symbol] Pass `:dark` for dark mode theming - # @param header [String] Optional string to display as the header - # @param system_arguments [Hash] <%= link_to_system_arguments_docs %> - def initialize(direction: DIRECTION_DEFAULT, scheme: SCHEME_DEFAULT, header: nil, **system_arguments) - @header = header - @direction = direction - @system_arguments = deny_tag_argument(**system_arguments) - - @system_arguments[:tag] = "details-menu" - @system_arguments[:role] = "menu" - - @system_arguments[:classes] = class_names( - @system_arguments[:classes], - "dropdown-menu", - "dropdown-menu-#{fetch_or_fallback(DIRECTION_OPTIONS, direction, DIRECTION_DEFAULT)}", - SCHEME_MAPPINGS[fetch_or_fallback(SCHEME_MAPPINGS.keys, scheme, SCHEME_DEFAULT)] - ) - end - end -end diff --git a/docs/content/guides/primer_dropdown_menu_component.md b/docs/content/guides/primer_dropdown_menu_component.md deleted file mode 100644 index 1f3d92a41d..0000000000 --- a/docs/content/guides/primer_dropdown_menu_component.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -title: Moving Away From `Primer::DropdownMenuComponent` ---- - -This guide will show you how to upgrade from the now deprecated -[`Primer::DropdownMenuComponent`](https://primer.style/view-components/components/dropdownmenu) -to the latest [`Primer::Alpha::Dropdown`](https://primer.style/view-components/components/alpha/dropdown) -component. - -## Arguments - -The following arguments for the component initializer have changed between the deprecated and newer versions -of the Primer Dropdown. - -| From `Primer::DropdownMenuComponent` | To `Primer::Alpha::Dropdown` | Notes | -|--------------------------------------|------------------------------|-------| -| `direction` | n/a | Moved to `menu` slot, below | -| `scheme` | n/a | Moved to `menu` slot, below | -| `header` | n/a | Moved to `menu` slot, below | -| n/a | `overlay` | Color of the menu overlay: `:default`, `:dark`, or `:none` | -| n/a | `with_caret` | Whether or not a caret should be displayed on the button | - -The remaining arguments have stayed the same. - -Please see the following documentation for complete descriptions and examples. - -* [Deprecated `Primer::DropdownMenuComponent`](https://primer.style/view-components/components/dropdownmenu) -* [Updated `Primer::Alpha::Dropdown` component](https://primer.style/view-components/components/alpha/dropdown) -* [`Primer::Alpha::Dropdown` Lookbook examples](https://primer.style/view-components/lookbook/inspect/primer/alpha/dropdown/default) - -## Slot Names - -The following slots have changed with the newer Primer Dropdown. - -| From `Primer::DropdownMenuComponent` | To `Primer::Alpha::Dropdown` | Notes | -|--------------------------------------|------------------------------|-------| -| n/a | `menu` | Required context menu for the dropdown. See the "Arguments for `menu` slot" section, below | -| n/a | `button` | The [`Primer::Beta::Button`](https://primer.style/view-components/components/beta/button) to display for the dropdown action | - -The remaining slot names have stayed the same. - -### Arguments for `menu` slot - -The following arguments are available with the `menu` named slot in Primer Dropdown. - -| Argument | Description | -|-------------|-------------| -| `as` | when `as` is `:list`, wraps the menu in a `