@webority/ui-react 0.174.1 → 0.175.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 +96 -96
- package/dist/canvas-kit/manifest.json +133 -1
- package/dist/canvas-kit/release.json +6 -6
- package/dist/components/AppAlert.js +1 -1
- package/dist/components/AppAvatar.js +1 -1
- package/dist/components/AppCalendar.js +1 -1
- package/dist/components/AppChart.js +1 -1
- package/dist/components/AppCheckbox.js +1 -1
- package/dist/components/AppChip.js +1 -1
- package/dist/components/AppChoiceCard.js +1 -1
- package/dist/components/AppCommentThread.js +1 -1
- package/dist/components/AppConfirmDialog.js +1 -1
- package/dist/components/AppConfirmProvider.js +1 -1
- package/dist/components/AppContextMenu.js +1 -1
- package/dist/components/AppDatePicker.js +1 -1
- package/dist/components/AppDateRangePicker.js +1 -1
- package/dist/components/AppDateTimePicker.js +1 -1
- package/dist/components/AppDropdown.js +1 -1
- package/dist/components/AppFileAttachment.js +1 -1
- package/dist/components/AppFilePicker.js +1 -1
- package/dist/components/AppFileViewer.js +1 -1
- package/dist/components/AppForm.js +1 -1
- package/dist/components/AppImagePicker.js +1 -1
- package/dist/components/AppInput.js +1 -1
- package/dist/components/AppLeadPopup.js +1 -1
- package/dist/components/AppLightbox.js +1 -1
- package/dist/components/AppLink.js +1 -1
- package/dist/components/AppMentionInput.js +1 -1
- package/dist/components/AppMonthPicker.js +1 -1
- package/dist/components/AppNumberInput.js +1 -1
- package/dist/components/AppOtpInput.js +1 -1
- package/dist/components/AppPageHeader.js +1 -1
- package/dist/components/AppPhoneNumberInput.js +1 -1
- package/dist/components/AppQueryBuilder.js +1 -1
- package/dist/components/AppRadio.js +1 -1
- package/dist/components/AppRichText.js +1 -1
- package/dist/components/AppSelect.js +1 -1
- package/dist/components/AppShell.js +1 -1
- package/dist/components/AppSlider.js +1 -1
- package/dist/components/AppSortableList.js +1 -1
- package/dist/components/AppSwitch.js +1 -1
- package/dist/components/AppTabs.js +1 -1
- package/dist/components/AppTextarea.js +1 -1
- package/dist/components/AppTimePicker.js +1 -1
- package/dist/components/AppTour.js +1 -1
- package/dist/components/AppTransferList.js +1 -1
- package/dist/components/AppTreePicker.js +1 -1
- package/dist/components/AppTreeView.js +1 -1
- package/dist/components/AppWhatsNew.js +1 -1
- package/dist/components/AppWizard.js +1 -1
- package/dist/components/AppWorkspaceSwitcher.js +1 -1
- package/dist/components/AppYearPicker.js +1 -1
- package/dist/components/toast.js +1 -1
- package/dist/guidance.json +1 -1
- package/dist/lib/CheckField.js +1 -1
- package/dist/lib/FileItemRow.js +1 -1
- package/dist/types/components/AppCalendar.d.ts +50 -2
- package/dist/types/components/AppChart.d.ts +3 -2
- package/dist/types/components/AppCheckbox.d.ts +4 -2
- package/dist/types/components/AppChoiceCard.d.ts +4 -0
- package/dist/types/components/AppCompareTable.d.ts +2 -2
- package/dist/types/components/AppConfirmDialog.d.ts +4 -0
- package/dist/types/components/AppContextMenu.d.ts +2 -0
- package/dist/types/components/AppCopyButton.d.ts +1 -1
- package/dist/types/components/AppDatePicker.d.ts +2 -1
- package/dist/types/components/AppDateRangePicker.d.ts +4 -1
- package/dist/types/components/AppDateTimePicker.d.ts +2 -1
- package/dist/types/components/AppDropdown.d.ts +2 -0
- package/dist/types/components/AppFileViewer.d.ts +50 -2
- package/dist/types/components/AppForm.d.ts +2 -2
- package/dist/types/components/AppFormSection.d.ts +2 -2
- package/dist/types/components/AppInput.d.ts +13 -1
- package/dist/types/components/AppLeadPopup.d.ts +2 -1
- package/dist/types/components/AppLightbox.d.ts +2 -0
- package/dist/types/components/AppMentionInput.d.ts +3 -1
- package/dist/types/components/AppMonthPicker.d.ts +2 -1
- package/dist/types/components/AppNumberInput.d.ts +4 -2
- package/dist/types/components/AppOtpInput.d.ts +17 -2
- package/dist/types/components/AppPhoneNumberInput.d.ts +7 -2
- package/dist/types/components/AppQueryBuilder.d.ts +3 -2
- package/dist/types/components/AppRadio.d.ts +11 -2
- package/dist/types/components/AppResult.d.ts +2 -2
- package/dist/types/components/AppRichText.d.ts +3 -2
- package/dist/types/components/AppRouteError.d.ts +2 -2
- package/dist/types/components/AppSelect.d.ts +3 -1
- package/dist/types/components/AppShell.d.ts +16 -0
- package/dist/types/components/AppSlider.d.ts +4 -2
- package/dist/types/components/AppSortableList.d.ts +4 -2
- package/dist/types/components/AppSwitch.d.ts +3 -2
- package/dist/types/components/AppTextarea.d.ts +3 -2
- package/dist/types/components/AppTimePicker.d.ts +19 -2
- package/dist/types/components/AppTour.d.ts +28 -2
- package/dist/types/components/AppTransferList.d.ts +4 -2
- package/dist/types/components/AppTreePicker.d.ts +3 -2
- package/dist/types/components/AppTreeView.d.ts +4 -2
- package/dist/types/components/AppWhatsNew.d.ts +2 -0
- package/dist/types/components/AppWizard.d.ts +16 -2
- package/dist/types/components/AppYearPicker.d.ts +3 -1
- package/dist/types/components/toast.d.ts +46 -4
- package/dist/types/lib/CheckField.d.ts +2 -1
- package/dist/types/lib/formFields.d.ts +2 -1
- package/package.json +8 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
import{devWarn as e}from"../lib/devWarn.js";import{linkTarget as t}from"../lib/linkTarget.js";import{navMatchScore as n}from"../lib/navMatch.js";import{SHELL_FOLDED_COOKIE as r,readNavFolded as i,readShellCollapsed as a,writeNavFolded as o,writeShellCollapsed as s}from"../lib/shellCookie.js";import{TargetLink as c}from"../lib/TargetLink.js";import l from"../lib/useElementEntry.js";import u from"../lib/useWuiText.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{IST_TIME_ZONE as y,initScrollEdges as b,isImeSafeEnter as x,revealActiveNavItem as S,setPopoverOpen as C}from"@webority/ui-elements/helpers";import{useEffect as w,useId as T,useMemo as E,useRef as D,useState as O}from"react";import{Fragment as k,jsx as A,jsxs as j}from"react/jsx-runtime";import{SHELL_TEXT as M,fillText as N}from"@webority/ui-elements/text";var P=()=>import(`@webority/ui-elements/elements/overflow`),F=()=>import(`@webority/ui-elements/elements/dropdown`),I=99,L=4,R=5,z=/^[a-z0-9-]+$/,B=`wui-sidebar-footer`,V=[],H=[`prefix`,`exact`],U=[`comfortable`,`compact`],W=[`neutral`,`primary`],ee=[`default`,`brand`],te=[`side`,`top`],ne=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],re=/* @__PURE__ */ new Set([`key`,`label`,`icon`,`iconVariant`,`iconSize`,`href`,`badge`,`badgeTone`,`badgeTitle`,`newUntil`,`trailingIcon`,`active`,`match`,`matchAlso`,`tab`,`tabLabel`,`children`,`header`,`description`]),G=e=>e>I?`${I}+`:String(e),K=new Intl.DateTimeFormat(`en-CA`,{timeZone:y}),ie=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:K.format(/* @__PURE__ */ new Date)<=e},ae=({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(` `)},oe=({logoLight:e,logoDark:t,markLight:n,markDark:r,brandName:i})=>{let a=i??``,o=[e&&/* @__PURE__ */ A(`img`,{className:`wui-brand-logo wui-brand-light`,src:e,alt:a},`logo-light`),t&&/* @__PURE__ */ A(`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__ */ A(`img`,{className:n,src:r,alt:a},t):/* @__PURE__ */ A(`img`,{className:n,src:r,alt:``,"aria-hidden":`true`},t));return[...o,...s].filter(Boolean)};function q(e){let{marker:t,props:n}=f(`AppShell`,e),c=u(`shell`,M),{groups:l=[],brand:d,logoLight:p,logoDark:m,markLight:y,markDark:x,brandName:T,brandHref:N,brandLabel:P,sidebarStart:F,sidebarStartCompact:I,sidebarFooter:L,sidebarFooterItems:R=V,topbarStart:z,topbarEnd:B,footer:H,launcher:re,children:G,collapsed:K,onCollapsedChange:ie,noSidebar:q=!1,nav:J=`side`,topNavDetail:Y=!1,capBadges:ce=!1,density:le=`comfortable`,itemHeight:ue,iconVariant:X=`twotone`,topbarTone:_e=`neutral`,tone:be=`default`,navLabel:Se=c.navLabel,linkComponent:Z,currentPath:Ce,rememberCollapsed:we=!1,collapsedCookie:Te=`wui-shell-collapsed`,foldedCookie:Ee=r,tabBarLabel:De=c.tabBarLabel,moreLabel:Oe=c.moreLabel,skipLabel:ke=c.skipLabel,openNavLabel:Ae=c.openNavLabel,expandNavLabel:je=c.expandNavLabel,collapseNavLabel:Me=c.collapseNavLabel,newLabel:Ne=c.newLabel,togglePagesLabel:Pe=c.togglePagesLabel,accountMenuLabel:Fe=c.accountMenuLabel,roleLabel:Ie=c.roleLabel,rolesLabel:Le=c.rolesLabel,unreadLabel:Re=c.unreadLabel,markAllReadLabel:ze=c.markAllReadLabel,viewAllLabel:Be=c.viewAllLabel,loadingNotificationsText:Ve=c.loadingNotificationsText,noUnreadText:He=c.noUnreadText,unreadNotificationsText:Ue=c.unreadNotificationsText,unreadBellLabel:We=c.unreadBellLabel,searchResultsLabel:Ge=c.searchResultsLabel,noResultsText:Ke=c.noResultsText,noResultsForText:qe=c.noResultsForText,resultsCountText:Je=c.resultsCountText,resultCountText:Ye=c.resultCountText,userMenu:Xe,notifications:Ze,search:Qe,className:$e=``,style:et,...tt}=n;if(v(`AppShell`,tt),_(`AppShell`,`density`,le,U),_(`AppShell`,`topbarTone`,_e,W),_(`AppShell`,`tone`,be,ee),_(`AppShell`,`nav`,J,te),_(`AppShell`,`iconVariant`,X,ne),P!==void 0&&!N)throw Error(`<AppShell> brandLabel names the brand link, so it needs brandHref.`);if(N){if(!P&&!T)throw Error(`<AppShell> brandHref needs brandLabel or brandName: the collapsed rail hides the logo, so the link would have no accessible name.`);if(!(d||p||m||y||x))throw Error(`<AppShell> brandHref has no brand, logo or mark to link.`)}let nt=(ue??0)>0?{...et,"--wui-nav-item-height":`${ue}px`}:et,[rt,it]=O(()=>we&&K===void 0&&typeof document<`u`?a(Te)??!1:!1),[at,Q]=O(!1),ot=D(null),[st,ct]=O(!1),[lt,ut]=O(!1),dt=D(null),ft=K??rt,pt=e=>N?/* @__PURE__ */ A(pe,{href:N,label:P||T,linkComponent:Z,onNavigate:()=>Q(!1),children:e}):e,mt=()=>{let e=!ft;K===void 0&&it(e),we&&s(e,Te),ie?.(e)},ht=l.some(e=>e.collapsible),[gt,_t]=O(()=>ht&&typeof document<`u`?i(Ee):/* @__PURE__ */ new Set),vt=e=>{let t=new Set(gt);t.has(e)?t.delete(e):t.add(e),_t(t),o(t,Ee)},yt=E(()=>se(l,R,Ce),[l,R,Ce]),$=yt.groups,bt=yt.footer,xt=q?null:de($,bt.some(e=>e.active));w(()=>{let e=()=>ct(window.scrollY>4);return e(),window.addEventListener(`scroll`,e,{passive:!0}),()=>window.removeEventListener(`scroll`,e)},[]),w(()=>{b()},[]),w(()=>{S(dt.current)},[]),w(()=>{let e=dt.current;if(!e)return;let t=()=>ut($.length>0&&e.scrollHeight>e.clientHeight);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[$]),w(()=>{let e=ot.current;if(!e)return;let t=window.matchMedia(`(max-width: 991.98px)`),n=()=>{t.matches?e.setAttribute(`popover`,`auto`):(e.removeAttribute(`popover`),Q(!1))},r=e=>Q(`newState`in e&&e.newState===`open`);return n(),t.addEventListener(`change`,n),e.addEventListener(`toggle`,r),()=>{t.removeEventListener(`change`,n),e.removeEventListener(`toggle`,r)}},[]),w(()=>{let e=ot.current;e?.hasAttribute(`popover`)&&C(e,at)},[at]);let St=[`app-shell`,ft?`collapsed`:``,q?`no-sidebar`:``,J===`top`?`wui-shell-top`:``,at?`mobile-open`:``,$e].filter(Boolean).join(` `);return/* @__PURE__ */ j(`div`,{className:St,"data-density":le===`compact`?`compact`:void 0,"data-shell-tone":be===`brand`?`brand`:void 0,"data-wui-folded-cookie":ht?Ee:void 0,style:nt,...t,...tt,children:[/* @__PURE__ */ A(`a`,{className:`wui-skip-link`,href:`#main-content`,children:ke}),/* @__PURE__ */ j(`aside`,{className:`app-sidebar`,ref:ot,children:[(d||p||m||y||x)&&/* @__PURE__ */ A(`div`,{className:ae({logoLight:p,logoDark:m,markLight:y,markDark:x}),children:pt(/* @__PURE__ */ j(k,{children:[oe({logoLight:p,logoDark:m,markLight:y,markDark:x,brandName:T}),d]}))}),F&&/* @__PURE__ */ A(`div`,{className:`app-sidebar-start`,children:F}),I&&/* @__PURE__ */ A(`div`,{className:`app-sidebar-start-compact`,children:I}),/* @__PURE__ */ A(`nav`,{className:`app-sidebar-scroll`,"aria-label":Se,ref:dt,tabIndex:lt?0:void 0,children:$.map((e,t)=>{let n=e.items.map(e=>e.header==null?/* @__PURE__ */ A(ge,{item:e,linkComponent:Z,onNavigate:()=>Q(!1),iconVariant:X,newLabel:Ne,togglePagesLabel:Pe,capBadges:ce},e.key??e.href??e.label):/* @__PURE__ */ A(`div`,{className:`wui-nav-header`,children:e.header},e.key??e.header));if(!e.collapsible)return/* @__PURE__ */ j(`div`,{className:`app-nav-group`,children:[e.label&&/* @__PURE__ */ A(`div`,{className:`app-nav-group-label`,children:e.label}),n,e.after&&/* @__PURE__ */ A(`div`,{className:`wui-nav-group-after`,children:e.after})]},e.key??e.label??`group-${t}`);let r=!gt.has(e.key??``)||!!he(e.items),i=`wui-nav-group-${e.key}`;return/* @__PURE__ */ j(`div`,{className:`app-nav-group wui-nav-group-collapsible${r?``:` wui-nav-group-folded`}`,"data-wui-nav-group":e.key,children:[/* @__PURE__ */ j(`button`,{type:`button`,className:`app-nav-group-label wui-nav-group-toggle`,"aria-expanded":r,"aria-controls":i,onClick:()=>vt(e.key??``),children:[/* @__PURE__ */ A(`span`,{className:`wui-nav-group-text`,children:e.label}),/* @__PURE__ */ A(`span`,{className:`wui-nav-group-caret`,children:/* @__PURE__ */ A(h,{name:`chevron-down`,size:16})})]}),/* @__PURE__ */ j(`div`,{className:`wui-nav-group-body`,id:i,children:[n,e.after&&/* @__PURE__ */ A(`div`,{className:`wui-nav-group-after`,children:e.after})]})]},e.key??`group-${t}`)})}),(L||bt.length>0)&&/* @__PURE__ */ j(`div`,{className:`app-sidebar-foot`,children:[bt.length>0&&/* @__PURE__ */ A(`div`,{className:`wui-sidebar-foot-links`,children:bt.map(e=>/* @__PURE__ */ A(ge,{item:e,linkComponent:Z,onNavigate:()=>Q(!1),iconVariant:X,newLabel:Ne,togglePagesLabel:Pe,capBadges:ce},e.key??e.href??e.label))}),L]}),!q&&/* @__PURE__ */ A(`button`,{type:`button`,className:`app-sidebar-toggle`,onClick:mt,"aria-label":ft?je:Me,"aria-expanded":!ft,children:/* @__PURE__ */ A(h,{name:`chevrons-left`,size:20})})]}),/* @__PURE__ */ j(`div`,{className:`app-main`,children:[/* @__PURE__ */ j(`header`,{className:`app-topbar${st?` wui-scrolled`:``}`,"data-tone":_e===`primary`?`primary`:void 0,children:[/* @__PURE__ */ j(`div`,{className:`app-topbar-start`,children:[/* @__PURE__ */ A(`button`,{type:`button`,className:`app-topbar-menu`,onClick:()=>Q(!0),"aria-label":Ae,"aria-expanded":at,children:/* @__PURE__ */ A(h,{name:`menu`,size:18})}),J===`top`&&d&&/* @__PURE__ */ A(`div`,{className:`wui-shell-top-brand`,children:pt(d)}),J===`top`&&/* @__PURE__ */ A(`div`,{className:`wui-shell-top-nav`,children:/* @__PURE__ */ A(g,{items:fe($,Y),ariaLabel:Se,linkComponent:Z})}),z,Qe&&/* @__PURE__ */ A(xe,{config:Qe,searchResultsLabel:Ge,noResultsText:Ke,noResultsForText:qe,resultsCountText:Je,resultCountText:Ye,moreLabel:Oe})]}),/* @__PURE__ */ j(`div`,{className:`app-topbar-end`,children:[B,Ze&&/* @__PURE__ */ A(ye,{config:Ze,unreadLabel:Re,markAllReadLabel:ze,viewAllLabel:Be,loadingNotificationsText:Ve,noUnreadText:He,unreadNotificationsText:Ue,unreadBellLabel:We}),Xe&&/* @__PURE__ */ A(ve,{config:Xe,linkComponent:Z,accountMenuLabel:Fe,roleLabel:Ie,rolesLabel:Le})]})]}),/* @__PURE__ */ A(`main`,{className:`app-content`,id:`main-content`,children:G}),H&&/* @__PURE__ */ A(`footer`,{className:`app-footer`,children:H})]}),re&&/* @__PURE__ */ A(`div`,{className:`wui-shell-launcher`,children:re}),xt&&/* @__PURE__ */ j(`nav`,{className:`wui-tabbar`,"aria-label":De,children:[xt.tabs.map(e=>/* @__PURE__ */ A(me,{tab:e,linkComponent:Z,iconVariant:X,capBadges:ce},e.key??e.href)),xt.hasMore&&/* @__PURE__ */ j(`button`,{type:`button`,className:`wui-tabbar-item${xt.moreActive?` active`:``}`,onClick:()=>Q(!0),children:[/* @__PURE__ */ A(`span`,{className:`wui-tabbar-icon`,children:/* @__PURE__ */ A(h,{name:`more`,size:24})}),/* @__PURE__ */ A(`span`,{className:`wui-tabbar-label`,children:Oe})]})]})]})}function se(e,t,r){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&&ue(t);let a=(e,t=!1)=>(e??[]).map(e=>Array.isArray(e.children)?{...e,children:a(e.children)}:{...e}).filter(e=>Y(e)?t:(e.children?.length??0)>0||!!e.href),o=[...e,{key:B,items:t}].map(e=>({...e,items:ce(a(e.items,!0))})).filter(e=>e.items.some(e=>!Y(e))),s=[],c=e=>{for(let t of e)Y(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`,J(e)),_(`AppShell`,`match`,e.match,H),_(`AppShell`,`iconVariant`,e.iconVariant,ne),_(`AppShell`,`badgeTone`,e.badgeTone,d);let l=null;if(r!=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=n(r,t.href,{exact:t.match===`exact`,also:t.matchAlso});if(i<0)continue;let a=t.match===`exact`&&n(r,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!==B),footer:o.find(e=>e.key===B)?.items??[]}}function J(e){return Object.fromEntries(Object.entries(e).filter(([e])=>!re.has(e)))}var Y=e=>e.header!=null;function ce(e){return e.filter((t,n)=>{if(!Y(t))return!0;let r=e.findIndex((e,t)=>t>n&&Y(e));return e.slice(n+1,r<0?void 0:r).length>0})}var le=/* @__PURE__ */ new Set;function ue(t){if(t.key!=null&&z.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`||le.has(n)||(le.add(n),e(n))}function de(e,t){let n=[],r=e=>{for(let t of e)Y(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?L:R;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 fe(e,t){let n=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},r=e=>e.key??e.href??n(e),i=(e,i)=>({key:r(e),label:n(e),to:i,current:!!e.active,...t&&e.description?{description:e.description}:{}}),a=e=>e.flatMap(e=>Y(e)?[]:[...e.href?[{...i(e,e.href),icon:e.icon}]:[],...a(e.children??[])]),o=[];for(let s of e)for(let e of s.items){if(Y(e))continue;let c=t&&s.label?{group:s.label}:{},l=a(e.children??[]);if(l.length>0){let a=e.href?[{...i(e,e.href),icon:e.icon}]:[],s=t&&(!!e.active||!!he(e.children??[]));o.push({key:r(e),label:n(e),links:[...a,...l],...c,...t?{current:s}:{}})}else e.href&&o.push({...i(e,e.href),...c})}return o}function X(e,t){return t&&typeof e==`number`&&e>I?`${I}+`:e}function pe({href:e,label:n,linkComponent:r,onNavigate:i,children:a}){return/* @__PURE__ */ A(c,{link:t(r,{to:e}),className:`wui-brand-link`,"aria-label":n,onClick:i,children:a})}function me({tab:e,linkComponent:n,iconVariant:r,capBadges:i}){let a=`wui-tabbar-item${e.active?` active`:``}`,o=/* @__PURE__ */ j(k,{children:[e.icon&&/* @__PURE__ */ A(`span`,{className:`wui-tabbar-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ A(h,{name:e.icon,size:24,variant:e.iconVariant??r}):e.icon}),/* @__PURE__ */ A(`span`,{className:`wui-tabbar-label`,children:e.tabLabel??e.label}),e.badge!=null&&/* @__PURE__ */ A(`span`,{className:`wui-tabbar-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:X(e.badge,i)})]}),s=e.active?`page`:void 0;return/* @__PURE__ */ A(c,{link:t(n,{to:e.href}),className:a,"aria-current":s,children:o})}function he(e){for(let t of e){if(t.active)return t;let e=t.children?.length?he(t.children):void 0;if(e)return e}}function ge({item:e,linkComponent:n,onNavigate:r,depth:i=0,iconVariant:a,newLabel:o,togglePagesLabel:s,capBadges:l}){let u=i>0,d=i>1?` wui-nav-depth-${Math.min(i,6)}`:``,f=Array.isArray(e.children)&&e.children.length>0,p=f?he(e.children??[]):void 0,m=!!p,g=p?p.key??p.href??p.label:null,[_,v]=O(m);w(()=>{g!=null&&v(!0)},[g]);let y=typeof e.label==`string`?e.label:void 0,b=!u&&e.icon&&/* @__PURE__ */ A(`span`,{className:`app-nav-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ A(h,{name:e.icon,size:e.iconSize??22,variant:e.iconVariant??a}):e.icon}),x=e.badge!=null&&/* @__PURE__ */ A(`span`,{className:`app-nav-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:X(e.badge,l)}),S=ie(e.newUntil)&&/* @__PURE__ */ A(`span`,{className:`wui-nav-new`,children:o}),C=/* @__PURE__ */ j(k,{children:[b,/* @__PURE__ */ A(`span`,{className:`app-nav-text`,children:e.label}),S,x,e.trailingIcon&&/* @__PURE__ */ A(`span`,{className:`app-nav-trailing`,children:typeof e.trailingIcon==`string`?/* @__PURE__ */ A(h,{name:e.trailingIcon,size:16}):e.trailingIcon})]}),T=e.active?`page`:void 0;if(f){let f=/* @__PURE__ */ A(`div`,{className:`app-nav-sub${_?` expanded`:``}`,inert:!_,"aria-hidden":!_||void 0,children:/* @__PURE__ */ A(`div`,{className:`app-nav-sub-inner`,children:(e.children??[]).map(e=>/* @__PURE__ */ A(ge,{item:e,linkComponent:n,onNavigate:r,depth:i+1,iconVariant:a,newLabel:o,togglePagesLabel:s,capBadges:l},e.key??e.href))})});if(e.href){let i=/* @__PURE__ */ A(c,{link:t(n,{to:e.href}),className:`wui-nav-split-link`,"aria-current":T,onClick:r,children:C});return/* @__PURE__ */ j(k,{children:[/* @__PURE__ */ j(`div`,{className:`app-nav-item has-children wui-nav-split${u?` app-nav-subitem`:``}${m||e.active?` active`:``}${d}`,"data-label":y,children:[i,/* @__PURE__ */ A(`button`,{type:`button`,className:`app-nav-caret wui-nav-split-toggle`,"aria-expanded":_,"aria-label":N(s,{name:y??``}),onClick:()=>v(e=>!e),children:/* @__PURE__ */ A(h,{name:`chevron-right`,size:16})})]}),f]})}return/* @__PURE__ */ j(k,{children:[/* @__PURE__ */ j(`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__ */ A(`span`,{className:`app-nav-text`,children:e.label}),S,x,/* @__PURE__ */ A(`span`,{className:`app-nav-caret`,children:/* @__PURE__ */ A(h,{name:`chevron-right`,size:16})})]}),f]})}let E=`app-nav-item${u?` app-nav-subitem`:``}${e.active?` active`:``}${d}`;return/* @__PURE__ */ A(c,{link:t(n,{to:e.href}),className:E,"aria-current":T,"data-label":y,onClick:r,children:C})}function _e(e){l(`wui-dropdown`,F);let[t,n]=O(!1),r=D(null);return w(()=>{r.current?.toggleAttribute(`open`,t)},[t]),w(()=>{let t=r.current;if(!t)return;let i=r=>{if(r.target!==t||!(`detail`in r)||!r.detail||typeof r.detail!=`object`)return;let i=`open`in r.detail&&r.detail.open===!0;n(i),i&&e?.()};return t.addEventListener(`wui-dropdown-toggle`,i),()=>t.removeEventListener(`wui-dropdown-toggle`,i)},[e]),{open:t,setOpen:n,ref:r}}function ve({config:e,linkComponent:n,accountMenuLabel:r,roleLabel:i,rolesLabel:a}){let o=u(`shell`,M),s=T(),{open:l,setOpen:d,ref:f}=_e(),{name:g,role:v,roles:y=[],noTriggerRole:b=!1,outlined:x=!1,photo:S,profileHref:C,profileLabel:w=o.profileLabel,onLogout:E,logoutAction:D,logoutLabel:O=o.logoutLabel,head:P,section:F,logoutVariant:I=`item`,items:L=[]}=e;if(_(`AppShell`,`userMenu.logoutVariant`,I,[`item`,`button`]),!g)throw Error(`<AppShell> userMenu.name is required; the trigger and the avatar are named from it.`);let R=y.map(e=>(e??``).trim()).filter(Boolean),z=()=>d(!1),B=(e,r,i,a)=>/* @__PURE__ */ A(c,{link:t(n,{to:e}),className:`dropdown-item`,onClick:a,children:r},i),V=/* @__PURE__ */ A(h,{name:`log-out`,size:18}),H=/* @__PURE__ */ j(k,{children:[V,O]});return/* @__PURE__ */ j(`wui-dropdown`,{class:`dropdown wui-usermenu`,align:`end`,ref:f,children:[/* @__PURE__ */ j(`button`,{type:`button`,id:s,className:x?`wui-usermenu-trigger wui-usermenu-trigger-outlined`:`wui-usermenu-trigger`,"data-wui-dropdown-trigger":!0,"aria-expanded":l,"aria-label":N(r,{name:g}),children:[/* @__PURE__ */ A(p,{name:g,src:S,tone:`auto`}),/* @__PURE__ */ j(`span`,{className:`wui-usermenu-text`,children:[/* @__PURE__ */ A(`span`,{className:`wui-usermenu-name`,children:g}),v&&!b&&/* @__PURE__ */ A(`span`,{className:`wui-usermenu-role`,children:v})]}),/* @__PURE__ */ A(h,{name:`chevron-down`,size:14,className:`wui-usermenu-caret`})]}),/* @__PURE__ */ j(`div`,{"data-wui-dropdown-menu":!0,popover:`auto`,className:`dropdown-menu dropdown-menu-end wui-usermenu-menu${l?` show`:``}`,"aria-labelledby":s,children:[/* @__PURE__ */ j(`div`,{className:`wui-usermenu-head`,children:[/* @__PURE__ */ A(p,{name:g,src:S,size:`lg`,tone:`auto`}),/* @__PURE__ */ j(`div`,{className:`wui-usermenu-who`,children:[/* @__PURE__ */ A(`div`,{className:`wui-usermenu-name`,children:g}),v&&/* @__PURE__ */ A(`div`,{className:`wui-usermenu-role`,children:v}),R.length>0&&/* @__PURE__ */ j(`div`,{className:`wui-usermenu-roles`,children:[/* @__PURE__ */ A(`span`,{className:`wui-usermenu-roles-label`,children:R.length===1?i:a}),` ${R.join(`, `)}`]}),P?/* @__PURE__ */ A(`div`,{className:`wui-usermenu-extra`,children:P}):null]})]}),F?/* @__PURE__ */ A(`div`,{className:`wui-usermenu-section`,children:F}):null,C&&B(C,/* @__PURE__ */ j(k,{children:[/* @__PURE__ */ A(h,{name:`user`,size:18}),w]}),void 0,z),L.map(e=>{if(e.divider)return/* @__PURE__ */ A(`hr`,{className:`dropdown-divider`},e.key);let t=/* @__PURE__ */ j(k,{children:[e.icon&&/* @__PURE__ */ A(h,{name:e.icon,size:18}),e.label]}),n=()=>{e.onClick?.(),z()};return e.href?B(e.href,t,e.key,n):/* @__PURE__ */ A(`button`,{type:`button`,className:`dropdown-item`,onClick:n,children:t},e.key)}),I===`button`?(D||E)&&/* @__PURE__ */ A(`div`,{className:`wui-usermenu-foot`,children:D?/* @__PURE__ */ A(`form`,{method:`post`,action:D,className:`wui-usermenu-logout`,children:/* @__PURE__ */ A(m,{type:`submit`,tone:`danger`,variant:`soft`,block:!0,leftIcon:V,children:O})}):/* @__PURE__ */ A(m,{type:`button`,tone:`danger`,variant:`soft`,block:!0,leftIcon:V,onClick:()=>{z(),E?.()},children:O})}):D?/* @__PURE__ */ A(`form`,{method:`post`,action:D,className:`wui-usermenu-logout`,children:/* @__PURE__ */ A(`button`,{type:`submit`,className:`dropdown-item danger`,children:H})}):E&&/* @__PURE__ */ A(`button`,{type:`button`,className:`dropdown-item danger`,onClick:()=>{z(),E()},children:H})]})]})}function ye({config:e,unreadLabel:t,markAllReadLabel:n,viewAllLabel:r,loadingNotificationsText:i,noUnreadText:a,unreadNotificationsText:o,unreadBellLabel:s}){let c=u(`shell`,M),l=T(),{open:d,ref:f}=_e(e.onOpen),{unread:p=0,items:m,loading:g=!1,onMarkAllRead:_,viewAllHref:v,label:y=c.label,emptyText:b=c.emptyText}=e,[x,S]=O(``),C=D(p);w(()=>{C.current!==p&&(C.current=p,S(p===0?a:N(o,{count:G(p)})))},[p,a,o]);let E=null;return m?.length?E=/* @__PURE__ */ A(`div`,{className:`wui-bell-items`,children:m.map((e,n)=>{let r=`wui-bell-item${e.read?` wui-bell-item-read`:``}`,i=/* @__PURE__ */ j(k,{children:[/* @__PURE__ */ A(`span`,{className:`wui-bell-dot`,"aria-hidden":`true`}),e.icon&&/* @__PURE__ */ A(`span`,{className:`wui-bell-icon`,children:/* @__PURE__ */ A(h,{name:e.icon,size:18})}),/* @__PURE__ */ j(`span`,{className:`wui-bell-body`,children:[!e.read&&/* @__PURE__ */ j(`span`,{className:`visually-hidden`,children:[t,`: `]}),/* @__PURE__ */ A(`span`,{className:`wui-bell-item-title`,children:e.title}),e.time&&/* @__PURE__ */ A(`span`,{className:`wui-bell-when`,children:e.time})]})]});return e.href?/* @__PURE__ */ A(`a`,{className:r,href:e.href,"data-id":e.id,children:i},e.id??n):/* @__PURE__ */ A(`div`,{className:r,"data-id":e.id,children:i},e.id??n)})}):g?E=/* @__PURE__ */ A(`div`,{className:`wui-bell-state`,children:i}):m&&(E=/* @__PURE__ */ A(`div`,{className:`wui-bell-state`,children:b})),/* @__PURE__ */ j(`wui-dropdown`,{class:`dropdown wui-bell`,align:`end`,ref:f,children:[/* @__PURE__ */ j(`button`,{type:`button`,id:l,className:`topbar-icon-btn wui-bell-trigger`,"data-wui-dropdown-trigger":!0,"aria-expanded":d,"aria-label":p===0?y:N(s,{label:y,count:G(p)}),children:[/* @__PURE__ */ A(h,{name:`notification`,size:20}),/* @__PURE__ */ A(`span`,{className:`wui-bell-count`,"aria-hidden":`true`,hidden:p===0,children:G(p)})]}),/* @__PURE__ */ A(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:x}),/* @__PURE__ */ j(`div`,{"data-wui-dropdown-menu":!0,popover:`auto`,className:`dropdown-menu dropdown-menu-end wui-bell-menu${d?` show`:``}`,"aria-labelledby":l,children:[/* @__PURE__ */ j(`div`,{className:`wui-bell-head`,children:[/* @__PURE__ */ A(`span`,{className:`wui-bell-title`,children:y}),_&&/* @__PURE__ */ A(`button`,{type:`button`,className:`wui-bell-markall`,onClick:_,children:n})]}),/* @__PURE__ */ A(`div`,{className:`wui-bell-list`,"aria-busy":g||void 0,children:E}),v&&/* @__PURE__ */ A(`a`,{className:`wui-bell-foot`,href:v,children:r})]})]})}var be=e=>!!e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName));function xe({config:e,searchResultsLabel:t,noResultsText:n,noResultsForText:r,resultsCountText:i,resultCountText:a,moreLabel:o}){l(`wui-overflow`,P);let s=u(`shell`,M),c=T(),{value:d=``,onChange:f,results:p=null,loading:m=!1,onSelect:g,onSubmit:_,onFocus:v,placeholder:y=s.placeholder}=e,[b,S]=O(!1),[C,k]=O(!1),[F,I]=O({results:null,index:-1}),L=F.results===p?F.index:-1,R=e=>I({results:p,index:e}),z=D(null),B=D(null),V=D([]),H=E(()=>(p??[]).flatMap(e=>e.hits??[]),[p]),U=p!=null&&!C,W=H.length;w(()=>{let e=e=>{e.key!==`/`||e.ctrlKey||e.metaKey||e.altKey||be(e.target instanceof HTMLElement?e.target:null)||(e.preventDefault(),S(!0),B.current?.focus())},t=e=>{z.current?.contains(e.target instanceof Node?e.target:null)||(k(!0),S(!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(!U||W===0)return;e.preventDefault(),R((L+(e.key===`ArrowDown`?1:-1)+W)%W)}else x(e.nativeEvent)?U&&L>=0&&V.current[L]?(e.preventDefault(),V.current[L].click()):_&&d.trim()!==``&&(e.preventDefault(),_(d.trim())):e.key===`Escape`&&(U?(e.preventDefault(),k(!0)):b&&(e.preventDefault(),S(!1)))},te=-1;return V.current=[],/* @__PURE__ */ A(`wui-overflow`,{class:`wui-topsearch-host`,label:o,children:/* @__PURE__ */ A(`div`,{"data-wui-overflow-list":!0,className:`wui-topsearch-row`,children:/* @__PURE__ */ j(`div`,{className:`wui-topsearch${b?` is-open`:``}${m?` is-loading`:``}`,ref:z,"data-overflow-label":y,children:[/* @__PURE__ */ A(`button`,{type:`button`,className:`topbar-icon-btn wui-topsearch-open`,"aria-label":y,"aria-expanded":b,"aria-controls":`${c}-panel`,onClick:()=>{let e=!b;S(e),e&&B.current?.focus()},children:/* @__PURE__ */ A(h,{name:`search`,size:20})}),/* @__PURE__ */ j(`div`,{className:`wui-topsearch-panel`,id:`${c}-panel`,children:[/* @__PURE__ */ j(`div`,{className:`search-wrap`,children:[/* @__PURE__ */ A(h,{name:`search`,size:18,className:`search-icon`}),/* @__PURE__ */ A(`input`,{ref:B,type:`search`,className:`form-control input search-input`,id:`${c}-input`,placeholder:y,"aria-label":y,role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":U,"aria-controls":`${c}-list`,"aria-activedescendant":U&&L>=0?`${c}-opt-${L}`:void 0,autoComplete:`off`,value:d,onChange:e=>{k(!1),f?.(e.target.value)},onKeyDown:ee,onFocus:v})]}),/* @__PURE__ */ A(`div`,{className:`wui-topsearch-results`,id:`${c}-list`,role:`listbox`,"aria-label":t,hidden:!U,children:U&&/* @__PURE__ */ j(`div`,{className:`wui-topsearch-groups`,role:`presentation`,children:[W===0&&/* @__PURE__ */ A(`div`,{className:`wui-topsearch-empty`,role:`option`,"aria-disabled":`true`,"aria-selected":`false`,children:N(r,{value:d})}),p.filter(e=>e.hits?.length).map((e,t)=>/* @__PURE__ */ j(`div`,{className:`wui-topsearch-group`,role:`group`,"aria-label":e.label??``,children:[e.label&&/* @__PURE__ */ A(`div`,{className:`wui-topsearch-group-label`,role:`presentation`,children:e.label}),e.hits.map(e=>{te+=1;let t=te;return/* @__PURE__ */ j(`a`,{className:`wui-topsearch-hit${t===L?` is-active`:``}`,role:`option`,"aria-selected":t===L,id:`${c}-opt-${t}`,href:e.href,ref:e=>{V.current[t]=e},onClick:t=>g?.(e,t),children:[e.icon&&/* @__PURE__ */ A(`span`,{className:`wui-topsearch-hit-icon`,children:/* @__PURE__ */ A(h,{name:e.icon,size:18})}),/* @__PURE__ */ j(`span`,{className:`wui-topsearch-hit-text`,children:[/* @__PURE__ */ A(`span`,{className:`wui-topsearch-hit-title`,children:e.title}),e.subtitle&&/* @__PURE__ */ A(`span`,{className:`wui-topsearch-hit-sub`,children:e.subtitle})]})]},`${e.href}-${t}`)})]},e.label??t))]})})]}),/* @__PURE__ */ A(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:U?W===0?n:N(W===1?a:i,{count:W}):``})]})})})}export{q as default};
|
|
1
|
+
import{devWarn as e}from"../lib/devWarn.js";import{linkTarget as t}from"../lib/linkTarget.js";import{navMatchScore as n}from"../lib/navMatch.js";import{SHELL_FOLDED_COOKIE as r,readNavFolded as i,readShellCollapsed as a,writeNavFolded as o,writeShellCollapsed as s}from"../lib/shellCookie.js";import{TargetLink as c}from"../lib/TargetLink.js";import l from"../lib/useElementEntry.js";import u from"../lib/useWuiText.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{IST_TIME_ZONE as y,initScrollEdges as b,isImeSafeEnter as x,revealActiveNavItem as S,setPopoverOpen as C}from"@webority/ui-elements/helpers";import{useEffect as w,useId as T,useMemo as E,useRef as D,useState as O}from"react";import{Fragment as k,jsx as A,jsxs as j}from"react/jsx-runtime";import{SHELL_TEXT as ee,fillText as M}from"@webority/ui-elements/text";var N=()=>import(`@webority/ui-elements/elements/overflow`),P=()=>import(`@webority/ui-elements/elements/dropdown`),F=99,I=4,L=5,R=/^[a-z0-9-]+$/,z=`wui-sidebar-footer`,B=[],V=[`prefix`,`exact`],H=[`comfortable`,`compact`],U=[`neutral`,`primary`],te=[`default`,`brand`],ne=[`side`,`top`],re=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],ie=/* @__PURE__ */ new Set([`key`,`label`,`icon`,`iconVariant`,`iconSize`,`href`,`badge`,`badgeTone`,`badgeTitle`,`newUntil`,`trailingIcon`,`active`,`match`,`matchAlso`,`tab`,`tabLabel`,`children`,`header`,`description`]),W=e=>e>F?`${F}+`:String(e),ae=new Intl.DateTimeFormat(`en-CA`,{timeZone:y}),oe=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:ae.format(/* @__PURE__ */ new Date)<=e},se=({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(` `)},ce=({logoLight:e,logoDark:t,markLight:n,markDark:r,brandName:i,logoLightWidth:a,logoLightHeight:o,logoDarkWidth:s,logoDarkHeight:c,markLightWidth:l,markLightHeight:u,markDarkWidth:d,markDarkHeight:f})=>{let p=i??``,m=[e&&/* @__PURE__ */ A(`img`,{className:`wui-brand-logo wui-brand-light`,src:e,alt:p,width:a,height:o},`logo-light`),t&&/* @__PURE__ */ A(`img`,{className:`wui-brand-logo wui-brand-dark`,src:t,alt:``,"aria-hidden":`true`,width:s,height:c},`logo-dark`)],h=[n&&[`mark-light`,`wui-brand-mark wui-brand-light`,n,l,u],r&&[`mark-dark`,`wui-brand-mark wui-brand-dark`,r,d,f]].filter(e=>!!e).map(([t,n,r,i,a],o)=>o===0&&!e?/* @__PURE__ */ A(`img`,{className:n,src:r,alt:p,width:i,height:a},t):/* @__PURE__ */ A(`img`,{className:n,src:r,alt:``,"aria-hidden":`true`,width:i,height:a},t));return[...m,...h].filter(Boolean)};function le(e){let{marker:t,props:n}=f(`AppShell`,e),c=u(`shell`,ee),{groups:l=[],brand:d,logoLight:p,logoDark:m,markLight:y,markDark:x,logoLightWidth:T,logoLightHeight:M,logoDarkWidth:N,logoDarkHeight:P,markLightWidth:F,markLightHeight:I,markDarkWidth:L,markDarkHeight:R,brandName:z,brandHref:V,brandLabel:ie,sidebarStart:W,sidebarStartCompact:ae,sidebarFooter:oe,sidebarFooterItems:le=B,topbarStart:de,topbarEnd:G,footer:fe,launcher:K,children:pe,collapsed:q,onCollapsedChange:ye,noSidebar:Y=!1,nav:Ce=`side`,topNavDetail:we=!1,capBadges:Te=!1,density:Ee=`comfortable`,itemHeight:De,iconVariant:Oe=`twotone`,topbarTone:ke=`neutral`,tone:Ae=`default`,navLabel:je=c.navLabel,linkComponent:X,currentPath:Me,rememberCollapsed:Ne=!1,collapsedCookie:Pe=`wui-shell-collapsed`,foldedCookie:Fe=r,tabBarLabel:Ie=c.tabBarLabel,moreLabel:Le=c.moreLabel,skipLabel:Re=c.skipLabel,openNavLabel:ze=c.openNavLabel,expandNavLabel:Be=c.expandNavLabel,collapseNavLabel:Ve=c.collapseNavLabel,newLabel:He=c.newLabel,togglePagesLabel:Ue=c.togglePagesLabel,accountMenuLabel:We=c.accountMenuLabel,roleLabel:Ge=c.roleLabel,rolesLabel:Ke=c.rolesLabel,unreadLabel:qe=c.unreadLabel,markAllReadLabel:Je=c.markAllReadLabel,viewAllLabel:Ye=c.viewAllLabel,loadingNotificationsText:Xe=c.loadingNotificationsText,noUnreadText:Ze=c.noUnreadText,unreadNotificationsText:Qe=c.unreadNotificationsText,unreadBellLabel:$e=c.unreadBellLabel,searchResultsLabel:et=c.searchResultsLabel,noResultsText:tt=c.noResultsText,noResultsForText:nt=c.noResultsForText,resultsCountText:rt=c.resultsCountText,resultCountText:it=c.resultCountText,userMenu:at,notifications:ot,search:st,className:ct=``,style:lt,...ut}=n;if(v(`AppShell`,ut),_(`AppShell`,`density`,Ee,H),_(`AppShell`,`topbarTone`,ke,U),_(`AppShell`,`tone`,Ae,te),_(`AppShell`,`nav`,Ce,ne),_(`AppShell`,`iconVariant`,Oe,re),ie!==void 0&&!V)throw Error(`<AppShell> brandLabel names the brand link, so it needs brandHref.`);if(V){if(!ie&&!z)throw Error(`<AppShell> brandHref needs brandLabel or brandName: the collapsed rail hides the logo, so the link would have no accessible name.`);if(!(d||p||m||y||x))throw Error(`<AppShell> brandHref has no brand, logo or mark to link.`)}let dt=(De??0)>0?{...lt,"--wui-nav-item-height":`${De}px`}:lt,[ft,pt]=O(()=>Ne&&q===void 0&&typeof document<`u`?a(Pe)??!1:!1),[Z,Q]=O(!1),mt=D(null),[ht,gt]=O(!1),[_t,vt]=O(!1),yt=D(null),bt=q??ft,xt=e=>V?/* @__PURE__ */ A(ge,{href:V,label:ie||z,linkComponent:X,onNavigate:()=>Q(!1),children:e}):e,St=()=>{let e=!bt;q===void 0&&pt(e),Ne&&s(e,Pe),ye?.(e)},Ct=l.some(e=>e.collapsible),[wt,Tt]=O(()=>Ct&&typeof document<`u`?i(Fe):/* @__PURE__ */ new Set),Et=e=>{let t=new Set(wt);t.has(e)?t.delete(e):t.add(e),Tt(t),o(t,Fe)},Dt=E(()=>ue(l,le,Me),[l,le,Me]),$=Dt.groups,Ot=Dt.footer,kt=Y?null:me($,Ot.some(e=>e.active));w(()=>{let e=()=>gt(window.scrollY>4);return e(),window.addEventListener(`scroll`,e,{passive:!0}),()=>window.removeEventListener(`scroll`,e)},[]),w(()=>{b()},[]),w(()=>{S(yt.current)},[]),w(()=>{let e=yt.current;if(!e)return;let t=()=>vt($.length>0&&e.scrollHeight>e.clientHeight);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[$]),w(()=>{let e=mt.current;if(!e)return;let t=window.matchMedia(`(max-width: 991.98px)`),n=()=>{t.matches?e.setAttribute(`popover`,`auto`):(e.removeAttribute(`popover`),Q(!1))},r=e=>Q(`newState`in e&&e.newState===`open`);return n(),t.addEventListener(`change`,n),e.addEventListener(`toggle`,r),()=>{t.removeEventListener(`change`,n),e.removeEventListener(`toggle`,r)}},[]),w(()=>{let e=mt.current;e?.hasAttribute(`popover`)&&C(e,Z)},[Z]);let At=[`app-shell`,bt?`collapsed`:``,Y?`no-sidebar`:``,Ce===`top`?`wui-shell-top`:``,Z?`mobile-open`:``,ct].filter(Boolean).join(` `);return/* @__PURE__ */ j(`div`,{className:At,"data-density":Ee===`compact`?`compact`:void 0,"data-shell-tone":Ae===`brand`?`brand`:void 0,"data-wui-folded-cookie":Ct?Fe:void 0,style:dt,...t,...ut,children:[/* @__PURE__ */ A(`a`,{className:`wui-skip-link`,href:`#main-content`,children:Re}),/* @__PURE__ */ j(`aside`,{className:`app-sidebar`,ref:mt,children:[(d||p||m||y||x)&&/* @__PURE__ */ A(`div`,{className:se({logoLight:p,logoDark:m,markLight:y,markDark:x}),children:xt(/* @__PURE__ */ j(k,{children:[ce({logoLight:p,logoDark:m,markLight:y,markDark:x,brandName:z,logoLightWidth:T,logoLightHeight:M,logoDarkWidth:N,logoDarkHeight:P,markLightWidth:F,markLightHeight:I,markDarkWidth:L,markDarkHeight:R}),d]}))}),W&&/* @__PURE__ */ A(`div`,{className:`app-sidebar-start`,children:W}),ae&&/* @__PURE__ */ A(`div`,{className:`app-sidebar-start-compact`,children:ae}),/* @__PURE__ */ A(`nav`,{className:`app-sidebar-scroll`,"aria-label":je,ref:yt,tabIndex:_t?0:void 0,children:$.map((e,t)=>{let n=e.items.map(e=>e.header==null?/* @__PURE__ */ A(ve,{item:e,linkComponent:X,onNavigate:()=>Q(!1),iconVariant:Oe,newLabel:He,togglePagesLabel:Ue,capBadges:Te},e.key??e.href??e.label):/* @__PURE__ */ A(`div`,{className:`wui-nav-header`,children:e.header},e.key??e.header));if(!e.collapsible)return/* @__PURE__ */ j(`div`,{className:`app-nav-group`,children:[e.label&&/* @__PURE__ */ A(`div`,{className:`app-nav-group-label`,children:e.label}),n,e.after&&/* @__PURE__ */ A(`div`,{className:`wui-nav-group-after`,children:e.after})]},e.key??e.label??`group-${t}`);let r=!wt.has(e.key??``)||!!J(e.items),i=`wui-nav-group-${e.key}`;return/* @__PURE__ */ j(`div`,{className:`app-nav-group wui-nav-group-collapsible${r?``:` wui-nav-group-folded`}`,"data-wui-nav-group":e.key,children:[/* @__PURE__ */ j(`button`,{type:`button`,className:`app-nav-group-label wui-nav-group-toggle`,"aria-expanded":r,"aria-controls":i,onClick:()=>Et(e.key??``),children:[/* @__PURE__ */ A(`span`,{className:`wui-nav-group-text`,children:e.label}),/* @__PURE__ */ A(`span`,{className:`wui-nav-group-caret`,children:/* @__PURE__ */ A(h,{name:`chevron-down`,size:16})})]}),/* @__PURE__ */ j(`div`,{className:`wui-nav-group-body`,id:i,children:[n,e.after&&/* @__PURE__ */ A(`div`,{className:`wui-nav-group-after`,children:e.after})]})]},e.key??`group-${t}`)})}),(oe||Ot.length>0)&&/* @__PURE__ */ j(`div`,{className:`app-sidebar-foot`,children:[Ot.length>0&&/* @__PURE__ */ A(`div`,{className:`wui-sidebar-foot-links`,children:Ot.map(e=>/* @__PURE__ */ A(ve,{item:e,linkComponent:X,onNavigate:()=>Q(!1),iconVariant:Oe,newLabel:He,togglePagesLabel:Ue,capBadges:Te},e.key??e.href??e.label))}),oe]}),!Y&&/* @__PURE__ */ A(`button`,{type:`button`,className:`app-sidebar-toggle`,onClick:St,"aria-label":bt?Be:Ve,"aria-expanded":!bt,children:/* @__PURE__ */ A(h,{name:`chevrons-left`,size:20})})]}),/* @__PURE__ */ j(`div`,{className:`app-main`,children:[/* @__PURE__ */ j(`header`,{className:`app-topbar${ht?` wui-scrolled`:``}`,"data-tone":ke===`primary`?`primary`:void 0,children:[/* @__PURE__ */ j(`div`,{className:`app-topbar-start`,children:[/* @__PURE__ */ A(`button`,{type:`button`,className:`app-topbar-menu`,onClick:()=>Q(!0),"aria-label":ze,"aria-expanded":Z,children:/* @__PURE__ */ A(h,{name:`menu`,size:18})}),Ce===`top`&&d&&/* @__PURE__ */ A(`div`,{className:`wui-shell-top-brand`,children:xt(d)}),Ce===`top`&&/* @__PURE__ */ A(`div`,{className:`wui-shell-top-nav`,children:/* @__PURE__ */ A(g,{items:he($,we),ariaLabel:je,linkComponent:X})}),de,st&&/* @__PURE__ */ A(Se,{config:st,searchResultsLabel:et,noResultsText:tt,noResultsForText:nt,resultsCountText:rt,resultCountText:it,moreLabel:Le})]}),/* @__PURE__ */ j(`div`,{className:`app-topbar-end`,children:[G,ot&&/* @__PURE__ */ A(xe,{config:ot,unreadLabel:qe,markAllReadLabel:Je,viewAllLabel:Ye,loadingNotificationsText:Xe,noUnreadText:Ze,unreadNotificationsText:Qe,unreadBellLabel:$e}),at&&/* @__PURE__ */ A(be,{config:at,linkComponent:X,accountMenuLabel:We,roleLabel:Ge,rolesLabel:Ke})]})]}),/* @__PURE__ */ A(`main`,{className:`app-content`,id:`main-content`,children:pe}),fe&&/* @__PURE__ */ A(`footer`,{className:`app-footer`,children:fe})]}),K&&/* @__PURE__ */ A(`div`,{className:`wui-shell-launcher`,children:K}),kt&&/* @__PURE__ */ j(`nav`,{className:`wui-tabbar`,"aria-label":Ie,children:[kt.tabs.map(e=>/* @__PURE__ */ A(_e,{tab:e,linkComponent:X,iconVariant:Oe,capBadges:Te},e.key??e.href)),kt.hasMore&&/* @__PURE__ */ j(`button`,{type:`button`,className:`wui-tabbar-item${kt.moreActive?` active`:``}`,onClick:()=>Q(!0),children:[/* @__PURE__ */ A(`span`,{className:`wui-tabbar-icon`,children:/* @__PURE__ */ A(h,{name:`more`,size:24})}),/* @__PURE__ */ A(`span`,{className:`wui-tabbar-label`,children:Le})]})]})]})}function ue(e,t,r){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&&pe(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:z,items:t}].map(e=>({...e,items:fe(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`,de(e)),_(`AppShell`,`match`,e.match,V),_(`AppShell`,`iconVariant`,e.iconVariant,re),_(`AppShell`,`badgeTone`,e.badgeTone,d);let l=null;if(r!=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=n(r,t.href,{exact:t.match===`exact`,also:t.matchAlso});if(i<0)continue;let a=t.match===`exact`&&n(r,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!==z),footer:o.find(e=>e.key===z)?.items??[]}}function de(e){return Object.fromEntries(Object.entries(e).filter(([e])=>!ie.has(e)))}var G=e=>e.header!=null;function fe(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 pe(t){if(t.key!=null&&R.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 me(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?I:L;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 he(e,t){let n=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},r=e=>e.key??e.href??n(e),i=(e,i)=>({key:r(e),label:n(e),to:i,current:!!e.active,...t&&e.description?{description:e.description}:{}}),a=e=>e.flatMap(e=>G(e)?[]:[...e.href?[{...i(e,e.href),icon:e.icon}]:[],...a(e.children??[])]),o=[];for(let s of e)for(let e of s.items){if(G(e))continue;let c=t&&s.label?{group:s.label}:{},l=a(e.children??[]);if(l.length>0){let a=e.href?[{...i(e,e.href),icon:e.icon}]:[],s=t&&(!!e.active||!!J(e.children??[]));o.push({key:r(e),label:n(e),links:[...a,...l],...c,...t?{current:s}:{}})}else e.href&&o.push({...i(e,e.href),...c})}return o}function q(e,t){return t&&typeof e==`number`&&e>F?`${F}+`:e}function ge({href:e,label:n,linkComponent:r,onNavigate:i,children:a}){return/* @__PURE__ */ A(c,{link:t(r,{to:e}),className:`wui-brand-link`,"aria-label":n,onClick:i,children:a})}function _e({tab:e,linkComponent:n,iconVariant:r,capBadges:i}){let a=`wui-tabbar-item${e.active?` active`:``}`,o=/* @__PURE__ */ j(k,{children:[e.icon&&/* @__PURE__ */ A(`span`,{className:`wui-tabbar-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ A(h,{name:e.icon,size:24,variant:e.iconVariant??r}):e.icon}),/* @__PURE__ */ A(`span`,{className:`wui-tabbar-label`,children:e.tabLabel??e.label}),e.badge!=null&&/* @__PURE__ */ A(`span`,{className:`wui-tabbar-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:q(e.badge,i)})]}),s=e.active?`page`:void 0;return/* @__PURE__ */ A(c,{link:t(n,{to:e.href}),className:a,"aria-current":s,children:o})}function J(e){for(let t of e){if(t.active)return t;let e=t.children?.length?J(t.children):void 0;if(e)return e}}function ve({item:e,linkComponent:n,onNavigate:r,depth:i=0,iconVariant:a,newLabel:o,togglePagesLabel:s,capBadges:l}){let u=i>0,d=i>1?` wui-nav-depth-${Math.min(i,6)}`:``,f=Array.isArray(e.children)&&e.children.length>0,p=f?J(e.children??[]):void 0,m=!!p,g=p?p.key??p.href??p.label:null,[_,v]=O(m);w(()=>{g!=null&&v(!0)},[g]);let y=typeof e.label==`string`?e.label:void 0,b=!u&&e.icon&&/* @__PURE__ */ A(`span`,{className:`app-nav-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ A(h,{name:e.icon,size:e.iconSize??22,variant:e.iconVariant??a}):e.icon}),x=e.badge!=null&&/* @__PURE__ */ A(`span`,{className:`app-nav-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:q(e.badge,l)}),S=oe(e.newUntil)&&/* @__PURE__ */ A(`span`,{className:`wui-nav-new`,children:o}),C=/* @__PURE__ */ j(k,{children:[b,/* @__PURE__ */ A(`span`,{className:`app-nav-text`,children:e.label}),S,x,e.trailingIcon&&/* @__PURE__ */ A(`span`,{className:`app-nav-trailing`,children:typeof e.trailingIcon==`string`?/* @__PURE__ */ A(h,{name:e.trailingIcon,size:16}):e.trailingIcon})]}),T=e.active?`page`:void 0;if(f){let f=/* @__PURE__ */ A(`div`,{className:`app-nav-sub${_?` expanded`:``}`,inert:!_,"aria-hidden":!_||void 0,children:/* @__PURE__ */ A(`div`,{className:`app-nav-sub-inner`,children:(e.children??[]).map(e=>/* @__PURE__ */ A(ve,{item:e,linkComponent:n,onNavigate:r,depth:i+1,iconVariant:a,newLabel:o,togglePagesLabel:s,capBadges:l},e.key??e.href))})});if(e.href){let i=/* @__PURE__ */ A(c,{link:t(n,{to:e.href}),className:`wui-nav-split-link`,"aria-current":T,onClick:r,children:C});return/* @__PURE__ */ j(k,{children:[/* @__PURE__ */ j(`div`,{className:`app-nav-item has-children wui-nav-split${u?` app-nav-subitem`:``}${m||e.active?` active`:``}${d}`,"data-label":y,children:[i,/* @__PURE__ */ A(`button`,{type:`button`,className:`app-nav-caret wui-nav-split-toggle`,"aria-expanded":_,"aria-label":M(s,{name:y??``}),onClick:()=>v(e=>!e),children:/* @__PURE__ */ A(h,{name:`chevron-right`,size:16})})]}),f]})}return/* @__PURE__ */ j(k,{children:[/* @__PURE__ */ j(`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__ */ A(`span`,{className:`app-nav-text`,children:e.label}),S,x,/* @__PURE__ */ A(`span`,{className:`app-nav-caret`,children:/* @__PURE__ */ A(h,{name:`chevron-right`,size:16})})]}),f]})}let E=`app-nav-item${u?` app-nav-subitem`:``}${e.active?` active`:``}${d}`;return/* @__PURE__ */ A(c,{link:t(n,{to:e.href}),className:E,"aria-current":T,"data-label":y,onClick:r,children:C})}function ye(e){l(`wui-dropdown`,P);let[t,n]=O(!1),r=D(null);return w(()=>{r.current?.toggleAttribute(`open`,t)},[t]),w(()=>{let t=r.current;if(!t)return;let i=r=>{if(r.target!==t||!(`detail`in r)||!r.detail||typeof r.detail!=`object`)return;let i=`open`in r.detail&&r.detail.open===!0;n(i),i&&e?.()};return t.addEventListener(`wui-dropdown-toggle`,i),()=>t.removeEventListener(`wui-dropdown-toggle`,i)},[e]),{open:t,setOpen:n,ref:r}}function be({config:e,linkComponent:n,accountMenuLabel:r,roleLabel:i,rolesLabel:a}){let o=u(`shell`,ee),s=T(),{open:l,setOpen:d,ref:f}=ye(),{name:g,role:v,roles:y=[],noTriggerRole:b=!1,outlined:x=!1,photo:S,profileHref:C,profileLabel:w=o.profileLabel,onLogout:E,logoutAction:D,logoutLabel:O=o.logoutLabel,head:N,section:P,logoutVariant:F=`item`,items:I=[]}=e;if(_(`AppShell`,`userMenu.logoutVariant`,F,[`item`,`button`]),!g)throw Error(`<AppShell> userMenu.name is required; the trigger and the avatar are named from it.`);let L=y.map(e=>(e??``).trim()).filter(Boolean),R=()=>d(!1),z=(e,r,i,a)=>/* @__PURE__ */ A(c,{link:t(n,{to:e}),className:`dropdown-item`,onClick:a,children:r},i),B=/* @__PURE__ */ A(h,{name:`log-out`,size:18}),V=/* @__PURE__ */ j(k,{children:[B,O]});return/* @__PURE__ */ j(`wui-dropdown`,{class:`dropdown wui-usermenu`,align:`end`,ref:f,children:[/* @__PURE__ */ j(`button`,{type:`button`,id:s,className:x?`wui-usermenu-trigger wui-usermenu-trigger-outlined`:`wui-usermenu-trigger`,"data-wui-dropdown-trigger":!0,"aria-expanded":l,"aria-label":M(r,{name:g}),children:[/* @__PURE__ */ A(p,{name:g,src:S,tone:`auto`}),/* @__PURE__ */ j(`span`,{className:`wui-usermenu-text`,children:[/* @__PURE__ */ A(`span`,{className:`wui-usermenu-name`,children:g}),v&&!b&&/* @__PURE__ */ A(`span`,{className:`wui-usermenu-role`,children:v})]}),/* @__PURE__ */ A(h,{name:`chevron-down`,size:14,className:`wui-usermenu-caret`})]}),/* @__PURE__ */ j(`div`,{"data-wui-dropdown-menu":!0,popover:`auto`,className:`dropdown-menu dropdown-menu-end wui-usermenu-menu${l?` show`:``}`,"aria-labelledby":s,children:[/* @__PURE__ */ j(`div`,{className:`wui-usermenu-head`,children:[/* @__PURE__ */ A(p,{name:g,src:S,size:`lg`,tone:`auto`}),/* @__PURE__ */ j(`div`,{className:`wui-usermenu-who`,children:[/* @__PURE__ */ A(`div`,{className:`wui-usermenu-name`,children:g}),v&&/* @__PURE__ */ A(`div`,{className:`wui-usermenu-role`,children:v}),L.length>0&&/* @__PURE__ */ j(`div`,{className:`wui-usermenu-roles`,children:[/* @__PURE__ */ A(`span`,{className:`wui-usermenu-roles-label`,children:L.length===1?i:a}),` ${L.join(`, `)}`]}),N?/* @__PURE__ */ A(`div`,{className:`wui-usermenu-extra`,children:N}):null]})]}),P?/* @__PURE__ */ A(`div`,{className:`wui-usermenu-section`,children:P}):null,C&&z(C,/* @__PURE__ */ j(k,{children:[/* @__PURE__ */ A(h,{name:`user`,size:18}),w]}),void 0,R),I.map(e=>{if(e.divider)return/* @__PURE__ */ A(`hr`,{className:`dropdown-divider`},e.key);let t=/* @__PURE__ */ j(k,{children:[e.icon&&/* @__PURE__ */ A(h,{name:e.icon,size:18}),e.label]}),n=()=>{e.onClick?.(),R()};return e.href?z(e.href,t,e.key,n):/* @__PURE__ */ A(`button`,{type:`button`,className:`dropdown-item`,onClick:n,children:t},e.key)}),F===`button`?(D||E)&&/* @__PURE__ */ A(`div`,{className:`wui-usermenu-foot`,children:D?/* @__PURE__ */ A(`form`,{method:`post`,action:D,className:`wui-usermenu-logout`,children:/* @__PURE__ */ A(m,{type:`submit`,tone:`danger`,variant:`soft`,block:!0,leftIcon:B,children:O})}):/* @__PURE__ */ A(m,{type:`button`,tone:`danger`,variant:`soft`,block:!0,leftIcon:B,onClick:()=>{R(),E?.()},children:O})}):D?/* @__PURE__ */ A(`form`,{method:`post`,action:D,className:`wui-usermenu-logout`,children:/* @__PURE__ */ A(`button`,{type:`submit`,className:`dropdown-item danger`,children:V})}):E&&/* @__PURE__ */ A(`button`,{type:`button`,className:`dropdown-item danger`,onClick:()=>{R(),E()},children:V})]})]})}function xe({config:e,unreadLabel:t,markAllReadLabel:n,viewAllLabel:r,loadingNotificationsText:i,noUnreadText:a,unreadNotificationsText:o,unreadBellLabel:s}){let c=u(`shell`,ee),l=T(),{open:d,ref:f}=ye(e.onOpen),{unread:p=0,items:m,loading:g=!1,onMarkAllRead:_,viewAllHref:v,label:y=c.label,emptyText:b=c.emptyText}=e,[x,S]=O(``),C=D(p);w(()=>{C.current!==p&&(C.current=p,S(p===0?a:M(o,{count:W(p)})))},[p,a,o]);let E=null;return m?.length?E=/* @__PURE__ */ A(`div`,{className:`wui-bell-items`,children:m.map((e,n)=>{let r=`wui-bell-item${e.read?` wui-bell-item-read`:``}`,i=/* @__PURE__ */ j(k,{children:[/* @__PURE__ */ A(`span`,{className:`wui-bell-dot`,"aria-hidden":`true`}),e.icon&&/* @__PURE__ */ A(`span`,{className:`wui-bell-icon`,children:/* @__PURE__ */ A(h,{name:e.icon,size:18})}),/* @__PURE__ */ j(`span`,{className:`wui-bell-body`,children:[!e.read&&/* @__PURE__ */ j(`span`,{className:`visually-hidden`,children:[t,`: `]}),/* @__PURE__ */ A(`span`,{className:`wui-bell-item-title`,children:e.title}),e.time&&/* @__PURE__ */ A(`span`,{className:`wui-bell-when`,children:e.time})]})]});return e.href?/* @__PURE__ */ A(`a`,{className:r,href:e.href,"data-id":e.id,children:i},e.id??n):/* @__PURE__ */ A(`div`,{className:r,"data-id":e.id,children:i},e.id??n)})}):g?E=/* @__PURE__ */ A(`div`,{className:`wui-bell-state`,children:i}):m&&(E=/* @__PURE__ */ A(`div`,{className:`wui-bell-state`,children:b})),/* @__PURE__ */ j(`wui-dropdown`,{class:`dropdown wui-bell`,align:`end`,ref:f,children:[/* @__PURE__ */ j(`button`,{type:`button`,id:l,className:`topbar-icon-btn wui-bell-trigger`,"data-wui-dropdown-trigger":!0,"aria-expanded":d,"aria-label":p===0?y:M(s,{label:y,count:W(p)}),children:[/* @__PURE__ */ A(h,{name:`notification`,size:20}),/* @__PURE__ */ A(`span`,{className:`wui-bell-count`,"aria-hidden":`true`,hidden:p===0,children:W(p)})]}),/* @__PURE__ */ A(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:x}),/* @__PURE__ */ j(`div`,{"data-wui-dropdown-menu":!0,popover:`auto`,className:`dropdown-menu dropdown-menu-end wui-bell-menu${d?` show`:``}`,"aria-labelledby":l,children:[/* @__PURE__ */ j(`div`,{className:`wui-bell-head`,children:[/* @__PURE__ */ A(`span`,{className:`wui-bell-title`,children:y}),_&&/* @__PURE__ */ A(`button`,{type:`button`,className:`wui-bell-markall`,onClick:_,children:n})]}),/* @__PURE__ */ A(`div`,{className:`wui-bell-list`,"aria-busy":g||void 0,children:E}),v&&/* @__PURE__ */ A(`a`,{className:`wui-bell-foot`,href:v,children:r})]})]})}var Y=e=>!!e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName));function Se({config:e,searchResultsLabel:t,noResultsText:n,noResultsForText:r,resultsCountText:i,resultCountText:a,moreLabel:o}){l(`wui-overflow`,N);let s=u(`shell`,ee),c=T(),{value:d=``,onChange:f,results:p=null,loading:m=!1,onSelect:g,onSubmit:_,onFocus:v,placeholder:y=s.placeholder}=e,[b,S]=O(!1),[C,k]=O(!1),[P,F]=O({results:null,index:-1}),I=P.results===p?P.index:-1,L=e=>F({results:p,index:e}),R=D(null),z=D(null),B=D([]),V=E(()=>(p??[]).flatMap(e=>e.hits??[]),[p]),H=p!=null&&!C,U=V.length;w(()=>{let e=e=>{e.key!==`/`||e.ctrlKey||e.metaKey||e.altKey||Y(e.target instanceof HTMLElement?e.target:null)||(e.preventDefault(),S(!0),z.current?.focus())},t=e=>{R.current?.contains(e.target instanceof Node?e.target:null)||(k(!0),S(!1))};return document.addEventListener(`keydown`,e),document.addEventListener(`pointerdown`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`pointerdown`,t)}},[]);let te=e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(!H||U===0)return;e.preventDefault(),L((I+(e.key===`ArrowDown`?1:-1)+U)%U)}else x(e.nativeEvent)?H&&I>=0&&B.current[I]?(e.preventDefault(),B.current[I].click()):_&&d.trim()!==``&&(e.preventDefault(),_(d.trim())):e.key===`Escape`&&(H?(e.preventDefault(),k(!0)):b&&(e.preventDefault(),S(!1)))},ne=-1;return B.current=[],/* @__PURE__ */ A(`wui-overflow`,{class:`wui-topsearch-host`,label:o,children:/* @__PURE__ */ A(`div`,{"data-wui-overflow-list":!0,className:`wui-topsearch-row`,children:/* @__PURE__ */ j(`div`,{className:`wui-topsearch${b?` is-open`:``}${m?` is-loading`:``}`,ref:R,"data-overflow-label":y,children:[/* @__PURE__ */ A(`button`,{type:`button`,className:`topbar-icon-btn wui-topsearch-open`,"aria-label":y,"aria-expanded":b,"aria-controls":`${c}-panel`,onClick:()=>{let e=!b;S(e),e&&z.current?.focus()},children:/* @__PURE__ */ A(h,{name:`search`,size:20})}),/* @__PURE__ */ j(`div`,{className:`wui-topsearch-panel`,id:`${c}-panel`,children:[/* @__PURE__ */ j(`div`,{className:`search-wrap`,children:[/* @__PURE__ */ A(h,{name:`search`,size:18,className:`search-icon`}),/* @__PURE__ */ A(`input`,{ref:z,type:`search`,className:`form-control input search-input`,id:`${c}-input`,placeholder:y,"aria-label":y,role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":H,"aria-controls":`${c}-list`,"aria-activedescendant":H&&I>=0?`${c}-opt-${I}`:void 0,autoComplete:`off`,value:d,onChange:e=>{k(!1),f?.(e.target.value)},onKeyDown:te,onFocus:v})]}),/* @__PURE__ */ A(`div`,{className:`wui-topsearch-results`,id:`${c}-list`,role:`listbox`,"aria-label":t,hidden:!H,children:H&&/* @__PURE__ */ j(`div`,{className:`wui-topsearch-groups`,role:`presentation`,children:[U===0&&/* @__PURE__ */ A(`div`,{className:`wui-topsearch-empty`,role:`option`,"aria-disabled":`true`,"aria-selected":`false`,children:M(r,{value:d})}),p.filter(e=>e.hits?.length).map((e,t)=>/* @__PURE__ */ j(`div`,{className:`wui-topsearch-group`,role:`group`,"aria-label":e.label??``,children:[e.label&&/* @__PURE__ */ A(`div`,{className:`wui-topsearch-group-label`,role:`presentation`,children:e.label}),e.hits.map(e=>{ne+=1;let t=ne;return/* @__PURE__ */ j(`a`,{className:`wui-topsearch-hit${t===I?` is-active`:``}`,role:`option`,"aria-selected":t===I,id:`${c}-opt-${t}`,href:e.href,ref:e=>{B.current[t]=e},onClick:t=>g?.(e,t),children:[e.icon&&/* @__PURE__ */ A(`span`,{className:`wui-topsearch-hit-icon`,children:/* @__PURE__ */ A(h,{name:e.icon,size:18})}),/* @__PURE__ */ j(`span`,{className:`wui-topsearch-hit-text`,children:[/* @__PURE__ */ A(`span`,{className:`wui-topsearch-hit-title`,children:e.title}),e.subtitle&&/* @__PURE__ */ A(`span`,{className:`wui-topsearch-hit-sub`,children:e.subtitle})]})]},`${e.href}-${t}`)})]},e.label??t))]})})]}),/* @__PURE__ */ A(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:H?U===0?n:M(U===1?a:i,{count:U}):``})]})})})}export{le as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/FieldMessage.js";import{useFieldError as t}from"../lib/formFields.js";import n from"../lib/useElementEntry.js";import
|
|
1
|
+
import e from"../lib/FieldMessage.js";import{useFieldError as t}from"../lib/formFields.js";import n from"../lib/useElementEntry.js";import r from"../lib/useWuiText.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import ee from"./AppInfoTip.js";import te from"./AppRequiredMark.js";import a from"./assertValidValue.js";import o,{readRange as s,writeNumberValue as c}from"./useWuiControl.js";import ne from"./warnUnknownProps.js";import{useEffect as re,useId as ie,useRef as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import{SLIDER_TEXT as ae}from"@webority/ui-elements/text";var oe=[`sm`,`md`,`lg`],se=[`none`,`indian`],f=()=>import(`@webority/ui-elements/elements/slider`),p=(e,t)=>c(e,typeof t==`number`||typeof t==`string`?t:void 0);function m(c){let{marker:m,props:ce}=i(`AppSlider`,c),h=r(`slider`,ae),{ref:g,value:_,start:v,end:y,range:le=!1,onChange:ue,label:b,required:x=!1,optional:de=!1,helperText:S,error:fe,name:C,startName:w,endName:T,min:E=0,max:D=100,step:O=1,disabled:k,readOnly:A=!1,loading:j=!1,defaultValue:M,defaultStart:N,defaultEnd:P,size:F,showValue:I,unit:L,grouping:R=`none`,id:z,ariaLabel:pe,className:B=``,fieldClassName:V=``,help:H,helpLabel:me=h.helpLabel,optionalLabel:he=h.optionalLabel,...U}=ce,ge=t(C),_e=t(w),ve=t(T),W=fe??ge??_e??ve;ne(`AppSlider`,U),a(`AppSlider`,`size`,F,oe),a(`AppSlider`,`grouping`,R,se);let ye=n(`wui-slider`,f),be=ie(),G=z||be,K=le,{setRef:q,innerRef:J}=o({ready:ye,ref:e=>{typeof g==`function`?g(e):g&&(g.current=e)},value:K?void 0:_,onChange:K?e=>{c.range&&c.onChange?.(e)}:e=>{c.range||c.onChange?.(e)},readValue:K?s:void 0,writeValue:K?void 0:p}),Y=l(!1);re(()=>{if(!K)return;let e=J.current;if(!e)return;let t=v===void 0?Y.current?void 0:N:v,n=y===void 0?Y.current?void 0:P:y;Y.current=!0,t!==void 0&&t>e.end?(n!==void 0&&e.end!==n&&(e.end=n),t!==void 0&&e.start!==t&&(e.start=t)):(t!==void 0&&e.start!==t&&(e.start=t),n!==void 0&&e.end!==n&&(e.end=n))},[v,y,N,P,K,J]);let X=!b&&!W&&!S,Z=W?`${G}-error`:void 0,Q=S?`${G}-hint`:void 0,$=/* @__PURE__ */ u(`wui-slider`,{ref:q,id:G,name:C||void 0,"start-name":w||void 0,"end-name":T||void 0,min:E,max:D,step:O,size:F||void 0,value:(_??M)!=null&&!K?String(_??M):void 0,"aria-label":pe||(typeof b==`string`?b:void 0),"aria-describedby":Z||Q,"aria-invalid":W?`true`:void 0,disabled:k?``:void 0,readonly:A?``:void 0,loading:j?``:void 0,required:x?``:void 0,range:K?``:void 0,"show-value":I?``:void 0,unit:L||void 0,grouping:R===`indian`?R:void 0,className:B||void 0,...X?m:null,...U});return X?$:/* @__PURE__ */ d(`div`,{...m,className:`field${V?` ${V}`:``}`,children:[b&&/* @__PURE__ */ d(`label`,{className:`label`,htmlFor:G,children:[b,de&&!x&&/* @__PURE__ */ u(`span`,{className:`label-optional`,children:` ${he}`}),x&&/* @__PURE__ */ u(te,{}),H&&/* @__PURE__ */ u(ee,{label:me,children:H})]}),$,/* @__PURE__ */ u(e,{error:W,hint:S,errorId:Z,hintId:Q})]})}export{m as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/useElementEntry.js";import t from"../lib/useWuiText.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppIcon.js";import i from"./assertValidValue.js";import a from"./useWuiControl.js";import o from"./warnUnknownProps.js";import{
|
|
1
|
+
import e from"../lib/useElementEntry.js";import t from"../lib/useWuiText.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppIcon.js";import i from"./assertValidValue.js";import a from"./useWuiControl.js";import o from"./warnUnknownProps.js";import{useEffect as s,useRef as c}from"react";import{jsx as l,jsxs as u}from"react/jsx-runtime";import{SORTABLE_LIST_TEXT as d,fillText as f}from"@webority/ui-elements/text";var p=[`vertical`,`horizontal`],m=[`always`,`hover`],h=()=>import(`@webority/ui-elements/elements/sortable`),g=e=>`order`in e,_=(e,t)=>{if(!g(e))throw TypeError(`<AppSortableList> wrote its order before <wui-sortable> upgraded.`);e.controlled=!0;let n=e.order;(n.length!==t.length||t.some((e,t)=>e!==n[t]))&&(e.order=t)};function v({ref:g,...v}){let y=e(`wui-sortable`,h),{marker:b,props:x}=n(`AppSortableList`,v),S=t(`sortableList`,d),{items:C=[],onReorder:w,ariaLabel:T,handle:E=!1,group:D,name:O,disabled:k=!1,orientation:A=`vertical`,handleDisplay:j=`always`,bordered:M=!0,className:N=``,reorderLabel:P=S.reorderLabel,...F}=x;o(`AppSortableList`,F),i(`AppSortableList`,`orientation`,A,p),i(`AppSortableList`,`handleDisplay`,j,m);let I=j===`hover`,L=C.map(e=>e.id),R=c(L);s(()=>{R.current=L});let{setRef:z,innerRef:B}=a({ready:y,ref:g,value:L,writeValue:_,on:{"wui-sortable:change":e=>{if(e.target!==e.currentTarget)return;let t=e.detail;w?.(t.ids,t),requestAnimationFrame(()=>{let e=B.current;e&&_(e,R.current)})}}});return/* @__PURE__ */ l(`wui-sortable`,{ref:z,role:`list`,"aria-label":T,name:O||void 0,group:D||void 0,orientation:A===`horizontal`?`horizontal`:void 0,"handle-display":I?`hover`:void 0,handle:E||I?``:void 0,disabled:k?``:void 0,borderless:M?void 0:``,className:`wui-sortable${N?` ${N}`:``}`,...b,...F,children:C.map(e=>/* @__PURE__ */ u(`div`,{role:`listitem`,className:`wui-sortable-item`,"data-id":e.id,"data-label":e.label,"data-disabled":e.disabled?``:void 0,children:[/* @__PURE__ */ l(`button`,{type:`button`,className:`wui-sortable-handle`,"aria-label":f(P,{name:e.label}),disabled:k||e.disabled?!0:void 0,children:/* @__PURE__ */ l(r,{name:`menu`,size:18})}),/* @__PURE__ */ l(`div`,{className:`wui-sortable-body`,children:e.content??e.label})]},e.id))})}export{v as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/CheckField.js";import{BOX_SIZES as t}from"../lib/fieldState.js";import n from"../lib/labelWithHelp.js";import r from"../lib/useWuiText.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./assertValidValue.js";import o from"./warnUnknownProps.js";import{
|
|
1
|
+
import e from"../lib/CheckField.js";import{BOX_SIZES as t}from"../lib/fieldState.js";import n from"../lib/labelWithHelp.js";import r from"../lib/useWuiText.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./assertValidValue.js";import o from"./warnUnknownProps.js";import{jsx as s}from"react/jsx-runtime";import{SWITCH_TEXT as c}from"@webority/ui-elements/text";var l=[`round`,`pill`,`circle`];function u(e,t){if(t!=null&&t!==``)throw Error(`<AppSwitch> controlOnly draws no field, so it takes no ${e}; draw the label or message on the page.`)}function d({ref:d,...f}){let{marker:p,props:m}=i(`AppSwitch`,f),h=r(`switch`,c),{label:g,id:_,name:v,error:y,helperText:b,help:x,helpLabel:S=h.helpLabel,shape:C=`round`,className:w=``,checked:T,defaultChecked:E,onChange:D,readOnly:O=!1,loading:k=!1,size:A=`md`,controlOnly:j=!1,...M}=m;if(o(`AppSwitch`,M),j&&(u(`label`,g),u(`error`,y),u(`helperText`,b),m.size!==void 0&&m.size!==`md`))throw Error(`<AppSwitch> controlOnly draws no field, so it takes no size; draw the label or message on the page.`);a(`AppSwitch`,`shape`,C,l),a(`AppSwitch`,`size`,A,t);let N=`form-check form-switch${C===`circle`?` form-switch-circle`:C===`pill`?` form-switch-pill`:``}`,P={...M};return T!==void 0&&(P.checked=T),E!==void 0&&(P.defaultChecked=E),D!==void 0&&(P.onChange=D),T!==void 0&&D===void 0&&(P.readOnly=!0),/* @__PURE__ */ s(e,{rootProps:p,ref:d,label:n(g,x,S),id:_,name:v,error:y,hint:b,className:w,rest:P,inputType:`checkbox`,wrapperClass:N,readOnly:O,loading:k,size:A,controlOnly:j})}export{d as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{linkTarget as e}from"../lib/linkTarget.js";import{TargetLink as t}from"../lib/TargetLink.js";import n from"../lib/useElementEntry.js";import r from"../lib/useWuiText.js";import{TONES as i}from"../lib/vocabulary.js";import{splitMarkerProps as a}from"../lib/wuiMarker.js";import o from"./AppIcon.js";import s from"./AppTooltip.js";import c from"./assertValidValue.js";import l from"./renderIconProp.js";import
|
|
1
|
+
import{linkTarget as e}from"../lib/linkTarget.js";import{TargetLink as t}from"../lib/TargetLink.js";import n from"../lib/useElementEntry.js";import r from"../lib/useWuiText.js";import{TONES as i}from"../lib/vocabulary.js";import{splitMarkerProps as a}from"../lib/wuiMarker.js";import o from"./AppIcon.js";import s from"./AppTooltip.js";import c from"./assertValidValue.js";import l from"./renderIconProp.js";import u from"./warnUnknownProps.js";import{formatNumber as ee}from"@webority/ui-elements/helpers";import{cloneElement as te,useCallback as d,useEffect as f,useLayoutEffect as p,useRef as m,useState as ne}from"react";import{Fragment as re,jsx as h,jsxs as g}from"react/jsx-runtime";import{TABS_TEXT as ie}from"@webority/ui-elements/text";var _=[`underline`,`pills`],v=[`horizontal`,`vertical`],y=[`sm`,`md`,`lg`],ae={sm:16,md:18,lg:20},oe=[`automatic`,`manual`],se=[`scroll`,`menu`],ce=i.filter(e=>e!==`primary`&&e!==`neutral`),le=()=>import(`@webority/ui-elements/elements/overflow`),b=1,ue=28,de=.7;function x(i){let{marker:x,props:fe}=a(`AppTabs`,i),S=r(`tabs`,ie),{tabs:C,value:w,onChange:T,linkComponent:E,variant:D=`underline`,orientation:O=`horizontal`,size:k=`md`,fitted:pe=!1,overflow:A=`scroll`,moreLabel:me=S.moreLabel,maxVisible:he,activation:j=`automatic`,ariaLabel:M,className:N=``,style:P,...F}=fe;n(`wui-overflow`,le),u(`AppTabs`,F),c(`AppTabs`,`variant`,D,_),c(`AppTabs`,`orientation`,O,v),c(`AppTabs`,`size`,k,y),c(`AppTabs`,`activation`,j,oe),c(`AppTabs`,`overflow`,A,se);for(let e of C)c(`AppTabs`,`tabs[].tone`,e.tone,ce);let I=m(null),L=m(null),R=O===`vertical`,z=(A===`menu`||he!=null)&&!R,B=ae[k],[V,H]=ne(w);f(()=>{H(w)},[w]);let ge=C.find(e=>!e.disabled)?.key,_e=C.some(e=>e.key===V&&!e.disabled)?V:void 0,ve=C.some(e=>e.key===w&&!e.disabled)?w:void 0,ye=_e??ve??ge,be=e=>{I.current?.querySelector(`[data-key="${CSS.escape(String(e))}"]`)?.focus()},U=d(()=>{let e=I.current,t=L.current;if(!e||!t||R||z)return;let n=e.scrollWidth-e.clientWidth;t.classList.toggle(`is-overflow-start`,e.scrollLeft>b),t.classList.toggle(`is-overflow-end`,n>b&&e.scrollLeft<n-b)},[R,z]),W=d(()=>{let e=I.current;if(!e)return;let t=e.querySelector(`.app-tab.active`);t?(R?(e.style.setProperty(`--wui-tab-y`,`${t.offsetTop}px`),e.style.setProperty(`--wui-tab-h`,`${t.offsetHeight}px`)):(e.style.setProperty(`--wui-tab-x`,`${t.offsetLeft}px`),e.style.setProperty(`--wui-tab-w`,`${t.offsetWidth}px`)),e.toggleAttribute(`data-active-danger`,!!C.find(e=>e.key===w)?.danger)):e.style.setProperty(R?`--wui-tab-h`:`--wui-tab-w`,`0px`),e.setAttribute(`data-wui-tabs`,``),U()},[R,C,w,U]),G=e=>!z||!I.current?.querySelector(`[data-key="${CSS.escape(String(e))}"][data-wui-overflow-hidden]`),K=d(e=>{let t=I.current;if(!t||R)return;let n=t.querySelector(`.app-tab[data-key="${CSS.escape(e)}"]`);if(!n)return;let r=ue,i=n.offsetLeft,a=i+n.offsetWidth;i-r<t.scrollLeft?t.scrollLeft=Math.max(0,i-r):a+r>t.scrollLeft+t.clientWidth&&(t.scrollLeft=a+r-t.clientWidth)},[R]);p(()=>{W()},[W]),p(()=>{K(w)},[w,K]);let q=m(W);f(()=>{q.current=W},[W]),f(()=>{if(!document.fonts)return;let e=!0;return document.fonts.ready.then(()=>{e&&q.current()}),()=>{e=!1}},[]);let J=m(null),Y=d(e=>{if(typeof ResizeObserver>`u`)return;let t=J.current??{ro:new ResizeObserver(()=>q.current()),count:0};return J.current=t,t.ro.observe(e),t.count+=1,()=>{t.ro.unobserve(e),--t.count,t.count===0&&(t.ro.disconnect(),J.current===t&&(J.current=null))}},[]),X=d(e=>{I.current=e;let t=e?Y(e):void 0;return()=>{I.current=null,t?.()}},[Y]),Z=d(e=>{L.current=e;let t=e?Y(e):void 0;return()=>{L.current=null,t?.()}},[Y]);f(()=>{let e=L.current;if(!z||!e)return;let t=()=>q.current();return e.addEventListener(`wui-overflow-change`,t),()=>e.removeEventListener(`wui-overflow-change`,t)},[z]);function xe(e){let t=e.target instanceof HTMLElement?e.target.dataset.key:void 0;if(t==null)return;let n=C.findIndex(e=>e.key===t);if(n<0)return;let r=C.length,i=(e,t)=>{for(let n=1;n<=r;n++){let i=C[((e+t*n)%r+r)%r];if(i&&!i.disabled&&G(i.key))return i}return null},a=getComputedStyle(e.currentTarget).direction===`rtl`,o=R?`ArrowDown`:a?`ArrowLeft`:`ArrowRight`,s=R?`ArrowUp`:a?`ArrowRight`:`ArrowLeft`,c=null;if(e.key===o?c=i(n,1):e.key===s?c=i(n,-1):e.key===`Home`?c=C.find(e=>!e.disabled&&G(e.key))??null:e.key===`End`&&(c=[...C].reverse().find(e=>!e.disabled&&G(e.key))??null),!c)return;e.preventDefault(),H(c.key),be(c.key);let l=c.href!=null||c.to!=null;j===`automatic`&&!l&&T?.(c.key)}let Q=e=>{let t=I.current;t&&t.scrollBy({left:e*t.clientWidth*de})},Se=[`app-tabs`,D===`pills`?`app-tabs-pills`:``,R?`app-tabs-vertical`:``,k===`sm`?`app-tabs-sm`:``,k===`lg`?`app-tabs-lg`:``,pe?`app-tabs-fitted`:``,N].filter(Boolean).join(` `),$=/* @__PURE__ */ g(`div`,{ref:X,role:`tablist`,"aria-orientation":R?`vertical`:void 0,"aria-label":M,className:Se,style:P,"data-wui-overflow-list":z?``:void 0,...F,onKeyDown:xe,onScroll:U,children:[C.map(n=>{let r=n.key===w,i=n.href!=null||n.to!=null,a={role:`tab`,"data-key":n.key,"aria-selected":r,tabIndex:n.key===ye?0:-1,className:`app-tab${r?` active`:``}${n.danger?` danger`:``}${i&&n.disabled?` disabled`:``}`},o=/* @__PURE__ */ g(re,{children:[n.image?/* @__PURE__ */ h(`img`,{className:`app-tab-img`,src:n.image,alt:n.imageAlt??``,width:B,height:B}):l(n.icon,{size:16,className:`app-tab-icon`}),/* @__PURE__ */ h(`span`,{className:`wui-tab-label`,children:n.label}),(n.countLabel||n.count!=null)&&/* @__PURE__ */ h(`span`,{className:`app-tab-count${n.tone?` ${n.tone}`:``}`,children:n.countLabel||ee(n.count,{decimals:0})})]}),c;if(i){let r=n.disabled||n.to==null||E==null||E===`a`?e(void 0,{href:n.disabled?void 0:n.href??n.to}):e(E,{to:n.to}),i=n.rel??(n.target===`_blank`?`noopener noreferrer`:void 0),s=n.disabled?{"aria-disabled":!0}:{target:n.target,rel:i},l=e=>{n.disabled?e.preventDefault():e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(H(n.key),T?.(n.key))};c=/* @__PURE__ */ h(t,{link:r,...a,...s,onClick:l,children:o},n.key)}else c=/* @__PURE__ */ h(`button`,{type:`button`,...a,disabled:n.disabled,onClick:()=>{n.disabled||(H(n.key),T?.(n.key))},children:o},n.key);return n.tooltip?/* @__PURE__ */ h(s,{content:n.tooltip,children:c},n.key):c}),/* @__PURE__ */ h(`span`,{className:`app-tab-indicator`,"aria-hidden":`true`,"data-wui-overflow-skip":``})]});return R?te($,x):z?/* @__PURE__ */ h(`wui-overflow`,{...x,ref:Z,class:`app-tabs-wrap`,label:me,children:$}):/* @__PURE__ */ g(`div`,{...x,ref:Z,className:`app-tabs-wrap`,children:[/* @__PURE__ */ h(`button`,{type:`button`,className:`app-tabs-scroll-btn prev`,"aria-label":S.scrollTabsBackwardLabel,tabIndex:-1,onClick:()=>Q(-1),children:/* @__PURE__ */ h(o,{name:`chevron-left`,size:16})}),$,/* @__PURE__ */ h(`button`,{type:`button`,className:`app-tabs-scroll-btn next`,"aria-label":S.scrollTabsForwardLabel,tabIndex:-1,onClick:()=>Q(1),children:/* @__PURE__ */ h(o,{name:`chevron-right`,size:16})})]})}export{x as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/FieldMessage.js";import{FIELD_BUSY_CLASS as n,FIELD_SIZES as r}from"../lib/fieldState.js";import{useFieldError as i}from"../lib/formFields.js";import ee from"../lib/useWuiText.js";import{splitMarkerProps as
|
|
1
|
+
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/FieldMessage.js";import{FIELD_BUSY_CLASS as n,FIELD_SIZES as r}from"../lib/fieldState.js";import{useFieldError as i}from"../lib/formFields.js";import ee from"../lib/useWuiText.js";import{splitMarkerProps as a}from"../lib/wuiMarker.js";import o from"./AppInfoTip.js";import s from"./AppRequiredMark.js";import te from"./assertValidValue.js";import ne from"./warnUnknownProps.js";import{useCallback as re,useEffect as c,useId as l,useLayoutEffect as u,useRef as d,useState as f}from"react";import{jsx as p,jsxs as m}from"react/jsx-runtime";import{TEXTAREA_TEXT as h}from"@webority/ui-elements/text";import{Form as g}from"react-bootstrap";var _=e=>e!=null&&e!==``&&e!==!1;function v({ref:v,...ie}){let{marker:y,props:b}=a(`AppTextarea`,ie),x=ee(`textarea`,h),{label:S,required:C=!1,optional:w=!1,optionalLabel:T=x.optionalLabel,error:ae,helperText:E,help:D,helpLabel:oe=x.helpLabel,id:se,name:O,rows:ce=4,autoGrow:k=!1,monospace:A=!1,showCount:j=!1,maxLength:M,disabled:N=!1,readOnly:P=!1,loading:F=!1,size:I=`md`,className:L=``,fieldClassName:R=``,controlOnly:z=!1,value:B,...V}=b,H=i(O),U=ae??H,{onChange:W,...le}=V;if(z){let e=[[`label`,S],[`error`,U],[`helperText`,E],[`fieldClassName`,R],[`showCount`,j],[`help`,D],[`optional`,w]];for(let[t,n]of e)if(_(n))throw Error(`<AppTextarea> controlOnly draws no field, so it takes no ${t}; draw the label or message on the page.`)}ne(`AppTextarea`,V),te(`AppTextarea`,`size`,I,r),c(()=>{w&&C&&typeof process<`u`&&process.env.NODE_ENV!==`production`&&e(`AppTextarea: optional and required together; optional ignored`)},[w,C]);let ue=l(),G=se||ue,de=[`textarea`,k?`autosize`:``,A?`wui-mono`:``,U?`error`:``,I===`sm`?`wui-input-sm`:``,I===`lg`?`wui-input-lg`:``,I===`xl`?`wui-input-xl`:``,F?n:``,L].filter(Boolean).join(` `),K=U&&G?`${G}-error`:void 0,q=E&&G?`${G}-hint`:void 0,fe=K||q,J=d(null),pe=e=>{J.current=e,typeof v==`function`?v(e):v&&(v.current=e)},Y=d(void 0),X=re(()=>{let e=J.current;e&&(e.style.height=`auto`,e.style.height=`${e.scrollHeight}px`,Y.current=`${e.value}|${e.clientWidth}`)},[]);u(()=>{let e=J.current;!k||!e?Y.current=void 0:`${String(B??e.value)}|${e.clientWidth}`!==Y.current&&X()});let[Z,Q]=f(()=>String(B??V.defaultValue??``).length);c(()=>{j&&B!==void 0&&Q(String(B??``).length)},[B,j]);let me=e=>{k&&X(),j&&Q(e.currentTarget.value.length),V.onInput?.(e)},$=/* @__PURE__ */ p(g.Control,{as:`textarea`,id:G,name:O,rows:ce,className:de,"aria-invalid":U?`true`:`false`,"aria-describedby":fe,"aria-busy":F||void 0,required:C,maxLength:M,disabled:N,readOnly:P||F,...z?y:null,...B===void 0?null:{value:B},...le,...W?{onChange:W}:null,ref:pe,onInput:me});return z?$:/* @__PURE__ */ m(g.Group,{...y,className:`field${R?` ${R}`:``}`,children:[S&&/* @__PURE__ */ m(g.Label,{className:`label`,htmlFor:G,children:[S,w&&!C&&/* @__PURE__ */ p(`span`,{className:`label-optional`,children:` ${T}`}),C&&/* @__PURE__ */ p(s,{}),D&&/* @__PURE__ */ p(o,{label:oe,children:D})]}),$,/* @__PURE__ */ p(t,{error:U,hint:E,errorId:K,hintId:q}),j&&/* @__PURE__ */ m(`div`,{className:`field-count${M&&Z>=M?` at-limit`:``}`,children:[Z,M?` / ${M}`:``]})]})}export{v as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/FieldMessage.js";import{useFieldError as t}from"../lib/formFields.js";import
|
|
1
|
+
import e from"../lib/FieldMessage.js";import{useFieldError as t}from"../lib/formFields.js";import ee from"../lib/useElementEntry.js";import n from"../lib/useWuiText.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./AppInfoTip.js";import te from"./AppRequiredMark.js";import a from"./assertValidValue.js";import ne from"./textOf.js";import o from"./useWuiControl.js";import s from"./warnUnknownProps.js";import{cloneElement as c,useId as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import{TIME_PICKER_TEXT as f}from"@webority/ui-elements/text";var p=[`sm`,`md`,`lg`,`xl`],m=[`12`,`24`],h=()=>import(`@webority/ui-elements/elements/timepicker`);function g(g){let _=ee(`wui-timepicker`,h),{marker:v,props:re}=r(`AppTimePicker`,g),y=n(`timePicker`,f),{value:b,defaultValue:x,onChange:S,label:C,required:w=!1,optional:T=!1,optionalLabel:E=y.optionalLabel,helperText:D,error:O,help:k,helpLabel:A=y.helpLabel,name:j,min:M,max:N,step:P,format:F=24,placeholder:ie=y.placeholder,disabled:I,readOnly:L=!1,loading:R=!1,size:z,id:B,ariaLabel:V,className:H=``,fieldClassName:U=``,ref:W,...G}=re,K=t(j),q=O??K;s(`AppTimePicker`,G),a(`AppTimePicker`,`size`,z,p);let J=String(F);a(`AppTimePicker`,`format`,J,m);let Y=l(),X=B||j||Y,{setRef:ae}=o({ready:_,ref:W,value:b??(x===void 0?``:void 0),onChange:S}),oe=!C&&!q&&!D,Z=q?`${X}-error`:void 0,Q=D?`${X}-hint`:void 0,se=Z||Q,$=/* @__PURE__ */ u(`wui-timepicker`,{ref:ae,value:(b??x)||void 0,id:X,name:j,min:M,max:N,step:P==null?void 0:String(P),format:J,placeholder:ie,size:z||void 0,"aria-label":V||ne(C)||void 0,"aria-describedby":se,"aria-invalid":q?`true`:void 0,disabled:I?``:void 0,readonly:L?``:void 0,loading:R?``:void 0,required:w?``:void 0,className:H||void 0,...G});return oe?c($,v):/* @__PURE__ */ d(`div`,{...v,className:`field${U?` ${U}`:``}`,children:[C&&/* @__PURE__ */ d(`label`,{className:`label`,htmlFor:X,children:[C,T&&!w&&/* @__PURE__ */ u(`span`,{className:`label-optional`,children:` ${E}`}),w&&/* @__PURE__ */ u(te,{}),k&&/* @__PURE__ */ u(i,{label:A,children:k})]}),$,/* @__PURE__ */ u(e,{error:q,hint:D,errorId:Z,hintId:Q})]})}export{g as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/useElementEntry.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./assertValidValue.js";import r from"./warnUnknownProps.js";import{
|
|
1
|
+
import e from"../lib/useElementEntry.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./assertValidValue.js";import r from"./warnUnknownProps.js";import{useEffect as i,useLayoutEffect as a,useRef as o}from"react";import{jsx as s}from"react/jsx-runtime";var c=[`image`,`video`],l=[`click`],u=()=>import(`@webority/ui-elements/elements/tour`);function d({ref:d,...f}){let p=e(`wui-tour`,u),{marker:m,props:h}=t(`AppTour`,f),{open:g,onClose:_,tourId:v,steps:y,seenStore:b,onBeforeStep:x,labels:S,endDialog:C=!0,endNextHref:w,className:T,...E}=h;r(`AppTour`,E);for(let e of y)n(`AppTour`,`steps[].mediaType`,e.mediaType,c),n(`AppTour`,`steps[].advanceOn`,e.advanceOn,l);let D=o(null),O=e=>{D.current=e,typeof d==`function`?d(e):d&&(d.current=e)};a(()=>{let e=D.current;e&&p&&(e.seenStore=b??null,e.onBeforeStep=x??null)},[b,x,p]),a(()=>{let e=D.current;e&&p&&(g?e.setAttribute(`open`,``):e.removeAttribute(`open`))},[g,p]);let k=o(_);return k.current=_,i(()=>{let e=D.current;if(!e)return;let t=e=>{if(!(e instanceof CustomEvent))throw Error(`AppTour: wui-tour:close must be a CustomEvent carrying its detail.`);let{reason:t,index:n,position:r,total:i}=e.detail;k.current?.(t,{index:n,position:r,total:i})};return e.addEventListener(`wui-tour:close`,t),()=>e.removeEventListener(`wui-tour:close`,t)},[]),/* @__PURE__ */ s(`wui-tour`,{ref:O,"tour-id":v,"back-label":S?.back,"next-label":S?.next,"skip-label":S?.skip,"done-label":S?.done,"progress-label":S?.progress,"advance-label":S?.advance,"media-pause-label":S?.mediaPause,"media-play-label":S?.mediaPlay,"end-title":S?.endTitle,"end-message":S?.endMessage,"end-button":S?.endButton,"end-next-label":S?.endNextLabel,"end-next-href":w,"end-dialog":C===!1?`false`:void 0,class:T||void 0,...m,...E,children:y.map(e=>/* @__PURE__ */ s(`wui-tour-step`,{target:e.target,title:e.title,media:e.media,"media-alt":e.mediaAlt,"media-poster":e.mediaPoster,"media-type":e.mediaType,"advance-on":e.advanceOn,"action-label":e.actionLabel,children:e.description},`${e.target??``}|${e.description}`))})}export{d as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/FieldMessage.js";import{transferKeyAction as t}from"../lib/transferList/transferKeys.js";import{filterItems as n,moveAnnouncement as r,moveToAvailable as i,moveToChosen as a,reorderChosen as o,splitItems as s}from"../lib/transferList/transferState.js";import c from"../lib/transferListView/TransferPanel.js";import l from"../lib/useWuiText.js";import{splitMarkerProps as ee}from"../lib/wuiMarker.js";import te from"./warnUnknownProps.js";import{
|
|
1
|
+
import e from"../lib/FieldMessage.js";import{transferKeyAction as t}from"../lib/transferList/transferKeys.js";import{filterItems as n,moveAnnouncement as r,moveToAvailable as i,moveToChosen as a,reorderChosen as o,splitItems as s}from"../lib/transferList/transferState.js";import c from"../lib/transferListView/TransferPanel.js";import l from"../lib/useWuiText.js";import{splitMarkerProps as ee}from"../lib/wuiMarker.js";import te from"./warnUnknownProps.js";import{useEffect as ne,useId as re,useRef as u,useState as d}from"react";import{jsx as f,jsxs as p}from"react/jsx-runtime";import{TRANSFER_LIST_TEXT as ie,fillText as m}from"@webority/ui-elements/text";var ae=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]);function h({ref:h,...oe}){let{marker:se,props:ce}=ee(`AppTransferList`,oe),g=l(`transferList`,ie),{items:_,value:v,defaultValue:le=[],onChange:y,name:b,label:x,helperText:S,error:C,disabled:w=!1,searchable:ue=!0,reorderable:T=!0,availableTitle:de=g.availableTitle,chosenTitle:fe=g.chosenTitle,addAllLabel:pe=g.addAllLabel,removeAllLabel:me=g.removeAllLabel,addLabel:he=g.addLabel,removeLabel:ge=g.removeLabel,searchLabel:_e=g.searchLabel,searchPlaceholder:ve=g.searchPlaceholder,noMatchText:ye=g.noMatchText,emptyAvailableTitle:E=g.emptyAvailableTitle,emptyAvailableText:D=g.emptyAvailableText,emptyChosenTitle:O=g.emptyChosenTitle,emptyChosenText:k=g.emptyChosenText,dragHintText:A=g.dragHintText,orderHintText:j=g.orderHintText,id:M,className:N=``,ariaLabel:P,...F}=ce;te(`AppTransferList`,F);let I=re(),L=`${I}-label`,R=C?`${I}-error`:void 0,z=S?`${I}-hint`:void 0,be=[R,z].filter(Boolean).join(` `)||void 0,xe=v!==void 0,[Se,Ce]=d(le),B=s(_,v??Se),V=B.chosen.map(e=>e.id),[we,Te]=d(``),[Ee,De]=d(``),[Oe,H]=d(``),U=u(!1),W=u(null),G=u(null),K=u(null);ne(()=>{let e=W.current;if(!e)return;W.current=null;let t=(e.side===`chosen`?K.current:G.current)?.querySelectorAll(`[data-transfer-row-action]`)??[];Array.from(t).find(t=>t.dataset.transferRowAction===e.id)?.focus()});let q=e=>!ae(e,V)&&(xe||Ce(e),y?.(e),!0),J=(e,t,n)=>{let o=t.filter(e=>_.some(t=>t.id===e&&t.disabled!==!0));if(o.length===0)return;let s=e===`chosen`?a(V,o,_,n):i(V,o);if(!q(s))return;let c=_.find(e=>e.id===o[o.length-1]);c&&H(r(c.label,e,s.indexOf(c.id)+1,s.length))},ke=(e,t)=>{if(t.to!==K.current)return;let n=o(V,t.id,t.toIndex),i=_.find(e=>e.id===t.id);q(n)&&i&&H(r(i.label,`chosen`,n.indexOf(i.id)+1,n.length))},Ae=e=>e.nativeEvent.isComposing||e.keyCode===229,Y=(e,n)=>{if(w||!(n.target instanceof HTMLElement))return null;let r=n.target.closest(`[data-id]`)?.dataset.id;if(!r)return null;let i=getComputedStyle(n.currentTarget).direction===`rtl`,a=i&&n.key===`ArrowLeft`?`ArrowRight`:i&&n.key===`ArrowRight`?`ArrowLeft`:n.key;return{rowId:r,action:t({key:a,shiftKey:n.shiftKey,altKey:n.altKey,ctrlKey:n.ctrlKey,metaKey:n.metaKey,isComposing:Ae(n)},{side:e,layout:`rows`,pickedUp:U.current,reorderable:T,rowDisabled:_.some(e=>e.id===r&&e.disabled===!0)})}},X=e=>t=>{let n=Y(e,t);if(!n)return;let{rowId:r,action:i}=n;i.type===`drop`||i.type===`cancelPickUp`?(U.current=!1,i.type===`drop`&&t.preventDefault()):i.type===`crossList`&&(t.preventDefault(),t.stopPropagation(),U.current=!1,t.target instanceof HTMLElement&&t.target.blur(),W.current={id:r,side:i.to},J(i.to,[r]))},Z=e=>t=>{let n=Y(e,t);if(!n)return;let{rowId:r,action:i}=n;if(i.type===`transfer`){t.preventDefault();let e=i.direction===`toChosen`?`chosen`:`available`;W.current={id:r,side:e},J(e,[r])}else i.type===`pickUp`&&(t.preventDefault(),U.current=!0)},Q=e=>{let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||(U.current=!1)},$=e=>{let t=e===`chosen`,r=t?Ee:we,i=n(t?B.chosen:B.available,r),a=i.filter(e=>e.disabled!==!0).map(e=>e.id),o=t?fe:de,s=t?`available`:`chosen`;return{side:e,title:o,items:i,totalCount:t?B.chosen.length:B.available.length,query:r,onQueryChange:t?De:Te,searchable:ue,searchLabel:m(_e,{title:o}),searchPlaceholder:ve,noMatchText:m(ye,{query:r}),bulkLabel:t?me:pe,onBulk:()=>J(s,a),bulkDisabled:w||a.length===0,emptyTitle:t?O:E,emptyText:t?k:D,hint:T?t?j:A:null,rowAction:{label:e=>m(t?ge:he,{name:e.label}),onAct:e=>{W.current={id:e,side:s},J(s,[e])}},reorder:t&&T?{onReorder:ke}:null,listRef:t?K:G,listLabel:o,disabled:w}};return/* @__PURE__ */ p(`div`,{id:M,ref:h,className:`wui-transfer-list d-flex flex-column gap-2${N?` ${N}`:``}`,role:`group`,"aria-labelledby":x?L:void 0,"aria-label":x?void 0:P,"aria-describedby":be,"aria-disabled":w||void 0,...se,...F,children:[x?/* @__PURE__ */ f(`div`,{id:L,className:`form-label mb-0`,children:x}):null,/* @__PURE__ */ p(`div`,{className:`wui-transfer-list-panels`,children:[/* @__PURE__ */ f(`div`,{onKeyDownCapture:X(`available`),onKeyDown:Z(`available`),onBlur:Q,children:/* @__PURE__ */ f(c,{...$(`available`)})}),/* @__PURE__ */ f(`div`,{onKeyDownCapture:X(`chosen`),onKeyDown:Z(`chosen`),onBlur:Q,children:/* @__PURE__ */ f(c,{...$(`chosen`)})})]}),b?V.map(e=>/* @__PURE__ */ f(`input`,{type:`hidden`,name:b,value:e},e)):null,/* @__PURE__ */ f(e,{error:C,hint:S,errorId:R,hintId:z}),/* @__PURE__ */ f(`div`,{className:`small text-secondary mt-2`,role:`status`,children:Oe})]})}export{h as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/FieldMessage.js";import t from"../lib/useElementEntry.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppRequiredMark.js";import i from"./assertValidValue.js";import a from"./useWuiControl.js";import o from"./warnUnknownProps.js";import{
|
|
1
|
+
import e from"../lib/FieldMessage.js";import t from"../lib/useElementEntry.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppRequiredMark.js";import i from"./assertValidValue.js";import a from"./useWuiControl.js";import o from"./warnUnknownProps.js";import{useEffect as s,useId as c}from"react";import{jsx as l,jsxs as u}from"react/jsx-runtime";var d=[`single`,`multiple`],f=()=>import(`@webority/ui-elements/elements/tree-picker`);function p(e){return e instanceof HTMLElement&&`values`in e&&`nodes`in e}function m(e,t){e.values=Array.isArray(t)?t:t===``?[]:[t]}function h({ref:h,...g}){let _=t(`wui-tree-picker`,f),{marker:v,props:y}=n(`AppTreePicker`,g),{nodes:b,selection:x=`multiple`,value:S,defaultValue:C,onChange:w,name:T,label:E,helperText:D,error:O,required:k,disabled:A,id:j,ariaLabel:M,className:N,chosenTitle:P,clearAllLabel:F,emptyTitle:I,emptyText:L,noMatchText:R,removeLabel:z,searchLabel:B,searchPlaceholder:V,selectedText:H,...U}=y;o(`AppTreePicker`,U),i(`AppTreePicker`,`selection`,x,d);let W=c(),G=j||W,K=E?`${G}-label`:void 0,q=O?`${G}-error`:void 0,J=D?`${G}-hint`:void 0,{setRef:Y,innerRef:X}=a({ready:_,ref:h,value:S,defaultValue:C,writeValue:m,on:{"wui-tree-picker:change":e=>w?.(e.detail.value,{ids:e.detail.values})}});s(()=>{let e=X.current;_&&p(e)&&b!==void 0&&(e.nodes=b)},[b,X,_]);let Z=/* @__PURE__ */ l(`wui-tree-picker`,{ref:Y,id:G,selection:x,name:T||void 0,"aria-label":M||void 0,"aria-labelledby":M?void 0:K,"aria-describedby":q||J||void 0,invalid:O?``:void 0,disabled:A?``:void 0,"chosen-title":P||void 0,"clear-all-label":F||void 0,"empty-title":I||void 0,"empty-text":L||void 0,"no-match-text":R||void 0,"remove-label":z||void 0,"search-label":B||void 0,"search-placeholder":V||void 0,"selected-text":H||void 0,className:N||void 0,...U});return/* @__PURE__ */ u(`div`,{...v,className:`field`,children:[E&&/* @__PURE__ */ u(`label`,{className:`label`,id:K,htmlFor:G,children:[E,k&&/* @__PURE__ */ l(r,{})]}),Z,/* @__PURE__ */ l(e,{error:O,hint:D,errorId:q,hintId:J})]})}export{h as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/useElementEntry.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./assertValidValue.js";import r,{readValues as i,writeValues as a}from"./useWuiControl.js";import o from"./warnUnknownProps.js";import{
|
|
1
|
+
import e from"../lib/useElementEntry.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./assertValidValue.js";import r,{readValues as i,writeValues as a}from"./useWuiControl.js";import o from"./warnUnknownProps.js";import{useEffect as s,useRef as c}from"react";import{jsx as l}from"react/jsx-runtime";var u=[`none`,`single`,`multiple`],d=()=>import(`@webority/ui-elements/elements/tree`);function f(e){return e instanceof HTMLElement&&`nodes`in e&&`loadChildren`in e&&`selected`in e}function p({ref:p,...m}){let h=e(`wui-tree`,d),{marker:g,props:_}=t(`AppTreeView`,m),{nodes:v,selection:y,selected:b,onSelect:x,checked:S,onCheck:C,loadChildren:w,loadUrl:T,onLoadError:E,name:D,loadingText:O,errorText:k,ariaLabel:A,id:j,className:M=``,...N}=_;o(`AppTreeView`,N),n(`AppTreeView`,`selection`,y,u);let{setRef:P,innerRef:F}=r({ready:h,ref:p,value:S,readValue:i,writeValue:a,on:{"wui-tree:check":e=>C?.(e.detail.values,{id:e.detail.id,checked:e.detail.checked}),"wui-tree:select":e=>{x?.(e.detail.id,e.detail.node);let t=e.currentTarget;f(t)&&b!==void 0&&t.selected!==b&&(t.selected=b)},"wui-tree:error":e=>E?.(e.detail.id,e.detail.message)}});s(()=>{let e=F.current;h&&f(e)&&v!==void 0&&(e.nodes=v)},[v,F,h]),s(()=>{let e=F.current;h&&f(e)&&(e.loadChildren=w)},[w,F,h]);let I=c(!1);return s(()=>{let e=F.current;h&&f(e)&&(b===void 0?(I.current&&(e.selected=null),I.current=!1):(I.current=!0,e.selected!==b&&(e.selected=b)))},[b,F,h]),/* @__PURE__ */ l(`wui-tree`,{ref:P,id:j||void 0,selection:y||void 0,name:D||void 0,"load-url":T||void 0,"loading-text":O||void 0,"error-text":k||void 0,"aria-label":A||void 0,className:M||void 0,...g,...N})}export{p as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{linkTarget as e}from"../lib/linkTarget.js";import{TargetLink as t}from"../lib/TargetLink.js";import n from"../lib/useElementEntry.js";import r from"../lib/useWuiText.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./AppIcon.js";import o from"./assertValidValue.js";import s from"./warnUnknownProps.js";import{formatDate as c}from"@webority/ui-elements/helpers";import{useEffect as l,useRef as u}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";import{WHATS_NEW_TEXT as p}from"@webority/ui-elements/text";var m=[`dot`,`count`],h=()=>import(`@webority/ui-elements/elements/whats-new`),g=e=>typeof e==`object`&&!!e&&`through`in e&&typeof e.through==`string`;function _(e){n(`wui-whats-new`,h);let{marker:t,props:_}=i(`AppWhatsNew`,e),y=r(`whatsNew`,p),{entries:b=[],storageKey:x,readThrough:S,indicator:C=`dot`,label:w=y.label,unreadLabel:T=y.unreadLabel,emptyText:E=y.emptyText,onRead:D,linkComponent:O,className:k=``,...A}=_;s(`AppWhatsNew`,A),o(`AppWhatsNew`,`indicator`,C,m);let j=u(null),M=u(D);return M.current=D,l(()=>{let e=j.current;if(!e)return;let t=e=>{let t=e instanceof CustomEvent?e.detail:void 0;if(!g(t))throw Error(`wui-whats-new-read carried no read-through date`);M.current?.(t.through)};return e.addEventListener(`wui-whats-new-read`,t),()=>e.removeEventListener(`wui-whats-new-read`,t)},[]),/* @__PURE__ */ f(`wui-whats-new`,{ref:j,class:[`wui-whats-new`,k].filter(Boolean).join(` `),"storage-key":x||void 0,"read-through":S||void 0,indicator:C,...t,...A,children:[/* @__PURE__ */ f(`button`,{type:`button`,className:`u-action wui-whats-new-trigger`,"aria-haspopup":`dialog`,children:[/* @__PURE__ */ d(a,{name:`gift`,size:20}),/* @__PURE__ */ d(`span`,{className:`wui-whats-new-name`,children:w}),/* @__PURE__ */ d(`span`,{className:`wui-whats-new-unread`,children:` ${T}`}),/* @__PURE__ */ d(`span`,{className:`wui-whats-new-dot`,"aria-hidden":`true`})]}),/* @__PURE__ */ f(`div`,{className:`wui-whats-new-panel`,popover:`auto`,role:`dialog`,"aria-label":w,tabIndex:-1,children:[/* @__PURE__ */ d(`h2`,{className:`wui-whats-new-title`,children:w}),b.length>0?/* @__PURE__ */ d(`ol`,{className:`wui-whats-new-list`,children:b.map((e,t)=>/* @__PURE__ */ f(`li`,{className:`wui-whats-new-entry`,children:[/* @__PURE__ */ d(`time`,{className:`wui-whats-new-date`,dateTime:e.date,children:c(e.date)}),/* @__PURE__ */ d(`h3`,{className:`wui-whats-new-entry-title`,children:e.title}),e.body&&/* @__PURE__ */ d(`p`,{className:`wui-whats-new-body`,children:e.body}),e.imageSrc&&/* @__PURE__ */ d(`img`,{className:`wui-whats-new-image`,src:e.imageSrc,alt:e.imageAlt??``,loading:`lazy`}),e.href&&/* @__PURE__ */ d(v,{entry:e,linkComponent:O})]},e.id??`${e.date}-${t}`))}):/* @__PURE__ */ d(`p`,{className:`wui-whats-new-empty`,children:E})]})]})}function v({entry:n,linkComponent:i}){let a=r(`whatsNew`,p),o=e(i,{href:n.href});return/* @__PURE__ */ d(t,{link:o,className:`wui-whats-new-link`,children:n.linkLabel||a.linkLabel})}export{_ as default};
|
|
1
|
+
import{linkTarget as e}from"../lib/linkTarget.js";import{TargetLink as t}from"../lib/TargetLink.js";import n from"../lib/useElementEntry.js";import r from"../lib/useWuiText.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./AppIcon.js";import o from"./assertValidValue.js";import s from"./warnUnknownProps.js";import{formatDate as c}from"@webority/ui-elements/helpers";import{useEffect as l,useRef as u}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";import{WHATS_NEW_TEXT as p}from"@webority/ui-elements/text";var m=[`dot`,`count`],h=()=>import(`@webority/ui-elements/elements/whats-new`),g=e=>typeof e==`object`&&!!e&&`through`in e&&typeof e.through==`string`;function _(e){n(`wui-whats-new`,h);let{marker:t,props:_}=i(`AppWhatsNew`,e),y=r(`whatsNew`,p),{entries:b=[],storageKey:x,readThrough:S,indicator:C=`dot`,label:w=y.label,unreadLabel:T=y.unreadLabel,emptyText:E=y.emptyText,onRead:D,linkComponent:O,className:k=``,...A}=_;s(`AppWhatsNew`,A),o(`AppWhatsNew`,`indicator`,C,m);let j=u(null),M=u(D);return M.current=D,l(()=>{let e=j.current;if(!e)return;let t=e=>{let t=e instanceof CustomEvent?e.detail:void 0;if(!g(t))throw Error(`wui-whats-new-read carried no read-through date`);M.current?.(t.through)};return e.addEventListener(`wui-whats-new-read`,t),()=>e.removeEventListener(`wui-whats-new-read`,t)},[]),/* @__PURE__ */ f(`wui-whats-new`,{ref:j,class:[`wui-whats-new`,k].filter(Boolean).join(` `),"storage-key":x||void 0,"read-through":S||void 0,indicator:C,...t,...A,children:[/* @__PURE__ */ f(`button`,{type:`button`,className:`u-action wui-whats-new-trigger`,"aria-haspopup":`dialog`,children:[/* @__PURE__ */ d(a,{name:`gift`,size:20}),/* @__PURE__ */ d(`span`,{className:`wui-whats-new-name`,children:w}),/* @__PURE__ */ d(`span`,{className:`wui-whats-new-unread`,children:` ${T}`}),/* @__PURE__ */ d(`span`,{className:`wui-whats-new-dot`,"aria-hidden":`true`})]}),/* @__PURE__ */ f(`div`,{className:`wui-whats-new-panel`,popover:`auto`,role:`dialog`,"aria-label":w,tabIndex:-1,children:[/* @__PURE__ */ d(`h2`,{className:`wui-whats-new-title`,children:w}),b.length>0?/* @__PURE__ */ d(`ol`,{className:`wui-whats-new-list`,children:b.map((e,t)=>/* @__PURE__ */ f(`li`,{className:`wui-whats-new-entry`,children:[/* @__PURE__ */ d(`time`,{className:`wui-whats-new-date`,dateTime:e.date,children:c(e.date)}),/* @__PURE__ */ d(`h3`,{className:`wui-whats-new-entry-title`,children:e.title}),e.body&&/* @__PURE__ */ d(`p`,{className:`wui-whats-new-body`,children:e.body}),e.imageSrc&&/* @__PURE__ */ d(`img`,{className:`wui-whats-new-image`,src:e.imageSrc,alt:e.imageAlt??``,width:e.imageWidth,height:e.imageHeight,loading:`lazy`}),e.href&&/* @__PURE__ */ d(v,{entry:e,linkComponent:O})]},e.id??`${e.date}-${t}`))}):/* @__PURE__ */ d(`p`,{className:`wui-whats-new-empty`,children:E})]})]})}function v({entry:n,linkComponent:i}){let a=r(`whatsNew`,p),o=e(i,{href:n.href});return/* @__PURE__ */ d(t,{link:o,className:`wui-whats-new-link`,children:n.linkLabel||a.linkLabel})}export{_ as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/useElementEntry.js";import n from"../lib/useWuiText.js";import{TONES as r}from"../lib/vocabulary.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./AppIcon.js";import o from"./assertValidValue.js";import s from"./warnUnknownProps.js";import{Children as
|
|
1
|
+
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/useElementEntry.js";import n from"../lib/useWuiText.js";import{TONES as r}from"../lib/vocabulary.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./AppIcon.js";import o from"./assertValidValue.js";import s from"./warnUnknownProps.js";import{Children as ee,useEffect as c,useRef as l}from"react";import{jsx as u,jsxs as te}from"react/jsx-runtime";import{WIZARD_TEXT as d}from"@webority/ui-elements/text";var ne=[`steps`,`journey`,`icons`,`tiles`],f=r.filter(e=>e!==`neutral`),p=[`horizontal`,`vertical`],m=[`center`,`start`],h=[`done`,`active`,`pending`,`error`],g=[`key`,`label`,`description`,`optional`,`icon`,`status`],re=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],ie=[`check`,`alert-triangle`,`minus`],_=[`sm`,`md`,`lg`],v={sm:14,md:16,lg:20},y=()=>import(`@webority/ui-elements/elements/wizard`),b=/* @__PURE__ */ new Set,x=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}};function S(t){if(!Array.isArray(t))throw Error(`AppWizard: steps must be an array of { label, description?, optional?, icon?, status?, key? } objects.`);t.forEach((t,n)=>{if(typeof t!=`object`||!t)throw Error(`AppWizard: steps[${n}] needs a text label.`);let r=`label`in t?t.label:void 0;if(typeof r!=`string`||r.trim()===``)throw Error(`AppWizard: steps[${n}] needs a text label.`);if(x())for(let r of Object.keys(t)){if(g.includes(r))continue;let t=`AppWizard: steps[${n}] has an unknown field ${r}; the fields are ${g.join(`, `)}.`;b.has(t)||(b.add(t),e(t))}})}function C({ref:e,...r}){let g=t(`wui-wizard`,y),{marker:b,props:x}=i(`AppWizard`,r),C=n(`wizard`,d),{steps:w=[],children:T,active:E,defaultActive:D=0,onStepChange:O,onFinish:k,onSkip:A,beforeNext:j,onInvalid:M,onClose:N,variant:P=`steps`,tone:F,doneTone:I,orientation:L=`horizontal`,align:R=`center`,iconVariant:z,size:B=`md`,iconSize:V,skippable:H=!1,nonLinear:U=!1,hideStepper:W=!1,hideConnectors:G=!1,disabled:K=!1,label:q=C.label,backLabel:J=C.backLabel,nextLabel:ae=C.nextLabel,skipLabel:oe=C.skipLabel,finishLabel:se=C.finishLabel,topBar:ce=!1,barTitle:le,closeLabel:ue=C.closeLabel,className:de=``,...Y}=x;s(`AppWizard`,Y),o(`AppWizard`,`variant`,P,ne),o(`AppWizard`,`tone`,F,f),o(`AppWizard`,`doneTone`,I,f),o(`AppWizard`,`orientation`,L,p),o(`AppWizard`,`align`,R,m),o(`AppWizard`,`iconVariant`,z,re),o(`AppWizard`,`size`,B,_),S(w);let X=V!==void 0&&V>0?V:v[B]??v.md;for(let e of w)o(`AppWizard`,`steps[].status`,e.status,h);let Z=l(null),fe=t=>{Z.current=t,typeof e==`function`?e(t):e&&(e.current=t)},pe=ee.toArray(T),Q=z&&z!==`linear`?[.../* @__PURE__ */ new Set([...ie,...w.map(e=>e.icon).filter(e=>!!e)])]:[],me=[F&&`wui-step-tone-${F}`,I&&`wui-step-done-tone-${I}`,B!==`md`&&_.includes(B)&&`wui-step-size-${B}`,de].filter(Boolean).join(` `),$=l(E===void 0?D:E);return c(()=>{let e=Z.current;e&&g&&$.current&&(e.active=$.current)},[g]),c(()=>{let e=Z.current;e&&g&&E!==void 0&&Number(e.active)!==E&&(e.active=E)},[E,g]),c(()=>{let e=Z.current;e&&g&&(e.beforeNext=j??null)},[j,g]),c(()=>{let e=Z.current;if(!e)return;let t=e=>{if(!(e instanceof CustomEvent))throw Error(`AppWizard: wui-wizard:change must be a CustomEvent carrying its detail.`);let t=e.detail;O?.(t.index,t)},n=e=>{if(!(e instanceof CustomEvent))throw Error(`AppWizard: wui-wizard:finish must be a CustomEvent carrying its detail.`);let t=e.detail;k?.(t)},r=e=>{if(!(e instanceof CustomEvent))throw Error(`AppWizard: wui-wizard:skip must be a CustomEvent carrying its detail.`);let t=e.detail;A?.(t.index)},i=e=>{if(!(e instanceof CustomEvent))throw Error(`AppWizard: wui-wizard:invalid must be a CustomEvent carrying its detail.`);let t=e.detail;M?.(t.index)},a=e=>{if(!(e instanceof CustomEvent))throw Error(`AppWizard: wui-wizard:close must be a CustomEvent carrying its detail.`);let t=e.detail;N?.(t)};return e.addEventListener(`wui-wizard:change`,t),e.addEventListener(`wui-wizard:finish`,n),e.addEventListener(`wui-wizard:skip`,r),e.addEventListener(`wui-wizard:invalid`,i),e.addEventListener(`wui-wizard:close`,a),()=>{e.removeEventListener(`wui-wizard:change`,t),e.removeEventListener(`wui-wizard:finish`,n),e.removeEventListener(`wui-wizard:skip`,r),e.removeEventListener(`wui-wizard:invalid`,i),e.removeEventListener(`wui-wizard:close`,a)}},[O,k,A,M,N]),/* @__PURE__ */ te(`wui-wizard`,{ref:fe,variant:P,orientation:L,align:R===`start`?`start`:void 0,"icon-size":X===16?void 0:X,skippable:H?``:void 0,"non-linear":U?``:void 0,"hide-stepper":W?``:void 0,"hide-connectors":G?``:void 0,disabled:K?``:void 0,label:q,"back-label":J,"next-label":ae,"skip-label":oe,"finish-label":se,"top-bar":ce?``:void 0,"bar-title":le||void 0,"close-label":ue,className:me||void 0,...b,...Y,children:[w.map((e,t)=>/* @__PURE__ */ u(`wui-wizard-step`,{label:e.label,description:e.description||void 0,optional:e.optional?``:void 0,icon:e.icon||void 0,status:e.status||void 0,children:pe[t]},e.key??`${e.label}-${t}`)),Q.length>0&&/* @__PURE__ */ u(`span`,{hidden:!0,"data-wui-glyphs":``,children:Q.map(e=>/* @__PURE__ */ u(a,{name:e,size:X,variant:z},e))})]})}export{C as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{linkTarget as e}from"../lib/linkTarget.js";import{TargetLink as t}from"../lib/TargetLink.js";import n from"../lib/useElementEntry.js";import r from"../lib/useWuiText.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./AppIcon.js";import o from"./assertValidValue.js";import s from"./warnUnknownProps.js";import{initialsOf as c}from"@webority/ui-elements/helpers";import{useCallback as l,useEffect as u,useMemo as d,useRef as f,useState as p}from"react";import{Fragment as m,jsx as h,jsxs as g}from"react/jsx-runtime";import{WORKSPACE_SWITCHER_TEXT as _,fillText as v}from"@webority/ui-elements/text";var y=[`sm`,`md`,`lg`],b=()=>import(`@webority/ui-elements/elements/dropdown`),x=/* @__PURE__ */ new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`]);function S(e){let{marker:t,props:c}=i(`AppWorkspaceSwitcher`,e),m=r(`workspaceSwitcher`,_),{tenants:S=[],currentId:E,onSelect:D,menuLabel:O,footerAction:k,linkComponent:A,searchable:j=!1,onCreate:M,canCreate:N=!1,createLabel:P=m.createLabel,compact:F=!1,size:I=`md`,ariaLabel:L,searchPlaceholder:R=m.searchPlaceholder,searchLabel:z=m.searchPlaceholder,noMatchText:B=m.noMatchText,...V}=c,{onToggle:H,...U}=V;s(`AppWorkspaceSwitcher`,U),o(`AppWorkspaceSwitcher`,`size`,I,y),n(`wui-dropdown`,b);let[W,G]=p(``),[K,q]=p(!1),J=f(null),Y=f(null),X=l((e,t)=>{q(e),H?.(e,t)},[H]),Z=S.find(e=>e.id===E)??S[0],Q=d(()=>{let e=W.trim().toLowerCase();return!j||!e?S:S.filter(t=>String(t.name??``).toLowerCase().includes(e))},[S,W,j]);u(()=>{K&&j&&J.current?.focus()},[K,j]),u(()=>{let e=Y.current;if(!e)return;let t=t=>{if(t.target===e){if(!(t instanceof CustomEvent))throw TypeError(`<wui-dropdown> toggle arrived without its detail.`);X(t.detail.open,{source:t.detail.source})}};return e.addEventListener(`wui-dropdown-toggle`,t),()=>e.removeEventListener(`wui-dropdown-toggle`,t)},[X]),u(()=>{if(!j)return;let e=J.current;if(!e)return;let t=e=>{x.has(e.key)&&e.stopPropagation()};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)},[j]);let $=Z?.name??``,ee=L??v(m.ariaLabel,{currentName:$});return/* @__PURE__ */ g(`wui-dropdown`,{ref:Y,class:`dropdown workspace-switcher${I===`sm`?` workspace-switcher-sm`:``}${I===`lg`?` workspace-switcher-lg`:``}`,...t,...U,children:[/* @__PURE__ */ h(T,{compact:F,tenant:Z,ariaLabel:ee}),/* @__PURE__ */ g(`div`,{"data-wui-dropdown-menu":``,popover:`auto`,className:`dropdown-menu workspace-switcher-menu`,children:[O?/* @__PURE__ */ h(`div`,{className:`workspace-switcher-menu-label`,children:O}):null,j?/* @__PURE__ */ g(`div`,{className:`workspace-switcher-search`,children:[/* @__PURE__ */ h(a,{name:`search`,size:14}),/* @__PURE__ */ h(`input`,{ref:J,type:`search`,className:`workspace-switcher-search-input`,placeholder:R,"aria-label":z,value:W,onChange:e=>G(e.target.value)})]}):null,/* @__PURE__ */ g(`div`,{className:`workspace-switcher-list`,children:[Q.map(e=>/* @__PURE__ */ g(`button`,{type:`button`,className:`dropdown-item workspace-switcher-option${e.id===Z?.id?` is-active`:``}`,onClick:()=>D?.(e),children:[/* @__PURE__ */ h(C,{tenant:e}),/* @__PURE__ */ h(`span`,{className:`workspace-switcher-option-name`,children:e.name}),e.badge?/* @__PURE__ */ h(`span`,{className:`workspace-switcher-badge`,children:e.badge}):null,e.id===Z?.id?/* @__PURE__ */ h(a,{name:`check`,size:16,className:`workspace-switcher-tick`}):null]},e.id)),Q.length===0?/* @__PURE__ */ h(`div`,{className:`workspace-switcher-empty`,children:B}):null]}),N?/* @__PURE__ */ g(`button`,{type:`button`,className:`dropdown-item workspace-switcher-create`,onClick:()=>M?.(),children:[/* @__PURE__ */ h(a,{name:`plus`,size:16}),P]}):null,k?/* @__PURE__ */ h(`div`,{className:`workspace-switcher-footer`,children:w(k,A)}):null]})]})}function C({tenant:e}){
|
|
1
|
+
import{linkTarget as e}from"../lib/linkTarget.js";import{TargetLink as t}from"../lib/TargetLink.js";import n from"../lib/useElementEntry.js";import r from"../lib/useWuiText.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./AppIcon.js";import o from"./assertValidValue.js";import s from"./warnUnknownProps.js";import{initialsOf as c}from"@webority/ui-elements/helpers";import{useCallback as l,useEffect as u,useMemo as d,useRef as f,useState as p}from"react";import{Fragment as m,jsx as h,jsxs as g}from"react/jsx-runtime";import{WORKSPACE_SWITCHER_TEXT as _,fillText as v}from"@webority/ui-elements/text";var y=[`sm`,`md`,`lg`],b=()=>import(`@webority/ui-elements/elements/dropdown`),x=/* @__PURE__ */ new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`]);function S(e){let{marker:t,props:c}=i(`AppWorkspaceSwitcher`,e),m=r(`workspaceSwitcher`,_),{tenants:S=[],currentId:E,onSelect:D,menuLabel:O,footerAction:k,linkComponent:A,searchable:j=!1,onCreate:M,canCreate:N=!1,createLabel:P=m.createLabel,compact:F=!1,size:I=`md`,ariaLabel:L,searchPlaceholder:R=m.searchPlaceholder,searchLabel:z=m.searchPlaceholder,noMatchText:B=m.noMatchText,...V}=c,{onToggle:H,...U}=V;s(`AppWorkspaceSwitcher`,U),o(`AppWorkspaceSwitcher`,`size`,I,y),n(`wui-dropdown`,b);let[W,G]=p(``),[K,q]=p(!1),J=f(null),Y=f(null),X=l((e,t)=>{q(e),H?.(e,t)},[H]),Z=S.find(e=>e.id===E)??S[0],Q=d(()=>{let e=W.trim().toLowerCase();return!j||!e?S:S.filter(t=>String(t.name??``).toLowerCase().includes(e))},[S,W,j]);u(()=>{K&&j&&J.current?.focus()},[K,j]),u(()=>{let e=Y.current;if(!e)return;let t=t=>{if(t.target===e){if(!(t instanceof CustomEvent))throw TypeError(`<wui-dropdown> toggle arrived without its detail.`);X(t.detail.open,{source:t.detail.source})}};return e.addEventListener(`wui-dropdown-toggle`,t),()=>e.removeEventListener(`wui-dropdown-toggle`,t)},[X]),u(()=>{if(!j)return;let e=J.current;if(!e)return;let t=e=>{x.has(e.key)&&e.stopPropagation()};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)},[j]);let $=Z?.name??``,ee=L??v(m.ariaLabel,{currentName:$});return/* @__PURE__ */ g(`wui-dropdown`,{ref:Y,class:`dropdown workspace-switcher${I===`sm`?` workspace-switcher-sm`:``}${I===`lg`?` workspace-switcher-lg`:``}`,...t,...U,children:[/* @__PURE__ */ h(T,{compact:F,tenant:Z,ariaLabel:ee,size:I}),/* @__PURE__ */ g(`div`,{"data-wui-dropdown-menu":``,popover:`auto`,className:`dropdown-menu workspace-switcher-menu`,children:[O?/* @__PURE__ */ h(`div`,{className:`workspace-switcher-menu-label`,children:O}):null,j?/* @__PURE__ */ g(`div`,{className:`workspace-switcher-search`,children:[/* @__PURE__ */ h(a,{name:`search`,size:14}),/* @__PURE__ */ h(`input`,{ref:J,type:`search`,className:`workspace-switcher-search-input`,placeholder:R,"aria-label":z,value:W,onChange:e=>G(e.target.value)})]}):null,/* @__PURE__ */ g(`div`,{className:`workspace-switcher-list`,children:[Q.map(e=>/* @__PURE__ */ g(`button`,{type:`button`,className:`dropdown-item workspace-switcher-option${e.id===Z?.id?` is-active`:``}`,onClick:()=>D?.(e),children:[/* @__PURE__ */ h(C,{tenant:e,size:I,inMenu:!0}),/* @__PURE__ */ h(`span`,{className:`workspace-switcher-option-name`,children:e.name}),e.badge?/* @__PURE__ */ h(`span`,{className:`workspace-switcher-badge`,children:e.badge}):null,e.id===Z?.id?/* @__PURE__ */ h(a,{name:`check`,size:16,className:`workspace-switcher-tick`}):null]},e.id)),Q.length===0?/* @__PURE__ */ h(`div`,{className:`workspace-switcher-empty`,children:B}):null]}),N?/* @__PURE__ */ g(`button`,{type:`button`,className:`dropdown-item workspace-switcher-create`,onClick:()=>M?.(),children:[/* @__PURE__ */ h(a,{name:`plus`,size:16}),P]}):null,k?/* @__PURE__ */ h(`div`,{className:`workspace-switcher-footer`,children:w(k,A)}):null]})]})}function C({tenant:e,size:t,inMenu:n=!1}){if(e?.logoUrl){let r=n?{sm:24,md:28,lg:34}[t]:{sm:24,md:30,lg:32}[t];return/* @__PURE__ */ h(`img`,{className:`workspace-switcher-mark`,src:e.logoUrl,alt:``,loading:`lazy`,width:r,height:r})}return/* @__PURE__ */ h(`span`,{className:`workspace-switcher-mark`,children:c(e?.name,1)})}function w(n,r){if(typeof n!=`object`||!n||!(`label`in n))return n;let{label:i,icon:o,href:s}=n,c=/* @__PURE__ */ g(m,{children:[o?/* @__PURE__ */ h(a,{name:o,size:16}):null,i]});return s?/* @__PURE__ */ h(t,{link:e(r,{href:s}),className:`workspace-switcher-footer-action`,children:c}):/* @__PURE__ */ h(`button`,{className:`workspace-switcher-footer-action`,type:`button`,children:c})}function T({compact:e,tenant:t,ariaLabel:n,size:r}){return/* @__PURE__ */ g(`button`,{type:`button`,"data-wui-dropdown-trigger":``,className:`workspace-switcher-trigger${e?` is-compact`:``}`,"aria-haspopup":`true`,"aria-expanded":`false`,"aria-label":n,children:[/* @__PURE__ */ h(C,{tenant:t,size:r}),e?null:/* @__PURE__ */ g(m,{children:[/* @__PURE__ */ h(`span`,{className:`workspace-switcher-trigger-name`,children:t?.name}),/* @__PURE__ */ h(a,{name:`chevrons-up-down`,size:16,className:`workspace-switcher-chevron`})]})]})}export{S as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/FieldMessage.js";import{useFieldError as
|
|
1
|
+
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/FieldMessage.js";import{useFieldError as n}from"../lib/formFields.js";import ee from"../lib/useElementEntry.js";import r from"../lib/useWuiText.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./AppInfoTip.js";import o from"./AppRequiredMark.js";import s from"./assertValidValue.js";import c from"./textOf.js";import l from"./useWuiControl.js";import u from"./warnUnknownProps.js";import{cloneElement as d,useId as f}from"react";import{jsx as p,jsxs as m}from"react/jsx-runtime";import{DATE_PICKER_TEXT as h}from"@webority/ui-elements/text";var g=[`sm`,`md`,`lg`,`xl`],_=()=>import(`@webority/ui-elements/elements/datepicker`);function v({ref:v,...te}){let ne=ee(`wui-datepicker`,_),y=r(`datePicker`,h),{marker:b,props:x}=i(`AppYearPicker`,te),{value:S,onChange:C,label:w,required:T=!1,optional:E=!1,optionalLabel:D=y.optionalLabel,helperText:O,error:k,name:A,min:j,max:M,placeholder:N=y.yearPlaceholder,disabled:P,readOnly:re=!1,loading:F=!1,defaultValue:I,help:L,helpLabel:R=y.helpLabel,size:z,displayFormat:B,id:V,ariaLabel:H,"aria-invalid":U,className:W=``,fieldClassName:G=``,...K}=x,q=n(A),J=k??q;u(`AppYearPicker`,K),s(`AppYearPicker`,`size`,z,g),typeof B==`string`&&B!==``&&/DD|YYYY|YY/.test(B)&&e(`[@webority/ui-react] <AppYearPicker> displayFormat "${B}" uses uppercase year or day tokens, which print as written; the year token is yyyy.`);let Y=f(),X=V||Y,{setRef:ie}=l({ready:ne,ref:v,value:S??(I===void 0?``:void 0),defaultValue:I,onChange:C}),ae=!w&&!J&&!O,Z=J?`${X}-error`:void 0,Q=O?`${X}-hint`:void 0,oe=Z||Q,$=/* @__PURE__ */ p(`wui-datepicker`,{ref:ie,id:X,name:A,value:(S??I)||void 0,min:j,max:M,placeholder:N,size:z||void 0,"display-format":B||void 0,"aria-label":H||c(w)||void 0,"aria-describedby":oe,"aria-invalid":U??(J?`true`:void 0),disabled:P?``:void 0,readonly:re?``:void 0,loading:F?``:void 0,required:T?``:void 0,className:W||void 0,...K,mode:`year`});return ae?d($,b):/* @__PURE__ */ m(`div`,{...b,className:`field${G?` ${G}`:``}`,children:[w&&/* @__PURE__ */ m(`label`,{className:`label`,htmlFor:X,children:[w,E&&!T&&/* @__PURE__ */ p(`span`,{className:`label-optional`,children:` ${D}`}),T&&/* @__PURE__ */ p(o,{}),L&&/* @__PURE__ */ p(a,{label:R,children:L})]}),$,/* @__PURE__ */ p(t,{error:J,hint:O,errorId:Z,hintId:Q})]})}export{v as default};
|
package/dist/components/toast.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./assertValidValue.js";import{dismissAllToasts as t,pushToast as n}from"./toastStore.js";import{TOAST_TEXT as r,readText as i}from"@webority/ui-elements/text";var a=()=>i(`toast`,r);function o(){t()}var s=/* @__PURE__ */ new Set([`success`,`info`,`warning`,`danger`]);function c(t,r=`info`){if(typeof r==`string`)e(`toast`,`variant`,r,s),n(t,r,{});else{if(typeof r!=`object`||!r)throw TypeError(`[@webority/ui-react] toast() received ${String(r)} as its second argument; pass a variant name or an options object.`);e(`toast`,`variant`,r.variant,s),n(t,r.variant??`info`,r)}}function l(e,t={}){n(e,`danger`,t)}c
|
|
1
|
+
import e from"./assertValidValue.js";import{dismissAllToasts as t,pushToast as n}from"./toastStore.js";import{TOAST_TEXT as r,readText as i}from"@webority/ui-elements/text";var a=()=>i(`toast`,r);function o(){t()}var s=/* @__PURE__ */ new Set([`success`,`info`,`warning`,`danger`]);function c(t,r=`info`){if(typeof r==`string`)e(`toast`,`variant`,r,s),n(t,r,{});else{if(typeof r!=`object`||!r)throw TypeError(`[@webority/ui-react] toast() received ${String(r)} as its second argument; pass a variant name or an options object.`);e(`toast`,`variant`,r.variant,s),n(t,r.variant??`info`,r)}}function l(e,t={}){n(e,`danger`,t)}var u=Object.assign(c,{promise:(e,t,n={})=>{let r=n.id||`promise-${Date.now()}-${Math.random()}`;return c(t.loading||a().loading,{...n,variant:`info`,id:r,duration:0}),e.then(e=>(c((typeof t.success==`function`?t.success(e):t.success)||a().success,{...n,variant:`success`,id:r,duration:n.duration===void 0?5e3:n.duration}),e)).catch(e=>{throw c((typeof t.error==`function`?t.error(e):t.error)||a().error,{...n,variant:`danger`,id:r,duration:n.duration===void 0?5e3:n.duration}),e})}});export{o as dismissAll,l as errorToast,u as toast};
|
package/dist/guidance.json
CHANGED
package/dist/lib/CheckField.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./FieldMessage.js";import{FIELD_BUSY_CLASS as t}from"./fieldState.js";import{useFieldError as n}from"./formFields.js";import{
|
|
1
|
+
import e from"./FieldMessage.js";import{FIELD_BUSY_CLASS as t}from"./fieldState.js";import{useFieldError as n}from"./formFields.js";import{useId as r}from"react";import{jsx as i,jsxs as a}from"react/jsx-runtime";var o=()=>{};function s({ref:s,label:c,id:l,name:u,error:d,hint:f,className:p=``,rest:m={},inputType:h,wrapperClass:g,rootProps:_,readOnly:v=!1,loading:y=!1,size:b=`md`,controlOnly:x=!1}){let S=n(u),C=x?d:d??S,w=r(),T=l||w,E=C?`${T}-error`:void 0,D=f?`${T}-hint`:void 0,O=b===`sm`?` form-check-sm`:b===`lg`?` form-check-lg`:``,{onClick:k,...A}=m;(v||y)&&A.checked!==void 0&&A.onChange===void 0&&(A.onChange=o);let j=y?`form-check-input ${t}`:`form-check-input`,M=x&&p?`${j} ${p}`:j,N=/* @__PURE__ */ i(`input`,{...x?_:void 0,type:h,className:M,id:T,name:u,ref:s,"aria-invalid":C?`true`:`false`,"aria-describedby":E||D,"aria-readonly":v||void 0,"aria-busy":y||void 0,onClick:e=>{v||y?e.preventDefault():k?.(e)},...A});return x?N:/* @__PURE__ */ a(`div`,{className:`${g}${O}${p?` ${p}`:``}`,..._,children:[N,c!=null&&/* @__PURE__ */ i(`label`,{className:`form-check-label`,htmlFor:T,children:c}),/* @__PURE__ */ i(e,{error:C,hint:f,errorId:E,hintId:D})]})}export{s as default};
|
package/dist/lib/FileItemRow.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../components/AppIcon.js";import t from"../components/AppProgress.js";import{linkOf as n,nameOf as r,sizeLabelOf as i,uploadErrorOf as a,uploadProgressOf as o,useItemUrl as s}from"./fileItem.js";import{linkTarget as c}from"./linkTarget.js";import{TargetLink as l}from"./TargetLink.js";import{jsx as u,jsxs as d}from"react/jsx-runtime";import{fillText as f}from"@webority/ui-elements/text";function p({item:p,isImage:m,onRemove:h,linkComponent:g,noun:_=`attachment`,removeFileLabel:v=`Remove {name}`,readOnly:y=!1}){let b=s(p,m),x=r(p),S=i(p),C=o(p),w=a(p),T=n(p),E=p instanceof File?void 0:p?.to,D=c(g,{to:E,href:T??void 0,routeHref:!1});return/* @__PURE__ */ d(`div`,{className:w?`attach-item wui-attach-failed`:`attach-item`,children:[/* @__PURE__ */ u(`span`,{className:`attach-item-media`,children:b?/* @__PURE__ */ u(`img`,{src:b,alt:x}):/* @__PURE__ */ u(e,{name:`file-text`,size:18})}),/* @__PURE__ */ d(`span`,{className:`attach-item-info`,children:[/* @__PURE__ */ u(`span`,{className:`attach-name`,children:T||E?/* @__PURE__ */ u(l,{link:D,children:x}):x}),S&&/* @__PURE__ */ u(`span`,{className:`attach-size`,children:S}),C!==null&&/* @__PURE__ */ u(t,{value:C,size:`sm`,label:`Uploading ${x}`,className:`wui-attach-progress`}),w&&/* @__PURE__ */ u(`div`,{className:`wui-attach-error`,children:w})]}),!y&&/* @__PURE__ */ u(`button`,{type:`button`,className:`attach-item-remove`,"aria-label":f(v,{name:x||_}),onClick:h,children:/* @__PURE__ */ u(e,{name:`x`,size:16})})]})}export{p as default};
|
|
1
|
+
import e from"../components/AppIcon.js";import t from"../components/AppProgress.js";import{linkOf as n,nameOf as r,sizeLabelOf as i,uploadErrorOf as a,uploadProgressOf as o,useItemUrl as s}from"./fileItem.js";import{linkTarget as c}from"./linkTarget.js";import{TargetLink as l}from"./TargetLink.js";import{jsx as u,jsxs as d}from"react/jsx-runtime";import{fillText as f}from"@webority/ui-elements/text";function p({item:p,isImage:m,onRemove:h,linkComponent:g,noun:_=`attachment`,removeFileLabel:v=`Remove {name}`,readOnly:y=!1}){let b=s(p,m),x=r(p),S=i(p),C=o(p),w=a(p),T=n(p),E=p instanceof File?void 0:p?.to,D=c(g,{to:E,href:T??void 0,routeHref:!1});return/* @__PURE__ */ d(`div`,{className:w?`attach-item wui-attach-failed`:`attach-item`,children:[/* @__PURE__ */ u(`span`,{className:`attach-item-media`,children:b?/* @__PURE__ */ u(`img`,{src:b,alt:x,width:40,height:40}):/* @__PURE__ */ u(e,{name:`file-text`,size:18})}),/* @__PURE__ */ d(`span`,{className:`attach-item-info`,children:[/* @__PURE__ */ u(`span`,{className:`attach-name`,children:T||E?/* @__PURE__ */ u(l,{link:D,children:x}):x}),S&&/* @__PURE__ */ u(`span`,{className:`attach-size`,children:S}),C!==null&&/* @__PURE__ */ u(t,{value:C,size:`sm`,label:`Uploading ${x}`,className:`wui-attach-progress`}),w&&/* @__PURE__ */ u(`div`,{className:`wui-attach-error`,children:w})]}),!y&&/* @__PURE__ */ u(`button`,{type:`button`,className:`attach-item-remove`,"aria-label":f(v,{name:x||_}),onClick:h,children:/* @__PURE__ */ u(e,{name:`x`,size:16})})]})}export{p as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type CSSProperties } from "react";
|
|
1
|
+
import { type CSSProperties, type JSX, type Ref } from "react";
|
|
2
2
|
export interface AppCalendarEvent {
|
|
3
3
|
id?: string | number | undefined;
|
|
4
4
|
title: string;
|
|
@@ -56,6 +56,54 @@ export interface AppCalendarProps {
|
|
|
56
56
|
className?: string | undefined;
|
|
57
57
|
/** Inline style on the element. */
|
|
58
58
|
style?: CSSProperties | undefined;
|
|
59
|
+
ref?: Ref<HTMLElement> | undefined;
|
|
59
60
|
}
|
|
60
|
-
|
|
61
|
+
/**
|
|
62
|
+
* Shows events on a month, week, day or list view, in India Standard Time unless `timeZone` is set, with weeks starting on
|
|
63
|
+
* `firstDay` (Monday unless the theme or the prop says otherwise). The calendar is the shared
|
|
64
|
+
* `<wui-calendar>` element, the same one the Razor `<app-calendar>` uses, with its calendar engine
|
|
65
|
+
* loaded the first time a calendar mounts: a page without a calendar never downloads it.
|
|
66
|
+
*
|
|
67
|
+
* Give it events as data (`events`), or an address (`eventsUrl`) it calls whenever the visible
|
|
68
|
+
* period changes, with `start`, `end` and `view` (month, week, day or list) query parameters: IST
|
|
69
|
+
* `YYYY-MM-DD` days, `end` being the first day not shown. The address answers with a JSON list of
|
|
70
|
+
* events. An event is `{ id, title, start, end, allDay, tone, url, stack }`: `start` and `end` are a
|
|
71
|
+
* `YYYY-MM-DD` day or an ISO date-time (an offset or Z is shifted to IST, no offset is already IST);
|
|
72
|
+
* `end` is the first moment after the event, so an all-day event on the 4th ends on the 5th; `tone`
|
|
73
|
+
* colours it from the theme (neutral, primary, success, warning, danger, info); `url` makes it a
|
|
74
|
+
* link. `stack` is `{ count, url, label }`: the card shows a `+count` link of its own to `url` with
|
|
75
|
+
* `label` as its tooltip, for a card that stands for several events; the card's own click is unchanged.
|
|
76
|
+
*
|
|
77
|
+
* Every day can be reached by keyboard: one tab stop among the days, the arrow keys move between
|
|
78
|
+
* them, Home and End go to the first and last day of the week, Page Up and Page Down to the
|
|
79
|
+
* previous and next month, Enter opens the day. A calendar given no `view` opens as a list when it
|
|
80
|
+
* is narrower than a phone.
|
|
81
|
+
*
|
|
82
|
+
* ```jsx
|
|
83
|
+
* <AppCalendar
|
|
84
|
+
* label="Team leave"
|
|
85
|
+
* eventsUrl="/api/leave"
|
|
86
|
+
* onEventClick={(event) => openLeave(event.id)}
|
|
87
|
+
* onDateClick={({ date }) => startRequest(date)}
|
|
88
|
+
* />
|
|
89
|
+
* ```
|
|
90
|
+
*
|
|
91
|
+
* @param props
|
|
92
|
+
* @param [props.label]
|
|
93
|
+
* @param [props.events]
|
|
94
|
+
* @param [props.eventsUrl]
|
|
95
|
+
* @param [props.view]
|
|
96
|
+
* @param [props.date]
|
|
97
|
+
* @param [props.emptyText]
|
|
98
|
+
* @param [props.firstDay]
|
|
99
|
+
* @param [props.timeZone]
|
|
100
|
+
* @param [props.errorText]
|
|
101
|
+
* @param [props.onEventClick] An event was clicked, or Enter was pressed on it. Gets the event as it was given. Return `false` to stop an event's own link.
|
|
102
|
+
* @param [props.onDateClick] A day was clicked, or Enter was pressed on it; `time` is set for a click on a time slot.
|
|
103
|
+
* @param [props.onRangeChange] The view or the visible period changed.
|
|
104
|
+
* @param [props.className]
|
|
105
|
+
* @param [props.style]
|
|
106
|
+
* @param [ref] The `<wui-calendar>` element, which has `refetch()`.
|
|
107
|
+
*/
|
|
108
|
+
declare function AppCalendar({ ref, ...props }: AppCalendarProps): JSX.Element;
|
|
61
109
|
export default AppCalendar;
|