Skip to content
This repository was archived by the owner on Jul 27, 2025. It is now read-only.

Commit ab6fdbb

Browse files
authored
Component namespacing (#2463)
* [claudesquad] update from 'component-namespacing' on 18 Jul 25 07:23 EDT * [claudesquad] update from 'component-namespacing' on 18 Jul 25 07:30 EDT * Update stimulus controller references to use namespace * Fix remaining tests
1 parent d5b147f commit ab6fdbb

File tree

182 files changed

+322
-321
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

182 files changed

+322
-321
lines changed
File renamed without changes.

app/components/alert_component.rb renamed to app/components/DS/alert.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
class AlertComponent < ViewComponent::Base
1+
class DS::Alert < DesignSystemComponent
22
def initialize(message:, variant: :info)
33
@message = message
44
@variant = variant
File renamed without changes.

app/components/button_component.rb renamed to app/components/DS/button.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# An extension to `button_to` helper. All options are passed through to the `button_to` helper with some additional
44
# options available.
5-
class ButtonComponent < ButtonishComponent
5+
class DS::Button < DS::Buttonish
66
attr_reader :confirm
77

88
def initialize(confirm: nil, **opts)

app/components/buttonish_component.rb renamed to app/components/DS/buttonish.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
class ButtonishComponent < ViewComponent::Base
1+
class DS::Buttonish < DesignSystemComponent
22
VARIANTS = {
33
primary: {
44
container_classes: "text-inverse bg-inverse hover:bg-inverse-hover disabled:bg-gray-500 theme-dark:disabled:bg-gray-400",
@@ -71,7 +71,7 @@ def initialize(variant: :primary, size: :md, href: nil, text: nil, icon: nil, ic
7171
end
7272

7373
def call
74-
raise NotImplementedError, "ButtonishComponent is an abstract class and cannot be instantiated directly."
74+
raise NotImplementedError, "Buttonish is an abstract class and cannot be instantiated directly."
7575
end
7676

7777
def container_classes(override_classes = nil)

app/components/dialog_component.html.erb renamed to app/components/DS/dialog.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<%= wrapper_element do %>
22
<%= tag.dialog class: "w-full h-full bg-transparent theme-dark:backdrop:bg-alpha-black-900 backdrop:bg-overlay #{drawer? ? "lg:p-3" : "lg:p-1"}", **merged_opts do %>
33
<%= tag.div class: dialog_outer_classes do %>
4-
<%= tag.div class: dialog_inner_classes, data: { dialog_target: "content" } do %>
4+
<%= tag.div class: dialog_inner_classes, data: { DS__dialog_target: "content" } do %>
55
<div class="grow overflow-y-auto py-4 space-y-4 flex flex-col">
66
<% if header? %>
77
<%= header %>

app/components/dialog_component.rb renamed to app/components/DS/dialog.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
class DialogComponent < ViewComponent::Base
1+
class DS::Dialog < DesignSystemComponent
22
renders_one :header, ->(title: nil, subtitle: nil, hide_close_icon: false, **opts, &block) do
33
content_tag(:header, class: "px-4 flex flex-col gap-2", **opts) do
44
title_div = content_tag(:div, class: "flex items-center justify-between gap-2") do
55
title = content_tag(:h2, title, class: class_names("font-medium text-primary", drawer? ? "text-lg" : "")) if title
6-
close_icon = render ButtonComponent.new(variant: "icon", class: "ml-auto", icon: "x", tabindex: "-1", data: { action: "dialog#close" }) unless hide_close_icon
6+
close_icon = render DS::Button.new(variant: "icon", class: "ml-auto", icon: "x", tabindex: "-1", data: { action: "DS--dialog#close" }) unless hide_close_icon
77
safe_join([ title, close_icon ].compact)
88
end
99

@@ -19,16 +19,16 @@ class DialogComponent < ViewComponent::Base
1919

2020
renders_many :actions, ->(cancel_action: false, **button_opts) do
2121
merged_opts = if cancel_action
22-
button_opts.merge(type: "button", data: { action: "modal#close" })
22+
button_opts.merge(type: "button", data: { action: "DS--dialog#close" })
2323
else
2424
button_opts
2525
end
2626

27-
render ButtonComponent.new(**merged_opts)
27+
render DS::Button.new(**merged_opts)
2828
end
2929

3030
renders_many :sections, ->(title:, **disclosure_opts, &block) do
31-
render DisclosureComponent.new(title: title, align: :right, **disclosure_opts) do
31+
render DS::Disclosure.new(title: title, align: :right, **disclosure_opts) do
3232
block.call
3333
end
3434
end
@@ -99,11 +99,11 @@ def merged_opts
9999
merged_opts = opts.dup
100100
data = merged_opts.delete(:data) || {}
101101

102-
data[:controller] = [ "dialog", "hotkey", data[:controller] ].compact.join(" ")
103-
data[:dialog_auto_open_value] = auto_open
104-
data[:dialog_reload_on_close_value] = reload_on_close
105-
data[:action] = [ "mousedown->dialog#clickOutside", data[:action] ].compact.join(" ")
106-
data[:hotkey] = "esc:dialog#close"
102+
data[:controller] = [ "DS--dialog", "hotkey", data[:controller] ].compact.join(" ")
103+
data[:DS__dialog_auto_open_value] = auto_open
104+
data[:DS__dialog_reload_on_close_value] = reload_on_close
105+
data[:action] = [ "mousedown->DS--dialog#clickOutside", data[:action] ].compact.join(" ")
106+
data[:hotkey] = "esc:DS--dialog#close"
107107
merged_opts[:data] = data
108108

109109
merged_opts
File renamed without changes.

app/components/disclosure_component.rb renamed to app/components/DS/disclosure.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
class DisclosureComponent < ViewComponent::Base
1+
class DS::Disclosure < DesignSystemComponent
22
renders_one :summary_content
33

44
attr_reader :title, :align, :open, :opts

0 commit comments

Comments
 (0)