@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.
Files changed (76) hide show
  1. package/.turbo/turbo-build:lib.log +2 -2
  2. package/CHANGELOG.md +20 -0
  3. package/package.json +3 -3
  4. package/src/patterns/components/accordion/accordion.wingsuit.yml +1 -0
  5. package/src/patterns/components/breadcrumb/breadcrumb.wingsuit.yml +1 -0
  6. package/src/patterns/components/button/button.wingsuit.yml +1 -0
  7. package/src/patterns/components/callout/callout.wingsuit.yml +1 -0
  8. package/src/patterns/components/card/card.wingsuit.yml +14 -13
  9. package/src/patterns/components/card_data/card_data.wingsuit.yml +3 -7
  10. package/src/patterns/components/card_detail/card_detail.wingsuit.yml +1 -3
  11. package/src/patterns/components/card_factlist/card_factlist.wingsuit.yml +1 -4
  12. package/src/patterns/components/card_feature/card_feature.wingsuit.yml +1 -3
  13. package/src/patterns/components/card_multilink/card_multilink.wingsuit.yml +7 -9
  14. package/src/patterns/components/card_promo/card_promo.wingsuit.yml +1 -3
  15. package/src/patterns/components/card_stat/card_stat.wingsuit.yml +1 -5
  16. package/src/patterns/components/card_text/card_text.wingsuit.yml +4 -6
  17. package/src/patterns/components/cardgroup/cardgroup.wingsuit.yml +1 -4
  18. package/src/patterns/components/{searchfield/searchfield.stories.jsx → checkbox/checkbox.stories.jsx} +1 -1
  19. package/src/patterns/components/checkbox/checkbox.twig +17 -0
  20. package/src/patterns/components/checkbox/checkbox.wingsuit.yml +83 -0
  21. package/src/patterns/components/checkbox/index.js +7 -0
  22. package/src/patterns/components/contextmenu/contextmenu.wingsuit.yml +1 -0
  23. package/src/patterns/components/datepicker/datepicker.stories.jsx +9 -0
  24. package/src/patterns/components/datepicker/datepicker.twig +20 -0
  25. package/src/patterns/components/datepicker/datepicker.wingsuit.yml +71 -0
  26. package/src/patterns/components/datepicker/index.js +7 -0
  27. package/src/patterns/components/dropdown/dropdown.twig +16 -16
  28. package/src/patterns/components/dropdown/dropdown.wingsuit.yml +80 -58
  29. package/src/patterns/components/footer/footer.wingsuit.yml +1 -0
  30. package/src/patterns/components/form/fieldset.twig +62 -0
  31. package/src/patterns/components/form/form.twig +18 -96
  32. package/src/patterns/components/form/form.wingsuit.yml +138 -967
  33. package/src/patterns/components/form/formcontrol.twig +84 -0
  34. package/src/patterns/components/form/input.twig +9 -12
  35. package/src/patterns/components/hero/hero.wingsuit.yml +40 -40
  36. package/src/patterns/components/herocard/herocard.wingsuit.yml +1 -0
  37. package/src/patterns/components/image/image.wingsuit.yml +1 -0
  38. package/src/patterns/components/link/link.wingsuit.yml +1 -0
  39. package/src/patterns/components/linklist/linklist.wingsuit.yml +1 -0
  40. package/src/patterns/components/list/list-item.wingsuit.yml +1 -0
  41. package/src/patterns/components/list/list.wingsuit.yml +1 -0
  42. package/src/patterns/components/loading/loading.wingsuit.yml +1 -0
  43. package/src/patterns/components/localnav/localnav.wingsuit.yml +1 -0
  44. package/src/patterns/components/logogrid/logogrid.wingsuit.yml +1 -2
  45. package/src/patterns/components/modal/modal.twig +3 -1
  46. package/src/patterns/components/modal/modal.wingsuit.yml +1 -0
  47. package/src/patterns/components/navigation/navigation.twig +145 -108
  48. package/src/patterns/components/notification/notification.wingsuit.yml +1 -0
  49. package/src/patterns/components/pagination/pagination.wingsuit.yml +1 -0
  50. package/src/patterns/components/profile/profile.wingsuit.yml +1 -0
  51. package/src/patterns/components/readmore/readmore.wingsuit.yml +1 -0
  52. package/src/patterns/components/richtext/richtext.wingsuit.yml +1 -0
  53. package/src/patterns/components/search/index.js +6 -0
  54. package/src/patterns/components/search/search.stories.jsx +10 -0
  55. package/src/patterns/components/search/search.twig +22 -0
  56. package/src/patterns/components/search/search.wingsuit.yml +89 -0
  57. package/src/patterns/components/socialmedia/socialmedia.wingsuit.yml +1 -0
  58. package/src/patterns/components/table/table.wingsuit.yml +1 -0
  59. package/src/patterns/components/tableofcontents/tableofcontents.wingsuit.yml +1 -0
  60. package/src/patterns/components/tabs/tabs.wingsuit.yml +1 -0
  61. package/src/patterns/components/tags/tags.wingsuit.yml +1 -0
  62. package/src/patterns/components/textinput/index.js +7 -0
  63. package/src/patterns/components/textinput/textinput.stories.jsx +10 -0
  64. package/src/patterns/components/textinput/textinput.twig +13 -0
  65. package/src/patterns/components/textinput/textinput.wingsuit.yml +87 -0
  66. package/src/patterns/components/tooltip/tooltip.twig +9 -11
  67. package/src/patterns/components/tooltip/tooltip.wingsuit.yml +7 -0
  68. package/src/patterns/components/video/video.wingsuit.yml +1 -0
  69. package/contributing.md +0 -5
  70. package/src/patterns/components/fieldset/fieldset.twig +0 -44
  71. package/src/patterns/components/form/checkbox.twig +0 -13
  72. package/src/patterns/components/form/checkboxgroup.twig +0 -5
  73. package/src/patterns/components/form/datepicker.twig +0 -41
  74. package/src/patterns/components/searchfield/index.js +0 -6
  75. package/src/patterns/components/searchfield/searchfield.twig +0 -7
  76. package/src/patterns/components/searchfield/searchfield.wingsuit.yml +0 -22
@@ -0,0 +1,22 @@
1
+ {# dropdown.twig #}
2
+
3
+ {% extends "@components/form/formcontrol.twig" %}
4
+
5
+ {% set baseClass = prefix ~ "--searchfield" %}
6
+ {% set searchClass = [baseClass, class] %}
7
+ {% set inputClass = prefix ~ "--input" %}
8
+ {% set buttonClass = baseClass ~ "--button" %}
9
+
10
+ {% if error %}
11
+ {% set inputClass = inputClass|merge([baseClass ~ "__error"]) %}
12
+ {% endif %}
13
+
14
+
15
+ {% block formfield %}
16
+
17
+ <div class="{{ searchClass|join(" ") }}" {% if style %} style={{ style }} {% endif %}>
18
+ <input name="{{name}}" type="{{type}}" class="{{ inputClass }}{% if error %} error{% endif %}" {% if placeholder %} placeholder="{{placeholder}}" {% endif %} {% if disabled %} disabled {% endif %} {% if required %} required {% endif %} id="{% if id %}{{id}}{% else %}{{name}}{% endif %}"/>
19
+ <input class="{{ buttonClass }}" type="submit"/>
20
+ </div>
21
+
22
+ {% endblock %}
@@ -0,0 +1,89 @@
1
+ searchfield:
2
+ namespace: Components/Forms
3
+ use: "@components/search/search.twig"
4
+ label: Search
5
+ description: A component for displaying a search field.
6
+ visibility: storybook
7
+ fields:
8
+ label:
9
+ type: text
10
+ label: Label
11
+ description: The label for the form element.
12
+ tooltip:
13
+ type: string
14
+ description: The tooltip for the form element.
15
+ helper:
16
+ type: text
17
+ label: Helper Text
18
+ description: The helper text for the form element.
19
+ id:
20
+ type: text
21
+ label: ID
22
+ description: The ID of the text input.
23
+ name:
24
+ type: text
25
+ label: Name
26
+ description: The name of the text input.
27
+ placeholder:
28
+ type: text
29
+ label: Placeholder
30
+ description: The placeholder of the text input.
31
+ preview: Search for something
32
+ class:
33
+ type: text
34
+ label: Class
35
+ description: The class of the text input.
36
+ preview: textinput
37
+ default: ""
38
+ style:
39
+ type: text
40
+ label: Style
41
+ description: The style of the text input.
42
+ preview: "width: 100%"
43
+ default: ""
44
+ pattern:
45
+ type: text
46
+ label: Pattern
47
+ description: The pattern of the text input.
48
+ preview: textinput``
49
+ default: ""
50
+ settings:
51
+ labelPlacement:
52
+ type: select
53
+ label: Label Placement
54
+ description: The placement of the label for the form element.
55
+ preview: "top"
56
+ default: "top"
57
+ options:
58
+ start: start
59
+ end: end
60
+ top: top
61
+ bottom: bottom
62
+ labelSize:
63
+ type: select
64
+ label: Label Size
65
+ description: The size of the label for the form element.
66
+ preview: "medium"
67
+ default: "medium"
68
+ options:
69
+ small: small
70
+ medium: medium
71
+ large: large
72
+ disabled:
73
+ type: boolean
74
+ label: Disabled
75
+ description: The disabled state of the text input.
76
+ preview: false
77
+ default: false
78
+ required:
79
+ type: boolean
80
+ label: Required
81
+ description: The required state of the text input.
82
+ preview: false
83
+ default: false
84
+ error:
85
+ type: boolean
86
+ label: Error
87
+ description: Adds an error state to the form control.
88
+ preview: false
89
+ default: false
@@ -1,4 +1,5 @@
1
1
  socialmedia:
2
+ namespace: Components/Navigation
2
3
  use: "@components/socialmedia/socialmedia.twig"
3
4
  label: Social Media
4
5
  description: The Social Media component displays a series of social media icons with links and an optional headline. It can have a light or a dark theme.
@@ -1,4 +1,5 @@
1
1
  table:
2
+ namespace: Components/Content
2
3
  use: "@components/table/table.twig"
3
4
  label: Table
4
5
  description: A component for displaying data in a table
@@ -1,4 +1,5 @@
1
1
  tableofcontents:
2
+ namespace: Components/Navigation
2
3
  use: "@components/tableofcontents/tableofcontents.twig"
3
4
  label: Table Of Contents
4
5
  description: A component for displaying links internal to a page
@@ -1,4 +1,5 @@
1
1
  tabs:
2
+ namespace: Components/User Interface
2
3
  use: "@components/tabs/tabs.twig"
3
4
  label: Tabs
4
5
  description: The Tabs component displays content that is subdivided into sections, providing an interface for toggling visually between sections
@@ -1,4 +1,5 @@
1
1
  tags:
2
+ namespace: Components/User Interface
2
3
  use: "@components/tags/tags.twig"
3
4
  label: Tags
4
5
  description: A group of tags
@@ -0,0 +1,7 @@
1
+ /**
2
+ * tag
3
+ */
4
+ // Module template
5
+ import "./textinput.twig";
6
+ import "./textinput.wingsuit.yml";
7
+ import "../tooltip/tooltip.behavior";
@@ -0,0 +1,10 @@
1
+ import "./index";
2
+
3
+ export default {};
4
+ const patternDefinition = require("./textinput.wingsuit.yml");
5
+
6
+ /* eslint-disable-next-line */
7
+ /* eslint-disable-next-line */
8
+ export const wingsuit = {
9
+ patternDefinition,
10
+ };
@@ -0,0 +1,13 @@
1
+ {# text-input.twig #}
2
+
3
+ {% extends "@components/form/formcontrol.twig" %}
4
+
5
+ {% set baseClass = prefix ~ "--text-input" %}
6
+ {% set inputClass = [baseClass] %}
7
+ {% if error %}
8
+ {% set inputClass = inputClass|merge([baseClass ~ "__error"]) %}
9
+ {% endif %}
10
+
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 %}/>
13
+ {% endblock %}
@@ -0,0 +1,87 @@
1
+ textinput:
2
+ namespace: Components/Forms
3
+ use: "@components/textinput/textinput.twig"
4
+ label: Text Input
5
+ description: The TextInput field provides a way for users with a single line of text to enter into a form. Use this component for things like names, email addresses, passwords and other short form fields.
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 input.
26
+ name:
27
+ type: text
28
+ label: Name
29
+ description: The name of the text input.
30
+ placeholder:
31
+ type: text
32
+ label: Placeholder
33
+ description: The placeholder of the text input.
34
+ preview: Sarah Martinez
35
+ default: ""
36
+ class:
37
+ type: text
38
+ label: Class
39
+ description: The class of the text input.
40
+ preview: textinput
41
+ default: ""
42
+ pattern:
43
+ type: text
44
+ label: Pattern
45
+ description: The pattern of the text input.
46
+ preview: textinput``
47
+ default: ""
48
+ settings:
49
+ labelPlacement:
50
+ type: select
51
+ label: Label Placement
52
+ description: The placement of the label for the form element.
53
+ preview: "top"
54
+ default: "top"
55
+ options:
56
+ start: start
57
+ end: end
58
+ top: top
59
+ bottom: bottom
60
+ labelSize:
61
+ type: select
62
+ label: Label Size
63
+ description: The size of the label for the form element.
64
+ preview: "medium"
65
+ default: "medium"
66
+ options:
67
+ small: small
68
+ medium: medium
69
+ large: large
70
+ disabled:
71
+ type: boolean
72
+ label: Disabled
73
+ description: The disabled state of the text input.
74
+ preview: false
75
+ default: false
76
+ required:
77
+ type: boolean
78
+ label: Required
79
+ description: The required state of the text input.
80
+ preview: false
81
+ default: false
82
+ error:
83
+ type: boolean
84
+ label: Error
85
+ description: Adds an error state to the form control.
86
+ preview: false
87
+ default: false
@@ -1,14 +1,12 @@
1
1
  {#
2
2
  TOOLTIP COMPONENT
3
3
  #}
4
- <div
5
- class="{{prefix}}--tooltip--wrapper{% if icon and icon != 'false' %} has-icon{% endif %} {{prefix}}--tooltip--wrapper--{{theme}}" role="status" aria-live="polite" aria-relevant="additions" data-loadcomponent="Tooltip" data-prefix="{{prefix}}"
6
- >
7
- {% if not icon or icon == 'false' %}
8
- {{ children|raw }}
9
- {% endif %}
10
- <span class="{{prefix}}--tooltip {{prefix}}--tooltip--{{theme}}" data-alignment="left">
11
- <span class="{{prefix}}--tooltip--arrow {{prefix}}--tooltip--arrow--placement-negative" data-placement="negative" role="presentation"></span>
12
- {{label}}
13
- </span>
14
- </div>
4
+ <div class="{{prefix}}--tooltip--wrapper {% if icon %}has-icon{% endif %}" role="status" aria-live="polite" aria-relevant="additions" data-loadcomponent="Tooltip" data-prefix="{{prefix}}">
5
+ {% if not icon or icon == 'false' %}
6
+ {{ children|raw }}
7
+ {% endif %}
8
+ <span class="{{prefix}}--tooltip {{prefix}}--tooltip--{{theme}}" data-alignment="left" id={{tooltipId}}>
9
+ <span class="{{prefix}}--tooltip--arrow {{prefix}}--tooltip--arrow--placement-negative" data-placement="negative" role="presentation"></span>
10
+ {{label}}
11
+ </span>
12
+ </div>
@@ -1,4 +1,5 @@
1
1
  tooltip:
2
+ namespace: Components/Feedback
2
3
  use: "@components/tooltip/tooltip.twig"
3
4
  label: Tooltip
4
5
  description: A component for displaying a tooltip
@@ -9,6 +10,12 @@ tooltip:
9
10
  description: label shown on the tooltip
10
11
  required: true
11
12
  preview: "Tooltip text"
13
+ tooltipId:
14
+ type: string
15
+ label: tooltipId
16
+ description: id for the tooltip. This is often needed for accessibility purposes, for example when you need to provide an `id` to an `aria-describedby` attribute.
17
+ required: true
18
+ preview: "tooltip-id"
12
19
  children:
13
20
  type: string
14
21
  label: children
@@ -1,4 +1,5 @@
1
1
  video:
2
+ namespace: Components/Media
2
3
  use: "@components/video/video.twig"
3
4
  label: Video
4
5
  description: A component for displaying a video, source from either a server or YouTube.
package/contributing.md DELETED
@@ -1,5 +0,0 @@
1
- # Contributing
2
-
3
- Before contributing, please ensure your IDE or text editor is using the `.editorconfig` at the root of this project. To achieve this easily, see the docs section titled ["IDE/text editor setup"](https://phase2.gitbook.io/frontend/wingsuit/development/coding-and-linting#ide-text-editor-setup)
4
-
5
- Then to contribute to these tools, just fork this repo, modify as you see fit and push up a pull request!
@@ -1,44 +0,0 @@
1
- {#
2
- FIELDSET COMPONENT
3
- This component by itself does nothing, but is used to wrap form labels and inputs as well as provide their helper text and error messaging
4
-
5
- it takes four params:
6
-
7
- fsinputid: a string, the id of the form field it contains
8
- fslabel: a string, the label of the form field
9
- fshelper: a string, helper text, if any
10
- fserror: a string, error message, if any
11
- fstype: a string, the type of field
12
- fsclass: a string, any additional classnames
13
- #}
14
- <fieldset id="{{fsinputid}}--fieldset" class="{{prefix}}--fieldset{% if fsclass %} {{fsclass}}{% endif %}" {% if fshelper %}data-helper="{{fshelper}}"{% endif %} {% if fserror %}data-error="{{fserror}}"{% endif %}>
15
- {% if legend %}
16
- <legend class="ilo--fieldset--legend">{{legend}}
17
- {% if grouptooltip %}
18
- {% include '@components/tooltip/tooltip.twig' with {label: grouptooltip.label, icon: grouptooltip.icon, theme: grouptooltip.theme, className: "ilo--fieldset--legend--tooltip"} %}
19
- {% endif %}
20
- </legend>
21
- {% endif %}
22
- {% if grouphelper and not grouperror %}
23
- <span class="ilo--fieldset--helper">{{grouphelper}}</span>
24
- {% endif %}
25
- {% if grouperror %}
26
- <span class="ilo--fieldset--error">{{grouperror}}</span>
27
- {% endif %}
28
- <div class="ilo--fieldset--input--{{fstype}}">
29
- <label class="{{prefix}}--fieldset--label" for="{{fsinputid}}">
30
- {{fslabel}}
31
- {% if tooltip %}
32
- {% include '@components/tooltip/tooltip.twig' with tooltip %}
33
- {% endif %}
34
- </label>
35
- {% block formfield %}
36
- {% endblock %}
37
- {% if fshelper and not fserror %}
38
- <span class="{{prefix}}--fieldset--helper">{{fshelper}}</span>
39
- {% endif %}
40
- {% if fserror %}
41
- <span class="{{prefix}}--fieldset--error">{{fserror}}</span>
42
- {% endif %}
43
- </div>
44
- </fieldset>
@@ -1,13 +0,0 @@
1
- {#
2
- CHECKBOX 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 = type %}
10
-
11
- {% block formfield %}
12
- <input id="{{id}}" name="{{name}}" type="checkbox" class="{{prefix}}--checkbox" {% if disabled %}disabled{% endif %} />
13
- {% endblock %}
@@ -1,5 +0,0 @@
1
- {#
2
- GROUPED CHECKBOX COMPONENT
3
- #}
4
- <input id="{{id}}" name="{{name}}" type="checkbox" class="{{prefix}}--checkbox" {% if disabled %}disabled{% endif %} />
5
-
@@ -1,41 +0,0 @@
1
- {#
2
- DATEPICKER COMPONENT
3
- #}
4
- <div class="{{prefix}}--datepicker{% if range %}--range{% endif %}">
5
- <fieldset class="{{prefix}}--fieldset">
6
- <div class="{{prefix}}--fieldset--input--date ">
7
- <label class="{{prefix}}--fieldset--label">
8
- {{label}}
9
- {% if tooltip %}
10
- {% include '@components/tooltip/tooltip.twig' with tooltip %}
11
- {% endif %}
12
- </label>
13
- <input name="{{name}}" type="date" class="{{prefix}}--datepicker {{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 %}">
14
- {% if helper and not error %}
15
- <span class="ilo--fieldset--helper">{{helper}}</span>
16
- {% endif %}
17
- {% if error %}
18
- <span class="ilo--fieldset--error">{{error}}</span>
19
- {% endif %}
20
- </div>
21
- </fieldset>
22
- {% if range %}
23
- <fieldset class="{{prefix}}--fieldset">
24
- <div class="{{prefix}}--fieldset--input--date ">
25
- <label class="{{prefix}}--fieldset--label">
26
- {{enddata.label}}
27
- {% if enddata.tooltip %}
28
- {% include '@components/tooltip/tooltip.twig' with enddata.tooltip %}
29
- {% endif %}
30
- </label>
31
- <input name="{{enddata.name}}" type="date" class="{{prefix}}--datepicker {{prefix}}--input{% if enddata['error'] is defined %} error{% endif %}" {% if enddata['placeholder'] is defined %}placeholder="{{enddata.placeholder}}"{% endif %} {% if enddata['required'] is defined %}required{% endif %} {% if enddata['disabled'] is defined %}disabled{% endif %} id="{% if enddata['id'] is defined %}{{enddata.id}}{% else %}{{enddata.name}}{% endif %}">
32
- </div>
33
- {% if enddata.helper and not enddata.error %}
34
- <span class="ilo--fieldset--helper">{{enddata.helper}}</span>
35
- {% endif %}
36
- {% if enddata.error %}
37
- <span class="ilo--fieldset--error">{{enddata.error}}</span>
38
- {% endif %}
39
- </fieldset>
40
- {% endif %}
41
- </div>
@@ -1,6 +0,0 @@
1
- /**
2
- * Search Field
3
- */
4
- // Module template
5
- import "./searchfield.twig";
6
- import "./searchfield.wingsuit.yml";
@@ -1,7 +0,0 @@
1
- {#
2
- SEARCH FIELD COMPONENT
3
- #}
4
- <form class="{{prefix}}--searchfield{% if input.label %} haslabel{% endif %}" action="{{action}}">
5
- {% include '@components/form/input.twig' with input %}
6
- <input class="{{prefix}}--searchfield--button" type="submit" />
7
- </form>
@@ -1,22 +0,0 @@
1
- searchfield:
2
- use: "@components/searchfield/searchfield.twig"
3
- label: Search Field
4
- description: A component for displaying a search field.
5
- fields:
6
- action:
7
- type: string
8
- label: action
9
- description: The form's action attribute
10
- preview: "http://www.ilo.org"
11
- required: false
12
- input:
13
- type: object
14
- label: input
15
- description: The search field input's attributes
16
- preview:
17
- label: "Search Field Label"
18
- helper: "The search field's helper text"
19
- name: "text"
20
- placeholder: "Search Field"
21
- type: "search"
22
- visibility: storybook