@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.
- package/coverage/cobertura-coverage.xml +133 -143
- package/coverage/components/accordion/accordion.js.html +1 -1
- package/coverage/components/accordion/index.html +1 -1
- package/coverage/components/inputs/combobox/vue-components/Combobox.vue.html +3 -18
- package/coverage/components/inputs/combobox/vue-components/index.html +1 -1
- package/coverage/components/inputs/multi-select/vue-components/MultiSelect.vue.html +4 -40
- package/coverage/components/inputs/multi-select/vue-components/MultiSelectCheckbox.vue.html +1 -1
- package/coverage/components/inputs/multi-select/vue-components/MultiSelectCheckboxGroup.vue.html +1 -1
- package/coverage/components/inputs/multi-select/vue-components/index.html +1 -1
- package/coverage/components/modal/index.html +1 -1
- package/coverage/components/modal/modal.js.html +1 -1
- package/coverage/components/notification/index.html +1 -1
- package/coverage/components/notification/notification.js.html +1 -1
- package/coverage/components/popover/index.html +1 -1
- package/coverage/components/popover/popover.js.html +1 -1
- package/coverage/components/switch-state/index.html +1 -1
- package/coverage/components/switch-state/switch-state.js.html +1 -1
- package/coverage/components/tabs/index.html +1 -1
- package/coverage/components/tabs/tabs.js.html +1 -1
- package/coverage/index.html +13 -13
- package/coverage/js/common.js.html +1 -1
- package/coverage/js/fractal-scripts/combobox.js.html +7 -10
- package/coverage/js/fractal-scripts/index.html +9 -9
- package/coverage/js/fractal-scripts/multiselect.js.html +13 -73
- package/coverage/js/fractal-scripts/notification.js.html +1 -1
- package/coverage/js/fractal-scripts/switch-state.js.html +1 -1
- package/coverage/js/index-fractal.js.html +1 -1
- package/coverage/js/index-polyfills.js.html +1 -1
- package/coverage/js/index-vue.js.html +7 -10
- package/coverage/js/index.html +7 -7
- package/coverage/js/index.js.html +1 -1
- package/coverage/js/polyfills/closest.js.html +1 -1
- package/coverage/js/polyfills/index.html +1 -1
- package/coverage/js/polyfills/remove.js.html +1 -1
- package/coverage/tokens/_config.js.html +1 -1
- package/coverage/tokens/index.html +1 -1
- package/dist/_tokens/css/_tokens.css +1 -1
- package/dist/_tokens/js/_tokens-module.js +1 -1
- package/dist/_tokens/scss/_tokens.scss +1 -1
- package/dist/assets/icons.json +1 -1
- package/dist/css/index.css +1 -1
- package/dist/js/index.js +6 -6
- package/gulpfile.js +1 -1
- package/package.json +1 -1
- package/src/components/button/button.scss +0 -8
- package/src/components/inputs/_form-elements.scss +129 -0
- package/src/components/inputs/_label/_macro.njk +3 -0
- package/src/components/inputs/_label/_template.njk +37 -0
- package/src/components/inputs/_message/_macro.njk +3 -0
- package/src/components/inputs/_message/_template.njk +24 -0
- package/src/components/inputs/checkbox/README.md +4 -0
- package/src/components/inputs/checkbox/_template.njk +37 -19
- package/src/components/inputs/checkbox/checkbox.config.js +2 -3
- package/src/components/inputs/checkbox/checkbox.njk +10 -8
- package/src/components/inputs/combobox/README.md +5 -1
- package/src/components/inputs/combobox/_template.njk +37 -18
- package/src/components/inputs/combobox/combobox.scss +3 -31
- package/src/components/inputs/combobox/vue-components/Combobox.vue +1 -6
- package/src/components/inputs/combobox/vue-components/ComboboxInput.vue +2 -2
- package/src/components/inputs/input/_template.njk +16 -49
- package/src/components/inputs/input/input.njk +18 -16
- package/src/components/inputs/multi-select/README.md +4 -0
- package/src/components/inputs/multi-select/_template.njk +24 -12
- package/src/components/inputs/multi-select/multi-select.config.js +28 -0
- package/src/components/inputs/multi-select/multi-select.njk +10 -6
- package/src/components/inputs/multi-select/multi-select.scss +12 -28
- package/src/components/inputs/multi-select/vue-components/MultiSelect.vue +2 -14
- package/src/components/inputs/radio/README.md +4 -0
- package/src/components/inputs/radio/_template.njk +36 -18
- package/src/components/inputs/radio/radio.config.js +7 -28
- package/src/components/inputs/radio/radio.njk +10 -8
- package/src/components/pagination/pagination.scss +10 -6
- package/src/components/pagination-numbers/README.md +1 -1
- package/src/components/pagination-numbers/_pagination-numbers-number-macro.njk +2 -2
- package/src/components/pagination-numbers/_template.njk +23 -12
- package/src/js/fractal-scripts/combobox.js +2 -3
- package/src/js/fractal-scripts/multiselect.js +7 -27
- package/src/js/index-vue.js +1 -2
- package/src/layout/containers/04-highlighted-containers.njk +3 -0
- package/src/layout/containers/highlighted-containers.config.json +3 -0
- package/src/layout/forms/README.md +1 -0
- package/src/layout/forms/forms.config.js +74 -0
- package/src/layout/forms/forms.njk +80 -0
- package/src/scss/components/__index.scss +2 -4
- package/src/scss/core/_containers.scss +5 -0
- package/src/scss/helpers/__index.scss +1 -1
- package/src/scss/import.scss +1 -1
- package/src/components/inputs/checkbox/checkbox.scss +0 -69
- package/src/components/inputs/input/input.scss +0 -89
- package/src/components/inputs/radio/radio.scss +0 -53
|
@@ -2,21 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
<div class="mds-grid-row">
|
|
4
4
|
<div class="mds-grid-col-6">
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
5
|
+
<div class="mds-form-field">
|
|
6
|
+
{{ MdsInput({
|
|
7
|
+
labelText: labelText,
|
|
8
|
+
hideLabel: hideLabel,
|
|
9
|
+
name: name,
|
|
10
|
+
id: id,
|
|
11
|
+
type: type,
|
|
12
|
+
value:value,
|
|
13
|
+
optional: optional,
|
|
14
|
+
disabled: disabled,
|
|
15
|
+
placeholder: placeholder,
|
|
16
|
+
helpText: helpText,
|
|
17
|
+
validationError: validationError,
|
|
18
|
+
state: state,
|
|
19
|
+
classes: classes,
|
|
20
|
+
tooltipMessage: tooltipMessage
|
|
21
|
+
}) }}
|
|
22
|
+
</div>
|
|
21
23
|
</div>
|
|
22
24
|
</div>
|
|
@@ -8,6 +8,10 @@
|
|
|
8
8
|
- `selected`: whether the checkbox is pre-selected **optional**,
|
|
9
9
|
- `terms`: an array of child terms of this term **optional**
|
|
10
10
|
- `optional`: Is the multi-select optional, otherwise required **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
|
## Accessibility
|
|
13
17
|
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
{% from "../_label/_macro.njk" import MdsInputLabel %}
|
|
2
|
+
{% from "../_message/_macro.njk" import MdsInputMessages %}
|
|
3
|
+
|
|
1
4
|
{% macro MdsMultiSelectCheckboxGroup(terms, name, nested = false) %}
|
|
2
5
|
{% if terms and terms.length %}
|
|
3
6
|
<div class="mds-multiselect__checkbox-group{% if nested %} mds-multiselect__checkbox-group--nested{% endif %}">
|
|
@@ -13,19 +16,28 @@
|
|
|
13
16
|
{% endif %}
|
|
14
17
|
{% endmacro %}
|
|
15
18
|
|
|
16
|
-
<div class="mds-multiselect js-mds-multiselect
|
|
17
|
-
<fieldset
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
<div class="mds-form-element mds-form-element--multiselect js-mds-multiselect{% if params.state %} mds-form-element--{{params.state}}{% endif %}" data-test="multiselect">
|
|
20
|
+
<fieldset>
|
|
21
|
+
{{ MdsInputLabel({
|
|
22
|
+
element: 'legend',
|
|
23
|
+
labelText: params.labelText,
|
|
24
|
+
hideLabel: params.hideLabel,
|
|
25
|
+
id: params.id,
|
|
26
|
+
optional: params.optional,
|
|
27
|
+
tooltipMessage: params.tooltipMessage
|
|
28
|
+
}) }}
|
|
29
|
+
{{ MdsInputMessages({
|
|
30
|
+
id: params.name,
|
|
31
|
+
helpText: params.helpText,
|
|
32
|
+
validationError: params.validationError
|
|
33
|
+
}) }}
|
|
34
|
+
|
|
35
|
+
<div class="mds-form-element__fallback mds-multiselect">
|
|
36
|
+
{{ MdsMultiSelectCheckboxGroup(params.terms, params.name) }}
|
|
26
37
|
</div>
|
|
38
|
+
|
|
39
|
+
{# Leave the custom element at the bottom so it has access to the above elements on render #}
|
|
40
|
+
<mds-multiselect name="{{params.name}}" labeltext="{{ params.labelText }}" optional="{{params.optional}}"></mds-multiselect>
|
|
27
41
|
</fieldset>
|
|
28
|
-
{# Leave the custom element at the bottom so it has access to the above elements on render #}
|
|
29
|
-
<mds-multiselect name="{{params.name}}" labeltext="{{ params.labelText }}" optional="{{params.optional}}"></mds-multiselect>
|
|
30
42
|
</div>
|
|
31
43
|
|
|
@@ -119,5 +119,33 @@ module.exports = {
|
|
|
119
119
|
],
|
|
120
120
|
},
|
|
121
121
|
},
|
|
122
|
+
{
|
|
123
|
+
name: 'With error',
|
|
124
|
+
context: {
|
|
125
|
+
labelText: 'Role',
|
|
126
|
+
name: 'role-with-error',
|
|
127
|
+
optional: true,
|
|
128
|
+
state: 'error',
|
|
129
|
+
validationError: 'Please select a maximum of 2 terms',
|
|
130
|
+
terms: [
|
|
131
|
+
{ id: 7, label: 'Academic Pharmacist', terms: [] },
|
|
132
|
+
{ id: 1, label: 'Community Pharmacist', terms: [] },
|
|
133
|
+
{ id: 10, label: 'Dispensing Assistant', terms: [] },
|
|
134
|
+
{ id: 4, label: 'Hospital Pharmacist', selected: true, terms: [] },
|
|
135
|
+
{ id: 6, label: 'Industrial Pharmacist', selected: true, terms: [] },
|
|
136
|
+
{ id: 3, label: 'Locum Pharmacist', terms: [] },
|
|
137
|
+
{ id: 11, label: 'Medicines Counter Assistant', terms: [] },
|
|
138
|
+
{ id: 2, label: 'Pharmacy Manager', terms: [] },
|
|
139
|
+
{ id: 12, label: 'Pharmacy Student', terms: [] },
|
|
140
|
+
{ id: 9, label: 'Pharmacy Technician', terms: [] },
|
|
141
|
+
{ id: 8, label: 'Pre-reg Pharmacist', selected: true, terms: [] },
|
|
142
|
+
{ id: 513016, label: 'Primary Care Pharmacist', terms: [] },
|
|
143
|
+
{ id: 513015, label: 'Region/Area Manager', terms: [] },
|
|
144
|
+
{ id: 5, label: 'Senior Management', terms: [] },
|
|
145
|
+
{ id: 513014, label: 'Superintendent Pharmacist', terms: [] },
|
|
146
|
+
{ id: 13, label: 'Other Pharmacy roles', terms: [] },
|
|
147
|
+
],
|
|
148
|
+
},
|
|
149
|
+
},
|
|
122
150
|
],
|
|
123
151
|
};
|
|
@@ -2,11 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
<div class="mds-grid-row">
|
|
4
4
|
<div class="mds-grid-col-6">
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
<div class="mds-form-field">
|
|
6
|
+
{{ MdsMultiSelect({
|
|
7
|
+
labelText: labelText,
|
|
8
|
+
name: name,
|
|
9
|
+
optional: optional,
|
|
10
|
+
terms: terms,
|
|
11
|
+
state: state,
|
|
12
|
+
validationError: validationError
|
|
13
|
+
}) }}
|
|
14
|
+
</div>
|
|
11
15
|
</div>
|
|
12
16
|
</div>
|
|
@@ -1,33 +1,15 @@
|
|
|
1
1
|
.mds-multiselect {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
&-optional {
|
|
10
|
-
@extend .mds-font-minion;
|
|
11
|
-
font-weight: normal;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
& fieldset {
|
|
15
|
-
padding: 0;
|
|
16
|
-
}
|
|
17
|
-
&__scrollable {
|
|
18
|
-
border-radius: $mds-size-border-radius;
|
|
19
|
-
border: $mds-size-border-width solid $mds-color-border;
|
|
20
|
-
max-height: 200px;
|
|
21
|
-
min-height: 200px;
|
|
22
|
-
overflow-y: auto;
|
|
23
|
-
padding: $mds-size-baseline * 2;
|
|
24
|
-
}
|
|
2
|
+
border-radius: $mds-size-border-radius;
|
|
3
|
+
border: $mds-size-border-width solid $mds-color-border;
|
|
4
|
+
max-height: 200px;
|
|
5
|
+
min-height: 200px;
|
|
6
|
+
overflow-y: auto;
|
|
7
|
+
padding: $mds-size-baseline * 2;
|
|
8
|
+
|
|
25
9
|
&__checkbox {
|
|
26
10
|
margin-bottom: $mds-size-baseline;
|
|
27
11
|
& input {
|
|
28
12
|
margin-right: $mds-size-baseline * 2;
|
|
29
|
-
}
|
|
30
|
-
& input, .mds-icon, label {
|
|
31
13
|
cursor: pointer;
|
|
32
14
|
}
|
|
33
15
|
}
|
|
@@ -39,6 +21,8 @@
|
|
|
39
21
|
}
|
|
40
22
|
}
|
|
41
23
|
|
|
42
|
-
.
|
|
43
|
-
|
|
44
|
-
|
|
24
|
+
.mds-form-element--error .mds-multiselect {
|
|
25
|
+
border-color: $mds-color-status-error-dark;
|
|
26
|
+
background-color: $mds-color-status-error-lightest;
|
|
27
|
+
border-left-width: $mds-size-baseline;
|
|
28
|
+
}
|
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="mds-multiselect
|
|
3
|
-
<
|
|
4
|
-
<legend class="mds-multiselect__label">
|
|
5
|
-
{{ labeltext }}
|
|
6
|
-
<span v-if="optional" class="mds-multiselect__label-optional"> (optional)</span>
|
|
7
|
-
</legend>
|
|
8
|
-
<div class="mds-multiselect__scrollable">
|
|
9
|
-
<MultiSelectCheckboxGroup :name="name" :options="availableOptions" :testId="`${name}-group`" />
|
|
10
|
-
</div>
|
|
11
|
-
</fieldset>
|
|
2
|
+
<div class="mds-multiselect" :data-multiselect-id="name">
|
|
3
|
+
<MultiSelectCheckboxGroup :name="name" :options="availableOptions" :testId="`${name}-group`" />
|
|
12
4
|
</div>
|
|
13
5
|
</template>
|
|
14
6
|
|
|
@@ -21,10 +13,6 @@ export default {
|
|
|
21
13
|
MultiSelectCheckboxGroup,
|
|
22
14
|
},
|
|
23
15
|
props: {
|
|
24
|
-
labeltext: {
|
|
25
|
-
type: String,
|
|
26
|
-
required: true,
|
|
27
|
-
},
|
|
28
16
|
name: {
|
|
29
17
|
type: [String, Boolean],
|
|
30
18
|
default: false,
|
|
@@ -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,3 +1,6 @@
|
|
|
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 -%}
|
|
@@ -5,22 +8,37 @@
|
|
|
5
8
|
{%- endif -%}
|
|
6
9
|
|
|
7
10
|
|
|
8
|
-
<div class="mds-
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
11
|
+
<div class="mds-form-element mds-form-element--radio{% if params.classes %} {{params.classes}}{% endif %}" id="{{params.id}}" data-test="radio">
|
|
12
|
+
<fieldset>
|
|
13
|
+
{{ MdsInputLabel({
|
|
14
|
+
element: 'legend',
|
|
15
|
+
labelText: params.labelText,
|
|
16
|
+
hideLabel: params.hideLabel,
|
|
17
|
+
id: params.id,
|
|
18
|
+
optional: params.optional,
|
|
19
|
+
tooltipMessage: params.tooltipMessage
|
|
20
|
+
}) }}
|
|
21
|
+
{{ MdsInputMessages({
|
|
22
|
+
id: params.id,
|
|
23
|
+
helpText: params.helpText,
|
|
24
|
+
validationError: params.validationError
|
|
25
|
+
}) }}
|
|
26
|
+
{%- for radio in params.options -%}
|
|
27
|
+
<div class="mds-form-check{% if radio.classes %} {{radio.classes}}{% endif %}">
|
|
28
|
+
<input
|
|
29
|
+
type="radio"
|
|
30
|
+
class="mds-form-check__input"
|
|
31
|
+
name="{{name}}"
|
|
32
|
+
id="{{radio.id}}"
|
|
33
|
+
{% if params.disabled %}disabled="disabled"{% endif %}
|
|
34
|
+
{% if radio.selected %}checked="checked"{% endif %}
|
|
35
|
+
value="{{radio.value}}"
|
|
36
|
+
/>{#
|
|
37
|
+
# Avoid extra space created by line breaks #
|
|
38
|
+
#}<label class="mds-form-check__label" for="{{radio.id}}">{#
|
|
39
|
+
#}{{radio.labelText}}{#
|
|
40
|
+
´#}</label>
|
|
41
|
+
</div>
|
|
42
|
+
{% endfor %}
|
|
43
|
+
</fieldset>
|
|
26
44
|
</div>
|
|
@@ -3,7 +3,7 @@ module.exports = {
|
|
|
3
3
|
status: 'wip',
|
|
4
4
|
context: {
|
|
5
5
|
id: 'radio-input',
|
|
6
|
-
labelText: 'Standard Radio
|
|
6
|
+
labelText: 'Standard Radio group',
|
|
7
7
|
options: [
|
|
8
8
|
{
|
|
9
9
|
labelText: 'Radio Input 1',
|
|
@@ -21,47 +21,28 @@ module.exports = {
|
|
|
21
21
|
{
|
|
22
22
|
name: 'Inline Radio using class',
|
|
23
23
|
context: {
|
|
24
|
-
id: 'inline-radio-input
|
|
25
|
-
labelText: 'Inline Radio
|
|
24
|
+
id: 'inline-radio-input',
|
|
25
|
+
labelText: 'Inline Radio using class',
|
|
26
26
|
options: [
|
|
27
27
|
{
|
|
28
28
|
labelText: 'Radio Input 1',
|
|
29
29
|
value: '2-1',
|
|
30
30
|
id: 'radio-2-1',
|
|
31
|
-
classes: 'mds-display-inline-block',
|
|
31
|
+
classes: 'mds-display-inline-block mds-margin-right-b2',
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
34
|
labelText: 'Radio Input 2',
|
|
35
35
|
value: '2-2',
|
|
36
36
|
id: 'radio-2-2',
|
|
37
37
|
selected: true,
|
|
38
|
-
classes: 'mds-display-inline-block',
|
|
39
|
-
},
|
|
40
|
-
],
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
name: 'Stacked Radio disabled',
|
|
45
|
-
context: {
|
|
46
|
-
id: 'stacked-radio-input-disabled',
|
|
47
|
-
labelText: 'Stacked Radio disabled',
|
|
48
|
-
disabled: true,
|
|
49
|
-
options: [
|
|
50
|
-
{
|
|
51
|
-
labelText: 'Radio Input 1',
|
|
52
|
-
value: '4-1',
|
|
53
|
-
id: 'radio-4-1',
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
labelText: 'Radio Input 2',
|
|
57
|
-
value: '4-2',
|
|
58
|
-
id: 'radio-4-2',
|
|
38
|
+
classes: 'mds-display-inline-block mds-margin-right-b2',
|
|
59
39
|
},
|
|
60
40
|
{
|
|
61
41
|
labelText: 'Radio Input 3',
|
|
62
42
|
value: '4-3',
|
|
63
43
|
id: 'radio-4-3',
|
|
64
44
|
selected: true,
|
|
45
|
+
classes: 'mds-display-inline-block',
|
|
65
46
|
},
|
|
66
47
|
],
|
|
67
48
|
},
|
|
@@ -71,25 +52,23 @@ module.exports = {
|
|
|
71
52
|
context: {
|
|
72
53
|
id: 'stacked-radio-input-disabled',
|
|
73
54
|
labelText: 'Stacked Radio disabled',
|
|
55
|
+
disabled: true,
|
|
74
56
|
options: [
|
|
75
57
|
{
|
|
76
58
|
labelText: 'Radio Input 1',
|
|
77
59
|
value: '4-1',
|
|
78
60
|
id: 'radio-4-1',
|
|
79
|
-
classes: 'mds-display-inline-block',
|
|
80
61
|
},
|
|
81
62
|
{
|
|
82
63
|
labelText: 'Radio Input 2',
|
|
83
64
|
value: '4-2',
|
|
84
65
|
id: 'radio-4-2',
|
|
85
|
-
classes: 'mds-display-inline-block',
|
|
86
66
|
},
|
|
87
67
|
{
|
|
88
68
|
labelText: 'Radio Input 3',
|
|
89
69
|
value: '4-3',
|
|
90
70
|
id: 'radio-4-3',
|
|
91
71
|
selected: true,
|
|
92
|
-
classes: 'mds-display-inline-block',
|
|
93
72
|
},
|
|
94
73
|
],
|
|
95
74
|
},
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
{% from "./inputs/radio/_macro.njk" import MdsRadio %}
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
<div class="mds-form-field">
|
|
4
|
+
{{ MdsRadio({
|
|
5
|
+
labelText: labelText,
|
|
6
|
+
name: name,
|
|
7
|
+
id: id,
|
|
8
|
+
disabled: disabled,
|
|
9
|
+
options: options,
|
|
10
|
+
classes: classes
|
|
11
|
+
}) }}
|
|
12
|
+
</div>
|
|
@@ -7,8 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
.mds-pagination__link {
|
|
9
9
|
display: inline-block;
|
|
10
|
-
padding: $mds-size-baseline * 3;
|
|
11
|
-
|
|
10
|
+
padding: $mds-size-baseline * 3 $mds-size-baseline * 2;
|
|
12
11
|
&--back {
|
|
13
12
|
@include mq($from: $mds-size-breakpoint-sm) {
|
|
14
13
|
border-right: $mds-size-border-width solid $mds-color-border;
|
|
@@ -26,9 +25,10 @@
|
|
|
26
25
|
}
|
|
27
26
|
}
|
|
28
27
|
|
|
29
|
-
&--
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
&--disabled {
|
|
29
|
+
cursor: not-allowed;
|
|
30
|
+
background-color: $mds-color-neutral-lightest;
|
|
31
|
+
color: $mds-color-neutral-lighter;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
.mds-pagination--numbers .mds-pagination__extra-label {
|
|
@@ -53,6 +53,10 @@
|
|
|
53
53
|
flex-grow: 1;
|
|
54
54
|
}
|
|
55
55
|
.mds-pagination__link--active {
|
|
56
|
-
|
|
56
|
+
color: $mds-color-text-base;
|
|
57
|
+
&:hover,
|
|
58
|
+
&:focus {
|
|
59
|
+
color: $mds-color-link-hover;
|
|
60
|
+
}
|
|
57
61
|
}
|
|
58
62
|
}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
- `name`: name of the component, used for accessibility purpose, should be descriptive (i.e. numbers pagination)
|
|
4
4
|
- `classes`: add extra CSS classes to the component
|
|
5
|
+
- `hideIcons`: hide caret icons
|
|
5
6
|
- `pageUrlTemplate`:(_required_) url template which will have a page number inserted .e.g. `/article/{pageNo}/seo-stuff`
|
|
6
7
|
- `pageNo`: (_required_) current page the list is on
|
|
7
8
|
- `pageSize`: (_required_) how many items per page
|
|
8
9
|
- `totalItemCount`: (_required_) total items count
|
|
9
|
-
- `hideIcons`: hide caret icons
|
|
10
10
|
- `prevLabel`: label of the previous link
|
|
11
11
|
- `prevVisHiddenLabel`: hidden label for accessibility purpose
|
|
12
12
|
- `nextLabel`: label of the next link
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
<span class="mds-visually-hidden">{{- params.pageVisHiddenLabel or 'Page' -}}</span>
|
|
10
10
|
{%- if params.showLastEllipses -%}
|
|
11
|
-
|
|
11
|
+
<span class="mds-display-none mds-display-md-inline">…</span>
|
|
12
12
|
{%- endif -%}
|
|
13
13
|
{{params.number}}
|
|
14
14
|
{%- if params.showFirstEllipses -%}
|
|
15
|
-
|
|
15
|
+
<span class="mds-display-none mds-display-md-inline">…</span>
|
|
16
16
|
{%- endif -%}
|
|
17
17
|
</a>
|
|
18
18
|
|
|
@@ -62,25 +62,30 @@ Otherwise, show an extra page in front of the current page to make up the displa
|
|
|
62
62
|
<ul class="mds-pagination mds-pagination--numbers mds-text-align-center {% if params.classes %} {{params.classes}}{% endif %}">
|
|
63
63
|
{% if params.prevLabel -%}
|
|
64
64
|
<li class="mds-pagination__item">
|
|
65
|
+
|
|
65
66
|
{%- if disabledButtonPrev -%}
|
|
66
|
-
<div class="mds-pagination__link mds-pagination__link--
|
|
67
|
+
<div class="mds-pagination__link mds-pagination__link--disabled">
|
|
67
68
|
{%- else -%}
|
|
68
69
|
<a href="{{params.pageUrlTemplate | replace('{pageNo}', pageNo - 1) }}" class="mds-pagination__link mds-pagination__link--background" aria-label="{{ params.prevLabel }} {{ params.prevVisHiddenLabel }}">
|
|
69
70
|
{%- endif -%}
|
|
71
|
+
|
|
70
72
|
{% if not params.hideIcons -%}
|
|
71
73
|
{{ MdsIcon({
|
|
72
|
-
iconName: 'chevron-left'
|
|
73
|
-
classes: 'mds-icon--before'
|
|
74
|
+
iconName: 'chevron-left'
|
|
74
75
|
}) }}
|
|
75
76
|
{%- endif -%}
|
|
76
|
-
<span
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
<span class="mds-display-none mds-display-md-inline mds-margin-left-b2">
|
|
78
|
+
{{- params.prevLabel -}}
|
|
79
|
+
{%- if params.prevVisHiddenLabel -%}
|
|
80
|
+
<span class="mds-visually-hidden">{{- params.prevVisHiddenLabel -}}</span>{%- endif -%}
|
|
81
|
+
</span>
|
|
82
|
+
|
|
79
83
|
{%- if disabledButtonPrev -%}
|
|
80
84
|
</div>
|
|
81
85
|
{%- else -%}
|
|
82
86
|
</a>
|
|
83
87
|
{%- endif -%}
|
|
88
|
+
|
|
84
89
|
</li>
|
|
85
90
|
{%- endif %}
|
|
86
91
|
<li class="mds-pagination__item mds-border-left">
|
|
@@ -122,25 +127,31 @@ Otherwise, show an extra page in front of the current page to make up the displa
|
|
|
122
127
|
{%- endif -%}
|
|
123
128
|
{% if params.nextLabel -%}
|
|
124
129
|
<li class="mds-pagination__item mds-border-left">
|
|
130
|
+
|
|
125
131
|
{%- if disabledButtonNext -%}
|
|
126
|
-
<div class="mds-pagination__link mds-pagination__link--
|
|
132
|
+
<div class="mds-pagination__link mds-pagination__link--disabled">
|
|
127
133
|
{%- else -%}
|
|
128
134
|
<a href="{{params.pageUrlTemplate | replace('{pageNo}', pageNo + 1)}}" class="mds-pagination__link mds-pagination__link--background" aria-label="{{ params.nextLabel }} {{ params.nextVisHiddenLabel }}">
|
|
129
135
|
{%- endif -%}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
136
|
+
|
|
137
|
+
<span class="mds-display-none mds-display-md-inline mds-margin-right-b2">
|
|
138
|
+
{{- params.nextLabel -}}
|
|
139
|
+
{%- if params.nextVisHiddenLabel -%}
|
|
140
|
+
<span class="mds-visually-hidden">{{- params.nextVisHiddenLabel -}}</span>{%- endif -%}
|
|
141
|
+
</span>
|
|
142
|
+
|
|
133
143
|
{% if not params.hideIcons -%}
|
|
134
144
|
{{ MdsIcon({
|
|
135
|
-
iconName: 'chevron-right'
|
|
136
|
-
classes: 'mds-icon--after'
|
|
145
|
+
iconName: 'chevron-right'
|
|
137
146
|
}) }}
|
|
138
147
|
{%- endif %}
|
|
148
|
+
|
|
139
149
|
{%- if disabledButtonNext -%}
|
|
140
150
|
</div>
|
|
141
151
|
{%- else -%}
|
|
142
152
|
</a>
|
|
143
153
|
{%- endif -%}
|
|
154
|
+
|
|
144
155
|
</li>
|
|
145
156
|
{%- endif %}
|
|
146
157
|
</ul>
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
const containerClass = 'js-mds-combobox';
|
|
2
1
|
const elementName = 'mds-combobox';
|
|
3
2
|
|
|
4
3
|
function bindToSelect() {
|
|
5
|
-
const el = document.querySelector(
|
|
4
|
+
const el = document.querySelector(`[data-combobox-id="distance-selection"]`);
|
|
6
5
|
if (el) {
|
|
7
6
|
const selectInput = document.getElementById('select-distance-selection');
|
|
8
7
|
const options = Array.from(selectInput.querySelectorAll('option'));
|
|
@@ -18,7 +17,7 @@ function bindToSelect() {
|
|
|
18
17
|
}
|
|
19
18
|
|
|
20
19
|
function bindToApi() {
|
|
21
|
-
const el = document.querySelector(
|
|
20
|
+
const el = document.querySelector(`[data-combobox-id="keywords-lookup"]`);
|
|
22
21
|
if (el) {
|
|
23
22
|
const vueSelect = el.querySelector(elementName);
|
|
24
23
|
vueSelect.filterOptions = false;
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
const containerClass = 'js-mds-multiselect';
|
|
2
|
-
const elementName = 'mds-multiselect';
|
|
3
|
-
|
|
4
1
|
function constructNode(rootNode) {
|
|
5
2
|
const localObj = [];
|
|
6
3
|
const parentNodes = rootNode.querySelectorAll(':scope > .mds-multiselect__checkbox');
|
|
@@ -23,34 +20,17 @@ function constructNode(rootNode) {
|
|
|
23
20
|
return localObj;
|
|
24
21
|
}
|
|
25
22
|
|
|
26
|
-
function
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
const vueMultiselect =
|
|
30
|
-
vueMultiselect.options = constructNode(
|
|
31
|
-
|
|
32
|
-
`.${elementName} .mds-combobox--fallback .mds-multiselect__scrollable-parent-role > .mds-multiselect__checkbox-group`
|
|
33
|
-
)
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function bindIndustryData() {
|
|
39
|
-
const el = document.querySelector(`.${containerClass}[data-multiselect-id="industry-combobox-id"]`);
|
|
40
|
-
if (el) {
|
|
41
|
-
const vueMultiselect = el.querySelector(`${elementName}`);
|
|
42
|
-
vueMultiselect.options = constructNode(
|
|
43
|
-
document.querySelector(
|
|
44
|
-
`.${elementName} .mds-combobox--fallback .mds-multiselect__scrollable-parent-industry > .mds-multiselect__checkbox-group`
|
|
45
|
-
)
|
|
46
|
-
);
|
|
47
|
-
}
|
|
23
|
+
function bindData() {
|
|
24
|
+
const elements = Array.from(document.querySelectorAll('.js-mds-multiselect'));
|
|
25
|
+
elements.forEach((element) => {
|
|
26
|
+
const vueMultiselect = element.querySelector('mds-multiselect');
|
|
27
|
+
vueMultiselect.options = constructNode(element.querySelector('.mds-multiselect__checkbox-group'));
|
|
28
|
+
});
|
|
48
29
|
}
|
|
49
30
|
|
|
50
31
|
const multiselect = {
|
|
51
32
|
init: () => {
|
|
52
|
-
|
|
53
|
-
bindIndustryData();
|
|
33
|
+
bindData();
|
|
54
34
|
},
|
|
55
35
|
};
|
|
56
36
|
|
package/src/js/index-vue.js
CHANGED
|
@@ -15,9 +15,8 @@ Vue.customElement('mds-combobox', Combobox, {
|
|
|
15
15
|
connectedCallback() {
|
|
16
16
|
// If the custom element has loaded, clear up any fallback elements that could cause ID clashes or weirdness in form submission
|
|
17
17
|
const fallbackInput = this.parentElement.querySelector('input');
|
|
18
|
-
|
|
18
|
+
|
|
19
19
|
if (fallbackInput) fallbackInput.remove();
|
|
20
|
-
if (fallbackLabel) fallbackLabel.remove();
|
|
21
20
|
},
|
|
22
21
|
});
|
|
23
22
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Use `mds-form-field` to wrap each of the form elements to get the correct spacing between them.
|