@webority/ui-react 0.147.0 → 0.149.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@
2
2
  "kind": "WeborityWeb",
3
3
  "library": {
4
4
  "name": "@webority/ui-react",
5
- "version": "0.147.0"
5
+ "version": "0.149.0"
6
6
  },
7
7
  "rendererProtocolVersion": 13,
8
8
  "platform": "Web",
@@ -5753,7 +5753,7 @@
5753
5753
  "name": "value",
5754
5754
  "type": "string",
5755
5755
  "required": false,
5756
- "description": "The stored body, with mentions as @[Label](id)."
5756
+ "description": "The stored body, with mentions as @[Label](id). Markdown source when markdown is set."
5757
5757
  }
5758
5758
  ],
5759
5759
  "required": false,
@@ -5763,7 +5763,7 @@
5763
5763
  "name": "value",
5764
5764
  "type": "string",
5765
5765
  "required": false,
5766
- "description": "The stored body, with mentions as @[Label](id)."
5766
+ "description": "The stored body, with mentions as @[Label](id). Markdown source when markdown is set."
5767
5767
  }
5768
5768
  ],
5769
5769
  "required": false,
@@ -5855,6 +5855,13 @@
5855
5855
  "description": "The list's accessible name.",
5856
5856
  "default": "Comments"
5857
5857
  },
5858
+ {
5859
+ "name": "markdown",
5860
+ "type": "boolean",
5861
+ "required": false,
5862
+ "description": "Draws each comment body as Markdown (bold, italics, lists, links, code); raw HTML shows as text and a mention reads as plain @Name. Unset, bodies show as plain text.",
5863
+ "default": false
5864
+ },
5858
5865
  {
5859
5866
  "name": "noCommentsText",
5860
5867
  "type": "string",
@@ -8782,12 +8789,13 @@
8782
8789
  "name": "menuWidth",
8783
8790
  "type": "enum",
8784
8791
  "enum": [
8792
+ "fit",
8785
8793
  "lg",
8786
8794
  "md",
8787
8795
  "sm"
8788
8796
  ],
8789
8797
  "required": false,
8790
- "description": "A fixed menu width (15, 20 or 25rem); long rows wrap instead of widening the menu. Unset, the menu fits its rows."
8798
+ "description": "A fixed menu width (15, 20 or 25rem; long rows wrap instead of widening the menu), or fit: no minimum, the menu is as wide as its widest row. Unset, the menu is at least 12rem wide."
8791
8799
  },
8792
8800
  {
8793
8801
  "name": "open",
@@ -10054,7 +10062,45 @@
10054
10062
  },
10055
10063
  {
10056
10064
  "name": "files",
10057
- "type": "any",
10065
+ "type": "array",
10066
+ "itemFields": [
10067
+ {
10068
+ "name": "href",
10069
+ "type": "string",
10070
+ "required": false,
10071
+ "description": "Where the file opens or downloads; makes the tile a link."
10072
+ },
10073
+ {
10074
+ "name": "key",
10075
+ "type": "stringOrNumber",
10076
+ "required": true,
10077
+ "description": "The file's key; not shown."
10078
+ },
10079
+ {
10080
+ "name": "meta",
10081
+ "type": "node",
10082
+ "required": false,
10083
+ "description": "Text after the size."
10084
+ },
10085
+ {
10086
+ "name": "name",
10087
+ "type": "string",
10088
+ "required": true,
10089
+ "description": "The file name; its extension makes the type tile."
10090
+ },
10091
+ {
10092
+ "name": "sizeBytes",
10093
+ "type": "number",
10094
+ "required": false,
10095
+ "description": "The size in bytes; shown as a readable size."
10096
+ },
10097
+ {
10098
+ "name": "to",
10099
+ "type": "string",
10100
+ "required": false,
10101
+ "description": "An in-app route; routed through the link component when one is given, otherwise a plain link."
10102
+ }
10103
+ ],
10058
10104
  "required": false,
10059
10105
  "description": "The files, each { key, name, href, to, sizeBytes, meta }. name's extension makes the type tile; href makes the tile a link; to is an in-app route, through linkComponent when one is given, otherwise a plain link; sizeBytes is the size in bytes; meta is text after the size.",
10060
10106
  "default": []
@@ -10066,7 +10112,9 @@
10066
10112
  "description": "Accessible name of the list."
10067
10113
  }
10068
10114
  ],
10069
- "itemsTakeAction": [],
10115
+ "itemsTakeAction": [
10116
+ "files"
10117
+ ],
10070
10118
  "takesAction": [],
10071
10119
  "source": "@webority/ui-react",
10072
10120
  "usage": {
@@ -14132,6 +14180,13 @@
14132
14180
  "description": "The close button's accessible name, for other languages.",
14133
14181
  "default": "Close"
14134
14182
  },
14183
+ {
14184
+ "name": "closeOnEscape",
14185
+ "type": "boolean",
14186
+ "required": false,
14187
+ "description": "Escape closes the modal through onClose, asking first when confirmDiscard applies. Set false for a dialog that must not close from the keyboard.",
14188
+ "default": true
14189
+ },
14135
14190
  {
14136
14191
  "name": "confirmDiscard",
14137
14192
  "type": "string",
@@ -14149,7 +14204,7 @@
14149
14204
  "name": "dismissible",
14150
14205
  "type": "boolean",
14151
14206
  "required": false,
14152
- "description": "Shows the close button in the header. Pair it with staticBackdrop for a forced-choice dialog.",
14207
+ "description": "Shows the close button in the header. For a forced-choice dialog, pair false with staticBackdrop and closeOnEscape false.",
14153
14208
  "default": true
14154
14209
  },
14155
14210
  {
@@ -14218,7 +14273,7 @@
14218
14273
  "name": "staticBackdrop",
14219
14274
  "type": "boolean",
14220
14275
  "required": false,
14221
- "description": "The pop-up closes only through its own Close or Cancel by default. false lets Escape and an outside click close it.",
14276
+ "description": "Covers outside clicks only: by default an outside click leaves the pop-up open. false lets an outside click close it.",
14222
14277
  "default": true
14223
14278
  },
14224
14279
  {
@@ -14354,7 +14409,7 @@
14354
14409
  "a11y": [
14355
14410
  "Focus stays inside the dialog: Tab and Shift+Tab wrap between its first and last control.",
14356
14411
  "The page behind an open dialog is made inert, and the dialog is named by a plain-text title or by ariaLabel; a headerless dialog with neither warns in development.",
14357
- "Escape and an outside click leave it open by default; set staticBackdrop to false to let them close it."
14412
+ "An outside click leaves it open by default (staticBackdrop); Escape closes it unless closeOnEscape is false."
14358
14413
  ]
14359
14414
  }
14360
14415
  },
@@ -20680,6 +20735,26 @@
20680
20735
  "description": "Shows the value but blocks editing. The value still posts.",
20681
20736
  "default": false
20682
20737
  },
20738
+ {
20739
+ "name": "recentsKey",
20740
+ "type": "string",
20741
+ "required": false,
20742
+ "description": "Single, search, multiple and country modes: a localStorage key to remember the options a person chooses on this device. The open list shows them first, under a Recent heading, while the search box is empty. Build it per user, for example from the user's public id. Only options still in the list show, so a search that fetches its options per query shows none. Not used in tag mode."
20743
+ },
20744
+ {
20745
+ "name": "recentsLabel",
20746
+ "type": "string",
20747
+ "required": false,
20748
+ "description": "The heading of the recent options.",
20749
+ "default": "Recent"
20750
+ },
20751
+ {
20752
+ "name": "recentsLimit",
20753
+ "type": "number",
20754
+ "required": false,
20755
+ "description": "How many recent options to show and keep, 1 to 20.",
20756
+ "default": 5
20757
+ },
20683
20758
  {
20684
20759
  "name": "remote",
20685
20760
  "type": "boolean",
@@ -21130,6 +21205,18 @@
21130
21205
  "required": false,
21131
21206
  "description": "The logo row at the top of the sidebar."
21132
21207
  },
21208
+ {
21209
+ "name": "brandHref",
21210
+ "type": "string",
21211
+ "required": false,
21212
+ "description": "Makes the logo row a link to this address, through linkComponent when one is passed. The link wraps the logo, mark and brand, so brand must hold no link of its own. Needs brandLabel or brandName."
21213
+ },
21214
+ {
21215
+ "name": "brandLabel",
21216
+ "type": "string",
21217
+ "required": false,
21218
+ "description": "The brand link's accessible name, such as Acme home. Used only with brandHref; defaults to brandName."
21219
+ },
21133
21220
  {
21134
21221
  "name": "brandName",
21135
21222
  "type": "string",
@@ -26072,7 +26159,7 @@
26072
26159
  "name": "description",
26073
26160
  "type": "node",
26074
26161
  "required": false,
26075
- "description": "A plain line of text under the title."
26162
+ "description": "A plain line of text under the title. With markdown set it is Markdown source and must be a string."
26076
26163
  },
26077
26164
  {
26078
26165
  "name": "eyebrow",
@@ -26096,7 +26183,7 @@
26096
26183
  "name": "note",
26097
26184
  "type": "string",
26098
26185
  "required": false,
26099
- "description": "A boxed note under the item."
26186
+ "description": "A boxed note under the item. With markdown set it is Markdown source."
26100
26187
  },
26101
26188
  {
26102
26189
  "name": "status",
@@ -26143,6 +26230,13 @@
26143
26230
  "description": "The entries. Feed: newest first. Progress and steps: first stage first.",
26144
26231
  "default": []
26145
26232
  },
26233
+ {
26234
+ "name": "markdown",
26235
+ "type": "boolean",
26236
+ "required": false,
26237
+ "description": "Draws each item's description and note as Markdown (bold, italics, lists, links, code); raw HTML shows as text. Both must then be strings. Unset, they show as plain text.",
26238
+ "default": false
26239
+ },
26146
26240
  {
26147
26241
  "name": "orientation",
26148
26242
  "type": "enum",
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "name": "webority-web",
3
- "version": "0.147.0",
3
+ "version": "0.149.0",
4
4
  "platform": "Web",
5
5
  "kitModuleVersion": 2,
6
6
  "rendererProtocolVersion": 13,
7
7
  "library": {
8
8
  "name": "@webority/ui-react",
9
- "version": "0.147.0"
9
+ "version": "0.149.0"
10
10
  },
11
11
  "files": {
12
12
  "manifest.json": {
13
- "sha256": "589881477f87c4e6140e57f74f1b366fef5d7dc8f52d8b7798e3200814f16fc8",
14
- "bytes": 984118
13
+ "sha256": "995913281b5628e54e63a1225605b9fd6b1e0a0c526d9293741985da88ff396c",
14
+ "bytes": 988201
15
15
  },
16
16
  "kit.js": {
17
- "sha256": "38a9487fa56d34c667467ca1921eea81dc67a5a993a62d3a7a59b01d128ecfcd",
18
- "bytes": 11180593
17
+ "sha256": "a88bfe1c522365bf99b8d9bbed113188e4d45b676f89eabdae50bf26f88ddd12",
18
+ "bytes": 11188610
19
19
  },
20
20
  "kit.css": {
21
21
  "sha256": "13b14f71fb6ea024945f95cba617b4f1d49f44a65ba7c7ed05d2354805539ef6",
@@ -1 +1 @@
1
- import e from"../lib/fillLabel.js";import{initialsOf as t}from"../lib/initials.js";import{linkTarget as n}from"../lib/linkTarget.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./AppAvatar.js";import a from"./AppBadge.js";import o from"./AppButton.js";import s from"./AppIcon.js";import c from"./assertValidValue.js";import l from"./warnUnknownProps.js";import{parseMentionValue as u}from"@webority/ui-elements/elements/mention-input";import{formatDate as d,formatFileSize as f,formatNumber as p,toInstant as m}from"@webority/ui-elements/helpers";import{Fragment as h,useEffect as g,useId as _,useRef as v}from"react";import{jsx as y,jsxs as b}from"react/jsx-runtime";import{COMMENT_REACTIONS as x,COMMENT_TEXT as S}from"@webority/ui-elements/elements/comment-thread";var C=[`stacked`,`inline`],w=[`list`,`conversation`];function T(e){let{marker:t,props:n}=r(`AppCommentThread`,e),{comments:a=[],onPost:s,onReply:u,onEdit:d,onDelete:f,onReact:p,people:m,loadPeople:h,reactionChoices:T,allowReplies:D=!0,allowReactions:O=!0,composerPlaceholder:k,variant:A=`list`,composer:j=`stacked`,author:M,postLabel:N=S.post,composerRows:P,readOnly:F=!1,linkComponent:I,label:L=S.listName,internalLabel:R=`Internal note`,attachmentsLabel:z=`Attachments`,composerLabel:B=`Add a comment`,noCommentsText:V=`No comments yet.`,reactionsLabel:H=`Reactions`,repliesToLabel:U=`Replies to {name}`,editedLabel:W=`Edited`,deletedText:G=`This comment was deleted.`,replyLabel:K=`Reply`,editLabel:q=`Edit`,deleteLabel:ee=`Delete`,deleteConfirmText:te=`Delete this comment?`,cancelLabel:ne=`Cancel`,addReactionLabel:re=`Add a reaction`,chooseReactionLabel:ie=`Choose a reaction`,peopleLabel:ae=`People`,id:oe,className:se=``,...J}=n;l(`AppCommentThread`,J),c(`AppCommentThread`,`variant`,A,w),c(`AppCommentThread`,`composer`,j,C);let ce=_(),Y=oe||`comment-thread-${ce.replace(/[^a-zA-Z0-9_-]/g,``)}`,X=v(null),Z=typeof h==`function`,le=T?.length?T:x,Q=j===`inline`,ue=P??(Q?1:3),de={reactionsLabel:H,repliesToLabel:U,editedLabel:W,deletedText:G,replyLabel:K,editLabel:q,deleteLabel:ee,deleteConfirmText:te,cancelLabel:ne,addReactionLabel:re},$=v(null);return $.current={onPost:s,onReply:u,onEdit:d,onDelete:f,onReact:p,loadPeople:h},g(()=>{let e=X.current;if(e)return e.submit=async({intent:e,commentId:t,parentId:n,body:r,emoji:i})=>{let a=$.current;e===`post`?await a.onPost?.(r):e===`reply`?await a.onReply?.(n,r):e===`edit`?await a.onEdit?.(t,r):e===`delete`?await a.onDelete?.(t):e===`react`&&await a.onReact?.(t,i)},()=>{e.submit=void 0}},[]),g(()=>{let e=X.current;e&&!Z&&(e.people=m||[])},[m,Z]),g(()=>{let e=X.current;if(!e||!Z)return;let t=/* @__PURE__ */ new WeakMap,n=async e=>{let n=e.target,r=(t.get(n)??0)+1;t.set(n,r),n.loading=!0;try{let i=await $.current.loadPeople(e.detail.query);t.get(n)===r&&(n.people=i||[])}catch{t.get(n)===r&&(n.people=[])}finally{t.get(n)===r&&(n.loading=!1)}};return e.addEventListener(`search`,n),()=>e.removeEventListener(`search`,n)},[Z]),/* @__PURE__ */ b(`wui-comment-thread`,{ref:X,id:Y,class:[`wui-comment-thread`,A===`conversation`&&`wui-comment-thread--conversation`,se].filter(Boolean).join(` `),controlled:``,"read-only":F?``:void 0,remote:Z?``:void 0,"reaction-choices":T?.length?T.join(` `):void 0,"no-replies":D?void 0:``,"no-reactions":O?void 0:``,"composer-placeholder":k,...t,...J,children:[/* @__PURE__ */ y(`div`,{className:`wui-comment-items`,"data-wui-items":``,children:a.length?/* @__PURE__ */ y(`ol`,{className:`wui-comment-list`,"aria-label":L,children:a.map(e=>/* @__PURE__ */ y(E,{comment:e,topLevel:!0,readOnly:F,allowReplies:D,allowReactions:O,linkComponent:I,internalLabel:R,attachmentsLabel:z,text:de},e.id))}):/* @__PURE__ */ y(`p`,{className:`wui-comment-empty`,children:V})}),!F&&O&&/* @__PURE__ */ y(`div`,{className:`wui-reaction-picker`,role:`group`,"aria-label":ie,"data-wui-picker":``,hidden:!0,children:le.map(e=>/* @__PURE__ */ y(`button`,{type:`button`,className:`wui-reaction-choice`,"data-wui-emoji":e,children:e},e))}),!F&&/* @__PURE__ */ b(`div`,{className:Q?`wui-comment-composer wui-comment-composer-inline`:`wui-comment-composer`,"data-wui-composer":``,children:[Q&&M?/* @__PURE__ */ y(i,{name:M,size:`sm`,tone:`auto`,className:`wui-comment-composer-avatar`}):null,/* @__PURE__ */ y(`wui-mention-input`,{id:`${Y}-new`,class:`wui-mention-input`,label:B,"people-label":ae,placeholder:k??S.composerPlaceholder,rows:String(ue),remote:Z?``:void 0}),/* @__PURE__ */ y(`div`,{className:`wui-comment-form-actions`,children:/* @__PURE__ */ y(o,{variant:Q?`outline`:`solid`,size:`sm`,"data-wui-action":`post`,children:N})}),/* @__PURE__ */ y(`div`,{className:`wui-comment-error`,"data-wui-error":``,hidden:!0})]}),/* @__PURE__ */ y(`span`,{className:`visually-hidden`,"data-wui-live":``,"aria-live":`polite`,"aria-atomic":`true`})]})}function E({comment:r,topLevel:i=!1,readOnly:c,allowReplies:l,allowReactions:g,linkComponent:_,internalLabel:v,attachmentsLabel:x,text:S}){let{id:C,author:w,at:T,value:D,edited:O,mine:k,internal:A,attachments:j=[],deleted:M,canEdit:N,canDelete:P,reactions:F=[],replies:I=[]}=r,L=w?.name||``,R=m(T),z=!c&&!M&&N,B=!c&&!M&&P,V=i&&l,H=[`wui-comment`,A&&`wui-comment--internal`,k&&`wui-comment--mine`].filter(Boolean).join(` `);return/* @__PURE__ */ b(`li`,{className:H,"data-wui-comment":C,"data-value":D??``,"data-wui-deleted":M?``:void 0,children:[/* @__PURE__ */ b(`div`,{className:`wui-comment-row`,children:[/* @__PURE__ */ b(`span`,{className:`avatar avatar-sm wui-comment-avatar`,"aria-hidden":`true`,children:[/* @__PURE__ */ y(`span`,{className:`avatar-face`,children:t(L)||`?`}),w?.src&&/* @__PURE__ */ y(`img`,{className:`avatar-img`,src:w.src,alt:``,onError:e=>{e.currentTarget.hidden=!0}})]}),/* @__PURE__ */ b(`div`,{className:`wui-comment-main`,children:[/* @__PURE__ */ b(`div`,{className:`wui-comment-head`,children:[/* @__PURE__ */ y(`span`,{className:`wui-comment-author`,children:L}),/* @__PURE__ */ y(`time`,{className:`wui-comment-time`,dateTime:Number.isFinite(R)?new Date(R).toISOString():void 0,children:d(T,{pattern:`datetime`})}),O&&!M&&/* @__PURE__ */ y(`span`,{className:`wui-comment-edited`,children:S.editedLabel}),A&&/* @__PURE__ */ y(a,{className:`wui-comment-internal-badge`,children:v})]}),M?/* @__PURE__ */ y(`div`,{className:`wui-comment-text wui-comment-text-deleted`,children:S.deletedText}):/* @__PURE__ */ y(`div`,{className:`wui-comment-text`,"data-wui-text":``,children:u(D).map((e,t)=>`text`in e?/* @__PURE__ */ y(h,{children:e.text},t):/* @__PURE__ */ b(`span`,{className:`wui-mention`,"data-mention-id":e.id,children:[`@`,e.label]},t))}),!M&&j.length>0&&/* @__PURE__ */ y(`ul`,{className:`wui-comment-attachments`,"aria-label":x,children:j.map(e=>{let{Tag:t,linkProps:r}=n(_,{to:e.to,href:e.href,routeHref:!1});return/* @__PURE__ */ b(`li`,{children:[/* @__PURE__ */ b(t,{className:`wui-comment-attachment`,...r,...e.to?{}:{download:!0},children:[/* @__PURE__ */ y(s,{name:`paperclip`,size:14}),e.name]}),typeof e.sizeBytes==`number`&&/* @__PURE__ */ y(`span`,{className:`wui-comment-attachment-size`,children:f(e.sizeBytes)})]},e.to??e.href)})}),z&&/* @__PURE__ */ y(`div`,{className:`wui-comment-editor`,"data-wui-editor":``,hidden:!0}),g&&!M&&(F.length>0||!c)&&/* @__PURE__ */ b(`div`,{className:`wui-comment-reactions`,role:`group`,"aria-label":S.reactionsLabel,children:[F.map(e=>c?/* @__PURE__ */ b(`span`,{className:e.mine?`wui-reaction wui-reaction-mine`:`wui-reaction`,children:[/* @__PURE__ */ y(`span`,{className:`wui-reaction-emoji`,children:e.emoji}),/* @__PURE__ */ y(`span`,{className:`wui-reaction-count`,children:p(e.count,{decimals:0})})]},e.emoji):/* @__PURE__ */ b(`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__ */ y(`span`,{className:`wui-reaction-emoji`,children:e.emoji}),/* @__PURE__ */ y(`span`,{className:`wui-reaction-count`,children:p(e.count,{decimals:0})})]},e.emoji)),!c&&/* @__PURE__ */ y(`button`,{type:`button`,className:`wui-reaction-add`,"data-wui-action":`react-menu`,"aria-label":S.addReactionLabel,"aria-haspopup":`true`,"aria-expanded":`false`,children:/* @__PURE__ */ y(s,{name:`emoji-smile`,size:16})})]}),!c&&!M&&(V||z||B)&&/* @__PURE__ */ b(`div`,{className:`wui-comment-actions`,"data-wui-actions":``,children:[V&&/* @__PURE__ */ y(`button`,{type:`button`,className:`wui-comment-action`,"data-wui-action":`reply`,children:S.replyLabel}),z&&/* @__PURE__ */ y(`button`,{type:`button`,className:`wui-comment-action`,"data-wui-action":`edit`,children:S.editLabel}),B&&/* @__PURE__ */ y(`button`,{type:`button`,className:`wui-comment-action`,"data-wui-action":`delete`,children:S.deleteLabel})]}),B&&/* @__PURE__ */ b(`div`,{className:`wui-comment-confirm`,"data-wui-confirm":``,hidden:!0,children:[/* @__PURE__ */ y(`span`,{className:`wui-comment-confirm-text`,children:S.deleteConfirmText}),/* @__PURE__ */ y(o,{tone:`danger`,size:`sm`,"data-wui-action":`confirm-delete`,children:S.deleteLabel}),/* @__PURE__ */ y(o,{variant:`ghost`,size:`sm`,"data-wui-action":`cancel-delete`,children:S.cancelLabel})]}),!c&&/* @__PURE__ */ y(`div`,{className:`wui-comment-error`,"data-wui-error":``,hidden:!0})]})]}),i&&I.length>0&&/* @__PURE__ */ y(`ol`,{className:`wui-comment-list wui-comment-replies`,"aria-label":e(S.repliesToLabel,{name:L}),children:I.map(e=>/* @__PURE__ */ y(E,{comment:e,readOnly:c,allowReactions:g,linkComponent:_,internalLabel:v,attachmentsLabel:x,text:S},e.id))}),V&&!c&&!M&&/* @__PURE__ */ y(`div`,{className:`wui-comment-reply`,"data-wui-reply":``,hidden:!0})]})}export{T as default};
1
+ import e from"../lib/fillLabel.js";import{initialsOf as t}from"../lib/initials.js";import{linkTarget as n}from"../lib/linkTarget.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./AppAvatar.js";import a from"./AppBadge.js";import o from"./AppButton.js";import s from"./AppIcon.js";import c from"./AppMarkdown.js";import l from"./assertValidValue.js";import u from"./warnUnknownProps.js";import{mentionTextFromValue as d,parseMentionValue as f}from"@webority/ui-elements/elements/mention-input";import{formatDate as p,formatFileSize as m,formatNumber as h,toInstant as g}from"@webority/ui-elements/helpers";import{Fragment as _,useEffect as v,useId as y,useRef as b}from"react";import{jsx as x,jsxs as S}from"react/jsx-runtime";import{COMMENT_REACTIONS as C,COMMENT_TEXT as w}from"@webority/ui-elements/elements/comment-thread";var T=[`stacked`,`inline`],E=[`list`,`conversation`];function D(e){let{marker:t,props:n}=r(`AppCommentThread`,e),{comments:a=[],onPost:s,onReply:c,onEdit:d,onDelete:f,onReact:p,people:m,loadPeople:h,reactionChoices:g,allowReplies:_=!0,allowReactions:D=!0,composerPlaceholder:k,variant:A=`list`,composer:j=`stacked`,author:M,postLabel:N=w.post,composerRows:P,readOnly:F=!1,markdown:I=!1,linkComponent:L,label:R=w.listName,internalLabel:z=`Internal note`,attachmentsLabel:B=`Attachments`,composerLabel:V=`Add a comment`,noCommentsText:H=`No comments yet.`,reactionsLabel:U=`Reactions`,repliesToLabel:W=`Replies to {name}`,editedLabel:G=`Edited`,deletedText:K=`This comment was deleted.`,replyLabel:q=`Reply`,editLabel:ee=`Edit`,deleteLabel:te=`Delete`,deleteConfirmText:ne=`Delete this comment?`,cancelLabel:re=`Cancel`,addReactionLabel:ie=`Add a reaction`,chooseReactionLabel:ae=`Choose a reaction`,peopleLabel:oe=`People`,id:se,className:ce=``,...J}=n;u(`AppCommentThread`,J),l(`AppCommentThread`,`variant`,A,E),l(`AppCommentThread`,`composer`,j,T);let le=y(),Y=se||`comment-thread-${le.replace(/[^a-zA-Z0-9_-]/g,``)}`,X=b(null),Z=typeof h==`function`,ue=g?.length?g:C,Q=j===`inline`,de=P??(Q?1:3),fe={reactionsLabel:U,repliesToLabel:W,editedLabel:G,deletedText:K,replyLabel:q,editLabel:ee,deleteLabel:te,deleteConfirmText:ne,cancelLabel:re,addReactionLabel:ie},$=b(null);return $.current={onPost:s,onReply:c,onEdit:d,onDelete:f,onReact:p,loadPeople:h},v(()=>{let e=X.current;if(e)return e.submit=async({intent:e,commentId:t,parentId:n,body:r,emoji:i})=>{let a=$.current;e===`post`?await a.onPost?.(r):e===`reply`?await a.onReply?.(n,r):e===`edit`?await a.onEdit?.(t,r):e===`delete`?await a.onDelete?.(t):e===`react`&&await a.onReact?.(t,i)},()=>{e.submit=void 0}},[]),v(()=>{let e=X.current;e&&!Z&&(e.people=m||[])},[m,Z]),v(()=>{let e=X.current;if(!e||!Z)return;let t=/* @__PURE__ */ new WeakMap,n=async e=>{let n=e.target,r=(t.get(n)??0)+1;t.set(n,r),n.loading=!0;try{let i=await $.current.loadPeople(e.detail.query);t.get(n)===r&&(n.people=i||[])}catch{t.get(n)===r&&(n.people=[])}finally{t.get(n)===r&&(n.loading=!1)}};return e.addEventListener(`search`,n),()=>e.removeEventListener(`search`,n)},[Z]),/* @__PURE__ */ S(`wui-comment-thread`,{ref:X,id:Y,class:[`wui-comment-thread`,A===`conversation`&&`wui-comment-thread--conversation`,ce].filter(Boolean).join(` `),controlled:``,"read-only":F?``:void 0,remote:Z?``:void 0,"reaction-choices":g?.length?g.join(` `):void 0,"no-replies":_?void 0:``,"no-reactions":D?void 0:``,"composer-placeholder":k,...t,...J,children:[/* @__PURE__ */ x(`div`,{className:`wui-comment-items`,"data-wui-items":``,children:a.length?/* @__PURE__ */ x(`ol`,{className:`wui-comment-list`,"aria-label":R,children:a.map(e=>/* @__PURE__ */ x(O,{comment:e,topLevel:!0,readOnly:F,allowReplies:_,allowReactions:D,markdown:I,linkComponent:L,internalLabel:z,attachmentsLabel:B,text:fe},e.id))}):/* @__PURE__ */ x(`p`,{className:`wui-comment-empty`,children:H})}),!F&&D&&/* @__PURE__ */ x(`div`,{className:`wui-reaction-picker`,role:`group`,"aria-label":ae,"data-wui-picker":``,hidden:!0,children:ue.map(e=>/* @__PURE__ */ x(`button`,{type:`button`,className:`wui-reaction-choice`,"data-wui-emoji":e,children:e},e))}),!F&&/* @__PURE__ */ S(`div`,{className:Q?`wui-comment-composer wui-comment-composer-inline`:`wui-comment-composer`,"data-wui-composer":``,children:[Q&&M?/* @__PURE__ */ x(i,{name:M,size:`sm`,tone:`auto`,className:`wui-comment-composer-avatar`}):null,/* @__PURE__ */ x(`wui-mention-input`,{id:`${Y}-new`,class:`wui-mention-input`,label:V,"people-label":oe,placeholder:k??w.composerPlaceholder,rows:String(de),remote:Z?``:void 0}),/* @__PURE__ */ x(`div`,{className:`wui-comment-form-actions`,children:/* @__PURE__ */ x(o,{variant:Q?`outline`:`solid`,size:`sm`,"data-wui-action":`post`,children:N})}),/* @__PURE__ */ x(`div`,{className:`wui-comment-error`,"data-wui-error":``,hidden:!0})]}),/* @__PURE__ */ x(`span`,{className:`visually-hidden`,"data-wui-live":``,"aria-live":`polite`,"aria-atomic":`true`})]})}function O({comment:r,topLevel:i=!1,readOnly:l,allowReplies:u,allowReactions:v,markdown:y,linkComponent:b,internalLabel:C,attachmentsLabel:w,text:T}){let{id:E,author:D,at:k,value:A,edited:j,mine:M,internal:N,attachments:P=[],deleted:F,canEdit:I,canDelete:L,reactions:R=[],replies:z=[]}=r,B=D?.name||``,V=g(k),H=!l&&!F&&I,U=!l&&!F&&L,W=i&&u,G=[`wui-comment`,N&&`wui-comment--internal`,M&&`wui-comment--mine`].filter(Boolean).join(` `);return/* @__PURE__ */ S(`li`,{className:G,"data-wui-comment":E,"data-value":A??``,"data-wui-deleted":F?``:void 0,children:[/* @__PURE__ */ S(`div`,{className:`wui-comment-row`,children:[/* @__PURE__ */ S(`span`,{className:`avatar avatar-sm wui-comment-avatar`,"aria-hidden":`true`,children:[/* @__PURE__ */ x(`span`,{className:`avatar-face`,children:t(B)||`?`}),D?.src&&/* @__PURE__ */ x(`img`,{className:`avatar-img`,src:D.src,alt:``,onError:e=>{e.currentTarget.hidden=!0}})]}),/* @__PURE__ */ S(`div`,{className:`wui-comment-main`,children:[/* @__PURE__ */ S(`div`,{className:`wui-comment-head`,children:[/* @__PURE__ */ x(`span`,{className:`wui-comment-author`,children:B}),/* @__PURE__ */ x(`time`,{className:`wui-comment-time`,dateTime:Number.isFinite(V)?new Date(V).toISOString():void 0,children:p(k,{pattern:`datetime`})}),j&&!F&&/* @__PURE__ */ x(`span`,{className:`wui-comment-edited`,children:T.editedLabel}),N&&/* @__PURE__ */ x(a,{className:`wui-comment-internal-badge`,children:C})]}),F?/* @__PURE__ */ x(`div`,{className:`wui-comment-text wui-comment-text-deleted`,children:T.deletedText}):/* @__PURE__ */ x(`div`,{className:y?`wui-comment-text wui-comment-text--markdown`:`wui-comment-text`,"data-wui-text":``,children:y?/* @__PURE__ */ x(c,{value:d(A).text,headings:`text`}):f(A).map((e,t)=>`text`in e?/* @__PURE__ */ x(_,{children:e.text},t):/* @__PURE__ */ S(`span`,{className:`wui-mention`,"data-mention-id":e.id,children:[`@`,e.label]},t))}),!F&&P.length>0&&/* @__PURE__ */ x(`ul`,{className:`wui-comment-attachments`,"aria-label":w,children:P.map(e=>{let{Tag:t,linkProps:r}=n(b,{to:e.to,href:e.href,routeHref:!1});return/* @__PURE__ */ S(`li`,{children:[/* @__PURE__ */ S(t,{className:`wui-comment-attachment`,...r,...e.to?{}:{download:!0},children:[/* @__PURE__ */ x(s,{name:`paperclip`,size:14}),e.name]}),typeof e.sizeBytes==`number`&&/* @__PURE__ */ x(`span`,{className:`wui-comment-attachment-size`,children:m(e.sizeBytes)})]},e.to??e.href)})}),H&&/* @__PURE__ */ x(`div`,{className:`wui-comment-editor`,"data-wui-editor":``,hidden:!0}),v&&!F&&(R.length>0||!l)&&/* @__PURE__ */ S(`div`,{className:`wui-comment-reactions`,role:`group`,"aria-label":T.reactionsLabel,children:[R.map(e=>l?/* @__PURE__ */ S(`span`,{className:e.mine?`wui-reaction wui-reaction-mine`:`wui-reaction`,children:[/* @__PURE__ */ x(`span`,{className:`wui-reaction-emoji`,children:e.emoji}),/* @__PURE__ */ x(`span`,{className:`wui-reaction-count`,children:h(e.count,{decimals:0})})]},e.emoji):/* @__PURE__ */ S(`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__ */ x(`span`,{className:`wui-reaction-emoji`,children:e.emoji}),/* @__PURE__ */ x(`span`,{className:`wui-reaction-count`,children:h(e.count,{decimals:0})})]},e.emoji)),!l&&/* @__PURE__ */ x(`button`,{type:`button`,className:`wui-reaction-add`,"data-wui-action":`react-menu`,"aria-label":T.addReactionLabel,"aria-haspopup":`true`,"aria-expanded":`false`,children:/* @__PURE__ */ x(s,{name:`emoji-smile`,size:16})})]}),!l&&!F&&(W||H||U)&&/* @__PURE__ */ S(`div`,{className:`wui-comment-actions`,"data-wui-actions":``,children:[W&&/* @__PURE__ */ x(`button`,{type:`button`,className:`wui-comment-action`,"data-wui-action":`reply`,children:T.replyLabel}),H&&/* @__PURE__ */ x(`button`,{type:`button`,className:`wui-comment-action`,"data-wui-action":`edit`,children:T.editLabel}),U&&/* @__PURE__ */ x(`button`,{type:`button`,className:`wui-comment-action`,"data-wui-action":`delete`,children:T.deleteLabel})]}),U&&/* @__PURE__ */ S(`div`,{className:`wui-comment-confirm`,"data-wui-confirm":``,hidden:!0,children:[/* @__PURE__ */ x(`span`,{className:`wui-comment-confirm-text`,children:T.deleteConfirmText}),/* @__PURE__ */ x(o,{tone:`danger`,size:`sm`,"data-wui-action":`confirm-delete`,children:T.deleteLabel}),/* @__PURE__ */ x(o,{variant:`ghost`,size:`sm`,"data-wui-action":`cancel-delete`,children:T.cancelLabel})]}),!l&&/* @__PURE__ */ x(`div`,{className:`wui-comment-error`,"data-wui-error":``,hidden:!0})]})]}),i&&z.length>0&&/* @__PURE__ */ x(`ol`,{className:`wui-comment-list wui-comment-replies`,"aria-label":e(T.repliesToLabel,{name:B}),children:z.map(e=>/* @__PURE__ */ x(O,{comment:e,readOnly:l,allowReactions:v,markdown:y,linkComponent:b,internalLabel:C,attachmentsLabel:w,text:T},e.id))}),W&&!l&&!F&&/* @__PURE__ */ x(`div`,{className:`wui-comment-reply`,"data-wui-reply":``,hidden:!0})]})}export{D as default};
@@ -1 +1 @@
1
- import e from"../lib/fillLabel.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppButton.js";import r from"./AppIcon.js";import i from"./AppInput.js";import a from"./AppModal.js";import o from"./assertValidValue.js";import{MODAL_ICONS as s}from"./ModalIcons.js";import c from"./warnUnknownProps.js";import{useEffect as l,useState as u}from"react";import{Fragment as d,jsx as f,jsxs as p}from"react/jsx-runtime";var m=[`sm`,`md`,`lg`,`xl`],h=[`default`,`plain`],g=[`success`,`danger`,`warning`,`info`,`primary`];function _(_){let{marker:v,props:y}=t(`AppConfirmDialog`,_),{open:b,title:x,variant:S=`default`,description:C,confirmLabel:w=`Confirm`,cancelLabel:T=`Cancel`,typePhraseLabel:E=`Type {phrase} to confirm`,tone:D,image:O,icon:k,iconSize:A,confirmPhrase:j,onConfirm:M,onClose:N,loading:P=!1,staticBackdrop:F=!0,placement:I=`center`,size:L=`md`,className:R=``,children:z,...B}=y;c(`AppConfirmDialog`,B),o(`AppConfirmDialog`,`tone`,D,g),o(`AppConfirmDialog`,`size`,typeof L==`string`?L:null,m),o(`AppConfirmDialog`,`variant`,S,h);let[V,H]=u(``);if(l(()=>{b||H(``)},[b]),!b)return null;let U=!!j&&V.trim()!==j,[W,...G]=E.split(`{phrase}`),K=G.join(j),q=S===`plain`,J=q?`sm`:`md`,Y=q||O||k?null:s[D===`danger`?`delete`:D??`info`],X=A>0?{"--wui-confirm-icon-size":`${A}px`}:void 0,Z=()=>{P||N?.()};return/* @__PURE__ */ f(a,{...v,...B,open:b,hideHeader:!0,title:x,onClose:Z,staticBackdrop:F,placement:I,size:L,className:[`wui-confirm`,q&&`wui-confirm-plain`,R].filter(Boolean).join(` `),footer:/* @__PURE__ */ p(`div`,{className:`wui-confirm-actions`,children:[/* @__PURE__ */ f(n,{tone:`neutral`,...q?{}:{variant:`soft`},size:J,disabled:P,onClick:Z,children:T}),/* @__PURE__ */ f(n,{tone:D===`danger`?`danger`:void 0,size:J,disabled:U,loading:P,onClick:M,children:w})]}),children:/* @__PURE__ */ p(`div`,{className:`wui-confirm-content`,children:[!q&&O?/* @__PURE__ */ f(`span`,{className:`wui-confirm-icon`,style:X,children:/* @__PURE__ */ f(`img`,{src:O,alt:``,"aria-hidden":`true`})}):!q&&k?/* @__PURE__ */ f(`span`,{className:`wui-confirm-icon`,style:X,children:typeof k==`string`?/* @__PURE__ */ f(r,{name:k,size:80}):k}):Y&&/* @__PURE__ */ f(`span`,{className:`wui-confirm-icon`,style:X,children:/* @__PURE__ */ f(Y,{size:120})}),/* @__PURE__ */ f(`h3`,{className:`wui-confirm-title`,tabIndex:-1,"data-autofocus":``,children:x}),C&&/* @__PURE__ */ f(`p`,{className:`wui-confirm-msg`,children:C}),z!=null&&z!==!1&&/* @__PURE__ */ f(`div`,{className:`wui-confirm-body`,children:z}),j&&/* @__PURE__ */ f(i,{fieldClassName:`mt-3 mb-0 w-100 text-start`,label:/* @__PURE__ */ p(d,{children:[W,/* @__PURE__ */ f(`strong`,{children:j}),K]}),value:V,onChange:e=>H(e.target.value),"aria-label":e(E,{phrase:j}),disabled:P})]})})}export{_ as default};
1
+ import e from"../lib/fillLabel.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppButton.js";import r from"./AppIcon.js";import i from"./AppInput.js";import a from"./AppModal.js";import o from"./assertValidValue.js";import{MODAL_ICONS as s}from"./ModalIcons.js";import c from"./warnUnknownProps.js";import{useEffect as l,useState as u}from"react";import{Fragment as d,jsx as f,jsxs as p}from"react/jsx-runtime";var m=[`sm`,`md`,`lg`,`xl`],h=[`default`,`plain`],g=[`success`,`danger`,`warning`,`info`,`primary`];function _(_){let{marker:v,props:y}=t(`AppConfirmDialog`,_),{open:b,title:x,variant:S=`default`,description:C,confirmLabel:w=`Confirm`,cancelLabel:T=`Cancel`,typePhraseLabel:E=`Type {phrase} to confirm`,tone:D,image:O,icon:k,iconSize:A,confirmPhrase:j,onConfirm:M,onClose:N,loading:P=!1,staticBackdrop:F=!0,placement:I=`center`,size:L=`md`,className:R=``,children:z,...B}=y;c(`AppConfirmDialog`,B),o(`AppConfirmDialog`,`tone`,D,g),o(`AppConfirmDialog`,`size`,typeof L==`string`?L:null,m),o(`AppConfirmDialog`,`variant`,S,h);let[V,H]=u(``);if(l(()=>{b||H(``)},[b]),!b)return null;let U=!!j&&V.trim()!==j,[W,...G]=E.split(`{phrase}`),K=G.join(j),q=S===`plain`,J=q?`sm`:`md`,Y=q||O||k?null:s[D===`danger`?`delete`:D??`info`],X=A>0?{"--wui-confirm-icon-size":`${A}px`}:void 0,Z=()=>{P||N?.()};return/* @__PURE__ */ f(a,{...v,...B,open:b,hideHeader:!0,title:x,onClose:Z,staticBackdrop:F,closeOnEscape:!F,placement:I,size:L,className:[`wui-confirm`,q&&`wui-confirm-plain`,R].filter(Boolean).join(` `),footer:/* @__PURE__ */ p(`div`,{className:`wui-confirm-actions`,children:[/* @__PURE__ */ f(n,{tone:`neutral`,...q?{}:{variant:`soft`},size:J,disabled:P,onClick:Z,children:T}),/* @__PURE__ */ f(n,{tone:D===`danger`?`danger`:void 0,size:J,disabled:U,loading:P,onClick:M,children:w})]}),children:/* @__PURE__ */ p(`div`,{className:`wui-confirm-content`,children:[!q&&O?/* @__PURE__ */ f(`span`,{className:`wui-confirm-icon`,style:X,children:/* @__PURE__ */ f(`img`,{src:O,alt:``,"aria-hidden":`true`})}):!q&&k?/* @__PURE__ */ f(`span`,{className:`wui-confirm-icon`,style:X,children:typeof k==`string`?/* @__PURE__ */ f(r,{name:k,size:80}):k}):Y&&/* @__PURE__ */ f(`span`,{className:`wui-confirm-icon`,style:X,children:/* @__PURE__ */ f(Y,{size:120})}),/* @__PURE__ */ f(`h3`,{className:`wui-confirm-title`,tabIndex:-1,"data-autofocus":``,children:x}),C&&/* @__PURE__ */ f(`p`,{className:`wui-confirm-msg`,children:C}),z!=null&&z!==!1&&/* @__PURE__ */ f(`div`,{className:`wui-confirm-body`,children:z}),j&&/* @__PURE__ */ f(i,{fieldClassName:`mt-3 mb-0 w-100 text-start`,label:/* @__PURE__ */ p(d,{children:[W,/* @__PURE__ */ f(`strong`,{children:j}),K]}),value:V,onChange:e=>H(e.target.value),"aria-label":e(E,{phrase:j}),disabled:P})]})})}export{_ as default};
@@ -1 +1 @@
1
- import{devWarn as e}from"../lib/devWarn.js";import{shortcutAria as t,shortcutChip as n}from"../lib/shortcutChip.js";import{TONES as r}from"../lib/vocabulary.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./AppIcon.js";import o from"./assertValidValue.js";import s from"./renderIconProp.js";import c from"./warnUnknownProps.js";import l from"./withTooltip.js";import{Fragment as u,forwardRef as d,useEffect as f,useRef as p,useState as m}from"react";import{Dropdown as h}from"react-bootstrap";import{jsx as g,jsxs as _}from"react/jsx-runtime";var v=[`sm`,`md`,`lg`,`xl`],y=[`neutral`],b=[`sm`,`md`,`lg`],x=e=>{e.preventDefault(),e.stopPropagation()},S=d(function(e,t){return/* @__PURE__ */ g(`button`,{...e,ref:t,"aria-disabled":`true`})}),C=!1;function w(){let t=!0;try{t=process.env.NODE_ENV!==`production`}catch{t=!0}t&&!C&&(C=!0,e("[@webority/ui-react] <AppDropdown> icon-only toggle has no accessible name — pass `label` or `ariaLabel`."))}function T(a){let{marker:d,props:C}=i(`AppDropdown`,a),{icon:T,iconSize:D,toggleClassName:O,toggleVariant:k,menuWidth:A,label:j,ariaLabel:M,align:N=`end`,items:P=[],menuClassName:F=``,linkComponent:I,children:L,trigger:R,open:z,onOpenChange:B,...V}=C;c(`AppDropdown`,V);for(let e of P)o(`AppDropdown`,`items[].hiddenFrom`,e.hiddenFrom,v),o(`AppDropdown`,`items[].tone`,e.tone,r);R||M||j||w(),o(`AppDropdown`,`toggleVariant`,k,y),o(`AppDropdown`,`menuWidth`,A,b),k&&!R&&e(`AppDropdown: toggleVariant needs a trigger; the icon toggle ignores it.`);let H=(O??(R?`wui-dropdown-trigger`:`topbar-icon-btn`))+(R&&k===`neutral`?` wui-dropdown-trigger-neutral`:``),U=[F,b.includes(A)?`wui-dropdown-menu-${A}`:``].filter(Boolean).join(` `),W=T??(R?void 0:`more-horizontal`),G=z!==void 0,[K,q]=m(!1),J=G?!!z:K,Y=p(null);Y.current=(e,t)=>{G||q(e),B?.(e,t)};let X=p(null);return f(()=>{if(!J)return;let e=X.current?.getBoundingClientRect(),t=()=>{let t=X.current?.getBoundingClientRect();(!e||!t||Math.abs(t.top-e.top)>2||Math.abs(t.left-e.left)>2)&&Y.current(!1,{source:`scroll`})},n=()=>Y.current(!1,{source:`resize`});return window.addEventListener(`scroll`,t,{capture:!0,passive:!0}),window.addEventListener(`resize`,n),()=>{window.removeEventListener(`scroll`,t,{capture:!0}),window.removeEventListener(`resize`,n)}},[J]),/* @__PURE__ */ _(h,{ref:X,align:N,show:J,onToggle:(e,t)=>Y.current(e,t),...d,...V,children:[/* @__PURE__ */ g(h.Toggle,{as:E,icon:W,iconSize:D,btnClassName:H,trigger:R,title:j,"aria-label":M??(R?void 0:j)}),/* @__PURE__ */ g(h.Menu,{className:U,renderOnMount:!0,popperConfig:{strategy:`fixed`},children:L??P.map(e=>{if(e.header!=null)return/* @__PURE__ */ g(`div`,{className:`dropdown-header`,children:e.header},e.key);if(e.divider)return/* @__PURE__ */ g(h.Divider,{},e.key);if(e.disabled)return/* @__PURE__ */ g(u,{children:l(/* @__PURE__ */ _(h.Item,{as:S,type:`button`,className:[e.tone===`danger`&&`danger`,`wui-dropdown-item-disabled`].filter(Boolean).join(` `),onClick:x,children:[e.image?/* @__PURE__ */ g(`img`,{src:e.image,alt:``}):s(e.icon,{size:16}),e.label,e.disabledReason&&/* @__PURE__ */ _(`span`,{className:`visually-hidden wui-dropdown-item-reason`,children:[`: `,e.disabledReason]})]}),e.disabledReason,`auto`)},e.key);let r=e.to?I?{as:I,to:e.to}:{as:`a`,href:e.to}:{as:`button`,type:`button`},i=[e.tone===`danger`&&`danger`,v.includes(e.hiddenFrom)&&`wui-hidden-from-${e.hiddenFrom}`].filter(Boolean).join(` `)||void 0;return/* @__PURE__ */ _(h.Item,{...r,onClick:e.onClick,className:i,"aria-keyshortcuts":t(e.shortcut),children:[e.image?/* @__PURE__ */ g(`img`,{src:e.image,alt:``}):s(e.icon,{size:16}),e.label,n(e.shortcut)]},e.key)})})]})}var E=d(function({icon:e,iconSize:t=20,btnClassName:n=`topbar-icon-btn`,trigger:r,"aria-label":i,className:o,...s},c){return/* @__PURE__ */ g(`button`,{ref:c,type:`button`,className:n,"aria-label":i,...s,children:r??/* @__PURE__ */ g(a,{name:e,size:t})})});export{T as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";import{shortcutAria as t,shortcutChip as n}from"../lib/shortcutChip.js";import{TONES as r}from"../lib/vocabulary.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./AppIcon.js";import o from"./assertValidValue.js";import s from"./renderIconProp.js";import c from"./warnUnknownProps.js";import l from"./withTooltip.js";import{Fragment as u,forwardRef as d,useEffect as f,useRef as p,useState as m}from"react";import{Dropdown as h}from"react-bootstrap";import{jsx as g,jsxs as _}from"react/jsx-runtime";var v=[`sm`,`md`,`lg`,`xl`],y=[`neutral`],b=[`sm`,`md`,`lg`,`fit`],x=e=>{e.preventDefault(),e.stopPropagation()},S=d(function(e,t){return/* @__PURE__ */ g(`button`,{...e,ref:t,"aria-disabled":`true`})}),C=!1;function w(){let t=!0;try{t=process.env.NODE_ENV!==`production`}catch{t=!0}t&&!C&&(C=!0,e("[@webority/ui-react] <AppDropdown> icon-only toggle has no accessible name — pass `label` or `ariaLabel`."))}function T(a){let{marker:d,props:C}=i(`AppDropdown`,a),{icon:T,iconSize:D,toggleClassName:O,toggleVariant:k,menuWidth:A,label:j,ariaLabel:M,align:N=`end`,items:P=[],menuClassName:F=``,linkComponent:I,children:L,trigger:R,open:z,onOpenChange:B,...V}=C;c(`AppDropdown`,V);for(let e of P)o(`AppDropdown`,`items[].hiddenFrom`,e.hiddenFrom,v),o(`AppDropdown`,`items[].tone`,e.tone,r);R||M||j||w(),o(`AppDropdown`,`toggleVariant`,k,y),o(`AppDropdown`,`menuWidth`,A,b),k&&!R&&e(`AppDropdown: toggleVariant needs a trigger; the icon toggle ignores it.`);let H=(O??(R?`wui-dropdown-trigger`:`topbar-icon-btn`))+(R&&k===`neutral`?` wui-dropdown-trigger-neutral`:``),U=[F,b.includes(A)?`wui-dropdown-menu-${A}`:``].filter(Boolean).join(` `),W=T??(R?void 0:`more-horizontal`),G=z!==void 0,[K,q]=m(!1),J=G?!!z:K,Y=p(null);Y.current=(e,t)=>{G||q(e),B?.(e,t)};let X=p(null);return f(()=>{if(!J)return;let e=X.current?.getBoundingClientRect(),t=()=>{let t=X.current?.getBoundingClientRect();(!e||!t||Math.abs(t.top-e.top)>2||Math.abs(t.left-e.left)>2)&&Y.current(!1,{source:`scroll`})},n=()=>Y.current(!1,{source:`resize`});return window.addEventListener(`scroll`,t,{capture:!0,passive:!0}),window.addEventListener(`resize`,n),()=>{window.removeEventListener(`scroll`,t,{capture:!0}),window.removeEventListener(`resize`,n)}},[J]),/* @__PURE__ */ _(h,{ref:X,align:N,show:J,onToggle:(e,t)=>Y.current(e,t),...d,...V,children:[/* @__PURE__ */ g(h.Toggle,{as:E,icon:W,iconSize:D,btnClassName:H,trigger:R,title:j,"aria-label":M??(R?void 0:j)}),/* @__PURE__ */ g(h.Menu,{className:U,renderOnMount:!0,popperConfig:{strategy:`fixed`},children:L??P.map(e=>{if(e.header!=null)return/* @__PURE__ */ g(`div`,{className:`dropdown-header`,children:e.header},e.key);if(e.divider)return/* @__PURE__ */ g(h.Divider,{},e.key);if(e.disabled)return/* @__PURE__ */ g(u,{children:l(/* @__PURE__ */ _(h.Item,{as:S,type:`button`,className:[e.tone===`danger`&&`danger`,`wui-dropdown-item-disabled`].filter(Boolean).join(` `),onClick:x,children:[e.image?/* @__PURE__ */ g(`img`,{src:e.image,alt:``}):s(e.icon,{size:16}),e.label,e.disabledReason&&/* @__PURE__ */ _(`span`,{className:`visually-hidden wui-dropdown-item-reason`,children:[`: `,e.disabledReason]})]}),e.disabledReason,`auto`)},e.key);let r=e.to?I?{as:I,to:e.to}:{as:`a`,href:e.to}:{as:`button`,type:`button`},i=[e.tone===`danger`&&`danger`,v.includes(e.hiddenFrom)&&`wui-hidden-from-${e.hiddenFrom}`].filter(Boolean).join(` `)||void 0;return/* @__PURE__ */ _(h.Item,{...r,onClick:e.onClick,className:i,"aria-keyshortcuts":t(e.shortcut),children:[e.image?/* @__PURE__ */ g(`img`,{src:e.image,alt:``}):s(e.icon,{size:16}),e.label,n(e.shortcut)]},e.key)})})]})}var E=d(function({icon:e,iconSize:t=20,btnClassName:n=`topbar-icon-btn`,trigger:r,"aria-label":i,className:o,...s},c){return/* @__PURE__ */ g(`button`,{ref:c,type:`button`,className:n,"aria-label":i,...s,children:r??/* @__PURE__ */ g(a,{name:e,size:t})})});export{T as default};
@@ -1 +1 @@
1
- import e from"../lib/DiscardPrompt.js";import{devWarn as t}from"../lib/devWarn.js";import{lockPageScroll as n}from"../lib/pageScrollLock.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./AppIcon.js";import a from"./assertValidValue.js";import o from"./warnUnknownProps.js";import{useCallback as s,useEffect as c,useRef as l,useState as u}from"react";import{Modal as ee}from"react-bootstrap";import{jsx as d,jsxs as f}from"react/jsx-runtime";var te=[`neutral`,`danger`,`success`,`warning`],ne=[`center`,`top`],p=`a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])`,m={sm:380,md:440,lg:640,xl:880},re=`wui-modal-fullscreen`,h=!1;function ie(){let e=!0;try{e=process.env.NODE_ENV!==`production`}catch{e=!0}e&&!h&&(h=!0,t("[@webority/ui-react] <AppModal hideHeader> has no accessible name: pass `ariaLabel` (or a string `title`)."))}function g(e,t){if(e.key!==`Tab`)return;let n=Array.from(t.querySelectorAll(p));if(!n.length){e.preventDefault(),t.focus();return}let r=n[0],i=n[n.length-1],a=document.activeElement;e.shiftKey&&(a===r||a===t)?(e.preventDefault(),i.focus()):!e.shiftKey&&a===i&&(e.preventDefault(),r.focus())}function ae(){let e=[];for(let t of document.body.children)t.hasAttribute(`inert`)||t.matches(`.modal, .modal-backdrop`)||(t.setAttribute(`inert`,``),e.push(t));return e}function oe(){return typeof document<`u`&&document.querySelector(`wui-drawer[open], .offcanvas.show`)!==null}function _(t){let{marker:h,props:_}=r(`AppModal`,t),{open:v,eyebrow:y,title:b,subtitle:x,headerIcon:S,tone:C=`neutral`,dismissible:w=!0,onClose:T,onBack:E,backLabel:D=`Back`,headerActions:O,footer:k,size:A=`md`,placement:j=`center`,hideHeader:M=!1,staticBackdrop:N=!0,confirmDiscard:P,dirty:se=!1,ariaLabel:F,closeLabel:ce=`Close`,className:le=``,children:ue,...I}=_;o(`AppModal`,I),a(`AppModal`,`tone`,C,te),a(`AppModal`,`placement`,j,ne),a(`AppModal`,`size`,typeof A==`string`?A:null,[...Object.keys(m),`fullscreen`]);let{style:L,ref:R,"data-wui":z,"data-wui-props":B,...V}=I,H=z?{"data-wui":z,"data-wui-props":B}:h,U=H[`data-wui`],W=H[`data-wui-props`];M&&!F&&typeof b!=`string`&&ie();let G=l(null),K=l(null),[q,J]=u(!1);c(()=>{v||J(!1)},[v]),c(()=>{q&&K.current?.focus()},[q]),c(()=>{if(v)return n()},[v]),c(()=>{let e=G.current?.closest(`.modal`);e&&(P?e.setAttribute(`confirm-discard`,P):e.removeAttribute(`confirm-discard`))},[v,P]);let Y=l(null),de=s(e=>{Y.current=e,typeof R==`function`?R(e):R&&(R.current=e)},[R]);c(()=>{let e=Y.current?.dialog;e&&(e.setAttribute(`data-wui`,U),W===void 0?e.removeAttribute(`data-wui-props`):e.setAttribute(`data-wui-props`,W))},[v,U,W]),c(()=>{if(!v)return;let e=G.current?.closest(`.modal-content`);if(!e)return;let t=()=>Array.from(e.querySelectorAll(p));(e.querySelector(`[data-autofocus]`)||t().find(e=>!e.classList.contains(`wui-modal-close`)&&!e.classList.contains(`wui-modal-back`))||t()[0]||e).focus?.({preventScroll:!0});let n=e.closest(`.modal`),r=ae(),i=e=>g(e,n);return n?.addEventListener(`keydown`,i),()=>{n?.removeEventListener(`keydown`,i);for(let e of r)e.removeAttribute(`inert`);n&&setTimeout(()=>{n.isConnected&&!n.classList.contains(`show`)&&n.dispatchEvent(new Event(`transitionend`,{bubbles:!0}))},500)}},[v]);let X=()=>{P&&se?J(!0):T?.()},Z=e=>{e.target.closest?.(`[data-wui-dismiss]`)&&X()},fe=()=>{J(!1),T?.()},pe=()=>{J(!1),(G.current?.querySelector(`input:not([type="hidden"]):not([disabled]),select:not([disabled]),textarea:not([disabled])`))?.focus()},Q=A===`fullscreen`,me=typeof A==`number`?A:m[A]??m.md,he=[`wui-modal`,C===`neutral`?``:`tone-${C}`,le].filter(Boolean).join(` `),$=v&&oe(),ge=[`wui-modal-shell`,Q&&re,$&&`wui-modal-stacked`].filter(Boolean).join(` `);return/* @__PURE__ */ f(ee,{...V,ref:de,show:v,onHide:X,backdrop:!N||`static`,keyboard:!N,autoFocus:!1,enforceFocus:!0,restoreFocus:!0,centered:j!==`top`,className:ge,style:Q?L:{"--wui-modal-max-width":`${me}px`,...L},dialogClassName:`wui-rb-dialog`,contentClassName:he,backdropClassName:$?`wui-modal-dim wui-modal-backdrop-stacked`:`wui-modal-dim`,"aria-label":F||(typeof b==`string`?b:void 0),children:[!M&&/* @__PURE__ */ f(`div`,{className:`wui-modal-header`,children:[E&&/* @__PURE__ */ d(`button`,{type:`button`,className:`wui-modal-back`,onClick:E,"aria-label":D,children:/* @__PURE__ */ d(i,{name:`arrow-left`,size:18})}),/* @__PURE__ */ f(`div`,{className:`wui-modal-heading`,children:[S&&/* @__PURE__ */ d(`span`,{className:`wui-modal-headicon`,children:/* @__PURE__ */ d(i,{name:S,size:18})}),/* @__PURE__ */ f(`div`,{className:`wui-modal-headtext`,children:[y&&/* @__PURE__ */ d(`div`,{className:`wui-modal-eyebrow`,children:y}),/* @__PURE__ */ d(`div`,{className:`wui-modal-title`,children:b}),x&&/* @__PURE__ */ d(`div`,{className:`wui-modal-subtitle`,children:x})]})]}),O&&/* @__PURE__ */ d(`div`,{className:`wui-modal-header-actions`,children:O}),w&&/* @__PURE__ */ d(`button`,{type:`button`,className:`wui-modal-close`,onClick:X,"aria-label":ce,children:/* @__PURE__ */ d(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:/* @__PURE__ */ d(`path`,{d:`M18 6 6 18M6 6l12 12`})})})]}),/* @__PURE__ */ d(`div`,{className:`wui-modal-body`,ref:G,onClick:Z,children:ue}),(k||q)&&/* @__PURE__ */ f(`div`,{className:q?`wui-modal-footer wui-drawer-discarding`:`wui-modal-footer`,onClick:Z,children:[q&&/* @__PURE__ */ d(e,{text:P,confirmRef:K,onDiscard:fe,onKeep:pe}),k]})]})}export{_ as default};
1
+ import e from"../lib/DiscardPrompt.js";import{devWarn as t}from"../lib/devWarn.js";import{lockPageScroll as n}from"../lib/pageScrollLock.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./AppIcon.js";import a from"./assertValidValue.js";import o from"./warnUnknownProps.js";import{useCallback as ee,useEffect as s,useRef as c,useState as l}from"react";import{Modal as te}from"react-bootstrap";import{jsx as u,jsxs as d}from"react/jsx-runtime";var f=[`neutral`,`danger`,`success`,`warning`],p=[`center`,`top`],m=`a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])`,h={sm:380,md:440,lg:640,xl:880},ne=`wui-modal-fullscreen`,g=!1;function re(){let e=!0;try{e=process.env.NODE_ENV!==`production`}catch{e=!0}e&&!g&&(g=!0,t("[@webority/ui-react] <AppModal hideHeader> has no accessible name: pass `ariaLabel` (or a string `title`)."))}function ie(e,t){if(e.key!==`Tab`)return;let n=Array.from(t.querySelectorAll(m));if(!n.length){e.preventDefault(),t.focus();return}let r=n[0],i=n[n.length-1],a=document.activeElement;e.shiftKey&&(a===r||a===t)?(e.preventDefault(),i.focus()):!e.shiftKey&&a===i&&(e.preventDefault(),r.focus())}function ae(){let e=[];for(let t of document.body.children)t.hasAttribute(`inert`)||t.matches(`.modal, .modal-backdrop`)||(t.setAttribute(`inert`,``),e.push(t));return e}function oe(){return typeof document<`u`&&document.querySelector(`wui-drawer[open], .offcanvas.show`)!==null}function _(t){let{marker:g,props:_}=r(`AppModal`,t),{open:v,eyebrow:y,title:b,subtitle:x,headerIcon:S,tone:C=`neutral`,dismissible:se=!0,onClose:w,onBack:T,backLabel:E=`Back`,headerActions:D,footer:O,size:k=`md`,placement:A=`center`,hideHeader:j=!1,staticBackdrop:ce=!0,closeOnEscape:le=!0,confirmDiscard:M,dirty:ue=!1,ariaLabel:N,closeLabel:de=`Close`,className:P=``,children:F,...I}=_;o(`AppModal`,I),a(`AppModal`,`tone`,C,f),a(`AppModal`,`placement`,A,p),a(`AppModal`,`size`,typeof k==`string`?k:null,[...Object.keys(h),`fullscreen`]);let{style:L,ref:R,"data-wui":z,"data-wui-props":B,...V}=I,H=z?{"data-wui":z,"data-wui-props":B}:g,U=H[`data-wui`],W=H[`data-wui-props`];j&&!N&&typeof b!=`string`&&re();let G=c(null),K=c(null),[q,J]=l(!1);s(()=>{v||J(!1)},[v]),s(()=>{q&&K.current?.focus()},[q]),s(()=>{if(v)return n()},[v]),s(()=>{let e=G.current?.closest(`.modal`);e&&(M?e.setAttribute(`confirm-discard`,M):e.removeAttribute(`confirm-discard`))},[v,M]);let Y=c(null),fe=ee(e=>{Y.current=e,typeof R==`function`?R(e):R&&(R.current=e)},[R]);s(()=>{let e=Y.current?.dialog;e&&(e.setAttribute(`data-wui`,U),W===void 0?e.removeAttribute(`data-wui-props`):e.setAttribute(`data-wui-props`,W))},[v,U,W]),s(()=>{if(!v)return;let e=G.current?.closest(`.modal-content`);if(!e)return;let t=()=>Array.from(e.querySelectorAll(m));(e.querySelector(`[data-autofocus]`)||t().find(e=>!e.classList.contains(`wui-modal-close`)&&!e.classList.contains(`wui-modal-back`))||t()[0]||e).focus?.({preventScroll:!0});let n=e.closest(`.modal`),r=ae(),i=e=>ie(e,n);return n?.addEventListener(`keydown`,i),()=>{n?.removeEventListener(`keydown`,i);for(let e of r)e.removeAttribute(`inert`);n&&setTimeout(()=>{n.isConnected&&!n.classList.contains(`show`)&&n.dispatchEvent(new Event(`transitionend`,{bubbles:!0}))},500)}},[v]);let X=()=>{M&&ue?J(!0):w?.()},Z=e=>{e.target.closest?.(`[data-wui-dismiss]`)&&X()},pe=()=>{J(!1),w?.()},me=()=>{J(!1),(G.current?.querySelector(`input:not([type="hidden"]):not([disabled]),select:not([disabled]),textarea:not([disabled])`))?.focus()},Q=k===`fullscreen`,he=typeof k==`number`?k:h[k]??h.md,ge=[`wui-modal`,C===`neutral`?``:`tone-${C}`,P].filter(Boolean).join(` `),$=v&&oe(),_e=[`wui-modal-shell`,Q&&ne,$&&`wui-modal-stacked`].filter(Boolean).join(` `);return/* @__PURE__ */ d(te,{...V,ref:fe,show:v,onHide:X,backdrop:!ce||`static`,keyboard:le,autoFocus:!1,enforceFocus:!0,restoreFocus:!0,centered:A!==`top`,className:_e,style:Q?L:{"--wui-modal-max-width":`${he}px`,...L},dialogClassName:`wui-rb-dialog`,contentClassName:ge,backdropClassName:$?`wui-modal-dim wui-modal-backdrop-stacked`:`wui-modal-dim`,"aria-label":N||(typeof b==`string`?b:void 0),children:[!j&&/* @__PURE__ */ d(`div`,{className:`wui-modal-header`,children:[T&&/* @__PURE__ */ u(`button`,{type:`button`,className:`wui-modal-back`,onClick:T,"aria-label":E,children:/* @__PURE__ */ u(i,{name:`arrow-left`,size:18})}),/* @__PURE__ */ d(`div`,{className:`wui-modal-heading`,children:[S&&/* @__PURE__ */ u(`span`,{className:`wui-modal-headicon`,children:/* @__PURE__ */ u(i,{name:S,size:18})}),/* @__PURE__ */ d(`div`,{className:`wui-modal-headtext`,children:[y&&/* @__PURE__ */ u(`div`,{className:`wui-modal-eyebrow`,children:y}),/* @__PURE__ */ u(`div`,{className:`wui-modal-title`,children:b}),x&&/* @__PURE__ */ u(`div`,{className:`wui-modal-subtitle`,children:x})]})]}),D&&/* @__PURE__ */ u(`div`,{className:`wui-modal-header-actions`,children:D}),se&&/* @__PURE__ */ u(`button`,{type:`button`,className:`wui-modal-close`,onClick:X,"aria-label":de,children:/* @__PURE__ */ u(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:/* @__PURE__ */ u(`path`,{d:`M18 6 6 18M6 6l12 12`})})})]}),/* @__PURE__ */ u(`div`,{className:`wui-modal-body`,ref:G,onClick:Z,children:F}),(O||q)&&/* @__PURE__ */ d(`div`,{className:q?`wui-modal-footer wui-drawer-discarding`:`wui-modal-footer`,onClick:Z,children:[q&&/* @__PURE__ */ u(e,{text:M,confirmRef:K,onDiscard:pe,onKeep:me}),O]})]})}export{_ as default};
@@ -1 +1 @@
1
- import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/FieldMessage.js";import{loadFlagStyles as n}from"../lib/flagStyles.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import ee from"./AppInfoTip.js";import i from"./AppRequiredMark.js";import a from"./assertValidValue.js";import te from"./useNodeLabels.js";import ne,{optionsEqual as re}from"./useWuiControl.js";import ie from"./warnUnknownProps.js";import{forwardRef as o,useEffect as s,useId as ae,useLayoutEffect as c,useMemo as oe,useRef as l}from"react";import{Fragment as se,jsx as u,jsxs as d}from"react/jsx-runtime";import"@webority/ui-elements/elements/select";var ce=[`single`,`multiple`,`search`,`tag`,`country`],le=[`comfortable`,`compact`],f=[`sm`,`md`,`lg`],ue=[`off`,`border`,`above`],de=[],p=[],fe=e=>e===`multiple`||e===`tag`,pe=(e,t)=>{let n=t??``;String(e.value??``)!==String(n)&&(e.value=n)},me=(e,t)=>{let n=Array.isArray(t)?t:p,r=Array.isArray(e.value)?e.value:p;n.length===r.length&&n.every((e,t)=>e===r[t])||(e.value=n)},he=(e,t)=>({...e,label:t}),m=e=>Array.isArray(e)?e.join(`,`):e,h=o(function(o,h){let{marker:g,props:ge}=r(`AppSelect`,o),{mode:_=`single`,density:v=`comfortable`,size:y,value:_e,defaultValue:b,onChange:x,options:S=de,loadOptions:C,remote:ve=!1,onSearch:ye,validate:be,placeholder:xe,searchPlaceholder:Se,emptyText:Ce,searchable:w,clearable:we=!1,icon:Te,valuePrefix:T,prefix:E,suffix:D,floatingLabel:O=`off`,disabled:Ee,readOnly:De=!1,loading:Oe=!1,open:ke,label:k,required:A=!1,optional:j=!1,optionalLabel:M=`(optional)`,error:N,helperText:P,help:F,helpLabel:Ae=`More information`,id:je,name:Me,minChars:I,debounce:L,allowCustom:Ne=!1,addLabel:Pe,searchingText:Fe,hintText:Ie,valueLabel:Le,valueAvatar:Re,valueInitials:ze,maxTags:R,allowDuplicates:Be=!1,separators:Ve,pattern:He,invalidMessage:Ue,createLabel:We,collapseChips:Ge=!1,selectedText:Ke,clearAllLabel:qe,countries:Je,suggested:Ye,suggestedLabel:Xe,allCountriesLabel:Ze,className:Qe=``,fieldClassName:z=``,"aria-label":$e,"aria-labelledby":et,"aria-describedby":tt,...B}=ge;ie(`AppSelect`,B),a(`AppSelect`,`mode`,_,ce),a(`AppSelect`,`density`,v,le),a(`AppSelect`,`size`,y,f);let V=fe(_);a(`AppSelect`,`floatingLabel`,O,V?[`off`]:ue);let H=l(!1);V&&(E!=null||D!=null)&&!H.current&&(H.current=!0,e(`AppSelect: prefix and suffix are not drawn in mode="${_}"; they are ignored.`));let nt=ae(),U=l(!1);s(()=>{_===`country`&&n()},[_]);let{setRef:rt,innerRef:W}=ne({ref:h,value:_e??(b===void 0?V?p:``:void 0),defaultValue:b,writeValue:V?me:pe,on:{change:e=>{let t=e.currentTarget.value;_===`search`||_===`tag`?x?.(t,{isCustom:!!e.detail?.isCustom}):x?.(t)},search:e=>{ve&&typeof C!=`function`&&ye?.(e.detail.query,{seq:e.detail.seq})}}}),G=oe(()=>typeof C==`function`?(e,t)=>new Promise(n=>n(C(e,t))).then(e=>(U.current=!0,e),e=>{throw U.current=!0,e}):null,[C]),{portal:it,toElementOptions:K}=te(S),q=l({el:null,options:null,map:null});c(()=>{let e=W.current;if(!e||q.current.el===e&&q.current.options===S&&q.current.map===K||(q.current={el:e,options:S,map:K},C&&U.current))return;let t=K(S,he);re(t,e.options)||(e.options=t)}),c(()=>{let e=W.current;if(!e)return;e.loadOptions!==G&&(e.loadOptions=G);let t=typeof be==`function`?be:null;e.validate!==t&&(e.validate=t)}),c(()=>{W.current?.toggleAttribute(`loading`,!!Oe)});let J=je||nt,Y=!V&&O!==`off`&&k,X=N&&J?`${J}-error`:void 0,at=P&&J?`${J}-hint`:void 0,ot=X||at||tt;s(()=>{let e=W.current;e&&(T==null||T===``?e.removeAttribute(`prefix`):e.setAttribute(`prefix`,T))},[T,W]);let st=!V&&!Y&&(E!=null||D!=null),Z=_!==`multiple`&&_!==`tag`&&_!==`country`&&!k&&!N&&!P&&!z,ct=/* @__PURE__ */ u(`wui-select`,{"aria-label":$e||(typeof k==`string`?k:void 0),"aria-labelledby":et||void 0,"aria-describedby":ot||void 0,"aria-invalid":N?`true`:void 0,ref:rt,id:J,name:Me,mode:_,density:v===`compact`?`compact`:void 0,placeholder:Y?` `:xe||void 0,"search-placeholder":Se||void 0,"empty-text":Ce||void 0,searchable:w===void 0?void 0:w?`true`:`false`,clearable:we?``:void 0,size:y!==`md`&&f.includes(y)?y:void 0,icon:Te||void 0,disabled:Ee?``:void 0,readonly:De?``:void 0,open:ke?``:void 0,required:A?``:void 0,"min-chars":I==null?void 0:String(I),debounce:L==null?void 0:String(L),remote:ve?``:void 0,"allow-custom":Ne?``:void 0,"add-label":Pe||void 0,"searching-text":Fe||void 0,"hint-text":Ie||void 0,"value-label":Le||void 0,"value-avatar":Re||void 0,"value-initials":ze||void 0,"max-tags":R==null?void 0:String(R),"allow-duplicates":Be?``:void 0,separators:Ve||void 0,pattern:He||void 0,"invalid-message":Ue||void 0,"create-label":We||void 0,"collapse-chips":Ge?``:void 0,"selected-text":Ke||void 0,"clear-all-label":qe||void 0,countries:m(Je)||void 0,suggested:m(Ye)||void 0,"suggested-label":Xe||void 0,"all-countries-label":Ze||void 0,className:Qe||void 0,...Z&&!st?g:null,...B}),Q=/* @__PURE__ */ d(se,{children:[ct,it]}),$=st?/* @__PURE__ */ d(`div`,{...Z?g:null,className:`input-affixed`,children:[E!=null&&/* @__PURE__ */ u(`span`,{className:`affix affix-pre`,children:E}),Q,D!=null&&/* @__PURE__ */ u(`span`,{className:`affix affix-suf`,children:D})]}):Q;if(Z)return $;let lt=[`field`,z].filter(Boolean).join(` `);return/* @__PURE__ */ d(`div`,{...g,className:lt,children:[k&&!Y&&/* @__PURE__ */ d(`label`,{className:`label`,htmlFor:J,children:[k,j&&!A&&/* @__PURE__ */ u(`span`,{className:`label-optional`,children:` ${M}`}),A&&/* @__PURE__ */ u(i,{}),F&&/* @__PURE__ */ u(ee,{label:Ae,children:F})]}),Y?/* @__PURE__ */ d(`div`,{className:O===`above`?`field-float wui-float-above`:`field-float`,children:[Q,/* @__PURE__ */ d(`label`,{className:`float-label`,htmlFor:J,children:[k,j&&!A&&/* @__PURE__ */ u(`span`,{className:`label-optional`,children:` ${M}`}),A&&/* @__PURE__ */ u(i,{})]})]}):$,/* @__PURE__ */ u(t,{error:N,hint:P,errorId:X,hintId:at})]})});export{h as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/FieldMessage.js";import{loadFlagStyles as n}from"../lib/flagStyles.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import ee from"./AppInfoTip.js";import i from"./AppRequiredMark.js";import a from"./assertValidValue.js";import te from"./useNodeLabels.js";import ne,{optionsEqual as re}from"./useWuiControl.js";import ie from"./warnUnknownProps.js";import{forwardRef as o,useEffect as s,useId as ae,useLayoutEffect as c,useMemo as oe,useRef as l}from"react";import{Fragment as se,jsx as u,jsxs as d}from"react/jsx-runtime";import"@webority/ui-elements/elements/select";var ce=[`single`,`multiple`,`search`,`tag`,`country`],le=[`comfortable`,`compact`],f=[`sm`,`md`,`lg`],ue=[`off`,`border`,`above`],de=[],p=[],fe=e=>e===`multiple`||e===`tag`,pe=(e,t)=>{let n=t??``;String(e.value??``)!==String(n)&&(e.value=n)},me=(e,t)=>{let n=Array.isArray(t)?t:p,r=Array.isArray(e.value)?e.value:p;n.length===r.length&&n.every((e,t)=>e===r[t])||(e.value=n)},he=(e,t)=>({...e,label:t}),m=e=>Array.isArray(e)?e.join(`,`):e,h=o(function(o,h){let{marker:g,props:ge}=r(`AppSelect`,o),{mode:_=`single`,density:v=`comfortable`,size:y,value:_e,defaultValue:b,onChange:x,options:S=de,loadOptions:C,remote:ve=!1,onSearch:ye,validate:be,placeholder:xe,searchPlaceholder:Se,emptyText:Ce,searchable:w,clearable:we=!1,icon:Te,valuePrefix:T,prefix:E,suffix:D,floatingLabel:O=`off`,disabled:Ee,readOnly:De=!1,loading:Oe=!1,open:ke,label:k,required:A=!1,optional:j=!1,optionalLabel:M=`(optional)`,error:N,helperText:P,help:F,helpLabel:Ae=`More information`,id:je,name:Me,minChars:I,debounce:L,allowCustom:Ne=!1,addLabel:Pe,searchingText:Fe,hintText:Ie,valueLabel:Le,valueAvatar:Re,valueInitials:ze,maxTags:R,allowDuplicates:Be=!1,separators:Ve,pattern:He,invalidMessage:Ue,createLabel:We,collapseChips:Ge=!1,selectedText:Ke,clearAllLabel:qe,countries:Je,suggested:Ye,suggestedLabel:Xe,allCountriesLabel:Ze,recentsKey:Qe,recentsLimit:z,recentsLabel:$e,className:et=``,fieldClassName:B=``,"aria-label":tt,"aria-labelledby":nt,"aria-describedby":rt,...V}=ge;ie(`AppSelect`,V),a(`AppSelect`,`mode`,_,ce),a(`AppSelect`,`density`,v,le),a(`AppSelect`,`size`,y,f);let H=fe(_);a(`AppSelect`,`floatingLabel`,O,H?[`off`]:ue);let U=l(!1);H&&(E!=null||D!=null)&&!U.current&&(U.current=!0,e(`AppSelect: prefix and suffix are not drawn in mode="${_}"; they are ignored.`));let it=ae(),W=l(!1);s(()=>{_===`country`&&n()},[_]);let{setRef:at,innerRef:G}=ne({ref:h,value:_e??(b===void 0?H?p:``:void 0),defaultValue:b,writeValue:H?me:pe,on:{change:e=>{let t=e.currentTarget.value;_===`search`||_===`tag`?x?.(t,{isCustom:!!e.detail?.isCustom}):x?.(t)},search:e=>{ve&&typeof C!=`function`&&ye?.(e.detail.query,{seq:e.detail.seq})}}}),K=oe(()=>typeof C==`function`?(e,t)=>new Promise(n=>n(C(e,t))).then(e=>(W.current=!0,e),e=>{throw W.current=!0,e}):null,[C]),{portal:ot,toElementOptions:q}=te(S),J=l({el:null,options:null,map:null});c(()=>{let e=G.current;if(!e||J.current.el===e&&J.current.options===S&&J.current.map===q||(J.current={el:e,options:S,map:q},C&&W.current))return;let t=q(S,he);re(t,e.options)||(e.options=t)}),c(()=>{let e=G.current;if(!e)return;e.loadOptions!==K&&(e.loadOptions=K);let t=typeof be==`function`?be:null;e.validate!==t&&(e.validate=t)}),c(()=>{G.current?.toggleAttribute(`loading`,!!Oe)});let Y=je||it,X=!H&&O!==`off`&&k,st=N&&Y?`${Y}-error`:void 0,ct=P&&Y?`${Y}-hint`:void 0,lt=st||ct||rt;s(()=>{let e=G.current;e&&(T==null||T===``?e.removeAttribute(`prefix`):e.setAttribute(`prefix`,T))},[T,G]);let ut=!H&&!X&&(E!=null||D!=null),Z=_!==`multiple`&&_!==`tag`&&_!==`country`&&!k&&!N&&!P&&!B,dt=/* @__PURE__ */ u(`wui-select`,{"aria-label":tt||(typeof k==`string`?k:void 0),"aria-labelledby":nt||void 0,"aria-describedby":lt||void 0,"aria-invalid":N?`true`:void 0,ref:at,id:Y,name:Me,mode:_,density:v===`compact`?`compact`:void 0,placeholder:X?` `:xe||void 0,"search-placeholder":Se||void 0,"empty-text":Ce||void 0,searchable:w===void 0?void 0:w?`true`:`false`,clearable:we?``:void 0,size:y!==`md`&&f.includes(y)?y:void 0,icon:Te||void 0,disabled:Ee?``:void 0,readonly:De?``:void 0,open:ke?``:void 0,required:A?``:void 0,"min-chars":I==null?void 0:String(I),debounce:L==null?void 0:String(L),remote:ve?``:void 0,"allow-custom":Ne?``:void 0,"add-label":Pe||void 0,"searching-text":Fe||void 0,"hint-text":Ie||void 0,"value-label":Le||void 0,"value-avatar":Re||void 0,"value-initials":ze||void 0,"max-tags":R==null?void 0:String(R),"allow-duplicates":Be?``:void 0,separators:Ve||void 0,pattern:He||void 0,"invalid-message":Ue||void 0,"create-label":We||void 0,"collapse-chips":Ge?``:void 0,"selected-text":Ke||void 0,"clear-all-label":qe||void 0,countries:m(Je)||void 0,suggested:m(Ye)||void 0,"suggested-label":Xe||void 0,"all-countries-label":Ze||void 0,"recents-key":Qe||void 0,"recents-limit":z==null?void 0:String(z),"recents-label":$e||void 0,className:et||void 0,...Z&&!ut?g:null,...V}),Q=/* @__PURE__ */ d(se,{children:[dt,ot]}),$=ut?/* @__PURE__ */ d(`div`,{...Z?g:null,className:`input-affixed`,children:[E!=null&&/* @__PURE__ */ u(`span`,{className:`affix affix-pre`,children:E}),Q,D!=null&&/* @__PURE__ */ u(`span`,{className:`affix affix-suf`,children:D})]}):Q;if(Z)return $;let ft=[`field`,B].filter(Boolean).join(` `);return/* @__PURE__ */ d(`div`,{...g,className:ft,children:[k&&!X&&/* @__PURE__ */ d(`label`,{className:`label`,htmlFor:Y,children:[k,j&&!A&&/* @__PURE__ */ u(`span`,{className:`label-optional`,children:` ${M}`}),A&&/* @__PURE__ */ u(i,{}),F&&/* @__PURE__ */ u(ee,{label:Ae,children:F})]}),X?/* @__PURE__ */ d(`div`,{className:O===`above`?`field-float wui-float-above`:`field-float`,children:[Q,/* @__PURE__ */ d(`label`,{className:`float-label`,htmlFor:Y,children:[k,j&&!A&&/* @__PURE__ */ u(`span`,{className:`label-optional`,children:` ${M}`}),A&&/* @__PURE__ */ u(i,{})]})]}):$,/* @__PURE__ */ u(t,{error:N,hint:P,errorId:st,hintId:ct})]})});export{h as default};
@@ -1 +1 @@
1
- import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/fillLabel.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{splitMarkerProps as c}from"../lib/wuiMarker.js";import l from"./AppAvatar.js";import u from"./AppButton.js";import d from"./AppIcon.js";import f from"./AppNavigationMenu.js";import p from"./assertValidValue.js";import m from"./warnUnknownProps.js";import{initScrollEdges as h,revealActiveNavItem as g}from"@webority/ui-elements/helpers";import{useEffect as _,useId as v,useMemo as y,useRef as b,useState as x}from"react";import{Fragment as S,jsx as C,jsxs as w}from"react/jsx-runtime";var T=99,E=4,D=5,O=/^[a-z0-9-]+$/,k=[`prefix`,`exact`],A=[`comfortable`,`compact`],j=[`neutral`,`primary`],M=[`side`,`top`],N=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],P=/* @__PURE__ */ new Set([`key`,`label`,`icon`,`iconVariant`,`iconSize`,`href`,`badge`,`badgeTone`,`badgeTitle`,`newUntil`,`trailingIcon`,`active`,`match`,`matchAlso`,`tab`,`tabLabel`,`children`]),F=e=>e>T?`${T}+`:String(e),I=new Intl.DateTimeFormat(`en-CA`,{timeZone:`Asia/Kolkata`}),L=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:I.format(/* @__PURE__ */ new Date)<=e},ee=({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(` `)},R=({logoLight:e,logoDark:t,markLight:n,markDark:r,brandName:i})=>{let a=i??``,o=[e&&/* @__PURE__ */ C(`img`,{className:`wui-brand-logo wui-brand-light`,src:e,alt:a},`logo-light`),t&&/* @__PURE__ */ C(`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(Boolean).map(([t,n,r],i)=>i===0&&!e?/* @__PURE__ */ C(`img`,{className:n,src:r,alt:a},t):/* @__PURE__ */ C(`img`,{className:n,src:r,alt:``,"aria-hidden":`true`},t));return[...o,...s].filter(Boolean)};function z(e){let{marker:t,props:n}=c(`AppShell`,e),{groups:l=[],brand:u,logoLight:v,logoDark:S,markLight:T,markDark:E,brandName:D,sidebarStart:O,sidebarStartCompact:k,sidebarFooter:P,topbarStart:F,topbarEnd:I,footer:L,launcher:z,children:ne,collapsed:B,onCollapsedChange:re,noSidebar:V=!1,nav:H=`side`,density:W=`comfortable`,itemHeight:G,iconVariant:K=`twotone`,topbarTone:de=`neutral`,navLabel:fe=`Main navigation`,linkComponent:q,currentPath:pe,rememberCollapsed:me=!1,collapsedCookie:he=`wui-shell-collapsed`,foldedCookie:J=r,tabBarLabel:ge=`Quick navigation`,moreLabel:_e=`More`,skipLabel:ve=`Skip to content`,openNavLabel:ye=`Open navigation`,closeNavLabel:be=`Close navigation`,expandNavLabel:xe=`Expand navigation`,collapseNavLabel:Se=`Collapse navigation`,newLabel:Ce=`New`,togglePagesLabel:we=`Show or hide {name} pages`,accountMenuLabel:Te=`Account menu for {name}`,roleLabel:Ee=`Role:`,rolesLabel:De=`Roles:`,unreadLabel:Oe=`Unread`,markAllReadLabel:ke=`Mark all read`,viewAllLabel:Ae=`View all`,loadingNotificationsText:je=`Loading…`,noUnreadText:Me=`No unread notifications`,unreadNotificationsText:Ne=`{count} unread notifications`,unreadBellLabel:Pe=`{label}, {count} unread`,searchResultsLabel:Fe=`Search results`,noResultsText:Ie=`No results`,noResultsForText:Le=`No results for “{value}”`,resultsCountText:Re=`{count} results`,resultCountText:ze=`{count} result`,userMenu:Be,notifications:Ve,search:He,className:Ue=``,style:We,...Ge}=n;m(`AppShell`,Ge),p(`AppShell`,`density`,W,A),p(`AppShell`,`topbarTone`,de,j),p(`AppShell`,`nav`,H,M),p(`AppShell`,`iconVariant`,K,N);let Ke=G>0?{...We,"--wui-nav-item-height":`${G}px`}:We,[qe,Je]=x(()=>me&&B===void 0&&typeof document<`u`?a(he)??!1:!1),[Y,X]=x(!1),[Ye,Xe]=x(!1),[Ze,Qe]=x(!1),$e=b(null),et=b(null),tt=b(null),Z=B??qe,nt=()=>{let e=!Z;B===void 0&&Je(e),me&&s(e,he),re?.(e)},rt=l.some(e=>e.collapsible),[it,at]=x(()=>rt&&typeof document<`u`?i(J):/* @__PURE__ */ new Set),ot=e=>{let t=new Set(it);t.has(e)?t.delete(e):t.add(e),at(t),o(t,J)},Q=y(()=>te(l,pe),[l,pe]),$=V?null:ie(Q);_(()=>{let e=()=>Xe(window.scrollY>4);return e(),window.addEventListener(`scroll`,e,{passive:!0}),()=>window.removeEventListener(`scroll`,e)},[]),_(()=>{h()},[]),_(()=>{g($e.current)},[]),_(()=>{let e=$e.current;if(!e)return;let t=()=>Qe(e.scrollHeight>e.clientHeight);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[Q]);let st=!!L;_(()=>{let e=tt.current,t=et.current;if(!st||!e||!t)return;let n=()=>t.style.setProperty(`--app-footer-h`,`${e.offsetHeight}px`);n();let r=typeof ResizeObserver>`u`?null:new ResizeObserver(n);return r?.observe(e),()=>{r?.disconnect(),t.style.removeProperty(`--app-footer-h`)}},[st]),_(()=>{if(!Y)return;let e=e=>{e.key===`Escape`&&X(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[Y]);let ct=[`app-shell`,Z?`collapsed`:``,V?`no-sidebar`:``,H===`top`?`wui-shell-top`:``,Y?`mobile-open`:``,Ue].filter(Boolean).join(` `);return/* @__PURE__ */ w(`div`,{ref:et,className:ct,"data-density":W===`compact`?`compact`:void 0,"data-wui-folded-cookie":rt?J:void 0,style:Ke,...t,...Ge,children:[/* @__PURE__ */ C(`a`,{className:`wui-skip-link`,href:`#main-content`,children:ve}),/* @__PURE__ */ w(`aside`,{className:`app-sidebar`,children:[(u||v||S||T||E)&&/* @__PURE__ */ w(`div`,{className:ee({logoLight:v,logoDark:S,markLight:T,markDark:E}),children:[R({logoLight:v,logoDark:S,markLight:T,markDark:E,brandName:D}),u]}),O&&/* @__PURE__ */ C(`div`,{className:`app-sidebar-start`,children:O}),k&&/* @__PURE__ */ C(`div`,{className:`app-sidebar-start-compact`,children:k}),/* @__PURE__ */ C(`nav`,{className:`app-sidebar-scroll`,"aria-label":fe,ref:$e,tabIndex:Ze?0:void 0,children:Q.map((e,t)=>{let n=e.items.map(e=>e.header==null?/* @__PURE__ */ C(se,{item:e,linkComponent:q,onNavigate:()=>X(!1),iconVariant:K,newLabel:Ce,togglePagesLabel:we},e.key??e.href??e.label):/* @__PURE__ */ C(`div`,{className:`wui-nav-header`,children:e.header},e.key??e.header));if(!e.collapsible)return/* @__PURE__ */ w(`div`,{className:`app-nav-group`,children:[e.label&&/* @__PURE__ */ C(`div`,{className:`app-nav-group-label`,children:e.label}),n,e.after&&/* @__PURE__ */ C(`div`,{className:`wui-nav-group-after`,children:e.after})]},e.key??e.label??`group-${t}`);let r=!it.has(e.key)||!!U(e.items),i=`wui-nav-group-${e.key}`;return/* @__PURE__ */ w(`div`,{className:`app-nav-group wui-nav-group-collapsible${r?``:` wui-nav-group-folded`}`,"data-wui-nav-group":e.key,children:[/* @__PURE__ */ w(`button`,{type:`button`,className:`app-nav-group-label wui-nav-group-toggle`,"aria-expanded":r,"aria-controls":i,onClick:()=>ot(e.key),children:[/* @__PURE__ */ C(`span`,{className:`wui-nav-group-text`,children:e.label}),/* @__PURE__ */ C(`span`,{className:`wui-nav-group-caret`,children:/* @__PURE__ */ C(d,{name:`chevron-down`,size:16})})]}),/* @__PURE__ */ w(`div`,{className:`wui-nav-group-body`,id:i,children:[n,e.after&&/* @__PURE__ */ C(`div`,{className:`wui-nav-group-after`,children:e.after})]})]},e.key??`group-${t}`)})}),P&&/* @__PURE__ */ C(`div`,{className:`app-sidebar-foot`,children:P}),!V&&/* @__PURE__ */ C(`button`,{type:`button`,className:`app-sidebar-toggle`,onClick:nt,"aria-label":Z?xe:Se,"aria-expanded":!Z,children:/* @__PURE__ */ C(d,{name:`chevrons-left`,size:20})})]}),/* @__PURE__ */ w(`div`,{className:`app-main`,children:[/* @__PURE__ */ w(`header`,{className:`app-topbar${Ye?` scrolled`:``}`,"data-tone":de===`primary`?`primary`:void 0,children:[/* @__PURE__ */ w(`div`,{className:`app-topbar-start`,children:[/* @__PURE__ */ C(`button`,{type:`button`,className:`app-topbar-menu`,onClick:()=>X(!0),"aria-label":ye,"aria-expanded":Y,children:/* @__PURE__ */ C(d,{name:`menu`,size:18})}),H===`top`&&u&&/* @__PURE__ */ C(`div`,{className:`wui-shell-top-brand`,children:u}),H===`top`&&/* @__PURE__ */ C(`div`,{className:`wui-shell-top-nav`,children:/* @__PURE__ */ C(f,{items:ae(Q),ariaLabel:fe,linkComponent:q})}),F,He&&/* @__PURE__ */ C(ue,{config:He,searchResultsLabel:Fe,noResultsText:Ie,noResultsForText:Le,resultsCountText:Re,resultCountText:ze})]}),/* @__PURE__ */ w(`div`,{className:`app-topbar-end`,children:[I,Ve&&/* @__PURE__ */ C(le,{config:Ve,unreadLabel:Oe,markAllReadLabel:ke,viewAllLabel:Ae,loadingNotificationsText:je,noUnreadText:Me,unreadNotificationsText:Ne,unreadBellLabel:Pe}),Be&&/* @__PURE__ */ C(ce,{config:Be,linkComponent:q,accountMenuLabel:Te,roleLabel:Ee,rolesLabel:De})]})]}),/* @__PURE__ */ C(`main`,{className:`app-content`,id:`main-content`,children:ne}),L&&/* @__PURE__ */ C(`footer`,{className:`app-footer`,ref:tt,children:L})]}),z&&/* @__PURE__ */ C(`div`,{className:`wui-shell-launcher`,children:z}),$&&/* @__PURE__ */ w(`nav`,{className:`wui-tabbar`,"aria-label":ge,children:[$.tabs.map(e=>/* @__PURE__ */ C(oe,{tab:e,linkComponent:q,iconVariant:K},e.key??e.href)),$.hasMore&&/* @__PURE__ */ w(`button`,{type:`button`,className:`wui-tabbar-item${$.moreActive?` active`:``}`,onClick:()=>X(!0),children:[/* @__PURE__ */ C(`span`,{className:`wui-tabbar-icon`,children:/* @__PURE__ */ C(d,{name:`more`,size:24})}),/* @__PURE__ */ C(`span`,{className:`wui-tabbar-label`,children:_e})]})]}),/* @__PURE__ */ C(`button`,{type:`button`,className:`app-scrim`,onClick:()=>X(!1),"aria-label":be,tabIndex:Y?0:-1})]})}function te(e,t){for(let t of e)t.collapsible&&H(t);let r=(e,t=!1)=>(e??[]).map(e=>Array.isArray(e.children)?{...e,children:r(e.children)}:{...e}).filter(e=>B(e)?t:(e.children?.length??0)>0||!!e.href),i=e.map(e=>({...e,items:re(r(e.items,!0))})).filter(e=>e.items.some(e=>!B(e))),a=[],o=e=>{for(let t of e)B(t)||(a.push(t),t.children&&o(t.children))};for(let e of i)o(e.items);for(let e of a)m(`AppShell items`,ne(e)),p(`AppShell`,`match`,e.match,k),p(`AppShell`,`iconVariant`,e.iconVariant,N);let s=null;if(t!=null&&!a.some(e=>e.active===!0)){let e=-1;for(let r of a){if(r.active!=null||r.children?.length&&!r.href)continue;let i=n(t,r.href,{exact:r.match===`exact`,also:r.matchAlso});if(i<0)continue;let a=r.match===`exact`&&n(t,r.href,{exact:!0})>=0?1/0:i;a>e&&(e=a,s=r)}}for(let e of a)e.active=e.active??e===s;return i}function ne(e){return Object.fromEntries(Object.entries(e).filter(([e])=>!P.has(e)))}var B=e=>e.header!=null;function re(e){return e.filter((t,n)=>{if(!B(t))return!0;let r=e.findIndex((e,t)=>t>n&&B(e));return e.slice(n+1,r<0?void 0:r).length>0})}var V=/* @__PURE__ */ new Set;function H(t){if(t.key!=null&&O.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.`,r=!0;try{r=process.env.NODE_ENV!==`production`}catch{r=!0}r&&!V.has(n)&&(V.add(n),e(n))}function ie(e){let t=[],n=e=>{for(let r of e)B(r)||(r.children?.length?n(r.children):t.push(r))};for(let t of e)n(t.items);let r=t.filter(e=>e.tab);if(r.length===0)return null;let i=r.length<t.length,a=i?E:D;if(r.length>a)throw Error(`<AppShell>: ${r.length} items carry tab: true, but the phone tab bar holds ${a} (${i?`4 plus More, because other items exist`:`5 when every item is a tab`}). Flag fewer items.`);return{tabs:r,hasMore:i,moreActive:t.some(e=>!e.tab&&e.active)}}function ae(e){let t=e=>({key:e.key??e.href??e.label,label:e.label,to:e.href,current:!!e.active}),n=e=>e.flatMap(e=>B(e)?[]:[...e.href?[{...t(e),icon:e.icon}]:[],...n(e.children??[])]),r=[];for(let i of e.flatMap(e=>e.items)){if(B(i))continue;let e=n(i.children??[]);if(e.length>0){let n=i.href?[{...t(i),icon:i.icon}]:[];r.push({key:t(i).key,label:i.label,links:[...n,...e]})}else i.href&&r.push(t(i))}return r}function oe({tab:e,linkComponent:t,iconVariant:n}){let r=`wui-tabbar-item${e.active?` active`:``}`,i=/* @__PURE__ */ w(S,{children:[e.icon&&/* @__PURE__ */ C(`span`,{className:`wui-tabbar-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ C(d,{name:e.icon,size:24,variant:e.iconVariant??n}):e.icon}),/* @__PURE__ */ C(`span`,{className:`wui-tabbar-label`,children:e.tabLabel??e.label}),e.badge!=null&&/* @__PURE__ */ C(`span`,{className:`wui-tabbar-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:e.badge})]}),a=e.active?`page`:void 0;return t?/* @__PURE__ */ C(t,{className:r,to:e.href,"aria-current":a,children:i}):/* @__PURE__ */ C(`a`,{className:r,href:e.href,"aria-current":a,children:i})}function U(e){for(let t of e){if(t.active)return t;let e=t.children?.length?U(t.children):void 0;if(e)return e}}function se({item:e,linkComponent:n,onNavigate:r,depth:i=0,iconVariant:a,newLabel:o,togglePagesLabel:s}){let c=i>0,l=i>1?` wui-nav-depth-${Math.min(i,6)}`:``,u=Array.isArray(e.children)&&e.children.length>0,f=u?U(e.children):void 0,p=!!f,m=f?f.key??f.href??f.label:null,[h,g]=x(p);_(()=>{m!=null&&g(!0)},[m]);let v=typeof e.label==`string`?e.label:void 0,y=!c&&e.icon&&/* @__PURE__ */ C(`span`,{className:`app-nav-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ C(d,{name:e.icon,size:e.iconSize??22,variant:e.iconVariant??a}):e.icon}),b=e.badge!=null&&/* @__PURE__ */ C(`span`,{className:`app-nav-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:e.badge}),T=L(e.newUntil)&&/* @__PURE__ */ C(`span`,{className:`wui-nav-new`,children:o}),E=/* @__PURE__ */ w(S,{children:[y,/* @__PURE__ */ C(`span`,{className:`app-nav-text`,children:e.label}),T,b,e.trailingIcon&&/* @__PURE__ */ C(`span`,{className:`app-nav-trailing`,children:typeof e.trailingIcon==`string`?/* @__PURE__ */ C(d,{name:e.trailingIcon,size:16}):e.trailingIcon})]}),D=e.active?`page`:void 0;if(u){let u=/* @__PURE__ */ C(`div`,{className:`app-nav-sub${h?` expanded`:``}`,inert:!h,"aria-hidden":!h||void 0,children:/* @__PURE__ */ C(`div`,{className:`app-nav-sub-inner`,children:e.children.map(e=>/* @__PURE__ */ C(se,{item:e,linkComponent:n,onNavigate:r,depth:i+1,iconVariant:a,newLabel:o,togglePagesLabel:s},e.key??e.href))})});if(e.href){let i=n?/* @__PURE__ */ C(n,{className:`wui-nav-split-link`,to:e.href,"aria-current":D,onClick:r,children:E}):/* @__PURE__ */ C(`a`,{className:`wui-nav-split-link`,href:e.href,"aria-current":D,onClick:r,children:E});return/* @__PURE__ */ w(S,{children:[/* @__PURE__ */ w(`div`,{className:`app-nav-item has-children wui-nav-split${c?` app-nav-subitem`:``}${p||e.active?` active`:``}${l}`,"data-label":v,children:[i,/* @__PURE__ */ C(`button`,{type:`button`,className:`app-nav-caret wui-nav-split-toggle`,"aria-expanded":h,"aria-label":t(s,{name:v??``}),onClick:()=>g(e=>!e),children:/* @__PURE__ */ C(d,{name:`chevron-right`,size:16})})]}),u]})}return/* @__PURE__ */ w(S,{children:[/* @__PURE__ */ w(`button`,{type:`button`,className:`app-nav-item${c?` app-nav-subitem`:``} has-children${p?` active`:``}${l}`,"aria-expanded":h,"data-label":v,onClick:()=>g(e=>!e),children:[y,/* @__PURE__ */ C(`span`,{className:`app-nav-text`,children:e.label}),T,b,/* @__PURE__ */ C(`span`,{className:`app-nav-caret`,children:/* @__PURE__ */ C(d,{name:`chevron-right`,size:16})})]}),u]})}let O=`app-nav-item${c?` app-nav-subitem`:``}${e.active?` active`:``}${l}`;return n?/* @__PURE__ */ C(n,{className:O,to:e.href,"aria-current":D,"data-label":v,onClick:r,children:E}):/* @__PURE__ */ C(`a`,{className:O,href:e.href,"aria-current":D,"data-label":v,onClick:r,children:E})}function W(){let[e,t]=x(!1),n=b(null);return _(()=>{if(!e)return;let r=e=>{n.current?.contains(e.target)||t(!1)},i=e=>{e.key===`Escape`&&(t(!1),n.current?.querySelector(`button`)?.focus())};return document.addEventListener(`mousedown`,r),document.addEventListener(`keydown`,i),()=>{document.removeEventListener(`mousedown`,r),document.removeEventListener(`keydown`,i)}},[e]),{open:e,setOpen:t,ref:n}}function ce({config:e,linkComponent:n,accountMenuLabel:r,roleLabel:i,rolesLabel:a}){let o=v(),{open:s,setOpen:c,ref:f}=W(),{name:m,role:h,roles:g=[],photo:_,profileHref:y,profileLabel:b=`My profile`,onLogout:x,logoutAction:T,logoutLabel:E=`Sign out`,head:D,section:O,logoutVariant:k=`item`,items:A=[]}=e;if(p(`AppShell`,`userMenu.logoutVariant`,k,[`item`,`button`]),!m)throw Error(`<AppShell> userMenu.name is required; the trigger and the avatar are named from it.`);let j=g.map(e=>(e??``).trim()).filter(Boolean),M=()=>c(!1),N=(e,t,r,i)=>n?/* @__PURE__ */ C(n,{className:`dropdown-item`,to:e,onClick:i,children:t},r):/* @__PURE__ */ C(`a`,{className:`dropdown-item`,href:e,onClick:i,children:t},r),P=/* @__PURE__ */ C(d,{name:`log-out`,size:18}),F=/* @__PURE__ */ w(S,{children:[P,E]});return/* @__PURE__ */ w(`div`,{className:`dropdown wui-usermenu`,ref:f,children:[/* @__PURE__ */ w(`button`,{type:`button`,id:o,className:`wui-usermenu-trigger`,"aria-expanded":s,"aria-label":t(r,{name:m}),onClick:()=>c(e=>!e),children:[/* @__PURE__ */ C(l,{name:m,src:_,tone:`auto`}),/* @__PURE__ */ w(`span`,{className:`wui-usermenu-text`,children:[/* @__PURE__ */ C(`span`,{className:`wui-usermenu-name`,children:m}),h&&/* @__PURE__ */ C(`span`,{className:`wui-usermenu-role`,children:h})]}),/* @__PURE__ */ C(d,{name:`chevron-down`,size:14,className:`wui-usermenu-caret`})]}),/* @__PURE__ */ w(`div`,{className:`dropdown-menu dropdown-menu-end wui-usermenu-menu${s?` show`:``}`,"aria-labelledby":o,"data-bs-popper":s?`static`:void 0,children:[/* @__PURE__ */ w(`div`,{className:`wui-usermenu-head`,children:[/* @__PURE__ */ C(l,{name:m,src:_,size:`lg`,tone:`auto`}),/* @__PURE__ */ w(`div`,{className:`wui-usermenu-who`,children:[/* @__PURE__ */ C(`div`,{className:`wui-usermenu-name`,children:m}),h&&/* @__PURE__ */ C(`div`,{className:`wui-usermenu-role`,children:h}),j.length>0&&/* @__PURE__ */ w(`div`,{className:`wui-usermenu-roles`,children:[/* @__PURE__ */ C(`span`,{className:`wui-usermenu-roles-label`,children:j.length===1?i:a}),` ${j.join(`, `)}`]}),D?/* @__PURE__ */ C(`div`,{className:`wui-usermenu-extra`,children:D}):null]})]}),O?/* @__PURE__ */ C(`div`,{className:`wui-usermenu-section`,children:O}):null,y&&N(y,/* @__PURE__ */ w(S,{children:[/* @__PURE__ */ C(d,{name:`user`,size:18}),b]}),void 0,M),A.map(e=>{if(e.divider)return/* @__PURE__ */ C(`hr`,{className:`dropdown-divider`},e.key);let t=/* @__PURE__ */ w(S,{children:[e.icon&&/* @__PURE__ */ C(d,{name:e.icon,size:18}),e.label]}),n=()=>{e.onClick?.(),M()};return e.href?N(e.href,t,e.key,n):/* @__PURE__ */ C(`button`,{type:`button`,className:`dropdown-item`,onClick:n,children:t},e.key)}),k===`button`?(T||x)&&/* @__PURE__ */ C(`div`,{className:`wui-usermenu-foot`,children:T?/* @__PURE__ */ C(`form`,{method:`post`,action:T,className:`wui-usermenu-logout`,children:/* @__PURE__ */ C(u,{type:`submit`,tone:`danger`,variant:`soft`,block:!0,leftIcon:P,children:E})}):/* @__PURE__ */ C(u,{type:`button`,tone:`danger`,variant:`soft`,block:!0,leftIcon:P,onClick:()=>{M(),x()},children:E})}):T?/* @__PURE__ */ C(`form`,{method:`post`,action:T,className:`wui-usermenu-logout`,children:/* @__PURE__ */ C(`button`,{type:`submit`,className:`dropdown-item danger`,children:F})}):x&&/* @__PURE__ */ C(`button`,{type:`button`,className:`dropdown-item danger`,onClick:()=>{M(),x()},children:F})]})]})}function le({config:e,unreadLabel:n,markAllReadLabel:r,viewAllLabel:i,loadingNotificationsText:a,noUnreadText:o,unreadNotificationsText:s,unreadBellLabel:c}){let l=v(),{open:u,setOpen:f,ref:p}=W(),{unread:m=0,items:h,loading:g=!1,onOpen:y,onMarkAllRead:T,viewAllHref:E,label:D=`Notifications`,emptyText:O=`You are all caught up.`}=e,[k,A]=x(``),j=b(m);_(()=>{j.current!==m&&(j.current=m,A(m===0?o:t(s,{count:F(m)})))},[m,o,s]);let M=null;return h?.length?M=/* @__PURE__ */ C(`div`,{className:`wui-bell-items`,children:h.map((e,t)=>{let r=`wui-bell-item${e.read?` wui-bell-item-read`:``}`,i=/* @__PURE__ */ w(S,{children:[/* @__PURE__ */ C(`span`,{className:`wui-bell-dot`,"aria-hidden":`true`}),e.icon&&/* @__PURE__ */ C(`span`,{className:`wui-bell-icon`,children:/* @__PURE__ */ C(d,{name:e.icon,size:18})}),/* @__PURE__ */ w(`span`,{className:`wui-bell-body`,children:[!e.read&&/* @__PURE__ */ w(`span`,{className:`visually-hidden`,children:[n,`: `]}),/* @__PURE__ */ C(`span`,{className:`wui-bell-item-title`,children:e.title}),e.time&&/* @__PURE__ */ C(`span`,{className:`wui-bell-when`,children:e.time})]})]});return e.href?/* @__PURE__ */ C(`a`,{className:r,href:e.href,"data-id":e.id,children:i},e.id??t):/* @__PURE__ */ C(`div`,{className:r,"data-id":e.id,children:i},e.id??t)})}):g?M=/* @__PURE__ */ C(`div`,{className:`wui-bell-state`,children:a}):h&&(M=/* @__PURE__ */ C(`div`,{className:`wui-bell-state`,children:O})),/* @__PURE__ */ w(`div`,{className:`dropdown wui-bell`,ref:p,children:[/* @__PURE__ */ w(`button`,{type:`button`,id:l,className:`topbar-icon-btn wui-bell-trigger`,"aria-expanded":u,"aria-label":m===0?D:t(c,{label:D,count:F(m)}),onClick:()=>{let e=!u;f(e),e&&y?.()},children:[/* @__PURE__ */ C(d,{name:`notification`,size:20}),/* @__PURE__ */ C(`span`,{className:`wui-bell-count`,"aria-hidden":`true`,hidden:m===0,children:F(m)})]}),/* @__PURE__ */ C(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:k}),/* @__PURE__ */ w(`div`,{className:`dropdown-menu dropdown-menu-end wui-bell-menu${u?` show`:``}`,"aria-labelledby":l,"data-bs-popper":u?`static`:void 0,children:[/* @__PURE__ */ w(`div`,{className:`wui-bell-head`,children:[/* @__PURE__ */ C(`span`,{className:`wui-bell-title`,children:D}),T&&/* @__PURE__ */ C(`button`,{type:`button`,className:`wui-bell-markall`,onClick:T,children:r})]}),/* @__PURE__ */ C(`div`,{className:`wui-bell-list`,"aria-busy":g||void 0,children:M}),E&&/* @__PURE__ */ C(`a`,{className:`wui-bell-foot`,href:E,children:i})]})]})}var G=e=>!!e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName));function ue({config:e,searchResultsLabel:n,noResultsText:r,noResultsForText:i,resultsCountText:a,resultCountText:o}){let s=v(),{value:c=``,onChange:l,results:u=null,loading:f=!1,onSelect:p,onSubmit:m,onFocus:h,placeholder:g=`Search`}=e,[S,T]=x(!1),[E,D]=x(!1),[O,k]=x({results:null,index:-1}),A=O.results===u?O.index:-1,j=e=>k({results:u,index:e}),M=b(null),N=b(null),P=b([]),F=y(()=>(u??[]).flatMap(e=>e.hits??[]),[u]),I=u!=null&&!E,L=F.length;_(()=>{let e=e=>{e.key!==`/`||e.ctrlKey||e.metaKey||e.altKey||G(e.target)||(e.preventDefault(),T(!0),N.current?.focus())},t=e=>{M.current?.contains(e.target)||(D(!0),T(!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(!I||L===0)return;e.preventDefault(),j((A+(e.key===`ArrowDown`?1:-1)+L)%L)}else e.key===`Enter`?I&&A>=0&&P.current[A]?(e.preventDefault(),P.current[A].click()):m&&c.trim()!==``&&(e.preventDefault(),m(c.trim())):e.key===`Escape`&&(I?(e.preventDefault(),D(!0)):S&&(e.preventDefault(),T(!1)))},R=-1;return P.current=[],/* @__PURE__ */ w(`div`,{className:`wui-topsearch${S?` is-open`:``}${f?` is-loading`:``}`,ref:M,children:[/* @__PURE__ */ C(`button`,{type:`button`,className:`topbar-icon-btn wui-topsearch-open`,"aria-label":g,"aria-expanded":S,"aria-controls":`${s}-panel`,onClick:()=>{let e=!S;T(e),e&&N.current?.focus()},children:/* @__PURE__ */ C(d,{name:`search`,size:20})}),/* @__PURE__ */ w(`div`,{className:`wui-topsearch-panel`,id:`${s}-panel`,children:[/* @__PURE__ */ w(`div`,{className:`search-wrap`,children:[/* @__PURE__ */ C(d,{name:`search`,size:18,className:`search-icon`}),/* @__PURE__ */ C(`input`,{ref:N,type:`search`,className:`form-control input search-input`,id:`${s}-input`,placeholder:g,"aria-label":g,role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":I,"aria-controls":`${s}-list`,"aria-activedescendant":I&&A>=0?`${s}-opt-${A}`:void 0,autoComplete:`off`,value:c,onChange:e=>{D(!1),l?.(e.target.value)},onKeyDown:ee,onFocus:h})]}),/* @__PURE__ */ C(`div`,{className:`wui-topsearch-results`,id:`${s}-list`,role:`listbox`,"aria-label":n,hidden:!I,children:I&&/* @__PURE__ */ w(`div`,{className:`wui-topsearch-groups`,role:`presentation`,children:[L===0&&/* @__PURE__ */ C(`div`,{className:`wui-topsearch-empty`,role:`option`,"aria-disabled":`true`,"aria-selected":`false`,children:t(i,{value:c})}),u.filter(e=>e.hits?.length).map((e,t)=>/* @__PURE__ */ w(`div`,{className:`wui-topsearch-group`,role:`group`,"aria-label":e.label??``,children:[e.label&&/* @__PURE__ */ C(`div`,{className:`wui-topsearch-group-label`,role:`presentation`,children:e.label}),e.hits.map(e=>{R+=1;let t=R;return/* @__PURE__ */ w(`a`,{className:`wui-topsearch-hit${t===A?` is-active`:``}`,role:`option`,"aria-selected":t===A,id:`${s}-opt-${t}`,href:e.href,ref:e=>{P.current[t]=e},onClick:t=>p?.(e,t),children:[e.icon&&/* @__PURE__ */ C(`span`,{className:`wui-topsearch-hit-icon`,children:/* @__PURE__ */ C(d,{name:e.icon,size:18})}),/* @__PURE__ */ w(`span`,{className:`wui-topsearch-hit-text`,children:[/* @__PURE__ */ C(`span`,{className:`wui-topsearch-hit-title`,children:e.title}),e.subtitle&&/* @__PURE__ */ C(`span`,{className:`wui-topsearch-hit-sub`,children:e.subtitle})]})]},`${e.href}-${t}`)})]},e.label??t))]})})]}),/* @__PURE__ */ C(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:I?L===0?r:t(L===1?o:a,{count:L}):``})]})}export{z as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/fillLabel.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{splitMarkerProps as c}from"../lib/wuiMarker.js";import l from"./AppAvatar.js";import u from"./AppButton.js";import d from"./AppIcon.js";import f from"./AppNavigationMenu.js";import p from"./assertValidValue.js";import m from"./warnUnknownProps.js";import{initScrollEdges as h,revealActiveNavItem as g}from"@webority/ui-elements/helpers";import{useEffect as _,useId as v,useMemo as y,useRef as b,useState as x}from"react";import{Fragment as S,jsx as C,jsxs as w}from"react/jsx-runtime";var T=99,E=4,D=5,O=/^[a-z0-9-]+$/,k=[`prefix`,`exact`],A=[`comfortable`,`compact`],j=[`neutral`,`primary`],M=[`side`,`top`],N=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],P=/* @__PURE__ */ new Set([`key`,`label`,`icon`,`iconVariant`,`iconSize`,`href`,`badge`,`badgeTone`,`badgeTitle`,`newUntil`,`trailingIcon`,`active`,`match`,`matchAlso`,`tab`,`tabLabel`,`children`]),F=e=>e>T?`${T}+`:String(e),I=new Intl.DateTimeFormat(`en-CA`,{timeZone:`Asia/Kolkata`}),L=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:I.format(/* @__PURE__ */ new Date)<=e},ee=({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(` `)},R=({logoLight:e,logoDark:t,markLight:n,markDark:r,brandName:i})=>{let a=i??``,o=[e&&/* @__PURE__ */ C(`img`,{className:`wui-brand-logo wui-brand-light`,src:e,alt:a},`logo-light`),t&&/* @__PURE__ */ C(`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(Boolean).map(([t,n,r],i)=>i===0&&!e?/* @__PURE__ */ C(`img`,{className:n,src:r,alt:a},t):/* @__PURE__ */ C(`img`,{className:n,src:r,alt:``,"aria-hidden":`true`},t));return[...o,...s].filter(Boolean)};function te(e){let{marker:t,props:n}=c(`AppShell`,e),{groups:l=[],brand:u,logoLight:v,logoDark:T,markLight:E,markDark:D,brandName:O,brandHref:k,brandLabel:P,sidebarStart:F,sidebarStartCompact:I,sidebarFooter:L,topbarStart:te,topbarEnd:re,footer:z,launcher:B,children:V,collapsed:H,onCollapsedChange:W,noSidebar:G=!1,nav:K=`side`,density:fe=`comfortable`,itemHeight:pe,iconVariant:q=`twotone`,topbarTone:me=`neutral`,navLabel:he=`Main navigation`,linkComponent:J,currentPath:ge,rememberCollapsed:_e=!1,collapsedCookie:ve=`wui-shell-collapsed`,foldedCookie:ye=r,tabBarLabel:be=`Quick navigation`,moreLabel:xe=`More`,skipLabel:Se=`Skip to content`,openNavLabel:Ce=`Open navigation`,closeNavLabel:we=`Close navigation`,expandNavLabel:Te=`Expand navigation`,collapseNavLabel:Ee=`Collapse navigation`,newLabel:De=`New`,togglePagesLabel:Oe=`Show or hide {name} pages`,accountMenuLabel:ke=`Account menu for {name}`,roleLabel:Ae=`Role:`,rolesLabel:je=`Roles:`,unreadLabel:Me=`Unread`,markAllReadLabel:Ne=`Mark all read`,viewAllLabel:Pe=`View all`,loadingNotificationsText:Fe=`Loading…`,noUnreadText:Ie=`No unread notifications`,unreadNotificationsText:Le=`{count} unread notifications`,unreadBellLabel:Re=`{label}, {count} unread`,searchResultsLabel:ze=`Search results`,noResultsText:Be=`No results`,noResultsForText:Ve=`No results for “{value}”`,resultsCountText:He=`{count} results`,resultCountText:Ue=`{count} result`,userMenu:We,notifications:Ge,search:Ke,className:qe=``,style:Je,...Ye}=n;if(m(`AppShell`,Ye),p(`AppShell`,`density`,fe,A),p(`AppShell`,`topbarTone`,me,j),p(`AppShell`,`nav`,K,M),p(`AppShell`,`iconVariant`,q,N),P!==void 0&&!k)throw Error(`<AppShell> brandLabel names the brand link, so it needs brandHref.`);if(k){if(!P&&!O)throw Error(`<AppShell> brandHref needs brandLabel or brandName: the collapsed rail hides the logo, so the link would have no accessible name.`);if(!(u||v||T||E||D))throw Error(`<AppShell> brandHref has no brand, logo or mark to link.`)}let Xe=pe>0?{...Je,"--wui-nav-item-height":`${pe}px`}:Je,[Ze,Qe]=x(()=>_e&&H===void 0&&typeof document<`u`?a(ve)??!1:!1),[Y,X]=x(!1),[$e,et]=x(!1),[tt,nt]=x(!1),rt=b(null),it=b(null),at=b(null),Z=H??Ze,ot=e=>k?/* @__PURE__ */ C(oe,{href:k,label:P||O,linkComponent:J,onNavigate:()=>X(!1),children:e}):e,st=()=>{let e=!Z;H===void 0&&Qe(e),_e&&s(e,ve),W?.(e)},ct=l.some(e=>e.collapsible),[lt,ut]=x(()=>ct&&typeof document<`u`?i(ye):/* @__PURE__ */ new Set),dt=e=>{let t=new Set(lt);t.has(e)?t.delete(e):t.add(e),ut(t),o(t,ye)},Q=y(()=>ne(l,ge),[l,ge]),$=G?null:ie(Q);_(()=>{let e=()=>et(window.scrollY>4);return e(),window.addEventListener(`scroll`,e,{passive:!0}),()=>window.removeEventListener(`scroll`,e)},[]),_(()=>{h()},[]),_(()=>{g(rt.current)},[]),_(()=>{let e=rt.current;if(!e)return;let t=()=>nt(e.scrollHeight>e.clientHeight);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[Q]);let ft=!!z;_(()=>{let e=at.current,t=it.current;if(!ft||!e||!t)return;let n=()=>t.style.setProperty(`--app-footer-h`,`${e.offsetHeight}px`);n();let r=typeof ResizeObserver>`u`?null:new ResizeObserver(n);return r?.observe(e),()=>{r?.disconnect(),t.style.removeProperty(`--app-footer-h`)}},[ft]),_(()=>{if(!Y)return;let e=e=>{e.key===`Escape`&&X(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[Y]);let pt=[`app-shell`,Z?`collapsed`:``,G?`no-sidebar`:``,K===`top`?`wui-shell-top`:``,Y?`mobile-open`:``,qe].filter(Boolean).join(` `);return/* @__PURE__ */ w(`div`,{ref:it,className:pt,"data-density":fe===`compact`?`compact`:void 0,"data-wui-folded-cookie":ct?ye:void 0,style:Xe,...t,...Ye,children:[/* @__PURE__ */ C(`a`,{className:`wui-skip-link`,href:`#main-content`,children:Se}),/* @__PURE__ */ w(`aside`,{className:`app-sidebar`,children:[(u||v||T||E||D)&&/* @__PURE__ */ C(`div`,{className:ee({logoLight:v,logoDark:T,markLight:E,markDark:D}),children:ot(/* @__PURE__ */ w(S,{children:[R({logoLight:v,logoDark:T,markLight:E,markDark:D,brandName:O}),u]}))}),F&&/* @__PURE__ */ C(`div`,{className:`app-sidebar-start`,children:F}),I&&/* @__PURE__ */ C(`div`,{className:`app-sidebar-start-compact`,children:I}),/* @__PURE__ */ C(`nav`,{className:`app-sidebar-scroll`,"aria-label":he,ref:rt,tabIndex:tt?0:void 0,children:Q.map((e,t)=>{let n=e.items.map(e=>e.header==null?/* @__PURE__ */ C(ce,{item:e,linkComponent:J,onNavigate:()=>X(!1),iconVariant:q,newLabel:De,togglePagesLabel:Oe},e.key??e.href??e.label):/* @__PURE__ */ C(`div`,{className:`wui-nav-header`,children:e.header},e.key??e.header));if(!e.collapsible)return/* @__PURE__ */ w(`div`,{className:`app-nav-group`,children:[e.label&&/* @__PURE__ */ C(`div`,{className:`app-nav-group-label`,children:e.label}),n,e.after&&/* @__PURE__ */ C(`div`,{className:`wui-nav-group-after`,children:e.after})]},e.key??e.label??`group-${t}`);let r=!lt.has(e.key)||!!U(e.items),i=`wui-nav-group-${e.key}`;return/* @__PURE__ */ w(`div`,{className:`app-nav-group wui-nav-group-collapsible${r?``:` wui-nav-group-folded`}`,"data-wui-nav-group":e.key,children:[/* @__PURE__ */ w(`button`,{type:`button`,className:`app-nav-group-label wui-nav-group-toggle`,"aria-expanded":r,"aria-controls":i,onClick:()=>dt(e.key),children:[/* @__PURE__ */ C(`span`,{className:`wui-nav-group-text`,children:e.label}),/* @__PURE__ */ C(`span`,{className:`wui-nav-group-caret`,children:/* @__PURE__ */ C(d,{name:`chevron-down`,size:16})})]}),/* @__PURE__ */ w(`div`,{className:`wui-nav-group-body`,id:i,children:[n,e.after&&/* @__PURE__ */ C(`div`,{className:`wui-nav-group-after`,children:e.after})]})]},e.key??`group-${t}`)})}),L&&/* @__PURE__ */ C(`div`,{className:`app-sidebar-foot`,children:L}),!G&&/* @__PURE__ */ C(`button`,{type:`button`,className:`app-sidebar-toggle`,onClick:st,"aria-label":Z?Te:Ee,"aria-expanded":!Z,children:/* @__PURE__ */ C(d,{name:`chevrons-left`,size:20})})]}),/* @__PURE__ */ w(`div`,{className:`app-main`,children:[/* @__PURE__ */ w(`header`,{className:`app-topbar${$e?` scrolled`:``}`,"data-tone":me===`primary`?`primary`:void 0,children:[/* @__PURE__ */ w(`div`,{className:`app-topbar-start`,children:[/* @__PURE__ */ C(`button`,{type:`button`,className:`app-topbar-menu`,onClick:()=>X(!0),"aria-label":Ce,"aria-expanded":Y,children:/* @__PURE__ */ C(d,{name:`menu`,size:18})}),K===`top`&&u&&/* @__PURE__ */ C(`div`,{className:`wui-shell-top-brand`,children:ot(u)}),K===`top`&&/* @__PURE__ */ C(`div`,{className:`wui-shell-top-nav`,children:/* @__PURE__ */ C(f,{items:ae(Q),ariaLabel:he,linkComponent:J})}),te,Ke&&/* @__PURE__ */ C(de,{config:Ke,searchResultsLabel:ze,noResultsText:Be,noResultsForText:Ve,resultsCountText:He,resultCountText:Ue})]}),/* @__PURE__ */ w(`div`,{className:`app-topbar-end`,children:[re,Ge&&/* @__PURE__ */ C(ue,{config:Ge,unreadLabel:Me,markAllReadLabel:Ne,viewAllLabel:Pe,loadingNotificationsText:Fe,noUnreadText:Ie,unreadNotificationsText:Le,unreadBellLabel:Re}),We&&/* @__PURE__ */ C(le,{config:We,linkComponent:J,accountMenuLabel:ke,roleLabel:Ae,rolesLabel:je})]})]}),/* @__PURE__ */ C(`main`,{className:`app-content`,id:`main-content`,children:V}),z&&/* @__PURE__ */ C(`footer`,{className:`app-footer`,ref:at,children:z})]}),B&&/* @__PURE__ */ C(`div`,{className:`wui-shell-launcher`,children:B}),$&&/* @__PURE__ */ w(`nav`,{className:`wui-tabbar`,"aria-label":be,children:[$.tabs.map(e=>/* @__PURE__ */ C(se,{tab:e,linkComponent:J,iconVariant:q},e.key??e.href)),$.hasMore&&/* @__PURE__ */ w(`button`,{type:`button`,className:`wui-tabbar-item${$.moreActive?` active`:``}`,onClick:()=>X(!0),children:[/* @__PURE__ */ C(`span`,{className:`wui-tabbar-icon`,children:/* @__PURE__ */ C(d,{name:`more`,size:24})}),/* @__PURE__ */ C(`span`,{className:`wui-tabbar-label`,children:xe})]})]}),/* @__PURE__ */ C(`button`,{type:`button`,className:`app-scrim`,onClick:()=>X(!1),"aria-label":we,tabIndex:Y?0:-1})]})}function ne(e,t){for(let t of e)t.collapsible&&H(t);let r=(e,t=!1)=>(e??[]).map(e=>Array.isArray(e.children)?{...e,children:r(e.children)}:{...e}).filter(e=>z(e)?t:(e.children?.length??0)>0||!!e.href),i=e.map(e=>({...e,items:B(r(e.items,!0))})).filter(e=>e.items.some(e=>!z(e))),a=[],o=e=>{for(let t of e)z(t)||(a.push(t),t.children&&o(t.children))};for(let e of i)o(e.items);for(let e of a)m(`AppShell items`,re(e)),p(`AppShell`,`match`,e.match,k),p(`AppShell`,`iconVariant`,e.iconVariant,N);let s=null;if(t!=null&&!a.some(e=>e.active===!0)){let e=-1;for(let r of a){if(r.active!=null||r.children?.length&&!r.href)continue;let i=n(t,r.href,{exact:r.match===`exact`,also:r.matchAlso});if(i<0)continue;let a=r.match===`exact`&&n(t,r.href,{exact:!0})>=0?1/0:i;a>e&&(e=a,s=r)}}for(let e of a)e.active=e.active??e===s;return i}function re(e){return Object.fromEntries(Object.entries(e).filter(([e])=>!P.has(e)))}var z=e=>e.header!=null;function B(e){return e.filter((t,n)=>{if(!z(t))return!0;let r=e.findIndex((e,t)=>t>n&&z(e));return e.slice(n+1,r<0?void 0:r).length>0})}var V=/* @__PURE__ */ new Set;function H(t){if(t.key!=null&&O.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.`,r=!0;try{r=process.env.NODE_ENV!==`production`}catch{r=!0}r&&!V.has(n)&&(V.add(n),e(n))}function ie(e){let t=[],n=e=>{for(let r of e)z(r)||(r.children?.length?n(r.children):t.push(r))};for(let t of e)n(t.items);let r=t.filter(e=>e.tab);if(r.length===0)return null;let i=r.length<t.length,a=i?E:D;if(r.length>a)throw Error(`<AppShell>: ${r.length} items carry tab: true, but the phone tab bar holds ${a} (${i?`4 plus More, because other items exist`:`5 when every item is a tab`}). Flag fewer items.`);return{tabs:r,hasMore:i,moreActive:t.some(e=>!e.tab&&e.active)}}function ae(e){let t=e=>({key:e.key??e.href??e.label,label:e.label,to:e.href,current:!!e.active}),n=e=>e.flatMap(e=>z(e)?[]:[...e.href?[{...t(e),icon:e.icon}]:[],...n(e.children??[])]),r=[];for(let i of e.flatMap(e=>e.items)){if(z(i))continue;let e=n(i.children??[]);if(e.length>0){let n=i.href?[{...t(i),icon:i.icon}]:[];r.push({key:t(i).key,label:i.label,links:[...n,...e]})}else i.href&&r.push(t(i))}return r}function oe({href:e,label:t,linkComponent:n,onNavigate:r,children:i}){return n?/* @__PURE__ */ C(n,{className:`wui-brand-link`,to:e,"aria-label":t,onClick:r,children:i}):/* @__PURE__ */ C(`a`,{className:`wui-brand-link`,href:e,"aria-label":t,onClick:r,children:i})}function se({tab:e,linkComponent:t,iconVariant:n}){let r=`wui-tabbar-item${e.active?` active`:``}`,i=/* @__PURE__ */ w(S,{children:[e.icon&&/* @__PURE__ */ C(`span`,{className:`wui-tabbar-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ C(d,{name:e.icon,size:24,variant:e.iconVariant??n}):e.icon}),/* @__PURE__ */ C(`span`,{className:`wui-tabbar-label`,children:e.tabLabel??e.label}),e.badge!=null&&/* @__PURE__ */ C(`span`,{className:`wui-tabbar-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:e.badge})]}),a=e.active?`page`:void 0;return t?/* @__PURE__ */ C(t,{className:r,to:e.href,"aria-current":a,children:i}):/* @__PURE__ */ C(`a`,{className:r,href:e.href,"aria-current":a,children:i})}function U(e){for(let t of e){if(t.active)return t;let e=t.children?.length?U(t.children):void 0;if(e)return e}}function ce({item:e,linkComponent:n,onNavigate:r,depth:i=0,iconVariant:a,newLabel:o,togglePagesLabel:s}){let c=i>0,l=i>1?` wui-nav-depth-${Math.min(i,6)}`:``,u=Array.isArray(e.children)&&e.children.length>0,f=u?U(e.children):void 0,p=!!f,m=f?f.key??f.href??f.label:null,[h,g]=x(p);_(()=>{m!=null&&g(!0)},[m]);let v=typeof e.label==`string`?e.label:void 0,y=!c&&e.icon&&/* @__PURE__ */ C(`span`,{className:`app-nav-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ C(d,{name:e.icon,size:e.iconSize??22,variant:e.iconVariant??a}):e.icon}),b=e.badge!=null&&/* @__PURE__ */ C(`span`,{className:`app-nav-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:e.badge}),T=L(e.newUntil)&&/* @__PURE__ */ C(`span`,{className:`wui-nav-new`,children:o}),E=/* @__PURE__ */ w(S,{children:[y,/* @__PURE__ */ C(`span`,{className:`app-nav-text`,children:e.label}),T,b,e.trailingIcon&&/* @__PURE__ */ C(`span`,{className:`app-nav-trailing`,children:typeof e.trailingIcon==`string`?/* @__PURE__ */ C(d,{name:e.trailingIcon,size:16}):e.trailingIcon})]}),D=e.active?`page`:void 0;if(u){let u=/* @__PURE__ */ C(`div`,{className:`app-nav-sub${h?` expanded`:``}`,inert:!h,"aria-hidden":!h||void 0,children:/* @__PURE__ */ C(`div`,{className:`app-nav-sub-inner`,children:e.children.map(e=>/* @__PURE__ */ C(ce,{item:e,linkComponent:n,onNavigate:r,depth:i+1,iconVariant:a,newLabel:o,togglePagesLabel:s},e.key??e.href))})});if(e.href){let i=n?/* @__PURE__ */ C(n,{className:`wui-nav-split-link`,to:e.href,"aria-current":D,onClick:r,children:E}):/* @__PURE__ */ C(`a`,{className:`wui-nav-split-link`,href:e.href,"aria-current":D,onClick:r,children:E});return/* @__PURE__ */ w(S,{children:[/* @__PURE__ */ w(`div`,{className:`app-nav-item has-children wui-nav-split${c?` app-nav-subitem`:``}${p||e.active?` active`:``}${l}`,"data-label":v,children:[i,/* @__PURE__ */ C(`button`,{type:`button`,className:`app-nav-caret wui-nav-split-toggle`,"aria-expanded":h,"aria-label":t(s,{name:v??``}),onClick:()=>g(e=>!e),children:/* @__PURE__ */ C(d,{name:`chevron-right`,size:16})})]}),u]})}return/* @__PURE__ */ w(S,{children:[/* @__PURE__ */ w(`button`,{type:`button`,className:`app-nav-item${c?` app-nav-subitem`:``} has-children${p?` active`:``}${l}`,"aria-expanded":h,"data-label":v,onClick:()=>g(e=>!e),children:[y,/* @__PURE__ */ C(`span`,{className:`app-nav-text`,children:e.label}),T,b,/* @__PURE__ */ C(`span`,{className:`app-nav-caret`,children:/* @__PURE__ */ C(d,{name:`chevron-right`,size:16})})]}),u]})}let O=`app-nav-item${c?` app-nav-subitem`:``}${e.active?` active`:``}${l}`;return n?/* @__PURE__ */ C(n,{className:O,to:e.href,"aria-current":D,"data-label":v,onClick:r,children:E}):/* @__PURE__ */ C(`a`,{className:O,href:e.href,"aria-current":D,"data-label":v,onClick:r,children:E})}function W(){let[e,t]=x(!1),n=b(null);return _(()=>{if(!e)return;let r=e=>{n.current?.contains(e.target)||t(!1)},i=e=>{e.key===`Escape`&&(t(!1),n.current?.querySelector(`button`)?.focus())};return document.addEventListener(`mousedown`,r),document.addEventListener(`keydown`,i),()=>{document.removeEventListener(`mousedown`,r),document.removeEventListener(`keydown`,i)}},[e]),{open:e,setOpen:t,ref:n}}function le({config:e,linkComponent:n,accountMenuLabel:r,roleLabel:i,rolesLabel:a}){let o=v(),{open:s,setOpen:c,ref:f}=W(),{name:m,role:h,roles:g=[],photo:_,profileHref:y,profileLabel:b=`My profile`,onLogout:x,logoutAction:T,logoutLabel:E=`Sign out`,head:D,section:O,logoutVariant:k=`item`,items:A=[]}=e;if(p(`AppShell`,`userMenu.logoutVariant`,k,[`item`,`button`]),!m)throw Error(`<AppShell> userMenu.name is required; the trigger and the avatar are named from it.`);let j=g.map(e=>(e??``).trim()).filter(Boolean),M=()=>c(!1),N=(e,t,r,i)=>n?/* @__PURE__ */ C(n,{className:`dropdown-item`,to:e,onClick:i,children:t},r):/* @__PURE__ */ C(`a`,{className:`dropdown-item`,href:e,onClick:i,children:t},r),P=/* @__PURE__ */ C(d,{name:`log-out`,size:18}),F=/* @__PURE__ */ w(S,{children:[P,E]});return/* @__PURE__ */ w(`div`,{className:`dropdown wui-usermenu`,ref:f,children:[/* @__PURE__ */ w(`button`,{type:`button`,id:o,className:`wui-usermenu-trigger`,"aria-expanded":s,"aria-label":t(r,{name:m}),onClick:()=>c(e=>!e),children:[/* @__PURE__ */ C(l,{name:m,src:_,tone:`auto`}),/* @__PURE__ */ w(`span`,{className:`wui-usermenu-text`,children:[/* @__PURE__ */ C(`span`,{className:`wui-usermenu-name`,children:m}),h&&/* @__PURE__ */ C(`span`,{className:`wui-usermenu-role`,children:h})]}),/* @__PURE__ */ C(d,{name:`chevron-down`,size:14,className:`wui-usermenu-caret`})]}),/* @__PURE__ */ w(`div`,{className:`dropdown-menu dropdown-menu-end wui-usermenu-menu${s?` show`:``}`,"aria-labelledby":o,"data-bs-popper":s?`static`:void 0,children:[/* @__PURE__ */ w(`div`,{className:`wui-usermenu-head`,children:[/* @__PURE__ */ C(l,{name:m,src:_,size:`lg`,tone:`auto`}),/* @__PURE__ */ w(`div`,{className:`wui-usermenu-who`,children:[/* @__PURE__ */ C(`div`,{className:`wui-usermenu-name`,children:m}),h&&/* @__PURE__ */ C(`div`,{className:`wui-usermenu-role`,children:h}),j.length>0&&/* @__PURE__ */ w(`div`,{className:`wui-usermenu-roles`,children:[/* @__PURE__ */ C(`span`,{className:`wui-usermenu-roles-label`,children:j.length===1?i:a}),` ${j.join(`, `)}`]}),D?/* @__PURE__ */ C(`div`,{className:`wui-usermenu-extra`,children:D}):null]})]}),O?/* @__PURE__ */ C(`div`,{className:`wui-usermenu-section`,children:O}):null,y&&N(y,/* @__PURE__ */ w(S,{children:[/* @__PURE__ */ C(d,{name:`user`,size:18}),b]}),void 0,M),A.map(e=>{if(e.divider)return/* @__PURE__ */ C(`hr`,{className:`dropdown-divider`},e.key);let t=/* @__PURE__ */ w(S,{children:[e.icon&&/* @__PURE__ */ C(d,{name:e.icon,size:18}),e.label]}),n=()=>{e.onClick?.(),M()};return e.href?N(e.href,t,e.key,n):/* @__PURE__ */ C(`button`,{type:`button`,className:`dropdown-item`,onClick:n,children:t},e.key)}),k===`button`?(T||x)&&/* @__PURE__ */ C(`div`,{className:`wui-usermenu-foot`,children:T?/* @__PURE__ */ C(`form`,{method:`post`,action:T,className:`wui-usermenu-logout`,children:/* @__PURE__ */ C(u,{type:`submit`,tone:`danger`,variant:`soft`,block:!0,leftIcon:P,children:E})}):/* @__PURE__ */ C(u,{type:`button`,tone:`danger`,variant:`soft`,block:!0,leftIcon:P,onClick:()=>{M(),x()},children:E})}):T?/* @__PURE__ */ C(`form`,{method:`post`,action:T,className:`wui-usermenu-logout`,children:/* @__PURE__ */ C(`button`,{type:`submit`,className:`dropdown-item danger`,children:F})}):x&&/* @__PURE__ */ C(`button`,{type:`button`,className:`dropdown-item danger`,onClick:()=>{M(),x()},children:F})]})]})}function ue({config:e,unreadLabel:n,markAllReadLabel:r,viewAllLabel:i,loadingNotificationsText:a,noUnreadText:o,unreadNotificationsText:s,unreadBellLabel:c}){let l=v(),{open:u,setOpen:f,ref:p}=W(),{unread:m=0,items:h,loading:g=!1,onOpen:y,onMarkAllRead:T,viewAllHref:E,label:D=`Notifications`,emptyText:O=`You are all caught up.`}=e,[k,A]=x(``),j=b(m);_(()=>{j.current!==m&&(j.current=m,A(m===0?o:t(s,{count:F(m)})))},[m,o,s]);let M=null;return h?.length?M=/* @__PURE__ */ C(`div`,{className:`wui-bell-items`,children:h.map((e,t)=>{let r=`wui-bell-item${e.read?` wui-bell-item-read`:``}`,i=/* @__PURE__ */ w(S,{children:[/* @__PURE__ */ C(`span`,{className:`wui-bell-dot`,"aria-hidden":`true`}),e.icon&&/* @__PURE__ */ C(`span`,{className:`wui-bell-icon`,children:/* @__PURE__ */ C(d,{name:e.icon,size:18})}),/* @__PURE__ */ w(`span`,{className:`wui-bell-body`,children:[!e.read&&/* @__PURE__ */ w(`span`,{className:`visually-hidden`,children:[n,`: `]}),/* @__PURE__ */ C(`span`,{className:`wui-bell-item-title`,children:e.title}),e.time&&/* @__PURE__ */ C(`span`,{className:`wui-bell-when`,children:e.time})]})]});return e.href?/* @__PURE__ */ C(`a`,{className:r,href:e.href,"data-id":e.id,children:i},e.id??t):/* @__PURE__ */ C(`div`,{className:r,"data-id":e.id,children:i},e.id??t)})}):g?M=/* @__PURE__ */ C(`div`,{className:`wui-bell-state`,children:a}):h&&(M=/* @__PURE__ */ C(`div`,{className:`wui-bell-state`,children:O})),/* @__PURE__ */ w(`div`,{className:`dropdown wui-bell`,ref:p,children:[/* @__PURE__ */ w(`button`,{type:`button`,id:l,className:`topbar-icon-btn wui-bell-trigger`,"aria-expanded":u,"aria-label":m===0?D:t(c,{label:D,count:F(m)}),onClick:()=>{let e=!u;f(e),e&&y?.()},children:[/* @__PURE__ */ C(d,{name:`notification`,size:20}),/* @__PURE__ */ C(`span`,{className:`wui-bell-count`,"aria-hidden":`true`,hidden:m===0,children:F(m)})]}),/* @__PURE__ */ C(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:k}),/* @__PURE__ */ w(`div`,{className:`dropdown-menu dropdown-menu-end wui-bell-menu${u?` show`:``}`,"aria-labelledby":l,"data-bs-popper":u?`static`:void 0,children:[/* @__PURE__ */ w(`div`,{className:`wui-bell-head`,children:[/* @__PURE__ */ C(`span`,{className:`wui-bell-title`,children:D}),T&&/* @__PURE__ */ C(`button`,{type:`button`,className:`wui-bell-markall`,onClick:T,children:r})]}),/* @__PURE__ */ C(`div`,{className:`wui-bell-list`,"aria-busy":g||void 0,children:M}),E&&/* @__PURE__ */ C(`a`,{className:`wui-bell-foot`,href:E,children:i})]})]})}var G=e=>!!e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName));function de({config:e,searchResultsLabel:n,noResultsText:r,noResultsForText:i,resultsCountText:a,resultCountText:o}){let s=v(),{value:c=``,onChange:l,results:u=null,loading:f=!1,onSelect:p,onSubmit:m,onFocus:h,placeholder:g=`Search`}=e,[S,T]=x(!1),[E,D]=x(!1),[O,k]=x({results:null,index:-1}),A=O.results===u?O.index:-1,j=e=>k({results:u,index:e}),M=b(null),N=b(null),P=b([]),F=y(()=>(u??[]).flatMap(e=>e.hits??[]),[u]),I=u!=null&&!E,L=F.length;_(()=>{let e=e=>{e.key!==`/`||e.ctrlKey||e.metaKey||e.altKey||G(e.target)||(e.preventDefault(),T(!0),N.current?.focus())},t=e=>{M.current?.contains(e.target)||(D(!0),T(!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(!I||L===0)return;e.preventDefault(),j((A+(e.key===`ArrowDown`?1:-1)+L)%L)}else e.key===`Enter`?I&&A>=0&&P.current[A]?(e.preventDefault(),P.current[A].click()):m&&c.trim()!==``&&(e.preventDefault(),m(c.trim())):e.key===`Escape`&&(I?(e.preventDefault(),D(!0)):S&&(e.preventDefault(),T(!1)))},R=-1;return P.current=[],/* @__PURE__ */ w(`div`,{className:`wui-topsearch${S?` is-open`:``}${f?` is-loading`:``}`,ref:M,children:[/* @__PURE__ */ C(`button`,{type:`button`,className:`topbar-icon-btn wui-topsearch-open`,"aria-label":g,"aria-expanded":S,"aria-controls":`${s}-panel`,onClick:()=>{let e=!S;T(e),e&&N.current?.focus()},children:/* @__PURE__ */ C(d,{name:`search`,size:20})}),/* @__PURE__ */ w(`div`,{className:`wui-topsearch-panel`,id:`${s}-panel`,children:[/* @__PURE__ */ w(`div`,{className:`search-wrap`,children:[/* @__PURE__ */ C(d,{name:`search`,size:18,className:`search-icon`}),/* @__PURE__ */ C(`input`,{ref:N,type:`search`,className:`form-control input search-input`,id:`${s}-input`,placeholder:g,"aria-label":g,role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":I,"aria-controls":`${s}-list`,"aria-activedescendant":I&&A>=0?`${s}-opt-${A}`:void 0,autoComplete:`off`,value:c,onChange:e=>{D(!1),l?.(e.target.value)},onKeyDown:ee,onFocus:h})]}),/* @__PURE__ */ C(`div`,{className:`wui-topsearch-results`,id:`${s}-list`,role:`listbox`,"aria-label":n,hidden:!I,children:I&&/* @__PURE__ */ w(`div`,{className:`wui-topsearch-groups`,role:`presentation`,children:[L===0&&/* @__PURE__ */ C(`div`,{className:`wui-topsearch-empty`,role:`option`,"aria-disabled":`true`,"aria-selected":`false`,children:t(i,{value:c})}),u.filter(e=>e.hits?.length).map((e,t)=>/* @__PURE__ */ w(`div`,{className:`wui-topsearch-group`,role:`group`,"aria-label":e.label??``,children:[e.label&&/* @__PURE__ */ C(`div`,{className:`wui-topsearch-group-label`,role:`presentation`,children:e.label}),e.hits.map(e=>{R+=1;let t=R;return/* @__PURE__ */ w(`a`,{className:`wui-topsearch-hit${t===A?` is-active`:``}`,role:`option`,"aria-selected":t===A,id:`${s}-opt-${t}`,href:e.href,ref:e=>{P.current[t]=e},onClick:t=>p?.(e,t),children:[e.icon&&/* @__PURE__ */ C(`span`,{className:`wui-topsearch-hit-icon`,children:/* @__PURE__ */ C(d,{name:e.icon,size:18})}),/* @__PURE__ */ w(`span`,{className:`wui-topsearch-hit-text`,children:[/* @__PURE__ */ C(`span`,{className:`wui-topsearch-hit-title`,children:e.title}),e.subtitle&&/* @__PURE__ */ C(`span`,{className:`wui-topsearch-hit-sub`,children:e.subtitle})]})]},`${e.href}-${t}`)})]},e.label??t))]})})]}),/* @__PURE__ */ C(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:I?L===0?r:t(L===1?o:a,{count:L}):``})]})}export{te as default};
@@ -1 +1 @@
1
- import e from"../lib/fillLabel.js";import{linkTarget as t}from"../lib/linkTarget.js";import{TONES as n}from"../lib/vocabulary.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./AppIcon.js";import a from"./assertValidValue.js";import o from"./warnUnknownProps.js";import{jsx as s,jsxs as c}from"react/jsx-runtime";var l=[`feed`,`progress`,`steps`],u=[`vertical`,`horizontal`],d=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],f=n.filter(e=>e!==`primary`),p=[`sm`,`md`,`lg`],m={done:`check`,current:`clock`,"on-hold":`lock`,rejected:`x`,cancelled:`minus`,skipped:`arrow-right`,upcoming:null},h=e=>typeof e==`string`&&(/^https?:[/][/]/i.test(e)||e.startsWith(`/`)&&e[1]!==`/`&&e[1]!==`\\`)&&![...e].some(e=>e.charCodeAt(0)<=32||e.charCodeAt(0)===127);function g(e){if(e.byHref!=null&&e.byHref!==``){if(!h(e.byHref))throw Error(`<AppTimeline> items[].byHref must be a path starting with one '/', or an http:// or https:// address, with no spaces.`);if(!e.by)throw Error(`<AppTimeline> items[].byHref links the by name, so the item needs by.`)}}var _=(e,n)=>{if(!e.byHref)return e.by;let{Tag:r,linkProps:i}=t(n,{href:e.byHref});return/* @__PURE__ */ s(r,{className:`timeline-by-link`,...i,children:e.by})};function v(t){let{marker:n,props:h}=r(`AppTimeline`,t),{items:v=[],variant:y=`feed`,orientation:b,iconVariant:x,size:S,linkComponent:C,className:w=``,style:T,stepLabel:E=`Step {number}`,...D}=h;o(`AppTimeline`,D),a(`AppTimeline`,`variant`,y,l),a(`AppTimeline`,`orientation`,b,u),a(`AppTimeline`,`iconVariant`,x,d),a(`AppTimeline`,`size`,typeof S==`string`?S:null,p);for(let e of v)a(`AppTimeline`,`items[].tone`,e.tone,f),g(e),y===`progress`&&a(`AppTimeline`,`items[].status`,e.status,Object.keys(m));let O=y===`progress`,k=y===`steps`,A=b===`horizontal`,j=x??(k?`bulk`:void 0),M=typeof S==`string`&&p.includes(S)?S:`md`,N=typeof S==`number`&&S>0?S:void 0,P=!N&&M!==`md`?` wui-timeline--${M}`:``,F=`${k?`timeline wui-timeline--steps${b===`vertical`?` wui-timeline--steps-vertical`:``}`:`timeline${O?` timeline--progress`:``}${A?` timeline--horizontal`:``}`}${P}${w?` ${w}`:``}`,I=k?N?Math.round(N*.43):{sm:19,md:24,lg:31}[M]:N?Math.round(N*.54):O?{sm:10,md:13,lg:17}[M]:{sm:10,md:12,lg:17}[M],L=N?{...T,"--wui-timeline-dot":`${N}px`}:T;return/* @__PURE__ */ s(`ol`,{className:F,style:L,...n,...D,children:v.map((t,n)=>{let r=t.tone&&t.tone!==`neutral`?` ${t.tone}`:``;if(k){let a=t.eyebrow??e(E,{number:n+1});return/* @__PURE__ */ c(`li`,{className:`timeline-item${r}`,children:[/* @__PURE__ */ s(`span`,{className:`timeline-dot`,children:t.icon?/* @__PURE__ */ s(i,{name:t.icon,size:I,variant:j}):null}),/* @__PURE__ */ c(`div`,{className:`timeline-body`,children:[a!==``&&/* @__PURE__ */ s(`div`,{className:`wui-timeline-eyebrow`,children:a}),/* @__PURE__ */ s(`div`,{className:`timeline-title`,children:t.title}),t.description&&/* @__PURE__ */ s(`div`,{className:`timeline-desc`,children:t.description})]})]},t.key??`${t.at}-${n}`)}let a=O?t.status:void 0,o=a?` is-${a}`:``,l=O?t.icon??(a?m[a]:void 0):t.icon||`circle`;return/* @__PURE__ */ c(`li`,{className:`timeline-item${o}${r}`,children:[/* @__PURE__ */ s(`span`,{className:`timeline-dot`,children:l?/* @__PURE__ */ s(i,{name:l,size:I,variant:j}):null}),/* @__PURE__ */ c(`div`,{className:`timeline-body`,children:[O?/* @__PURE__ */ c(`div`,{className:`timeline-head`,children:[/* @__PURE__ */ s(`div`,{className:`timeline-title`,children:t.title}),(t.at||t.time)&&/* @__PURE__ */ c(`span`,{className:`timeline-when`,children:[t.at&&/* @__PURE__ */ s(`span`,{className:`timeline-at`,title:t.atTitle||void 0,children:t.at}),t.time&&/* @__PURE__ */ s(`span`,{className:`timeline-time`,children:t.time})]})]}):/* @__PURE__ */ s(`div`,{className:`timeline-title`,children:t.title}),t.description&&/* @__PURE__ */ s(`div`,{className:`timeline-desc`,children:t.description}),!O&&(t.at||t.time||t.by)&&/* @__PURE__ */ c(`div`,{className:`timeline-meta`,children:[(t.at||t.time)&&/* @__PURE__ */ c(`span`,{className:`timeline-when`,children:[t.at&&/* @__PURE__ */ s(`span`,{className:`timeline-at`,title:t.atTitle||void 0,children:t.at}),t.time&&/* @__PURE__ */ s(`span`,{className:`timeline-time`,children:t.time})]}),t.by&&/* @__PURE__ */ s(`span`,{className:`timeline-by`,children:_(t,C)})]}),O&&t.by&&/* @__PURE__ */ s(`div`,{className:`timeline-meta`,children:/* @__PURE__ */ s(`span`,{className:`timeline-by`,children:_(t,C)})}),t.note&&/* @__PURE__ */ s(`p`,{className:`timeline-note`,children:t.note})]})]},t.key??`${t.at}-${n}`)})})}export{v as default};
1
+ import e from"../lib/fillLabel.js";import{linkTarget as t}from"../lib/linkTarget.js";import{TONES as n}from"../lib/vocabulary.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./AppIcon.js";import a from"./AppMarkdown.js";import o from"./assertValidValue.js";import s from"./warnUnknownProps.js";import{jsx as c,jsxs as l}from"react/jsx-runtime";var u=[`feed`,`progress`,`steps`],d=[`vertical`,`horizontal`],f=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],p=n.filter(e=>e!==`primary`),m=[`sm`,`md`,`lg`],h={done:`check`,current:`clock`,"on-hold":`lock`,rejected:`x`,cancelled:`minus`,skipped:`arrow-right`,upcoming:null},g=e=>typeof e==`string`&&(/^https?:[/][/]/i.test(e)||e.startsWith(`/`)&&e[1]!==`/`&&e[1]!==`\\`)&&![...e].some(e=>e.charCodeAt(0)<=32||e.charCodeAt(0)===127);function _(e){if(e.byHref!=null&&e.byHref!==``){if(!g(e.byHref))throw Error(`<AppTimeline> items[].byHref must be a path starting with one '/', or an http:// or https:// address, with no spaces.`);if(!e.by)throw Error(`<AppTimeline> items[].byHref links the by name, so the item needs by.`)}}var v=(e,n)=>{if(!e.byHref)return e.by;let{Tag:r,linkProps:i}=t(n,{href:e.byHref});return/* @__PURE__ */ c(r,{className:`timeline-by-link`,...i,children:e.by})},y=(e,t)=>t?/* @__PURE__ */ c(a,{value:e.description,headings:`text`}):e.description,b=(e,t)=>t?/* @__PURE__ */ c(`div`,{className:`timeline-note wui-timeline-note--markdown`,children:/* @__PURE__ */ c(a,{value:e.note,headings:`text`})}):/* @__PURE__ */ c(`p`,{className:`timeline-note`,children:e.note});function x(t){let{marker:n,props:a}=r(`AppTimeline`,t),{items:g=[],variant:x=`feed`,orientation:S,iconVariant:C,size:w,linkComponent:T,className:E=``,style:D,stepLabel:O=`Step {number}`,markdown:k=!1,...A}=a;s(`AppTimeline`,A),o(`AppTimeline`,`variant`,x,u),o(`AppTimeline`,`orientation`,S,d),o(`AppTimeline`,`iconVariant`,C,f),o(`AppTimeline`,`size`,typeof w==`string`?w:null,m);for(let e of g){if(k){for(let t of[`description`,`note`])if(e[t]!=null&&typeof e[t]!=`string`)throw TypeError(`<AppTimeline> items[].${t} must be a string when markdown is set, because it is Markdown source.`)}o(`AppTimeline`,`items[].tone`,e.tone,p),_(e),x===`progress`&&o(`AppTimeline`,`items[].status`,e.status,Object.keys(h))}let j=x===`progress`,M=x===`steps`,N=S===`horizontal`,P=C??(M?`bulk`:void 0),F=typeof w==`string`&&m.includes(w)?w:`md`,I=typeof w==`number`&&w>0?w:void 0,L=!I&&F!==`md`?` wui-timeline--${F}`:``,R=`${M?`timeline wui-timeline--steps${S===`vertical`?` wui-timeline--steps-vertical`:``}`:`timeline${j?` timeline--progress`:``}${N?` timeline--horizontal`:``}`}${L}${E?` ${E}`:``}`,z=M?I?Math.round(I*.43):{sm:19,md:24,lg:31}[F]:I?Math.round(I*.54):j?{sm:10,md:13,lg:17}[F]:{sm:10,md:12,lg:17}[F],B=I?{...D,"--wui-timeline-dot":`${I}px`}:D;return/* @__PURE__ */ c(`ol`,{className:R,style:B,...n,...A,children:g.map((t,n)=>{let r=t.tone&&t.tone!==`neutral`?` ${t.tone}`:``;if(M){let a=t.eyebrow??e(O,{number:n+1});return/* @__PURE__ */ l(`li`,{className:`timeline-item${r}`,children:[/* @__PURE__ */ c(`span`,{className:`timeline-dot`,children:t.icon?/* @__PURE__ */ c(i,{name:t.icon,size:z,variant:P}):null}),/* @__PURE__ */ l(`div`,{className:`timeline-body`,children:[a!==``&&/* @__PURE__ */ c(`div`,{className:`wui-timeline-eyebrow`,children:a}),/* @__PURE__ */ c(`div`,{className:`timeline-title`,children:t.title}),t.description&&/* @__PURE__ */ c(`div`,{className:`timeline-desc`,children:y(t,k)})]})]},t.key??`${t.at}-${n}`)}let a=j?t.status:void 0,o=a?` is-${a}`:``,s=j?t.icon??(a?h[a]:void 0):t.icon||`circle`;return/* @__PURE__ */ l(`li`,{className:`timeline-item${o}${r}`,children:[/* @__PURE__ */ c(`span`,{className:`timeline-dot`,children:s?/* @__PURE__ */ c(i,{name:s,size:z,variant:P}):null}),/* @__PURE__ */ l(`div`,{className:`timeline-body`,children:[j?/* @__PURE__ */ l(`div`,{className:`timeline-head`,children:[/* @__PURE__ */ c(`div`,{className:`timeline-title`,children:t.title}),(t.at||t.time)&&/* @__PURE__ */ l(`span`,{className:`timeline-when`,children:[t.at&&/* @__PURE__ */ c(`span`,{className:`timeline-at`,title:t.atTitle||void 0,children:t.at}),t.time&&/* @__PURE__ */ c(`span`,{className:`timeline-time`,children:t.time})]})]}):/* @__PURE__ */ c(`div`,{className:`timeline-title`,children:t.title}),t.description&&/* @__PURE__ */ c(`div`,{className:`timeline-desc`,children:y(t,k)}),!j&&(t.at||t.time||t.by)&&/* @__PURE__ */ l(`div`,{className:`timeline-meta`,children:[(t.at||t.time)&&/* @__PURE__ */ l(`span`,{className:`timeline-when`,children:[t.at&&/* @__PURE__ */ c(`span`,{className:`timeline-at`,title:t.atTitle||void 0,children:t.at}),t.time&&/* @__PURE__ */ c(`span`,{className:`timeline-time`,children:t.time})]}),t.by&&/* @__PURE__ */ c(`span`,{className:`timeline-by`,children:v(t,T)})]}),j&&t.by&&/* @__PURE__ */ c(`div`,{className:`timeline-meta`,children:/* @__PURE__ */ c(`span`,{className:`timeline-by`,children:v(t,T)})}),t.note&&b(t,k)]})]},t.key??`${t.at}-${n}`)})})}export{x as default};