text: import{r as a,c as e,h as t,H as i,g as c}from"./p-cdf3f581.js";import{a as r}from"./p-fb698d64.js";import{I as o}from"./p-2152cae9.js";import{T as s,C as l,S as n,I as p}from"./p-6c45a726.js";const d=class{constructor(t){a(this,t),this.calciteListItemChange=e(this,"calciteListItemChange",7),this.calciteListItemRemove=e(this,"calciteListItemRemove",7),this.calciteListItemPropsChange=e(this,"calciteListItemPropsChange",7),this.calciteListItemValueChange=e(this,"calciteListItemValueChange",7),this.disabled=!1,this.disableDeselect=!1,this.icon=null,this.removable=!1,this.selected=!1,this.textRemove=s.remove,this.pickListClickHandler=a=>{this.disabled||this.disableDeselect&&this.selected||(this.shiftPressed=a.shiftKey,this.selected=!this.selected)},this.pickListKeyDownHandler=a=>{if(" "===a.key){if(a.preventDefault(),this.disableDeselect&&this.selected)return;this.selected=!this.selected}},this.removeClickHandler=()=>{this.calciteListItemRemove.emit()}}descriptionWatchHandler(){this.calciteListItemPropsChange.emit()}labelWatchHandler(){this.calciteListItemPropsChange.emit()}metadataWatchHandler(){this.calciteListItemPropsChange.emit()}selectedWatchHandler(){this.calciteListItemChange.emit({item:this.el,value:this.value,selected:this.selected,shiftPressed:this.shiftPressed}),this.shiftPressed=!1}textDescriptionWatchHandler(){this.calciteListItemPropsChange.emit()}textLabelWatchHandler(){this.calciteListItemPropsChange.emit()}valueWatchHandler(a,e){this.calciteListItemValueChange.emit({oldValue:e,newValue:a})}async toggleSelected(a){this.disabled||(this.selected="boolean"==typeof a?a:!this.selected)}async setFocus(){var a;null===(a=this.focusEl)||void 0===a||a.focus()}renderIcon(){const{icon:a}=this;return a?t("span",{class:l.icon},t("calcite-icon",{scale:"s",icon:a===o.circle?p.circle:p.checked})):null}renderRemoveAction(){return this.removable?t("calcite-action",{scale:"s",class:l.remove,icon:p.remove,text:this.textRemove,onClick:this.removeClickHandler}):null}renderSecondaryAction(){return r(this.el,n.secondaryAction)||this.removable?t("div",{class:l.action},t("slot",{name:n.secondaryAction},this.renderRemoveAction())):null}render(){const a=this.description||this.textDescription,e=this.label||this.textLabel;return t(i,{role:"menuitemcheckbox","aria-checked":this.selected.toString()},t("label",{class:l.label,onClick:this.pickListClickHandler,onKeyDown:this.pickListKeyDownHandler,tabIndex:0,ref:a=>this.focusEl=a,"aria-label":e},this.renderIcon(),t("div",{class:l.textContainer},t("span",{class:l.title},e),a?t("span",{class:l.description},a):null)),this.renderSecondaryAction())}get el(){return c(this)}static get watchers(){return{description:["descriptionWatchHandler"],label:["labelWatchHandler"],metadata:["metadataWatchHandler"],selected:["selectedWatchHandler"],textDescription:["textDescriptionWatchHandler"],textLabel:["textLabelWatchHandler"],value:["valueWatchHandler"]}}};d.style=":host{box-sizing:border-box;color:var(--calcite-app-foreground);font-family:var(--calcite-app-font-family);font-size:var(--calcite-app-font-size-0);line-height:var(--calcite-app-line-height);background-color:var(--calcite-app-background)}:host *{box-sizing:border-box}:host{box-shadow:0 -1px 0 var(--calcite-app-border) inset;align-items:center;background-color:var(--calcite-app-background-clear);display:flex;margin:0;color:var(--calcite-app-foreground);transition:background-color var(--calcite-app-animation-time-fast) var(--calcite-app-easing-function);animation:calcite-app-fade-in var(--calcite-app-animation-time) var(--calcite-app-easing-function)}:host([hidden]){display:none}:host([theme=dark]){--calcite-app-background:#404040;--calcite-app-foreground:#dfdfdf;--calcite-app-background-hover:#2b2b2b;--calcite-app-foreground-hover:#f3f3f3;--calcite-app-background-active:#151515;--calcite-app-foreground-active:#59d6ff;--calcite-app-foreground-subtle:#eaeaea;--calcite-app-background-content:#2b2b2b;--calcite-app-border:#2b2b2b;--calcite-app-border-hover:#2b2b2b;--calcite-app-border-subtle:#2b2b2b;--calcite-app-scrim:rgba(64, 64, 64, 0.8)}:host([theme=light]){--calcite-app-background:#ffffff;--calcite-app-foreground:#404040;--calcite-app-background-hover:#eaeaea;--calcite-app-foreground-hover:#2b2b2b;--calcite-app-background-active:#c7eaff;--calcite-app-foreground-active:#00619b;--calcite-app-foreground-subtle:#757575;--calcite-app-foreground-link:#007ac2;--calcite-app-background-content:#f3f3f3;--calcite-app-background-clear:transparent;--calcite-app-border:#eaeaea;--calcite-app-border-hover:#dfdfdf;--calcite-app-border-subtle:#f3f3f3;--calcite-app-border-active:#00619b;--calcite-app-disabled-opacity:0.25;--calcite-app-scrim:rgba(255, 255, 255, 0.8)}:host(:hover),:host(:focus){background-color:var(--calcite-app-background-hover)}.icon{color:var(--calcite-app-foreground-link);flex:0 0 0%;line-height:0;width:var(--calcite-app-icon-size);margin:0 var(--calcite-app-side-spacing-quarter);opacity:0}:host([selected]) .icon{transition:opacity var(--calcite-app-animation-time-fast) var(--calcite-app-easing-function);opacity:1}.label{display:flex;flex:1 1 auto;padding:var(--calcite-app-cap-spacing-half) var(--calcite-app-side-spacing-quarter);align-items:center;cursor:pointer;outline-offset:0;outline-color:transparent;transition:outline-offset var(--calcite-app-animation-time-fast) ease-in-out, outline-color var(--calcite-app-animation-time-fast) ease-in-out}.label:focus{outline:2px solid var(--calcite-ui-blue-1);outline-offset:-2px}.text-container{display:flex;flex-flow:column nowrap;overflow:hidden;pointer-events:none;padding:0 var(--calcite-app-side-spacing-quarter)}.title{font-size:var(--calcite-app-font-size--1);word-wrap:break-word;word-break:break-word}.description{color:var(--calcite-app-foreground-subtle);font-family:var(--calcite-app-font-family-monospace);font-size:var(--calcite-app-font-size--2);margin-top:var(--calcite-app-cap-spacing-quarter);word-wrap:break-word;word-break:break-word}.action{align-items:center;display:flex;flex:0 0 auto;justify-self:flex-end;margin:var(--calcite-app-cap-spacing-quarter) var(--calcite-app-side-spacing-half)}";export{d as calcite_pick_list_item}