@ansible/ansible-ui-framework 2.4.1889 → 2.4.1891

Sign up to get free protection for your applications and to get access to all the features.
package/index.js CHANGED
@@ -34698,7 +34698,7 @@ function m1e(e) {
34698
34698
  function ic(e) {
34699
34699
  const t = na(e), { label: n, children: r, helpText: i, isEmpty: a } = e;
34700
34700
  return r === null || typeof r > "u" || r === "" ? /* @__PURE__ */ g.jsx(g.Fragment, {}) : a ? /* @__PURE__ */ g.jsx(g.Fragment, {}) : /* @__PURE__ */ g.jsxs(is, { style: { gridColumn: e.fullWidth ? "span 3" : void 0 }, children: [
34701
- n && /* @__PURE__ */ g.jsxs(Sm, { children: [
34701
+ n && /* @__PURE__ */ g.jsxs(Sm, { "data-cy": `label-${t}`, children: [
34702
34702
  n,
34703
34703
  i ? /* @__PURE__ */ g.jsx(m1e, { header: n, content: i }) : null
34704
34704
  ] }),
package/index.umd.cjs CHANGED
@@ -383,7 +383,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
383
383
  font-size: var(--pf-v5-global--FontSize--sm);
384
384
  --pf-v5-c-form__group-label-help--Color: var(--pf-v5-global--Color--200);
385
385
  --pf-v5-c-form__group-label-help--hover--Color: var(--pf-v5-global--Color--100);
386
- `;function x0e(e){const{ariaLabel:t="",content:n,header:r,id:i="",maxWidth:a="",...o}=e,[s]=Pt();return n?m.jsx(E.Popover,{bodyContent:n,headerContent:r,hideOnOutsideClick:!0,id:i,"data-cy":i,maxWidth:a,...o,children:m.jsx(b0e,{"aria-label":t??s.moreInformation,"aria-haspopup":"true",className:"pf-v5-c-form__group-label-help",onClick:l=>l.preventDefault(),type:"button",children:m.jsx(ve.HelpIcon,{})})}):null}function js(e){const t=mi(e),{label:n,children:r,helpText:i,isEmpty:a}=e;return r===null||typeof r>"u"||r===""?m.jsx(m.Fragment,{}):a?m.jsx(m.Fragment,{}):m.jsxs(E.DescriptionListGroup,{style:{gridColumn:e.fullWidth?"span 3":void 0},children:[n&&m.jsxs(E.DescriptionListTerm,{children:[n,i?m.jsx(x0e,{header:n,content:i}):null]}),m.jsx(E.DescriptionListDescription,{id:t,"data-cy":t,children:r})]})}function CA(e){const{disablePadding:t,alertPrompts:n}=e,r=za(),i=e.labelOrientation??r.formLayout,a=e.numberOfColumns?e.numberOfColumns:r.formColumns,o=e.isCompact;let s=m.jsxs(_0e,{variant:"light",padding:{default:"noPadding"},children:[n&&n.length>0&&n.map((l,c)=>m.jsx(E.Alert,{style:{margin:12},isInline:!0,title:l,variant:"warning","data-cy":l},c)),m.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=m.jsx(Cr,{children:s})),s}const _0e=Pe(E.PageSection)`
386
+ `;function x0e(e){const{ariaLabel:t="",content:n,header:r,id:i="",maxWidth:a="",...o}=e,[s]=Pt();return n?m.jsx(E.Popover,{bodyContent:n,headerContent:r,hideOnOutsideClick:!0,id:i,"data-cy":i,maxWidth:a,...o,children:m.jsx(b0e,{"aria-label":t??s.moreInformation,"aria-haspopup":"true",className:"pf-v5-c-form__group-label-help",onClick:l=>l.preventDefault(),type:"button",children:m.jsx(ve.HelpIcon,{})})}):null}function js(e){const t=mi(e),{label:n,children:r,helpText:i,isEmpty:a}=e;return r===null||typeof r>"u"||r===""?m.jsx(m.Fragment,{}):a?m.jsx(m.Fragment,{}):m.jsxs(E.DescriptionListGroup,{style:{gridColumn:e.fullWidth?"span 3":void 0},children:[n&&m.jsxs(E.DescriptionListTerm,{"data-cy":`label-${t}`,children:[n,i?m.jsx(x0e,{header:n,content:i}):null]}),m.jsx(E.DescriptionListDescription,{id:t,"data-cy":t,children:r})]})}function CA(e){const{disablePadding:t,alertPrompts:n}=e,r=za(),i=e.labelOrientation??r.formLayout,a=e.numberOfColumns?e.numberOfColumns:r.formColumns,o=e.isCompact;let s=m.jsxs(_0e,{variant:"light",padding:{default:"noPadding"},children:[n&&n.length>0&&n.map((l,c)=>m.jsx(E.Alert,{style:{margin:12},isInline:!0,title:l,variant:"warning","data-cy":l},c)),m.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=m.jsx(Cr,{children:s})),s}const _0e=Pe(E.PageSection)`
387
387
  background-color: transparent;
388
388
  `;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||{}),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||{}),Ih=(e=>(e.last="last",e))(Ih||{});function Jt(e){var r;const{item:t,column:n}=e;if(!n)return m.jsx(m.Fragment,{});switch(n.type){case"text":return m.jsx(B_,{text:n.value(t),to:(r=n.to)==null?void 0:r.call(n,t)});case"description":return m.jsx("div",{style:{minWidth:200,whiteSpace:"normal"},children:n.value(t)});case"datetime":return m.jsx(F_,{value:n.value(t)});case"count":return m.jsx(m.Fragment,{children:n.value(t)??"-"});case"labels":return m.jsx(R_,{labels:n.value(t)??[]});default:return m.jsx(m.Fragment,{children:n.cell(t)})}}function qy(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 Lh(e){return b.useMemo(()=>e.filter(t=>t.modal!=="hidden"),[e])}function w0e(e){return e=b.useMemo(()=>e.filter(t=>t.dashboard!=="hidden"),[e]),e=MA(e),e=IA(e),e}function S0e(e,t){const n=qy(e),r=PA(e),i=jA(e);switch(t){case et.Table:return n;case et.List:return r;case et.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!==Ih.last),[i]),o=b.useMemo(()=>i.filter(s=>s.priority===Ih.last),[i]);return!t||!i.length?null:m.jsxs(m.Fragment,{children:[a.map(s=>m.jsx(js,{helpText:s.helpText,label:s.header,children:m.jsx(Jt,{column:s,item:t})},s.id??s.header)),r||null,o.map(s=>m.jsx(js,{label:s.header,children:m.jsx(Jt,{column:s,item:t})},s.id??s.header))]})}class O0e{constructor(t){si(this,"value");si(this,"next");this.value=t}}class C0e{constructor(){mp(this,oi,void 0);mp(this,yo,void 0);mp(this,bo,void 0);this.clear()}enqueue(t){const n=new O0e(t);Sa(this,oi)?(Sa(this,yo).next=n,qi(this,yo,n)):(qi(this,oi,n),qi(this,yo,n)),n1(this,bo)._++}dequeue(){const t=Sa(this,oi);if(t)return qi(this,oi,Sa(this,oi).next),n1(this,bo)._--,t.value}clear(){qi(this,oi,void 0),qi(this,yo,void 0),qi(this,bo,0)}get size(){return Sa(this,bo)}*[Symbol.iterator](){let t=Sa(this,oi);for(;t;)yield t.value,t=t.next}}oi=new WeakMap,yo=new WeakMap,bo=new WeakMap;const E0e={bind(e,t,n){return e.bind(n)}};function T0e(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 C0e;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(E0e.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 wc=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=rn("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(_=>o==null?void 0:o.includes(_)),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(_=>!(o!=null&&o.includes(_))),[a,o]),p=b.useMemo(()=>!!(c&&o&&h&&!u&&(o==null?void 0:o.length)+h.length>c),[u,c,o,h]),g=b.useMemo(()=>{const _=o?o.length:0;return m.jsx(tu,{splitButtonItems:[m.jsx(To,{id:"select-all",ouiaId:"select-all","data-cy":"select-all","aria-label":"Select all",isChecked:u?!0:_>0?null:!1,onChange:f,children:d},"select-all")],onToggle:(S,w)=>n(w),isDisabled:p})},[o,u,f,d,p]),v=b.useMemo(()=>m.jsx(Eo,{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(()=>m.jsx(Eo,{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 m.jsx("div",{style:{marginLeft:-8},children:m.jsx(ll,{isOpen:t,toggle:g,dropdownItems:x,style:{zIndex:400}})})}function Nh(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}=Ie(),{id:n,icon:r,placeholder:i,values:a,onSelect:o,options:s,variant:l,disableClearSelection:c,maxChipSize:u,queryLabel:f}=e,[d,h]=Nh(e.open??!1,e.setOpen),[p,g]=Nh(e.searchValue??"",e.setSearchValue),v=b.useRef(null),y=b.useMemo(()=>{const k=[];for(const $ of a??[]){const M=s.find(A=>A.value===$);M?k.push(M):f&&$!==void 0&&k.push({label:f($),value:$})}return k},[s,f,a]),x=k=>m.jsx(E.Tooltip,{content:e.isDisabled,trigger:e.isDisabled?void 0:"manual",children:m.jsx(E.MenuToggle,{id:n,ref:k,onClick:()=>h(!d),isExpanded:d,onKeyDown:$=>{switch($.key){case"Tab":case"Enter":case"Shift":break;default:h(!0),setTimeout(()=>{w.current&&(w.current.focus(),w.current.value=$.key)},1);break}},"data-cy":n,icon:r,isDisabled:!!e.isDisabled,isFullWidth:!0,style:{paddingTop:2,paddingBottom:4,minHeight:36},children:y.length>0?m.jsx(m.Fragment,{children:l==="count"?m.jsx(E.Chip,{isReadOnly:c,onClick:()=>o(()=>[]),style:{marginTop:-4,marginBottom:-4},children:y.length}):m.jsxs(m.Fragment,{children:[m.jsx(E.ChipGroup,{numChips:99,children:y.map($=>m.jsx(E.Chip,{isReadOnly:e.disableClearChips,textMaxWidth:u,style:{marginTop:-2,marginBottom:-2},onClick:()=>o(M=>M==null?void 0:M.filter(A=>A!==$.value)),children:$.label},$.label))}),!c&&m.jsx(ve.TimesIcon,{role:"button","aria-hidden":!0,onClick:()=>o(()=>[]),style:{verticalAlign:"middle",marginLeft:8}})]})}):m.jsx("span",{style:{opacity:.7},children:i})})}),_=b.useMemo(()=>y.map(k=>k.label),[y]),S=b.useCallback((k,$)=>{o(M=>{const A=s.find(j=>j.key!==void 0?j.key===$:j.label===$);return A&&((M==null?void 0:M.find(j=>j===A.value))!==void 0?M=M.filter(j=>j!==A.value):(M=M?[...M]:[],M.push(A.value))),M})},[o,s]),w=b.useRef(null);b.useEffect(()=>{d||g("")},[d,g]);const O=b.useMemo(()=>{const k=s.filter($=>p===""?!0:$.label.toLowerCase().includes(p.toLowerCase()));return e.disableSortOptions||k.sort(($,M)=>$.label.toLowerCase().localeCompare(M.label.toLowerCase())),k},[s,e.disableSortOptions,p]),T=b.useMemo(()=>{if(s.some($=>!!$.group)){const $={};for(const M of O){const A=M.group??"";$[A]||($[A]=[]),$[A].push(M)}return $}},[s,O]);return m.jsxs(E.Select,{id:`${n}-select`,selected:_,onSelect:S,isOpen:d,onOpenChange:h,toggle:x,popperProps:{appendTo:()=>document.body},innerRef:v,children:[m.jsx(E.MenuSearch,{children:m.jsx(E.MenuSearchInput,{"data-cy":"search-input",children:m.jsx(E.SearchInput,{id:`${n}-search`,ref:w,value:p,onChange:(k,$)=>g($),onClear:k=>{k.stopPropagation(),g("")},resultsCount:O.length!==s.length?`${O.length} / ${s.length}`:void 0,onKeyDown:k=>{var $;switch(k.key){case"ArrowDown":case"Tab":{k.preventDefault(),k.stopPropagation();const M=($=v==null?void 0:v.current)==null?void 0:$.querySelector("li button:not(:disabled),li input:not(:disabled)");M&&M.focus();break}}}})})}),m.jsx(E.Divider,{}),O.length===0?m.jsx(m.Fragment,{children:e.isLoading?m.jsx(E.Bullseye,{style:{padding:16},children:m.jsx(E.Spinner,{size:"lg"})}):m.jsx(E.SelectOption,{isDisabled:!0,children:t("No results found")},"no result")}):m.jsx(k0e,{children:T?m.jsx(m.Fragment,{children:Object.keys(T).map(k=>m.jsx(E.SelectGroup,{label:k,children:m.jsx(RA,{searchRef:w,options:O,selectedOptions:y})},k))}):m.jsx(RA,{searchRef:w,options:O,selectedOptions:y})}),e.footer&&m.jsx(E.MenuFooter,{children:e.footer})]})}function RA(e){return m.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=gi(t);return m.jsx(E.SelectOption,{id:n,icon:t.icon,value:t.key!==void 0?t.key:t.label,description:t.description?m.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 k0e=Pe(Cr)`
389
389
  max-height: 40vh;
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.1889",
4
+ "version": "2.4.1891",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",