@ilo-org/twig 0.9.5 → 0.10.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 +20 -0
- package/package.json +3 -3
- package/src/patterns/components/accordion/accordion.wingsuit.yml +1 -0
- package/src/patterns/components/breadcrumb/breadcrumb.wingsuit.yml +1 -0
- package/src/patterns/components/button/button.wingsuit.yml +1 -0
- package/src/patterns/components/callout/callout.wingsuit.yml +1 -0
- package/src/patterns/components/card/card.wingsuit.yml +14 -13
- package/src/patterns/components/card_data/card_data.wingsuit.yml +3 -7
- package/src/patterns/components/card_detail/card_detail.wingsuit.yml +1 -3
- package/src/patterns/components/card_factlist/card_factlist.wingsuit.yml +1 -4
- package/src/patterns/components/card_feature/card_feature.wingsuit.yml +1 -3
- package/src/patterns/components/card_multilink/card_multilink.wingsuit.yml +7 -9
- package/src/patterns/components/card_promo/card_promo.wingsuit.yml +1 -3
- package/src/patterns/components/card_stat/card_stat.wingsuit.yml +1 -5
- package/src/patterns/components/card_text/card_text.wingsuit.yml +4 -6
- package/src/patterns/components/cardgroup/cardgroup.wingsuit.yml +1 -4
- package/src/patterns/components/{searchfield/searchfield.stories.jsx → checkbox/checkbox.stories.jsx} +1 -1
- package/src/patterns/components/checkbox/checkbox.twig +17 -0
- package/src/patterns/components/checkbox/checkbox.wingsuit.yml +83 -0
- package/src/patterns/components/checkbox/index.js +7 -0
- package/src/patterns/components/contextmenu/contextmenu.wingsuit.yml +1 -0
- package/src/patterns/components/datepicker/datepicker.stories.jsx +9 -0
- package/src/patterns/components/datepicker/datepicker.twig +20 -0
- package/src/patterns/components/datepicker/datepicker.wingsuit.yml +71 -0
- package/src/patterns/components/datepicker/index.js +7 -0
- package/src/patterns/components/dropdown/dropdown.twig +16 -16
- package/src/patterns/components/dropdown/dropdown.wingsuit.yml +80 -58
- package/src/patterns/components/footer/footer.wingsuit.yml +1 -0
- package/src/patterns/components/form/fieldset.twig +62 -0
- package/src/patterns/components/form/form.twig +18 -96
- package/src/patterns/components/form/form.wingsuit.yml +138 -967
- package/src/patterns/components/form/formcontrol.twig +84 -0
- package/src/patterns/components/form/input.twig +9 -12
- package/src/patterns/components/hero/hero.wingsuit.yml +40 -40
- package/src/patterns/components/herocard/herocard.wingsuit.yml +1 -0
- package/src/patterns/components/image/image.wingsuit.yml +1 -0
- package/src/patterns/components/link/link.wingsuit.yml +1 -0
- package/src/patterns/components/linklist/linklist.wingsuit.yml +1 -0
- package/src/patterns/components/list/list-item.wingsuit.yml +1 -0
- package/src/patterns/components/list/list.wingsuit.yml +1 -0
- package/src/patterns/components/loading/loading.wingsuit.yml +1 -0
- package/src/patterns/components/localnav/localnav.wingsuit.yml +1 -0
- package/src/patterns/components/logogrid/logogrid.wingsuit.yml +1 -2
- package/src/patterns/components/modal/modal.twig +3 -1
- package/src/patterns/components/modal/modal.wingsuit.yml +1 -0
- package/src/patterns/components/navigation/navigation.twig +145 -108
- package/src/patterns/components/notification/notification.wingsuit.yml +1 -0
- package/src/patterns/components/pagination/pagination.wingsuit.yml +1 -0
- package/src/patterns/components/profile/profile.wingsuit.yml +1 -0
- package/src/patterns/components/readmore/readmore.wingsuit.yml +1 -0
- package/src/patterns/components/richtext/richtext.wingsuit.yml +1 -0
- package/src/patterns/components/search/index.js +6 -0
- package/src/patterns/components/search/search.stories.jsx +10 -0
- package/src/patterns/components/search/search.twig +22 -0
- package/src/patterns/components/search/search.wingsuit.yml +89 -0
- package/src/patterns/components/socialmedia/socialmedia.wingsuit.yml +1 -0
- package/src/patterns/components/table/table.wingsuit.yml +1 -0
- package/src/patterns/components/tableofcontents/tableofcontents.wingsuit.yml +1 -0
- package/src/patterns/components/tabs/tabs.wingsuit.yml +1 -0
- package/src/patterns/components/tags/tags.wingsuit.yml +1 -0
- package/src/patterns/components/textinput/index.js +7 -0
- package/src/patterns/components/textinput/textinput.stories.jsx +10 -0
- package/src/patterns/components/textinput/textinput.twig +13 -0
- package/src/patterns/components/textinput/textinput.wingsuit.yml +87 -0
- package/src/patterns/components/tooltip/tooltip.twig +9 -11
- package/src/patterns/components/tooltip/tooltip.wingsuit.yml +7 -0
- package/src/patterns/components/video/video.wingsuit.yml +1 -0
- package/contributing.md +0 -5
- package/src/patterns/components/fieldset/fieldset.twig +0 -44
- package/src/patterns/components/form/checkbox.twig +0 -13
- package/src/patterns/components/form/checkboxgroup.twig +0 -5
- package/src/patterns/components/form/datepicker.twig +0 -41
- package/src/patterns/components/searchfield/index.js +0 -6
- package/src/patterns/components/searchfield/searchfield.twig +0 -7
- package/src/patterns/components/searchfield/searchfield.wingsuit.yml +0 -22
|
@@ -1,78 +1,100 @@
|
|
|
1
1
|
dropdown:
|
|
2
|
+
namespace: components/Forms
|
|
2
3
|
use: "@components/dropdown/dropdown.twig"
|
|
3
4
|
label: Dropdown
|
|
4
5
|
description: The Dropdown displays a select element with options, and is most
|
|
5
6
|
commonly used in forms.
|
|
7
|
+
visibility: storybook
|
|
6
8
|
fields:
|
|
7
|
-
|
|
8
|
-
type:
|
|
9
|
-
label:
|
|
10
|
-
description: The
|
|
11
|
-
preview: "
|
|
12
|
-
|
|
13
|
-
error:
|
|
9
|
+
label:
|
|
10
|
+
type: text
|
|
11
|
+
label: Label
|
|
12
|
+
description: The label for the form element.
|
|
13
|
+
preview: "Select a country"
|
|
14
|
+
tooltip:
|
|
14
15
|
type: string
|
|
15
|
-
|
|
16
|
-
description: Does this have an error? If so, the error message
|
|
17
|
-
preview: ""
|
|
18
|
-
required: false
|
|
16
|
+
description: The tooltip for the form element.
|
|
19
17
|
helper:
|
|
20
|
-
type:
|
|
21
|
-
label:
|
|
22
|
-
description:
|
|
23
|
-
preview: "My helper text"
|
|
24
|
-
required: false
|
|
18
|
+
type: text
|
|
19
|
+
label: Helper Text
|
|
20
|
+
description: The helper text for the form element.
|
|
25
21
|
id:
|
|
26
|
-
type:
|
|
27
|
-
label:
|
|
28
|
-
description:
|
|
29
|
-
preview: "dropdown"
|
|
30
|
-
required: true
|
|
31
|
-
label:
|
|
32
|
-
type: string
|
|
33
|
-
label: label
|
|
34
|
-
description: the label of the form field
|
|
35
|
-
preview: "Dropdown Label"
|
|
36
|
-
required: true
|
|
22
|
+
type: text
|
|
23
|
+
label: ID
|
|
24
|
+
description: The ID of the input.
|
|
37
25
|
name:
|
|
38
|
-
type:
|
|
39
|
-
label:
|
|
40
|
-
description:
|
|
41
|
-
|
|
42
|
-
|
|
26
|
+
type: text
|
|
27
|
+
label: Name
|
|
28
|
+
description: The name of the input.
|
|
29
|
+
class:
|
|
30
|
+
type: text
|
|
31
|
+
label: Class
|
|
32
|
+
description: The class of the form field.
|
|
33
|
+
preview: checkbox
|
|
34
|
+
default: ""
|
|
35
|
+
style:
|
|
36
|
+
type: text
|
|
37
|
+
label: Style
|
|
38
|
+
description: The style of the form field.
|
|
39
|
+
defaultOption:
|
|
40
|
+
type: text
|
|
41
|
+
label: Default Option
|
|
42
|
+
description: The value of the default option for the form element.
|
|
43
|
+
preview: "TH"
|
|
43
44
|
options:
|
|
44
45
|
type: object
|
|
45
46
|
label: Options
|
|
46
|
-
description: The options for
|
|
47
|
-
required: true
|
|
47
|
+
description: The options for the form element.
|
|
48
48
|
preview:
|
|
49
|
-
- label:
|
|
50
|
-
value:
|
|
51
|
-
- label:
|
|
52
|
-
value:
|
|
53
|
-
- label:
|
|
54
|
-
value:
|
|
55
|
-
- label:
|
|
56
|
-
value:
|
|
57
|
-
- label:
|
|
58
|
-
value:
|
|
49
|
+
- label: Switzerland
|
|
50
|
+
value: CH
|
|
51
|
+
- label: Côte d'Ivoire
|
|
52
|
+
value: CI
|
|
53
|
+
- label: Thailand
|
|
54
|
+
value: TH
|
|
55
|
+
- label: United States
|
|
56
|
+
value: US
|
|
57
|
+
- label: Zimbabwe
|
|
58
|
+
value: ZW
|
|
59
|
+
- label: Afghanistan
|
|
60
|
+
value: AF
|
|
61
|
+
- label: Åland Islands
|
|
62
|
+
value: AX
|
|
59
63
|
settings:
|
|
60
|
-
|
|
64
|
+
labelPlacement:
|
|
61
65
|
type: select
|
|
62
|
-
label:
|
|
63
|
-
description:
|
|
66
|
+
label: Label Placement
|
|
67
|
+
description: The placement of the label for the form element.
|
|
68
|
+
preview: "top"
|
|
64
69
|
options:
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
+
start: start
|
|
71
|
+
end: end
|
|
72
|
+
top: top
|
|
73
|
+
bottom: bottom
|
|
74
|
+
labelSize:
|
|
70
75
|
type: select
|
|
71
|
-
label:
|
|
72
|
-
description:
|
|
76
|
+
label: Label Size
|
|
77
|
+
description: The size of the label for the form element.
|
|
78
|
+
preview: medium
|
|
73
79
|
options:
|
|
74
|
-
|
|
75
|
-
|
|
80
|
+
small: small
|
|
81
|
+
medium: medium
|
|
82
|
+
large: large
|
|
83
|
+
disabled:
|
|
84
|
+
type: boolean
|
|
85
|
+
label: Disabled
|
|
86
|
+
description: The disabled state of the form element.
|
|
76
87
|
preview: false
|
|
77
|
-
|
|
78
|
-
|
|
88
|
+
default: false
|
|
89
|
+
required:
|
|
90
|
+
type: boolean
|
|
91
|
+
label: Required
|
|
92
|
+
description: The required state of the form element.
|
|
93
|
+
preview: false
|
|
94
|
+
default: false
|
|
95
|
+
error:
|
|
96
|
+
type: boolean
|
|
97
|
+
label: Error
|
|
98
|
+
description: Adds an error state to the form control.
|
|
99
|
+
preview: false
|
|
100
|
+
default: false
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{# fieldset.twig #}
|
|
2
|
+
|
|
3
|
+
{% set baseClass = prefix ~ "--fieldset" %}
|
|
4
|
+
{% set wrapClass = baseClass ~ "--wrap__" ~ wrap %}
|
|
5
|
+
{% set directionClass = baseClass ~ "--direction__" ~ direction %}
|
|
6
|
+
{% set helperClass = baseClass ~ "--helper" %}
|
|
7
|
+
{% set errorClass = baseClass ~ "__error" %}
|
|
8
|
+
{% set disabledClass = baseClass ~ "__disabled" %}
|
|
9
|
+
|
|
10
|
+
{% set fieldsetClasses = [fieldsetClass, baseClass, wrapClass, directionClass, class] %}
|
|
11
|
+
{% if disabled %}
|
|
12
|
+
{% set fieldsetClasses = fieldsetClasses|merge([disabledClass]) %}
|
|
13
|
+
{% endif %}
|
|
14
|
+
|
|
15
|
+
{% set helperClasses = [helperClass] %}
|
|
16
|
+
{% if hasError %}
|
|
17
|
+
{% set helperClasses = helperClasses|merge([errorClass]) %}
|
|
18
|
+
{% endif %}
|
|
19
|
+
|
|
20
|
+
{% set showHelper = helper or hasError %}
|
|
21
|
+
{% set helperMessage = hasError ? errorMessage : helper %}
|
|
22
|
+
|
|
23
|
+
<fieldset class="{{ fieldsetClasses|join(' ') }}" {% if style %} style="{{ style }}" {% endif %}>
|
|
24
|
+
{% if legend or helper %}
|
|
25
|
+
<div class="{{ baseClass ~ '--legend-wrapper' }}">
|
|
26
|
+
{% if legend %}
|
|
27
|
+
<legend class="{{ baseClass ~ '--legend' }}">
|
|
28
|
+
{{ legend }}
|
|
29
|
+
{% if tooltip %}
|
|
30
|
+
{% include '@components/tooltip/tooltip.twig' with {
|
|
31
|
+
"icon": true,
|
|
32
|
+
"label": tooltip,
|
|
33
|
+
"theme": "dark",
|
|
34
|
+
"prefix": prefix,
|
|
35
|
+
"tooltipId": tooltip
|
|
36
|
+
} only %}
|
|
37
|
+
{% endif %}
|
|
38
|
+
</legend>
|
|
39
|
+
{% endif %}
|
|
40
|
+
{% if showHelper %}
|
|
41
|
+
<span class="{{ helperClasses|join(' ') }}">{{ helperMessage }}</span>
|
|
42
|
+
{% endif %}
|
|
43
|
+
</div>
|
|
44
|
+
{% endif %}
|
|
45
|
+
<div class="{{ baseClass ~ '--elements' }}">
|
|
46
|
+
{% for field in fields %}
|
|
47
|
+
{% if field.type == "textinput" %}
|
|
48
|
+
{% include "@components/textinput/textinput.twig" with field|merge({ "prefix": prefix }) only %}
|
|
49
|
+
{% elseif field.type == "checkbox" %}
|
|
50
|
+
{% include "@components/checkbox/checkbox.twig" with field|merge({ "prefix": prefix }) only %}
|
|
51
|
+
{% elseif field.type == "datepicker" %}
|
|
52
|
+
{% include "@components/datepicker/datepicker.twig" with field|merge({ "prefix": prefix }) only %}
|
|
53
|
+
{% elseif field.type == "dropdown" %}
|
|
54
|
+
{% include "@components/dropdown/dropdown.twig" with field|merge({ "prefix": prefix }) only %}
|
|
55
|
+
{% elseif field.type == "dropdown" %}
|
|
56
|
+
{% include "@components/dropdown/dropdown.twig" with field|merge({ "prefix": prefix }) only %}
|
|
57
|
+
{% elseif field.type == "search" %}
|
|
58
|
+
{% include "@components/search/search.twig" with field|merge({ "prefix": prefix }) only %}
|
|
59
|
+
{% endif %}
|
|
60
|
+
{% endfor %}
|
|
61
|
+
</div>
|
|
62
|
+
</fieldset>
|
|
@@ -1,97 +1,19 @@
|
|
|
1
|
-
{#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
{% for i in item.field.items %}
|
|
20
|
-
{% if i.type == "radio" or (i.type == "checkbox" and i.field[0].grouped == true) %}
|
|
21
|
-
<fieldset class="{{prefix}}--choice-group {{prefix}}--fieldset">
|
|
22
|
-
{% if i.legend %}
|
|
23
|
-
<legend class="{{prefix}}--fieldset--legend">{{i.legend}}
|
|
24
|
-
{% if i.grouptooltip is defined %}
|
|
25
|
-
{% include '@components/tooltip/tooltip.twig' with {label: i.grouptooltip.label, icon: i.grouptooltip.icon, theme: i.grouptooltip.theme, className: prefix ~ "--fieldset--legend--tooltip"} %}
|
|
26
|
-
{% endif %}
|
|
27
|
-
</legend>
|
|
28
|
-
{% endif %}
|
|
29
|
-
{% if i.grouphelper and not i.grouperror %}
|
|
30
|
-
<span class="{{prefix}}--fieldset--helper">{{i.grouphelper}}</span>
|
|
31
|
-
{% endif %}
|
|
32
|
-
{% if i.grouperror %}
|
|
33
|
-
<span class="{{prefix}}--fieldset--error">{{i.grouperror}}</span>
|
|
34
|
-
{% endif %}
|
|
35
|
-
{% for f in i.field %}
|
|
36
|
-
<div class="{{prefix}}--fieldset--input--{{i.type}}">
|
|
37
|
-
<label class="{{prefix}}--fieldset--label" for="{% if f.id is defined and f.id is not empty %}{{f.id}}{% else %}{{f.name}}{% endif %}">{{f.label}}</label>
|
|
38
|
-
{% if i.type == "radio" %}
|
|
39
|
-
{% include '@components/form/radio.twig' with f %}
|
|
40
|
-
{% else %}
|
|
41
|
-
{% include '@components/form/checkboxgroup.twig' with f %}
|
|
42
|
-
{% endif %}
|
|
43
|
-
</div>
|
|
44
|
-
{% endfor %}
|
|
45
|
-
</fieldset>
|
|
46
|
-
{% elseif i.type == "date" %}
|
|
47
|
-
{% include '@components/form/datepicker.twig' with i.field %}
|
|
48
|
-
{% else %}
|
|
49
|
-
{% if i.type == "input" or (i.type == "checkbox" and not i.field[0].grouped) or i.type == "file" or i.type == "number" or i.type == "textarea" %}
|
|
50
|
-
{% include '@components/form/'~ i.type ~'.twig' with i.field %}
|
|
51
|
-
{% endif %}
|
|
52
|
-
{% if i.type == "dropdown" %}
|
|
53
|
-
{% include '@components/dropdown/dropdown.twig' with i.field %}
|
|
54
|
-
{% endif %}
|
|
55
|
-
{% endif %}
|
|
56
|
-
{% endfor %}
|
|
57
|
-
</fieldset>
|
|
58
|
-
{% endif %}
|
|
59
|
-
{% if item.type == "radio" or (item.type == "checkbox" and item.field[0].grouped == true) %}
|
|
60
|
-
<fieldset class="{{prefix}}--choice-group {{prefix}}--fieldset">
|
|
61
|
-
{% if item.legend %}
|
|
62
|
-
<legend class="{{prefix}}--fieldset--legend">{{item.legend}}
|
|
63
|
-
{% if item.grouptooltip is defined %}
|
|
64
|
-
{% include '@components/tooltip/tooltip.twig' with {label: item.grouptooltip.label, icon: item.grouptooltip.icon, theme: item.grouptooltip.theme, className: prefix ~ "--fieldset--legend--tooltip"} %}
|
|
65
|
-
{% endif %}
|
|
66
|
-
</legend>
|
|
67
|
-
{% endif %}
|
|
68
|
-
{% if item.grouphelper and not item.grouperror %}
|
|
69
|
-
<span class="{{prefix}}--fieldset--helper">{{item.grouphelper}}</span>
|
|
70
|
-
{% endif %}
|
|
71
|
-
{% if item.grouperror %}
|
|
72
|
-
<span class="{{prefix}}--fieldset--error">{{item.grouperror}}</span>
|
|
73
|
-
{% endif %}
|
|
74
|
-
{% for f in item.field %}
|
|
75
|
-
<div class="{{prefix}}--fieldset--input--{{item.type}}">
|
|
76
|
-
<label class="{{prefix}}--fieldset--label" for="{% if f.id is defined and f.id is not empty %}{{f.id}}{% else %}{{f.name}}{% endif %}">{{f.label}}</label>
|
|
77
|
-
{% if item.type == "radio" %}
|
|
78
|
-
{% include '@components/form/radio.twig' with f %}
|
|
79
|
-
{% else %}
|
|
80
|
-
{% include '@components/form/checkboxgroup.twig' with f %}
|
|
81
|
-
{% endif %}
|
|
82
|
-
</div>
|
|
83
|
-
{% endfor %}
|
|
84
|
-
</fieldset>
|
|
85
|
-
{% elseif item.type == "date" %}
|
|
86
|
-
{% include '@components/form/datepicker.twig' with item.field %}
|
|
87
|
-
{% else %}
|
|
88
|
-
{% if item.type == "input" or (item.type == "checkbox" and not item.field[0].grouped) or item.type == "file" or item.type == "number" or item.type == "textarea" %}
|
|
89
|
-
{% include '@components/form/'~ item.type ~'.twig' with item.field %}
|
|
90
|
-
{% endif %}
|
|
91
|
-
{% if item.type == "dropdown" %}
|
|
92
|
-
{% include '@components/dropdown/dropdown.twig' with item.field %}
|
|
93
|
-
{% endif %}
|
|
94
|
-
{% endif %}
|
|
95
|
-
{% endfor %}
|
|
96
|
-
{% include '@components/button/button.twig' with {type: "primary", kind: "submit", size: "large", label: submitlabel} %}
|
|
1
|
+
{# form.twig #}
|
|
2
|
+
|
|
3
|
+
{% set baseClass = prefix ~ "--form" %}
|
|
4
|
+
|
|
5
|
+
{% set formControlClass = [baseClass, class] %}
|
|
6
|
+
|
|
7
|
+
<form class="{{ formControlClass|join(' ') }}" data-loadcomponent="Form" {%- for key, value in attributes|default({} ) -%} {{- ' ' ~ key ~ '="' ~ value|e('html_attr') ~ '"' -}} {%- endfor -%}>
|
|
8
|
+
{% if headline %}
|
|
9
|
+
<h2>{{ headline }}</h2>
|
|
10
|
+
{% endif %}
|
|
11
|
+
{% for fieldset in fieldsets %}
|
|
12
|
+
{% include "@components/form/fieldset.twig" with fieldset|merge({ "prefix": prefix }) only %}
|
|
13
|
+
{% endfor %}
|
|
14
|
+
{% if submit %}
|
|
15
|
+
{% include "@components/button/button.twig" with submit|merge({
|
|
16
|
+
"prefix": prefix, "kind": "submit" }) only
|
|
17
|
+
%}
|
|
18
|
+
{% endif %}
|
|
97
19
|
</form>
|