@webority/ui-react 0.146.2 → 0.148.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.146.2"
5
+ "version": "0.148.0"
6
6
  },
7
7
  "rendererProtocolVersion": 13,
8
8
  "platform": "Web",
@@ -3839,6 +3839,12 @@
3839
3839
  "description": "Extra classes on the element.",
3840
3840
  "default": ""
3841
3841
  },
3842
+ {
3843
+ "name": "count",
3844
+ "type": "node",
3845
+ "required": false,
3846
+ "description": "A count shown after the label, such as a filter's result count."
3847
+ },
3842
3848
  {
3843
3849
  "name": "disabled",
3844
3850
  "type": "boolean",
@@ -3864,6 +3870,12 @@
3864
3870
  "required": false,
3865
3871
  "description": "aria-label for the dismiss button."
3866
3872
  },
3873
+ {
3874
+ "name": "selected",
3875
+ "type": "boolean",
3876
+ "required": false,
3877
+ "description": "With onClick, true marks the chip as the chosen filter (its button carries aria-pressed). Needs onClick; a chip that is not clickable refuses it."
3878
+ },
3867
3879
  {
3868
3880
  "name": "size",
3869
3881
  "type": "enum",
@@ -5741,7 +5753,7 @@
5741
5753
  "name": "value",
5742
5754
  "type": "string",
5743
5755
  "required": false,
5744
- "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."
5745
5757
  }
5746
5758
  ],
5747
5759
  "required": false,
@@ -5751,7 +5763,7 @@
5751
5763
  "name": "value",
5752
5764
  "type": "string",
5753
5765
  "required": false,
5754
- "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."
5755
5767
  }
5756
5768
  ],
5757
5769
  "required": false,
@@ -5843,6 +5855,13 @@
5843
5855
  "description": "The list's accessible name.",
5844
5856
  "default": "Comments"
5845
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
+ },
5846
5865
  {
5847
5866
  "name": "noCommentsText",
5848
5867
  "type": "string",
@@ -8770,12 +8789,13 @@
8770
8789
  "name": "menuWidth",
8771
8790
  "type": "enum",
8772
8791
  "enum": [
8792
+ "fit",
8773
8793
  "lg",
8774
8794
  "md",
8775
8795
  "sm"
8776
8796
  ],
8777
8797
  "required": false,
8778
- "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."
8779
8799
  },
8780
8800
  {
8781
8801
  "name": "open",
@@ -10042,7 +10062,45 @@
10042
10062
  },
10043
10063
  {
10044
10064
  "name": "files",
10045
- "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
+ ],
10046
10104
  "required": false,
10047
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.",
10048
10106
  "default": []
@@ -10054,7 +10112,9 @@
10054
10112
  "description": "Accessible name of the list."
10055
10113
  }
10056
10114
  ],
10057
- "itemsTakeAction": [],
10115
+ "itemsTakeAction": [
10116
+ "files"
10117
+ ],
10058
10118
  "takesAction": [],
10059
10119
  "source": "@webority/ui-react",
10060
10120
  "usage": {
@@ -12892,7 +12952,7 @@
12892
12952
  ],
12893
12953
  "required": false,
12894
12954
  "description": "The icon style of a named icon; a node icon is drawn as given.",
12895
- "default": "linear"
12955
+ "default": "twotone"
12896
12956
  },
12897
12957
  {
12898
12958
  "name": "inline",
@@ -20668,6 +20728,26 @@
20668
20728
  "description": "Shows the value but blocks editing. The value still posts.",
20669
20729
  "default": false
20670
20730
  },
20731
+ {
20732
+ "name": "recentsKey",
20733
+ "type": "string",
20734
+ "required": false,
20735
+ "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."
20736
+ },
20737
+ {
20738
+ "name": "recentsLabel",
20739
+ "type": "string",
20740
+ "required": false,
20741
+ "description": "The heading of the recent options.",
20742
+ "default": "Recent"
20743
+ },
20744
+ {
20745
+ "name": "recentsLimit",
20746
+ "type": "number",
20747
+ "required": false,
20748
+ "description": "How many recent options to show and keep, 1 to 20.",
20749
+ "default": 5
20750
+ },
20671
20751
  {
20672
20752
  "name": "remote",
20673
20753
  "type": "boolean",
@@ -21118,6 +21198,18 @@
21118
21198
  "required": false,
21119
21199
  "description": "The logo row at the top of the sidebar."
21120
21200
  },
21201
+ {
21202
+ "name": "brandHref",
21203
+ "type": "string",
21204
+ "required": false,
21205
+ "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."
21206
+ },
21207
+ {
21208
+ "name": "brandLabel",
21209
+ "type": "string",
21210
+ "required": false,
21211
+ "description": "The brand link's accessible name, such as Acme home. Used only with brandHref; defaults to brandName."
21212
+ },
21121
21213
  {
21122
21214
  "name": "brandName",
21123
21215
  "type": "string",
@@ -21374,7 +21466,8 @@
21374
21466
  "twotone"
21375
21467
  ],
21376
21468
  "required": false,
21377
- "description": "The iconsax style of every sidebar icon. A row's own iconVariant overrides it; bulk is the filled look. Unset, icons draw in the linear style."
21469
+ "description": "The iconsax style of every sidebar icon. A row's own iconVariant overrides it; bulk is the filled look. Unset, icons draw in the twotone style.",
21470
+ "default": "twotone"
21378
21471
  },
21379
21472
  {
21380
21473
  "name": "itemHeight",
@@ -26059,7 +26152,7 @@
26059
26152
  "name": "description",
26060
26153
  "type": "node",
26061
26154
  "required": false,
26062
- "description": "A plain line of text under the title."
26155
+ "description": "A plain line of text under the title. With markdown set it is Markdown source and must be a string."
26063
26156
  },
26064
26157
  {
26065
26158
  "name": "eyebrow",
@@ -26083,7 +26176,7 @@
26083
26176
  "name": "note",
26084
26177
  "type": "string",
26085
26178
  "required": false,
26086
- "description": "A boxed note under the item."
26179
+ "description": "A boxed note under the item. With markdown set it is Markdown source."
26087
26180
  },
26088
26181
  {
26089
26182
  "name": "status",
@@ -26130,6 +26223,13 @@
26130
26223
  "description": "The entries. Feed: newest first. Progress and steps: first stage first.",
26131
26224
  "default": []
26132
26225
  },
26226
+ {
26227
+ "name": "markdown",
26228
+ "type": "boolean",
26229
+ "required": false,
26230
+ "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.",
26231
+ "default": false
26232
+ },
26133
26233
  {
26134
26234
  "name": "orientation",
26135
26235
  "type": "enum",
@@ -28219,19 +28319,19 @@
28219
28319
  },
28220
28320
  "border": {
28221
28321
  "light": "#ebedf3",
28222
- "dark": "#2a2f3a"
28322
+ "dark": "#3d4554"
28223
28323
  },
28224
28324
  "border-strong": {
28225
28325
  "light": "#c4cada",
28226
- "dark": "#3a414f"
28326
+ "dark": "#515b6e"
28227
28327
  },
28228
28328
  "border-subtle": {
28229
28329
  "light": "#f4f6f8",
28230
- "dark": "#2a2f3a80"
28330
+ "dark": "#3d455480"
28231
28331
  },
28232
28332
  "chart-1": {
28233
28333
  "light": "#4f46e5",
28234
- "dark": "#9590ef"
28334
+ "dark": "#aeaaf5"
28235
28335
  },
28236
28336
  "chart-2": {
28237
28337
  "light": "#eb6834",
@@ -28263,7 +28363,7 @@
28263
28363
  },
28264
28364
  "chart-axis": {
28265
28365
  "light": "#c4cada",
28266
- "dark": "#3a414f"
28366
+ "dark": "#515b6e"
28267
28367
  },
28268
28368
  "chart-diverging-high": {
28269
28369
  "light": "#2a78d6",
@@ -28279,7 +28379,7 @@
28279
28379
  },
28280
28380
  "chart-grid": {
28281
28381
  "light": "#ebedf3",
28282
- "dark": "#2a2f3a"
28382
+ "dark": "#3d4554"
28283
28383
  },
28284
28384
  "chart-label": {
28285
28385
  "light": "#626a82",
@@ -28355,23 +28455,23 @@
28355
28455
  },
28356
28456
  "field-border": {
28357
28457
  "light": "#dfe2ea",
28358
- "dark": "#2a2f3a"
28458
+ "dark": "#3d4554"
28359
28459
  },
28360
28460
  "field-border-focus": {
28361
28461
  "light": "#a5b4fc",
28362
- "dark": "#9590ef"
28462
+ "dark": "#aeaaf5"
28363
28463
  },
28364
28464
  "field-border-hover": {
28365
28465
  "light": "#c4cada",
28366
- "dark": "#3a414f"
28466
+ "dark": "#515b6e"
28367
28467
  },
28368
28468
  "focus-ring": {
28369
28469
  "light": "#4f46e5",
28370
- "dark": "#9590ef"
28470
+ "dark": "#aeaaf5"
28371
28471
  },
28372
28472
  "focus-ring-soft": {
28373
28473
  "light": "#4f46e540",
28374
- "dark": "#9590ef40"
28474
+ "dark": "#aeaaf540"
28375
28475
  },
28376
28476
  "info": {
28377
28477
  "light": "#056ee9",
@@ -28403,7 +28503,7 @@
28403
28503
  },
28404
28504
  "link": {
28405
28505
  "light": "#4f46e5",
28406
- "dark": "#9590ef"
28506
+ "dark": "#aeaaf5"
28407
28507
  },
28408
28508
  "neutral": {
28409
28509
  "light": "#07143714",
@@ -28487,11 +28587,11 @@
28487
28587
  },
28488
28588
  "primary": {
28489
28589
  "light": "#4f46e5",
28490
- "dark": "#9590ef"
28590
+ "dark": "#aeaaf5"
28491
28591
  },
28492
28592
  "primary-hover": {
28493
28593
  "light": "#4338ca",
28494
- "dark": "#a29df1"
28594
+ "dark": "#c3c0f8"
28495
28595
  },
28496
28596
  "primary-soft": {
28497
28597
  "light": "#e0e7ff",
@@ -28499,15 +28599,15 @@
28499
28599
  },
28500
28600
  "primary-text": {
28501
28601
  "light": "#4f46e5",
28502
- "dark": "#9590ef"
28602
+ "dark": "#aeaaf5"
28503
28603
  },
28504
28604
  "primary-wash": {
28505
28605
  "light": "#4f46e514",
28506
- "dark": "#9590ef14"
28606
+ "dark": "#aeaaf514"
28507
28607
  },
28508
28608
  "primary-wash-strong": {
28509
28609
  "light": "#4f46e533",
28510
- "dark": "#9590ef33"
28610
+ "dark": "#aeaaf533"
28511
28611
  },
28512
28612
  "progress-label": {
28513
28613
  "light": "#ffffff",
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "name": "webority-web",
3
- "version": "0.146.2",
3
+ "version": "0.148.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.146.2"
9
+ "version": "0.148.0"
10
10
  },
11
11
  "files": {
12
12
  "manifest.json": {
13
- "sha256": "2ba5d3a1f01b4686b36c0054d96f56e953f7430243ca9313fc543b4871df56a5",
14
- "bytes": 983608
13
+ "sha256": "ca51e1bbfda10ac1abf669292d210efc5e3cd133b29f223900842cc6377e39eb",
14
+ "bytes": 987853
15
15
  },
16
16
  "kit.js": {
17
- "sha256": "62d043120d96c6f006d12d53f1d7894a20ea6f99da21f336c53d22cfea73954e",
18
- "bytes": 11176046
17
+ "sha256": "337bd0913da462d198e5f03bbe813c99455cb612a0a8f15820f2b3b14db04b16",
18
+ "bytes": 11188258
19
19
  },
20
20
  "kit.css": {
21
21
  "sha256": "13b14f71fb6ea024945f95cba617b4f1d49f44a65ba7c7ed05d2354805539ef6",
@@ -1 +1 @@
1
- import{TONES as e}from"../lib/vocabulary.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppIcon.js";import r from"./assertValidValue.js";import i from"./warnUnknownProps.js";import{Fragment as a,jsx as o,jsxs as s}from"react/jsx-runtime";var c=[`soft`,`outline`,`solid`],l=[`sm`,`md`];function u(u){let{marker:d,props:f}=t(`AppChip`,u),{label:p,children:m,tone:h=`neutral`,variant:g=`soft`,size:_=`md`,leadingIcon:v,avatar:y,onRemove:b,onClick:x,disabled:S=!1,removeLabel:C,className:w=``,...T}=f;i(`AppChip`,T),r(`AppChip`,`tone`,h,e),r(`AppChip`,`variant`,g,c),r(`AppChip`,`size`,_,l);let E=p??m,D={},O={};for(let[e,t]of Object.entries(T))x&&(e.startsWith(`aria-`)||e.startsWith(`data-`))?D[e]=t:O[e]=t;let k=[`chip`,h&&h!==`neutral`?h:``,g===`outline`?`chip-outline`:g===`solid`?`chip-solid`:``,_===`sm`?`chip-sm`:``,x?`chip-clickable`:``,b?`chip-removable`:``,S?`is-disabled`:``,w].filter(Boolean).join(` `),A=y?/* @__PURE__ */ o(`span`,{className:`chip-avatar`,children:typeof y==`string`?/* @__PURE__ */ o(`img`,{src:y,alt:``}):y}):v?/* @__PURE__ */ o(`span`,{className:`chip-ic`,children:/* @__PURE__ */ o(n,{name:v,size:_===`sm`?12:14})}):null,j=x?/* @__PURE__ */ s(`button`,{type:`button`,className:`chip-body`,...D,onClick:x,disabled:S,children:[A,/* @__PURE__ */ o(`span`,{className:`chip-label`,children:E})]}):/* @__PURE__ */ s(a,{children:[A,/* @__PURE__ */ o(`span`,{className:`chip-label`,children:E})]});return/* @__PURE__ */ s(`span`,{className:k,...d,...O,children:[j,b&&/* @__PURE__ */ o(`button`,{type:`button`,className:`chip-remove`,onClick:b,disabled:S,"aria-label":C||(typeof E==`string`?`Remove ${E}`:`Remove`),children:/* @__PURE__ */ o(n,{name:`x`,size:_===`sm`?12:14})})]})}export{u as default};
1
+ import{TONES as e}from"../lib/vocabulary.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppIcon.js";import r from"./assertValidValue.js";import i from"./warnUnknownProps.js";import{Fragment as a,jsx as o,jsxs as s}from"react/jsx-runtime";var c=[`soft`,`outline`,`solid`],l=[`sm`,`md`];function u(u){let{marker:d,props:f}=t(`AppChip`,u),{label:p,children:m,tone:h=`neutral`,variant:g=`soft`,size:_=`md`,leadingIcon:v,avatar:y,onRemove:b,onClick:x,selected:S,count:C,disabled:w=!1,removeLabel:T,className:E=``,...D}=f;if(i(`AppChip`,D),r(`AppChip`,`tone`,h,e),r(`AppChip`,`variant`,g,c),r(`AppChip`,`size`,_,l),S!=null&&!x)throw RangeError(`[@webority/ui-react] <AppChip> received selected without onClick. Only a clickable chip can be the chosen filter: pass onClick, or omit selected.`);let O=p??m,k=C==null?null:/* @__PURE__ */ o(`span`,{className:`wui-chip-count`,children:C}),A={},j={};for(let[e,t]of Object.entries(D))x&&(e.startsWith(`aria-`)||e.startsWith(`data-`))?A[e]=t:j[e]=t;let M=[`chip`,h&&h!==`neutral`?h:``,g===`outline`?`chip-outline`:g===`solid`?`chip-solid`:``,_===`sm`?`chip-sm`:``,x?`chip-clickable`:``,b?`chip-removable`:``,w?`is-disabled`:``,E].filter(Boolean).join(` `),N=y?/* @__PURE__ */ o(`span`,{className:`chip-avatar`,children:typeof y==`string`?/* @__PURE__ */ o(`img`,{src:y,alt:``}):y}):v?/* @__PURE__ */ o(`span`,{className:`chip-ic`,children:/* @__PURE__ */ o(n,{name:v,size:_===`sm`?12:14})}):null,P=x?/* @__PURE__ */ s(`button`,{type:`button`,className:`chip-body`,"aria-pressed":S??void 0,...A,onClick:x,disabled:w,children:[N,/* @__PURE__ */ o(`span`,{className:`chip-label`,children:O}),k]}):/* @__PURE__ */ s(a,{children:[N,/* @__PURE__ */ o(`span`,{className:`chip-label`,children:O}),k]});return/* @__PURE__ */ s(`span`,{className:M,...d,...j,children:[P,b&&/* @__PURE__ */ o(`button`,{type:`button`,className:`chip-remove`,onClick:b,disabled:w,"aria-label":T||(typeof O==`string`?`Remove ${O}`:`Remove`),children:/* @__PURE__ */ o(n,{name:`x`,size:_===`sm`?12:14})})]})}export{u as default};
@@ -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{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{TONES as e}from"../lib/vocabulary.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppIcon.js";import r from"./AppSparkline.js";import i from"./assertValidValue.js";import a from"./renderIconProp.js";import o from"./warnUnknownProps.js";import{isValidElement as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";var u=[`plain`,`filled`,`accent`,`spotlight`],d=[`sm`,`md`,`lg`],f=e,p=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],m=[`up`,`down`,`flat`],h=e.filter(e=>[`success`,`danger`,`neutral`].includes(e)),g={success:` wui-kpi-delta--success`,danger:` wui-kpi-delta--danger`,neutral:` wui-kpi-delta--neutral`};function _(e){return e==null||typeof e==`boolean`?``:typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(_).join(``):s(e)?_(e.props?.children):``}function v(e){let t=_(e).trim();return t.startsWith(`+`)?`up`:t.startsWith(`-`)||t.startsWith(`−`)?`down`:`flat`}function y(e){let{marker:s,props:_}=t(`AppKpiTile`,e),{label:y,value:b,caption:x,icon:S,iconTone:C,iconVariant:w,delta:T,deltaDirection:E,deltaTone:D,sparkline:O,variant:k=`plain`,size:A=`md`,valueSize:j,inline:M=!1,attention:N=!1,href:P,linkComponent:F,className:I=``,style:L,iconClassName:R=``,labelClassName:z=``,valueClassName:B=``,captionClassName:V=``,deltaClassName:H=``,sparklineClassName:U=``,...W}=_;o(`AppKpiTile`,W),i(`AppKpiTile`,`variant`,k,u),i(`AppKpiTile`,`size`,A,d),i(`AppKpiTile`,`iconTone`,C,f),i(`AppKpiTile`,`iconVariant`,w,p),i(`AppKpiTile`,`deltaDirection`,E,m),i(`AppKpiTile`,`deltaTone`,D,h);let G=`kpi${M?` kpi-inline`:``}${k===`filled`?` kpi-filled`:k===`accent`?` kpi-accent`:k===`spotlight`?` kpi-spotlight`:``}${A===`lg`?` kpi-lg`:A===`sm`?` kpi-sm`:``}${N?` kpi-attention`:``}${I?` ${I}`:``}`,K=typeof j==`number`&&j>0?{...L,"--wui-kpi-value-size":`${j}px`}:L,q=E??v(T),J=q===`up`?`arrow-up`:q===`down`?`arrow-down`:null,Y=Object.hasOwn(g,D??``)?g[D]:``,X=P==null?`div`:F||`a`,Z=P==null?{}:F?{to:P}:{href:P};return/* @__PURE__ */ l(X,{className:G,style:K,...s,...W,...Z,children:[S&&/* @__PURE__ */ c(`span`,{className:`kpi-icon${C?` kpi-icon-${C}`:``}${R?` ${R}`:``}`,children:a(S,{size:20,variant:w})}),/* @__PURE__ */ c(`div`,{className:`kpi-label${z?` ${z}`:``}`,children:y}),/* @__PURE__ */ c(`div`,{className:`kpi-value${B?` ${B}`:``}`,children:b}),x&&/* @__PURE__ */ c(`div`,{className:`kpi-caption${V?` ${V}`:``}`,children:x}),T&&/* @__PURE__ */ l(`div`,{className:`kpi-delta${q===`flat`?``:` ${q}`}${Y}${H?` ${H}`:``}`,children:[J&&/* @__PURE__ */ c(n,{name:J,size:13}),T]}),O&&O.length>0&&/* @__PURE__ */ c(r,{data:O,className:`kpi-sparkline${U?` ${U}`:``}`})]})}export{y as default};
1
+ import{TONES as e}from"../lib/vocabulary.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppIcon.js";import r from"./AppSparkline.js";import i from"./assertValidValue.js";import a from"./renderIconProp.js";import o from"./warnUnknownProps.js";import{isValidElement as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";var u=[`plain`,`filled`,`accent`,`spotlight`],d=[`sm`,`md`,`lg`],f=e,p=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],m=[`up`,`down`,`flat`],h=e.filter(e=>[`success`,`danger`,`neutral`].includes(e)),g={success:` wui-kpi-delta--success`,danger:` wui-kpi-delta--danger`,neutral:` wui-kpi-delta--neutral`};function _(e){return e==null||typeof e==`boolean`?``:typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(_).join(``):s(e)?_(e.props?.children):``}function v(e){let t=_(e).trim();return t.startsWith(`+`)?`up`:t.startsWith(`-`)||t.startsWith(`−`)?`down`:`flat`}function y(e){let{marker:s,props:_}=t(`AppKpiTile`,e),{label:y,value:b,caption:x,icon:S,iconTone:C,iconVariant:w=`twotone`,delta:T,deltaDirection:E,deltaTone:D,sparkline:O,variant:k=`plain`,size:A=`md`,valueSize:j,inline:M=!1,attention:N=!1,href:P,linkComponent:F,className:I=``,style:L,iconClassName:R=``,labelClassName:z=``,valueClassName:B=``,captionClassName:V=``,deltaClassName:H=``,sparklineClassName:U=``,...W}=_;o(`AppKpiTile`,W),i(`AppKpiTile`,`variant`,k,u),i(`AppKpiTile`,`size`,A,d),i(`AppKpiTile`,`iconTone`,C,f),i(`AppKpiTile`,`iconVariant`,w,p),i(`AppKpiTile`,`deltaDirection`,E,m),i(`AppKpiTile`,`deltaTone`,D,h);let G=`kpi${M?` kpi-inline`:``}${k===`filled`?` kpi-filled`:k===`accent`?` kpi-accent`:k===`spotlight`?` kpi-spotlight`:``}${A===`lg`?` kpi-lg`:A===`sm`?` kpi-sm`:``}${N?` kpi-attention`:``}${I?` ${I}`:``}`,K=typeof j==`number`&&j>0?{...L,"--wui-kpi-value-size":`${j}px`}:L,q=E??v(T),J=q===`up`?`arrow-up`:q===`down`?`arrow-down`:null,Y=Object.hasOwn(g,D??``)?g[D]:``,X=P==null?`div`:F||`a`,Z=P==null?{}:F?{to:P}:{href:P};return/* @__PURE__ */ l(X,{className:G,style:K,...s,...W,...Z,children:[S&&/* @__PURE__ */ c(`span`,{className:`kpi-icon${C?` kpi-icon-${C}`:``}${R?` ${R}`:``}`,children:a(S,{size:20,variant:w})}),/* @__PURE__ */ c(`div`,{className:`kpi-label${z?` ${z}`:``}`,children:y}),/* @__PURE__ */ c(`div`,{className:`kpi-value${B?` ${B}`:``}`,children:b}),x&&/* @__PURE__ */ c(`div`,{className:`kpi-caption${V?` ${V}`:``}`,children:x}),T&&/* @__PURE__ */ l(`div`,{className:`kpi-delta${q===`flat`?``:` ${q}`}${Y}${H?` ${H}`:``}`,children:[J&&/* @__PURE__ */ c(n,{name:J,size:13}),T]}),O&&O.length>0&&/* @__PURE__ */ c(r,{data:O,className:`kpi-sparkline${U?` ${U}`:``}`})]})}export{y 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};