@ansible/ansible-ui-framework 2.4.2518 → 2.4.2520

Sign up to get free protection for your applications and to get access to all the features.
package/index.js CHANGED
@@ -34523,7 +34523,7 @@ const Su = (e) => {
34523
34523
  for (const l of s)
34524
34524
  typeof l == "string" && r.push({ message: l });
34525
34525
  } else if (typeof s == "string")
34526
- i.push({ name: o, message: s });
34526
+ o === "detail" ? r.push({ message: s }) : i.push({ name: o, message: s });
34527
34527
  else if (Array.isArray(s))
34528
34528
  for (const l of s)
34529
34529
  typeof l == "string" && i.push({ name: o, message: l });
package/index.umd.cjs CHANGED
@@ -387,7 +387,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
387
387
  opacity: 0.8;
388
388
  `;function EA(e){const{disablePadding:t,alertPrompts:n}=e,r=Wa(),i=e.labelOrientation??r.formLayout,a=e.numberOfColumns?e.numberOfColumns:r.formColumns,o=e.isCompact;let s=g.jsxs(x0e,{variant:"light",padding:{default:"noPadding"},children:[n&&n.length>0&&n.map((l,u)=>g.jsx(E.Alert,{style:{margin:12},isInline:!0,title:l,variant:"warning","data-cy":l},u)),g.jsx(E.DescriptionList,{orientation:{sm:i,md:i,lg:i,xl:i,"2xl":i},columnModifier:a==="multiple"?{default:"1Col",sm:"1Col",md:"2Col",lg:"2Col",xl:"3Col","2xl":"3Col"}:a==="two"?{default:"1Col",sm:"1Col",md:"2Col",lg:"2Col",xl:"3Col","2xl":"2Col"}:void 0,style:{maxWidth:1200,padding:t?void 0:24},isCompact:o,children:e.children})]});return e.disableScroll||(s=g.jsx(Er,{children:s})),s}const x0e=ke(E.PageSection)`
389
389
  background-color: transparent;
390
- `;var et=(e=>(e.Table="table",e.List="list",e.Cards="cards",e))(et||{}),va=(e=>(e.description="description",e.expanded="expanded",e.hidden="hidden",e))(va||{}),TA=(e=>(e.name="name",e.subtitle="subtitle",e.description="description",e.hidden="hidden",e.primary="primary",e.secondary="secondary",e))(TA||{}),kA=(e=>(e.name="name",e.subtitle="subtitle",e.description="description",e.hidden="hidden",e))(kA||{}),AA=(e=>(e.hidden="hidden",e))(AA||{}),PA=(e=>(e.hidden="hidden",e))(PA||{}),Ih=(e=>(e.last="last",e))(Ih||{});function Jt(e){var r;const{item:t,column:n}=e;if(!n)return g.jsx(g.Fragment,{});switch(n.type){case"text":return g.jsx(z_,{text:n.value(t),to:(r=n.to)==null?void 0:r.call(n,t)});case"description":return g.jsx("div",{style:{minWidth:200,whiteSpace:"normal"},children:n.value(t)});case"datetime":return g.jsx(R_,{value:n.value(t)});case"count":return g.jsx(g.Fragment,{children:n.value(t)??"-"});case"labels":return g.jsx(B_,{labels:n.value(t)??[]});default:return g.jsx(g.Fragment,{children:n.cell(t)})}}function Yy(e){return b.useMemo(()=>e.filter(t=>!(t.table==="hidden"||t.table==="description"||t.table==="expanded")),[e])}function jA(e){return b.useMemo(()=>e.filter(t=>t.list!=="hidden"),[e])}function DA(e){return b.useMemo(()=>e.filter(t=>t.card!=="hidden"),[e])}function Mh(e){return b.useMemo(()=>e.filter(t=>t.modal!=="hidden"),[e])}function _0e(e){return e=b.useMemo(()=>e.filter(t=>t.dashboard!=="hidden"),[e]),e=MA(e),e=LA(e),e}function w0e(e,t){const n=Yy(e),r=jA(e),i=DA(e);switch(t){case et.Table:return n;case et.List:return r;case et.Cards:return i}}function $A(e){return b.useMemo(()=>e.filter(t=>t.table==="hidden"?!1:t.table==="description"),[e])}function IA(e){return b.useMemo(()=>e.filter(t=>t.table==="hidden"?!1:t.table==="expanded"),[e])}function MA(e){return b.useMemo(()=>e.map(t=>({...t,sort:void 0})),[e])}function LA(e){return b.useMemo(()=>e.map(t=>({...t,table:t.table==="expanded"?void 0:t.table})),[e])}function NA(e){const{item:t,columns:n,children:r}=e,i=b.useMemo(()=>n.filter(s=>{if(!t)return!1;if("value"in s&&s.value){const l=s.value(t);if(l==null||typeof l=="string"&&l.trim().length===0)return!1}return!0}),[n,t]),a=b.useMemo(()=>i.filter(s=>s.priority!==Ih.last),[i]),o=b.useMemo(()=>i.filter(s=>s.priority===Ih.last),[i]);return!t||!i.length?null:g.jsxs(g.Fragment,{children:[a.map(s=>g.jsx(Ps,{helpText:s.helpText,label:s.header,children:g.jsx(Jt,{column:s,item:t})},s.id??s.header)),r||null,o.map(s=>g.jsx(Ps,{label:s.header,children:g.jsx(Jt,{column:s,item:t})},s.id??s.header))]})}class S0e{constructor(t){li(this,"value");li(this,"next");this.value=t}}class O0e{constructor(){hp(this,hr);hp(this,bo);hp(this,xo);this.clear()}enqueue(t){const n=new S0e(t);ui(this,hr)?(ui(this,bo).next=n,Gi(this,bo,n)):(Gi(this,hr,n),Gi(this,bo,n)),i1(this,xo)._++}dequeue(){const t=ui(this,hr);if(t)return Gi(this,hr,ui(this,hr).next),i1(this,xo)._--,t.value}peek(){if(ui(this,hr))return ui(this,hr).value}clear(){Gi(this,hr,void 0),Gi(this,bo,void 0),Gi(this,xo,0)}get size(){return ui(this,xo)}*[Symbol.iterator](){let t=ui(this,hr);for(;t;)yield t.value,t=t.next}}hr=new WeakMap,bo=new WeakMap,xo=new WeakMap;const C0e={bind(e,t,n){return e.bind(n)}};function E0e(e){if(!((Number.isInteger(e)||e===Number.POSITIVE_INFINITY)&&e>0))throw new TypeError("Expected `concurrency` to be a number from 1 and up");const t=new O0e;let n=0;const r=()=>{n--,t.size>0&&t.dequeue()()},i=async(s,l,u)=>{n++;const c=(async()=>s(...u))();l(c);try{await c}catch{}r()},a=(s,l,u)=>{t.enqueue(C0e.bind(i.bind(void 0,s,l,u))),(async()=>(await Promise.resolve(),n<e&&t.size>0&&t.dequeue()()))()},o=(s,...l)=>new Promise(u=>{a(s,u,l)});return Object.defineProperties(o,{activeCount:{get:()=>n},pendingCount:{get:()=>t.size},clearQueue:{value(){t.clear()}}}),o}const _u=e=>{const t=["json"],n=["non_field_errors"],r=[],i=[];switch(typeof e){case"string":r.push({message:e});break;case"object":if(e===null)break;if(Array.isArray(e)){for(const a of e)typeof a=="string"&&r.push({message:a});break}for(const a of t)if(a in e&&typeof e[a]=="object"&&e[a]!==null)for(const o in e[a]){const s=e[a][o];if(n.includes(o)){if(typeof s=="string")r.push({message:s});else if(Array.isArray(s))for(const l of s)typeof l=="string"&&r.push({message:l})}else if(typeof s=="string")i.push({name:o,message:s});else if(Array.isArray(s))for(const l of s)typeof l=="string"&&i.push({name:o,message:l})}else e instanceof Error&&r.push({message:e.message});break}return{genericErrors:r,fieldErrors:i}};function FA(e){const[t,n]=b.useState(!1),r=rn("sm"),[i]=At(),{pageItems:a,selectedItems:o,selectItems:s,unselectAll:l,maxSelections:u}=e,c=e.itemCount!==void 0&&e.itemCount>0&&a&&a.length>0&&(a??[]).every(_=>o==null?void 0:o.includes(_)),f=b.useCallback(()=>{c?l==null||l():s==null||s(a??[])},[c,l,s,a]),d=b.useMemo(()=>r?o&&o.length>0?`${o.length} selected`:"":o&&o.length>0?`${o.length}`:"",[r,o]),h=b.useMemo(()=>a==null?void 0:a.filter(_=>!(o!=null&&o.includes(_))),[a,o]),p=b.useMemo(()=>!!(u&&o&&h&&!c&&(o==null?void 0:o.length)+h.length>u),[c,u,o,h]),m=b.useMemo(()=>{const _=o?o.length:0;return g.jsx(ig,{splitButtonItems:[g.jsx(Mo,{id:"select-all",ouiaId:"select-all","data-cy":"select-all","aria-label":"Select all",isChecked:c?!0:_>0?null:!1,onChange:f,children:d},"select-all")],onToggle:(S,w)=>n(w),isDisabled:p})},[o,c,f,d,p]),v=b.useMemo(()=>g.jsx(yc,{id:"select-none",ouiaId:"select-none",onClick:()=>{l==null||l(),n(!1)},children:e.selectNoneText??i.selectNone},"select-none"),[e.selectNoneText,i.selectNone,l]),y=b.useMemo(()=>g.jsx(yc,{id:"select-page",ouiaId:"select-page",onClick:()=>{s==null||s(a??[]),n(!1)},children:`Select ${(a==null?void 0:a.length)??0} page items`},"select-page"),[s,a]),x=b.useMemo(()=>o&&o.length>0?[v,y]:[y],[v,y,o]);return g.jsx("div",{style:{marginLeft:-8},children:g.jsx(gc,{isOpen:t,toggle:m,dropdownItems:x,style:{zIndex:400}})})}function Lh(e,t){const[n,r]=b.useState(()=>e);b.useEffect(()=>r(e),[e]);const i=b.useCallback(a=>{t?t(a):r(a)},[t]);return[n,i]}function RA(e){const{t}=Ie(),{id:n,icon:r,placeholder:i,values:a,onSelect:o,options:s,variant:l,disableClearSelection:u,maxChipSize:c,queryLabel:f,compareOptionValues:d}=e,[h,p]=Lh(e.open??!1,e.setOpen),[m,v]=Lh(e.searchValue??"",e.setSearchValue),y=b.useRef(null),x=b.useMemo(()=>{const D=[];for(const I of a??[]){const A=s.find(j=>d?d(j.value,I):j.value===I);A?D.push(A):f&&I!==void 0&&D.push({label:f(I),value:I})}return D},[s,f,a,d]),_=D=>g.jsx(E.Tooltip,{content:e.isDisabled,trigger:e.isDisabled?void 0:"manual",children:g.jsx(E.MenuToggle,{id:n,ref:D,onClick:()=>p(!h),isExpanded:h,onKeyDown:I=>{switch(I.key){case"Tab":case"Enter":case"Shift":break;default:p(!0),setTimeout(()=>{O.current&&(O.current.focus(),O.current.value=I.key)},1);break}},"data-cy":n,icon:r,isDisabled:!!e.isDisabled,isFullWidth:!0,style:{paddingTop:2,paddingBottom:4,minHeight:36},children:x.length>0?g.jsx(g.Fragment,{children:l==="count"?g.jsx(E.Chip,{isReadOnly:u,onClick:()=>o(()=>[]),style:{marginTop:-4,marginBottom:-4},children:x.length}):g.jsxs(g.Fragment,{children:[g.jsx(E.ChipGroup,{numChips:99,children:x.map(I=>g.jsx(E.Chip,{isReadOnly:e.disableClearChips,textMaxWidth:c,style:{marginTop:-2,marginBottom:-2},onClick:()=>o(A=>A==null?void 0:A.filter(j=>j!==I.value)),children:I.label},I.label))}),!u&&g.jsx(ve.TimesIcon,{role:"button","aria-hidden":!0,onClick:()=>o(()=>[]),style:{verticalAlign:"middle",marginLeft:8}})]})}):g.jsx("span",{style:{opacity:.7},children:i})})}),S=b.useMemo(()=>x.map(D=>D.label),[x]),w=b.useCallback((D,I)=>{o(A=>{const j=s.find(P=>P.key!==void 0?P.key===I:P.label===I);return j&&((A==null?void 0:A.find(P=>d?d(P,j.value):P===j.value))!==void 0?A=A.filter(P=>d?!d(P,j.value):P!==j.value):(A=A?[...A]:[],A.push(j.value))),A})},[o,s,d]),O=b.useRef(null);b.useEffect(()=>{h||v("")},[h,v]);const C=b.useMemo(()=>{const D=s.filter(I=>m===""?!0:I.label.toLowerCase().includes(m.toLowerCase()));return e.disableSortOptions||D.sort((I,A)=>I.label.toLowerCase().localeCompare(A.label.toLowerCase())),D},[s,e.disableSortOptions,m]),k=b.useMemo(()=>{if(s.some(I=>!!I.group)){const I={};for(const A of C){const j=A.group??"";I[j]||(I[j]=[]),I[j].push(A)}return I}},[s,C]);return g.jsxs(E.Select,{id:`${n}-select`,selected:S,onSelect:w,isOpen:h,onOpenChange:p,toggle:_,popperProps:{appendTo:()=>document.body,preventOverflow:!0,enableFlip:!0},innerRef:y,children:[g.jsx(E.MenuSearch,{children:g.jsx(E.MenuSearchInput,{"data-cy":"search-input",children:g.jsx(E.SearchInput,{id:`${n}-search`,ref:O,value:m,onChange:(D,I)=>v(I),onClear:D=>{D.stopPropagation(),v("")},resultsCount:C.length!==s.length?`${C.length} / ${s.length}`:void 0,onKeyDown:D=>{var I;switch(D.key){case"ArrowDown":case"Tab":{D.preventDefault(),D.stopPropagation();const A=(I=y==null?void 0:y.current)==null?void 0:I.querySelector("li button:not(:disabled),li input:not(:disabled)");A&&A.focus();break}}}})})}),g.jsx(E.Divider,{}),C.length===0?g.jsx(g.Fragment,{children:e.isLoading?g.jsx(E.Bullseye,{style:{padding:16},children:g.jsx(E.Spinner,{size:"lg"})}):g.jsx(E.SelectOption,{isDisabled:!0,children:t("No results found")},"no result")}):g.jsx(T0e,{children:k?g.jsx(g.Fragment,{children:Object.keys(k).map(D=>g.jsx(E.SelectGroup,{label:D,children:g.jsx(BA,{searchRef:O,options:C,selectedOptions:x})},D))}):g.jsx(BA,{searchRef:O,options:C,selectedOptions:x})}),e.footer&&g.jsx(E.MenuFooter,{children:e.footer})]})}function BA(e){return g.jsx(E.SelectList,{onKeyDown:t=>{var n;switch(t.key){case"Tab":t.preventDefault(),t.stopPropagation(),(n=e.searchRef.current)==null||n.focus();break}},children:e.options.map(t=>{const n=Lr(t);return g.jsx(E.SelectOption,{id:n,icon:t.icon,value:t.key!==void 0?t.key:t.label,description:t.description?g.jsx("div",{style:{maxWidth:300},children:t.description}):void 0,hasCheckbox:!0,isSelected:e.selectedOptions.includes(t),"data-cy":n,children:t.label},t.key!==void 0?t.key:t.label)})})}const T0e=ke(Er)`
390
+ `;var et=(e=>(e.Table="table",e.List="list",e.Cards="cards",e))(et||{}),va=(e=>(e.description="description",e.expanded="expanded",e.hidden="hidden",e))(va||{}),TA=(e=>(e.name="name",e.subtitle="subtitle",e.description="description",e.hidden="hidden",e.primary="primary",e.secondary="secondary",e))(TA||{}),kA=(e=>(e.name="name",e.subtitle="subtitle",e.description="description",e.hidden="hidden",e))(kA||{}),AA=(e=>(e.hidden="hidden",e))(AA||{}),PA=(e=>(e.hidden="hidden",e))(PA||{}),Ih=(e=>(e.last="last",e))(Ih||{});function Jt(e){var r;const{item:t,column:n}=e;if(!n)return g.jsx(g.Fragment,{});switch(n.type){case"text":return g.jsx(z_,{text:n.value(t),to:(r=n.to)==null?void 0:r.call(n,t)});case"description":return g.jsx("div",{style:{minWidth:200,whiteSpace:"normal"},children:n.value(t)});case"datetime":return g.jsx(R_,{value:n.value(t)});case"count":return g.jsx(g.Fragment,{children:n.value(t)??"-"});case"labels":return g.jsx(B_,{labels:n.value(t)??[]});default:return g.jsx(g.Fragment,{children:n.cell(t)})}}function Yy(e){return b.useMemo(()=>e.filter(t=>!(t.table==="hidden"||t.table==="description"||t.table==="expanded")),[e])}function jA(e){return b.useMemo(()=>e.filter(t=>t.list!=="hidden"),[e])}function DA(e){return b.useMemo(()=>e.filter(t=>t.card!=="hidden"),[e])}function Mh(e){return b.useMemo(()=>e.filter(t=>t.modal!=="hidden"),[e])}function _0e(e){return e=b.useMemo(()=>e.filter(t=>t.dashboard!=="hidden"),[e]),e=MA(e),e=LA(e),e}function w0e(e,t){const n=Yy(e),r=jA(e),i=DA(e);switch(t){case et.Table:return n;case et.List:return r;case et.Cards:return i}}function $A(e){return b.useMemo(()=>e.filter(t=>t.table==="hidden"?!1:t.table==="description"),[e])}function IA(e){return b.useMemo(()=>e.filter(t=>t.table==="hidden"?!1:t.table==="expanded"),[e])}function MA(e){return b.useMemo(()=>e.map(t=>({...t,sort:void 0})),[e])}function LA(e){return b.useMemo(()=>e.map(t=>({...t,table:t.table==="expanded"?void 0:t.table})),[e])}function NA(e){const{item:t,columns:n,children:r}=e,i=b.useMemo(()=>n.filter(s=>{if(!t)return!1;if("value"in s&&s.value){const l=s.value(t);if(l==null||typeof l=="string"&&l.trim().length===0)return!1}return!0}),[n,t]),a=b.useMemo(()=>i.filter(s=>s.priority!==Ih.last),[i]),o=b.useMemo(()=>i.filter(s=>s.priority===Ih.last),[i]);return!t||!i.length?null:g.jsxs(g.Fragment,{children:[a.map(s=>g.jsx(Ps,{helpText:s.helpText,label:s.header,children:g.jsx(Jt,{column:s,item:t})},s.id??s.header)),r||null,o.map(s=>g.jsx(Ps,{label:s.header,children:g.jsx(Jt,{column:s,item:t})},s.id??s.header))]})}class S0e{constructor(t){li(this,"value");li(this,"next");this.value=t}}class O0e{constructor(){hp(this,hr);hp(this,bo);hp(this,xo);this.clear()}enqueue(t){const n=new S0e(t);ui(this,hr)?(ui(this,bo).next=n,Gi(this,bo,n)):(Gi(this,hr,n),Gi(this,bo,n)),i1(this,xo)._++}dequeue(){const t=ui(this,hr);if(t)return Gi(this,hr,ui(this,hr).next),i1(this,xo)._--,t.value}peek(){if(ui(this,hr))return ui(this,hr).value}clear(){Gi(this,hr,void 0),Gi(this,bo,void 0),Gi(this,xo,0)}get size(){return ui(this,xo)}*[Symbol.iterator](){let t=ui(this,hr);for(;t;)yield t.value,t=t.next}}hr=new WeakMap,bo=new WeakMap,xo=new WeakMap;const C0e={bind(e,t,n){return e.bind(n)}};function E0e(e){if(!((Number.isInteger(e)||e===Number.POSITIVE_INFINITY)&&e>0))throw new TypeError("Expected `concurrency` to be a number from 1 and up");const t=new O0e;let n=0;const r=()=>{n--,t.size>0&&t.dequeue()()},i=async(s,l,u)=>{n++;const c=(async()=>s(...u))();l(c);try{await c}catch{}r()},a=(s,l,u)=>{t.enqueue(C0e.bind(i.bind(void 0,s,l,u))),(async()=>(await Promise.resolve(),n<e&&t.size>0&&t.dequeue()()))()},o=(s,...l)=>new Promise(u=>{a(s,u,l)});return Object.defineProperties(o,{activeCount:{get:()=>n},pendingCount:{get:()=>t.size},clearQueue:{value(){t.clear()}}}),o}const _u=e=>{const t=["json"],n=["non_field_errors"],r=[],i=[];switch(typeof e){case"string":r.push({message:e});break;case"object":if(e===null)break;if(Array.isArray(e)){for(const a of e)typeof a=="string"&&r.push({message:a});break}for(const a of t)if(a in e&&typeof e[a]=="object"&&e[a]!==null)for(const o in e[a]){const s=e[a][o];if(n.includes(o)){if(typeof s=="string")r.push({message:s});else if(Array.isArray(s))for(const l of s)typeof l=="string"&&r.push({message:l})}else if(typeof s=="string")o==="detail"?r.push({message:s}):i.push({name:o,message:s});else if(Array.isArray(s))for(const l of s)typeof l=="string"&&i.push({name:o,message:l})}else e instanceof Error&&r.push({message:e.message});break}return{genericErrors:r,fieldErrors:i}};function FA(e){const[t,n]=b.useState(!1),r=rn("sm"),[i]=At(),{pageItems:a,selectedItems:o,selectItems:s,unselectAll:l,maxSelections:u}=e,c=e.itemCount!==void 0&&e.itemCount>0&&a&&a.length>0&&(a??[]).every(_=>o==null?void 0:o.includes(_)),f=b.useCallback(()=>{c?l==null||l():s==null||s(a??[])},[c,l,s,a]),d=b.useMemo(()=>r?o&&o.length>0?`${o.length} selected`:"":o&&o.length>0?`${o.length}`:"",[r,o]),h=b.useMemo(()=>a==null?void 0:a.filter(_=>!(o!=null&&o.includes(_))),[a,o]),p=b.useMemo(()=>!!(u&&o&&h&&!c&&(o==null?void 0:o.length)+h.length>u),[c,u,o,h]),m=b.useMemo(()=>{const _=o?o.length:0;return g.jsx(ig,{splitButtonItems:[g.jsx(Mo,{id:"select-all",ouiaId:"select-all","data-cy":"select-all","aria-label":"Select all",isChecked:c?!0:_>0?null:!1,onChange:f,children:d},"select-all")],onToggle:(S,w)=>n(w),isDisabled:p})},[o,c,f,d,p]),v=b.useMemo(()=>g.jsx(yc,{id:"select-none",ouiaId:"select-none",onClick:()=>{l==null||l(),n(!1)},children:e.selectNoneText??i.selectNone},"select-none"),[e.selectNoneText,i.selectNone,l]),y=b.useMemo(()=>g.jsx(yc,{id:"select-page",ouiaId:"select-page",onClick:()=>{s==null||s(a??[]),n(!1)},children:`Select ${(a==null?void 0:a.length)??0} page items`},"select-page"),[s,a]),x=b.useMemo(()=>o&&o.length>0?[v,y]:[y],[v,y,o]);return g.jsx("div",{style:{marginLeft:-8},children:g.jsx(gc,{isOpen:t,toggle:m,dropdownItems:x,style:{zIndex:400}})})}function Lh(e,t){const[n,r]=b.useState(()=>e);b.useEffect(()=>r(e),[e]);const i=b.useCallback(a=>{t?t(a):r(a)},[t]);return[n,i]}function RA(e){const{t}=Ie(),{id:n,icon:r,placeholder:i,values:a,onSelect:o,options:s,variant:l,disableClearSelection:u,maxChipSize:c,queryLabel:f,compareOptionValues:d}=e,[h,p]=Lh(e.open??!1,e.setOpen),[m,v]=Lh(e.searchValue??"",e.setSearchValue),y=b.useRef(null),x=b.useMemo(()=>{const D=[];for(const I of a??[]){const A=s.find(j=>d?d(j.value,I):j.value===I);A?D.push(A):f&&I!==void 0&&D.push({label:f(I),value:I})}return D},[s,f,a,d]),_=D=>g.jsx(E.Tooltip,{content:e.isDisabled,trigger:e.isDisabled?void 0:"manual",children:g.jsx(E.MenuToggle,{id:n,ref:D,onClick:()=>p(!h),isExpanded:h,onKeyDown:I=>{switch(I.key){case"Tab":case"Enter":case"Shift":break;default:p(!0),setTimeout(()=>{O.current&&(O.current.focus(),O.current.value=I.key)},1);break}},"data-cy":n,icon:r,isDisabled:!!e.isDisabled,isFullWidth:!0,style:{paddingTop:2,paddingBottom:4,minHeight:36},children:x.length>0?g.jsx(g.Fragment,{children:l==="count"?g.jsx(E.Chip,{isReadOnly:u,onClick:()=>o(()=>[]),style:{marginTop:-4,marginBottom:-4},children:x.length}):g.jsxs(g.Fragment,{children:[g.jsx(E.ChipGroup,{numChips:99,children:x.map(I=>g.jsx(E.Chip,{isReadOnly:e.disableClearChips,textMaxWidth:c,style:{marginTop:-2,marginBottom:-2},onClick:()=>o(A=>A==null?void 0:A.filter(j=>j!==I.value)),children:I.label},I.label))}),!u&&g.jsx(ve.TimesIcon,{role:"button","aria-hidden":!0,onClick:()=>o(()=>[]),style:{verticalAlign:"middle",marginLeft:8}})]})}):g.jsx("span",{style:{opacity:.7},children:i})})}),S=b.useMemo(()=>x.map(D=>D.label),[x]),w=b.useCallback((D,I)=>{o(A=>{const j=s.find(P=>P.key!==void 0?P.key===I:P.label===I);return j&&((A==null?void 0:A.find(P=>d?d(P,j.value):P===j.value))!==void 0?A=A.filter(P=>d?!d(P,j.value):P!==j.value):(A=A?[...A]:[],A.push(j.value))),A})},[o,s,d]),O=b.useRef(null);b.useEffect(()=>{h||v("")},[h,v]);const C=b.useMemo(()=>{const D=s.filter(I=>m===""?!0:I.label.toLowerCase().includes(m.toLowerCase()));return e.disableSortOptions||D.sort((I,A)=>I.label.toLowerCase().localeCompare(A.label.toLowerCase())),D},[s,e.disableSortOptions,m]),k=b.useMemo(()=>{if(s.some(I=>!!I.group)){const I={};for(const A of C){const j=A.group??"";I[j]||(I[j]=[]),I[j].push(A)}return I}},[s,C]);return g.jsxs(E.Select,{id:`${n}-select`,selected:S,onSelect:w,isOpen:h,onOpenChange:p,toggle:_,popperProps:{appendTo:()=>document.body,preventOverflow:!0,enableFlip:!0},innerRef:y,children:[g.jsx(E.MenuSearch,{children:g.jsx(E.MenuSearchInput,{"data-cy":"search-input",children:g.jsx(E.SearchInput,{id:`${n}-search`,ref:O,value:m,onChange:(D,I)=>v(I),onClear:D=>{D.stopPropagation(),v("")},resultsCount:C.length!==s.length?`${C.length} / ${s.length}`:void 0,onKeyDown:D=>{var I;switch(D.key){case"ArrowDown":case"Tab":{D.preventDefault(),D.stopPropagation();const A=(I=y==null?void 0:y.current)==null?void 0:I.querySelector("li button:not(:disabled),li input:not(:disabled)");A&&A.focus();break}}}})})}),g.jsx(E.Divider,{}),C.length===0?g.jsx(g.Fragment,{children:e.isLoading?g.jsx(E.Bullseye,{style:{padding:16},children:g.jsx(E.Spinner,{size:"lg"})}):g.jsx(E.SelectOption,{isDisabled:!0,children:t("No results found")},"no result")}):g.jsx(T0e,{children:k?g.jsx(g.Fragment,{children:Object.keys(k).map(D=>g.jsx(E.SelectGroup,{label:D,children:g.jsx(BA,{searchRef:O,options:C,selectedOptions:x})},D))}):g.jsx(BA,{searchRef:O,options:C,selectedOptions:x})}),e.footer&&g.jsx(E.MenuFooter,{children:e.footer})]})}function BA(e){return g.jsx(E.SelectList,{onKeyDown:t=>{var n;switch(t.key){case"Tab":t.preventDefault(),t.stopPropagation(),(n=e.searchRef.current)==null||n.focus();break}},children:e.options.map(t=>{const n=Lr(t);return g.jsx(E.SelectOption,{id:n,icon:t.icon,value:t.key!==void 0?t.key:t.label,description:t.description?g.jsx("div",{style:{maxWidth:300},children:t.description}):void 0,hasCheckbox:!0,isSelected:e.selectedOptions.includes(t),"data-cy":n,children:t.label},t.key!==void 0?t.key:t.label)})})}const T0e=ke(Er)`
391
391
  max-height: 40vh;
392
392
  `;function k0e(e){const{t}=Ie(),[n,r]=b.useState(!1),[i,a]=b.useState(!1),[o,s]=b.useState(),[l,u]=b.useState(0),[c,f]=b.useState(),[d,h]=b.useState(!1),p=b.useRef(),[m,v]=b.useState(""),y=b.useCallback(E.debounce(k=>v(k),200),[]),x=b.useRef(e.queryOptions).current,_=b.useRef(null),S=b.useCallback(()=>{_.current&&_.current.abort();const k=new AbortController;return _.current=k,r(()=>(a(!1),s(void 0),f(D=>{if(D)return D}),x({next:p.current,signal:k.signal,search:m}).then(D=>{k.signal.aborted||(p.current=D.next,D.remaining||a(!0),f(I=>{if(k.signal.aborted)return I;let A=[...I??[],...D.options];const j=new Set;return A=A.filter(P=>j.has(P.value)?!1:(j.add(P.value),!0)),A.sort((P,$)=>{const M=P.label.toLowerCase(),B=$.label.toLowerCase();return M<B?-1:M>B?1:0}),u(D.remaining+A.length),A}))}).catch(D=>{k.signal.aborted||s(D instanceof Error?D:new Error(t("Unknown error")))}).finally(()=>{k.signal.aborted||r(!1)}),!0)),()=>k.abort()},[x,m,t]),w=b.useCallback(k=>{k.preventDefault(),k.stopPropagation(),S()},[S]),O=b.useCallback(k=>{k.preventDefault(),k.stopPropagation(),u(0),f([]),p.current=void 0,S()},[S]);b.useEffect(()=>{d&&(u(0),f([]),p.current=void 0,S())},[d,S]);const C=g.jsxs(E.Stack,{hasGutter:!0,children:[g.jsxs(E.Flex,{children:[g.jsx(E.FlexItem,{grow:{default:"grow"},children:g.jsxs(E.ActionList,{children:[e.onBrowse&&g.jsx(E.ActionListItem,{children:g.jsx(E.Button,{id:"browse",onClick:k=>{var D;k.preventDefault(),k.stopPropagation(),h(!1),(D=e.onBrowse)==null||D.call(e)},children:t("Browse")})}),!i&&g.jsx(E.ActionListItem,{children:g.jsx(E.Button,{id:"load-more",isLoading:n,onClick:w,isDisabled:n,children:t(n?"Loading...":"Load more")})})]})}),!i&&l!==0&&g.jsx(E.FlexItem,{children:t("Loaded {{count}} of {{total}}",{count:(c==null?void 0:c.length)??0,total:l})})]}),e.footer]});return o?g.jsx(A0e,{id:e.id,variant:"secondary",isDanger:!0,icon:g.jsx(ve.SyncAltIcon,{}),iconPosition:"right",onClick:O,children:typeof e.queryErrorText=="function"?e.queryErrorText(o):e.queryErrorText??t("Error loading options")}):g.jsx(RA,{id:e.id,icon:e.icon,placeholder:e.placeholder,options:c??[],values:e.values,onSelect:e.onSelect,variant:e.variant,footer:C,open:d,setOpen:h,searchValue:m,setSearchValue:y,isLoading:n,disableClearSelection:e.disableClearSelection,disableClearChips:e.disableClearChips,queryLabel:e.queryLabel,compareOptionValues:e.compareOptionValues})}const A0e=ke(E.Button)`
393
393
  width: 100%;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ansible/ansible-ui-framework",
3
3
  "description": "A framework for building applications using PatternFly.",
4
- "version": "2.4.2518",
4
+ "version": "2.4.2520",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",