dsfr-view-components 2.1.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 03d38ef8a83c41d5ab9bf87104210ba23ba7575c895c2220ca07c139463b8c9e
4
- data.tar.gz: 479342fcb5bdaffc4b164d62072b2abb5a16606be8009c2bc355701b70f3b89b
3
+ metadata.gz: 6fd43d49e7920aa1ae37d143b9503c68b1d44aad46e5a3acde610b7a0ae9da96
4
+ data.tar.gz: b3a7d11b90ff73cad4023f517bd3d567141648e25cdf200b1204daf2dcde8db7
5
5
  SHA512:
6
- metadata.gz: 64b0c74cef32df4432489d2f2f1a320a46fa20ab1c9235298869569d83edad665245f94df8ce113eb7635d615dd3a339aa66538fb17fc3e40cf414c41e51474f
7
- data.tar.gz: cbb2749d28d8af2b8a42c142160c78035f111313cbc7fe60d8c526d24b4a638615611b6d26aeea302adbbcfc47acb168b36cc25804a6809e12f83be2527d1897
6
+ metadata.gz: 4508aef35cb1afd72ca39df0e89c74290f8a4f9ebfe47c8ff2b7ce8fbcb4fba3ff2d647ecfcc41eb585b515ef378716496c1355e917d2a7b59fc38ba3faa93a5
7
+ data.tar.gz: f9391b2ef8ddfcdd985305d823ded7fb73add4d05eb05c8be8d30cec1a7cdf2d07b6d1df44bbd5ae18a609b5fb7d9934b54c192715449321ff2493638919f570
@@ -7,6 +7,8 @@ class DsfrComponent::Base < ViewComponent::Base
7
7
 
8
8
  HEADING_LEVELS = [1, 2, 3, 4, 5, 6].freeze
9
9
 
10
+ SIZES = %i[sm md lg].freeze
11
+
10
12
  def initialize(classes:, html_attributes:)
11
13
  if classes.nil?
12
14
  Rails.logger.warn("classes is nil, if no custom classes are needed omit the param")
@@ -0,0 +1,30 @@
1
+ module DsfrComponent
2
+ class HighlightComponent < DsfrComponent::Base
3
+ # @param text [String] Le contenu textuel du composant
4
+ # @param size [Symbol] La taille de la mise en exergue
5
+ def initialize(text:, size: :md, classes: [], html_attributes: {})
6
+ @text = text
7
+ @size = size
8
+
9
+ raise ArgumentError if not SIZES.include?(size)
10
+
11
+ super(classes: classes, html_attributes: html_attributes)
12
+ end
13
+
14
+ def call
15
+ tag.div(**html_attributes) do
16
+ tag.p(class: "fr-text--#{@size}") do
17
+ @text
18
+ end
19
+ end
20
+ end
21
+
22
+ private
23
+
24
+ attr_reader :text, :size
25
+
26
+ def default_attributes
27
+ { class: 'fr-highlight' }
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,11 @@
1
+ <%= tag.div(**html_attributes) do %>
2
+ <nav class="fr-container" role="navigation" aria-label="<%= label %>">
3
+ <ul class="fr-skiplinks__list">
4
+ <% links.each do |link| %>
5
+ <li>
6
+ <%= link %>
7
+ </li>
8
+ <% end %>
9
+ </ul>
10
+ </nav>
11
+ <% end %>
@@ -0,0 +1,20 @@
1
+ module DsfrComponent
2
+ class SkiplinkComponent < DsfrComponent::Base
3
+ # @param label [String] le texte utilisé pour le aria-label de la nav qui affiche les liens d’évitement (par exemple « Accès rapide »)
4
+ # @param links [Array] liste de liens HTML
5
+ def initialize(label:, links:, classes: [], html_attributes: {})
6
+ @label = label
7
+ @links = links
8
+
9
+ super(classes: classes, html_attributes: html_attributes)
10
+ end
11
+
12
+ private
13
+
14
+ attr_reader :label, :links
15
+
16
+ def default_attributes
17
+ { class: 'fr-skiplinks' }
18
+ end
19
+ end
20
+ end
@@ -16,6 +16,8 @@ module DsfrComponentsHelper
16
16
  dsfr_header_direct_link: 'DsfrComponent::HeaderComponent::DirectLinkComponent',
17
17
  dsfr_header_direct_dropdown_link: 'DsfrComponent::HeaderComponent::DirectLinkDropdownComponent',
18
18
  dsfr_tabs: 'DsfrComponent::TabsComponent',
19
+ dsfr_highlight: 'DsfrComponent::HighlightComponent',
20
+ dsfr_skiplink: 'DsfrComponent::SkiplinkComponent',
19
21
  # DO NOT REMOVE: new component mapping here
20
22
  }.freeze
21
23
  HELPER_NAME_TO_CLASS_NAME.each do |name, klass|
@@ -1,5 +1,5 @@
1
1
  module Dsfr
2
2
  module Components
3
- VERSION = '2.1.0'.freeze
3
+ VERSION = '2.1.1'.freeze
4
4
  end
5
5
  end
@@ -3,4 +3,3 @@ require "view_component"
3
3
  require "dsfr/components/helpers/css_utilities"
4
4
  require "dsfr/components/engine"
5
5
  require "html_attributes_utils"
6
- require "pagy"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dsfr-view-components
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - BetaGouv developers
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-01-21 00:00:00.000000000 Z
10
+ date: 2025-02-03 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: html-attributes-utils
@@ -23,20 +23,6 @@ dependencies:
23
23
  - - "~>"
24
24
  - !ruby/object:Gem::Version
25
25
  version: '1'
26
- - !ruby/object:Gem::Dependency
27
- name: pagy
28
- requirement: !ruby/object:Gem::Requirement
29
- requirements:
30
- - - "~>"
31
- - !ruby/object:Gem::Version
32
- version: '6'
33
- type: :runtime
34
- prerelease: false
35
- version_requirements: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - "~>"
38
- - !ruby/object:Gem::Version
39
- version: '6'
40
26
  - !ruby/object:Gem::Dependency
41
27
  name: view_component
42
28
  requirement: !ruby/object:Gem::Requirement
@@ -388,8 +374,11 @@ files:
388
374
  - app/components/dsfr_component/header_component/direct_link_dropdown_component.rb
389
375
  - app/components/dsfr_component/header_component/operator_image_component.rb
390
376
  - app/components/dsfr_component/header_component/tool_link_component.rb
377
+ - app/components/dsfr_component/highlight_component.rb
391
378
  - app/components/dsfr_component/modal_component.html.erb
392
379
  - app/components/dsfr_component/modal_component.rb
380
+ - app/components/dsfr_component/skiplink_component.html.erb
381
+ - app/components/dsfr_component/skiplink_component.rb
393
382
  - app/components/dsfr_component/stepper_component.html.erb
394
383
  - app/components/dsfr_component/stepper_component.rb
395
384
  - app/components/dsfr_component/tabs_component.html.erb