@ilo-org/twig 0.10.5 → 0.11.1
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/.turbo/turbo-build:lib.log +2 -2
- package/CHANGELOG.md +37 -0
- package/package.json +3 -3
- package/src/patterns/components/datepicker/datepicker.twig +1 -1
- package/src/patterns/components/datepicker/datepicker.wingsuit.yml +1 -1
- package/src/patterns/components/{form → fileupload}/fileupload.behavior.js +0 -1
- package/src/patterns/components/{form → fileupload}/fileupload.js +47 -19
- package/src/patterns/components/fileupload/fileupload.stories.jsx +9 -0
- package/src/patterns/components/fileupload/fileupload.twig +20 -0
- package/src/patterns/components/fileupload/fileupload.wingsuit.yml +94 -0
- package/src/patterns/components/fileupload/index.js +8 -0
- package/src/patterns/components/footer/footer.wingsuit.yml +1 -1
- package/src/patterns/components/form/fieldset.twig +10 -2
- package/src/patterns/components/form/form.wingsuit.yml +56 -2
- package/src/patterns/components/form/formcontrol.twig +4 -1
- package/src/patterns/components/form/index.js +1 -2
- package/src/patterns/components/hero/hero.twig +47 -38
- package/src/patterns/components/hero/hero.wingsuit.yml +19 -4
- package/src/patterns/components/hero/index.js +1 -0
- package/src/patterns/components/navigation/navigation.twig +4 -0
- package/src/patterns/components/numberpicker/index.js +7 -0
- package/src/patterns/components/numberpicker/numberpicker.stories.jsx +9 -0
- package/src/patterns/components/numberpicker/numberpicker.twig +16 -0
- package/src/patterns/components/numberpicker/numberpicker.wingsuit.yml +91 -0
- package/src/patterns/components/radio/index.js +7 -0
- package/src/patterns/components/radio/radio.stories.jsx +10 -0
- package/src/patterns/components/radio/radio.twig +23 -0
- package/src/patterns/components/radio/radio.wingsuit.yml +83 -0
- package/src/patterns/components/textarea/index.js +7 -0
- package/src/patterns/components/textarea/textarea.stories.jsx +9 -0
- package/src/patterns/components/textarea/textarea.twig +14 -0
- package/src/patterns/components/textarea/textarea.wingsuit.yml +126 -0
- package/src/patterns/components/textinput/textinput.twig +2 -1
- package/src/patterns/components/toggle/index.js +7 -0
- package/src/patterns/components/toggle/toggle.stories.jsx +10 -0
- package/src/patterns/components/toggle/toggle.twig +36 -0
- package/src/patterns/components/toggle/toggle.wingsuit.yml +94 -0
- package/src/patterns/components/tooltip/tooltip.twig +7 -5
- package/src/patterns/components/tooltip/tooltip.wingsuit.yml +9 -0
- package/src/patterns/components/form/file.twig +0 -14
- package/src/patterns/components/form/number.twig +0 -13
- package/src/patterns/components/form/radio.twig +0 -4
- package/src/patterns/components/form/textarea.twig +0 -13
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
> @ilo-org/twig@0.
|
|
2
|
+
> @ilo-org/twig@0.11.1 build:lib /home/runner/work/designsystem/designsystem/packages/twig
|
|
3
3
|
> node importprefix.js && node importsvgs.js && pnpm output
|
|
4
4
|
|
|
5
5
|
theme prefix added
|
|
6
6
|
|
|
7
|
-
> @ilo-org/twig@0.
|
|
7
|
+
> @ilo-org/twig@0.11.1 output /home/runner/work/designsystem/designsystem/packages/twig
|
|
8
8
|
> node outputtwigs.js
|
|
9
9
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# @ilo-org/twig
|
|
2
2
|
|
|
3
|
+
## 0.11.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 515502c24: The Hero component accepts top level `theme` and `background` variables that it will pass to the card. Otherwise, it's still possible to pass them directly to the card on an object with all of the other card properties.
|
|
8
|
+
- 7c5bb7bed: Update Hero to insert standard hero card offset so as to align it with content in the main content container
|
|
9
|
+
- Updated dependencies [ee517d0f2]
|
|
10
|
+
- Updated dependencies [71002bcde]
|
|
11
|
+
- Updated dependencies [703bc66a6]
|
|
12
|
+
- Updated dependencies [ad52c6442]
|
|
13
|
+
- Updated dependencies [9be1cd23e]
|
|
14
|
+
- @ilo-org/styles@0.10.2
|
|
15
|
+
- @ilo-org/themes@0.6.0
|
|
16
|
+
|
|
17
|
+
## 0.11.0
|
|
18
|
+
|
|
19
|
+
### Minor Changes
|
|
20
|
+
|
|
21
|
+
- 455e1b626: Add Radio as form element
|
|
22
|
+
- 41f933135: Adds File Upload as form element
|
|
23
|
+
- 4f439c1bf: Add Number Picker as form element
|
|
24
|
+
- b7e6cda36: Add TextArea as form element
|
|
25
|
+
- 2acffbd2e: Add Toggle as form element
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- bd5919f50: Setting formControlClass as a variable with the default value at the begining of the template.
|
|
30
|
+
- a43230b26: Add blocks to override with Drupal search block on the navigation.
|
|
31
|
+
- c86fa4f33: Fix tooltip icon appearing in the wrong color. This adds a new parameter `icontheme` for the tooltip, which defaults to light.
|
|
32
|
+
- 86b5b118a: Set name as default id for TextInput
|
|
33
|
+
- Updated dependencies [c3b0e6def]
|
|
34
|
+
- Updated dependencies [39ff32a91]
|
|
35
|
+
- Updated dependencies [0488bc66e]
|
|
36
|
+
- Updated dependencies [c86fa4f33]
|
|
37
|
+
- @ilo-org/styles@0.10.1
|
|
38
|
+
- @ilo-org/themes@0.5.1
|
|
39
|
+
|
|
3
40
|
## 0.10.5
|
|
4
41
|
|
|
5
42
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ilo-org/twig",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Twig components for the ILO's Design System",
|
|
6
6
|
"main": "",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"@ilo-org/brand-assets": "0.2.0",
|
|
26
26
|
"@ilo-org/fonts": "0.1.0",
|
|
27
27
|
"@ilo-org/icons": "0.2.1",
|
|
28
|
-
"@ilo-org/styles": "0.10.
|
|
29
|
-
"@ilo-org/themes": "0.
|
|
28
|
+
"@ilo-org/styles": "0.10.2",
|
|
29
|
+
"@ilo-org/themes": "0.6.0",
|
|
30
30
|
"@ilo-org/utils": "0.0.11"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
@@ -2,7 +2,7 @@ datepicker:
|
|
|
2
2
|
namespace: Components/Forms
|
|
3
3
|
use: "@components/datepicker/datepicker.twig"
|
|
4
4
|
label: Date Picker
|
|
5
|
-
description: The
|
|
5
|
+
description: The Date Picker component is used to select a date from a calendar.
|
|
6
6
|
visibility: storybook
|
|
7
7
|
fields:
|
|
8
8
|
label:
|
|
@@ -47,12 +47,12 @@ export default class FileUpload {
|
|
|
47
47
|
* @chainable
|
|
48
48
|
*/
|
|
49
49
|
cacheDomReferences() {
|
|
50
|
-
|
|
51
|
-
* The button for toggling Read More state
|
|
52
|
-
* @type {Object}
|
|
53
|
-
*/
|
|
50
|
+
// Find the container of the input
|
|
54
51
|
this.container = this.element.parentElement.parentElement;
|
|
55
52
|
|
|
53
|
+
// Find the form control
|
|
54
|
+
this.formControl = this.container.parentElement;
|
|
55
|
+
|
|
56
56
|
return this;
|
|
57
57
|
}
|
|
58
58
|
|
|
@@ -80,29 +80,56 @@ export default class FileUpload {
|
|
|
80
80
|
return this;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
/**
|
|
84
|
+
* Format bytes to a human readable format
|
|
85
|
+
*
|
|
86
|
+
* @param {Number} bytes
|
|
87
|
+
* @param {Number} decimals
|
|
88
|
+
* @return {String}
|
|
89
|
+
*/
|
|
90
|
+
formatBytes(bytes, decimals = 2) {
|
|
91
|
+
if (!+bytes) return "0 Bytes";
|
|
92
|
+
|
|
93
|
+
const k = 1024;
|
|
94
|
+
const dm = decimals < 0 ? 0 : decimals;
|
|
95
|
+
const sizes = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
|
|
96
|
+
|
|
97
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
98
|
+
|
|
99
|
+
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;
|
|
100
|
+
}
|
|
101
|
+
|
|
83
102
|
/**
|
|
84
103
|
* onChange interaction with the FileUpload button
|
|
85
104
|
*
|
|
86
105
|
* @return {Object} FileUpload A reference to the instance of the class
|
|
87
106
|
* @chainable
|
|
88
107
|
*/
|
|
89
|
-
onChange(
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
108
|
+
onChange() {
|
|
109
|
+
// Classname of the list of files to upload
|
|
110
|
+
const fileListClass = `${this.prefix}--file-upload--list`;
|
|
111
|
+
|
|
112
|
+
// Find the fileList if it exsists
|
|
113
|
+
let fileList = this.formControl.querySelector(`.${fileListClass}`);
|
|
114
|
+
|
|
115
|
+
// Remove the fileList if it exists
|
|
116
|
+
if (fileList) {
|
|
117
|
+
fileList.remove();
|
|
94
118
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
fileList.classList.add(
|
|
119
|
+
|
|
120
|
+
// Create a new filelist and add it to the form control
|
|
121
|
+
fileList = document.createElement("ul");
|
|
122
|
+
fileList.classList.add(fileListClass);
|
|
123
|
+
this.formControl.appendChild(fileList);
|
|
124
|
+
|
|
125
|
+
// Add files to the filelist
|
|
99
126
|
let files = "";
|
|
100
|
-
[...
|
|
101
|
-
|
|
127
|
+
[...this.element.files].forEach((file) => {
|
|
128
|
+
const fileSize = this.formatBytes(file.size);
|
|
129
|
+
files += this.template(file.name, fileSize);
|
|
102
130
|
});
|
|
131
|
+
|
|
103
132
|
fileList.innerHTML = files;
|
|
104
|
-
newDiv.appendChild(fileList);
|
|
105
|
-
this.container.appendChild(newDiv);
|
|
106
133
|
|
|
107
134
|
return this;
|
|
108
135
|
}
|
|
@@ -111,9 +138,10 @@ export default class FileUpload {
|
|
|
111
138
|
* A template for outputting the list item markup
|
|
112
139
|
*
|
|
113
140
|
* @param {String} filename
|
|
141
|
+
* @param {String} filesize
|
|
114
142
|
* @return {String}
|
|
115
143
|
*/
|
|
116
|
-
template(filename) {
|
|
117
|
-
return `<li class="ilo--file-upload--list-item">${filename}</li>`;
|
|
144
|
+
template(filename, filesize) {
|
|
145
|
+
return `<li class="ilo--file-upload--list-item">${filename} (${filesize})</li>`;
|
|
118
146
|
}
|
|
119
147
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{# fileupload.twig #}
|
|
2
|
+
|
|
3
|
+
{% extends "@components/form/formcontrol.twig" %}
|
|
4
|
+
|
|
5
|
+
{% set baseClass = prefix ~ '--file-upload' %}
|
|
6
|
+
{% set fileUploadClasses = [baseClass] %}
|
|
7
|
+
{% set inputClass = baseClass ~ '--input' %}
|
|
8
|
+
|
|
9
|
+
{% if error %}
|
|
10
|
+
{% set fileUploadClasses = fileUploadClasses|merge(['error']) %}
|
|
11
|
+
{% endif %}
|
|
12
|
+
|
|
13
|
+
{% block formfield %}
|
|
14
|
+
<div class="{{ fileUploadClasses|join(' ') }}">
|
|
15
|
+
<label class="{{ inputClass }}">
|
|
16
|
+
{{ placeholder }}
|
|
17
|
+
<input id="{{ id|default(name) }}" name="{{ name }}" {% if disabled %} disabled {% endif %} {% if multiple %} multiple {% endif %} placeholder="{{ placeholder }}" {% if required %} required {% endif %} type="file" data-label="{{ placeholder }}" aria-describedby="{{ ariaDescribedBy }}" {% if accept %} accept="{{ accept }}" {% endif %} data-loadcomponent="FileUpload" data-prefix="{{prefix}}"/>
|
|
18
|
+
</label>
|
|
19
|
+
</div>
|
|
20
|
+
{% endblock %}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
fileupload:
|
|
2
|
+
namespace: Components/Forms
|
|
3
|
+
use: "@components/fileupload/fileupload.twig"
|
|
4
|
+
label: File Upload
|
|
5
|
+
description: The FileUpload component allows users to select and upload files
|
|
6
|
+
from their device to a web application. It displays a list of the
|
|
7
|
+
files to upload once they've been selected.
|
|
8
|
+
visibility: storybook
|
|
9
|
+
fields:
|
|
10
|
+
label:
|
|
11
|
+
type: text
|
|
12
|
+
label: Label
|
|
13
|
+
description: The label for the form element.
|
|
14
|
+
preview: Upload your files here
|
|
15
|
+
tooltip:
|
|
16
|
+
type: string
|
|
17
|
+
description: The tooltip for the form element.
|
|
18
|
+
helper:
|
|
19
|
+
type: text
|
|
20
|
+
label: Helper Text
|
|
21
|
+
description: The helper text for the form element.
|
|
22
|
+
preview: Max docs size 10MB
|
|
23
|
+
id:
|
|
24
|
+
type: text
|
|
25
|
+
label: ID
|
|
26
|
+
description: The ID of the text input.
|
|
27
|
+
name:
|
|
28
|
+
type: text
|
|
29
|
+
label: Name
|
|
30
|
+
description: The name of the text input.
|
|
31
|
+
placeholder:
|
|
32
|
+
type: text
|
|
33
|
+
label: Placeholder
|
|
34
|
+
description: The placeholder of the text input.
|
|
35
|
+
preview: Select files
|
|
36
|
+
class:
|
|
37
|
+
type: text
|
|
38
|
+
label: Class
|
|
39
|
+
description: The class of the text input.
|
|
40
|
+
preview: textinput
|
|
41
|
+
default: ""
|
|
42
|
+
accept:
|
|
43
|
+
type: text
|
|
44
|
+
label: Accept
|
|
45
|
+
description: The accept attribute of the text input.
|
|
46
|
+
preview: ".pdf,.doc, .docx, .jpg, .png"
|
|
47
|
+
settings:
|
|
48
|
+
labelPlacement:
|
|
49
|
+
type: select
|
|
50
|
+
label: Label Placement
|
|
51
|
+
description: The placement of the label for the form element.
|
|
52
|
+
preview: "top"
|
|
53
|
+
default: "top"
|
|
54
|
+
options:
|
|
55
|
+
start: start
|
|
56
|
+
end: end
|
|
57
|
+
top: top
|
|
58
|
+
bottom: bottom
|
|
59
|
+
labelSize:
|
|
60
|
+
type: select
|
|
61
|
+
label: Label Size
|
|
62
|
+
description: The size of the label for the form element.
|
|
63
|
+
preview: "medium"
|
|
64
|
+
default: "medium"
|
|
65
|
+
options:
|
|
66
|
+
small: small
|
|
67
|
+
medium: medium
|
|
68
|
+
large: large
|
|
69
|
+
multiple:
|
|
70
|
+
type: boolean
|
|
71
|
+
label: Multiple
|
|
72
|
+
description: If the user can select multiple files.
|
|
73
|
+
preview: false
|
|
74
|
+
options:
|
|
75
|
+
true: true
|
|
76
|
+
false: false
|
|
77
|
+
disabled:
|
|
78
|
+
type: boolean
|
|
79
|
+
label: Disabled
|
|
80
|
+
description: The disabled state of the text input.
|
|
81
|
+
preview: false
|
|
82
|
+
default: false
|
|
83
|
+
required:
|
|
84
|
+
type: boolean
|
|
85
|
+
label: Required
|
|
86
|
+
description: The required state of the text input.
|
|
87
|
+
preview: false
|
|
88
|
+
default: false
|
|
89
|
+
error:
|
|
90
|
+
type: boolean
|
|
91
|
+
label: Error
|
|
92
|
+
description: Adds an error state to the form control.
|
|
93
|
+
preview: false
|
|
94
|
+
default: false
|
|
@@ -52,10 +52,18 @@
|
|
|
52
52
|
{% include "@components/datepicker/datepicker.twig" with field|merge({ "prefix": prefix }) only %}
|
|
53
53
|
{% elseif field.type == "dropdown" %}
|
|
54
54
|
{% include "@components/dropdown/dropdown.twig" with field|merge({ "prefix": prefix }) only %}
|
|
55
|
-
{% elseif field.type == "
|
|
56
|
-
{% include "@components/
|
|
55
|
+
{% elseif field.type == "fileupload" %}
|
|
56
|
+
{% include "@components/fileupload/fileupload.twig" with field|merge({ "prefix": prefix }) only %}
|
|
57
|
+
{% elseif field.type == "numberpicker" %}
|
|
58
|
+
{% include "@components/numberpicker/numberpicker.twig" with field|merge({ "prefix": prefix }) only %}
|
|
59
|
+
{% elseif field.type == "radio" %}
|
|
60
|
+
{% include "@components/radio/radio.twig" with field|merge({ "prefix": prefix }) only %}
|
|
57
61
|
{% elseif field.type == "search" %}
|
|
58
62
|
{% include "@components/search/search.twig" with field|merge({ "prefix": prefix }) only %}
|
|
63
|
+
{% elseif field.type == "textarea" %}
|
|
64
|
+
{% include "@components/textarea/textarea.twig" with field|merge({ "prefix": prefix }) only %}
|
|
65
|
+
{% elseif field.type == "toggle" %}
|
|
66
|
+
{% include "@components/toggle/toggle.twig" with field|merge({ "prefix": prefix }) only %}
|
|
59
67
|
{% endif %}
|
|
60
68
|
{% endfor %}
|
|
61
69
|
</div>
|
|
@@ -89,8 +89,33 @@ form:
|
|
|
89
89
|
labelSize: small
|
|
90
90
|
class: my--formfield--class
|
|
91
91
|
value: 3
|
|
92
|
+
- legend: Which committee will you be attending?
|
|
93
|
+
direction: row
|
|
94
|
+
fields:
|
|
95
|
+
- type: radio
|
|
96
|
+
name: priority-1
|
|
97
|
+
label: Credentials committee
|
|
98
|
+
labelPlacement: end
|
|
99
|
+
labelSize: small
|
|
100
|
+
class: my--formfield--class
|
|
101
|
+
value: 1
|
|
102
|
+
- type: radio
|
|
103
|
+
name: priority-1
|
|
104
|
+
label: General Affairs Committee
|
|
105
|
+
labelPlacement: end
|
|
106
|
+
labelSize: small
|
|
107
|
+
class: my--formfield--class
|
|
108
|
+
value: 2
|
|
109
|
+
- type: radio
|
|
110
|
+
name: priority-1
|
|
111
|
+
label: Finance Committee
|
|
112
|
+
labelPlacement: end
|
|
113
|
+
labelSize: small
|
|
114
|
+
class: my--formfield--class
|
|
115
|
+
value: 3
|
|
92
116
|
- legend: Tell us more about you
|
|
93
117
|
direction: row
|
|
118
|
+
wrap: wrap
|
|
94
119
|
style: "width: 100%"
|
|
95
120
|
fields:
|
|
96
121
|
- type: dropdown
|
|
@@ -99,7 +124,7 @@ form:
|
|
|
99
124
|
labelPlacement: top
|
|
100
125
|
labelSize: small
|
|
101
126
|
class: my--formfield--class
|
|
102
|
-
style: "flex: 1
|
|
127
|
+
style: "flex: 1 0 250px"
|
|
103
128
|
options:
|
|
104
129
|
- label: Switzerland
|
|
105
130
|
value: CH
|
|
@@ -121,7 +146,7 @@ form:
|
|
|
121
146
|
labelPlacement: top
|
|
122
147
|
labelSize: small
|
|
123
148
|
class: my--formfield--class
|
|
124
|
-
style: "flex: 1
|
|
149
|
+
style: "flex: 1 0 250px"
|
|
125
150
|
options:
|
|
126
151
|
- label: Workers
|
|
127
152
|
value: 1
|
|
@@ -131,6 +156,13 @@ form:
|
|
|
131
156
|
value: 3
|
|
132
157
|
- label: Other
|
|
133
158
|
value: 4
|
|
159
|
+
- type: numberpicker
|
|
160
|
+
name: arrival-date
|
|
161
|
+
label: How many people are in your delegation?
|
|
162
|
+
labelPlacement: top
|
|
163
|
+
labelSize: small
|
|
164
|
+
class: my--formfield--class
|
|
165
|
+
style: "flex: 1 0 250px"
|
|
134
166
|
- legend: When will you be coming to the ILC?
|
|
135
167
|
direction: row
|
|
136
168
|
style: "width: 100%"
|
|
@@ -149,3 +181,25 @@ form:
|
|
|
149
181
|
labelSize: small
|
|
150
182
|
class: my--formfield--class
|
|
151
183
|
style: "flex: 1 1 49%"
|
|
184
|
+
- legend: Submit a copy of your passport
|
|
185
|
+
direction: row
|
|
186
|
+
style: "width: 100%"
|
|
187
|
+
fields:
|
|
188
|
+
- type: fileupload
|
|
189
|
+
name: arrival-date
|
|
190
|
+
label: PDF or JPG files up to 10MB
|
|
191
|
+
accept: ".pdf,.jpg"
|
|
192
|
+
placeholder: Select file
|
|
193
|
+
labelPlacement: end
|
|
194
|
+
labelSize: small
|
|
195
|
+
class: my--formfield--class
|
|
196
|
+
- direction: row
|
|
197
|
+
style: "width: 100%"
|
|
198
|
+
fields:
|
|
199
|
+
- type: textarea
|
|
200
|
+
name: comments
|
|
201
|
+
label: Do you have any questions or comments?
|
|
202
|
+
labelPlacement: top
|
|
203
|
+
labelSize: medium
|
|
204
|
+
class: my--formfield--class
|
|
205
|
+
style: "flex: 1 1 100%"
|
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
{# Initialize ariaDescribedBy #}
|
|
6
6
|
{% set ariaDescribedBy = [] %}
|
|
7
7
|
|
|
8
|
+
{# Initialize formControlClass #}
|
|
9
|
+
{% set formControlClass = formControlClass|default([]) %}
|
|
10
|
+
|
|
8
11
|
{# if not defined id will be set to the value of name or to a random number #}
|
|
9
12
|
{% if not id %}
|
|
10
13
|
{% if name %}
|
|
@@ -38,7 +41,7 @@
|
|
|
38
41
|
{% set errorClass = baseClass ~ "__error" %}
|
|
39
42
|
{% set disabledClass = baseClass ~ "__disabled" %}
|
|
40
43
|
{% set labelPlacementClass = baseClass ~ "__label-placement__" ~ labelPlacement|default("start") %}
|
|
41
|
-
{% set formControlClass = [baseClass, class, labelPlacementClass] %}
|
|
44
|
+
{% set formControlClass = formControlClass|merge([baseClass, class, labelPlacementClass]) %}
|
|
42
45
|
|
|
43
46
|
{% if error %}
|
|
44
47
|
{% set formControlClass = formControlClass|merge([errorClass]) %}
|
|
@@ -1,34 +1,37 @@
|
|
|
1
|
-
{#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
{# hero.twig #}
|
|
2
|
+
|
|
3
|
+
{% set theme = theme|default(herocard.theme) %}
|
|
4
|
+
{% set background = background|default(herocard.background) %}
|
|
5
|
+
|
|
6
|
+
<div class="hero hero__card-justify__{{ justify }} hero__poster-size__{{ postersize }} hero__card-size__{{ cardsize }} hero__card-align__{{ align }} hero__card-theme__{{ theme }} hero__card-background__{{ background }}">
|
|
7
|
+
<figure class="hero--figure">
|
|
8
|
+
{% block hero_image %}
|
|
9
|
+
{% if image %}
|
|
10
|
+
<picture>
|
|
11
|
+
{% for img in image.url|reverse %}
|
|
12
|
+
{% if loop.last == false %}
|
|
13
|
+
<source srcset="{{img.src}}" media="(min-width: {{img.breakpoint}}px)">
|
|
14
|
+
{% endif %}
|
|
15
|
+
{% endfor %}
|
|
16
|
+
<img class="{{prefix}}--card--image" src="{{image.url|reverse|last.src}}" alt="{{image.alt}}" {% if image.loading %} loading="{{ image.loading }}" {% endif %}>
|
|
17
|
+
</picture>
|
|
18
|
+
{% endif %}
|
|
19
|
+
{% endblock %}
|
|
20
|
+
</figure>
|
|
21
|
+
{% if breadcrumb %}
|
|
22
|
+
<div class="hero--breadcrumbs">
|
|
23
|
+
<div class="hero--breadcrumbs--wrapper">
|
|
24
|
+
{% include "@components/breadcrumb/breadcrumb.twig" with {
|
|
23
25
|
home: breadcrumb.home,
|
|
24
26
|
links: breadcrumb.links,
|
|
25
27
|
prefix: prefix,
|
|
26
28
|
} only %}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
{% endif %}
|
|
32
|
+
<div class="hero--card-offset"></div>
|
|
33
|
+
<div class="hero--card">
|
|
34
|
+
{% include "@components/herocard/herocard.twig" with {
|
|
32
35
|
url: herocard.url,
|
|
33
36
|
eyebrow: herocard.eyebrow,
|
|
34
37
|
cornercut: herocard.cornercut,
|
|
@@ -36,17 +39,23 @@
|
|
|
36
39
|
intro: herocard.intro,
|
|
37
40
|
prefix: prefix,
|
|
38
41
|
socialmedia: herocard.socialmedia,
|
|
39
|
-
theme:
|
|
40
|
-
background:
|
|
42
|
+
theme: theme,
|
|
43
|
+
background: background,
|
|
41
44
|
title: herocard.title,
|
|
42
45
|
} only %}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
</div>
|
|
47
|
+
<div class="hero--caption">
|
|
48
|
+
{% if not caption %}
|
|
49
|
+
{% else %}
|
|
50
|
+
<div class="hero--caption--wrapper">
|
|
51
|
+
{% include '@components/tooltip/tooltip.twig' with {
|
|
52
|
+
prefix: prefix,
|
|
53
|
+
label: caption.label,
|
|
54
|
+
icon: true,
|
|
55
|
+
theme: "dark",
|
|
56
|
+
icontheme: "dark"
|
|
57
|
+
} only %}
|
|
58
|
+
</div>
|
|
59
|
+
{% endif %}
|
|
60
|
+
</div>
|
|
52
61
|
</div>
|
|
@@ -35,6 +35,8 @@ hero:
|
|
|
35
35
|
url: "/linkfour"
|
|
36
36
|
- label: "Link Five"
|
|
37
37
|
url: "/linkfive"
|
|
38
|
+
- label: "Link Six"
|
|
39
|
+
url: "/linksix"
|
|
38
40
|
herocard:
|
|
39
41
|
label: Hero Card
|
|
40
42
|
type: object
|
|
@@ -62,8 +64,6 @@ hero:
|
|
|
62
64
|
description: The credit and caption information about the image. Appears as a tooltip.
|
|
63
65
|
preview:
|
|
64
66
|
label: A metalurgy worker at a manufacturing plant in Viet Nam. © ILO/Minh Quang
|
|
65
|
-
icon: "true"
|
|
66
|
-
theme: "dark"
|
|
67
67
|
settings:
|
|
68
68
|
justify:
|
|
69
69
|
label: Justify
|
|
@@ -104,6 +104,23 @@ hero:
|
|
|
104
104
|
xlarge: xlarge
|
|
105
105
|
xxlarge: xxlarge
|
|
106
106
|
preview: small
|
|
107
|
+
background:
|
|
108
|
+
type: select
|
|
109
|
+
label: Background
|
|
110
|
+
description: Should the background be solid, semi-transparent or transparent
|
|
111
|
+
options:
|
|
112
|
+
solid: solid
|
|
113
|
+
semi-transparent: semi-transparent
|
|
114
|
+
transparent: transparent
|
|
115
|
+
preview: "solid"
|
|
116
|
+
theme:
|
|
117
|
+
type: select
|
|
118
|
+
label: Theme
|
|
119
|
+
description: The theme of the hero card.
|
|
120
|
+
options:
|
|
121
|
+
light: light
|
|
122
|
+
dark: dark
|
|
123
|
+
preview: "dark"
|
|
107
124
|
variants:
|
|
108
125
|
default:
|
|
109
126
|
label: Default
|
|
@@ -153,6 +170,4 @@ hero:
|
|
|
153
170
|
icon: "linkedin"
|
|
154
171
|
caption:
|
|
155
172
|
label: A metalurgy worker at a manufacturing plant in Viet Nam. © ILO/Minh Quang
|
|
156
|
-
icon: "true"
|
|
157
|
-
theme: "dark"
|
|
158
173
|
visibility: storybook
|