@webority/ui-react 0.168.0 → 0.169.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 (64) hide show
  1. package/dist/canvas-kit/kit.js +216 -216
  2. package/dist/canvas-kit/manifest.json +3776 -2325
  3. package/dist/canvas-kit/release.json +6 -6
  4. package/dist/components/AppAvatar.js +1 -1
  5. package/dist/components/AppCommentThread.js +1 -1
  6. package/dist/components/AppDataTable.js +1 -1
  7. package/dist/components/AppEntryGrid.js +1 -1
  8. package/dist/components/AppGantt.js +1 -0
  9. package/dist/components/AppIdleTimeoutDialog.js +1 -0
  10. package/dist/components/AppInput.js +1 -1
  11. package/dist/components/AppLoadMore.js +1 -0
  12. package/dist/components/AppQueryBuilder.js +1 -0
  13. package/dist/components/AppSavedViews.js +1 -0
  14. package/dist/components/AppSearch.js +1 -1
  15. package/dist/components/AppShell.js +1 -1
  16. package/dist/components/AppTransferList.js +1 -0
  17. package/dist/components/AppTreePicker.js +1 -0
  18. package/dist/components/AppWorkspaceSwitcher.js +1 -1
  19. package/dist/guidance.json +204 -2
  20. package/dist/lib/queryBuilder/querySerialise.js +1 -0
  21. package/dist/lib/queryBuilder/queryTree.js +1 -0
  22. package/dist/lib/queryBuilder/queryTypes.js +1 -0
  23. package/dist/lib/queryBuilderView/QueryAppliedBar.js +1 -0
  24. package/dist/lib/queryBuilderView/QueryConditionRow.js +1 -0
  25. package/dist/lib/queryBuilderView/QueryGroupBox.js +1 -0
  26. package/dist/lib/queryBuilderView/QueryRulePanel.js +1 -0
  27. package/dist/lib/queryBuilderView/QueryValueInput.js +1 -0
  28. package/dist/lib/queryBuilderView/queryDisplay.js +1 -0
  29. package/dist/lib/transferList/transferKeys.js +1 -0
  30. package/dist/lib/transferList/transferState.js +1 -0
  31. package/dist/lib/transferListView/TransferPanel.js +1 -0
  32. package/dist/lib/transferListView/TransferRow.js +1 -0
  33. package/dist/types/components/AppChart.d.ts +3 -2
  34. package/dist/types/components/AppDataTable.d.ts +6 -0
  35. package/dist/types/components/AppEntryGrid.d.ts +3 -0
  36. package/dist/types/components/AppGantt.d.ts +75 -0
  37. package/dist/types/components/AppIdleTimeoutDialog.d.ts +43 -0
  38. package/dist/types/components/AppLoadMore.d.ts +47 -0
  39. package/dist/types/components/AppPopover.d.ts +2 -0
  40. package/dist/types/components/AppQueryBuilder.d.ts +37 -0
  41. package/dist/types/components/AppSavedViews.d.ts +21 -0
  42. package/dist/types/components/AppSearch.d.ts +6 -0
  43. package/dist/types/components/AppTransferList.d.ts +131 -0
  44. package/dist/types/components/AppTreePicker.d.ts +92 -0
  45. package/dist/types/components/AppTreeView.d.ts +4 -0
  46. package/dist/types/index.d.ts +13 -1
  47. package/dist/types/lib/queryBuilder/querySerialise.d.ts +31 -0
  48. package/dist/types/lib/queryBuilder/queryTree.d.ts +37 -0
  49. package/dist/types/lib/queryBuilder/queryTypes.d.ts +57 -0
  50. package/dist/types/lib/queryBuilderView/QueryAppliedBar.d.ts +24 -0
  51. package/dist/types/lib/queryBuilderView/QueryConditionRow.d.ts +16 -0
  52. package/dist/types/lib/queryBuilderView/QueryGroupBox.d.ts +27 -0
  53. package/dist/types/lib/queryBuilderView/QueryRulePanel.d.ts +18 -0
  54. package/dist/types/lib/queryBuilderView/QueryValueInput.d.ts +15 -0
  55. package/dist/types/lib/queryBuilderView/queryDisplay.d.ts +29 -0
  56. package/dist/types/lib/transferList/transferKeys.d.ts +44 -0
  57. package/dist/types/lib/transferList/transferState.d.ts +24 -0
  58. package/dist/types/lib/transferListView/TransferPanel.d.ts +33 -0
  59. package/dist/types/lib/transferListView/TransferRow.d.ts +10 -0
  60. package/dist/ui-react.js +1 -1
  61. package/dist/web-core/dist/errors/extractApiError.js +2 -2
  62. package/package.json +9 -9
  63. package/dist/lib/initials.js +0 -1
  64. package/dist/types/lib/initials.d.ts +0 -5
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "name": "webority-web",
3
- "version": "0.168.0",
3
+ "version": "0.169.1",
4
4
  "platform": "Web",
5
5
  "kitModuleVersion": 2,
6
6
  "rendererProtocolVersion": 14,
7
7
  "library": {
8
8
  "name": "@webority/ui-react",
9
- "version": "0.168.0"
9
+ "version": "0.169.1"
10
10
  },
11
11
  "files": {
12
12
  "manifest.json": {
13
- "sha256": "fc151613ca8315e4ad151378292e8ab9957a9f7b8e436352151c6504cffecf98",
14
- "bytes": 1050487
13
+ "sha256": "25c0022ea5fb52d8242757a1131524361bb2a96f546d6742ac9c25f3c9883ad4",
14
+ "bytes": 1100752
15
15
  },
16
16
  "kit.js": {
17
- "sha256": "f1da7c81e64ecb488ebf9505ca25e51cbc30610e1c74de740d1f24cf948f15df",
18
- "bytes": 9909904
17
+ "sha256": "8904f9a9cd07a9666e24ebcf6a57e743c8aaf00ffa2dd74504b5927b3774049a",
18
+ "bytes": 10053246
19
19
  },
20
20
  "kit.css": {
21
21
  "sha256": "13b14f71fb6ea024945f95cba617b4f1d49f44a65ba7c7ed05d2354805539ef6",
@@ -1 +1 @@
1
- import{initialsOf as e}from"../lib/initials.js";import{linkTarget as t}from"../lib/linkTarget.js";import{TargetLink as n}from"../lib/TargetLink.js";import r from"../lib/useWuiText.js";import{TONES as i}from"../lib/vocabulary.js";import{splitMarkerProps as a}from"../lib/wuiMarker.js";import o from"./assertValidValue.js";import s from"./renderIconProp.js";import c from"./warnUnknownProps.js";import l from"./withTooltip.js";import{useState as u}from"react";import{Fragment as d,jsx as f,jsxs as p}from"react/jsx-runtime";import{AVATAR_TEXT as m}from"@webority/ui-elements/text";var ee=[`circle`,`rounded`,`square`],h=[...i,`auto`],g=[`none`,`online`,`offline`,`away`,`busy`],_=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],te=/* @__PURE__ */ new Set([`xs`,`sm`,`md`,`lg`,`xl`,`2xl`]),v={xs:20,sm:24,md:32,lg:48,xl:64,"2xl":96};function ne(t){return e(t)||`?`}function re(e){let t=e||``,n=0;for(let e=0;e<t.length;e+=1)n=Math.imul(n,31)+t.charCodeAt(e)>>>0;return n%360}function y(e){if(typeof e==`number`)return e;let t=v[e];if(t!=null)return t;let n=Number.parseInt(e,10);return Number.isNaN(n)?32:n}function b(e){let{marker:i,props:v}=a(`AppAvatar`,e),b=r(`avatar`,m),{name:x,src:S,size:C=`md`,shape:w=`circle`,tone:T=`primary`,status:E=`none`,ring:D=!1,label:O,icon:k,iconVariant:A,badge:j,href:M,onClick:N,linkComponent:P,tooltip:F,tooltipPlacement:I,className:L=``,photoLabel:R=b.photoLabel,...z}=v;c(`AppAvatar`,z),o(`AppAvatar`,`shape`,w,ee),o(`AppAvatar`,`tone`,T,h),o(`AppAvatar`,`status`,E,g),o(`AppAvatar`,`iconVariant`,A,_);let{style:B,...V}=z,[H,U]=u(null),W=H!=null&&H===S,G=typeof C==`string`&&te.has(C),K=G?null:typeof C==`number`||/^\d+$/.test(C)?`${C}px`:C,q=M!=null||N!=null,J=S!=null&&S!==``&&!W,Y=[`avatar`,G&&C!==`md`?`avatar-${C}`:``,w===`circle`?``:`avatar-${w}`,T===`primary`?``:`avatar-${T}`,D?`avatar-ring`:``,q?`avatar-clickable`:``,L].filter(Boolean).join(` `),X={};K&&(X[`--avatar-size`]=K),T===`auto`&&(X[`--avatar-hue`]=re(x));let Z=Object.keys(X).length||B?{...X,...B}:void 0,ie=/* @__PURE__ */ f(`span`,{className:`avatar-face`,"aria-hidden":`true`,children:k!=null&&k!==!1&&k!==``?s(k,{size:Math.round(y(C)*.55),variant:A}):ne(x)}),ae=/* @__PURE__ */ p(d,{children:[E!==`none`&&/* @__PURE__ */ f(`span`,{className:`avatar-status avatar-status-${E}`,"aria-hidden":`true`}),j!=null&&/* @__PURE__ */ f(`span`,{className:`avatar-badge`,children:j}),O!=null&&/* @__PURE__ */ f(`span`,{className:`avatar-label`,"aria-hidden":`true`,children:O})]}),Q=/* @__PURE__ */ p(d,{children:[ie,J&&/* @__PURE__ */ f(`img`,{className:`avatar-img`,src:S,alt:q?``:x||R,onError:()=>U(S)}),ae]});if(M!=null){let e=t(P,{href:M});return l(/* @__PURE__ */ f(n,{link:e,className:Y,style:Z,...i,...V,"aria-label":O||x,onClick:N,children:Q}),F,I)}if(N!=null)return l(/* @__PURE__ */ f(`button`,{type:`button`,className:Y,style:Z,...i,...V,"aria-label":O||x,onClick:N,children:Q}),F,I);if(J)return l(/* @__PURE__ */ f(`span`,{className:Y,style:Z,...i,...V,children:Q}),F,I);let $=O?.trim()||x?.trim();return l($?/* @__PURE__ */ f(`span`,{className:Y,style:Z,...i,...V,role:`img`,"aria-label":$,children:Q}):/* @__PURE__ */ f(`span`,{className:Y,style:Z,...i,...V,"aria-hidden":`true`,children:Q}),F,I)}export{b as default};
1
+ import{linkTarget as e}from"../lib/linkTarget.js";import{TargetLink as t}from"../lib/TargetLink.js";import n from"../lib/useWuiText.js";import{TONES as r}from"../lib/vocabulary.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./assertValidValue.js";import o from"./renderIconProp.js";import s from"./warnUnknownProps.js";import c from"./withTooltip.js";import{initialsOf as l}from"@webority/ui-elements/helpers";import{useState as u}from"react";import{Fragment as d,jsx as f,jsxs as p}from"react/jsx-runtime";import{AVATAR_TEXT as m}from"@webority/ui-elements/text";var ee=[`circle`,`rounded`,`square`],te=[...r,`auto`],h=[`none`,`online`,`offline`,`away`,`busy`],g=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],ne=/* @__PURE__ */ new Set([`xs`,`sm`,`md`,`lg`,`xl`,`2xl`]),_={xs:20,sm:24,md:32,lg:48,xl:64,"2xl":96};function re(e){return l(e)||`?`}function v(e){let t=e||``,n=0;for(let e=0;e<t.length;e+=1)n=Math.imul(n,31)+t.charCodeAt(e)>>>0;return n%360}function y(e){if(typeof e==`number`)return e;let t=_[e];if(t!=null)return t;let n=Number.parseInt(e,10);return Number.isNaN(n)?32:n}function b(r){let{marker:l,props:_}=i(`AppAvatar`,r),b=n(`avatar`,m),{name:x,src:S,size:C=`md`,shape:w=`circle`,tone:T=`primary`,status:E=`none`,ring:D=!1,label:O,icon:k,iconVariant:A,badge:j,href:M,onClick:N,linkComponent:P,tooltip:F,tooltipPlacement:I,className:L=``,photoLabel:R=b.photoLabel,...z}=_;s(`AppAvatar`,z),a(`AppAvatar`,`shape`,w,ee),a(`AppAvatar`,`tone`,T,te),a(`AppAvatar`,`status`,E,h),a(`AppAvatar`,`iconVariant`,A,g);let{style:B,...V}=z,[H,U]=u(null),W=H!=null&&H===S,G=typeof C==`string`&&ne.has(C),K=G?null:typeof C==`number`||/^\d+$/.test(C)?`${C}px`:C,q=M!=null||N!=null,J=S!=null&&S!==``&&!W,Y=[`avatar`,G&&C!==`md`?`avatar-${C}`:``,w===`circle`?``:`avatar-${w}`,T===`primary`?``:`avatar-${T}`,D?`avatar-ring`:``,q?`avatar-clickable`:``,L].filter(Boolean).join(` `),X={};K&&(X[`--avatar-size`]=K),T===`auto`&&(X[`--avatar-hue`]=v(x));let Z=Object.keys(X).length||B?{...X,...B}:void 0,ie=/* @__PURE__ */ f(`span`,{className:`avatar-face`,"aria-hidden":`true`,children:k!=null&&k!==!1&&k!==``?o(k,{size:Math.round(y(C)*.55),variant:A}):re(x)}),ae=/* @__PURE__ */ p(d,{children:[E!==`none`&&/* @__PURE__ */ f(`span`,{className:`avatar-status avatar-status-${E}`,"aria-hidden":`true`}),j!=null&&/* @__PURE__ */ f(`span`,{className:`avatar-badge`,children:j}),O!=null&&/* @__PURE__ */ f(`span`,{className:`avatar-label`,"aria-hidden":`true`,children:O})]}),Q=/* @__PURE__ */ p(d,{children:[ie,J&&/* @__PURE__ */ f(`img`,{className:`avatar-img`,src:S,alt:q?``:x||R,onError:()=>U(S)}),ae]});if(M!=null){let n=e(P,{href:M});return c(/* @__PURE__ */ f(t,{link:n,className:Y,style:Z,...l,...V,"aria-label":O||x,onClick:N,children:Q}),F,I)}if(N!=null)return c(/* @__PURE__ */ f(`button`,{type:`button`,className:Y,style:Z,...l,...V,"aria-label":O||x,onClick:N,children:Q}),F,I);if(J)return c(/* @__PURE__ */ f(`span`,{className:Y,style:Z,...l,...V,children:Q}),F,I);let $=O?.trim()||x?.trim();return c($?/* @__PURE__ */ f(`span`,{className:Y,style:Z,...l,...V,role:`img`,"aria-label":$,children:Q}):/* @__PURE__ */ f(`span`,{className:Y,style:Z,...l,...V,"aria-hidden":`true`,children:Q}),F,I)}export{b as default};
@@ -1 +1 @@
1
- import{initialsOf as e}from"../lib/initials.js";import{linkTarget as t}from"../lib/linkTarget.js";import{TargetLink as n}from"../lib/TargetLink.js";import r from"../lib/useElementEntry.js";import i from"../lib/useWuiText.js";import{splitMarkerProps as a}from"../lib/wuiMarker.js";import o from"./AppAvatar.js";import s from"./AppBadge.js";import c from"./AppButton.js";import l from"./AppIcon.js";import u from"./AppMarkdown.js";import d from"./assertValidValue.js";import f from"./warnUnknownProps.js";import{COMMENT_REACTIONS as p,formatDate as m,formatFileSize as h,formatNumber as g,mentionTextFromValue as _,parseMentionValue as v,toInstant as y}from"@webority/ui-elements/helpers";import{Fragment as b,useEffect as x,useId as S,useRef as C}from"react";import{jsx as w,jsxs as T}from"react/jsx-runtime";import{COMMENT_THREAD_TEXT as E,fillText as D}from"@webority/ui-elements/text";var O=[`stacked`,`inline`],k=[`list`,`conversation`],A=()=>import(`@webority/ui-elements/elements/comment-thread`),j=()=>import(`@webority/ui-elements/elements/mention-input`),M=e=>v(e??``).map((e,t)=>({key:`segment-${t}`,seg:e})),N=e=>e.localName===`wui-mention-input`;function P(e){let{marker:t,props:n}=a(`AppCommentThread`,e),s=i(`commentThread`,E),{comments:l=[],onPost:u,onReply:m,onEdit:h,onDelete:g,onReact:_,people:v,loadPeople:y,reactionChoices:b,allowReplies:D=!0,allowReactions:M=!0,composerPlaceholder:P,variant:I=`list`,composer:L=`stacked`,author:R,postLabel:z=s.postLabel,composerRows:B,readOnly:V=!1,markdown:H=!1,linkComponent:U,label:W=s.label,internalLabel:G=s.internalLabel,attachmentsLabel:K=s.attachmentsLabel,composerLabel:ee=s.composerLabel,noCommentsText:te=s.noCommentsText,reactionsLabel:ne=s.reactionsLabel,repliesToLabel:re=s.repliesToLabel,editedLabel:ie=s.editedLabel,deletedText:ae=s.deletedText,replyLabel:oe=s.replyLabel,editLabel:se=s.editLabel,deleteLabel:ce=s.deleteLabel,deleteConfirmText:le=s.deleteConfirmText,cancelLabel:ue=s.cancelLabel,addReactionLabel:de=s.addReactionLabel,chooseReactionLabel:fe=s.chooseReactionLabel,peopleLabel:pe=s.peopleLabel,id:me,className:he=``,...q}=n;f(`AppCommentThread`,q),d(`AppCommentThread`,`variant`,I,k),d(`AppCommentThread`,`composer`,L,O);let J=r(`wui-comment-thread`,A);r(`wui-mention-input`,j);let ge=S(),Y=me||`comment-thread-${ge.replace(/[^a-zA-Z0-9_-]/g,``)}`,X=C(null),Z=typeof y==`function`,_e=b?.length?b:p,Q=L===`inline`,ve=B??(Q?1:3),ye={reactionsLabel:ne,repliesToLabel:re,editedLabel:ie,deletedText:ae,replyLabel:oe,editLabel:se,deleteLabel:ce,deleteConfirmText:le,cancelLabel:ue,addReactionLabel:de},$=C({onPost:u,onReply:m,onEdit:h,onDelete:g,onReact:_,loadPeople:y});return $.current={onPost:u,onReply:m,onEdit:h,onDelete:g,onReact:_,loadPeople:y},x(()=>{let e=X.current;if(e&&J)return e.submit=async e=>{let t=$.current;e.intent===`post`?await t.onPost?.(e.body):e.intent===`reply`?await t.onReply?.(e.parentId,e.body):e.intent===`edit`?await t.onEdit?.(e.commentId,e.body):e.intent===`delete`?await t.onDelete?.(e.commentId):e.intent===`react`&&await t.onReact?.(e.commentId,e.emoji)},()=>{e.submit=void 0}},[J]),x(()=>{let e=X.current;e&&J&&!Z&&(e.people=v||[])},[v,Z,J]),x(()=>{let e=X.current;if(!e||!Z)return;let t=/* @__PURE__ */ new WeakMap,n=async e=>{let n=e.target;if(!(e instanceof CustomEvent)||!(n instanceof HTMLElement)||!N(n))throw TypeError(`<wui-comment-thread> search came from something other than a mention box.`);let r=e.detail;if(typeof r!=`object`||!r||!(`query`in r)||typeof r.query!=`string`)throw TypeError(`<wui-comment-thread> search carried no query.`);let i=r.query,{loadPeople:a}=$.current;if(typeof a!=`function`)throw Error(`<AppCommentThread> is remote but has no loadPeople.`);let o=(t.get(n)??0)+1;t.set(n,o),n.loading=!0;try{let e=await a(i);t.get(n)===o&&(n.people=e||[])}catch(e){t.get(n)===o&&(n.people=[],n.searchFailed=!0,reportError(e))}finally{t.get(n)===o&&(n.loading=!1)}};return e.addEventListener(`search`,n),()=>e.removeEventListener(`search`,n)},[Z]),/* @__PURE__ */ T(`wui-comment-thread`,{ref:X,id:Y,class:[`wui-comment-thread`,I===`conversation`&&`wui-comment-thread--conversation`,he].filter(Boolean).join(` `),controlled:``,"read-only":V?``:void 0,remote:Z?``:void 0,"reaction-choices":b?.length?b.join(` `):void 0,"no-replies":D?void 0:``,"no-reactions":M?void 0:``,"composer-placeholder":P,...t,...q,children:[/* @__PURE__ */ w(`div`,{className:`wui-comment-items`,"data-wui-items":``,children:l.length?/* @__PURE__ */ w(`ol`,{className:`wui-comment-list`,"aria-label":W,children:l.map(e=>/* @__PURE__ */ w(F,{comment:e,topLevel:!0,readOnly:V,allowReplies:D,allowReactions:M,markdown:H,linkComponent:U,internalLabel:G,attachmentsLabel:K,text:ye},e.id))}):/* @__PURE__ */ w(`p`,{className:`wui-comment-empty`,children:te})}),!V&&M&&/* @__PURE__ */ w(`div`,{className:`wui-reaction-picker`,role:`group`,"aria-label":fe,"data-wui-picker":``,popover:`auto`,children:_e.map(e=>/* @__PURE__ */ w(`button`,{type:`button`,className:`wui-reaction-choice`,"data-wui-emoji":e,children:e},e))}),!V&&/* @__PURE__ */ T(`div`,{className:Q?`wui-comment-composer wui-comment-composer-inline`:`wui-comment-composer`,"data-wui-composer":``,children:[Q&&R?/* @__PURE__ */ w(o,{name:R,size:`sm`,tone:`auto`,className:`wui-comment-composer-avatar`}):null,/* @__PURE__ */ w(`wui-mention-input`,{id:`${Y}-new`,class:`wui-mention-input`,label:ee,"people-label":pe,placeholder:P??s.composerPlaceholder,rows:String(ve),remote:Z?``:void 0}),/* @__PURE__ */ w(`div`,{className:`wui-comment-form-actions`,children:/* @__PURE__ */ w(c,{variant:Q?`outline`:`solid`,size:`sm`,"data-wui-action":`post`,children:z})}),/* @__PURE__ */ w(`div`,{className:`wui-comment-error`,"data-wui-error":``,hidden:!0})]}),/* @__PURE__ */ w(`span`,{className:`visually-hidden`,"data-wui-live":``,"aria-live":`polite`,"aria-atomic":`true`})]})}function F({comment:r,topLevel:i=!1,readOnly:a,allowReplies:o,allowReactions:d,markdown:f,linkComponent:p,internalLabel:v,attachmentsLabel:x,text:S}){let{id:C,author:E,at:O,value:k,edited:A,mine:j,internal:N,attachments:P=[],deleted:I,canEdit:L,canDelete:R,reactions:z=[],replies:B=[]}=r,V=E?.name||``,H=y(O),U=!a&&!I&&L,W=!a&&!I&&R,G=i&&o,K=[`wui-comment`,N&&`wui-comment--internal`,j&&`wui-comment--mine`].filter(Boolean).join(` `);return/* @__PURE__ */ T(`li`,{className:K,"data-wui-comment":C,"data-value":k??``,"data-wui-deleted":I?``:void 0,children:[/* @__PURE__ */ T(`div`,{className:`wui-comment-row`,children:[/* @__PURE__ */ T(`span`,{className:`avatar avatar-sm wui-comment-avatar`,"aria-hidden":`true`,children:[/* @__PURE__ */ w(`span`,{className:`avatar-face`,children:e(V)||`?`}),E?.src&&/* @__PURE__ */ w(`img`,{className:`avatar-img`,src:E.src,alt:``,onError:e=>{e.currentTarget.hidden=!0}})]}),/* @__PURE__ */ T(`div`,{className:`wui-comment-main`,children:[/* @__PURE__ */ T(`div`,{className:`wui-comment-head`,children:[/* @__PURE__ */ w(`span`,{className:`wui-comment-author`,children:V}),/* @__PURE__ */ w(`time`,{className:`wui-comment-time`,dateTime:Number.isFinite(H)?new Date(H).toISOString():void 0,children:m(O,{pattern:`datetime`})}),A&&!I&&/* @__PURE__ */ w(`span`,{className:`wui-comment-edited`,children:S.editedLabel}),N&&/* @__PURE__ */ w(s,{className:`wui-comment-internal-badge`,children:v})]}),I?/* @__PURE__ */ w(`div`,{className:`wui-comment-text wui-comment-text-deleted`,children:S.deletedText}):/* @__PURE__ */ w(`div`,{className:f?`wui-comment-text wui-comment-text--markdown`:`wui-comment-text`,"data-wui-text":``,children:f?/* @__PURE__ */ w(u,{value:_(k??``).text,headings:`text`}):M(k).map(({key:e,seg:t})=>`text`in t?/* @__PURE__ */ w(b,{children:t.text},e):/* @__PURE__ */ T(`span`,{className:`wui-mention`,"data-mention-id":t.id,children:[`@`,t.label]},e))}),!I&&P.length>0&&/* @__PURE__ */ w(`ul`,{className:`wui-comment-attachments`,"aria-label":x,children:P.map(e=>{let r=t(p,{to:e.to,href:e.href,routeHref:!1});return/* @__PURE__ */ T(`li`,{children:[/* @__PURE__ */ T(n,{link:r,className:`wui-comment-attachment`,...e.to?{}:{download:!0},children:[/* @__PURE__ */ w(l,{name:`paperclip`,size:14}),e.name]}),typeof e.sizeBytes==`number`&&/* @__PURE__ */ w(`span`,{className:`wui-comment-attachment-size`,children:h(e.sizeBytes)})]},e.to??e.href)})}),U&&/* @__PURE__ */ w(`div`,{className:`wui-comment-editor`,"data-wui-editor":``,hidden:!0}),d&&!I&&(z.length>0||!a)&&/* @__PURE__ */ T(`div`,{className:`wui-comment-reactions`,role:`group`,"aria-label":S.reactionsLabel,children:[z.map(e=>a?/* @__PURE__ */ T(`span`,{className:e.mine?`wui-reaction wui-reaction-mine`:`wui-reaction`,children:[/* @__PURE__ */ w(`span`,{className:`wui-reaction-emoji`,children:e.emoji}),/* @__PURE__ */ w(`span`,{className:`wui-reaction-count`,children:g(e.count,{decimals:0})})]},e.emoji):/* @__PURE__ */ T(`button`,{type:`button`,className:e.mine?`wui-reaction wui-reaction-mine`:`wui-reaction`,"data-wui-emoji":e.emoji,"aria-pressed":e.mine?`true`:`false`,children:[/* @__PURE__ */ w(`span`,{className:`wui-reaction-emoji`,children:e.emoji}),/* @__PURE__ */ w(`span`,{className:`wui-reaction-count`,children:g(e.count,{decimals:0})})]},e.emoji)),!a&&/* @__PURE__ */ w(`button`,{type:`button`,className:`wui-reaction-add`,"data-wui-action":`react-menu`,"aria-label":S.addReactionLabel,"aria-haspopup":`true`,"aria-expanded":`false`,children:/* @__PURE__ */ w(l,{name:`emoji-smile`,size:16})})]}),!a&&!I&&(G||U||W)&&/* @__PURE__ */ T(`div`,{className:`wui-comment-actions`,"data-wui-actions":``,children:[G&&/* @__PURE__ */ w(`button`,{type:`button`,className:`wui-comment-action`,"data-wui-action":`reply`,children:S.replyLabel}),U&&/* @__PURE__ */ w(`button`,{type:`button`,className:`wui-comment-action`,"data-wui-action":`edit`,children:S.editLabel}),W&&/* @__PURE__ */ w(`button`,{type:`button`,className:`wui-comment-action`,"data-wui-action":`delete`,children:S.deleteLabel})]}),W&&/* @__PURE__ */ T(`div`,{className:`wui-comment-confirm`,"data-wui-confirm":``,hidden:!0,children:[/* @__PURE__ */ w(`span`,{className:`wui-comment-confirm-text`,children:S.deleteConfirmText}),/* @__PURE__ */ w(c,{tone:`danger`,size:`sm`,"data-wui-action":`confirm-delete`,children:S.deleteLabel}),/* @__PURE__ */ w(c,{variant:`ghost`,size:`sm`,"data-wui-action":`cancel-delete`,children:S.cancelLabel})]}),!a&&/* @__PURE__ */ w(`div`,{className:`wui-comment-error`,"data-wui-error":``,hidden:!0})]})]}),i&&B.length>0&&/* @__PURE__ */ w(`ol`,{className:`wui-comment-list wui-comment-replies`,"aria-label":D(S.repliesToLabel,{name:V}),children:B.map(e=>/* @__PURE__ */ w(F,{comment:e,readOnly:a,allowReactions:d,markdown:f,linkComponent:p,internalLabel:v,attachmentsLabel:x,text:S},e.id))}),G&&!a&&!I&&/* @__PURE__ */ w(`div`,{className:`wui-comment-reply`,"data-wui-reply":``,hidden:!0})]})}export{P as default};
1
+ import{linkTarget as e}from"../lib/linkTarget.js";import{TargetLink as t}from"../lib/TargetLink.js";import n from"../lib/useElementEntry.js";import r from"../lib/useWuiText.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./AppAvatar.js";import o from"./AppBadge.js";import s from"./AppButton.js";import c from"./AppIcon.js";import l from"./AppMarkdown.js";import u from"./assertValidValue.js";import d from"./warnUnknownProps.js";import{COMMENT_REACTIONS as f,formatDate as p,formatFileSize as m,formatNumber as h,initialsOf as g,mentionTextFromValue as _,parseMentionValue as v,toInstant as y}from"@webority/ui-elements/helpers";import{Fragment as b,useEffect as x,useId as S,useRef as C}from"react";import{jsx as w,jsxs as T}from"react/jsx-runtime";import{COMMENT_THREAD_TEXT as E,fillText as D}from"@webority/ui-elements/text";var O=[`stacked`,`inline`],k=[`list`,`conversation`],A=()=>import(`@webority/ui-elements/elements/comment-thread`),j=()=>import(`@webority/ui-elements/elements/mention-input`),M=e=>v(e??``).map((e,t)=>({key:`segment-${t}`,seg:e})),N=e=>e.localName===`wui-mention-input`;function P(e){let{marker:t,props:o}=i(`AppCommentThread`,e),c=r(`commentThread`,E),{comments:l=[],onPost:p,onReply:m,onEdit:h,onDelete:g,onReact:_,people:v,loadPeople:y,reactionChoices:b,allowReplies:D=!0,allowReactions:M=!0,composerPlaceholder:P,variant:I=`list`,composer:L=`stacked`,author:R,postLabel:z=c.postLabel,composerRows:B,readOnly:V=!1,markdown:H=!1,linkComponent:U,label:W=c.label,internalLabel:G=c.internalLabel,attachmentsLabel:K=c.attachmentsLabel,composerLabel:ee=c.composerLabel,noCommentsText:te=c.noCommentsText,reactionsLabel:ne=c.reactionsLabel,repliesToLabel:re=c.repliesToLabel,editedLabel:ie=c.editedLabel,deletedText:ae=c.deletedText,replyLabel:oe=c.replyLabel,editLabel:se=c.editLabel,deleteLabel:ce=c.deleteLabel,deleteConfirmText:le=c.deleteConfirmText,cancelLabel:ue=c.cancelLabel,addReactionLabel:de=c.addReactionLabel,chooseReactionLabel:fe=c.chooseReactionLabel,peopleLabel:pe=c.peopleLabel,id:me,className:he=``,...q}=o;d(`AppCommentThread`,q),u(`AppCommentThread`,`variant`,I,k),u(`AppCommentThread`,`composer`,L,O);let J=n(`wui-comment-thread`,A);n(`wui-mention-input`,j);let ge=S(),Y=me||`comment-thread-${ge.replace(/[^a-zA-Z0-9_-]/g,``)}`,X=C(null),Z=typeof y==`function`,_e=b?.length?b:f,Q=L===`inline`,ve=B??(Q?1:3),ye={reactionsLabel:ne,repliesToLabel:re,editedLabel:ie,deletedText:ae,replyLabel:oe,editLabel:se,deleteLabel:ce,deleteConfirmText:le,cancelLabel:ue,addReactionLabel:de},$=C({onPost:p,onReply:m,onEdit:h,onDelete:g,onReact:_,loadPeople:y});return $.current={onPost:p,onReply:m,onEdit:h,onDelete:g,onReact:_,loadPeople:y},x(()=>{let e=X.current;if(e&&J)return e.submit=async e=>{let t=$.current;e.intent===`post`?await t.onPost?.(e.body):e.intent===`reply`?await t.onReply?.(e.parentId,e.body):e.intent===`edit`?await t.onEdit?.(e.commentId,e.body):e.intent===`delete`?await t.onDelete?.(e.commentId):e.intent===`react`&&await t.onReact?.(e.commentId,e.emoji)},()=>{e.submit=void 0}},[J]),x(()=>{let e=X.current;e&&J&&!Z&&(e.people=v||[])},[v,Z,J]),x(()=>{let e=X.current;if(!e||!Z)return;let t=/* @__PURE__ */ new WeakMap,n=async e=>{let n=e.target;if(!(e instanceof CustomEvent)||!(n instanceof HTMLElement)||!N(n))throw TypeError(`<wui-comment-thread> search came from something other than a mention box.`);let r=e.detail;if(typeof r!=`object`||!r||!(`query`in r)||typeof r.query!=`string`)throw TypeError(`<wui-comment-thread> search carried no query.`);let i=r.query,{loadPeople:a}=$.current;if(typeof a!=`function`)throw Error(`<AppCommentThread> is remote but has no loadPeople.`);let o=(t.get(n)??0)+1;t.set(n,o),n.loading=!0;try{let e=await a(i);t.get(n)===o&&(n.people=e||[])}catch(e){t.get(n)===o&&(n.people=[],n.searchFailed=!0,reportError(e))}finally{t.get(n)===o&&(n.loading=!1)}};return e.addEventListener(`search`,n),()=>e.removeEventListener(`search`,n)},[Z]),/* @__PURE__ */ T(`wui-comment-thread`,{ref:X,id:Y,class:[`wui-comment-thread`,I===`conversation`&&`wui-comment-thread--conversation`,he].filter(Boolean).join(` `),controlled:``,"read-only":V?``:void 0,remote:Z?``:void 0,"reaction-choices":b?.length?b.join(` `):void 0,"no-replies":D?void 0:``,"no-reactions":M?void 0:``,"composer-placeholder":P,...t,...q,children:[/* @__PURE__ */ w(`div`,{className:`wui-comment-items`,"data-wui-items":``,children:l.length?/* @__PURE__ */ w(`ol`,{className:`wui-comment-list`,"aria-label":W,children:l.map(e=>/* @__PURE__ */ w(F,{comment:e,topLevel:!0,readOnly:V,allowReplies:D,allowReactions:M,markdown:H,linkComponent:U,internalLabel:G,attachmentsLabel:K,text:ye},e.id))}):/* @__PURE__ */ w(`p`,{className:`wui-comment-empty`,children:te})}),!V&&M&&/* @__PURE__ */ w(`div`,{className:`wui-reaction-picker`,role:`group`,"aria-label":fe,"data-wui-picker":``,popover:`auto`,children:_e.map(e=>/* @__PURE__ */ w(`button`,{type:`button`,className:`wui-reaction-choice`,"data-wui-emoji":e,children:e},e))}),!V&&/* @__PURE__ */ T(`div`,{className:Q?`wui-comment-composer wui-comment-composer-inline`:`wui-comment-composer`,"data-wui-composer":``,children:[Q&&R?/* @__PURE__ */ w(a,{name:R,size:`sm`,tone:`auto`,className:`wui-comment-composer-avatar`}):null,/* @__PURE__ */ w(`wui-mention-input`,{id:`${Y}-new`,class:`wui-mention-input`,label:ee,"people-label":pe,placeholder:P??c.composerPlaceholder,rows:String(ve),remote:Z?``:void 0}),/* @__PURE__ */ w(`div`,{className:`wui-comment-form-actions`,children:/* @__PURE__ */ w(s,{variant:Q?`outline`:`solid`,size:`sm`,"data-wui-action":`post`,children:z})}),/* @__PURE__ */ w(`div`,{className:`wui-comment-error`,"data-wui-error":``,hidden:!0})]}),/* @__PURE__ */ w(`span`,{className:`visually-hidden`,"data-wui-live":``,"aria-live":`polite`,"aria-atomic":`true`})]})}function F({comment:n,topLevel:r=!1,readOnly:i,allowReplies:a,allowReactions:u,markdown:d,linkComponent:f,internalLabel:v,attachmentsLabel:x,text:S}){let{id:C,author:E,at:O,value:k,edited:A,mine:j,internal:N,attachments:P=[],deleted:I,canEdit:L,canDelete:R,reactions:z=[],replies:B=[]}=n,V=E?.name||``,H=y(O),U=!i&&!I&&L,W=!i&&!I&&R,G=r&&a,K=[`wui-comment`,N&&`wui-comment--internal`,j&&`wui-comment--mine`].filter(Boolean).join(` `);return/* @__PURE__ */ T(`li`,{className:K,"data-wui-comment":C,"data-value":k??``,"data-wui-deleted":I?``:void 0,children:[/* @__PURE__ */ T(`div`,{className:`wui-comment-row`,children:[/* @__PURE__ */ T(`span`,{className:`avatar avatar-sm wui-comment-avatar`,"aria-hidden":`true`,children:[/* @__PURE__ */ w(`span`,{className:`avatar-face`,children:g(V)||`?`}),E?.src&&/* @__PURE__ */ w(`img`,{className:`avatar-img`,src:E.src,alt:``,onError:e=>{e.currentTarget.hidden=!0}})]}),/* @__PURE__ */ T(`div`,{className:`wui-comment-main`,children:[/* @__PURE__ */ T(`div`,{className:`wui-comment-head`,children:[/* @__PURE__ */ w(`span`,{className:`wui-comment-author`,children:V}),/* @__PURE__ */ w(`time`,{className:`wui-comment-time`,dateTime:Number.isFinite(H)?new Date(H).toISOString():void 0,children:p(O,{pattern:`datetime`})}),A&&!I&&/* @__PURE__ */ w(`span`,{className:`wui-comment-edited`,children:S.editedLabel}),N&&/* @__PURE__ */ w(o,{className:`wui-comment-internal-badge`,children:v})]}),I?/* @__PURE__ */ w(`div`,{className:`wui-comment-text wui-comment-text-deleted`,children:S.deletedText}):/* @__PURE__ */ w(`div`,{className:d?`wui-comment-text wui-comment-text--markdown`:`wui-comment-text`,"data-wui-text":``,children:d?/* @__PURE__ */ w(l,{value:_(k??``).text,headings:`text`}):M(k).map(({key:e,seg:t})=>`text`in t?/* @__PURE__ */ w(b,{children:t.text},e):/* @__PURE__ */ T(`span`,{className:`wui-mention`,"data-mention-id":t.id,children:[`@`,t.label]},e))}),!I&&P.length>0&&/* @__PURE__ */ w(`ul`,{className:`wui-comment-attachments`,"aria-label":x,children:P.map(n=>{let r=e(f,{to:n.to,href:n.href,routeHref:!1});return/* @__PURE__ */ T(`li`,{children:[/* @__PURE__ */ T(t,{link:r,className:`wui-comment-attachment`,...n.to?{}:{download:!0},children:[/* @__PURE__ */ w(c,{name:`paperclip`,size:14}),n.name]}),typeof n.sizeBytes==`number`&&/* @__PURE__ */ w(`span`,{className:`wui-comment-attachment-size`,children:m(n.sizeBytes)})]},n.to??n.href)})}),U&&/* @__PURE__ */ w(`div`,{className:`wui-comment-editor`,"data-wui-editor":``,hidden:!0}),u&&!I&&(z.length>0||!i)&&/* @__PURE__ */ T(`div`,{className:`wui-comment-reactions`,role:`group`,"aria-label":S.reactionsLabel,children:[z.map(e=>i?/* @__PURE__ */ T(`span`,{className:e.mine?`wui-reaction wui-reaction-mine`:`wui-reaction`,children:[/* @__PURE__ */ w(`span`,{className:`wui-reaction-emoji`,children:e.emoji}),/* @__PURE__ */ w(`span`,{className:`wui-reaction-count`,children:h(e.count,{decimals:0})})]},e.emoji):/* @__PURE__ */ T(`button`,{type:`button`,className:e.mine?`wui-reaction wui-reaction-mine`:`wui-reaction`,"data-wui-emoji":e.emoji,"aria-pressed":e.mine?`true`:`false`,children:[/* @__PURE__ */ w(`span`,{className:`wui-reaction-emoji`,children:e.emoji}),/* @__PURE__ */ w(`span`,{className:`wui-reaction-count`,children:h(e.count,{decimals:0})})]},e.emoji)),!i&&/* @__PURE__ */ w(`button`,{type:`button`,className:`wui-reaction-add`,"data-wui-action":`react-menu`,"aria-label":S.addReactionLabel,"aria-haspopup":`true`,"aria-expanded":`false`,children:/* @__PURE__ */ w(c,{name:`emoji-smile`,size:16})})]}),!i&&!I&&(G||U||W)&&/* @__PURE__ */ T(`div`,{className:`wui-comment-actions`,"data-wui-actions":``,children:[G&&/* @__PURE__ */ w(`button`,{type:`button`,className:`wui-comment-action`,"data-wui-action":`reply`,children:S.replyLabel}),U&&/* @__PURE__ */ w(`button`,{type:`button`,className:`wui-comment-action`,"data-wui-action":`edit`,children:S.editLabel}),W&&/* @__PURE__ */ w(`button`,{type:`button`,className:`wui-comment-action`,"data-wui-action":`delete`,children:S.deleteLabel})]}),W&&/* @__PURE__ */ T(`div`,{className:`wui-comment-confirm`,"data-wui-confirm":``,hidden:!0,children:[/* @__PURE__ */ w(`span`,{className:`wui-comment-confirm-text`,children:S.deleteConfirmText}),/* @__PURE__ */ w(s,{tone:`danger`,size:`sm`,"data-wui-action":`confirm-delete`,children:S.deleteLabel}),/* @__PURE__ */ w(s,{variant:`ghost`,size:`sm`,"data-wui-action":`cancel-delete`,children:S.cancelLabel})]}),!i&&/* @__PURE__ */ w(`div`,{className:`wui-comment-error`,"data-wui-error":``,hidden:!0})]})]}),r&&B.length>0&&/* @__PURE__ */ w(`ol`,{className:`wui-comment-list wui-comment-replies`,"aria-label":D(S.repliesToLabel,{name:V}),children:B.map(e=>/* @__PURE__ */ w(F,{comment:e,readOnly:i,allowReactions:u,markdown:d,linkComponent:f,internalLabel:v,attachmentsLabel:x,text:S},e.id))}),G&&!i&&!I&&/* @__PURE__ */ w(`div`,{className:`wui-comment-reply`,"data-wui-reply":``,hidden:!0})]})}export{P as default};
@@ -1 +1 @@
1
- import{devWarn as e}from"../lib/devWarn.js";import{emptyPlaceholder as t}from"../lib/emptyValue.js";import n from"../lib/useElementEntry.js";import r from"../lib/useWuiText.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./AppIcon.js";import o from"./AppInfoTip.js";import s from"./AppRowActions.js";import c from"./AppSkeleton.js";import l from"./AppTablePagination.js";import u from"./assertValidValue.js";import ee from"./warnUnknownProps.js";import{COLUMN_MAX_WIDTH as te,COLUMN_MIN_WIDTH as d,PIN_AT_VAR as f,PIN_SIDES as ne,ROW_HEIGHTS as p,ROW_MOVE_LIMIT as re,ROW_SAVE_ERROR_CLASS as ie,attachRowDrag as ae,attachScrollEdges as oe,groupCount as se,groupItems as ce,isImeSafeEnter as le,measureRows as ue,pinAtValue as de,pinClasses as fe,planPins as pe,playRowMoves as me,rowOrderChanged as he,saveOutcomeText as ge,settledRows as _e,syncTargets as ve,virtualRange as ye}from"@webority/ui-elements/helpers";import{Children as be,Fragment as xe,isValidElement as Se,useCallback as Ce,useEffect as m,useLayoutEffect as we,useMemo as Te,useRef as h,useState as g}from"react";import{Fragment as Ee,jsx as _,jsxs as v}from"react/jsx-runtime";import{DATA_TABLE_TEXT as De,ROW_ACTIONS_TEXT as Oe,fillText as ke,pluralText as Ae}from"@webority/ui-elements/text";import{FORCED_STATE_CLASSES as je}from"@webority/theme/runtime";var Me=()=>import(`@webority/ui-elements/elements/data-table`),Ne=[`comfortable`,`cozy`,`compact`],Pe=[`auto`,`fixed`],Fe=[1,2,3,4];function y(e,t){return typeof e==`object`&&e?Reflect.get(e,t):void 0}function Ie(e,t){if(e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`||Se(e)||Array.isArray(e))return e;throw Error(`AppDataTable: the value under "${t}" is not renderable; give that column a render function.`)}function Le(e,t){return Ie(y(e,t),t)}var Re=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}},ze=/* @__PURE__ */ new Set;function b(t,n){!ze.has(t)&&Re()&&(ze.add(t),e(`[@webority/ui-react] <AppDataTable> ${n}`))}var Be=100,Ve=e=>{let t=typeof e==`object`&&e&&`id`in e?e.id:void 0;return typeof t==`string`||typeof t==`number`?t:void 0},He=()=>{},Ue=()=>({total:0,keys:[]}),We=[],Ge=(e,t,n)=>{let r=!!t?.(e),i=r?``:n?.(e)||``;return{state:r?`saving`:i?`error`:null,message:i}};function x(e){return e===`end`?`wui-cell-end`:e===`num`?`num`:e===`center`?`text-center`:``}function Ke(e){return e===`center`?`44%`:e===`end`||e===`num`?`56%`:`60%`}function qe(e){return e==null||e===``?t():Array.isArray(e)?be.toArray(e):typeof e==`boolean`?String(e):e}function Je(e){if(!e||!(e.total>0))return!1;let t=e.pageSizes?.length?e.pageSizes:[e.pageSize];return e.total>Math.min(...t)}function S(e){n(`wui-data-table`,Me);let t=r(`dataTable`,De),be=r(`rowActions`,Oe),Se=e=>e?ke(t.resizeColumnText,{label:e}):t.resizeColumnLabel,{marker:Re,props:ze}=i(`AppDataTable`,e),{columns:S,rows:C=We,rowKey:Ye=Ve,sort:Xe,onSort:Ze,loading:w=!1,refreshing:Qe=!1,skeletonRows:$e=5,empty:et=t.empty,emptyFiltered:tt,sourceCount:nt,rowActions:T,linkComponent:rt,rowActionsLabel:it,pagination:E,ariaLabel:at,className:ot=``,wrapperClassName:st=``,selectable:D=!1,selectedIds:O,isRowSelectable:ct,onToggleRow:lt,onToggleAll:ut,onSelectRange:dt,renderExpanded:ft,singleExpand:pt=!1,density:k=`comfortable`,tableLayout:mt=`auto`,striped:ht=!1,flush:gt=!1,pad:_t,nameLines:A,headerTone:vt,rowDrag:j=!1,maxHeight:yt,stickyFirstColumn:bt=!1,stickyActions:xt=!1,equalActions:St=!1,linkFirstColumn:Ct=!1,stackOnMobile:M=!1,hiddenColumns:wt,rowStatus:Tt,rowHref:N,onRowClick:Et,activeRowKey:Dt,hoverRowKey:Ot,resizableColumns:P=!1,viewKey:kt,groupBy:F,groupLabel:At,virtual:I=!1,rowSaving:L,rowSaveError:R,...jt}=ze;ee(`AppDataTable`,jt);let{style:Mt,...Nt}=jt,z=Ce((e,t)=>{let n=Ye(e,t);if(n==null)throw Error(`AppDataTable: a row has no key. Pass rowKey, or give every row an id.`);return n},[Ye]),Pt=wt?.length?new Set(wt):null;S=Pt?S.filter(e=>!(e.hideable&&Pt.has(e.key))):S,u(`AppDataTable`,`density`,k,Ne),u(`AppDataTable`,`tableLayout`,mt,Pe),u(`AppDataTable`,`nameLines`,A,Fe);for(let e of S)u(`AppDataTable`,`column.pin`,e.pin,ne);let B=typeof N==`function`||typeof Et==`function`,Ft=[`table table-ledger`,k===`cozy`||k===`compact`?`wui-table-${k}`:``,ht?`wui-table-striped`:``,bt?`wui-table-sticky-first`:``,xt?`wui-table-sticky-actions`:``,St?`wui-table-equal-actions`:``,M?`wui-table-stack`:``,Ct&&B?`wui-table-link-first`:``,ot].filter(Boolean).join(` `),V=typeof ft==`function`,[It,Lt]=g(()=>/* @__PURE__ */ new Set),Rt=e=>Lt(t=>{if(t.has(e)){let n=new Set(t);return n.delete(e),n}return pt?/* @__PURE__ */ new Set([e]):new Set(t).add(e)}),zt=S.some(e=>typeof e.footer==`function`),Bt=e=>!!(e.target instanceof Element&&e.target.closest(`a, button, input, select, textarea, label, [role='menu'], [role='menuitem'], .dropdown`)),Vt=(e,t)=>{if(Bt(t)||(Et&&Et(e),!N))return;let n=N(e);n&&(t.ctrlKey||t.metaKey||t.button===1?window.open(n,`_blank`,`noopener`):window.location.assign(n))},H=yt!==void 0,Ht=Qe&&!w&&C.length>0,Ut=[`table-wrap`,H?`wui-table-scroll`:``,gt?`wui-table-flush`:``,Ht?`wui-table-refreshing`:``,st].filter(Boolean).join(` `),Wt={maxHeight:H?yt:void 0,"--wui-table-pad":_t!=null&&!gt?`${_t}px`:void 0,"--wui-name-lines":I?`1`:A?.toString(),"--wui-table-header-bg":vt??void 0},Gt=Object.values(Wt).some(e=>e!==void 0)||Mt!==void 0?{...Wt,...Mt}:void 0,Kt=Math.max(1,S.length+ +!!T+ +!!D+ +!!V),qt=S.some(e=>e.pin===`start`||e.pin===`end`),Jt=qt||P||!!F||I,U=+!!V+ +!!D,Yt=qt?pe([...V?[`lead`]:[],...D?[`lead`]:[],...S.map(e=>e.pin===`start`||e.pin===`end`?e.pin:null),...T?[null]:[]]):[],W=(e,t=``)=>{let n=Yt[e];return n?{className:`${t.trim()} ${fe(n)}`.trim(),style:{[f]:de(n.side,n.ordinal)}}:{className:t,style:void 0}},Xt=(e,t)=>Yt[e]?{...t,...W(e).style}:t,Zt=S.length-1+ +!!T;kt&&!P&&b(`view-key`,"`viewKey` remembers resized widths: add `resizableColumns`."),I&&!H&&b(`virtual-height`,"`virtual` needs `maxHeight`: without a scroll box every row renders."),I&&(V||M)&&b(`virtual-shape`,"`virtual` takes rows of one height, so it is off with `renderExpanded` or `stackOnMobile`."),I&&A!==void 0&&A!==1&&b(`virtual-name-lines`,"`nameLines` is ignored with `virtual`: a virtual table shows one line per name."),Ct&&!B&&b(`link-first-column`,"`linkFirstColumn` needs rowHref or onRowClick: the row is what opens."),pt&&typeof ft!=`function`&&b(`single-expand`,"`singleExpand` needs renderExpanded: there are no rows to expand."),!I&&C?.length>500&&b(`rows-without-virtual`,`renders more than 500 rows without virtual: add virtual with maxHeight, or page the data.`);let G=I&&H&&!V&&!M&&!w&&C?.length>0,K=(e,t)=>!ct||!!ct(e,t),Qt=D&&C?C.reduce((e,t,n)=>e+ +!!K(t,n),0):0,q=D&&C?C.reduce((e,t,n)=>e+(K(t,n)&&O?.has(z(t,n))?1:0),0):0,$t=Qt>0&&q===Qt,en=q>0&&!$t,tn=e=>{e&&(e.indeterminate=en)},nn=h(null),rn=(e,t)=>{let n=nn.current;nn.current=e;let r=t&&n!==null?C.findIndex((e,t)=>z(e,t)===n):-1,i=C.findIndex((t,n)=>z(t,n)===e);if(r<0||i<0||r===i){lt?.(e);return}let a=!O?.has(e),o=Math.min(r,i),s=C.slice(o,Math.max(r,i)+1).map((e,t)=>[e,o+t]).filter(([e,t])=>K(e,t)).map(([e,t])=>z(e,t)).filter(e=>(O?.has(e)||!1)!==a);if(dt)dt(s,a);else for(let e of s)lt?.(e)},an=e=>{ct?(C||[]).forEach((t,n)=>{let r=z(t,n);K(t,n)&&(O?.has(r)||!1)!==e&&lt?.(r)}):ut?.(e)},[on,sn]=g(()=>/* @__PURE__ */ new Set),cn=e=>sn(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),J=Te(()=>{let e=(C||[]).map((e,t)=>({row:e,i:t}));return F?ce(e,({row:e})=>String(y(e,F)??``)).flatMap(e=>[{group:e,open:!on.has(e.key)},...on.has(e.key)?[]:e.items]):e},[C,F,on]),ln=h(null),[Y,un]=g(null),dn=Ce(e=>{ln.current=e,un(e)},[]),fn=h(null);m(()=>{let e=Y;if(!e)return;let t=e=>{let t=e.target instanceof Element?e.target.closest(`.u-name`):null;t&&!t.title&&(t.scrollWidth>t.clientWidth||t.scrollHeight>t.clientHeight)&&(t.title=(t.textContent??``).trim())},n=e=>{let t=e.target instanceof Element?e.target.closest(`tbody > tr[aria-rowindex]`)?.getAttribute(`aria-rowindex`):null;fn.current=t?Number(t)-2:null},r=t=>{t.relatedTarget instanceof Node&&e.contains(t.relatedTarget)||(fn.current=null)};e.addEventListener(`mouseover`,t),e.addEventListener(`focusin`,t),e.addEventListener(`focusin`,n),e.addEventListener(`focusout`,r);let i=oe(e);return()=>{e.removeEventListener(`mouseover`,t),e.removeEventListener(`focusin`,t),e.removeEventListener(`focusin`,n),e.removeEventListener(`focusout`,r),i()}},[Y]),m(()=>{if(!j||!Y)return;let e=ae(Y);return ve(document),e},[j,Y]);let pn=h(Ue);we(()=>{pn.current=()=>({total:C?.length??0,keys:C?C.flatMap((e,t)=>{let n=z(e,t);return K(e,t)&&O?.has(n)?[String(n)]:[]}):[]})});let mn=h(!1);m(()=>{if(!mn.current&&(mn.current=!0,q===0))return;let{total:e,keys:t}=pn.current();ln.current?.querySelector(`table`)?.dispatchEvent(new CustomEvent(`selectionchange`,{bubbles:!0,detail:{selected:q,total:e,keys:t}}))},[q]);let[hn,gn]=g({top:0,height:0}),[_n,vn]=g(p[k]??p.comfortable);m(()=>{let e=Y;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};gn(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,Y]);let yn=h(null);we(()=>{if(!G){yn.current=null;return}let e=`${k}:${C?.length??0}`;if(yn.current===e)return;yn.current=e;let t=(ln.current?.querySelector(`:scope > table > tbody > tr:not(.wui-virtual-spacer, .wui-group-row)`))?.getBoundingClientRect().height;t!==void 0&&t>0&&Math.abs(t-_n)>.5&&vn(t)});let X={start:0,end:J.length,before:0,after:0};if(G){X=ye({scrollTop:hn.top,viewport:hn.height||Number.parseFloat(String(yt))||0,rowHeight:_n,count:J.length});let e=fn.current;e!==null&&e>=0&&e<J.length&&(e<X.start&&X.start-e<=Be&&(X={...X,start:e,before:e*_n}),e>=X.end&&e-X.end<Be&&(X={...X,end:e+1,after:(J.length-e-1)*_n}))}let bn=h(null),xn=h(null),Sn=h(null),Cn=!I&&!w&&C?.length>0&&C.length<=re;we(()=>{let e=bn.current;if(!Cn||!e){xn.current=null,Sn.current=null;return}let t=C.map((e,t)=>z(e,t));he(Sn.current,t)&&me(e.rows,xn.current),xn.current=ue(e.rows),Sn.current=t});let wn=typeof L==`function`||typeof R==`function`,Tn=h(null),En=h(null),Z=S[0]?.key;m(()=>{if(!wn){En.current=null;return}let e=/* @__PURE__ */ new Map;(C||[]).forEach((t,n)=>{let r=Z===void 0?void 0:y(t,Z),i=typeof r==`string`||typeof r==`number`?String(r):``;e.set(z(t,n),{...Ge(t,L,R),label:i})});let t=ge(_e(En.current,e));En.current=e,t&&Tn.current&&(Tn.current.textContent=t)},[C,L,R,z,wn,Z]);let Dn=tt!==void 0&&(nt===void 0||nt>0)?tt:et,On=({group:e,open:n},r)=>{let i=y(e.items[0]?.row,F??``),o=e.items.map(e=>e.row);return/* @__PURE__ */ _(`tr`,{className:`wui-group-row`,"data-group-key":e.key,"aria-rowindex":G?r+2:void 0,children:/* @__PURE__ */ _(`th`,{className:`wui-group-cell`,scope:`rowgroup`,colSpan:Kt,children:/* @__PURE__ */ v(`button`,{type:`button`,className:`wui-group-toggle`,"aria-expanded":n,onClick:()=>cn(e.key),children:[/* @__PURE__ */ _(a,{name:`chevron-down`,size:16}),/* @__PURE__ */ _(`span`,{className:`wui-group-label`,children:At?At(i,o):qe(Ie(i,F??``))}),/* @__PURE__ */ _(`span`,{className:`wui-group-count`,"aria-hidden":`true`,children:se(e.items.length)}),/* @__PURE__ */ _(`span`,{className:`visually-hidden wui-group-rows`,children:`, ${Ae(t,`groupRows`,e.items.length,{count:se(e.items.length)})}`})]})})},`group:${e.key}`)},kn=({row:e,i:n},r)=>{let i=z(e,n),o=V&&It.has(i),c=Dt!=null&&String(Dt)===String(i),l=Ot!=null&&String(Ot)===String(i),u=String(i).replace(/[^a-z0-9]/gi,`_`),ee=W(0,`wui-expand-cell`),te=W(+!!V,`wui-select-cell`),d=wn?Ge(e,L,R):null,f=K(e,n),ne=T?.(e);if(T&&!Array.isArray(ne))throw TypeError(`AppDataTable: rowActions returns a list of actions ({ key, label, icon, onClick or href }). It returned something else: restate the buttons as a list, see node scripts/codemods/row-actions.mjs --check.`);let p=Z===void 0?void 0:y(e,Z),re=typeof p==`string`||typeof p==`number`?ke(t.moreActionsForText,{firstValue:p}):be.menuLabel;return/* @__PURE__ */ v(xe,{children:[/* @__PURE__ */ v(`tr`,{className:[D&&f&&O?.has(i)?`is-selected`:``,B?`wui-row-link`:``,c?`wui-row-active`:``,l?je.hover:``].filter(Boolean).join(` `)||void 0,"aria-current":c?`true`:void 0,"aria-rowindex":G?r+2:void 0,"aria-busy":d?.state===`saving`?`true`:void 0,"data-wui-save-state":d?.state||void 0,"data-status":Tt?.(e)||void 0,"data-href":N?.(e)||void 0,"data-row-key":j?String(i):void 0,tabIndex:B?0:void 0,onClick:B?t=>Vt(e,t):void 0,onAuxClick:B&&N?t=>t.button===1&&Vt(e,t):void 0,onKeyDown:B?t=>{le(t.nativeEvent)&&t.target===t.currentTarget&&Vt(e,t)}:void 0,children:[V&&/* @__PURE__ */ _(`td`,{className:ee.className,style:ee.style,children:/* @__PURE__ */ _(`button`,{type:`button`,className:`wui-expand-toggle${o?` is-open`:``}`,"aria-expanded":o,"aria-controls":o?`${u}-expanded`:void 0,"aria-label":o?t.collapseRowLabel:t.expandRowLabel,onClick:()=>Rt(i),children:/* @__PURE__ */ _(a,{name:`chevron-down`,size:16})})}),D&&/* @__PURE__ */ _(`td`,{className:te.className,style:te.style,children:/* @__PURE__ */ _(`input`,{type:`checkbox`,className:`wui-check`,checked:f&&(O?.has(i)||!1),disabled:!f,onChange:e=>rn(i,e.nativeEvent instanceof MouseEvent&&e.nativeEvent.shiftKey),onMouseDown:e=>{e.shiftKey&&e.preventDefault()},"aria-label":t.selectRowLabel})}),S.map((t,n)=>{let r=t.rowHeader?`th`:`td`;return/* @__PURE__ */ v(r,{scope:t.rowHeader?`row`:void 0,className:W(U+n,(n===0?`wui-name-cell `:``)+(t.rowHeader?`wui-row-header `:``)+(t.nowrap?`text-nowrap `:``)+x(t.align)+(t.cellClassName?` ${t.cellClassName}`:``)).className,style:Xt(U+n,t.cellStyle),"data-label":M&&typeof t.label==`string`?t.label:void 0,children:[t.render?t.render(e):qe(Le(e,t.key)),n===0&&d?.state===`error`&&/* @__PURE__ */ _(`span`,{className:ie,children:d.message})]},t.key)}),T&&/* @__PURE__ */ _(`td`,{children:/* @__PURE__ */ _(s,{items:ne??[],menuLabel:re,linkComponent:rt})})]}),o&&/* @__PURE__ */ _(`tr`,{className:`wui-row-expanded`,children:/* @__PURE__ */ _(`td`,{id:`${u}-expanded`,colSpan:Kt,children:ft?.(e)})})]},i)},An=(e,t)=>`group`in e?On(e,t):kn(e,t),jn=(e,t)=>G?/* @__PURE__ */ _(`tr`,{className:`wui-virtual-spacer`,"aria-hidden":`true`,hidden:t===0,children:/* @__PURE__ */ _(`td`,{colSpan:Kt,style:{height:t}})},e):null,Q=W(0,`wui-expand-cell`),$=W(+!!V,`wui-select-cell`),Mn=()=>Array.from({length:$e},(e,t)=>`skeleton-${t}`).map(e=>/* @__PURE__ */ v(`tr`,{children:[V&&/* @__PURE__ */ _(`td`,{className:Q.className,style:Q.style}),D&&/* @__PURE__ */ _(`td`,{className:$.className,style:$.style}),S.map((e,t)=>/* @__PURE__ */ _(`td`,{className:W(U+t,(t===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+x(e.align)).className,style:Xt(U+t,void 0),"data-label":M&&typeof e.label==`string`?e.label:void 0,children:/* @__PURE__ */ _(c,{width:Ke(e.align),height:12,radius:6})},e.key)),T&&/* @__PURE__ */ _(`td`,{children:/* @__PURE__ */ _(`div`,{className:`u-row-actions`,children:/* @__PURE__ */ _(c,{width:`32px`,height:12,radius:6})})})]},e));return/* @__PURE__ */ v(Ee,{children:[/* @__PURE__ */ v(Jt?`wui-data-table`:`div`,{ref:dn,...Jt?{class:Ut,resizable:P?``:void 0,"view-key":kt||void 0,"data-wui-row-drag":j?``:void 0,"aria-busy":Ht||void 0}:{className:Ut,"data-wui-row-drag":j?``:void 0,"aria-busy":Ht||void 0},style:Gt,tabIndex:0,...Re,...Nt,children:[/* @__PURE__ */ v(`table`,{className:Ft,"aria-label":at,"aria-rowcount":G?J.length+1:void 0,style:mt===`fixed`?{tableLayout:`fixed`}:void 0,children:[/* @__PURE__ */ _(`thead`,{children:/* @__PURE__ */ v(`tr`,{"aria-rowindex":G?1:void 0,children:[V&&/* @__PURE__ */ _(`th`,{className:Q.className,style:Q.style,children:/* @__PURE__ */ _(`span`,{className:`visually-hidden`,children:t.expandLabel})}),D&&/* @__PURE__ */ _(`th`,{className:$.className,style:$.style,children:/* @__PURE__ */ _(`input`,{ref:tn,type:`checkbox`,className:`wui-check`,checked:$t,disabled:w,onChange:e=>an(e.target.checked),"aria-label":t.selectAllRowsLabel})}),S.map((e,t)=>{let n=e.sortable?Ze:void 0,r=n!==void 0,i=Xe&&Xe.key===e.key,s=e.align===`num`||e.align===`end`,c=r&&/* @__PURE__ */ _(`span`,{className:`sort-icon${s?` wui-sort-lead`:``}`,children:/* @__PURE__ */ _(a,{name:`chevrons-up-down`,size:14})}),l=P&&t!==Zt,u=e.width||e.minWidth?{width:e.width,minWidth:e.minWidth}:void 0;return/* @__PURE__ */ v(`th`,{className:W(U+t,(r?`sortable `:``)+(t===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+(e.grow?`wui-col-grow `:``)+(l?`wui-col-resizable `:``)+x(e.align)).className,style:Xt(U+t,u),"data-key":Jt?e.key:void 0,"aria-label":l&&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?Xe?.dir===`asc`?`ascending`:`descending`:r?`none`:void 0,onClick:n?t=>{t.target instanceof Element&&t.target.closest(`.infotip`)||w||n(e.key)}:void 0,onKeyDown:n?t=>{t.target===t.currentTarget&&(le(t.nativeEvent)||t.key===` `)&&(t.preventDefault(),w||n(e.key))}:void 0,children:[s&&c,e.label,!s&&c,e.help?/* @__PURE__ */ _(o,{label:typeof e.label==`string`?e.label:void 0,children:e.help}):null,l&&/* @__PURE__ */ _(`span`,{className:`wui-col-resize`,role:`separator`,"aria-orientation":`vertical`,"aria-valuemin":d,"aria-valuemax":te,tabIndex:0,"aria-label":Se(typeof e.label==`string`?e.label:e.key)})]},e.key)}),T&&(it?/* @__PURE__ */ _(`th`,{className:`wui-cell-end`,children:it}):/* @__PURE__ */ _(`th`,{className:`wui-cell-end`,children:/* @__PURE__ */ _(`span`,{className:`visually-hidden`,children:t.rowActionsLabel})}))]})}),/* @__PURE__ */ _(`tbody`,{ref:bn,children:w?Mn():C?.length?/* @__PURE__ */ v(Ee,{children:[jn(`before`,X.before),J.slice(X.start,X.end).map((e,t)=>An(e,X.start+t)),jn(`after`,X.after)]}):null}),zt&&!w&&C?.length>0&&/* @__PURE__ */ _(`tfoot`,{children:/* @__PURE__ */ v(`tr`,{children:[V&&/* @__PURE__ */ _(`td`,{className:Q.className,style:Q.style}),D&&/* @__PURE__ */ _(`td`,{className:$.className,style:$.style}),S.map((e,t)=>/* @__PURE__ */ _(`td`,{className:W(U+t,(t===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+x(e.align)).className,style:Xt(U+t,void 0),children:e.footer?e.footer(C):null},e.key)),T&&/* @__PURE__ */ _(`td`,{})]})})]}),!w&&!C?.length&&/* @__PURE__ */ _(`div`,{className:`tbl-empty-block`,children:typeof Dn==`string`?/* @__PURE__ */ _(`div`,{className:`tbl-empty-plain`,children:Dn}):Dn})]}),Je(E)&&/* @__PURE__ */ _(l,{page:E.page,totalPages:E.totalPages,total:E.total,pageSize:E.pageSize,onPageChange:w?He:E.setPage,onPageSizeChange:w?He:E.setPageSize,pageSizes:E.pageSizes,mode:E.mode,summary:E.summary}),wn&&/* @__PURE__ */ _(`div`,{ref:Tn,className:`visually-hidden`,role:`status`,"aria-live":`polite`,"data-wui-table-status":``})]})}export{S as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";import{emptyPlaceholder as t}from"../lib/emptyValue.js";import n from"../lib/useElementEntry.js";import r from"../lib/useWuiText.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./AppButton.js";import o from"./AppEmptyState.js";import s from"./AppIcon.js";import ee from"./AppInfoTip.js";import te from"./AppRowActions.js";import c from"./AppSkeleton.js";import l from"./AppTablePagination.js";import u from"./assertValidValue.js";import d from"./warnUnknownProps.js";import{COLUMN_MAX_WIDTH as f,COLUMN_MIN_WIDTH as ne,PIN_AT_VAR as re,PIN_SIDES as ie,ROW_HEIGHTS as ae,ROW_MOVE_LIMIT as oe,ROW_SAVE_ERROR_CLASS as se,attachRowDrag as ce,attachScrollEdges as le,groupCount as ue,groupItems as de,isImeSafeEnter as fe,measureRows as pe,pinAtValue as me,pinClasses as he,planPins as ge,playRowMoves as _e,rowOrderChanged as ve,saveOutcomeText as ye,settledRows as be,syncTargets as xe,virtualRange as Se}from"@webority/ui-elements/helpers";import{Children as Ce,Fragment as we,isValidElement as Te,useCallback as Ee,useEffect as p,useLayoutEffect as De,useMemo as Oe,useRef as m,useState as h}from"react";import{Fragment as ke,jsx as g,jsxs as _}from"react/jsx-runtime";import{DATA_TABLE_TEXT as Ae,ROW_ACTIONS_TEXT as je,fillText as Me,pluralText as Ne}from"@webority/ui-elements/text";import{FORCED_STATE_CLASSES as Pe}from"@webority/theme/runtime";var Fe=()=>import(`@webority/ui-elements/elements/data-table`),Ie=[`comfortable`,`cozy`,`compact`],Le=[`auto`,`fixed`],Re=[1,2,3,4],ze=e=>typeof e==`number`?`${e}px`:e;function Be(e){let t=e.flatMap(e=>{let t=e.minWidth??e.width;return t===void 0?[]:[ze(t)]});if(t.length!==0)return t.length===1?t[0]:`calc(${t.join(` + `)})`}function v(e,t){return typeof e==`object`&&e?Reflect.get(e,t):void 0}function Ve(e,t){if(e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`||Te(e)||Array.isArray(e))return e;throw Error(`AppDataTable: the value under "${t}" is not renderable; give that column a render function.`)}function He(e,t){return Ve(v(e,t),t)}var Ue=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}},y=/* @__PURE__ */ new Set;function b(t,n){!y.has(t)&&Ue()&&(y.add(t),e(`[@webority/ui-react] <AppDataTable> ${n}`))}var We=100,Ge=e=>{let t=typeof e==`object`&&e&&`id`in e?e.id:void 0;return typeof t==`string`||typeof t==`number`?t:void 0},Ke=()=>{},qe=()=>({total:0,keys:[]}),Je=[],Ye=(e,t,n)=>{let r=!!t?.(e),i=r?``:n?.(e)||``;return{state:r?`saving`:i?`error`:null,message:i}};function x(e){return e===`end`?`wui-cell-end`:e===`num`?`num`:e===`center`?`text-center`:``}function Xe(e){return e===`center`?`44%`:e===`end`||e===`num`?`56%`:`60%`}function Ze(e){return e==null||e===``?t():Array.isArray(e)?Ce.toArray(e):typeof e==`boolean`?String(e):e}function Qe(e){if(!e||!(e.total>0))return!1;let t=e.pageSizes?.length?e.pageSizes:[e.pageSize];return e.total>Math.min(...t)}function S(e){n(`wui-data-table`,Fe);let t=r(`dataTable`,Ae),Ce=r(`rowActions`,je),Te=e=>e?Me(t.resizeColumnText,{label:e}):t.resizeColumnLabel,{marker:ze,props:Ue}=i(`AppDataTable`,e),{columns:y,rows:S=Je,rowKey:$e=Ge,sort:et,onSort:tt,loading:C=!1,refreshing:nt=!1,skeletonRows:rt=5,empty:it=t.empty,emptyFiltered:at,error:ot,onRetry:st,sourceCount:ct,rowActions:w,linkComponent:lt,rowActionsLabel:ut,pagination:T,ariaLabel:dt,className:ft=``,wrapperClassName:pt=``,selectable:E=!1,selectedIds:D,isRowSelectable:mt,onToggleRow:ht,onToggleAll:gt,onSelectRange:_t,renderExpanded:vt,singleExpand:yt=!1,density:O=`comfortable`,tableLayout:bt=`auto`,striped:xt=!1,flush:St=!1,pad:Ct,nameLines:k,headerTone:wt,rowDrag:A=!1,maxHeight:Tt,stickyFirstColumn:Et=!1,stickyActions:Dt=!1,equalActions:Ot=!1,linkFirstColumn:kt=!1,stackOnMobile:j=!1,hiddenColumns:At,rowStatus:jt,rowHref:M,onRowClick:Mt,activeRowKey:Nt,hoverRowKey:Pt,resizableColumns:N=!1,viewKey:Ft,groupBy:P,groupLabel:It,virtual:F=!1,rowSaving:I,rowSaveError:L,...Lt}=Ue;d(`AppDataTable`,Lt);let{style:Rt,...zt}=Lt,R=Ee((e,t)=>{let n=$e(e,t);if(n==null)throw Error(`AppDataTable: a row has no key. Pass rowKey, or give every row an id.`);return n},[$e]),Bt=At?.length?new Set(At):null;y=Bt?y.filter(e=>!(e.hideable&&Bt.has(e.key))):y,u(`AppDataTable`,`density`,O,Ie),u(`AppDataTable`,`tableLayout`,bt,Le),u(`AppDataTable`,`nameLines`,k,Re);for(let e of y)u(`AppDataTable`,`column.pin`,e.pin,ie);let z=typeof M==`function`||typeof Mt==`function`,Vt=[`table table-ledger`,O===`cozy`||O===`compact`?`wui-table-${O}`:``,xt?`wui-table-striped`:``,Et?`wui-table-sticky-first`:``,Dt?`wui-table-sticky-actions`:``,Ot?`wui-table-equal-actions`:``,j?`wui-table-stack`:``,kt&&z?`wui-table-link-first`:``,ft].filter(Boolean).join(` `),B=typeof vt==`function`,[Ht,Ut]=h(()=>/* @__PURE__ */ new Set),Wt=e=>Ut(t=>{if(t.has(e)){let n=new Set(t);return n.delete(e),n}return yt?/* @__PURE__ */ new Set([e]):new Set(t).add(e)}),Gt=y.some(e=>typeof e.footer==`function`),Kt=e=>!!(e.target instanceof Element&&e.target.closest(`a, button, input, select, textarea, label, [role='menu'], [role='menuitem'], .dropdown`)),qt=(e,t)=>{if(Kt(t)||(Mt&&Mt(e),!M))return;let n=M(e);n&&(t.ctrlKey||t.metaKey||t.button===1?window.open(n,`_blank`,`noopener`):window.location.assign(n))},V=Tt!==void 0,Jt=nt&&!C&&S.length>0,Yt=[`table-wrap`,V?`wui-table-scroll`:``,St?`wui-table-flush`:``,Jt?`wui-table-refreshing`:``,pt].filter(Boolean).join(` `),Xt={maxHeight:V?Tt:void 0,"--wui-table-pad":Ct!=null&&!St?`${Ct}px`:void 0,"--wui-name-lines":F?`1`:k?.toString(),"--wui-table-header-bg":wt??void 0},Zt=Object.values(Xt).some(e=>e!==void 0)||Rt!==void 0?{...Xt,...Rt}:void 0,Qt=Math.max(1,y.length+ +!!w+ +!!E+ +!!B),$t=y.some(e=>e.pin===`start`||e.pin===`end`),en=$t||N||!!P||F,H=+!!B+ +!!E,tn=$t?ge([...B?[`lead`]:[],...E?[`lead`]:[],...y.map(e=>e.pin===`start`||e.pin===`end`?e.pin:null),...w?[null]:[]]):[],U=(e,t=``)=>{let n=tn[e];return n?{className:`${t.trim()} ${he(n)}`.trim(),style:{[re]:me(n.side,n.ordinal)}}:{className:t,style:void 0}},nn=(e,t)=>tn[e]?{...t,...U(e).style}:t,rn=y.length-1+ +!!w;Ft&&!N&&b(`view-key`,"`viewKey` remembers resized widths: add `resizableColumns`."),F&&!V&&b(`virtual-height`,"`virtual` needs `maxHeight`: without a scroll box every row renders."),F&&(B||j)&&b(`virtual-shape`,"`virtual` takes rows of one height, so it is off with `renderExpanded` or `stackOnMobile`."),F&&k!==void 0&&k!==1&&b(`virtual-name-lines`,"`nameLines` is ignored with `virtual`: a virtual table shows one line per name."),kt&&!z&&b(`link-first-column`,"`linkFirstColumn` needs rowHref or onRowClick: the row is what opens."),yt&&typeof vt!=`function`&&b(`single-expand`,"`singleExpand` needs renderExpanded: there are no rows to expand."),!F&&S?.length>500&&b(`rows-without-virtual`,`renders more than 500 rows without virtual: add virtual with maxHeight, or page the data.`);let W=F&&V&&!B&&!j&&!C&&S?.length>0,G=(e,t)=>!mt||!!mt(e,t),an=E&&S?S.reduce((e,t,n)=>e+ +!!G(t,n),0):0,K=E&&S?S.reduce((e,t,n)=>e+(G(t,n)&&D?.has(R(t,n))?1:0),0):0,on=an>0&&K===an,sn=K>0&&!on,cn=e=>{e&&(e.indeterminate=sn)},ln=m(null),un=(e,t)=>{let n=ln.current;ln.current=e;let r=t&&n!==null?S.findIndex((e,t)=>R(e,t)===n):-1,i=S.findIndex((t,n)=>R(t,n)===e);if(r<0||i<0||r===i){ht?.(e);return}let a=!D?.has(e),o=Math.min(r,i),s=S.slice(o,Math.max(r,i)+1).map((e,t)=>[e,o+t]).filter(([e,t])=>G(e,t)).map(([e,t])=>R(e,t)).filter(e=>(D?.has(e)||!1)!==a);if(_t)_t(s,a);else for(let e of s)ht?.(e)},dn=e=>{mt?(S||[]).forEach((t,n)=>{let r=R(t,n);G(t,n)&&(D?.has(r)||!1)!==e&&ht?.(r)}):gt?.(e)},[fn,pn]=h(()=>/* @__PURE__ */ new Set),mn=e=>pn(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),q=Oe(()=>{let e=(S||[]).map((e,t)=>({row:e,i:t}));return P?de(e,({row:e})=>String(v(e,P)??``)).flatMap(e=>[{group:e,open:!fn.has(e.key)},...fn.has(e.key)?[]:e.items]):e},[S,P,fn]),hn=m(null),[J,gn]=h(null),_n=Ee(e=>{hn.current=e,gn(e)},[]),vn=m(null);p(()=>{let e=J;if(!e)return;let t=e=>{let t=e.target instanceof Element?e.target.closest(`.u-name`):null;t&&!t.title&&(t.scrollWidth>t.clientWidth||t.scrollHeight>t.clientHeight)&&(t.title=(t.textContent??``).trim())},n=e=>{let t=e.target instanceof Element?e.target.closest(`tbody > tr[aria-rowindex]`)?.getAttribute(`aria-rowindex`):null;vn.current=t?Number(t)-2:null},r=t=>{t.relatedTarget instanceof Node&&e.contains(t.relatedTarget)||(vn.current=null)};e.addEventListener(`mouseover`,t),e.addEventListener(`focusin`,t),e.addEventListener(`focusin`,n),e.addEventListener(`focusout`,r);let i=le(e);return()=>{e.removeEventListener(`mouseover`,t),e.removeEventListener(`focusin`,t),e.removeEventListener(`focusin`,n),e.removeEventListener(`focusout`,r),i()}},[J]),p(()=>{if(!A||!J)return;let e=ce(J);return xe(document),e},[A,J]);let yn=m(qe);De(()=>{yn.current=()=>({total:S?.length??0,keys:S?S.flatMap((e,t)=>{let n=R(e,t);return G(e,t)&&D?.has(n)?[String(n)]:[]}):[]})});let bn=m(!1);p(()=>{if(!bn.current&&(bn.current=!0,K===0))return;let{total:e,keys:t}=yn.current();hn.current?.querySelector(`table`)?.dispatchEvent(new CustomEvent(`selectionchange`,{bubbles:!0,detail:{selected:K,total:e,keys:t}}))},[K]);let[xn,Sn]=h({top:0,height:0}),[Cn,wn]=h(ae[O]??ae.comfortable);p(()=>{let e=J;if(!W||!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};Sn(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)}},[W,J]);let Tn=m(null);De(()=>{if(!W){Tn.current=null;return}let e=`${O}:${S?.length??0}`;if(Tn.current===e)return;Tn.current=e;let t=(hn.current?.querySelector(`:scope > table > tbody > tr:not(.wui-virtual-spacer, .wui-group-row)`))?.getBoundingClientRect().height;t!==void 0&&t>0&&Math.abs(t-Cn)>.5&&wn(t)});let Y={start:0,end:q.length,before:0,after:0};if(W){Y=Se({scrollTop:xn.top,viewport:xn.height||Number.parseFloat(String(Tt))||0,rowHeight:Cn,count:q.length});let e=vn.current;e!==null&&e>=0&&e<q.length&&(e<Y.start&&Y.start-e<=We&&(Y={...Y,start:e,before:e*Cn}),e>=Y.end&&e-Y.end<We&&(Y={...Y,end:e+1,after:(q.length-e-1)*Cn}))}let En=m(null),Dn=m(null),On=m(null),kn=!F&&!C&&S?.length>0&&S.length<=oe;De(()=>{let e=En.current;if(!kn||!e){Dn.current=null,On.current=null;return}let t=S.map((e,t)=>R(e,t));ve(On.current,t)&&_e(e.rows,Dn.current),Dn.current=pe(e.rows),On.current=t});let An=typeof I==`function`||typeof L==`function`,jn=m(null),Mn=m(null),X=y[0]?.key;p(()=>{if(!An){Mn.current=null;return}let e=/* @__PURE__ */ new Map;(S||[]).forEach((t,n)=>{let r=X===void 0?void 0:v(t,X),i=typeof r==`string`||typeof r==`number`?String(r):``;e.set(R(t,n),{...Ye(t,I,L),label:i})});let t=ye(be(Mn.current,e));Mn.current=e,t&&jn.current&&(jn.current.textContent=t)},[S,I,L,R,An,X]);let Nn=at!==void 0&&(ct===void 0||ct>0)?at:it,Z=!C&&ot?ot:null,Pn=({group:e,open:n},r)=>{let i=v(e.items[0]?.row,P??``),a=e.items.map(e=>e.row);return/* @__PURE__ */ g(`tr`,{className:`wui-group-row`,"data-group-key":e.key,"aria-rowindex":W?r+2:void 0,children:/* @__PURE__ */ g(`th`,{className:`wui-group-cell`,scope:`rowgroup`,colSpan:Qt,children:/* @__PURE__ */ _(`button`,{type:`button`,className:`wui-group-toggle`,"aria-expanded":n,onClick:()=>mn(e.key),children:[/* @__PURE__ */ g(s,{name:`chevron-down`,size:16}),/* @__PURE__ */ g(`span`,{className:`wui-group-label`,children:It?It(i,a):Ze(Ve(i,P??``))}),/* @__PURE__ */ g(`span`,{className:`wui-group-count`,"aria-hidden":`true`,children:ue(e.items.length)}),/* @__PURE__ */ g(`span`,{className:`visually-hidden wui-group-rows`,children:`, ${Ne(t,`groupRows`,e.items.length,{count:ue(e.items.length)})}`})]})})},`group:${e.key}`)},Fn=({row:e,i:n},r)=>{let i=R(e,n),a=B&&Ht.has(i),o=Nt!=null&&String(Nt)===String(i),ee=Pt!=null&&String(Pt)===String(i),c=String(i).replace(/[^a-z0-9]/gi,`_`),l=U(0,`wui-expand-cell`),u=U(+!!B,`wui-select-cell`),d=An?Ye(e,I,L):null,f=G(e,n),ne=w?.(e);if(w&&!Array.isArray(ne))throw TypeError(`AppDataTable: rowActions returns a list of actions ({ key, label, icon, onClick or href }). It returned something else: restate the buttons as a list, see node scripts/codemods/row-actions.mjs --check.`);let re=X===void 0?void 0:v(e,X),ie=typeof re==`string`||typeof re==`number`?Me(t.moreActionsForText,{firstValue:re}):Ce.menuLabel;return/* @__PURE__ */ _(we,{children:[/* @__PURE__ */ _(`tr`,{className:[E&&f&&D?.has(i)?`is-selected`:``,z?`wui-row-link`:``,o?`wui-row-active`:``,ee?Pe.hover:``].filter(Boolean).join(` `)||void 0,"aria-current":o?`true`:void 0,"aria-rowindex":W?r+2:void 0,"aria-busy":d?.state===`saving`?`true`:void 0,"data-wui-save-state":d?.state||void 0,"data-status":jt?.(e)||void 0,"data-href":M?.(e)||void 0,"data-row-key":A?String(i):void 0,tabIndex:z?0:void 0,onClick:z?t=>qt(e,t):void 0,onAuxClick:z&&M?t=>t.button===1&&qt(e,t):void 0,onKeyDown:z?t=>{fe(t.nativeEvent)&&t.target===t.currentTarget&&qt(e,t)}:void 0,children:[B&&/* @__PURE__ */ g(`td`,{className:l.className,style:l.style,children:/* @__PURE__ */ g(`button`,{type:`button`,className:`wui-expand-toggle${a?` is-open`:``}`,"aria-expanded":a,"aria-controls":a?`${c}-expanded`:void 0,"aria-label":a?t.collapseRowLabel:t.expandRowLabel,onClick:()=>Wt(i),children:/* @__PURE__ */ g(s,{name:`chevron-down`,size:16})})}),E&&/* @__PURE__ */ g(`td`,{className:u.className,style:u.style,children:/* @__PURE__ */ g(`input`,{type:`checkbox`,className:`wui-check`,checked:f&&(D?.has(i)||!1),disabled:!f,onChange:e=>un(i,e.nativeEvent instanceof MouseEvent&&e.nativeEvent.shiftKey),onMouseDown:e=>{e.shiftKey&&e.preventDefault()},"aria-label":t.selectRowLabel})}),y.map((t,n)=>{let r=t.rowHeader?`th`:`td`;return/* @__PURE__ */ _(r,{scope:t.rowHeader?`row`:void 0,className:U(H+n,(n===0?`wui-name-cell `:``)+(t.rowHeader?`wui-row-header `:``)+(t.nowrap?`text-nowrap `:``)+x(t.align)+(t.cellClassName?` ${t.cellClassName}`:``)).className,style:nn(H+n,t.cellStyle),"data-label":j&&typeof t.label==`string`?t.label:void 0,children:[t.render?t.render(e):Ze(He(e,t.key)),n===0&&d?.state===`error`&&/* @__PURE__ */ g(`span`,{className:se,children:d.message})]},t.key)}),w&&/* @__PURE__ */ g(`td`,{children:/* @__PURE__ */ g(te,{items:ne??[],menuLabel:ie,linkComponent:lt})})]}),a&&/* @__PURE__ */ g(`tr`,{className:`wui-row-expanded`,children:/* @__PURE__ */ g(`td`,{id:`${c}-expanded`,colSpan:Qt,children:vt?.(e)})})]},i)},In=(e,t)=>`group`in e?Pn(e,t):Fn(e,t),Ln=(e,t)=>W?/* @__PURE__ */ g(`tr`,{className:`wui-virtual-spacer`,"aria-hidden":`true`,hidden:t===0,children:/* @__PURE__ */ g(`td`,{colSpan:Qt,style:{height:t}})},e):null,Q=U(0,`wui-expand-cell`),$=U(+!!B,`wui-select-cell`),Rn=()=>Array.from({length:rt},(e,t)=>`skeleton-${t}`).map(e=>/* @__PURE__ */ _(`tr`,{children:[B&&/* @__PURE__ */ g(`td`,{className:Q.className,style:Q.style}),E&&/* @__PURE__ */ g(`td`,{className:$.className,style:$.style}),y.map((e,t)=>/* @__PURE__ */ g(`td`,{className:U(H+t,(t===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+x(e.align)).className,style:nn(H+t,void 0),"data-label":j&&typeof e.label==`string`?e.label:void 0,children:/* @__PURE__ */ g(c,{width:Xe(e.align),height:12,radius:6})},e.key)),w&&/* @__PURE__ */ g(`td`,{children:/* @__PURE__ */ g(`div`,{className:`u-row-actions`,children:/* @__PURE__ */ g(c,{width:`32px`,height:12,radius:6})})})]},e));return/* @__PURE__ */ _(ke,{children:[/* @__PURE__ */ _(en?`wui-data-table`:`div`,{ref:_n,...en?{class:Yt,resizable:N?``:void 0,"view-key":Ft||void 0,"data-wui-row-drag":A?``:void 0,"aria-busy":Jt||void 0}:{className:Yt,"data-wui-row-drag":A?``:void 0,"aria-busy":Jt||void 0},style:Zt,tabIndex:0,...ze,...zt,children:[/* @__PURE__ */ _(`table`,{className:Vt,"aria-label":dt,"aria-rowcount":W?q.length+1:void 0,style:bt===`fixed`?{tableLayout:`fixed`,minWidth:Be(y)}:void 0,children:[/* @__PURE__ */ g(`thead`,{children:/* @__PURE__ */ _(`tr`,{"aria-rowindex":W?1:void 0,children:[B&&/* @__PURE__ */ g(`th`,{className:Q.className,style:Q.style,children:/* @__PURE__ */ g(`span`,{className:`visually-hidden`,children:t.expandLabel})}),E&&/* @__PURE__ */ g(`th`,{className:$.className,style:$.style,children:/* @__PURE__ */ g(`input`,{ref:cn,type:`checkbox`,className:`wui-check`,checked:on,disabled:C,onChange:e=>dn(e.target.checked),"aria-label":t.selectAllRowsLabel})}),y.map((e,t)=>{let n=e.sortable?tt:void 0,r=n!==void 0,i=et&&et.key===e.key,a=e.align===`num`||e.align===`end`,o=r&&/* @__PURE__ */ g(`span`,{className:`sort-icon${a?` wui-sort-lead`:``}`,children:/* @__PURE__ */ g(s,{name:`chevrons-up-down`,size:14})}),te=N&&t!==rn,c=bt===`fixed`&&!e.grow?e.minWidth:void 0,l=e.width||e.minWidth?{width:e.width??c,minWidth:e.minWidth}:void 0;return/* @__PURE__ */ _(`th`,{className:U(H+t,(r?`sortable `:``)+(t===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+(e.grow?`wui-col-grow `:``)+(te?`wui-col-resizable `:``)+x(e.align)).className,style:nn(H+t,l),"data-key":en?e.key:void 0,"aria-label":te&&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?et?.dir===`asc`?`ascending`:`descending`:r?`none`:void 0,onClick:n?t=>{t.target instanceof Element&&t.target.closest(`.infotip`)||C||n(e.key)}:void 0,onKeyDown:n?t=>{t.target===t.currentTarget&&(fe(t.nativeEvent)||t.key===` `)&&(t.preventDefault(),C||n(e.key))}:void 0,children:[a&&o,e.label,!a&&o,e.help?/* @__PURE__ */ g(ee,{label:typeof e.label==`string`?e.label:void 0,children:e.help}):null,te&&/* @__PURE__ */ g(`span`,{className:`wui-col-resize`,role:`separator`,"aria-orientation":`vertical`,"aria-valuemin":ne,"aria-valuemax":f,tabIndex:0,"aria-label":Te(typeof e.label==`string`?e.label:e.key)})]},e.key)}),w&&(ut?/* @__PURE__ */ g(`th`,{className:`wui-cell-end`,children:ut}):/* @__PURE__ */ g(`th`,{className:`wui-cell-end`,children:/* @__PURE__ */ g(`span`,{className:`visually-hidden`,children:t.rowActionsLabel})}))]})}),/* @__PURE__ */ g(`tbody`,{ref:En,children:C?Rn():Z?null:S?.length?/* @__PURE__ */ _(ke,{children:[Ln(`before`,Y.before),q.slice(Y.start,Y.end).map((e,t)=>In(e,Y.start+t)),Ln(`after`,Y.after)]}):null}),Gt&&!C&&!Z&&S?.length>0&&/* @__PURE__ */ g(`tfoot`,{children:/* @__PURE__ */ _(`tr`,{children:[B&&/* @__PURE__ */ g(`td`,{className:Q.className,style:Q.style}),E&&/* @__PURE__ */ g(`td`,{className:$.className,style:$.style}),y.map((e,t)=>/* @__PURE__ */ g(`td`,{className:U(H+t,(t===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+x(e.align)).className,style:nn(H+t,void 0),children:e.footer?e.footer(S):null},e.key)),w&&/* @__PURE__ */ g(`td`,{})]})})]}),!C&&(Z||!S?.length)&&/* @__PURE__ */ g(`div`,{className:`tbl-empty-block`,role:Z?`alert`:void 0,children:Z?/* @__PURE__ */ g(o,{variant:`table`,icon:`alert-circle`,description:Z.message,action:st?/* @__PURE__ */ g(a,{variant:`soft`,size:`sm`,onClick:()=>st(),children:t.retryLabel}):void 0,className:`wui-table-error`}):typeof Nn==`string`?/* @__PURE__ */ g(`div`,{className:`tbl-empty-plain`,children:Nn}):Nn})]}),Qe(T)&&/* @__PURE__ */ g(l,{page:T.page,totalPages:T.totalPages,total:T.total,pageSize:T.pageSize,onPageChange:C?Ke:T.setPage,onPageSizeChange:C?Ke:T.setPageSize,pageSizes:T.pageSizes,mode:T.mode,summary:T.summary}),An&&/* @__PURE__ */ g(`div`,{ref:jn,className:`visually-hidden`,role:`status`,"aria-live":`polite`,"data-wui-table-status":``})]})}export{S as default};
@@ -1 +1 @@
1
- import e from"../lib/useElementEntry.js";import t from"../lib/useWuiText.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppIcon.js";import i from"./AppInfoTip.js";import a from"./AppKbd.js";import o from"./AppSkeleton.js";import s from"./AppSpinner.js";import c from"./AppTablePagination.js";import l from"./assertValidValue.js";import ee from"./warnUnknownProps.js";import{Fragment as u,useEffect as te,useRef as d}from"react";import{Fragment as f,jsx as p,jsxs as m}from"react/jsx-runtime";import{ENTRY_GRID_TEXT as h,KBD_TEXT as g}from"@webority/ui-elements/text";var _=[`text`,`number`],ne=[`start`],re=3,ie=[`clean`,`dirty`,`saving`,`saved`,`failed`],ae=e=>Array.isArray(e)&&e.every(e=>Array.isArray(e)&&e.every(e=>typeof e==`string`)),oe=()=>import(`@webority/ui-elements/elements/entry-grid`);function v(v){e(`wui-entry-grid`,oe);let y=t(`entryGrid`,h),b=t(`kbd`,g),{marker:se,props:x}=n(`AppEntryGrid`,v),{columns:S,rows:C,rowKey:w,activeRowKey:T,onActiveRowChange:E,renderCell:ce,rowState:D,rowError:O,onCommitRow:k,onDiscardRow:A,onAddRow:j,sort:M,onSort:N,onPasteRows:P,onRemoveRow:F,loading:I=!1,skeletonRows:L=re,emptyContent:R,rowProps:z,pagination:B,renderRowDetail:V,hint:H=!0,label:U=y.label,addLabel:W=y.addLabel,emptyLabel:G=y.emptyLabel,statusLabel:K=y.statusLabel,dirtyLabel:le=y.dirtyLabel,savingLabel:ue=y.savingLabel,savedLabel:de=y.savedLabel,failedLabel:fe=y.failedLabel,commitNextLabel:pe=y.commitNextLabel,commitStayLabel:me=y.commitStayLabel,discardLabel:he=y.discardLabel,moveLabel:ge=y.moveLabel,removeLineLabel:_e=y.removeLineLabel,className:ve=``,...q}=x;if(ee(`AppEntryGrid`,q),S.forEach((e,t)=>{if(l(`AppEntryGrid`,`columns[].kind`,e.kind,_),l(`AppEntryGrid`,`columns[].pin`,e.pin,ne),e.pin!==void 0&&t!==0)throw Error(`AppEntryGrid: only the first column can be pinned, but "${e.key}" has pin.`);if(e.sortable&&N===void 0)throw Error(`AppEntryGrid: column "${e.key}" is sortable, so the grid needs onSort.`)}),!Number.isInteger(L)||L<1)throw Error(`AppEntryGrid: skeletonRows must be a whole number of 1 or more, not ${L}.`);if(R!==void 0&&x.emptyLabel!==void 0)throw Error(`AppEntryGrid: give emptyLabel or emptyContent, not both.`);let ye=C.map(e=>{let t=D?D(e):`clean`;return l(`AppEntryGrid`,`rowState()`,t,ie),t}),J=d(null),Y=d({rows:C,rowKey:w,onCommitRow:k,onDiscardRow:A,onActiveRowChange:E,onAddRow:j,onSort:N,onPasteRows:P,onRemoveRow:F});Y.current={rows:C,rowKey:w,onCommitRow:k,onDiscardRow:A,onActiveRowChange:E,onAddRow:j,onSort:N,onPasteRows:P,onRemoveRow:F},te(()=>{let e=J.current;if(!e)return;let t=e=>{let t=e instanceof CustomEvent?e.detail?.rowKey:void 0,{rows:n,rowKey:r}=Y.current;return typeof t==`string`?n.find(e=>r(e)===t):void 0},n=e=>{let n=t(e),r=e instanceof CustomEvent?e.detail?.move:void 0;n!==void 0&&(r===`next`||r===`stay`)&&Y.current.onCommitRow?.(n,r)},r=e=>{let n=t(e);n!==void 0&&Y.current.onDiscardRow?.(n)},i=e=>{let n=t(e);n!==void 0&&Y.current.onActiveRowChange?.(Y.current.rowKey(n))},a=()=>Y.current.onAddRow?.(),o=e=>{let t=e instanceof CustomEvent?e.detail?.columnKey:void 0;typeof t==`string`&&Y.current.onSort?.(t)},s=e=>{let n=e instanceof CustomEvent?e.detail:void 0,r=t(e);r!==void 0&&typeof n?.columnKey==`string`&&ae(n.rows)&&Y.current.onPasteRows?.({rowKey:Y.current.rowKey(r),columnKey:n.columnKey,rows:n.rows})},c=e=>{let n=t(e);n!==void 0&&Y.current.onRemoveRow?.(Y.current.rowKey(n))};return e.addEventListener(`wui-entry-grid:commit`,n),e.addEventListener(`wui-entry-grid:discard`,r),e.addEventListener(`wui-entry-grid:active`,i),e.addEventListener(`wui-entry-grid:add`,a),e.addEventListener(`wui-entry-grid:sort`,o),e.addEventListener(`wui-entry-grid:paste`,s),e.addEventListener(`wui-entry-grid:remove`,c),()=>{e.removeEventListener(`wui-entry-grid:commit`,n),e.removeEventListener(`wui-entry-grid:discard`,r),e.removeEventListener(`wui-entry-grid:active`,i),e.removeEventListener(`wui-entry-grid:add`,a),e.removeEventListener(`wui-entry-grid:sort`,o),e.removeEventListener(`wui-entry-grid:paste`,s),e.removeEventListener(`wui-entry-grid:remove`,c)}},[]);let be=e=>e===`dirty`?/* @__PURE__ */ p(`span`,{className:`wui-entry-grid-dot`,role:`img`,"aria-label":le}):e===`saving`?/* @__PURE__ */ p(s,{size:`sm`,label:ue}):e===`saved`?/* @__PURE__ */ m(f,{children:[/* @__PURE__ */ p(r,{name:`tick-circle`,size:16}),/* @__PURE__ */ p(`span`,{className:`visually-hidden`,children:de})]}):e===`failed`?/* @__PURE__ */ m(f,{children:[/* @__PURE__ */ p(r,{name:`danger`,size:16}),/* @__PURE__ */ p(`span`,{className:`visually-hidden`,children:fe})]}):null,xe=S.some(e=>e.footer),X=S.length+1,Z=e=>e.kind===`number`?`text-end`:void 0,Se=e=>[e.sortable&&`sortable`,e.kind===`number`&&`text-end`].filter(Boolean).join(` `)||void 0,Q=S.some(e=>e.group!==void 0),$=[];for(let e of S){let t=$[$.length-1];e.group!==void 0&&t?.group===e.group?t.span+=1:$.push({key:e.key,group:e.group,span:1})}let Ce=e=>{if(e.sortable)return M?.key===e.key?M.dir===`asc`?`ascending`:`descending`:`none`},we=e=>{let t=z?.(e)??{};for(let e of Object.keys(t))if(!e.startsWith(`data-`)||e===`data-row-key`)throw Error(`AppEntryGrid: rowProps can only return data-* attributes other than data-row-key, not "${e}".`);return t};return/* @__PURE__ */ m(`wui-entry-grid`,{ref:J,class:[`wui-entry-grid`,ve].filter(Boolean).join(` `),"active-row":T??``,removable:F?``:void 0,...se,...q,children:[/* @__PURE__ */ p(`div`,{className:`table-responsive wui-entry-grid-scroll`,children:/* @__PURE__ */ m(`table`,{className:`table wui-entry-grid-table`,"aria-label":U,children:[/* @__PURE__ */ m(`thead`,{children:[Q?/* @__PURE__ */ m(`tr`,{children:[/* @__PURE__ */ p(`th`,{scope:`col`,className:`wui-entry-grid-status`,rowSpan:2,children:/* @__PURE__ */ p(`span`,{className:`visually-hidden`,children:K})}),$.map(e=>/* @__PURE__ */ p(`th`,{className:`wui-entry-grid-group`,scope:e.span>1?`colgroup`:`col`,colSpan:e.span>1?e.span:void 0,"data-pin":e.span===1?S.find(t=>t.key===e.key)?.pin:void 0,children:e.group},e.key))]}):null,/* @__PURE__ */ m(`tr`,{children:[Q?null:/* @__PURE__ */ p(`th`,{scope:`col`,className:`wui-entry-grid-status`,children:/* @__PURE__ */ p(`span`,{className:`visually-hidden`,children:K})}),S.map(e=>{let t=e.sortable?/* @__PURE__ */ p(`span`,{className:`sort-icon${e.kind===`number`?` wui-sort-lead`:``}`,children:/* @__PURE__ */ p(r,{name:`chevrons-up-down`,size:14})}):null;return/* @__PURE__ */ m(`th`,{scope:`col`,className:Se(e),style:e.width===void 0?void 0:{width:e.width},"data-column-key":e.key,"data-pin":e.pin,"data-sortable":e.sortable?`true`:void 0,tabIndex:e.sortable?0:void 0,"aria-sort":Ce(e),children:[e.kind===`number`?t:null,e.label,e.kind===`number`?null:t,e.help?/* @__PURE__ */ p(i,{label:typeof e.label==`string`?e.label:void 0,children:e.help}):null]},e.key)})]})]}),/* @__PURE__ */ m(`tbody`,{children:[I?Array.from({length:L},(e,t)=>`skeleton-${t}`).map(e=>/* @__PURE__ */ m(`tr`,{children:[/* @__PURE__ */ p(`td`,{className:`wui-entry-grid-status`}),S.map(e=>/* @__PURE__ */ p(`td`,{className:Z(e),"data-column-key":e.key,"data-pin":e.pin,children:/* @__PURE__ */ p(o,{width:e.kind===`number`?`56%`:`60%`,height:12,radius:6})},e.key))]},e)):C.map((e,t)=>{let n=w(e),r=ye[t]??`clean`,i=n===T,a=r===`failed`&&O!==void 0,o=i&&V!==void 0,s=[`wui-entry-grid-row`,i&&`is-active`,r!==`clean`&&`wui-entry-grid-row-${r}`].filter(Boolean).join(` `);return/* @__PURE__ */ m(u,{children:[/* @__PURE__ */ m(`tr`,{...we(e),className:s,"data-row-key":n,"aria-current":i?`true`:void 0,children:[/* @__PURE__ */ p(`td`,{className:`wui-entry-grid-status`,children:be(r)}),S.map(t=>/* @__PURE__ */ p(`td`,{className:Z(t),"data-kind":t.kind??`text`,"data-column-key":t.key,"data-pin":t.pin,children:ce(e,t,i)},t.key))]}),a||o?/* @__PURE__ */ p(`tr`,{className:`wui-entry-grid-detail`,children:/* @__PURE__ */ m(`td`,{colSpan:X,children:[a?/* @__PURE__ */ p(`div`,{className:`wui-entry-grid-error`,role:`alert`,children:O(e)}):null,o?V(e):null]})}):null]},n)}),!I&&C.length===0?/* @__PURE__ */ p(`tr`,{className:`wui-entry-grid-empty`,children:/* @__PURE__ */ p(`td`,{colSpan:X,children:R===void 0?G:R})}):null]}),xe?/* @__PURE__ */ p(`tfoot`,{className:`wui-entry-grid-footer`,children:/* @__PURE__ */ m(`tr`,{children:[/* @__PURE__ */ p(`td`,{}),S.map(e=>/* @__PURE__ */ p(`td`,{className:Z(e),children:e.footer?.(C)},e.key))]})}):null]})}),B?/* @__PURE__ */ p(c,{page:B.page,totalPages:B.totalPages,total:B.total,pageSize:B.pageSize,onPageChange:I?void 0:B.setPage,onPageSizeChange:I?void 0:B.setPageSize,pageSizes:B.pageSizes,mode:B.mode,summary:B.summary}):null,/* @__PURE__ */ m(`div`,{className:`wui-entry-grid-bar`,children:[j?/* @__PURE__ */ p(`button`,{type:`button`,className:`btn btn-sm btn-outline-primary wui-entry-grid-add`,children:W}):null,H?/* @__PURE__ */ m(`ul`,{className:`wui-entry-grid-hint`,children:[k?/* @__PURE__ */ m(f,{children:[/* @__PURE__ */ m(`li`,{children:[/* @__PURE__ */ p(a,{children:b.enterLabel}),` ${pe}`]}),/* @__PURE__ */ m(`li`,{children:[/* @__PURE__ */ p(a,{children:b.ctrlLabel}),`+`,/* @__PURE__ */ p(a,{children:`S`}),` ${me}`]})]}):null,/* @__PURE__ */ m(`li`,{children:[/* @__PURE__ */ p(a,{children:b.escLabel}),` ${he}`]}),/* @__PURE__ */ m(`li`,{children:[/* @__PURE__ */ p(a,{children:b.ctrlLabel}),`+`,/* @__PURE__ */ p(a,{children:`↑`}),`/`,/* @__PURE__ */ p(a,{children:`↓`}),` ${ge}`]}),F?/* @__PURE__ */ m(`li`,{children:[/* @__PURE__ */ p(a,{children:b.ctrlLabel}),`+`,/* @__PURE__ */ p(a,{children:`Delete`}),` ${_e}`]}):null]}):null]})]})}export{v as default};
1
+ import e from"../lib/useElementEntry.js";import t from"../lib/useWuiText.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppIcon.js";import i from"./AppInfoTip.js";import a from"./AppKbd.js";import o from"./AppSkeleton.js";import s from"./AppSpinner.js";import c from"./AppTablePagination.js";import l from"./assertValidValue.js";import u from"./warnUnknownProps.js";import{memo as d,useEffect as f,useMemo as p,useRef as m,useState as ee}from"react";import{Fragment as h,jsx as g,jsxs as _}from"react/jsx-runtime";import{ENTRY_GRID_TEXT as v,KBD_TEXT as te}from"@webority/ui-elements/text";var ne=[`text`,`number`],re=[`start`],ie=3,ae=[`clean`,`dirty`,`saving`,`saved`,`failed`],oe=e=>Array.isArray(e)&&e.every(e=>Array.isArray(e)&&e.every(e=>typeof e==`string`)),se=()=>import(`@webority/ui-elements/elements/entry-grid`);function y(e,t){return e===`dirty`?/* @__PURE__ */ g(`span`,{className:`wui-entry-grid-dot`,role:`img`,"aria-label":t.dirty}):e===`saving`?/* @__PURE__ */ g(s,{size:`sm`,label:t.saving}):e===`saved`?/* @__PURE__ */ _(h,{children:[/* @__PURE__ */ g(r,{name:`tick-circle`,size:16}),/* @__PURE__ */ g(`span`,{className:`visually-hidden`,children:t.saved})]}):e===`failed`?/* @__PURE__ */ _(h,{children:[/* @__PURE__ */ g(r,{name:`danger`,size:16}),/* @__PURE__ */ g(`span`,{className:`visually-hidden`,children:t.failed})]}):null}function b(e){return e.kind===`number`?`text-end`:void 0}function x(e,t){let n=t?.(e)??{};for(let e of Object.keys(n))if(!e.startsWith(`data-`)||e===`data-row-key`)throw Error(`AppEntryGrid: rowProps can only return data-* attributes other than data-row-key, not "${e}".`);return n}function ce({row:e,rowKeyValue:t,status:n,isActive:r,columns:i,renderCell:a,rowError:o,renderRowDetail:s,rowProps:c,span:l,statusText:u}){let d=n===`failed`&&o!==void 0,f=r&&s!==void 0,p=[`wui-entry-grid-row`,r&&`is-active`,n!==`clean`&&`wui-entry-grid-row-${n}`].filter(Boolean).join(` `);return/* @__PURE__ */ _(h,{children:[/* @__PURE__ */ _(`tr`,{...x(e,c),className:p,"data-row-key":t,"aria-current":r?`true`:void 0,children:[/* @__PURE__ */ g(`td`,{className:`wui-entry-grid-status`,children:y(n,u)}),i.map(t=>/* @__PURE__ */ g(`td`,{className:b(t),"data-kind":t.kind??`text`,"data-column-key":t.key,"data-pin":t.pin,children:a(e,t,r)},t.key))]}),d||f?/* @__PURE__ */ g(`tr`,{className:`wui-entry-grid-detail`,children:/* @__PURE__ */ _(`td`,{colSpan:l,children:[d?/* @__PURE__ */ g(`div`,{className:`wui-entry-grid-error`,role:`alert`,children:o(e)}):null,f?s(e):null]})}):null]})}function S(s){e(`wui-entry-grid`,se);let y=t(`entryGrid`,v),x=t(`kbd`,te),{marker:S,props:C}=n(`AppEntryGrid`,s),{columns:w,rows:T,rowKey:E,activeRowKey:D,onActiveRowChange:O,renderCell:le,rowState:k,rowError:ue,onCommitRow:A,onDiscardRow:j,onAddRow:M,sort:N,onSort:P,onPasteRows:F,onRemoveRow:I,loading:L=!1,skeletonRows:R=ie,emptyContent:z,rowProps:de,pagination:B,renderRowDetail:fe,hint:pe=!0,label:me=y.label,addLabel:he=y.addLabel,emptyLabel:ge=y.emptyLabel,statusLabel:V=y.statusLabel,dirtyLabel:H=y.dirtyLabel,savingLabel:U=y.savingLabel,savedLabel:W=y.savedLabel,failedLabel:G=y.failedLabel,commitNextLabel:_e=y.commitNextLabel,commitStayLabel:ve=y.commitStayLabel,discardLabel:ye=y.discardLabel,moveLabel:be=y.moveLabel,removeLineLabel:xe=y.removeLineLabel,maxHeight:K,className:Se=``,...q}=C;if(u(`AppEntryGrid`,q),w.forEach((e,t)=>{if(l(`AppEntryGrid`,`columns[].kind`,e.kind,ne),l(`AppEntryGrid`,`columns[].pin`,e.pin,re),e.pin!==void 0&&t!==0)throw Error(`AppEntryGrid: only the first column can be pinned, but "${e.key}" has pin.`);if(e.sortable&&P===void 0)throw Error(`AppEntryGrid: column "${e.key}" is sortable, so the grid needs onSort.`)}),!Number.isInteger(R)||R<1)throw Error(`AppEntryGrid: skeletonRows must be a whole number of 1 or more, not ${R}.`);if(z!==void 0&&C.emptyLabel!==void 0)throw Error(`AppEntryGrid: give emptyLabel or emptyContent, not both.`);let Ce=T.map(e=>{let t=k?k(e):`clean`;return l(`AppEntryGrid`,`rowState()`,t,ae),t}),J=m(null),Y=m({rows:T,rowKey:E,onCommitRow:A,onDiscardRow:j,onActiveRowChange:O,onAddRow:M,onSort:P,onPasteRows:F,onRemoveRow:I});Y.current={rows:T,rowKey:E,onCommitRow:A,onDiscardRow:j,onActiveRowChange:O,onAddRow:M,onSort:P,onPasteRows:F,onRemoveRow:I};let we=p(()=>({dirty:H,saving:U,saved:W,failed:G}),[H,U,W,G]),[X]=ee(()=>d(ce));f(()=>{let e=J.current;if(!e)return;let t=e=>{let t=e instanceof CustomEvent?e.detail?.rowKey:void 0,{rows:n,rowKey:r}=Y.current;return typeof t==`string`?n.find(e=>r(e)===t):void 0},n=e=>{let n=t(e),r=e instanceof CustomEvent?e.detail?.move:void 0;n!==void 0&&(r===`next`||r===`stay`)&&Y.current.onCommitRow?.(n,r)},r=e=>{let n=t(e);n!==void 0&&Y.current.onDiscardRow?.(n)},i=e=>{let n=t(e);n!==void 0&&Y.current.onActiveRowChange?.(Y.current.rowKey(n))},a=()=>Y.current.onAddRow?.(),o=e=>{let t=e instanceof CustomEvent?e.detail?.columnKey:void 0;typeof t==`string`&&Y.current.onSort?.(t)},s=e=>{let n=e instanceof CustomEvent?e.detail:void 0,r=t(e);r!==void 0&&typeof n?.columnKey==`string`&&oe(n.rows)&&Y.current.onPasteRows?.({rowKey:Y.current.rowKey(r),columnKey:n.columnKey,rows:n.rows})},c=e=>{let n=t(e);n!==void 0&&Y.current.onRemoveRow?.(Y.current.rowKey(n))};return e.addEventListener(`wui-entry-grid:commit`,n),e.addEventListener(`wui-entry-grid:discard`,r),e.addEventListener(`wui-entry-grid:active`,i),e.addEventListener(`wui-entry-grid:add`,a),e.addEventListener(`wui-entry-grid:sort`,o),e.addEventListener(`wui-entry-grid:paste`,s),e.addEventListener(`wui-entry-grid:remove`,c),()=>{e.removeEventListener(`wui-entry-grid:commit`,n),e.removeEventListener(`wui-entry-grid:discard`,r),e.removeEventListener(`wui-entry-grid:active`,i),e.removeEventListener(`wui-entry-grid:add`,a),e.removeEventListener(`wui-entry-grid:sort`,o),e.removeEventListener(`wui-entry-grid:paste`,s),e.removeEventListener(`wui-entry-grid:remove`,c)}},[]);let Te=w.some(e=>e.footer),Z=w.length+1,Ee=e=>[e.sortable&&`sortable`,e.kind===`number`&&`text-end`].filter(Boolean).join(` `)||void 0,Q=w.some(e=>e.group!==void 0),$=[];for(let e of w){let t=$[$.length-1];e.group!==void 0&&t?.group===e.group?t.span+=1:$.push({key:e.key,group:e.group,span:1})}let De=e=>{if(e.sortable)return N?.key===e.key?N.dir===`asc`?`ascending`:`descending`:`none`};return/* @__PURE__ */ _(`wui-entry-grid`,{ref:J,class:[`wui-entry-grid`,Se].filter(Boolean).join(` `),"active-row":D??``,removable:I?``:void 0,...S,...q,children:[/* @__PURE__ */ g(`div`,{className:[`table-responsive wui-entry-grid-scroll`,K!==void 0&&`wui-entry-grid-scrolls`].filter(Boolean).join(` `),style:K===void 0?void 0:{maxHeight:K},children:/* @__PURE__ */ _(`table`,{className:`table wui-entry-grid-table`,"aria-label":me,children:[/* @__PURE__ */ _(`thead`,{children:[Q?/* @__PURE__ */ _(`tr`,{children:[/* @__PURE__ */ g(`th`,{scope:`col`,className:`wui-entry-grid-status`,rowSpan:2,children:/* @__PURE__ */ g(`span`,{className:`visually-hidden`,children:V})}),$.map(e=>/* @__PURE__ */ g(`th`,{className:`wui-entry-grid-group`,scope:e.span>1?`colgroup`:`col`,colSpan:e.span>1?e.span:void 0,"data-pin":e.span===1?w.find(t=>t.key===e.key)?.pin:void 0,children:e.group},e.key))]}):null,/* @__PURE__ */ _(`tr`,{children:[Q?null:/* @__PURE__ */ g(`th`,{scope:`col`,className:`wui-entry-grid-status`,children:/* @__PURE__ */ g(`span`,{className:`visually-hidden`,children:V})}),w.map(e=>{let t=e.sortable?/* @__PURE__ */ g(`span`,{className:`sort-icon${e.kind===`number`?` wui-sort-lead`:``}`,children:/* @__PURE__ */ g(r,{name:`chevrons-up-down`,size:14})}):null;return/* @__PURE__ */ _(`th`,{scope:`col`,className:Ee(e),style:e.width===void 0?void 0:{width:e.width},"data-column-key":e.key,"data-pin":e.pin,"data-sortable":e.sortable?`true`:void 0,tabIndex:e.sortable?0:void 0,"aria-sort":De(e),children:[e.kind===`number`?t:null,e.label,e.kind===`number`?null:t,e.help?/* @__PURE__ */ g(i,{label:typeof e.label==`string`?e.label:void 0,children:e.help}):null]},e.key)})]})]}),/* @__PURE__ */ _(`tbody`,{children:[L?Array.from({length:R},(e,t)=>`skeleton-${t}`).map(e=>/* @__PURE__ */ _(`tr`,{children:[/* @__PURE__ */ g(`td`,{className:`wui-entry-grid-status`}),w.map(e=>/* @__PURE__ */ g(`td`,{className:b(e),"data-column-key":e.key,"data-pin":e.pin,children:/* @__PURE__ */ g(o,{width:e.kind===`number`?`56%`:`60%`,height:12,radius:6})},e.key))]},e)):T.map((e,t)=>{let n=E(e);return/* @__PURE__ */ g(X,{row:e,rowKeyValue:n,status:Ce[t]??`clean`,isActive:n===D,columns:w,renderCell:le,rowError:ue,renderRowDetail:fe,rowProps:de,span:Z,statusText:we},n)}),!L&&T.length===0?/* @__PURE__ */ g(`tr`,{className:`wui-entry-grid-empty`,children:/* @__PURE__ */ g(`td`,{colSpan:Z,children:z===void 0?ge:z})}):null]}),Te?/* @__PURE__ */ g(`tfoot`,{className:`wui-entry-grid-footer`,children:/* @__PURE__ */ _(`tr`,{children:[/* @__PURE__ */ g(`td`,{}),w.map(e=>/* @__PURE__ */ g(`td`,{className:b(e),children:e.footer?.(T)},e.key))]})}):null]})}),B?/* @__PURE__ */ g(c,{page:B.page,totalPages:B.totalPages,total:B.total,pageSize:B.pageSize,onPageChange:L?void 0:B.setPage,onPageSizeChange:L?void 0:B.setPageSize,pageSizes:B.pageSizes,mode:B.mode,summary:B.summary}):null,/* @__PURE__ */ _(`div`,{className:`wui-entry-grid-bar`,children:[M?/* @__PURE__ */ g(`button`,{type:`button`,className:`btn btn-sm btn-outline-primary wui-entry-grid-add`,children:he}):null,pe?/* @__PURE__ */ _(`ul`,{className:`wui-entry-grid-hint`,children:[A?/* @__PURE__ */ _(h,{children:[/* @__PURE__ */ _(`li`,{children:[/* @__PURE__ */ g(a,{children:x.enterLabel}),` ${_e}`]}),/* @__PURE__ */ _(`li`,{children:[/* @__PURE__ */ g(a,{children:x.ctrlLabel}),`+`,/* @__PURE__ */ g(a,{children:`S`}),` ${ve}`]})]}):null,/* @__PURE__ */ _(`li`,{children:[/* @__PURE__ */ g(a,{children:x.escLabel}),` ${ye}`]}),/* @__PURE__ */ _(`li`,{children:[/* @__PURE__ */ g(a,{children:x.ctrlLabel}),`+`,/* @__PURE__ */ g(a,{children:`↑`}),`/`,/* @__PURE__ */ g(a,{children:`↓`}),` ${be}`]}),I?/* @__PURE__ */ _(`li`,{children:[/* @__PURE__ */ g(a,{children:x.ctrlLabel}),`+`,/* @__PURE__ */ g(a,{children:`Delete`}),` ${xe}`]}):null]}):null]})]})}export{S as default};
@@ -0,0 +1 @@
1
+ import e from"../lib/useElementEntry.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./assertValidValue.js";import r from"./warnUnknownProps.js";import{validateGantt as i}from"@webority/ui-elements/helpers";import{useCallback as a,useEffect as o,useLayoutEffect as ee,useMemo as te,useRef as s,useState as c}from"react";import{jsx as l}from"react/jsx-runtime";var u=()=>import(`@webority/ui-elements/elements/gantt`),d=[`table`,`lanes`],f=[`day`,`week`,`month`],ne=[`ready`,`loading`,`empty`,`error`],p=`wui-gantt:zoom-change`,m=`wui-gantt:from-change`,h=`wui-gantt:fold-change`,g=`wui-gantt:select`,_=`wui-gantt:add-task`,v=`wui-gantt:retry`,y=(e,t)=>{if(!(e instanceof CustomEvent))throw Error(`${t} arrived without a CustomEvent`);return e.detail},b=e=>e===``?void 0:e,x=e=>({title:e.title,rows:e.rows,layout:e.layout,zoom:e.zoom,from:b(e.from),folded:e.folded,selected:e.selected,today:b(e.today),state:e.state,emptyText:b(e.emptyText),errorText:b(e.errorText),loadingText:b(e.loadingText),addTask:e.addTask?!0:void 0,controlled:!0}),S=(e,t)=>t!=null&&Object.keys(e).every(n=>Object.is(e[n],t[n])),C=e=>{try{return JSON.stringify(e)}catch{return null}};function w(b){e(`wui-gantt`,u);let{marker:w,props:T}=t(`AppGantt`,b),{rows:E,title:re,layout:D,zoom:O,onZoomChange:k,from:A,onFromChange:j,folded:M,onFoldedChange:N,selected:P,onSelectedChange:F,today:I,state:L,loading:R,error:z,emptyText:B,errorText:V,loadingText:H,onAddTask:U,onRetry:W,className:G=``,style:ie,ref:K,...q}=T;r(`AppGantt`,q),n(`AppGantt`,`layout`,D,d),n(`AppGantt`,`zoom`,O,f),n(`AppGantt`,`state`,L,ne);let J=te(()=>{if(!Array.isArray(E))throw Error(`<AppGantt> rows is required: pass the list of tasks.`);return i({rows:E,zoom:O,layout:D}),E},[E,O,D]),[Y,ae]=c(`week`),[oe,se]=c(void 0),[ce,le]=c([]),[ue,de]=c(null),fe=O??Y,pe=A??oe,me=M??ce,he=P===void 0?ue:P,ge=z?`error`:R?`loading`:L,X=z||V,Z=s(null),Q=s({props:null,signature:null}),$=s({zoom:O,from:A,folded:M,selected:P,onZoomChange:k,onFromChange:j,onFoldedChange:N,onSelectedChange:F,onAddTask:U,onRetry:W}),_e=a(e=>{Z.current=e,typeof K==`function`?K(e):K&&(K.current=e)},[K]);return o(()=>{$.current={zoom:O,from:A,folded:M,selected:P,onZoomChange:k,onFromChange:j,onFoldedChange:N,onSelectedChange:F,onAddTask:U,onRetry:W}}),ee(()=>{let e=Z.current;if(!e)return;let t={title:re,rows:J,layout:D,zoom:fe,from:pe,folded:me,selected:he??null,today:I,state:ge,emptyText:B,errorText:X,loadingText:H,addTask:!!U};if(S(t,Q.current.props))return;Q.current.props=t;let n=x(t),r=C(n);(r===null||r!==Q.current.signature)&&(Q.current.signature=r,e.spec=n)}),o(()=>{let e=Z.current;if(!e)throw Error(`AppGantt: the <wui-gantt> element is not mounted`);let t=[[p,e=>{let{zoom:t}=y(e,p),n=$.current;n.onZoomChange?.(t),n.zoom===void 0&&ae(t)}],[m,e=>{let{from:t}=y(e,m),n=$.current;n.onFromChange?.(t),n.from===void 0&&se(t)}],[h,e=>{let{folded:t}=y(e,h),n=$.current;n.onFoldedChange?.(t),n.folded===void 0&&le(t)}],[g,e=>{let{key:t}=y(e,g),n=$.current;n.onSelectedChange?.(t),n.selected===void 0&&de(t)}],[_,()=>$.current.onAddTask?.()],[v,()=>$.current.onRetry?.()]];for(let[n,r]of t)e.addEventListener(n,r);return()=>{for(let[n,r]of t)e.removeEventListener(n,r)}},[]),/* @__PURE__ */ l(`wui-gantt`,{ref:_e,className:G||void 0,style:ie,...w,...q})}export{w as default};
@@ -0,0 +1 @@
1
+ import e from"../lib/useWuiText.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppConfirmDialog.js";import r from"./warnUnknownProps.js";import{jsx as i}from"react/jsx-runtime";import{IDLE_TIMEOUT_DIALOG_TEXT as a,fillText as o}from"@webority/ui-elements/text";function s(e){if(!Number.isFinite(e)||e<0)throw RangeError(`AppIdleTimeoutDialog: remainingMs must be a non-negative finite number, got ${e}.`);let t=Math.ceil(e/1e3);return`${Math.floor(t/60)}:${String(t%60).padStart(2,`0`)}`}function c(c){let{marker:l,props:u}=t(`AppIdleTimeoutDialog`,c),d=e(`idleTimeoutDialog`,a),{open:f,remainingMs:p,onStay:m,onSignOut:h,title:g=d.title,description:_=d.description,stayLabel:v=d.stayLabel,signOutLabel:y=d.signOutLabel,className:b=``,...x}=u;r(`AppIdleTimeoutDialog`,x);let S=s(p);return/* @__PURE__ */ i(n,{...l,...x,open:f,tone:`warning`,title:g,description:o(_,{time:S}),confirmLabel:v,cancelLabel:y,onConfirm:m,onClose:h,className:b})}export{c as default};
@@ -1 +1 @@
1
- import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/FieldMessage.js";import{FIELD_BUSY_CLASS as n,blockWhenReadOnly as ee}from"../lib/fieldState.js";import{useFieldError as te}from"../lib/formFields.js";import ne from"../lib/useWuiText.js";import{splitMarkerProps as re}from"../lib/wuiMarker.js";import r from"./AppIcon.js";import ie from"./AppInfoTip.js";import ae from"./AppPopover.js";import i from"./AppRequiredMark.js";import a from"./assertValidValue.js";import oe from"./warnUnknownProps.js";import{MASK_INPUT_TYPES as se,MASK_NAMES as ce,attachInputMask as le,evaluatePassword as ue,formatMasked as de,isMaskPattern as fe,postedMasked as pe}from"@webority/ui-elements/helpers";import{cloneElement as me,forwardRef as he,useEffect as o,useId as ge,useRef as _e,useState as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";import{INPUT_TEXT as ve}from"@webority/ui-elements/text";import{Form as u}from"react-bootstrap";var ye=[`sm`,`md`,`lg`,`xl`],be=[`bare`,`underline`],xe=[`off`,`border`,`above`],Se=[`off`,`shown`];function d(e,t){if(t!=null&&t!==``&&t!==!1)throw Error(`<AppInput> controlOnly draws no field, so it takes no ${e}; draw the label or message on the page.`)}function Ce(e){return e==null||{...`minLength`in e&&{minLength:e.minLength??0},...`uppercase`in e&&{uppercase:e.uppercase??!1},...`lowercase`in e&&{lowercase:e.lowercase??!1},...`digit`in e&&{digit:e.digit??!1},...`special`in e&&{special:e.special??!1},...`uniqueChars`in e&&{uniqueChars:e.uniqueChars??0},...`customRules`in e&&{customRules:e.customRules??[]}}}var f=he(function(he,f){let{marker:we,props:Te}=re(`AppInput`,he),p=ne(`input`,ve),{label:m,required:h=!1,optional:g=!1,error:Ee,helperText:_,help:v,helpLabel:De=p.helpLabel,type:y=`text`,size:b=`md`,leftIcon:x,rightIcon:S,onRightIconClick:Oe,rightIconLabel:ke,unit:C,id:Ae,name:je,className:Me=``,fieldClassName:w=``,disabled:Ne=!1,readOnly:T=!1,loading:E=!1,clearable:D=!1,clearLabel:Pe=p.clearLabel,optionalLabel:Fe=p.optionalLabel,requirementsTitle:Ie=p.requirementsTitle,showPasswordLabel:Le=p.showPasswordLabel,hidePasswordLabel:Re=p.hidePasswordLabel,showCount:O=!1,maxLength:k,monospace:ze=!1,prefix:A,suffix:j,action:Be,floatingLabel:M=`off`,variant:N,passwordRequirements:P=`off`,passwordPolicy:Ve,requirementsPlacement:F=`auto`,mask:I,postFormatted:L=!1,onMaskChange:He,controlOnly:Ue=!1,value:R,...z}=Te,We=te(je);oe(`AppInput`,z);let{onChange:Ge,onBlur:Ke,onClick:qe,onInput:B,...Je}=z;a(`AppInput`,`size`,b,ye),a(`AppInput`,`variant`,N,be),a(`AppInput`,`floatingLabel`,M,xe),a(`AppInput`,`passwordRequirements`,P,Se),Ue&&(d(`label`,m),d(`error`,Ee),d(`helperText`,_),d(`fieldClassName`,w),d(`showCount`,O),d(`help`,v),d(`optional`,g),d(`floatingLabel`,M===`off`?void 0:M),d(`passwordRequirements`,P===`shown`?P:void 0)),o(()=>{g&&h&&typeof process<`u`&&process.env.NODE_ENV!==`production`&&e(`AppInput: optional and required together; optional ignored`)},[g,h]),I!=null&&!fe(I)&&a(`AppInput`,`mask`,I,ce),I!=null&&a(`AppInput`,`type`,y,se);let[V,Ye]=s(!1),[Xe,Ze]=s(``),H=Ee||Xe||We,Qe=ge(),U=Ae||Qe,W=y===`password`,$e=W&&V?`text`:y,G=_e(null),et=e=>{G.current=e,typeof f==`function`?f(e):f&&(f.current=e)},K=String(R??z.defaultValue??``),[tt,q]=s(()=>!!K),[nt,rt]=s(()=>K.length),it=D&&!Ne&&!T&&!E,J=D||O,Y=W&&P===`shown`,[at,ot]=s(K);o(()=>{Y&&R!==void 0&&ot(String(R??``))},[R,Y]),o(()=>{if(!J||R===void 0)return;let e=String(R??``);q(!!e),rt(e.length)},[R,J]);let st=e=>{let t=e.currentTarget;q(!!t.value),rt(t.value.length),B?.(e)},ct=e=>{Y&&ot(e.currentTarget.value),J?st(e):B?.(e)},lt=I?{...R!==void 0&&{value:de(I,R)},...z.defaultValue!==void 0&&{defaultValue:de(I,z.defaultValue)}}:null,ut=_e(He);ut.current=He,o(()=>{let e=G.current;if(I&&e)return le(e,{mask:I,postFormatted:L,onChange:(e,t)=>ut.current?.(e,t),onInvalidChange:Ze})},[I,L]);let dt=e=>I&&!L&&e?t=>{let n=t.currentTarget,ee=new Proxy(n,{get:(e,t)=>{if(t===`value`)return pe(I,e.value);let n=Reflect.get(e,t,e);return typeof n==`function`?n.bind(e):n}});e(Object.create(t,{target:{value:ee}}))}:e,ft=it?/* @__PURE__ */ c(`button`,{type:`button`,className:`input-clear`,onClick:()=>{let e=G.current;if(!e)return;let t=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,`value`)?.set;t?t.call(e,``):e.value=``,e.dispatchEvent(new Event(`input`,{bubbles:!0})),q(!1),e.focus()},"aria-label":Pe,tabIndex:-1,hidden:!tt,children:/* @__PURE__ */ c(r,{name:`x`,size:16})}):null,pt=H&&U?`${U}-error`:void 0,mt=_&&U?`${U}-hint`:void 0,X=Y&&F===`inline`,ht=X&&U?`${U}-requirements`:void 0,gt=pt||(X?ht:mt),_t=[`input`,b===`sm`?`wui-input-sm`:``,b===`lg`?`wui-input-lg`:``,b===`xl`?`wui-input-xl`:``,H?`error`:``,W?`pw`:``,C?`num-input`:``,!(M!==`off`&&m||A||j||C||W||S)&&D&&it?`has-clear`:``,N===`underline`?`wui-input-underline`:N?`input-${N}`:``,ze?`wui-mono`:``,E?n:``,Me].filter(Boolean).join(` `),vt=ee(T||E),yt=vt?e=>{vt(e),qe?.(e)}:qe,bt=dt(Ge),xt=dt(Ke),St=J||Y?ct:B,Z=/* @__PURE__ */ c(u.Control,{id:U,name:je,type:$e,className:_t,disabled:Ne,readOnly:T||E,"aria-busy":E||void 0,required:h,"aria-invalid":H?`true`:`false`,"aria-describedby":gt,maxLength:k,...R===void 0?null:{value:R},...Je,...yt?{onClick:yt}:null,...bt?{onChange:bt}:null,...xt?{onBlur:xt}:null,...lt,placeholder:M===`off`?z.placeholder:` `,ref:et,...St?{onInput:St}:null}),Q=Ve??!0,Ct=Q&&typeof Q==`object`&&Q.title||Ie,wt=Y?ue(at,Ce(Ve)):null,Tt=Y?/* @__PURE__ */ c(`ul`,{className:`pw-criteria`,"aria-live":`polite`,id:ht,"aria-label":X?Ct:void 0,children:wt?.map(e=>/* @__PURE__ */ l(`li`,{className:`pw-rule ${e.met?`met`:`unmet`}`,children:[/* @__PURE__ */ c(`span`,{className:`pw-mark`,"aria-hidden":`true`}),/* @__PURE__ */ c(`span`,{className:`pw-rule-text`,children:e.label}),/* @__PURE__ */ c(`span`,{className:`visually-hidden`,children:e.met?p.requirementMetLabel:p.requirementNotMetLabel})]},e.key))}):null,$;if(M!==`off`&&m&&!W)$=/* @__PURE__ */ l(`div`,{className:M===`above`?`field-float wui-float-above`:`field-float`,children:[Z,/* @__PURE__ */ l(`label`,{className:`float-label`,htmlFor:U,children:[m,h&&/* @__PURE__ */ c(i,{})]})]});else if(Be)$=/* @__PURE__ */ l(`div`,{className:`input-action-row`,children:[/* @__PURE__ */ l(`div`,{className:x?`input-icon`:`input-wrap`,children:[x&&/* @__PURE__ */ c(`span`,{className:`ic`,children:/* @__PURE__ */ c(r,{name:x,size:16})}),Z]}),/* @__PURE__ */ c(`div`,{className:`input-action`,children:Be})]});else if(A||j)$=/* @__PURE__ */ l(`div`,{className:`input-affixed`,children:[A!=null&&/* @__PURE__ */ c(`span`,{className:`affix affix-pre`,children:A}),Z,j!=null&&/* @__PURE__ */ c(`span`,{className:`affix affix-suf`,children:j})]});else if(C)$=/* @__PURE__ */ l(`div`,{className:`input-with-unit`,children:[Z,/* @__PURE__ */ c(`span`,{className:`unit`,children:C})]});else if(W){let e=/* @__PURE__ */ l(`button`,{type:`button`,className:`pw-toggle${V?` pw-revealed`:``}`,onClick:()=>Ye(e=>!e),"aria-label":V?Re:Le,tabIndex:-1,children:[/* @__PURE__ */ c(r,{name:`eye`,size:18,className:`pw-eye`}),/* @__PURE__ */ c(r,{name:`eye-off`,size:18,className:`pw-eye-off`})]}),t=M!==`off`&&m?/* @__PURE__ */ c(`div`,{className:M===`above`?`field-float wui-float-above`:`field-float`,children:/* @__PURE__ */ l(`div`,{className:`input-wrap`,children:[Z,e,/* @__PURE__ */ l(`label`,{className:`float-label`,htmlFor:U,children:[m,h&&/* @__PURE__ */ c(i,{})]})]})}):/* @__PURE__ */ l(`div`,{className:x?`input-icon`:`input-wrap`,children:[x&&/* @__PURE__ */ c(`span`,{className:`ic`,children:/* @__PURE__ */ c(r,{name:x,size:16})}),Z,e]});$=Y&&!X&&F!==`inline`?/* @__PURE__ */ c(ae,{trigger:t,triggerType:`focus`,placement:F,title:Ct,className:`pw-popover`,children:Tt}):t}else $=S?/* @__PURE__ */ l(`div`,{className:`input-wrap`,children:[Z,/* @__PURE__ */ c(`button`,{type:`button`,className:`pw-toggle`,onClick:Oe,disabled:!Oe,tabIndex:-1,"aria-label":ke||S,children:/* @__PURE__ */ c(r,{name:S,size:18})})]}):D?/* @__PURE__ */ l(`div`,{className:x?`input-icon`:`input-wrap`,children:[x&&/* @__PURE__ */ c(`span`,{className:`ic`,children:/* @__PURE__ */ c(r,{name:x,size:16})}),Z,ft]}):x?/* @__PURE__ */ l(`div`,{className:`input-icon`,children:[/* @__PURE__ */ c(`span`,{className:`ic`,children:/* @__PURE__ */ c(r,{name:x,size:16})}),Z]}):Z;return Ue?me($,we):/* @__PURE__ */ l(u.Group,{...we,className:`field${w?` ${w}`:``}`,children:[m&&M===`off`&&/* @__PURE__ */ l(u.Label,{className:`label`,htmlFor:U,children:[m,g&&!h&&/* @__PURE__ */ c(`span`,{className:`label-optional`,children:` ${Fe}`}),h&&/* @__PURE__ */ c(i,{}),v&&/* @__PURE__ */ c(ie,{label:De,children:v})]}),$,X&&/* @__PURE__ */ c(`div`,{className:`wui-pw-inline`,children:Tt}),/* @__PURE__ */ c(t,{error:H,hint:X?null:_,errorId:pt,hintId:mt}),O&&/* @__PURE__ */ l(`div`,{className:`field-count${k&&nt>=k?` at-limit`:``}`,children:[nt,k?` / ${k}`:``]})]})});export{f as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/FieldMessage.js";import{FIELD_BUSY_CLASS as n,blockWhenReadOnly as ee}from"../lib/fieldState.js";import{useFieldError as te}from"../lib/formFields.js";import ne from"../lib/useWuiText.js";import{splitMarkerProps as re}from"../lib/wuiMarker.js";import r from"./AppIcon.js";import ie from"./AppInfoTip.js";import ae from"./AppPopover.js";import i from"./AppRequiredMark.js";import a from"./assertValidValue.js";import oe from"./warnUnknownProps.js";import{MASK_INPUT_TYPES as se,MASK_NAMES as ce,attachInputMask as le,evaluatePassword as ue,formatMasked as de,isMaskPattern as fe,postedMasked as pe}from"@webority/ui-elements/helpers";import{cloneElement as me,forwardRef as he,useEffect as o,useId as ge,useRef as _e,useState as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";import{INPUT_TEXT as ve}from"@webority/ui-elements/text";import{Form as u}from"react-bootstrap";var ye=[`sm`,`md`,`lg`,`xl`],be=[`bare`,`underline`],xe=[`off`,`border`,`above`],Se=[`off`,`shown`];function d(e,t){if(t!=null&&t!==``&&t!==!1)throw Error(`<AppInput> controlOnly draws no field, so it takes no ${e}; draw the label or message on the page.`)}function Ce(e){return e==null||{...`minLength`in e&&{minLength:e.minLength??0},...`uppercase`in e&&{uppercase:e.uppercase??!1},...`lowercase`in e&&{lowercase:e.lowercase??!1},...`digit`in e&&{digit:e.digit??!1},...`special`in e&&{special:e.special??!1},...`uniqueChars`in e&&{uniqueChars:e.uniqueChars??0},...`customRules`in e&&{customRules:e.customRules??[]}}}var f=he(function(he,f){let{marker:we,props:Te}=re(`AppInput`,he),p=ne(`input`,ve),{label:m,required:h=!1,optional:g=!1,error:Ee,helperText:_,help:v,helpLabel:De=p.helpLabel,type:y=`text`,size:b=`md`,leftIcon:x,rightIcon:S,onRightIconClick:Oe,rightIconLabel:ke,unit:C,id:Ae,name:je,className:Me=``,fieldClassName:w=``,disabled:Ne=!1,readOnly:T=!1,loading:E=!1,clearable:D=!1,clearLabel:Pe=p.clearLabel,optionalLabel:Fe=p.optionalLabel,requirementsTitle:Ie=p.requirementsTitle,showPasswordLabel:Le=p.showPasswordLabel,hidePasswordLabel:Re=p.hidePasswordLabel,showCount:O=!1,maxLength:k,monospace:ze=!1,prefix:A,suffix:j,action:Be,floatingLabel:M=`off`,variant:N,passwordRequirements:P=`off`,passwordPolicy:Ve,requirementsPlacement:F=`auto`,mask:I,postFormatted:L=!1,onMaskChange:He,controlOnly:Ue=!1,value:R,...z}=Te,We=te(je);oe(`AppInput`,z);let{onChange:Ge,onBlur:Ke,onClick:qe,onInput:B,...Je}=z;a(`AppInput`,`size`,b,ye),a(`AppInput`,`variant`,N,be),a(`AppInput`,`floatingLabel`,M,xe),a(`AppInput`,`passwordRequirements`,P,Se),Ue&&(d(`label`,m),d(`error`,Ee),d(`helperText`,_),d(`fieldClassName`,w),d(`showCount`,O),d(`help`,v),d(`optional`,g),d(`floatingLabel`,M===`off`?void 0:M),d(`passwordRequirements`,P===`shown`?P:void 0)),o(()=>{g&&h&&typeof process<`u`&&process.env.NODE_ENV!==`production`&&e(`AppInput: optional and required together; optional ignored`)},[g,h]),I!=null&&!fe(I)&&a(`AppInput`,`mask`,I,ce),I!=null&&a(`AppInput`,`type`,y,se);let[V,Ye]=s(!1),[Xe,Ze]=s(``),H=Ee||Xe||We,Qe=ge(),U=Ae||Qe,W=y===`password`,$e=W&&V?`text`:y,G=_e(null),et=e=>{G.current=e,typeof f==`function`?f(e):f&&(f.current=e)},K=String(R??z.defaultValue??``),[tt,q]=s(()=>!!K),[nt,rt]=s(()=>K.length),it=D&&!Ne&&!T&&!E,J=D||O,Y=W&&P===`shown`,[at,ot]=s(K);o(()=>{Y&&R!==void 0&&ot(String(R??``))},[R,Y]),o(()=>{if(!J||R===void 0)return;let e=String(R??``);q(!!e),rt(e.length)},[R,J]);let st=e=>{let t=e.currentTarget;q(!!t.value),rt(t.value.length),B?.(e)},ct=e=>{Y&&ot(e.currentTarget.value),J?st(e):B?.(e)},lt=I?{...R!==void 0&&{value:de(I,R)},...z.defaultValue!==void 0&&{defaultValue:de(I,z.defaultValue)}}:null,ut=_e(He);ut.current=He,o(()=>{let e=G.current;if(!I||!e)return;let t,n=le(e,{mask:I,postFormatted:L,onChange:(e,t)=>ut.current?.(e,t),onInvalidChange:e=>{clearTimeout(t),t=setTimeout(()=>Ze(e),0)}});return()=>{n(),clearTimeout(t),Ze(``)}},[I,L]);let dt=e=>I&&!L&&e?t=>{let n=t.currentTarget,ee=new Proxy(n,{get:(e,t)=>{if(t===`value`)return pe(I,e.value);let n=Reflect.get(e,t,e);return typeof n==`function`?n.bind(e):n}});e(Object.create(t,{target:{value:ee}}))}:e,ft=it?/* @__PURE__ */ c(`button`,{type:`button`,className:`input-clear`,onClick:()=>{let e=G.current;if(!e)return;let t=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,`value`)?.set;t?t.call(e,``):e.value=``,e.dispatchEvent(new Event(`input`,{bubbles:!0})),q(!1),e.focus()},"aria-label":Pe,tabIndex:-1,hidden:!tt,children:/* @__PURE__ */ c(r,{name:`x`,size:16})}):null,pt=H&&U?`${U}-error`:void 0,mt=_&&U?`${U}-hint`:void 0,X=Y&&F===`inline`,ht=X&&U?`${U}-requirements`:void 0,gt=pt||(X?ht:mt),_t=[`input`,b===`sm`?`wui-input-sm`:``,b===`lg`?`wui-input-lg`:``,b===`xl`?`wui-input-xl`:``,H?`error`:``,W?`pw`:``,C?`num-input`:``,!(M!==`off`&&m||A||j||C||W||S)&&D&&it?`has-clear`:``,N===`underline`?`wui-input-underline`:N?`input-${N}`:``,ze?`wui-mono`:``,E?n:``,Me].filter(Boolean).join(` `),vt=ee(T||E),yt=vt?e=>{vt(e),qe?.(e)}:qe,bt=dt(Ge),xt=dt(Ke),St=J||Y?ct:B,Z=/* @__PURE__ */ c(u.Control,{id:U,name:je,type:$e,className:_t,disabled:Ne,readOnly:T||E,"aria-busy":E||void 0,required:h,"aria-invalid":H?`true`:`false`,"aria-describedby":gt,maxLength:k,...R===void 0?null:{value:R},...Je,...yt?{onClick:yt}:null,...bt?{onChange:bt}:null,...xt?{onBlur:xt}:null,...lt,placeholder:M===`off`?z.placeholder:` `,ref:et,...St?{onInput:St}:null}),Q=Ve??!0,Ct=Q&&typeof Q==`object`&&Q.title||Ie,wt=Y?ue(at,Ce(Ve)):null,Tt=Y?/* @__PURE__ */ c(`ul`,{className:`pw-criteria`,"aria-live":`polite`,id:ht,"aria-label":X?Ct:void 0,children:wt?.map(e=>/* @__PURE__ */ l(`li`,{className:`pw-rule ${e.met?`met`:`unmet`}`,children:[/* @__PURE__ */ c(`span`,{className:`pw-mark`,"aria-hidden":`true`}),/* @__PURE__ */ c(`span`,{className:`pw-rule-text`,children:e.label}),/* @__PURE__ */ c(`span`,{className:`visually-hidden`,children:e.met?p.requirementMetLabel:p.requirementNotMetLabel})]},e.key))}):null,$;if(M!==`off`&&m&&!W)$=/* @__PURE__ */ l(`div`,{className:M===`above`?`field-float wui-float-above`:`field-float`,children:[Z,/* @__PURE__ */ l(`label`,{className:`float-label`,htmlFor:U,children:[m,h&&/* @__PURE__ */ c(i,{})]})]});else if(Be)$=/* @__PURE__ */ l(`div`,{className:`input-action-row`,children:[/* @__PURE__ */ l(`div`,{className:x?`input-icon`:`input-wrap`,children:[x&&/* @__PURE__ */ c(`span`,{className:`ic`,children:/* @__PURE__ */ c(r,{name:x,size:16})}),Z]}),/* @__PURE__ */ c(`div`,{className:`input-action`,children:Be})]});else if(A||j)$=/* @__PURE__ */ l(`div`,{className:`input-affixed`,children:[A!=null&&/* @__PURE__ */ c(`span`,{className:`affix affix-pre`,children:A}),Z,j!=null&&/* @__PURE__ */ c(`span`,{className:`affix affix-suf`,children:j})]});else if(C)$=/* @__PURE__ */ l(`div`,{className:`input-with-unit`,children:[Z,/* @__PURE__ */ c(`span`,{className:`unit`,children:C})]});else if(W){let e=/* @__PURE__ */ l(`button`,{type:`button`,className:`pw-toggle${V?` pw-revealed`:``}`,onClick:()=>Ye(e=>!e),"aria-label":V?Re:Le,tabIndex:-1,children:[/* @__PURE__ */ c(r,{name:`eye`,size:18,className:`pw-eye`}),/* @__PURE__ */ c(r,{name:`eye-off`,size:18,className:`pw-eye-off`})]}),t=M!==`off`&&m?/* @__PURE__ */ c(`div`,{className:M===`above`?`field-float wui-float-above`:`field-float`,children:/* @__PURE__ */ l(`div`,{className:`input-wrap`,children:[Z,e,/* @__PURE__ */ l(`label`,{className:`float-label`,htmlFor:U,children:[m,h&&/* @__PURE__ */ c(i,{})]})]})}):/* @__PURE__ */ l(`div`,{className:x?`input-icon`:`input-wrap`,children:[x&&/* @__PURE__ */ c(`span`,{className:`ic`,children:/* @__PURE__ */ c(r,{name:x,size:16})}),Z,e]});$=Y&&!X&&F!==`inline`?/* @__PURE__ */ c(ae,{trigger:t,triggerType:`focus`,placement:F,title:Ct,className:`pw-popover`,children:Tt}):t}else $=S?/* @__PURE__ */ l(`div`,{className:`input-wrap`,children:[Z,/* @__PURE__ */ c(`button`,{type:`button`,className:`pw-toggle`,onClick:Oe,disabled:!Oe,tabIndex:-1,"aria-label":ke||S,children:/* @__PURE__ */ c(r,{name:S,size:18})})]}):D?/* @__PURE__ */ l(`div`,{className:x?`input-icon`:`input-wrap`,children:[x&&/* @__PURE__ */ c(`span`,{className:`ic`,children:/* @__PURE__ */ c(r,{name:x,size:16})}),Z,ft]}):x?/* @__PURE__ */ l(`div`,{className:`input-icon`,children:[/* @__PURE__ */ c(`span`,{className:`ic`,children:/* @__PURE__ */ c(r,{name:x,size:16})}),Z]}):Z;return Ue?me($,we):/* @__PURE__ */ l(u.Group,{...we,className:`field${w?` ${w}`:``}`,children:[m&&M===`off`&&/* @__PURE__ */ l(u.Label,{className:`label`,htmlFor:U,children:[m,g&&!h&&/* @__PURE__ */ c(`span`,{className:`label-optional`,children:` ${Fe}`}),h&&/* @__PURE__ */ c(i,{}),v&&/* @__PURE__ */ c(ie,{label:De,children:v})]}),$,X&&/* @__PURE__ */ c(`div`,{className:`wui-pw-inline`,children:Tt}),/* @__PURE__ */ c(t,{error:H,hint:X?null:_,errorId:pt,hintId:mt}),O&&/* @__PURE__ */ l(`div`,{className:`field-count${k&&nt>=k?` at-limit`:``}`,children:[nt,k?` / ${k}`:``]})]})});export{f as default};
@@ -0,0 +1 @@
1
+ import e from"../lib/useWuiText.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppButton.js";import r from"./AppSpinner.js";import i from"./warnUnknownProps.js";import{useEffect as a,useRef as o}from"react";import{Fragment as s,jsx as c,jsxs as l}from"react/jsx-runtime";import{LOAD_MORE_TEXT as u}from"@webority/ui-elements/text";function d(d){let{marker:f,props:p}=t(`AppLoadMore`,d),m=e(`loadMore`,u),{paging:h,infinite:g=!1,className:_=``,loadMoreLabel:v=m.loadMoreLabel,loadingLabel:y=m.loadingLabel,failedText:b=m.failedText,retryLabel:x=m.retryLabel,finishedText:S=m.finishedText,...C}=p;i(`AppLoadMore`,C);let w=h.errorMore?`error`:h.loadingMore?`loading`:h.hasMore?`more`:`end`,T=o(null),E=o(h.loadMore);E.current=h.loadMore;let D=g&&w===`more`;return a(()=>{let e=T.current;if(!D||!e||typeof IntersectionObserver>`u`)return;let t=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&E.current()},{rootMargin:`200px`});return t.observe(e),()=>t.disconnect()},[D]),/* @__PURE__ */ l(`div`,{className:`d-flex align-items-center justify-content-center gap-2 py-3${_?` ${_}`:``}`,"data-state":w,"aria-busy":w===`loading`?`true`:void 0,...f,...C,children:[w===`error`&&/* @__PURE__ */ l(s,{children:[/* @__PURE__ */ c(`span`,{className:`text-danger small`,role:`status`,children:b}),/* @__PURE__ */ c(n,{variant:`ghost`,size:`sm`,onClick:()=>h.retryMore(),children:x})]}),w===`loading`&&/* @__PURE__ */ c(r,{size:`sm`,label:y}),w===`more`&&/* @__PURE__ */ c(n,{variant:`soft`,onClick:()=>h.loadMore(),children:v}),w===`end`&&/* @__PURE__ */ c(`span`,{className:`text-body-secondary small`,role:`status`,children:S}),D&&/* @__PURE__ */ c(`div`,{ref:T,"aria-hidden":`true`})]})}export{d as default};
@@ -0,0 +1 @@
1
+ import{serialiseQuery as e}from"../lib/queryBuilder/querySerialise.js";import{addCondition as t,addGroup as n,countConditions as ee,emptyQuery as r,isGroup as te,nodeAt as ne,pruneIncomplete as i,queryDepth as a,removeNode as o,setGroupOp as re,updateCondition as ie,validateQuery as ae}from"../lib/queryBuilder/queryTree.js";import oe from"../lib/queryBuilderView/QueryAppliedBar.js";import s from"../lib/queryBuilderView/QueryRulePanel.js";import{clauseText as c,pathKey as se,querySummary as ce}from"../lib/queryBuilderView/queryDisplay.js";import le from"../lib/useWuiText.js";import{splitMarkerProps as ue}from"../lib/wuiMarker.js";import de from"./warnUnknownProps.js";import{forwardRef as l,useCallback as fe,useId as pe,useRef as me,useState as u}from"react";import{jsx as d}from"react/jsx-runtime";import{QUERY_BUILDER_TEXT as he}from"@webority/ui-elements/text";function ge(e){if(!Array.isArray(e)||e.length===0)throw TypeError(`[@webority/ui-react] <AppQueryBuilder> needs a non-empty fields array.`);let t=/* @__PURE__ */ new Set;for(let n of e){if(t.has(n.key))throw TypeError(`[@webority/ui-react] <AppQueryBuilder> field key "${n.key}" is given more than once.`);t.add(n.key)}}function _e(e){if(!Number.isInteger(e)||e<1)throw TypeError(`[@webority/ui-react] <AppQueryBuilder> maxDepth must be a whole number of 1 or more, received ${e}.`);return Math.min(e,3)}var f=l(function(l,f){let{marker:ve,props:ye}=ue(`AppQueryBuilder`,l),p=le(`queryBuilder`,he),{fields:m,value:h,defaultValue:be,onChange:g,maxDepth:_=3,disabled:v=!1,ariaLabel:y,className:b,addConditionLabel:x=p.addConditionLabel,addGroupLabel:S=p.addGroupLabel,andLabel:C=p.andLabel,applyLabel:w=p.applyLabel,cancelLabel:T=p.cancelLabel,clearAllLabel:E=p.clearAllLabel,closeLabel:D=p.closeLabel,conditionCountTextOne:O=p.conditionCountTextOne,conditionCountTextOther:k=p.conditionCountTextOther,datePlaceholder:A=p.datePlaceholder,emptySummaryText:j=p.emptySummaryText,emptyText:M=p.emptyText,emptyTitle:N=p.emptyTitle,emptyValueText:xe=p.emptyValueText,fieldLabel:Se=p.fieldLabel,filtersCountLabel:Ce=p.filtersCountLabel,filtersLabel:we=p.filtersLabel,groupCountTextOne:Te=p.groupCountTextOne,groupCountTextOther:Ee=p.groupCountTextOther,incompleteTextOne:De=p.incompleteTextOne,incompleteTextOther:Oe=p.incompleteTextOther,matchAllLabel:ke=p.matchAllLabel,matchAnyLabel:Ae=p.matchAnyLabel,matchLabel:je=p.matchLabel,matchSuffixText:Me=p.matchSuffixText,maxPlaceholder:Ne=p.maxPlaceholder,minPlaceholder:Pe=p.minPlaceholder,multiPlaceholder:Fe=p.multiPlaceholder,noLabel:Ie=p.noLabel,operatorBetween:Le=p.operatorBetween,operatorContains:Re=p.operatorContains,operatorGt:ze=p.operatorGt,operatorGtDate:Be=p.operatorGtDate,operatorInLast:Ve=p.operatorInLast,operatorIs:He=p.operatorIs,operatorIsAnyOf:Ue=p.operatorIsAnyOf,operatorIsEmpty:We=p.operatorIsEmpty,operatorIsNot:Ge=p.operatorIsNot,operatorLabel:Ke=p.operatorLabel,operatorLt:qe=p.operatorLt,operatorLtDate:Je=p.operatorLtDate,orLabel:Ye=p.orLabel,panelTitle:Xe=p.panelTitle,rangeJoinText:Ze=p.rangeJoinText,removeClauseLabel:Qe=p.removeClauseLabel,removeConditionLabel:$e=p.removeConditionLabel,removeGroupLabel:et=p.removeGroupLabel,singlePlaceholder:tt=p.singlePlaceholder,textPlaceholder:nt=p.textPlaceholder,unitDays:rt=p.unitDays,unitLabel:it=p.unitLabel,unitMonths:at=p.unitMonths,unitWeeks:ot=p.unitWeeks,valueLabel:st=p.valueLabel,valueRequiredText:ct=p.valueRequiredText,yesLabel:lt=p.yesLabel,...P}=ye,F={addConditionLabel:x,addGroupLabel:S,andLabel:C,applyLabel:w,cancelLabel:T,clearAllLabel:E,closeLabel:D,conditionCountTextOne:O,conditionCountTextOther:k,datePlaceholder:A,emptySummaryText:j,emptyText:M,emptyTitle:N,emptyValueText:xe,fieldLabel:Se,filtersCountLabel:Ce,filtersLabel:we,groupCountTextOne:Te,groupCountTextOther:Ee,incompleteTextOne:De,incompleteTextOther:Oe,matchAllLabel:ke,matchAnyLabel:Ae,matchLabel:je,matchSuffixText:Me,maxPlaceholder:Ne,minPlaceholder:Pe,multiPlaceholder:Fe,noLabel:Ie,operatorBetween:Le,operatorContains:Re,operatorGt:ze,operatorGtDate:Be,operatorInLast:Ve,operatorIs:He,operatorIsAnyOf:Ue,operatorIsEmpty:We,operatorIsNot:Ge,operatorLabel:Ke,operatorLt:qe,operatorLtDate:Je,orLabel:Ye,panelTitle:Xe,rangeJoinText:Ze,removeClauseLabel:Qe,removeConditionLabel:$e,removeGroupLabel:et,singlePlaceholder:tt,textPlaceholder:nt,unitDays:rt,unitLabel:it,unitMonths:at,unitWeeks:ot,valueLabel:st,valueRequiredText:ct,yesLabel:lt};de(`AppQueryBuilder`,P),ge(m);let I=_e(_),L=h??be??r(),[R,z]=u(L),[B,V]=u(L),[H,U]=u(!1),[ut,dt]=u(h),W=pe(),G=me(null),ft=fe(e=>{G.current=e,typeof f==`function`?f(e):f&&(f.current=e)},[f]),K=e(R,m);h!==ut&&(dt(h),h!==void 0&&e(h,m)!==K&&(z(h),V(h)));let pt=ae(B,m,I),q=[];for(let e of pt){let t=ne(B,e.path);t!==void 0&&!te(t)&&q.push(se(e.path))}let J=q.length,mt=e(B,m),Y=!v&&J===0&&mt!==K,ht=ce(i(B,m),m,F),gt=R.items.map(e=>c(e,m,F)),_t=R.op===`and`?F.andLabel:F.orLabel,vt=ee(R),X=e=>V(t=>{let n=e(t);return a(n)>Math.max(I,a(t))?t:n}),yt=(e,t)=>X(n=>ie(n,e,t,m)),bt=e=>X(t=>o(t,e)),xt=e=>X(n=>t(n,e,m)),Z=e=>X(t=>n(t,e)),St=(e,t)=>X(n=>re(n,e,t)),Ct=()=>V(r()),Q=t=>{let n=i(t,m);z(n),e(n,m)!==K&&g?.(n)},wt=e=>{e&&V(R),U(e)},$=()=>{G.current?.querySelector(`[data-wui-popover-trigger]`)?.focus()},Tt=()=>{U(!1),$()},Et=()=>{Y&&(Q(B),U(!1),$())},Dt=e=>Q(o(R,[e])),Ot=()=>Q(r());return/* @__PURE__ */ d(`div`,{ref:ft,className:`wui-query-builder${b?` ${b}`:``}`,...ve,...P,children:/* @__PURE__ */ d(oe,{clauses:gt,connector:_t,conditionCount:vt,text:F,ariaLabel:y??F.filtersLabel,titleId:W,disabled:v,open:H,onOpenChange:wt,onRemoveClause:Dt,onClear:Ot,children:H?/* @__PURE__ */ d(s,{draft:B,fields:m,maxDepth:I,text:F,disabled:v,incompletePaths:q,titleId:W,summary:ht,incompleteCount:J,canApply:Y,onUpdate:yt,onRemove:bt,onAddCondition:xt,onAddGroup:Z,onSetOp:St,onClear:Ct,onCancel:Tt,onApply:Et}):null})})});export{f as default};
@@ -0,0 +1 @@
1
+ import e from"../lib/useElementEntry.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./warnUnknownProps.js";import{useLayoutEffect as r,useRef as i}from"react";import{jsx as a}from"react/jsx-runtime";var o=()=>import(`@webority/ui-elements/elements/saved-views`);function s(s){e(`wui-saved-views`,o);let{marker:c,props:l}=t(`AppSavedViews`,s),{storageKey:u,className:d=``,...f}=l;n(`AppSavedViews`,f);let p=i(null);if(r(()=>{p.current?.setAttribute(`key`,u)},[u]),u.trim()===``)throw Error(`AppSavedViews needs a storageKey, the name its views are stored under.`);return/* @__PURE__ */ a(`wui-saved-views`,{ref:p,class:d||void 0,...c,...f})}export{s as default};
@@ -1 +1 @@
1
- import{FIELD_SIZES as e}from"../lib/fieldState.js";import t from"../lib/useWuiText.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppIcon.js";import i from"./assertValidValue.js";import a from"./warnUnknownProps.js";import{isTypingTarget as o}from"@webority/ui-elements/helpers";import{useCallback as s,useEffect as c,useRef as l,useState as u}from"react";import{flushSync as d}from"react-dom";import{jsx as f,jsxs as p}from"react/jsx-runtime";import{SEARCH_TEXT as m}from"@webority/ui-elements/text";import{Form as h}from"react-bootstrap";function g(g){let{marker:_,props:v}=n(`AppSearch`,g),y=t(`search`,m),{value:b,defaultValue:x,onChange:S,placeholder:C=y.placeholder,ariaLabel:w,clearLabel:T=y.clearLabel,searchLabel:E=y.searchLabel,iconSize:D,size:O,loading:k=!1,collapsible:A=!1,disabled:j=!1,className:M=``,form:N,onKeyDown:P,...F}=v;a(`AppSearch`,F);let{readOnly:I,...L}=F;i(`AppSearch`,`size`,O,e);let R=D??18,[z,B]=u(x??``),V=b===void 0?z:b,[H,U]=u(!!V),W=l(null),G=l(null),K=!A||H||!!V,q=s(()=>{U(!0),requestAnimationFrame(()=>W.current?.focus())},[]),J=()=>{B(``),d(()=>S?.(``)),W.current?.form?.requestSubmit()};c(()=>{if(!A)return;let e=e=>{e.key!==`/`||e.ctrlKey||e.altKey||e.metaKey||o(e.target instanceof Node?e.target:null)||[...document.querySelectorAll(`.search-wrap.wui-search-collapsible`)].find(e=>e.offsetParent!==null)===G.current&&(e.preventDefault(),q())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[A,q]);let Y=[`search-wrap`,V?`has-value`:``,O===`sm`?`wui-search-sm`:O===`lg`?`wui-search-lg`:O===`xl`?`wui-search-xl`:``,k?`is-loading`:``,A?`wui-search-collapsible`:``,A&&!K?`is-collapsed`:``,M].filter(Boolean).join(` `),X=D==null?void 0:{"--wui-search-icon-size":`${D}px`};return/* @__PURE__ */ p(`div`,{..._,className:Y,style:X,ref:G,onBlur:e=>{A&&!e.currentTarget.contains(e.relatedTarget)&&!V&&U(!1)},children:[A&&/* @__PURE__ */ f(`button`,{type:`button`,className:`wui-search-toggle`,"aria-label":w||C||E,"aria-expanded":K?`true`:`false`,onClick:q,children:/* @__PURE__ */ f(r,{name:`search`,size:R})}),k&&/* @__PURE__ */ f(`span`,{className:`search-spinner`,"aria-hidden":`true`}),/* @__PURE__ */ f(r,{name:`search`,size:R,className:`search-icon`}),/* @__PURE__ */ f(h.Control,{ref:W,type:`search`,className:`input search-input`,placeholder:C,value:V,onChange:e=>{B(e.target.value),S?.(e.target.value)},onKeyDown:e=>{P?.(e),A&&e.key===`Escape`&&!V&&U(!1)},"aria-label":w,form:N,disabled:j,...I===void 0?null:{readOnly:I},...L}),!j&&/* @__PURE__ */ f(`button`,{type:`button`,className:`search-clear`,"aria-label":T,onClick:J,hidden:!V,children:/* @__PURE__ */ f(r,{name:`x`,size:16})})]})}export{g as default};
1
+ import{FIELD_SIZES as e}from"../lib/fieldState.js";import t from"../lib/useWuiText.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppIcon.js";import i from"./assertValidValue.js";import a from"./warnUnknownProps.js";import{isTypingTarget as o}from"@webority/ui-elements/helpers";import{useCallback as s,useEffect as c,useRef as l,useState as u}from"react";import{flushSync as d}from"react-dom";import{jsx as f,jsxs as p}from"react/jsx-runtime";import{SEARCH_TEXT as m}from"@webority/ui-elements/text";import{Form as h}from"react-bootstrap";function g(g){let{marker:_,props:v}=n(`AppSearch`,g),y=t(`search`,m),{value:b,defaultValue:x,onChange:S,placeholder:C=y.placeholder,ariaLabel:w,clearLabel:T=y.clearLabel,searchLabel:E=y.searchLabel,iconSize:D,size:O,loading:k=!1,collapsible:A=!1,disabled:j=!1,readOnly:M,className:N=``,form:P,onKeyDown:F,...I}=v;a(`AppSearch`,I),i(`AppSearch`,`size`,O,e);let L=D??18,[R,z]=u(x??``),B=b===void 0?R:b,[V,H]=u(!!B),U=l(null),W=l(null),G=!A||V||!!B,K=s(()=>{H(!0),requestAnimationFrame(()=>U.current?.focus())},[]),q=()=>{z(``),d(()=>S?.(``)),U.current?.form?.requestSubmit()};c(()=>{if(!A)return;let e=e=>{e.key!==`/`||e.ctrlKey||e.altKey||e.metaKey||o(e.target instanceof Node?e.target:null)||[...document.querySelectorAll(`.search-wrap.wui-search-collapsible`)].find(e=>e.offsetParent!==null)===W.current&&(e.preventDefault(),K())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[A,K]);let J=[`search-wrap`,B?`has-value`:``,O===`sm`?`wui-search-sm`:O===`lg`?`wui-search-lg`:O===`xl`?`wui-search-xl`:``,k?`is-loading`:``,A?`wui-search-collapsible`:``,A&&!G?`is-collapsed`:``,N].filter(Boolean).join(` `),Y=D==null?void 0:{"--wui-search-icon-size":`${D}px`};return/* @__PURE__ */ p(`div`,{..._,className:J,style:Y,ref:W,onBlur:e=>{A&&!e.currentTarget.contains(e.relatedTarget)&&!B&&H(!1)},children:[A&&/* @__PURE__ */ f(`button`,{type:`button`,className:`wui-search-toggle`,"aria-label":w||C||E,"aria-expanded":G?`true`:`false`,onClick:K,children:/* @__PURE__ */ f(r,{name:`search`,size:L})}),k&&/* @__PURE__ */ f(`span`,{className:`search-spinner`,"aria-hidden":`true`}),/* @__PURE__ */ f(r,{name:`search`,size:L,className:`search-icon`}),/* @__PURE__ */ f(h.Control,{ref:U,type:`search`,className:`input search-input`,placeholder:C,value:B,onChange:e=>{z(e.target.value),S?.(e.target.value)},onKeyDown:e=>{F?.(e),A&&e.key===`Escape`&&!B&&H(!1)},"aria-label":w,form:P,disabled:j,...M===void 0?null:{readOnly:M},...I}),!j&&!M&&/* @__PURE__ */ f(`button`,{type:`button`,className:`search-clear`,"aria-label":T,onClick:q,hidden:!B,children:/* @__PURE__ */ f(r,{name:`x`,size:16})})]})}export{g as default};
@@ -1 +1 @@
1
- import{devWarn as e}from"../lib/devWarn.js";import{linkTarget as t}from"../lib/linkTarget.js";import{navMatchScore as n}from"../lib/navMatch.js";import{SHELL_FOLDED_COOKIE as r,readNavFolded as i,readShellCollapsed as a,writeNavFolded as o,writeShellCollapsed as s}from"../lib/shellCookie.js";import{TargetLink as c}from"../lib/TargetLink.js";import l from"../lib/useElementEntry.js";import u from"../lib/useWuiText.js";import{TONES as d}from"../lib/vocabulary.js";import{splitMarkerProps as f}from"../lib/wuiMarker.js";import p from"./AppAvatar.js";import m from"./AppButton.js";import h from"./AppIcon.js";import g from"./AppNavigationMenu.js";import _ from"./assertValidValue.js";import v from"./warnUnknownProps.js";import{initScrollEdges as y,isImeSafeEnter as b,revealActiveNavItem as x,setPopoverOpen as S}from"@webority/ui-elements/helpers";import{useEffect as C,useId as w,useMemo as T,useRef as E,useState as D}from"react";import{Fragment as O,jsx as k,jsxs as A}from"react/jsx-runtime";import{SHELL_TEXT as j,fillText as M}from"@webority/ui-elements/text";var N=()=>import(`@webority/ui-elements/elements/overflow`),P=()=>import(`@webority/ui-elements/elements/dropdown`),F=99,I=4,L=5,R=/^[a-z0-9-]+$/,z=`wui-sidebar-footer`,B=[],V=[`prefix`,`exact`],H=[`comfortable`,`compact`],U=[`neutral`,`primary`],W=[`default`,`brand`],ee=[`side`,`top`],G=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],te=/* @__PURE__ */ new Set([`key`,`label`,`icon`,`iconVariant`,`iconSize`,`href`,`badge`,`badgeTone`,`badgeTitle`,`newUntil`,`trailingIcon`,`active`,`match`,`matchAlso`,`tab`,`tabLabel`,`children`]),K=e=>e>F?`${F}+`:String(e),ne=new Intl.DateTimeFormat(`en-CA`,{timeZone:`Asia/Kolkata`}),q=e=>{if(typeof e!=`string`||!/^\d{4}-\d{2}-\d{2}$/.test(e))return!1;let t=/* @__PURE__ */ new Date(`${e}T00:00:00Z`);return Number.isNaN(t.getTime())||t.toISOString().slice(0,10)!==e?!1:ne.format(/* @__PURE__ */ new Date)<=e},re=({logoLight:e,logoDark:t,markLight:n,markDark:r})=>{let i=!!(n||r);return[`app-sidebar-brand`,i&&`wui-brand-has-mark`,i&&!e&&!t&&`wui-brand-mark-only`,(t||r)&&`wui-brand-themed`].filter(Boolean).join(` `)},ie=({logoLight:e,logoDark:t,markLight:n,markDark:r,brandName:i})=>{let a=i??``,o=[e&&/* @__PURE__ */ k(`img`,{className:`wui-brand-logo wui-brand-light`,src:e,alt:a},`logo-light`),t&&/* @__PURE__ */ k(`img`,{className:`wui-brand-logo wui-brand-dark`,src:t,alt:``,"aria-hidden":`true`},`logo-dark`)],s=[n&&[`mark-light`,`wui-brand-mark wui-brand-light`,n],r&&[`mark-dark`,`wui-brand-mark wui-brand-dark`,r]].filter(e=>!!e).map(([t,n,r],i)=>i===0&&!e?/* @__PURE__ */ k(`img`,{className:n,src:r,alt:a},t):/* @__PURE__ */ k(`img`,{className:n,src:r,alt:``,"aria-hidden":`true`},t));return[...o,...s].filter(Boolean)};function ae(e){let{marker:t,props:n}=f(`AppShell`,e),c=u(`shell`,j),{groups:l=[],brand:d,logoLight:p,logoDark:m,markLight:b,markDark:w,brandName:M,brandHref:N,brandLabel:P,sidebarStart:F,sidebarStartCompact:I,sidebarFooter:L,sidebarFooterItems:R=B,topbarStart:z,topbarEnd:V,footer:te,launcher:K,children:ne,collapsed:q,onCollapsedChange:ae,noSidebar:J=!1,nav:Y=`side`,density:se=`comfortable`,itemHeight:ce,iconVariant:X=`twotone`,topbarTone:he=`neutral`,tone:ve=`default`,navLabel:be=c.navLabel,linkComponent:Z,currentPath:xe,rememberCollapsed:Se=!1,collapsedCookie:Ce=`wui-shell-collapsed`,foldedCookie:we=r,tabBarLabel:Te=c.tabBarLabel,moreLabel:Ee=c.moreLabel,skipLabel:De=c.skipLabel,openNavLabel:Oe=c.openNavLabel,expandNavLabel:ke=c.expandNavLabel,collapseNavLabel:Ae=c.collapseNavLabel,newLabel:je=c.newLabel,togglePagesLabel:Me=c.togglePagesLabel,accountMenuLabel:Ne=c.accountMenuLabel,roleLabel:Pe=c.roleLabel,rolesLabel:Fe=c.rolesLabel,unreadLabel:Ie=c.unreadLabel,markAllReadLabel:Le=c.markAllReadLabel,viewAllLabel:Re=c.viewAllLabel,loadingNotificationsText:ze=c.loadingNotificationsText,noUnreadText:Be=c.noUnreadText,unreadNotificationsText:Ve=c.unreadNotificationsText,unreadBellLabel:He=c.unreadBellLabel,searchResultsLabel:Ue=c.searchResultsLabel,noResultsText:We=c.noResultsText,noResultsForText:Ge=c.noResultsForText,resultsCountText:Ke=c.resultsCountText,resultCountText:qe=c.resultCountText,userMenu:Je,notifications:Ye,search:Xe,className:Ze=``,style:Qe,...$e}=n;if(v(`AppShell`,$e),_(`AppShell`,`density`,se,H),_(`AppShell`,`topbarTone`,he,U),_(`AppShell`,`tone`,ve,W),_(`AppShell`,`nav`,Y,ee),_(`AppShell`,`iconVariant`,X,G),P!==void 0&&!N)throw Error(`<AppShell> brandLabel names the brand link, so it needs brandHref.`);if(N){if(!P&&!M)throw Error(`<AppShell> brandHref needs brandLabel or brandName: the collapsed rail hides the logo, so the link would have no accessible name.`);if(!(d||p||m||b||w))throw Error(`<AppShell> brandHref has no brand, logo or mark to link.`)}let et=(ce??0)>0?{...Qe,"--wui-nav-item-height":`${ce}px`}:Qe,[tt,nt]=D(()=>Se&&q===void 0&&typeof document<`u`?a(Ce)??!1:!1),[rt,Q]=D(!1),it=E(null),[at,ot]=D(!1),[st,ct]=D(!1),lt=E(null),ut=q??tt,dt=e=>N?/* @__PURE__ */ k(de,{href:N,label:P||M,linkComponent:Z,onNavigate:()=>Q(!1),children:e}):e,ft=()=>{let e=!ut;q===void 0&&nt(e),Se&&s(e,Ce),ae?.(e)},pt=l.some(e=>e.collapsible),[mt,ht]=D(()=>pt&&typeof document<`u`?i(we):/* @__PURE__ */ new Set),gt=e=>{let t=new Set(mt);t.has(e)?t.delete(e):t.add(e),ht(t),o(t,we)},_t=T(()=>oe(l,R,xe),[l,R,xe]),$=_t.groups,vt=_t.footer,yt=J?null:le($,vt.some(e=>e.active));C(()=>{let e=()=>ot(window.scrollY>4);return e(),window.addEventListener(`scroll`,e,{passive:!0}),()=>window.removeEventListener(`scroll`,e)},[]),C(()=>{y()},[]),C(()=>{x(lt.current)},[]),C(()=>{let e=lt.current;if(!e)return;let t=()=>ct($.length>0&&e.scrollHeight>e.clientHeight);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[$]),C(()=>{let e=it.current;if(!e)return;let t=window.matchMedia(`(max-width: 991.98px)`),n=()=>{t.matches?e.setAttribute(`popover`,`auto`):(e.removeAttribute(`popover`),Q(!1))},r=e=>Q(`newState`in e&&e.newState===`open`);return n(),t.addEventListener(`change`,n),e.addEventListener(`toggle`,r),()=>{t.removeEventListener(`change`,n),e.removeEventListener(`toggle`,r)}},[]),C(()=>{let e=it.current;e?.hasAttribute(`popover`)&&S(e,rt)},[rt]);let bt=[`app-shell`,ut?`collapsed`:``,J?`no-sidebar`:``,Y===`top`?`wui-shell-top`:``,rt?`mobile-open`:``,Ze].filter(Boolean).join(` `);return/* @__PURE__ */ A(`div`,{className:bt,"data-density":se===`compact`?`compact`:void 0,"data-shell-tone":ve===`brand`?`brand`:void 0,"data-wui-folded-cookie":pt?we:void 0,style:et,...t,...$e,children:[/* @__PURE__ */ k(`a`,{className:`wui-skip-link`,href:`#main-content`,children:De}),/* @__PURE__ */ A(`aside`,{className:`app-sidebar`,ref:it,children:[(d||p||m||b||w)&&/* @__PURE__ */ k(`div`,{className:re({logoLight:p,logoDark:m,markLight:b,markDark:w}),children:dt(/* @__PURE__ */ A(O,{children:[ie({logoLight:p,logoDark:m,markLight:b,markDark:w,brandName:M}),d]}))}),F&&/* @__PURE__ */ k(`div`,{className:`app-sidebar-start`,children:F}),I&&/* @__PURE__ */ k(`div`,{className:`app-sidebar-start-compact`,children:I}),/* @__PURE__ */ k(`nav`,{className:`app-sidebar-scroll`,"aria-label":be,ref:lt,tabIndex:st?0:void 0,children:$.map((e,t)=>{let n=e.items.map(e=>e.header==null?/* @__PURE__ */ k(me,{item:e,linkComponent:Z,onNavigate:()=>Q(!1),iconVariant:X,newLabel:je,togglePagesLabel:Me},e.key??e.href??e.label):/* @__PURE__ */ k(`div`,{className:`wui-nav-header`,children:e.header},e.key??e.header));if(!e.collapsible)return/* @__PURE__ */ A(`div`,{className:`app-nav-group`,children:[e.label&&/* @__PURE__ */ k(`div`,{className:`app-nav-group-label`,children:e.label}),n,e.after&&/* @__PURE__ */ k(`div`,{className:`wui-nav-group-after`,children:e.after})]},e.key??e.label??`group-${t}`);let r=!mt.has(e.key??``)||!!pe(e.items),i=`wui-nav-group-${e.key}`;return/* @__PURE__ */ A(`div`,{className:`app-nav-group wui-nav-group-collapsible${r?``:` wui-nav-group-folded`}`,"data-wui-nav-group":e.key,children:[/* @__PURE__ */ A(`button`,{type:`button`,className:`app-nav-group-label wui-nav-group-toggle`,"aria-expanded":r,"aria-controls":i,onClick:()=>gt(e.key??``),children:[/* @__PURE__ */ k(`span`,{className:`wui-nav-group-text`,children:e.label}),/* @__PURE__ */ k(`span`,{className:`wui-nav-group-caret`,children:/* @__PURE__ */ k(h,{name:`chevron-down`,size:16})})]}),/* @__PURE__ */ A(`div`,{className:`wui-nav-group-body`,id:i,children:[n,e.after&&/* @__PURE__ */ k(`div`,{className:`wui-nav-group-after`,children:e.after})]})]},e.key??`group-${t}`)})}),(L||vt.length>0)&&/* @__PURE__ */ A(`div`,{className:`app-sidebar-foot`,children:[vt.length>0&&/* @__PURE__ */ k(`div`,{className:`wui-sidebar-foot-links`,children:vt.map(e=>/* @__PURE__ */ k(me,{item:e,linkComponent:Z,onNavigate:()=>Q(!1),iconVariant:X,newLabel:je,togglePagesLabel:Me},e.key??e.href??e.label))}),L]}),!J&&/* @__PURE__ */ k(`button`,{type:`button`,className:`app-sidebar-toggle`,onClick:ft,"aria-label":ut?ke:Ae,"aria-expanded":!ut,children:/* @__PURE__ */ k(h,{name:`chevrons-left`,size:20})})]}),/* @__PURE__ */ A(`div`,{className:`app-main`,children:[/* @__PURE__ */ A(`header`,{className:`app-topbar${at?` wui-scrolled`:``}`,"data-tone":he===`primary`?`primary`:void 0,children:[/* @__PURE__ */ A(`div`,{className:`app-topbar-start`,children:[/* @__PURE__ */ k(`button`,{type:`button`,className:`app-topbar-menu`,onClick:()=>Q(!0),"aria-label":Oe,"aria-expanded":rt,children:/* @__PURE__ */ k(h,{name:`menu`,size:18})}),Y===`top`&&d&&/* @__PURE__ */ k(`div`,{className:`wui-shell-top-brand`,children:dt(d)}),Y===`top`&&/* @__PURE__ */ k(`div`,{className:`wui-shell-top-nav`,children:/* @__PURE__ */ k(g,{items:ue($),ariaLabel:be,linkComponent:Z})}),z,Xe&&/* @__PURE__ */ k(ye,{config:Xe,searchResultsLabel:Ue,noResultsText:We,noResultsForText:Ge,resultsCountText:Ke,resultCountText:qe,moreLabel:Ee})]}),/* @__PURE__ */ A(`div`,{className:`app-topbar-end`,children:[V,Ye&&/* @__PURE__ */ k(_e,{config:Ye,unreadLabel:Ie,markAllReadLabel:Le,viewAllLabel:Re,loadingNotificationsText:ze,noUnreadText:Be,unreadNotificationsText:Ve,unreadBellLabel:He}),Je&&/* @__PURE__ */ k(ge,{config:Je,linkComponent:Z,accountMenuLabel:Ne,roleLabel:Pe,rolesLabel:Fe})]})]}),/* @__PURE__ */ k(`main`,{className:`app-content`,id:`main-content`,children:ne}),te&&/* @__PURE__ */ k(`footer`,{className:`app-footer`,children:te})]}),K&&/* @__PURE__ */ k(`div`,{className:`wui-shell-launcher`,children:K}),yt&&/* @__PURE__ */ A(`nav`,{className:`wui-tabbar`,"aria-label":Te,children:[yt.tabs.map(e=>/* @__PURE__ */ k(fe,{tab:e,linkComponent:Z,iconVariant:X},e.key??e.href)),yt.hasMore&&/* @__PURE__ */ A(`button`,{type:`button`,className:`wui-tabbar-item${yt.moreActive?` active`:``}`,onClick:()=>Q(!0),children:[/* @__PURE__ */ k(`span`,{className:`wui-tabbar-icon`,children:/* @__PURE__ */ k(h,{name:`more`,size:24})}),/* @__PURE__ */ k(`span`,{className:`wui-tabbar-label`,children:Ee})]})]})]})}function oe(e,t,r){let i=t;for(let e of i){if(e.children?.length)throw Error(`<AppShell> sidebarFooterItems cannot hold children; keep footer links flat.`);if(e.tab)throw Error(`<AppShell> sidebarFooterItems cannot carry tab: true; the phone tab bar is built from groups.`);if(e.header!=null)throw Error(`<AppShell> sidebarFooterItems cannot hold a header row.`)}for(let t of e)t.collapsible&&X(t);let a=(e,t=!1)=>(e??[]).map(e=>Array.isArray(e.children)?{...e,children:a(e.children)}:{...e}).filter(e=>Y(e)?t:(e.children?.length??0)>0||!!e.href),o=[...e,{key:z,items:t}].map(e=>({...e,items:se(a(e.items,!0))})).filter(e=>e.items.some(e=>!Y(e))),s=[],c=e=>{for(let t of e)Y(t)||(s.push(t),t.children&&c(t.children))};for(let e of o)c(e.items);for(let e of s)v(`AppShell items`,J(e)),_(`AppShell`,`match`,e.match,V),_(`AppShell`,`iconVariant`,e.iconVariant,G),_(`AppShell`,`badgeTone`,e.badgeTone,d);let l=null;if(r!=null&&!s.some(e=>e.active===!0)){let e=-1;for(let t of s){if(t.active!=null||t.children?.length&&!t.href)continue;let i=n(r,t.href,{exact:t.match===`exact`,also:t.matchAlso});if(i<0)continue;let a=t.match===`exact`&&n(r,t.href,{exact:!0})>=0?1/0:i;a>e&&(e=a,l=t)}}for(let e of s)e.active=e.active??e===l;return{groups:o.filter(e=>e.key!==z),footer:o.find(e=>e.key===z)?.items??[]}}function J(e){return Object.fromEntries(Object.entries(e).filter(([e])=>!te.has(e)))}var Y=e=>e.header!=null;function se(e){return e.filter((t,n)=>{if(!Y(t))return!0;let r=e.findIndex((e,t)=>t>n&&Y(e));return e.slice(n+1,r<0?void 0:r).length>0})}var ce=/* @__PURE__ */ new Set;function X(t){if(t.key!=null&&R.test(t.key))return;let n=t.key==null?`<AppShell> a collapsible group needs a key so its folded state can be remembered.`:`<AppShell> collapsible group key "${t.key}" must use lower-case letters, digits and hyphens.`;typeof process<`u`&&process.env.NODE_ENV===`production`||ce.has(n)||(ce.add(n),e(n))}function le(e,t){let n=[],r=e=>{for(let t of e)Y(t)||(t.children?.length?r(t.children):n.push(t))};for(let t of e)r(t.items);let i=n.filter(e=>e.tab);if(i.length===0)return null;let a=i.length<n.length,o=a?I:L;if(i.length>o)throw Error(`<AppShell>: ${i.length} items carry tab: true, but the phone tab bar holds ${o} (${a?`4 plus More, because other items exist`:`5 when every item is a tab`}). Flag fewer items.`);return{tabs:i,hasMore:a,moreActive:t||n.some(e=>!e.tab&&e.active)}}function ue(e){let t=e=>{if(e.label===void 0)throw Error(`<AppShell> a navigation row has no label; every row but a header needs one.`);return e.label},n=e=>e.key??e.href??t(e),r=(e,r)=>({key:n(e),label:t(e),to:r,current:!!e.active}),i=e=>e.flatMap(e=>Y(e)?[]:[...e.href?[{...r(e,e.href),icon:e.icon}]:[],...i(e.children??[])]),a=[];for(let o of e.flatMap(e=>e.items)){if(Y(o))continue;let e=i(o.children??[]);if(e.length>0){let i=o.href?[{...r(o,o.href),icon:o.icon}]:[];a.push({key:n(o),label:t(o),links:[...i,...e]})}else o.href&&a.push(r(o,o.href))}return a}function de({href:e,label:n,linkComponent:r,onNavigate:i,children:a}){return/* @__PURE__ */ k(c,{link:t(r,{to:e}),className:`wui-brand-link`,"aria-label":n,onClick:i,children:a})}function fe({tab:e,linkComponent:n,iconVariant:r}){let i=`wui-tabbar-item${e.active?` active`:``}`,a=/* @__PURE__ */ A(O,{children:[e.icon&&/* @__PURE__ */ k(`span`,{className:`wui-tabbar-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ k(h,{name:e.icon,size:24,variant:e.iconVariant??r}):e.icon}),/* @__PURE__ */ k(`span`,{className:`wui-tabbar-label`,children:e.tabLabel??e.label}),e.badge!=null&&/* @__PURE__ */ k(`span`,{className:`wui-tabbar-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:e.badge})]}),o=e.active?`page`:void 0;return/* @__PURE__ */ k(c,{link:t(n,{to:e.href}),className:i,"aria-current":o,children:a})}function pe(e){for(let t of e){if(t.active)return t;let e=t.children?.length?pe(t.children):void 0;if(e)return e}}function me({item:e,linkComponent:n,onNavigate:r,depth:i=0,iconVariant:a,newLabel:o,togglePagesLabel:s}){let l=i>0,u=i>1?` wui-nav-depth-${Math.min(i,6)}`:``,d=Array.isArray(e.children)&&e.children.length>0,f=d?pe(e.children??[]):void 0,p=!!f,m=f?f.key??f.href??f.label:null,[g,_]=D(p);C(()=>{m!=null&&_(!0)},[m]);let v=typeof e.label==`string`?e.label:void 0,y=!l&&e.icon&&/* @__PURE__ */ k(`span`,{className:`app-nav-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ k(h,{name:e.icon,size:e.iconSize??22,variant:e.iconVariant??a}):e.icon}),b=e.badge!=null&&/* @__PURE__ */ k(`span`,{className:`app-nav-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:e.badge}),x=q(e.newUntil)&&/* @__PURE__ */ k(`span`,{className:`wui-nav-new`,children:o}),S=/* @__PURE__ */ A(O,{children:[y,/* @__PURE__ */ k(`span`,{className:`app-nav-text`,children:e.label}),x,b,e.trailingIcon&&/* @__PURE__ */ k(`span`,{className:`app-nav-trailing`,children:typeof e.trailingIcon==`string`?/* @__PURE__ */ k(h,{name:e.trailingIcon,size:16}):e.trailingIcon})]}),w=e.active?`page`:void 0;if(d){let d=/* @__PURE__ */ k(`div`,{className:`app-nav-sub${g?` expanded`:``}`,inert:!g,"aria-hidden":!g||void 0,children:/* @__PURE__ */ k(`div`,{className:`app-nav-sub-inner`,children:(e.children??[]).map(e=>/* @__PURE__ */ k(me,{item:e,linkComponent:n,onNavigate:r,depth:i+1,iconVariant:a,newLabel:o,togglePagesLabel:s},e.key??e.href))})});if(e.href){let i=/* @__PURE__ */ k(c,{link:t(n,{to:e.href}),className:`wui-nav-split-link`,"aria-current":w,onClick:r,children:S});return/* @__PURE__ */ A(O,{children:[/* @__PURE__ */ A(`div`,{className:`app-nav-item has-children wui-nav-split${l?` app-nav-subitem`:``}${p||e.active?` active`:``}${u}`,"data-label":v,children:[i,/* @__PURE__ */ k(`button`,{type:`button`,className:`app-nav-caret wui-nav-split-toggle`,"aria-expanded":g,"aria-label":M(s,{name:v??``}),onClick:()=>_(e=>!e),children:/* @__PURE__ */ k(h,{name:`chevron-right`,size:16})})]}),d]})}return/* @__PURE__ */ A(O,{children:[/* @__PURE__ */ A(`button`,{type:`button`,className:`app-nav-item${l?` app-nav-subitem`:``} has-children${p?` active`:``}${u}`,"aria-expanded":g,"data-label":v,onClick:()=>_(e=>!e),children:[y,/* @__PURE__ */ k(`span`,{className:`app-nav-text`,children:e.label}),x,b,/* @__PURE__ */ k(`span`,{className:`app-nav-caret`,children:/* @__PURE__ */ k(h,{name:`chevron-right`,size:16})})]}),d]})}let T=`app-nav-item${l?` app-nav-subitem`:``}${e.active?` active`:``}${u}`;return/* @__PURE__ */ k(c,{link:t(n,{to:e.href}),className:T,"aria-current":w,"data-label":v,onClick:r,children:S})}function he(e){l(`wui-dropdown`,P);let[t,n]=D(!1),r=E(null);return C(()=>{r.current?.toggleAttribute(`open`,t)},[t]),C(()=>{let t=r.current;if(!t)return;let i=r=>{if(r.target!==t||!(`detail`in r)||!r.detail||typeof r.detail!=`object`)return;let i=`open`in r.detail&&r.detail.open===!0;n(i),i&&e?.()};return t.addEventListener(`wui-dropdown-toggle`,i),()=>t.removeEventListener(`wui-dropdown-toggle`,i)},[e]),{open:t,setOpen:n,ref:r}}function ge({config:e,linkComponent:n,accountMenuLabel:r,roleLabel:i,rolesLabel:a}){let o=u(`shell`,j),s=w(),{open:l,setOpen:d,ref:f}=he(),{name:g,role:v,roles:y=[],noTriggerRole:b=!1,outlined:x=!1,photo:S,profileHref:C,profileLabel:T=o.profileLabel,onLogout:E,logoutAction:D,logoutLabel:N=o.logoutLabel,head:P,section:F,logoutVariant:I=`item`,items:L=[]}=e;if(_(`AppShell`,`userMenu.logoutVariant`,I,[`item`,`button`]),!g)throw Error(`<AppShell> userMenu.name is required; the trigger and the avatar are named from it.`);let R=y.map(e=>(e??``).trim()).filter(Boolean),z=()=>d(!1),B=(e,r,i,a)=>/* @__PURE__ */ k(c,{link:t(n,{to:e}),className:`dropdown-item`,onClick:a,children:r},i),V=/* @__PURE__ */ k(h,{name:`log-out`,size:18}),H=/* @__PURE__ */ A(O,{children:[V,N]});return/* @__PURE__ */ A(`wui-dropdown`,{class:`dropdown wui-usermenu`,align:`end`,ref:f,children:[/* @__PURE__ */ A(`button`,{type:`button`,id:s,className:x?`wui-usermenu-trigger wui-usermenu-trigger-outlined`:`wui-usermenu-trigger`,"data-wui-dropdown-trigger":!0,"aria-expanded":l,"aria-label":M(r,{name:g}),children:[/* @__PURE__ */ k(p,{name:g,src:S,tone:`auto`}),/* @__PURE__ */ A(`span`,{className:`wui-usermenu-text`,children:[/* @__PURE__ */ k(`span`,{className:`wui-usermenu-name`,children:g}),v&&!b&&/* @__PURE__ */ k(`span`,{className:`wui-usermenu-role`,children:v})]}),/* @__PURE__ */ k(h,{name:`chevron-down`,size:14,className:`wui-usermenu-caret`})]}),/* @__PURE__ */ A(`div`,{"data-wui-dropdown-menu":!0,popover:`auto`,className:`dropdown-menu dropdown-menu-end wui-usermenu-menu${l?` show`:``}`,"aria-labelledby":s,children:[/* @__PURE__ */ A(`div`,{className:`wui-usermenu-head`,children:[/* @__PURE__ */ k(p,{name:g,src:S,size:`lg`,tone:`auto`}),/* @__PURE__ */ A(`div`,{className:`wui-usermenu-who`,children:[/* @__PURE__ */ k(`div`,{className:`wui-usermenu-name`,children:g}),v&&/* @__PURE__ */ k(`div`,{className:`wui-usermenu-role`,children:v}),R.length>0&&/* @__PURE__ */ A(`div`,{className:`wui-usermenu-roles`,children:[/* @__PURE__ */ k(`span`,{className:`wui-usermenu-roles-label`,children:R.length===1?i:a}),` ${R.join(`, `)}`]}),P?/* @__PURE__ */ k(`div`,{className:`wui-usermenu-extra`,children:P}):null]})]}),F?/* @__PURE__ */ k(`div`,{className:`wui-usermenu-section`,children:F}):null,C&&B(C,/* @__PURE__ */ A(O,{children:[/* @__PURE__ */ k(h,{name:`user`,size:18}),T]}),void 0,z),L.map(e=>{if(e.divider)return/* @__PURE__ */ k(`hr`,{className:`dropdown-divider`},e.key);let t=/* @__PURE__ */ A(O,{children:[e.icon&&/* @__PURE__ */ k(h,{name:e.icon,size:18}),e.label]}),n=()=>{e.onClick?.(),z()};return e.href?B(e.href,t,e.key,n):/* @__PURE__ */ k(`button`,{type:`button`,className:`dropdown-item`,onClick:n,children:t},e.key)}),I===`button`?(D||E)&&/* @__PURE__ */ k(`div`,{className:`wui-usermenu-foot`,children:D?/* @__PURE__ */ k(`form`,{method:`post`,action:D,className:`wui-usermenu-logout`,children:/* @__PURE__ */ k(m,{type:`submit`,tone:`danger`,variant:`soft`,block:!0,leftIcon:V,children:N})}):/* @__PURE__ */ k(m,{type:`button`,tone:`danger`,variant:`soft`,block:!0,leftIcon:V,onClick:()=>{z(),E?.()},children:N})}):D?/* @__PURE__ */ k(`form`,{method:`post`,action:D,className:`wui-usermenu-logout`,children:/* @__PURE__ */ k(`button`,{type:`submit`,className:`dropdown-item danger`,children:H})}):E&&/* @__PURE__ */ k(`button`,{type:`button`,className:`dropdown-item danger`,onClick:()=>{z(),E()},children:H})]})]})}function _e({config:e,unreadLabel:t,markAllReadLabel:n,viewAllLabel:r,loadingNotificationsText:i,noUnreadText:a,unreadNotificationsText:o,unreadBellLabel:s}){let c=u(`shell`,j),l=w(),{open:d,ref:f}=he(e.onOpen),{unread:p=0,items:m,loading:g=!1,onMarkAllRead:_,viewAllHref:v,label:y=c.label,emptyText:b=c.emptyText}=e,[x,S]=D(``),T=E(p);C(()=>{T.current!==p&&(T.current=p,S(p===0?a:M(o,{count:K(p)})))},[p,a,o]);let N=null;return m?.length?N=/* @__PURE__ */ k(`div`,{className:`wui-bell-items`,children:m.map((e,n)=>{let r=`wui-bell-item${e.read?` wui-bell-item-read`:``}`,i=/* @__PURE__ */ A(O,{children:[/* @__PURE__ */ k(`span`,{className:`wui-bell-dot`,"aria-hidden":`true`}),e.icon&&/* @__PURE__ */ k(`span`,{className:`wui-bell-icon`,children:/* @__PURE__ */ k(h,{name:e.icon,size:18})}),/* @__PURE__ */ A(`span`,{className:`wui-bell-body`,children:[!e.read&&/* @__PURE__ */ A(`span`,{className:`visually-hidden`,children:[t,`: `]}),/* @__PURE__ */ k(`span`,{className:`wui-bell-item-title`,children:e.title}),e.time&&/* @__PURE__ */ k(`span`,{className:`wui-bell-when`,children:e.time})]})]});return e.href?/* @__PURE__ */ k(`a`,{className:r,href:e.href,"data-id":e.id,children:i},e.id??n):/* @__PURE__ */ k(`div`,{className:r,"data-id":e.id,children:i},e.id??n)})}):g?N=/* @__PURE__ */ k(`div`,{className:`wui-bell-state`,children:i}):m&&(N=/* @__PURE__ */ k(`div`,{className:`wui-bell-state`,children:b})),/* @__PURE__ */ A(`wui-dropdown`,{class:`dropdown wui-bell`,align:`end`,ref:f,children:[/* @__PURE__ */ A(`button`,{type:`button`,id:l,className:`topbar-icon-btn wui-bell-trigger`,"data-wui-dropdown-trigger":!0,"aria-expanded":d,"aria-label":p===0?y:M(s,{label:y,count:K(p)}),children:[/* @__PURE__ */ k(h,{name:`notification`,size:20}),/* @__PURE__ */ k(`span`,{className:`wui-bell-count`,"aria-hidden":`true`,hidden:p===0,children:K(p)})]}),/* @__PURE__ */ k(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:x}),/* @__PURE__ */ A(`div`,{"data-wui-dropdown-menu":!0,popover:`auto`,className:`dropdown-menu dropdown-menu-end wui-bell-menu${d?` show`:``}`,"aria-labelledby":l,children:[/* @__PURE__ */ A(`div`,{className:`wui-bell-head`,children:[/* @__PURE__ */ k(`span`,{className:`wui-bell-title`,children:y}),_&&/* @__PURE__ */ k(`button`,{type:`button`,className:`wui-bell-markall`,onClick:_,children:n})]}),/* @__PURE__ */ k(`div`,{className:`wui-bell-list`,"aria-busy":g||void 0,children:N}),v&&/* @__PURE__ */ k(`a`,{className:`wui-bell-foot`,href:v,children:r})]})]})}var ve=e=>!!e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName));function ye({config:e,searchResultsLabel:t,noResultsText:n,noResultsForText:r,resultsCountText:i,resultCountText:a,moreLabel:o}){l(`wui-overflow`,N);let s=u(`shell`,j),c=w(),{value:d=``,onChange:f,results:p=null,loading:m=!1,onSelect:g,onSubmit:_,onFocus:v,placeholder:y=s.placeholder}=e,[x,S]=D(!1),[O,P]=D(!1),[F,I]=D({results:null,index:-1}),L=F.results===p?F.index:-1,R=e=>I({results:p,index:e}),z=E(null),B=E(null),V=E([]),H=T(()=>(p??[]).flatMap(e=>e.hits??[]),[p]),U=p!=null&&!O,W=H.length;C(()=>{let e=e=>{e.key!==`/`||e.ctrlKey||e.metaKey||e.altKey||ve(e.target instanceof HTMLElement?e.target:null)||(e.preventDefault(),S(!0),B.current?.focus())},t=e=>{z.current?.contains(e.target instanceof Node?e.target:null)||(P(!0),S(!1))};return document.addEventListener(`keydown`,e),document.addEventListener(`pointerdown`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`pointerdown`,t)}},[]);let ee=e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(!U||W===0)return;e.preventDefault(),R((L+(e.key===`ArrowDown`?1:-1)+W)%W)}else b(e.nativeEvent)?U&&L>=0&&V.current[L]?(e.preventDefault(),V.current[L].click()):_&&d.trim()!==``&&(e.preventDefault(),_(d.trim())):e.key===`Escape`&&(U?(e.preventDefault(),P(!0)):x&&(e.preventDefault(),S(!1)))},G=-1;return V.current=[],/* @__PURE__ */ k(`wui-overflow`,{class:`wui-topsearch-host`,label:o,children:/* @__PURE__ */ k(`div`,{"data-wui-overflow-list":!0,className:`wui-topsearch-row`,children:/* @__PURE__ */ A(`div`,{className:`wui-topsearch${x?` is-open`:``}${m?` is-loading`:``}`,ref:z,"data-overflow-label":y,children:[/* @__PURE__ */ k(`button`,{type:`button`,className:`topbar-icon-btn wui-topsearch-open`,"aria-label":y,"aria-expanded":x,"aria-controls":`${c}-panel`,onClick:()=>{let e=!x;S(e),e&&B.current?.focus()},children:/* @__PURE__ */ k(h,{name:`search`,size:20})}),/* @__PURE__ */ A(`div`,{className:`wui-topsearch-panel`,id:`${c}-panel`,children:[/* @__PURE__ */ A(`div`,{className:`search-wrap`,children:[/* @__PURE__ */ k(h,{name:`search`,size:18,className:`search-icon`}),/* @__PURE__ */ k(`input`,{ref:B,type:`search`,className:`form-control input search-input`,id:`${c}-input`,placeholder:y,"aria-label":y,role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":U,"aria-controls":`${c}-list`,"aria-activedescendant":U&&L>=0?`${c}-opt-${L}`:void 0,autoComplete:`off`,value:d,onChange:e=>{P(!1),f?.(e.target.value)},onKeyDown:ee,onFocus:v})]}),/* @__PURE__ */ k(`div`,{className:`wui-topsearch-results`,id:`${c}-list`,role:`listbox`,"aria-label":t,hidden:!U,children:U&&/* @__PURE__ */ A(`div`,{className:`wui-topsearch-groups`,role:`presentation`,children:[W===0&&/* @__PURE__ */ k(`div`,{className:`wui-topsearch-empty`,role:`option`,"aria-disabled":`true`,"aria-selected":`false`,children:M(r,{value:d})}),p.filter(e=>e.hits?.length).map((e,t)=>/* @__PURE__ */ A(`div`,{className:`wui-topsearch-group`,role:`group`,"aria-label":e.label??``,children:[e.label&&/* @__PURE__ */ k(`div`,{className:`wui-topsearch-group-label`,role:`presentation`,children:e.label}),e.hits.map(e=>{G+=1;let t=G;return/* @__PURE__ */ A(`a`,{className:`wui-topsearch-hit${t===L?` is-active`:``}`,role:`option`,"aria-selected":t===L,id:`${c}-opt-${t}`,href:e.href,ref:e=>{V.current[t]=e},onClick:t=>g?.(e,t),children:[e.icon&&/* @__PURE__ */ k(`span`,{className:`wui-topsearch-hit-icon`,children:/* @__PURE__ */ k(h,{name:e.icon,size:18})}),/* @__PURE__ */ A(`span`,{className:`wui-topsearch-hit-text`,children:[/* @__PURE__ */ k(`span`,{className:`wui-topsearch-hit-title`,children:e.title}),e.subtitle&&/* @__PURE__ */ k(`span`,{className:`wui-topsearch-hit-sub`,children:e.subtitle})]})]},`${e.href}-${t}`)})]},e.label??t))]})})]}),/* @__PURE__ */ k(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:U?W===0?n:M(W===1?a:i,{count:W}):``})]})})})}export{ae as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";import{linkTarget as t}from"../lib/linkTarget.js";import{navMatchScore as n}from"../lib/navMatch.js";import{SHELL_FOLDED_COOKIE as r,readNavFolded as i,readShellCollapsed as a,writeNavFolded as o,writeShellCollapsed as s}from"../lib/shellCookie.js";import{TargetLink as c}from"../lib/TargetLink.js";import l from"../lib/useElementEntry.js";import u from"../lib/useWuiText.js";import{TONES as d}from"../lib/vocabulary.js";import{splitMarkerProps as f}from"../lib/wuiMarker.js";import p from"./AppAvatar.js";import m from"./AppButton.js";import h from"./AppIcon.js";import g from"./AppNavigationMenu.js";import _ from"./assertValidValue.js";import v from"./warnUnknownProps.js";import{IST_TIME_ZONE as y,initScrollEdges as b,isImeSafeEnter as x,revealActiveNavItem as S,setPopoverOpen as C}from"@webority/ui-elements/helpers";import{useEffect as w,useId as T,useMemo as E,useRef as D,useState as O}from"react";import{Fragment as k,jsx as A,jsxs as j}from"react/jsx-runtime";import{SHELL_TEXT as ee,fillText as M}from"@webority/ui-elements/text";var N=()=>import(`@webority/ui-elements/elements/overflow`),P=()=>import(`@webority/ui-elements/elements/dropdown`),F=99,I=4,L=5,R=/^[a-z0-9-]+$/,z=`wui-sidebar-footer`,B=[],V=[`prefix`,`exact`],H=[`comfortable`,`compact`],U=[`neutral`,`primary`],te=[`default`,`brand`],ne=[`side`,`top`],re=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],ie=/* @__PURE__ */ new Set([`key`,`label`,`icon`,`iconVariant`,`iconSize`,`href`,`badge`,`badgeTone`,`badgeTitle`,`newUntil`,`trailingIcon`,`active`,`match`,`matchAlso`,`tab`,`tabLabel`,`children`]),W=e=>e>F?`${F}+`:String(e),G=new Intl.DateTimeFormat(`en-CA`,{timeZone:y}),ae=e=>{if(typeof e!=`string`||!/^\d{4}-\d{2}-\d{2}$/.test(e))return!1;let t=/* @__PURE__ */ new Date(`${e}T00:00:00Z`);return Number.isNaN(t.getTime())||t.toISOString().slice(0,10)!==e?!1:G.format(/* @__PURE__ */ new Date)<=e},oe=({logoLight:e,logoDark:t,markLight:n,markDark:r})=>{let i=!!(n||r);return[`app-sidebar-brand`,i&&`wui-brand-has-mark`,i&&!e&&!t&&`wui-brand-mark-only`,(t||r)&&`wui-brand-themed`].filter(Boolean).join(` `)},se=({logoLight:e,logoDark:t,markLight:n,markDark:r,brandName:i})=>{let a=i??``,o=[e&&/* @__PURE__ */ A(`img`,{className:`wui-brand-logo wui-brand-light`,src:e,alt:a},`logo-light`),t&&/* @__PURE__ */ A(`img`,{className:`wui-brand-logo wui-brand-dark`,src:t,alt:``,"aria-hidden":`true`},`logo-dark`)],s=[n&&[`mark-light`,`wui-brand-mark wui-brand-light`,n],r&&[`mark-dark`,`wui-brand-mark wui-brand-dark`,r]].filter(e=>!!e).map(([t,n,r],i)=>i===0&&!e?/* @__PURE__ */ A(`img`,{className:n,src:r,alt:a},t):/* @__PURE__ */ A(`img`,{className:n,src:r,alt:``,"aria-hidden":`true`},t));return[...o,...s].filter(Boolean)};function K(e){let{marker:t,props:n}=f(`AppShell`,e),c=u(`shell`,ee),{groups:l=[],brand:d,logoLight:p,logoDark:m,markLight:y,markDark:x,brandName:T,brandHref:M,brandLabel:N,sidebarStart:P,sidebarStartCompact:F,sidebarFooter:I,sidebarFooterItems:L=B,topbarStart:R,topbarEnd:z,footer:V,launcher:ie,children:W,collapsed:G,onCollapsedChange:ae,noSidebar:K=!1,nav:q=`side`,density:J=`comfortable`,itemHeight:le,iconVariant:Y=`twotone`,topbarTone:ue=`neutral`,tone:X=`default`,navLabel:ye=c.navLabel,linkComponent:Z,currentPath:xe,rememberCollapsed:Se=!1,collapsedCookie:Ce=`wui-shell-collapsed`,foldedCookie:we=r,tabBarLabel:Te=c.tabBarLabel,moreLabel:Ee=c.moreLabel,skipLabel:De=c.skipLabel,openNavLabel:Oe=c.openNavLabel,expandNavLabel:ke=c.expandNavLabel,collapseNavLabel:Ae=c.collapseNavLabel,newLabel:je=c.newLabel,togglePagesLabel:Me=c.togglePagesLabel,accountMenuLabel:Ne=c.accountMenuLabel,roleLabel:Pe=c.roleLabel,rolesLabel:Fe=c.rolesLabel,unreadLabel:Ie=c.unreadLabel,markAllReadLabel:Le=c.markAllReadLabel,viewAllLabel:Re=c.viewAllLabel,loadingNotificationsText:ze=c.loadingNotificationsText,noUnreadText:Be=c.noUnreadText,unreadNotificationsText:Ve=c.unreadNotificationsText,unreadBellLabel:He=c.unreadBellLabel,searchResultsLabel:Ue=c.searchResultsLabel,noResultsText:We=c.noResultsText,noResultsForText:Ge=c.noResultsForText,resultsCountText:Ke=c.resultsCountText,resultCountText:qe=c.resultCountText,userMenu:Je,notifications:Ye,search:Xe,className:Ze=``,style:Qe,...$e}=n;if(v(`AppShell`,$e),_(`AppShell`,`density`,J,H),_(`AppShell`,`topbarTone`,ue,U),_(`AppShell`,`tone`,X,te),_(`AppShell`,`nav`,q,ne),_(`AppShell`,`iconVariant`,Y,re),N!==void 0&&!M)throw Error(`<AppShell> brandLabel names the brand link, so it needs brandHref.`);if(M){if(!N&&!T)throw Error(`<AppShell> brandHref needs brandLabel or brandName: the collapsed rail hides the logo, so the link would have no accessible name.`);if(!(d||p||m||y||x))throw Error(`<AppShell> brandHref has no brand, logo or mark to link.`)}let et=(le??0)>0?{...Qe,"--wui-nav-item-height":`${le}px`}:Qe,[tt,nt]=O(()=>Se&&G===void 0&&typeof document<`u`?a(Ce)??!1:!1),[rt,Q]=O(!1),it=D(null),[at,ot]=O(!1),[st,ct]=O(!1),lt=D(null),ut=G??tt,dt=e=>M?/* @__PURE__ */ A(pe,{href:M,label:N||T,linkComponent:Z,onNavigate:()=>Q(!1),children:e}):e,ft=()=>{let e=!ut;G===void 0&&nt(e),Se&&s(e,Ce),ae?.(e)},pt=l.some(e=>e.collapsible),[mt,ht]=O(()=>pt&&typeof document<`u`?i(we):/* @__PURE__ */ new Set),gt=e=>{let t=new Set(mt);t.has(e)?t.delete(e):t.add(e),ht(t),o(t,we)},_t=E(()=>ce(l,L,xe),[l,L,xe]),$=_t.groups,vt=_t.footer,yt=K?null:de($,vt.some(e=>e.active));w(()=>{let e=()=>ot(window.scrollY>4);return e(),window.addEventListener(`scroll`,e,{passive:!0}),()=>window.removeEventListener(`scroll`,e)},[]),w(()=>{b()},[]),w(()=>{S(lt.current)},[]),w(()=>{let e=lt.current;if(!e)return;let t=()=>ct($.length>0&&e.scrollHeight>e.clientHeight);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[$]),w(()=>{let e=it.current;if(!e)return;let t=window.matchMedia(`(max-width: 991.98px)`),n=()=>{t.matches?e.setAttribute(`popover`,`auto`):(e.removeAttribute(`popover`),Q(!1))},r=e=>Q(`newState`in e&&e.newState===`open`);return n(),t.addEventListener(`change`,n),e.addEventListener(`toggle`,r),()=>{t.removeEventListener(`change`,n),e.removeEventListener(`toggle`,r)}},[]),w(()=>{let e=it.current;e?.hasAttribute(`popover`)&&C(e,rt)},[rt]);let bt=[`app-shell`,ut?`collapsed`:``,K?`no-sidebar`:``,q===`top`?`wui-shell-top`:``,rt?`mobile-open`:``,Ze].filter(Boolean).join(` `);return/* @__PURE__ */ j(`div`,{className:bt,"data-density":J===`compact`?`compact`:void 0,"data-shell-tone":X===`brand`?`brand`:void 0,"data-wui-folded-cookie":pt?we:void 0,style:et,...t,...$e,children:[/* @__PURE__ */ A(`a`,{className:`wui-skip-link`,href:`#main-content`,children:De}),/* @__PURE__ */ j(`aside`,{className:`app-sidebar`,ref:it,children:[(d||p||m||y||x)&&/* @__PURE__ */ A(`div`,{className:oe({logoLight:p,logoDark:m,markLight:y,markDark:x}),children:dt(/* @__PURE__ */ j(k,{children:[se({logoLight:p,logoDark:m,markLight:y,markDark:x,brandName:T}),d]}))}),P&&/* @__PURE__ */ A(`div`,{className:`app-sidebar-start`,children:P}),F&&/* @__PURE__ */ A(`div`,{className:`app-sidebar-start-compact`,children:F}),/* @__PURE__ */ A(`nav`,{className:`app-sidebar-scroll`,"aria-label":ye,ref:lt,tabIndex:st?0:void 0,children:$.map((e,t)=>{let n=e.items.map(e=>e.header==null?/* @__PURE__ */ A(ge,{item:e,linkComponent:Z,onNavigate:()=>Q(!1),iconVariant:Y,newLabel:je,togglePagesLabel:Me},e.key??e.href??e.label):/* @__PURE__ */ A(`div`,{className:`wui-nav-header`,children:e.header},e.key??e.header));if(!e.collapsible)return/* @__PURE__ */ j(`div`,{className:`app-nav-group`,children:[e.label&&/* @__PURE__ */ A(`div`,{className:`app-nav-group-label`,children:e.label}),n,e.after&&/* @__PURE__ */ A(`div`,{className:`wui-nav-group-after`,children:e.after})]},e.key??e.label??`group-${t}`);let r=!mt.has(e.key??``)||!!he(e.items),i=`wui-nav-group-${e.key}`;return/* @__PURE__ */ j(`div`,{className:`app-nav-group wui-nav-group-collapsible${r?``:` wui-nav-group-folded`}`,"data-wui-nav-group":e.key,children:[/* @__PURE__ */ j(`button`,{type:`button`,className:`app-nav-group-label wui-nav-group-toggle`,"aria-expanded":r,"aria-controls":i,onClick:()=>gt(e.key??``),children:[/* @__PURE__ */ A(`span`,{className:`wui-nav-group-text`,children:e.label}),/* @__PURE__ */ A(`span`,{className:`wui-nav-group-caret`,children:/* @__PURE__ */ A(h,{name:`chevron-down`,size:16})})]}),/* @__PURE__ */ j(`div`,{className:`wui-nav-group-body`,id:i,children:[n,e.after&&/* @__PURE__ */ A(`div`,{className:`wui-nav-group-after`,children:e.after})]})]},e.key??`group-${t}`)})}),(I||vt.length>0)&&/* @__PURE__ */ j(`div`,{className:`app-sidebar-foot`,children:[vt.length>0&&/* @__PURE__ */ A(`div`,{className:`wui-sidebar-foot-links`,children:vt.map(e=>/* @__PURE__ */ A(ge,{item:e,linkComponent:Z,onNavigate:()=>Q(!1),iconVariant:Y,newLabel:je,togglePagesLabel:Me},e.key??e.href??e.label))}),I]}),!K&&/* @__PURE__ */ A(`button`,{type:`button`,className:`app-sidebar-toggle`,onClick:ft,"aria-label":ut?ke:Ae,"aria-expanded":!ut,children:/* @__PURE__ */ A(h,{name:`chevrons-left`,size:20})})]}),/* @__PURE__ */ j(`div`,{className:`app-main`,children:[/* @__PURE__ */ j(`header`,{className:`app-topbar${at?` wui-scrolled`:``}`,"data-tone":ue===`primary`?`primary`:void 0,children:[/* @__PURE__ */ j(`div`,{className:`app-topbar-start`,children:[/* @__PURE__ */ A(`button`,{type:`button`,className:`app-topbar-menu`,onClick:()=>Q(!0),"aria-label":Oe,"aria-expanded":rt,children:/* @__PURE__ */ A(h,{name:`menu`,size:18})}),q===`top`&&d&&/* @__PURE__ */ A(`div`,{className:`wui-shell-top-brand`,children:dt(d)}),q===`top`&&/* @__PURE__ */ A(`div`,{className:`wui-shell-top-nav`,children:/* @__PURE__ */ A(g,{items:fe($),ariaLabel:ye,linkComponent:Z})}),R,Xe&&/* @__PURE__ */ A(be,{config:Xe,searchResultsLabel:Ue,noResultsText:We,noResultsForText:Ge,resultsCountText:Ke,resultCountText:qe,moreLabel:Ee})]}),/* @__PURE__ */ j(`div`,{className:`app-topbar-end`,children:[z,Ye&&/* @__PURE__ */ A(ve,{config:Ye,unreadLabel:Ie,markAllReadLabel:Le,viewAllLabel:Re,loadingNotificationsText:ze,noUnreadText:Be,unreadNotificationsText:Ve,unreadBellLabel:He}),Je&&/* @__PURE__ */ A(_e,{config:Je,linkComponent:Z,accountMenuLabel:Ne,roleLabel:Pe,rolesLabel:Fe})]})]}),/* @__PURE__ */ A(`main`,{className:`app-content`,id:`main-content`,children:W}),V&&/* @__PURE__ */ A(`footer`,{className:`app-footer`,children:V})]}),ie&&/* @__PURE__ */ A(`div`,{className:`wui-shell-launcher`,children:ie}),yt&&/* @__PURE__ */ j(`nav`,{className:`wui-tabbar`,"aria-label":Te,children:[yt.tabs.map(e=>/* @__PURE__ */ A(me,{tab:e,linkComponent:Z,iconVariant:Y},e.key??e.href)),yt.hasMore&&/* @__PURE__ */ j(`button`,{type:`button`,className:`wui-tabbar-item${yt.moreActive?` active`:``}`,onClick:()=>Q(!0),children:[/* @__PURE__ */ A(`span`,{className:`wui-tabbar-icon`,children:/* @__PURE__ */ A(h,{name:`more`,size:24})}),/* @__PURE__ */ A(`span`,{className:`wui-tabbar-label`,children:Ee})]})]})]})}function ce(e,t,r){let i=t;for(let e of i){if(e.children?.length)throw Error(`<AppShell> sidebarFooterItems cannot hold children; keep footer links flat.`);if(e.tab)throw Error(`<AppShell> sidebarFooterItems cannot carry tab: true; the phone tab bar is built from groups.`);if(e.header!=null)throw Error(`<AppShell> sidebarFooterItems cannot hold a header row.`)}for(let t of e)t.collapsible&&ue(t);let a=(e,t=!1)=>(e??[]).map(e=>Array.isArray(e.children)?{...e,children:a(e.children)}:{...e}).filter(e=>J(e)?t:(e.children?.length??0)>0||!!e.href),o=[...e,{key:z,items:t}].map(e=>({...e,items:le(a(e.items,!0))})).filter(e=>e.items.some(e=>!J(e))),s=[],c=e=>{for(let t of e)J(t)||(s.push(t),t.children&&c(t.children))};for(let e of o)c(e.items);for(let e of s)v(`AppShell items`,q(e)),_(`AppShell`,`match`,e.match,V),_(`AppShell`,`iconVariant`,e.iconVariant,re),_(`AppShell`,`badgeTone`,e.badgeTone,d);let l=null;if(r!=null&&!s.some(e=>e.active===!0)){let e=-1;for(let t of s){if(t.active!=null||t.children?.length&&!t.href)continue;let i=n(r,t.href,{exact:t.match===`exact`,also:t.matchAlso});if(i<0)continue;let a=t.match===`exact`&&n(r,t.href,{exact:!0})>=0?1/0:i;a>e&&(e=a,l=t)}}for(let e of s)e.active=e.active??e===l;return{groups:o.filter(e=>e.key!==z),footer:o.find(e=>e.key===z)?.items??[]}}function q(e){return Object.fromEntries(Object.entries(e).filter(([e])=>!ie.has(e)))}var J=e=>e.header!=null;function le(e){return e.filter((t,n)=>{if(!J(t))return!0;let r=e.findIndex((e,t)=>t>n&&J(e));return e.slice(n+1,r<0?void 0:r).length>0})}var Y=/* @__PURE__ */ new Set;function ue(t){if(t.key!=null&&R.test(t.key))return;let n=t.key==null?`<AppShell> a collapsible group needs a key so its folded state can be remembered.`:`<AppShell> collapsible group key "${t.key}" must use lower-case letters, digits and hyphens.`;typeof process<`u`&&process.env.NODE_ENV===`production`||Y.has(n)||(Y.add(n),e(n))}function de(e,t){let n=[],r=e=>{for(let t of e)J(t)||(t.children?.length?r(t.children):n.push(t))};for(let t of e)r(t.items);let i=n.filter(e=>e.tab);if(i.length===0)return null;let a=i.length<n.length,o=a?I:L;if(i.length>o)throw Error(`<AppShell>: ${i.length} items carry tab: true, but the phone tab bar holds ${o} (${a?`4 plus More, because other items exist`:`5 when every item is a tab`}). Flag fewer items.`);return{tabs:i,hasMore:a,moreActive:t||n.some(e=>!e.tab&&e.active)}}function fe(e){let t=e=>{if(e.label===void 0)throw Error(`<AppShell> a navigation row has no label; every row but a header needs one.`);return e.label},n=e=>e.key??e.href??t(e),r=(e,r)=>({key:n(e),label:t(e),to:r,current:!!e.active}),i=e=>e.flatMap(e=>J(e)?[]:[...e.href?[{...r(e,e.href),icon:e.icon}]:[],...i(e.children??[])]),a=[];for(let o of e.flatMap(e=>e.items)){if(J(o))continue;let e=i(o.children??[]);if(e.length>0){let i=o.href?[{...r(o,o.href),icon:o.icon}]:[];a.push({key:n(o),label:t(o),links:[...i,...e]})}else o.href&&a.push(r(o,o.href))}return a}function pe({href:e,label:n,linkComponent:r,onNavigate:i,children:a}){return/* @__PURE__ */ A(c,{link:t(r,{to:e}),className:`wui-brand-link`,"aria-label":n,onClick:i,children:a})}function me({tab:e,linkComponent:n,iconVariant:r}){let i=`wui-tabbar-item${e.active?` active`:``}`,a=/* @__PURE__ */ j(k,{children:[e.icon&&/* @__PURE__ */ A(`span`,{className:`wui-tabbar-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ A(h,{name:e.icon,size:24,variant:e.iconVariant??r}):e.icon}),/* @__PURE__ */ A(`span`,{className:`wui-tabbar-label`,children:e.tabLabel??e.label}),e.badge!=null&&/* @__PURE__ */ A(`span`,{className:`wui-tabbar-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:e.badge})]}),o=e.active?`page`:void 0;return/* @__PURE__ */ A(c,{link:t(n,{to:e.href}),className:i,"aria-current":o,children:a})}function he(e){for(let t of e){if(t.active)return t;let e=t.children?.length?he(t.children):void 0;if(e)return e}}function ge({item:e,linkComponent:n,onNavigate:r,depth:i=0,iconVariant:a,newLabel:o,togglePagesLabel:s}){let l=i>0,u=i>1?` wui-nav-depth-${Math.min(i,6)}`:``,d=Array.isArray(e.children)&&e.children.length>0,f=d?he(e.children??[]):void 0,p=!!f,m=f?f.key??f.href??f.label:null,[g,_]=O(p);w(()=>{m!=null&&_(!0)},[m]);let v=typeof e.label==`string`?e.label:void 0,y=!l&&e.icon&&/* @__PURE__ */ A(`span`,{className:`app-nav-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ A(h,{name:e.icon,size:e.iconSize??22,variant:e.iconVariant??a}):e.icon}),b=e.badge!=null&&/* @__PURE__ */ A(`span`,{className:`app-nav-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:e.badge}),x=ae(e.newUntil)&&/* @__PURE__ */ A(`span`,{className:`wui-nav-new`,children:o}),S=/* @__PURE__ */ j(k,{children:[y,/* @__PURE__ */ A(`span`,{className:`app-nav-text`,children:e.label}),x,b,e.trailingIcon&&/* @__PURE__ */ A(`span`,{className:`app-nav-trailing`,children:typeof e.trailingIcon==`string`?/* @__PURE__ */ A(h,{name:e.trailingIcon,size:16}):e.trailingIcon})]}),C=e.active?`page`:void 0;if(d){let d=/* @__PURE__ */ A(`div`,{className:`app-nav-sub${g?` expanded`:``}`,inert:!g,"aria-hidden":!g||void 0,children:/* @__PURE__ */ A(`div`,{className:`app-nav-sub-inner`,children:(e.children??[]).map(e=>/* @__PURE__ */ A(ge,{item:e,linkComponent:n,onNavigate:r,depth:i+1,iconVariant:a,newLabel:o,togglePagesLabel:s},e.key??e.href))})});if(e.href){let i=/* @__PURE__ */ A(c,{link:t(n,{to:e.href}),className:`wui-nav-split-link`,"aria-current":C,onClick:r,children:S});return/* @__PURE__ */ j(k,{children:[/* @__PURE__ */ j(`div`,{className:`app-nav-item has-children wui-nav-split${l?` app-nav-subitem`:``}${p||e.active?` active`:``}${u}`,"data-label":v,children:[i,/* @__PURE__ */ A(`button`,{type:`button`,className:`app-nav-caret wui-nav-split-toggle`,"aria-expanded":g,"aria-label":M(s,{name:v??``}),onClick:()=>_(e=>!e),children:/* @__PURE__ */ A(h,{name:`chevron-right`,size:16})})]}),d]})}return/* @__PURE__ */ j(k,{children:[/* @__PURE__ */ j(`button`,{type:`button`,className:`app-nav-item${l?` app-nav-subitem`:``} has-children${p?` active`:``}${u}`,"aria-expanded":g,"data-label":v,onClick:()=>_(e=>!e),children:[y,/* @__PURE__ */ A(`span`,{className:`app-nav-text`,children:e.label}),x,b,/* @__PURE__ */ A(`span`,{className:`app-nav-caret`,children:/* @__PURE__ */ A(h,{name:`chevron-right`,size:16})})]}),d]})}let T=`app-nav-item${l?` app-nav-subitem`:``}${e.active?` active`:``}${u}`;return/* @__PURE__ */ A(c,{link:t(n,{to:e.href}),className:T,"aria-current":C,"data-label":v,onClick:r,children:S})}function X(e){l(`wui-dropdown`,P);let[t,n]=O(!1),r=D(null);return w(()=>{r.current?.toggleAttribute(`open`,t)},[t]),w(()=>{let t=r.current;if(!t)return;let i=r=>{if(r.target!==t||!(`detail`in r)||!r.detail||typeof r.detail!=`object`)return;let i=`open`in r.detail&&r.detail.open===!0;n(i),i&&e?.()};return t.addEventListener(`wui-dropdown-toggle`,i),()=>t.removeEventListener(`wui-dropdown-toggle`,i)},[e]),{open:t,setOpen:n,ref:r}}function _e({config:e,linkComponent:n,accountMenuLabel:r,roleLabel:i,rolesLabel:a}){let o=u(`shell`,ee),s=T(),{open:l,setOpen:d,ref:f}=X(),{name:g,role:v,roles:y=[],noTriggerRole:b=!1,outlined:x=!1,photo:S,profileHref:C,profileLabel:w=o.profileLabel,onLogout:E,logoutAction:D,logoutLabel:O=o.logoutLabel,head:N,section:P,logoutVariant:F=`item`,items:I=[]}=e;if(_(`AppShell`,`userMenu.logoutVariant`,F,[`item`,`button`]),!g)throw Error(`<AppShell> userMenu.name is required; the trigger and the avatar are named from it.`);let L=y.map(e=>(e??``).trim()).filter(Boolean),R=()=>d(!1),z=(e,r,i,a)=>/* @__PURE__ */ A(c,{link:t(n,{to:e}),className:`dropdown-item`,onClick:a,children:r},i),B=/* @__PURE__ */ A(h,{name:`log-out`,size:18}),V=/* @__PURE__ */ j(k,{children:[B,O]});return/* @__PURE__ */ j(`wui-dropdown`,{class:`dropdown wui-usermenu`,align:`end`,ref:f,children:[/* @__PURE__ */ j(`button`,{type:`button`,id:s,className:x?`wui-usermenu-trigger wui-usermenu-trigger-outlined`:`wui-usermenu-trigger`,"data-wui-dropdown-trigger":!0,"aria-expanded":l,"aria-label":M(r,{name:g}),children:[/* @__PURE__ */ A(p,{name:g,src:S,tone:`auto`}),/* @__PURE__ */ j(`span`,{className:`wui-usermenu-text`,children:[/* @__PURE__ */ A(`span`,{className:`wui-usermenu-name`,children:g}),v&&!b&&/* @__PURE__ */ A(`span`,{className:`wui-usermenu-role`,children:v})]}),/* @__PURE__ */ A(h,{name:`chevron-down`,size:14,className:`wui-usermenu-caret`})]}),/* @__PURE__ */ j(`div`,{"data-wui-dropdown-menu":!0,popover:`auto`,className:`dropdown-menu dropdown-menu-end wui-usermenu-menu${l?` show`:``}`,"aria-labelledby":s,children:[/* @__PURE__ */ j(`div`,{className:`wui-usermenu-head`,children:[/* @__PURE__ */ A(p,{name:g,src:S,size:`lg`,tone:`auto`}),/* @__PURE__ */ j(`div`,{className:`wui-usermenu-who`,children:[/* @__PURE__ */ A(`div`,{className:`wui-usermenu-name`,children:g}),v&&/* @__PURE__ */ A(`div`,{className:`wui-usermenu-role`,children:v}),L.length>0&&/* @__PURE__ */ j(`div`,{className:`wui-usermenu-roles`,children:[/* @__PURE__ */ A(`span`,{className:`wui-usermenu-roles-label`,children:L.length===1?i:a}),` ${L.join(`, `)}`]}),N?/* @__PURE__ */ A(`div`,{className:`wui-usermenu-extra`,children:N}):null]})]}),P?/* @__PURE__ */ A(`div`,{className:`wui-usermenu-section`,children:P}):null,C&&z(C,/* @__PURE__ */ j(k,{children:[/* @__PURE__ */ A(h,{name:`user`,size:18}),w]}),void 0,R),I.map(e=>{if(e.divider)return/* @__PURE__ */ A(`hr`,{className:`dropdown-divider`},e.key);let t=/* @__PURE__ */ j(k,{children:[e.icon&&/* @__PURE__ */ A(h,{name:e.icon,size:18}),e.label]}),n=()=>{e.onClick?.(),R()};return e.href?z(e.href,t,e.key,n):/* @__PURE__ */ A(`button`,{type:`button`,className:`dropdown-item`,onClick:n,children:t},e.key)}),F===`button`?(D||E)&&/* @__PURE__ */ A(`div`,{className:`wui-usermenu-foot`,children:D?/* @__PURE__ */ A(`form`,{method:`post`,action:D,className:`wui-usermenu-logout`,children:/* @__PURE__ */ A(m,{type:`submit`,tone:`danger`,variant:`soft`,block:!0,leftIcon:B,children:O})}):/* @__PURE__ */ A(m,{type:`button`,tone:`danger`,variant:`soft`,block:!0,leftIcon:B,onClick:()=>{R(),E?.()},children:O})}):D?/* @__PURE__ */ A(`form`,{method:`post`,action:D,className:`wui-usermenu-logout`,children:/* @__PURE__ */ A(`button`,{type:`submit`,className:`dropdown-item danger`,children:V})}):E&&/* @__PURE__ */ A(`button`,{type:`button`,className:`dropdown-item danger`,onClick:()=>{R(),E()},children:V})]})]})}function ve({config:e,unreadLabel:t,markAllReadLabel:n,viewAllLabel:r,loadingNotificationsText:i,noUnreadText:a,unreadNotificationsText:o,unreadBellLabel:s}){let c=u(`shell`,ee),l=T(),{open:d,ref:f}=X(e.onOpen),{unread:p=0,items:m,loading:g=!1,onMarkAllRead:_,viewAllHref:v,label:y=c.label,emptyText:b=c.emptyText}=e,[x,S]=O(``),C=D(p);w(()=>{C.current!==p&&(C.current=p,S(p===0?a:M(o,{count:W(p)})))},[p,a,o]);let E=null;return m?.length?E=/* @__PURE__ */ A(`div`,{className:`wui-bell-items`,children:m.map((e,n)=>{let r=`wui-bell-item${e.read?` wui-bell-item-read`:``}`,i=/* @__PURE__ */ j(k,{children:[/* @__PURE__ */ A(`span`,{className:`wui-bell-dot`,"aria-hidden":`true`}),e.icon&&/* @__PURE__ */ A(`span`,{className:`wui-bell-icon`,children:/* @__PURE__ */ A(h,{name:e.icon,size:18})}),/* @__PURE__ */ j(`span`,{className:`wui-bell-body`,children:[!e.read&&/* @__PURE__ */ j(`span`,{className:`visually-hidden`,children:[t,`: `]}),/* @__PURE__ */ A(`span`,{className:`wui-bell-item-title`,children:e.title}),e.time&&/* @__PURE__ */ A(`span`,{className:`wui-bell-when`,children:e.time})]})]});return e.href?/* @__PURE__ */ A(`a`,{className:r,href:e.href,"data-id":e.id,children:i},e.id??n):/* @__PURE__ */ A(`div`,{className:r,"data-id":e.id,children:i},e.id??n)})}):g?E=/* @__PURE__ */ A(`div`,{className:`wui-bell-state`,children:i}):m&&(E=/* @__PURE__ */ A(`div`,{className:`wui-bell-state`,children:b})),/* @__PURE__ */ j(`wui-dropdown`,{class:`dropdown wui-bell`,align:`end`,ref:f,children:[/* @__PURE__ */ j(`button`,{type:`button`,id:l,className:`topbar-icon-btn wui-bell-trigger`,"data-wui-dropdown-trigger":!0,"aria-expanded":d,"aria-label":p===0?y:M(s,{label:y,count:W(p)}),children:[/* @__PURE__ */ A(h,{name:`notification`,size:20}),/* @__PURE__ */ A(`span`,{className:`wui-bell-count`,"aria-hidden":`true`,hidden:p===0,children:W(p)})]}),/* @__PURE__ */ A(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:x}),/* @__PURE__ */ j(`div`,{"data-wui-dropdown-menu":!0,popover:`auto`,className:`dropdown-menu dropdown-menu-end wui-bell-menu${d?` show`:``}`,"aria-labelledby":l,children:[/* @__PURE__ */ j(`div`,{className:`wui-bell-head`,children:[/* @__PURE__ */ A(`span`,{className:`wui-bell-title`,children:y}),_&&/* @__PURE__ */ A(`button`,{type:`button`,className:`wui-bell-markall`,onClick:_,children:n})]}),/* @__PURE__ */ A(`div`,{className:`wui-bell-list`,"aria-busy":g||void 0,children:E}),v&&/* @__PURE__ */ A(`a`,{className:`wui-bell-foot`,href:v,children:r})]})]})}var ye=e=>!!e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName));function be({config:e,searchResultsLabel:t,noResultsText:n,noResultsForText:r,resultsCountText:i,resultCountText:a,moreLabel:o}){l(`wui-overflow`,N);let s=u(`shell`,ee),c=T(),{value:d=``,onChange:f,results:p=null,loading:m=!1,onSelect:g,onSubmit:_,onFocus:v,placeholder:y=s.placeholder}=e,[b,S]=O(!1),[C,k]=O(!1),[P,F]=O({results:null,index:-1}),I=P.results===p?P.index:-1,L=e=>F({results:p,index:e}),R=D(null),z=D(null),B=D([]),V=E(()=>(p??[]).flatMap(e=>e.hits??[]),[p]),H=p!=null&&!C,U=V.length;w(()=>{let e=e=>{e.key!==`/`||e.ctrlKey||e.metaKey||e.altKey||ye(e.target instanceof HTMLElement?e.target:null)||(e.preventDefault(),S(!0),z.current?.focus())},t=e=>{R.current?.contains(e.target instanceof Node?e.target:null)||(k(!0),S(!1))};return document.addEventListener(`keydown`,e),document.addEventListener(`pointerdown`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`pointerdown`,t)}},[]);let te=e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(!H||U===0)return;e.preventDefault(),L((I+(e.key===`ArrowDown`?1:-1)+U)%U)}else x(e.nativeEvent)?H&&I>=0&&B.current[I]?(e.preventDefault(),B.current[I].click()):_&&d.trim()!==``&&(e.preventDefault(),_(d.trim())):e.key===`Escape`&&(H?(e.preventDefault(),k(!0)):b&&(e.preventDefault(),S(!1)))},ne=-1;return B.current=[],/* @__PURE__ */ A(`wui-overflow`,{class:`wui-topsearch-host`,label:o,children:/* @__PURE__ */ A(`div`,{"data-wui-overflow-list":!0,className:`wui-topsearch-row`,children:/* @__PURE__ */ j(`div`,{className:`wui-topsearch${b?` is-open`:``}${m?` is-loading`:``}`,ref:R,"data-overflow-label":y,children:[/* @__PURE__ */ A(`button`,{type:`button`,className:`topbar-icon-btn wui-topsearch-open`,"aria-label":y,"aria-expanded":b,"aria-controls":`${c}-panel`,onClick:()=>{let e=!b;S(e),e&&z.current?.focus()},children:/* @__PURE__ */ A(h,{name:`search`,size:20})}),/* @__PURE__ */ j(`div`,{className:`wui-topsearch-panel`,id:`${c}-panel`,children:[/* @__PURE__ */ j(`div`,{className:`search-wrap`,children:[/* @__PURE__ */ A(h,{name:`search`,size:18,className:`search-icon`}),/* @__PURE__ */ A(`input`,{ref:z,type:`search`,className:`form-control input search-input`,id:`${c}-input`,placeholder:y,"aria-label":y,role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":H,"aria-controls":`${c}-list`,"aria-activedescendant":H&&I>=0?`${c}-opt-${I}`:void 0,autoComplete:`off`,value:d,onChange:e=>{k(!1),f?.(e.target.value)},onKeyDown:te,onFocus:v})]}),/* @__PURE__ */ A(`div`,{className:`wui-topsearch-results`,id:`${c}-list`,role:`listbox`,"aria-label":t,hidden:!H,children:H&&/* @__PURE__ */ j(`div`,{className:`wui-topsearch-groups`,role:`presentation`,children:[U===0&&/* @__PURE__ */ A(`div`,{className:`wui-topsearch-empty`,role:`option`,"aria-disabled":`true`,"aria-selected":`false`,children:M(r,{value:d})}),p.filter(e=>e.hits?.length).map((e,t)=>/* @__PURE__ */ j(`div`,{className:`wui-topsearch-group`,role:`group`,"aria-label":e.label??``,children:[e.label&&/* @__PURE__ */ A(`div`,{className:`wui-topsearch-group-label`,role:`presentation`,children:e.label}),e.hits.map(e=>{ne+=1;let t=ne;return/* @__PURE__ */ j(`a`,{className:`wui-topsearch-hit${t===I?` is-active`:``}`,role:`option`,"aria-selected":t===I,id:`${c}-opt-${t}`,href:e.href,ref:e=>{B.current[t]=e},onClick:t=>g?.(e,t),children:[e.icon&&/* @__PURE__ */ A(`span`,{className:`wui-topsearch-hit-icon`,children:/* @__PURE__ */ A(h,{name:e.icon,size:18})}),/* @__PURE__ */ j(`span`,{className:`wui-topsearch-hit-text`,children:[/* @__PURE__ */ A(`span`,{className:`wui-topsearch-hit-title`,children:e.title}),e.subtitle&&/* @__PURE__ */ A(`span`,{className:`wui-topsearch-hit-sub`,children:e.subtitle})]})]},`${e.href}-${t}`)})]},e.label??t))]})})]}),/* @__PURE__ */ A(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:H?U===0?n:M(U===1?a:i,{count:U}):``})]})})})}export{K as default};
@@ -0,0 +1 @@
1
+ import e from"../lib/FieldMessage.js";import{transferKeyAction as t}from"../lib/transferList/transferKeys.js";import{filterItems as n,moveAnnouncement as r,moveToAvailable as i,moveToChosen as a,reorderChosen as o,splitItems as s}from"../lib/transferList/transferState.js";import c from"../lib/transferListView/TransferPanel.js";import l from"../lib/useWuiText.js";import{splitMarkerProps as ee}from"../lib/wuiMarker.js";import te from"./warnUnknownProps.js";import{forwardRef as u,useEffect as ne,useId as d,useRef as f,useState as p}from"react";import{jsx as m,jsxs as h}from"react/jsx-runtime";import{TRANSFER_LIST_TEXT as re,fillText as g}from"@webority/ui-elements/text";var ie=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),_=u(function(u,_){let{marker:ae,props:oe}=ee(`AppTransferList`,u),v=l(`transferList`,re),{items:y,value:b,defaultValue:se=[],onChange:ce,name:x,label:S,helperText:C,error:w,disabled:T=!1,searchable:le=!0,reorderable:E=!0,availableTitle:ue=v.availableTitle,chosenTitle:de=v.chosenTitle,addAllLabel:fe=v.addAllLabel,removeAllLabel:pe=v.removeAllLabel,addLabel:me=v.addLabel,removeLabel:he=v.removeLabel,searchLabel:ge=v.searchLabel,searchPlaceholder:_e=v.searchPlaceholder,noMatchText:ve=v.noMatchText,emptyAvailableTitle:ye=v.emptyAvailableTitle,emptyAvailableText:D=v.emptyAvailableText,emptyChosenTitle:O=v.emptyChosenTitle,emptyChosenText:k=v.emptyChosenText,dragHintText:A=v.dragHintText,orderHintText:j=v.orderHintText,id:M,className:N=``,ariaLabel:P,...F}=oe;te(`AppTransferList`,F);let I=d(),L=`${I}-label`,R=w?`${I}-error`:void 0,z=C?`${I}-hint`:void 0,be=[R,z].filter(Boolean).join(` `)||void 0,xe=b!==void 0,[Se,Ce]=p(se),B=s(y,b??Se),V=B.chosen.map(e=>e.id),[we,Te]=p(``),[Ee,De]=p(``),[Oe,H]=p(``),U=f(!1),W=f(null),G=f(null),K=f(null);ne(()=>{let e=W.current;if(!e)return;W.current=null;let t=(e.side===`chosen`?K.current:G.current)?.querySelectorAll(`[data-transfer-row-action]`)??[];Array.from(t).find(t=>t.dataset.transferRowAction===e.id)?.focus()});let q=e=>!ie(e,V)&&(xe||Ce(e),ce?.(e),!0),J=(e,t,n)=>{let o=t.filter(e=>y.some(t=>t.id===e&&t.disabled!==!0));if(o.length===0)return;let s=e===`chosen`?a(V,o,y,n):i(V,o);if(!q(s))return;let c=y.find(e=>e.id===o[o.length-1]);c&&H(r(c.label,e,s.indexOf(c.id)+1,s.length))},ke=(e,t)=>{if(t.to!==K.current)return;let n=o(V,t.id,t.toIndex),i=y.find(e=>e.id===t.id);q(n)&&i&&H(r(i.label,`chosen`,n.indexOf(i.id)+1,n.length))},Y=(e,n)=>{if(T||!(n.target instanceof HTMLElement))return null;let r=n.target.closest(`[data-id]`)?.dataset.id;return r?{rowId:r,action:t({key:n.key,shiftKey:n.shiftKey,altKey:n.altKey,ctrlKey:n.ctrlKey,metaKey:n.metaKey,isComposing:n.nativeEvent.isComposing,keyCode:n.keyCode},{side:e,layout:`rows`,pickedUp:U.current,reorderable:E,rowDisabled:y.some(e=>e.id===r&&e.disabled===!0)})}:null},X=e=>t=>{let n=Y(e,t);if(!n)return;let{rowId:r,action:i}=n;i.type===`drop`||i.type===`cancelPickUp`?(U.current=!1,i.type===`drop`&&t.preventDefault()):i.type===`crossList`&&(t.preventDefault(),t.stopPropagation(),U.current=!1,t.target instanceof HTMLElement&&t.target.blur(),W.current={id:r,side:i.to},J(i.to,[r]))},Z=e=>t=>{let n=Y(e,t);if(!n)return;let{rowId:r,action:i}=n;if(i.type===`transfer`){t.preventDefault();let e=i.direction===`toChosen`?`chosen`:`available`;W.current={id:r,side:e},J(e,[r])}else i.type===`pickUp`&&(t.preventDefault(),U.current=!0)},Q=e=>{let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||(U.current=!1)},$=e=>{let t=e===`chosen`,r=t?Ee:we,i=n(t?B.chosen:B.available,r),a=i.filter(e=>e.disabled!==!0).map(e=>e.id),o=t?de:ue,s=t?`available`:`chosen`;return{side:e,title:o,items:i,totalCount:t?B.chosen.length:B.available.length,query:r,onQueryChange:t?De:Te,searchable:le,searchLabel:g(ge,{title:o}),searchPlaceholder:_e,noMatchText:g(ve,{query:r}),bulkLabel:t?pe:fe,onBulk:()=>J(s,a),bulkDisabled:T||a.length===0,emptyTitle:t?O:ye,emptyText:t?k:D,hint:E?t?j:A:null,rowAction:{label:e=>g(t?he:me,{name:e.label}),onAct:e=>{W.current={id:e,side:s},J(s,[e])}},reorder:t&&E?{onReorder:ke}:null,listRef:t?K:G,listLabel:o,disabled:T}};return/* @__PURE__ */ h(`div`,{id:M,ref:_,className:`wui-transfer-list d-flex flex-column gap-2${N?` ${N}`:``}`,role:`group`,"aria-labelledby":S?L:void 0,"aria-label":S?void 0:P,"aria-describedby":be,"aria-disabled":T||void 0,...ae,...F,children:[S?/* @__PURE__ */ m(`div`,{id:L,className:`form-label mb-0`,children:S}):null,/* @__PURE__ */ h(`div`,{className:`wui-transfer-list-panels`,children:[/* @__PURE__ */ m(`div`,{onKeyDownCapture:X(`available`),onKeyDown:Z(`available`),onBlur:Q,children:/* @__PURE__ */ m(c,{...$(`available`)})}),/* @__PURE__ */ m(`div`,{onKeyDownCapture:X(`chosen`),onKeyDown:Z(`chosen`),onBlur:Q,children:/* @__PURE__ */ m(c,{...$(`chosen`)})})]}),x?V.map(e=>/* @__PURE__ */ m(`input`,{type:`hidden`,name:x,value:e},e)):null,/* @__PURE__ */ m(e,{error:w,hint:C,errorId:R,hintId:z}),/* @__PURE__ */ m(`div`,{className:`small text-secondary mt-2`,role:`status`,children:Oe})]})});export{_ as default};
@@ -0,0 +1 @@
1
+ import e from"../lib/FieldMessage.js";import t from"../lib/useElementEntry.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppRequiredMark.js";import i from"./assertValidValue.js";import a from"./useWuiControl.js";import o from"./warnUnknownProps.js";import{forwardRef as s,useEffect as c,useId as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";var f=[`single`,`multiple`],p=()=>import(`@webority/ui-elements/elements/tree-picker`);function m(e){return e instanceof HTMLElement&&`values`in e&&`nodes`in e}function h(e,t){e.values=Array.isArray(t)?t:t===``?[]:[t]}var g=s(function(s,g){let _=t(`wui-tree-picker`,p),{marker:v,props:y}=n(`AppTreePicker`,s),{nodes:b,selection:x=`multiple`,value:S,defaultValue:C,onChange:w,name:T,label:E,helperText:D,error:O,required:k,disabled:A,id:j,ariaLabel:M,className:N,chosenTitle:P,clearAllLabel:F,emptyTitle:I,emptyText:L,noMatchText:R,removeLabel:z,searchLabel:B,searchPlaceholder:V,selectedText:H,...U}=y;o(`AppTreePicker`,U),i(`AppTreePicker`,`selection`,x,f);let W=l(),G=j||W,K=E?`${G}-label`:void 0,q=O?`${G}-error`:void 0,J=D?`${G}-hint`:void 0,{setRef:Y,innerRef:X}=a({ready:_,ref:g,value:S,defaultValue:C,writeValue:h,on:{"wui-tree-picker:change":e=>w?.(e.detail.value,{ids:e.detail.values})}});c(()=>{let e=X.current;_&&m(e)&&b!==void 0&&(e.nodes=b)},[b,X,_]);let Z=/* @__PURE__ */ u(`wui-tree-picker`,{ref:Y,id:G,selection:x,name:T||void 0,"aria-label":M||void 0,"aria-labelledby":M?void 0:K,"aria-describedby":q||J||void 0,invalid:O?``:void 0,disabled:A?``:void 0,"chosen-title":P||void 0,"clear-all-label":F||void 0,"empty-title":I||void 0,"empty-text":L||void 0,"no-match-text":R||void 0,"remove-label":z||void 0,"search-label":B||void 0,"search-placeholder":V||void 0,"selected-text":H||void 0,className:N||void 0,...U});return/* @__PURE__ */ d(`div`,{...v,className:`field`,children:[E&&/* @__PURE__ */ d(`label`,{className:`label`,id:K,htmlFor:G,children:[E,k&&/* @__PURE__ */ u(r,{})]}),Z,/* @__PURE__ */ u(e,{error:O,hint:D,errorId:q,hintId:J})]})});export{g as default};
@@ -1 +1 @@
1
- import{initialsOf as e}from"../lib/initials.js";import{linkTarget as t}from"../lib/linkTarget.js";import{TargetLink as n}from"../lib/TargetLink.js";import r from"../lib/useElementEntry.js";import i from"../lib/useWuiText.js";import{splitMarkerProps as a}from"../lib/wuiMarker.js";import o from"./AppIcon.js";import s from"./assertValidValue.js";import c from"./warnUnknownProps.js";import{useCallback as l,useEffect as u,useMemo as d,useRef as f,useState as p}from"react";import{Fragment as m,jsx as h,jsxs as g}from"react/jsx-runtime";import{WORKSPACE_SWITCHER_TEXT as _,fillText as v}from"@webority/ui-elements/text";var y=[`sm`,`md`,`lg`],b=()=>import(`@webority/ui-elements/elements/dropdown`),x=/* @__PURE__ */ new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`]);function S(e){let{marker:t,props:n}=a(`AppWorkspaceSwitcher`,e),m=i(`workspaceSwitcher`,_),{tenants:S=[],currentId:E,onSelect:D,menuLabel:O,footerAction:k,linkComponent:A,searchable:j=!1,onCreate:M,canCreate:N=!1,createLabel:P=m.createLabel,compact:F=!1,size:I=`md`,ariaLabel:L,searchPlaceholder:R=m.searchPlaceholder,searchLabel:z=m.searchPlaceholder,noMatchText:B=m.noMatchText,...V}=n,{onToggle:H,...U}=V;c(`AppWorkspaceSwitcher`,U),s(`AppWorkspaceSwitcher`,`size`,I,y),r(`wui-dropdown`,b);let[W,G]=p(``),[K,q]=p(!1),J=f(null),Y=f(null),X=l((e,t)=>{q(e),H?.(e,t)},[H]),Z=S.find(e=>e.id===E)??S[0],Q=d(()=>{let e=W.trim().toLowerCase();return!j||!e?S:S.filter(t=>String(t.name??``).toLowerCase().includes(e))},[S,W,j]);u(()=>{K&&j&&J.current?.focus()},[K,j]),u(()=>{let e=Y.current;if(!e)return;let t=t=>{if(t.target===e){if(!(t instanceof CustomEvent))throw TypeError(`<wui-dropdown> toggle arrived without its detail.`);X(t.detail.open,{source:t.detail.source})}};return e.addEventListener(`wui-dropdown-toggle`,t),()=>e.removeEventListener(`wui-dropdown-toggle`,t)},[X]),u(()=>{if(!j)return;let e=J.current;if(!e)return;let t=e=>{x.has(e.key)&&e.stopPropagation()};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)},[j]);let $=Z?.name??``,ee=L??v(m.ariaLabel,{currentName:$});return/* @__PURE__ */ g(`wui-dropdown`,{ref:Y,class:`dropdown workspace-switcher${I===`sm`?` workspace-switcher-sm`:``}${I===`lg`?` workspace-switcher-lg`:``}`,...t,...U,children:[/* @__PURE__ */ h(T,{compact:F,tenant:Z,ariaLabel:ee}),/* @__PURE__ */ g(`div`,{"data-wui-dropdown-menu":``,popover:`auto`,className:`dropdown-menu workspace-switcher-menu`,children:[O?/* @__PURE__ */ h(`div`,{className:`workspace-switcher-menu-label`,children:O}):null,j?/* @__PURE__ */ g(`div`,{className:`workspace-switcher-search`,children:[/* @__PURE__ */ h(o,{name:`search`,size:14}),/* @__PURE__ */ h(`input`,{ref:J,type:`search`,className:`workspace-switcher-search-input`,placeholder:R,"aria-label":z,value:W,onChange:e=>G(e.target.value)})]}):null,/* @__PURE__ */ g(`div`,{className:`workspace-switcher-list`,children:[Q.map(e=>/* @__PURE__ */ g(`button`,{type:`button`,className:`dropdown-item workspace-switcher-option${e.id===Z?.id?` is-active`:``}`,onClick:()=>D?.(e),children:[/* @__PURE__ */ h(C,{tenant:e}),/* @__PURE__ */ h(`span`,{className:`workspace-switcher-option-name`,children:e.name}),e.badge?/* @__PURE__ */ h(`span`,{className:`workspace-switcher-badge`,children:e.badge}):null,e.id===Z?.id?/* @__PURE__ */ h(o,{name:`check`,size:16,className:`workspace-switcher-tick`}):null]},e.id)),Q.length===0?/* @__PURE__ */ h(`div`,{className:`workspace-switcher-empty`,children:B}):null]}),N?/* @__PURE__ */ g(`button`,{type:`button`,className:`dropdown-item workspace-switcher-create`,onClick:()=>M?.(),children:[/* @__PURE__ */ h(o,{name:`plus`,size:16}),P]}):null,k?/* @__PURE__ */ h(`div`,{className:`workspace-switcher-footer`,children:w(k,A)}):null]})]})}function C({tenant:t}){return t?.logoUrl?/* @__PURE__ */ h(`img`,{className:`workspace-switcher-mark`,src:t.logoUrl,alt:``,loading:`lazy`}):/* @__PURE__ */ h(`span`,{className:`workspace-switcher-mark`,children:e(t?.name,1)})}function w(e,r){if(typeof e!=`object`||!e||!(`label`in e))return e;let{label:i,icon:a,href:s}=e,c=/* @__PURE__ */ g(m,{children:[a?/* @__PURE__ */ h(o,{name:a,size:16}):null,i]});return s?/* @__PURE__ */ h(n,{link:t(r,{href:s}),className:`workspace-switcher-footer-action`,children:c}):/* @__PURE__ */ h(`button`,{className:`workspace-switcher-footer-action`,type:`button`,children:c})}function T({compact:e,tenant:t,ariaLabel:n}){return/* @__PURE__ */ g(`button`,{type:`button`,"data-wui-dropdown-trigger":``,className:`workspace-switcher-trigger${e?` is-compact`:``}`,"aria-haspopup":`true`,"aria-expanded":`false`,"aria-label":n,children:[/* @__PURE__ */ h(C,{tenant:t}),e?null:/* @__PURE__ */ g(m,{children:[/* @__PURE__ */ h(`span`,{className:`workspace-switcher-trigger-name`,children:t?.name}),/* @__PURE__ */ h(o,{name:`chevrons-up-down`,size:16,className:`workspace-switcher-chevron`})]})]})}export{S as default};
1
+ import{linkTarget as e}from"../lib/linkTarget.js";import{TargetLink as t}from"../lib/TargetLink.js";import n from"../lib/useElementEntry.js";import r from"../lib/useWuiText.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./AppIcon.js";import o from"./assertValidValue.js";import s from"./warnUnknownProps.js";import{initialsOf as c}from"@webority/ui-elements/helpers";import{useCallback as l,useEffect as u,useMemo as d,useRef as f,useState as p}from"react";import{Fragment as m,jsx as h,jsxs as g}from"react/jsx-runtime";import{WORKSPACE_SWITCHER_TEXT as _,fillText as v}from"@webority/ui-elements/text";var y=[`sm`,`md`,`lg`],b=()=>import(`@webority/ui-elements/elements/dropdown`),x=/* @__PURE__ */ new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`]);function S(e){let{marker:t,props:c}=i(`AppWorkspaceSwitcher`,e),m=r(`workspaceSwitcher`,_),{tenants:S=[],currentId:E,onSelect:D,menuLabel:O,footerAction:k,linkComponent:A,searchable:j=!1,onCreate:M,canCreate:N=!1,createLabel:P=m.createLabel,compact:F=!1,size:I=`md`,ariaLabel:L,searchPlaceholder:R=m.searchPlaceholder,searchLabel:z=m.searchPlaceholder,noMatchText:B=m.noMatchText,...V}=c,{onToggle:H,...U}=V;s(`AppWorkspaceSwitcher`,U),o(`AppWorkspaceSwitcher`,`size`,I,y),n(`wui-dropdown`,b);let[W,G]=p(``),[K,q]=p(!1),J=f(null),Y=f(null),X=l((e,t)=>{q(e),H?.(e,t)},[H]),Z=S.find(e=>e.id===E)??S[0],Q=d(()=>{let e=W.trim().toLowerCase();return!j||!e?S:S.filter(t=>String(t.name??``).toLowerCase().includes(e))},[S,W,j]);u(()=>{K&&j&&J.current?.focus()},[K,j]),u(()=>{let e=Y.current;if(!e)return;let t=t=>{if(t.target===e){if(!(t instanceof CustomEvent))throw TypeError(`<wui-dropdown> toggle arrived without its detail.`);X(t.detail.open,{source:t.detail.source})}};return e.addEventListener(`wui-dropdown-toggle`,t),()=>e.removeEventListener(`wui-dropdown-toggle`,t)},[X]),u(()=>{if(!j)return;let e=J.current;if(!e)return;let t=e=>{x.has(e.key)&&e.stopPropagation()};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)},[j]);let $=Z?.name??``,ee=L??v(m.ariaLabel,{currentName:$});return/* @__PURE__ */ g(`wui-dropdown`,{ref:Y,class:`dropdown workspace-switcher${I===`sm`?` workspace-switcher-sm`:``}${I===`lg`?` workspace-switcher-lg`:``}`,...t,...U,children:[/* @__PURE__ */ h(T,{compact:F,tenant:Z,ariaLabel:ee}),/* @__PURE__ */ g(`div`,{"data-wui-dropdown-menu":``,popover:`auto`,className:`dropdown-menu workspace-switcher-menu`,children:[O?/* @__PURE__ */ h(`div`,{className:`workspace-switcher-menu-label`,children:O}):null,j?/* @__PURE__ */ g(`div`,{className:`workspace-switcher-search`,children:[/* @__PURE__ */ h(a,{name:`search`,size:14}),/* @__PURE__ */ h(`input`,{ref:J,type:`search`,className:`workspace-switcher-search-input`,placeholder:R,"aria-label":z,value:W,onChange:e=>G(e.target.value)})]}):null,/* @__PURE__ */ g(`div`,{className:`workspace-switcher-list`,children:[Q.map(e=>/* @__PURE__ */ g(`button`,{type:`button`,className:`dropdown-item workspace-switcher-option${e.id===Z?.id?` is-active`:``}`,onClick:()=>D?.(e),children:[/* @__PURE__ */ h(C,{tenant:e}),/* @__PURE__ */ h(`span`,{className:`workspace-switcher-option-name`,children:e.name}),e.badge?/* @__PURE__ */ h(`span`,{className:`workspace-switcher-badge`,children:e.badge}):null,e.id===Z?.id?/* @__PURE__ */ h(a,{name:`check`,size:16,className:`workspace-switcher-tick`}):null]},e.id)),Q.length===0?/* @__PURE__ */ h(`div`,{className:`workspace-switcher-empty`,children:B}):null]}),N?/* @__PURE__ */ g(`button`,{type:`button`,className:`dropdown-item workspace-switcher-create`,onClick:()=>M?.(),children:[/* @__PURE__ */ h(a,{name:`plus`,size:16}),P]}):null,k?/* @__PURE__ */ h(`div`,{className:`workspace-switcher-footer`,children:w(k,A)}):null]})]})}function C({tenant:e}){return e?.logoUrl?/* @__PURE__ */ h(`img`,{className:`workspace-switcher-mark`,src:e.logoUrl,alt:``,loading:`lazy`}):/* @__PURE__ */ h(`span`,{className:`workspace-switcher-mark`,children:c(e?.name,1)})}function w(n,r){if(typeof n!=`object`||!n||!(`label`in n))return n;let{label:i,icon:o,href:s}=n,c=/* @__PURE__ */ g(m,{children:[o?/* @__PURE__ */ h(a,{name:o,size:16}):null,i]});return s?/* @__PURE__ */ h(t,{link:e(r,{href:s}),className:`workspace-switcher-footer-action`,children:c}):/* @__PURE__ */ h(`button`,{className:`workspace-switcher-footer-action`,type:`button`,children:c})}function T({compact:e,tenant:t,ariaLabel:n}){return/* @__PURE__ */ g(`button`,{type:`button`,"data-wui-dropdown-trigger":``,className:`workspace-switcher-trigger${e?` is-compact`:``}`,"aria-haspopup":`true`,"aria-expanded":`false`,"aria-label":n,children:[/* @__PURE__ */ h(C,{tenant:t}),e?null:/* @__PURE__ */ g(m,{children:[/* @__PURE__ */ h(`span`,{className:`workspace-switcher-trigger-name`,children:t?.name}),/* @__PURE__ */ h(a,{name:`chevrons-up-down`,size:16,className:`workspace-switcher-chevron`})]})]})}export{S as default};