dsfr-view-components 2.1.2 → 2.2.0
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 +4 -4
- data/app/components/dsfr_component/accordion_component/section_component.rb +1 -2
- data/app/components/dsfr_component/accordion_component.rb +3 -4
- data/app/components/dsfr_component/alert_component.rb +38 -22
- data/app/components/dsfr_component/badge_component.rb +3 -5
- data/app/components/dsfr_component/base.rb +1 -14
- data/app/components/dsfr_component/breadcrumbs_component.rb +0 -4
- data/app/components/dsfr_component/button_component.rb +2 -2
- data/app/components/dsfr_component/callout_component.rb +1 -2
- data/app/components/dsfr_component/header_component/direct_link_component.rb +2 -2
- data/app/components/dsfr_component/header_component/direct_link_dropdown_component.rb +2 -2
- data/app/components/dsfr_component/header_component/operator_image_component.rb +2 -2
- data/app/components/dsfr_component/header_component/tool_link_component.rb +2 -2
- data/app/components/dsfr_component/header_component.rb +2 -2
- data/app/components/dsfr_component/highlight_component.rb +2 -2
- data/app/components/dsfr_component/modal_component.rb +2 -2
- data/app/components/dsfr_component/notice_component.rb +2 -2
- data/app/components/dsfr_component/{search_bar_component.html.erb → search_component.html.erb} +4 -1
- data/app/components/dsfr_component/{search_bar_component.rb → search_component.rb} +11 -3
- data/app/components/dsfr_component/skiplink_component.rb +2 -2
- data/app/components/dsfr_component/stepper_component.rb +2 -2
- data/app/components/dsfr_component/tabs_component/tab_component.rb +2 -2
- data/app/components/dsfr_component/tabs_component.rb +2 -2
- data/app/components/dsfr_component/tag_component.rb +2 -2
- data/app/components/dsfr_component/tile_component.rb +2 -2
- data/app/helpers/dsfr_components_helper.rb +1 -1
- data/lib/dsfr/components/version.rb +1 -1
- metadata +5 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3abead9a7b02e13cbbe5cfa9e1d9efa24db78ff92e6560920823e232da2686a
|
4
|
+
data.tar.gz: 1257756ffd30ee9e631a095967f7c430b7902516952b4f328e8ba9f54825c994
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93de62ccadb3a81c1991ff9f85c42e4f52e0dad62513b958656b20eac58b6a376f67b5394ea395def361bb7cc22e08a26a16681783eec5d2c3889ae5bc3128da
|
7
|
+
data.tar.gz: 79b0c4176685a04c0875ccd70a015ba70aeae6ff948fcf907538211e98880cde86dae51097edd14e0a45f69f8f4866c6a2c6cfe7b60aa361b609a463e14aa67a
|
@@ -13,7 +13,6 @@ class DsfrComponent::AccordionComponent::SectionComponent < DsfrComponent::Base
|
|
13
13
|
starting_header_level:,
|
14
14
|
expanded: false,
|
15
15
|
id: nil,
|
16
|
-
classes: [],
|
17
16
|
html_attributes: {}
|
18
17
|
)
|
19
18
|
@title = title
|
@@ -21,7 +20,7 @@ class DsfrComponent::AccordionComponent::SectionComponent < DsfrComponent::Base
|
|
21
20
|
@id = id
|
22
21
|
@starting_header_level = starting_header_level
|
23
22
|
|
24
|
-
super(
|
23
|
+
super(html_attributes: html_attributes)
|
25
24
|
end
|
26
25
|
|
27
26
|
def id
|
@@ -1,9 +1,8 @@
|
|
1
1
|
class DsfrComponent::AccordionComponent < DsfrComponent::Base
|
2
2
|
include DsfrComponent::Traits::HeaderSizeable
|
3
3
|
|
4
|
-
renders_many :sections, ->(title: nil, expanded: false, id: nil,
|
4
|
+
renders_many :sections, ->(title: nil, expanded: false, id: nil, html_attributes: {}, &block) do
|
5
5
|
DsfrComponent::AccordionComponent::SectionComponent.new(
|
6
|
-
classes: classes,
|
7
6
|
expanded: expanded,
|
8
7
|
html_attributes: html_attributes,
|
9
8
|
title: title,
|
@@ -13,10 +12,10 @@ class DsfrComponent::AccordionComponent < DsfrComponent::Base
|
|
13
12
|
)
|
14
13
|
end
|
15
14
|
|
16
|
-
def initialize(
|
15
|
+
def initialize(html_attributes: {}, starting_header_level: nil)
|
17
16
|
@starting_header_level = starting_header_level
|
18
17
|
|
19
|
-
super(
|
18
|
+
super(html_attributes: html_attributes)
|
20
19
|
end
|
21
20
|
|
22
21
|
private
|
@@ -7,20 +7,19 @@ class DsfrComponent::AlertComponent < DsfrComponent::Base
|
|
7
7
|
# @param size [Symbol] alert size : `:md` (default) or `:sm`
|
8
8
|
# @param close_button [Boolean] display a close button to remove the alert
|
9
9
|
# @note in size MD the title is required but the content is optional. In size SM there should be not title but the content is required
|
10
|
-
def initialize(type: nil, title: nil, size: :md, close_button: false, icon_name: nil,
|
10
|
+
def initialize(type: nil, title: nil, size: :md, close_button: false, icon_name: nil, html_attributes: {})
|
11
11
|
@title = title
|
12
12
|
@type = type
|
13
13
|
@size = size
|
14
14
|
@close_button = close_button
|
15
15
|
@icon_name = icon_name
|
16
16
|
|
17
|
-
super(
|
17
|
+
super(html_attributes: html_attributes)
|
18
18
|
end
|
19
19
|
|
20
20
|
def call
|
21
|
-
|
22
|
-
|
23
|
-
raise ArgumentError, "icon_name should be set only on default alert" if @type && @icon_name
|
21
|
+
check_main_content!
|
22
|
+
check_icon_allowed!
|
24
23
|
|
25
24
|
tag.div(**html_attributes) do
|
26
25
|
safe_join([title_tag, content_tag, close_button_tag])
|
@@ -35,6 +34,32 @@ private
|
|
35
34
|
{ class: %w(fr-alert) + [icon_class, type_class, size_class].compact }
|
36
35
|
end
|
37
36
|
|
37
|
+
def default_type?
|
38
|
+
type.nil?
|
39
|
+
end
|
40
|
+
|
41
|
+
def check_icon_allowed!
|
42
|
+
raise ArgumentError, "a custom icon can only be used on default alert types" if icon_name && !default_type?
|
43
|
+
end
|
44
|
+
|
45
|
+
def main_content?
|
46
|
+
case size
|
47
|
+
when :sm
|
48
|
+
content.present? && title.blank?
|
49
|
+
when :md
|
50
|
+
content.present? || title.present?
|
51
|
+
else
|
52
|
+
raise ArgumentError, "invalid alert size: '#{size}', supported sizes are #{SIZES.to_sentence}"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def check_main_content!
|
57
|
+
raise(
|
58
|
+
ArgumentError,
|
59
|
+
"You must provide a title for medium alerts, but you can't use it for small alerts (use content instead)"
|
60
|
+
) if not main_content?
|
61
|
+
end
|
62
|
+
|
38
63
|
def title_tag
|
39
64
|
return nil if title.blank?
|
40
65
|
|
@@ -65,34 +90,25 @@ private
|
|
65
90
|
"fr-icon-#{icon_name}"
|
66
91
|
end
|
67
92
|
|
68
|
-
def type_class
|
69
|
-
return nil if type.blank?
|
70
|
-
fail(ArgumentError, type_error_message) unless valid_type?
|
71
|
-
|
72
|
-
"fr-alert--#{type}"
|
73
|
-
end
|
74
|
-
|
75
93
|
def valid_type?
|
76
94
|
type.in?(TYPES)
|
77
95
|
end
|
78
96
|
|
79
|
-
def
|
80
|
-
|
81
|
-
end
|
82
|
-
|
83
|
-
def size_class
|
84
|
-
return nil if size == :md
|
97
|
+
def type_class
|
98
|
+
return nil if type.blank?
|
85
99
|
|
86
|
-
|
100
|
+
raise ArgumentError, "invalid alert type #{type}, supported types are #{TYPES.to_sentence}" unless valid_type?
|
87
101
|
|
88
|
-
"fr-alert--#{
|
102
|
+
"fr-alert--#{type}"
|
89
103
|
end
|
90
104
|
|
91
105
|
def valid_size?
|
92
106
|
size.in?(SIZES)
|
93
107
|
end
|
94
108
|
|
95
|
-
def
|
96
|
-
|
109
|
+
def size_class
|
110
|
+
return nil if size == :md
|
111
|
+
|
112
|
+
"fr-alert--#{size}"
|
97
113
|
end
|
98
114
|
end
|
@@ -3,14 +3,12 @@ module DsfrComponent
|
|
3
3
|
STATUSES = %i[success error info warning new].freeze
|
4
4
|
|
5
5
|
# @param status [BadgeComponent::STATUSES]
|
6
|
-
def initialize(status:,
|
6
|
+
def initialize(status:, html_attributes: {})
|
7
7
|
raise(ArgumentError, "`status` should be one of #{STATUSES}") unless STATUSES.include?(status)
|
8
8
|
|
9
9
|
@status = status
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
super(classes: classes, html_attributes: html_attributes)
|
11
|
+
super(html_attributes: html_attributes)
|
14
12
|
end
|
15
13
|
|
16
14
|
def call
|
@@ -24,7 +22,7 @@ module DsfrComponent
|
|
24
22
|
attr_reader :status
|
25
23
|
|
26
24
|
def default_attributes
|
27
|
-
{ class: 'fr-badge' }
|
25
|
+
{ class: ['fr-badge', "fr-badge--#{status}"] }
|
28
26
|
end
|
29
27
|
end
|
30
28
|
end
|
@@ -9,21 +9,8 @@ class DsfrComponent::Base < ViewComponent::Base
|
|
9
9
|
|
10
10
|
SIZES = %i[sm md lg].freeze
|
11
11
|
|
12
|
-
def initialize(
|
13
|
-
if classes.nil?
|
14
|
-
Rails.logger.warn("classes is nil, if no custom classes are needed omit the param")
|
15
|
-
|
16
|
-
classes = []
|
17
|
-
end
|
18
|
-
# FIXME: remove first merge when we deprecate classes
|
19
|
-
#
|
20
|
-
# This step only needs to be here while we still accept classes:, now
|
21
|
-
# we're using html_attributes_utils we can start to move towards
|
22
|
-
# supporting html_attributes: { class: 'xyz' } over taking them
|
23
|
-
# separately
|
24
|
-
|
12
|
+
def initialize(html_attributes: {})
|
25
13
|
@html_attributes = default_attributes
|
26
|
-
.deep_merge_html_attributes({ class: classes })
|
27
14
|
.deep_merge_html_attributes(html_attributes)
|
28
15
|
.deep_tidy_html_attributes
|
29
16
|
|
@@ -9,10 +9,6 @@ class DsfrComponent::BreadcrumbsComponent < DsfrComponent::Base
|
|
9
9
|
content_tag(:a, class: 'fr-breadcrumb__link', **attributes) { label }
|
10
10
|
end
|
11
11
|
|
12
|
-
def initialize(classes: [], html_attributes: {})
|
13
|
-
super(classes: classes, html_attributes: html_attributes)
|
14
|
-
end
|
15
|
-
|
16
12
|
private
|
17
13
|
|
18
14
|
def default_attributes
|
@@ -10,7 +10,7 @@ module DsfrComponent
|
|
10
10
|
# @param title [String] Le titre du bouton permettant d’afficher une infobulle (optionnel)
|
11
11
|
# @param level [String] Le niveau du bouton : :primary (défaut), :secondary ou :tertiary (optionnel)
|
12
12
|
# @param size [String] La taille du bouton : :sm, :md (défaut), :lg (optionnel)
|
13
|
-
def initialize(label: nil, title: nil, icon: nil, icon_position: :left, level: nil, size: nil,
|
13
|
+
def initialize(label: nil, title: nil, icon: nil, icon_position: :left, level: nil, size: nil, html_attributes: {})
|
14
14
|
@label = label
|
15
15
|
@title = title
|
16
16
|
@icon = icon
|
@@ -24,7 +24,7 @@ module DsfrComponent
|
|
24
24
|
validate_level
|
25
25
|
validate_label
|
26
26
|
|
27
|
-
super(
|
27
|
+
super(html_attributes: html_attributes)
|
28
28
|
end
|
29
29
|
|
30
30
|
def call
|
@@ -13,14 +13,13 @@ module DsfrComponent
|
|
13
13
|
title:,
|
14
14
|
icon_name: "information-line",
|
15
15
|
starting_header_level: nil,
|
16
|
-
classes: [],
|
17
16
|
html_attributes: {}
|
18
17
|
)
|
19
18
|
@title = title
|
20
19
|
@icon_name = icon_name
|
21
20
|
@starting_header_level = starting_header_level
|
22
21
|
|
23
|
-
super(
|
22
|
+
super(html_attributes: html_attributes)
|
24
23
|
end
|
25
24
|
|
26
25
|
def call
|
@@ -1,10 +1,10 @@
|
|
1
1
|
class DsfrComponent::HeaderComponent::DirectLinkComponent < DsfrComponent::Base
|
2
|
-
def initialize(title:, path:, active: false,
|
2
|
+
def initialize(title:, path:, active: false, html_attributes: {})
|
3
3
|
@title = title
|
4
4
|
@path = path
|
5
5
|
@active = active
|
6
6
|
|
7
|
-
super(
|
7
|
+
super(html_attributes: html_attributes)
|
8
8
|
end
|
9
9
|
|
10
10
|
def call
|
@@ -1,11 +1,11 @@
|
|
1
1
|
class DsfrComponent::HeaderComponent::DirectLinkDropdownComponent < DsfrComponent::Base
|
2
2
|
renders_many :links, DsfrComponent::HeaderComponent::DirectLinkComponent
|
3
3
|
|
4
|
-
def initialize(title:, active: false,
|
4
|
+
def initialize(title:, active: false, html_attributes: {})
|
5
5
|
@title = title
|
6
6
|
@active = active
|
7
7
|
|
8
|
-
super(
|
8
|
+
super(html_attributes: html_attributes)
|
9
9
|
end
|
10
10
|
|
11
11
|
def call
|
@@ -2,12 +2,12 @@ class DsfrComponent::HeaderComponent::OperatorImageComponent < DsfrComponent::Ba
|
|
2
2
|
# @param title [String] Le title du lien vers la page d'accueil du site
|
3
3
|
# @param src [String] L'attribut src qui sera passé au tag img
|
4
4
|
# @param alt [String] Le texte alternatif qui sera passé au tag img. Il doit impérativement contenir le texte présent dans l’image.
|
5
|
-
def initialize(title:, src:, alt:,
|
5
|
+
def initialize(title:, src:, alt:, html_attributes: {})
|
6
6
|
@title = title
|
7
7
|
@src = src
|
8
8
|
@alt = alt
|
9
9
|
|
10
|
-
super(
|
10
|
+
super(html_attributes: html_attributes)
|
11
11
|
end
|
12
12
|
|
13
13
|
def call
|
@@ -1,9 +1,9 @@
|
|
1
1
|
class DsfrComponent::HeaderComponent::ToolLinkComponent < DsfrComponent::Base
|
2
|
-
def initialize(title:, path:,
|
2
|
+
def initialize(title:, path:, html_attributes: {})
|
3
3
|
@title = title
|
4
4
|
@path = path
|
5
5
|
|
6
|
-
super(
|
6
|
+
super(html_attributes: html_attributes)
|
7
7
|
end
|
8
8
|
|
9
9
|
def call
|
@@ -10,12 +10,12 @@ class DsfrComponent::HeaderComponent < DsfrComponent::Base
|
|
10
10
|
# @param logo_text [String] Ce texte obligatoire sera affiché en dessous de la Marianne et au dessus de la devise française. C’est généralement un nom de ministère ou d’administration.
|
11
11
|
# @param title [String] Le nom du service numérique, titre principal du site.
|
12
12
|
# @param tagline [String] La description du service numérique, sous-titre du site (optionnelle).
|
13
|
-
def initialize(logo_text:, title: nil, tagline: nil,
|
13
|
+
def initialize(logo_text:, title: nil, tagline: nil, html_attributes: {})
|
14
14
|
@logo_text = logo_text
|
15
15
|
@title = title
|
16
16
|
@tagline = tagline
|
17
17
|
|
18
|
-
super(
|
18
|
+
super(html_attributes: html_attributes)
|
19
19
|
end
|
20
20
|
|
21
21
|
private
|
@@ -2,13 +2,13 @@ module DsfrComponent
|
|
2
2
|
class HighlightComponent < DsfrComponent::Base
|
3
3
|
# @param text [String] Le contenu textuel du composant
|
4
4
|
# @param size [Symbol] La taille de la mise en exergue
|
5
|
-
def initialize(text:, size: :md,
|
5
|
+
def initialize(text:, size: :md, html_attributes: {})
|
6
6
|
@text = text
|
7
7
|
@size = size
|
8
8
|
|
9
9
|
raise ArgumentError if not SIZES.include?(size)
|
10
10
|
|
11
|
-
super(
|
11
|
+
super(html_attributes: html_attributes)
|
12
12
|
end
|
13
13
|
|
14
14
|
def call
|
@@ -5,12 +5,12 @@ module DsfrComponent
|
|
5
5
|
|
6
6
|
# @param title [String] Titre de la modale
|
7
7
|
# @param opened [Boolean] Ouvre la modale dès le chargement de la page
|
8
|
-
def initialize(title:, opened: false,
|
8
|
+
def initialize(title:, opened: false, html_attributes: {})
|
9
9
|
@title = title
|
10
10
|
@opened = opened
|
11
11
|
|
12
12
|
@id = html_attributes[:id]
|
13
|
-
super(
|
13
|
+
super(html_attributes: html_attributes)
|
14
14
|
end
|
15
15
|
|
16
16
|
private
|
@@ -23,7 +23,7 @@ module DsfrComponent
|
|
23
23
|
# @param link_title [String] Titre du lien (optionnel)
|
24
24
|
# @param link_blank [Boolean] Ouvrir le lien dans un nouvel onglet (optionnel)
|
25
25
|
def initialize(title:, description:, type: "info", description_tag: :p, use_icon: true, icon_name: nil, use_notice: false, dismissible: false, dismiss_label: "Masquer le message", link_label: nil, link_href: nil, link_title: nil, link_blank: true,
|
26
|
-
|
26
|
+
html_attributes: {})
|
27
27
|
@title = title
|
28
28
|
@description = description
|
29
29
|
@type = type
|
@@ -53,7 +53,7 @@ module DsfrComponent
|
|
53
53
|
raise ArgumentError, "L’icône d’un bandeau de type météo doit être une icône météo (#{WEATHER_ICONS.join(', ')})" if WEATHER_TYPES.include?(type) && WEATHER_ICONS.exclude?(icon_name)
|
54
54
|
end
|
55
55
|
|
56
|
-
super(
|
56
|
+
super(html_attributes: html_attributes)
|
57
57
|
end
|
58
58
|
|
59
59
|
private
|
data/app/components/dsfr_component/{search_bar_component.html.erb → search_component.html.erb}
RENAMED
@@ -1,5 +1,8 @@
|
|
1
1
|
<%= form_with(url: url, method: :get, **html_attributes) do |form| %>
|
2
|
+
<% hidden_fields.each do |name, value| %>
|
3
|
+
<%= form.hidden_field(name, value: value) %>
|
4
|
+
<% end %>
|
2
5
|
<%= form.label(name, label_text, for: id, class: 'fr-label') %>
|
3
|
-
<%= form.search_field(name, id: id, placeholder: button_text, class: 'fr-input') %>
|
6
|
+
<%= form.search_field(name, id: id, placeholder: button_text, value: value, class: 'fr-input') %>
|
4
7
|
<%= form.button(type: :submit, name: nil, class: 'fr-btn') { button_text } %>
|
5
8
|
<% end %>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module DsfrComponent
|
2
|
-
class
|
2
|
+
class SearchComponent < DsfrComponent::Base
|
3
3
|
DEFAULT_LABEL_TEXT = 'Recherche'.freeze
|
4
4
|
DEFAULT_BUTTON_TEXT = 'Rechercher'.freeze
|
5
5
|
|
@@ -8,27 +8,35 @@ module DsfrComponent
|
|
8
8
|
# @param size [Symbol] component size : `:md` (default) or `:sm`/`:lg`
|
9
9
|
# @param label_text [String] Label text, default: "Recherche"
|
10
10
|
# @param button_text [String] Button and placeholder text, default: "Rechercher"
|
11
|
+
# @param value [String] Current input value (optional, defaults to request.params[name])
|
12
|
+
# @param hidden_fields [Hash] Extra fields (optional)
|
11
13
|
def initialize(url:, name: :search, size: :md, label_text: DEFAULT_LABEL_TEXT, button_text: DEFAULT_BUTTON_TEXT, **html_attributes)
|
12
14
|
@url = url
|
13
15
|
@name = name
|
14
16
|
@label_text = label_text
|
15
17
|
@button_text = button_text
|
16
18
|
@size = size
|
19
|
+
@value = html_attributes.delete(:value)
|
20
|
+
@hidden_fields = html_attributes.delete(:hidden_fields) || {}
|
17
21
|
@html_attributes = html_attributes
|
18
22
|
|
19
23
|
validate_size!
|
20
24
|
|
21
|
-
super(
|
25
|
+
super(html_attributes: html_attributes)
|
22
26
|
end
|
23
27
|
|
24
28
|
private
|
25
29
|
|
26
|
-
attr_reader :url, :size, :name, :label_text, :button_text, :html_attributes
|
30
|
+
attr_reader :url, :size, :name, :label_text, :button_text, :hidden_fields, :html_attributes
|
27
31
|
|
28
32
|
def id
|
29
33
|
"#{name}_#{object_id}"
|
30
34
|
end
|
31
35
|
|
36
|
+
def value
|
37
|
+
@value || (request && request.params[name])
|
38
|
+
end
|
39
|
+
|
32
40
|
def default_attributes
|
33
41
|
classes = ['fr-search-bar']
|
34
42
|
classes << "fr-search-bar--#{size}" unless size == :md
|
@@ -2,11 +2,11 @@ module DsfrComponent
|
|
2
2
|
class SkiplinkComponent < DsfrComponent::Base
|
3
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
4
|
# @param links [Array] liste de liens HTML
|
5
|
-
def initialize(label:, links:,
|
5
|
+
def initialize(label:, links:, html_attributes: {})
|
6
6
|
@label = label
|
7
7
|
@links = links
|
8
8
|
|
9
|
-
super(
|
9
|
+
super(html_attributes: html_attributes)
|
10
10
|
end
|
11
11
|
|
12
12
|
private
|
@@ -4,7 +4,7 @@ module DsfrComponent
|
|
4
4
|
# @param value [Integer] Numéro de l’étape en cours (commence à 1)
|
5
5
|
# @param max [Integer] Nombre d’étapes total
|
6
6
|
# @param next_title [String] Titre de l’étape suivante (sauf pour la dernière étape)
|
7
|
-
def initialize(title:, value:, max:, next_title: nil,
|
7
|
+
def initialize(title:, value:, max:, next_title: nil, html_attributes: {})
|
8
8
|
@title = title
|
9
9
|
@value = value
|
10
10
|
@max = max
|
@@ -12,7 +12,7 @@ module DsfrComponent
|
|
12
12
|
|
13
13
|
raise ArgumentError, "Les étapes doivent aller de 1 jusqu´à 8 au maximum" if @value < 1 || @value > @max || @max > 8
|
14
14
|
|
15
|
-
super(
|
15
|
+
super(html_attributes: html_attributes)
|
16
16
|
end
|
17
17
|
|
18
18
|
private
|
@@ -3,13 +3,13 @@ class DsfrComponent::TabsComponent::TabComponent < DsfrComponent::Base
|
|
3
3
|
# @param active [Boolean] Définit si l’onglet est actif ou non
|
4
4
|
# @param path [String] (optionnel) chemin vers lequel l’onglet pointe, utilisable avec Turbo Drive, transforme le bouton en lien, avec une turbo action `advance`
|
5
5
|
# @param icon [String] (optionnel) icône affichée à gauche du titre de l’onglet (sans le préfixe `fr-icon-`)
|
6
|
-
def initialize(title:, active: false, path: nil, icon: nil,
|
6
|
+
def initialize(title:, active: false, path: nil, icon: nil, html_attributes: {})
|
7
7
|
@title = title
|
8
8
|
@active = active
|
9
9
|
@path = path
|
10
10
|
@icon = icon
|
11
11
|
|
12
|
-
super(
|
12
|
+
super(html_attributes: html_attributes)
|
13
13
|
end
|
14
14
|
|
15
15
|
def nav_id
|
@@ -2,11 +2,11 @@ class DsfrComponent::TabsComponent < DsfrComponent::Base
|
|
2
2
|
renders_many :tabs, "DsfrComponent::TabsComponent::TabComponent"
|
3
3
|
|
4
4
|
# @param label [String] Le nom du système d’onglets, sera uniquement affiché comme aria-label (optionnel)
|
5
|
-
def initialize(label: nil,
|
5
|
+
def initialize(label: nil, html_attributes: {})
|
6
6
|
@label = label
|
7
7
|
@tabs = []
|
8
8
|
|
9
|
-
super(
|
9
|
+
super(html_attributes: html_attributes)
|
10
10
|
end
|
11
11
|
|
12
12
|
private
|
@@ -8,7 +8,7 @@ module DsfrComponent
|
|
8
8
|
# @param url [String] for clickable tags only (optional)
|
9
9
|
# @param selected [Boolean] adds a check, useful for filters list, cannot be used with `url` (optional)
|
10
10
|
# @param dismissable [Boolean] adds a close icon on the right, cannot be used with `url` or `icon` (optional)
|
11
|
-
def initialize(title:, icon: nil, size: nil, url: nil, selected: nil, dismissable: nil,
|
11
|
+
def initialize(title:, icon: nil, size: nil, url: nil, selected: nil, dismissable: nil, html_attributes: {})
|
12
12
|
@title = title
|
13
13
|
@icon = icon
|
14
14
|
@size = size
|
@@ -16,7 +16,7 @@ module DsfrComponent
|
|
16
16
|
@selected = selected
|
17
17
|
@dismissable = dismissable
|
18
18
|
|
19
|
-
super(
|
19
|
+
super(html_attributes: html_attributes)
|
20
20
|
end
|
21
21
|
|
22
22
|
def call
|
@@ -7,7 +7,7 @@ module DsfrComponent
|
|
7
7
|
# @param description [String] description (optional)
|
8
8
|
# @param orientation [String] :horizontal or :vertical
|
9
9
|
# @param heading_level [Integer] 1, 2, 3, 4 (default), 5, 6
|
10
|
-
def initialize(title:, url:, image_src: nil, image_alt: "", description: nil, orientation: :vertical, heading_level: 4,
|
10
|
+
def initialize(title:, url:, image_src: nil, image_alt: "", description: nil, orientation: :vertical, heading_level: 4, html_attributes: {})
|
11
11
|
@title = title
|
12
12
|
@url = url
|
13
13
|
@image_src = image_src
|
@@ -18,7 +18,7 @@ module DsfrComponent
|
|
18
18
|
|
19
19
|
raise ArgumentError if HEADING_LEVELS.exclude?(heading_level)
|
20
20
|
|
21
|
-
super(
|
21
|
+
super(html_attributes: html_attributes)
|
22
22
|
end
|
23
23
|
|
24
24
|
private
|
@@ -20,7 +20,7 @@ module DsfrComponentsHelper
|
|
20
20
|
dsfr_skiplink: 'DsfrComponent::SkiplinkComponent',
|
21
21
|
dsfr_callout: 'DsfrComponent::CalloutComponent',
|
22
22
|
dsfr_notice: 'DsfrComponent::NoticeComponent',
|
23
|
-
|
23
|
+
dsfr_search: 'DsfrComponent::SearchComponent',
|
24
24
|
# DO NOT REMOVE: new component mapping here
|
25
25
|
}.freeze
|
26
26
|
HELPER_NAME_TO_CLASS_NAME.each do |name, klass|
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dsfr-view-components
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- BetaGouv developers
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date: 2025-04-
|
10
|
+
date: 2025-04-24 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: html-attributes-utils
|
@@ -353,8 +352,8 @@ files:
|
|
353
352
|
- app/components/dsfr_component/modal_component.rb
|
354
353
|
- app/components/dsfr_component/notice_component.html.erb
|
355
354
|
- app/components/dsfr_component/notice_component.rb
|
356
|
-
- app/components/dsfr_component/
|
357
|
-
- app/components/dsfr_component/
|
355
|
+
- app/components/dsfr_component/search_component.html.erb
|
356
|
+
- app/components/dsfr_component/search_component.rb
|
358
357
|
- app/components/dsfr_component/skiplink_component.html.erb
|
359
358
|
- app/components/dsfr_component/skiplink_component.rb
|
360
359
|
- app/components/dsfr_component/stepper_component.html.erb
|
@@ -393,7 +392,6 @@ metadata:
|
|
393
392
|
homepage_uri: https://github.com/betagouv/dsfr-view-components
|
394
393
|
source_code_uri: https://github.com/betagouv/dsfr-view-components
|
395
394
|
rubygems_mfa_required: 'true'
|
396
|
-
post_install_message:
|
397
395
|
rdoc_options: []
|
398
396
|
require_paths:
|
399
397
|
- lib
|
@@ -408,8 +406,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
408
406
|
- !ruby/object:Gem::Version
|
409
407
|
version: '0'
|
410
408
|
requirements: []
|
411
|
-
rubygems_version: 3.
|
412
|
-
signing_key:
|
409
|
+
rubygems_version: 3.6.2
|
413
410
|
specification_version: 4
|
414
411
|
summary: Composants ViewComponent pour le Système de Design de l'État (DSFR)
|
415
412
|
test_files: []
|