@openeuropa/bcl-description-list 0.19.0 → 0.22.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.
- package/__snapshots__/description-list.test.js.snap +14 -14
- package/{dataHorizontal.js → data/data--horizontal.js} +0 -0
- package/{data.js → data/data.js} +0 -0
- package/description-list.html.twig +23 -12
- package/description-list.story.js +8 -2
- package/description-list.test.js +2 -2
- package/package.json +4 -3
|
@@ -51,14 +51,14 @@ exports[`OE - Description List horizontal renders correctly 1`] = `
|
|
|
51
51
|
<dt>
|
|
52
52
|
Only title label
|
|
53
53
|
</dt>
|
|
54
|
-
<
|
|
55
|
-
<
|
|
54
|
+
<dd>
|
|
55
|
+
<div>
|
|
56
56
|
Description text goes here.
|
|
57
|
-
</
|
|
58
|
-
<
|
|
57
|
+
</div>
|
|
58
|
+
<div>
|
|
59
59
|
Description text goes here.
|
|
60
|
-
</
|
|
61
|
-
</
|
|
60
|
+
</div>
|
|
61
|
+
</dd>
|
|
62
62
|
</dl>
|
|
63
63
|
</jest>
|
|
64
64
|
`;
|
|
@@ -119,7 +119,7 @@ exports[`OE - Description List renders correctly 1`] = `
|
|
|
119
119
|
exports[`OE - Description List with title horizontal renders correctly 1`] = `
|
|
120
120
|
<jest>
|
|
121
121
|
<h6
|
|
122
|
-
class="fw-bold mb-4"
|
|
122
|
+
class="fw-bold mb-4 bcl-heading"
|
|
123
123
|
>
|
|
124
124
|
Description list test title
|
|
125
125
|
</h6>
|
|
@@ -172,14 +172,14 @@ exports[`OE - Description List with title horizontal renders correctly 1`] = `
|
|
|
172
172
|
<dt>
|
|
173
173
|
Only title label
|
|
174
174
|
</dt>
|
|
175
|
-
<
|
|
176
|
-
<
|
|
175
|
+
<dd>
|
|
176
|
+
<div>
|
|
177
177
|
Description text goes here.
|
|
178
|
-
</
|
|
179
|
-
<
|
|
178
|
+
</div>
|
|
179
|
+
<div>
|
|
180
180
|
Description text goes here.
|
|
181
|
-
</
|
|
182
|
-
</
|
|
181
|
+
</div>
|
|
182
|
+
</dd>
|
|
183
183
|
</dl>
|
|
184
184
|
</jest>
|
|
185
185
|
`;
|
|
@@ -187,7 +187,7 @@ exports[`OE - Description List with title horizontal renders correctly 1`] = `
|
|
|
187
187
|
exports[`OE - Description List with title renders correctly 1`] = `
|
|
188
188
|
<jest>
|
|
189
189
|
<h6
|
|
190
|
-
class="fw-bold mb-4"
|
|
190
|
+
class="fw-bold mb-4 bcl-heading"
|
|
191
191
|
>
|
|
192
192
|
Description list test title
|
|
193
193
|
</h6>
|
|
File without changes
|
package/{data.js → data/data.js}
RENAMED
|
File without changes
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
Parameters:
|
|
5
5
|
- title: (string) (default: "")
|
|
6
6
|
- title_tag: (string) (default: "h2")
|
|
7
|
+
- title_attributes (drupal attrs)
|
|
7
8
|
- "items" (array) (default: []): format: [
|
|
8
9
|
{
|
|
9
10
|
"term" (object or array of object) -format: {
|
|
@@ -22,6 +23,7 @@
|
|
|
22
23
|
|
|
23
24
|
{% set _title = title|default('') %}
|
|
24
25
|
{% set _title_tag = title_tag|default('h2') %}
|
|
26
|
+
{% set _title_attributes = title_attributes ?: create_attribute() %}
|
|
25
27
|
{% set _items = items|default([]) %}
|
|
26
28
|
{% set _variant = variant|default('') %}
|
|
27
29
|
|
|
@@ -34,10 +36,11 @@
|
|
|
34
36
|
{% endif %}
|
|
35
37
|
|
|
36
38
|
{% if _title is not empty %}
|
|
37
|
-
{%
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
{% include '@oe-bcl/bcl-heading/heading.html.twig' with {
|
|
40
|
+
title: _title,
|
|
41
|
+
title_tag: _title_tag,
|
|
42
|
+
attributes: _title_attributes,
|
|
43
|
+
} only %}
|
|
41
44
|
{% endif %}
|
|
42
45
|
|
|
43
46
|
<dl
|
|
@@ -63,10 +66,14 @@
|
|
|
63
66
|
{% include '@oe-bcl/bcl-icon/icon.html.twig' with _term.icon|merge({
|
|
64
67
|
attributes: create_attribute().addClass(_icon_classes)
|
|
65
68
|
}) only %}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
69
|
+
<p class="mb-0 d-inline-block">{{ _term.label }}</p>
|
|
70
|
+
{%- elseif _term.color is not empty -%}
|
|
71
|
+
<div class="d-flex align-items-center">
|
|
72
|
+
<span class="p-2 me-2 d-inline-block rounded-1 {{ _term.color }}"></span>{{- _term.label -}}
|
|
73
|
+
</div>
|
|
74
|
+
{%- else -%}
|
|
75
|
+
{{- _term.label -}}
|
|
76
|
+
{%- endif -%}
|
|
70
77
|
</dt>
|
|
71
78
|
{% endfor %}
|
|
72
79
|
{% if _variant == 'horizontal' %}
|
|
@@ -87,6 +94,10 @@
|
|
|
87
94
|
attributes: create_attribute().addClass(_icon_classes)
|
|
88
95
|
}) only -%}
|
|
89
96
|
<p class="mb-0 d-inline-block">{{ _item.term.label }}</p>
|
|
97
|
+
{%- elseif _item.term.color is not empty -%}
|
|
98
|
+
<div class="d-flex align-items-center">
|
|
99
|
+
<span class="p-2 me-2 d-inline-block rounded-1 {{ _item.term.color }}"></span>{{- _item.term.label -}}
|
|
100
|
+
</div>
|
|
90
101
|
{%- else -%}
|
|
91
102
|
{{- _item.term.label -}}
|
|
92
103
|
{%- endif -%}
|
|
@@ -96,10 +107,10 @@
|
|
|
96
107
|
{% if _item.definition is not empty %}
|
|
97
108
|
{% if _item.definition is iterable %}
|
|
98
109
|
{% if _variant == 'horizontal' %}
|
|
99
|
-
<
|
|
110
|
+
<dd>
|
|
100
111
|
{% endif %}
|
|
101
112
|
{% for _definition in _item.definition %}
|
|
102
|
-
<dd>
|
|
113
|
+
{% if _variant == 'horizontal' %}<div>{% else %}<dd>{% endif %}
|
|
103
114
|
{%- if _definition.button is defined -%}
|
|
104
115
|
{% include '@oe-bcl/bcl-button/button.html.twig' with _definition.button only %}
|
|
105
116
|
{%- elseif _definition.link is defined %}
|
|
@@ -115,10 +126,10 @@
|
|
|
115
126
|
{{- _definition.label -}}
|
|
116
127
|
{%- endif -%}
|
|
117
128
|
{%- endif -%}
|
|
118
|
-
</dd>
|
|
129
|
+
{% if _variant == 'horizontal' %}</div>{% else %}</dd>{% endif %}
|
|
119
130
|
{% endfor %}
|
|
120
131
|
{% if _variant == 'horizontal' %}
|
|
121
|
-
</
|
|
132
|
+
</dd>
|
|
122
133
|
{% endif %}
|
|
123
134
|
{% else %}
|
|
124
135
|
<dd>
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import withCode from "@openeuropa/storybook-addon-code";
|
|
2
|
+
import { withDesign } from "storybook-addon-designs";
|
|
3
|
+
|
|
4
|
+
import demoData from "@openeuropa/bcl-description-list/data/data.js";
|
|
5
|
+
import demoDataHorizontal from "@openeuropa/bcl-description-list/data/data--horizontal";
|
|
3
6
|
import descriptionList from "@openeuropa/bcl-description-list/description-list.html.twig";
|
|
4
7
|
import { correctPaths } from "@openeuropa/bcl-story-utils";
|
|
5
8
|
|
|
6
9
|
export default {
|
|
7
10
|
title: "Paragraphs/Description List",
|
|
11
|
+
decorators: [withCode, withDesign],
|
|
8
12
|
parameters: {
|
|
9
13
|
controls: {
|
|
10
14
|
disable: true,
|
|
@@ -23,3 +27,5 @@ export const Default = () => descriptionList(correctPaths(demoData));
|
|
|
23
27
|
|
|
24
28
|
export const Horizontal = () =>
|
|
25
29
|
descriptionList(correctPaths(demoDataHorizontal));
|
|
30
|
+
|
|
31
|
+
Horizontal.storyName = "Horizontal Description List";
|
package/description-list.test.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { renderTwigFileAsNode } from "@openeuropa/bcl-test-utils";
|
|
2
|
-
import demoData from "@openeuropa/bcl-description-list/data
|
|
3
|
-
import demoDataHorizontal from "@openeuropa/bcl-description-list/
|
|
2
|
+
import demoData from "@openeuropa/bcl-description-list/data/data";
|
|
3
|
+
import demoDataHorizontal from "@openeuropa/bcl-description-list/data/data--horizontal";
|
|
4
4
|
const template = "@oe-bcl/bcl-description-list/description-list.html.twig";
|
|
5
5
|
|
|
6
6
|
const render = (params) => renderTwigFileAsNode(template, params);
|
package/package.json
CHANGED
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
"name": "@openeuropa/bcl-description-list",
|
|
3
3
|
"author": "European Commission",
|
|
4
4
|
"license": "EUPL-1.2",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.22.0",
|
|
6
6
|
"description": "OE - BCL description-list",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@openeuropa/bcl-
|
|
11
|
+
"@openeuropa/bcl-heading": "^0.22.0",
|
|
12
|
+
"@openeuropa/bcl-icon": "^0.22.0"
|
|
12
13
|
},
|
|
13
14
|
"repository": {
|
|
14
15
|
"type": "git",
|
|
@@ -24,5 +25,5 @@
|
|
|
24
25
|
"design-system",
|
|
25
26
|
"twig"
|
|
26
27
|
],
|
|
27
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "57304ad94ae3c234f2f2b904208ce540a7a53f23"
|
|
28
29
|
}
|