@aquera/nile-elements 1.4.4-beta-1.2 → 1.4.5-beta-1.0

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.
Files changed (45) hide show
  1. package/README.md +3 -0
  2. package/demo/index.html +3 -7
  3. package/demo/variables.css +1 -0
  4. package/dist/index.js +11 -11
  5. package/dist/nile-auto-complete/nile-auto-complete.cjs.js +1 -1
  6. package/dist/nile-auto-complete/nile-auto-complete.cjs.js.map +1 -1
  7. package/dist/nile-auto-complete/nile-auto-complete.esm.js +3 -3
  8. package/dist/nile-chip/nile-chip.cjs.js +1 -1
  9. package/dist/nile-chip/nile-chip.cjs.js.map +1 -1
  10. package/dist/nile-chip/nile-chip.esm.js +11 -11
  11. package/dist/nile-dropdown/nile-dropdown.cjs.js +1 -1
  12. package/dist/nile-dropdown/nile-dropdown.cjs.js.map +1 -1
  13. package/dist/nile-dropdown/nile-dropdown.esm.js +2 -2
  14. package/dist/nile-toast/nile-toast.cjs.js +1 -1
  15. package/dist/nile-toast/nile-toast.cjs.js.map +1 -1
  16. package/dist/nile-toast/nile-toast.esm.js +2 -2
  17. package/dist/src/nile-accesibility/index.d.ts +1 -0
  18. package/dist/src/nile-accesibility/index.js +2 -0
  19. package/dist/src/nile-accesibility/index.js.map +1 -0
  20. package/dist/src/nile-accesibility/nile-accesibility.css.d.ts +12 -0
  21. package/dist/src/nile-accesibility/nile-accesibility.css.js +41 -0
  22. package/dist/src/nile-accesibility/nile-accesibility.css.js.map +1 -0
  23. package/dist/src/nile-accesibility/nile-accesibility.d.ts +18 -0
  24. package/dist/src/nile-accesibility/nile-accesibility.js +61 -0
  25. package/dist/src/nile-accesibility/nile-accesibility.js.map +1 -0
  26. package/dist/src/nile-auto-complete/nile-auto-complete.d.ts +1 -0
  27. package/dist/src/nile-auto-complete/nile-auto-complete.js +13 -3
  28. package/dist/src/nile-auto-complete/nile-auto-complete.js.map +1 -1
  29. package/dist/src/nile-chip/nile-chip.d.ts +2 -0
  30. package/dist/src/nile-chip/nile-chip.js +10 -4
  31. package/dist/src/nile-chip/nile-chip.js.map +1 -1
  32. package/dist/src/nile-dropdown/nile-dropdown.js +4 -0
  33. package/dist/src/nile-dropdown/nile-dropdown.js.map +1 -1
  34. package/dist/src/nile-toast/nile-toast.d.ts +1 -1
  35. package/dist/src/nile-toast/nile-toast.js +4 -4
  36. package/dist/src/nile-toast/nile-toast.js.map +1 -1
  37. package/dist/src/version.js +1 -1
  38. package/dist/src/version.js.map +1 -1
  39. package/dist/tsconfig.tsbuildinfo +1 -1
  40. package/package.json +1 -1
  41. package/src/nile-auto-complete/nile-auto-complete.ts +9 -3
  42. package/src/nile-chip/nile-chip.ts +5 -10
  43. package/src/nile-dropdown/nile-dropdown.ts +3 -0
  44. package/src/nile-toast/nile-toast.ts +4 -4
  45. package/vscode-html-custom-data.json +16 -2
@@ -1 +1 @@
1
- {"version":3,"file":"nile-chip.cjs.js","sources":["../../../src/nile-chip/nile-chip.ts"],"sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n LitElement,\n html,\n CSSResultArray,\n TemplateResult,\n PropertyValues,\n} from 'lit';\nimport { customElement, query, state, property } from 'lit/decorators.js';\nimport { styles } from './nile-chip.css';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { HasSlotController } from '../internal/slot';\nimport NileElement, { NileFormControl } from '../internal/nile-element';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js';\nimport { VisibilityManager } from '../utilities/visibility-manager.js';\n\ninterface CustomEventDetail {\n value: string;\n}\n\n@customElement('nile-chip')\nexport class NileChip extends NileElement {\n public static get styles(): CSSResultArray {\n return [styles];\n }\n\n private readonly hasSlotController = new HasSlotController(\n this,\n 'help-text',\n 'label'\n );\n\n @state() tags: string[] = [];\n\n @state() inputValue: string = '';\n\n @state() isDropdownOpen: boolean = false;\n @state() tooltips: (string | null)[] = [];\n @state() private chipFocusIndex: number | null = null;\n\n\n @query('nile-auto-complete') autoComplete!: any;\n\n /** Sets the input to a warning state, changing its visual appearance. */\n @property({ type: Boolean }) warning = false;\n\n@property({ type: Boolean }) noAutoComplete = false;\n\n\n /** Sets the input to an error state, changing its visual appearance. */\n @property({ type: Boolean }) error = false;\n\n /** Sets the input to a success state, changing its visual appearance. */\n @property({ type: Boolean }) success = false;\n\n /** Disables the duplicate entries. */\n @property({ type: Boolean }) noDuplicates = false;\n\n /** The input's label. If you need to display HTML, use the `label` slot instead. */\n @property() label = '';\n\n @property({ type: String }) tagVariant: string = ''; // can be '', 'normal', 'success', etc.\n\n\n /** Adds a clear button when the input is not empty. */\n @property({ type: Boolean }) acceptUserInput = false;\n\n /** When true, adds a chip when the input loses focus or when clicking outside the component. Only works when acceptUserInput is true. */\n @property({ type: Boolean }) addOnBlur = false;\n\n /** Adds a clear button when the input is not empty. */\n @property({ type: Boolean }) clearable = false;\n\n /** Placeholder text to show as a hint when the input is empty. */\n @property() placeholder = 'type here...';\n\n /** Makes the input readonly. */\n @property({ type: Boolean, reflect: true }) readonly = false;\n\n /** Disables the input. */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /** \n * When true, the dropdown menu will be appended to the document body instead of the parent container.\n * This is useful when the parent has overflow: hidden, clip-path, or transform applied.\n */\n @property({ type: Boolean, reflect: true }) portal = false;\n\n // AUTO-COMPLETE-OPTIONS\n\n /** Virtual scroll in dropdown options. */\n @property({ type: Boolean }) enableVirtualScroll = false;\n\n @property({ type: Array }) autoCompleteOptions: any[] = [];\n\n @property({ type: Array }) filteredAutoCompleteOptions: any[] = [];\n\n @property({ type: Array }) value: any[] = [];\n\n @property({ type: Boolean }) noWrap: boolean = false;\n\n @property({ type: Boolean }) loading: boolean = false;\n\n @property({ type: Array }) errorIndexes: number[] = [];\n\n @property({ attribute: 'help-text', reflect: true }) helpText = '';\n\n @property({ attribute: 'error-message', reflect: true }) errorMessage = '';\n\n @property({ attribute:false}) filterFunction: (item:string,searchedValue:string)=>boolean = (item:string,searchedValue:string)=>item.toLowerCase().includes(searchedValue.toLowerCase());\n\n @property({ attribute:false}) renderItemFunction: (item:any)=>string = (item:any)=>item;\n\n private visibilityManager?: VisibilityManager;\n\n @property({ type: Boolean, reflect: true }) enableVisibilityEffect = false;\n\n @property({ type: Boolean, reflect: true }) enableTabClose = false;\n\n @property({ type: Boolean }) showTooltip: boolean = false;\n\n @property({ type: Boolean }) enableTagDelete = false;\n\n private isSelectingFromDropdown = false;\n\n\n private resetDropdownState() {\n this.isSelectingFromDropdown = false;\n }\n \n\n protected updated(changedProperties: PropertyValues): void {\n super.updated(changedProperties);\n if (changedProperties.has('autoCompleteOptions')) {\n let options = this.autoCompleteOptions;\n if (typeof options === 'string') {\n try {\n options = JSON.parse(options);\n } catch (e) {\n options = [];\n }\n }\n this.filteredAutoCompleteOptions = Array.isArray(options) ? [...options] : [];\n if (this.noDuplicates) {\n this.filteredAutoCompleteOptions =\n this.filteredAutoCompleteOptions.filter(\n option => !this.value.includes(option)\n );\n }\n }\n if (changedProperties.has('value')){\n this.tags = [...this.value];\n this.onTagsChanged();\n }\n if (changedProperties.has('tags')){\n this.onTagsChanged();\n }\n }\n \n protected async firstUpdated(_changed: PropertyValues) {\n await this.updateComplete;\n \n const inputTarget =\n this.noAutoComplete\n ? this.renderRoot.querySelector('nile-input')?.input\n : this.autoComplete?.inputElement?.input || this.autoComplete?.inputElement;\n \n this.visibilityManager = new VisibilityManager({\n host: this,\n target: inputTarget,\n enableVisibilityEffect: this.enableVisibilityEffect,\n enableTabClose: this.enableTabClose,\n isOpen: () => this.isDropdownOpen,\n onAnchorOutOfView: () => {\n this.isDropdownOpen = false;\n if (this.autoComplete) {\n this.autoComplete.isDropdownOpen = false;\n } \n this.emit('nile-visibility-change', {\n visible: false,\n reason: 'anchor-out-of-view',\n });\n },\n onDocumentHidden: () => {\n this.isDropdownOpen = false;\n if (this.autoComplete) {\n this.autoComplete.isDropdownOpen = false;\n }\n this.emit('nile-visibility-change', {\n visible: false,\n reason: 'document-hidden',\n });\n },\n emit: (event, detail) => this.emit(`nile-${event}`, detail),\n });\n }\n\n \n private handleDocumentClick = (event: MouseEvent) => {\n const path = event.composedPath();\n \n if (this.isSelectingFromDropdown) {\n // Do NOT process addOnBlur while selecting dropdown\n this.resetDropdownState();\n return;\n }\n \n // User clicked outside chip → normal addOnBlur path\n if (!path.includes(this)) {\n if (this.addOnBlur && this.acceptUserInput && this.inputValue) {\n this.addChipFromInputValue();\n }\n this.isDropdownOpen = false;\n }\n };\n \n \n \n connectedCallback() {\n super.connectedCallback();\n document.addEventListener('click', this.handleDocumentClick);\n if (this.noDuplicates) {\n this.filteredAutoCompleteOptions =\n this.filteredAutoCompleteOptions.filter(\n option => !this.value.includes(option)\n );\n }\n this.emit('nile-init');\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.visibilityManager?.cleanup();\n document.removeEventListener('click', this.handleDocumentClick);\n this.emit('nile-destroy');\n }\n\n private markDropdownSelectStart(event: MouseEvent) {\n this.isSelectingFromDropdown = true;\n }\n \n\n render() {\n // Check if slots are present\n const hasLabelSlot = this.hasSlotController.test('label');\n const hasHelpTextSlot = this.hasSlotController.test('help-text');\n\n // Check if label and help text are present\n const hasLabel = this.label ? true : !!hasLabelSlot;\n\n const hasHelpText = this.helpText ? true : false;\n const hasErrorMessage = this.errorMessage ? true : false;\n\n return html`\n <div\n part=\"form-control\"\n class=${classMap({\n 'form-control': true,\n 'form-control--medium': true,\n 'form-control--has-label': hasLabel,\n 'form-control--has-help-text': hasHelpText,\n 'nile-chip--disabled': this.disabled,\n })}\n >\n <label\n part=\"form-control-label\"\n class=\"form-control__label\"\n for=\"input\"\n aria-hidden=${hasLabel ? 'false' : 'true'}\n >\n <slot name=\"label\">${this.label}</slot>\n </label>\n\n <div\n part='base' \n class=${classMap({\n 'nile-chip': true,\n 'nile-chip--warning': this.warning,\n 'nile-chip--error': this.error,\n 'nile-chip--success': this.success,\n 'nile-chip--no-wrap': this.noWrap,\n 'nile-chip--open': this.isDropdownOpen, \n })}\n >\n ${this.tags.map((tag, index) => {\n const tooltipContent = this.tooltips[index];\n const isFocused = this.enableTagDelete && this.chipFocusIndex === index;\n let tagText = \"\";\n if(tag || typeof tag === \"number\") {\n tagText = tag.toString();\n }\n const tagTemplate = html`\n <nile-tag\n class=${classMap({\n 'nile-chip__tags': true,\n 'nile-chip__tags--focused': isFocused,\n })}\n aria-selected=${isFocused ? 'true' : 'false'}\n .variant=${this.errorIndexes.includes(index)\n ? 'error'\n : 'normal'}\n @nile-remove=${() => this.handleRemove(tag)}\n removable\n ?pill=${this.tagVariant !== 'normal'}\n ?disabled=${this.disabled}\n >\n ${unsafeHTML(tagText)}\n </nile-tag>\n `;\n\n if (this.showTooltip && tooltipContent) {\n return html`\n <nile-lite-tooltip allowHTML .content=${tooltipContent}>\n ${tagTemplate}\n </nile-lite-tooltip>\n `;\n }\n\n return tagTemplate;\n })}\n\n <div class=\"nile-chip__auto-complete\">\n ${this.noAutoComplete\n ? html`\n <nile-input\n .value=${this.inputValue}\n .placeholder=${this.placeholder}\n .disabled=${this.disabled}\n ?no-border=${true}\n ?no-outline=${true}\n ?no-padding=${true}\n @nile-input=${this.handleInputChange}\n @keydown=${this.handleInputKeydown}\n @focus=${this.handleFocus}\n @blur=${this.handleBlur}\n exportparts=\"input\"\n ></nile-input>\n `\n : html`\n <nile-auto-complete\n .enableVirtualScroll=${this.enableVirtualScroll}\n .allMenuItems=${this.filteredAutoCompleteOptions}\n .filterFunction=${this.filterFunction}\n .renderItemFunction=${this.renderItemFunction}\n .showTooltips=${this.showTooltip}\n .loading=\"${this.loading}\"\n .value=${this.inputValue}\n ?isDropdownOpen=${this.isDropdownOpen}\n .noBorder=${true}\n .noOutline=${true}\n .noPadding=${true}\n .disabled=${this.disabled}\n .readonly=${this.readonly}\n .portal=${this.portal}\n openOnFocus\n exportparts=\"options__wrapper, input, base\"\n .placeholder=${this.placeholder}\n @nile-input=${this.handleInputChange}\n @keydown=${this.handleInputKeydown}\n @nile-focus=${this.handleFocus}\n @nile-blur=${this.handleBlur}\n @nile-complete=${this.handleSelect}\n @mousedown=${this.markDropdownSelectStart}\n\n ></nile-auto-complete>\n `}\n </div>\n </div>\n ${hasHelpText\n ? html` <nile-form-help-text>${this.helpText}</nile-form-help-text> `\n : ``}\n ${hasErrorMessage\n ? html`\n <nile-form-error-message\n >${this.errorMessage}</nile-form-error-message\n >\n `\n : ``}\n </div>\n `;\n }\n\n private handleSelect(event: CustomEvent<CustomEventDetail>) {\n this.isSelectingFromDropdown = false;\n this.resetDropdownState();\n\n // Add the selected value to the tags array only if it doesn't already exist\n const selectedValue = event.detail.value;\n const selectedOption = this.autoCompleteOptions.find(\n (opt) => opt.name === selectedValue || opt.id === selectedValue\n );\n\n let tooltipContent: string | null = null;\n \n if (this.showTooltip) {\n if (selectedOption?.tooltip?.content) {\n const { content, for: showFor } = selectedOption.tooltip;\n if (!showFor || showFor === 'tag') {\n if (content instanceof Promise) {\n this.tooltips = [...this.tooltips, 'Loading...'];\n \n const currentIndex = this.tooltips.length - 1;\n content.then((resolved) => {\n this.tooltips[currentIndex] = resolved;\n this.requestUpdate();\n });\n } else {\n tooltipContent = content;\n }\n }\n } else {\n tooltipContent = selectedOption?.name || selectedValue;\n }\n }\n\n if (!this.noDuplicates || !this.tags.includes(selectedValue)) {\n this.tags = [...this.tags, selectedValue];\n \n\n if (!(selectedOption?.tooltip?.content instanceof Promise)) {\n this.tooltips = [...this.tooltips, tooltipContent];\n }\n \n this.emit('nile-chip-change', { value: this.tags });\n this.resetInput();\n }\n }\n\n private handleRemove(value: string) {\n // Remove the tag from the tags array\n this.tags = this.tags.filter(tag => tag !== value);\n\n if (this.noDuplicates && this.autoCompleteOptions.includes(value)) {\n this.filteredAutoCompleteOptions = [\n ...this.filteredAutoCompleteOptions,\n value,\n ];\n }\n this.emit('nile-chip-change', { value: this.tags });\n }\n\n private handleInputChange(event: CustomEvent<CustomEventDetail>) {\n // Update the input value\n this.inputValue = event.detail.value;\n }\n\n private addChipFromInputValue(): boolean {\n if (this.noDuplicates && this.tags.includes(this.inputValue)) {\n this.emit('nile-duplicates-blocked');\n return false;\n }\n\n this.tags = [...this.tags, this.inputValue];\n if (this.showTooltip) {\n this.tooltips = [...this.tooltips, this.inputValue];\n } else {\n this.tooltips = [...this.tooltips, null];\n }\n\n this.inputValue = '';\n this.visibilityManager?.cleanup();\n this.emit('nile-chip-change', { value: this.tags });\n return true;\n }\n\n private handleInputKeydown(event: KeyboardEvent) {\n if (\n this.enableTagDelete &&\n (event.key === 'Backspace' || event.key === 'Delete') &&\n !this.inputValue &&\n !this.readonly &&\n !this.disabled\n ) {\n if (this.tags.length === 0) {\n this.chipFocusIndex = null;\n return;\n }\n\n event.preventDefault();\n if (this.chipFocusIndex === null) {\n this.chipFocusIndex = this.tags.length - 1;\n this.requestUpdate();\n return;\n }\n const index = this.chipFocusIndex;\n const removedTag = this.tags[index];\n\n this.tags = this.tags.filter((_, i) => i !== index);\n this.tooltips = this.tooltips.filter((_, i) => i !== index);\n\n this.emit('nile-chip-change', { value: this.tags });\n if (this.tags.length > 0) {\n this.chipFocusIndex = Math.max(0, index - 1);\n } else {\n this.chipFocusIndex = null;\n }\n\n return;\n }\n\n if (this.readonly) {\n const allowedKeys = ['ArrowUp', 'ArrowDown', 'Enter', 'Tab'];\n if (!allowedKeys.includes(event.key)) {\n event.preventDefault();\n return;\n }\n }\n\n if (!this.acceptUserInput) {\n return;\n }\n\n if(event.key === 'Tab'){\n event.preventDefault()\n }\n \n if (\n (event.key === 'Enter' || event.key === 'Tab' ) \n && this.inputValue \n && (!this.noDuplicates || !this.tags.includes(this.inputValue))\n ) {\n event.preventDefault()\n this.tags = [...this.tags, this.inputValue];\n if (this.showTooltip) {\n this.tooltips = [...this.tooltips, this.inputValue];\n } else {\n this.tooltips = [...this.tooltips, null];\n }\n \n this.resetInput();\n this.emit('nile-chip-change', { value: this.tags });\n }\n\n if(\n (event.key === 'Enter'|| event.key === 'Tab' ) \n && this.inputValue \n && (this.noDuplicates || this.tags.includes(this.inputValue))\n ){\n this.emit('nile-duplicates-blocked');\n }\n }\n\n private handleFocus() {\n if (this.noAutoComplete) {\n return;\n }\n this.visibilityManager?.setup();\n this.isDropdownOpen = true;\n }\n\n private handleBlur() {\n if (this.isSelectingFromDropdown) return;\n \n if (this.addOnBlur && this.acceptUserInput && this.inputValue) {\n this.addChipFromInputValue();\n }\n }\n\n onTagsChanged() {\n if (this.noDuplicates)\n this.filteredAutoCompleteOptions = this.filteredAutoCompleteOptions.filter(option => !this.tags.includes(option));\n }\n\n\n private resetInput() {\n // Reset the input-related properties\n this.inputValue = '';\n this.isDropdownOpen = false;\n this.visibilityManager?.cleanup();\n if (!this.noAutoComplete && this.autoComplete) {\n this.autoComplete.value = '';\n this.autoComplete.handleFocus();\n }\n } \n}\n\nexport default NileChip;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-chip': NileChip;\n }\n}\n"],"names":["NileChip","d","this","hasSlotController","HasSlotController","tags","inputValue","isDropdownOpen","tooltips","chipFocusIndex","warning","noAutoComplete","error","success","noDuplicates","label","tagVariant","acceptUserInput","addOnBlur","clearable","placeholder","readonly","disabled","portal","enableVirtualScroll","autoCompleteOptions","filteredAutoCompleteOptions","value","noWrap","loading","errorIndexes","helpText","errorMessage","filterFunction","item","searchedValue","toLowerCase","includes","renderItemFunction","enableVisibilityEffect","enableTabClose","showTooltip","enableTagDelete","isSelectingFromDropdown","handleDocumentClick","event","path","composedPath","resetDropdownState","addChipFromInputValue","_this","_inherits","_a","_createClass","key","updated","changedProperties","_this2","super","has","options","JSON","parse","e","Array","isArray","filter","option","onTagsChanged","_firstUpdated","_asyncToGenerator","_regeneratorRuntime","mark","_callee","_changed","updateComplete","inputTarget","renderRoot","querySelector","input","autoComplete","inputElement","visibilityManager","VisibilityManager","host","target","isOpen","onAnchorOutOfView","emit","visible","reason","onDocumentHidden","detail","_context2","stop","firstUpdated","connectedCallback","document","addEventListener","disconnectedCallback","cleanup","removeEventListener","markDropdownSelectStart","render","hasLabelSlot","test","hasLabel","hasHelpText","hasErrorMessage","html","_templateObject","_taggedTemplateLiteral","classMap","map","tag","index","tooltipContent","isFocused","tagText","toString","tagTemplate","_templateObject2","handleRemove","unsafeHTML","_templateObject3","_templateObject4","handleInputChange","handleInputKeydown","handleFocus","handleBlur","_templateObject5","handleSelect","_templateObject6","_templateObject7","selectedValue","selectedOption","find","opt","name","id","tooltip","content","_s$tooltip2","showFor","Promise","concat","_toConsumableArray","currentIndex","length","then","resolved","requestUpdate","resetInput","preventDefault","_","i","Math","max","setup","_this$visibilityManag4","__decorate","get","styles","NileElement","state","prototype","query","property","type","Boolean","String","reflect","attribute","_export","customElement"],"mappings":"0paA2BaA,CAAAA,uBAAAA,EAAAA,EAAN,SAAAC,EAAA,uEAKYC,KAAAA,CAAiBC,iBAAAA,CAAG,GAAIC,CAAAA,CACvCF,CAAAA,sBAAAA,CAAAA,KAAAA,EACA,WACA,CAAA,OAAA,CAAA,CAGOA,KAAAA,CAAIG,IAAAA,CAAa,GAEjBH,KAAAA,CAAUI,UAAAA,CAAW,GAErBJ,KAAAA,CAAcK,cAAAA,CAAAA,CAAY,EAC1BL,KAAAA,CAAQM,QAAAA,CAAsB,EACtBN,CAAAA,KAAAA,CAAcO,cAAkB,CAAA,IAAA,CAMpBP,KAAAA,CAAOQ,OAAG,CAAA,CAAA,CAAA,CAEZR,KAAAA,CAAcS,cAAG,CAAA,CAAA,CAAA,CAIfT,KAAAA,CAAKU,KAAG,CAAA,CAAA,CAAA,CAGRV,KAAAA,CAAOW,OAAAA,CAAAA,CAAG,CAGVX,CAAAA,KAAAA,CAAYY,cAAG,CAGhCZ,CAAAA,KAAAA,CAAKa,MAAG,EAEQb,CAAAA,KAAAA,CAAAc,WAAqB,EAIpBd,CAAAA,KAAAA,CAAee,eAAG,CAAA,CAAA,CAAA,CAGlBf,KAAAA,CAASgB,SAAAA,CAAAA,CAAG,E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AA,CAAAA,CAAA,CAA7BO,CAAS,CAAA,CAAEK,WAAU,CAAkE5K,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAqK,SAAA,CAAA,oBAAA,CAAA,IAAA,EAI5CL,CAAAA,CAAAA,CAAAA,CAAA,CAA3CO,CAAS,CAAA,CAAEC,KAAMC,OAASE,CAAAA,OAAAA,CAAAA,CAAS,KAAuC3K,CAAAqK,CAAAA,SAAAA,CAAA,6BAAA,EAE/BL,CAAAA,CAAAA,CAAAA,CAAA,CAA3CO,CAAS,CAAA,CAAEC,KAAMC,OAASE,CAAAA,OAAAA,CAAAA,CAAS,KAA+B3K,CAAAqK,CAAAA,SAAAA,CAAA,gBAAA,CAAA,IAAA,EAAA,CAAA,CAEtCL,CAAA,CAAA,CAA5BO,EAAS,CAAEC,IAAAA,CAAMC,WAAwCzK,CAAAqK,CAAAA,SAAAA,CAAA,kBAAA,EAE7BL,CAAAA,CAAAA,CAAAA,CAAA,CAA5BO,CAAS,CAAA,CAAEC,KAAMC,OAAmCzK,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAqK,UAAA,iBAAA,CAAA,IAAA,EAAA,CAAA,CAAAQ,OAAA,KApG1C7K,EAAQgK,CAAA,CAAA,CADpBc,CAAc,CAAA,WAAA,CAAA,CAAA,CACF9K"}
1
+ {"version":3,"file":"nile-chip.cjs.js","sources":["../../../src/nile-chip/nile-chip.ts"],"sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n LitElement,\n html,\n CSSResultArray,\n TemplateResult,\n PropertyValues,\n} from 'lit';\nimport { customElement, query, state, property } from 'lit/decorators.js';\nimport { styles } from './nile-chip.css';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { HasSlotController } from '../internal/slot';\nimport NileElement, { NileFormControl } from '../internal/nile-element';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js';\nimport { VisibilityManager } from '../utilities/visibility-manager.js';\n\ninterface CustomEventDetail {\n value: string;\n}\n\n@customElement('nile-chip')\nexport class NileChip extends NileElement {\n public static get styles(): CSSResultArray {\n return [styles];\n }\n\n private readonly hasSlotController = new HasSlotController(\n this,\n 'help-text',\n 'label'\n );\n\n @state() tags: string[] = [];\n\n @state() inputValue: string = '';\n\n @state() isDropdownOpen: boolean = false;\n @state() tooltips: (string | null)[] = [];\n @state() private chipFocusIndex: number | null = null;\n\n\n @query('nile-auto-complete') autoComplete!: any;\n\n /** Sets the input to a warning state, changing its visual appearance. */\n @property({ type: Boolean }) warning = false;\n\n@property({ type: Boolean }) noAutoComplete = false;\n\n\n /** Sets the input to an error state, changing its visual appearance. */\n @property({ type: Boolean }) error = false;\n\n /** Sets the input to a success state, changing its visual appearance. */\n @property({ type: Boolean }) success = false;\n\n /** Disables the duplicate entries. */\n @property({ type: Boolean }) noDuplicates = false;\n\n /** The input's label. If you need to display HTML, use the `label` slot instead. */\n @property() label = '';\n\n @property({ type: String }) tagVariant: string = ''; // can be '', 'normal', 'success', etc.\n\n\n /** Adds a clear button when the input is not empty. */\n @property({ type: Boolean }) acceptUserInput = false;\n\n /** When true, adds a chip when the input loses focus or when clicking outside the component. Only works when acceptUserInput is true. */\n @property({ type: Boolean }) addOnBlur = false;\n\n /** Adds a clear button when the input is not empty. */\n @property({ type: Boolean }) clearable = false;\n\n /** Placeholder text to show as a hint when the input is empty. */\n @property() placeholder = 'type here...';\n\n /** Makes the input readonly. */\n @property({ type: Boolean, reflect: true }) readonly = false;\n\n /** Disables the input. */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /** \n * When true, the dropdown menu will be appended to the document body instead of the parent container.\n * This is useful when the parent has overflow: hidden, clip-path, or transform applied.\n */\n @property({ type: Boolean, reflect: true }) portal = false;\n\n // AUTO-COMPLETE-OPTIONS\n\n /** Virtual scroll in dropdown options. */\n @property({ type: Boolean }) enableVirtualScroll = false;\n\n @property({ type: Array }) autoCompleteOptions: any[] = [];\n\n @property({ type: Array }) filteredAutoCompleteOptions: any[] = [];\n\n @property({ type: Array }) value: any[] = [];\n\n @property({ type: Boolean }) noWrap: boolean = false;\n\n @property({ type: Boolean }) loading: boolean = false;\n\n @property({ type: Array }) errorIndexes: number[] = [];\n\n @property({ attribute: 'help-text', reflect: true }) helpText = '';\n\n @property({ attribute: 'error-message', reflect: true }) errorMessage = '';\n\n @property({ attribute:false}) filterFunction: (item:string,searchedValue:string)=>boolean = (item:string,searchedValue:string)=>item.toLowerCase().includes(searchedValue.toLowerCase());\n\n @property({ attribute:false}) renderItemFunction: (item:any)=>string = (item:any)=>item;\n\n private visibilityManager?: VisibilityManager;\n\n @property({ type: Boolean, reflect: true }) enableVisibilityEffect = false;\n\n @property({ type: Boolean, reflect: true }) enableTabClose = false;\n\n @property({ type: Boolean }) showTooltip: boolean = false;\n\n @property({ type: Boolean }) enableTagDelete = false;\n\n @property({ type: String, reflect: true, attribute: true }) openDropdownOnFocus: string = 'true';\n\n @property({ type: Boolean, reflect: true, attribute: true }) noDropdownClose = false;\n\n private isSelectingFromDropdown = false;\n private resetDropdownState() {\n this.isSelectingFromDropdown = false;\n }\n \n\n protected updated(changedProperties: PropertyValues): void {\n super.updated(changedProperties);\n if (changedProperties.has('autoCompleteOptions')) {\n let options = this.autoCompleteOptions;\n if (typeof options === 'string') {\n try {\n options = JSON.parse(options);\n } catch (e) {\n options = [];\n }\n }\n this.filteredAutoCompleteOptions = Array.isArray(options) ? [...options] : [];\n if (this.noDuplicates) {\n this.filteredAutoCompleteOptions =\n this.filteredAutoCompleteOptions.filter(\n option => !this.value.includes(option)\n );\n }\n }\n if (changedProperties.has('value')){\n this.tags = [...this.value];\n this.onTagsChanged();\n }\n if (changedProperties.has('tags')){\n this.onTagsChanged();\n }\n }\n \n protected async firstUpdated(_changed: PropertyValues) {\n await this.updateComplete;\n \n const inputTarget =\n this.noAutoComplete\n ? this.renderRoot.querySelector('nile-input')?.input\n : this.autoComplete?.inputElement?.input || this.autoComplete?.inputElement;\n \n this.visibilityManager = new VisibilityManager({\n host: this,\n target: inputTarget,\n enableVisibilityEffect: this.enableVisibilityEffect,\n enableTabClose: this.enableTabClose,\n isOpen: () => this.isDropdownOpen,\n onAnchorOutOfView: () => {\n this.isDropdownOpen = false;\n if (this.autoComplete) {\n this.autoComplete.isDropdownOpen = false;\n } \n this.emit('nile-visibility-change', {\n visible: false,\n reason: 'anchor-out-of-view',\n });\n },\n onDocumentHidden: () => {\n this.isDropdownOpen = false;\n if (this.autoComplete) {\n this.autoComplete.isDropdownOpen = false;\n }\n this.emit('nile-visibility-change', {\n visible: false,\n reason: 'document-hidden',\n });\n },\n emit: (event, detail) => this.emit(`nile-${event}`, detail),\n });\n }\n\n \n private handleDocumentClick = (event: MouseEvent) => {\n const path = event.composedPath();\n \n if (this.isSelectingFromDropdown) {\n this.resetDropdownState();\n return;\n }\n if (!path.includes(this)) {\n if (this.addOnBlur && this.acceptUserInput && this.inputValue) {\n this.addChipFromInputValue();\n }\n this.isDropdownOpen = false;\n }\n };\n \n connectedCallback() {\n super.connectedCallback();\n document.addEventListener('click', this.handleDocumentClick);\n if (this.noDuplicates) {\n this.filteredAutoCompleteOptions =\n this.filteredAutoCompleteOptions.filter(\n option => !this.value.includes(option)\n );\n }\n this.emit('nile-init');\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.visibilityManager?.cleanup();\n document.removeEventListener('click', this.handleDocumentClick);\n this.emit('nile-destroy');\n }\n\n private markDropdownSelectStart(event: MouseEvent) {\n this.isSelectingFromDropdown = true;\n }\n \n\n render() {\n // Check if slots are present\n const hasLabelSlot = this.hasSlotController.test('label');\n const hasHelpTextSlot = this.hasSlotController.test('help-text');\n\n // Check if label and help text are present\n const hasLabel = this.label ? true : !!hasLabelSlot;\n\n const hasHelpText = this.helpText ? true : false;\n const hasErrorMessage = this.errorMessage ? true : false;\n\n return html`\n <div\n part=\"form-control\"\n class=${classMap({\n 'form-control': true,\n 'form-control--medium': true,\n 'form-control--has-label': hasLabel,\n 'form-control--has-help-text': hasHelpText,\n 'nile-chip--disabled': this.disabled,\n })}\n >\n <label\n part=\"form-control-label\"\n class=\"form-control__label\"\n for=\"input\"\n aria-hidden=${hasLabel ? 'false' : 'true'}\n >\n <slot name=\"label\">${this.label}</slot>\n </label>\n\n <div\n part='base' \n class=${classMap({\n 'nile-chip': true,\n 'nile-chip--warning': this.warning,\n 'nile-chip--error': this.error,\n 'nile-chip--success': this.success,\n 'nile-chip--no-wrap': this.noWrap,\n 'nile-chip--open': this.isDropdownOpen, \n })}\n >\n ${this.tags.map((tag, index) => {\n const tooltipContent = this.tooltips[index];\n const isFocused = this.enableTagDelete && this.chipFocusIndex === index;\n let tagText = \"\";\n if(tag || typeof tag === \"number\") {\n tagText = tag.toString();\n }\n const tagTemplate = html`\n <nile-tag\n class=${classMap({\n 'nile-chip__tags': true,\n 'nile-chip__tags--focused': isFocused,\n })}\n aria-selected=${isFocused ? 'true' : 'false'}\n .variant=${this.errorIndexes.includes(index)\n ? 'error'\n : 'normal'}\n @nile-remove=${() => this.handleRemove(tag)}\n removable\n ?pill=${this.tagVariant !== 'normal'}\n ?disabled=${this.disabled}\n >\n ${unsafeHTML(tagText)}\n </nile-tag>\n `;\n\n if (this.showTooltip && tooltipContent) {\n return html`\n <nile-lite-tooltip allowHTML .content=${tooltipContent}>\n ${tagTemplate}\n </nile-lite-tooltip>\n `;\n }\n\n return tagTemplate;\n })}\n\n <div class=\"nile-chip__auto-complete\">\n ${this.noAutoComplete\n ? html`\n <nile-input\n .value=${this.inputValue}\n .placeholder=${this.placeholder}\n .disabled=${this.disabled}\n ?no-border=${true}\n ?no-outline=${true}\n ?no-padding=${true}\n @nile-input=${this.handleInputChange}\n @keydown=${this.handleInputKeydown}\n @focus=${this.handleFocus}\n @blur=${this.handleBlur}\n exportparts=\"input\"\n ></nile-input>\n `\n : html`\n <nile-auto-complete\n .enableVirtualScroll=${this.enableVirtualScroll}\n .allMenuItems=${this.filteredAutoCompleteOptions}\n .filterFunction=${this.filterFunction}\n .renderItemFunction=${this.renderItemFunction}\n .showTooltips=${this.showTooltip}\n .loading=\"${this.loading}\"\n .value=${this.inputValue}\n ?isDropdownOpen=${this.isDropdownOpen}\n .noBorder=${true}\n .noOutline=${true}\n .noPadding=${true}\n .disabled=${this.disabled}\n .readonly=${this.readonly}\n .portal=${this.portal}\n ?openOnFocus=${this.openDropdownOnFocus === 'true' ? true : false}\n exportparts=\"options__wrapper, input, base\"\n .placeholder=${this.placeholder}\n @nile-input=${this.handleInputChange}\n @keydown=${this.handleInputKeydown}\n @nile-focus=${this.handleFocus}\n @nile-blur=${this.handleBlur}\n @nile-complete=${this.handleSelect}\n @mousedown=${this.markDropdownSelectStart}\n .noDropdownClose=${this.noDropdownClose}\n ></nile-auto-complete>\n `}\n </div>\n </div>\n ${hasHelpText\n ? html` <nile-form-help-text>${this.helpText}</nile-form-help-text> `\n : ``}\n ${hasErrorMessage\n ? html`\n <nile-form-error-message\n >${this.errorMessage}</nile-form-error-message\n >\n `\n : ``}\n </div>\n `;\n }\n\n private handleSelect(event: CustomEvent<CustomEventDetail>) {\n this.isSelectingFromDropdown = false;\n this.resetDropdownState();\n // Add the selected value to the tags array only if it doesn't already exist\n const selectedValue = event.detail.value;\n const selectedOption = this.autoCompleteOptions.find(\n (opt) => opt.name === selectedValue || opt.id === selectedValue\n );\n\n let tooltipContent: string | null = null;\n \n if (this.showTooltip) {\n if (selectedOption?.tooltip?.content) {\n const { content, for: showFor } = selectedOption.tooltip;\n if (!showFor || showFor === 'tag') {\n if (content instanceof Promise) {\n this.tooltips = [...this.tooltips, 'Loading...'];\n \n const currentIndex = this.tooltips.length - 1;\n content.then((resolved) => {\n this.tooltips[currentIndex] = resolved;\n this.requestUpdate();\n });\n } else {\n tooltipContent = content;\n }\n }\n } else {\n tooltipContent = selectedOption?.name || selectedValue;\n }\n }\n\n if (!this.noDuplicates || !this.tags.includes(selectedValue)) {\n this.tags = [...this.tags, selectedValue];\n \n\n if (!(selectedOption?.tooltip?.content instanceof Promise)) {\n this.tooltips = [...this.tooltips, tooltipContent];\n }\n \n this.emit('nile-chip-change', { value: this.tags });\n this.resetInput();\n }\n }\n\n private handleRemove(value: string) {\n // Remove the tag from the tags array\n this.tags = this.tags.filter(tag => tag !== value);\n\n if (this.noDuplicates && this.autoCompleteOptions.includes(value)) {\n this.filteredAutoCompleteOptions = [\n ...this.filteredAutoCompleteOptions,\n value,\n ];\n }\n this.emit('nile-chip-change', { value: this.tags });\n }\n\n private handleInputChange(event: CustomEvent<CustomEventDetail>) {\n // Update the input value\n this.inputValue = event.detail.value;\n }\n\n private addChipFromInputValue(): boolean {\n if (this.noDuplicates && this.tags.includes(this.inputValue)) {\n this.emit('nile-duplicates-blocked');\n return false;\n }\n\n this.tags = [...this.tags, this.inputValue];\n if (this.showTooltip) {\n this.tooltips = [...this.tooltips, this.inputValue];\n } else {\n this.tooltips = [...this.tooltips, null];\n }\n\n this.inputValue = '';\n this.visibilityManager?.cleanup();\n this.emit('nile-chip-change', { value: this.tags });\n return true;\n }\n\n private handleInputKeydown(event: KeyboardEvent) {\n if (\n this.enableTagDelete &&\n (event.key === 'Backspace' || event.key === 'Delete') &&\n !this.inputValue &&\n !this.readonly &&\n !this.disabled\n ) {\n if (this.tags.length === 0) {\n this.chipFocusIndex = null;\n return;\n }\n\n event.preventDefault();\n if (this.chipFocusIndex === null) {\n this.chipFocusIndex = this.tags.length - 1;\n this.requestUpdate();\n return;\n }\n const index = this.chipFocusIndex;\n const removedTag = this.tags[index];\n\n this.tags = this.tags.filter((_, i) => i !== index);\n this.tooltips = this.tooltips.filter((_, i) => i !== index);\n\n this.emit('nile-chip-change', { value: this.tags });\n if (this.tags.length > 0) {\n this.chipFocusIndex = Math.max(0, index - 1);\n } else {\n this.chipFocusIndex = null;\n }\n\n return;\n }\n\n if (this.readonly) {\n const allowedKeys = ['ArrowUp', 'ArrowDown', 'Enter', 'Tab'];\n if (!allowedKeys.includes(event.key)) {\n event.preventDefault();\n return;\n }\n }\n\n if (!this.acceptUserInput) {\n return;\n }\n\n if(event.key === 'Tab'){\n event.preventDefault()\n }\n \n if (\n (event.key === 'Enter' || event.key === 'Tab' ) \n && this.inputValue \n && (!this.noDuplicates || !this.tags.includes(this.inputValue))\n ) {\n event.preventDefault()\n this.tags = [...this.tags, this.inputValue];\n if (this.showTooltip) {\n this.tooltips = [...this.tooltips, this.inputValue];\n } else {\n this.tooltips = [...this.tooltips, null];\n }\n \n this.resetInput();\n this.emit('nile-chip-change', { value: this.tags });\n }\n\n if(\n (event.key === 'Enter'|| event.key === 'Tab' ) \n && this.inputValue \n && (this.noDuplicates || this.tags.includes(this.inputValue))\n ){\n this.emit('nile-duplicates-blocked');\n }\n }\n\n private handleFocus() {\n if (this.noAutoComplete) {\n return;\n }\n this.visibilityManager?.setup();\n this.isDropdownOpen = true;\n }\n\n private handleBlur() {\n if (this.isSelectingFromDropdown) return;\n if (this.addOnBlur && this.acceptUserInput && this.inputValue) {\n this.addChipFromInputValue();\n }\n }\n\n onTagsChanged() {\n if (this.noDuplicates)\n this.filteredAutoCompleteOptions = this.filteredAutoCompleteOptions.filter(option => !this.tags.includes(option));\n }\n\n\n private resetInput() {\n // Reset the input-related properties\n this.inputValue = '';\n this.isDropdownOpen = false;\n this.visibilityManager?.cleanup();\n if (!this.noAutoComplete && this.autoComplete) {\n this.autoComplete.value = '';\n this.autoComplete.handleFocus();\n }\n } \n}\n\nexport default NileChip;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-chip': NileChip;\n }\n}\n"],"names":["NileChip","d","this","hasSlotController","HasSlotController","tags","inputValue","isDropdownOpen","tooltips","chipFocusIndex","warning","noAutoComplete","error","success","noDuplicates","label","tagVariant","acceptUserInput","addOnBlur","clearable","placeholder","readonly","disabled","portal","enableVirtualScroll","autoCompleteOptions","filteredAutoCompleteOptions","value","noWrap","loading","errorIndexes","helpText","errorMessage","filterFunction","item","searchedValue","toLowerCase","includes","renderItemFunction","enableVisibilityEffect","enableTabClose","showTooltip","enableTagDelete","openDropdownOnFocus","noDropdownClose","isSelectingFromDropdown","handleDocumentClick","event","path","composedPath","resetDropdownState","addChipFromInputValue","_this","_inherits","_a","_createClass","key","updated","changedProperties","super","has","options","JSON","parse","e","Array","isArray","filter","option","_toConsumableArray","onTagsChanged","_firstUpdated","_asyncToGenerator","_regeneratorRuntime","mark","_callee","_changed","updateComplete","inputTarget","renderRoot","querySelector","_this$renderRoot$quer","input","autoComplete","inputElement","visibilityManager","VisibilityManager","host","target","isOpen","onAnchorOutOfView","emit","visible","reason","onDocumentHidden","detail","_context2","stop","firstUpdated","connectedCallback","document","addEventListener","disconnectedCallback","cleanup","removeEventListener","markDropdownSelectStart","render","hasLabelSlot","test","hasLabel","hasHelpText","hasErrorMessage","html","_templateObject","_taggedTemplateLiteral","classMap","map","tag","index","tooltipContent","isFocused","tagText","toString","tagTemplate","_templateObject2","handleRemove","unsafeHTML","_templateObject3","_templateObject4","handleInputChange","handleInputKeydown","handleFocus","handleBlur","_templateObject5","handleSelect","_templateObject6","_templateObject7","selectedValue","selectedOption","find","opt","name","id","tooltip","content","_s$tooltip2","for","showFor","Promise","currentIndex","length","then","resolved","requestUpdate","concat","resetInput","_this$visibilityManag2","preventDefault","_","i","Math","max","setup","_this$visibilityManag4","get","styles","NileElement","__decorate","state","prototype","query","property","type","Boolean","String","reflect","attribute","_export","customElement"],"mappings":"0paA2BaA,CAAAA,uBAAAA,EAAAA,EAAN,SAAAC,EAAA,uEAKYC,KAAAA,CAAiBC,iBAAAA,CAAG,GAAIC,CAAAA,CACvCF,CAAAA,sBAAAA,CAAAA,KAAAA,EACA,WACA,CAAA,OAAA,CAAA,CAGOA,KAAAA,CAAIG,IAAAA,CAAa,GAEjBH,KAAAA,CAAUI,UAAAA,CAAW,EAErBJ,CAAAA,KAAAA,CAAcK,cAAY,CAAA,CAAA,CAAA,CAC1BL,KAAAA,CAAQM,QAAsB,CAAA,EAAA,CACtBN,KAAAA,CAAcO,cAAAA,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as h,customElement as o}from"lit/decorators.js";import{s as l}from"./nile-chip.css.esm.js";import{classMap as n}from"lit/directives/class-map.js";import{H as r}from"../internal/slot.esm.js";import{N as a}from"../internal/nile-element.esm.js";import{unsafeHTML as p}from"lit/directives/unsafe-html.js";import{V as c}from"../utilities/visibility-manager.esm.js";let d=class extends a{constructor(){super(...arguments),this.hasSlotController=new r(this,"help-text","label"),this.tags=[],this.inputValue="",this.isDropdownOpen=!1,this.tooltips=[],this.chipFocusIndex=null,this.warning=!1,this.noAutoComplete=!1,this.error=!1,this.success=!1,this.noDuplicates=!1,this.label="",this.tagVariant="",this.acceptUserInput=!1,this.addOnBlur=!1,this.clearable=!1,this.placeholder="type here...",this.readonly=!1,this.disabled=!1,this.portal=!1,this.enableVirtualScroll=!1,this.autoCompleteOptions=[],this.filteredAutoCompleteOptions=[],this.value=[],this.noWrap=!1,this.loading=!1,this.errorIndexes=[],this.helpText="",this.errorMessage="",this.filterFunction=(t,i)=>t.toLowerCase().includes(i.toLowerCase()),this.renderItemFunction=t=>t,this.enableVisibilityEffect=!1,this.enableTabClose=!1,this.showTooltip=!1,this.enableTagDelete=!1,this.isSelectingFromDropdown=!1,this.handleDocumentClick=t=>{const i=t.composedPath();this.isSelectingFromDropdown?this.resetDropdownState():i.includes(this)||(this.addOnBlur&&this.acceptUserInput&&this.inputValue&&this.addChipFromInputValue(),this.isDropdownOpen=!1)}}static get styles(){return[l]}resetDropdownState(){this.isSelectingFromDropdown=!1}updated(t){if(super.updated(t),t.has("autoCompleteOptions")){let t=this.autoCompleteOptions;if("string"==typeof t)try{t=JSON.parse(t)}catch(i){t=[]}this.filteredAutoCompleteOptions=Array.isArray(t)?[...t]:[],this.noDuplicates&&(this.filteredAutoCompleteOptions=this.filteredAutoCompleteOptions.filter((t=>!this.value.includes(t))))}t.has("value")&&(this.tags=[...this.value],this.onTagsChanged()),t.has("tags")&&this.onTagsChanged()}async firstUpdated(t){await this.updateComplete;const i=this.noAutoComplete?this.renderRoot.querySelector("nile-input")?.input:this.autoComplete?.inputElement?.input||this.autoComplete?.inputElement;this.visibilityManager=new c({host:this,target:i,enableVisibilityEffect:this.enableVisibilityEffect,enableTabClose:this.enableTabClose,isOpen:()=>this.isDropdownOpen,onAnchorOutOfView:()=>{this.isDropdownOpen=!1,this.autoComplete&&(this.autoComplete.isDropdownOpen=!1),this.emit("nile-visibility-change",{visible:!1,reason:"anchor-out-of-view"})},onDocumentHidden:()=>{this.isDropdownOpen=!1,this.autoComplete&&(this.autoComplete.isDropdownOpen=!1),this.emit("nile-visibility-change",{visible:!1,reason:"document-hidden"})},emit:(t,i)=>this.emit(`nile-${t}`,i)})}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.handleDocumentClick),this.noDuplicates&&(this.filteredAutoCompleteOptions=this.filteredAutoCompleteOptions.filter((t=>!this.value.includes(t)))),this.emit("nile-init")}disconnectedCallback(){super.disconnectedCallback(),this.visibilityManager?.cleanup(),document.removeEventListener("click",this.handleDocumentClick),this.emit("nile-destroy")}markDropdownSelectStart(t){this.isSelectingFromDropdown=!0}render(){const t=this.hasSlotController.test("label");this.hasSlotController.test("help-text");const s=!!this.label||!!t,e=!!this.helpText,h=!!this.errorMessage;return i`
1
+ import{__decorate as t}from"tslib";import{html as i}from"lit";import{state as e,query as s,property as h,customElement as o}from"lit/decorators.js";import{s as l}from"./nile-chip.css.esm.js";import{classMap as n}from"lit/directives/class-map.js";import{H as r}from"../internal/slot.esm.js";import{N as a}from"../internal/nile-element.esm.js";import{unsafeHTML as p}from"lit/directives/unsafe-html.js";import{V as c}from"../utilities/visibility-manager.esm.js";let d=class extends a{constructor(){super(...arguments),this.hasSlotController=new r(this,"help-text","label"),this.tags=[],this.inputValue="",this.isDropdownOpen=!1,this.tooltips=[],this.chipFocusIndex=null,this.warning=!1,this.noAutoComplete=!1,this.error=!1,this.success=!1,this.noDuplicates=!1,this.label="",this.tagVariant="",this.acceptUserInput=!1,this.addOnBlur=!1,this.clearable=!1,this.placeholder="type here...",this.readonly=!1,this.disabled=!1,this.portal=!1,this.enableVirtualScroll=!1,this.autoCompleteOptions=[],this.filteredAutoCompleteOptions=[],this.value=[],this.noWrap=!1,this.loading=!1,this.errorIndexes=[],this.helpText="",this.errorMessage="",this.filterFunction=(t,i)=>t.toLowerCase().includes(i.toLowerCase()),this.renderItemFunction=t=>t,this.enableVisibilityEffect=!1,this.enableTabClose=!1,this.showTooltip=!1,this.enableTagDelete=!1,this.openDropdownOnFocus="true",this.noDropdownClose=!1,this.isSelectingFromDropdown=!1,this.handleDocumentClick=t=>{const i=t.composedPath();this.isSelectingFromDropdown?this.resetDropdownState():i.includes(this)||(this.addOnBlur&&this.acceptUserInput&&this.inputValue&&this.addChipFromInputValue(),this.isDropdownOpen=!1)}}static get styles(){return[l]}resetDropdownState(){this.isSelectingFromDropdown=!1}updated(t){if(super.updated(t),t.has("autoCompleteOptions")){let t=this.autoCompleteOptions;if("string"==typeof t)try{t=JSON.parse(t)}catch(i){t=[]}this.filteredAutoCompleteOptions=Array.isArray(t)?[...t]:[],this.noDuplicates&&(this.filteredAutoCompleteOptions=this.filteredAutoCompleteOptions.filter((t=>!this.value.includes(t))))}t.has("value")&&(this.tags=[...this.value],this.onTagsChanged()),t.has("tags")&&this.onTagsChanged()}async firstUpdated(t){await this.updateComplete;const i=this.noAutoComplete?this.renderRoot.querySelector("nile-input")?.input:this.autoComplete?.inputElement?.input||this.autoComplete?.inputElement;this.visibilityManager=new c({host:this,target:i,enableVisibilityEffect:this.enableVisibilityEffect,enableTabClose:this.enableTabClose,isOpen:()=>this.isDropdownOpen,onAnchorOutOfView:()=>{this.isDropdownOpen=!1,this.autoComplete&&(this.autoComplete.isDropdownOpen=!1),this.emit("nile-visibility-change",{visible:!1,reason:"anchor-out-of-view"})},onDocumentHidden:()=>{this.isDropdownOpen=!1,this.autoComplete&&(this.autoComplete.isDropdownOpen=!1),this.emit("nile-visibility-change",{visible:!1,reason:"document-hidden"})},emit:(t,i)=>this.emit(`nile-${t}`,i)})}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.handleDocumentClick),this.noDuplicates&&(this.filteredAutoCompleteOptions=this.filteredAutoCompleteOptions.filter((t=>!this.value.includes(t)))),this.emit("nile-init")}disconnectedCallback(){super.disconnectedCallback(),this.visibilityManager?.cleanup(),document.removeEventListener("click",this.handleDocumentClick),this.emit("nile-destroy")}markDropdownSelectStart(t){this.isSelectingFromDropdown=!0}render(){const t=this.hasSlotController.test("label");this.hasSlotController.test("help-text");const e=!!this.label||!!t,s=!!this.helpText,h=!!this.errorMessage;return i`
2
2
  <div
3
3
  part="form-control"
4
- class=${n({"form-control":!0,"form-control--medium":!0,"form-control--has-label":s,"form-control--has-help-text":e,"nile-chip--disabled":this.disabled})}
4
+ class=${n({"form-control":!0,"form-control--medium":!0,"form-control--has-label":e,"form-control--has-help-text":s,"nile-chip--disabled":this.disabled})}
5
5
  >
6
6
  <label
7
7
  part="form-control-label"
8
8
  class="form-control__label"
9
9
  for="input"
10
- aria-hidden=${s?"false":"true"}
10
+ aria-hidden=${e?"false":"true"}
11
11
  >
12
12
  <slot name="label">${this.label}</slot>
13
13
  </label>
@@ -16,11 +16,11 @@ import{__decorate as t}from"tslib";import{html as i}from"lit";import{state as s,
16
16
  part='base'
17
17
  class=${n({"nile-chip":!0,"nile-chip--warning":this.warning,"nile-chip--error":this.error,"nile-chip--success":this.success,"nile-chip--no-wrap":this.noWrap,"nile-chip--open":this.isDropdownOpen})}
18
18
  >
19
- ${this.tags.map(((t,s)=>{const e=this.tooltips[s],h=this.enableTagDelete&&this.chipFocusIndex===s;let o="";(t||"number"==typeof t)&&(o=t.toString());const l=i`
19
+ ${this.tags.map(((t,e)=>{const s=this.tooltips[e],h=this.enableTagDelete&&this.chipFocusIndex===e;let o="";(t||"number"==typeof t)&&(o=t.toString());const l=i`
20
20
  <nile-tag
21
21
  class=${n({"nile-chip__tags":!0,"nile-chip__tags--focused":h})}
22
22
  aria-selected=${h?"true":"false"}
23
- .variant=${this.errorIndexes.includes(s)?"error":"normal"}
23
+ .variant=${this.errorIndexes.includes(e)?"error":"normal"}
24
24
  @nile-remove=${()=>this.handleRemove(t)}
25
25
  removable
26
26
  ?pill=${"normal"!==this.tagVariant}
@@ -28,8 +28,8 @@ import{__decorate as t}from"tslib";import{html as i}from"lit";import{state as s,
28
28
  >
29
29
  ${p(o)}
30
30
  </nile-tag>
31
- `;return this.showTooltip&&e?i`
32
- <nile-lite-tooltip allowHTML .content=${e}>
31
+ `;return this.showTooltip&&s?i`
32
+ <nile-lite-tooltip allowHTML .content=${s}>
33
33
  ${l}
34
34
  </nile-lite-tooltip>
35
35
  `:l}))}
@@ -65,7 +65,7 @@ import{__decorate as t}from"tslib";import{html as i}from"lit";import{state as s,
65
65
  .disabled=${this.disabled}
66
66
  .readonly=${this.readonly}
67
67
  .portal=${this.portal}
68
- openOnFocus
68
+ ?openOnFocus=${"true"===this.openDropdownOnFocus}
69
69
  exportparts="options__wrapper, input, base"
70
70
  .placeholder=${this.placeholder}
71
71
  @nile-input=${this.handleInputChange}
@@ -74,16 +74,16 @@ import{__decorate as t}from"tslib";import{html as i}from"lit";import{state as s,
74
74
  @nile-blur=${this.handleBlur}
75
75
  @nile-complete=${this.handleSelect}
76
76
  @mousedown=${this.markDropdownSelectStart}
77
-
77
+ .noDropdownClose=${this.noDropdownClose}
78
78
  ></nile-auto-complete>
79
79
  `}
80
80
  </div>
81
81
  </div>
82
- ${e?i` <nile-form-help-text>${this.helpText}</nile-form-help-text> `:""}
82
+ ${s?i` <nile-form-help-text>${this.helpText}</nile-form-help-text> `:""}
83
83
  ${h?i`
84
84
  <nile-form-error-message
85
85
  >${this.errorMessage}</nile-form-error-message
86
86
  >
87
87
  `:""}
88
88
  </div>
89
- `}handleSelect(t){this.isSelectingFromDropdown=!1,this.resetDropdownState();const i=t.detail.value,s=this.autoCompleteOptions.find((t=>t.name===i||t.id===i));let e=null;if(this.showTooltip)if(s?.tooltip?.content){const{content:t,for:i}=s.tooltip;if(!i||"tag"===i)if(t instanceof Promise){this.tooltips=[...this.tooltips,"Loading..."];const i=this.tooltips.length-1;t.then((t=>{this.tooltips[i]=t,this.requestUpdate()}))}else e=t}else e=s?.name||i;this.noDuplicates&&this.tags.includes(i)||(this.tags=[...this.tags,i],s?.tooltip?.content instanceof Promise||(this.tooltips=[...this.tooltips,e]),this.emit("nile-chip-change",{value:this.tags}),this.resetInput())}handleRemove(t){this.tags=this.tags.filter((i=>i!==t)),this.noDuplicates&&this.autoCompleteOptions.includes(t)&&(this.filteredAutoCompleteOptions=[...this.filteredAutoCompleteOptions,t]),this.emit("nile-chip-change",{value:this.tags})}handleInputChange(t){this.inputValue=t.detail.value}addChipFromInputValue(){return this.noDuplicates&&this.tags.includes(this.inputValue)?(this.emit("nile-duplicates-blocked"),!1):(this.tags=[...this.tags,this.inputValue],this.showTooltip?this.tooltips=[...this.tooltips,this.inputValue]:this.tooltips=[...this.tooltips,null],this.inputValue="",this.visibilityManager?.cleanup(),this.emit("nile-chip-change",{value:this.tags}),!0)}handleInputKeydown(t){if(this.enableTagDelete&&("Backspace"===t.key||"Delete"===t.key)&&!this.inputValue&&!this.readonly&&!this.disabled){if(0===this.tags.length)return void(this.chipFocusIndex=null);if(t.preventDefault(),null===this.chipFocusIndex)return this.chipFocusIndex=this.tags.length-1,void this.requestUpdate();const i=this.chipFocusIndex;return this.tags[i],this.tags=this.tags.filter(((t,s)=>s!==i)),this.tooltips=this.tooltips.filter(((t,s)=>s!==i)),this.emit("nile-chip-change",{value:this.tags}),void(this.tags.length>0?this.chipFocusIndex=Math.max(0,i-1):this.chipFocusIndex=null)}if(this.readonly){if(!["ArrowUp","ArrowDown","Enter","Tab"].includes(t.key))return void t.preventDefault()}this.acceptUserInput&&("Tab"===t.key&&t.preventDefault(),"Enter"!==t.key&&"Tab"!==t.key||!this.inputValue||this.noDuplicates&&this.tags.includes(this.inputValue)||(t.preventDefault(),this.tags=[...this.tags,this.inputValue],this.showTooltip?this.tooltips=[...this.tooltips,this.inputValue]:this.tooltips=[...this.tooltips,null],this.resetInput(),this.emit("nile-chip-change",{value:this.tags})),"Enter"!==t.key&&"Tab"!==t.key||!this.inputValue||!this.noDuplicates&&!this.tags.includes(this.inputValue)||this.emit("nile-duplicates-blocked"))}handleFocus(){this.noAutoComplete||(this.visibilityManager?.setup(),this.isDropdownOpen=!0)}handleBlur(){this.isSelectingFromDropdown||this.addOnBlur&&this.acceptUserInput&&this.inputValue&&this.addChipFromInputValue()}onTagsChanged(){this.noDuplicates&&(this.filteredAutoCompleteOptions=this.filteredAutoCompleteOptions.filter((t=>!this.tags.includes(t))))}resetInput(){this.inputValue="",this.isDropdownOpen=!1,this.visibilityManager?.cleanup(),!this.noAutoComplete&&this.autoComplete&&(this.autoComplete.value="",this.autoComplete.handleFocus())}};t([s()],d.prototype,"tags",void 0),t([s()],d.prototype,"inputValue",void 0),t([s()],d.prototype,"isDropdownOpen",void 0),t([s()],d.prototype,"tooltips",void 0),t([s()],d.prototype,"chipFocusIndex",void 0),t([e("nile-auto-complete")],d.prototype,"autoComplete",void 0),t([h({type:Boolean})],d.prototype,"warning",void 0),t([h({type:Boolean})],d.prototype,"noAutoComplete",void 0),t([h({type:Boolean})],d.prototype,"error",void 0),t([h({type:Boolean})],d.prototype,"success",void 0),t([h({type:Boolean})],d.prototype,"noDuplicates",void 0),t([h()],d.prototype,"label",void 0),t([h({type:String})],d.prototype,"tagVariant",void 0),t([h({type:Boolean})],d.prototype,"acceptUserInput",void 0),t([h({type:Boolean})],d.prototype,"addOnBlur",void 0),t([h({type:Boolean})],d.prototype,"clearable",void 0),t([h()],d.prototype,"placeholder",void 0),t([h({type:Boolean,reflect:!0})],d.prototype,"readonly",void 0),t([h({type:Boolean,reflect:!0})],d.prototype,"disabled",void 0),t([h({type:Boolean,reflect:!0})],d.prototype,"portal",void 0),t([h({type:Boolean})],d.prototype,"enableVirtualScroll",void 0),t([h({type:Array})],d.prototype,"autoCompleteOptions",void 0),t([h({type:Array})],d.prototype,"filteredAutoCompleteOptions",void 0),t([h({type:Array})],d.prototype,"value",void 0),t([h({type:Boolean})],d.prototype,"noWrap",void 0),t([h({type:Boolean})],d.prototype,"loading",void 0),t([h({type:Array})],d.prototype,"errorIndexes",void 0),t([h({attribute:"help-text",reflect:!0})],d.prototype,"helpText",void 0),t([h({attribute:"error-message",reflect:!0})],d.prototype,"errorMessage",void 0),t([h({attribute:!1})],d.prototype,"filterFunction",void 0),t([h({attribute:!1})],d.prototype,"renderItemFunction",void 0),t([h({type:Boolean,reflect:!0})],d.prototype,"enableVisibilityEffect",void 0),t([h({type:Boolean,reflect:!0})],d.prototype,"enableTabClose",void 0),t([h({type:Boolean})],d.prototype,"showTooltip",void 0),t([h({type:Boolean})],d.prototype,"enableTagDelete",void 0),d=t([o("nile-chip")],d);export{d as N};
89
+ `}handleSelect(t){this.isSelectingFromDropdown=!1,this.resetDropdownState();const i=t.detail.value,e=this.autoCompleteOptions.find((t=>t.name===i||t.id===i));let s=null;if(this.showTooltip)if(e?.tooltip?.content){const{content:t,for:i}=e.tooltip;if(!i||"tag"===i)if(t instanceof Promise){this.tooltips=[...this.tooltips,"Loading..."];const i=this.tooltips.length-1;t.then((t=>{this.tooltips[i]=t,this.requestUpdate()}))}else s=t}else s=e?.name||i;this.noDuplicates&&this.tags.includes(i)||(this.tags=[...this.tags,i],e?.tooltip?.content instanceof Promise||(this.tooltips=[...this.tooltips,s]),this.emit("nile-chip-change",{value:this.tags}),this.resetInput())}handleRemove(t){this.tags=this.tags.filter((i=>i!==t)),this.noDuplicates&&this.autoCompleteOptions.includes(t)&&(this.filteredAutoCompleteOptions=[...this.filteredAutoCompleteOptions,t]),this.emit("nile-chip-change",{value:this.tags})}handleInputChange(t){this.inputValue=t.detail.value}addChipFromInputValue(){return this.noDuplicates&&this.tags.includes(this.inputValue)?(this.emit("nile-duplicates-blocked"),!1):(this.tags=[...this.tags,this.inputValue],this.showTooltip?this.tooltips=[...this.tooltips,this.inputValue]:this.tooltips=[...this.tooltips,null],this.inputValue="",this.visibilityManager?.cleanup(),this.emit("nile-chip-change",{value:this.tags}),!0)}handleInputKeydown(t){if(this.enableTagDelete&&("Backspace"===t.key||"Delete"===t.key)&&!this.inputValue&&!this.readonly&&!this.disabled){if(0===this.tags.length)return void(this.chipFocusIndex=null);if(t.preventDefault(),null===this.chipFocusIndex)return this.chipFocusIndex=this.tags.length-1,void this.requestUpdate();const i=this.chipFocusIndex;return this.tags[i],this.tags=this.tags.filter(((t,e)=>e!==i)),this.tooltips=this.tooltips.filter(((t,e)=>e!==i)),this.emit("nile-chip-change",{value:this.tags}),void(this.tags.length>0?this.chipFocusIndex=Math.max(0,i-1):this.chipFocusIndex=null)}if(this.readonly){if(!["ArrowUp","ArrowDown","Enter","Tab"].includes(t.key))return void t.preventDefault()}this.acceptUserInput&&("Tab"===t.key&&t.preventDefault(),"Enter"!==t.key&&"Tab"!==t.key||!this.inputValue||this.noDuplicates&&this.tags.includes(this.inputValue)||(t.preventDefault(),this.tags=[...this.tags,this.inputValue],this.showTooltip?this.tooltips=[...this.tooltips,this.inputValue]:this.tooltips=[...this.tooltips,null],this.resetInput(),this.emit("nile-chip-change",{value:this.tags})),"Enter"!==t.key&&"Tab"!==t.key||!this.inputValue||!this.noDuplicates&&!this.tags.includes(this.inputValue)||this.emit("nile-duplicates-blocked"))}handleFocus(){this.noAutoComplete||(this.visibilityManager?.setup(),this.isDropdownOpen=!0)}handleBlur(){this.isSelectingFromDropdown||this.addOnBlur&&this.acceptUserInput&&this.inputValue&&this.addChipFromInputValue()}onTagsChanged(){this.noDuplicates&&(this.filteredAutoCompleteOptions=this.filteredAutoCompleteOptions.filter((t=>!this.tags.includes(t))))}resetInput(){this.inputValue="",this.isDropdownOpen=!1,this.visibilityManager?.cleanup(),!this.noAutoComplete&&this.autoComplete&&(this.autoComplete.value="",this.autoComplete.handleFocus())}};t([e()],d.prototype,"tags",void 0),t([e()],d.prototype,"inputValue",void 0),t([e()],d.prototype,"isDropdownOpen",void 0),t([e()],d.prototype,"tooltips",void 0),t([e()],d.prototype,"chipFocusIndex",void 0),t([s("nile-auto-complete")],d.prototype,"autoComplete",void 0),t([h({type:Boolean})],d.prototype,"warning",void 0),t([h({type:Boolean})],d.prototype,"noAutoComplete",void 0),t([h({type:Boolean})],d.prototype,"error",void 0),t([h({type:Boolean})],d.prototype,"success",void 0),t([h({type:Boolean})],d.prototype,"noDuplicates",void 0),t([h()],d.prototype,"label",void 0),t([h({type:String})],d.prototype,"tagVariant",void 0),t([h({type:Boolean})],d.prototype,"acceptUserInput",void 0),t([h({type:Boolean})],d.prototype,"addOnBlur",void 0),t([h({type:Boolean})],d.prototype,"clearable",void 0),t([h()],d.prototype,"placeholder",void 0),t([h({type:Boolean,reflect:!0})],d.prototype,"readonly",void 0),t([h({type:Boolean,reflect:!0})],d.prototype,"disabled",void 0),t([h({type:Boolean,reflect:!0})],d.prototype,"portal",void 0),t([h({type:Boolean})],d.prototype,"enableVirtualScroll",void 0),t([h({type:Array})],d.prototype,"autoCompleteOptions",void 0),t([h({type:Array})],d.prototype,"filteredAutoCompleteOptions",void 0),t([h({type:Array})],d.prototype,"value",void 0),t([h({type:Boolean})],d.prototype,"noWrap",void 0),t([h({type:Boolean})],d.prototype,"loading",void 0),t([h({type:Array})],d.prototype,"errorIndexes",void 0),t([h({attribute:"help-text",reflect:!0})],d.prototype,"helpText",void 0),t([h({attribute:"error-message",reflect:!0})],d.prototype,"errorMessage",void 0),t([h({attribute:!1})],d.prototype,"filterFunction",void 0),t([h({attribute:!1})],d.prototype,"renderItemFunction",void 0),t([h({type:Boolean,reflect:!0})],d.prototype,"enableVisibilityEffect",void 0),t([h({type:Boolean,reflect:!0})],d.prototype,"enableTabClose",void 0),t([h({type:Boolean})],d.prototype,"showTooltip",void 0),t([h({type:Boolean})],d.prototype,"enableTagDelete",void 0),t([h({type:String,reflect:!0,attribute:!0})],d.prototype,"openDropdownOnFocus",void 0),t([h({type:Boolean,reflect:!0,attribute:!0})],d.prototype,"noDropdownClose",void 0),d=t([o("nile-chip")],d);export{d as N};
@@ -1,2 +1,2 @@
1
- function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}System.register(["tslib","lit","lit/decorators.js","./nile-dropdown.css.cjs.js","../internal/animate.cjs.js","lit/directives/class-map.js","../utilities/animation-registry.cjs.js","../internal/tabbable.cjs.js","../internal/event.cjs.js","../internal/watch.cjs.js","../internal/nile-element.cjs.js","../nile-popup/nile-popup.cjs.js","./portal-manager.cjs.js","../utilities/visibility-manager.cjs.js","../floating-ui.dom-007bbe96.cjs.js","../nile-popup/nile-popup.css.cjs.js","./portal-utils.cjs.js"],function(_export,_context){"use strict";var t,i,s,e,o,n,h,a,r,l,d,p,c,m,u,f,w,_templateObject,y;function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}));}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */_regeneratorRuntime=function _regeneratorRuntime(){return e;};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value;},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function define(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e];}try{define({},"");}catch(t){define=function define(t,e,r){return t[e]=r;};}function wrap(t,e,r,n){var i=e&&e.prototype instanceof Generator?e:Generator,a=Object.create(i.prototype),c=new Context(n||[]);return o(a,"_invoke",{value:makeInvokeMethod(t,r,c)}),a;}function tryCatch(t,e,r){try{return{type:"normal",arg:t.call(e,r)};}catch(t){return{type:"throw",arg:t};}}e.wrap=wrap;var h="suspendedStart",l="suspendedYield",f="executing",s="completed",y={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var p={};define(p,a,function(){return this;});var d=Object.getPrototypeOf,v=d&&d(d(values([])));v&&v!==r&&n.call(v,a)&&(p=v);var g=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(p);function defineIteratorMethods(t){["next","throw","return"].forEach(function(e){define(t,e,function(t){return this._invoke(e,t);});});}function AsyncIterator(t,e){function invoke(r,o,i,a){var c=tryCatch(t[r],t,o);if("throw"!==c.type){var u=c.arg,h=u.value;return h&&"object"==_typeof(h)&&n.call(h,"__await")?e.resolve(h.__await).then(function(t){invoke("next",t,i,a);},function(t){invoke("throw",t,i,a);}):e.resolve(h).then(function(t){u.value=t,i(u);},function(t){return invoke("throw",t,i,a);});}a(c.arg);}var r;o(this,"_invoke",{value:function value(t,n){function callInvokeWithMethodAndArg(){return new e(function(e,r){invoke(t,n,e,r);});}return r=r?r.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg();}});}function makeInvokeMethod(e,r,n){var o=h;return function(i,a){if(o===f)throw Error("Generator is already running");if(o===s){if("throw"===i)throw a;return{value:t,done:!0};}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=maybeInvokeDelegate(c,n);if(u){if(u===y)continue;return u;}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=s,n.arg;n.dispatchException(n.arg);}else"return"===n.method&&n.abrupt("return",n.arg);o=f;var p=tryCatch(e,r,n);if("normal"===p.type){if(o=n.done?s:l,p.arg===y)continue;return{value:p.arg,done:n.done};}"throw"===p.type&&(o=s,n.method="throw",n.arg=p.arg);}};}function maybeInvokeDelegate(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator["return"]&&(r.method="return",r.arg=t,maybeInvokeDelegate(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var i=tryCatch(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,y;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y);}function pushTryEntry(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e);}function resetTryEntry(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e;}function Context(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(pushTryEntry,this),this.reset(!0);}function values(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function next(){for(;++o<e.length;)if(n.call(e,o))return next.value=e[o],next.done=!1,next;return next.value=t,next.done=!0,next;};return i.next=i;}}throw new TypeError(_typeof(e)+" is not iterable");}return GeneratorFunction.prototype=GeneratorFunctionPrototype,o(g,"constructor",{value:GeneratorFunctionPrototype,configurable:!0}),o(GeneratorFunctionPrototype,"constructor",{value:GeneratorFunction,configurable:!0}),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===GeneratorFunction||"GeneratorFunction"===(e.displayName||e.name));},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,GeneratorFunctionPrototype):(t.__proto__=GeneratorFunctionPrototype,define(t,u,"GeneratorFunction")),t.prototype=Object.create(g),t;},e.awrap=function(t){return{__await:t};},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,c,function(){return this;}),e.AsyncIterator=AsyncIterator,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new AsyncIterator(wrap(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then(function(t){return t.done?t.value:a.next();});},defineIteratorMethods(g),define(g,u,"Generator"),define(g,a,function(){return this;}),define(g,"toString",function(){return"[object Generator]";}),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function next(){for(;r.length;){var t=r.pop();if(t in e)return next.value=t,next.done=!1,next;}return next.done=!0,next;};},e.values=values,Context.prototype={constructor:Context,reset:function reset(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(resetTryEntry),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t);},stop:function stop(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval;},dispatchException:function dispatchException(e){if(this.done)throw e;var r=this;function handle(n,o){return a.type="throw",a.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o;}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return handle("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return handle(i.catchLoc,!0);if(this.prev<i.finallyLoc)return handle(i.finallyLoc);}else if(c){if(this.prev<i.catchLoc)return handle(i.catchLoc,!0);}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return handle(i.finallyLoc);}}}},abrupt:function abrupt(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break;}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(a);},complete:function complete(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y;},finish:function finish(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),resetTryEntry(r),y;}},"catch":function _catch(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;resetTryEntry(r);}return o;}}throw Error("illegal catch attempt");},delegateYield:function delegateYield(e,r,n){return this.delegate={iterator:values(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y;}},e;}function asyncGeneratorStep(n,t,e,r,o,a,c){try{var i=n[a](c),u=i.value;}catch(n){return void e(n);}i.done?t(u):Promise.resolve(u).then(r,o);}function _asyncToGenerator(n){return function(){var t=this,e=arguments;return new Promise(function(r,o){var a=n.apply(t,e);function _next(n){asyncGeneratorStep(a,r,o,_next,_throw,"next",n);}function _throw(n){asyncGeneratorStep(a,r,o,_next,_throw,"throw",n);}_next(void 0);});};}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t);}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _superPropGet(t,o,e,r){var p=_get(_getPrototypeOf(1&r?t.prototype:t),o,e);return 2&r&&"function"==typeof p?function(t){return p.apply(e,t);}:p;}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var p=_superPropBase(e,t);if(p){var n=Object.getOwnPropertyDescriptor(p,t);return n.get?n.get.call(arguments.length<3?e:r):n.value;}},_get.apply(null,arguments);}function _superPropBase(t,o){for(;!{}.hasOwnProperty.call(t,o)&&null!==(t=_getPrototypeOf(t)););return t;}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t);},_getPrototypeOf(t);}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e);}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t;},_setPrototypeOf(t,e);}return{setters:[function(_tslib){t=_tslib.__decorate;},function(_lit){i=_lit.html;},function(_litDecoratorsJs){s=_litDecoratorsJs.query;e=_litDecoratorsJs.property;o=_litDecoratorsJs.customElement;},function(_nileDropdownCssCjsJs){n=_nileDropdownCssCjsJs.s;},function(_internalAnimateCjsJs){h=_internalAnimateCjsJs.s;a=_internalAnimateCjsJs.a;},function(_litDirectivesClassMapJs){r=_litDirectivesClassMapJs.classMap;},function(_utilitiesAnimationRegistryCjsJs){l=_utilitiesAnimationRegistryCjsJs.s;d=_utilitiesAnimationRegistryCjsJs.g;},function(_internalTabbableCjsJs){p=_internalTabbableCjsJs.g;},function(_internalEventCjsJs){c=_internalEventCjsJs.w;},function(_internalWatchCjsJs){m=_internalWatchCjsJs.w;},function(_internalNileElementCjsJs){u=_internalNileElementCjsJs.N;},function(_nilePopupNilePopupCjsJs){},function(_portalManagerCjsJs){f=_portalManagerCjsJs.D;},function(_utilitiesVisibilityManagerCjsJs){w=_utilitiesVisibilityManagerCjsJs.V;},function(_floatingUiDom001CjsJs){},function(_nilePopupNilePopupCssCjsJs){},function(_portalUtilsCjsJs){}],execute:function execute(){_export("N",y=/*#__PURE__*/function(_u){function y(){var _this;_classCallCheck(this,y);_this=_callSuper(this,y,arguments),_this.open=!1,_this.placement="bottom-start",_this.disabled=!1,_this.stayOpenOnSelect=!1,_this.distance=0,_this.noOpenOnClick=!1,_this.skidding=0,_this.hoist=!1,_this.portal=!1,_this.enableVisibilityEffect=!1,_this.enableTabClose=!1,_this.portalManager=null;return _this;}_inherits(y,_u);return _createClass(y,[{key:"connectedCallback",value:function connectedCallback(){var _this2=this;_superPropGet(y,"connectedCallback",this,3)([]),this.handlePanelSelect=this.handlePanelSelect.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleDocumentKeyDown=this.handleDocumentKeyDown.bind(this),this.handleDocumentMouseDown=this.handleDocumentMouseDown.bind(this),this.containingElement||(this.containingElement=this),this.emit("nile-init"),requestAnimationFrame(function(){_this2.portal&&!_this2.portalManager&&(_this2.portalManager=new f(_this2));});}},{key:"firstUpdated",value:function(){var _firstUpdated=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(t){var _this3=this;var i;return _regeneratorRuntime().wrap(function _callee$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:this.panel.hidden=!this.open;this.open&&(this.addOpenListeners(),this.popup.active=!0);_context2.next=4;return this.updateComplete;case 4:i=this.trigger.assignedElements({flatten:!0})[0];this.visibilityManager=new w({host:this,target:i||null,enableVisibilityEffect:this.enableVisibilityEffect,enableTabClose:this.enableTabClose,isOpen:function isOpen(){return _this3.open;},onAnchorOutOfView:function onAnchorOutOfView(){_this3.hide(),_this3.emit("nile-visibility-change",{visible:!1,reason:"anchor-out-of-view"});},onDocumentHidden:function onDocumentHidden(){_this3.hide(),_this3.emit("nile-visibility-change",{visible:!1,reason:"document-hidden"});},emit:function emit(t,i){return _this3.emit("nile-".concat(t),i);}});case 6:case"end":return _context2.stop();}},_callee,this);}));function firstUpdated(_x){return _firstUpdated.apply(this,arguments);}return firstUpdated;}()},{key:"disconnectedCallback",value:function disconnectedCallback(){var _this$visibilityManag;_superPropGet(y,"disconnectedCallback",this,3)([]),(_this$visibilityManag=this.visibilityManager)!==null&&_this$visibilityManag!==void 0&&_this$visibilityManag.cleanup(),this.removeOpenListeners(),this.hide(),this.emit("nile-destroy"),this.portalManager&&(this.portalManager.cleanupPortalAppend(),this.portalManager=null);}},{key:"focusOnTrigger",value:function focusOnTrigger(){var t=this.trigger.assignedElements({flatten:!0})[0];"function"==typeof(t===null||t===void 0?void 0:t.focus)&&t.focus();}},{key:"getMenu",value:function getMenu(){return this.panel.assignedElements({flatten:!0}).find(function(t){return"nile-menu"===t.tagName.toLowerCase();});}},{key:"handleKeyDown",value:function handleKeyDown(t){this.open&&"Escape"===t.key&&(t.stopPropagation(),this.hide(),this.focusOnTrigger());}},{key:"handleDocumentKeyDown",value:function handleDocumentKeyDown(t){var _this4=this;if("Escape"===t.key&&this.open)return t.stopPropagation(),this.focusOnTrigger(),void this.hide();if("Tab"===t.key){var _document$activeEleme;if(this.open&&"nile-menu-item"===((_document$activeEleme=document.activeElement)===null||_document$activeEleme===void 0?void 0:_document$activeEleme.tagName.toLowerCase()))return t.preventDefault(),this.hide(),void this.focusOnTrigger();setTimeout(function(){var _this4$containingElem,_document$activeEleme2,_this4$portalManager;var t=((_this4$containingElem=_this4.containingElement)===null||_this4$containingElem===void 0?void 0:_this4$containingElem.getRootNode())instanceof ShadowRoot?(_document$activeEleme2=document.activeElement)===null||_document$activeEleme2===void 0||(_document$activeEleme2=_document$activeEleme2.shadowRoot)===null||_document$activeEleme2===void 0?void 0:_document$activeEleme2.activeElement:document.activeElement,i=_this4.containingElement&&(t===null||t===void 0?void 0:t.closest(_this4.containingElement.tagName.toLowerCase()))===_this4.containingElement,s=_this4.portal&&((_this4$portalManager=_this4.portalManager)===null||_this4$portalManager===void 0?void 0:_this4$portalManager.portalContainerElement)&&(t===_this4.portalManager.portalContainerElement||(t===null||t===void 0?void 0:t.closest(".nile-dropdown-portal-append"))===_this4.portalManager.portalContainerElement);i||s||_this4.hide();});}}},{key:"handleDocumentMouseDown",value:function handleDocumentMouseDown(t){var _this$portalManager;var i=t.composedPath(),s=this.containingElement&&i.includes(this.containingElement),e=this.portal&&((_this$portalManager=this.portalManager)===null||_this$portalManager===void 0?void 0:_this$portalManager.portalContainerElement)&&i.includes(this.portalManager.portalContainerElement);s||e||this.hide();}},{key:"handlePanelSelect",value:function handlePanelSelect(t){var i=t.target;this.stayOpenOnSelect||"nile-menu"!==i.tagName.toLowerCase()||(this.hide(),this.focusOnTrigger());}},{key:"handleTriggerClick",value:function handleTriggerClick(){this.noOpenOnClick||(this.open?this.hide():(this.show(),this.focusOnTrigger()));}},{key:"handleTriggerKeyDown",value:function handleTriggerKeyDown(t){var i=this.getMenu();if(i){var _s=i.getAllItems(),_e=_s[0],_o=_s[_s.length-1];["ArrowDown","ArrowUp","Home","End"].includes(t.key)&&(t.preventDefault(),this.open||this.show(),_s.length>0&&this.updateComplete.then(function(){"ArrowDown"!==t.key&&"Home"!==t.key||(i.setCurrentItem(_e),_e.focus()),"ArrowUp"!==t.key&&"End"!==t.key||(i.setCurrentItem(_o),_o.focus());}));}}},{key:"handleTriggerKeyUp",value:function handleTriggerKeyUp(t){" "===t.key&&t.preventDefault();}},{key:"handleTriggerSlotChange",value:function handleTriggerSlotChange(){this.updateAccessibleTrigger();}},{key:"updateAccessibleTrigger",value:function updateAccessibleTrigger(){var t=this.trigger.assignedElements({flatten:!0}).find(function(t){return p(t).start;});var i;if(t){switch(t.tagName.toLowerCase()){case"nile-button":case"nile-icon-button":i=t.button;break;default:i=t;}i.setAttribute("aria-haspopup","true"),i.setAttribute("aria-expanded",this.open?"true":"false");}}},{key:"show",value:function(){var _show=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(){return _regeneratorRuntime().wrap(function _callee2$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:if(this.open){_context3.next=2;break;}return _context3.abrupt("return",(this.open=!0,c(this,"nile-after-show")));case 2:case"end":return _context3.stop();}},_callee2,this);}));function show(){return _show.apply(this,arguments);}return show;}()},{key:"hide",value:function(){var _hide=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(){return _regeneratorRuntime().wrap(function _callee3$(_context4){while(1)switch(_context4.prev=_context4.next){case 0:if(!this.open){_context4.next=2;break;}return _context4.abrupt("return",(this.open=!1,c(this,"nile-after-hide")));case 2:case"end":return _context4.stop();}},_callee3,this);}));function hide(){return _hide.apply(this,arguments);}return hide;}()},{key:"reposition",value:function reposition(){this.popup.reposition();}},{key:"addOpenListeners",value:function addOpenListeners(){this.panel.addEventListener("nile-select",this.handlePanelSelect),this.panel.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keydown",this.handleDocumentKeyDown),document.addEventListener("mousedown",this.handleDocumentMouseDown);}},{key:"removeOpenListeners",value:function removeOpenListeners(){this.panel&&(this.panel.removeEventListener("nile-select",this.handlePanelSelect),this.panel.removeEventListener("keydown",this.handleKeyDown)),document.removeEventListener("keydown",this.handleDocumentKeyDown),document.removeEventListener("mousedown",this.handleDocumentMouseDown);}},{key:"updated",value:function updated(t){_superPropGet(y,"updated",this,3)([t]),t.has("portal")&&(this.portal&&!this.portalManager?(this.portalManager=new f(this),this.open&&this.portalManager.setupPortalAppend()):!this.portal&&this.portalManager&&(this.portalManager.cleanupPortalAppend(),this.portalManager=null));}},{key:"handleOpenChange",value:function(){var _handleOpenChange=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(){var _this$visibilityManag2;var _d,_t,_i,_this$visibilityManag3,_d2,_t2,_i2;return _regeneratorRuntime().wrap(function _callee4$(_context5){while(1)switch(_context5.prev=_context5.next){case 0:if(!((_this$visibilityManag2=this.visibilityManager)!==null&&_this$visibilityManag2!==void 0&&_this$visibilityManag2.setup(),this.disabled)){_context5.next=4;break;}this.open=!1;_context5.next=31;break;case 4:if(!(this.updateAccessibleTrigger(),this.open)){_context5.next=18;break;}this.emit("nile-show");this.addOpenListeners();this.portal&&this.portalManager?this.portalManager.setupPortalAppend():this.portal&&!this.portalManager&&(this.portalManager=new f(this),this.portalManager.setupPortalAppend());_context5.next=10;return h(this);case 10:if(this.portal){_context5.next=15;break;}this.panel.hidden=!1,this.popup.active=!0;_d=d(this,"dropdown.show",{dir:""}),_t=_d.keyframes,_i=_d.options;_context5.next=15;return a(this.popup.popup,_t,_i);case 15:this.emit("nile-after-show");_context5.next=31;break;case 18:this.emit("nile-hide");this.removeOpenListeners();(_this$visibilityManag3=this.visibilityManager)!==null&&_this$visibilityManag3!==void 0&&_this$visibilityManag3.cleanup();this.portal&&this.portalManager&&this.portalManager.cleanupPortalAppend();_context5.next=24;return h(this);case 24:if(this.portal){_context5.next=30;break;}_d2=d(this,"dropdown.hide",{dir:""}),_t2=_d2.keyframes,_i2=_d2.options;_context5.next=28;return a(this.popup.popup,_t2,_i2);case 28:this.panel.hidden=!0;this.popup.active=!1;case 30:this.emit("nile-after-hide");case 31:case"end":return _context5.stop();}},_callee4,this);}));function handleOpenChange(){return _handleOpenChange.apply(this,arguments);}return handleOpenChange;}()},{key:"render",value:function render(){return i(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n <nile-popup\n part=\"base\"\n id=\"dropdown\"\n placement=","\n distance=","\n skidding=","\n strategy=","\n sync=","\n flip\n shift\n auto-size=\"both\"\n auto-size-padding=\"10\"\n class=","\n >\n <slot\n name=\"trigger\"\n slot=\"anchor\"\n part=\"trigger\"\n class=\"dropdown__trigger\"\n @click=","\n @keydown=","\n @keyup=","\n @slotchange=","\n ></slot>\n\n <slot\n part=\"panel\"\n class=\"dropdown__panel\"\n aria-hidden=","\n aria-labelledby=\"dropdown\"\n style=","\n ></slot>\n </nile-popup>\n "])),this.placement,this.distance,this.skidding,this.hoist?"fixed":"absolute",this.sync,r({dropdown:!0,"dropdown--open":this.open}),this.handleTriggerClick,this.handleTriggerKeyDown,this.handleTriggerKeyUp,this.handleTriggerSlotChange,this.open?"false":"true",this.portal&&this.portalManager?"display: none;":"");}}]);}(u));y.styles=n,t([s(".dropdown")],y.prototype,"popup",void 0),t([s(".dropdown__trigger")],y.prototype,"trigger",void 0),t([s(".dropdown__panel")],y.prototype,"panel",void 0),t([e({type:Boolean,reflect:!0})],y.prototype,"open",void 0),t([e({reflect:!0})],y.prototype,"placement",void 0),t([e({type:Boolean,reflect:!0})],y.prototype,"disabled",void 0),t([e({attribute:"stay-open-on-select",type:Boolean,reflect:!0})],y.prototype,"stayOpenOnSelect",void 0),t([e({attribute:!1})],y.prototype,"containingElement",void 0),t([e({type:Number})],y.prototype,"distance",void 0),t([e({type:Boolean})],y.prototype,"noOpenOnClick",void 0),t([e({type:Number})],y.prototype,"skidding",void 0),t([e()],y.prototype,"sync",void 0),t([e({type:Boolean})],y.prototype,"hoist",void 0),t([e({type:Boolean,reflect:!0})],y.prototype,"portal",void 0),t([e({type:Boolean,reflect:!0})],y.prototype,"enableVisibilityEffect",void 0),t([e({type:Boolean,reflect:!0})],y.prototype,"enableTabClose",void 0),t([m("open",{waitUntilFirstUpdate:!0})],y.prototype,"handleOpenChange",null),_export("N",y=t([o("nile-dropdown")],y)),l("dropdown.show",{keyframes:[{opacity:0,scale:.9},{opacity:1,scale:1}],options:{duration:100,easing:"ease"}}),l("dropdown.hide",{keyframes:[{opacity:1,scale:1},{opacity:0,scale:.9}],options:{duration:100,easing:"ease"}});}};});
1
+ function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}System.register(["tslib","lit","lit/decorators.js","./nile-dropdown.css.cjs.js","../internal/animate.cjs.js","lit/directives/class-map.js","../utilities/animation-registry.cjs.js","../internal/tabbable.cjs.js","../internal/event.cjs.js","../internal/watch.cjs.js","../internal/nile-element.cjs.js","../nile-popup/nile-popup.cjs.js","./portal-manager.cjs.js","../utilities/visibility-manager.cjs.js","../floating-ui.dom-007bbe96.cjs.js","../nile-popup/nile-popup.css.cjs.js","./portal-utils.cjs.js"],function(_export,_context){"use strict";var t,i,s,e,n,o,h,a,r,l,d,p,c,m,u,f,w,_templateObject,y;function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}));}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */_regeneratorRuntime=function _regeneratorRuntime(){return e;};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value;},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function define(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e];}try{define({},"");}catch(t){define=function define(t,e,r){return t[e]=r;};}function wrap(t,e,r,n){var i=e&&e.prototype instanceof Generator?e:Generator,a=Object.create(i.prototype),c=new Context(n||[]);return o(a,"_invoke",{value:makeInvokeMethod(t,r,c)}),a;}function tryCatch(t,e,r){try{return{type:"normal",arg:t.call(e,r)};}catch(t){return{type:"throw",arg:t};}}e.wrap=wrap;var h="suspendedStart",l="suspendedYield",f="executing",s="completed",y={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var p={};define(p,a,function(){return this;});var d=Object.getPrototypeOf,v=d&&d(d(values([])));v&&v!==r&&n.call(v,a)&&(p=v);var g=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(p);function defineIteratorMethods(t){["next","throw","return"].forEach(function(e){define(t,e,function(t){return this._invoke(e,t);});});}function AsyncIterator(t,e){function invoke(r,o,i,a){var c=tryCatch(t[r],t,o);if("throw"!==c.type){var u=c.arg,h=u.value;return h&&"object"==_typeof(h)&&n.call(h,"__await")?e.resolve(h.__await).then(function(t){invoke("next",t,i,a);},function(t){invoke("throw",t,i,a);}):e.resolve(h).then(function(t){u.value=t,i(u);},function(t){return invoke("throw",t,i,a);});}a(c.arg);}var r;o(this,"_invoke",{value:function value(t,n){function callInvokeWithMethodAndArg(){return new e(function(e,r){invoke(t,n,e,r);});}return r=r?r.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg();}});}function makeInvokeMethod(e,r,n){var o=h;return function(i,a){if(o===f)throw Error("Generator is already running");if(o===s){if("throw"===i)throw a;return{value:t,done:!0};}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=maybeInvokeDelegate(c,n);if(u){if(u===y)continue;return u;}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=s,n.arg;n.dispatchException(n.arg);}else"return"===n.method&&n.abrupt("return",n.arg);o=f;var p=tryCatch(e,r,n);if("normal"===p.type){if(o=n.done?s:l,p.arg===y)continue;return{value:p.arg,done:n.done};}"throw"===p.type&&(o=s,n.method="throw",n.arg=p.arg);}};}function maybeInvokeDelegate(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator["return"]&&(r.method="return",r.arg=t,maybeInvokeDelegate(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var i=tryCatch(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,y;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y);}function pushTryEntry(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e);}function resetTryEntry(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e;}function Context(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(pushTryEntry,this),this.reset(!0);}function values(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function next(){for(;++o<e.length;)if(n.call(e,o))return next.value=e[o],next.done=!1,next;return next.value=t,next.done=!0,next;};return i.next=i;}}throw new TypeError(_typeof(e)+" is not iterable");}return GeneratorFunction.prototype=GeneratorFunctionPrototype,o(g,"constructor",{value:GeneratorFunctionPrototype,configurable:!0}),o(GeneratorFunctionPrototype,"constructor",{value:GeneratorFunction,configurable:!0}),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===GeneratorFunction||"GeneratorFunction"===(e.displayName||e.name));},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,GeneratorFunctionPrototype):(t.__proto__=GeneratorFunctionPrototype,define(t,u,"GeneratorFunction")),t.prototype=Object.create(g),t;},e.awrap=function(t){return{__await:t};},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,c,function(){return this;}),e.AsyncIterator=AsyncIterator,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new AsyncIterator(wrap(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then(function(t){return t.done?t.value:a.next();});},defineIteratorMethods(g),define(g,u,"Generator"),define(g,a,function(){return this;}),define(g,"toString",function(){return"[object Generator]";}),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function next(){for(;r.length;){var t=r.pop();if(t in e)return next.value=t,next.done=!1,next;}return next.done=!0,next;};},e.values=values,Context.prototype={constructor:Context,reset:function reset(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(resetTryEntry),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t);},stop:function stop(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval;},dispatchException:function dispatchException(e){if(this.done)throw e;var r=this;function handle(n,o){return a.type="throw",a.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o;}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return handle("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return handle(i.catchLoc,!0);if(this.prev<i.finallyLoc)return handle(i.finallyLoc);}else if(c){if(this.prev<i.catchLoc)return handle(i.catchLoc,!0);}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return handle(i.finallyLoc);}}}},abrupt:function abrupt(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break;}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(a);},complete:function complete(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y;},finish:function finish(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),resetTryEntry(r),y;}},"catch":function _catch(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;resetTryEntry(r);}return o;}}throw Error("illegal catch attempt");},delegateYield:function delegateYield(e,r,n){return this.delegate={iterator:values(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y;}},e;}function asyncGeneratorStep(n,t,e,r,o,a,c){try{var i=n[a](c),u=i.value;}catch(n){return void e(n);}i.done?t(u):Promise.resolve(u).then(r,o);}function _asyncToGenerator(n){return function(){var t=this,e=arguments;return new Promise(function(r,o){var a=n.apply(t,e);function _next(n){asyncGeneratorStep(a,r,o,_next,_throw,"next",n);}function _throw(n){asyncGeneratorStep(a,r,o,_next,_throw,"throw",n);}_next(void 0);});};}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t);}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _superPropGet(t,o,e,r){var p=_get(_getPrototypeOf(1&r?t.prototype:t),o,e);return 2&r&&"function"==typeof p?function(t){return p.apply(e,t);}:p;}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var p=_superPropBase(e,t);if(p){var n=Object.getOwnPropertyDescriptor(p,t);return n.get?n.get.call(arguments.length<3?e:r):n.value;}},_get.apply(null,arguments);}function _superPropBase(t,o){for(;!{}.hasOwnProperty.call(t,o)&&null!==(t=_getPrototypeOf(t)););return t;}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t);},_getPrototypeOf(t);}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e);}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t;},_setPrototypeOf(t,e);}return{setters:[function(_tslib){t=_tslib.__decorate;},function(_lit){i=_lit.html;},function(_litDecoratorsJs){s=_litDecoratorsJs.query;e=_litDecoratorsJs.property;n=_litDecoratorsJs.customElement;},function(_nileDropdownCssCjsJs){o=_nileDropdownCssCjsJs.s;},function(_internalAnimateCjsJs){h=_internalAnimateCjsJs.s;a=_internalAnimateCjsJs.a;},function(_litDirectivesClassMapJs){r=_litDirectivesClassMapJs.classMap;},function(_utilitiesAnimationRegistryCjsJs){l=_utilitiesAnimationRegistryCjsJs.s;d=_utilitiesAnimationRegistryCjsJs.g;},function(_internalTabbableCjsJs){p=_internalTabbableCjsJs.g;},function(_internalEventCjsJs){c=_internalEventCjsJs.w;},function(_internalWatchCjsJs){m=_internalWatchCjsJs.w;},function(_internalNileElementCjsJs){u=_internalNileElementCjsJs.N;},function(_nilePopupNilePopupCjsJs){},function(_portalManagerCjsJs){f=_portalManagerCjsJs.D;},function(_utilitiesVisibilityManagerCjsJs){w=_utilitiesVisibilityManagerCjsJs.V;},function(_floatingUiDom001CjsJs){},function(_nilePopupNilePopupCssCjsJs){},function(_portalUtilsCjsJs){}],execute:function execute(){_export("N",y=/*#__PURE__*/function(_u){function y(){var _this;_classCallCheck(this,y);_this=_callSuper(this,y,arguments),_this.open=!1,_this.placement="bottom-start",_this.disabled=!1,_this.stayOpenOnSelect=!1,_this.distance=0,_this.noOpenOnClick=!1,_this.skidding=0,_this.hoist=!1,_this.portal=!1,_this.enableVisibilityEffect=!1,_this.enableTabClose=!1,_this.portalManager=null;return _this;}_inherits(y,_u);return _createClass(y,[{key:"connectedCallback",value:function connectedCallback(){var _this2=this;_superPropGet(y,"connectedCallback",this,3)([]),this.handlePanelSelect=this.handlePanelSelect.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleDocumentKeyDown=this.handleDocumentKeyDown.bind(this),this.handleDocumentMouseDown=this.handleDocumentMouseDown.bind(this),this.containingElement||(this.containingElement=this),this.emit("nile-init"),requestAnimationFrame(function(){_this2.portal&&!_this2.portalManager&&(_this2.portalManager=new f(_this2));});}},{key:"firstUpdated",value:function(){var _firstUpdated=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(t){var _this3=this;var i;return _regeneratorRuntime().wrap(function _callee$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:this.panel.hidden=!this.open;this.open&&(this.addOpenListeners(),this.popup.active=!0);_context2.next=4;return this.updateComplete;case 4:i=this.trigger.assignedElements({flatten:!0})[0];this.visibilityManager=new w({host:this,target:i||null,enableVisibilityEffect:this.enableVisibilityEffect,enableTabClose:this.enableTabClose,isOpen:function isOpen(){return _this3.open;},onAnchorOutOfView:function onAnchorOutOfView(){_this3.hide(),_this3.emit("nile-visibility-change",{visible:!1,reason:"anchor-out-of-view"});},onDocumentHidden:function onDocumentHidden(){_this3.hide(),_this3.emit("nile-visibility-change",{visible:!1,reason:"document-hidden"});},emit:function emit(t,i){return _this3.emit("nile-".concat(t),i);}});case 6:case"end":return _context2.stop();}},_callee,this);}));function firstUpdated(_x){return _firstUpdated.apply(this,arguments);}return firstUpdated;}()},{key:"disconnectedCallback",value:function disconnectedCallback(){var _this$visibilityManag;_superPropGet(y,"disconnectedCallback",this,3)([]),(_this$visibilityManag=this.visibilityManager)!==null&&_this$visibilityManag!==void 0&&_this$visibilityManag.cleanup(),this.removeOpenListeners(),this.hide(),this.emit("nile-destroy"),this.portalManager&&(this.portalManager.cleanupPortalAppend(),this.portalManager=null);}},{key:"focusOnTrigger",value:function focusOnTrigger(){var t=this.trigger.assignedElements({flatten:!0})[0];"function"==typeof(t===null||t===void 0?void 0:t.focus)&&t.focus();}},{key:"getMenu",value:function getMenu(){return this.panel.assignedElements({flatten:!0}).find(function(t){return"nile-menu"===t.tagName.toLowerCase();});}},{key:"handleKeyDown",value:function handleKeyDown(t){this.open&&"Escape"===t.key&&(t.stopPropagation(),this.hide(),this.focusOnTrigger());}},{key:"handleDocumentKeyDown",value:function handleDocumentKeyDown(t){var _this4=this;if("Escape"===t.key&&this.open)return t.stopPropagation(),this.focusOnTrigger(),void this.hide();if("Tab"===t.key){var _document$activeEleme;if(this.open&&"nile-menu-item"===((_document$activeEleme=document.activeElement)===null||_document$activeEleme===void 0?void 0:_document$activeEleme.tagName.toLowerCase()))return t.preventDefault(),this.hide(),void this.focusOnTrigger();setTimeout(function(){var _this4$containingElem,_document$activeEleme2,_this4$portalManager;var t=((_this4$containingElem=_this4.containingElement)===null||_this4$containingElem===void 0?void 0:_this4$containingElem.getRootNode())instanceof ShadowRoot?(_document$activeEleme2=document.activeElement)===null||_document$activeEleme2===void 0||(_document$activeEleme2=_document$activeEleme2.shadowRoot)===null||_document$activeEleme2===void 0?void 0:_document$activeEleme2.activeElement:document.activeElement,i=_this4.containingElement&&(t===null||t===void 0?void 0:t.closest(_this4.containingElement.tagName.toLowerCase()))===_this4.containingElement,s=_this4.portal&&((_this4$portalManager=_this4.portalManager)===null||_this4$portalManager===void 0?void 0:_this4$portalManager.portalContainerElement)&&(t===_this4.portalManager.portalContainerElement||(t===null||t===void 0?void 0:t.closest(".nile-dropdown-portal-append"))===_this4.portalManager.portalContainerElement);i||s||_this4.hide();});}}},{key:"handleDocumentMouseDown",value:function handleDocumentMouseDown(t){var _this$portalManager;var i=t.composedPath(),s=this.containingElement&&i.includes(this.containingElement),e=this.portal&&((_this$portalManager=this.portalManager)===null||_this$portalManager===void 0?void 0:_this$portalManager.portalContainerElement)&&i.includes(this.portalManager.portalContainerElement);s||e||this.hide();}},{key:"handlePanelSelect",value:function handlePanelSelect(t){var i=t.target;this.stayOpenOnSelect||"nile-menu"!==i.tagName.toLowerCase()?this.stayOpenOnSelect&&"nile-menu"===i.tagName.toLowerCase()&&(this.show(),this.focusOnTrigger()):(this.hide(),this.focusOnTrigger());}},{key:"handleTriggerClick",value:function handleTriggerClick(){this.noOpenOnClick||(this.open?this.hide():(this.show(),this.focusOnTrigger()));}},{key:"handleTriggerKeyDown",value:function handleTriggerKeyDown(t){var i=this.getMenu();if(i){var _s=i.getAllItems(),_e=_s[0],_n=_s[_s.length-1];["ArrowDown","ArrowUp","Home","End"].includes(t.key)&&(t.preventDefault(),this.open||this.show(),_s.length>0&&this.updateComplete.then(function(){"ArrowDown"!==t.key&&"Home"!==t.key||(i.setCurrentItem(_e),_e.focus()),"ArrowUp"!==t.key&&"End"!==t.key||(i.setCurrentItem(_n),_n.focus());}));}}},{key:"handleTriggerKeyUp",value:function handleTriggerKeyUp(t){" "===t.key&&t.preventDefault();}},{key:"handleTriggerSlotChange",value:function handleTriggerSlotChange(){this.updateAccessibleTrigger();}},{key:"updateAccessibleTrigger",value:function updateAccessibleTrigger(){var t=this.trigger.assignedElements({flatten:!0}).find(function(t){return p(t).start;});var i;if(t){switch(t.tagName.toLowerCase()){case"nile-button":case"nile-icon-button":i=t.button;break;default:i=t;}i.setAttribute("aria-haspopup","true"),i.setAttribute("aria-expanded",this.open?"true":"false");}}},{key:"show",value:function(){var _show=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(){return _regeneratorRuntime().wrap(function _callee2$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:if(this.open){_context3.next=2;break;}return _context3.abrupt("return",(this.open=!0,c(this,"nile-after-show")));case 2:case"end":return _context3.stop();}},_callee2,this);}));function show(){return _show.apply(this,arguments);}return show;}()},{key:"hide",value:function(){var _hide=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(){return _regeneratorRuntime().wrap(function _callee3$(_context4){while(1)switch(_context4.prev=_context4.next){case 0:if(!this.open){_context4.next=2;break;}return _context4.abrupt("return",(this.open=!1,c(this,"nile-after-hide")));case 2:case"end":return _context4.stop();}},_callee3,this);}));function hide(){return _hide.apply(this,arguments);}return hide;}()},{key:"reposition",value:function reposition(){this.popup.reposition();}},{key:"addOpenListeners",value:function addOpenListeners(){this.panel.addEventListener("nile-select",this.handlePanelSelect),this.panel.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keydown",this.handleDocumentKeyDown),document.addEventListener("mousedown",this.handleDocumentMouseDown);}},{key:"removeOpenListeners",value:function removeOpenListeners(){this.panel&&(this.panel.removeEventListener("nile-select",this.handlePanelSelect),this.panel.removeEventListener("keydown",this.handleKeyDown)),document.removeEventListener("keydown",this.handleDocumentKeyDown),document.removeEventListener("mousedown",this.handleDocumentMouseDown);}},{key:"updated",value:function updated(t){_superPropGet(y,"updated",this,3)([t]),t.has("portal")&&(this.portal&&!this.portalManager?(this.portalManager=new f(this),this.open&&this.portalManager.setupPortalAppend()):!this.portal&&this.portalManager&&(this.portalManager.cleanupPortalAppend(),this.portalManager=null));}},{key:"handleOpenChange",value:function(){var _handleOpenChange=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(){var _this$visibilityManag2;var _d,_t,_i,_this$visibilityManag3,_d2,_t2,_i2;return _regeneratorRuntime().wrap(function _callee4$(_context5){while(1)switch(_context5.prev=_context5.next){case 0:if(!((_this$visibilityManag2=this.visibilityManager)!==null&&_this$visibilityManag2!==void 0&&_this$visibilityManag2.setup(),this.disabled)){_context5.next=4;break;}this.open=!1;_context5.next=31;break;case 4:if(!(this.updateAccessibleTrigger(),this.open)){_context5.next=18;break;}this.emit("nile-show");this.addOpenListeners();this.portal&&this.portalManager?this.portalManager.setupPortalAppend():this.portal&&!this.portalManager&&(this.portalManager=new f(this),this.portalManager.setupPortalAppend());_context5.next=10;return h(this);case 10:if(this.portal){_context5.next=15;break;}this.panel.hidden=!1,this.popup.active=!0;_d=d(this,"dropdown.show",{dir:""}),_t=_d.keyframes,_i=_d.options;_context5.next=15;return a(this.popup.popup,_t,_i);case 15:this.emit("nile-after-show");_context5.next=31;break;case 18:this.emit("nile-hide");this.removeOpenListeners();(_this$visibilityManag3=this.visibilityManager)!==null&&_this$visibilityManag3!==void 0&&_this$visibilityManag3.cleanup();this.portal&&this.portalManager&&this.portalManager.cleanupPortalAppend();_context5.next=24;return h(this);case 24:if(this.portal){_context5.next=30;break;}_d2=d(this,"dropdown.hide",{dir:""}),_t2=_d2.keyframes,_i2=_d2.options;_context5.next=28;return a(this.popup.popup,_t2,_i2);case 28:this.panel.hidden=!0;this.popup.active=!1;case 30:this.emit("nile-after-hide");case 31:case"end":return _context5.stop();}},_callee4,this);}));function handleOpenChange(){return _handleOpenChange.apply(this,arguments);}return handleOpenChange;}()},{key:"render",value:function render(){return i(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n <nile-popup\n part=\"base\"\n id=\"dropdown\"\n placement=","\n distance=","\n skidding=","\n strategy=","\n sync=","\n flip\n shift\n auto-size=\"both\"\n auto-size-padding=\"10\"\n class=","\n >\n <slot\n name=\"trigger\"\n slot=\"anchor\"\n part=\"trigger\"\n class=\"dropdown__trigger\"\n @click=","\n @keydown=","\n @keyup=","\n @slotchange=","\n ></slot>\n\n <slot\n part=\"panel\"\n class=\"dropdown__panel\"\n aria-hidden=","\n aria-labelledby=\"dropdown\"\n style=","\n ></slot>\n </nile-popup>\n "])),this.placement,this.distance,this.skidding,this.hoist?"fixed":"absolute",this.sync,r({dropdown:!0,"dropdown--open":this.open}),this.handleTriggerClick,this.handleTriggerKeyDown,this.handleTriggerKeyUp,this.handleTriggerSlotChange,this.open?"false":"true",this.portal&&this.portalManager?"display: none;":"");}}]);}(u));y.styles=o,t([s(".dropdown")],y.prototype,"popup",void 0),t([s(".dropdown__trigger")],y.prototype,"trigger",void 0),t([s(".dropdown__panel")],y.prototype,"panel",void 0),t([e({type:Boolean,reflect:!0})],y.prototype,"open",void 0),t([e({reflect:!0})],y.prototype,"placement",void 0),t([e({type:Boolean,reflect:!0})],y.prototype,"disabled",void 0),t([e({attribute:"stay-open-on-select",type:Boolean,reflect:!0})],y.prototype,"stayOpenOnSelect",void 0),t([e({attribute:!1})],y.prototype,"containingElement",void 0),t([e({type:Number})],y.prototype,"distance",void 0),t([e({type:Boolean})],y.prototype,"noOpenOnClick",void 0),t([e({type:Number})],y.prototype,"skidding",void 0),t([e()],y.prototype,"sync",void 0),t([e({type:Boolean})],y.prototype,"hoist",void 0),t([e({type:Boolean,reflect:!0})],y.prototype,"portal",void 0),t([e({type:Boolean,reflect:!0})],y.prototype,"enableVisibilityEffect",void 0),t([e({type:Boolean,reflect:!0})],y.prototype,"enableTabClose",void 0),t([m("open",{waitUntilFirstUpdate:!0})],y.prototype,"handleOpenChange",null),_export("N",y=t([n("nile-dropdown")],y)),l("dropdown.show",{keyframes:[{opacity:0,scale:.9},{opacity:1,scale:1}],options:{duration:100,easing:"ease"}}),l("dropdown.hide",{keyframes:[{opacity:1,scale:1},{opacity:0,scale:.9}],options:{duration:100,easing:"ease"}});}};});
2
2
  //# sourceMappingURL=nile-dropdown.cjs.js.map