@webority/ui-react 0.150.0 → 0.153.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 +200 -200
- package/dist/canvas-kit/manifest.json +624 -31
- package/dist/canvas-kit/release.json +6 -6
- package/dist/components/AppAlert.js +1 -1
- package/dist/components/AppAsyncBlock.js +1 -1
- package/dist/components/AppBreadcrumbs.js +1 -1
- package/dist/components/AppButton.js +1 -1
- package/dist/components/AppCard.js +1 -1
- package/dist/components/AppCarousel.js +1 -1
- package/dist/components/AppCompareTable.js +1 -1
- package/dist/components/AppDashboardCell.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/AppFilterBar.js +1 -1
- package/dist/components/AppForm.js +1 -0
- package/dist/components/AppInlineEdit.js +1 -1
- package/dist/components/AppInput.js +1 -1
- package/dist/components/AppKanban.js +1 -1
- package/dist/components/AppLink.js +1 -1
- package/dist/components/AppModal.js +1 -1
- package/dist/components/AppPopover.js +1 -1
- package/dist/components/AppSearch.js +1 -1
- package/dist/components/AppSectionLeadCapture.js +1 -1
- package/dist/components/AppSelect.js +1 -1
- package/dist/components/AppShell.js +1 -1
- package/dist/components/AppTextarea.js +1 -1
- package/dist/components/AppThemeToggle.js +1 -1
- package/dist/components/AppTooltip.js +1 -1
- package/dist/components/AppWizard.js +1 -1
- package/dist/guidance.json +160 -16
- package/dist/lib/useFileDrop.js +1 -1
- package/dist/types/components/AppAsyncBlock.d.ts +2 -2
- package/dist/types/components/AppBreadcrumbs.d.ts +11 -0
- package/dist/types/components/AppButton.d.ts +3 -3
- package/dist/types/components/AppCompareTable.d.ts +7 -0
- package/dist/types/components/AppDashboardCell.d.ts +9 -5
- package/dist/types/components/AppDashboardGrid.d.ts +6 -5
- package/dist/types/components/AppDropdown.d.ts +19 -0
- package/dist/types/components/AppForm.d.ts +23 -0
- package/dist/types/components/AppKanban.d.ts +5 -0
- package/dist/types/components/AppLink.d.ts +2 -2
- package/dist/types/components/AppSearch.d.ts +1 -1
- package/dist/types/components/AppSelect.d.ts +7 -2
- package/dist/types/components/AppShell.d.ts +6 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/ui-react.js +1 -1
- package/dist/web-core/dist/api/idempotencyKey.js +1 -0
- package/package.json +10 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/DiscardPrompt.js";import{devWarn as t}from"../lib/devWarn.js";import{lockPageScroll as n}from"../lib/pageScrollLock.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./AppIcon.js";import a from"./assertValidValue.js";import o from"./warnUnknownProps.js";import{useCallback as ee,useEffect as s,useRef as c,useState as l}from"react";import{Modal as te}from"react-bootstrap";import{jsx as u,jsxs as d}from"react/jsx-runtime";var f=[`neutral`,`danger`,`success`,`warning`],
|
|
1
|
+
import e from"../lib/DiscardPrompt.js";import{devWarn as t}from"../lib/devWarn.js";import{lockPageScroll as n}from"../lib/pageScrollLock.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./AppIcon.js";import a from"./assertValidValue.js";import o from"./warnUnknownProps.js";import{useCallback as ee,useEffect as s,useRef as c,useState as l}from"react";import{Modal as te}from"react-bootstrap";import{jsx as u,jsxs as d}from"react/jsx-runtime";var f=[`neutral`,`danger`,`success`,`warning`],ne=[`center`,`top`],p=`a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])`,m={sm:380,md:440,lg:640,xl:880},re=`wui-modal-fullscreen`,ie=e=>typeof e==`number`?e:e===`fullscreen`?m.md:m[e],h=!1;function ae(){let e=!0;try{e=process.env.NODE_ENV!==`production`}catch{e=!0}e&&!h&&(h=!0,t("[@webority/ui-react] <AppModal hideHeader> has no accessible name: pass `ariaLabel` (or a string `title`)."))}function oe(e,t){if(e.key!==`Tab`)return;let n=Array.from(t.querySelectorAll(p));if(!n.length){e.preventDefault(),t.focus();return}let r=n[0],i=n[n.length-1];if(!r||!i)return;let a=document.activeElement;e.shiftKey&&(a===r||a===t)?(e.preventDefault(),i.focus()):!e.shiftKey&&a===i&&(e.preventDefault(),r.focus())}function se(){let e=[];for(let t of document.body.children)t.hasAttribute(`inert`)||t.matches(`.modal, .modal-backdrop`)||(t.setAttribute(`inert`,``),e.push(t));return e}function ce(){return typeof document<`u`&&document.querySelector(`wui-drawer[open], .offcanvas.show`)!==null}function g(t){let{marker:h,props:g}=r(`AppModal`,t),{open:_,eyebrow:v,title:y,subtitle:b,headerIcon:x,tone:S=`neutral`,dismissible:le=!0,onClose:C,onBack:w,backLabel:T=`Back`,headerActions:E,footer:D,size:O=`md`,placement:k=`center`,hideHeader:A=!1,staticBackdrop:j=!0,closeOnEscape:M=!0,confirmDiscard:N,dirty:ue=!1,ariaLabel:P,closeLabel:de=`Close`,className:fe=``,children:pe,...F}=g;o(`AppModal`,F),a(`AppModal`,`tone`,S,f),a(`AppModal`,`placement`,k,ne),a(`AppModal`,`size`,typeof O==`string`?O:null,[...Object.keys(m),`fullscreen`]);let{style:I,ref:L,onExited:R,"data-wui":z,"data-wui-props":me,...he}=F,B=z?{"data-wui":z,"data-wui-props":me}:h,V=B[`data-wui`],H=B[`data-wui-props`];A&&!P&&typeof y!=`string`&&ae();let U=c(null),W=c(null),[G,ge]=l(null);s(()=>{ge(_?W.current?.dialog??null:null)},[_]);let K=c(null),[q,J]=l(!1);s(()=>{_||J(!1)},[_]),s(()=>{q&&K.current?.focus()},[q]),s(()=>{if(_)return n()},[_]),s(()=>{G&&(N?G.setAttribute(`confirm-discard`,N):G.removeAttribute(`confirm-discard`))},[G,N]);let _e=ee(e=>{W.current=e,typeof L==`function`?L(e):L&&(L.current=e)},[L]);s(()=>{G&&(G.setAttribute(`data-wui`,String(V)),H===void 0?G.removeAttribute(`data-wui-props`):G.setAttribute(`data-wui-props`,H))},[G,V,H]),s(()=>{if(!_)return;let e=U.current?.closest(`.modal-content`);if(!e)return;let t=()=>Array.from(e.querySelectorAll(p));(e.querySelector(`[data-autofocus]`)||t().find(e=>!e.classList.contains(`wui-modal-close`)&&!e.classList.contains(`wui-modal-back`))||t()[0]||e).focus?.({preventScroll:!0});let n=e.closest(`.modal`),r=se(),i=e=>{n&&oe(e,n)};return n?.addEventListener(`keydown`,i),()=>{n?.removeEventListener(`keydown`,i);for(let e of r)e.removeAttribute(`inert`);n&&setTimeout(()=>{n.isConnected&&!n.classList.contains(`show`)&&n.dispatchEvent(new Event(`transitionend`,{bubbles:!0}))},500)}},[_]);let Y=()=>{N&&ue?J(!0):C?.()},X=e=>{let t=e.target;t instanceof Element&&t.closest(`[data-wui-dismiss]`)&&Y()},ve=()=>{J(!1),C?.()},ye=()=>{J(!1),(U.current?.querySelector(`input:not([type="hidden"]):not([disabled]),select:not([disabled]),textarea:not([disabled])`))?.focus()},Z=O===`fullscreen`,be=ie(O),xe=[`wui-modal`,S===`neutral`?``:`tone-${S}`,fe].filter(Boolean).join(` `),Q=_&&ce(),Se=[`wui-modal-shell`,Z&&re,Q&&`wui-modal-stacked`].filter(Boolean).join(` `),$=Z?I:{"--wui-modal-max-width":`${be}px`,...I};return/* @__PURE__ */ d(te,{...he,...R?{onExited:R}:null,ref:_e,show:_,onHide:Y,backdrop:!j||`static`,keyboard:M,autoFocus:!1,enforceFocus:!0,restoreFocus:!0,centered:k!==`top`,className:Se,...$?{style:$}:null,dialogClassName:`wui-rb-dialog`,contentClassName:xe,backdropClassName:Q?`wui-modal-dim wui-modal-backdrop-stacked`:`wui-modal-dim`,"aria-label":P||(typeof y==`string`?y:void 0),children:[!A&&/* @__PURE__ */ d(`div`,{className:`wui-modal-header`,children:[w&&/* @__PURE__ */ u(`button`,{type:`button`,className:`wui-modal-back`,onClick:w,"aria-label":T,children:/* @__PURE__ */ u(i,{name:`arrow-left`,size:18})}),/* @__PURE__ */ d(`div`,{className:`wui-modal-heading`,children:[x&&/* @__PURE__ */ u(`span`,{className:`wui-modal-headicon`,children:/* @__PURE__ */ u(i,{name:x,size:18})}),/* @__PURE__ */ d(`div`,{className:`wui-modal-headtext`,children:[v&&/* @__PURE__ */ u(`div`,{className:`wui-modal-eyebrow`,children:v}),/* @__PURE__ */ u(`div`,{className:`wui-modal-title`,children:y}),b&&/* @__PURE__ */ u(`div`,{className:`wui-modal-subtitle`,children:b})]})]}),E&&/* @__PURE__ */ u(`div`,{className:`wui-modal-header-actions`,children:E}),le&&/* @__PURE__ */ u(`button`,{type:`button`,className:`wui-modal-close`,onClick:Y,"aria-label":de,children:/* @__PURE__ */ u(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:/* @__PURE__ */ u(`path`,{d:`M18 6 6 18M6 6l12 12`})})})]}),/* @__PURE__ */ u(`div`,{className:`wui-modal-body`,ref:U,onClick:X,children:pe}),(D||q)&&/* @__PURE__ */ d(`div`,{className:q?`wui-modal-footer wui-drawer-discarding`:`wui-modal-footer`,onClick:X,children:[q&&/* @__PURE__ */ u(e,{text:N,confirmRef:K,onDiscard:ve,onKeep:ye}),D]})]})}export{g as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/FocusPanel.js";import t from"./assertValidValue.js";import ee from"./warnUnknownProps.js";import{cloneElement as n,useCallback as r,useEffect as i,useId as a,useRef as o,useState as s}from"react";import{OverlayTrigger as te,Popover as c}from"react-bootstrap";import{jsx as l,jsxs as u}from"react/jsx-runtime";var d={start:`left`,end:`right`,top:`top`,bottom:`bottom`,auto:`auto`},f={modifiers:[{name:`computeStyles`,options:{gpuAcceleration:!1}}]},p=[`dialog`];function m({trigger:m,children:h,title:g,placement:_=`bottom`,triggerType:v=`click`,onOpenChange:y,className:b=``,open:x,role:S,labelledBy:C,autoFocus:w=!1,openDelay:T=80,closeDelay:E=220,...D}){ee(`AppPopover`,D),t(`AppPopover`,`role`,S,p);let O=a(),k=`${O}-title`,A=o(null),[j,M]=s(null),N=m.props.ref,ne=r(e=>{M(e),typeof N==`function`?N(e):N&&(N.current=e)},[N]),[P,F]=s(!1),I=x!==void 0,L=I?x:P,R=S===`dialog`,z=v===`hover`||Array.isArray(v)&&v.includes(`hover`),B=z&&!I,V=L&&j!==null,H=o(null),U=o(P);U.current=P;let W=()=>{clearTimeout(H.current??void 0),H.current=null},G=(e,t)=>{W(),H.current=setTimeout(()=>{H.current=null,e!==U.current&&(F(e),y?.(e))},t)};i(()=>()=>clearTimeout(H.current??void 0),[]),i(()=>{if(!B||!P)return;let e=e=>{e.key===`Escape`&&(clearTimeout(H.current??void 0),H.current=null,F(!1),y?.(!1))};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[B,P,y]);let K=e=>{B?G(e,e?T:E):(I||F(e),y?.(e))},q=R?{role:`dialog`,"aria-modal":!1,"aria-labelledby":C??(g?k:void 0)}:{},J=B?{onMouseEnter:W,onMouseLeave:()=>G(!1,E),onFocus:W,onBlur:e=>{let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||G(!1,E)}}:{},Y=/* @__PURE__ */ u(c,{id:O,className:b||void 0,...q,...J,children:[w&&/* @__PURE__ */ l(e,{triggerRef:A}),g&&/* @__PURE__ */ l(c.Header,{as:`div`,id:k,children:g}),h==null?null:/* @__PURE__ */ l(c.Body,{children:h})]}),{onClick:X,"aria-expanded":Z,...re}=D,Q=m.props[`aria-expanded`],$,ie=v===`click`||Array.isArray(v)&&v.includes(`click`);Z===void 0?Q===void 0?ie&&($=L):$=Q:$=Z;let ae=n(m,{...re,...$===void 0?{}:{"aria-expanded":$},ref:ne,onClick:e=>{A.current=e.currentTarget,X?.(e),typeof m.props.onClick==`function`&&m.props.onClick(e)}}),oe=v===`click`;return/* @__PURE__ */ l(te,{trigger:v,placement:d[_]||_,popperConfig:f,overlay:Y,rootClose:oe||R
|
|
1
|
+
import e from"../lib/FocusPanel.js";import t from"./assertValidValue.js";import ee from"./warnUnknownProps.js";import{cloneElement as n,useCallback as r,useEffect as i,useId as a,useRef as o,useState as s}from"react";import{OverlayTrigger as te,Popover as c}from"react-bootstrap";import{jsx as l,jsxs as u}from"react/jsx-runtime";var d={start:`left`,end:`right`,top:`top`,bottom:`bottom`,auto:`auto`},f={modifiers:[{name:`computeStyles`,options:{gpuAcceleration:!1}}]},p=[`dialog`];function m({trigger:m,children:h,title:g,placement:_=`bottom`,triggerType:v=`click`,onOpenChange:y,className:b=``,open:x,role:S,labelledBy:C,autoFocus:w=!1,openDelay:T=80,closeDelay:E=220,...D}){ee(`AppPopover`,D),t(`AppPopover`,`role`,S,p);let O=a(),k=`${O}-title`,A=o(null),[j,M]=s(null),N=m.props.ref,ne=r(e=>{M(e),typeof N==`function`?N(e):N&&(N.current=e)},[N]),[P,F]=s(!1),I=x!==void 0,L=I?x:P,R=S===`dialog`,z=v===`hover`||Array.isArray(v)&&v.includes(`hover`),B=z&&!I,V=L&&j!==null,H=o(null),U=o(P);U.current=P;let W=()=>{clearTimeout(H.current??void 0),H.current=null},G=(e,t)=>{W(),H.current=setTimeout(()=>{H.current=null,e!==U.current&&(F(e),y?.(e))},t)};i(()=>()=>clearTimeout(H.current??void 0),[]),i(()=>{if(!B||!P)return;let e=e=>{e.key===`Escape`&&(clearTimeout(H.current??void 0),H.current=null,F(!1),y?.(!1))};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[B,P,y]);let K=e=>{B?G(e,e?T:E):(I||F(e),y?.(e))},q=R?{role:`dialog`,"aria-modal":!1,"aria-labelledby":C??(g?k:void 0)}:{},J=B?{onMouseEnter:W,onMouseLeave:()=>G(!1,E),onFocus:W,onBlur:e=>{let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||G(!1,E)}}:{},Y=/* @__PURE__ */ u(c,{id:O,className:b||void 0,...q,...J,children:[w&&/* @__PURE__ */ l(e,{triggerRef:A}),g&&/* @__PURE__ */ l(c.Header,{as:`div`,id:k,children:g}),h==null?null:/* @__PURE__ */ l(c.Body,{children:h})]}),{onClick:X,"aria-expanded":Z,...re}=D,Q=m.props[`aria-expanded`],$,ie=v===`click`||Array.isArray(v)&&v.includes(`click`);Z===void 0?Q===void 0?ie&&($=L):$=Q:$=Z;let ae=n(m,{...re,...$===void 0?{}:{"aria-expanded":$},ref:ne,onClick:e=>{A.current=e.currentTarget,X?.(e),typeof m.props.onClick==`function`&&m.props.onClick(e)}}),oe=v===`click`;return/* @__PURE__ */ l(te,{trigger:v,placement:d[_]||_,popperConfig:f,overlay:Y,rootClose:oe||R,...I&&z?{delay:{show:T,hide:E}}:{},onToggle:K,...I||z?{show:V}:{},children:ae})}export{m as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./AppIcon.js";import n from"./assertValidValue.js";import r from"./warnUnknownProps.js";import{isTypingTarget as i}from"@webority/ui-elements/helpers";import{useCallback as a,useEffect as o,useRef as s,useState as c}from"react";import{Form as l}from"react-bootstrap";import{jsx as u,jsxs as d}from"react/jsx-runtime";import{flushSync as f}from"react-dom";var p=[`sm`,`md`,`lg`];function m(m){let{marker:h,props:g}=e(`AppSearch`,m),{value:_,defaultValue:v,onChange:y,placeholder:b=`Search…`,ariaLabel:x,clearLabel:S=`Clear search`,searchLabel:C=`Search`,iconSize:w,size:T,loading:E=!1,collapsible:D=!1,disabled:O=!1,className:k=``,form:A,onKeyDown:j,...M}=g;r(`AppSearch`,M)
|
|
1
|
+
import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./AppIcon.js";import n from"./assertValidValue.js";import r from"./warnUnknownProps.js";import{isTypingTarget as i}from"@webority/ui-elements/helpers";import{useCallback as a,useEffect as o,useRef as s,useState as c}from"react";import{Form as l}from"react-bootstrap";import{jsx as u,jsxs as d}from"react/jsx-runtime";import{flushSync as f}from"react-dom";var p=[`sm`,`md`,`lg`];function m(m){let{marker:h,props:g}=e(`AppSearch`,m),{value:_,defaultValue:v,onChange:y,placeholder:b=`Search…`,ariaLabel:x,clearLabel:S=`Clear search`,searchLabel:C=`Search`,iconSize:w,size:T,loading:E=!1,collapsible:D=!1,disabled:O=!1,className:k=``,form:A,onKeyDown:j,...M}=g;r(`AppSearch`,M);let{readOnly:N,...P}=M;n(`AppSearch`,`size`,T,p);let F=w??18,[I,L]=c(v??``),R=_===void 0?I:_,[z,B]=c(!!R),V=s(null),H=s(null),U=!D||z||!!R,W=a(()=>{B(!0),requestAnimationFrame(()=>V.current?.focus())},[]),G=()=>{L(``),f(()=>y?.(``)),V.current?.form?.requestSubmit()};o(()=>{if(!D)return;let e=e=>{e.key!==`/`||e.ctrlKey||e.altKey||e.metaKey||i(e.target instanceof Node?e.target:null)||[...document.querySelectorAll(`.search-wrap.wui-search-collapsible`)].find(e=>e.offsetParent!==null)===H.current&&(e.preventDefault(),W())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[D,W]);let K=[`search-wrap`,R?`has-value`:``,T===`sm`?`search-sm`:T===`lg`?`search-lg`:``,E?`is-loading`:``,D?`wui-search-collapsible`:``,D&&!U?`is-collapsed`:``,k].filter(Boolean).join(` `),q=w==null?void 0:{"--wui-search-icon-size":`${w}px`};return/* @__PURE__ */ d(`div`,{...h,className:K,style:q,ref:H,onBlur:e=>{D&&!e.currentTarget.contains(e.relatedTarget)&&!R&&B(!1)},children:[D&&/* @__PURE__ */ u(`button`,{type:`button`,className:`wui-search-toggle`,"aria-label":x||b||C,"aria-expanded":U?`true`:`false`,onClick:W,children:/* @__PURE__ */ u(t,{name:`search`,size:F})}),E&&/* @__PURE__ */ u(`span`,{className:`search-spinner`,"aria-hidden":`true`}),/* @__PURE__ */ u(t,{name:`search`,size:F,className:`search-icon`}),/* @__PURE__ */ u(l.Control,{ref:V,type:`search`,className:`input search-input`,placeholder:b,value:R,onChange:e=>{L(e.target.value),y?.(e.target.value)},onKeyDown:e=>{j?.(e),D&&e.key===`Escape`&&!R&&B(!1)},"aria-label":x,form:A,disabled:O,...N===void 0?null:{readOnly:N},...P}),!O&&/* @__PURE__ */ u(`button`,{type:`button`,className:`search-clear`,"aria-label":S,onClick:G,hidden:!R,children:/* @__PURE__ */ u(t,{name:`x`,size:16})})]})}export{m as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e,{SECTION_ALIGNS as t,SECTION_HEADINGS as n,SECTION_VARIANTS as r,sectionHeading as i}from"../lib/sectionShell.js";import{splitMarkerProps as a}from"../lib/wuiMarker.js";import o from"./AppAlert.js";import s from"./AppButton.js";import c from"./
|
|
1
|
+
import e,{SECTION_ALIGNS as t,SECTION_HEADINGS as n,SECTION_VARIANTS as r,sectionHeading as i}from"../lib/sectionShell.js";import{splitMarkerProps as a}from"../lib/wuiMarker.js";import o from"./AppAlert.js";import s from"./AppButton.js";import c from"./AppForm.js";import l from"./AppInput.js";import ee from"./AppPhoneNumberInput.js";import u from"./AppTextarea.js";import d from"./assertValidValue.js";import te from"./warnUnknownProps.js";import{useId as ne,useState as f}from"react";import{jsx as p,jsxs as m}from"react/jsx-runtime";var h=[`name`,`email`,`phone`,`company`,`message`],g={name:`name`,email:`email`,company:`organization`},_=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function v(e,t,n){let r={};for(let{name:i,required:a=!1}of e){let e=(t[i]??``).trim();a&&e===``?r[i]=n.required:i===`email`&&e!==``&&!_.test(e)&&(r[i]=n.invalidEmail)}return r}function y(_){let{marker:y,props:b}=a(`AppSectionLeadCapture`,_),{title:x,description:S,fields:C,onSubmit:w,submitLabel:T=`Send`,nameLabel:E=`Name`,emailLabel:D=`Email`,phoneLabel:O=`Phone number`,companyLabel:k=`Company`,messageLabel:A=`Message`,requiredText:j=`This field is required.`,invalidEmailText:M=`Enter an email address such as name@example.com.`,submitErrorText:N=`We could not send your message. Please try again.`,successTitle:P,successText:F,consent:I,as:L=`h2`,eyebrow:R,subtitle:z,align:B=`center`,variant:V=`default`,className:H=``,...U}=b;te(`AppSectionLeadCapture`,U),d(`AppSectionLeadCapture`,`as`,L,n),d(`AppSectionLeadCapture`,`align`,B,t),d(`AppSectionLeadCapture`,`variant`,V,r);for(let e of C)d(`AppSectionLeadCapture`,`fields.name`,e.name,h);let W=ne(),[G,K]=f(()=>Object.fromEntries(C.map(e=>[e.name,``]))),[q,J]=f({}),[Y,X]=f(null),[Z,Q]=f(!1),[re,ie]=f(!1),$=(e,t)=>K(n=>({...n,[e]:t})),ae={name:E,email:D,phone:O,company:k,message:A},oe={required:j,invalidEmail:M};async function se(){if(Z)return!1;let e=v(C,G,oe);if(J(e),X(null),Object.keys(e).length>0)return!1;let t=Object.fromEntries(Object.entries(G).map(([e,t])=>[e,(t??``).trim()]));Q(!0);try{return await w(t),ie(!0),!0}catch(e){let t=typeof e==`object`&&e&&`message`in e?e.message:void 0;return X(typeof t==`string`&&t!==``?t:N),!1}finally{Q(!1)}}function ce({name:e,label:t=ae[e],required:n=!1}){let r=`${W}-${e}`,i=q[e];return e===`phone`?/* @__PURE__ */ p(ee,{id:r,name:e,label:t,required:n,value:G[e],onChange:t=>$(e,t),error:i},e):e===`message`?/* @__PURE__ */ p(u,{id:r,name:e,label:t,required:n,value:G[e],onChange:t=>$(e,t.target.value),error:i},e):/* @__PURE__ */ p(l,{id:r,name:e,type:e===`email`?`email`:`text`,autoComplete:g[e],label:t,required:n,value:G[e],onChange:t=>$(e,t.target.value),error:i},e)}return/* @__PURE__ */ m(e,{component:`AppSectionLeadCapture`,kind:`lead-capture`,title:x,as:i(L,`h2`),eyebrow:R,subtitle:z,align:B,variant:V,className:H,rest:{...y,...U},children:[S!=null&&S!==``&&/* @__PURE__ */ p(`p`,{className:`wui-section-lead-text`,children:S}),re?/* @__PURE__ */ p(`div`,{className:`wui-section-lead-success`,children:/* @__PURE__ */ p(o,{tone:`success`,title:P,children:F})}):/* @__PURE__ */ m(c,{className:`wui-section-lead-form`,noValidate:!0,onSubmit:se,children:[/* @__PURE__ */ p(`div`,{className:`wui-section-lead-fields`,children:C.map(ce)}),Y!=null&&/* @__PURE__ */ p(o,{tone:`danger`,children:Y}),/* @__PURE__ */ p(s,{type:`submit`,loading:Z,children:T}),I!=null&&I!==``&&/* @__PURE__ */ p(`p`,{className:`wui-section-lead-consent`,children:I})]})]})}export{y as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/FieldMessage.js";import{loadFlagStyles as n}from"../lib/flagStyles.js";import r from"../lib/useElementEntry.js";import{splitMarkerProps as ee}from"../lib/wuiMarker.js";import te from"./AppInfoTip.js";import ne from"./AppRequiredMark.js";import i from"./assertValidValue.js";import
|
|
1
|
+
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/FieldMessage.js";import{loadFlagStyles as n}from"../lib/flagStyles.js";import r from"../lib/useElementEntry.js";import{splitMarkerProps as ee}from"../lib/wuiMarker.js";import te from"./AppInfoTip.js";import ne from"./AppRequiredMark.js";import i from"./assertValidValue.js";import a from"./textOf.js";import re from"./useNodeLabels.js";import ie,{optionsEqual as ae}from"./useWuiControl.js";import oe from"./warnUnknownProps.js";import{forwardRef as o,useEffect as s,useId as se,useLayoutEffect as c,useMemo as ce,useRef as l}from"react";import{Fragment as le,jsx as u,jsxs as d}from"react/jsx-runtime";var ue=[`single`,`multiple`,`search`,`tag`,`country`],de=[`comfortable`,`compact`],f=[`sm`,`md`,`lg`],fe=[`off`,`border`,`above`],pe=[],p=[],me=()=>import(`@webority/ui-elements/elements/select`),he=e=>e===`multiple`||e===`tag`,m=e=>e!=null&&e!==``,h=e=>{throw Error(`<AppSelect> controlOnly draws no field, so it takes no ${e}; draw the label or message on the page.`)},ge=(e,t)=>{let n=t??``;String(e.value??``)!==String(n)&&(e.value=n)},_e=(e,t)=>{let n=Array.isArray(t)?t:p,r=Array.isArray(e.value)?e.value:p;n.length===r.length&&n.every((e,t)=>e===r[t])||(e.value=n)},ve=(e,t)=>({...e,label:t}),ye=e=>Array.isArray(e)?e.join(`,`):e,be=o(function(o,be){let g=r(`wui-select`,me),{marker:_,props:xe}=ee(`AppSelect`,o),{mode:v=`single`,density:y=`comfortable`,size:b,value:Se,defaultValue:x,onChange:Ce,options:S=pe,loadOptions:C,remote:w=!1,onSearch:we,validate:T,placeholder:Te,searchPlaceholder:Ee,emptyText:De,searchable:E,clearable:Oe=!1,openOnHover:ke=!1,icon:Ae,valuePrefix:D,prefix:O,suffix:k,floatingLabel:A=`off`,disabled:je,readOnly:Me=!1,loading:Ne=!1,open:Pe,label:j,required:M=!1,optional:N=!1,optionalLabel:P=`(optional)`,error:F,helperText:I,help:L,helpLabel:Fe=`More information`,id:Ie,name:Le,minChars:R,debounce:z,allowCustom:Re=!1,addLabel:ze,searchingText:Be,hintText:Ve,valueLabel:He,valueAvatar:Ue,valueInitials:We,maxTags:B,allowDuplicates:Ge=!1,separators:Ke,pattern:qe,invalidMessage:Je,createLabel:Ye,collapseChips:Xe=!1,selectedText:Ze,clearAllLabel:Qe,countries:$e,suggested:et,suggestedLabel:tt,allCountriesLabel:nt,recentsKey:rt,recentsLimit:V,recentsLabel:it,className:at=``,fieldClassName:H=``,controlOnly:U=!1,"aria-label":ot,"aria-labelledby":st,"aria-describedby":ct,...lt}=xe;oe(`AppSelect`,lt),i(`AppSelect`,`mode`,v,ue),i(`AppSelect`,`density`,y,de),i(`AppSelect`,`size`,b,f);let W=he(v);i(`AppSelect`,`floatingLabel`,A,W?[`off`]:fe);let ut=l(!1);W&&(O!=null||k!=null)&&!ut.current&&(ut.current=!0,e(`AppSelect: prefix and suffix are not drawn in mode="${v}"; they are ignored.`));let dt=se(),G=l(!1);s(()=>{v===`country`&&n()},[v]);let{setRef:ft,innerRef:K}=ie({ready:g,ref:be,value:Se??(x===void 0?W?p:``:void 0),defaultValue:x,writeValue:W?_e:ge,on:{change:e=>{let t=e.currentTarget.value,n={isCustom:!!e.detail?.isCustom};switch(o.mode){case`multiple`:Array.isArray(t)&&o.onChange?.(t);break;case`tag`:Array.isArray(t)&&o.onChange?.(t,n);break;case`search`:typeof t==`string`&&o.onChange?.(t,n);break;default:typeof t==`string`&&o.onChange?.(t)}},search:e=>{w&&typeof C!=`function`&&we?.(e.detail.query,{seq:e.detail.seq})}}}),pt=ce(()=>typeof C==`function`?(e,t)=>new Promise(n=>n(C(e,t))).then(e=>(G.current=!0,e),e=>{throw G.current=!0,e}):null,[C]),{portal:mt,toElementOptions:q}=re(S),J=l({el:null,options:null,map:null});c(()=>{let e=K.current;if(!e||!g||J.current.el===e&&J.current.options===S&&J.current.map===q||(J.current={el:e,options:S,map:q},C&&G.current))return;let t=q(S,ve);ae(t,e.options)||(e.options=t)}),c(()=>{let e=K.current;if(!e||!g)return;e.loadOptions!==pt&&(e.loadOptions=pt);let t=typeof T==`function`?T:null;e.validate!==t&&(e.validate=t)}),c(()=>{K.current?.toggleAttribute(`loading`,!!Ne)});let Y=Ie||dt,X=!W&&A!==`off`&&j,ht=F&&Y?`${Y}-error`:void 0,gt=I&&Y?`${Y}-hint`:void 0,_t=ht||gt||ct;s(()=>{let e=K.current;e&&(D==null||D===``?e.removeAttribute(`prefix`):e.setAttribute(`prefix`,D))},[D,K]);let vt=!W&&!X&&(O!=null||k!=null),yt=v===`multiple`||v===`tag`||v===`country`;if(U&&(m(j)&&h(`label`),m(F)&&h(`error`),m(I)&&h(`helperText`),m(H)&&h(`fieldClassName`),yt))throw Error(`<AppSelect> controlOnly draws no field, so it takes no mode="${v}"; that mode always draws its field.`);let Z=U||!yt&&!j&&!F&&!I&&!H,bt=a(j).trim(),xt=bt&&(v===`single`||v===`multiple`||v===`search`)?`Search ${bt}…`:void 0,St=/* @__PURE__ */ u(`wui-select`,{"aria-label":ot||a(j)||void 0,"aria-labelledby":st||void 0,"aria-describedby":_t||void 0,"aria-invalid":F?`true`:void 0,ref:ft,id:Y,name:Le,mode:v,density:y===`compact`?`compact`:void 0,placeholder:X?` `:Te||void 0,"search-placeholder":Ee||xt,"empty-text":De||void 0,searchable:E===void 0?void 0:E?`true`:`false`,clearable:Oe?``:void 0,"open-on-hover":ke?``:void 0,size:b!==`md`&&f.includes(b??``)?b:void 0,icon:Ae||void 0,disabled:je?``:void 0,readonly:Me?``:void 0,open:Pe?``:void 0,required:M?``:void 0,"min-chars":R==null?void 0:String(R),debounce:z==null?void 0:String(z),remote:w?``:void 0,"allow-custom":Re?``:void 0,"add-label":ze||void 0,"searching-text":Be||void 0,"hint-text":Ve||void 0,"value-label":He||void 0,"value-avatar":Ue||void 0,"value-initials":We||void 0,"max-tags":B==null?void 0:String(B),"allow-duplicates":Ge?``:void 0,separators:Ke||void 0,pattern:qe||void 0,"invalid-message":Je||void 0,"create-label":Ye||void 0,"collapse-chips":Xe?``:void 0,"selected-text":Ze||void 0,"clear-all-label":Qe||void 0,countries:ye($e)||void 0,suggested:ye(et)||void 0,"suggested-label":tt||void 0,"all-countries-label":nt||void 0,"recents-key":rt||void 0,"recents-limit":V==null?void 0:String(V),"recents-label":it||void 0,className:at||void 0,...Z&&!vt?_:null,...lt}),Q=/* @__PURE__ */ d(le,{children:[St,mt]}),$=vt?/* @__PURE__ */ d(`div`,{...Z?_:null,className:`input-affixed`,children:[O!=null&&/* @__PURE__ */ u(`span`,{className:`affix affix-pre`,children:O}),Q,k!=null&&/* @__PURE__ */ u(`span`,{className:`affix affix-suf`,children:k})]}):Q;if(Z)return $;let Ct=[`field`,H].filter(Boolean).join(` `);return/* @__PURE__ */ d(`div`,{..._,className:Ct,children:[j&&!X&&/* @__PURE__ */ d(`label`,{className:`label`,htmlFor:Y,children:[j,N&&!M&&/* @__PURE__ */ u(`span`,{className:`label-optional`,children:` ${P}`}),M&&/* @__PURE__ */ u(ne,{}),L&&/* @__PURE__ */ u(te,{label:Fe,children:L})]}),X?/* @__PURE__ */ d(`div`,{className:A===`above`?`field-float wui-float-above`:`field-float`,children:[Q,/* @__PURE__ */ d(`label`,{className:`float-label`,htmlFor:Y,children:[j,N&&!M&&/* @__PURE__ */ u(`span`,{className:`label-optional`,children:` ${P}`}),M&&/* @__PURE__ */ u(ne,{})]})]}):$,/* @__PURE__ */ u(t,{error:F,hint:I,errorId:ht,hintId:gt})]})});export{be as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/fillLabel.js";import{linkTarget as n}from"../lib/linkTarget.js";import{navMatchScore as r}from"../lib/navMatch.js";import{SHELL_FOLDED_COOKIE as i,readNavFolded as a,readShellCollapsed as o,writeNavFolded as s,writeShellCollapsed as c}from"../lib/shellCookie.js";import{TargetLink as l}from"../lib/TargetLink.js";import{splitMarkerProps as u}from"../lib/wuiMarker.js";import d from"./AppAvatar.js";import f from"./AppButton.js";import p from"./AppIcon.js";import m from"./AppNavigationMenu.js";import h from"./assertValidValue.js";import g from"./warnUnknownProps.js";import{initScrollEdges as _,revealActiveNavItem as v}from"@webority/ui-elements/helpers";import{useEffect as y,useId as b,useMemo as x,useRef as S,useState as C}from"react";import{Fragment as w,jsx as T,jsxs as E}from"react/jsx-runtime";var D=99,O=4,k=5,A=/^[a-z0-9-]+$/,j=[`prefix`,`exact`],M=[`comfortable`,`compact`],N=[`neutral`,`primary`],P=[`side`,`top`],F=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],I=/* @__PURE__ */ new Set([`key`,`label`,`icon`,`iconVariant`,`iconSize`,`href`,`badge`,`badgeTone`,`badgeTitle`,`newUntil`,`trailingIcon`,`active`,`match`,`matchAlso`,`tab`,`tabLabel`,`children`]),L=e=>e>D?`${D}+`:String(e),R=new Intl.DateTimeFormat(`en-CA`,{timeZone:`Asia/Kolkata`}),z=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:R.format(/* @__PURE__ */ new Date)<=e},ee=({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(` `)},te=({logoLight:e,logoDark:t,markLight:n,markDark:r,brandName:i})=>{let a=i??``,o=[e&&/* @__PURE__ */ T(`img`,{className:`wui-brand-logo wui-brand-light`,src:e,alt:a},`logo-light`),t&&/* @__PURE__ */ T(`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__ */ T(`img`,{className:n,src:r,alt:a},t):/* @__PURE__ */ T(`img`,{className:n,src:r,alt:``,"aria-hidden":`true`},t));return[...o,...s].filter(Boolean)};function B(e){let{marker:t,props:n}=u(`AppShell`,e),{groups:r=[],brand:l,logoLight:d,logoDark:f,markLight:b,markDark:D,brandName:O,brandHref:k,brandLabel:A,sidebarStart:j,sidebarStartCompact:I,sidebarFooter:L,topbarStart:R,topbarEnd:z,footer:B,launcher:V,children:H,collapsed:U,onCollapsedChange:W,noSidebar:G=!1,nav:q=`side`,density:ue=`comfortable`,itemHeight:fe,iconVariant:pe=`twotone`,topbarTone:me=`neutral`,navLabel:he=`Main navigation`,linkComponent:J,currentPath:ge,rememberCollapsed:_e=!1,collapsedCookie:ve=`wui-shell-collapsed`,foldedCookie:ye=i,tabBarLabel:be=`Quick navigation`,moreLabel:xe=`More`,skipLabel:Se=`Skip to content`,openNavLabel:Ce=`Open navigation`,closeNavLabel:we=`Close navigation`,expandNavLabel:Te=`Expand navigation`,collapseNavLabel:Ee=`Collapse navigation`,newLabel:De=`New`,togglePagesLabel:Oe=`Show or hide {name} pages`,accountMenuLabel:ke=`Account menu for {name}`,roleLabel:Ae=`Role:`,rolesLabel:je=`Roles:`,unreadLabel:Me=`Unread`,markAllReadLabel:Ne=`Mark all read`,viewAllLabel:Pe=`View all`,loadingNotificationsText:Fe=`Loading…`,noUnreadText:Ie=`No unread notifications`,unreadNotificationsText:Le=`{count} unread notifications`,unreadBellLabel:Re=`{label}, {count} unread`,searchResultsLabel:ze=`Search results`,noResultsText:Be=`No results`,noResultsForText:Ve=`No results for “{value}”`,resultsCountText:He=`{count} results`,resultCountText:Ue=`{count} result`,userMenu:We,notifications:Ge,search:Ke,className:qe=``,style:Je,...Ye}=n;if(g(`AppShell`,Ye),h(`AppShell`,`density`,ue,M),h(`AppShell`,`topbarTone`,me,N),h(`AppShell`,`nav`,q,P),h(`AppShell`,`iconVariant`,pe,F),A!==void 0&&!k)throw Error(`<AppShell> brandLabel names the brand link, so it needs brandHref.`);if(k){if(!A&&!O)throw Error(`<AppShell> brandHref needs brandLabel or brandName: the collapsed rail hides the logo, so the link would have no accessible name.`);if(!(l||d||f||b||D))throw Error(`<AppShell> brandHref has no brand, logo or mark to link.`)}let Xe=(fe??0)>0?{...Je,"--wui-nav-item-height":`${fe}px`}:Je,[Ze,Qe]=C(()=>_e&&U===void 0&&typeof document<`u`?o(ve)??!1:!1),[Y,X]=C(!1),[$e,et]=C(!1),[tt,nt]=C(!1),rt=S(null),it=S(null),at=S(null),Z=U??Ze,ot=e=>k?/* @__PURE__ */ T(ae,{href:k,label:A||O,linkComponent:J,onNavigate:()=>X(!1),children:e}):e,st=()=>{let e=!Z;U===void 0&&Qe(e),_e&&c(e,ve),W?.(e)},ct=r.some(e=>e.collapsible),[lt,ut]=C(()=>ct&&typeof document<`u`?a(ye):/* @__PURE__ */ new Set),dt=e=>{let t=new Set(lt);t.has(e)?t.delete(e):t.add(e),ut(t),s(t,ye)},Q=x(()=>ne(r,ge),[r,ge]),$=G?null:re(Q);y(()=>{let e=()=>et(window.scrollY>4);return e(),window.addEventListener(`scroll`,e,{passive:!0}),()=>window.removeEventListener(`scroll`,e)},[]),y(()=>{_()},[]),y(()=>{v(rt.current)},[]),y(()=>{let e=rt.current;if(!e)return;let t=()=>nt(Q.length>0&&e.scrollHeight>e.clientHeight);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[Q]);let ft=!!B;y(()=>{let e=at.current,t=it.current;if(!ft||!e||!t)return;let n=()=>t.style.setProperty(`--app-footer-h`,`${e.offsetHeight}px`);n();let r=typeof ResizeObserver>`u`?null:new ResizeObserver(n);return r?.observe(e),()=>{r?.disconnect(),t.style.removeProperty(`--app-footer-h`)}},[ft]),y(()=>{if(!Y)return;let e=e=>{e.key===`Escape`&&X(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[Y]);let pt=[`app-shell`,Z?`collapsed`:``,G?`no-sidebar`:``,q===`top`?`wui-shell-top`:``,Y?`mobile-open`:``,qe].filter(Boolean).join(` `);return/* @__PURE__ */ E(`div`,{ref:it,className:pt,"data-density":ue===`compact`?`compact`:void 0,"data-wui-folded-cookie":ct?ye:void 0,style:Xe,...t,...Ye,children:[/* @__PURE__ */ T(`a`,{className:`wui-skip-link`,href:`#main-content`,children:Se}),/* @__PURE__ */ E(`aside`,{className:`app-sidebar`,children:[(l||d||f||b||D)&&/* @__PURE__ */ T(`div`,{className:ee({logoLight:d,logoDark:f,markLight:b,markDark:D}),children:ot(/* @__PURE__ */ E(w,{children:[te({logoLight:d,logoDark:f,markLight:b,markDark:D,brandName:O}),l]}))}),j&&/* @__PURE__ */ T(`div`,{className:`app-sidebar-start`,children:j}),I&&/* @__PURE__ */ T(`div`,{className:`app-sidebar-start-compact`,children:I}),/* @__PURE__ */ T(`nav`,{className:`app-sidebar-scroll`,"aria-label":he,ref:rt,tabIndex:tt?0:void 0,children:Q.map((e,t)=>{let n=e.items.map(e=>e.header==null?/* @__PURE__ */ T(se,{item:e,linkComponent:J,onNavigate:()=>X(!1),iconVariant:pe,newLabel:De,togglePagesLabel:Oe},e.key??e.href??e.label):/* @__PURE__ */ T(`div`,{className:`wui-nav-header`,children:e.header},e.key??e.header));if(!e.collapsible)return/* @__PURE__ */ E(`div`,{className:`app-nav-group`,children:[e.label&&/* @__PURE__ */ T(`div`,{className:`app-nav-group-label`,children:e.label}),n,e.after&&/* @__PURE__ */ T(`div`,{className:`wui-nav-group-after`,children:e.after})]},e.key??e.label??`group-${t}`);let r=!lt.has(e.key??``)||!!K(e.items),i=`wui-nav-group-${e.key}`;return/* @__PURE__ */ E(`div`,{className:`app-nav-group wui-nav-group-collapsible${r?``:` wui-nav-group-folded`}`,"data-wui-nav-group":e.key,children:[/* @__PURE__ */ E(`button`,{type:`button`,className:`app-nav-group-label wui-nav-group-toggle`,"aria-expanded":r,"aria-controls":i,onClick:()=>dt(e.key??``),children:[/* @__PURE__ */ T(`span`,{className:`wui-nav-group-text`,children:e.label}),/* @__PURE__ */ T(`span`,{className:`wui-nav-group-caret`,children:/* @__PURE__ */ T(p,{name:`chevron-down`,size:16})})]}),/* @__PURE__ */ E(`div`,{className:`wui-nav-group-body`,id:i,children:[n,e.after&&/* @__PURE__ */ T(`div`,{className:`wui-nav-group-after`,children:e.after})]})]},e.key??`group-${t}`)})}),L&&/* @__PURE__ */ T(`div`,{className:`app-sidebar-foot`,children:L}),!G&&/* @__PURE__ */ T(`button`,{type:`button`,className:`app-sidebar-toggle`,onClick:st,"aria-label":Z?Te:Ee,"aria-expanded":!Z,children:/* @__PURE__ */ T(p,{name:`chevrons-left`,size:20})})]}),/* @__PURE__ */ E(`div`,{className:`app-main`,children:[/* @__PURE__ */ E(`header`,{className:`app-topbar${$e?` scrolled`:``}`,"data-tone":me===`primary`?`primary`:void 0,children:[/* @__PURE__ */ E(`div`,{className:`app-topbar-start`,children:[/* @__PURE__ */ T(`button`,{type:`button`,className:`app-topbar-menu`,onClick:()=>X(!0),"aria-label":Ce,"aria-expanded":Y,children:/* @__PURE__ */ T(p,{name:`menu`,size:18})}),q===`top`&&l&&/* @__PURE__ */ T(`div`,{className:`wui-shell-top-brand`,children:ot(l)}),q===`top`&&/* @__PURE__ */ T(`div`,{className:`wui-shell-top-nav`,children:/* @__PURE__ */ T(m,{items:ie(Q),ariaLabel:he,linkComponent:J})}),R,Ke&&/* @__PURE__ */ T(de,{config:Ke,searchResultsLabel:ze,noResultsText:Be,noResultsForText:Ve,resultsCountText:He,resultCountText:Ue})]}),/* @__PURE__ */ E(`div`,{className:`app-topbar-end`,children:[z,Ge&&/* @__PURE__ */ T(le,{config:Ge,unreadLabel:Me,markAllReadLabel:Ne,viewAllLabel:Pe,loadingNotificationsText:Fe,noUnreadText:Ie,unreadNotificationsText:Le,unreadBellLabel:Re}),We&&/* @__PURE__ */ T(ce,{config:We,linkComponent:J,accountMenuLabel:ke,roleLabel:Ae,rolesLabel:je})]})]}),/* @__PURE__ */ T(`main`,{className:`app-content`,id:`main-content`,children:H}),B&&/* @__PURE__ */ T(`footer`,{className:`app-footer`,ref:at,children:B})]}),V&&/* @__PURE__ */ T(`div`,{className:`wui-shell-launcher`,children:V}),$&&/* @__PURE__ */ E(`nav`,{className:`wui-tabbar`,"aria-label":be,children:[$.tabs.map(e=>/* @__PURE__ */ T(oe,{tab:e,linkComponent:J,iconVariant:pe},e.key??e.href)),$.hasMore&&/* @__PURE__ */ E(`button`,{type:`button`,className:`wui-tabbar-item${$.moreActive?` active`:``}`,onClick:()=>X(!0),children:[/* @__PURE__ */ T(`span`,{className:`wui-tabbar-icon`,children:/* @__PURE__ */ T(p,{name:`more`,size:24})}),/* @__PURE__ */ T(`span`,{className:`wui-tabbar-label`,children:xe})]})]}),/* @__PURE__ */ T(`button`,{type:`button`,className:`app-scrim`,onClick:()=>X(!1),"aria-label":we,tabIndex:Y?0:-1})]})}function ne(e,t){for(let t of e)t.collapsible&&G(t);let n=(e,t=!1)=>(e??[]).map(e=>Array.isArray(e.children)?{...e,children:n(e.children)}:{...e}).filter(e=>H(e)?t:(e.children?.length??0)>0||!!e.href),i=e.map(e=>({...e,items:U(n(e.items,!0))})).filter(e=>e.items.some(e=>!H(e))),a=[],o=e=>{for(let t of e)H(t)||(a.push(t),t.children&&o(t.children))};for(let e of i)o(e.items);for(let e of a)g(`AppShell items`,V(e)),h(`AppShell`,`match`,e.match,j),h(`AppShell`,`iconVariant`,e.iconVariant,F);let s=null;if(t!=null&&!a.some(e=>e.active===!0)){let e=-1;for(let n of a){if(n.active!=null||n.children?.length&&!n.href)continue;let i=r(t,n.href,{exact:n.match===`exact`,also:n.matchAlso});if(i<0)continue;let a=n.match===`exact`&&r(t,n.href,{exact:!0})>=0?1/0:i;a>e&&(e=a,s=n)}}for(let e of a)e.active=e.active??e===s;return i}function V(e){return Object.fromEntries(Object.entries(e).filter(([e])=>!I.has(e)))}var H=e=>e.header!=null;function U(e){return e.filter((t,n)=>{if(!H(t))return!0;let r=e.findIndex((e,t)=>t>n&&H(e));return e.slice(n+1,r<0?void 0:r).length>0})}var W=/* @__PURE__ */ new Set;function G(t){if(t.key!=null&&A.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`||W.has(n)||(W.add(n),e(n))}function re(e){let t=[],n=e=>{for(let r of e)H(r)||(r.children?.length?n(r.children):t.push(r))};for(let t of e)n(t.items);let r=t.filter(e=>e.tab);if(r.length===0)return null;let i=r.length<t.length,a=i?O:k;if(r.length>a)throw Error(`<AppShell>: ${r.length} items carry tab: true, but the phone tab bar holds ${a} (${i?`4 plus More, because other items exist`:`5 when every item is a tab`}). Flag fewer items.`);return{tabs:r,hasMore:i,moreActive:t.some(e=>!e.tab&&e.active)}}function ie(e){let t=e=>{if(e.label===void 0)throw Error(`<AppShell> a navigation row has no label; every row but a header needs one.`);return e.label},n=e=>e.key??e.href??t(e),r=(e,r)=>({key:n(e),label:t(e),to:r,current:!!e.active}),i=e=>e.flatMap(e=>H(e)?[]:[...e.href?[{...r(e,e.href),icon:e.icon}]:[],...i(e.children??[])]),a=[];for(let o of e.flatMap(e=>e.items)){if(H(o))continue;let e=i(o.children??[]);if(e.length>0){let i=o.href?[{...r(o,o.href),icon:o.icon}]:[];a.push({key:n(o),label:t(o),links:[...i,...e]})}else o.href&&a.push(r(o,o.href))}return a}function ae({href:e,label:t,linkComponent:r,onNavigate:i,children:a}){return/* @__PURE__ */ T(l,{link:n(r,{to:e}),className:`wui-brand-link`,"aria-label":t,onClick:i,children:a})}function oe({tab:e,linkComponent:t,iconVariant:r}){let i=`wui-tabbar-item${e.active?` active`:``}`,a=/* @__PURE__ */ E(w,{children:[e.icon&&/* @__PURE__ */ T(`span`,{className:`wui-tabbar-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ T(p,{name:e.icon,size:24,variant:e.iconVariant??r}):e.icon}),/* @__PURE__ */ T(`span`,{className:`wui-tabbar-label`,children:e.tabLabel??e.label}),e.badge!=null&&/* @__PURE__ */ T(`span`,{className:`wui-tabbar-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:e.badge})]}),o=e.active?`page`:void 0;return/* @__PURE__ */ T(l,{link:n(t,{to:e.href}),className:i,"aria-current":o,children:a})}function K(e){for(let t of e){if(t.active)return t;let e=t.children?.length?K(t.children):void 0;if(e)return e}}function se({item:e,linkComponent:r,onNavigate:i,depth:a=0,iconVariant:o,newLabel:s,togglePagesLabel:c}){let u=a>0,d=a>1?` wui-nav-depth-${Math.min(a,6)}`:``,f=Array.isArray(e.children)&&e.children.length>0,m=f?K(e.children??[]):void 0,h=!!m,g=m?m.key??m.href??m.label:null,[_,v]=C(h);y(()=>{g!=null&&v(!0)},[g]);let b=typeof e.label==`string`?e.label:void 0,x=!u&&e.icon&&/* @__PURE__ */ T(`span`,{className:`app-nav-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ T(p,{name:e.icon,size:e.iconSize??22,variant:e.iconVariant??o}):e.icon}),S=e.badge!=null&&/* @__PURE__ */ T(`span`,{className:`app-nav-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:e.badge}),D=z(e.newUntil)&&/* @__PURE__ */ T(`span`,{className:`wui-nav-new`,children:s}),O=/* @__PURE__ */ E(w,{children:[x,/* @__PURE__ */ T(`span`,{className:`app-nav-text`,children:e.label}),D,S,e.trailingIcon&&/* @__PURE__ */ T(`span`,{className:`app-nav-trailing`,children:typeof e.trailingIcon==`string`?/* @__PURE__ */ T(p,{name:e.trailingIcon,size:16}):e.trailingIcon})]}),k=e.active?`page`:void 0;if(f){let f=/* @__PURE__ */ T(`div`,{className:`app-nav-sub${_?` expanded`:``}`,inert:!_,"aria-hidden":!_||void 0,children:/* @__PURE__ */ T(`div`,{className:`app-nav-sub-inner`,children:(e.children??[]).map(e=>/* @__PURE__ */ T(se,{item:e,linkComponent:r,onNavigate:i,depth:a+1,iconVariant:o,newLabel:s,togglePagesLabel:c},e.key??e.href))})});if(e.href){let a=/* @__PURE__ */ T(l,{link:n(r,{to:e.href}),className:`wui-nav-split-link`,"aria-current":k,onClick:i,children:O});return/* @__PURE__ */ E(w,{children:[/* @__PURE__ */ E(`div`,{className:`app-nav-item has-children wui-nav-split${u?` app-nav-subitem`:``}${h||e.active?` active`:``}${d}`,"data-label":b,children:[a,/* @__PURE__ */ T(`button`,{type:`button`,className:`app-nav-caret wui-nav-split-toggle`,"aria-expanded":_,"aria-label":t(c,{name:b??``}),onClick:()=>v(e=>!e),children:/* @__PURE__ */ T(p,{name:`chevron-right`,size:16})})]}),f]})}return/* @__PURE__ */ E(w,{children:[/* @__PURE__ */ E(`button`,{type:`button`,className:`app-nav-item${u?` app-nav-subitem`:``} has-children${h?` active`:``}${d}`,"aria-expanded":_,"data-label":b,onClick:()=>v(e=>!e),children:[x,/* @__PURE__ */ T(`span`,{className:`app-nav-text`,children:e.label}),D,S,/* @__PURE__ */ T(`span`,{className:`app-nav-caret`,children:/* @__PURE__ */ T(p,{name:`chevron-right`,size:16})})]}),f]})}let A=`app-nav-item${u?` app-nav-subitem`:``}${e.active?` active`:``}${d}`;return/* @__PURE__ */ T(l,{link:n(r,{to:e.href}),className:A,"aria-current":k,"data-label":b,onClick:i,children:O})}function q(){let[e,t]=C(!1),n=S(null);return y(()=>{if(!e)return;let r=e=>{n.current?.contains(e.target instanceof Node?e.target:null)||t(!1)},i=e=>{e.key===`Escape`&&(t(!1),n.current?.querySelector(`button`)?.focus())};return document.addEventListener(`mousedown`,r),document.addEventListener(`keydown`,i),()=>{document.removeEventListener(`mousedown`,r),document.removeEventListener(`keydown`,i)}},[e]),{open:e,setOpen:t,ref:n}}function ce({config:e,linkComponent:r,accountMenuLabel:i,roleLabel:a,rolesLabel:o}){let s=b(),{open:c,setOpen:u,ref:m}=q(),{name:g,role:_,roles:v=[],photo:y,profileHref:x,profileLabel:S=`My profile`,onLogout:C,logoutAction:D,logoutLabel:O=`Sign out`,head:k,section:A,logoutVariant:j=`item`,items:M=[]}=e;if(h(`AppShell`,`userMenu.logoutVariant`,j,[`item`,`button`]),!g)throw Error(`<AppShell> userMenu.name is required; the trigger and the avatar are named from it.`);let N=v.map(e=>(e??``).trim()).filter(Boolean),P=()=>u(!1),F=(e,t,i,a)=>/* @__PURE__ */ T(l,{link:n(r,{to:e}),className:`dropdown-item`,onClick:a,children:t},i),I=/* @__PURE__ */ T(p,{name:`log-out`,size:18}),L=/* @__PURE__ */ E(w,{children:[I,O]});return/* @__PURE__ */ E(`div`,{className:`dropdown wui-usermenu`,ref:m,children:[/* @__PURE__ */ E(`button`,{type:`button`,id:s,className:`wui-usermenu-trigger`,"aria-expanded":c,"aria-label":t(i,{name:g}),onClick:()=>u(e=>!e),children:[/* @__PURE__ */ T(d,{name:g,src:y,tone:`auto`}),/* @__PURE__ */ E(`span`,{className:`wui-usermenu-text`,children:[/* @__PURE__ */ T(`span`,{className:`wui-usermenu-name`,children:g}),_&&/* @__PURE__ */ T(`span`,{className:`wui-usermenu-role`,children:_})]}),/* @__PURE__ */ T(p,{name:`chevron-down`,size:14,className:`wui-usermenu-caret`})]}),/* @__PURE__ */ E(`div`,{className:`dropdown-menu dropdown-menu-end wui-usermenu-menu${c?` show`:``}`,"aria-labelledby":s,"data-bs-popper":c?`static`:void 0,children:[/* @__PURE__ */ E(`div`,{className:`wui-usermenu-head`,children:[/* @__PURE__ */ T(d,{name:g,src:y,size:`lg`,tone:`auto`}),/* @__PURE__ */ E(`div`,{className:`wui-usermenu-who`,children:[/* @__PURE__ */ T(`div`,{className:`wui-usermenu-name`,children:g}),_&&/* @__PURE__ */ T(`div`,{className:`wui-usermenu-role`,children:_}),N.length>0&&/* @__PURE__ */ E(`div`,{className:`wui-usermenu-roles`,children:[/* @__PURE__ */ T(`span`,{className:`wui-usermenu-roles-label`,children:N.length===1?a:o}),` ${N.join(`, `)}`]}),k?/* @__PURE__ */ T(`div`,{className:`wui-usermenu-extra`,children:k}):null]})]}),A?/* @__PURE__ */ T(`div`,{className:`wui-usermenu-section`,children:A}):null,x&&F(x,/* @__PURE__ */ E(w,{children:[/* @__PURE__ */ T(p,{name:`user`,size:18}),S]}),void 0,P),M.map(e=>{if(e.divider)return/* @__PURE__ */ T(`hr`,{className:`dropdown-divider`},e.key);let t=/* @__PURE__ */ E(w,{children:[e.icon&&/* @__PURE__ */ T(p,{name:e.icon,size:18}),e.label]}),n=()=>{e.onClick?.(),P()};return e.href?F(e.href,t,e.key,n):/* @__PURE__ */ T(`button`,{type:`button`,className:`dropdown-item`,onClick:n,children:t},e.key)}),j===`button`?(D||C)&&/* @__PURE__ */ T(`div`,{className:`wui-usermenu-foot`,children:D?/* @__PURE__ */ T(`form`,{method:`post`,action:D,className:`wui-usermenu-logout`,children:/* @__PURE__ */ T(f,{type:`submit`,tone:`danger`,variant:`soft`,block:!0,leftIcon:I,children:O})}):/* @__PURE__ */ T(f,{type:`button`,tone:`danger`,variant:`soft`,block:!0,leftIcon:I,onClick:()=>{P(),C?.()},children:O})}):D?/* @__PURE__ */ T(`form`,{method:`post`,action:D,className:`wui-usermenu-logout`,children:/* @__PURE__ */ T(`button`,{type:`submit`,className:`dropdown-item danger`,children:L})}):C&&/* @__PURE__ */ T(`button`,{type:`button`,className:`dropdown-item danger`,onClick:()=>{P(),C()},children:L})]})]})}function le({config:e,unreadLabel:n,markAllReadLabel:r,viewAllLabel:i,loadingNotificationsText:a,noUnreadText:o,unreadNotificationsText:s,unreadBellLabel:c}){let l=b(),{open:u,setOpen:d,ref:f}=q(),{unread:m=0,items:h,loading:g=!1,onOpen:_,onMarkAllRead:v,viewAllHref:x,label:D=`Notifications`,emptyText:O=`You are all caught up.`}=e,[k,A]=C(``),j=S(m);y(()=>{j.current!==m&&(j.current=m,A(m===0?o:t(s,{count:L(m)})))},[m,o,s]);let M=null;return h?.length?M=/* @__PURE__ */ T(`div`,{className:`wui-bell-items`,children:h.map((e,t)=>{let r=`wui-bell-item${e.read?` wui-bell-item-read`:``}`,i=/* @__PURE__ */ E(w,{children:[/* @__PURE__ */ T(`span`,{className:`wui-bell-dot`,"aria-hidden":`true`}),e.icon&&/* @__PURE__ */ T(`span`,{className:`wui-bell-icon`,children:/* @__PURE__ */ T(p,{name:e.icon,size:18})}),/* @__PURE__ */ E(`span`,{className:`wui-bell-body`,children:[!e.read&&/* @__PURE__ */ E(`span`,{className:`visually-hidden`,children:[n,`: `]}),/* @__PURE__ */ T(`span`,{className:`wui-bell-item-title`,children:e.title}),e.time&&/* @__PURE__ */ T(`span`,{className:`wui-bell-when`,children:e.time})]})]});return e.href?/* @__PURE__ */ T(`a`,{className:r,href:e.href,"data-id":e.id,children:i},e.id??t):/* @__PURE__ */ T(`div`,{className:r,"data-id":e.id,children:i},e.id??t)})}):g?M=/* @__PURE__ */ T(`div`,{className:`wui-bell-state`,children:a}):h&&(M=/* @__PURE__ */ T(`div`,{className:`wui-bell-state`,children:O})),/* @__PURE__ */ E(`div`,{className:`dropdown wui-bell`,ref:f,children:[/* @__PURE__ */ E(`button`,{type:`button`,id:l,className:`topbar-icon-btn wui-bell-trigger`,"aria-expanded":u,"aria-label":m===0?D:t(c,{label:D,count:L(m)}),onClick:()=>{let e=!u;d(e),e&&_?.()},children:[/* @__PURE__ */ T(p,{name:`notification`,size:20}),/* @__PURE__ */ T(`span`,{className:`wui-bell-count`,"aria-hidden":`true`,hidden:m===0,children:L(m)})]}),/* @__PURE__ */ T(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:k}),/* @__PURE__ */ E(`div`,{className:`dropdown-menu dropdown-menu-end wui-bell-menu${u?` show`:``}`,"aria-labelledby":l,"data-bs-popper":u?`static`:void 0,children:[/* @__PURE__ */ E(`div`,{className:`wui-bell-head`,children:[/* @__PURE__ */ T(`span`,{className:`wui-bell-title`,children:D}),v&&/* @__PURE__ */ T(`button`,{type:`button`,className:`wui-bell-markall`,onClick:v,children:r})]}),/* @__PURE__ */ T(`div`,{className:`wui-bell-list`,"aria-busy":g||void 0,children:M}),x&&/* @__PURE__ */ T(`a`,{className:`wui-bell-foot`,href:x,children:i})]})]})}var ue=e=>!!e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName));function de({config:e,searchResultsLabel:n,noResultsText:r,noResultsForText:i,resultsCountText:a,resultCountText:o}){let s=b(),{value:c=``,onChange:l,results:u=null,loading:d=!1,onSelect:f,onSubmit:m,onFocus:h,placeholder:g=`Search`}=e,[_,v]=C(!1),[w,D]=C(!1),[O,k]=C({results:null,index:-1}),A=O.results===u?O.index:-1,j=e=>k({results:u,index:e}),M=S(null),N=S(null),P=S([]),F=x(()=>(u??[]).flatMap(e=>e.hits??[]),[u]),I=u!=null&&!w,L=F.length;y(()=>{let e=e=>{e.key!==`/`||e.ctrlKey||e.metaKey||e.altKey||ue(e.target instanceof HTMLElement?e.target:null)||(e.preventDefault(),v(!0),N.current?.focus())},t=e=>{M.current?.contains(e.target instanceof Node?e.target:null)||(D(!0),v(!1))};return document.addEventListener(`keydown`,e),document.addEventListener(`pointerdown`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`pointerdown`,t)}},[]);let R=e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(!I||L===0)return;e.preventDefault(),j((A+(e.key===`ArrowDown`?1:-1)+L)%L)}else e.key===`Enter`?I&&A>=0&&P.current[A]?(e.preventDefault(),P.current[A].click()):m&&c.trim()!==``&&(e.preventDefault(),m(c.trim())):e.key===`Escape`&&(I?(e.preventDefault(),D(!0)):_&&(e.preventDefault(),v(!1)))},z=-1;return P.current=[],/* @__PURE__ */ E(`div`,{className:`wui-topsearch${_?` is-open`:``}${d?` is-loading`:``}`,ref:M,children:[/* @__PURE__ */ T(`button`,{type:`button`,className:`topbar-icon-btn wui-topsearch-open`,"aria-label":g,"aria-expanded":_,"aria-controls":`${s}-panel`,onClick:()=>{let e=!_;v(e),e&&N.current?.focus()},children:/* @__PURE__ */ T(p,{name:`search`,size:20})}),/* @__PURE__ */ E(`div`,{className:`wui-topsearch-panel`,id:`${s}-panel`,children:[/* @__PURE__ */ E(`div`,{className:`search-wrap`,children:[/* @__PURE__ */ T(p,{name:`search`,size:18,className:`search-icon`}),/* @__PURE__ */ T(`input`,{ref:N,type:`search`,className:`form-control input search-input`,id:`${s}-input`,placeholder:g,"aria-label":g,role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":I,"aria-controls":`${s}-list`,"aria-activedescendant":I&&A>=0?`${s}-opt-${A}`:void 0,autoComplete:`off`,value:c,onChange:e=>{D(!1),l?.(e.target.value)},onKeyDown:R,onFocus:h})]}),/* @__PURE__ */ T(`div`,{className:`wui-topsearch-results`,id:`${s}-list`,role:`listbox`,"aria-label":n,hidden:!I,children:I&&/* @__PURE__ */ E(`div`,{className:`wui-topsearch-groups`,role:`presentation`,children:[L===0&&/* @__PURE__ */ T(`div`,{className:`wui-topsearch-empty`,role:`option`,"aria-disabled":`true`,"aria-selected":`false`,children:t(i,{value:c})}),u.filter(e=>e.hits?.length).map((e,t)=>/* @__PURE__ */ E(`div`,{className:`wui-topsearch-group`,role:`group`,"aria-label":e.label??``,children:[e.label&&/* @__PURE__ */ T(`div`,{className:`wui-topsearch-group-label`,role:`presentation`,children:e.label}),e.hits.map(e=>{z+=1;let t=z;return/* @__PURE__ */ E(`a`,{className:`wui-topsearch-hit${t===A?` is-active`:``}`,role:`option`,"aria-selected":t===A,id:`${s}-opt-${t}`,href:e.href,ref:e=>{P.current[t]=e},onClick:t=>f?.(e,t),children:[e.icon&&/* @__PURE__ */ T(`span`,{className:`wui-topsearch-hit-icon`,children:/* @__PURE__ */ T(p,{name:e.icon,size:18})}),/* @__PURE__ */ E(`span`,{className:`wui-topsearch-hit-text`,children:[/* @__PURE__ */ T(`span`,{className:`wui-topsearch-hit-title`,children:e.title}),e.subtitle&&/* @__PURE__ */ T(`span`,{className:`wui-topsearch-hit-sub`,children:e.subtitle})]})]},`${e.href}-${t}`)})]},e.label??t))]})})]}),/* @__PURE__ */ T(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:I?L===0?r:t(L===1?o:a,{count:L}):``})]})}export{B as default};
|
|
1
|
+
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/fillLabel.js";import{linkTarget as n}from"../lib/linkTarget.js";import{navMatchScore as r}from"../lib/navMatch.js";import{SHELL_FOLDED_COOKIE as i,readNavFolded as a,readShellCollapsed as o,writeNavFolded as s,writeShellCollapsed as c}from"../lib/shellCookie.js";import{TargetLink as l}from"../lib/TargetLink.js";import u from"../lib/useElementEntry.js";import{splitMarkerProps as d}from"../lib/wuiMarker.js";import f from"./AppAvatar.js";import p from"./AppButton.js";import m from"./AppIcon.js";import h from"./AppNavigationMenu.js";import g from"./assertValidValue.js";import _ from"./warnUnknownProps.js";import{initScrollEdges as v,revealActiveNavItem as y}from"@webority/ui-elements/helpers";import{useEffect as b,useId as x,useMemo as S,useRef as C,useState as w}from"react";import{Fragment as T,jsx as E,jsxs as D}from"react/jsx-runtime";var O=()=>import(`@webority/ui-elements/elements/overflow`),k=99,A=4,j=5,M=/^[a-z0-9-]+$/,N=`wui-sidebar-footer`,P=[],F=[`prefix`,`exact`],I=[`comfortable`,`compact`],L=[`neutral`,`primary`],R=[`side`,`top`],z=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],ee=/* @__PURE__ */ new Set([`key`,`label`,`icon`,`iconVariant`,`iconSize`,`href`,`badge`,`badgeTone`,`badgeTitle`,`newUntil`,`trailingIcon`,`active`,`match`,`matchAlso`,`tab`,`tabLabel`,`children`]),B=e=>e>k?`${k}+`:String(e),te=new Intl.DateTimeFormat(`en-CA`,{timeZone:`Asia/Kolkata`}),ne=e=>{if(typeof e!=`string`||!/^\d{4}-\d{2}-\d{2}$/.test(e))return!1;let t=/* @__PURE__ */ new Date(`${e}T00:00:00Z`);return Number.isNaN(t.getTime())||t.toISOString().slice(0,10)!==e?!1:te.format(/* @__PURE__ */ new Date)<=e},re=({logoLight:e,logoDark:t,markLight:n,markDark:r})=>{let i=!!(n||r);return[`app-sidebar-brand`,i&&`wui-brand-has-mark`,i&&!e&&!t&&`wui-brand-mark-only`,(t||r)&&`wui-brand-themed`].filter(Boolean).join(` `)},ie=({logoLight:e,logoDark:t,markLight:n,markDark:r,brandName:i})=>{let a=i??``,o=[e&&/* @__PURE__ */ E(`img`,{className:`wui-brand-logo wui-brand-light`,src:e,alt:a},`logo-light`),t&&/* @__PURE__ */ E(`img`,{className:`wui-brand-logo wui-brand-dark`,src:t,alt:``,"aria-hidden":`true`},`logo-dark`)],s=[n&&[`mark-light`,`wui-brand-mark wui-brand-light`,n],r&&[`mark-dark`,`wui-brand-mark wui-brand-dark`,r]].filter(e=>!!e).map(([t,n,r],i)=>i===0&&!e?/* @__PURE__ */ E(`img`,{className:n,src:r,alt:a},t):/* @__PURE__ */ E(`img`,{className:n,src:r,alt:``,"aria-hidden":`true`},t));return[...o,...s].filter(Boolean)};function ae(e){let{marker:t,props:n}=d(`AppShell`,e),{groups:r=[],brand:l,logoLight:u,logoDark:f,markLight:p,markDark:x,brandName:O,brandHref:k,brandLabel:A,sidebarStart:j,sidebarStartCompact:M,sidebarFooter:N,sidebarFooterItems:F=P,topbarStart:ee,topbarEnd:B,footer:te,launcher:ne,children:ae,collapsed:V,onCollapsedChange:H,noSidebar:U=!1,nav:W=`side`,density:se=`comfortable`,itemHeight:G,iconVariant:K=`twotone`,topbarTone:_e=`neutral`,navLabel:ve=`Main navigation`,linkComponent:q,currentPath:ye,rememberCollapsed:be=!1,collapsedCookie:xe=`wui-shell-collapsed`,foldedCookie:Se=i,tabBarLabel:Ce=`Quick navigation`,moreLabel:we=`More`,skipLabel:Te=`Skip to content`,openNavLabel:Ee=`Open navigation`,closeNavLabel:De=`Close navigation`,expandNavLabel:Oe=`Expand navigation`,collapseNavLabel:ke=`Collapse navigation`,newLabel:Ae=`New`,togglePagesLabel:je=`Show or hide {name} pages`,accountMenuLabel:Me=`Account menu for {name}`,roleLabel:Ne=`Role:`,rolesLabel:Pe=`Roles:`,unreadLabel:Fe=`Unread`,markAllReadLabel:Ie=`Mark all read`,viewAllLabel:Le=`View all`,loadingNotificationsText:Re=`Loading…`,noUnreadText:ze=`No unread notifications`,unreadNotificationsText:Be=`{count} unread notifications`,unreadBellLabel:Ve=`{label}, {count} unread`,searchResultsLabel:He=`Search results`,noResultsText:Ue=`No results`,noResultsForText:We=`No results for “{value}”`,resultsCountText:Ge=`{count} results`,resultCountText:Ke=`{count} result`,userMenu:qe,notifications:Je,search:Ye,className:Xe=``,style:Ze,...Qe}=n;if(_(`AppShell`,Qe),g(`AppShell`,`density`,se,I),g(`AppShell`,`topbarTone`,_e,L),g(`AppShell`,`nav`,W,R),g(`AppShell`,`iconVariant`,K,z),A!==void 0&&!k)throw Error(`<AppShell> brandLabel names the brand link, so it needs brandHref.`);if(k){if(!A&&!O)throw Error(`<AppShell> brandHref needs brandLabel or brandName: the collapsed rail hides the logo, so the link would have no accessible name.`);if(!(l||u||f||p||x))throw Error(`<AppShell> brandHref has no brand, logo or mark to link.`)}let $e=(G??0)>0?{...Ze,"--wui-nav-item-height":`${G}px`}:Ze,[et,tt]=w(()=>be&&V===void 0&&typeof document<`u`?o(xe)??!1:!1),[J,Y]=w(!1),[nt,rt]=w(!1),[it,at]=w(!1),ot=C(null),X=V??et,st=e=>k?/* @__PURE__ */ E(ue,{href:k,label:A||O,linkComponent:q,onNavigate:()=>Y(!1),children:e}):e,ct=()=>{let e=!X;V===void 0&&tt(e),be&&c(e,xe),H?.(e)},lt=r.some(e=>e.collapsible),[ut,dt]=w(()=>lt&&typeof document<`u`?a(Se):/* @__PURE__ */ new Set),ft=e=>{let t=new Set(ut);t.has(e)?t.delete(e):t.add(e),dt(t),s(t,Se)},pt=S(()=>oe(r,F,ye),[r,F,ye]),Z=pt.groups,Q=pt.footer,$=U?null:ce(Z,Q.some(e=>e.active));b(()=>{let e=()=>rt(window.scrollY>4);return e(),window.addEventListener(`scroll`,e,{passive:!0}),()=>window.removeEventListener(`scroll`,e)},[]),b(()=>{v()},[]),b(()=>{y(ot.current)},[]),b(()=>{let e=ot.current;if(!e)return;let t=()=>at(Z.length>0&&e.scrollHeight>e.clientHeight);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[Z]),b(()=>{if(!J)return;let e=e=>{e.key===`Escape`&&Y(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[J]);let mt=[`app-shell`,X?`collapsed`:``,U?`no-sidebar`:``,W===`top`?`wui-shell-top`:``,J?`mobile-open`:``,Xe].filter(Boolean).join(` `);return/* @__PURE__ */ D(`div`,{className:mt,"data-density":se===`compact`?`compact`:void 0,"data-wui-folded-cookie":lt?Se:void 0,style:$e,...t,...Qe,children:[/* @__PURE__ */ E(`a`,{className:`wui-skip-link`,href:`#main-content`,children:Te}),/* @__PURE__ */ D(`aside`,{className:`app-sidebar`,children:[(l||u||f||p||x)&&/* @__PURE__ */ E(`div`,{className:re({logoLight:u,logoDark:f,markLight:p,markDark:x}),children:st(/* @__PURE__ */ D(T,{children:[ie({logoLight:u,logoDark:f,markLight:p,markDark:x,brandName:O}),l]}))}),j&&/* @__PURE__ */ E(`div`,{className:`app-sidebar-start`,children:j}),M&&/* @__PURE__ */ E(`div`,{className:`app-sidebar-start-compact`,children:M}),/* @__PURE__ */ E(`nav`,{className:`app-sidebar-scroll`,"aria-label":ve,ref:ot,tabIndex:it?0:void 0,children:Z.map((e,t)=>{let n=e.items.map(e=>e.header==null?/* @__PURE__ */ E(pe,{item:e,linkComponent:q,onNavigate:()=>Y(!1),iconVariant:K,newLabel:Ae,togglePagesLabel:je},e.key??e.href??e.label):/* @__PURE__ */ E(`div`,{className:`wui-nav-header`,children:e.header},e.key??e.header));if(!e.collapsible)return/* @__PURE__ */ D(`div`,{className:`app-nav-group`,children:[e.label&&/* @__PURE__ */ E(`div`,{className:`app-nav-group-label`,children:e.label}),n,e.after&&/* @__PURE__ */ E(`div`,{className:`wui-nav-group-after`,children:e.after})]},e.key??e.label??`group-${t}`);let r=!ut.has(e.key??``)||!!fe(e.items),i=`wui-nav-group-${e.key}`;return/* @__PURE__ */ D(`div`,{className:`app-nav-group wui-nav-group-collapsible${r?``:` wui-nav-group-folded`}`,"data-wui-nav-group":e.key,children:[/* @__PURE__ */ D(`button`,{type:`button`,className:`app-nav-group-label wui-nav-group-toggle`,"aria-expanded":r,"aria-controls":i,onClick:()=>ft(e.key??``),children:[/* @__PURE__ */ E(`span`,{className:`wui-nav-group-text`,children:e.label}),/* @__PURE__ */ E(`span`,{className:`wui-nav-group-caret`,children:/* @__PURE__ */ E(m,{name:`chevron-down`,size:16})})]}),/* @__PURE__ */ D(`div`,{className:`wui-nav-group-body`,id:i,children:[n,e.after&&/* @__PURE__ */ E(`div`,{className:`wui-nav-group-after`,children:e.after})]})]},e.key??`group-${t}`)})}),(N||Q.length>0)&&/* @__PURE__ */ D(`div`,{className:`app-sidebar-foot`,children:[Q.length>0&&/* @__PURE__ */ E(`div`,{className:`wui-sidebar-foot-links`,children:Q.map(e=>/* @__PURE__ */ E(pe,{item:e,linkComponent:q,onNavigate:()=>Y(!1),iconVariant:K,newLabel:Ae,togglePagesLabel:je},e.key??e.href??e.label))}),N]}),!U&&/* @__PURE__ */ E(`button`,{type:`button`,className:`app-sidebar-toggle`,onClick:ct,"aria-label":X?Oe:ke,"aria-expanded":!X,children:/* @__PURE__ */ E(m,{name:`chevrons-left`,size:20})})]}),/* @__PURE__ */ D(`div`,{className:`app-main`,children:[/* @__PURE__ */ D(`header`,{className:`app-topbar${nt?` scrolled`:``}`,"data-tone":_e===`primary`?`primary`:void 0,children:[/* @__PURE__ */ D(`div`,{className:`app-topbar-start`,children:[/* @__PURE__ */ E(`button`,{type:`button`,className:`app-topbar-menu`,onClick:()=>Y(!0),"aria-label":Ee,"aria-expanded":J,children:/* @__PURE__ */ E(m,{name:`menu`,size:18})}),W===`top`&&l&&/* @__PURE__ */ E(`div`,{className:`wui-shell-top-brand`,children:st(l)}),W===`top`&&/* @__PURE__ */ E(`div`,{className:`wui-shell-top-nav`,children:/* @__PURE__ */ E(h,{items:le(Z),ariaLabel:ve,linkComponent:q})}),ee,Ye&&/* @__PURE__ */ E(ge,{config:Ye,searchResultsLabel:He,noResultsText:Ue,noResultsForText:We,resultsCountText:Ge,resultCountText:Ke})]}),/* @__PURE__ */ D(`div`,{className:`app-topbar-end`,children:[B,Je&&/* @__PURE__ */ E(he,{config:Je,unreadLabel:Fe,markAllReadLabel:Ie,viewAllLabel:Le,loadingNotificationsText:Re,noUnreadText:ze,unreadNotificationsText:Be,unreadBellLabel:Ve}),qe&&/* @__PURE__ */ E(me,{config:qe,linkComponent:q,accountMenuLabel:Me,roleLabel:Ne,rolesLabel:Pe})]})]}),/* @__PURE__ */ E(`main`,{className:`app-content`,id:`main-content`,children:ae}),te&&/* @__PURE__ */ E(`footer`,{className:`app-footer`,children:te})]}),ne&&/* @__PURE__ */ E(`div`,{className:`wui-shell-launcher`,children:ne}),$&&/* @__PURE__ */ D(`nav`,{className:`wui-tabbar`,"aria-label":Ce,children:[$.tabs.map(e=>/* @__PURE__ */ E(de,{tab:e,linkComponent:q,iconVariant:K},e.key??e.href)),$.hasMore&&/* @__PURE__ */ D(`button`,{type:`button`,className:`wui-tabbar-item${$.moreActive?` active`:``}`,onClick:()=>Y(!0),children:[/* @__PURE__ */ E(`span`,{className:`wui-tabbar-icon`,children:/* @__PURE__ */ E(m,{name:`more`,size:24})}),/* @__PURE__ */ E(`span`,{className:`wui-tabbar-label`,children:we})]})]}),/* @__PURE__ */ E(`button`,{type:`button`,className:`app-scrim`,onClick:()=>Y(!1),"aria-label":De,tabIndex:J?0:-1})]})}function oe(e,t,n){let i=t;for(let e of i){if(e.children?.length)throw Error(`<AppShell> sidebarFooterItems cannot hold children; keep footer links flat.`);if(e.tab)throw Error(`<AppShell> sidebarFooterItems cannot carry tab: true; the phone tab bar is built from groups.`);if(e.header!=null)throw Error(`<AppShell> sidebarFooterItems cannot hold a header row.`)}for(let t of e)t.collapsible&&se(t);let a=(e,t=!1)=>(e??[]).map(e=>Array.isArray(e.children)?{...e,children:a(e.children)}:{...e}).filter(e=>H(e)?t:(e.children?.length??0)>0||!!e.href),o=[...e,{key:N,items:t}].map(e=>({...e,items:U(a(e.items,!0))})).filter(e=>e.items.some(e=>!H(e))),s=[],c=e=>{for(let t of e)H(t)||(s.push(t),t.children&&c(t.children))};for(let e of o)c(e.items);for(let e of s)_(`AppShell items`,V(e)),g(`AppShell`,`match`,e.match,F),g(`AppShell`,`iconVariant`,e.iconVariant,z);let l=null;if(n!=null&&!s.some(e=>e.active===!0)){let e=-1;for(let t of s){if(t.active!=null||t.children?.length&&!t.href)continue;let i=r(n,t.href,{exact:t.match===`exact`,also:t.matchAlso});if(i<0)continue;let a=t.match===`exact`&&r(n,t.href,{exact:!0})>=0?1/0:i;a>e&&(e=a,l=t)}}for(let e of s)e.active=e.active??e===l;return{groups:o.filter(e=>e.key!==N),footer:o.find(e=>e.key===N)?.items??[]}}function V(e){return Object.fromEntries(Object.entries(e).filter(([e])=>!ee.has(e)))}var H=e=>e.header!=null;function U(e){return e.filter((t,n)=>{if(!H(t))return!0;let r=e.findIndex((e,t)=>t>n&&H(e));return e.slice(n+1,r<0?void 0:r).length>0})}var W=/* @__PURE__ */ new Set;function se(t){if(t.key!=null&&M.test(t.key))return;let n=t.key==null?`<AppShell> a collapsible group needs a key so its folded state can be remembered.`:`<AppShell> collapsible group key "${t.key}" must use lower-case letters, digits and hyphens.`;typeof process<`u`&&process.env.NODE_ENV===`production`||W.has(n)||(W.add(n),e(n))}function ce(e,t){let n=[],r=e=>{for(let t of e)H(t)||(t.children?.length?r(t.children):n.push(t))};for(let t of e)r(t.items);let i=n.filter(e=>e.tab);if(i.length===0)return null;let a=i.length<n.length,o=a?A:j;if(i.length>o)throw Error(`<AppShell>: ${i.length} items carry tab: true, but the phone tab bar holds ${o} (${a?`4 plus More, because other items exist`:`5 when every item is a tab`}). Flag fewer items.`);return{tabs:i,hasMore:a,moreActive:t||n.some(e=>!e.tab&&e.active)}}function le(e){let t=e=>{if(e.label===void 0)throw Error(`<AppShell> a navigation row has no label; every row but a header needs one.`);return e.label},n=e=>e.key??e.href??t(e),r=(e,r)=>({key:n(e),label:t(e),to:r,current:!!e.active}),i=e=>e.flatMap(e=>H(e)?[]:[...e.href?[{...r(e,e.href),icon:e.icon}]:[],...i(e.children??[])]),a=[];for(let o of e.flatMap(e=>e.items)){if(H(o))continue;let e=i(o.children??[]);if(e.length>0){let i=o.href?[{...r(o,o.href),icon:o.icon}]:[];a.push({key:n(o),label:t(o),links:[...i,...e]})}else o.href&&a.push(r(o,o.href))}return a}function ue({href:e,label:t,linkComponent:r,onNavigate:i,children:a}){return/* @__PURE__ */ E(l,{link:n(r,{to:e}),className:`wui-brand-link`,"aria-label":t,onClick:i,children:a})}function de({tab:e,linkComponent:t,iconVariant:r}){let i=`wui-tabbar-item${e.active?` active`:``}`,a=/* @__PURE__ */ D(T,{children:[e.icon&&/* @__PURE__ */ E(`span`,{className:`wui-tabbar-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ E(m,{name:e.icon,size:24,variant:e.iconVariant??r}):e.icon}),/* @__PURE__ */ E(`span`,{className:`wui-tabbar-label`,children:e.tabLabel??e.label}),e.badge!=null&&/* @__PURE__ */ E(`span`,{className:`wui-tabbar-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:e.badge})]}),o=e.active?`page`:void 0;return/* @__PURE__ */ E(l,{link:n(t,{to:e.href}),className:i,"aria-current":o,children:a})}function fe(e){for(let t of e){if(t.active)return t;let e=t.children?.length?fe(t.children):void 0;if(e)return e}}function pe({item:e,linkComponent:r,onNavigate:i,depth:a=0,iconVariant:o,newLabel:s,togglePagesLabel:c}){let u=a>0,d=a>1?` wui-nav-depth-${Math.min(a,6)}`:``,f=Array.isArray(e.children)&&e.children.length>0,p=f?fe(e.children??[]):void 0,h=!!p,g=p?p.key??p.href??p.label:null,[_,v]=w(h);b(()=>{g!=null&&v(!0)},[g]);let y=typeof e.label==`string`?e.label:void 0,x=!u&&e.icon&&/* @__PURE__ */ E(`span`,{className:`app-nav-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ E(m,{name:e.icon,size:e.iconSize??22,variant:e.iconVariant??o}):e.icon}),S=e.badge!=null&&/* @__PURE__ */ E(`span`,{className:`app-nav-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:e.badge}),C=ne(e.newUntil)&&/* @__PURE__ */ E(`span`,{className:`wui-nav-new`,children:s}),O=/* @__PURE__ */ D(T,{children:[x,/* @__PURE__ */ E(`span`,{className:`app-nav-text`,children:e.label}),C,S,e.trailingIcon&&/* @__PURE__ */ E(`span`,{className:`app-nav-trailing`,children:typeof e.trailingIcon==`string`?/* @__PURE__ */ E(m,{name:e.trailingIcon,size:16}):e.trailingIcon})]}),k=e.active?`page`:void 0;if(f){let f=/* @__PURE__ */ E(`div`,{className:`app-nav-sub${_?` expanded`:``}`,inert:!_,"aria-hidden":!_||void 0,children:/* @__PURE__ */ E(`div`,{className:`app-nav-sub-inner`,children:(e.children??[]).map(e=>/* @__PURE__ */ E(pe,{item:e,linkComponent:r,onNavigate:i,depth:a+1,iconVariant:o,newLabel:s,togglePagesLabel:c},e.key??e.href))})});if(e.href){let a=/* @__PURE__ */ E(l,{link:n(r,{to:e.href}),className:`wui-nav-split-link`,"aria-current":k,onClick:i,children:O});return/* @__PURE__ */ D(T,{children:[/* @__PURE__ */ D(`div`,{className:`app-nav-item has-children wui-nav-split${u?` app-nav-subitem`:``}${h||e.active?` active`:``}${d}`,"data-label":y,children:[a,/* @__PURE__ */ E(`button`,{type:`button`,className:`app-nav-caret wui-nav-split-toggle`,"aria-expanded":_,"aria-label":t(c,{name:y??``}),onClick:()=>v(e=>!e),children:/* @__PURE__ */ E(m,{name:`chevron-right`,size:16})})]}),f]})}return/* @__PURE__ */ D(T,{children:[/* @__PURE__ */ D(`button`,{type:`button`,className:`app-nav-item${u?` app-nav-subitem`:``} has-children${h?` active`:``}${d}`,"aria-expanded":_,"data-label":y,onClick:()=>v(e=>!e),children:[x,/* @__PURE__ */ E(`span`,{className:`app-nav-text`,children:e.label}),C,S,/* @__PURE__ */ E(`span`,{className:`app-nav-caret`,children:/* @__PURE__ */ E(m,{name:`chevron-right`,size:16})})]}),f]})}let A=`app-nav-item${u?` app-nav-subitem`:``}${e.active?` active`:``}${d}`;return/* @__PURE__ */ E(l,{link:n(r,{to:e.href}),className:A,"aria-current":k,"data-label":y,onClick:i,children:O})}function G(){let[e,t]=w(!1),n=C(null);return b(()=>{if(!e)return;let r=e=>{n.current?.contains(e.target instanceof Node?e.target:null)||t(!1)},i=e=>{e.key===`Escape`&&(t(!1),n.current?.querySelector(`button`)?.focus())};return document.addEventListener(`mousedown`,r),document.addEventListener(`keydown`,i),()=>{document.removeEventListener(`mousedown`,r),document.removeEventListener(`keydown`,i)}},[e]),{open:e,setOpen:t,ref:n}}function me({config:e,linkComponent:r,accountMenuLabel:i,roleLabel:a,rolesLabel:o}){let s=x(),{open:c,setOpen:u,ref:d}=G(),{name:h,role:_,roles:v=[],noTriggerRole:y=!1,photo:b,profileHref:S,profileLabel:C=`My profile`,onLogout:w,logoutAction:O,logoutLabel:k=`Sign out`,head:A,section:j,logoutVariant:M=`item`,items:N=[]}=e;if(g(`AppShell`,`userMenu.logoutVariant`,M,[`item`,`button`]),!h)throw Error(`<AppShell> userMenu.name is required; the trigger and the avatar are named from it.`);let P=v.map(e=>(e??``).trim()).filter(Boolean),F=()=>u(!1),I=(e,t,i,a)=>/* @__PURE__ */ E(l,{link:n(r,{to:e}),className:`dropdown-item`,onClick:a,children:t},i),L=/* @__PURE__ */ E(m,{name:`log-out`,size:18}),R=/* @__PURE__ */ D(T,{children:[L,k]});return/* @__PURE__ */ D(`div`,{className:`dropdown wui-usermenu`,ref:d,children:[/* @__PURE__ */ D(`button`,{type:`button`,id:s,className:`wui-usermenu-trigger`,"aria-expanded":c,"aria-label":t(i,{name:h}),onClick:()=>u(e=>!e),children:[/* @__PURE__ */ E(f,{name:h,src:b,tone:`auto`}),/* @__PURE__ */ D(`span`,{className:`wui-usermenu-text`,children:[/* @__PURE__ */ E(`span`,{className:`wui-usermenu-name`,children:h}),_&&!y&&/* @__PURE__ */ E(`span`,{className:`wui-usermenu-role`,children:_})]}),/* @__PURE__ */ E(m,{name:`chevron-down`,size:14,className:`wui-usermenu-caret`})]}),/* @__PURE__ */ D(`div`,{className:`dropdown-menu dropdown-menu-end wui-usermenu-menu${c?` show`:``}`,"aria-labelledby":s,"data-bs-popper":c?`static`:void 0,children:[/* @__PURE__ */ D(`div`,{className:`wui-usermenu-head`,children:[/* @__PURE__ */ E(f,{name:h,src:b,size:`lg`,tone:`auto`}),/* @__PURE__ */ D(`div`,{className:`wui-usermenu-who`,children:[/* @__PURE__ */ E(`div`,{className:`wui-usermenu-name`,children:h}),_&&/* @__PURE__ */ E(`div`,{className:`wui-usermenu-role`,children:_}),P.length>0&&/* @__PURE__ */ D(`div`,{className:`wui-usermenu-roles`,children:[/* @__PURE__ */ E(`span`,{className:`wui-usermenu-roles-label`,children:P.length===1?a:o}),` ${P.join(`, `)}`]}),A?/* @__PURE__ */ E(`div`,{className:`wui-usermenu-extra`,children:A}):null]})]}),j?/* @__PURE__ */ E(`div`,{className:`wui-usermenu-section`,children:j}):null,S&&I(S,/* @__PURE__ */ D(T,{children:[/* @__PURE__ */ E(m,{name:`user`,size:18}),C]}),void 0,F),N.map(e=>{if(e.divider)return/* @__PURE__ */ E(`hr`,{className:`dropdown-divider`},e.key);let t=/* @__PURE__ */ D(T,{children:[e.icon&&/* @__PURE__ */ E(m,{name:e.icon,size:18}),e.label]}),n=()=>{e.onClick?.(),F()};return e.href?I(e.href,t,e.key,n):/* @__PURE__ */ E(`button`,{type:`button`,className:`dropdown-item`,onClick:n,children:t},e.key)}),M===`button`?(O||w)&&/* @__PURE__ */ E(`div`,{className:`wui-usermenu-foot`,children:O?/* @__PURE__ */ E(`form`,{method:`post`,action:O,className:`wui-usermenu-logout`,children:/* @__PURE__ */ E(p,{type:`submit`,tone:`danger`,variant:`soft`,block:!0,leftIcon:L,children:k})}):/* @__PURE__ */ E(p,{type:`button`,tone:`danger`,variant:`soft`,block:!0,leftIcon:L,onClick:()=>{F(),w?.()},children:k})}):O?/* @__PURE__ */ E(`form`,{method:`post`,action:O,className:`wui-usermenu-logout`,children:/* @__PURE__ */ E(`button`,{type:`submit`,className:`dropdown-item danger`,children:R})}):w&&/* @__PURE__ */ E(`button`,{type:`button`,className:`dropdown-item danger`,onClick:()=>{F(),w()},children:R})]})]})}function he({config:e,unreadLabel:n,markAllReadLabel:r,viewAllLabel:i,loadingNotificationsText:a,noUnreadText:o,unreadNotificationsText:s,unreadBellLabel:c}){let l=x(),{open:u,setOpen:d,ref:f}=G(),{unread:p=0,items:h,loading:g=!1,onOpen:_,onMarkAllRead:v,viewAllHref:y,label:S=`Notifications`,emptyText:O=`You are all caught up.`}=e,[k,A]=w(``),j=C(p);b(()=>{j.current!==p&&(j.current=p,A(p===0?o:t(s,{count:B(p)})))},[p,o,s]);let M=null;return h?.length?M=/* @__PURE__ */ E(`div`,{className:`wui-bell-items`,children:h.map((e,t)=>{let r=`wui-bell-item${e.read?` wui-bell-item-read`:``}`,i=/* @__PURE__ */ D(T,{children:[/* @__PURE__ */ E(`span`,{className:`wui-bell-dot`,"aria-hidden":`true`}),e.icon&&/* @__PURE__ */ E(`span`,{className:`wui-bell-icon`,children:/* @__PURE__ */ E(m,{name:e.icon,size:18})}),/* @__PURE__ */ D(`span`,{className:`wui-bell-body`,children:[!e.read&&/* @__PURE__ */ D(`span`,{className:`visually-hidden`,children:[n,`: `]}),/* @__PURE__ */ E(`span`,{className:`wui-bell-item-title`,children:e.title}),e.time&&/* @__PURE__ */ E(`span`,{className:`wui-bell-when`,children:e.time})]})]});return e.href?/* @__PURE__ */ E(`a`,{className:r,href:e.href,"data-id":e.id,children:i},e.id??t):/* @__PURE__ */ E(`div`,{className:r,"data-id":e.id,children:i},e.id??t)})}):g?M=/* @__PURE__ */ E(`div`,{className:`wui-bell-state`,children:a}):h&&(M=/* @__PURE__ */ E(`div`,{className:`wui-bell-state`,children:O})),/* @__PURE__ */ D(`div`,{className:`dropdown wui-bell`,ref:f,children:[/* @__PURE__ */ D(`button`,{type:`button`,id:l,className:`topbar-icon-btn wui-bell-trigger`,"aria-expanded":u,"aria-label":p===0?S:t(c,{label:S,count:B(p)}),onClick:()=>{let e=!u;d(e),e&&_?.()},children:[/* @__PURE__ */ E(m,{name:`notification`,size:20}),/* @__PURE__ */ E(`span`,{className:`wui-bell-count`,"aria-hidden":`true`,hidden:p===0,children:B(p)})]}),/* @__PURE__ */ E(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:k}),/* @__PURE__ */ D(`div`,{className:`dropdown-menu dropdown-menu-end wui-bell-menu${u?` show`:``}`,"aria-labelledby":l,"data-bs-popper":u?`static`:void 0,children:[/* @__PURE__ */ D(`div`,{className:`wui-bell-head`,children:[/* @__PURE__ */ E(`span`,{className:`wui-bell-title`,children:S}),v&&/* @__PURE__ */ E(`button`,{type:`button`,className:`wui-bell-markall`,onClick:v,children:r})]}),/* @__PURE__ */ E(`div`,{className:`wui-bell-list`,"aria-busy":g||void 0,children:M}),y&&/* @__PURE__ */ E(`a`,{className:`wui-bell-foot`,href:y,children:i})]})]})}var K=e=>!!e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName));function ge({config:e,searchResultsLabel:n,noResultsText:r,noResultsForText:i,resultsCountText:a,resultCountText:o}){u(`wui-overflow`,O);let s=x(),{value:c=``,onChange:l,results:d=null,loading:f=!1,onSelect:p,onSubmit:h,onFocus:g,placeholder:_=`Search`}=e,[v,y]=w(!1),[T,k]=w(!1),[A,j]=w({results:null,index:-1}),M=A.results===d?A.index:-1,N=e=>j({results:d,index:e}),P=C(null),F=C(null),I=C([]),L=S(()=>(d??[]).flatMap(e=>e.hits??[]),[d]),R=d!=null&&!T,z=L.length;b(()=>{let e=e=>{e.key!==`/`||e.ctrlKey||e.metaKey||e.altKey||K(e.target instanceof HTMLElement?e.target:null)||(e.preventDefault(),y(!0),F.current?.focus())},t=e=>{P.current?.contains(e.target instanceof Node?e.target:null)||(k(!0),y(!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(!R||z===0)return;e.preventDefault(),N((M+(e.key===`ArrowDown`?1:-1)+z)%z)}else e.key===`Enter`?R&&M>=0&&I.current[M]?(e.preventDefault(),I.current[M].click()):h&&c.trim()!==``&&(e.preventDefault(),h(c.trim())):e.key===`Escape`&&(R?(e.preventDefault(),k(!0)):v&&(e.preventDefault(),y(!1)))},B=-1;return I.current=[],/* @__PURE__ */ E(`wui-overflow`,{class:`wui-topsearch-host`,label:`More`,children:/* @__PURE__ */ E(`div`,{"data-wui-overflow-list":!0,className:`wui-topsearch-row`,children:/* @__PURE__ */ D(`div`,{className:`wui-topsearch${v?` is-open`:``}${f?` is-loading`:``}`,ref:P,"data-overflow-label":_,children:[/* @__PURE__ */ E(`button`,{type:`button`,className:`topbar-icon-btn wui-topsearch-open`,"aria-label":_,"aria-expanded":v,"aria-controls":`${s}-panel`,onClick:()=>{let e=!v;y(e),e&&F.current?.focus()},children:/* @__PURE__ */ E(m,{name:`search`,size:20})}),/* @__PURE__ */ D(`div`,{className:`wui-topsearch-panel`,id:`${s}-panel`,children:[/* @__PURE__ */ D(`div`,{className:`search-wrap`,children:[/* @__PURE__ */ E(m,{name:`search`,size:18,className:`search-icon`}),/* @__PURE__ */ E(`input`,{ref:F,type:`search`,className:`form-control input search-input`,id:`${s}-input`,placeholder:_,"aria-label":_,role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":R,"aria-controls":`${s}-list`,"aria-activedescendant":R&&M>=0?`${s}-opt-${M}`:void 0,autoComplete:`off`,value:c,onChange:e=>{k(!1),l?.(e.target.value)},onKeyDown:ee,onFocus:g})]}),/* @__PURE__ */ E(`div`,{className:`wui-topsearch-results`,id:`${s}-list`,role:`listbox`,"aria-label":n,hidden:!R,children:R&&/* @__PURE__ */ D(`div`,{className:`wui-topsearch-groups`,role:`presentation`,children:[z===0&&/* @__PURE__ */ E(`div`,{className:`wui-topsearch-empty`,role:`option`,"aria-disabled":`true`,"aria-selected":`false`,children:t(i,{value:c})}),d.filter(e=>e.hits?.length).map((e,t)=>/* @__PURE__ */ D(`div`,{className:`wui-topsearch-group`,role:`group`,"aria-label":e.label??``,children:[e.label&&/* @__PURE__ */ E(`div`,{className:`wui-topsearch-group-label`,role:`presentation`,children:e.label}),e.hits.map(e=>{B+=1;let t=B;return/* @__PURE__ */ D(`a`,{className:`wui-topsearch-hit${t===M?` is-active`:``}`,role:`option`,"aria-selected":t===M,id:`${s}-opt-${t}`,href:e.href,ref:e=>{I.current[t]=e},onClick:t=>p?.(e,t),children:[e.icon&&/* @__PURE__ */ E(`span`,{className:`wui-topsearch-hit-icon`,children:/* @__PURE__ */ E(m,{name:e.icon,size:18})}),/* @__PURE__ */ D(`span`,{className:`wui-topsearch-hit-text`,children:[/* @__PURE__ */ E(`span`,{className:`wui-topsearch-hit-title`,children:e.title}),e.subtitle&&/* @__PURE__ */ E(`span`,{className:`wui-topsearch-hit-sub`,children:e.subtitle})]})]},`${e.href}-${t}`)})]},e.label??t))]})})]}),/* @__PURE__ */ E(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:R?z===0?r:t(z===1?o:a,{count:z}):``})]})})})}export{ae 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
|
|
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{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./AppInfoTip.js";import o from"./AppRequiredMark.js";import s from"./assertValidValue.js";import ee from"./warnUnknownProps.js";import{forwardRef as c,useCallback as l,useEffect as u,useId as d,useLayoutEffect as f,useRef as p,useState as te}from"react";import{Form as m}from"react-bootstrap";import{jsx as h,jsxs as g}from"react/jsx-runtime";var _=e=>e!=null&&e!==``&&e!==!1,v=c(function(c,v){let{marker:y,props:ne}=i(`AppTextarea`,c),{label:b,required:x=!1,optional:S=!1,optionalLabel:C=`(optional)`,error:w,helperText:T,help:E,helpLabel:D=`More information`,id:re,name:ie,rows:ae=4,autoGrow:O=!1,monospace:oe=!1,showCount:k=!1,maxLength:A,disabled:j=!1,readOnly:M=!1,loading:N=!1,size:P=`md`,className:F=``,fieldClassName:I=``,controlOnly:L=!1,value:R,...z}=ne,{onChange:B,...V}=z;if(L){let e=[[`label`,b],[`error`,w],[`helperText`,T],[`fieldClassName`,I],[`showCount`,k],[`help`,E],[`optional`,S]];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.`)}ee(`AppTextarea`,z),s(`AppTextarea`,`size`,P,r),u(()=>{S&&x&&typeof process<`u`&&process.env.NODE_ENV!==`production`&&e(`AppTextarea: optional and required together; optional ignored`)},[S,x]);let H=d(),U=re||H,W=[`textarea`,O?`autosize`:``,oe?`wui-mono`:``,w?`error`:``,P===`sm`?`input-sm`:``,P===`lg`?`input-lg`:``,N?n:``,F].filter(Boolean).join(` `),G=w&&U?`${U}-error`:void 0,K=T&&U?`${U}-hint`:void 0,q=G||K,J=p(null),se=e=>{J.current=e,typeof v==`function`?v(e):v&&(v.current=e)},Y=p(void 0),X=l(()=>{let e=J.current;e&&(e.style.height=`auto`,e.style.height=`${e.scrollHeight}px`,Y.current=`${e.value}|${e.clientWidth}`)},[]);f(()=>{let e=J.current;!O||!e?Y.current=void 0:`${String(R??e.value)}|${e.clientWidth}`!==Y.current&&X()});let[Z,Q]=te(()=>String(R??z.defaultValue??``).length);u(()=>{k&&R!==void 0&&Q(String(R??``).length)},[R,k]);let ce=e=>{O&&X(),k&&Q(e.currentTarget.value.length),z.onInput?.(e)},$=/* @__PURE__ */ h(m.Control,{as:`textarea`,id:U,name:ie,rows:ae,className:W,"aria-invalid":w?`true`:`false`,"aria-describedby":q,"aria-busy":N||void 0,required:x,maxLength:A,disabled:j,readOnly:M||N,...L?y:null,...R===void 0?null:{value:R},...V,...B?{onChange:B}:null,ref:se,onInput:ce});return L?$:/* @__PURE__ */ g(m.Group,{...y,className:`field${I?` ${I}`:``}`,children:[b&&/* @__PURE__ */ g(m.Label,{className:`label`,htmlFor:U,children:[b,S&&!x&&/* @__PURE__ */ h(`span`,{className:`label-optional`,children:` ${C}`}),x&&/* @__PURE__ */ h(o,{}),E&&/* @__PURE__ */ h(a,{label:D,children:E})]}),$,/* @__PURE__ */ h(t,{error:w,hint:T,errorId:G,hintId:K}),k&&/* @__PURE__ */ g(`div`,{className:`field-count${A&&Z>=A?` at-limit`:``}`,children:[Z,A?` / ${A}`:``]})]})});export{v as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./AppActionIcon.js";import n from"./AppSegmented.js";import r from"./assertValidValue.js";import i from"./warnUnknownProps.js";import{DEFAULT_THEME_EFFECT as a,DEFAULT_THEME_STORAGE_KEY as o,THEME_CHANGE_EVENT as s,THEME_EFFECTS as c,THEME_MODES as l,applyTheme as u,nextTheme as d,readStoredTheme as f,resolveTheme as p,storeTheme as m,transitionTheme as h,watchSystemTheme as g}from"@webority/ui-elements/helpers";import{useCallback as _,useEffect as v,useId as y,useRef as b,useState as x}from"react";import{jsx as S}from"react/jsx-runtime";import{flushSync as C}from"react-dom";function w(e){return l.some(t=>t===e)}var T={light:`sun`,dark:`moon`,auto:`monitor`},E={light:`light`,dark:`dark`,auto:`follows your device`},D=[`icon`,`segmented`],O={sm:16,md:20,lg:24,xl:28};function k(l){let{marker:k,props:A}=e(`AppThemeToggle`,l),{variant:j=`icon`,effect:M=a,includeAuto:N=!0,storageKey:P=o,duration:F,label:I=`Theme`,lightLabel:L=`Light`,darkLabel:R=`Dark`,autoLabel:z=`System`,name:B,size:V=`md`,tooltipPlacement:H=`auto`,onChange:U,className:W=``,...G}=A;i(`AppThemeToggle`,G),r(`AppThemeToggle`,`variant`,j,D),r(`AppThemeToggle`,`effect`,M,c),r(`AppThemeToggle`,`size`,V,Object.keys(O));let K=_(e=>e===`auto`&&!N?p(e):e,[N]),[q,J]=x(()=>K(typeof window>`u`?`auto`:f(P))),Y=y(),X=B||Y,Z=b({shown:K,storageKey:P});v(()=>{let e=document.documentElement.getAttribute(`data-theme`);w(e)?J(Z.current.shown(e)):u(f(Z.current.storageKey))},[]),v(()=>{let e=e=>{let t=`detail`in e?e.detail:void 0,n=typeof t==`object`&&t&&`preference`in t?t.preference:void 0;w(n)&&J(K(n))};return document.addEventListener(s,e),()=>document.removeEventListener(s,e)},[K]),v(()=>g(()=>{document.documentElement.getAttribute(`data-theme`)===`auto`&&u(`auto`)}),[]);let Q=_((e,t)=>{let n=t?.getBoundingClientRect?.()??{left:0,top:0,width:0,height:0},r={x:n.left+n.width/2,y:n.top+n.height/2};h(()=>{u(e),m(e,P),C(()=>J(e)),U?.(e)},{effect:M,to:p(e),origin:r
|
|
1
|
+
import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./AppActionIcon.js";import n from"./AppSegmented.js";import r from"./assertValidValue.js";import i from"./warnUnknownProps.js";import{DEFAULT_THEME_EFFECT as a,DEFAULT_THEME_STORAGE_KEY as o,THEME_CHANGE_EVENT as s,THEME_EFFECTS as c,THEME_MODES as l,applyTheme as u,nextTheme as d,readStoredTheme as f,resolveTheme as p,storeTheme as m,transitionTheme as h,watchSystemTheme as g}from"@webority/ui-elements/helpers";import{useCallback as _,useEffect as v,useId as y,useRef as b,useState as x}from"react";import{jsx as S}from"react/jsx-runtime";import{flushSync as C}from"react-dom";function w(e){return l.some(t=>t===e)}var T={light:`sun`,dark:`moon`,auto:`monitor`},E={light:`light`,dark:`dark`,auto:`follows your device`},D=[`icon`,`segmented`],O={sm:16,md:20,lg:24,xl:28};function k(l){let{marker:k,props:A}=e(`AppThemeToggle`,l),{variant:j=`icon`,effect:M=a,includeAuto:N=!0,storageKey:P=o,duration:F,label:I=`Theme`,lightLabel:L=`Light`,darkLabel:R=`Dark`,autoLabel:z=`System`,name:B,size:V=`md`,tooltipPlacement:H=`auto`,onChange:U,className:W=``,...G}=A;i(`AppThemeToggle`,G),r(`AppThemeToggle`,`variant`,j,D),r(`AppThemeToggle`,`effect`,M,c),r(`AppThemeToggle`,`size`,V,Object.keys(O));let K=_(e=>e===`auto`&&!N?p(e):e,[N]),[q,J]=x(()=>K(typeof window>`u`?`auto`:f(P))),Y=y(),X=B||Y,Z=b({shown:K,storageKey:P});v(()=>{let e=document.documentElement.getAttribute(`data-theme`);w(e)?J(Z.current.shown(e)):u(f(Z.current.storageKey))},[]),v(()=>{let e=e=>{let t=`detail`in e?e.detail:void 0,n=typeof t==`object`&&t&&`preference`in t?t.preference:void 0;w(n)&&J(K(n))};return document.addEventListener(s,e),()=>document.removeEventListener(s,e)},[K]),v(()=>g(()=>{document.documentElement.getAttribute(`data-theme`)===`auto`&&u(`auto`)}),[]);let Q=_((e,t)=>{let n=t?.getBoundingClientRect?.()??{left:0,top:0,width:0,height:0},r={x:n.left+n.width/2,y:n.top+n.height/2};h(()=>{u(e),m(e,P),C(()=>J(e)),U?.(e)},{effect:M,to:p(e),origin:r,...F===void 0?null:{duration:F}})},[P,M,F,U]);if(j===`segmented`){let e=[{value:`light`,label:L,icon:T.light},{value:`dark`,label:R,icon:T.dark}];return N&&e.push({value:`auto`,label:z,icon:T.auto}),/* @__PURE__ */ S(n,{...k,options:e,value:q,name:X,label:I,size:V===`xl`?`lg`:V,className:[`wui-theme-toggle`,`wui-theme-toggle-segmented`,W].filter(Boolean).join(` `),onChange:e=>{if(!w(e)||e===q)return;let t=document.querySelector(`.segmented-input[name="${CSS.escape(X)}"][value="${e}"]`);Q(e,t?.closest(`.segmented-option`)??t)}})}return/* @__PURE__ */ S(t,{...k,icon:T[q],label:`${I}: ${E[q]}`,size:O[V]??O.md,tooltipPlacement:H,onClick:e=>Q(d(q,{includeAuto:N}),e.currentTarget),className:[`wui-theme-toggle`,W].filter(Boolean).join(` `)})}export{k as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{shortcutChip as e}from"../lib/shortcutChip.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./assertValidValue.js";import r from"./warnUnknownProps.js";import{cloneElement as i,useEffect as a,useId as o,useRef as s,useState as c}from"react";import{OverlayTrigger as l,Tooltip as u}from"react-bootstrap";import{jsx as d,jsxs as f}from"react/jsx-runtime";var p=[`neutral`,`primary`,`success`,`warning`,`danger`],m=[`inverse`],h=[`sm`,`md`,`lg`],g={start:`left`,end:`right`,top:`top`,bottom:`bottom`},_=[`auto`,`top`,`bottom`,`start`,`end`],v={modifiers:[{name:`offset`,options:{offset:[0,6]}}]};function y(y){let{marker:b,props:x}=t(`AppTooltip`,y),{content:S,children:C,placement:w=`top`,tone:T=`neutral`,variant:E,size:D=`md`,open:O,shortcut:k,className:A=``,...j}=x;r(`AppTooltip`,j),n(`AppTooltip`,`tone`,T,p),n(`AppTooltip`,`variant`,E,m),n(`AppTooltip`,`size`,D,h),n(`AppTooltip`,`placement`,w,_);let M=o(),[N,P]=c(!1),F=typeof O==`boolean`,I=[`wui-tooltip`,T&&T!==`neutral`?`tone-${T}`:``,E?`wui-tooltip-${E}`:``,D&&D!==`md`?`size-${D}`:``,A].filter(Boolean).join(` `),L=/* @__PURE__ */ f(u,{id:M,className:I,...b,children:[S,e(k,{inTooltip:!0})]}),R=e=>{C.props.onClick?.(e),j.onClick?.(e),P(!1)},z=s(!1),B=e=>{C.props.onFocusCapture?.(e),j.onFocusCapture?.(e),z.current=!e.currentTarget.matches?.(`:focus-visible`),queueMicrotask(()=>{z.current=!1})};return a(()=>{if(F||!N)return;let e=e=>{e.key===`Escape`&&(e.stopPropagation(),P(!1))};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},[F,N]),/* @__PURE__ */ d(l,{trigger:[`hover`,`focus`],placement:g[w]??`auto`,popperConfig:v,show:F?O:N
|
|
1
|
+
import{shortcutChip as e}from"../lib/shortcutChip.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./assertValidValue.js";import r from"./warnUnknownProps.js";import{cloneElement as i,useEffect as a,useId as o,useRef as s,useState as c}from"react";import{OverlayTrigger as l,Tooltip as u}from"react-bootstrap";import{jsx as d,jsxs as f}from"react/jsx-runtime";var p=[`neutral`,`primary`,`success`,`warning`,`danger`],m=[`inverse`],h=[`sm`,`md`,`lg`],g={start:`left`,end:`right`,top:`top`,bottom:`bottom`},_=[`auto`,`top`,`bottom`,`start`,`end`],v={modifiers:[{name:`offset`,options:{offset:[0,6]}}]};function y(y){let{marker:b,props:x}=t(`AppTooltip`,y),{content:S,children:C,placement:w=`top`,tone:T=`neutral`,variant:E,size:D=`md`,open:O,shortcut:k,className:A=``,...j}=x;r(`AppTooltip`,j),n(`AppTooltip`,`tone`,T,p),n(`AppTooltip`,`variant`,E,m),n(`AppTooltip`,`size`,D,h),n(`AppTooltip`,`placement`,w,_);let M=o(),[N,P]=c(!1),F=typeof O==`boolean`,I=[`wui-tooltip`,T&&T!==`neutral`?`tone-${T}`:``,E?`wui-tooltip-${E}`:``,D&&D!==`md`?`size-${D}`:``,A].filter(Boolean).join(` `),L=/* @__PURE__ */ f(u,{id:M,className:I,...b,children:[S,e(k,{inTooltip:!0})]}),R=e=>{C.props.onClick?.(e),j.onClick?.(e),P(!1)},z=s(!1),B=e=>{C.props.onFocusCapture?.(e),j.onFocusCapture?.(e),z.current=!e.currentTarget.matches?.(`:focus-visible`),queueMicrotask(()=>{z.current=!1})};return a(()=>{if(F||!N)return;let e=e=>{e.key===`Escape`&&(e.stopPropagation(),P(!1))};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},[F,N]),/* @__PURE__ */ d(l,{trigger:[`hover`,`focus`],placement:g[w]??`auto`,popperConfig:v,show:F?O:N,...F?null:{onToggle:e=>{let t=z.current;z.current=!1,e&&t||P(e)}},overlay:L,children:F?i(C,j):i(C,{...j,onClick:R,onFocusCapture:B})})}export{y as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/useElementEntry.js";import{TONES as n}from"../lib/vocabulary.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./AppIcon.js";import a from"./assertValidValue.js";import ee from"./warnUnknownProps.js";import{Children as te,forwardRef as o,useEffect as s,useRef as c}from"react";import{jsx as l,jsxs as u}from"react/jsx-runtime";var ne=[`steps`,`journey`,`icons`,`tiles`],d=n.filter(e=>e!==`neutral`),f=[`horizontal`,`vertical`],p=[`center`,`start`],m=[`done`,`active`,`pending`,`error`],h=[`key`,`label`,`description`,`optional`,`icon`,`status`],re=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],ie=[`check`,`alert-triangle`,`minus`],g=[`sm`,`md`,`lg`],_={sm:14,md:16,lg:20},v=()=>import(`@webority/ui-elements/elements/wizard`),y=/* @__PURE__ */ new Set,b=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}};function ae(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
|
|
1
|
+
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/useElementEntry.js";import{TONES as n}from"../lib/vocabulary.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./AppIcon.js";import a from"./assertValidValue.js";import ee from"./warnUnknownProps.js";import{Children as te,forwardRef as o,useEffect as s,useRef as c}from"react";import{jsx as l,jsxs as u}from"react/jsx-runtime";var ne=[`steps`,`journey`,`icons`,`tiles`],d=n.filter(e=>e!==`neutral`),f=[`horizontal`,`vertical`],p=[`center`,`start`],m=[`done`,`active`,`pending`,`error`],h=[`key`,`label`,`description`,`optional`,`icon`,`status`],re=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],ie=[`check`,`alert-triangle`,`minus`],g=[`sm`,`md`,`lg`],_={sm:14,md:16,lg:20},v=()=>import(`@webority/ui-elements/elements/wizard`),y=/* @__PURE__ */ new Set,b=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}};function ae(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(b())for(let r of Object.keys(t)){if(h.includes(r))continue;let t=`AppWizard: steps[${n}] has an unknown field ${r}; the fields are ${h.join(`, `)}.`;y.has(t)||(y.add(t),e(t))}})}var x=o(function(e,n){let o=t(`wui-wizard`,v),{marker:h,props:y}=r(`AppWizard`,e),{steps:b=[],children:x,active:S,defaultActive:C=0,onStepChange:w,onFinish:T,onSkip:E,beforeNext:D,onInvalid:O,onClose:k,variant:A=`steps`,tone:j,doneTone:M,orientation:N=`horizontal`,align:P=`center`,iconVariant:F,size:I=`md`,iconSize:L,skippable:R=!1,nonLinear:z=!1,hideStepper:B=!1,hideConnectors:V=!1,disabled:H=!1,label:U=`Progress`,backLabel:W=`Back`,nextLabel:G=`Next`,skipLabel:K=`Skip`,finishLabel:q=`Finish`,topBar:oe=!1,barTitle:se,closeLabel:J=`Close`,className:ce=``,...Y}=y;ee(`AppWizard`,Y),a(`AppWizard`,`variant`,A,ne),a(`AppWizard`,`tone`,j,d),a(`AppWizard`,`doneTone`,M,d),a(`AppWizard`,`orientation`,N,f),a(`AppWizard`,`align`,P,p),a(`AppWizard`,`iconVariant`,F,re),a(`AppWizard`,`size`,I,g),ae(b);let X=L!==void 0&&L>0?L:_[I]??_.md;for(let e of b)a(`AppWizard`,`steps[].status`,e.status,m);let Z=c(null),le=e=>{Z.current=e,typeof n==`function`?n(e):n&&(n.current=e)},ue=te.toArray(x),Q=F&&F!==`linear`?[.../* @__PURE__ */ new Set([...ie,...b.map(e=>e.icon).filter(e=>!!e)])]:[],de=[j&&`wui-step-tone-${j}`,M&&`wui-step-done-tone-${M}`,I!==`md`&&g.includes(I)&&`wui-step-size-${I}`,ce].filter(Boolean).join(` `),$=c(S===void 0?C:S);return s(()=>{let e=Z.current;e&&o&&$.current&&(e.active=$.current)},[o]),s(()=>{let e=Z.current;e&&o&&S!==void 0&&Number(e.active)!==S&&(e.active=S)},[S,o]),s(()=>{let e=Z.current;e&&o&&(e.beforeNext=D??null)},[D,o]),s(()=>{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;w?.(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;T?.(t)},r=e=>{if(!(e instanceof CustomEvent))throw Error(`AppWizard: wui-wizard:skip must be a CustomEvent carrying its detail.`);let t=e.detail;E?.(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;O?.(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;k?.(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)}},[w,T,E,O,k]),/* @__PURE__ */ u(`wui-wizard`,{ref:le,variant:A,orientation:N,align:P===`start`?`start`:void 0,"icon-size":X===16?void 0:X,skippable:R?``:void 0,"non-linear":z?``:void 0,"hide-stepper":B?``:void 0,"hide-connectors":V?``:void 0,disabled:H?``:void 0,label:U,"back-label":W,"next-label":G,"skip-label":K,"finish-label":q,"top-bar":oe?``:void 0,"bar-title":se||void 0,"close-label":J,className:de||void 0,...h,...Y,children:[b.map((e,t)=>/* @__PURE__ */ l(`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:ue[t]},e.key??`${e.label}-${t}`)),Q.length>0&&/* @__PURE__ */ l(`span`,{hidden:!0,"data-wui-glyphs":``,children:Q.map(e=>/* @__PURE__ */ l(i,{name:e,size:X,variant:F},e))})]})});export{x as default};
|