@madgex/design-system 1.45.0 → 1.46.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 (90) hide show
  1. package/coverage/cobertura-coverage.xml +133 -143
  2. package/coverage/components/accordion/accordion.js.html +1 -1
  3. package/coverage/components/accordion/index.html +1 -1
  4. package/coverage/components/inputs/combobox/vue-components/Combobox.vue.html +3 -18
  5. package/coverage/components/inputs/combobox/vue-components/index.html +1 -1
  6. package/coverage/components/inputs/multi-select/vue-components/MultiSelect.vue.html +4 -40
  7. package/coverage/components/inputs/multi-select/vue-components/MultiSelectCheckbox.vue.html +1 -1
  8. package/coverage/components/inputs/multi-select/vue-components/MultiSelectCheckboxGroup.vue.html +1 -1
  9. package/coverage/components/inputs/multi-select/vue-components/index.html +1 -1
  10. package/coverage/components/modal/index.html +1 -1
  11. package/coverage/components/modal/modal.js.html +1 -1
  12. package/coverage/components/notification/index.html +1 -1
  13. package/coverage/components/notification/notification.js.html +1 -1
  14. package/coverage/components/popover/index.html +1 -1
  15. package/coverage/components/popover/popover.js.html +1 -1
  16. package/coverage/components/switch-state/index.html +1 -1
  17. package/coverage/components/switch-state/switch-state.js.html +1 -1
  18. package/coverage/components/tabs/index.html +1 -1
  19. package/coverage/components/tabs/tabs.js.html +1 -1
  20. package/coverage/index.html +13 -13
  21. package/coverage/js/common.js.html +1 -1
  22. package/coverage/js/fractal-scripts/combobox.js.html +7 -10
  23. package/coverage/js/fractal-scripts/index.html +9 -9
  24. package/coverage/js/fractal-scripts/multiselect.js.html +13 -73
  25. package/coverage/js/fractal-scripts/notification.js.html +1 -1
  26. package/coverage/js/fractal-scripts/switch-state.js.html +1 -1
  27. package/coverage/js/index-fractal.js.html +1 -1
  28. package/coverage/js/index-polyfills.js.html +1 -1
  29. package/coverage/js/index-vue.js.html +7 -10
  30. package/coverage/js/index.html +7 -7
  31. package/coverage/js/index.js.html +1 -1
  32. package/coverage/js/polyfills/closest.js.html +1 -1
  33. package/coverage/js/polyfills/index.html +1 -1
  34. package/coverage/js/polyfills/remove.js.html +1 -1
  35. package/coverage/tokens/_config.js.html +1 -1
  36. package/coverage/tokens/index.html +1 -1
  37. package/dist/_tokens/css/_tokens.css +1 -1
  38. package/dist/_tokens/js/_tokens-module.js +1 -1
  39. package/dist/_tokens/scss/_tokens.scss +1 -1
  40. package/dist/assets/icons.json +1 -1
  41. package/dist/css/index.css +1 -1
  42. package/dist/js/index.js +6 -6
  43. package/gulpfile.js +1 -1
  44. package/package.json +1 -1
  45. package/src/components/button/button.scss +0 -8
  46. package/src/components/inputs/_form-elements.scss +129 -0
  47. package/src/components/inputs/_label/_macro.njk +3 -0
  48. package/src/components/inputs/_label/_template.njk +37 -0
  49. package/src/components/inputs/_message/_macro.njk +3 -0
  50. package/src/components/inputs/_message/_template.njk +24 -0
  51. package/src/components/inputs/checkbox/README.md +4 -0
  52. package/src/components/inputs/checkbox/_template.njk +37 -19
  53. package/src/components/inputs/checkbox/checkbox.config.js +2 -3
  54. package/src/components/inputs/checkbox/checkbox.njk +10 -8
  55. package/src/components/inputs/combobox/README.md +5 -1
  56. package/src/components/inputs/combobox/_template.njk +37 -18
  57. package/src/components/inputs/combobox/combobox.scss +3 -31
  58. package/src/components/inputs/combobox/vue-components/Combobox.vue +1 -6
  59. package/src/components/inputs/combobox/vue-components/ComboboxInput.vue +2 -2
  60. package/src/components/inputs/input/_template.njk +16 -49
  61. package/src/components/inputs/input/input.njk +18 -16
  62. package/src/components/inputs/multi-select/README.md +4 -0
  63. package/src/components/inputs/multi-select/_template.njk +24 -12
  64. package/src/components/inputs/multi-select/multi-select.config.js +28 -0
  65. package/src/components/inputs/multi-select/multi-select.njk +10 -6
  66. package/src/components/inputs/multi-select/multi-select.scss +12 -28
  67. package/src/components/inputs/multi-select/vue-components/MultiSelect.vue +2 -14
  68. package/src/components/inputs/radio/README.md +4 -0
  69. package/src/components/inputs/radio/_template.njk +36 -18
  70. package/src/components/inputs/radio/radio.config.js +7 -28
  71. package/src/components/inputs/radio/radio.njk +10 -8
  72. package/src/components/pagination/pagination.scss +10 -6
  73. package/src/components/pagination-numbers/README.md +1 -1
  74. package/src/components/pagination-numbers/_pagination-numbers-number-macro.njk +2 -2
  75. package/src/components/pagination-numbers/_template.njk +23 -12
  76. package/src/js/fractal-scripts/combobox.js +2 -3
  77. package/src/js/fractal-scripts/multiselect.js +7 -27
  78. package/src/js/index-vue.js +1 -2
  79. package/src/layout/containers/04-highlighted-containers.njk +3 -0
  80. package/src/layout/containers/highlighted-containers.config.json +3 -0
  81. package/src/layout/forms/README.md +1 -0
  82. package/src/layout/forms/forms.config.js +74 -0
  83. package/src/layout/forms/forms.njk +80 -0
  84. package/src/scss/components/__index.scss +2 -4
  85. package/src/scss/core/_containers.scss +5 -0
  86. package/src/scss/helpers/__index.scss +1 -1
  87. package/src/scss/import.scss +1 -1
  88. package/src/components/inputs/checkbox/checkbox.scss +0 -69
  89. package/src/components/inputs/input/input.scss +0 -89
  90. package/src/components/inputs/radio/radio.scss +0 -53
package/gulpfile.js CHANGED
@@ -14,7 +14,7 @@ async function clean() {
14
14
  }
15
15
 
16
16
  function watchFiles() {
17
- gulp.watch(['src/scss/core/**/*.scss', 'src/components/**/*.scss'], { awaitWriteFinish: true }, gulp.series(css));
17
+ gulp.watch(['src/scss/**/*.scss', 'src/components/**/*.scss'], { awaitWriteFinish: true }, gulp.series(css));
18
18
  gulp.watch('src/tokens/**/*.json', gulp.series(tokens, css));
19
19
  gulp.watch('src/icons/**/*.svg', gulp.series(svgsprite, fractalBuild));
20
20
  gulp.watch(['src/js/**/*', 'src/components/**/*.js', 'src/components/**/*.vue'], gulp.series(jsbundle));
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@madgex/design-system",
3
3
  "author": "Madgex",
4
4
  "license": "UNLICENSED",
5
- "version": "1.45.0",
5
+ "version": "1.46.1",
6
6
  "scripts": {
7
7
  "clean": "rimraf dist public tokens/build",
8
8
  "commit": "commit",
@@ -14,10 +14,6 @@
14
14
  @extend .mds-font-body-copy;
15
15
  font-family: $mds-font-family-button-base;
16
16
 
17
- @include mq($from: md) {
18
- padding: ($mds-size-baseline * 2) ($mds-size-baseline * 5);
19
- }
20
-
21
17
  &:hover,
22
18
  &:focus {
23
19
  background-color: $mds-color-button-bg-hover;
@@ -28,10 +24,6 @@
28
24
 
29
25
  .mds-button--small {
30
26
  padding: ($mds-size-baseline * 2) ($mds-size-baseline * 3);
31
-
32
- @include mq($from: md) {
33
- padding: ($mds-size-baseline * 1) ($mds-size-baseline * 3);
34
- }
35
27
  }
36
28
 
37
29
  .mds-button--large {
@@ -0,0 +1,129 @@
1
+ .mds-form-field {
2
+ margin-bottom: $mds-size-baseline * 7;
3
+ }
4
+
5
+ .mds-form-label {
6
+ display: flex;
7
+ margin-bottom: $mds-size-baseline * 3;
8
+ }
9
+ .mds-form-label__label {
10
+ font-weight: bold;
11
+ flex: 1;
12
+ }
13
+ .mds-form-label__optional {
14
+ @extend .mds-font-brevier;
15
+ font-weight: normal;
16
+ }
17
+ .mds-form-label__tooltip {
18
+ padding: 0;
19
+ }
20
+
21
+ .mds-form-message {
22
+ @extend .mds-font-brevier;
23
+ margin-bottom: $mds-size-baseline * 4;
24
+
25
+ &--error {
26
+ display: flex;
27
+ align-items: center;
28
+ color: $mds-color-status-error-dark;
29
+
30
+ & .mds-icon-container {
31
+ margin-right: $mds-size-baseline;
32
+ }
33
+ }
34
+ }
35
+
36
+ .mds-form-control {
37
+ width: 100%;
38
+ padding: $mds-size-baseline * 3;
39
+ border-radius: $mds-size-border-radius;
40
+ border: $mds-size-border-width solid $mds-color-border;
41
+ @extend .mds-font-body-copy;
42
+
43
+ &:focus {
44
+ border: 1px solid $mds-color-input-focus;
45
+ outline-color: $mds-color-input-focus;
46
+ box-shadow: 0 0 4px 2px $mds-color-input-focus;
47
+ }
48
+
49
+ .mds-form-element--error & {
50
+ border-color: $mds-color-status-error-dark;
51
+ background-color: $mds-color-status-error-lightest;
52
+ border-left-width: $mds-size-baseline;
53
+ padding-left: $mds-size-baseline * 2;
54
+ &:focus {
55
+ outline-color: $mds-color-status-error-dark;
56
+ box-shadow: 0 0 4px 2px $mds-color-status-error-dark;
57
+ border-color: $mds-color-status-error-dark;
58
+ border-left-width: $mds-size-baseline;
59
+ }
60
+ }
61
+ }
62
+
63
+ .mds-form-check {
64
+ margin-bottom: $mds-size-baseline * 2;
65
+
66
+ &:last-child {
67
+ margin-bottom: 0;
68
+ }
69
+ }
70
+ .mds-form-check__input {
71
+ display: inline-block;
72
+ position: relative;
73
+ vertical-align: text-bottom;
74
+ appearance: none;
75
+ height: $mds-size-baseline * 5;
76
+ width: $mds-size-baseline * 5;
77
+ padding: $mds-size-baseline;
78
+ border: $mds-color-input-border;
79
+ background-color: $mds-color-neutral-white;
80
+ outline: 0;
81
+ margin-right: $mds-size-baseline * 2;
82
+ cursor: pointer;
83
+
84
+ &:hover,
85
+ &:focus {
86
+ box-shadow: $mds-color-input-shadow-focus;
87
+ }
88
+
89
+ &:disabled {
90
+ border-color: $mds-color-input-disabled-field;
91
+ background: $mds-color-input-disabled-field;
92
+ box-shadow: none;
93
+ cursor: auto;
94
+
95
+ & + .mds-form-check__label {
96
+ color: $mds-color-input-disabled-label;
97
+ }
98
+ }
99
+
100
+ .mds-form-element--checkbox & {
101
+ border-radius: $mds-size-border-radius;
102
+
103
+ &:checked:before {
104
+ content: '\2713';
105
+ display: flex;
106
+ justify-content: center;
107
+ align-items: center;
108
+ width: 100%;
109
+ height: 100%;
110
+ color: $mds-color-input-checked;
111
+ }
112
+ }
113
+ .mds-form-element--radio & {
114
+ border-radius: 50%;
115
+
116
+ &:checked:before {
117
+ content: '';
118
+ display: block;
119
+ width: 100%;
120
+ height: 100%;
121
+ border-radius: 50%;
122
+ background-color: $mds-color-input-checked;
123
+ }
124
+ }
125
+ }
126
+
127
+ .js .mds-form-element__fallback {
128
+ display: none;
129
+ }
@@ -0,0 +1,3 @@
1
+ {% macro MdsInputLabel(params) %}
2
+ {%- include "./_template.njk" -%}
3
+ {% endmacro %}
@@ -0,0 +1,37 @@
1
+ {% from "../../icons/_macro.njk" import MdsIcon %}
2
+ {% from "../../popover/_macro.njk" import MdsPopover %}
3
+
4
+ {%- set classes -%}{#
5
+ #}mds-form-label__label{% if params.hideLabel %} mds-visually-hidden{% endif -%}
6
+ {%- endset -%}
7
+
8
+ <div class="mds-form-label">
9
+ {%- if params.element == 'legend' -%}
10
+ <legend class="{{ classes }}">
11
+ {%- else -%}
12
+ <label class="{{ classes }}" for="{{ params.id }}">
13
+ {%- endif -%}
14
+ {{ params.labelText }}
15
+ {%- if params.optional -%}
16
+ <span class="mds-form-label__optional"> (optional)</span>
17
+ {%- endif -%}
18
+ {%- if params.element == 'legend' -%}
19
+ </legend>
20
+ {%- else -%}
21
+ </label>
22
+ {%- endif -%}
23
+
24
+ {%- if params.tooltipMessage -%}
25
+ {{- MdsPopover({
26
+ id: params.id + '-tooltip',
27
+ text: MdsIcon({
28
+ iconName: 'question-mark',
29
+ classes: 'mds-icon--info',
30
+ visuallyHiddenLabel: 'More info'
31
+ }),
32
+ placement: 'right',
33
+ classes: 'mds-button mds-button--plain mds-form-label__tooltip',
34
+ content: params.tooltipMessage
35
+ }) -}}
36
+ {%- endif -%}
37
+ </div>
@@ -0,0 +1,3 @@
1
+ {% macro MdsInputMessages(params) %}
2
+ {%- include "./_template.njk" -%}
3
+ {% endmacro %}
@@ -0,0 +1,24 @@
1
+ {% from "../../icons/_macro.njk" import MdsIcon %}
2
+
3
+ {% if params.helpText %}
4
+ <div
5
+ class="mds-form-message"
6
+ id="{{ params.id }}-help-text">
7
+ {{ params.helpText }}
8
+ </div>
9
+ {% endif %}
10
+ {% if params.validationError %}
11
+ <div
12
+ aria-live="polite"
13
+ class="mds-form-message mds-form-message--error"
14
+ id="{{ params.id }}-validation-error">
15
+ {{- MdsIcon({
16
+ iconName: 'cross',
17
+ classes: 'mds-icon--sm',
18
+ hasContainer: true,
19
+ containerClasses: 'mds-icon-container--circle mds-icon-container--error'
20
+ })
21
+ -}}
22
+ {{- params.validationError -}}
23
+ </div>
24
+ {% endif %}
@@ -4,6 +4,10 @@
4
4
  - `name`: The name of the input field, uses ID unless specified **optional**,
5
5
  - `id`: The id attribute of the field, **required**
6
6
  - `disabled`: Should the input be disabled **optional**,
7
+ - `helpText`: Helper text to display under the label **optional**,
8
+ - `tooltipMessage`: Toggles a tooltip with this message to appear on the input **optional**
9
+ - `validationError`: The error message provided by validation **optional**,
10
+ - `state`: The current state of the input, currently the only allowed value is `error` **optional**
7
11
  - `classes`: add extra classes to the fieldgroup - **optional**
8
12
  - `options`: This is an object of all options, See an example option below
9
13
  ```
@@ -1,25 +1,43 @@
1
+ {% from "../_label/_macro.njk" import MdsInputLabel %}
2
+ {% from "../_message/_macro.njk" import MdsInputMessages %}
3
+
1
4
  {%- if params.name -%}
2
5
  {%- set name = params.name -%}
3
6
  {%- else -%}
4
7
  {%- set name = params.id -%}
5
8
  {%- endif -%}
6
9
 
7
- <div class="mds-checkbox__group{% if params.classes %} {{params.classes}}{% endif %}" id="{{params.id}}" data-test="checkbox">
8
- <legend>{{params.labelText}}</legend>
9
- {%- for checkbox in params.options -%}
10
- <div class="mds-checkbox{% if checkbox.classes %} {{checkbox.classes}}{% endif %}">
11
- <input
12
- type="checkbox"
13
- class="mds-checkbox__input"
14
- name="{{name}}"
15
- id="{{checkbox.id}}"
16
- {% if params.disabled %}disabled="disabled"{% endif %}
17
- {% if checkbox.selected %}checked="checked"{% endif %}
18
- value="{{checkbox.value}}"
19
- />
20
- <label class="mds-checkbox__label" for="{{checkbox.id}}">
21
- {{checkbox.labelText}}
22
- </label>
23
- </div>
24
- {% endfor %}
25
- </fieldset>
10
+ <div class="mds-form-element mds-form-element--checkbox{% if params.classes %} {{params.classes}}{% endif %}" id="{{params.id}}" data-test="checkbox">
11
+ <fieldset>
12
+ {{ MdsInputLabel({
13
+ element: 'legend',
14
+ labelText: params.labelText,
15
+ hideLabel: params.hideLabel,
16
+ id: params.id,
17
+ optional: params.optional,
18
+ tooltipMessage: params.tooltipMessage
19
+ }) }}
20
+ {{ MdsInputMessages({
21
+ id: params.id,
22
+ helpText: params.helpText,
23
+ validationError: params.validationError
24
+ }) }}
25
+ {%- for checkbox in params.options -%}
26
+ <div class="mds-form-check{% if checkbox.classes %} {{checkbox.classes}}{% endif %}">
27
+ <input
28
+ type="checkbox"
29
+ class="mds-form-check__input"
30
+ name="{{name}}"
31
+ id="{{checkbox.id}}"
32
+ {% if params.disabled %}disabled="disabled"{% endif %}
33
+ {% if checkbox.selected %}checked="checked"{% endif %}
34
+ value="{{checkbox.value}}"
35
+ />{#
36
+ # Avoid extra space created by line breaks #
37
+ #}<label class="mds-form-check__label" for="{{checkbox.id}}">{#
38
+ #}{{checkbox.labelText}}{#
39
+ #}</label>
40
+ </div>
41
+ {% endfor %}
42
+ </fieldset>
43
+ </div>
@@ -3,7 +3,7 @@ module.exports = {
3
3
  status: 'wip',
4
4
  context: {
5
5
  id: 'checkbox-input',
6
- labelText: 'Standard checkbox Group',
6
+ labelText: 'Standard checkbox group',
7
7
  options: [
8
8
  {
9
9
  labelText: 'Checkbox Input 1',
@@ -23,13 +23,12 @@ module.exports = {
23
23
  context: {
24
24
  id: 'inline-checkbox-using-class',
25
25
  labelText: 'Inline checkbox using class',
26
- classes: 'mds-display-inline-block',
27
26
  options: [
28
27
  {
29
28
  labelText: 'Checkbox Input 1',
30
29
  value: '2-1',
31
30
  id: 'checkbox-2-1',
32
- classes: 'mds-display-inline-block',
31
+ classes: 'mds-display-inline-block mds-margin-right-b2',
33
32
  },
34
33
  {
35
34
  labelText: 'Checkbox Input 2',
@@ -1,10 +1,12 @@
1
1
  {% from "./inputs/checkbox/_macro.njk" import MdsCheckbox %}
2
2
 
3
- {{ MdsCheckbox({
4
- labelText: labelText,
5
- name: name,
6
- id: id,
7
- disabled: disabled,
8
- options: options,
9
- classes: classes
10
- }) }}
3
+ <div class="mds-form-field">
4
+ {{ MdsCheckbox({
5
+ labelText: labelText,
6
+ name: name,
7
+ id: id,
8
+ disabled: disabled,
9
+ options: options,
10
+ classes: classes
11
+ }) }}
12
+ </div>
@@ -1,13 +1,17 @@
1
1
  ## Parameters - Nunjucks
2
2
 
3
3
  - `id`: the id of your combobox
4
- - `name`: the name of the input for form submission
4
+ - `name`: the name of the input for form submission. Uses ID unless specified - _optional_
5
5
  - `resultMessage`: to be used as a prop for the Vue component below, will not be used if Javascript is not available
6
6
  - `labelText`: the text used in the label
7
7
  - `options`: a json object of key, value pairs e.g { 45: 'Orange' }. To be used when falling back to a native select if Javascript is not available
8
8
  - `fallbackTo`: the form element to use as a fallback. Should be either 'select' or 'input'
9
9
  - `placeholder`: the placeholder for your input (defaults to 'Please select')
10
10
  - `classes`: add extra classes to the trigger - _optional_
11
+ - `helpText`: Helper text to display under the label _optional_,
12
+ - `tooltipMessage`: Toggles a tooltip with this message to appear on the input _optional_
13
+ - `validationError`: The error message provided by validation _optional_,
14
+ - `state`: The current state of the input, currently the only allowed value is `error` _optional_
11
15
 
12
16
  ## Props - Vue component
13
17
 
@@ -1,4 +1,5 @@
1
- {% from "../../icons/_macro.njk" import MdsIcon %}
1
+ {% from "../_label/_macro.njk" import MdsInputLabel %}
2
+ {% from "../_message/_macro.njk" import MdsInputMessages %}
2
3
 
3
4
  {%- set comboboxId %}
4
5
  {%- if params.id -%}
@@ -14,6 +15,12 @@
14
15
  {%- endif -%}
15
16
  {% endset -%}
16
17
 
18
+ {% if params.name %}
19
+ {% set comboboxName = params.name %}
20
+ {% else %}
21
+ {% set comboboxName = comboboxId %}
22
+ {% endif %}
23
+
17
24
  {%- set placeholder %}
18
25
  {%- if params.placeholder -%}
19
26
  {{ params.placeholder }}
@@ -23,23 +30,35 @@
23
30
  {% endset -%}
24
31
 
25
32
  {%- if comboboxId -%}
26
- <div class="mds-combobox js-mds-combobox {% if params.classes %} {{params.classes}}{% endif %}" data-combobox-id="{{ comboboxId }}" data-test="combobox">
27
- <label class="mds-combobox__label mds-font-pica mds-combobox--fallback" id="{{ comboboxId }}-label" for="{{ comboboxId }}">{{ params.labelText }}</label>
28
- {% if params.fallbackTo === 'select' and params.options %}
29
- <select class="mds-combobox__select mds-combobox--fallback" id="select-{{ comboboxId }}" name="{{ params.name }}" aria-labelledby="{{ comboboxId }}-label" value="{{ params.defaultValue|default('') }}">
30
- <option>{{ placeholder }}</option>
31
- {%- if params.options -%}
32
- {%- for value, option in params.options -%}
33
- <option value="{{ value }}">{{ option }}</option>
34
- {%- endfor -%}
35
- {%- endif -%}
36
- </select>
37
- {% elseif params.fallbackTo === 'input' %}
38
- <input class="mds-combobox__input mds-border mds-border-radius mds-combobox--fallback" autocomplete="off" name="{{ params.name }}" type="text"
39
- id="{{ comboboxId }}" aria-labelledby="{{ comboboxId }}-label" value="{{ params.defaultValue|default('') }}" placeholder="{{ placeholder }}">
40
- {% endif %}
33
+ <div class="mds-form-element mds-form-element--combobox js-mds-combobox{% if params.classes %} {{params.classes}}{% endif %}{% if params.state %} mds-form-element--{{params.state}}{% endif %}" data-combobox-id="{{ comboboxId }}" data-test="combobox">
34
+ {{ MdsInputLabel({
35
+ labelText: params.labelText,
36
+ hideLabel: params.hideLabel,
37
+ id: comboboxId,
38
+ optional: params.optional,
39
+ tooltipMessage: params.tooltipMessage
40
+ }) }}
41
+ {{ MdsInputMessages({
42
+ id: comboboxId,
43
+ helpText: params.helpText,
44
+ validationError: params.validationError
45
+ }) }}
46
+ <div class="mds-form-element__fallback">
47
+ {% if params.fallbackTo === 'select' and params.options %}
48
+ <select class="mds-form-control" id="select-{{ comboboxId }}" name="{{ comboboxName }}" aria-labelledby="{{ comboboxId }}-label" value="{{ params.defaultValue|default('') }}">
49
+ <option>{{ placeholder }}</option>
50
+ {%- if params.options -%}
51
+ {%- for value, option in params.options -%}
52
+ <option value="{{ value }}">{{ option }}</option>
53
+ {%- endfor -%}
54
+ {%- endif -%}
55
+ </select>
56
+ {% elseif params.fallbackTo === 'input' %}
57
+ <input class="mds-form-control" type="text" name="{{ comboboxName }}" autocomplete="off" id="{{ comboboxId }}" value="{{ params.defaultValue|default('') }}" placeholder="{{ placeholder }}" />
58
+ {% endif %}
59
+ </div>
41
60
  {# Leave the custom element at the bottom so it has access to the above elements on render #}
42
- <mds-combobox comboboxid="{{ comboboxId }}" labeltext="{{ params.labelText }}" placeholder="{{ placeholder }}"
43
- {% if params.fallbackTo === 'input' %}name="{{ params.name }}"{% endif %} {% if params.resultMessage %}resultmessage="{{ params.resultMessage }}"{% endif %}></mds-combobox>
61
+ <mds-combobox comboboxid="{{ comboboxId }}" placeholder="{{ placeholder }}"
62
+ {% if params.fallbackTo === 'input' %}name="{{ comboboxName }}"{% endif %} {% if params.resultMessage %}resultmessage="{{ params.resultMessage }}"{% endif %}></mds-combobox>
44
63
  </div>
45
64
  {%- endif -%}
@@ -2,24 +2,6 @@
2
2
  display: block;
3
3
  position: relative;
4
4
  }
5
-
6
- .mds-combobox__input,
7
- .mds-combobox__select {
8
- width: 100%;
9
- padding: $mds-size-baseline * 3;
10
- border-radius: $mds-size-border-radius;
11
- border: $mds-size-border-width solid $mds-color-border;
12
- margin-right: $mds-size-baseline * 4;
13
- display: inline-block;
14
- &:focus {
15
- border-color: $mds-color-neutral-base;
16
- }
17
- }
18
-
19
- .mds-combobox__input-wrapper {
20
- position: relative;
21
- }
22
-
23
5
  .mds-combobox__listbox {
24
6
  border: $mds-size-border-width solid $mds-color-border;
25
7
  border-top: none;
@@ -30,10 +12,12 @@
30
12
  max-height: 250px;
31
13
  overflow-y: scroll;
32
14
  @include z-index();
33
- .mds-combobox__option {
15
+
16
+ & .mds-combobox__option {
34
17
  @extend .mds-font-pica;
35
18
  padding: $mds-size-baseline;
36
19
  background-color: $mds-color-neutral-white;
20
+
37
21
  &.mds-combobox__option--focused,
38
22
  &:hover {
39
23
  cursor: pointer;
@@ -41,15 +25,3 @@
41
25
  }
42
26
  }
43
27
  }
44
-
45
- .mds-combobox--active .mds-combobox__listbox {
46
- border-color: $mds-color-neutral-base;
47
- }
48
- .mds-combobox--active .mds-combobox__input {
49
- border-radius: $mds-size-border-radius $mds-size-border-radius 0 0;
50
- border-bottom-color: $mds-color-border;
51
- }
52
-
53
- .js .mds-combobox .mds-combobox--fallback {
54
- display: none;
55
- }
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div
3
- class="mds-combobox js-mds-combobox"
3
+ class="mds-combobox"
4
4
  :class="{ 'mds-combobox--active': !listBoxHidden }"
5
5
  @keydown.down="hiddenGuard(onKeyDown)"
6
6
  @keydown.up="hiddenGuard(onKeyUp)"
@@ -9,7 +9,6 @@
9
9
  @keydown.esc="makeInactive"
10
10
  @keydown.enter="chooseOption"
11
11
  >
12
- <label class="mds-combobox__label" :id="labelId" :for="comboboxid">{{ labeltext }}</label>
13
12
  <ComboboxInput
14
13
  @focus="makeActive"
15
14
  @blur="onInputBlur"
@@ -57,10 +56,6 @@ export default {
57
56
  type: String,
58
57
  required: true,
59
58
  },
60
- labeltext: {
61
- type: String,
62
- required: true,
63
- },
64
59
  placeholder: {
65
60
  type: String,
66
61
  default: 'Please combobox',
@@ -1,8 +1,8 @@
1
1
  <template>
2
- <div role="presentation" class="mds-combobox__input-wrapper">
2
+ <div role="presentation">
3
3
  <input
4
4
  v-bind="$attrs"
5
- class="mds-combobox__input"
5
+ class="mds-form-control"
6
6
  autocomplete="off"
7
7
  type="text"
8
8
  :value="value"
@@ -1,5 +1,5 @@
1
- {% from "../../icons/_macro.njk" import MdsIcon %}
2
- {% from "../../popover/_macro.njk" import MdsPopover %}
1
+ {% from "../_label/_macro.njk" import MdsInputLabel %}
2
+ {% from "../_message/_macro.njk" import MdsInputMessages %}
3
3
 
4
4
  {% if params.name %}
5
5
  {% set name = params.name %}
@@ -7,53 +7,21 @@
7
7
  {% set name = params.id %}
8
8
  {% endif %}
9
9
 
10
- <div class="mds-input{% if params.validationMessage %} mds-input--has-msg{% endif %}{% if params.state %} mds-input--{{params.state}}{% endif %}{% if params.classes %} {{params.classes}}{% endif %}" id="{{ params.id }}-container" data-test="input">
11
- <div class="mds-input__wrapper-label">
12
- <label class="mds-input__label{% if params.hideLabel %} mds-visually-hidden{% endif %}" for="{{ params.id }}">
13
- {{ params.labelText }}
14
- {% if params.optional %}
15
- <span class="mds-input__label-optional mds-font-minion">(optional)</span>
16
- {% endif %}
17
- </label>
18
- {% if params.tooltipMessage %}
19
- {{- MdsPopover({
20
- id: params.id + '-tooltip',
21
- text: MdsIcon({
22
- iconName: 'question-mark',
23
- classes: 'mds-icon--info',
24
- visuallyHiddenLabel: 'More info'
25
- }),
26
- placement: 'right',
27
- classes: 'mds-button mds-button--plain mds-input__tooltip',
28
- content: params.tooltipMessage
29
- }) -}}
30
- {% endif %}
31
- </div>
32
- {% if params.helpText %}
33
- <div
34
- class="mds-input__msg"
35
- id="{{ params.id }}-help-text">
36
- {{ params.helpText }}
37
- </div>
38
- {% endif %}
39
- {% if params.validationError %}
40
- <div
41
- aria-live="polite"
42
- class="mds-input__msg mds-input__msg--error"
43
- id="{{ params.id }}-validation-error">
44
- {{- MdsIcon({
45
- iconName: 'cross',
46
- classes: 'mds-icon--sm',
47
- hasContainer: true,
48
- containerClasses: 'mds-icon--error mds-icon-container--circle mds-icon-container--error'
49
- })
50
- -}}
51
- {{ params.validationError }}
52
- </div>
53
- {% endif %}
54
- <div class="mds-input__wrapper-input">
10
+ <div class="mds-form-element mds-form-element--input{% if params.state %} mds-form-element--{{params.state}}{% endif %}{% if params.classes %} {{params.classes}}{% endif %}" id="{{ params.id }}-container" data-test="input">
11
+ {{ MdsInputLabel({
12
+ labelText: params.labelText,
13
+ hideLabel: params.hideLabel,
14
+ id: params.id,
15
+ optional: params.optional,
16
+ tooltipMessage: params.tooltipMessage
17
+ }) }}
18
+ {{ MdsInputMessages({
19
+ id: params.id,
20
+ helpText: params.helpText,
21
+ validationError: params.validationError
22
+ }) }}
55
23
  <input
56
- class="mds-input__input"
24
+ class="mds-form-control"
57
25
  type="{{ params.type }}"
58
26
  name="{{ name }}"
59
27
  id="{{ params.id }}"
@@ -70,5 +38,4 @@
70
38
  value="{{params.value}}"
71
39
  {% endif %}
72
40
  />
73
- </div>
74
41
  </div>