@webority/ui-react 0.78.1 → 0.79.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import{devWarn as e}from"../lib/devWarn.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"./AppIcon.js";import{AppSkeletonRows as i}from"./AppSkeleton.js";import a from"./AppTablePagination.js";import{attachRowDrag as o,attachScrollEdges as s,syncTargets as c}from"@webority/ui-elements/helpers";import{Fragment as ee,useEffect as l,useLayoutEffect as u,useMemo as d,useRef as f,useState as p}from"react";import{Fragment as te,jsx as m,jsxs as h}from"react/jsx-runtime";import{COLUMN_MAX_WIDTH as ne,COLUMN_MIN_WIDTH as re,DATA_TABLE_TEXT as ie,PIN_AT_VAR as ae,PIN_SIDES as oe,ROW_HEIGHTS as se,ROW_MOVE_LIMIT as ce,ROW_SAVE_ERROR_CLASS as le,groupCount as ue,groupItems as de,measureRows as fe,pinAtValue as pe,pinClasses as me,planPins as he,playRowMoves as ge,rowOrderChanged as _e,saveOutcomeText as ve,settledRows as ye,virtualRange as be}from"@webority/ui-elements/elements/data-table";var xe=[`comfortable`,`cozy`,`compact`],g=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}},_=new Set;function v(t,n){_.has(t)||!g()||(_.add(t),e(`[@webority/ui-react] <AppDataTable> ${n}`))}var Se=100;function y(e){return e===`end`?`wui-cell-end`:e===`num`?`num`:e===`center`?`text-center`:``}function Ce(e){return e==null||e===``?`-`:typeof e==`boolean`?String(e):e}function we(e){if(!e||!(e.total>0))return!1;let t=e.pageSizes?.length?e.pageSizes:[e.pageSize];return e.total>Math.min(...t)}function b({columns:e,rows:g,rowKey:_=e=>e.id,sort:b,onSort:x,loading:S=!1,skeletonRows:Te=5,empty:Ee=`No records found.`,emptyFiltered:De,sourceCount:Oe,rowActions:C,rowActionsLabel:ke,pagination:w,ariaLabel:Ae,className:je=``,wrapperClassName:Me=``,selectable:T=!1,selectedIds:E,isRowSelectable:D,onToggleRow:O,onToggleAll:Ne,onSelectRange:Pe,renderExpanded:Fe,density:k=`comfortable`,striped:Ie=!1,flush:Le=!1,rowDrag:A=!1,maxHeight:j,stickyFirstColumn:Re=!1,stickyActions:ze=!1,stackOnMobile:M=!1,hiddenColumns:Be,rowStatus:Ve,rowHref:N,onRowClick:P,activeRowKey:He,resizableColumns:F=!1,viewKey:Ue,groupBy:I,groupLabel:We,virtual:L=!1,rowSaving:Ge,rowSaveError:Ke,...qe}){n(`AppDataTable`,qe);let Je=Be?.length?new Set(Be):null;e=Je?e.filter(e=>!(e.hideable&&Je.has(e.key))):e,t(`AppDataTable`,`density`,k,xe);for(let n of e)t(`AppDataTable`,`column.pin`,n.pin,oe);let Ye=[`table table-ledger`,k===`cozy`||k===`compact`?`wui-table-${k}`:``,Ie?`wui-table-striped`:``,Re?`wui-table-sticky-first`:``,ze?`wui-table-sticky-actions`:``,M?`wui-table-stack`:``,je].filter(Boolean).join(` `),R=typeof Fe==`function`,[Xe,Ze]=p(()=>new Set),Qe=e=>Ze(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),$e=e.some(e=>typeof e.footer==`function`),z=typeof N==`function`||typeof P==`function`,et=e=>!!e.target.closest(`a, button, input, select, textarea, label, [role='menu'], [role='menuitem'], .dropdown`),tt=(e,t)=>{if(et(t)||(P&&P(e),!N))return;let n=N(e);n&&(t.ctrlKey||t.metaKey||t.button===1?window.open(n,`_blank`,`noopener`):window.location.assign(n))},B=j!==void 0,nt=[`table-wrap`,B?`wui-table-scroll`:``,Le?`wui-table-flush`:``,Me].filter(Boolean).join(` `),rt=B?{maxHeight:j}:void 0,V=Math.max(1,e.length+ +!!C+ +!!T+ +!!R),it=e.some(e=>e.pin===`start`||e.pin===`end`),H=it||F||!!I||L,U=+!!R+ +!!T,at=it?he([...R?[`lead`]:[],...T?[`lead`]:[],...e.map(e=>e.pin===`start`||e.pin===`end`?e.pin:null),...C?[null]:[]]):[],W=(e,t=``)=>{let n=at[e];return n?{className:`${t.trim()} ${me(n)}`.trim(),style:{[ae]:pe(n.side,n.ordinal)}}:{className:t,style:void 0}},ot=(e,t)=>at[e]?{...t,...W(e).style}:t,st=e.length-1+ +!!C;Ue&&!F&&v(`view-key`,"`viewKey` remembers resized widths: add `resizableColumns`."),L&&!B&&v(`virtual-height`,"`virtual` needs `maxHeight`: without a scroll box every row renders."),L&&(R||M)&&v(`virtual-shape`,"`virtual` takes rows of one height, so it is off with `renderExpanded` or `stackOnMobile`.");let G=L&&B&&!R&&!M&&!S&&g?.length>0,K=(e,t)=>!D||!!D(e,t),ct=T&&g?g.reduce((e,t,n)=>e+ +!!K(t,n),0):0,q=T&&g?g.reduce((e,t,n)=>e+(K(t,n)&&E?.has(_(t,n))?1:0),0):0,lt=ct>0&&q===ct,ut=q>0&&!lt,dt=e=>{e&&(e.indeterminate=ut)},ft=f(null),pt=(e,t)=>{let n=ft.current;ft.current=e;let r=t&&n!==null?g.findIndex((e,t)=>_(e,t)===n):-1,i=g.findIndex((t,n)=>_(t,n)===e);if(r<0||i<0||r===i){O?.(e);return}let a=!E?.has(e),o=Math.min(r,i),s=g.slice(o,Math.max(r,i)+1).map((e,t)=>[e,o+t]).filter(([e,t])=>K(e,t)).map(([e,t])=>_(e,t)).filter(e=>(E?.has(e)||!1)!==a);if(Pe)Pe(s,a);else for(let e of s)O?.(e)},mt=e=>{if(!D){Ne?.(e);return}(g||[]).forEach((t,n)=>{let r=_(t,n);K(t,n)&&(E?.has(r)||!1)!==e&&O?.(r)})},[ht,gt]=p(()=>new Set),_t=e=>gt(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),J=d(()=>{let e=(g||[]).map((e,t)=>({row:e,i:t}));return I?de(e,({row:e})=>String(e[I]??``)).flatMap(e=>[{group:e,open:!ht.has(e.key)},...ht.has(e.key)?[]:e.items]):e},[g,I,ht]),Y=f(null),vt=f(null);l(()=>{let e=Y.current;if(!e)return;let t=e=>{let t=e.target.closest?.(`.u-name`);t&&!t.title&&(t.scrollWidth>t.clientWidth||t.scrollHeight>t.clientHeight)&&(t.title=t.textContent.trim())},n=e=>{let t=e.target.closest?.(`tbody > tr[aria-rowindex]`)?.getAttribute(`aria-rowindex`);vt.current=t?Number(t)-2:null},r=t=>{e.contains(t.relatedTarget)||(vt.current=null)};e.addEventListener(`mouseover`,t),e.addEventListener(`focusin`,t),e.addEventListener(`focusin`,n),e.addEventListener(`focusout`,r);let i=s(e);return()=>{e.removeEventListener(`mouseover`,t),e.removeEventListener(`focusin`,t),e.removeEventListener(`focusin`,n),e.removeEventListener(`focusout`,r),i()}},[H]),l(()=>{if(!A||!Y.current)return;let e=o(Y.current);return c(document),e},[A,H]);let yt=f(!1);l(()=>{!yt.current&&(yt.current=!0,q===0)||Y.current?.querySelector(`table`)?.dispatchEvent(new CustomEvent(`selectionchange`,{bubbles:!0,detail:{selected:q,total:g?.length??0,keys:g?g.flatMap((e,t)=>{let n=_(e,t);return K(e,t)&&E?.has(n)?[String(n)]:[]}):[]}}))},[T,q]);let[bt,xt]=p({top:0,height:0}),[X,St]=p(se[k]??se.comfortable);l(()=>{let e=Y.current;if(!G||!e)return;let t=0,n=()=>{t=0;let n=e.querySelector(`:scope > table > thead`)?.getBoundingClientRect().height||0,r={top:Math.max(0,e.scrollTop-n),height:e.clientHeight};xt(e=>e.top===r.top&&e.height===r.height?e:r)},r=()=>{t||=requestAnimationFrame(n)};e.addEventListener(`scroll`,r,{passive:!0});let i=typeof ResizeObserver<`u`?new ResizeObserver(r):null;return i?.observe(e),n(),()=>{e.removeEventListener(`scroll`,r),i?.disconnect(),t&&cancelAnimationFrame(t)}},[G,H]),u(()=>{if(!G)return;let e=(Y.current?.querySelector(`:scope > table > tbody > tr:not(.wui-virtual-spacer, .wui-group-row)`))?.getBoundingClientRect().height;e>0&&Math.abs(e-X)>.5&&St(e)});let Z={start:0,end:J.length,before:0,after:0};if(G){Z=be({scrollTop:bt.top,viewport:bt.height||Number.parseFloat(j)||0,rowHeight:X,count:J.length});let e=vt.current;e!==null&&e>=0&&e<J.length&&(e<Z.start&&Z.start-e<=Se&&(Z={...Z,start:e,before:e*X}),e>=Z.end&&e-Z.end<Se&&(Z={...Z,end:e+1,after:(J.length-e-1)*X}))}let Ct=f(null),wt=f(null),Tt=f(null),Et=!L&&!S&&g?.length>0&&g.length<=ce;u(()=>{let e=Ct.current;if(!Et||!e){wt.current=null,Tt.current=null;return}let t=g.map((e,t)=>_(e,t));_e(Tt.current,t)&&ge(e.rows,wt.current),wt.current=fe(e.rows),Tt.current=t});let Dt=typeof Ge==`function`||typeof Ke==`function`,Ot=e=>{let t=!!Ge?.(e),n=t?``:Ke?.(e)||``;return{state:t?`saving`:n?`error`:null,message:n}},kt=f(null),At=f(null);l(()=>{if(!Dt){At.current=null;return}let t=e[0]?.key,n=new Map;(g||[]).forEach((e,r)=>{let i=t===void 0?void 0:e[t],a=typeof i==`string`||typeof i==`number`?String(i):``;n.set(_(e,r),{...Ot(e),label:a})});let r=ve(ye(At.current,n));At.current=n,r&&kt.current&&(kt.current.textContent=r)});let jt=De!==void 0&&Oe>0?De:Ee,Mt=({group:e,open:t},n)=>{let i=e.items[0].row[I],a=e.items.map(e=>e.row);return m(`tr`,{className:`wui-group-row`,"data-group-key":e.key,"aria-rowindex":G?n+2:void 0,children:m(`th`,{className:`wui-group-cell`,scope:`rowgroup`,colSpan:V,children:h(`button`,{type:`button`,className:`wui-group-toggle`,"aria-expanded":t,onClick:()=>_t(e.key),children:[m(r,{name:`chevron-down`,size:16}),m(`span`,{className:`wui-group-label`,children:We?We(i,a):Ce(i)}),m(`span`,{className:`wui-group-count`,"aria-hidden":`true`,children:ue(e.items.length)}),m(`span`,{className:`visually-hidden wui-group-rows`,children:`, ${ie.rows(e.items.length)}`})]})})},`group:${e.key}`)},Nt=({row:t,i:n},i)=>{let a=_(t,n),o=R&&Xe.has(a),s=He!=null&&String(He)===String(a),c=String(a).replace(/[^a-z0-9]/gi,`_`),l=W(0,`wui-expand-cell`),u=W(+!!R,`wui-select-cell`),d=Dt?Ot(t):null,f=K(t,n);return h(ee,{children:[h(`tr`,{className:[T&&f&&E?.has(a)?`is-selected`:``,z?`wui-row-link`:``,s?`wui-row-active`:``].filter(Boolean).join(` `)||void 0,"aria-current":s?`true`:void 0,"aria-rowindex":G?i+2:void 0,"aria-busy":d?.state===`saving`?`true`:void 0,"data-wui-save-state":d?.state||void 0,"data-status":Ve?.(t)||void 0,"data-href":N?.(t)||void 0,"data-row-key":A?String(a):void 0,tabIndex:z?0:void 0,onClick:z?e=>tt(t,e):void 0,onAuxClick:z&&N?e=>e.button===1&&tt(t,e):void 0,onKeyDown:z?e=>{e.key===`Enter`&&e.target===e.currentTarget&&tt(t,e)}:void 0,children:[R&&m(`td`,{className:l.className,style:l.style,children:m(`button`,{type:`button`,className:`wui-expand-toggle${o?` is-open`:``}`,"aria-expanded":o,"aria-controls":o?`${c}-expanded`:void 0,"aria-label":o?`Collapse row`:`Expand row`,onClick:()=>Qe(a),children:m(r,{name:`chevron-down`,size:16})})}),T&&m(`td`,{className:u.className,style:u.style,children:m(`input`,{type:`checkbox`,className:`wui-check`,checked:f&&(E?.has(a)||!1),disabled:!f,onChange:e=>pt(a,e.nativeEvent.shiftKey),onMouseDown:e=>{e.shiftKey&&e.preventDefault()},"aria-label":`Select row`})}),e.map((e,n)=>h(`td`,{className:W(U+n,(n===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+y(e.align)+(e.cellClassName?` ${e.cellClassName}`:``)).className,style:ot(U+n,e.cellStyle),"data-label":M&&typeof e.label==`string`?e.label:void 0,children:[e.render?e.render(t):Ce(t[e.key]),n===0&&d?.state===`error`&&m(`span`,{className:le,children:d.message})]},e.key)),C&&m(`td`,{children:m(`div`,{className:`u-row-actions`,children:C(t)})})]}),o&&m(`tr`,{className:`wui-row-expanded`,children:m(`td`,{id:`${c}-expanded`,colSpan:V,children:Fe(t)})})]},a)},Pt=(e,t)=>e.group?Mt(e,t):Nt(e,t),Ft=(e,t)=>G?m(`tr`,{className:`wui-virtual-spacer`,"aria-hidden":`true`,hidden:t===0,children:m(`td`,{colSpan:V,style:{height:t}})},e):null,Q=W(0,`wui-expand-cell`),$=W(+!!R,`wui-select-cell`);return h(te,{children:[h(H?`wui-data-table`:`div`,{ref:Y,...H?{class:nt,resizable:F?``:void 0,"view-key":Ue||void 0,"data-wui-row-drag":A?``:void 0}:{className:nt,"data-wui-row-drag":A?``:void 0},style:rt,tabIndex:0,...qe,children:[h(`table`,{className:Ye,"aria-label":Ae,"aria-rowcount":G?J.length+1:void 0,children:[m(`thead`,{children:h(`tr`,{"aria-rowindex":G?1:void 0,children:[R&&m(`th`,{className:Q.className,style:Q.style,children:m(`span`,{className:`visually-hidden`,children:`Expand`})}),T&&m(`th`,{className:$.className,style:$.style,children:m(`input`,{ref:dt,type:`checkbox`,className:`wui-check`,checked:lt,onChange:e=>mt(e.target.checked),"aria-label":`Select all rows`})}),e.map((e,t)=>{let n=!!(e.sortable&&x),i=b&&b.key===e.key,a=e.align===`num`||e.align===`end`,o=n&&m(`span`,{className:`sort-icon${a?` wui-sort-lead`:``}`,children:m(r,{name:`chevrons-up-down`,size:14})}),s=F&&t!==st,c=e.width||e.minWidth?{width:e.width,minWidth:e.minWidth}:void 0;return h(`th`,{className:W(U+t,(n?`sortable `:``)+(t===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+(e.grow?`wui-col-grow `:``)+(s?`wui-col-resizable `:``)+y(e.align)).className,style:ot(U+t,c),"data-key":H?e.key:void 0,"aria-label":s&&typeof e.label==`string`?e.label:void 0,"data-pin":e.pin===`start`||e.pin===`end`?e.pin:void 0,tabIndex:n?0:void 0,"aria-sort":i?b.dir===`asc`?`ascending`:`descending`:n?`none`:void 0,onClick:n?()=>x(e.key):void 0,onKeyDown:n?t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),x(e.key))}:void 0,children:[a&&o,e.label,!a&&o,s&&m(`span`,{className:`wui-col-resize`,role:`separator`,"aria-orientation":`vertical`,"aria-valuemin":re,"aria-valuemax":ne,tabIndex:0,"aria-label":ie.resize(typeof e.label==`string`?e.label:e.key)})]},e.key)}),C&&(ke?m(`th`,{className:`wui-cell-end`,children:ke}):m(`th`,{className:`wui-cell-end`,children:m(`span`,{className:`visually-hidden`,children:`Actions`})}))]})}),m(`tbody`,{ref:Ct,children:S?m(i,{rows:Te,cols:V}):g?.length?h(te,{children:[Ft(`before`,Z.before),J.slice(Z.start,Z.end).map((e,t)=>Pt(e,Z.start+t)),Ft(`after`,Z.after)]}):null}),$e&&!S&&g?.length>0&&m(`tfoot`,{children:h(`tr`,{children:[R&&m(`td`,{className:Q.className,style:Q.style}),T&&m(`td`,{className:$.className,style:$.style}),e.map((e,t)=>m(`td`,{className:W(U+t,(t===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+y(e.align)).className,style:ot(U+t,void 0),children:e.footer?e.footer(g):null},e.key)),C&&m(`td`,{})]})})]}),!S&&!g?.length&&m(`div`,{className:`tbl-empty-block`,children:typeof jt==`string`?m(`div`,{className:`tbl-empty-plain`,children:jt}):jt})]}),we(w)&&m(a,{page:w.page,totalPages:w.totalPages,pageSize:w.pageSize,onPageChange:w.setPage,onPageSizeChange:w.setPageSize,pageSizes:w.pageSizes,mode:w.mode}),Dt&&m(`div`,{ref:kt,className:`visually-hidden`,role:`status`,"aria-live":`polite`,"data-wui-table-status":``})]})}export{b as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"./AppIcon.js";import{AppSkeletonRows as i}from"./AppSkeleton.js";import a from"./AppTablePagination.js";import{attachRowDrag as o,attachScrollEdges as s,syncTargets as c}from"@webority/ui-elements/helpers";import{Fragment as ee,useEffect as l,useLayoutEffect as u,useMemo as d,useRef as f,useState as p}from"react";import{Fragment as te,jsx as m,jsxs as h}from"react/jsx-runtime";import{COLUMN_MAX_WIDTH as ne,COLUMN_MIN_WIDTH as re,DATA_TABLE_TEXT as ie,PIN_AT_VAR as ae,PIN_SIDES as oe,ROW_HEIGHTS as se,ROW_MOVE_LIMIT as ce,ROW_SAVE_ERROR_CLASS as le,groupCount as ue,groupItems as de,measureRows as fe,pinAtValue as pe,pinClasses as me,planPins as he,playRowMoves as ge,rowOrderChanged as _e,saveOutcomeText as ve,settledRows as ye,virtualRange as be}from"@webority/ui-elements/elements/data-table";var xe=[`comfortable`,`cozy`,`compact`],g=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}},_=new Set;function v(t,n){_.has(t)||!g()||(_.add(t),e(`[@webority/ui-react] <AppDataTable> ${n}`))}var Se=100,Ce=e=>e.id,we=(e,t,n)=>{let r=!!t?.(e),i=r?``:n?.(e)||``;return{state:r?`saving`:i?`error`:null,message:i}};function y(e){return e===`end`?`wui-cell-end`:e===`num`?`num`:e===`center`?`text-center`:``}function Te(e){return e==null||e===``?`-`:typeof e==`boolean`?String(e):e}function Ee(e){if(!e||!(e.total>0))return!1;let t=e.pageSizes?.length?e.pageSizes:[e.pageSize];return e.total>Math.min(...t)}function b({columns:e,rows:g,rowKey:_=Ce,sort:b,onSort:x,loading:S=!1,skeletonRows:De=5,empty:Oe=`No records found.`,emptyFiltered:ke,sourceCount:Ae,rowActions:C,rowActionsLabel:je,pagination:w,ariaLabel:Me,className:Ne=``,wrapperClassName:Pe=``,selectable:T=!1,selectedIds:E,isRowSelectable:D,onToggleRow:O,onToggleAll:Fe,onSelectRange:Ie,renderExpanded:Le,density:k=`comfortable`,striped:Re=!1,flush:ze=!1,rowDrag:A=!1,maxHeight:Be,stickyFirstColumn:Ve=!1,stickyActions:He=!1,stackOnMobile:j=!1,hiddenColumns:Ue,rowStatus:We,rowHref:M,onRowClick:Ge,activeRowKey:Ke,resizableColumns:N=!1,viewKey:qe,groupBy:P,groupLabel:Je,virtual:F=!1,rowSaving:I,rowSaveError:L,...Ye}){n(`AppDataTable`,Ye);let Xe=Ue?.length?new Set(Ue):null;e=Xe?e.filter(e=>!(e.hideable&&Xe.has(e.key))):e,t(`AppDataTable`,`density`,k,xe);for(let n of e)t(`AppDataTable`,`column.pin`,n.pin,oe);let Ze=[`table table-ledger`,k===`cozy`||k===`compact`?`wui-table-${k}`:``,Re?`wui-table-striped`:``,Ve?`wui-table-sticky-first`:``,He?`wui-table-sticky-actions`:``,j?`wui-table-stack`:``,Ne].filter(Boolean).join(` `),R=typeof Le==`function`,[Qe,$e]=p(()=>new Set),et=e=>$e(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),tt=e.some(e=>typeof e.footer==`function`),z=typeof M==`function`||typeof Ge==`function`,nt=e=>!!e.target.closest(`a, button, input, select, textarea, label, [role='menu'], [role='menuitem'], .dropdown`),rt=(e,t)=>{if(nt(t)||(Ge&&Ge(e),!M))return;let n=M(e);n&&(t.ctrlKey||t.metaKey||t.button===1?window.open(n,`_blank`,`noopener`):window.location.assign(n))},B=Be!==void 0,it=[`table-wrap`,B?`wui-table-scroll`:``,ze?`wui-table-flush`:``,Pe].filter(Boolean).join(` `),at=B?{maxHeight:Be}:void 0,V=Math.max(1,e.length+ +!!C+ +!!T+ +!!R),ot=e.some(e=>e.pin===`start`||e.pin===`end`),H=ot||N||!!P||F,U=+!!R+ +!!T,st=ot?he([...R?[`lead`]:[],...T?[`lead`]:[],...e.map(e=>e.pin===`start`||e.pin===`end`?e.pin:null),...C?[null]:[]]):[],W=(e,t=``)=>{let n=st[e];return n?{className:`${t.trim()} ${me(n)}`.trim(),style:{[ae]:pe(n.side,n.ordinal)}}:{className:t,style:void 0}},ct=(e,t)=>st[e]?{...t,...W(e).style}:t,lt=e.length-1+ +!!C;qe&&!N&&v(`view-key`,"`viewKey` remembers resized widths: add `resizableColumns`."),F&&!B&&v(`virtual-height`,"`virtual` needs `maxHeight`: without a scroll box every row renders."),F&&(R||j)&&v(`virtual-shape`,"`virtual` takes rows of one height, so it is off with `renderExpanded` or `stackOnMobile`."),!F&&g?.length>500&&v(`rows-without-virtual`,`renders more than 500 rows without virtual: add virtual with maxHeight, or page the data.`);let G=F&&B&&!R&&!j&&!S&&g?.length>0,K=(e,t)=>!D||!!D(e,t),ut=T&&g?g.reduce((e,t,n)=>e+ +!!K(t,n),0):0,q=T&&g?g.reduce((e,t,n)=>e+(K(t,n)&&E?.has(_(t,n))?1:0),0):0,dt=ut>0&&q===ut,ft=q>0&&!dt,pt=e=>{e&&(e.indeterminate=ft)},mt=f(null),ht=(e,t)=>{let n=mt.current;mt.current=e;let r=t&&n!==null?g.findIndex((e,t)=>_(e,t)===n):-1,i=g.findIndex((t,n)=>_(t,n)===e);if(r<0||i<0||r===i){O?.(e);return}let a=!E?.has(e),o=Math.min(r,i),s=g.slice(o,Math.max(r,i)+1).map((e,t)=>[e,o+t]).filter(([e,t])=>K(e,t)).map(([e,t])=>_(e,t)).filter(e=>(E?.has(e)||!1)!==a);if(Ie)Ie(s,a);else for(let e of s)O?.(e)},gt=e=>{if(!D){Fe?.(e);return}(g||[]).forEach((t,n)=>{let r=_(t,n);K(t,n)&&(E?.has(r)||!1)!==e&&O?.(r)})},[_t,vt]=p(()=>new Set),yt=e=>vt(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),J=d(()=>{let e=(g||[]).map((e,t)=>({row:e,i:t}));return P?de(e,({row:e})=>String(e[P]??``)).flatMap(e=>[{group:e,open:!_t.has(e.key)},..._t.has(e.key)?[]:e.items]):e},[g,P,_t]),Y=f(null),bt=f(null);l(()=>{let e=Y.current;if(!e)return;let t=e=>{let t=e.target.closest?.(`.u-name`);t&&!t.title&&(t.scrollWidth>t.clientWidth||t.scrollHeight>t.clientHeight)&&(t.title=t.textContent.trim())},n=e=>{let t=e.target.closest?.(`tbody > tr[aria-rowindex]`)?.getAttribute(`aria-rowindex`);bt.current=t?Number(t)-2:null},r=t=>{e.contains(t.relatedTarget)||(bt.current=null)};e.addEventListener(`mouseover`,t),e.addEventListener(`focusin`,t),e.addEventListener(`focusin`,n),e.addEventListener(`focusout`,r);let i=s(e);return()=>{e.removeEventListener(`mouseover`,t),e.removeEventListener(`focusin`,t),e.removeEventListener(`focusin`,n),e.removeEventListener(`focusout`,r),i()}},[H]),l(()=>{if(!A||!Y.current)return;let e=o(Y.current);return c(document),e},[A,H]);let xt=f(!1);l(()=>{!xt.current&&(xt.current=!0,q===0)||Y.current?.querySelector(`table`)?.dispatchEvent(new CustomEvent(`selectionchange`,{bubbles:!0,detail:{selected:q,total:g?.length??0,keys:g?g.flatMap((e,t)=>{let n=_(e,t);return K(e,t)&&E?.has(n)?[String(n)]:[]}):[]}}))},[T,q]);let[St,Ct]=p({top:0,height:0}),[X,wt]=p(se[k]??se.comfortable);l(()=>{let e=Y.current;if(!G||!e)return;let t=0,n=()=>{t=0;let n=e.querySelector(`:scope > table > thead`)?.getBoundingClientRect().height||0,r={top:Math.max(0,e.scrollTop-n),height:e.clientHeight};Ct(e=>e.top===r.top&&e.height===r.height?e:r)},r=()=>{t||=requestAnimationFrame(n)};e.addEventListener(`scroll`,r,{passive:!0});let i=typeof ResizeObserver<`u`?new ResizeObserver(r):null;return i?.observe(e),n(),()=>{e.removeEventListener(`scroll`,r),i?.disconnect(),t&&cancelAnimationFrame(t)}},[G,H]),u(()=>{if(!G)return;let e=(Y.current?.querySelector(`:scope > table > tbody > tr:not(.wui-virtual-spacer, .wui-group-row)`))?.getBoundingClientRect().height;e>0&&Math.abs(e-X)>.5&&wt(e)},[k,g?.length,F,G]);let Z={start:0,end:J.length,before:0,after:0};if(G){Z=be({scrollTop:St.top,viewport:St.height||Number.parseFloat(Be)||0,rowHeight:X,count:J.length});let e=bt.current;e!==null&&e>=0&&e<J.length&&(e<Z.start&&Z.start-e<=Se&&(Z={...Z,start:e,before:e*X}),e>=Z.end&&e-Z.end<Se&&(Z={...Z,end:e+1,after:(J.length-e-1)*X}))}let Tt=f(null),Et=f(null),Dt=f(null),Ot=!F&&!S&&g?.length>0&&g.length<=ce;u(()=>{let e=Tt.current;if(!Ot||!e){Et.current=null,Dt.current=null;return}let t=g.map((e,t)=>_(e,t));_e(Dt.current,t)&&ge(e.rows,Et.current),Et.current=fe(e.rows),Dt.current=t});let kt=typeof I==`function`||typeof L==`function`,At=f(null),jt=f(null);l(()=>{if(!kt){jt.current=null;return}let t=e[0]?.key,n=new Map;(g||[]).forEach((e,r)=>{let i=t===void 0?void 0:e[t],a=typeof i==`string`||typeof i==`number`?String(i):``;n.set(_(e,r),{...we(e,I,L),label:a})});let r=ve(ye(jt.current,n));jt.current=n,r&&At.current&&(At.current.textContent=r)},[g,I,L,_]);let Mt=ke!==void 0&&Ae>0?ke:Oe,Nt=({group:e,open:t},n)=>{let i=e.items[0].row[P],a=e.items.map(e=>e.row);return m(`tr`,{className:`wui-group-row`,"data-group-key":e.key,"aria-rowindex":G?n+2:void 0,children:m(`th`,{className:`wui-group-cell`,scope:`rowgroup`,colSpan:V,children:h(`button`,{type:`button`,className:`wui-group-toggle`,"aria-expanded":t,onClick:()=>yt(e.key),children:[m(r,{name:`chevron-down`,size:16}),m(`span`,{className:`wui-group-label`,children:Je?Je(i,a):Te(i)}),m(`span`,{className:`wui-group-count`,"aria-hidden":`true`,children:ue(e.items.length)}),m(`span`,{className:`visually-hidden wui-group-rows`,children:`, ${ie.rows(e.items.length)}`})]})})},`group:${e.key}`)},Pt=({row:t,i:n},i)=>{let a=_(t,n),o=R&&Qe.has(a),s=Ke!=null&&String(Ke)===String(a),c=String(a).replace(/[^a-z0-9]/gi,`_`),l=W(0,`wui-expand-cell`),u=W(+!!R,`wui-select-cell`),d=kt?we(t,I,L):null,f=K(t,n);return h(ee,{children:[h(`tr`,{className:[T&&f&&E?.has(a)?`is-selected`:``,z?`wui-row-link`:``,s?`wui-row-active`:``].filter(Boolean).join(` `)||void 0,"aria-current":s?`true`:void 0,"aria-rowindex":G?i+2:void 0,"aria-busy":d?.state===`saving`?`true`:void 0,"data-wui-save-state":d?.state||void 0,"data-status":We?.(t)||void 0,"data-href":M?.(t)||void 0,"data-row-key":A?String(a):void 0,tabIndex:z?0:void 0,onClick:z?e=>rt(t,e):void 0,onAuxClick:z&&M?e=>e.button===1&&rt(t,e):void 0,onKeyDown:z?e=>{e.key===`Enter`&&e.target===e.currentTarget&&rt(t,e)}:void 0,children:[R&&m(`td`,{className:l.className,style:l.style,children:m(`button`,{type:`button`,className:`wui-expand-toggle${o?` is-open`:``}`,"aria-expanded":o,"aria-controls":o?`${c}-expanded`:void 0,"aria-label":o?`Collapse row`:`Expand row`,onClick:()=>et(a),children:m(r,{name:`chevron-down`,size:16})})}),T&&m(`td`,{className:u.className,style:u.style,children:m(`input`,{type:`checkbox`,className:`wui-check`,checked:f&&(E?.has(a)||!1),disabled:!f,onChange:e=>ht(a,e.nativeEvent.shiftKey),onMouseDown:e=>{e.shiftKey&&e.preventDefault()},"aria-label":`Select row`})}),e.map((e,n)=>h(`td`,{className:W(U+n,(n===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+y(e.align)+(e.cellClassName?` ${e.cellClassName}`:``)).className,style:ct(U+n,e.cellStyle),"data-label":j&&typeof e.label==`string`?e.label:void 0,children:[e.render?e.render(t):Te(t[e.key]),n===0&&d?.state===`error`&&m(`span`,{className:le,children:d.message})]},e.key)),C&&m(`td`,{children:m(`div`,{className:`u-row-actions`,children:C(t)})})]}),o&&m(`tr`,{className:`wui-row-expanded`,children:m(`td`,{id:`${c}-expanded`,colSpan:V,children:Le(t)})})]},a)},Ft=(e,t)=>e.group?Nt(e,t):Pt(e,t),It=(e,t)=>G?m(`tr`,{className:`wui-virtual-spacer`,"aria-hidden":`true`,hidden:t===0,children:m(`td`,{colSpan:V,style:{height:t}})},e):null,Q=W(0,`wui-expand-cell`),$=W(+!!R,`wui-select-cell`);return h(te,{children:[h(H?`wui-data-table`:`div`,{ref:Y,...H?{class:it,resizable:N?``:void 0,"view-key":qe||void 0,"data-wui-row-drag":A?``:void 0}:{className:it,"data-wui-row-drag":A?``:void 0},style:at,tabIndex:0,...Ye,children:[h(`table`,{className:Ze,"aria-label":Me,"aria-rowcount":G?J.length+1:void 0,children:[m(`thead`,{children:h(`tr`,{"aria-rowindex":G?1:void 0,children:[R&&m(`th`,{className:Q.className,style:Q.style,children:m(`span`,{className:`visually-hidden`,children:`Expand`})}),T&&m(`th`,{className:$.className,style:$.style,children:m(`input`,{ref:pt,type:`checkbox`,className:`wui-check`,checked:dt,onChange:e=>gt(e.target.checked),"aria-label":`Select all rows`})}),e.map((e,t)=>{let n=!!(e.sortable&&x),i=b&&b.key===e.key,a=e.align===`num`||e.align===`end`,o=n&&m(`span`,{className:`sort-icon${a?` wui-sort-lead`:``}`,children:m(r,{name:`chevrons-up-down`,size:14})}),s=N&&t!==lt,c=e.width||e.minWidth?{width:e.width,minWidth:e.minWidth}:void 0;return h(`th`,{className:W(U+t,(n?`sortable `:``)+(t===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+(e.grow?`wui-col-grow `:``)+(s?`wui-col-resizable `:``)+y(e.align)).className,style:ct(U+t,c),"data-key":H?e.key:void 0,"aria-label":s&&typeof e.label==`string`?e.label:void 0,"data-pin":e.pin===`start`||e.pin===`end`?e.pin:void 0,tabIndex:n?0:void 0,"aria-sort":i?b.dir===`asc`?`ascending`:`descending`:n?`none`:void 0,onClick:n?()=>x(e.key):void 0,onKeyDown:n?t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),x(e.key))}:void 0,children:[a&&o,e.label,!a&&o,s&&m(`span`,{className:`wui-col-resize`,role:`separator`,"aria-orientation":`vertical`,"aria-valuemin":re,"aria-valuemax":ne,tabIndex:0,"aria-label":ie.resize(typeof e.label==`string`?e.label:e.key)})]},e.key)}),C&&(je?m(`th`,{className:`wui-cell-end`,children:je}):m(`th`,{className:`wui-cell-end`,children:m(`span`,{className:`visually-hidden`,children:`Actions`})}))]})}),m(`tbody`,{ref:Tt,children:S?m(i,{rows:De,cols:V}):g?.length?h(te,{children:[It(`before`,Z.before),J.slice(Z.start,Z.end).map((e,t)=>Ft(e,Z.start+t)),It(`after`,Z.after)]}):null}),tt&&!S&&g?.length>0&&m(`tfoot`,{children:h(`tr`,{children:[R&&m(`td`,{className:Q.className,style:Q.style}),T&&m(`td`,{className:$.className,style:$.style}),e.map((e,t)=>m(`td`,{className:W(U+t,(t===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+y(e.align)).className,style:ct(U+t,void 0),children:e.footer?e.footer(g):null},e.key)),C&&m(`td`,{})]})})]}),!S&&!g?.length&&m(`div`,{className:`tbl-empty-block`,children:typeof Mt==`string`?m(`div`,{className:`tbl-empty-plain`,children:Mt}):Mt})]}),Ee(w)&&m(a,{page:w.page,totalPages:w.totalPages,pageSize:w.pageSize,onPageChange:w.setPage,onPageSizeChange:w.setPageSize,pageSizes:w.pageSizes,mode:w.mode}),kt&&m(`div`,{ref:At,className:`visually-hidden`,role:`status`,"aria-live":`polite`,"data-wui-table-status":``})]})}export{b as default};
@@ -1 +1 @@
1
- import e from"./warnUnknownProps.js";import t from"../lib/FieldMessage.js";import n from"./AppInfoTip.js";import r from"./AppRequiredMark.js";import{useId as i}from"react";import{jsx as a,jsxs as o}from"react/jsx-runtime";function s({label:s,options:c=[],name:l,value:u,defaultValue:d,onChange:f,inline:p=!1,required:m=!1,disabled:h=!1,error:g,hint:_,help:v,helpLabel:y=`More information`,id:b,className:x=``,fieldClassName:S=``,style:C,...w}){e(`AppRadioGroup`,w);let T=i(),E=b||T,D=l||E,O=`${E}-error`,k=`${E}-hint`,A=u!==void 0;return o(`div`,{className:`field${S?` ${S}`:``}`,children:[s!=null&&o(`span`,{className:`label`,id:`${E}-label`,children:[s,m&&a(r,{}),v&&a(n,{label:y,children:v})]}),a(`div`,{className:[`wui-radio-group`,p?`wui-radio-group-inline`:``,x].filter(Boolean).join(` `),style:C,id:E,role:`radiogroup`,"aria-labelledby":s==null?void 0:`${E}-label`,"aria-required":m?`true`:void 0,"aria-invalid":g?`true`:void 0,"aria-describedby":g?O:_?k:void 0,...w,children:c.map((e,t)=>{let n=`${E}-${t}`;return o(`div`,{className:`form-check`,children:[a(`input`,{type:`radio`,className:`form-check-input`,id:n,name:D,value:e.value,disabled:h||e.disabled||void 0,required:m||void 0,...A?{checked:u===e.value,onChange:()=>f?.(e.value)}:{defaultChecked:d===e.value,onChange:()=>f?.(e.value)}}),a(`label`,{className:`form-check-label`,htmlFor:n,children:e.label})]},e.value)})}),a(t,{error:g,hint:_,errorId:O,hintId:k})]})}export{s as default};
1
+ import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"../lib/FieldMessage.js";import r from"./AppInfoTip.js";import i from"./AppRequiredMark.js";import{useId as a}from"react";import{jsx as o,jsxs as s}from"react/jsx-runtime";var c=[`default`,`card`];function l({label:l,options:u=[],name:d,value:f,defaultValue:p,onChange:m,variant:h=`default`,inline:g=!1,required:_=!1,disabled:v=!1,error:y,hint:b,help:x,helpLabel:S=`More information`,id:C,className:w=``,fieldClassName:T=``,style:E,...D}){t(`AppRadioGroup`,D),e(`AppRadioGroup`,`variant`,h,c);let O=a(),k=C||O,A=d||k,j=`${k}-error`,M=`${k}-hint`,N=f!==void 0;return s(`div`,{className:`field${T?` ${T}`:``}`,children:[l!=null&&s(`span`,{className:`label`,id:`${k}-label`,children:[l,_&&o(i,{}),x&&o(r,{label:S,children:x})]}),o(`div`,{className:[`wui-radio-group`,h===`card`?`wui-radio-group-card`:``,g?`wui-radio-group-inline`:``,w].filter(Boolean).join(` `),style:E,id:k,role:`radiogroup`,"aria-labelledby":l==null?void 0:`${k}-label`,"aria-required":_?`true`:void 0,"aria-invalid":y?`true`:void 0,"aria-describedby":y?j:b?M:void 0,...D,children:u.map((e,t)=>{let n=`${k}-${t}`,r=e.description==null?void 0:`${n}-desc`;return s(`div`,{className:`form-check`,children:[o(`input`,{type:`radio`,className:`form-check-input`,id:n,name:A,value:e.value,disabled:v||e.disabled||void 0,required:_||void 0,"aria-describedby":r,...N?{checked:f===e.value,onChange:()=>m?.(e.value)}:{defaultChecked:p===e.value,onChange:()=>m?.(e.value)}}),o(`label`,{className:`form-check-label`,htmlFor:n,children:e.label}),r&&o(`div`,{className:`wui-radio-option-desc`,id:r,children:e.description})]},e.value)})}),o(n,{error:y,hint:b,errorId:j,hintId:M})]})}export{l as default};
@@ -1 +1 @@
1
- import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"./AppIcon.js";import{Children as r,forwardRef as i,useEffect as a,useRef as o}from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";import"@webority/ui-elements/elements/wizard";var l=[`steps`,`journey`,`icons`,`tiles`],u=[`primary`,`success`,`warning`,`danger`,`info`],d=[`horizontal`,`vertical`],f=[`done`,`active`,`pending`,`error`],p=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],m=[`check`,`alert-triangle`,`minus`],h=[`sm`,`md`,`lg`],g={sm:14,md:16,lg:20},_=i(function({steps:i=[],children:_,active:v,defaultActive:y=0,onStepChange:b,onFinish:x,onSkip:S,beforeNext:C,onInvalid:w,onClose:T,variant:E=`steps`,tone:D,doneTone:O,orientation:k=`horizontal`,iconVariant:A,size:j=`md`,iconSize:M,skippable:N=!1,nonLinear:P=!1,hideStepper:F=!1,hideConnectors:I=!1,disabled:L=!1,label:R=`Progress`,backLabel:z=`Back`,nextLabel:B=`Next`,skipLabel:V=`Skip`,finishLabel:H=`Finish`,topBar:U=!1,barTitle:W,closeLabel:G=`Close`,className:K=``,...q},J){t(`AppWizard`,q),e(`AppWizard`,`variant`,E,l),e(`AppWizard`,`tone`,D,u),e(`AppWizard`,`doneTone`,O,u),e(`AppWizard`,`orientation`,k,d),e(`AppWizard`,`iconVariant`,A,p),e(`AppWizard`,`size`,j,h);let Y=M>0?M:g[j]??g.md;for(let t of i)e(`AppWizard`,`steps[].status`,t.status,f);let X=o(null),Z=e=>{X.current=e,typeof J==`function`?J(e):J&&(J.current=e)},Q=r.toArray(_),$=A&&A!==`linear`?[...new Set([...m,...i.map(e=>e.icon).filter(Boolean)])]:[],ee=[D&&`wui-step-tone-${D}`,O&&`wui-step-done-tone-${O}`,j!==`md`&&h.includes(j)&&`wui-step-size-${j}`,K].filter(Boolean).join(` `);return a(()=>{let e=X.current;if(!e)return;let t=v===void 0?y:v;t&&(e.active=t)},[]),a(()=>{let e=X.current;e&&v!==void 0&&Number(e.active)!==v&&(e.active=v)},[v]),a(()=>{let e=X.current;e&&(e.beforeNext=C??null)},[C]),a(()=>{let e=X.current;if(!e)return;let t=e=>b?.(e.detail.index,e.detail),n=e=>x?.(e.detail),r=e=>S?.(e.detail.index),i=e=>w?.(e.detail.index),a=e=>T?.(e.detail);return e.addEventListener(`wui-wizard:change`,t),e.addEventListener(`wui-wizard:finish`,n),e.addEventListener(`wui-wizard:skip`,r),e.addEventListener(`wui-wizard:invalid`,i),e.addEventListener(`wui-wizard:close`,a),()=>{e.removeEventListener(`wui-wizard:change`,t),e.removeEventListener(`wui-wizard:finish`,n),e.removeEventListener(`wui-wizard:skip`,r),e.removeEventListener(`wui-wizard:invalid`,i),e.removeEventListener(`wui-wizard:close`,a)}},[b,x,S,w,T]),c(`wui-wizard`,{ref:Z,variant:E,orientation:k,"icon-size":Y===16?void 0:Y,skippable:N?``:void 0,"non-linear":P?``:void 0,"hide-stepper":F?``:void 0,"hide-connectors":I?``:void 0,disabled:L?``:void 0,label:R,"back-label":z,"next-label":B,"skip-label":V,"finish-label":H,"top-bar":U?``:void 0,"bar-title":W||void 0,"close-label":G,className:ee||void 0,...q,children:[i.map((e,t)=>s(`wui-wizard-step`,{label:e.label,description:e.description||void 0,optional:e.optional?``:void 0,icon:e.icon||void 0,status:e.status||void 0,children:Q[t]},e.key??`${e.label}-${t}`)),$.length>0&&s(`span`,{hidden:!0,"data-wui-glyphs":``,children:$.map(e=>s(n,{name:e,size:Y,variant:A},e))})]})});export{_ as default};
1
+ import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"./AppIcon.js";import{Children as r,forwardRef as i,useEffect as a,useRef as o}from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";import"@webority/ui-elements/elements/wizard";var l=[`steps`,`journey`,`icons`,`tiles`],u=[`primary`,`success`,`warning`,`danger`,`info`],d=[`horizontal`,`vertical`],ee=[`center`,`start`],f=[`done`,`active`,`pending`,`error`],p=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],m=[`check`,`alert-triangle`,`minus`],h=[`sm`,`md`,`lg`],g={sm:14,md:16,lg:20},_=i(function({steps:i=[],children:_,active:v,defaultActive:y=0,onStepChange:b,onFinish:x,onSkip:S,beforeNext:C,onInvalid:w,onClose:T,variant:E=`steps`,tone:D,doneTone:O,orientation:k=`horizontal`,align:A=`center`,iconVariant:j,size:M=`md`,iconSize:N,skippable:P=!1,nonLinear:F=!1,hideStepper:I=!1,hideConnectors:L=!1,disabled:R=!1,label:z=`Progress`,backLabel:B=`Back`,nextLabel:V=`Next`,skipLabel:H=`Skip`,finishLabel:U=`Finish`,topBar:W=!1,barTitle:G,closeLabel:K=`Close`,className:q=``,...J},Y){t(`AppWizard`,J),e(`AppWizard`,`variant`,E,l),e(`AppWizard`,`tone`,D,u),e(`AppWizard`,`doneTone`,O,u),e(`AppWizard`,`orientation`,k,d),e(`AppWizard`,`align`,A,ee),e(`AppWizard`,`iconVariant`,j,p),e(`AppWizard`,`size`,M,h);let X=N>0?N:g[M]??g.md;for(let t of i)e(`AppWizard`,`steps[].status`,t.status,f);let Z=o(null),Q=e=>{Z.current=e,typeof Y==`function`?Y(e):Y&&(Y.current=e)},te=r.toArray(_),$=j&&j!==`linear`?[...new Set([...m,...i.map(e=>e.icon).filter(Boolean)])]:[],ne=[D&&`wui-step-tone-${D}`,O&&`wui-step-done-tone-${O}`,M!==`md`&&h.includes(M)&&`wui-step-size-${M}`,q].filter(Boolean).join(` `);return a(()=>{let e=Z.current;if(!e)return;let t=v===void 0?y:v;t&&(e.active=t)},[]),a(()=>{let e=Z.current;e&&v!==void 0&&Number(e.active)!==v&&(e.active=v)},[v]),a(()=>{let e=Z.current;e&&(e.beforeNext=C??null)},[C]),a(()=>{let e=Z.current;if(!e)return;let t=e=>b?.(e.detail.index,e.detail),n=e=>x?.(e.detail),r=e=>S?.(e.detail.index),i=e=>w?.(e.detail.index),a=e=>T?.(e.detail);return e.addEventListener(`wui-wizard:change`,t),e.addEventListener(`wui-wizard:finish`,n),e.addEventListener(`wui-wizard:skip`,r),e.addEventListener(`wui-wizard:invalid`,i),e.addEventListener(`wui-wizard:close`,a),()=>{e.removeEventListener(`wui-wizard:change`,t),e.removeEventListener(`wui-wizard:finish`,n),e.removeEventListener(`wui-wizard:skip`,r),e.removeEventListener(`wui-wizard:invalid`,i),e.removeEventListener(`wui-wizard:close`,a)}},[b,x,S,w,T]),c(`wui-wizard`,{ref:Q,variant:E,orientation:k,align:A===`start`?`start`:void 0,"icon-size":X===16?void 0:X,skippable:P?``:void 0,"non-linear":F?``:void 0,"hide-stepper":I?``:void 0,"hide-connectors":L?``:void 0,disabled:R?``:void 0,label:z,"back-label":B,"next-label":V,"skip-label":H,"finish-label":U,"top-bar":W?``:void 0,"bar-title":G||void 0,"close-label":K,className:ne||void 0,...J,children:[i.map((e,t)=>s(`wui-wizard-step`,{label:e.label,description:e.description||void 0,optional:e.optional?``:void 0,icon:e.icon||void 0,status:e.status||void 0,children:te[t]},e.key??`${e.label}-${t}`)),$.length>0&&s(`span`,{hidden:!0,"data-wui-glyphs":``,children:$.map(e=>s(n,{name:e,size:X,variant:j},e))})]})});export{_ as default};
@@ -9,11 +9,14 @@
9
9
  *
10
10
  * @param {object} props
11
11
  * @param {import('react').ReactNode} props.label Visible group label; also the group's accessible name.
12
- * @param {{ value: string, label: import('react').ReactNode, disabled?: boolean }[]} props.options
12
+ * @param {{ value: string, label: import('react').ReactNode, description?: import('react').ReactNode, disabled?: boolean }[]} props.options
13
+ * `description` is a muted line under the option's label, read with the radio as its description.
13
14
  * @param {string} [props.name] Shared name of the radios. Defaults to a generated one.
14
15
  * @param {string} [props.value] Selected value (controlled).
15
16
  * @param {string} [props.defaultValue] Initially selected value (uncontrolled).
16
17
  * @param {(value: string) => void} [props.onChange]
18
+ * @param {'default'|'card'} [props.variant='default'] `card` draws each option as a bordered card
19
+ * the whole of which selects it; the chosen card takes the primary border and a tinted fill.
17
20
  * @param {boolean} [props.inline=false] Options in a row (wrapping) instead of a column.
18
21
  * @param {boolean} [props.required=false]
19
22
  * @param {boolean} [props.disabled=false] Disables every option.
@@ -26,17 +29,19 @@
26
29
  * @param {import('react').CSSProperties} [props.style] Inline style; lands on the group with `className`.
27
30
  * @param {string} [props.fieldClassName] Class on the `.field` wrapper.
28
31
  */
29
- export default function AppRadioGroup({ label, options, name, value, defaultValue, onChange, inline, required, disabled, error, hint, help, helpLabel, id, className, fieldClassName, style, ...rest }: {
32
+ export default function AppRadioGroup({ label, options, name, value, defaultValue, onChange, variant, inline, required, disabled, error, hint, help, helpLabel, id, className, fieldClassName, style, ...rest }: {
30
33
  label: import('react').ReactNode;
31
34
  options: {
32
35
  value: string;
33
36
  label: import('react').ReactNode;
37
+ description?: import('react').ReactNode;
34
38
  disabled?: boolean;
35
39
  }[];
36
40
  name?: string;
37
41
  value?: string;
38
42
  defaultValue?: string;
39
43
  onChange?: (value: string) => void;
44
+ variant?: 'default' | 'card';
40
45
  inline?: boolean;
41
46
  required?: boolean;
42
47
  disabled?: boolean;
@@ -23,6 +23,7 @@ import "@webority/ui-elements/elements/wizard";
23
23
  * @param {'primary'|'success'|'warning'|'danger'|'info'} [props.tone] Recolour the whole stepper accent (active fill, done rail, ring, done tint) to a semantic ramp. Unset keeps the variant's default (primary for steps/journey, success/green for icons). For any other colour, override the `--wui-step-accent` / `--wui-step-soft` CSS variables via `style` or a `className` instead.
24
24
  * @param {'primary'|'success'|'warning'|'danger'|'info'} [props.doneTone] Recolour completed steps only (their badge, "STEP n" eyebrow and the filled line after them) to a semantic ramp; the current step keeps the `tone` accent. Unset, completed steps follow `tone`. For any other colour, override the `--wui-step-done-accent` / `--wui-step-done-soft` CSS variables via `style` or a `className` instead.
25
25
  * @param {'horizontal'|'vertical'} [props.orientation='horizontal']
26
+ * @param {'center'|'start'} [props.align='center'] Where each step's badge, label and description sit in its column on a horizontal stepper: centred, or at the start with the line running from badge to badge. Applies to the steps and icons variants; journey, tiles and vertical steps are start-aligned already.
26
27
  * @param {'linear'|'outline'|'bold'|'bulk'|'broken'|'twotone'} [props.iconVariant='linear'] The iconsax style of
27
28
  * every header glyph: the done tick, the error alert, the skipped dash and each step's own `icon`.
28
29
  * @param {'sm'|'md'|'lg'} [props.size='md'] Scales the stepper header: the badge, its number, the labels and the glyphs.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webority/ui-react",
3
- "version": "0.78.1",
3
+ "version": "0.79.1",
4
4
  "description": "Webority shared React component library — App* primitives on react-bootstrap + the @webority/theme design system.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",
@@ -27,11 +27,11 @@
27
27
  },
28
28
  "sideEffects": false,
29
29
  "dependencies": {
30
- "@webority/theme": "0.78.1",
31
- "@webority/ui-elements": "0.78.1"
30
+ "@webority/theme": "0.79.1",
31
+ "@webority/ui-elements": "0.79.1"
32
32
  },
33
33
  "peerDependencies": {
34
- "@webority/analytics": "^0.23.0",
34
+ "@webority/analytics": "^0.24.0",
35
35
  "bootstrap": "5.3.3",
36
36
  "react": "^19.0.0",
37
37
  "react-bootstrap": "^2.10.0",
@@ -45,7 +45,7 @@
45
45
  "@types/react": "^19.2.17",
46
46
  "@vitejs/plugin-react": "^6.0.1",
47
47
  "@vitest/coverage-v8": "5.0.1",
48
- "@webority/analytics": "0.23.2",
48
+ "@webority/analytics": "0.24.0",
49
49
  "bootstrap": "5.3.3",
50
50
  "jsdom": "30.1.1",
51
51
  "react": "^19.2.6",