@webority/ui-react 0.102.3 → 0.104.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.102.3"
5
+ "version": "0.104.0"
6
6
  },
7
7
  "rendererProtocolVersion": 12,
8
8
  "platform": "Web",
@@ -170,6 +170,17 @@
170
170
  "description": "A destructive tint.",
171
171
  "default": false
172
172
  },
173
+ {
174
+ "name": "density",
175
+ "type": "enum",
176
+ "enum": [
177
+ "comfortable",
178
+ "compact"
179
+ ],
180
+ "required": false,
181
+ "description": "How much room surrounds the glyph: comfortable keeps an 8px ring, compact 4px (a 16px glyph in a 24px disc).",
182
+ "default": "comfortable"
183
+ },
173
184
  {
174
185
  "name": "disabled",
175
186
  "type": "boolean",
@@ -216,6 +227,13 @@
216
227
  "description": "Allows several files. File mode only.",
217
228
  "default": false
218
229
  },
230
+ {
231
+ "name": "neutral",
232
+ "type": "boolean",
233
+ "required": false,
234
+ "description": "Muted ink with a muted surface on hover, for an action on a card or a quiet surface. Not with danger.",
235
+ "default": false
236
+ },
219
237
  {
220
238
  "name": "shortcut",
221
239
  "type": "string",
@@ -3383,6 +3401,15 @@
3383
3401
  "type": "string",
3384
3402
  "required": false,
3385
3403
  "description": "The form field name, sent with the value on submit."
3404
+ },
3405
+ {
3406
+ "name": "shape",
3407
+ "type": "enum",
3408
+ "enum": [
3409
+ "circle"
3410
+ ],
3411
+ "required": false,
3412
+ "description": "circle draws a round box with the tick inside, for a task that is completed. Omit it for the square box."
3386
3413
  }
3387
3414
  ],
3388
3415
  "itemsTakeAction": [],
@@ -3895,6 +3922,15 @@
3895
3922
  "required": true,
3896
3923
  "description": "Shared form name. Cards with the same name form one group."
3897
3924
  },
3925
+ {
3926
+ "name": "selectedStyle",
3927
+ "type": "enum",
3928
+ "enum": [
3929
+ "filled"
3930
+ ],
3931
+ "required": false,
3932
+ "description": "`filled` fills the checked card's icon disc with the primary colour and draws the glyph in the on-primary colour. Unset keeps the soft selected look."
3933
+ },
3898
3934
  {
3899
3935
  "name": "size",
3900
3936
  "type": "enum",
@@ -4167,6 +4203,17 @@
4167
4203
  "type": "string",
4168
4204
  "required": false,
4169
4205
  "description": "The value this chip submits when selected."
4206
+ },
4207
+ {
4208
+ "name": "variant",
4209
+ "type": "enum",
4210
+ "enum": [
4211
+ "soft",
4212
+ "solid"
4213
+ ],
4214
+ "required": false,
4215
+ "description": "Checked look: a soft primary tint (soft) or a primary fill with a translucent count (solid).",
4216
+ "default": "soft"
4170
4217
  }
4171
4218
  ],
4172
4219
  "itemsTakeAction": [],
@@ -4930,6 +4977,20 @@
4930
4977
  "marker": "AppCommentThread",
4931
4978
  "acceptsChildren": false,
4932
4979
  "props": [
4980
+ {
4981
+ "name": "allowReactions",
4982
+ "type": "boolean",
4983
+ "required": false,
4984
+ "description": "False leaves out the reaction panel and the reaction chips.",
4985
+ "default": true
4986
+ },
4987
+ {
4988
+ "name": "allowReplies",
4989
+ "type": "boolean",
4990
+ "required": false,
4991
+ "description": "False leaves out the Reply action and the reply box; existing replies still show.",
4992
+ "default": true
4993
+ },
4933
4994
  {
4934
4995
  "name": "className",
4935
4996
  "type": "string",
@@ -5136,6 +5197,12 @@
5136
5197
  "description": "Top-level comments, oldest first.",
5137
5198
  "default": []
5138
5199
  },
5200
+ {
5201
+ "name": "composerPlaceholder",
5202
+ "type": "string",
5203
+ "required": false,
5204
+ "description": "The composer box's placeholder. Without it the standard placeholder asks for a comment and names @ mentions."
5205
+ },
5139
5206
  {
5140
5207
  "name": "id",
5141
5208
  "type": "string",
@@ -7596,6 +7663,18 @@
7596
7663
  "required": false,
7597
7664
  "description": "Marks the row as destructive."
7598
7665
  },
7666
+ {
7667
+ "name": "disabled",
7668
+ "type": "boolean",
7669
+ "required": false,
7670
+ "description": "Shows the row greyed out. It stays focusable and cannot be chosen, and renders no link."
7671
+ },
7672
+ {
7673
+ "name": "disabledReason",
7674
+ "type": "string",
7675
+ "required": false,
7676
+ "description": "Why the row is disabled. Shown as a tooltip on hover and focus, and read by screen readers. Needs disabled."
7677
+ },
7599
7678
  {
7600
7679
  "name": "divider",
7601
7680
  "type": "boolean",
@@ -7674,6 +7753,17 @@
7674
7753
  "description": "Class for the menu panel.",
7675
7754
  "default": ""
7676
7755
  },
7756
+ {
7757
+ "name": "menuWidth",
7758
+ "type": "enum",
7759
+ "enum": [
7760
+ "lg",
7761
+ "md",
7762
+ "sm"
7763
+ ],
7764
+ "required": false,
7765
+ "description": "A fixed menu width (15, 20 or 25rem); long rows wrap instead of widening the menu. Unset, the menu fits its rows."
7766
+ },
7677
7767
  {
7678
7768
  "name": "show",
7679
7769
  "type": "boolean",
@@ -7686,6 +7776,15 @@
7686
7776
  "required": false,
7687
7777
  "description": "Class for the toggle button, replacing the default toggle look."
7688
7778
  },
7779
+ {
7780
+ "name": "toggleVariant",
7781
+ "type": "enum",
7782
+ "enum": [
7783
+ "neutral"
7784
+ ],
7785
+ "required": false,
7786
+ "description": "neutral: a custom trigger that keeps the surrounding font and colour, with a muted fill on hover and while open. Needs trigger."
7787
+ },
7689
7788
  {
7690
7789
  "name": "trigger",
7691
7790
  "type": "node",
@@ -12027,6 +12126,13 @@
12027
12126
  "required": false,
12028
12127
  "description": "The accessible name when the title is not plain text, or when the header is hidden."
12029
12128
  },
12129
+ {
12130
+ "name": "backLabel",
12131
+ "type": "string",
12132
+ "required": false,
12133
+ "description": "The accessible name of the back arrow shown when onBack is set.",
12134
+ "default": "Back"
12135
+ },
12030
12136
  {
12031
12137
  "name": "confirmDiscard",
12032
12138
  "type": "string",
@@ -17637,6 +17743,13 @@
17637
17743
  "required": false,
17638
17744
  "description": "Disables the control."
17639
17745
  },
17746
+ {
17747
+ "name": "emptyText",
17748
+ "type": "string",
17749
+ "required": false,
17750
+ "description": "Text shown in the menu when a search matches nothing.",
17751
+ "default": "No matches"
17752
+ },
17640
17753
  {
17641
17754
  "name": "error",
17642
17755
  "type": "string",
@@ -18332,6 +18445,13 @@
18332
18445
  "description": "Compact sets the content's top padding to 12px.",
18333
18446
  "default": "comfortable"
18334
18447
  },
18448
+ {
18449
+ "name": "foldedCookie",
18450
+ "type": "string",
18451
+ "required": false,
18452
+ "description": "The cookie that remembers the folded collapsible groups, as their keys joined by dots.",
18453
+ "default": "wui-nav-folded"
18454
+ },
18335
18455
  {
18336
18456
  "name": "footer",
18337
18457
  "type": "node",
@@ -18348,6 +18468,13 @@
18348
18468
  "required": false,
18349
18469
  "description": "A node rendered right after the group's links, such as an add-a-space row. It is hidden on the collapsed rail and shown in the drawer."
18350
18470
  },
18471
+ {
18472
+ "name": "collapsible",
18473
+ "type": "boolean",
18474
+ "required": false,
18475
+ "description": "Folds the group from its heading. Its folded state is remembered in a cookie (foldedCookie).",
18476
+ "default": false
18477
+ },
18351
18478
  {
18352
18479
  "name": "items",
18353
18480
  "type": "array",
@@ -18387,6 +18514,12 @@
18387
18514
  "required": false,
18388
18515
  "description": "Sub-items. The row becomes an expandable parent."
18389
18516
  },
18517
+ {
18518
+ "name": "header",
18519
+ "type": "string",
18520
+ "required": false,
18521
+ "description": "A sub-heading row inside the group, drawn with no link. Shown only while a link follows it."
18522
+ },
18390
18523
  {
18391
18524
  "name": "href",
18392
18525
  "type": "url",
@@ -18428,8 +18561,8 @@
18428
18561
  {
18429
18562
  "name": "label",
18430
18563
  "type": "string",
18431
- "required": true,
18432
- "description": "The visible label of the row."
18564
+ "required": false,
18565
+ "description": "The visible label of the row. Every row but a header row has one."
18433
18566
  },
18434
18567
  {
18435
18568
  "name": "match",
@@ -18447,6 +18580,12 @@
18447
18580
  "required": false,
18448
18581
  "description": "Extra path prefixes that also make this row the current page."
18449
18582
  },
18583
+ {
18584
+ "name": "newUntil",
18585
+ "type": "string",
18586
+ "required": false,
18587
+ "description": "An ISO date (yyyy-MM-dd, India time). A green New pill shows after the label through that day, and none after it."
18588
+ },
18450
18589
  {
18451
18590
  "name": "tab",
18452
18591
  "type": "boolean",
@@ -18469,6 +18608,12 @@
18469
18608
  "required": true,
18470
18609
  "description": "The nav rows of the group."
18471
18610
  },
18611
+ {
18612
+ "name": "key",
18613
+ "type": "string",
18614
+ "required": false,
18615
+ "description": "A stable name for the group. Needed with collapsible; lower-case letters, digits and hyphens."
18616
+ },
18472
18617
  {
18473
18618
  "name": "label",
18474
18619
  "type": "string",
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "name": "webority-web",
3
- "version": "0.102.3",
3
+ "version": "0.104.0",
4
4
  "platform": "Web",
5
5
  "kitModuleVersion": 2,
6
6
  "rendererProtocolVersion": 12,
7
7
  "library": {
8
8
  "name": "@webority/ui-react",
9
- "version": "0.102.3"
9
+ "version": "0.104.0"
10
10
  },
11
11
  "files": {
12
12
  "manifest.json": {
13
- "sha256": "de065a2042e59a8c8fc00a368e4b0d08e48654324c6721c2b7f6d20dade8cb00",
14
- "bytes": 850905
13
+ "sha256": "ee6d9ab29a478006f9701c05a0e03602cb719c78ef751a7be69abd31c051dbfc",
14
+ "bytes": 856258
15
15
  },
16
16
  "kit.js": {
17
- "sha256": "e759d6a89ee9e3a9ec2cc6644436c3327a99da23a3944ec0a9cde6ac794e813b",
18
- "bytes": 10876977
17
+ "sha256": "e082fb70728ca3e5e60d1cf29a875a4e7514745756812c506e9b5bda62ccda36",
18
+ "bytes": 10887627
19
19
  },
20
20
  "kit.css": {
21
21
  "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
@@ -1 +1 @@
1
- import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import{devWarn as t}from"../lib/devWarn.js";import n from"./warnInvalidValue.js";import r from"./warnUnknownProps.js";import{shortcutAria as i}from"../lib/shortcutChip.js";import a from"./withTooltip.js";import o from"./renderIconProp.js";import{useRef as s}from"react";import{Fragment as c,jsx as l,jsxs as u}from"react/jsx-runtime";var d=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`];function f(f){let{icon:p,iconVariant:m,label:h,tooltipPlacement:g=`auto`,shortcut:_,danger:v=!1,disabled:y=!1,size:b=20,onClick:x,className:S=``,as:C,href:w,accept:T,multiple:E=!1,onFiles:D,...O}=f,k=Number(b),A=Number.isFinite(k)&&k>0?k:20;b!==void 0&&!(Number.isFinite(k)&&k>0)&&t(`AppActionIcon: size must be a positive number of px.`),r(`AppActionIcon`,C===void 0?O:{...O,as:C}),n(`AppActionIcon`,`iconVariant`,m,d);let j=typeof D==`function`;j&&(C!==void 0||w!==void 0)&&t(`AppActionIcon: file mode renders a button; href and as are ignored.`),!j&&(T!==void 0||E)&&t(`AppActionIcon: accept and multiple apply only in file mode (pass onFiles).`);let M=s(null),N=e=>{let t=[...e.target.files];e.target.value=``,t.length>0&&D(t)},P=[`u-action`,v?`danger`:``,S].filter(Boolean).join(` `),{style:F,...I}=O,L={"--wui-action-size":`${A+16}px`,...F},R=j?`button`:C??(w?`a`:`button`),z=R===`button`,B=a(l(R,{type:z?`button`:void 0,href:z||y?void 0:w,className:P,style:L,"aria-label":h,"aria-keyshortcuts":i(_),disabled:z?y:void 0,"aria-disabled":!z&&y?`true`:void 0,role:!z&&y?`link`:void 0,tabIndex:!z&&y?-1:void 0,onClick:e=>{if(y){e.preventDefault(),e.stopPropagation();return}x?.(e),j&&!e.defaultPrevented&&M.current?.click()},...e(`AppActionIcon`,f),...I,children:o(p,{size:A,variant:m})}),h,g,_);return j?u(c,{children:[B,l(`input`,{type:`file`,ref:M,className:`wui-action-icon-file`,hidden:!0,tabIndex:-1,"aria-hidden":`true`,accept:T,multiple:E,onChange:N,onClick:e=>e.stopPropagation()})]}):B}export{f as default};
1
+ import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import{devWarn as t}from"../lib/devWarn.js";import n from"./warnInvalidValue.js";import r from"./warnUnknownProps.js";import{shortcutAria as i}from"../lib/shortcutChip.js";import a from"./withTooltip.js";import o from"./renderIconProp.js";import{useRef as s}from"react";import{Fragment as c,jsx as l,jsxs as u}from"react/jsx-runtime";var d=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],f=[`comfortable`,`compact`];function p(p){let{icon:m,iconVariant:h,label:g,tooltipPlacement:_=`auto`,shortcut:v,danger:y=!1,density:b=`comfortable`,neutral:x=!1,disabled:S=!1,size:C=20,onClick:w,className:T=``,as:E,href:D,accept:O,multiple:k=!1,onFiles:A,...j}=p,M=Number(C),N=Number.isFinite(M)&&M>0?M:20;C!==void 0&&!(Number.isFinite(M)&&M>0)&&t(`AppActionIcon: size must be a positive number of px.`),r(`AppActionIcon`,E===void 0?j:{...j,as:E}),n(`AppActionIcon`,`iconVariant`,h,d),n(`AppActionIcon`,`density`,b,f),y&&x&&t(`AppActionIcon: danger and neutral are exclusive; danger wins.`);let P=typeof A==`function`;P&&(E!==void 0||D!==void 0)&&t(`AppActionIcon: file mode renders a button; href and as are ignored.`),!P&&(O!==void 0||k)&&t(`AppActionIcon: accept and multiple apply only in file mode (pass onFiles).`);let F=s(null),I=e=>{let t=[...e.target.files];e.target.value=``,t.length>0&&A(t)},L=[`u-action`,y?`danger`:``,x&&!y?`neutral`:``,T].filter(Boolean).join(` `),{style:R,...z}=j,B={"--wui-action-size":`${N+(b===`compact`?8:16)}px`,...R},V=P?`button`:E??(D?`a`:`button`),H=V===`button`,U=a(l(V,{type:H?`button`:void 0,href:H||S?void 0:D,className:L,style:B,"aria-label":g,"aria-keyshortcuts":i(v),disabled:H?S:void 0,"aria-disabled":!H&&S?`true`:void 0,role:!H&&S?`link`:void 0,tabIndex:!H&&S?-1:void 0,onClick:e=>{if(S){e.preventDefault(),e.stopPropagation();return}w?.(e),P&&!e.defaultPrevented&&F.current?.click()},...e(`AppActionIcon`,p),...z,children:o(m,{size:N,variant:h})}),g,_,v);return P?u(c,{children:[U,l(`input`,{type:`file`,ref:F,className:`wui-action-icon-file`,hidden:!0,tabIndex:-1,"aria-hidden":`true`,accept:O,multiple:k,onChange:I,onClick:e=>e.stopPropagation()})]}):U}export{p as default};
@@ -1 +1 @@
1
- import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnUnknownProps.js";import n from"../lib/CheckField.js";import{forwardRef as r}from"react";import{jsx as i}from"react/jsx-runtime";var a=r(function(r,a){let{label:o,id:s,name:c,error:l,hint:u,className:d=``,...f}=r;return t(`AppCheckbox`,f),i(n,{rootProps:e(`AppCheckbox`,r),ref:a,label:o,id:s,name:c,error:l,hint:u,className:d,rest:f,inputType:`checkbox`,wrapperClass:`form-check`})});export{a as default};
1
+ import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"../lib/CheckField.js";import{forwardRef as i}from"react";import{jsx as a}from"react/jsx-runtime";var o=[`circle`],s=i(function(i,s){let{label:c,id:l,name:u,error:d,hint:f,shape:p,className:m=``,...h}=i;n(`AppCheckbox`,h),t(`AppCheckbox`,`shape`,p,o);let g=p===`circle`?`form-check form-check-circle`:`form-check`;return a(r,{rootProps:e(`AppCheckbox`,i),ref:s,label:c,id:l,name:u,error:d,hint:f,className:m,rest:h,inputType:`checkbox`,wrapperClass:g})});export{s as default};
@@ -1 +1 @@
1
- import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"./AppIcon.js";import{Fragment as i,jsx as a,jsxs as o}from"react/jsx-runtime";var s={sm:` wui-struct-card-sm`,md:``,lg:` wui-struct-card-lg`},c={inline:``,stacked:` wui-struct-card-stacked`},l={sm:16,md:18,lg:22};function u(u){let{name:d,multiple:f=!1,value:p,checked:m,onChange:h,icon:g,iconNode:_,iconSize:v,image:y,imageAlt:b=``,children:x,title:S,description:C,checkIcon:w=`check`,checkSize:T=18,hideCheck:E=!1,disabled:D=!1,size:O=`md`,layout:k=`inline`,className:A=``,...j}=u;n(`AppChoiceCard`,j),t(`AppChoiceCard`,`size`,O,Object.keys(s)),t(`AppChoiceCard`,`layout`,k,Object.keys(c));let M=s[O]??``,N=c[k]??``,P=v??l[O]??l.md;return o(`label`,{className:`struct-card${y?` struct-card-img-card`:``}${M}${N}${E?` wui-struct-card-no-check`:``}${m?` checked`:``}${A?` ${A}`:``}`,"aria-disabled":D||void 0,...e(`AppChoiceCard`,u),...j,children:[a(`input`,{type:f?`checkbox`:`radio`,name:d,value:p,className:`struct-card-input`,checked:m,onChange:h,disabled:D}),y?a(`span`,{className:`struct-card-media`,children:a(`img`,{className:`struct-card-img`,src:y,alt:b})}):_||g?a(`span`,{className:`struct-card-ic`,children:_||a(r,{name:g,size:P,variant:m?`bold`:void 0})}):null,a(`span`,{className:`struct-card-body`,children:x||o(i,{children:[S&&a(`span`,{className:`struct-card-title`,children:S}),C&&a(`span`,{className:`struct-card-desc`,children:C})]})}),!E&&a(`span`,{className:`struct-card-check`,children:a(r,{name:w,size:T})})]})}export{u as default};
1
+ import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"./AppIcon.js";import{Fragment as i,jsx as a,jsxs as o}from"react/jsx-runtime";var s={sm:` wui-struct-card-sm`,md:``,lg:` wui-struct-card-lg`},c={inline:``,stacked:` wui-struct-card-stacked`},l={filled:` wui-struct-card-filled`},u={sm:16,md:18,lg:22};function d(d){let{name:f,multiple:p=!1,value:m,checked:h,onChange:g,icon:_,iconNode:v,iconSize:y,image:b,imageAlt:x=``,children:S,title:C,description:w,checkIcon:T=`check`,checkSize:E=18,hideCheck:D=!1,disabled:O=!1,size:k=`md`,layout:A=`inline`,selectedStyle:j,className:M=``,...N}=d;n(`AppChoiceCard`,N),t(`AppChoiceCard`,`size`,k,Object.keys(s)),t(`AppChoiceCard`,`layout`,A,Object.keys(c)),t(`AppChoiceCard`,`selectedStyle`,j,Object.keys(l));let P=s[k]??``,F=c[A]??``,I=l[j]??``,L=y??u[k]??u.md;return o(`label`,{className:`struct-card${b?` struct-card-img-card`:``}${P}${F}${I}${D?` wui-struct-card-no-check`:``}${M?` ${M}`:``}`,"aria-disabled":O||void 0,...e(`AppChoiceCard`,d),...N,children:[a(`input`,{type:p?`checkbox`:`radio`,name:f,value:m,className:`struct-card-input`,checked:h,onChange:g,disabled:O}),b?a(`span`,{className:`struct-card-media`,children:a(`img`,{className:`struct-card-img`,src:b,alt:x})}):v||_?a(`span`,{className:`struct-card-ic`,children:v||o(i,{children:[a(`span`,{className:`wui-struct-card-glyph`,children:a(r,{name:_,size:L})}),a(`span`,{className:`wui-struct-card-glyph-on`,children:a(r,{name:_,size:L,variant:`bold`})})]})}):null,a(`span`,{className:`struct-card-body`,children:S||o(i,{children:[C&&a(`span`,{className:`struct-card-title`,children:C}),w&&a(`span`,{className:`struct-card-desc`,children:w})]})}),!D&&a(`span`,{className:`struct-card-check`,children:a(r,{name:T,size:E})})]})}export{d as default};
@@ -1 +1 @@
1
- import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import{jsx as r,jsxs as i}from"react/jsx-runtime";var a=[`sm`,`md`,`lg`];function o(o){let{multiple:s=!0,label:c,name:l,value:u,checked:d,onChange:f,children:p,count:m,size:h=`md`,disabled:g=!1,className:_=``,...v}=o;return n(`AppChoiceChip`,v),t(`AppChoiceChip`,`size`,h,a),i(`label`,{className:`choice-chip${d?` checked`:``}${h===`sm`?` choice-chip-sm`:h===`lg`?` choice-chip-lg`:``}${_?` ${_}`:``}`,...e(`AppChoiceChip`,o),...v,children:[r(`input`,{type:s?`checkbox`:`radio`,name:l,value:u,checked:d,disabled:g,onChange:f}),r(`span`,{children:c??p}),m!=null&&r(`span`,{className:`count`,children:m})]})}export{o as default};
1
+ import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import{jsx as r,jsxs as i}from"react/jsx-runtime";var a=[`sm`,`md`,`lg`],o=[`soft`,`solid`];function s(s){let{multiple:c=!0,label:l,name:u,value:d,checked:f,onChange:p,children:m,count:h,size:g=`md`,variant:_=`soft`,disabled:v=!1,className:y=``,...b}=s;return n(`AppChoiceChip`,b),t(`AppChoiceChip`,`size`,g,a),t(`AppChoiceChip`,`variant`,_,o),i(`label`,{className:`choice-chip${f?` checked`:``}${g===`sm`?` choice-chip-sm`:g===`lg`?` choice-chip-lg`:``}${_===`solid`?` wui-choice-chip-solid`:``}${y?` ${y}`:``}`,...e(`AppChoiceChip`,s),...b,children:[r(`input`,{type:c?`checkbox`:`radio`,name:u,value:d,checked:f,disabled:v,onChange:p}),r(`span`,{children:l??m}),h!=null&&r(`span`,{className:`count`,children:h})]})}export{s as default};
@@ -1 +1 @@
1
- import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnUnknownProps.js";import n from"./AppIcon.js";import{initialsOf as r}from"../lib/initials.js";import{parseMentionValue as i}from"@webority/ui-elements/elements/mention-input";import{formatDate as a,formatNumber as o,toInstant as s}from"@webority/ui-elements/helpers";import{Fragment as c,useEffect as l,useId as u,useRef as d}from"react";import{jsx as f,jsxs as p}from"react/jsx-runtime";import{COMMENT_REACTIONS as m,COMMENT_TEXT as h}from"@webority/ui-elements/elements/comment-thread";function g(n){let{comments:r=[],onPost:i,onReply:a,onEdit:o,onDelete:s,onReact:c,people:g,loadPeople:v,reactionChoices:y,readOnly:b=!1,label:x=h.listName,id:S,className:C=``,...w}=n;t(`AppCommentThread`,w);let T=u(),E=S||`comment-thread-${T.replace(/[^a-zA-Z0-9_-]/g,``)}`,D=d(null),O=typeof v==`function`,k=y?.length?y:m,A=d(null);return A.current={onPost:i,onReply:a,onEdit:o,onDelete:s,onReact:c,loadPeople:v},l(()=>{let e=D.current;if(e)return e.submit=async({intent:e,commentId:t,parentId:n,body:r,emoji:i})=>{let a=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}},[]),l(()=>{let e=D.current;!e||O||(e.people=g||[])},[g,O]),l(()=>{let e=D.current;if(!e||!O)return;let t=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 A.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)},[O]),p(`wui-comment-thread`,{ref:D,id:E,class:C?`wui-comment-thread ${C}`:`wui-comment-thread`,controlled:``,"read-only":b?``:void 0,remote:O?``:void 0,"reaction-choices":y?.length?y.join(` `):void 0,...e(`AppCommentThread`,n),...w,children:[f(`div`,{className:`wui-comment-items`,"data-wui-items":``,children:r.length?f(`ol`,{className:`wui-comment-list`,"aria-label":x,children:r.map(e=>f(_,{comment:e,topLevel:!0,readOnly:b},e.id))}):f(`p`,{className:`wui-comment-empty`,children:h.empty})}),!b&&f(`div`,{className:`wui-reaction-picker`,role:`group`,"aria-label":h.pickerName,"data-wui-picker":``,hidden:!0,children:k.map(e=>f(`button`,{type:`button`,className:`wui-reaction-choice`,"data-wui-emoji":e,children:e},e))}),!b&&p(`div`,{className:`wui-comment-composer`,"data-wui-composer":``,children:[f(`wui-mention-input`,{id:`${E}-new`,class:`wui-mention-input`,label:h.composerLabel,placeholder:h.composerPlaceholder,rows:`3`,remote:O?``:void 0}),f(`div`,{className:`wui-comment-form-actions`,children:f(`button`,{type:`button`,className:`btn btn-primary btn-sm`,"data-wui-action":`post`,children:h.post})}),f(`div`,{className:`wui-comment-error`,"data-wui-error":``,hidden:!0})]}),f(`span`,{className:`visually-hidden`,"data-wui-live":``,"aria-live":`polite`,"aria-atomic":`true`})]})}function _({comment:e,topLevel:t=!1,readOnly:l}){let{id:u,author:d,at:m,value:g,edited:v,deleted:y,canEdit:b,canDelete:x,reactions:S=[],replies:C=[]}=e,w=d?.name||``,T=s(m),E=!l&&!y&&b,D=!l&&!y&&x;return p(`li`,{className:`wui-comment`,"data-wui-comment":u,"data-value":g??``,"data-wui-deleted":y?``:void 0,children:[p(`div`,{className:`wui-comment-row`,children:[p(`span`,{className:`avatar avatar-sm wui-comment-avatar`,"aria-hidden":`true`,children:[f(`span`,{className:`avatar-face`,children:r(w)||`?`}),d?.src&&f(`img`,{className:`avatar-img`,src:d.src,alt:``,onError:e=>{e.currentTarget.hidden=!0}})]}),p(`div`,{className:`wui-comment-main`,children:[p(`div`,{className:`wui-comment-head`,children:[f(`span`,{className:`wui-comment-author`,children:w}),f(`time`,{className:`wui-comment-time`,dateTime:Number.isFinite(T)?new Date(T).toISOString():void 0,children:a(m,{pattern:`datetime`})}),v&&!y&&f(`span`,{className:`wui-comment-edited`,children:h.edited})]}),y?f(`div`,{className:`wui-comment-text wui-comment-text-deleted`,children:h.deleted}):f(`div`,{className:`wui-comment-text`,"data-wui-text":``,children:i(g).map((e,t)=>`text`in e?f(c,{children:e.text},t):p(`span`,{className:`wui-mention`,"data-mention-id":e.id,children:[`@`,e.label]},t))}),E&&f(`div`,{className:`wui-comment-editor`,"data-wui-editor":``,hidden:!0}),!y&&(S.length>0||!l)&&p(`div`,{className:`wui-comment-reactions`,role:`group`,"aria-label":h.reactions,children:[S.map(e=>l?p(`span`,{className:e.mine?`wui-reaction wui-reaction-mine`:`wui-reaction`,children:[f(`span`,{className:`wui-reaction-emoji`,children:e.emoji}),f(`span`,{className:`wui-reaction-count`,children:o(e.count,{decimals:0})})]},e.emoji):p(`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:[f(`span`,{className:`wui-reaction-emoji`,children:e.emoji}),f(`span`,{className:`wui-reaction-count`,children:o(e.count,{decimals:0})})]},e.emoji)),!l&&f(`button`,{type:`button`,className:`wui-reaction-add`,"data-wui-action":`react-menu`,"aria-label":h.addReaction,"aria-haspopup":`true`,"aria-expanded":`false`,children:f(n,{name:`emoji-smile`,size:16})})]}),!l&&!y&&(t||E||D)&&p(`div`,{className:`wui-comment-actions`,"data-wui-actions":``,children:[t&&f(`button`,{type:`button`,className:`wui-comment-action`,"data-wui-action":`reply`,children:h.reply}),E&&f(`button`,{type:`button`,className:`wui-comment-action`,"data-wui-action":`edit`,children:h.edit}),D&&f(`button`,{type:`button`,className:`wui-comment-action`,"data-wui-action":`delete`,children:h.delete})]}),D&&p(`div`,{className:`wui-comment-confirm`,"data-wui-confirm":``,hidden:!0,children:[f(`span`,{className:`wui-comment-confirm-text`,children:h.confirmDelete}),f(`button`,{type:`button`,className:`btn btn-danger btn-sm`,"data-wui-action":`confirm-delete`,children:h.delete}),f(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,"data-wui-action":`cancel-delete`,children:h.cancel})]}),!l&&f(`div`,{className:`wui-comment-error`,"data-wui-error":``,hidden:!0})]})]}),t&&C.length>0&&f(`ol`,{className:`wui-comment-list wui-comment-replies`,"aria-label":h.repliesName(w),children:C.map(e=>f(_,{comment:e,readOnly:l},e.id))}),t&&!l&&!y&&f(`div`,{className:`wui-comment-reply`,"data-wui-reply":``,hidden:!0})]})}export{g as default};
1
+ import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnUnknownProps.js";import n from"./AppIcon.js";import{initialsOf as r}from"../lib/initials.js";import{parseMentionValue as i}from"@webority/ui-elements/elements/mention-input";import{formatDate as a,formatNumber as o,toInstant as s}from"@webority/ui-elements/helpers";import{Fragment as c,useEffect as l,useId as u,useRef as d}from"react";import{jsx as f,jsxs as p}from"react/jsx-runtime";import{COMMENT_REACTIONS as m,COMMENT_TEXT as h}from"@webority/ui-elements/elements/comment-thread";function g(n){let{comments:r=[],onPost:i,onReply:a,onEdit:o,onDelete:s,onReact:c,people:g,loadPeople:v,reactionChoices:y,allowReplies:b=!0,allowReactions:x=!0,composerPlaceholder:S,readOnly:C=!1,label:w=h.listName,id:T,className:E=``,...D}=n;t(`AppCommentThread`,D);let O=u(),k=T||`comment-thread-${O.replace(/[^a-zA-Z0-9_-]/g,``)}`,A=d(null),j=typeof v==`function`,M=y?.length?y:m,N=d(null);return N.current={onPost:i,onReply:a,onEdit:o,onDelete:s,onReact:c,loadPeople:v},l(()=>{let e=A.current;if(e)return e.submit=async({intent:e,commentId:t,parentId:n,body:r,emoji:i})=>{let a=N.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}},[]),l(()=>{let e=A.current;!e||j||(e.people=g||[])},[g,j]),l(()=>{let e=A.current;if(!e||!j)return;let t=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 N.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)},[j]),p(`wui-comment-thread`,{ref:A,id:k,class:E?`wui-comment-thread ${E}`:`wui-comment-thread`,controlled:``,"read-only":C?``:void 0,remote:j?``:void 0,"reaction-choices":y?.length?y.join(` `):void 0,"no-replies":b?void 0:``,"no-reactions":x?void 0:``,"composer-placeholder":S,...e(`AppCommentThread`,n),...D,children:[f(`div`,{className:`wui-comment-items`,"data-wui-items":``,children:r.length?f(`ol`,{className:`wui-comment-list`,"aria-label":w,children:r.map(e=>f(_,{comment:e,topLevel:!0,readOnly:C,allowReplies:b,allowReactions:x},e.id))}):f(`p`,{className:`wui-comment-empty`,children:h.empty})}),!C&&x&&f(`div`,{className:`wui-reaction-picker`,role:`group`,"aria-label":h.pickerName,"data-wui-picker":``,hidden:!0,children:M.map(e=>f(`button`,{type:`button`,className:`wui-reaction-choice`,"data-wui-emoji":e,children:e},e))}),!C&&p(`div`,{className:`wui-comment-composer`,"data-wui-composer":``,children:[f(`wui-mention-input`,{id:`${k}-new`,class:`wui-mention-input`,label:h.composerLabel,placeholder:S??h.composerPlaceholder,rows:`3`,remote:j?``:void 0}),f(`div`,{className:`wui-comment-form-actions`,children:f(`button`,{type:`button`,className:`btn btn-primary btn-sm`,"data-wui-action":`post`,children:h.post})}),f(`div`,{className:`wui-comment-error`,"data-wui-error":``,hidden:!0})]}),f(`span`,{className:`visually-hidden`,"data-wui-live":``,"aria-live":`polite`,"aria-atomic":`true`})]})}function _({comment:e,topLevel:t=!1,readOnly:l,allowReplies:u,allowReactions:d}){let{id:m,author:g,at:v,value:y,edited:b,deleted:x,canEdit:S,canDelete:C,reactions:w=[],replies:T=[]}=e,E=g?.name||``,D=s(v),O=!l&&!x&&S,k=!l&&!x&&C,A=t&&u;return p(`li`,{className:`wui-comment`,"data-wui-comment":m,"data-value":y??``,"data-wui-deleted":x?``:void 0,children:[p(`div`,{className:`wui-comment-row`,children:[p(`span`,{className:`avatar avatar-sm wui-comment-avatar`,"aria-hidden":`true`,children:[f(`span`,{className:`avatar-face`,children:r(E)||`?`}),g?.src&&f(`img`,{className:`avatar-img`,src:g.src,alt:``,onError:e=>{e.currentTarget.hidden=!0}})]}),p(`div`,{className:`wui-comment-main`,children:[p(`div`,{className:`wui-comment-head`,children:[f(`span`,{className:`wui-comment-author`,children:E}),f(`time`,{className:`wui-comment-time`,dateTime:Number.isFinite(D)?new Date(D).toISOString():void 0,children:a(v,{pattern:`datetime`})}),b&&!x&&f(`span`,{className:`wui-comment-edited`,children:h.edited})]}),x?f(`div`,{className:`wui-comment-text wui-comment-text-deleted`,children:h.deleted}):f(`div`,{className:`wui-comment-text`,"data-wui-text":``,children:i(y).map((e,t)=>`text`in e?f(c,{children:e.text},t):p(`span`,{className:`wui-mention`,"data-mention-id":e.id,children:[`@`,e.label]},t))}),O&&f(`div`,{className:`wui-comment-editor`,"data-wui-editor":``,hidden:!0}),d&&!x&&(w.length>0||!l)&&p(`div`,{className:`wui-comment-reactions`,role:`group`,"aria-label":h.reactions,children:[w.map(e=>l?p(`span`,{className:e.mine?`wui-reaction wui-reaction-mine`:`wui-reaction`,children:[f(`span`,{className:`wui-reaction-emoji`,children:e.emoji}),f(`span`,{className:`wui-reaction-count`,children:o(e.count,{decimals:0})})]},e.emoji):p(`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:[f(`span`,{className:`wui-reaction-emoji`,children:e.emoji}),f(`span`,{className:`wui-reaction-count`,children:o(e.count,{decimals:0})})]},e.emoji)),!l&&f(`button`,{type:`button`,className:`wui-reaction-add`,"data-wui-action":`react-menu`,"aria-label":h.addReaction,"aria-haspopup":`true`,"aria-expanded":`false`,children:f(n,{name:`emoji-smile`,size:16})})]}),!l&&!x&&(A||O||k)&&p(`div`,{className:`wui-comment-actions`,"data-wui-actions":``,children:[A&&f(`button`,{type:`button`,className:`wui-comment-action`,"data-wui-action":`reply`,children:h.reply}),O&&f(`button`,{type:`button`,className:`wui-comment-action`,"data-wui-action":`edit`,children:h.edit}),k&&f(`button`,{type:`button`,className:`wui-comment-action`,"data-wui-action":`delete`,children:h.delete})]}),k&&p(`div`,{className:`wui-comment-confirm`,"data-wui-confirm":``,hidden:!0,children:[f(`span`,{className:`wui-comment-confirm-text`,children:h.confirmDelete}),f(`button`,{type:`button`,className:`btn btn-danger btn-sm`,"data-wui-action":`confirm-delete`,children:h.delete}),f(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,"data-wui-action":`cancel-delete`,children:h.cancel})]}),!l&&f(`div`,{className:`wui-comment-error`,"data-wui-error":``,hidden:!0})]})]}),t&&T.length>0&&f(`ol`,{className:`wui-comment-list wui-comment-replies`,"aria-label":h.repliesName(E),children:T.map(e=>f(_,{comment:e,readOnly:l,allowReactions:d},e.id))}),A&&!l&&!x&&f(`div`,{className:`wui-comment-reply`,"data-wui-reply":``,hidden:!0})]})}export{g as default};
@@ -1 +1 @@
1
- import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import{devWarn as t}from"../lib/devWarn.js";import n from"./warnInvalidValue.js";import r from"./warnUnknownProps.js";import{shortcutAria as i,shortcutChip as a}from"../lib/shortcutChip.js";import o from"./AppIcon.js";import s from"./renderIconProp.js";import{forwardRef as c,useEffect as l,useRef as u,useState as d}from"react";import{Dropdown as f}from"react-bootstrap";import{jsx as p,jsxs as m}from"react/jsx-runtime";var h=[`sm`,`md`,`lg`,`xl`],g=!1;function _(){let e=!0;try{e=process.env.NODE_ENV!==`production`}catch{e=!0}!e||g||(g=!0,t("[@webority/ui-react] <AppDropdown> icon-only toggle has no accessible name — pass `label` or `ariaLabel`."))}function v(t){let{icon:o,iconSize:c,toggleClassName:g,label:v,ariaLabel:b,align:x=`end`,items:S=[],menuClassName:C=``,linkComponent:w,children:T,trigger:E,show:D,onToggle:O,...k}=t;r(`AppDropdown`,k);for(let e of S)n(`AppDropdown`,`items[].hiddenFrom`,e.hiddenFrom,h);!E&&!b&&!v&&_();let A=g??(E?`wui-dropdown-trigger`:`topbar-icon-btn`),j=D!==void 0,[M,N]=d(!1),P=j?!!D:M,F=u(null);F.current=(e,t)=>{j||N(e),O?.(e,t)};let I=u(null);return l(()=>{if(!P)return;let e=I.current?.getBoundingClientRect(),t=()=>{let t=I.current?.getBoundingClientRect();(!e||!t||Math.abs(t.top-e.top)>2||Math.abs(t.left-e.left)>2)&&F.current(!1,{source:`scroll`})},n=()=>F.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)}},[P]),m(f,{ref:I,align:x,show:P,onToggle:(e,t)=>F.current(e,t),...e(`AppDropdown`,t),...k,children:[p(f.Toggle,{as:y,icon:o,iconSize:c,btnClassName:A,trigger:E,title:v,"aria-label":b??(E?void 0:v)}),p(f.Menu,{className:C,renderOnMount:!0,popperConfig:{strategy:`fixed`},children:T??S.map(e=>{if(e.header!=null)return p(`div`,{className:`dropdown-header`,children:e.header},e.key);if(e.divider)return p(f.Divider,{},e.key);let t=e.to?w?{as:w,to:e.to}:{as:`a`,href:e.to}:{as:`button`,type:`button`},n=[e.danger&&`danger`,h.includes(e.hiddenFrom)&&`wui-hidden-from-${e.hiddenFrom}`].filter(Boolean).join(` `)||void 0;return m(f.Item,{...t,onClick:e.onClick,className:n,"aria-keyshortcuts":i(e.shortcut),children:[e.image?p(`img`,{src:e.image,alt:``}):s(e.icon,{size:16}),e.label,a(e.shortcut)]},e.key)})})]})}var y=c(function({icon:e,iconSize:t=20,btnClassName:n=`topbar-icon-btn`,trigger:r,"aria-label":i,className:a,...s},c){return p(`button`,{ref:c,type:`button`,className:n,"aria-label":i,...s,children:r??p(o,{name:e,size:t})})});export{v as default};
1
+ import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import{devWarn as t}from"../lib/devWarn.js";import n from"./warnInvalidValue.js";import r from"./warnUnknownProps.js";import{shortcutAria as i,shortcutChip as a}from"../lib/shortcutChip.js";import o from"./withTooltip.js";import s from"./AppIcon.js";import c from"./renderIconProp.js";import{Fragment as l,forwardRef as u,useEffect as d,useRef as f,useState as p}from"react";import{Dropdown as m}from"react-bootstrap";import{jsx as h,jsxs as g}from"react/jsx-runtime";var _=[`sm`,`md`,`lg`,`xl`],v=[`neutral`],y=[`sm`,`md`,`lg`],b=e=>{e.preventDefault(),e.stopPropagation()},x=u(function(e,t){return h(`button`,{...e,ref:t,"aria-disabled":`true`})}),S=!1;function C(){let e=!0;try{e=process.env.NODE_ENV!==`production`}catch{e=!0}!e||S||(S=!0,t("[@webority/ui-react] <AppDropdown> icon-only toggle has no accessible name — pass `label` or `ariaLabel`."))}function w(s){let{icon:u,iconSize:S,toggleClassName:w,toggleVariant:E,menuWidth:D,label:O,ariaLabel:k,align:A=`end`,items:j=[],menuClassName:M=``,linkComponent:N,children:P,trigger:F,show:I,onToggle:L,...R}=s;r(`AppDropdown`,R);for(let e of j)n(`AppDropdown`,`items[].hiddenFrom`,e.hiddenFrom,_);!F&&!k&&!O&&C(),n(`AppDropdown`,`toggleVariant`,E,v),n(`AppDropdown`,`menuWidth`,D,y),E&&!F&&t(`AppDropdown: toggleVariant needs a trigger; the icon toggle ignores it.`);let z=(w??(F?`wui-dropdown-trigger`:`topbar-icon-btn`))+(F&&E===`neutral`?` wui-dropdown-trigger-neutral`:``),B=[M,y.includes(D)?`wui-dropdown-menu-${D}`:``].filter(Boolean).join(` `),V=I!==void 0,[H,U]=p(!1),W=V?!!I:H,G=f(null);G.current=(e,t)=>{V||U(e),L?.(e,t)};let K=f(null);return d(()=>{if(!W)return;let e=K.current?.getBoundingClientRect(),t=()=>{let t=K.current?.getBoundingClientRect();(!e||!t||Math.abs(t.top-e.top)>2||Math.abs(t.left-e.left)>2)&&G.current(!1,{source:`scroll`})},n=()=>G.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)}},[W]),g(m,{ref:K,align:A,show:W,onToggle:(e,t)=>G.current(e,t),...e(`AppDropdown`,s),...R,children:[h(m.Toggle,{as:T,icon:u,iconSize:S,btnClassName:z,trigger:F,title:O,"aria-label":k??(F?void 0:O)}),h(m.Menu,{className:B,renderOnMount:!0,popperConfig:{strategy:`fixed`},children:P??j.map(e=>{if(e.header!=null)return h(`div`,{className:`dropdown-header`,children:e.header},e.key);if(e.divider)return h(m.Divider,{},e.key);if(e.disabled)return h(l,{children:o(g(m.Item,{as:x,type:`button`,className:[e.danger&&`danger`,`wui-dropdown-item-disabled`].filter(Boolean).join(` `),onClick:b,children:[e.image?h(`img`,{src:e.image,alt:``}):c(e.icon,{size:16}),e.label,e.disabledReason&&g(`span`,{className:`visually-hidden wui-dropdown-item-reason`,children:[`: `,e.disabledReason]})]}),e.disabledReason,`auto`)},e.key);let t=e.to?N?{as:N,to:e.to}:{as:`a`,href:e.to}:{as:`button`,type:`button`},n=[e.danger&&`danger`,_.includes(e.hiddenFrom)&&`wui-hidden-from-${e.hiddenFrom}`].filter(Boolean).join(` `)||void 0;return g(m.Item,{...t,onClick:e.onClick,className:n,"aria-keyshortcuts":i(e.shortcut),children:[e.image?h(`img`,{src:e.image,alt:``}):c(e.icon,{size:16}),e.label,a(e.shortcut)]},e.key)})})]})}var T=u(function({icon:e,iconSize:t=20,btnClassName:n=`topbar-icon-btn`,trigger:r,"aria-label":i,className:a,...o},c){return h(`button`,{ref:c,type:`button`,className:n,"aria-label":i,...o,children:r??h(s,{name:e,size:t})})});export{w as default};
@@ -1 +1 @@
1
- import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import{devWarn as t}from"../lib/devWarn.js";import n from"./warnInvalidValue.js";import r from"./warnUnknownProps.js";import i from"./AppIcon.js";import a from"../lib/DiscardPrompt.js";import{useCallback as o,useEffect as s,useRef as c,useState as l}from"react";import{Modal as u}from"react-bootstrap";import{jsx as d,jsxs as f}from"react/jsx-runtime";var p=[`default`,`danger`,`success`,`warning`],m=[`center`,`top`],h=`a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])`,g={sm:380,md:440,lg:640,xl:880},ee=`wui-modal-fullscreen`,_=!1;function v(){let e=!0;try{e=process.env.NODE_ENV!==`production`}catch{e=!0}!e||_||(_=!0,t("[@webority/ui-react] <AppModal hideHeader> has no accessible name — pass `ariaLabel` (or a string `title`)."))}function y(e,t){if(e.key!==`Tab`)return;let n=Array.from(t.querySelectorAll(h));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 te(){let e=[];for(let t of document.body.children)t.hasAttribute(`inert`)||t.matches(`.modal, .modal-backdrop`)||(t.setAttribute(`inert`,``),e.push(t));return e}function b(t){let{open:_,eyebrow:b,title:x,subtitle:S,headerIcon:C,tone:w=`default`,dismissible:T=!0,onClose:E,footer:D,size:O=`md`,placement:k=`center`,hideHeader:A=!1,staticBackdrop:j=!1,confirmDiscard:M,dirty:N=!1,ariaLabel:P,className:F=``,children:I,"data-canvas":ne,...L}=t;r(`AppModal`,L),n(`AppModal`,`tone`,w,p),n(`AppModal`,`placement`,k,m),n(`AppModal`,`size`,typeof O==`string`?O:null,[...Object.keys(g),`fullscreen`]);let{style:R,ref:z,"data-wui":B,"data-wui-props":V,...H}=L,U=B?{"data-wui":B,"data-wui-props":V}:e(`AppModal`,t),W=U[`data-wui`],G=U[`data-wui-props`];A&&!P&&typeof x!=`string`&&v();let K=c(null),q=c(null),[J,Y]=l(!1);s(()=>{_||Y(!1)},[_]),s(()=>{J&&q.current?.focus()},[J]),s(()=>{let e=K.current?.closest(`.modal`);e&&(M?e.setAttribute(`confirm-discard`,M):e.removeAttribute(`confirm-discard`))},[_,M]);let X=c(null),Z=o(e=>{X.current=e,typeof z==`function`?z(e):z&&(z.current=e)},[z]);s(()=>{let e=X.current?.dialog;e&&(e.setAttribute(`data-wui`,W),G===void 0?e.removeAttribute(`data-wui-props`):e.setAttribute(`data-wui-props`,G))},[_,W,G]),s(()=>{if(!_)return;let e=K.current?.closest(`.modal-content`);if(!e)return;let t=()=>Array.from(e.querySelectorAll(h));(e.querySelector(`[data-autofocus]`)||t().find(e=>!e.classList.contains(`wui-modal-close`))||t()[0]||e).focus?.();let n=e.closest(`.modal`),r=te(),i=e=>y(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)}},[_]);let Q=()=>{if(M&&N){Y(!0);return}E?.()},re=()=>{Y(!1),E?.()},ie=()=>{Y(!1),(K.current?.querySelector(`input:not([type="hidden"]):not([disabled]),select:not([disabled]),textarea:not([disabled])`))?.focus()},$=O===`fullscreen`,ae=typeof O==`number`?O:g[O]??g.md,oe=[`wui-modal`,w==="default"?``:`tone-${w}`,F].filter(Boolean).join(` `);return f(u,{...H,ref:Z,show:_,onHide:Q,backdrop:!j||`static`,keyboard:!j,autoFocus:!1,enforceFocus:!0,restoreFocus:!0,centered:k!==`top`,className:$?`wui-modal-shell ${ee}`:`wui-modal-shell`,style:$?R:{"--wui-modal-max-width":`${ae}px`,...R},dialogClassName:`wui-rb-dialog`,contentClassName:oe,backdropClassName:`wui-modal-dim`,"aria-label":P||(typeof x==`string`?x:void 0),children:[!A&&f(`div`,{className:`wui-modal-header`,children:[f(`div`,{className:`wui-modal-heading`,children:[C&&d(`span`,{className:`wui-modal-headicon`,children:d(i,{name:C,size:18})}),f(`div`,{className:`wui-modal-headtext`,children:[b&&d(`div`,{className:`wui-modal-eyebrow`,children:b}),d(`div`,{className:`wui-modal-title`,children:x}),S&&d(`div`,{className:`wui-modal-subtitle`,children:S})]})]}),T&&d(`button`,{type:`button`,className:`wui-modal-close`,onClick:Q,"aria-label":`Close`,children: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:d(`path`,{d:`M18 6 6 18M6 6l12 12`})})})]}),d(`div`,{className:`wui-modal-body`,ref:K,children:I}),(D||J)&&f(`div`,{className:J?`wui-modal-footer wui-drawer-discarding`:`wui-modal-footer`,children:[J&&d(a,{text:M,confirmRef:q,onDiscard:re,onKeep:ie}),D]})]})}export{b as default};
1
+ import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import{devWarn as t}from"../lib/devWarn.js";import n from"./warnInvalidValue.js";import r from"./warnUnknownProps.js";import i from"./AppIcon.js";import a from"../lib/DiscardPrompt.js";import{useCallback as o,useEffect as s,useRef as c,useState as ee}from"react";import{Modal as l}from"react-bootstrap";import{jsx as u,jsxs as d}from"react/jsx-runtime";var te=[`default`,`danger`,`success`,`warning`],f=[`center`,`top`],p=`a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])`,m={sm:380,md:440,lg:640,xl:880},h=`wui-modal-fullscreen`,g=!1;function _(){let 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 v(e,t){if(e.key!==`Tab`)return;let n=Array.from(t.querySelectorAll(p));if(!n.length){e.preventDefault(),t.focus();return}let r=n[0],i=n[n.length-1],a=document.activeElement;e.shiftKey&&(a===r||a===t)?(e.preventDefault(),i.focus()):!e.shiftKey&&a===i&&(e.preventDefault(),r.focus())}function y(){let e=[];for(let t of document.body.children)t.hasAttribute(`inert`)||t.matches(`.modal, .modal-backdrop`)||(t.setAttribute(`inert`,``),e.push(t));return e}function b(t){let{open:g,eyebrow:b,title:x,subtitle:S,headerIcon:C,tone:w=`default`,dismissible:T=!0,onClose:E,onBack:D,backLabel:O=`Back`,footer:k,size:A=`md`,placement:j=`center`,hideHeader:M=!1,staticBackdrop:N=!1,confirmDiscard:P,dirty:F=!1,ariaLabel:I,className:ne=``,children:re,"data-canvas":ie,...L}=t;r(`AppModal`,L),n(`AppModal`,`tone`,w,te),n(`AppModal`,`placement`,j,f),n(`AppModal`,`size`,typeof A==`string`?A:null,[...Object.keys(m),`fullscreen`]);let{style:R,ref:z,"data-wui":B,"data-wui-props":V,...H}=L,U=B?{"data-wui":B,"data-wui-props":V}:e(`AppModal`,t),W=U[`data-wui`],G=U[`data-wui-props`];M&&!I&&typeof x!=`string`&&_();let K=c(null),q=c(null),[J,Y]=ee(!1);s(()=>{g||Y(!1)},[g]),s(()=>{J&&q.current?.focus()},[J]),s(()=>{let e=K.current?.closest(`.modal`);e&&(P?e.setAttribute(`confirm-discard`,P):e.removeAttribute(`confirm-discard`))},[g,P]);let X=c(null),ae=o(e=>{X.current=e,typeof z==`function`?z(e):z&&(z.current=e)},[z]);s(()=>{let e=X.current?.dialog;e&&(e.setAttribute(`data-wui`,W),G===void 0?e.removeAttribute(`data-wui-props`):e.setAttribute(`data-wui-props`,G))},[g,W,G]),s(()=>{if(!g)return;let e=K.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?.();let n=e.closest(`.modal`),r=y(),i=e=>v(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)}},[g]);let Z=()=>{if(P&&F){Y(!0);return}E?.()},Q=()=>{Y(!1),E?.()},oe=()=>{Y(!1),(K.current?.querySelector(`input:not([type="hidden"]):not([disabled]),select:not([disabled]),textarea:not([disabled])`))?.focus()},$=A===`fullscreen`,se=typeof A==`number`?A:m[A]??m.md,ce=[`wui-modal`,w==="default"?``:`tone-${w}`,ne].filter(Boolean).join(` `);return d(l,{...H,ref:ae,show:g,onHide:Z,backdrop:!N||`static`,keyboard:!N,autoFocus:!1,enforceFocus:!0,restoreFocus:!0,centered:j!==`top`,className:$?`wui-modal-shell ${h}`:`wui-modal-shell`,style:$?R:{"--wui-modal-max-width":`${se}px`,...R},dialogClassName:`wui-rb-dialog`,contentClassName:ce,backdropClassName:`wui-modal-dim`,"aria-label":I||(typeof x==`string`?x:void 0),children:[!M&&d(`div`,{className:`wui-modal-header`,children:[D&&u(`button`,{type:`button`,className:`wui-modal-back`,onClick:D,"aria-label":O,children:u(i,{name:`arrow-left`,size:18})}),d(`div`,{className:`wui-modal-heading`,children:[C&&u(`span`,{className:`wui-modal-headicon`,children:u(i,{name:C,size:18})}),d(`div`,{className:`wui-modal-headtext`,children:[b&&u(`div`,{className:`wui-modal-eyebrow`,children:b}),u(`div`,{className:`wui-modal-title`,children:x}),S&&u(`div`,{className:`wui-modal-subtitle`,children:S})]})]}),T&&u(`button`,{type:`button`,className:`wui-modal-close`,onClick:Z,"aria-label":`Close`,children: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:u(`path`,{d:`M18 6 6 18M6 6l12 12`})})})]}),u(`div`,{className:`wui-modal-body`,ref:K,children:re}),(k||J)&&d(`div`,{className:J?`wui-modal-footer wui-drawer-discarding`:`wui-modal-footer`,children:[J&&u(a,{text:P,confirmRef:q,onDiscard:Q,onKeep:oe}),k]})]})}export{b as default};
@@ -1 +1 @@
1
- import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import ee from"../lib/FieldMessage.js";import r from"./AppInfoTip.js";import i from"./AppRequiredMark.js";import a from"./useNodeLabels.js";import o,{optionsEqual as s}from"./useWuiControl.js";import{forwardRef as c,useId as te,useLayoutEffect as ne,useRef as re}from"react";import{Fragment as l,jsx as u,jsxs as d}from"react/jsx-runtime";import"@webority/ui-elements/elements/select";var f=[`sm`,`lg`,`xl`],p=[`off`,`border`,`above`],m=(e,t)=>({value:e.value,label:t,icon:e.icon}),h=c(function(c,h){let{value:g,onChange:_,options:v=[],placeholder:ie=`Select...`,searchPlaceholder:ae=`Search...`,searchable:oe=!1,clearable:se=!1,size:y,icon:ce,prefix:b,suffix:x,floatingLabel:S=`off`,disabled:C,open:w,label:T,required:E=!1,error:D,hint:O,help:k,helpLabel:A=`More information`,id:j,name:M,className:N=``,fieldClassName:P=``,"aria-label":F,"aria-labelledby":I,"aria-describedby":L,"data-canvas":le,...R}=c;n(`AppSelect`,R),t(`AppSelect`,`size`,y,f),t(`AppSelect`,`floatingLabel`,S,p);let z=te(),{setRef:B,innerRef:V}=o({ref:h,value:g??``,onChange:_}),{portal:H,toElementOptions:U}=a(v),W=re({el:null,options:null,map:null});ne(()=>{let e=V.current;if(!e||W.current.el===e&&W.current.options===v&&W.current.map===U)return;W.current={el:e,options:v,map:U};let t=U(v,m);s(t,e.options)||(e.options=t)});let G=j||z,K=S!==`off`&&T,q=D&&G?`${G}-error`:void 0,J=O&&G?`${G}-hint`:void 0,ue=q||J||L,Y=!K&&(b!=null||x!=null),X=!T&&!D&&!O,Z=e(`AppSelect`,c),Q=d(l,{children:[u(`wui-select`,{"aria-label":F||(typeof T==`string`?T:void 0),"aria-labelledby":I||void 0,"aria-describedby":ue||void 0,"aria-invalid":D?`true`:void 0,ref:B,value:g||void 0,id:G,name:M,placeholder:S!==`off`&&T?` `:ie,"search-placeholder":ae,searchable:oe?``:void 0,clearable:se?``:void 0,size:y||void 0,icon:ce||void 0,disabled:C?``:void 0,open:w?``:void 0,required:E?``:void 0,className:N||void 0,...X&&!Y?Z:null,...R}),H]}),$=Y?d(`div`,{...X?Z:null,className:`input-affixed`,children:[b!=null&&u(`span`,{className:`affix affix-pre`,children:b}),Q,x!=null&&u(`span`,{className:`affix affix-suf`,children:x})]}):Q;if(X)return $;let de=[`field`,P].filter(Boolean).join(` `);return d(`div`,{...Z,className:de,children:[T&&!K&&d(`label`,{className:`label`,htmlFor:G,children:[T,E&&u(i,{}),k&&u(r,{label:A,children:k})]}),K?d(`div`,{className:S===`above`?`field-float wui-float-above`:`field-float`,children:[Q,d(`label`,{className:`float-label`,htmlFor:G,children:[T,E&&u(i,{})]})]}):$,u(ee,{error:D,hint:O,errorId:q,hintId:J})]})});export{h as default};
1
+ import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import ee from"../lib/FieldMessage.js";import r from"./AppInfoTip.js";import i from"./AppRequiredMark.js";import a from"./useNodeLabels.js";import o,{optionsEqual as s}from"./useWuiControl.js";import{forwardRef as c,useId as te,useLayoutEffect as ne,useRef as l}from"react";import{Fragment as u,jsx as d,jsxs as f}from"react/jsx-runtime";import"@webority/ui-elements/elements/select";var re=[`sm`,`lg`,`xl`],ie=[`off`,`border`,`above`],p=(e,t)=>({value:e.value,label:t,icon:e.icon}),m=c(function(c,m){let{value:h,onChange:g,options:_=[],placeholder:v=`Select...`,searchPlaceholder:ae=`Search...`,emptyText:oe,searchable:se=!1,clearable:ce=!1,size:y,icon:le,prefix:b,suffix:x,floatingLabel:S=`off`,disabled:C,open:w,label:T,required:E=!1,error:D,hint:O,help:k,helpLabel:A=`More information`,id:j,name:M,className:N=``,fieldClassName:P=``,"aria-label":F,"aria-labelledby":I,"aria-describedby":ue,"data-canvas":de,...L}=c;n(`AppSelect`,L),t(`AppSelect`,`size`,y,re),t(`AppSelect`,`floatingLabel`,S,ie);let R=te(),{setRef:z,innerRef:B}=o({ref:m,value:h??``,onChange:g}),{portal:V,toElementOptions:H}=a(_),U=l({el:null,options:null,map:null});ne(()=>{let e=B.current;if(!e||U.current.el===e&&U.current.options===_&&U.current.map===H)return;U.current={el:e,options:_,map:H};let t=H(_,p);s(t,e.options)||(e.options=t)});let W=j||R,G=S!==`off`&&T,K=D&&W?`${W}-error`:void 0,q=O&&W?`${W}-hint`:void 0,J=K||q||ue,Y=!G&&(b!=null||x!=null),X=!T&&!D&&!O,Z=e(`AppSelect`,c),Q=f(u,{children:[d(`wui-select`,{"aria-label":F||(typeof T==`string`?T:void 0),"aria-labelledby":I||void 0,"aria-describedby":J||void 0,"aria-invalid":D?`true`:void 0,ref:z,value:h||void 0,id:W,name:M,placeholder:S!==`off`&&T?` `:v,"search-placeholder":ae,"empty-text":oe||void 0,searchable:se?``:void 0,clearable:ce?``:void 0,size:y||void 0,icon:le||void 0,disabled:C?``:void 0,open:w?``:void 0,required:E?``:void 0,className:N||void 0,...X&&!Y?Z:null,...L}),V]}),$=Y?f(`div`,{...X?Z:null,className:`input-affixed`,children:[b!=null&&d(`span`,{className:`affix affix-pre`,children:b}),Q,x!=null&&d(`span`,{className:`affix affix-suf`,children:x})]}):Q;if(X)return $;let fe=[`field`,P].filter(Boolean).join(` `);return f(`div`,{...Z,className:fe,children:[T&&!G&&f(`label`,{className:`label`,htmlFor:W,children:[T,E&&d(i,{}),k&&d(r,{label:A,children:k})]}),G?f(`div`,{className:S===`above`?`field-float wui-float-above`:`field-float`,children:[Q,f(`label`,{className:`float-label`,htmlFor:W,children:[T,E&&d(i,{})]})]}):$,d(ee,{error:D,hint:O,errorId:K,hintId:q})]})});export{m as default};
@@ -1 +1 @@
1
- import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"./AppIcon.js";import i from"./AppAvatar.js";import{navMatchScore as a}from"../lib/navMatch.js";import{readShellCollapsed as o,writeShellCollapsed as s}from"../lib/shellCookie.js";import{initScrollEdges as c}from"@webority/ui-elements/helpers";import{useEffect as l,useId as u,useMemo as d,useRef as f,useState as p}from"react";import{Fragment as m,jsx as h,jsxs as g}from"react/jsx-runtime";var _=99,v=4,y=5,b=[`prefix`,`exact`],x=[`comfortable`,`compact`],S=[`default`,`primary`],C=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],w=new Set([`key`,`label`,`icon`,`iconVariant`,`iconSize`,`href`,`badge`,`badgeTone`,`badgeTitle`,`trailingIcon`,`active`,`match`,`matchAlso`,`tab`,`tabLabel`,`children`]),T=e=>e>_?`${_}+`:String(e);function E(i){let{groups:a=[],brand:u,sidebarStart:m,sidebarStartCompact:_,sidebarFooter:v,topbarStart:y,topbarEnd:b,footer:w,launcher:T,children:E,collapsed:O,onCollapsedChange:j,noSidebar:N=!1,density:F=`comfortable`,itemHeight:I,iconVariant:L,topbarTone:R=`default`,navLabel:ne=`Main navigation`,linkComponent:z,currentPath:B,rememberCollapsed:V=!1,collapsedCookie:H=`wui-shell-collapsed`,tabBarLabel:re=`Quick navigation`,moreLabel:ie=`More`,userMenu:U,notifications:W,search:G,className:ae=``,style:K,...q}=i;n(`AppShell`,q),t(`AppShell`,`density`,F,x),t(`AppShell`,`topbarTone`,R,S),t(`AppShell`,`iconVariant`,L,C);let oe=I>0?{...K,"--wui-nav-item-height":`${I}px`}:K,[se,ce]=p(()=>V&&O===void 0&&typeof document<`u`?o(H)??!1:!1),[J,Y]=p(!1),[le,ue]=p(!1),[de,fe]=p(!1),X=f(null),Z=O??se,pe=()=>{let e=!Z;O===void 0&&ce(e),V&&s(e,H),j?.(e)},Q=d(()=>D(a,B),[a,B]),$=N?null:k(Q);return l(()=>{let e=()=>ue(window.scrollY>4);return e(),window.addEventListener(`scroll`,e,{passive:!0}),()=>window.removeEventListener(`scroll`,e)},[]),l(()=>{c()},[]),l(()=>{let e=X.current,t=e?.querySelector(`.app-nav-item[aria-current="page"]`);if(!e||!t)return;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();n.top<r.top?e.scrollTop-=r.top-n.top:n.bottom>r.bottom&&(e.scrollTop+=n.bottom-r.bottom)},[]),l(()=>{let e=X.current;if(!e)return;let t=()=>fe(e.scrollHeight>e.clientHeight);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[Q]),l(()=>{if(!J)return;let e=e=>{e.key===`Escape`&&Y(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[J]),g(`div`,{className:[`app-shell`,Z?`collapsed`:``,N?`no-sidebar`:``,J?`mobile-open`:``,ae].filter(Boolean).join(` `),"data-density":F===`compact`?`compact`:void 0,style:oe,...e(`AppShell`,i),...q,children:[h(`a`,{className:`wui-skip-link`,href:`#main-content`,children:`Skip to content`}),g(`aside`,{className:`app-sidebar`,children:[u&&h(`div`,{className:`app-sidebar-brand`,children:u}),m&&h(`div`,{className:`app-sidebar-start`,children:m}),_&&h(`div`,{className:`app-sidebar-start-compact`,children:_}),h(`nav`,{className:`app-sidebar-scroll`,"aria-label":ne,ref:X,tabIndex:de?0:void 0,children:Q.map((e,t)=>g(`div`,{className:`app-nav-group`,children:[e.label&&h(`div`,{className:`app-nav-group-label`,children:e.label}),e.items.map(e=>h(M,{item:e,linkComponent:z,onNavigate:()=>Y(!1),iconVariant:L},e.key??e.href??e.label)),e.after&&h(`div`,{className:`wui-nav-group-after`,children:e.after})]},e.label??`group-${t}`))}),v&&h(`div`,{className:`app-sidebar-foot`,children:v}),!N&&h(`button`,{type:`button`,className:`app-sidebar-toggle`,onClick:pe,"aria-label":Z?`Expand navigation`:`Collapse navigation`,"aria-expanded":!Z,children:h(r,{name:`chevrons-left`,size:20})})]}),g(`div`,{className:`app-main`,children:[g(`header`,{className:`app-topbar${le?` scrolled`:``}`,"data-tone":R===`primary`?`primary`:void 0,children:[g(`div`,{className:`app-topbar-start`,children:[h(`button`,{type:`button`,className:`app-topbar-menu`,onClick:()=>Y(!0),"aria-label":`Open navigation`,"aria-expanded":J,children:h(r,{name:`menu`,size:18})}),y,G&&h(te,{config:G})]}),g(`div`,{className:`app-topbar-end`,children:[b,W&&h(ee,{config:W}),U&&h(P,{config:U,linkComponent:z})]})]}),h(`main`,{className:`app-content`,id:`main-content`,children:E}),w&&h(`footer`,{className:`app-footer`,children:w})]}),T&&h(`div`,{className:`wui-shell-launcher`,children:T}),$&&g(`nav`,{className:`wui-tabbar`,"aria-label":re,children:[$.tabs.map(e=>h(A,{tab:e,linkComponent:z,iconVariant:L},e.key??e.href)),$.hasMore&&g(`button`,{type:`button`,className:`wui-tabbar-item${$.moreActive?` active`:``}`,onClick:()=>Y(!0),children:[h(`span`,{className:`wui-tabbar-icon`,children:h(r,{name:`more`,size:24})}),h(`span`,{className:`wui-tabbar-label`,children:ie})]})]}),h(`button`,{type:`button`,className:`app-scrim`,onClick:()=>Y(!1),"aria-label":`Close navigation`,tabIndex:J?0:-1})]})}function D(e,r){let i=e=>(e??[]).map(e=>Array.isArray(e.children)?{...e,children:i(e.children)}:{...e}).filter(e=>(e.children?.length??0)>0||!!e.href),o=e.map(e=>({...e,items:i(e.items)})).filter(e=>e.items.length>0),s=[],c=e=>{for(let t of e)s.push(t),t.children&&c(t.children)};for(let e of o)c(e.items);for(let e of s)n(`AppShell items`,O(e)),t(`AppShell`,`match`,e.match,b),t(`AppShell`,`iconVariant`,e.iconVariant,C);let l=null;if(r!=null&&!s.some(e=>e.active===!0)){let e=-1;for(let t of s){if(t.active!=null||t.children?.length&&!t.href)continue;let n=a(r,t.href,{exact:t.match===`exact`,also:t.matchAlso});if(n<0)continue;let i=t.match===`exact`&&a(r,t.href,{exact:!0})>=0?1/0:n;i>e&&(e=i,l=t)}}for(let e of s)e.active=e.active??e===l;return o}function O(e){return Object.fromEntries(Object.entries(e).filter(([e])=>!w.has(e)))}function k(e){let t=[],n=e=>{for(let r of e)r.children?.length?n(r.children):t.push(r)};for(let t of e)n(t.items);let r=t.filter(e=>e.tab);if(r.length===0)return null;let i=r.length<t.length,a=i?v:y;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 A({tab:e,linkComponent:t,iconVariant:n}){let i=`wui-tabbar-item${e.active?` active`:``}`,a=g(m,{children:[e.icon&&h(`span`,{className:`wui-tabbar-icon`,children:typeof e.icon==`string`?h(r,{name:e.icon,size:24,variant:e.iconVariant??n}):e.icon}),h(`span`,{className:`wui-tabbar-label`,children:e.tabLabel??e.label}),e.badge!=null&&h(`span`,{className:`wui-tabbar-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:e.badge})]}),o=e.active?`page`:void 0;return t?h(t,{className:i,to:e.href,"aria-current":o,children:a}):h(`a`,{className:i,href:e.href,"aria-current":o,children:a})}function j(e){for(let t of e){if(t.active)return t;let e=t.children?.length?j(t.children):void 0;if(e)return e}}function M({item:e,linkComponent:t,onNavigate:n,depth:i=0,iconVariant:a}){let o=i>0,s=i>1?` wui-nav-depth-${Math.min(i,6)}`:``,c=Array.isArray(e.children)&&e.children.length>0,u=c?j(e.children):void 0,d=!!u,f=u?u.key??u.href??u.label:null,[_,v]=p(d);l(()=>{f!=null&&v(!0)},[f]);let y=typeof e.label==`string`?e.label:void 0,b=!o&&e.icon&&h(`span`,{className:`app-nav-icon`,children:typeof e.icon==`string`?h(r,{name:e.icon,size:e.iconSize??22,variant:e.iconVariant??a}):e.icon}),x=e.badge!=null&&h(`span`,{className:`app-nav-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:e.badge}),S=g(m,{children:[b,h(`span`,{className:`app-nav-text`,children:e.label}),x,e.trailingIcon&&h(`span`,{className:`app-nav-trailing`,children:typeof e.trailingIcon==`string`?h(r,{name:e.trailingIcon,size:16}):e.trailingIcon})]}),C=e.active?`page`:void 0;if(c){let c=h(`div`,{className:`app-nav-sub${_?` expanded`:``}`,inert:!_,"aria-hidden":!_||void 0,children:h(`div`,{className:`app-nav-sub-inner`,children:e.children.map(e=>h(M,{item:e,linkComponent:t,onNavigate:n,depth:i+1,iconVariant:a},e.key??e.href))})});if(e.href){let i=t?h(t,{className:`wui-nav-split-link`,to:e.href,"aria-current":C,onClick:n,children:S}):h(`a`,{className:`wui-nav-split-link`,href:e.href,"aria-current":C,onClick:n,children:S});return g(m,{children:[g(`div`,{className:`app-nav-item has-children wui-nav-split${o?` app-nav-subitem`:``}${d||e.active?` active`:``}${s}`,"data-label":y,children:[i,h(`button`,{type:`button`,className:`app-nav-caret wui-nav-split-toggle`,"aria-expanded":_,"aria-label":`Show or hide ${y??``} pages`,onClick:()=>v(e=>!e),children:h(r,{name:`chevron-right`,size:16})})]}),c]})}return g(m,{children:[g(`button`,{type:`button`,className:`app-nav-item${o?` app-nav-subitem`:``} has-children${d?` active`:``}${s}`,"aria-expanded":_,"data-label":y,onClick:()=>v(e=>!e),children:[b,h(`span`,{className:`app-nav-text`,children:e.label}),x,h(`span`,{className:`app-nav-caret`,children:h(r,{name:`chevron-right`,size:16})})]}),c]})}let w=`app-nav-item${o?` app-nav-subitem`:``}${e.active?` active`:``}${s}`;return t?h(t,{className:w,to:e.href,"aria-current":C,"data-label":y,onClick:n,children:S}):h(`a`,{className:w,href:e.href,"aria-current":C,"data-label":y,onClick:n,children:S})}function N(){let[e,t]=p(!1),n=f(null);return l(()=>{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 P({config:e,linkComponent:t}){let n=u(),{open:a,setOpen:o,ref:s}=N(),{name:c,role:l,roles:d=[],photo:f,profileHref:p,profileLabel:_=`My profile`,onLogout:v,logoutAction:y,logoutLabel:b=`Sign out`,items:x=[]}=e;if(!c)throw Error(`<AppShell> userMenu.name is required; the trigger and the avatar are named from it.`);let S=d.map(e=>(e??``).trim()).filter(Boolean),C=()=>o(!1),w=(e,n,r,i)=>t?h(t,{className:`dropdown-item`,to:e,onClick:i,children:n},r):h(`a`,{className:`dropdown-item`,href:e,onClick:i,children:n},r),T=g(m,{children:[h(r,{name:`log-out`,size:18}),b]});return g(`div`,{className:`dropdown wui-usermenu`,ref:s,children:[g(`button`,{type:`button`,id:n,className:`wui-usermenu-trigger`,"aria-expanded":a,"aria-label":`Account menu for ${c}`,onClick:()=>o(e=>!e),children:[h(i,{name:c,src:f,tone:`auto`}),g(`span`,{className:`wui-usermenu-text`,children:[h(`span`,{className:`wui-usermenu-name`,children:c}),l&&h(`span`,{className:`wui-usermenu-role`,children:l})]}),h(r,{name:`chevron-down`,size:14,className:`wui-usermenu-caret`})]}),g(`div`,{className:`dropdown-menu dropdown-menu-end wui-usermenu-menu${a?` show`:``}`,"aria-labelledby":n,"data-bs-popper":a?`static`:void 0,children:[g(`div`,{className:`wui-usermenu-head`,children:[h(i,{name:c,src:f,size:`lg`,tone:`auto`}),g(`div`,{className:`wui-usermenu-who`,children:[h(`div`,{className:`wui-usermenu-name`,children:c}),l&&h(`div`,{className:`wui-usermenu-role`,children:l}),S.length>0&&g(`div`,{className:`wui-usermenu-roles`,children:[h(`span`,{className:`wui-usermenu-roles-label`,children:S.length===1?`Role:`:`Roles:`}),` ${S.join(`, `)}`]})]})]}),p&&w(p,g(m,{children:[h(r,{name:`user`,size:18}),_]}),void 0,C),x.map(e=>{if(e.divider)return h(`hr`,{className:`dropdown-divider`},e.key);let t=g(m,{children:[e.icon&&h(r,{name:e.icon,size:18}),e.label]}),n=()=>{e.onClick?.(),C()};return e.href?w(e.href,t,e.key,n):h(`button`,{type:`button`,className:`dropdown-item`,onClick:n,children:t},e.key)}),y?h(`form`,{method:`post`,action:y,className:`wui-usermenu-logout`,children:h(`button`,{type:`submit`,className:`dropdown-item danger`,children:T})}):v&&h(`button`,{type:`button`,className:`dropdown-item danger`,onClick:()=>{C(),v()},children:T})]})]})}function ee({config:e}){let t=u(),{open:n,setOpen:i,ref:a}=N(),{unread:o=0,items:s,loading:c=!1,onOpen:d,onMarkAllRead:_,viewAllHref:v,label:y=`Notifications`,emptyText:b=`You are all caught up.`}=e,[x,S]=p(``),C=f(o);l(()=>{C.current!==o&&(C.current=o,S(o===0?`No unread notifications`:`${T(o)} unread notifications`))},[o]);let w=null;return s?.length?w=h(`div`,{className:`wui-bell-items`,children:s.map((e,t)=>{let n=`wui-bell-item${e.read?` wui-bell-item-read`:``}`,i=g(m,{children:[h(`span`,{className:`wui-bell-dot`,"aria-hidden":`true`}),e.icon&&h(`span`,{className:`wui-bell-icon`,children:h(r,{name:e.icon,size:18})}),g(`span`,{className:`wui-bell-body`,children:[!e.read&&h(`span`,{className:`visually-hidden`,children:`Unread: `}),h(`span`,{className:`wui-bell-item-title`,children:e.title}),e.time&&h(`span`,{className:`wui-bell-when`,children:e.time})]})]});return e.href?h(`a`,{className:n,href:e.href,"data-id":e.id,children:i},e.id??t):h(`div`,{className:n,"data-id":e.id,children:i},e.id??t)})}):c?w=h(`div`,{className:`wui-bell-state`,children:`Loading…`}):s&&(w=h(`div`,{className:`wui-bell-state`,children:b})),g(`div`,{className:`dropdown wui-bell`,ref:a,children:[g(`button`,{type:`button`,id:t,className:`topbar-icon-btn wui-bell-trigger`,"aria-expanded":n,"aria-label":o===0?y:`${y}, ${T(o)} unread`,onClick:()=>{let e=!n;i(e),e&&d?.()},children:[h(r,{name:`notification`,size:20}),h(`span`,{className:`wui-bell-count`,"aria-hidden":`true`,hidden:o===0,children:T(o)})]}),h(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:x}),g(`div`,{className:`dropdown-menu dropdown-menu-end wui-bell-menu${n?` show`:``}`,"aria-labelledby":t,"data-bs-popper":n?`static`:void 0,children:[g(`div`,{className:`wui-bell-head`,children:[h(`span`,{className:`wui-bell-title`,children:y}),_&&h(`button`,{type:`button`,className:`wui-bell-markall`,onClick:_,children:`Mark all read`})]}),h(`div`,{className:`wui-bell-list`,"aria-busy":c||void 0,children:w}),v&&h(`a`,{className:`wui-bell-foot`,href:v,children:`View all`})]})]})}var F=e=>!!e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName));function te({config:e}){let t=u(),{value:n=``,onChange:i,results:a=null,loading:o=!1,onSelect:s,onSubmit:c,placeholder:m=`Search`}=e,[_,v]=p(!1),[y,b]=p(!1),[x,S]=p({results:null,index:-1}),C=x.results===a?x.index:-1,w=e=>S({results:a,index:e}),T=f(null),E=f(null),D=f([]),O=d(()=>(a??[]).flatMap(e=>e.hits??[]),[a]),k=a!=null&&!y,A=O.length;l(()=>{let e=e=>{e.key!==`/`||e.ctrlKey||e.metaKey||e.altKey||F(e.target)||(e.preventDefault(),v(!0),E.current?.focus())},t=e=>{T.current?.contains(e.target)||(b(!0),v(!1))};return document.addEventListener(`keydown`,e),document.addEventListener(`pointerdown`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`pointerdown`,t)}},[]);let j=e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(!k||A===0)return;e.preventDefault(),w((C+(e.key===`ArrowDown`?1:-1)+A)%A)}else e.key===`Enter`?k&&C>=0&&D.current[C]?(e.preventDefault(),D.current[C].click()):c&&n.trim()!==``&&(e.preventDefault(),c(n.trim())):e.key===`Escape`&&(k?(e.preventDefault(),b(!0)):_&&(e.preventDefault(),v(!1)))},M=-1;return D.current=[],g(`div`,{className:`wui-topsearch${_?` is-open`:``}${o?` is-loading`:``}`,ref:T,children:[h(`button`,{type:`button`,className:`topbar-icon-btn wui-topsearch-open`,"aria-label":m,"aria-expanded":_,"aria-controls":`${t}-panel`,onClick:()=>{let e=!_;v(e),e&&E.current?.focus()},children:h(r,{name:`search`,size:20})}),g(`div`,{className:`wui-topsearch-panel`,id:`${t}-panel`,children:[g(`div`,{className:`search-wrap`,children:[h(r,{name:`search`,size:18,className:`search-icon`}),h(`input`,{ref:E,type:`search`,className:`form-control input search-input`,id:`${t}-input`,placeholder:m,"aria-label":m,role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":k,"aria-controls":`${t}-list`,"aria-activedescendant":k&&C>=0?`${t}-opt-${C}`:void 0,autoComplete:`off`,value:n,onChange:e=>{b(!1),i?.(e.target.value)},onKeyDown:j})]}),h(`div`,{className:`wui-topsearch-results`,id:`${t}-list`,role:`listbox`,"aria-label":`Search results`,hidden:!k,children:k&&g(`div`,{className:`wui-topsearch-groups`,role:`presentation`,children:[A===0&&g(`div`,{className:`wui-topsearch-empty`,role:`option`,"aria-disabled":`true`,"aria-selected":`false`,children:[`No results for “`,n,`”`]}),a.filter(e=>e.hits?.length).map((e,n)=>g(`div`,{className:`wui-topsearch-group`,role:`group`,"aria-label":e.label??``,children:[e.label&&h(`div`,{className:`wui-topsearch-group-label`,role:`presentation`,children:e.label}),e.hits.map(e=>{M+=1;let n=M;return g(`a`,{className:`wui-topsearch-hit${n===C?` is-active`:``}`,role:`option`,"aria-selected":n===C,id:`${t}-opt-${n}`,href:e.href,ref:e=>{D.current[n]=e},onClick:t=>s?.(e,t),children:[e.icon&&h(`span`,{className:`wui-topsearch-hit-icon`,children:h(r,{name:e.icon,size:18})}),g(`span`,{className:`wui-topsearch-hit-text`,children:[h(`span`,{className:`wui-topsearch-hit-title`,children:e.title}),e.subtitle&&h(`span`,{className:`wui-topsearch-hit-sub`,children:e.subtitle})]})]},`${e.href}-${n}`)})]},e.label??n))]})})]}),h(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:k?A===0?`No results`:`${A} ${A===1?`result`:`results`}`:``})]})}export{E as default};
1
+ import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import{devWarn as t}from"../lib/devWarn.js";import n from"./warnInvalidValue.js";import r from"./warnUnknownProps.js";import i from"./AppIcon.js";import a from"./AppAvatar.js";import{navMatchScore as o}from"../lib/navMatch.js";import{SHELL_FOLDED_COOKIE as s,readNavFolded as c,readShellCollapsed as l,writeNavFolded as u,writeShellCollapsed as d}from"../lib/shellCookie.js";import{initScrollEdges as f}from"@webority/ui-elements/helpers";import{useEffect as p,useId as m,useMemo as h,useRef as g,useState as _}from"react";import{Fragment as v,jsx as y,jsxs as b}from"react/jsx-runtime";var x=99,S=4,C=5,w=/^[a-z0-9-]+$/,T=[`prefix`,`exact`],E=[`comfortable`,`compact`],D=[`default`,`primary`],O=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],k=new Set([`key`,`label`,`icon`,`iconVariant`,`iconSize`,`href`,`badge`,`badgeTone`,`badgeTitle`,`newUntil`,`trailingIcon`,`active`,`match`,`matchAlso`,`tab`,`tabLabel`,`children`]),A=e=>e>x?`${x}+`:String(e),j=new Intl.DateTimeFormat(`en-CA`,{timeZone:`Asia/Kolkata`}),M=e=>{if(typeof e!=`string`||!/^\d{4}-\d{2}-\d{2}$/.test(e))return!1;let t=new Date(`${e}T00:00:00Z`);return Number.isNaN(t.getTime())||t.toISOString().slice(0,10)!==e?!1:j.format(new Date)<=e};function N(t){let{groups:a=[],brand:o,sidebarStart:m,sidebarStartCompact:v,sidebarFooter:x,topbarStart:S,topbarEnd:C,footer:w,launcher:T,children:k,collapsed:A,onCollapsedChange:j,noSidebar:M=!1,density:N=`comfortable`,itemHeight:P,iconVariant:F,topbarTone:I=`default`,navLabel:L=`Main navigation`,linkComponent:R,currentPath:V,rememberCollapsed:H=!1,collapsedCookie:oe=`wui-shell-collapsed`,foldedCookie:U=s,tabBarLabel:se=`Quick navigation`,moreLabel:ce=`More`,userMenu:W,notifications:G,search:K,className:le=``,style:q,...ue}=t;r(`AppShell`,ue),n(`AppShell`,`density`,N,E),n(`AppShell`,`topbarTone`,I,D),n(`AppShell`,`iconVariant`,F,O);let de=P>0?{...q,"--wui-nav-item-height":`${P}px`}:q,[fe,pe]=_(()=>H&&A===void 0&&typeof document<`u`?l(oe)??!1:!1),[J,Y]=_(!1),[me,he]=_(!1),[ge,_e]=_(!1),X=g(null),Z=A??fe,ve=()=>{let e=!Z;A===void 0&&pe(e),H&&d(e,oe),j?.(e)},ye=a.some(e=>e.collapsible),[be,xe]=_(()=>ye&&typeof document<`u`?c(U):new Set),Se=e=>{let t=new Set(be);t.has(e)?t.delete(e):t.add(e),xe(t),u(t,U)},Q=h(()=>ee(a,V),[a,V]),$=M?null:te(Q);return p(()=>{let e=()=>he(window.scrollY>4);return e(),window.addEventListener(`scroll`,e,{passive:!0}),()=>window.removeEventListener(`scroll`,e)},[]),p(()=>{f()},[]),p(()=>{let e=X.current,t=e?.querySelector(`.app-nav-item[aria-current="page"]`);if(!e||!t)return;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();n.top<r.top?e.scrollTop-=r.top-n.top:n.bottom>r.bottom&&(e.scrollTop+=n.bottom-r.bottom)},[]),p(()=>{let e=X.current;if(!e)return;let t=()=>_e(e.scrollHeight>e.clientHeight);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[Q]),p(()=>{if(!J)return;let e=e=>{e.key===`Escape`&&Y(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[J]),b(`div`,{className:[`app-shell`,Z?`collapsed`:``,M?`no-sidebar`:``,J?`mobile-open`:``,le].filter(Boolean).join(` `),"data-density":N===`compact`?`compact`:void 0,"data-wui-folded-cookie":ye?U:void 0,style:de,...e(`AppShell`,t),...ue,children:[y(`a`,{className:`wui-skip-link`,href:`#main-content`,children:`Skip to content`}),b(`aside`,{className:`app-sidebar`,children:[o&&y(`div`,{className:`app-sidebar-brand`,children:o}),m&&y(`div`,{className:`app-sidebar-start`,children:m}),v&&y(`div`,{className:`app-sidebar-start-compact`,children:v}),y(`nav`,{className:`app-sidebar-scroll`,"aria-label":L,ref:X,tabIndex:ge?0:void 0,children:Q.map((e,t)=>{let n=e.items.map(e=>e.header==null?y(B,{item:e,linkComponent:R,onNavigate:()=>Y(!1),iconVariant:F},e.key??e.href??e.label):y(`div`,{className:`wui-nav-header`,children:e.header},e.key??e.header));if(!e.collapsible)return b(`div`,{className:`app-nav-group`,children:[e.label&&y(`div`,{className:`app-nav-group-label`,children:e.label}),n,e.after&&y(`div`,{className:`wui-nav-group-after`,children:e.after})]},e.key??e.label??`group-${t}`);let r=!be.has(e.key)||!!z(e.items),a=`wui-nav-group-${e.key}`;return b(`div`,{className:`app-nav-group wui-nav-group-collapsible${r?``:` wui-nav-group-folded`}`,"data-wui-nav-group":e.key,children:[b(`button`,{type:`button`,className:`app-nav-group-label wui-nav-group-toggle`,"aria-expanded":r,"aria-controls":a,onClick:()=>Se(e.key),children:[y(`span`,{className:`wui-nav-group-text`,children:e.label}),y(`span`,{className:`wui-nav-group-caret`,children:y(i,{name:`chevron-down`,size:16})})]}),b(`div`,{className:`wui-nav-group-body`,id:a,children:[n,e.after&&y(`div`,{className:`wui-nav-group-after`,children:e.after})]})]},e.key??`group-${t}`)})}),x&&y(`div`,{className:`app-sidebar-foot`,children:x}),!M&&y(`button`,{type:`button`,className:`app-sidebar-toggle`,onClick:ve,"aria-label":Z?`Expand navigation`:`Collapse navigation`,"aria-expanded":!Z,children:y(i,{name:`chevrons-left`,size:20})})]}),b(`div`,{className:`app-main`,children:[b(`header`,{className:`app-topbar${me?` scrolled`:``}`,"data-tone":I===`primary`?`primary`:void 0,children:[b(`div`,{className:`app-topbar-start`,children:[y(`button`,{type:`button`,className:`app-topbar-menu`,onClick:()=>Y(!0),"aria-label":`Open navigation`,"aria-expanded":J,children:y(i,{name:`menu`,size:18})}),S,K&&y(ae,{config:K})]}),b(`div`,{className:`app-topbar-end`,children:[C,G&&y(ie,{config:G}),W&&y(re,{config:W,linkComponent:R})]})]}),y(`main`,{className:`app-content`,id:`main-content`,children:k}),w&&y(`footer`,{className:`app-footer`,children:w})]}),T&&y(`div`,{className:`wui-shell-launcher`,children:T}),$&&b(`nav`,{className:`wui-tabbar`,"aria-label":se,children:[$.tabs.map(e=>y(ne,{tab:e,linkComponent:R,iconVariant:F},e.key??e.href)),$.hasMore&&b(`button`,{type:`button`,className:`wui-tabbar-item${$.moreActive?` active`:``}`,onClick:()=>Y(!0),children:[y(`span`,{className:`wui-tabbar-icon`,children:y(i,{name:`more`,size:24})}),y(`span`,{className:`wui-tabbar-label`,children:ce})]})]}),y(`button`,{type:`button`,className:`app-scrim`,onClick:()=>Y(!1),"aria-label":`Close navigation`,tabIndex:J?0:-1})]})}function ee(e,t){for(let t of e)t.collapsible&&R(t);let i=(e,t=!1)=>(e??[]).map(e=>Array.isArray(e.children)?{...e,children:i(e.children)}:{...e}).filter(e=>F(e)?t:(e.children?.length??0)>0||!!e.href),a=e.map(e=>({...e,items:I(i(e.items,!0))})).filter(e=>e.items.some(e=>!F(e))),s=[],c=e=>{for(let t of e)F(t)||(s.push(t),t.children&&c(t.children))};for(let e of a)c(e.items);for(let e of s)r(`AppShell items`,P(e)),n(`AppShell`,`match`,e.match,T),n(`AppShell`,`iconVariant`,e.iconVariant,O);let l=null;if(t!=null&&!s.some(e=>e.active===!0)){let e=-1;for(let n of s){if(n.active!=null||n.children?.length&&!n.href)continue;let r=o(t,n.href,{exact:n.match===`exact`,also:n.matchAlso});if(r<0)continue;let i=n.match===`exact`&&o(t,n.href,{exact:!0})>=0?1/0:r;i>e&&(e=i,l=n)}}for(let e of s)e.active=e.active??e===l;return a}function P(e){return Object.fromEntries(Object.entries(e).filter(([e])=>!k.has(e)))}var F=e=>e.header!=null;function I(e){return e.filter((t,n)=>{if(!F(t))return!0;let r=e.findIndex((e,t)=>t>n&&F(e));return e.slice(n+1,r<0?void 0:r).length>0})}var L=new Set;function R(e){if(e.key!=null&&w.test(e.key))return;let n=e.key==null?`<AppShell> a collapsible group needs a key so its folded state can be remembered.`:`<AppShell> collapsible group key "${e.key}" must use lower-case letters, digits and hyphens.`,r=!0;try{r=process.env.NODE_ENV!==`production`}catch{r=!0}!r||L.has(n)||(L.add(n),t(n))}function te(e){let t=[],n=e=>{for(let r of e)F(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?S:C;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 ne({tab:e,linkComponent:t,iconVariant:n}){let r=`wui-tabbar-item${e.active?` active`:``}`,a=b(v,{children:[e.icon&&y(`span`,{className:`wui-tabbar-icon`,children:typeof e.icon==`string`?y(i,{name:e.icon,size:24,variant:e.iconVariant??n}):e.icon}),y(`span`,{className:`wui-tabbar-label`,children:e.tabLabel??e.label}),e.badge!=null&&y(`span`,{className:`wui-tabbar-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:e.badge})]}),o=e.active?`page`:void 0;return t?y(t,{className:r,to:e.href,"aria-current":o,children:a}):y(`a`,{className:r,href:e.href,"aria-current":o,children:a})}function z(e){for(let t of e){if(t.active)return t;let e=t.children?.length?z(t.children):void 0;if(e)return e}}function B({item:e,linkComponent:t,onNavigate:n,depth:r=0,iconVariant:a}){let o=r>0,s=r>1?` wui-nav-depth-${Math.min(r,6)}`:``,c=Array.isArray(e.children)&&e.children.length>0,l=c?z(e.children):void 0,u=!!l,d=l?l.key??l.href??l.label:null,[f,m]=_(u);p(()=>{d!=null&&m(!0)},[d]);let h=typeof e.label==`string`?e.label:void 0,g=!o&&e.icon&&y(`span`,{className:`app-nav-icon`,children:typeof e.icon==`string`?y(i,{name:e.icon,size:e.iconSize??22,variant:e.iconVariant??a}):e.icon}),x=e.badge!=null&&y(`span`,{className:`app-nav-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:e.badge}),S=M(e.newUntil)&&y(`span`,{className:`wui-nav-new`,children:`New`}),C=b(v,{children:[g,y(`span`,{className:`app-nav-text`,children:e.label}),S,x,e.trailingIcon&&y(`span`,{className:`app-nav-trailing`,children:typeof e.trailingIcon==`string`?y(i,{name:e.trailingIcon,size:16}):e.trailingIcon})]}),w=e.active?`page`:void 0;if(c){let c=y(`div`,{className:`app-nav-sub${f?` expanded`:``}`,inert:!f,"aria-hidden":!f||void 0,children:y(`div`,{className:`app-nav-sub-inner`,children:e.children.map(e=>y(B,{item:e,linkComponent:t,onNavigate:n,depth:r+1,iconVariant:a},e.key??e.href))})});if(e.href){let r=t?y(t,{className:`wui-nav-split-link`,to:e.href,"aria-current":w,onClick:n,children:C}):y(`a`,{className:`wui-nav-split-link`,href:e.href,"aria-current":w,onClick:n,children:C});return b(v,{children:[b(`div`,{className:`app-nav-item has-children wui-nav-split${o?` app-nav-subitem`:``}${u||e.active?` active`:``}${s}`,"data-label":h,children:[r,y(`button`,{type:`button`,className:`app-nav-caret wui-nav-split-toggle`,"aria-expanded":f,"aria-label":`Show or hide ${h??``} pages`,onClick:()=>m(e=>!e),children:y(i,{name:`chevron-right`,size:16})})]}),c]})}return b(v,{children:[b(`button`,{type:`button`,className:`app-nav-item${o?` app-nav-subitem`:``} has-children${u?` active`:``}${s}`,"aria-expanded":f,"data-label":h,onClick:()=>m(e=>!e),children:[g,y(`span`,{className:`app-nav-text`,children:e.label}),S,x,y(`span`,{className:`app-nav-caret`,children:y(i,{name:`chevron-right`,size:16})})]}),c]})}let T=`app-nav-item${o?` app-nav-subitem`:``}${e.active?` active`:``}${s}`;return t?y(t,{className:T,to:e.href,"aria-current":w,"data-label":h,onClick:n,children:C}):y(`a`,{className:T,href:e.href,"aria-current":w,"data-label":h,onClick:n,children:C})}function V(){let[e,t]=_(!1),n=g(null);return p(()=>{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 re({config:e,linkComponent:t}){let n=m(),{open:r,setOpen:o,ref:s}=V(),{name:c,role:l,roles:u=[],photo:d,profileHref:f,profileLabel:p=`My profile`,onLogout:h,logoutAction:g,logoutLabel:_=`Sign out`,items:x=[]}=e;if(!c)throw Error(`<AppShell> userMenu.name is required; the trigger and the avatar are named from it.`);let S=u.map(e=>(e??``).trim()).filter(Boolean),C=()=>o(!1),w=(e,n,r,i)=>t?y(t,{className:`dropdown-item`,to:e,onClick:i,children:n},r):y(`a`,{className:`dropdown-item`,href:e,onClick:i,children:n},r),T=b(v,{children:[y(i,{name:`log-out`,size:18}),_]});return b(`div`,{className:`dropdown wui-usermenu`,ref:s,children:[b(`button`,{type:`button`,id:n,className:`wui-usermenu-trigger`,"aria-expanded":r,"aria-label":`Account menu for ${c}`,onClick:()=>o(e=>!e),children:[y(a,{name:c,src:d,tone:`auto`}),b(`span`,{className:`wui-usermenu-text`,children:[y(`span`,{className:`wui-usermenu-name`,children:c}),l&&y(`span`,{className:`wui-usermenu-role`,children:l})]}),y(i,{name:`chevron-down`,size:14,className:`wui-usermenu-caret`})]}),b(`div`,{className:`dropdown-menu dropdown-menu-end wui-usermenu-menu${r?` show`:``}`,"aria-labelledby":n,"data-bs-popper":r?`static`:void 0,children:[b(`div`,{className:`wui-usermenu-head`,children:[y(a,{name:c,src:d,size:`lg`,tone:`auto`}),b(`div`,{className:`wui-usermenu-who`,children:[y(`div`,{className:`wui-usermenu-name`,children:c}),l&&y(`div`,{className:`wui-usermenu-role`,children:l}),S.length>0&&b(`div`,{className:`wui-usermenu-roles`,children:[y(`span`,{className:`wui-usermenu-roles-label`,children:S.length===1?`Role:`:`Roles:`}),` ${S.join(`, `)}`]})]})]}),f&&w(f,b(v,{children:[y(i,{name:`user`,size:18}),p]}),void 0,C),x.map(e=>{if(e.divider)return y(`hr`,{className:`dropdown-divider`},e.key);let t=b(v,{children:[e.icon&&y(i,{name:e.icon,size:18}),e.label]}),n=()=>{e.onClick?.(),C()};return e.href?w(e.href,t,e.key,n):y(`button`,{type:`button`,className:`dropdown-item`,onClick:n,children:t},e.key)}),g?y(`form`,{method:`post`,action:g,className:`wui-usermenu-logout`,children:y(`button`,{type:`submit`,className:`dropdown-item danger`,children:T})}):h&&y(`button`,{type:`button`,className:`dropdown-item danger`,onClick:()=>{C(),h()},children:T})]})]})}function ie({config:e}){let t=m(),{open:n,setOpen:r,ref:a}=V(),{unread:o=0,items:s,loading:c=!1,onOpen:l,onMarkAllRead:u,viewAllHref:d,label:f=`Notifications`,emptyText:h=`You are all caught up.`}=e,[x,S]=_(``),C=g(o);p(()=>{C.current!==o&&(C.current=o,S(o===0?`No unread notifications`:`${A(o)} unread notifications`))},[o]);let w=null;return s?.length?w=y(`div`,{className:`wui-bell-items`,children:s.map((e,t)=>{let n=`wui-bell-item${e.read?` wui-bell-item-read`:``}`,r=b(v,{children:[y(`span`,{className:`wui-bell-dot`,"aria-hidden":`true`}),e.icon&&y(`span`,{className:`wui-bell-icon`,children:y(i,{name:e.icon,size:18})}),b(`span`,{className:`wui-bell-body`,children:[!e.read&&y(`span`,{className:`visually-hidden`,children:`Unread: `}),y(`span`,{className:`wui-bell-item-title`,children:e.title}),e.time&&y(`span`,{className:`wui-bell-when`,children:e.time})]})]});return e.href?y(`a`,{className:n,href:e.href,"data-id":e.id,children:r},e.id??t):y(`div`,{className:n,"data-id":e.id,children:r},e.id??t)})}):c?w=y(`div`,{className:`wui-bell-state`,children:`Loading…`}):s&&(w=y(`div`,{className:`wui-bell-state`,children:h})),b(`div`,{className:`dropdown wui-bell`,ref:a,children:[b(`button`,{type:`button`,id:t,className:`topbar-icon-btn wui-bell-trigger`,"aria-expanded":n,"aria-label":o===0?f:`${f}, ${A(o)} unread`,onClick:()=>{let e=!n;r(e),e&&l?.()},children:[y(i,{name:`notification`,size:20}),y(`span`,{className:`wui-bell-count`,"aria-hidden":`true`,hidden:o===0,children:A(o)})]}),y(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:x}),b(`div`,{className:`dropdown-menu dropdown-menu-end wui-bell-menu${n?` show`:``}`,"aria-labelledby":t,"data-bs-popper":n?`static`:void 0,children:[b(`div`,{className:`wui-bell-head`,children:[y(`span`,{className:`wui-bell-title`,children:f}),u&&y(`button`,{type:`button`,className:`wui-bell-markall`,onClick:u,children:`Mark all read`})]}),y(`div`,{className:`wui-bell-list`,"aria-busy":c||void 0,children:w}),d&&y(`a`,{className:`wui-bell-foot`,href:d,children:`View all`})]})]})}var H=e=>!!e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName));function ae({config:e}){let t=m(),{value:n=``,onChange:r,results:a=null,loading:o=!1,onSelect:s,onSubmit:c,placeholder:l=`Search`}=e,[u,d]=_(!1),[f,v]=_(!1),[x,S]=_({results:null,index:-1}),C=x.results===a?x.index:-1,w=e=>S({results:a,index:e}),T=g(null),E=g(null),D=g([]),O=h(()=>(a??[]).flatMap(e=>e.hits??[]),[a]),k=a!=null&&!f,A=O.length;p(()=>{let e=e=>{e.key!==`/`||e.ctrlKey||e.metaKey||e.altKey||H(e.target)||(e.preventDefault(),d(!0),E.current?.focus())},t=e=>{T.current?.contains(e.target)||(v(!0),d(!1))};return document.addEventListener(`keydown`,e),document.addEventListener(`pointerdown`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`pointerdown`,t)}},[]);let j=e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(!k||A===0)return;e.preventDefault(),w((C+(e.key===`ArrowDown`?1:-1)+A)%A)}else e.key===`Enter`?k&&C>=0&&D.current[C]?(e.preventDefault(),D.current[C].click()):c&&n.trim()!==``&&(e.preventDefault(),c(n.trim())):e.key===`Escape`&&(k?(e.preventDefault(),v(!0)):u&&(e.preventDefault(),d(!1)))},M=-1;return D.current=[],b(`div`,{className:`wui-topsearch${u?` is-open`:``}${o?` is-loading`:``}`,ref:T,children:[y(`button`,{type:`button`,className:`topbar-icon-btn wui-topsearch-open`,"aria-label":l,"aria-expanded":u,"aria-controls":`${t}-panel`,onClick:()=>{let e=!u;d(e),e&&E.current?.focus()},children:y(i,{name:`search`,size:20})}),b(`div`,{className:`wui-topsearch-panel`,id:`${t}-panel`,children:[b(`div`,{className:`search-wrap`,children:[y(i,{name:`search`,size:18,className:`search-icon`}),y(`input`,{ref:E,type:`search`,className:`form-control input search-input`,id:`${t}-input`,placeholder:l,"aria-label":l,role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":k,"aria-controls":`${t}-list`,"aria-activedescendant":k&&C>=0?`${t}-opt-${C}`:void 0,autoComplete:`off`,value:n,onChange:e=>{v(!1),r?.(e.target.value)},onKeyDown:j})]}),y(`div`,{className:`wui-topsearch-results`,id:`${t}-list`,role:`listbox`,"aria-label":`Search results`,hidden:!k,children:k&&b(`div`,{className:`wui-topsearch-groups`,role:`presentation`,children:[A===0&&b(`div`,{className:`wui-topsearch-empty`,role:`option`,"aria-disabled":`true`,"aria-selected":`false`,children:[`No results for “`,n,`”`]}),a.filter(e=>e.hits?.length).map((e,n)=>b(`div`,{className:`wui-topsearch-group`,role:`group`,"aria-label":e.label??``,children:[e.label&&y(`div`,{className:`wui-topsearch-group-label`,role:`presentation`,children:e.label}),e.hits.map(e=>{M+=1;let n=M;return b(`a`,{className:`wui-topsearch-hit${n===C?` is-active`:``}`,role:`option`,"aria-selected":n===C,id:`${t}-opt-${n}`,href:e.href,ref:e=>{D.current[n]=e},onClick:t=>s?.(e,t),children:[e.icon&&y(`span`,{className:`wui-topsearch-hit-icon`,children:y(i,{name:e.icon,size:18})}),b(`span`,{className:`wui-topsearch-hit-text`,children:[y(`span`,{className:`wui-topsearch-hit-title`,children:e.title}),e.subtitle&&y(`span`,{className:`wui-topsearch-hit-sub`,children:e.subtitle})]})]},`${e.href}-${n}`)})]},e.label??n))]})})]}),y(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:k?A===0?`No results`:`${A} ${A===1?`result`:`results`}`:``})]})}export{N as default};
@@ -2,7 +2,7 @@
2
2
  "format": "webority-guidance/1",
3
3
  "package": {
4
4
  "name": "@webority/ui-react",
5
- "version": "0.102.3"
5
+ "version": "0.104.0"
6
6
  },
7
7
  "components": [
8
8
  {
@@ -1 +1 @@
1
- var e=`wui-shell-collapsed`,t=e=>e instanceof DOMException&&e.name===`SecurityError`;function n(n=e,r=document){let i;try{i=r.cookie}catch(e){if(t(e))return null;throw e}for(let e of i.split(`;`)){let t=e.indexOf(`=`);if(t<0||e.slice(0,t).trim()!==n)continue;let r=e.slice(t+1).trim();return r===`1`||r!==`0`&&null}return null}function r(n,r=e,i=document){try{i.cookie=`${r}=${n?`1`:`0`}; Path=/; Max-Age=31536000; SameSite=Lax`}catch(e){if(!t(e))throw e}}export{e as SHELL_COLLAPSED_COOKIE,n as readShellCollapsed,r as writeShellCollapsed};
1
+ var e=`wui-shell-collapsed`,t=31536e3,n=e=>e instanceof DOMException&&e.name===`SecurityError`;function r(t=e,r=document){let i;try{i=r.cookie}catch(e){if(n(e))return null;throw e}for(let e of i.split(`;`)){let n=e.indexOf(`=`);if(n<0||e.slice(0,n).trim()!==t)continue;let r=e.slice(n+1).trim();return r===`1`||r!==`0`&&null}return null}function i(r,i=e,a=document){try{a.cookie=`${i}=${r?`1`:`0`}; Path=/; Max-Age=${t}; SameSite=Lax`}catch(e){if(!n(e))throw e}}var a=`wui-nav-folded`;function o(e=a,t=document){let r;try{r=t.cookie}catch(e){if(n(e))return new Set;throw e}for(let t of r.split(`;`)){let n=t.indexOf(`=`);if(!(n<0||t.slice(0,n).trim()!==e))return new Set(t.slice(n+1).trim().split(`.`).filter(Boolean))}return new Set}function s(e,r=a,i=document){try{i.cookie=`${r}=${[...e].join(`.`)}; Path=/; Max-Age=${t}; SameSite=Lax`}catch(e){if(!n(e))throw e}}export{e as SHELL_COLLAPSED_COOKIE,a as SHELL_FOLDED_COOKIE,o as readNavFolded,r as readShellCollapsed,s as writeNavFolded,i as writeShellCollapsed};
@@ -16,6 +16,8 @@
16
16
  * @param {'auto'|'top'|'bottom'|'start'|'end'} [props.tooltipPlacement]
17
17
  * @param {string} [props.shortcut]
18
18
  * @param {boolean} [props.danger]
19
+ * @param {"comfortable"|"compact"} [props.density]
20
+ * @param {boolean} [props.neutral]
19
21
  * @param {boolean} [props.disabled]
20
22
  * @param {number} [props.size]
21
23
  * @param {() => void} [props.onClick]
@@ -48,6 +50,16 @@ export default function AppActionIcon(props: {
48
50
  * @default false
49
51
  */
50
52
  danger?: boolean;
53
+ /**
54
+ * How much room surrounds the glyph: comfortable keeps an 8px ring, compact 4px (a 16px glyph in a 24px disc).
55
+ * @default "comfortable"
56
+ */
57
+ density?: "comfortable" | "compact";
58
+ /**
59
+ * Muted ink with a muted surface on hover, for an action on a card or a quiet surface. Not with danger.
60
+ * @default false
61
+ */
62
+ neutral?: boolean;
51
63
  /**
52
64
  * Turns the action off.
53
65
  * @default false
@@ -16,6 +16,8 @@ declare const AppCheckbox: import("react").ForwardRefExoticComponent<{
16
16
  error?: string;
17
17
  /** Helper text below the control. Hidden while an error is shown. */
18
18
  hint?: string;
19
+ /** circle draws a round box with the tick inside, for a task that is completed. Omit it for the square box. */
20
+ shape?: 'circle';
19
21
  /**
20
22
  * Extra classes on the element.
21
23
  * @default ""