@ilo-org/twig 0.10.5 → 0.11.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/.turbo/turbo-build:lib.log +2 -2
- package/CHANGELOG.md +23 -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 +38 -32
- package/src/patterns/components/hero/hero.wingsuit.yml +0 -4
- 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.0 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.0 output /home/runner/work/designsystem/designsystem/packages/twig
|
|
8
8
|
> node outputtwigs.js
|
|
9
9
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @ilo-org/twig
|
|
2
2
|
|
|
3
|
+
## 0.11.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 455e1b626: Add Radio as form element
|
|
8
|
+
- 41f933135: Adds File Upload as form element
|
|
9
|
+
- 4f439c1bf: Add Number Picker as form element
|
|
10
|
+
- b7e6cda36: Add TextArea as form element
|
|
11
|
+
- 2acffbd2e: Add Toggle as form element
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- bd5919f50: Setting formControlClass as a variable with the default value at the begining of the template.
|
|
16
|
+
- a43230b26: Add blocks to override with Drupal search block on the navigation.
|
|
17
|
+
- c86fa4f33: Fix tooltip icon appearing in the wrong color. This adds a new parameter `icontheme` for the tooltip, which defaults to light.
|
|
18
|
+
- 86b5b118a: Set name as default id for TextInput
|
|
19
|
+
- Updated dependencies [c3b0e6def]
|
|
20
|
+
- Updated dependencies [39ff32a91]
|
|
21
|
+
- Updated dependencies [0488bc66e]
|
|
22
|
+
- Updated dependencies [c86fa4f33]
|
|
23
|
+
- @ilo-org/styles@0.10.1
|
|
24
|
+
- @ilo-org/themes@0.5.1
|
|
25
|
+
|
|
3
26
|
## 0.10.5
|
|
4
27
|
|
|
5
28
|
### 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.0",
|
|
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.5.
|
|
28
|
+
"@ilo-org/styles": "0.10.1",
|
|
29
|
+
"@ilo-org/themes": "0.5.1",
|
|
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]) %}
|
|
@@ -2,33 +2,33 @@
|
|
|
2
2
|
Hero COMPONENT
|
|
3
3
|
#}
|
|
4
4
|
<div class="hero hero__card-justify__{{ justify }} hero__poster-size__{{ postersize }} hero__card-size__{{ cardsize }} hero__card-align__{{ align }}">
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
5
|
+
<figure class="hero--figure">
|
|
6
|
+
{% block hero_image %}
|
|
7
|
+
{% if image %}
|
|
8
|
+
<picture>
|
|
9
|
+
{% for img in image.url|reverse %}
|
|
10
|
+
{% if loop.last == false %}
|
|
11
|
+
<source srcset="{{img.src}}" media="(min-width: {{img.breakpoint}}px)">
|
|
12
|
+
{% endif %}
|
|
13
|
+
{% endfor %}
|
|
14
|
+
<img class="{{prefix}}--card--image" src="{{image.url|reverse|last.src}}" alt="{{image.alt}}" {% if image.loading %} loading="{{ image.loading }}" {% endif %}>
|
|
15
|
+
</picture>
|
|
16
|
+
{% endif %}
|
|
17
|
+
{% endblock %}
|
|
18
|
+
</figure>
|
|
19
|
+
{% if breadcrumb %}
|
|
20
|
+
<div class="hero--breadcrumbs">
|
|
21
|
+
<div class="hero--breadcrumbs--wrapper">
|
|
22
|
+
{% include "@components/breadcrumb/breadcrumb.twig" with {
|
|
23
23
|
home: breadcrumb.home,
|
|
24
24
|
links: breadcrumb.links,
|
|
25
25
|
prefix: prefix,
|
|
26
26
|
} only %}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
{% endif %}
|
|
30
|
+
<div class="hero--card">
|
|
31
|
+
{% include "@components/herocard/herocard.twig" with {
|
|
32
32
|
url: herocard.url,
|
|
33
33
|
eyebrow: herocard.eyebrow,
|
|
34
34
|
cornercut: herocard.cornercut,
|
|
@@ -40,13 +40,19 @@
|
|
|
40
40
|
background: herocard.background,
|
|
41
41
|
title: herocard.title,
|
|
42
42
|
} only %}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
43
|
+
</div>
|
|
44
|
+
<div class="hero--caption">
|
|
45
|
+
{% if not caption %}
|
|
46
|
+
{% else %}
|
|
47
|
+
<div class="hero--caption--wrapper">
|
|
48
|
+
{% include '@components/tooltip/tooltip.twig' with {
|
|
49
|
+
prefix: prefix,
|
|
50
|
+
label: caption.label,
|
|
51
|
+
icon: true,
|
|
52
|
+
theme: "dark",
|
|
53
|
+
icontheme: "dark"
|
|
54
|
+
} only %}
|
|
55
|
+
</div>
|
|
56
|
+
{% endif %}
|
|
57
|
+
</div>
|
|
52
58
|
</div>
|
|
@@ -62,8 +62,6 @@ hero:
|
|
|
62
62
|
description: The credit and caption information about the image. Appears as a tooltip.
|
|
63
63
|
preview:
|
|
64
64
|
label: A metalurgy worker at a manufacturing plant in Viet Nam. © ILO/Minh Quang
|
|
65
|
-
icon: "true"
|
|
66
|
-
theme: "dark"
|
|
67
65
|
settings:
|
|
68
66
|
justify:
|
|
69
67
|
label: Justify
|
|
@@ -153,6 +151,4 @@ hero:
|
|
|
153
151
|
icon: "linkedin"
|
|
154
152
|
caption:
|
|
155
153
|
label: A metalurgy worker at a manufacturing plant in Viet Nam. © ILO/Minh Quang
|
|
156
|
-
icon: "true"
|
|
157
|
-
theme: "dark"
|
|
158
154
|
visibility: storybook
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
</div>
|
|
48
48
|
<!-- /.{{prefix}}--mobile--logo -->
|
|
49
49
|
<div class="{{prefix}}--mobile--nav--search">
|
|
50
|
+
{% block mobileSearch %}
|
|
50
51
|
{% include '@components/form/form.twig' with {
|
|
51
52
|
attributes: {
|
|
52
53
|
action: searchfield.action,
|
|
@@ -63,6 +64,7 @@
|
|
|
63
64
|
}]
|
|
64
65
|
}
|
|
65
66
|
%}
|
|
67
|
+
{% endblock %}
|
|
66
68
|
</div>
|
|
67
69
|
<!-- /.{{prefix}}--mobile--search -->
|
|
68
70
|
|
|
@@ -137,6 +139,7 @@
|
|
|
137
139
|
|
|
138
140
|
<div class="{{prefix}}--search-box">
|
|
139
141
|
<div class="{{prefix}}--header--inner {{ prefix }}--container">
|
|
142
|
+
{% block desktopSearch %}
|
|
140
143
|
{% include '@components/form/form.twig' with {
|
|
141
144
|
attributes: {
|
|
142
145
|
action: searchfield.action,
|
|
@@ -153,6 +156,7 @@
|
|
|
153
156
|
}]
|
|
154
157
|
}
|
|
155
158
|
%}
|
|
159
|
+
{% endblock %}
|
|
156
160
|
</div>
|
|
157
161
|
</div>
|
|
158
162
|
<!-- /.{{prefix}}--search-box -->
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{# numberpicker.twig #}
|
|
2
|
+
|
|
3
|
+
{% extends "@components/form/formcontrol.twig" %}
|
|
4
|
+
|
|
5
|
+
{% set inputClass = prefix ~ '--input' %}
|
|
6
|
+
{% set baseClass = prefix ~ '--numberpicker' %}
|
|
7
|
+
{% set hasError = not disabled and error %}
|
|
8
|
+
{% set numberPickerClasses = [inputClass, baseClass] %}
|
|
9
|
+
|
|
10
|
+
{% if hasError %}
|
|
11
|
+
{% set numberPickerClasses = numberPickerClasses|merge(['error']) %}
|
|
12
|
+
{% endif %}
|
|
13
|
+
|
|
14
|
+
{% block formfield %}
|
|
15
|
+
<input id="{{ id|default(name) }}" name="{{ name }}" {% if disabled %} disabled {% endif %} placeholder="{{ placeholder }}" {% if required %} required {% endif %} type="number" class="{{ numberPickerClasses|join(' ') }}" pattern="[0-9]*" inputmode="numeric" aria-describedby="{{ ariaDescribedBy }}" {% if max is defined %} max="{{ max }}" {% endif %} {% if min is defined %} min="{{ min }}" {% endif %} {% if step is defined %} step="{{ step }}" {% endif %}/>
|
|
16
|
+
{% endblock %}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
numberpicker:
|
|
2
|
+
namespace: Components/Forms
|
|
3
|
+
use: "@components/numberpicker/numberpicker.twig"
|
|
4
|
+
label: Number Picker
|
|
5
|
+
description: The Number Picker component is used to select a number from a range.
|
|
6
|
+
visibility: storybook
|
|
7
|
+
fields:
|
|
8
|
+
label:
|
|
9
|
+
type: text
|
|
10
|
+
label: Label
|
|
11
|
+
description: The label for the form element.
|
|
12
|
+
preview: "Pick a number"
|
|
13
|
+
tooltip:
|
|
14
|
+
type: string
|
|
15
|
+
description: The tooltip for the form element.
|
|
16
|
+
helper:
|
|
17
|
+
type: text
|
|
18
|
+
label: Helper Text
|
|
19
|
+
description: The helper text for the form element.
|
|
20
|
+
id:
|
|
21
|
+
type: text
|
|
22
|
+
label: ID
|
|
23
|
+
description: The ID of the input.
|
|
24
|
+
name:
|
|
25
|
+
type: text
|
|
26
|
+
label: Name
|
|
27
|
+
description: The name of the input.
|
|
28
|
+
class:
|
|
29
|
+
type: text
|
|
30
|
+
label: Class
|
|
31
|
+
description: The class of the form field.
|
|
32
|
+
preview: checkbox
|
|
33
|
+
default: ""
|
|
34
|
+
placeholder:
|
|
35
|
+
type: text
|
|
36
|
+
label: Placeholder
|
|
37
|
+
description: The placeholder of the form field.
|
|
38
|
+
preview: "0 - 100"
|
|
39
|
+
min:
|
|
40
|
+
type: number
|
|
41
|
+
label: Min
|
|
42
|
+
description: The minimum value of the form field.
|
|
43
|
+
preview: 0
|
|
44
|
+
max:
|
|
45
|
+
type: number
|
|
46
|
+
label: Max
|
|
47
|
+
description: The maximum value of the form field.
|
|
48
|
+
preview: 100
|
|
49
|
+
step:
|
|
50
|
+
type: number
|
|
51
|
+
label: Step
|
|
52
|
+
description: The step value of the form field.
|
|
53
|
+
preview: 1
|
|
54
|
+
settings:
|
|
55
|
+
labelPlacement:
|
|
56
|
+
type: select
|
|
57
|
+
label: Label Placement
|
|
58
|
+
description: The placement of the label for the form element.
|
|
59
|
+
preview: "top"
|
|
60
|
+
options:
|
|
61
|
+
start: start
|
|
62
|
+
end: end
|
|
63
|
+
top: top
|
|
64
|
+
bottom: bottom
|
|
65
|
+
labelSize:
|
|
66
|
+
type: select
|
|
67
|
+
label: Label Size
|
|
68
|
+
description: The size of the label for the form element.
|
|
69
|
+
preview: medium
|
|
70
|
+
options:
|
|
71
|
+
small: small
|
|
72
|
+
medium: medium
|
|
73
|
+
large: large
|
|
74
|
+
disabled:
|
|
75
|
+
type: boolean
|
|
76
|
+
label: Disabled
|
|
77
|
+
description: The disabled state of the form element.
|
|
78
|
+
preview: false
|
|
79
|
+
default: false
|
|
80
|
+
required:
|
|
81
|
+
type: boolean
|
|
82
|
+
label: Required
|
|
83
|
+
description: The required state of the form element.
|
|
84
|
+
preview: false
|
|
85
|
+
default: false
|
|
86
|
+
error:
|
|
87
|
+
type: boolean
|
|
88
|
+
label: Error
|
|
89
|
+
description: Adds an error state to the form control.
|
|
90
|
+
preview: false
|
|
91
|
+
default: false
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{# checkbox.twig #}
|
|
2
|
+
|
|
3
|
+
{% extends "@components/form/formcontrol.twig" %}
|
|
4
|
+
|
|
5
|
+
{% set baseClass = (prefix is defined ? prefix ~ "--radio" : "--radio") %}
|
|
6
|
+
{% set controlClass = baseClass ~ "--control" %}
|
|
7
|
+
|
|
8
|
+
{% set errorClass = baseClass ~ "__error" %}
|
|
9
|
+
|
|
10
|
+
{% set radioClasses = [baseClass, class] %}
|
|
11
|
+
|
|
12
|
+
{% if error is defined and error %}
|
|
13
|
+
{% set radioClasses = radioClasses|merge([errorClass]) %}
|
|
14
|
+
{% endif %}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
{% block formfield %}
|
|
18
|
+
<div class="{{ radioClasses|join(" ") }}">
|
|
19
|
+
<input id="{{ id is defined ? id : name }}" name="{{ name }}" type="radio" {% if defaultChecked is defined and defaultChecked %} defaultchecked {% endif %} {% if checked is defined and checked %} checked {% endif %} {% if ariaDescribedBy is defined %} aria-describedby="{{ ariaDescribedBy }}" {% endif %} {% if checked is defined and checked %} checked {% endif %} value="{{ value }}" {% if disabled is defined and disabled %} disabled {% endif %} {% if required is defined and required %} required {% endif %}/>
|
|
20
|
+
<span class="{{ controlClass }}"></span>
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
{% endblock %}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
checkbox:
|
|
2
|
+
namespace: Components/Forms
|
|
3
|
+
use: "@components/radio/radio.twig"
|
|
4
|
+
label: Radio
|
|
5
|
+
description: The Radio component provides users with a switch they can use to
|
|
6
|
+
turn a single option on or off or alternate between multiple
|
|
7
|
+
different states.
|
|
8
|
+
visibility: storybook
|
|
9
|
+
fields:
|
|
10
|
+
label:
|
|
11
|
+
type: text
|
|
12
|
+
label: Label
|
|
13
|
+
description: The label for the form element.
|
|
14
|
+
preview: "Do you agree to these terms?"
|
|
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
|
+
id:
|
|
23
|
+
type: text
|
|
24
|
+
label: ID
|
|
25
|
+
description: The ID of the input.
|
|
26
|
+
name:
|
|
27
|
+
type: text
|
|
28
|
+
label: Name
|
|
29
|
+
description: The name of the input.
|
|
30
|
+
class:
|
|
31
|
+
type: text
|
|
32
|
+
label: Class
|
|
33
|
+
description: The class of the form field.
|
|
34
|
+
preview: radio
|
|
35
|
+
default: ""
|
|
36
|
+
value:
|
|
37
|
+
type: text
|
|
38
|
+
label: Value
|
|
39
|
+
description: The value of the input.
|
|
40
|
+
preview: "1"
|
|
41
|
+
settings:
|
|
42
|
+
defaultSelected:
|
|
43
|
+
type: boolean
|
|
44
|
+
label: Default Selected
|
|
45
|
+
description: The default selected state of the form element.
|
|
46
|
+
preview: false
|
|
47
|
+
labelPlacement:
|
|
48
|
+
type: select
|
|
49
|
+
label: Label Placement
|
|
50
|
+
description: The placement of the label for the form element.
|
|
51
|
+
preview: "end"
|
|
52
|
+
options:
|
|
53
|
+
start: start
|
|
54
|
+
end: end
|
|
55
|
+
top: top
|
|
56
|
+
bottom: bottom
|
|
57
|
+
labelSize:
|
|
58
|
+
type: select
|
|
59
|
+
label: Label Size
|
|
60
|
+
description: The size of the label for the form element.
|
|
61
|
+
preview: "small"
|
|
62
|
+
options:
|
|
63
|
+
small: small
|
|
64
|
+
medium: medium
|
|
65
|
+
large: large
|
|
66
|
+
disabled:
|
|
67
|
+
type: boolean
|
|
68
|
+
label: Disabled
|
|
69
|
+
description: The disabled state of the form element.
|
|
70
|
+
preview: false
|
|
71
|
+
default: false
|
|
72
|
+
required:
|
|
73
|
+
type: boolean
|
|
74
|
+
label: Required
|
|
75
|
+
description: The required state of the form element.
|
|
76
|
+
preview: false
|
|
77
|
+
default: false
|
|
78
|
+
error:
|
|
79
|
+
type: boolean
|
|
80
|
+
label: Error
|
|
81
|
+
description: Adds an error state to the form control.
|
|
82
|
+
preview: false
|
|
83
|
+
default: false
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{# textarea.twig #}
|
|
2
|
+
|
|
3
|
+
{% extends "@components/form/formcontrol.twig" %}
|
|
4
|
+
|
|
5
|
+
{% set baseClass = prefix ~ '--textarea' %}
|
|
6
|
+
{% set textAreaClass = [baseClass] %}
|
|
7
|
+
{% if error %}
|
|
8
|
+
{% set textAreaClass = textAreaClass|merge([baseClass ~ "__error"]) %}
|
|
9
|
+
{% endif %}
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
{% block formfield %}
|
|
13
|
+
<textarea class="{{ textAreaClass|join(' ') }}" name="{{ name }}" id="{{ id|default(name) }}" aria-describedby="{{ ariaDescribedBy }}" {% if disabled %} disabled {% endif %} {% if required %} required {% endif %} {% if placeholder %} placeholder="{{ placeholder }}" {% endif %} {% if form %} form="{{ form }}" {% endif %} {% if maxlength %} maxlength="{{ maxlength }}" {% endif %} {% if minlength %} minlength="{{ minlength }}" {% endif %} {% if spellcheck %} spellcheck="{{ spellcheck }}" {% endif %} {% if wrap %} wrap="{{ wrap }}" {% endif %}>{{ value|default('') }}</textarea>
|
|
14
|
+
{% endblock %}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
textarea:
|
|
2
|
+
namespace: Components/Forms
|
|
3
|
+
use: "@components/textarea/textarea.twig"
|
|
4
|
+
label: Text Area
|
|
5
|
+
description: The TextArea component allows users to enter multi-line text. It's used to capture free-form text, such as a comment or a description.
|
|
6
|
+
visibility: storybook
|
|
7
|
+
fields:
|
|
8
|
+
label:
|
|
9
|
+
type: text
|
|
10
|
+
label: Label
|
|
11
|
+
description: The label for the form element.
|
|
12
|
+
preview: "Insert your name here"
|
|
13
|
+
tooltip:
|
|
14
|
+
type: string
|
|
15
|
+
description: The tooltip for the form element.
|
|
16
|
+
preview: "This is a tooltip"
|
|
17
|
+
helper:
|
|
18
|
+
type: text
|
|
19
|
+
label: Helper Text
|
|
20
|
+
description: The helper text for the form element.
|
|
21
|
+
preview: "Enter first name and last name"
|
|
22
|
+
id:
|
|
23
|
+
type: text
|
|
24
|
+
label: ID
|
|
25
|
+
description: The ID of the text area.
|
|
26
|
+
name:
|
|
27
|
+
type: text
|
|
28
|
+
label: Name
|
|
29
|
+
description: The name of the text area.
|
|
30
|
+
placeholder:
|
|
31
|
+
type: text
|
|
32
|
+
label: Placeholder
|
|
33
|
+
description: The placeholder of the text area.
|
|
34
|
+
preview: Enter your life story here
|
|
35
|
+
default: ""
|
|
36
|
+
class:
|
|
37
|
+
type: text
|
|
38
|
+
label: Class
|
|
39
|
+
description: The class of the text area.
|
|
40
|
+
preview: textinput
|
|
41
|
+
default: ""
|
|
42
|
+
pattern:
|
|
43
|
+
type: text
|
|
44
|
+
label: Pattern
|
|
45
|
+
description: The pattern of the text area.
|
|
46
|
+
preview: textinput``
|
|
47
|
+
default: ""
|
|
48
|
+
form:
|
|
49
|
+
type: text
|
|
50
|
+
label: Form
|
|
51
|
+
description: The form of the text area if it's not nested in a form element.
|
|
52
|
+
preview: textinput
|
|
53
|
+
default: ""
|
|
54
|
+
maxlength:
|
|
55
|
+
type: number
|
|
56
|
+
label: Max Length
|
|
57
|
+
description: The maximum length of the text area.
|
|
58
|
+
preview: 100
|
|
59
|
+
minlength:
|
|
60
|
+
type: number
|
|
61
|
+
label: Min Length
|
|
62
|
+
description: The minimum length of the text area.
|
|
63
|
+
preview: 0
|
|
64
|
+
style:
|
|
65
|
+
type: text
|
|
66
|
+
label: Style
|
|
67
|
+
description: The style of the text area.
|
|
68
|
+
preview: "width: 100%;"
|
|
69
|
+
settings:
|
|
70
|
+
labelPlacement:
|
|
71
|
+
type: select
|
|
72
|
+
label: Label Placement
|
|
73
|
+
description: The placement of the label for the form element.
|
|
74
|
+
preview: "top"
|
|
75
|
+
default: "top"
|
|
76
|
+
options:
|
|
77
|
+
start: start
|
|
78
|
+
end: end
|
|
79
|
+
top: top
|
|
80
|
+
bottom: bottom
|
|
81
|
+
labelSize:
|
|
82
|
+
type: select
|
|
83
|
+
label: Label Size
|
|
84
|
+
description: The size of the label for the form element.
|
|
85
|
+
preview: "medium"
|
|
86
|
+
default: "medium"
|
|
87
|
+
options:
|
|
88
|
+
small: small
|
|
89
|
+
medium: medium
|
|
90
|
+
large: large
|
|
91
|
+
disabled:
|
|
92
|
+
type: boolean
|
|
93
|
+
label: Disabled
|
|
94
|
+
description: The disabled state of the text area.
|
|
95
|
+
preview: false
|
|
96
|
+
default: false
|
|
97
|
+
required:
|
|
98
|
+
type: boolean
|
|
99
|
+
label: Required
|
|
100
|
+
description: The required state of the text area.
|
|
101
|
+
preview: false
|
|
102
|
+
default: false
|
|
103
|
+
error:
|
|
104
|
+
type: boolean
|
|
105
|
+
label: Error
|
|
106
|
+
description: Adds an error state to the form control.
|
|
107
|
+
preview: false
|
|
108
|
+
default: false
|
|
109
|
+
spellcheck:
|
|
110
|
+
type: select
|
|
111
|
+
label: Spellcheck
|
|
112
|
+
description: The spellcheck state of the text area.
|
|
113
|
+
options:
|
|
114
|
+
true: true
|
|
115
|
+
false: false
|
|
116
|
+
default: default
|
|
117
|
+
preview: default
|
|
118
|
+
wrap:
|
|
119
|
+
type: select
|
|
120
|
+
label: Wrap
|
|
121
|
+
description: The wrap state of the text area.
|
|
122
|
+
options:
|
|
123
|
+
hard: hard
|
|
124
|
+
soft: soft
|
|
125
|
+
off: off
|
|
126
|
+
preview: off
|
|
@@ -9,5 +9,6 @@
|
|
|
9
9
|
{% endif %}
|
|
10
10
|
|
|
11
11
|
{% block formfield %}
|
|
12
|
-
<input id="{{ id }}" name="{{ name }}" type="{{ type|default("text") }}" class="{{ inputClass|join(" ") }}" {% if placeholder %} placeholder="{{ placeholder }}" {% endif %} {% if disabled %} disabled {% endif %} {% if required %} required {% endif %} {% if pattern %} pattern="{{ pattern }}" {% endif %} {% if ariaDescribedBy %} aria-describedby="{{ ariaDescribedBy }}" {% endif %}/>
|
|
12
|
+
<input id="{{ id|default(name) }}" name="{{ name }}" type="{{ type|default("text") }}" class="{{ inputClass|join(" ") }}" {% if placeholder %} placeholder="{{ placeholder }}" {% endif %} {% if disabled %} disabled {% endif %} {% if required %} required {% endif %} {% if pattern %} pattern="{{ pattern }}" {% endif %} {% if ariaDescribedBy %} aria-describedby="{{ ariaDescribedBy }}" {% endif %}/>
|
|
13
|
+
|
|
13
14
|
{% endblock %}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{# toggle.twig #}
|
|
2
|
+
|
|
3
|
+
{% extends "@components/form/formcontrol.twig" %}
|
|
4
|
+
|
|
5
|
+
{# Define the default values, these values can be overridden when the template is included or extended. #}
|
|
6
|
+
{% set size = size|default("medium") %}
|
|
7
|
+
{% set error = error|default(false) %}
|
|
8
|
+
{% set disabled = disabled|default(false) %}
|
|
9
|
+
{% set defaultChecked = defaultChecked|default(false) %}
|
|
10
|
+
{% set required = required|default(false) %}
|
|
11
|
+
{% set name = name|default("toggle") %}
|
|
12
|
+
{% set id = id|default(name) %}
|
|
13
|
+
{% set ariaDescribedBy = ariaDescribedBy|default("") %}
|
|
14
|
+
|
|
15
|
+
{# Calculate dynamic classes based on the passed values. #}
|
|
16
|
+
{% set baseClass = prefix ~ "--input--toggle" %}
|
|
17
|
+
{% set sliderClass = baseClass ~ "--slider" %}
|
|
18
|
+
{% set toggleClass = [baseClass, class, baseClass ~ "__size__" ~ size] %}
|
|
19
|
+
|
|
20
|
+
{% if not disabled and error %}
|
|
21
|
+
{% set toggleClass = toggleClass|merge([baseClass ~ "__error"]) %}
|
|
22
|
+
{% endif %}
|
|
23
|
+
{% if disabled %}
|
|
24
|
+
{% set toggleClass = toggleClass|merge([baseClass ~ "__disabled"]) %}
|
|
25
|
+
{% endif %}
|
|
26
|
+
|
|
27
|
+
{% block formfield %}
|
|
28
|
+
|
|
29
|
+
<div class="{{ toggleClass|join(" ") }}">
|
|
30
|
+
<input {% if defaultchecked %} defaultchecked {% endif %} {% if required %} required {% endif %} {% if checked %} checked {% endif %} name="{{ name }}" id="{{ id }}" type="checkbox" role="switch" aria-describedby="{{ ariaDescribedBy }}"/>
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
<span class="{{ sliderClass }}"/>
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
{% endblock %}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
toggle:
|
|
2
|
+
namespace: Components/Forms
|
|
3
|
+
use: "@components/toggle/toggle.twig"
|
|
4
|
+
label: Toggle
|
|
5
|
+
description: The toggle component provides users with a switch they can use to
|
|
6
|
+
turn a single option on or off or alternate between two different
|
|
7
|
+
states.
|
|
8
|
+
visibility: storybook
|
|
9
|
+
fields:
|
|
10
|
+
label:
|
|
11
|
+
type: text
|
|
12
|
+
label: Label
|
|
13
|
+
description: The label for the form element.
|
|
14
|
+
preview: Accept cookies
|
|
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
|
+
id:
|
|
23
|
+
type: text
|
|
24
|
+
label: ID
|
|
25
|
+
description: The ID of the text input.
|
|
26
|
+
name:
|
|
27
|
+
type: text
|
|
28
|
+
label: Name
|
|
29
|
+
description: The name of the text input.
|
|
30
|
+
class:
|
|
31
|
+
type: text
|
|
32
|
+
label: Class
|
|
33
|
+
description: The class of the text input.
|
|
34
|
+
preview: textinput
|
|
35
|
+
default: ""
|
|
36
|
+
settings:
|
|
37
|
+
labelPlacement:
|
|
38
|
+
type: select
|
|
39
|
+
label: Label Placement
|
|
40
|
+
description: The placement of the label for the form element.
|
|
41
|
+
preview: end
|
|
42
|
+
options:
|
|
43
|
+
start: start
|
|
44
|
+
end: end
|
|
45
|
+
top: top
|
|
46
|
+
bottom: bottom
|
|
47
|
+
labelSize:
|
|
48
|
+
type: select
|
|
49
|
+
label: Label Size
|
|
50
|
+
description: The size of the label for the form element.
|
|
51
|
+
preview: small
|
|
52
|
+
options:
|
|
53
|
+
small: small
|
|
54
|
+
medium: medium
|
|
55
|
+
large: large
|
|
56
|
+
defaultchecked:
|
|
57
|
+
type: boolean
|
|
58
|
+
label: Default Checked
|
|
59
|
+
description: The default checked state of the text input.
|
|
60
|
+
preview: false
|
|
61
|
+
default: false
|
|
62
|
+
checked:
|
|
63
|
+
type: boolean
|
|
64
|
+
label: Checked
|
|
65
|
+
description: The checked state of the text input.
|
|
66
|
+
preview: false
|
|
67
|
+
default: false
|
|
68
|
+
disabled:
|
|
69
|
+
type: boolean
|
|
70
|
+
label: Disabled
|
|
71
|
+
description: The disabled state of the text input.
|
|
72
|
+
preview: false
|
|
73
|
+
default: false
|
|
74
|
+
required:
|
|
75
|
+
type: boolean
|
|
76
|
+
label: Required
|
|
77
|
+
description: The required state of the text input.
|
|
78
|
+
preview: false
|
|
79
|
+
default: false
|
|
80
|
+
error:
|
|
81
|
+
type: boolean
|
|
82
|
+
label: Error
|
|
83
|
+
description: Adds an error state to the form control.
|
|
84
|
+
preview: false
|
|
85
|
+
default: false
|
|
86
|
+
size:
|
|
87
|
+
type: select
|
|
88
|
+
label: Size
|
|
89
|
+
description: The size of the toggle.
|
|
90
|
+
preview: medium
|
|
91
|
+
options:
|
|
92
|
+
small: small
|
|
93
|
+
medium: medium
|
|
94
|
+
large: large
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
{#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
{# tooltip.twig #}
|
|
2
|
+
|
|
3
|
+
{% set icontheme = icontheme|default("light") %}
|
|
4
|
+
{% set theme = theme|default("dark") %}
|
|
5
|
+
|
|
6
|
+
<div class="{{prefix}}--tooltip--wrapper {% if icon %} {{prefix}}--tooltip--wrapper__icon {{prefix}}--tooltip--wrapper__icon__theme__{{icontheme}} {% endif %}" role="status" aria-live="polite" aria-relevant="additions" data-loadcomponent="Tooltip" data-prefix="{{prefix}}">
|
|
7
|
+
{% if not icon or icon == "false" %}
|
|
6
8
|
{{ children|raw }}
|
|
7
9
|
{% endif %}
|
|
8
10
|
<span class="{{prefix}}--tooltip {{prefix}}--tooltip--{{theme}}" data-alignment="left" id={{tooltipId}}>
|
|
@@ -32,6 +32,15 @@ tooltip:
|
|
|
32
32
|
false: false
|
|
33
33
|
preview: "true"
|
|
34
34
|
required: true
|
|
35
|
+
icontheme:
|
|
36
|
+
type: select
|
|
37
|
+
label: Icon Theme
|
|
38
|
+
description: Use dark for dark backgrounds, light for light backgrounds
|
|
39
|
+
options:
|
|
40
|
+
light: light
|
|
41
|
+
dark: dark
|
|
42
|
+
preview: light
|
|
43
|
+
required: true
|
|
35
44
|
theme:
|
|
36
45
|
type: select
|
|
37
46
|
label: Theme
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{#
|
|
2
|
-
FILE UPLOAD COMPONENT
|
|
3
|
-
#}
|
|
4
|
-
{% extends '@components/fieldset/fieldset.twig' %}
|
|
5
|
-
{% set fsinputid = id ? id : name %}
|
|
6
|
-
{% set fslabel = label %}
|
|
7
|
-
{% set fshelper = helper %}
|
|
8
|
-
{% set fserror = error %}
|
|
9
|
-
{% set fstype = "file" %}
|
|
10
|
-
{% set fsclass = "file-upload" %}
|
|
11
|
-
|
|
12
|
-
{% block formfield %}
|
|
13
|
-
<input name="{{name}}" type="file" class="{{prefix}}--file-upload {% if error %} error{% endif %}" {% if placeholder %}placeholder="{{placeholder}}"{% endif %} {% if disabled %}disabled{% endif %} {% if required %}required{% endif %} id="{% if id %}{{id}}{% else %}{{name}}{% endif %}" data-label="{{label}}" data-loadcomponent="FileUpload" />
|
|
14
|
-
{% endblock %}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
{#
|
|
2
|
-
NUMBER COMPONENT
|
|
3
|
-
#}
|
|
4
|
-
{% extends '@components/fieldset/fieldset.twig' %}
|
|
5
|
-
{% set fsinputid = id ? id : name %}
|
|
6
|
-
{% set fslabel = label %}
|
|
7
|
-
{% set fshelper = helper %}
|
|
8
|
-
{% set fserror = error %}
|
|
9
|
-
{% set fstype = "number" %}
|
|
10
|
-
|
|
11
|
-
{% block formfield %}
|
|
12
|
-
<input name="{{name}}" type="text" class="{{prefix}}--numberpicker {{prefix}}--input{% if error %} error{% endif %}" {% if placeholder %}placeholder="{{placeholder}}"{% endif %} {% if required %}required{% endif %} {% if disabled %}disabled{% endif %} id="{% if id %}{{id}}{% else %}{{name}}{% endif %}" pattern="[0-9]*" inputmode="numeric" />
|
|
13
|
-
{% endblock %}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
{#
|
|
2
|
-
TEXTAREA COMPONENT
|
|
3
|
-
#}
|
|
4
|
-
{% extends '@components/fieldset/fieldset.twig' %}
|
|
5
|
-
{% set fsinputid = id ? id : name %}
|
|
6
|
-
{% set fslabel = label %}
|
|
7
|
-
{% set fshelper = helper %}
|
|
8
|
-
{% set fserror = error %}
|
|
9
|
-
{% set fstype = "textarea" %}
|
|
10
|
-
|
|
11
|
-
{% block formfield %}
|
|
12
|
-
<textarea name="textarea" {% if placeholder %}placeholder="{{placeholder}}"{% endif %} {% if required %}required{% endif %} {% if disabled %}disabled{% endif %} class="{{prefix}}--textarea" id="{% if id %}{{id}}{% else %}{{name}}{% endif %}" spellcheck="false"></textarea>
|
|
13
|
-
{% endblock %}
|