@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 +1 @@
|
|
|
1
|
-
{"file":"admiralty-autocomplete.js","mappings":";;;;;;AAAO,MAAM,eAAe,GAAG,CAAwB,WAAwB,EAAE,OAAe,EAAE,QAAqC;IACrI,IAAI,OAAO,gBAAgB,KAAK,WAAW,EAAE;QAC3C,OAAO;KACR;IAED,MAAM,QAAQ,GAAG,IAAI,gBAAgB,CAAC,YAAY;QAChD,QAAQ,CAAC,iBAAiB,CAAI,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC;K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,OAAO,IAAI,IAAI,CAAC,cAAc,KAClC,gFAAyB,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,cAAc,GAAG,SAAS,GAAG,QAAQ,EAAE,IACpH,IAAI,CAAC,cAAc,CACI,CAC3B,CACG,EACN;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,IAAI,MAAM,GAAG,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/autocomplete/optionsWatcher.ts","src/components/autocomplete/autocomplete.scss?tag=admiralty-autocomplete&encapsulation=scoped","src/components/autocomplete/autocomplete.tsx"],"sourcesContent":["export const watchForOptions = <T extends HTMLElement>(containerEl: HTMLElement, tagName: string, onChange: (el: T | undefined) => void) => {\n if (typeof MutationObserver === 'undefined') {\n return;\n }\n\n const mutation = new MutationObserver(mutationList => {\n onChange(getSelectedOption<T>(mutationList, tagName));\n });\n mutation.observe(containerEl, {\n childList: true,\n subtree: true,\n });\n return mutation;\n};\n\nconst getSelectedOption = <T extends HTMLElement>(mutationList: MutationRecord[], tagName: string): T | undefined => {\n let newOption: T | undefined;\n mutationList.forEach(mut => {\n // eslint-disable-next-line @typescript-eslint/prefer-for-of\n for (let i = 0; i < mut.addedNodes.length; i++) {\n newOption = findCheckedOption<T>(mut.addedNodes[i], tagName) || newOption;\n }\n });\n return newOption;\n};\n\n/**\n * The \"value\" key is only set on some components such as ion-select-option.\n * As a result, we create a default union type of HTMLElement and the \"value\" key.\n * However, implementers are required to provide the appropriate component type\n * such as HTMLIonSelectOptionElement.\n */\nexport const findCheckedOption = <T extends HTMLElement & { value?: any | null }>(node: Node, tagName: string) => {\n /**\n * https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType\n * The above check ensures \"node\" is an Element (nodeType 1).\n */\n if (node.nodeType !== 1) {\n return undefined;\n }\n\n // HTMLElement inherits from Element, so we cast \"el\" as T.\n const el = node as T;\n\n const options: T[] = el.tagName === tagName.toUpperCase() ? [el] : Array.from(el.querySelectorAll(tagName));\n\n return options.find((o: T) => o.value === el.value);\n};\n","@import './autocomplete.vars';\n\n.autocomplete__wrapper {\n position: relative;\n}\n\n.autocomplete__hint,\n.autocomplete__input {\n appearance: none;\n border: 2px solid $autocomplete-input-border-colour;\n border-radius: 0; /* Safari 10 on iOS adds implicit border rounding. */\n box-sizing: border-box;\n color: $autocomplete-text-colour;\n margin-bottom: 0; /* BUG: Safari 10 on macOS seems to add an implicit margin. */\n line-height: 1.5;\n width: 100%;\n}\n\n.autocomplete__label {\n background-color: transparent;\n position: relative;\n font-size: $autocomplete-label-font-size;\n}\n\n.autocomplete__input {\n background-color: transparent;\n position: relative;\n}\n\n.autocomplete__hint {\n color: $autocomplete-text-colour;\n position: absolute;\n}\n\n.autocomplete__input-wrapper {\n position: relative;\n}\n\n.autocomplete__input--default {\n padding: 12px;\n}\n\n.autocomplete__input--focused {\n outline: 3px solid $autocomplete-focus-colour;\n outline-offset: 0;\n box-shadow: inset 0 0 0 2px $autocomplete-text-colour;\n}\n\n.autocomplete__input--show-all-values {\n padding: 12px 35px 12px 12px; /* Space for arrow. Other padding should match .autocomplete__input--default. */\n cursor: pointer;\n}\n\n.autocomplete__input--invalid {\n border-color: $autocomplete-error-border-colour;\n}\n\n.autocomplete__input--disabled {\n border-color: $autocomplete-disabled-border-colour;\n}\n\n.autocomplete__menu {\n background-color: $autocomplete-background-colour;\n border: 2px solid $autocomplete-input-border-colour;\n border-top: 0;\n color: $autocomplete-text-colour;\n margin: 0;\n max-height: 342px;\n overflow-x: hidden;\n padding: 0;\n width: 100%;\n width: calc(100% - 4px);\n}\n\n.autocomplete__menu--visible {\n display: block;\n}\n\n.autocomplete__menu--hidden {\n display: none;\n}\n\n.autocomplete__menu--overlay {\n box-shadow: rgba(0, 0, 0, 0.256863) 0px 2px 6px;\n left: 0;\n position: absolute;\n top: 100%;\n z-index: 100;\n}\n\n.autocomplete__menu--inline {\n position: relative;\n}\n\n.autocomplete__option {\n border-bottom: solid $autocomplete-option-border-colour;\n border-width: 1px 0;\n color: $autocomplete-text-colour;\n cursor: pointer;\n display: block;\n position: relative;\n margin-bottom: 0;\n}\n\n.autocomplete__option:before {\n content: none;\n}\n\n.autocomplete__option > * {\n pointer-events: none;\n}\n\n.autocomplete__option:first-of-type {\n border-top-width: 0;\n}\n\n.autocomplete__option:last-of-type {\n border-bottom-width: 0;\n}\n\n.autocomplete__option--focused,\n.autocomplete__option:hover {\n background-color: $autocomplete-option-hover-background-colour;\n border-color: $autocomplete-option-hover-background-colour;\n color: $autocomplete-option-hover-text-colour;\n outline: none;\n}\n\n.autocomplete__option--no-results {\n background-color: $autocomplete-option-no-results-background-colour;\n color: $autocomplete-option-no-results-text-colour;\n text-align: center;\n\n margin-top: 50px;\n margin-bottom: 50px;\n cursor: not-allowed;\n}\n.autocomplete__option--no-results:hover {\n background-color: $autocomplete-option-no-results-background-colour;\n border-color: $autocomplete-option-no-results-background-colour;\n color: $autocomplete-option-no-results-text-colour;\n text-align: center;\n\n margin-top: 50px;\n margin-bottom: 50px;\n cursor: not-allowed;\n}\n\n.autocomplete__hint,\n.autocomplete__input,\n.autocomplete__option {\n font-size: $autocomplete-option-font-size;\n font-weight: $autocomplete-option-font-weight;\n}\n\n.autocomplete__hint,\n.autocomplete__option {\n padding: 10px;\n}\n\n.autocomplete-down-icon {\n font-size: $autocomplete-icon-font-size;\n font-weight: $autocomplete-icon-font-weight;\n pointer-events: none;\n position: absolute;\n right: 12px;\n top: 14px;\n}\n\nadmiralty-icon.disabled {\n color: $autocomplete-dropdown-icon-colour;\n}\n\nadmiralty-input-invalid {\n margin-top: 6px;\n}\n","/**\n * This component takes heavy inspiration from the autocomplete component created by alphagov: https://github.com/alphagov/accessible-autocomplete\n */\n\nimport { Component, forceUpdate, Prop, State, h, Element, EventEmitter, Event, Watch } from '@stencil/core';\nimport { watchForOptions } from './optionsWatcher';\nimport { AutoCompleteChangeEventDetail } from './autocomplete.interface';\n\ninterface Option {\n text: string;\n value: any;\n}\n\nconst keyCodes = {\n 13: 'enter',\n 27: 'escape',\n 32: 'space',\n 38: 'up',\n 40: 'down',\n};\n\nfunction isIosDevice() {\n return typeof navigator !== 'undefined' && !!(navigator.userAgent.match(/(iPod|iPhone|iPad)/g) && navigator.userAgent.match(/AppleWebKit/g));\n}\n\nfunction isPrintableKeyCode(keyCode) {\n return (\n (keyCode > 47 && keyCode < 58) || // number keys\n keyCode === 32 ||\n keyCode === 8 || // spacebar or backspace\n (keyCode > 64 && keyCode < 91) || // letter keys\n (keyCode > 95 && keyCode < 112) || // numpad keys\n (keyCode > 185 && keyCode < 193) || // ;=,-./` (in order)\n (keyCode > 218 && keyCode < 223) // [\\]' (in order)\n );\n}\n\nfunction filterOptions(options: Option[], searchTerm: string) {\n return options.filter(({ text }) => text.toLowerCase().indexOf(searchTerm.toLowerCase()) !== -1);\n}\n\nfunction filterOptionsByValue(options: Option[], searchTerm: string) {\n return options.filter(({ value }) => value.toLowerCase().indexOf(searchTerm.toLowerCase()) !== -1);\n}\n\n@Component({\n tag: 'admiralty-autocomplete',\n styleUrl: 'autocomplete.scss',\n scoped: true,\n})\nexport class AutocompleteComponent {\n private internalId = ++nextId;\n\n @Element() el!: HTMLAdmiraltyAutocompleteElement;\n\n /**\n * Automatically select the first matching option.\n */\n @Prop() autoselect: boolean = false;\n /**\n * The default CSS namespace.\n */\n @Prop() cssNamespace: string = 'autocomplete';\n /**\n * When set to `overlay` this option will display the menu as an absolutely positioned overlay instead of inline.\n */\n @Prop() displayMenu: string = 'inline';\n /**\n * Prevent displaying options until the minimum string length is reached. Ignored when show all values is enabled.\n */\n @Prop() minLength: number = 0;\n /**\n * The name for the `<input>` element.\n */\n @Prop() name: string;\n /**\n * Populate the placeholder attribute on the `<input>` element.\n */\n @Prop() placeholder: string = '';\n /**\n * Toggle automatically confirming a selection when the field is blurred.\n */\n @Prop() confirmOnBlur: boolean = true;\n /**\n * Toggle whether to display the \"No results found\" message.\n */\n @Prop() showNoOptionsFound: boolean = true;\n /**\n * Toggle showing all values when the input is clicked, like a default dropdown.\n */\n @Prop() showAllValues: boolean = true;\n /**\n * Populates the required field on the `<input>` element.\n */\n @Prop() required: boolean = false;\n /**\n * The hint that is provided to assistive users.\n */\n @Prop() assistiveHint: string =\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\n /**\n * Sets HTML attributes and their values on the generated `ul` menu element. Useful for adding `aria-labelledby`\n * and setting to the value of the `id` attribute on your existing label, to provide context to an assistive\n * technology user. e.g.\n * ```\n * const menuAttributes = {\n * className: 'custom-className',\n * class: 'custom-class',\n * id: 'custom-id',\n * role: 'custom-role'\n * }\n * ```\n * */\n @Prop() menuAttributes: any;\n /**\n * Classes to add to the component's `<input>` element.\n */\n @Prop() inputClasses: string;\n /**\n * Classes to add to the menu displaying the options.\n */\n @Prop() menuClasses: string;\n /**\n * The text that will be used as a field label.\n */\n @Prop() label: string = null;\n /**\n * TThe text which will be used under the label to describe the input.\n */\n @Prop() hint: string = null;\n /**\n * Whether to show that the component is in an invalid state.\n */\n @Prop() invalid: boolean = false;\n /**\n * The message to show when the component is invalid.\n */\n @Prop() invalidMessage: string = null;\n /**\n * When `true`, the component cannot be interacted with.\n */\n @Prop() disabled: boolean = false;\n /**\n * The value of the input.\n */\n @Prop({ mutable: true }) value?: string | null = null;\n\n /**\n * Emitted when the value has changed.\n */\n @Event() admiraltyChange: EventEmitter<AutoCompleteChangeEventDetail>;\n\n elementReferences = {};\n $pollInput: NodeJS.Timeout;\n\n source: Option[] = [];\n\n @State() focused: number | null = null;\n @State() hovered: number | null = null;\n @State() menuOpen: boolean = false;\n @State() options: Option[] = [];\n @State() option: Option = null;\n @State() query: string = null;\n @State() validChoiceMade: boolean = false;\n @State() selected: number | null = null;\n @State() ariaHint: boolean = true;\n\n @Watch('value')\n onValueChange(newVal: string, _: string) {\n if (this.source.length === 0) {\n // If this is the initial render, the options won't have been set yet, so do nothing\n return;\n }\n if (newVal && newVal.length > 0) {\n const matches = filterOptionsByValue(this.source, newVal);\n const matchFound = matches.length > 0;\n this.options = matches;\n this.validChoiceMade = matchFound;\n this.option = matches[0];\n this.query = matchFound ? matches[0].text : '';\n this.menuOpen = false;\n this.ariaHint = false;\n } else {\n this.options = [];\n this.option = null;\n this.query = '';\n this.ariaHint = true;\n }\n\n this.admiraltyChange.emit({ value: this.option?.value ?? '' });\n }\n\n @Watch('focused')\n onFocusedChange(newVal: number | null, oldVal: number | null) {\n const componentLostFocus = this.focused === null;\n const focusedChanged = oldVal !== newVal;\n const focusDifferentElement = focusedChanged && !componentLostFocus;\n if (focusDifferentElement) {\n this.elementReferences[this.focused]?.focus();\n }\n const focusedInput = this.focused === -1;\n const componentGainedFocus = focusedChanged && oldVal === null;\n const selectAllText = focusedInput && componentGainedFocus;\n if (selectAllText) {\n const inputElement = this.elementReferences[this.focused];\n inputElement.setSelectionRange(0, inputElement.value.length);\n }\n }\n\n isQueryAnOption(query: string, options: Option[]) {\n return options.map(({ text }) => this.templateInputValue(text).toLowerCase()).indexOf(query.toLowerCase()) !== -1;\n }\n\n connectedCallback() {\n this.mutation = watchForOptions<HTMLAdmiraltyAutocompleteOptionElement>(this.el, 'admiralty-autocomplete-option', async () => {\n this.source = this.childOpts.map(({ textContent, value }) => ({\n text: textContent?.length > 0 ? textContent : value,\n value: value ?? textContent,\n }));\n if (this.query === null && this.value?.length > 0) {\n const matches = filterOptionsByValue(this.source, this.value);\n this.options = matches;\n this.option = matches[0];\n this.query = matches[0]?.text ?? '';\n }\n forceUpdate(this);\n });\n // this.pollInputElement();\n }\n\n disconnectedCallback() {\n clearTimeout(this.$pollInput);\n }\n\n // Applications like Dragon NaturallySpeaking will modify the\n // `input` field by directly changing its `.value`. These events\n // don't trigger our JavaScript event listeners, so we need to poll\n // to handle when and if they occur.\n pollInputElement() {\n this.getDirectInputChanges();\n this.$pollInput = setTimeout(() => {\n this.pollInputElement();\n }, 100);\n }\n\n getDirectInputChanges() {\n const inputReference = this.elementReferences[-1];\n const queryHasChanged = inputReference && inputReference.value !== this.query;\n\n if (queryHasChanged) {\n this.handleInputChange({ target: { value: inputReference.value } });\n }\n }\n\n mutation: MutationObserver;\n\n private get childOpts() {\n return Array.from(this.el.querySelectorAll('admiralty-autocomplete-option'));\n }\n\n hasAutoselect() {\n return isIosDevice() ? false : this.autoselect;\n }\n\n // This template is used when converting from a state.options object into a state.query.\n templateInputValue(value) {\n // const inputValueTemplate = this.templates && this.templates.inputValue;\n // return inputValueTemplate ? inputValueTemplate(value) : value;\n return value;\n }\n\n // This template is used when displaying results / suggestions.\n templateSuggestion(value) {\n // const suggestionTemplate = this.templates && this.templates.suggestion;\n // return suggestionTemplate ? suggestionTemplate(value) : value;\n return value;\n }\n\n handleComponentBlur(newState: { menuOpen: boolean; query: string }) {\n let newQuery: string;\n if (this.confirmOnBlur) {\n newQuery = newState.query || this.query;\n const matches = filterOptions(this.source, newQuery);\n const matchFound = newQuery?.length > 0 && matches.length > 0;\n const option = matchFound ? matches[0] : { value: null, text: '' };\n this.value = option.value;\n } else {\n newQuery = this.query;\n }\n this.focused = null;\n this.menuOpen = newState.menuOpen || false;\n this.selected = null;\n this.validChoiceMade = this.isQueryAnOption(newQuery, this.options);\n }\n\n handleListMouseLeave() {\n this.hovered = null;\n }\n\n handleOptionBlur(event, index) {\n const focusingOutsideComponent = event.relatedTarget === null;\n const focusingInput = event.relatedTarget === this.elementReferences[-1];\n const focusingAnotherOption = this.focused !== index && this.focused !== -1;\n const blurComponent = (!focusingAnotherOption && focusingOutsideComponent) || !(focusingAnotherOption || focusingInput);\n if (blurComponent) {\n const keepMenuOpen = this.menuOpen && isIosDevice();\n this.handleComponentBlur({\n menuOpen: keepMenuOpen,\n query: this.templateInputValue(this.options[this.selected]?.text ?? ''),\n });\n }\n }\n\n handleInputBlur(_) {\n const focusingAnOption = this.focused !== -1;\n if (!focusingAnOption) {\n const keepMenuOpen = this.menuOpen && isIosDevice();\n this.handleComponentBlur({\n menuOpen: keepMenuOpen,\n query: this.query,\n });\n }\n }\n\n handleInputChange(event) {\n const autoselect = this.hasAutoselect();\n const query = event.target.value;\n const queryEmpty = query.length === 0;\n const queryChanged = this.query !== query;\n const queryLongEnough = query.length >= this.minLength;\n\n this.query = query;\n this.ariaHint = queryEmpty;\n\n const searchForOptions = this.showAllValues || (!queryEmpty && queryChanged && queryLongEnough);\n if (searchForOptions) {\n const matches = filterOptions(this.source, this.query);\n const optionsAvailable = matches.length > 0;\n this.menuOpen = optionsAvailable;\n this.options = matches;\n this.selected = autoselect && optionsAvailable ? 0 : -1;\n this.validChoiceMade = false;\n } else if (queryEmpty || !queryLongEnough) {\n this.menuOpen = false;\n this.options = [];\n }\n }\n\n handleInputClick(event) {\n this.handleInputChange(event);\n }\n\n handleInputFocus(_) {\n const shouldReopenMenu = !this.validChoiceMade && this.query?.length >= this.minLength && this.options.length > 0;\n\n if (shouldReopenMenu) {\n this.focused = -1;\n this.menuOpen = shouldReopenMenu || this.menuOpen;\n this.selected = -1;\n } else {\n this.focused = -1;\n }\n }\n\n handleOptionFocus(index) {\n this.focused = index;\n this.hovered = null;\n this.selected = index;\n }\n\n handleOptionMouseEnter(index) {\n // iOS Safari prevents click event if mouseenter adds hover background colour\n // See: https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html#//apple_ref/doc/uid/TP40006511-SW4\n if (!isIosDevice()) {\n this.hovered = index;\n }\n }\n\n handleOptionClick(_, index) {\n const selectedOption = this.options[index];\n this.value = selectedOption.value;\n this.focused = -1;\n this.hovered = null;\n this.menuOpen = false;\n this.selected = index;\n this.validChoiceMade = true;\n forceUpdate(this);\n }\n\n handleOptionMouseDown(event) {\n // Safari triggers focusOut before click, but if you\n // preventDefault on mouseDown, you can stop that from happening.\n // If this is removed, clicking on an option in Safari will trigger\n // `handleOptionBlur`, which closes the menu, and the click will\n // trigger on the element underneath instead.\n // See: http://stackoverflow.com/questions/7621711/how-to-prevent-blur-running-when-clicking-a-link-in-jquery\n event.preventDefault();\n }\n\n handleUpArrow(event) {\n event.preventDefault();\n const isNotAtTop = this.selected !== -1;\n const allowMoveUp = isNotAtTop && this.menuOpen;\n if (allowMoveUp) {\n this.handleOptionFocus(this.selected - 1);\n }\n }\n\n handleDownArrow(event) {\n event.preventDefault();\n // if not open, open\n if (this.showAllValues && this.menuOpen === false) {\n event.preventDefault();\n const matches = filterOptions(this.source, '');\n this.menuOpen = true;\n this.options = matches;\n this.selected = 0;\n this.focused = 0;\n this.hovered = null;\n } else if (this.menuOpen === true) {\n const isNotAtBottom = this.selected !== this.options.length - 1;\n const allowMoveDown = isNotAtBottom && this.menuOpen;\n if (allowMoveDown) {\n this.handleOptionFocus(this.selected + 1);\n }\n }\n }\n\n handleSpace(event) {\n // if not open, open\n if (this.showAllValues && this.menuOpen === false && this.query === '') {\n event.preventDefault();\n const matches = filterOptions(this.source, '');\n this.menuOpen = true;\n this.options = matches;\n }\n const focusIsOnOption = this.focused !== -1;\n if (focusIsOnOption) {\n event.preventDefault();\n this.handleOptionClick(event, this.focused);\n }\n }\n\n handleEnter(event) {\n if (this.menuOpen) {\n event.preventDefault();\n const hasSelectedOption = this.selected >= 0;\n if (hasSelectedOption) {\n this.handleOptionClick(event, this.selected);\n }\n }\n }\n\n handlePrintableKey(event) {\n const inputElement = this.elementReferences[-1];\n const eventIsOnInput = event.target === inputElement;\n if (!eventIsOnInput) {\n // FIXME: This would be better if it was in componentDidUpdate,\n // but using setState to trigger that seems to not work correctly\n // in preact@8.1.0.\n inputElement.focus();\n }\n }\n\n handleKeyDown(event) {\n switch (keyCodes[event.keyCode]) {\n case 'up':\n this.handleUpArrow(event);\n break;\n case 'down':\n this.handleDownArrow(event);\n break;\n case 'space':\n this.handleSpace(event);\n break;\n case 'enter':\n this.handleEnter(event);\n break;\n case 'escape':\n this.handleComponentBlur({\n query: this.query,\n menuOpen: this.menuOpen,\n });\n break;\n default:\n if (isPrintableKeyCode(event.keyCode)) {\n this.handlePrintableKey(event);\n }\n break;\n }\n }\n\n render() {\n const id = this.el.id != '' ? this.el.id : `admiralty-autocomplete-${this.internalId}`;\n const inputId = `${id}-input`;\n const hintId = `${id}-hint`;\n const errorId = `${id}-error`;\n\n const inputFocused = this.focused === -1;\n const noOptionsAvailable = this.options.length === 0;\n const queryNotEmpty = this.query?.length !== 0;\n const queryLongEnough = this.query?.length >= this.minLength;\n const showNoOptionsFound = this.showNoOptionsFound && inputFocused && noOptionsAvailable && queryNotEmpty && queryLongEnough;\n\n const wrapperClassName = `${this.cssNamespace}__wrapper`;\n const optionFocused = this.focused !== -1 && this.focused !== null;\n\n const optionClassName = `${this.cssNamespace}__option`;\n\n const assistiveHintID = id + '__assistiveHint';\n const ariaProps = {\n 'aria-describedby': `${this.hint ? hintId : ''} ${this.ariaHint ? assistiveHintID : ''} ${this.invalid ? errorId : ''}`,\n 'aria-expanded': this.menuOpen ? 'true' : 'false',\n 'aria-activedescendant': optionFocused ? `${id}__option--${this.focused}` : null,\n 'aria-owns': `${id}__listbox`,\n 'aria-autocomplete': this.hasAutoselect() ? 'both' : 'list',\n };\n\n const inputClassName = `${this.cssNamespace}__input`;\n const inputClassList = [inputClassName, this.showAllValues ? `${inputClassName}--show-all-values` : `${inputClassName}--default`];\n\n const componentIsFocused = this.focused !== null;\n if (componentIsFocused) {\n inputClassList.push(`${inputClassName}--focused`);\n }\n\n if (this.inputClasses) {\n inputClassList.push(this.inputClasses);\n }\n\n if (this.invalid && this.invalidMessage) {\n inputClassList.push(`${inputClassName}--invalid`);\n }\n\n if (this.disabled) {\n inputClassList.push(`${inputClassName}--disabled`);\n }\n\n const menuClassName = `${this.cssNamespace}__menu`;\n const menuModifierDisplayMenu = `${menuClassName}--${this.displayMenu}`;\n const menuIsVisible = this.menuOpen || showNoOptionsFound;\n const menuModifierVisibility = `${menuClassName}--${menuIsVisible ? 'visible' : 'hidden'}`;\n\n const menuClassList = [menuClassName, menuModifierDisplayMenu, menuModifierVisibility];\n\n if (this.menuClasses) {\n menuClassList.push(this.menuClasses);\n }\n\n if (this.menuAttributes?.class || this.menuAttributes?.className) {\n menuClassList.push(this.menuAttributes?.class || this.menuAttributes?.className);\n }\n\n const computedMenuAttributes = {\n // Copy the attributes passed as props\n ...this.menuAttributes,\n // And add the values computed for the autocomplete\n id: `${id}__listbox`,\n role: 'listbox',\n onMouseLeave: this.handleListMouseLeave,\n };\n\n // Preact would override our computed `className`\n // with the `class` from the `menuAttributes` so\n // we need to clean it up from the computed attributes\n delete computedMenuAttributes.class;\n\n return (\n <div class={wrapperClassName} onKeyDown={event => this.handleKeyDown(event)}>\n {this.label ? (\n <admiralty-label class=\"autocomplete__label\" disabled={this.disabled} for={inputId}>\n {this.label}\n </admiralty-label>\n ) : null}\n {this.hint ? (\n <admiralty-hint id={hintId} disabled={this.disabled}>\n {this.hint}\n </admiralty-hint>\n ) : null}\n <div class=\"autocomplete__input-wrapper\">\n <input\n {...ariaProps}\n disabled={this.disabled}\n aria-disabled={this.disabled}\n autoComplete=\"off\"\n class={inputClassList.join(' ')}\n id={inputId}\n onClick={event => this.handleInputClick(event)}\n onBlur={event => this.handleInputBlur(event)}\n onInput={event => this.handleInputChange(event)}\n onFocus={event => this.handleInputFocus(event)}\n name={this.name}\n placeholder={this.placeholder}\n ref={inputElement => {\n this.elementReferences[-1] = inputElement;\n }}\n type=\"text\"\n role=\"combobox\"\n required={this.required}\n value={this.query}\n />\n <admiralty-icon class={`autocomplete-down-icon ${this.disabled ? 'disabled' : ''}`} icon-name={this.menuOpen || showNoOptionsFound ? 'angle-up' : 'angle-down'} />\n </div>\n\n <ul {...computedMenuAttributes} class={menuClassList.join(' ')}>\n {this.options.map((option, index) => {\n const showFocused = this.focused === -1 ? this.selected === index : this.focused === index;\n const optionModifierFocused = showFocused && this.hovered === null ? ` ${optionClassName}--focused` : '';\n const iosPosinsetHtml = isIosDevice()\n ? `<span id=${id}__option-suffix--${index} style=\"border:0;clip:rect(0 0 0 0);height:1px;` +\n 'marginBottom:-1px;marginRight:-1px;overflow:hidden;padding:0;position:absolute;' +\n 'whiteSpace:nowrap;width:1px\">' +\n ` ${index + 1} of ${this.options.length}</span>`\n : '';\n\n return (\n <li\n aria-selected={this.focused === index ? 'true' : 'false'}\n class={`${optionClassName}${optionModifierFocused}`}\n innerHTML={this.templateSuggestion(option.text) + iosPosinsetHtml}\n id={`${id}__option--${index}`}\n key={index}\n onBlur={event => this.handleOptionBlur(event, index)}\n onClick={event => this.handleOptionClick(event, index)}\n onMouseDown={event => this.handleOptionMouseDown(event)}\n onMouseEnter={() => this.handleOptionMouseEnter(index)}\n ref={optionEl => {\n this.elementReferences[index] = optionEl;\n }}\n role=\"option\"\n tabIndex={-1}\n aria-posinset={index + 1}\n aria-setsize={this.options.length}\n />\n );\n })}\n\n {showNoOptionsFound && <li class={`${optionClassName} ${optionClassName}--no-results`}>No results found</li>}\n </ul>\n\n <span id={assistiveHintID} style={{ display: 'none' }}>\n {this.assistiveHint}\n </span>\n {this.invalid && this.invalidMessage && (\n <admiralty-input-invalid id={errorId} style={{ visibility: this.invalid && this.invalidMessage ? 'visible' : 'hidden' }}>\n {this.invalidMessage}\n </admiralty-input-invalid>\n )}\n </div>\n );\n }\n}\nlet nextId = 0;\n"],"version":3}
|
|
1
|
+
{"file":"admiralty-autocomplete.js","mappings":";;;;;;AAAO,MAAM,eAAe,GAAG,CAAwB,WAAwB,EAAE,OAAe,EAAE,QAAqC;IACrI,IAAI,OAAO,gBAAgB,KAAK,WAAW,EAAE;QAC3C,OAAO;KACR;IAED,MAAM,QAAQ,GAAG,IAAI,gBAAgB,CAAC,YAAY;QAChD,QAAQ,CAAC,iBAAiB,CAAI,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC;KACvD,CAAC,CAAC;IACH,QAAQ,CAAC,OAAO,CAAC,WAAW,EAAE;QAC5B,SAAS,EAAE,IAAI;QACf,OAAO,EAAE,IAAI;KAC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E,UAAU,EAAE,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,cAAc,GAAG,SAAS,GAAG,QAAQ,EAAE,IACpH,IAAI,CAAC,cAAc,CACI,CAC3B,CACG,EACN;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,IAAI,MAAM,GAAG,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/autocomplete/optionsWatcher.ts","src/components/autocomplete/autocomplete.scss?tag=admiralty-autocomplete&encapsulation=scoped","src/components/autocomplete/autocomplete.tsx"],"sourcesContent":["export const watchForOptions = <T extends HTMLElement>(containerEl: HTMLElement, tagName: string, onChange: (el: T | undefined) => void) => {\n if (typeof MutationObserver === 'undefined') {\n return;\n }\n\n const mutation = new MutationObserver(mutationList => {\n onChange(getSelectedOption<T>(mutationList, tagName));\n });\n mutation.observe(containerEl, {\n childList: true,\n subtree: true,\n });\n return mutation;\n};\n\nconst getSelectedOption = <T extends HTMLElement>(mutationList: MutationRecord[], tagName: string): T | undefined => {\n let newOption: T | undefined;\n mutationList.forEach(mut => {\n // eslint-disable-next-line @typescript-eslint/prefer-for-of\n for (let i = 0; i < mut.addedNodes.length; i++) {\n newOption = findCheckedOption<T>(mut.addedNodes[i], tagName) || newOption;\n }\n });\n return newOption;\n};\n\n/**\n * The \"value\" key is only set on some components such as ion-select-option.\n * As a result, we create a default union type of HTMLElement and the \"value\" key.\n * However, implementers are required to provide the appropriate component type\n * such as HTMLIonSelectOptionElement.\n */\nexport const findCheckedOption = <T extends HTMLElement & { value?: any | null }>(node: Node, tagName: string) => {\n /**\n * https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType\n * The above check ensures \"node\" is an Element (nodeType 1).\n */\n if (node.nodeType !== 1) {\n return undefined;\n }\n\n // HTMLElement inherits from Element, so we cast \"el\" as T.\n const el = node as T;\n\n const options: T[] = el.tagName === tagName.toUpperCase() ? [el] : Array.from(el.querySelectorAll(tagName));\n\n return options.find((o: T) => o.value === el.value);\n};\n","@import './autocomplete.vars';\n\n.autocomplete__wrapper {\n position: relative;\n}\n\n.autocomplete__hint,\n.autocomplete__input {\n appearance: none;\n border: 2px solid $autocomplete-input-border-colour;\n border-radius: 0; /* Safari 10 on iOS adds implicit border rounding. */\n box-sizing: border-box;\n color: $autocomplete-text-colour;\n margin-bottom: 0; /* BUG: Safari 10 on macOS seems to add an implicit margin. */\n line-height: 1.5;\n width: 100%;\n}\n\n.autocomplete__label {\n background-color: transparent;\n position: relative;\n font-size: $autocomplete-label-font-size;\n}\n\n.autocomplete__input {\n background-color: transparent;\n position: relative;\n}\n\n.autocomplete__hint {\n color: $autocomplete-text-colour;\n position: absolute;\n}\n\n.autocomplete__input-wrapper {\n position: relative;\n}\n\n.autocomplete__input--default {\n padding: 12px;\n}\n\n.autocomplete__input--focused {\n outline: 3px solid $autocomplete-focus-colour;\n outline-offset: 0;\n box-shadow: inset 0 0 0 2px $autocomplete-text-colour;\n}\n\n.autocomplete__input--show-all-values {\n padding: 12px 35px 12px 12px; /* Space for arrow. Other padding should match .autocomplete__input--default. */\n cursor: pointer;\n}\n\n.autocomplete__input--invalid {\n border-color: $autocomplete-error-border-colour;\n}\n\n.autocomplete__input--disabled {\n border-color: $autocomplete-disabled-border-colour;\n}\n\n.autocomplete__menu {\n background-color: $autocomplete-background-colour;\n border: 2px solid $autocomplete-input-border-colour;\n border-top: 0;\n color: $autocomplete-text-colour;\n margin: 0;\n max-height: 342px;\n overflow-x: hidden;\n padding: 0;\n width: 100%;\n width: calc(100% - 4px);\n}\n\n.autocomplete__menu--visible {\n display: block;\n}\n\n.autocomplete__menu--hidden {\n display: none;\n}\n\n.autocomplete__menu--overlay {\n box-shadow: rgba(0, 0, 0, 0.256863) 0px 2px 6px;\n left: 0;\n position: absolute;\n top: 100%;\n z-index: 100;\n}\n\n.autocomplete__menu--inline {\n position: relative;\n}\n\n.autocomplete__option {\n border-bottom: solid $autocomplete-option-border-colour;\n border-width: 1px 0;\n color: $autocomplete-text-colour;\n cursor: pointer;\n display: block;\n position: relative;\n margin-bottom: 0;\n}\n\n.autocomplete__option:before {\n content: none;\n}\n\n.autocomplete__option > * {\n pointer-events: none;\n}\n\n.autocomplete__option:first-of-type {\n border-top-width: 0;\n}\n\n.autocomplete__option:last-of-type {\n border-bottom-width: 0;\n}\n\n.autocomplete__option--focused,\n.autocomplete__option:hover {\n background-color: $autocomplete-option-hover-background-colour;\n border-color: $autocomplete-option-hover-background-colour;\n color: $autocomplete-option-hover-text-colour;\n outline: none;\n}\n\n.autocomplete__option--no-results {\n background-color: $autocomplete-option-no-results-background-colour;\n color: $autocomplete-option-no-results-text-colour;\n text-align: center;\n\n margin-top: 50px;\n margin-bottom: 50px;\n cursor: not-allowed;\n}\n.autocomplete__option--no-results:hover {\n background-color: $autocomplete-option-no-results-background-colour;\n border-color: $autocomplete-option-no-results-background-colour;\n color: $autocomplete-option-no-results-text-colour;\n text-align: center;\n\n margin-top: 50px;\n margin-bottom: 50px;\n cursor: not-allowed;\n}\n\n.autocomplete__hint,\n.autocomplete__input,\n.autocomplete__option {\n font-size: $autocomplete-option-font-size;\n font-weight: $autocomplete-option-font-weight;\n}\n\n.autocomplete__hint,\n.autocomplete__option {\n padding: 10px;\n}\n\n.autocomplete-down-icon {\n font-size: $autocomplete-icon-font-size;\n font-weight: $autocomplete-icon-font-weight;\n pointer-events: none;\n position: absolute;\n right: 12px;\n top: 14px;\n}\n\nadmiralty-icon.disabled {\n color: $autocomplete-dropdown-icon-colour;\n}\n\nadmiralty-input-invalid {\n margin-top: 6px;\n}\n","/**\n * This component takes heavy inspiration from the autocomplete component created by alphagov: https://github.com/alphagov/accessible-autocomplete\n */\n\nimport { Component, forceUpdate, Prop, State, h, Element, EventEmitter, Event, Watch } from '@stencil/core';\nimport { watchForOptions } from './optionsWatcher';\nimport { AutoCompleteChangeEventDetail } from './autocomplete.interface';\n\ninterface Option {\n text: string;\n value: any;\n}\n\nconst keyCodes = {\n 13: 'enter',\n 27: 'escape',\n 32: 'space',\n 38: 'up',\n 40: 'down',\n};\n\nfunction isIosDevice() {\n return typeof navigator !== 'undefined' && !!(navigator.userAgent.match(/(iPod|iPhone|iPad)/g) && navigator.userAgent.match(/AppleWebKit/g));\n}\n\nfunction isPrintableKeyCode(keyCode) {\n return (\n (keyCode > 47 && keyCode < 58) || // number keys\n keyCode === 32 ||\n keyCode === 8 || // spacebar or backspace\n (keyCode > 64 && keyCode < 91) || // letter keys\n (keyCode > 95 && keyCode < 112) || // numpad keys\n (keyCode > 185 && keyCode < 193) || // ;=,-./` (in order)\n (keyCode > 218 && keyCode < 223) // [\\]' (in order)\n );\n}\n\nfunction filterOptions(options: Option[], searchTerm: string) {\n return options.filter(({ text }) => text.toLowerCase().indexOf(searchTerm.toLowerCase()) !== -1);\n}\n\nfunction filterOptionsByValue(options: Option[], searchTerm: string) {\n return options.filter(({ value }) => value.toLowerCase().indexOf(searchTerm.toLowerCase()) !== -1);\n}\n\n@Component({\n tag: 'admiralty-autocomplete',\n styleUrl: 'autocomplete.scss',\n scoped: true,\n})\nexport class AutocompleteComponent {\n private internalId = ++nextId;\n\n @Element() el!: HTMLAdmiraltyAutocompleteElement;\n\n /**\n * Automatically select the first matching option.\n */\n @Prop() autoselect: boolean = false;\n /**\n * The default CSS namespace.\n */\n @Prop() cssNamespace: string = 'autocomplete';\n /**\n * When set to `overlay` this option will display the menu as an absolutely positioned overlay instead of inline.\n */\n @Prop() displayMenu: string = 'inline';\n /**\n * Prevent displaying options until the minimum string length is reached. Ignored when show all values is enabled.\n */\n @Prop() minLength: number = 0;\n /**\n * The name for the `<input>` element.\n */\n @Prop() name: string;\n /**\n * Populate the placeholder attribute on the `<input>` element.\n */\n @Prop() placeholder: string = '';\n /**\n * Toggle automatically confirming a selection when the field is blurred.\n */\n @Prop() confirmOnBlur: boolean = true;\n /**\n * Toggle whether to display the \"No results found\" message.\n */\n @Prop() showNoOptionsFound: boolean = true;\n /**\n * Toggle showing all values when the input is clicked, like a default dropdown. This will hide the chevron when set to false.\n */\n @Prop() showAllValues: boolean = true;\n /**\n * Populates the required field on the `<input>` element.\n */\n @Prop() required: boolean = false;\n /**\n * The hint that is provided to assistive users.\n */\n @Prop() assistiveHint: string =\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\n /**\n * Sets HTML attributes and their values on the generated `ul` menu element. Useful for adding `aria-labelledby`\n * and setting to the value of the `id` attribute on your existing label, to provide context to an assistive\n * technology user. e.g.\n * ```\n * const menuAttributes = {\n * className: 'custom-className',\n * class: 'custom-class',\n * id: 'custom-id',\n * role: 'custom-role'\n * }\n * ```\n * */\n @Prop() menuAttributes: any;\n /**\n * Classes to add to the component's `<input>` element.\n */\n @Prop() inputClasses: string;\n /**\n * Classes to add to the menu displaying the options.\n */\n @Prop() menuClasses: string;\n /**\n * The text that will be used as a field label.\n */\n @Prop() label: string = null;\n /**\n * TThe text which will be used under the label to describe the input.\n */\n @Prop() hint: string = null;\n /**\n * Whether to show that the component is in an invalid state.\n */\n @Prop() invalid: boolean = false;\n /**\n * The message to show when the component is invalid.\n */\n @Prop() invalidMessage: string = null;\n /**\n * When `true`, the component cannot be interacted with.\n */\n @Prop() disabled: boolean = false;\n /**\n * The value of the input.\n */\n @Prop({ mutable: true }) value?: string | null = null;\n\n /**\n * Emitted when the value has changed.\n */\n @Event() admiraltyChange: EventEmitter<AutoCompleteChangeEventDetail>;\n\n elementReferences = {};\n $pollInput: NodeJS.Timeout;\n\n source: Option[] = [];\n\n @State() focused: number | null = null;\n @State() hovered: number | null = null;\n @State() menuOpen: boolean = false;\n @State() options: Option[] = [];\n @State() option: Option = null;\n @State() query: string = null;\n @State() validChoiceMade: boolean = false;\n @State() selected: number | null = null;\n @State() ariaHint: boolean = true;\n\n @Watch('value')\n onValueChange(newVal: string, _: string) {\n if (this.source.length === 0) {\n // If this is the initial render, the options won't have been set yet, so do nothing\n return;\n }\n if (newVal && newVal.length > 0) {\n const matches = filterOptionsByValue(this.source, newVal);\n const matchFound = matches.length > 0;\n this.options = matches;\n this.validChoiceMade = matchFound;\n this.option = matches[0];\n this.query = matchFound ? matches[0].text : '';\n this.menuOpen = false;\n this.ariaHint = false;\n } else {\n this.options = [];\n this.option = null;\n this.query = '';\n this.ariaHint = true;\n }\n\n this.admiraltyChange.emit({ value: this.option?.value ?? '' });\n }\n\n @Watch('focused')\n onFocusedChange(newVal: number | null, oldVal: number | null) {\n const componentLostFocus = this.focused === null;\n const focusedChanged = oldVal !== newVal;\n const focusDifferentElement = focusedChanged && !componentLostFocus;\n if (focusDifferentElement) {\n this.elementReferences[this.focused]?.focus();\n }\n const focusedInput = this.focused === -1;\n const componentGainedFocus = focusedChanged && oldVal === null;\n const selectAllText = focusedInput && componentGainedFocus;\n if (selectAllText) {\n const inputElement = this.elementReferences[this.focused];\n inputElement.setSelectionRange(0, inputElement.value.length);\n }\n }\n\n isQueryAnOption(query: string, options: Option[]) {\n return options.map(({ text }) => this.templateInputValue(text).toLowerCase()).indexOf(query.toLowerCase()) !== -1;\n }\n\n connectedCallback() {\n this.mutation = watchForOptions<HTMLAdmiraltyAutocompleteOptionElement>(this.el, 'admiralty-autocomplete-option', async () => {\n this.source = this.childOpts.map(({ textContent, value }) => ({\n text: textContent?.length > 0 ? textContent : value,\n value: value ?? textContent,\n }));\n if (this.query === null && this.value?.length > 0) {\n const matches = filterOptionsByValue(this.source, this.value);\n this.options = matches;\n this.option = matches[0];\n this.query = matches[0]?.text ?? '';\n }\n forceUpdate(this);\n });\n // this.pollInputElement();\n }\n\n disconnectedCallback() {\n clearTimeout(this.$pollInput);\n }\n\n // Applications like Dragon NaturallySpeaking will modify the\n // `input` field by directly changing its `.value`. These events\n // don't trigger our JavaScript event listeners, so we need to poll\n // to handle when and if they occur.\n pollInputElement() {\n this.getDirectInputChanges();\n this.$pollInput = setTimeout(() => {\n this.pollInputElement();\n }, 100);\n }\n\n getDirectInputChanges() {\n const inputReference = this.elementReferences[-1];\n const queryHasChanged = inputReference && inputReference.value !== this.query;\n\n if (queryHasChanged) {\n this.handleInputChange({ target: { value: inputReference.value } });\n }\n }\n\n mutation: MutationObserver;\n\n private get childOpts() {\n return Array.from(this.el.querySelectorAll('admiralty-autocomplete-option'));\n }\n\n hasAutoselect() {\n return isIosDevice() ? false : this.autoselect;\n }\n\n // This template is used when converting from a state.options object into a state.query.\n templateInputValue(value) {\n // const inputValueTemplate = this.templates && this.templates.inputValue;\n // return inputValueTemplate ? inputValueTemplate(value) : value;\n return value;\n }\n\n // This template is used when displaying results / suggestions.\n templateSuggestion(value) {\n // const suggestionTemplate = this.templates && this.templates.suggestion;\n // return suggestionTemplate ? suggestionTemplate(value) : value;\n return value;\n }\n\n handleComponentBlur(newState: { menuOpen: boolean; query: string }) {\n let newQuery: string;\n if (this.confirmOnBlur) {\n newQuery = newState.query || this.query;\n const matches = filterOptions(this.source, newQuery);\n const matchFound = newQuery?.length > 0 && matches.length > 0;\n const option = matchFound ? matches[0] : { value: null, text: '' };\n this.value = option.value;\n } else {\n newQuery = this.query;\n }\n this.focused = null;\n this.menuOpen = newState.menuOpen || false;\n this.selected = null;\n this.validChoiceMade = this.isQueryAnOption(newQuery, this.options);\n }\n\n handleListMouseLeave() {\n this.hovered = null;\n }\n\n handleOptionBlur(event, index) {\n const focusingOutsideComponent = event.relatedTarget === null;\n const focusingInput = event.relatedTarget === this.elementReferences[-1];\n const focusingAnotherOption = this.focused !== index && this.focused !== -1;\n const blurComponent = (!focusingAnotherOption && focusingOutsideComponent) || !(focusingAnotherOption || focusingInput);\n if (blurComponent) {\n const keepMenuOpen = this.menuOpen && isIosDevice();\n this.handleComponentBlur({\n menuOpen: keepMenuOpen,\n query: this.templateInputValue(this.options[this.selected]?.text ?? ''),\n });\n }\n }\n\n handleInputBlur(_) {\n const focusingAnOption = this.focused !== -1;\n if (!focusingAnOption) {\n const keepMenuOpen = this.menuOpen && isIosDevice();\n this.handleComponentBlur({\n menuOpen: keepMenuOpen,\n query: this.query,\n });\n }\n }\n\n handleInputChange(event) {\n const autoselect = this.hasAutoselect();\n const query = event.target.value;\n const queryEmpty = query.length === 0;\n const queryChanged = this.query !== query;\n const queryLongEnough = query.length >= this.minLength;\n\n this.query = query;\n this.ariaHint = queryEmpty;\n\n const searchForOptions = this.showAllValues || (!queryEmpty && queryChanged && queryLongEnough);\n if (searchForOptions) {\n const matches = filterOptions(this.source, this.query);\n const optionsAvailable = matches.length > 0;\n this.menuOpen = optionsAvailable;\n this.options = matches;\n this.selected = autoselect && optionsAvailable ? 0 : -1;\n this.validChoiceMade = false;\n } else if (queryEmpty || !queryLongEnough) {\n this.menuOpen = false;\n this.options = [];\n }\n }\n\n handleInputClick(event) {\n this.handleInputChange(event);\n }\n\n handleInputFocus(_) {\n const shouldReopenMenu = !this.validChoiceMade && this.query?.length >= this.minLength && this.options.length > 0;\n\n if (shouldReopenMenu) {\n this.focused = -1;\n this.menuOpen = shouldReopenMenu || this.menuOpen;\n this.selected = -1;\n } else {\n this.focused = -1;\n }\n }\n\n handleOptionFocus(index) {\n this.focused = index;\n this.hovered = null;\n this.selected = index;\n }\n\n handleOptionMouseEnter(index) {\n // iOS Safari prevents click event if mouseenter adds hover background colour\n // See: https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html#//apple_ref/doc/uid/TP40006511-SW4\n if (!isIosDevice()) {\n this.hovered = index;\n }\n }\n\n handleOptionClick(_, index) {\n const selectedOption = this.options[index];\n this.value = selectedOption.value;\n this.focused = -1;\n this.hovered = null;\n this.menuOpen = false;\n this.selected = index;\n this.validChoiceMade = true;\n forceUpdate(this);\n }\n\n handleOptionMouseDown(event) {\n // Safari triggers focusOut before click, but if you\n // preventDefault on mouseDown, you can stop that from happening.\n // If this is removed, clicking on an option in Safari will trigger\n // `handleOptionBlur`, which closes the menu, and the click will\n // trigger on the element underneath instead.\n // See: http://stackoverflow.com/questions/7621711/how-to-prevent-blur-running-when-clicking-a-link-in-jquery\n event.preventDefault();\n }\n\n handleUpArrow(event) {\n event.preventDefault();\n const isNotAtTop = this.selected !== -1;\n const allowMoveUp = isNotAtTop && this.menuOpen;\n if (allowMoveUp) {\n this.handleOptionFocus(this.selected - 1);\n }\n }\n\n handleDownArrow(event) {\n event.preventDefault();\n // if not open, open\n if (this.showAllValues && this.menuOpen === false) {\n event.preventDefault();\n const matches = filterOptions(this.source, '');\n this.menuOpen = true;\n this.options = matches;\n this.selected = 0;\n this.focused = 0;\n this.hovered = null;\n } else if (this.menuOpen === true) {\n const isNotAtBottom = this.selected !== this.options.length - 1;\n const allowMoveDown = isNotAtBottom && this.menuOpen;\n if (allowMoveDown) {\n this.handleOptionFocus(this.selected + 1);\n }\n }\n }\n\n handleSpace(event) {\n // if not open, open\n if (this.showAllValues && this.menuOpen === false && this.query === '') {\n event.preventDefault();\n const matches = filterOptions(this.source, '');\n this.menuOpen = true;\n this.options = matches;\n }\n const focusIsOnOption = this.focused !== -1;\n if (focusIsOnOption) {\n event.preventDefault();\n this.handleOptionClick(event, this.focused);\n }\n }\n\n handleEnter(event) {\n if (this.menuOpen) {\n event.preventDefault();\n const hasSelectedOption = this.selected >= 0;\n if (hasSelectedOption) {\n this.handleOptionClick(event, this.selected);\n }\n }\n }\n\n handlePrintableKey(event) {\n const inputElement = this.elementReferences[-1];\n const eventIsOnInput = event.target === inputElement;\n if (!eventIsOnInput) {\n // FIXME: This would be better if it was in componentDidUpdate,\n // but using setState to trigger that seems to not work correctly\n // in preact@8.1.0.\n inputElement.focus();\n }\n }\n\n handleKeyDown(event) {\n switch (keyCodes[event.keyCode]) {\n case 'up':\n this.handleUpArrow(event);\n break;\n case 'down':\n this.handleDownArrow(event);\n break;\n case 'space':\n this.handleSpace(event);\n break;\n case 'enter':\n this.handleEnter(event);\n break;\n case 'escape':\n this.handleComponentBlur({\n query: this.query,\n menuOpen: this.menuOpen,\n });\n break;\n default:\n if (isPrintableKeyCode(event.keyCode)) {\n this.handlePrintableKey(event);\n }\n break;\n }\n }\n\n render() {\n const id = this.el.id != '' ? this.el.id : `admiralty-autocomplete-${this.internalId}`;\n const inputId = `${id}-input`;\n const hintId = `${id}-hint`;\n const errorId = `${id}-error`;\n\n const inputFocused = this.focused === -1;\n const noOptionsAvailable = this.options.length === 0;\n const queryNotEmpty = this.query?.length !== 0;\n const queryLongEnough = this.query?.length >= this.minLength;\n const showNoOptionsFound = this.showNoOptionsFound && inputFocused && noOptionsAvailable && queryNotEmpty && queryLongEnough;\n\n const wrapperClassName = `${this.cssNamespace}__wrapper`;\n const optionFocused = this.focused !== -1 && this.focused !== null;\n\n const optionClassName = `${this.cssNamespace}__option`;\n\n const assistiveHintID = id + '__assistiveHint';\n const ariaProps = {\n 'aria-describedby': `${this.hint ? hintId : ''} ${this.ariaHint ? assistiveHintID : ''} ${this.invalid ? errorId : ''}`,\n 'aria-expanded': this.menuOpen ? 'true' : 'false',\n 'aria-activedescendant': optionFocused ? `${id}__option--${this.focused}` : null,\n 'aria-owns': `${id}__listbox`,\n 'aria-autocomplete': this.hasAutoselect() ? 'both' : 'list',\n };\n\n const inputClassName = `${this.cssNamespace}__input`;\n const inputClassList = [inputClassName, this.showAllValues ? `${inputClassName}--show-all-values` : `${inputClassName}--default`];\n\n const componentIsFocused = this.focused !== null;\n if (componentIsFocused) {\n inputClassList.push(`${inputClassName}--focused`);\n }\n\n if (this.inputClasses) {\n inputClassList.push(this.inputClasses);\n }\n\n if (this.invalid && this.invalidMessage) {\n inputClassList.push(`${inputClassName}--invalid`);\n }\n\n if (this.disabled) {\n inputClassList.push(`${inputClassName}--disabled`);\n }\n\n const menuClassName = `${this.cssNamespace}__menu`;\n const menuModifierDisplayMenu = `${menuClassName}--${this.displayMenu}`;\n const menuIsVisible = this.menuOpen || showNoOptionsFound;\n const menuModifierVisibility = `${menuClassName}--${menuIsVisible ? 'visible' : 'hidden'}`;\n\n const menuClassList = [menuClassName, menuModifierDisplayMenu, menuModifierVisibility];\n\n if (this.menuClasses) {\n menuClassList.push(this.menuClasses);\n }\n\n if (this.menuAttributes?.class || this.menuAttributes?.className) {\n menuClassList.push(this.menuAttributes?.class || this.menuAttributes?.className);\n }\n\n const computedMenuAttributes = {\n // Copy the attributes passed as props\n ...this.menuAttributes,\n // And add the values computed for the autocomplete\n id: `${id}__listbox`,\n role: 'listbox',\n onMouseLeave: this.handleListMouseLeave,\n };\n\n // Preact would override our computed `className`\n // with the `class` from the `menuAttributes` so\n // we need to clean it up from the computed attributes\n delete computedMenuAttributes.class;\n\n return (\n <div class={wrapperClassName} onKeyDown={event => this.handleKeyDown(event)}>\n {this.label ? (\n <admiralty-label class=\"autocomplete__label\" disabled={this.disabled} for={inputId}>\n {this.label}\n </admiralty-label>\n ) : null}\n {this.hint ? (\n <admiralty-hint id={hintId} disabled={this.disabled}>\n {this.hint}\n </admiralty-hint>\n ) : null}\n <div class=\"autocomplete__input-wrapper\">\n <input\n {...ariaProps}\n disabled={this.disabled}\n aria-disabled={this.disabled}\n autoComplete=\"off\"\n class={inputClassList.join(' ')}\n id={inputId}\n onClick={event => this.handleInputClick(event)}\n onBlur={event => this.handleInputBlur(event)}\n onInput={event => this.handleInputChange(event)}\n onFocus={event => this.handleInputFocus(event)}\n name={this.name}\n placeholder={this.placeholder}\n ref={inputElement => {\n this.elementReferences[-1] = inputElement;\n }}\n type=\"text\"\n role=\"combobox\"\n required={this.required}\n value={this.query}\n />\n {this.showAllValues &&\n <admiralty-icon class={`autocomplete-down-icon ${this.disabled ? \"disabled\" : \"\"}`} icon-name={this.menuOpen || showNoOptionsFound ? \"angle-up\" : \"angle-down\"} />\n }\n </div>\n\n <ul {...computedMenuAttributes} class={menuClassList.join(' ')}>\n {this.options.map((option, index) => {\n const showFocused = this.focused === -1 ? this.selected === index : this.focused === index;\n const optionModifierFocused = showFocused && this.hovered === null ? ` ${optionClassName}--focused` : '';\n const iosPosinsetHtml = isIosDevice()\n ? `<span id=${id}__option-suffix--${index} style=\"border:0;clip:rect(0 0 0 0);height:1px;` +\n 'marginBottom:-1px;marginRight:-1px;overflow:hidden;padding:0;position:absolute;' +\n 'whiteSpace:nowrap;width:1px\">' +\n ` ${index + 1} of ${this.options.length}</span>`\n : '';\n\n return (\n <li\n aria-selected={this.focused === index ? 'true' : 'false'}\n class={`${optionClassName}${optionModifierFocused}`}\n innerHTML={this.templateSuggestion(option.text) + iosPosinsetHtml}\n id={`${id}__option--${index}`}\n key={index}\n onBlur={event => this.handleOptionBlur(event, index)}\n onClick={event => this.handleOptionClick(event, index)}\n onMouseDown={event => this.handleOptionMouseDown(event)}\n onMouseEnter={() => this.handleOptionMouseEnter(index)}\n ref={optionEl => {\n this.elementReferences[index] = optionEl;\n }}\n role=\"option\"\n tabIndex={-1}\n aria-posinset={index + 1}\n aria-setsize={this.options.length}\n />\n );\n })}\n\n {showNoOptionsFound && <li class={`${optionClassName} ${optionClassName}--no-results`}>No results found</li>}\n </ul>\n\n <span id={assistiveHintID} style={{ display: 'none' }}>\n {this.assistiveHint}\n </span>\n {this.invalid && this.invalidMessage && (\n <admiralty-input-invalid id={errorId} style={{ visibility: this.invalid && this.invalidMessage ? 'visible' : 'hidden' }}>\n {this.invalidMessage}\n </admiralty-input-invalid>\n )}\n </div>\n );\n }\n}\nlet nextId = 0;\n"],"version":3}
|
|
@@ -1,4 +1,124 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { p as proxyCustomElement, H, c as createEvent, h } from './p-7dd465c9.js';
|
|
2
|
+
import { d as defineCustomElement$5 } from './p-8ccb8247.js';
|
|
3
|
+
import { d as defineCustomElement$4 } from './p-91d406aa.js';
|
|
4
|
+
import { d as defineCustomElement$3 } from './p-8c6a193a.js';
|
|
5
|
+
import { d as defineCustomElement$2 } from './p-09a69305.js';
|
|
6
|
+
|
|
7
|
+
const inputCss = ".visually-hidden.sc-admiralty-input: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-input{display:none}}@media (min-width: 1024px){.not-desktop.sc-admiralty-input{display:none}}@media (min-width: 1024px){.tablet-only.sc-admiralty-input{display:none}}@media (max-width: 479px) and (min-width: 0px){.tablet-only.sc-admiralty-input{display:none}}@media (max-width: 479px) and (min-width: 0px){.tablet-or-desktop.sc-admiralty-input{display:none}}@media (min-width: 1024px){.phone-or-tablet.sc-admiralty-input{display:none}}@media (min-width: 1024px){.phone-only.sc-admiralty-input{display:none}}@media (max-width: 1023px) and (min-width: 480px){.phone-only.sc-admiralty-input{display:none}}.text-input-container.sc-admiralty-input{display:flex;flex-direction:column}.text-input-container.sc-admiralty-input input.sc-admiralty-input{background-color:var(--admiralty-background-colour);border-color:var(--admiralty-text-colour);border-width:2px;border-style:solid;color:var(--admiralty-text-colour);font-size:var(--admiralty-input-font-size, var(--admiralty-font-size-0));line-height:24px;font-weight:var(--admiralty-input-font-weight, var(--admiralty-font-weight-normal));padding:12px}.text-input-container.sc-admiralty-input input.sc-admiralty-input:focus{outline-offset:unset;outline:3px solid var(--admiralty-focus-colour);box-shadow:var(--admiralty-text-colour) inset 0 0 0 2px}.text-input-container.sc-admiralty-input input.invalid.sc-admiralty-input{border-color:var(--admiralty-colour-danger)}.text-input-container.sc-admiralty-input input.invalid.sc-admiralty-input:focus-visible{border-color:unset;outline:3px solid var(--admiralty-focus-colour)}.text-input-container.sc-admiralty-input input.disabled.sc-admiralty-input{color:var(--admiralty-disabled-colour);border-color:var(--admiralty-disabled-colour);background:var(--admiralty-background-colour)}.text-input-container.sc-admiralty-input admiralty-input-invalid.sc-admiralty-input{margin-top:6px}";
|
|
8
|
+
const AdmiraltyInputStyle0 = inputCss;
|
|
9
|
+
|
|
10
|
+
const InputComponent = /*@__PURE__*/ proxyCustomElement(class InputComponent extends H {
|
|
11
|
+
constructor() {
|
|
12
|
+
super();
|
|
13
|
+
this.__registerHost();
|
|
14
|
+
this.admiraltyInput = createEvent(this, "admiraltyInput", 7);
|
|
15
|
+
this.admiraltyFocus = createEvent(this, "admiraltyFocus", 7);
|
|
16
|
+
this.admiraltyBlur = createEvent(this, "admiraltyBlur", 7);
|
|
17
|
+
this.internalId = ++nextId;
|
|
18
|
+
this.onInput = (ev) => {
|
|
19
|
+
const input = ev.target;
|
|
20
|
+
if (input) {
|
|
21
|
+
this.value = input.value || '';
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
this.onBlur = (ev) => {
|
|
25
|
+
this.admiraltyBlur.emit(ev);
|
|
26
|
+
};
|
|
27
|
+
this.onFocus = (ev) => {
|
|
28
|
+
this.admiraltyFocus.emit(ev);
|
|
29
|
+
};
|
|
30
|
+
this.name = undefined;
|
|
31
|
+
this.label = undefined;
|
|
32
|
+
this.hint = undefined;
|
|
33
|
+
this.disabled = false;
|
|
34
|
+
this.type = 'text';
|
|
35
|
+
this.placeholder = undefined;
|
|
36
|
+
this.width = undefined;
|
|
37
|
+
this.required = false;
|
|
38
|
+
this.invalid = false;
|
|
39
|
+
this.invalidMessage = undefined;
|
|
40
|
+
this.autocomplete = 'off';
|
|
41
|
+
this.value = '';
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Update the native input element when the value changes
|
|
45
|
+
*/
|
|
46
|
+
valueChanged() {
|
|
47
|
+
const nativeInput = this.nativeInput;
|
|
48
|
+
const value = this.getValue();
|
|
49
|
+
if (nativeInput && nativeInput.value !== value) {
|
|
50
|
+
nativeInput.value = value;
|
|
51
|
+
}
|
|
52
|
+
this.admiraltyInput.emit({ value: this.value == null ? this.getValue() : this.value.toString() });
|
|
53
|
+
}
|
|
54
|
+
getValue() {
|
|
55
|
+
return typeof this.value === 'number' ? this.value.toString() : (this.value || '').toString();
|
|
56
|
+
}
|
|
57
|
+
render() {
|
|
58
|
+
const value = this.getValue();
|
|
59
|
+
const id = this.el.id != '' ? this.el.id : `admiralty-input-${this.internalId}`;
|
|
60
|
+
const inputId = `${id}-input`;
|
|
61
|
+
const hintId = `${id}-hint`;
|
|
62
|
+
const errorId = `${id}-error`;
|
|
63
|
+
return (h("div", { key: '8331b75bcdebf5e7881f3e89a6ff1afc07a2f247', class: "text-input-container" }, this.label ? (h("admiralty-label", { disabled: this.disabled, for: inputId }, this.label)) : null, this.hint ? (h("admiralty-hint", { id: hintId, disabled: this.disabled }, this.hint)) : null, h("input", Object.assign({ key: '8df3c8eb66e28ccc2ad478305fae9d0d02211ae0', ref: input => (this.nativeInput = input), class: { disabled: this.disabled, invalid: this.invalid }, disabled: this.disabled, id: inputId, name: this.name, type: this.type, value: value, onInput: this.onInput, onFocus: this.onFocus, onBlur: this.onBlur, placeholder: this.placeholder, autoComplete: this.autocomplete, required: this.required, style: {
|
|
64
|
+
maxWidth: this.width ? `${this.width}px` : null,
|
|
65
|
+
}, "aria-invalid": this.invalid ? 'true' : 'false' }, (this.hint ? { 'aria-describedby': hintId + (this.invalid ? ' ' + errorId : '') } : this.invalid ? { 'aria-describedby': errorId } : null))), h("admiralty-input-invalid", { key: 'fb88c4e6e41eea9496b8cdc6b206c9b3e8dad07a', id: errorId, style: Object.assign({}, (!(this.invalid && this.invalidMessage) ? { display: 'none' } : {})) }, this.invalidMessage)));
|
|
66
|
+
}
|
|
67
|
+
get el() { return this; }
|
|
68
|
+
static get watchers() { return {
|
|
69
|
+
"value": ["valueChanged"]
|
|
70
|
+
}; }
|
|
71
|
+
static get style() { return AdmiraltyInputStyle0; }
|
|
72
|
+
}, [2, "admiralty-input", {
|
|
73
|
+
"name": [1],
|
|
74
|
+
"label": [1],
|
|
75
|
+
"hint": [1],
|
|
76
|
+
"disabled": [4],
|
|
77
|
+
"type": [1],
|
|
78
|
+
"placeholder": [1],
|
|
79
|
+
"width": [2],
|
|
80
|
+
"required": [4],
|
|
81
|
+
"invalid": [4],
|
|
82
|
+
"invalidMessage": [1, "invalid-message"],
|
|
83
|
+
"autocomplete": [1],
|
|
84
|
+
"value": [1032]
|
|
85
|
+
}, undefined, {
|
|
86
|
+
"value": ["valueChanged"]
|
|
87
|
+
}]);
|
|
88
|
+
let nextId = 0;
|
|
89
|
+
function defineCustomElement$1() {
|
|
90
|
+
if (typeof customElements === "undefined") {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const components = ["admiralty-input", "admiralty-hint", "admiralty-icon", "admiralty-input-invalid", "admiralty-label"];
|
|
94
|
+
components.forEach(tagName => { switch (tagName) {
|
|
95
|
+
case "admiralty-input":
|
|
96
|
+
if (!customElements.get(tagName)) {
|
|
97
|
+
customElements.define(tagName, InputComponent);
|
|
98
|
+
}
|
|
99
|
+
break;
|
|
100
|
+
case "admiralty-hint":
|
|
101
|
+
if (!customElements.get(tagName)) {
|
|
102
|
+
defineCustomElement$5();
|
|
103
|
+
}
|
|
104
|
+
break;
|
|
105
|
+
case "admiralty-icon":
|
|
106
|
+
if (!customElements.get(tagName)) {
|
|
107
|
+
defineCustomElement$4();
|
|
108
|
+
}
|
|
109
|
+
break;
|
|
110
|
+
case "admiralty-input-invalid":
|
|
111
|
+
if (!customElements.get(tagName)) {
|
|
112
|
+
defineCustomElement$3();
|
|
113
|
+
}
|
|
114
|
+
break;
|
|
115
|
+
case "admiralty-label":
|
|
116
|
+
if (!customElements.get(tagName)) {
|
|
117
|
+
defineCustomElement$2();
|
|
118
|
+
}
|
|
119
|
+
break;
|
|
120
|
+
} });
|
|
121
|
+
}
|
|
2
122
|
|
|
3
123
|
const AdmiraltyInput = InputComponent;
|
|
4
124
|
const defineCustomElement = defineCustomElement$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"admiralty-input.js","mappings":";;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
|
|
1
|
+
{"file":"admiralty-input.js","mappings":";;;;;;AAAA,MAAM,QAAQ,GAAG,wuEAAwuE,CAAC;AAC1vE,6BAAe,QAAQ;;MCcV,cAAc;;;;;;;QACjB,eAAU,GAAG,EAAE,MAAM,CAAC;QA8FtB,YA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AAI,CAAC,IAAI,GAAG,EAAC,kBAAkB,EAAC,MAAM,IAAI,IAAI,CAAC,OAAO,GAAG,GAAG,GAAE,OAAO,GAAG,EAAE,CAAC,EAAC,GAAG,IAAI,CAAC,OAAO,GAAG,EAAC,kBAAkB,EAAC,OAAO,EAAC,GAAG,IAAI,GACtI,EACF,gFAAyB,EAAE,EAAE,OAAO,EAAE,KAAK,qBAAQ,EAAE,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MACjH,IAAI,CAAC,cAAc,CACI,CACtB,EACN;KACH;;;;;;;;;;;;;;;;;;;;;;AAGH,IAAI,MAAM,GAAG,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/input/input.scss?tag=admiralty-input&encapsulation=scoped","src/components/input/input.tsx"],"sourcesContent":["@import 'inputs.vars';\n\n.text-input-container {\n display: flex;\n flex-direction: column;\n\n input {\n background-color: $input-background-colour;\n border-color: $input-border-colour;\n border-width: 2px;\n border-style: solid;\n color: $input-text-colour;\n font-size: $input-text-size;\n line-height: 24px;\n font-weight: $input-text-weight;\n\n padding: 12px;\n\n &:focus {\n outline-offset: unset;\n outline: 3px solid $input-focus-colour;\n box-shadow: $input-border-colour inset 0 0 0 2px;\n }\n\n &.invalid {\n border-color: $input-error-border-colour;\n\n &:focus-visible {\n border-color: unset;\n outline: 3px solid $input-focus-colour;\n }\n }\n\n &.disabled {\n color: $input-disabled-text-colour;\n border-color: $input-disabled-border-colour;\n background: $input-background-colour;\n }\n }\n\n admiralty-input-invalid {\n margin-top: 6px;\n }\n}\n","import { Component, ComponentInterface, Element, Event, EventEmitter, h, Prop, Watch } from '@stencil/core';\nimport { InputChangeEventDetail } from './input.interface';\n\n/**\n * Once this component works, review whether a form field component should be created so\n * that shared properties such as `label`, `hint`, `disabled` etc. can be defined once.\n * Examples of similar components that can extend that base component are area, select\n * and checkbox.\n */\n\n@Component({\n tag: 'admiralty-input',\n styleUrl: 'input.scss',\n scoped: true,\n})\nexport class InputComponent implements ComponentInterface {\n private internalId = ++nextId;\n private nativeInput?: HTMLInputElement;\n\n @Element() el!: HTMLElement;\n\n /**\n * The name of the control, which is submitted with the form data.\n */\n @Prop() name: string;\n\n /**\n * The label which will be used above the input to describe the input.\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 * This dictates whether the form field is disabled.\n */\n @Prop() disabled = false;\n\n /**\n * The input type, options are: text; number; date; time; email; password; tel; url\n */\n @Prop() type: 'text' | 'number' | 'date' | 'time' | 'email' | 'password' | 'tel' | 'url' = 'text';\n\n /**\n * The placeholder text to show in the input\n */\n @Prop() placeholder: string;\n\n /**\n * The maximum width for the input field.\n */\n @Prop() width: number;\n\n /**\n * This dictates whether the input is required or not\n */\n @Prop() required: boolean = false;\n\n /**\n * Whether to show the input in an invalid state\n */\n @Prop() invalid: boolean = false;\n\n /**\n * The message to show when the input is invalid\n */\n @Prop() invalidMessage: string;\n\n /**\n * Indicates whether the value of the control can be automatically completed by the browser.\n */\n @Prop() autocomplete: string = 'off';\n\n /**\n * The value of the input.\n */\n @Prop({ mutable: true }) value?: string | number | null = '';\n\n /**\n * Emitted when the value has changed.\n */\n @Event() admiraltyInput: EventEmitter<InputChangeEventDetail>;\n\n /**\n * Emitted when the input gains focus.\n */\n @Event() admiraltyFocus: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the input loses focus.\n */\n @Event() admiraltyBlur: EventEmitter<FocusEvent>;\n\n /**\n * Update the native input element when the value changes\n */\n\n @Watch('value')\n protected valueChanged() {\n const nativeInput = this.nativeInput;\n const value = this.getValue();\n if (nativeInput && nativeInput.value !== value) {\n nativeInput.value = value;\n }\n this.admiraltyInput.emit({ value: this.value == null ? this.getValue() : this.value.toString() });\n }\n\n private onInput = (ev: Event) => {\n const input = ev.target as HTMLInputElement | null;\n if (input) {\n this.value = input.value || '';\n }\n };\n\n private getValue(): string {\n return typeof this.value === 'number' ? this.value.toString() : (this.value || '').toString();\n }\n\n private onBlur = (ev: FocusEvent) => {\n this.admiraltyBlur.emit(ev);\n };\n\n private onFocus = (ev: FocusEvent) => {\n this.admiraltyFocus.emit(ev);\n };\n\n render() {\n const value = this.getValue();\n const id = this.el.id != '' ? this.el.id : `admiralty-input-${this.internalId}`;\n const inputId = `${id}-input`;\n const hintId = `${id}-hint`;\n const errorId = `${id}-error`;\n\n return (\n <div class=\"text-input-container\">\n {this.label ? (\n <admiralty-label disabled={this.disabled} for={inputId}>\n {this.label}\n </admiralty-label>\n ) : null}\n {this.hint ? (\n <admiralty-hint id={hintId} disabled={this.disabled}>\n {this.hint}\n </admiralty-hint>\n ) : null}\n <input\n ref={input => (this.nativeInput = input)}\n class={{ disabled: this.disabled, invalid: this.invalid }}\n disabled={this.disabled}\n id={inputId}\n name={this.name}\n type={this.type}\n value={value}\n onInput={this.onInput}\n onFocus={this.onFocus}\n onBlur={this.onBlur}\n placeholder={this.placeholder}\n autoComplete={this.autocomplete}\n required={this.required}\n style={{\n maxWidth: this.width ? `${this.width}px` : null,\n }}\n aria-invalid={this.invalid ? 'true' : 'false'}\n {...(this.hint ? {'aria-describedby':hintId + (this.invalid ? ' '+ errorId : '')} : this.invalid ? {'aria-describedby':errorId} : null)}\n />\n <admiralty-input-invalid id={errorId} style={{ ...(!(this.invalid && this.invalidMessage) ? { display: 'none' } : {}) }}>\n {this.invalidMessage}\n </admiralty-input-invalid>\n </div>\n );\n }\n}\n\nlet nextId = 0;\n"],"version":3}
|
|
@@ -8,7 +8,7 @@ const ProgressBarComponent = /*@__PURE__*/ proxyCustomElement(class ProgressBarC
|
|
|
8
8
|
constructor() {
|
|
9
9
|
super();
|
|
10
10
|
this.__registerHost();
|
|
11
|
-
this.
|
|
11
|
+
this.inputId = `admiralty-progress-${++progressId}`;
|
|
12
12
|
this.label = undefined;
|
|
13
13
|
this.progression = 0;
|
|
14
14
|
this.error = false;
|
|
@@ -20,13 +20,19 @@ const ProgressBarComponent = /*@__PURE__*/ proxyCustomElement(class ProgressBarC
|
|
|
20
20
|
* then updates the progressionValue state if the progression value is valid
|
|
21
21
|
*/
|
|
22
22
|
progressionChanged() {
|
|
23
|
+
this.updateProgression();
|
|
24
|
+
}
|
|
25
|
+
updateProgression() {
|
|
23
26
|
if (this.progression && this.progression >= 0 && this.progression <= 100) {
|
|
24
27
|
this.progressionValue = this.progression;
|
|
25
28
|
}
|
|
26
29
|
}
|
|
30
|
+
componentDidLoad() {
|
|
31
|
+
this.updateProgression();
|
|
32
|
+
}
|
|
27
33
|
render() {
|
|
28
|
-
const {
|
|
29
|
-
return (h("div", { key: '
|
|
34
|
+
const { inputId, label, error, progressionValue } = this;
|
|
35
|
+
return (h("div", { key: '7eafecb0ac94fad83d6a219d766be02ec31ba81b', class: "admiralty-progress" }, label ? h("admiralty-label", { for: inputId }, label) : null, h("progress", { key: '11a7d830aea3d391dc0a533672f0241e540c3289', id: inputId, class: { error: error }, value: progressionValue, max: "100" })));
|
|
30
36
|
}
|
|
31
37
|
static get watchers() { return {
|
|
32
38
|
"progression": ["progressionChanged"]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"admiralty-progress-bar.js","mappings":";;;AAAA,MAAM,cAAc,GAAG,8yDAA8yD,CAAC;AACt0D,mCAAe,cAAc;;MCMhB,oBAAoB;;;;QACvB,
|
|
1
|
+
{"file":"admiralty-progress-bar.js","mappings":";;;AAAA,MAAM,cAAc,GAAG,8yDAA8yD,CAAC;AACt0D,mCAAe,cAAc;;MCMhB,oBAAoB;;;;QACvB,YAAO,GAAG,sBAAsB,EAAE,UAAU,EAAE,CAAC;;2BASzB,CAAC;qBAKN,KAAK;gCAMM,IAAI,CAAC,WAAW;;;;;;;IAQ1C,kBAAkB;QAC1B,IAAI,CAAC,iBAAiB,EAAE,CAAC;KAC1B;IAEO,iBAAiB;QACvB,IAAI,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,WAAW,IAAI,CAAC,IAAI,IAAI,CAAC,WAAW,IAAI,GAAG,EAAE;YACxE,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,WAAW,CAAC;SAC1C;KACF;IAED,gBAAgB;QACd,IAAI,CAAC,iBAAiB,EAAE,CAAC;KAC1B;IAED,MAAM;QACJ,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,gBAAgB,EAAE,GAAG,IAAI,CAAC;QAEzD,QACE,4DAAK,KAAK,EAAC,oBAAoB,IAC5B,KAAK,GAAG,uBAAiB,GAAG,EAAE,OAAO,IAAG,KAAK,CAAmB,GAAG,IAAI,EACxE,iEAAU,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,gBAAgB,EAAE,GAAG,EAAC,KAAK,GAAG,CACjF,EACN;KACH;;;;;;;;;;;;;AAGH,IAAI,UAAU,GAAG,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/progress-bar/progress-bar.scss?tag=admiralty-progress-bar&encapsulation=scoped","src/components/progress-bar/progress-bar.tsx"],"sourcesContent":["@import 'progress-bar.vars.scss';\n\nprogress {\n appearance: none;\n background: $progress-bar-background-colour;\n border: none;\n box-sizing: border-box;\n color: $progress-bar-text-colour;\n display: inline-block;\n font-size: $progress-bar-font-size;\n flex: 1;\n height: 1em;\n width: 100%;\n\n &[value].error::-webkit-progress-value {\n background-color: $progress-bar-error-colour;\n }\n\n &[value].error::-moz-progress-bar {\n background-color: $progress-bar-error-colour;\n }\n\n &[value]::-webkit-progress-value {\n background-color: $progress-bar-success-colour;\n }\n\n &[value]::-moz-progress-bar {\n background-color: $progress-bar-success-colour;\n }\n}\n","import { Component, h, Prop, State, Watch } from '@stencil/core';\n\n@Component({\n tag: 'admiralty-progress-bar',\n styleUrl: 'progress-bar.scss',\n scoped: true,\n})\nexport class ProgressBarComponent {\n private inputId = `admiralty-progress-${++progressId}`;\n\n /**\n * If set, adds a label above the progress bar\n */\n @Prop() label?: string;\n\n /** * A value from 0 - 100 that visually represents the current progression\n */\n @Prop() progression: number = 0;\n\n /**\n * Set to true to indicate an error (turns the progress bar red)\n */\n @Prop() error: boolean = false;\n\n /**\n * Progress value, min:0, max: 100\n */\n\n @State() progressionValue: number = this.progression;\n\n /**\n * @internal\n * Watches the progression prop for changes\n * then updates the progressionValue state if the progression value is valid\n */\n @Watch('progression')\n protected progressionChanged() {\n this.updateProgression();\n }\n\n private updateProgression() {\n if (this.progression && this.progression >= 0 && this.progression <= 100) {\n this.progressionValue = this.progression;\n }\n }\n\n componentDidLoad() {\n this.updateProgression();\n }\n\n render() {\n const { inputId ,label, error, progressionValue } = this;\n\n return (\n <div class=\"admiralty-progress\">\n {label ? <admiralty-label for={inputId}>{label}</admiralty-label> : null}\n <progress id={inputId} class={{ error: error }} value={progressionValue} max=\"100\" />\n </div>\n );\n }\n}\n\nlet progressId = 0;\n"],"version":3}
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, c as createEvent, f as forceUpdate, h, d as Host } from './p-7dd465c9.js';
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
var Keys;
|
|
4
|
+
(function (Keys) {
|
|
5
|
+
Keys["UP_ARROW"] = "ArrowUp";
|
|
6
|
+
Keys["DOWN_ARROW"] = "ArrowDown";
|
|
7
|
+
Keys["LEFT_ARROW"] = "ArrowLeft";
|
|
8
|
+
Keys["RIGHT_ARROW"] = "ArrowRight";
|
|
9
|
+
Keys["ENTER"] = "Enter";
|
|
10
|
+
Keys["TAB"] = "Tab";
|
|
11
|
+
Keys["HOME"] = "Home";
|
|
12
|
+
Keys["END"] = "End";
|
|
13
|
+
Keys["SPACE"] = " ";
|
|
14
|
+
})(Keys || (Keys = {}));
|
|
3
15
|
|
|
4
16
|
const tabGroupCss = ".visually-hidden.sc-admiralty-tab-group: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-tab-group{display:none}}@media (min-width: 1024px){.not-desktop.sc-admiralty-tab-group{display:none}}@media (min-width: 1024px){.tablet-only.sc-admiralty-tab-group{display:none}}@media (max-width: 479px) and (min-width: 0px){.tablet-only.sc-admiralty-tab-group{display:none}}@media (max-width: 479px) and (min-width: 0px){.tablet-or-desktop.sc-admiralty-tab-group{display:none}}@media (min-width: 1024px){.phone-or-tablet.sc-admiralty-tab-group{display:none}}@media (min-width: 1024px){.phone-only.sc-admiralty-tab-group{display:none}}@media (max-width: 1023px) and (min-width: 480px){.phone-only.sc-admiralty-tab-group{display:none}}.tab-group-headers.sc-admiralty-tab-group{width:100%}hr.sc-admiralty-tab-group{width:100%;height:2px;margin:6px 0;background-color:var(--admiralty-colour-light)}.headers.sc-admiralty-tab-group{display:flex;overflow-x:auto;white-space:nowrap}.headers.sc-admiralty-tab-group .heading.sc-admiralty-tab-group{cursor:pointer;padding:10px;height:42px;max-width:fit-content;box-sizing:border-box;user-select:none;text-align:center;text-decoration:none;color:var(--admiralty-colour-primary);background-color:unset;font-weight:var(--admiralty-tab-group-font-weight, var(--admiralty-font-weight-medium));font-size:var(--admiralty-tab-group-font-size, var(--admiralty-font-size-0));margin-left:4px}.headers.sc-admiralty-tab-group .heading.sc-admiralty-tab-group:first-child{margin-left:0}@media (max-width: 1023px){.headers.sc-admiralty-tab-group .heading.sc-admiralty-tab-group{font-size:var(--admiralty-tab-group-not-desktop-font-size, var(--admiralty-font-size--1));line-height:18px;padding:8px;height:unset;width:unset}}.headers.sc-admiralty-tab-group .heading.sc-admiralty-tab-group:focus-visible{box-shadow:var(--admiralty-focus-colour) inset 0 0 0 2px}.headers.sc-admiralty-tab-group .heading.sc-admiralty-tab-group:focus,.headers.sc-admiralty-tab-group .heading.active.sc-admiralty-tab-group:focus{outline:3px solid transparent;color:var(--admiralty-text-colour);background-color:var(--admiralty-focus-colour);box-shadow:0 -2px var(--admiralty-focus-colour), 0 4px var(--admiralty-text-colour);text-decoration:none;box-shadow:0px -4px var(--admiralty-text-colour) inset}.headers.sc-admiralty-tab-group .heading.sc-admiralty-tab-group:hover{background-color:var(--admiralty-hover-background-colour);color:var(--admiralty-colour-primary);box-shadow:unset}.headers.sc-admiralty-tab-group .heading.active.sc-admiralty-tab-group{background-color:var(--admiralty-colour-primary);color:var(--admiralty-colour-primary-contrast)}";
|
|
5
17
|
const AdmiraltyTabGroupStyle0 = tabGroupCss;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"admiralty-tab-group.js","mappings":";;;AAAA,MAAM,WAAW,GAAG,o5FAAo5F,CAAC;AACz6F,gCAAe,WAAW;;ACO1B,IAAI,MAAM,GAAG,CAAC,CAAC;MAOF,iBAAiB;;;;;QAOpB,aAAQ,GAAG,MAAM,EAAE,CAAC;QAEpB,UAAK,GAAc,EAAE,CAAC;QACtB,gBAAW,GAAkB,EAAE,CAAC;6BAPC,CAAC;;IAS1C,iBAAiB,CAAC,GAAW;QAC3B,MAAM,UAAU,GAAG,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,gBAAgB,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;QACrG,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACtC,UAAU,CAAC,YAAY,CAAC,UAAU,EAAE,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;QAEtE,IAAI,CAAC,aAAa,GAAG,GAAG,CAAC;QACzB,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAE7B,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KACrC;IAEO,qBAAqB;QAC3B,MAAM,aAAa,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AC;YAC7B,WAAW,CAAC,IAAI,CAAC,CAAC;SACnB;KACF;IAED,MAAM;QACJ,MAAM,aAAa,GAAG,MACpB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,GAAG,KAC5B,cACE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,KAAK,KAAK,IAAI,CAAC,aAAa,EAAE,EAClE,EAAE,EAAE,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,EACjC,IAAI,EAAC,KAAK,EACV,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,kBACvB,IAAI,CAAC,KAAK,CAAC,MAAM,mBAChB,GAAG,GAAG,CAAC,KAAK,KAAK,IAAI,CAAC,aAAa,EAAE,mBACrC,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,EAC9C,OAAO,EAAE,GAAG,IAAI,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,EACjD,SAAS,EAAE,EAAE,IAAI,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC,IAEtC,GAAG,CAAC,KAAK,CACH,CACV,CAAC,CAAC;QAEL,QACE,EAAC,IAAI,uDACH,4DAAK,KAAK,EAAC,mBAAmB,EAAC,IAAI,EAAC,SAAS,IAC3C,4DAAK,KAAK,EAAC,SAAS,IAAE,aAAa,EAAE,CAAO,CACxC,EACN,4DAAM,EACN,8DAAa,CACR,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/tab-group/tab-group.scss?tag=admiralty-tab-group&encapsulation=scoped","src/components/tab-group/tab-group.tsx"],"sourcesContent":["@import 'tab-group.vars';\n\n.tab-group-headers {\n width: 100%;\n}\n\nhr {\n width: 100%;\n height: 2px;\n margin: 6px 0;\n background-color: $tab-group-separator-colour;\n}\n\n.headers {\n display: flex;\n overflow-x: auto;\n\n white-space: nowrap;\n\n .heading {\n cursor: pointer;\n padding: 10px;\n height: 42px;\n max-width: fit-content;\n box-sizing: border-box;\n user-select: none;\n\n text-align: center;\n text-decoration: none;\n color: $tab-group-heading-text-colour;\n background-color: unset;\n font-weight: $tab-group-heading-text-weight;\n font-size: $tab-group-heading-text-font;\n margin-left: 4px;\n\n &:first-child {\n margin-left: 0;\n }\n\n @include not-desktop {\n font-size: $tab-group-heading-not-desktop-text-font;\n line-height: 18px;\n padding: 8px;\n height: unset;\n width: unset;\n }\n\n &:focus-visible {\n box-shadow: $tab-group-focus-colour inset 0 0 0 2px;\n }\n\n &:focus,\n &.active:focus {\n @include focus-highlight;\n box-shadow: 0px -4px $tab-group-focus-text-colour inset;\n }\n\n &:hover {\n background-color: $tab-group-heading-hover-background-colour;\n color: $tab-group-heading-text-colour;\n box-shadow: unset;\n }\n\n &.active {\n background-color: $tab-group-active-background-colour;\n color: $tab-group-active-text-colour;\n }\n }\n}\n","import { Component, Element, Prop, Event, h, EventEmitter, Host, forceUpdate } from '@stencil/core';\nimport { Keys } from '../Keys';\n\ninterface TabInfo {\n label: string;\n index: number;\n}\n\nlet nextId = 0;\n\n@Component({\n tag: 'admiralty-tab-group',\n styleUrl: 'tab-group.scss',\n scoped: true,\n})\nexport class TabGroupComponent {\n @Element() el: HTMLElement;\n\n @Prop({ mutable: true }) selectedIndex = 0;\n\n @Event() admiraltyTabSelected: EventEmitter<number>;\n\n private _groupId = nextId++;\n\n private _tabs: TabInfo[] = [];\n private _tabHeaders: HTMLElement[] = [];\n\n handleSelectedTab(idx: number) {\n const oldContent = this.el.querySelector(`.tab-content#${this.getTabContentId(this.selectedIndex)}`);\n oldContent.classList.remove('active');\n oldContent.setAttribute('tabindex', this.getTabIndex(idx).toString());\n\n this.selectedIndex = idx;\n this.setSelectedTabContent();\n\n this.admiraltyTabSelected.emit(idx);\n }\n\n private setSelectedTabContent() {\n const activeContent = this.el.querySelector(`.tab-content#${this.getTabContentId(this.selectedIndex)}`);\n activeContent.classList.add('active');\n activeContent.setAttribute('tabindex', this.getTabIndex(this.selectedIndex).toString());\n }\n\n private getTabIndex(index: number): number | null {\n return this.selectedIndex === index ? 0 : -1;\n }\n\n private getTabContentId(i: number): string {\n return `tab-panel-${this._groupId}-${i}`;\n }\n\n private getTabLabelId(i: number): string {\n return `tab-label-${this._groupId}-${i}`;\n }\n\n handleKeyDown(event: KeyboardEvent): void {\n const tgt = event.target as HTMLElement;\n let processed = false;\n\n switch (event.key) {\n case Keys.LEFT_ARROW:\n this.moveFocusToPreviousTab(tgt);\n processed = true;\n break;\n case Keys.RIGHT_ARROW:\n this.moveFocusToNextTab(tgt);\n processed = true;\n break;\n\n case Keys.HOME:\n this.moveFocusToTabHeader(this._tabHeaders[0]);\n processed = true;\n break;\n\n case Keys.END:\n this.moveFocusToTabHeader(this._tabHeaders[this._tabHeaders.length - 1]);\n processed = true;\n break;\n default:\n break;\n }\n\n if (processed) {\n event.stopPropagation();\n event.preventDefault();\n }\n }\n\n private moveFocusToTabHeader(header: HTMLElement) {\n header.focus();\n }\n\n private moveFocusToPreviousTab(currentHeader: HTMLElement) {\n const firstTab = this._tabHeaders[0];\n const lastTab = this._tabHeaders[this._tabHeaders.length - 1];\n\n if (currentHeader === firstTab) {\n this.moveFocusToTabHeader(lastTab);\n } else {\n const index = this._tabHeaders.indexOf(currentHeader);\n this.moveFocusToTabHeader(this._tabHeaders[index - 1]);\n }\n }\n\n private moveFocusToNextTab(currentHeader: HTMLElement) {\n const firstTab = this._tabHeaders[0];\n const lastTab = this._tabHeaders[this._tabHeaders.length - 1];\n\n if (currentHeader === lastTab) {\n this.moveFocusToTabHeader(firstTab);\n } else {\n const index = this._tabHeaders.indexOf(currentHeader);\n this.moveFocusToTabHeader(this._tabHeaders[index + 1]);\n }\n }\n\n componentWillLoad() {\n const tabItems = this.el.querySelectorAll('admiralty-tab');\n\n this._tabs = [];\n\n if (tabItems.length > 0) {\n let idx = 0;\n tabItems.forEach(t => {\n t.tabLabelId = this.getTabLabelId(idx);\n t.tabContentId = this.getTabContentId(idx);\n\n this._tabs.push({ label: t.label, index: idx });\n ++idx;\n });\n\n this.selectedIndex = Math.max(0, Math.min(this.selectedIndex, tabItems.length - 1));\n }\n }\n\n componentDidLoad() {\n this._tabHeaders = Array.from(this.el.querySelectorAll('[role=\"tab\"]'));\n\n const tabItems = this.el.querySelectorAll('admiralty-tab .tab-content');\n\n if (tabItems.length > 0) {\n const tabContent = this.el.querySelector('hr');\n tabContent.after(...Array.from(tabItems));\n\n this.setSelectedTabContent();\n forceUpdate(this);\n }\n }\n\n render() {\n const createHeaders = () =>\n Array.from(this._tabs).map(tab => (\n <button\n class={{ heading: true, active: tab.index === this.selectedIndex }}\n id={this.getTabLabelId(tab.index)}\n role=\"tab\"\n tabIndex={this.getTabIndex(tab.index)}\n aria-setsize={this._tabs.length}\n aria-selected={`${tab.index === this.selectedIndex}`}\n aria-controls={this.getTabContentId(tab.index)}\n onClick={_ev => this.handleSelectedTab(tab.index)}\n onKeyDown={ev => this.handleKeyDown(ev)}\n >\n {tab.label}\n </button>\n ));\n\n return (\n <Host>\n <div class=\"tab-group-headers\" role=\"tablist\">\n <div class=\"headers\">{createHeaders()}</div>\n </div>\n <hr />\n <slot></slot>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"admiralty-tab-group.js","mappings":";;AAAA,IAAY,IAUX;AAVD,WAAY,IAAI;IACd,4BAAoB,CAAA;IACpB,gCAAwB,CAAA;IACxB,gCAAwB,CAAA;IACxB,kCAA0B,CAAA;IAC1B,uBAAe,CAAA;IACf,mBAAW,CAAA;IACX,qBAAa,CAAA;IACb,mBAAW,CAAA;IACX,mBAAW,CAAA;AACb,CAAC,EAVW,IAAI,KAAJ,IAAI;;ACAhB,MAAM,WAAW,GAAG,o5FAAo5F,CAAC;AACz6F,gCAAe,WAAW;;ACO1B,IAAI,MAAM,GAAG,CAAC,CAAC;MAOF,iBAAiB;;;;;QAOpB,aAAQ,GAAG,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AAI,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,EACjD,SAAS,EAAE,EAAE,IAAI,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC,IAEtC,GAAG,CAAC,KAAK,CACH,CACV,CAAC,CAAC;QAEL,QACE,EAAC,IAAI,uDACH,4DAAK,KAAK,EAAC,mBAAmB,EAAC,IAAI,EAAC,SAAS,IAC3C,4DAAK,KAAK,EAAC,SAAS,IAAE,aAAa,EAAE,CAAO,CACxC,EACN,4DAAM,EACN,8DAAa,CACR,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/Keys.ts","src/components/tab-group/tab-group.scss?tag=admiralty-tab-group&encapsulation=scoped","src/components/tab-group/tab-group.tsx"],"sourcesContent":["export enum Keys {\n UP_ARROW = 'ArrowUp',\n DOWN_ARROW = 'ArrowDown',\n LEFT_ARROW = 'ArrowLeft',\n RIGHT_ARROW = 'ArrowRight',\n ENTER = 'Enter',\n TAB = 'Tab',\n HOME = 'Home',\n END = 'End',\n SPACE = ' '\n}\n","@import 'tab-group.vars';\n\n.tab-group-headers {\n width: 100%;\n}\n\nhr {\n width: 100%;\n height: 2px;\n margin: 6px 0;\n background-color: $tab-group-separator-colour;\n}\n\n.headers {\n display: flex;\n overflow-x: auto;\n\n white-space: nowrap;\n\n .heading {\n cursor: pointer;\n padding: 10px;\n height: 42px;\n max-width: fit-content;\n box-sizing: border-box;\n user-select: none;\n\n text-align: center;\n text-decoration: none;\n color: $tab-group-heading-text-colour;\n background-color: unset;\n font-weight: $tab-group-heading-text-weight;\n font-size: $tab-group-heading-text-font;\n margin-left: 4px;\n\n &:first-child {\n margin-left: 0;\n }\n\n @include not-desktop {\n font-size: $tab-group-heading-not-desktop-text-font;\n line-height: 18px;\n padding: 8px;\n height: unset;\n width: unset;\n }\n\n &:focus-visible {\n box-shadow: $tab-group-focus-colour inset 0 0 0 2px;\n }\n\n &:focus,\n &.active:focus {\n @include focus-highlight;\n box-shadow: 0px -4px $tab-group-focus-text-colour inset;\n }\n\n &:hover {\n background-color: $tab-group-heading-hover-background-colour;\n color: $tab-group-heading-text-colour;\n box-shadow: unset;\n }\n\n &.active {\n background-color: $tab-group-active-background-colour;\n color: $tab-group-active-text-colour;\n }\n }\n}\n","import { Component, Element, Prop, Event, h, EventEmitter, Host, forceUpdate } from '@stencil/core';\nimport { Keys } from '../Keys';\n\ninterface TabInfo {\n label: string;\n index: number;\n}\n\nlet nextId = 0;\n\n@Component({\n tag: 'admiralty-tab-group',\n styleUrl: 'tab-group.scss',\n scoped: true,\n})\nexport class TabGroupComponent {\n @Element() el: HTMLElement;\n\n @Prop({ mutable: true }) selectedIndex = 0;\n\n @Event() admiraltyTabSelected: EventEmitter<number>;\n\n private _groupId = nextId++;\n\n private _tabs: TabInfo[] = [];\n private _tabHeaders: HTMLElement[] = [];\n\n handleSelectedTab(idx: number) {\n const oldContent = this.el.querySelector(`.tab-content#${this.getTabContentId(this.selectedIndex)}`);\n oldContent.classList.remove('active');\n oldContent.setAttribute('tabindex', this.getTabIndex(idx).toString());\n\n this.selectedIndex = idx;\n this.setSelectedTabContent();\n\n this.admiraltyTabSelected.emit(idx);\n }\n\n private setSelectedTabContent() {\n const activeContent = this.el.querySelector(`.tab-content#${this.getTabContentId(this.selectedIndex)}`);\n activeContent.classList.add('active');\n activeContent.setAttribute('tabindex', this.getTabIndex(this.selectedIndex).toString());\n }\n\n private getTabIndex(index: number): number | null {\n return this.selectedIndex === index ? 0 : -1;\n }\n\n private getTabContentId(i: number): string {\n return `tab-panel-${this._groupId}-${i}`;\n }\n\n private getTabLabelId(i: number): string {\n return `tab-label-${this._groupId}-${i}`;\n }\n\n handleKeyDown(event: KeyboardEvent): void {\n const tgt = event.target as HTMLElement;\n let processed = false;\n\n switch (event.key) {\n case Keys.LEFT_ARROW:\n this.moveFocusToPreviousTab(tgt);\n processed = true;\n break;\n case Keys.RIGHT_ARROW:\n this.moveFocusToNextTab(tgt);\n processed = true;\n break;\n\n case Keys.HOME:\n this.moveFocusToTabHeader(this._tabHeaders[0]);\n processed = true;\n break;\n\n case Keys.END:\n this.moveFocusToTabHeader(this._tabHeaders[this._tabHeaders.length - 1]);\n processed = true;\n break;\n default:\n break;\n }\n\n if (processed) {\n event.stopPropagation();\n event.preventDefault();\n }\n }\n\n private moveFocusToTabHeader(header: HTMLElement) {\n header.focus();\n }\n\n private moveFocusToPreviousTab(currentHeader: HTMLElement) {\n const firstTab = this._tabHeaders[0];\n const lastTab = this._tabHeaders[this._tabHeaders.length - 1];\n\n if (currentHeader === firstTab) {\n this.moveFocusToTabHeader(lastTab);\n } else {\n const index = this._tabHeaders.indexOf(currentHeader);\n this.moveFocusToTabHeader(this._tabHeaders[index - 1]);\n }\n }\n\n private moveFocusToNextTab(currentHeader: HTMLElement) {\n const firstTab = this._tabHeaders[0];\n const lastTab = this._tabHeaders[this._tabHeaders.length - 1];\n\n if (currentHeader === lastTab) {\n this.moveFocusToTabHeader(firstTab);\n } else {\n const index = this._tabHeaders.indexOf(currentHeader);\n this.moveFocusToTabHeader(this._tabHeaders[index + 1]);\n }\n }\n\n componentWillLoad() {\n const tabItems = this.el.querySelectorAll('admiralty-tab');\n\n this._tabs = [];\n\n if (tabItems.length > 0) {\n let idx = 0;\n tabItems.forEach(t => {\n t.tabLabelId = this.getTabLabelId(idx);\n t.tabContentId = this.getTabContentId(idx);\n\n this._tabs.push({ label: t.label, index: idx });\n ++idx;\n });\n\n this.selectedIndex = Math.max(0, Math.min(this.selectedIndex, tabItems.length - 1));\n }\n }\n\n componentDidLoad() {\n this._tabHeaders = Array.from(this.el.querySelectorAll('[role=\"tab\"]'));\n\n const tabItems = this.el.querySelectorAll('admiralty-tab .tab-content');\n\n if (tabItems.length > 0) {\n const tabContent = this.el.querySelector('hr');\n tabContent.after(...Array.from(tabItems));\n\n this.setSelectedTabContent();\n forceUpdate(this);\n }\n }\n\n render() {\n const createHeaders = () =>\n Array.from(this._tabs).map(tab => (\n <button\n class={{ heading: true, active: tab.index === this.selectedIndex }}\n id={this.getTabLabelId(tab.index)}\n role=\"tab\"\n tabIndex={this.getTabIndex(tab.index)}\n aria-setsize={this._tabs.length}\n aria-selected={`${tab.index === this.selectedIndex}`}\n aria-controls={this.getTabContentId(tab.index)}\n onClick={_ev => this.handleSelectedTab(tab.index)}\n onKeyDown={ev => this.handleKeyDown(ev)}\n >\n {tab.label}\n </button>\n ));\n\n return (\n <Host>\n <div class=\"tab-group-headers\" role=\"tablist\">\n <div class=\"headers\">{createHeaders()}</div>\n </div>\n <hr />\n <slot></slot>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -463,9 +463,10 @@ const AutocompleteComponent = class {
|
|
|
463
463
|
// with the `class` from the `menuAttributes` so
|
|
464
464
|
// we need to clean it up from the computed attributes
|
|
465
465
|
delete computedMenuAttributes.class;
|
|
466
|
-
return (h("div", { key: '
|
|
466
|
+
return (h("div", { key: '9cb9e0e2dad7646540004b2d36870c31b116f035', class: wrapperClassName, onKeyDown: event => this.handleKeyDown(event) }, this.label ? (h("admiralty-label", { class: "autocomplete__label", disabled: this.disabled, for: inputId }, this.label)) : null, this.hint ? (h("admiralty-hint", { id: hintId, disabled: this.disabled }, this.hint)) : null, h("div", { key: '93189d20cea5100ed4bc408824735569ea9d5e26', class: "autocomplete__input-wrapper" }, h("input", Object.assign({ key: '74770128149f77d1a4c17be5389188e29e34df1e' }, ariaProps, { disabled: this.disabled, "aria-disabled": this.disabled, autoComplete: "off", class: inputClassList.join(' '), id: inputId, onClick: event => this.handleInputClick(event), onBlur: event => this.handleInputBlur(event), onInput: event => this.handleInputChange(event), onFocus: event => this.handleInputFocus(event), name: this.name, placeholder: this.placeholder, ref: inputElement => {
|
|
467
467
|
this.elementReferences[-1] = inputElement;
|
|
468
|
-
}, type: "text", role: "combobox", required: this.required, value: this.query })),
|
|
468
|
+
}, type: "text", role: "combobox", required: this.required, value: this.query })), this.showAllValues &&
|
|
469
|
+
h("admiralty-icon", { key: '98032793bfdc0fb9ca7c90be9352e234de7d72bb', class: `autocomplete-down-icon ${this.disabled ? "disabled" : ""}`, "icon-name": this.menuOpen || showNoOptionsFound ? "angle-up" : "angle-down" })), h("ul", Object.assign({ key: '4b0ba76ad0eefa89c67b85bb8bb574133696e574' }, computedMenuAttributes, { class: menuClassList.join(' ') }), this.options.map((option, index) => {
|
|
469
470
|
const showFocused = this.focused === -1 ? this.selected === index : this.focused === index;
|
|
470
471
|
const optionModifierFocused = showFocused && this.hovered === null ? ` ${optionClassName}--focused` : '';
|
|
471
472
|
const iosPosinsetHtml = isIosDevice()
|
|
@@ -477,7 +478,7 @@ const AutocompleteComponent = class {
|
|
|
477
478
|
return (h("li", { "aria-selected": this.focused === index ? 'true' : 'false', class: `${optionClassName}${optionModifierFocused}`, innerHTML: this.templateSuggestion(option.text) + iosPosinsetHtml, id: `${id}__option--${index}`, key: index, onBlur: event => this.handleOptionBlur(event, index), onClick: event => this.handleOptionClick(event, index), onMouseDown: event => this.handleOptionMouseDown(event), onMouseEnter: () => this.handleOptionMouseEnter(index), ref: optionEl => {
|
|
478
479
|
this.elementReferences[index] = optionEl;
|
|
479
480
|
}, role: "option", tabIndex: -1, "aria-posinset": index + 1, "aria-setsize": this.options.length }));
|
|
480
|
-
}), showNoOptionsFound && h("li", { key: '
|
|
481
|
+
}), showNoOptionsFound && h("li", { key: 'aef863d0e03270176d2967cc4f98ee813063debc', class: `${optionClassName} ${optionClassName}--no-results` }, "No results found")), h("span", { key: 'bf9764e00280f22c3f0901e7e9276e7a9c1d5eae', id: assistiveHintID, style: { display: 'none' } }, this.assistiveHint), this.invalid && this.invalidMessage && (h("admiralty-input-invalid", { key: '6be96502d68013e546a9e33d0ccdede7462fbb19', id: errorId, style: { visibility: this.invalid && this.invalidMessage ? 'visible' : 'hidden' } }, this.invalidMessage))));
|
|
481
482
|
}
|
|
482
483
|
get el() { return getElement(this); }
|
|
483
484
|
static get watchers() { return {
|