diff --git a/playbook-website/Gemfile.lock b/playbook-website/Gemfile.lock index 4731ac9393..42852648c6 100644 --- a/playbook-website/Gemfile.lock +++ b/playbook-website/Gemfile.lock @@ -5,7 +5,7 @@ PATH actionpack (>= 5.2.4.5) actionview (>= 5.2.4.5) activesupport (>= 5.2.4.5) - view_component (= 2.83.0) + view_component (= 4.3.0) vite_rails GEM @@ -146,7 +146,6 @@ GEM net-pop net-smtp marcel (1.1.0) - method_source (1.1.0) mini_mime (1.1.5) mini_portile2 (2.8.9) minitest (5.25.1) @@ -302,10 +301,10 @@ GEM tzinfo (>= 1.0.0) unicode-display_width (2.5.0) useragent (0.16.11) - view_component (2.83.0) - activesupport (>= 5.2.0, < 8.0) - concurrent-ruby (~> 1.0) - method_source (~> 1.0) + view_component (4.3.0) + actionview (>= 7.1.0) + activesupport (>= 7.1.0) + concurrent-ruby (~> 1) vite_rails (3.0.17) railties (>= 5.1, < 8) vite_ruby (~> 3.0, >= 3.2.2) diff --git a/playbook-website/app/components/playbook/pb_docs/kit_example.rb b/playbook-website/app/components/playbook/pb_docs/kit_example.rb index 166747083d..300a45aa90 100644 --- a/playbook-website/app/components/playbook/pb_docs/kit_example.rb +++ b/playbook-website/app/components/playbook/pb_docs/kit_example.rb @@ -55,7 +55,7 @@ def full_screen def available_props schema_path = Playbook::Engine.root.join("app/pb_kits/playbook/pb_#{kit}/kit.schema.json") - File.exist?(schema_path) ? File.read(schema_path) : "{}" + ::File.exist?(schema_path) ? ::File.read(schema_path) : "{}" end private diff --git a/playbook/Gemfile.lock b/playbook/Gemfile.lock index 11437e8186..97f726bf86 100644 --- a/playbook/Gemfile.lock +++ b/playbook/Gemfile.lock @@ -5,90 +5,102 @@ PATH actionpack (>= 5.2.4.5) actionview (>= 5.2.4.5) activesupport (>= 5.2.4.5) - view_component (= 2.83.0) + view_component (= 4.3.0) vite_rails GEM remote: https://rubygems.org/ specs: - actioncable (7.0.8.1) - actionpack (= 7.0.8.1) - activesupport (= 7.0.8.1) + actioncable (7.2.2.2) + actionpack (= 7.2.2.2) + activesupport (= 7.2.2.2) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.8.1) - actionpack (= 7.0.8.1) - activejob (= 7.0.8.1) - activerecord (= 7.0.8.1) - activestorage (= 7.0.8.1) - activesupport (= 7.0.8.1) - mail (>= 2.7.1) - net-imap - net-pop - net-smtp - actionmailer (7.0.8.1) - actionpack (= 7.0.8.1) - actionview (= 7.0.8.1) - activejob (= 7.0.8.1) - activesupport (= 7.0.8.1) - mail (~> 2.5, >= 2.5.4) - net-imap - net-pop - net-smtp - rails-dom-testing (~> 2.0) - actionpack (7.0.8.1) - actionview (= 7.0.8.1) - activesupport (= 7.0.8.1) - rack (~> 2.0, >= 2.2.4) + zeitwerk (~> 2.6) + actionmailbox (7.2.2.2) + actionpack (= 7.2.2.2) + activejob (= 7.2.2.2) + activerecord (= 7.2.2.2) + activestorage (= 7.2.2.2) + activesupport (= 7.2.2.2) + mail (>= 2.8.0) + actionmailer (7.2.2.2) + actionpack (= 7.2.2.2) + actionview (= 7.2.2.2) + activejob (= 7.2.2.2) + activesupport (= 7.2.2.2) + mail (>= 2.8.0) + rails-dom-testing (~> 2.2) + actionpack (7.2.2.2) + actionview (= 7.2.2.2) + activesupport (= 7.2.2.2) + nokogiri (>= 1.8.5) + racc + rack (>= 2.2.4, < 3.2) + rack-session (>= 1.0.1) rack-test (>= 0.6.3) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.8.1) - actionpack (= 7.0.8.1) - activerecord (= 7.0.8.1) - activestorage (= 7.0.8.1) - activesupport (= 7.0.8.1) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + useragent (~> 0.16) + actiontext (7.2.2.2) + actionpack (= 7.2.2.2) + activerecord (= 7.2.2.2) + activestorage (= 7.2.2.2) + activesupport (= 7.2.2.2) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.8.1) - activesupport (= 7.0.8.1) + actionview (7.2.2.2) + activesupport (= 7.2.2.2) builder (~> 3.1) - erubi (~> 1.4) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (7.0.8.1) - activesupport (= 7.0.8.1) + erubi (~> 1.11) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + activejob (7.2.2.2) + activesupport (= 7.2.2.2) globalid (>= 0.3.6) - activemodel (7.0.8.1) - activesupport (= 7.0.8.1) - activerecord (7.0.8.1) - activemodel (= 7.0.8.1) - activesupport (= 7.0.8.1) - activestorage (7.0.8.1) - actionpack (= 7.0.8.1) - activejob (= 7.0.8.1) - activerecord (= 7.0.8.1) - activesupport (= 7.0.8.1) + activemodel (7.2.2.2) + activesupport (= 7.2.2.2) + activerecord (7.2.2.2) + activemodel (= 7.2.2.2) + activesupport (= 7.2.2.2) + timeout (>= 0.4.0) + activestorage (7.2.2.2) + actionpack (= 7.2.2.2) + activejob (= 7.2.2.2) + activerecord (= 7.2.2.2) + activesupport (= 7.2.2.2) marcel (~> 1.0) - mini_mime (>= 1.1.0) - activesupport (7.0.8.1) - concurrent-ruby (~> 1.0, >= 1.0.2) + activesupport (7.2.2.2) + base64 + benchmark (>= 0.3) + bigdecimal + concurrent-ruby (~> 1.0, >= 1.3.1) + connection_pool (>= 2.2.5) + drb i18n (>= 1.6, < 2) + logger (>= 1.4.2) minitest (>= 5.1) - tzinfo (~> 2.0) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) addressable (2.8.0) public_suffix (>= 2.0.2, < 5.0) ast (2.4.2) + base64 (0.3.0) + benchmark (0.5.0) + bigdecimal (4.1.2) brakeman (7.0.0) racc - builder (3.2.4) + builder (3.3.0) byebug (11.1.3) - concurrent-ruby (1.2.3) + concurrent-ruby (1.3.6) + connection_pool (3.0.2) crass (1.0.6) - date (3.3.4) + date (3.5.1) diff-lcs (1.4.4) + drb (2.2.3) dry-cli (1.0.0) - erubi (1.12.0) + erb (6.0.4) + erubi (1.13.1) faraday (1.10.3) faraday-em_http (~> 1.0) faraday-em_synchrony (~> 1.0) @@ -122,38 +134,47 @@ GEM rainbow (>= 2.2.1) rake (>= 10.0) retriable (~> 3.0) - globalid (1.2.1) + globalid (1.3.0) activesupport (>= 6.1) - i18n (1.14.4) + i18n (1.14.8) concurrent-ruby (~> 1.0) + io-console (0.8.2) + irb (1.18.0) + pp (>= 0.6.0) + prism (>= 1.3.0) + rdoc (>= 4.0.0) + reline (>= 0.4.2) json (2.7.1) language_server-protocol (3.17.0.3) - loofah (2.22.0) + logger (1.7.0) + loofah (2.25.1) crass (~> 1.0.2) nokogiri (>= 1.12.0) - mail (2.8.1) + mail (2.9.0) + logger mini_mime (>= 0.1.1) net-imap net-pop net-smtp - marcel (1.0.4) - method_source (1.0.0) + marcel (1.2.1) mini_mime (1.1.5) mini_portile2 (2.8.9) - minitest (5.22.3) + minitest (6.0.6) + drb (~> 2.0) + prism (~> 1.5) multi_json (1.15.0) multipart-post (2.4.0) - net-imap (0.4.10) + net-imap (0.6.4.1) date net-protocol net-pop (0.1.2) net-protocol net-protocol (0.2.2) timeout - net-smtp (0.5.0) + net-smtp (0.5.1) net-protocol - nio4r (2.7.1) - nokogiri (1.19.1) + nio4r (2.7.5) + nokogiri (1.19.3) mini_portile2 (~> 2.8.2) racc (~> 1.4) octokit (4.21.0) @@ -163,44 +184,63 @@ GEM parser (3.3.0.5) ast (~> 2.4.1) racc + pp (0.6.3) + prettyprint + prettyprint (0.2.0) + prism (1.9.0) + psych (5.4.0) + date + stringio public_suffix (4.0.6) racc (1.8.1) - rack (2.2.9) + rack (3.1.21) rack-proxy (0.7.7) rack - rack-test (2.1.0) + rack-session (2.1.2) + base64 (>= 0.1.0) + rack (>= 3.0.0) + rack-test (2.2.0) rack (>= 1.3) - rails (7.0.8.1) - actioncable (= 7.0.8.1) - actionmailbox (= 7.0.8.1) - actionmailer (= 7.0.8.1) - actionpack (= 7.0.8.1) - actiontext (= 7.0.8.1) - actionview (= 7.0.8.1) - activejob (= 7.0.8.1) - activemodel (= 7.0.8.1) - activerecord (= 7.0.8.1) - activestorage (= 7.0.8.1) - activesupport (= 7.0.8.1) + rackup (2.3.1) + rack (>= 3) + rails (7.2.2.2) + actioncable (= 7.2.2.2) + actionmailbox (= 7.2.2.2) + actionmailer (= 7.2.2.2) + actionpack (= 7.2.2.2) + actiontext (= 7.2.2.2) + actionview (= 7.2.2.2) + activejob (= 7.2.2.2) + activemodel (= 7.2.2.2) + activerecord (= 7.2.2.2) + activestorage (= 7.2.2.2) + activesupport (= 7.2.2.2) bundler (>= 1.15.0) - railties (= 7.0.8.1) - rails-dom-testing (2.2.0) + railties (= 7.2.2.2) + rails-dom-testing (2.3.0) activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.6.0) - loofah (~> 2.21) - nokogiri (~> 1.14) - railties (7.0.8.1) - actionpack (= 7.0.8.1) - activesupport (= 7.0.8.1) - method_source + rails-html-sanitizer (1.7.0) + loofah (~> 2.25) + nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) + railties (7.2.2.2) + actionpack (= 7.2.2.2) + activesupport (= 7.2.2.2) + irb (~> 1.13) + rackup (>= 1.0.0) rake (>= 12.2) - thor (~> 1.0) - zeitwerk (~> 2.5) + thor (~> 1.0, >= 1.2.2) + zeitwerk (~> 2.6) rainbow (3.1.1) - rake (13.1.0) + rake (13.4.2) + rdoc (7.2.0) + erb + psych (>= 4.0.0) + tsort regexp_parser (2.9.0) + reline (0.6.3) + io-console (~> 0.5) retriable (3.1.2) rexml (3.2.6) rspec (3.9.0) @@ -248,17 +288,21 @@ GEM sawyer (0.8.2) addressable (>= 2.3.5) faraday (> 0.8, < 2.0) - thor (1.3.1) - timeout (0.4.1) + securerandom (0.4.1) + stringio (3.2.0) + thor (1.5.0) + timeout (0.6.1) + tsort (0.2.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) tzinfo-data (1.2018.9) tzinfo (>= 1.0.0) unicode-display_width (2.5.0) - view_component (2.83.0) - activesupport (>= 5.2.0, < 8.0) - concurrent-ruby (~> 1.0) - method_source (~> 1.0) + useragent (0.16.11) + view_component (4.3.0) + actionview (>= 7.1.0) + activesupport (>= 7.1.0) + concurrent-ruby (~> 1) vite_rails (3.0.17) railties (>= 5.1, < 8) vite_ruby (~> 3.0, >= 3.2.2) @@ -266,11 +310,12 @@ GEM dry-cli (>= 0.7, < 2) rack-proxy (~> 0.6, >= 0.6.1) zeitwerk (~> 2.2) - websocket-driver (0.7.6) + websocket-driver (0.8.1) + base64 websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) will_paginate (3.3.1) - zeitwerk (2.6.13) + zeitwerk (2.8.2) PLATFORMS ruby @@ -280,7 +325,7 @@ DEPENDENCIES byebug (>= 11.0.0) github_changelog_generator (= 1.15.2) playbook_ui! - rails (>= 5.2.4.5) + rails (~> 7.2.2.1) rspec-html-matchers (= 0.9.1) rspec-rails (~> 3.8, >= 3.8.0) rubocop diff --git a/playbook/app/pb_kits/playbook/pb_pagination/pagination.html.erb b/playbook/app/pb_kits/playbook/pb_pagination/pagination.html.erb index 89c48cc212..b95edad73e 100644 --- a/playbook/app/pb_kits/playbook/pb_pagination/pagination.html.erb +++ b/playbook/app/pb_kits/playbook/pb_pagination/pagination.html.erb @@ -1,3 +1,3 @@ <%= pb_content_tag do %> - <%= will_paginate object.model, renderer: Playbook::Pagination::Rails %> + <%= helpers.will_paginate object.model, renderer: Playbook::Pagination::Rails %> <% end %> diff --git a/playbook/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor.html.erb b/playbook/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor.html.erb index 585dd8d99b..8a6ca30feb 100644 --- a/playbook/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor.html.erb +++ b/playbook/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor.html.erb @@ -158,5 +158,5 @@ <%# Module script: rich_text_editor_rails.js %> diff --git a/playbook/app/pb_kits/playbook/pb_user_badge/user_badge.rb b/playbook/app/pb_kits/playbook/pb_user_badge/user_badge.rb index a44b869ac3..a3aa864eb8 100644 --- a/playbook/app/pb_kits/playbook/pb_user_badge/user_badge.rb +++ b/playbook/app/pb_kits/playbook/pb_user_badge/user_badge.rb @@ -16,12 +16,8 @@ def classname def display_badge @display_badge ||= begin - badge_path = File.join( - File.dirname(self.class.source_location), - "badges", - "#{badge}.svg" - ) - File.read(badge_path).html_safe + badge_path = Playbook.kit_path("user_badge", "badges", "#{badge}.svg") + ::File.read(badge_path).html_safe end end end diff --git a/playbook/bin/rails b/playbook/bin/rails index 2f4b3e9f48..e696a97df1 100755 --- a/playbook/bin/rails +++ b/playbook/bin/rails @@ -10,5 +10,7 @@ APP_PATH = File.expand_path('../spec/dummy/config/application', __dir__) ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE']) +require "logger" + require "rails" require 'rails/engine/commands' diff --git a/playbook/config/brakeman.ignore b/playbook/config/brakeman.ignore new file mode 100644 index 0000000000..8311f63194 --- /dev/null +++ b/playbook/config/brakeman.ignore @@ -0,0 +1,12 @@ +{ + "ignored_warnings": [ + { + "warning_type": "Unmaintained Dependency", + "warning_code": 122, + "fingerprint": "21ab0fe00fdd5899ffc405cff75aadb91b805ee996a614f7e27b08a287e9062d", + "note": "Rails 7.2 dev dependency required for ViewComponent 4. General support until 2026-08-09." + } + ], + "updated": "2026-05-26 00:00:00 +0000", + "brakeman_version": "7.0.0" +} diff --git a/playbook/lib/playbook/engine.rb b/playbook/lib/playbook/engine.rb index 7714755c0b..fa7c70c648 100644 --- a/playbook/lib/playbook/engine.rb +++ b/playbook/lib/playbook/engine.rb @@ -11,8 +11,6 @@ class Engine < ::Rails::Engine g.test_framework :rspec end - config.view_component.render_monkey_patch_enabled = false - if config.respond_to?(:assets) config.assets.paths ||= [] config.assets.paths << Playbook::Engine.root.join("fonts") diff --git a/playbook/lib/playbook/kit_base.rb b/playbook/lib/playbook/kit_base.rb index e2f724682f..376e605459 100644 --- a/playbook/lib/playbook/kit_base.rb +++ b/playbook/lib/playbook/kit_base.rb @@ -35,9 +35,9 @@ require "playbook/max_height" module Playbook - include ActionView::Helpers - class KitBase < ViewComponent::Base + include ActionView::Helpers + include Playbook::PbKitHelper include Playbook::Props include Playbook::Classnames diff --git a/playbook/lib/playbook/pb_kit_helper.rb b/playbook/lib/playbook/pb_kit_helper.rb index 3ffdcacec2..e0be9e985e 100755 --- a/playbook/lib/playbook/pb_kit_helper.rb +++ b/playbook/lib/playbook/pb_kit_helper.rb @@ -7,11 +7,7 @@ module PbKitHelper def pb_rails(kit_name, props: {}, &block) kit = Playbook::KitResolver.resolve(kit_name.to_s) - if respond_to? :render_component - render_component kit.new(props, &block), &block - else - render kit.new(props, &block), &block - end + render kit.new(props, &block), &block end def deprecated_kit_warning(kit_name, message = nil) diff --git a/playbook/playbook_ui.gemspec b/playbook/playbook_ui.gemspec index 62c8ba3ed3..e91931a297 100644 --- a/playbook/playbook_ui.gemspec +++ b/playbook/playbook_ui.gemspec @@ -35,13 +35,13 @@ Gem::Specification.new do |s| s.add_dependency "actionpack", ">= 5.2.4.5" s.add_dependency "actionview", ">= 5.2.4.5" s.add_dependency "activesupport", ">= 5.2.4.5" - s.add_dependency "view_component", "2.83.0" + s.add_dependency "view_component", "4.3.0" s.add_dependency "vite_rails" s.add_development_dependency "brakeman", "7.0.0" s.add_development_dependency "byebug", ">= 11.0.0" s.add_development_dependency "github_changelog_generator", "1.15.2" - s.add_development_dependency "rails", ">= 5.2.4.5" + s.add_development_dependency "rails", "~> 7.2.2.1" s.add_development_dependency "rspec-html-matchers", "0.9.1" s.add_development_dependency "rspec-rails", "~> 3.8", ">= 3.8.0" s.add_development_dependency "rubocop" diff --git a/playbook/spec/dummy/config/application.rb b/playbook/spec/dummy/config/application.rb index 906bd16380..45fd9e24d0 100644 --- a/playbook/spec/dummy/config/application.rb +++ b/playbook/spec/dummy/config/application.rb @@ -15,7 +15,7 @@ module Dummy class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. - config.load_defaults 7.0 + config.load_defaults 7.2 # Configuration for the application, engines, and railties goes here. # diff --git a/playbook/spec/dummy/config/boot.rb b/playbook/spec/dummy/config/boot.rb index c2241d7074..ee8036479b 100644 --- a/playbook/spec/dummy/config/boot.rb +++ b/playbook/spec/dummy/config/boot.rb @@ -3,3 +3,5 @@ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) require "bundler/setup" # Set up gems listed in the Gemfile. + +require "logger"