@ukho/admiralty-core 4.0.0-next.7 → 4.0.0-next.8
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/dist/admiralty/admiralty.esm.js +1 -1
- package/dist/admiralty/admiralty.esm.js.map +1 -1
- package/dist/admiralty/{p-0747bd00.entry.js → p-1e01bb1c.entry.js} +2 -2
- package/dist/admiralty/{p-0747bd00.entry.js.map → p-1e01bb1c.entry.js.map} +1 -1
- package/dist/admiralty/{p-e11fb21b.entry.js → p-6dde3d41.entry.js} +2 -2
- package/dist/admiralty/p-6dde3d41.entry.js.map +1 -0
- package/dist/admiralty/{p-f8e1cfce.entry.js → p-a0466b05.entry.js} +2 -2
- package/dist/admiralty/p-a0466b05.entry.js.map +1 -0
- package/dist/admiralty/p-f2f2c51d.entry.js +2 -0
- package/dist/admiralty/p-f2f2c51d.entry.js.map +1 -0
- package/dist/cjs/admiralty-autocomplete.cjs.entry.js +4 -3
- package/dist/cjs/admiralty-autocomplete.cjs.entry.js.map +1 -1
- package/dist/cjs/admiralty-input.cjs.entry.js +2 -2
- package/dist/cjs/admiralty-input.cjs.entry.js.map +1 -1
- package/dist/cjs/admiralty-progress-bar.cjs.entry.js +9 -3
- package/dist/cjs/admiralty-progress-bar.cjs.entry.js.map +1 -1
- package/dist/cjs/admiralty-tab-group.cjs.entry.js +17 -5
- package/dist/cjs/admiralty-tab-group.cjs.entry.js.map +1 -1
- package/dist/cjs/admiralty.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -3
- package/dist/collection/components/autocomplete/autocomplete.js +5 -4
- package/dist/collection/components/autocomplete/autocomplete.js.map +1 -1
- package/dist/collection/components/input/input.js +2 -2
- package/dist/collection/components/input/input.js.map +1 -1
- package/dist/collection/components/progress-bar/progress-bar.js +9 -3
- package/dist/collection/components/progress-bar/progress-bar.js.map +1 -1
- package/dist/components/admiralty-autocomplete.js +4 -3
- package/dist/components/admiralty-autocomplete.js.map +1 -1
- package/dist/components/admiralty-input.js +121 -1
- package/dist/components/admiralty-input.js.map +1 -1
- package/dist/components/admiralty-progress-bar.js +9 -3
- package/dist/components/admiralty-progress-bar.js.map +1 -1
- package/dist/components/admiralty-tab-group.js +13 -1
- package/dist/components/admiralty-tab-group.js.map +1 -1
- package/dist/esm/admiralty-autocomplete.entry.js +4 -3
- package/dist/esm/admiralty-autocomplete.entry.js.map +1 -1
- package/dist/esm/admiralty-input.entry.js +2 -2
- package/dist/esm/admiralty-input.entry.js.map +1 -1
- package/dist/esm/admiralty-progress-bar.entry.js +9 -3
- package/dist/esm/admiralty-progress-bar.entry.js.map +1 -1
- package/dist/esm/admiralty-tab-group.entry.js +13 -1
- package/dist/esm/admiralty-tab-group.entry.js.map +1 -1
- package/dist/esm/admiralty.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/autocomplete/autocomplete.d.ts +1 -1
- package/dist/types/components/progress-bar/progress-bar.d.ts +3 -1
- package/dist/types/components.d.ts +2 -94
- package/docs/docs.json +3 -218
- package/package.json +2 -2
- package/dist/admiralty/p-26ffce79.entry.js +0 -2
- package/dist/admiralty/p-26ffce79.entry.js.map +0 -1
- package/dist/admiralty/p-a4bd6904.js +0 -2
- package/dist/admiralty/p-a4bd6904.js.map +0 -1
- package/dist/admiralty/p-b7153ca1.entry.js +0 -2
- package/dist/admiralty/p-b7153ca1.entry.js.map +0 -1
- package/dist/admiralty/p-d701641c.entry.js +0 -2
- package/dist/admiralty/p-d701641c.entry.js.map +0 -1
- package/dist/admiralty/p-e11fb21b.entry.js.map +0 -1
- package/dist/admiralty/p-f8e1cfce.entry.js.map +0 -1
- package/dist/cjs/Keys-019752ee.js +0 -16
- package/dist/cjs/Keys-019752ee.js.map +0 -1
- package/dist/cjs/admiralty-type-ahead-item.cjs.entry.js +0 -23
- package/dist/cjs/admiralty-type-ahead-item.cjs.entry.js.map +0 -1
- package/dist/cjs/admiralty-type-ahead.cjs.entry.js +0 -204
- package/dist/cjs/admiralty-type-ahead.cjs.entry.js.map +0 -1
- package/dist/collection/components/type-ahead/type-ahead.css +0 -106
- package/dist/collection/components/type-ahead/type-ahead.js +0 -329
- package/dist/collection/components/type-ahead/type-ahead.js.map +0 -1
- package/dist/collection/components/type-ahead-item/type-ahead-item.css +0 -3
- package/dist/collection/components/type-ahead-item/type-ahead-item.js +0 -43
- package/dist/collection/components/type-ahead-item/type-ahead-item.js.map +0 -1
- package/dist/components/admiralty-type-ahead-item.d.ts +0 -11
- package/dist/components/admiralty-type-ahead-item.js +0 -38
- package/dist/components/admiralty-type-ahead-item.js.map +0 -1
- package/dist/components/admiralty-type-ahead.d.ts +0 -11
- package/dist/components/admiralty-type-ahead.js +0 -254
- package/dist/components/admiralty-type-ahead.js.map +0 -1
- package/dist/components/p-1a2059bb.js +0 -125
- package/dist/components/p-1a2059bb.js.map +0 -1
- package/dist/components/p-a4bd6904.js +0 -16
- package/dist/components/p-a4bd6904.js.map +0 -1
- package/dist/esm/Keys-acfce4b9.js +0 -16
- package/dist/esm/Keys-acfce4b9.js.map +0 -1
- package/dist/esm/admiralty-type-ahead-item.entry.js +0 -19
- package/dist/esm/admiralty-type-ahead-item.entry.js.map +0 -1
- package/dist/esm/admiralty-type-ahead.entry.js +0 -200
- package/dist/esm/admiralty-type-ahead.entry.js.map +0 -1
- package/dist/types/components/type-ahead/type-ahead.d.ts +0 -72
- package/dist/types/components/type-ahead-item/type-ahead-item.d.ts +0 -4
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, f as forceUpdate, h, H as Host, g as getElement } from './index-60c25452.js';
|
|
2
|
-
import { K as Keys } from './Keys-acfce4b9.js';
|
|
3
|
-
|
|
4
|
-
const typeAheadCss = ".visually-hidden.sc-admiralty-type-ahead:not(:focus):not(:active){position:absolute !important;width:1px !important;height:1px !important;margin:0 !important;padding:0 !important;overflow:hidden !important;clip:rect(0 0 0 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;border:0 !important;white-space:nowrap !important}@media (max-width: 1023px){.desktop-only.sc-admiralty-type-ahead{display:none}}@media (min-width: 1024px){.not-desktop.sc-admiralty-type-ahead{display:none}}@media (min-width: 1024px){.tablet-only.sc-admiralty-type-ahead{display:none}}@media (max-width: 479px) and (min-width: 0px){.tablet-only.sc-admiralty-type-ahead{display:none}}@media (max-width: 479px) and (min-width: 0px){.tablet-or-desktop.sc-admiralty-type-ahead{display:none}}@media (min-width: 1024px){.phone-or-tablet.sc-admiralty-type-ahead{display:none}}@media (min-width: 1024px){.phone-only.sc-admiralty-type-ahead{display:none}}@media (max-width: 1023px) and (min-width: 480px){.phone-only.sc-admiralty-type-ahead{display:none}}*.sc-admiralty-type-ahead{margin:0px;padding:0px}.text-input-wrap.sc-admiralty-type-ahead{height:auto !important}.filterTextInput.sc-admiralty-type-ahead{width:100%}.typeahead-list-container.sc-admiralty-type-ahead{position:relative}.typeahead-list-container.sc-admiralty-type-ahead .typeahead-list.sc-admiralty-type-ahead{position:absolute;left:0px;top:-24px;background-color:var(--admiralty-background-colour);width:100%;box-shadow:0px 4px 4px rgba(0, 0, 0, 0.25);border:2px solid var(--admiralty-text-colour);border-top:none;box-sizing:border-box;max-height:180px;overflow-y:auto;z-index:1;list-style:none}.typeahead-list-container.sc-admiralty-type-ahead .typeahead-list.sc-admiralty-type-ahead li.sc-admiralty-type-ahead{cursor:pointer;transform:unset !important;padding:6px;min-height:24px;margin:0}.typeahead-list-container.sc-admiralty-type-ahead .typeahead-list.sc-admiralty-type-ahead li.sc-admiralty-type-ahead:before{content:none}.typeahead-list-container.sc-admiralty-type-ahead .typeahead-list.sc-admiralty-type-ahead li.highlighted.sc-admiralty-type-ahead{background-color:var(--admiralty-colour-primary);color:var(--admiralty-colour-primary-contrast)}";
|
|
5
|
-
const AdmiraltyTypeAheadStyle0 = typeAheadCss;
|
|
6
|
-
|
|
7
|
-
const TypeAheadComponent = class {
|
|
8
|
-
constructor(hostRef) {
|
|
9
|
-
registerInstance(this, hostRef);
|
|
10
|
-
this.selectionChanged = createEvent(this, "selectionChanged", 7);
|
|
11
|
-
this.valueChanged = createEvent(this, "valueChanged", 7);
|
|
12
|
-
this.internalId = ++id;
|
|
13
|
-
this.filterList = [];
|
|
14
|
-
this.selectedItemIndex = -1;
|
|
15
|
-
this.isFocused = false;
|
|
16
|
-
this.isSilenced = false;
|
|
17
|
-
this.isAlternateStatusSection = false;
|
|
18
|
-
this.originalSearch = '';
|
|
19
|
-
this.hasBeenFocusedAtLeastOnce = false;
|
|
20
|
-
this.filterResult = new Array();
|
|
21
|
-
this.value = undefined;
|
|
22
|
-
this.label = undefined;
|
|
23
|
-
this.hint = undefined;
|
|
24
|
-
this.placeholder = undefined;
|
|
25
|
-
this.resultsOnInitFocus = false;
|
|
26
|
-
}
|
|
27
|
-
get inputValue() {
|
|
28
|
-
return this.inputControl.value.toString();
|
|
29
|
-
}
|
|
30
|
-
set inputValue(value) {
|
|
31
|
-
this.inputControl.value = value;
|
|
32
|
-
}
|
|
33
|
-
componentDidLoad() {
|
|
34
|
-
if (this.value) {
|
|
35
|
-
this.inputValue = this.value;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
connectedCallback() {
|
|
39
|
-
this.mutation = new MutationObserver(() => {
|
|
40
|
-
this.populateFilterList();
|
|
41
|
-
forceUpdate(this);
|
|
42
|
-
});
|
|
43
|
-
this.mutation.observe(this.el, {
|
|
44
|
-
childList: true,
|
|
45
|
-
subtree: true,
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
disconnectedCallback() {
|
|
49
|
-
if (this.mutation) {
|
|
50
|
-
this.mutation.disconnect();
|
|
51
|
-
this.mutation = undefined;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
populateFilterList() {
|
|
55
|
-
const slotItems = this.el.querySelectorAll('admiralty-type-ahead-item');
|
|
56
|
-
this.filterList = [];
|
|
57
|
-
slotItems.forEach(el => {
|
|
58
|
-
this.filterList.push(el.getAttribute('value'));
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
handleFocusIn() {
|
|
62
|
-
if (this.resultsOnInitFocus && !this.hasBeenFocusedAtLeastOnce) {
|
|
63
|
-
this.performFilter('');
|
|
64
|
-
this.hasBeenFocusedAtLeastOnce = true;
|
|
65
|
-
}
|
|
66
|
-
this.isFocused = true;
|
|
67
|
-
this.isSilenced = false;
|
|
68
|
-
}
|
|
69
|
-
handleFocusOut() {
|
|
70
|
-
this.isFocused = false;
|
|
71
|
-
this.statusText = null;
|
|
72
|
-
this.isSilenced = true;
|
|
73
|
-
}
|
|
74
|
-
textChanged(value) {
|
|
75
|
-
this.originalSearch = value;
|
|
76
|
-
this.performFilter(value);
|
|
77
|
-
this.isSilenced = false;
|
|
78
|
-
this.valueChanged.emit(value);
|
|
79
|
-
}
|
|
80
|
-
handleKeyPressed(event) {
|
|
81
|
-
event.stopImmediatePropagation();
|
|
82
|
-
if (event.key === Keys.UP_ARROW || event.key === Keys.DOWN_ARROW) {
|
|
83
|
-
this.navigateSuggestions(event.key);
|
|
84
|
-
this.updateScroll();
|
|
85
|
-
}
|
|
86
|
-
else if (event.key !== Keys.ENTER) {
|
|
87
|
-
this.textChanged(this.inputValue);
|
|
88
|
-
this.selectCurrentItem();
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
handleKeyDown(event) {
|
|
92
|
-
event.stopImmediatePropagation();
|
|
93
|
-
if (event.key === Keys.TAB || event.key === Keys.ENTER) {
|
|
94
|
-
this.selectCurrentItem();
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
handleItemSelected(value) {
|
|
98
|
-
this.inputValue = value;
|
|
99
|
-
this.textChanged(value);
|
|
100
|
-
this.filterResult = new Array();
|
|
101
|
-
this.selectionChanged.emit(value);
|
|
102
|
-
}
|
|
103
|
-
performFilter(value) {
|
|
104
|
-
const filter = (filterList, text) => {
|
|
105
|
-
const filterResult = filterList.filter(value => {
|
|
106
|
-
return text === null || text.length < 1 || value.toLowerCase().indexOf(text.toLowerCase()) > -1;
|
|
107
|
-
});
|
|
108
|
-
return filterResult;
|
|
109
|
-
};
|
|
110
|
-
this.filterResult = filter(this.filterList, value);
|
|
111
|
-
this.selectedItemIndex = -1;
|
|
112
|
-
}
|
|
113
|
-
addHighlight() {
|
|
114
|
-
if (this.selectedItemIndex > -1) {
|
|
115
|
-
const listItem = this.el.querySelector(`#${this.getListItemId(this.selectedItemIndex)}`);
|
|
116
|
-
listItem.classList.add('highlighted');
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
removeHighlight(i) {
|
|
120
|
-
if (i > -1) {
|
|
121
|
-
const listItem = this.el.querySelector(`#${this.getListItemId(i)}`);
|
|
122
|
-
listItem.classList.remove('highlighted');
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
selectCurrentItem() {
|
|
126
|
-
if (this.selectedItemIndex >= 0) {
|
|
127
|
-
const selectedItemText = this.filterResult[this.selectedItemIndex];
|
|
128
|
-
this.handleItemSelected(selectedItemText);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
handleItemHovered(index) {
|
|
132
|
-
this.removeHighlight(this.selectedItemIndex);
|
|
133
|
-
this.selectedItemIndex = index;
|
|
134
|
-
this.addHighlight();
|
|
135
|
-
}
|
|
136
|
-
handleComponentFocusOut() {
|
|
137
|
-
var _a;
|
|
138
|
-
// Ensure dropdown closed on clicking or tabbing away from this component
|
|
139
|
-
if (((_a = this.filterResult) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
140
|
-
this.filterResult = new Array();
|
|
141
|
-
this.hasBeenFocusedAtLeastOnce = false;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Check if the selected option is in view, and scroll if not
|
|
146
|
-
*/
|
|
147
|
-
updateScroll() {
|
|
148
|
-
const container = this.listContainer;
|
|
149
|
-
const ul = container.querySelector('ul');
|
|
150
|
-
const selectedItem = Array.from(ul.childNodes).find((item) => item.ariaPosInSet === `${this.selectedItemIndex + 1}`);
|
|
151
|
-
if (container && selectedItem && container.scrollHeight + container.clientHeight) {
|
|
152
|
-
selectedItem.scrollIntoView();
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
navigateSuggestions(key) {
|
|
156
|
-
if (key === Keys.UP_ARROW) {
|
|
157
|
-
this.removeHighlight(this.selectedItemIndex);
|
|
158
|
-
this.selectedItemIndex--;
|
|
159
|
-
if (this.selectedItemIndex === -2) {
|
|
160
|
-
this.selectedItemIndex = this.filterResult.length - 1;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
if (key === Keys.DOWN_ARROW) {
|
|
164
|
-
this.removeHighlight(this.selectedItemIndex);
|
|
165
|
-
this.selectedItemIndex++;
|
|
166
|
-
if (this.selectedItemIndex > this.filterResult.length - 1) {
|
|
167
|
-
this.selectedItemIndex = -1;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
if (this.selectedItemIndex === -1) {
|
|
171
|
-
this.inputValue = this.originalSearch;
|
|
172
|
-
}
|
|
173
|
-
else {
|
|
174
|
-
const value = this.filterResult[this.selectedItemIndex];
|
|
175
|
-
this.inputValue = value;
|
|
176
|
-
this.addHighlight();
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
getListItemId(i) {
|
|
180
|
-
const id = this.getId();
|
|
181
|
-
return `${id}-list-item-${i}`;
|
|
182
|
-
}
|
|
183
|
-
getId() {
|
|
184
|
-
return this.el.id != '' ? this.el.id : `admiralty-typeahead-${this.internalId}`;
|
|
185
|
-
}
|
|
186
|
-
render() {
|
|
187
|
-
const id = this.getId();
|
|
188
|
-
const inputId = `${id}-input`;
|
|
189
|
-
const hintId = `${id}-assistive-hint`;
|
|
190
|
-
const listId = `${id}-list`;
|
|
191
|
-
return (h(Host, { key: 'a31dfc130539fc7998a1a858780180c3f58a3dca', onFocusout: _ev => this.handleComponentFocusOut() }, h("div", { key: '2b1d16a096aedc73730e3456a786c79bbb649087', class: "visually-hidden" }, h("div", { key: '7a4ffe9d200afbb32759292ad537af595b46d377', class: "results-status-a", role: "status", "aria-atomic": "true", "aria-live": "polite" }, !this.isSilenced && this.isAlternateStatusSection ? this.statusText : ''), h("div", { key: '246dd3d76841a08ec9304156956279b1319ae956', class: "results-status-b", role: "status", "aria-atomic": "true", "aria-live": "polite" }, !this.isSilenced && !this.isAlternateStatusSection ? this.statusText : '')), h("admiralty-input", { key: '9226118ea71b0c055c3b8b12bdaf183b8d0f1be0', type: "text", ref: el => (this.inputControl = el), id: inputId, label: this.label, hint: this.hint, placeholder: this.placeholder, class: "filterTextInput", onKeyUp: ev => this.handleKeyPressed(ev), onKeyDown: ev => this.handleKeyDown(ev), onFocusin: _ev => this.handleFocusIn(), onFocusout: _ev => this.handleFocusOut(), "aria-expanded": this.isFocused && this.filterResult.length > 0 }), h("span", { key: '2802b19f095e15fef7e346311014f4944578804d', id: hintId, class: "visually-hidden" }, "When autocomplete results are available use up and down arrows to review and enter to select. Touch device users, explore by touch or with swipe gestures."), this.filterResult.length > 0 ? (h("div", { class: "typeahead-list-container", ref: el => (this.listContainer = el) }, h("ul", { class: "typeahead-list", id: listId, role: "listbox" }, this.filterResult.map((item, i) => (h("li", { id: this.getListItemId(i), onMouseDown: _ev => this.handleItemSelected(item), onMouseOver: _ev => this.handleItemHovered(i), "aria-selected": i === this.selectedItemIndex, role: "option", tabindex: "-1", "aria-posinset": i + 1, "aria-setsize": this.filterResult.length }, item)))))) : null, h("slot", { key: '52fb739eff8fe71caa9e39ae6add139cbb4db1a7' })));
|
|
192
|
-
}
|
|
193
|
-
get el() { return getElement(this); }
|
|
194
|
-
};
|
|
195
|
-
let id = 0;
|
|
196
|
-
TypeAheadComponent.style = AdmiraltyTypeAheadStyle0;
|
|
197
|
-
|
|
198
|
-
export { TypeAheadComponent as admiralty_type_ahead };
|
|
199
|
-
|
|
200
|
-
//# sourceMappingURL=admiralty-type-ahead.entry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{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,CAAC,EACvC,SAAS,EAAE,GAAG,IAAI,IAAI,CAAC,aAAa,EAAE,EACtC,UAAU,EAAE,GAAG,IAAI,IAAI,CAAC,cAAc,EAAE,mBACzB,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,GAC5C,EAEnB,6DAAM,EAAE,EAAE,MAAM,EAAE,KAAK,EAAC,iBAAiB,iKAElC,EACN,IAAI,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,IAC3B,WAAK,KAAK,EAAC,0BAA0B,EAAC,GAAG,EAAE,EAAE,KAAK,IAAI,CAAC,aAAa,GAAG,EAAE,CAAC,IACxE,UAAI,KAAK,EAAC,gBAAgB,EAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAC,SAAS,IAClD,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,MAC7B,UACE,EAAE,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,EACzB,WAAW,EAAE,GAAG,IAAI,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,EACjD,WAAW,EAAE,GAAG,IAAI,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,mBAC9B,CAAC,KAAK,IAAI,CAAC,iBAAiB,EAC3C,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAC,IAAI,mBACE,CAAC,GAAG,CAAC,kBACN,IAAI,CAAC,YAAY,CAAC,MAAM,IAErC,IAAI,CACF,CACN,CAAC,CACC,CACD,IACJ,IAAI,EACR,8DAAa,CACR,EACP;KACH;;;AAGH,IAAI,EAAE,GAAG,CAAC,CAAC;;;;;","names":[],"sources":["src/components/type-ahead/type-ahead.scss?tag=admiralty-type-ahead&encapsulation=scoped","src/components/type-ahead/type-ahead.tsx"],"sourcesContent":["@import 'type-ahead.vars';\n\n* {\n margin: 0px;\n padding: 0px;\n}\n\n.text-input-wrap {\n height: auto !important;\n}\n\n.filterTextInput {\n width: 100%;\n}\n\n.typeahead-list-container {\n position: relative;\n\n .typeahead-list {\n position: absolute;\n left: 0px;\n top: -24px;\n background-color: $type-ahead-background-colour;\n width: 100%;\n box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);\n border: 2px solid $type-ahead-border-colour;\n border-top: none;\n box-sizing: border-box;\n max-height: 180px;\n overflow-y: auto;\n z-index: 1;\n list-style: none;\n\n li {\n cursor: pointer;\n transform: unset !important;\n padding: 6px;\n min-height: 24px;\n margin: 0;\n }\n\n li:before {\n content: none;\n }\n\n li.highlighted {\n background-color: $type-ahead-highlighted-background-colour;\n color: $type-ahead-highlighted-text-colour;\n }\n }\n}\n","import { Component, EventEmitter, Host, Prop, Event, h, State, Element, forceUpdate } from '@stencil/core';\nimport { Keys } from '../Keys';\n\n@Component({\n tag: 'admiralty-type-ahead',\n styleUrl: 'type-ahead.scss',\n scoped: true,\n})\nexport class TypeAheadComponent {\n private internalId = ++id;\n\n @Element() el: HTMLElement;\n\n listContainer!: HTMLDivElement;\n inputControl!: HTMLAdmiraltyInputElement;\n\n @State() filterResult: string[] = new Array<string>();\n\n filterList: Array<string> = [];\n\n selectedItemIndex = -1;\n isFocused = false;\n\n isSilenced = false;\n isAlternateStatusSection = false;\n statusText: string;\n\n private mutation: MutationObserver;\n\n private originalSearch = '';\n private hasBeenFocusedAtLeastOnce = false;\n\n private get inputValue() {\n return this.inputControl.value.toString();\n }\n\n private set inputValue(value: string) {\n this.inputControl.value = value;\n }\n\n /**\n * The value of the textinput\n */\n @Prop() value: string;\n\n /**\n * The text content of the label for the input box\n */\n @Prop() label: string;\n\n /**\n * The hint which will be used under the label to describe the input.\n */\n @Prop() hint: string;\n\n /**\n * The placeholder text for the input field\n */\n @Prop() placeholder: string;\n\n /**\n * Optional property to show results when input box is initally focused\n */\n @Prop() resultsOnInitFocus: boolean = false;\n\n /**\n * Optional function that will be executed when the user selects an item from the typeahead\n */\n @Event() selectionChanged: EventEmitter<string>;\n\n /**\n * Event that is fired whenever the value of the typeahead changes\n * e.g. selection from the dropdown or manually typed entry\n */\n @Event() valueChanged: EventEmitter<string>;\n\n componentDidLoad() {\n if (this.value) {\n this.inputValue = this.value;\n }\n }\n\n connectedCallback() {\n this.mutation = new MutationObserver(() => {\n this.populateFilterList();\n forceUpdate(this);\n });\n this.mutation.observe(this.el, {\n childList: true,\n subtree: true,\n });\n }\n\n disconnectedCallback() {\n if (this.mutation) {\n this.mutation.disconnect();\n this.mutation = undefined;\n }\n }\n\n populateFilterList() {\n const slotItems = this.el.querySelectorAll('admiralty-type-ahead-item');\n this.filterList = [];\n slotItems.forEach(el => {\n this.filterList.push(el.getAttribute('value'));\n });\n }\n\n handleFocusIn() {\n if (this.resultsOnInitFocus && !this.hasBeenFocusedAtLeastOnce) {\n this.performFilter('');\n this.hasBeenFocusedAtLeastOnce = true;\n }\n\n this.isFocused = true;\n this.isSilenced = false;\n }\n\n handleFocusOut() {\n this.isFocused = false;\n this.statusText = null;\n this.isSilenced = true;\n }\n\n private textChanged(value: string): void {\n this.originalSearch = value;\n this.performFilter(value);\n this.isSilenced = false;\n this.valueChanged.emit(value);\n }\n\n handleKeyPressed(event: KeyboardEvent): void {\n event.stopImmediatePropagation();\n\n if (event.key === Keys.UP_ARROW || event.key === Keys.DOWN_ARROW) {\n this.navigateSuggestions(event.key);\n this.updateScroll();\n } else if (event.key !== Keys.ENTER) {\n this.textChanged(this.inputValue);\n this.selectCurrentItem();\n }\n }\n\n handleKeyDown(event: KeyboardEvent): void {\n event.stopImmediatePropagation();\n\n if (event.key === Keys.TAB || event.key === Keys.ENTER) {\n this.selectCurrentItem();\n }\n }\n\n handleItemSelected(value: string): void {\n this.inputValue = value;\n this.textChanged(value);\n this.filterResult = new Array<string>();\n this.selectionChanged.emit(value);\n }\n\n private performFilter(value: string) {\n const filter = (filterList: string[], text: string) => {\n const filterResult = filterList.filter(value => {\n return text === null || text.length < 1 || value.toLowerCase().indexOf(text.toLowerCase()) > -1;\n });\n return filterResult;\n };\n\n this.filterResult = filter(this.filterList, value);\n\n this.selectedItemIndex = -1;\n }\n\n private addHighlight() {\n if (this.selectedItemIndex > -1) {\n const listItem = this.el.querySelector(`#${this.getListItemId(this.selectedItemIndex)}`);\n listItem.classList.add('highlighted');\n }\n }\n\n private removeHighlight(i: number) {\n if (i > -1) {\n const listItem = this.el.querySelector(`#${this.getListItemId(i)}`);\n listItem.classList.remove('highlighted');\n }\n }\n\n private selectCurrentItem(): void {\n if (this.selectedItemIndex >= 0) {\n const selectedItemText = this.filterResult[this.selectedItemIndex];\n this.handleItemSelected(selectedItemText);\n }\n }\n\n handleItemHovered(index: number): void {\n this.removeHighlight(this.selectedItemIndex);\n this.selectedItemIndex = index;\n this.addHighlight();\n }\n\n handleComponentFocusOut() {\n // Ensure dropdown closed on clicking or tabbing away from this component\n if (this.filterResult?.length > 0) {\n this.filterResult = new Array<string>();\n this.hasBeenFocusedAtLeastOnce = false;\n }\n }\n\n /**\n * Check if the selected option is in view, and scroll if not\n */\n private updateScroll() {\n const container = this.listContainer;\n\n const ul = container.querySelector('ul');\n const selectedItem: any = Array.from(ul.childNodes).find((item: any) => item.ariaPosInSet === `${this.selectedItemIndex + 1}`);\n\n if (container && selectedItem && container.scrollHeight + container.clientHeight) {\n selectedItem.scrollIntoView();\n }\n }\n\n private navigateSuggestions(key: Keys) {\n if (key === Keys.UP_ARROW) {\n this.removeHighlight(this.selectedItemIndex);\n this.selectedItemIndex--;\n if (this.selectedItemIndex === -2) {\n this.selectedItemIndex = this.filterResult.length - 1;\n }\n }\n if (key === Keys.DOWN_ARROW) {\n this.removeHighlight(this.selectedItemIndex);\n this.selectedItemIndex++;\n if (this.selectedItemIndex > this.filterResult.length - 1) {\n this.selectedItemIndex = -1;\n }\n }\n if (this.selectedItemIndex === -1) {\n this.inputValue = this.originalSearch;\n } else {\n const value = this.filterResult[this.selectedItemIndex];\n\n this.inputValue = value;\n\n this.addHighlight();\n }\n }\n\n private getListItemId(i: number) {\n const id = this.getId();\n return `${id}-list-item-${i}`;\n }\n\n private getId() {\n return this.el.id != '' ? this.el.id : `admiralty-typeahead-${this.internalId}`;\n }\n\n render() {\n const id = this.getId();\n const inputId = `${id}-input`;\n const hintId = `${id}-assistive-hint`;\n const listId = `${id}-list`;\n\n return (\n <Host onFocusout={_ev => this.handleComponentFocusOut()}>\n <div class=\"visually-hidden\">\n <div class=\"results-status-a\" role=\"status\" aria-atomic=\"true\" aria-live=\"polite\">\n {!this.isSilenced && this.isAlternateStatusSection ? this.statusText : ''}\n </div>\n <div class=\"results-status-b\" role=\"status\" aria-atomic=\"true\" aria-live=\"polite\">\n {!this.isSilenced && !this.isAlternateStatusSection ? this.statusText : ''}\n </div>\n </div>\n <admiralty-input\n type=\"text\"\n ref={el => (this.inputControl = el)}\n id={inputId}\n label={this.label}\n hint={this.hint}\n placeholder={this.placeholder}\n class=\"filterTextInput\"\n onKeyUp={ev => this.handleKeyPressed(ev)}\n onKeyDown={ev => this.handleKeyDown(ev)}\n onFocusin={_ev => this.handleFocusIn()}\n onFocusout={_ev => this.handleFocusOut()}\n aria-expanded={this.isFocused && this.filterResult.length > 0}\n ></admiralty-input>\n\n <span id={hintId} class=\"visually-hidden\">\n When autocomplete results are available use up and down arrows to review and enter to select. Touch device users, explore by touch or with swipe gestures.\n </span>\n {this.filterResult.length > 0 ? (\n <div class=\"typeahead-list-container\" ref={el => (this.listContainer = el)}>\n <ul class=\"typeahead-list\" id={listId} role=\"listbox\">\n {this.filterResult.map((item, i) => (\n <li\n id={this.getListItemId(i)}\n onMouseDown={_ev => this.handleItemSelected(item)}\n onMouseOver={_ev => this.handleItemHovered(i)}\n aria-selected={i === this.selectedItemIndex}\n role=\"option\"\n tabindex=\"-1\"\n aria-posinset={i + 1}\n aria-setsize={this.filterResult.length}\n >\n {item}\n </li>\n ))}\n </ul>\n </div>\n ) : null}\n <slot></slot>\n </Host>\n );\n }\n}\n\nlet id = 0;\n"],"version":3}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from '../../stencil-public-runtime';
|
|
2
|
-
export declare class TypeAheadComponent {
|
|
3
|
-
private internalId;
|
|
4
|
-
el: HTMLElement;
|
|
5
|
-
listContainer: HTMLDivElement;
|
|
6
|
-
inputControl: HTMLAdmiraltyInputElement;
|
|
7
|
-
filterResult: string[];
|
|
8
|
-
filterList: Array<string>;
|
|
9
|
-
selectedItemIndex: number;
|
|
10
|
-
isFocused: boolean;
|
|
11
|
-
isSilenced: boolean;
|
|
12
|
-
isAlternateStatusSection: boolean;
|
|
13
|
-
statusText: string;
|
|
14
|
-
private mutation;
|
|
15
|
-
private originalSearch;
|
|
16
|
-
private hasBeenFocusedAtLeastOnce;
|
|
17
|
-
private get inputValue();
|
|
18
|
-
private set inputValue(value);
|
|
19
|
-
/**
|
|
20
|
-
* The value of the textinput
|
|
21
|
-
*/
|
|
22
|
-
value: string;
|
|
23
|
-
/**
|
|
24
|
-
* The text content of the label for the input box
|
|
25
|
-
*/
|
|
26
|
-
label: string;
|
|
27
|
-
/**
|
|
28
|
-
* The hint which will be used under the label to describe the input.
|
|
29
|
-
*/
|
|
30
|
-
hint: string;
|
|
31
|
-
/**
|
|
32
|
-
* The placeholder text for the input field
|
|
33
|
-
*/
|
|
34
|
-
placeholder: string;
|
|
35
|
-
/**
|
|
36
|
-
* Optional property to show results when input box is initally focused
|
|
37
|
-
*/
|
|
38
|
-
resultsOnInitFocus: boolean;
|
|
39
|
-
/**
|
|
40
|
-
* Optional function that will be executed when the user selects an item from the typeahead
|
|
41
|
-
*/
|
|
42
|
-
selectionChanged: EventEmitter<string>;
|
|
43
|
-
/**
|
|
44
|
-
* Event that is fired whenever the value of the typeahead changes
|
|
45
|
-
* e.g. selection from the dropdown or manually typed entry
|
|
46
|
-
*/
|
|
47
|
-
valueChanged: EventEmitter<string>;
|
|
48
|
-
componentDidLoad(): void;
|
|
49
|
-
connectedCallback(): void;
|
|
50
|
-
disconnectedCallback(): void;
|
|
51
|
-
populateFilterList(): void;
|
|
52
|
-
handleFocusIn(): void;
|
|
53
|
-
handleFocusOut(): void;
|
|
54
|
-
private textChanged;
|
|
55
|
-
handleKeyPressed(event: KeyboardEvent): void;
|
|
56
|
-
handleKeyDown(event: KeyboardEvent): void;
|
|
57
|
-
handleItemSelected(value: string): void;
|
|
58
|
-
private performFilter;
|
|
59
|
-
private addHighlight;
|
|
60
|
-
private removeHighlight;
|
|
61
|
-
private selectCurrentItem;
|
|
62
|
-
handleItemHovered(index: number): void;
|
|
63
|
-
handleComponentFocusOut(): void;
|
|
64
|
-
/**
|
|
65
|
-
* Check if the selected option is in view, and scroll if not
|
|
66
|
-
*/
|
|
67
|
-
private updateScroll;
|
|
68
|
-
private navigateSuggestions;
|
|
69
|
-
private getListItemId;
|
|
70
|
-
private getId;
|
|
71
|
-
render(): any;
|
|
72
|
-
}
|