@webority/ui-react 0.179.0 → 0.180.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.
Files changed (108) hide show
  1. package/dist/canvas-kit/kit.js +143 -143
  2. package/dist/canvas-kit/manifest.json +2479 -106
  3. package/dist/canvas-kit/release.json +6 -6
  4. package/dist/components/AppAgenda.js +1 -0
  5. package/dist/components/AppAsyncBlock.js +1 -1
  6. package/dist/components/AppButton.js +1 -1
  7. package/dist/components/AppCalendar.js +1 -1
  8. package/dist/components/AppCalendarViews.js +1 -0
  9. package/dist/components/AppChangeList.js +1 -0
  10. package/dist/components/AppChart.js +1 -1
  11. package/dist/components/AppColorField.js +1 -1
  12. package/dist/components/AppCommandPalette.js +1 -1
  13. package/dist/components/AppDashboardCell.js +1 -1
  14. package/dist/components/AppDashboardGrid.js +1 -1
  15. package/dist/components/AppDashboardHeader.js +1 -0
  16. package/dist/components/AppDataTable.js +1 -1
  17. package/dist/components/AppDatePicker.js +1 -1
  18. package/dist/components/AppDateRangePicker.js +1 -1
  19. package/dist/components/AppDateTimePicker.js +1 -1
  20. package/dist/components/AppDescriptions.js +1 -1
  21. package/dist/components/AppDropdown.js +1 -1
  22. package/dist/components/AppEntryGrid.js +1 -1
  23. package/dist/components/AppFileViewer.js +1 -1
  24. package/dist/components/AppForm.js +1 -1
  25. package/dist/components/AppFormActions.js +1 -1
  26. package/dist/components/AppFormRow.js +1 -1
  27. package/dist/components/AppGantt.js +1 -1
  28. package/dist/components/AppInput.js +1 -1
  29. package/dist/components/AppKanban.js +1 -1
  30. package/dist/components/AppKpiTile.js +1 -1
  31. package/dist/components/AppListCard.js +1 -0
  32. package/dist/components/AppMentionInput.js +1 -1
  33. package/dist/components/AppMiniCalendar.js +1 -0
  34. package/dist/components/AppNotificationCenter.js +1 -1
  35. package/dist/components/AppNumberInput.js +1 -1
  36. package/dist/components/AppOfflineBanner.js +1 -0
  37. package/dist/components/AppOtpInput.js +1 -1
  38. package/dist/components/AppPageHeader.js +1 -1
  39. package/dist/components/AppPhoneNumberInput.js +1 -1
  40. package/dist/components/AppQueueBundle.js +1 -0
  41. package/dist/components/AppResultBlock.js +1 -0
  42. package/dist/components/AppRouteError.js +1 -1
  43. package/dist/components/AppSearch.js +1 -1
  44. package/dist/components/AppSegmented.js +1 -1
  45. package/dist/components/AppSelect.js +1 -1
  46. package/dist/components/AppSettingRow.js +1 -0
  47. package/dist/components/AppSettingSection.js +1 -0
  48. package/dist/components/AppShell.js +1 -1
  49. package/dist/components/AppStepper.js +1 -1
  50. package/dist/components/AppTabs.js +1 -1
  51. package/dist/components/AppTimePicker.js +1 -1
  52. package/dist/components/AppWizard.js +1 -1
  53. package/dist/guidance.json +987 -9
  54. package/dist/lib/formStatusContext.js +1 -0
  55. package/dist/lib/useStickyLayer.js +1 -0
  56. package/dist/types/components/AppAgenda.d.ts +69 -0
  57. package/dist/types/components/AppAsyncBlock.d.ts +5 -0
  58. package/dist/types/components/AppButton.d.ts +9 -0
  59. package/dist/types/components/AppCalendar.d.ts +14 -0
  60. package/dist/types/components/AppCalendarViews.d.ts +69 -0
  61. package/dist/types/components/AppChangeList.d.ts +30 -0
  62. package/dist/types/components/AppChart.d.ts +5 -0
  63. package/dist/types/components/AppColorField.d.ts +2 -0
  64. package/dist/types/components/AppCommandPalette.d.ts +12 -0
  65. package/dist/types/components/AppDashboardCell.d.ts +17 -1
  66. package/dist/types/components/AppDashboardGrid.d.ts +39 -5
  67. package/dist/types/components/AppDashboardHeader.d.ts +21 -0
  68. package/dist/types/components/AppDataTable.d.ts +28 -2
  69. package/dist/types/components/AppDatePicker.d.ts +2 -0
  70. package/dist/types/components/AppDateRangePicker.d.ts +2 -0
  71. package/dist/types/components/AppDescriptions.d.ts +2 -0
  72. package/dist/types/components/AppDropdown.d.ts +2 -2
  73. package/dist/types/components/AppEntryGrid.d.ts +15 -0
  74. package/dist/types/components/AppFileViewer.d.ts +7 -0
  75. package/dist/types/components/AppForm.d.ts +5 -0
  76. package/dist/types/components/AppFormActions.d.ts +28 -4
  77. package/dist/types/components/AppFormRow.d.ts +5 -0
  78. package/dist/types/components/AppGantt.d.ts +10 -2
  79. package/dist/types/components/AppInput.d.ts +5 -0
  80. package/dist/types/components/AppKanban.d.ts +4 -0
  81. package/dist/types/components/AppKpiTile.d.ts +14 -1
  82. package/dist/types/components/AppListCard.d.ts +32 -0
  83. package/dist/types/components/AppMentionInput.d.ts +2 -0
  84. package/dist/types/components/AppMiniCalendar.d.ts +78 -0
  85. package/dist/types/components/AppNotificationCenter.d.ts +20 -0
  86. package/dist/types/components/AppNumberInput.d.ts +7 -0
  87. package/dist/types/components/AppOfflineBanner.d.ts +28 -0
  88. package/dist/types/components/AppOtpInput.d.ts +2 -0
  89. package/dist/types/components/AppPhoneNumberInput.d.ts +7 -0
  90. package/dist/types/components/AppQueueBundle.d.ts +35 -0
  91. package/dist/types/components/AppResultBlock.d.ts +62 -0
  92. package/dist/types/components/AppRouteError.d.ts +76 -4
  93. package/dist/types/components/AppSearch.d.ts +3 -0
  94. package/dist/types/components/AppSegmented.d.ts +14 -0
  95. package/dist/types/components/AppSelect.d.ts +2 -0
  96. package/dist/types/components/AppSettingRow.d.ts +61 -0
  97. package/dist/types/components/AppSettingSection.d.ts +23 -0
  98. package/dist/types/components/AppShell.d.ts +10 -62
  99. package/dist/types/components/AppStepper.d.ts +6 -1
  100. package/dist/types/components/AppTabs.d.ts +5 -0
  101. package/dist/types/components/AppTimePicker.d.ts +2 -0
  102. package/dist/types/components/AppWizard.d.ts +31 -2
  103. package/dist/types/index.d.ts +17 -2
  104. package/dist/types/lib/focusField.d.ts +1 -2
  105. package/dist/types/lib/formStatusContext.d.ts +15 -0
  106. package/dist/types/lib/useStickyLayer.d.ts +7 -0
  107. package/dist/ui-react.js +1 -1
  108. package/package.json +11 -11
@@ -1 +1 @@
1
- import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/FieldMessage.js";import{FIELD_SIZES as n}from"../lib/fieldState.js";import{loadFlagStyles as r}from"../lib/flagStyles.js";import{useFieldError as ee}from"../lib/formFields.js";import te from"../lib/useElementEntry.js";import ne from"../lib/useWuiText.js";import{splitMarkerProps as re}from"../lib/wuiMarker.js";import ie from"./AppInfoTip.js";import ae from"./AppRequiredMark.js";import i from"./assertValidValue.js";import oe from"./textOf.js";import se from"./useNodeLabels.js";import ce,{optionsEqual as le}from"./useWuiControl.js";import ue from"./warnUnknownProps.js";import{useEffect as a,useId as de,useLayoutEffect as o,useMemo as fe,useRef as s}from"react";import{Fragment as pe,jsx as c,jsxs as l}from"react/jsx-runtime";import{SELECT_TEXT as me,fillText as he}from"@webority/ui-elements/text";var ge=[`single`,`multiple`,`search`,`tag`,`country`],_e=[`comfortable`,`compact`],ve=[`off`,`border`,`above`],ye=[],u=[],be=()=>import(`@webority/ui-elements/elements/select`),xe=e=>e===`multiple`||e===`tag`,d=e=>e!=null&&e!==``,f=e=>{throw Error(`<AppSelect> controlOnly draws no field, so it takes no ${e}; draw the label or message on the page.`)},Se=(e,t)=>{let n=t??``;String(e.value??``)!==String(n)&&(e.value=n)},Ce=(e,t)=>{let n=Array.isArray(t)?t:u,r=Array.isArray(e.value)?e.value:u;n.length===r.length&&n.every((e,t)=>e===r[t])||(e.value=n)},we=(e,t)=>({...e,label:t}),p=e=>Array.isArray(e)?e.join(`,`):e;function m({ref:m,...h}){let g=te(`wui-select`,be),{marker:_,props:Te}=re(`AppSelect`,h),v=ne(`select`,me),{mode:y=`single`,density:b=`comfortable`,size:x,value:Ee,defaultValue:De,onChange:Oe,options:S=ye,loadOptions:C,remote:w=!1,onSearch:ke,source:T,validate:E,placeholder:Ae,searchPlaceholder:je,emptyText:Me,searchable:D,clearable:Ne=!1,openOnHover:Pe=!1,lazyOptions:Fe=!1,icon:Ie,valuePrefix:O,prefix:k,suffix:A,floatingLabel:j=`off`,disabled:Le,readOnly:Re=!1,loading:ze=!1,open:Be,label:M,required:N=!1,optional:Ve=!1,optionalLabel:He=v.optionalLabel,error:Ue,valid:We=!1,helperText:P,help:Ge,helpLabel:Ke=v.helpLabel,id:qe,name:F,minChars:I,debounce:L,allowCustom:Je=!1,addLabel:Ye,searchingText:Xe,hintText:Ze,valueLabel:Qe,valueAvatar:$e,valueInitials:et,maxTags:R,allowDuplicates:tt=!1,separators:nt,pattern:rt,invalidMessage:it,createLabel:at,collapseChips:ot=!1,selectedText:st,clearAllLabel:ct,countries:lt,suggested:ut,suggestedLabel:dt,allCountriesLabel:ft,recentsKey:pt,recentsLimit:z,recentsLabel:mt,className:ht=``,fieldClassName:B=``,controlOnly:V=!1,"aria-label":gt,"aria-labelledby":_t,"aria-describedby":vt,"aria-invalid":yt,...H}=Te,bt=ee(F),U=Ue??bt;ue(`AppSelect`,H),i(`AppSelect`,`mode`,y,ge),i(`AppSelect`,`density`,b,_e),i(`AppSelect`,`size`,x,n);let W=xe(y);if(i(`AppSelect`,`floatingLabel`,j,W?[`off`]:ve),T&&(w||C))throw Error(`<AppSelect> source answers each query from the server, so it takes no remote or loadOptions; drop one of them.`);let G=s(!1);W&&(k!=null||A!=null)&&!G.current&&(G.current=!0,e(`AppSelect: prefix and suffix are not drawn in mode="${y}"; they are ignored.`));let xt=de(),K=s(!1);a(()=>{y===`country`&&r()},[y]);let{setRef:St,innerRef:q}=ce({ready:g,ref:m,value:Ee??(De===void 0?W?u:``:void 0),defaultValue:De,writeValue:W?Ce:Se,on:{change:e=>{let t=e.currentTarget.value,n={isCustom:!!e.detail?.isCustom};switch(h.mode){case`multiple`:Array.isArray(t)&&h.onChange?.(t);break;case`tag`:Array.isArray(t)&&h.onChange?.(t,n);break;case`search`:typeof t==`string`&&h.onChange?.(t,n);break;default:typeof t==`string`&&h.onChange?.(t)}},search:e=>{w&&typeof C!=`function`&&ke?.(e.detail.query,{seq:e.detail.seq})}}}),Ct=fe(()=>typeof C==`function`?(e,t)=>new Promise(n=>n(C(e,t))).then(e=>(K.current=!0,e),e=>{throw K.current=!0,e}):null,[C]),{portal:wt,toElementOptions:J}=se(S),Y=s({el:null,options:null,map:null});o(()=>{let e=q.current;if(!e||!g||Y.current.el===e&&Y.current.options===S&&Y.current.map===J||(Y.current={el:e,options:S,map:J},C&&K.current))return;let t=J(S,we);le(t,e.options)||(e.options=t)}),o(()=>{let e=q.current;if(!e||!g)return;e.loadOptions!==Ct&&(e.loadOptions=Ct);let t=typeof E==`function`?E:null;e.validate!==t&&(e.validate=t)}),o(()=>{q.current?.toggleAttribute(`loading`,!!ze)});let X=qe||xt,Z=!W&&j!==`off`&&M,Tt=U&&X?`${X}-error`:void 0,Et=P&&X?`${X}-hint`:void 0,Dt=Tt||Et||vt;a(()=>{let e=q.current;e&&(O==null||O===``?e.removeAttribute(`prefix`):e.setAttribute(`prefix`,O))},[O,q]);let Ot=!W&&!Z&&(k!=null||A!=null),kt=y===`multiple`||y===`tag`||y===`country`;if(V&&(d(M)&&f(`label`),d(U)&&f(`error`),d(P)&&f(`helperText`),d(B)&&f(`fieldClassName`),kt))throw Error(`<AppSelect> controlOnly draws no field, so it takes no mode="${y}"; that mode always draws its field.`);let Q=V||!kt&&!M&&!U&&!P&&!B,At=oe(M).trim(),jt=At&&(y===`single`||y===`multiple`||y===`search`)?he(v.defaultSearchPlaceholder,{labelText:At}):void 0,Mt=[ht,We&&!U?`wui-valid`:``].filter(Boolean).join(` `),Nt=/* @__PURE__ */ c(`wui-select`,{"aria-label":gt||oe(M)||void 0,"aria-labelledby":_t||void 0,"aria-describedby":Dt||void 0,"aria-invalid":yt??(U?`true`:void 0),ref:St,id:X,name:F,mode:y,density:b===`compact`?`compact`:void 0,placeholder:Z?` `:Ae||void 0,"search-placeholder":je||jt,"empty-text":Me||void 0,searchable:D===void 0?void 0:D?`true`:`false`,clearable:Ne?``:void 0,"open-on-hover":Pe?``:void 0,"lazy-options":Fe?``:void 0,size:x!==`md`&&n.includes(x??``)?x:void 0,icon:Ie||void 0,disabled:Le?``:void 0,readonly:Re?``:void 0,open:Be?``:void 0,required:N?``:void 0,"min-chars":I==null?void 0:String(I),debounce:L==null?void 0:String(L),remote:w?``:void 0,source:T||void 0,"allow-custom":Je?``:void 0,"add-label":Ye||void 0,"searching-text":Xe||void 0,"hint-text":Ze||void 0,"value-label":Qe||void 0,"value-avatar":$e||void 0,"value-initials":et||void 0,"max-tags":R==null?void 0:String(R),"allow-duplicates":tt?``:void 0,separators:nt||void 0,pattern:rt||void 0,"invalid-message":it||void 0,"create-label":at||void 0,"collapse-chips":ot?``:void 0,"selected-text":st||void 0,"clear-all-label":ct||void 0,countries:p(lt)||void 0,suggested:p(ut)||void 0,"suggested-label":dt||void 0,"all-countries-label":ft||void 0,"recents-key":pt||void 0,"recents-limit":z==null?void 0:String(z),"recents-label":mt||void 0,className:Mt||void 0,...Q&&!Ot?_:null,...H}),$=/* @__PURE__ */ l(pe,{children:[Nt,wt]}),Pt=Ot?/* @__PURE__ */ l(`div`,{...Q?_:null,className:`input-affixed`,children:[k!=null&&/* @__PURE__ */ c(`span`,{className:`affix affix-pre`,children:k}),$,A!=null&&/* @__PURE__ */ c(`span`,{className:`affix affix-suf`,children:A})]}):$;if(Q)return Pt;let Ft=[`field`,B].filter(Boolean).join(` `);return/* @__PURE__ */ l(`div`,{..._,className:Ft,children:[M&&!Z&&/* @__PURE__ */ l(`label`,{className:`label`,htmlFor:X,children:[M,Ve&&!N&&/* @__PURE__ */ c(`span`,{className:`label-optional`,children:` ${He}`}),N&&/* @__PURE__ */ c(ae,{}),Ge&&/* @__PURE__ */ c(ie,{label:Ke,children:Ge})]}),Z?/* @__PURE__ */ l(`div`,{className:j===`above`?`field-float wui-float-above`:`field-float`,children:[$,/* @__PURE__ */ l(`label`,{className:`float-label`,htmlFor:X,children:[M,Ve&&!N&&/* @__PURE__ */ c(`span`,{className:`label-optional`,children:` ${He}`}),N&&/* @__PURE__ */ c(ae,{})]})]}):Pt,/* @__PURE__ */ c(t,{error:U,hint:P,errorId:Tt,hintId:Et})]})}export{m as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/FieldMessage.js";import{FIELD_SIZES as n}from"../lib/fieldState.js";import{loadFlagStyles as r}from"../lib/flagStyles.js";import{useFieldError as ee}from"../lib/formFields.js";import te from"../lib/useElementEntry.js";import ne from"../lib/useWuiText.js";import{splitMarkerProps as re}from"../lib/wuiMarker.js";import ie from"./AppInfoTip.js";import ae from"./AppRequiredMark.js";import i from"./assertValidValue.js";import a from"./textOf.js";import oe from"./useNodeLabels.js";import se,{optionsEqual as ce}from"./useWuiControl.js";import le from"./warnUnknownProps.js";import{useEffect as ue,useId as de,useLayoutEffect as o,useMemo as fe,useRef as s}from"react";import{Fragment as pe,jsx as c,jsxs as l}from"react/jsx-runtime";import{SELECT_TEXT as me,fillText as he}from"@webority/ui-elements/text";var ge=[`single`,`multiple`,`search`,`tag`,`country`],_e=[`comfortable`,`compact`],ve=[`off`,`border`,`above`],ye=[`underline`],be=[],u=[],xe=()=>import(`@webority/ui-elements/elements/select`),Se=e=>e===`multiple`||e===`tag`,d=e=>e!=null&&e!==``,f=e=>{throw Error(`<AppSelect> controlOnly draws no field, so it takes no ${e}; draw the label or message on the page.`)},Ce=(e,t)=>{let n=t??``;String(e.value??``)!==String(n)&&(e.value=n)},we=(e,t)=>{let n=Array.isArray(t)?t:u,r=Array.isArray(e.value)?e.value:u;n.length===r.length&&n.every((e,t)=>e===r[t])||(e.value=n)},Te=(e,t)=>({...e,label:t}),p=e=>Array.isArray(e)?e.join(`,`):e;function m({ref:m,...h}){let g=te(`wui-select`,xe),{marker:_,props:Ee}=re(`AppSelect`,h),v=ne(`select`,me),{mode:y=`single`,density:De=`comfortable`,size:b,value:Oe,defaultValue:x,onChange:ke,options:S=be,loadOptions:C,remote:w=!1,onSearch:Ae,source:je,validate:Me,placeholder:Ne,searchPlaceholder:Pe,emptyText:Fe,searchable:T,clearable:Ie=!1,openOnHover:Le=!1,lazyOptions:Re=!1,icon:ze,valuePrefix:E,prefix:D,suffix:O,floatingLabel:k=`off`,variant:Be,disabled:Ve,readOnly:He=!1,loading:Ue=!1,open:We,label:A,required:j=!1,optional:Ge=!1,optionalLabel:Ke=v.optionalLabel,error:qe,valid:Je=!1,helperText:M,help:N,helpLabel:Ye=v.helpLabel,id:Xe,name:P,minChars:F,debounce:I,allowCustom:Ze=!1,addLabel:Qe,searchingText:$e,hintText:et,valueLabel:tt,valueAvatar:nt,valueInitials:rt,maxTags:L,allowDuplicates:it=!1,separators:at,pattern:ot,invalidMessage:st,createLabel:ct,collapseChips:lt=!1,selectedText:ut,clearAllLabel:dt,countries:ft,suggested:pt,suggestedLabel:mt,allCountriesLabel:ht,recentsKey:gt,recentsLimit:R,recentsLabel:_t,className:vt=``,fieldClassName:z=``,controlOnly:B=!1,"aria-label":yt,"aria-labelledby":bt,"aria-describedby":xt,"aria-invalid":St,...V}=Ee,Ct=ee(P),H=qe??Ct;le(`AppSelect`,V),i(`AppSelect`,`mode`,y,ge),i(`AppSelect`,`density`,De,_e),i(`AppSelect`,`size`,b,n);let U=Se(y);if(i(`AppSelect`,`floatingLabel`,k,U?[`off`]:ve),i(`AppSelect`,`variant`,Be,ye),je&&(w||C))throw Error(`<AppSelect> source answers each query from the server, so it takes no remote or loadOptions; drop one of them.`);let W=s(!1);U&&(D!=null||O!=null)&&!W.current&&(W.current=!0,e(`AppSelect: prefix and suffix are not drawn in mode="${y}"; they are ignored.`));let wt=de(),G=s(!1);ue(()=>{y===`country`&&r()},[y]);let{setRef:Tt,innerRef:K}=se({ready:g,ref:m,value:Oe??(x===void 0?U?u:``:void 0),defaultValue:x,writeValue:U?we:Ce,on:{change:e=>{let t=e.currentTarget.value,n={isCustom:!!e.detail?.isCustom};switch(h.mode){case`multiple`:Array.isArray(t)&&h.onChange?.(t);break;case`tag`:Array.isArray(t)&&h.onChange?.(t,n);break;case`search`:typeof t==`string`&&h.onChange?.(t,n);break;default:typeof t==`string`&&h.onChange?.(t)}},search:e=>{w&&typeof C!=`function`&&Ae?.(e.detail.query,{seq:e.detail.seq})}}}),q=fe(()=>typeof C==`function`?(e,t)=>new Promise(n=>n(C(e,t))).then(e=>(G.current=!0,e),e=>{throw G.current=!0,e}):null,[C]),{portal:Et,toElementOptions:J}=oe(S),Y=s({el:null,options:null,map:null});o(()=>{let e=K.current;if(!e||!g||Y.current.el===e&&Y.current.options===S&&Y.current.map===J||(Y.current={el:e,options:S,map:J},C&&G.current))return;let t=J(S,Te);ce(t,e.options)||(e.options=t)}),o(()=>{let e=K.current;if(!e||!g)return;e.loadOptions!==q&&(e.loadOptions=q);let t=typeof Me==`function`?Me:null;e.validate!==t&&(e.validate=t)}),o(()=>{K.current?.toggleAttribute(`loading`,!!Ue)});let X=Xe||wt,Z=!U&&k!==`off`&&A,Dt=H&&X?`${X}-error`:void 0,Ot=M&&X?`${X}-hint`:void 0,kt=Dt||Ot||xt;ue(()=>{let e=K.current;e&&(E==null||E===``?e.removeAttribute(`prefix`):e.setAttribute(`prefix`,E))},[E,K]);let At=!U&&!Z&&(D!=null||O!=null),jt=y===`multiple`||y===`tag`||y===`country`;if(B&&(d(A)&&f(`label`),d(H)&&f(`error`),d(M)&&f(`helperText`),d(z)&&f(`fieldClassName`),jt))throw Error(`<AppSelect> controlOnly draws no field, so it takes no mode="${y}"; that mode always draws its field.`);let Q=B||!jt&&!A&&!H&&!M&&!z,Mt=a(A).trim(),Nt=Mt&&(y===`single`||y===`multiple`||y===`search`)?he(v.defaultSearchPlaceholder,{labelText:Mt}):void 0,Pt=[vt,Je&&!H?`wui-valid`:``,Be===`underline`?`wui-input-underline`:``].filter(Boolean).join(` `),Ft=/* @__PURE__ */ c(`wui-select`,{"aria-label":yt||a(A)||void 0,"aria-labelledby":bt||void 0,"aria-describedby":kt||void 0,"aria-invalid":St??(H?`true`:void 0),ref:Tt,id:X,name:P,mode:y,density:De===`compact`?`compact`:void 0,placeholder:Z?` `:Ne||void 0,"search-placeholder":Pe||Nt,"empty-text":Fe||void 0,searchable:T===void 0?void 0:T?`true`:`false`,clearable:Ie?``:void 0,"open-on-hover":Le?``:void 0,"lazy-options":Re?``:void 0,size:b!==`md`&&n.includes(b??``)?b:void 0,icon:ze||void 0,disabled:Ve?``:void 0,readonly:He?``:void 0,open:We?``:void 0,required:j?``:void 0,"min-chars":F==null?void 0:String(F),debounce:I==null?void 0:String(I),remote:w?``:void 0,source:je||void 0,"allow-custom":Ze?``:void 0,"add-label":Qe||void 0,"searching-text":$e||void 0,"hint-text":et||void 0,"value-label":tt||void 0,"value-avatar":nt||void 0,"value-initials":rt||void 0,"max-tags":L==null?void 0:String(L),"allow-duplicates":it?``:void 0,separators:at||void 0,pattern:ot||void 0,"invalid-message":st||void 0,"create-label":ct||void 0,"collapse-chips":lt?``:void 0,"selected-text":ut||void 0,"clear-all-label":dt||void 0,countries:p(ft)||void 0,suggested:p(pt)||void 0,"suggested-label":mt||void 0,"all-countries-label":ht||void 0,"recents-key":gt||void 0,"recents-limit":R==null?void 0:String(R),"recents-label":_t||void 0,className:Pt||void 0,...Q&&!At?_:null,...V}),$=/* @__PURE__ */ l(pe,{children:[Ft,Et]}),It=At?/* @__PURE__ */ l(`div`,{...Q?_:null,className:`input-affixed`,children:[D!=null&&/* @__PURE__ */ c(`span`,{className:`affix affix-pre`,children:D}),$,O!=null&&/* @__PURE__ */ c(`span`,{className:`affix affix-suf`,children:O})]}):$;if(Q)return It;let Lt=[`field`,z].filter(Boolean).join(` `);return/* @__PURE__ */ l(`div`,{..._,className:Lt,children:[A&&!Z&&/* @__PURE__ */ l(`label`,{className:`label`,htmlFor:X,children:[A,Ge&&!j&&/* @__PURE__ */ c(`span`,{className:`label-optional`,children:` ${Ke}`}),j&&/* @__PURE__ */ c(ae,{}),N&&/* @__PURE__ */ c(ie,{label:Ye,children:N})]}),Z?/* @__PURE__ */ l(`div`,{className:k===`above`?`field-float wui-float-above`:`field-float`,children:[$,/* @__PURE__ */ l(`label`,{className:`float-label`,htmlFor:X,children:[A,Ge&&!j&&/* @__PURE__ */ c(`span`,{className:`label-optional`,children:` ${Ke}`}),j&&/* @__PURE__ */ c(ae,{})]})]}):It,/* @__PURE__ */ c(t,{error:H,hint:M,errorId:Dt,hintId:Ot})]})}export{m as default};
@@ -0,0 +1 @@
1
+ import e from"../lib/useWuiText.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppAlert.js";import r from"./AppButton.js";import i from"./AppChangeList.js";import a from"./AppInput.js";import o from"./assertValidValue.js";import s from"./warnUnknownProps.js";import{useState as c}from"react";import{jsx as l,jsxs as u}from"react/jsx-runtime";import{SETTING_ROW_TEXT as d,fillText as f}from"@webority/ui-elements/text";var p=[`read`,`edit`];function m(m){let{marker:h,props:g}=t(`AppSettingRow`,m),_=e(`settingRow`,d),{label:v,description:y,badge:b,value:x,children:S,mode:C=`read`,onEdit:w,onCancel:T,onSave:E,saving:D=!1,error:O,confirm:k,editDisabledReason:A,className:j=``,...M}=g,[N,P]=c(!1),[F,I]=c(``);s(`AppSettingRow`,M),o(`AppSettingRow`,`mode`,C,p);let L=C===`edit`,R=L&&N?k:void 0,z=R?.confirmWord!=null&&F!==R.confirmWord,[B,...V]=_.was.split(`{value}`),H=V.join(`{value}`),U=()=>{E?.()},W=()=>{k?P(!0):U()},G=()=>{P(!1),I(``)},K=()=>{P(!1),I(``),w?.()},q=[`wui-setting-row`,L?`wui-setting-row-editing`:``,j].filter(Boolean).join(` `);return/* @__PURE__ */ l(`div`,{className:q,"data-mode":C,...h,children:/* @__PURE__ */ u(`div`,{className:`wui-setting-row-main`,children:[/* @__PURE__ */ u(`div`,{className:`wui-setting-row-head`,children:[/* @__PURE__ */ u(`div`,{className:`wui-setting-row-label`,children:[v,b!=null&&/* @__PURE__ */ l(`span`,{className:`wui-setting-row-badge`,children:b})]}),y!=null&&/* @__PURE__ */ l(`p`,{className:`wui-setting-row-desc`,children:y})]}),L?/* @__PURE__ */ u(`div`,{className:`wui-setting-row-edit-body`,children:[/* @__PURE__ */ l(`div`,{className:`wui-setting-row-control`,inert:D||R!==void 0?!0:void 0,children:S}),x!=null&&/* @__PURE__ */ u(`p`,{className:`wui-setting-row-was`,children:[B,x,H]}),O!=null&&/* @__PURE__ */ l(n,{tone:`danger`,role:`alert`,children:O}),R===void 0?/* @__PURE__ */ u(`div`,{className:`wui-setting-row-actions`,children:[/* @__PURE__ */ l(r,{variant:`outline`,tone:`neutral`,onClick:T,disabled:D,children:_.cancel}),/* @__PURE__ */ l(r,{tone:`primary`,loading:D,onClick:W,children:_.save})]}):/* @__PURE__ */ u(`div`,{className:`wui-setting-row-confirm`,children:[/* @__PURE__ */ l(`p`,{className:`wui-setting-row-confirm-title`,children:R.title}),/* @__PURE__ */ l(i,{items:R.changes}),R.effect!=null&&/* @__PURE__ */ l(`p`,{className:`wui-setting-row-effect`,children:R.effect}),R.confirmWord!=null&&/* @__PURE__ */ l(a,{label:f(_.confirmWordLabel,{word:R.confirmWord}),name:`settingConfirmWord`,autoComplete:`off`,value:F,onChange:e=>I(e.target.value),helperText:f(_.confirmHint,{word:R.confirmWord,action:R.actionLabel})}),/* @__PURE__ */ u(`div`,{className:`wui-setting-row-actions`,children:[/* @__PURE__ */ l(r,{variant:`outline`,tone:`neutral`,onClick:G,disabled:D,children:_.keepEditing}),/* @__PURE__ */ l(r,{tone:`primary`,loading:D,disabled:D||z,onClick:U,children:R.actionLabel})]})]})]}):/* @__PURE__ */ u(`div`,{className:`wui-setting-row-read`,children:[/* @__PURE__ */ l(`span`,{className:`wui-setting-row-value`,children:x}),/* @__PURE__ */ l(r,{variant:`outline`,tone:`neutral`,size:`sm`,className:`wui-setting-row-edit`,onClick:K,disabled:A!=null,tooltip:A,children:_.edit})]})]})})}export{m as default};
@@ -0,0 +1 @@
1
+ import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./warnUnknownProps.js";import{jsx as n,jsxs as r}from"react/jsx-runtime";function i(i){let{marker:a,props:o}=e(`AppSettingSection`,i),{title:s,description:c,action:l,children:u,className:d=``,...f}=o;t(`AppSettingSection`,f);let p=[`wui-setting-section`,d].filter(Boolean).join(` `),m=s!=null||c!=null||l!=null;return/* @__PURE__ */ r(`section`,{className:p,...a,children:[m&&/* @__PURE__ */ r(`div`,{className:`wui-setting-section-head`,children:[/* @__PURE__ */ r(`div`,{className:`wui-setting-section-titles`,children:[s!=null&&/* @__PURE__ */ n(`h3`,{className:`wui-setting-section-title`,children:s}),c!=null&&/* @__PURE__ */ n(`p`,{className:`wui-setting-section-desc`,children:c})]}),l!=null&&/* @__PURE__ */ n(`div`,{className:`wui-setting-section-action`,children:l})]}),/* @__PURE__ */ n(`div`,{className:`wui-setting-section-rows`,children:u})]})}export{i as default};
@@ -1 +1 @@
1
- import{devWarn as e}from"../lib/devWarn.js";import{linkTarget as t}from"../lib/linkTarget.js";import{navMatchScore as n}from"../lib/navMatch.js";import{SHELL_FOLDED_COOKIE as r,readNavFolded as i,readShellCollapsed as a,writeNavFolded as o,writeShellCollapsed as s}from"../lib/shellCookie.js";import{TargetLink as c}from"../lib/TargetLink.js";import l from"../lib/useElementEntry.js";import u from"../lib/useWuiText.js";import{TONES as d}from"../lib/vocabulary.js";import{splitMarkerProps as f}from"../lib/wuiMarker.js";import p from"./AppAvatar.js";import m from"./AppButton.js";import h from"./AppIcon.js";import g from"./AppNavigationMenu.js";import _ from"./assertValidValue.js";import v from"./warnUnknownProps.js";import{IST_TIME_ZONE as y,initScrollEdges as b,isApplePlatform as x,isCommandChord as S,isImeSafeEnter as C,revealActiveNavItem as w,setPopoverOpen as T}from"@webority/ui-elements/helpers";import{useEffect as E,useId as ee,useMemo as D,useRef as O,useState as k}from"react";import{Fragment as A,jsx as j,jsxs as M}from"react/jsx-runtime";import{SHELL_TEXT as te,fillText as N}from"@webority/ui-elements/text";var ne=()=>import(`@webority/ui-elements/elements/overflow`),P=()=>import(`@webority/ui-elements/elements/dropdown`),F=99,I=4,L=5,R=/^[a-z0-9-]+$/,z=`wui-sidebar-footer`,re=[],B=[`prefix`,`exact`],V=[`comfortable`,`compact`],H=[`neutral`,`primary`],ie=[`default`,`brand`],U=[`side`,`top`],W=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],ae=/* @__PURE__ */ new Set([`key`,`label`,`icon`,`iconVariant`,`iconSize`,`href`,`badge`,`badgeTone`,`badgeTitle`,`newUntil`,`trailingIcon`,`active`,`match`,`matchAlso`,`tab`,`tabLabel`,`children`,`header`,`description`]),G=e=>e>F?`${F}+`:String(e),oe=new Intl.DateTimeFormat(`en-CA`,{timeZone:y}),se=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:oe.format(/* @__PURE__ */ new Date)<=e},ce=({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(` `)},le=({logoLight:e,logoDark:t,markLight:n,markDark:r,brandName:i,logoLightWidth:a,logoLightHeight:o,logoDarkWidth:s,logoDarkHeight:c,markLightWidth:l,markLightHeight:u,markDarkWidth:d,markDarkHeight:f})=>{let p=i??``,m=[e&&/* @__PURE__ */ j(`img`,{className:`wui-brand-logo wui-brand-light`,src:e,alt:p,width:a,height:o},`logo-light`),t&&/* @__PURE__ */ j(`img`,{className:`wui-brand-logo wui-brand-dark`,src:t,alt:``,"aria-hidden":`true`,width:s,height:c},`logo-dark`)],h=[n&&[`mark-light`,`wui-brand-mark wui-brand-light`,n,l,u],r&&[`mark-dark`,`wui-brand-mark wui-brand-dark`,r,d,f]].filter(e=>!!e).map(([t,n,r,i,a],o)=>o===0&&!e?/* @__PURE__ */ j(`img`,{className:n,src:r,alt:p,width:i,height:a},t):/* @__PURE__ */ j(`img`,{className:n,src:r,alt:``,"aria-hidden":`true`,width:i,height:a},t));return[...m,...h].filter(Boolean)};function ue(e){let{marker:t,props:n}=f(`AppShell`,e),c=u(`shell`,te),{groups:l=[],brand:d,logoLight:p,logoDark:m,markLight:y,markDark:x,logoLightWidth:S,logoLightHeight:C,logoDarkWidth:ee,logoDarkHeight:N,markLightWidth:ne,markLightHeight:P,markDarkWidth:F,markDarkHeight:I,brandName:L,brandHref:R,brandLabel:z,sidebarStart:B,sidebarStartCompact:ae,sidebarFooter:G,sidebarFooterItems:oe=re,topbarStart:se,topbarEnd:ue,footer:fe,launcher:K,children:pe,collapsed:q,onCollapsedChange:me,noSidebar:J=!1,nav:Y=`side`,topNavDetail:Ce=!1,capBadges:Te=!1,density:Ee=`comfortable`,itemHeight:De,iconVariant:Oe=`twotone`,topbarTone:ke=`neutral`,tone:Ae=`default`,navLabel:je=c.navLabel,linkComponent:X,currentPath:Me,rememberCollapsed:Ne=!1,collapsedCookie:Pe=`wui-shell-collapsed`,foldedCookie:Fe=r,tabBarLabel:Ie=c.tabBarLabel,moreLabel:Le=c.moreLabel,skipLabel:Re=c.skipLabel,openNavLabel:ze=c.openNavLabel,expandNavLabel:Be=c.expandNavLabel,collapseNavLabel:Ve=c.collapseNavLabel,newLabel:He=c.newLabel,togglePagesLabel:Ue=c.togglePagesLabel,accountMenuLabel:We=c.accountMenuLabel,roleLabel:Ge=c.roleLabel,rolesLabel:Ke=c.rolesLabel,unreadLabel:qe=c.unreadLabel,markAllReadLabel:Je=c.markAllReadLabel,viewAllLabel:Ye=c.viewAllLabel,loadingNotificationsText:Xe=c.loadingNotificationsText,noUnreadText:Ze=c.noUnreadText,unreadNotificationsText:Qe=c.unreadNotificationsText,unreadBellLabel:$e=c.unreadBellLabel,searchResultsLabel:et=c.searchResultsLabel,noResultsText:tt=c.noResultsText,noResultsForText:nt=c.noResultsForText,resultsCountText:rt=c.resultsCountText,resultCountText:it=c.resultCountText,userMenu:at,notifications:ot,search:st,className:ct=``,style:lt,...ut}=n;if(v(`AppShell`,ut),_(`AppShell`,`density`,Ee,V),_(`AppShell`,`topbarTone`,ke,H),_(`AppShell`,`tone`,Ae,ie),_(`AppShell`,`nav`,Y,U),_(`AppShell`,`iconVariant`,Oe,W),z!==void 0&&!R)throw Error(`<AppShell> brandLabel names the brand link, so it needs brandHref.`);if(R){if(!z&&!L)throw Error(`<AppShell> brandHref needs brandLabel or brandName: the collapsed rail hides the logo, so the link would have no accessible name.`);if(!(d||p||m||y||x))throw Error(`<AppShell> brandHref has no brand, logo or mark to link.`)}let dt=(De??0)>0?{...lt,"--wui-nav-item-height":`${De}px`}:lt,[ft,pt]=k(()=>Ne&&q===void 0&&typeof document<`u`?a(Pe)??!1:!1),[Z,Q]=k(!1),mt=O(null),[ht,gt]=k(!1),[_t,vt]=k(!1),yt=O(null),bt=q??ft,xt=e=>R?/* @__PURE__ */ j(_e,{href:R,label:z||L,linkComponent:X,onNavigate:()=>Q(!1),children:e}):e,St=()=>{let e=!bt;q===void 0&&pt(e),Ne&&s(e,Pe),me?.(e)},Ct=l.some(e=>e.collapsible),[wt,Tt]=k(()=>Ct&&typeof document<`u`?i(Fe):/* @__PURE__ */ new Set),Et=e=>{let t=new Set(wt);t.has(e)?t.delete(e):t.add(e),Tt(t),o(t,Fe)},Dt=D(()=>de(l,oe,Me),[l,oe,Me]),$=Dt.groups,Ot=Dt.footer,kt=J?null:he($,Ot.some(e=>e.active));E(()=>{let e=()=>gt(window.scrollY>4);return e(),window.addEventListener(`scroll`,e,{passive:!0}),()=>window.removeEventListener(`scroll`,e)},[]),E(()=>{b()},[]),E(()=>{w(yt.current)},[]),E(()=>{let e=yt.current;if(!e)return;let t=()=>vt($.length>0&&e.scrollHeight>e.clientHeight);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[$]),E(()=>{let e=mt.current;if(!e)return;let t=window.matchMedia(`(max-width: 991.98px)`),n=()=>{t.matches?e.setAttribute(`popover`,`auto`):(e.removeAttribute(`popover`),Q(!1))},r=e=>Q(`newState`in e&&e.newState===`open`);return n(),t.addEventListener(`change`,n),e.addEventListener(`toggle`,r),()=>{t.removeEventListener(`change`,n),e.removeEventListener(`toggle`,r)}},[]),E(()=>{let e=mt.current;e?.hasAttribute(`popover`)&&T(e,Z)},[Z]);let At=[`app-shell`,bt?`collapsed`:``,J?`no-sidebar`:``,Y===`top`?`wui-shell-top`:``,Z?`mobile-open`:``,ct].filter(Boolean).join(` `);return/* @__PURE__ */ M(`div`,{className:At,"data-density":Ee===`compact`?`compact`:void 0,"data-shell-tone":Ae===`brand`?`brand`:void 0,"data-wui-folded-cookie":Ct?Fe:void 0,style:dt,...t,...ut,children:[/* @__PURE__ */ j(`a`,{className:`wui-skip-link`,href:`#main-content`,children:Re}),/* @__PURE__ */ M(`aside`,{className:`app-sidebar`,ref:mt,children:[(d||p||m||y||x)&&/* @__PURE__ */ j(`div`,{className:ce({logoLight:p,logoDark:m,markLight:y,markDark:x}),children:xt(/* @__PURE__ */ M(A,{children:[le({logoLight:p,logoDark:m,markLight:y,markDark:x,brandName:L,logoLightWidth:S,logoLightHeight:C,logoDarkWidth:ee,logoDarkHeight:N,markLightWidth:ne,markLightHeight:P,markDarkWidth:F,markDarkHeight:I}),d]}))}),B&&/* @__PURE__ */ j(`div`,{className:`app-sidebar-start`,children:B}),ae&&/* @__PURE__ */ j(`div`,{className:`app-sidebar-start-compact`,children:ae}),/* @__PURE__ */ j(`nav`,{className:`app-sidebar-scroll`,"aria-label":je,ref:yt,tabIndex:_t?0:void 0,children:$.map((e,t)=>{let n=e.items.map(e=>e.header==null?/* @__PURE__ */ j(be,{item:e,linkComponent:X,onNavigate:()=>Q(!1),iconVariant:Oe,newLabel:He,togglePagesLabel:Ue,capBadges:Te},e.key??e.href??e.label):/* @__PURE__ */ j(`div`,{className:`wui-nav-header`,children:e.header},e.key??e.header));if(!e.collapsible)return/* @__PURE__ */ M(`div`,{className:`app-nav-group`,children:[e.label&&/* @__PURE__ */ j(`div`,{className:`app-nav-group-label`,children:e.label}),n,e.after&&/* @__PURE__ */ j(`div`,{className:`wui-nav-group-after`,children:e.after})]},e.key??e.label??`group-${t}`);let r=!wt.has(e.key??``)||!!ye(e.items),i=`wui-nav-group-${e.key}`;return/* @__PURE__ */ M(`div`,{className:`app-nav-group wui-nav-group-collapsible${r?``:` wui-nav-group-folded`}`,"data-wui-nav-group":e.key,children:[/* @__PURE__ */ M(`button`,{type:`button`,className:`app-nav-group-label wui-nav-group-toggle`,"aria-expanded":r,"aria-controls":i,onClick:()=>Et(e.key??``),children:[/* @__PURE__ */ j(`span`,{className:`wui-nav-group-text`,children:e.label}),/* @__PURE__ */ j(`span`,{className:`wui-nav-group-caret`,children:/* @__PURE__ */ j(h,{name:`chevron-down`,size:16})})]}),/* @__PURE__ */ M(`div`,{className:`wui-nav-group-body`,id:i,children:[n,e.after&&/* @__PURE__ */ j(`div`,{className:`wui-nav-group-after`,children:e.after})]})]},e.key??`group-${t}`)})}),(G||Ot.length>0)&&/* @__PURE__ */ M(`div`,{className:`app-sidebar-foot`,children:[Ot.length>0&&/* @__PURE__ */ j(`div`,{className:`wui-sidebar-foot-links`,children:Ot.map(e=>/* @__PURE__ */ j(be,{item:e,linkComponent:X,onNavigate:()=>Q(!1),iconVariant:Oe,newLabel:He,togglePagesLabel:Ue,capBadges:Te},e.key??e.href??e.label))}),G]}),!J&&/* @__PURE__ */ j(`button`,{type:`button`,className:`app-sidebar-toggle`,onClick:St,"aria-label":bt?Be:Ve,"aria-expanded":!bt,children:/* @__PURE__ */ j(h,{name:`chevrons-left`,size:20})})]}),/* @__PURE__ */ M(`div`,{className:`app-main`,children:[/* @__PURE__ */ M(`header`,{className:`app-topbar${ht?` wui-scrolled`:``}`,"data-tone":ke===`primary`?`primary`:void 0,children:[/* @__PURE__ */ M(`div`,{className:`app-topbar-start`,children:[/* @__PURE__ */ j(`button`,{type:`button`,className:`app-topbar-menu`,onClick:()=>Q(!0),"aria-label":ze,"aria-expanded":Z,children:/* @__PURE__ */ j(h,{name:`menu`,size:18})}),Y===`top`&&d&&/* @__PURE__ */ j(`div`,{className:`wui-shell-top-brand`,children:xt(d)}),Y===`top`&&/* @__PURE__ */ j(`div`,{className:`wui-shell-top-nav`,children:/* @__PURE__ */ j(g,{items:ge($,Ce),ariaLabel:je,linkComponent:X})}),se,st&&/* @__PURE__ */ j(we,{config:st,searchResultsLabel:et,noResultsText:tt,noResultsForText:nt,resultsCountText:rt,resultCountText:it,moreLabel:Le})]}),/* @__PURE__ */ M(`div`,{className:`app-topbar-end`,children:[ue,ot&&/* @__PURE__ */ j(Se,{config:ot,unreadLabel:qe,markAllReadLabel:Je,viewAllLabel:Ye,loadingNotificationsText:Xe,noUnreadText:Ze,unreadNotificationsText:Qe,unreadBellLabel:$e}),at&&/* @__PURE__ */ j(xe,{config:at,linkComponent:X,accountMenuLabel:We,roleLabel:Ge,rolesLabel:Ke})]})]}),/* @__PURE__ */ j(`main`,{className:`app-content`,id:`main-content`,children:pe}),fe&&/* @__PURE__ */ j(`footer`,{className:`app-footer`,children:fe})]}),K&&/* @__PURE__ */ j(`div`,{className:`wui-shell-launcher`,children:K}),kt&&/* @__PURE__ */ M(`nav`,{className:`wui-tabbar`,"aria-label":Ie,"data-wui-cap-badges":Te||void 0,children:[kt.tabs.map(e=>/* @__PURE__ */ j(ve,{tab:e,linkComponent:X,iconVariant:Oe,capBadges:Te},e.key??e.href)),kt.hasMore&&/* @__PURE__ */ M(`button`,{type:`button`,className:`wui-tabbar-item${kt.moreActive?` active`:``}`,onClick:()=>Q(!0),children:[/* @__PURE__ */ j(`span`,{className:`wui-tabbar-icon`,children:/* @__PURE__ */ j(h,{name:`more`,size:24})}),/* @__PURE__ */ j(`span`,{className:`wui-tabbar-label`,children:Le})]})]})]})}function de(e,t,r){let i=t;for(let e of i){if(e.children?.length)throw Error(`<AppShell> sidebarFooterItems cannot hold children; keep footer links flat.`);if(e.tab)throw Error(`<AppShell> sidebarFooterItems cannot carry tab: true; the phone tab bar is built from groups.`);if(e.header!=null)throw Error(`<AppShell> sidebarFooterItems cannot hold a header row.`)}for(let t of e)t.collapsible&&me(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:z,items:t}].map(e=>({...e,items:pe(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`,fe(e)),_(`AppShell`,`match`,e.match,B),_(`AppShell`,`iconVariant`,e.iconVariant,W),_(`AppShell`,`badgeTone`,e.badgeTone,d);let l=null;if(r!=null&&!s.some(e=>e.active===!0)){let e=-1;for(let t of s){if(t.active!=null||t.children?.length&&!t.href)continue;let i=n(r,t.href,{exact:t.match===`exact`,also:t.matchAlso});if(i<0)continue;let a=t.match===`exact`&&n(r,t.href,{exact:!0})>=0?1/0:i;a>e&&(e=a,l=t)}}for(let e of s)e.active=e.active??e===l;return{groups:o.filter(e=>e.key!==z),footer:o.find(e=>e.key===z)?.items??[]}}function fe(e){return Object.fromEntries(Object.entries(e).filter(([e])=>!ae.has(e)))}var K=e=>e.header!=null;function pe(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 me(t){if(t.key!=null&&R.test(t.key))return;let n=t.key==null?`<AppShell> a collapsible group needs a key so its folded state can be remembered.`:`<AppShell> collapsible group key "${t.key}" must use lower-case letters, digits and hyphens.`;typeof process<`u`&&process.env.NODE_ENV===`production`||q.has(n)||(q.add(n),e(n))}function he(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?I:L;if(i.length>o)throw Error(`<AppShell>: ${i.length} items carry tab: true, but the phone tab bar holds ${o} (${a?`4 plus More, because other items exist`:`5 when every item is a tab`}). Flag fewer items.`);return{tabs:i,hasMore:a,moreActive:t||n.some(e=>!e.tab&&e.active)}}function ge(e,t){let n=e=>{if(e.label===void 0)throw Error(`<AppShell> a navigation row has no label; every row but a header needs one.`);return e.label},r=e=>e.key??e.href??n(e),i=(e,i)=>({key:r(e),label:n(e),to:i,current:!!e.active,...t&&e.description?{description:e.description}:{}}),a=e=>e.flatMap(e=>K(e)?[]:[...e.href?[{...i(e,e.href),icon:e.icon}]:[],...a(e.children??[])]),o=[];for(let s of e)for(let e of s.items){if(K(e))continue;let c=t&&s.label?{group:s.label}:{},l=a(e.children??[]);if(l.length>0){let a=e.href?[{...i(e,e.href),icon:e.icon}]:[],s=t&&(!!e.active||!!ye(e.children??[]));o.push({key:r(e),label:n(e),links:[...a,...l],...c,...t?{current:s}:{}})}else e.href&&o.push({...i(e,e.href),...c})}return o}function J(e,t){return t&&typeof e==`number`&&e>F?`${F}+`:e}function _e({href:e,label:n,linkComponent:r,onNavigate:i,children:a}){return/* @__PURE__ */ j(c,{link:t(r,{to:e}),className:`wui-brand-link`,"aria-label":n,onClick:i,children:a})}function ve({tab:e,linkComponent:n,iconVariant:r,capBadges:i}){let a=`wui-tabbar-item${e.active?` active`:``}`,o=/* @__PURE__ */ M(A,{children:[e.icon&&/* @__PURE__ */ j(`span`,{className:`wui-tabbar-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ j(h,{name:e.icon,size:24,variant:e.iconVariant??r}):e.icon}),/* @__PURE__ */ j(`span`,{className:`wui-tabbar-label`,children:e.tabLabel??e.label}),e.badge!=null&&/* @__PURE__ */ j(`span`,{className:`wui-tabbar-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:J(e.badge,i)}),e.badge!=null&&e.badgeTitle&&/* @__PURE__ */ j(`span`,{className:`visually-hidden`,children:e.badgeTitle})]}),s=e.active?`page`:void 0;return/* @__PURE__ */ j(c,{link:t(n,{to:e.href}),className:a,"aria-current":s,children:o})}function ye(e){for(let t of e){if(t.active)return t;let e=t.children?.length?ye(t.children):void 0;if(e)return e}}function be({item:e,linkComponent:n,onNavigate:r,depth:i=0,iconVariant:a,newLabel:o,togglePagesLabel:s,capBadges:l}){let u=i>0,d=i>1?` wui-nav-depth-${Math.min(i,6)}`:``,f=Array.isArray(e.children)&&e.children.length>0,p=f?ye(e.children??[]):void 0,m=!!p,g=p?p.key??p.href??p.label:null,[_,v]=k(m);E(()=>{g!=null&&v(!0)},[g]);let y=typeof e.label==`string`?e.label:void 0,b=!u&&e.icon&&/* @__PURE__ */ j(`span`,{className:`app-nav-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ j(h,{name:e.icon,size:e.iconSize??22,variant:e.iconVariant??a}):e.icon}),x=e.badge!=null&&/* @__PURE__ */ j(`span`,{className:`app-nav-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:J(e.badge,l)}),S=se(e.newUntil)&&/* @__PURE__ */ j(`span`,{className:`wui-nav-new`,children:o}),C=/* @__PURE__ */ M(A,{children:[b,/* @__PURE__ */ j(`span`,{className:`app-nav-text`,children:e.label}),S,x,e.trailingIcon&&/* @__PURE__ */ j(`span`,{className:`app-nav-trailing`,children:typeof e.trailingIcon==`string`?/* @__PURE__ */ j(h,{name:e.trailingIcon,size:16}):e.trailingIcon})]}),w=e.active?`page`:void 0;if(f){let f=/* @__PURE__ */ j(`div`,{className:`app-nav-sub${_?` expanded`:``}`,inert:!_,"aria-hidden":!_||void 0,children:/* @__PURE__ */ j(`div`,{className:`app-nav-sub-inner`,children:(e.children??[]).map(e=>/* @__PURE__ */ j(be,{item:e,linkComponent:n,onNavigate:r,depth:i+1,iconVariant:a,newLabel:o,togglePagesLabel:s,capBadges:l},e.key??e.href))})});if(e.href){let i=/* @__PURE__ */ j(c,{link:t(n,{to:e.href}),className:`wui-nav-split-link`,"aria-current":w,onClick:r,children:C});return/* @__PURE__ */ M(A,{children:[/* @__PURE__ */ M(`div`,{className:`app-nav-item has-children wui-nav-split${u?` app-nav-subitem`:``}${m||e.active?` active`:``}${d}`,"data-label":y,children:[i,/* @__PURE__ */ j(`button`,{type:`button`,className:`app-nav-caret wui-nav-split-toggle`,"aria-expanded":_,"aria-label":N(s,{name:y??``}),onClick:()=>v(e=>!e),children:/* @__PURE__ */ j(h,{name:`chevron-right`,size:16})})]}),f]})}return/* @__PURE__ */ M(A,{children:[/* @__PURE__ */ M(`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__ */ j(`span`,{className:`app-nav-text`,children:e.label}),S,x,/* @__PURE__ */ j(`span`,{className:`app-nav-caret`,children:/* @__PURE__ */ j(h,{name:`chevron-right`,size:16})})]}),f]})}let T=`app-nav-item${u?` app-nav-subitem`:``}${e.active?` active`:``}${d}`;return/* @__PURE__ */ j(c,{link:t(n,{to:e.href}),className:T,"aria-current":w,"data-label":y,onClick:r,children:C})}function Y(e){l(`wui-dropdown`,P);let[t,n]=k(!1),r=O(null);return E(()=>{r.current?.toggleAttribute(`open`,t)},[t]),E(()=>{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 xe({config:e,linkComponent:n,accountMenuLabel:r,roleLabel:i,rolesLabel:a}){let o=u(`shell`,te),s=ee(),{open:l,setOpen:d,ref:f}=Y(),{name:g,role:v,roles:y=[],noTriggerRole:b=!1,outlined:x=!1,photo:S,profileHref:C,profileLabel:w=o.profileLabel,onLogout:T,logoutAction:E,logoutLabel:D=o.logoutLabel,head:O,section:k,logoutVariant:ne=`item`,items:P=[]}=e;if(_(`AppShell`,`userMenu.logoutVariant`,ne,[`item`,`button`]),!g)throw Error(`<AppShell> userMenu.name is required; the trigger and the avatar are named from it.`);let F=y.map(e=>(e??``).trim()).filter(Boolean),I=()=>d(!1),L=(e,r,i,a)=>/* @__PURE__ */ j(c,{link:t(n,{to:e}),className:`dropdown-item`,onClick:a,children:r},i),R=/* @__PURE__ */ j(h,{name:`log-out`,size:18}),z=/* @__PURE__ */ M(A,{children:[R,D]});return/* @__PURE__ */ M(`wui-dropdown`,{class:`dropdown wui-usermenu`,align:`end`,ref:f,children:[/* @__PURE__ */ M(`button`,{type:`button`,id:s,className:x?`wui-usermenu-trigger wui-usermenu-trigger-outlined`:`wui-usermenu-trigger`,"data-wui-dropdown-trigger":!0,"aria-expanded":l,"aria-label":N(r,{name:g}),children:[/* @__PURE__ */ j(p,{name:g,src:S,tone:`auto`}),/* @__PURE__ */ M(`span`,{className:`wui-usermenu-text`,children:[/* @__PURE__ */ j(`span`,{className:`wui-usermenu-name`,children:g}),v&&!b&&/* @__PURE__ */ j(`span`,{className:`wui-usermenu-role`,children:v})]}),/* @__PURE__ */ j(h,{name:`chevron-down`,size:14,className:`wui-usermenu-caret`})]}),/* @__PURE__ */ M(`div`,{"data-wui-dropdown-menu":!0,popover:`auto`,className:`dropdown-menu dropdown-menu-end wui-usermenu-menu${l?` show`:``}`,"aria-labelledby":s,children:[/* @__PURE__ */ M(`div`,{className:`wui-usermenu-head`,children:[/* @__PURE__ */ j(p,{name:g,src:S,size:`lg`,tone:`auto`}),/* @__PURE__ */ M(`div`,{className:`wui-usermenu-who`,children:[/* @__PURE__ */ j(`div`,{className:`wui-usermenu-name`,children:g}),v&&/* @__PURE__ */ j(`div`,{className:`wui-usermenu-role`,children:v}),F.length>0&&/* @__PURE__ */ M(`div`,{className:`wui-usermenu-roles`,children:[/* @__PURE__ */ j(`span`,{className:`wui-usermenu-roles-label`,children:F.length===1?i:a}),` ${F.join(`, `)}`]}),O?/* @__PURE__ */ j(`div`,{className:`wui-usermenu-extra`,children:O}):null]})]}),k?/* @__PURE__ */ j(`div`,{className:`wui-usermenu-section`,children:k}):null,C&&L(C,/* @__PURE__ */ M(A,{children:[/* @__PURE__ */ j(h,{name:`user`,size:18}),w]}),void 0,I),P.map(e=>{if(e.divider)return/* @__PURE__ */ j(`hr`,{className:`dropdown-divider`},e.key);let t=/* @__PURE__ */ M(A,{children:[e.icon&&/* @__PURE__ */ j(h,{name:e.icon,size:18}),e.label]}),n=()=>{e.onClick?.(),I()};return e.href?L(e.href,t,e.key,n):/* @__PURE__ */ j(`button`,{type:`button`,className:`dropdown-item`,onClick:n,children:t},e.key)}),ne===`button`?(E||T)&&/* @__PURE__ */ j(`div`,{className:`wui-usermenu-foot`,children:E?/* @__PURE__ */ j(`form`,{method:`post`,action:E,className:`wui-usermenu-logout`,children:/* @__PURE__ */ M(m,{type:`submit`,tone:`danger`,variant:`soft`,block:!0,children:[/* @__PURE__ */ j(`span`,{className:`d-inline-flex me-2`,children:R}),D]})}):/* @__PURE__ */ M(m,{type:`button`,tone:`danger`,variant:`soft`,block:!0,onClick:()=>{I(),T?.()},children:[/* @__PURE__ */ j(`span`,{className:`d-inline-flex me-2`,children:R}),D]})}):E?/* @__PURE__ */ j(`form`,{method:`post`,action:E,className:`wui-usermenu-logout`,children:/* @__PURE__ */ j(`button`,{type:`submit`,className:`dropdown-item danger`,children:z})}):T&&/* @__PURE__ */ j(`button`,{type:`button`,className:`dropdown-item danger`,onClick:()=>{I(),T()},children:z})]})]})}function Se({config:e,unreadLabel:t,markAllReadLabel:n,viewAllLabel:r,loadingNotificationsText:i,noUnreadText:a,unreadNotificationsText:o,unreadBellLabel:s}){let c=u(`shell`,te),l=ee(),{open:d,ref:f}=Y(e.onOpen),{unread:p=0,items:m,loading:g=!1,onMarkAllRead:_,viewAllHref:v,label:y=c.label,emptyText:b=c.emptyText}=e,[x,S]=k(``),C=O(p);E(()=>{C.current!==p&&(C.current=p,S(p===0?a:N(o,{count:G(p)})))},[p,a,o]);let w=null;return m?.length?w=/* @__PURE__ */ j(`div`,{className:`wui-bell-items`,children:m.map((e,n)=>{let r=`wui-bell-item${e.read?` wui-bell-item-read`:``}`,i=/* @__PURE__ */ M(A,{children:[/* @__PURE__ */ j(`span`,{className:`wui-bell-dot`,"aria-hidden":`true`}),e.icon&&/* @__PURE__ */ j(`span`,{className:`wui-bell-icon`,children:/* @__PURE__ */ j(h,{name:e.icon,size:18})}),/* @__PURE__ */ M(`span`,{className:`wui-bell-body`,children:[!e.read&&/* @__PURE__ */ M(`span`,{className:`visually-hidden`,children:[t,`: `]}),/* @__PURE__ */ j(`span`,{className:`wui-bell-item-title`,children:e.title}),e.time&&/* @__PURE__ */ j(`span`,{className:`wui-bell-when`,children:e.time})]})]});return e.href?/* @__PURE__ */ j(`a`,{className:r,href:e.href,"data-id":e.id,children:i},e.id??n):/* @__PURE__ */ j(`div`,{className:r,"data-id":e.id,children:i},e.id??n)})}):g?w=/* @__PURE__ */ j(`div`,{className:`wui-bell-state`,children:i}):m&&(w=/* @__PURE__ */ j(`div`,{className:`wui-bell-state`,children:b})),/* @__PURE__ */ M(`wui-dropdown`,{class:`dropdown wui-bell`,align:`end`,ref:f,children:[/* @__PURE__ */ M(`button`,{type:`button`,id:l,className:`topbar-icon-btn wui-bell-trigger`,"data-wui-dropdown-trigger":!0,"aria-expanded":d,"aria-label":p===0?y:N(s,{label:y,count:G(p)}),children:[/* @__PURE__ */ j(h,{name:`notification`,size:20}),/* @__PURE__ */ j(`span`,{className:`wui-bell-count`,"aria-hidden":`true`,hidden:p===0,children:G(p)})]}),/* @__PURE__ */ j(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:x}),/* @__PURE__ */ M(`div`,{"data-wui-dropdown-menu":!0,popover:`auto`,className:`dropdown-menu dropdown-menu-end wui-bell-menu${d?` show`:``}`,"aria-labelledby":l,children:[/* @__PURE__ */ M(`div`,{className:`wui-bell-head`,children:[/* @__PURE__ */ j(`span`,{className:`wui-bell-title`,children:y}),_&&/* @__PURE__ */ j(`button`,{type:`button`,className:`wui-bell-markall`,onClick:_,children:n})]}),/* @__PURE__ */ j(`div`,{className:`wui-bell-list`,"aria-busy":g||void 0,children:w}),v&&/* @__PURE__ */ j(`a`,{className:`wui-bell-foot`,href:v,children:r})]})]})}var Ce=e=>!!e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName));function we({config:e,searchResultsLabel:t,noResultsText:n,noResultsForText:r,resultsCountText:i,resultCountText:a,moreLabel:o}){l(`wui-overflow`,ne);let s=u(`shell`,te),c=ee(),{value:d=``,onChange:f,results:p=null,loading:m=!1,onSelect:g,onSubmit:_,onFocus:v,placeholder:y=s.placeholder,shortcutKey:b}=e;if(b!==void 0&&!/^[a-z]$/.test(b))throw Error(`<AppShell>: search shortcutKey must be one letter, a to z; got "${b}".`);let w=b?.toUpperCase(),T=w===void 0?``:` (${x()?`⌘${w}`:`Ctrl+${w}`})`;E(()=>{if(b===void 0)return;let e=e=>{S(e,b)&&(e.preventDefault(),P(!0),V.current?.focus(),V.current?.select())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[b]);let[A,P]=k(!1),[F,I]=k(!1),[L,R]=k({results:null,index:-1}),z=L.results===p?L.index:-1,re=e=>R({results:p,index:e}),B=O(null),V=O(null),H=O([]),ie=D(()=>(p??[]).flatMap(e=>e.hits??[]),[p]),U=p!=null&&!F,W=ie.length;E(()=>{let e=e=>{e.key!==`/`||e.ctrlKey||e.metaKey||e.altKey||Ce(e.target instanceof HTMLElement?e.target:null)||(e.preventDefault(),P(!0),V.current?.focus())},t=e=>{B.current?.contains(e.target instanceof Node?e.target:null)||(I(!0),P(!1))};return document.addEventListener(`keydown`,e),document.addEventListener(`pointerdown`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`pointerdown`,t)}},[]);let ae=e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(!U||W===0)return;e.preventDefault(),re((z+(e.key===`ArrowDown`?1:-1)+W)%W)}else C(e.nativeEvent)?U&&z>=0&&H.current[z]?(e.preventDefault(),H.current[z].click()):_&&d.trim()!==``&&(e.preventDefault(),_(d.trim())):e.key===`Escape`&&(U?(e.preventDefault(),I(!0)):A&&(e.preventDefault(),P(!1)))},G=-1;return H.current=[],/* @__PURE__ */ j(`wui-overflow`,{class:`wui-topsearch-host`,label:o,children:/* @__PURE__ */ j(`div`,{"data-wui-overflow-list":!0,className:`wui-topsearch-row`,children:/* @__PURE__ */ M(`div`,{className:`wui-topsearch${A?` is-open`:``}${m?` is-loading`:``}`,ref:B,"data-overflow-label":y,children:[/* @__PURE__ */ j(`button`,{type:`button`,className:`topbar-icon-btn wui-topsearch-open`,"aria-label":y,"aria-expanded":A,"aria-controls":`${c}-panel`,onClick:()=>{let e=!A;P(e),e&&V.current?.focus()},children:/* @__PURE__ */ j(h,{name:`search`,size:20})}),/* @__PURE__ */ M(`div`,{className:`wui-topsearch-panel`,id:`${c}-panel`,children:[/* @__PURE__ */ M(`div`,{className:`search-wrap`,children:[/* @__PURE__ */ j(h,{name:`search`,size:18,className:`search-icon`}),/* @__PURE__ */ j(`input`,{ref:V,type:`search`,className:`form-control input search-input`,id:`${c}-input`,placeholder:y+T,"aria-label":y,"aria-keyshortcuts":w===void 0?void 0:`Control+${w} Meta+${w}`,role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":U,"aria-controls":`${c}-list`,"aria-activedescendant":U&&z>=0?`${c}-opt-${z}`:void 0,autoComplete:`off`,value:d,onChange:e=>{I(!1),f?.(e.target.value)},onKeyDown:ae,onFocus:v})]}),/* @__PURE__ */ j(`div`,{className:`wui-topsearch-results`,id:`${c}-list`,role:`listbox`,"aria-label":t,hidden:!U,children:U&&/* @__PURE__ */ M(`div`,{className:`wui-topsearch-groups`,role:`presentation`,children:[W===0&&/* @__PURE__ */ j(`div`,{className:`wui-topsearch-empty`,role:`option`,"aria-disabled":`true`,"aria-selected":`false`,children:N(r,{value:d})}),p.filter(e=>e.hits?.length).map((e,t)=>/* @__PURE__ */ M(`div`,{className:`wui-topsearch-group`,role:`group`,"aria-label":e.label??``,children:[e.label&&/* @__PURE__ */ j(`div`,{className:`wui-topsearch-group-label`,role:`presentation`,children:e.label}),e.hits.map(e=>{G+=1;let t=G;return/* @__PURE__ */ M(`a`,{className:`wui-topsearch-hit${t===z?` is-active`:``}`,role:`option`,"aria-selected":t===z,id:`${c}-opt-${t}`,href:e.href,ref:e=>{H.current[t]=e},onClick:t=>g?.(e,t),children:[e.icon&&/* @__PURE__ */ j(`span`,{className:`wui-topsearch-hit-icon`,children:/* @__PURE__ */ j(h,{name:e.icon,size:18})}),/* @__PURE__ */ M(`span`,{className:`wui-topsearch-hit-text`,children:[/* @__PURE__ */ j(`span`,{className:`wui-topsearch-hit-title`,children:e.title}),e.subtitle&&/* @__PURE__ */ j(`span`,{className:`wui-topsearch-hit-sub`,children:e.subtitle})]})]},`${e.href}-${t}`)})]},e.label??t))]})})]}),/* @__PURE__ */ j(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:U?W===0?n:N(W===1?a:i,{count:W}):``})]})})})}export{ue as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";import{linkTarget as t}from"../lib/linkTarget.js";import{navMatchScore as n}from"../lib/navMatch.js";import{SHELL_FOLDED_COOKIE as r,readNavFolded as i,readShellCollapsed as a,writeNavFolded as o,writeShellCollapsed as s}from"../lib/shellCookie.js";import{TargetLink as c}from"../lib/TargetLink.js";import l from"../lib/useElementEntry.js";import u from"../lib/useWuiText.js";import{TONES as d}from"../lib/vocabulary.js";import{splitMarkerProps as f}from"../lib/wuiMarker.js";import p from"./AppAvatar.js";import m from"./AppButton.js";import h from"./AppIcon.js";import g from"./AppNavigationMenu.js";import _ from"./AppNotificationCenter.js";import v from"./assertValidValue.js";import y from"./warnUnknownProps.js";import{IST_TIME_ZONE as b,initScrollEdges as x,isApplePlatform as S,isCommandChord as C,isImeSafeEnter as w,revealActiveNavItem as T,setPopoverOpen as E}from"@webority/ui-elements/helpers";import{useEffect as D,useId as ee,useMemo as O,useRef as k,useState as A}from"react";import{Fragment as j,jsx as M,jsxs as N}from"react/jsx-runtime";import{SHELL_TEXT as te,fillText as P}from"@webority/ui-elements/text";var ne=()=>import(`@webority/ui-elements/elements/overflow`),F=()=>import(`@webority/ui-elements/elements/dropdown`),I=99,L=4,R=5,z=/^[a-z0-9-]+$/,B=`wui-sidebar-footer`,re=[],V=[`prefix`,`exact`],H=[`comfortable`,`compact`],ie=[`default`,`none`,`compact`],U=[`neutral`,`primary`],W=[`default`,`brand`],ae=[`side`,`top`],G=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],oe=/* @__PURE__ */ new Set([`key`,`label`,`icon`,`iconVariant`,`iconSize`,`href`,`badge`,`badgeTone`,`badgeTitle`,`newUntil`,`trailingIcon`,`active`,`match`,`matchAlso`,`tab`,`tabLabel`,`children`,`header`,`description`]),se=new Intl.DateTimeFormat(`en-CA`,{timeZone:b}),ce=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:se.format(/* @__PURE__ */ new Date)<=e},le=({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(` `)},ue=({logoLight:e,logoDark:t,markLight:n,markDark:r,brandName:i,logoLightWidth:a,logoLightHeight:o,logoDarkWidth:s,logoDarkHeight:c,markLightWidth:l,markLightHeight:u,markDarkWidth:d,markDarkHeight:f})=>{let p=i??``,m=[e&&/* @__PURE__ */ M(`img`,{className:`wui-brand-logo wui-brand-light`,src:e,alt:p,width:a,height:o},`logo-light`),t&&/* @__PURE__ */ M(`img`,{className:`wui-brand-logo wui-brand-dark`,src:t,alt:``,"aria-hidden":`true`,width:s,height:c},`logo-dark`)],h=[n&&[`mark-light`,`wui-brand-mark wui-brand-light`,n,l,u],r&&[`mark-dark`,`wui-brand-mark wui-brand-dark`,r,d,f]].filter(e=>!!e).map(([t,n,r,i,a],o)=>o===0&&!e?/* @__PURE__ */ M(`img`,{className:n,src:r,alt:p,width:i,height:a},t):/* @__PURE__ */ M(`img`,{className:n,src:r,alt:``,"aria-hidden":`true`,width:i,height:a},t));return[...m,...h].filter(Boolean)};function de(e){let{marker:t,props:n}=f(`AppShell`,e),c=u(`shell`,te),{groups:l=[],brand:d,logoLight:p,logoDark:m,markLight:b,markDark:S,logoLightWidth:C,logoLightHeight:w,logoDarkWidth:ee,logoDarkHeight:P,markLightWidth:ne,markLightHeight:F,markDarkWidth:I,markDarkHeight:L,brandName:R,brandHref:z,brandLabel:B,sidebarStart:V,sidebarStartCompact:oe,sidebarFooter:se,sidebarFooterItems:ce=re,topbarStart:de,topbarEnd:pe,footer:K,launcher:me,children:he,collapsed:q,onCollapsedChange:ve,noSidebar:Y=!1,nav:X=`side`,topNavDetail:we=!1,capBadges:Te=!1,density:Ee=`comfortable`,contentPaddingBottom:De=`default`,itemHeight:Oe,iconVariant:ke=`twotone`,topbarTone:Ae=`neutral`,tone:je=`default`,navLabel:Me=c.navLabel,linkComponent:Z,currentPath:Ne,rememberCollapsed:Pe=!1,collapsedCookie:Fe=`wui-shell-collapsed`,foldedCookie:Ie=r,tabBarLabel:Le=c.tabBarLabel,moreLabel:Re=c.moreLabel,skipLabel:ze=c.skipLabel,openNavLabel:Be=c.openNavLabel,expandNavLabel:Ve=c.expandNavLabel,collapseNavLabel:He=c.collapseNavLabel,newLabel:Ue=c.newLabel,togglePagesLabel:We=c.togglePagesLabel,accountMenuLabel:Ge=c.accountMenuLabel,roleLabel:Ke=c.roleLabel,rolesLabel:qe=c.rolesLabel,searchResultsLabel:Je=c.searchResultsLabel,noResultsText:Ye=c.noResultsText,noResultsForText:Xe=c.noResultsForText,resultsCountText:Ze=c.resultsCountText,resultCountText:Qe=c.resultCountText,userMenu:$e,notifications:et,search:tt,className:nt=``,style:rt,...it}=n;if(y(`AppShell`,it),v(`AppShell`,`density`,Ee,H),v(`AppShell`,`contentPaddingBottom`,De,ie),v(`AppShell`,`topbarTone`,Ae,U),v(`AppShell`,`tone`,je,W),v(`AppShell`,`nav`,X,ae),v(`AppShell`,`iconVariant`,ke,G),B!==void 0&&!z)throw Error(`<AppShell> brandLabel names the brand link, so it needs brandHref.`);if(z){if(!B&&!R)throw Error(`<AppShell> brandHref needs brandLabel or brandName: the collapsed rail hides the logo, so the link would have no accessible name.`);if(!(d||p||m||b||S))throw Error(`<AppShell> brandHref has no brand, logo or mark to link.`)}let at=(Oe??0)>0?{...rt,"--wui-nav-item-height":`${Oe}px`}:rt,[ot,st]=A(()=>Pe&&q===void 0&&typeof document<`u`?a(Fe)??!1:!1),[ct,Q]=A(!1),lt=k(null),[ut,dt]=A(!1),[ft,pt]=A(!1),mt=k(null),ht=q??ot,gt=e=>z?/* @__PURE__ */ M(ye,{href:z,label:B||R,linkComponent:Z,onNavigate:()=>Q(!1),children:e}):e,_t=()=>{let e=!ht;q===void 0&&st(e),Pe&&s(e,Fe),ve?.(e)},vt=l.some(e=>e.collapsible),[yt,bt]=A(()=>vt&&typeof document<`u`?i(Ie):/* @__PURE__ */ new Set),xt=e=>{let t=new Set(yt);t.has(e)?t.delete(e):t.add(e),bt(t),o(t,Ie)},St=O(()=>fe(l,ce,Ne),[l,ce,Ne]),$=St.groups,Ct=St.footer,wt=Y?null:ge($,Ct.some(e=>e.active));D(()=>{let e=()=>dt(window.scrollY>4);return e(),window.addEventListener(`scroll`,e,{passive:!0}),()=>window.removeEventListener(`scroll`,e)},[]),D(()=>{x()},[]),D(()=>{T(mt.current)},[]),D(()=>{let e=mt.current;if(!e)return;let t=()=>pt($.length>0&&e.scrollHeight>e.clientHeight);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[$]),D(()=>{let e=lt.current;if(!e)return;let t=window.matchMedia(`(max-width: 991.98px)`),n=()=>{t.matches?e.setAttribute(`popover`,`auto`):(e.removeAttribute(`popover`),Q(!1))},r=e=>Q(`newState`in e&&e.newState===`open`);return n(),t.addEventListener(`change`,n),e.addEventListener(`toggle`,r),()=>{t.removeEventListener(`change`,n),e.removeEventListener(`toggle`,r)}},[]),D(()=>{let e=lt.current;e?.hasAttribute(`popover`)&&E(e,ct)},[ct]);let Tt=[`app-shell`,ht?`collapsed`:``,Y?`no-sidebar`:``,X===`top`?`wui-shell-top`:``,ct?`mobile-open`:``,nt].filter(Boolean).join(` `);return/* @__PURE__ */ N(`div`,{className:Tt,"data-density":Ee===`compact`?`compact`:void 0,"data-content-padding-bottom":De==="default"?void 0:De,"data-shell-tone":je===`brand`?`brand`:void 0,"data-wui-folded-cookie":vt?Ie:void 0,style:at,...t,...it,children:[/* @__PURE__ */ M(`a`,{className:`wui-skip-link`,href:`#main-content`,children:ze}),/* @__PURE__ */ N(`aside`,{className:`app-sidebar`,ref:lt,children:[(d||p||m||b||S)&&/* @__PURE__ */ M(`div`,{className:le({logoLight:p,logoDark:m,markLight:b,markDark:S}),children:gt(/* @__PURE__ */ N(j,{children:[ue({logoLight:p,logoDark:m,markLight:b,markDark:S,brandName:R,logoLightWidth:C,logoLightHeight:w,logoDarkWidth:ee,logoDarkHeight:P,markLightWidth:ne,markLightHeight:F,markDarkWidth:I,markDarkHeight:L}),d]}))}),V&&/* @__PURE__ */ M(`div`,{className:`app-sidebar-start`,children:V}),oe&&/* @__PURE__ */ M(`div`,{className:`app-sidebar-start-compact`,children:oe}),/* @__PURE__ */ M(`nav`,{className:`app-sidebar-scroll`,"aria-label":Me,ref:mt,tabIndex:ft?0:void 0,children:$.map((e,t)=>{let n=e.items.map(e=>e.header==null?/* @__PURE__ */ M(xe,{item:e,linkComponent:Z,onNavigate:()=>Q(!1),iconVariant:ke,newLabel:Ue,togglePagesLabel:We,capBadges:Te},e.key??e.href??e.label):/* @__PURE__ */ M(`div`,{className:`wui-nav-header`,children:e.header},e.key??e.header));if(!e.collapsible)return/* @__PURE__ */ N(`div`,{className:`app-nav-group`,children:[e.label&&/* @__PURE__ */ M(`div`,{className:`app-nav-group-label`,children:e.label}),n,e.after&&/* @__PURE__ */ M(`div`,{className:`wui-nav-group-after`,children:e.after})]},e.key??e.label??`group-${t}`);let r=!yt.has(e.key??``)||!!J(e.items),i=`wui-nav-group-${e.key}`;return/* @__PURE__ */ N(`div`,{className:`app-nav-group wui-nav-group-collapsible${r?``:` wui-nav-group-folded`}`,"data-wui-nav-group":e.key,children:[/* @__PURE__ */ N(`button`,{type:`button`,className:`app-nav-group-label wui-nav-group-toggle`,"aria-expanded":r,"aria-controls":i,onClick:()=>xt(e.key??``),children:[/* @__PURE__ */ M(`span`,{className:`wui-nav-group-text`,children:e.label}),/* @__PURE__ */ M(`span`,{className:`wui-nav-group-caret`,children:/* @__PURE__ */ M(h,{name:`chevron-down`,size:16})})]}),/* @__PURE__ */ N(`div`,{className:`wui-nav-group-body`,id:i,children:[n,e.after&&/* @__PURE__ */ M(`div`,{className:`wui-nav-group-after`,children:e.after})]})]},e.key??`group-${t}`)})}),(se||Ct.length>0)&&/* @__PURE__ */ N(`div`,{className:`app-sidebar-foot`,children:[Ct.length>0&&/* @__PURE__ */ M(`div`,{className:`wui-sidebar-foot-links`,children:Ct.map(e=>/* @__PURE__ */ M(xe,{item:e,linkComponent:Z,onNavigate:()=>Q(!1),iconVariant:ke,newLabel:Ue,togglePagesLabel:We,capBadges:Te},e.key??e.href??e.label))}),se]}),!Y&&/* @__PURE__ */ M(`button`,{type:`button`,className:`app-sidebar-toggle`,onClick:_t,"aria-label":ht?Ve:He,"aria-expanded":!ht,children:/* @__PURE__ */ M(h,{name:`chevrons-left`,size:20})})]}),/* @__PURE__ */ N(`div`,{className:`app-main`,children:[/* @__PURE__ */ N(`header`,{className:`app-topbar${ut?` wui-scrolled`:``}`,"data-tone":Ae===`primary`?`primary`:void 0,children:[/* @__PURE__ */ N(`div`,{className:`app-topbar-start`,children:[/* @__PURE__ */ M(`button`,{type:`button`,className:`app-topbar-menu`,onClick:()=>Q(!0),"aria-label":Be,"aria-expanded":ct,children:/* @__PURE__ */ M(h,{name:`menu`,size:18})}),X===`top`&&d&&/* @__PURE__ */ M(`div`,{className:`wui-shell-top-brand`,children:gt(d)}),X===`top`&&/* @__PURE__ */ M(`div`,{className:`wui-shell-top-nav`,children:/* @__PURE__ */ M(g,{items:_e($,we),ariaLabel:Me,linkComponent:Z})}),de,tt&&/* @__PURE__ */ M(Ce,{config:tt,searchResultsLabel:Je,noResultsText:Ye,noResultsForText:Xe,resultsCountText:Ze,resultCountText:Qe,moreLabel:Re})]}),/* @__PURE__ */ N(`div`,{className:`app-topbar-end`,children:[pe,et&&/* @__PURE__ */ M(_,{...et}),$e&&/* @__PURE__ */ M(Se,{config:$e,linkComponent:Z,accountMenuLabel:Ge,roleLabel:Ke,rolesLabel:qe})]})]}),/* @__PURE__ */ M(`main`,{className:`app-content`,id:`main-content`,children:he}),K&&/* @__PURE__ */ M(`footer`,{className:`app-footer`,children:K})]}),me&&/* @__PURE__ */ M(`div`,{className:`wui-shell-launcher`,children:me}),wt&&/* @__PURE__ */ N(`nav`,{className:`wui-tabbar`,"aria-label":Le,"data-wui-cap-badges":Te||void 0,children:[wt.tabs.map(e=>/* @__PURE__ */ M(be,{tab:e,linkComponent:Z,iconVariant:ke,capBadges:Te},e.key??e.href)),wt.hasMore&&/* @__PURE__ */ N(`button`,{type:`button`,className:`wui-tabbar-item${wt.moreActive?` active`:``}`,onClick:()=>Q(!0),children:[/* @__PURE__ */ M(`span`,{className:`wui-tabbar-icon`,children:/* @__PURE__ */ M(h,{name:`more`,size:24})}),/* @__PURE__ */ M(`span`,{className:`wui-tabbar-label`,children:Re})]})]})]})}function fe(e,t,r){let i=t;for(let e of i){if(e.children?.length)throw Error(`<AppShell> sidebarFooterItems cannot hold children; keep footer links flat.`);if(e.tab)throw Error(`<AppShell> sidebarFooterItems cannot carry tab: true; the phone tab bar is built from groups.`);if(e.header!=null)throw Error(`<AppShell> sidebarFooterItems cannot hold a header row.`)}for(let t of e)t.collapsible&&q(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:B,items:t}].map(e=>({...e,items:me(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)y(`AppShell items`,pe(e)),v(`AppShell`,`match`,e.match,V),v(`AppShell`,`iconVariant`,e.iconVariant,G),v(`AppShell`,`badgeTone`,e.badgeTone,d);let l=null;if(r!=null&&!s.some(e=>e.active===!0)){let e=-1;for(let t of s){if(t.active!=null||t.children?.length&&!t.href)continue;let i=n(r,t.href,{exact:t.match===`exact`,also:t.matchAlso});if(i<0)continue;let a=t.match===`exact`&&n(r,t.href,{exact:!0})>=0?1/0:i;a>e&&(e=a,l=t)}}for(let e of s)e.active=e.active??e===l;return{groups:o.filter(e=>e.key!==B),footer:o.find(e=>e.key===B)?.items??[]}}function pe(e){return Object.fromEntries(Object.entries(e).filter(([e])=>!oe.has(e)))}var K=e=>e.header!=null;function me(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 he=/* @__PURE__ */ new Set;function q(t){if(t.key!=null&&z.test(t.key))return;let n=t.key==null?`<AppShell> a collapsible group needs a key so its folded state can be remembered.`:`<AppShell> collapsible group key "${t.key}" must use lower-case letters, digits and hyphens.`;typeof process<`u`&&process.env.NODE_ENV===`production`||he.has(n)||(he.add(n),e(n))}function ge(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?L:R;if(i.length>o)throw Error(`<AppShell>: ${i.length} items carry tab: true, but the phone tab bar holds ${o} (${a?`4 plus More, because other items exist`:`5 when every item is a tab`}). Flag fewer items.`);return{tabs:i,hasMore:a,moreActive:t||n.some(e=>!e.tab&&e.active)}}function _e(e,t){let n=e=>{if(e.label===void 0)throw Error(`<AppShell> a navigation row has no label; every row but a header needs one.`);return e.label},r=e=>e.key??e.href??n(e),i=(e,i)=>({key:r(e),label:n(e),to:i,current:!!e.active,...t&&e.description?{description:e.description}:{}}),a=e=>e.flatMap(e=>K(e)?[]:[...e.href?[{...i(e,e.href),icon:e.icon}]:[],...a(e.children??[])]),o=[];for(let s of e)for(let e of s.items){if(K(e))continue;let c=t&&s.label?{group:s.label}:{},l=a(e.children??[]);if(l.length>0){let a=e.href?[{...i(e,e.href),icon:e.icon}]:[],s=t&&(!!e.active||!!J(e.children??[]));o.push({key:r(e),label:n(e),links:[...a,...l],...c,...t?{current:s}:{}})}else e.href&&o.push({...i(e,e.href),...c})}return o}function ve(e,t){return t&&typeof e==`number`&&e>I?`${I}+`:e}function ye({href:e,label:n,linkComponent:r,onNavigate:i,children:a}){return/* @__PURE__ */ M(c,{link:t(r,{to:e}),className:`wui-brand-link`,"aria-label":n,onClick:i,children:a})}function be({tab:e,linkComponent:n,iconVariant:r,capBadges:i}){let a=`wui-tabbar-item${e.active?` active`:``}`,o=/* @__PURE__ */ N(j,{children:[e.icon&&/* @__PURE__ */ M(`span`,{className:`wui-tabbar-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ M(h,{name:e.icon,size:24,variant:e.iconVariant??r}):e.icon}),/* @__PURE__ */ M(`span`,{className:`wui-tabbar-label`,children:e.tabLabel??e.label}),e.badge!=null&&/* @__PURE__ */ M(`span`,{className:`wui-tabbar-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:ve(e.badge,i)}),e.badge!=null&&e.badgeTitle&&/* @__PURE__ */ M(`span`,{className:`visually-hidden`,children:e.badgeTitle})]}),s=e.active?`page`:void 0;return/* @__PURE__ */ M(c,{link:t(n,{to:e.href}),className:a,"aria-current":s,children:o})}function J(e){for(let t of e){if(t.active)return t;let e=t.children?.length?J(t.children):void 0;if(e)return e}}function xe({item:e,linkComponent:n,onNavigate:r,depth:i=0,iconVariant:a,newLabel:o,togglePagesLabel:s,capBadges:l}){let u=i>0,d=i>1?` wui-nav-depth-${Math.min(i,6)}`:``,f=Array.isArray(e.children)&&e.children.length>0,p=f?J(e.children??[]):void 0,m=!!p,g=p?p.key??p.href??p.label:null,[_,v]=A(m);D(()=>{g!=null&&v(!0)},[g]);let y=typeof e.label==`string`?e.label:void 0,b=!u&&e.icon&&/* @__PURE__ */ M(`span`,{className:`app-nav-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ M(h,{name:e.icon,size:e.iconSize??22,variant:e.iconVariant??a}):e.icon}),x=e.badge!=null&&/* @__PURE__ */ M(`span`,{className:`app-nav-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:ve(e.badge,l)}),S=ce(e.newUntil)&&/* @__PURE__ */ M(`span`,{className:`wui-nav-new`,children:o}),C=/* @__PURE__ */ N(j,{children:[b,/* @__PURE__ */ M(`span`,{className:`app-nav-text`,children:e.label}),S,x,e.trailingIcon&&/* @__PURE__ */ M(`span`,{className:`app-nav-trailing`,children:typeof e.trailingIcon==`string`?/* @__PURE__ */ M(h,{name:e.trailingIcon,size:16}):e.trailingIcon})]}),w=e.active?`page`:void 0;if(f){let f=/* @__PURE__ */ M(`div`,{className:`app-nav-sub${_?` expanded`:``}`,inert:!_,"aria-hidden":!_||void 0,children:/* @__PURE__ */ M(`div`,{className:`app-nav-sub-inner`,children:(e.children??[]).map(e=>/* @__PURE__ */ M(xe,{item:e,linkComponent:n,onNavigate:r,depth:i+1,iconVariant:a,newLabel:o,togglePagesLabel:s,capBadges:l},e.key??e.href))})});if(e.href){let i=/* @__PURE__ */ M(c,{link:t(n,{to:e.href}),className:`wui-nav-split-link`,"aria-current":w,onClick:r,children:C});return/* @__PURE__ */ N(j,{children:[/* @__PURE__ */ N(`div`,{className:`app-nav-item has-children wui-nav-split${u?` app-nav-subitem`:``}${m||e.active?` active`:``}${d}`,"data-label":y,children:[i,/* @__PURE__ */ M(`button`,{type:`button`,className:`app-nav-caret wui-nav-split-toggle`,"aria-expanded":_,"aria-label":P(s,{name:y??``}),onClick:()=>v(e=>!e),children:/* @__PURE__ */ M(h,{name:`chevron-right`,size:16})})]}),f]})}return/* @__PURE__ */ N(j,{children:[/* @__PURE__ */ N(`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__ */ M(`span`,{className:`app-nav-text`,children:e.label}),S,x,/* @__PURE__ */ M(`span`,{className:`app-nav-caret`,children:/* @__PURE__ */ M(h,{name:`chevron-right`,size:16})})]}),f]})}let T=`app-nav-item${u?` app-nav-subitem`:``}${e.active?` active`:``}${d}`;return/* @__PURE__ */ M(c,{link:t(n,{to:e.href}),className:T,"aria-current":w,"data-label":y,onClick:r,children:C})}function Y(e){l(`wui-dropdown`,F);let[t,n]=A(!1),r=k(null);return D(()=>{r.current?.toggleAttribute(`open`,t)},[t]),D(()=>{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 Se({config:e,linkComponent:n,accountMenuLabel:r,roleLabel:i,rolesLabel:a}){let o=u(`shell`,te),s=ee(),{open:l,setOpen:d,ref:f}=Y(),{name:g,role:_,roles:y=[],noTriggerRole:b=!1,outlined:x=!1,photo:S,profileHref:C,profileLabel:w=o.profileLabel,onLogout:T,logoutAction:E,logoutLabel:D=o.logoutLabel,head:O,section:k,logoutVariant:A=`item`,items:ne=[]}=e;if(v(`AppShell`,`userMenu.logoutVariant`,A,[`item`,`button`]),!g)throw Error(`<AppShell> userMenu.name is required; the trigger and the avatar are named from it.`);let F=y.map(e=>(e??``).trim()).filter(Boolean),I=()=>d(!1),L=(e,r,i,a)=>/* @__PURE__ */ M(c,{link:t(n,{to:e}),className:`dropdown-item`,onClick:a,children:r},i),R=/* @__PURE__ */ M(h,{name:`log-out`,size:18}),z=/* @__PURE__ */ N(j,{children:[R,D]});return/* @__PURE__ */ N(`wui-dropdown`,{class:`dropdown wui-usermenu`,align:`end`,ref:f,children:[/* @__PURE__ */ N(`button`,{type:`button`,id:s,className:x?`wui-usermenu-trigger wui-usermenu-trigger-outlined`:`wui-usermenu-trigger`,"data-wui-dropdown-trigger":!0,"aria-expanded":l,"aria-label":P(r,{name:g}),children:[/* @__PURE__ */ M(p,{name:g,src:S,tone:`auto`}),/* @__PURE__ */ N(`span`,{className:`wui-usermenu-text`,children:[/* @__PURE__ */ M(`span`,{className:`wui-usermenu-name`,children:g}),_&&!b&&/* @__PURE__ */ M(`span`,{className:`wui-usermenu-role`,children:_})]}),/* @__PURE__ */ M(h,{name:`chevron-down`,size:14,className:`wui-usermenu-caret`})]}),/* @__PURE__ */ N(`div`,{"data-wui-dropdown-menu":!0,popover:`auto`,className:`dropdown-menu dropdown-menu-end wui-usermenu-menu${l?` show`:``}`,"aria-labelledby":s,children:[/* @__PURE__ */ N(`div`,{className:`wui-usermenu-head`,children:[/* @__PURE__ */ M(p,{name:g,src:S,size:`lg`,tone:`auto`}),/* @__PURE__ */ N(`div`,{className:`wui-usermenu-who`,children:[/* @__PURE__ */ M(`div`,{className:`wui-usermenu-name`,children:g}),_&&/* @__PURE__ */ M(`div`,{className:`wui-usermenu-role`,children:_}),F.length>0&&/* @__PURE__ */ N(`div`,{className:`wui-usermenu-roles`,children:[/* @__PURE__ */ M(`span`,{className:`wui-usermenu-roles-label`,children:F.length===1?i:a}),` ${F.join(`, `)}`]}),O?/* @__PURE__ */ M(`div`,{className:`wui-usermenu-extra`,children:O}):null]})]}),k?/* @__PURE__ */ M(`div`,{className:`wui-usermenu-section`,children:k}):null,C&&L(C,/* @__PURE__ */ N(j,{children:[/* @__PURE__ */ M(h,{name:`user`,size:18}),w]}),void 0,I),ne.map(e=>{if(e.divider)return/* @__PURE__ */ M(`hr`,{className:`dropdown-divider`},e.key);let t=/* @__PURE__ */ N(j,{children:[e.icon&&/* @__PURE__ */ M(h,{name:e.icon,size:18}),e.label]}),n=()=>{e.onClick?.(),I()};return e.href?L(e.href,t,e.key,n):/* @__PURE__ */ M(`button`,{type:`button`,className:`dropdown-item`,onClick:n,children:t},e.key)}),A===`button`?(E||T)&&/* @__PURE__ */ M(`div`,{className:`wui-usermenu-foot`,children:E?/* @__PURE__ */ M(`form`,{method:`post`,action:E,className:`wui-usermenu-logout`,children:/* @__PURE__ */ N(m,{type:`submit`,tone:`danger`,variant:`soft`,block:!0,children:[/* @__PURE__ */ M(`span`,{className:`d-inline-flex me-2`,children:R}),D]})}):/* @__PURE__ */ N(m,{type:`button`,tone:`danger`,variant:`soft`,block:!0,onClick:()=>{I(),T?.()},children:[/* @__PURE__ */ M(`span`,{className:`d-inline-flex me-2`,children:R}),D]})}):E?/* @__PURE__ */ M(`form`,{method:`post`,action:E,className:`wui-usermenu-logout`,children:/* @__PURE__ */ M(`button`,{type:`submit`,className:`dropdown-item danger`,children:z})}):T&&/* @__PURE__ */ M(`button`,{type:`button`,className:`dropdown-item danger`,onClick:()=>{I(),T()},children:z})]})]})}var X=e=>!!e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName));function Ce({config:e,searchResultsLabel:t,noResultsText:n,noResultsForText:r,resultsCountText:i,resultCountText:a,moreLabel:o}){l(`wui-overflow`,ne);let s=u(`shell`,te),c=ee(),{value:d=``,onChange:f,results:p=null,loading:m=!1,onSelect:g,onSubmit:_,onFocus:v,placeholder:y=s.placeholder,shortcutKey:b}=e;if(b!==void 0&&!/^[a-z]$/.test(b))throw Error(`<AppShell>: search shortcutKey must be one letter, a to z; got "${b}".`);let x=b?.toUpperCase(),T=x===void 0?``:` (${S()?`⌘${x}`:`Ctrl+${x}`})`;D(()=>{if(b===void 0)return;let e=e=>{C(e,b)&&(e.preventDefault(),j(!0),V.current?.focus(),V.current?.select())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[b]);let[E,j]=A(!1),[F,I]=A(!1),[L,R]=A({results:null,index:-1}),z=L.results===p?L.index:-1,B=e=>R({results:p,index:e}),re=k(null),V=k(null),H=k([]),ie=O(()=>(p??[]).flatMap(e=>e.hits??[]),[p]),U=p!=null&&!F,W=ie.length;D(()=>{let e=e=>{e.key!==`/`||e.ctrlKey||e.metaKey||e.altKey||X(e.target instanceof HTMLElement?e.target:null)||(e.preventDefault(),j(!0),V.current?.focus())},t=e=>{re.current?.contains(e.target instanceof Node?e.target:null)||(I(!0),j(!1))};return document.addEventListener(`keydown`,e),document.addEventListener(`pointerdown`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`pointerdown`,t)}},[]);let ae=e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(!U||W===0)return;e.preventDefault(),B((z+(e.key===`ArrowDown`?1:-1)+W)%W)}else w(e.nativeEvent)?U&&z>=0&&H.current[z]?(e.preventDefault(),H.current[z].click()):_&&d.trim()!==``&&(e.preventDefault(),_(d.trim())):e.key===`Escape`&&(U?(e.preventDefault(),I(!0)):E&&(e.preventDefault(),j(!1)))},G=-1;return H.current=[],/* @__PURE__ */ M(`wui-overflow`,{class:`wui-topsearch-host`,label:o,children:/* @__PURE__ */ M(`div`,{"data-wui-overflow-list":!0,className:`wui-topsearch-row`,children:/* @__PURE__ */ N(`div`,{className:`wui-topsearch${E?` is-open`:``}${m?` is-loading`:``}`,ref:re,"data-overflow-label":y,children:[/* @__PURE__ */ M(`button`,{type:`button`,className:`topbar-icon-btn wui-topsearch-open`,"aria-label":y,"aria-expanded":E,"aria-controls":`${c}-panel`,onClick:()=>{let e=!E;j(e),e&&V.current?.focus()},children:/* @__PURE__ */ M(h,{name:`search`,size:20})}),/* @__PURE__ */ N(`div`,{className:`wui-topsearch-panel`,id:`${c}-panel`,children:[/* @__PURE__ */ N(`div`,{className:`search-wrap`,children:[/* @__PURE__ */ M(h,{name:`search`,size:18,className:`search-icon`}),/* @__PURE__ */ M(`input`,{ref:V,type:`search`,className:`form-control input search-input`,id:`${c}-input`,placeholder:y+T,"aria-label":y,"aria-keyshortcuts":x===void 0?void 0:`Control+${x} Meta+${x}`,role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":U,"aria-controls":`${c}-list`,"aria-activedescendant":U&&z>=0?`${c}-opt-${z}`:void 0,autoComplete:`off`,value:d,onChange:e=>{I(!1),f?.(e.target.value)},onKeyDown:ae,onFocus:v})]}),/* @__PURE__ */ M(`div`,{className:`wui-topsearch-results`,id:`${c}-list`,role:`listbox`,"aria-label":t,hidden:!U,children:U&&/* @__PURE__ */ N(`div`,{className:`wui-topsearch-groups`,role:`presentation`,children:[W===0&&/* @__PURE__ */ M(`div`,{className:`wui-topsearch-empty`,role:`option`,"aria-disabled":`true`,"aria-selected":`false`,children:P(r,{value:d})}),p.filter(e=>e.hits?.length).map((e,t)=>/* @__PURE__ */ N(`div`,{className:`wui-topsearch-group`,role:`group`,"aria-label":e.label??``,children:[e.label&&/* @__PURE__ */ M(`div`,{className:`wui-topsearch-group-label`,role:`presentation`,children:e.label}),e.hits.map(e=>{G+=1;let t=G;return/* @__PURE__ */ N(`a`,{className:`wui-topsearch-hit${t===z?` is-active`:``}`,role:`option`,"aria-selected":t===z,id:`${c}-opt-${t}`,href:e.href,ref:e=>{H.current[t]=e},onClick:t=>g?.(e,t),children:[e.icon&&/* @__PURE__ */ M(`span`,{className:`wui-topsearch-hit-icon`,children:/* @__PURE__ */ M(h,{name:e.icon,size:18})}),/* @__PURE__ */ N(`span`,{className:`wui-topsearch-hit-text`,children:[/* @__PURE__ */ M(`span`,{className:`wui-topsearch-hit-title`,children:e.title}),e.subtitle&&/* @__PURE__ */ M(`span`,{className:`wui-topsearch-hit-sub`,children:e.subtitle})]})]},`${e.href}-${t}`)})]},e.label??t))]})})]}),/* @__PURE__ */ M(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:U?W===0?n:P(W===1?a:i,{count:W}):``})]})})})}export{de as default};
@@ -1 +1 @@
1
- import{linkTarget as e}from"../lib/linkTarget.js";import{TargetLink as t}from"../lib/TargetLink.js";import n from"../lib/useWuiText.js";import{TONES as r}from"../lib/vocabulary.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./AppIcon.js";import o from"./assertValidValue.js";import s from"./warnUnknownProps.js";import{deriveStepStatus as c,stepperHeaderItems as l}from"@webority/ui-elements/helpers";import{Fragment as u,jsx as d,jsxs as f}from"react/jsx-runtime";import{STEPPER_TEXT as p,fillText as m}from"@webority/ui-elements/text";var h=[`steps`,`journey`],g=[`horizontal`,`vertical`],_=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],v=[`sm`,`md`,`lg`],y=r.filter(e=>e===`primary`||e===`info`),b={sm:12,md:14,lg:18},x=[`done`,`active`,`pending`,`error`];function S(r){let{marker:S,props:C}=i(`AppStepper`,r),w=n(`stepper`,p),{steps:T=[],variant:E=`steps`,orientation:D=`horizontal`,iconVariant:O,size:k=`md`,iconSize:A,active:j,onStepClick:M,label:N=w.label,stepLabel:P=w.stepLabel,tone:F=`primary`,linkComponent:I,className:L=``,...R}=C;s(`AppStepper`,R),o(`AppStepper`,`variant`,E,h),o(`AppStepper`,`orientation`,D,g),o(`AppStepper`,`iconVariant`,O,_),o(`AppStepper`,`size`,k,v),o(`AppStepper`,`tone`,F,y);let z=A!==void 0&&A>0?A:b[k];for(let e of T)o(`AppStepper`,`steps[].status`,e.status,x);let B=E===`journey`,V=[`stepper`,B&&`stepper-journey`,D===`vertical`&&`stepper-vertical`,k!==`md`&&v.includes(k)&&`wui-step-size-${k}`,F!==`primary`&&y.includes(F)&&`wui-step-tone-${F}`,L].filter(Boolean).join(` `),H=l(T,{statusOf:e=>{let t=T[e];if(!t)throw Error(`AppStepper: no step at index ${e}`);return t.status||c(e,j)},journey:B,connectors:!0});return/* @__PURE__ */ d(`nav`,{className:V,"aria-label":N,...S,...R,children:H.map(n=>{let r=n.index,i=T[r];if(!i)throw Error(`AppStepper: no step at index ${r}`);let o=n.className,s=n.glyph.number;n.glyph.icon&&(s=/* @__PURE__ */ d(a,{name:n.glyph.icon,size:z,variant:O}));let c=/* @__PURE__ */ f(u,{children:[/* @__PURE__ */ d(`span`,{className:`step-circle`,children:s}),B?/* @__PURE__ */ f(`span`,{className:`step-text`,children:[/* @__PURE__ */ d(`span`,{className:`step-index`,children:m(P,{number:r+1})}),/* @__PURE__ */ d(`span`,{className:`step-label`,children:i.label}),i.description?/* @__PURE__ */ d(`span`,{className:`step-desc`,children:i.description}):null]}):/* @__PURE__ */ f(u,{children:[/* @__PURE__ */ d(`span`,{className:`step-label`,children:i.label}),i.description?/* @__PURE__ */ d(`span`,{className:`step-desc`,children:i.description}):null]})]}),l=n.current?`step`:void 0,p=i.key??`${i.label}-${r}`,h;if(M)h=/* @__PURE__ */ d(`button`,{type:`button`,className:o,"aria-current":l,onClick:()=>M(i,r),children:c},p);else if(i.href){let n=e(I,{href:i.href});h=/* @__PURE__ */ d(t,{link:n,className:o,"aria-current":l,children:c},p)}else h=/* @__PURE__ */ d(`div`,{className:o,"aria-current":l,children:c},p);return n.line?[h,/* @__PURE__ */ d(`span`,{className:`step-line${n.line.done?` done`:``}`,"aria-hidden":`true`},`${p}-line`)]:h})})}export{S as default};
1
+ import{linkTarget as e}from"../lib/linkTarget.js";import{TargetLink as t}from"../lib/TargetLink.js";import n from"../lib/useStickyLayer.js";import r from"../lib/useWuiText.js";import{TONES as i}from"../lib/vocabulary.js";import{splitMarkerProps as a}from"../lib/wuiMarker.js";import o from"./AppIcon.js";import s from"./assertValidValue.js";import c from"./warnUnknownProps.js";import{deriveStepStatus as l,stepperHeaderItems as u}from"@webority/ui-elements/helpers";import{useRef as d}from"react";import{Fragment as f,jsx as p,jsxs as m}from"react/jsx-runtime";import{STEPPER_TEXT as h,fillText as g}from"@webority/ui-elements/text";var _=[`steps`,`journey`],v=[`horizontal`,`vertical`],y=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],b=[`sm`,`md`,`lg`],x=i.filter(e=>e===`primary`||e===`info`),S={sm:12,md:14,lg:18},C=[`done`,`active`,`pending`,`error`];function w(i){let{marker:w,props:T}=a(`AppStepper`,i),E=r(`stepper`,h),{steps:D=[],variant:O=`steps`,orientation:k=`horizontal`,sticky:A=!1,iconVariant:j,size:M=`md`,iconSize:N,active:P,onStepClick:F,label:I=E.label,stepLabel:L=E.stepLabel,tone:R=`primary`,linkComponent:z,className:B=``,...V}=T,H=d(null);n(H,A),c(`AppStepper`,V),s(`AppStepper`,`variant`,O,_),s(`AppStepper`,`orientation`,k,v),s(`AppStepper`,`iconVariant`,j,y),s(`AppStepper`,`size`,M,b),s(`AppStepper`,`tone`,R,x);let U=N!==void 0&&N>0?N:S[M];for(let e of D)s(`AppStepper`,`steps[].status`,e.status,C);let W=O===`journey`,G=[`stepper`,W&&`stepper-journey`,k===`vertical`&&`stepper-vertical`,A&&`wui-stepper-sticky`,M!==`md`&&b.includes(M)&&`wui-step-size-${M}`,R!==`primary`&&x.includes(R)&&`wui-step-tone-${R}`,B].filter(Boolean).join(` `),K=u(D,{statusOf:e=>{let t=D[e];if(!t)throw Error(`AppStepper: no step at index ${e}`);return t.status||l(e,P)},journey:W,connectors:!0});return/* @__PURE__ */ p(`nav`,{ref:H,className:G,"aria-label":I,"data-wui-sticky-layer":A?``:void 0,...w,...V,children:K.map(n=>{let r=n.index,i=D[r];if(!i)throw Error(`AppStepper: no step at index ${r}`);let a=n.className,s=n.glyph.number;n.glyph.icon&&(s=/* @__PURE__ */ p(o,{name:n.glyph.icon,size:U,variant:j}));let c=/* @__PURE__ */ m(f,{children:[/* @__PURE__ */ p(`span`,{className:`step-circle`,children:s}),W?/* @__PURE__ */ m(`span`,{className:`step-text`,children:[/* @__PURE__ */ p(`span`,{className:`step-index`,children:g(L,{number:r+1})}),/* @__PURE__ */ p(`span`,{className:`step-label`,children:i.label}),i.description?/* @__PURE__ */ p(`span`,{className:`step-desc`,children:i.description}):null]}):/* @__PURE__ */ m(f,{children:[/* @__PURE__ */ p(`span`,{className:`step-label`,children:i.label}),i.description?/* @__PURE__ */ p(`span`,{className:`step-desc`,children:i.description}):null]})]}),l=n.current?`step`:void 0,u=i.key??`${i.label}-${r}`,d;if(F)d=/* @__PURE__ */ p(`button`,{type:`button`,className:a,"aria-current":l,onClick:()=>F(i,r),children:c},u);else if(i.href){let n=e(z,{href:i.href});d=/* @__PURE__ */ p(t,{link:n,className:a,"aria-current":l,children:c},u)}else d=/* @__PURE__ */ p(`div`,{className:a,"aria-current":l,children:c},u);return n.line?[d,/* @__PURE__ */ p(`span`,{className:`step-line${n.line.done?` done`:``}`,"aria-hidden":`true`},`${u}-line`)]:d})})}export{w as default};
@@ -1 +1 @@
1
- import{linkTarget as e}from"../lib/linkTarget.js";import{TargetLink as t}from"../lib/TargetLink.js";import n from"../lib/useElementEntry.js";import r from"../lib/useWuiText.js";import{TONES as i}from"../lib/vocabulary.js";import{splitMarkerProps as a}from"../lib/wuiMarker.js";import o from"./AppIcon.js";import s from"./AppTooltip.js";import c from"./assertValidValue.js";import l from"./renderIconProp.js";import u from"./warnUnknownProps.js";import{formatNumber as ee}from"@webority/ui-elements/helpers";import{cloneElement as te,useCallback as d,useEffect as f,useLayoutEffect as p,useRef as m,useState as ne}from"react";import{Fragment as re,jsx as h,jsxs as g}from"react/jsx-runtime";import{TABS_TEXT as ie}from"@webority/ui-elements/text";var _=[`underline`,`pills`],v=[`horizontal`,`vertical`],y=[`sm`,`md`,`lg`],ae={sm:16,md:18,lg:20},oe=[`automatic`,`manual`],se=[`scroll`,`menu`],ce=i.filter(e=>e!==`primary`&&e!==`neutral`),le=()=>import(`@webority/ui-elements/elements/overflow`),b=1,ue=28,de=.7;function x(i){let{marker:x,props:fe}=a(`AppTabs`,i),S=r(`tabs`,ie),{tabs:C,value:w,onChange:T,linkComponent:E,variant:D=`underline`,orientation:O=`horizontal`,size:k=`md`,fitted:pe=!1,overflow:A=`scroll`,moreLabel:me=S.moreLabel,maxVisible:he,activation:j=`automatic`,ariaLabel:M,className:N=``,style:P,...F}=fe;n(`wui-overflow`,le),u(`AppTabs`,F),c(`AppTabs`,`variant`,D,_),c(`AppTabs`,`orientation`,O,v),c(`AppTabs`,`size`,k,y),c(`AppTabs`,`activation`,j,oe),c(`AppTabs`,`overflow`,A,se);for(let e of C)if(c(`AppTabs`,`tabs[].tone`,e.tone,ce),e.countPending&&(e.count!=null||e.countLabel))throw Error(`<AppTabs> tab "${e.key}" sets countPending with count or countLabel: a pending badge is empty, so it takes neither.`);let I=m(null),L=m(null),R=O===`vertical`,z=(A===`menu`||he!=null)&&!R,B=ae[k],[V,H]=ne(w);f(()=>{H(w)},[w]);let ge=C.find(e=>!e.disabled)?.key,_e=C.some(e=>e.key===V&&!e.disabled)?V:void 0,ve=C.some(e=>e.key===w&&!e.disabled)?w:void 0,ye=_e??ve??ge,be=e=>{I.current?.querySelector(`[data-key="${CSS.escape(String(e))}"]`)?.focus()},U=d(()=>{let e=I.current,t=L.current;if(!e||!t||R||z)return;let n=e.scrollWidth-e.clientWidth;t.classList.toggle(`is-overflow-start`,e.scrollLeft>b),t.classList.toggle(`is-overflow-end`,n>b&&e.scrollLeft<n-b)},[R,z]),W=d(()=>{let e=I.current;if(!e)return;let t=e.querySelector(`.app-tab.active`);t?(R?(e.style.setProperty(`--wui-tab-y`,`${t.offsetTop}px`),e.style.setProperty(`--wui-tab-h`,`${t.offsetHeight}px`)):(e.style.setProperty(`--wui-tab-x`,`${t.offsetLeft}px`),e.style.setProperty(`--wui-tab-w`,`${t.offsetWidth}px`)),e.toggleAttribute(`data-active-danger`,!!C.find(e=>e.key===w)?.danger)):e.style.setProperty(R?`--wui-tab-h`:`--wui-tab-w`,`0px`),e.setAttribute(`data-wui-tabs`,``),U()},[R,C,w,U]),G=e=>!z||!I.current?.querySelector(`[data-key="${CSS.escape(String(e))}"][data-wui-overflow-hidden]`),K=d(e=>{let t=I.current;if(!t||R)return;let n=t.querySelector(`.app-tab[data-key="${CSS.escape(e)}"]`);if(!n)return;let r=ue,i=n.offsetLeft,a=i+n.offsetWidth;i-r<t.scrollLeft?t.scrollLeft=Math.max(0,i-r):a+r>t.scrollLeft+t.clientWidth&&(t.scrollLeft=a+r-t.clientWidth)},[R]);p(()=>{W()},[W]),p(()=>{K(w)},[w,K]);let q=m(W);f(()=>{q.current=W},[W]),f(()=>{if(!document.fonts)return;let e=!0;return document.fonts.ready.then(()=>{e&&q.current()}),()=>{e=!1}},[]);let J=m(null),Y=d(e=>{if(typeof ResizeObserver>`u`)return;let t=J.current??{ro:new ResizeObserver(()=>q.current()),count:0};return J.current=t,t.ro.observe(e),t.count+=1,()=>{t.ro.unobserve(e),--t.count,t.count===0&&(t.ro.disconnect(),J.current===t&&(J.current=null))}},[]),X=d(e=>{I.current=e;let t=e?Y(e):void 0;return()=>{I.current=null,t?.()}},[Y]),Z=d(e=>{L.current=e;let t=e?Y(e):void 0;return()=>{L.current=null,t?.()}},[Y]);f(()=>{let e=L.current;if(!z||!e)return;let t=()=>q.current();return e.addEventListener(`wui-overflow-change`,t),()=>e.removeEventListener(`wui-overflow-change`,t)},[z]);function xe(e){let t=e.target instanceof HTMLElement?e.target.dataset.key:void 0;if(t==null)return;let n=C.findIndex(e=>e.key===t);if(n<0)return;let r=C.length,i=(e,t)=>{for(let n=1;n<=r;n++){let i=C[((e+t*n)%r+r)%r];if(i&&!i.disabled&&G(i.key))return i}return null},a=getComputedStyle(e.currentTarget).direction===`rtl`,o=R?`ArrowDown`:a?`ArrowLeft`:`ArrowRight`,s=R?`ArrowUp`:a?`ArrowRight`:`ArrowLeft`,c=null;if(e.key===o?c=i(n,1):e.key===s?c=i(n,-1):e.key===`Home`?c=C.find(e=>!e.disabled&&G(e.key))??null:e.key===`End`&&(c=[...C].reverse().find(e=>!e.disabled&&G(e.key))??null),!c)return;e.preventDefault(),H(c.key),be(c.key);let l=c.href!=null||c.to!=null;j===`automatic`&&!l&&T?.(c.key)}let Q=e=>{let t=I.current;t&&t.scrollBy({left:e*t.clientWidth*de})},Se=[`app-tabs`,D===`pills`?`app-tabs-pills`:``,R?`app-tabs-vertical`:``,k===`sm`?`app-tabs-sm`:``,k===`lg`?`app-tabs-lg`:``,pe?`app-tabs-fitted`:``,N].filter(Boolean).join(` `),$=/* @__PURE__ */ g(`div`,{ref:X,role:`tablist`,"aria-orientation":R?`vertical`:void 0,"aria-label":M,className:Se,style:P,"data-wui-overflow-list":z?``:void 0,...F,onKeyDown:xe,onScroll:U,children:[C.map(n=>{let r=n.key===w,i=n.href!=null||n.to!=null,a={role:`tab`,"data-key":n.key,"aria-selected":r,tabIndex:n.key===ye?0:-1,className:`app-tab${r?` active`:``}${n.danger?` danger`:``}${i&&n.disabled?` disabled`:``}`},o=/* @__PURE__ */ g(re,{children:[n.image?/* @__PURE__ */ h(`img`,{className:`app-tab-img`,src:n.image,alt:n.imageAlt??``,width:B,height:B}):l(n.icon,{size:16,className:`app-tab-icon`}),/* @__PURE__ */ h(`span`,{className:`wui-tab-label`,children:n.label}),n.countPending?/* @__PURE__ */ h(`span`,{className:`app-tab-count${n.tone?` ${n.tone}`:``}`,"data-count-pending":``}):(n.countLabel||n.count!=null)&&/* @__PURE__ */ h(`span`,{className:`app-tab-count${n.tone?` ${n.tone}`:``}`,children:n.countLabel||ee(n.count,{decimals:0})})]}),c;if(i){let r=n.disabled||n.to==null||E==null||E===`a`?e(void 0,{href:n.disabled?void 0:n.href??n.to}):e(E,{to:n.to}),i=n.rel??(n.target===`_blank`?`noopener noreferrer`:void 0),s=n.disabled?{"aria-disabled":!0}:{target:n.target,rel:i},l=e=>{n.disabled?e.preventDefault():e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(H(n.key),T?.(n.key))};c=/* @__PURE__ */ h(t,{link:r,...a,...s,onClick:l,children:o},n.key)}else c=/* @__PURE__ */ h(`button`,{type:`button`,...a,disabled:n.disabled,onClick:()=>{n.disabled||(H(n.key),T?.(n.key))},children:o},n.key);return n.tooltip?/* @__PURE__ */ h(s,{content:n.tooltip,children:c},n.key):c}),/* @__PURE__ */ h(`span`,{className:`app-tab-indicator`,"aria-hidden":`true`,"data-wui-overflow-skip":``})]});return R?te($,x):z?/* @__PURE__ */ h(`wui-overflow`,{...x,ref:Z,class:`app-tabs-wrap`,label:me,children:$}):/* @__PURE__ */ g(`div`,{...x,ref:Z,className:`app-tabs-wrap`,children:[/* @__PURE__ */ h(`button`,{type:`button`,className:`app-tabs-scroll-btn prev`,"aria-label":S.scrollTabsBackwardLabel,tabIndex:-1,onClick:()=>Q(-1),children:/* @__PURE__ */ h(o,{name:`chevron-left`,size:16})}),$,/* @__PURE__ */ h(`button`,{type:`button`,className:`app-tabs-scroll-btn next`,"aria-label":S.scrollTabsForwardLabel,tabIndex:-1,onClick:()=>Q(1),children:/* @__PURE__ */ h(o,{name:`chevron-right`,size:16})})]})}export{x as default};
1
+ import{linkTarget as e}from"../lib/linkTarget.js";import{TargetLink as t}from"../lib/TargetLink.js";import n from"../lib/useElementEntry.js";import r from"../lib/useStickyLayer.js";import i from"../lib/useWuiText.js";import{TONES as a}from"../lib/vocabulary.js";import{splitMarkerProps as o}from"../lib/wuiMarker.js";import s from"./AppIcon.js";import c from"./AppTooltip.js";import l from"./assertValidValue.js";import ee from"./renderIconProp.js";import te from"./warnUnknownProps.js";import{formatNumber as u}from"@webority/ui-elements/helpers";import{cloneElement as d,useCallback as f,useEffect as p,useLayoutEffect as m,useRef as h,useState as ne}from"react";import{Fragment as re,jsx as g,jsxs as _}from"react/jsx-runtime";import{TABS_TEXT as ie}from"@webority/ui-elements/text";var ae=[`underline`,`pills`],oe=[`horizontal`,`vertical`],se=[`sm`,`md`,`lg`],v={sm:16,md:18,lg:20},ce=[`automatic`,`manual`],le=[`scroll`,`menu`],ue=a.filter(e=>e!==`primary`&&e!==`neutral`),y=()=>import(`@webority/ui-elements/elements/overflow`),b=1,de=28,fe=.7;function x(a){let{marker:x,props:pe}=o(`AppTabs`,a),S=i(`tabs`,ie),{tabs:C,value:w,onChange:T,linkComponent:E,variant:D=`underline`,orientation:O=`horizontal`,size:k=`md`,fitted:me=!1,overflow:A=`scroll`,moreLabel:he=S.moreLabel,maxVisible:ge,activation:j=`automatic`,ariaLabel:M,className:N=``,style:P,sticky:F=!1,...I}=pe;n(`wui-overflow`,y),te(`AppTabs`,I),l(`AppTabs`,`variant`,D,ae),l(`AppTabs`,`orientation`,O,oe),l(`AppTabs`,`size`,k,se),l(`AppTabs`,`activation`,j,ce),l(`AppTabs`,`overflow`,A,le);for(let e of C)if(l(`AppTabs`,`tabs[].tone`,e.tone,ue),e.countPending&&(e.count!=null||e.countLabel))throw Error(`<AppTabs> tab "${e.key}" sets countPending with count or countLabel: a pending badge is empty, so it takes neither.`);let L=h(null),R=h(null),z=O===`vertical`;r(z?L:R,F);let B=(A===`menu`||ge!=null)&&!z,V=v[k],[H,U]=ne(w);p(()=>{U(w)},[w]);let _e=C.find(e=>!e.disabled)?.key,ve=C.some(e=>e.key===H&&!e.disabled)?H:void 0,ye=C.some(e=>e.key===w&&!e.disabled)?w:void 0,be=ve??ye??_e,xe=e=>{L.current?.querySelector(`[data-key="${CSS.escape(String(e))}"]`)?.focus()},W=f(()=>{let e=L.current,t=R.current;if(!e||!t||z||B)return;let n=e.scrollWidth-e.clientWidth;t.classList.toggle(`is-overflow-start`,e.scrollLeft>b),t.classList.toggle(`is-overflow-end`,n>b&&e.scrollLeft<n-b)},[z,B]),G=f(()=>{let e=L.current;if(!e)return;let t=e.querySelector(`.app-tab.active`);t?(z?(e.style.setProperty(`--wui-tab-y`,`${t.offsetTop}px`),e.style.setProperty(`--wui-tab-h`,`${t.offsetHeight}px`)):(e.style.setProperty(`--wui-tab-x`,`${t.offsetLeft}px`),e.style.setProperty(`--wui-tab-w`,`${t.offsetWidth}px`)),e.toggleAttribute(`data-active-danger`,!!C.find(e=>e.key===w)?.danger)):e.style.setProperty(z?`--wui-tab-h`:`--wui-tab-w`,`0px`),e.setAttribute(`data-wui-tabs`,``),W()},[z,C,w,W]),K=e=>!B||!L.current?.querySelector(`[data-key="${CSS.escape(String(e))}"][data-wui-overflow-hidden]`),q=f(e=>{let t=L.current;if(!t||z)return;let n=t.querySelector(`.app-tab[data-key="${CSS.escape(e)}"]`);if(!n)return;let r=de,i=n.offsetLeft,a=i+n.offsetWidth;i-r<t.scrollLeft?t.scrollLeft=Math.max(0,i-r):a+r>t.scrollLeft+t.clientWidth&&(t.scrollLeft=a+r-t.clientWidth)},[z]);m(()=>{G()},[G]),m(()=>{q(w)},[w,q]);let J=h(G);p(()=>{J.current=G},[G]),p(()=>{if(!document.fonts)return;let e=!0;return document.fonts.ready.then(()=>{e&&J.current()}),()=>{e=!1}},[]);let Y=h(null),X=f(e=>{if(typeof ResizeObserver>`u`)return;let t=Y.current??{ro:new ResizeObserver(()=>J.current()),count:0};return Y.current=t,t.ro.observe(e),t.count+=1,()=>{t.ro.unobserve(e),--t.count,t.count===0&&(t.ro.disconnect(),Y.current===t&&(Y.current=null))}},[]),Se=f(e=>{L.current=e;let t=e?X(e):void 0;return()=>{L.current=null,t?.()}},[X]),Z=f(e=>{R.current=e;let t=e?X(e):void 0;return()=>{R.current=null,t?.()}},[X]);p(()=>{let e=R.current;if(!B||!e)return;let t=()=>J.current();return e.addEventListener(`wui-overflow-change`,t),()=>e.removeEventListener(`wui-overflow-change`,t)},[B]);function Ce(e){let t=e.target instanceof HTMLElement?e.target.dataset.key:void 0;if(t==null)return;let n=C.findIndex(e=>e.key===t);if(n<0)return;let r=C.length,i=(e,t)=>{for(let n=1;n<=r;n++){let i=C[((e+t*n)%r+r)%r];if(i&&!i.disabled&&K(i.key))return i}return null},a=getComputedStyle(e.currentTarget).direction===`rtl`,o=z?`ArrowDown`:a?`ArrowLeft`:`ArrowRight`,s=z?`ArrowUp`:a?`ArrowRight`:`ArrowLeft`,c=null;if(e.key===o?c=i(n,1):e.key===s?c=i(n,-1):e.key===`Home`?c=C.find(e=>!e.disabled&&K(e.key))??null:e.key===`End`&&(c=[...C].reverse().find(e=>!e.disabled&&K(e.key))??null),!c)return;e.preventDefault(),U(c.key),xe(c.key);let l=c.href!=null||c.to!=null;j===`automatic`&&!l&&T?.(c.key)}let Q=e=>{let t=L.current;t&&t.scrollBy({left:e*t.clientWidth*fe})},we=[`app-tabs`,D===`pills`?`app-tabs-pills`:``,z?`app-tabs-vertical`:``,k===`sm`?`app-tabs-sm`:``,k===`lg`?`app-tabs-lg`:``,me?`app-tabs-fitted`:``,z&&F?`wui-tabs-sticky`:``,N].filter(Boolean).join(` `),$=/* @__PURE__ */ _(`div`,{ref:Se,role:`tablist`,"aria-orientation":z?`vertical`:void 0,"aria-label":M,className:we,style:P,"data-wui-sticky-layer":z&&F?``:void 0,"data-wui-overflow-list":B?``:void 0,...I,onKeyDown:Ce,onScroll:W,children:[C.map(n=>{let r=n.key===w,i=n.href!=null||n.to!=null,a={role:`tab`,"data-key":n.key,"aria-selected":r,tabIndex:n.key===be?0:-1,className:`app-tab${r?` active`:``}${n.danger?` danger`:``}${i&&n.disabled?` disabled`:``}`},o=/* @__PURE__ */ _(re,{children:[n.image?/* @__PURE__ */ g(`img`,{className:`app-tab-img`,src:n.image,alt:n.imageAlt??``,width:V,height:V}):ee(n.icon,{size:16,className:`app-tab-icon`}),/* @__PURE__ */ g(`span`,{className:`wui-tab-label`,children:n.label}),n.countPending?/* @__PURE__ */ g(`span`,{className:`app-tab-count${n.tone?` ${n.tone}`:``}`,"data-count-pending":``}):(n.countLabel||n.count!=null)&&/* @__PURE__ */ g(`span`,{className:`app-tab-count${n.tone?` ${n.tone}`:``}`,children:n.countLabel||u(n.count,{decimals:0})})]}),s;if(i){let r=n.disabled||n.to==null||E==null||E===`a`?e(void 0,{href:n.disabled?void 0:n.href??n.to}):e(E,{to:n.to}),i=n.rel??(n.target===`_blank`?`noopener noreferrer`:void 0),c=n.disabled?{"aria-disabled":!0}:{target:n.target,rel:i},l=e=>{n.disabled?e.preventDefault():e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(U(n.key),T?.(n.key))};s=/* @__PURE__ */ g(t,{link:r,...a,...c,onClick:l,children:o},n.key)}else s=/* @__PURE__ */ g(`button`,{type:`button`,...a,disabled:n.disabled,onClick:()=>{n.disabled||(U(n.key),T?.(n.key))},children:o},n.key);return n.tooltip?/* @__PURE__ */ g(c,{content:n.tooltip,children:s},n.key):s}),/* @__PURE__ */ g(`span`,{className:`app-tab-indicator`,"aria-hidden":`true`,"data-wui-overflow-skip":``})]});return z?d($,x):B?/* @__PURE__ */ g(`wui-overflow`,{...x,ref:Z,class:F?`app-tabs-wrap wui-tabs-sticky`:`app-tabs-wrap`,"data-wui-sticky-layer":F?``:void 0,label:he,children:$}):/* @__PURE__ */ _(`div`,{...x,ref:Z,className:F?`app-tabs-wrap wui-tabs-sticky`:`app-tabs-wrap`,"data-wui-sticky-layer":F?``:void 0,children:[/* @__PURE__ */ g(`button`,{type:`button`,className:`app-tabs-scroll-btn prev`,"aria-label":S.scrollTabsBackwardLabel,tabIndex:-1,onClick:()=>Q(-1),children:/* @__PURE__ */ g(s,{name:`chevron-left`,size:16})}),$,/* @__PURE__ */ g(`button`,{type:`button`,className:`app-tabs-scroll-btn next`,"aria-label":S.scrollTabsForwardLabel,tabIndex:-1,onClick:()=>Q(1),children:/* @__PURE__ */ g(s,{name:`chevron-right`,size:16})})]})}export{x as default};
@@ -1 +1 @@
1
- import e from"../lib/FieldMessage.js";import{useFieldError as t}from"../lib/formFields.js";import ee from"../lib/useElementEntry.js";import n from"../lib/useWuiText.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./AppInfoTip.js";import te from"./AppRequiredMark.js";import a from"./assertValidValue.js";import ne from"./textOf.js";import o from"./useWuiControl.js";import s from"./warnUnknownProps.js";import{cloneElement as c,useId as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import{TIME_PICKER_TEXT as f}from"@webority/ui-elements/text";var p=[`sm`,`md`,`lg`,`xl`],m=[`12`,`24`],h=()=>import(`@webority/ui-elements/elements/timepicker`);function g(g){let _=ee(`wui-timepicker`,h),{marker:v,props:re}=r(`AppTimePicker`,g),y=n(`timePicker`,f),{value:b,defaultValue:x,onChange:S,label:C,required:w=!1,optional:T=!1,optionalLabel:E=y.optionalLabel,helperText:D,error:O,help:k,helpLabel:A=y.helpLabel,name:j,min:M,max:N,step:P,format:F=24,placeholder:ie=y.placeholder,disabled:I,readOnly:L=!1,loading:R=!1,size:z,id:B,ariaLabel:V,className:H=``,fieldClassName:U=``,ref:W,...G}=re,K=t(j),q=O??K;s(`AppTimePicker`,G),a(`AppTimePicker`,`size`,z,p);let J=String(F);a(`AppTimePicker`,`format`,J,m);let Y=l(),X=B||j||Y,{setRef:ae}=o({ready:_,ref:W,value:b??(x===void 0?``:void 0),onChange:S}),oe=!C&&!q&&!D,Z=q?`${X}-error`:void 0,Q=D?`${X}-hint`:void 0,se=Z||Q,$=/* @__PURE__ */ u(`wui-timepicker`,{ref:ae,value:(b??x)||void 0,id:X,name:j,min:M,max:N,step:P==null?void 0:String(P),format:J,placeholder:ie,size:z||void 0,"aria-label":V||ne(C)||void 0,"aria-describedby":se,"aria-invalid":q?`true`:void 0,disabled:I?``:void 0,readonly:L?``:void 0,loading:R?``:void 0,required:w?``:void 0,className:H||void 0,...G});return oe?c($,v):/* @__PURE__ */ d(`div`,{...v,className:`field${U?` ${U}`:``}`,children:[C&&/* @__PURE__ */ d(`label`,{className:`label`,htmlFor:X,children:[C,T&&!w&&/* @__PURE__ */ u(`span`,{className:`label-optional`,children:` ${E}`}),w&&/* @__PURE__ */ u(te,{}),k&&/* @__PURE__ */ u(i,{label:A,children:k})]}),$,/* @__PURE__ */ u(e,{error:q,hint:D,errorId:Z,hintId:Q})]})}export{g as default};
1
+ import ee from"../lib/FieldMessage.js";import{useFieldError as e}from"../lib/formFields.js";import te from"../lib/useElementEntry.js";import t from"../lib/useWuiText.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppInfoTip.js";import ne from"./AppRequiredMark.js";import i from"./assertValidValue.js";import re from"./textOf.js";import a from"./useWuiControl.js";import o from"./warnUnknownProps.js";import{cloneElement as s,useId as c}from"react";import{jsx as l,jsxs as u}from"react/jsx-runtime";import{TIME_PICKER_TEXT as d}from"@webority/ui-elements/text";var ie=[`sm`,`md`,`lg`,`xl`],f=[`12`,`24`],p=[`underline`],m=()=>import(`@webority/ui-elements/elements/timepicker`);function h(h){let ae=te(`wui-timepicker`,m),{marker:g,props:oe}=n(`AppTimePicker`,h),_=t(`timePicker`,d),{value:v,defaultValue:y,onChange:b,label:x,required:S=!1,optional:C=!1,optionalLabel:w=_.optionalLabel,helperText:T,error:E,help:D,helpLabel:O=_.helpLabel,name:k,min:A,max:j,step:M,format:N=24,placeholder:P=_.placeholder,disabled:F,readOnly:I=!1,loading:L=!1,size:R,variant:z,id:B,ariaLabel:V,className:H=``,fieldClassName:U=``,ref:W,...G}=oe,K=e(k),q=E??K;o(`AppTimePicker`,G),i(`AppTimePicker`,`size`,R,ie);let J=String(N);i(`AppTimePicker`,`format`,J,f),i(`AppTimePicker`,`variant`,z,p);let se=c(),Y=B||k||se,{setRef:ce}=a({ready:ae,ref:W,value:v??(y===void 0?``:void 0),onChange:b}),le=!x&&!q&&!T,X=[z===`underline`?`wui-input-underline`:``,H].filter(Boolean).join(` `),Z=q?`${Y}-error`:void 0,Q=T?`${Y}-hint`:void 0,ue=Z||Q,$=/* @__PURE__ */ l(`wui-timepicker`,{ref:ce,value:(v??y)||void 0,id:Y,name:k,min:A,max:j,step:M==null?void 0:String(M),format:J,placeholder:P,size:R||void 0,"aria-label":V||re(x)||void 0,"aria-describedby":ue,"aria-invalid":q?`true`:void 0,disabled:F?``:void 0,readonly:I?``:void 0,loading:L?``:void 0,required:S?``:void 0,className:X||void 0,...G});return le?s($,g):/* @__PURE__ */ u(`div`,{...g,className:`field${U?` ${U}`:``}`,children:[x&&/* @__PURE__ */ u(`label`,{className:`label`,htmlFor:Y,children:[x,C&&!S&&/* @__PURE__ */ l(`span`,{className:`label-optional`,children:` ${w}`}),S&&/* @__PURE__ */ l(ne,{}),D&&/* @__PURE__ */ l(r,{label:O,children:D})]}),$,/* @__PURE__ */ l(ee,{error:q,hint:T,errorId:Z,hintId:Q})]})}export{h as default};
@@ -1 +1 @@
1
- import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/useElementEntry.js";import n from"../lib/useWuiText.js";import{TONES as r}from"../lib/vocabulary.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./AppIcon.js";import o from"./assertValidValue.js";import s from"./warnUnknownProps.js";import{Children as ee,useEffect as c,useRef as l}from"react";import{jsx as u,jsxs as te}from"react/jsx-runtime";import{WIZARD_TEXT as d}from"@webority/ui-elements/text";var ne=[`steps`,`journey`,`icons`,`tiles`],f=r.filter(e=>e!==`neutral`),p=[`horizontal`,`vertical`],m=[`center`,`start`],h=[`done`,`active`,`pending`,`error`],g=[`key`,`label`,`description`,`optional`,`icon`,`status`],re=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],ie=[`check`,`alert-triangle`,`minus`],_=[`sm`,`md`,`lg`],v={sm:14,md:16,lg:20},y=()=>import(`@webority/ui-elements/elements/wizard`),b=/* @__PURE__ */ new Set,x=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}};function S(t){if(!Array.isArray(t))throw Error(`AppWizard: steps must be an array of { label, description?, optional?, icon?, status?, key? } objects.`);t.forEach((t,n)=>{if(typeof t!=`object`||!t)throw Error(`AppWizard: steps[${n}] needs a text label.`);let r=`label`in t?t.label:void 0;if(typeof r!=`string`||r.trim()===``)throw Error(`AppWizard: steps[${n}] needs a text label.`);if(x())for(let r of Object.keys(t)){if(g.includes(r))continue;let t=`AppWizard: steps[${n}] has an unknown field ${r}; the fields are ${g.join(`, `)}.`;b.has(t)||(b.add(t),e(t))}})}function C({ref:e,...r}){let g=t(`wui-wizard`,y),{marker:b,props:x}=i(`AppWizard`,r),C=n(`wizard`,d),{steps:w=[],children:T,active:E,defaultActive:D=0,onStepChange:O,onFinish:k,onSkip:A,beforeNext:j,onInvalid:M,onClose:N,variant:P=`steps`,tone:F,doneTone:I,orientation:L=`horizontal`,align:R=`center`,iconVariant:z,size:B=`md`,iconSize:V,skippable:H=!1,nonLinear:U=!1,hideStepper:W=!1,hideConnectors:G=!1,disabled:K=!1,label:q=C.label,backLabel:J=C.backLabel,nextLabel:ae=C.nextLabel,skipLabel:oe=C.skipLabel,finishLabel:se=C.finishLabel,topBar:ce=!1,barTitle:le,closeLabel:ue=C.closeLabel,className:de=``,...Y}=x;s(`AppWizard`,Y),o(`AppWizard`,`variant`,P,ne),o(`AppWizard`,`tone`,F,f),o(`AppWizard`,`doneTone`,I,f),o(`AppWizard`,`orientation`,L,p),o(`AppWizard`,`align`,R,m),o(`AppWizard`,`iconVariant`,z,re),o(`AppWizard`,`size`,B,_),S(w);let X=V!==void 0&&V>0?V:v[B]??v.md;for(let e of w)o(`AppWizard`,`steps[].status`,e.status,h);let Z=l(null),fe=t=>{Z.current=t,typeof e==`function`?e(t):e&&(e.current=t)},pe=ee.toArray(T),Q=z&&z!==`linear`?[.../* @__PURE__ */ new Set([...ie,...w.map(e=>e.icon).filter(e=>!!e)])]:[],me=[F&&`wui-step-tone-${F}`,I&&`wui-step-done-tone-${I}`,B!==`md`&&_.includes(B)&&`wui-step-size-${B}`,de].filter(Boolean).join(` `),$=l(E===void 0?D:E);return c(()=>{let e=Z.current;e&&g&&$.current&&(e.active=$.current)},[g]),c(()=>{let e=Z.current;e&&g&&E!==void 0&&Number(e.active)!==E&&(e.active=E)},[E,g]),c(()=>{let e=Z.current;e&&g&&(e.beforeNext=j??null)},[j,g]),c(()=>{let e=Z.current;if(!e)return;let t=e=>{if(!(e instanceof CustomEvent))throw Error(`AppWizard: wui-wizard:change must be a CustomEvent carrying its detail.`);let t=e.detail;O?.(t.index,t)},n=e=>{if(!(e instanceof CustomEvent))throw Error(`AppWizard: wui-wizard:finish must be a CustomEvent carrying its detail.`);let t=e.detail;k?.(t)},r=e=>{if(!(e instanceof CustomEvent))throw Error(`AppWizard: wui-wizard:skip must be a CustomEvent carrying its detail.`);let t=e.detail;A?.(t.index)},i=e=>{if(!(e instanceof CustomEvent))throw Error(`AppWizard: wui-wizard:invalid must be a CustomEvent carrying its detail.`);let t=e.detail;M?.(t.index)},a=e=>{if(!(e instanceof CustomEvent))throw Error(`AppWizard: wui-wizard:close must be a CustomEvent carrying its detail.`);let t=e.detail;N?.(t)};return e.addEventListener(`wui-wizard:change`,t),e.addEventListener(`wui-wizard:finish`,n),e.addEventListener(`wui-wizard:skip`,r),e.addEventListener(`wui-wizard:invalid`,i),e.addEventListener(`wui-wizard:close`,a),()=>{e.removeEventListener(`wui-wizard:change`,t),e.removeEventListener(`wui-wizard:finish`,n),e.removeEventListener(`wui-wizard:skip`,r),e.removeEventListener(`wui-wizard:invalid`,i),e.removeEventListener(`wui-wizard:close`,a)}},[O,k,A,M,N]),/* @__PURE__ */ te(`wui-wizard`,{ref:fe,variant:P,orientation:L,align:R===`start`?`start`:void 0,"icon-size":X===16?void 0:X,skippable:H?``:void 0,"non-linear":U?``:void 0,"hide-stepper":W?``:void 0,"hide-connectors":G?``:void 0,disabled:K?``:void 0,label:q,"back-label":J,"next-label":ae,"skip-label":oe,"finish-label":se,"top-bar":ce?``:void 0,"bar-title":le||void 0,"close-label":ue,className:me||void 0,...b,...Y,children:[w.map((e,t)=>/* @__PURE__ */ u(`wui-wizard-step`,{label:e.label,description:e.description||void 0,optional:e.optional?``:void 0,icon:e.icon||void 0,status:e.status||void 0,children:pe[t]},e.key??`${e.label}-${t}`)),Q.length>0&&/* @__PURE__ */ u(`span`,{hidden:!0,"data-wui-glyphs":``,children:Q.map(e=>/* @__PURE__ */ u(a,{name:e,size:X,variant:z},e))})]})}export{C as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/useElementEntry.js";import n from"../lib/useWuiText.js";import{TONES as r}from"../lib/vocabulary.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./AppIcon.js";import o from"./assertValidValue.js";import ee from"./warnUnknownProps.js";import{Children as te,useEffect as s,useRef as c,useState as ne}from"react";import{createPortal as l}from"react-dom";import{jsx as u,jsxs as re}from"react/jsx-runtime";import{WIZARD_TEXT as ie}from"@webority/ui-elements/text";var ae=[`steps`,`journey`,`icons`,`tiles`],d=r.filter(e=>e!==`neutral`),oe=[`horizontal`,`vertical`],se=[`center`,`start`],ce=[`done`,`active`,`pending`,`error`],f=[`key`,`label`,`description`,`optional`,`icon`,`status`,`errorCount`],le=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],ue=[`check`,`alert-triangle`,`minus`],p=[`sm`,`md`,`lg`],m={sm:14,md:16,lg:20},de=()=>import(`@webority/ui-elements/elements/wizard`),h=/* @__PURE__ */ new Set,g=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}};function fe(t){if(!Array.isArray(t))throw Error(`AppWizard: steps must be an array of { label, description?, optional?, icon?, status?, key? } objects.`);t.forEach((t,n)=>{if(typeof t!=`object`||!t)throw Error(`AppWizard: steps[${n}] needs a text label.`);let r=`label`in t?t.label:void 0;if(typeof r!=`string`||r.trim()===``)throw Error(`AppWizard: steps[${n}] needs a text label.`);let i=`errorCount`in t?t.errorCount:void 0;if(i!==void 0&&!(typeof i==`number`&&Number.isInteger(i)&&i>=0))throw Error(`AppWizard: steps[${n}].errorCount must be a whole number of 0 or more.`);if(g())for(let r of Object.keys(t)){if(f.includes(r))continue;let t=`AppWizard: steps[${n}] has an unknown field ${r}; the fields are ${f.join(`, `)}.`;h.has(t)||(h.add(t),e(t))}})}function _({ref:e,...r}){let f=t(`wui-wizard`,de),{marker:h,props:g}=i(`AppWizard`,r),_=n(`wizard`,ie),{steps:v=[],children:pe,active:y,defaultActive:me=0,onStepChange:b,onFinish:x,onSkip:S,beforeNext:C,onInvalid:w,onClose:T,variant:E=`steps`,tone:D,doneTone:O,orientation:k=`horizontal`,align:A=`center`,iconVariant:j,size:M=`md`,iconSize:N,skippable:P=!1,nonLinear:F=!1,hideStepper:I=!1,hideConnectors:L=!1,disabled:R=!1,label:z=_.label,backLabel:B=_.backLabel,nextLabel:he=_.nextLabel,skipLabel:ge=_.skipLabel,finishLabel:_e=_.finishLabel,topBar:ve=!1,barTitle:ye,closeLabel:be=_.closeLabel,stickyFooter:xe=!1,status:V,extraActions:H,finishLoading:Se=!1,dirty:Ce=!1,onLeave:U,className:we=``,...W}=g;ee(`AppWizard`,W),o(`AppWizard`,`variant`,E,ae),o(`AppWizard`,`tone`,D,d),o(`AppWizard`,`doneTone`,O,d),o(`AppWizard`,`orientation`,k,oe),o(`AppWizard`,`align`,A,se),o(`AppWizard`,`iconVariant`,j,le),o(`AppWizard`,`size`,M,p),fe(v);let G=N!==void 0&&N>0?N:m[M]??m.md;for(let e of v)o(`AppWizard`,`steps[].status`,e.status,ce);let K=V!=null&&V!==!1,q=H!=null&&H!==!1,[J,Te]=ne({status:null,extra:null}),Y=v.map(e=>e.errorCount??0).join(`,`),X=c(Y),Z=c(null),Ee=t=>{Z.current=t,typeof e==`function`?e(t):e&&(e.current=t)},De=te.toArray(pe),Q=j&&j!==`linear`?[.../* @__PURE__ */ new Set([...ue,...v.map(e=>e.icon).filter(e=>!!e)])]:[],Oe=[D&&`wui-step-tone-${D}`,O&&`wui-step-done-tone-${O}`,M!==`md`&&p.includes(M)&&`wui-step-size-${M}`,we].filter(Boolean).join(` `),$=c(y===void 0?me:y);return s(()=>{let e=Z.current;e&&f&&$.current&&(e.active=$.current)},[f]),s(()=>{let e=Z.current;e&&f&&y!==void 0&&Number(e.active)!==y&&(e.active=y)},[y,f]),s(()=>{let e=Z.current;e&&f&&(e.beforeNext=C??null)},[C,f]),s(()=>{let e=Z.current;if(!e)return;let t=e=>{if(!(e instanceof CustomEvent))throw Error(`AppWizard: wui-wizard:change must be a CustomEvent carrying its detail.`);let t=e.detail;b?.(t.index,t)},n=e=>{if(!(e instanceof CustomEvent))throw Error(`AppWizard: wui-wizard:finish must be a CustomEvent carrying its detail.`);let t=e.detail;x?.(t)},r=e=>{if(!(e instanceof CustomEvent))throw Error(`AppWizard: wui-wizard:skip must be a CustomEvent carrying its detail.`);let t=e.detail;S?.(t.index)},i=e=>{if(!(e instanceof CustomEvent))throw Error(`AppWizard: wui-wizard:invalid must be a CustomEvent carrying its detail.`);let t=e.detail;w?.(t.index)},a=e=>{if(!(e instanceof CustomEvent))throw Error(`AppWizard: wui-wizard:leave must be a CustomEvent carrying its detail.`);let t=e.detail;U?.(t)},o=e=>{if(!(e instanceof CustomEvent))throw Error(`AppWizard: wui-wizard:close must be a CustomEvent carrying its detail.`);let t=e.detail;T?.(t)};return e.addEventListener(`wui-wizard:change`,t),e.addEventListener(`wui-wizard:finish`,n),e.addEventListener(`wui-wizard:skip`,r),e.addEventListener(`wui-wizard:invalid`,i),e.addEventListener(`wui-wizard:close`,o),e.addEventListener(`wui-wizard:leave`,a),()=>{e.removeEventListener(`wui-wizard:leave`,a),e.removeEventListener(`wui-wizard:change`,t),e.removeEventListener(`wui-wizard:finish`,n),e.removeEventListener(`wui-wizard:skip`,r),e.removeEventListener(`wui-wizard:invalid`,i),e.removeEventListener(`wui-wizard:close`,o)}},[b,x,S,w,T,U]),s(()=>{let e=Z.current;e&&f&&Te(t=>t.status===e._statusSlot&&t.extra===e._extraSlot?t:{status:e._statusSlot,extra:e._extraSlot})}),s(()=>{f&&X.current!==Y&&(X.current=Y,Z.current?.refresh())}),/* @__PURE__ */ re(`wui-wizard`,{ref:Ee,variant:E,orientation:k,align:A===`start`?`start`:void 0,"icon-size":G===16?void 0:G,skippable:P?``:void 0,"non-linear":F?``:void 0,"hide-stepper":I?``:void 0,"hide-connectors":L?``:void 0,disabled:R?``:void 0,label:z,"back-label":B,"next-label":he,"skip-label":ge,"finish-label":_e,"top-bar":ve?``:void 0,"bar-title":ye||void 0,"close-label":be,"sticky-footer":xe?``:void 0,"finish-loading":Se?``:void 0,dirty:Ce?``:void 0,"status-slot":K?``:void 0,"extra-slot":q?``:void 0,className:Oe||void 0,...h,...W,children:[v.map((e,t)=>/* @__PURE__ */ u(`wui-wizard-step`,{label:e.label,description:e.description||void 0,optional:e.optional?``:void 0,"error-count":e.errorCount?e.errorCount:void 0,icon:e.icon||void 0,status:e.status||void 0,children:De[t]},e.key??`${e.label}-${t}`)),K&&J.status&&l(V,J.status),q&&J.extra&&l(H,J.extra),Q.length>0&&/* @__PURE__ */ u(`span`,{hidden:!0,"data-wui-glyphs":``,children:Q.map(e=>/* @__PURE__ */ u(a,{name:e,size:G,variant:j},e))})]})}export{_ as default};