dsfr-view-components 2.0.1 → 2.1.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/README.md +3 -3
- data/app/components/dsfr_component/accordion_component/section_component.html.erb +5 -5
- data/app/components/dsfr_component/accordion_component/section_component.rb +10 -2
- data/app/components/dsfr_component/accordion_component.rb +8 -1
- data/lib/dsfr/components/version.rb +1 -1
- metadata +17 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03d38ef8a83c41d5ab9bf87104210ba23ba7575c895c2220ca07c139463b8c9e
|
4
|
+
data.tar.gz: 479342fcb5bdaffc4b164d62072b2abb5a16606be8009c2bc355701b70f3b89b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64b0c74cef32df4432489d2f2f1a320a46fa20ab1c9235298869569d83edad665245f94df8ce113eb7635d615dd3a339aa66538fb17fc3e40cf414c41e51474f
|
7
|
+
data.tar.gz: cbb2749d28d8af2b8a42c142160c78035f111313cbc7fe60d8c526d24b4a638615611b6d26aeea302adbbcfc47acb168b36cc25804a6809e12f83be2527d1897
|
data/README.md
CHANGED
@@ -25,6 +25,8 @@ Pour utiliser cette gem dans votre application Rails, il faut ajouter cette lign
|
|
25
25
|
require "dsfr/components"
|
26
26
|
```
|
27
27
|
|
28
|
+
**NOTE:** depuis la version 2.1, la gem dépend de [`dsfr-assets`](https://github.com/betagouv/dsfr-assets) qui embarque les assets du DSFR pour vous. Pour laisser au temps aux équipes de vérifier cette intégration, l'inclusion des assets est optionnelle mais peut se faire en suivant [les instructions dans le README de dsfr-assets](https://github.com/betagouv/dsfr-assets?tab=readme-ov-file#installation).
|
29
|
+
|
28
30
|
## Composants disponibles
|
29
31
|
|
30
32
|
Cette gem a pour but de supporter tous les composants proposés par le Design Système de l'État hormis ceux concernant les formulaires. Ceux-ci seront fournis dans une gem indépendante dans le futur.
|
@@ -75,12 +77,11 @@ Utilisez le générateur pour créer un nouveau composant :
|
|
75
77
|
bin/rails g dsfr_component FancyButton --params title:String count:Integer
|
76
78
|
```
|
77
79
|
|
78
|
-
|
79
80
|
Lancer la dummy app pour itérer sur les composants :
|
80
81
|
|
81
82
|
```sh
|
82
83
|
cd spec/dummy
|
83
|
-
bundle install
|
84
|
+
bundle install
|
84
85
|
bundle exec rails server
|
85
86
|
```
|
86
87
|
|
@@ -90,7 +91,6 @@ Déployer une nouvelle version de la gem :
|
|
90
91
|
VERSION=1.3.2 make deploy_gem
|
91
92
|
```
|
92
93
|
|
93
|
-
|
94
94
|
## Licence
|
95
95
|
|
96
96
|
Le code source et la gem sont ouverts sous la licence [MIT](https://opensource.org/licenses/MIT).
|
@@ -1,13 +1,13 @@
|
|
1
1
|
<%= tag.section(**html_attributes) do %>
|
2
|
-
|
2
|
+
<%= tag.send("h#{starting_header_level}", class: "fr-accordion__title") do %>
|
3
3
|
<button
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
class="fr-accordion__btn"
|
5
|
+
aria-expanded="<%= expanded? ? "true" : "false" %>"
|
6
|
+
aria-controls="<%= id %>"
|
7
7
|
>
|
8
8
|
<%= title %>
|
9
9
|
</button>
|
10
|
-
|
10
|
+
<% end %>
|
11
11
|
<div
|
12
12
|
id="<%= id %>"
|
13
13
|
class="fr-collapse <%= "fr-collapse--expanded" if expanded? %>"
|
@@ -1,15 +1,23 @@
|
|
1
1
|
class DsfrComponent::AccordionComponent::SectionComponent < DsfrComponent::Base
|
2
|
-
attr_reader :title, :expanded
|
2
|
+
attr_reader :title, :expanded, :starting_header_level
|
3
3
|
|
4
4
|
alias_method :expanded?, :expanded
|
5
5
|
|
6
6
|
# @param title [String] section title
|
7
7
|
# @param expanded [Boolean] toggles section folding
|
8
8
|
# @param id [String] the HTML id, optional if you want to reuse the anchor
|
9
|
-
def initialize(
|
9
|
+
def initialize(
|
10
|
+
title:,
|
11
|
+
starting_header_level:,
|
12
|
+
expanded: false,
|
13
|
+
id: nil,
|
14
|
+
classes: [],
|
15
|
+
html_attributes: {}
|
16
|
+
)
|
10
17
|
@title = title
|
11
18
|
@expanded = expanded
|
12
19
|
@id = id
|
20
|
+
@starting_header_level = starting_header_level
|
13
21
|
|
14
22
|
super(classes: classes, html_attributes: html_attributes)
|
15
23
|
end
|
@@ -1,4 +1,8 @@
|
|
1
1
|
class DsfrComponent::AccordionComponent < DsfrComponent::Base
|
2
|
+
DEFAULT_HEADER_LEVEL = 3
|
3
|
+
|
4
|
+
attr_reader :starting_header_level
|
5
|
+
|
2
6
|
renders_many :sections, ->(title: nil, expanded: false, id: nil, classes: [], html_attributes: {}, &block) do
|
3
7
|
DsfrComponent::AccordionComponent::SectionComponent.new(
|
4
8
|
classes: classes,
|
@@ -6,11 +10,14 @@ class DsfrComponent::AccordionComponent < DsfrComponent::Base
|
|
6
10
|
html_attributes: html_attributes,
|
7
11
|
title: title,
|
8
12
|
id: id,
|
13
|
+
starting_header_level: starting_header_level,
|
9
14
|
&block
|
10
15
|
)
|
11
16
|
end
|
12
17
|
|
13
|
-
def initialize(classes: [], html_attributes: {})
|
18
|
+
def initialize(classes: [], html_attributes: {}, starting_header_level: DEFAULT_HEADER_LEVEL)
|
19
|
+
@starting_header_level = starting_header_level
|
20
|
+
|
14
21
|
super(classes: classes, html_attributes: html_attributes)
|
15
22
|
end
|
16
23
|
|
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.0
|
4
|
+
version: 2.1.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-01-
|
10
|
+
date: 2025-01-21 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: html-attributes-utils
|
@@ -52,6 +51,20 @@ dependencies:
|
|
52
51
|
- - "~>"
|
53
52
|
- !ruby/object:Gem::Version
|
54
53
|
version: '3'
|
54
|
+
- !ruby/object:Gem::Dependency
|
55
|
+
name: dsfr-assets
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '1.13'
|
61
|
+
type: :runtime
|
62
|
+
prerelease: false
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '1.13'
|
55
68
|
- !ruby/object:Gem::Dependency
|
56
69
|
name: deep_merge
|
57
70
|
requirement: !ruby/object:Gem::Requirement
|
@@ -408,7 +421,6 @@ licenses:
|
|
408
421
|
- MIT
|
409
422
|
metadata:
|
410
423
|
rubygems_mfa_required: 'true'
|
411
|
-
post_install_message:
|
412
424
|
rdoc_options: []
|
413
425
|
require_paths:
|
414
426
|
- lib
|
@@ -423,8 +435,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
423
435
|
- !ruby/object:Gem::Version
|
424
436
|
version: '0'
|
425
437
|
requirements: []
|
426
|
-
rubygems_version: 3.
|
427
|
-
signing_key:
|
438
|
+
rubygems_version: 3.6.2
|
428
439
|
specification_version: 4
|
429
440
|
summary: Composants ViewComponent pour le Système de Design de l'État (DSFR)
|
430
441
|
test_files: []
|