Коммит
61d5a0a795
|
@ -10,7 +10,9 @@
|
|||
"rules": {
|
||||
"github/no-then": "off",
|
||||
"no-invalid-this": "off",
|
||||
"custom-elements/tag-name-matches-class": ["error", {"suffix": "Element"}]
|
||||
"custom-elements/tag-name-matches-class": ["error", {"suffix": "Element"}],
|
||||
"import/extensions": ["error", "always"],
|
||||
"import/no-unresolved": "off"
|
||||
},
|
||||
"globals": {
|
||||
"AutocompleteElement": "readonly"
|
||||
|
@ -42,6 +44,12 @@
|
|||
"rules": {
|
||||
"@typescript-eslint/explicit-module-boundary-types": "off"
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": ["*.config.js"],
|
||||
"rules": {
|
||||
"filenames/match-regex": "off"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
18
package.json
18
package.json
|
@ -33,21 +33,21 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@github/prettier-config": "0.0.4",
|
||||
"axe-core": "^4.4.0",
|
||||
"axe-core": "^4.4.1",
|
||||
"chai": "^4.3.6",
|
||||
"chromium": "^3.0.3",
|
||||
"eslint": "^7.25.0",
|
||||
"eslint-plugin-custom-elements": "^0.0.2",
|
||||
"eslint-plugin-github": "^4.1.3",
|
||||
"http-server": "^14.0.0",
|
||||
"karma": "^6.3.2",
|
||||
"eslint": "^8.9.0",
|
||||
"eslint-plugin-custom-elements": "^0.0.4",
|
||||
"eslint-plugin-github": "^4.3.5",
|
||||
"http-server": "^14.1.0",
|
||||
"karma": "^6.3.16",
|
||||
"karma-chai": "^0.1.0",
|
||||
"karma-chrome-launcher": "^3.1.0",
|
||||
"karma-mocha": "^2.0.1",
|
||||
"karma-mocha-reporter": "^2.2.5",
|
||||
"mocha": "^8.3.2",
|
||||
"rollup": "^2.45.2",
|
||||
"mocha": "^9.2.1",
|
||||
"rollup": "^2.68.0",
|
||||
"rollup-plugin-node-resolve": "^5.2.0",
|
||||
"typescript": "^4.2.4"
|
||||
"typescript": "^4.5.5"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import AutocompleteEvent from './auto-complete-event'
|
||||
import Autocomplete from './autocomplete'
|
||||
import Autocomplete from './autocomplete.js'
|
||||
import AutocompleteEvent from './auto-complete-event.js'
|
||||
|
||||
const state = new WeakMap()
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import type AutocompleteElement from './auto-complete-element'
|
||||
import debounce from './debounce'
|
||||
import {fragment} from './send'
|
||||
import Combobox from '@github/combobox-nav'
|
||||
import debounce from './debounce.js'
|
||||
import {fragment} from './send.js'
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
|
@ -93,6 +93,7 @@ export default class Autocomplete {
|
|||
|
||||
if (this.input.getAttribute('aria-expanded') === 'true') {
|
||||
this.input.setAttribute('aria-expanded', 'false')
|
||||
// eslint-disable-next-line i18n-text/no-en
|
||||
this.updateFeedbackForScreenReaders('Results hidden.')
|
||||
}
|
||||
|
||||
|
@ -153,6 +154,7 @@ export default class Autocomplete {
|
|||
this.container.value = value
|
||||
|
||||
if (!value) {
|
||||
// eslint-disable-next-line i18n-text/no-en
|
||||
this.updateFeedbackForScreenReaders(`Results hidden.`)
|
||||
}
|
||||
}
|
||||
|
@ -162,8 +164,8 @@ export default class Autocomplete {
|
|||
}
|
||||
|
||||
onInputChange(): void {
|
||||
if (this.feedback && this.feedback.innerHTML) {
|
||||
this.feedback.innerHTML = ''
|
||||
if (this.feedback && this.feedback.textContent) {
|
||||
this.feedback.textContent = ''
|
||||
}
|
||||
this.container.removeAttribute('value')
|
||||
this.fetchResults()
|
||||
|
@ -179,7 +181,7 @@ export default class Autocomplete {
|
|||
updateFeedbackForScreenReaders(inputString: string): void {
|
||||
setTimeout(() => {
|
||||
if (this.feedback) {
|
||||
this.feedback.innerHTML = inputString
|
||||
this.feedback.textContent = inputString
|
||||
}
|
||||
}, SCREEN_READER_DELAY)
|
||||
}
|
||||
|
@ -202,6 +204,7 @@ export default class Autocomplete {
|
|||
this.container.dispatchEvent(new CustomEvent('loadstart'))
|
||||
fragment(this.input, url.toString())
|
||||
.then(html => {
|
||||
// eslint-disable-next-line github/no-inner-html
|
||||
this.results.innerHTML = html
|
||||
this.identifyOptions()
|
||||
const allNewOptions = this.results.querySelectorAll('[role="option"]')
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
import AutocompleteElement from './auto-complete-element'
|
||||
import AutocompleteElement from './auto-complete-element.js'
|
||||
export {AutocompleteElement as default}
|
||||
export {default as AutocompleteEvent} from './auto-complete-event'
|
||||
export {default as AutocompleteEvent} from './auto-complete-event.js'
|
||||
|
|
|
@ -2,5 +2,8 @@
|
|||
"globals": {
|
||||
"axe": "readonly",
|
||||
"chai": "readonly"
|
||||
},
|
||||
"rules": {
|
||||
"github/no-inner-html": "off"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
const SELECTOR = 'auto-complete'
|
||||
const INPUT_RULE_ID = 'required-input-element-child'
|
||||
// eslint-disable-next-line i18n-text/no-en
|
||||
const INPUT_HELP_TEXT = 'This component requires an input field to be provided.'
|
||||
const CLEAR_BUTTON_RULE_ID = 'optional-clear-must-be-button'
|
||||
// eslint-disable-next-line i18n-text/no-en
|
||||
const CLEAR_BUTTON_HELP_TEXT = 'If provided with clear button, it must be a button element.'
|
||||
|
||||
function checkForInput(autoCompleteElement) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче