UNPKG

@esri/calcite-components

Version:

Web Components for Esri's Calcite Design System.

1 lines 6.9 kB
var __awaiter=this&&this.__awaiter||function(t,e,i,a){function r(t){return t instanceof i?t:new i((function(e){e(t)}))}return new(i||(i=Promise))((function(i,n){function s(t){try{l(a.next(t))}catch(e){n(e)}}function o(t){try{l(a["throw"](t))}catch(e){n(e)}}function l(t){t.done?i(t.value):r(t.value).then(s,o)}l((a=a.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var i={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},a,r,n,s;return s={next:o(0),throw:o(1),return:o(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function o(t){return function(e){return l([t,e])}}function l(s){if(a)throw new TypeError("Generator is already executing.");while(i)try{if(a=1,r&&(n=s[0]&2?r["return"]:s[0]?r["throw"]||((n=r["return"])&&n.call(r),0):r.next)&&!(n=n.call(r,s[1])).done)return n;if(r=0,n)s=[s[0]&2,n.value];switch(s[0]){case 0:case 1:n=s;break;case 4:i.label++;return{value:s[1],done:false};case 5:i.label++;r=s[1];s=[0];continue;case 7:s=i.ops.pop();i.trys.pop();continue;default:if(!(n=i.trys,n=n.length>0&&n[n.length-1])&&(s[0]===6||s[0]===2)){i=0;continue}if(s[0]===3&&(!n||s[1]>n[0]&&s[1]<n[3])){i.label=s[1];break}if(s[0]===6&&i.label<n[1]){i.label=n[1];n=s;break}if(n&&i.label<n[2]){i.label=n[2];i.ops.push(s);break}if(n[2])i.ops.pop();i.trys.pop();continue}s=e.call(t,i)}catch(o){s=[6,o];r=0}finally{a=n=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};import{r as registerInstance,c as createEvent,h,g as getElement}from"./index-8fd57462.js";import"./dom-d9ba1da4.js";import"./debounce-4dee3b1c.js";import"./array-af19adb2.js";import{I as ICON_TYPES}from"./resources-e06851d2.js";import{m as mutationObserverCallback,d as deselectSiblingItems,s as selectSiblings,h as handleFilter,g as getItemData,k as keyDownHandler,i as initialize,a as initializeObserver,c as cleanUpObserver,r as removeItem,b as calciteListItemChangeHandler,e as calciteListItemValueChangeHandler,f as setUpItems,j as setFocus,L as List}from"./shared-list-render-e4a67a06.js";var calcitePickListCss="@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}:host{-webkit-box-sizing:border-box;box-sizing:border-box;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-2);font-size:var(--calcite-font-size--1)}:host *{-webkit-box-sizing:border-box;box-sizing:border-box}:host{--calcite-icon-size:1rem;--calcite-spacing-quarter:0.25rem;--calcite-spacing-half:0.5rem;--calcite-spacing-three-quarters:0.75rem;--calcite-spacing:1rem;--calcite-spacing-plus-quarter:1.25rem;--calcite-spacing-plus-half:1.5rem;--calcite-spacing-double:2rem;--calcite-menu-min-width:10rem;--calcite-header-min-height:3rem;--calcite-footer-min-height:3rem}:root{--calcite-popper-transition:150ms ease-in-out}:host([hidden]){display:none}:host{-ms-flex-align:stretch;align-items:stretch;background-color:transparent;display:-ms-flexbox;display:flex;-ms-flex:1 0 auto;flex:1 0 auto;-ms-flex-flow:column;flex-flow:column;padding-bottom:var(--calcite-cap-spacing);position:relative}header{background-color:var(--calcite-ui-foreground-1);display:-ms-flexbox;display:flex;-ms-flex-pack:end;justify-content:flex-end;-ms-flex-align:stretch;align-items:stretch;margin-bottom:var(--calcite-spacing-quarter);-webkit-box-shadow:0 1px 0 var(--calcite-ui-border-3);box-shadow:0 1px 0 var(--calcite-ui-border-3)}header.sticky{position:-webkit-sticky;position:sticky;top:0;z-index:1}calcite-filter{margin-bottom:1px}calcite-scrim{display:-ms-flexbox;display:flex;-ms-flex:0 0 auto;flex:0 0 auto;-ms-flex-flow:column;flex-flow:column;pointer-events:none}:host([loading][disabled]){min-height:2rem}";var CalcitePickList=function(){function t(t){registerInstance(this,t);this.calciteListChange=createEvent(this,"calciteListChange",7);this.disabled=false;this.filterEnabled=false;this.loading=false;this.multiple=false;this.selectedValues=new Map;this.dataForFilter=[];this.lastSelectedItem=null;this.observer=new MutationObserver(mutationObserverCallback.bind(this));this.deselectSiblingItems=deselectSiblingItems.bind(this);this.selectSiblings=selectSiblings.bind(this);this.handleFilter=handleFilter.bind(this);this.getItemData=getItemData.bind(this);this.keyDownHandler=keyDownHandler.bind(this)}t.prototype.connectedCallback=function(){initialize.call(this);initializeObserver.call(this)};t.prototype.disconnectedCallback=function(){cleanUpObserver.call(this)};t.prototype.calciteListItemRemoveHandler=function(t){removeItem.call(this,t)};t.prototype.calciteListItemChangeHandler=function(t){calciteListItemChangeHandler.call(this,t)};t.prototype.calciteListItemPropsChangeHandler=function(t){t.stopPropagation();this.setUpFilter()};t.prototype.calciteListItemValueChangeHandler=function(t){calciteListItemValueChangeHandler.call(this,t)};t.prototype.setUpItems=function(){setUpItems.call(this,"calcite-pick-list-item")};t.prototype.setUpFilter=function(){if(this.filterEnabled){this.dataForFilter=this.getItemData()}};t.prototype.getSelectedItems=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,this.selectedValues]}))}))};t.prototype.setFocus=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,setFocus.call(this)]}))}))};t.prototype.getIconType=function(){return this.multiple?ICON_TYPES.square:ICON_TYPES.circle};t.prototype.render=function(){return h(List,{onKeyDown:this.keyDownHandler,props:this})};Object.defineProperty(t.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return t}();CalcitePickList.style=calcitePickListCss;export{CalcitePickList as calcite_pick_list};