@madgex/design-system 11.0.0 → 12.0.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/README.md +3 -0
- package/dist/assets/icons.json +1 -1
- package/dist/css/index.css +1 -1
- package/dist/js/index-fractal.js +1 -1
- package/package.json +1 -1
- package/src/components/inputs/combobox/README.md +28 -6
- package/src/components/inputs/combobox/_template.njk +42 -31
- package/src/components/inputs/combobox/combobox.config.js +14 -2
- package/src/components/inputs/combobox/combobox.njk +21 -11
- package/src/components/tabs/README.md +8 -9
- package/src/components/tabs/_template.njk +10 -33
- package/src/components/tabs/tab-id.njk +3 -4
- package/src/components/tabs/tabs.config.js +34 -59
- package/src/components/tabs/tabs.njk +0 -3
- package/src/components/tabs/tabs.scss +0 -21
- package/src/js/index-fractal.js +0 -4
- package/src/js/fractal-scripts/combobox.js +0 -88
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
const elementName = 'mds-combobox';
|
|
2
|
-
|
|
3
|
-
function bindToLocationSelect() {
|
|
4
|
-
const el = document.querySelector(`[data-combobox-id="distance-selection"]`);
|
|
5
|
-
|
|
6
|
-
if (el) {
|
|
7
|
-
const selectInput = el.querySelector('select');
|
|
8
|
-
const options = Array.from(selectInput.querySelectorAll('option'));
|
|
9
|
-
const vueSelect = el.querySelector(elementName);
|
|
10
|
-
|
|
11
|
-
vueSelect.options = options.slice(1).map((opt) => ({ value: opt.value, label: opt.textContent }));
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function bindToSalarySelect() {
|
|
16
|
-
const el = document.querySelector(`[data-combobox-id="salary-selection"]`);
|
|
17
|
-
|
|
18
|
-
if (el) {
|
|
19
|
-
const selectInput = el.querySelector('select');
|
|
20
|
-
const options = Array.from(selectInput.querySelectorAll('option'));
|
|
21
|
-
const vueSelect = el.querySelector(elementName);
|
|
22
|
-
|
|
23
|
-
vueSelect.options = options.slice(1).map((opt) => ({ value: opt.value, label: opt.textContent }));
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function setSalaryHiddenField() {
|
|
28
|
-
const comboBoxEl = document.querySelector(`[data-combobox-id="salary-selection"] mds-combobox`);
|
|
29
|
-
const hiddenInputEl = document.querySelector('#salary-selection-hidden-input');
|
|
30
|
-
|
|
31
|
-
if (comboBoxEl && hiddenInputEl) {
|
|
32
|
-
comboBoxEl.addEventListener('select-option', () => {
|
|
33
|
-
console.log('Setting #salary-selection-hidden-input..');
|
|
34
|
-
hiddenInputEl.value = hiddenInputEl.value === 'flip' ? 'flop' : 'flip';
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function clearSalaryHiddenField() {
|
|
40
|
-
const comboBoxEl = document.querySelector(`[data-combobox-id="salary-selection"] mds-combobox`);
|
|
41
|
-
const hiddenInputEl = document.querySelector('#salary-selection-hidden-input');
|
|
42
|
-
|
|
43
|
-
if (comboBoxEl && hiddenInputEl) {
|
|
44
|
-
comboBoxEl.addEventListener('clear-all', () => {
|
|
45
|
-
console.log('Clearing #salary-selection-hidden-input..');
|
|
46
|
-
hiddenInputEl.value = '';
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function bindToApi() {
|
|
52
|
-
const el = document.querySelector(`[data-combobox-id="keywords-lookup"]`);
|
|
53
|
-
|
|
54
|
-
if (el) {
|
|
55
|
-
const vueSelect = el.querySelector(elementName);
|
|
56
|
-
|
|
57
|
-
vueSelect.filterOptions = false;
|
|
58
|
-
vueSelect.addEventListener('search', (event) => {
|
|
59
|
-
const [searchValue] = event.detail;
|
|
60
|
-
|
|
61
|
-
if (searchValue && searchValue.length > 2) {
|
|
62
|
-
fetch(`https://api.datamuse.com/sug?s=${searchValue}`)
|
|
63
|
-
.then((res) => res.json())
|
|
64
|
-
.then((data) => {
|
|
65
|
-
const options = data.map(({ word }) => ({ value: word, label: word }));
|
|
66
|
-
|
|
67
|
-
vueSelect.options = options;
|
|
68
|
-
return options;
|
|
69
|
-
})
|
|
70
|
-
.catch(console.log);
|
|
71
|
-
} else {
|
|
72
|
-
vueSelect.options = [];
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
const combobox = {
|
|
79
|
-
init: () => {
|
|
80
|
-
bindToLocationSelect();
|
|
81
|
-
bindToSalarySelect();
|
|
82
|
-
setSalaryHiddenField();
|
|
83
|
-
clearSalaryHiddenField();
|
|
84
|
-
bindToApi();
|
|
85
|
-
},
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
export default combobox;
|