@openeuropa/bcl-twig-templates 1.13.0 → 1.13.2
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/bin/copy-templates.js +132 -0
- package/package.json +68 -68
- package/templates/bcl-accordion/accordion.html.twig +140 -0
- package/templates/bcl-alert/alert.html.twig +80 -0
- package/templates/bcl-badge/badge.html.twig +75 -0
- package/templates/bcl-banner/banner.html.twig +105 -0
- package/templates/bcl-base-templates/content-type.html.twig +135 -0
- package/templates/bcl-base-templates/listing-page.html.twig +72 -0
- package/templates/bcl-base-templates/sidebar-search.html.twig +20 -0
- package/templates/bcl-blockquote/blockquote.html.twig +70 -0
- package/templates/bcl-breadcrumb/breadcrumb.html.twig +58 -0
- package/templates/bcl-button/button.html.twig +95 -0
- package/templates/bcl-button-group/button-group.html.twig +63 -0
- package/templates/bcl-card/card.html.twig +291 -0
- package/templates/bcl-card-layout/card-layout.html.twig +84 -0
- package/templates/bcl-carousel/carousel.html.twig +189 -0
- package/templates/bcl-contact-form/contact-form.html.twig +5 -0
- package/templates/bcl-content-banner/content-banner.html.twig +148 -0
- package/templates/bcl-date-block/date-block.html.twig +77 -0
- package/templates/bcl-description-list/description-list-details.html.twig +41 -0
- package/templates/bcl-description-list/description-list-title.html.twig +30 -0
- package/templates/bcl-description-list/description-list.html.twig +117 -0
- package/templates/bcl-dropdown/dropdown.html.twig +131 -0
- package/templates/bcl-event/event.html.twig +24 -0
- package/templates/bcl-fact-figures/fact-figures.html.twig +125 -0
- package/templates/bcl-featured-media/featured-media.html.twig +177 -0
- package/templates/bcl-file/file-translations.html.twig +93 -0
- package/templates/bcl-file/file.html.twig +162 -0
- package/templates/bcl-footer/footer.html.twig +87 -0
- package/templates/bcl-form/form.html.twig +147 -0
- package/templates/bcl-form-input/form-input.html.twig +179 -0
- package/templates/bcl-gallery/gallery-item.html.twig +62 -0
- package/templates/bcl-gallery/gallery.html.twig +191 -0
- package/templates/bcl-group/group-landing.html.twig +101 -0
- package/templates/bcl-group/group.html.twig +27 -0
- package/templates/bcl-header/header.html.twig +135 -0
- package/templates/bcl-heading/heading.html.twig +36 -0
- package/templates/bcl-icon/icon.html.twig +33 -0
- package/templates/bcl-inpage-navigation/inpage-navigation.html.twig +77 -0
- package/templates/bcl-landing-page/landing-page.html.twig +56 -0
- package/templates/bcl-language-list/language-list-grid.html.twig +65 -0
- package/templates/bcl-language-list/language-list-modal.html.twig +111 -0
- package/templates/bcl-language-list/language-list.html.twig +107 -0
- package/templates/bcl-link/link.html.twig +94 -0
- package/templates/bcl-links-block/links-block.html.twig +72 -0
- package/templates/bcl-list-group/list-group.html.twig +116 -0
- package/templates/bcl-listing/listing.html.twig +197 -0
- package/templates/bcl-mega-menu/mega-menu-items.html.twig +32 -0
- package/templates/bcl-mega-menu/mega-menu-submenu.html.twig +67 -0
- package/templates/bcl-mega-menu/mega-menu.html.twig +114 -0
- package/templates/bcl-modal/modal.html.twig +92 -0
- package/templates/bcl-navbar/navbar.html.twig +106 -0
- package/templates/bcl-navigation/navigation.html.twig +184 -0
- package/templates/bcl-offcanvas/offcanvas.html.twig +119 -0
- package/templates/bcl-page/page.html.twig +45 -0
- package/templates/bcl-pagination/pagination-item.html.twig +69 -0
- package/templates/bcl-pagination/pagination.html.twig +158 -0
- package/templates/bcl-pagination-v2/pagination-item.html.twig +86 -0
- package/templates/bcl-pagination-v2/pagination.html.twig +210 -0
- package/templates/bcl-placeholder/placeholder.html.twig +41 -0
- package/templates/bcl-progress/progress.html.twig +69 -0
- package/templates/bcl-project/project-lists.html.twig +69 -0
- package/templates/bcl-project/project.html.twig +72 -0
- package/templates/bcl-project-status/project-contributions.html.twig +53 -0
- package/templates/bcl-project-status/project-status.html.twig +94 -0
- package/templates/bcl-recent-activities/recent-activities.html.twig +60 -0
- package/templates/bcl-search-form/search-form.html.twig +50 -0
- package/templates/bcl-select/select.html.twig +187 -0
- package/templates/bcl-spinner/spinner.html.twig +37 -0
- package/templates/bcl-subscription/subscription-modal.html.twig +24 -0
- package/templates/bcl-subscription/subscription.html.twig +10 -0
- package/templates/bcl-subscription-block/subscription-block.html.twig +35 -0
- package/templates/bcl-table/table.html.twig +191 -0
- package/templates/bcl-textarea/textarea.html.twig +146 -0
- package/templates/bcl-timeline/timeline-item.html.twig +31 -0
- package/templates/bcl-timeline/timeline.html.twig +112 -0
- package/templates/bcl-toasts/toasts.html.twig +128 -0
- package/templates/bcl-user/user-compact.html.twig +61 -0
- package/templates/bcl-user/user-terms.html.twig +11 -0
- package/templates/bcl-user/user.html.twig +137 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
|
|
6
|
+
const packageDir = path.resolve(__dirname, "..");
|
|
7
|
+
const destinationDir = path.join(packageDir, "templates");
|
|
8
|
+
const packageJson = require(path.join(packageDir, "package.json"));
|
|
9
|
+
|
|
10
|
+
const findWorkspaceRoot = (startDir) => {
|
|
11
|
+
let currentDir = startDir;
|
|
12
|
+
|
|
13
|
+
while (currentDir !== path.dirname(currentDir)) {
|
|
14
|
+
if (fs.existsSync(path.join(currentDir, "pnpm-workspace.yaml"))) {
|
|
15
|
+
return currentDir;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
currentDir = path.dirname(currentDir);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return null;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const findWorkspacePackageDir = (workspaceRoot, packageName) => {
|
|
25
|
+
if (!workspaceRoot) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const searchRoots = [
|
|
30
|
+
path.join(workspaceRoot, "src", "components"),
|
|
31
|
+
path.join(workspaceRoot, "src", "compositions"),
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
for (const searchRoot of searchRoots) {
|
|
35
|
+
if (!fs.existsSync(searchRoot)) {
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
for (const entry of fs.readdirSync(searchRoot, { withFileTypes: true })) {
|
|
40
|
+
if (!entry.isDirectory()) {
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const candidateDir = path.join(searchRoot, entry.name);
|
|
45
|
+
const candidatePackageJson = path.join(candidateDir, "package.json");
|
|
46
|
+
|
|
47
|
+
if (!fs.existsSync(candidatePackageJson)) {
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const candidatePackage = JSON.parse(
|
|
52
|
+
fs.readFileSync(candidatePackageJson, "utf8"),
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
if (candidatePackage.name === packageName) {
|
|
56
|
+
return candidateDir;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return null;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const resolvePackageDir = (packageName, workspaceRoot) => {
|
|
65
|
+
try {
|
|
66
|
+
return path.dirname(
|
|
67
|
+
require.resolve(`${packageName}/package.json`, {
|
|
68
|
+
paths: [packageDir],
|
|
69
|
+
}),
|
|
70
|
+
);
|
|
71
|
+
} catch {
|
|
72
|
+
return findWorkspacePackageDir(workspaceRoot, packageName);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const copyTwigFiles = (sourceDir, packageName) => {
|
|
77
|
+
const twigFiles = fs
|
|
78
|
+
.readdirSync(sourceDir, { withFileTypes: true })
|
|
79
|
+
.filter((entry) => entry.isFile() && entry.name.endsWith(".twig"))
|
|
80
|
+
.map((entry) => entry.name);
|
|
81
|
+
|
|
82
|
+
if (twigFiles.length === 0) {
|
|
83
|
+
return 0;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const packageDestinationDir = path.join(
|
|
87
|
+
destinationDir,
|
|
88
|
+
packageName.replace("@openeuropa/", ""),
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
fs.mkdirSync(packageDestinationDir, { recursive: true });
|
|
92
|
+
|
|
93
|
+
for (const twigFile of twigFiles) {
|
|
94
|
+
fs.copyFileSync(
|
|
95
|
+
path.join(sourceDir, twigFile),
|
|
96
|
+
path.join(packageDestinationDir, twigFile),
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return twigFiles.length;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const workspaceRoot = findWorkspaceRoot(packageDir);
|
|
104
|
+
const dependencies = {
|
|
105
|
+
...packageJson.dependencies,
|
|
106
|
+
...packageJson.devDependencies,
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
let copiedFiles = 0;
|
|
110
|
+
|
|
111
|
+
for (const packageName of Object.keys(dependencies).sort()) {
|
|
112
|
+
if (
|
|
113
|
+
!packageName.startsWith("@openeuropa/bcl-") ||
|
|
114
|
+
packageName === packageJson.name
|
|
115
|
+
) {
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const sourceDir = resolvePackageDir(packageName, workspaceRoot);
|
|
120
|
+
|
|
121
|
+
if (!sourceDir) {
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
copiedFiles += copyTwigFiles(sourceDir, packageName);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (copiedFiles === 0) {
|
|
129
|
+
throw new Error("No Twig templates were copied.");
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
console.log(`Copied ${copiedFiles} Twig templates.`);
|
package/package.json
CHANGED
|
@@ -2,83 +2,83 @@
|
|
|
2
2
|
"name": "@openeuropa/bcl-twig-templates",
|
|
3
3
|
"author": "European Commission",
|
|
4
4
|
"license": "EUPL-1.2",
|
|
5
|
-
"version": "1.13.
|
|
5
|
+
"version": "1.13.2",
|
|
6
6
|
"description": "OE Bcl Twig Templates",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
10
10
|
"devDependencies": {
|
|
11
|
-
"@openeuropa/bcl-accordion": "^1.13.
|
|
12
|
-
"@openeuropa/bcl-alert": "^1.13.
|
|
13
|
-
"@openeuropa/bcl-badge": "^1.13.
|
|
14
|
-
"@openeuropa/bcl-banner": "^1.13.
|
|
15
|
-
"@openeuropa/bcl-base-templates": "^1.13.
|
|
16
|
-
"@openeuropa/bcl-blockquote": "^1.13.
|
|
17
|
-
"@openeuropa/bcl-breadcrumb": "^1.13.
|
|
18
|
-
"@openeuropa/bcl-button": "^1.13.
|
|
19
|
-
"@openeuropa/bcl-button-group": "^1.13.
|
|
20
|
-
"@openeuropa/bcl-card": "^1.13.
|
|
21
|
-
"@openeuropa/bcl-card-layout": "^1.13.
|
|
22
|
-
"@openeuropa/bcl-carousel": "^1.13.
|
|
23
|
-
"@openeuropa/bcl-contact-form": "^1.13.
|
|
24
|
-
"@openeuropa/bcl-content-banner": "^1.13.
|
|
25
|
-
"@openeuropa/bcl-date-block": "^1.13.
|
|
26
|
-
"@openeuropa/bcl-description-list": "^1.13.
|
|
27
|
-
"@openeuropa/bcl-dropdown": "^1.13.
|
|
28
|
-
"@openeuropa/bcl-event": "^1.13.
|
|
29
|
-
"@openeuropa/bcl-fact-figures": "^1.13.
|
|
30
|
-
"@openeuropa/bcl-featured-media": "^1.13.
|
|
31
|
-
"@openeuropa/bcl-file": "^1.13.
|
|
32
|
-
"@openeuropa/bcl-footer": "^1.13.
|
|
33
|
-
"@openeuropa/bcl-form": "^1.13.
|
|
34
|
-
"@openeuropa/bcl-form-input": "^1.13.
|
|
35
|
-
"@openeuropa/bcl-gallery": "^1.13.
|
|
36
|
-
"@openeuropa/bcl-glossary": "^1.13.
|
|
37
|
-
"@openeuropa/bcl-group": "^1.13.
|
|
38
|
-
"@openeuropa/bcl-header": "^1.13.
|
|
39
|
-
"@openeuropa/bcl-heading": "^1.13.
|
|
40
|
-
"@openeuropa/bcl-icon": "^1.13.
|
|
41
|
-
"@openeuropa/bcl-inpage-navigation": "^1.13.
|
|
42
|
-
"@openeuropa/bcl-landing-page": "^1.13.
|
|
43
|
-
"@openeuropa/bcl-language-list": "^1.13.
|
|
44
|
-
"@openeuropa/bcl-language-switcher": "^1.13.
|
|
45
|
-
"@openeuropa/bcl-link": "^1.13.
|
|
46
|
-
"@openeuropa/bcl-links-block": "^1.13.
|
|
47
|
-
"@openeuropa/bcl-list-group": "^1.13.
|
|
48
|
-
"@openeuropa/bcl-listing": "^1.13.
|
|
49
|
-
"@openeuropa/bcl-mega-menu": "^1.13.
|
|
50
|
-
"@openeuropa/bcl-modal": "^1.13.
|
|
51
|
-
"@openeuropa/bcl-multilingual": "^1.13.
|
|
52
|
-
"@openeuropa/bcl-navbar": "^1.13.
|
|
53
|
-
"@openeuropa/bcl-navigation": "^1.13.
|
|
54
|
-
"@openeuropa/bcl-news": "^1.13.
|
|
55
|
-
"@openeuropa/bcl-offcanvas": "^1.13.
|
|
56
|
-
"@openeuropa/bcl-page": "^1.13.
|
|
57
|
-
"@openeuropa/bcl-pagination": "^1.13.
|
|
58
|
-
"@openeuropa/bcl-pagination-v2": "^1.13.
|
|
59
|
-
"@openeuropa/bcl-person": "^1.13.
|
|
60
|
-
"@openeuropa/bcl-placeholder": "^1.13.
|
|
61
|
-
"@openeuropa/bcl-progress": "^1.13.
|
|
62
|
-
"@openeuropa/bcl-project": "^1.13.
|
|
63
|
-
"@openeuropa/bcl-project-status": "^1.13.
|
|
64
|
-
"@openeuropa/bcl-recent-activities": "^1.13.
|
|
65
|
-
"@openeuropa/bcl-search": "^1.13.
|
|
66
|
-
"@openeuropa/bcl-search-form": "^1.13.
|
|
67
|
-
"@openeuropa/bcl-select": "^1.13.
|
|
68
|
-
"@openeuropa/bcl-spinner": "^1.13.
|
|
69
|
-
"@openeuropa/bcl-subscription": "^1.13.
|
|
70
|
-
"@openeuropa/bcl-subscription-block": "^1.13.
|
|
71
|
-
"@openeuropa/bcl-table": "^1.13.
|
|
72
|
-
"@openeuropa/bcl-textarea": "^1.13.
|
|
73
|
-
"@openeuropa/bcl-timeline": "^1.13.
|
|
74
|
-
"@openeuropa/bcl-toasts": "^1.13.
|
|
75
|
-
"@openeuropa/bcl-user": "^1.13.
|
|
11
|
+
"@openeuropa/bcl-accordion": "^1.13.2",
|
|
12
|
+
"@openeuropa/bcl-alert": "^1.13.2",
|
|
13
|
+
"@openeuropa/bcl-badge": "^1.13.2",
|
|
14
|
+
"@openeuropa/bcl-banner": "^1.13.2",
|
|
15
|
+
"@openeuropa/bcl-base-templates": "^1.13.2",
|
|
16
|
+
"@openeuropa/bcl-blockquote": "^1.13.2",
|
|
17
|
+
"@openeuropa/bcl-breadcrumb": "^1.13.2",
|
|
18
|
+
"@openeuropa/bcl-button": "^1.13.2",
|
|
19
|
+
"@openeuropa/bcl-button-group": "^1.13.2",
|
|
20
|
+
"@openeuropa/bcl-card": "^1.13.2",
|
|
21
|
+
"@openeuropa/bcl-card-layout": "^1.13.2",
|
|
22
|
+
"@openeuropa/bcl-carousel": "^1.13.2",
|
|
23
|
+
"@openeuropa/bcl-contact-form": "^1.13.2",
|
|
24
|
+
"@openeuropa/bcl-content-banner": "^1.13.2",
|
|
25
|
+
"@openeuropa/bcl-date-block": "^1.13.2",
|
|
26
|
+
"@openeuropa/bcl-description-list": "^1.13.2",
|
|
27
|
+
"@openeuropa/bcl-dropdown": "^1.13.2",
|
|
28
|
+
"@openeuropa/bcl-event": "^1.13.2",
|
|
29
|
+
"@openeuropa/bcl-fact-figures": "^1.13.2",
|
|
30
|
+
"@openeuropa/bcl-featured-media": "^1.13.2",
|
|
31
|
+
"@openeuropa/bcl-file": "^1.13.2",
|
|
32
|
+
"@openeuropa/bcl-footer": "^1.13.2",
|
|
33
|
+
"@openeuropa/bcl-form": "^1.13.2",
|
|
34
|
+
"@openeuropa/bcl-form-input": "^1.13.2",
|
|
35
|
+
"@openeuropa/bcl-gallery": "^1.13.2",
|
|
36
|
+
"@openeuropa/bcl-glossary": "^1.13.2",
|
|
37
|
+
"@openeuropa/bcl-group": "^1.13.2",
|
|
38
|
+
"@openeuropa/bcl-header": "^1.13.2",
|
|
39
|
+
"@openeuropa/bcl-heading": "^1.13.2",
|
|
40
|
+
"@openeuropa/bcl-icon": "^1.13.2",
|
|
41
|
+
"@openeuropa/bcl-inpage-navigation": "^1.13.2",
|
|
42
|
+
"@openeuropa/bcl-landing-page": "^1.13.2",
|
|
43
|
+
"@openeuropa/bcl-language-list": "^1.13.2",
|
|
44
|
+
"@openeuropa/bcl-language-switcher": "^1.13.2",
|
|
45
|
+
"@openeuropa/bcl-link": "^1.13.2",
|
|
46
|
+
"@openeuropa/bcl-links-block": "^1.13.2",
|
|
47
|
+
"@openeuropa/bcl-list-group": "^1.13.2",
|
|
48
|
+
"@openeuropa/bcl-listing": "^1.13.2",
|
|
49
|
+
"@openeuropa/bcl-mega-menu": "^1.13.2",
|
|
50
|
+
"@openeuropa/bcl-modal": "^1.13.2",
|
|
51
|
+
"@openeuropa/bcl-multilingual": "^1.13.2",
|
|
52
|
+
"@openeuropa/bcl-navbar": "^1.13.2",
|
|
53
|
+
"@openeuropa/bcl-navigation": "^1.13.2",
|
|
54
|
+
"@openeuropa/bcl-news": "^1.13.2",
|
|
55
|
+
"@openeuropa/bcl-offcanvas": "^1.13.2",
|
|
56
|
+
"@openeuropa/bcl-page": "^1.13.2",
|
|
57
|
+
"@openeuropa/bcl-pagination": "^1.13.2",
|
|
58
|
+
"@openeuropa/bcl-pagination-v2": "^1.13.2",
|
|
59
|
+
"@openeuropa/bcl-person": "^1.13.2",
|
|
60
|
+
"@openeuropa/bcl-placeholder": "^1.13.2",
|
|
61
|
+
"@openeuropa/bcl-progress": "^1.13.2",
|
|
62
|
+
"@openeuropa/bcl-project": "^1.13.2",
|
|
63
|
+
"@openeuropa/bcl-project-status": "^1.13.2",
|
|
64
|
+
"@openeuropa/bcl-recent-activities": "^1.13.2",
|
|
65
|
+
"@openeuropa/bcl-search": "^1.13.2",
|
|
66
|
+
"@openeuropa/bcl-search-form": "^1.13.2",
|
|
67
|
+
"@openeuropa/bcl-select": "^1.13.2",
|
|
68
|
+
"@openeuropa/bcl-spinner": "^1.13.2",
|
|
69
|
+
"@openeuropa/bcl-subscription": "^1.13.2",
|
|
70
|
+
"@openeuropa/bcl-subscription-block": "^1.13.2",
|
|
71
|
+
"@openeuropa/bcl-table": "^1.13.2",
|
|
72
|
+
"@openeuropa/bcl-textarea": "^1.13.2",
|
|
73
|
+
"@openeuropa/bcl-timeline": "^1.13.2",
|
|
74
|
+
"@openeuropa/bcl-toasts": "^1.13.2",
|
|
75
|
+
"@openeuropa/bcl-user": "^1.13.2",
|
|
76
76
|
"copyfiles": "2.4.1",
|
|
77
77
|
"rimraf": "6.1.3"
|
|
78
78
|
},
|
|
79
79
|
"scripts": {
|
|
80
80
|
"clean": "rimraf templates",
|
|
81
|
-
"copy": "
|
|
81
|
+
"copy": "node bin/copy-templates.js",
|
|
82
82
|
"prepublish": "npm run clean && npm run copy"
|
|
83
83
|
},
|
|
84
84
|
"repository": {
|
|
@@ -95,5 +95,5 @@
|
|
|
95
95
|
"design-system",
|
|
96
96
|
"twig"
|
|
97
97
|
],
|
|
98
|
-
"gitHead": "
|
|
98
|
+
"gitHead": "13e3e4489e4ab19744c8231f0f84bd9e5dfd92f4"
|
|
99
99
|
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
{#
|
|
2
|
+
Parameters:
|
|
3
|
+
- title (string) (default: '')
|
|
4
|
+
- title_tag (string) (default: 'h2')
|
|
5
|
+
- title_link: (link object) (default: {})
|
|
6
|
+
- title_attributes: (drupal attrs)
|
|
7
|
+
- id (int) (default: random(10000))
|
|
8
|
+
- flush (boolean) (default: false)
|
|
9
|
+
- items (array) (default: []): format: [
|
|
10
|
+
{
|
|
11
|
+
title: (string),
|
|
12
|
+
title_tag: (string),
|
|
13
|
+
content: (block),
|
|
14
|
+
stay_open (boolean) (default: false)
|
|
15
|
+
},
|
|
16
|
+
]
|
|
17
|
+
- expand_button: (button object) (default: {})
|
|
18
|
+
- collapse_button: (button object) (default: {})
|
|
19
|
+
- open_item_id (int) (default: 0)
|
|
20
|
+
- attributes (drupal attrs)
|
|
21
|
+
#}
|
|
22
|
+
|
|
23
|
+
{%- set _title = title|default('') %}
|
|
24
|
+
{% set _title_tag = title_tag|default('h2') %}
|
|
25
|
+
{% set _title_link = title_link|default({}) %}
|
|
26
|
+
{% set _title_attributes = title_attributes ?: create_attribute() %}
|
|
27
|
+
{% set _id = id|default(random(10000)) %}
|
|
28
|
+
{% set _flush = flush ?? false %}
|
|
29
|
+
{% set _items = items|default([]) %}
|
|
30
|
+
{% set _expand_button = expand_button|default({}) %}
|
|
31
|
+
{% set _collapse_button = collapse_button|default({}) %}
|
|
32
|
+
{% set _open_item_id = open_item_id|default(0) %}
|
|
33
|
+
{% set _classes = ['accordion'] %}
|
|
34
|
+
{% if _flush %}
|
|
35
|
+
{%- set _classes = _classes|merge(['accordion-flush']) %}
|
|
36
|
+
{% endif %}
|
|
37
|
+
|
|
38
|
+
{%- if attributes is empty %}
|
|
39
|
+
{%- set attributes = create_attribute() %}
|
|
40
|
+
{% endif %}
|
|
41
|
+
|
|
42
|
+
{%- set attributes = attributes.addClass(_classes).setAttribute('id', 'accordion-' ~ _id) %}
|
|
43
|
+
|
|
44
|
+
{%- if _items is not empty -%}
|
|
45
|
+
<div
|
|
46
|
+
{{ attributes }}
|
|
47
|
+
>
|
|
48
|
+
{%- if _title is not empty -%}
|
|
49
|
+
{% include '@oe-bcl/bcl-heading/heading.html.twig' with {
|
|
50
|
+
title: _title,
|
|
51
|
+
title_tag: _title_tag,
|
|
52
|
+
title_link: _title_link,
|
|
53
|
+
attributes: _title_attributes,
|
|
54
|
+
} only %}
|
|
55
|
+
{%- endif -%}
|
|
56
|
+
|
|
57
|
+
{% if _items|length > 1 and (_expand_button is not empty or _collapse_button is not empty) %}
|
|
58
|
+
{%- set wrapper_attributes = create_attribute().addClass(['d-flex', 'justify-content-end', 'gap-3', 'mb-3']) -%}
|
|
59
|
+
<div
|
|
60
|
+
{{ wrapper_attributes }}
|
|
61
|
+
>
|
|
62
|
+
{%- if _expand_button is not empty %}
|
|
63
|
+
{%- if _expand_button.attributes is empty %}
|
|
64
|
+
{%- set _expand_button = _expand_button|merge({
|
|
65
|
+
attributes: create_attribute()
|
|
66
|
+
})
|
|
67
|
+
%}
|
|
68
|
+
{%- endif %}
|
|
69
|
+
{%- include '@oe-bcl/bcl-button/button.html.twig' with _expand_button|merge({
|
|
70
|
+
attributes: _expand_button.attributes
|
|
71
|
+
.setAttribute('data-target', 'accordion-' ~ _id)
|
|
72
|
+
.setAttribute('data-action', 'expand')
|
|
73
|
+
}) only %}
|
|
74
|
+
{%- endif %}
|
|
75
|
+
{%- if _collapse_button is not empty %}
|
|
76
|
+
{%- if _collapse_button.attributes is empty %}
|
|
77
|
+
{%- set _collapse_button = _collapse_button|merge({
|
|
78
|
+
attributes: create_attribute()
|
|
79
|
+
})
|
|
80
|
+
%}
|
|
81
|
+
{%- endif %}
|
|
82
|
+
{%- include '@oe-bcl/bcl-button/button.html.twig' with _collapse_button|merge({
|
|
83
|
+
attributes: _collapse_button.attributes
|
|
84
|
+
.setAttribute('data-target', 'accordion-' ~ _id)
|
|
85
|
+
.setAttribute('data-action', 'collapse')
|
|
86
|
+
}) only %}
|
|
87
|
+
{%- endif -%}
|
|
88
|
+
</div>
|
|
89
|
+
{%- endif -%}
|
|
90
|
+
<div class="accordion-items-wrapper">
|
|
91
|
+
{%- for _item in _items %}
|
|
92
|
+
{%- set _open_item = _open_item_id == loop.index %}
|
|
93
|
+
{%- set _button_classes = ['accordion-button'] %}
|
|
94
|
+
{%- if not _open_item %}
|
|
95
|
+
{%- set _button_classes = _button_classes|merge(['collapsed']) %}
|
|
96
|
+
{%- endif -%}
|
|
97
|
+
<div class="accordion-item">
|
|
98
|
+
{%- set _item_title_tag = _item.title_tag|default('h2') -%}
|
|
99
|
+
<{{ _item_title_tag }}
|
|
100
|
+
class="accordion-header"
|
|
101
|
+
id="heading-{{ _id }}-{{ loop.index }}"
|
|
102
|
+
>
|
|
103
|
+
{%- set button_attributes = create_attribute()
|
|
104
|
+
.addClass(_button_classes)
|
|
105
|
+
.setAttribute('data-bs-toggle', 'collapse')
|
|
106
|
+
.setAttribute('autocomplete', 'off')
|
|
107
|
+
.setAttribute('data-bs-target', '#collapse-' ~ _id ~ '-' ~ loop.index)
|
|
108
|
+
.setAttribute('aria-controls', 'collapse-' ~ _id ~ '-' ~ loop.index)
|
|
109
|
+
.setAttribute('aria-expanded', open_item ? 'true' : 'false')
|
|
110
|
+
%}
|
|
111
|
+
{%- set item_title -%}
|
|
112
|
+
<span>
|
|
113
|
+
{{- _item.title -}}
|
|
114
|
+
</span>
|
|
115
|
+
{%- endset %}
|
|
116
|
+
{%- include '@oe-bcl/bcl-button/button.html.twig' with {
|
|
117
|
+
label: item_title,
|
|
118
|
+
clean_class: true,
|
|
119
|
+
attributes: button_attributes
|
|
120
|
+
} only -%}
|
|
121
|
+
</{{ _item_title_tag }}>{# -#}
|
|
122
|
+
<div
|
|
123
|
+
id="collapse-{{ _id }}-{{ loop.index }}"
|
|
124
|
+
class="accordion-collapse collapse{{ _open_item ? ' show' }}"
|
|
125
|
+
aria-labelledby="heading-{{ _id }}-{{ loop.index }}"
|
|
126
|
+
role="region"
|
|
127
|
+
{% if not _item.stay_open and _expand_button is empty %}
|
|
128
|
+
data-bs-parent="#accordion-{{ _id }}"
|
|
129
|
+
{% endif %}
|
|
130
|
+
>{# -#}
|
|
131
|
+
<div class="accordion-body">
|
|
132
|
+
{%- set _content = _item.content|default('') %}
|
|
133
|
+
{%- block content _content -%}
|
|
134
|
+
</div>{# -#}
|
|
135
|
+
</div>{# -#}
|
|
136
|
+
</div>
|
|
137
|
+
{%- endfor -%}
|
|
138
|
+
</div>{# -#}
|
|
139
|
+
</div>
|
|
140
|
+
{%- endif -%}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
{# Parameters:
|
|
2
|
+
- message (string) (default: '')
|
|
3
|
+
- heading (string) (default: '')
|
|
4
|
+
- variant (string) (default: 'primary')
|
|
5
|
+
- dismissible (boolean) (default: true)
|
|
6
|
+
- animated_dismiss (boolean) (default: true)
|
|
7
|
+
- icon_path (string) (default: '')
|
|
8
|
+
- icon_name (string) (default: '')
|
|
9
|
+
- attributes (drupal attrs)
|
|
10
|
+
#}
|
|
11
|
+
|
|
12
|
+
{%- set _message = message|default('') %}
|
|
13
|
+
{% set _heading = heading|default('') %}
|
|
14
|
+
{% set _variant = variant|default('primary') %}
|
|
15
|
+
{% set _dismissible = dismissible ?? true %}
|
|
16
|
+
{% set _animated_dismiss = animated_dismiss ?? true %}
|
|
17
|
+
{% set _icon_path = icon_path|default('') %}
|
|
18
|
+
{% set _icon_name = icon_name|default('') %}
|
|
19
|
+
|
|
20
|
+
{%- set _classes = ['alert', 'alert-' ~ _variant|e('html_attr'), 'd-flex', 'align-items-center'] %}
|
|
21
|
+
{% set _icon_names = {
|
|
22
|
+
primary: "info-circle-fill",
|
|
23
|
+
secondary: "info-circle-fill",
|
|
24
|
+
success: "check-circle-fill",
|
|
25
|
+
danger: "dash-circle-fill",
|
|
26
|
+
warning: "exclamation-triangle-fill",
|
|
27
|
+
light: "info-circle-fill",
|
|
28
|
+
info: "info-circle-fill",
|
|
29
|
+
dark: "info-circle-fill",
|
|
30
|
+
}
|
|
31
|
+
%}
|
|
32
|
+
|
|
33
|
+
{%- if _dismissible %}
|
|
34
|
+
{%- set _classes = _classes|merge(['alert-dismissible']) %}
|
|
35
|
+
{% endif %}
|
|
36
|
+
{% if _animated_dismiss %}
|
|
37
|
+
{%- set _classes = _classes|merge(['fade', 'show']) %}
|
|
38
|
+
{% endif %}
|
|
39
|
+
|
|
40
|
+
{%- set _classes = _classes|merge(['text-dark']) %}
|
|
41
|
+
|
|
42
|
+
{%- set _icon_classes = ['flex-shrink-0 me-3 mt-1 align-self-start' ] %}
|
|
43
|
+
|
|
44
|
+
{%- if _variant != 'light' %}
|
|
45
|
+
{%- set _icon_classes = _icon_classes|merge(['text-' ~ _variant]) %}
|
|
46
|
+
{% endif %}
|
|
47
|
+
|
|
48
|
+
{%- if attributes is empty %}
|
|
49
|
+
{%- set attributes = create_attribute() %}
|
|
50
|
+
{% endif %}
|
|
51
|
+
|
|
52
|
+
{%- set attributes = attributes.addClass(_classes).setAttribute('role', 'alert') -%}
|
|
53
|
+
|
|
54
|
+
<div {{ attributes }}>
|
|
55
|
+
{%- if _icon_path is not empty %}
|
|
56
|
+
{%- include '@oe-bcl/bcl-icon/icon.html.twig' with {
|
|
57
|
+
name: _icon_name ?: _icon_names[_variant],
|
|
58
|
+
size: 's',
|
|
59
|
+
path: _icon_path,
|
|
60
|
+
attributes: create_attribute().addClass(_icon_classes),
|
|
61
|
+
} only %}
|
|
62
|
+
{% endif -%}
|
|
63
|
+
<div class="alert-content flex-grow-1">
|
|
64
|
+
{%- if _heading is not empty -%}
|
|
65
|
+
<div class="alert-heading h4">{{ _heading }}</div>
|
|
66
|
+
{%- endif -%}
|
|
67
|
+
{%- if _message is not empty -%}
|
|
68
|
+
{{- _message -}}
|
|
69
|
+
{%- endif -%}
|
|
70
|
+
</div>
|
|
71
|
+
{%- if _dismissible -%}
|
|
72
|
+
<button
|
|
73
|
+
type="button"
|
|
74
|
+
class="btn-close"
|
|
75
|
+
data-bs-dismiss="alert"
|
|
76
|
+
aria-label="Close"
|
|
77
|
+
></button>
|
|
78
|
+
{%- endif -%}
|
|
79
|
+
</div>
|
|
80
|
+
{#--#}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{# Parameters:
|
|
2
|
+
- label (string) (default: '')
|
|
3
|
+
- background: (string) (default: 'primary')
|
|
4
|
+
- url (string) (default: '')
|
|
5
|
+
- title (string) (default: '')
|
|
6
|
+
- dismissible (boolean) (default: false)
|
|
7
|
+
- assistive_text (string) (default: '')
|
|
8
|
+
- rounded_pill (boolean) (default: false)
|
|
9
|
+
- outline (boolean) (default: false)
|
|
10
|
+
- icon_path (string) (default: '')
|
|
11
|
+
- attributes (drupal attrs)
|
|
12
|
+
#}
|
|
13
|
+
|
|
14
|
+
{%- set _label = label|default('') %}
|
|
15
|
+
{% set _background = background|default('primary') %}
|
|
16
|
+
{% set _url = url|default('') %}
|
|
17
|
+
{% set _title = title|default('') %}
|
|
18
|
+
{% set _dismissible = dismissible ?? false %}
|
|
19
|
+
{% set _assistive_text = assistive_text|default('') %}
|
|
20
|
+
{% set _rounded_pill = rounded_pill|default(false) %}
|
|
21
|
+
{% set _outline = outline|default(false) %}
|
|
22
|
+
{% set _icon_path = icon_path|default('') %}
|
|
23
|
+
{% set _classes = ['badge'] %}
|
|
24
|
+
|
|
25
|
+
{%- if _rounded_pill %}
|
|
26
|
+
{%- set _classes = _classes|merge(['rounded-pill']) %}
|
|
27
|
+
{% endif %}
|
|
28
|
+
|
|
29
|
+
{%- if _outline %}
|
|
30
|
+
{%- set _classes = _classes|merge(['badge-outline-' ~ _background]) %}
|
|
31
|
+
{% else %}
|
|
32
|
+
{%- set _classes = _classes|merge(['text-bg-' ~ _background]) %}
|
|
33
|
+
{% endif %}
|
|
34
|
+
|
|
35
|
+
{%- if attributes is empty %}
|
|
36
|
+
{%- set attributes = create_attribute() %}
|
|
37
|
+
{% endif %}
|
|
38
|
+
|
|
39
|
+
{%- if _title is not empty -%}
|
|
40
|
+
{% set attributes = attributes.setAttribute('title', _title) %}
|
|
41
|
+
{%- endif -%}
|
|
42
|
+
|
|
43
|
+
{% set attributes = attributes.addClass(_classes) %}
|
|
44
|
+
|
|
45
|
+
{%- set _label %}
|
|
46
|
+
{%- if _assistive_text is not empty -%}
|
|
47
|
+
<span class="visually-hidden">
|
|
48
|
+
{{- _assistive_text -}}
|
|
49
|
+
</span>
|
|
50
|
+
{%- endif -%}
|
|
51
|
+
{{- _label -}}
|
|
52
|
+
{%- if _dismissible -%}
|
|
53
|
+
<span class="icon--close" aria-hidden="true">
|
|
54
|
+
{%- include '@oe-bcl/bcl-icon/icon.html.twig' with {
|
|
55
|
+
name: "x-circle-fill",
|
|
56
|
+
size: "xs",
|
|
57
|
+
path: _icon_path,
|
|
58
|
+
} only -%}
|
|
59
|
+
</span>
|
|
60
|
+
{%- endif -%}
|
|
61
|
+
{% endset %}
|
|
62
|
+
|
|
63
|
+
{%- if _url is not empty -%}
|
|
64
|
+
{% include '@oe-bcl/bcl-link/link.html.twig' with {
|
|
65
|
+
label: _label,
|
|
66
|
+
path: _url,
|
|
67
|
+
attributes: attributes,
|
|
68
|
+
} only %}
|
|
69
|
+
{%- else -%}
|
|
70
|
+
<span
|
|
71
|
+
{{ attributes }}
|
|
72
|
+
>
|
|
73
|
+
{{- _label -}}
|
|
74
|
+
</span>
|
|
75
|
+
{%- endif -%}
|