@webority/ui-react 0.161.0 → 0.163.0

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.
@@ -2,7 +2,7 @@
2
2
  "kind": "WeborityWeb",
3
3
  "library": {
4
4
  "name": "@webority/ui-react",
5
- "version": "0.161.0"
5
+ "version": "0.163.0"
6
6
  },
7
7
  "rendererProtocolVersion": 14,
8
8
  "platform": "Web",
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "name": "webority-web",
3
- "version": "0.161.0",
3
+ "version": "0.163.0",
4
4
  "platform": "Web",
5
5
  "kitModuleVersion": 2,
6
6
  "rendererProtocolVersion": 14,
7
7
  "library": {
8
8
  "name": "@webority/ui-react",
9
- "version": "0.161.0"
9
+ "version": "0.163.0"
10
10
  },
11
11
  "files": {
12
12
  "manifest.json": {
13
- "sha256": "2dec05b92a7183a5144c248d1d89cfee39d07e1a2dce417307ae4ade787db8ea",
13
+ "sha256": "81766bf1c45733bb35f4a420eff42bc5d5f27fe4380c848b0747e1e09c60e0ce",
14
14
  "bytes": 1015716
15
15
  },
16
16
  "kit.js": {
17
- "sha256": "236b6eca499a1b253b27b2728daa5a0ef6f178ca44d0ac954c00d4b2ef7807a9",
18
- "bytes": 9847791
17
+ "sha256": "f4992b08b83732f02ce17a4a5bb582af351578cd43fe627b77d77fe88011029d",
18
+ "bytes": 9848128
19
19
  },
20
20
  "kit.css": {
21
21
  "sha256": "13b14f71fb6ea024945f95cba617b4f1d49f44a65ba7c7ed05d2354805539ef6",
@@ -1 +1 @@
1
- import{linkTarget as e}from"../lib/linkTarget.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppIcon.js";import r from"./assertValidValue.js";import ee from"./warnUnknownProps.js";import{useState as te}from"react";import{Card as i}from"react-bootstrap";import{Fragment as a,jsx as o,jsxs as s}from"react/jsx-runtime";var ne=[`flat`,`elevated`,`outline`,`filled`,`accent`],c={elevated:`card-elevated`,outline:`card-outlined`,filled:`card-muted`,accent:`card-accent`},l=[`primary`,`success`,`warning`,`danger`,`info`],u=[`none`,`sm`,`md`,`lg`],d=[`sans`,`serif`],f={xs:320,sm:420,md:560,lg:720};function p(p){let{marker:re,props:ie}=t(`AppCard`,p),{title:m,subtitle:h,headerIcon:g,titleClassName:_=``,titleFont:v=`sans`,header:y,headerExtra:b,headerActions:x,footer:S,media:C,children:w,variant:T=`flat`,tone:E=`primary`,padding:D=`md`,maxWidth:O,className:ae=``,bodyClassName:k=``,headerClassName:A=``,body:j=!0,lifted:M=!1,flush:N=!1,divided:P=!1,href:F,onClick:I,linkComponent:L,onClose:R,dismissible:z,closeLabel:B=`Close`,...V}=ie,[H,U]=te(!1);ee(`AppCard`,V),r(`AppCard`,`variant`,T,ne),r(`AppCard`,`tone`,E,l),r(`AppCard`,`padding`,D,u),r(`AppCard`,`titleFont`,v,d);let{style:W,as:G,...K}=V,q=F!=null||I!=null,oe=[c[T]??``,T===`accent`&&E&&E!==`primary`?`tone-${E}`:``,D&&D!==`md`?`card-pad-${D}`:``,N?`card-flush`:``,P?`card-divided`:``,M?`card-lifted`:``,O==null?``:`card-constrained`,q?`card-clickable`:``,ae].filter(Boolean).join(` `)||void 0,J=O==null?void 0:f[String(O)],Y=O==null?void 0:J==null?typeof O==`number`?`${O}px`:O:`${J}px`,se=Y?{"--card-max-width":Y,...W}:W,X={};if(F!=null){let t=e(L,{href:F});X=t.Tag===`a`?{as:`a`,href:t.linkProps.href}:{as:t.Tag,to:t.linkProps.to},I&&(X.onClick=I)}else I!=null&&(X={role:`button`,tabIndex:0,onClick:I,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),I(e))}});let Z=z??typeof R==`function`,ce=Z?/* @__PURE__ */ o(`button`,{type:`button`,className:`card-close`,"aria-label":B,onClick:e=>{e.preventDefault(),e.stopPropagation(),U(!0),R?.()},onKeyDown:e=>e.stopPropagation(),children:/* @__PURE__ */ o(n,{name:`x`,size:16})}):null,Q=m!=null||h!=null||g!=null,le=y!=null||Q||b!=null||x!=null||Z,$=g==null?null:typeof g==`string`?/* @__PURE__ */ o(n,{name:g,size:18}):g;return H?null:/* @__PURE__ */ s(i,{className:oe,style:se,...re,...K,...G===void 0?null:{as:G},...X,children:[C!=null&&/* @__PURE__ */ o(`div`,{className:`card-media`,children:C}),le&&/* @__PURE__ */ s(i.Header,{className:A||void 0,children:[y??/* @__PURE__ */ s(a,{children:[Q&&/* @__PURE__ */ s(`div`,{className:`card-header-main`,children:[$!=null&&/* @__PURE__ */ o(`span`,{className:`card-header-icon`,children:$}),/* @__PURE__ */ s(`div`,{className:`card-header-titles`,children:[m!=null&&/* @__PURE__ */ o(`div`,{className:[`card-title`,_].filter(Boolean).join(` `),style:v===`serif`?{fontFamily:`var(--wui-font-display)`}:void 0,children:m}),h!=null&&/* @__PURE__ */ o(`div`,{className:`card-subtitle`,children:h})]})]}),b,x!=null&&/* @__PURE__ */ o(`div`,{className:`card-header-actions`,children:x})]}),ce]}),j?/* @__PURE__ */ o(i.Body,{className:k||void 0,children:w}):w,S!=null&&/* @__PURE__ */ o(`div`,{className:`card-footer`,children:S})]})}export{p as default};
1
+ import{linkTarget as e}from"../lib/linkTarget.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppIcon.js";import r from"./assertValidValue.js";import i from"./warnUnknownProps.js";import{isImeSafeEnter as ee}from"@webority/ui-elements/helpers";import{useState as a}from"react";import{Card as o}from"react-bootstrap";import{Fragment as s,jsx as c,jsxs as l}from"react/jsx-runtime";var te=[`flat`,`elevated`,`outline`,`filled`,`accent`],ne={elevated:`card-elevated`,outline:`card-outlined`,filled:`card-muted`,accent:`card-accent`},re=[`primary`,`success`,`warning`,`danger`,`info`],u=[`none`,`sm`,`md`,`lg`],d=[`sans`,`serif`],ie={xs:320,sm:420,md:560,lg:720};function f(f){let{marker:p,props:m}=t(`AppCard`,f),{title:h,subtitle:g,headerIcon:_,titleClassName:v=``,titleFont:y=`sans`,header:b,headerExtra:x,headerActions:S,footer:C,media:w,children:T,variant:E=`flat`,tone:D=`primary`,padding:O=`md`,maxWidth:k,className:ae=``,bodyClassName:A=``,headerClassName:j=``,body:M=!0,lifted:N=!1,flush:P=!1,divided:F=!1,href:I,onClick:L,linkComponent:R,onClose:z,dismissible:B,closeLabel:V=`Close`,...H}=m,[U,W]=a(!1);i(`AppCard`,H),r(`AppCard`,`variant`,E,te),r(`AppCard`,`tone`,D,re),r(`AppCard`,`padding`,O,u),r(`AppCard`,`titleFont`,y,d);let{style:G,as:K,...q}=H,oe=I!=null||L!=null,se=[ne[E]??``,E===`accent`&&D&&D!==`primary`?`tone-${D}`:``,O&&O!==`md`?`card-pad-${O}`:``,P?`card-flush`:``,F?`card-divided`:``,N?`card-lifted`:``,k==null?``:`card-constrained`,oe?`card-clickable`:``,ae].filter(Boolean).join(` `)||void 0,J=k==null?void 0:ie[String(k)],Y=k==null?void 0:J==null?typeof k==`number`?`${k}px`:k:`${J}px`,ce=Y?{"--card-max-width":Y,...G}:G,X={};if(I!=null){let t=e(R,{href:I});X=t.Tag===`a`?{as:`a`,href:t.linkProps.href}:{as:t.Tag,to:t.linkProps.to},L&&(X.onClick=L)}else L!=null&&(X={role:`button`,tabIndex:0,onClick:L,onKeyDown:e=>{(ee(e.nativeEvent)||e.key===` `)&&(e.preventDefault(),L(e))}});let Z=B??typeof z==`function`,le=Z?/* @__PURE__ */ c(`button`,{type:`button`,className:`card-close`,"aria-label":V,onClick:e=>{e.preventDefault(),e.stopPropagation(),W(!0),z?.()},onKeyDown:e=>e.stopPropagation(),children:/* @__PURE__ */ c(n,{name:`x`,size:16})}):null,Q=h!=null||g!=null||_!=null,ue=b!=null||Q||x!=null||S!=null||Z,$=_==null?null:typeof _==`string`?/* @__PURE__ */ c(n,{name:_,size:18}):_;return U?null:/* @__PURE__ */ l(o,{className:se,style:ce,...p,...q,...K===void 0?null:{as:K},...X,children:[w!=null&&/* @__PURE__ */ c(`div`,{className:`card-media`,children:w}),ue&&/* @__PURE__ */ l(o.Header,{className:j||void 0,children:[b??/* @__PURE__ */ l(s,{children:[Q&&/* @__PURE__ */ l(`div`,{className:`card-header-main`,children:[$!=null&&/* @__PURE__ */ c(`span`,{className:`card-header-icon`,children:$}),/* @__PURE__ */ l(`div`,{className:`card-header-titles`,children:[h!=null&&/* @__PURE__ */ c(`div`,{className:[`card-title`,v].filter(Boolean).join(` `),style:y===`serif`?{fontFamily:`var(--wui-font-display)`}:void 0,children:h}),g!=null&&/* @__PURE__ */ c(`div`,{className:`card-subtitle`,children:g})]})]}),x,S!=null&&/* @__PURE__ */ c(`div`,{className:`card-header-actions`,children:S})]}),le]}),M?/* @__PURE__ */ c(o.Body,{className:A||void 0,children:T}):T,C!=null&&/* @__PURE__ */ c(`div`,{className:`card-footer`,children:C})]})}export{f as default};
@@ -1 +1 @@
1
- import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/useElementEntry.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppIcon.js";import i from"./AppSkeleton.js";import a from"./AppTablePagination.js";import o from"./assertValidValue.js";import s from"./warnUnknownProps.js";import{COLUMN_MAX_WIDTH as ee,COLUMN_MIN_WIDTH as te,DATA_TABLE_TEXT as c,PIN_AT_VAR as l,PIN_SIDES as u,ROW_HEIGHTS as ne,ROW_MOVE_LIMIT as re,ROW_SAVE_ERROR_CLASS as ie,attachRowDrag as ae,attachScrollEdges as oe,groupCount as se,groupItems as ce,measureRows as le,pinAtValue as ue,pinClasses as de,planPins as fe,playRowMoves as pe,rowOrderChanged as me,saveOutcomeText as he,settledRows as ge,syncTargets as _e,virtualRange as ve}from"@webority/ui-elements/helpers";import{Children as ye,Fragment as be,isValidElement as xe,useCallback as Se,useEffect as d,useLayoutEffect as Ce,useMemo as we,useRef as f,useState as p}from"react";import{Fragment as Te,jsx as m,jsxs as h}from"react/jsx-runtime";import{FORCED_STATE_CLASSES as Ee}from"@webority/theme/runtime";var De=()=>import(`@webority/ui-elements/elements/data-table`),Oe=[`comfortable`,`cozy`,`compact`],ke=[`auto`,`fixed`];function g(e,t){return typeof e==`object`&&e?Reflect.get(e,t):void 0}function Ae(e,t){if(e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`||xe(e)||Array.isArray(e))return e;throw Error(`AppDataTable: the value under "${t}" is not renderable; give that column a render function.`)}function je(e,t){return Ae(g(e,t),t)}var _=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}},v=/* @__PURE__ */ new Set;function y(t,n){!v.has(t)&&_()&&(v.add(t),e(`[@webority/ui-react] <AppDataTable> ${n}`))}var Me=100,Ne=e=>{let t=typeof e==`object`&&e&&`id`in e?e.id:void 0;return typeof t==`string`||typeof t==`number`?t:void 0},Pe=()=>{},Fe=()=>({total:0,keys:[]}),Ie=[],Le=(e,t,n)=>{let r=!!t?.(e),i=r?``:n?.(e)||``;return{state:r?`saving`:i?`error`:null,message:i}};function b(e){return e===`end`?`wui-cell-end`:e===`num`?`num`:e===`center`?`text-center`:``}function Re(e){return e===`center`?`44%`:e===`end`||e===`num`?`56%`:`60%`}function ze(e){return e==null||e===``?`-`:Array.isArray(e)?ye.toArray(e):typeof e==`boolean`?String(e):e}function Be(e){if(!e||!(e.total>0))return!1;let t=e.pageSizes?.length?e.pageSizes:[e.pageSize];return e.total>Math.min(...t)}function Ve(e){t(`wui-data-table`,De);let{marker:ye,props:xe}=n(`AppDataTable`,e),{columns:_,rows:v=Ie,rowKey:Ve=Ne,sort:He,onSort:Ue,loading:x=!1,skeletonRows:We=5,empty:Ge=`No records found.`,emptyFiltered:Ke,sourceCount:qe,rowActions:S,rowActionsLabel:Je,pagination:C,ariaLabel:Ye,className:Xe=``,wrapperClassName:Ze=``,selectable:w=!1,selectedIds:T,isRowSelectable:Qe,onToggleRow:$e,onToggleAll:et,onSelectRange:tt,renderExpanded:nt,density:E=`comfortable`,tableLayout:rt=`auto`,striped:it=!1,flush:at=!1,pad:ot,headerTone:st,rowDrag:D=!1,maxHeight:ct,stickyFirstColumn:lt=!1,stickyActions:ut=!1,stackOnMobile:O=!1,hiddenColumns:dt,rowStatus:ft,rowHref:k,onRowClick:pt,activeRowKey:mt,hoverRowKey:ht,resizableColumns:A=!1,viewKey:gt,groupBy:j,groupLabel:_t,virtual:M=!1,rowSaving:N,rowSaveError:P,...vt}=xe;s(`AppDataTable`,vt);let{style:yt,...bt}=vt,F=Se((e,t)=>{let n=Ve(e,t);if(n==null)throw Error(`AppDataTable: a row has no key. Pass rowKey, or give every row an id.`);return n},[Ve]),xt=dt?.length?new Set(dt):null;_=xt?_.filter(e=>!(e.hideable&&xt.has(e.key))):_,o(`AppDataTable`,`density`,E,Oe),o(`AppDataTable`,`tableLayout`,rt,ke);for(let e of _)o(`AppDataTable`,`column.pin`,e.pin,u);let St=[`table table-ledger`,E===`cozy`||E===`compact`?`wui-table-${E}`:``,it?`wui-table-striped`:``,lt?`wui-table-sticky-first`:``,ut?`wui-table-sticky-actions`:``,O?`wui-table-stack`:``,Xe].filter(Boolean).join(` `),I=typeof nt==`function`,[Ct,wt]=p(()=>/* @__PURE__ */ new Set),Tt=e=>wt(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),Et=_.some(e=>typeof e.footer==`function`),L=typeof k==`function`||typeof pt==`function`,Dt=e=>!!(e.target instanceof Element&&e.target.closest(`a, button, input, select, textarea, label, [role='menu'], [role='menuitem'], .dropdown`)),Ot=(e,t)=>{if(Dt(t)||(pt&&pt(e),!k))return;let n=k(e);n&&(t.ctrlKey||t.metaKey||t.button===1?window.open(n,`_blank`,`noopener`):window.location.assign(n))},R=ct!==void 0,kt=[`table-wrap`,R?`wui-table-scroll`:``,at?`wui-table-flush`:``,Ze].filter(Boolean).join(` `),At={maxHeight:R?ct:void 0,"--wui-table-pad":ot!=null&&!at?`${ot}px`:void 0,"--wui-table-header-bg":st??void 0},jt=Object.values(At).some(e=>e!==void 0)||yt!==void 0?{...At,...yt}:void 0,Mt=Math.max(1,_.length+ +!!S+ +!!w+ +!!I),Nt=_.some(e=>e.pin===`start`||e.pin===`end`),Pt=Nt||A||!!j||M,z=+!!I+ +!!w,Ft=Nt?fe([...I?[`lead`]:[],...w?[`lead`]:[],..._.map(e=>e.pin===`start`||e.pin===`end`?e.pin:null),...S?[null]:[]]):[],B=(e,t=``)=>{let n=Ft[e];return n?{className:`${t.trim()} ${de(n)}`.trim(),style:{[l]:ue(n.side,n.ordinal)}}:{className:t,style:void 0}},V=(e,t)=>Ft[e]?{...t,...B(e).style}:t,It=_.length-1+ +!!S;gt&&!A&&y(`view-key`,"`viewKey` remembers resized widths: add `resizableColumns`."),M&&!R&&y(`virtual-height`,"`virtual` needs `maxHeight`: without a scroll box every row renders."),M&&(I||O)&&y(`virtual-shape`,"`virtual` takes rows of one height, so it is off with `renderExpanded` or `stackOnMobile`."),!M&&v?.length>500&&y(`rows-without-virtual`,`renders more than 500 rows without virtual: add virtual with maxHeight, or page the data.`);let H=M&&R&&!I&&!O&&!x&&v?.length>0,U=(e,t)=>!Qe||!!Qe(e,t),Lt=w&&v?v.reduce((e,t,n)=>e+ +!!U(t,n),0):0,W=w&&v?v.reduce((e,t,n)=>e+(U(t,n)&&T?.has(F(t,n))?1:0),0):0,Rt=Lt>0&&W===Lt,zt=W>0&&!Rt,Bt=e=>{e&&(e.indeterminate=zt)},Vt=f(null),Ht=(e,t)=>{let n=Vt.current;Vt.current=e;let r=t&&n!==null?v.findIndex((e,t)=>F(e,t)===n):-1,i=v.findIndex((t,n)=>F(t,n)===e);if(r<0||i<0||r===i){$e?.(e);return}let a=!T?.has(e),o=Math.min(r,i),s=v.slice(o,Math.max(r,i)+1).map((e,t)=>[e,o+t]).filter(([e,t])=>U(e,t)).map(([e,t])=>F(e,t)).filter(e=>(T?.has(e)||!1)!==a);if(tt)tt(s,a);else for(let e of s)$e?.(e)},Ut=e=>{Qe?(v||[]).forEach((t,n)=>{let r=F(t,n);U(t,n)&&(T?.has(r)||!1)!==e&&$e?.(r)}):et?.(e)},[Wt,Gt]=p(()=>/* @__PURE__ */ new Set),Kt=e=>Gt(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),G=we(()=>{let e=(v||[]).map((e,t)=>({row:e,i:t}));return j?ce(e,({row:e})=>String(g(e,j)??``)).flatMap(e=>[{group:e,open:!Wt.has(e.key)},...Wt.has(e.key)?[]:e.items]):e},[v,j,Wt]),qt=f(null),[K,Jt]=p(null),Yt=Se(e=>{qt.current=e,Jt(e)},[]),Xt=f(null);d(()=>{let e=K;if(!e)return;let t=e=>{let t=e.target instanceof Element?e.target.closest(`.u-name`):null;t&&!t.title&&(t.scrollWidth>t.clientWidth||t.scrollHeight>t.clientHeight)&&(t.title=(t.textContent??``).trim())},n=e=>{let t=e.target instanceof Element?e.target.closest(`tbody > tr[aria-rowindex]`)?.getAttribute(`aria-rowindex`):null;Xt.current=t?Number(t)-2:null},r=t=>{t.relatedTarget instanceof Node&&e.contains(t.relatedTarget)||(Xt.current=null)};e.addEventListener(`mouseover`,t),e.addEventListener(`focusin`,t),e.addEventListener(`focusin`,n),e.addEventListener(`focusout`,r);let i=oe(e);return()=>{e.removeEventListener(`mouseover`,t),e.removeEventListener(`focusin`,t),e.removeEventListener(`focusin`,n),e.removeEventListener(`focusout`,r),i()}},[K]),d(()=>{if(!D||!K)return;let e=ae(K);return _e(document),e},[D,K]);let Zt=f(Fe);Ce(()=>{Zt.current=()=>({total:v?.length??0,keys:v?v.flatMap((e,t)=>{let n=F(e,t);return U(e,t)&&T?.has(n)?[String(n)]:[]}):[]})});let Qt=f(!1);d(()=>{if(!Qt.current&&(Qt.current=!0,W===0))return;let{total:e,keys:t}=Zt.current();qt.current?.querySelector(`table`)?.dispatchEvent(new CustomEvent(`selectionchange`,{bubbles:!0,detail:{selected:W,total:e,keys:t}}))},[W]);let[$t,en]=p({top:0,height:0}),[q,tn]=p(ne[E]??ne.comfortable);d(()=>{let e=K;if(!H||!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};en(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)}},[H,K]);let nn=f(null);Ce(()=>{if(!H){nn.current=null;return}let e=`${E}:${v?.length??0}`;if(nn.current===e)return;nn.current=e;let t=(qt.current?.querySelector(`:scope > table > tbody > tr:not(.wui-virtual-spacer, .wui-group-row)`))?.getBoundingClientRect().height;t!==void 0&&t>0&&Math.abs(t-q)>.5&&tn(t)});let J={start:0,end:G.length,before:0,after:0};if(H){J=ve({scrollTop:$t.top,viewport:$t.height||Number.parseFloat(String(ct))||0,rowHeight:q,count:G.length});let e=Xt.current;e!==null&&e>=0&&e<G.length&&(e<J.start&&J.start-e<=Me&&(J={...J,start:e,before:e*q}),e>=J.end&&e-J.end<Me&&(J={...J,end:e+1,after:(G.length-e-1)*q}))}let rn=f(null),an=f(null),Y=f(null),on=!M&&!x&&v?.length>0&&v.length<=re;Ce(()=>{let e=rn.current;if(!on||!e){an.current=null,Y.current=null;return}let t=v.map((e,t)=>F(e,t));me(Y.current,t)&&pe(e.rows,an.current),an.current=le(e.rows),Y.current=t});let X=typeof N==`function`||typeof P==`function`,sn=f(null),cn=f(null),ln=_[0]?.key;d(()=>{if(!X){cn.current=null;return}let e=/* @__PURE__ */ new Map;(v||[]).forEach((t,n)=>{let r=ln===void 0?void 0:g(t,ln),i=typeof r==`string`||typeof r==`number`?String(r):``;e.set(F(t,n),{...Le(t,N,P),label:i})});let t=he(ge(cn.current,e));cn.current=e,t&&sn.current&&(sn.current.textContent=t)},[v,N,P,F,X,ln]);let Z=Ke!==void 0&&(qe===void 0||qe>0)?Ke:Ge,un=({group:e,open:t},n)=>{let i=g(e.items[0]?.row,j??``),a=e.items.map(e=>e.row);return/* @__PURE__ */ m(`tr`,{className:`wui-group-row`,"data-group-key":e.key,"aria-rowindex":H?n+2:void 0,children:/* @__PURE__ */ m(`th`,{className:`wui-group-cell`,scope:`rowgroup`,colSpan:Mt,children:/* @__PURE__ */ h(`button`,{type:`button`,className:`wui-group-toggle`,"aria-expanded":t,onClick:()=>Kt(e.key),children:[/* @__PURE__ */ m(r,{name:`chevron-down`,size:16}),/* @__PURE__ */ m(`span`,{className:`wui-group-label`,children:_t?_t(i,a):ze(Ae(i,j??``))}),/* @__PURE__ */ m(`span`,{className:`wui-group-count`,"aria-hidden":`true`,children:se(e.items.length)}),/* @__PURE__ */ m(`span`,{className:`visually-hidden wui-group-rows`,children:`, ${c.rows(e.items.length)}`})]})})},`group:${e.key}`)},dn=({row:e,i:t},n)=>{let i=F(e,t),a=I&&Ct.has(i),o=mt!=null&&String(mt)===String(i),s=ht!=null&&String(ht)===String(i),ee=String(i).replace(/[^a-z0-9]/gi,`_`),te=B(0,`wui-expand-cell`),c=B(+!!I,`wui-select-cell`),l=X?Le(e,N,P):null,u=U(e,t);return/* @__PURE__ */ h(be,{children:[/* @__PURE__ */ h(`tr`,{className:[w&&u&&T?.has(i)?`is-selected`:``,L?`wui-row-link`:``,o?`wui-row-active`:``,s?Ee.hover:``].filter(Boolean).join(` `)||void 0,"aria-current":o?`true`:void 0,"aria-rowindex":H?n+2:void 0,"aria-busy":l?.state===`saving`?`true`:void 0,"data-wui-save-state":l?.state||void 0,"data-status":ft?.(e)||void 0,"data-href":k?.(e)||void 0,"data-row-key":D?String(i):void 0,tabIndex:L?0:void 0,onClick:L?t=>Ot(e,t):void 0,onAuxClick:L&&k?t=>t.button===1&&Ot(e,t):void 0,onKeyDown:L?t=>{t.key===`Enter`&&t.target===t.currentTarget&&Ot(e,t)}:void 0,children:[I&&/* @__PURE__ */ m(`td`,{className:te.className,style:te.style,children:/* @__PURE__ */ m(`button`,{type:`button`,className:`wui-expand-toggle${a?` is-open`:``}`,"aria-expanded":a,"aria-controls":a?`${ee}-expanded`:void 0,"aria-label":a?`Collapse row`:`Expand row`,onClick:()=>Tt(i),children:/* @__PURE__ */ m(r,{name:`chevron-down`,size:16})})}),w&&/* @__PURE__ */ m(`td`,{className:c.className,style:c.style,children:/* @__PURE__ */ m(`input`,{type:`checkbox`,className:`wui-check`,checked:u&&(T?.has(i)||!1),disabled:!u,onChange:e=>Ht(i,e.nativeEvent instanceof MouseEvent&&e.nativeEvent.shiftKey),onMouseDown:e=>{e.shiftKey&&e.preventDefault()},"aria-label":`Select row`})}),_.map((t,n)=>{let r=t.rowHeader?`th`:`td`;return/* @__PURE__ */ h(r,{scope:t.rowHeader?`row`:void 0,className:B(z+n,(n===0?`wui-name-cell `:``)+(t.rowHeader?`wui-row-header `:``)+(t.nowrap?`text-nowrap `:``)+b(t.align)+(t.cellClassName?` ${t.cellClassName}`:``)).className,style:V(z+n,t.cellStyle),"data-label":O&&typeof t.label==`string`?t.label:void 0,children:[t.render?t.render(e):ze(je(e,t.key)),n===0&&l?.state===`error`&&/* @__PURE__ */ m(`span`,{className:ie,children:l.message})]},t.key)}),S&&/* @__PURE__ */ m(`td`,{children:/* @__PURE__ */ m(`div`,{className:`u-row-actions`,children:S(e)})})]}),a&&/* @__PURE__ */ m(`tr`,{className:`wui-row-expanded`,children:/* @__PURE__ */ m(`td`,{id:`${ee}-expanded`,colSpan:Mt,children:nt?.(e)})})]},i)},fn=(e,t)=>`group`in e?un(e,t):dn(e,t),pn=(e,t)=>H?/* @__PURE__ */ m(`tr`,{className:`wui-virtual-spacer`,"aria-hidden":`true`,hidden:t===0,children:/* @__PURE__ */ m(`td`,{colSpan:Mt,style:{height:t}})},e):null,Q=B(0,`wui-expand-cell`),$=B(+!!I,`wui-select-cell`),mn=()=>Array.from({length:We},(e,t)=>`skeleton-${t}`).map(e=>/* @__PURE__ */ h(`tr`,{children:[I&&/* @__PURE__ */ m(`td`,{className:Q.className,style:Q.style}),w&&/* @__PURE__ */ m(`td`,{className:$.className,style:$.style}),_.map((e,t)=>/* @__PURE__ */ m(`td`,{className:B(z+t,(t===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+b(e.align)).className,style:V(z+t,void 0),"data-label":O&&typeof e.label==`string`?e.label:void 0,children:/* @__PURE__ */ m(i,{width:Re(e.align),height:12,radius:6})},e.key)),S&&/* @__PURE__ */ m(`td`,{children:/* @__PURE__ */ m(`div`,{className:`u-row-actions`,children:/* @__PURE__ */ m(i,{width:`32px`,height:12,radius:6})})})]},e));return/* @__PURE__ */ h(Te,{children:[/* @__PURE__ */ h(Pt?`wui-data-table`:`div`,{ref:Yt,...Pt?{class:kt,resizable:A?``:void 0,"view-key":gt||void 0,"data-wui-row-drag":D?``:void 0}:{className:kt,"data-wui-row-drag":D?``:void 0},style:jt,tabIndex:0,...ye,...bt,children:[/* @__PURE__ */ h(`table`,{className:St,"aria-label":Ye,"aria-rowcount":H?G.length+1:void 0,style:rt===`fixed`?{tableLayout:`fixed`}:void 0,children:[/* @__PURE__ */ m(`thead`,{children:/* @__PURE__ */ h(`tr`,{"aria-rowindex":H?1:void 0,children:[I&&/* @__PURE__ */ m(`th`,{className:Q.className,style:Q.style,children:/* @__PURE__ */ m(`span`,{className:`visually-hidden`,children:`Expand`})}),w&&/* @__PURE__ */ m(`th`,{className:$.className,style:$.style,children:/* @__PURE__ */ m(`input`,{ref:Bt,type:`checkbox`,className:`wui-check`,checked:Rt,disabled:x,onChange:e=>Ut(e.target.checked),"aria-label":`Select all rows`})}),_.map((e,t)=>{let n=e.sortable?Ue:void 0,i=n!==void 0,a=He&&He.key===e.key,o=e.align===`num`||e.align===`end`,s=i&&/* @__PURE__ */ m(`span`,{className:`sort-icon${o?` wui-sort-lead`:``}`,children:/* @__PURE__ */ m(r,{name:`chevrons-up-down`,size:14})}),l=A&&t!==It,u=e.width||e.minWidth?{width:e.width,minWidth:e.minWidth}:void 0;return/* @__PURE__ */ h(`th`,{className:B(z+t,(i?`sortable `:``)+(t===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+(e.grow?`wui-col-grow `:``)+(l?`wui-col-resizable `:``)+b(e.align)).className,style:V(z+t,u),"data-key":Pt?e.key:void 0,"aria-label":l&&typeof e.label==`string`?e.label:void 0,"data-pin":e.pin===`start`||e.pin===`end`?e.pin:void 0,tabIndex:i?0:void 0,"aria-sort":a?He?.dir===`asc`?`ascending`:`descending`:i?`none`:void 0,onClick:n?()=>{x||n(e.key)}:void 0,onKeyDown:n?t=>{t.target===t.currentTarget&&(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),x||n(e.key))}:void 0,children:[o&&s,e.label,!o&&s,l&&/* @__PURE__ */ m(`span`,{className:`wui-col-resize`,role:`separator`,"aria-orientation":`vertical`,"aria-valuemin":te,"aria-valuemax":ee,tabIndex:0,"aria-label":c.resize(typeof e.label==`string`?e.label:e.key)})]},e.key)}),S&&(Je?/* @__PURE__ */ m(`th`,{className:`wui-cell-end`,children:Je}):/* @__PURE__ */ m(`th`,{className:`wui-cell-end`,children:/* @__PURE__ */ m(`span`,{className:`visually-hidden`,children:`Actions`})}))]})}),/* @__PURE__ */ m(`tbody`,{ref:rn,children:x?mn():v?.length?/* @__PURE__ */ h(Te,{children:[pn(`before`,J.before),G.slice(J.start,J.end).map((e,t)=>fn(e,J.start+t)),pn(`after`,J.after)]}):null}),Et&&!x&&v?.length>0&&/* @__PURE__ */ m(`tfoot`,{children:/* @__PURE__ */ h(`tr`,{children:[I&&/* @__PURE__ */ m(`td`,{className:Q.className,style:Q.style}),w&&/* @__PURE__ */ m(`td`,{className:$.className,style:$.style}),_.map((e,t)=>/* @__PURE__ */ m(`td`,{className:B(z+t,(t===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+b(e.align)).className,style:V(z+t,void 0),children:e.footer?e.footer(v):null},e.key)),S&&/* @__PURE__ */ m(`td`,{})]})})]}),!x&&!v?.length&&/* @__PURE__ */ m(`div`,{className:`tbl-empty-block`,children:typeof Z==`string`?/* @__PURE__ */ m(`div`,{className:`tbl-empty-plain`,children:Z}):Z})]}),Be(C)&&/* @__PURE__ */ m(a,{page:C.page,totalPages:C.totalPages,total:C.total,pageSize:C.pageSize,onPageChange:x?Pe:C.setPage,onPageSizeChange:x?Pe:C.setPageSize,pageSizes:C.pageSizes,mode:C.mode,summary:C.summary}),X&&/* @__PURE__ */ m(`div`,{ref:sn,className:`visually-hidden`,role:`status`,"aria-live":`polite`,"data-wui-table-status":``})]})}export{Ve as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/useElementEntry.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppIcon.js";import i from"./AppSkeleton.js";import a from"./AppTablePagination.js";import o from"./assertValidValue.js";import s from"./warnUnknownProps.js";import{COLUMN_MAX_WIDTH as c,COLUMN_MIN_WIDTH as ee,DATA_TABLE_TEXT as l,PIN_AT_VAR as u,PIN_SIDES as d,ROW_HEIGHTS as te,ROW_MOVE_LIMIT as ne,ROW_SAVE_ERROR_CLASS as re,attachRowDrag as ie,attachScrollEdges as ae,groupCount as oe,groupItems as se,isImeSafeEnter as ce,measureRows as le,pinAtValue as ue,pinClasses as de,planPins as fe,playRowMoves as pe,rowOrderChanged as me,saveOutcomeText as he,settledRows as ge,syncTargets as _e,virtualRange as ve}from"@webority/ui-elements/helpers";import{Children as ye,Fragment as be,isValidElement as xe,useCallback as Se,useEffect as f,useLayoutEffect as Ce,useMemo as we,useRef as p,useState as m}from"react";import{Fragment as Te,jsx as h,jsxs as g}from"react/jsx-runtime";import{FORCED_STATE_CLASSES as Ee}from"@webority/theme/runtime";var De=()=>import(`@webority/ui-elements/elements/data-table`),Oe=[`comfortable`,`cozy`,`compact`],ke=[`auto`,`fixed`];function _(e,t){return typeof e==`object`&&e?Reflect.get(e,t):void 0}function Ae(e,t){if(e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`||xe(e)||Array.isArray(e))return e;throw Error(`AppDataTable: the value under "${t}" is not renderable; give that column a render function.`)}function je(e,t){return Ae(_(e,t),t)}var v=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}},y=/* @__PURE__ */ new Set;function b(t,n){!y.has(t)&&v()&&(y.add(t),e(`[@webority/ui-react] <AppDataTable> ${n}`))}var Me=100,Ne=e=>{let t=typeof e==`object`&&e&&`id`in e?e.id:void 0;return typeof t==`string`||typeof t==`number`?t:void 0},Pe=()=>{},Fe=()=>({total:0,keys:[]}),Ie=[],Le=(e,t,n)=>{let r=!!t?.(e),i=r?``:n?.(e)||``;return{state:r?`saving`:i?`error`:null,message:i}};function x(e){return e===`end`?`wui-cell-end`:e===`num`?`num`:e===`center`?`text-center`:``}function Re(e){return e===`center`?`44%`:e===`end`||e===`num`?`56%`:`60%`}function ze(e){return e==null||e===``?`-`:Array.isArray(e)?ye.toArray(e):typeof e==`boolean`?String(e):e}function Be(e){if(!e||!(e.total>0))return!1;let t=e.pageSizes?.length?e.pageSizes:[e.pageSize];return e.total>Math.min(...t)}function Ve(e){t(`wui-data-table`,De);let{marker:ye,props:xe}=n(`AppDataTable`,e),{columns:v,rows:y=Ie,rowKey:Ve=Ne,sort:He,onSort:Ue,loading:S=!1,skeletonRows:We=5,empty:Ge=`No records found.`,emptyFiltered:Ke,sourceCount:qe,rowActions:C,rowActionsLabel:Je,pagination:w,ariaLabel:Ye,className:Xe=``,wrapperClassName:Ze=``,selectable:T=!1,selectedIds:E,isRowSelectable:Qe,onToggleRow:$e,onToggleAll:et,onSelectRange:tt,renderExpanded:nt,density:D=`comfortable`,tableLayout:rt=`auto`,striped:it=!1,flush:at=!1,pad:ot,headerTone:st,rowDrag:O=!1,maxHeight:ct,stickyFirstColumn:lt=!1,stickyActions:ut=!1,stackOnMobile:k=!1,hiddenColumns:dt,rowStatus:ft,rowHref:A,onRowClick:pt,activeRowKey:mt,hoverRowKey:ht,resizableColumns:j=!1,viewKey:gt,groupBy:M,groupLabel:_t,virtual:N=!1,rowSaving:P,rowSaveError:F,...vt}=xe;s(`AppDataTable`,vt);let{style:yt,...bt}=vt,I=Se((e,t)=>{let n=Ve(e,t);if(n==null)throw Error(`AppDataTable: a row has no key. Pass rowKey, or give every row an id.`);return n},[Ve]),xt=dt?.length?new Set(dt):null;v=xt?v.filter(e=>!(e.hideable&&xt.has(e.key))):v,o(`AppDataTable`,`density`,D,Oe),o(`AppDataTable`,`tableLayout`,rt,ke);for(let e of v)o(`AppDataTable`,`column.pin`,e.pin,d);let St=[`table table-ledger`,D===`cozy`||D===`compact`?`wui-table-${D}`:``,it?`wui-table-striped`:``,lt?`wui-table-sticky-first`:``,ut?`wui-table-sticky-actions`:``,k?`wui-table-stack`:``,Xe].filter(Boolean).join(` `),L=typeof nt==`function`,[Ct,wt]=m(()=>/* @__PURE__ */ new Set),Tt=e=>wt(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),Et=v.some(e=>typeof e.footer==`function`),R=typeof A==`function`||typeof pt==`function`,Dt=e=>!!(e.target instanceof Element&&e.target.closest(`a, button, input, select, textarea, label, [role='menu'], [role='menuitem'], .dropdown`)),Ot=(e,t)=>{if(Dt(t)||(pt&&pt(e),!A))return;let n=A(e);n&&(t.ctrlKey||t.metaKey||t.button===1?window.open(n,`_blank`,`noopener`):window.location.assign(n))},z=ct!==void 0,kt=[`table-wrap`,z?`wui-table-scroll`:``,at?`wui-table-flush`:``,Ze].filter(Boolean).join(` `),At={maxHeight:z?ct:void 0,"--wui-table-pad":ot!=null&&!at?`${ot}px`:void 0,"--wui-table-header-bg":st??void 0},jt=Object.values(At).some(e=>e!==void 0)||yt!==void 0?{...At,...yt}:void 0,Mt=Math.max(1,v.length+ +!!C+ +!!T+ +!!L),Nt=v.some(e=>e.pin===`start`||e.pin===`end`),Pt=Nt||j||!!M||N,B=+!!L+ +!!T,Ft=Nt?fe([...L?[`lead`]:[],...T?[`lead`]:[],...v.map(e=>e.pin===`start`||e.pin===`end`?e.pin:null),...C?[null]:[]]):[],V=(e,t=``)=>{let n=Ft[e];return n?{className:`${t.trim()} ${de(n)}`.trim(),style:{[u]:ue(n.side,n.ordinal)}}:{className:t,style:void 0}},H=(e,t)=>Ft[e]?{...t,...V(e).style}:t,It=v.length-1+ +!!C;gt&&!j&&b(`view-key`,"`viewKey` remembers resized widths: add `resizableColumns`."),N&&!z&&b(`virtual-height`,"`virtual` needs `maxHeight`: without a scroll box every row renders."),N&&(L||k)&&b(`virtual-shape`,"`virtual` takes rows of one height, so it is off with `renderExpanded` or `stackOnMobile`."),!N&&y?.length>500&&b(`rows-without-virtual`,`renders more than 500 rows without virtual: add virtual with maxHeight, or page the data.`);let U=N&&z&&!L&&!k&&!S&&y?.length>0,W=(e,t)=>!Qe||!!Qe(e,t),Lt=T&&y?y.reduce((e,t,n)=>e+ +!!W(t,n),0):0,G=T&&y?y.reduce((e,t,n)=>e+(W(t,n)&&E?.has(I(t,n))?1:0),0):0,Rt=Lt>0&&G===Lt,zt=G>0&&!Rt,Bt=e=>{e&&(e.indeterminate=zt)},Vt=p(null),Ht=(e,t)=>{let n=Vt.current;Vt.current=e;let r=t&&n!==null?y.findIndex((e,t)=>I(e,t)===n):-1,i=y.findIndex((t,n)=>I(t,n)===e);if(r<0||i<0||r===i){$e?.(e);return}let a=!E?.has(e),o=Math.min(r,i),s=y.slice(o,Math.max(r,i)+1).map((e,t)=>[e,o+t]).filter(([e,t])=>W(e,t)).map(([e,t])=>I(e,t)).filter(e=>(E?.has(e)||!1)!==a);if(tt)tt(s,a);else for(let e of s)$e?.(e)},Ut=e=>{Qe?(y||[]).forEach((t,n)=>{let r=I(t,n);W(t,n)&&(E?.has(r)||!1)!==e&&$e?.(r)}):et?.(e)},[Wt,Gt]=m(()=>/* @__PURE__ */ new Set),Kt=e=>Gt(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),K=we(()=>{let e=(y||[]).map((e,t)=>({row:e,i:t}));return M?se(e,({row:e})=>String(_(e,M)??``)).flatMap(e=>[{group:e,open:!Wt.has(e.key)},...Wt.has(e.key)?[]:e.items]):e},[y,M,Wt]),qt=p(null),[q,Jt]=m(null),Yt=Se(e=>{qt.current=e,Jt(e)},[]),Xt=p(null);f(()=>{let e=q;if(!e)return;let t=e=>{let t=e.target instanceof Element?e.target.closest(`.u-name`):null;t&&!t.title&&(t.scrollWidth>t.clientWidth||t.scrollHeight>t.clientHeight)&&(t.title=(t.textContent??``).trim())},n=e=>{let t=e.target instanceof Element?e.target.closest(`tbody > tr[aria-rowindex]`)?.getAttribute(`aria-rowindex`):null;Xt.current=t?Number(t)-2:null},r=t=>{t.relatedTarget instanceof Node&&e.contains(t.relatedTarget)||(Xt.current=null)};e.addEventListener(`mouseover`,t),e.addEventListener(`focusin`,t),e.addEventListener(`focusin`,n),e.addEventListener(`focusout`,r);let i=ae(e);return()=>{e.removeEventListener(`mouseover`,t),e.removeEventListener(`focusin`,t),e.removeEventListener(`focusin`,n),e.removeEventListener(`focusout`,r),i()}},[q]),f(()=>{if(!O||!q)return;let e=ie(q);return _e(document),e},[O,q]);let Zt=p(Fe);Ce(()=>{Zt.current=()=>({total:y?.length??0,keys:y?y.flatMap((e,t)=>{let n=I(e,t);return W(e,t)&&E?.has(n)?[String(n)]:[]}):[]})});let Qt=p(!1);f(()=>{if(!Qt.current&&(Qt.current=!0,G===0))return;let{total:e,keys:t}=Zt.current();qt.current?.querySelector(`table`)?.dispatchEvent(new CustomEvent(`selectionchange`,{bubbles:!0,detail:{selected:G,total:e,keys:t}}))},[G]);let[$t,en]=m({top:0,height:0}),[J,tn]=m(te[D]??te.comfortable);f(()=>{let e=q;if(!U||!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};en(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)}},[U,q]);let nn=p(null);Ce(()=>{if(!U){nn.current=null;return}let e=`${D}:${y?.length??0}`;if(nn.current===e)return;nn.current=e;let t=(qt.current?.querySelector(`:scope > table > tbody > tr:not(.wui-virtual-spacer, .wui-group-row)`))?.getBoundingClientRect().height;t!==void 0&&t>0&&Math.abs(t-J)>.5&&tn(t)});let Y={start:0,end:K.length,before:0,after:0};if(U){Y=ve({scrollTop:$t.top,viewport:$t.height||Number.parseFloat(String(ct))||0,rowHeight:J,count:K.length});let e=Xt.current;e!==null&&e>=0&&e<K.length&&(e<Y.start&&Y.start-e<=Me&&(Y={...Y,start:e,before:e*J}),e>=Y.end&&e-Y.end<Me&&(Y={...Y,end:e+1,after:(K.length-e-1)*J}))}let rn=p(null),an=p(null),on=p(null),sn=!N&&!S&&y?.length>0&&y.length<=ne;Ce(()=>{let e=rn.current;if(!sn||!e){an.current=null,on.current=null;return}let t=y.map((e,t)=>I(e,t));me(on.current,t)&&pe(e.rows,an.current),an.current=le(e.rows),on.current=t});let X=typeof P==`function`||typeof F==`function`,cn=p(null),ln=p(null),un=v[0]?.key;f(()=>{if(!X){ln.current=null;return}let e=/* @__PURE__ */ new Map;(y||[]).forEach((t,n)=>{let r=un===void 0?void 0:_(t,un),i=typeof r==`string`||typeof r==`number`?String(r):``;e.set(I(t,n),{...Le(t,P,F),label:i})});let t=he(ge(ln.current,e));ln.current=e,t&&cn.current&&(cn.current.textContent=t)},[y,P,F,I,X,un]);let Z=Ke!==void 0&&(qe===void 0||qe>0)?Ke:Ge,dn=({group:e,open:t},n)=>{let i=_(e.items[0]?.row,M??``),a=e.items.map(e=>e.row);return/* @__PURE__ */ h(`tr`,{className:`wui-group-row`,"data-group-key":e.key,"aria-rowindex":U?n+2:void 0,children:/* @__PURE__ */ h(`th`,{className:`wui-group-cell`,scope:`rowgroup`,colSpan:Mt,children:/* @__PURE__ */ g(`button`,{type:`button`,className:`wui-group-toggle`,"aria-expanded":t,onClick:()=>Kt(e.key),children:[/* @__PURE__ */ h(r,{name:`chevron-down`,size:16}),/* @__PURE__ */ h(`span`,{className:`wui-group-label`,children:_t?_t(i,a):ze(Ae(i,M??``))}),/* @__PURE__ */ h(`span`,{className:`wui-group-count`,"aria-hidden":`true`,children:oe(e.items.length)}),/* @__PURE__ */ h(`span`,{className:`visually-hidden wui-group-rows`,children:`, ${l.rows(e.items.length)}`})]})})},`group:${e.key}`)},fn=({row:e,i:t},n)=>{let i=I(e,t),a=L&&Ct.has(i),o=mt!=null&&String(mt)===String(i),s=ht!=null&&String(ht)===String(i),c=String(i).replace(/[^a-z0-9]/gi,`_`),ee=V(0,`wui-expand-cell`),l=V(+!!L,`wui-select-cell`),u=X?Le(e,P,F):null,d=W(e,t);return/* @__PURE__ */ g(be,{children:[/* @__PURE__ */ g(`tr`,{className:[T&&d&&E?.has(i)?`is-selected`:``,R?`wui-row-link`:``,o?`wui-row-active`:``,s?Ee.hover:``].filter(Boolean).join(` `)||void 0,"aria-current":o?`true`:void 0,"aria-rowindex":U?n+2:void 0,"aria-busy":u?.state===`saving`?`true`:void 0,"data-wui-save-state":u?.state||void 0,"data-status":ft?.(e)||void 0,"data-href":A?.(e)||void 0,"data-row-key":O?String(i):void 0,tabIndex:R?0:void 0,onClick:R?t=>Ot(e,t):void 0,onAuxClick:R&&A?t=>t.button===1&&Ot(e,t):void 0,onKeyDown:R?t=>{ce(t.nativeEvent)&&t.target===t.currentTarget&&Ot(e,t)}:void 0,children:[L&&/* @__PURE__ */ h(`td`,{className:ee.className,style:ee.style,children:/* @__PURE__ */ h(`button`,{type:`button`,className:`wui-expand-toggle${a?` is-open`:``}`,"aria-expanded":a,"aria-controls":a?`${c}-expanded`:void 0,"aria-label":a?`Collapse row`:`Expand row`,onClick:()=>Tt(i),children:/* @__PURE__ */ h(r,{name:`chevron-down`,size:16})})}),T&&/* @__PURE__ */ h(`td`,{className:l.className,style:l.style,children:/* @__PURE__ */ h(`input`,{type:`checkbox`,className:`wui-check`,checked:d&&(E?.has(i)||!1),disabled:!d,onChange:e=>Ht(i,e.nativeEvent instanceof MouseEvent&&e.nativeEvent.shiftKey),onMouseDown:e=>{e.shiftKey&&e.preventDefault()},"aria-label":`Select row`})}),v.map((t,n)=>{let r=t.rowHeader?`th`:`td`;return/* @__PURE__ */ g(r,{scope:t.rowHeader?`row`:void 0,className:V(B+n,(n===0?`wui-name-cell `:``)+(t.rowHeader?`wui-row-header `:``)+(t.nowrap?`text-nowrap `:``)+x(t.align)+(t.cellClassName?` ${t.cellClassName}`:``)).className,style:H(B+n,t.cellStyle),"data-label":k&&typeof t.label==`string`?t.label:void 0,children:[t.render?t.render(e):ze(je(e,t.key)),n===0&&u?.state===`error`&&/* @__PURE__ */ h(`span`,{className:re,children:u.message})]},t.key)}),C&&/* @__PURE__ */ h(`td`,{children:/* @__PURE__ */ h(`div`,{className:`u-row-actions`,children:C(e)})})]}),a&&/* @__PURE__ */ h(`tr`,{className:`wui-row-expanded`,children:/* @__PURE__ */ h(`td`,{id:`${c}-expanded`,colSpan:Mt,children:nt?.(e)})})]},i)},pn=(e,t)=>`group`in e?dn(e,t):fn(e,t),mn=(e,t)=>U?/* @__PURE__ */ h(`tr`,{className:`wui-virtual-spacer`,"aria-hidden":`true`,hidden:t===0,children:/* @__PURE__ */ h(`td`,{colSpan:Mt,style:{height:t}})},e):null,Q=V(0,`wui-expand-cell`),$=V(+!!L,`wui-select-cell`),hn=()=>Array.from({length:We},(e,t)=>`skeleton-${t}`).map(e=>/* @__PURE__ */ g(`tr`,{children:[L&&/* @__PURE__ */ h(`td`,{className:Q.className,style:Q.style}),T&&/* @__PURE__ */ h(`td`,{className:$.className,style:$.style}),v.map((e,t)=>/* @__PURE__ */ h(`td`,{className:V(B+t,(t===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+x(e.align)).className,style:H(B+t,void 0),"data-label":k&&typeof e.label==`string`?e.label:void 0,children:/* @__PURE__ */ h(i,{width:Re(e.align),height:12,radius:6})},e.key)),C&&/* @__PURE__ */ h(`td`,{children:/* @__PURE__ */ h(`div`,{className:`u-row-actions`,children:/* @__PURE__ */ h(i,{width:`32px`,height:12,radius:6})})})]},e));return/* @__PURE__ */ g(Te,{children:[/* @__PURE__ */ g(Pt?`wui-data-table`:`div`,{ref:Yt,...Pt?{class:kt,resizable:j?``:void 0,"view-key":gt||void 0,"data-wui-row-drag":O?``:void 0}:{className:kt,"data-wui-row-drag":O?``:void 0},style:jt,tabIndex:0,...ye,...bt,children:[/* @__PURE__ */ g(`table`,{className:St,"aria-label":Ye,"aria-rowcount":U?K.length+1:void 0,style:rt===`fixed`?{tableLayout:`fixed`}:void 0,children:[/* @__PURE__ */ h(`thead`,{children:/* @__PURE__ */ g(`tr`,{"aria-rowindex":U?1:void 0,children:[L&&/* @__PURE__ */ h(`th`,{className:Q.className,style:Q.style,children:/* @__PURE__ */ h(`span`,{className:`visually-hidden`,children:`Expand`})}),T&&/* @__PURE__ */ h(`th`,{className:$.className,style:$.style,children:/* @__PURE__ */ h(`input`,{ref:Bt,type:`checkbox`,className:`wui-check`,checked:Rt,disabled:S,onChange:e=>Ut(e.target.checked),"aria-label":`Select all rows`})}),v.map((e,t)=>{let n=e.sortable?Ue:void 0,i=n!==void 0,a=He&&He.key===e.key,o=e.align===`num`||e.align===`end`,s=i&&/* @__PURE__ */ h(`span`,{className:`sort-icon${o?` wui-sort-lead`:``}`,children:/* @__PURE__ */ h(r,{name:`chevrons-up-down`,size:14})}),u=j&&t!==It,d=e.width||e.minWidth?{width:e.width,minWidth:e.minWidth}:void 0;return/* @__PURE__ */ g(`th`,{className:V(B+t,(i?`sortable `:``)+(t===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+(e.grow?`wui-col-grow `:``)+(u?`wui-col-resizable `:``)+x(e.align)).className,style:H(B+t,d),"data-key":Pt?e.key:void 0,"aria-label":u&&typeof e.label==`string`?e.label:void 0,"data-pin":e.pin===`start`||e.pin===`end`?e.pin:void 0,tabIndex:i?0:void 0,"aria-sort":a?He?.dir===`asc`?`ascending`:`descending`:i?`none`:void 0,onClick:n?()=>{S||n(e.key)}:void 0,onKeyDown:n?t=>{t.target===t.currentTarget&&(ce(t.nativeEvent)||t.key===` `)&&(t.preventDefault(),S||n(e.key))}:void 0,children:[o&&s,e.label,!o&&s,u&&/* @__PURE__ */ h(`span`,{className:`wui-col-resize`,role:`separator`,"aria-orientation":`vertical`,"aria-valuemin":ee,"aria-valuemax":c,tabIndex:0,"aria-label":l.resize(typeof e.label==`string`?e.label:e.key)})]},e.key)}),C&&(Je?/* @__PURE__ */ h(`th`,{className:`wui-cell-end`,children:Je}):/* @__PURE__ */ h(`th`,{className:`wui-cell-end`,children:/* @__PURE__ */ h(`span`,{className:`visually-hidden`,children:`Actions`})}))]})}),/* @__PURE__ */ h(`tbody`,{ref:rn,children:S?hn():y?.length?/* @__PURE__ */ g(Te,{children:[mn(`before`,Y.before),K.slice(Y.start,Y.end).map((e,t)=>pn(e,Y.start+t)),mn(`after`,Y.after)]}):null}),Et&&!S&&y?.length>0&&/* @__PURE__ */ h(`tfoot`,{children:/* @__PURE__ */ g(`tr`,{children:[L&&/* @__PURE__ */ h(`td`,{className:Q.className,style:Q.style}),T&&/* @__PURE__ */ h(`td`,{className:$.className,style:$.style}),v.map((e,t)=>/* @__PURE__ */ h(`td`,{className:V(B+t,(t===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+x(e.align)).className,style:H(B+t,void 0),children:e.footer?e.footer(y):null},e.key)),C&&/* @__PURE__ */ h(`td`,{})]})})]}),!S&&!y?.length&&/* @__PURE__ */ h(`div`,{className:`tbl-empty-block`,children:typeof Z==`string`?/* @__PURE__ */ h(`div`,{className:`tbl-empty-plain`,children:Z}):Z})]}),Be(w)&&/* @__PURE__ */ h(a,{page:w.page,totalPages:w.totalPages,total:w.total,pageSize:w.pageSize,onPageChange:S?Pe:w.setPage,onPageSizeChange:S?Pe:w.setPageSize,pageSizes:w.pageSizes,mode:w.mode,summary:w.summary}),X&&/* @__PURE__ */ h(`div`,{ref:cn,className:`visually-hidden`,role:`status`,"aria-live":`polite`,"data-wui-table-status":``})]})}export{Ve as default};
@@ -1 +1 @@
1
- import{emptyFacetValue as e,isFacetActive as t}from"../web-core/dist/query/listQuery.js";import{devWarn as n}from"../lib/devWarn.js";import r from"../lib/fillLabel.js";import i from"../lib/useElementEntry.js";import{splitMarkerProps as a}from"../lib/wuiMarker.js";import o from"./AppButton.js";import ee from"./AppChip.js";import s from"./AppDateRangePicker.js";import te from"./AppIcon.js";import c from"./AppSearch.js";import l from"./AppSegmented.js";import u from"./AppSelect.js";import ne from"./AppSwitch.js";import d from"./assertValidValue.js";import re from"./warnUnknownProps.js";import{Fragment as ie,useEffect as f,useId as ae,useRef as p,useState as oe,useSyncExternalStore as se}from"react";import{Fragment as ce,jsx as m,jsxs as h}from"react/jsx-runtime";var g=`(max-width: 575.98px)`,le=3,_=2,ue=e=>{let t=window.matchMedia?.(g);return t?.addEventListener(`change`,e),()=>t?.removeEventListener(`change`,e)},de=()=>window.matchMedia?.(g).matches??!1,fe=[`enum`,`multiEnum`,`dateRange`,`text`],pe=[`sm`,`md`],me=()=>import(`@webority/ui-elements/elements/filter-popover`),v=4,he=e=>(e.type===`enum`||e.type===`multiEnum`)&&!e.options?.length,y=(e,t)=>e.options?.find(e=>e.value===t)?.label??t,ge=(e,t)=>JSON.stringify(e)===JSON.stringify(t),b=(e,t,n)=>/* @__PURE__ */ RangeError(`[@webority/ui-react] <AppFilterBar> facet "${e.key}" needs ${t}, received ${JSON.stringify(n)}.`),x=(e,t)=>{if(t==null)return``;if(typeof t==`string`)return t;throw b(e,`a string value`,t)},S=(e,t)=>{if(t==null)return[];if(Array.isArray(t)&&t.every(e=>typeof e==`string`))return t;throw b(e,`an array of strings`,t)},C=(e,t)=>{if(t==null)return{from:``,to:``};if(typeof t==`object`&&!Array.isArray(t)&&!(t instanceof Date)){let{from:e,to:n}=t;if((e===void 0||typeof e==`string`)&&(n===void 0||typeof n==`string`))return{from:e,to:n}}throw b(e,`a { from, to } date range`,t)};function _e(n,i,a){if(n.required||!t(n,i))return[];if(n.type===`enum`)return[{id:n.key,text:y(n,x(n,i)),clear:()=>e(n)}];if(n.type===`multiEnum`){let e=S(n,i);return e.map(t=>({id:`${n.key}:${t}`,text:y(n,t),clear:()=>e.filter(e=>e!==t)}))}if(n.type===`dateRange`){let t=C(n,i),o=t.from&&t.to?r(a.range,{from:t.from,to:t.to}):t.from?r(a.from,{date:t.from}):r(a.until,{date:t.to});return[{id:n.key,text:o,clear:()=>e(n)}]}return[]}var w=/* @__PURE__ */ new Set;function ve(e){let t=!0;try{t=process.env.NODE_ENV!==`production`}catch{t=!0}t&&!w.has(e)&&(w.add(e),n(`[@webority/ui-react] <AppFilterBar> facet "${e}" sets allLabel, which only an enum facet uses.`))}var T=/* @__PURE__ */ new Set;function ye(e){let t=!0;try{t=process.env.NODE_ENV!==`production`}catch{t=!0}t&&!T.has(e)&&(T.add(e),n(`[@webority/ui-react] <AppFilterBar> facet "${e}" sets required, which only an enum facet uses.`))}var E=/* @__PURE__ */ new Set;function be(e){let t=!0;try{t=process.env.NODE_ENV!==`production`}catch{t=!0}t&&!E.has(e)&&(E.add(e),n(`[@webority/ui-react] <AppFilterBar> facet "${e}" sets allLabel and required; a required facet has no All segment.`))}var D=/* @__PURE__ */ new Set;function xe(e){let t=!0;try{t=process.env.NODE_ENV!==`production`}catch{t=!0}t&&!D.has(e)&&(D.add(e),n(`[@webority/ui-react] <AppFilterBar> facet "${e}" sets presets, which only a dateRange facet uses.`))}function O(n){i(`wui-filter-popover`,me);let{marker:s,props:c}=a(`AppFilterBar`,n),{facets:l,value:u,onChange:g,inline:v=le,floating:y=!1,apply:b=!1,size:x=`sm`,className:S=``,clearAllLabel:C=`Clear all`,filtersLabel:w=`Filters`,filtersActiveLabel:T=`Filters, {count} active`,keepOpenLabel:E=`Keep open`,appliesAtOnceText:D=`Changes apply at once.`,applyLabel:O=`Apply`,anyLabel:A=`Any`,removeChipLabel:Se=`Remove {facet} filter {value}`,dateFromText:Ce=`From {date}`,dateUntilText:we=`Until {date}`,dateRangeText:Te=`{from} to {to}`,...j}=c;re(`AppFilterBar`,j),d(`AppFilterBar`,`size`,x,pe);let M=x===`md`,Ee={range:Te,from:Ce,until:we},N=se(ue,de,()=>!1),P=p(null),F=p(null),De=e=>{let t=P.current,n=F.current;t&&n&&(e.preventDefault(),t.open=!t.open,n.classList.remove(`wui-filter-more-panel-end`),t.open&&n.getBoundingClientRect().right>window.innerWidth-8&&n.classList.add(`wui-filter-more-panel-end`))},I=ae(),[L,R]=oe({}),z=p(u);for(let e of l)d(`AppFilterBar`,`facets[].type`,e.type,fe);for(let e of l)e.allLabel!=null&&e.type!==`enum`&&ve(e.key),e.required&&e.type!==`enum`&&ye(e.key),e.required&&e.allLabel!=null&&be(e.key),e.presets!=null&&e.type!==`dateRange`&&xe(e.key);let B=l.filter(e=>!he(e)),V=B.flatMap(e=>_e(e,u[e.key],Ee).map(t=>({...t,facet:e}))),H=B.filter(e=>!e.required&&t(e,u[e.key])),U=y||N?0:Math.max(0,v),W=B.slice(U),Oe=W.filter(e=>H.includes(e)).length,G=!y&&W.length>0;f(()=>{if(!G)return;let e=e=>{let t=P.current;t?.open&&(e.type===`keydown`?e instanceof KeyboardEvent&&e.key===`Escape`:!e.composedPath().includes(t))&&(t.open=!1)};return document.addEventListener(`click`,e),document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`click`,e),document.removeEventListener(`keydown`,e)}},[G]),f(()=>{let e=z.current;z.current=u,R(t=>{let n=Object.entries(t).filter(([t])=>ge(e[t],u[t]));return n.length===Object.keys(t).length?t:Object.fromEntries(n)})},[u]);let K=e=>b&&!y&&(e.type===`text`||e.type===`dateRange`),q=e=>K(e)&&Object.hasOwn(L,e.key)?L[e.key]:u[e.key],J=e=>t=>K(e)?R(n=>({...n,[e.key]:t})):g(e.key,t),Y=()=>{for(let[e,t]of Object.entries(L))g(e,t);R({})},ke=e=>{e.key===`Enter`&&Y()},Ae=e=>{e.preventDefault(),Y()},X=(e,t)=>e.type===`text`&&K(e)?/* @__PURE__ */ m(`span`,{onKeyDownCapture:ke,children:t}):t,je=e=>/* @__PURE__ */ m(ie,{children:X(e,/* @__PURE__ */ m(k,{facet:e,value:q(e),onChange:J(e),medium:M,anyLabel:A}))},e.key),Z=e=>/* @__PURE__ */ h(`div`,{className:`wui-filter-popover-field`,children:[/* @__PURE__ */ m(`span`,{className:`label`,"aria-hidden":`true`,children:e.label}),X(e,/* @__PURE__ */ m(k,{facet:e,value:q(e),onChange:J(e),floating:!0,medium:M,anyLabel:A}))]},e.key),Q=(e,t)=>t>0&&/* @__PURE__ */ m(`span`,{className:e,children:` (${t})`}),Me=e=>/* @__PURE__ */ m(ee,{size:`sm`,label:`${e.facet.label}: ${e.text}`,removeLabel:r(Se,{facet:e.facet.label,value:e.text}),onRemove:()=>g(e.facet.key,e.clear()),className:!y&&B.indexOf(e.facet)<U?`wui-filter-chip-inline`:void 0},e.id),Ne=/* @__PURE__ */ m(o,{variant:`ghost`,size:M?void 0:`sm`,onClick:()=>{for(let t of H)g(t.key,e(t));R({})},children:C});if(y){let e=V.slice(_),t=H.length;return/* @__PURE__ */ h(`div`,{className:`wui-filter-bar d-flex flex-wrap align-items-center gap-2${S?` ${S}`:``}`,...s,...j,children:[/* @__PURE__ */ h(`wui-filter-popover`,{class:`wui-filter-popover`,children:[/* @__PURE__ */ h(o,{variant:t>0?`outline`:`ghost`,size:M?void 0:`sm`,leftIcon:`filter`,className:`wui-filter-popover-trigger`,"aria-expanded":`false`,"aria-controls":I,"aria-label":t>0?r(T,{count:t}):void 0,children:[w,t>0&&/* @__PURE__ */ m(`span`,{className:`badge rounded-pill text-bg-primary ms-1`,children:t})]}),/* @__PURE__ */ h(`div`,{id:I,className:`wui-filter-popover-panel`,role:`dialog`,"aria-label":w,hidden:!0,children:[/* @__PURE__ */ h(`div`,{className:`wui-filter-popover-head`,children:[/* @__PURE__ */ m(`span`,{className:`wui-filter-popover-title`,children:w}),/* @__PURE__ */ m(ne,{label:E,id:`${I}-pin`})]}),/* @__PURE__ */ m(`div`,{className:`wui-filter-popover-grid`,children:B.map(Z)}),/* @__PURE__ */ h(`div`,{className:`wui-filter-popover-foot`,children:[/* @__PURE__ */ m(`span`,{className:`wui-filter-popover-note`,children:D}),t>0&&Ne]})]})]}),V.slice(0,_).map(Me),e.length>0&&/* @__PURE__ */ h(`span`,{className:`chip chip-sm wui-filter-popover-more`,title:e.map(e=>`${e.facet.label}: ${e.text}`).join(`, `),children:[`+`,e.length]})]})}let Pe=`wui-filter-bar d-flex flex-wrap align-items-center gap-2${N&&G?` wui-filter-bar--folded`:``}`,Fe=e=>`${e}${S?` ${S}`:``}`,$=/* @__PURE__ */ h(ce,{children:[B.slice(0,U).map(je),G&&/* @__PURE__ */ h(`details`,{ref:P,className:`wui-filter-more`,children:[/* @__PURE__ */ h(`summary`,{className:`btn btn-outline-primary${M?``:` btn-sm`} wui-filter-more-trigger`,onClick:De,children:[/* @__PURE__ */ m(te,{name:`filter`,size:14,className:`me-2`}),w,Q(`wui-filter-count-desktop`,Oe),Q(`wui-filter-count-phone`,H.length)]}),/* @__PURE__ */ h(`div`,{ref:F,className:`wui-filter-more-panel`,children:[/* @__PURE__ */ m(`div`,{className:`wui-filter-more-head`,children:w}),W.map(Z)]})]}),V.map(Me),H.length>0&&Ne]});return!b||!B.some(e=>e.type===`text`||e.type===`dateRange`)?/* @__PURE__ */ m(`div`,{className:Fe(Pe),...s,...j,children:$}):/* @__PURE__ */ h(`div`,{className:Fe(`wui-filter-form d-flex flex-wrap align-items-center gap-2`),...s,...j,children:[/* @__PURE__ */ m(`div`,{className:Pe,children:$}),/* @__PURE__ */ m(o,{type:`submit`,size:M?void 0:`sm`,onClick:Ae,children:O})]})}function k({facet:e,value:t,onChange:n,floating:r=!1,medium:i=!1,anyLabel:a}){if(e.type===`enum`){let o=e.options??[];return(e.required?o.length<=v:o.length<v)?/* @__PURE__ */ m(l,{label:e.label,name:e.key,size:i?`md`:`sm`,value:x(e,t),onChange:n,options:e.required?o:[{value:``,label:e.allLabel||`All`},...o]}):/* @__PURE__ */ m(u,{"aria-label":e.label,name:e.key,placeholder:r?a:e.label,clearable:!e.required,size:i?void 0:`sm`,value:x(e,t),onChange:n,options:o})}return e.type===`multiEnum`?/* @__PURE__ */ m(u,{mode:`multiple`,"aria-label":e.label,name:e.key,placeholder:r?a:e.label,size:i?void 0:`sm`,collapseChips:!0,value:S(e,t),onChange:n,options:e.options??[]}):e.type===`dateRange`?/* @__PURE__ */ m(s,{ariaLabel:e.label,startName:`${e.key}From`,endName:`${e.key}To`,placeholder:r?a:e.label,size:i?void 0:`sm`,presets:e.presets,start:C(e,t).from,end:C(e,t).to,onChange:e=>n({from:e.start??``,to:e.end??``})}):/* @__PURE__ */ m(c,{ariaLabel:e.label,name:e.key,placeholder:e.label,size:i?void 0:`sm`,value:x(e,t),onChange:n})}export{O as default};
1
+ import{emptyFacetValue as e,isFacetActive as t}from"../web-core/dist/query/listQuery.js";import{devWarn as n}from"../lib/devWarn.js";import r from"../lib/fillLabel.js";import i from"../lib/useElementEntry.js";import{splitMarkerProps as a}from"../lib/wuiMarker.js";import o from"./AppButton.js";import ee from"./AppChip.js";import s from"./AppDateRangePicker.js";import te from"./AppIcon.js";import c from"./AppSearch.js";import l from"./AppSegmented.js";import u from"./AppSelect.js";import ne from"./AppSwitch.js";import d from"./assertValidValue.js";import re from"./warnUnknownProps.js";import{isImeSafeEnter as ie}from"@webority/ui-elements/helpers";import{Fragment as ae,useEffect as f,useId as oe,useRef as p,useState as se,useSyncExternalStore as ce}from"react";import{Fragment as le,jsx as m,jsxs as h}from"react/jsx-runtime";var g=`(max-width: 575.98px)`,ue=3,_=2,de=e=>{let t=window.matchMedia?.(g);return t?.addEventListener(`change`,e),()=>t?.removeEventListener(`change`,e)},fe=()=>window.matchMedia?.(g).matches??!1,pe=[`enum`,`multiEnum`,`dateRange`,`text`],me=[`sm`,`md`],he=()=>import(`@webority/ui-elements/elements/filter-popover`),v=4,ge=e=>(e.type===`enum`||e.type===`multiEnum`)&&!e.options?.length,y=(e,t)=>e.options?.find(e=>e.value===t)?.label??t,_e=(e,t)=>JSON.stringify(e)===JSON.stringify(t),b=(e,t,n)=>/* @__PURE__ */ RangeError(`[@webority/ui-react] <AppFilterBar> facet "${e.key}" needs ${t}, received ${JSON.stringify(n)}.`),x=(e,t)=>{if(t==null)return``;if(typeof t==`string`)return t;throw b(e,`a string value`,t)},S=(e,t)=>{if(t==null)return[];if(Array.isArray(t)&&t.every(e=>typeof e==`string`))return t;throw b(e,`an array of strings`,t)},C=(e,t)=>{if(t==null)return{from:``,to:``};if(typeof t==`object`&&!Array.isArray(t)&&!(t instanceof Date)){let{from:e,to:n}=t;if((e===void 0||typeof e==`string`)&&(n===void 0||typeof n==`string`))return{from:e,to:n}}throw b(e,`a { from, to } date range`,t)};function ve(n,i,a){if(n.required||!t(n,i))return[];if(n.type===`enum`)return[{id:n.key,text:y(n,x(n,i)),clear:()=>e(n)}];if(n.type===`multiEnum`){let e=S(n,i);return e.map(t=>({id:`${n.key}:${t}`,text:y(n,t),clear:()=>e.filter(e=>e!==t)}))}if(n.type===`dateRange`){let t=C(n,i),o=t.from&&t.to?r(a.range,{from:t.from,to:t.to}):t.from?r(a.from,{date:t.from}):r(a.until,{date:t.to});return[{id:n.key,text:o,clear:()=>e(n)}]}return[]}var w=/* @__PURE__ */ new Set;function ye(e){let t=!0;try{t=process.env.NODE_ENV!==`production`}catch{t=!0}t&&!w.has(e)&&(w.add(e),n(`[@webority/ui-react] <AppFilterBar> facet "${e}" sets allLabel, which only an enum facet uses.`))}var T=/* @__PURE__ */ new Set;function be(e){let t=!0;try{t=process.env.NODE_ENV!==`production`}catch{t=!0}t&&!T.has(e)&&(T.add(e),n(`[@webority/ui-react] <AppFilterBar> facet "${e}" sets required, which only an enum facet uses.`))}var E=/* @__PURE__ */ new Set;function xe(e){let t=!0;try{t=process.env.NODE_ENV!==`production`}catch{t=!0}t&&!E.has(e)&&(E.add(e),n(`[@webority/ui-react] <AppFilterBar> facet "${e}" sets allLabel and required; a required facet has no All segment.`))}var D=/* @__PURE__ */ new Set;function Se(e){let t=!0;try{t=process.env.NODE_ENV!==`production`}catch{t=!0}t&&!D.has(e)&&(D.add(e),n(`[@webority/ui-react] <AppFilterBar> facet "${e}" sets presets, which only a dateRange facet uses.`))}function O(n){i(`wui-filter-popover`,he);let{marker:s,props:c}=a(`AppFilterBar`,n),{facets:l,value:u,onChange:g,inline:v=ue,floating:y=!1,apply:b=!1,size:x=`sm`,className:S=``,clearAllLabel:C=`Clear all`,filtersLabel:w=`Filters`,filtersActiveLabel:T=`Filters, {count} active`,keepOpenLabel:E=`Keep open`,appliesAtOnceText:D=`Changes apply at once.`,applyLabel:O=`Apply`,anyLabel:A=`Any`,removeChipLabel:Ce=`Remove {facet} filter {value}`,dateFromText:we=`From {date}`,dateUntilText:Te=`Until {date}`,dateRangeText:Ee=`{from} to {to}`,...j}=c;re(`AppFilterBar`,j),d(`AppFilterBar`,`size`,x,me);let M=x===`md`,De={range:Ee,from:we,until:Te},N=ce(de,fe,()=>!1),P=p(null),F=p(null),Oe=e=>{let t=P.current,n=F.current;t&&n&&(e.preventDefault(),t.open=!t.open,n.classList.remove(`wui-filter-more-panel-end`),t.open&&n.getBoundingClientRect().right>window.innerWidth-8&&n.classList.add(`wui-filter-more-panel-end`))},I=oe(),[L,R]=se({}),z=p(u);for(let e of l)d(`AppFilterBar`,`facets[].type`,e.type,pe);for(let e of l)e.allLabel!=null&&e.type!==`enum`&&ye(e.key),e.required&&e.type!==`enum`&&be(e.key),e.required&&e.allLabel!=null&&xe(e.key),e.presets!=null&&e.type!==`dateRange`&&Se(e.key);let B=l.filter(e=>!ge(e)),V=B.flatMap(e=>ve(e,u[e.key],De).map(t=>({...t,facet:e}))),H=B.filter(e=>!e.required&&t(e,u[e.key])),U=y||N?0:Math.max(0,v),W=B.slice(U),ke=W.filter(e=>H.includes(e)).length,G=!y&&W.length>0;f(()=>{if(!G)return;let e=e=>{let t=P.current;t?.open&&(e.type===`keydown`?e instanceof KeyboardEvent&&e.key===`Escape`:!e.composedPath().includes(t))&&(t.open=!1)};return document.addEventListener(`click`,e),document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`click`,e),document.removeEventListener(`keydown`,e)}},[G]),f(()=>{let e=z.current;z.current=u,R(t=>{let n=Object.entries(t).filter(([t])=>_e(e[t],u[t]));return n.length===Object.keys(t).length?t:Object.fromEntries(n)})},[u]);let K=e=>b&&!y&&(e.type===`text`||e.type===`dateRange`),q=e=>K(e)&&Object.hasOwn(L,e.key)?L[e.key]:u[e.key],J=e=>t=>K(e)?R(n=>({...n,[e.key]:t})):g(e.key,t),Y=()=>{for(let[e,t]of Object.entries(L))g(e,t);R({})},Ae=e=>{ie(e.nativeEvent)&&Y()},je=e=>{e.preventDefault(),Y()},X=(e,t)=>e.type===`text`&&K(e)?/* @__PURE__ */ m(`span`,{onKeyDownCapture:Ae,children:t}):t,Me=e=>/* @__PURE__ */ m(ae,{children:X(e,/* @__PURE__ */ m(k,{facet:e,value:q(e),onChange:J(e),medium:M,anyLabel:A}))},e.key),Z=e=>/* @__PURE__ */ h(`div`,{className:`wui-filter-popover-field`,children:[/* @__PURE__ */ m(`span`,{className:`label`,"aria-hidden":`true`,children:e.label}),X(e,/* @__PURE__ */ m(k,{facet:e,value:q(e),onChange:J(e),floating:!0,medium:M,anyLabel:A}))]},e.key),Q=(e,t)=>t>0&&/* @__PURE__ */ m(`span`,{className:e,children:` (${t})`}),Ne=e=>/* @__PURE__ */ m(ee,{size:`sm`,label:`${e.facet.label}: ${e.text}`,removeLabel:r(Ce,{facet:e.facet.label,value:e.text}),onRemove:()=>g(e.facet.key,e.clear()),className:!y&&B.indexOf(e.facet)<U?`wui-filter-chip-inline`:void 0},e.id),Pe=/* @__PURE__ */ m(o,{variant:`ghost`,size:M?void 0:`sm`,onClick:()=>{for(let t of H)g(t.key,e(t));R({})},children:C});if(y){let e=V.slice(_),t=H.length;return/* @__PURE__ */ h(`div`,{className:`wui-filter-bar d-flex flex-wrap align-items-center gap-2${S?` ${S}`:``}`,...s,...j,children:[/* @__PURE__ */ h(`wui-filter-popover`,{class:`wui-filter-popover`,children:[/* @__PURE__ */ h(o,{variant:t>0?`outline`:`ghost`,size:M?void 0:`sm`,leftIcon:`filter`,className:`wui-filter-popover-trigger`,"aria-expanded":`false`,"aria-controls":I,"aria-label":t>0?r(T,{count:t}):void 0,children:[w,t>0&&/* @__PURE__ */ m(`span`,{className:`badge rounded-pill text-bg-primary ms-1`,children:t})]}),/* @__PURE__ */ h(`div`,{id:I,className:`wui-filter-popover-panel`,role:`dialog`,"aria-label":w,hidden:!0,children:[/* @__PURE__ */ h(`div`,{className:`wui-filter-popover-head`,children:[/* @__PURE__ */ m(`span`,{className:`wui-filter-popover-title`,children:w}),/* @__PURE__ */ m(ne,{label:E,id:`${I}-pin`})]}),/* @__PURE__ */ m(`div`,{className:`wui-filter-popover-grid`,children:B.map(Z)}),/* @__PURE__ */ h(`div`,{className:`wui-filter-popover-foot`,children:[/* @__PURE__ */ m(`span`,{className:`wui-filter-popover-note`,children:D}),t>0&&Pe]})]})]}),V.slice(0,_).map(Ne),e.length>0&&/* @__PURE__ */ h(`span`,{className:`chip chip-sm wui-filter-popover-more`,title:e.map(e=>`${e.facet.label}: ${e.text}`).join(`, `),children:[`+`,e.length]})]})}let Fe=`wui-filter-bar d-flex flex-wrap align-items-center gap-2${N&&G?` wui-filter-bar--folded`:``}`,Ie=e=>`${e}${S?` ${S}`:``}`,$=/* @__PURE__ */ h(le,{children:[B.slice(0,U).map(Me),G&&/* @__PURE__ */ h(`details`,{ref:P,className:`wui-filter-more`,children:[/* @__PURE__ */ h(`summary`,{className:`btn btn-outline-primary${M?``:` btn-sm`} wui-filter-more-trigger`,onClick:Oe,children:[/* @__PURE__ */ m(te,{name:`filter`,size:14,className:`me-2`}),w,Q(`wui-filter-count-desktop`,ke),Q(`wui-filter-count-phone`,H.length)]}),/* @__PURE__ */ h(`div`,{ref:F,className:`wui-filter-more-panel`,children:[/* @__PURE__ */ m(`div`,{className:`wui-filter-more-head`,children:w}),W.map(Z)]})]}),V.map(Ne),H.length>0&&Pe]});return!b||!B.some(e=>e.type===`text`||e.type===`dateRange`)?/* @__PURE__ */ m(`div`,{className:Ie(Fe),...s,...j,children:$}):/* @__PURE__ */ h(`div`,{className:Ie(`wui-filter-form d-flex flex-wrap align-items-center gap-2`),...s,...j,children:[/* @__PURE__ */ m(`div`,{className:Fe,children:$}),/* @__PURE__ */ m(o,{type:`submit`,size:M?void 0:`sm`,onClick:je,children:O})]})}function k({facet:e,value:t,onChange:n,floating:r=!1,medium:i=!1,anyLabel:a}){if(e.type===`enum`){let o=e.options??[];return(e.required?o.length<=v:o.length<v)?/* @__PURE__ */ m(l,{label:e.label,name:e.key,size:i?`md`:`sm`,value:x(e,t),onChange:n,options:e.required?o:[{value:``,label:e.allLabel||`All`},...o]}):/* @__PURE__ */ m(u,{"aria-label":e.label,name:e.key,placeholder:r?a:e.label,clearable:!e.required,size:i?void 0:`sm`,value:x(e,t),onChange:n,options:o})}return e.type===`multiEnum`?/* @__PURE__ */ m(u,{mode:`multiple`,"aria-label":e.label,name:e.key,placeholder:r?a:e.label,size:i?void 0:`sm`,collapseChips:!0,value:S(e,t),onChange:n,options:e.options??[]}):e.type===`dateRange`?/* @__PURE__ */ m(s,{ariaLabel:e.label,startName:`${e.key}From`,endName:`${e.key}To`,placeholder:r?a:e.label,size:i?void 0:`sm`,presets:e.presets,start:C(e,t).from,end:C(e,t).to,onChange:e=>n({from:e.start??``,to:e.end??``})}):/* @__PURE__ */ m(c,{ariaLabel:e.label,name:e.key,placeholder:e.label,size:i?void 0:`sm`,value:x(e,t),onChange:n})}export{O as default};
@@ -1 +1 @@
1
- import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/fillLabel.js";import{linkTarget as n}from"../lib/linkTarget.js";import{navMatchScore as r}from"../lib/navMatch.js";import{SHELL_FOLDED_COOKIE as i,readNavFolded as a,readShellCollapsed as o,writeNavFolded as s,writeShellCollapsed as c}from"../lib/shellCookie.js";import{TargetLink as l}from"../lib/TargetLink.js";import u from"../lib/useElementEntry.js";import{TONES as d}from"../lib/vocabulary.js";import{splitMarkerProps as f}from"../lib/wuiMarker.js";import p from"./AppAvatar.js";import m from"./AppButton.js";import h from"./AppIcon.js";import g from"./AppNavigationMenu.js";import _ from"./assertValidValue.js";import v from"./warnUnknownProps.js";import{initScrollEdges as y,revealActiveNavItem as b}from"@webority/ui-elements/helpers";import{useEffect as x,useId as S,useMemo as C,useRef as w,useState as T}from"react";import{Fragment as E,jsx as D,jsxs as O}from"react/jsx-runtime";var k=()=>import(`@webority/ui-elements/elements/overflow`),A=99,j=4,M=5,N=/^[a-z0-9-]+$/,P=`wui-sidebar-footer`,F=[],I=[`prefix`,`exact`],L=[`comfortable`,`compact`],R=[`neutral`,`primary`],z=[`side`,`top`],B=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],ee=/* @__PURE__ */ new Set([`key`,`label`,`icon`,`iconVariant`,`iconSize`,`href`,`badge`,`badgeTone`,`badgeTitle`,`newUntil`,`trailingIcon`,`active`,`match`,`matchAlso`,`tab`,`tabLabel`,`children`]),V=e=>e>A?`${A}+`:String(e),te=new Intl.DateTimeFormat(`en-CA`,{timeZone:`Asia/Kolkata`}),ne=e=>{if(typeof e!=`string`||!/^\d{4}-\d{2}-\d{2}$/.test(e))return!1;let t=/* @__PURE__ */ new Date(`${e}T00:00:00Z`);return Number.isNaN(t.getTime())||t.toISOString().slice(0,10)!==e?!1:te.format(/* @__PURE__ */ new Date)<=e},re=({logoLight:e,logoDark:t,markLight:n,markDark:r})=>{let i=!!(n||r);return[`app-sidebar-brand`,i&&`wui-brand-has-mark`,i&&!e&&!t&&`wui-brand-mark-only`,(t||r)&&`wui-brand-themed`].filter(Boolean).join(` `)},ie=({logoLight:e,logoDark:t,markLight:n,markDark:r,brandName:i})=>{let a=i??``,o=[e&&/* @__PURE__ */ D(`img`,{className:`wui-brand-logo wui-brand-light`,src:e,alt:a},`logo-light`),t&&/* @__PURE__ */ D(`img`,{className:`wui-brand-logo wui-brand-dark`,src:t,alt:``,"aria-hidden":`true`},`logo-dark`)],s=[n&&[`mark-light`,`wui-brand-mark wui-brand-light`,n],r&&[`mark-dark`,`wui-brand-mark wui-brand-dark`,r]].filter(e=>!!e).map(([t,n,r],i)=>i===0&&!e?/* @__PURE__ */ D(`img`,{className:n,src:r,alt:a},t):/* @__PURE__ */ D(`img`,{className:n,src:r,alt:``,"aria-hidden":`true`},t));return[...o,...s].filter(Boolean)};function H(e){let{marker:t,props:n}=f(`AppShell`,e),{groups:r=[],brand:l,logoLight:u,logoDark:d,markLight:p,markDark:m,brandName:S,brandHref:k,brandLabel:A,sidebarStart:j,sidebarStartCompact:M,sidebarFooter:N,sidebarFooterItems:P=F,topbarStart:I,topbarEnd:ee,footer:V,launcher:te,children:ne,collapsed:H,onCollapsedChange:oe,noSidebar:U=!1,nav:W=`side`,density:G=`comfortable`,itemHeight:se,iconVariant:K=`twotone`,topbarTone:ge=`neutral`,navLabel:ve=`Main navigation`,linkComponent:q,currentPath:ye,rememberCollapsed:be=!1,collapsedCookie:xe=`wui-shell-collapsed`,foldedCookie:Se=i,tabBarLabel:Ce=`Quick navigation`,moreLabel:we=`More`,skipLabel:Te=`Skip to content`,openNavLabel:Ee=`Open navigation`,closeNavLabel:De=`Close navigation`,expandNavLabel:Oe=`Expand navigation`,collapseNavLabel:ke=`Collapse navigation`,newLabel:Ae=`New`,togglePagesLabel:je=`Show or hide {name} pages`,accountMenuLabel:Me=`Account menu for {name}`,roleLabel:Ne=`Role:`,rolesLabel:Pe=`Roles:`,unreadLabel:Fe=`Unread`,markAllReadLabel:Ie=`Mark all read`,viewAllLabel:Le=`View all`,loadingNotificationsText:Re=`Loading…`,noUnreadText:ze=`No unread notifications`,unreadNotificationsText:Be=`{count} unread notifications`,unreadBellLabel:Ve=`{label}, {count} unread`,searchResultsLabel:He=`Search results`,noResultsText:Ue=`No results`,noResultsForText:We=`No results for “{value}”`,resultsCountText:Ge=`{count} results`,resultCountText:Ke=`{count} result`,userMenu:qe,notifications:Je,search:Ye,className:Xe=``,style:Ze,...Qe}=n;if(v(`AppShell`,Qe),_(`AppShell`,`density`,G,L),_(`AppShell`,`topbarTone`,ge,R),_(`AppShell`,`nav`,W,z),_(`AppShell`,`iconVariant`,K,B),A!==void 0&&!k)throw Error(`<AppShell> brandLabel names the brand link, so it needs brandHref.`);if(k){if(!A&&!S)throw Error(`<AppShell> brandHref needs brandLabel or brandName: the collapsed rail hides the logo, so the link would have no accessible name.`);if(!(l||u||d||p||m))throw Error(`<AppShell> brandHref has no brand, logo or mark to link.`)}let $e=(se??0)>0?{...Ze,"--wui-nav-item-height":`${se}px`}:Ze,[et,tt]=T(()=>be&&H===void 0&&typeof document<`u`?o(xe)??!1:!1),[J,Y]=T(!1),[nt,rt]=T(!1),[it,at]=T(!1),ot=w(null),X=H??et,st=e=>k?/* @__PURE__ */ D(ue,{href:k,label:A||S,linkComponent:q,onNavigate:()=>Y(!1),children:e}):e,ct=()=>{let e=!X;H===void 0&&tt(e),be&&c(e,xe),oe?.(e)},lt=r.some(e=>e.collapsible),[ut,dt]=T(()=>lt&&typeof document<`u`?a(Se):/* @__PURE__ */ new Set),ft=e=>{let t=new Set(ut);t.has(e)?t.delete(e):t.add(e),dt(t),s(t,Se)},pt=C(()=>ae(r,P,ye),[r,P,ye]),Z=pt.groups,Q=pt.footer,$=U?null:ce(Z,Q.some(e=>e.active));x(()=>{let e=()=>rt(window.scrollY>4);return e(),window.addEventListener(`scroll`,e,{passive:!0}),()=>window.removeEventListener(`scroll`,e)},[]),x(()=>{y()},[]),x(()=>{b(ot.current)},[]),x(()=>{let e=ot.current;if(!e)return;let t=()=>at(Z.length>0&&e.scrollHeight>e.clientHeight);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[Z]),x(()=>{if(!J)return;let e=e=>{e.key===`Escape`&&Y(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[J]);let mt=[`app-shell`,X?`collapsed`:``,U?`no-sidebar`:``,W===`top`?`wui-shell-top`:``,J?`mobile-open`:``,Xe].filter(Boolean).join(` `);return/* @__PURE__ */ O(`div`,{className:mt,"data-density":G===`compact`?`compact`:void 0,"data-wui-folded-cookie":lt?Se:void 0,style:$e,...t,...Qe,children:[/* @__PURE__ */ D(`a`,{className:`wui-skip-link`,href:`#main-content`,children:Te}),/* @__PURE__ */ O(`aside`,{className:`app-sidebar`,children:[(l||u||d||p||m)&&/* @__PURE__ */ D(`div`,{className:re({logoLight:u,logoDark:d,markLight:p,markDark:m}),children:st(/* @__PURE__ */ O(E,{children:[ie({logoLight:u,logoDark:d,markLight:p,markDark:m,brandName:S}),l]}))}),j&&/* @__PURE__ */ D(`div`,{className:`app-sidebar-start`,children:j}),M&&/* @__PURE__ */ D(`div`,{className:`app-sidebar-start-compact`,children:M}),/* @__PURE__ */ D(`nav`,{className:`app-sidebar-scroll`,"aria-label":ve,ref:ot,tabIndex:it?0:void 0,children:Z.map((e,t)=>{let n=e.items.map(e=>e.header==null?/* @__PURE__ */ D(pe,{item:e,linkComponent:q,onNavigate:()=>Y(!1),iconVariant:K,newLabel:Ae,togglePagesLabel:je},e.key??e.href??e.label):/* @__PURE__ */ D(`div`,{className:`wui-nav-header`,children:e.header},e.key??e.header));if(!e.collapsible)return/* @__PURE__ */ O(`div`,{className:`app-nav-group`,children:[e.label&&/* @__PURE__ */ D(`div`,{className:`app-nav-group-label`,children:e.label}),n,e.after&&/* @__PURE__ */ D(`div`,{className:`wui-nav-group-after`,children:e.after})]},e.key??e.label??`group-${t}`);let r=!ut.has(e.key??``)||!!fe(e.items),i=`wui-nav-group-${e.key}`;return/* @__PURE__ */ O(`div`,{className:`app-nav-group wui-nav-group-collapsible${r?``:` wui-nav-group-folded`}`,"data-wui-nav-group":e.key,children:[/* @__PURE__ */ O(`button`,{type:`button`,className:`app-nav-group-label wui-nav-group-toggle`,"aria-expanded":r,"aria-controls":i,onClick:()=>ft(e.key??``),children:[/* @__PURE__ */ D(`span`,{className:`wui-nav-group-text`,children:e.label}),/* @__PURE__ */ D(`span`,{className:`wui-nav-group-caret`,children:/* @__PURE__ */ D(h,{name:`chevron-down`,size:16})})]}),/* @__PURE__ */ O(`div`,{className:`wui-nav-group-body`,id:i,children:[n,e.after&&/* @__PURE__ */ D(`div`,{className:`wui-nav-group-after`,children:e.after})]})]},e.key??`group-${t}`)})}),(N||Q.length>0)&&/* @__PURE__ */ O(`div`,{className:`app-sidebar-foot`,children:[Q.length>0&&/* @__PURE__ */ D(`div`,{className:`wui-sidebar-foot-links`,children:Q.map(e=>/* @__PURE__ */ D(pe,{item:e,linkComponent:q,onNavigate:()=>Y(!1),iconVariant:K,newLabel:Ae,togglePagesLabel:je},e.key??e.href??e.label))}),N]}),!U&&/* @__PURE__ */ D(`button`,{type:`button`,className:`app-sidebar-toggle`,onClick:ct,"aria-label":X?Oe:ke,"aria-expanded":!X,children:/* @__PURE__ */ D(h,{name:`chevrons-left`,size:20})})]}),/* @__PURE__ */ O(`div`,{className:`app-main`,children:[/* @__PURE__ */ O(`header`,{className:`app-topbar${nt?` scrolled`:``}`,"data-tone":ge===`primary`?`primary`:void 0,children:[/* @__PURE__ */ O(`div`,{className:`app-topbar-start`,children:[/* @__PURE__ */ D(`button`,{type:`button`,className:`app-topbar-menu`,onClick:()=>Y(!0),"aria-label":Ee,"aria-expanded":J,children:/* @__PURE__ */ D(h,{name:`menu`,size:18})}),W===`top`&&l&&/* @__PURE__ */ D(`div`,{className:`wui-shell-top-brand`,children:st(l)}),W===`top`&&/* @__PURE__ */ D(`div`,{className:`wui-shell-top-nav`,children:/* @__PURE__ */ D(g,{items:le(Z),ariaLabel:ve,linkComponent:q})}),I,Ye&&/* @__PURE__ */ D(_e,{config:Ye,searchResultsLabel:He,noResultsText:Ue,noResultsForText:We,resultsCountText:Ge,resultCountText:Ke,moreLabel:we})]}),/* @__PURE__ */ O(`div`,{className:`app-topbar-end`,children:[ee,Je&&/* @__PURE__ */ D(he,{config:Je,unreadLabel:Fe,markAllReadLabel:Ie,viewAllLabel:Le,loadingNotificationsText:Re,noUnreadText:ze,unreadNotificationsText:Be,unreadBellLabel:Ve}),qe&&/* @__PURE__ */ D(me,{config:qe,linkComponent:q,accountMenuLabel:Me,roleLabel:Ne,rolesLabel:Pe})]})]}),/* @__PURE__ */ D(`main`,{className:`app-content`,id:`main-content`,children:ne}),V&&/* @__PURE__ */ D(`footer`,{className:`app-footer`,children:V})]}),te&&/* @__PURE__ */ D(`div`,{className:`wui-shell-launcher`,children:te}),$&&/* @__PURE__ */ O(`nav`,{className:`wui-tabbar`,"aria-label":Ce,children:[$.tabs.map(e=>/* @__PURE__ */ D(de,{tab:e,linkComponent:q,iconVariant:K},e.key??e.href)),$.hasMore&&/* @__PURE__ */ O(`button`,{type:`button`,className:`wui-tabbar-item${$.moreActive?` active`:``}`,onClick:()=>Y(!0),children:[/* @__PURE__ */ D(`span`,{className:`wui-tabbar-icon`,children:/* @__PURE__ */ D(h,{name:`more`,size:24})}),/* @__PURE__ */ D(`span`,{className:`wui-tabbar-label`,children:we})]})]}),/* @__PURE__ */ D(`button`,{type:`button`,className:`app-scrim`,onClick:()=>Y(!1),"aria-label":De,tabIndex:J?0:-1})]})}function ae(e,t,n){let i=t;for(let e of i){if(e.children?.length)throw Error(`<AppShell> sidebarFooterItems cannot hold children; keep footer links flat.`);if(e.tab)throw Error(`<AppShell> sidebarFooterItems cannot carry tab: true; the phone tab bar is built from groups.`);if(e.header!=null)throw Error(`<AppShell> sidebarFooterItems cannot hold a header row.`)}for(let t of e)t.collapsible&&se(t);let a=(e,t=!1)=>(e??[]).map(e=>Array.isArray(e.children)?{...e,children:a(e.children)}:{...e}).filter(e=>U(e)?t:(e.children?.length??0)>0||!!e.href),o=[...e,{key:P,items:t}].map(e=>({...e,items:W(a(e.items,!0))})).filter(e=>e.items.some(e=>!U(e))),s=[],c=e=>{for(let t of e)U(t)||(s.push(t),t.children&&c(t.children))};for(let e of o)c(e.items);for(let e of s)v(`AppShell items`,oe(e)),_(`AppShell`,`match`,e.match,I),_(`AppShell`,`iconVariant`,e.iconVariant,B),_(`AppShell`,`badgeTone`,e.badgeTone,d);let l=null;if(n!=null&&!s.some(e=>e.active===!0)){let e=-1;for(let t of s){if(t.active!=null||t.children?.length&&!t.href)continue;let i=r(n,t.href,{exact:t.match===`exact`,also:t.matchAlso});if(i<0)continue;let a=t.match===`exact`&&r(n,t.href,{exact:!0})>=0?1/0:i;a>e&&(e=a,l=t)}}for(let e of s)e.active=e.active??e===l;return{groups:o.filter(e=>e.key!==P),footer:o.find(e=>e.key===P)?.items??[]}}function oe(e){return Object.fromEntries(Object.entries(e).filter(([e])=>!ee.has(e)))}var U=e=>e.header!=null;function W(e){return e.filter((t,n)=>{if(!U(t))return!0;let r=e.findIndex((e,t)=>t>n&&U(e));return e.slice(n+1,r<0?void 0:r).length>0})}var G=/* @__PURE__ */ new Set;function se(t){if(t.key!=null&&N.test(t.key))return;let n=t.key==null?`<AppShell> a collapsible group needs a key so its folded state can be remembered.`:`<AppShell> collapsible group key "${t.key}" must use lower-case letters, digits and hyphens.`;typeof process<`u`&&process.env.NODE_ENV===`production`||G.has(n)||(G.add(n),e(n))}function ce(e,t){let n=[],r=e=>{for(let t of e)U(t)||(t.children?.length?r(t.children):n.push(t))};for(let t of e)r(t.items);let i=n.filter(e=>e.tab);if(i.length===0)return null;let a=i.length<n.length,o=a?j:M;if(i.length>o)throw Error(`<AppShell>: ${i.length} items carry tab: true, but the phone tab bar holds ${o} (${a?`4 plus More, because other items exist`:`5 when every item is a tab`}). Flag fewer items.`);return{tabs:i,hasMore:a,moreActive:t||n.some(e=>!e.tab&&e.active)}}function le(e){let t=e=>{if(e.label===void 0)throw Error(`<AppShell> a navigation row has no label; every row but a header needs one.`);return e.label},n=e=>e.key??e.href??t(e),r=(e,r)=>({key:n(e),label:t(e),to:r,current:!!e.active}),i=e=>e.flatMap(e=>U(e)?[]:[...e.href?[{...r(e,e.href),icon:e.icon}]:[],...i(e.children??[])]),a=[];for(let o of e.flatMap(e=>e.items)){if(U(o))continue;let e=i(o.children??[]);if(e.length>0){let i=o.href?[{...r(o,o.href),icon:o.icon}]:[];a.push({key:n(o),label:t(o),links:[...i,...e]})}else o.href&&a.push(r(o,o.href))}return a}function ue({href:e,label:t,linkComponent:r,onNavigate:i,children:a}){return/* @__PURE__ */ D(l,{link:n(r,{to:e}),className:`wui-brand-link`,"aria-label":t,onClick:i,children:a})}function de({tab:e,linkComponent:t,iconVariant:r}){let i=`wui-tabbar-item${e.active?` active`:``}`,a=/* @__PURE__ */ O(E,{children:[e.icon&&/* @__PURE__ */ D(`span`,{className:`wui-tabbar-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ D(h,{name:e.icon,size:24,variant:e.iconVariant??r}):e.icon}),/* @__PURE__ */ D(`span`,{className:`wui-tabbar-label`,children:e.tabLabel??e.label}),e.badge!=null&&/* @__PURE__ */ D(`span`,{className:`wui-tabbar-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:e.badge})]}),o=e.active?`page`:void 0;return/* @__PURE__ */ D(l,{link:n(t,{to:e.href}),className:i,"aria-current":o,children:a})}function fe(e){for(let t of e){if(t.active)return t;let e=t.children?.length?fe(t.children):void 0;if(e)return e}}function pe({item:e,linkComponent:r,onNavigate:i,depth:a=0,iconVariant:o,newLabel:s,togglePagesLabel:c}){let u=a>0,d=a>1?` wui-nav-depth-${Math.min(a,6)}`:``,f=Array.isArray(e.children)&&e.children.length>0,p=f?fe(e.children??[]):void 0,m=!!p,g=p?p.key??p.href??p.label:null,[_,v]=T(m);x(()=>{g!=null&&v(!0)},[g]);let y=typeof e.label==`string`?e.label:void 0,b=!u&&e.icon&&/* @__PURE__ */ D(`span`,{className:`app-nav-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ D(h,{name:e.icon,size:e.iconSize??22,variant:e.iconVariant??o}):e.icon}),S=e.badge!=null&&/* @__PURE__ */ D(`span`,{className:`app-nav-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:e.badge}),C=ne(e.newUntil)&&/* @__PURE__ */ D(`span`,{className:`wui-nav-new`,children:s}),w=/* @__PURE__ */ O(E,{children:[b,/* @__PURE__ */ D(`span`,{className:`app-nav-text`,children:e.label}),C,S,e.trailingIcon&&/* @__PURE__ */ D(`span`,{className:`app-nav-trailing`,children:typeof e.trailingIcon==`string`?/* @__PURE__ */ D(h,{name:e.trailingIcon,size:16}):e.trailingIcon})]}),k=e.active?`page`:void 0;if(f){let f=/* @__PURE__ */ D(`div`,{className:`app-nav-sub${_?` expanded`:``}`,inert:!_,"aria-hidden":!_||void 0,children:/* @__PURE__ */ D(`div`,{className:`app-nav-sub-inner`,children:(e.children??[]).map(e=>/* @__PURE__ */ D(pe,{item:e,linkComponent:r,onNavigate:i,depth:a+1,iconVariant:o,newLabel:s,togglePagesLabel:c},e.key??e.href))})});if(e.href){let a=/* @__PURE__ */ D(l,{link:n(r,{to:e.href}),className:`wui-nav-split-link`,"aria-current":k,onClick:i,children:w});return/* @__PURE__ */ O(E,{children:[/* @__PURE__ */ O(`div`,{className:`app-nav-item has-children wui-nav-split${u?` app-nav-subitem`:``}${m||e.active?` active`:``}${d}`,"data-label":y,children:[a,/* @__PURE__ */ D(`button`,{type:`button`,className:`app-nav-caret wui-nav-split-toggle`,"aria-expanded":_,"aria-label":t(c,{name:y??``}),onClick:()=>v(e=>!e),children:/* @__PURE__ */ D(h,{name:`chevron-right`,size:16})})]}),f]})}return/* @__PURE__ */ O(E,{children:[/* @__PURE__ */ O(`button`,{type:`button`,className:`app-nav-item${u?` app-nav-subitem`:``} has-children${m?` active`:``}${d}`,"aria-expanded":_,"data-label":y,onClick:()=>v(e=>!e),children:[b,/* @__PURE__ */ D(`span`,{className:`app-nav-text`,children:e.label}),C,S,/* @__PURE__ */ D(`span`,{className:`app-nav-caret`,children:/* @__PURE__ */ D(h,{name:`chevron-right`,size:16})})]}),f]})}let A=`app-nav-item${u?` app-nav-subitem`:``}${e.active?` active`:``}${d}`;return/* @__PURE__ */ D(l,{link:n(r,{to:e.href}),className:A,"aria-current":k,"data-label":y,onClick:i,children:w})}function K(){let[e,t]=T(!1),n=w(null);return x(()=>{if(!e)return;let r=e=>{n.current?.contains(e.target instanceof Node?e.target:null)||t(!1)},i=e=>{e.key===`Escape`&&(t(!1),n.current?.querySelector(`button`)?.focus())};return document.addEventListener(`mousedown`,r),document.addEventListener(`keydown`,i),()=>{document.removeEventListener(`mousedown`,r),document.removeEventListener(`keydown`,i)}},[e]),{open:e,setOpen:t,ref:n}}function me({config:e,linkComponent:r,accountMenuLabel:i,roleLabel:a,rolesLabel:o}){let s=S(),{open:c,setOpen:u,ref:d}=K(),{name:f,role:g,roles:v=[],noTriggerRole:y=!1,photo:b,profileHref:x,profileLabel:C=`My profile`,onLogout:w,logoutAction:T,logoutLabel:k=`Sign out`,head:A,section:j,logoutVariant:M=`item`,items:N=[]}=e;if(_(`AppShell`,`userMenu.logoutVariant`,M,[`item`,`button`]),!f)throw Error(`<AppShell> userMenu.name is required; the trigger and the avatar are named from it.`);let P=v.map(e=>(e??``).trim()).filter(Boolean),F=()=>u(!1),I=(e,t,i,a)=>/* @__PURE__ */ D(l,{link:n(r,{to:e}),className:`dropdown-item`,onClick:a,children:t},i),L=/* @__PURE__ */ D(h,{name:`log-out`,size:18}),R=/* @__PURE__ */ O(E,{children:[L,k]});return/* @__PURE__ */ O(`div`,{className:`dropdown wui-usermenu`,ref:d,children:[/* @__PURE__ */ O(`button`,{type:`button`,id:s,className:`wui-usermenu-trigger`,"aria-expanded":c,"aria-label":t(i,{name:f}),onClick:()=>u(e=>!e),children:[/* @__PURE__ */ D(p,{name:f,src:b,tone:`auto`}),/* @__PURE__ */ O(`span`,{className:`wui-usermenu-text`,children:[/* @__PURE__ */ D(`span`,{className:`wui-usermenu-name`,children:f}),g&&!y&&/* @__PURE__ */ D(`span`,{className:`wui-usermenu-role`,children:g})]}),/* @__PURE__ */ D(h,{name:`chevron-down`,size:14,className:`wui-usermenu-caret`})]}),/* @__PURE__ */ O(`div`,{className:`dropdown-menu dropdown-menu-end wui-usermenu-menu${c?` show`:``}`,"aria-labelledby":s,"data-bs-popper":c?`static`:void 0,children:[/* @__PURE__ */ O(`div`,{className:`wui-usermenu-head`,children:[/* @__PURE__ */ D(p,{name:f,src:b,size:`lg`,tone:`auto`}),/* @__PURE__ */ O(`div`,{className:`wui-usermenu-who`,children:[/* @__PURE__ */ D(`div`,{className:`wui-usermenu-name`,children:f}),g&&/* @__PURE__ */ D(`div`,{className:`wui-usermenu-role`,children:g}),P.length>0&&/* @__PURE__ */ O(`div`,{className:`wui-usermenu-roles`,children:[/* @__PURE__ */ D(`span`,{className:`wui-usermenu-roles-label`,children:P.length===1?a:o}),` ${P.join(`, `)}`]}),A?/* @__PURE__ */ D(`div`,{className:`wui-usermenu-extra`,children:A}):null]})]}),j?/* @__PURE__ */ D(`div`,{className:`wui-usermenu-section`,children:j}):null,x&&I(x,/* @__PURE__ */ O(E,{children:[/* @__PURE__ */ D(h,{name:`user`,size:18}),C]}),void 0,F),N.map(e=>{if(e.divider)return/* @__PURE__ */ D(`hr`,{className:`dropdown-divider`},e.key);let t=/* @__PURE__ */ O(E,{children:[e.icon&&/* @__PURE__ */ D(h,{name:e.icon,size:18}),e.label]}),n=()=>{e.onClick?.(),F()};return e.href?I(e.href,t,e.key,n):/* @__PURE__ */ D(`button`,{type:`button`,className:`dropdown-item`,onClick:n,children:t},e.key)}),M===`button`?(T||w)&&/* @__PURE__ */ D(`div`,{className:`wui-usermenu-foot`,children:T?/* @__PURE__ */ D(`form`,{method:`post`,action:T,className:`wui-usermenu-logout`,children:/* @__PURE__ */ D(m,{type:`submit`,tone:`danger`,variant:`soft`,block:!0,leftIcon:L,children:k})}):/* @__PURE__ */ D(m,{type:`button`,tone:`danger`,variant:`soft`,block:!0,leftIcon:L,onClick:()=>{F(),w?.()},children:k})}):T?/* @__PURE__ */ D(`form`,{method:`post`,action:T,className:`wui-usermenu-logout`,children:/* @__PURE__ */ D(`button`,{type:`submit`,className:`dropdown-item danger`,children:R})}):w&&/* @__PURE__ */ D(`button`,{type:`button`,className:`dropdown-item danger`,onClick:()=>{F(),w()},children:R})]})]})}function he({config:e,unreadLabel:n,markAllReadLabel:r,viewAllLabel:i,loadingNotificationsText:a,noUnreadText:o,unreadNotificationsText:s,unreadBellLabel:c}){let l=S(),{open:u,setOpen:d,ref:f}=K(),{unread:p=0,items:m,loading:g=!1,onOpen:_,onMarkAllRead:v,viewAllHref:y,label:b=`Notifications`,emptyText:C=`You are all caught up.`}=e,[k,A]=T(``),j=w(p);x(()=>{j.current!==p&&(j.current=p,A(p===0?o:t(s,{count:V(p)})))},[p,o,s]);let M=null;return m?.length?M=/* @__PURE__ */ D(`div`,{className:`wui-bell-items`,children:m.map((e,t)=>{let r=`wui-bell-item${e.read?` wui-bell-item-read`:``}`,i=/* @__PURE__ */ O(E,{children:[/* @__PURE__ */ D(`span`,{className:`wui-bell-dot`,"aria-hidden":`true`}),e.icon&&/* @__PURE__ */ D(`span`,{className:`wui-bell-icon`,children:/* @__PURE__ */ D(h,{name:e.icon,size:18})}),/* @__PURE__ */ O(`span`,{className:`wui-bell-body`,children:[!e.read&&/* @__PURE__ */ O(`span`,{className:`visually-hidden`,children:[n,`: `]}),/* @__PURE__ */ D(`span`,{className:`wui-bell-item-title`,children:e.title}),e.time&&/* @__PURE__ */ D(`span`,{className:`wui-bell-when`,children:e.time})]})]});return e.href?/* @__PURE__ */ D(`a`,{className:r,href:e.href,"data-id":e.id,children:i},e.id??t):/* @__PURE__ */ D(`div`,{className:r,"data-id":e.id,children:i},e.id??t)})}):g?M=/* @__PURE__ */ D(`div`,{className:`wui-bell-state`,children:a}):m&&(M=/* @__PURE__ */ D(`div`,{className:`wui-bell-state`,children:C})),/* @__PURE__ */ O(`div`,{className:`dropdown wui-bell`,ref:f,children:[/* @__PURE__ */ O(`button`,{type:`button`,id:l,className:`topbar-icon-btn wui-bell-trigger`,"aria-expanded":u,"aria-label":p===0?b:t(c,{label:b,count:V(p)}),onClick:()=>{let e=!u;d(e),e&&_?.()},children:[/* @__PURE__ */ D(h,{name:`notification`,size:20}),/* @__PURE__ */ D(`span`,{className:`wui-bell-count`,"aria-hidden":`true`,hidden:p===0,children:V(p)})]}),/* @__PURE__ */ D(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:k}),/* @__PURE__ */ O(`div`,{className:`dropdown-menu dropdown-menu-end wui-bell-menu${u?` show`:``}`,"aria-labelledby":l,"data-bs-popper":u?`static`:void 0,children:[/* @__PURE__ */ O(`div`,{className:`wui-bell-head`,children:[/* @__PURE__ */ D(`span`,{className:`wui-bell-title`,children:b}),v&&/* @__PURE__ */ D(`button`,{type:`button`,className:`wui-bell-markall`,onClick:v,children:r})]}),/* @__PURE__ */ D(`div`,{className:`wui-bell-list`,"aria-busy":g||void 0,children:M}),y&&/* @__PURE__ */ D(`a`,{className:`wui-bell-foot`,href:y,children:i})]})]})}var ge=e=>!!e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName));function _e({config:e,searchResultsLabel:n,noResultsText:r,noResultsForText:i,resultsCountText:a,resultCountText:o,moreLabel:s}){u(`wui-overflow`,k);let c=S(),{value:l=``,onChange:d,results:f=null,loading:p=!1,onSelect:m,onSubmit:g,onFocus:_,placeholder:v=`Search`}=e,[y,b]=T(!1),[E,A]=T(!1),[j,M]=T({results:null,index:-1}),N=j.results===f?j.index:-1,P=e=>M({results:f,index:e}),F=w(null),I=w(null),L=w([]),R=C(()=>(f??[]).flatMap(e=>e.hits??[]),[f]),z=f!=null&&!E,B=R.length;x(()=>{let e=e=>{e.key!==`/`||e.ctrlKey||e.metaKey||e.altKey||ge(e.target instanceof HTMLElement?e.target:null)||(e.preventDefault(),b(!0),I.current?.focus())},t=e=>{F.current?.contains(e.target instanceof Node?e.target:null)||(A(!0),b(!1))};return document.addEventListener(`keydown`,e),document.addEventListener(`pointerdown`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`pointerdown`,t)}},[]);let ee=e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(!z||B===0)return;e.preventDefault(),P((N+(e.key===`ArrowDown`?1:-1)+B)%B)}else e.key===`Enter`?z&&N>=0&&L.current[N]?(e.preventDefault(),L.current[N].click()):g&&l.trim()!==``&&(e.preventDefault(),g(l.trim())):e.key===`Escape`&&(z?(e.preventDefault(),A(!0)):y&&(e.preventDefault(),b(!1)))},V=-1;return L.current=[],/* @__PURE__ */ D(`wui-overflow`,{class:`wui-topsearch-host`,label:s,children:/* @__PURE__ */ D(`div`,{"data-wui-overflow-list":!0,className:`wui-topsearch-row`,children:/* @__PURE__ */ O(`div`,{className:`wui-topsearch${y?` is-open`:``}${p?` is-loading`:``}`,ref:F,"data-overflow-label":v,children:[/* @__PURE__ */ D(`button`,{type:`button`,className:`topbar-icon-btn wui-topsearch-open`,"aria-label":v,"aria-expanded":y,"aria-controls":`${c}-panel`,onClick:()=>{let e=!y;b(e),e&&I.current?.focus()},children:/* @__PURE__ */ D(h,{name:`search`,size:20})}),/* @__PURE__ */ O(`div`,{className:`wui-topsearch-panel`,id:`${c}-panel`,children:[/* @__PURE__ */ O(`div`,{className:`search-wrap`,children:[/* @__PURE__ */ D(h,{name:`search`,size:18,className:`search-icon`}),/* @__PURE__ */ D(`input`,{ref:I,type:`search`,className:`form-control input search-input`,id:`${c}-input`,placeholder:v,"aria-label":v,role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":z,"aria-controls":`${c}-list`,"aria-activedescendant":z&&N>=0?`${c}-opt-${N}`:void 0,autoComplete:`off`,value:l,onChange:e=>{A(!1),d?.(e.target.value)},onKeyDown:ee,onFocus:_})]}),/* @__PURE__ */ D(`div`,{className:`wui-topsearch-results`,id:`${c}-list`,role:`listbox`,"aria-label":n,hidden:!z,children:z&&/* @__PURE__ */ O(`div`,{className:`wui-topsearch-groups`,role:`presentation`,children:[B===0&&/* @__PURE__ */ D(`div`,{className:`wui-topsearch-empty`,role:`option`,"aria-disabled":`true`,"aria-selected":`false`,children:t(i,{value:l})}),f.filter(e=>e.hits?.length).map((e,t)=>/* @__PURE__ */ O(`div`,{className:`wui-topsearch-group`,role:`group`,"aria-label":e.label??``,children:[e.label&&/* @__PURE__ */ D(`div`,{className:`wui-topsearch-group-label`,role:`presentation`,children:e.label}),e.hits.map(e=>{V+=1;let t=V;return/* @__PURE__ */ O(`a`,{className:`wui-topsearch-hit${t===N?` is-active`:``}`,role:`option`,"aria-selected":t===N,id:`${c}-opt-${t}`,href:e.href,ref:e=>{L.current[t]=e},onClick:t=>m?.(e,t),children:[e.icon&&/* @__PURE__ */ D(`span`,{className:`wui-topsearch-hit-icon`,children:/* @__PURE__ */ D(h,{name:e.icon,size:18})}),/* @__PURE__ */ O(`span`,{className:`wui-topsearch-hit-text`,children:[/* @__PURE__ */ D(`span`,{className:`wui-topsearch-hit-title`,children:e.title}),e.subtitle&&/* @__PURE__ */ D(`span`,{className:`wui-topsearch-hit-sub`,children:e.subtitle})]})]},`${e.href}-${t}`)})]},e.label??t))]})})]}),/* @__PURE__ */ D(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:z?B===0?r:t(B===1?o:a,{count:B}):``})]})})})}export{H as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/fillLabel.js";import{linkTarget as n}from"../lib/linkTarget.js";import{navMatchScore as r}from"../lib/navMatch.js";import{SHELL_FOLDED_COOKIE as i,readNavFolded as a,readShellCollapsed as o,writeNavFolded as s,writeShellCollapsed as c}from"../lib/shellCookie.js";import{TargetLink as l}from"../lib/TargetLink.js";import u from"../lib/useElementEntry.js";import{TONES as d}from"../lib/vocabulary.js";import{splitMarkerProps as f}from"../lib/wuiMarker.js";import p from"./AppAvatar.js";import m from"./AppButton.js";import h from"./AppIcon.js";import g from"./AppNavigationMenu.js";import _ from"./assertValidValue.js";import v from"./warnUnknownProps.js";import{initScrollEdges as y,isImeSafeEnter as b,revealActiveNavItem as x}from"@webority/ui-elements/helpers";import{useEffect as S,useId as C,useMemo as w,useRef as T,useState as E}from"react";import{Fragment as D,jsx as O,jsxs as k}from"react/jsx-runtime";var A=()=>import(`@webority/ui-elements/elements/overflow`),j=99,M=4,N=5,P=/^[a-z0-9-]+$/,F=`wui-sidebar-footer`,I=[],L=[`prefix`,`exact`],R=[`comfortable`,`compact`],ee=[`neutral`,`primary`],z=[`side`,`top`],B=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],V=/* @__PURE__ */ new Set([`key`,`label`,`icon`,`iconVariant`,`iconSize`,`href`,`badge`,`badgeTone`,`badgeTitle`,`newUntil`,`trailingIcon`,`active`,`match`,`matchAlso`,`tab`,`tabLabel`,`children`]),H=e=>e>j?`${j}+`:String(e),te=new Intl.DateTimeFormat(`en-CA`,{timeZone:`Asia/Kolkata`}),U=e=>{if(typeof e!=`string`||!/^\d{4}-\d{2}-\d{2}$/.test(e))return!1;let t=/* @__PURE__ */ new Date(`${e}T00:00:00Z`);return Number.isNaN(t.getTime())||t.toISOString().slice(0,10)!==e?!1:te.format(/* @__PURE__ */ new Date)<=e},ne=({logoLight:e,logoDark:t,markLight:n,markDark:r})=>{let i=!!(n||r);return[`app-sidebar-brand`,i&&`wui-brand-has-mark`,i&&!e&&!t&&`wui-brand-mark-only`,(t||r)&&`wui-brand-themed`].filter(Boolean).join(` `)},re=({logoLight:e,logoDark:t,markLight:n,markDark:r,brandName:i})=>{let a=i??``,o=[e&&/* @__PURE__ */ O(`img`,{className:`wui-brand-logo wui-brand-light`,src:e,alt:a},`logo-light`),t&&/* @__PURE__ */ O(`img`,{className:`wui-brand-logo wui-brand-dark`,src:t,alt:``,"aria-hidden":`true`},`logo-dark`)],s=[n&&[`mark-light`,`wui-brand-mark wui-brand-light`,n],r&&[`mark-dark`,`wui-brand-mark wui-brand-dark`,r]].filter(e=>!!e).map(([t,n,r],i)=>i===0&&!e?/* @__PURE__ */ O(`img`,{className:n,src:r,alt:a},t):/* @__PURE__ */ O(`img`,{className:n,src:r,alt:``,"aria-hidden":`true`},t));return[...o,...s].filter(Boolean)};function ie(e){let{marker:t,props:n}=f(`AppShell`,e),{groups:r=[],brand:l,logoLight:u,logoDark:d,markLight:p,markDark:m,brandName:b,brandHref:C,brandLabel:A,sidebarStart:j,sidebarStartCompact:M,sidebarFooter:N,sidebarFooterItems:P=I,topbarStart:F,topbarEnd:L,footer:V,launcher:H,children:te,collapsed:U,onCollapsedChange:ie,noSidebar:W=!1,nav:G=`side`,density:oe=`comfortable`,itemHeight:K,iconVariant:q=`twotone`,topbarTone:J=`neutral`,navLabel:he=`Main navigation`,linkComponent:Y,currentPath:_e,rememberCollapsed:ve=!1,collapsedCookie:ye=`wui-shell-collapsed`,foldedCookie:be=i,tabBarLabel:xe=`Quick navigation`,moreLabel:Se=`More`,skipLabel:Ce=`Skip to content`,openNavLabel:we=`Open navigation`,closeNavLabel:Te=`Close navigation`,expandNavLabel:Ee=`Expand navigation`,collapseNavLabel:De=`Collapse navigation`,newLabel:Oe=`New`,togglePagesLabel:ke=`Show or hide {name} pages`,accountMenuLabel:Ae=`Account menu for {name}`,roleLabel:je=`Role:`,rolesLabel:Me=`Roles:`,unreadLabel:Ne=`Unread`,markAllReadLabel:Pe=`Mark all read`,viewAllLabel:Fe=`View all`,loadingNotificationsText:Ie=`Loading…`,noUnreadText:Le=`No unread notifications`,unreadNotificationsText:Re=`{count} unread notifications`,unreadBellLabel:ze=`{label}, {count} unread`,searchResultsLabel:Be=`Search results`,noResultsText:Ve=`No results`,noResultsForText:He=`No results for “{value}”`,resultsCountText:Ue=`{count} results`,resultCountText:We=`{count} result`,userMenu:Ge,notifications:Ke,search:qe,className:Je=``,style:Ye,...Xe}=n;if(v(`AppShell`,Xe),_(`AppShell`,`density`,oe,R),_(`AppShell`,`topbarTone`,J,ee),_(`AppShell`,`nav`,G,z),_(`AppShell`,`iconVariant`,q,B),A!==void 0&&!C)throw Error(`<AppShell> brandLabel names the brand link, so it needs brandHref.`);if(C){if(!A&&!b)throw Error(`<AppShell> brandHref needs brandLabel or brandName: the collapsed rail hides the logo, so the link would have no accessible name.`);if(!(l||u||d||p||m))throw Error(`<AppShell> brandHref has no brand, logo or mark to link.`)}let Ze=(K??0)>0?{...Ye,"--wui-nav-item-height":`${K}px`}:Ye,[Qe,$e]=E(()=>ve&&U===void 0&&typeof document<`u`?o(ye)??!1:!1),[X,Z]=E(!1),[et,tt]=E(!1),[nt,rt]=E(!1),it=T(null),Q=U??Qe,at=e=>C?/* @__PURE__ */ O(le,{href:C,label:A||b,linkComponent:Y,onNavigate:()=>Z(!1),children:e}):e,ot=()=>{let e=!Q;U===void 0&&$e(e),ve&&c(e,ye),ie?.(e)},st=r.some(e=>e.collapsible),[ct,lt]=E(()=>st&&typeof document<`u`?a(be):/* @__PURE__ */ new Set),ut=e=>{let t=new Set(ct);t.has(e)?t.delete(e):t.add(e),lt(t),s(t,be)},dt=w(()=>ae(r,P,_e),[r,P,_e]),$=dt.groups,ft=dt.footer,pt=W?null:se($,ft.some(e=>e.active));S(()=>{let e=()=>tt(window.scrollY>4);return e(),window.addEventListener(`scroll`,e,{passive:!0}),()=>window.removeEventListener(`scroll`,e)},[]),S(()=>{y()},[]),S(()=>{x(it.current)},[]),S(()=>{let e=it.current;if(!e)return;let t=()=>rt($.length>0&&e.scrollHeight>e.clientHeight);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[$]),S(()=>{if(!X)return;let e=e=>{e.key===`Escape`&&Z(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[X]);let mt=[`app-shell`,Q?`collapsed`:``,W?`no-sidebar`:``,G===`top`?`wui-shell-top`:``,X?`mobile-open`:``,Je].filter(Boolean).join(` `);return/* @__PURE__ */ k(`div`,{className:mt,"data-density":oe===`compact`?`compact`:void 0,"data-wui-folded-cookie":st?be:void 0,style:Ze,...t,...Xe,children:[/* @__PURE__ */ O(`a`,{className:`wui-skip-link`,href:`#main-content`,children:Ce}),/* @__PURE__ */ k(`aside`,{className:`app-sidebar`,children:[(l||u||d||p||m)&&/* @__PURE__ */ O(`div`,{className:ne({logoLight:u,logoDark:d,markLight:p,markDark:m}),children:at(/* @__PURE__ */ k(D,{children:[re({logoLight:u,logoDark:d,markLight:p,markDark:m,brandName:b}),l]}))}),j&&/* @__PURE__ */ O(`div`,{className:`app-sidebar-start`,children:j}),M&&/* @__PURE__ */ O(`div`,{className:`app-sidebar-start-compact`,children:M}),/* @__PURE__ */ O(`nav`,{className:`app-sidebar-scroll`,"aria-label":he,ref:it,tabIndex:nt?0:void 0,children:$.map((e,t)=>{let n=e.items.map(e=>e.header==null?/* @__PURE__ */ O(fe,{item:e,linkComponent:Y,onNavigate:()=>Z(!1),iconVariant:q,newLabel:Oe,togglePagesLabel:ke},e.key??e.href??e.label):/* @__PURE__ */ O(`div`,{className:`wui-nav-header`,children:e.header},e.key??e.header));if(!e.collapsible)return/* @__PURE__ */ k(`div`,{className:`app-nav-group`,children:[e.label&&/* @__PURE__ */ O(`div`,{className:`app-nav-group-label`,children:e.label}),n,e.after&&/* @__PURE__ */ O(`div`,{className:`wui-nav-group-after`,children:e.after})]},e.key??e.label??`group-${t}`);let r=!ct.has(e.key??``)||!!de(e.items),i=`wui-nav-group-${e.key}`;return/* @__PURE__ */ k(`div`,{className:`app-nav-group wui-nav-group-collapsible${r?``:` wui-nav-group-folded`}`,"data-wui-nav-group":e.key,children:[/* @__PURE__ */ k(`button`,{type:`button`,className:`app-nav-group-label wui-nav-group-toggle`,"aria-expanded":r,"aria-controls":i,onClick:()=>ut(e.key??``),children:[/* @__PURE__ */ O(`span`,{className:`wui-nav-group-text`,children:e.label}),/* @__PURE__ */ O(`span`,{className:`wui-nav-group-caret`,children:/* @__PURE__ */ O(h,{name:`chevron-down`,size:16})})]}),/* @__PURE__ */ k(`div`,{className:`wui-nav-group-body`,id:i,children:[n,e.after&&/* @__PURE__ */ O(`div`,{className:`wui-nav-group-after`,children:e.after})]})]},e.key??`group-${t}`)})}),(N||ft.length>0)&&/* @__PURE__ */ k(`div`,{className:`app-sidebar-foot`,children:[ft.length>0&&/* @__PURE__ */ O(`div`,{className:`wui-sidebar-foot-links`,children:ft.map(e=>/* @__PURE__ */ O(fe,{item:e,linkComponent:Y,onNavigate:()=>Z(!1),iconVariant:q,newLabel:Oe,togglePagesLabel:ke},e.key??e.href??e.label))}),N]}),!W&&/* @__PURE__ */ O(`button`,{type:`button`,className:`app-sidebar-toggle`,onClick:ot,"aria-label":Q?Ee:De,"aria-expanded":!Q,children:/* @__PURE__ */ O(h,{name:`chevrons-left`,size:20})})]}),/* @__PURE__ */ k(`div`,{className:`app-main`,children:[/* @__PURE__ */ k(`header`,{className:`app-topbar${et?` scrolled`:``}`,"data-tone":J===`primary`?`primary`:void 0,children:[/* @__PURE__ */ k(`div`,{className:`app-topbar-start`,children:[/* @__PURE__ */ O(`button`,{type:`button`,className:`app-topbar-menu`,onClick:()=>Z(!0),"aria-label":we,"aria-expanded":X,children:/* @__PURE__ */ O(h,{name:`menu`,size:18})}),G===`top`&&l&&/* @__PURE__ */ O(`div`,{className:`wui-shell-top-brand`,children:at(l)}),G===`top`&&/* @__PURE__ */ O(`div`,{className:`wui-shell-top-nav`,children:/* @__PURE__ */ O(g,{items:ce($),ariaLabel:he,linkComponent:Y})}),F,qe&&/* @__PURE__ */ O(ge,{config:qe,searchResultsLabel:Be,noResultsText:Ve,noResultsForText:He,resultsCountText:Ue,resultCountText:We,moreLabel:Se})]}),/* @__PURE__ */ k(`div`,{className:`app-topbar-end`,children:[L,Ke&&/* @__PURE__ */ O(me,{config:Ke,unreadLabel:Ne,markAllReadLabel:Pe,viewAllLabel:Fe,loadingNotificationsText:Ie,noUnreadText:Le,unreadNotificationsText:Re,unreadBellLabel:ze}),Ge&&/* @__PURE__ */ O(pe,{config:Ge,linkComponent:Y,accountMenuLabel:Ae,roleLabel:je,rolesLabel:Me})]})]}),/* @__PURE__ */ O(`main`,{className:`app-content`,id:`main-content`,children:te}),V&&/* @__PURE__ */ O(`footer`,{className:`app-footer`,children:V})]}),H&&/* @__PURE__ */ O(`div`,{className:`wui-shell-launcher`,children:H}),pt&&/* @__PURE__ */ k(`nav`,{className:`wui-tabbar`,"aria-label":xe,children:[pt.tabs.map(e=>/* @__PURE__ */ O(ue,{tab:e,linkComponent:Y,iconVariant:q},e.key??e.href)),pt.hasMore&&/* @__PURE__ */ k(`button`,{type:`button`,className:`wui-tabbar-item${pt.moreActive?` active`:``}`,onClick:()=>Z(!0),children:[/* @__PURE__ */ O(`span`,{className:`wui-tabbar-icon`,children:/* @__PURE__ */ O(h,{name:`more`,size:24})}),/* @__PURE__ */ O(`span`,{className:`wui-tabbar-label`,children:Se})]})]}),/* @__PURE__ */ O(`button`,{type:`button`,className:`app-scrim`,onClick:()=>Z(!1),"aria-label":Te,tabIndex:X?0:-1})]})}function ae(e,t,n){let i=t;for(let e of i){if(e.children?.length)throw Error(`<AppShell> sidebarFooterItems cannot hold children; keep footer links flat.`);if(e.tab)throw Error(`<AppShell> sidebarFooterItems cannot carry tab: true; the phone tab bar is built from groups.`);if(e.header!=null)throw Error(`<AppShell> sidebarFooterItems cannot hold a header row.`)}for(let t of e)t.collapsible&&q(t);let a=(e,t=!1)=>(e??[]).map(e=>Array.isArray(e.children)?{...e,children:a(e.children)}:{...e}).filter(e=>G(e)?t:(e.children?.length??0)>0||!!e.href),o=[...e,{key:F,items:t}].map(e=>({...e,items:oe(a(e.items,!0))})).filter(e=>e.items.some(e=>!G(e))),s=[],c=e=>{for(let t of e)G(t)||(s.push(t),t.children&&c(t.children))};for(let e of o)c(e.items);for(let e of s)v(`AppShell items`,W(e)),_(`AppShell`,`match`,e.match,L),_(`AppShell`,`iconVariant`,e.iconVariant,B),_(`AppShell`,`badgeTone`,e.badgeTone,d);let l=null;if(n!=null&&!s.some(e=>e.active===!0)){let e=-1;for(let t of s){if(t.active!=null||t.children?.length&&!t.href)continue;let i=r(n,t.href,{exact:t.match===`exact`,also:t.matchAlso});if(i<0)continue;let a=t.match===`exact`&&r(n,t.href,{exact:!0})>=0?1/0:i;a>e&&(e=a,l=t)}}for(let e of s)e.active=e.active??e===l;return{groups:o.filter(e=>e.key!==F),footer:o.find(e=>e.key===F)?.items??[]}}function W(e){return Object.fromEntries(Object.entries(e).filter(([e])=>!V.has(e)))}var G=e=>e.header!=null;function oe(e){return e.filter((t,n)=>{if(!G(t))return!0;let r=e.findIndex((e,t)=>t>n&&G(e));return e.slice(n+1,r<0?void 0:r).length>0})}var K=/* @__PURE__ */ new Set;function q(t){if(t.key!=null&&P.test(t.key))return;let n=t.key==null?`<AppShell> a collapsible group needs a key so its folded state can be remembered.`:`<AppShell> collapsible group key "${t.key}" must use lower-case letters, digits and hyphens.`;typeof process<`u`&&process.env.NODE_ENV===`production`||K.has(n)||(K.add(n),e(n))}function se(e,t){let n=[],r=e=>{for(let t of e)G(t)||(t.children?.length?r(t.children):n.push(t))};for(let t of e)r(t.items);let i=n.filter(e=>e.tab);if(i.length===0)return null;let a=i.length<n.length,o=a?M:N;if(i.length>o)throw Error(`<AppShell>: ${i.length} items carry tab: true, but the phone tab bar holds ${o} (${a?`4 plus More, because other items exist`:`5 when every item is a tab`}). Flag fewer items.`);return{tabs:i,hasMore:a,moreActive:t||n.some(e=>!e.tab&&e.active)}}function ce(e){let t=e=>{if(e.label===void 0)throw Error(`<AppShell> a navigation row has no label; every row but a header needs one.`);return e.label},n=e=>e.key??e.href??t(e),r=(e,r)=>({key:n(e),label:t(e),to:r,current:!!e.active}),i=e=>e.flatMap(e=>G(e)?[]:[...e.href?[{...r(e,e.href),icon:e.icon}]:[],...i(e.children??[])]),a=[];for(let o of e.flatMap(e=>e.items)){if(G(o))continue;let e=i(o.children??[]);if(e.length>0){let i=o.href?[{...r(o,o.href),icon:o.icon}]:[];a.push({key:n(o),label:t(o),links:[...i,...e]})}else o.href&&a.push(r(o,o.href))}return a}function le({href:e,label:t,linkComponent:r,onNavigate:i,children:a}){return/* @__PURE__ */ O(l,{link:n(r,{to:e}),className:`wui-brand-link`,"aria-label":t,onClick:i,children:a})}function ue({tab:e,linkComponent:t,iconVariant:r}){let i=`wui-tabbar-item${e.active?` active`:``}`,a=/* @__PURE__ */ k(D,{children:[e.icon&&/* @__PURE__ */ O(`span`,{className:`wui-tabbar-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ O(h,{name:e.icon,size:24,variant:e.iconVariant??r}):e.icon}),/* @__PURE__ */ O(`span`,{className:`wui-tabbar-label`,children:e.tabLabel??e.label}),e.badge!=null&&/* @__PURE__ */ O(`span`,{className:`wui-tabbar-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:e.badge})]}),o=e.active?`page`:void 0;return/* @__PURE__ */ O(l,{link:n(t,{to:e.href}),className:i,"aria-current":o,children:a})}function de(e){for(let t of e){if(t.active)return t;let e=t.children?.length?de(t.children):void 0;if(e)return e}}function fe({item:e,linkComponent:r,onNavigate:i,depth:a=0,iconVariant:o,newLabel:s,togglePagesLabel:c}){let u=a>0,d=a>1?` wui-nav-depth-${Math.min(a,6)}`:``,f=Array.isArray(e.children)&&e.children.length>0,p=f?de(e.children??[]):void 0,m=!!p,g=p?p.key??p.href??p.label:null,[_,v]=E(m);S(()=>{g!=null&&v(!0)},[g]);let y=typeof e.label==`string`?e.label:void 0,b=!u&&e.icon&&/* @__PURE__ */ O(`span`,{className:`app-nav-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ O(h,{name:e.icon,size:e.iconSize??22,variant:e.iconVariant??o}):e.icon}),x=e.badge!=null&&/* @__PURE__ */ O(`span`,{className:`app-nav-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:e.badge}),C=U(e.newUntil)&&/* @__PURE__ */ O(`span`,{className:`wui-nav-new`,children:s}),w=/* @__PURE__ */ k(D,{children:[b,/* @__PURE__ */ O(`span`,{className:`app-nav-text`,children:e.label}),C,x,e.trailingIcon&&/* @__PURE__ */ O(`span`,{className:`app-nav-trailing`,children:typeof e.trailingIcon==`string`?/* @__PURE__ */ O(h,{name:e.trailingIcon,size:16}):e.trailingIcon})]}),T=e.active?`page`:void 0;if(f){let f=/* @__PURE__ */ O(`div`,{className:`app-nav-sub${_?` expanded`:``}`,inert:!_,"aria-hidden":!_||void 0,children:/* @__PURE__ */ O(`div`,{className:`app-nav-sub-inner`,children:(e.children??[]).map(e=>/* @__PURE__ */ O(fe,{item:e,linkComponent:r,onNavigate:i,depth:a+1,iconVariant:o,newLabel:s,togglePagesLabel:c},e.key??e.href))})});if(e.href){let a=/* @__PURE__ */ O(l,{link:n(r,{to:e.href}),className:`wui-nav-split-link`,"aria-current":T,onClick:i,children:w});return/* @__PURE__ */ k(D,{children:[/* @__PURE__ */ k(`div`,{className:`app-nav-item has-children wui-nav-split${u?` app-nav-subitem`:``}${m||e.active?` active`:``}${d}`,"data-label":y,children:[a,/* @__PURE__ */ O(`button`,{type:`button`,className:`app-nav-caret wui-nav-split-toggle`,"aria-expanded":_,"aria-label":t(c,{name:y??``}),onClick:()=>v(e=>!e),children:/* @__PURE__ */ O(h,{name:`chevron-right`,size:16})})]}),f]})}return/* @__PURE__ */ k(D,{children:[/* @__PURE__ */ k(`button`,{type:`button`,className:`app-nav-item${u?` app-nav-subitem`:``} has-children${m?` active`:``}${d}`,"aria-expanded":_,"data-label":y,onClick:()=>v(e=>!e),children:[b,/* @__PURE__ */ O(`span`,{className:`app-nav-text`,children:e.label}),C,x,/* @__PURE__ */ O(`span`,{className:`app-nav-caret`,children:/* @__PURE__ */ O(h,{name:`chevron-right`,size:16})})]}),f]})}let A=`app-nav-item${u?` app-nav-subitem`:``}${e.active?` active`:``}${d}`;return/* @__PURE__ */ O(l,{link:n(r,{to:e.href}),className:A,"aria-current":T,"data-label":y,onClick:i,children:w})}function J(){let[e,t]=E(!1),n=T(null);return S(()=>{if(!e)return;let r=e=>{n.current?.contains(e.target instanceof Node?e.target:null)||t(!1)},i=e=>{e.key===`Escape`&&(t(!1),n.current?.querySelector(`button`)?.focus())};return document.addEventListener(`mousedown`,r),document.addEventListener(`keydown`,i),()=>{document.removeEventListener(`mousedown`,r),document.removeEventListener(`keydown`,i)}},[e]),{open:e,setOpen:t,ref:n}}function pe({config:e,linkComponent:r,accountMenuLabel:i,roleLabel:a,rolesLabel:o}){let s=C(),{open:c,setOpen:u,ref:d}=J(),{name:f,role:g,roles:v=[],noTriggerRole:y=!1,photo:b,profileHref:x,profileLabel:S=`My profile`,onLogout:w,logoutAction:T,logoutLabel:E=`Sign out`,head:A,section:j,logoutVariant:M=`item`,items:N=[]}=e;if(_(`AppShell`,`userMenu.logoutVariant`,M,[`item`,`button`]),!f)throw Error(`<AppShell> userMenu.name is required; the trigger and the avatar are named from it.`);let P=v.map(e=>(e??``).trim()).filter(Boolean),F=()=>u(!1),I=(e,t,i,a)=>/* @__PURE__ */ O(l,{link:n(r,{to:e}),className:`dropdown-item`,onClick:a,children:t},i),L=/* @__PURE__ */ O(h,{name:`log-out`,size:18}),R=/* @__PURE__ */ k(D,{children:[L,E]});return/* @__PURE__ */ k(`div`,{className:`dropdown wui-usermenu`,ref:d,children:[/* @__PURE__ */ k(`button`,{type:`button`,id:s,className:`wui-usermenu-trigger`,"aria-expanded":c,"aria-label":t(i,{name:f}),onClick:()=>u(e=>!e),children:[/* @__PURE__ */ O(p,{name:f,src:b,tone:`auto`}),/* @__PURE__ */ k(`span`,{className:`wui-usermenu-text`,children:[/* @__PURE__ */ O(`span`,{className:`wui-usermenu-name`,children:f}),g&&!y&&/* @__PURE__ */ O(`span`,{className:`wui-usermenu-role`,children:g})]}),/* @__PURE__ */ O(h,{name:`chevron-down`,size:14,className:`wui-usermenu-caret`})]}),/* @__PURE__ */ k(`div`,{className:`dropdown-menu dropdown-menu-end wui-usermenu-menu${c?` show`:``}`,"aria-labelledby":s,"data-bs-popper":c?`static`:void 0,children:[/* @__PURE__ */ k(`div`,{className:`wui-usermenu-head`,children:[/* @__PURE__ */ O(p,{name:f,src:b,size:`lg`,tone:`auto`}),/* @__PURE__ */ k(`div`,{className:`wui-usermenu-who`,children:[/* @__PURE__ */ O(`div`,{className:`wui-usermenu-name`,children:f}),g&&/* @__PURE__ */ O(`div`,{className:`wui-usermenu-role`,children:g}),P.length>0&&/* @__PURE__ */ k(`div`,{className:`wui-usermenu-roles`,children:[/* @__PURE__ */ O(`span`,{className:`wui-usermenu-roles-label`,children:P.length===1?a:o}),` ${P.join(`, `)}`]}),A?/* @__PURE__ */ O(`div`,{className:`wui-usermenu-extra`,children:A}):null]})]}),j?/* @__PURE__ */ O(`div`,{className:`wui-usermenu-section`,children:j}):null,x&&I(x,/* @__PURE__ */ k(D,{children:[/* @__PURE__ */ O(h,{name:`user`,size:18}),S]}),void 0,F),N.map(e=>{if(e.divider)return/* @__PURE__ */ O(`hr`,{className:`dropdown-divider`},e.key);let t=/* @__PURE__ */ k(D,{children:[e.icon&&/* @__PURE__ */ O(h,{name:e.icon,size:18}),e.label]}),n=()=>{e.onClick?.(),F()};return e.href?I(e.href,t,e.key,n):/* @__PURE__ */ O(`button`,{type:`button`,className:`dropdown-item`,onClick:n,children:t},e.key)}),M===`button`?(T||w)&&/* @__PURE__ */ O(`div`,{className:`wui-usermenu-foot`,children:T?/* @__PURE__ */ O(`form`,{method:`post`,action:T,className:`wui-usermenu-logout`,children:/* @__PURE__ */ O(m,{type:`submit`,tone:`danger`,variant:`soft`,block:!0,leftIcon:L,children:E})}):/* @__PURE__ */ O(m,{type:`button`,tone:`danger`,variant:`soft`,block:!0,leftIcon:L,onClick:()=>{F(),w?.()},children:E})}):T?/* @__PURE__ */ O(`form`,{method:`post`,action:T,className:`wui-usermenu-logout`,children:/* @__PURE__ */ O(`button`,{type:`submit`,className:`dropdown-item danger`,children:R})}):w&&/* @__PURE__ */ O(`button`,{type:`button`,className:`dropdown-item danger`,onClick:()=>{F(),w()},children:R})]})]})}function me({config:e,unreadLabel:n,markAllReadLabel:r,viewAllLabel:i,loadingNotificationsText:a,noUnreadText:o,unreadNotificationsText:s,unreadBellLabel:c}){let l=C(),{open:u,setOpen:d,ref:f}=J(),{unread:p=0,items:m,loading:g=!1,onOpen:_,onMarkAllRead:v,viewAllHref:y,label:b=`Notifications`,emptyText:x=`You are all caught up.`}=e,[w,A]=E(``),j=T(p);S(()=>{j.current!==p&&(j.current=p,A(p===0?o:t(s,{count:H(p)})))},[p,o,s]);let M=null;return m?.length?M=/* @__PURE__ */ O(`div`,{className:`wui-bell-items`,children:m.map((e,t)=>{let r=`wui-bell-item${e.read?` wui-bell-item-read`:``}`,i=/* @__PURE__ */ k(D,{children:[/* @__PURE__ */ O(`span`,{className:`wui-bell-dot`,"aria-hidden":`true`}),e.icon&&/* @__PURE__ */ O(`span`,{className:`wui-bell-icon`,children:/* @__PURE__ */ O(h,{name:e.icon,size:18})}),/* @__PURE__ */ k(`span`,{className:`wui-bell-body`,children:[!e.read&&/* @__PURE__ */ k(`span`,{className:`visually-hidden`,children:[n,`: `]}),/* @__PURE__ */ O(`span`,{className:`wui-bell-item-title`,children:e.title}),e.time&&/* @__PURE__ */ O(`span`,{className:`wui-bell-when`,children:e.time})]})]});return e.href?/* @__PURE__ */ O(`a`,{className:r,href:e.href,"data-id":e.id,children:i},e.id??t):/* @__PURE__ */ O(`div`,{className:r,"data-id":e.id,children:i},e.id??t)})}):g?M=/* @__PURE__ */ O(`div`,{className:`wui-bell-state`,children:a}):m&&(M=/* @__PURE__ */ O(`div`,{className:`wui-bell-state`,children:x})),/* @__PURE__ */ k(`div`,{className:`dropdown wui-bell`,ref:f,children:[/* @__PURE__ */ k(`button`,{type:`button`,id:l,className:`topbar-icon-btn wui-bell-trigger`,"aria-expanded":u,"aria-label":p===0?b:t(c,{label:b,count:H(p)}),onClick:()=>{let e=!u;d(e),e&&_?.()},children:[/* @__PURE__ */ O(h,{name:`notification`,size:20}),/* @__PURE__ */ O(`span`,{className:`wui-bell-count`,"aria-hidden":`true`,hidden:p===0,children:H(p)})]}),/* @__PURE__ */ O(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:w}),/* @__PURE__ */ k(`div`,{className:`dropdown-menu dropdown-menu-end wui-bell-menu${u?` show`:``}`,"aria-labelledby":l,"data-bs-popper":u?`static`:void 0,children:[/* @__PURE__ */ k(`div`,{className:`wui-bell-head`,children:[/* @__PURE__ */ O(`span`,{className:`wui-bell-title`,children:b}),v&&/* @__PURE__ */ O(`button`,{type:`button`,className:`wui-bell-markall`,onClick:v,children:r})]}),/* @__PURE__ */ O(`div`,{className:`wui-bell-list`,"aria-busy":g||void 0,children:M}),y&&/* @__PURE__ */ O(`a`,{className:`wui-bell-foot`,href:y,children:i})]})]})}var he=e=>!!e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName));function ge({config:e,searchResultsLabel:n,noResultsText:r,noResultsForText:i,resultsCountText:a,resultCountText:o,moreLabel:s}){u(`wui-overflow`,A);let c=C(),{value:l=``,onChange:d,results:f=null,loading:p=!1,onSelect:m,onSubmit:g,onFocus:_,placeholder:v=`Search`}=e,[y,x]=E(!1),[D,j]=E(!1),[M,N]=E({results:null,index:-1}),P=M.results===f?M.index:-1,F=e=>N({results:f,index:e}),I=T(null),L=T(null),R=T([]),ee=w(()=>(f??[]).flatMap(e=>e.hits??[]),[f]),z=f!=null&&!D,B=ee.length;S(()=>{let e=e=>{e.key!==`/`||e.ctrlKey||e.metaKey||e.altKey||he(e.target instanceof HTMLElement?e.target:null)||(e.preventDefault(),x(!0),L.current?.focus())},t=e=>{I.current?.contains(e.target instanceof Node?e.target:null)||(j(!0),x(!1))};return document.addEventListener(`keydown`,e),document.addEventListener(`pointerdown`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`pointerdown`,t)}},[]);let V=e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(!z||B===0)return;e.preventDefault(),F((P+(e.key===`ArrowDown`?1:-1)+B)%B)}else b(e.nativeEvent)?z&&P>=0&&R.current[P]?(e.preventDefault(),R.current[P].click()):g&&l.trim()!==``&&(e.preventDefault(),g(l.trim())):e.key===`Escape`&&(z?(e.preventDefault(),j(!0)):y&&(e.preventDefault(),x(!1)))},H=-1;return R.current=[],/* @__PURE__ */ O(`wui-overflow`,{class:`wui-topsearch-host`,label:s,children:/* @__PURE__ */ O(`div`,{"data-wui-overflow-list":!0,className:`wui-topsearch-row`,children:/* @__PURE__ */ k(`div`,{className:`wui-topsearch${y?` is-open`:``}${p?` is-loading`:``}`,ref:I,"data-overflow-label":v,children:[/* @__PURE__ */ O(`button`,{type:`button`,className:`topbar-icon-btn wui-topsearch-open`,"aria-label":v,"aria-expanded":y,"aria-controls":`${c}-panel`,onClick:()=>{let e=!y;x(e),e&&L.current?.focus()},children:/* @__PURE__ */ O(h,{name:`search`,size:20})}),/* @__PURE__ */ k(`div`,{className:`wui-topsearch-panel`,id:`${c}-panel`,children:[/* @__PURE__ */ k(`div`,{className:`search-wrap`,children:[/* @__PURE__ */ O(h,{name:`search`,size:18,className:`search-icon`}),/* @__PURE__ */ O(`input`,{ref:L,type:`search`,className:`form-control input search-input`,id:`${c}-input`,placeholder:v,"aria-label":v,role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":z,"aria-controls":`${c}-list`,"aria-activedescendant":z&&P>=0?`${c}-opt-${P}`:void 0,autoComplete:`off`,value:l,onChange:e=>{j(!1),d?.(e.target.value)},onKeyDown:V,onFocus:_})]}),/* @__PURE__ */ O(`div`,{className:`wui-topsearch-results`,id:`${c}-list`,role:`listbox`,"aria-label":n,hidden:!z,children:z&&/* @__PURE__ */ k(`div`,{className:`wui-topsearch-groups`,role:`presentation`,children:[B===0&&/* @__PURE__ */ O(`div`,{className:`wui-topsearch-empty`,role:`option`,"aria-disabled":`true`,"aria-selected":`false`,children:t(i,{value:l})}),f.filter(e=>e.hits?.length).map((e,t)=>/* @__PURE__ */ k(`div`,{className:`wui-topsearch-group`,role:`group`,"aria-label":e.label??``,children:[e.label&&/* @__PURE__ */ O(`div`,{className:`wui-topsearch-group-label`,role:`presentation`,children:e.label}),e.hits.map(e=>{H+=1;let t=H;return/* @__PURE__ */ k(`a`,{className:`wui-topsearch-hit${t===P?` is-active`:``}`,role:`option`,"aria-selected":t===P,id:`${c}-opt-${t}`,href:e.href,ref:e=>{R.current[t]=e},onClick:t=>m?.(e,t),children:[e.icon&&/* @__PURE__ */ O(`span`,{className:`wui-topsearch-hit-icon`,children:/* @__PURE__ */ O(h,{name:e.icon,size:18})}),/* @__PURE__ */ k(`span`,{className:`wui-topsearch-hit-text`,children:[/* @__PURE__ */ O(`span`,{className:`wui-topsearch-hit-title`,children:e.title}),e.subtitle&&/* @__PURE__ */ O(`span`,{className:`wui-topsearch-hit-sub`,children:e.subtitle})]})]},`${e.href}-${t}`)})]},e.label??t))]})})]}),/* @__PURE__ */ O(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:z?B===0?r:t(B===1?o:a,{count:B}):``})]})})})}export{ie as default};
@@ -2,7 +2,7 @@
2
2
  "format": "webority-guidance/1",
3
3
  "package": {
4
4
  "name": "@webority/ui-react",
5
- "version": "0.161.0"
5
+ "version": "0.163.0"
6
6
  },
7
7
  "components": [
8
8
  {
@@ -1,11 +1,11 @@
1
- import { type ComponentPropsWithRef, type FormEvent, type JSX, type ReactNode } from "react";
1
+ import { type ComponentPropsWithRef, type JSX, type ReactNode, type SubmitEvent } from "react";
2
2
  export interface AppFormSubmitContext {
3
3
  /** One key per send; a new one is made only after onSubmit returns true. */
4
4
  idempotencyKey: string;
5
5
  }
6
6
  export interface AppFormProps extends Omit<ComponentPropsWithRef<"form">, "onSubmit" | "className"> {
7
7
  /** Runs once per submit; return true when the send succeeded, false to keep the same idempotency key for a retry. A second submit while one is pending is dropped. */
8
- onSubmit: (event: FormEvent<HTMLFormElement>, context: AppFormSubmitContext) => boolean | Promise<boolean>;
8
+ onSubmit: (event: SubmitEvent<HTMLFormElement>, context: AppFormSubmitContext) => boolean | Promise<boolean>;
9
9
  /**
10
10
  * Extra class names added to the form element.
11
11
  * @default ""
@@ -1,4 +1,4 @@
1
- export { createLocalSeenStore, mentionedIds, parseMentionValue, postedMasked, themeBootScript, } from "@webority/ui-elements/helpers";
1
+ export { createLocalSeenStore, isImeSafeEnter, mentionedIds, parseMentionValue, postedMasked, themeBootScript, } from "@webority/ui-elements/helpers";
2
2
  export { default as AppAccordion } from "./components/AppAccordion.tsx";
3
3
  export { default as AppAccountSwitcher } from "./components/AppAccountSwitcher.tsx";
4
4
  export { default as AppActionIcon } from "./components/AppActionIcon.tsx";
package/dist/ui-react.js CHANGED
@@ -1 +1 @@
1
- import e from"./components/AppAccordion.js";import t from"./components/AppAccountSwitcher.js";import n from"./components/AppActionIcon.js";import r from"./components/AppAlert.js";import i from"./components/AppAsyncBlock.js";import a from"./components/AppAuthLayout.js";import o from"./components/AppAvatar.js";import s from"./components/AppAvatarGroup.js";import c from"./components/AppBadge.js";import l from"./components/AppBanner.js";import u from"./components/AppBreadcrumbs.js";import d from"./components/AppButton.js";import f from"./components/AppButtonGroup.js";import p from"./components/AppCalendar.js";import m from"./components/AppCard.js";import h from"./components/AppCarousel.js";import g from"./components/AppCell.js";import _ from"./components/AppChart.js";import v from"./components/AppChartCard.js";import y from"./components/AppCheckbox.js";import b from"./components/AppChip.js";import x from"./components/AppChipGroup.js";import S from"./components/AppChoiceCard.js";import C from"./components/AppChoiceChip.js";import w from"./components/AppCodeBlock.js";import T from"./components/AppColorField.js";import E from"./components/AppColumnMenu.js";import D from"./components/AppCommandPalette.js";import O from"./components/AppCommentThread.js";import k from"./components/AppCompareTable.js";import A from"./components/AppConfirmDialog.js";import j,{useConfirm as M}from"./components/AppConfirmProvider.js";import N from"./components/AppConsentBanner.js";import P from"./components/AppContextMenu.js";import F from"./components/AppCopyButton.js";import I from"./components/AppCountryFlag.js";import L from"./components/AppDashboardCell.js";import R from"./components/AppDashboardGrid.js";import z from"./components/AppDataTable.js";import B from"./components/AppDatePicker.js";import V from"./components/AppDateRangePicker.js";import H from"./components/AppDescriptions.js";import U from"./components/AppDetailPane.js";import W from"./components/AppDrawer.js";import G from"./components/AppDropdown.js";import K from"./components/AppDropZone.js";import q from"./components/AppDueDate.js";import J from"./components/AppEmptyState.js";import Y from"./components/AppErrorBoundary.js";import X from"./components/AppErrorSummary.js";import Z from"./components/AppFileAttachment.js";import Q from"./components/AppFilePicker.js";import $ from"./components/AppFileTiles.js";import ee from"./components/AppFileViewer.js";import te from"./components/AppFilterBar.js";import ne from"./components/AppFloatingButton.js";import re from"./components/AppFloatingDock.js";import ie,{useFormSubmit as ae}from"./components/AppForm.js";import oe from"./components/AppFormActions.js";import se from"./components/AppFormRow.js";import ce from"./components/AppFormSection.js";import le from"./components/AppHoverCard.js";import ue,{iconNames as de,registerIcons as fe}from"./components/AppIcon.js";import pe from"./components/AppImagePicker.js";import me from"./components/AppInfoTip.js";import he from"./components/AppInlineEdit.js";import ge from"./components/AppInput.js";import _e from"./components/AppInputGroup.js";import ve from"./components/AppKanban.js";import ye from"./components/AppKbd.js";import be from"./components/AppKpiTile.js";import xe from"./components/AppLeadPopup.js";import Se from"./components/AppLightbox.js";import Ce from"./components/AppLink.js";import we from"./components/AppMarkdown.js";import Te from"./components/AppMentionInput.js";import Ee from"./components/AppMeter.js";import De from"./components/AppMetricStrip.js";import Oe from"./components/AppModal.js";import ke from"./components/AppNavigationMenu.js";import Ae from"./components/AppNavList.js";import je from"./components/AppNotificationCenter.js";import Me from"./components/AppNumberInput.js";import Ne from"./components/AppOnboardingChecklist.js";import Pe from"./components/AppOrgTree.js";import Fe from"./components/AppOtpInput.js";import Ie from"./components/AppPageHeader.js";import Le from"./components/AppPhoneNumberInput.js";import Re from"./components/AppPopover.js";import ze from"./components/AppPricingCard.js";import Be from"./components/AppProgress.js";import Ve from"./components/AppQrCode.js";import He from"./components/AppRadio.js";import Ue from"./components/AppRadioGroup.js";import We from"./components/AppRating.js";import Ge from"./components/AppRecordPager.js";import Ke from"./components/AppRelativeTime.js";import qe from"./components/AppRepeater.js";import Je from"./components/AppRequiredMark.js";import Ye from"./components/AppResizable.js";import Xe from"./components/AppResizableHandle.js";import Ze from"./components/AppResizablePanel.js";import Qe from"./components/AppResourceCard.js";import $e from"./components/AppResult.js";import et from"./components/AppRichText.js";import tt from"./components/AppRollingNumber.js";import nt from"./components/AppRouteError.js";import rt from"./components/AppRowSwitch.js";import it from"./components/AppScoreScale.js";import at from"./components/AppScrollbar.js";import ot from"./components/AppSearch.js";import st from"./components/AppSectionCallToAction.js";import ct from"./components/AppSectionFaq.js";import lt from"./components/AppSectionFeatures.js";import ut from"./components/AppSectionHero.js";import dt from"./components/AppSectionLeadCapture.js";import ft from"./components/AppSectionLogos.js";import pt from"./components/AppSectionPricing.js";import mt from"./components/AppSectionTestimonials.js";import ht from"./components/AppSegmented.js";import gt from"./components/AppSelect.js";import _t from"./components/AppSeoHead.js";import vt from"./components/AppShell.js";import yt from"./components/AppShortcutLegend.js";import bt from"./components/AppShowMore.js";import xt,{AppSkeletonRows as St}from"./components/AppSkeleton.js";import Ct from"./components/AppSkeletonLines.js";import wt from"./components/AppSlider.js";import Tt from"./components/AppSortableList.js";import Et from"./components/AppSparkline.js";import Dt from"./components/AppSpinner.js";import Ot from"./components/AppSplash.js";import kt from"./components/AppSplitButton.js";import At from"./components/AppSplitView.js";import jt from"./components/AppStatusBadge.js";import Mt from"./components/AppStepper.js";import Nt from"./components/AppSwitch.js";import Pt from"./components/AppTablePagination.js";import Ft from"./components/AppTableToolbar.js";import It from"./components/AppTabs.js";import Lt from"./components/AppTextarea.js";import Rt from"./components/AppThemeToggle.js";import zt from"./components/AppTimeline.js";import Bt from"./components/AppTimePicker.js";import Vt from"./components/AppToast.js";import Ht from"./components/AppToolbar.js";import Ut from"./components/AppTooltip.js";import Wt from"./components/AppTour.js";import Gt from"./components/AppTreeView.js";import Kt from"./components/AppTruncate.js";import qt from"./components/AppUpdateBar.js";import Jt from"./components/AppWhatsNew.js";import Yt from"./components/AppWizard.js";import Xt from"./components/AppWorkspaceSwitcher.js";import Zt from"./components/assertValidValue.js";import{MODAL_ICONS as Qt}from"./components/ModalIcons.js";import{dismissAll as $t,errorToast as en,toast as tn}from"./components/toast.js";import{useCommandPaletteShortcut as nn}from"./lib/useCommandPaletteShortcut.js";import{useFloatingStack as rn}from"./lib/useFloatingStack.js";import{useListShortcuts as an}from"./lib/useListShortcuts.js";import{usePagination as on}from"./lib/usePagination.js";import{useTableView as sn}from"./lib/useTableView.js";import{createLocalSeenStore as cn,mentionedIds as ln,parseMentionValue as un,postedMasked as dn,themeBootScript as fn}from"@webority/ui-elements/helpers";export{e as AppAccordion,t as AppAccountSwitcher,n as AppActionIcon,r as AppAlert,i as AppAsyncBlock,a as AppAuthLayout,o as AppAvatar,s as AppAvatarGroup,c as AppBadge,l as AppBanner,u as AppBreadcrumbs,d as AppButton,f as AppButtonGroup,p as AppCalendar,m as AppCard,h as AppCarousel,g as AppCell,_ as AppChart,v as AppChartCard,y as AppCheckbox,b as AppChip,x as AppChipGroup,S as AppChoiceCard,C as AppChoiceChip,w as AppCodeBlock,T as AppColorField,E as AppColumnMenu,D as AppCommandPalette,O as AppCommentThread,k as AppCompareTable,A as AppConfirmDialog,j as AppConfirmProvider,N as AppConsentBanner,P as AppContextMenu,F as AppCopyButton,I as AppCountryFlag,L as AppDashboardCell,R as AppDashboardGrid,z as AppDataTable,B as AppDatePicker,V as AppDateRangePicker,H as AppDescriptions,U as AppDetailPane,W as AppDrawer,K as AppDropZone,G as AppDropdown,q as AppDueDate,J as AppEmptyState,Y as AppErrorBoundary,X as AppErrorSummary,Z as AppFileAttachment,Q as AppFilePicker,$ as AppFileTiles,ee as AppFileViewer,te as AppFilterBar,ne as AppFloatingButton,re as AppFloatingDock,ie as AppForm,oe as AppFormActions,se as AppFormRow,ce as AppFormSection,le as AppHoverCard,ue as AppIcon,pe as AppImagePicker,me as AppInfoTip,he as AppInlineEdit,ge as AppInput,_e as AppInputGroup,ve as AppKanban,ye as AppKbd,be as AppKpiTile,xe as AppLeadPopup,Se as AppLightbox,Ce as AppLink,we as AppMarkdown,Te as AppMentionInput,Ee as AppMeter,De as AppMetricStrip,Oe as AppModal,Ae as AppNavList,ke as AppNavigationMenu,je as AppNotificationCenter,Me as AppNumberInput,Ne as AppOnboardingChecklist,Pe as AppOrgTree,Fe as AppOtpInput,Ie as AppPageHeader,Le as AppPhoneNumberInput,Re as AppPopover,ze as AppPricingCard,Be as AppProgress,Ve as AppQrCode,He as AppRadio,Ue as AppRadioGroup,We as AppRating,Ge as AppRecordPager,Ke as AppRelativeTime,qe as AppRepeater,Je as AppRequiredMark,Ye as AppResizable,Xe as AppResizableHandle,Ze as AppResizablePanel,Qe as AppResourceCard,$e as AppResult,et as AppRichText,tt as AppRollingNumber,nt as AppRouteError,rt as AppRowSwitch,it as AppScoreScale,at as AppScrollbar,ot as AppSearch,st as AppSectionCallToAction,ct as AppSectionFaq,lt as AppSectionFeatures,ut as AppSectionHero,dt as AppSectionLeadCapture,ft as AppSectionLogos,pt as AppSectionPricing,mt as AppSectionTestimonials,ht as AppSegmented,gt as AppSelect,_t as AppSeoHead,vt as AppShell,yt as AppShortcutLegend,bt as AppShowMore,xt as AppSkeleton,Ct as AppSkeletonLines,St as AppSkeletonRows,wt as AppSlider,Tt as AppSortableList,Et as AppSparkline,Dt as AppSpinner,Ot as AppSplash,kt as AppSplitButton,At as AppSplitView,jt as AppStatusBadge,Mt as AppStepper,Nt as AppSwitch,Pt as AppTablePagination,Ft as AppTableToolbar,It as AppTabs,Lt as AppTextarea,Rt as AppThemeToggle,Bt as AppTimePicker,zt as AppTimeline,Vt as AppToast,Ht as AppToolbar,Ut as AppTooltip,Wt as AppTour,Gt as AppTreeView,Kt as AppTruncate,qt as AppUpdateBar,Jt as AppWhatsNew,Yt as AppWizard,Xt as AppWorkspaceSwitcher,Qt as MODAL_ICONS,Zt as assertValidValue,cn as createLocalSeenStore,$t as dismissAll,en as errorToast,de as iconNames,ln as mentionedIds,un as parseMentionValue,dn as postedMasked,fe as registerIcons,fn as themeBootScript,tn as toast,nn as useCommandPaletteShortcut,M as useConfirm,rn as useFloatingStack,ae as useFormSubmit,an as useListShortcuts,on as usePagination,sn as useTableView};
1
+ import e from"./components/AppAccordion.js";import t from"./components/AppAccountSwitcher.js";import n from"./components/AppActionIcon.js";import r from"./components/AppAlert.js";import i from"./components/AppAsyncBlock.js";import a from"./components/AppAuthLayout.js";import o from"./components/AppAvatar.js";import s from"./components/AppAvatarGroup.js";import c from"./components/AppBadge.js";import l from"./components/AppBanner.js";import u from"./components/AppBreadcrumbs.js";import d from"./components/AppButton.js";import f from"./components/AppButtonGroup.js";import p from"./components/AppCalendar.js";import m from"./components/AppCard.js";import h from"./components/AppCarousel.js";import g from"./components/AppCell.js";import _ from"./components/AppChart.js";import v from"./components/AppChartCard.js";import y from"./components/AppCheckbox.js";import b from"./components/AppChip.js";import x from"./components/AppChipGroup.js";import S from"./components/AppChoiceCard.js";import C from"./components/AppChoiceChip.js";import w from"./components/AppCodeBlock.js";import T from"./components/AppColorField.js";import E from"./components/AppColumnMenu.js";import D from"./components/AppCommandPalette.js";import O from"./components/AppCommentThread.js";import k from"./components/AppCompareTable.js";import A from"./components/AppConfirmDialog.js";import j,{useConfirm as M}from"./components/AppConfirmProvider.js";import N from"./components/AppConsentBanner.js";import P from"./components/AppContextMenu.js";import F from"./components/AppCopyButton.js";import I from"./components/AppCountryFlag.js";import L from"./components/AppDashboardCell.js";import R from"./components/AppDashboardGrid.js";import z from"./components/AppDataTable.js";import B from"./components/AppDatePicker.js";import V from"./components/AppDateRangePicker.js";import H from"./components/AppDescriptions.js";import U from"./components/AppDetailPane.js";import W from"./components/AppDrawer.js";import G from"./components/AppDropdown.js";import K from"./components/AppDropZone.js";import q from"./components/AppDueDate.js";import J from"./components/AppEmptyState.js";import Y from"./components/AppErrorBoundary.js";import X from"./components/AppErrorSummary.js";import Z from"./components/AppFileAttachment.js";import Q from"./components/AppFilePicker.js";import $ from"./components/AppFileTiles.js";import ee from"./components/AppFileViewer.js";import te from"./components/AppFilterBar.js";import ne from"./components/AppFloatingButton.js";import re from"./components/AppFloatingDock.js";import ie,{useFormSubmit as ae}from"./components/AppForm.js";import oe from"./components/AppFormActions.js";import se from"./components/AppFormRow.js";import ce from"./components/AppFormSection.js";import le from"./components/AppHoverCard.js";import ue,{iconNames as de,registerIcons as fe}from"./components/AppIcon.js";import pe from"./components/AppImagePicker.js";import me from"./components/AppInfoTip.js";import he from"./components/AppInlineEdit.js";import ge from"./components/AppInput.js";import _e from"./components/AppInputGroup.js";import ve from"./components/AppKanban.js";import ye from"./components/AppKbd.js";import be from"./components/AppKpiTile.js";import xe from"./components/AppLeadPopup.js";import Se from"./components/AppLightbox.js";import Ce from"./components/AppLink.js";import we from"./components/AppMarkdown.js";import Te from"./components/AppMentionInput.js";import Ee from"./components/AppMeter.js";import De from"./components/AppMetricStrip.js";import Oe from"./components/AppModal.js";import ke from"./components/AppNavigationMenu.js";import Ae from"./components/AppNavList.js";import je from"./components/AppNotificationCenter.js";import Me from"./components/AppNumberInput.js";import Ne from"./components/AppOnboardingChecklist.js";import Pe from"./components/AppOrgTree.js";import Fe from"./components/AppOtpInput.js";import Ie from"./components/AppPageHeader.js";import Le from"./components/AppPhoneNumberInput.js";import Re from"./components/AppPopover.js";import ze from"./components/AppPricingCard.js";import Be from"./components/AppProgress.js";import Ve from"./components/AppQrCode.js";import He from"./components/AppRadio.js";import Ue from"./components/AppRadioGroup.js";import We from"./components/AppRating.js";import Ge from"./components/AppRecordPager.js";import Ke from"./components/AppRelativeTime.js";import qe from"./components/AppRepeater.js";import Je from"./components/AppRequiredMark.js";import Ye from"./components/AppResizable.js";import Xe from"./components/AppResizableHandle.js";import Ze from"./components/AppResizablePanel.js";import Qe from"./components/AppResourceCard.js";import $e from"./components/AppResult.js";import et from"./components/AppRichText.js";import tt from"./components/AppRollingNumber.js";import nt from"./components/AppRouteError.js";import rt from"./components/AppRowSwitch.js";import it from"./components/AppScoreScale.js";import at from"./components/AppScrollbar.js";import ot from"./components/AppSearch.js";import st from"./components/AppSectionCallToAction.js";import ct from"./components/AppSectionFaq.js";import lt from"./components/AppSectionFeatures.js";import ut from"./components/AppSectionHero.js";import dt from"./components/AppSectionLeadCapture.js";import ft from"./components/AppSectionLogos.js";import pt from"./components/AppSectionPricing.js";import mt from"./components/AppSectionTestimonials.js";import ht from"./components/AppSegmented.js";import gt from"./components/AppSelect.js";import _t from"./components/AppSeoHead.js";import vt from"./components/AppShell.js";import yt from"./components/AppShortcutLegend.js";import bt from"./components/AppShowMore.js";import xt,{AppSkeletonRows as St}from"./components/AppSkeleton.js";import Ct from"./components/AppSkeletonLines.js";import wt from"./components/AppSlider.js";import Tt from"./components/AppSortableList.js";import Et from"./components/AppSparkline.js";import Dt from"./components/AppSpinner.js";import Ot from"./components/AppSplash.js";import kt from"./components/AppSplitButton.js";import At from"./components/AppSplitView.js";import jt from"./components/AppStatusBadge.js";import Mt from"./components/AppStepper.js";import Nt from"./components/AppSwitch.js";import Pt from"./components/AppTablePagination.js";import Ft from"./components/AppTableToolbar.js";import It from"./components/AppTabs.js";import Lt from"./components/AppTextarea.js";import Rt from"./components/AppThemeToggle.js";import zt from"./components/AppTimeline.js";import Bt from"./components/AppTimePicker.js";import Vt from"./components/AppToast.js";import Ht from"./components/AppToolbar.js";import Ut from"./components/AppTooltip.js";import Wt from"./components/AppTour.js";import Gt from"./components/AppTreeView.js";import Kt from"./components/AppTruncate.js";import qt from"./components/AppUpdateBar.js";import Jt from"./components/AppWhatsNew.js";import Yt from"./components/AppWizard.js";import Xt from"./components/AppWorkspaceSwitcher.js";import Zt from"./components/assertValidValue.js";import{MODAL_ICONS as Qt}from"./components/ModalIcons.js";import{dismissAll as $t,errorToast as en,toast as tn}from"./components/toast.js";import{useCommandPaletteShortcut as nn}from"./lib/useCommandPaletteShortcut.js";import{useFloatingStack as rn}from"./lib/useFloatingStack.js";import{useListShortcuts as an}from"./lib/useListShortcuts.js";import{usePagination as on}from"./lib/usePagination.js";import{useTableView as sn}from"./lib/useTableView.js";import{createLocalSeenStore as cn,isImeSafeEnter as ln,mentionedIds as un,parseMentionValue as dn,postedMasked as fn,themeBootScript as pn}from"@webority/ui-elements/helpers";export{e as AppAccordion,t as AppAccountSwitcher,n as AppActionIcon,r as AppAlert,i as AppAsyncBlock,a as AppAuthLayout,o as AppAvatar,s as AppAvatarGroup,c as AppBadge,l as AppBanner,u as AppBreadcrumbs,d as AppButton,f as AppButtonGroup,p as AppCalendar,m as AppCard,h as AppCarousel,g as AppCell,_ as AppChart,v as AppChartCard,y as AppCheckbox,b as AppChip,x as AppChipGroup,S as AppChoiceCard,C as AppChoiceChip,w as AppCodeBlock,T as AppColorField,E as AppColumnMenu,D as AppCommandPalette,O as AppCommentThread,k as AppCompareTable,A as AppConfirmDialog,j as AppConfirmProvider,N as AppConsentBanner,P as AppContextMenu,F as AppCopyButton,I as AppCountryFlag,L as AppDashboardCell,R as AppDashboardGrid,z as AppDataTable,B as AppDatePicker,V as AppDateRangePicker,H as AppDescriptions,U as AppDetailPane,W as AppDrawer,K as AppDropZone,G as AppDropdown,q as AppDueDate,J as AppEmptyState,Y as AppErrorBoundary,X as AppErrorSummary,Z as AppFileAttachment,Q as AppFilePicker,$ as AppFileTiles,ee as AppFileViewer,te as AppFilterBar,ne as AppFloatingButton,re as AppFloatingDock,ie as AppForm,oe as AppFormActions,se as AppFormRow,ce as AppFormSection,le as AppHoverCard,ue as AppIcon,pe as AppImagePicker,me as AppInfoTip,he as AppInlineEdit,ge as AppInput,_e as AppInputGroup,ve as AppKanban,ye as AppKbd,be as AppKpiTile,xe as AppLeadPopup,Se as AppLightbox,Ce as AppLink,we as AppMarkdown,Te as AppMentionInput,Ee as AppMeter,De as AppMetricStrip,Oe as AppModal,Ae as AppNavList,ke as AppNavigationMenu,je as AppNotificationCenter,Me as AppNumberInput,Ne as AppOnboardingChecklist,Pe as AppOrgTree,Fe as AppOtpInput,Ie as AppPageHeader,Le as AppPhoneNumberInput,Re as AppPopover,ze as AppPricingCard,Be as AppProgress,Ve as AppQrCode,He as AppRadio,Ue as AppRadioGroup,We as AppRating,Ge as AppRecordPager,Ke as AppRelativeTime,qe as AppRepeater,Je as AppRequiredMark,Ye as AppResizable,Xe as AppResizableHandle,Ze as AppResizablePanel,Qe as AppResourceCard,$e as AppResult,et as AppRichText,tt as AppRollingNumber,nt as AppRouteError,rt as AppRowSwitch,it as AppScoreScale,at as AppScrollbar,ot as AppSearch,st as AppSectionCallToAction,ct as AppSectionFaq,lt as AppSectionFeatures,ut as AppSectionHero,dt as AppSectionLeadCapture,ft as AppSectionLogos,pt as AppSectionPricing,mt as AppSectionTestimonials,ht as AppSegmented,gt as AppSelect,_t as AppSeoHead,vt as AppShell,yt as AppShortcutLegend,bt as AppShowMore,xt as AppSkeleton,Ct as AppSkeletonLines,St as AppSkeletonRows,wt as AppSlider,Tt as AppSortableList,Et as AppSparkline,Dt as AppSpinner,Ot as AppSplash,kt as AppSplitButton,At as AppSplitView,jt as AppStatusBadge,Mt as AppStepper,Nt as AppSwitch,Pt as AppTablePagination,Ft as AppTableToolbar,It as AppTabs,Lt as AppTextarea,Rt as AppThemeToggle,Bt as AppTimePicker,zt as AppTimeline,Vt as AppToast,Ht as AppToolbar,Ut as AppTooltip,Wt as AppTour,Gt as AppTreeView,Kt as AppTruncate,qt as AppUpdateBar,Jt as AppWhatsNew,Yt as AppWizard,Xt as AppWorkspaceSwitcher,Qt as MODAL_ICONS,Zt as assertValidValue,cn as createLocalSeenStore,$t as dismissAll,en as errorToast,de as iconNames,ln as isImeSafeEnter,un as mentionedIds,dn as parseMentionValue,fn as postedMasked,fe as registerIcons,pn as themeBootScript,tn as toast,nn as useCommandPaletteShortcut,M as useConfirm,rn as useFloatingStack,ae as useFormSubmit,an as useListShortcuts,on as usePagination,sn as useTableView};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webority/ui-react",
3
- "version": "0.161.0",
3
+ "version": "0.163.0",
4
4
  "description": "Webority shared React component library: App* primitives on react-bootstrap and the @webority/theme design system.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",
@@ -29,14 +29,14 @@
29
29
  },
30
30
  "sideEffects": false,
31
31
  "dependencies": {
32
- "@webority/markdown-core": "0.161.0",
33
- "@webority/theme": "0.161.0",
34
- "@webority/ui-elements": "0.161.0",
35
- "@webority/web-core": "0.161.0"
32
+ "@webority/markdown-core": "0.163.0",
33
+ "@webority/theme": "0.163.0",
34
+ "@webority/ui-elements": "0.163.0",
35
+ "@webority/web-core": "0.163.0"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "@webority/analytics": "^0.40.0",
39
- "bootstrap": "5.3.8",
39
+ "bootstrap": "5.3.9",
40
40
  "react": "^19.0.0",
41
41
  "react-bootstrap": "^2.10.0",
42
42
  "react-dom": "^19.0.0"
@@ -51,11 +51,11 @@
51
51
  "@types/react-dom": "^19.3.0",
52
52
  "@vitejs/plugin-react": "^6.0.1",
53
53
  "@vitest/coverage-v8": "5.1.0",
54
- "@webority/analytics": "0.40.3",
55
- "@webority/canvas-kit": "0.161.0",
56
- "@webority/biome-config": "0.161.0",
57
- "@webority/tokens": "0.161.0",
58
- "bootstrap": "5.3.8",
54
+ "@webority/analytics": "0.40.5",
55
+ "@webority/canvas-kit": "0.163.0",
56
+ "@webority/biome-config": "0.163.0",
57
+ "@webority/tokens": "0.163.0",
58
+ "bootstrap": "5.3.9",
59
59
  "jsdom": "30.1.1",
60
60
  "react": "^19.3.1",
61
61
  "react-bootstrap": "^2.10.6",