@webority/ui-react 0.164.0 → 0.165.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/LICENSE +1 -1
- package/dist/canvas-kit/kit.js +206 -206
- package/dist/canvas-kit/manifest.json +1086 -406
- package/dist/canvas-kit/release.json +6 -6
- package/dist/components/AppAsyncBlock.js +1 -1
- package/dist/components/AppColorField.js +1 -1
- package/dist/components/AppDataTable.js +1 -1
- package/dist/components/AppDatePicker.js +1 -1
- package/dist/components/AppDateRangePicker.js +1 -1
- package/dist/components/AppDescriptions.js +1 -1
- package/dist/components/AppDropZone.js +1 -1
- package/dist/components/AppDropdown.js +1 -1
- package/dist/components/AppEntryGrid.js +1 -0
- 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 -1
- package/dist/components/AppFormulaSteps.js +1 -0
- package/dist/components/AppImagePicker.js +1 -1
- package/dist/components/AppInput.js +1 -1
- package/dist/components/AppMentionInput.js +1 -1
- package/dist/components/AppMetricStrip.js +1 -1
- package/dist/components/AppModal.js +1 -1
- package/dist/components/AppNumberInput.js +1 -1
- package/dist/components/AppOtpInput.js +1 -1
- package/dist/components/AppPhoneNumberInput.js +1 -1
- package/dist/components/AppPopover.js +1 -1
- package/dist/components/AppRadioGroup.js +1 -1
- package/dist/components/AppRating.js +1 -1
- package/dist/components/AppRichText.js +1 -1
- package/dist/components/AppRowActions.js +1 -0
- package/dist/components/AppScoreScale.js +1 -1
- package/dist/components/AppSectionFeatures.js +1 -1
- package/dist/components/AppSectionLogos.js +1 -1
- package/dist/components/AppSelect.js +1 -1
- package/dist/components/AppShell.js +1 -1
- package/dist/components/AppSlider.js +1 -1
- package/dist/components/AppTextarea.js +1 -1
- package/dist/components/AppTimePicker.js +1 -1
- package/dist/components/AppToast.js +1 -1
- package/dist/guidance.json +212 -137
- package/dist/hookForm/index.js +1 -0
- package/dist/lib/CheckField.js +1 -1
- package/dist/lib/formFields.js +1 -0
- package/dist/lib/unsavedText.js +1 -0
- package/dist/types/components/AppAsyncBlock.d.ts +3 -3
- package/dist/types/components/AppChart.d.ts +12 -4
- package/dist/types/components/AppDataTable.d.ts +29 -2
- package/dist/types/components/AppDateRangePicker.d.ts +4 -0
- package/dist/types/components/AppDescriptions.d.ts +6 -0
- package/dist/types/components/AppEntryGrid.d.ts +122 -0
- package/dist/types/components/AppFilterBar.d.ts +12 -1
- package/dist/types/components/AppForm.d.ts +18 -0
- package/dist/types/components/AppFormulaSteps.d.ts +64 -0
- package/dist/types/components/AppMetricStrip.d.ts +5 -0
- package/dist/types/components/AppModal.d.ts +5 -0
- package/dist/types/components/AppRowActions.d.ts +40 -0
- package/dist/types/components/AppSectionFeatures.d.ts +5 -1
- package/dist/types/components/AppSectionLogos.d.ts +1 -0
- package/dist/types/components/AppShell.d.ts +2 -0
- package/dist/types/components/AppSlider.d.ts +5 -0
- package/dist/types/components/AppToast.d.ts +5 -0
- package/dist/types/hookForm/index.d.ts +14 -0
- package/dist/types/index.d.ts +7 -5
- package/dist/types/lib/formFields.d.ts +12 -0
- package/dist/types/lib/unsavedText.d.ts +5 -0
- package/dist/ui-react.js +1 -1
- package/dist/web-core/dist/errors/extractApiError.js +2 -0
- package/dist/web-core/dist/errors/requestPlatform.js +1 -0
- package/package.json +20 -9
- package/dist/components/AppResizable.js +0 -1
- package/dist/components/AppResizableHandle.js +0 -1
- package/dist/components/AppResizablePanel.js +0 -1
- package/dist/components/AppRollingNumber.js +0 -1
- package/dist/components/AppRowSwitch.js +0 -1
- package/dist/types/components/AppResizable.d.ts +0 -37
- package/dist/types/components/AppResizableHandle.d.ts +0 -14
- package/dist/types/components/AppResizablePanel.d.ts +0 -14
- package/dist/types/components/AppRollingNumber.d.ts +0 -30
- package/dist/types/components/AppRowSwitch.d.ts +0 -18
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/FieldMessage.js";import{FIELD_SIZES as t}from"../lib/fieldState.js";import n from"../lib/useElementEntry.js";import{splitMarkerProps as
|
|
1
|
+
import e from"../lib/FieldMessage.js";import{FIELD_SIZES as t}from"../lib/fieldState.js";import{useFieldError as n}from"../lib/formFields.js";import r from"../lib/useElementEntry.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./AppInfoTip.js";import o from"./AppRequiredMark.js";import ee from"./assertValidValue.js";import s from"./useWuiControl.js";import c from"./warnUnknownProps.js";import{forwardRef as l,useEffect as u,useId as d,useRef as f}from"react";import{jsx as p,jsxs as m}from"react/jsx-runtime";var h=()=>import(`@webority/ui-elements/elements/mention-input`),te=e=>typeof e==`object`&&!!e&&`query`in e&&typeof e.query==`string`,g=l(function(l,g){let _=r(`wui-mention-input`,h),{marker:v,props:y}=i(`AppMentionInput`,l),{value:b,defaultValue:x,onChange:S,people:C,loadPeople:w,minChars:T,debounce:E,onSubmit:D,rows:O=3,placeholder:k,disabled:A=!1,readOnly:j=!1,loading:M=!1,size:N=`md`,name:P,id:F,label:I,error:L,helperText:R,required:z=!1,help:B,helpLabel:V=`More information`,className:H=``,fieldClassName:U=``,...W}=y,G=n(P),K=L??G;c(`AppMentionInput`,W),ee(`AppMentionInput`,`size`,N,t);let q=typeof w==`function`,J=d(),Y=F||`mention-${J.replace(/[^a-zA-Z0-9_-]/g,``)}`,X=K?`${Y}-error`:R?`${Y}-hint`:void 0,Z=f(M),Q=f(!1),{setRef:ne,innerRef:$}=s({ready:_,ref:g,value:b??(x===void 0?``:void 0),defaultValue:x,on:{change:e=>{let t=$.current;if(e.target===e.currentTarget&&t){if(typeof t.value!=`string`||!Array.isArray(t.mentions))throw TypeError(`<wui-mention-input> reported a change without its value and mentions.`);S?.(t.value,{mentions:t.mentions})}},"wui:mention-input:submit":()=>D?.()}});return u(()=>{let e=$.current;e&&_&&!q&&(e.people=C||[])},[C,q,_,$]),u(()=>{Z.current=M;let e=$.current;e&&_&&!Q.current&&(e.loading=M)},[M,_,$]),u(()=>{let e=$.current;if(!e||!_||!q)return;let t=0,n=null,r=async r=>{if(!(r instanceof CustomEvent))throw TypeError(`<wui-mention-input> search arrived without its query.`);let i=r.detail;if(!te(i))throw TypeError(`<wui-mention-input> search arrived without its query.`);let a=i.query,o=++t;n?.abort(),n=typeof AbortController==`function`?new AbortController:null,Q.current=!0,e.loading=!0;try{let r=await w(a,{signal:n?.signal});o===t&&(e.people=r||[])}catch(r){if((r instanceof DOMException||r instanceof Error)&&r.name===`AbortError`)return;o===t&&(e.people=[],e.searchFailed=!0,n?.signal.aborted||reportError(r))}finally{o===t&&(Q.current=!1,e.loading=Z.current)}};return e.addEventListener(`search`,r),()=>{t=-1,n?.abort(),e.removeEventListener(`search`,r),Q.current=!1,e.loading=Z.current}},[q,w,_,$]),/* @__PURE__ */ m(`div`,{...v,className:`field${U?` ${U}`:``}`,children:[I&&/* @__PURE__ */ m(`label`,{className:`label`,htmlFor:`${Y}-text`,children:[I,z&&/* @__PURE__ */ p(o,{}),B&&/* @__PURE__ */ p(a,{label:V,children:B})]}),/* @__PURE__ */ p(`wui-mention-input`,{ref:ne,id:Y,class:H?`wui-mention-input ${H}`:`wui-mention-input`,label:typeof I==`string`?I:void 0,placeholder:k||void 0,rows:String(O),name:P||void 0,remote:q?``:void 0,"min-chars":T==null?void 0:String(T),debounce:E==null?void 0:String(E),disabled:A?``:void 0,readonly:j?``:void 0,loading:M?``:void 0,size:N===`md`?void 0:N,"aria-describedby":X,"aria-invalid":K?`true`:void 0,...W}),/* @__PURE__ */ p(e,{error:K,hint:R,errorId:`${Y}-error`,hintId:`${Y}-hint`})]})});export{g as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{linkTarget as e}from"../lib/linkTarget.js";import{TargetLink as t}from"../lib/TargetLink.js";import{TONES as n}from"../lib/vocabulary.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./assertValidValue.js";import a from"./warnUnknownProps.js";import{Fragment as o,jsx as s,jsxs as c}from"react/jsx-runtime";var l=[3,4,5],u=[`sm`,`md`],d=n.filter(e=>e!==`primary`);function f(n){let{marker:f,props:p}=r(`AppMetricStrip`,n),{items:m=[],columns:h=4,size:g=`md`,
|
|
1
|
+
import{linkTarget as e}from"../lib/linkTarget.js";import{TargetLink as t}from"../lib/TargetLink.js";import{TONES as n}from"../lib/vocabulary.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./assertValidValue.js";import a from"./warnUnknownProps.js";import{Fragment as o,jsx as s,jsxs as c}from"react/jsx-runtime";var l=[3,4,5],u=[`sm`,`md`],d=n.filter(e=>e!==`primary`);function f(n){let{marker:f,props:p}=r(`AppMetricStrip`,n),{items:m=[],columns:h=4,size:g=`md`,divided:_=!1,linkComponent:v,className:y=``,...b}=p;a(`AppMetricStrip`,b),i(`AppMetricStrip`,`columns`,h,l),i(`AppMetricStrip`,`size`,g,u);let x=[`wui-metric-strip`,`wui-metric-strip-cols-${h}`,g===`sm`?`wui-metric-strip-sm`:``,_?`wui-metric-strip-divided`:``,y].filter(Boolean).join(` `);return/* @__PURE__ */ s(`div`,{className:x,...f,...b,children:m.map((n,r)=>{i(`AppMetricStrip`,`tone`,n.tone,d);let a=`wui-metric${n.tone&&n.tone!==`neutral`?` wui-metric-tone-${n.tone}`:``}`,l=/* @__PURE__ */ c(o,{children:[/* @__PURE__ */ s(`div`,{className:`wui-metric-label`,children:n.label}),/* @__PURE__ */ s(`div`,{className:`wui-metric-value`,children:n.value}),n.note&&/* @__PURE__ */ s(`div`,{className:`wui-metric-note`,children:n.note})]}),u=`${n.label}-${r}`,f=e(v,{href:n.href});return n.href?/* @__PURE__ */ s(t,{link:f,className:a,children:l},u):/* @__PURE__ */ s(`div`,{className:a,children:l},u)})})}export{f as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/DiscardPrompt.js";import{devWarn as t}from"../lib/devWarn.js";import n from"../lib/useElementEntry.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./AppIcon.js";import a from"./assertValidValue.js";import
|
|
1
|
+
import e from"../lib/DiscardPrompt.js";import{devWarn as t}from"../lib/devWarn.js";import n from"../lib/useElementEntry.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{useCallback as o,useEffect as s,useRef as c,useState as l}from"react";import{createPortal as u}from"react-dom";import{jsx as d,jsxs as f}from"react/jsx-runtime";var p=[`neutral`,`danger`,`success`,`warning`],m=[`center`,`top`],te=[`sans`,`serif`],ne=()=>import(`@webority/ui-elements/elements/modal`),h={sm:380,md:440,lg:640,xl:880},re=`wui-modal-fullscreen`,ie=e=>typeof e==`number`?e:e===`fullscreen`?h.md:h[e],g=!1;function _(){let e=!0;try{e=process.env.NODE_ENV!==`production`}catch{e=!0}e&&!g&&(g=!0,t("[@webority/ui-react] <AppModal hideHeader> has no accessible name: pass `ariaLabel` (or a string `title`)."))}function v(t){n(`wui-modal`,ne);let{marker:g,props:v}=r(`AppModal`,t),{open:y,eyebrow:b,title:x,subtitle:S,headerIcon:C,tone:w=`neutral`,dismissible:ae=!0,onClose:T,onBack:E,backLabel:D=`Back`,headerActions:O,footer:k,size:A=`md`,placement:j=`center`,titleFont:M=`sans`,hideHeader:N=!1,staticBackdrop:oe=!0,closeOnEscape:se=!0,confirmDiscard:P,dirty:ce=!1,ariaLabel:F,closeLabel:le=`Close`,className:I=``,children:L,...R}=v;ee(`AppModal`,R),a(`AppModal`,`tone`,w,p),a(`AppModal`,`placement`,j,m),a(`AppModal`,`titleFont`,M,te),a(`AppModal`,`size`,typeof A==`string`?A:null,[...Object.keys(h),`fullscreen`]);let{style:z,ref:B,onExited:V,"data-wui":H,"data-wui-props":U,...ue}=R,W=H?{"data-wui":H,"data-wui-props":U}:g,de=W[`data-wui`],fe=W[`data-wui-props`];N&&!F&&typeof x!=`string`&&_();let G=c(null),K=c(null),[pe,q]=l(y),me=y||pe;s(()=>{y&&q(!0)},[y]);let J=c(null),[Y,X]=l(!1);s(()=>{y||X(!1)},[y]),s(()=>{Y&&J.current?.focus()},[Y]);let he=o(e=>{K.current=e,typeof B==`function`?B(e):B&&(B.current=e)},[B]),ge=()=>{P&&ce?X(!0):T?.()},Z=c({open:y,requestClose:()=>{},onExited:V});Z.current={open:y,requestClose:ge,onExited:V};let _e=o(e=>{if(!e)return;let t=t=>t.target instanceof Element&&t.target.closest(`wui-modal`)===e,n=e=>{t(e)&&(e.preventDefault(),Z.current.requestClose())},r=e=>{if(!t(e))return;Z.current.open||q(!1);let n=K.current;if(!n)throw TypeError(`<wui-modal> closed without its dialog.`);Z.current.onExited?.(n)};return e.addEventListener(`wui-modal-close`,n),e.addEventListener(`wui-modal-closed`,r),()=>{e.removeEventListener(`wui-modal-close`,n),e.removeEventListener(`wui-modal-closed`,r)}},[]),Q=()=>{X(!1),T?.()},ve=()=>{X(!1),(G.current?.querySelector(`input:not([type="hidden"]):not([disabled]),select:not([disabled]),textarea:not([disabled])`))?.focus()},$=A===`fullscreen`,ye=ie(A),be=[`modal-content`,`wui-modal`,w===`neutral`?``:`tone-${w}`,I].filter(Boolean).join(` `),xe=[`modal`,`wui-modal-shell`,$&&re].filter(Boolean).join(` `),Se=[`modal-dialog`,j!==`top`&&`modal-dialog-centered`,`wui-rb-dialog`].filter(Boolean).join(` `),Ce=$?z:{"--wui-modal-max-width":`${ye}px`,...z};return!me||typeof document>`u`?null:u(/* @__PURE__ */ d(`wui-modal`,{ref:_e,"data-wui":de,"data-wui-props":fe,open:y?``:void 0,static:oe?``:void 0,"no-escape":se&&!Y?void 0:``,"confirm-discard":P||void 0,children:/* @__PURE__ */ d(`dialog`,{...ue,ref:he,className:xe,"aria-label":F||(typeof x==`string`?x:void 0),style:Ce,children:/* @__PURE__ */ d(`div`,{className:Se,children:/* @__PURE__ */ f(`div`,{className:be,children:[!N&&/* @__PURE__ */ f(`div`,{className:`wui-modal-header`,children:[E&&/* @__PURE__ */ d(`button`,{type:`button`,className:`wui-modal-back`,onClick:E,"aria-label":D,children:/* @__PURE__ */ d(i,{name:`arrow-left`,size:18})}),/* @__PURE__ */ f(`div`,{className:`wui-modal-heading`,children:[C&&/* @__PURE__ */ d(`span`,{className:`wui-modal-headicon`,children:/* @__PURE__ */ d(i,{name:C,size:18})}),/* @__PURE__ */ f(`div`,{className:`wui-modal-headtext`,children:[b&&/* @__PURE__ */ d(`div`,{className:`wui-modal-eyebrow`,children:b}),/* @__PURE__ */ d(`div`,{className:M===`serif`?`wui-modal-title wui-modal-title-serif`:`wui-modal-title`,children:x}),S&&/* @__PURE__ */ d(`div`,{className:`wui-modal-subtitle`,children:S})]})]}),O&&/* @__PURE__ */ d(`div`,{className:`wui-modal-header-actions`,children:O}),ae&&/* @__PURE__ */ d(`button`,{type:`button`,className:`wui-modal-close`,"data-wui-dismiss":``,"aria-label":le,children:/* @__PURE__ */ d(`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__ */ d(`path`,{d:`M18 6 6 18M6 6l12 12`})})})]}),/* @__PURE__ */ d(`div`,{className:`wui-modal-body`,ref:G,children:L}),(k||Y)&&/* @__PURE__ */ f(`div`,{className:Y?`wui-modal-footer wui-drawer-discarding`:`wui-modal-footer`,children:[Y&&/* @__PURE__ */ d(e,{text:P,confirmRef:J,onDiscard:Q,onKeep:ve}),k]})]})})})}),document.body)}export{v as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/FieldMessage.js";import{FIELD_BUSY_CLASS as t}from"../lib/fieldState.js";import{
|
|
1
|
+
import e from"../lib/FieldMessage.js";import{FIELD_BUSY_CLASS as t}from"../lib/fieldState.js";import{useFieldError as n}from"../lib/formFields.js";import{groupIndianText as r}from"../lib/indianGrouping.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./AppIcon.js";import ee from"./AppInfoTip.js";import te from"./AppRequiredMark.js";import o from"./assertValidValue.js";import ne from"./warnUnknownProps.js";import{forwardRef as s,useCallback as re,useEffect as ie,useId as ae,useLayoutEffect as oe,useRef as c,useState as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import{Form as f}from"react-bootstrap";var se=[`sm`,`md`,`lg`],ce=[`none`,`indian`],p=e=>{if(e===``||e==null)return null;let t=parseFloat(e.replace(/,/g,``));return Number.isNaN(t)?null:t},m=(e,t)=>e.slice(0,t).replace(/\D/g,``).length,h=(e,t)=>{if(t<=0)return 0;let n=0;for(let r=0;r<e.length;r++)if(/\d/.test(e.charAt(r))&&++n===t)return r+1;return e.length},g=(e,t,n)=>{let i=t>0&&typeof e==`number`&&Number.isFinite(e)?e.toFixed(t):String(e??``);return n===`indian`?r(i):i},_=s(function(s,_){let{marker:le,props:ue}=i(`AppNumberInput`,s),{label:v,required:y=!1,optional:de=!1,error:fe,helperText:b,help:x,helpLabel:pe=`More information`,decreaseLabel:me=`Decrease`,increaseLabel:he=`Increase`,optionalLabel:ge=`(optional)`,value:S,onChange:C,min:w,max:T,step:_e=1,precision:E=0,grouping:D=`none`,unit:O,size:k=`md`,id:ve,name:A,className:ye=``,fieldClassName:j=``,disabled:M=!1,readOnly:N=!1,loading:P=!1,defaultValue:F,...I}=ue,be=n(A),L=fe??be,R=N||P;ne(`AppNumberInput`,I),o(`AppNumberInput`,`size`,k,se),o(`AppNumberInput`,`grouping`,D,ce);let xe=ae(),z=ve||xe,B=e=>{if(E===0)return Math.round(e);let t=10**E;return Math.round(e*t)/t},V=e=>{let t=e;return typeof w==`number`&&(t=Math.max(t,w)),typeof T==`number`&&(t=Math.min(t,T)),t},H=e=>g(e,E,D),[U,W]=l(()=>H(S??F)),G=c(D);ie(()=>{let e=S??F,t=G.current!==D;G.current=D,W(n=>!t&&p(n)===(e??null)?n:g(t&&S===void 0?p(n):e,E,D))},[S,F,E,D]);let K=c(null),q=c(null),[,Se]=l(0),Ce=re(e=>{K.current=e,typeof _==`function`?_(e):_&&(_.current=e)},[_]);oe(()=>{let e=q.current,t=K.current;if(e===null||t===null)return;q.current=null;let n=h(U,e);t.setSelectionRange(n,n)});let J=e=>{let t=(p(U)??V(0))+e*_e,n=V(B(t));W(H(n)),C?.(n)},Y=p(U),we=M||N||P||Y!==null&&typeof w==`number`&&Y<=w,Te=M||N||P||Y!==null&&typeof T==`number`&&Y>=T,X=L&&z?`${z}-error`:void 0,Z=b&&z?`${z}-hint`:void 0,Ee=X||Z,De=[`input`,k===`sm`?`input-sm`:``,k===`lg`?`input-lg`:``,L?`error`:``,`num-input`,ye,P?t:``].filter(Boolean).join(` `),Q=RegExp(`^${typeof w==`number`&&w>=0?``:`-?`}\\d*${E>0?`(\\.\\d*)?`:``}$`),$=(e,t)=>{let n=D===`indian`?e.replace(/,/g,``):e;if(!Q.test(n))return;let i=D===`indian`?r(n):n;if(i!==e&&i===U){let e=h(i,t);queueMicrotask(()=>K.current?.setSelectionRange(e,e))}else i!==e&&(q.current=t,Se(e=>e+1));W(i);let a=p(n);a!==null&&C?.(a)},Oe=e=>{let t=e.target.value;$(t,m(t,e.target.selectionStart??t.length))},ke=e=>{if(R){I.onBlur?.(e);return}let t=p(e.target.value);if(t===null)W(``),C?.(null);else{let e=V(B(t));W(H(e)),C?.(e)}I.onBlur?.(e)},Ae=e=>{if(R)I.onKeyDown?.(e);else{if(D===`indian`&&(e.key===`Backspace`||e.key===`Delete`)){let t=e.currentTarget.value,n=e.currentTarget.selectionStart;if(n!==null&&e.currentTarget.selectionEnd===n){let r=e.key===`Backspace`?n-1:n,i=e.key===`Backspace`?n-2:n+1;i>=0&&t.charAt(r)===`,`&&/\d/.test(t.charAt(i))&&(e.preventDefault(),$(t.slice(0,i)+t.slice(i+1),m(t,i)))}}e.key===`ArrowUp`?(e.preventDefault(),J(1)):e.key===`ArrowDown`&&(e.preventDefault(),J(-1)),I.onKeyDown?.(e)}},je=/* @__PURE__ */ u(f.Control,{...I,id:z,name:D===`indian`?void 0:A,type:`text`,inputMode:E>0?`decimal`:`numeric`,className:De,disabled:M,readOnly:R,"aria-busy":P||void 0,required:y,"aria-invalid":L?`true`:`false`,"aria-describedby":Ee,value:U,ref:Ce,onChange:Oe,onBlur:ke,onKeyDown:Ae}),Me=[`num-wrap`,k===`sm`?`num-wrap-sm`:``,k===`lg`?`num-wrap-lg`:``].filter(Boolean).join(` `),Ne=/* @__PURE__ */ d(`div`,{className:Me,children:[/* @__PURE__ */ u(`button`,{type:`button`,className:`num-btn`,"aria-label":me,tabIndex:-1,disabled:we,onClick:()=>J(-1),children:/* @__PURE__ */ u(a,{name:`minus`,size:16})}),je,O&&/* @__PURE__ */ u(`span`,{className:`affix`,children:O}),/* @__PURE__ */ u(`button`,{type:`button`,className:`num-btn`,"aria-label":he,tabIndex:-1,disabled:Te,onClick:()=>J(1),children:/* @__PURE__ */ u(a,{name:`plus`,size:16})})]}),Pe=D===`indian`&&A?/* @__PURE__ */ u(`input`,{type:`hidden`,name:A,value:U.replace(/,/g,``),disabled:M,"data-wui-number-plain":``}):null;return/* @__PURE__ */ d(f.Group,{...le,"data-grouping":D===`indian`?D:void 0,className:`field${j?` ${j}`:``}`,children:[v&&/* @__PURE__ */ d(f.Label,{className:`label`,htmlFor:z,children:[v,de&&!y&&/* @__PURE__ */ u(`span`,{className:`label-optional`,children:` ${ge}`}),y&&/* @__PURE__ */ u(te,{}),x&&/* @__PURE__ */ u(ee,{label:pe,children:x})]}),Ne,Pe,/* @__PURE__ */ u(e,{error:L,hint:b,errorId:X,hintId:Z})]})});export{_ as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/FieldMessage.js";import{FIELD_SIZES as t}from"../lib/fieldState.js";import n from"../lib/useElementEntry.js";import{splitMarkerProps as
|
|
1
|
+
import e from"../lib/FieldMessage.js";import{FIELD_SIZES as t}from"../lib/fieldState.js";import{useFieldError as n}from"../lib/formFields.js";import r from"../lib/useElementEntry.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./AppInfoTip.js";import o from"./AppRequiredMark.js";import s from"./assertValidValue.js";import c from"./useWuiControl.js";import l from"./warnUnknownProps.js";import{cloneElement as u,forwardRef as d,useId as f}from"react";import{jsx as p,jsxs as m}from"react/jsx-runtime";var h=[`numeric`,`alphanumeric`],g=()=>import(`@webority/ui-elements/elements/otp`),_=d(function(d,_){let v=r(`wui-otp`,g),{marker:y,props:b}=i(`AppOtpInput`,d),{value:x,defaultValue:S,onChange:C,onComplete:w,length:T=6,mode:E=`numeric`,size:D=`md`,label:O,required:k=!1,optional:A=!1,optionalLabel:j=`(optional)`,helperText:M,help:N,helpLabel:P=`More information`,error:F,disabled:I=!1,readOnly:L=!1,loading:R=!1,name:z,id:B,className:V=``,fieldClassName:H=``,...U}=b,W=n(z),G=F??W;l(`AppOtpInput`,U),s(`AppOtpInput`,`mode`,E,h),s(`AppOtpInput`,`size`,D,t);let K=f(),q=B||K,J=G?`${q}-error`:void 0,Y=M?`${q}-hint`:void 0,X=J||Y,{setRef:Z}=c({ready:v,ref:_,value:x??(S===void 0?``:void 0),onChange:C,on:{complete:e=>w?.(e.detail)}}),Q=/* @__PURE__ */ p(`wui-otp`,{"aria-label":typeof O==`string`?O:void 0,ref:Z,id:q,name:z,length:String(T),mode:E,size:D===`md`?void 0:D,value:(x??S)||void 0,"aria-describedby":X,"aria-invalid":G?`true`:void 0,disabled:I?``:void 0,readonly:L?``:void 0,loading:R?``:void 0,required:k?``:void 0,className:V||void 0,...U});return!O&&!G&&!M?u(Q,y):/* @__PURE__ */ m(`div`,{...y,className:`field${H?` ${H}`:``}`,children:[O&&/* @__PURE__ */ m(`label`,{className:`label`,htmlFor:q,children:[O,A&&!k&&/* @__PURE__ */ p(`span`,{className:`label-optional`,children:` ${j}`}),k&&/* @__PURE__ */ p(o,{}),N&&/* @__PURE__ */ p(a,{label:P,children:N})]}),Q,/* @__PURE__ */ p(e,{error:G,hint:M,errorId:J,hintId:Y})]})});export{_ as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/FieldMessage.js";import{loadFlagStyles as t}from"../lib/flagStyles.js";import n from"../lib/useElementEntry.js";import{splitMarkerProps as
|
|
1
|
+
import e from"../lib/FieldMessage.js";import{loadFlagStyles as t}from"../lib/flagStyles.js";import{useFieldError as n}from"../lib/formFields.js";import r from"../lib/useElementEntry.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./AppInfoTip.js";import o from"./AppRequiredMark.js";import s from"./assertValidValue.js";import c from"./useWuiControl.js";import l from"./warnUnknownProps.js";import{forwardRef as u,useEffect as d,useId as f}from"react";import{jsx as p,jsxs as m}from"react/jsx-runtime";var h=[`sm`,`md`,`lg`],g=()=>import(`@webority/ui-elements/elements/phone`),_=u(function(u,_){let v=r(`wui-phone`,g),{marker:y,props:b}=i(`AppPhoneNumberInput`,u),{value:x,onChange:S,country:C,lockedCountry:w,disabled:T=!1,readOnly:E=!1,loading:D=!1,defaultValue:O,help:k,helpLabel:A=`More information`,name:j,id:M,label:N=`Phone number`,placeholder:P,required:F=!1,optional:I=!1,optionalLabel:L=`(optional)`,helperText:R,error:z,showFlag:B=!0,showDialCode:V=!0,size:H=`md`,fieldClassName:U=``,...W}=b,G=n(j),K=z??G;l(`AppPhoneNumberInput`,W),s(`AppPhoneNumberInput`,`size`,H,h),d(()=>{B&&t()},[B]);let q=f(),J=M||q,Y=K&&J?`${J}-error`:void 0,X=!K&&R&&J?`${J}-hint`:void 0,{setRef:Z}=c({ready:v,ref:_,value:x??(O===void 0?``:void 0),defaultValue:O,onChange:S,events:[`input`,`change`]});return/* @__PURE__ */ m(`div`,{...y,className:`field app-phone-number-input${H===`sm`?` phone-sm`:``}${H===`lg`?` phone-lg`:``}${U?` ${U}`:``}`,children:[N&&/* @__PURE__ */ m(`label`,{className:`label`,htmlFor:J,children:[N,I&&!F&&/* @__PURE__ */ p(`span`,{className:`label-optional`,children:` ${L}`}),F&&/* @__PURE__ */ p(o,{}),k&&/* @__PURE__ */ p(a,{label:A,children:k})]}),/* @__PURE__ */ p(`wui-phone`,{ref:Z,id:J,name:j,"aria-label":typeof N==`string`?N:void 0,"aria-describedby":Y||X,"aria-invalid":K?`true`:void 0,country:w||C,"locked-country":w||void 0,placeholder:P,required:F?``:void 0,disabled:T?``:void 0,readonly:E?``:void 0,loading:D?``:void 0,"hide-flag":B?void 0:``,"hide-dial":V?void 0:``,"external-error":``,...W}),/* @__PURE__ */ p(e,{error:K,hint:R,errorId:Y,hintId:X})]})});export{_ as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/useElementEntry.js";import t from"./assertValidValue.js";import
|
|
1
|
+
import e from"../lib/useElementEntry.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./assertValidValue.js";import r from"./warnUnknownProps.js";import{cloneElement as i,useEffect as a,useId as o,useRef as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";var u=()=>import(`@webority/ui-elements/elements/popover`),d=[`dialog`];function f({trigger:f,children:p,title:m,placement:h=`bottom`,triggerType:g=`click`,onOpenChange:_,className:v=``,open:y,role:b,labelledBy:x,autoFocus:S=!1,openDelay:C=80,closeDelay:w=220,...T}){e(`wui-popover`,u);let{marker:E,props:D}=t(`AppPopover`,T);r(`AppPopover`,D),n(`AppPopover`,`role`,b,d);let O=`${o()}-title`,k=s(null),A=s(_);A.current=_;let j=y!==void 0,M=b===`dialog`,N=Array.isArray(g)?g:[g],P=N.includes(`click`);a(()=>{let e=k.current;if(!e)return;let t=t=>{if(t.target!==e)return;if(!(t instanceof CustomEvent))throw TypeError(`wui-popover-toggle arrived without a detail`);j&&t.preventDefault();let n=t.detail;A.current?.(n.open)};return e.addEventListener(`wui-popover-toggle`,t),()=>e.removeEventListener(`wui-popover-toggle`,t)},[j]);let{onClick:F,"aria-expanded":I,...L}=D,R=f.props[`aria-expanded`],z;I===void 0?R===void 0?P&&(z=y===!0):z=R:z=I;let B=i(f,{...L,...z===void 0?{}:{"aria-expanded":z},"data-wui-popover-trigger":``,onClick:e=>{F?.(e),typeof f.props.onClick==`function`&&f.props.onClick(e)}});return/* @__PURE__ */ l(`wui-popover`,{ref:k,trigger:N.join(` `),placement:h,open:y?``:void 0,"open-delay":C,"close-delay":w,"role-dialog":M?``:void 0,"auto-focus":S?``:void 0,"labelled-by":M?x:void 0,...E,children:[B,/* @__PURE__ */ l(`div`,{"data-wui-popover-panel":!0,popover:``,className:`popover bs-popover-auto${v?` ${v}`:``}`,role:`tooltip`,children:[/* @__PURE__ */ c(`div`,{className:`popover-arrow`}),m&&/* @__PURE__ */ c(`div`,{className:`popover-header`,id:O,children:m}),p==null?null:/* @__PURE__ */ c(`div`,{className:`popover-body`,children:p})]})]})}export{f as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/FieldMessage.js";import{FIELD_BUSY_CLASS as t,FIELD_SIZES as n,blockWhenReadOnly as r}from"../lib/fieldState.js";import{
|
|
1
|
+
import e from"../lib/FieldMessage.js";import{FIELD_BUSY_CLASS as t,FIELD_SIZES as n,blockWhenReadOnly as r}from"../lib/fieldState.js";import{useFieldError as i}from"../lib/formFields.js";import{splitMarkerProps as a}from"../lib/wuiMarker.js";import o from"./AppInfoTip.js";import s from"./AppRequiredMark.js";import c from"./assertValidValue.js";import l from"./warnUnknownProps.js";import{useId as u}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";var p=[`default`,`card`];function m(m){let{marker:h,props:g}=a(`AppRadioGroup`,m),{label:_,options:v=[],name:y,value:b,defaultValue:x,onChange:S,variant:C=`default`,inline:w=!1,required:T=!1,optional:E=!1,optionalLabel:D=`(optional)`,disabled:O=!1,readOnly:k=!1,loading:A=!1,size:j=`md`,error:M,helperText:N,help:P,helpLabel:F=`More information`,id:I,className:L=``,fieldClassName:R=``,style:z,...B}=g,V=i(y),H=M??V;l(`AppRadioGroup`,B),c(`AppRadioGroup`,`variant`,C,p),c(`AppRadioGroup`,`size`,j,n);let U=j===`sm`?` form-check-sm`:j===`lg`?` form-check-lg`:``,W=u(),G=I||W,K=y||G,q=`${G}-error`,J=`${G}-hint`,Y=b!==void 0;return/* @__PURE__ */ f(`div`,{...h,className:`field${R?` ${R}`:``}`,children:[_!=null&&/* @__PURE__ */ f(`span`,{className:`label`,id:`${G}-label`,children:[_,E&&!T&&/* @__PURE__ */ d(`span`,{className:`label-optional`,children:` ${D}`}),T&&/* @__PURE__ */ d(s,{}),P&&/* @__PURE__ */ d(o,{label:F,children:P})]}),/* @__PURE__ */ d(`div`,{className:[`wui-radio-group`,C===`card`?`wui-radio-group-card`:``,w?`wui-radio-group-inline`:``,L].filter(Boolean).join(` `),style:z,id:G,role:`radiogroup`,"aria-labelledby":_==null?void 0:`${G}-label`,"aria-required":T?`true`:void 0,"aria-readonly":k||void 0,"aria-busy":A||void 0,"aria-invalid":H?`true`:void 0,"aria-describedby":H?q:N?J:void 0,...B,children:v.map((e,n)=>{let i=`${G}-${n}`,a=e.description==null?void 0:`${i}-desc`;return/* @__PURE__ */ f(`div`,{className:`form-check${U}`,children:[/* @__PURE__ */ d(`input`,{type:`radio`,className:A?`form-check-input ${t}`:`form-check-input`,id:i,name:K,value:e.value,disabled:O||e.disabled||void 0,required:T||void 0,"aria-describedby":a,"aria-readonly":k||void 0,"aria-busy":A||void 0,onClick:r(k||A),...Y?{checked:b===e.value,onChange:()=>S?.(e.value)}:{defaultChecked:x===e.value,onChange:()=>S?.(e.value)}}),/* @__PURE__ */ d(`label`,{className:`form-check-label`,htmlFor:i,children:e.label}),a&&/* @__PURE__ */ d(`div`,{className:`wui-radio-option-desc`,id:a,children:e.description})]},e.value)})}),/* @__PURE__ */ d(e,{error:H,hint:N,errorId:q,hintId:J})]})}export{m as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/FieldMessage.js";import{blockWhenReadOnly as t}from"../lib/fieldState.js";import n from"../lib/fillLabel.js";import r from"../lib/useElementEntry.js";import{splitMarkerProps as
|
|
1
|
+
import e from"../lib/FieldMessage.js";import{blockWhenReadOnly as t}from"../lib/fieldState.js";import n from"../lib/fillLabel.js";import{useFieldError as r}from"../lib/formFields.js";import i from"../lib/useElementEntry.js";import{splitMarkerProps as a}from"../lib/wuiMarker.js";import o from"./AppIcon.js";import s from"./AppInfoTip.js";import c from"./AppRequiredMark.js";import l from"./assertValidValue.js";import u from"./warnUnknownProps.js";import{useId as d,useState as f}from"react";import{jsx as p,jsxs as m}from"react/jsx-runtime";var h=()=>import(`@webority/ui-elements/elements/rating`),g={sm:16,md:20,lg:28},_=e=>String(Math.round(e*100)/100),v=(e,t,n)=>e>=t?`full`:n&&e>=t-.5?`half`:`empty`;function y(o){i(`wui-rating`,h);let{marker:y,props:x}=a(`AppRating`,o),{value:S,defaultValue:C,onChange:w,max:T=5,readOnly:E=!1,half:D=!1,showValue:O=!1,size:k=`md`,label:A,help:j,helpLabel:ee=`More information`,ratingLabel:te=`Rating`,starLabel:ne=`{count} star`,starsLabel:re=`{count} stars`,valueText:ie=`{value} out of {max}`,name:M,required:N=!1,disabled:P=!1,loading:F=!1,error:I,helperText:L,id:R,className:z=``,fieldClassName:B=``,...V}=x,H=r(M),U=I??H;u(`AppRating`,V),l(`AppRating`,`size`,k,Object.keys(g));let W=d(),[G,K]=f(C),q=g[k]??g.md,J=Array.from({length:T},(e,t)=>t+1),Y=(...e)=>[`wui-rating`,`wui-rating-${k}`,...e,z].filter(Boolean).join(` `);if(E){let e=S===void 0?G:S,t=Number.isFinite(Number(e))?Math.min(Math.max(Number(e),0),T):0,r=D?Math.round(t*2)/2:Math.round(t),i=`${typeof A==`string`&&A?`${A}: `:``}${n(ie,{value:_(t),max:T})}`;return/* @__PURE__ */ m(`span`,{className:Y(`wui-rating-display`,F&&`wui-field-busy`),id:R,role:`img`,"aria-label":i,"aria-busy":F||void 0,...y,...V,children:[/* @__PURE__ */ p(`span`,{className:`wui-rating-stars`,"aria-hidden":`true`,children:J.map(e=>/* @__PURE__ */ p(`span`,{className:`wui-rating-star wui-rating-star-${v(r,e,D)}`,children:/* @__PURE__ */ p(b,{px:q})},e))}),O&&/* @__PURE__ */ p(`span`,{className:`wui-rating-value`,"aria-hidden":`true`,children:_(t)})]})}let X=R||W,ae=M||X,Z=`${X}-error`,Q=`${X}-hint`,$=Math.round(Number(S===void 0?G:S))||0,oe=e=>{F||(K(e),w?.(e))};return/* @__PURE__ */ m(`div`,{...y,className:`field${B?` ${B}`:``}`,children:[A!=null&&/* @__PURE__ */ m(`span`,{className:`label`,id:`${X}-label`,children:[A,N&&/* @__PURE__ */ p(c,{}),j&&/* @__PURE__ */ p(s,{label:ee,children:j})]}),/* @__PURE__ */ p(`wui-rating`,{class:Y(`wui-rating-input`,F&&`wui-field-busy`),id:X,role:`radiogroup`,"aria-busy":F?`true`:void 0,"aria-labelledby":A==null?void 0:`${X}-label`,"aria-label":A==null?te:void 0,"aria-required":N?`true`:void 0,"aria-invalid":U?`true`:void 0,"aria-describedby":U?Z:L?Q:void 0,disabled:P?``:void 0,...V,children:J.map(e=>/* @__PURE__ */ m(`label`,{className:`wui-rating-star wui-rating-star-${$>=e?`full`:`empty`}`,"data-value":e,children:[/* @__PURE__ */ p(`input`,{type:`radio`,className:`visually-hidden`,name:ae,value:e,"aria-label":n(e===1?ne:re,{count:e}),checked:$===e,onChange:()=>oe(e),onClick:t(E||F),disabled:P||void 0,required:N||void 0}),/* @__PURE__ */ p(b,{px:q})]},e))}),/* @__PURE__ */ p(e,{error:U,hint:L,errorId:Z,hintId:Q})]})}function b({px:e}){return/* @__PURE__ */ m(`span`,{className:`wui-rating-glyphs`,"aria-hidden":`true`,children:[/* @__PURE__ */ p(o,{name:`star`,size:e}),/* @__PURE__ */ p(`span`,{className:`wui-rating-fill`,children:/* @__PURE__ */ p(o,{name:`star`,variant:`bold`,size:e})})]})}export{y as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/FieldMessage.js";import{
|
|
1
|
+
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/FieldMessage.js";import{useFieldError as n}from"../lib/formFields.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./AppInfoTip.js";import a from"./AppRequiredMark.js";import o from"./assertValidValue.js";import s from"./useWuiControl.js";import c from"./warnUnknownProps.js";import{isElementDefined as l,whenElementDefined as u}from"@webority/ui-elements/helpers";import{forwardRef as d,useEffect as f,useId as p,useState as m}from"react";import{jsx as h,jsxs as g}from"react/jsx-runtime";var _=[`html`,`markdown`],v=[`input`,`change`],y=`The editor couldn't load. Reload the page and try again.`,b=d(function(d,b){let{marker:x,props:S}=r(`AppRichText`,d),{value:C,onChange:w,format:T,placeholder:E,name:D,label:O,error:k,helperText:A,required:j=!1,disabled:M=!1,readOnly:N=!1,loading:P=!1,defaultValue:F,id:I,ariaLabel:L,className:R=``,fieldClassName:z=``,help:B,helpLabel:V=`More information`,...H}=S,U=n(D),W=k??U;c(`AppRichText`,H),o(`AppRichText`,`format`,T,_);let G=p(),K=I||G,[q,J]=m(!1),[Y,X]=m(()=>l(`wui-rich-text`)),{setRef:Z}=s({ready:Y,ref:b,value:C,defaultValue:F,onChange:w,events:v});return f(()=>{if(Y)return;let t=!0;return import(`@webority/ui-elements/rich-text`).then(()=>u(`wui-rich-text`)).then(()=>{t&&X(!0)},n=>{let r=typeof n==`object`&&n&&`message`in n?n.message:void 0;e(`[AppRichText] the editor failed to load:`,r),t&&J(!0)}),()=>{t=!1}},[Y]),/* @__PURE__ */ g(`div`,{...x,className:`field${z?` ${z}`:``}`,children:[O&&/* @__PURE__ */ g(`label`,{className:`label`,htmlFor:K,children:[O,j&&/* @__PURE__ */ h(a,{}),B&&/* @__PURE__ */ h(i,{label:V,children:B})]}),q?/* @__PURE__ */ h(`div`,{className:`field-error`,role:`status`,children:y}):/* @__PURE__ */ h(`wui-rich-text`,{ref:Z,id:K,role:`group`,name:D,format:T||void 0,placeholder:E,"aria-label":L||(typeof O==`string`?O:void 0),"aria-describedby":W?`${K}-error`:A?`${K}-hint`:void 0,"aria-invalid":W?`true`:void 0,required:j?``:void 0,disabled:M?``:void 0,readonly:N?``:void 0,loading:P?``:void 0,className:R||void 0,...H},T||`html`),/* @__PURE__ */ h(t,{error:W,hint:A,errorId:`${K}-error`,hintId:`${K}-hint`})]})});export{b as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{linkTarget as e}from"../lib/linkTarget.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppActionIcon.js";import r from"./AppButton.js";import i from"./AppDropdown.js";import a from"./assertValidValue.js";import o from"./warnUnknownProps.js";import{jsx as s,jsxs as c}from"react/jsx-runtime";var l=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],u=[`danger`],d=e=>!!e,f=e=>!e.menuOnly&&(!!e.icon||e.showLabel===!0);function p(e){if(e.label.trim()===``)throw RangeError(`<AppRowActions> an action needs a label.`);if(e.to&&e.href)throw RangeError(`<AppRowActions> action "${e.key}" takes to or href, not both.`);if(!e.disabled&&!e.onClick&&!e.href&&!e.to)throw RangeError(`<AppRowActions> action "${e.key}" needs onClick, href or to unless it is disabled.`);if(e.disabledReason&&!e.disabled)throw RangeError(`<AppRowActions> action "${e.key}" has disabledReason without disabled.`);if(e.menuOnly&&e.showLabel)throw RangeError(`<AppRowActions> action "${e.key}" takes menuOnly or showLabel, not both.`);a(`AppRowActions`,`items[].tone`,e.tone,u),a(`AppRowActions`,`items[].iconVariant`,e.iconVariant,l)}function m(t,n){if(!n.to)return{href:n.href};let r=e(t,{to:n.to});return r.Tag===`a`?{href:r.linkProps.href}:{as:r.Tag,to:r.linkProps.to}}function h(e,t){let i=m(t,e);if(e.showLabel||!e.icon)return/* @__PURE__ */ s(r,{size:`sm`,variant:`outline`,tone:e.tone,leftIcon:e.icon,iconVariant:e.iconVariant,tooltip:e.disabled?e.disabledReason:void 0,className:`wui-row-action-inline`,disabled:e.disabled,onClick:e.onClick,...i,children:e.label},e.key);let a=e.disabled&&e.disabledReason?`${e.label}: ${e.disabledReason}`:e.label;return/* @__PURE__ */ s(n,{icon:e.icon,iconVariant:e.iconVariant,label:a,tone:e.tone,className:`wui-row-action-inline`,disabled:e.disabled,onClick:e.onClick,...i},e.key)}function g(e){let{marker:n,props:r}=t(`AppRowActions`,e),{items:a,menuLabel:l=`More actions`,linkComponent:u,className:m=``,...g}=r;o(`AppRowActions`,g);let _=a.filter(d);for(let e of _)p(e);let v=_.length>0&&_.every(f),y=_.map(e=>({key:e.key,label:e.label,icon:e.icon,to:e.to,href:e.href,onClick:e.onClick,tone:e.tone,disabled:e.disabled,disabledReason:e.disabledReason,hiddenFrom:f(e)?`sm`:void 0}));return/* @__PURE__ */ c(`div`,{className:[`u-row-actions`,m].filter(Boolean).join(` `),...n,...g,children:[_.filter(f).map(e=>h(e,u)),_.length>0?/* @__PURE__ */ s(i,{className:[`wui-row-actions-menu`,v?`wui-hidden-from-sm`:``].filter(Boolean).join(` `),icon:`more-horizontal`,label:l,align:`end`,toggleClassName:`u-action`,linkComponent:u,items:y}):null]})}export{g as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/FieldMessage.js";import{
|
|
1
|
+
import e from"../lib/FieldMessage.js";import{useFieldError as t}from"../lib/formFields.js";import{wuiMarkerAttributes as n}from"../lib/wuiMarker.js";import{useId as r}from"react";import{jsx as i,jsxs as a}from"react/jsx-runtime";function o(o){let{value:s=null,onChange:c,min:l=0,max:u=10,label:d,lowLabel:f,highLabel:p,name:m,disabled:h=!1,error:g,helperText:_,id:v,className:y=``,fieldClassName:b=``,scoreLabel:x=`Score`}=o,S=t(m),C=g??S,w=r(),T=v||w,E=m||T,D=`${T}-error`,O=`${T}-hint`,k=Array.from({length:Math.max(0,u-l+1)},(e,t)=>l+t),A=f!=null||p!=null;return/* @__PURE__ */ a(`div`,{...n(`AppScoreScale`,o),className:`field${b?` ${b}`:``}`,children:[d!=null&&/* @__PURE__ */ i(`span`,{className:`label`,id:`${T}-label`,children:d}),/* @__PURE__ */ a(`div`,{className:`wui-score-scale${y?` ${y}`:``}`,id:T,role:`radiogroup`,"aria-labelledby":d==null?void 0:`${T}-label`,"aria-label":d==null?x:void 0,"aria-invalid":C?`true`:void 0,"aria-describedby":C?D:_?O:void 0,children:[k.map(e=>/* @__PURE__ */ a(`label`,{className:`wui-score-scale__item${s===e?` wui-score-scale__item--selected`:``}`,children:[/* @__PURE__ */ i(`input`,{type:`radio`,className:`visually-hidden`,name:E,value:e,checked:s===e,disabled:h,onChange:()=>c?.(e)}),e]},e)),A&&/* @__PURE__ */ a(`span`,{className:`wui-score-scale__ends`,children:[/* @__PURE__ */ i(`span`,{children:f}),/* @__PURE__ */ i(`span`,{children:p})]})]}),/* @__PURE__ */ i(e,{error:C,hint:_,errorId:D,hintId:O})]})}export{o as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e,{SECTION_ALIGNS as t,SECTION_HEADINGS as n,SECTION_TITLE_FONTS as r,SECTION_VARIANTS as i,
|
|
1
|
+
import e,{SECTION_ALIGNS as t,SECTION_HEADINGS as n,SECTION_TITLE_FONTS as r,SECTION_VARIANTS as i,SectionImage as a,itemHeading as o,sectionHeading as s}from"../lib/sectionShell.js";import{splitMarkerProps as c}from"../lib/wuiMarker.js";import l from"./AppIcon.js";import u from"./assertValidValue.js";import d from"./warnUnknownProps.js";import{jsx as f,jsxs as p}from"react/jsx-runtime";var m=[`grid`,`rows`];function h(h){let{marker:g,props:_}=c(`AppSectionFeatures`,h),{title:v,items:y=[],layout:b=`grid`,as:x=`h2`,eyebrow:S,subtitle:C,align:w=`center`,variant:T=`default`,titleFont:E=`display`,inset:D,className:O=``,...k}=_;d(`AppSectionFeatures`,k),u(`AppSectionFeatures`,`layout`,b,m),u(`AppSectionFeatures`,`as`,x,n),u(`AppSectionFeatures`,`align`,w,t),u(`AppSectionFeatures`,`variant`,T,i),u(`AppSectionFeatures`,`titleFont`,E,r);for(let e of y)if(e.imageSrc!==void 0){if(e.icon)throw Error(`AppSectionFeatures item "${e.title}" sets both icon and imageSrc: pick one.`);if(!e.imageAlt?.trim()||(e.imageWidth??0)<=0||(e.imageHeight??0)<=0)throw Error(`AppSectionFeatures item "${e.title}" needs imageAlt, imageWidth and imageHeight with imageSrc: an image without a size moves the page when it loads.`)}let A=s(x,`h2`),j=o(A);return/* @__PURE__ */ f(e,{component:`AppSectionFeatures`,kind:`features`,title:v,as:A,eyebrow:S,subtitle:C,align:w,variant:T,titleFont:E,inset:D,extraClass:b===`rows`?`wui-section-features-rows`:``,className:O,rest:{...g,...k},children:y.length>0&&/* @__PURE__ */ f(`ul`,{className:`wui-section-features-list`,children:y.map(e=>/* @__PURE__ */ p(`li`,{className:`wui-section-feature`,children:[e.media!=null&&/* @__PURE__ */ f(`div`,{className:`wui-section-media`,children:e.media}),/* @__PURE__ */ p(`div`,{className:`wui-section-feature-body`,children:[e.imageSrc!==void 0&&/* @__PURE__ */ f(`span`,{className:`wui-section-feature-icon wui-section-feature-icon-image`,children:/* @__PURE__ */ f(a,{className:`wui-section-feature-img`,src:e.imageSrc,alt:e.imageAlt??``,width:e.imageWidth??0,height:e.imageHeight??0})}),e.icon&&/* @__PURE__ */ f(`span`,{className:`wui-section-feature-icon`,children:/* @__PURE__ */ f(l,{name:e.icon,size:24})}),/* @__PURE__ */ f(j,{className:`wui-section-feature-title`,children:e.title}),e.description!=null&&e.description!==``&&/* @__PURE__ */ f(`div`,{className:`wui-section-feature-text`,children:e.description})]})]},e.key??e.title))})})}export{h as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{linkTarget as e}from"../lib/linkTarget.js";import t,{SECTION_ALIGNS as n,SECTION_HEADINGS as r,SECTION_VARIANTS as i,SectionImage as a,sectionHeading as o}from"../lib/sectionShell.js";import{TargetLink as s}from"../lib/TargetLink.js";import{splitMarkerProps as c}from"../lib/wuiMarker.js";import l from"./assertValidValue.js";import u from"./warnUnknownProps.js";import{jsx as d}from"react/jsx-runtime";var
|
|
1
|
+
import{linkTarget as e}from"../lib/linkTarget.js";import t,{SECTION_ALIGNS as n,SECTION_HEADINGS as r,SECTION_VARIANTS as i,SectionImage as a,sectionHeading as o}from"../lib/sectionShell.js";import{TargetLink as s}from"../lib/TargetLink.js";import{splitMarkerProps as c}from"../lib/wuiMarker.js";import l from"./assertValidValue.js";import u from"./warnUnknownProps.js";import{jsx as d,jsxs as f}from"react/jsx-runtime";var p=e=>typeof e==`string`&&e.trim()!==``?e:void 0;function m(e,t){let n=p(e.alt)??p(e.name)??p(e.label);if(n===void 0||e.width===void 0||e.height===void 0)throw Error(`AppSectionLogos item "${t}" needs alt, width and height.`);return/* @__PURE__ */ d(a,{className:`wui-section-logo-img`,src:t,alt:n,width:e.width,height:e.height})}function h(a){let{marker:h,props:g}=c(`AppSectionLogos`,a),{title:_,items:v=[],as:y=`h2`,eyebrow:b,subtitle:x,align:S=`center`,variant:C=`default`,className:w=``,linkComponent:T,...E}=g;u(`AppSectionLogos`,E),l(`AppSectionLogos`,`as`,y,r),l(`AppSectionLogos`,`align`,S,n),l(`AppSectionLogos`,`variant`,C,i);for(let e of v){let t=p(e.src),n=p(e.name)??p(e.label),r=(e.width??0)>0&&(e.height??0)>0;if(!(t?(p(e.alt)??n)!==void 0&&r:n!==void 0))throw Error(`AppSectionLogos item "${e.src??``}" needs src, alt (the company's name), width and height: a logo without a size moves the page when it loads.`)}return/* @__PURE__ */ d(t,{component:`AppSectionLogos`,kind:`logos`,title:_,as:o(y,`h2`),eyebrow:b,subtitle:x,align:S,variant:C,className:w,rest:{...h,...E},children:v.length>0&&/* @__PURE__ */ d(`ul`,{className:`wui-section-logos-list`,children:v.map(t=>{let n=p(t.src),r=p(t.name)??p(t.label),i=n?m(t,n):/* @__PURE__ */ d(`span`,{className:`wui-section-logo-text`,children:r}),a=p(t.caption),o=a?/* @__PURE__ */ f(`span`,{className:`wui-section-logo-stack`,children:[i,/* @__PURE__ */ d(`span`,{className:`wui-section-logo-caption`,children:a})]}):i,c=e(T,{href:t.href});return/* @__PURE__ */ d(`li`,{className:`wui-section-logo`,children:t.href?/* @__PURE__ */ d(s,{link:c,children:o}):o},t.key??n??r)})})})}export{h 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
|
|
1
|
+
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/FieldMessage.js";import{loadFlagStyles as n}from"../lib/flagStyles.js";import{useFieldError as r}from"../lib/formFields.js";import ee from"../lib/useElementEntry.js";import{splitMarkerProps as te}from"../lib/wuiMarker.js";import ne from"./AppInfoTip.js";import i from"./AppRequiredMark.js";import a from"./assertValidValue.js";import o from"./textOf.js";import re from"./useNodeLabels.js";import ie,{optionsEqual as ae}from"./useWuiControl.js";import oe from"./warnUnknownProps.js";import{forwardRef as s,useEffect as c,useId as se,useLayoutEffect as l,useMemo as ce,useRef as u}from"react";import{Fragment as le,jsx as d,jsxs as f}from"react/jsx-runtime";var ue=[`single`,`multiple`,`search`,`tag`,`country`],de=[`comfortable`,`compact`],p=[`sm`,`md`,`lg`],fe=[`off`,`border`,`above`],pe=[],m=[],me=()=>import(`@webority/ui-elements/elements/select`),he=e=>e===`multiple`||e===`tag`,h=e=>e!=null&&e!==``,g=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:m,r=Array.isArray(e.value)?e.value:m;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=s(function(s,be){let _=ee(`wui-select`,me),{marker:v,props:xe}=te(`AppSelect`,s),{mode:y=`single`,density:b=`comfortable`,size:x,value:Se,defaultValue:S,onChange:Ce,options:C=pe,loadOptions:w,remote:T=!1,onSearch:we,validate:E,placeholder:Te,searchPlaceholder:Ee,emptyText:De,searchable:D,clearable:Oe=!1,openOnHover:ke=!1,icon:Ae,valuePrefix:O,prefix:k,suffix:A,floatingLabel:j=`off`,disabled:je,readOnly:Me=!1,loading:Ne=!1,open:Pe,label:M,required:N=!1,optional:P=!1,optionalLabel:F=`(optional)`,error:Fe,helperText:I,help:L,helpLabel:Ie=`More information`,id:Le,name:R,minChars:z,debounce:B,allowCustom:Re=!1,addLabel:ze,searchingText:Be,hintText:Ve,valueLabel:He,valueAvatar:Ue,valueInitials:We,maxTags:Ge,allowDuplicates:Ke=!1,separators:qe,pattern:Je,invalidMessage:Ye,createLabel:Xe,collapseChips:Ze=!1,selectedText:Qe,clearAllLabel:$e,countries:et,suggested:tt,suggestedLabel:nt,allCountriesLabel:rt,recentsKey:it,recentsLimit:at,recentsLabel:ot,className:st=``,fieldClassName:V=``,controlOnly:ct=!1,"aria-label":lt,"aria-labelledby":ut,"aria-describedby":dt,...ft}=xe,pt=r(R),H=Fe??pt;oe(`AppSelect`,ft),a(`AppSelect`,`mode`,y,ue),a(`AppSelect`,`density`,b,de),a(`AppSelect`,`size`,x,p);let U=he(y);a(`AppSelect`,`floatingLabel`,j,U?[`off`]:fe);let mt=u(!1);U&&(k!=null||A!=null)&&!mt.current&&(mt.current=!0,e(`AppSelect: prefix and suffix are not drawn in mode="${y}"; they are ignored.`));let ht=se(),W=u(!1);c(()=>{y===`country`&&n()},[y]);let{setRef:gt,innerRef:G}=ie({ready:_,ref:be,value:Se??(S===void 0?U?m:``:void 0),defaultValue:S,writeValue:U?_e:ge,on:{change:e=>{let t=e.currentTarget.value,n={isCustom:!!e.detail?.isCustom};switch(s.mode){case`multiple`:Array.isArray(t)&&s.onChange?.(t);break;case`tag`:Array.isArray(t)&&s.onChange?.(t,n);break;case`search`:typeof t==`string`&&s.onChange?.(t,n);break;default:typeof t==`string`&&s.onChange?.(t)}},search:e=>{T&&typeof w!=`function`&&we?.(e.detail.query,{seq:e.detail.seq})}}}),_t=ce(()=>typeof w==`function`?(e,t)=>new Promise(n=>n(w(e,t))).then(e=>(W.current=!0,e),e=>{throw W.current=!0,e}):null,[w]),{portal:vt,toElementOptions:K}=re(C),q=u({el:null,options:null,map:null});l(()=>{let e=G.current;if(!e||!_||q.current.el===e&&q.current.options===C&&q.current.map===K||(q.current={el:e,options:C,map:K},w&&W.current))return;let t=K(C,ve);ae(t,e.options)||(e.options=t)}),l(()=>{let e=G.current;if(!e||!_)return;e.loadOptions!==_t&&(e.loadOptions=_t);let t=typeof E==`function`?E:null;e.validate!==t&&(e.validate=t)}),l(()=>{G.current?.toggleAttribute(`loading`,!!Ne)});let J=Le||ht,Y=!U&&j!==`off`&&M,yt=H&&J?`${J}-error`:void 0,bt=I&&J?`${J}-hint`:void 0,xt=yt||bt||dt;c(()=>{let e=G.current;e&&(O==null||O===``?e.removeAttribute(`prefix`):e.setAttribute(`prefix`,O))},[O,G]);let X=!U&&!Y&&(k!=null||A!=null),St=y===`multiple`||y===`tag`||y===`country`;if(ct&&(h(M)&&g(`label`),h(H)&&g(`error`),h(I)&&g(`helperText`),h(V)&&g(`fieldClassName`),St))throw Error(`<AppSelect> controlOnly draws no field, so it takes no mode="${y}"; that mode always draws its field.`);let Z=ct||!St&&!M&&!H&&!I&&!V,Ct=o(M).trim(),wt=Ct&&(y===`single`||y===`multiple`||y===`search`)?`Search ${Ct}…`:void 0,Tt=/* @__PURE__ */ d(`wui-select`,{"aria-label":lt||o(M)||void 0,"aria-labelledby":ut||void 0,"aria-describedby":xt||void 0,"aria-invalid":H?`true`:void 0,ref:gt,id:J,name:R,mode:y,density:b===`compact`?`compact`:void 0,placeholder:Y?` `:Te||void 0,"search-placeholder":Ee||wt,"empty-text":De||void 0,searchable:D===void 0?void 0:D?`true`:`false`,clearable:Oe?``:void 0,"open-on-hover":ke?``:void 0,size:x!==`md`&&p.includes(x??``)?x:void 0,icon:Ae||void 0,disabled:je?``:void 0,readonly:Me?``:void 0,open:Pe?``:void 0,required:N?``:void 0,"min-chars":z==null?void 0:String(z),debounce:B==null?void 0:String(B),remote:T?``: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":Ge==null?void 0:String(Ge),"allow-duplicates":Ke?``:void 0,separators:qe||void 0,pattern:Je||void 0,"invalid-message":Ye||void 0,"create-label":Xe||void 0,"collapse-chips":Ze?``:void 0,"selected-text":Qe||void 0,"clear-all-label":$e||void 0,countries:ye(et)||void 0,suggested:ye(tt)||void 0,"suggested-label":nt||void 0,"all-countries-label":rt||void 0,"recents-key":it||void 0,"recents-limit":at==null?void 0:String(at),"recents-label":ot||void 0,className:st||void 0,...Z&&!X?v:null,...ft}),Q=/* @__PURE__ */ f(le,{children:[Tt,vt]}),$=X?/* @__PURE__ */ f(`div`,{...Z?v:null,className:`input-affixed`,children:[k!=null&&/* @__PURE__ */ d(`span`,{className:`affix affix-pre`,children:k}),Q,A!=null&&/* @__PURE__ */ d(`span`,{className:`affix affix-suf`,children:A})]}):Q;if(Z)return $;let Et=[`field`,V].filter(Boolean).join(` `);return/* @__PURE__ */ f(`div`,{...v,className:Et,children:[M&&!Y&&/* @__PURE__ */ f(`label`,{className:`label`,htmlFor:J,children:[M,P&&!N&&/* @__PURE__ */ d(`span`,{className:`label-optional`,children:` ${F}`}),N&&/* @__PURE__ */ d(i,{}),L&&/* @__PURE__ */ d(ne,{label:Ie,children:L})]}),Y?/* @__PURE__ */ f(`div`,{className:j===`above`?`field-float wui-float-above`:`field-float`,children:[Q,/* @__PURE__ */ f(`label`,{className:`float-label`,htmlFor:J,children:[M,P&&!N&&/* @__PURE__ */ d(`span`,{className:`label-optional`,children:` ${F}`}),N&&/* @__PURE__ */ d(i,{})]})]}):$,/* @__PURE__ */ d(t,{error:H,hint:I,errorId:yt,hintId:bt})]})});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 u from"../lib/useElementEntry.js";import{TONES as d}from"../lib/vocabulary.js";import{splitMarkerProps as f}from"../lib/wuiMarker.js";import p from"./AppAvatar.js";import m from"./AppButton.js";import h from"./AppIcon.js";import g from"./AppNavigationMenu.js";import _ from"./assertValidValue.js";import v from"./warnUnknownProps.js";import{initScrollEdges as y,isImeSafeEnter as b,revealActiveNavItem as x,setPopoverOpen as S}from"@webority/ui-elements/helpers";import{useEffect as C,useId as w,useMemo as T,useRef as E,useState as D}from"react";import{Fragment as O,jsx as k,jsxs as A}from"react/jsx-runtime";var j=()=>import(`@webority/ui-elements/elements/overflow`),M=()=>import(`@webority/ui-elements/elements/dropdown`),N=99,P=4,F=5,I=/^[a-z0-9-]+$/,L=`wui-sidebar-footer`,R=[],z=[`prefix`,`exact`],B=[`comfortable`,`compact`],V=[`neutral`,`primary`],ee=[`default`,`brand`],te=[`side`,`top`],ne=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],re=/* @__PURE__ */ new Set([`key`,`label`,`icon`,`iconVariant`,`iconSize`,`href`,`badge`,`badgeTone`,`badgeTitle`,`newUntil`,`trailingIcon`,`active`,`match`,`matchAlso`,`tab`,`tabLabel`,`children`]),H=e=>e>N?`${N}+`:String(e),U=new Intl.DateTimeFormat(`en-CA`,{timeZone:`Asia/Kolkata`}),ie=e=>{if(typeof e!=`string`||!/^\d{4}-\d{2}-\d{2}$/.test(e))return!1;let t=/* @__PURE__ */ new Date(`${e}T00:00:00Z`);return Number.isNaN(t.getTime())||t.toISOString().slice(0,10)!==e?!1:U.format(/* @__PURE__ */ new Date)<=e},ae=({logoLight:e,logoDark:t,markLight:n,markDark:r})=>{let i=!!(n||r);return[`app-sidebar-brand`,i&&`wui-brand-has-mark`,i&&!e&&!t&&`wui-brand-mark-only`,(t||r)&&`wui-brand-themed`].filter(Boolean).join(` `)},oe=({logoLight:e,logoDark:t,markLight:n,markDark:r,brandName:i})=>{let a=i??``,o=[e&&/* @__PURE__ */ k(`img`,{className:`wui-brand-logo wui-brand-light`,src:e,alt:a},`logo-light`),t&&/* @__PURE__ */ k(`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__ */ k(`img`,{className:n,src:r,alt:a},t):/* @__PURE__ */ k(`img`,{className:n,src:r,alt:``,"aria-hidden":`true`},t));return[...o,...s].filter(Boolean)};function W(e){let{marker:t,props:n}=f(`AppShell`,e),{groups:r=[],brand:l,logoLight:u,logoDark:d,markLight:p,markDark:m,brandName:b,brandHref:w,brandLabel:j,sidebarStart:M,sidebarStartCompact:N,sidebarFooter:P,sidebarFooterItems:F=R,topbarStart:I,topbarEnd:L,footer:z,launcher:re,children:H,collapsed:U,onCollapsedChange:ie,noSidebar:W=!1,nav:G=`side`,density:K=`comfortable`,itemHeight:ce,iconVariant:q=`twotone`,topbarTone:le=`neutral`,tone:J=`default`,navLabel:ve=`Main navigation`,linkComponent:Y,currentPath:be,rememberCollapsed:xe=!1,collapsedCookie:Se=`wui-shell-collapsed`,foldedCookie:Ce=i,tabBarLabel:we=`Quick navigation`,moreLabel:Te=`More`,skipLabel:Ee=`Skip to content`,openNavLabel:De=`Open navigation`,expandNavLabel:Oe=`Expand navigation`,collapseNavLabel:ke=`Collapse navigation`,newLabel:Ae=`New`,togglePagesLabel:je=`Show or hide {name} pages`,accountMenuLabel:Me=`Account menu for {name}`,roleLabel:Ne=`Role:`,rolesLabel:Pe=`Roles:`,unreadLabel:Fe=`Unread`,markAllReadLabel:Ie=`Mark all read`,viewAllLabel:Le=`View all`,loadingNotificationsText:Re=`Loading…`,noUnreadText:ze=`No unread notifications`,unreadNotificationsText:Be=`{count} unread notifications`,unreadBellLabel:Ve=`{label}, {count} unread`,searchResultsLabel:He=`Search results`,noResultsText:Ue=`No results`,noResultsForText:We=`No results for “{value}”`,resultsCountText:Ge=`{count} results`,resultCountText:Ke=`{count} result`,userMenu:qe,notifications:Je,search:Ye,className:Xe=``,style:Ze,...Qe}=n;if(v(`AppShell`,Qe),_(`AppShell`,`density`,K,B),_(`AppShell`,`topbarTone`,le,V),_(`AppShell`,`tone`,J,ee),_(`AppShell`,`nav`,G,te),_(`AppShell`,`iconVariant`,q,ne),j!==void 0&&!w)throw Error(`<AppShell> brandLabel names the brand link, so it needs brandHref.`);if(w){if(!j&&!b)throw Error(`<AppShell> brandHref needs brandLabel or brandName: the collapsed rail hides the logo, so the link would have no accessible name.`);if(!(l||u||d||p||m))throw Error(`<AppShell> brandHref has no brand, logo or mark to link.`)}let $e=(ce??0)>0?{...Ze,"--wui-nav-item-height":`${ce}px`}:Ze,[et,tt]=D(()=>xe&&U===void 0&&typeof document<`u`?o(Se)??!1:!1),[X,Z]=D(!1),nt=E(null),[rt,it]=D(!1),[at,ot]=D(!1),st=E(null),Q=U??et,ct=e=>w?/* @__PURE__ */ k(fe,{href:w,label:j||b,linkComponent:Y,onNavigate:()=>Z(!1),children:e}):e,lt=()=>{let e=!Q;U===void 0&&tt(e),xe&&c(e,Se),ie?.(e)},ut=r.some(e=>e.collapsible),[dt,ft]=D(()=>ut&&typeof document<`u`?a(Ce):/* @__PURE__ */ new Set),pt=e=>{let t=new Set(dt);t.has(e)?t.delete(e):t.add(e),ft(t),s(t,Ce)},mt=T(()=>se(r,F,be),[r,F,be]),$=mt.groups,ht=mt.footer,gt=W?null:ue($,ht.some(e=>e.active));C(()=>{let e=()=>it(window.scrollY>4);return e(),window.addEventListener(`scroll`,e,{passive:!0}),()=>window.removeEventListener(`scroll`,e)},[]),C(()=>{y()},[]),C(()=>{x(st.current)},[]),C(()=>{let e=st.current;if(!e)return;let t=()=>ot($.length>0&&e.scrollHeight>e.clientHeight);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[$]),C(()=>{let e=nt.current;if(!e)return;let t=window.matchMedia(`(max-width: 991.98px)`),n=()=>{t.matches?e.setAttribute(`popover`,`auto`):(e.removeAttribute(`popover`),Z(!1))},r=e=>Z(`newState`in e&&e.newState===`open`);return n(),t.addEventListener(`change`,n),e.addEventListener(`toggle`,r),()=>{t.removeEventListener(`change`,n),e.removeEventListener(`toggle`,r)}},[]),C(()=>{let e=nt.current;e?.hasAttribute(`popover`)&&S(e,X)},[X]);let _t=[`app-shell`,Q?`collapsed`:``,W?`no-sidebar`:``,G===`top`?`wui-shell-top`:``,X?`mobile-open`:``,Xe].filter(Boolean).join(` `);return/* @__PURE__ */ A(`div`,{className:_t,"data-density":K===`compact`?`compact`:void 0,"data-shell-tone":J===`brand`?`brand`:void 0,"data-wui-folded-cookie":ut?Ce:void 0,style:$e,...t,...Qe,children:[/* @__PURE__ */ k(`a`,{className:`wui-skip-link`,href:`#main-content`,children:Ee}),/* @__PURE__ */ A(`aside`,{className:`app-sidebar`,ref:nt,children:[(l||u||d||p||m)&&/* @__PURE__ */ k(`div`,{className:ae({logoLight:u,logoDark:d,markLight:p,markDark:m}),children:ct(/* @__PURE__ */ A(O,{children:[oe({logoLight:u,logoDark:d,markLight:p,markDark:m,brandName:b}),l]}))}),M&&/* @__PURE__ */ k(`div`,{className:`app-sidebar-start`,children:M}),N&&/* @__PURE__ */ k(`div`,{className:`app-sidebar-start-compact`,children:N}),/* @__PURE__ */ k(`nav`,{className:`app-sidebar-scroll`,"aria-label":ve,ref:st,tabIndex:at?0:void 0,children:$.map((e,t)=>{let n=e.items.map(e=>e.header==null?/* @__PURE__ */ k(he,{item:e,linkComponent:Y,onNavigate:()=>Z(!1),iconVariant:q,newLabel:Ae,togglePagesLabel:je},e.key??e.href??e.label):/* @__PURE__ */ k(`div`,{className:`wui-nav-header`,children:e.header},e.key??e.header));if(!e.collapsible)return/* @__PURE__ */ A(`div`,{className:`app-nav-group`,children:[e.label&&/* @__PURE__ */ k(`div`,{className:`app-nav-group-label`,children:e.label}),n,e.after&&/* @__PURE__ */ k(`div`,{className:`wui-nav-group-after`,children:e.after})]},e.key??e.label??`group-${t}`);let r=!dt.has(e.key??``)||!!me(e.items),i=`wui-nav-group-${e.key}`;return/* @__PURE__ */ A(`div`,{className:`app-nav-group wui-nav-group-collapsible${r?``:` wui-nav-group-folded`}`,"data-wui-nav-group":e.key,children:[/* @__PURE__ */ A(`button`,{type:`button`,className:`app-nav-group-label wui-nav-group-toggle`,"aria-expanded":r,"aria-controls":i,onClick:()=>pt(e.key??``),children:[/* @__PURE__ */ k(`span`,{className:`wui-nav-group-text`,children:e.label}),/* @__PURE__ */ k(`span`,{className:`wui-nav-group-caret`,children:/* @__PURE__ */ k(h,{name:`chevron-down`,size:16})})]}),/* @__PURE__ */ A(`div`,{className:`wui-nav-group-body`,id:i,children:[n,e.after&&/* @__PURE__ */ k(`div`,{className:`wui-nav-group-after`,children:e.after})]})]},e.key??`group-${t}`)})}),(P||ht.length>0)&&/* @__PURE__ */ A(`div`,{className:`app-sidebar-foot`,children:[ht.length>0&&/* @__PURE__ */ k(`div`,{className:`wui-sidebar-foot-links`,children:ht.map(e=>/* @__PURE__ */ k(he,{item:e,linkComponent:Y,onNavigate:()=>Z(!1),iconVariant:q,newLabel:Ae,togglePagesLabel:je},e.key??e.href??e.label))}),P]}),!W&&/* @__PURE__ */ k(`button`,{type:`button`,className:`app-sidebar-toggle`,onClick:lt,"aria-label":Q?Oe:ke,"aria-expanded":!Q,children:/* @__PURE__ */ k(h,{name:`chevrons-left`,size:20})})]}),/* @__PURE__ */ A(`div`,{className:`app-main`,children:[/* @__PURE__ */ A(`header`,{className:`app-topbar${rt?` wui-scrolled`:``}`,"data-tone":le===`primary`?`primary`:void 0,children:[/* @__PURE__ */ A(`div`,{className:`app-topbar-start`,children:[/* @__PURE__ */ k(`button`,{type:`button`,className:`app-topbar-menu`,onClick:()=>Z(!0),"aria-label":De,"aria-expanded":X,children:/* @__PURE__ */ k(h,{name:`menu`,size:18})}),G===`top`&&l&&/* @__PURE__ */ k(`div`,{className:`wui-shell-top-brand`,children:ct(l)}),G===`top`&&/* @__PURE__ */ k(`div`,{className:`wui-shell-top-nav`,children:/* @__PURE__ */ k(g,{items:de($),ariaLabel:ve,linkComponent:Y})}),I,Ye&&/* @__PURE__ */ k(ye,{config:Ye,searchResultsLabel:He,noResultsText:Ue,noResultsForText:We,resultsCountText:Ge,resultCountText:Ke,moreLabel:Te})]}),/* @__PURE__ */ A(`div`,{className:`app-topbar-end`,children:[L,Je&&/* @__PURE__ */ k(_e,{config:Je,unreadLabel:Fe,markAllReadLabel:Ie,viewAllLabel:Le,loadingNotificationsText:Re,noUnreadText:ze,unreadNotificationsText:Be,unreadBellLabel:Ve}),qe&&/* @__PURE__ */ k(ge,{config:qe,linkComponent:Y,accountMenuLabel:Me,roleLabel:Ne,rolesLabel:Pe})]})]}),/* @__PURE__ */ k(`main`,{className:`app-content`,id:`main-content`,children:H}),z&&/* @__PURE__ */ k(`footer`,{className:`app-footer`,children:z})]}),re&&/* @__PURE__ */ k(`div`,{className:`wui-shell-launcher`,children:re}),gt&&/* @__PURE__ */ A(`nav`,{className:`wui-tabbar`,"aria-label":we,children:[gt.tabs.map(e=>/* @__PURE__ */ k(pe,{tab:e,linkComponent:Y,iconVariant:q},e.key??e.href)),gt.hasMore&&/* @__PURE__ */ A(`button`,{type:`button`,className:`wui-tabbar-item${gt.moreActive?` active`:``}`,onClick:()=>Z(!0),children:[/* @__PURE__ */ k(`span`,{className:`wui-tabbar-icon`,children:/* @__PURE__ */ k(h,{name:`more`,size:24})}),/* @__PURE__ */ k(`span`,{className:`wui-tabbar-label`,children:Te})]})]})]})}function se(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&&le(t);let a=(e,t=!1)=>(e??[]).map(e=>Array.isArray(e.children)?{...e,children:a(e.children)}:{...e}).filter(e=>K(e)?t:(e.children?.length??0)>0||!!e.href),o=[...e,{key:L,items:t}].map(e=>({...e,items:ce(a(e.items,!0))})).filter(e=>e.items.some(e=>!K(e))),s=[],c=e=>{for(let t of e)K(t)||(s.push(t),t.children&&c(t.children))};for(let e of o)c(e.items);for(let e of s)v(`AppShell items`,G(e)),_(`AppShell`,`match`,e.match,z),_(`AppShell`,`iconVariant`,e.iconVariant,ne),_(`AppShell`,`badgeTone`,e.badgeTone,d);let l=null;if(n!=null&&!s.some(e=>e.active===!0)){let e=-1;for(let t of s){if(t.active!=null||t.children?.length&&!t.href)continue;let i=r(n,t.href,{exact:t.match===`exact`,also:t.matchAlso});if(i<0)continue;let a=t.match===`exact`&&r(n,t.href,{exact:!0})>=0?1/0:i;a>e&&(e=a,l=t)}}for(let e of s)e.active=e.active??e===l;return{groups:o.filter(e=>e.key!==L),footer:o.find(e=>e.key===L)?.items??[]}}function G(e){return Object.fromEntries(Object.entries(e).filter(([e])=>!re.has(e)))}var K=e=>e.header!=null;function ce(e){return e.filter((t,n)=>{if(!K(t))return!0;let r=e.findIndex((e,t)=>t>n&&K(e));return e.slice(n+1,r<0?void 0:r).length>0})}var q=/* @__PURE__ */ new Set;function le(t){if(t.key!=null&&I.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`||q.has(n)||(q.add(n),e(n))}function ue(e,t){let n=[],r=e=>{for(let t of e)K(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?P:F;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 de(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=>K(e)?[]:[...e.href?[{...r(e,e.href),icon:e.icon}]:[],...i(e.children??[])]),a=[];for(let o of e.flatMap(e=>e.items)){if(K(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 fe({href:e,label:t,linkComponent:r,onNavigate:i,children:a}){return/* @__PURE__ */ k(l,{link:n(r,{to:e}),className:`wui-brand-link`,"aria-label":t,onClick:i,children:a})}function pe({tab:e,linkComponent:t,iconVariant:r}){let i=`wui-tabbar-item${e.active?` active`:``}`,a=/* @__PURE__ */ A(O,{children:[e.icon&&/* @__PURE__ */ k(`span`,{className:`wui-tabbar-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ k(h,{name:e.icon,size:24,variant:e.iconVariant??r}):e.icon}),/* @__PURE__ */ k(`span`,{className:`wui-tabbar-label`,children:e.tabLabel??e.label}),e.badge!=null&&/* @__PURE__ */ k(`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__ */ k(l,{link:n(t,{to:e.href}),className:i,"aria-current":o,children:a})}function me(e){for(let t of e){if(t.active)return t;let e=t.children?.length?me(t.children):void 0;if(e)return e}}function he({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?me(e.children??[]):void 0,m=!!p,g=p?p.key??p.href??p.label:null,[_,v]=D(m);C(()=>{g!=null&&v(!0)},[g]);let y=typeof e.label==`string`?e.label:void 0,b=!u&&e.icon&&/* @__PURE__ */ k(`span`,{className:`app-nav-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ k(h,{name:e.icon,size:e.iconSize??22,variant:e.iconVariant??o}):e.icon}),x=e.badge!=null&&/* @__PURE__ */ k(`span`,{className:`app-nav-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:e.badge}),S=ie(e.newUntil)&&/* @__PURE__ */ k(`span`,{className:`wui-nav-new`,children:s}),w=/* @__PURE__ */ A(O,{children:[b,/* @__PURE__ */ k(`span`,{className:`app-nav-text`,children:e.label}),S,x,e.trailingIcon&&/* @__PURE__ */ k(`span`,{className:`app-nav-trailing`,children:typeof e.trailingIcon==`string`?/* @__PURE__ */ k(h,{name:e.trailingIcon,size:16}):e.trailingIcon})]}),T=e.active?`page`:void 0;if(f){let f=/* @__PURE__ */ k(`div`,{className:`app-nav-sub${_?` expanded`:``}`,inert:!_,"aria-hidden":!_||void 0,children:/* @__PURE__ */ k(`div`,{className:`app-nav-sub-inner`,children:(e.children??[]).map(e=>/* @__PURE__ */ k(he,{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__ */ k(l,{link:n(r,{to:e.href}),className:`wui-nav-split-link`,"aria-current":T,onClick:i,children:w});return/* @__PURE__ */ A(O,{children:[/* @__PURE__ */ A(`div`,{className:`app-nav-item has-children wui-nav-split${u?` app-nav-subitem`:``}${m||e.active?` active`:``}${d}`,"data-label":y,children:[a,/* @__PURE__ */ k(`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__ */ k(h,{name:`chevron-right`,size:16})})]}),f]})}return/* @__PURE__ */ A(O,{children:[/* @__PURE__ */ A(`button`,{type:`button`,className:`app-nav-item${u?` app-nav-subitem`:``} has-children${m?` active`:``}${d}`,"aria-expanded":_,"data-label":y,onClick:()=>v(e=>!e),children:[b,/* @__PURE__ */ k(`span`,{className:`app-nav-text`,children:e.label}),S,x,/* @__PURE__ */ k(`span`,{className:`app-nav-caret`,children:/* @__PURE__ */ k(h,{name:`chevron-right`,size:16})})]}),f]})}let E=`app-nav-item${u?` app-nav-subitem`:``}${e.active?` active`:``}${d}`;return/* @__PURE__ */ k(l,{link:n(r,{to:e.href}),className:E,"aria-current":T,"data-label":y,onClick:i,children:w})}function J(e){u(`wui-dropdown`,M);let[t,n]=D(!1),r=E(null);return C(()=>{r.current?.toggleAttribute(`open`,t)},[t]),C(()=>{let t=r.current;if(!t)return;let i=r=>{if(r.target!==t||!(`detail`in r)||!r.detail||typeof r.detail!=`object`)return;let i=`open`in r.detail&&r.detail.open===!0;n(i),i&&e?.()};return t.addEventListener(`wui-dropdown-toggle`,i),()=>t.removeEventListener(`wui-dropdown-toggle`,i)},[e]),{open:t,setOpen:n,ref:r}}function ge({config:e,linkComponent:r,accountMenuLabel:i,roleLabel:a,rolesLabel:o}){let s=w(),{open:c,setOpen:u,ref:d}=J(),{name:f,role:g,roles:v=[],noTriggerRole:y=!1,photo:b,profileHref:x,profileLabel:S=`My profile`,onLogout:C,logoutAction:T,logoutLabel:E=`Sign out`,head:D,section:j,logoutVariant:M=`item`,items:N=[]}=e;if(_(`AppShell`,`userMenu.logoutVariant`,M,[`item`,`button`]),!f)throw Error(`<AppShell> userMenu.name is required; the trigger and the avatar are named from it.`);let P=v.map(e=>(e??``).trim()).filter(Boolean),F=()=>u(!1),I=(e,t,i,a)=>/* @__PURE__ */ k(l,{link:n(r,{to:e}),className:`dropdown-item`,onClick:a,children:t},i),L=/* @__PURE__ */ k(h,{name:`log-out`,size:18}),R=/* @__PURE__ */ A(O,{children:[L,E]});return/* @__PURE__ */ A(`wui-dropdown`,{class:`dropdown wui-usermenu`,align:`end`,ref:d,children:[/* @__PURE__ */ A(`button`,{type:`button`,id:s,className:`wui-usermenu-trigger`,"data-wui-dropdown-trigger":!0,"aria-expanded":c,"aria-label":t(i,{name:f}),children:[/* @__PURE__ */ k(p,{name:f,src:b,tone:`auto`}),/* @__PURE__ */ A(`span`,{className:`wui-usermenu-text`,children:[/* @__PURE__ */ k(`span`,{className:`wui-usermenu-name`,children:f}),g&&!y&&/* @__PURE__ */ k(`span`,{className:`wui-usermenu-role`,children:g})]}),/* @__PURE__ */ k(h,{name:`chevron-down`,size:14,className:`wui-usermenu-caret`})]}),/* @__PURE__ */ A(`div`,{"data-wui-dropdown-menu":!0,popover:`auto`,className:`dropdown-menu dropdown-menu-end wui-usermenu-menu${c?` show`:``}`,"aria-labelledby":s,children:[/* @__PURE__ */ A(`div`,{className:`wui-usermenu-head`,children:[/* @__PURE__ */ k(p,{name:f,src:b,size:`lg`,tone:`auto`}),/* @__PURE__ */ A(`div`,{className:`wui-usermenu-who`,children:[/* @__PURE__ */ k(`div`,{className:`wui-usermenu-name`,children:f}),g&&/* @__PURE__ */ k(`div`,{className:`wui-usermenu-role`,children:g}),P.length>0&&/* @__PURE__ */ A(`div`,{className:`wui-usermenu-roles`,children:[/* @__PURE__ */ k(`span`,{className:`wui-usermenu-roles-label`,children:P.length===1?a:o}),` ${P.join(`, `)}`]}),D?/* @__PURE__ */ k(`div`,{className:`wui-usermenu-extra`,children:D}):null]})]}),j?/* @__PURE__ */ k(`div`,{className:`wui-usermenu-section`,children:j}):null,x&&I(x,/* @__PURE__ */ A(O,{children:[/* @__PURE__ */ k(h,{name:`user`,size:18}),S]}),void 0,F),N.map(e=>{if(e.divider)return/* @__PURE__ */ k(`hr`,{className:`dropdown-divider`},e.key);let t=/* @__PURE__ */ A(O,{children:[e.icon&&/* @__PURE__ */ k(h,{name:e.icon,size:18}),e.label]}),n=()=>{e.onClick?.(),F()};return e.href?I(e.href,t,e.key,n):/* @__PURE__ */ k(`button`,{type:`button`,className:`dropdown-item`,onClick:n,children:t},e.key)}),M===`button`?(T||C)&&/* @__PURE__ */ k(`div`,{className:`wui-usermenu-foot`,children:T?/* @__PURE__ */ k(`form`,{method:`post`,action:T,className:`wui-usermenu-logout`,children:/* @__PURE__ */ k(m,{type:`submit`,tone:`danger`,variant:`soft`,block:!0,leftIcon:L,children:E})}):/* @__PURE__ */ k(m,{type:`button`,tone:`danger`,variant:`soft`,block:!0,leftIcon:L,onClick:()=>{F(),C?.()},children:E})}):T?/* @__PURE__ */ k(`form`,{method:`post`,action:T,className:`wui-usermenu-logout`,children:/* @__PURE__ */ k(`button`,{type:`submit`,className:`dropdown-item danger`,children:R})}):C&&/* @__PURE__ */ k(`button`,{type:`button`,className:`dropdown-item danger`,onClick:()=>{F(),C()},children:R})]})]})}function _e({config:e,unreadLabel:n,markAllReadLabel:r,viewAllLabel:i,loadingNotificationsText:a,noUnreadText:o,unreadNotificationsText:s,unreadBellLabel:c}){let l=w(),{open:u,ref:d}=J(e.onOpen),{unread:f=0,items:p,loading:m=!1,onMarkAllRead:g,viewAllHref:_,label:v=`Notifications`,emptyText:y=`You are all caught up.`}=e,[b,x]=D(``),S=E(f);C(()=>{S.current!==f&&(S.current=f,x(f===0?o:t(s,{count:H(f)})))},[f,o,s]);let T=null;return p?.length?T=/* @__PURE__ */ k(`div`,{className:`wui-bell-items`,children:p.map((e,t)=>{let r=`wui-bell-item${e.read?` wui-bell-item-read`:``}`,i=/* @__PURE__ */ A(O,{children:[/* @__PURE__ */ k(`span`,{className:`wui-bell-dot`,"aria-hidden":`true`}),e.icon&&/* @__PURE__ */ k(`span`,{className:`wui-bell-icon`,children:/* @__PURE__ */ k(h,{name:e.icon,size:18})}),/* @__PURE__ */ A(`span`,{className:`wui-bell-body`,children:[!e.read&&/* @__PURE__ */ A(`span`,{className:`visually-hidden`,children:[n,`: `]}),/* @__PURE__ */ k(`span`,{className:`wui-bell-item-title`,children:e.title}),e.time&&/* @__PURE__ */ k(`span`,{className:`wui-bell-when`,children:e.time})]})]});return e.href?/* @__PURE__ */ k(`a`,{className:r,href:e.href,"data-id":e.id,children:i},e.id??t):/* @__PURE__ */ k(`div`,{className:r,"data-id":e.id,children:i},e.id??t)})}):m?T=/* @__PURE__ */ k(`div`,{className:`wui-bell-state`,children:a}):p&&(T=/* @__PURE__ */ k(`div`,{className:`wui-bell-state`,children:y})),/* @__PURE__ */ A(`wui-dropdown`,{class:`dropdown wui-bell`,align:`end`,ref:d,children:[/* @__PURE__ */ A(`button`,{type:`button`,id:l,className:`topbar-icon-btn wui-bell-trigger`,"data-wui-dropdown-trigger":!0,"aria-expanded":u,"aria-label":f===0?v:t(c,{label:v,count:H(f)}),children:[/* @__PURE__ */ k(h,{name:`notification`,size:20}),/* @__PURE__ */ k(`span`,{className:`wui-bell-count`,"aria-hidden":`true`,hidden:f===0,children:H(f)})]}),/* @__PURE__ */ k(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:b}),/* @__PURE__ */ A(`div`,{"data-wui-dropdown-menu":!0,popover:`auto`,className:`dropdown-menu dropdown-menu-end wui-bell-menu${u?` show`:``}`,"aria-labelledby":l,children:[/* @__PURE__ */ A(`div`,{className:`wui-bell-head`,children:[/* @__PURE__ */ k(`span`,{className:`wui-bell-title`,children:v}),g&&/* @__PURE__ */ k(`button`,{type:`button`,className:`wui-bell-markall`,onClick:g,children:r})]}),/* @__PURE__ */ k(`div`,{className:`wui-bell-list`,"aria-busy":m||void 0,children:T}),_&&/* @__PURE__ */ k(`a`,{className:`wui-bell-foot`,href:_,children:i})]})]})}var ve=e=>!!e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName));function ye({config:e,searchResultsLabel:n,noResultsText:r,noResultsForText:i,resultsCountText:a,resultCountText:o,moreLabel:s}){u(`wui-overflow`,j);let c=w(),{value:l=``,onChange:d,results:f=null,loading:p=!1,onSelect:m,onSubmit:g,onFocus:_,placeholder:v=`Search`}=e,[y,x]=D(!1),[S,O]=D(!1),[M,N]=D({results:null,index:-1}),P=M.results===f?M.index:-1,F=e=>N({results:f,index:e}),I=E(null),L=E(null),R=E([]),z=T(()=>(f??[]).flatMap(e=>e.hits??[]),[f]),B=f!=null&&!S,V=z.length;C(()=>{let e=e=>{e.key!==`/`||e.ctrlKey||e.metaKey||e.altKey||ve(e.target instanceof HTMLElement?e.target:null)||(e.preventDefault(),x(!0),L.current?.focus())},t=e=>{I.current?.contains(e.target instanceof Node?e.target:null)||(O(!0),x(!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(!B||V===0)return;e.preventDefault(),F((P+(e.key===`ArrowDown`?1:-1)+V)%V)}else b(e.nativeEvent)?B&&P>=0&&R.current[P]?(e.preventDefault(),R.current[P].click()):g&&l.trim()!==``&&(e.preventDefault(),g(l.trim())):e.key===`Escape`&&(B?(e.preventDefault(),O(!0)):y&&(e.preventDefault(),x(!1)))},te=-1;return R.current=[],/* @__PURE__ */ k(`wui-overflow`,{class:`wui-topsearch-host`,label:s,children:/* @__PURE__ */ k(`div`,{"data-wui-overflow-list":!0,className:`wui-topsearch-row`,children:/* @__PURE__ */ A(`div`,{className:`wui-topsearch${y?` is-open`:``}${p?` is-loading`:``}`,ref:I,"data-overflow-label":v,children:[/* @__PURE__ */ k(`button`,{type:`button`,className:`topbar-icon-btn wui-topsearch-open`,"aria-label":v,"aria-expanded":y,"aria-controls":`${c}-panel`,onClick:()=>{let e=!y;x(e),e&&L.current?.focus()},children:/* @__PURE__ */ k(h,{name:`search`,size:20})}),/* @__PURE__ */ A(`div`,{className:`wui-topsearch-panel`,id:`${c}-panel`,children:[/* @__PURE__ */ A(`div`,{className:`search-wrap`,children:[/* @__PURE__ */ k(h,{name:`search`,size:18,className:`search-icon`}),/* @__PURE__ */ k(`input`,{ref:L,type:`search`,className:`form-control input search-input`,id:`${c}-input`,placeholder:v,"aria-label":v,role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":B,"aria-controls":`${c}-list`,"aria-activedescendant":B&&P>=0?`${c}-opt-${P}`:void 0,autoComplete:`off`,value:l,onChange:e=>{O(!1),d?.(e.target.value)},onKeyDown:ee,onFocus:_})]}),/* @__PURE__ */ k(`div`,{className:`wui-topsearch-results`,id:`${c}-list`,role:`listbox`,"aria-label":n,hidden:!B,children:B&&/* @__PURE__ */ A(`div`,{className:`wui-topsearch-groups`,role:`presentation`,children:[V===0&&/* @__PURE__ */ k(`div`,{className:`wui-topsearch-empty`,role:`option`,"aria-disabled":`true`,"aria-selected":`false`,children:t(i,{value:l})}),f.filter(e=>e.hits?.length).map((e,t)=>/* @__PURE__ */ A(`div`,{className:`wui-topsearch-group`,role:`group`,"aria-label":e.label??``,children:[e.label&&/* @__PURE__ */ k(`div`,{className:`wui-topsearch-group-label`,role:`presentation`,children:e.label}),e.hits.map(e=>{te+=1;let t=te;return/* @__PURE__ */ A(`a`,{className:`wui-topsearch-hit${t===P?` is-active`:``}`,role:`option`,"aria-selected":t===P,id:`${c}-opt-${t}`,href:e.href,ref:e=>{R.current[t]=e},onClick:t=>m?.(e,t),children:[e.icon&&/* @__PURE__ */ k(`span`,{className:`wui-topsearch-hit-icon`,children:/* @__PURE__ */ k(h,{name:e.icon,size:18})}),/* @__PURE__ */ A(`span`,{className:`wui-topsearch-hit-text`,children:[/* @__PURE__ */ k(`span`,{className:`wui-topsearch-hit-title`,children:e.title}),e.subtitle&&/* @__PURE__ */ k(`span`,{className:`wui-topsearch-hit-sub`,children:e.subtitle})]})]},`${e.href}-${t}`)})]},e.label??t))]})})]}),/* @__PURE__ */ k(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:B?V===0?r:t(V===1?o:a,{count:V}):``})]})})})}export{W as default};
|
|
1
|
+
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/fillLabel.js";import{linkTarget as n}from"../lib/linkTarget.js";import{navMatchScore as r}from"../lib/navMatch.js";import{SHELL_FOLDED_COOKIE as i,readNavFolded as a,readShellCollapsed as o,writeNavFolded as s,writeShellCollapsed as c}from"../lib/shellCookie.js";import{TargetLink as l}from"../lib/TargetLink.js";import u from"../lib/useElementEntry.js";import{TONES as d}from"../lib/vocabulary.js";import{splitMarkerProps as f}from"../lib/wuiMarker.js";import p from"./AppAvatar.js";import m from"./AppButton.js";import h from"./AppIcon.js";import g from"./AppNavigationMenu.js";import _ from"./assertValidValue.js";import v from"./warnUnknownProps.js";import{initScrollEdges as y,isImeSafeEnter as b,revealActiveNavItem as x,setPopoverOpen as S}from"@webority/ui-elements/helpers";import{useEffect as C,useId as w,useMemo as T,useRef as E,useState as D}from"react";import{Fragment as O,jsx as k,jsxs as A}from"react/jsx-runtime";var j=()=>import(`@webority/ui-elements/elements/overflow`),M=()=>import(`@webority/ui-elements/elements/dropdown`),N=99,P=4,F=5,I=/^[a-z0-9-]+$/,L=`wui-sidebar-footer`,R=[],z=[`prefix`,`exact`],B=[`comfortable`,`compact`],V=[`neutral`,`primary`],ee=[`default`,`brand`],te=[`side`,`top`],ne=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],re=/* @__PURE__ */ new Set([`key`,`label`,`icon`,`iconVariant`,`iconSize`,`href`,`badge`,`badgeTone`,`badgeTitle`,`newUntil`,`trailingIcon`,`active`,`match`,`matchAlso`,`tab`,`tabLabel`,`children`]),H=e=>e>N?`${N}+`:String(e),U=new Intl.DateTimeFormat(`en-CA`,{timeZone:`Asia/Kolkata`}),ie=e=>{if(typeof e!=`string`||!/^\d{4}-\d{2}-\d{2}$/.test(e))return!1;let t=/* @__PURE__ */ new Date(`${e}T00:00:00Z`);return Number.isNaN(t.getTime())||t.toISOString().slice(0,10)!==e?!1:U.format(/* @__PURE__ */ new Date)<=e},ae=({logoLight:e,logoDark:t,markLight:n,markDark:r})=>{let i=!!(n||r);return[`app-sidebar-brand`,i&&`wui-brand-has-mark`,i&&!e&&!t&&`wui-brand-mark-only`,(t||r)&&`wui-brand-themed`].filter(Boolean).join(` `)},oe=({logoLight:e,logoDark:t,markLight:n,markDark:r,brandName:i})=>{let a=i??``,o=[e&&/* @__PURE__ */ k(`img`,{className:`wui-brand-logo wui-brand-light`,src:e,alt:a},`logo-light`),t&&/* @__PURE__ */ k(`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__ */ k(`img`,{className:n,src:r,alt:a},t):/* @__PURE__ */ k(`img`,{className:n,src:r,alt:``,"aria-hidden":`true`},t));return[...o,...s].filter(Boolean)};function W(e){let{marker:t,props:n}=f(`AppShell`,e),{groups:r=[],brand:l,logoLight:u,logoDark:d,markLight:p,markDark:m,brandName:b,brandHref:w,brandLabel:j,sidebarStart:M,sidebarStartCompact:N,sidebarFooter:P,sidebarFooterItems:F=R,topbarStart:I,topbarEnd:L,footer:z,launcher:re,children:H,collapsed:U,onCollapsedChange:ie,noSidebar:W=!1,nav:G=`side`,density:K=`comfortable`,itemHeight:ce,iconVariant:q=`twotone`,topbarTone:le=`neutral`,tone:J=`default`,navLabel:ve=`Main navigation`,linkComponent:Y,currentPath:be,rememberCollapsed:xe=!1,collapsedCookie:Se=`wui-shell-collapsed`,foldedCookie:Ce=i,tabBarLabel:we=`Quick navigation`,moreLabel:Te=`More`,skipLabel:Ee=`Skip to content`,openNavLabel:De=`Open navigation`,expandNavLabel:Oe=`Expand navigation`,collapseNavLabel:ke=`Collapse navigation`,newLabel:Ae=`New`,togglePagesLabel:je=`Show or hide {name} pages`,accountMenuLabel:Me=`Account menu for {name}`,roleLabel:Ne=`Role:`,rolesLabel:Pe=`Roles:`,unreadLabel:Fe=`Unread`,markAllReadLabel:Ie=`Mark all read`,viewAllLabel:Le=`View all`,loadingNotificationsText:Re=`Loading…`,noUnreadText:ze=`No unread notifications`,unreadNotificationsText:Be=`{count} unread notifications`,unreadBellLabel:Ve=`{label}, {count} unread`,searchResultsLabel:He=`Search results`,noResultsText:Ue=`No results`,noResultsForText:We=`No results for “{value}”`,resultsCountText:Ge=`{count} results`,resultCountText:Ke=`{count} result`,userMenu:qe,notifications:Je,search:Ye,className:Xe=``,style:Ze,...Qe}=n;if(v(`AppShell`,Qe),_(`AppShell`,`density`,K,B),_(`AppShell`,`topbarTone`,le,V),_(`AppShell`,`tone`,J,ee),_(`AppShell`,`nav`,G,te),_(`AppShell`,`iconVariant`,q,ne),j!==void 0&&!w)throw Error(`<AppShell> brandLabel names the brand link, so it needs brandHref.`);if(w){if(!j&&!b)throw Error(`<AppShell> brandHref needs brandLabel or brandName: the collapsed rail hides the logo, so the link would have no accessible name.`);if(!(l||u||d||p||m))throw Error(`<AppShell> brandHref has no brand, logo or mark to link.`)}let $e=(ce??0)>0?{...Ze,"--wui-nav-item-height":`${ce}px`}:Ze,[et,tt]=D(()=>xe&&U===void 0&&typeof document<`u`?o(Se)??!1:!1),[X,Z]=D(!1),nt=E(null),[rt,it]=D(!1),[at,ot]=D(!1),st=E(null),Q=U??et,ct=e=>w?/* @__PURE__ */ k(fe,{href:w,label:j||b,linkComponent:Y,onNavigate:()=>Z(!1),children:e}):e,lt=()=>{let e=!Q;U===void 0&&tt(e),xe&&c(e,Se),ie?.(e)},ut=r.some(e=>e.collapsible),[dt,ft]=D(()=>ut&&typeof document<`u`?a(Ce):/* @__PURE__ */ new Set),pt=e=>{let t=new Set(dt);t.has(e)?t.delete(e):t.add(e),ft(t),s(t,Ce)},mt=T(()=>se(r,F,be),[r,F,be]),$=mt.groups,ht=mt.footer,gt=W?null:ue($,ht.some(e=>e.active));C(()=>{let e=()=>it(window.scrollY>4);return e(),window.addEventListener(`scroll`,e,{passive:!0}),()=>window.removeEventListener(`scroll`,e)},[]),C(()=>{y()},[]),C(()=>{x(st.current)},[]),C(()=>{let e=st.current;if(!e)return;let t=()=>ot($.length>0&&e.scrollHeight>e.clientHeight);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[$]),C(()=>{let e=nt.current;if(!e)return;let t=window.matchMedia(`(max-width: 991.98px)`),n=()=>{t.matches?e.setAttribute(`popover`,`auto`):(e.removeAttribute(`popover`),Z(!1))},r=e=>Z(`newState`in e&&e.newState===`open`);return n(),t.addEventListener(`change`,n),e.addEventListener(`toggle`,r),()=>{t.removeEventListener(`change`,n),e.removeEventListener(`toggle`,r)}},[]),C(()=>{let e=nt.current;e?.hasAttribute(`popover`)&&S(e,X)},[X]);let _t=[`app-shell`,Q?`collapsed`:``,W?`no-sidebar`:``,G===`top`?`wui-shell-top`:``,X?`mobile-open`:``,Xe].filter(Boolean).join(` `);return/* @__PURE__ */ A(`div`,{className:_t,"data-density":K===`compact`?`compact`:void 0,"data-shell-tone":J===`brand`?`brand`:void 0,"data-wui-folded-cookie":ut?Ce:void 0,style:$e,...t,...Qe,children:[/* @__PURE__ */ k(`a`,{className:`wui-skip-link`,href:`#main-content`,children:Ee}),/* @__PURE__ */ A(`aside`,{className:`app-sidebar`,ref:nt,children:[(l||u||d||p||m)&&/* @__PURE__ */ k(`div`,{className:ae({logoLight:u,logoDark:d,markLight:p,markDark:m}),children:ct(/* @__PURE__ */ A(O,{children:[oe({logoLight:u,logoDark:d,markLight:p,markDark:m,brandName:b}),l]}))}),M&&/* @__PURE__ */ k(`div`,{className:`app-sidebar-start`,children:M}),N&&/* @__PURE__ */ k(`div`,{className:`app-sidebar-start-compact`,children:N}),/* @__PURE__ */ k(`nav`,{className:`app-sidebar-scroll`,"aria-label":ve,ref:st,tabIndex:at?0:void 0,children:$.map((e,t)=>{let n=e.items.map(e=>e.header==null?/* @__PURE__ */ k(he,{item:e,linkComponent:Y,onNavigate:()=>Z(!1),iconVariant:q,newLabel:Ae,togglePagesLabel:je},e.key??e.href??e.label):/* @__PURE__ */ k(`div`,{className:`wui-nav-header`,children:e.header},e.key??e.header));if(!e.collapsible)return/* @__PURE__ */ A(`div`,{className:`app-nav-group`,children:[e.label&&/* @__PURE__ */ k(`div`,{className:`app-nav-group-label`,children:e.label}),n,e.after&&/* @__PURE__ */ k(`div`,{className:`wui-nav-group-after`,children:e.after})]},e.key??e.label??`group-${t}`);let r=!dt.has(e.key??``)||!!me(e.items),i=`wui-nav-group-${e.key}`;return/* @__PURE__ */ A(`div`,{className:`app-nav-group wui-nav-group-collapsible${r?``:` wui-nav-group-folded`}`,"data-wui-nav-group":e.key,children:[/* @__PURE__ */ A(`button`,{type:`button`,className:`app-nav-group-label wui-nav-group-toggle`,"aria-expanded":r,"aria-controls":i,onClick:()=>pt(e.key??``),children:[/* @__PURE__ */ k(`span`,{className:`wui-nav-group-text`,children:e.label}),/* @__PURE__ */ k(`span`,{className:`wui-nav-group-caret`,children:/* @__PURE__ */ k(h,{name:`chevron-down`,size:16})})]}),/* @__PURE__ */ A(`div`,{className:`wui-nav-group-body`,id:i,children:[n,e.after&&/* @__PURE__ */ k(`div`,{className:`wui-nav-group-after`,children:e.after})]})]},e.key??`group-${t}`)})}),(P||ht.length>0)&&/* @__PURE__ */ A(`div`,{className:`app-sidebar-foot`,children:[ht.length>0&&/* @__PURE__ */ k(`div`,{className:`wui-sidebar-foot-links`,children:ht.map(e=>/* @__PURE__ */ k(he,{item:e,linkComponent:Y,onNavigate:()=>Z(!1),iconVariant:q,newLabel:Ae,togglePagesLabel:je},e.key??e.href??e.label))}),P]}),!W&&/* @__PURE__ */ k(`button`,{type:`button`,className:`app-sidebar-toggle`,onClick:lt,"aria-label":Q?Oe:ke,"aria-expanded":!Q,children:/* @__PURE__ */ k(h,{name:`chevrons-left`,size:20})})]}),/* @__PURE__ */ A(`div`,{className:`app-main`,children:[/* @__PURE__ */ A(`header`,{className:`app-topbar${rt?` wui-scrolled`:``}`,"data-tone":le===`primary`?`primary`:void 0,children:[/* @__PURE__ */ A(`div`,{className:`app-topbar-start`,children:[/* @__PURE__ */ k(`button`,{type:`button`,className:`app-topbar-menu`,onClick:()=>Z(!0),"aria-label":De,"aria-expanded":X,children:/* @__PURE__ */ k(h,{name:`menu`,size:18})}),G===`top`&&l&&/* @__PURE__ */ k(`div`,{className:`wui-shell-top-brand`,children:ct(l)}),G===`top`&&/* @__PURE__ */ k(`div`,{className:`wui-shell-top-nav`,children:/* @__PURE__ */ k(g,{items:de($),ariaLabel:ve,linkComponent:Y})}),I,Ye&&/* @__PURE__ */ k(ye,{config:Ye,searchResultsLabel:He,noResultsText:Ue,noResultsForText:We,resultsCountText:Ge,resultCountText:Ke,moreLabel:Te})]}),/* @__PURE__ */ A(`div`,{className:`app-topbar-end`,children:[L,Je&&/* @__PURE__ */ k(_e,{config:Je,unreadLabel:Fe,markAllReadLabel:Ie,viewAllLabel:Le,loadingNotificationsText:Re,noUnreadText:ze,unreadNotificationsText:Be,unreadBellLabel:Ve}),qe&&/* @__PURE__ */ k(ge,{config:qe,linkComponent:Y,accountMenuLabel:Me,roleLabel:Ne,rolesLabel:Pe})]})]}),/* @__PURE__ */ k(`main`,{className:`app-content`,id:`main-content`,children:H}),z&&/* @__PURE__ */ k(`footer`,{className:`app-footer`,children:z})]}),re&&/* @__PURE__ */ k(`div`,{className:`wui-shell-launcher`,children:re}),gt&&/* @__PURE__ */ A(`nav`,{className:`wui-tabbar`,"aria-label":we,children:[gt.tabs.map(e=>/* @__PURE__ */ k(pe,{tab:e,linkComponent:Y,iconVariant:q},e.key??e.href)),gt.hasMore&&/* @__PURE__ */ A(`button`,{type:`button`,className:`wui-tabbar-item${gt.moreActive?` active`:``}`,onClick:()=>Z(!0),children:[/* @__PURE__ */ k(`span`,{className:`wui-tabbar-icon`,children:/* @__PURE__ */ k(h,{name:`more`,size:24})}),/* @__PURE__ */ k(`span`,{className:`wui-tabbar-label`,children:Te})]})]})]})}function se(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&&le(t);let a=(e,t=!1)=>(e??[]).map(e=>Array.isArray(e.children)?{...e,children:a(e.children)}:{...e}).filter(e=>K(e)?t:(e.children?.length??0)>0||!!e.href),o=[...e,{key:L,items:t}].map(e=>({...e,items:ce(a(e.items,!0))})).filter(e=>e.items.some(e=>!K(e))),s=[],c=e=>{for(let t of e)K(t)||(s.push(t),t.children&&c(t.children))};for(let e of o)c(e.items);for(let e of s)v(`AppShell items`,G(e)),_(`AppShell`,`match`,e.match,z),_(`AppShell`,`iconVariant`,e.iconVariant,ne),_(`AppShell`,`badgeTone`,e.badgeTone,d);let l=null;if(n!=null&&!s.some(e=>e.active===!0)){let e=-1;for(let t of s){if(t.active!=null||t.children?.length&&!t.href)continue;let i=r(n,t.href,{exact:t.match===`exact`,also:t.matchAlso});if(i<0)continue;let a=t.match===`exact`&&r(n,t.href,{exact:!0})>=0?1/0:i;a>e&&(e=a,l=t)}}for(let e of s)e.active=e.active??e===l;return{groups:o.filter(e=>e.key!==L),footer:o.find(e=>e.key===L)?.items??[]}}function G(e){return Object.fromEntries(Object.entries(e).filter(([e])=>!re.has(e)))}var K=e=>e.header!=null;function ce(e){return e.filter((t,n)=>{if(!K(t))return!0;let r=e.findIndex((e,t)=>t>n&&K(e));return e.slice(n+1,r<0?void 0:r).length>0})}var q=/* @__PURE__ */ new Set;function le(t){if(t.key!=null&&I.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`||q.has(n)||(q.add(n),e(n))}function ue(e,t){let n=[],r=e=>{for(let t of e)K(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?P:F;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 de(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=>K(e)?[]:[...e.href?[{...r(e,e.href),icon:e.icon}]:[],...i(e.children??[])]),a=[];for(let o of e.flatMap(e=>e.items)){if(K(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 fe({href:e,label:t,linkComponent:r,onNavigate:i,children:a}){return/* @__PURE__ */ k(l,{link:n(r,{to:e}),className:`wui-brand-link`,"aria-label":t,onClick:i,children:a})}function pe({tab:e,linkComponent:t,iconVariant:r}){let i=`wui-tabbar-item${e.active?` active`:``}`,a=/* @__PURE__ */ A(O,{children:[e.icon&&/* @__PURE__ */ k(`span`,{className:`wui-tabbar-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ k(h,{name:e.icon,size:24,variant:e.iconVariant??r}):e.icon}),/* @__PURE__ */ k(`span`,{className:`wui-tabbar-label`,children:e.tabLabel??e.label}),e.badge!=null&&/* @__PURE__ */ k(`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__ */ k(l,{link:n(t,{to:e.href}),className:i,"aria-current":o,children:a})}function me(e){for(let t of e){if(t.active)return t;let e=t.children?.length?me(t.children):void 0;if(e)return e}}function he({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?me(e.children??[]):void 0,m=!!p,g=p?p.key??p.href??p.label:null,[_,v]=D(m);C(()=>{g!=null&&v(!0)},[g]);let y=typeof e.label==`string`?e.label:void 0,b=!u&&e.icon&&/* @__PURE__ */ k(`span`,{className:`app-nav-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ k(h,{name:e.icon,size:e.iconSize??22,variant:e.iconVariant??o}):e.icon}),x=e.badge!=null&&/* @__PURE__ */ k(`span`,{className:`app-nav-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:e.badge}),S=ie(e.newUntil)&&/* @__PURE__ */ k(`span`,{className:`wui-nav-new`,children:s}),w=/* @__PURE__ */ A(O,{children:[b,/* @__PURE__ */ k(`span`,{className:`app-nav-text`,children:e.label}),S,x,e.trailingIcon&&/* @__PURE__ */ k(`span`,{className:`app-nav-trailing`,children:typeof e.trailingIcon==`string`?/* @__PURE__ */ k(h,{name:e.trailingIcon,size:16}):e.trailingIcon})]}),T=e.active?`page`:void 0;if(f){let f=/* @__PURE__ */ k(`div`,{className:`app-nav-sub${_?` expanded`:``}`,inert:!_,"aria-hidden":!_||void 0,children:/* @__PURE__ */ k(`div`,{className:`app-nav-sub-inner`,children:(e.children??[]).map(e=>/* @__PURE__ */ k(he,{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__ */ k(l,{link:n(r,{to:e.href}),className:`wui-nav-split-link`,"aria-current":T,onClick:i,children:w});return/* @__PURE__ */ A(O,{children:[/* @__PURE__ */ A(`div`,{className:`app-nav-item has-children wui-nav-split${u?` app-nav-subitem`:``}${m||e.active?` active`:``}${d}`,"data-label":y,children:[a,/* @__PURE__ */ k(`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__ */ k(h,{name:`chevron-right`,size:16})})]}),f]})}return/* @__PURE__ */ A(O,{children:[/* @__PURE__ */ A(`button`,{type:`button`,className:`app-nav-item${u?` app-nav-subitem`:``} has-children${m?` active`:``}${d}`,"aria-expanded":_,"data-label":y,onClick:()=>v(e=>!e),children:[b,/* @__PURE__ */ k(`span`,{className:`app-nav-text`,children:e.label}),S,x,/* @__PURE__ */ k(`span`,{className:`app-nav-caret`,children:/* @__PURE__ */ k(h,{name:`chevron-right`,size:16})})]}),f]})}let E=`app-nav-item${u?` app-nav-subitem`:``}${e.active?` active`:``}${d}`;return/* @__PURE__ */ k(l,{link:n(r,{to:e.href}),className:E,"aria-current":T,"data-label":y,onClick:i,children:w})}function J(e){u(`wui-dropdown`,M);let[t,n]=D(!1),r=E(null);return C(()=>{r.current?.toggleAttribute(`open`,t)},[t]),C(()=>{let t=r.current;if(!t)return;let i=r=>{if(r.target!==t||!(`detail`in r)||!r.detail||typeof r.detail!=`object`)return;let i=`open`in r.detail&&r.detail.open===!0;n(i),i&&e?.()};return t.addEventListener(`wui-dropdown-toggle`,i),()=>t.removeEventListener(`wui-dropdown-toggle`,i)},[e]),{open:t,setOpen:n,ref:r}}function ge({config:e,linkComponent:r,accountMenuLabel:i,roleLabel:a,rolesLabel:o}){let s=w(),{open:c,setOpen:u,ref:d}=J(),{name:f,role:g,roles:v=[],noTriggerRole:y=!1,outlined:b=!1,photo:x,profileHref:S,profileLabel:C=`My profile`,onLogout:T,logoutAction:E,logoutLabel:D=`Sign out`,head:j,section:M,logoutVariant:N=`item`,items:P=[]}=e;if(_(`AppShell`,`userMenu.logoutVariant`,N,[`item`,`button`]),!f)throw Error(`<AppShell> userMenu.name is required; the trigger and the avatar are named from it.`);let F=v.map(e=>(e??``).trim()).filter(Boolean),I=()=>u(!1),L=(e,t,i,a)=>/* @__PURE__ */ k(l,{link:n(r,{to:e}),className:`dropdown-item`,onClick:a,children:t},i),R=/* @__PURE__ */ k(h,{name:`log-out`,size:18}),z=/* @__PURE__ */ A(O,{children:[R,D]});return/* @__PURE__ */ A(`wui-dropdown`,{class:`dropdown wui-usermenu`,align:`end`,ref:d,children:[/* @__PURE__ */ A(`button`,{type:`button`,id:s,className:b?`wui-usermenu-trigger wui-usermenu-trigger-outlined`:`wui-usermenu-trigger`,"data-wui-dropdown-trigger":!0,"aria-expanded":c,"aria-label":t(i,{name:f}),children:[/* @__PURE__ */ k(p,{name:f,src:x,tone:`auto`}),/* @__PURE__ */ A(`span`,{className:`wui-usermenu-text`,children:[/* @__PURE__ */ k(`span`,{className:`wui-usermenu-name`,children:f}),g&&!y&&/* @__PURE__ */ k(`span`,{className:`wui-usermenu-role`,children:g})]}),/* @__PURE__ */ k(h,{name:`chevron-down`,size:14,className:`wui-usermenu-caret`})]}),/* @__PURE__ */ A(`div`,{"data-wui-dropdown-menu":!0,popover:`auto`,className:`dropdown-menu dropdown-menu-end wui-usermenu-menu${c?` show`:``}`,"aria-labelledby":s,children:[/* @__PURE__ */ A(`div`,{className:`wui-usermenu-head`,children:[/* @__PURE__ */ k(p,{name:f,src:x,size:`lg`,tone:`auto`}),/* @__PURE__ */ A(`div`,{className:`wui-usermenu-who`,children:[/* @__PURE__ */ k(`div`,{className:`wui-usermenu-name`,children:f}),g&&/* @__PURE__ */ k(`div`,{className:`wui-usermenu-role`,children:g}),F.length>0&&/* @__PURE__ */ A(`div`,{className:`wui-usermenu-roles`,children:[/* @__PURE__ */ k(`span`,{className:`wui-usermenu-roles-label`,children:F.length===1?a:o}),` ${F.join(`, `)}`]}),j?/* @__PURE__ */ k(`div`,{className:`wui-usermenu-extra`,children:j}):null]})]}),M?/* @__PURE__ */ k(`div`,{className:`wui-usermenu-section`,children:M}):null,S&&L(S,/* @__PURE__ */ A(O,{children:[/* @__PURE__ */ k(h,{name:`user`,size:18}),C]}),void 0,I),P.map(e=>{if(e.divider)return/* @__PURE__ */ k(`hr`,{className:`dropdown-divider`},e.key);let t=/* @__PURE__ */ A(O,{children:[e.icon&&/* @__PURE__ */ k(h,{name:e.icon,size:18}),e.label]}),n=()=>{e.onClick?.(),I()};return e.href?L(e.href,t,e.key,n):/* @__PURE__ */ k(`button`,{type:`button`,className:`dropdown-item`,onClick:n,children:t},e.key)}),N===`button`?(E||T)&&/* @__PURE__ */ k(`div`,{className:`wui-usermenu-foot`,children:E?/* @__PURE__ */ k(`form`,{method:`post`,action:E,className:`wui-usermenu-logout`,children:/* @__PURE__ */ k(m,{type:`submit`,tone:`danger`,variant:`soft`,block:!0,leftIcon:R,children:D})}):/* @__PURE__ */ k(m,{type:`button`,tone:`danger`,variant:`soft`,block:!0,leftIcon:R,onClick:()=>{I(),T?.()},children:D})}):E?/* @__PURE__ */ k(`form`,{method:`post`,action:E,className:`wui-usermenu-logout`,children:/* @__PURE__ */ k(`button`,{type:`submit`,className:`dropdown-item danger`,children:z})}):T&&/* @__PURE__ */ k(`button`,{type:`button`,className:`dropdown-item danger`,onClick:()=>{I(),T()},children:z})]})]})}function _e({config:e,unreadLabel:n,markAllReadLabel:r,viewAllLabel:i,loadingNotificationsText:a,noUnreadText:o,unreadNotificationsText:s,unreadBellLabel:c}){let l=w(),{open:u,ref:d}=J(e.onOpen),{unread:f=0,items:p,loading:m=!1,onMarkAllRead:g,viewAllHref:_,label:v=`Notifications`,emptyText:y=`You are all caught up.`}=e,[b,x]=D(``),S=E(f);C(()=>{S.current!==f&&(S.current=f,x(f===0?o:t(s,{count:H(f)})))},[f,o,s]);let T=null;return p?.length?T=/* @__PURE__ */ k(`div`,{className:`wui-bell-items`,children:p.map((e,t)=>{let r=`wui-bell-item${e.read?` wui-bell-item-read`:``}`,i=/* @__PURE__ */ A(O,{children:[/* @__PURE__ */ k(`span`,{className:`wui-bell-dot`,"aria-hidden":`true`}),e.icon&&/* @__PURE__ */ k(`span`,{className:`wui-bell-icon`,children:/* @__PURE__ */ k(h,{name:e.icon,size:18})}),/* @__PURE__ */ A(`span`,{className:`wui-bell-body`,children:[!e.read&&/* @__PURE__ */ A(`span`,{className:`visually-hidden`,children:[n,`: `]}),/* @__PURE__ */ k(`span`,{className:`wui-bell-item-title`,children:e.title}),e.time&&/* @__PURE__ */ k(`span`,{className:`wui-bell-when`,children:e.time})]})]});return e.href?/* @__PURE__ */ k(`a`,{className:r,href:e.href,"data-id":e.id,children:i},e.id??t):/* @__PURE__ */ k(`div`,{className:r,"data-id":e.id,children:i},e.id??t)})}):m?T=/* @__PURE__ */ k(`div`,{className:`wui-bell-state`,children:a}):p&&(T=/* @__PURE__ */ k(`div`,{className:`wui-bell-state`,children:y})),/* @__PURE__ */ A(`wui-dropdown`,{class:`dropdown wui-bell`,align:`end`,ref:d,children:[/* @__PURE__ */ A(`button`,{type:`button`,id:l,className:`topbar-icon-btn wui-bell-trigger`,"data-wui-dropdown-trigger":!0,"aria-expanded":u,"aria-label":f===0?v:t(c,{label:v,count:H(f)}),children:[/* @__PURE__ */ k(h,{name:`notification`,size:20}),/* @__PURE__ */ k(`span`,{className:`wui-bell-count`,"aria-hidden":`true`,hidden:f===0,children:H(f)})]}),/* @__PURE__ */ k(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:b}),/* @__PURE__ */ A(`div`,{"data-wui-dropdown-menu":!0,popover:`auto`,className:`dropdown-menu dropdown-menu-end wui-bell-menu${u?` show`:``}`,"aria-labelledby":l,children:[/* @__PURE__ */ A(`div`,{className:`wui-bell-head`,children:[/* @__PURE__ */ k(`span`,{className:`wui-bell-title`,children:v}),g&&/* @__PURE__ */ k(`button`,{type:`button`,className:`wui-bell-markall`,onClick:g,children:r})]}),/* @__PURE__ */ k(`div`,{className:`wui-bell-list`,"aria-busy":m||void 0,children:T}),_&&/* @__PURE__ */ k(`a`,{className:`wui-bell-foot`,href:_,children:i})]})]})}var ve=e=>!!e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName));function ye({config:e,searchResultsLabel:n,noResultsText:r,noResultsForText:i,resultsCountText:a,resultCountText:o,moreLabel:s}){u(`wui-overflow`,j);let c=w(),{value:l=``,onChange:d,results:f=null,loading:p=!1,onSelect:m,onSubmit:g,onFocus:_,placeholder:v=`Search`}=e,[y,x]=D(!1),[S,O]=D(!1),[M,N]=D({results:null,index:-1}),P=M.results===f?M.index:-1,F=e=>N({results:f,index:e}),I=E(null),L=E(null),R=E([]),z=T(()=>(f??[]).flatMap(e=>e.hits??[]),[f]),B=f!=null&&!S,V=z.length;C(()=>{let e=e=>{e.key!==`/`||e.ctrlKey||e.metaKey||e.altKey||ve(e.target instanceof HTMLElement?e.target:null)||(e.preventDefault(),x(!0),L.current?.focus())},t=e=>{I.current?.contains(e.target instanceof Node?e.target:null)||(O(!0),x(!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(!B||V===0)return;e.preventDefault(),F((P+(e.key===`ArrowDown`?1:-1)+V)%V)}else b(e.nativeEvent)?B&&P>=0&&R.current[P]?(e.preventDefault(),R.current[P].click()):g&&l.trim()!==``&&(e.preventDefault(),g(l.trim())):e.key===`Escape`&&(B?(e.preventDefault(),O(!0)):y&&(e.preventDefault(),x(!1)))},te=-1;return R.current=[],/* @__PURE__ */ k(`wui-overflow`,{class:`wui-topsearch-host`,label:s,children:/* @__PURE__ */ k(`div`,{"data-wui-overflow-list":!0,className:`wui-topsearch-row`,children:/* @__PURE__ */ A(`div`,{className:`wui-topsearch${y?` is-open`:``}${p?` is-loading`:``}`,ref:I,"data-overflow-label":v,children:[/* @__PURE__ */ k(`button`,{type:`button`,className:`topbar-icon-btn wui-topsearch-open`,"aria-label":v,"aria-expanded":y,"aria-controls":`${c}-panel`,onClick:()=>{let e=!y;x(e),e&&L.current?.focus()},children:/* @__PURE__ */ k(h,{name:`search`,size:20})}),/* @__PURE__ */ A(`div`,{className:`wui-topsearch-panel`,id:`${c}-panel`,children:[/* @__PURE__ */ A(`div`,{className:`search-wrap`,children:[/* @__PURE__ */ k(h,{name:`search`,size:18,className:`search-icon`}),/* @__PURE__ */ k(`input`,{ref:L,type:`search`,className:`form-control input search-input`,id:`${c}-input`,placeholder:v,"aria-label":v,role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":B,"aria-controls":`${c}-list`,"aria-activedescendant":B&&P>=0?`${c}-opt-${P}`:void 0,autoComplete:`off`,value:l,onChange:e=>{O(!1),d?.(e.target.value)},onKeyDown:ee,onFocus:_})]}),/* @__PURE__ */ k(`div`,{className:`wui-topsearch-results`,id:`${c}-list`,role:`listbox`,"aria-label":n,hidden:!B,children:B&&/* @__PURE__ */ A(`div`,{className:`wui-topsearch-groups`,role:`presentation`,children:[V===0&&/* @__PURE__ */ k(`div`,{className:`wui-topsearch-empty`,role:`option`,"aria-disabled":`true`,"aria-selected":`false`,children:t(i,{value:l})}),f.filter(e=>e.hits?.length).map((e,t)=>/* @__PURE__ */ A(`div`,{className:`wui-topsearch-group`,role:`group`,"aria-label":e.label??``,children:[e.label&&/* @__PURE__ */ k(`div`,{className:`wui-topsearch-group-label`,role:`presentation`,children:e.label}),e.hits.map(e=>{te+=1;let t=te;return/* @__PURE__ */ A(`a`,{className:`wui-topsearch-hit${t===P?` is-active`:``}`,role:`option`,"aria-selected":t===P,id:`${c}-opt-${t}`,href:e.href,ref:e=>{R.current[t]=e},onClick:t=>m?.(e,t),children:[e.icon&&/* @__PURE__ */ k(`span`,{className:`wui-topsearch-hit-icon`,children:/* @__PURE__ */ k(h,{name:e.icon,size:18})}),/* @__PURE__ */ A(`span`,{className:`wui-topsearch-hit-text`,children:[/* @__PURE__ */ k(`span`,{className:`wui-topsearch-hit-title`,children:e.title}),e.subtitle&&/* @__PURE__ */ k(`span`,{className:`wui-topsearch-hit-sub`,children:e.subtitle})]})]},`${e.href}-${t}`)})]},e.label??t))]})})]}),/* @__PURE__ */ k(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:B?V===0?r:t(V===1?o:a,{count:V}):``})]})})})}export{W as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/FieldMessage.js";import t from"../lib/useElementEntry.js";import{splitMarkerProps as
|
|
1
|
+
import e from"../lib/FieldMessage.js";import{useFieldError as t}from"../lib/formFields.js";import n from"../lib/useElementEntry.js";import{splitMarkerProps as ee}from"../lib/wuiMarker.js";import r from"./AppInfoTip.js";import i from"./AppRequiredMark.js";import a from"./assertValidValue.js";import te,{readRange as o,writeNumberValue as s}from"./useWuiControl.js";import ne from"./warnUnknownProps.js";import{forwardRef as c,useEffect as re,useId as ie,useRef as ae}from"react";import{jsx as l,jsxs as u}from"react/jsx-runtime";var oe=[`sm`,`md`,`lg`],d=[`none`,`indian`],f=()=>import(`@webority/ui-elements/elements/slider`),p=(e,t)=>s(e,typeof t==`number`||typeof t==`string`?t:void 0),m=c(function(s,c){let{marker:m,props:h}=ee(`AppSlider`,s),{value:g,start:_,end:v,range:se=!1,onChange:ce,label:y,required:b=!1,optional:le=!1,helperText:x,error:ue,name:S,startName:C,endName:w,min:T=0,max:E=100,step:D=1,disabled:O,readOnly:k=!1,loading:A=!1,defaultValue:j,defaultStart:M,defaultEnd:N,size:P,showValue:F,unit:I,grouping:L=`none`,id:R,ariaLabel:z,className:B=``,fieldClassName:V=``,help:H,helpLabel:U=`More information`,optionalLabel:de=`(optional)`,...W}=h,fe=t(S),pe=t(C),me=t(w),G=ue??fe??pe??me;ne(`AppSlider`,W),a(`AppSlider`,`size`,P,oe),a(`AppSlider`,`grouping`,L,d);let he=n(`wui-slider`,f),ge=ie(),K=R||ge,q=se,{setRef:_e,innerRef:J}=te({ready:he,ref:e=>{typeof c==`function`?c(e):c&&(c.current=e)},value:q?void 0:g,onChange:q?e=>{s.range&&s.onChange?.(e)}:e=>{s.range||s.onChange?.(e)},readValue:q?o:void 0,writeValue:q?void 0:p}),Y=ae(!1);re(()=>{if(!q)return;let e=J.current;if(!e)return;let t=_===void 0?Y.current?void 0:M:_,n=v===void 0?Y.current?void 0:N:v;Y.current=!0,t!==void 0&&t>e.end?(n!==void 0&&e.end!==n&&(e.end=n),t!==void 0&&e.start!==t&&(e.start=t)):(t!==void 0&&e.start!==t&&(e.start=t),n!==void 0&&e.end!==n&&(e.end=n))},[_,v,M,N,q,J]);let X=!y&&!G&&!x,Z=G?`${K}-error`:void 0,Q=x?`${K}-hint`:void 0,$=/* @__PURE__ */ l(`wui-slider`,{ref:_e,id:K,name:S||void 0,"start-name":C||void 0,"end-name":w||void 0,min:T,max:E,step:D,size:P||void 0,value:(g??j)!=null&&!q?String(g??j):void 0,"aria-label":z||(typeof y==`string`?y:void 0),"aria-describedby":Z||Q,"aria-invalid":G?`true`:void 0,disabled:O?``:void 0,readonly:k?``:void 0,loading:A?``:void 0,required:b?``:void 0,range:q?``:void 0,"show-value":F?``:void 0,unit:I||void 0,grouping:L===`indian`?L:void 0,className:B||void 0,...X?m:null,...W});return X?$:/* @__PURE__ */ u(`div`,{...m,className:`field${V?` ${V}`:``}`,children:[y&&/* @__PURE__ */ u(`label`,{className:`label`,htmlFor:K,children:[y,le&&!b&&/* @__PURE__ */ l(`span`,{className:`label-optional`,children:` ${de}`}),b&&/* @__PURE__ */ l(i,{}),H&&/* @__PURE__ */ l(r,{label:U,children:H})]}),$,/* @__PURE__ */ l(e,{error:G,hint:x,errorId:Z,hintId:Q})]})});export{m as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/FieldMessage.js";import{FIELD_BUSY_CLASS as n,FIELD_SIZES as r}from"../lib/fieldState.js";import{
|
|
1
|
+
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/FieldMessage.js";import{FIELD_BUSY_CLASS as n,FIELD_SIZES as r}from"../lib/fieldState.js";import{useFieldError as i}from"../lib/formFields.js";import{splitMarkerProps as ee}from"../lib/wuiMarker.js";import te from"./AppInfoTip.js";import ne from"./AppRequiredMark.js";import re from"./assertValidValue.js";import a from"./warnUnknownProps.js";import{forwardRef as o,useCallback as s,useEffect as c,useId as l,useLayoutEffect as u,useRef as d,useState as ie}from"react";import{jsx as f,jsxs as p}from"react/jsx-runtime";import{Form as m}from"react-bootstrap";var h=e=>e!=null&&e!==``&&e!==!1,g=o(function(o,g){let{marker:_,props:v}=ee(`AppTextarea`,o),{label:y,required:b=!1,optional:x=!1,optionalLabel:S=`(optional)`,error:C,helperText:w,help:T,helpLabel:ae=`More information`,id:oe,name:E,rows:se=4,autoGrow:D=!1,monospace:O=!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}=v,B=i(E),V=C??B,{onChange:H,...U}=z;if(L){let e=[[`label`,y],[`error`,V],[`helperText`,w],[`fieldClassName`,I],[`showCount`,k],[`help`,T],[`optional`,x]];for(let[t,n]of e)if(h(n))throw Error(`<AppTextarea> controlOnly draws no field, so it takes no ${t}; draw the label or message on the page.`)}a(`AppTextarea`,z),re(`AppTextarea`,`size`,P,r),c(()=>{x&&b&&typeof process<`u`&&process.env.NODE_ENV!==`production`&&e(`AppTextarea: optional and required together; optional ignored`)},[x,b]);let W=l(),G=oe||W,ce=[`textarea`,D?`autosize`:``,O?`wui-mono`:``,V?`error`:``,P===`sm`?`input-sm`:``,P===`lg`?`input-lg`:``,N?n:``,F].filter(Boolean).join(` `),K=V&&G?`${G}-error`:void 0,q=w&&G?`${G}-hint`:void 0,le=K||q,J=d(null),ue=e=>{J.current=e,typeof g==`function`?g(e):g&&(g.current=e)},Y=d(void 0),X=s(()=>{let e=J.current;e&&(e.style.height=`auto`,e.style.height=`${e.scrollHeight}px`,Y.current=`${e.value}|${e.clientWidth}`)},[]);u(()=>{let e=J.current;!D||!e?Y.current=void 0:`${String(R??e.value)}|${e.clientWidth}`!==Y.current&&X()});let[Z,Q]=ie(()=>String(R??z.defaultValue??``).length);c(()=>{k&&R!==void 0&&Q(String(R??``).length)},[R,k]);let de=e=>{D&&X(),k&&Q(e.currentTarget.value.length),z.onInput?.(e)},$=/* @__PURE__ */ f(m.Control,{as:`textarea`,id:G,name:E,rows:se,className:ce,"aria-invalid":V?`true`:`false`,"aria-describedby":le,"aria-busy":N||void 0,required:b,maxLength:A,disabled:j,readOnly:M||N,...L?_:null,...R===void 0?null:{value:R},...U,...H?{onChange:H}:null,ref:ue,onInput:de});return L?$:/* @__PURE__ */ p(m.Group,{..._,className:`field${I?` ${I}`:``}`,children:[y&&/* @__PURE__ */ p(m.Label,{className:`label`,htmlFor:G,children:[y,x&&!b&&/* @__PURE__ */ f(`span`,{className:`label-optional`,children:` ${S}`}),b&&/* @__PURE__ */ f(ne,{}),T&&/* @__PURE__ */ f(te,{label:ae,children:T})]}),$,/* @__PURE__ */ f(t,{error:V,hint:w,errorId:K,hintId:q}),k&&/* @__PURE__ */ p(`div`,{className:`field-count${A&&Z>=A?` at-limit`:``}`,children:[Z,A?` / ${A}`:``]})]})});export{g as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/FieldMessage.js";import t from"../lib/useElementEntry.js";import{splitMarkerProps as
|
|
1
|
+
import e from"../lib/FieldMessage.js";import{useFieldError as t}from"../lib/formFields.js";import n from"../lib/useElementEntry.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./AppInfoTip.js";import a from"./AppRequiredMark.js";import o from"./assertValidValue.js";import s from"./textOf.js";import ee from"./useWuiControl.js";import te from"./warnUnknownProps.js";import{cloneElement as c,forwardRef as l,useId as u}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";var p=[`sm`,`md`,`lg`],m=[`12`,`24`],h=()=>import(`@webority/ui-elements/elements/timepicker`),g=l(function(l,g){let _=n(`wui-timepicker`,h),{marker:v,props:y}=r(`AppTimePicker`,l),{value:b,defaultValue:x,onChange:ne,label:S,required:C=!1,optional:w=!1,optionalLabel:T=`(optional)`,helperText:E,error:D,help:O,helpLabel:k=`More information`,name:A,min:j,max:M,step:N,format:P=24,placeholder:F=`Select time`,disabled:I,readOnly:re=!1,loading:L=!1,size:R,id:z,ariaLabel:B,className:V=``,fieldClassName:H=``,...U}=y,W=t(A),G=D??W;te(`AppTimePicker`,U),o(`AppTimePicker`,`size`,R,p);let K=String(P);o(`AppTimePicker`,`format`,K,m);let q=u(),J=z||A||q,{setRef:Y}=ee({ready:_,ref:g,value:b??(x===void 0?``:void 0),onChange:ne}),X=!S&&!G&&!E,Z=G?`${J}-error`:void 0,Q=E?`${J}-hint`:void 0,ie=Z||Q,$=/* @__PURE__ */ d(`wui-timepicker`,{ref:Y,value:(b??x)||void 0,id:J,name:A,min:j,max:M,step:N==null?void 0:String(N),format:K,placeholder:F,size:R||void 0,"aria-label":B||s(S)||void 0,"aria-describedby":ie,"aria-invalid":G?`true`:void 0,disabled:I?``:void 0,readonly:re?``:void 0,loading:L?``:void 0,required:C?``:void 0,className:V||void 0,...U});return X?c($,v):/* @__PURE__ */ f(`div`,{...v,className:`field${H?` ${H}`:``}`,children:[S&&/* @__PURE__ */ f(`label`,{className:`label`,htmlFor:J,children:[S,w&&!C&&/* @__PURE__ */ d(`span`,{className:`label-optional`,children:` ${T}`}),C&&/* @__PURE__ */ d(a,{}),O&&/* @__PURE__ */ d(i,{label:k,children:O})]}),$,/* @__PURE__ */ d(e,{error:G,hint:E,errorId:Z,hintId:Q})]})});export{g as default};
|