@webority/ui-react 0.76.0 → 0.77.1

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 (42) hide show
  1. package/dist/components/AppActionIcon.js +1 -1
  2. package/dist/components/AppAutocomplete.js +1 -1
  3. package/dist/components/AppCalendar.js +1 -1
  4. package/dist/components/AppChart.js +1 -1
  5. package/dist/components/AppChartCard.js +1 -1
  6. package/dist/components/AppDataTable.js +1 -1
  7. package/dist/components/AppDescriptions.js +1 -1
  8. package/dist/components/AppDrawer.js +1 -1
  9. package/dist/components/AppDropdown.js +1 -1
  10. package/dist/components/AppFilePicker.js +1 -1
  11. package/dist/components/AppFileViewer.js +1 -1
  12. package/dist/components/AppFilterBar.js +1 -1
  13. package/dist/components/AppFormRow.js +1 -1
  14. package/dist/components/AppIcon.js +1 -1
  15. package/dist/components/AppKpiTile.js +1 -1
  16. package/dist/components/AppLink.js +1 -1
  17. package/dist/components/AppModal.js +1 -1
  18. package/dist/components/AppPhoneNumberInput.js +1 -1
  19. package/dist/components/AppRichText.js +1 -1
  20. package/dist/components/AppSelect.js +1 -1
  21. package/dist/components/AppShell.js +1 -1
  22. package/dist/components/AppSparkline.js +1 -1
  23. package/dist/components/AppThemeToggle.js +1 -1
  24. package/dist/components/AppTimeline.js +1 -1
  25. package/dist/components/AppWizard.js +1 -1
  26. package/dist/components/useNodeLabels.js +1 -1
  27. package/dist/components/warnInvalidValue.js +1 -1
  28. package/dist/components/warnUnknownProps.js +1 -1
  29. package/dist/lib/DiscardPrompt.js +1 -0
  30. package/dist/lib/devWarn.js +1 -0
  31. package/dist/types/components/AppAutocomplete.d.ts +3 -0
  32. package/dist/types/components/AppDataTable.d.ts +5 -1
  33. package/dist/types/components/AppFilterBar.d.ts +2 -1
  34. package/dist/types/components/AppKpiTile.d.ts +6 -3
  35. package/dist/types/components/AppShell.d.ts +4 -0
  36. package/dist/types/components/AppTimeline.d.ts +3 -1
  37. package/dist/types/components/AppWizard.d.ts +5 -1
  38. package/dist/types/components/iconGlyphs.g.d.ts +1 -2
  39. package/dist/types/components/useNodeLabels.d.ts +11 -4
  40. package/dist/types/lib/DiscardPrompt.d.ts +16 -0
  41. package/dist/types/lib/devWarn.d.ts +2 -0
  42. package/package.json +3 -3
@@ -1 +1 @@
1
- import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import{shortcutAria as n}from"../lib/shortcutChip.js";import r from"./withTooltip.js";import i from"./renderIconProp.js";import{useRef as a}from"react";import{Fragment as o,jsx as s,jsxs as c}from"react/jsx-runtime";var l=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`];function u({icon:u,iconVariant:d,label:f,tooltipPlacement:p=`auto`,shortcut:m,danger:h=!1,disabled:g=!1,size:_=20,onClick:v,className:y=``,as:b,href:x,accept:S,multiple:C=!1,onFiles:w,...T}){t(`AppActionIcon`,b===void 0?T:{...T,as:b}),e(`AppActionIcon`,`iconVariant`,d,l);let E=typeof w==`function`;E&&(b!==void 0||x!==void 0)&&console.warn(`AppActionIcon: file mode renders a button; href and as are ignored.`),!E&&(S!==void 0||C)&&console.warn(`AppActionIcon: accept and multiple apply only in file mode (pass onFiles).`);let D=a(null),O=e=>{let t=[...e.target.files];e.target.value=``,t.length>0&&w(t)},k=[`u-action`,h?`danger`:``,y].filter(Boolean).join(` `),{style:A,...j}=T,M={"--wui-action-size":`${_+16}px`,...A},N=E?`button`:b??(x?`a`:`button`),P=N===`button`,F=r(s(N,{type:P?`button`:void 0,href:P||g?void 0:x,className:k,style:M,"aria-label":f,"aria-keyshortcuts":n(m),disabled:P?g:void 0,"aria-disabled":!P&&g?`true`:void 0,role:!P&&g?`link`:void 0,tabIndex:!P&&g?-1:void 0,onClick:e=>{if(g){e.preventDefault(),e.stopPropagation();return}v?.(e),E&&!e.defaultPrevented&&D.current?.click()},...j,children:i(u,{size:_,variant:d})}),f,p,m);return E?c(o,{children:[F,s(`input`,{type:`file`,ref:D,className:`wui-action-icon-file`,hidden:!0,tabIndex:-1,"aria-hidden":`true`,accept:S,multiple:C,onChange:O,onClick:e=>e.stopPropagation()})]}):F}export{u as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import{shortcutAria as r}from"../lib/shortcutChip.js";import i from"./withTooltip.js";import a from"./renderIconProp.js";import{useRef as o}from"react";import{Fragment as s,jsx as c,jsxs as l}from"react/jsx-runtime";var u=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`];function d({icon:d,iconVariant:f,label:p,tooltipPlacement:m=`auto`,shortcut:h,danger:g=!1,disabled:_=!1,size:v=20,onClick:y,className:b=``,as:x,href:S,accept:C,multiple:w=!1,onFiles:T,...E}){n(`AppActionIcon`,x===void 0?E:{...E,as:x}),t(`AppActionIcon`,`iconVariant`,f,u);let D=typeof T==`function`;D&&(x!==void 0||S!==void 0)&&e(`AppActionIcon: file mode renders a button; href and as are ignored.`),!D&&(C!==void 0||w)&&e(`AppActionIcon: accept and multiple apply only in file mode (pass onFiles).`);let O=o(null),k=e=>{let t=[...e.target.files];e.target.value=``,t.length>0&&T(t)},A=[`u-action`,g?`danger`:``,b].filter(Boolean).join(` `),{style:j,...M}=E,N={"--wui-action-size":`${v+16}px`,...j},P=D?`button`:x??(S?`a`:`button`),F=P===`button`,I=i(c(P,{type:F?`button`:void 0,href:F||_?void 0:S,className:A,style:N,"aria-label":p,"aria-keyshortcuts":r(h),disabled:F?_:void 0,"aria-disabled":!F&&_?`true`:void 0,role:!F&&_?`link`:void 0,tabIndex:!F&&_?-1:void 0,onClick:e=>{if(_){e.preventDefault(),e.stopPropagation();return}y?.(e),D&&!e.defaultPrevented&&O.current?.click()},...M,children:a(d,{size:v,variant:f})}),p,m,h);return D?l(s,{children:[I,c(`input`,{type:`file`,ref:O,className:`wui-action-icon-file`,hidden:!0,tabIndex:-1,"aria-hidden":`true`,accept:C,multiple:w,onChange:k,onClick:e=>e.stopPropagation()})]}):I}export{d as default};
@@ -1 +1 @@
1
- import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"../lib/FieldMessage.js";import r from"./AppInfoTip.js";import i from"./AppRequiredMark.js";import a from"./useNodeLabels.js";import o,{optionsEqual as s}from"./useWuiControl.js";import{forwardRef as c,useEffect as l,useId as u,useRef as d}from"react";import{jsx as f,jsxs as p}from"react/jsx-runtime";import"@webority/ui-elements/elements/autocomplete";var m=[`sm`,`lg`],h=[],g=(e,t)=>({...e,label:t}),_=c(function({value:c,onChange:_,options:v,loadOptions:y,placeholder:b=`Search…`,minChars:x,debounce:S,disabled:C=!1,size:w,allowCustom:T=!1,name:E,id:D,label:O,error:k,hint:A,required:j=!1,help:M,helpLabel:N=`More information`,fieldClassName:P=``,...F},I){t(`AppAutocomplete`,F),e(`AppAutocomplete`,`size`,w,m);let L=typeof y==`function`,R=u(),z=D||R,{setRef:B,innerRef:V}=o({ref:I,value:c??``,on:{change:e=>_?.(e.currentTarget.value,{isCustom:!!e.detail?.isCustom})}}),H=v||h,{portal:U,toElementOptions:W}=a(H),G=d(!1);return l(()=>{let e=V.current;if(!e||L&&G.current)return;let t=W(H,g);s(t,e.options)||(e.options=t)},[H,L,V,W]),l(()=>{let e=V.current;if(!e||!L)return;let t=0,n=null,r=async r=>{let i=++t;n?.abort(),n=typeof AbortController==`function`?new AbortController:null,e.loading=!0;try{let a=await y(r.detail.query,{signal:n?.signal});i===t&&(G.current=!0,e.options=a||[])}catch{i===t&&(G.current=!0,e.options=[])}finally{i===t&&(e.loading=!1)}};return e.addEventListener(`search`,r),()=>{t=-1,n?.abort(),e.removeEventListener(`search`,r),e.loading=!1}},[L,y,V]),p(`div`,{className:`field${P?` ${P}`:``}`,children:[O&&p(`label`,{className:`label`,htmlFor:z,children:[O,j&&f(i,{}),M&&f(r,{label:N,children:M})]}),f(`wui-autocomplete`,{"aria-label":typeof O==`string`?O:void 0,"aria-describedby":k?`${z}-error`:A?`${z}-hint`:void 0,"aria-invalid":k?`true`:void 0,id:z,ref:B,name:E,placeholder:b,remote:L?``:void 0,"min-chars":x==null?void 0:String(x),debounce:S==null?void 0:String(S),size:w||void 0,"allow-custom":T?``:void 0,disabled:C?``:void 0,required:j?``:void 0,...F}),U,f(n,{error:k,hint:A,errorId:`${z}-error`,hintId:`${z}-hint`})]})});export{_ as default};
1
+ import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"../lib/FieldMessage.js";import r from"./AppInfoTip.js";import i from"./AppRequiredMark.js";import a from"./useNodeLabels.js";import o,{optionsEqual as s}from"./useWuiControl.js";import{forwardRef as c,useEffect as l,useId as u,useRef as d}from"react";import{jsx as f,jsxs as p}from"react/jsx-runtime";import"@webority/ui-elements/elements/autocomplete";var m=[`sm`,`lg`],h=[],g=(e,t)=>({...e,label:t}),_=(e,t,n)=>{if(n==null||t==null||t===``)return e;let r=String(t);return e.some(e=>String(e.value)===r)?e:[...e,{value:r,label:n}]},v=c(function({value:c,onChange:v,options:y,valueLabel:b,loadOptions:x,placeholder:S=`Search…`,minChars:C,debounce:w,disabled:T=!1,size:E,allowCustom:D=!1,name:O,id:k,label:A,error:j,hint:M,required:N=!1,help:P,helpLabel:F=`More information`,fieldClassName:I=``,...L},R){t(`AppAutocomplete`,L),e(`AppAutocomplete`,`size`,E,m);let z=typeof x==`function`,B=u(),V=k||B,{setRef:H,innerRef:U}=o({ref:R,value:c??``,on:{change:e=>v?.(e.currentTarget.value,{isCustom:!!e.detail?.isCustom})}}),W=y||h,{portal:G,toElementOptions:K}=a(W),q=d(!1);return l(()=>{let e=U.current;if(!e||z&&q.current)return;let t=K(_(W,c,b),g);s(t,e.options)||(e.options=t)},[W,z,U,K,c,b]),l(()=>{let e=U.current;if(!e||!z||!q.current)return;let t=e.options,n=_(t,c,b);n!==t&&(e.options=n)},[c,b,z,U]),l(()=>{let e=U.current;if(!e||!z)return;let t=0,n=null,r=async r=>{let i=++t;n?.abort(),n=typeof AbortController==`function`?new AbortController:null,e.loading=!0;try{let a=await x(r.detail.query,{signal:n?.signal});i===t&&(q.current=!0,e.options=a||[])}catch{i===t&&(q.current=!0,e.options=[])}finally{i===t&&(e.loading=!1)}};return e.addEventListener(`search`,r),()=>{t=-1,n?.abort(),e.removeEventListener(`search`,r),e.loading=!1}},[z,x,U]),p(`div`,{className:`field${I?` ${I}`:``}`,children:[A&&p(`label`,{className:`label`,htmlFor:V,children:[A,N&&f(i,{}),P&&f(r,{label:F,children:P})]}),f(`wui-autocomplete`,{"aria-label":typeof A==`string`?A:void 0,"aria-describedby":j?`${V}-error`:M?`${V}-hint`:void 0,"aria-invalid":j?`true`:void 0,id:V,ref:H,name:O,placeholder:S,remote:z?``:void 0,"min-chars":C==null?void 0:String(C),debounce:w==null?void 0:String(w),size:E||void 0,"allow-custom":D?``:void 0,disabled:T?``:void 0,required:N?``:void 0,...L}),G,f(n,{error:j,hint:M,errorId:`${V}-error`,hintId:`${V}-hint`})]})});export{v as default};
@@ -1 +1 @@
1
- import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import{forwardRef as n,useCallback as r,useEffect as i,useLayoutEffect as a,useRef as o,useState as s}from"react";import{jsx as c}from"react/jsx-runtime";var l=`wui-calendar:event-click`,u=`wui-calendar:date-click`,d=`wui-calendar:range-change`,f=[`month`,`week`,`day`,`list`],p=`This calendar couldn't load. Try again in a moment.`,m=n(function({label:n,events:m,eventsUrl:h,view:g,date:_,emptyText:v,errorText:y,firstDay:b,onEventClick:x,onDateClick:S,onRangeChange:C,className:w=``,style:T,...E},D){t(`AppCalendar`,E),e(`AppCalendar`,`view`,g,f);let O=o(null),k=o(``),A=o({onEventClick:x,onDateClick:S,onRangeChange:C}),[j,M]=s(!1),N=r(e=>{O.current=e,typeof D==`function`?D(e):D&&(D.current=e)},[D]);return i(()=>{A.current={onEventClick:x,onDateClick:S,onRangeChange:C}}),a(()=>{let e=O.current;if(!e)return;let t=m==null?``:JSON.stringify(m);t!==k.current&&(k.current=t,e.events=m??null)}),i(()=>{let e=O.current,t=[[l,e=>{A.current.onEventClick?.(e.detail)===!1&&e.preventDefault()}],[u,e=>A.current.onDateClick?.(e.detail)],[d,e=>A.current.onRangeChange?.(e.detail)]];for(let[n,r]of t)e.addEventListener(n,r);return()=>{for(let[n,r]of t)e.removeEventListener(n,r)}},[]),i(()=>{let e=!0;return import(`@webority/ui-elements/calendar`).catch(t=>{console.warn(`[AppCalendar] the calendar failed to load:`,t?.message),e&&M(!0)}),()=>{e=!1}},[]),j?c(`div`,{className:w||void 0,style:T,role:`status`,children:c(`p`,{className:`wui-calendar-status-text`,children:y||p})}):c(`wui-calendar`,{ref:N,label:n||void 0,"events-url":h||void 0,view:g||void 0,date:_||void 0,"empty-text":v||void 0,"error-text":y||void 0,"first-day":b==null?void 0:String(b),className:w||void 0,style:T,...E})});export{m as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import{forwardRef as r,useCallback as i,useEffect as a,useLayoutEffect as o,useRef as s,useState as c}from"react";import{jsx as l}from"react/jsx-runtime";var u=`wui-calendar:event-click`,d=`wui-calendar:date-click`,f=`wui-calendar:range-change`,p=[`month`,`week`,`day`,`list`],m=`This calendar couldn't load. Try again in a moment.`,h=r(function({label:r,events:h,eventsUrl:g,view:_,date:v,emptyText:y,errorText:b,firstDay:x,onEventClick:S,onDateClick:C,onRangeChange:w,className:T=``,style:E,...D},O){n(`AppCalendar`,D),t(`AppCalendar`,`view`,_,p);let k=s(null),A=s(``),j=s({onEventClick:S,onDateClick:C,onRangeChange:w}),[M,N]=c(!1),P=i(e=>{k.current=e,typeof O==`function`?O(e):O&&(O.current=e)},[O]);return a(()=>{j.current={onEventClick:S,onDateClick:C,onRangeChange:w}}),o(()=>{let e=k.current;if(!e)return;let t=h==null?``:JSON.stringify(h);t!==A.current&&(A.current=t,e.events=h??null)}),a(()=>{let e=k.current,t=[[u,e=>{j.current.onEventClick?.(e.detail)===!1&&e.preventDefault()}],[d,e=>j.current.onDateClick?.(e.detail)],[f,e=>j.current.onRangeChange?.(e.detail)]];for(let[n,r]of t)e.addEventListener(n,r);return()=>{for(let[n,r]of t)e.removeEventListener(n,r)}},[]),a(()=>{let t=!0;return import(`@webority/ui-elements/calendar`).catch(n=>{e(`[AppCalendar] the calendar failed to load:`,n?.message),t&&N(!0)}),()=>{t=!1}},[]),M?l(`div`,{className:T||void 0,style:E,role:`status`,children:l(`p`,{className:`wui-calendar-status-text`,children:b||m})}):l(`wui-calendar`,{ref:P,label:r||void 0,"events-url":g||void 0,view:_||void 0,date:v||void 0,"empty-text":y||void 0,"error-text":b||void 0,"first-day":x==null?void 0:String(x),className:T||void 0,style:E,...D})});export{h as default};
@@ -1 +1 @@
1
- import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import{forwardRef as n,useCallback as r,useEffect as i,useLayoutEffect as a,useRef as o,useState as s}from"react";import{jsx as c}from"react/jsx-runtime";var l=`wui-chart:select`,u=`wui-chart:legend-change`,d=`wui-chart:ready`,f=[`line`,`area`,`column`,`bar`,`donut`,`heatmap`,`calendar`,`funnel`,`gauge`,`waterfall`,`treemap`,`sankey`,`scatter`,`bubble`,`multiples`],p=[`none`,`stacked`,`percent`],m=[`ready`,`loading`,`empty`,`error`],h=[`auto`,`svg`,`canvas`],g=[`chart`,`table`],_=`This chart couldn't load. Try again in a moment.`,v=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}},y=!1;function b(){y||!v()||(y=!0,console.warn("[@webority/ui-react] <AppChart> has no `title`, which names the chart for assistive tech and its exported files."))}var x=e=>e===``?void 0:e,S=e=>Array.isArray(e)?e.map(S):e==null||Object.getPrototypeOf(e)!==Object.prototype?e:Object.fromEntries(Object.entries(e).filter(([,e])=>e!==``).map(([e,t])=>[e,S(t)])),C=e=>({type:x(e.type),title:x(e.title),description:x(e.description),data:e.data,x:S(e.x),series:S(e.series),group:S(e.group),to:S(e.to),size:S(e.size),trend:e.trend,zoom:e.zoom,bands:S(e.bands),stack:x(e.stack),y:S(e.y),target:S(e.target),height:e.height>0?e.height:void 0,state:x(e.state),emptyText:x(e.emptyText),errorText:x(e.errorText),renderer:x(e.renderer)}),w=(e,t)=>t!=null&&Object.keys(e).every(n=>Object.is(e[n],t[n])),T=e=>{try{return JSON.stringify(e)}catch{return null}},E=n(function({type:n,title:v,description:y,data:x,x:S,series:E,group:D,to:O,size:k,trend:A,zoom:j,bands:M,stack:N,y:P,target:F,height:I,state:L,emptyText:R,errorText:z,renderer:B,view:V,onSelect:H,onLegendChange:U,onReady:W,className:G=``,style:K,...q},J){t(`AppChart`,q),e(`AppChart`,`type`,n,f),e(`AppChart`,`stack`,N,p),e(`AppChart`,`state`,L,m),e(`AppChart`,`renderer`,B,h),e(`AppChart`,`view`,V,g),v||b();let Y=o(null),X=o({props:null,signature:null}),Z=o({onSelect:H,onLegendChange:U,onReady:W}),[Q,$]=s(!1),ee=r(e=>{Y.current=e,typeof J==`function`?J(e):J&&(J.current=e)},[J]);return i(()=>{Z.current={onSelect:H,onLegendChange:U,onReady:W}}),a(()=>{let e=Y.current;if(!e)return;let t={type:n,title:v,description:y,data:x,x:S,series:E,group:D,to:O,size:k,trend:A,zoom:j,bands:M,stack:N,y:P,target:F,height:I,state:L,emptyText:R,errorText:z,renderer:B};if(w(t,X.current.props))return;X.current.props=t;let r=C(t),i=T(r);i!==null&&i===X.current.signature||(X.current.signature=i,e.spec=r)}),i(()=>{let e=Y.current,t=e=>t=>Z.current[e]?.(t.detail),n=[[l,t(`onSelect`)],[u,t(`onLegendChange`)],[d,t(`onReady`)]];for(let[t,r]of n)e.addEventListener(t,r);return()=>{for(let[t,r]of n)e.removeEventListener(t,r)}},[]),i(()=>{let e=!0;return import(`@webority/ui-elements/chart`).catch(t=>{console.warn(`[AppChart] the chart failed to load:`,t?.message),e&&$(!0)}),()=>{e=!1}},[]),Q?c(`div`,{className:G||void 0,style:K,role:`status`,children:c(`p`,{className:`wui-chart-state-text`,children:z||_})}):c(`wui-chart`,{ref:ee,view:V||void 0,className:G||void 0,style:K,...q})});export{E as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import{forwardRef as r,useCallback as i,useEffect as a,useLayoutEffect as o,useRef as s,useState as c}from"react";import{jsx as l}from"react/jsx-runtime";var u=`wui-chart:select`,d=`wui-chart:legend-change`,f=`wui-chart:ready`,p=[`line`,`area`,`column`,`bar`,`donut`,`heatmap`,`calendar`,`funnel`,`gauge`,`waterfall`,`treemap`,`sankey`,`scatter`,`bubble`,`multiples`],m=[`none`,`stacked`,`percent`],h=[`ready`,`loading`,`empty`,`error`],g=[`auto`,`svg`,`canvas`],_=[`chart`,`table`],v=`This chart couldn't load. Try again in a moment.`,y=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}},b=!1;function x(){b||!y()||(b=!0,e("[@webority/ui-react] <AppChart> has no `title`, which names the chart for assistive tech and its exported files."))}var S=e=>e===``?void 0:e,C=e=>Array.isArray(e)?e.map(C):e==null||Object.getPrototypeOf(e)!==Object.prototype?e:Object.fromEntries(Object.entries(e).filter(([,e])=>e!==``).map(([e,t])=>[e,C(t)])),w=e=>({type:S(e.type),title:S(e.title),description:S(e.description),data:e.data,x:C(e.x),series:C(e.series),group:C(e.group),to:C(e.to),size:C(e.size),trend:e.trend,zoom:e.zoom,bands:C(e.bands),stack:S(e.stack),y:C(e.y),target:C(e.target),height:e.height>0?e.height:void 0,state:S(e.state),emptyText:S(e.emptyText),errorText:S(e.errorText),renderer:S(e.renderer)}),T=(e,t)=>t!=null&&Object.keys(e).every(n=>Object.is(e[n],t[n])),E=e=>{try{return JSON.stringify(e)}catch{return null}},D=r(function({type:r,title:y,description:b,data:S,x:C,series:D,group:O,to:k,size:A,trend:j,zoom:M,bands:N,stack:P,y:F,target:I,height:L,state:R,emptyText:z,errorText:B,renderer:V,view:H,onSelect:U,onLegendChange:W,onReady:G,className:K=``,style:q,...J},Y){n(`AppChart`,J),t(`AppChart`,`type`,r,p),t(`AppChart`,`stack`,P,m),t(`AppChart`,`state`,R,h),t(`AppChart`,`renderer`,V,g),t(`AppChart`,`view`,H,_),y||x();let X=s(null),Z=s({props:null,signature:null}),Q=s({onSelect:U,onLegendChange:W,onReady:G}),[$,ee]=c(!1),te=i(e=>{X.current=e,typeof Y==`function`?Y(e):Y&&(Y.current=e)},[Y]);return a(()=>{Q.current={onSelect:U,onLegendChange:W,onReady:G}}),o(()=>{let e=X.current;if(!e)return;let t={type:r,title:y,description:b,data:S,x:C,series:D,group:O,to:k,size:A,trend:j,zoom:M,bands:N,stack:P,y:F,target:I,height:L,state:R,emptyText:z,errorText:B,renderer:V};if(T(t,Z.current.props))return;Z.current.props=t;let n=w(t),i=E(n);i!==null&&i===Z.current.signature||(Z.current.signature=i,e.spec=n)}),a(()=>{let e=X.current,t=e=>t=>Q.current[e]?.(t.detail),n=[[u,t(`onSelect`)],[d,t(`onLegendChange`)],[f,t(`onReady`)]];for(let[t,r]of n)e.addEventListener(t,r);return()=>{for(let[t,r]of n)e.removeEventListener(t,r)}},[]),a(()=>{let t=!0;return import(`@webority/ui-elements/chart`).catch(n=>{e(`[AppChart] the chart failed to load:`,n?.message),t&&ee(!0)}),()=>{t=!1}},[]),$?l(`div`,{className:K||void 0,style:q,role:`status`,children:l(`p`,{className:`wui-chart-state-text`,children:B||v})}):l(`wui-chart`,{ref:te,view:H||void 0,className:K||void 0,style:q,...J})});export{D as default};
@@ -1 +1 @@
1
- import e from"./warnUnknownProps.js";import t from"./AppIcon.js";import n from"./AppButton.js";import r from"./AppCard.js";import i from"./AppDropdown.js";import a from"./AppSegmented.js";import{useLayoutEffect as o,useRef as s,useState as c}from"react";import{Dropdown as l}from"react-bootstrap";import{Fragment as u,jsx as d,jsxs as f}from"react/jsx-runtime";var p=[{value:`chart`,label:`Chart`,icon:`chart`},{value:`table`,label:`Table`,icon:`grid`}],m=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}},h=!1;function g(){h||!m()||(h=!0,console.warn("[@webority/ui-react] <AppChartCard> has no `title`, which is the card's heading and names its menu button."))}var _=e=>e.getAttribute(`view`)===`table`?`table`:`chart`;function v({title:m,subtitle:h,toolbar:v=!0,onRetry:y,footer:b,children:x,className:S=``,...C}){e(`AppChartCard`,C),m||g();let w=s(null),T=s(null),[E,D]=c(`chart`),O=s(E);O.current=E;let[k,A]=c(!0),j=()=>w.current?.querySelector(`wui-chart`);o(()=>{let e=w.current,t=()=>{let t=e.querySelector(`wui-chart`);if(t){if(t===T.current){D(_(t));return}T.current=t,t.hasAttribute(`view`)?D(_(t)):O.current!==`chart`&&t.setAttribute(`view`,O.current)}};t();let n=new MutationObserver(t);return n.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`view`]}),()=>n.disconnect()},[]);let M=f(u,{children:[d(`button`,{type:`button`,className:`topbar-icon-btn wui-chart-card-tool wui-chart-card-legend-tool`,"aria-pressed":k,"aria-label":`Show legend`,title:`Show or hide the legend`,onClick:()=>A(!k),children:d(t,{name:`list`,size:16})}),d(a,{size:`sm`,label:`View`,options:p,value:E,onChange:e=>{D(e),j()?.setAttribute(`view`,e)}}),f(i,{icon:`more-horizontal`,label:m?`More actions for ${m}`:`More actions`,children:[f(l.Item,{as:`button`,type:`button`,onClick:()=>j()?.exportPng?.(),children:[d(t,{name:`image`,size:16}),`Download PNG`]}),f(l.Item,{as:`button`,type:`button`,onClick:()=>j()?.exportCsv?.(),children:[d(t,{name:`download`,size:16}),`Download CSV`]})]})]}),N=[`wui-chart-card`,k?``:`wui-chart-card-legend-off`,S].filter(Boolean).join(` `);return f(r,{title:m,subtitle:h,headerActions:v?M:void 0,footer:b,className:N,...C,children:[d(`div`,{ref:w,children:x}),y&&d(`div`,{className:`wui-chart-card-retry`,children:d(n,{variant:`outline`,size:`sm`,onClick:y,children:`Try again`})})]})}export{v as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";import t from"./warnUnknownProps.js";import n from"./AppIcon.js";import r from"./AppButton.js";import i from"./AppCard.js";import a from"./AppDropdown.js";import o from"./AppSegmented.js";import{useLayoutEffect as s,useRef as c,useState as l}from"react";import{Dropdown as u}from"react-bootstrap";import{Fragment as d,jsx as f,jsxs as p}from"react/jsx-runtime";var m=[{value:`chart`,label:`Chart`,icon:`chart`},{value:`table`,label:`Table`,icon:`grid`}],h=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}},g=!1;function _(){g||!h()||(g=!0,e("[@webority/ui-react] <AppChartCard> has no `title`, which is the card's heading and names its menu button."))}var v=e=>e.getAttribute(`view`)===`table`?`table`:`chart`;function y({title:e,subtitle:h,toolbar:g=!0,onRetry:y,footer:b,children:x,className:S=``,...C}){t(`AppChartCard`,C),e||_();let w=c(null),T=c(null),[E,D]=l(`chart`),O=c(E);O.current=E;let[k,A]=l(!0),j=()=>w.current?.querySelector(`wui-chart`);s(()=>{let e=w.current,t=()=>{let t=e.querySelector(`wui-chart`);if(t){if(t===T.current){D(v(t));return}T.current=t,t.hasAttribute(`view`)?D(v(t)):O.current!==`chart`&&t.setAttribute(`view`,O.current)}};t();let n=new MutationObserver(t);return n.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`view`]}),()=>n.disconnect()},[]);let M=p(d,{children:[f(`button`,{type:`button`,className:`topbar-icon-btn wui-chart-card-tool wui-chart-card-legend-tool`,"aria-pressed":k,"aria-label":`Show legend`,title:`Show or hide the legend`,onClick:()=>A(!k),children:f(n,{name:`list`,size:16})}),f(o,{size:`sm`,label:`View`,options:m,value:E,onChange:e=>{D(e),j()?.setAttribute(`view`,e)}}),p(a,{icon:`more-horizontal`,label:e?`More actions for ${e}`:`More actions`,children:[p(u.Item,{as:`button`,type:`button`,onClick:()=>j()?.exportPng?.(),children:[f(n,{name:`image`,size:16}),`Download PNG`]}),p(u.Item,{as:`button`,type:`button`,onClick:()=>j()?.exportCsv?.(),children:[f(n,{name:`download`,size:16}),`Download CSV`]})]})]}),N=[`wui-chart-card`,k?``:`wui-chart-card-legend-off`,S].filter(Boolean).join(` `);return p(i,{title:e,subtitle:h,headerActions:g?M:void 0,footer:b,className:N,...C,children:[f(`div`,{ref:w,children:x}),y&&f(`div`,{className:`wui-chart-card-retry`,children:f(r,{variant:`outline`,size:`sm`,onClick:y,children:`Try again`})})]})}export{y as default};
@@ -1 +1 @@
1
- import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"./AppIcon.js";import{AppSkeletonRows as r}from"./AppSkeleton.js";import i from"./AppTablePagination.js";import{attachRowDrag as a,attachScrollEdges as o,syncTargets as s}from"@webority/ui-elements/helpers";import{Fragment as ee,useEffect as c,useLayoutEffect as l,useMemo as u,useRef as d,useState as f}from"react";import{Fragment as te,jsx as p,jsxs as m}from"react/jsx-runtime";import{COLUMN_MAX_WIDTH as ne,COLUMN_MIN_WIDTH as re,DATA_TABLE_TEXT as ie,PIN_AT_VAR as ae,PIN_SIDES as oe,ROW_HEIGHTS as se,ROW_MOVE_LIMIT as ce,ROW_SAVE_ERROR_CLASS as le,groupCount as ue,groupItems as de,measureRows as fe,pinAtValue as pe,pinClasses as me,planPins as he,playRowMoves as ge,rowOrderChanged as _e,saveOutcomeText as ve,settledRows as ye,virtualRange as be}from"@webority/ui-elements/elements/data-table";var xe=[`comfortable`,`cozy`,`compact`],h=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}},g=new Set;function Se(e,t){g.has(e)||!h()||(g.add(e),console.warn(`[@webority/ui-react] <AppDataTable> ${t}`))}var Ce=100;function _(e){return e===`end`?`wui-cell-end`:e===`num`?`num`:e===`center`?`text-center`:``}function we(e){return e==null||e===``?`-`:typeof e==`boolean`?String(e):e}function Te(e){if(!e||!(e.total>0))return!1;let t=e.pageSizes?.length?e.pageSizes:[e.pageSize];return e.total>Math.min(...t)}function v({columns:h,rows:g,rowKey:v=e=>e.id,sort:Ee,onSort:y,loading:b=!1,skeletonRows:De=5,empty:Oe=`No records found.`,emptyFiltered:ke,sourceCount:Ae,rowActions:x,rowActionsLabel:je,pagination:S,ariaLabel:Me,className:Ne=``,wrapperClassName:Pe=``,selectable:C=!1,selectedIds:w,onToggleRow:Fe,onToggleAll:Ie,onSelectRange:Le,renderExpanded:Re,density:T=`comfortable`,striped:ze=!1,flush:Be=!1,rowDrag:E=!1,maxHeight:D,stickyFirstColumn:Ve=!1,stickyActions:He=!1,stackOnMobile:O=!1,hiddenColumns:Ue,rowStatus:We,rowHref:k,onRowClick:A,activeRowKey:Ge,resizableColumns:j=!1,viewKey:Ke,groupBy:M,groupLabel:qe,virtual:N=!1,rowSaving:Je,rowSaveError:Ye,...Xe}){t(`AppDataTable`,Xe);let Ze=Ue?.length?new Set(Ue):null;h=Ze?h.filter(e=>!(e.hideable&&Ze.has(e.key))):h,e(`AppDataTable`,`density`,T,xe);for(let t of h)e(`AppDataTable`,`column.pin`,t.pin,oe);let Qe=[`table table-ledger`,T===`cozy`||T===`compact`?`wui-table-${T}`:``,ze?`wui-table-striped`:``,Ve?`wui-table-sticky-first`:``,He?`wui-table-sticky-actions`:``,O?`wui-table-stack`:``,Ne].filter(Boolean).join(` `),P=typeof Re==`function`,[$e,et]=f(()=>new Set),tt=e=>et(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),nt=h.some(e=>typeof e.footer==`function`),F=typeof k==`function`||typeof A==`function`,rt=e=>!!e.target.closest(`a, button, input, select, textarea, label, [role='menu'], [role='menuitem'], .dropdown`),it=(e,t)=>{if(rt(t)||(A&&A(e),!k))return;let n=k(e);n&&(t.ctrlKey||t.metaKey||t.button===1?window.open(n,`_blank`,`noopener`):window.location.assign(n))},I=D!==void 0,at=[`table-wrap`,I?`wui-table-scroll`:``,Be?`wui-table-flush`:``,Pe].filter(Boolean).join(` `),ot=I?{maxHeight:D}:void 0,L=Math.max(1,h.length+ +!!x+ +!!C+ +!!P),st=h.some(e=>e.pin===`start`||e.pin===`end`),R=st||j||!!M||N,z=+!!P+ +!!C,ct=st?he([...P?[`lead`]:[],...C?[`lead`]:[],...h.map(e=>e.pin===`start`||e.pin===`end`?e.pin:null),...x?[null]:[]]):[],B=(e,t=``)=>{let n=ct[e];return n?{className:`${t.trim()} ${me(n)}`.trim(),style:{[ae]:pe(n.side,n.ordinal)}}:{className:t,style:void 0}},V=(e,t)=>ct[e]?{...t,...B(e).style}:t,lt=h.length-1+ +!!x;Ke&&!j&&Se(`view-key`,"`viewKey` remembers resized widths: add `resizableColumns`."),N&&!I&&Se(`virtual-height`,"`virtual` needs `maxHeight`: without a scroll box every row renders."),N&&(P||O)&&Se(`virtual-shape`,"`virtual` takes rows of one height, so it is off with `renderExpanded` or `stackOnMobile`.");let H=N&&I&&!P&&!O&&!b&&g?.length>0,U=C&&g?g.reduce((e,t,n)=>e+ +!!w?.has(v(t,n)),0):0,ut=C&&g&&g.length>0&&U===g.length,dt=U>0&&!ut,ft=e=>{e&&(e.indeterminate=dt)},pt=d(null),mt=(e,t)=>{let n=pt.current;pt.current=e;let r=t&&n!==null?g.findIndex((e,t)=>v(e,t)===n):-1,i=g.findIndex((t,n)=>v(t,n)===e);if(r<0||i<0||r===i){Fe?.(e);return}let a=!w?.has(e),o=g.slice(Math.min(r,i),Math.max(r,i)+1).map((e,t)=>v(e,Math.min(r,i)+t)).filter(e=>(w?.has(e)||!1)!==a);if(Le)Le(o,a);else for(let e of o)Fe?.(e)},[W,ht]=f(()=>new Set),gt=e=>ht(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),G=u(()=>{let e=(g||[]).map((e,t)=>({row:e,i:t}));return M?de(e,({row:e})=>String(e[M]??``)).flatMap(e=>[{group:e,open:!W.has(e.key)},...W.has(e.key)?[]:e.items]):e},[g,M,W]),K=d(null),q=d(null);c(()=>{let e=K.current;if(!e)return;let t=e=>{let t=e.target.closest?.(`.u-name`);t&&!t.title&&(t.scrollWidth>t.clientWidth||t.scrollHeight>t.clientHeight)&&(t.title=t.textContent.trim())},n=e=>{let t=e.target.closest?.(`tbody > tr[aria-rowindex]`)?.getAttribute(`aria-rowindex`);q.current=t?Number(t)-2:null},r=t=>{e.contains(t.relatedTarget)||(q.current=null)};e.addEventListener(`mouseover`,t),e.addEventListener(`focusin`,t),e.addEventListener(`focusin`,n),e.addEventListener(`focusout`,r);let i=o(e);return()=>{e.removeEventListener(`mouseover`,t),e.removeEventListener(`focusin`,t),e.removeEventListener(`focusin`,n),e.removeEventListener(`focusout`,r),i()}},[R]),c(()=>{if(!E||!K.current)return;let e=a(K.current);return s(document),e},[E,R]);let _t=d(!1);c(()=>{!_t.current&&(_t.current=!0,U===0)||K.current?.querySelector(`table`)?.dispatchEvent(new CustomEvent(`selectionchange`,{bubbles:!0,detail:{selected:U,total:g?.length??0,keys:g?g.map((e,t)=>v(e,t)).filter(e=>w?.has(e)).map(String):[]}}))},[C,U]);let[vt,yt]=f({top:0,height:0}),[J,bt]=f(se[T]??se.comfortable);c(()=>{let e=K.current;if(!H||!e)return;let t=0,n=()=>{t=0;let n=e.querySelector(`:scope > table > thead`)?.getBoundingClientRect().height||0,r={top:Math.max(0,e.scrollTop-n),height:e.clientHeight};yt(e=>e.top===r.top&&e.height===r.height?e:r)},r=()=>{t||=requestAnimationFrame(n)};e.addEventListener(`scroll`,r,{passive:!0});let i=typeof ResizeObserver<`u`?new ResizeObserver(r):null;return i?.observe(e),n(),()=>{e.removeEventListener(`scroll`,r),i?.disconnect(),t&&cancelAnimationFrame(t)}},[H,R]),l(()=>{if(!H)return;let e=(K.current?.querySelector(`:scope > table > tbody > tr:not(.wui-virtual-spacer, .wui-group-row)`))?.getBoundingClientRect().height;e>0&&Math.abs(e-J)>.5&&bt(e)});let Y={start:0,end:G.length,before:0,after:0};if(H){Y=be({scrollTop:vt.top,viewport:vt.height||Number.parseFloat(D)||0,rowHeight:J,count:G.length});let e=q.current;e!==null&&e>=0&&e<G.length&&(e<Y.start&&Y.start-e<=Ce&&(Y={...Y,start:e,before:e*J}),e>=Y.end&&e-Y.end<Ce&&(Y={...Y,end:e+1,after:(G.length-e-1)*J}))}let xt=d(null),X=d(null),Z=d(null),St=!N&&!b&&g?.length>0&&g.length<=ce;l(()=>{let e=xt.current;if(!St||!e){X.current=null,Z.current=null;return}let t=g.map((e,t)=>v(e,t));_e(Z.current,t)&&ge(e.rows,X.current),X.current=fe(e.rows),Z.current=t});let Ct=typeof Je==`function`||typeof Ye==`function`,wt=e=>{let t=!!Je?.(e),n=t?``:Ye?.(e)||``;return{state:t?`saving`:n?`error`:null,message:n}},Tt=d(null),Et=d(null);c(()=>{if(!Ct){Et.current=null;return}let e=h[0]?.key,t=new Map;(g||[]).forEach((n,r)=>{let i=e===void 0?void 0:n[e],a=typeof i==`string`||typeof i==`number`?String(i):``;t.set(v(n,r),{...wt(n),label:a})});let n=ve(ye(Et.current,t));Et.current=t,n&&Tt.current&&(Tt.current.textContent=n)});let Dt=ke!==void 0&&Ae>0?ke:Oe,Ot=({group:e,open:t},r)=>{let i=e.items[0].row[M],a=e.items.map(e=>e.row);return p(`tr`,{className:`wui-group-row`,"data-group-key":e.key,"aria-rowindex":H?r+2:void 0,children:p(`th`,{className:`wui-group-cell`,scope:`rowgroup`,colSpan:L,children:m(`button`,{type:`button`,className:`wui-group-toggle`,"aria-expanded":t,onClick:()=>gt(e.key),children:[p(n,{name:`chevron-down`,size:16}),p(`span`,{className:`wui-group-label`,children:qe?qe(i,a):we(i)}),p(`span`,{className:`wui-group-count`,"aria-hidden":`true`,children:ue(e.items.length)}),p(`span`,{className:`visually-hidden wui-group-rows`,children:`, ${ie.rows(e.items.length)}`})]})})},`group:${e.key}`)},kt=({row:e,i:t},r)=>{let i=v(e,t),a=P&&$e.has(i),o=Ge!=null&&String(Ge)===String(i),s=String(i).replace(/[^a-z0-9]/gi,`_`),c=B(0,`wui-expand-cell`),l=B(+!!P,`wui-select-cell`),u=Ct?wt(e):null;return m(ee,{children:[m(`tr`,{className:[C&&w?.has(i)?`is-selected`:``,F?`wui-row-link`:``,o?`wui-row-active`:``].filter(Boolean).join(` `)||void 0,"aria-current":o?`true`:void 0,"aria-rowindex":H?r+2:void 0,"aria-busy":u?.state===`saving`?`true`:void 0,"data-wui-save-state":u?.state||void 0,"data-status":We?.(e)||void 0,"data-href":k?.(e)||void 0,"data-row-key":E?String(i):void 0,tabIndex:F?0:void 0,onClick:F?t=>it(e,t):void 0,onAuxClick:F&&k?t=>t.button===1&&it(e,t):void 0,onKeyDown:F?t=>{t.key===`Enter`&&t.target===t.currentTarget&&it(e,t)}:void 0,children:[P&&p(`td`,{className:c.className,style:c.style,children:p(`button`,{type:`button`,className:`wui-expand-toggle${a?` is-open`:``}`,"aria-expanded":a,"aria-controls":a?`${s}-expanded`:void 0,"aria-label":a?`Collapse row`:`Expand row`,onClick:()=>tt(i),children:p(n,{name:`chevron-down`,size:16})})}),C&&p(`td`,{className:l.className,style:l.style,children:p(`input`,{type:`checkbox`,className:`wui-check`,checked:w?.has(i)||!1,onChange:e=>mt(i,e.nativeEvent.shiftKey),onMouseDown:e=>{e.shiftKey&&e.preventDefault()},"aria-label":`Select row`})}),h.map((t,n)=>m(`td`,{className:B(z+n,(n===0?`wui-name-cell `:``)+(t.nowrap?`text-nowrap `:``)+_(t.align)+(t.cellClassName?` ${t.cellClassName}`:``)).className,style:V(z+n,t.cellStyle),"data-label":O&&typeof t.label==`string`?t.label:void 0,children:[t.render?t.render(e):we(e[t.key]),n===0&&u?.state===`error`&&p(`span`,{className:le,children:u.message})]},t.key)),x&&p(`td`,{children:p(`div`,{className:`u-row-actions`,children:x(e)})})]}),a&&p(`tr`,{className:`wui-row-expanded`,children:p(`td`,{id:`${s}-expanded`,colSpan:L,children:Re(e)})})]},i)},At=(e,t)=>e.group?Ot(e,t):kt(e,t),jt=(e,t)=>H?p(`tr`,{className:`wui-virtual-spacer`,"aria-hidden":`true`,hidden:t===0,children:p(`td`,{colSpan:L,style:{height:t}})},e):null,Q=B(0,`wui-expand-cell`),$=B(+!!P,`wui-select-cell`);return m(te,{children:[m(R?`wui-data-table`:`div`,{ref:K,...R?{class:at,resizable:j?``:void 0,"view-key":Ke||void 0,"data-wui-row-drag":E?``:void 0}:{className:at,"data-wui-row-drag":E?``:void 0},style:ot,tabIndex:0,...Xe,children:[m(`table`,{className:Qe,"aria-label":Me,"aria-rowcount":H?G.length+1:void 0,children:[p(`thead`,{children:m(`tr`,{"aria-rowindex":H?1:void 0,children:[P&&p(`th`,{className:Q.className,style:Q.style,children:p(`span`,{className:`visually-hidden`,children:`Expand`})}),C&&p(`th`,{className:$.className,style:$.style,children:p(`input`,{ref:ft,type:`checkbox`,className:`wui-check`,checked:ut,onChange:e=>Ie?.(e.target.checked),"aria-label":`Select all rows`})}),h.map((e,t)=>{let r=!!(e.sortable&&y),i=Ee&&Ee.key===e.key,a=e.align===`num`||e.align===`end`,o=r&&p(`span`,{className:`sort-icon${a?` wui-sort-lead`:``}`,children:p(n,{name:`chevrons-up-down`,size:14})}),s=j&&t!==lt,ee=e.width||e.minWidth?{width:e.width,minWidth:e.minWidth}:void 0;return m(`th`,{className:B(z+t,(r?`sortable `:``)+(t===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+(e.grow?`wui-col-grow `:``)+(s?`wui-col-resizable `:``)+_(e.align)).className,style:V(z+t,ee),"data-key":R?e.key:void 0,"aria-label":s&&typeof e.label==`string`?e.label:void 0,"data-pin":e.pin===`start`||e.pin===`end`?e.pin:void 0,tabIndex:r?0:void 0,"aria-sort":i?Ee.dir===`asc`?`ascending`:`descending`:r?`none`:void 0,onClick:r?()=>y(e.key):void 0,onKeyDown:r?t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),y(e.key))}:void 0,children:[a&&o,e.label,!a&&o,s&&p(`span`,{className:`wui-col-resize`,role:`separator`,"aria-orientation":`vertical`,"aria-valuemin":re,"aria-valuemax":ne,tabIndex:0,"aria-label":ie.resize(typeof e.label==`string`?e.label:e.key)})]},e.key)}),x&&(je?p(`th`,{className:`wui-cell-end`,children:je}):p(`th`,{className:`wui-cell-end`,children:p(`span`,{className:`visually-hidden`,children:`Actions`})}))]})}),p(`tbody`,{ref:xt,children:b?p(r,{rows:De,cols:L}):g?.length?m(te,{children:[jt(`before`,Y.before),G.slice(Y.start,Y.end).map((e,t)=>At(e,Y.start+t)),jt(`after`,Y.after)]}):null}),nt&&!b&&g?.length>0&&p(`tfoot`,{children:m(`tr`,{children:[P&&p(`td`,{className:Q.className,style:Q.style}),C&&p(`td`,{className:$.className,style:$.style}),h.map((e,t)=>p(`td`,{className:B(z+t,(t===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+_(e.align)).className,style:V(z+t,void 0),children:e.footer?e.footer(g):null},e.key)),x&&p(`td`,{})]})})]}),!b&&!g?.length&&p(`div`,{className:`tbl-empty-block`,children:typeof Dt==`string`?p(`div`,{className:`tbl-empty-plain`,children:Dt}):Dt})]}),Te(S)&&p(i,{page:S.page,totalPages:S.totalPages,pageSize:S.pageSize,onPageChange:S.setPage,onPageSizeChange:S.setPageSize,pageSizes:S.pageSizes,mode:S.mode}),Ct&&p(`div`,{ref:Tt,className:`visually-hidden`,role:`status`,"aria-live":`polite`,"data-wui-table-status":``})]})}export{v as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"./AppIcon.js";import{AppSkeletonRows as i}from"./AppSkeleton.js";import a from"./AppTablePagination.js";import{attachRowDrag as o,attachScrollEdges as s,syncTargets as c}from"@webority/ui-elements/helpers";import{Fragment as ee,useEffect as l,useLayoutEffect as u,useMemo as d,useRef as f,useState as p}from"react";import{Fragment as te,jsx as m,jsxs as h}from"react/jsx-runtime";import{COLUMN_MAX_WIDTH as ne,COLUMN_MIN_WIDTH as re,DATA_TABLE_TEXT as ie,PIN_AT_VAR as ae,PIN_SIDES as oe,ROW_HEIGHTS as se,ROW_MOVE_LIMIT as ce,ROW_SAVE_ERROR_CLASS as le,groupCount as ue,groupItems as de,measureRows as fe,pinAtValue as pe,pinClasses as me,planPins as he,playRowMoves as ge,rowOrderChanged as _e,saveOutcomeText as ve,settledRows as ye,virtualRange as be}from"@webority/ui-elements/elements/data-table";var xe=[`comfortable`,`cozy`,`compact`],g=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}},_=new Set;function v(t,n){_.has(t)||!g()||(_.add(t),e(`[@webority/ui-react] <AppDataTable> ${n}`))}var Se=100;function y(e){return e===`end`?`wui-cell-end`:e===`num`?`num`:e===`center`?`text-center`:``}function Ce(e){return e==null||e===``?`-`:typeof e==`boolean`?String(e):e}function we(e){if(!e||!(e.total>0))return!1;let t=e.pageSizes?.length?e.pageSizes:[e.pageSize];return e.total>Math.min(...t)}function b({columns:e,rows:g,rowKey:_=e=>e.id,sort:b,onSort:x,loading:S=!1,skeletonRows:Te=5,empty:Ee=`No records found.`,emptyFiltered:De,sourceCount:Oe,rowActions:C,rowActionsLabel:ke,pagination:w,ariaLabel:Ae,className:je=``,wrapperClassName:Me=``,selectable:T=!1,selectedIds:E,isRowSelectable:D,onToggleRow:O,onToggleAll:Ne,onSelectRange:Pe,renderExpanded:Fe,density:k=`comfortable`,striped:Ie=!1,flush:Le=!1,rowDrag:A=!1,maxHeight:j,stickyFirstColumn:Re=!1,stickyActions:ze=!1,stackOnMobile:M=!1,hiddenColumns:Be,rowStatus:Ve,rowHref:N,onRowClick:P,activeRowKey:He,resizableColumns:F=!1,viewKey:Ue,groupBy:I,groupLabel:We,virtual:L=!1,rowSaving:Ge,rowSaveError:Ke,...qe}){n(`AppDataTable`,qe);let Je=Be?.length?new Set(Be):null;e=Je?e.filter(e=>!(e.hideable&&Je.has(e.key))):e,t(`AppDataTable`,`density`,k,xe);for(let n of e)t(`AppDataTable`,`column.pin`,n.pin,oe);let Ye=[`table table-ledger`,k===`cozy`||k===`compact`?`wui-table-${k}`:``,Ie?`wui-table-striped`:``,Re?`wui-table-sticky-first`:``,ze?`wui-table-sticky-actions`:``,M?`wui-table-stack`:``,je].filter(Boolean).join(` `),R=typeof Fe==`function`,[Xe,Ze]=p(()=>new Set),Qe=e=>Ze(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),$e=e.some(e=>typeof e.footer==`function`),z=typeof N==`function`||typeof P==`function`,et=e=>!!e.target.closest(`a, button, input, select, textarea, label, [role='menu'], [role='menuitem'], .dropdown`),tt=(e,t)=>{if(et(t)||(P&&P(e),!N))return;let n=N(e);n&&(t.ctrlKey||t.metaKey||t.button===1?window.open(n,`_blank`,`noopener`):window.location.assign(n))},B=j!==void 0,nt=[`table-wrap`,B?`wui-table-scroll`:``,Le?`wui-table-flush`:``,Me].filter(Boolean).join(` `),rt=B?{maxHeight:j}:void 0,V=Math.max(1,e.length+ +!!C+ +!!T+ +!!R),it=e.some(e=>e.pin===`start`||e.pin===`end`),H=it||F||!!I||L,U=+!!R+ +!!T,at=it?he([...R?[`lead`]:[],...T?[`lead`]:[],...e.map(e=>e.pin===`start`||e.pin===`end`?e.pin:null),...C?[null]:[]]):[],W=(e,t=``)=>{let n=at[e];return n?{className:`${t.trim()} ${me(n)}`.trim(),style:{[ae]:pe(n.side,n.ordinal)}}:{className:t,style:void 0}},ot=(e,t)=>at[e]?{...t,...W(e).style}:t,st=e.length-1+ +!!C;Ue&&!F&&v(`view-key`,"`viewKey` remembers resized widths: add `resizableColumns`."),L&&!B&&v(`virtual-height`,"`virtual` needs `maxHeight`: without a scroll box every row renders."),L&&(R||M)&&v(`virtual-shape`,"`virtual` takes rows of one height, so it is off with `renderExpanded` or `stackOnMobile`.");let G=L&&B&&!R&&!M&&!S&&g?.length>0,K=(e,t)=>!D||!!D(e,t),ct=T&&g?g.reduce((e,t,n)=>e+ +!!K(t,n),0):0,q=T&&g?g.reduce((e,t,n)=>e+(K(t,n)&&E?.has(_(t,n))?1:0),0):0,lt=ct>0&&q===ct,ut=q>0&&!lt,dt=e=>{e&&(e.indeterminate=ut)},ft=f(null),pt=(e,t)=>{let n=ft.current;ft.current=e;let r=t&&n!==null?g.findIndex((e,t)=>_(e,t)===n):-1,i=g.findIndex((t,n)=>_(t,n)===e);if(r<0||i<0||r===i){O?.(e);return}let a=!E?.has(e),o=Math.min(r,i),s=g.slice(o,Math.max(r,i)+1).map((e,t)=>[e,o+t]).filter(([e,t])=>K(e,t)).map(([e,t])=>_(e,t)).filter(e=>(E?.has(e)||!1)!==a);if(Pe)Pe(s,a);else for(let e of s)O?.(e)},mt=e=>{if(!D){Ne?.(e);return}(g||[]).forEach((t,n)=>{let r=_(t,n);K(t,n)&&(E?.has(r)||!1)!==e&&O?.(r)})},[ht,gt]=p(()=>new Set),_t=e=>gt(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),J=d(()=>{let e=(g||[]).map((e,t)=>({row:e,i:t}));return I?de(e,({row:e})=>String(e[I]??``)).flatMap(e=>[{group:e,open:!ht.has(e.key)},...ht.has(e.key)?[]:e.items]):e},[g,I,ht]),Y=f(null),vt=f(null);l(()=>{let e=Y.current;if(!e)return;let t=e=>{let t=e.target.closest?.(`.u-name`);t&&!t.title&&(t.scrollWidth>t.clientWidth||t.scrollHeight>t.clientHeight)&&(t.title=t.textContent.trim())},n=e=>{let t=e.target.closest?.(`tbody > tr[aria-rowindex]`)?.getAttribute(`aria-rowindex`);vt.current=t?Number(t)-2:null},r=t=>{e.contains(t.relatedTarget)||(vt.current=null)};e.addEventListener(`mouseover`,t),e.addEventListener(`focusin`,t),e.addEventListener(`focusin`,n),e.addEventListener(`focusout`,r);let i=s(e);return()=>{e.removeEventListener(`mouseover`,t),e.removeEventListener(`focusin`,t),e.removeEventListener(`focusin`,n),e.removeEventListener(`focusout`,r),i()}},[H]),l(()=>{if(!A||!Y.current)return;let e=o(Y.current);return c(document),e},[A,H]);let yt=f(!1);l(()=>{!yt.current&&(yt.current=!0,q===0)||Y.current?.querySelector(`table`)?.dispatchEvent(new CustomEvent(`selectionchange`,{bubbles:!0,detail:{selected:q,total:g?.length??0,keys:g?g.flatMap((e,t)=>{let n=_(e,t);return K(e,t)&&E?.has(n)?[String(n)]:[]}):[]}}))},[T,q]);let[bt,xt]=p({top:0,height:0}),[X,St]=p(se[k]??se.comfortable);l(()=>{let e=Y.current;if(!G||!e)return;let t=0,n=()=>{t=0;let n=e.querySelector(`:scope > table > thead`)?.getBoundingClientRect().height||0,r={top:Math.max(0,e.scrollTop-n),height:e.clientHeight};xt(e=>e.top===r.top&&e.height===r.height?e:r)},r=()=>{t||=requestAnimationFrame(n)};e.addEventListener(`scroll`,r,{passive:!0});let i=typeof ResizeObserver<`u`?new ResizeObserver(r):null;return i?.observe(e),n(),()=>{e.removeEventListener(`scroll`,r),i?.disconnect(),t&&cancelAnimationFrame(t)}},[G,H]),u(()=>{if(!G)return;let e=(Y.current?.querySelector(`:scope > table > tbody > tr:not(.wui-virtual-spacer, .wui-group-row)`))?.getBoundingClientRect().height;e>0&&Math.abs(e-X)>.5&&St(e)});let Z={start:0,end:J.length,before:0,after:0};if(G){Z=be({scrollTop:bt.top,viewport:bt.height||Number.parseFloat(j)||0,rowHeight:X,count:J.length});let e=vt.current;e!==null&&e>=0&&e<J.length&&(e<Z.start&&Z.start-e<=Se&&(Z={...Z,start:e,before:e*X}),e>=Z.end&&e-Z.end<Se&&(Z={...Z,end:e+1,after:(J.length-e-1)*X}))}let Ct=f(null),wt=f(null),Tt=f(null),Et=!L&&!S&&g?.length>0&&g.length<=ce;u(()=>{let e=Ct.current;if(!Et||!e){wt.current=null,Tt.current=null;return}let t=g.map((e,t)=>_(e,t));_e(Tt.current,t)&&ge(e.rows,wt.current),wt.current=fe(e.rows),Tt.current=t});let Dt=typeof Ge==`function`||typeof Ke==`function`,Ot=e=>{let t=!!Ge?.(e),n=t?``:Ke?.(e)||``;return{state:t?`saving`:n?`error`:null,message:n}},kt=f(null),At=f(null);l(()=>{if(!Dt){At.current=null;return}let t=e[0]?.key,n=new Map;(g||[]).forEach((e,r)=>{let i=t===void 0?void 0:e[t],a=typeof i==`string`||typeof i==`number`?String(i):``;n.set(_(e,r),{...Ot(e),label:a})});let r=ve(ye(At.current,n));At.current=n,r&&kt.current&&(kt.current.textContent=r)});let jt=De!==void 0&&Oe>0?De:Ee,Mt=({group:e,open:t},n)=>{let i=e.items[0].row[I],a=e.items.map(e=>e.row);return m(`tr`,{className:`wui-group-row`,"data-group-key":e.key,"aria-rowindex":G?n+2:void 0,children:m(`th`,{className:`wui-group-cell`,scope:`rowgroup`,colSpan:V,children:h(`button`,{type:`button`,className:`wui-group-toggle`,"aria-expanded":t,onClick:()=>_t(e.key),children:[m(r,{name:`chevron-down`,size:16}),m(`span`,{className:`wui-group-label`,children:We?We(i,a):Ce(i)}),m(`span`,{className:`wui-group-count`,"aria-hidden":`true`,children:ue(e.items.length)}),m(`span`,{className:`visually-hidden wui-group-rows`,children:`, ${ie.rows(e.items.length)}`})]})})},`group:${e.key}`)},Nt=({row:t,i:n},i)=>{let a=_(t,n),o=R&&Xe.has(a),s=He!=null&&String(He)===String(a),c=String(a).replace(/[^a-z0-9]/gi,`_`),l=W(0,`wui-expand-cell`),u=W(+!!R,`wui-select-cell`),d=Dt?Ot(t):null,f=K(t,n);return h(ee,{children:[h(`tr`,{className:[T&&f&&E?.has(a)?`is-selected`:``,z?`wui-row-link`:``,s?`wui-row-active`:``].filter(Boolean).join(` `)||void 0,"aria-current":s?`true`:void 0,"aria-rowindex":G?i+2:void 0,"aria-busy":d?.state===`saving`?`true`:void 0,"data-wui-save-state":d?.state||void 0,"data-status":Ve?.(t)||void 0,"data-href":N?.(t)||void 0,"data-row-key":A?String(a):void 0,tabIndex:z?0:void 0,onClick:z?e=>tt(t,e):void 0,onAuxClick:z&&N?e=>e.button===1&&tt(t,e):void 0,onKeyDown:z?e=>{e.key===`Enter`&&e.target===e.currentTarget&&tt(t,e)}:void 0,children:[R&&m(`td`,{className:l.className,style:l.style,children:m(`button`,{type:`button`,className:`wui-expand-toggle${o?` is-open`:``}`,"aria-expanded":o,"aria-controls":o?`${c}-expanded`:void 0,"aria-label":o?`Collapse row`:`Expand row`,onClick:()=>Qe(a),children:m(r,{name:`chevron-down`,size:16})})}),T&&m(`td`,{className:u.className,style:u.style,children:m(`input`,{type:`checkbox`,className:`wui-check`,checked:f&&(E?.has(a)||!1),disabled:!f,onChange:e=>pt(a,e.nativeEvent.shiftKey),onMouseDown:e=>{e.shiftKey&&e.preventDefault()},"aria-label":`Select row`})}),e.map((e,n)=>h(`td`,{className:W(U+n,(n===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+y(e.align)+(e.cellClassName?` ${e.cellClassName}`:``)).className,style:ot(U+n,e.cellStyle),"data-label":M&&typeof e.label==`string`?e.label:void 0,children:[e.render?e.render(t):Ce(t[e.key]),n===0&&d?.state===`error`&&m(`span`,{className:le,children:d.message})]},e.key)),C&&m(`td`,{children:m(`div`,{className:`u-row-actions`,children:C(t)})})]}),o&&m(`tr`,{className:`wui-row-expanded`,children:m(`td`,{id:`${c}-expanded`,colSpan:V,children:Fe(t)})})]},a)},Pt=(e,t)=>e.group?Mt(e,t):Nt(e,t),Ft=(e,t)=>G?m(`tr`,{className:`wui-virtual-spacer`,"aria-hidden":`true`,hidden:t===0,children:m(`td`,{colSpan:V,style:{height:t}})},e):null,Q=W(0,`wui-expand-cell`),$=W(+!!R,`wui-select-cell`);return h(te,{children:[h(H?`wui-data-table`:`div`,{ref:Y,...H?{class:nt,resizable:F?``:void 0,"view-key":Ue||void 0,"data-wui-row-drag":A?``:void 0}:{className:nt,"data-wui-row-drag":A?``:void 0},style:rt,tabIndex:0,...qe,children:[h(`table`,{className:Ye,"aria-label":Ae,"aria-rowcount":G?J.length+1:void 0,children:[m(`thead`,{children:h(`tr`,{"aria-rowindex":G?1:void 0,children:[R&&m(`th`,{className:Q.className,style:Q.style,children:m(`span`,{className:`visually-hidden`,children:`Expand`})}),T&&m(`th`,{className:$.className,style:$.style,children:m(`input`,{ref:dt,type:`checkbox`,className:`wui-check`,checked:lt,onChange:e=>mt(e.target.checked),"aria-label":`Select all rows`})}),e.map((e,t)=>{let n=!!(e.sortable&&x),i=b&&b.key===e.key,a=e.align===`num`||e.align===`end`,o=n&&m(`span`,{className:`sort-icon${a?` wui-sort-lead`:``}`,children:m(r,{name:`chevrons-up-down`,size:14})}),s=F&&t!==st,c=e.width||e.minWidth?{width:e.width,minWidth:e.minWidth}:void 0;return h(`th`,{className:W(U+t,(n?`sortable `:``)+(t===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+(e.grow?`wui-col-grow `:``)+(s?`wui-col-resizable `:``)+y(e.align)).className,style:ot(U+t,c),"data-key":H?e.key:void 0,"aria-label":s&&typeof e.label==`string`?e.label:void 0,"data-pin":e.pin===`start`||e.pin===`end`?e.pin:void 0,tabIndex:n?0:void 0,"aria-sort":i?b.dir===`asc`?`ascending`:`descending`:n?`none`:void 0,onClick:n?()=>x(e.key):void 0,onKeyDown:n?t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),x(e.key))}:void 0,children:[a&&o,e.label,!a&&o,s&&m(`span`,{className:`wui-col-resize`,role:`separator`,"aria-orientation":`vertical`,"aria-valuemin":re,"aria-valuemax":ne,tabIndex:0,"aria-label":ie.resize(typeof e.label==`string`?e.label:e.key)})]},e.key)}),C&&(ke?m(`th`,{className:`wui-cell-end`,children:ke}):m(`th`,{className:`wui-cell-end`,children:m(`span`,{className:`visually-hidden`,children:`Actions`})}))]})}),m(`tbody`,{ref:Ct,children:S?m(i,{rows:Te,cols:V}):g?.length?h(te,{children:[Ft(`before`,Z.before),J.slice(Z.start,Z.end).map((e,t)=>Pt(e,Z.start+t)),Ft(`after`,Z.after)]}):null}),$e&&!S&&g?.length>0&&m(`tfoot`,{children:h(`tr`,{children:[R&&m(`td`,{className:Q.className,style:Q.style}),T&&m(`td`,{className:$.className,style:$.style}),e.map((e,t)=>m(`td`,{className:W(U+t,(t===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+y(e.align)).className,style:ot(U+t,void 0),children:e.footer?e.footer(g):null},e.key)),C&&m(`td`,{})]})})]}),!S&&!g?.length&&m(`div`,{className:`tbl-empty-block`,children:typeof jt==`string`?m(`div`,{className:`tbl-empty-plain`,children:jt}):jt})]}),we(w)&&m(a,{page:w.page,totalPages:w.totalPages,pageSize:w.pageSize,onPageChange:w.setPage,onPageSizeChange:w.setPageSize,pageSizes:w.pageSizes,mode:w.mode}),Dt&&m(`div`,{ref:kt,className:`visually-hidden`,role:`status`,"aria-live":`polite`,"data-wui-table-status":``})]})}export{b as default};
@@ -1 +1 @@
1
- import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import{isEmpty as n}from"../lib/emptyValue.js";import{jsx as r,jsxs as i}from"react/jsx-runtime";var a=[`sm`,`md`],o=[`grid`,`summary`];function s({items:s=[],columns:c=2,size:l=`md`,bordered:u=!1,layout:d=`grid`,title:f,className:p=``,...m}){return t(`AppDescriptions`,m),e(`AppDescriptions`,`size`,l,a),e(`AppDescriptions`,`layout`,d,o),i(`div`,{className:[`descs`,`descs-col-${c}`,l&&l!==`md`?`descs-${l}`:``,u?`descs-bordered`:``,d===`summary`?`wui-descs-summary`:``,p].filter(Boolean).join(` `)||void 0,...m,children:[f&&r(`div`,{className:`descs-title`,children:f}),r(`dl`,{className:`descs-list`,children:s.map((e,t)=>{let a=n(e.value),o=e.span??1,s=e.key??`${e.label}-${t}`;return i(`div`,{className:`descs-item${e.emphasis?` wui-descs-emphasis`:``}`,style:{"--descs-span":o},children:[r(`dt`,{className:`descs-label`,children:e.label}),r(`dd`,{className:`descs-value${a?` is-empty`:``}`,children:a?`-`:e.value})]},s)})})]})}export{s as default};
1
+ import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import{isEmpty as n}from"../lib/emptyValue.js";import{jsx as r,jsxs as i}from"react/jsx-runtime";var a=[`sm`,`md`],o=[`grid`,`summary`];function s({items:s=[],columns:c=2,size:l=`md`,bordered:u=!1,layout:d=`grid`,title:f,className:p=``,...m}){return t(`AppDescriptions`,m),e(`AppDescriptions`,`size`,l,a),e(`AppDescriptions`,`layout`,d,o),i(`div`,{className:[`descs`,`descs-col-${c}`,l&&l!==`md`?`descs-${l}`:``,u?`descs-bordered`:``,d===`summary`?`wui-descs-summary`:``,p].filter(Boolean).join(` `)||void 0,...m,children:[f&&r(`div`,{className:`descs-title`,children:f}),r(`dl`,{className:`descs-list`,children:s.map((e,t)=>{let a=n(e.value),o=Math.min(12,Math.max(1,e.span??1)),s=e.key??`${e.label}-${t}`;return i(`div`,{className:`descs-item${e.emphasis?` wui-descs-emphasis`:``} wui-descs-span-${o}`,children:[r(`dt`,{className:`descs-label`,children:e.label}),r(`dd`,{className:`descs-value${a?` is-empty`:``}`,children:a?`-`:e.value})]},s)})})]})}export{s as default};
@@ -1 +1 @@
1
- import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import{useEffect as n,useRef as r,useState as i}from"react";import{jsx as a,jsxs as o}from"react/jsx-runtime";import"@webority/ui-elements/elements/drawer";var s=[`end`,`start`],c=[`sm`,`md`,`lg`],l=[50,90],u=e=>Array.isArray(e)&&e.length>0&&e.every(e=>Number.isFinite(e)&&e>=10&&e<=100);function d({open:d=!1,onClose:f,title:p,subtitle:m,ariaLabel:h,side:g=`end`,size:_=`md`,snapPoints:v=l,defaultSnap:y=0,onSnapChange:b,dismissible:x=!0,staticBackdrop:S=!1,confirmDiscard:C,dirty:w=!1,footer:T,className:E=``,children:D,...O}){t(`AppDrawer`,O),e(`AppDrawer`,`side`,g,s),e(`AppDrawer`,`size`,_,c),e(`AppDrawer`,`snapPoints`,u(v)?void 0:JSON.stringify(v),[`an array of numbers from 10 to 100`]);let k=r(null),A=r(null),j=r(null),[M,N]=i(!1);A.current={onClose:f,onSnapChange:b,confirmDiscard:C,dirty:w},n(()=>{d||N(!1)},[d]),n(()=>{M&&j.current?.focus()},[M]),n(()=>{let e=k.current;if(!e)return;let t=t=>{if(t.target===e){if(t.preventDefault(),A.current.confirmDiscard&&A.current.dirty){N(!0);return}A.current.onClose?.()}},n=t=>{t.target===e&&A.current.onSnapChange?.(t.detail.index,t.detail.percent)},r=n=>{n.target.closest?.(`[data-wui-dismiss]`)&&t({target:e,preventDefault(){}})};return e.addEventListener(`wui-drawer-close`,t),e.addEventListener(`wui-drawer-snap`,n),e.addEventListener(`click`,r),()=>{e.removeEventListener(`wui-drawer-close`,t),e.removeEventListener(`wui-drawer-snap`,n),e.removeEventListener(`click`,r)}},[]);let P=()=>{N(!1),k.current?.dispatchEvent(new CustomEvent(`wui:drawer:discard`,{bubbles:!0})),A.current.onClose?.()},F=u(v)?v:l;return o(`wui-drawer`,{ref:k,...O,class:[`wui-drawer`,E].filter(Boolean).join(` `),side:g,size:_,"snap-points":F.join(`,`),"default-snap":String(y),static:S?``:void 0,"confirm-discard":C||void 0,open:d?``:void 0,children:[a(`div`,{className:`wui-drawer-backdrop`,"data-wui-drawer-backdrop":``,"aria-hidden":`true`}),o(`div`,{className:`wui-drawer-panel`,role:`dialog`,"aria-modal":`true`,"aria-label":h||p||void 0,tabIndex:-1,children:[a(`div`,{className:`wui-drawer-grip`,"data-wui-drawer-grip":``,children:a(`div`,{className:`wui-drawer-handle`,role:`slider`,tabIndex:0,"aria-orientation":`vertical`,"aria-label":`Sheet height`})}),o(`div`,{className:`wui-drawer-header`,"data-wui-drawer-grip":``,children:[o(`div`,{className:`wui-drawer-headtext`,children:[p&&a(`div`,{className:`wui-drawer-title`,children:p}),m&&a(`div`,{className:`wui-drawer-subtitle`,children:m})]}),x&&a(`button`,{type:`button`,className:`wui-drawer-close`,"data-wui-drawer-close":``,"aria-label":`Close`,children:a(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:a(`path`,{d:`M18 6 6 18M6 6l12 12`})})})]}),a(`div`,{className:`wui-drawer-body`,children:D}),(T||M)&&o(`div`,{className:M?`wui-drawer-footer wui-drawer-discarding`:`wui-drawer-footer`,children:[M&&o(`div`,{className:`wui-drawer-discard`,role:`alert`,children:[a(`span`,{className:`wui-drawer-discard-text`,children:C}),a(`button`,{type:`button`,className:`btn btn-danger btn-sm`,"data-wui-discard-confirm":``,ref:j,onClick:P,children:`Discard`}),a(`button`,{type:`button`,className:`btn btn-secondary btn-sm`,"data-wui-discard-keep":``,onClick:()=>N(!1),children:`Keep editing`})]}),T]})]})]})}export{d as default};
1
+ import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"../lib/DiscardPrompt.js";import{useEffect as r,useRef as i,useState as a}from"react";import{jsx as o,jsxs as s}from"react/jsx-runtime";import"@webority/ui-elements/elements/drawer";var c=[`end`,`start`],l=[`sm`,`md`,`lg`],u=[50,90],d=e=>Array.isArray(e)&&e.length>0&&e.every(e=>Number.isFinite(e)&&e>=10&&e<=100);function f({open:f=!1,onClose:p,title:m,subtitle:h,ariaLabel:g,side:_=`end`,size:v=`md`,snapPoints:y=u,defaultSnap:b=0,onSnapChange:x,dismissible:S=!0,staticBackdrop:C=!1,confirmDiscard:w,dirty:T=!1,footer:E,className:D=``,children:O,...k}){t(`AppDrawer`,k),e(`AppDrawer`,`side`,_,c),e(`AppDrawer`,`size`,v,l),e(`AppDrawer`,`snapPoints`,d(y)?void 0:JSON.stringify(y),[`an array of numbers from 10 to 100`]);let A=i(null),j=i(null),M=i(null),[N,P]=a(!1);j.current={onClose:p,onSnapChange:x,confirmDiscard:w,dirty:T},r(()=>{f||P(!1)},[f]),r(()=>{N&&M.current?.focus()},[N]),r(()=>{let e=A.current;if(!e)return;let t=t=>{if(t.target===e){if(t.preventDefault(),j.current.confirmDiscard&&j.current.dirty){P(!0);return}j.current.onClose?.()}},n=t=>{t.target===e&&j.current.onSnapChange?.(t.detail.index,t.detail.percent)},r=n=>{n.target.closest?.(`[data-wui-dismiss]`)&&t({target:e,preventDefault(){}})};return e.addEventListener(`wui-drawer-close`,t),e.addEventListener(`wui-drawer-snap`,n),e.addEventListener(`click`,r),()=>{e.removeEventListener(`wui-drawer-close`,t),e.removeEventListener(`wui-drawer-snap`,n),e.removeEventListener(`click`,r)}},[]);let F=()=>{P(!1),A.current?.dispatchEvent(new CustomEvent(`wui:drawer:discard`,{bubbles:!0})),j.current.onClose?.()},I=d(y)?y:u;return s(`wui-drawer`,{ref:A,...k,class:[`wui-drawer`,D].filter(Boolean).join(` `),side:_,size:v,"snap-points":I.join(`,`),"default-snap":String(b),static:C?``:void 0,"confirm-discard":w||void 0,open:f?``:void 0,children:[o(`div`,{className:`wui-drawer-backdrop`,"data-wui-drawer-backdrop":``,"aria-hidden":`true`}),s(`div`,{className:`wui-drawer-panel`,role:`dialog`,"aria-modal":`true`,"aria-label":g||m||void 0,tabIndex:-1,children:[o(`div`,{className:`wui-drawer-grip`,"data-wui-drawer-grip":``,children:o(`div`,{className:`wui-drawer-handle`,role:`slider`,tabIndex:0,"aria-orientation":`vertical`,"aria-label":`Sheet height`})}),s(`div`,{className:`wui-drawer-header`,"data-wui-drawer-grip":``,children:[s(`div`,{className:`wui-drawer-headtext`,children:[m&&o(`div`,{className:`wui-drawer-title`,children:m}),h&&o(`div`,{className:`wui-drawer-subtitle`,children:h})]}),S&&o(`button`,{type:`button`,className:`wui-drawer-close`,"data-wui-drawer-close":``,"aria-label":`Close`,children:o(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:o(`path`,{d:`M18 6 6 18M6 6l12 12`})})})]}),o(`div`,{className:`wui-drawer-body`,children:O}),(E||N)&&s(`div`,{className:N?`wui-drawer-footer wui-drawer-discarding`:`wui-drawer-footer`,children:[N&&o(n,{text:w,confirmRef:M,onDiscard:F,onKeep:()=>P(!1)}),E]})]})]})}export{f as default};
@@ -1 +1 @@
1
- import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import{shortcutAria as n,shortcutChip as r}from"../lib/shortcutChip.js";import i from"./AppIcon.js";import a from"./renderIconProp.js";import{forwardRef as o,useEffect as s,useRef as c,useState as l}from"react";import{Dropdown as u}from"react-bootstrap";import{jsx as d,jsxs as f}from"react/jsx-runtime";var p=[`sm`,`md`,`lg`,`xl`],m=!1;function h(){let e=!0;try{e=process.env.NODE_ENV!==`production`}catch{e=!0}!e||m||(m=!0,console.warn("[@webority/ui-react] <AppDropdown> icon-only toggle has no accessible name — pass `label` or `ariaLabel`."))}function g({icon:i,iconSize:o,toggleClassName:m,label:g,ariaLabel:v,align:y=`end`,items:b=[],menuClassName:x=``,linkComponent:S,children:C,trigger:w,show:T,onToggle:E,...D}){t(`AppDropdown`,D);for(let t of b)e(`AppDropdown`,`items[].hiddenFrom`,t.hiddenFrom,p);!w&&!v&&!g&&h();let O=m??(w?`wui-dropdown-trigger`:`topbar-icon-btn`),k=T!==void 0,[A,j]=l(!1),M=k?!!T:A,N=c(null);N.current=(e,t)=>{k||j(e),E?.(e,t)};let P=c(null);return s(()=>{if(!M)return;let e=P.current?.getBoundingClientRect(),t=()=>{let t=P.current?.getBoundingClientRect();(!e||!t||Math.abs(t.top-e.top)>2||Math.abs(t.left-e.left)>2)&&N.current(!1,{source:`scroll`})},n=()=>N.current(!1,{source:`resize`});return window.addEventListener(`scroll`,t,{capture:!0,passive:!0}),window.addEventListener(`resize`,n),()=>{window.removeEventListener(`scroll`,t,{capture:!0}),window.removeEventListener(`resize`,n)}},[M]),f(u,{ref:P,align:y,show:M,onToggle:(e,t)=>N.current(e,t),...D,children:[d(u.Toggle,{as:_,icon:i,iconSize:o,btnClassName:O,trigger:w,title:g,"aria-label":v??(w?void 0:g)}),d(u.Menu,{className:x,renderOnMount:!0,popperConfig:{strategy:`fixed`},children:C??b.map(e=>{if(e.header!=null)return d(`div`,{className:`dropdown-header`,children:e.header},e.key);if(e.divider)return d(u.Divider,{},e.key);let t=e.to?S?{as:S,to:e.to}:{as:`a`,href:e.to}:{as:`button`,type:`button`},i=[e.danger&&`danger`,p.includes(e.hiddenFrom)&&`wui-hidden-from-${e.hiddenFrom}`].filter(Boolean).join(` `)||void 0;return f(u.Item,{...t,onClick:e.onClick,className:i,"aria-keyshortcuts":n(e.shortcut),children:[e.image?d(`img`,{src:e.image,alt:``}):a(e.icon,{size:16}),e.label,r(e.shortcut)]},e.key)})})]})}var _=o(function({icon:e,iconSize:t=20,btnClassName:n=`topbar-icon-btn`,trigger:r,"aria-label":a,className:o,...s},c){return d(`button`,{ref:c,type:`button`,className:n,"aria-label":a,...s,children:r??d(i,{name:e,size:t})})});export{g as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import{shortcutAria as r,shortcutChip as i}from"../lib/shortcutChip.js";import a from"./AppIcon.js";import o from"./renderIconProp.js";import{forwardRef as s,useEffect as c,useRef as l,useState as u}from"react";import{Dropdown as d}from"react-bootstrap";import{jsx as f,jsxs as p}from"react/jsx-runtime";var m=[`sm`,`md`,`lg`,`xl`],h=!1;function g(){let t=!0;try{t=process.env.NODE_ENV!==`production`}catch{t=!0}!t||h||(h=!0,e("[@webority/ui-react] <AppDropdown> icon-only toggle has no accessible name — pass `label` or `ariaLabel`."))}function _({icon:e,iconSize:a,toggleClassName:s,label:h,ariaLabel:_,align:y=`end`,items:b=[],menuClassName:x=``,linkComponent:S,children:C,trigger:w,show:T,onToggle:E,...D}){n(`AppDropdown`,D);for(let e of b)t(`AppDropdown`,`items[].hiddenFrom`,e.hiddenFrom,m);!w&&!_&&!h&&g();let O=s??(w?`wui-dropdown-trigger`:`topbar-icon-btn`),k=T!==void 0,[A,j]=u(!1),M=k?!!T:A,N=l(null);N.current=(e,t)=>{k||j(e),E?.(e,t)};let P=l(null);return c(()=>{if(!M)return;let e=P.current?.getBoundingClientRect(),t=()=>{let t=P.current?.getBoundingClientRect();(!e||!t||Math.abs(t.top-e.top)>2||Math.abs(t.left-e.left)>2)&&N.current(!1,{source:`scroll`})},n=()=>N.current(!1,{source:`resize`});return window.addEventListener(`scroll`,t,{capture:!0,passive:!0}),window.addEventListener(`resize`,n),()=>{window.removeEventListener(`scroll`,t,{capture:!0}),window.removeEventListener(`resize`,n)}},[M]),p(d,{ref:P,align:y,show:M,onToggle:(e,t)=>N.current(e,t),...D,children:[f(d.Toggle,{as:v,icon:e,iconSize:a,btnClassName:O,trigger:w,title:h,"aria-label":_??(w?void 0:h)}),f(d.Menu,{className:x,renderOnMount:!0,popperConfig:{strategy:`fixed`},children:C??b.map(e=>{if(e.header!=null)return f(`div`,{className:`dropdown-header`,children:e.header},e.key);if(e.divider)return f(d.Divider,{},e.key);let t=e.to?S?{as:S,to:e.to}:{as:`a`,href:e.to}:{as:`button`,type:`button`},n=[e.danger&&`danger`,m.includes(e.hiddenFrom)&&`wui-hidden-from-${e.hiddenFrom}`].filter(Boolean).join(` `)||void 0;return p(d.Item,{...t,onClick:e.onClick,className:n,"aria-keyshortcuts":r(e.shortcut),children:[e.image?f(`img`,{src:e.image,alt:``}):o(e.icon,{size:16}),e.label,i(e.shortcut)]},e.key)})})]})}var v=s(function({icon:e,iconSize:t=20,btnClassName:n=`topbar-icon-btn`,trigger:r,"aria-label":i,className:o,...s},c){return f(`button`,{ref:c,type:`button`,className:n,"aria-label":i,...s,children:r??f(a,{name:e,size:t})})});export{_ as default};
@@ -1 +1 @@
1
- import e from"./warnUnknownProps.js";import t from"./withTooltip.js";import n from"./AppIcon.js";import r from"../lib/FieldMessage.js";import i from"./AppRequiredMark.js";import{keyOf as a}from"../lib/fileItem.js";import o from"../lib/FileItemRow.js";import{DEFAULT_MAX_SIZE_MB as s,acceptLabel as c,isImageFile as l,isImageOnlyAccept as ee,isPdfFile as te,validateFile as u}from"@webority/ui-elements/helpers";import{useEffect as d,useId as ne,useRef as re,useState as f}from"react";import{jsx as p,jsxs as m}from"react/jsx-runtime";function h({label:h,value:g,name:_,id:ie,onPick:v,multiple:y=!1,maxFiles:b,accept:x=`.jpg,.jpeg,.png`,maxSizeMb:S=s,required:ae,error:oe,hint:C,loading:w=!1,className:T=``,fieldClassName:E=``,style:D,...O}){e(`AppFilePicker`,O);let[k,A]=f(null),[se,j]=f(null),[M,N]=f(!1),[P,F]=f(``),I=re(null),ce=ne(),L=ie||ce;d(()=>{if(!y&&g instanceof File&&l(g)){let e=URL.createObjectURL(g);return A(e),()=>URL.revokeObjectURL(e)}A(null)},[g,y]);let R=!y&&g&&!l(g)&&te(g)?g instanceof File?g:g.url:null;d(()=>{if(!R){j(null);return}let e=!0,t=null;return import(`@webority/ui-elements/file-viewer`).then(e=>e.renderPdfFirstPage(typeof R==`string`?{url:R}:R)).then(n=>{e&&(t=URL.createObjectURL(n),j(t))}).catch(e=>console.warn(`[AppFilePicker] the PDF preview failed:`,e?.message)),()=>{e=!1,j(null),t&&URL.revokeObjectURL(t)}},[R]);let z=y?Array.isArray(g)?g:g?[g]:[]:[],B=oe||P,V=B?`${L}-error`:void 0,H=C&&!B?`${L}-hint`:void 0,U=V||H,W=ee(x),G=!y&&!!g,K=G&&(g instanceof File?l(g):W||l(g)),le=g?.name,q=K?g?.url||k:se,J=K?`image`:`file`,ue=h?`Change ${h}`:`Change ${J}`,Y=h?`Remove ${h}`:`Remove ${J}`,de=h?`${h} preview`:`Selected ${J} preview`,X=e=>{let t=u(e,{accept:x,maxSizeMb:S});return t?(F(t),!1):(F(``),v(e),!0)},Z=e=>{let t=Array.from(e||[]);if(!t.length)return;let n=Array.isArray(g)?g:g?[g]:[],r=new Set(n.map(a)),i=``,o=[];for(let e of t){let t=u(e,{accept:x,maxSizeMb:S});if(t){i||=t;continue}r.has(a(e))||(r.add(a(e)),o.push(e))}let s=n.concat(o);b&&s.length>b&&(s=s.slice(0,b),i||=`Up to ${b} files.`),F(i),v(s)},fe=e=>{if(y){Z(e.target.files);return}let t=e.target.files?.[0]||null;t&&(X(t)||(e.target.value=``))},pe=e=>{if(e.preventDefault(),N(!1),w)return;if(y){Z(e.dataTransfer.files);return}let t=e.dataTransfer.files?.[0];t&&X(t)},me=e=>{F(``),v(z.filter((t,n)=>n!==e))},he=()=>I.current?.click(),Q=w?p(`span`,{className:`wui-file-busy`,children:p(`span`,{className:`spinner-border spinner-border-sm`,role:`status`,"aria-label":`Loading`})}):null,$=p(`input`,{id:L,name:_,ref:I,type:`file`,"aria-describedby":U,accept:x,multiple:y||void 0,disabled:w||void 0,className:`visually-hidden`,onClick:e=>{e.currentTarget.value=``},onChange:fe,...O});return m(`div`,{className:`field${E?` ${E}`:``}`,children:[m(`label`,{className:`label`,htmlFor:L,children:[h,ae&&p(i,{})]}),G?m(`div`,{className:`file-preview${B?` error`:``}${T?` ${T}`:``}`,style:D,"aria-busy":w||void 0,children:[m(`button`,{type:`button`,className:`file-preview-open`,"aria-label":ue,onClick:he,disabled:w,children:[q?p(`img`,{src:q,alt:de,className:`file-preview-img`}):m(`span`,{className:`file-preview-file`,children:[p(n,{name:`file-text`,size:28}),p(`span`,{className:`file-preview-file-name`,children:le})]}),p(`span`,{className:`file-preview-overlay`,children:m(`span`,{className:`file-preview-cta`,children:[p(n,{name:K?`image`:`file-text`,size:16}),` `,K?`Change image`:`Change file`]})})]}),t(p(`button`,{type:`button`,className:`file-preview-remove`,"aria-label":Y,onClick:()=>v(null),disabled:w,children:p(n,{name:`x`,size:16})}),Y),$,Q]}):m(`div`,{className:`file-input file-input-tall${M?` dragging`:``}${B?` error`:``}${y&&z.length>0?` has-files`:``}${T?` ${T}`:``}`,style:D,"aria-busy":w||void 0,onDragOver:e=>{e.preventDefault(),!w&&!M&&N(!0)},onDragLeave:e=>{e.preventDefault(),N(!1)},onDrop:pe,children:[m(`label`,{htmlFor:L,className:`file-input-zone-label`,children:[p(`span`,{className:`file-input-icon`,children:p(n,{name:`upload`,size:24})}),m(`span`,{className:`file-input-title`,children:[p(`span`,{className:`browse`,children:`Click to upload`}),` or drag & drop`]}),p(`span`,{className:`file-input-text`,children:S>0?`${c(x)}, up to ${S} MB`:c(x)})]}),$,Q,y&&z.length>0&&p(`div`,{className:`attach-list`,children:z.map((e,t)=>p(o,{item:e,isImage:e instanceof File?l(e):W||l(e),noun:`file`,onRemove:()=>me(t)},a(e)))})]}),p(r,{error:B,hint:C,errorId:V,hintId:H})]})}export{h as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";import t from"./warnUnknownProps.js";import n from"./withTooltip.js";import r from"./AppIcon.js";import i from"../lib/FieldMessage.js";import a from"./AppRequiredMark.js";import{keyOf as o}from"../lib/fileItem.js";import s from"../lib/FileItemRow.js";import{DEFAULT_MAX_SIZE_MB as ee,acceptLabel as c,isImageFile as l,isImageOnlyAccept as u,isPdfFile as te,validateFile as d}from"@webority/ui-elements/helpers";import{useEffect as f,useId as ne,useRef as re,useState as p}from"react";import{jsx as m,jsxs as h}from"react/jsx-runtime";function g({label:g,value:_,name:v,id:ie,onPick:y,multiple:b=!1,maxFiles:x,accept:S=`.jpg,.jpeg,.png`,maxSizeMb:C=ee,required:ae,error:oe,hint:w,loading:T=!1,className:E=``,fieldClassName:D=``,style:O,...k}){t(`AppFilePicker`,k);let[se,A]=p(null),[ce,j]=p(null),[M,N]=p(!1),[P,F]=p(``),I=re(null),le=ne(),L=ie||le;f(()=>{if(!b&&_ instanceof File&&l(_)){let e=URL.createObjectURL(_);return A(e),()=>URL.revokeObjectURL(e)}A(null)},[_,b]);let R=!b&&_&&!l(_)&&te(_)?_ instanceof File?_:_.url:null;f(()=>{if(!R){j(null);return}let t=!0,n=null;return import(`@webority/ui-elements/file-viewer`).then(e=>e.renderPdfFirstPage(typeof R==`string`?{url:R}:R)).then(e=>{t&&(n=URL.createObjectURL(e),j(n))}).catch(t=>e(`[AppFilePicker] the PDF preview failed:`,t?.message)),()=>{t=!1,j(null),n&&URL.revokeObjectURL(n)}},[R]);let z=b?Array.isArray(_)?_:_?[_]:[]:[],B=oe||P,V=B?`${L}-error`:void 0,H=w&&!B?`${L}-hint`:void 0,U=V||H,W=u(S),G=!b&&!!_,K=G&&(_ instanceof File?l(_):W||l(_)),ue=_?.name,q=K?_?.url||se:ce,J=K?`image`:`file`,de=g?`Change ${g}`:`Change ${J}`,Y=g?`Remove ${g}`:`Remove ${J}`,fe=g?`${g} preview`:`Selected ${J} preview`,X=e=>{let t=d(e,{accept:S,maxSizeMb:C});return t?(F(t),!1):(F(``),y(e),!0)},Z=e=>{let t=Array.from(e||[]);if(!t.length)return;let n=Array.isArray(_)?_:_?[_]:[],r=new Set(n.map(o)),i=``,a=[];for(let e of t){let t=d(e,{accept:S,maxSizeMb:C});if(t){i||=t;continue}r.has(o(e))||(r.add(o(e)),a.push(e))}let s=n.concat(a);x&&s.length>x&&(s=s.slice(0,x),i||=`Up to ${x} files.`),F(i),y(s)},pe=e=>{if(b){Z(e.target.files);return}let t=e.target.files?.[0]||null;t&&(X(t)||(e.target.value=``))},me=e=>{if(e.preventDefault(),N(!1),T)return;if(b){Z(e.dataTransfer.files);return}let t=e.dataTransfer.files?.[0];t&&X(t)},he=e=>{F(``),y(z.filter((t,n)=>n!==e))},ge=()=>I.current?.click(),Q=T?m(`span`,{className:`wui-file-busy`,children:m(`span`,{className:`spinner-border spinner-border-sm`,role:`status`,"aria-label":`Loading`})}):null,$=m(`input`,{id:L,name:v,ref:I,type:`file`,"aria-describedby":U,accept:S,multiple:b||void 0,disabled:T||void 0,className:`visually-hidden`,onClick:e=>{e.currentTarget.value=``},onChange:pe,...k});return h(`div`,{className:`field${D?` ${D}`:``}`,children:[h(`label`,{className:`label`,htmlFor:L,children:[g,ae&&m(a,{})]}),G?h(`div`,{className:`file-preview${B?` error`:``}${E?` ${E}`:``}`,style:O,"aria-busy":T||void 0,children:[h(`button`,{type:`button`,className:`file-preview-open`,"aria-label":de,onClick:ge,disabled:T,children:[q?m(`img`,{src:q,alt:fe,className:`file-preview-img`}):h(`span`,{className:`file-preview-file`,children:[m(r,{name:`file-text`,size:28}),m(`span`,{className:`file-preview-file-name`,children:ue})]}),m(`span`,{className:`file-preview-overlay`,children:h(`span`,{className:`file-preview-cta`,children:[m(r,{name:K?`image`:`file-text`,size:16}),` `,K?`Change image`:`Change file`]})})]}),n(m(`button`,{type:`button`,className:`file-preview-remove`,"aria-label":Y,onClick:()=>y(null),disabled:T,children:m(r,{name:`x`,size:16})}),Y),$,Q]}):h(`div`,{className:`file-input file-input-tall${M?` dragging`:``}${B?` error`:``}${b&&z.length>0?` has-files`:``}${E?` ${E}`:``}`,style:O,"aria-busy":T||void 0,onDragOver:e=>{e.preventDefault(),!T&&!M&&N(!0)},onDragLeave:e=>{e.preventDefault(),N(!1)},onDrop:me,children:[h(`label`,{htmlFor:L,className:`file-input-zone-label`,children:[m(`span`,{className:`file-input-icon`,children:m(r,{name:`upload`,size:24})}),h(`span`,{className:`file-input-title`,children:[m(`span`,{className:`browse`,children:`Click to upload`}),` or drag & drop`]}),m(`span`,{className:`file-input-text`,children:C>0?`${c(S)}, up to ${C} MB`:c(S)})]}),$,Q,b&&z.length>0&&m(`div`,{className:`attach-list`,children:z.map((e,t)=>m(s,{item:e,isImage:e instanceof File?l(e):W||l(e),noun:`file`,onRemove:()=>he(t)},o(e)))})]}),m(i,{error:B,hint:w,errorId:V,hintId:H})]})}export{g as default};
@@ -1 +1 @@
1
- import e from"./warnUnknownProps.js";import{forwardRef as t,useCallback as n,useEffect as r,useLayoutEffect as i,useRef as a,useState as o}from"react";import{Fragment as s,jsx as c,jsxs as l}from"react/jsx-runtime";import{createPortal as u}from"react-dom";var d=`wui-file-viewer:load`,f=`wui-file-viewer:error`,p=`wui-file-viewer:prefs-change`,m=t(function({src:t,name:m,type:h,prefs:g,onPrefsChange:_,viewKey:v,download:y=!1,print:b=!0,workerSrc:x,assetBase:S,captions:C,actions:w,onLoad:T,onError:E,className:D=``,style:O,...k},A){e(`AppFileViewer`,k);let j=a(null),M=a(T),N=a(E),P=a(_),[F,I]=o(null),L=n(e=>{j.current=e,typeof A==`function`?A(e):A&&(A.current=e)},[A]);return i(()=>{g!==void 0&&(j.current.prefs=g)},[g]),r(()=>{M.current=T,N.current=E,P.current=_}),r(()=>{let e=j.current,t=e=>M.current?.(e.detail),n=e=>N.current?.(e.detail),r=e=>P.current?.(e.detail);return e.addEventListener(d,t),e.addEventListener(f,n),e.addEventListener(p,r),()=>{e.removeEventListener(d,t),e.removeEventListener(f,n),e.removeEventListener(p,r)}},[]),r(()=>{let e=!0;return import(`@webority/ui-elements/file-viewer`).then(()=>{let t=j.current;e&&t?.isConnected&&I(t.actionsContainer)}).catch(t=>{console.warn(`[AppFileViewer] the viewer failed to load:`,t?.message),e&&N.current?.({message:t?.message??String(t)})}),()=>{e=!1}},[]),l(s,{children:[c(`wui-file-viewer`,{ref:L,src:t,name:m||void 0,type:h||void 0,"view-key":v||void 0,download:y?``:void 0,print:b?void 0:`false`,"worker-src":x||void 0,"asset-base":S||void 0,captions:C||void 0,className:D||void 0,style:O,...k}),F&&w!=null&&u(c(`div`,{slot:`actions`,className:`wui-file-viewer-slot`,children:w}),F)]})});export{m as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";import t from"./warnUnknownProps.js";import{forwardRef as n,useCallback as r,useEffect as i,useLayoutEffect as a,useRef as o,useState as s}from"react";import{Fragment as c,jsx as l,jsxs as u}from"react/jsx-runtime";import{createPortal as d}from"react-dom";var f=`wui-file-viewer:load`,p=`wui-file-viewer:error`,m=`wui-file-viewer:prefs-change`,h=n(function({src:n,name:h,type:g,prefs:_,onPrefsChange:v,viewKey:y,download:b=!1,print:x=!0,workerSrc:S,assetBase:C,captions:w,actions:T,onLoad:E,onError:D,className:O=``,style:k,...A},j){t(`AppFileViewer`,A);let M=o(null),N=o(E),P=o(D),F=o(v),[I,L]=s(null),R=r(e=>{M.current=e,typeof j==`function`?j(e):j&&(j.current=e)},[j]);return a(()=>{_!==void 0&&(M.current.prefs=_)},[_]),i(()=>{N.current=E,P.current=D,F.current=v}),i(()=>{let e=M.current,t=e=>N.current?.(e.detail),n=e=>P.current?.(e.detail),r=e=>F.current?.(e.detail);return e.addEventListener(f,t),e.addEventListener(p,n),e.addEventListener(m,r),()=>{e.removeEventListener(f,t),e.removeEventListener(p,n),e.removeEventListener(m,r)}},[]),i(()=>{let t=!0;return import(`@webority/ui-elements/file-viewer`).then(()=>{let e=M.current;t&&e?.isConnected&&L(e.actionsContainer)}).catch(n=>{e(`[AppFileViewer] the viewer failed to load:`,n?.message),t&&P.current?.({message:n?.message??String(n)})}),()=>{t=!1}},[]),u(c,{children:[l(`wui-file-viewer`,{ref:R,src:n,name:h||void 0,type:g||void 0,"view-key":y||void 0,download:b?``:void 0,print:x?void 0:`false`,"worker-src":S||void 0,"asset-base":C||void 0,captions:w||void 0,className:O||void 0,style:k,...A}),I&&T!=null&&d(l(`div`,{slot:`actions`,className:`wui-file-viewer-slot`,children:T}),I)]})});export{h as default};
@@ -1 +1 @@
1
- import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"./AppIcon.js";import r from"./AppButton.js";import i from"./AppSegmented.js";import a from"./AppChip.js";import o from"./AppDateRangePicker.js";import{emptyFacetValue as s,isFacetActive as c}from"../lib/listQuery.js";import l from"./AppMultiSelect.js";import u from"./AppSearch.js";import d from"./AppSelect.js";import f from"./AppSwitch.js";import{useEffect as p,useId as m,useRef as h,useSyncExternalStore as g}from"react";import{jsx as _,jsxs as v}from"react/jsx-runtime";import"@webority/ui-elements/elements/filter-popover";var y=`(max-width: 575.98px)`,b=3,x=2,S=e=>{let t=window.matchMedia?.(y);return t?.addEventListener(`change`,e),()=>t?.removeEventListener(`change`,e)},C=()=>window.matchMedia?.(y).matches??!1,w=[`enum`,`multiEnum`,`dateRange`,`text`],T=4,E=e=>(e.type===`enum`||e.type===`multiEnum`)&&!e.options?.length,D=(e,t)=>e.options?.find(e=>e.value===t)?.label??t;function O(e,t){if(!c(e,t))return[];if(e.type===`enum`)return[{id:e.key,text:D(e,t),clear:()=>s(e)}];if(e.type===`multiEnum`)return t.map(n=>({id:`${e.key}:${n}`,text:D(e,n),clear:()=>t.filter(e=>e!==n)}));if(e.type===`dateRange`){let n=t.from&&t.to?`${t.from} to ${t.to}`:t.from?`From ${t.from}`:`Until ${t.to}`;return[{id:e.key,text:n,clear:()=>s(e)}]}return[]}var k=new Set;function A(e){let t=!0;try{t=process.env.NODE_ENV!==`production`}catch{t=!0}!t||k.has(e)||(k.add(e),console.warn(`[@webority/ui-react] <AppFilterBar> facet "${e}" sets allLabel, which only an enum facet uses.`))}var j=new Set;function M(e){let t=!0;try{t=process.env.NODE_ENV!==`production`}catch{t=!0}!t||j.has(e)||(j.add(e),console.warn(`[@webority/ui-react] <AppFilterBar> facet "${e}" sets presets, which only a dateRange facet uses.`))}function N({facets:i,value:o,onChange:l,inline:u=b,floating:d=!1,className:y=``,...T}){t(`AppFilterBar`,T);let D=g(S,C,()=>!1),k=h(null),j=m();for(let t of i)e(`AppFilterBar`,`facets[].type`,t.type,w);for(let e of i)e.allLabel!=null&&e.type!==`enum`&&A(e.key),e.presets!=null&&e.type!==`dateRange`&&M(e.key);let N=i.filter(e=>!E(e)),F=N.flatMap(e=>O(e,o[e.key]).map(t=>({...t,facet:e}))),I=N.filter(e=>c(e,o[e.key])),L=d||D?0:Math.max(0,u),R=N.slice(L),z=R.filter(e=>I.includes(e)).length,B=!d&&R.length>0;p(()=>{if(!B)return;let e=e=>{let t=k.current;t?.open&&(e.type===`keydown`?e.key===`Escape`:!e.composedPath().includes(t))&&(t.open=!1)};return document.addEventListener(`click`,e),document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`click`,e),document.removeEventListener(`keydown`,e)}},[B]);let V=e=>_(P,{facet:e,value:o[e.key],onChange:t=>l(e.key,t)},e.key),H=e=>v(`div`,{className:`wui-filter-popover-field`,children:[_(`span`,{className:`label`,"aria-hidden":`true`,children:e.label}),_(P,{facet:e,value:o[e.key],onChange:t=>l(e.key,t),floating:!0})]},e.key),U=(e,t)=>t>0&&_(`span`,{className:e,children:` (${t})`}),W=e=>_(a,{size:`sm`,label:`${e.facet.label}: ${e.text}`,removeLabel:`Remove ${e.facet.label} filter ${e.text}`,onRemove:()=>l(e.facet.key,e.clear())},e.id),G=_(r,{variant:`ghost`,size:`sm`,onClick:()=>{for(let e of I)l(e.key,s(e))},children:`Clear all`});if(d){let e=F.slice(x),t=I.length;return v(`div`,{className:`wui-filter-bar d-flex flex-wrap align-items-center gap-2${y?` ${y}`:``}`,...T,children:[v(`wui-filter-popover`,{class:`wui-filter-popover`,children:[v(`button`,{type:`button`,className:`btn ${t>0?`btn-outline-primary`:`btn-ghost`} btn-sm wui-filter-popover-trigger`,"aria-expanded":`false`,"aria-controls":j,"aria-label":t>0?`Filters, ${t} active`:void 0,children:[_(n,{name:`filter`,size:14,className:`me-2`}),`Filters`,t>0&&_(`span`,{className:`badge rounded-pill text-bg-primary ms-1`,children:t})]}),v(`div`,{id:j,className:`wui-filter-popover-panel`,role:`dialog`,"aria-label":`Filters`,hidden:!0,children:[v(`div`,{className:`wui-filter-popover-head`,children:[_(`span`,{className:`wui-filter-popover-title`,children:`Filters`}),_(f,{label:`Keep open`,id:`${j}-pin`})]}),_(`div`,{className:`wui-filter-popover-grid`,children:N.map(H)}),v(`div`,{className:`wui-filter-popover-foot`,children:[_(`span`,{className:`wui-filter-popover-note`,children:`Changes apply at once.`}),t>0&&G]})]})]}),F.slice(0,x).map(W),e.length>0&&v(`span`,{className:`chip chip-sm wui-filter-popover-more`,title:e.map(e=>`${e.facet.label}: ${e.text}`).join(`, `),children:[`+`,e.length]})]})}return v(`div`,{className:`wui-filter-bar d-flex flex-wrap align-items-center gap-2${D&&B?` wui-filter-bar--folded`:``}${y?` ${y}`:``}`,...T,children:[N.slice(0,L).map(V),B&&v(`details`,{ref:k,className:`wui-filter-more`,children:[v(`summary`,{className:`btn btn-outline-primary btn-sm wui-filter-more-trigger`,children:[_(n,{name:`filter`,size:14,className:`me-2`}),`Filters`,U(`wui-filter-count-desktop`,z),U(`wui-filter-count-phone`,I.length)]}),v(`div`,{className:`wui-filter-more-panel`,children:[_(`div`,{className:`wui-filter-more-head`,children:`Filters`}),R.map(H)]})]}),F.map(W),I.length>1&&G]})}function P({facet:e,value:t,onChange:n,floating:r=!1}){if(e.type===`enum`){let a=e.options??[];return a.length<T?_(i,{label:e.label,name:e.key,size:`sm`,value:t??``,onChange:n,options:[{value:``,label:e.allLabel||`All`},...a]}):_(d,{"aria-label":e.label,name:e.key,placeholder:r?`Any`:e.label,size:`sm`,clearable:!0,value:t??``,onChange:n,options:a})}return e.type===`multiEnum`?_(l,{"aria-label":e.label,name:e.key,placeholder:r?`Any`:e.label,size:`sm`,collapseChips:!0,values:t??[],onChange:n,options:e.options??[]}):e.type===`dateRange`?_(o,{ariaLabel:e.label,startName:`${e.key}From`,endName:`${e.key}To`,placeholder:r?`Any`:e.label,size:`sm`,presets:e.presets,start:t?.from??``,end:t?.to??``,onChange:e=>n({from:e.start??``,to:e.end??``})}):_(u,{ariaLabel:e.label,name:e.key,placeholder:e.label,size:`sm`,value:t??``,onChange:n})}export{N as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"./AppIcon.js";import i from"./AppButton.js";import a from"./AppSegmented.js";import o from"./AppChip.js";import s from"./AppDateRangePicker.js";import{emptyFacetValue as c,isFacetActive as l}from"../lib/listQuery.js";import u from"./AppMultiSelect.js";import d from"./AppSearch.js";import f from"./AppSelect.js";import p from"./AppSwitch.js";import{useEffect as m,useId as h,useRef as g,useSyncExternalStore as _}from"react";import{jsx as v,jsxs as y}from"react/jsx-runtime";import"@webority/ui-elements/elements/filter-popover";var b=`(max-width: 575.98px)`,x=3,S=2,C=e=>{let t=window.matchMedia?.(b);return t?.addEventListener(`change`,e),()=>t?.removeEventListener(`change`,e)},w=()=>window.matchMedia?.(b).matches??!1,T=[`enum`,`multiEnum`,`dateRange`,`text`],E=4,D=e=>(e.type===`enum`||e.type===`multiEnum`)&&!e.options?.length,O=(e,t)=>e.options?.find(e=>e.value===t)?.label??t;function k(e,t){if(!l(e,t))return[];if(e.type===`enum`)return[{id:e.key,text:O(e,t),clear:()=>c(e)}];if(e.type===`multiEnum`)return t.map(n=>({id:`${e.key}:${n}`,text:O(e,n),clear:()=>t.filter(e=>e!==n)}));if(e.type===`dateRange`){let n=t.from&&t.to?`${t.from} to ${t.to}`:t.from?`From ${t.from}`:`Until ${t.to}`;return[{id:e.key,text:n,clear:()=>c(e)}]}return[]}var A=new Set;function j(t){let n=!0;try{n=process.env.NODE_ENV!==`production`}catch{n=!0}!n||A.has(t)||(A.add(t),e(`[@webority/ui-react] <AppFilterBar> facet "${t}" sets allLabel, which only an enum facet uses.`))}var M=new Set;function N(t){let n=!0;try{n=process.env.NODE_ENV!==`production`}catch{n=!0}!n||M.has(t)||(M.add(t),e(`[@webority/ui-react] <AppFilterBar> facet "${t}" sets presets, which only a dateRange facet uses.`))}function P({facets:e,value:a,onChange:s,inline:u=x,floating:d=!1,className:f=``,...b}){n(`AppFilterBar`,b);let E=_(C,w,()=>!1),O=g(null),A=h();for(let n of e)t(`AppFilterBar`,`facets[].type`,n.type,T);for(let t of e)t.allLabel!=null&&t.type!==`enum`&&j(t.key),t.presets!=null&&t.type!==`dateRange`&&N(t.key);let M=e.filter(e=>!D(e)),P=M.flatMap(e=>k(e,a[e.key]).map(t=>({...t,facet:e}))),I=M.filter(e=>l(e,a[e.key])),L=d||E?0:Math.max(0,u),R=M.slice(L),z=R.filter(e=>I.includes(e)).length,B=!d&&R.length>0;m(()=>{if(!B)return;let e=e=>{let t=O.current;t?.open&&(e.type===`keydown`?e.key===`Escape`:!e.composedPath().includes(t))&&(t.open=!1)};return document.addEventListener(`click`,e),document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`click`,e),document.removeEventListener(`keydown`,e)}},[B]);let V=e=>v(F,{facet:e,value:a[e.key],onChange:t=>s(e.key,t)},e.key),H=e=>y(`div`,{className:`wui-filter-popover-field`,children:[v(`span`,{className:`label`,"aria-hidden":`true`,children:e.label}),v(F,{facet:e,value:a[e.key],onChange:t=>s(e.key,t),floating:!0})]},e.key),U=(e,t)=>t>0&&v(`span`,{className:e,children:` (${t})`}),W=e=>v(o,{size:`sm`,label:`${e.facet.label}: ${e.text}`,removeLabel:`Remove ${e.facet.label} filter ${e.text}`,onRemove:()=>s(e.facet.key,e.clear()),className:!d&&M.indexOf(e.facet)<L?`wui-filter-chip-inline`:void 0},e.id),G=v(i,{variant:`ghost`,size:`sm`,onClick:()=>{for(let e of I)s(e.key,c(e))},children:`Clear all`});if(d){let e=P.slice(S),t=I.length;return y(`div`,{className:`wui-filter-bar d-flex flex-wrap align-items-center gap-2${f?` ${f}`:``}`,...b,children:[y(`wui-filter-popover`,{class:`wui-filter-popover`,children:[y(`button`,{type:`button`,className:`btn ${t>0?`btn-outline-primary`:`btn-ghost`} btn-sm wui-filter-popover-trigger`,"aria-expanded":`false`,"aria-controls":A,"aria-label":t>0?`Filters, ${t} active`:void 0,children:[v(r,{name:`filter`,size:14,className:`me-2`}),`Filters`,t>0&&v(`span`,{className:`badge rounded-pill text-bg-primary ms-1`,children:t})]}),y(`div`,{id:A,className:`wui-filter-popover-panel`,role:`dialog`,"aria-label":`Filters`,hidden:!0,children:[y(`div`,{className:`wui-filter-popover-head`,children:[v(`span`,{className:`wui-filter-popover-title`,children:`Filters`}),v(p,{label:`Keep open`,id:`${A}-pin`})]}),v(`div`,{className:`wui-filter-popover-grid`,children:M.map(H)}),y(`div`,{className:`wui-filter-popover-foot`,children:[v(`span`,{className:`wui-filter-popover-note`,children:`Changes apply at once.`}),t>0&&G]})]})]}),P.slice(0,S).map(W),e.length>0&&y(`span`,{className:`chip chip-sm wui-filter-popover-more`,title:e.map(e=>`${e.facet.label}: ${e.text}`).join(`, `),children:[`+`,e.length]})]})}return y(`div`,{className:`wui-filter-bar d-flex flex-wrap align-items-center gap-2${E&&B?` wui-filter-bar--folded`:``}${f?` ${f}`:``}`,...b,children:[M.slice(0,L).map(V),B&&y(`details`,{ref:O,className:`wui-filter-more`,children:[y(`summary`,{className:`btn btn-outline-primary btn-sm wui-filter-more-trigger`,children:[v(r,{name:`filter`,size:14,className:`me-2`}),`Filters`,U(`wui-filter-count-desktop`,z),U(`wui-filter-count-phone`,I.length)]}),y(`div`,{className:`wui-filter-more-panel`,children:[v(`div`,{className:`wui-filter-more-head`,children:`Filters`}),R.map(H)]})]}),P.map(W),I.length>0&&G]})}function F({facet:e,value:t,onChange:n,floating:r=!1}){if(e.type===`enum`){let i=e.options??[];return i.length<E?v(a,{label:e.label,name:e.key,size:`sm`,value:t??``,onChange:n,options:[{value:``,label:e.allLabel||`All`},...i]}):v(f,{"aria-label":e.label,name:e.key,placeholder:r?`Any`:e.label,size:`sm`,clearable:!0,value:t??``,onChange:n,options:i})}return e.type===`multiEnum`?v(u,{"aria-label":e.label,name:e.key,placeholder:r?`Any`:e.label,size:`sm`,collapseChips:!0,values:t??[],onChange:n,options:e.options??[]}):e.type===`dateRange`?v(s,{ariaLabel:e.label,startName:`${e.key}From`,endName:`${e.key}To`,placeholder:r?`Any`:e.label,size:`sm`,presets:e.presets,start:t?.from??``,end:t?.to??``,onChange:e=>n({from:e.start??``,to:e.end??``})}):v(d,{ariaLabel:e.label,name:e.key,placeholder:e.label,size:`sm`,value:t??``,onChange:n})}export{P as default};
@@ -1 +1 @@
1
- import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import{jsx as n}from"react/jsx-runtime";var r=[1,2,3];function i({children:i,columns:a=2,className:o=``,...s}){t(`AppFormRow`,s),e(`AppFormRow`,`columns`,a,r);let{style:c,...l}=s;return n(`div`,{className:[`form-row-grid`,o].filter(Boolean).join(` `),style:{"--form-cols":a,...c},...l,children:i})}export{i as default};
1
+ import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import{jsx as n}from"react/jsx-runtime";var r=[1,2,3];function i({children:i,columns:a=2,className:o=``,...s}){t(`AppFormRow`,s),e(`AppFormRow`,`columns`,a,r);let{style:c,...l}=s;return n(`div`,{className:[`form-row-grid`,`wui-form-cols-${Math.min(12,Math.max(1,a))}`,o].filter(Boolean).join(` `),style:c,...l,children:i})}export{i as default};
@@ -1 +1 @@
1
- import{FULL_LINEAR_LOADERS as e,FULL_VARIANT_LOADERS as t,shardKey as n}from"./iconCatalogLoaders.g.js";import{ICON_NAMES as r}from"./iconCatalogNames.g.js";import{GLYPHS as i}from"./iconGlyphs.g.js";import a from"./warnInvalidValue.js";import o from"./warnUnknownProps.js";import s from"./withTooltip.js";import{useEffect as c,useState as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";var f=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],p=new Set;function m(e,t){p.has(e)||(p.add(e),console.warn(`[@webority/ui-react] The ${e} failed to load (${t?.message??t}); icons fall back to the linear default until a later render retries it.`))}var h=null,g=null,_=!1,v=new Set;function y(){return g||=import(`./iconVariants.g.js`).then(e=>{h=e.VARIANT_GLYPHS,_=!1;for(let e of v)e();v.clear()}).catch(e=>{g=null,m(`curated icon variants chunk`,e),_?v.clear():(_=!0,setTimeout(()=>{for(let e of[...v])e()},1e3))}),g}var b=new Set(r),x=Object.create(null),S=Object.create(null),C=Object.create(null),w=Object.create(null);function T(t){let r=n(t),i=e[r];return i?(S[r]||=i().then(e=>{Object.assign(x,e.FULL_GLYPHS),w[r]=!1;let t=C[r];if(t){for(let e of t)e();t.clear()}}).catch(e=>{S[r]=null,m(`full icon catalogue '${r}' shard`,e),w[r]?C[r]?.clear():(w[r]=!0,setTimeout(()=>{for(let e of[...C[r]||[]])e()},1e3))}),S[r]):null}var E=Object.create(null),D=Object.create(null),O=Object.create(null),k=Object.create(null);function A(e,r){let i=t[e];if(!i)return null;let a=n(r),o=i[a];if(!o)return null;let s=`${e}:${a}`;return D[s]||=o().then(t=>{let n=E[e]||(E[e]=Object.create(null));Object.assign(n,t.FULL_VARIANT_GLYPHS),k[s]=!1;let r=O[s];if(r){for(let e of r)e();r.clear()}}).catch(t=>{D[s]=null,m(`${e} icon catalogue '${a}' shard`,t),k[s]?O[s]?.clear():(k[s]=!0,setTimeout(()=>{for(let e of[...O[s]||[]])e()},1e3))}),D[s]}var j=r,M=new Map;function N(e){for(let[t,n]of Object.entries(e))M.set(t,n)}function P({name:e,size:t=16,variant:r,tooltip:p,tooltipPlacement:m,className:g,color:_,style:S,...w}){o(`AppIcon`,w),a(`AppIcon`,`variant`,r,f);let D=!!r&&r!==`linear`,k=p!=null&&p!==``,j=e=>k?s(u(`span`,{className:`wui-icon-tip`,role:`img`,"aria-label":p,children:e}),p,m):e,N=i[e]!==void 0,P=!N&&b.has(e),[,F]=l(0);c(()=>{let t=()=>F(e=>e+1);D&&N&&!h&&(v.add(t),y());let i=P?n(e):null;P&&x[e]===void 0&&((C[i]||=new Set).add(t),T(e));let a=D&&P?`${r}:${n(e)}`:null;return D&&P&&E[r]?.[e]===void 0&&((O[a]||=new Set).add(t),A(r,e)),()=>{v.delete(t),i&&C[i]?.delete(t),a&&O[a]?.delete(t)}},[e,D,N,P,r]);let I=M.get(e);if(I)return j(I({size:t,color:_,className:g,style:S}));if(e===`hard-hat`)return j(u(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,className:g?`wui-icon ${g}`:`wui-icon`,"data-icon":e,"aria-hidden":`true`,style:{verticalAlign:`-.125em`,color:_,...S},...w,children:d(`g`,{fill:`currentColor`,children:[u(`circle`,{cx:`12`,cy:`7.5`,r:`4.2`}),u(`path`,{d:`M3.2 22.5C3.2 17.4 7.5 14.9 11 14.7L12 17.4l1-2.7C16.5 14.9 20.8 17.4 20.8 22.5z`})]})}));let L=D&&(h?.[r]?.[e]||P&&E?.[r]?.[e])||i[e]||x[e];return L?j(u(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,className:g?`wui-icon ${g}`:`wui-icon`,"data-icon":e,"aria-hidden":`true`,style:{verticalAlign:`-.125em`,color:_,...S},dangerouslySetInnerHTML:{__html:L},...w})):null}export{P as default,j as iconNames,N as registerIcons};
1
+ import{devWarn as e}from"../lib/devWarn.js";import{FULL_LINEAR_LOADERS as t,FULL_VARIANT_LOADERS as n,shardKey as r}from"./iconCatalogLoaders.g.js";import{ICON_NAMES as i}from"./iconCatalogNames.g.js";import{GLYPHS as a}from"./iconGlyphs.g.js";import o from"./warnInvalidValue.js";import s from"./warnUnknownProps.js";import c from"./withTooltip.js";import{useEffect as l,useState as u}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";var p=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],m=new Set;function h(t,n){m.has(t)||(m.add(t),e(`[@webority/ui-react] The ${t} failed to load (${n?.message??n}); icons fall back to the linear default until a later render retries it.`))}var g=null,_=null,v=!1,y=new Set;function b(){return _||=import(`./iconVariants.g.js`).then(e=>{g=e.VARIANT_GLYPHS,v=!1;for(let e of y)e();y.clear()}).catch(e=>{_=null,h(`curated icon variants chunk`,e),v?y.clear():(v=!0,setTimeout(()=>{for(let e of[...y])e()},1e3))}),_}var x=new Set(i),S=Object.create(null),C=Object.create(null),w=Object.create(null),T=Object.create(null);function E(e){let n=r(e),i=t[n];return i?(C[n]||=i().then(e=>{Object.assign(S,e.FULL_GLYPHS),T[n]=!1;let t=w[n];if(t){for(let e of t)e();t.clear()}}).catch(e=>{C[n]=null,h(`full icon catalogue '${n}' shard`,e),T[n]?w[n]?.clear():(T[n]=!0,setTimeout(()=>{for(let e of[...w[n]||[]])e()},1e3))}),C[n]):null}var D=Object.create(null),O=Object.create(null),k=Object.create(null),A=Object.create(null);function j(e,t){let i=n[e];if(!i)return null;let a=r(t),o=i[a];if(!o)return null;let s=`${e}:${a}`;return O[s]||=o().then(t=>{let n=D[e]||(D[e]=Object.create(null));Object.assign(n,t.FULL_VARIANT_GLYPHS),A[s]=!1;let r=k[s];if(r){for(let e of r)e();r.clear()}}).catch(t=>{O[s]=null,h(`${e} icon catalogue '${a}' shard`,t),A[s]?k[s]?.clear():(A[s]=!0,setTimeout(()=>{for(let e of[...k[s]||[]])e()},1e3))}),O[s]}var M=i,N=new Map;function P(e){for(let[t,n]of Object.entries(e))N.set(t,n)}function F({name:e,size:t=16,variant:n,tooltip:i,tooltipPlacement:m,className:h,color:_,style:v,...C}){s(`AppIcon`,C),o(`AppIcon`,`variant`,n,p);let T=!!n&&n!==`linear`,O=i!=null&&i!==``,A=e=>O?c(d(`span`,{className:`wui-icon-tip`,role:`img`,"aria-label":i,children:e}),i,m):e,M=a[e]!==void 0,P=!M&&x.has(e),[,F]=u(0);l(()=>{let t=()=>F(e=>e+1);T&&M&&!g&&(y.add(t),b());let i=P?r(e):null;P&&S[e]===void 0&&((w[i]||=new Set).add(t),E(e));let a=T&&P?`${n}:${r(e)}`:null;return T&&P&&D[n]?.[e]===void 0&&((k[a]||=new Set).add(t),j(n,e)),()=>{y.delete(t),i&&w[i]?.delete(t),a&&k[a]?.delete(t)}},[e,T,M,P,n]);let I=N.get(e);if(I)return A(I({size:t,color:_,className:h,style:v}));if(e===`hard-hat`)return A(d(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,className:h?`wui-icon ${h}`:`wui-icon`,"data-icon":e,"aria-hidden":`true`,style:{color:_,...v},...C,children:f(`g`,{fill:`currentColor`,children:[d(`circle`,{cx:`12`,cy:`7.5`,r:`4.2`}),d(`path`,{d:`M3.2 22.5C3.2 17.4 7.5 14.9 11 14.7L12 17.4l1-2.7C16.5 14.9 20.8 17.4 20.8 22.5z`})]})}));let L=T&&(g?.[n]?.[e]||P&&D?.[n]?.[e])||a[e]||S[e];return L?A(d(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,className:h?`wui-icon ${h}`:`wui-icon`,"data-icon":e,"aria-hidden":`true`,style:{color:_,...v},dangerouslySetInnerHTML:{__html:L},...C})):null}export{F as default,M as iconNames,P as registerIcons};
@@ -1 +1 @@
1
- import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"./AppIcon.js";import r from"./renderIconProp.js";import i from"./AppSparkline.js";import{jsx as a,jsxs as o}from"react/jsx-runtime";var s=[`plain`,`filled`,`accent`,`spotlight`],c=[`sm`,`md`,`lg`],l=[`primary`,`success`,`warning`,`danger`,`info`,`neutral`],u=[`up`,`down`,`flat`],d=[`success`,`danger`,`neutral`],f={success:` wui-kpi-delta--success`,danger:` wui-kpi-delta--danger`,neutral:` wui-kpi-delta--neutral`};function p(e){if(typeof e!=`string`)return`flat`;let t=e.trim();return t.startsWith(`+`)?`up`:t.startsWith(`-`)||t.startsWith(`−`)?`down`:`flat`}function m({label:m,value:h,caption:g,icon:_,iconTone:v,delta:y,deltaDirection:b,deltaTone:x,sparkline:S,variant:C=`plain`,size:w=`md`,valueSize:T,inline:E=!1,attention:D=!1,href:O,linkComponent:k,className:A=``,style:j,iconClassName:M=``,labelClassName:N=``,valueClassName:P=``,captionClassName:F=``,deltaClassName:I=``,sparklineClassName:L=``,...R}){t(`AppKpiTile`,R),e(`AppKpiTile`,`variant`,C,s),e(`AppKpiTile`,`size`,w,c),e(`AppKpiTile`,`iconTone`,v,l),e(`AppKpiTile`,`deltaDirection`,b,u),e(`AppKpiTile`,`deltaTone`,x,d);let z=`kpi${E?` kpi-inline`:``}${C===`filled`?` kpi-filled`:C===`accent`?` kpi-accent`:C===`spotlight`?` kpi-spotlight`:``}${w===`lg`?` kpi-lg`:w===`sm`?` kpi-sm`:``}${D?` kpi-attention`:``}${A?` ${A}`:``}`,B=typeof T==`number`&&T>0?{...j,"--wui-kpi-value-size":`${T}px`}:j,V=b??p(y),H=V===`up`?`arrow-up`:V===`down`?`arrow-down`:null,U=Object.hasOwn(f,x??``)?f[x]:``,W=O==null?`div`:k||`a`,G=O==null?{}:k?{to:O}:{href:O};return o(W,{className:z,style:B,...R,...G,children:[_&&a(`span`,{className:`kpi-icon${v?` kpi-icon-${v}`:``}${M?` ${M}`:``}`,children:r(_,{size:20})}),a(`div`,{className:`kpi-label${N?` ${N}`:``}`,children:m}),a(`div`,{className:`kpi-value${P?` ${P}`:``}`,children:h}),g&&a(`div`,{className:`kpi-caption${F?` ${F}`:``}`,children:g}),y&&o(`div`,{className:`kpi-delta${V===`flat`?``:` ${V}`}${U}${I?` ${I}`:``}`,children:[H&&a(n,{name:H,size:13}),y]}),S&&S.length>0&&a(i,{data:S,className:`kpi-sparkline${L?` ${L}`:``}`})]})}export{m as default};
1
+ import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"./AppIcon.js";import r from"./renderIconProp.js";import i from"./AppSparkline.js";import{jsx as a,jsxs as o}from"react/jsx-runtime";var s=[`plain`,`filled`,`accent`,`spotlight`],c=[`sm`,`md`,`lg`],l=[`primary`,`success`,`warning`,`danger`,`info`,`neutral`],u=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],d=[`up`,`down`,`flat`],f=[`success`,`danger`,`neutral`],p={success:` wui-kpi-delta--success`,danger:` wui-kpi-delta--danger`,neutral:` wui-kpi-delta--neutral`};function m(e){if(typeof e!=`string`)return`flat`;let t=e.trim();return t.startsWith(`+`)?`up`:t.startsWith(`-`)||t.startsWith(`−`)?`down`:`flat`}function h({label:h,value:g,caption:_,icon:v,iconTone:y,iconVariant:b,delta:x,deltaDirection:S,deltaTone:C,sparkline:w,variant:T=`plain`,size:E=`md`,valueSize:D,inline:O=!1,attention:k=!1,href:A,linkComponent:j,className:M=``,style:N,iconClassName:P=``,labelClassName:F=``,valueClassName:I=``,captionClassName:L=``,deltaClassName:R=``,sparklineClassName:z=``,...B}){t(`AppKpiTile`,B),e(`AppKpiTile`,`variant`,T,s),e(`AppKpiTile`,`size`,E,c),e(`AppKpiTile`,`iconTone`,y,l),e(`AppKpiTile`,`iconVariant`,b,u),e(`AppKpiTile`,`deltaDirection`,S,d),e(`AppKpiTile`,`deltaTone`,C,f);let V=`kpi${O?` kpi-inline`:``}${T===`filled`?` kpi-filled`:T===`accent`?` kpi-accent`:T===`spotlight`?` kpi-spotlight`:``}${E===`lg`?` kpi-lg`:E===`sm`?` kpi-sm`:``}${k?` kpi-attention`:``}${M?` ${M}`:``}`,H=typeof D==`number`&&D>0?{...N,"--wui-kpi-value-size":`${D}px`}:N,U=S??m(x),W=U===`up`?`arrow-up`:U===`down`?`arrow-down`:null,G=Object.hasOwn(p,C??``)?p[C]:``,K=A==null?`div`:j||`a`,q=A==null?{}:j?{to:A}:{href:A};return o(K,{className:V,style:H,...B,...q,children:[v&&a(`span`,{className:`kpi-icon${y?` kpi-icon-${y}`:``}${P?` ${P}`:``}`,children:r(v,{size:20,variant:b})}),a(`div`,{className:`kpi-label${F?` ${F}`:``}`,children:h}),a(`div`,{className:`kpi-value${I?` ${I}`:``}`,children:g}),_&&a(`div`,{className:`kpi-caption${L?` ${L}`:``}`,children:_}),x&&o(`div`,{className:`kpi-delta${U===`flat`?``:` ${U}`}${G}${R?` ${R}`:``}`,children:[W&&a(n,{name:W,size:13}),x]}),w&&w.length>0&&a(i,{data:w,className:`kpi-sparkline${z?` ${z}`:``}`})]})}export{h as default};
@@ -1 +1 @@
1
- import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"./AppIcon.js";import{Fragment as r,jsx as i,jsxs as a}from"react/jsx-runtime";var o={sm:13,md:15,lg:18},s=[`underline`,`underline-center`,`static`,`slide`,`icon`,`highlight`,`bracket`,`fade`,`grow`,`glow`,`shine`,`none`];function c(e,t,r){if(!e)return null;let a=`wui-link__ic wui-link__ic--${t}`;return typeof e==`string`?i(`span`,{className:a,children:i(n,{name:e,size:o[r]??o.md})}):i(`span`,{className:a,children:e})}function l({children:n,label:l,href:u,animation:d=`underline`,leftIcon:f=null,rightIcon:p=null,size:m=`md`,external:h=!1,disabled:g=!1,linkComponent:_,className:v=``,...y}){t(`AppLink`,y),e(`AppLink`,`animation`,d,s),e(`AppLink`,`size`,m,Object.keys(o));let b=s.includes(d)?d:`underline`,x=b===`icon`&&!p&&!f?`arrow-right`:p,S=[`wui-link`,`wui-link--${b}`,m===`md`?``:`wui-link--${m}`,g?`is-disabled`:``,v].filter(Boolean).join(` `),C=a(r,{children:[c(f,`left`,m),i(`span`,{className:`wui-link__label`,children:n??l}),c(x,`right`,m)]});return g?i(`span`,{className:S,"aria-disabled":`true`,...y,children:C}):_&&!h?i(_,{className:S,to:u,...y,children:C}):i(`a`,{className:S,href:u,target:h?`_blank`:void 0,rel:h?`noopener noreferrer`:void 0,...y,children:C})}export{l as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"./AppIcon.js";import{Fragment as i,jsx as a,jsxs as o}from"react/jsx-runtime";var s={sm:13,md:15,lg:18},c=[`underline`,`underline-center`,`static`,`slide`,`icon`,`highlight`,`bracket`,`fade`,`grow`,`glow`,`shine`,`none`];function l(e,t,n){if(!e)return null;let i=`wui-link__ic wui-link__ic--${t}`;return typeof e==`string`?a(`span`,{className:i,children:a(r,{name:e,size:s[n]??s.md})}):a(`span`,{className:i,children:e})}function u({children:r,label:u,href:d,animation:f=`underline`,leftIcon:p=null,rightIcon:m=null,size:h=`md`,external:g=!1,disabled:_=!1,linkComponent:v,className:y=``,...b}){n(`AppLink`,b),t(`AppLink`,`animation`,f,c),t(`AppLink`,`size`,h,Object.keys(s)),!d&&b.onClick&&e(`[@webority/ui-react] AppLink has onClick but no href, so it renders an anchor that keyboards cannot reach. Use AppButton for an action, or pass href.`);let x=c.includes(f)?f:`underline`,S=x===`icon`&&!m&&!p?`arrow-right`:m,C=[`wui-link`,`wui-link--${x}`,h===`md`?``:`wui-link--${h}`,_?`is-disabled`:``,y].filter(Boolean).join(` `),w=o(i,{children:[l(p,`left`,h),a(`span`,{className:`wui-link__label`,children:r??u}),l(S,`right`,h)]});return _?a(`span`,{className:C,"aria-disabled":`true`,...b,children:w}):v&&!g?a(v,{className:C,to:d,...b,children:w}):a(`a`,{className:C,href:d,target:g?`_blank`:void 0,rel:g?`noopener noreferrer`:void 0,...b,children:w})}export{u as default};
@@ -1 +1 @@
1
- import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"./AppIcon.js";import{useEffect as r,useRef as i,useState as a}from"react";import{Modal as o}from"react-bootstrap";import{jsx as s,jsxs as c}from"react/jsx-runtime";var l=[`default`,`danger`,`success`,`warning`],u=[`center`,`top`],d=`a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])`,f={sm:380,md:440,lg:640,xl:880},p=`wui-modal-fullscreen`,m=!1;function h(){let e=!0;try{e=process.env.NODE_ENV!==`production`}catch{e=!0}!e||m||(m=!0,console.warn("[@webority/ui-react] <AppModal hideHeader> has no accessible name — pass `ariaLabel` (or a string `title`)."))}function g(e,t){if(e.key!==`Tab`)return;let n=Array.from(t.querySelectorAll(d));if(!n.length){e.preventDefault(),t.focus();return}let r=n[0],i=n[n.length-1],a=document.activeElement;e.shiftKey&&(a===r||a===t)?(e.preventDefault(),i.focus()):!e.shiftKey&&a===i&&(e.preventDefault(),r.focus())}function _(){let e=[];for(let t of document.body.children)t.hasAttribute(`inert`)||t.matches(`.modal, .modal-backdrop`)||(t.setAttribute(`inert`,``),e.push(t));return e}function v({open:m,eyebrow:v,title:y,subtitle:b,headerIcon:x,tone:S=`default`,dismissible:C=!0,onClose:w,footer:T,size:E=`md`,placement:D=`center`,hideHeader:O=!1,staticBackdrop:k=!1,confirmDiscard:A,dirty:j=!1,ariaLabel:M,className:N=``,children:P,...F}){t(`AppModal`,F),e(`AppModal`,`tone`,S,l),e(`AppModal`,`placement`,D,u),e(`AppModal`,`size`,typeof E==`string`?E:null,[...Object.keys(f),`fullscreen`]);let{style:I,...L}=F;O&&!M&&typeof y!=`string`&&h();let R=i(null),z=i(null),[B,V]=a(!1);r(()=>{m||V(!1)},[m]),r(()=>{B&&z.current?.focus()},[B]),r(()=>{let e=R.current?.closest(`.modal`);e&&(A?e.setAttribute(`confirm-discard`,A):e.removeAttribute(`confirm-discard`))},[m,A]),r(()=>{if(!m)return;let e=R.current?.closest(`.modal-content`);if(!e)return;let t=()=>Array.from(e.querySelectorAll(d));(e.querySelector(`[data-autofocus]`)||t().find(e=>!e.classList.contains(`wui-modal-close`))||t()[0]||e).focus?.();let n=e.closest(`.modal`),r=_(),i=e=>g(e,n);return n?.addEventListener(`keydown`,i),()=>{n?.removeEventListener(`keydown`,i);for(let e of r)e.removeAttribute(`inert`);n&&setTimeout(()=>{n.isConnected&&!n.classList.contains(`show`)&&n.dispatchEvent(new Event(`transitionend`,{bubbles:!0}))},500)}},[m]);let H=()=>{if(A&&j){V(!0);return}w?.()},U=()=>{V(!1),w?.()},W=()=>{V(!1),(R.current?.querySelector(`input:not([type="hidden"]):not([disabled]),select:not([disabled]),textarea:not([disabled])`))?.focus()},G=E===`fullscreen`,K=typeof E==`number`?E:f[E]??f.md,q=[`wui-modal`,S==="default"?``:`tone-${S}`,N].filter(Boolean).join(` `);return c(o,{...L,show:m,onHide:H,backdrop:!k||`static`,keyboard:!k,autoFocus:!1,enforceFocus:!0,restoreFocus:!0,centered:D!==`top`,className:G?`wui-modal-shell ${p}`:`wui-modal-shell`,style:G?I:{"--wui-modal-max-width":`${K}px`,...I},dialogClassName:`wui-rb-dialog`,contentClassName:q,backdropClassName:`wui-modal-dim`,"aria-label":M||(typeof y==`string`?y:void 0),children:[!O&&c(`div`,{className:`wui-modal-header`,children:[c(`div`,{className:`wui-modal-heading`,children:[x&&s(`span`,{className:`wui-modal-headicon`,children:s(n,{name:x,size:18})}),c(`div`,{className:`wui-modal-headtext`,children:[v&&s(`div`,{className:`wui-modal-eyebrow`,children:v}),s(`div`,{className:`wui-modal-title`,children:y}),b&&s(`div`,{className:`wui-modal-subtitle`,children:b})]})]}),C&&s(`button`,{type:`button`,className:`wui-modal-close`,onClick:H,"aria-label":`Close`,children:s(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:s(`path`,{d:`M18 6 6 18M6 6l12 12`})})})]}),s(`div`,{className:`wui-modal-body`,ref:R,children:P}),(T||B)&&c(`div`,{className:B?`wui-modal-footer wui-drawer-discarding`:`wui-modal-footer`,children:[B&&c(`div`,{className:`wui-drawer-discard`,role:`alert`,children:[s(`span`,{className:`wui-drawer-discard-text`,children:A}),s(`button`,{type:`button`,className:`btn btn-danger btn-sm`,"data-wui-discard-confirm":``,ref:z,onClick:U,children:`Discard`}),s(`button`,{type:`button`,className:`btn btn-secondary btn-sm`,"data-wui-discard-keep":``,onClick:W,children:`Keep editing`})]}),T]})]})}export{v as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"./AppIcon.js";import i from"../lib/DiscardPrompt.js";import{useEffect as a,useRef as o,useState as s}from"react";import{Modal as c}from"react-bootstrap";import{jsx as l,jsxs as u}from"react/jsx-runtime";var d=[`default`,`danger`,`success`,`warning`],f=[`center`,`top`],p=`a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])`,m={sm:380,md:440,lg:640,xl:880},h=`wui-modal-fullscreen`,g=!1;function _(){let t=!0;try{t=process.env.NODE_ENV!==`production`}catch{t=!0}!t||g||(g=!0,e("[@webority/ui-react] <AppModal hideHeader> has no accessible name — pass `ariaLabel` (or a string `title`)."))}function v(e,t){if(e.key!==`Tab`)return;let n=Array.from(t.querySelectorAll(p));if(!n.length){e.preventDefault(),t.focus();return}let r=n[0],i=n[n.length-1],a=document.activeElement;e.shiftKey&&(a===r||a===t)?(e.preventDefault(),i.focus()):!e.shiftKey&&a===i&&(e.preventDefault(),r.focus())}function y(){let e=[];for(let t of document.body.children)t.hasAttribute(`inert`)||t.matches(`.modal, .modal-backdrop`)||(t.setAttribute(`inert`,``),e.push(t));return e}function b({open:e,eyebrow:g,title:b,subtitle:x,headerIcon:S,tone:C=`default`,dismissible:w=!0,onClose:T,footer:E,size:D=`md`,placement:O=`center`,hideHeader:k=!1,staticBackdrop:A=!1,confirmDiscard:j,dirty:M=!1,ariaLabel:N,className:P=``,children:F,...I}){n(`AppModal`,I),t(`AppModal`,`tone`,C,d),t(`AppModal`,`placement`,O,f),t(`AppModal`,`size`,typeof D==`string`?D:null,[...Object.keys(m),`fullscreen`]);let{style:L,...R}=I;k&&!N&&typeof b!=`string`&&_();let z=o(null),B=o(null),[V,H]=s(!1);a(()=>{e||H(!1)},[e]),a(()=>{V&&B.current?.focus()},[V]),a(()=>{let e=z.current?.closest(`.modal`);e&&(j?e.setAttribute(`confirm-discard`,j):e.removeAttribute(`confirm-discard`))},[e,j]),a(()=>{if(!e)return;let t=z.current?.closest(`.modal-content`);if(!t)return;let n=()=>Array.from(t.querySelectorAll(p));(t.querySelector(`[data-autofocus]`)||n().find(e=>!e.classList.contains(`wui-modal-close`))||n()[0]||t).focus?.();let r=t.closest(`.modal`),i=y(),a=e=>v(e,r);return r?.addEventListener(`keydown`,a),()=>{r?.removeEventListener(`keydown`,a);for(let e of i)e.removeAttribute(`inert`);r&&setTimeout(()=>{r.isConnected&&!r.classList.contains(`show`)&&r.dispatchEvent(new Event(`transitionend`,{bubbles:!0}))},500)}},[e]);let U=()=>{if(j&&M){H(!0);return}T?.()},W=()=>{H(!1),T?.()},G=()=>{H(!1),(z.current?.querySelector(`input:not([type="hidden"]):not([disabled]),select:not([disabled]),textarea:not([disabled])`))?.focus()},K=D===`fullscreen`,q=typeof D==`number`?D:m[D]??m.md,J=[`wui-modal`,C==="default"?``:`tone-${C}`,P].filter(Boolean).join(` `);return u(c,{...R,show:e,onHide:U,backdrop:!A||`static`,keyboard:!A,autoFocus:!1,enforceFocus:!0,restoreFocus:!0,centered:O!==`top`,className:K?`wui-modal-shell ${h}`:`wui-modal-shell`,style:K?L:{"--wui-modal-max-width":`${q}px`,...L},dialogClassName:`wui-rb-dialog`,contentClassName:J,backdropClassName:`wui-modal-dim`,"aria-label":N||(typeof b==`string`?b:void 0),children:[!k&&u(`div`,{className:`wui-modal-header`,children:[u(`div`,{className:`wui-modal-heading`,children:[S&&l(`span`,{className:`wui-modal-headicon`,children:l(r,{name:S,size:18})}),u(`div`,{className:`wui-modal-headtext`,children:[g&&l(`div`,{className:`wui-modal-eyebrow`,children:g}),l(`div`,{className:`wui-modal-title`,children:b}),x&&l(`div`,{className:`wui-modal-subtitle`,children:x})]})]}),w&&l(`button`,{type:`button`,className:`wui-modal-close`,onClick:U,"aria-label":`Close`,children:l(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:l(`path`,{d:`M18 6 6 18M6 6l12 12`})})})]}),l(`div`,{className:`wui-modal-body`,ref:z,children:F}),(E||V)&&u(`div`,{className:V?`wui-modal-footer wui-drawer-discarding`:`wui-modal-footer`,children:[V&&l(i,{text:j,confirmRef:B,onDiscard:W,onKeep:G}),E]})]})}export{b as default};
@@ -1 +1 @@
1
- import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"../lib/FieldMessage.js";import r from"./AppRequiredMark.js";import i from"./useWuiControl.js";import{forwardRef as a,useId as o}from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";import"@webority/ui-elements/elements/phone";var l=[`sm`,`md`,`lg`],u=a(function({value:a,onChange:u,country:d,disabled:f=!1,name:p,id:m,label:h=`Phone number`,placeholder:g,required:_=!1,hint:v,error:y,showFlag:b=!0,showDialCode:x=!0,size:S=`md`,fieldClassName:C=``,...w},T){t(`AppPhoneNumberInput`,w),e(`AppPhoneNumberInput`,`size`,S,l);let E=o(),D=m||E,O=y&&D?`${D}-error`:void 0,k=!y&&v&&D?`${D}-hint`:void 0,{setRef:A}=i({ref:T,value:a??``,onChange:u,events:[`input`,`change`]});return c(`div`,{className:`field app-phone-number-input${S===`sm`?` phone-sm`:``}${S===`lg`?` phone-lg`:``}${C?` ${C}`:``}`,children:[h&&c(`label`,{className:`label`,htmlFor:D,children:[h,_&&s(r,{})]}),s(`wui-phone`,{ref:A,id:D,name:p,"aria-label":typeof h==`string`?h:void 0,"aria-describedby":O||k,"aria-invalid":y?`true`:void 0,country:d,placeholder:g,required:_?``:void 0,disabled:f?``:void 0,"hide-flag":b?void 0:``,"hide-dial":x?void 0:``,...w}),s(n,{error:y,hint:v,errorId:O,hintId:k})]})});export{u as default};
1
+ import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"../lib/FieldMessage.js";import r from"./AppRequiredMark.js";import i from"./useWuiControl.js";import{forwardRef as a,useId as o}from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";import"@webority/ui-elements/elements/phone";var l=[`sm`,`md`,`lg`],u=a(function({value:a,onChange:u,country:d,disabled:f=!1,name:p,id:m,label:h=`Phone number`,placeholder:g,required:_=!1,hint:v,error:y,showFlag:b=!0,showDialCode:x=!0,size:S=`md`,fieldClassName:C=``,...w},T){t(`AppPhoneNumberInput`,w),e(`AppPhoneNumberInput`,`size`,S,l);let E=o(),D=m||E,O=y&&D?`${D}-error`:void 0,k=!y&&v&&D?`${D}-hint`:void 0,{setRef:A}=i({ref:T,value:a??``,onChange:u,events:[`input`,`change`]});return c(`div`,{className:`field app-phone-number-input${S===`sm`?` phone-sm`:``}${S===`lg`?` phone-lg`:``}${C?` ${C}`:``}`,children:[h&&c(`label`,{className:`label`,htmlFor:D,children:[h,_&&s(r,{})]}),s(`wui-phone`,{ref:A,id:D,name:p,"aria-label":typeof h==`string`?h:void 0,"aria-describedby":O||k,"aria-invalid":y?`true`:void 0,country:d,placeholder:g,required:_?``:void 0,disabled:f?``:void 0,"hide-flag":b?void 0:``,"hide-dial":x?void 0:``,"external-error":``,...w}),s(n,{error:y,hint:v,errorId:O,hintId:k})]})});export{u as default};
@@ -1 +1 @@
1
- import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"../lib/FieldMessage.js";import r from"./AppInfoTip.js";import i from"./AppRequiredMark.js";import a from"./useWuiControl.js";import{forwardRef as o,useEffect as s,useId as c,useState as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";var f=[`html`,`markdown`],p=[`input`,`change`],m=`The editor couldn't load. Reload the page and try again.`,h=o(function({value:o,onChange:h,format:g,placeholder:_,name:v,label:y,error:b,hint:x,required:S=!1,disabled:C=!1,readOnly:w=!1,id:T,ariaLabel:E,className:D=``,fieldClassName:O=``,help:k,helpLabel:A=`More information`,...j},M){t(`AppRichText`,j),e(`AppRichText`,`format`,g,f);let N=c(),P=T||N,[F,I]=l(!1),{setRef:L}=a({ref:M,value:o,onChange:h,events:p});return s(()=>{let e=!0;return import(`@webority/ui-elements/rich-text`).catch(t=>{console.warn(`[AppRichText] the editor failed to load:`,t?.message),e&&I(!0)}),()=>{e=!1}},[]),d(`div`,{className:`field${O?` ${O}`:``}`,children:[y&&d(`label`,{className:`label`,htmlFor:P,children:[y,S&&u(i,{}),k&&u(r,{label:A,children:k})]}),F?u(`div`,{className:`field-error`,role:`status`,children:m}):u(`wui-rich-text`,{ref:L,id:P,role:`group`,name:v,format:g||void 0,placeholder:_,"aria-label":E||(typeof y==`string`?y:void 0),"aria-describedby":b?`${P}-error`:x?`${P}-hint`:void 0,"aria-invalid":b?`true`:void 0,required:S?``:void 0,disabled:C?``:void 0,readonly:w?``:void 0,className:D||void 0,...j},g||`html`),u(n,{error:b,hint:x,errorId:`${P}-error`,hintId:`${P}-hint`})]})});export{h as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"../lib/FieldMessage.js";import i from"./AppInfoTip.js";import a from"./AppRequiredMark.js";import o from"./useWuiControl.js";import{forwardRef as s,useEffect as c,useId as l,useState as u}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";var p=[`html`,`markdown`],m=[`input`,`change`],h=`The editor couldn't load. Reload the page and try again.`,g=s(function({value:s,onChange:g,format:_,placeholder:v,name:y,label:b,error:x,hint:S,required:C=!1,disabled:w=!1,readOnly:T=!1,id:E,ariaLabel:D,className:O=``,fieldClassName:k=``,help:A,helpLabel:j=`More information`,...M},N){n(`AppRichText`,M),t(`AppRichText`,`format`,_,p);let P=l(),F=E||P,[I,L]=u(!1),{setRef:R}=o({ref:N,value:s,onChange:g,events:m});return c(()=>{let t=!0;return import(`@webority/ui-elements/rich-text`).catch(n=>{e(`[AppRichText] the editor failed to load:`,n?.message),t&&L(!0)}),()=>{t=!1}},[]),f(`div`,{className:`field${k?` ${k}`:``}`,children:[b&&f(`label`,{className:`label`,htmlFor:F,children:[b,C&&d(a,{}),A&&d(i,{label:j,children:A})]}),I?d(`div`,{className:`field-error`,role:`status`,children:h}):d(`wui-rich-text`,{ref:R,id:F,role:`group`,name:y,format:_||void 0,placeholder:v,"aria-label":D||(typeof b==`string`?b:void 0),"aria-describedby":x?`${F}-error`:S?`${F}-hint`:void 0,"aria-invalid":x?`true`:void 0,required:C?``:void 0,disabled:w?``:void 0,readonly:T?``:void 0,className:O||void 0,...M},_||`html`),d(r,{error:x,hint:S,errorId:`${F}-error`,hintId:`${F}-hint`})]})});export{g as default};
@@ -1 +1 @@
1
- import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"../lib/FieldMessage.js";import ee from"./AppInfoTip.js";import r from"./AppRequiredMark.js";import i from"./useNodeLabels.js";import a,{optionsEqual as o}from"./useWuiControl.js";import{forwardRef as s,useEffect as c,useId as l,useRef as u}from"react";import{Fragment as d,jsx as f,jsxs as p}from"react/jsx-runtime";import"@webority/ui-elements/elements/select";var te=[`sm`,`lg`],m=(e,t)=>({value:e.value,label:t,icon:e.icon}),h=s(function({value:s,onChange:h,options:g=[],placeholder:_=`Select...`,searchPlaceholder:v=`Search...`,searchable:y=!1,clearable:b=!1,size:x,icon:S,prefix:C,suffix:w,floatingLabel:T=!1,disabled:E,label:D,required:O=!1,error:k,hint:A,help:j,helpLabel:M=`More information`,id:N,name:P,className:F=``,fieldClassName:I=``,"aria-label":L,"aria-labelledby":R,"aria-describedby":z,...B},V){t(`AppSelect`,B),e(`AppSelect`,`size`,x,te);let H=l(),{setRef:U,innerRef:W}=a({ref:V,value:s??``,onChange:h}),{portal:G,toElementOptions:K}=i(g),q=u({el:null,options:null});c(()=>{let e=W.current;if(!e||q.current.el===e&&q.current.options===g)return;q.current={el:e,options:g};let t=K(g,m);o(t,e.options)||(e.options=t)});let J=N||H,Y=T&&D,X=k&&J?`${J}-error`:void 0,Z=A&&J?`${J}-hint`:void 0,Q=p(d,{children:[f(`wui-select`,{"aria-label":L||(typeof D==`string`?D:void 0),"aria-labelledby":R||void 0,"aria-describedby":X||Z||z||void 0,"aria-invalid":k?`true`:void 0,ref:U,id:J,name:P,placeholder:T&&D?` `:_,"search-placeholder":v,searchable:y?``:void 0,clearable:b?``:void 0,size:x||void 0,icon:S||void 0,disabled:E?``:void 0,required:O?``:void 0,className:F||void 0,...B}),G]}),$=!Y&&(C!=null||w!=null)?p(`div`,{className:`input-affixed`,children:[C!=null&&f(`span`,{className:`affix affix-pre`,children:C}),Q,w!=null&&f(`span`,{className:`affix affix-suf`,children:w})]}):Q;return!D&&!k&&!A?$:p(`div`,{className:[`field`,I].filter(Boolean).join(` `),children:[D&&!Y&&p(`label`,{className:`label`,htmlFor:J,children:[D,O&&f(r,{}),j&&f(ee,{label:M,children:j})]}),Y?p(`div`,{className:`field-float`,children:[Q,p(`label`,{className:`float-label`,htmlFor:J,children:[D,O&&f(r,{})]})]}):$,f(n,{error:k,hint:A,errorId:X,hintId:Z})]})});export{h as default};
1
+ import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"../lib/FieldMessage.js";import r from"./AppInfoTip.js";import i from"./AppRequiredMark.js";import a from"./useNodeLabels.js";import o,{optionsEqual as s}from"./useWuiControl.js";import{forwardRef as c,useEffect as l,useId as u,useRef as d}from"react";import{Fragment as ee,jsx as f,jsxs as p}from"react/jsx-runtime";import"@webority/ui-elements/elements/select";var m=[`sm`,`lg`],te=(e,t)=>({value:e.value,label:t,icon:e.icon}),h=c(function({value:c,onChange:h,options:g=[],placeholder:_=`Select...`,searchPlaceholder:v=`Search...`,searchable:y=!1,clearable:b=!1,size:x,icon:S,prefix:C,suffix:w,floatingLabel:T=!1,disabled:E,label:D,required:O=!1,error:k,hint:A,help:j,helpLabel:M=`More information`,id:N,name:P,className:F=``,fieldClassName:I=``,"aria-label":L,"aria-labelledby":R,"aria-describedby":z,...B},V){t(`AppSelect`,B),e(`AppSelect`,`size`,x,m);let H=u(),{setRef:U,innerRef:W}=o({ref:V,value:c??``,onChange:h}),{portal:G,toElementOptions:K}=a(g),q=d({el:null,options:null,map:null});l(()=>{let e=W.current;if(!e||q.current.el===e&&q.current.options===g&&q.current.map===K)return;q.current={el:e,options:g,map:K};let t=K(g,te);s(t,e.options)||(e.options=t)});let J=N||H,Y=T&&D,X=k&&J?`${J}-error`:void 0,Z=A&&J?`${J}-hint`:void 0,Q=p(ee,{children:[f(`wui-select`,{"aria-label":L||(typeof D==`string`?D:void 0),"aria-labelledby":R||void 0,"aria-describedby":X||Z||z||void 0,"aria-invalid":k?`true`:void 0,ref:U,id:J,name:P,placeholder:T&&D?` `:_,"search-placeholder":v,searchable:y?``:void 0,clearable:b?``:void 0,size:x||void 0,icon:S||void 0,disabled:E?``:void 0,required:O?``:void 0,className:F||void 0,...B}),G]}),$=!Y&&(C!=null||w!=null)?p(`div`,{className:`input-affixed`,children:[C!=null&&f(`span`,{className:`affix affix-pre`,children:C}),Q,w!=null&&f(`span`,{className:`affix affix-suf`,children:w})]}):Q;return!D&&!k&&!A?$:p(`div`,{className:[`field`,I].filter(Boolean).join(` `),children:[D&&!Y&&p(`label`,{className:`label`,htmlFor:J,children:[D,O&&f(i,{}),j&&f(r,{label:M,children:j})]}),Y?p(`div`,{className:`field-float`,children:[Q,p(`label`,{className:`float-label`,htmlFor:J,children:[D,O&&f(i,{})]})]}):$,f(n,{error:k,hint:A,errorId:X,hintId:Z})]})});export{h as default};
@@ -1 +1 @@
1
- import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"./AppIcon.js";import r from"./AppAvatar.js";import{navMatchScore as i}from"../lib/navMatch.js";import{readShellCollapsed as a,writeShellCollapsed as o}from"../lib/shellCookie.js";import{initScrollEdges as s}from"@webority/ui-elements/helpers";import{useEffect as c,useId as l,useMemo as u,useRef as d,useState as f}from"react";import{Fragment as p,jsx as m,jsxs as h}from"react/jsx-runtime";var g=99,_=4,v=5,y=[`prefix`,`exact`],b=[`comfortable`,`compact`],x=e=>e>g?`${g}+`:String(e);function S({groups:r=[],brand:i,sidebarStart:l,sidebarStartCompact:p,sidebarFooter:g,topbarStart:_,topbarEnd:v,footer:y,children:x,collapsed:S,onCollapsedChange:E,noSidebar:O=!1,density:j=`comfortable`,navLabel:N=`Main navigation`,linkComponent:P,currentPath:F,rememberCollapsed:I=!1,collapsedCookie:L=`wui-shell-collapsed`,tabBarLabel:R=`Quick navigation`,moreLabel:z=`More`,userMenu:B,notifications:V,search:H,className:U=``,...W}){t(`AppShell`,W),e(`AppShell`,`density`,j,b);let[G,K]=f(()=>I&&S===void 0&&typeof document<`u`?a(L)??!1:!1),[q,J]=f(!1),[Y,ee]=f(!1),[te,ne]=f(!1),X=d(null),Z=S??G,re=()=>{let e=!Z;S===void 0&&K(e),I&&o(e,L),E?.(e)},Q=u(()=>C(r,F),[r,F]),$=O?null:w(Q);return c(()=>{let e=()=>ee(window.scrollY>4);return e(),window.addEventListener(`scroll`,e,{passive:!0}),()=>window.removeEventListener(`scroll`,e)},[]),c(()=>{s()},[]),c(()=>{let e=X.current,t=e?.querySelector(`.app-nav-item[aria-current="page"]`);if(!e||!t)return;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();n.top<r.top?e.scrollTop-=r.top-n.top:n.bottom>r.bottom&&(e.scrollTop+=n.bottom-r.bottom)},[]),c(()=>{let e=X.current;if(!e)return;let t=()=>ne(e.scrollHeight>e.clientHeight);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[Q]),c(()=>{if(!q)return;let e=e=>{e.key===`Escape`&&J(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[q]),h(`div`,{className:[`app-shell`,Z?`collapsed`:``,O?`no-sidebar`:``,q?`mobile-open`:``,U].filter(Boolean).join(` `),"data-density":j===`compact`?`compact`:void 0,...W,children:[m(`a`,{className:`wui-skip-link`,href:`#main-content`,children:`Skip to content`}),h(`aside`,{className:`app-sidebar`,children:[i&&m(`div`,{className:`app-sidebar-brand`,children:i}),l&&m(`div`,{className:`app-sidebar-start`,children:l}),p&&m(`div`,{className:`app-sidebar-start-compact`,children:p}),m(`nav`,{className:`app-sidebar-scroll`,"aria-label":N,ref:X,tabIndex:te?0:void 0,children:Q.map((e,t)=>h(`div`,{className:`app-nav-group`,children:[e.label&&m(`div`,{className:`app-nav-group-label`,children:e.label}),e.items.map(e=>m(D,{item:e,linkComponent:P,onNavigate:()=>J(!1)},e.key??e.href??e.label)),e.after&&m(`div`,{className:`wui-nav-group-after`,children:e.after})]},e.label??`group-${t}`))}),g&&m(`div`,{className:`app-sidebar-foot`,children:g}),!O&&m(`button`,{type:`button`,className:`app-sidebar-toggle`,onClick:re,"aria-label":Z?`Expand navigation`:`Collapse navigation`,"aria-expanded":!Z,children:m(n,{name:`chevrons-left`,size:20})})]}),h(`div`,{className:`app-main`,children:[h(`header`,{className:`app-topbar${Y?` scrolled`:``}`,children:[h(`div`,{className:`app-topbar-start`,children:[m(`button`,{type:`button`,className:`app-topbar-menu`,onClick:()=>J(!0),"aria-label":`Open navigation`,"aria-expanded":q,children:m(n,{name:`menu`,size:18})}),_,H&&m(M,{config:H})]}),h(`div`,{className:`app-topbar-end`,children:[v,V&&m(A,{config:V}),B&&m(k,{config:B,linkComponent:P})]})]}),m(`main`,{className:`app-content`,id:`main-content`,children:x}),y&&m(`footer`,{className:`app-footer`,children:y})]}),$&&h(`nav`,{className:`wui-tabbar`,"aria-label":R,children:[$.tabs.map(e=>m(T,{tab:e,linkComponent:P},e.key??e.href)),$.hasMore&&h(`button`,{type:`button`,className:`wui-tabbar-item${$.moreActive?` active`:``}`,onClick:()=>J(!0),children:[m(`span`,{className:`wui-tabbar-icon`,children:m(n,{name:`more`,size:24})}),m(`span`,{className:`wui-tabbar-label`,children:z})]})]}),m(`button`,{type:`button`,className:`app-scrim`,onClick:()=>J(!1),"aria-label":`Close navigation`,tabIndex:q?0:-1})]})}function C(t,n){let r=e=>(e??[]).map(e=>Array.isArray(e.children)?{...e,children:r(e.children)}:{...e}).filter(e=>(e.children?.length??0)>0||!!e.href),a=t.map(e=>({...e,items:r(e.items)})).filter(e=>e.items.length>0),o=[],s=e=>{for(let t of e)o.push(t),t.children&&s(t.children)};for(let e of a)s(e.items);for(let t of o)e(`AppShell`,`match`,t.match,y);let c=null;if(n!=null&&!o.some(e=>e.active===!0)){let e=-1;for(let t of o){if(t.active!=null||t.children?.length&&!t.href)continue;let r=i(n,t.href,{exact:t.match===`exact`,also:t.matchAlso});r>e&&(e=r,c=t)}}for(let e of o)e.active=e.active??e===c;return a}function w(e){let t=[],n=e=>{for(let r of e)r.children?.length?n(r.children):t.push(r)};for(let t of e)n(t.items);let r=t.filter(e=>e.tab);if(r.length===0)return null;let i=r.length<t.length,a=i?_:v;if(r.length>a)throw Error(`<AppShell>: ${r.length} items carry tab: true, but the phone tab bar holds ${a} (${i?`4 plus More, because other items exist`:`5 when every item is a tab`}). Flag fewer items.`);return{tabs:r,hasMore:i,moreActive:t.some(e=>!e.tab&&e.active)}}function T({tab:e,linkComponent:t}){let r=`wui-tabbar-item${e.active?` active`:``}`,i=h(p,{children:[e.icon&&m(`span`,{className:`wui-tabbar-icon`,children:typeof e.icon==`string`?m(n,{name:e.icon,size:24}):e.icon}),m(`span`,{className:`wui-tabbar-label`,children:e.tabLabel??e.label}),e.badge!=null&&m(`span`,{className:`wui-tabbar-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,children:e.badge})]}),a=e.active?`page`:void 0;return t?m(t,{className:r,to:e.href,"aria-current":a,children:i}):m(`a`,{className:r,href:e.href,"aria-current":a,children:i})}function E(e){for(let t of e){if(t.active)return t;let e=t.children?.length?E(t.children):void 0;if(e)return e}}function D({item:e,linkComponent:t,onNavigate:r,depth:i=0}){let a=i>0,o=i>1?{"--wui-nav-depth":i}:void 0,s=Array.isArray(e.children)&&e.children.length>0,l=s?E(e.children):void 0,u=!!l,d=l?l.key??l.href??l.label:null,[g,_]=f(u);c(()=>{d!=null&&_(!0)},[d]);let v=typeof e.label==`string`?e.label:void 0,y=!a&&e.icon&&m(`span`,{className:`app-nav-icon`,children:typeof e.icon==`string`?m(n,{name:e.icon,size:22}):e.icon}),b=e.badge!=null&&m(`span`,{className:`app-nav-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,children:e.badge}),x=h(p,{children:[y,m(`span`,{className:`app-nav-text`,children:e.label}),b,e.trailingIcon&&m(`span`,{className:`app-nav-trailing`,children:typeof e.trailingIcon==`string`?m(n,{name:e.trailingIcon,size:16}):e.trailingIcon})]}),S=e.active?`page`:void 0;if(s){let s=m(`div`,{className:`app-nav-sub${g?` expanded`:``}`,inert:!g,"aria-hidden":!g||void 0,children:m(`div`,{className:`app-nav-sub-inner`,children:e.children.map(e=>m(D,{item:e,linkComponent:t,onNavigate:r,depth:i+1},e.key??e.href))})});if(e.href){let i=t?m(t,{className:`wui-nav-split-link`,to:e.href,"aria-current":S,onClick:r,children:x}):m(`a`,{className:`wui-nav-split-link`,href:e.href,"aria-current":S,onClick:r,children:x});return h(p,{children:[h(`div`,{className:`app-nav-item has-children wui-nav-split${a?` app-nav-subitem`:``}${u||e.active?` active`:``}`,style:o,"data-label":v,children:[i,m(`button`,{type:`button`,className:`app-nav-caret wui-nav-split-toggle`,"aria-expanded":g,"aria-label":`Show or hide ${v??``} pages`,onClick:()=>_(e=>!e),children:m(n,{name:`chevron-right`,size:16})})]}),s]})}return h(p,{children:[h(`button`,{type:`button`,className:`app-nav-item${a?` app-nav-subitem`:``} has-children${u?` active`:``}`,style:o,"aria-expanded":g,"data-label":v,onClick:()=>_(e=>!e),children:[y,m(`span`,{className:`app-nav-text`,children:e.label}),b,m(`span`,{className:`app-nav-caret`,children:m(n,{name:`chevron-right`,size:16})})]}),s]})}let C=`app-nav-item${a?` app-nav-subitem`:``}${e.active?` active`:``}`;return t?m(t,{className:C,style:o,to:e.href,"aria-current":S,"data-label":v,onClick:r,children:x}):m(`a`,{className:C,style:o,href:e.href,"aria-current":S,"data-label":v,onClick:r,children:x})}function O(){let[e,t]=f(!1),n=d(null);return c(()=>{if(!e)return;let r=e=>{n.current?.contains(e.target)||t(!1)},i=e=>{e.key===`Escape`&&(t(!1),n.current?.querySelector(`button`)?.focus())};return document.addEventListener(`mousedown`,r),document.addEventListener(`keydown`,i),()=>{document.removeEventListener(`mousedown`,r),document.removeEventListener(`keydown`,i)}},[e]),{open:e,setOpen:t,ref:n}}function k({config:e,linkComponent:t}){let i=l(),{open:a,setOpen:o,ref:s}=O(),{name:c,role:u,photo:d,profileHref:f,profileLabel:g=`My profile`,onLogout:_,logoutAction:v,logoutLabel:y=`Sign out`,items:b=[]}=e;if(!c)throw Error(`<AppShell> userMenu.name is required; the trigger and the avatar are named from it.`);let x=()=>o(!1),S=(e,n,r,i)=>t?m(t,{className:`dropdown-item`,to:e,onClick:i,children:n},r):m(`a`,{className:`dropdown-item`,href:e,onClick:i,children:n},r),C=h(p,{children:[m(n,{name:`log-out`,size:18}),y]});return h(`div`,{className:`dropdown wui-usermenu`,ref:s,children:[h(`button`,{type:`button`,id:i,className:`wui-usermenu-trigger`,"aria-expanded":a,"aria-label":`Account menu for ${c}`,onClick:()=>o(e=>!e),children:[m(r,{name:c,src:d,tone:`auto`}),h(`span`,{className:`wui-usermenu-text`,children:[m(`span`,{className:`wui-usermenu-name`,children:c}),u&&m(`span`,{className:`wui-usermenu-role`,children:u})]}),m(n,{name:`chevron-down`,size:14,className:`wui-usermenu-caret`})]}),h(`div`,{className:`dropdown-menu dropdown-menu-end wui-usermenu-menu${a?` show`:``}`,"aria-labelledby":i,"data-bs-popper":a?`static`:void 0,children:[h(`div`,{className:`wui-usermenu-head`,children:[m(r,{name:c,src:d,size:`lg`,tone:`auto`}),h(`div`,{className:`wui-usermenu-who`,children:[m(`div`,{className:`wui-usermenu-name`,children:c}),u&&m(`div`,{className:`wui-usermenu-role`,children:u})]})]}),f&&S(f,h(p,{children:[m(n,{name:`user`,size:18}),g]}),void 0,x),b.map(e=>{if(e.divider)return m(`hr`,{className:`dropdown-divider`},e.key);let t=h(p,{children:[e.icon&&m(n,{name:e.icon,size:18}),e.label]}),r=()=>{e.onClick?.(),x()};return e.href?S(e.href,t,e.key,r):m(`button`,{type:`button`,className:`dropdown-item`,onClick:r,children:t},e.key)}),v?m(`form`,{method:`post`,action:v,className:`wui-usermenu-logout`,children:m(`button`,{type:`submit`,className:`dropdown-item danger`,children:C})}):_&&m(`button`,{type:`button`,className:`dropdown-item danger`,onClick:()=>{x(),_()},children:C})]})]})}function A({config:e}){let t=l(),{open:r,setOpen:i,ref:a}=O(),{unread:o=0,items:s,loading:u=!1,onOpen:g,onMarkAllRead:_,viewAllHref:v,label:y=`Notifications`,emptyText:b=`You are all caught up.`}=e,[S,C]=f(``),w=d(o);c(()=>{w.current!==o&&(w.current=o,C(o===0?`No unread notifications`:`${x(o)} unread notifications`))},[o]);let T=null;return s?.length?T=m(`div`,{className:`wui-bell-items`,children:s.map((e,t)=>{let r=`wui-bell-item${e.read?` wui-bell-item-read`:``}`,i=h(p,{children:[m(`span`,{className:`wui-bell-dot`,"aria-hidden":`true`}),e.icon&&m(`span`,{className:`wui-bell-icon`,children:m(n,{name:e.icon,size:18})}),h(`span`,{className:`wui-bell-body`,children:[!e.read&&m(`span`,{className:`visually-hidden`,children:`Unread: `}),m(`span`,{className:`wui-bell-item-title`,children:e.title}),e.time&&m(`span`,{className:`wui-bell-when`,children:e.time})]})]});return e.href?m(`a`,{className:r,href:e.href,"data-id":e.id,children:i},e.id??t):m(`div`,{className:r,"data-id":e.id,children:i},e.id??t)})}):u?T=m(`div`,{className:`wui-bell-state`,children:`Loading…`}):s&&(T=m(`div`,{className:`wui-bell-state`,children:b})),h(`div`,{className:`dropdown wui-bell`,ref:a,children:[h(`button`,{type:`button`,id:t,className:`topbar-icon-btn wui-bell-trigger`,"aria-expanded":r,"aria-label":o===0?y:`${y}, ${x(o)} unread`,onClick:()=>{let e=!r;i(e),e&&g?.()},children:[m(n,{name:`notification`,size:20}),m(`span`,{className:`wui-bell-count`,"aria-hidden":`true`,hidden:o===0,children:x(o)})]}),m(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:S}),h(`div`,{className:`dropdown-menu dropdown-menu-end wui-bell-menu${r?` show`:``}`,"aria-labelledby":t,"data-bs-popper":r?`static`:void 0,children:[h(`div`,{className:`wui-bell-head`,children:[m(`span`,{className:`wui-bell-title`,children:y}),_&&m(`button`,{type:`button`,className:`wui-bell-markall`,onClick:_,children:`Mark all read`})]}),m(`div`,{className:`wui-bell-list`,"aria-busy":u||void 0,children:T}),v&&m(`a`,{className:`wui-bell-foot`,href:v,children:`View all`})]})]})}var j=e=>!!e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName));function M({config:e}){let t=l(),{value:r=``,onChange:i,results:a=null,loading:o=!1,onSelect:s,onSubmit:p,placeholder:g=`Search`}=e,[_,v]=f(!1),[y,b]=f(!1),[x,S]=f({results:null,index:-1}),C=x.results===a?x.index:-1,w=e=>S({results:a,index:e}),T=d(null),E=d(null),D=d([]),O=u(()=>(a??[]).flatMap(e=>e.hits??[]),[a]),k=a!=null&&!y,A=O.length;c(()=>{let e=e=>{e.key!==`/`||e.ctrlKey||e.metaKey||e.altKey||j(e.target)||(e.preventDefault(),v(!0),E.current?.focus())},t=e=>{T.current?.contains(e.target)||(b(!0),v(!1))};return document.addEventListener(`keydown`,e),document.addEventListener(`pointerdown`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`pointerdown`,t)}},[]);let M=e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(!k||A===0)return;e.preventDefault(),w((C+(e.key===`ArrowDown`?1:-1)+A)%A)}else e.key===`Enter`?k&&C>=0&&D.current[C]?(e.preventDefault(),D.current[C].click()):p&&r.trim()!==``&&(e.preventDefault(),p(r.trim())):e.key===`Escape`&&(k?(e.preventDefault(),b(!0)):_&&(e.preventDefault(),v(!1)))},N=-1;return D.current=[],h(`div`,{className:`wui-topsearch${_?` is-open`:``}${o?` is-loading`:``}`,ref:T,children:[m(`button`,{type:`button`,className:`topbar-icon-btn wui-topsearch-open`,"aria-label":g,"aria-expanded":_,"aria-controls":`${t}-panel`,onClick:()=>{let e=!_;v(e),e&&E.current?.focus()},children:m(n,{name:`search`,size:20})}),h(`div`,{className:`wui-topsearch-panel`,id:`${t}-panel`,children:[h(`div`,{className:`search-wrap`,children:[m(n,{name:`search`,size:18,className:`search-icon`}),m(`input`,{ref:E,type:`search`,className:`form-control input search-input`,id:`${t}-input`,placeholder:g,"aria-label":g,role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":k,"aria-controls":`${t}-list`,"aria-activedescendant":k&&C>=0?`${t}-opt-${C}`:void 0,autoComplete:`off`,value:r,onChange:e=>{b(!1),i?.(e.target.value)},onKeyDown:M})]}),m(`div`,{className:`wui-topsearch-results`,id:`${t}-list`,role:`listbox`,"aria-label":`Search results`,hidden:!k,children:k&&h(`div`,{className:`wui-topsearch-groups`,role:`presentation`,children:[A===0&&h(`div`,{className:`wui-topsearch-empty`,role:`option`,"aria-disabled":`true`,"aria-selected":`false`,children:[`No results for “`,r,`”`]}),a.filter(e=>e.hits?.length).map((e,r)=>h(`div`,{className:`wui-topsearch-group`,role:`group`,"aria-label":e.label??``,children:[e.label&&m(`div`,{className:`wui-topsearch-group-label`,role:`presentation`,children:e.label}),e.hits.map(e=>{N+=1;let r=N;return h(`a`,{className:`wui-topsearch-hit${r===C?` is-active`:``}`,role:`option`,"aria-selected":r===C,id:`${t}-opt-${r}`,href:e.href,ref:e=>{D.current[r]=e},onClick:t=>s?.(e,t),children:[e.icon&&m(`span`,{className:`wui-topsearch-hit-icon`,children:m(n,{name:e.icon,size:18})}),h(`span`,{className:`wui-topsearch-hit-text`,children:[m(`span`,{className:`wui-topsearch-hit-title`,children:e.title}),e.subtitle&&m(`span`,{className:`wui-topsearch-hit-sub`,children:e.subtitle})]})]},`${e.href}-${r}`)})]},e.label??r))]})})]}),m(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:k?A===0?`No results`:`${A} ${A===1?`result`:`results`}`:``})]})}export{S as default};
1
+ import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"./AppIcon.js";import r from"./AppAvatar.js";import{navMatchScore as i}from"../lib/navMatch.js";import{readShellCollapsed as a,writeShellCollapsed as o}from"../lib/shellCookie.js";import{initScrollEdges as s}from"@webority/ui-elements/helpers";import{useEffect as c,useId as l,useMemo as u,useRef as d,useState as f}from"react";import{Fragment as p,jsx as m,jsxs as h}from"react/jsx-runtime";var g=99,_=4,v=5,y=[`prefix`,`exact`],b=[`comfortable`,`compact`],x=e=>e>g?`${g}+`:String(e);function S({groups:r=[],brand:i,sidebarStart:l,sidebarStartCompact:p,sidebarFooter:g,topbarStart:_,topbarEnd:v,footer:y,children:x,collapsed:S,onCollapsedChange:E,noSidebar:O=!1,density:j=`comfortable`,navLabel:N=`Main navigation`,linkComponent:P,currentPath:F,rememberCollapsed:I=!1,collapsedCookie:L=`wui-shell-collapsed`,tabBarLabel:R=`Quick navigation`,moreLabel:z=`More`,userMenu:B,notifications:V,search:H,className:U=``,...W}){t(`AppShell`,W),e(`AppShell`,`density`,j,b);let[G,K]=f(()=>I&&S===void 0&&typeof document<`u`?a(L)??!1:!1),[q,J]=f(!1),[Y,ee]=f(!1),[te,ne]=f(!1),X=d(null),Z=S??G,re=()=>{let e=!Z;S===void 0&&K(e),I&&o(e,L),E?.(e)},Q=u(()=>C(r,F),[r,F]),$=O?null:w(Q);return c(()=>{let e=()=>ee(window.scrollY>4);return e(),window.addEventListener(`scroll`,e,{passive:!0}),()=>window.removeEventListener(`scroll`,e)},[]),c(()=>{s()},[]),c(()=>{let e=X.current,t=e?.querySelector(`.app-nav-item[aria-current="page"]`);if(!e||!t)return;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();n.top<r.top?e.scrollTop-=r.top-n.top:n.bottom>r.bottom&&(e.scrollTop+=n.bottom-r.bottom)},[]),c(()=>{let e=X.current;if(!e)return;let t=()=>ne(e.scrollHeight>e.clientHeight);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[Q]),c(()=>{if(!q)return;let e=e=>{e.key===`Escape`&&J(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[q]),h(`div`,{className:[`app-shell`,Z?`collapsed`:``,O?`no-sidebar`:``,q?`mobile-open`:``,U].filter(Boolean).join(` `),"data-density":j===`compact`?`compact`:void 0,...W,children:[m(`a`,{className:`wui-skip-link`,href:`#main-content`,children:`Skip to content`}),h(`aside`,{className:`app-sidebar`,children:[i&&m(`div`,{className:`app-sidebar-brand`,children:i}),l&&m(`div`,{className:`app-sidebar-start`,children:l}),p&&m(`div`,{className:`app-sidebar-start-compact`,children:p}),m(`nav`,{className:`app-sidebar-scroll`,"aria-label":N,ref:X,tabIndex:te?0:void 0,children:Q.map((e,t)=>h(`div`,{className:`app-nav-group`,children:[e.label&&m(`div`,{className:`app-nav-group-label`,children:e.label}),e.items.map(e=>m(D,{item:e,linkComponent:P,onNavigate:()=>J(!1)},e.key??e.href??e.label)),e.after&&m(`div`,{className:`wui-nav-group-after`,children:e.after})]},e.label??`group-${t}`))}),g&&m(`div`,{className:`app-sidebar-foot`,children:g}),!O&&m(`button`,{type:`button`,className:`app-sidebar-toggle`,onClick:re,"aria-label":Z?`Expand navigation`:`Collapse navigation`,"aria-expanded":!Z,children:m(n,{name:`chevrons-left`,size:20})})]}),h(`div`,{className:`app-main`,children:[h(`header`,{className:`app-topbar${Y?` scrolled`:``}`,children:[h(`div`,{className:`app-topbar-start`,children:[m(`button`,{type:`button`,className:`app-topbar-menu`,onClick:()=>J(!0),"aria-label":`Open navigation`,"aria-expanded":q,children:m(n,{name:`menu`,size:18})}),_,H&&m(M,{config:H})]}),h(`div`,{className:`app-topbar-end`,children:[v,V&&m(A,{config:V}),B&&m(k,{config:B,linkComponent:P})]})]}),m(`main`,{className:`app-content`,id:`main-content`,children:x}),y&&m(`footer`,{className:`app-footer`,children:y})]}),$&&h(`nav`,{className:`wui-tabbar`,"aria-label":R,children:[$.tabs.map(e=>m(T,{tab:e,linkComponent:P},e.key??e.href)),$.hasMore&&h(`button`,{type:`button`,className:`wui-tabbar-item${$.moreActive?` active`:``}`,onClick:()=>J(!0),children:[m(`span`,{className:`wui-tabbar-icon`,children:m(n,{name:`more`,size:24})}),m(`span`,{className:`wui-tabbar-label`,children:z})]})]}),m(`button`,{type:`button`,className:`app-scrim`,onClick:()=>J(!1),"aria-label":`Close navigation`,tabIndex:q?0:-1})]})}function C(t,n){let r=e=>(e??[]).map(e=>Array.isArray(e.children)?{...e,children:r(e.children)}:{...e}).filter(e=>(e.children?.length??0)>0||!!e.href),a=t.map(e=>({...e,items:r(e.items)})).filter(e=>e.items.length>0),o=[],s=e=>{for(let t of e)o.push(t),t.children&&s(t.children)};for(let e of a)s(e.items);for(let t of o)e(`AppShell`,`match`,t.match,y);let c=null;if(n!=null&&!o.some(e=>e.active===!0)){let e=-1;for(let t of o){if(t.active!=null||t.children?.length&&!t.href)continue;let r=i(n,t.href,{exact:t.match===`exact`,also:t.matchAlso});r>e&&(e=r,c=t)}}for(let e of o)e.active=e.active??e===c;return a}function w(e){let t=[],n=e=>{for(let r of e)r.children?.length?n(r.children):t.push(r)};for(let t of e)n(t.items);let r=t.filter(e=>e.tab);if(r.length===0)return null;let i=r.length<t.length,a=i?_:v;if(r.length>a)throw Error(`<AppShell>: ${r.length} items carry tab: true, but the phone tab bar holds ${a} (${i?`4 plus More, because other items exist`:`5 when every item is a tab`}). Flag fewer items.`);return{tabs:r,hasMore:i,moreActive:t.some(e=>!e.tab&&e.active)}}function T({tab:e,linkComponent:t}){let r=`wui-tabbar-item${e.active?` active`:``}`,i=h(p,{children:[e.icon&&m(`span`,{className:`wui-tabbar-icon`,children:typeof e.icon==`string`?m(n,{name:e.icon,size:24}):e.icon}),m(`span`,{className:`wui-tabbar-label`,children:e.tabLabel??e.label}),e.badge!=null&&m(`span`,{className:`wui-tabbar-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:e.badge})]}),a=e.active?`page`:void 0;return t?m(t,{className:r,to:e.href,"aria-current":a,children:i}):m(`a`,{className:r,href:e.href,"aria-current":a,children:i})}function E(e){for(let t of e){if(t.active)return t;let e=t.children?.length?E(t.children):void 0;if(e)return e}}function D({item:e,linkComponent:t,onNavigate:r,depth:i=0}){let a=i>0,o=i>1?` wui-nav-depth-${Math.min(i,6)}`:``,s=Array.isArray(e.children)&&e.children.length>0,l=s?E(e.children):void 0,u=!!l,d=l?l.key??l.href??l.label:null,[g,_]=f(u);c(()=>{d!=null&&_(!0)},[d]);let v=typeof e.label==`string`?e.label:void 0,y=!a&&e.icon&&m(`span`,{className:`app-nav-icon`,children:typeof e.icon==`string`?m(n,{name:e.icon,size:22}):e.icon}),b=e.badge!=null&&m(`span`,{className:`app-nav-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:e.badge}),x=h(p,{children:[y,m(`span`,{className:`app-nav-text`,children:e.label}),b,e.trailingIcon&&m(`span`,{className:`app-nav-trailing`,children:typeof e.trailingIcon==`string`?m(n,{name:e.trailingIcon,size:16}):e.trailingIcon})]}),S=e.active?`page`:void 0;if(s){let s=m(`div`,{className:`app-nav-sub${g?` expanded`:``}`,inert:!g,"aria-hidden":!g||void 0,children:m(`div`,{className:`app-nav-sub-inner`,children:e.children.map(e=>m(D,{item:e,linkComponent:t,onNavigate:r,depth:i+1},e.key??e.href))})});if(e.href){let i=t?m(t,{className:`wui-nav-split-link`,to:e.href,"aria-current":S,onClick:r,children:x}):m(`a`,{className:`wui-nav-split-link`,href:e.href,"aria-current":S,onClick:r,children:x});return h(p,{children:[h(`div`,{className:`app-nav-item has-children wui-nav-split${a?` app-nav-subitem`:``}${u||e.active?` active`:``}${o}`,"data-label":v,children:[i,m(`button`,{type:`button`,className:`app-nav-caret wui-nav-split-toggle`,"aria-expanded":g,"aria-label":`Show or hide ${v??``} pages`,onClick:()=>_(e=>!e),children:m(n,{name:`chevron-right`,size:16})})]}),s]})}return h(p,{children:[h(`button`,{type:`button`,className:`app-nav-item${a?` app-nav-subitem`:``} has-children${u?` active`:``}${o}`,"aria-expanded":g,"data-label":v,onClick:()=>_(e=>!e),children:[y,m(`span`,{className:`app-nav-text`,children:e.label}),b,m(`span`,{className:`app-nav-caret`,children:m(n,{name:`chevron-right`,size:16})})]}),s]})}let C=`app-nav-item${a?` app-nav-subitem`:``}${e.active?` active`:``}${o}`;return t?m(t,{className:C,to:e.href,"aria-current":S,"data-label":v,onClick:r,children:x}):m(`a`,{className:C,href:e.href,"aria-current":S,"data-label":v,onClick:r,children:x})}function O(){let[e,t]=f(!1),n=d(null);return c(()=>{if(!e)return;let r=e=>{n.current?.contains(e.target)||t(!1)},i=e=>{e.key===`Escape`&&(t(!1),n.current?.querySelector(`button`)?.focus())};return document.addEventListener(`mousedown`,r),document.addEventListener(`keydown`,i),()=>{document.removeEventListener(`mousedown`,r),document.removeEventListener(`keydown`,i)}},[e]),{open:e,setOpen:t,ref:n}}function k({config:e,linkComponent:t}){let i=l(),{open:a,setOpen:o,ref:s}=O(),{name:c,role:u,photo:d,profileHref:f,profileLabel:g=`My profile`,onLogout:_,logoutAction:v,logoutLabel:y=`Sign out`,items:b=[]}=e;if(!c)throw Error(`<AppShell> userMenu.name is required; the trigger and the avatar are named from it.`);let x=()=>o(!1),S=(e,n,r,i)=>t?m(t,{className:`dropdown-item`,to:e,onClick:i,children:n},r):m(`a`,{className:`dropdown-item`,href:e,onClick:i,children:n},r),C=h(p,{children:[m(n,{name:`log-out`,size:18}),y]});return h(`div`,{className:`dropdown wui-usermenu`,ref:s,children:[h(`button`,{type:`button`,id:i,className:`wui-usermenu-trigger`,"aria-expanded":a,"aria-label":`Account menu for ${c}`,onClick:()=>o(e=>!e),children:[m(r,{name:c,src:d,tone:`auto`}),h(`span`,{className:`wui-usermenu-text`,children:[m(`span`,{className:`wui-usermenu-name`,children:c}),u&&m(`span`,{className:`wui-usermenu-role`,children:u})]}),m(n,{name:`chevron-down`,size:14,className:`wui-usermenu-caret`})]}),h(`div`,{className:`dropdown-menu dropdown-menu-end wui-usermenu-menu${a?` show`:``}`,"aria-labelledby":i,"data-bs-popper":a?`static`:void 0,children:[h(`div`,{className:`wui-usermenu-head`,children:[m(r,{name:c,src:d,size:`lg`,tone:`auto`}),h(`div`,{className:`wui-usermenu-who`,children:[m(`div`,{className:`wui-usermenu-name`,children:c}),u&&m(`div`,{className:`wui-usermenu-role`,children:u})]})]}),f&&S(f,h(p,{children:[m(n,{name:`user`,size:18}),g]}),void 0,x),b.map(e=>{if(e.divider)return m(`hr`,{className:`dropdown-divider`},e.key);let t=h(p,{children:[e.icon&&m(n,{name:e.icon,size:18}),e.label]}),r=()=>{e.onClick?.(),x()};return e.href?S(e.href,t,e.key,r):m(`button`,{type:`button`,className:`dropdown-item`,onClick:r,children:t},e.key)}),v?m(`form`,{method:`post`,action:v,className:`wui-usermenu-logout`,children:m(`button`,{type:`submit`,className:`dropdown-item danger`,children:C})}):_&&m(`button`,{type:`button`,className:`dropdown-item danger`,onClick:()=>{x(),_()},children:C})]})]})}function A({config:e}){let t=l(),{open:r,setOpen:i,ref:a}=O(),{unread:o=0,items:s,loading:u=!1,onOpen:g,onMarkAllRead:_,viewAllHref:v,label:y=`Notifications`,emptyText:b=`You are all caught up.`}=e,[S,C]=f(``),w=d(o);c(()=>{w.current!==o&&(w.current=o,C(o===0?`No unread notifications`:`${x(o)} unread notifications`))},[o]);let T=null;return s?.length?T=m(`div`,{className:`wui-bell-items`,children:s.map((e,t)=>{let r=`wui-bell-item${e.read?` wui-bell-item-read`:``}`,i=h(p,{children:[m(`span`,{className:`wui-bell-dot`,"aria-hidden":`true`}),e.icon&&m(`span`,{className:`wui-bell-icon`,children:m(n,{name:e.icon,size:18})}),h(`span`,{className:`wui-bell-body`,children:[!e.read&&m(`span`,{className:`visually-hidden`,children:`Unread: `}),m(`span`,{className:`wui-bell-item-title`,children:e.title}),e.time&&m(`span`,{className:`wui-bell-when`,children:e.time})]})]});return e.href?m(`a`,{className:r,href:e.href,"data-id":e.id,children:i},e.id??t):m(`div`,{className:r,"data-id":e.id,children:i},e.id??t)})}):u?T=m(`div`,{className:`wui-bell-state`,children:`Loading…`}):s&&(T=m(`div`,{className:`wui-bell-state`,children:b})),h(`div`,{className:`dropdown wui-bell`,ref:a,children:[h(`button`,{type:`button`,id:t,className:`topbar-icon-btn wui-bell-trigger`,"aria-expanded":r,"aria-label":o===0?y:`${y}, ${x(o)} unread`,onClick:()=>{let e=!r;i(e),e&&g?.()},children:[m(n,{name:`notification`,size:20}),m(`span`,{className:`wui-bell-count`,"aria-hidden":`true`,hidden:o===0,children:x(o)})]}),m(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:S}),h(`div`,{className:`dropdown-menu dropdown-menu-end wui-bell-menu${r?` show`:``}`,"aria-labelledby":t,"data-bs-popper":r?`static`:void 0,children:[h(`div`,{className:`wui-bell-head`,children:[m(`span`,{className:`wui-bell-title`,children:y}),_&&m(`button`,{type:`button`,className:`wui-bell-markall`,onClick:_,children:`Mark all read`})]}),m(`div`,{className:`wui-bell-list`,"aria-busy":u||void 0,children:T}),v&&m(`a`,{className:`wui-bell-foot`,href:v,children:`View all`})]})]})}var j=e=>!!e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName));function M({config:e}){let t=l(),{value:r=``,onChange:i,results:a=null,loading:o=!1,onSelect:s,onSubmit:p,placeholder:g=`Search`}=e,[_,v]=f(!1),[y,b]=f(!1),[x,S]=f({results:null,index:-1}),C=x.results===a?x.index:-1,w=e=>S({results:a,index:e}),T=d(null),E=d(null),D=d([]),O=u(()=>(a??[]).flatMap(e=>e.hits??[]),[a]),k=a!=null&&!y,A=O.length;c(()=>{let e=e=>{e.key!==`/`||e.ctrlKey||e.metaKey||e.altKey||j(e.target)||(e.preventDefault(),v(!0),E.current?.focus())},t=e=>{T.current?.contains(e.target)||(b(!0),v(!1))};return document.addEventListener(`keydown`,e),document.addEventListener(`pointerdown`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`pointerdown`,t)}},[]);let M=e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(!k||A===0)return;e.preventDefault(),w((C+(e.key===`ArrowDown`?1:-1)+A)%A)}else e.key===`Enter`?k&&C>=0&&D.current[C]?(e.preventDefault(),D.current[C].click()):p&&r.trim()!==``&&(e.preventDefault(),p(r.trim())):e.key===`Escape`&&(k?(e.preventDefault(),b(!0)):_&&(e.preventDefault(),v(!1)))},N=-1;return D.current=[],h(`div`,{className:`wui-topsearch${_?` is-open`:``}${o?` is-loading`:``}`,ref:T,children:[m(`button`,{type:`button`,className:`topbar-icon-btn wui-topsearch-open`,"aria-label":g,"aria-expanded":_,"aria-controls":`${t}-panel`,onClick:()=>{let e=!_;v(e),e&&E.current?.focus()},children:m(n,{name:`search`,size:20})}),h(`div`,{className:`wui-topsearch-panel`,id:`${t}-panel`,children:[h(`div`,{className:`search-wrap`,children:[m(n,{name:`search`,size:18,className:`search-icon`}),m(`input`,{ref:E,type:`search`,className:`form-control input search-input`,id:`${t}-input`,placeholder:g,"aria-label":g,role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":k,"aria-controls":`${t}-list`,"aria-activedescendant":k&&C>=0?`${t}-opt-${C}`:void 0,autoComplete:`off`,value:r,onChange:e=>{b(!1),i?.(e.target.value)},onKeyDown:M})]}),m(`div`,{className:`wui-topsearch-results`,id:`${t}-list`,role:`listbox`,"aria-label":`Search results`,hidden:!k,children:k&&h(`div`,{className:`wui-topsearch-groups`,role:`presentation`,children:[A===0&&h(`div`,{className:`wui-topsearch-empty`,role:`option`,"aria-disabled":`true`,"aria-selected":`false`,children:[`No results for “`,r,`”`]}),a.filter(e=>e.hits?.length).map((e,r)=>h(`div`,{className:`wui-topsearch-group`,role:`group`,"aria-label":e.label??``,children:[e.label&&m(`div`,{className:`wui-topsearch-group-label`,role:`presentation`,children:e.label}),e.hits.map(e=>{N+=1;let r=N;return h(`a`,{className:`wui-topsearch-hit${r===C?` is-active`:``}`,role:`option`,"aria-selected":r===C,id:`${t}-opt-${r}`,href:e.href,ref:e=>{D.current[r]=e},onClick:t=>s?.(e,t),children:[e.icon&&m(`span`,{className:`wui-topsearch-hit-icon`,children:m(n,{name:e.icon,size:18})}),h(`span`,{className:`wui-topsearch-hit-text`,children:[m(`span`,{className:`wui-topsearch-hit-title`,children:e.title}),e.subtitle&&m(`span`,{className:`wui-topsearch-hit-sub`,children:e.subtitle})]})]},`${e.href}-${r}`)})]},e.label??r))]})})]}),m(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:k?A===0?`No results`:`${A} ${A===1?`result`:`results`}`:``})]})}export{S as default};
@@ -1 +1 @@
1
- import e from"./warnUnknownProps.js";import{jsx as t}from"react/jsx-runtime";var n=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}},r=!1;function i(e){r||!n()||(r=!0,console.warn(`[@webority/ui-react] <AppSparkline> left out ${e} value(s) in \`data\` that are not finite numbers.`))}var a=e=>typeof e==`number`&&Number.isFinite(e);function o(e,t,n){if(e.length<2)return`0,${n/2} ${t},${n/2}`;let r=Math.min(...e),i=Math.max(...e)-r,a=t/(e.length-1);return e.map((e,t)=>{let o=i===0?n/2:n-(e-r)/i*n;return`${t*a},${o}`}).join(` `)}var s=e=>String(Number(e.toFixed(2)));function c(e,t){let n=t?`${t} trend`:`Trend`;return e.length===1?`${n} has one value, ${s(e[0])}.`:`${n} from ${s(e[0])} to ${s(e[e.length-1])} across ${e.length} points.`}function l({data:n,label:r,width:s=48,height:l=16,className:u=``,...d}){e(`AppSparkline`,d);let f=Array.isArray(n)?n.filter(a):[];return Array.isArray(n)&&f.length<n.length&&i(n.length-f.length),f.length===0?null:t(`svg`,{className:`wui-sparkline${u?` ${u}`:``}`,width:s,height:l,viewBox:`0 0 ${s} ${l}`,role:`img`,"aria-label":c(f,r),...d,children:t(`polyline`,{points:o(f,s,l),stroke:`currentColor`,fill:`none`})})}export{l as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";import t from"./warnUnknownProps.js";import{jsx as n}from"react/jsx-runtime";var r=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}},i=!1;function a(t){i||!r()||(i=!0,e(`[@webority/ui-react] <AppSparkline> left out ${t} value(s) in \`data\` that are not finite numbers.`))}var o=e=>typeof e==`number`&&Number.isFinite(e);function s(e,t,n){if(e.length<2)return`0,${n/2} ${t},${n/2}`;let r=Math.min(...e),i=Math.max(...e)-r,a=t/(e.length-1);return e.map((e,t)=>{let o=i===0?n/2:n-(e-r)/i*n;return`${t*a},${o}`}).join(` `)}var c=e=>String(Number(e.toFixed(2)));function l(e,t){let n=t?`${t} trend`:`Trend`;return e.length===1?`${n} has one value, ${c(e[0])}.`:`${n} from ${c(e[0])} to ${c(e[e.length-1])} across ${e.length} points.`}function u({data:e,label:r,width:i=48,height:c=16,className:u=``,...d}){t(`AppSparkline`,d);let f=Array.isArray(e)?e.filter(o):[];return Array.isArray(e)&&f.length<e.length&&a(e.length-f.length),f.length===0?null:n(`svg`,{className:`wui-sparkline${u?` ${u}`:``}`,width:i,height:c,viewBox:`0 0 ${i} ${c}`,role:`img`,"aria-label":l(f,r),...d,children:n(`polyline`,{points:s(f,i,c),stroke:`currentColor`,fill:`none`})})}export{u as default};
@@ -1 +1 @@
1
- import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"./AppActionIcon.js";import r from"./AppSegmented.js";import{DEFAULT_THEME_EFFECT as i,DEFAULT_THEME_STORAGE_KEY as a,THEME_CHANGE_EVENT as o,THEME_EFFECTS as s,THEME_MODES as c,applyTheme as l,nextTheme as u,readStoredTheme as d,resolveTheme as f,storeTheme as p,transitionTheme as m,watchSystemTheme as h}from"@webority/ui-elements/helpers";import{useCallback as g,useEffect as _,useId as v,useState as y}from"react";import{jsx as b}from"react/jsx-runtime";import{flushSync as x}from"react-dom";var S={light:`sun`,dark:`moon`,auto:`refresh-cw`},C=[`icon`,`segmented`],w={sm:16,md:20,lg:24,xl:28};function T({variant:T=`icon`,effect:E=i,includeAuto:D=!0,storageKey:O=a,duration:k,label:A=`Theme`,lightLabel:j=`Light`,darkLabel:M=`Dark`,autoLabel:N=`System`,name:P,size:F=`md`,tooltipPlacement:I=`auto`,onChange:L,className:R=``,...z}){t(`AppThemeToggle`,z),e(`AppThemeToggle`,`variant`,T,C),e(`AppThemeToggle`,`effect`,E,s),e(`AppThemeToggle`,`size`,F,Object.keys(w));let B=g(e=>e===`auto`&&!D?f(e):e,[D]),[V,H]=y(()=>B(typeof window>`u`?`auto`:d(O))),U=v(),W=P||U;_(()=>{let e=document.documentElement.getAttribute(`data-theme`);c.includes(e)?H(B(e)):l(d(O))},[]),_(()=>{let e=e=>{let t=e.detail?.preference;c.includes(t)&&H(B(t))};return document.addEventListener(o,e),()=>document.removeEventListener(o,e)},[B]),_(()=>h(()=>{document.documentElement.getAttribute(`data-theme`)===`auto`&&l(`auto`)}),[]);let G=g((e,t)=>{let n=t?.getBoundingClientRect?.()??{left:0,top:0,width:0,height:0},r={x:n.left+n.width/2,y:n.top+n.height/2};m(()=>{l(e),p(e,O),x(()=>H(e)),L?.(e)},{effect:E,to:f(e),origin:r,duration:k})},[O,E,k,L]);if(T===`segmented`){let e=[{value:`light`,label:j,icon:S.light},{value:`dark`,label:M,icon:S.dark}];return D&&e.push({value:`auto`,label:N,icon:S.auto}),b(r,{options:e,value:V,name:W,label:A,size:F,className:[`wui-theme-toggle`,`wui-theme-toggle-segmented`,R].filter(Boolean).join(` `),onChange:e=>{if(e===V)return;let t=document.querySelector(`.segmented-input[name="${CSS.escape(W)}"][value="${e}"]`);G(e,t?.closest(`.segmented-option`)??t)}})}return b(n,{icon:S[V],label:`${A}: ${V}`,size:w[F]??w.md,tooltipPlacement:I,onClick:e=>G(u(V,{includeAuto:D}),e.currentTarget),className:[`wui-theme-toggle`,R].filter(Boolean).join(` `)})}export{T as default};
1
+ import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"./AppActionIcon.js";import r from"./AppSegmented.js";import{DEFAULT_THEME_EFFECT as i,DEFAULT_THEME_STORAGE_KEY as a,THEME_CHANGE_EVENT as o,THEME_EFFECTS as s,THEME_MODES as c,applyTheme as l,nextTheme as u,readStoredTheme as d,resolveTheme as f,storeTheme as p,transitionTheme as m,watchSystemTheme as h}from"@webority/ui-elements/helpers";import{useCallback as g,useEffect as _,useId as v,useState as y}from"react";import{jsx as b}from"react/jsx-runtime";import{flushSync as x}from"react-dom";var S={light:`sun`,dark:`moon`,auto:`monitor`},C={light:`light`,dark:`dark`,auto:`follows your device`},w=[`icon`,`segmented`],T={sm:16,md:20,lg:24,xl:28};function E({variant:E=`icon`,effect:D=i,includeAuto:O=!0,storageKey:k=a,duration:A,label:j=`Theme`,lightLabel:M=`Light`,darkLabel:N=`Dark`,autoLabel:P=`System`,name:F,size:I=`md`,tooltipPlacement:L=`auto`,onChange:R,className:z=``,...B}){t(`AppThemeToggle`,B),e(`AppThemeToggle`,`variant`,E,w),e(`AppThemeToggle`,`effect`,D,s),e(`AppThemeToggle`,`size`,I,Object.keys(T));let V=g(e=>e===`auto`&&!O?f(e):e,[O]),[H,U]=y(()=>V(typeof window>`u`?`auto`:d(k))),W=v(),G=F||W;_(()=>{let e=document.documentElement.getAttribute(`data-theme`);c.includes(e)?U(V(e)):l(d(k))},[]),_(()=>{let e=e=>{let t=e.detail?.preference;c.includes(t)&&U(V(t))};return document.addEventListener(o,e),()=>document.removeEventListener(o,e)},[V]),_(()=>h(()=>{document.documentElement.getAttribute(`data-theme`)===`auto`&&l(`auto`)}),[]);let K=g((e,t)=>{let n=t?.getBoundingClientRect?.()??{left:0,top:0,width:0,height:0},r={x:n.left+n.width/2,y:n.top+n.height/2};m(()=>{l(e),p(e,k),x(()=>U(e)),R?.(e)},{effect:D,to:f(e),origin:r,duration:A})},[k,D,A,R]);if(E===`segmented`){let e=[{value:`light`,label:M,icon:S.light},{value:`dark`,label:N,icon:S.dark}];return O&&e.push({value:`auto`,label:P,icon:S.auto}),b(r,{options:e,value:H,name:G,label:j,size:I,className:[`wui-theme-toggle`,`wui-theme-toggle-segmented`,z].filter(Boolean).join(` `),onChange:e=>{if(e===H)return;let t=document.querySelector(`.segmented-input[name="${CSS.escape(G)}"][value="${e}"]`);K(e,t?.closest(`.segmented-option`)??t)}})}return b(n,{icon:S[H],label:`${j}: ${C[H]}`,size:T[I]??T.md,tooltipPlacement:L,onClick:e=>K(u(H,{includeAuto:O}),e.currentTarget),className:[`wui-theme-toggle`,z].filter(Boolean).join(` `)})}export{E as default};
@@ -1 +1 @@
1
- import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"./AppIcon.js";import{jsx as r,jsxs as i}from"react/jsx-runtime";var a=[`feed`,`progress`],o=[`vertical`,`horizontal`],s=[`neutral`,`success`,`warning`,`danger`,`info`],c={done:`check`,current:`clock`,"on-hold":`lock`,rejected:`x`,cancelled:`minus`,skipped:`arrow-right`,upcoming:null},l=e=>typeof e==`string`&&(/^https?:[/][/]/i.test(e)||e.startsWith(`/`)&&e[1]!==`/`&&e[1]!==`\\`)&&![...e].some(e=>e.charCodeAt(0)<=32||e.charCodeAt(0)===127);function u(e){if(!(e.byHref==null||e.byHref===``)){if(!l(e.byHref))throw Error(`<AppTimeline> items[].byHref must be a path starting with one '/', or an http:// or https:// address, with no spaces.`);if(!e.by)throw Error(`<AppTimeline> items[].byHref links the by name, so the item needs by.`)}}var d=e=>e.byHref?r(`a`,{className:`timeline-by-link`,href:e.byHref,children:e.by}):e.by;function f({items:l=[],variant:f=`feed`,orientation:p=`vertical`,size:m,className:h=``,style:g,..._}){t(`AppTimeline`,_),e(`AppTimeline`,`variant`,f,a),e(`AppTimeline`,`orientation`,p,o);for(let t of l)e(`AppTimeline`,`items[].tone`,t.tone,s),u(t),f===`progress`&&e(`AppTimeline`,`items[].status`,t.status,Object.keys(c));let v=f===`progress`,y=`timeline${v?` timeline--progress`:``}${p===`horizontal`?` timeline--horizontal`:``}${h?` ${h}`:``}`,b=typeof m==`number`&&m>0?m:void 0,x=b?Math.round(b*.54):v?13:12;return r(`ol`,{className:y,style:b?{...g,"--wui-timeline-dot":`${b}px`}:g,..._,children:l.map((e,t)=>{let a=v?e.status:void 0,o=a?` is-${a}`:``,s=e.tone&&e.tone!==`neutral`?` ${e.tone}`:``,l=v?e.icon??(a?c[a]:void 0):e.icon||`circle`;return i(`li`,{className:`timeline-item${o}${s}`,children:[r(`span`,{className:`timeline-dot`,children:l?r(n,{name:l,size:x}):null}),i(`div`,{className:`timeline-body`,children:[v?i(`div`,{className:`timeline-head`,children:[r(`div`,{className:`timeline-title`,children:e.title}),(e.at||e.time)&&i(`span`,{className:`timeline-when`,children:[e.at&&r(`span`,{className:`timeline-at`,children:e.at}),e.time&&r(`span`,{className:`timeline-time`,children:e.time})]})]}):r(`div`,{className:`timeline-title`,children:e.title}),e.description&&r(`div`,{className:`timeline-desc`,children:e.description}),!v&&(e.at||e.time||e.by)&&i(`div`,{className:`timeline-meta`,children:[(e.at||e.time)&&i(`span`,{className:`timeline-when`,children:[e.at&&r(`span`,{className:`timeline-at`,children:e.at}),e.time&&r(`span`,{className:`timeline-time`,children:e.time})]}),e.by&&r(`span`,{className:`timeline-by`,children:d(e)})]}),v&&e.by&&r(`div`,{className:`timeline-meta`,children:r(`span`,{className:`timeline-by`,children:d(e)})}),e.note&&r(`p`,{className:`timeline-note`,children:e.note})]})]},e.key??`${e.at}-${t}`)})})}export{f as default};
1
+ import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"./AppIcon.js";import{jsx as r,jsxs as i}from"react/jsx-runtime";var a=[`feed`,`progress`],o=[`vertical`,`horizontal`],s=[`neutral`,`success`,`warning`,`danger`,`info`],c={done:`check`,current:`clock`,"on-hold":`lock`,rejected:`x`,cancelled:`minus`,skipped:`arrow-right`,upcoming:null},l=e=>typeof e==`string`&&(/^https?:[/][/]/i.test(e)||e.startsWith(`/`)&&e[1]!==`/`&&e[1]!==`\\`)&&![...e].some(e=>e.charCodeAt(0)<=32||e.charCodeAt(0)===127);function u(e){if(!(e.byHref==null||e.byHref===``)){if(!l(e.byHref))throw Error(`<AppTimeline> items[].byHref must be a path starting with one '/', or an http:// or https:// address, with no spaces.`);if(!e.by)throw Error(`<AppTimeline> items[].byHref links the by name, so the item needs by.`)}}var d=e=>e.byHref?r(`a`,{className:`timeline-by-link`,href:e.byHref,children:e.by}):e.by;function f({items:l=[],variant:f=`feed`,orientation:p=`vertical`,size:m,className:h=``,style:g,..._}){t(`AppTimeline`,_),e(`AppTimeline`,`variant`,f,a),e(`AppTimeline`,`orientation`,p,o);for(let t of l)e(`AppTimeline`,`items[].tone`,t.tone,s),u(t),f===`progress`&&e(`AppTimeline`,`items[].status`,t.status,Object.keys(c));let v=f===`progress`,y=`timeline${v?` timeline--progress`:``}${p===`horizontal`?` timeline--horizontal`:``}${h?` ${h}`:``}`,b=typeof m==`number`&&m>0?m:void 0,x=b?Math.round(b*.54):v?13:12;return r(`ol`,{className:y,style:b?{...g,"--wui-timeline-dot":`${b}px`}:g,..._,children:l.map((e,t)=>{let a=v?e.status:void 0,o=a?` is-${a}`:``,s=e.tone&&e.tone!==`neutral`?` ${e.tone}`:``,l=v?e.icon??(a?c[a]:void 0):e.icon||`circle`;return i(`li`,{className:`timeline-item${o}${s}`,children:[r(`span`,{className:`timeline-dot`,children:l?r(n,{name:l,size:x}):null}),i(`div`,{className:`timeline-body`,children:[v?i(`div`,{className:`timeline-head`,children:[r(`div`,{className:`timeline-title`,children:e.title}),(e.at||e.time)&&i(`span`,{className:`timeline-when`,children:[e.at&&r(`span`,{className:`timeline-at`,title:e.atTitle||void 0,children:e.at}),e.time&&r(`span`,{className:`timeline-time`,children:e.time})]})]}):r(`div`,{className:`timeline-title`,children:e.title}),e.description&&r(`div`,{className:`timeline-desc`,children:e.description}),!v&&(e.at||e.time||e.by)&&i(`div`,{className:`timeline-meta`,children:[(e.at||e.time)&&i(`span`,{className:`timeline-when`,children:[e.at&&r(`span`,{className:`timeline-at`,title:e.atTitle||void 0,children:e.at}),e.time&&r(`span`,{className:`timeline-time`,children:e.time})]}),e.by&&r(`span`,{className:`timeline-by`,children:d(e)})]}),v&&e.by&&r(`div`,{className:`timeline-meta`,children:r(`span`,{className:`timeline-by`,children:d(e)})}),e.note&&r(`p`,{className:`timeline-note`,children:e.note})]})]},e.key??`${e.at}-${t}`)})})}export{f as default};
@@ -1 +1 @@
1
- import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"./AppIcon.js";import{Children as r,forwardRef as i,useEffect as a,useRef as o}from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";import"@webority/ui-elements/elements/wizard";var l=[`steps`,`journey`,`icons`],u=[`primary`,`success`,`warning`,`danger`,`info`],d=[`horizontal`,`vertical`],f=[`done`,`active`,`pending`,`error`],p=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],m=[`check`,`alert-triangle`,`minus`],h=[`sm`,`md`,`lg`],g={sm:14,md:16,lg:20},_=i(function({steps:i=[],children:_,active:v,defaultActive:y=0,onStepChange:b,onFinish:x,onSkip:S,beforeNext:C,onInvalid:w,variant:T=`steps`,tone:E,doneTone:D,orientation:O=`horizontal`,iconVariant:k,size:A=`md`,iconSize:j,skippable:M=!1,nonLinear:N=!1,hideStepper:P=!1,hideConnectors:F=!1,disabled:I=!1,label:L=`Progress`,backLabel:R=`Back`,nextLabel:z=`Next`,skipLabel:B=`Skip`,finishLabel:V=`Finish`,className:H=``,...U},W){t(`AppWizard`,U),e(`AppWizard`,`variant`,T,l),e(`AppWizard`,`tone`,E,u),e(`AppWizard`,`doneTone`,D,u),e(`AppWizard`,`orientation`,O,d),e(`AppWizard`,`iconVariant`,k,p),e(`AppWizard`,`size`,A,h);let G=j>0?j:g[A]??g.md;for(let t of i)e(`AppWizard`,`steps[].status`,t.status,f);let K=o(null),q=e=>{K.current=e,typeof W==`function`?W(e):W&&(W.current=e)},J=r.toArray(_),Y=k&&k!==`linear`?[...new Set([...m,...i.map(e=>e.icon).filter(Boolean)])]:[],X=[E&&`wui-step-tone-${E}`,D&&`wui-step-done-tone-${D}`,A!==`md`&&h.includes(A)&&`wui-step-size-${A}`,H].filter(Boolean).join(` `);return a(()=>{let e=K.current;if(!e)return;let t=v===void 0?y:v;t&&(e.active=t)},[]),a(()=>{let e=K.current;e&&v!==void 0&&Number(e.active)!==v&&(e.active=v)},[v]),a(()=>{let e=K.current;e&&(e.beforeNext=C??null)},[C]),a(()=>{let e=K.current;if(!e)return;let t=e=>b?.(e.detail.index,e.detail),n=e=>x?.(e.detail),r=e=>S?.(e.detail.index),i=e=>w?.(e.detail.index);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.removeEventListener(`wui-wizard:change`,t),e.removeEventListener(`wui-wizard:finish`,n),e.removeEventListener(`wui-wizard:skip`,r),e.removeEventListener(`wui-wizard:invalid`,i)}},[b,x,S,w]),c(`wui-wizard`,{ref:q,variant:T,orientation:O,"icon-size":G===16?void 0:G,skippable:M?``:void 0,"non-linear":N?``:void 0,"hide-stepper":P?``:void 0,"hide-connectors":F?``:void 0,disabled:I?``:void 0,label:L,"back-label":R,"next-label":z,"skip-label":B,"finish-label":V,className:X||void 0,...U,children:[i.map((e,t)=>s(`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:J[t]},e.key??`${e.label}-${t}`)),Y.length>0&&s(`span`,{hidden:!0,"data-wui-glyphs":``,children:Y.map(e=>s(n,{name:e,size:G,variant:k},e))})]})});export{_ as default};
1
+ import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"./AppIcon.js";import{Children as r,forwardRef as i,useEffect as a,useRef as o}from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";import"@webority/ui-elements/elements/wizard";var l=[`steps`,`journey`,`icons`,`tiles`],u=[`primary`,`success`,`warning`,`danger`,`info`],d=[`horizontal`,`vertical`],f=[`done`,`active`,`pending`,`error`],p=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],m=[`check`,`alert-triangle`,`minus`],h=[`sm`,`md`,`lg`],g={sm:14,md:16,lg:20},_=i(function({steps:i=[],children:_,active:v,defaultActive:y=0,onStepChange:b,onFinish:x,onSkip:S,beforeNext:C,onInvalid:w,onClose:T,variant:E=`steps`,tone:D,doneTone:O,orientation:k=`horizontal`,iconVariant:A,size:j=`md`,iconSize:M,skippable:N=!1,nonLinear:P=!1,hideStepper:F=!1,hideConnectors:I=!1,disabled:L=!1,label:R=`Progress`,backLabel:z=`Back`,nextLabel:B=`Next`,skipLabel:V=`Skip`,finishLabel:H=`Finish`,topBar:U=!1,barTitle:W,closeLabel:G=`Close`,className:K=``,...q},J){t(`AppWizard`,q),e(`AppWizard`,`variant`,E,l),e(`AppWizard`,`tone`,D,u),e(`AppWizard`,`doneTone`,O,u),e(`AppWizard`,`orientation`,k,d),e(`AppWizard`,`iconVariant`,A,p),e(`AppWizard`,`size`,j,h);let Y=M>0?M:g[j]??g.md;for(let t of i)e(`AppWizard`,`steps[].status`,t.status,f);let X=o(null),Z=e=>{X.current=e,typeof J==`function`?J(e):J&&(J.current=e)},Q=r.toArray(_),$=A&&A!==`linear`?[...new Set([...m,...i.map(e=>e.icon).filter(Boolean)])]:[],ee=[D&&`wui-step-tone-${D}`,O&&`wui-step-done-tone-${O}`,j!==`md`&&h.includes(j)&&`wui-step-size-${j}`,K].filter(Boolean).join(` `);return a(()=>{let e=X.current;if(!e)return;let t=v===void 0?y:v;t&&(e.active=t)},[]),a(()=>{let e=X.current;e&&v!==void 0&&Number(e.active)!==v&&(e.active=v)},[v]),a(()=>{let e=X.current;e&&(e.beforeNext=C??null)},[C]),a(()=>{let e=X.current;if(!e)return;let t=e=>b?.(e.detail.index,e.detail),n=e=>x?.(e.detail),r=e=>S?.(e.detail.index),i=e=>w?.(e.detail.index),a=e=>T?.(e.detail);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)}},[b,x,S,w,T]),c(`wui-wizard`,{ref:Z,variant:E,orientation:k,"icon-size":Y===16?void 0:Y,skippable:N?``:void 0,"non-linear":P?``:void 0,"hide-stepper":F?``:void 0,"hide-connectors":I?``:void 0,disabled:L?``:void 0,label:R,"back-label":z,"next-label":B,"skip-label":V,"finish-label":H,"top-bar":U?``:void 0,"bar-title":W||void 0,"close-label":G,className:ee||void 0,...q,children:[i.map((e,t)=>s(`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:Q[t]},e.key??`${e.label}-${t}`)),$.length>0&&s(`span`,{hidden:!0,"data-wui-glyphs":``,children:$.map(e=>s(n,{name:e,size:Y,variant:A},e))})]})});export{_ as default};
@@ -1 +1 @@
1
- import{withTrustedLabel as e}from"@webority/ui-elements/helpers";import{createElement as t,useCallback as n,useRef as r}from"react";import{createPortal as i}from"react-dom";var a=e=>e?.label!=null&&typeof e.label==`object`;function o(o){let s=r(null),c=o.filter(a);c.length&&s.current===null&&(s.current=document.createElement(`div`));let l=n((t,n)=>{let r=0;return t.map(t=>{if(!a(t))return n(t,t?.label??t?.text??``);let i=s.current.children[r].innerHTML;return r+=1,e(n(t,i))})},[]);return{portal:c.length?i(c.map(e=>t(`span`,{key:String(e.value)},e.label)),s.current):null,toElementOptions:l}}export{o as default};
1
+ import e from"./AppIcon.js";import{withTrustedLabel as t}from"@webority/ui-elements/helpers";import{createElement as n,useCallback as r,useEffect as i,useRef as a,useState as o}from"react";import{createPortal as s}from"react-dom";var c=e=>e?.label!=null&&typeof e.label==`object`,l=e=>typeof e?.icon==`string`&&e.icon!==``,u=e=>c(e)||l(e);function d(t){let r=t.label??t.text??t.value;return l(t)?n(`span`,{className:`wui-opt-label`},n(e,{name:t.icon,size:16}),r):r}function f(e){let c=a(null),[f,p]=o(0),m=e.filter(u);m.length&&c.current===null&&(c.current=document.createElement(`div`));let h=c.current!==null;i(()=>{if(!h)return;let e=c.current.innerHTML,t=new MutationObserver(()=>{let t=c.current.innerHTML;t!==e&&(e=t,p(e=>e+1))});return t.observe(c.current,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),()=>t.disconnect()},[h]);let g=r((e,n)=>{let r=0;return e.map(e=>{if(!u(e))return n(e,e?.label??e?.text??``);let i=c.current.children[r].innerHTML;return r+=1,t(n(l(e)?{...e,icon:void 0}:e,i))})},[f]);return{portal:m.length?s(m.map(e=>n(`span`,{key:String(e.value)},d(e))),c.current):null,toElementOptions:g}}export{f as default};
@@ -1 +1 @@
1
- var e=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}},t=new Set;function n(n,r,i,a){if(!e()||i==null)return;let o=a instanceof Set?a:new Set(a);if(o.has(i))return;let s=`${n}.${r}.${String(i)}`;t.has(s)||(t.add(s),console.warn(`[@webority/ui-react] <${n}> received ${r}="${String(i)}", which is not one of ${[...o].map(e=>`"${e}"`).join(` | `)}. The component fell back to its default, so this renders something other than what the call site asks for — check the value against the component catalogue at https://ui-react.webority.dev.`))}export{n as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";var t=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}},n=new Set;function r(r,i,a,o){if(!t()||a==null)return;let s=o instanceof Set?o:new Set(o);if(s.has(a))return;let c=`${r}.${i}.${String(a)}`;n.has(c)||(n.add(c),e(`[@webority/ui-react] <${r}> received ${i}="${String(a)}", which is not one of ${[...s].map(e=>`"${e}"`).join(` | `)}. The component fell back to its default, so this renders something other than what the call site asks for — check the value against the component catalogue at https://ui-react.webority.dev.`))}export{r as default};
@@ -1 +1 @@
1
- var e=new Set(`id.title.role.style.className.class.tabIndex.lang.dir.hidden.slot.part.draggable.spellCheck.translate.inert.popover.name.type.value.defaultValue.checked.defaultChecked.placeholder.disabled.readOnly.required.autoFocus.autoComplete.form.formAction.formMethod.formNoValidate.formTarget.min.max.step.minLength.maxLength.pattern.multiple.accept.capture.rows.cols.wrap.list.htmlFor.inputMode.enterKeyHint.href.target.rel.download.ping.referrerPolicy.src.srcSet.alt.width.height.loading.decoding.sizes.crossOrigin.useMap.colSpan.rowSpan.headers.scope.span.key.ref.children.dangerouslySetInnerHTML.suppressHydrationWarning`.split(`.`)),t=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}},n=e=>e.startsWith(`data-`)||e.startsWith(`aria-`)||/^on[A-Z]/.test(e),r=new Set;function i(i,a){if(!(!t()||!a)&&!(`as`in a))for(let t of Object.keys(a)){if(n(t)||e.has(t))continue;let a=`${i}.${t}`;r.has(a)||(r.add(a),console.warn(`[@webority/ui-react] <${i}> received an unknown prop "${t}". It is not part of the component's API and is not a valid HTML attribute, so it will either be dropped or land on the DOM — check the prop name against the component catalogue at https://ui-react.webority.dev.`))}}export{i as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";var t=new Set(`id.title.role.style.className.class.tabIndex.lang.dir.hidden.slot.part.draggable.spellCheck.translate.inert.popover.name.type.value.defaultValue.checked.defaultChecked.placeholder.disabled.readOnly.required.autoFocus.autoComplete.form.formAction.formMethod.formNoValidate.formTarget.min.max.step.minLength.maxLength.pattern.multiple.accept.capture.rows.cols.wrap.list.htmlFor.inputMode.enterKeyHint.href.target.rel.download.ping.referrerPolicy.src.srcSet.alt.width.height.loading.decoding.sizes.crossOrigin.useMap.colSpan.rowSpan.headers.scope.span.key.ref.children.dangerouslySetInnerHTML.suppressHydrationWarning`.split(`.`)),n=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}},r=e=>e.startsWith(`data-`)||e.startsWith(`aria-`)||/^on[A-Z]/.test(e),i=new Set;function a(a,o){if(!(!n()||!o)&&!(`as`in o))for(let n of Object.keys(o)){if(r(n)||t.has(n))continue;let o=`${a}.${n}`;i.has(o)||(i.add(o),e(`[@webority/ui-react] <${a}> received an unknown prop "${n}". It is not part of the component's API and is not a valid HTML attribute, so it will either be dropped or land on the DOM — check the prop name against the component catalogue at https://ui-react.webority.dev.`))}}export{a as default};
@@ -0,0 +1 @@
1
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";function n({text:n,confirmRef:r,onDiscard:i,onKeep:a}){return t(`div`,{className:`wui-drawer-discard`,role:`alert`,children:[e(`span`,{className:`wui-drawer-discard-text`,children:n}),e(`button`,{type:`button`,className:`btn btn-danger btn-sm`,"data-wui-discard-confirm":``,ref:r,onClick:i,children:`Discard`}),e(`button`,{type:`button`,className:`btn btn-secondary btn-sm`,"data-wui-discard-keep":``,onClick:a,children:`Keep editing`})]})}export{n as default};
@@ -0,0 +1 @@
1
+ function e(e,...t){console.warn(e,...t)}export{e as devWarn};
@@ -20,6 +20,9 @@ import "@webority/ui-elements/elements/autocomplete";
20
20
  * A label may be a node (`<>CO<sub>2</sub></>`): it renders as static markup in the menu, the
21
21
  * input shows its text once chosen, and filtering and the option's accessible name use that
22
22
  * text. Remote results from `loadOptions` take string labels only.
23
+ * @param {string} [props.valueLabel] Text shown for `value` when `options` does not contain it, such as a
24
+ * selection loaded from the server. Omit it to keep the default: the field shows the value's option
25
+ * label, or nothing. Shown only while `value` is missing from the options.
23
26
  * @param {(query: string, opts?: { signal?: AbortSignal }) => Promise<{value: string, label: string}[]>} [props.loadOptions]
24
27
  * Remote loader; receives an AbortSignal for the superseded request (optional to use).
25
28
  * @param {string} [props.placeholder]
@@ -57,6 +57,9 @@
57
57
  * Razor: `active-row-key` against each row's `data-row-key`.
58
58
  * @param {boolean} [props.selectable=false] Render a leading checkbox column. Fires a bubbling `selectionchange` ({ selected, total, keys }) when the ticked count changes, as Razor does.
59
59
  * @param {Set<string|number>} [props.selectedIds] Currently selected row keys.
60
+ * @param {(row: object, index: number) => boolean} [props.isRowSelectable] A row it returns false for shows a disabled
61
+ * box and is skipped by select all, the selected count and bulk actions. With it, select all calls `onToggleRow`
62
+ * for each selectable row whose state changes, not `onToggleAll`. Unset, every row is selectable.
60
63
  * @param {(id: string|number) => void} [props.onToggleRow]
61
64
  * @param {(checked: boolean) => void} [props.onToggleAll] Toggle all current rows.
62
65
  * @param {(keys: Array<string|number>, checked: boolean) => void} [props.onSelectRange] Shift+click on a row
@@ -92,7 +95,7 @@
92
95
  * A sort or reorder of up to 200 rows glides each row to its new place; not under reduced motion, and not
93
96
  * on a `virtual` table.
94
97
  */
95
- export default function AppDataTable({ columns, rows, rowKey, sort, onSort, loading, skeletonRows, empty, emptyFiltered, sourceCount, rowActions, rowActionsLabel, pagination, ariaLabel, className, wrapperClassName, selectable, selectedIds, onToggleRow, onToggleAll, onSelectRange, renderExpanded, density, striped, flush, rowDrag, maxHeight, stickyFirstColumn, stickyActions, stackOnMobile, hiddenColumns, rowStatus, rowHref, onRowClick, activeRowKey, resizableColumns, viewKey, groupBy, groupLabel, virtual, rowSaving, rowSaveError, ...rest }: {
98
+ export default function AppDataTable({ columns, rows, rowKey, sort, onSort, loading, skeletonRows, empty, emptyFiltered, sourceCount, rowActions, rowActionsLabel, pagination, ariaLabel, className, wrapperClassName, selectable, selectedIds, isRowSelectable, onToggleRow, onToggleAll, onSelectRange, renderExpanded, density, striped, flush, rowDrag, maxHeight, stickyFirstColumn, stickyActions, stackOnMobile, hiddenColumns, rowStatus, rowHref, onRowClick, activeRowKey, resizableColumns, viewKey, groupBy, groupLabel, virtual, rowSaving, rowSaveError, ...rest }: {
96
99
  columns: object[];
97
100
  rows: object[];
98
101
  rowKey?: (row: object, index: number) => string | number;
@@ -127,6 +130,7 @@ export default function AppDataTable({ columns, rows, rowKey, sort, onSort, load
127
130
  activeRowKey?: string | number;
128
131
  selectable?: boolean;
129
132
  selectedIds?: Set<string | number>;
133
+ isRowSelectable?: (row: object, index: number) => boolean;
130
134
  onToggleRow?: (id: string | number) => void;
131
135
  onToggleAll?: (checked: boolean) => void;
132
136
  onSelectRange?: (keys: Array<string | number>, checked: boolean) => void;
@@ -12,7 +12,8 @@ import "@webority/ui-elements/elements/filter-popover";
12
12
  * selects and date ranges narrow; it wraps only when full, and each facet takes its own line on a phone.
13
13
  *
14
14
  * Only the first `inline` facets sit in the row. The rest go in a panel behind a "Filters (n)" button,
15
- * n counting the active ones among them (no number while none is active); their chips stay in the row.
15
+ * n counting the active ones among them (no number while none is active); a folded facet's chip stays in
16
+ * the row, and an inline facet's chip is hidden on a desktop, where its control already shows the value.
16
17
  * The panel is a `<details>` that closes on an outside click or Escape. On a phone every facet folds
17
18
  * into that one button and the panel becomes a sheet from the bottom edge. The button and Clear all
18
19
  * never wrap.
@@ -8,6 +8,8 @@
8
8
  * @param {import('react').ReactNode} [props.caption] A sub-line under the value (e.g. "Total sent").
9
9
  * @param {string|import('react').ReactNode} [props.icon] Icon name for the leading tile, or a custom node.
10
10
  * @param {'primary'|'success'|'warning'|'danger'|'info'|'neutral'} [props.iconTone] Tints the icon chip.
11
+ * @param {'linear'|'outline'|'bold'|'bulk'|'broken'|'twotone'} [props.iconVariant='linear'] The iconsax style of a
12
+ * named `icon`; a node icon is drawn as given.
11
13
  * @param {import('react').ReactNode} [props.delta] Change text, e.g. "12% vs last month".
12
14
  * @param {'up'|'down'|'flat'} [props.deltaDirection] Colours the delta and picks its arrow. Omitted →
13
15
  * inferred from a leading "+"/"-" on `delta` (falls back to 'flat').
@@ -17,11 +19,11 @@
17
19
  * @param {number[]} [props.sparkline] A trend series rendered as a small inline chart.
18
20
  * @param {'plain'|'filled'|'accent'|'spotlight'} [props.variant='plain'] The tile surface/layout:
19
21
  * plain (today's bordered card), filled (a subtle surface fill), accent (a brand-tinted fill),
20
- * spotlight (editorial feature tile — icon pinned top-right, serif value, caption below).
22
+ * spotlight (editorial feature tile — icon pinned top-right, large value, caption below).
21
23
  * @param {'sm'|'md'|'lg'} [props.size='md'] Tile scale: sm (compact), md (default), lg (a hero
22
24
  * tile with an enlarged value — for the single headline stat above a dashboard).
23
25
  * @param {number} [props.valueSize] Custom value ("main heading") font-size in px. Overrides the
24
- * size/variant default — use it to tame a too-large headline (e.g. the spotlight serif).
26
+ * size/variant default — use it to tame a too-large headline (e.g. the spotlight value).
25
27
  * @param {boolean} [props.inline=false] Put the icon beside the text instead of above it.
26
28
  * @param {boolean} [props.attention=false] Marks the tile as needing action (warning-tinted).
27
29
  * @param {string} [props.href] Renders the whole tile as a link to this URL.
@@ -36,12 +38,13 @@
36
38
  * @param {string} [props.deltaClassName] Extra class(es) on the delta.
37
39
  * @param {string} [props.sparklineClassName] Extra class(es) on the sparkline.
38
40
  */
39
- export default function AppKpiTile({ label, value, caption, icon, iconTone, delta, deltaDirection, deltaTone, sparkline, variant, size, valueSize, inline, attention, href, linkComponent: Link, className, style, iconClassName, labelClassName, valueClassName, captionClassName, deltaClassName, sparklineClassName, ...rest }: {
41
+ export default function AppKpiTile({ label, value, caption, icon, iconTone, iconVariant, delta, deltaDirection, deltaTone, sparkline, variant, size, valueSize, inline, attention, href, linkComponent: Link, className, style, iconClassName, labelClassName, valueClassName, captionClassName, deltaClassName, sparklineClassName, ...rest }: {
40
42
  label: string;
41
43
  value: import('react').ReactNode;
42
44
  caption?: import('react').ReactNode;
43
45
  icon?: string | import('react').ReactNode;
44
46
  iconTone?: 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'neutral';
47
+ iconVariant?: 'linear' | 'outline' | 'bold' | 'bulk' | 'broken' | 'twotone';
45
48
  delta?: import('react').ReactNode;
46
49
  deltaDirection?: 'up' | 'down' | 'flat';
47
50
  deltaTone?: 'success' | 'danger' | 'neutral';
@@ -18,6 +18,10 @@ export type NavItemShape = {
18
18
  * Tints the badge for an alert count.
19
19
  */
20
20
  badgeTone?: 'danger' | 'success' | 'warning';
21
+ /**
22
+ * The badge's hover text, e.g. 3 invoices overdue.
23
+ */
24
+ badgeTitle?: string;
21
25
  /**
22
26
  * A right-aligned secondary glyph (lock, external arrow, new dot).
23
27
  */
@@ -20,12 +20,13 @@
20
20
  * tone?: 'neutral'|'success'|'warning'|'danger'|'info',
21
21
  * status?: 'upcoming'|'current'|'done'|'on-hold'|'rejected'|'cancelled'|'skipped',
22
22
  * title: import('react').ReactNode, description?: import('react').ReactNode,
23
- * at?: string, time?: string, by?: string, byHref?: string, note?: string }[]} props.items
23
+ * at?: string, atTitle?: string, time?: string, by?: string, byHref?: string, note?: string }[]} props.items
24
24
  * Feed variant: newest first. Progress variant: first stage first.
25
25
  * `status` drives the dot + rail in the progress variant; `description` is a
26
26
  * plain inline subtext under the title (distinct from the boxed `note`).
27
27
  * `at` is the date and `time` an optional time-of-day shown beside it — both are
28
28
  * pre-formatted strings the caller owns (IST, DD-MMM-YYYY / HH:mm); pass either or both.
29
+ * `atTitle` is the full date and time shown on hover over `at`, such as `14 Oct 2026, 4:05 pm`; omit it for no tooltip.
29
30
  * `byHref` links the `by` name (a path starting with one `/`, or an `http://` / `https://` address);
30
31
  * any other value, or `byHref` without `by`, throws.
31
32
  * @param {'feed'|'progress'} [props.variant] Layout mode. Defaults to `feed`.
@@ -47,6 +48,7 @@ export default function AppTimeline({ items, variant, orientation, size, classNa
47
48
  title: import('react').ReactNode;
48
49
  description?: import('react').ReactNode;
49
50
  at?: string;
51
+ atTitle?: string;
50
52
  time?: string;
51
53
  by?: string;
52
54
  byHref?: string;
@@ -19,7 +19,7 @@ import "@webority/ui-elements/elements/wizard";
19
19
  * @param {(index: number) => void} [props.onSkip] Fired when an optional step is skipped.
20
20
  * @param {(index: number) => boolean | Promise<boolean>} [props.beforeNext] Validation gate run before advancing on Next and before Finish on the last step. Return false (or a rejecting promise) to block; the blocked step turns red.
21
21
  * @param {(index: number) => void} [props.onInvalid] Fired when advancing is blocked by beforeNext (the step is marked invalid).
22
- * @param {'steps'|'journey'|'icons'} [props.variant='steps'] Stepper header style — compact circles, the wide journey bar, or large connected icon badges with a "STEP n" eyebrow.
22
+ * @param {'steps'|'journey'|'icons'|'tiles'} [props.variant='steps'] Stepper header style — compact circles, the wide journey bar, large connected icon badges with a "STEP n" eyebrow, or a row of tiles (icon square, label and a Done / Current / To do line).
23
23
  * @param {'primary'|'success'|'warning'|'danger'|'info'} [props.tone] Recolour the whole stepper accent (active fill, done rail, ring, done tint) to a semantic ramp. Unset keeps the variant's default (primary for steps/journey, success/green for icons). For any other colour, override the `--wui-step-accent` / `--wui-step-soft` CSS variables via `style` or a `className` instead.
24
24
  * @param {'primary'|'success'|'warning'|'danger'|'info'} [props.doneTone] Recolour completed steps only (their badge, "STEP n" eyebrow and the filled line after them) to a semantic ramp; the current step keeps the `tone` accent. Unset, completed steps follow `tone`. For any other colour, override the `--wui-step-done-accent` / `--wui-step-done-soft` CSS variables via `style` or a `className` instead.
25
25
  * @param {'horizontal'|'vertical'} [props.orientation='horizontal']
@@ -37,6 +37,10 @@ import "@webority/ui-elements/elements/wizard";
37
37
  * @param {string} [props.nextLabel='Next']
38
38
  * @param {string} [props.skipLabel='Skip']
39
39
  * @param {string} [props.finishLabel='Finish']
40
+ * @param {boolean} [props.topBar=false] Show a 56px bar above the stepper with `barTitle`, "Step N of M" and a close button.
41
+ * @param {string} [props.barTitle] The title at the start of the top bar.
42
+ * @param {string} [props.closeLabel='Close'] Accessible name of the top bar's close button.
43
+ * @param {(detail: { index: number }) => void} [props.onClose] Fired when the top bar's close button is pressed. The wizard does not close itself.
40
44
  * @param {string} [props.className]
41
45
  */
42
46
  declare const AppWizard: import("react").ForwardRefExoticComponent<import("react").RefAttributes<any>>;
@@ -207,8 +207,7 @@ export declare const GLYPHS: {
207
207
  };
208
208
  export declare const iconNames: string[];
209
209
  /** The library's single icon SVG emitter — identical markup to Razor's IconMarkup.Render. */
210
- export declare function glyphSvg(name: any, { size, className, style }?: {
210
+ export declare function glyphSvg(name: any, { size, className }?: {
211
211
  className?: string;
212
212
  size?: number;
213
- style?: string;
214
213
  }): string;
@@ -1,5 +1,6 @@
1
1
  /**
2
- * Lets a select option carry a React node as its label (a subscript, a bold run, a badge).
2
+ * Lets a select option carry a React node as its label (a subscript, a bold run, a badge), and
3
+ * draws an option's `icon` through AppIcon.
3
4
  *
4
5
  * The shared select element renders its options from strings, so each node label is rendered
5
6
  * by React into a detached host through a portal, and the markup React produced is handed to
@@ -8,10 +9,15 @@
8
9
  * and as the selected value, and filters, typeahead-matches and names each option by its text,
9
10
  * so `LPZ 0<sub>B</sub>` is found by typing "0b" and read out as "LPZ 0B".
10
11
  *
11
- * The markup is static: handlers and state inside a label do not run in the menu, and it is
12
- * read again only when the `options` array changes.
12
+ * An option with an `icon` takes the same path. The element's own glyph table holds only the
13
+ * curated icons, so a catalogue icon outside it, or one a product registered, drew nothing.
14
+ * AppIcon resolves every name and loads a catalogue shard on demand; when a glyph arrives, the
15
+ * host changes, and `toElementOptions` changes identity so the wrapper writes the options again.
16
+ * The icon is removed from the option handed to the element, so it is never drawn twice.
13
17
  *
14
- * @param {Array<{ value: string, label?: import('react').ReactNode }>} options
18
+ * The markup is static: handlers and state inside a label do not run in the menu.
19
+ *
20
+ * @param {Array<{ value: string, label?: import('react').ReactNode, icon?: string }>} options
15
21
  * @returns {{
16
22
  * portal: import('react').ReactPortal | null,
17
23
  * toElementOptions: (options: object[], shape: (o: object, label: string) => object) => object[],
@@ -22,6 +28,7 @@
22
28
  export default function useNodeLabels(options: Array<{
23
29
  value: string;
24
30
  label?: import('react').ReactNode;
31
+ icon?: string;
25
32
  }>): {
26
33
  portal: import('react').ReactPortal | null;
27
34
  toElementOptions: (options: object[], shape: (o: object, label: string) => object) => object[];
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The "discard your changes?" row of a dirty modal or drawer footer. Internal: shared by AppModal
3
+ * and AppDrawer so the two cannot drift.
4
+ *
5
+ * @param {object} props
6
+ * @param {import("react").ReactNode} props.text The question, e.g. "Discard your changes?".
7
+ * @param {import("react").Ref<HTMLButtonElement>} props.confirmRef Focused when the prompt opens.
8
+ * @param {() => void} props.onDiscard
9
+ * @param {() => void} props.onKeep
10
+ */
11
+ export default function DiscardPrompt({ text, confirmRef, onDiscard, onKeep }: {
12
+ text: import("react").ReactNode;
13
+ confirmRef: import("react").Ref<HTMLButtonElement>;
14
+ onDiscard: () => void;
15
+ onKeep: () => void;
16
+ }): import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ export declare function devWarn(message: any, ...optionalParams: any[]): void;
2
+ export declare function devError(message: any, ...optionalParams: any[]): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webority/ui-react",
3
- "version": "0.76.0",
3
+ "version": "0.77.1",
4
4
  "description": "Webority shared React component library — App* primitives on react-bootstrap + the @webority/theme design system.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",
@@ -27,8 +27,8 @@
27
27
  },
28
28
  "sideEffects": false,
29
29
  "dependencies": {
30
- "@webority/theme": "0.76.0",
31
- "@webority/ui-elements": "0.76.0"
30
+ "@webority/theme": "0.77.1",
31
+ "@webority/ui-elements": "0.77.1"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "@webority/analytics": "^0.23.0",