From 569bea0c38ec119cfa319a86cf684bfe3d9eaa89 Mon Sep 17 00:00:00 2001 From: Unai Abrisketa Date: Wed, 11 Dec 2024 11:07:28 +0100 Subject: [PATCH 1/7] Fix typo in gemspec description --- essence.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/essence.gemspec b/essence.gemspec index 0f37543..6625623 100644 --- a/essence.gemspec +++ b/essence.gemspec @@ -21,7 +21,7 @@ Gem::Specification.new do |spec| spec.summary = "ViewComponents for ePages's online shop software Beyond" spec.description = <<-DESC Essence is an open-source framework that provides ViewComponents, - form styles and other functionality for appsdesigned and developed for the + form styles and other functionality for apps designed and developed for the online shop software Beyond DESC spec.license = 'MIT' From 6da865571aa189e840bedddc241631f9dd82cc40 Mon Sep 17 00:00:00 2001 From: Unai Abrisketa Date: Thu, 12 Dec 2024 11:17:23 +0100 Subject: [PATCH 2/7] Add expandable components --- .../essence/icon_component/arrow_right.svg | 1 + .../icon_component/chevron_up_down.svg | 3 ++ .../essence/beyond/components/_index.scss | 2 + .../essence/expand_all_button_component.rb | 38 ++++++++++++++ .../expand_all_button_component.html.erb | 3 ++ .../expand_all_button_component.scss | 13 +++++ .../expand_all_button_component.yml | 4 ++ .../expand_all_button_component_controller.js | 52 +++++++++++++++++++ .../essence/expandable_component.rb | 30 +++++++++++ .../expandable_component.html.erb | 8 +++ .../expandable_component.scss | 42 +++++++++++++++ .../expandable_component_controller.js | 32 ++++++++++++ app/javascript/essence/controllers/index.js | 6 +++ .../expand_all_button_component_preview.rb | 19 +++++++ .../essence/expandable_component_preview.rb | 19 +++++++ .../essence/expand_all_component_spec.rb | 15 ++++++ .../essence/expandable_component_spec.rb | 15 ++++++ 17 files changed, 302 insertions(+) create mode 100644 app/assets/images/essence/icon_component/arrow_right.svg create mode 100644 app/assets/images/essence/icon_component/chevron_up_down.svg create mode 100644 app/components/essence/expand_all_button_component.rb create mode 100644 app/components/essence/expand_all_button_component/expand_all_button_component.html.erb create mode 100644 app/components/essence/expand_all_button_component/expand_all_button_component.scss create mode 100644 app/components/essence/expand_all_button_component/expand_all_button_component.yml create mode 100644 app/components/essence/expand_all_button_component/expand_all_button_component_controller.js create mode 100644 app/components/essence/expandable_component.rb create mode 100644 app/components/essence/expandable_component/expandable_component.html.erb create mode 100644 app/components/essence/expandable_component/expandable_component.scss create mode 100644 app/components/essence/expandable_component/expandable_component_controller.js create mode 100644 site/app/previews/essence/expand_all_button_component_preview.rb create mode 100644 site/app/previews/essence/expandable_component_preview.rb create mode 100644 spec/components/essence/expand_all_component_spec.rb create mode 100644 spec/components/essence/expandable_component_spec.rb diff --git a/app/assets/images/essence/icon_component/arrow_right.svg b/app/assets/images/essence/icon_component/arrow_right.svg new file mode 100644 index 0000000..8cb5e86 --- /dev/null +++ b/app/assets/images/essence/icon_component/arrow_right.svg @@ -0,0 +1 @@ + diff --git a/app/assets/images/essence/icon_component/chevron_up_down.svg b/app/assets/images/essence/icon_component/chevron_up_down.svg new file mode 100644 index 0000000..d3e7a14 --- /dev/null +++ b/app/assets/images/essence/icon_component/chevron_up_down.svg @@ -0,0 +1,3 @@ + + + diff --git a/app/assets/stylesheets/essence/beyond/components/_index.scss b/app/assets/stylesheets/essence/beyond/components/_index.scss index 3b37374..5f07140 100644 --- a/app/assets/stylesheets/essence/beyond/components/_index.scss +++ b/app/assets/stylesheets/essence/beyond/components/_index.scss @@ -5,6 +5,8 @@ @import '../../../../../components/essence/card_component/card_component'; @import '../../../../../components/essence/clipboard_copy_component/clipboard_copy_component'; @import '../../../../../components/essence/empty_state_component/empty_state_component'; +@import '../../../../../components/essence/expand_all_button_component/expand_all_button_component'; +@import '../../../../../components/essence/expandable_component/expandable_component'; @import '../../../../../components/essence/link_component/link_component'; @import '../../../../../components/essence/notification_component/notification_component'; @import '../../../../../components/essence/paragraph_component/paragraph_component'; diff --git a/app/components/essence/expand_all_button_component.rb b/app/components/essence/expand_all_button_component.rb new file mode 100644 index 0000000..12db382 --- /dev/null +++ b/app/components/essence/expand_all_button_component.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +module Essence + class ExpandAllButtonComponent < ApplicationComponent + attr_reader :expand_all_text, :html_options + + DEFAULT_TARGET = '.expandable' + + def initialize(target: DEFAULT_TARGET, + expand_all_text: nil, + collapse_all_text: nil, + **html_options) + @target = target + @expand_all_text = expand_all_text + @collapse_all_text = collapse_all_text + @html_options = html_options + end + + private + + def before_render + @expand_all_text ||= t('.expand_all_text') + @collapse_all_text ||= t('.collapse_all_text') + + set_base_html_options( + 'expand-all-button', + data: { + controller: 'expand-all-button', + action: 'expand-all-button#toggleAll', + expand_all_button_expandable_outlet: @target, + expand_all_button_expand_all_text_value: @expand_all_text, + expand_all_button_collapse_all_text_value: @collapse_all_text, + expand_all_button_all_expanded_value: false + } + ) + end + end +end diff --git a/app/components/essence/expand_all_button_component/expand_all_button_component.html.erb b/app/components/essence/expand_all_button_component/expand_all_button_component.html.erb new file mode 100644 index 0000000..e6e8523 --- /dev/null +++ b/app/components/essence/expand_all_button_component/expand_all_button_component.html.erb @@ -0,0 +1,3 @@ +<%= render Essence::ButtonComponent.new(name: expand_all_text, display_as: :link, type: :button, **html_options) do |button| %> + <% button.with_left_icon 'chevron_up_down' %> +<% end %> diff --git a/app/components/essence/expand_all_button_component/expand_all_button_component.scss b/app/components/essence/expand_all_button_component/expand_all_button_component.scss new file mode 100644 index 0000000..597c64e --- /dev/null +++ b/app/components/essence/expand_all_button_component/expand_all_button_component.scss @@ -0,0 +1,13 @@ +:root { + --primaryLink-color: deepskyblue; + --primaryLink-hover-color: #0099cc; +} + +$expand-all-button-icon-size: 15px; + +.expand-all-button { + .button-icon { + height: $expand-all-button-icon-size; + width: $expand-all-button-icon-size; + } +} diff --git a/app/components/essence/expand_all_button_component/expand_all_button_component.yml b/app/components/essence/expand_all_button_component/expand_all_button_component.yml new file mode 100644 index 0000000..bbeb5c1 --- /dev/null +++ b/app/components/essence/expand_all_button_component/expand_all_button_component.yml @@ -0,0 +1,4 @@ +--- +en: + expand_all_text: Expand all + collapse_all_text: Collapse all diff --git a/app/components/essence/expand_all_button_component/expand_all_button_component_controller.js b/app/components/essence/expand_all_button_component/expand_all_button_component_controller.js new file mode 100644 index 0000000..b04351a --- /dev/null +++ b/app/components/essence/expand_all_button_component/expand_all_button_component_controller.js @@ -0,0 +1,52 @@ +import { Controller } from "@hotwired/stimulus"; + +export default class extends Controller { + static outlets = [ + "expandable" + ] + + static values = { + expandAllText: String, + collapseAllText: String, + allExpanded: Boolean + } + + connect() { + this.checkExpandables() + } + + toggleAll() { + this.#updateExpandablesState(!this.allExpandedValue) + } + + collapseAll() { + this.#updateExpandablesState(false) + } + + expandAll() { + this.#updateExpandablesState(true) + } + + checkExpandables() { + if (this.expandableOutlets.length === 0) return + + const allExpanded = this.expandableOutlets.every(expandable => expandable.expandedValue) + const allCollapsed = this.expandableOutlets.every(expandable => !expandable.expandedValue) + + if (allExpanded) { + this.#updateExpandedState(true) + } else if (allCollapsed) { + this.#updateExpandedState(false) + } + } + + #updateExpandablesState(expandedState) { + this.#updateExpandedState(expandedState) + this.expandableOutlets.forEach(expandable => expandedState ? expandable.expand() : expandable.collapse()) + } + + #updateExpandedState(expandedState) { + this.allExpandedValue = expandedState + this.element.querySelector("span").textContent = expandedState ? this.collapseAllTextValue : this.expandAllTextValue + } +} diff --git a/app/components/essence/expandable_component.rb b/app/components/essence/expandable_component.rb new file mode 100644 index 0000000..e203491 --- /dev/null +++ b/app/components/essence/expandable_component.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +module Essence + class ExpandableComponent < ApplicationComponent + attr_reader :name, :html_options + + DEFAULT_EXPANDED = false + + def initialize(name:, + expanded: DEFAULT_EXPANDED, + **html_options) + @name = name + @expanded = fetch_or_fallback_boolean(expanded, fallback: DEFAULT_EXPANDED) + @html_options = html_options + end + + private + + def before_render + set_base_html_options( + 'expandable', + data: { + controller: 'expandable', + expandable_expanded_value: @expanded, + expandable_expand_all_button_outlet: '.expand-all-button' + } + ) + end + end +end diff --git a/app/components/essence/expandable_component/expandable_component.html.erb b/app/components/essence/expandable_component/expandable_component.html.erb new file mode 100644 index 0000000..6968432 --- /dev/null +++ b/app/components/essence/expandable_component/expandable_component.html.erb @@ -0,0 +1,8 @@ +
> + <%= render Essence::ButtonComponent.new(name:, display_as: :link, type: :button, class: 'expandable-button', data: { action: 'expandable#toggle' }) do |button| %> + <% button.with_left_icon 'arrow_right' %> + <% end %> +
+ <%= content %> +
+
diff --git a/app/components/essence/expandable_component/expandable_component.scss b/app/components/essence/expandable_component/expandable_component.scss new file mode 100644 index 0000000..1200576 --- /dev/null +++ b/app/components/essence/expandable_component/expandable_component.scss @@ -0,0 +1,42 @@ +:root { + --primaryLink-color: deepskyblue; + --primaryLink-hover-color: #0099cc; +} + +$expandable-icon-size: 10px; + +.expandable { + &[data-expandable-expanded-value="false"] { + .expandable-content { + height: 0; + } + } + + &[data-expandable-expanded-value="true"] { + .button-icon { + transform: rotate(90deg); + } + + .expandable-content { + margin-top: 10px; + } + } + + &-button { + font-weight: bold; + + .button-icon { + height: $expandable-icon-size; + width: $expandable-icon-size; + } + } + + &-content { + interpolate-size: allow-keywords; + height: auto; + margin-top: 0; + overflow: hidden; + padding-left: 20px; + transition: height 250ms, margin-top 250ms; + } +} diff --git a/app/components/essence/expandable_component/expandable_component_controller.js b/app/components/essence/expandable_component/expandable_component_controller.js new file mode 100644 index 0000000..5091153 --- /dev/null +++ b/app/components/essence/expandable_component/expandable_component_controller.js @@ -0,0 +1,32 @@ +import { Controller } from "@hotwired/stimulus"; + +export default class extends Controller { + static outlets = [ + "expand-all-button" + ] + + static values = { + expanded: Boolean + } + + toggle() { + this.#updateExpandedState(!this.expandedValue) + } + + expand() { + this.#updateExpandedState(true) + } + + collapse() { + this.#updateExpandedState(false) + } + + #updateExpandedState(expandedState) { + this.expandedValue = expandedState + this.#triggerOutletsCheckExpandables() + } + + #triggerOutletsCheckExpandables() { + this.expandAllButtonOutlets.forEach(expandable => expandable.checkExpandables()) + } +} diff --git a/app/javascript/essence/controllers/index.js b/app/javascript/essence/controllers/index.js index bc6b2be..91642ca 100644 --- a/app/javascript/essence/controllers/index.js +++ b/app/javascript/essence/controllers/index.js @@ -8,5 +8,11 @@ application.register('paragraph', ParagraphComponentController) import ClipboardCopyComponentController from 'components/essence/clipboard_copy_component/clipboard_copy_component_controller' application.register('clipboard-copy', ClipboardCopyComponentController) +import ExpandAllButtonComponentController from 'components/essence/expand_all_button_component/expand_all_button_component_controller' +application.register('expand-all-button', ExpandAllButtonComponentController) + +import ExpandableComponentController from 'components/essence/expandable_component/expandable_component_controller' +application.register('expandable', ExpandableComponentController) + import TooltipComponentController from 'components/essence/tooltip_component/tooltip_component_controller' application.register('tooltip', TooltipComponentController) diff --git a/site/app/previews/essence/expand_all_button_component_preview.rb b/site/app/previews/essence/expand_all_button_component_preview.rb new file mode 100644 index 0000000..eb71a56 --- /dev/null +++ b/site/app/previews/essence/expand_all_button_component_preview.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Essence + # + # @logical_path components + # + class ExpandAllButtonComponentPreview < ViewComponent::Preview + # + # @param expand_all_text + # @param collapse_all_text + # @param target + # + def default(collapse_all_text: 'Collapse all', + expand_all_text: 'Expand all', + target: '.expandable-target') + render Essence::ExpandAllButtonComponent.new(target:, expand_all_text:, collapse_all_text:) + end + end +end diff --git a/site/app/previews/essence/expandable_component_preview.rb b/site/app/previews/essence/expandable_component_preview.rb new file mode 100644 index 0000000..4d3997a --- /dev/null +++ b/site/app/previews/essence/expandable_component_preview.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Essence + # + # @logical_path components + # + class ExpandableComponentPreview < ViewComponent::Preview + # + # @param name + # @param text + # + def default(name: 'Expandable name', + text: 'Expandable text') + render Essence::ExpandableComponent.new(name:) do + text + end + end + end +end diff --git a/spec/components/essence/expand_all_component_spec.rb b/spec/components/essence/expand_all_component_spec.rb new file mode 100644 index 0000000..3d98ce3 --- /dev/null +++ b/spec/components/essence/expand_all_component_spec.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +require "rails_helper" + +RSpec.describe Essence::ExpandAllComponent, type: :component do + pending "add some examples to (or delete) #{__FILE__}" + + # it "renders something useful" do + # expect( + # render_inline(described_class.new(attr: "value")) { "Hello, components!" }.css("p").to_html + # ).to include( + # "Hello, components!" + # ) + # end +end diff --git a/spec/components/essence/expandable_component_spec.rb b/spec/components/essence/expandable_component_spec.rb new file mode 100644 index 0000000..22bad7e --- /dev/null +++ b/spec/components/essence/expandable_component_spec.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +require "rails_helper" + +RSpec.describe Essence::ExpandableComponent, type: :component do + pending "add some examples to (or delete) #{__FILE__}" + + # it "renders something useful" do + # expect( + # render_inline(described_class.new(attr: "value")) { "Hello, components!" }.css("p").to_html + # ).to include( + # "Hello, components!" + # ) + # end +end From e81c10a1c8d82798f53b84f77d43bd58d20c619e Mon Sep 17 00:00:00 2001 From: Unai Abrisketa Date: Thu, 12 Dec 2024 11:56:15 +0100 Subject: [PATCH 3/7] Fix rubocop offenses --- spec/components/essence/expand_all_component_spec.rb | 2 +- spec/components/essence/expandable_component_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/components/essence/expand_all_component_spec.rb b/spec/components/essence/expand_all_component_spec.rb index 3d98ce3..03893e9 100644 --- a/spec/components/essence/expand_all_component_spec.rb +++ b/spec/components/essence/expand_all_component_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require "rails_helper" +require 'rails_helper' RSpec.describe Essence::ExpandAllComponent, type: :component do pending "add some examples to (or delete) #{__FILE__}" diff --git a/spec/components/essence/expandable_component_spec.rb b/spec/components/essence/expandable_component_spec.rb index 22bad7e..baeaddc 100644 --- a/spec/components/essence/expandable_component_spec.rb +++ b/spec/components/essence/expandable_component_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require "rails_helper" +require 'rails_helper' RSpec.describe Essence::ExpandableComponent, type: :component do pending "add some examples to (or delete) #{__FILE__}" From 5fd8052f857081b14b7d06d326d6726b9ebcf733 Mon Sep 17 00:00:00 2001 From: Unai Abrisketa Date: Thu, 12 Dec 2024 12:00:00 +0100 Subject: [PATCH 4/7] Fix component name --- spec/components/essence/expand_all_component_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/components/essence/expand_all_component_spec.rb b/spec/components/essence/expand_all_component_spec.rb index 03893e9..a45f007 100644 --- a/spec/components/essence/expand_all_component_spec.rb +++ b/spec/components/essence/expand_all_component_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe Essence::ExpandAllComponent, type: :component do +RSpec.describe Essence::ExpandAllButtonComponent, type: :component do pending "add some examples to (or delete) #{__FILE__}" # it "renders something useful" do From 088d5c906b154f03dadd14946217bd4454590823 Mon Sep 17 00:00:00 2001 From: Unai Abrisketa Date: Thu, 12 Dec 2024 12:05:35 +0100 Subject: [PATCH 5/7] Update dependencies --- Gemfile.lock | 245 +++++++++++++++++++++++++----------------------- essence.gemspec | 2 +- 2 files changed, 128 insertions(+), 119 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 8b4928b..a971202 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,7 +6,7 @@ PATH gretel (~> 5.0) importmap-rails (~> 2.0) inline_svg (~> 1.10) - rails (>= 7.1.4) + rails (~> 7.1.4) sassc-rails (~> 2.1) simple_form (~> 5.3) stimulus-rails (~> 1.3) @@ -15,82 +15,90 @@ PATH GEM remote: https://rubygems.org/ specs: - actioncable (7.2.1.1) - actionpack (= 7.2.1.1) - activesupport (= 7.2.1.1) + actioncable (7.1.5.1) + actionpack (= 7.1.5.1) + activesupport (= 7.1.5.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (7.2.1.1) - actionpack (= 7.2.1.1) - activejob (= 7.2.1.1) - activerecord (= 7.2.1.1) - activestorage (= 7.2.1.1) - activesupport (= 7.2.1.1) - mail (>= 2.8.0) - actionmailer (7.2.1.1) - actionpack (= 7.2.1.1) - actionview (= 7.2.1.1) - activejob (= 7.2.1.1) - activesupport (= 7.2.1.1) - mail (>= 2.8.0) + actionmailbox (7.1.5.1) + actionpack (= 7.1.5.1) + activejob (= 7.1.5.1) + activerecord (= 7.1.5.1) + activestorage (= 7.1.5.1) + activesupport (= 7.1.5.1) + mail (>= 2.7.1) + net-imap + net-pop + net-smtp + actionmailer (7.1.5.1) + actionpack (= 7.1.5.1) + actionview (= 7.1.5.1) + activejob (= 7.1.5.1) + activesupport (= 7.1.5.1) + mail (~> 2.5, >= 2.5.4) + net-imap + net-pop + net-smtp rails-dom-testing (~> 2.2) - actionpack (7.2.1.1) - actionview (= 7.2.1.1) - activesupport (= 7.2.1.1) + actionpack (7.1.5.1) + actionview (= 7.1.5.1) + activesupport (= 7.1.5.1) nokogiri (>= 1.8.5) racc - rack (>= 2.2.4, < 3.2) + rack (>= 2.2.4) rack-session (>= 1.0.1) rack-test (>= 0.6.3) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - useragent (~> 0.16) - actiontext (7.2.1.1) - actionpack (= 7.2.1.1) - activerecord (= 7.2.1.1) - activestorage (= 7.2.1.1) - activesupport (= 7.2.1.1) + actiontext (7.1.5.1) + actionpack (= 7.1.5.1) + activerecord (= 7.1.5.1) + activestorage (= 7.1.5.1) + activesupport (= 7.1.5.1) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.2.1.1) - activesupport (= 7.2.1.1) + actionview (7.1.5.1) + activesupport (= 7.1.5.1) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - activejob (7.2.1.1) - activesupport (= 7.2.1.1) + activejob (7.1.5.1) + activesupport (= 7.1.5.1) globalid (>= 0.3.6) - activemodel (7.2.1.1) - activesupport (= 7.2.1.1) - activerecord (7.2.1.1) - activemodel (= 7.2.1.1) - activesupport (= 7.2.1.1) + activemodel (7.1.5.1) + activesupport (= 7.1.5.1) + activerecord (7.1.5.1) + activemodel (= 7.1.5.1) + activesupport (= 7.1.5.1) timeout (>= 0.4.0) - activestorage (7.2.1.1) - actionpack (= 7.2.1.1) - activejob (= 7.2.1.1) - activerecord (= 7.2.1.1) - activesupport (= 7.2.1.1) + activestorage (7.1.5.1) + actionpack (= 7.1.5.1) + activejob (= 7.1.5.1) + activerecord (= 7.1.5.1) + activesupport (= 7.1.5.1) marcel (~> 1.0) - activesupport (7.2.1.1) + activesupport (7.1.5.1) base64 + benchmark (>= 0.3) bigdecimal - concurrent-ruby (~> 1.0, >= 1.3.1) + concurrent-ruby (~> 1.0, >= 1.0.2) connection_pool (>= 2.2.5) drb i18n (>= 1.6, < 2) logger (>= 1.4.2) minitest (>= 5.1) + mutex_m securerandom (>= 0.3) - tzinfo (~> 2.0, >= 2.0.5) + tzinfo (~> 2.0) addressable (2.8.7) public_suffix (>= 2.0.2, < 7.0) ast (2.4.2) base64 (0.2.0) + benchmark (0.4.0) bigdecimal (3.1.8) - brakeman (6.2.1) + brakeman (6.2.2) racc builder (3.3.0) capybara (3.40.0) @@ -111,7 +119,7 @@ GEM crass (1.0.6) css_parser (1.19.1) addressable - date (3.3.4) + date (3.4.1) diff-lcs (1.5.1) drb (2.2.1) erubi (1.13.0) @@ -141,17 +149,17 @@ GEM inline_svg (1.10.0) activesupport (>= 3.0) nokogiri (>= 1.6) - io-console (0.7.2) + io-console (0.8.0) irb (1.14.1) rdoc (>= 4.0.0) reline (>= 0.4.2) - json (2.7.2) + json (2.9.0) language_server-protocol (3.17.0.3) - logger (1.6.1) - loofah (2.22.0) + logger (1.6.2) + loofah (2.23.1) crass (~> 1.0.2) nokogiri (>= 1.12.0) - lookbook (2.3.2) + lookbook (2.3.4) activemodel css_parser htmlbeautifier (~> 1.3) @@ -172,8 +180,9 @@ GEM matrix (0.4.2) method_source (1.1.0) mini_mime (1.1.5) - minitest (5.25.1) - net-imap (0.4.17) + minitest (5.25.4) + mutex_m (0.3.0) + net-imap (0.5.1) date net-protocol net-pop (0.1.2) @@ -182,27 +191,28 @@ GEM timeout net-smtp (0.5.0) net-protocol - nio4r (2.7.3) - nokogiri (1.16.7-aarch64-linux) + nio4r (2.7.4) + nokogiri (1.17.1-aarch64-linux) racc (~> 1.4) - nokogiri (1.16.7-arm-linux) + nokogiri (1.17.1-arm-linux) racc (~> 1.4) - nokogiri (1.16.7-arm64-darwin) + nokogiri (1.17.1-arm64-darwin) racc (~> 1.4) - nokogiri (1.16.7-x86-linux) + nokogiri (1.17.1-x86-linux) racc (~> 1.4) - nokogiri (1.16.7-x86_64-darwin) + nokogiri (1.17.1-x86_64-darwin) racc (~> 1.4) - nokogiri (1.16.7-x86_64-linux) + nokogiri (1.17.1-x86_64-linux) racc (~> 1.4) parallel (1.26.3) - parser (3.3.5.0) + parser (3.3.6.0) ast (~> 2.4.1) racc - psych (5.1.2) + psych (5.2.1) + date stringio public_suffix (6.0.1) - puma (6.4.3) + puma (6.5.0) nio4r (~> 2.0) racc (1.8.1) rack (3.1.8) @@ -210,49 +220,48 @@ GEM rack (>= 3.0.0) rack-test (2.1.0) rack (>= 1.3) - rackup (2.1.0) + rackup (2.2.1) rack (>= 3) - webrick (~> 1.8) - rails (7.2.1.1) - actioncable (= 7.2.1.1) - actionmailbox (= 7.2.1.1) - actionmailer (= 7.2.1.1) - actionpack (= 7.2.1.1) - actiontext (= 7.2.1.1) - actionview (= 7.2.1.1) - activejob (= 7.2.1.1) - activemodel (= 7.2.1.1) - activerecord (= 7.2.1.1) - activestorage (= 7.2.1.1) - activesupport (= 7.2.1.1) + rails (7.1.5.1) + actioncable (= 7.1.5.1) + actionmailbox (= 7.1.5.1) + actionmailer (= 7.1.5.1) + actionpack (= 7.1.5.1) + actiontext (= 7.1.5.1) + actionview (= 7.1.5.1) + activejob (= 7.1.5.1) + activemodel (= 7.1.5.1) + activerecord (= 7.1.5.1) + activestorage (= 7.1.5.1) + activesupport (= 7.1.5.1) bundler (>= 1.15.0) - railties (= 7.2.1.1) + railties (= 7.1.5.1) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.6.0) + rails-html-sanitizer (1.6.1) loofah (~> 2.21) - nokogiri (~> 1.14) - railties (7.2.1.1) - actionpack (= 7.2.1.1) - activesupport (= 7.2.1.1) - irb (~> 1.13) + 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.1.5.1) + actionpack (= 7.1.5.1) + activesupport (= 7.1.5.1) + irb rackup (>= 1.0.0) rake (>= 12.2) thor (~> 1.0, >= 1.2.2) zeitwerk (~> 2.6) rainbow (3.1.1) rake (13.2.1) - rdoc (6.7.0) + rdoc (6.8.1) psych (>= 4.0.0) redcarpet (3.6.0) - regexp_parser (2.9.2) - reline (0.5.10) + regexp_parser (2.9.3) + reline (0.5.12) io-console (~> 0.5) - rexml (3.3.8) - rouge (4.4.0) - rspec-core (3.13.1) + rexml (3.3.9) + rouge (4.5.1) + rspec-core (3.13.2) rspec-support (~> 3.13.0) rspec-expectations (3.13.3) diff-lcs (>= 1.2.0, < 2.0) @@ -262,7 +271,7 @@ GEM rspec-mocks (3.13.2) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-rails (7.0.1) + rspec-rails (7.1.0) actionpack (>= 7.0) activesupport (>= 7.0) railties (>= 7.0) @@ -270,20 +279,20 @@ GEM rspec-expectations (~> 3.13) rspec-mocks (~> 3.13) rspec-support (~> 3.13) - rspec-support (3.13.1) - rubocop (1.67.0) + rspec-support (3.13.2) + rubocop (1.69.1) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 2.4, < 3.0) - rubocop-ast (>= 1.32.2, < 2.0) + regexp_parser (>= 2.9.3, < 3.0) + rubocop-ast (>= 1.36.2, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.32.3) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.36.2) parser (>= 3.3.1.0) - rubocop-rails (2.26.2) + rubocop-rails (2.27.0) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.52.0, < 2.0) @@ -298,8 +307,8 @@ GEM sprockets (> 3.0) sprockets-rails tilt - securerandom (0.3.1) - selenium-webdriver (4.25.0) + securerandom (0.4.0) + selenium-webdriver (4.27.0) base64 (~> 0.2) logger (~> 1.4) rexml (~> 3.2, >= 3.2.5) @@ -315,32 +324,32 @@ GEM actionpack (>= 6.1) activesupport (>= 6.1) sprockets (>= 3.0.0) - sqlite3 (2.1.0-aarch64-linux-gnu) - sqlite3 (2.1.0-aarch64-linux-musl) - sqlite3 (2.1.0-arm-linux-gnu) - sqlite3 (2.1.0-arm-linux-musl) - sqlite3 (2.1.0-arm64-darwin) - sqlite3 (2.1.0-x86-linux-gnu) - sqlite3 (2.1.0-x86-linux-musl) - sqlite3 (2.1.0-x86_64-darwin) - sqlite3 (2.1.0-x86_64-linux-gnu) - sqlite3 (2.1.0-x86_64-linux-musl) + sqlite3 (2.4.1-aarch64-linux-gnu) + sqlite3 (2.4.1-aarch64-linux-musl) + sqlite3 (2.4.1-arm-linux-gnu) + sqlite3 (2.4.1-arm-linux-musl) + sqlite3 (2.4.1-arm64-darwin) + sqlite3 (2.4.1-x86-linux-gnu) + sqlite3 (2.4.1-x86-linux-musl) + sqlite3 (2.4.1-x86_64-darwin) + sqlite3 (2.4.1-x86_64-linux-gnu) + sqlite3 (2.4.1-x86_64-linux-musl) stimulus-rails (1.3.4) railties (>= 6.0.0) - stringio (3.1.1) + stringio (3.1.2) thor (1.3.2) tilt (2.4.0) - timeout (0.4.1) + timeout (0.4.2) tzinfo (2.0.6) concurrent-ruby (~> 1.0) unaccent (0.4.0) - unicode-display_width (2.6.0) - useragent (0.16.10) - view_component (3.17.0) - activesupport (>= 5.2.0, < 8.0) + unicode-display_width (3.1.2) + unicode-emoji (~> 4.0, >= 4.0.4) + unicode-emoji (4.0.4) + view_component (3.20.0) + activesupport (>= 5.2.0, < 8.1) concurrent-ruby (~> 1.0) method_source (~> 1.0) - webrick (1.8.2) websocket (1.2.11) websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) @@ -348,7 +357,7 @@ GEM xpath (3.2.0) nokogiri (~> 1.8) yard (0.9.37) - zeitwerk (2.7.0) + zeitwerk (2.7.1) PLATFORMS aarch64-linux diff --git a/essence.gemspec b/essence.gemspec index 6625623..c2a0fbd 100644 --- a/essence.gemspec +++ b/essence.gemspec @@ -43,7 +43,7 @@ Gem::Specification.new do |spec| spec.add_dependency 'gretel', '~> 5.0' spec.add_dependency 'importmap-rails', '~> 2.0' spec.add_dependency 'inline_svg', '~> 1.10' - spec.add_dependency 'rails', '>= 7.1.4' + spec.add_dependency 'rails', '~> 7.1.4' spec.add_dependency 'sassc-rails', '~> 2.1' spec.add_dependency 'simple_form', '~> 5.3' spec.add_dependency 'stimulus-rails', '~> 1.3' From 3f3e928484c556f6f79bd46b1bcd91314bd3cfda Mon Sep 17 00:00:00 2001 From: Unai Abrisketa Date: Thu, 12 Dec 2024 12:39:02 +0100 Subject: [PATCH 6/7] Refactor text assignment in status_component for clarity --- app/components/essence/status_component.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/components/essence/status_component.rb b/app/components/essence/status_component.rb index 49cb878..1094522 100644 --- a/app/components/essence/status_component.rb +++ b/app/components/essence/status_component.rb @@ -30,7 +30,7 @@ def initialize(text:, variant: DEFAULT_VARIANT, bubble: DEFAULT_BUBBLE, **html_options) - @text = text&.to_s&.strip&.presence&.downcase + @text = text.presence&.strip&.downcase @variant = fetch_or_fallback(VARIANT_OPTIONS, variant.to_sym, DEFAULT_VARIANT) @bubble = fetch_or_fallback(BUBBLE_OPTIONS, bubble&.to_sym, DEFAULT_BUBBLE) @html_options = html_options From d3fcfcc227e6dea1420d5bdabead5e94a42b4fde Mon Sep 17 00:00:00 2001 From: Unai Abrisketa Date: Thu, 12 Dec 2024 12:53:06 +0100 Subject: [PATCH 7/7] Update Rails dependency to allow versions >= 7.1.4 and < 8.0 --- Gemfile.lock | 130 +++++++++++++++++++++++------------------------- essence.gemspec | 2 +- 2 files changed, 63 insertions(+), 69 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index a971202..2817ad1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,7 +6,7 @@ PATH gretel (~> 5.0) importmap-rails (~> 2.0) inline_svg (~> 1.10) - rails (~> 7.1.4) + rails (>= 7.1.4, < 8.0) sassc-rails (~> 2.1) simple_form (~> 5.3) stimulus-rails (~> 1.3) @@ -15,83 +15,77 @@ PATH GEM remote: https://rubygems.org/ specs: - actioncable (7.1.5.1) - actionpack (= 7.1.5.1) - activesupport (= 7.1.5.1) + actioncable (7.2.2.1) + actionpack (= 7.2.2.1) + activesupport (= 7.2.2.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (7.1.5.1) - actionpack (= 7.1.5.1) - activejob (= 7.1.5.1) - activerecord (= 7.1.5.1) - activestorage (= 7.1.5.1) - activesupport (= 7.1.5.1) - mail (>= 2.7.1) - net-imap - net-pop - net-smtp - actionmailer (7.1.5.1) - actionpack (= 7.1.5.1) - actionview (= 7.1.5.1) - activejob (= 7.1.5.1) - activesupport (= 7.1.5.1) - mail (~> 2.5, >= 2.5.4) - net-imap - net-pop - net-smtp + actionmailbox (7.2.2.1) + actionpack (= 7.2.2.1) + activejob (= 7.2.2.1) + activerecord (= 7.2.2.1) + activestorage (= 7.2.2.1) + activesupport (= 7.2.2.1) + mail (>= 2.8.0) + actionmailer (7.2.2.1) + actionpack (= 7.2.2.1) + actionview (= 7.2.2.1) + activejob (= 7.2.2.1) + activesupport (= 7.2.2.1) + mail (>= 2.8.0) rails-dom-testing (~> 2.2) - actionpack (7.1.5.1) - actionview (= 7.1.5.1) - activesupport (= 7.1.5.1) + actionpack (7.2.2.1) + actionview (= 7.2.2.1) + activesupport (= 7.2.2.1) nokogiri (>= 1.8.5) racc - rack (>= 2.2.4) + rack (>= 2.2.4, < 3.2) rack-session (>= 1.0.1) rack-test (>= 0.6.3) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - actiontext (7.1.5.1) - actionpack (= 7.1.5.1) - activerecord (= 7.1.5.1) - activestorage (= 7.1.5.1) - activesupport (= 7.1.5.1) + useragent (~> 0.16) + actiontext (7.2.2.1) + actionpack (= 7.2.2.1) + activerecord (= 7.2.2.1) + activestorage (= 7.2.2.1) + activesupport (= 7.2.2.1) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.1.5.1) - activesupport (= 7.1.5.1) + actionview (7.2.2.1) + activesupport (= 7.2.2.1) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - activejob (7.1.5.1) - activesupport (= 7.1.5.1) + activejob (7.2.2.1) + activesupport (= 7.2.2.1) globalid (>= 0.3.6) - activemodel (7.1.5.1) - activesupport (= 7.1.5.1) - activerecord (7.1.5.1) - activemodel (= 7.1.5.1) - activesupport (= 7.1.5.1) + activemodel (7.2.2.1) + activesupport (= 7.2.2.1) + activerecord (7.2.2.1) + activemodel (= 7.2.2.1) + activesupport (= 7.2.2.1) timeout (>= 0.4.0) - activestorage (7.1.5.1) - actionpack (= 7.1.5.1) - activejob (= 7.1.5.1) - activerecord (= 7.1.5.1) - activesupport (= 7.1.5.1) + activestorage (7.2.2.1) + actionpack (= 7.2.2.1) + activejob (= 7.2.2.1) + activerecord (= 7.2.2.1) + activesupport (= 7.2.2.1) marcel (~> 1.0) - activesupport (7.1.5.1) + activesupport (7.2.2.1) base64 benchmark (>= 0.3) bigdecimal - concurrent-ruby (~> 1.0, >= 1.0.2) + concurrent-ruby (~> 1.0, >= 1.3.1) connection_pool (>= 2.2.5) drb i18n (>= 1.6, < 2) logger (>= 1.4.2) minitest (>= 5.1) - mutex_m securerandom (>= 0.3) - tzinfo (~> 2.0) + tzinfo (~> 2.0, >= 2.0.5) addressable (2.8.7) public_suffix (>= 2.0.2, < 7.0) ast (2.4.2) @@ -181,7 +175,6 @@ GEM method_source (1.1.0) mini_mime (1.1.5) minitest (5.25.4) - mutex_m (0.3.0) net-imap (0.5.1) date net-protocol @@ -222,20 +215,20 @@ GEM rack (>= 1.3) rackup (2.2.1) rack (>= 3) - rails (7.1.5.1) - actioncable (= 7.1.5.1) - actionmailbox (= 7.1.5.1) - actionmailer (= 7.1.5.1) - actionpack (= 7.1.5.1) - actiontext (= 7.1.5.1) - actionview (= 7.1.5.1) - activejob (= 7.1.5.1) - activemodel (= 7.1.5.1) - activerecord (= 7.1.5.1) - activestorage (= 7.1.5.1) - activesupport (= 7.1.5.1) + rails (7.2.2.1) + actioncable (= 7.2.2.1) + actionmailbox (= 7.2.2.1) + actionmailer (= 7.2.2.1) + actionpack (= 7.2.2.1) + actiontext (= 7.2.2.1) + actionview (= 7.2.2.1) + activejob (= 7.2.2.1) + activemodel (= 7.2.2.1) + activerecord (= 7.2.2.1) + activestorage (= 7.2.2.1) + activesupport (= 7.2.2.1) bundler (>= 1.15.0) - railties (= 7.1.5.1) + railties (= 7.2.2.1) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -243,10 +236,10 @@ GEM rails-html-sanitizer (1.6.1) loofah (~> 2.21) 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.1.5.1) - actionpack (= 7.1.5.1) - activesupport (= 7.1.5.1) - irb + railties (7.2.2.1) + actionpack (= 7.2.2.1) + activesupport (= 7.2.2.1) + irb (~> 1.13) rackup (>= 1.0.0) rake (>= 12.2) thor (~> 1.0, >= 1.2.2) @@ -346,6 +339,7 @@ GEM unicode-display_width (3.1.2) unicode-emoji (~> 4.0, >= 4.0.4) unicode-emoji (4.0.4) + useragent (0.16.11) view_component (3.20.0) activesupport (>= 5.2.0, < 8.1) concurrent-ruby (~> 1.0) diff --git a/essence.gemspec b/essence.gemspec index c2a0fbd..5e2d454 100644 --- a/essence.gemspec +++ b/essence.gemspec @@ -43,7 +43,7 @@ Gem::Specification.new do |spec| spec.add_dependency 'gretel', '~> 5.0' spec.add_dependency 'importmap-rails', '~> 2.0' spec.add_dependency 'inline_svg', '~> 1.10' - spec.add_dependency 'rails', '~> 7.1.4' + spec.add_dependency 'rails', '>= 7.1.4', '< 8.0' spec.add_dependency 'sassc-rails', '~> 2.1' spec.add_dependency 'simple_form', '~> 5.3' spec.add_dependency 'stimulus-rails', '~> 1.3'