@openeuropa/bcl-modal 0.1.2 → 0.1.202408021145

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.
Files changed (2) hide show
  1. package/modal.html.twig +61 -13
  2. package/package.json +2 -2
package/modal.html.twig CHANGED
@@ -1,34 +1,82 @@
1
- {% spaceless %}
1
+ {% apply spaceless %}
2
2
 
3
3
  {# Parameters:
4
- - size (sm, lg, xl, fullscreen)
5
- - id
6
- - header (block)
7
- - body (block)
8
- - footer (block)
9
- - extra_class
4
+ - size (string) default('')
5
+ options: sm, lg, xl, fullscreen
6
+ - id (boolean) (default: modal-random(1000))
7
+ - fullscreen_responsive (string) (default: '')
8
+ options: sm, md, lg, xl, xxl
9
+ - static_backdrop (boolean) (default: false)
10
+ - verticaly_centered (boolean) (default: false)
11
+ - scrollable (boolean) (default: false)
12
+ - header (block) (default: '')
13
+ - messages (block) (default: '')
14
+ - body (block) (default: '')
15
+ - footer (block) (default: '')
16
+ - attributes (drupal attrs)
17
+
18
+ Blocks
19
+ - header
20
+ - messages
21
+ - body
22
+ - footer
10
23
  #}
11
- {% set _size = size ? 'modal-' ~ size : '' %}
12
- {% set _id = id|default('defaultModalId') %}
24
+
25
+ {% set _size = size|default('') %}
26
+ {% set _id = id|default('modal-' ~ random(1000)) %}
27
+ {% set _fullscreen_responsive = fullscreen_responsive|default('') %}
28
+ {% set _static_backdrop = static_backdrop ?? false %}
29
+ {% set _verticaly_centered = verticaly_centered ?? false %}
30
+ {% set _scrollable = scrollable ?? false %}
13
31
  {% set _header = header|default('') %}
32
+ {% set _messages = messages|default('') %}
14
33
  {% set _body = body|default('') %}
15
34
  {% set _footer = footer|default('') %}
16
- {% set _extra_class = extra_class|default('') %}
17
35
 
18
- <div class="modal fade {{ _extra_class }}" id={{ _id }} tabindex="-1" aria-labelledby="{{ _id }}Label" aria-hidden="true">
19
- <div class="modal-dialog {{ _size }}">
36
+ {% set _classes = ['modal', 'fade'] %}
37
+
38
+ {% if attributes is empty %}
39
+ {% set attributes = create_attribute() %}
40
+ {% endif %}
41
+
42
+ {% set attributes = attributes
43
+ .setAttribute('id', _id)
44
+ .setAttribute('tabindex', '-1')
45
+ .setAttribute('aria-hidden', 'true')
46
+ .setAttribute('aria-label', _id ~ 'Label')
47
+ .addClass(_classes)
48
+ %}
49
+
50
+ {% if _static_backdrop %}
51
+ {% set attributes = attributes.setAttribute('data-bs-backdrop', 'static') %}
52
+ {% endif %}
53
+
54
+ <div
55
+ {{ attributes }}
56
+ >
57
+ <div class="modal-dialog
58
+ {{- _size ? ' modal-' ~ size -}}
59
+ {{- _fullscreen_responsive ? ' modal-fullscreen-' ~ _fullscreen_responsive ~ '-down' -}}
60
+ {{- _verticaly_centered ? ' modal-dialog-centered' -}}
61
+ {{- _scrollable ? ' modal-dialog-scrollable' -}}"
62
+ >
20
63
  <div class="modal-content">
64
+ {% if header is not empty %}
21
65
  <div class="modal-header">
22
66
  {%- block header _header -%}
23
67
  </div>
68
+ {% endif %}
69
+ {%- block messages _messages -%}
24
70
  <div class="modal-body">
25
71
  {%- block body _body -%}
26
72
  </div>
73
+ {% if footer is not empty %}
27
74
  <div class="modal-footer">
28
75
  {%- block footer _footer -%}
29
76
  </div>
77
+ {% endif %}
30
78
  </div>
31
79
  </div>
32
80
  </div>
33
81
 
34
- {% endspaceless %}
82
+ {% endapply %}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@openeuropa/bcl-modal",
3
3
  "author": "European Commission",
4
4
  "license": "EUPL-1.2",
5
- "version": "0.1.2",
5
+ "version": "0.1.202408021145",
6
6
  "publishConfig": {
7
7
  "access": "public"
8
8
  },
@@ -21,5 +21,5 @@
21
21
  "design-system",
22
22
  "twig"
23
23
  ],
24
- "gitHead": "b242dcb5ed9578fcd212c98cf722eabc845d313b"
24
+ "gitHead": "7ee2013f7f64a70ddfa35228a9a65967dd71eec3"
25
25
  }