@webority/ui-react 0.163.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/README.md +2 -2
- package/dist/canvas-kit/kit.js +212 -212
- package/dist/canvas-kit/manifest.json +1127 -389
- package/dist/canvas-kit/release.json +6 -6
- package/dist/components/AppAccountSwitcher.js +1 -1
- package/dist/components/AppAlert.js +1 -1
- package/dist/components/AppAsyncBlock.js +1 -1
- package/dist/components/AppBreadcrumbs.js +1 -1
- package/dist/components/AppButton.js +1 -1
- package/dist/components/AppCard.js +1 -1
- package/dist/components/AppChartCard.js +1 -1
- package/dist/components/AppChoiceChip.js +1 -1
- package/dist/components/AppCodeBlock.js +1 -1
- package/dist/components/AppColorField.js +1 -1
- package/dist/components/AppCommentThread.js +1 -1
- package/dist/components/AppContextMenu.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/AppDrawer.js +1 -1
- package/dist/components/AppDropZone.js +1 -1
- package/dist/components/AppDropdown.js +1 -1
- package/dist/components/AppDueDate.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/AppFileViewer.js +1 -1
- package/dist/components/AppFilterBar.js +1 -1
- package/dist/components/AppFloatingButton.js +1 -1
- package/dist/components/AppForm.js +1 -1
- package/dist/components/AppFormulaSteps.js +1 -0
- package/dist/components/AppHoverCard.js +1 -1
- package/dist/components/AppImagePicker.js +1 -1
- package/dist/components/AppInlineEdit.js +1 -1
- package/dist/components/AppInput.js +1 -1
- package/dist/components/AppMarkdown.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/AppNotificationCenter.js +1 -1
- package/dist/components/AppNumberInput.js +1 -1
- package/dist/components/AppOtpInput.js +1 -1
- package/dist/components/AppPageHeader.js +1 -1
- package/dist/components/AppPhoneNumberInput.js +1 -1
- package/dist/components/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/AppSearch.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/AppSparkline.js +1 -1
- package/dist/components/AppTextarea.js +1 -1
- package/dist/components/AppThemeToggle.js +1 -1
- package/dist/components/AppTimePicker.js +1 -1
- package/dist/components/AppToast.js +1 -1
- package/dist/components/AppTooltip.js +1 -1
- package/dist/components/AppWhatsNew.js +1 -1
- package/dist/components/AppWorkspaceSwitcher.js +1 -1
- package/dist/components/warnUnknownProps.js +1 -1
- package/dist/guidance.json +216 -141
- package/dist/hookForm/index.js +1 -0
- package/dist/lib/CheckField.js +1 -1
- package/dist/lib/formFields.js +1 -0
- package/dist/lib/indianGrouping.js +1 -0
- package/dist/lib/unsavedText.js +1 -0
- package/dist/lib/useOverlayRoot.js +1 -0
- package/dist/types/components/AppAccordion.d.ts +1 -1
- package/dist/types/components/AppAlert.d.ts +1 -1
- package/dist/types/components/AppAsyncBlock.d.ts +3 -3
- package/dist/types/components/AppBreadcrumbs.d.ts +6 -0
- package/dist/types/components/AppCard.d.ts +1 -1
- package/dist/types/components/AppChart.d.ts +12 -4
- package/dist/types/components/AppChip.d.ts +2 -2
- package/dist/types/components/AppCodeBlock.d.ts +1 -1
- package/dist/types/components/AppCommandPalette.d.ts +2 -2
- package/dist/types/components/AppDataTable.d.ts +32 -3
- package/dist/types/components/AppDateRangePicker.d.ts +4 -0
- package/dist/types/components/AppDescriptions.d.ts +7 -1
- package/dist/types/components/AppDrawer.d.ts +1 -1
- package/dist/types/components/AppDropdown.d.ts +7 -7
- package/dist/types/components/AppEntryGrid.d.ts +122 -0
- package/dist/types/components/AppFilePicker.d.ts +1 -1
- package/dist/types/components/AppFilterBar.d.ts +12 -1
- package/dist/types/components/AppFloatingDock.d.ts +2 -2
- package/dist/types/components/AppForm.d.ts +18 -0
- package/dist/types/components/AppFormActions.d.ts +1 -1
- package/dist/types/components/AppFormSection.d.ts +1 -1
- package/dist/types/components/AppFormulaSteps.d.ts +64 -0
- package/dist/types/components/AppIcon.d.ts +2 -2
- package/dist/types/components/AppInfoTip.d.ts +1 -1
- package/dist/types/components/AppInlineEdit.d.ts +5 -0
- package/dist/types/components/AppKpiTile.d.ts +1 -1
- package/dist/types/components/AppMeter.d.ts +1 -1
- package/dist/types/components/AppMetricStrip.d.ts +5 -0
- package/dist/types/components/AppModal.d.ts +9 -4
- package/dist/types/components/AppNumberInput.d.ts +7 -0
- package/dist/types/components/AppPageHeader.d.ts +5 -0
- package/dist/types/components/AppPopover.d.ts +3 -3
- package/dist/types/components/AppRequiredMark.d.ts +1 -1
- package/dist/types/components/AppResourceCard.d.ts +1 -1
- package/dist/types/components/AppResult.d.ts +2 -2
- package/dist/types/components/AppRowActions.d.ts +40 -0
- package/dist/types/components/AppScrollbar.d.ts +1 -1
- 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 +8 -6
- package/dist/types/components/AppSlider.d.ts +5 -0
- package/dist/types/components/AppSparkline.d.ts +3 -0
- package/dist/types/components/AppSpinner.d.ts +2 -2
- package/dist/types/components/AppSplash.d.ts +2 -2
- package/dist/types/components/AppTabs.d.ts +3 -3
- package/dist/types/components/AppToast.d.ts +6 -1
- package/dist/types/components/AppToolbar.d.ts +5 -5
- package/dist/types/components/AppTooltip.d.ts +5 -5
- package/dist/types/components/AppWorkspaceSwitcher.d.ts +3 -3
- package/dist/types/components/toastStore.d.ts +2 -2
- package/dist/types/components/warnUnknownProps.d.ts +3 -3
- package/dist/types/hookForm/index.d.ts +14 -0
- package/dist/types/index.d.ts +8 -6
- package/dist/types/lib/CheckField.d.ts +1 -1
- package/dist/types/lib/FieldMessage.d.ts +1 -1
- package/dist/types/lib/FileItemRow.d.ts +1 -1
- package/dist/types/lib/fileItem.d.ts +3 -3
- package/dist/types/lib/formFields.d.ts +12 -0
- package/dist/types/lib/indianGrouping.d.ts +2 -0
- package/dist/types/lib/unsavedText.d.ts +5 -0
- package/dist/types/lib/useOverlayRoot.d.ts +2 -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 +21 -10
- 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/lib/FocusPanel.js +0 -1
- package/dist/lib/pageScrollLock.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
- package/dist/types/lib/FocusPanel.d.ts +0 -11
- package/dist/types/lib/pageScrollLock.d.ts +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{devError as e}from"../lib/devWarn.js";import{TONES as
|
|
1
|
+
import{devError as e}from"../lib/devWarn.js";import t from"../lib/useElementEntry.js";import{TONES as n}from"../lib/vocabulary.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import{BreadcrumbTrailContext as i}from"./AppBreadcrumbs.js";import ee from"./AppIcon.js";import a from"./assertValidValue.js";import te from"./warnUnknownProps.js";import{formatNumber as ne}from"@webority/ui-elements/helpers";import{useEffect as re,useState as o}from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";var ie=[`sm`,`md`,`lg`,`bar`],ae=[`start`,`center`],l=[`inline`,`below`],u=[`below`,`inline`],d=[`h1`,`h2`,`h3`,`h4`,`h5`,`h6`],f=`.btn-primary`,p=()=>import(`@webority/ui-elements/elements/overflow`),m=[`views`,`tools`,`meta`,`bulk`],h={views:`tabs (app-tabs) under the header`,tools:`filters in the table toolbar (app-table-toolbar)`,meta:`facts in the header's description or a fact list below it`,bulk:`bulk actions in the table toolbar's bulk slot`},g=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}},_=e=>e!=null&&e!==!1&&e!==``;function v({children:e}){return t(`wui-overflow`,p),/* @__PURE__ */ s(`wui-overflow`,{class:`wui-page-header-actions`,label:`More`,keep:f,children:/* @__PURE__ */ s(`div`,{className:`page-actions`,"data-wui-overflow-list":``,children:e})})}function y(t){let{marker:f,props:p}=r(`AppPageHeader`,t),{title:y,titleSlot:b,as:x=`h1`,subtitle:S,eyebrow:C,icon:w,tone:T=`primary`,status:E,breadcrumbs:D,actions:O,views:k,tools:A,meta:j,metaPlacement:M=`inline`,subtitlePlacement:N=`below`,bulkFor:P,bulk:F,size:I=`md`,align:L=`start`,divider:R=!1,sticky:z=!1,foldActions:B=!1,className:V=``,...H}=p;if(te(`AppPageHeader`,H),a(`AppPageHeader`,`tone`,T,n.filter(e=>e!==`neutral`)),a(`AppPageHeader`,`size`,I,ie),a(`AppPageHeader`,`align`,L,ae),a(`AppPageHeader`,`as`,x,d),a(`AppPageHeader`,`metaPlacement`,M,l),a(`AppPageHeader`,`subtitlePlacement`,N,u),I!==`bar`&&g()){let t={views:k,tools:A,meta:j,bulk:F};for(let n of m)_(t[n])&&e(`app-page-header-${n} is drawn only when size="bar". On a ${I} header, put ${h[n]} instead.`);B&&e(`foldActions works only when size="bar". On a ${I} header it has no effect; drop it or use size="bar".`)}let U=d.includes(x)?x:`h1`,W=I===`bar`,G=W&&M===`below`,K=!W&&N===`inline`,q=[`page-header`,I&&I!==`md`?`page-header-${I}`:``,L===`center`?`page-header-center`:``,R?`page-header-divider`:``,z?`page-header-sticky`:``,T&&T!==`primary`?`tone-${T}`:``,G?`wui-page-header-meta-below`:``,K?`wui-page-header-subtitle-inline`:``,V].filter(Boolean).join(` `),[J,Y]=o(0),X=W?P:void 0;re(()=>{if(!X)return;document.getElementById(X)?.setAttribute(`data-wui-bulk-in-bar`,``);let e=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail;typeof t?.selected==`number`&&e.target instanceof Node&&document.getElementById(X)?.contains(e.target)&&Y(t.selected)};return document.addEventListener(`selectionchange`,e),()=>{document.removeEventListener(`selectionchange`,e),document.getElementById(X)?.removeAttribute(`data-wui-bulk-in-bar`)}},[X]);let Z=y!=null||b!=null?/* @__PURE__ */ s(U,{className:b==null?`page-title`:`page-title wui-page-title-slot`,"aria-label":b!=null&&typeof y==`string`&&y!==``?y:void 0,children:b??y}):null;if(W)return/* @__PURE__ */ c(`header`,{className:q,"data-wui-page-header-bar":``,"data-wui-bulk-for":P||void 0,...f,...H,children:[D!=null&&/* @__PURE__ */ s(i.Provider,{value:!0,children:/* @__PURE__ */ s(`div`,{className:`page-header-bar-crumbs`,children:D})}),Z,E!=null&&/* @__PURE__ */ s(`span`,{className:`page-status`,children:E}),k!=null&&/* @__PURE__ */ s(`div`,{className:`page-header-bar-views`,"data-wui-bar-swap":``,hidden:P&&J>0?!0:void 0,children:k}),/* @__PURE__ */ s(`span`,{className:`page-header-bar-spacer`,"aria-hidden":`true`}),j!=null&&!G&&/* @__PURE__ */ s(`div`,{className:`page-header-bar-meta`,children:j}),A!=null&&/* @__PURE__ */ s(`div`,{className:`page-header-bar-tools`,"data-wui-bar-swap":``,hidden:P&&J>0?!0:void 0,children:A}),P?/* @__PURE__ */ c(`div`,{className:`page-header-bar-bulk`,"data-wui-bar-bulk":``,hidden:J===0||void 0,children:[/* @__PURE__ */ s(`span`,{className:`page-header-bar-bulk-count`,"aria-live":`polite`,children:J>0?`${ne(J,{decimals:0})} selected`:``}),F]}):null,O!=null&&(B?/* @__PURE__ */ s(v,{children:O}):/* @__PURE__ */ s(`div`,{className:`page-actions`,children:O})),j!=null&&G&&/* @__PURE__ */ s(`div`,{className:`page-header-bar-meta`,children:j})]});let Q=w==null?null:typeof w==`string`?/* @__PURE__ */ s(ee,{name:w,size:20}):w,$=S==null?null:/* @__PURE__ */ s(`div`,{className:`page-subtitle`,children:S});return/* @__PURE__ */ c(`div`,{className:q,...f,...H,children:[D!=null&&/* @__PURE__ */ s(`div`,{className:`page-breadcrumbs`,children:D}),/* @__PURE__ */ c(`div`,{className:`page-header-bar`,children:[/* @__PURE__ */ c(`div`,{className:`page-header-lead`,children:[Q!=null&&/* @__PURE__ */ s(`span`,{className:`page-header-icon`,children:Q}),/* @__PURE__ */ c(`div`,{className:`page-header-titles`,children:[C!=null&&/* @__PURE__ */ s(`div`,{className:`page-eyebrow`,children:C}),/* @__PURE__ */ c(`div`,{className:`page-titlebar`,children:[Z,E!=null&&/* @__PURE__ */ s(`span`,{className:`page-status`,children:E}),K&&$]}),!K&&$]})]}),O!=null&&/* @__PURE__ */ s(`div`,{className:`page-actions`,children:O})]})]})}export{y 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/
|
|
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{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./AppIcon.js";import n from"./assertValidValue.js";import r from"./warnUnknownProps.js";import{isTypingTarget as i}from"@webority/ui-elements/helpers";import{useCallback as a,useEffect as o,useRef as s,useState as c}from"react";import{
|
|
1
|
+
import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./AppIcon.js";import n from"./assertValidValue.js";import r from"./warnUnknownProps.js";import{isTypingTarget as i}from"@webority/ui-elements/helpers";import{useCallback as a,useEffect as o,useRef as s,useState as c}from"react";import{flushSync as l}from"react-dom";import{jsx as u,jsxs as d}from"react/jsx-runtime";import{Form as f}from"react-bootstrap";var p=[`sm`,`md`,`lg`];function m(m){let{marker:h,props:g}=e(`AppSearch`,m),{value:_,defaultValue:v,onChange:y,placeholder:b=`Search…`,ariaLabel:x,clearLabel:S=`Clear search`,searchLabel:C=`Search`,iconSize:w,size:T,loading:E=!1,collapsible:D=!1,disabled:O=!1,className:k=``,form:A,onKeyDown:j,...M}=g;r(`AppSearch`,M);let{readOnly:N,...P}=M;n(`AppSearch`,`size`,T,p);let F=w??18,[I,L]=c(v??``),R=_===void 0?I:_,[z,B]=c(!!R),V=s(null),H=s(null),U=!D||z||!!R,W=a(()=>{B(!0),requestAnimationFrame(()=>V.current?.focus())},[]),G=()=>{L(``),l(()=>y?.(``)),V.current?.form?.requestSubmit()};o(()=>{if(!D)return;let e=e=>{e.key!==`/`||e.ctrlKey||e.altKey||e.metaKey||i(e.target instanceof Node?e.target:null)||[...document.querySelectorAll(`.search-wrap.wui-search-collapsible`)].find(e=>e.offsetParent!==null)===H.current&&(e.preventDefault(),W())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[D,W]);let K=[`search-wrap`,R?`has-value`:``,T===`sm`?`search-sm`:T===`lg`?`search-lg`:``,E?`is-loading`:``,D?`wui-search-collapsible`:``,D&&!U?`is-collapsed`:``,k].filter(Boolean).join(` `),q=w==null?void 0:{"--wui-search-icon-size":`${w}px`};return/* @__PURE__ */ d(`div`,{...h,className:K,style:q,ref:H,onBlur:e=>{D&&!e.currentTarget.contains(e.relatedTarget)&&!R&&B(!1)},children:[D&&/* @__PURE__ */ u(`button`,{type:`button`,className:`wui-search-toggle`,"aria-label":x||b||C,"aria-expanded":U?`true`:`false`,onClick:W,children:/* @__PURE__ */ u(t,{name:`search`,size:F})}),E&&/* @__PURE__ */ u(`span`,{className:`search-spinner`,"aria-hidden":`true`}),/* @__PURE__ */ u(t,{name:`search`,size:F,className:`search-icon`}),/* @__PURE__ */ u(f.Control,{ref:V,type:`search`,className:`input search-input`,placeholder:b,value:R,onChange:e=>{L(e.target.value),y?.(e.target.value)},onKeyDown:e=>{j?.(e),D&&e.key===`Escape`&&!R&&B(!1)},"aria-label":x,form:A,disabled:O,...N===void 0?null:{readOnly:N},...P}),!O&&/* @__PURE__ */ u(`button`,{type:`button`,className:`search-clear`,"aria-label":S,onClick:G,hidden:!R,children:/* @__PURE__ */ u(t,{name:`x`,size:16})})]})}export{m as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e,{SECTION_ALIGNS as t,SECTION_HEADINGS as n,SECTION_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}from"@webority/ui-elements/helpers";import{useEffect as S,useId as C,useMemo as w,useRef as T,useState as E}from"react";import{Fragment as D,jsx as O,jsxs as k}from"react/jsx-runtime";var A=()=>import(`@webority/ui-elements/elements/overflow`),j=99,M=4,N=5,P=/^[a-z0-9-]+$/,F=`wui-sidebar-footer`,I=[],L=[`prefix`,`exact`],R=[`comfortable`,`compact`],ee=[`neutral`,`primary`],z=[`side`,`top`],B=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],V=/* @__PURE__ */ new Set([`key`,`label`,`icon`,`iconVariant`,`iconSize`,`href`,`badge`,`badgeTone`,`badgeTitle`,`newUntil`,`trailingIcon`,`active`,`match`,`matchAlso`,`tab`,`tabLabel`,`children`]),H=e=>e>j?`${j}+`:String(e),te=new Intl.DateTimeFormat(`en-CA`,{timeZone:`Asia/Kolkata`}),U=e=>{if(typeof e!=`string`||!/^\d{4}-\d{2}-\d{2}$/.test(e))return!1;let t=/* @__PURE__ */ new Date(`${e}T00:00:00Z`);return Number.isNaN(t.getTime())||t.toISOString().slice(0,10)!==e?!1:te.format(/* @__PURE__ */ new Date)<=e},ne=({logoLight:e,logoDark:t,markLight:n,markDark:r})=>{let i=!!(n||r);return[`app-sidebar-brand`,i&&`wui-brand-has-mark`,i&&!e&&!t&&`wui-brand-mark-only`,(t||r)&&`wui-brand-themed`].filter(Boolean).join(` `)},re=({logoLight:e,logoDark:t,markLight:n,markDark:r,brandName:i})=>{let a=i??``,o=[e&&/* @__PURE__ */ O(`img`,{className:`wui-brand-logo wui-brand-light`,src:e,alt:a},`logo-light`),t&&/* @__PURE__ */ O(`img`,{className:`wui-brand-logo wui-brand-dark`,src:t,alt:``,"aria-hidden":`true`},`logo-dark`)],s=[n&&[`mark-light`,`wui-brand-mark wui-brand-light`,n],r&&[`mark-dark`,`wui-brand-mark wui-brand-dark`,r]].filter(e=>!!e).map(([t,n,r],i)=>i===0&&!e?/* @__PURE__ */ O(`img`,{className:n,src:r,alt:a},t):/* @__PURE__ */ O(`img`,{className:n,src:r,alt:``,"aria-hidden":`true`},t));return[...o,...s].filter(Boolean)};function ie(e){let{marker:t,props:n}=f(`AppShell`,e),{groups:r=[],brand:l,logoLight:u,logoDark:d,markLight:p,markDark:m,brandName:b,brandHref:C,brandLabel:A,sidebarStart:j,sidebarStartCompact:M,sidebarFooter:N,sidebarFooterItems:P=I,topbarStart:F,topbarEnd:L,footer:V,launcher:H,children:te,collapsed:U,onCollapsedChange:ie,noSidebar:W=!1,nav:G=`side`,density:oe=`comfortable`,itemHeight:K,iconVariant:q=`twotone`,topbarTone:J=`neutral`,navLabel:he=`Main navigation`,linkComponent:Y,currentPath:_e,rememberCollapsed:ve=!1,collapsedCookie:ye=`wui-shell-collapsed`,foldedCookie:be=i,tabBarLabel:xe=`Quick navigation`,moreLabel:Se=`More`,skipLabel:Ce=`Skip to content`,openNavLabel:we=`Open navigation`,closeNavLabel:Te=`Close navigation`,expandNavLabel:Ee=`Expand navigation`,collapseNavLabel:De=`Collapse navigation`,newLabel:Oe=`New`,togglePagesLabel:ke=`Show or hide {name} pages`,accountMenuLabel:Ae=`Account menu for {name}`,roleLabel:je=`Role:`,rolesLabel:Me=`Roles:`,unreadLabel:Ne=`Unread`,markAllReadLabel:Pe=`Mark all read`,viewAllLabel:Fe=`View all`,loadingNotificationsText:Ie=`Loading…`,noUnreadText:Le=`No unread notifications`,unreadNotificationsText:Re=`{count} unread notifications`,unreadBellLabel:ze=`{label}, {count} unread`,searchResultsLabel:Be=`Search results`,noResultsText:Ve=`No results`,noResultsForText:He=`No results for “{value}”`,resultsCountText:Ue=`{count} results`,resultCountText:We=`{count} result`,userMenu:Ge,notifications:Ke,search:qe,className:Je=``,style:Ye,...Xe}=n;if(v(`AppShell`,Xe),_(`AppShell`,`density`,oe,R),_(`AppShell`,`topbarTone`,J,ee),_(`AppShell`,`nav`,G,z),_(`AppShell`,`iconVariant`,q,B),A!==void 0&&!C)throw Error(`<AppShell> brandLabel names the brand link, so it needs brandHref.`);if(C){if(!A&&!b)throw Error(`<AppShell> brandHref needs brandLabel or brandName: the collapsed rail hides the logo, so the link would have no accessible name.`);if(!(l||u||d||p||m))throw Error(`<AppShell> brandHref has no brand, logo or mark to link.`)}let Ze=(K??0)>0?{...Ye,"--wui-nav-item-height":`${K}px`}:Ye,[Qe,$e]=E(()=>ve&&U===void 0&&typeof document<`u`?o(ye)??!1:!1),[X,Z]=E(!1),[et,tt]=E(!1),[nt,rt]=E(!1),it=T(null),Q=U??Qe,at=e=>C?/* @__PURE__ */ O(le,{href:C,label:A||b,linkComponent:Y,onNavigate:()=>Z(!1),children:e}):e,ot=()=>{let e=!Q;U===void 0&&$e(e),ve&&c(e,ye),ie?.(e)},st=r.some(e=>e.collapsible),[ct,lt]=E(()=>st&&typeof document<`u`?a(be):/* @__PURE__ */ new Set),ut=e=>{let t=new Set(ct);t.has(e)?t.delete(e):t.add(e),lt(t),s(t,be)},dt=w(()=>ae(r,P,_e),[r,P,_e]),$=dt.groups,ft=dt.footer,pt=W?null:se($,ft.some(e=>e.active));S(()=>{let e=()=>tt(window.scrollY>4);return e(),window.addEventListener(`scroll`,e,{passive:!0}),()=>window.removeEventListener(`scroll`,e)},[]),S(()=>{y()},[]),S(()=>{x(it.current)},[]),S(()=>{let e=it.current;if(!e)return;let t=()=>rt($.length>0&&e.scrollHeight>e.clientHeight);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[$]),S(()=>{if(!X)return;let e=e=>{e.key===`Escape`&&Z(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[X]);let mt=[`app-shell`,Q?`collapsed`:``,W?`no-sidebar`:``,G===`top`?`wui-shell-top`:``,X?`mobile-open`:``,Je].filter(Boolean).join(` `);return/* @__PURE__ */ k(`div`,{className:mt,"data-density":oe===`compact`?`compact`:void 0,"data-wui-folded-cookie":st?be:void 0,style:Ze,...t,...Xe,children:[/* @__PURE__ */ O(`a`,{className:`wui-skip-link`,href:`#main-content`,children:Ce}),/* @__PURE__ */ k(`aside`,{className:`app-sidebar`,children:[(l||u||d||p||m)&&/* @__PURE__ */ O(`div`,{className:ne({logoLight:u,logoDark:d,markLight:p,markDark:m}),children:at(/* @__PURE__ */ k(D,{children:[re({logoLight:u,logoDark:d,markLight:p,markDark:m,brandName:b}),l]}))}),j&&/* @__PURE__ */ O(`div`,{className:`app-sidebar-start`,children:j}),M&&/* @__PURE__ */ O(`div`,{className:`app-sidebar-start-compact`,children:M}),/* @__PURE__ */ O(`nav`,{className:`app-sidebar-scroll`,"aria-label":he,ref:it,tabIndex:nt?0:void 0,children:$.map((e,t)=>{let n=e.items.map(e=>e.header==null?/* @__PURE__ */ O(fe,{item:e,linkComponent:Y,onNavigate:()=>Z(!1),iconVariant:q,newLabel:Oe,togglePagesLabel:ke},e.key??e.href??e.label):/* @__PURE__ */ O(`div`,{className:`wui-nav-header`,children:e.header},e.key??e.header));if(!e.collapsible)return/* @__PURE__ */ k(`div`,{className:`app-nav-group`,children:[e.label&&/* @__PURE__ */ O(`div`,{className:`app-nav-group-label`,children:e.label}),n,e.after&&/* @__PURE__ */ O(`div`,{className:`wui-nav-group-after`,children:e.after})]},e.key??e.label??`group-${t}`);let r=!ct.has(e.key??``)||!!de(e.items),i=`wui-nav-group-${e.key}`;return/* @__PURE__ */ k(`div`,{className:`app-nav-group wui-nav-group-collapsible${r?``:` wui-nav-group-folded`}`,"data-wui-nav-group":e.key,children:[/* @__PURE__ */ k(`button`,{type:`button`,className:`app-nav-group-label wui-nav-group-toggle`,"aria-expanded":r,"aria-controls":i,onClick:()=>ut(e.key??``),children:[/* @__PURE__ */ O(`span`,{className:`wui-nav-group-text`,children:e.label}),/* @__PURE__ */ O(`span`,{className:`wui-nav-group-caret`,children:/* @__PURE__ */ O(h,{name:`chevron-down`,size:16})})]}),/* @__PURE__ */ k(`div`,{className:`wui-nav-group-body`,id:i,children:[n,e.after&&/* @__PURE__ */ O(`div`,{className:`wui-nav-group-after`,children:e.after})]})]},e.key??`group-${t}`)})}),(N||ft.length>0)&&/* @__PURE__ */ k(`div`,{className:`app-sidebar-foot`,children:[ft.length>0&&/* @__PURE__ */ O(`div`,{className:`wui-sidebar-foot-links`,children:ft.map(e=>/* @__PURE__ */ O(fe,{item:e,linkComponent:Y,onNavigate:()=>Z(!1),iconVariant:q,newLabel:Oe,togglePagesLabel:ke},e.key??e.href??e.label))}),N]}),!W&&/* @__PURE__ */ O(`button`,{type:`button`,className:`app-sidebar-toggle`,onClick:ot,"aria-label":Q?Ee:De,"aria-expanded":!Q,children:/* @__PURE__ */ O(h,{name:`chevrons-left`,size:20})})]}),/* @__PURE__ */ k(`div`,{className:`app-main`,children:[/* @__PURE__ */ k(`header`,{className:`app-topbar${et?` scrolled`:``}`,"data-tone":J===`primary`?`primary`:void 0,children:[/* @__PURE__ */ k(`div`,{className:`app-topbar-start`,children:[/* @__PURE__ */ O(`button`,{type:`button`,className:`app-topbar-menu`,onClick:()=>Z(!0),"aria-label":we,"aria-expanded":X,children:/* @__PURE__ */ O(h,{name:`menu`,size:18})}),G===`top`&&l&&/* @__PURE__ */ O(`div`,{className:`wui-shell-top-brand`,children:at(l)}),G===`top`&&/* @__PURE__ */ O(`div`,{className:`wui-shell-top-nav`,children:/* @__PURE__ */ O(g,{items:ce($),ariaLabel:he,linkComponent:Y})}),F,qe&&/* @__PURE__ */ O(ge,{config:qe,searchResultsLabel:Be,noResultsText:Ve,noResultsForText:He,resultsCountText:Ue,resultCountText:We,moreLabel:Se})]}),/* @__PURE__ */ k(`div`,{className:`app-topbar-end`,children:[L,Ke&&/* @__PURE__ */ O(me,{config:Ke,unreadLabel:Ne,markAllReadLabel:Pe,viewAllLabel:Fe,loadingNotificationsText:Ie,noUnreadText:Le,unreadNotificationsText:Re,unreadBellLabel:ze}),Ge&&/* @__PURE__ */ O(pe,{config:Ge,linkComponent:Y,accountMenuLabel:Ae,roleLabel:je,rolesLabel:Me})]})]}),/* @__PURE__ */ O(`main`,{className:`app-content`,id:`main-content`,children:te}),V&&/* @__PURE__ */ O(`footer`,{className:`app-footer`,children:V})]}),H&&/* @__PURE__ */ O(`div`,{className:`wui-shell-launcher`,children:H}),pt&&/* @__PURE__ */ k(`nav`,{className:`wui-tabbar`,"aria-label":xe,children:[pt.tabs.map(e=>/* @__PURE__ */ O(ue,{tab:e,linkComponent:Y,iconVariant:q},e.key??e.href)),pt.hasMore&&/* @__PURE__ */ k(`button`,{type:`button`,className:`wui-tabbar-item${pt.moreActive?` active`:``}`,onClick:()=>Z(!0),children:[/* @__PURE__ */ O(`span`,{className:`wui-tabbar-icon`,children:/* @__PURE__ */ O(h,{name:`more`,size:24})}),/* @__PURE__ */ O(`span`,{className:`wui-tabbar-label`,children:Se})]})]}),/* @__PURE__ */ O(`button`,{type:`button`,className:`app-scrim`,onClick:()=>Z(!1),"aria-label":Te,tabIndex:X?0:-1})]})}function ae(e,t,n){let i=t;for(let e of i){if(e.children?.length)throw Error(`<AppShell> sidebarFooterItems cannot hold children; keep footer links flat.`);if(e.tab)throw Error(`<AppShell> sidebarFooterItems cannot carry tab: true; the phone tab bar is built from groups.`);if(e.header!=null)throw Error(`<AppShell> sidebarFooterItems cannot hold a header row.`)}for(let t of e)t.collapsible&&q(t);let a=(e,t=!1)=>(e??[]).map(e=>Array.isArray(e.children)?{...e,children:a(e.children)}:{...e}).filter(e=>G(e)?t:(e.children?.length??0)>0||!!e.href),o=[...e,{key:F,items:t}].map(e=>({...e,items:oe(a(e.items,!0))})).filter(e=>e.items.some(e=>!G(e))),s=[],c=e=>{for(let t of e)G(t)||(s.push(t),t.children&&c(t.children))};for(let e of o)c(e.items);for(let e of s)v(`AppShell items`,W(e)),_(`AppShell`,`match`,e.match,L),_(`AppShell`,`iconVariant`,e.iconVariant,B),_(`AppShell`,`badgeTone`,e.badgeTone,d);let l=null;if(n!=null&&!s.some(e=>e.active===!0)){let e=-1;for(let t of s){if(t.active!=null||t.children?.length&&!t.href)continue;let i=r(n,t.href,{exact:t.match===`exact`,also:t.matchAlso});if(i<0)continue;let a=t.match===`exact`&&r(n,t.href,{exact:!0})>=0?1/0:i;a>e&&(e=a,l=t)}}for(let e of s)e.active=e.active??e===l;return{groups:o.filter(e=>e.key!==F),footer:o.find(e=>e.key===F)?.items??[]}}function W(e){return Object.fromEntries(Object.entries(e).filter(([e])=>!V.has(e)))}var G=e=>e.header!=null;function oe(e){return e.filter((t,n)=>{if(!G(t))return!0;let r=e.findIndex((e,t)=>t>n&&G(e));return e.slice(n+1,r<0?void 0:r).length>0})}var K=/* @__PURE__ */ new Set;function q(t){if(t.key!=null&&P.test(t.key))return;let n=t.key==null?`<AppShell> a collapsible group needs a key so its folded state can be remembered.`:`<AppShell> collapsible group key "${t.key}" must use lower-case letters, digits and hyphens.`;typeof process<`u`&&process.env.NODE_ENV===`production`||K.has(n)||(K.add(n),e(n))}function se(e,t){let n=[],r=e=>{for(let t of e)G(t)||(t.children?.length?r(t.children):n.push(t))};for(let t of e)r(t.items);let i=n.filter(e=>e.tab);if(i.length===0)return null;let a=i.length<n.length,o=a?M:N;if(i.length>o)throw Error(`<AppShell>: ${i.length} items carry tab: true, but the phone tab bar holds ${o} (${a?`4 plus More, because other items exist`:`5 when every item is a tab`}). Flag fewer items.`);return{tabs:i,hasMore:a,moreActive:t||n.some(e=>!e.tab&&e.active)}}function ce(e){let t=e=>{if(e.label===void 0)throw Error(`<AppShell> a navigation row has no label; every row but a header needs one.`);return e.label},n=e=>e.key??e.href??t(e),r=(e,r)=>({key:n(e),label:t(e),to:r,current:!!e.active}),i=e=>e.flatMap(e=>G(e)?[]:[...e.href?[{...r(e,e.href),icon:e.icon}]:[],...i(e.children??[])]),a=[];for(let o of e.flatMap(e=>e.items)){if(G(o))continue;let e=i(o.children??[]);if(e.length>0){let i=o.href?[{...r(o,o.href),icon:o.icon}]:[];a.push({key:n(o),label:t(o),links:[...i,...e]})}else o.href&&a.push(r(o,o.href))}return a}function le({href:e,label:t,linkComponent:r,onNavigate:i,children:a}){return/* @__PURE__ */ O(l,{link:n(r,{to:e}),className:`wui-brand-link`,"aria-label":t,onClick:i,children:a})}function ue({tab:e,linkComponent:t,iconVariant:r}){let i=`wui-tabbar-item${e.active?` active`:``}`,a=/* @__PURE__ */ k(D,{children:[e.icon&&/* @__PURE__ */ O(`span`,{className:`wui-tabbar-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ O(h,{name:e.icon,size:24,variant:e.iconVariant??r}):e.icon}),/* @__PURE__ */ O(`span`,{className:`wui-tabbar-label`,children:e.tabLabel??e.label}),e.badge!=null&&/* @__PURE__ */ O(`span`,{className:`wui-tabbar-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:e.badge})]}),o=e.active?`page`:void 0;return/* @__PURE__ */ O(l,{link:n(t,{to:e.href}),className:i,"aria-current":o,children:a})}function de(e){for(let t of e){if(t.active)return t;let e=t.children?.length?de(t.children):void 0;if(e)return e}}function fe({item:e,linkComponent:r,onNavigate:i,depth:a=0,iconVariant:o,newLabel:s,togglePagesLabel:c}){let u=a>0,d=a>1?` wui-nav-depth-${Math.min(a,6)}`:``,f=Array.isArray(e.children)&&e.children.length>0,p=f?de(e.children??[]):void 0,m=!!p,g=p?p.key??p.href??p.label:null,[_,v]=E(m);S(()=>{g!=null&&v(!0)},[g]);let y=typeof e.label==`string`?e.label:void 0,b=!u&&e.icon&&/* @__PURE__ */ O(`span`,{className:`app-nav-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ O(h,{name:e.icon,size:e.iconSize??22,variant:e.iconVariant??o}):e.icon}),x=e.badge!=null&&/* @__PURE__ */ O(`span`,{className:`app-nav-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:e.badge}),C=U(e.newUntil)&&/* @__PURE__ */ O(`span`,{className:`wui-nav-new`,children:s}),w=/* @__PURE__ */ k(D,{children:[b,/* @__PURE__ */ O(`span`,{className:`app-nav-text`,children:e.label}),C,x,e.trailingIcon&&/* @__PURE__ */ O(`span`,{className:`app-nav-trailing`,children:typeof e.trailingIcon==`string`?/* @__PURE__ */ O(h,{name:e.trailingIcon,size:16}):e.trailingIcon})]}),T=e.active?`page`:void 0;if(f){let f=/* @__PURE__ */ O(`div`,{className:`app-nav-sub${_?` expanded`:``}`,inert:!_,"aria-hidden":!_||void 0,children:/* @__PURE__ */ O(`div`,{className:`app-nav-sub-inner`,children:(e.children??[]).map(e=>/* @__PURE__ */ O(fe,{item:e,linkComponent:r,onNavigate:i,depth:a+1,iconVariant:o,newLabel:s,togglePagesLabel:c},e.key??e.href))})});if(e.href){let a=/* @__PURE__ */ O(l,{link:n(r,{to:e.href}),className:`wui-nav-split-link`,"aria-current":T,onClick:i,children:w});return/* @__PURE__ */ k(D,{children:[/* @__PURE__ */ k(`div`,{className:`app-nav-item has-children wui-nav-split${u?` app-nav-subitem`:``}${m||e.active?` active`:``}${d}`,"data-label":y,children:[a,/* @__PURE__ */ O(`button`,{type:`button`,className:`app-nav-caret wui-nav-split-toggle`,"aria-expanded":_,"aria-label":t(c,{name:y??``}),onClick:()=>v(e=>!e),children:/* @__PURE__ */ O(h,{name:`chevron-right`,size:16})})]}),f]})}return/* @__PURE__ */ k(D,{children:[/* @__PURE__ */ k(`button`,{type:`button`,className:`app-nav-item${u?` app-nav-subitem`:``} has-children${m?` active`:``}${d}`,"aria-expanded":_,"data-label":y,onClick:()=>v(e=>!e),children:[b,/* @__PURE__ */ O(`span`,{className:`app-nav-text`,children:e.label}),C,x,/* @__PURE__ */ O(`span`,{className:`app-nav-caret`,children:/* @__PURE__ */ O(h,{name:`chevron-right`,size:16})})]}),f]})}let A=`app-nav-item${u?` app-nav-subitem`:``}${e.active?` active`:``}${d}`;return/* @__PURE__ */ O(l,{link:n(r,{to:e.href}),className:A,"aria-current":T,"data-label":y,onClick:i,children:w})}function J(){let[e,t]=E(!1),n=T(null);return S(()=>{if(!e)return;let r=e=>{n.current?.contains(e.target instanceof Node?e.target:null)||t(!1)},i=e=>{e.key===`Escape`&&(t(!1),n.current?.querySelector(`button`)?.focus())};return document.addEventListener(`mousedown`,r),document.addEventListener(`keydown`,i),()=>{document.removeEventListener(`mousedown`,r),document.removeEventListener(`keydown`,i)}},[e]),{open:e,setOpen:t,ref:n}}function pe({config:e,linkComponent:r,accountMenuLabel:i,roleLabel:a,rolesLabel:o}){let s=C(),{open:c,setOpen:u,ref:d}=J(),{name:f,role:g,roles:v=[],noTriggerRole:y=!1,photo:b,profileHref:x,profileLabel:S=`My profile`,onLogout:w,logoutAction:T,logoutLabel:E=`Sign out`,head:A,section:j,logoutVariant:M=`item`,items:N=[]}=e;if(_(`AppShell`,`userMenu.logoutVariant`,M,[`item`,`button`]),!f)throw Error(`<AppShell> userMenu.name is required; the trigger and the avatar are named from it.`);let P=v.map(e=>(e??``).trim()).filter(Boolean),F=()=>u(!1),I=(e,t,i,a)=>/* @__PURE__ */ O(l,{link:n(r,{to:e}),className:`dropdown-item`,onClick:a,children:t},i),L=/* @__PURE__ */ O(h,{name:`log-out`,size:18}),R=/* @__PURE__ */ k(D,{children:[L,E]});return/* @__PURE__ */ k(`div`,{className:`dropdown wui-usermenu`,ref:d,children:[/* @__PURE__ */ k(`button`,{type:`button`,id:s,className:`wui-usermenu-trigger`,"aria-expanded":c,"aria-label":t(i,{name:f}),onClick:()=>u(e=>!e),children:[/* @__PURE__ */ O(p,{name:f,src:b,tone:`auto`}),/* @__PURE__ */ k(`span`,{className:`wui-usermenu-text`,children:[/* @__PURE__ */ O(`span`,{className:`wui-usermenu-name`,children:f}),g&&!y&&/* @__PURE__ */ O(`span`,{className:`wui-usermenu-role`,children:g})]}),/* @__PURE__ */ O(h,{name:`chevron-down`,size:14,className:`wui-usermenu-caret`})]}),/* @__PURE__ */ k(`div`,{className:`dropdown-menu dropdown-menu-end wui-usermenu-menu${c?` show`:``}`,"aria-labelledby":s,"data-bs-popper":c?`static`:void 0,children:[/* @__PURE__ */ k(`div`,{className:`wui-usermenu-head`,children:[/* @__PURE__ */ O(p,{name:f,src:b,size:`lg`,tone:`auto`}),/* @__PURE__ */ k(`div`,{className:`wui-usermenu-who`,children:[/* @__PURE__ */ O(`div`,{className:`wui-usermenu-name`,children:f}),g&&/* @__PURE__ */ O(`div`,{className:`wui-usermenu-role`,children:g}),P.length>0&&/* @__PURE__ */ k(`div`,{className:`wui-usermenu-roles`,children:[/* @__PURE__ */ O(`span`,{className:`wui-usermenu-roles-label`,children:P.length===1?a:o}),` ${P.join(`, `)}`]}),A?/* @__PURE__ */ O(`div`,{className:`wui-usermenu-extra`,children:A}):null]})]}),j?/* @__PURE__ */ O(`div`,{className:`wui-usermenu-section`,children:j}):null,x&&I(x,/* @__PURE__ */ k(D,{children:[/* @__PURE__ */ O(h,{name:`user`,size:18}),S]}),void 0,F),N.map(e=>{if(e.divider)return/* @__PURE__ */ O(`hr`,{className:`dropdown-divider`},e.key);let t=/* @__PURE__ */ k(D,{children:[e.icon&&/* @__PURE__ */ O(h,{name:e.icon,size:18}),e.label]}),n=()=>{e.onClick?.(),F()};return e.href?I(e.href,t,e.key,n):/* @__PURE__ */ O(`button`,{type:`button`,className:`dropdown-item`,onClick:n,children:t},e.key)}),M===`button`?(T||w)&&/* @__PURE__ */ O(`div`,{className:`wui-usermenu-foot`,children:T?/* @__PURE__ */ O(`form`,{method:`post`,action:T,className:`wui-usermenu-logout`,children:/* @__PURE__ */ O(m,{type:`submit`,tone:`danger`,variant:`soft`,block:!0,leftIcon:L,children:E})}):/* @__PURE__ */ O(m,{type:`button`,tone:`danger`,variant:`soft`,block:!0,leftIcon:L,onClick:()=>{F(),w?.()},children:E})}):T?/* @__PURE__ */ O(`form`,{method:`post`,action:T,className:`wui-usermenu-logout`,children:/* @__PURE__ */ O(`button`,{type:`submit`,className:`dropdown-item danger`,children:R})}):w&&/* @__PURE__ */ O(`button`,{type:`button`,className:`dropdown-item danger`,onClick:()=>{F(),w()},children:R})]})]})}function me({config:e,unreadLabel:n,markAllReadLabel:r,viewAllLabel:i,loadingNotificationsText:a,noUnreadText:o,unreadNotificationsText:s,unreadBellLabel:c}){let l=C(),{open:u,setOpen:d,ref:f}=J(),{unread:p=0,items:m,loading:g=!1,onOpen:_,onMarkAllRead:v,viewAllHref:y,label:b=`Notifications`,emptyText:x=`You are all caught up.`}=e,[w,A]=E(``),j=T(p);S(()=>{j.current!==p&&(j.current=p,A(p===0?o:t(s,{count:H(p)})))},[p,o,s]);let M=null;return m?.length?M=/* @__PURE__ */ O(`div`,{className:`wui-bell-items`,children:m.map((e,t)=>{let r=`wui-bell-item${e.read?` wui-bell-item-read`:``}`,i=/* @__PURE__ */ k(D,{children:[/* @__PURE__ */ O(`span`,{className:`wui-bell-dot`,"aria-hidden":`true`}),e.icon&&/* @__PURE__ */ O(`span`,{className:`wui-bell-icon`,children:/* @__PURE__ */ O(h,{name:e.icon,size:18})}),/* @__PURE__ */ k(`span`,{className:`wui-bell-body`,children:[!e.read&&/* @__PURE__ */ k(`span`,{className:`visually-hidden`,children:[n,`: `]}),/* @__PURE__ */ O(`span`,{className:`wui-bell-item-title`,children:e.title}),e.time&&/* @__PURE__ */ O(`span`,{className:`wui-bell-when`,children:e.time})]})]});return e.href?/* @__PURE__ */ O(`a`,{className:r,href:e.href,"data-id":e.id,children:i},e.id??t):/* @__PURE__ */ O(`div`,{className:r,"data-id":e.id,children:i},e.id??t)})}):g?M=/* @__PURE__ */ O(`div`,{className:`wui-bell-state`,children:a}):m&&(M=/* @__PURE__ */ O(`div`,{className:`wui-bell-state`,children:x})),/* @__PURE__ */ k(`div`,{className:`dropdown wui-bell`,ref:f,children:[/* @__PURE__ */ k(`button`,{type:`button`,id:l,className:`topbar-icon-btn wui-bell-trigger`,"aria-expanded":u,"aria-label":p===0?b:t(c,{label:b,count:H(p)}),onClick:()=>{let e=!u;d(e),e&&_?.()},children:[/* @__PURE__ */ O(h,{name:`notification`,size:20}),/* @__PURE__ */ O(`span`,{className:`wui-bell-count`,"aria-hidden":`true`,hidden:p===0,children:H(p)})]}),/* @__PURE__ */ O(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:w}),/* @__PURE__ */ k(`div`,{className:`dropdown-menu dropdown-menu-end wui-bell-menu${u?` show`:``}`,"aria-labelledby":l,"data-bs-popper":u?`static`:void 0,children:[/* @__PURE__ */ k(`div`,{className:`wui-bell-head`,children:[/* @__PURE__ */ O(`span`,{className:`wui-bell-title`,children:b}),v&&/* @__PURE__ */ O(`button`,{type:`button`,className:`wui-bell-markall`,onClick:v,children:r})]}),/* @__PURE__ */ O(`div`,{className:`wui-bell-list`,"aria-busy":g||void 0,children:M}),y&&/* @__PURE__ */ O(`a`,{className:`wui-bell-foot`,href:y,children:i})]})]})}var he=e=>!!e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName));function ge({config:e,searchResultsLabel:n,noResultsText:r,noResultsForText:i,resultsCountText:a,resultCountText:o,moreLabel:s}){u(`wui-overflow`,A);let c=C(),{value:l=``,onChange:d,results:f=null,loading:p=!1,onSelect:m,onSubmit:g,onFocus:_,placeholder:v=`Search`}=e,[y,x]=E(!1),[D,j]=E(!1),[M,N]=E({results:null,index:-1}),P=M.results===f?M.index:-1,F=e=>N({results:f,index:e}),I=T(null),L=T(null),R=T([]),ee=w(()=>(f??[]).flatMap(e=>e.hits??[]),[f]),z=f!=null&&!D,B=ee.length;S(()=>{let e=e=>{e.key!==`/`||e.ctrlKey||e.metaKey||e.altKey||he(e.target instanceof HTMLElement?e.target:null)||(e.preventDefault(),x(!0),L.current?.focus())},t=e=>{I.current?.contains(e.target instanceof Node?e.target:null)||(j(!0),x(!1))};return document.addEventListener(`keydown`,e),document.addEventListener(`pointerdown`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`pointerdown`,t)}},[]);let V=e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(!z||B===0)return;e.preventDefault(),F((P+(e.key===`ArrowDown`?1:-1)+B)%B)}else b(e.nativeEvent)?z&&P>=0&&R.current[P]?(e.preventDefault(),R.current[P].click()):g&&l.trim()!==``&&(e.preventDefault(),g(l.trim())):e.key===`Escape`&&(z?(e.preventDefault(),j(!0)):y&&(e.preventDefault(),x(!1)))},H=-1;return R.current=[],/* @__PURE__ */ O(`wui-overflow`,{class:`wui-topsearch-host`,label:s,children:/* @__PURE__ */ O(`div`,{"data-wui-overflow-list":!0,className:`wui-topsearch-row`,children:/* @__PURE__ */ k(`div`,{className:`wui-topsearch${y?` is-open`:``}${p?` is-loading`:``}`,ref:I,"data-overflow-label":v,children:[/* @__PURE__ */ O(`button`,{type:`button`,className:`topbar-icon-btn wui-topsearch-open`,"aria-label":v,"aria-expanded":y,"aria-controls":`${c}-panel`,onClick:()=>{let e=!y;x(e),e&&L.current?.focus()},children:/* @__PURE__ */ O(h,{name:`search`,size:20})}),/* @__PURE__ */ k(`div`,{className:`wui-topsearch-panel`,id:`${c}-panel`,children:[/* @__PURE__ */ k(`div`,{className:`search-wrap`,children:[/* @__PURE__ */ O(h,{name:`search`,size:18,className:`search-icon`}),/* @__PURE__ */ O(`input`,{ref:L,type:`search`,className:`form-control input search-input`,id:`${c}-input`,placeholder:v,"aria-label":v,role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":z,"aria-controls":`${c}-list`,"aria-activedescendant":z&&P>=0?`${c}-opt-${P}`:void 0,autoComplete:`off`,value:l,onChange:e=>{j(!1),d?.(e.target.value)},onKeyDown:V,onFocus:_})]}),/* @__PURE__ */ O(`div`,{className:`wui-topsearch-results`,id:`${c}-list`,role:`listbox`,"aria-label":n,hidden:!z,children:z&&/* @__PURE__ */ k(`div`,{className:`wui-topsearch-groups`,role:`presentation`,children:[B===0&&/* @__PURE__ */ O(`div`,{className:`wui-topsearch-empty`,role:`option`,"aria-disabled":`true`,"aria-selected":`false`,children:t(i,{value:l})}),f.filter(e=>e.hits?.length).map((e,t)=>/* @__PURE__ */ k(`div`,{className:`wui-topsearch-group`,role:`group`,"aria-label":e.label??``,children:[e.label&&/* @__PURE__ */ O(`div`,{className:`wui-topsearch-group-label`,role:`presentation`,children:e.label}),e.hits.map(e=>{H+=1;let t=H;return/* @__PURE__ */ k(`a`,{className:`wui-topsearch-hit${t===P?` is-active`:``}`,role:`option`,"aria-selected":t===P,id:`${c}-opt-${t}`,href:e.href,ref:e=>{R.current[t]=e},onClick:t=>m?.(e,t),children:[e.icon&&/* @__PURE__ */ O(`span`,{className:`wui-topsearch-hit-icon`,children:/* @__PURE__ */ O(h,{name:e.icon,size:18})}),/* @__PURE__ */ k(`span`,{className:`wui-topsearch-hit-text`,children:[/* @__PURE__ */ O(`span`,{className:`wui-topsearch-hit-title`,children:e.title}),e.subtitle&&/* @__PURE__ */ O(`span`,{className:`wui-topsearch-hit-sub`,children:e.subtitle})]})]},`${e.href}-${t}`)})]},e.label??t))]})})]}),/* @__PURE__ */ O(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:z?B===0?r:t(B===1?o:a,{count:B}):``})]})})})}export{ie as default};
|
|
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/fillLabel.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./warnUnknownProps.js";import{jsx as i}from"react/jsx-runtime";var a=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}},o=!1;function s(t){!o&&a()&&(o=!0,e(`[@webority/ui-react] <AppSparkline> left out ${t} value(s) in \`data\` that are not finite numbers.`))}var c=e=>typeof e==`number`&&Number.isFinite(e);function l(e,t,n){if(e.length<2)return`0,${n/2} ${t},${n/2}`;let r
|
|
1
|
+
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/fillLabel.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./warnUnknownProps.js";import{jsx as i}from"react/jsx-runtime";var a=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}},o=!1;function s(t){!o&&a()&&(o=!0,e(`[@webority/ui-react] <AppSparkline> left out ${t} value(s) in \`data\` that are not finite numbers.`))}var c=e=>typeof e==`number`&&Number.isFinite(e);function l(e,t,n,r){if(e.length<2)return`0,${n/2} ${t},${n/2}`;let i=r===void 0?Math.min(...e):Math.min(r,...e),a=Math.max(...e)-i,o=t/(e.length-1);return e.map((e,t)=>{let r=a===0?n/2:n-(e-i)/a*n;return`${t*o},${r}`}).join(` `)}var u=e=>String(Number(e.toFixed(2)));function d(e,n,r){let i=n?t(r.namedTrendLabel,{label:n}):r.trendLabel;return e.length===1?t(r.oneValueText,{name:i,value:u(e[0]??0)}):t(r.rangeText,{name:i,from:u(e[0]??0),to:u(e[e.length-1]??0),count:e.length})}function f(e){let{marker:t,props:a}=n(`AppSparkline`,e),{data:o,label:u,width:f=48,height:p=16,className:m=``,trendLabel:h=`Trend`,namedTrendLabel:g=`{label} trend`,oneValueText:_=`{name} has one value, {value}.`,rangeText:v=`{name} from {from} to {to} across {count} points.`,yMin:y,...b}=a;r(`AppSparkline`,b);let x=Array.isArray(o)?o.filter(c):[];if(Array.isArray(o)&&x.length<o.length&&s(o.length-x.length),x.length===0)return null;let S={trendLabel:h,namedTrendLabel:g,oneValueText:_,rangeText:v};return/* @__PURE__ */ i(`svg`,{className:`wui-sparkline${m?` ${m}`:``}`,width:f,height:p,viewBox:`0 0 ${f} ${p}`,role:`img`,"aria-label":d(x,u,S),...t,...b,children:/* @__PURE__ */ i(`polyline`,{points:l(x,f,p,y),stroke:`currentColor`,fill:`none`})})}export{f 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{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./AppActionIcon.js";import n from"./AppSegmented.js";import r from"./assertValidValue.js";import i from"./warnUnknownProps.js";import{DEFAULT_THEME_EFFECT as a,DEFAULT_THEME_STORAGE_KEY as o,THEME_CHANGE_EVENT as s,THEME_EFFECTS as c,THEME_MODES as l,applyTheme as u,nextTheme as d,readStoredTheme as f,resolveTheme as p,storeTheme as m,transitionTheme as h,watchSystemTheme as g}from"@webority/ui-elements/helpers";import{useCallback as _,useEffect as v,useId as y,useRef as b,useState as x}from"react";import{
|
|
1
|
+
import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./AppActionIcon.js";import n from"./AppSegmented.js";import r from"./assertValidValue.js";import i from"./warnUnknownProps.js";import{DEFAULT_THEME_EFFECT as a,DEFAULT_THEME_STORAGE_KEY as o,THEME_CHANGE_EVENT as s,THEME_EFFECTS as c,THEME_MODES as l,applyTheme as u,nextTheme as d,readStoredTheme as f,resolveTheme as p,storeTheme as m,transitionTheme as h,watchSystemTheme as g}from"@webority/ui-elements/helpers";import{useCallback as _,useEffect as v,useId as y,useRef as b,useState as x}from"react";import{flushSync as S}from"react-dom";import{jsx as C}from"react/jsx-runtime";function w(e){return l.some(t=>t===e)}var T={light:`sun`,dark:`moon`,auto:`monitor`},E={light:`light`,dark:`dark`,auto:`follows your device`},D=[`icon`,`segmented`],O={sm:16,md:20,lg:24,xl:28};function k(l){let{marker:k,props:A}=e(`AppThemeToggle`,l),{variant:j=`icon`,effect:M=a,includeAuto:N=!0,storageKey:P=o,duration:F,label:I=`Theme`,lightLabel:L=`Light`,darkLabel:R=`Dark`,autoLabel:z=`System`,name:B,size:V=`md`,tooltipPlacement:H=`auto`,onChange:U,className:W=``,...G}=A;i(`AppThemeToggle`,G),r(`AppThemeToggle`,`variant`,j,D),r(`AppThemeToggle`,`effect`,M,c),r(`AppThemeToggle`,`size`,V,Object.keys(O));let K=_(e=>e===`auto`&&!N?p(e):e,[N]),[q,J]=x(()=>K(typeof window>`u`?`auto`:f(P))),Y=y(),X=B||Y,Z=b({shown:K,storageKey:P});v(()=>{let e=document.documentElement.getAttribute(`data-theme`);w(e)?J(Z.current.shown(e)):u(f(Z.current.storageKey))},[]),v(()=>{let e=e=>{if(!(e instanceof CustomEvent))throw Error(`wui:theme:change arrived without a CustomEvent`);let t=`detail`in e?e.detail:void 0,n=typeof t==`object`&&t&&`preference`in t?t.preference:void 0;w(n)&&J(K(n))};return document.addEventListener(s,e),()=>document.removeEventListener(s,e)},[K]),v(()=>g(()=>{document.documentElement.getAttribute(`data-theme`)===`auto`&&u(`auto`)}),[]);let Q=_((e,t)=>{let n=t?.getBoundingClientRect?.()??{left:0,top:0,width:0,height:0},r={x:n.left+n.width/2,y:n.top+n.height/2};h(()=>{u(e),m(e,P),S(()=>J(e)),U?.(e)},{effect:M,to:p(e),origin:r,...F===void 0?null:{duration:F}})},[P,M,F,U]);if(j===`segmented`){let e=[{value:`light`,label:L,icon:T.light},{value:`dark`,label:R,icon:T.dark}];return N&&e.push({value:`auto`,label:z,icon:T.auto}),/* @__PURE__ */ C(n,{...k,options:e,value:q,name:X,label:I,size:V===`xl`?`lg`:V,className:[`wui-theme-toggle`,`wui-theme-toggle-segmented`,W].filter(Boolean).join(` `),onChange:e=>{if(!w(e)||e===q)return;let t=document.querySelector(`.segmented-input[name="${CSS.escape(X)}"][value="${e}"]`);Q(e,t?.closest(`.segmented-option`)??t)}})}return/* @__PURE__ */ C(t,{...k,icon:T[q],label:`${I}: ${E[q]}`,size:O[V]??O.md,tooltipPlacement:H,onClick:e=>Q(d(q,{includeAuto:N}),e.currentTarget),className:[`wui-theme-toggle`,W].filter(Boolean).join(` `)})}export{k as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import 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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{devWarn as e}from"../lib/devWarn.js";import{
|
|
1
|
+
import{devWarn as e}from"../lib/devWarn.js";import{useOverlayRoot as t}from"../lib/useOverlayRoot.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppIcon.js";import i from"./assertValidValue.js";import{TOAST_ANIMATIONS as a,TOAST_SHAPES as o,TOAST_SURFACES as s,adoptToast as c,dismissToast as l,subscribeToasts as u}from"./toastStore.js";import d from"./warnUnknownProps.js";import{raisePopover as f}from"@webority/ui-elements/helpers";import{useEffect as p,useRef as m,useState as h}from"react";import{createPortal as g}from"react-dom";import{jsx as _,jsxs as v}from"react/jsx-runtime";var y={success:{icon:`check-circle`,assertive:!1},info:{icon:`info`,assertive:!1},warning:{icon:`alert-triangle`,assertive:!0},danger:{icon:`alert-circle`,assertive:!0}},b=e=>Object.keys(y).includes(e),x={"top-start":`top-0 start-0`,"top-center":`top-0 start-50 translate-middle-x`,"top-end":`top-0 end-0`,"middle-center":`top-50 start-50 translate-middle`,"bottom-start":`bottom-0 start-0`,"bottom-center":`bottom-0 start-50 translate-middle-x`,"bottom-end":`bottom-0 end-0`},S=64;function C(r){let{marker:c,props:l}=n(`AppToast`,r),{position:y=`bottom-end`,maxVisible:b=4,animation:S=`rise`,shape:C=`rounded`,surface:T=`auto`,offset:E,closeLabel:D=`Close`,className:O=``,...k}=l;d(`AppToast`,k),i(`AppToast`,`position`,y,Object.keys(x)),i(`AppToast`,`animation`,S,a),i(`AppToast`,`shape`,C,o),i(`AppToast`,`surface`,T,s);let[A,j]=h([]);p(()=>u(j),[]);let M=t(),N=m(null);p(()=>{let e=N.current;M&&e&&A.length!==0&&e.isConnected&&f(e)},[A,M]);let P=typeof E==`number`&&Number.isFinite(E)&&E>=0;p(()=>{E==null||P||e(`[@webority/ui-react] <AppToast> received offset="${String(E)}", which must be a number of pixels, 0 or more. The default offset is used instead.`)},[E,P]);let{style:F,...I}=k,L={"--wui-toast-offset":`${E}px`},R=P?{...L,...F}:F,z=Math.max(0,A.length-b),B=z?A.slice(z):A,V=x[y]??x[`bottom-end`];return M?g(/* @__PURE__ */ v(`div`,{...c,...I,ref:N,popover:`manual`,style:R,className:`wui-toast-container toast-container position-fixed ${V} p-3 ${O}`.trim(),children:[z>0&&/* @__PURE__ */ v(`div`,{className:`wui-toast-more`,"aria-hidden":`true`,children:[`+`,z,` more`]}),B.map(e=>/* @__PURE__ */ _(w,{toast:e,defaultAnimation:S,defaultShape:C,defaultSurface:T,closeLabel:D},e.id))]}),M):null}function w({toast:e,defaultAnimation:t=`rise`,defaultShape:n=`rounded`,defaultSurface:i=`auto`,closeLabel:a=`Close`}){if(!b(e.variant))throw Error(`<AppToast> has no tone for the variant "${e.variant}".`);let o=y[e.variant],s=e.animation??t,u=e.shape??n,d=e.surface??i,f=(s===`rise`?``:` wui-toast--anim-${s}`)+(u===`rounded`?``:` wui-toast--shape-${u}`)+(d===`inverse`?` wui-toast--surface-inverse`:``),g=e.duration===0,[x,C]=h(0),[w,T]=h(!1),E=m(null),D=()=>l(e.id),O=m(null);p(()=>{if(e.duration===0)return;c(e.id);let t=O.current,n=t==null?``:getComputedStyle(t).animationName;if(t!=null&&(typeof t.getAnimations==`function`?t.getAnimations().length>0:n!==``&&n!==`none`))return;let r=setTimeout(()=>l(e.id),e.duration);return()=>clearTimeout(r)},[e.id,e.duration]);let k=e=>{if(e.button===0){if(!(e.target instanceof Element))throw Error(`<AppToast> received a pointer event whose target is not an element.`);e.target.closest(`button`)||(E.current=e.clientX,T(!0),e.currentTarget.setPointerCapture?.(e.pointerId))}},A=e=>{E.current!==null&&C(e.clientX-E.current)},j=()=>{E.current=null,T(!1),C(0)},M=e=>{if(E.current===null)return;let t=e.clientX-E.current;Math.abs(t)>S?D():j()},N=x?{transform:`translateX(${x}px)`,opacity:Math.max(0,1-Math.abs(x)/200)}:void 0,P=e.message;return/* @__PURE__ */ v(`div`,{className:`toast show wui-toast wui-toast--${e.variant}${f}${w?` wui-toast--dragging`:``}`,role:o.assertive?`alert`:`status`,"aria-live":o.assertive?`assertive`:`polite`,"aria-atomic":`true`,style:N,onPointerDown:k,onPointerMove:A,onPointerUp:M,onPointerCancel:j,children:[/* @__PURE__ */ _(`span`,{className:`wui-toast-icon`,"aria-hidden":`true`,children:/* @__PURE__ */ _(r,{name:o.icon,size:20})}),/* @__PURE__ */ v(`div`,{className:`wui-toast-content`,children:[e.title&&/* @__PURE__ */ _(`div`,{className:`wui-toast-title`,children:e.title}),/* @__PURE__ */ _(`div`,{className:`wui-toast-message`,children:P}),typeof e.progress==`number`&&/* @__PURE__ */ v(`div`,{className:`wui-toast-task`,children:[/* @__PURE__ */ _(`div`,{className:`wui-toast-track`,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(e.progress),children:/* @__PURE__ */ _(`div`,{className:`wui-toast-track-fill`,style:{width:`${e.progress}%`}})}),/* @__PURE__ */ v(`span`,{className:`wui-toast-track-pct`,"aria-hidden":`true`,children:[Math.round(e.progress),`%`]})]}),e.action&&/* @__PURE__ */ _(`button`,{type:`button`,className:`wui-toast-action`,onClick:()=>{e.action?.onClick?.(),D()},children:e.action.label})]}),/* @__PURE__ */ _(`button`,{type:`button`,className:`btn-close wui-toast-close`,"aria-label":a,onClick:D}),!g&&/* @__PURE__ */ _(`div`,{ref:O,className:`wui-toast-progress`,style:{animationDuration:`${e.duration}ms`},onAnimationEnd:D})]})}export{C as default};
|