Skip to content

Commit 032b4f9

Browse files
authored
Merge branch 'development' into OEL-4185-#default#
2 parents fb37098 + c3fc9aa commit 032b4f9

File tree

46 files changed

+1004
-364
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1004
-364
lines changed

.storybook/drupal-attribute.js

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
const { DrupalAttribute } = require("drupal-attribute");
2+
3+
/**
4+
* Storybook-specific DrupalAttribute variant.
5+
*
6+
* Aligns the JS implementation with Drupal's PHP Attribute behavior by keeping
7+
* empty-string attribute values (e.g. `hidden=""`) instead of dropping them.
8+
*/
9+
class StorybookDrupalAttribute extends DrupalAttribute {
10+
toString() {
11+
const components = [];
12+
13+
for (const key of this.keys()) {
14+
let value = this.get(key);
15+
16+
if (value === null || value === undefined || value === false) {
17+
continue;
18+
}
19+
20+
if (value === true) {
21+
components.push(key);
22+
continue;
23+
}
24+
25+
if (Array.isArray(value)) {
26+
const filtered = value
27+
.filter((v) => v !== null && v !== undefined && v !== "")
28+
.map(String);
29+
30+
if (filtered.length === 0) {
31+
continue;
32+
}
33+
34+
value = filtered.join(" ");
35+
}
36+
37+
if (value === key) {
38+
components.push(key);
39+
continue;
40+
}
41+
42+
if (value === "") {
43+
components.push(`${key}=""`);
44+
continue;
45+
}
46+
47+
components.push(`${key}="${String(value)}"`);
48+
}
49+
50+
return components.length ? ` ${components.join(" ")}` : "";
51+
}
52+
}
53+
54+
module.exports = {
55+
StorybookDrupalAttribute,
56+
};

.storybook/environment.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const {
66
createFilesystemLoader,
77
createFunction,
88
} = require("twing");
9-
const { DrupalAttribute } = require("drupal-attribute");
9+
const { StorybookDrupalAttribute } = require("./drupal-attribute");
1010

1111
const projComponentsAbsPath = path.resolve(__dirname, "../src/components");
1212
const projCompositionsAbsPath = path.resolve(__dirname, "../src/compositions");
@@ -23,7 +23,7 @@ try {
2323

2424
const createAttribute = createFunction(
2525
"create_attribute",
26-
() => Promise.resolve(new DrupalAttribute()),
26+
() => Promise.resolve(new StorybookDrupalAttribute()),
2727
[],
2828
);
2929

docs/packages.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
- @openeuropa/bcl-spinner
5858
- @openeuropa/bcl-table
5959
- @openeuropa/bcl-textarea
60-
- @openeuropa/bcl-toast
60+
- @openeuropa/bcl-toasts
6161
- @openeuropa/bcl-user-listing
6262
- @openeuropa/bcl-user-view
6363

src/components/bcl-card-layout/__snapshots__/card-layout.test.js.snap

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ exports[`OE - Card grid renders correctly with cards having equal height 1`] = `
585585
class="col"
586586
>
587587
<article
588-
class="mb-3 card h-100"
588+
class="mb-3 h-100 card"
589589
>
590590
<div
591591
class="card-header"
@@ -632,7 +632,7 @@ exports[`OE - Card grid renders correctly with cards having equal height 1`] = `
632632
class="col"
633633
>
634634
<article
635-
class="mb-3 card h-100"
635+
class="mb-3 h-100 card"
636636
>
637637
<div
638638
class="card-header"
@@ -678,7 +678,7 @@ exports[`OE - Card grid renders correctly with cards having equal height 1`] = `
678678
class="col"
679679
>
680680
<article
681-
class="mb-3 card h-100"
681+
class="mb-3 h-100 card"
682682
>
683683
<div
684684
class="card-header"
@@ -730,7 +730,7 @@ exports[`OE - Card grid renders correctly with cards having equal height 1`] = `
730730
class="col"
731731
>
732732
<article
733-
class="mb-3 card h-100"
733+
class="mb-3 h-100 card"
734734
>
735735
<div
736736
class="card-header"
@@ -777,7 +777,7 @@ exports[`OE - Card grid renders correctly with cards having equal height 1`] = `
777777
class="col"
778778
>
779779
<article
780-
class="mb-3 card h-100"
780+
class="mb-3 h-100 card"
781781
>
782782
<div
783783
class="card-header"
@@ -819,7 +819,7 @@ exports[`OE - Card grid renders correctly with cards having equal height 1`] = `
819819
class="col"
820820
>
821821
<article
822-
class="mb-3 card h-100"
822+
class="mb-3 h-100 card"
823823
>
824824
<div
825825
class="card-header"

src/components/bcl-carousel/__snapshots__/carousel.test.js.snap

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ exports[`OE - carousel renders correctly 1`] = `
1111
class="carousel-indicators d-none d-md-flex"
1212
>
1313
<button
14-
aria-current="aria-current"
14+
aria-current
1515
aria-label="Slide 1"
1616
class="active"
1717
data-bs-slide-to="0"
@@ -175,7 +175,7 @@ exports[`OE - carousel renders correctly when touch swipe is disabled 1`] = `
175175
class="carousel-indicators d-none d-md-flex"
176176
>
177177
<button
178-
aria-current="aria-current"
178+
aria-current
179179
aria-label="Slide 1"
180180
class="active"
181181
data-bs-slide-to="0"
@@ -338,7 +338,7 @@ exports[`OE - carousel renders correctly with caption title and no caption 1`] =
338338
class="carousel-indicators d-none d-md-flex"
339339
>
340340
<button
341-
aria-current="aria-current"
341+
aria-current
342342
aria-label="Slide 1"
343343
class="active"
344344
data-bs-slide-to="0"
@@ -489,7 +489,7 @@ exports[`OE - carousel renders correctly with custom intervals 1`] = `
489489
class="carousel-indicators d-none d-md-flex"
490490
>
491491
<button
492-
aria-current="aria-current"
492+
aria-current
493493
aria-label="Slide 1"
494494
class="active"
495495
data-bs-slide-to="0"
@@ -656,7 +656,7 @@ exports[`OE - carousel renders correctly with dark variant 1`] = `
656656
class="carousel-indicators d-none d-md-flex"
657657
>
658658
<button
659-
aria-current="aria-current"
659+
aria-current
660660
aria-label="Slide 1"
661661
class="active"
662662
data-bs-slide-to="0"
@@ -819,7 +819,7 @@ exports[`OE - carousel renders correctly with fade and dark variant 1`] = `
819819
class="carousel-indicators d-none d-md-flex"
820820
>
821821
<button
822-
aria-current="aria-current"
822+
aria-current
823823
aria-label="Slide 1"
824824
class="active"
825825
data-bs-slide-to="0"
@@ -982,7 +982,7 @@ exports[`OE - carousel renders correctly with fade transition 1`] = `
982982
class="carousel-indicators d-none d-md-flex"
983983
>
984984
<button
985-
aria-current="aria-current"
985+
aria-current
986986
aria-label="Slide 1"
987987
class="active"
988988
data-bs-slide-to="0"
@@ -1145,7 +1145,7 @@ exports[`OE - carousel renders correctly with rounded indicators 1`] = `
11451145
class="carousel-indicators d-none d-md-flex"
11461146
>
11471147
<button
1148-
aria-current="aria-current"
1148+
aria-current
11491149
aria-label="Slide 1"
11501150
class="active"
11511151
data-bs-slide-to="0"
@@ -1314,7 +1314,7 @@ exports[`OE - carousel renders correctly with specific slide 1`] = `
13141314
type="button"
13151315
/>
13161316
<button
1317-
aria-current="aria-current"
1317+
aria-current
13181318
aria-label="Slide 2"
13191319
class="active"
13201320
data-bs-slide-to="1"
@@ -1481,7 +1481,7 @@ exports[`OE - carousel renders correctly with title 1`] = `
14811481
class="carousel-indicators d-none d-md-flex"
14821482
>
14831483
<button
1484-
aria-current="aria-current"
1484+
aria-current
14851485
aria-label="Slide 1"
14861486
class="active"
14871487
data-bs-slide-to="0"
@@ -1643,7 +1643,7 @@ exports[`OE - carousel renders correctly without autoplay 1`] = `
16431643
class="carousel-indicators d-none d-md-flex"
16441644
>
16451645
<button
1646-
aria-current="aria-current"
1646+
aria-current
16471647
aria-label="Slide 1"
16481648
class="active"
16491649
data-bs-slide-to="0"
@@ -1806,7 +1806,7 @@ exports[`OE - carousel renders correctly without controls 1`] = `
18061806
class="carousel-indicators d-none d-md-flex"
18071807
>
18081808
<button
1809-
aria-current="aria-current"
1809+
aria-current
18101810
aria-label="Slide 1"
18111811
class="active"
18121812
data-bs-slide-to="0"

src/components/bcl-dropdown/__snapshots__/dropdown.test.js.snap

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ exports[`OE - dropdown renders correctly 1`] = `
4444
<button
4545
aria-disabled="true"
4646
class="dropdown-item"
47-
disabled="disabled"
47+
disabled
4848
type="button"
4949
>
5050
I'm a disabled button
@@ -107,7 +107,7 @@ exports[`OE - dropdown renders correctly with alignment end 1`] = `
107107
<button
108108
aria-disabled="true"
109109
class="dropdown-item"
110-
disabled="disabled"
110+
disabled
111111
type="button"
112112
>
113113
I'm a disabled button
@@ -170,7 +170,7 @@ exports[`OE - dropdown renders correctly with dark mode 1`] = `
170170
<button
171171
aria-disabled="true"
172172
class="dropdown-item"
173-
disabled="disabled"
173+
disabled
174174
type="button"
175175
>
176176
I'm a disabled button
@@ -233,7 +233,7 @@ exports[`OE - dropdown renders correctly with direction dropup 1`] = `
233233
<button
234234
aria-disabled="true"
235235
class="dropdown-item"
236-
disabled="disabled"
236+
disabled
237237
type="button"
238238
>
239239
I'm a disabled button
@@ -296,7 +296,7 @@ exports[`OE - dropdown renders correctly with trigger link 1`] = `
296296
<button
297297
aria-disabled="true"
298298
class="dropdown-item"
299-
disabled="disabled"
299+
disabled
300300
type="button"
301301
>
302302
I'm a disabled button
@@ -356,7 +356,7 @@ exports[`OE - dropdown renders correctly without wrapper 1`] = `
356356
<button
357357
aria-disabled="true"
358358
class="dropdown-item"
359-
disabled="disabled"
359+
disabled
360360
type="button"
361361
>
362362
I'm a disabled button

src/components/bcl-form-input/__snapshots__/form-input.test.js.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ exports[`OE - Form Input renders correctly when disabled 1`] = `
218218
<input
219219
aria-describedby="helperText"
220220
class="form-control"
221-
disabled="disabled"
221+
disabled
222222
id="example-form-input-1"
223223
type="text"
224224
/>
@@ -323,7 +323,7 @@ exports[`OE - Form Input renders correctly when readonly 1`] = `
323323
aria-describedby="helperText"
324324
class="form-control"
325325
id="example-form-input-1"
326-
readonly="readonly"
326+
readonly
327327
type="text"
328328
/>
329329
<div
@@ -357,7 +357,7 @@ exports[`OE - Form Input renders correctly when required 1`] = `
357357
aria-describedby="helperText"
358358
class="form-control"
359359
id="example-form-input-1"
360-
required="required"
360+
required
361361
type="text"
362362
/>
363363
<div

0 commit comments

Comments
 (0)