1import{K as l,W as c,O as r,P as o,R as d,T as n}from"./signal.CNCfU7Hw.js";import{e as h,n as p}from"./ref.D1KjxGgY.js";import{b as i}from"./dom.CLWNH6N5.js";import{u as m}from"./useSetFocus.DmdLAgUP.js";import{u}from"./useInteractive.DKrGT6nQ.js";import"./directive-helpers.DS6Yk2X1.js";import"./guid.LcV_DAvu.js";import"./index.B3LrT0DQ.js";import"./proxyExports-CXEnG2Az.Ci2qtAtz.js";import"./index.DV2a7jmW.js";import"./index.Lhiybazs.js";import"./component.DaY1qw_V.js";const f=d`:host([disabled]){cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-opacity-disabled)}:host([disabled]) *,:host([disabled]) ::slotted(*){pointer-events:none}:host{display:block}.container{display:flex;flex-wrap:wrap;gap:var(--calcite-card-group-space, var(--calcite-card-group-gap, var(--calcite-spacing-md)))}:host([hidden]){display:none}[hidden]{display:none}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}.interaction-container{display:contents}`,b={container:"container"};class g extends l{constructor(){super(),this.items=[],this.slotRef=h(),this.focusSetter=m()(this),this.interactiveContainer=u(this),this.disabled=!1,this.selectedItems=[],this.selectionMode="none",this.calciteCardGroupSelect=c({cancelable:!1}),this.listen("calciteInternalCardKeyEvent",this.calciteInternalCardKeyEventListener),this.listen("calciteCardSelect",this.calciteCardSelectListener)}static{this.properties={disabled:[7,{},{reflect:!0,type:Boolean}],label:1,selectedItems:[0,{},{attribute:!1}],selectionMode:[3,{},{reflect:!0}]}}static{this.styles=f}async setFocus(e){return this.focusSetter(()=>this.items[0],e)}willUpdate(e){e.has("selectionMode")&&this.hasUpdated&&this.updateItemsOnSelectionModeChange()}loaded(){this.updateSelectedItems()}calciteInternalCardKeyEventListener(e){if(e.composedPath().includes(this.el)){const s=this.items.filter(t=>!t.disabled);
1switch(e.detail.key){case"ArrowRight":i(s,e.target,"next",!0,!1);break;case"ArrowLeft":i(s,e.target,"previous",!0,!1);break;case"Home":i(s,e.target,"first",!0,!1);break;case"End":i(s,e.target,"last",!0,!1);break}}}calciteCardSelectListener(e){e.composedPath().includes(this.el)&&!e.target.selectable&&this.setSelectedItems(!0,e.target)}updateItemsOnSelectionModeChange(){this.updateSlottedItems(this.slotRef.value),this.updateSelectedItems()}updateItemsOnSlotChange(e){this.updateSlottedItems(e.target),this.updateSelectedItems()}updateSlottedItems(e){this.items=e?.assignedElements({flatten:!0}).filter(s=>s?.matches("calcite-card"))||[]}updateSelectedItems(){this.items.forEach(e=>{e.selectionMode=this.selectionMode}),this.setSelectedItems(!1)}setSelectedItems(e,s){s&&this.items.forEach(t=>{const a=s===t;switch(this.selectionMode){case"multiple":a&&(t.selected=!t.selected);break;case"single":t.selected=a?!t.selected:!1;break;case"single-persist":t.selected=!!a;break}}),this.selectedItems=this.items.filter(t=>t.selected),e&&this.selectionMode!=="none"&&!this.disabled&&this.calciteCardGroupSelect.emit()}render(){const e=this.selectionMode==="none"||this.selectionMode==="multiple"?"group":"radiogroup";return this.interactiveContainer({disabled:this.disabled,children:o`<div .ariaLabel=${this.label} class=${r(b.container)} .role=${e}><slot @slotchange=${this.updateItemsOnSlotChange} ${p(this.slotRef)}></slot></div>`})}}n("calcite-card-group",g);export{g as CardGroup};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.