@ansible/ansible-ui-framework 2.4.1769 → 2.4.1771

Sign up to get free protection for your applications and to get access to all the features.
@@ -31,6 +31,7 @@ export declare enum ColumnPriority {
31
31
  interface ITableColumnCommon<T extends object> {
32
32
  id?: string;
33
33
  header: string;
34
+ helpText?: string;
34
35
  minWidth?: number;
35
36
  maxWidth?: number;
36
37
  fullWidth?: boolean;
@@ -92,6 +93,7 @@ export declare function useColumnsWithoutSort<T extends object>(columns: ITableC
92
93
  cell: CellFn<T, ReactNode>;
93
94
  id?: string | undefined;
94
95
  header: string;
96
+ helpText?: string | undefined;
95
97
  minWidth?: number | undefined;
96
98
  maxWidth?: number | undefined;
97
99
  fullWidth?: boolean | undefined;
@@ -111,6 +113,7 @@ export declare function useColumnsWithoutSort<T extends object>(columns: ITableC
111
113
  to?: ((item: T) => string | undefined) | undefined;
112
114
  id?: string | undefined;
113
115
  header: string;
116
+ helpText?: string | undefined;
114
117
  minWidth?: number | undefined;
115
118
  maxWidth?: number | undefined;
116
119
  fullWidth?: boolean | undefined;
@@ -129,6 +132,7 @@ export declare function useColumnsWithoutSort<T extends object>(columns: ITableC
129
132
  value: CellFn<T, string | null | undefined>;
130
133
  id?: string | undefined;
131
134
  header: string;
135
+ helpText?: string | undefined;
132
136
  minWidth?: number | undefined;
133
137
  maxWidth?: number | undefined;
134
138
  fullWidth?: boolean | undefined;
@@ -147,6 +151,7 @@ export declare function useColumnsWithoutSort<T extends object>(columns: ITableC
147
151
  value: CellFn<T, string | number | undefined>;
148
152
  id?: string | undefined;
149
153
  header: string;
154
+ helpText?: string | undefined;
150
155
  minWidth?: number | undefined;
151
156
  maxWidth?: number | undefined;
152
157
  fullWidth?: boolean | undefined;
@@ -165,6 +170,7 @@ export declare function useColumnsWithoutSort<T extends object>(columns: ITableC
165
170
  value: CellFn<T, string[] | undefined>;
166
171
  id?: string | undefined;
167
172
  header: string;
173
+ helpText?: string | undefined;
168
174
  minWidth?: number | undefined;
169
175
  maxWidth?: number | undefined;
170
176
  fullWidth?: boolean | undefined;
@@ -183,6 +189,7 @@ export declare function useColumnsWithoutSort<T extends object>(columns: ITableC
183
189
  value: CellFn<T, number | undefined>;
184
190
  id?: string | undefined;
185
191
  header: string;
192
+ helpText?: string | undefined;
186
193
  minWidth?: number | undefined;
187
194
  maxWidth?: number | undefined;
188
195
  fullWidth?: boolean | undefined;
@@ -203,6 +210,7 @@ export declare function useColumnsWithoutExpandedRow<T extends object>(columns:
203
210
  cell: CellFn<T, ReactNode>;
204
211
  id?: string | undefined;
205
212
  header: string;
213
+ helpText?: string | undefined;
206
214
  minWidth?: number | undefined;
207
215
  maxWidth?: number | undefined;
208
216
  fullWidth?: boolean | undefined;
@@ -222,6 +230,7 @@ export declare function useColumnsWithoutExpandedRow<T extends object>(columns:
222
230
  to?: ((item: T) => string | undefined) | undefined;
223
231
  id?: string | undefined;
224
232
  header: string;
233
+ helpText?: string | undefined;
225
234
  minWidth?: number | undefined;
226
235
  maxWidth?: number | undefined;
227
236
  fullWidth?: boolean | undefined;
@@ -240,6 +249,7 @@ export declare function useColumnsWithoutExpandedRow<T extends object>(columns:
240
249
  value: CellFn<T, string | null | undefined>;
241
250
  id?: string | undefined;
242
251
  header: string;
252
+ helpText?: string | undefined;
243
253
  minWidth?: number | undefined;
244
254
  maxWidth?: number | undefined;
245
255
  fullWidth?: boolean | undefined;
@@ -258,6 +268,7 @@ export declare function useColumnsWithoutExpandedRow<T extends object>(columns:
258
268
  value: CellFn<T, string | number | undefined>;
259
269
  id?: string | undefined;
260
270
  header: string;
271
+ helpText?: string | undefined;
261
272
  minWidth?: number | undefined;
262
273
  maxWidth?: number | undefined;
263
274
  fullWidth?: boolean | undefined;
@@ -276,6 +287,7 @@ export declare function useColumnsWithoutExpandedRow<T extends object>(columns:
276
287
  value: CellFn<T, string[] | undefined>;
277
288
  id?: string | undefined;
278
289
  header: string;
290
+ helpText?: string | undefined;
279
291
  minWidth?: number | undefined;
280
292
  maxWidth?: number | undefined;
281
293
  fullWidth?: boolean | undefined;
@@ -294,6 +306,7 @@ export declare function useColumnsWithoutExpandedRow<T extends object>(columns:
294
306
  value: CellFn<T, number | undefined>;
295
307
  id?: string | undefined;
296
308
  header: string;
309
+ helpText?: string | undefined;
297
310
  minWidth?: number | undefined;
298
311
  maxWidth?: number | undefined;
299
312
  fullWidth?: boolean | undefined;
package/index.js CHANGED
@@ -34874,7 +34874,15 @@ function A1e(e) {
34874
34874
  [i]
34875
34875
  );
34876
34876
  return !t || !i.length ? null : /* @__PURE__ */ g.jsxs(g.Fragment, { children: [
34877
- a.map((s) => /* @__PURE__ */ g.jsx(nc, { label: s.header, children: /* @__PURE__ */ g.jsx(nn, { column: s, item: t }) }, s.id ?? s.header)),
34877
+ a.map((s) => /* @__PURE__ */ g.jsx(
34878
+ nc,
34879
+ {
34880
+ helpText: s.helpText,
34881
+ label: s.header,
34882
+ children: /* @__PURE__ */ g.jsx(nn, { column: s, item: t })
34883
+ },
34884
+ s.id ?? s.header
34885
+ )),
34878
34886
  r || null,
34879
34887
  o.map((s) => /* @__PURE__ */ g.jsx(nc, { label: s.header, children: /* @__PURE__ */ g.jsx(nn, { column: s, item: t }) }, s.id ?? s.header))
34880
34888
  ] });
package/index.umd.cjs CHANGED
@@ -385,7 +385,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
385
385
  --pf-v5-c-form__group-label-help--hover--Color: var(--pf-v5-global--Color--100);
386
386
  `;function p0e(e){const{ariaLabel:t="",content:n,header:r,id:i="",maxWidth:a="",...o}=e,[s]=Pt();return n?g.jsx(E.Popover,{bodyContent:n,headerContent:r,hideOnOutsideClick:!0,id:i,"data-cy":i,maxWidth:a,...o,children:g.jsx(h0e,{"aria-label":t??s.moreInformation,"aria-haspopup":"true",className:"pf-v5-c-form__group-label-help",onClick:l=>l.preventDefault(),type:"button",children:g.jsx(ve.HelpIcon,{})})}):null}function Ps(e){const t=hi(e),{label:n,children:r,helpText:i,isEmpty:a}=e;return r===null||typeof r>"u"||r===""?g.jsx(g.Fragment,{}):a?g.jsx(g.Fragment,{}):g.jsxs(E.DescriptionListGroup,{style:{gridColumn:e.fullWidth?"span 3":void 0},children:[n&&g.jsxs(E.DescriptionListTerm,{children:[n,i?g.jsx(p0e,{header:n,content:i}):null]}),g.jsx(E.DescriptionListDescription,{id:t,"data-cy":t,children:r})]})}function CA(e){const{disablePadding:t,alertPrompts:n}=e,r=Fa(),i=e.labelOrientation??r.formLayout,a=e.numberOfColumns?e.numberOfColumns:r.formColumns,o=e.isCompact;let s=g.jsxs(g0e,{variant:"light",padding:{default:"noPadding"},children:[n&&n.length>0&&n.map((l,c)=>g.jsx(E.Alert,{style:{margin:12},isInline:!0,title:l,variant:"warning","data-cy":l},c)),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(Cr,{children:s})),s}const g0e=Pe(E.PageSection)`
387
387
  background-color: transparent;
388
- `;var Qe=(e=>(e.Table="table",e.List="list",e.Cards="cards",e))(Qe||{}),pa=(e=>(e.description="description",e.expanded="expanded",e.hidden="hidden",e))(pa||{}),EA=(e=>(e.name="name",e.subtitle="subtitle",e.description="description",e.hidden="hidden",e.primary="primary",e.secondary="secondary",e))(EA||{}),TA=(e=>(e.name="name",e.subtitle="subtitle",e.description="description",e.hidden="hidden",e))(TA||{}),kA=(e=>(e.hidden="hidden",e))(kA||{}),AA=(e=>(e.hidden="hidden",e))(AA||{}),Mh=(e=>(e.last="last",e))(Mh||{});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(F_,{value:n.value(t)});case"count":return g.jsx(g.Fragment,{children:n.value(t)??"-"});case"labels":return g.jsx(R_,{labels:n.value(t)??[]});default:return g.jsx(g.Fragment,{children:n.cell(t)})}}function Gy(e){return b.useMemo(()=>e.filter(t=>!(t.table==="hidden"||t.table==="description"||t.table==="expanded")),[e])}function PA(e){return b.useMemo(()=>e.filter(t=>t.list!=="hidden"),[e])}function jA(e){return b.useMemo(()=>e.filter(t=>t.card!=="hidden"),[e])}function Ih(e){return b.useMemo(()=>e.filter(t=>t.modal!=="hidden"),[e])}function m0e(e){return e=b.useMemo(()=>e.filter(t=>t.dashboard!=="hidden"),[e]),e=MA(e),e=IA(e),e}function v0e(e,t){const n=Gy(e),r=PA(e),i=jA(e);switch(t){case Qe.Table:return n;case Qe.List:return r;case Qe.Cards:return i}}function DA(e){return b.useMemo(()=>e.filter(t=>t.table==="hidden"?!1:t.table==="description"),[e])}function $A(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 IA(e){return b.useMemo(()=>e.map(t=>({...t,table:t.table==="expanded"?void 0:t.table})),[e])}function LA(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!==Mh.last),[i]),o=b.useMemo(()=>i.filter(s=>s.priority===Mh.last),[i]);return!t||!i.length?null:g.jsxs(g.Fragment,{children:[a.map(s=>g.jsx(Ps,{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 y0e{constructor(t){ai(this,"value");ai(this,"next");this.value=t}}class b0e{constructor(){pp(this,ii,void 0);pp(this,mo,void 0);pp(this,vo,void 0);this.clear()}enqueue(t){const n=new y0e(t);xa(this,ii)?(xa(this,mo).next=n,Ui(this,mo,n)):(Ui(this,ii,n),Ui(this,mo,n)),n1(this,vo)._++}dequeue(){const t=xa(this,ii);if(t)return Ui(this,ii,xa(this,ii).next),n1(this,vo)._--,t.value}clear(){Ui(this,ii,void 0),Ui(this,mo,void 0),Ui(this,vo,0)}get size(){return xa(this,vo)}*[Symbol.iterator](){let t=xa(this,ii);for(;t;)yield t.value,t=t.next}}ii=new WeakMap,mo=new WeakMap,vo=new WeakMap;const x0e={bind(e,t,n){return e.bind(n)}};function _0e(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 b0e;let n=0;const r=()=>{n--,t.size>0&&t.dequeue()()},i=async(s,l,c)=>{n++;const u=(async()=>s(...c))();l(u);try{await u}catch{}r()},a=(s,l,c)=>{t.enqueue(x0e.bind(i.bind(void 0,s,l,c))),(async()=>(await Promise.resolve(),n<e&&t.size>0&&t.dequeue()()))()},o=(s,...l)=>new Promise(c=>{a(s,c,l)});return Object.defineProperties(o,{activeCount:{get:()=>n},pendingCount:{get:()=>t.size},clearQueue:{value(){t.clear()}}}),o}const _c=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 NA(e){const[t,n]=b.useState(!1),r=nn("sm"),[i]=Pt(),{pageItems:a,selectedItems:o,selectItems:s,unselectAll:l,maxSelections:c}=e,u=e.itemCount!==void 0&&e.itemCount>0&&a&&a.length>0&&(a??[]).every(w=>o==null?void 0:o.includes(w)),f=b.useCallback(()=>{u?l==null||l():s==null||s(a??[])},[u,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(w=>!(o!=null&&o.includes(w))),[a,o]),p=b.useMemo(()=>!!(c&&o&&h&&!u&&(o==null?void 0:o.length)+h.length>c),[u,c,o,h]),m=b.useMemo(()=>{const w=o?o.length:0;return g.jsx(eu,{splitButtonItems:[g.jsx(Co,{id:"select-all",ouiaId:"select-all","data-cy":"select-all","aria-label":"Select all",isChecked:u?!0:w>0?null:!1,onChange:f,children:d},"select-all")],onToggle:(S,_)=>n(_),isDisabled:p})},[o,u,f,d,p]),v=b.useMemo(()=>g.jsx(Oo,{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(Oo,{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(sl,{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 FA(e){const{t}=Be(),{id:n,icon:r,placeholder:i,values:a,onSelect:o,options:s,variant:l,disableClearSelection:c,maxChipSize:u,queryLabel:f}=e,[d,h]=Lh(e.open??!1,e.setOpen),[p,m]=Lh(e.searchValue??"",e.setSearchValue),v=b.useRef(null),y=b.useMemo(()=>{const k=[];for(const P of a??[]){const M=s.find(A=>A.value===P);M?k.push(M):f&&P!==void 0&&k.push({label:f(P),value:P})}return k},[s,f,a]),x=k=>g.jsx(E.Tooltip,{content:e.isDisabled,trigger:e.isDisabled?void 0:"manual",children:g.jsx(E.MenuToggle,{id:n,ref:k,onClick:()=>h(!d),isExpanded:d,onKeyDown:P=>{switch(P.key){case"Tab":case"Enter":case"Shift":break;default:h(!0),setTimeout(()=>{_.current&&(_.current.focus(),_.current.value=P.key)},1);break}},"data-cy":n,icon:r,isDisabled:!!e.isDisabled,isFullWidth:!0,style:{paddingTop:2,paddingBottom:4,minHeight:36},children:y.length>0?g.jsx(g.Fragment,{children:l==="count"?g.jsx(E.Chip,{isReadOnly:c,onClick:()=>o(()=>[]),style:{marginTop:-4,marginBottom:-4},children:y.length}):g.jsxs(g.Fragment,{children:[g.jsx(E.ChipGroup,{numChips:99,children:y.map(P=>g.jsx(E.Chip,{isReadOnly:e.disableClearChips,textMaxWidth:u,style:{marginTop:-2,marginBottom:-2},onClick:()=>o(M=>M==null?void 0:M.filter(A=>A!==P.value)),children:P.label},P.label))}),!c&&g.jsx(ve.TimesIcon,{role:"button","aria-hidden":!0,onClick:()=>o(()=>[]),style:{verticalAlign:"middle",marginLeft:8}})]})}):g.jsx("span",{style:{opacity:.7},children:i})})}),w=b.useMemo(()=>y.map(k=>k.label),[y]),S=b.useCallback((k,P)=>{o(M=>{const A=s.find(D=>D.key!==void 0?D.key===P:D.label===P);return A&&((M==null?void 0:M.find(D=>D===A.value))!==void 0?M=M.filter(D=>D!==A.value):(M=M?[...M]:[],M.push(A.value))),M})},[o,s]),_=b.useRef(null);b.useEffect(()=>{d||m("")},[d,m]);const O=b.useMemo(()=>{const k=s.filter(P=>p===""?!0:P.label.toLowerCase().includes(p.toLowerCase()));return e.disableSortOptions||k.sort((P,M)=>P.label.toLowerCase().localeCompare(M.label.toLowerCase())),k},[s,e.disableSortOptions,p]),T=b.useMemo(()=>{if(s.some(P=>!!P.group)){const P={};for(const M of O){const A=M.group??"";P[A]||(P[A]=[]),P[A].push(M)}return P}},[s,O]);return g.jsxs(E.Select,{id:`${n}-select`,selected:w,onSelect:S,isOpen:d,onOpenChange:h,toggle:x,popperProps:{appendTo:()=>document.body},innerRef:v,children:[g.jsx(E.MenuSearch,{children:g.jsx(E.MenuSearchInput,{"data-cy":"search-input",children:g.jsx(E.SearchInput,{id:`${n}-search`,ref:_,value:p,onChange:(k,P)=>m(P),onClear:k=>{k.stopPropagation(),m("")},resultsCount:O.length!==s.length?`${O.length} / ${s.length}`:void 0,onKeyDown:k=>{var P;switch(k.key){case"ArrowDown":case"Tab":{k.preventDefault(),k.stopPropagation();const M=(P=v==null?void 0:v.current)==null?void 0:P.querySelector("li button:not(:disabled),li input:not(:disabled)");M&&M.focus();break}}}})})}),g.jsx(E.Divider,{}),O.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(w0e,{children:T?g.jsx(g.Fragment,{children:Object.keys(T).map(k=>g.jsx(E.SelectGroup,{label:k,children:g.jsx(RA,{searchRef:_,options:O,selectedOptions:y})},k))}):g.jsx(RA,{searchRef:_,options:O,selectedOptions:y})}),e.footer&&g.jsx(E.MenuFooter,{children:e.footer})]})}function RA(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=pi(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 w0e=Pe(Cr)`
388
+ `;var Qe=(e=>(e.Table="table",e.List="list",e.Cards="cards",e))(Qe||{}),pa=(e=>(e.description="description",e.expanded="expanded",e.hidden="hidden",e))(pa||{}),EA=(e=>(e.name="name",e.subtitle="subtitle",e.description="description",e.hidden="hidden",e.primary="primary",e.secondary="secondary",e))(EA||{}),TA=(e=>(e.name="name",e.subtitle="subtitle",e.description="description",e.hidden="hidden",e))(TA||{}),kA=(e=>(e.hidden="hidden",e))(kA||{}),AA=(e=>(e.hidden="hidden",e))(AA||{}),Mh=(e=>(e.last="last",e))(Mh||{});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(F_,{value:n.value(t)});case"count":return g.jsx(g.Fragment,{children:n.value(t)??"-"});case"labels":return g.jsx(R_,{labels:n.value(t)??[]});default:return g.jsx(g.Fragment,{children:n.cell(t)})}}function Gy(e){return b.useMemo(()=>e.filter(t=>!(t.table==="hidden"||t.table==="description"||t.table==="expanded")),[e])}function PA(e){return b.useMemo(()=>e.filter(t=>t.list!=="hidden"),[e])}function jA(e){return b.useMemo(()=>e.filter(t=>t.card!=="hidden"),[e])}function Ih(e){return b.useMemo(()=>e.filter(t=>t.modal!=="hidden"),[e])}function m0e(e){return e=b.useMemo(()=>e.filter(t=>t.dashboard!=="hidden"),[e]),e=MA(e),e=IA(e),e}function v0e(e,t){const n=Gy(e),r=PA(e),i=jA(e);switch(t){case Qe.Table:return n;case Qe.List:return r;case Qe.Cards:return i}}function DA(e){return b.useMemo(()=>e.filter(t=>t.table==="hidden"?!1:t.table==="description"),[e])}function $A(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 IA(e){return b.useMemo(()=>e.map(t=>({...t,table:t.table==="expanded"?void 0:t.table})),[e])}function LA(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!==Mh.last),[i]),o=b.useMemo(()=>i.filter(s=>s.priority===Mh.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 y0e{constructor(t){ai(this,"value");ai(this,"next");this.value=t}}class b0e{constructor(){pp(this,ii,void 0);pp(this,mo,void 0);pp(this,vo,void 0);this.clear()}enqueue(t){const n=new y0e(t);xa(this,ii)?(xa(this,mo).next=n,Ui(this,mo,n)):(Ui(this,ii,n),Ui(this,mo,n)),n1(this,vo)._++}dequeue(){const t=xa(this,ii);if(t)return Ui(this,ii,xa(this,ii).next),n1(this,vo)._--,t.value}clear(){Ui(this,ii,void 0),Ui(this,mo,void 0),Ui(this,vo,0)}get size(){return xa(this,vo)}*[Symbol.iterator](){let t=xa(this,ii);for(;t;)yield t.value,t=t.next}}ii=new WeakMap,mo=new WeakMap,vo=new WeakMap;const x0e={bind(e,t,n){return e.bind(n)}};function _0e(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 b0e;let n=0;const r=()=>{n--,t.size>0&&t.dequeue()()},i=async(s,l,c)=>{n++;const u=(async()=>s(...c))();l(u);try{await u}catch{}r()},a=(s,l,c)=>{t.enqueue(x0e.bind(i.bind(void 0,s,l,c))),(async()=>(await Promise.resolve(),n<e&&t.size>0&&t.dequeue()()))()},o=(s,...l)=>new Promise(c=>{a(s,c,l)});return Object.defineProperties(o,{activeCount:{get:()=>n},pendingCount:{get:()=>t.size},clearQueue:{value(){t.clear()}}}),o}const _c=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 NA(e){const[t,n]=b.useState(!1),r=nn("sm"),[i]=Pt(),{pageItems:a,selectedItems:o,selectItems:s,unselectAll:l,maxSelections:c}=e,u=e.itemCount!==void 0&&e.itemCount>0&&a&&a.length>0&&(a??[]).every(w=>o==null?void 0:o.includes(w)),f=b.useCallback(()=>{u?l==null||l():s==null||s(a??[])},[u,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(w=>!(o!=null&&o.includes(w))),[a,o]),p=b.useMemo(()=>!!(c&&o&&h&&!u&&(o==null?void 0:o.length)+h.length>c),[u,c,o,h]),m=b.useMemo(()=>{const w=o?o.length:0;return g.jsx(eu,{splitButtonItems:[g.jsx(Co,{id:"select-all",ouiaId:"select-all","data-cy":"select-all","aria-label":"Select all",isChecked:u?!0:w>0?null:!1,onChange:f,children:d},"select-all")],onToggle:(S,_)=>n(_),isDisabled:p})},[o,u,f,d,p]),v=b.useMemo(()=>g.jsx(Oo,{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(Oo,{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(sl,{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 FA(e){const{t}=Be(),{id:n,icon:r,placeholder:i,values:a,onSelect:o,options:s,variant:l,disableClearSelection:c,maxChipSize:u,queryLabel:f}=e,[d,h]=Lh(e.open??!1,e.setOpen),[p,m]=Lh(e.searchValue??"",e.setSearchValue),v=b.useRef(null),y=b.useMemo(()=>{const k=[];for(const P of a??[]){const M=s.find(A=>A.value===P);M?k.push(M):f&&P!==void 0&&k.push({label:f(P),value:P})}return k},[s,f,a]),x=k=>g.jsx(E.Tooltip,{content:e.isDisabled,trigger:e.isDisabled?void 0:"manual",children:g.jsx(E.MenuToggle,{id:n,ref:k,onClick:()=>h(!d),isExpanded:d,onKeyDown:P=>{switch(P.key){case"Tab":case"Enter":case"Shift":break;default:h(!0),setTimeout(()=>{_.current&&(_.current.focus(),_.current.value=P.key)},1);break}},"data-cy":n,icon:r,isDisabled:!!e.isDisabled,isFullWidth:!0,style:{paddingTop:2,paddingBottom:4,minHeight:36},children:y.length>0?g.jsx(g.Fragment,{children:l==="count"?g.jsx(E.Chip,{isReadOnly:c,onClick:()=>o(()=>[]),style:{marginTop:-4,marginBottom:-4},children:y.length}):g.jsxs(g.Fragment,{children:[g.jsx(E.ChipGroup,{numChips:99,children:y.map(P=>g.jsx(E.Chip,{isReadOnly:e.disableClearChips,textMaxWidth:u,style:{marginTop:-2,marginBottom:-2},onClick:()=>o(M=>M==null?void 0:M.filter(A=>A!==P.value)),children:P.label},P.label))}),!c&&g.jsx(ve.TimesIcon,{role:"button","aria-hidden":!0,onClick:()=>o(()=>[]),style:{verticalAlign:"middle",marginLeft:8}})]})}):g.jsx("span",{style:{opacity:.7},children:i})})}),w=b.useMemo(()=>y.map(k=>k.label),[y]),S=b.useCallback((k,P)=>{o(M=>{const A=s.find(D=>D.key!==void 0?D.key===P:D.label===P);return A&&((M==null?void 0:M.find(D=>D===A.value))!==void 0?M=M.filter(D=>D!==A.value):(M=M?[...M]:[],M.push(A.value))),M})},[o,s]),_=b.useRef(null);b.useEffect(()=>{d||m("")},[d,m]);const O=b.useMemo(()=>{const k=s.filter(P=>p===""?!0:P.label.toLowerCase().includes(p.toLowerCase()));return e.disableSortOptions||k.sort((P,M)=>P.label.toLowerCase().localeCompare(M.label.toLowerCase())),k},[s,e.disableSortOptions,p]),T=b.useMemo(()=>{if(s.some(P=>!!P.group)){const P={};for(const M of O){const A=M.group??"";P[A]||(P[A]=[]),P[A].push(M)}return P}},[s,O]);return g.jsxs(E.Select,{id:`${n}-select`,selected:w,onSelect:S,isOpen:d,onOpenChange:h,toggle:x,popperProps:{appendTo:()=>document.body},innerRef:v,children:[g.jsx(E.MenuSearch,{children:g.jsx(E.MenuSearchInput,{"data-cy":"search-input",children:g.jsx(E.SearchInput,{id:`${n}-search`,ref:_,value:p,onChange:(k,P)=>m(P),onClear:k=>{k.stopPropagation(),m("")},resultsCount:O.length!==s.length?`${O.length} / ${s.length}`:void 0,onKeyDown:k=>{var P;switch(k.key){case"ArrowDown":case"Tab":{k.preventDefault(),k.stopPropagation();const M=(P=v==null?void 0:v.current)==null?void 0:P.querySelector("li button:not(:disabled),li input:not(:disabled)");M&&M.focus();break}}}})})}),g.jsx(E.Divider,{}),O.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(w0e,{children:T?g.jsx(g.Fragment,{children:Object.keys(T).map(k=>g.jsx(E.SelectGroup,{label:k,children:g.jsx(RA,{searchRef:_,options:O,selectedOptions:y})},k))}):g.jsx(RA,{searchRef:_,options:O,selectedOptions:y})}),e.footer&&g.jsx(E.MenuFooter,{children:e.footer})]})}function RA(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=pi(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 w0e=Pe(Cr)`
389
389
  max-height: 40vh;
390
390
  `;function S0e(e){const{t}=Be(),[n,r]=b.useState(!1),[i,a]=b.useState(!1),[o,s]=b.useState(),[l,c]=b.useState(0),[u,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,w=b.useRef(null),S=b.useCallback(()=>{w.current&&w.current.abort();const k=new AbortController;return w.current=k,r(()=>(a(!1),s(void 0),f(P=>{if(P)return P}),x({next:p.current,signal:k.signal,search:m}).then(P=>{k.signal.aborted||(p.current=P.next,P.remaining||a(!0),f(M=>{if(k.signal.aborted)return M;let A=[...M??[],...P.options];const D=new Set;return A=A.filter(j=>D.has(j.value)?!1:(D.add(j.value),!0)),A.sort((j,$)=>{const I=j.label.toLowerCase(),z=$.label.toLowerCase();return I<z?-1:I>z?1:0}),c(P.remaining+A.length),A}))}).catch(P=>{k.signal.aborted||s(P instanceof Error?P:new Error(t("Unknown error")))}).finally(()=>{k.signal.aborted||r(!1)}),!0)),()=>k.abort()},[x,m,t]),_=b.useCallback(k=>{k.preventDefault(),k.stopPropagation(),S()},[S]),O=b.useCallback(k=>{k.preventDefault(),k.stopPropagation(),c(0),f([]),p.current=void 0,S()},[S]);b.useEffect(()=>{d&&(c(0),f([]),p.current=void 0,S())},[d,S]);const T=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 P;k.preventDefault(),k.stopPropagation(),h(!1),(P=e.onBrowse)==null||P.call(e)},children:t("Browse")})}),!i&&g.jsx(E.ActionListItem,{children:g.jsx(E.Button,{id:"load-more",isLoading:n,onClick:_,isDisabled:n,children:t(n?"Loading...":"Load more")})})]})}),!i&&l!==0&&g.jsx(E.FlexItem,{children:t("Loaded {{count}} of {{total}}",{count:(u==null?void 0:u.length)??0,total:l})})]}),e.footer]});return o?g.jsx(O0e,{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(FA,{id:e.id,icon:e.icon,placeholder:e.placeholder,options:u??[],values:e.values,onSelect:e.onSelect,variant:e.variant,footer:T,open:d,setOpen:h,searchValue:m,setSearchValue:y,isLoading:n,disableClearSelection:e.disableClearSelection,disableClearChips:e.disableClearChips,queryLabel:e.queryLabel})}const O0e=Pe(E.Button)`
391
391
  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.1769",
4
+ "version": "2.4.1771",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",