carbon-components-angular 6.0.0-rc.24 → 6.0.0-rc.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/documentation/components/Dropdown.html +44 -44
- package/docs/documentation/components/ProgressIndicator.html +13 -9
- package/docs/documentation/js/search/search_index.js +2 -2
- package/docs/documentation/modules/DocumentationModule/dependencies.svg +4 -4
- package/docs/documentation/modules/DocumentationModule.html +4 -4
- package/docs/documentation/modules/DropdownModule/dependencies.svg +61 -61
- package/docs/documentation/modules/DropdownModule.html +61 -61
- package/docs/documentation/modules/FileUploaderModule/dependencies.svg +4 -4
- package/docs/documentation/modules/FileUploaderModule.html +4 -4
- package/docs/documentation/modules/GridModule/dependencies.svg +4 -4
- package/docs/documentation/modules/GridModule.html +4 -4
- package/docs/documentation/modules/I18nModule/dependencies.svg +13 -13
- package/docs/documentation/modules/I18nModule.html +13 -13
- package/docs/documentation/modules/LayoutModule/dependencies.svg +4 -4
- package/docs/documentation/modules/LayoutModule.html +4 -4
- package/docs/documentation/modules/ListModule/dependencies.svg +4 -4
- package/docs/documentation/modules/ListModule.html +4 -4
- package/docs/documentation/modules/LoadingModule/dependencies.svg +4 -4
- package/docs/documentation/modules/LoadingModule.html +4 -4
- package/docs/documentation/modules/MenuButton/dependencies.svg +4 -4
- package/docs/documentation/modules/MenuButton.html +4 -4
- package/docs/documentation/modules/ModalModule/dependencies.svg +4 -4
- package/docs/documentation/modules/ModalModule.html +4 -4
- package/docs/documentation/modules/NFormsModule/dependencies.svg +4 -4
- package/docs/documentation/modules/NFormsModule.html +4 -4
- package/docs/documentation/modules/NotificationModule/dependencies.svg +4 -4
- package/docs/documentation/modules/NotificationModule.html +4 -4
- package/docs/documentation/modules/PaginationModule/dependencies.svg +4 -4
- package/docs/documentation/modules/PaginationModule.html +4 -4
- package/docs/documentation/modules/PopoverModule/dependencies.svg +4 -4
- package/docs/documentation/modules/PopoverModule.html +4 -4
- package/docs/documentation/modules/ProgressBarModule/dependencies.svg +4 -4
- package/docs/documentation/modules/ProgressBarModule.html +4 -4
- package/docs/documentation/modules/SearchModule/dependencies.svg +4 -4
- package/docs/documentation/modules/SearchModule.html +4 -4
- package/docs/documentation/modules/SelectModule/dependencies.svg +4 -4
- package/docs/documentation/modules/SelectModule.html +4 -4
- package/docs/documentation/modules/SkeletonModule/dependencies.svg +4 -4
- package/docs/documentation/modules/SkeletonModule.html +4 -4
- package/docs/documentation/modules/SliderModule/dependencies.svg +4 -4
- package/docs/documentation/modules/SliderModule.html +4 -4
- package/docs/documentation/modules/TabsModule/dependencies.svg +4 -4
- package/docs/documentation/modules/TabsModule.html +4 -4
- package/docs/documentation/modules/TagModule/dependencies.svg +4 -4
- package/docs/documentation/modules/TagModule.html +4 -4
- package/docs/documentation/modules/ThemeModule/dependencies.svg +4 -4
- package/docs/documentation/modules/ThemeModule.html +4 -4
- package/docs/documentation/modules/TimePickerModule/dependencies.svg +4 -4
- package/docs/documentation/modules/TimePickerModule.html +4 -4
- package/docs/documentation/modules/TimePickerSelectModule/dependencies.svg +4 -4
- package/docs/documentation/modules/TimePickerSelectModule.html +4 -4
- package/docs/documentation/modules/ToggletipModule/dependencies.svg +4 -4
- package/docs/documentation/modules/ToggletipModule.html +4 -4
- package/docs/documentation/modules/TooltipModule/dependencies.svg +4 -4
- package/docs/documentation/modules/TooltipModule.html +4 -4
- package/docs/documentation/modules/UIShellModule/dependencies.svg +4 -4
- package/docs/documentation/modules/UIShellModule.html +4 -4
- package/docs/documentation.json +60 -60
- package/docs/storybook/{8383.ee4c2859.iframe.bundle.js → 8383.ae122023.iframe.bundle.js} +2 -2
- package/docs/storybook/{8383.ee4c2859.iframe.bundle.js.map → 8383.ae122023.iframe.bundle.js.map} +1 -1
- package/docs/storybook/iframe.html +2 -2
- package/docs/storybook/{main.cf934f2c.iframe.bundle.js → main.383af198.iframe.bundle.js} +2 -2
- package/docs/storybook/main.383af198.iframe.bundle.js.map +1 -0
- package/docs/storybook/patterns-dialogs-modal-with-table-stories.e5bc0101.iframe.bundle.js +2 -0
- package/docs/storybook/patterns-dialogs-modal-with-table-stories.e5bc0101.iframe.bundle.js.map +1 -0
- package/docs/storybook/{patterns-forms-multi-step-form-stories.806cd952.iframe.bundle.js → patterns-forms-multi-step-form-stories.4d284816.iframe.bundle.js} +2 -2
- package/docs/storybook/{patterns-forms-multi-step-form-stories.806cd952.iframe.bundle.js.map → patterns-forms-multi-step-form-stories.4d284816.iframe.bundle.js.map} +1 -1
- package/docs/storybook/{patterns-loading-large-loading-stories.7ba92ef7.iframe.bundle.js → patterns-loading-large-loading-stories.9f109d31.iframe.bundle.js} +2 -2
- package/docs/storybook/{patterns-loading-large-loading-stories.7ba92ef7.iframe.bundle.js.map → patterns-loading-large-loading-stories.9f109d31.iframe.bundle.js.map} +1 -1
- package/docs/storybook/{progress-indicator-progress-indicator-stories.16ba479b.iframe.bundle.js → progress-indicator-progress-indicator-stories.bafc7a3e.iframe.bundle.js} +2 -2
- package/docs/storybook/{progress-indicator-progress-indicator-stories.16ba479b.iframe.bundle.js.map → progress-indicator-progress-indicator-stories.bafc7a3e.iframe.bundle.js.map} +1 -1
- package/docs/storybook/project.json +1 -1
- package/docs/storybook/{runtime~main.be0ba4bf.iframe.bundle.js → runtime~main.ec69f997.iframe.bundle.js} +2 -2
- package/docs/storybook/{runtime~main.be0ba4bf.iframe.bundle.js.map → runtime~main.ec69f997.iframe.bundle.js.map} +1 -1
- package/dropdown/index.d.ts +1 -1
- package/fesm2022/carbon-components-angular-dropdown.mjs +4 -4
- package/fesm2022/carbon-components-angular-dropdown.mjs.map +1 -1
- package/fesm2022/carbon-components-angular-progress-indicator.mjs +7 -4
- package/fesm2022/carbon-components-angular-progress-indicator.mjs.map +1 -1
- package/package.json +1 -1
- package/docs/storybook/main.cf934f2c.iframe.bundle.js.map +0 -1
- package/docs/storybook/patterns-dialogs-modal-with-table-stories.f3f802fc.iframe.bundle.js +0 -2
- package/docs/storybook/patterns-dialogs-modal-with-table-stories.f3f802fc.iframe.bundle.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkcarbon_components_angular=self.webpackChunkcarbon_components_angular||[]).push([[8383],{"./src/dropdown/index.ts"(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{Jn:()=>AbstractDropdownView,ms:()=>Dropdown,Q5:()=>DropdownList,kr:()=>DropdownModule,LA:()=>DropdownService});var _staticBlock,tslib_es6=__webpack_require__("./node_modules/tslib/tslib.es6.js"),root_effect_scheduler=__webpack_require__("./node_modules/@angular/core/fesm2022/root_effect_scheduler.mjs"),debug_node=__webpack_require__("./node_modules/@angular/core/fesm2022/debug_node.mjs"),core=__webpack_require__("./node_modules/@angular/core/fesm2022/core.mjs"),fesm2022_forms=__webpack_require__("./node_modules/@angular/forms/fesm2022/forms.mjs"),Subscription=__webpack_require__("./node_modules/rxjs/dist/esm5/internal/Subscription.js"),of=__webpack_require__("./node_modules/rxjs/dist/esm5/internal/observable/of.js"),isUndefined=__webpack_require__("./node_modules/lodash-es/isUndefined.js"),isNull=__webpack_require__("./node_modules/lodash-es/isNull.js");let AbstractDropdownView=(class AbstractDropdownView{constructor(){this.type="single",this.size="md"}set items(value){}get items(){}getNextItem(){}hasNextElement(){}getNextElement(){}getPrevItem(){}hasPrevElement(){}getPrevElement(){}getSelected(){}getCurrentItem(){}getCurrentElement(){}getListItems(){}propagateSelected(value){}filterBy(value){}initFocus(){}onItemsReady(subcription){}reorderSelected(moveFocus){}static#_=_staticBlock=()=>(this.propDecorators={items:[{type:debug_node.pde}],select:[{type:debug_node.k7i}],blurIntent:[{type:debug_node.k7i}]},this)},_staticBlock());AbstractDropdownView=(0,tslib_es6.Cg)([(0,debug_node.WLR)({selector:"[cdsAbstractDropdownView], [ibmAbstractDropdownView]",standalone:!0})],AbstractDropdownView);var dropdown_service_staticBlock,i18n=__webpack_require__("./src/i18n/index.ts"),placeholder=__webpack_require__("./src/placeholder/index.ts"),utils_position=__webpack_require__("./node_modules/@carbon/utils-position/index.js"),utils=__webpack_require__("./src/utils/index.ts");const defaultOffset={top:0,left:0};let DropdownService=(class DropdownService{set offset(value){this._offset=Object.assign({},defaultOffset,value)}get offset(){return this._offset}constructor(){this.placeholderService=(0,root_effect_scheduler.WQX)(placeholder.F2),this.animationFrameService=(0,root_effect_scheduler.WQX)(utils.hK),this.animationFrameSubscription=new Subscription.yU,this._offset=defaultOffset}appendToBody(parentRef,menuRef,classList){menuRef.style.display="block";const dropdownWrapper=document.createElement("div");return dropdownWrapper.className=`dropdown ${classList}`,dropdownWrapper.style.width=parentRef.offsetWidth+"px",dropdownWrapper.style.position="absolute",dropdownWrapper.appendChild(menuRef),this.placeholderService.hasPlaceholderRef()?this.placeholderService.appendElement(dropdownWrapper):document.body.appendChild(dropdownWrapper),this.menuInstance=dropdownWrapper,this.animationFrameSubscription=this.animationFrameService.tick.subscribe(()=>{this.positionDropdown(parentRef,dropdownWrapper)}),this.positionDropdown(parentRef,dropdownWrapper),dropdownWrapper}appendToDropdown(hostRef){if(!this.menuInstance)return;const instance=this.menuInstance,menu=instance.firstElementChild;return this.menuInstance=null,menu.style.display="none",hostRef.appendChild(menu),this.animationFrameSubscription.unsubscribe(),this.placeholderService.hasPlaceholderRef()&&this.placeholderService.hasElement(instance)?this.placeholderService.removeElement(instance):document.body.contains(instance)&&document.body.removeChild(instance),instance}updatePosition(parentRef){this.positionDropdown(parentRef,this.menuInstance)}ngOnDestroy(){this.animationFrameSubscription.unsubscribe()}positionDropdown(parentRef,menuRef){if(!menuRef)return;let leftOffset=0;const boxMenu=menuRef.querySelector(".cds--list-box__menu");if(boxMenu)if(parentRef.getBoundingClientRect().left!==boxMenu.getBoundingClientRect().left){parentRef.getBoundingClientRect().left-boxMenu.getBoundingClientRect().left+boxMenu.getBoundingClientRect().right>(window.innerWidth||document.documentElement.clientWidth)&&(leftOffset=parentRef.offsetWidth-boxMenu.offsetWidth)}else boxMenu.getBoundingClientRect().right>(window.innerWidth||document.documentElement.clientWidth)&&(leftOffset=parentRef.offsetWidth-boxMenu.offsetWidth);const closestMenuWithPos=(0,utils.NX)("position",["relative","fixed","absolute"],menuRef.parentElement),topPos=closestMenuWithPos?-1*closestMenuWithPos.getBoundingClientRect().top:this.offset.top,leftPos=closestMenuWithPos?-1*closestMenuWithPos.getBoundingClientRect().left:this.offset.left+leftOffset;let pos=utils_position.G1.findAbsolute(parentRef,menuRef,"bottom");pos=utils_position.G1.addOffset(pos,topPos,leftPos),utils_position.G1.setElement(menuRef,pos)}static#_=dropdown_service_staticBlock=()=>(this.ctorParameters=()=>[],this)},dropdown_service_staticBlock());DropdownService=(0,tslib_es6.Cg)([(0,debug_node._qm)()],DropdownService);var dropdown_component_staticBlock,Dropdown_1,common_module=__webpack_require__("./node_modules/@angular/common/fesm2022/common_module.mjs"),icon=__webpack_require__("./src/icon/index.ts");let Dropdown=(class Dropdown{get fluidInvalidClass(){return this.invalid&&this.fluid}get fluidFocusClass(){return this.fluid&&this._isFocused&&!this.isOpen}get hasDecorator(){return!!this.decorator}set menuIsClosed(isClosed){this.isOpen=!isClosed,this.changeDetectorRef.markForCheck()}get writtenValue(){return this._writtenValue}set writtenValue(val){val&&0===val.length&&this.clearSelected(),this._writtenValue=val}constructor(){this.i18n=(0,root_effect_scheduler.WQX)(i18n.F2),this.id="dropdown-"+Dropdown_1.dropdownCount++,this.hideLabel=!1,this.placeholder="",this.displayValue="",this.clearText=this.i18n.get().DROPDOWN.CLEAR,this.size="md",this.type="single",this.theme="dark",this.disabled=!1,this.readonly=!1,this.skeleton=!1,this.inline=!1,this.disableArrowKeys=!1,this.invalid=!1,this.warn=!1,this.appendInline=null,this.selectionFeedback="top-after-reopen",this.menuButtonLabel=this.i18n.get().DROPDOWN.OPEN,this.selectedLabel=this.i18n.get().DROPDOWN.SELECTED,this.allowNullValues=!1,this.selected=new debug_node.bkB,this.onClose=new debug_node.bkB,this.close=new debug_node.bkB,this.hostClass=!0,this.hostWrapperClass=!0,this.fluid=!1,this.isOpen=!1,this._dropUp=!1,this.noop=this._noop.bind(this),this.outsideClick=this._outsideClick.bind(this),this.outsideKey=this._outsideKey.bind(this),this.keyboardNav=this._keyboardNav.bind(this),this.elementRef=(0,root_effect_scheduler.WQX)(debug_node.aKT),this.dropdownService=(0,root_effect_scheduler.WQX)(DropdownService),this.elementService=(0,root_effect_scheduler.WQX)(utils.GT),this.changeDetectorRef=(0,root_effect_scheduler.WQX)(core.ChangeDetectorRef),this.visibilitySubscription=new Subscription.yU,this.onTouchedCallback=this._noop,this._isFocused=!1,this._writtenValue=[],this._isUsingNgControl=!1,this.propagateChange=_=>{}}ngOnInit(){this.view&&(this.view.type=this.type)}ngAfterContentInit(){if(!this.view)return;this.view.type=this.type,this.view.size=this.size;const isUpdate=event=>event&&event.isUpdate;this.selectionSubscription=this.view.select.subscribe(event=>{if("single"!==this.type||isUpdate(event)||Array.isArray(event)||(this.closeMenu(),event.item&&event.item.selected?this.itemValueKey?this._propagateChange(event.item[this.itemValueKey]):this._propagateChange(event.item):this._propagateChange(null)),"multi"===this.type&&!isUpdate(event))if(this.itemValueKey&&this.view.getSelected()){const values=this.view.getSelected().map(item=>item[this.itemValueKey]);this._propagateChange(values)}else this._propagateChange(this.view.getSelected());isUpdate(event)?this._isUsingNgControl&&this.writeValue(this.writtenValue):(this.checkForReorder(),this.selected.emit(event))})}ngAfterViewInit(){null===this.appendInline&&(0,utils.fy)(this.elementRef.nativeElement)?this.appendInline=!1:null===this.appendInline&&(this.appendInline=!0),this.checkForReorder()}ngOnDestroy(){this.appendInline||this._appendToDropdown(),this.visibilitySubscription?.unsubscribe(),this.selectionSubscription?.unsubscribe()}writeValue(value){this.writtenValue=value,this.view.onItemsReady(()=>{if((0,isUndefined.A)(value)||(0,isNull.A)(value)&&!this.allowNullValues)this.view.propagateSelected([value]);else if("single"===this.type)if(this.itemValueKey){const newValue=Object.assign({},this.view.getListItems().find(item=>item[this.itemValueKey]===value));newValue.selected=!0,this.view.propagateSelected([newValue])}else this.view.propagateSelected([value]);else if(this.itemValueKey){let newValues=[];for(const v of value)for(const item of this.view.getListItems())item[this.itemValueKey]===v&&newValues.push(Object.assign({},item,{selected:!0}));this.view.propagateSelected(newValues)}else this.view.propagateSelected(value||[value]);this.checkForReorder()})}onBlur(){this.onTouchedCallback()}registerOnChange(fn){this._isUsingNgControl=!0,this.propagateChange=fn}registerOnTouched(fn){this.onTouchedCallback=fn}setDisabledState(isDisabled){this.disabled=isDisabled}onKeyDown(event){if(!this.readonly){if("Escape"===event.key&&this.isOpen&&event.stopImmediatePropagation(),"Escape"===event.key)event.preventDefault(),this.closeMenu(),this.dropdownButton.nativeElement.focus();else if(!this.isOpen&&(" "===event.key||"ArrowDown"===event.key||"ArrowUp"===event.key)){if(this.disableArrowKeys&&("ArrowDown"===event.key||"ArrowUp"===event.key))return;event.preventDefault(),this.openMenu()}this.isOpen&&"Tab"===event.key&&this.dropdownMenu.nativeElement.contains(event.target)&&this.closeMenu(),this.isOpen&&"Tab"===event.key&&event.shiftKey&&this.closeMenu(),"multi"!==this.type&&(this.isOpen||this.closedDropdownNavigation(event))}}closedDropdownNavigation(event){if("ArrowDown"===event.key){event.preventDefault(),this.view.getCurrentItem().selected=!1;let item=this.view.getNextItem();item&&(item.selected=!0)}else if("ArrowUp"===event.key){event.preventDefault(),this.view.getCurrentItem().selected=!1;let item=this.view.getPrevItem();item&&(item.selected=!0)}}getDisplayStringValue(){if(!this.view||this.skeleton)return;let selected=this.view.getSelected();return!selected.length||this.displayValue&&this.isRenderString()?selected.length&&this.isRenderString()?(0,of.of)(this.displayValue):(0,of.of)(this.placeholder):"multi"===this.type?(0,of.of)(this.placeholder):(0,of.of)(selected[0].content)}isRenderString(){return"string"==typeof this.displayValue}getRenderTemplateContext(){if(!this.view)return;let selected=this.view.getSelected();return"multi"===this.type?{items:selected}:selected&&selected.length>0?{item:selected[0]}:{}}getSelectedCount(){if(this.view.getSelected())return this.view.getSelected().length}clearSelected(){if(!this.disabled&&0!==this.getSelectedCount()){for(const item of this.view.getListItems())item.selected=!1;this.selected.emit([]),this._propagateChange([])}}valueSelected(){return!!this.view.getSelected()}_noop(){}_outsideClick(event){this.elementRef.nativeElement.contains(event.target)||this.dropdownMenu.nativeElement.contains(event.target)||this.closeMenu()}_outsideKey(event){this.isOpen&&"Tab"===event.key&&this.dropdownMenu.nativeElement.contains(event.target)&&this.closeMenu()}_keyboardNav(event){"Escape"===event.key&&this.isOpen&&event.stopImmediatePropagation(),"Escape"===event.key?(event.preventDefault(),this.closeMenu(),this.dropdownButton.nativeElement.focus()):this.isOpen&&"Tab"===event.key&&(this.dropdownButton.nativeElement.focus(),this.dropdownButton.nativeElement.dispatchEvent(new KeyboardEvent("keydown",{bubbles:!0,cancelable:!0,key:"Tab"})),this.closeMenu())}_appendToDropdown(){this.dropdownService.appendToDropdown(this.elementRef.nativeElement),this.dropdownMenu.nativeElement.removeEventListener("keydown",this.keyboardNav,!0)}_appendToBody(){const lightClass="light"===this.theme?" cds--list-box--light":"",expandedClass=this.isOpen?" cds--list-box--expanded":"";this.dropdownService.appendToBody(this.dropdownButton.nativeElement,this.dropdownMenu.nativeElement,`${this.elementRef.nativeElement.className}${lightClass}${expandedClass}`),this.dropdownMenu.nativeElement.addEventListener("keydown",this.keyboardNav,!0)}_shouldDropUp(){const menu=this.dropdownMenu&&this.dropdownMenu.nativeElement.querySelector(".cds--list-box__menu"),menuRect=menu&&menu.getBoundingClientRect();if(menu&&menuRect){return(0,utils.db)(menu).reduce((shouldDropUp,parent)=>{const parentRect=parent.getBoundingClientRect(),isBelowParent=!(menuRect.bottom<=parentRect.bottom);return shouldDropUp||isBelowParent},!1)}return!1}openMenu(){if(0!==this.view.getListItems().length){if(this._dropUp=!1,this.isOpen=!0,this.changeDetectorRef.markForCheck(),!this.appendInline){const target=this.dropdownButton.nativeElement,parent=this.elementRef.nativeElement;this.visibilitySubscription=this.elementService.visibility(target,parent).subscribe(value=>{value.visible||this.closeMenu()}),this._appendToBody()}setTimeout(()=>{null!==this.dropUp&&void 0!==this.dropUp||(this._dropUp=this._shouldDropUp())},0),document.body.firstElementChild.addEventListener("click",this.noop,!0),document.body.firstElementChild.addEventListener("keydown",this.noop,!0),document.addEventListener("click",this.outsideClick,!0),document.addEventListener("keydown",this.outsideKey,!0),setTimeout(()=>this.view.initFocus(),0)}}closeMenu(){this.isOpen&&(this.isOpen=!1,this.changeDetectorRef.markForCheck(),this.checkForReorder(),this.onClose.emit(),this.close.emit(),this.dropdownButton.nativeElement.focus(),this.view.disableScroll&&this.view.disableScroll(),this.appendInline||(this.visibilitySubscription.unsubscribe(),this._appendToDropdown()),document.body.firstElementChild.removeEventListener("click",this.noop,!0),document.body.firstElementChild.removeEventListener("keydown",this.noop,!0),document.removeEventListener("click",this.outsideClick,!0),document.removeEventListener("keydown",this.outsideKey,!0))}toggleMenu(){this.isOpen?this.closeMenu():this.openMenu()}isTemplate(value){return value instanceof debug_node.C4Q}handleFocus(event){this._isFocused="focus"===event.type,"blur"===event.type&&this.onBlur()}checkForReorder(){const topAfterReopen=!this.isOpen&&"top-after-reopen"===this.selectionFeedback;"multi"!==this.type||!topAfterReopen&&"top"!==this.selectionFeedback||this.view.reorderSelected()}_propagateChange(value){this.writtenValue=value,this.propagateChange(value)}static#_=dropdown_component_staticBlock=()=>(Dropdown_1=this,this.dropdownCount=0,this.ctorParameters=()=>[],this.propDecorators={fluidInvalidClass:[{type:debug_node.g$6,args:["class.cds--list-box__wrapper--fluid--invalid"]}],fluidFocusClass:[{type:debug_node.g$6,args:["class.cds--list-box__wrapper--fluid--focus"]}],id:[{type:debug_node.pde}],label:[{type:debug_node.pde}],hideLabel:[{type:debug_node.pde}],helperText:[{type:debug_node.pde}],decorator:[{type:debug_node.pde}],placeholder:[{type:debug_node.pde}],displayValue:[{type:debug_node.pde}],clearText:[{type:debug_node.pde}],size:[{type:debug_node.pde}],type:[{type:debug_node.pde}],theme:[{type:debug_node.pde}],disabled:[{type:debug_node.pde}],readonly:[{type:debug_node.pde}],skeleton:[{type:debug_node.pde}],inline:[{type:debug_node.pde}],disableArrowKeys:[{type:debug_node.pde}],invalid:[{type:debug_node.pde}],invalidText:[{type:debug_node.pde}],warn:[{type:debug_node.pde}],warnText:[{type:debug_node.pde}],appendInline:[{type:debug_node.pde}],scrollableContainer:[{type:debug_node.pde}],itemValueKey:[{type:debug_node.pde}],selectionFeedback:[{type:debug_node.pde}],menuButtonLabel:[{type:debug_node.pde}],selectedLabel:[{type:debug_node.pde}],dropUp:[{type:debug_node.pde}],allowNullValues:[{type:debug_node.pde}],selected:[{type:debug_node.k7i}],onClose:[{type:debug_node.k7i}],close:[{type:debug_node.k7i}],view:[{type:core.ContentChild,args:[AbstractDropdownView,{static:!0}]}],dropdownButton:[{type:core.ViewChild,args:["dropdownButton",{static:!0}]}],dropdownMenu:[{type:core.ViewChild,args:["dropdownMenu",{static:!0}]}],hostClass:[{type:debug_node.g$6,args:["class.cds--dropdown__wrapper"]}],hostWrapperClass:[{type:debug_node.g$6,args:["class.cds--list-box__wrapper"]}],hasDecorator:[{type:debug_node.g$6,args:["class.cds--list-box__wrapper--decorator"]}],fluid:[{type:debug_node.g$6,args:["class.cds--list-box__wrapper--fluid"]},{type:debug_node.pde}],isOpen:[{type:debug_node.pde}],onKeyDown:[{type:debug_node.Z$l,args:["keydown",["$event"]]}]},this)},dropdown_component_staticBlock());Dropdown=Dropdown_1=(0,tslib_es6.Cg)([(0,debug_node.uAl)({selector:"cds-dropdown, ibm-dropdown",template:'\n\t\t@if (label && !skeleton) {\n\t\t\t<label\n\t\t\t\t[for]="id"\n\t\t\t\tclass="cds--label"\n\t\t\t\t[ngClass]="{\n\t\t\t\t\t\'cds--label--disabled\': disabled,\n\t\t\t\t\t\'cds--visually-hidden\': hideLabel\n\t\t\t\t}">\n\t\t\t\t@if (!isTemplate(label)) {\n\t\t\t\t\t{{label}}\n\t\t\t\t}\n\t\t\t\t@if (isTemplate(label)) {\n\t\t\t\t\t<ng-template [ngTemplateOutlet]="label"></ng-template>\n\t\t\t\t}\n\t\t\t</label>\n\t\t}\n\t\t<div\n\t\t\tclass="cds--list-box"\n\t\t\t[ngClass]="{\n\t\t\t\t\'cds--dropdown\': type !== \'multi\' && !(skeleton && fluid),\n\t\t\t\t\'cds--multiselect\': type === \'multi\',\n\t\t\t\t\'cds--multi-select--selected\': type === \'multi\' && getSelectedCount() > 0,\n\t\t\t\t\'cds--dropdown--light\': theme === \'light\',\n\t\t\t\t\'cds--list-box--light\': theme === \'light\',\n\t\t\t\t\'cds--list-box--inline\': inline,\n\t\t\t\t\'cds--skeleton\': skeleton,\n\t\t\t\t\'cds--dropdown--disabled cds--list-box--disabled\': disabled,\n\t\t\t\t\'cds--dropdown--readonly\': readonly,\n\t\t\t\t\'cds--dropdown--invalid\': invalid,\n\t\t\t\t\'cds--dropdown--warning cds--list-box--warning\': warn,\n\t\t\t\t\'cds--dropdown--sm cds--list-box--sm\': size === \'sm\',\n\t\t\t\t\'cds--dropdown--md cds--list-box--md\': size === \'md\',\n\t\t\t\t\'cds--dropdown--lg cds--list-box--lg\': size === \'lg\',\n\t\t\t\t\'cds--list-box--expanded\': isOpen,\n\t\t\t\t\'cds--list-box--invalid\': invalid\n\t\t\t}"\n\t\t\t[attr.data-invalid]="invalid ? true : null">\n\t\t\t@if (skeleton && fluid) {\n\t\t\t\t<div class="cds--list-box__label"></div>\n\t\t\t}\n\t\t\t<button\n\t\t\t\t#dropdownButton\n\t\t\t\t[id]="id"\n\t\t\t\ttype="button"\n\t\t\t\tclass="cds--list-box__field"\n\t\t\t\t[ngClass]="{\'a\': isOpen}"\n\t\t\t\t[attr.aria-expanded]="isOpen"\n\t\t\t\t[attr.aria-disabled]="disabled"\n\t\t\t\taria-haspopup="listbox"\n\t\t\t\t(click)="disabled || readonly ? $event.stopPropagation() : toggleMenu()"\n\t\t\t\t(focus)="fluid ? handleFocus($event) : null"\n\t\t\t\t(blur)="fluid ? handleFocus($event) : onBlur()"\n\t\t\t\t[attr.disabled]="disabled ? true : null">\n\t\t\t\t@if (type === \'multi\' && getSelectedCount() > 0) {\n\t\t\t\t\t<div\n\t\t\t\t\t\t(click)="clearSelected()"\n\t\t\t\t\t\t(keydown.enter)="clearSelected()"\n\t\t\t\t\t\tclass="cds--list-box__selection cds--tag--filter cds--list-box__selection--multi"\n\t\t\t\t\t\ttabindex="0"\n\t\t\t\t\t\t[title]="clearText">\n\t\t\t\t\t\t{{getSelectedCount()}}\n\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\tfocusable="false"\n\t\t\t\t\t\t\tpreserveAspectRatio="xMidYMid meet"\n\t\t\t\t\t\t\tstyle="will-change: transform;"\n\t\t\t\t\t\t\trole="img"\n\t\t\t\t\t\t\txmlns="http://www.w3.org/2000/svg"\n\t\t\t\t\t\t\twidth="16"\n\t\t\t\t\t\t\theight="16"\n\t\t\t\t\t\t\tviewBox="0 0 16 16"\n\t\t\t\t\t\t\taria-hidden="true">\n\t\t\t\t\t\t\t<path d="M12 4.7l-.7-.7L8 7.3 4.7 4l-.7.7L7.3 8 4 11.3l.7.7L8 8.7l3.3 3.3.7-.7L8.7 8z"></path>\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t</div>\n\t\t\t\t}\n\t\t\t\t@if (isRenderString()) {\n\t\t\t\t\t<span class="cds--list-box__label">{{getDisplayStringValue() | async}}</span>\n\t\t\t\t}\n\t\t\t\t@if (!isRenderString()) {\n\t\t\t\t\t<ng-template\n\t\t\t\t\t\t[ngTemplateOutletContext]="getRenderTemplateContext()"\n\t\t\t\t\t\t[ngTemplateOutlet]="displayValue">\n\t\t\t\t\t</ng-template>\n\t\t\t\t}\n\t\t\t\t<span class="cds--list-box__menu-icon">\n\t\t\t\t\t@if (!skeleton) {\n\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\tcdsIcon="chevron--down"\n\t\t\t\t\t\t\tsize="16"\n\t\t\t\t\t\t\t[attr.aria-label]="menuButtonLabel"\n\t\t\t\t\t\t\t[ngClass]="{\'cds--list-box__menu-icon--open\': isOpen }">\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t}\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t\t@if (decorator) {\n\t\t\t\t<div class="cds--list-box__inner-wrapper--decorator">\n\t\t\t\t\t<ng-template [ngTemplateOutlet]="decorator"></ng-template>\n\t\t\t\t</div>\n\t\t\t}\n\t\t\t@if (invalid) {\n\t\t\t\t<svg\n\t\t\t\t\tclass="cds--list-box__invalid-icon"\n\t\t\t\t\tcdsIcon="warning--filled"\n\t\t\t\t\tsize="16">\n\t\t\t\t</svg>\n\t\t\t}\n\t\t\t@if (!invalid && warn) {\n\t\t\t\t<svg\n\t\t\t\t\tcdsIcon="warning--alt--filled"\n\t\t\t\t\tsize="16"\n\t\t\t\t\tclass="cds--list-box__invalid-icon cds--list-box__invalid-icon--warning">\n\t\t\t\t</svg>\n\t\t\t}\n\t\t\t<div\n\t\t\t\t#dropdownMenu\n\t\t\t\t[ngClass]="{\n\t\t\t\t\t\'cds--list-box--up\': this.dropUp !== null && this.dropUp !== undefined ? dropUp : _dropUp\n\t\t\t\t}">\n\t\t\t\t@if (isOpen) {\n\t\t\t\t\t<ng-content></ng-content>\n\t\t\t\t}\n\t\t\t</div>\n\t\t</div>\n\t\t@if (fluid) {\n\t\t\t<hr class="cds--list-box__divider" />\n\t\t}\n\t\t@if (helperText && !invalid && !warn && !skeleton && !fluid) {\n\t\t\t<div\n\t\t\t\tclass="cds--form__helper-text"\n\t\t\t\t[ngClass]="{\n\t\t\t\t\t\'cds--form__helper-text--disabled\': disabled\n\t\t\t\t}">\n\t\t\t\t@if (!isTemplate(helperText)) {\n\t\t\t\t\t{{helperText}}\n\t\t\t\t}\n\t\t\t\t@if (isTemplate(helperText)) {\n\t\t\t\t\t<ng-template [ngTemplateOutlet]="helperText"></ng-template>\n\t\t\t\t}\n\t\t\t</div>\n\t\t}\n\t\t@if (invalid) {\n\t\t\t<div class="cds--form-requirement">\n\t\t\t\t@if (!isTemplate(invalidText)) {\n\t\t\t\t\t{{ invalidText }}\n\t\t\t\t}\n\t\t\t\t@if (isTemplate(invalidText)) {\n\t\t\t\t\t<ng-template [ngTemplateOutlet]="invalidText"></ng-template>\n\t\t\t\t}\n\t\t\t</div>\n\t\t}\n\t\t@if (!invalid && warn) {\n\t\t\t<div class="cds--form-requirement">\n\t\t\t\t@if (!isTemplate(warnText)) {\n\t\t\t\t\t{{warnText}}\n\t\t\t\t}\n\t\t\t\t@if (isTemplate(warnText)) {\n\t\t\t\t\t<ng-template [ngTemplateOutlet]="warnText"></ng-template>\n\t\t\t\t}\n\t\t\t</div>\n\t\t}\n\t',providers:[{provide:fesm2022_forms.kq,useExisting:Dropdown,multi:!0},placeholder.F2,utils.hK,utils._B,DropdownService,utils.GT,utils.US],changeDetection:debug_node.Ngq.OnPush,imports:[common_module.YU,common_module.T3,icon.LJ,common_module.Jj]})],Dropdown);var isObservable=__webpack_require__("./node_modules/rxjs/dist/esm5/internal/util/isObservable.js"),Observable=__webpack_require__("./node_modules/rxjs/dist/esm5/internal/Observable.js"),first=__webpack_require__("./node_modules/rxjs/dist/esm5/internal/operators/first.js"),fromEvent=__webpack_require__("./node_modules/rxjs/dist/esm5/internal/observable/fromEvent.js"),debounceTime=__webpack_require__("./node_modules/rxjs/dist/esm5/internal/operators/debounceTime.js"),map=__webpack_require__("./node_modules/rxjs/dist/esm5/internal/operators/map.js"),filter=__webpack_require__("./node_modules/rxjs/dist/esm5/internal/operators/filter.js");var dropdown_list_component_staticBlock,DropdownList_1;let DropdownList=(class DropdownList{set items(value){(0,isObservable.A)(value)?(this._itemsSubscription&&this._itemsSubscription.unsubscribe(),this._itemsReady=new Observable.c(observer=>{this._itemsSubscription=value.subscribe(v=>{this.updateList(v),observer.next(!0),observer.complete()})}),this.onItemsReady(null)):this.updateList(value),this._originalItems=value}get items(){return this._originalItems}constructor(){this.i18n=(0,root_effect_scheduler.WQX)(i18n.F2),this.elementRef=(0,root_effect_scheduler.WQX)(debug_node.aKT),this.ariaLabel=this.i18n.get().DROPDOWN_LIST.LABEL,this.listTpl=null,this.select=new debug_node.bkB,this.scroll=new debug_node.bkB,this.blurIntent=new debug_node.bkB,this.type="single",this.showTitles=!0,this.size="md",this.listId="listbox-"+DropdownList_1.listCount++,this.highlightedItem=null,this.displayItems=[],this.index=-1,this._items=[],this.changeDetectorRef=(0,root_effect_scheduler.WQX)(core.ChangeDetectorRef)}ngAfterViewInit(){this.index=this.getListItems().findIndex(item=>item.selected),this.setupFocusObservable(),setTimeout(()=>{this.doEmitSelect(!0)})}ngOnDestroy(){this.focusJump&&this.focusJump.unsubscribe(),this._itemsSubscription&&this._itemsSubscription.unsubscribe()}doEmitSelect(isUpdate=!0){if("single"===this.type)this.select.emit({item:this._items.find(item=>item.selected),isUpdate});else{const selected=this.getSelected()||[];selected.isUpdate=isUpdate,this.select.emit(selected)}}getItemId(index){return`${this.listId}-${index}`}updateList(items){this._items=items.map(item=>Object.assign({},item)),this.displayItems=this._items,this.updateIndex(),this.setupFocusObservable(),this.doEmitSelect()}filterBy(query=""){query?(this.displayItems=this.getListItems().filter(item=>item.content.toLowerCase().includes(query.toLowerCase())),this.displayItems&&(this.index=0),this.changeDetectorRef.markForCheck()):this.displayItems=this.getListItems(),this.updateIndex()}setupFocusObservable(){if(!this.list)return;this.focusJump&&this.focusJump.unsubscribe();let elList=Array.from(this.list.nativeElement.querySelectorAll("li"));this.focusJump=function watchFocusJump(target,elements){return(0,fromEvent.R)(target,"keydown").pipe((0,debounceTime.B)(150),(0,map.T)(ev=>{let el=elements.find(itemEl=>itemEl.textContent.trim().toLowerCase().startsWith(ev.key));if(el)return el}),(0,filter.p)(el=>!!el))}(this.list.nativeElement,elList).subscribe(el=>{el.focus()})}getNextItem(){return this.index<this.displayItems.length-1&&this.index++,this.displayItems[this.index]}hasNextElement(){return this.index<this.displayItems.length-1&&(!(this.index===this.displayItems.length-2)||!this.displayItems[this.index+1].disabled)}getNextElement(){const elemList=this.listElementList?this.listElementList.toArray():[];if(!elemList.length)return null;for(let i=this.index+1;i<elemList.length;i++)if(!this.displayItems[i].disabled)return this.index=i,elemList[i].nativeElement;return elemList[this.index]?.nativeElement}getPrevItem(){return this.index>0&&this.index--,this.displayItems[this.index]}hasPrevElement(){return this.index>0&&(!(1===this.index)||!this.displayItems[0].disabled)}getPrevElement(){const elemList=this.listElementList?this.listElementList.toArray():[];if(!elemList.length)return null;for(let i=this.index-1;i<this.index&&i>=0;i--)if(!this.displayItems[i].disabled)return this.index=i,elemList[i].nativeElement;return elemList[this.index].nativeElement}getCurrentItem(){return this.index<0?this.displayItems[0]:this.displayItems[this.index]}getCurrentElement(){return this.index<0?this.listElementList.first.nativeElement:this.listElementList.toArray()[this.index].nativeElement}getListItems(){return this._items}getSelected(){let selected=this.getListItems().filter(item=>item.selected);return 0===selected.length?[]:selected}propagateSelected(value){Array.isArray(value)||console.error(`${this.constructor.name}.propagateSelected expects an Array<ListItem>, got ${JSON.stringify(value)}`),this.onItemsReady(()=>{const selectedNewItems=[];for(let newItem of value)if(newItem&&newItem.selected){let tempNewItem=Object.assign({},newItem);delete tempNewItem.selected,tempNewItem=JSON.stringify(tempNewItem),selectedNewItems.push(tempNewItem)}for(let oldItem of this.getListItems()){if(0===selectedNewItems.length){oldItem.selected=!1;continue}let tempOldItem=Object.assign({},oldItem);delete tempOldItem.selected,tempOldItem=JSON.stringify(tempOldItem);for(let selectedNewItem of selectedNewItems){if(tempOldItem.includes(selectedNewItem)){oldItem.selected=!0;break}oldItem.selected=!1}}})}initFocus(){this.index<0&&this.updateIndex(),this.list.nativeElement.focus(),this.highlightedItem=this.getItemId(this.index),this.changeDetectorRef.markForCheck()}updateIndex(){const selected=this.getSelected();selected.length?this.index=this.displayItems.indexOf(selected[0]):this.index<0&&this.hasNextElement()&&this.getNextElement()}navigateList(event){"Enter"===event.key||" "===event.key?(this.listElementList.some(option=>option.nativeElement===event.target)&&event.preventDefault(),"Enter"===event.key&&this.doClick(event,this.getCurrentItem())):"ArrowDown"!==event.key&&"ArrowUp"!==event.key||(event.preventDefault(),"ArrowDown"===event.key?this.hasNextElement()?this.getNextElement()?.scrollIntoView({block:"end"}):this.blurIntent.emit("bottom"):"ArrowUp"===event.key&&(this.hasPrevElement()?this.getPrevElement().scrollIntoView({block:"nearest"}):this.blurIntent.emit("top")),this.highlightedItem=this.getItemId(this.index))}doClick(event,item){if(event.preventDefault(),item&&!item.disabled){if(this.list.nativeElement.focus(),"single"===this.type){item.selected=!0;for(let otherItem of this.getListItems())item!==otherItem&&(otherItem.selected=!1)}else item.selected=!item.selected;this.index=this.displayItems.indexOf(item),this.highlightedItem=this.getItemId(this.index),this.doEmitSelect(!1)}}onItemFocus(index){const element=this.listElementList.toArray()[index].nativeElement;element.classList.add("cds--list-box__menu-item--highlighted"),element.tabIndex=0}onItemBlur(index){const element=this.listElementList.toArray()[index].nativeElement;element.classList.remove("cds--list-box__menu-item--highlighted"),element.tabIndex=-1}emitScroll(event){const customScrollEvent={atTop:0===event.srcElement.scrollTop,atBottom:event.srcElement.scrollHeight-event.srcElement.scrollTop===event.srcElement.clientHeight,event};this.scroll.emit(customScrollEvent)}onItemsReady(subcription){(this._itemsReady||(0,of.of)(!0)).pipe((0,first.$)()).subscribe(subcription)}reorderSelected(moveFocus=!0){this.displayItems=[...this.getSelected(),...this.getListItems().filter(item=>!item.selected)],this.changeDetectorRef.markForCheck(),moveFocus&&setTimeout(()=>{this.updateIndex(),this.highlightedItem=this.getItemId(this.index),this.changeDetectorRef.markForCheck()})}static#_=dropdown_list_component_staticBlock=()=>(DropdownList_1=this,this.listCount=0,this.ctorParameters=()=>[],this.propDecorators={ariaLabel:[{type:debug_node.pde}],items:[{type:debug_node.pde}],listTpl:[{type:debug_node.pde}],select:[{type:debug_node.k7i}],scroll:[{type:debug_node.k7i}],blurIntent:[{type:debug_node.k7i}],list:[{type:core.ViewChild,args:["list",{static:!0}]}],type:[{type:debug_node.pde}],showTitles:[{type:debug_node.pde}],listElementList:[{type:core.ViewChildren,args:["listItem"]}]},this)},dropdown_list_component_staticBlock());var scrollable_list_directive_staticBlock;DropdownList=DropdownList_1=(0,tslib_es6.Cg)([(0,debug_node.uAl)({selector:"cds-dropdown-list, ibm-dropdown-list",template:'\n\t\t<ul\n\t\t\t#list\n\t\t\t[id]="listId"\n\t\t\trole="listbox"\n\t\t\tclass="cds--list-box__menu cds--multi-select"\n\t\t\t(scroll)="emitScroll($event)"\n\t\t\t(keydown)="navigateList($event)"\n\t\t\ttabindex="0"\n\t\t\t[attr.aria-label]="ariaLabel"\n\t\t\t[attr.aria-activedescendant]="highlightedItem">\n\t\t\t@for (item of displayItems; track item; let i = $index) {\n\t\t\t\t<li\n\t\t\t\t\trole="option"\n\t\t\t\t\t(click)="doClick($event, item)"\n\t\t\t\t\tclass="cds--list-box__menu-item"\n\t\t\t\t\t[attr.aria-selected]="item.selected"\n\t\t\t\t\t[id]="getItemId(i)"\n\t\t\t\t\t[attr.tabindex]="highlightedItem === getItemId(i) ? 0 : null"\n\t\t\t\t\t[attr.title]=" showTitles ? item.content : null"\n\t\t\t\t\t[attr.disabled]="item.disabled ? true : null"\n\t\t\t\t\t[ngClass]="{\n\t\t\t\t\t\t\'cds--list-box__menu-item--active\': item.selected,\n\t\t\t\t\t\t\'cds--list-box__menu-item--highlighted\': highlightedItem === getItemId(i)\n\t\t\t\t\t}">\n\t\t\t\t\t<div\n\t\t\t\t\t\t#listItem\n\t\t\t\t\t\ttabindex="-1"\n\t\t\t\t\t\tclass="cds--list-box__menu-item__option">\n\t\t\t\t\t\t@if (!listTpl && type === \'multi\') {\n\t\t\t\t\t\t\t<div class="cds--form-item cds--checkbox-wrapper">\n\t\t\t\t\t\t\t\t<label\n\t\t\t\t\t\t\t\t\t[attr.data-contained-checkbox-state]="item.selected"\n\t\t\t\t\t\t\t\t\tclass="cds--checkbox-label">\n\t\t\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\t\t\tclass="cds--checkbox"\n\t\t\t\t\t\t\t\t\t\ttype="checkbox"\n\t\t\t\t\t\t\t\t\t\t[checked]="item.selected"\n\t\t\t\t\t\t\t\t\t\t[disabled]="item.disabled"\n\t\t\t\t\t\t\t\t\t\ttabindex="-1">\n\t\t\t\t\t\t\t\t\t<span class="cds--checkbox-appearance"></span>\n\t\t\t\t\t\t\t\t\t<span class="cds--checkbox-label-text">{{item.content}}</span>\n\t\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t}\n\t\t\t\t\t\t@if (!listTpl && type === \'single\') {\n\t\t\t\t\t\t\t{{item.content}}\n\t\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\t\tcdsIcon="checkmark"\n\t\t\t\t\t\t\t\tsize="16"\n\t\t\t\t\t\t\t\tclass="cds--list-box__menu-item__selected-icon">\n\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t}\n\t\t\t\t\t\t@if (listTpl) {\n\t\t\t\t\t\t\t<ng-template\n\t\t\t\t\t\t\t\t[ngTemplateOutletContext]="{item: item}"\n\t\t\t\t\t\t\t\t[ngTemplateOutlet]="listTpl">\n\t\t\t\t\t\t\t</ng-template>\n\t\t\t\t\t\t}\n\t\t\t\t\t</div>\n\t\t\t\t</li>\n\t\t\t}\n\t\t</ul>\n\t',providers:[{provide:AbstractDropdownView,useExisting:DropdownList},DropdownService,utils.hK,utils._B],changeDetection:debug_node.Ngq.OnPush,imports:[common_module.YU,icon.LJ,common_module.T3]})],DropdownList);let ScrollableList=(class ScrollableList{constructor(){this.nScrollableList=null,this.scrollEnabled=!0,this.scrollBy=10,this.elementRef=(0,root_effect_scheduler.WQX)(debug_node.aKT),this.canScrollUp=!1,this.canScrollDown=!1,this.list=this.elementRef.nativeElement}ngOnChanges(changes){changes.scrollEnabled&&(changes.scrollEnabled.currentValue?(this.list.style.overflow="hidden",this.scrollUpTarget.style.display="flex",this.scrollDownTarget.style.display="flex",this.canScrollUp=!0,this.canScrollDown=!0,this.updateScrollHeight(),this.checkScrollArrows(),setTimeout(()=>{this.checkScrollArrows()})):(this.scrollUpTarget.style.display="none",this.scrollDownTarget.style.display="none",this.canScrollUp=!1,this.canScrollDown=!1,this.list.style.height=null,this.list.style.overflow=null,clearInterval(this.hoverScrollInterval)))}ngAfterViewInit(){this.nScrollableList&&(this.list=this.elementRef.nativeElement.querySelector(this.nScrollableList)),this.scrollUpTarget.addEventListener("mouseover",()=>this.onHoverUp(!0)),this.scrollUpTarget.addEventListener("mouseout",()=>this.onHoverUp(!1)),this.scrollDownTarget.addEventListener("mouseover",()=>this.onHoverDown(!0)),this.scrollDownTarget.addEventListener("mouseout",()=>this.onHoverDown(!1))}updateScrollHeight(){if(this.scrollEnabled){const containerRect=this.elementRef.nativeElement.parentElement.getBoundingClientRect(),innerHeightDiff=this.list.getBoundingClientRect().top-containerRect.top,height=containerRect.height-(containerRect.bottom-window.innerHeight)-innerHeightDiff-40;this.list.style.height=`${height}px`}}checkScrollArrows(){const scrollUpHeight=this.scrollUpTarget.offsetHeight,scrollDownHeight=this.scrollDownTarget.offsetHeight;0===this.list.scrollTop?(this.canScrollUp&&(this.list.style.height=`${parseInt(this.list.style.height,10)+scrollUpHeight}px`),this.scrollUpTarget.style.display="none",this.canScrollUp=!1):this.list.scrollTop===this.list.scrollTopMax?(this.canScrollDown&&(this.list.style.height=`${parseInt(this.list.style.height,10)+scrollDownHeight}px`),this.scrollDownTarget.style.display="none",this.canScrollDown=!1):(this.canScrollUp||(this.list.style.height=parseInt(this.list.style.height,10)-scrollUpHeight+"px"),this.canScrollDown||(this.list.style.height=parseInt(this.list.style.height,10)-scrollDownHeight+"px"),this.scrollUpTarget.style.display="flex",this.scrollDownTarget.style.display="flex",this.canScrollUp=!0,this.canScrollDown=!0)}onWheel(event){event.deltaY<0?this.list.scrollTop-=this.scrollBy:this.list.scrollTop+=this.scrollBy,this.list.scrollTop!==this.list.scrollTopMax&&0!==this.list.scrollTop&&(event.preventDefault(),event.stopPropagation()),this.checkScrollArrows()}onTouchStart(event){event.touches[0]&&(this.lastTouch=event.touches[0].clientY)}onTouchMove(event){if(event.preventDefault(),event.stopPropagation(),event.touches[0]){const touch=event.touches[0];this.list.scrollTop+=this.lastTouch-touch.clientY,this.lastTouch=touch.clientY,this.checkScrollArrows()}}hoverScrollBy(hovering,amount){hovering?this.hoverScrollInterval=setInterval(()=>{this.list.scrollTop+=amount,this.checkScrollArrows()},1):clearInterval(this.hoverScrollInterval)}onHoverUp(hovering){this.hoverScrollBy(hovering,-3)}onHoverDown(hovering){this.hoverScrollBy(hovering,3)}onKeyDown(event){"ArrowDown"!==event.key&&"ArrowUp"!==event.key||this.checkScrollArrows()}static#_=scrollable_list_directive_staticBlock=()=>(this.ctorParameters=()=>[],this.propDecorators={nScrollableList:[{type:debug_node.pde}],scrollEnabled:[{type:debug_node.pde}],scrollUpTarget:[{type:debug_node.pde}],scrollDownTarget:[{type:debug_node.pde}],scrollBy:[{type:debug_node.pde}],onWheel:[{type:debug_node.Z$l,args:["wheel",["$event"]]}],onTouchStart:[{type:debug_node.Z$l,args:["touchstart",["$event"]]}],onTouchMove:[{type:debug_node.Z$l,args:["touchmove",["$event"]]}],onKeyDown:[{type:debug_node.Z$l,args:["keydown",["$event"]]}]},this)},scrollable_list_directive_staticBlock());ScrollableList=(0,tslib_es6.Cg)([(0,debug_node.WLR)({selector:"[cdsScrollableList], [ibmScrollableList]",exportAs:"scrollable-list",standalone:!0})],ScrollableList);let DropdownModule=class DropdownModule{};DropdownModule=(0,tslib_es6.Cg)([(0,debug_node.UQu)({exports:[Dropdown,DropdownList,ScrollableList,AbstractDropdownView],imports:[common_module.MD,fesm2022_forms.YN,i18n.LP,placeholder.UU,utils.uh,icon.op,Dropdown,DropdownList,ScrollableList,AbstractDropdownView],providers:[DropdownService]})],DropdownModule)}}]);
|
|
2
|
-
//# sourceMappingURL=8383.
|
|
1
|
+
"use strict";(self.webpackChunkcarbon_components_angular=self.webpackChunkcarbon_components_angular||[]).push([[8383],{"./src/dropdown/index.ts"(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{Jn:()=>AbstractDropdownView,ms:()=>Dropdown,Q5:()=>DropdownList,kr:()=>DropdownModule,LA:()=>DropdownService});var _staticBlock,tslib_es6=__webpack_require__("./node_modules/tslib/tslib.es6.js"),root_effect_scheduler=__webpack_require__("./node_modules/@angular/core/fesm2022/root_effect_scheduler.mjs"),debug_node=__webpack_require__("./node_modules/@angular/core/fesm2022/debug_node.mjs"),core=__webpack_require__("./node_modules/@angular/core/fesm2022/core.mjs"),fesm2022_forms=__webpack_require__("./node_modules/@angular/forms/fesm2022/forms.mjs"),Subscription=__webpack_require__("./node_modules/rxjs/dist/esm5/internal/Subscription.js"),of=__webpack_require__("./node_modules/rxjs/dist/esm5/internal/observable/of.js"),isUndefined=__webpack_require__("./node_modules/lodash-es/isUndefined.js"),isNull=__webpack_require__("./node_modules/lodash-es/isNull.js");let AbstractDropdownView=(class AbstractDropdownView{constructor(){this.type="single",this.size="md"}set items(value){}get items(){}getNextItem(){}hasNextElement(){}getNextElement(){}getPrevItem(){}hasPrevElement(){}getPrevElement(){}getSelected(){}getCurrentItem(){}getCurrentElement(){}getListItems(){}propagateSelected(value){}filterBy(value){}initFocus(){}onItemsReady(subcription){}reorderSelected(moveFocus){}static#_=_staticBlock=()=>(this.propDecorators={items:[{type:debug_node.pde}],select:[{type:debug_node.k7i}],blurIntent:[{type:debug_node.k7i}]},this)},_staticBlock());AbstractDropdownView=(0,tslib_es6.Cg)([(0,debug_node.WLR)({selector:"[cdsAbstractDropdownView], [ibmAbstractDropdownView]",standalone:!0})],AbstractDropdownView);var dropdown_service_staticBlock,i18n=__webpack_require__("./src/i18n/index.ts"),placeholder=__webpack_require__("./src/placeholder/index.ts"),utils_position=__webpack_require__("./node_modules/@carbon/utils-position/index.js"),utils=__webpack_require__("./src/utils/index.ts");const defaultOffset={top:0,left:0};let DropdownService=(class DropdownService{set offset(value){this._offset=Object.assign({},defaultOffset,value)}get offset(){return this._offset}constructor(){this.placeholderService=(0,root_effect_scheduler.WQX)(placeholder.F2),this.animationFrameService=(0,root_effect_scheduler.WQX)(utils.hK),this.animationFrameSubscription=new Subscription.yU,this._offset=defaultOffset}appendToBody(parentRef,menuRef,classList){menuRef.style.display="block";const dropdownWrapper=document.createElement("div");return dropdownWrapper.className=`dropdown ${classList}`,dropdownWrapper.style.width=parentRef.offsetWidth+"px",dropdownWrapper.style.position="absolute",dropdownWrapper.appendChild(menuRef),this.placeholderService.hasPlaceholderRef()?this.placeholderService.appendElement(dropdownWrapper):document.body.appendChild(dropdownWrapper),this.menuInstance=dropdownWrapper,this.animationFrameSubscription=this.animationFrameService.tick.subscribe(()=>{this.positionDropdown(parentRef,dropdownWrapper)}),this.positionDropdown(parentRef,dropdownWrapper),dropdownWrapper}appendToDropdown(hostRef){if(!this.menuInstance)return;const instance=this.menuInstance,menu=instance.firstElementChild;return this.menuInstance=null,menu.style.display="none",hostRef.appendChild(menu),this.animationFrameSubscription.unsubscribe(),this.placeholderService.hasPlaceholderRef()&&this.placeholderService.hasElement(instance)?this.placeholderService.removeElement(instance):document.body.contains(instance)&&document.body.removeChild(instance),instance}updatePosition(parentRef){this.positionDropdown(parentRef,this.menuInstance)}ngOnDestroy(){this.animationFrameSubscription.unsubscribe()}positionDropdown(parentRef,menuRef){if(!menuRef)return;let leftOffset=0;const boxMenu=menuRef.querySelector(".cds--list-box__menu");if(boxMenu)if(parentRef.getBoundingClientRect().left!==boxMenu.getBoundingClientRect().left){parentRef.getBoundingClientRect().left-boxMenu.getBoundingClientRect().left+boxMenu.getBoundingClientRect().right>(window.innerWidth||document.documentElement.clientWidth)&&(leftOffset=parentRef.offsetWidth-boxMenu.offsetWidth)}else boxMenu.getBoundingClientRect().right>(window.innerWidth||document.documentElement.clientWidth)&&(leftOffset=parentRef.offsetWidth-boxMenu.offsetWidth);const closestMenuWithPos=(0,utils.NX)("position",["relative","fixed","absolute"],menuRef.parentElement),topPos=closestMenuWithPos?-1*closestMenuWithPos.getBoundingClientRect().top:this.offset.top,leftPos=closestMenuWithPos?-1*closestMenuWithPos.getBoundingClientRect().left:this.offset.left+leftOffset;let pos=utils_position.G1.findAbsolute(parentRef,menuRef,"bottom");pos=utils_position.G1.addOffset(pos,topPos,leftPos),utils_position.G1.setElement(menuRef,pos)}static#_=dropdown_service_staticBlock=()=>(this.ctorParameters=()=>[],this)},dropdown_service_staticBlock());DropdownService=(0,tslib_es6.Cg)([(0,debug_node._qm)()],DropdownService);var dropdown_component_staticBlock,Dropdown_1,common_module=__webpack_require__("./node_modules/@angular/common/fesm2022/common_module.mjs"),icon=__webpack_require__("./src/icon/index.ts");let Dropdown=(class Dropdown{get fluidInvalidClass(){return this.invalid&&this.fluid}get fluidFocusClass(){return this.fluid&&this._isFocused&&!this.isOpen}get hasDecorator(){return!!this.decorator}set menuIsClosed(isClosed){this.isOpen=!isClosed,this.changeDetectorRef.markForCheck()}get writtenValue(){return this._writtenValue}set writtenValue(val){val&&0===val.length&&this.clearSelected(),this._writtenValue=val}constructor(){this.i18n=(0,root_effect_scheduler.WQX)(i18n.F2),this.id="dropdown-"+Dropdown_1.dropdownCount++,this.hideLabel=!1,this.placeholder="",this.displayValue="",this.clearText=this.i18n.get().DROPDOWN.CLEAR,this.size="md",this.type="single",this.theme="dark",this.disabled=!1,this.readonly=!1,this.skeleton=!1,this.inline=!1,this.disableArrowKeys=!1,this.invalid=!1,this.warn=!1,this.appendInline=null,this.selectionFeedback="top-after-reopen",this.menuButtonLabel=this.i18n.get().DROPDOWN.OPEN,this.selectedLabel=this.i18n.get().DROPDOWN.SELECTED,this.allowNullValues=!1,this.selected=new debug_node.bkB,this.onClose=new debug_node.bkB,this.close=new debug_node.bkB,this.hostClass=!0,this.hostWrapperClass=!0,this.fluid=!1,this.isOpen=!1,this._dropUp=!1,this.noop=this._noop.bind(this),this.outsideClick=this._outsideClick.bind(this),this.outsideKey=this._outsideKey.bind(this),this.keyboardNav=this._keyboardNav.bind(this),this.elementRef=(0,root_effect_scheduler.WQX)(debug_node.aKT),this.dropdownService=(0,root_effect_scheduler.WQX)(DropdownService),this.elementService=(0,root_effect_scheduler.WQX)(utils.GT),this.changeDetectorRef=(0,root_effect_scheduler.WQX)(core.ChangeDetectorRef),this.visibilitySubscription=new Subscription.yU,this.onTouchedCallback=this._noop,this._isFocused=!1,this._writtenValue=[],this._isUsingNgControl=!1,this.propagateChange=_=>{}}ngOnInit(){this.view&&(this.view.type=this.type)}ngAfterContentInit(){if(!this.view)return;this.view.type=this.type,this.view.size=this.size;const isUpdate=event=>event&&event.isUpdate;this.selectionSubscription=this.view.select.subscribe(event=>{if("single"!==this.type||isUpdate(event)||Array.isArray(event)||(this.closeMenu(),event.item&&event.item.selected?this.itemValueKey?this._propagateChange(event.item[this.itemValueKey]):this._propagateChange(event.item):this._propagateChange(null)),"multi"===this.type&&!isUpdate(event))if(this.itemValueKey&&this.view.getSelected()){const values=this.view.getSelected().map(item=>item[this.itemValueKey]);this._propagateChange(values)}else this._propagateChange(this.view.getSelected());isUpdate(event)?this._isUsingNgControl&&this.writeValue(this.writtenValue):(this.checkForReorder(),this.selected.emit(event))})}ngAfterViewInit(){null===this.appendInline&&(0,utils.fy)(this.elementRef.nativeElement)?this.appendInline=!1:null===this.appendInline&&(this.appendInline=!0),this.checkForReorder()}ngOnDestroy(){this.appendInline||this._appendToDropdown(),this.visibilitySubscription?.unsubscribe(),this.selectionSubscription?.unsubscribe()}writeValue(value){this.writtenValue=value,this.view.onItemsReady(()=>{if((0,isUndefined.A)(value)||(0,isNull.A)(value)&&!this.allowNullValues)this.view.propagateSelected([value]);else if("single"===this.type)if(this.itemValueKey){const newValue=Object.assign({},this.view.getListItems().find(item=>item[this.itemValueKey]===value));newValue.selected=!0,this.view.propagateSelected([newValue])}else this.view.propagateSelected([value]);else if(this.itemValueKey){let newValues=[];for(const v of value)for(const item of this.view.getListItems())item[this.itemValueKey]===v&&newValues.push(Object.assign({},item,{selected:!0}));this.view.propagateSelected(newValues)}else this.view.propagateSelected(value||[value]);this.checkForReorder()})}onBlur(){this.onTouchedCallback()}registerOnChange(fn){this._isUsingNgControl=!0,this.propagateChange=fn}registerOnTouched(fn){this.onTouchedCallback=fn}setDisabledState(isDisabled){this.disabled=isDisabled}onKeyDown(event){if(!this.readonly){if("Escape"===event.key&&this.isOpen&&event.stopImmediatePropagation(),"Escape"===event.key)event.preventDefault(),this.closeMenu(),this.dropdownButton.nativeElement.focus();else if(!this.isOpen&&(" "===event.key||"ArrowDown"===event.key||"ArrowUp"===event.key)){if(this.disableArrowKeys&&("ArrowDown"===event.key||"ArrowUp"===event.key))return;event.preventDefault(),this.openMenu()}this.isOpen&&"Tab"===event.key&&this.dropdownMenu.nativeElement.contains(event.target)&&this.closeMenu(),this.isOpen&&"Tab"===event.key&&event.shiftKey&&this.closeMenu(),"multi"!==this.type&&(this.isOpen||this.closedDropdownNavigation(event))}}closedDropdownNavigation(event){if("ArrowDown"===event.key){event.preventDefault(),this.view.getCurrentItem().selected=!1;let item=this.view.getNextItem();item&&(item.selected=!0)}else if("ArrowUp"===event.key){event.preventDefault(),this.view.getCurrentItem().selected=!1;let item=this.view.getPrevItem();item&&(item.selected=!0)}}getDisplayStringValue(){if(!this.view||this.skeleton)return;let selected=this.view.getSelected();return!selected.length||this.displayValue&&this.isRenderString()?selected.length&&this.isRenderString()?(0,of.of)(this.displayValue):(0,of.of)(this.placeholder):"multi"===this.type?(0,of.of)(this.placeholder):(0,of.of)(selected[0].content)}isRenderString(){return"string"==typeof this.displayValue}getRenderTemplateContext(){if(!this.view)return;let selected=this.view.getSelected();return"multi"===this.type?{items:selected}:selected&&selected.length>0?{item:selected[0]}:{}}getSelectedCount(){if(this.view.getSelected())return this.view.getSelected().length}clearSelected(){if(!this.disabled&&0!==this.getSelectedCount()){for(const item of this.view.getListItems())item.selected=!1;this.selected.emit([]),this._propagateChange([])}}valueSelected(){return!!this.view.getSelected()}_noop(){}_outsideClick(event){this.elementRef.nativeElement.contains(event.target)||this.dropdownMenu.nativeElement.contains(event.target)||this.closeMenu()}_outsideKey(event){this.isOpen&&"Tab"===event.key&&this.dropdownMenu.nativeElement.contains(event.target)&&this.closeMenu()}_keyboardNav(event){"Escape"===event.key&&this.isOpen&&event.stopImmediatePropagation(),"Escape"===event.key?(event.preventDefault(),this.closeMenu(),this.dropdownButton.nativeElement.focus()):this.isOpen&&"Tab"===event.key&&(this.dropdownButton.nativeElement.focus(),this.dropdownButton.nativeElement.dispatchEvent(new KeyboardEvent("keydown",{bubbles:!0,cancelable:!0,key:"Tab"})),this.closeMenu())}_appendToDropdown(){this.dropdownService.appendToDropdown(this.elementRef.nativeElement),this.dropdownMenu.nativeElement.removeEventListener("keydown",this.keyboardNav,!0)}_appendToBody(){const lightClass="light"===this.theme?" cds--list-box--light":"",expandedClass=this.isOpen?" cds--list-box--expanded":"";this.dropdownService.appendToBody(this.dropdownButton.nativeElement,this.dropdownMenu.nativeElement,`${this.elementRef.nativeElement.className}${lightClass}${expandedClass}`),this.dropdownMenu.nativeElement.addEventListener("keydown",this.keyboardNav,!0)}_shouldDropUp(){const menu=this.dropdownMenu&&this.dropdownMenu.nativeElement.querySelector(".cds--list-box__menu"),menuRect=menu&&menu.getBoundingClientRect();if(menu&&menuRect){return(0,utils.db)(menu).reduce((shouldDropUp,parent)=>{const parentRect=parent.getBoundingClientRect(),isBelowParent=!(menuRect.bottom<=parentRect.bottom);return shouldDropUp||isBelowParent},!1)}return!1}openMenu(){if(0!==this.view.getListItems().length){if(this._dropUp=!1,this.isOpen=!0,this.changeDetectorRef.markForCheck(),!this.appendInline){const target=this.dropdownButton.nativeElement,parent=this.elementRef.nativeElement;this.visibilitySubscription=this.elementService.visibility(target,parent).subscribe(value=>{value.visible||this.closeMenu()}),this._appendToBody()}setTimeout(()=>{null!==this.dropUp&&void 0!==this.dropUp||(this._dropUp=this._shouldDropUp())},0),document.body.firstElementChild.addEventListener("click",this.noop,!0),document.body.firstElementChild.addEventListener("keydown",this.noop,!0),document.addEventListener("click",this.outsideClick,!0),document.addEventListener("keydown",this.outsideKey,!0),setTimeout(()=>this.view.initFocus(),0)}}closeMenu(){this.isOpen&&(this.isOpen=!1,this.changeDetectorRef.markForCheck(),this.checkForReorder(),this.onClose.emit(),this.close.emit(),this.dropdownButton.nativeElement.focus(),this.view.disableScroll&&this.view.disableScroll(),this.appendInline||(this.visibilitySubscription.unsubscribe(),this._appendToDropdown()),document.body.firstElementChild.removeEventListener("click",this.noop,!0),document.body.firstElementChild.removeEventListener("keydown",this.noop,!0),document.removeEventListener("click",this.outsideClick,!0),document.removeEventListener("keydown",this.outsideKey,!0))}toggleMenu(){this.isOpen?this.closeMenu():this.openMenu()}isTemplate(value){return value instanceof debug_node.C4Q}handleFocus(event){this._isFocused="focus"===event.type,"blur"===event.type&&this.onBlur()}checkForReorder(){const topAfterReopen=!this.isOpen&&"top-after-reopen"===this.selectionFeedback;"multi"!==this.type||!topAfterReopen&&"top"!==this.selectionFeedback||this.view.reorderSelected()}_propagateChange(value){this.writtenValue=value,this.propagateChange(value)}static#_=dropdown_component_staticBlock=()=>(Dropdown_1=this,this.dropdownCount=0,this.ctorParameters=()=>[],this.propDecorators={fluidInvalidClass:[{type:debug_node.g$6,args:["class.cds--list-box__wrapper--fluid--invalid"]}],fluidFocusClass:[{type:debug_node.g$6,args:["class.cds--list-box__wrapper--fluid--focus"]}],hasDecorator:[{type:debug_node.g$6,args:["class.cds--list-box__wrapper--decorator"]}],id:[{type:debug_node.pde}],label:[{type:debug_node.pde}],hideLabel:[{type:debug_node.pde}],helperText:[{type:debug_node.pde}],decorator:[{type:debug_node.pde}],placeholder:[{type:debug_node.pde}],displayValue:[{type:debug_node.pde}],clearText:[{type:debug_node.pde}],size:[{type:debug_node.pde}],type:[{type:debug_node.pde}],theme:[{type:debug_node.pde}],disabled:[{type:debug_node.pde}],readonly:[{type:debug_node.pde}],skeleton:[{type:debug_node.pde}],inline:[{type:debug_node.pde}],disableArrowKeys:[{type:debug_node.pde}],invalid:[{type:debug_node.pde}],invalidText:[{type:debug_node.pde}],warn:[{type:debug_node.pde}],warnText:[{type:debug_node.pde}],appendInline:[{type:debug_node.pde}],scrollableContainer:[{type:debug_node.pde}],itemValueKey:[{type:debug_node.pde}],selectionFeedback:[{type:debug_node.pde}],menuButtonLabel:[{type:debug_node.pde}],selectedLabel:[{type:debug_node.pde}],dropUp:[{type:debug_node.pde}],allowNullValues:[{type:debug_node.pde}],selected:[{type:debug_node.k7i}],onClose:[{type:debug_node.k7i}],close:[{type:debug_node.k7i}],view:[{type:core.ContentChild,args:[AbstractDropdownView,{static:!0}]}],dropdownButton:[{type:core.ViewChild,args:["dropdownButton",{static:!0}]}],dropdownMenu:[{type:core.ViewChild,args:["dropdownMenu",{static:!0}]}],hostClass:[{type:debug_node.g$6,args:["class.cds--dropdown__wrapper"]}],hostWrapperClass:[{type:debug_node.g$6,args:["class.cds--list-box__wrapper"]}],fluid:[{type:debug_node.g$6,args:["class.cds--list-box__wrapper--fluid"]},{type:debug_node.pde}],isOpen:[{type:debug_node.pde}],onKeyDown:[{type:debug_node.Z$l,args:["keydown",["$event"]]}]},this)},dropdown_component_staticBlock());Dropdown=Dropdown_1=(0,tslib_es6.Cg)([(0,debug_node.uAl)({selector:"cds-dropdown, ibm-dropdown",template:'\n\t\t@if (label && !skeleton) {\n\t\t\t<label\n\t\t\t\t[for]="id"\n\t\t\t\tclass="cds--label"\n\t\t\t\t[ngClass]="{\n\t\t\t\t\t\'cds--label--disabled\': disabled,\n\t\t\t\t\t\'cds--visually-hidden\': hideLabel\n\t\t\t\t}">\n\t\t\t\t@if (!isTemplate(label)) {\n\t\t\t\t\t{{label}}\n\t\t\t\t}\n\t\t\t\t@if (isTemplate(label)) {\n\t\t\t\t\t<ng-template [ngTemplateOutlet]="label"></ng-template>\n\t\t\t\t}\n\t\t\t</label>\n\t\t}\n\t\t<div\n\t\t\tclass="cds--list-box"\n\t\t\t[ngClass]="{\n\t\t\t\t\'cds--dropdown\': type !== \'multi\' && !(skeleton && fluid),\n\t\t\t\t\'cds--multiselect\': type === \'multi\',\n\t\t\t\t\'cds--multi-select--selected\': type === \'multi\' && getSelectedCount() > 0,\n\t\t\t\t\'cds--dropdown--light\': theme === \'light\',\n\t\t\t\t\'cds--list-box--light\': theme === \'light\',\n\t\t\t\t\'cds--list-box--inline\': inline,\n\t\t\t\t\'cds--skeleton\': skeleton,\n\t\t\t\t\'cds--dropdown--disabled cds--list-box--disabled\': disabled,\n\t\t\t\t\'cds--dropdown--readonly\': readonly,\n\t\t\t\t\'cds--dropdown--invalid\': invalid,\n\t\t\t\t\'cds--dropdown--warning cds--list-box--warning\': warn,\n\t\t\t\t\'cds--dropdown--sm cds--list-box--sm\': size === \'sm\',\n\t\t\t\t\'cds--dropdown--md cds--list-box--md\': size === \'md\',\n\t\t\t\t\'cds--dropdown--lg cds--list-box--lg\': size === \'lg\',\n\t\t\t\t\'cds--list-box--expanded\': isOpen,\n\t\t\t\t\'cds--list-box--invalid\': invalid\n\t\t\t}"\n\t\t\t[attr.data-invalid]="invalid ? true : null">\n\t\t\t@if (skeleton && fluid) {\n\t\t\t\t<div class="cds--list-box__label"></div>\n\t\t\t}\n\t\t\t<button\n\t\t\t\t#dropdownButton\n\t\t\t\t[id]="id"\n\t\t\t\ttype="button"\n\t\t\t\tclass="cds--list-box__field"\n\t\t\t\t[ngClass]="{\'a\': isOpen}"\n\t\t\t\t[attr.aria-expanded]="isOpen"\n\t\t\t\t[attr.aria-disabled]="disabled"\n\t\t\t\taria-haspopup="listbox"\n\t\t\t\t(click)="disabled || readonly ? $event.stopPropagation() : toggleMenu()"\n\t\t\t\t(focus)="fluid ? handleFocus($event) : null"\n\t\t\t\t(blur)="fluid ? handleFocus($event) : onBlur()"\n\t\t\t\t[attr.disabled]="disabled ? true : null">\n\t\t\t\t@if (type === \'multi\' && getSelectedCount() > 0) {\n\t\t\t\t\t<div\n\t\t\t\t\t\t(click)="clearSelected()"\n\t\t\t\t\t\t(keydown.enter)="clearSelected()"\n\t\t\t\t\t\tclass="cds--list-box__selection cds--tag--filter cds--list-box__selection--multi"\n\t\t\t\t\t\ttabindex="0"\n\t\t\t\t\t\t[title]="clearText">\n\t\t\t\t\t\t{{getSelectedCount()}}\n\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\tfocusable="false"\n\t\t\t\t\t\t\tpreserveAspectRatio="xMidYMid meet"\n\t\t\t\t\t\t\tstyle="will-change: transform;"\n\t\t\t\t\t\t\trole="img"\n\t\t\t\t\t\t\txmlns="http://www.w3.org/2000/svg"\n\t\t\t\t\t\t\twidth="16"\n\t\t\t\t\t\t\theight="16"\n\t\t\t\t\t\t\tviewBox="0 0 16 16"\n\t\t\t\t\t\t\taria-hidden="true">\n\t\t\t\t\t\t\t<path d="M12 4.7l-.7-.7L8 7.3 4.7 4l-.7.7L7.3 8 4 11.3l.7.7L8 8.7l3.3 3.3.7-.7L8.7 8z"></path>\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t</div>\n\t\t\t\t}\n\t\t\t\t@if (isRenderString()) {\n\t\t\t\t\t<span class="cds--list-box__label">{{getDisplayStringValue() | async}}</span>\n\t\t\t\t}\n\t\t\t\t@if (!isRenderString()) {\n\t\t\t\t\t<ng-template\n\t\t\t\t\t\t[ngTemplateOutletContext]="getRenderTemplateContext()"\n\t\t\t\t\t\t[ngTemplateOutlet]="displayValue">\n\t\t\t\t\t</ng-template>\n\t\t\t\t}\n\t\t\t\t<span class="cds--list-box__menu-icon">\n\t\t\t\t\t@if (!skeleton) {\n\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\tcdsIcon="chevron--down"\n\t\t\t\t\t\t\tsize="16"\n\t\t\t\t\t\t\t[attr.aria-label]="menuButtonLabel"\n\t\t\t\t\t\t\t[ngClass]="{\'cds--list-box__menu-icon--open\': isOpen }">\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t}\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t\t@if (decorator) {\n\t\t\t\t<div class="cds--list-box__inner-wrapper--decorator">\n\t\t\t\t\t<ng-template [ngTemplateOutlet]="decorator"></ng-template>\n\t\t\t\t</div>\n\t\t\t}\n\t\t\t@if (invalid) {\n\t\t\t\t<svg\n\t\t\t\t\tclass="cds--list-box__invalid-icon"\n\t\t\t\t\tcdsIcon="warning--filled"\n\t\t\t\t\tsize="16">\n\t\t\t\t</svg>\n\t\t\t}\n\t\t\t@if (!invalid && warn) {\n\t\t\t\t<svg\n\t\t\t\t\tcdsIcon="warning--alt--filled"\n\t\t\t\t\tsize="16"\n\t\t\t\t\tclass="cds--list-box__invalid-icon cds--list-box__invalid-icon--warning">\n\t\t\t\t</svg>\n\t\t\t}\n\t\t\t<div\n\t\t\t\t#dropdownMenu\n\t\t\t\t[ngClass]="{\n\t\t\t\t\t\'cds--list-box--up\': this.dropUp !== null && this.dropUp !== undefined ? dropUp : _dropUp\n\t\t\t\t}">\n\t\t\t\t@if (isOpen) {\n\t\t\t\t\t<ng-content></ng-content>\n\t\t\t\t}\n\t\t\t</div>\n\t\t</div>\n\t\t@if (fluid) {\n\t\t\t<hr class="cds--list-box__divider" />\n\t\t}\n\t\t@if (helperText && !invalid && !warn && !skeleton && !fluid) {\n\t\t\t<div\n\t\t\t\tclass="cds--form__helper-text"\n\t\t\t\t[ngClass]="{\n\t\t\t\t\t\'cds--form__helper-text--disabled\': disabled\n\t\t\t\t}">\n\t\t\t\t@if (!isTemplate(helperText)) {\n\t\t\t\t\t{{helperText}}\n\t\t\t\t}\n\t\t\t\t@if (isTemplate(helperText)) {\n\t\t\t\t\t<ng-template [ngTemplateOutlet]="helperText"></ng-template>\n\t\t\t\t}\n\t\t\t</div>\n\t\t}\n\t\t@if (invalid) {\n\t\t\t<div class="cds--form-requirement">\n\t\t\t\t@if (!isTemplate(invalidText)) {\n\t\t\t\t\t{{ invalidText }}\n\t\t\t\t}\n\t\t\t\t@if (isTemplate(invalidText)) {\n\t\t\t\t\t<ng-template [ngTemplateOutlet]="invalidText"></ng-template>\n\t\t\t\t}\n\t\t\t</div>\n\t\t}\n\t\t@if (!invalid && warn) {\n\t\t\t<div class="cds--form-requirement">\n\t\t\t\t@if (!isTemplate(warnText)) {\n\t\t\t\t\t{{warnText}}\n\t\t\t\t}\n\t\t\t\t@if (isTemplate(warnText)) {\n\t\t\t\t\t<ng-template [ngTemplateOutlet]="warnText"></ng-template>\n\t\t\t\t}\n\t\t\t</div>\n\t\t}\n\t',providers:[{provide:fesm2022_forms.kq,useExisting:Dropdown,multi:!0},placeholder.F2,utils.hK,utils._B,DropdownService,utils.GT,utils.US],changeDetection:debug_node.Ngq.OnPush,imports:[common_module.YU,common_module.T3,icon.LJ,common_module.Jj]})],Dropdown);var isObservable=__webpack_require__("./node_modules/rxjs/dist/esm5/internal/util/isObservable.js"),Observable=__webpack_require__("./node_modules/rxjs/dist/esm5/internal/Observable.js"),first=__webpack_require__("./node_modules/rxjs/dist/esm5/internal/operators/first.js"),fromEvent=__webpack_require__("./node_modules/rxjs/dist/esm5/internal/observable/fromEvent.js"),debounceTime=__webpack_require__("./node_modules/rxjs/dist/esm5/internal/operators/debounceTime.js"),map=__webpack_require__("./node_modules/rxjs/dist/esm5/internal/operators/map.js"),filter=__webpack_require__("./node_modules/rxjs/dist/esm5/internal/operators/filter.js");var dropdown_list_component_staticBlock,DropdownList_1;let DropdownList=(class DropdownList{set items(value){(0,isObservable.A)(value)?(this._itemsSubscription&&this._itemsSubscription.unsubscribe(),this._itemsReady=new Observable.c(observer=>{this._itemsSubscription=value.subscribe(v=>{this.updateList(v),observer.next(!0),observer.complete()})}),this.onItemsReady(null)):this.updateList(value),this._originalItems=value}get items(){return this._originalItems}constructor(){this.i18n=(0,root_effect_scheduler.WQX)(i18n.F2),this.elementRef=(0,root_effect_scheduler.WQX)(debug_node.aKT),this.ariaLabel=this.i18n.get().DROPDOWN_LIST.LABEL,this.listTpl=null,this.select=new debug_node.bkB,this.scroll=new debug_node.bkB,this.blurIntent=new debug_node.bkB,this.type="single",this.showTitles=!0,this.size="md",this.listId="listbox-"+DropdownList_1.listCount++,this.highlightedItem=null,this.displayItems=[],this.index=-1,this._items=[],this.changeDetectorRef=(0,root_effect_scheduler.WQX)(core.ChangeDetectorRef)}ngAfterViewInit(){this.index=this.getListItems().findIndex(item=>item.selected),this.setupFocusObservable(),setTimeout(()=>{this.doEmitSelect(!0)})}ngOnDestroy(){this.focusJump&&this.focusJump.unsubscribe(),this._itemsSubscription&&this._itemsSubscription.unsubscribe()}doEmitSelect(isUpdate=!0){if("single"===this.type)this.select.emit({item:this._items.find(item=>item.selected),isUpdate});else{const selected=this.getSelected()||[];selected.isUpdate=isUpdate,this.select.emit(selected)}}getItemId(index){return`${this.listId}-${index}`}updateList(items){this._items=items.map(item=>Object.assign({},item)),this.displayItems=this._items,this.updateIndex(),this.setupFocusObservable(),this.doEmitSelect()}filterBy(query=""){query?(this.displayItems=this.getListItems().filter(item=>item.content.toLowerCase().includes(query.toLowerCase())),this.displayItems&&(this.index=0),this.changeDetectorRef.markForCheck()):this.displayItems=this.getListItems(),this.updateIndex()}setupFocusObservable(){if(!this.list)return;this.focusJump&&this.focusJump.unsubscribe();let elList=Array.from(this.list.nativeElement.querySelectorAll("li"));this.focusJump=function watchFocusJump(target,elements){return(0,fromEvent.R)(target,"keydown").pipe((0,debounceTime.B)(150),(0,map.T)(ev=>{let el=elements.find(itemEl=>itemEl.textContent.trim().toLowerCase().startsWith(ev.key));if(el)return el}),(0,filter.p)(el=>!!el))}(this.list.nativeElement,elList).subscribe(el=>{el.focus()})}getNextItem(){return this.index<this.displayItems.length-1&&this.index++,this.displayItems[this.index]}hasNextElement(){return this.index<this.displayItems.length-1&&(!(this.index===this.displayItems.length-2)||!this.displayItems[this.index+1].disabled)}getNextElement(){const elemList=this.listElementList?this.listElementList.toArray():[];if(!elemList.length)return null;for(let i=this.index+1;i<elemList.length;i++)if(!this.displayItems[i].disabled)return this.index=i,elemList[i].nativeElement;return elemList[this.index]?.nativeElement}getPrevItem(){return this.index>0&&this.index--,this.displayItems[this.index]}hasPrevElement(){return this.index>0&&(!(1===this.index)||!this.displayItems[0].disabled)}getPrevElement(){const elemList=this.listElementList?this.listElementList.toArray():[];if(!elemList.length)return null;for(let i=this.index-1;i<this.index&&i>=0;i--)if(!this.displayItems[i].disabled)return this.index=i,elemList[i].nativeElement;return elemList[this.index].nativeElement}getCurrentItem(){return this.index<0?this.displayItems[0]:this.displayItems[this.index]}getCurrentElement(){return this.index<0?this.listElementList.first.nativeElement:this.listElementList.toArray()[this.index].nativeElement}getListItems(){return this._items}getSelected(){let selected=this.getListItems().filter(item=>item.selected);return 0===selected.length?[]:selected}propagateSelected(value){Array.isArray(value)||console.error(`${this.constructor.name}.propagateSelected expects an Array<ListItem>, got ${JSON.stringify(value)}`),this.onItemsReady(()=>{const selectedNewItems=[];for(let newItem of value)if(newItem&&newItem.selected){let tempNewItem=Object.assign({},newItem);delete tempNewItem.selected,tempNewItem=JSON.stringify(tempNewItem),selectedNewItems.push(tempNewItem)}for(let oldItem of this.getListItems()){if(0===selectedNewItems.length){oldItem.selected=!1;continue}let tempOldItem=Object.assign({},oldItem);delete tempOldItem.selected,tempOldItem=JSON.stringify(tempOldItem);for(let selectedNewItem of selectedNewItems){if(tempOldItem.includes(selectedNewItem)){oldItem.selected=!0;break}oldItem.selected=!1}}})}initFocus(){this.index<0&&this.updateIndex(),this.list.nativeElement.focus(),this.highlightedItem=this.getItemId(this.index),this.changeDetectorRef.markForCheck()}updateIndex(){const selected=this.getSelected();selected.length?this.index=this.displayItems.indexOf(selected[0]):this.index<0&&this.hasNextElement()&&this.getNextElement()}navigateList(event){"Enter"===event.key||" "===event.key?(this.listElementList.some(option=>option.nativeElement===event.target)&&event.preventDefault(),"Enter"===event.key&&this.doClick(event,this.getCurrentItem())):"ArrowDown"!==event.key&&"ArrowUp"!==event.key||(event.preventDefault(),"ArrowDown"===event.key?this.hasNextElement()?this.getNextElement()?.scrollIntoView({block:"end"}):this.blurIntent.emit("bottom"):"ArrowUp"===event.key&&(this.hasPrevElement()?this.getPrevElement().scrollIntoView({block:"nearest"}):this.blurIntent.emit("top")),this.highlightedItem=this.getItemId(this.index))}doClick(event,item){if(event.preventDefault(),item&&!item.disabled){if(this.list.nativeElement.focus(),"single"===this.type){item.selected=!0;for(let otherItem of this.getListItems())item!==otherItem&&(otherItem.selected=!1)}else item.selected=!item.selected;this.index=this.displayItems.indexOf(item),this.highlightedItem=this.getItemId(this.index),this.doEmitSelect(!1)}}onItemFocus(index){const element=this.listElementList.toArray()[index].nativeElement;element.classList.add("cds--list-box__menu-item--highlighted"),element.tabIndex=0}onItemBlur(index){const element=this.listElementList.toArray()[index].nativeElement;element.classList.remove("cds--list-box__menu-item--highlighted"),element.tabIndex=-1}emitScroll(event){const customScrollEvent={atTop:0===event.srcElement.scrollTop,atBottom:event.srcElement.scrollHeight-event.srcElement.scrollTop===event.srcElement.clientHeight,event};this.scroll.emit(customScrollEvent)}onItemsReady(subcription){(this._itemsReady||(0,of.of)(!0)).pipe((0,first.$)()).subscribe(subcription)}reorderSelected(moveFocus=!0){this.displayItems=[...this.getSelected(),...this.getListItems().filter(item=>!item.selected)],this.changeDetectorRef.markForCheck(),moveFocus&&setTimeout(()=>{this.updateIndex(),this.highlightedItem=this.getItemId(this.index),this.changeDetectorRef.markForCheck()})}static#_=dropdown_list_component_staticBlock=()=>(DropdownList_1=this,this.listCount=0,this.ctorParameters=()=>[],this.propDecorators={ariaLabel:[{type:debug_node.pde}],items:[{type:debug_node.pde}],listTpl:[{type:debug_node.pde}],select:[{type:debug_node.k7i}],scroll:[{type:debug_node.k7i}],blurIntent:[{type:debug_node.k7i}],list:[{type:core.ViewChild,args:["list",{static:!0}]}],type:[{type:debug_node.pde}],showTitles:[{type:debug_node.pde}],listElementList:[{type:core.ViewChildren,args:["listItem"]}]},this)},dropdown_list_component_staticBlock());var scrollable_list_directive_staticBlock;DropdownList=DropdownList_1=(0,tslib_es6.Cg)([(0,debug_node.uAl)({selector:"cds-dropdown-list, ibm-dropdown-list",template:'\n\t\t<ul\n\t\t\t#list\n\t\t\t[id]="listId"\n\t\t\trole="listbox"\n\t\t\tclass="cds--list-box__menu cds--multi-select"\n\t\t\t(scroll)="emitScroll($event)"\n\t\t\t(keydown)="navigateList($event)"\n\t\t\ttabindex="0"\n\t\t\t[attr.aria-label]="ariaLabel"\n\t\t\t[attr.aria-activedescendant]="highlightedItem">\n\t\t\t@for (item of displayItems; track item; let i = $index) {\n\t\t\t\t<li\n\t\t\t\t\trole="option"\n\t\t\t\t\t(click)="doClick($event, item)"\n\t\t\t\t\tclass="cds--list-box__menu-item"\n\t\t\t\t\t[attr.aria-selected]="item.selected"\n\t\t\t\t\t[id]="getItemId(i)"\n\t\t\t\t\t[attr.tabindex]="highlightedItem === getItemId(i) ? 0 : null"\n\t\t\t\t\t[attr.title]=" showTitles ? item.content : null"\n\t\t\t\t\t[attr.disabled]="item.disabled ? true : null"\n\t\t\t\t\t[ngClass]="{\n\t\t\t\t\t\t\'cds--list-box__menu-item--active\': item.selected,\n\t\t\t\t\t\t\'cds--list-box__menu-item--highlighted\': highlightedItem === getItemId(i)\n\t\t\t\t\t}">\n\t\t\t\t\t<div\n\t\t\t\t\t\t#listItem\n\t\t\t\t\t\ttabindex="-1"\n\t\t\t\t\t\tclass="cds--list-box__menu-item__option">\n\t\t\t\t\t\t@if (!listTpl && type === \'multi\') {\n\t\t\t\t\t\t\t<div class="cds--form-item cds--checkbox-wrapper">\n\t\t\t\t\t\t\t\t<label\n\t\t\t\t\t\t\t\t\t[attr.data-contained-checkbox-state]="item.selected"\n\t\t\t\t\t\t\t\t\tclass="cds--checkbox-label">\n\t\t\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\t\t\tclass="cds--checkbox"\n\t\t\t\t\t\t\t\t\t\ttype="checkbox"\n\t\t\t\t\t\t\t\t\t\t[checked]="item.selected"\n\t\t\t\t\t\t\t\t\t\t[disabled]="item.disabled"\n\t\t\t\t\t\t\t\t\t\ttabindex="-1">\n\t\t\t\t\t\t\t\t\t<span class="cds--checkbox-appearance"></span>\n\t\t\t\t\t\t\t\t\t<span class="cds--checkbox-label-text">{{item.content}}</span>\n\t\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t}\n\t\t\t\t\t\t@if (!listTpl && type === \'single\') {\n\t\t\t\t\t\t\t{{item.content}}\n\t\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\t\tcdsIcon="checkmark"\n\t\t\t\t\t\t\t\tsize="16"\n\t\t\t\t\t\t\t\tclass="cds--list-box__menu-item__selected-icon">\n\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t}\n\t\t\t\t\t\t@if (listTpl) {\n\t\t\t\t\t\t\t<ng-template\n\t\t\t\t\t\t\t\t[ngTemplateOutletContext]="{item: item}"\n\t\t\t\t\t\t\t\t[ngTemplateOutlet]="listTpl">\n\t\t\t\t\t\t\t</ng-template>\n\t\t\t\t\t\t}\n\t\t\t\t\t</div>\n\t\t\t\t</li>\n\t\t\t}\n\t\t</ul>\n\t',providers:[{provide:AbstractDropdownView,useExisting:DropdownList},DropdownService,utils.hK,utils._B],changeDetection:debug_node.Ngq.OnPush,imports:[common_module.YU,icon.LJ,common_module.T3]})],DropdownList);let ScrollableList=(class ScrollableList{constructor(){this.nScrollableList=null,this.scrollEnabled=!0,this.scrollBy=10,this.elementRef=(0,root_effect_scheduler.WQX)(debug_node.aKT),this.canScrollUp=!1,this.canScrollDown=!1,this.list=this.elementRef.nativeElement}ngOnChanges(changes){changes.scrollEnabled&&(changes.scrollEnabled.currentValue?(this.list.style.overflow="hidden",this.scrollUpTarget.style.display="flex",this.scrollDownTarget.style.display="flex",this.canScrollUp=!0,this.canScrollDown=!0,this.updateScrollHeight(),this.checkScrollArrows(),setTimeout(()=>{this.checkScrollArrows()})):(this.scrollUpTarget.style.display="none",this.scrollDownTarget.style.display="none",this.canScrollUp=!1,this.canScrollDown=!1,this.list.style.height=null,this.list.style.overflow=null,clearInterval(this.hoverScrollInterval)))}ngAfterViewInit(){this.nScrollableList&&(this.list=this.elementRef.nativeElement.querySelector(this.nScrollableList)),this.scrollUpTarget.addEventListener("mouseover",()=>this.onHoverUp(!0)),this.scrollUpTarget.addEventListener("mouseout",()=>this.onHoverUp(!1)),this.scrollDownTarget.addEventListener("mouseover",()=>this.onHoverDown(!0)),this.scrollDownTarget.addEventListener("mouseout",()=>this.onHoverDown(!1))}updateScrollHeight(){if(this.scrollEnabled){const containerRect=this.elementRef.nativeElement.parentElement.getBoundingClientRect(),innerHeightDiff=this.list.getBoundingClientRect().top-containerRect.top,height=containerRect.height-(containerRect.bottom-window.innerHeight)-innerHeightDiff-40;this.list.style.height=`${height}px`}}checkScrollArrows(){const scrollUpHeight=this.scrollUpTarget.offsetHeight,scrollDownHeight=this.scrollDownTarget.offsetHeight;0===this.list.scrollTop?(this.canScrollUp&&(this.list.style.height=`${parseInt(this.list.style.height,10)+scrollUpHeight}px`),this.scrollUpTarget.style.display="none",this.canScrollUp=!1):this.list.scrollTop===this.list.scrollTopMax?(this.canScrollDown&&(this.list.style.height=`${parseInt(this.list.style.height,10)+scrollDownHeight}px`),this.scrollDownTarget.style.display="none",this.canScrollDown=!1):(this.canScrollUp||(this.list.style.height=parseInt(this.list.style.height,10)-scrollUpHeight+"px"),this.canScrollDown||(this.list.style.height=parseInt(this.list.style.height,10)-scrollDownHeight+"px"),this.scrollUpTarget.style.display="flex",this.scrollDownTarget.style.display="flex",this.canScrollUp=!0,this.canScrollDown=!0)}onWheel(event){event.deltaY<0?this.list.scrollTop-=this.scrollBy:this.list.scrollTop+=this.scrollBy,this.list.scrollTop!==this.list.scrollTopMax&&0!==this.list.scrollTop&&(event.preventDefault(),event.stopPropagation()),this.checkScrollArrows()}onTouchStart(event){event.touches[0]&&(this.lastTouch=event.touches[0].clientY)}onTouchMove(event){if(event.preventDefault(),event.stopPropagation(),event.touches[0]){const touch=event.touches[0];this.list.scrollTop+=this.lastTouch-touch.clientY,this.lastTouch=touch.clientY,this.checkScrollArrows()}}hoverScrollBy(hovering,amount){hovering?this.hoverScrollInterval=setInterval(()=>{this.list.scrollTop+=amount,this.checkScrollArrows()},1):clearInterval(this.hoverScrollInterval)}onHoverUp(hovering){this.hoverScrollBy(hovering,-3)}onHoverDown(hovering){this.hoverScrollBy(hovering,3)}onKeyDown(event){"ArrowDown"!==event.key&&"ArrowUp"!==event.key||this.checkScrollArrows()}static#_=scrollable_list_directive_staticBlock=()=>(this.ctorParameters=()=>[],this.propDecorators={nScrollableList:[{type:debug_node.pde}],scrollEnabled:[{type:debug_node.pde}],scrollUpTarget:[{type:debug_node.pde}],scrollDownTarget:[{type:debug_node.pde}],scrollBy:[{type:debug_node.pde}],onWheel:[{type:debug_node.Z$l,args:["wheel",["$event"]]}],onTouchStart:[{type:debug_node.Z$l,args:["touchstart",["$event"]]}],onTouchMove:[{type:debug_node.Z$l,args:["touchmove",["$event"]]}],onKeyDown:[{type:debug_node.Z$l,args:["keydown",["$event"]]}]},this)},scrollable_list_directive_staticBlock());ScrollableList=(0,tslib_es6.Cg)([(0,debug_node.WLR)({selector:"[cdsScrollableList], [ibmScrollableList]",exportAs:"scrollable-list",standalone:!0})],ScrollableList);let DropdownModule=class DropdownModule{};DropdownModule=(0,tslib_es6.Cg)([(0,debug_node.UQu)({exports:[Dropdown,DropdownList,ScrollableList,AbstractDropdownView],imports:[common_module.MD,fesm2022_forms.YN,i18n.LP,placeholder.UU,utils.uh,icon.op,Dropdown,DropdownList,ScrollableList,AbstractDropdownView],providers:[DropdownService]})],DropdownModule)}}]);
|
|
2
|
+
//# sourceMappingURL=8383.ae122023.iframe.bundle.js.map
|
package/docs/storybook/{8383.ee4c2859.iframe.bundle.js.map → 8383.ae122023.iframe.bundle.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"8383.ee4c2859.iframe.bundle.js","mappings":"AAOA","sources":["webpack://carbon-components-angular/./src/dropdown/abstract-dropdown-view.class.ts","webpack://carbon-components-angular/./src/dropdown/dropdown.service.ts","webpack://carbon-components-angular/./src/dropdown/dropdown.component.ts","webpack://carbon-components-angular/./src/dropdown/list/dropdown-list.component.ts","webpack://carbon-components-angular/./src/dropdown/dropdowntools.ts","webpack://carbon-components-angular/./src/dropdown/scrollable-list.directive.ts","webpack://carbon-components-angular/./src/dropdown/dropdown.module.ts"],"sourcesContent":["import { __decorate } from \"tslib\";\nimport { Input, Output, Directive } from \"@angular/core\";\n/**\n * A component that intends to be used within `Dropdown` must provide an implementation that extends this base class.\n * It also must provide the base class in the `@Component` meta-data.\n * ex: `providers: [{provide: AbstractDropdownView, useExisting: forwardRef(() => MyDropdownView)}]`\n */\nlet AbstractDropdownView = class AbstractDropdownView {\n constructor() {\n /**\n * Specifies whether or not the `DropdownList` supports selecting multiple items as opposed to single\n * item selection.\n */\n this.type = \"single\";\n /**\n * Specifies the render size of the items within the `AbstractDropdownView`.\n */\n this.size = \"md\";\n }\n set items(value) { }\n get items() { return; }\n /**\n * Returns the `ListItem` that is subsequent to the selected item in the `DropdownList`.\n */\n getNextItem() { return; }\n /**\n * Returns a boolean if the currently selected item is preceded by another\n */\n hasNextElement() { return; }\n /**\n * Returns the `HTMLElement` for the item that is subsequent to the selected item.\n */\n getNextElement() { return; }\n /**\n * Returns the `ListItem` that precedes the selected item within `DropdownList`.\n */\n getPrevItem() { return; }\n /**\n * Returns a boolean if the currently selected item is followed by another\n */\n hasPrevElement() { return; }\n /**\n * Returns the `HTMLElement` for the item that precedes the selected item.\n */\n getPrevElement() { return; }\n /**\n * Returns the selected leaf level item(s) within the `DropdownList`.\n */\n getSelected() { return; }\n /**\n * Returns the `ListItem` that is selected within `DropdownList`.\n */\n getCurrentItem() { return; }\n /**\n * Returns the `HTMLElement` for the item that is selected within the `DropdownList`.\n */\n getCurrentElement() { return; }\n /**\n * Guaranteed to return the current items as an Array.\n */\n getListItems() { return; }\n /**\n * Transforms array input list of items to the correct state by updating the selected item(s).\n */\n propagateSelected(value) { }\n /**\n *\n * @param value value to filter the list by\n */\n filterBy(value) { }\n /**\n * Initializes focus in the list\n * In most cases this just calls `getCurrentElement().focus()`\n */\n initFocus() { }\n /**\n * Subscribe the function passed to an internal observable that will resolve once the items are ready\n */\n onItemsReady(subcription) { }\n /**\n * Reorder selected items bringing them to the top of the list\n */\n reorderSelected(moveFocus) { }\n static { this.propDecorators = {\n items: [{ type: Input }],\n select: [{ type: Output }],\n blurIntent: [{ type: Output }]\n }; }\n};\nAbstractDropdownView = __decorate([\n Directive({\n selector: \"[cdsAbstractDropdownView], [ibmAbstractDropdownView]\",\n standalone: true\n })\n], AbstractDropdownView);\nexport { AbstractDropdownView };\n","import { __decorate } from \"tslib\";\nimport { Injectable, inject } from \"@angular/core\";\nimport { PlaceholderService } from \"carbon-components-angular/placeholder\";\nimport { Subscription } from \"rxjs\";\nimport { position } from \"@carbon/utils-position\";\nimport { AnimationFrameService, closestAttr } from \"carbon-components-angular/utils\";\nconst defaultOffset = { top: 0, left: 0 };\nlet DropdownService = class DropdownService {\n set offset(value) {\n this._offset = Object.assign({}, defaultOffset, value);\n }\n get offset() {\n return this._offset;\n }\n constructor() {\n this.placeholderService = inject(PlaceholderService);\n this.animationFrameService = inject(AnimationFrameService);\n /**\n * Maintains an Event Observable Subscription for the global requestAnimationFrame.\n * requestAnimationFrame is tracked only if the `Dropdown` is appended to the body otherwise we don't need it\n */\n this.animationFrameSubscription = new Subscription();\n this._offset = defaultOffset;\n }\n /**\n * Appends the menu to the body, or a `cds-placeholder` (if defined)\n *\n * @param parentRef container to position relative to\n * @param menuRef menu to be appended to body\n * @param classList any extra classes we should wrap the container with\n */\n appendToBody(parentRef, menuRef, classList) {\n // build the dropdown list container\n menuRef.style.display = \"block\";\n const dropdownWrapper = document.createElement(\"div\");\n dropdownWrapper.className = `dropdown ${classList}`;\n dropdownWrapper.style.width = parentRef.offsetWidth + \"px\";\n dropdownWrapper.style.position = \"absolute\";\n dropdownWrapper.appendChild(menuRef);\n // append it to the placeholder\n if (this.placeholderService.hasPlaceholderRef()) {\n this.placeholderService.appendElement(dropdownWrapper);\n // or append it directly to the body\n }\n else {\n document.body.appendChild(dropdownWrapper);\n }\n this.menuInstance = dropdownWrapper;\n this.animationFrameSubscription = this.animationFrameService.tick.subscribe(() => {\n this.positionDropdown(parentRef, dropdownWrapper);\n });\n // run one position in sync, so we're less likely to have the view \"jump\" as we focus\n this.positionDropdown(parentRef, dropdownWrapper);\n return dropdownWrapper;\n }\n /**\n * Reattach the dropdown menu to the parent container\n * @param hostRef container to append to\n */\n appendToDropdown(hostRef) {\n // if the instance is already removed don't try and remove it again\n if (!this.menuInstance) {\n return;\n }\n const instance = this.menuInstance;\n const menu = instance.firstElementChild;\n // clean up the instance\n this.menuInstance = null;\n menu.style.display = \"none\";\n hostRef.appendChild(menu);\n this.animationFrameSubscription.unsubscribe();\n if (this.placeholderService.hasPlaceholderRef() && this.placeholderService.hasElement(instance)) {\n this.placeholderService.removeElement(instance);\n }\n else if (document.body.contains(instance)) {\n document.body.removeChild(instance);\n }\n return instance;\n }\n /**\n * position an open dropdown relative to the given parentRef\n */\n updatePosition(parentRef) {\n this.positionDropdown(parentRef, this.menuInstance);\n }\n ngOnDestroy() {\n this.animationFrameSubscription.unsubscribe();\n }\n positionDropdown(parentRef, menuRef) {\n if (!menuRef) {\n return;\n }\n let leftOffset = 0;\n const boxMenu = menuRef.querySelector(\".cds--list-box__menu\");\n if (boxMenu) {\n // If the parentRef and boxMenu are in a different left position relative to the\n // window, the the boxMenu position has already been flipped and a check needs to be done\n // to see if it needs to stay flipped.\n if (parentRef.getBoundingClientRect().left !== boxMenu.getBoundingClientRect().left) {\n // The getBoundingClientRect().right of the boxMenu if it were hypothetically flipped\n // back into the original position before the flip.\n const testBoxMenuRightEdgePos = parentRef.getBoundingClientRect().left - boxMenu.getBoundingClientRect().left + boxMenu.getBoundingClientRect().right;\n if (testBoxMenuRightEdgePos > (window.innerWidth || document.documentElement.clientWidth)) {\n leftOffset = parentRef.offsetWidth - boxMenu.offsetWidth;\n }\n // If it has not already been flipped, check if it is necessary to flip, ie. if the\n // boxMenu is outside of the right viewPort.\n }\n else if (boxMenu.getBoundingClientRect().right > (window.innerWidth || document.documentElement.clientWidth)) {\n leftOffset = parentRef.offsetWidth - boxMenu.offsetWidth;\n }\n }\n // If cds-placeholder has a parent with a position(relative|fixed|absolute) account for the parent offset\n const closestMenuWithPos = closestAttr(\"position\", [\"relative\", \"fixed\", \"absolute\"], menuRef.parentElement);\n const topPos = closestMenuWithPos ? closestMenuWithPos.getBoundingClientRect().top * -1 : this.offset.top;\n const leftPos = closestMenuWithPos ? closestMenuWithPos.getBoundingClientRect().left * -1 : this.offset.left + leftOffset;\n let pos = position.findAbsolute(parentRef, menuRef, \"bottom\");\n pos = position.addOffset(pos, topPos, leftPos);\n position.setElement(menuRef, pos);\n }\n static { this.ctorParameters = () => []; }\n};\nDropdownService = __decorate([\n Injectable()\n], DropdownService);\nexport { DropdownService };\n","var Dropdown_1;\nimport { __decorate } from \"tslib\";\nimport { Component, Input, Output, EventEmitter, ElementRef, ContentChild, ViewChild, HostListener, HostBinding, TemplateRef, ChangeDetectionStrategy, ChangeDetectorRef, inject } from \"@angular/core\";\nimport { NG_VALUE_ACCESSOR } from \"@angular/forms\";\n// Observable import is required here so typescript can compile correctly\nimport { of, Subscription } from \"rxjs\";\nimport { isNull, isUndefined } from \"lodash-es\";\nimport { AbstractDropdownView } from \"./abstract-dropdown-view.class\";\nimport { I18n } from \"carbon-components-angular/i18n\";\nimport { DropdownService } from \"./dropdown.service\";\nimport { AnimationFrameService, AnimationFrameServiceSingleton, ElementService, EventService, getScrollableParents } from \"carbon-components-angular/utils\";\nimport { hasScrollableParents } from \"carbon-components-angular/utils\";\nimport { NgClass, NgTemplateOutlet, AsyncPipe } from \"@angular/common\";\nimport { IconDirective } from \"carbon-components-angular/icon\";\nimport { PlaceholderService } from \"carbon-components-angular/placeholder\";\n/**\n * Drop-down lists enable users to select one or more items from a list.\n *\n * #### Opening behavior/List DOM placement\n * By default the dropdown will try to figure out the best placement for the dropdown list.\n *\n * If it's not contained within any scrolling elements, it will open inline, if it _is_\n * contained within a scrolling container it will try to open in the body, or an `cds-placeholder`.\n *\n * To control this behavior you can use the `appendInline` input:\n * - `[appendInline]=\"null\"` is the default (auto detection)\n * - `[appendInline]=\"false\"` will always append to the body/`cds-placeholder`\n * - `[appendInline]=\"true\"` will always append inline (next to the dropdown button)\n *\n * Get started with importing the components:\n *\n * ```typescript\n * import { Dropdown, DropdownList } from 'carbon-components-angular';\n * ```\n *\n * [See demo](../../?path=/story/components-dropdown--basic)\n */\nlet Dropdown = class Dropdown {\n static { Dropdown_1 = this; }\n static { this.dropdownCount = 0; }\n get fluidInvalidClass() {\n return this.invalid && this.fluid;\n }\n get fluidFocusClass() {\n return this.fluid && this._isFocused && !this.isOpen;\n }\n get hasDecorator() {\n return !!this.decorator;\n }\n /** Deprecated as of v6 - Will be removed in v7 */\n set menuIsClosed(isClosed) {\n this.isOpen = !isClosed;\n this.changeDetectorRef.markForCheck();\n }\n get writtenValue() {\n return this._writtenValue;\n }\n set writtenValue(val) {\n if (val && val.length === 0) {\n this.clearSelected();\n }\n this._writtenValue = val;\n }\n /**\n * Creates an instance of Dropdown.\n */\n constructor() {\n this.i18n = inject(I18n);\n this.id = `dropdown-${Dropdown_1.dropdownCount++}`;\n this.hideLabel = false;\n this.placeholder = \"\";\n this.displayValue = \"\";\n this.clearText = this.i18n.get().DROPDOWN.CLEAR;\n this.size = \"md\";\n this.type = \"single\";\n this.theme = \"dark\";\n this.disabled = false;\n this.readonly = false;\n this.skeleton = false;\n this.inline = false;\n this.disableArrowKeys = false;\n this.invalid = false;\n this.warn = false;\n this.appendInline = null;\n this.selectionFeedback = \"top-after-reopen\";\n this.menuButtonLabel = this.i18n.get().DROPDOWN.OPEN;\n this.selectedLabel = this.i18n.get().DROPDOWN.SELECTED;\n this.allowNullValues = false;\n this.selected = new EventEmitter();\n this.onClose = new EventEmitter();\n this.close = new EventEmitter();\n this.hostClass = true;\n this.hostWrapperClass = true;\n this.fluid = false;\n this.isOpen = false;\n /**\n * controls whether the `drop-up` class is applied\n */\n this._dropUp = false;\n // .bind creates a new function, so we declare the methods below\n // but .bind them up here\n this.noop = this._noop.bind(this);\n this.outsideClick = this._outsideClick.bind(this);\n this.outsideKey = this._outsideKey.bind(this);\n this.keyboardNav = this._keyboardNav.bind(this);\n this.elementRef = inject(ElementRef);\n this.dropdownService = inject(DropdownService);\n this.elementService = inject(ElementService);\n this.changeDetectorRef = inject(ChangeDetectorRef);\n this.visibilitySubscription = new Subscription();\n this.onTouchedCallback = this._noop;\n this._isFocused = false;\n // primarily used to capture and propagate input to `writeValue` before the content is available\n this._writtenValue = [];\n this._isUsingNgControl = false;\n /**\n * function passed in by `registerOnChange`\n */\n this.propagateChange = (_) => { };\n }\n /**\n * Updates the `type` property in the `@ContentChild`.\n * The `type` property specifies whether the `Dropdown` allows single selection or multi selection.\n */\n ngOnInit() {\n if (this.view) {\n this.view.type = this.type;\n }\n }\n /**\n * Initializes classes and subscribes to events for single or multi selection.\n */\n ngAfterContentInit() {\n if (!this.view) {\n return;\n }\n this.view.type = this.type;\n this.view.size = this.size;\n // function to check if the event is organic (isUpdate === false) or programmatic\n const isUpdate = event => event && event.isUpdate;\n this.selectionSubscription = this.view.select.subscribe(event => {\n if (this.type === \"single\" && !isUpdate(event) && !Array.isArray(event)) {\n this.closeMenu();\n if (event.item && event.item.selected) {\n if (this.itemValueKey) {\n this._propagateChange(event.item[this.itemValueKey]);\n }\n else {\n this._propagateChange(event.item);\n }\n }\n else {\n this._propagateChange(null);\n }\n }\n if (this.type === \"multi\" && !isUpdate(event)) {\n // if we have a `value` selector and selected items map them appropriately\n if (this.itemValueKey && this.view.getSelected()) {\n const values = this.view.getSelected().map(item => item[this.itemValueKey]);\n this._propagateChange(values);\n // otherwise just pass up the values from `getSelected`\n }\n else {\n this._propagateChange(this.view.getSelected());\n }\n }\n // only emit selected for \"organic\" selections\n if (!isUpdate(event)) {\n this.checkForReorder();\n this.selected.emit(event);\n }\n else if (this._isUsingNgControl) {\n this.writeValue(this.writtenValue);\n }\n });\n }\n ngAfterViewInit() {\n // if appendInline is default valued (null) we should:\n // 1. if there are scrollable parents (not including body) don't append inline\n // this should also cover the case where the dropdown is in a modal\n // (where we _do_ want to append to the placeholder)\n if (this.appendInline === null && hasScrollableParents(this.elementRef.nativeElement)) {\n this.appendInline = false;\n // 2. otherwise we should append inline\n }\n else if (this.appendInline === null) {\n this.appendInline = true;\n }\n this.checkForReorder();\n }\n /**\n * Removing the `Dropdown` from the body if it is appended to the body.\n */\n ngOnDestroy() {\n if (!this.appendInline) {\n this._appendToDropdown();\n }\n this.visibilitySubscription?.unsubscribe();\n this.selectionSubscription?.unsubscribe();\n }\n /**\n * Propagates the injected `value`.\n */\n writeValue(value) {\n // cache the written value so we can use it in `AfterContentInit`\n this.writtenValue = value;\n this.view.onItemsReady(() => {\n // propagate null/undefined as an array (deselect everything) unless `allowNullValues` is true\n if (isUndefined(value) || (isNull(value) && !this.allowNullValues)) {\n this.view.propagateSelected([value]);\n }\n else if (this.type === \"single\") {\n if (this.itemValueKey) {\n // clone the specified item and update its state\n const newValue = Object.assign({}, this.view.getListItems().find(item => item[this.itemValueKey] === value));\n newValue.selected = true;\n this.view.propagateSelected([newValue]);\n }\n else {\n // pass the singular value as an array of ListItem\n this.view.propagateSelected([value]);\n }\n }\n else {\n if (this.itemValueKey) {\n // clone the items and update their state based on the received value array\n // this way we don't lose any additional metadata that may be passed in via the `items` Input\n let newValues = [];\n for (const v of value) {\n for (const item of this.view.getListItems()) {\n if (item[this.itemValueKey] === v) {\n newValues.push(Object.assign({}, item, { selected: true }));\n }\n }\n }\n this.view.propagateSelected(newValues);\n }\n else {\n // we can safely assume we're passing an array of `ListItem`s\n this.view.propagateSelected(value || [value]);\n }\n }\n this.checkForReorder();\n });\n }\n onBlur() {\n this.onTouchedCallback();\n }\n registerOnChange(fn) {\n this._isUsingNgControl = true;\n this.propagateChange = fn;\n }\n /**\n * Registering the function injected to control the touch use of the `Dropdown`.\n */\n registerOnTouched(fn) {\n this.onTouchedCallback = fn;\n }\n /**\n * `ControlValueAccessor` method to programmatically disable the dropdown.\n *\n * ex: `this.formGroup.get(\"myDropdown\").disable();`\n *\n * @param isDisabled `true` to disable the input\n */\n setDisabledState(isDisabled) {\n this.disabled = isDisabled;\n }\n onKeyDown(event) {\n if (this.readonly) {\n return;\n }\n if ((event.key === \"Escape\") && this.isOpen) {\n event.stopImmediatePropagation(); // don't unintentionally close other widgets that listen for Escape\n }\n if (event.key === \"Escape\") {\n event.preventDefault();\n this.closeMenu();\n this.dropdownButton.nativeElement.focus();\n }\n else if (!this.isOpen && (event.key === \" \" || event.key === \"ArrowDown\" || event.key === \"ArrowUp\")) {\n if (this.disableArrowKeys && (event.key === \"ArrowDown\" || event.key === \"ArrowUp\")) {\n return;\n }\n event.preventDefault();\n this.openMenu();\n }\n if (this.isOpen && event.key === \"Tab\" && this.dropdownMenu.nativeElement.contains(event.target)) {\n this.closeMenu();\n }\n if (this.isOpen && event.key === \"Tab\" && event.shiftKey) {\n this.closeMenu();\n }\n if (this.type === \"multi\") {\n return;\n }\n if (!this.isOpen) {\n this.closedDropdownNavigation(event);\n }\n }\n closedDropdownNavigation(event) {\n if (event.key === \"ArrowDown\") {\n event.preventDefault();\n this.view.getCurrentItem().selected = false;\n let item = this.view.getNextItem();\n if (item) {\n item.selected = true;\n }\n }\n else if (event.key === \"ArrowUp\") {\n event.preventDefault();\n this.view.getCurrentItem().selected = false;\n let item = this.view.getPrevItem();\n if (item) {\n item.selected = true;\n }\n }\n }\n /**\n * Returns the display value if there is a selection and displayValue is set,\n * if there is just a selection the ListItem content property will be returned,\n * otherwise the placeholder will be returned.\n */\n getDisplayStringValue() {\n if (!this.view || this.skeleton) {\n return;\n }\n let selected = this.view.getSelected();\n if (selected.length && (!this.displayValue || !this.isRenderString())) {\n if (this.type === \"multi\") {\n return of(this.placeholder);\n }\n else {\n return of(selected[0].content);\n }\n }\n else if (selected.length && this.isRenderString()) {\n return of(this.displayValue);\n }\n return of(this.placeholder);\n }\n isRenderString() {\n return typeof this.displayValue === \"string\";\n }\n getRenderTemplateContext() {\n if (!this.view) {\n return;\n }\n let selected = this.view.getSelected();\n if (this.type === \"multi\") {\n return { items: selected };\n }\n else if (selected && selected.length > 0) {\n return { item: selected[0] }; // this is to be compatible with the dropdown-list template\n }\n else {\n return {};\n }\n }\n getSelectedCount() {\n if (this.view.getSelected()) {\n return this.view.getSelected().length;\n }\n }\n clearSelected() {\n if (this.disabled || this.getSelectedCount() === 0) {\n return;\n }\n for (const item of this.view.getListItems()) {\n item.selected = false;\n }\n this.selected.emit([]);\n this._propagateChange([]);\n }\n /**\n * Returns `true` if there is a value selected.\n */\n valueSelected() {\n if (this.view.getSelected()) {\n return true;\n }\n return false;\n }\n _noop() { }\n /**\n * Handles clicks outside of the `Dropdown`.\n */\n _outsideClick(event) {\n if (!this.elementRef.nativeElement.contains(event.target) &&\n // if we're appendToBody the list isn't within the _elementRef,\n // so we've got to check if our target is possibly in there too.\n !this.dropdownMenu.nativeElement.contains(event.target)) {\n this.closeMenu();\n }\n }\n _outsideKey(event) {\n if (this.isOpen && event.key === \"Tab\" && this.dropdownMenu.nativeElement.contains(event.target)) {\n this.closeMenu();\n }\n }\n /**\n * Handles keyboard events so users are controlling the `Dropdown` instead of unintentionally controlling outside elements.\n */\n _keyboardNav(event) {\n if (event.key === \"Escape\" && this.isOpen) {\n event.stopImmediatePropagation(); // don't unintentionally close modal if inside of it\n }\n if (event.key === \"Escape\") {\n event.preventDefault();\n this.closeMenu();\n this.dropdownButton.nativeElement.focus();\n }\n else if (this.isOpen && event.key === \"Tab\") {\n // this way focus will start on the next focusable item from the dropdown\n // not the top of the body!\n this.dropdownButton.nativeElement.focus();\n this.dropdownButton.nativeElement.dispatchEvent(new KeyboardEvent(\"keydown\", { bubbles: true, cancelable: true, key: \"Tab\" }));\n this.closeMenu();\n }\n }\n /**\n * Creates the `Dropdown` list appending it to the dropdown parent object instead of the body.\n */\n _appendToDropdown() {\n this.dropdownService.appendToDropdown(this.elementRef.nativeElement);\n this.dropdownMenu.nativeElement.removeEventListener(\"keydown\", this.keyboardNav, true);\n }\n /**\n * Creates the `Dropdown` list as an element that is appended to the DOM body.\n */\n _appendToBody() {\n const lightClass = this.theme === \"light\" ? \" cds--list-box--light\" : \"\";\n const expandedClass = this.isOpen ? \" cds--list-box--expanded\" : \"\";\n this.dropdownService.appendToBody(this.dropdownButton.nativeElement, this.dropdownMenu.nativeElement, `${this.elementRef.nativeElement.className}${lightClass}${expandedClass}`);\n this.dropdownMenu.nativeElement.addEventListener(\"keydown\", this.keyboardNav, true);\n }\n /**\n * Detects whether or not the `Dropdown` list is visible within all scrollable parents.\n * This can be overridden by passing in a value to the `dropUp` input.\n */\n _shouldDropUp() {\n // check if dropdownMenu exists first.\n const menu = this.dropdownMenu && this.dropdownMenu.nativeElement.querySelector(\".cds--list-box__menu\");\n // check if menu exists first.\n const menuRect = menu && menu.getBoundingClientRect();\n if (menu && menuRect) {\n const scrollableParents = getScrollableParents(menu);\n return scrollableParents.reduce((shouldDropUp, parent) => {\n const parentRect = parent.getBoundingClientRect();\n const isBelowParent = !(menuRect.bottom <= parentRect.bottom);\n return shouldDropUp || isBelowParent;\n }, false);\n }\n return false;\n }\n /**\n * Expands the dropdown menu in the view.\n */\n openMenu() {\n // prevents the dropdown from opening when list of items is empty\n if (this.view.getListItems().length === 0) {\n return;\n }\n this._dropUp = false;\n this.isOpen = true;\n this.changeDetectorRef.markForCheck();\n // move the dropdown list to the body if we're not appending inline\n // and position it relative to the dropdown wrapper\n if (!this.appendInline) {\n const target = this.dropdownButton.nativeElement;\n const parent = this.elementRef.nativeElement;\n this.visibilitySubscription = this.elementService\n .visibility(target, parent)\n .subscribe(value => {\n if (!value.visible) {\n this.closeMenu();\n }\n });\n this._appendToBody();\n }\n // set the dropdown menu to drop up if it's near the bottom of the screen\n // setTimeout lets us measure after it's visible in the DOM\n setTimeout(() => {\n if (this.dropUp === null || this.dropUp === undefined) {\n this._dropUp = this._shouldDropUp();\n }\n }, 0);\n // we bind noop to document.body.firstElementChild to allow safari to fire events\n // from document. Then we unbind everything later to keep things light.\n document.body.firstElementChild.addEventListener(\"click\", this.noop, true);\n document.body.firstElementChild.addEventListener(\"keydown\", this.noop, true);\n document.addEventListener(\"click\", this.outsideClick, true);\n document.addEventListener(\"keydown\", this.outsideKey, true);\n setTimeout(() => this.view.initFocus(), 0);\n }\n /**\n * Collapsing the dropdown menu and removing unnecessary `EventListeners`.\n */\n closeMenu() {\n // return early if the menu is already closed\n if (!this.isOpen) {\n return;\n }\n this.isOpen = false;\n this.changeDetectorRef.markForCheck();\n this.checkForReorder();\n this.onClose.emit();\n this.close.emit();\n // focus the trigger button when we close ...\n this.dropdownButton.nativeElement.focus();\n // remove the conditional once this api is settled and part of abstract-dropdown-view.class\n if (this.view[\"disableScroll\"]) {\n this.view[\"disableScroll\"]();\n }\n // move the list back in the component on close\n if (!this.appendInline) {\n this.visibilitySubscription.unsubscribe();\n this._appendToDropdown();\n }\n document.body.firstElementChild.removeEventListener(\"click\", this.noop, true);\n document.body.firstElementChild.removeEventListener(\"keydown\", this.noop, true);\n document.removeEventListener(\"click\", this.outsideClick, true);\n document.removeEventListener(\"keydown\", this.outsideKey, true);\n }\n /**\n * Controls toggling menu states between open/expanded and closed/collapsed.\n */\n toggleMenu() {\n if (!this.isOpen) {\n this.openMenu();\n }\n else {\n this.closeMenu();\n }\n }\n isTemplate(value) {\n return value instanceof TemplateRef;\n }\n handleFocus(event) {\n this._isFocused = event.type === \"focus\";\n if (event.type === \"blur\") {\n this.onBlur();\n }\n }\n /**\n * Controls when it's needed to apply the selection feedback\n */\n checkForReorder() {\n const topAfterReopen = !this.isOpen && this.selectionFeedback === \"top-after-reopen\";\n if ((this.type === \"multi\") && (topAfterReopen || this.selectionFeedback === \"top\")) {\n this.view.reorderSelected();\n }\n }\n // used only to update writtenValue\n _propagateChange(value) {\n this.writtenValue = value;\n this.propagateChange(value);\n }\n static { this.ctorParameters = () => []; }\n static { this.propDecorators = {\n fluidInvalidClass: [{ type: HostBinding, args: [\"class.cds--list-box__wrapper--fluid--invalid\",] }],\n fluidFocusClass: [{ type: HostBinding, args: [\"class.cds--list-box__wrapper--fluid--focus\",] }],\n id: [{ type: Input }],\n label: [{ type: Input }],\n hideLabel: [{ type: Input }],\n helperText: [{ type: Input }],\n decorator: [{ type: Input }],\n placeholder: [{ type: Input }],\n displayValue: [{ type: Input }],\n clearText: [{ type: Input }],\n size: [{ type: Input }],\n type: [{ type: Input }],\n theme: [{ type: Input }],\n disabled: [{ type: Input }],\n readonly: [{ type: Input }],\n skeleton: [{ type: Input }],\n inline: [{ type: Input }],\n disableArrowKeys: [{ type: Input }],\n invalid: [{ type: Input }],\n invalidText: [{ type: Input }],\n warn: [{ type: Input }],\n warnText: [{ type: Input }],\n appendInline: [{ type: Input }],\n scrollableContainer: [{ type: Input }],\n itemValueKey: [{ type: Input }],\n selectionFeedback: [{ type: Input }],\n menuButtonLabel: [{ type: Input }],\n selectedLabel: [{ type: Input }],\n dropUp: [{ type: Input }],\n allowNullValues: [{ type: Input }],\n selected: [{ type: Output }],\n onClose: [{ type: Output }],\n close: [{ type: Output }],\n view: [{ type: ContentChild, args: [AbstractDropdownView, { static: true },] }],\n dropdownButton: [{ type: ViewChild, args: [\"dropdownButton\", { static: true },] }],\n dropdownMenu: [{ type: ViewChild, args: [\"dropdownMenu\", { static: true },] }],\n hostClass: [{ type: HostBinding, args: [\"class.cds--dropdown__wrapper\",] }],\n hostWrapperClass: [{ type: HostBinding, args: [\"class.cds--list-box__wrapper\",] }],\n hasDecorator: [{ type: HostBinding, args: [\"class.cds--list-box__wrapper--decorator\",] }],\n fluid: [{ type: HostBinding, args: [\"class.cds--list-box__wrapper--fluid\",] }, { type: Input }],\n isOpen: [{ type: Input }],\n onKeyDown: [{ type: HostListener, args: [\"keydown\", [\"$event\"],] }]\n }; }\n};\nDropdown = Dropdown_1 = __decorate([\n Component({\n selector: \"cds-dropdown, ibm-dropdown\",\n template: `\n\t\t@if (label && !skeleton) {\n\t\t\t<label\n\t\t\t\t[for]=\"id\"\n\t\t\t\tclass=\"cds--label\"\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--label--disabled': disabled,\n\t\t\t\t\t'cds--visually-hidden': hideLabel\n\t\t\t\t}\">\n\t\t\t\t@if (!isTemplate(label)) {\n\t\t\t\t\t{{label}}\n\t\t\t\t}\n\t\t\t\t@if (isTemplate(label)) {\n\t\t\t\t\t<ng-template [ngTemplateOutlet]=\"label\"></ng-template>\n\t\t\t\t}\n\t\t\t</label>\n\t\t}\n\t\t<div\n\t\t\tclass=\"cds--list-box\"\n\t\t\t[ngClass]=\"{\n\t\t\t\t'cds--dropdown': type !== 'multi' && !(skeleton && fluid),\n\t\t\t\t'cds--multiselect': type === 'multi',\n\t\t\t\t'cds--multi-select--selected': type === 'multi' && getSelectedCount() > 0,\n\t\t\t\t'cds--dropdown--light': theme === 'light',\n\t\t\t\t'cds--list-box--light': theme === 'light',\n\t\t\t\t'cds--list-box--inline': inline,\n\t\t\t\t'cds--skeleton': skeleton,\n\t\t\t\t'cds--dropdown--disabled cds--list-box--disabled': disabled,\n\t\t\t\t'cds--dropdown--readonly': readonly,\n\t\t\t\t'cds--dropdown--invalid': invalid,\n\t\t\t\t'cds--dropdown--warning cds--list-box--warning': warn,\n\t\t\t\t'cds--dropdown--sm cds--list-box--sm': size === 'sm',\n\t\t\t\t'cds--dropdown--md cds--list-box--md': size === 'md',\n\t\t\t\t'cds--dropdown--lg cds--list-box--lg': size === 'lg',\n\t\t\t\t'cds--list-box--expanded': isOpen,\n\t\t\t\t'cds--list-box--invalid': invalid\n\t\t\t}\"\n\t\t\t[attr.data-invalid]=\"invalid ? true : null\">\n\t\t\t@if (skeleton && fluid) {\n\t\t\t\t<div class=\"cds--list-box__label\"></div>\n\t\t\t}\n\t\t\t<button\n\t\t\t\t#dropdownButton\n\t\t\t\t[id]=\"id\"\n\t\t\t\ttype=\"button\"\n\t\t\t\tclass=\"cds--list-box__field\"\n\t\t\t\t[ngClass]=\"{'a': isOpen}\"\n\t\t\t\t[attr.aria-expanded]=\"isOpen\"\n\t\t\t\t[attr.aria-disabled]=\"disabled\"\n\t\t\t\taria-haspopup=\"listbox\"\n\t\t\t\t(click)=\"disabled || readonly ? $event.stopPropagation() : toggleMenu()\"\n\t\t\t\t(focus)=\"fluid ? handleFocus($event) : null\"\n\t\t\t\t(blur)=\"fluid ? handleFocus($event) : onBlur()\"\n\t\t\t\t[attr.disabled]=\"disabled ? true : null\">\n\t\t\t\t@if (type === 'multi' && getSelectedCount() > 0) {\n\t\t\t\t\t<div\n\t\t\t\t\t\t(click)=\"clearSelected()\"\n\t\t\t\t\t\t(keydown.enter)=\"clearSelected()\"\n\t\t\t\t\t\tclass=\"cds--list-box__selection cds--tag--filter cds--list-box__selection--multi\"\n\t\t\t\t\t\ttabindex=\"0\"\n\t\t\t\t\t\t[title]=\"clearText\">\n\t\t\t\t\t\t{{getSelectedCount()}}\n\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\tfocusable=\"false\"\n\t\t\t\t\t\t\tpreserveAspectRatio=\"xMidYMid meet\"\n\t\t\t\t\t\t\tstyle=\"will-change: transform;\"\n\t\t\t\t\t\t\trole=\"img\"\n\t\t\t\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\t\t\t\twidth=\"16\"\n\t\t\t\t\t\t\theight=\"16\"\n\t\t\t\t\t\t\tviewBox=\"0 0 16 16\"\n\t\t\t\t\t\t\taria-hidden=\"true\">\n\t\t\t\t\t\t\t<path d=\"M12 4.7l-.7-.7L8 7.3 4.7 4l-.7.7L7.3 8 4 11.3l.7.7L8 8.7l3.3 3.3.7-.7L8.7 8z\"></path>\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t</div>\n\t\t\t\t}\n\t\t\t\t@if (isRenderString()) {\n\t\t\t\t\t<span class=\"cds--list-box__label\">{{getDisplayStringValue() | async}}</span>\n\t\t\t\t}\n\t\t\t\t@if (!isRenderString()) {\n\t\t\t\t\t<ng-template\n\t\t\t\t\t\t[ngTemplateOutletContext]=\"getRenderTemplateContext()\"\n\t\t\t\t\t\t[ngTemplateOutlet]=\"displayValue\">\n\t\t\t\t\t</ng-template>\n\t\t\t\t}\n\t\t\t\t<span class=\"cds--list-box__menu-icon\">\n\t\t\t\t\t@if (!skeleton) {\n\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\tcdsIcon=\"chevron--down\"\n\t\t\t\t\t\t\tsize=\"16\"\n\t\t\t\t\t\t\t[attr.aria-label]=\"menuButtonLabel\"\n\t\t\t\t\t\t\t[ngClass]=\"{'cds--list-box__menu-icon--open': isOpen }\">\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t}\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t\t@if (decorator) {\n\t\t\t\t<div class=\"cds--list-box__inner-wrapper--decorator\">\n\t\t\t\t\t<ng-template [ngTemplateOutlet]=\"decorator\"></ng-template>\n\t\t\t\t</div>\n\t\t\t}\n\t\t\t@if (invalid) {\n\t\t\t\t<svg\n\t\t\t\t\tclass=\"cds--list-box__invalid-icon\"\n\t\t\t\t\tcdsIcon=\"warning--filled\"\n\t\t\t\t\tsize=\"16\">\n\t\t\t\t</svg>\n\t\t\t}\n\t\t\t@if (!invalid && warn) {\n\t\t\t\t<svg\n\t\t\t\t\tcdsIcon=\"warning--alt--filled\"\n\t\t\t\t\tsize=\"16\"\n\t\t\t\t\tclass=\"cds--list-box__invalid-icon cds--list-box__invalid-icon--warning\">\n\t\t\t\t</svg>\n\t\t\t}\n\t\t\t<div\n\t\t\t\t#dropdownMenu\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--list-box--up': this.dropUp !== null && this.dropUp !== undefined ? dropUp : _dropUp\n\t\t\t\t}\">\n\t\t\t\t@if (isOpen) {\n\t\t\t\t\t<ng-content></ng-content>\n\t\t\t\t}\n\t\t\t</div>\n\t\t</div>\n\t\t@if (fluid) {\n\t\t\t<hr class=\"cds--list-box__divider\" />\n\t\t}\n\t\t@if (helperText && !invalid && !warn && !skeleton && !fluid) {\n\t\t\t<div\n\t\t\t\tclass=\"cds--form__helper-text\"\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--form__helper-text--disabled': disabled\n\t\t\t\t}\">\n\t\t\t\t@if (!isTemplate(helperText)) {\n\t\t\t\t\t{{helperText}}\n\t\t\t\t}\n\t\t\t\t@if (isTemplate(helperText)) {\n\t\t\t\t\t<ng-template [ngTemplateOutlet]=\"helperText\"></ng-template>\n\t\t\t\t}\n\t\t\t</div>\n\t\t}\n\t\t@if (invalid) {\n\t\t\t<div class=\"cds--form-requirement\">\n\t\t\t\t@if (!isTemplate(invalidText)) {\n\t\t\t\t\t{{ invalidText }}\n\t\t\t\t}\n\t\t\t\t@if (isTemplate(invalidText)) {\n\t\t\t\t\t<ng-template [ngTemplateOutlet]=\"invalidText\"></ng-template>\n\t\t\t\t}\n\t\t\t</div>\n\t\t}\n\t\t@if (!invalid && warn) {\n\t\t\t<div class=\"cds--form-requirement\">\n\t\t\t\t@if (!isTemplate(warnText)) {\n\t\t\t\t\t{{warnText}}\n\t\t\t\t}\n\t\t\t\t@if (isTemplate(warnText)) {\n\t\t\t\t\t<ng-template [ngTemplateOutlet]=\"warnText\"></ng-template>\n\t\t\t\t}\n\t\t\t</div>\n\t\t}\n\t`,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: Dropdown,\n multi: true\n },\n PlaceholderService,\n AnimationFrameService,\n AnimationFrameServiceSingleton,\n DropdownService,\n ElementService,\n EventService\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [\n NgClass,\n NgTemplateOutlet,\n IconDirective,\n AsyncPipe\n ]\n })\n], Dropdown);\nexport { Dropdown };\n","var DropdownList_1;\nimport { __decorate } from \"tslib\";\nimport { Component, Input, Output, EventEmitter, ViewChild, ElementRef, ViewChildren, ChangeDetectionStrategy, ChangeDetectorRef, inject } from \"@angular/core\";\nimport { Observable, isObservable, of } from \"rxjs\";\nimport { first } from \"rxjs/operators\";\nimport { I18n } from \"carbon-components-angular/i18n\";\nimport { AbstractDropdownView } from \"../abstract-dropdown-view.class\";\nimport { watchFocusJump } from \"../dropdowntools\";\nimport { NgClass, NgTemplateOutlet } from \"@angular/common\";\nimport { IconDirective } from \"carbon-components-angular/icon\";\nimport { DropdownService } from \"../dropdown.service\";\nimport { AnimationFrameService, AnimationFrameServiceSingleton } from \"carbon-components-angular/utils\";\n/**\n * ```html\n * <cds-dropdown-list [items]=\"listItems\"></cds-dropdown-list>\n * ```\n * ```typescript\n * listItems = [\n * \t{\n * \t\tcontent: \"item one\",\n * \t\tselected: false\n * \t},\n * \t{\n * \t\tcontent: \"item two\",\n * \t\tselected: false,\n * \t},\n * \t{\n * \t\tcontent: \"item three\",\n * \t\tselected: false\n * \t},\n * \t{\n * \t\tcontent: \"item four\",\n * \t\tselected: false\n * \t}\n * ];\n * ```\n */\nlet DropdownList = class DropdownList {\n static { DropdownList_1 = this; }\n static { this.listCount = 0; }\n set items(value) {\n if (isObservable(value)) {\n if (this._itemsSubscription) {\n this._itemsSubscription.unsubscribe();\n }\n this._itemsReady = new Observable((observer) => {\n this._itemsSubscription = value.subscribe(v => {\n this.updateList(v);\n observer.next(true);\n observer.complete();\n });\n });\n this.onItemsReady(null);\n }\n else {\n this.updateList(value);\n }\n this._originalItems = value;\n }\n get items() {\n return this._originalItems;\n }\n /**\n * Creates an instance of `DropdownList`.\n */\n constructor() {\n this.i18n = inject(I18n);\n this.elementRef = inject(ElementRef);\n this.ariaLabel = this.i18n.get().DROPDOWN_LIST.LABEL;\n this.listTpl = null;\n this.select = new EventEmitter();\n this.scroll = new EventEmitter();\n this.blurIntent = new EventEmitter();\n this.type = \"single\";\n this.showTitles = true;\n /**\n * Defines the rendering size of the `DropdownList` input component.\n */\n this.size = \"md\";\n this.listId = `listbox-${DropdownList_1.listCount++}`;\n this.highlightedItem = null;\n /**\n * Holds the list of items that will be displayed in the `DropdownList`.\n * It differs from the the complete set of items when filtering is used (but\n * it is always a subset of the total items in `DropdownList`).\n */\n this.displayItems = [];\n /**\n * Maintains the index for the selected item within the `DropdownList`.\n */\n this.index = -1;\n /**\n * Useful representation of the items, should be accessed via `getListItems`.\n */\n this._items = [];\n this.changeDetectorRef = inject(ChangeDetectorRef);\n }\n /**\n * Retrieves array of list items and index of the selected item after view has rendered.\n * Additionally, any Observables for the `DropdownList` are initialized.\n */\n ngAfterViewInit() {\n this.index = this.getListItems().findIndex(item => item.selected);\n this.setupFocusObservable();\n setTimeout(() => {\n this.doEmitSelect(true);\n });\n }\n /**\n * Removes any Observables on destruction of the component.\n */\n ngOnDestroy() {\n if (this.focusJump) {\n this.focusJump.unsubscribe();\n }\n if (this._itemsSubscription) {\n this._itemsSubscription.unsubscribe();\n }\n }\n doEmitSelect(isUpdate = true) {\n if (this.type === \"single\") {\n this.select.emit({ item: this._items.find(item => item.selected), isUpdate: isUpdate });\n }\n else {\n // abuse javascripts object mutability until we can break the API and switch to\n // { items: [], isUpdate: true }\n const selected = this.getSelected() || [];\n selected[\"isUpdate\"] = isUpdate;\n this.select.emit(selected);\n }\n }\n getItemId(index) {\n return `${this.listId}-${index}`;\n }\n /**\n * Updates the displayed list of items and then retrieves the most current properties for the `DropdownList` from the DOM.\n */\n updateList(items) {\n this._items = items.map(item => Object.assign({}, item));\n this.displayItems = this._items;\n this.updateIndex();\n this.setupFocusObservable();\n this.doEmitSelect();\n }\n /**\n * Filters the items being displayed in the DOM list.\n */\n filterBy(query = \"\") {\n if (query) {\n this.displayItems = this.getListItems().filter(item => item.content.toLowerCase().includes(query.toLowerCase()));\n // Reset index if items were found\n // Prevent selecting index in list that are undefined.\n if (this.displayItems) {\n this.index = 0;\n }\n this.changeDetectorRef.markForCheck();\n }\n else {\n this.displayItems = this.getListItems();\n }\n this.updateIndex();\n }\n /**\n * Initializes (or re-initializes) the Observable that handles switching focus to an element based on\n * key input matching the first letter of the item in the list.\n */\n setupFocusObservable() {\n if (!this.list) {\n return;\n }\n if (this.focusJump) {\n this.focusJump.unsubscribe();\n }\n let elList = Array.from(this.list.nativeElement.querySelectorAll(\"li\"));\n this.focusJump = watchFocusJump(this.list.nativeElement, elList)\n .subscribe(el => {\n el.focus();\n });\n }\n /**\n * Returns the `ListItem` that is subsequent to the selected item in the `DropdownList`.\n */\n getNextItem() {\n if (this.index < this.displayItems.length - 1) {\n this.index++;\n }\n return this.displayItems[this.index];\n }\n /**\n * Returns `true` if the selected item is not the last item in the `DropdownList`.\n */\n hasNextElement() {\n return this.index < this.displayItems.length - 1 &&\n (!(this.index === this.displayItems.length - 2) || !this.displayItems[this.index + 1].disabled);\n }\n /**\n * Returns the `HTMLElement` for the item that is subsequent to the selected item.\n */\n getNextElement() {\n // Only return native elements if they are rendered\n const elemList = this.listElementList ? this.listElementList.toArray() : [];\n if (!elemList.length) {\n return null;\n }\n /**\n * Start checking from next index\n * Continue looping through the list until a non disabeled element is found or\n * end of list is reached\n */\n for (let i = this.index + 1; i < elemList.length; i++) {\n // If the values in the list are not disabled\n if (!this.displayItems[i].disabled) {\n this.index = i;\n return elemList[i].nativeElement;\n }\n }\n return elemList[this.index]?.nativeElement;\n }\n /**\n * Returns the `ListItem` that precedes the selected item within `DropdownList`.\n */\n getPrevItem() {\n if (this.index > 0) {\n this.index--;\n }\n return this.displayItems[this.index];\n }\n /**\n * Returns `true` if the selected item is not the first in the list.\n */\n hasPrevElement() {\n return this.index > 0 && (!(this.index === 1) || !this.displayItems[0].disabled);\n }\n /**\n * Returns the `HTMLElement` for the item that precedes the selected item.\n */\n getPrevElement() {\n // Only return native elements if they are rendered\n const elemList = this.listElementList ? this.listElementList.toArray() : [];\n if (!elemList.length) {\n return null;\n }\n /**\n * Start checking from next index\n * Continue looping through the list until a non disabeled element is found or\n * end of list is reached\n */\n for (let i = this.index - 1; i < this.index && i >= 0; i--) {\n // If the values in the list are not disabled\n if (!this.displayItems[i].disabled) {\n this.index = i;\n return elemList[i].nativeElement;\n }\n }\n return elemList[this.index].nativeElement;\n }\n /**\n * Returns the `ListItem` that is selected within `DropdownList`.\n */\n getCurrentItem() {\n if (this.index < 0) {\n return this.displayItems[0];\n }\n return this.displayItems[this.index];\n }\n /**\n * Returns the `HTMLElement` for the item that is selected within the `DropdownList`.\n */\n getCurrentElement() {\n if (this.index < 0) {\n return this.listElementList.first.nativeElement;\n }\n return this.listElementList.toArray()[this.index].nativeElement;\n }\n /**\n * Returns the items as an Array\n */\n getListItems() {\n return this._items;\n }\n /**\n * Returns a list containing the selected item(s) in the `DropdownList`.\n */\n getSelected() {\n let selected = this.getListItems().filter(item => item.selected);\n if (selected.length === 0) {\n return [];\n }\n return selected;\n }\n /**\n * Transforms array input list of items to the correct state by updating the selected item(s).\n */\n propagateSelected(value) {\n // if we get a non-array, log out an error (since it is one)\n if (!Array.isArray(value)) {\n console.error(`${this.constructor.name}.propagateSelected expects an Array<ListItem>, got ${JSON.stringify(value)}`);\n }\n this.onItemsReady(() => {\n const selectedNewItems = [];\n for (let newItem of value) {\n if (newItem && newItem.selected) {\n // copy the item\n let tempNewItem = Object.assign({}, newItem);\n // deleted selected because it's what we _want_ to change\n delete tempNewItem.selected;\n // stringify for compare later\n tempNewItem = JSON.stringify(tempNewItem);\n // add to the list of selected items\n selectedNewItems.push(tempNewItem);\n }\n }\n // loop through the list items and update the `selected` state for matching items in `value`\n for (let oldItem of this.getListItems()) {\n // fast path when no items are selected\n if (selectedNewItems.length === 0) {\n oldItem.selected = false;\n continue;\n }\n // copy the item\n let tempOldItem = Object.assign({}, oldItem);\n // deleted selected because it's what we _want_ to change\n delete tempOldItem.selected;\n // stringify for compare\n tempOldItem = JSON.stringify(tempOldItem);\n for (let selectedNewItem of selectedNewItems) {\n // do the compare\n if (tempOldItem.includes(selectedNewItem)) {\n oldItem.selected = true;\n // if we've found a matching item, we can stop looping\n break;\n }\n else {\n oldItem.selected = false;\n }\n }\n }\n });\n }\n /**\n * Initializes focus in the list, effectively a wrapper for `getCurrentElement().focus()`\n */\n initFocus() {\n if (this.index < 0) {\n this.updateIndex();\n }\n this.list.nativeElement.focus();\n // `index` is resolved synchronously above, and both callers already defer\n // `initFocus` until the list is rendered, so there's nothing left to wait for\n this.highlightedItem = this.getItemId(this.index);\n this.changeDetectorRef.markForCheck();\n }\n updateIndex() {\n // initialize index on the first selected item or\n // on the next non disabled item if no items are selected\n // in case, if all items are disabled, the index value will remain same\n const selected = this.getSelected();\n if (selected.length) {\n this.index = this.displayItems.indexOf(selected[0]);\n }\n else if (this.index < 0 && this.hasNextElement()) {\n this.getNextElement();\n }\n }\n /**\n * Manages the keyboard accessibility for navigation and selection within a `DropdownList`.\n */\n navigateList(event) {\n if (event.key === \"Enter\" || event.key === \" \") {\n if (this.listElementList.some(option => option.nativeElement === event.target)) {\n event.preventDefault();\n }\n if (event.key === \"Enter\") {\n this.doClick(event, this.getCurrentItem());\n }\n }\n else if (event.key === \"ArrowDown\" || event.key === \"ArrowUp\") {\n event.preventDefault();\n if (event.key === \"ArrowDown\") {\n if (this.hasNextElement()) {\n this.getNextElement()?.scrollIntoView({ block: \"end\" });\n }\n else {\n this.blurIntent.emit(\"bottom\");\n }\n }\n else if (event.key === \"ArrowUp\") {\n if (this.hasPrevElement()) {\n this.getPrevElement().scrollIntoView({ block: \"nearest\" });\n }\n else {\n this.blurIntent.emit(\"top\");\n }\n }\n // `getNextElement`/`getPrevElement` update `index` synchronously, and this\n // runs inside the keydown handler, so the following check picks it up\n this.highlightedItem = this.getItemId(this.index);\n }\n }\n /**\n * Emits the selected item or items after a mouse click event has occurred.\n */\n doClick(event, item) {\n event.preventDefault();\n if (item && !item.disabled) {\n this.list.nativeElement.focus();\n if (this.type === \"single\") {\n item.selected = true;\n // reset the selection\n for (let otherItem of this.getListItems()) {\n if (item !== otherItem) {\n otherItem.selected = false;\n }\n }\n }\n else {\n item.selected = !item.selected;\n }\n this.index = this.displayItems.indexOf(item);\n this.highlightedItem = this.getItemId(this.index);\n this.doEmitSelect(false);\n }\n }\n onItemFocus(index) {\n const element = this.listElementList.toArray()[index].nativeElement;\n element.classList.add(\"cds--list-box__menu-item--highlighted\");\n element.tabIndex = 0;\n }\n onItemBlur(index) {\n const element = this.listElementList.toArray()[index].nativeElement;\n element.classList.remove(\"cds--list-box__menu-item--highlighted\");\n element.tabIndex = -1;\n }\n /**\n * Emits the scroll event of the options list\n */\n emitScroll(event) {\n const atTop = event.srcElement.scrollTop === 0;\n const atBottom = event.srcElement.scrollHeight - event.srcElement.scrollTop === event.srcElement.clientHeight;\n const customScrollEvent = { atTop, atBottom, event };\n this.scroll.emit(customScrollEvent);\n }\n /**\n * Subscribe the function passed to an internal observable that will resolve once the items are ready\n */\n onItemsReady(subcription) {\n // this subscription will auto unsubscribe because of the `first()` pipe\n (this._itemsReady || of(true)).pipe(first()).subscribe(subcription);\n }\n reorderSelected(moveFocus = true) {\n this.displayItems = [...this.getSelected(), ...this.getListItems().filter(item => !item.selected)];\n this.changeDetectorRef.markForCheck();\n if (moveFocus) {\n setTimeout(() => {\n this.updateIndex();\n this.highlightedItem = this.getItemId(this.index);\n this.changeDetectorRef.markForCheck();\n });\n }\n }\n static { this.ctorParameters = () => []; }\n static { this.propDecorators = {\n ariaLabel: [{ type: Input }],\n items: [{ type: Input }],\n listTpl: [{ type: Input }],\n select: [{ type: Output }],\n scroll: [{ type: Output }],\n blurIntent: [{ type: Output }],\n list: [{ type: ViewChild, args: [\"list\", { static: true },] }],\n type: [{ type: Input }],\n showTitles: [{ type: Input }],\n listElementList: [{ type: ViewChildren, args: [\"listItem\",] }]\n }; }\n};\nDropdownList = DropdownList_1 = __decorate([\n Component({\n selector: \"cds-dropdown-list, ibm-dropdown-list\",\n template: `\n\t\t<ul\n\t\t\t#list\n\t\t\t[id]=\"listId\"\n\t\t\trole=\"listbox\"\n\t\t\tclass=\"cds--list-box__menu cds--multi-select\"\n\t\t\t(scroll)=\"emitScroll($event)\"\n\t\t\t(keydown)=\"navigateList($event)\"\n\t\t\ttabindex=\"0\"\n\t\t\t[attr.aria-label]=\"ariaLabel\"\n\t\t\t[attr.aria-activedescendant]=\"highlightedItem\">\n\t\t\t@for (item of displayItems; track item; let i = $index) {\n\t\t\t\t<li\n\t\t\t\t\trole=\"option\"\n\t\t\t\t\t(click)=\"doClick($event, item)\"\n\t\t\t\t\tclass=\"cds--list-box__menu-item\"\n\t\t\t\t\t[attr.aria-selected]=\"item.selected\"\n\t\t\t\t\t[id]=\"getItemId(i)\"\n\t\t\t\t\t[attr.tabindex]=\"highlightedItem === getItemId(i) ? 0 : null\"\n\t\t\t\t\t[attr.title]=\" showTitles ? item.content : null\"\n\t\t\t\t\t[attr.disabled]=\"item.disabled ? true : null\"\n\t\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t\t'cds--list-box__menu-item--active': item.selected,\n\t\t\t\t\t\t'cds--list-box__menu-item--highlighted': highlightedItem === getItemId(i)\n\t\t\t\t\t}\">\n\t\t\t\t\t<div\n\t\t\t\t\t\t#listItem\n\t\t\t\t\t\ttabindex=\"-1\"\n\t\t\t\t\t\tclass=\"cds--list-box__menu-item__option\">\n\t\t\t\t\t\t@if (!listTpl && type === 'multi') {\n\t\t\t\t\t\t\t<div class=\"cds--form-item cds--checkbox-wrapper\">\n\t\t\t\t\t\t\t\t<label\n\t\t\t\t\t\t\t\t\t[attr.data-contained-checkbox-state]=\"item.selected\"\n\t\t\t\t\t\t\t\t\tclass=\"cds--checkbox-label\">\n\t\t\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\t\t\tclass=\"cds--checkbox\"\n\t\t\t\t\t\t\t\t\t\ttype=\"checkbox\"\n\t\t\t\t\t\t\t\t\t\t[checked]=\"item.selected\"\n\t\t\t\t\t\t\t\t\t\t[disabled]=\"item.disabled\"\n\t\t\t\t\t\t\t\t\t\ttabindex=\"-1\">\n\t\t\t\t\t\t\t\t\t<span class=\"cds--checkbox-appearance\"></span>\n\t\t\t\t\t\t\t\t\t<span class=\"cds--checkbox-label-text\">{{item.content}}</span>\n\t\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t}\n\t\t\t\t\t\t@if (!listTpl && type === 'single') {\n\t\t\t\t\t\t\t{{item.content}}\n\t\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\t\tcdsIcon=\"checkmark\"\n\t\t\t\t\t\t\t\tsize=\"16\"\n\t\t\t\t\t\t\t\tclass=\"cds--list-box__menu-item__selected-icon\">\n\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t}\n\t\t\t\t\t\t@if (listTpl) {\n\t\t\t\t\t\t\t<ng-template\n\t\t\t\t\t\t\t\t[ngTemplateOutletContext]=\"{item: item}\"\n\t\t\t\t\t\t\t\t[ngTemplateOutlet]=\"listTpl\">\n\t\t\t\t\t\t\t</ng-template>\n\t\t\t\t\t\t}\n\t\t\t\t\t</div>\n\t\t\t\t</li>\n\t\t\t}\n\t\t</ul>\n\t`,\n providers: [\n {\n provide: AbstractDropdownView,\n useExisting: DropdownList\n },\n DropdownService,\n AnimationFrameService,\n AnimationFrameServiceSingleton\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [NgClass, IconDirective, NgTemplateOutlet]\n })\n], DropdownList);\nexport { DropdownList };\n","import { fromEvent } from \"rxjs\";\nimport { debounceTime, map, filter } from \"rxjs/operators\";\n/**\n * returns an observable bound to keydown events that\n * filters to a single element where the first letter of\n * it's textContent matches the key pressed\n *\n * @param target element to watch\n * @param elements elements to search\n */\nexport function watchFocusJump(target, elements) {\n return fromEvent(target, \"keydown\")\n .pipe(debounceTime(150), map((ev) => {\n let el = elements.find((itemEl) => itemEl.textContent.trim().toLowerCase().startsWith(ev.key));\n if (el) {\n return el;\n }\n }), filter(el => !!el));\n}\n/** bundle of functions to aid in manipulating tree structures */\nexport const treetools = {\n /** finds an item in a set of items and returns the item and path to the item as an array */\n find: function (items, itemToFind, path = []) {\n let found;\n for (let i of items) {\n if (i === itemToFind) {\n path.push(i);\n found = i;\n }\n if (i.items && !found) {\n path.push(i);\n found = this.find(i.items, itemToFind, path).found;\n if (!found) {\n path = [];\n }\n }\n }\n return { found, path };\n }\n};\n","import { __decorate } from \"tslib\";\nimport { Input, Directive, ElementRef, HostListener, inject } from \"@angular/core\";\nlet ScrollableList = class ScrollableList {\n constructor() {\n this.nScrollableList = null;\n this.scrollEnabled = true;\n this.scrollBy = 10;\n this.elementRef = inject(ElementRef);\n this.canScrollUp = false;\n this.canScrollDown = false;\n this.list = this.elementRef.nativeElement;\n }\n ngOnChanges(changes) {\n if (changes.scrollEnabled) {\n if (changes.scrollEnabled.currentValue) {\n this.list.style.overflow = \"hidden\";\n this.scrollUpTarget.style.display = \"flex\";\n this.scrollDownTarget.style.display = \"flex\";\n this.canScrollUp = true;\n this.canScrollDown = true;\n this.updateScrollHeight();\n this.checkScrollArrows();\n setTimeout(() => {\n this.checkScrollArrows();\n });\n }\n else {\n this.scrollUpTarget.style.display = \"none\";\n this.scrollDownTarget.style.display = \"none\";\n this.canScrollUp = false;\n this.canScrollDown = false;\n this.list.style.height = null;\n this.list.style.overflow = null;\n clearInterval(this.hoverScrollInterval);\n }\n }\n }\n ngAfterViewInit() {\n if (this.nScrollableList) {\n this.list = this.elementRef.nativeElement.querySelector(this.nScrollableList);\n }\n this.scrollUpTarget.addEventListener(\"mouseover\", () => this.onHoverUp(true));\n this.scrollUpTarget.addEventListener(\"mouseout\", () => this.onHoverUp(false));\n this.scrollDownTarget.addEventListener(\"mouseover\", () => this.onHoverDown(true));\n this.scrollDownTarget.addEventListener(\"mouseout\", () => this.onHoverDown(false));\n }\n updateScrollHeight() {\n if (this.scrollEnabled) {\n const container = this.elementRef.nativeElement.parentElement;\n const containerRect = container.getBoundingClientRect();\n const innerHeightDiff = this.list.getBoundingClientRect().top - containerRect.top;\n const outerHeightDiff = containerRect.height - (containerRect.bottom - window.innerHeight);\n // 40 gives us some padding between the bottom of the list,\n // the bottom of the window, and the scroll down button\n const height = outerHeightDiff - innerHeightDiff - 40;\n this.list.style.height = `${height}px`;\n }\n }\n checkScrollArrows() {\n const scrollUpHeight = this.scrollUpTarget.offsetHeight;\n const scrollDownHeight = this.scrollDownTarget.offsetHeight;\n if (this.list.scrollTop === 0) {\n if (this.canScrollUp) {\n this.list.style.height = `${parseInt(this.list.style.height, 10) + scrollUpHeight}px`;\n }\n this.scrollUpTarget.style.display = \"none\";\n this.canScrollUp = false;\n }\n else if (this.list.scrollTop === this.list.scrollTopMax) {\n if (this.canScrollDown) {\n this.list.style.height = `${parseInt(this.list.style.height, 10) + scrollDownHeight}px`;\n }\n this.scrollDownTarget.style.display = \"none\";\n this.canScrollDown = false;\n }\n else {\n if (!this.canScrollUp) {\n this.list.style.height = `${parseInt(this.list.style.height, 10) - scrollUpHeight}px`;\n }\n if (!this.canScrollDown) {\n this.list.style.height = `${parseInt(this.list.style.height, 10) - scrollDownHeight}px`;\n }\n this.scrollUpTarget.style.display = \"flex\";\n this.scrollDownTarget.style.display = \"flex\";\n this.canScrollUp = true;\n this.canScrollDown = true;\n }\n }\n onWheel(event) {\n if (event.deltaY < 0) {\n this.list.scrollTop -= this.scrollBy;\n }\n else {\n this.list.scrollTop += this.scrollBy;\n }\n // only prevent the parent/window from scrolling if we can scroll\n if (!(this.list.scrollTop === this.list.scrollTopMax || this.list.scrollTop === 0)) {\n event.preventDefault();\n event.stopPropagation();\n }\n this.checkScrollArrows();\n }\n onTouchStart(event) {\n if (event.touches[0]) {\n this.lastTouch = event.touches[0].clientY;\n }\n }\n onTouchMove(event) {\n event.preventDefault();\n event.stopPropagation();\n if (event.touches[0]) {\n const touch = event.touches[0];\n this.list.scrollTop += this.lastTouch - touch.clientY;\n this.lastTouch = touch.clientY;\n this.checkScrollArrows();\n }\n }\n hoverScrollBy(hovering, amount) {\n if (hovering) {\n this.hoverScrollInterval = setInterval(() => {\n this.list.scrollTop += amount;\n this.checkScrollArrows();\n }, 1);\n }\n else {\n clearInterval(this.hoverScrollInterval);\n }\n }\n onHoverUp(hovering) {\n // how many px/lines to scroll by on hover\n // 3 is just a random number that felt good\n // 1 and 2 are too slow, 4 works but it might be a tad fast\n this.hoverScrollBy(hovering, -3);\n }\n onHoverDown(hovering) {\n this.hoverScrollBy(hovering, 3);\n }\n onKeyDown(event) {\n if (event.key === \"ArrowDown\" || event.key === \"ArrowUp\") {\n this.checkScrollArrows();\n }\n }\n static { this.ctorParameters = () => []; }\n static { this.propDecorators = {\n nScrollableList: [{ type: Input }],\n scrollEnabled: [{ type: Input }],\n scrollUpTarget: [{ type: Input }],\n scrollDownTarget: [{ type: Input }],\n scrollBy: [{ type: Input }],\n onWheel: [{ type: HostListener, args: [\"wheel\", [\"$event\"],] }],\n onTouchStart: [{ type: HostListener, args: [\"touchstart\", [\"$event\"],] }],\n onTouchMove: [{ type: HostListener, args: [\"touchmove\", [\"$event\"],] }],\n onKeyDown: [{ type: HostListener, args: [\"keydown\", [\"$event\"],] }]\n }; }\n};\nScrollableList = __decorate([\n Directive({\n selector: \"[cdsScrollableList], [ibmScrollableList]\",\n exportAs: \"scrollable-list\",\n standalone: true\n })\n], ScrollableList);\nexport { ScrollableList };\n","import { __decorate } from \"tslib\";\nimport { NgModule } from \"@angular/core\";\nimport { CommonModule } from \"@angular/common\";\nimport { FormsModule } from \"@angular/forms\";\nimport { Dropdown } from \"./dropdown.component\";\nimport { DropdownList } from \"./list/dropdown-list.component\";\nimport { AbstractDropdownView } from \"./abstract-dropdown-view.class\";\nimport { ScrollableList } from \"./scrollable-list.directive\";\nimport { I18nModule } from \"carbon-components-angular/i18n\";\nimport { PlaceholderModule } from \"carbon-components-angular/placeholder\";\nimport { DropdownService } from \"./dropdown.service\";\nimport { UtilsModule } from \"carbon-components-angular/utils\";\nimport { IconModule } from \"carbon-components-angular/icon\";\nlet DropdownModule = class DropdownModule {\n};\nDropdownModule = __decorate([\n NgModule({\n exports: [\n Dropdown,\n DropdownList,\n ScrollableList,\n AbstractDropdownView\n ],\n imports: [\n CommonModule,\n FormsModule,\n I18nModule,\n PlaceholderModule,\n UtilsModule,\n IconModule,\n Dropdown,\n DropdownList,\n ScrollableList,\n AbstractDropdownView\n ],\n providers: [DropdownService]\n })\n], DropdownModule);\nexport { DropdownModule };\n"],"names":[],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"8383.ae122023.iframe.bundle.js","mappings":"AAOA","sources":["webpack://carbon-components-angular/./src/dropdown/abstract-dropdown-view.class.ts","webpack://carbon-components-angular/./src/dropdown/dropdown.service.ts","webpack://carbon-components-angular/./src/dropdown/dropdown.component.ts","webpack://carbon-components-angular/./src/dropdown/list/dropdown-list.component.ts","webpack://carbon-components-angular/./src/dropdown/dropdowntools.ts","webpack://carbon-components-angular/./src/dropdown/scrollable-list.directive.ts","webpack://carbon-components-angular/./src/dropdown/dropdown.module.ts"],"sourcesContent":["import { __decorate } from \"tslib\";\nimport { Input, Output, Directive } from \"@angular/core\";\n/**\n * A component that intends to be used within `Dropdown` must provide an implementation that extends this base class.\n * It also must provide the base class in the `@Component` meta-data.\n * ex: `providers: [{provide: AbstractDropdownView, useExisting: forwardRef(() => MyDropdownView)}]`\n */\nlet AbstractDropdownView = class AbstractDropdownView {\n constructor() {\n /**\n * Specifies whether or not the `DropdownList` supports selecting multiple items as opposed to single\n * item selection.\n */\n this.type = \"single\";\n /**\n * Specifies the render size of the items within the `AbstractDropdownView`.\n */\n this.size = \"md\";\n }\n set items(value) { }\n get items() { return; }\n /**\n * Returns the `ListItem` that is subsequent to the selected item in the `DropdownList`.\n */\n getNextItem() { return; }\n /**\n * Returns a boolean if the currently selected item is preceded by another\n */\n hasNextElement() { return; }\n /**\n * Returns the `HTMLElement` for the item that is subsequent to the selected item.\n */\n getNextElement() { return; }\n /**\n * Returns the `ListItem` that precedes the selected item within `DropdownList`.\n */\n getPrevItem() { return; }\n /**\n * Returns a boolean if the currently selected item is followed by another\n */\n hasPrevElement() { return; }\n /**\n * Returns the `HTMLElement` for the item that precedes the selected item.\n */\n getPrevElement() { return; }\n /**\n * Returns the selected leaf level item(s) within the `DropdownList`.\n */\n getSelected() { return; }\n /**\n * Returns the `ListItem` that is selected within `DropdownList`.\n */\n getCurrentItem() { return; }\n /**\n * Returns the `HTMLElement` for the item that is selected within the `DropdownList`.\n */\n getCurrentElement() { return; }\n /**\n * Guaranteed to return the current items as an Array.\n */\n getListItems() { return; }\n /**\n * Transforms array input list of items to the correct state by updating the selected item(s).\n */\n propagateSelected(value) { }\n /**\n *\n * @param value value to filter the list by\n */\n filterBy(value) { }\n /**\n * Initializes focus in the list\n * In most cases this just calls `getCurrentElement().focus()`\n */\n initFocus() { }\n /**\n * Subscribe the function passed to an internal observable that will resolve once the items are ready\n */\n onItemsReady(subcription) { }\n /**\n * Reorder selected items bringing them to the top of the list\n */\n reorderSelected(moveFocus) { }\n static { this.propDecorators = {\n items: [{ type: Input }],\n select: [{ type: Output }],\n blurIntent: [{ type: Output }]\n }; }\n};\nAbstractDropdownView = __decorate([\n Directive({\n selector: \"[cdsAbstractDropdownView], [ibmAbstractDropdownView]\",\n standalone: true\n })\n], AbstractDropdownView);\nexport { AbstractDropdownView };\n","import { __decorate } from \"tslib\";\nimport { Injectable, inject } from \"@angular/core\";\nimport { PlaceholderService } from \"carbon-components-angular/placeholder\";\nimport { Subscription } from \"rxjs\";\nimport { position } from \"@carbon/utils-position\";\nimport { AnimationFrameService, closestAttr } from \"carbon-components-angular/utils\";\nconst defaultOffset = { top: 0, left: 0 };\nlet DropdownService = class DropdownService {\n set offset(value) {\n this._offset = Object.assign({}, defaultOffset, value);\n }\n get offset() {\n return this._offset;\n }\n constructor() {\n this.placeholderService = inject(PlaceholderService);\n this.animationFrameService = inject(AnimationFrameService);\n /**\n * Maintains an Event Observable Subscription for the global requestAnimationFrame.\n * requestAnimationFrame is tracked only if the `Dropdown` is appended to the body otherwise we don't need it\n */\n this.animationFrameSubscription = new Subscription();\n this._offset = defaultOffset;\n }\n /**\n * Appends the menu to the body, or a `cds-placeholder` (if defined)\n *\n * @param parentRef container to position relative to\n * @param menuRef menu to be appended to body\n * @param classList any extra classes we should wrap the container with\n */\n appendToBody(parentRef, menuRef, classList) {\n // build the dropdown list container\n menuRef.style.display = \"block\";\n const dropdownWrapper = document.createElement(\"div\");\n dropdownWrapper.className = `dropdown ${classList}`;\n dropdownWrapper.style.width = parentRef.offsetWidth + \"px\";\n dropdownWrapper.style.position = \"absolute\";\n dropdownWrapper.appendChild(menuRef);\n // append it to the placeholder\n if (this.placeholderService.hasPlaceholderRef()) {\n this.placeholderService.appendElement(dropdownWrapper);\n // or append it directly to the body\n }\n else {\n document.body.appendChild(dropdownWrapper);\n }\n this.menuInstance = dropdownWrapper;\n this.animationFrameSubscription = this.animationFrameService.tick.subscribe(() => {\n this.positionDropdown(parentRef, dropdownWrapper);\n });\n // run one position in sync, so we're less likely to have the view \"jump\" as we focus\n this.positionDropdown(parentRef, dropdownWrapper);\n return dropdownWrapper;\n }\n /**\n * Reattach the dropdown menu to the parent container\n * @param hostRef container to append to\n */\n appendToDropdown(hostRef) {\n // if the instance is already removed don't try and remove it again\n if (!this.menuInstance) {\n return;\n }\n const instance = this.menuInstance;\n const menu = instance.firstElementChild;\n // clean up the instance\n this.menuInstance = null;\n menu.style.display = \"none\";\n hostRef.appendChild(menu);\n this.animationFrameSubscription.unsubscribe();\n if (this.placeholderService.hasPlaceholderRef() && this.placeholderService.hasElement(instance)) {\n this.placeholderService.removeElement(instance);\n }\n else if (document.body.contains(instance)) {\n document.body.removeChild(instance);\n }\n return instance;\n }\n /**\n * position an open dropdown relative to the given parentRef\n */\n updatePosition(parentRef) {\n this.positionDropdown(parentRef, this.menuInstance);\n }\n ngOnDestroy() {\n this.animationFrameSubscription.unsubscribe();\n }\n positionDropdown(parentRef, menuRef) {\n if (!menuRef) {\n return;\n }\n let leftOffset = 0;\n const boxMenu = menuRef.querySelector(\".cds--list-box__menu\");\n if (boxMenu) {\n // If the parentRef and boxMenu are in a different left position relative to the\n // window, the the boxMenu position has already been flipped and a check needs to be done\n // to see if it needs to stay flipped.\n if (parentRef.getBoundingClientRect().left !== boxMenu.getBoundingClientRect().left) {\n // The getBoundingClientRect().right of the boxMenu if it were hypothetically flipped\n // back into the original position before the flip.\n const testBoxMenuRightEdgePos = parentRef.getBoundingClientRect().left - boxMenu.getBoundingClientRect().left + boxMenu.getBoundingClientRect().right;\n if (testBoxMenuRightEdgePos > (window.innerWidth || document.documentElement.clientWidth)) {\n leftOffset = parentRef.offsetWidth - boxMenu.offsetWidth;\n }\n // If it has not already been flipped, check if it is necessary to flip, ie. if the\n // boxMenu is outside of the right viewPort.\n }\n else if (boxMenu.getBoundingClientRect().right > (window.innerWidth || document.documentElement.clientWidth)) {\n leftOffset = parentRef.offsetWidth - boxMenu.offsetWidth;\n }\n }\n // If cds-placeholder has a parent with a position(relative|fixed|absolute) account for the parent offset\n const closestMenuWithPos = closestAttr(\"position\", [\"relative\", \"fixed\", \"absolute\"], menuRef.parentElement);\n const topPos = closestMenuWithPos ? closestMenuWithPos.getBoundingClientRect().top * -1 : this.offset.top;\n const leftPos = closestMenuWithPos ? closestMenuWithPos.getBoundingClientRect().left * -1 : this.offset.left + leftOffset;\n let pos = position.findAbsolute(parentRef, menuRef, \"bottom\");\n pos = position.addOffset(pos, topPos, leftPos);\n position.setElement(menuRef, pos);\n }\n static { this.ctorParameters = () => []; }\n};\nDropdownService = __decorate([\n Injectable()\n], DropdownService);\nexport { DropdownService };\n","var Dropdown_1;\nimport { __decorate } from \"tslib\";\nimport { Component, Input, Output, EventEmitter, ElementRef, ContentChild, ViewChild, HostListener, HostBinding, TemplateRef, ChangeDetectionStrategy, ChangeDetectorRef, inject } from \"@angular/core\";\nimport { NG_VALUE_ACCESSOR } from \"@angular/forms\";\n// Observable import is required here so typescript can compile correctly\nimport { of, Subscription } from \"rxjs\";\nimport { isNull, isUndefined } from \"lodash-es\";\nimport { AbstractDropdownView } from \"./abstract-dropdown-view.class\";\nimport { I18n } from \"carbon-components-angular/i18n\";\nimport { DropdownService } from \"./dropdown.service\";\nimport { AnimationFrameService, AnimationFrameServiceSingleton, ElementService, EventService, getScrollableParents } from \"carbon-components-angular/utils\";\nimport { hasScrollableParents } from \"carbon-components-angular/utils\";\nimport { NgClass, NgTemplateOutlet, AsyncPipe } from \"@angular/common\";\nimport { IconDirective } from \"carbon-components-angular/icon\";\nimport { PlaceholderService } from \"carbon-components-angular/placeholder\";\n/**\n * Drop-down lists enable users to select one or more items from a list.\n *\n * #### Opening behavior/List DOM placement\n * By default the dropdown will try to figure out the best placement for the dropdown list.\n *\n * If it's not contained within any scrolling elements, it will open inline, if it _is_\n * contained within a scrolling container it will try to open in the body, or an `cds-placeholder`.\n *\n * To control this behavior you can use the `appendInline` input:\n * - `[appendInline]=\"null\"` is the default (auto detection)\n * - `[appendInline]=\"false\"` will always append to the body/`cds-placeholder`\n * - `[appendInline]=\"true\"` will always append inline (next to the dropdown button)\n *\n * Get started with importing the components:\n *\n * ```typescript\n * import { Dropdown, DropdownList } from 'carbon-components-angular';\n * ```\n *\n * [See demo](../../?path=/story/components-dropdown--basic)\n */\nlet Dropdown = class Dropdown {\n static { Dropdown_1 = this; }\n static { this.dropdownCount = 0; }\n get fluidInvalidClass() {\n return this.invalid && this.fluid;\n }\n get fluidFocusClass() {\n return this.fluid && this._isFocused && !this.isOpen;\n }\n get hasDecorator() {\n return !!this.decorator;\n }\n /** Deprecated as of v6 - Will be removed in v7 */\n set menuIsClosed(isClosed) {\n this.isOpen = !isClosed;\n this.changeDetectorRef.markForCheck();\n }\n get writtenValue() {\n return this._writtenValue;\n }\n set writtenValue(val) {\n if (val && val.length === 0) {\n this.clearSelected();\n }\n this._writtenValue = val;\n }\n /**\n * Creates an instance of Dropdown.\n */\n constructor() {\n this.i18n = inject(I18n);\n this.id = `dropdown-${Dropdown_1.dropdownCount++}`;\n this.hideLabel = false;\n this.placeholder = \"\";\n this.displayValue = \"\";\n this.clearText = this.i18n.get().DROPDOWN.CLEAR;\n this.size = \"md\";\n this.type = \"single\";\n this.theme = \"dark\";\n this.disabled = false;\n this.readonly = false;\n this.skeleton = false;\n this.inline = false;\n this.disableArrowKeys = false;\n this.invalid = false;\n this.warn = false;\n this.appendInline = null;\n this.selectionFeedback = \"top-after-reopen\";\n this.menuButtonLabel = this.i18n.get().DROPDOWN.OPEN;\n this.selectedLabel = this.i18n.get().DROPDOWN.SELECTED;\n this.allowNullValues = false;\n this.selected = new EventEmitter();\n this.onClose = new EventEmitter();\n this.close = new EventEmitter();\n this.hostClass = true;\n this.hostWrapperClass = true;\n this.fluid = false;\n this.isOpen = false;\n /**\n * controls whether the `drop-up` class is applied\n */\n this._dropUp = false;\n // .bind creates a new function, so we declare the methods below\n // but .bind them up here\n this.noop = this._noop.bind(this);\n this.outsideClick = this._outsideClick.bind(this);\n this.outsideKey = this._outsideKey.bind(this);\n this.keyboardNav = this._keyboardNav.bind(this);\n this.elementRef = inject(ElementRef);\n this.dropdownService = inject(DropdownService);\n this.elementService = inject(ElementService);\n this.changeDetectorRef = inject(ChangeDetectorRef);\n this.visibilitySubscription = new Subscription();\n this.onTouchedCallback = this._noop;\n this._isFocused = false;\n // primarily used to capture and propagate input to `writeValue` before the content is available\n this._writtenValue = [];\n this._isUsingNgControl = false;\n /**\n * function passed in by `registerOnChange`\n */\n this.propagateChange = (_) => { };\n }\n /**\n * Updates the `type` property in the `@ContentChild`.\n * The `type` property specifies whether the `Dropdown` allows single selection or multi selection.\n */\n ngOnInit() {\n if (this.view) {\n this.view.type = this.type;\n }\n }\n /**\n * Initializes classes and subscribes to events for single or multi selection.\n */\n ngAfterContentInit() {\n if (!this.view) {\n return;\n }\n this.view.type = this.type;\n this.view.size = this.size;\n // function to check if the event is organic (isUpdate === false) or programmatic\n const isUpdate = event => event && event.isUpdate;\n this.selectionSubscription = this.view.select.subscribe(event => {\n if (this.type === \"single\" && !isUpdate(event) && !Array.isArray(event)) {\n this.closeMenu();\n if (event.item && event.item.selected) {\n if (this.itemValueKey) {\n this._propagateChange(event.item[this.itemValueKey]);\n }\n else {\n this._propagateChange(event.item);\n }\n }\n else {\n this._propagateChange(null);\n }\n }\n if (this.type === \"multi\" && !isUpdate(event)) {\n // if we have a `value` selector and selected items map them appropriately\n if (this.itemValueKey && this.view.getSelected()) {\n const values = this.view.getSelected().map(item => item[this.itemValueKey]);\n this._propagateChange(values);\n // otherwise just pass up the values from `getSelected`\n }\n else {\n this._propagateChange(this.view.getSelected());\n }\n }\n // only emit selected for \"organic\" selections\n if (!isUpdate(event)) {\n this.checkForReorder();\n this.selected.emit(event);\n }\n else if (this._isUsingNgControl) {\n this.writeValue(this.writtenValue);\n }\n });\n }\n ngAfterViewInit() {\n // if appendInline is default valued (null) we should:\n // 1. if there are scrollable parents (not including body) don't append inline\n // this should also cover the case where the dropdown is in a modal\n // (where we _do_ want to append to the placeholder)\n if (this.appendInline === null && hasScrollableParents(this.elementRef.nativeElement)) {\n this.appendInline = false;\n // 2. otherwise we should append inline\n }\n else if (this.appendInline === null) {\n this.appendInline = true;\n }\n this.checkForReorder();\n }\n /**\n * Removing the `Dropdown` from the body if it is appended to the body.\n */\n ngOnDestroy() {\n if (!this.appendInline) {\n this._appendToDropdown();\n }\n this.visibilitySubscription?.unsubscribe();\n this.selectionSubscription?.unsubscribe();\n }\n /**\n * Propagates the injected `value`.\n */\n writeValue(value) {\n // cache the written value so we can use it in `AfterContentInit`\n this.writtenValue = value;\n this.view.onItemsReady(() => {\n // propagate null/undefined as an array (deselect everything) unless `allowNullValues` is true\n if (isUndefined(value) || (isNull(value) && !this.allowNullValues)) {\n this.view.propagateSelected([value]);\n }\n else if (this.type === \"single\") {\n if (this.itemValueKey) {\n // clone the specified item and update its state\n const newValue = Object.assign({}, this.view.getListItems().find(item => item[this.itemValueKey] === value));\n newValue.selected = true;\n this.view.propagateSelected([newValue]);\n }\n else {\n // pass the singular value as an array of ListItem\n this.view.propagateSelected([value]);\n }\n }\n else {\n if (this.itemValueKey) {\n // clone the items and update their state based on the received value array\n // this way we don't lose any additional metadata that may be passed in via the `items` Input\n let newValues = [];\n for (const v of value) {\n for (const item of this.view.getListItems()) {\n if (item[this.itemValueKey] === v) {\n newValues.push(Object.assign({}, item, { selected: true }));\n }\n }\n }\n this.view.propagateSelected(newValues);\n }\n else {\n // we can safely assume we're passing an array of `ListItem`s\n this.view.propagateSelected(value || [value]);\n }\n }\n this.checkForReorder();\n });\n }\n onBlur() {\n this.onTouchedCallback();\n }\n registerOnChange(fn) {\n this._isUsingNgControl = true;\n this.propagateChange = fn;\n }\n /**\n * Registering the function injected to control the touch use of the `Dropdown`.\n */\n registerOnTouched(fn) {\n this.onTouchedCallback = fn;\n }\n /**\n * `ControlValueAccessor` method to programmatically disable the dropdown.\n *\n * ex: `this.formGroup.get(\"myDropdown\").disable();`\n *\n * @param isDisabled `true` to disable the input\n */\n setDisabledState(isDisabled) {\n this.disabled = isDisabled;\n }\n onKeyDown(event) {\n if (this.readonly) {\n return;\n }\n if ((event.key === \"Escape\") && this.isOpen) {\n event.stopImmediatePropagation(); // don't unintentionally close other widgets that listen for Escape\n }\n if (event.key === \"Escape\") {\n event.preventDefault();\n this.closeMenu();\n this.dropdownButton.nativeElement.focus();\n }\n else if (!this.isOpen && (event.key === \" \" || event.key === \"ArrowDown\" || event.key === \"ArrowUp\")) {\n if (this.disableArrowKeys && (event.key === \"ArrowDown\" || event.key === \"ArrowUp\")) {\n return;\n }\n event.preventDefault();\n this.openMenu();\n }\n if (this.isOpen && event.key === \"Tab\" && this.dropdownMenu.nativeElement.contains(event.target)) {\n this.closeMenu();\n }\n if (this.isOpen && event.key === \"Tab\" && event.shiftKey) {\n this.closeMenu();\n }\n if (this.type === \"multi\") {\n return;\n }\n if (!this.isOpen) {\n this.closedDropdownNavigation(event);\n }\n }\n closedDropdownNavigation(event) {\n if (event.key === \"ArrowDown\") {\n event.preventDefault();\n this.view.getCurrentItem().selected = false;\n let item = this.view.getNextItem();\n if (item) {\n item.selected = true;\n }\n }\n else if (event.key === \"ArrowUp\") {\n event.preventDefault();\n this.view.getCurrentItem().selected = false;\n let item = this.view.getPrevItem();\n if (item) {\n item.selected = true;\n }\n }\n }\n /**\n * Returns the display value if there is a selection and displayValue is set,\n * if there is just a selection the ListItem content property will be returned,\n * otherwise the placeholder will be returned.\n */\n getDisplayStringValue() {\n if (!this.view || this.skeleton) {\n return;\n }\n let selected = this.view.getSelected();\n if (selected.length && (!this.displayValue || !this.isRenderString())) {\n if (this.type === \"multi\") {\n return of(this.placeholder);\n }\n else {\n return of(selected[0].content);\n }\n }\n else if (selected.length && this.isRenderString()) {\n return of(this.displayValue);\n }\n return of(this.placeholder);\n }\n isRenderString() {\n return typeof this.displayValue === \"string\";\n }\n getRenderTemplateContext() {\n if (!this.view) {\n return;\n }\n let selected = this.view.getSelected();\n if (this.type === \"multi\") {\n return { items: selected };\n }\n else if (selected && selected.length > 0) {\n return { item: selected[0] }; // this is to be compatible with the dropdown-list template\n }\n else {\n return {};\n }\n }\n getSelectedCount() {\n if (this.view.getSelected()) {\n return this.view.getSelected().length;\n }\n }\n clearSelected() {\n if (this.disabled || this.getSelectedCount() === 0) {\n return;\n }\n for (const item of this.view.getListItems()) {\n item.selected = false;\n }\n this.selected.emit([]);\n this._propagateChange([]);\n }\n /**\n * Returns `true` if there is a value selected.\n */\n valueSelected() {\n if (this.view.getSelected()) {\n return true;\n }\n return false;\n }\n _noop() { }\n /**\n * Handles clicks outside of the `Dropdown`.\n */\n _outsideClick(event) {\n if (!this.elementRef.nativeElement.contains(event.target) &&\n // if we're appendToBody the list isn't within the _elementRef,\n // so we've got to check if our target is possibly in there too.\n !this.dropdownMenu.nativeElement.contains(event.target)) {\n this.closeMenu();\n }\n }\n _outsideKey(event) {\n if (this.isOpen && event.key === \"Tab\" && this.dropdownMenu.nativeElement.contains(event.target)) {\n this.closeMenu();\n }\n }\n /**\n * Handles keyboard events so users are controlling the `Dropdown` instead of unintentionally controlling outside elements.\n */\n _keyboardNav(event) {\n if (event.key === \"Escape\" && this.isOpen) {\n event.stopImmediatePropagation(); // don't unintentionally close modal if inside of it\n }\n if (event.key === \"Escape\") {\n event.preventDefault();\n this.closeMenu();\n this.dropdownButton.nativeElement.focus();\n }\n else if (this.isOpen && event.key === \"Tab\") {\n // this way focus will start on the next focusable item from the dropdown\n // not the top of the body!\n this.dropdownButton.nativeElement.focus();\n this.dropdownButton.nativeElement.dispatchEvent(new KeyboardEvent(\"keydown\", { bubbles: true, cancelable: true, key: \"Tab\" }));\n this.closeMenu();\n }\n }\n /**\n * Creates the `Dropdown` list appending it to the dropdown parent object instead of the body.\n */\n _appendToDropdown() {\n this.dropdownService.appendToDropdown(this.elementRef.nativeElement);\n this.dropdownMenu.nativeElement.removeEventListener(\"keydown\", this.keyboardNav, true);\n }\n /**\n * Creates the `Dropdown` list as an element that is appended to the DOM body.\n */\n _appendToBody() {\n const lightClass = this.theme === \"light\" ? \" cds--list-box--light\" : \"\";\n const expandedClass = this.isOpen ? \" cds--list-box--expanded\" : \"\";\n this.dropdownService.appendToBody(this.dropdownButton.nativeElement, this.dropdownMenu.nativeElement, `${this.elementRef.nativeElement.className}${lightClass}${expandedClass}`);\n this.dropdownMenu.nativeElement.addEventListener(\"keydown\", this.keyboardNav, true);\n }\n /**\n * Detects whether or not the `Dropdown` list is visible within all scrollable parents.\n * This can be overridden by passing in a value to the `dropUp` input.\n */\n _shouldDropUp() {\n // check if dropdownMenu exists first.\n const menu = this.dropdownMenu && this.dropdownMenu.nativeElement.querySelector(\".cds--list-box__menu\");\n // check if menu exists first.\n const menuRect = menu && menu.getBoundingClientRect();\n if (menu && menuRect) {\n const scrollableParents = getScrollableParents(menu);\n return scrollableParents.reduce((shouldDropUp, parent) => {\n const parentRect = parent.getBoundingClientRect();\n const isBelowParent = !(menuRect.bottom <= parentRect.bottom);\n return shouldDropUp || isBelowParent;\n }, false);\n }\n return false;\n }\n /**\n * Expands the dropdown menu in the view.\n */\n openMenu() {\n // prevents the dropdown from opening when list of items is empty\n if (this.view.getListItems().length === 0) {\n return;\n }\n this._dropUp = false;\n this.isOpen = true;\n this.changeDetectorRef.markForCheck();\n // move the dropdown list to the body if we're not appending inline\n // and position it relative to the dropdown wrapper\n if (!this.appendInline) {\n const target = this.dropdownButton.nativeElement;\n const parent = this.elementRef.nativeElement;\n this.visibilitySubscription = this.elementService\n .visibility(target, parent)\n .subscribe(value => {\n if (!value.visible) {\n this.closeMenu();\n }\n });\n this._appendToBody();\n }\n // set the dropdown menu to drop up if it's near the bottom of the screen\n // setTimeout lets us measure after it's visible in the DOM\n setTimeout(() => {\n if (this.dropUp === null || this.dropUp === undefined) {\n this._dropUp = this._shouldDropUp();\n }\n }, 0);\n // we bind noop to document.body.firstElementChild to allow safari to fire events\n // from document. Then we unbind everything later to keep things light.\n document.body.firstElementChild.addEventListener(\"click\", this.noop, true);\n document.body.firstElementChild.addEventListener(\"keydown\", this.noop, true);\n document.addEventListener(\"click\", this.outsideClick, true);\n document.addEventListener(\"keydown\", this.outsideKey, true);\n setTimeout(() => this.view.initFocus(), 0);\n }\n /**\n * Collapsing the dropdown menu and removing unnecessary `EventListeners`.\n */\n closeMenu() {\n // return early if the menu is already closed\n if (!this.isOpen) {\n return;\n }\n this.isOpen = false;\n this.changeDetectorRef.markForCheck();\n this.checkForReorder();\n this.onClose.emit();\n this.close.emit();\n // focus the trigger button when we close ...\n this.dropdownButton.nativeElement.focus();\n // remove the conditional once this api is settled and part of abstract-dropdown-view.class\n if (this.view[\"disableScroll\"]) {\n this.view[\"disableScroll\"]();\n }\n // move the list back in the component on close\n if (!this.appendInline) {\n this.visibilitySubscription.unsubscribe();\n this._appendToDropdown();\n }\n document.body.firstElementChild.removeEventListener(\"click\", this.noop, true);\n document.body.firstElementChild.removeEventListener(\"keydown\", this.noop, true);\n document.removeEventListener(\"click\", this.outsideClick, true);\n document.removeEventListener(\"keydown\", this.outsideKey, true);\n }\n /**\n * Controls toggling menu states between open/expanded and closed/collapsed.\n */\n toggleMenu() {\n if (!this.isOpen) {\n this.openMenu();\n }\n else {\n this.closeMenu();\n }\n }\n isTemplate(value) {\n return value instanceof TemplateRef;\n }\n handleFocus(event) {\n this._isFocused = event.type === \"focus\";\n if (event.type === \"blur\") {\n this.onBlur();\n }\n }\n /**\n * Controls when it's needed to apply the selection feedback\n */\n checkForReorder() {\n const topAfterReopen = !this.isOpen && this.selectionFeedback === \"top-after-reopen\";\n if ((this.type === \"multi\") && (topAfterReopen || this.selectionFeedback === \"top\")) {\n this.view.reorderSelected();\n }\n }\n // used only to update writtenValue\n _propagateChange(value) {\n this.writtenValue = value;\n this.propagateChange(value);\n }\n static { this.ctorParameters = () => []; }\n static { this.propDecorators = {\n fluidInvalidClass: [{ type: HostBinding, args: [\"class.cds--list-box__wrapper--fluid--invalid\",] }],\n fluidFocusClass: [{ type: HostBinding, args: [\"class.cds--list-box__wrapper--fluid--focus\",] }],\n hasDecorator: [{ type: HostBinding, args: [\"class.cds--list-box__wrapper--decorator\",] }],\n id: [{ type: Input }],\n label: [{ type: Input }],\n hideLabel: [{ type: Input }],\n helperText: [{ type: Input }],\n decorator: [{ type: Input }],\n placeholder: [{ type: Input }],\n displayValue: [{ type: Input }],\n clearText: [{ type: Input }],\n size: [{ type: Input }],\n type: [{ type: Input }],\n theme: [{ type: Input }],\n disabled: [{ type: Input }],\n readonly: [{ type: Input }],\n skeleton: [{ type: Input }],\n inline: [{ type: Input }],\n disableArrowKeys: [{ type: Input }],\n invalid: [{ type: Input }],\n invalidText: [{ type: Input }],\n warn: [{ type: Input }],\n warnText: [{ type: Input }],\n appendInline: [{ type: Input }],\n scrollableContainer: [{ type: Input }],\n itemValueKey: [{ type: Input }],\n selectionFeedback: [{ type: Input }],\n menuButtonLabel: [{ type: Input }],\n selectedLabel: [{ type: Input }],\n dropUp: [{ type: Input }],\n allowNullValues: [{ type: Input }],\n selected: [{ type: Output }],\n onClose: [{ type: Output }],\n close: [{ type: Output }],\n view: [{ type: ContentChild, args: [AbstractDropdownView, { static: true },] }],\n dropdownButton: [{ type: ViewChild, args: [\"dropdownButton\", { static: true },] }],\n dropdownMenu: [{ type: ViewChild, args: [\"dropdownMenu\", { static: true },] }],\n hostClass: [{ type: HostBinding, args: [\"class.cds--dropdown__wrapper\",] }],\n hostWrapperClass: [{ type: HostBinding, args: [\"class.cds--list-box__wrapper\",] }],\n fluid: [{ type: HostBinding, args: [\"class.cds--list-box__wrapper--fluid\",] }, { type: Input }],\n isOpen: [{ type: Input }],\n onKeyDown: [{ type: HostListener, args: [\"keydown\", [\"$event\"],] }]\n }; }\n};\nDropdown = Dropdown_1 = __decorate([\n Component({\n selector: \"cds-dropdown, ibm-dropdown\",\n template: `\n\t\t@if (label && !skeleton) {\n\t\t\t<label\n\t\t\t\t[for]=\"id\"\n\t\t\t\tclass=\"cds--label\"\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--label--disabled': disabled,\n\t\t\t\t\t'cds--visually-hidden': hideLabel\n\t\t\t\t}\">\n\t\t\t\t@if (!isTemplate(label)) {\n\t\t\t\t\t{{label}}\n\t\t\t\t}\n\t\t\t\t@if (isTemplate(label)) {\n\t\t\t\t\t<ng-template [ngTemplateOutlet]=\"label\"></ng-template>\n\t\t\t\t}\n\t\t\t</label>\n\t\t}\n\t\t<div\n\t\t\tclass=\"cds--list-box\"\n\t\t\t[ngClass]=\"{\n\t\t\t\t'cds--dropdown': type !== 'multi' && !(skeleton && fluid),\n\t\t\t\t'cds--multiselect': type === 'multi',\n\t\t\t\t'cds--multi-select--selected': type === 'multi' && getSelectedCount() > 0,\n\t\t\t\t'cds--dropdown--light': theme === 'light',\n\t\t\t\t'cds--list-box--light': theme === 'light',\n\t\t\t\t'cds--list-box--inline': inline,\n\t\t\t\t'cds--skeleton': skeleton,\n\t\t\t\t'cds--dropdown--disabled cds--list-box--disabled': disabled,\n\t\t\t\t'cds--dropdown--readonly': readonly,\n\t\t\t\t'cds--dropdown--invalid': invalid,\n\t\t\t\t'cds--dropdown--warning cds--list-box--warning': warn,\n\t\t\t\t'cds--dropdown--sm cds--list-box--sm': size === 'sm',\n\t\t\t\t'cds--dropdown--md cds--list-box--md': size === 'md',\n\t\t\t\t'cds--dropdown--lg cds--list-box--lg': size === 'lg',\n\t\t\t\t'cds--list-box--expanded': isOpen,\n\t\t\t\t'cds--list-box--invalid': invalid\n\t\t\t}\"\n\t\t\t[attr.data-invalid]=\"invalid ? true : null\">\n\t\t\t@if (skeleton && fluid) {\n\t\t\t\t<div class=\"cds--list-box__label\"></div>\n\t\t\t}\n\t\t\t<button\n\t\t\t\t#dropdownButton\n\t\t\t\t[id]=\"id\"\n\t\t\t\ttype=\"button\"\n\t\t\t\tclass=\"cds--list-box__field\"\n\t\t\t\t[ngClass]=\"{'a': isOpen}\"\n\t\t\t\t[attr.aria-expanded]=\"isOpen\"\n\t\t\t\t[attr.aria-disabled]=\"disabled\"\n\t\t\t\taria-haspopup=\"listbox\"\n\t\t\t\t(click)=\"disabled || readonly ? $event.stopPropagation() : toggleMenu()\"\n\t\t\t\t(focus)=\"fluid ? handleFocus($event) : null\"\n\t\t\t\t(blur)=\"fluid ? handleFocus($event) : onBlur()\"\n\t\t\t\t[attr.disabled]=\"disabled ? true : null\">\n\t\t\t\t@if (type === 'multi' && getSelectedCount() > 0) {\n\t\t\t\t\t<div\n\t\t\t\t\t\t(click)=\"clearSelected()\"\n\t\t\t\t\t\t(keydown.enter)=\"clearSelected()\"\n\t\t\t\t\t\tclass=\"cds--list-box__selection cds--tag--filter cds--list-box__selection--multi\"\n\t\t\t\t\t\ttabindex=\"0\"\n\t\t\t\t\t\t[title]=\"clearText\">\n\t\t\t\t\t\t{{getSelectedCount()}}\n\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\tfocusable=\"false\"\n\t\t\t\t\t\t\tpreserveAspectRatio=\"xMidYMid meet\"\n\t\t\t\t\t\t\tstyle=\"will-change: transform;\"\n\t\t\t\t\t\t\trole=\"img\"\n\t\t\t\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\t\t\t\twidth=\"16\"\n\t\t\t\t\t\t\theight=\"16\"\n\t\t\t\t\t\t\tviewBox=\"0 0 16 16\"\n\t\t\t\t\t\t\taria-hidden=\"true\">\n\t\t\t\t\t\t\t<path d=\"M12 4.7l-.7-.7L8 7.3 4.7 4l-.7.7L7.3 8 4 11.3l.7.7L8 8.7l3.3 3.3.7-.7L8.7 8z\"></path>\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t</div>\n\t\t\t\t}\n\t\t\t\t@if (isRenderString()) {\n\t\t\t\t\t<span class=\"cds--list-box__label\">{{getDisplayStringValue() | async}}</span>\n\t\t\t\t}\n\t\t\t\t@if (!isRenderString()) {\n\t\t\t\t\t<ng-template\n\t\t\t\t\t\t[ngTemplateOutletContext]=\"getRenderTemplateContext()\"\n\t\t\t\t\t\t[ngTemplateOutlet]=\"displayValue\">\n\t\t\t\t\t</ng-template>\n\t\t\t\t}\n\t\t\t\t<span class=\"cds--list-box__menu-icon\">\n\t\t\t\t\t@if (!skeleton) {\n\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\tcdsIcon=\"chevron--down\"\n\t\t\t\t\t\t\tsize=\"16\"\n\t\t\t\t\t\t\t[attr.aria-label]=\"menuButtonLabel\"\n\t\t\t\t\t\t\t[ngClass]=\"{'cds--list-box__menu-icon--open': isOpen }\">\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t}\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t\t@if (decorator) {\n\t\t\t\t<div class=\"cds--list-box__inner-wrapper--decorator\">\n\t\t\t\t\t<ng-template [ngTemplateOutlet]=\"decorator\"></ng-template>\n\t\t\t\t</div>\n\t\t\t}\n\t\t\t@if (invalid) {\n\t\t\t\t<svg\n\t\t\t\t\tclass=\"cds--list-box__invalid-icon\"\n\t\t\t\t\tcdsIcon=\"warning--filled\"\n\t\t\t\t\tsize=\"16\">\n\t\t\t\t</svg>\n\t\t\t}\n\t\t\t@if (!invalid && warn) {\n\t\t\t\t<svg\n\t\t\t\t\tcdsIcon=\"warning--alt--filled\"\n\t\t\t\t\tsize=\"16\"\n\t\t\t\t\tclass=\"cds--list-box__invalid-icon cds--list-box__invalid-icon--warning\">\n\t\t\t\t</svg>\n\t\t\t}\n\t\t\t<div\n\t\t\t\t#dropdownMenu\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--list-box--up': this.dropUp !== null && this.dropUp !== undefined ? dropUp : _dropUp\n\t\t\t\t}\">\n\t\t\t\t@if (isOpen) {\n\t\t\t\t\t<ng-content></ng-content>\n\t\t\t\t}\n\t\t\t</div>\n\t\t</div>\n\t\t@if (fluid) {\n\t\t\t<hr class=\"cds--list-box__divider\" />\n\t\t}\n\t\t@if (helperText && !invalid && !warn && !skeleton && !fluid) {\n\t\t\t<div\n\t\t\t\tclass=\"cds--form__helper-text\"\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--form__helper-text--disabled': disabled\n\t\t\t\t}\">\n\t\t\t\t@if (!isTemplate(helperText)) {\n\t\t\t\t\t{{helperText}}\n\t\t\t\t}\n\t\t\t\t@if (isTemplate(helperText)) {\n\t\t\t\t\t<ng-template [ngTemplateOutlet]=\"helperText\"></ng-template>\n\t\t\t\t}\n\t\t\t</div>\n\t\t}\n\t\t@if (invalid) {\n\t\t\t<div class=\"cds--form-requirement\">\n\t\t\t\t@if (!isTemplate(invalidText)) {\n\t\t\t\t\t{{ invalidText }}\n\t\t\t\t}\n\t\t\t\t@if (isTemplate(invalidText)) {\n\t\t\t\t\t<ng-template [ngTemplateOutlet]=\"invalidText\"></ng-template>\n\t\t\t\t}\n\t\t\t</div>\n\t\t}\n\t\t@if (!invalid && warn) {\n\t\t\t<div class=\"cds--form-requirement\">\n\t\t\t\t@if (!isTemplate(warnText)) {\n\t\t\t\t\t{{warnText}}\n\t\t\t\t}\n\t\t\t\t@if (isTemplate(warnText)) {\n\t\t\t\t\t<ng-template [ngTemplateOutlet]=\"warnText\"></ng-template>\n\t\t\t\t}\n\t\t\t</div>\n\t\t}\n\t`,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: Dropdown,\n multi: true\n },\n PlaceholderService,\n AnimationFrameService,\n AnimationFrameServiceSingleton,\n DropdownService,\n ElementService,\n EventService\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [\n NgClass,\n NgTemplateOutlet,\n IconDirective,\n AsyncPipe\n ]\n })\n], Dropdown);\nexport { Dropdown };\n","var DropdownList_1;\nimport { __decorate } from \"tslib\";\nimport { Component, Input, Output, EventEmitter, ViewChild, ElementRef, ViewChildren, ChangeDetectionStrategy, ChangeDetectorRef, inject } from \"@angular/core\";\nimport { Observable, isObservable, of } from \"rxjs\";\nimport { first } from \"rxjs/operators\";\nimport { I18n } from \"carbon-components-angular/i18n\";\nimport { AbstractDropdownView } from \"../abstract-dropdown-view.class\";\nimport { watchFocusJump } from \"../dropdowntools\";\nimport { NgClass, NgTemplateOutlet } from \"@angular/common\";\nimport { IconDirective } from \"carbon-components-angular/icon\";\nimport { DropdownService } from \"../dropdown.service\";\nimport { AnimationFrameService, AnimationFrameServiceSingleton } from \"carbon-components-angular/utils\";\n/**\n * ```html\n * <cds-dropdown-list [items]=\"listItems\"></cds-dropdown-list>\n * ```\n * ```typescript\n * listItems = [\n * \t{\n * \t\tcontent: \"item one\",\n * \t\tselected: false\n * \t},\n * \t{\n * \t\tcontent: \"item two\",\n * \t\tselected: false,\n * \t},\n * \t{\n * \t\tcontent: \"item three\",\n * \t\tselected: false\n * \t},\n * \t{\n * \t\tcontent: \"item four\",\n * \t\tselected: false\n * \t}\n * ];\n * ```\n */\nlet DropdownList = class DropdownList {\n static { DropdownList_1 = this; }\n static { this.listCount = 0; }\n set items(value) {\n if (isObservable(value)) {\n if (this._itemsSubscription) {\n this._itemsSubscription.unsubscribe();\n }\n this._itemsReady = new Observable((observer) => {\n this._itemsSubscription = value.subscribe(v => {\n this.updateList(v);\n observer.next(true);\n observer.complete();\n });\n });\n this.onItemsReady(null);\n }\n else {\n this.updateList(value);\n }\n this._originalItems = value;\n }\n get items() {\n return this._originalItems;\n }\n /**\n * Creates an instance of `DropdownList`.\n */\n constructor() {\n this.i18n = inject(I18n);\n this.elementRef = inject(ElementRef);\n this.ariaLabel = this.i18n.get().DROPDOWN_LIST.LABEL;\n this.listTpl = null;\n this.select = new EventEmitter();\n this.scroll = new EventEmitter();\n this.blurIntent = new EventEmitter();\n this.type = \"single\";\n this.showTitles = true;\n /**\n * Defines the rendering size of the `DropdownList` input component.\n */\n this.size = \"md\";\n this.listId = `listbox-${DropdownList_1.listCount++}`;\n this.highlightedItem = null;\n /**\n * Holds the list of items that will be displayed in the `DropdownList`.\n * It differs from the the complete set of items when filtering is used (but\n * it is always a subset of the total items in `DropdownList`).\n */\n this.displayItems = [];\n /**\n * Maintains the index for the selected item within the `DropdownList`.\n */\n this.index = -1;\n /**\n * Useful representation of the items, should be accessed via `getListItems`.\n */\n this._items = [];\n this.changeDetectorRef = inject(ChangeDetectorRef);\n }\n /**\n * Retrieves array of list items and index of the selected item after view has rendered.\n * Additionally, any Observables for the `DropdownList` are initialized.\n */\n ngAfterViewInit() {\n this.index = this.getListItems().findIndex(item => item.selected);\n this.setupFocusObservable();\n setTimeout(() => {\n this.doEmitSelect(true);\n });\n }\n /**\n * Removes any Observables on destruction of the component.\n */\n ngOnDestroy() {\n if (this.focusJump) {\n this.focusJump.unsubscribe();\n }\n if (this._itemsSubscription) {\n this._itemsSubscription.unsubscribe();\n }\n }\n doEmitSelect(isUpdate = true) {\n if (this.type === \"single\") {\n this.select.emit({ item: this._items.find(item => item.selected), isUpdate: isUpdate });\n }\n else {\n // abuse javascripts object mutability until we can break the API and switch to\n // { items: [], isUpdate: true }\n const selected = this.getSelected() || [];\n selected[\"isUpdate\"] = isUpdate;\n this.select.emit(selected);\n }\n }\n getItemId(index) {\n return `${this.listId}-${index}`;\n }\n /**\n * Updates the displayed list of items and then retrieves the most current properties for the `DropdownList` from the DOM.\n */\n updateList(items) {\n this._items = items.map(item => Object.assign({}, item));\n this.displayItems = this._items;\n this.updateIndex();\n this.setupFocusObservable();\n this.doEmitSelect();\n }\n /**\n * Filters the items being displayed in the DOM list.\n */\n filterBy(query = \"\") {\n if (query) {\n this.displayItems = this.getListItems().filter(item => item.content.toLowerCase().includes(query.toLowerCase()));\n // Reset index if items were found\n // Prevent selecting index in list that are undefined.\n if (this.displayItems) {\n this.index = 0;\n }\n this.changeDetectorRef.markForCheck();\n }\n else {\n this.displayItems = this.getListItems();\n }\n this.updateIndex();\n }\n /**\n * Initializes (or re-initializes) the Observable that handles switching focus to an element based on\n * key input matching the first letter of the item in the list.\n */\n setupFocusObservable() {\n if (!this.list) {\n return;\n }\n if (this.focusJump) {\n this.focusJump.unsubscribe();\n }\n let elList = Array.from(this.list.nativeElement.querySelectorAll(\"li\"));\n this.focusJump = watchFocusJump(this.list.nativeElement, elList)\n .subscribe(el => {\n el.focus();\n });\n }\n /**\n * Returns the `ListItem` that is subsequent to the selected item in the `DropdownList`.\n */\n getNextItem() {\n if (this.index < this.displayItems.length - 1) {\n this.index++;\n }\n return this.displayItems[this.index];\n }\n /**\n * Returns `true` if the selected item is not the last item in the `DropdownList`.\n */\n hasNextElement() {\n return this.index < this.displayItems.length - 1 &&\n (!(this.index === this.displayItems.length - 2) || !this.displayItems[this.index + 1].disabled);\n }\n /**\n * Returns the `HTMLElement` for the item that is subsequent to the selected item.\n */\n getNextElement() {\n // Only return native elements if they are rendered\n const elemList = this.listElementList ? this.listElementList.toArray() : [];\n if (!elemList.length) {\n return null;\n }\n /**\n * Start checking from next index\n * Continue looping through the list until a non disabeled element is found or\n * end of list is reached\n */\n for (let i = this.index + 1; i < elemList.length; i++) {\n // If the values in the list are not disabled\n if (!this.displayItems[i].disabled) {\n this.index = i;\n return elemList[i].nativeElement;\n }\n }\n return elemList[this.index]?.nativeElement;\n }\n /**\n * Returns the `ListItem` that precedes the selected item within `DropdownList`.\n */\n getPrevItem() {\n if (this.index > 0) {\n this.index--;\n }\n return this.displayItems[this.index];\n }\n /**\n * Returns `true` if the selected item is not the first in the list.\n */\n hasPrevElement() {\n return this.index > 0 && (!(this.index === 1) || !this.displayItems[0].disabled);\n }\n /**\n * Returns the `HTMLElement` for the item that precedes the selected item.\n */\n getPrevElement() {\n // Only return native elements if they are rendered\n const elemList = this.listElementList ? this.listElementList.toArray() : [];\n if (!elemList.length) {\n return null;\n }\n /**\n * Start checking from next index\n * Continue looping through the list until a non disabeled element is found or\n * end of list is reached\n */\n for (let i = this.index - 1; i < this.index && i >= 0; i--) {\n // If the values in the list are not disabled\n if (!this.displayItems[i].disabled) {\n this.index = i;\n return elemList[i].nativeElement;\n }\n }\n return elemList[this.index].nativeElement;\n }\n /**\n * Returns the `ListItem` that is selected within `DropdownList`.\n */\n getCurrentItem() {\n if (this.index < 0) {\n return this.displayItems[0];\n }\n return this.displayItems[this.index];\n }\n /**\n * Returns the `HTMLElement` for the item that is selected within the `DropdownList`.\n */\n getCurrentElement() {\n if (this.index < 0) {\n return this.listElementList.first.nativeElement;\n }\n return this.listElementList.toArray()[this.index].nativeElement;\n }\n /**\n * Returns the items as an Array\n */\n getListItems() {\n return this._items;\n }\n /**\n * Returns a list containing the selected item(s) in the `DropdownList`.\n */\n getSelected() {\n let selected = this.getListItems().filter(item => item.selected);\n if (selected.length === 0) {\n return [];\n }\n return selected;\n }\n /**\n * Transforms array input list of items to the correct state by updating the selected item(s).\n */\n propagateSelected(value) {\n // if we get a non-array, log out an error (since it is one)\n if (!Array.isArray(value)) {\n console.error(`${this.constructor.name}.propagateSelected expects an Array<ListItem>, got ${JSON.stringify(value)}`);\n }\n this.onItemsReady(() => {\n const selectedNewItems = [];\n for (let newItem of value) {\n if (newItem && newItem.selected) {\n // copy the item\n let tempNewItem = Object.assign({}, newItem);\n // deleted selected because it's what we _want_ to change\n delete tempNewItem.selected;\n // stringify for compare later\n tempNewItem = JSON.stringify(tempNewItem);\n // add to the list of selected items\n selectedNewItems.push(tempNewItem);\n }\n }\n // loop through the list items and update the `selected` state for matching items in `value`\n for (let oldItem of this.getListItems()) {\n // fast path when no items are selected\n if (selectedNewItems.length === 0) {\n oldItem.selected = false;\n continue;\n }\n // copy the item\n let tempOldItem = Object.assign({}, oldItem);\n // deleted selected because it's what we _want_ to change\n delete tempOldItem.selected;\n // stringify for compare\n tempOldItem = JSON.stringify(tempOldItem);\n for (let selectedNewItem of selectedNewItems) {\n // do the compare\n if (tempOldItem.includes(selectedNewItem)) {\n oldItem.selected = true;\n // if we've found a matching item, we can stop looping\n break;\n }\n else {\n oldItem.selected = false;\n }\n }\n }\n });\n }\n /**\n * Initializes focus in the list, effectively a wrapper for `getCurrentElement().focus()`\n */\n initFocus() {\n if (this.index < 0) {\n this.updateIndex();\n }\n this.list.nativeElement.focus();\n // `index` is resolved synchronously above, and both callers already defer\n // `initFocus` until the list is rendered, so there's nothing left to wait for\n this.highlightedItem = this.getItemId(this.index);\n this.changeDetectorRef.markForCheck();\n }\n updateIndex() {\n // initialize index on the first selected item or\n // on the next non disabled item if no items are selected\n // in case, if all items are disabled, the index value will remain same\n const selected = this.getSelected();\n if (selected.length) {\n this.index = this.displayItems.indexOf(selected[0]);\n }\n else if (this.index < 0 && this.hasNextElement()) {\n this.getNextElement();\n }\n }\n /**\n * Manages the keyboard accessibility for navigation and selection within a `DropdownList`.\n */\n navigateList(event) {\n if (event.key === \"Enter\" || event.key === \" \") {\n if (this.listElementList.some(option => option.nativeElement === event.target)) {\n event.preventDefault();\n }\n if (event.key === \"Enter\") {\n this.doClick(event, this.getCurrentItem());\n }\n }\n else if (event.key === \"ArrowDown\" || event.key === \"ArrowUp\") {\n event.preventDefault();\n if (event.key === \"ArrowDown\") {\n if (this.hasNextElement()) {\n this.getNextElement()?.scrollIntoView({ block: \"end\" });\n }\n else {\n this.blurIntent.emit(\"bottom\");\n }\n }\n else if (event.key === \"ArrowUp\") {\n if (this.hasPrevElement()) {\n this.getPrevElement().scrollIntoView({ block: \"nearest\" });\n }\n else {\n this.blurIntent.emit(\"top\");\n }\n }\n // `getNextElement`/`getPrevElement` update `index` synchronously, and this\n // runs inside the keydown handler, so the following check picks it up\n this.highlightedItem = this.getItemId(this.index);\n }\n }\n /**\n * Emits the selected item or items after a mouse click event has occurred.\n */\n doClick(event, item) {\n event.preventDefault();\n if (item && !item.disabled) {\n this.list.nativeElement.focus();\n if (this.type === \"single\") {\n item.selected = true;\n // reset the selection\n for (let otherItem of this.getListItems()) {\n if (item !== otherItem) {\n otherItem.selected = false;\n }\n }\n }\n else {\n item.selected = !item.selected;\n }\n this.index = this.displayItems.indexOf(item);\n this.highlightedItem = this.getItemId(this.index);\n this.doEmitSelect(false);\n }\n }\n onItemFocus(index) {\n const element = this.listElementList.toArray()[index].nativeElement;\n element.classList.add(\"cds--list-box__menu-item--highlighted\");\n element.tabIndex = 0;\n }\n onItemBlur(index) {\n const element = this.listElementList.toArray()[index].nativeElement;\n element.classList.remove(\"cds--list-box__menu-item--highlighted\");\n element.tabIndex = -1;\n }\n /**\n * Emits the scroll event of the options list\n */\n emitScroll(event) {\n const atTop = event.srcElement.scrollTop === 0;\n const atBottom = event.srcElement.scrollHeight - event.srcElement.scrollTop === event.srcElement.clientHeight;\n const customScrollEvent = { atTop, atBottom, event };\n this.scroll.emit(customScrollEvent);\n }\n /**\n * Subscribe the function passed to an internal observable that will resolve once the items are ready\n */\n onItemsReady(subcription) {\n // this subscription will auto unsubscribe because of the `first()` pipe\n (this._itemsReady || of(true)).pipe(first()).subscribe(subcription);\n }\n reorderSelected(moveFocus = true) {\n this.displayItems = [...this.getSelected(), ...this.getListItems().filter(item => !item.selected)];\n this.changeDetectorRef.markForCheck();\n if (moveFocus) {\n setTimeout(() => {\n this.updateIndex();\n this.highlightedItem = this.getItemId(this.index);\n this.changeDetectorRef.markForCheck();\n });\n }\n }\n static { this.ctorParameters = () => []; }\n static { this.propDecorators = {\n ariaLabel: [{ type: Input }],\n items: [{ type: Input }],\n listTpl: [{ type: Input }],\n select: [{ type: Output }],\n scroll: [{ type: Output }],\n blurIntent: [{ type: Output }],\n list: [{ type: ViewChild, args: [\"list\", { static: true },] }],\n type: [{ type: Input }],\n showTitles: [{ type: Input }],\n listElementList: [{ type: ViewChildren, args: [\"listItem\",] }]\n }; }\n};\nDropdownList = DropdownList_1 = __decorate([\n Component({\n selector: \"cds-dropdown-list, ibm-dropdown-list\",\n template: `\n\t\t<ul\n\t\t\t#list\n\t\t\t[id]=\"listId\"\n\t\t\trole=\"listbox\"\n\t\t\tclass=\"cds--list-box__menu cds--multi-select\"\n\t\t\t(scroll)=\"emitScroll($event)\"\n\t\t\t(keydown)=\"navigateList($event)\"\n\t\t\ttabindex=\"0\"\n\t\t\t[attr.aria-label]=\"ariaLabel\"\n\t\t\t[attr.aria-activedescendant]=\"highlightedItem\">\n\t\t\t@for (item of displayItems; track item; let i = $index) {\n\t\t\t\t<li\n\t\t\t\t\trole=\"option\"\n\t\t\t\t\t(click)=\"doClick($event, item)\"\n\t\t\t\t\tclass=\"cds--list-box__menu-item\"\n\t\t\t\t\t[attr.aria-selected]=\"item.selected\"\n\t\t\t\t\t[id]=\"getItemId(i)\"\n\t\t\t\t\t[attr.tabindex]=\"highlightedItem === getItemId(i) ? 0 : null\"\n\t\t\t\t\t[attr.title]=\" showTitles ? item.content : null\"\n\t\t\t\t\t[attr.disabled]=\"item.disabled ? true : null\"\n\t\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t\t'cds--list-box__menu-item--active': item.selected,\n\t\t\t\t\t\t'cds--list-box__menu-item--highlighted': highlightedItem === getItemId(i)\n\t\t\t\t\t}\">\n\t\t\t\t\t<div\n\t\t\t\t\t\t#listItem\n\t\t\t\t\t\ttabindex=\"-1\"\n\t\t\t\t\t\tclass=\"cds--list-box__menu-item__option\">\n\t\t\t\t\t\t@if (!listTpl && type === 'multi') {\n\t\t\t\t\t\t\t<div class=\"cds--form-item cds--checkbox-wrapper\">\n\t\t\t\t\t\t\t\t<label\n\t\t\t\t\t\t\t\t\t[attr.data-contained-checkbox-state]=\"item.selected\"\n\t\t\t\t\t\t\t\t\tclass=\"cds--checkbox-label\">\n\t\t\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\t\t\tclass=\"cds--checkbox\"\n\t\t\t\t\t\t\t\t\t\ttype=\"checkbox\"\n\t\t\t\t\t\t\t\t\t\t[checked]=\"item.selected\"\n\t\t\t\t\t\t\t\t\t\t[disabled]=\"item.disabled\"\n\t\t\t\t\t\t\t\t\t\ttabindex=\"-1\">\n\t\t\t\t\t\t\t\t\t<span class=\"cds--checkbox-appearance\"></span>\n\t\t\t\t\t\t\t\t\t<span class=\"cds--checkbox-label-text\">{{item.content}}</span>\n\t\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t}\n\t\t\t\t\t\t@if (!listTpl && type === 'single') {\n\t\t\t\t\t\t\t{{item.content}}\n\t\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\t\tcdsIcon=\"checkmark\"\n\t\t\t\t\t\t\t\tsize=\"16\"\n\t\t\t\t\t\t\t\tclass=\"cds--list-box__menu-item__selected-icon\">\n\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t}\n\t\t\t\t\t\t@if (listTpl) {\n\t\t\t\t\t\t\t<ng-template\n\t\t\t\t\t\t\t\t[ngTemplateOutletContext]=\"{item: item}\"\n\t\t\t\t\t\t\t\t[ngTemplateOutlet]=\"listTpl\">\n\t\t\t\t\t\t\t</ng-template>\n\t\t\t\t\t\t}\n\t\t\t\t\t</div>\n\t\t\t\t</li>\n\t\t\t}\n\t\t</ul>\n\t`,\n providers: [\n {\n provide: AbstractDropdownView,\n useExisting: DropdownList\n },\n DropdownService,\n AnimationFrameService,\n AnimationFrameServiceSingleton\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [NgClass, IconDirective, NgTemplateOutlet]\n })\n], DropdownList);\nexport { DropdownList };\n","import { fromEvent } from \"rxjs\";\nimport { debounceTime, map, filter } from \"rxjs/operators\";\n/**\n * returns an observable bound to keydown events that\n * filters to a single element where the first letter of\n * it's textContent matches the key pressed\n *\n * @param target element to watch\n * @param elements elements to search\n */\nexport function watchFocusJump(target, elements) {\n return fromEvent(target, \"keydown\")\n .pipe(debounceTime(150), map((ev) => {\n let el = elements.find((itemEl) => itemEl.textContent.trim().toLowerCase().startsWith(ev.key));\n if (el) {\n return el;\n }\n }), filter(el => !!el));\n}\n/** bundle of functions to aid in manipulating tree structures */\nexport const treetools = {\n /** finds an item in a set of items and returns the item and path to the item as an array */\n find: function (items, itemToFind, path = []) {\n let found;\n for (let i of items) {\n if (i === itemToFind) {\n path.push(i);\n found = i;\n }\n if (i.items && !found) {\n path.push(i);\n found = this.find(i.items, itemToFind, path).found;\n if (!found) {\n path = [];\n }\n }\n }\n return { found, path };\n }\n};\n","import { __decorate } from \"tslib\";\nimport { Input, Directive, ElementRef, HostListener, inject } from \"@angular/core\";\nlet ScrollableList = class ScrollableList {\n constructor() {\n this.nScrollableList = null;\n this.scrollEnabled = true;\n this.scrollBy = 10;\n this.elementRef = inject(ElementRef);\n this.canScrollUp = false;\n this.canScrollDown = false;\n this.list = this.elementRef.nativeElement;\n }\n ngOnChanges(changes) {\n if (changes.scrollEnabled) {\n if (changes.scrollEnabled.currentValue) {\n this.list.style.overflow = \"hidden\";\n this.scrollUpTarget.style.display = \"flex\";\n this.scrollDownTarget.style.display = \"flex\";\n this.canScrollUp = true;\n this.canScrollDown = true;\n this.updateScrollHeight();\n this.checkScrollArrows();\n setTimeout(() => {\n this.checkScrollArrows();\n });\n }\n else {\n this.scrollUpTarget.style.display = \"none\";\n this.scrollDownTarget.style.display = \"none\";\n this.canScrollUp = false;\n this.canScrollDown = false;\n this.list.style.height = null;\n this.list.style.overflow = null;\n clearInterval(this.hoverScrollInterval);\n }\n }\n }\n ngAfterViewInit() {\n if (this.nScrollableList) {\n this.list = this.elementRef.nativeElement.querySelector(this.nScrollableList);\n }\n this.scrollUpTarget.addEventListener(\"mouseover\", () => this.onHoverUp(true));\n this.scrollUpTarget.addEventListener(\"mouseout\", () => this.onHoverUp(false));\n this.scrollDownTarget.addEventListener(\"mouseover\", () => this.onHoverDown(true));\n this.scrollDownTarget.addEventListener(\"mouseout\", () => this.onHoverDown(false));\n }\n updateScrollHeight() {\n if (this.scrollEnabled) {\n const container = this.elementRef.nativeElement.parentElement;\n const containerRect = container.getBoundingClientRect();\n const innerHeightDiff = this.list.getBoundingClientRect().top - containerRect.top;\n const outerHeightDiff = containerRect.height - (containerRect.bottom - window.innerHeight);\n // 40 gives us some padding between the bottom of the list,\n // the bottom of the window, and the scroll down button\n const height = outerHeightDiff - innerHeightDiff - 40;\n this.list.style.height = `${height}px`;\n }\n }\n checkScrollArrows() {\n const scrollUpHeight = this.scrollUpTarget.offsetHeight;\n const scrollDownHeight = this.scrollDownTarget.offsetHeight;\n if (this.list.scrollTop === 0) {\n if (this.canScrollUp) {\n this.list.style.height = `${parseInt(this.list.style.height, 10) + scrollUpHeight}px`;\n }\n this.scrollUpTarget.style.display = \"none\";\n this.canScrollUp = false;\n }\n else if (this.list.scrollTop === this.list.scrollTopMax) {\n if (this.canScrollDown) {\n this.list.style.height = `${parseInt(this.list.style.height, 10) + scrollDownHeight}px`;\n }\n this.scrollDownTarget.style.display = \"none\";\n this.canScrollDown = false;\n }\n else {\n if (!this.canScrollUp) {\n this.list.style.height = `${parseInt(this.list.style.height, 10) - scrollUpHeight}px`;\n }\n if (!this.canScrollDown) {\n this.list.style.height = `${parseInt(this.list.style.height, 10) - scrollDownHeight}px`;\n }\n this.scrollUpTarget.style.display = \"flex\";\n this.scrollDownTarget.style.display = \"flex\";\n this.canScrollUp = true;\n this.canScrollDown = true;\n }\n }\n onWheel(event) {\n if (event.deltaY < 0) {\n this.list.scrollTop -= this.scrollBy;\n }\n else {\n this.list.scrollTop += this.scrollBy;\n }\n // only prevent the parent/window from scrolling if we can scroll\n if (!(this.list.scrollTop === this.list.scrollTopMax || this.list.scrollTop === 0)) {\n event.preventDefault();\n event.stopPropagation();\n }\n this.checkScrollArrows();\n }\n onTouchStart(event) {\n if (event.touches[0]) {\n this.lastTouch = event.touches[0].clientY;\n }\n }\n onTouchMove(event) {\n event.preventDefault();\n event.stopPropagation();\n if (event.touches[0]) {\n const touch = event.touches[0];\n this.list.scrollTop += this.lastTouch - touch.clientY;\n this.lastTouch = touch.clientY;\n this.checkScrollArrows();\n }\n }\n hoverScrollBy(hovering, amount) {\n if (hovering) {\n this.hoverScrollInterval = setInterval(() => {\n this.list.scrollTop += amount;\n this.checkScrollArrows();\n }, 1);\n }\n else {\n clearInterval(this.hoverScrollInterval);\n }\n }\n onHoverUp(hovering) {\n // how many px/lines to scroll by on hover\n // 3 is just a random number that felt good\n // 1 and 2 are too slow, 4 works but it might be a tad fast\n this.hoverScrollBy(hovering, -3);\n }\n onHoverDown(hovering) {\n this.hoverScrollBy(hovering, 3);\n }\n onKeyDown(event) {\n if (event.key === \"ArrowDown\" || event.key === \"ArrowUp\") {\n this.checkScrollArrows();\n }\n }\n static { this.ctorParameters = () => []; }\n static { this.propDecorators = {\n nScrollableList: [{ type: Input }],\n scrollEnabled: [{ type: Input }],\n scrollUpTarget: [{ type: Input }],\n scrollDownTarget: [{ type: Input }],\n scrollBy: [{ type: Input }],\n onWheel: [{ type: HostListener, args: [\"wheel\", [\"$event\"],] }],\n onTouchStart: [{ type: HostListener, args: [\"touchstart\", [\"$event\"],] }],\n onTouchMove: [{ type: HostListener, args: [\"touchmove\", [\"$event\"],] }],\n onKeyDown: [{ type: HostListener, args: [\"keydown\", [\"$event\"],] }]\n }; }\n};\nScrollableList = __decorate([\n Directive({\n selector: \"[cdsScrollableList], [ibmScrollableList]\",\n exportAs: \"scrollable-list\",\n standalone: true\n })\n], ScrollableList);\nexport { ScrollableList };\n","import { __decorate } from \"tslib\";\nimport { NgModule } from \"@angular/core\";\nimport { CommonModule } from \"@angular/common\";\nimport { FormsModule } from \"@angular/forms\";\nimport { Dropdown } from \"./dropdown.component\";\nimport { DropdownList } from \"./list/dropdown-list.component\";\nimport { AbstractDropdownView } from \"./abstract-dropdown-view.class\";\nimport { ScrollableList } from \"./scrollable-list.directive\";\nimport { I18nModule } from \"carbon-components-angular/i18n\";\nimport { PlaceholderModule } from \"carbon-components-angular/placeholder\";\nimport { DropdownService } from \"./dropdown.service\";\nimport { UtilsModule } from \"carbon-components-angular/utils\";\nimport { IconModule } from \"carbon-components-angular/icon\";\nlet DropdownModule = class DropdownModule {\n};\nDropdownModule = __decorate([\n NgModule({\n exports: [\n Dropdown,\n DropdownList,\n ScrollableList,\n AbstractDropdownView\n ],\n imports: [\n CommonModule,\n FormsModule,\n I18nModule,\n PlaceholderModule,\n UtilsModule,\n IconModule,\n Dropdown,\n DropdownList,\n ScrollableList,\n AbstractDropdownView\n ],\n providers: [DropdownService]\n })\n], DropdownModule);\nexport { DropdownModule };\n"],"names":[],"sourceRoot":""}
|
|
@@ -524,8 +524,8 @@
|
|
|
524
524
|
window['TAGS_OPTIONS'] = {"dev-only":{"excludeFromDocsStories":true},"docs-only":{"excludeFromSidebar":true},"test-only":{"excludeFromSidebar":true,"excludeFromDocsStories":true}};</script><script type="module">import './sb-preview/runtime.js';
|
|
525
525
|
|
|
526
526
|
|
|
527
|
-
import './runtime~main.
|
|
527
|
+
import './runtime~main.ec69f997.iframe.bundle.js';
|
|
528
528
|
|
|
529
529
|
import './4467.bb0e41c8.iframe.bundle.js';
|
|
530
530
|
|
|
531
|
-
import './main.
|
|
531
|
+
import './main.383af198.iframe.bundle.js';</script></body></html>
|