import"./chunk-QTnfLwEv.js";import{i as e,o as t,r as n,t as r}from"./jsx-runtime-DHSfUA5-.js";import{t as i}from"./check-DqMliDjm.js";import{t as a}from"./chevron-right-359IEfVc.js";import{t as o}from"./user-round-DuMTTg1k.js";t();var s=r();function c({right:t}){return t.type===`value`?(0,s.jsx)(`span`,{className:e.Cell.RowValue,children:t.text}):t.type===`image`?t.url?(0,s.jsx)(`img`,{className:e.CellList.RightImage,"data-test-id":t.testId,src:t.url,alt:``}):(0,s.jsx)(`span`,{className:e.CellList.RightImageFallback,"aria-hidden":`true`,children:(0,s.jsx)(o,{size:19,strokeWidth:1.8})}):(0,s.jsx)(`span`,{className:e.CellList.RightInitial,"data-test-id":t.testId,"aria-hidden":`true`,children:t.text.trim().slice(0,1).toUpperCase()||`?`})}function l({items:t}){return(0,s.jsx)(s.Fragment,{children:t.map(t=>{if(t.hide)return null;let r=t.key??t.label;if(t.type===`option`)return(0,s.jsxs)(`button`,{className:n(e.CellList.Row,e.CellList.RowPressable),type:`button`,"data-test-id":t.testId,onClick:t.onClick,disabled:t.disabled,"aria-pressed":t.selected,children:[(0,s.jsx)(`span`,{className:e.Cell.RowLabel,children:t.label}),t.selected&&(0,s.jsx)(i,{size:24,className:e.Cell.CheckIcon,strokeWidth:2.2})]},r);if(t.type===`action`)return(0,s.jsx)(`button`,{className:n(e.CellList.Action,t.danger&&e.CellList.ActionDanger),type:`button`,"data-test-id":t.testId,onClick:t.onClick,disabled:t.disabled,children:t.label},r);if(t.type===`switch`)return(0,s.jsxs)(`label`,{className:e.CellList.Row,children:[(0,s.jsx)(`span`,{className:e.Cell.RowLabel,children:t.label}),(0,s.jsx)(`input`,{type:`checkbox`,className:e.Choice.Input,"data-test-id":t.testId,checked:t.checked,disabled:t.disabled,onChange:e=>{t.disabled||t.onChange(e.target.checked)}})]},r);let o=(0,s.jsxs)(s.Fragment,{children:[t.icon&&(0,s.jsx)(`span`,{className:e.CellList.Icon,children:t.icon}),(0,s.jsx)(`span`,{className:e.Cell.RowLabel,children:t.label}),t.right&&(0,s.jsx)(c,{right:t.right})]});return t.onClick?(0,s.jsxs)(`button`,{className:n(e.CellList.Row,e.CellList.RowPressable),type:`button`,"data-test-id":t.testId,onClick:t.onClick,disabled:t.disabled,children:[o,(0,s.jsx)(a,{size:18,className:e.CellList.Chevron,strokeWidth:1.9})]},r):(0,s.jsx)(`div`,{className:e.CellList.Row,"data-test-id":t.testId,children:o},r)})})}function u({items:t,title:r,bordered:i,testId:a,className:o}){let c=(0,s.jsx)(`section`,{className:n(i?e.CellList.GroupBordered:e.CellList.Group,e.CellList.GroupDividers,!r&&o),"data-test-id":a,children:(0,s.jsx)(l,{items:t})});return r?(0,s.jsxs)(`div`,{className:o,children:[(0,s.jsx)(`h2`,{className:e.CellList.GroupTitle,children:r}),c]}):c}export{u as t};
//# sourceMappingURL=CellList-UkuVgkhN.js.map