@webority/ui-react 0.157.0 → 0.160.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.
- package/dist/canvas-kit/kit.js +175 -175
- package/dist/canvas-kit/manifest.json +21 -5
- package/dist/canvas-kit/release.json +7 -7
- package/dist/components/AppShell.js +1 -1
- package/dist/guidance.json +1 -1
- package/dist/lib/svgNodes.js +1 -1
- package/dist/types/components/AppContextMenu.d.ts +1 -1
- package/dist/types/components/AppDropdown.d.ts +1 -1
- package/dist/types/components/AppFileAttachment.d.ts +3 -3
- package/dist/types/components/AppShell.d.ts +3 -2
- package/dist/types/components/AppSplitButton.d.ts +3 -3
- package/dist/types/components/AppTreeView.d.ts +2 -1
- package/dist/types/lib/svgNodes.d.ts +5 -2
- package/package.json +9 -9
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"kind": "WeborityWeb",
|
|
3
3
|
"library": {
|
|
4
4
|
"name": "@webority/ui-react",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.160.0"
|
|
6
6
|
},
|
|
7
|
-
"rendererProtocolVersion":
|
|
7
|
+
"rendererProtocolVersion": 14,
|
|
8
8
|
"platform": "Web",
|
|
9
9
|
"kitModuleVersion": 2,
|
|
10
10
|
"productKit": null,
|
|
@@ -9848,7 +9848,7 @@
|
|
|
9848
9848
|
},
|
|
9849
9849
|
{
|
|
9850
9850
|
"name": "label",
|
|
9851
|
-
"type": "
|
|
9851
|
+
"type": "node",
|
|
9852
9852
|
"required": false,
|
|
9853
9853
|
"description": "The label shown above the field.",
|
|
9854
9854
|
"default": "Attachment"
|
|
@@ -21799,11 +21799,14 @@
|
|
|
21799
21799
|
"type": "enum",
|
|
21800
21800
|
"enum": [
|
|
21801
21801
|
"danger",
|
|
21802
|
+
"info",
|
|
21803
|
+
"neutral",
|
|
21804
|
+
"primary",
|
|
21802
21805
|
"success",
|
|
21803
21806
|
"warning"
|
|
21804
21807
|
],
|
|
21805
21808
|
"required": false,
|
|
21806
|
-
"description": "Tints the badge for an alert count."
|
|
21809
|
+
"description": "Tints the badge, in the AppBadge tone set: danger for an alert count, primary for a plain count."
|
|
21807
21810
|
},
|
|
21808
21811
|
{
|
|
21809
21812
|
"name": "children",
|
|
@@ -22284,11 +22287,14 @@
|
|
|
22284
22287
|
"type": "enum",
|
|
22285
22288
|
"enum": [
|
|
22286
22289
|
"danger",
|
|
22290
|
+
"info",
|
|
22291
|
+
"neutral",
|
|
22292
|
+
"primary",
|
|
22287
22293
|
"success",
|
|
22288
22294
|
"warning"
|
|
22289
22295
|
],
|
|
22290
22296
|
"required": false,
|
|
22291
|
-
"description": "Tints the badge for an alert count."
|
|
22297
|
+
"description": "Tints the badge, in the AppBadge tone set: danger for an alert count, primary for a plain count."
|
|
22292
22298
|
},
|
|
22293
22299
|
{
|
|
22294
22300
|
"name": "href",
|
|
@@ -31272,6 +31278,16 @@
|
|
|
31272
31278
|
"version": "0.152.0",
|
|
31273
31279
|
"components": [],
|
|
31274
31280
|
"values": {}
|
|
31281
|
+
},
|
|
31282
|
+
{
|
|
31283
|
+
"version": "0.158.0",
|
|
31284
|
+
"components": [],
|
|
31285
|
+
"values": {}
|
|
31286
|
+
},
|
|
31287
|
+
{
|
|
31288
|
+
"version": "0.160.0",
|
|
31289
|
+
"components": [],
|
|
31290
|
+
"values": {}
|
|
31275
31291
|
}
|
|
31276
31292
|
]
|
|
31277
31293
|
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webority-web",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.160.0",
|
|
4
4
|
"platform": "Web",
|
|
5
5
|
"kitModuleVersion": 2,
|
|
6
|
-
"rendererProtocolVersion":
|
|
6
|
+
"rendererProtocolVersion": 14,
|
|
7
7
|
"library": {
|
|
8
8
|
"name": "@webority/ui-react",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.160.0"
|
|
10
10
|
},
|
|
11
11
|
"files": {
|
|
12
12
|
"manifest.json": {
|
|
13
|
-
"sha256": "
|
|
14
|
-
"bytes":
|
|
13
|
+
"sha256": "d15e07eb1de37737ec6e9ef4b10358676cc9037b5a7407b590443a0b276a1bd3",
|
|
14
|
+
"bytes": 1015593
|
|
15
15
|
},
|
|
16
16
|
"kit.js": {
|
|
17
|
-
"sha256": "
|
|
18
|
-
"bytes":
|
|
17
|
+
"sha256": "f58ae0da8526ff0351855e519b876be54ff04e79064bc4da23ecef6c3e4e474e",
|
|
18
|
+
"bytes": 9847358
|
|
19
19
|
},
|
|
20
20
|
"kit.css": {
|
|
21
21
|
"sha256": "13b14f71fb6ea024945f95cba617b4f1d49f44a65ba7c7ed05d2354805539ef6",
|
|
@@ -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{splitMarkerProps as d}from"../lib/wuiMarker.js";import f from"./AppAvatar.js";import p from"./AppButton.js";import m from"./AppIcon.js";import h from"./AppNavigationMenu.js";import g from"./assertValidValue.js";import _ from"./warnUnknownProps.js";import{initScrollEdges as v,revealActiveNavItem as y}from"@webority/ui-elements/helpers";import{useEffect as b,useId as x,useMemo as S,useRef as C,useState as w}from"react";import{Fragment as T,jsx as E,jsxs as D}from"react/jsx-runtime";var O=()=>import(`@webority/ui-elements/elements/overflow`),k=99,A=4,j=5,M=/^[a-z0-9-]+$/,N=`wui-sidebar-footer`,P=[],F=[`prefix`,`exact`],I=[`comfortable`,`compact`],L=[`neutral`,`primary`],R=[`side`,`top`],z=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],B=/* @__PURE__ */ new Set([`key`,`label`,`icon`,`iconVariant`,`iconSize`,`href`,`badge`,`badgeTone`,`badgeTitle`,`newUntil`,`trailingIcon`,`active`,`match`,`matchAlso`,`tab`,`tabLabel`,`children`]),V=e=>e>k?`${k}+`:String(e),H=new Intl.DateTimeFormat(`en-CA`,{timeZone:`Asia/Kolkata`}),ee=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:H.format(/* @__PURE__ */ new Date)<=e},te=({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(` `)},ne=({logoLight:e,logoDark:t,markLight:n,markDark:r,brandName:i})=>{let a=i??``,o=[e&&/* @__PURE__ */ E(`img`,{className:`wui-brand-logo wui-brand-light`,src:e,alt:a},`logo-light`),t&&/* @__PURE__ */ E(`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__ */ E(`img`,{className:n,src:r,alt:a},t):/* @__PURE__ */ E(`img`,{className:n,src:r,alt:``,"aria-hidden":`true`},t));return[...o,...s].filter(Boolean)};function re(e){let{marker:t,props:n}=d(`AppShell`,e),{groups:r=[],brand:l,logoLight:u,logoDark:f,markLight:p,markDark:x,brandName:O,brandHref:k,brandLabel:A,sidebarStart:j,sidebarStartCompact:M,sidebarFooter:N,sidebarFooterItems:F=P,topbarStart:B,topbarEnd:V,footer:H,launcher:ee,children:re,collapsed:U,onCollapsedChange:W,noSidebar:G=!1,nav:K=`side`,density:ae=`comfortable`,itemHeight:q,iconVariant:J=`twotone`,topbarTone:he=`neutral`,navLabel:ge=`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(_(`AppShell`,Xe),g(`AppShell`,`density`,ae,I),g(`AppShell`,`topbarTone`,he,L),g(`AppShell`,`nav`,K,R),g(`AppShell`,`iconVariant`,J,z),A!==void 0&&!k)throw Error(`<AppShell> brandLabel names the brand link, so it needs brandHref.`);if(k){if(!A&&!O)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||f||p||x))throw Error(`<AppShell> brandHref has no brand, logo or mark to link.`)}let Ze=(q??0)>0?{...Ye,"--wui-nav-item-height":`${q}px`}:Ye,[Qe,$e]=w(()=>ve&&U===void 0&&typeof document<`u`?o(ye)??!1:!1),[X,Z]=w(!1),[et,tt]=w(!1),[nt,rt]=w(!1),it=C(null),Q=U??Qe,at=e=>k?/* @__PURE__ */ E(ce,{href:k,label:A||O,linkComponent:Y,onNavigate:()=>Z(!1),children:e}):e,ot=()=>{let e=!Q;U===void 0&&$e(e),ve&&c(e,ye),W?.(e)},st=r.some(e=>e.collapsible),[ct,lt]=w(()=>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=S(()=>ie(r,F,_e),[r,F,_e]),$=dt.groups,ft=dt.footer,pt=G?null:oe($,ft.some(e=>e.active));b(()=>{let e=()=>tt(window.scrollY>4);return e(),window.addEventListener(`scroll`,e,{passive:!0}),()=>window.removeEventListener(`scroll`,e)},[]),b(()=>{v()},[]),b(()=>{y(it.current)},[]),b(()=>{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()},[$]),b(()=>{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`:``,G?`no-sidebar`:``,K===`top`?`wui-shell-top`:``,X?`mobile-open`:``,Je].filter(Boolean).join(` `);return/* @__PURE__ */ D(`div`,{className:mt,"data-density":ae===`compact`?`compact`:void 0,"data-wui-folded-cookie":st?be:void 0,style:Ze,...t,...Xe,children:[/* @__PURE__ */ E(`a`,{className:`wui-skip-link`,href:`#main-content`,children:Ce}),/* @__PURE__ */ D(`aside`,{className:`app-sidebar`,children:[(l||u||f||p||x)&&/* @__PURE__ */ E(`div`,{className:te({logoLight:u,logoDark:f,markLight:p,markDark:x}),children:at(/* @__PURE__ */ D(T,{children:[ne({logoLight:u,logoDark:f,markLight:p,markDark:x,brandName:O}),l]}))}),j&&/* @__PURE__ */ E(`div`,{className:`app-sidebar-start`,children:j}),M&&/* @__PURE__ */ E(`div`,{className:`app-sidebar-start-compact`,children:M}),/* @__PURE__ */ E(`nav`,{className:`app-sidebar-scroll`,"aria-label":ge,ref:it,tabIndex:nt?0:void 0,children:$.map((e,t)=>{let n=e.items.map(e=>e.header==null?/* @__PURE__ */ E(de,{item:e,linkComponent:Y,onNavigate:()=>Z(!1),iconVariant:J,newLabel:Oe,togglePagesLabel:ke},e.key??e.href??e.label):/* @__PURE__ */ E(`div`,{className:`wui-nav-header`,children:e.header},e.key??e.header));if(!e.collapsible)return/* @__PURE__ */ D(`div`,{className:`app-nav-group`,children:[e.label&&/* @__PURE__ */ E(`div`,{className:`app-nav-group-label`,children:e.label}),n,e.after&&/* @__PURE__ */ E(`div`,{className:`wui-nav-group-after`,children:e.after})]},e.key??e.label??`group-${t}`);let r=!ct.has(e.key??``)||!!ue(e.items),i=`wui-nav-group-${e.key}`;return/* @__PURE__ */ D(`div`,{className:`app-nav-group wui-nav-group-collapsible${r?``:` wui-nav-group-folded`}`,"data-wui-nav-group":e.key,children:[/* @__PURE__ */ D(`button`,{type:`button`,className:`app-nav-group-label wui-nav-group-toggle`,"aria-expanded":r,"aria-controls":i,onClick:()=>ut(e.key??``),children:[/* @__PURE__ */ E(`span`,{className:`wui-nav-group-text`,children:e.label}),/* @__PURE__ */ E(`span`,{className:`wui-nav-group-caret`,children:/* @__PURE__ */ E(m,{name:`chevron-down`,size:16})})]}),/* @__PURE__ */ D(`div`,{className:`wui-nav-group-body`,id:i,children:[n,e.after&&/* @__PURE__ */ E(`div`,{className:`wui-nav-group-after`,children:e.after})]})]},e.key??`group-${t}`)})}),(N||ft.length>0)&&/* @__PURE__ */ D(`div`,{className:`app-sidebar-foot`,children:[ft.length>0&&/* @__PURE__ */ E(`div`,{className:`wui-sidebar-foot-links`,children:ft.map(e=>/* @__PURE__ */ E(de,{item:e,linkComponent:Y,onNavigate:()=>Z(!1),iconVariant:J,newLabel:Oe,togglePagesLabel:ke},e.key??e.href??e.label))}),N]}),!G&&/* @__PURE__ */ E(`button`,{type:`button`,className:`app-sidebar-toggle`,onClick:ot,"aria-label":Q?Ee:De,"aria-expanded":!Q,children:/* @__PURE__ */ E(m,{name:`chevrons-left`,size:20})})]}),/* @__PURE__ */ D(`div`,{className:`app-main`,children:[/* @__PURE__ */ D(`header`,{className:`app-topbar${et?` scrolled`:``}`,"data-tone":he===`primary`?`primary`:void 0,children:[/* @__PURE__ */ D(`div`,{className:`app-topbar-start`,children:[/* @__PURE__ */ E(`button`,{type:`button`,className:`app-topbar-menu`,onClick:()=>Z(!0),"aria-label":we,"aria-expanded":X,children:/* @__PURE__ */ E(m,{name:`menu`,size:18})}),K===`top`&&l&&/* @__PURE__ */ E(`div`,{className:`wui-shell-top-brand`,children:at(l)}),K===`top`&&/* @__PURE__ */ E(`div`,{className:`wui-shell-top-nav`,children:/* @__PURE__ */ E(h,{items:se($),ariaLabel:ge,linkComponent:Y})}),B,qe&&/* @__PURE__ */ E(me,{config:qe,searchResultsLabel:Be,noResultsText:Ve,noResultsForText:He,resultsCountText:Ue,resultCountText:We,moreLabel:Se})]}),/* @__PURE__ */ D(`div`,{className:`app-topbar-end`,children:[V,Ke&&/* @__PURE__ */ E(pe,{config:Ke,unreadLabel:Ne,markAllReadLabel:Pe,viewAllLabel:Fe,loadingNotificationsText:Ie,noUnreadText:Le,unreadNotificationsText:Re,unreadBellLabel:ze}),Ge&&/* @__PURE__ */ E(fe,{config:Ge,linkComponent:Y,accountMenuLabel:Ae,roleLabel:je,rolesLabel:Me})]})]}),/* @__PURE__ */ E(`main`,{className:`app-content`,id:`main-content`,children:re}),H&&/* @__PURE__ */ E(`footer`,{className:`app-footer`,children:H})]}),ee&&/* @__PURE__ */ E(`div`,{className:`wui-shell-launcher`,children:ee}),pt&&/* @__PURE__ */ D(`nav`,{className:`wui-tabbar`,"aria-label":xe,children:[pt.tabs.map(e=>/* @__PURE__ */ E(le,{tab:e,linkComponent:Y,iconVariant:J},e.key??e.href)),pt.hasMore&&/* @__PURE__ */ D(`button`,{type:`button`,className:`wui-tabbar-item${pt.moreActive?` active`:``}`,onClick:()=>Z(!0),children:[/* @__PURE__ */ E(`span`,{className:`wui-tabbar-icon`,children:/* @__PURE__ */ E(m,{name:`more`,size:24})}),/* @__PURE__ */ E(`span`,{className:`wui-tabbar-label`,children:Se})]})]}),/* @__PURE__ */ E(`button`,{type:`button`,className:`app-scrim`,onClick:()=>Z(!1),"aria-label":Te,tabIndex:X?0:-1})]})}function ie(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&&ae(t);let a=(e,t=!1)=>(e??[]).map(e=>Array.isArray(e.children)?{...e,children:a(e.children)}:{...e}).filter(e=>W(e)?t:(e.children?.length??0)>0||!!e.href),o=[...e,{key:N,items:t}].map(e=>({...e,items:G(a(e.items,!0))})).filter(e=>e.items.some(e=>!W(e))),s=[],c=e=>{for(let t of e)W(t)||(s.push(t),t.children&&c(t.children))};for(let e of o)c(e.items);for(let e of s)_(`AppShell items`,U(e)),g(`AppShell`,`match`,e.match,F),g(`AppShell`,`iconVariant`,e.iconVariant,z);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!==N),footer:o.find(e=>e.key===N)?.items??[]}}function U(e){return Object.fromEntries(Object.entries(e).filter(([e])=>!B.has(e)))}var W=e=>e.header!=null;function G(e){return e.filter((t,n)=>{if(!W(t))return!0;let r=e.findIndex((e,t)=>t>n&&W(e));return e.slice(n+1,r<0?void 0:r).length>0})}var K=/* @__PURE__ */ new Set;function ae(t){if(t.key!=null&&M.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 oe(e,t){let n=[],r=e=>{for(let t of e)W(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?A:j;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 se(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=>W(e)?[]:[...e.href?[{...r(e,e.href),icon:e.icon}]:[],...i(e.children??[])]),a=[];for(let o of e.flatMap(e=>e.items)){if(W(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 ce({href:e,label:t,linkComponent:r,onNavigate:i,children:a}){return/* @__PURE__ */ E(l,{link:n(r,{to:e}),className:`wui-brand-link`,"aria-label":t,onClick:i,children:a})}function le({tab:e,linkComponent:t,iconVariant:r}){let i=`wui-tabbar-item${e.active?` active`:``}`,a=/* @__PURE__ */ D(T,{children:[e.icon&&/* @__PURE__ */ E(`span`,{className:`wui-tabbar-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ E(m,{name:e.icon,size:24,variant:e.iconVariant??r}):e.icon}),/* @__PURE__ */ E(`span`,{className:`wui-tabbar-label`,children:e.tabLabel??e.label}),e.badge!=null&&/* @__PURE__ */ E(`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__ */ E(l,{link:n(t,{to:e.href}),className:i,"aria-current":o,children:a})}function ue(e){for(let t of e){if(t.active)return t;let e=t.children?.length?ue(t.children):void 0;if(e)return e}}function de({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?ue(e.children??[]):void 0,h=!!p,g=p?p.key??p.href??p.label:null,[_,v]=w(h);b(()=>{g!=null&&v(!0)},[g]);let y=typeof e.label==`string`?e.label:void 0,x=!u&&e.icon&&/* @__PURE__ */ E(`span`,{className:`app-nav-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ E(m,{name:e.icon,size:e.iconSize??22,variant:e.iconVariant??o}):e.icon}),S=e.badge!=null&&/* @__PURE__ */ E(`span`,{className:`app-nav-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:e.badge}),C=ee(e.newUntil)&&/* @__PURE__ */ E(`span`,{className:`wui-nav-new`,children:s}),O=/* @__PURE__ */ D(T,{children:[x,/* @__PURE__ */ E(`span`,{className:`app-nav-text`,children:e.label}),C,S,e.trailingIcon&&/* @__PURE__ */ E(`span`,{className:`app-nav-trailing`,children:typeof e.trailingIcon==`string`?/* @__PURE__ */ E(m,{name:e.trailingIcon,size:16}):e.trailingIcon})]}),k=e.active?`page`:void 0;if(f){let f=/* @__PURE__ */ E(`div`,{className:`app-nav-sub${_?` expanded`:``}`,inert:!_,"aria-hidden":!_||void 0,children:/* @__PURE__ */ E(`div`,{className:`app-nav-sub-inner`,children:(e.children??[]).map(e=>/* @__PURE__ */ E(de,{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__ */ E(l,{link:n(r,{to:e.href}),className:`wui-nav-split-link`,"aria-current":k,onClick:i,children:O});return/* @__PURE__ */ D(T,{children:[/* @__PURE__ */ D(`div`,{className:`app-nav-item has-children wui-nav-split${u?` app-nav-subitem`:``}${h||e.active?` active`:``}${d}`,"data-label":y,children:[a,/* @__PURE__ */ E(`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__ */ E(m,{name:`chevron-right`,size:16})})]}),f]})}return/* @__PURE__ */ D(T,{children:[/* @__PURE__ */ D(`button`,{type:`button`,className:`app-nav-item${u?` app-nav-subitem`:``} has-children${h?` active`:``}${d}`,"aria-expanded":_,"data-label":y,onClick:()=>v(e=>!e),children:[x,/* @__PURE__ */ E(`span`,{className:`app-nav-text`,children:e.label}),C,S,/* @__PURE__ */ E(`span`,{className:`app-nav-caret`,children:/* @__PURE__ */ E(m,{name:`chevron-right`,size:16})})]}),f]})}let A=`app-nav-item${u?` app-nav-subitem`:``}${e.active?` active`:``}${d}`;return/* @__PURE__ */ E(l,{link:n(r,{to:e.href}),className:A,"aria-current":k,"data-label":y,onClick:i,children:O})}function q(){let[e,t]=w(!1),n=C(null);return b(()=>{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 fe({config:e,linkComponent:r,accountMenuLabel:i,roleLabel:a,rolesLabel:o}){let s=x(),{open:c,setOpen:u,ref:d}=q(),{name:h,role:_,roles:v=[],noTriggerRole:y=!1,photo:b,profileHref:S,profileLabel:C=`My profile`,onLogout:w,logoutAction:O,logoutLabel:k=`Sign out`,head:A,section:j,logoutVariant:M=`item`,items:N=[]}=e;if(g(`AppShell`,`userMenu.logoutVariant`,M,[`item`,`button`]),!h)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__ */ E(l,{link:n(r,{to:e}),className:`dropdown-item`,onClick:a,children:t},i),L=/* @__PURE__ */ E(m,{name:`log-out`,size:18}),R=/* @__PURE__ */ D(T,{children:[L,k]});return/* @__PURE__ */ D(`div`,{className:`dropdown wui-usermenu`,ref:d,children:[/* @__PURE__ */ D(`button`,{type:`button`,id:s,className:`wui-usermenu-trigger`,"aria-expanded":c,"aria-label":t(i,{name:h}),onClick:()=>u(e=>!e),children:[/* @__PURE__ */ E(f,{name:h,src:b,tone:`auto`}),/* @__PURE__ */ D(`span`,{className:`wui-usermenu-text`,children:[/* @__PURE__ */ E(`span`,{className:`wui-usermenu-name`,children:h}),_&&!y&&/* @__PURE__ */ E(`span`,{className:`wui-usermenu-role`,children:_})]}),/* @__PURE__ */ E(m,{name:`chevron-down`,size:14,className:`wui-usermenu-caret`})]}),/* @__PURE__ */ D(`div`,{className:`dropdown-menu dropdown-menu-end wui-usermenu-menu${c?` show`:``}`,"aria-labelledby":s,"data-bs-popper":c?`static`:void 0,children:[/* @__PURE__ */ D(`div`,{className:`wui-usermenu-head`,children:[/* @__PURE__ */ E(f,{name:h,src:b,size:`lg`,tone:`auto`}),/* @__PURE__ */ D(`div`,{className:`wui-usermenu-who`,children:[/* @__PURE__ */ E(`div`,{className:`wui-usermenu-name`,children:h}),_&&/* @__PURE__ */ E(`div`,{className:`wui-usermenu-role`,children:_}),P.length>0&&/* @__PURE__ */ D(`div`,{className:`wui-usermenu-roles`,children:[/* @__PURE__ */ E(`span`,{className:`wui-usermenu-roles-label`,children:P.length===1?a:o}),` ${P.join(`, `)}`]}),A?/* @__PURE__ */ E(`div`,{className:`wui-usermenu-extra`,children:A}):null]})]}),j?/* @__PURE__ */ E(`div`,{className:`wui-usermenu-section`,children:j}):null,S&&I(S,/* @__PURE__ */ D(T,{children:[/* @__PURE__ */ E(m,{name:`user`,size:18}),C]}),void 0,F),N.map(e=>{if(e.divider)return/* @__PURE__ */ E(`hr`,{className:`dropdown-divider`},e.key);let t=/* @__PURE__ */ D(T,{children:[e.icon&&/* @__PURE__ */ E(m,{name:e.icon,size:18}),e.label]}),n=()=>{e.onClick?.(),F()};return e.href?I(e.href,t,e.key,n):/* @__PURE__ */ E(`button`,{type:`button`,className:`dropdown-item`,onClick:n,children:t},e.key)}),M===`button`?(O||w)&&/* @__PURE__ */ E(`div`,{className:`wui-usermenu-foot`,children:O?/* @__PURE__ */ E(`form`,{method:`post`,action:O,className:`wui-usermenu-logout`,children:/* @__PURE__ */ E(p,{type:`submit`,tone:`danger`,variant:`soft`,block:!0,leftIcon:L,children:k})}):/* @__PURE__ */ E(p,{type:`button`,tone:`danger`,variant:`soft`,block:!0,leftIcon:L,onClick:()=>{F(),w?.()},children:k})}):O?/* @__PURE__ */ E(`form`,{method:`post`,action:O,className:`wui-usermenu-logout`,children:/* @__PURE__ */ E(`button`,{type:`submit`,className:`dropdown-item danger`,children:R})}):w&&/* @__PURE__ */ E(`button`,{type:`button`,className:`dropdown-item danger`,onClick:()=>{F(),w()},children:R})]})]})}function pe({config:e,unreadLabel:n,markAllReadLabel:r,viewAllLabel:i,loadingNotificationsText:a,noUnreadText:o,unreadNotificationsText:s,unreadBellLabel:c}){let l=x(),{open:u,setOpen:d,ref:f}=q(),{unread:p=0,items:h,loading:g=!1,onOpen:_,onMarkAllRead:v,viewAllHref:y,label:S=`Notifications`,emptyText:O=`You are all caught up.`}=e,[k,A]=w(``),j=C(p);b(()=>{j.current!==p&&(j.current=p,A(p===0?o:t(s,{count:V(p)})))},[p,o,s]);let M=null;return h?.length?M=/* @__PURE__ */ E(`div`,{className:`wui-bell-items`,children:h.map((e,t)=>{let r=`wui-bell-item${e.read?` wui-bell-item-read`:``}`,i=/* @__PURE__ */ D(T,{children:[/* @__PURE__ */ E(`span`,{className:`wui-bell-dot`,"aria-hidden":`true`}),e.icon&&/* @__PURE__ */ E(`span`,{className:`wui-bell-icon`,children:/* @__PURE__ */ E(m,{name:e.icon,size:18})}),/* @__PURE__ */ D(`span`,{className:`wui-bell-body`,children:[!e.read&&/* @__PURE__ */ D(`span`,{className:`visually-hidden`,children:[n,`: `]}),/* @__PURE__ */ E(`span`,{className:`wui-bell-item-title`,children:e.title}),e.time&&/* @__PURE__ */ E(`span`,{className:`wui-bell-when`,children:e.time})]})]});return e.href?/* @__PURE__ */ E(`a`,{className:r,href:e.href,"data-id":e.id,children:i},e.id??t):/* @__PURE__ */ E(`div`,{className:r,"data-id":e.id,children:i},e.id??t)})}):g?M=/* @__PURE__ */ E(`div`,{className:`wui-bell-state`,children:a}):h&&(M=/* @__PURE__ */ E(`div`,{className:`wui-bell-state`,children:O})),/* @__PURE__ */ D(`div`,{className:`dropdown wui-bell`,ref:f,children:[/* @__PURE__ */ D(`button`,{type:`button`,id:l,className:`topbar-icon-btn wui-bell-trigger`,"aria-expanded":u,"aria-label":p===0?S:t(c,{label:S,count:V(p)}),onClick:()=>{let e=!u;d(e),e&&_?.()},children:[/* @__PURE__ */ E(m,{name:`notification`,size:20}),/* @__PURE__ */ E(`span`,{className:`wui-bell-count`,"aria-hidden":`true`,hidden:p===0,children:V(p)})]}),/* @__PURE__ */ E(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:k}),/* @__PURE__ */ D(`div`,{className:`dropdown-menu dropdown-menu-end wui-bell-menu${u?` show`:``}`,"aria-labelledby":l,"data-bs-popper":u?`static`:void 0,children:[/* @__PURE__ */ D(`div`,{className:`wui-bell-head`,children:[/* @__PURE__ */ E(`span`,{className:`wui-bell-title`,children:S}),v&&/* @__PURE__ */ E(`button`,{type:`button`,className:`wui-bell-markall`,onClick:v,children:r})]}),/* @__PURE__ */ E(`div`,{className:`wui-bell-list`,"aria-busy":g||void 0,children:M}),y&&/* @__PURE__ */ E(`a`,{className:`wui-bell-foot`,href:y,children:i})]})]})}var J=e=>!!e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName));function me({config:e,searchResultsLabel:n,noResultsText:r,noResultsForText:i,resultsCountText:a,resultCountText:o,moreLabel:s}){u(`wui-overflow`,O);let c=x(),{value:l=``,onChange:d,results:f=null,loading:p=!1,onSelect:h,onSubmit:g,onFocus:_,placeholder:v=`Search`}=e,[y,T]=w(!1),[k,A]=w(!1),[j,M]=w({results:null,index:-1}),N=j.results===f?j.index:-1,P=e=>M({results:f,index:e}),F=C(null),I=C(null),L=C([]),R=S(()=>(f??[]).flatMap(e=>e.hits??[]),[f]),z=f!=null&&!k,B=R.length;b(()=>{let e=e=>{e.key!==`/`||e.ctrlKey||e.metaKey||e.altKey||J(e.target instanceof HTMLElement?e.target:null)||(e.preventDefault(),T(!0),I.current?.focus())},t=e=>{F.current?.contains(e.target instanceof Node?e.target:null)||(A(!0),T(!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(),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(),T(!1)))},H=-1;return L.current=[],/* @__PURE__ */ E(`wui-overflow`,{class:`wui-topsearch-host`,label:s,children:/* @__PURE__ */ E(`div`,{"data-wui-overflow-list":!0,className:`wui-topsearch-row`,children:/* @__PURE__ */ D(`div`,{className:`wui-topsearch${y?` is-open`:``}${p?` is-loading`:``}`,ref:F,"data-overflow-label":v,children:[/* @__PURE__ */ E(`button`,{type:`button`,className:`topbar-icon-btn wui-topsearch-open`,"aria-label":v,"aria-expanded":y,"aria-controls":`${c}-panel`,onClick:()=>{let e=!y;T(e),e&&I.current?.focus()},children:/* @__PURE__ */ E(m,{name:`search`,size:20})}),/* @__PURE__ */ D(`div`,{className:`wui-topsearch-panel`,id:`${c}-panel`,children:[/* @__PURE__ */ D(`div`,{className:`search-wrap`,children:[/* @__PURE__ */ E(m,{name:`search`,size:18,className:`search-icon`}),/* @__PURE__ */ E(`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:V,onFocus:_})]}),/* @__PURE__ */ E(`div`,{className:`wui-topsearch-results`,id:`${c}-list`,role:`listbox`,"aria-label":n,hidden:!z,children:z&&/* @__PURE__ */ D(`div`,{className:`wui-topsearch-groups`,role:`presentation`,children:[B===0&&/* @__PURE__ */ E(`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__ */ D(`div`,{className:`wui-topsearch-group`,role:`group`,"aria-label":e.label??``,children:[e.label&&/* @__PURE__ */ E(`div`,{className:`wui-topsearch-group-label`,role:`presentation`,children:e.label}),e.hits.map(e=>{H+=1;let t=H;return/* @__PURE__ */ D(`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=>h?.(e,t),children:[e.icon&&/* @__PURE__ */ E(`span`,{className:`wui-topsearch-hit-icon`,children:/* @__PURE__ */ E(m,{name:e.icon,size:18})}),/* @__PURE__ */ D(`span`,{className:`wui-topsearch-hit-text`,children:[/* @__PURE__ */ E(`span`,{className:`wui-topsearch-hit-title`,children:e.title}),e.subtitle&&/* @__PURE__ */ E(`span`,{className:`wui-topsearch-hit-sub`,children:e.subtitle})]})]},`${e.href}-${t}`)})]},e.label??t))]})})]}),/* @__PURE__ */ E(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:z?B===0?r:t(B===1?o:a,{count:B}):``})]})})})}export{re 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,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};
|
package/dist/guidance.json
CHANGED
package/dist/lib/svgNodes.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createElement as e}from"react";function t
|
|
1
|
+
import{createElement as e}from"react";var t=[`g`,`path`,`rect`,`circle`,`ellipse`,`line`,`polyline`,`polygon`,`defs`,`linearGradient`,`stop`,`text`];function n(t){return t.map(([t,r,i],a)=>e(t,{key:a,...r},typeof i==`string`?i:i?n(i):void 0))}new Set(t);export{n as renderSvgNodes};
|
|
@@ -13,7 +13,7 @@ export interface AppContextMenuItem {
|
|
|
13
13
|
shortcut?: string | undefined;
|
|
14
14
|
checked?: boolean | undefined;
|
|
15
15
|
to?: string | undefined;
|
|
16
|
-
onClick?: (() => void) | undefined;
|
|
16
|
+
onClick?: ((event: React.MouseEvent<HTMLElement>) => void) | undefined;
|
|
17
17
|
tone?: "danger" | undefined;
|
|
18
18
|
disabled?: boolean | undefined;
|
|
19
19
|
divider?: boolean | undefined;
|
|
@@ -8,7 +8,7 @@ export interface AppDropdownItem {
|
|
|
8
8
|
image?: string | undefined;
|
|
9
9
|
to?: string | undefined;
|
|
10
10
|
href?: string | undefined;
|
|
11
|
-
onClick?: (() => void) | undefined;
|
|
11
|
+
onClick?: ((event: React.MouseEvent<HTMLElement>) => void) | undefined;
|
|
12
12
|
tone?: "danger" | undefined;
|
|
13
13
|
disabled?: boolean | undefined;
|
|
14
14
|
disabledReason?: string | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ComponentPropsWithoutRef, type JSX } from "react";
|
|
1
|
+
import { type ComponentPropsWithoutRef, type JSX, type ReactNode } from "react";
|
|
2
2
|
import { type AppLinkComponent } from "../lib/linkTarget.ts";
|
|
3
3
|
/**
|
|
4
4
|
* `to` is an in-app route for the file viewer page, routed through linkComponent; url stays a plain link.
|
|
@@ -16,7 +16,7 @@ interface AppFileAttachmentBaseProps extends Omit<ComponentPropsWithoutRef<"inpu
|
|
|
16
16
|
* The label shown above the field.
|
|
17
17
|
* @default "Attachment"
|
|
18
18
|
*/
|
|
19
|
-
label?:
|
|
19
|
+
label?: ReactNode | undefined;
|
|
20
20
|
/** Form field name, so an uncontrolled form can post the file. */
|
|
21
21
|
name?: string | undefined;
|
|
22
22
|
/** The file types the field takes, as an accept list. Defaults to images; pass for example image/*,application/pdf for mixed. An empty string accepts any file type, and the format line then names no types. */
|
|
@@ -113,7 +113,7 @@ export type AppFileAttachmentProps = AppFileAttachmentSingleProps | AppFileAttac
|
|
|
113
113
|
* to something (a ticket, a message) where the file's name/size matters more than a big preview.
|
|
114
114
|
*
|
|
115
115
|
* @param props
|
|
116
|
-
* @param [props.label]
|
|
116
|
+
* @param [props.label] The field label: text, or text with a node such as a required marker. Default "Attachment".
|
|
117
117
|
* @param [props.value]
|
|
118
118
|
* @param [props.name]
|
|
119
119
|
* @param props.onChange single-mode → File|null; multiple → File[]
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type * as React from "react";
|
|
2
2
|
import { type AppLinkComponent } from "../lib/linkTarget.ts";
|
|
3
|
+
import type { AppBadgeProps } from "./AppBadge.tsx";
|
|
3
4
|
import { type IconVariant } from "./AppIcon.tsx";
|
|
4
5
|
export interface NavItemShape {
|
|
5
6
|
key?: string | undefined;
|
|
@@ -18,8 +19,8 @@ export interface NavItemShape {
|
|
|
18
19
|
href?: string | undefined;
|
|
19
20
|
/** A count or short status at the row's end. */
|
|
20
21
|
badge?: React.ReactNode | undefined;
|
|
21
|
-
/** Tints the badge
|
|
22
|
-
badgeTone?: "
|
|
22
|
+
/** Tints the badge, in the AppBadge tone set: a red alert count, a primary count. */
|
|
23
|
+
badgeTone?: AppBadgeProps["tone"];
|
|
23
24
|
/** The badge's hover text, e.g. 3 invoices overdue. */
|
|
24
25
|
badgeTitle?: string | undefined;
|
|
25
26
|
/** An ISO date (yyyy-MM-dd, India time). A green "New" pill shows after the label through that day, and none after it. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
1
|
+
import type { ComponentPropsWithoutRef, MouseEvent, ReactNode } from "react";
|
|
2
2
|
import type { AppLinkComponent } from "../lib/linkTarget.ts";
|
|
3
3
|
export interface AppSplitButtonItem {
|
|
4
4
|
key: string;
|
|
@@ -6,7 +6,7 @@ export interface AppSplitButtonItem {
|
|
|
6
6
|
icon?: string | ReactNode | undefined;
|
|
7
7
|
image?: string | undefined;
|
|
8
8
|
to?: string | undefined;
|
|
9
|
-
onClick?: (() => void) | undefined;
|
|
9
|
+
onClick?: ((event: MouseEvent<HTMLElement>) => void) | undefined;
|
|
10
10
|
tone?: "danger" | undefined;
|
|
11
11
|
shortcut?: string | undefined;
|
|
12
12
|
divider?: boolean | undefined;
|
|
@@ -20,7 +20,7 @@ export interface AppSplitButtonProps extends Omit<ComponentPropsWithoutRef<"div"
|
|
|
20
20
|
*/
|
|
21
21
|
items?: AppSplitButtonItem[] | undefined;
|
|
22
22
|
/** Called when the main button is pressed. */
|
|
23
|
-
onClick?: (() => void) | undefined;
|
|
23
|
+
onClick?: ((event: MouseEvent<HTMLElement>) => void) | undefined;
|
|
24
24
|
/** Makes the main button a link. */
|
|
25
25
|
href?: string | undefined;
|
|
26
26
|
/**
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { ComponentPropsWithoutRef } from "react";
|
|
2
|
+
import type { AppBadgeProps } from "./AppBadge.tsx";
|
|
2
3
|
export type AppTreeViewSelection = "none" | "single" | "multiple";
|
|
3
4
|
export type AppTreeViewNode = {
|
|
4
5
|
id: string;
|
|
5
6
|
label: string;
|
|
6
7
|
icon?: string | undefined;
|
|
7
8
|
badge?: string | undefined;
|
|
8
|
-
badgeTone?: "
|
|
9
|
+
badgeTone?: AppBadgeProps["tone"];
|
|
9
10
|
children?: AppTreeViewNode[] | undefined;
|
|
10
11
|
hasChildren?: boolean | undefined;
|
|
11
12
|
expanded?: boolean | undefined;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
|
|
3
|
-
export type
|
|
2
|
+
declare const SVG_TAGS: readonly ["g", "path", "rect", "circle", "ellipse", "line", "polyline", "polygon", "defs", "linearGradient", "stop", "text"];
|
|
3
|
+
export type SvgTag = (typeof SVG_TAGS)[number];
|
|
4
|
+
export type SvgNode = readonly [tag: Exclude<SvgTag, "text">, attrs: Readonly<Record<string, string>>, children?: readonly SvgNode[]] | readonly [tag: "text", attrs: Readonly<Record<string, string>>, content?: string];
|
|
4
5
|
export declare function renderSvgNodes(nodes: readonly SvgNode[]): ReactNode[];
|
|
6
|
+
export declare function svgNodesOf(value: unknown): readonly SvgNode[];
|
|
7
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webority/ui-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.160.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,10 +29,10 @@
|
|
|
29
29
|
},
|
|
30
30
|
"sideEffects": false,
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@webority/markdown-core": "0.
|
|
33
|
-
"@webority/theme": "0.
|
|
34
|
-
"@webority/ui-elements": "0.
|
|
35
|
-
"@webority/web-core": "0.
|
|
32
|
+
"@webority/markdown-core": "0.160.0",
|
|
33
|
+
"@webority/theme": "0.160.0",
|
|
34
|
+
"@webority/ui-elements": "0.160.0",
|
|
35
|
+
"@webority/web-core": "0.160.0"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"@webority/analytics": "^0.40.0",
|
|
@@ -51,10 +51,10 @@
|
|
|
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.
|
|
55
|
-
"@webority/canvas-kit": "0.
|
|
56
|
-
"@webority/biome-config": "0.
|
|
57
|
-
"@webority/tokens": "0.
|
|
54
|
+
"@webority/analytics": "0.40.2",
|
|
55
|
+
"@webority/canvas-kit": "0.160.0",
|
|
56
|
+
"@webority/biome-config": "0.160.0",
|
|
57
|
+
"@webority/tokens": "0.160.0",
|
|
58
58
|
"bootstrap": "5.3.8",
|
|
59
59
|
"jsdom": "30.1.1",
|
|
60
60
|
"react": "^19.3.1",
|