diff --git a/.changeset/khaki-avocados-notice.md b/.changeset/khaki-avocados-notice.md new file mode 100644 index 0000000000..6a42bc7cbb --- /dev/null +++ b/.changeset/khaki-avocados-notice.md @@ -0,0 +1,9 @@ +--- +"@primer/view-components": patch +--- + +Deprecate components and moving to new namespace: + +- Primer::Dropdown moving to Primer::Alpha::Dropdown +- Primer::Dropdown::Menu moving to Primer::Alpha::Dropdown::Menu +- Primer::Dropdown::Menu::Item moving to Primer::Alpha::Dropdown::Menu::Item diff --git a/.playwright/screenshots/previews.test.ts-snapshots/primer/dropdown/default.png b/.playwright/screenshots/previews.test.ts-snapshots/primer/alpha/dropdown/default.png similarity index 100% rename from .playwright/screenshots/previews.test.ts-snapshots/primer/dropdown/default.png rename to .playwright/screenshots/previews.test.ts-snapshots/primer/alpha/dropdown/default.png diff --git a/.playwright/screenshots/previews.test.ts-snapshots/primer/dropdown/focused.png b/.playwright/screenshots/previews.test.ts-snapshots/primer/alpha/dropdown/focused.png similarity index 100% rename from .playwright/screenshots/previews.test.ts-snapshots/primer/dropdown/focused.png rename to .playwright/screenshots/previews.test.ts-snapshots/primer/alpha/dropdown/focused.png diff --git a/app/components/primer/dropdown.html.erb b/app/components/primer/alpha/dropdown.html.erb similarity index 100% rename from app/components/primer/dropdown.html.erb rename to app/components/primer/alpha/dropdown.html.erb diff --git a/app/components/primer/dropdown.pcss b/app/components/primer/alpha/dropdown.pcss similarity index 100% rename from app/components/primer/dropdown.pcss rename to app/components/primer/alpha/dropdown.pcss diff --git a/app/components/primer/alpha/dropdown.rb b/app/components/primer/alpha/dropdown.rb new file mode 100644 index 0000000000..05c1516771 --- /dev/null +++ b/app/components/primer/alpha/dropdown.rb @@ -0,0 +1,154 @@ +# frozen_string_literal: true + +module Primer + module Alpha + # `Dropdown` is a lightweight context menu for housing navigation and actions. + # They're great for instances where you don't need the full power (and code) of the SelectMenu. + class Dropdown < Primer::Component + status :alpha + + # Required trigger for the dropdown. Has the same arguments as <%= link_to_component(Primer::ButtonComponent) %>, + # but it is locked as a `summary` tag. + renders_one :button, lambda { |**system_arguments| + @button_arguments = system_arguments + @button_arguments[:button] = true + @button_arguments[:dropdown] = @with_caret + + Primer::Content.new + } + + # Required context menu for the dropdown. + # + # @param as [Symbol] When `as` is `:list`, wraps the menu in a `