@ilo-org/twig 0.9.5 → 0.10.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.
Files changed (75) hide show
  1. package/.turbo/turbo-build:lib.log +2 -2
  2. package/CHANGELOG.md +14 -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.wingsuit.yml +1 -0
  46. package/src/patterns/components/navigation/navigation.twig +145 -108
  47. package/src/patterns/components/notification/notification.wingsuit.yml +1 -0
  48. package/src/patterns/components/pagination/pagination.wingsuit.yml +1 -0
  49. package/src/patterns/components/profile/profile.wingsuit.yml +1 -0
  50. package/src/patterns/components/readmore/readmore.wingsuit.yml +1 -0
  51. package/src/patterns/components/richtext/richtext.wingsuit.yml +1 -0
  52. package/src/patterns/components/search/index.js +6 -0
  53. package/src/patterns/components/search/search.stories.jsx +10 -0
  54. package/src/patterns/components/search/search.twig +22 -0
  55. package/src/patterns/components/search/search.wingsuit.yml +89 -0
  56. package/src/patterns/components/socialmedia/socialmedia.wingsuit.yml +1 -0
  57. package/src/patterns/components/table/table.wingsuit.yml +1 -0
  58. package/src/patterns/components/tableofcontents/tableofcontents.wingsuit.yml +1 -0
  59. package/src/patterns/components/tabs/tabs.wingsuit.yml +1 -0
  60. package/src/patterns/components/tags/tags.wingsuit.yml +1 -0
  61. package/src/patterns/components/textinput/index.js +7 -0
  62. package/src/patterns/components/textinput/textinput.stories.jsx +10 -0
  63. package/src/patterns/components/textinput/textinput.twig +13 -0
  64. package/src/patterns/components/textinput/textinput.wingsuit.yml +87 -0
  65. package/src/patterns/components/tooltip/tooltip.twig +9 -11
  66. package/src/patterns/components/tooltip/tooltip.wingsuit.yml +7 -0
  67. package/src/patterns/components/video/video.wingsuit.yml +1 -0
  68. package/contributing.md +0 -5
  69. package/src/patterns/components/fieldset/fieldset.twig +0 -44
  70. package/src/patterns/components/form/checkbox.twig +0 -13
  71. package/src/patterns/components/form/checkboxgroup.twig +0 -5
  72. package/src/patterns/components/form/datepicker.twig +0 -41
  73. package/src/patterns/components/searchfield/index.js +0 -6
  74. package/src/patterns/components/searchfield/searchfield.twig +0 -7
  75. package/src/patterns/components/searchfield/searchfield.wingsuit.yml +0 -22
@@ -1,9 +1,9 @@
1
1
 
2
- > @ilo-org/twig@0.9.5 build:lib /home/runner/work/designsystem/designsystem/packages/twig
2
+ > @ilo-org/twig@0.10.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.9.5 output /home/runner/work/designsystem/designsystem/packages/twig
7
+ > @ilo-org/twig@0.10.0 output /home/runner/work/designsystem/designsystem/packages/twig
8
8
  > node outputtwigs.js
9
9
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @ilo-org/twig
2
2
 
3
+ ## 0.10.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 5a4a7255a: This includes an initial refactor of the Form component and exposes several sub-components so they can be used directly by the developer without the Form component if they need to. So far, the Checkbox, Date Picker, Dropdown, Search and Text Input are exposed. Legacy form components have been removed from the documentation and should not be used, they will be refactored and exposed properly in the next version.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [5a4a7255a]
12
+ - Updated dependencies [5a4a7255a]
13
+ - Updated dependencies [5a4a7255a]
14
+ - @ilo-org/themes@0.3.0
15
+ - @ilo-org/styles@0.9.1
16
+
3
17
  ## 0.9.5
4
18
 
5
19
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ilo-org/twig",
3
- "version": "0.9.5",
3
+ "version": "0.10.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.1.0",
26
26
  "@ilo-org/fonts": "0.1.0",
27
27
  "@ilo-org/icons": "0.2.1",
28
- "@ilo-org/styles": "0.9.0",
29
- "@ilo-org/themes": "0.2.0",
28
+ "@ilo-org/styles": "0.9.1",
29
+ "@ilo-org/themes": "0.3.0",
30
30
  "@ilo-org/utils": "0.0.11"
31
31
  },
32
32
  "devDependencies": {
@@ -1,4 +1,5 @@
1
1
  accordion:
2
+ namespace: Components/Content
2
3
  use: "@components/accordion/accordion.twig"
3
4
  label: Accordion
4
5
  description:
@@ -1,4 +1,5 @@
1
1
  breadcrumb:
2
+ namespace: Components/Navigation
2
3
  use: "@components/breadcrumb/breadcrumb.twig"
3
4
  label: Breadcrumb
4
5
  description: A component for displaying links in a "breadcrumb" ux
@@ -1,4 +1,5 @@
1
1
  button:
2
+ namespace: Components/User Interface
2
3
  use: "@components/button/button.twig"
3
4
  label: Button
4
5
  description: A button or a link styled like a button.
@@ -1,4 +1,5 @@
1
1
  callout:
2
+ namespace: Components/Feedback
2
3
  use: "@components/callout/callout.twig"
3
4
  label: Callout
4
5
  description: A callout alert section with a few different types
@@ -1,4 +1,5 @@
1
1
  card:
2
+ namespace: Components/Cards
2
3
  use: "@components/card/card.twig"
3
4
  label: Card
4
5
  description: Cards display prominent content of a page. This component is a wrapper around all of the card types in the design system except for the Hero Card. To use it, pass a `type` setting to the card and then pass the appropriate fields for that card type. For more information about the settings you can pass to each card type, see the documentation for that card.
@@ -32,12 +33,12 @@ card:
32
33
  links:
33
34
  headline: Also available in
34
35
  items:
35
- - label: English
36
- url: "https://www.ilo.org/search?q=link"
37
- - label: Español
38
- url: "https://www.ilo.org/search?q=hyperlink"
39
- - label: Français
40
- url: "https://www.ilo.org/search?q=url"
36
+ - label: English
37
+ url: "https://www.ilo.org/search?q=link"
38
+ - label: Español
39
+ url: "https://www.ilo.org/search?q=hyperlink"
40
+ - label: Français
41
+ url: "https://www.ilo.org/search?q=url"
41
42
  date:
42
43
  type: object
43
44
  label: Date
@@ -88,12 +89,12 @@ card:
88
89
  preview:
89
90
  linkgroup:
90
91
  - links:
91
- - label: Read the press release
92
- url: "https://www.ilo.org"
93
- - label: See the statement
94
- url: "https://www.ilo.org"
95
- - label: Remarks to G7 Openening Session
96
- url: "https://www.ilo.org"
92
+ - label: Read the press release
93
+ url: "https://www.ilo.org"
94
+ - label: See the statement
95
+ url: "https://www.ilo.org"
96
+ - label: Remarks to G7 Openening Session
97
+ url: "https://www.ilo.org"
97
98
  list:
98
99
  type: object
99
100
  label: List
@@ -224,4 +225,4 @@ card:
224
225
  stat:
225
226
  label: Stat Card
226
227
  settings:
227
- type: stat
228
+ type: stat
@@ -1,4 +1,5 @@
1
1
  datacard:
2
+ namespace: Components/Cards
2
3
  use: "@components/card_data/card_data.twig"
3
4
  label: Data Card
4
5
  description: A data card component for organising data about things like publications or events.
@@ -64,8 +65,8 @@ datacard:
64
65
  alt: "Image alt text"
65
66
  loading: "lazy"
66
67
  url:
67
- - breakpoint: "(min-width: 0px)"
68
- src: "/images/publication.jpg"
68
+ - breakpoint: "(min-width: 0px)"
69
+ src: "/images/publication.jpg"
69
70
  settings:
70
71
  size:
71
72
  type: select
@@ -125,8 +126,3 @@ datacard:
125
126
  - label: EPUB 5.8 MB
126
127
  url: "https://www.ilo.org"
127
128
  links: false
128
-
129
-
130
-
131
-
132
-
@@ -1,4 +1,5 @@
1
1
  detailcard:
2
+ namespace: Components/Cards
2
3
  use: "@components/card_detail/card_detail.twig"
3
4
  label: Detail Card
4
5
  description: A detail card component for displaying links to content. It can have an image, title, link, intro text and date.
@@ -68,6 +69,3 @@ detailcard:
68
69
  options:
69
70
  true: True
70
71
  false: False
71
-
72
-
73
-
@@ -1,4 +1,5 @@
1
1
  factlistcard:
2
+ namespace: Components/Cards
2
3
  use: "@components/card_factlist/card_factlist.twig"
3
4
  label: Fact List Card
4
5
  description: A Fact List Card is a card that displays a list of facts or statistics.
@@ -43,7 +44,3 @@ factlistcard:
43
44
  options:
44
45
  dark: Dark
45
46
  light: Light
46
-
47
-
48
-
49
-
@@ -1,4 +1,5 @@
1
1
  featurecard:
2
+ namespace: Components/Cards
2
3
  use: "@components/card_feature/card_feature.twig"
3
4
  label: Feature Card
4
5
  description: A feature card component for displaying links to content. It can have an image, title, link, date and call to action.
@@ -77,6 +78,3 @@ featurecard:
77
78
  options:
78
79
  dark: Dark
79
80
  light: Light
80
-
81
-
82
-
@@ -1,4 +1,5 @@
1
1
  multilinkcard:
2
+ namespace: Components/Cards
2
3
  use: "@components/card_multilink/card_multilink.twig"
3
4
  label: Multilink Card
4
5
  description: A multilink card component for displaying links to content. It can have an image, title, intro text and a list of links displayed at the bottom or on the side of the card.
@@ -44,12 +45,12 @@ multilinkcard:
44
45
  preview:
45
46
  linkgroup:
46
47
  - links:
47
- - label: Read the press release
48
- url: "https://www.ilo.org"
49
- - label: See the statement
50
- url: "https://www.ilo.org"
51
- - label: Remarks to G7 Openening Session
52
- url: "https://www.ilo.org"
48
+ - label: Read the press release
49
+ url: "https://www.ilo.org"
50
+ - label: See the statement
51
+ url: "https://www.ilo.org"
52
+ - label: Remarks to G7 Openening Session
53
+ url: "https://www.ilo.org"
53
54
  title:
54
55
  type: string
55
56
  label: Title
@@ -83,6 +84,3 @@ multilinkcard:
83
84
  narrow: narrow
84
85
  wide: wide
85
86
  fluid: fluid
86
-
87
-
88
-
@@ -1,4 +1,5 @@
1
1
  promocard:
2
+ namespace: Components/Cards
2
3
  use: "@components/card_promo/card_promo.twig"
3
4
  label: Promo Card
4
5
  description: A promo card component for displaying links to content. It can have a title, link, intro and additional call to action.
@@ -68,6 +69,3 @@ promocard:
68
69
  options:
69
70
  dark: Dark
70
71
  light: Light
71
-
72
-
73
-
@@ -1,4 +1,5 @@
1
1
  statcard:
2
+ namespace: Components/Cards
2
3
  use: "@components/card_stat/card_stat.twig"
3
4
  label: Stat Card
4
5
  description: A stat card highlights a prominent fact or statistic with a link to where the information comes from. It can appear in a range of different colors.
@@ -41,8 +42,3 @@ statcard:
41
42
  yellow: yellow
42
43
  blue: blue
43
44
  preview: "blue"
44
-
45
-
46
-
47
-
48
-
@@ -1,4 +1,5 @@
1
1
  textcard:
2
+ namespace: Components/Cards
2
3
  use: "@components/card_text/card_text.twig"
3
4
  label: Text Card
4
5
  description: A text card component for displaying links to content. It can have a title, link, date and profile to highlight the author of the content.
@@ -26,9 +27,9 @@ textcard:
26
27
  label: Profile
27
28
  description: Optional profile of the author who created the content
28
29
  preview:
29
- avatar: "/images/ilo-dg.jpg"
30
- name: "Gilbert F. Houngbo"
31
- role: "ILO Director-General"
30
+ avatar: "/images/ilo-dg.jpg"
31
+ name: "Gilbert F. Houngbo"
32
+ role: "ILO Director-General"
32
33
  title:
33
34
  type: string
34
35
  label: Title
@@ -54,6 +55,3 @@ textcard:
54
55
  options:
55
56
  dark: Dark
56
57
  light: Light
57
-
58
-
59
-
@@ -1,4 +1,5 @@
1
1
  cardgroup:
2
+ namespace: Components/Cards
2
3
  use: "@components/cardgroup/cardgroup.twig"
3
4
  label: Card Group
4
5
  description: A group of cards
@@ -147,7 +148,3 @@ cardgroup:
147
148
  preview:
148
149
  label: "Discover our unique mission"
149
150
  url: "https://www.ilo.org"
150
-
151
-
152
-
153
-
@@ -1,7 +1,7 @@
1
1
  import "./index";
2
2
 
3
3
  export default {};
4
- const patternDefinition = require("./searchfield.wingsuit.yml");
4
+ const patternDefinition = require("./checkbox.wingsuit.yml");
5
5
 
6
6
  /* eslint-disable-next-line */
7
7
  /* eslint-disable-next-line */
@@ -0,0 +1,17 @@
1
+ {# checkbox.twig #}
2
+
3
+ {% extends "@components/form/formcontrol.twig" %}
4
+
5
+ {% set disabled = disabled|default(false) %}
6
+ {% set baseClass = prefix ~ '--checkbox' %}
7
+ {% set errorClass = baseClass ~ '__error' %}
8
+ {% set CheckboxClasses = [baseClass] %}
9
+
10
+ {% if error %}
11
+ {% set CheckboxClasses = CheckboxClasses|merge([errorClass]) %}
12
+ {% endif %}
13
+
14
+
15
+ {% block formfield %}
16
+ <input id="{{ id|default(name) }}" name="{{ name }}" {% if disabled %} disabled {% endif %} {% if required %} required {% endif %} type="checkbox" class="{{ CheckboxClasses|join(' ') }}" {% if defaultChecked %} checked {% endif %} {% if ariaDescribedBy %} aria-describedby="{{ ariaDescribedBy }}" {% endif %} {% if value %} value="{{ value }}" {% endif %}/>
17
+ {% endblock %}
@@ -0,0 +1,83 @@
1
+ checkbox:
2
+ namespace: Components/Forms
3
+ use: "@components/checkbox/checkbox.twig"
4
+ label: Checkbox
5
+ description:
6
+ The checkbox component provides users with a switch they can use to
7
+ select more than one option from a list.
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: checkbox
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,7 @@
1
+ /**
2
+ * tag
3
+ */
4
+ // Module template
5
+ import "./checkbox.twig";
6
+ import "./checkbox.wingsuit.yml";
7
+ import "../tooltip/tooltip.behavior";
@@ -1,4 +1,5 @@
1
1
  contextmenu:
2
+ namespace: Components/Navigation
2
3
  use: "@components/contextmenu/contextmenu.twig"
3
4
  label: Context Menu
4
5
  description: The ContextMenu receives a list of urls with labels and an optional prop indicating if this link is at the end of a 'section.'
@@ -0,0 +1,9 @@
1
+ import "./index";
2
+
3
+ export default {};
4
+ const patternDefinition = require("./datepicker.wingsuit.yml");
5
+
6
+ /* eslint-disable-next-line */
7
+ export const wingsuit = {
8
+ patternDefinition,
9
+ };
@@ -0,0 +1,20 @@
1
+ {# date_picker.html.twig #}
2
+
3
+ {% extends "@components/form/formcontrol.twig" %}
4
+
5
+
6
+ {# Default values and input preparation #}
7
+ {% set disabled = disabled|default(false) %}
8
+ {% set inputClass = prefix ~ '--input' %}
9
+ {% set baseClass = prefix ~ '--datepicker' %}
10
+ {% set datePickerClasses = [inputClass, baseClass] %}
11
+
12
+ {% if error %}
13
+ {% set datePickerClasses = datePickerClasses|merge(['error']) %}
14
+ {% endif %}
15
+
16
+ {% block formfield %}
17
+
18
+ <input type="date" id="{{ id|default(name) }}" name="{{ name }}" {% if onBlur %} onblur="{{ onBlur }}" {% endif %} {% if disabled %} disabled {% endif %} placeholder="{{ placeholder|default('') }}" {% if required %} required {% endif %} class="{{ datePickerClasses|join(' ') }}" {% if max %} max="{{ max }}" {% endif %} {% if min %} min="{{ min }}" {% endif %} {% if step %} step="{{ step }}" {% endif %} {% if ariaDescribedBy %} aria-describedby="{{ ariaDescribedBy }}" {% endif %}/>
19
+
20
+ {% endblock %}
@@ -0,0 +1,71 @@
1
+ datepicker:
2
+ namespace: Components/Forms
3
+ use: "@components/datepicker/datepicker.twig"
4
+ label: Date Picker
5
+ description: The facet component combines the Accordion and the Checkbox components. It's usually used to filter a list of items.
6
+ visibility: storybook
7
+ fields:
8
+ label:
9
+ type: text
10
+ label: Label
11
+ description: The label for the form element.
12
+ preview: "Select a date"
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
+ settings:
35
+ labelPlacement:
36
+ type: select
37
+ label: Label Placement
38
+ description: The placement of the label for the form element.
39
+ preview: "top"
40
+ options:
41
+ start: start
42
+ end: end
43
+ top: top
44
+ bottom: bottom
45
+ labelSize:
46
+ type: select
47
+ label: Label Size
48
+ description: The size of the label for the form element.
49
+ preview: medium
50
+ options:
51
+ small: small
52
+ medium: medium
53
+ large: large
54
+ disabled:
55
+ type: boolean
56
+ label: Disabled
57
+ description: The disabled state of the form element.
58
+ preview: false
59
+ default: false
60
+ required:
61
+ type: boolean
62
+ label: Required
63
+ description: The required state of the form element.
64
+ preview: false
65
+ default: false
66
+ error:
67
+ type: boolean
68
+ label: Error
69
+ description: Adds an error state to the form control.
70
+ preview: false
71
+ default: false
@@ -0,0 +1,7 @@
1
+ /**
2
+ * tag
3
+ */
4
+ // Module template
5
+ import "./datepicker.twig";
6
+ import "./datepicker.wingsuit.yml";
7
+ import "../tooltip/tooltip.behavior";
@@ -1,20 +1,20 @@
1
- {#
2
- DROPDOWN COMPONENT
1
+ {# dropdown.twig #}
3
2
 
4
- Like all form fields, extends the FIELDSET components, and passes it some variables
5
- #}
6
- {% extends '@components/fieldset/fieldset.twig' %}
7
- {% set fsinputid = id ? id : name %}
8
- {% set fslabel = label %}
9
- {% set fshelper = helper %}
10
- {% set fserror = error %}
3
+ {% extends "@components/form/formcontrol.twig" %}
4
+
5
+ {% set disabled = disabled|default(false) %}
6
+ {% set baseClass = prefix ~ '--dropdown' %}
7
+ {% set dropdownClasses = [baseClass, class] %}
8
+ {% if error %}
9
+ {% set dropdownClasses = dropdownClasses|merge(['error']) %}
10
+ {% endif %}
11
11
 
12
12
  {% block formfield %}
13
- <div class="{{prefix}}--dropdown--wrapper">
14
- <select id="{% if id %}{{id}}{% else %}{{name}}{% endif %}" {% if autocomplete is defined %}autocomplete="{{autocomplete}}"{% endif %} name="dropdown" class="{{prefix}}--dropdown{% if error %} error{% endif %}" {% if disabled is defined and disabled == 'true' %}disabled{% endif %}>
15
- {% for option in options %}
16
- <option label="{{option.label}}" value="{{option.value}}" {% if defaultValue is defined and defaultValue == option.value %}selected{% endif %} {% if option.disabled is defined and option.disabled == 'true' %}disabled{% endif %}></option>
17
- {% endfor %}
18
- </select>
19
- </div>
13
+ <div class="{{ baseClass }}--wrapper" {% if style %} style="{{ style }}" {% endif %}>
14
+ <select id="{{ id|default(name) }}" autocomplete="{{ autocomplete|default('off') }}" name="{{ name }}" {% if required %} required {% endif %} {% if onBlur %} onblur="{{ onBlur }}" {% endif %} {% if disabled %} disabled {% endif %} class="{{ dropdownClasses|join(' ') }}" value="{{ currentvalue|default(value) }}" {% if form %} form="{{ form }}" {% endif %} {% if multiple %} multiple {% endif %} {% if selectSize %} size="{{ selectSize }}" {% endif %} {% if ariaDescribedBy %} aria-describedby="{{ ariaDescribedBy }}" {% endif %}>
15
+ {% for option in options %}
16
+ <option {% if option.disabled %} disabled {% endif %} label="{{ option.label }}" value="{{ option.value }}" {% if defaultOption and defaultOption == option.value%}} selected {% endif %}></option>
17
+ {% endfor %}
18
+ </select>
19
+ </div>
20
20
  {% endblock %}